diff --git a/.changepacks/changepack_log_Ob3pmJphiH7bOr1xjABTd.json b/.changepacks/changepack_log_Ob3pmJphiH7bOr1xjABTd.json deleted file mode 100644 index 8e1e301..0000000 --- a/.changepacks/changepack_log_Ob3pmJphiH7bOr1xjABTd.json +++ /dev/null @@ -1 +0,0 @@ -{"changes":{"packages/hookform/package.json":"Minor","packages/zod/package.json":"Patch","packages/generator/package.json":"Patch"},"note":"Support hookform","date":"2026-01-04T13:28:49.692436300Z"} \ No newline at end of file diff --git a/.changepacks/changepack_log_URa6hitqbZIeSM3ThRmXA.json b/.changepacks/changepack_log_URa6hitqbZIeSM3ThRmXA.json deleted file mode 100644 index ce013cf..0000000 --- a/.changepacks/changepack_log_URa6hitqbZIeSM3ThRmXA.json +++ /dev/null @@ -1 +0,0 @@ -{"changes":{"packages/core/package.json":"Patch","packages/rsbuild-plugin/package.json":"Patch","packages/webpack-plugin/package.json":"Patch","packages/zod/package.json":"Patch","packages/generator/package.json":"Patch","packages/next-plugin/package.json":"Patch","packages/fetch/package.json":"Patch","packages/hookform/package.json":"Patch","packages/utils/package.json":"Patch","packages/vite-plugin/package.json":"Patch","packages/react-query/package.json":"Patch","packages/ui/package.json":"Minor"},"note":"Implement ui","date":"2026-01-05T04:19:18.456233400Z"} \ No newline at end of file diff --git a/.changepacks/changepack_log_bTLoWLJTloIs9pkFN38NE.json b/.changepacks/changepack_log_bTLoWLJTloIs9pkFN38NE.json deleted file mode 100644 index 82f3c77..0000000 --- a/.changepacks/changepack_log_bTLoWLJTloIs9pkFN38NE.json +++ /dev/null @@ -1 +0,0 @@ -{"changes":{"packages/webpack-plugin/package.json":"Patch","packages/next-plugin/package.json":"Patch","packages/utils/package.json":"Patch","packages/vite-plugin/package.json":"Patch","packages/zod/package.json":"Patch","packages/fetch/package.json":"Patch","packages/core/package.json":"Patch","packages/rsbuild-plugin/package.json":"Patch","packages/generator/package.json":"Patch","packages/react-query/package.json":"Patch"},"note":"implement zod","date":"2026-01-04T11:21:33.541821Z"} \ No newline at end of file diff --git a/.changepacks/changepack_log_pD6lylXWV9brQzAlQutNu.json b/.changepacks/changepack_log_pD6lylXWV9brQzAlQutNu.json deleted file mode 100644 index 0c38361..0000000 --- a/.changepacks/changepack_log_pD6lylXWV9brQzAlQutNu.json +++ /dev/null @@ -1 +0,0 @@ -{"changes":{"packages/zod/package.json":"Minor"},"note":"Implement zod","date":"2026-01-04T11:21:57.546730400Z"} \ No newline at end of file diff --git a/.changepacks/config.json b/.changepacks/config.json index 626b5da..4270e89 100644 --- a/.changepacks/config.json +++ b/.changepacks/config.json @@ -3,6 +3,9 @@ "baseBranch": "main", "latestPackage": null, "publish": { - "node": "bun publish" + "node": "bun pm pack --quiet --filename publish.tgz && npm publish ./publish.tgz" + }, + "publishDryRun": { + "node": "bun pm pack --quiet --filename publish.tgz && npm publish ./publish.tgz --dry-run" } } diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 045f6ab..4db0702 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v7 - uses: oven-sh/setup-bun@v2 with: @@ -27,7 +27,14 @@ jobs: - run: bun lint - run: bun run build - run: bun lint - - run: bun test --coverage + - run: bun test --coverage --coverage-reporter=lcov --coverage-reporter=text + - name: Upload to codecov.io + uses: codecov/codecov-action@v7 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + files: ./coverage/lcov.info + if: github.ref == 'refs/heads/main' changepacks: name: changepacks @@ -39,36 +46,47 @@ jobs: # Actions > General > Workflow permissions for creating pull request # Create brench to create pull request contents: write + id-token: write needs: - check steps: - - uses: actions/checkout@v5 - - uses: changepacks/action@main - id: changepacks - outputs: - changepacks: ${{ steps.changepacks.outputs.changepacks }} - - publish: - runs-on: ubuntu-latest - needs: - - changepacks - if: contains(needs.changepacks.outputs.changepacks, 'package.json') - steps: - - name: Checkout - uses: actions/checkout@v5 - + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + fetch-tags: true - uses: oven-sh/setup-bun@v2 with: bun-version: latest + - name: Install Node.js + uses: actions/setup-node@v7 + with: + registry-url: "https://registry.npmjs.org" + node-version: 24 - run: bun i - run: bun run build - - run: bun test --coverage --coverage-reporter=lcov - - name: Upload to codecov.io - uses: codecov/codecov-action@v5 + - name: Verify publish tarballs + shell: bash + run: | + set -euo pipefail + for manifest in packages/*/package.json; do + package_dir="$(dirname "$manifest")" + pack_dir="$RUNNER_TEMP/publish-verify/${package_dir//\//-}" + mkdir -p "$pack_dir" + (cd "$package_dir" && bun pm pack --quiet --destination "$pack_dir") + tarballs=("$pack_dir"/*.tgz) + if [[ "${#tarballs[@]}" -ne 1 ]]; then + echo "Expected one tarball for $package_dir" >&2 + exit 1 + fi + packed_manifest="$(tar -xOf "${tarballs[0]}" package/package.json)" + if grep -q 'workspace:' <<< "$packed_manifest"; then + echo "Unresolved workspace dependency in $package_dir" >&2 + exit 1 + fi + done + - uses: changepacks/action@main + id: changepacks with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - files: ./coverage/lcov.info - - run: bunx @changepacks/cli publish --yes - env: - NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} + publish: true + outputs: + changepacks: ${{ steps.changepacks.outputs.changepacks }} diff --git a/.gitignore b/.gitignore index 6a4f18e..ad41264 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json .DS_Store .claude +.sisyphus +.omc +.omo \ No newline at end of file diff --git a/README.md b/README.md index 16c3534..acf2cb6 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,14 @@ Just write API calls — the types are already there. ## 📖 Table of Contents + - [Features](#-features) - [Quick Start](#-quick-start) - [Cold Typing vs Boild Typing](#-cold-typing-vs-boild-typing) - [Packages](#-packages) - [API Usage](#-api-usage) - [Multiple API Servers](#-multiple-api-servers) +- [Next.js Server Actions](#-nextjs-server-actions) - [React Query Integration](#-react-query-integration) - [Advanced Usage](#-advanced-usage) - [Configuration Options](#-configuration-options) @@ -53,7 +55,7 @@ Just write API calls — the types are already there. ### **🪝 Fetch-compatible design** devup-api feels like using `fetch`, but with superpowers: -- Path params automatically replaced +- Path params automatically replaced and URL-encoded (`.` and `..` are rejected) - Query/body/header types enforced - Typed success & error responses - Optional runtime schema validation @@ -64,6 +66,11 @@ devup-api feels like using `fetch`, but with superpowers: - Automatic type generation during build time - Zero runtime overhead +### **⚡ Generated Next.js Server Actions** +- Generate top-level Server Action functions from OpenAPI operationIds +- Import actions from `@devup-api/fetch/server` instead of reaching into `df` +- Cold typing works before generated files exist, then becomes fully typed after the plugin runs + --- ## 🚀 Quick Start @@ -714,6 +721,57 @@ type Product = DevupObject<'response', 'openapi2.json'>['Product'] // From open --- +## ⚡ Next.js Server Actions + +devup-api generates named Server Action wrappers for operationId-based API calls by default. This is useful in Next.js App Router projects when you want to call server-side API functions from Client Components without manually writing one action per endpoint. + +Set `serverActions.baseUrl` when generated actions should call a specific API origin: + +```ts +// next.config.ts +import devupApi from '@devup-api/next-plugin' + +export default devupApi({ + reactStrictMode: true, + serverActions: { + baseUrl: 'https://api.example.com', + }, +}) +``` + +Then import generated actions from the virtual server module: + +```tsx +'use client' + +import { getUser } from '@devup-api/fetch/server' + +export function UserButton() { + return ( + + ) +} +``` + +The generated `df/server.ts` file contains `'use server'` and exports one named async function for every operationId in your OpenAPI schemas. You should import from `@devup-api/fetch/server`, not from `df/server.ts` directly; the build plugin aliases that module to the generated file. + +Generated actions return `DevupApiResponse`. This keeps the same `data` / `error` / `isOk` / `isError` shape as normal `api.get()` calls, while replacing the native `Response` instance with a plain serializable response object that can cross the Server Action boundary. Its headers leave out `Set-Cookie` and `Set-Cookie2`, matching what browser `fetch` exposes to JavaScript. + +During cold typing, `@devup-api/fetch/server` is still importable before `df` exists. The fallback keeps initial setup from failing, and the generated module replaces it with strict operation-specific types after `dev` or `build` runs. + +Server Actions are enabled by default. Disable generation explicitly with `serverActions: false` or `serverActions: { enabled: false }`. + +--- + ## 🔄 React Query Integration devup-api provides first-class support for TanStack React Query through the `@devup-api/react-query` package. All hooks are fully typed based on your OpenAPI schema. @@ -786,7 +844,7 @@ function UserList() { { // React Query options staleTime: 5 * 60 * 1000, // 5 minutes - cacheTime: 10 * 60 * 1000, // 10 minutes + gcTime: 10 * 60 * 1000, // 10 minutes refetchOnWindowFocus: false, retry: 3, } @@ -835,8 +893,8 @@ function CreateUserForm() {
- {mutation.isError &&
Error: {mutation.error.message}
} {mutation.isSuccess &&
User created successfully!
} @@ -1531,6 +1589,16 @@ interface DevupApiOptions { * @default true */ responseDefaultNonNullable?: boolean + + /** + * Generate operationId-based Server Action wrappers and expose them via + * @devup-api/fetch/server. + * @default true + */ + serverActions?: boolean | { + enabled?: boolean + baseUrl?: string + } } ``` @@ -1542,7 +1610,8 @@ interface DevupApiOptions { 2. Extracts paths, methods, schemas, parameters, and request bodies 3. Generates TypeScript interface definitions automatically 4. Creates a URL map for operationId-based API calls -5. Builds a typed wrapper around `fetch()` with full type safety +5. Generates named Server Actions in `df/server.ts` by default +6. Builds a typed wrapper around `fetch()` with full type safety --- diff --git a/SKILL.md b/SKILL.md index 8648835..58b48f2 100644 --- a/SKILL.md +++ b/SKILL.md @@ -1,179 +1,579 @@ --- name: devup-api -description: A tool for generating fully typed API clients from OpenAPI schemas. It offers a fetch-compatible API, auto-generated types without generics, and integrates with major build tools like Vite, Next.js, and Webpack. +description: | + Type-safe API client generator from OpenAPI schemas with full ecosystem support. + + TRIGGER WHEN: + - Setting up API client with OpenAPI schema (@devup-api/fetch) + - Making typed API requests (GET, POST, PUT, PATCH, DELETE) + - Using React Query hooks (@devup-api/react-query) + - Using Zod validation schemas (@devup-api/zod) + - Building forms with react-hook-form (@devup-api/hookform) + - Creating CRUD interfaces (@devup-api/ui) + - Configuring Vite/Next.js/Webpack/Rsbuild plugins + - Implementing authentication middleware + - Using DevupObject for type references --- -# devup-api +# devup-api Usage Guide -This skill helps you invoke the `devup-api` library to generate and use fully typed API clients in your TypeScript projects. `devup-api` reads your `openapi.json` and automatically generates a type-safe client that feels like `fetch` but with strict typing for paths, parameters, bodies, and responses. +Type-safe API client from OpenAPI. Zero generics, auto-generated types. -## Key Features +## Setup -- **OpenAPI-driven:** Generates types directly from `openapi.json`. -- **Fetch-compatible:** Ergonomic API similar to standard `fetch`. -- **Zero Generics:** No complex generic types to manage manually. -- **Build Tool Integration:** Plugins for Vite, Next.js, Webpack, and Rsbuild. -- **React Query Integration:** First-class support for TanStack React Query with `@devup-api/react-query`. -- **Multiple API Servers:** Support for multiple OpenAPI schemas with `serverName` and `DevupObject` type access. -- **Two-phase Typing:** "Cold Typing" (relaxed types for initial setup) and "Boild Typing" (strict types after generation - named after "boiled" and inspired by "boilerplate"). - -## Usage Instructions - -### 1. Installation - -Install the core fetch package and the plugin for your build tool: +### Install ```bash -npm install @devup-api/fetch @devup-api/vite-plugin # For Vite -# OR -npm install @devup-api/fetch @devup-api/next-plugin # For Next.js -# See README for Webpack and Rsbuild +# Core + Build Plugin (choose one) +npm install @devup-api/fetch @devup-api/vite-plugin # Vite +npm install @devup-api/fetch @devup-api/next-plugin # Next.js +npm install @devup-api/fetch @devup-api/webpack-plugin # Webpack +npm install @devup-api/fetch @devup-api/rsbuild-plugin # Rsbuild + +# Optional Integrations +npm install @devup-api/react-query @tanstack/react-query # React Query +npm install @devup-api/zod zod # Zod validation +npm install @devup-api/hookform react-hook-form zod # Hook Form +npm install @devup-api/ui @tanstack/react-query react-hook-form zod # CRUD UI ``` -### 2. Configuration +### Configure Build Tool -Add the plugin to your build configuration (e.g., `vite.config.ts`, `next.config.ts`). - -**Vite Example:** ```ts -import { defineConfig } from 'vite' +// vite.config.ts import devupApi from '@devup-api/vite-plugin' +export default defineConfig({ plugins: [devupApi()] }) -export default defineConfig({ - plugins: [devupApi()], -}) +// next.config.ts +import devupApi from '@devup-api/next-plugin' +export default devupApi({ reactStrictMode: true }) ``` -### 3. TypeScript Setup - -Include the generated types in your `tsconfig.json`: +### tsconfig.json ```json -{ - "include": [ - "src", - "df/**/*.d.ts" - ] -} +{ "include": ["src", "df/**/*.d.ts"] } ``` -*Note: `df` is the default temporary directory.* -### 4. Create and Use Client +Place `openapi.json` in project root, run `npm run dev`. + +--- + +## @devup-api/fetch — API Client + +### Create Client ```ts -import { createApi } from '@devup-api/fetch' +import { createApi, type DevupObject } from '@devup-api/fetch' -// Initialize const api = createApi('https://api.example.com') +// or with options +const api = createApi({ baseUrl: 'https://api.example.com', headers: { 'X-Custom': 'value' } }) +``` -// GET Request (using operationId or path) -const users = await api.get('getUsers', { query: { page: 1 } }) -// OR +### HTTP Methods + +```ts +// GET +const users = await api.get('getUsers', { query: { page: 1, limit: 20 } }) const user = await api.get('/users/{id}', { params: { id: '123' } }) -// POST Request -const newUser = await api.post('createUser', { - body: { name: 'Alice', email: 'alice@example.com' } -}) +// POST +const created = await api.post('createUser', { body: { name: 'John', email: 'john@example.com' } }) + +// PUT / PATCH / DELETE +await api.put('/users/{id}', { params: { id: '1' }, body: { name: 'Jane', email: 'jane@example.com' } }) +await api.patch('/users/{id}', { params: { id: '1' }, body: { name: 'Jane' } }) +await api.delete('/users/{id}', { params: { id: '1' } }) ``` -## Examples +### Response Handling -### Complete Workflow +```ts +const result = await api.get('getUser', { params: { id: '1' } }) -1. **Project Setup:** Ensure `openapi.json` is in your project root. -2. **Configure:** Add `devup-api/vite-plugin` to `vite.config.ts`. -3. **Run:** Run `npm run dev` or `npm run build`. This generates `df/api.d.ts`. -4. **Code:** Use `createApi` to make requests. IntelliSense will now show available paths and required parameters. +if (result.data) { + console.log(result.data.name) // typed response +} else if (result.error) { + console.error(result.error) // typed error +} +console.log(result.response.status) // raw Response +``` -### Handling Responses +### DevupObject (Type References) -`devup-api` returns an object with either `data` (success) or `error` (failure). +Use `DevupObject` directly in type annotations without redefining types: ```ts -const response = await api.get('getUser', { params: { id: '1' } }) +// Direct usage in variable declarations +const user: DevupObject['User'] = await fetchUser() +const body: DevupObject<'request'>['CreateUserBody'] = { name: 'John', email: 'john@example.com' } +const error: DevupObject<'error'>['ErrorResponse'] = result.error -if (response.data) { - console.log('User Name:', response.data.name) -} else if (response.error) { - console.error('Error:', response.error.message) -} +// Direct usage in function parameters +function displayUser(user: DevupObject['User']) { /* ... */ } + +// Direct usage in component props +function UserCard({ user }: { user: DevupObject['User'] }) { /* ... */ } + +// Multi-server types +const product: DevupObject<'response', 'openapi2.json'>['Product'] = data +``` + +### Middleware + +```ts +// Auth +api.use({ + onRequest: async ({ request }) => { + const token = localStorage.getItem('token') + if (token) { + const headers = new Headers(request.headers) + headers.set('Authorization', `Bearer ${token}`) + return new Request(request, { headers }) + } + } +}) + +// Token Refresh +api.use({ + onResponse: async ({ request, response }) => { + if (response.status === 401) { + const newToken = await refreshToken() + const headers = new Headers(request.headers) + headers.set('Authorization', `Bearer ${newToken}`) + return fetch(new Request(request, { headers })) + } + } +}) ``` -## Using DevupObject for Type References +--- -`DevupObject` provides direct access to generated schema types: +## @devup-api/fetch/server — Next.js Server Actions + +Server Actions are generated by default. Set `serverActions.baseUrl` when generated actions should call a specific API origin. ```ts -import { createApi, type DevupObject } from '@devup-api/fetch' +// next.config.ts +import devupApi from '@devup-api/next-plugin' + +export default devupApi({ + reactStrictMode: true, + serverActions: { + baseUrl: 'https://api.example.com', + }, +}) +``` -// Access response types -type User = DevupObject['User'] +Use generated actions through the virtual module, never by importing `df/server.ts` directly: -// Access request/error types -type CreateUserRequest = DevupObject<'request'>['CreateUserBody'] -type ApiError = DevupObject<'error'>['ErrorResponse'] +```tsx +'use client' -// For multiple OpenAPI schemas, specify the server name -type Product = DevupObject<'response', 'openapi2.json'>['Product'] +import { getUser } from '@devup-api/fetch/server' + +const result = await getUser({ params: { id: '123' } }) ``` -## Multiple API Servers +Notes: + +- Generated `df/server.ts` contains `'use server'` and top-level named async exports. +- Generated actions return `DevupApiResponse`; the serialized headers omit `Set-Cookie` and `Set-Cookie2`. +- `@devup-api/fetch/server` has a cold typing fallback before `df` exists. +- The plugin aliases `@devup-api/fetch/server` to generated `df/server.ts` during dev/build. +- When enabled, every operationId is generated as a named Server Action export. +- Disable generation explicitly with `serverActions: false` or `serverActions: { enabled: false }`. + +--- -Support multiple OpenAPI schemas with `serverName`: +## @devup-api/react-query — React Query Hooks ```ts -import { createApi, type DevupObject } from '@devup-api/fetch' +import { createApi } from '@devup-api/fetch' +import { createQueryClient } from '@devup-api/react-query' + +const api = createApi('https://api.example.com') +const queryClient = createQueryClient(api) +``` -// Default server -const api = createApi({ baseUrl: 'https://api.example.com' }) +### useQuery + +```tsx +const { data, isLoading, error, refetch } = queryClient.useQuery( + 'get', + '/users/{id}', + { params: { id: userId } }, + { staleTime: 5 * 60 * 1000 } // React Query options +) +``` -// Second server -const api2 = createApi({ - baseUrl: 'https://api.another-service.com', - serverName: 'openapi2.json', +### useMutation + +```tsx +const mutation = queryClient.useMutation('post', 'createUser', { + onSuccess: (data) => { + client.invalidateQueries({ + queryKey: queryClient.getQueryKey('get', 'getUsers'), + }) + } }) -// Types from different schemas -type User = DevupObject['User'] // openapi.json -type Product = DevupObject<'response', 'openapi2.json'>['Product'] // openapi2.json +mutation.mutate({ body: { name: 'John', email: 'john@example.com' } }) ``` -## React Query Integration +### getQueryKey (Cache Invalidation) -For React applications using TanStack React Query, use `@devup-api/react-query`: +Use `queryClient.getQueryKey()` to get type-safe query keys for cache invalidation: -```bash -npm install @devup-api/react-query @tanstack/react-query +```tsx +// By operationId +queryClient.getQueryKey('get', 'getUsers') + +// By path with params +queryClient.getQueryKey('get', '/users/{id}', { params: { id: '123' } }) + +// Usage with TanStack Query client +client.invalidateQueries({ + queryKey: queryClient.getQueryKey( + 'get', + '/project-subject/projects/{projectId}/companion', + ), +}) +``` + +### useSuspenseQuery + +```tsx +// Use with React Suspense +const { data } = queryClient.useSuspenseQuery('get', 'getUsers', {}) +``` + +### useInfiniteQuery + +```tsx +const { data, fetchNextPage, hasNextPage } = queryClient.useInfiniteQuery( + 'get', + 'getUsers', + { + initialPageParam: 1, + getNextPageParam: (lastPage) => lastPage.nextPage + } +) +``` + +### useQueries (Parallel) + +```tsx +const results = queryClient.useQueries([ + ['get', '/users/{id}', { params: { id: '1' } }], + ['get', '/users/{id}', { params: { id: '2' } }], +]) ``` +--- + +## @devup-api/zod — Runtime Validation + +Schemas auto-generated from OpenAPI via virtual module. + ```ts +import { schemas, responseSchemas, requestSchemas, errorSchemas, pathSchemas } from '@devup-api/zod' + +// By category +const userSchema = responseSchemas.User +const createUserSchema = requestSchemas.CreateUserRequest +const errorSchema = errorSchemas.ApiError + +// By path/operationId (for forms) +const schema = pathSchemas.post['createUser'] +const schema = pathSchemas.put['/users/{id}'] + +// Multi-server +const productSchema = schemas['openapi2.json'].response.Product + +// Validate +const result = userSchema.safeParse(data) +if (result.success) { + console.log(result.data) +} else { + console.error(result.error.issues) +} + +// Type inference +import { z } from 'zod' +type User = z.infer +``` + +--- + +## @devup-api/hookform — React Hook Form Integration + +Auto-validation with Zod schemas from OpenAPI. + +```tsx import { createApi } from '@devup-api/fetch' -import { createQueryClient } from '@devup-api/react-query' +import { ApiForm, useFormContext, useWatch, useFieldArray, Controller } from '@devup-api/hookform' const api = createApi('https://api.example.com') -const queryClient = createQueryClient(api) +``` + +### Basic Form + +```tsx +function FormFields() { + const { register, formState: { errors, isSubmitting } } = useFormContext() + return ( + <> + + {errors.name && {errors.name.message}} + + {errors.email && {errors.email.message}} + + + ) +} -// useQuery -const { data } = queryClient.useQuery('get', '/users/{id}', { params: { id: '123' } }) +function CreateUserForm() { + return ( + console.log('Created:', data)} + onError={(error) => console.error('Error:', error)} + onValidationError={(errors) => console.log('Validation:', errors)} + > + + + ) +} +``` -// useMutation -const mutation = queryClient.useMutation('post', 'createUser') +### Edit Form + +```tsx + console.log('Updated:', data)} +> + + +``` -// useSuspenseQuery -const { data } = queryClient.useSuspenseQuery('get', 'getUsers', {}) +### Props + +| Prop | Type | Description | +|------|------|-------------| +| `api` | `DevupApi` | API client | +| `method` | `'post' \| 'put' \| 'patch' \| 'delete'` | HTTP method | +| `path` | `string` | operationId or path | +| `requestOptions` | `{ params?, query?, headers? }` | Additional request options | +| `defaultValues` | `object` | Form default values | +| `mode` | `'onSubmit' \| 'onBlur' \| 'onChange'` | Validation mode | +| `resetOnSuccess` | `boolean` | Reset form after success | +| `onSuccess` | `(data) => void` | Success callback | +| `onError` | `(error) => void` | API error callback | +| `onValidationError` | `(errors) => void` | Validation error callback | + +--- + +## @devup-api/ui — CRUD Components + +Auto-generated CRUD from OpenAPI tags. + +### OpenAPI Tags + +```yaml +paths: + /users/{id}: + get: + tags: [devup:user:one] # GET single (required) + put: + tags: [devup:user:edit] # PUT update + patch: + tags: [devup:user:fix] # PATCH update + /users: + post: + tags: [devup:user:create] # POST create (required) +``` + +### Usage + +```tsx +import { createApi } from '@devup-api/fetch' +import { ApiCrud } from '@devup-api/ui' +import { crudConfigs } from '@devup-api/ui/crud' + +const api = createApi('https://api.example.com') +``` + +### Create Mode (no params) + +```tsx + console.log('Created:', data)} +/> +``` + +### Edit Mode (with params) + +```tsx +Loading...} + oneFallback={
Not found
} + onUpdateSuccess={(data) => console.log('Updated:', data)} +/> +``` + +### Headless Mode (Render Function) + +```tsx + + {({ form, mode, submit, isLoading, one }) => ( + { e.preventDefault(); submit() }}> + + + + + )} + +``` + +### Custom Renderers + +```tsx + ( +
+ + +
+ )} + renderSubmit={({ isLoading, mode }) => ( + + )} +/> +``` + +### useApiCrud Hook + +```tsx +import { useApiCrud } from '@devup-api/ui' -// useInfiniteQuery -const { data, fetchNextPage } = queryClient.useInfiniteQuery('get', 'getUsers', { - initialPageParam: 1, - getNextPageParam: (lastPage) => lastPage.nextPage, +const crud = useApiCrud({ + config: crudConfigs.user, + api, + params: userId ? { id: userId } : undefined, + onCreateSuccess: (data) => console.log('Created:', data), + onUpdateSuccess: (data) => console.log('Updated:', data), }) + +// crud.mode: 'create' | 'edit' +// crud.form: UseFormReturn +// crud.one: { data, isLoading, isError } +// crud.create: { mutate, isPending } +// crud.update: { mutate, isPending } +// crud.submit: () => void +// crud.isLoading: boolean +``` + +### Field Types + +`text` | `number` | `email` | `password` | `url` | `tel` | `textarea` | `select` | `checkbox` | `radio` | `date` | `datetime` | `time` | `file` | `hidden` | `array` | `object` + +--- + +## Multiple API Servers + +```ts +// Plugin config +devupApi({ openapiFiles: ['openapi.json', 'openapi2.json'] }) + +// Usage +const api1 = createApi({ baseUrl: 'https://api1.com' }) +const api2 = createApi({ baseUrl: 'https://api2.com', serverName: 'openapi2.json' }) + +// Types - use directly without redefining +const user: DevupObject['User'] = data // openapi.json +const product: DevupObject<'response', 'openapi2.json'>['Product'] = data // openapi2.json +``` + +--- + +## Plugin Options + +```ts +interface DevupApiOptions { + openapiFiles?: string | string[] // default: 'openapi.json' + tempDir?: string // default: 'df' + convertCase?: 'snake' | 'camel' | 'pascal' | 'maintain' // default: 'camel' + requestDefaultNonNullable?: boolean // default: false + responseDefaultNonNullable?: boolean // default: true + // default: true; use false or { enabled: false } to disable + serverActions?: boolean | { + enabled?: boolean + baseUrl?: string + } +} +``` + +--- + +## Common Patterns + +### Request Cancellation + +```ts +const controller = new AbortController() +setTimeout(() => controller.abort(), 5000) +await api.get('getUsers', { signal: controller.signal }) +``` + +### File Upload + +```ts +const formData = new FormData() +formData.append('file', file) +await api.post('/upload', { body: formData }) ``` -## Guidelines +### Environment URL + +```ts +const api = createApi(import.meta.env.VITE_API_URL || 'http://localhost:3000') +``` + +--- + +## Troubleshooting -- **"Cold" vs "Boild" Typing:** When you first start, types might be `any` (Cold Typing ❄️). Run your build command (`dev` or `build`) to generate the types and enable strict checking (Boild Typing 🔥 - the warm opposite of cold, with zero boilerplate needed!). -- **Operation IDs vs Paths:** You can use either the OpenAPI `operationId` (e.g., `getUsers`) or the URL path (e.g., `/users`). `operationId` is often more concise. -- **Generated Files:** Do not manually edit the files in the `df` (or configured temp) directory. They are auto-generated. -- **Verification:** If types seem missing, ensure `tsconfig.json` includes the generated folder and that the build script has run at least once. -- **Advanced Features:** devup-api supports authentication, file uploads, request interceptors, retry logic, caching, and more through custom fetch implementations. +| Issue | Solution | +|-------|----------| +| Types not appearing | Run `npm run dev`, check tsconfig includes `df/**/*.d.ts` | +| Server Action import fails at runtime | Configure the build plugin so `@devup-api/fetch/server` aliases to generated `df/server.ts` | +| operationId not found | Use path `/users/{id}` or verify openapi.json operationId | +| Zod schemas empty | Ensure bundler plugin is configured, run dev server | +| CRUD config missing | Add `devup:{name}:one` and `devup:{name}:create` tags to OpenAPI | diff --git a/bun.lock b/bun.lock index 92e6514..8b9c525 100644 --- a/bun.lock +++ b/bun.lock @@ -1,18 +1,19 @@ { - "lockfileVersion": 1, + "lockfileVersion": 2, "configVersion": 1, "workspaces": { "": { "name": "devup-api", "devDependencies": { - "@biomejs/biome": "^2.3", - "@testing-library/react": "^16.3.1", + "@biomejs/biome": "^2.5", + "@devup-api/react-query": "workspace:*", + "@testing-library/react": "^16.3.2", "@testing-library/react-hooks": "^8.0.1", "@types/bun": "latest", "bun-test-env-dom": "^1.0.3", "husky": "^9", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.8", + "react-dom": "^19.2.8", }, }, "examples/next": { @@ -27,16 +28,17 @@ "@devup-api/zod": "workspace:*", "@devup-ui/react": "^1", "@tanstack/react-query": "^5", - "next": "^16.1.1", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "next": "^16.3.2", + "react": "^19.2.8", + "react-dom": "^19.2.8", + "zod": "^4.4", }, "devDependencies": { "@devup-ui/next-plugin": "^1", - "@types/node": "^25", + "@types/node": "^26", "@types/react": "^19", "@types/react-dom": "^19", - "typescript": "^5", + "typescript": "^7", }, }, "examples/next-webpack": { @@ -46,16 +48,16 @@ "@devup-api/fetch": "workspace:*", "@devup-api/next-plugin": "workspace:*", "@devup-ui/react": "^1", - "next": "^16.1.1", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "next": "^16.3.2", + "react": "^19.2.8", + "react-dom": "^19.2.8", }, "devDependencies": { "@devup-ui/next-plugin": "^1", - "@types/node": "^25", + "@types/node": "^26", "@types/react": "^19", "@types/react-dom": "^19", - "typescript": "^5", + "typescript": "^7", }, }, "examples/rsbuild": { @@ -63,8 +65,8 @@ "version": "0.1.0", "dependencies": { "@devup-api/fetch": "workspace:*", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.8", + "react-dom": "^19.2.8", }, "devDependencies": { "@devup-api/rsbuild-plugin": "workspace:*", @@ -72,7 +74,7 @@ "@rsbuild/plugin-react": "*", "@types/react": "^19", "@types/react-dom": "^19", - "typescript": "^5", + "typescript": "^7", }, }, "examples/vite": { @@ -80,76 +82,77 @@ "version": "0.1.0", "dependencies": { "@devup-api/fetch": "workspace:*", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.8", + "react-dom": "^19.2.8", }, "devDependencies": { "@devup-api/vite-plugin": "workspace:*", "@types/react": "^19", "@types/react-dom": "^19", - "@vitejs/plugin-react": "^5.1.2", - "typescript": "^5", - "vite": "^7.3.0", + "@vitejs/plugin-react": "^6.1.0", + "typescript": "^7", + "vite": "^8.2.2", }, }, "packages/core": { "name": "@devup-api/core", - "version": "0.1.10", + "version": "0.1.19", "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", + "@types/node": "^26.2", + "typescript": "^7.0", }, }, "packages/fetch": { "name": "@devup-api/fetch", - "version": "0.1.13", + "version": "0.1.22", "dependencies": { "@devup-api/core": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", + "@types/node": "^26.2", + "typescript": "^7.0", }, }, "packages/generator": { "name": "@devup-api/generator", - "version": "0.1.12", + "version": "0.1.25", "dependencies": { "@devup-api/core": "workspace:^", "@devup-api/utils": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "openapi-types": "^12.1", - "typescript": "^5.9", + "typescript": "^7.0", }, }, "packages/hookform": { "name": "@devup-api/hookform", - "version": "0.0.1", + "version": "0.1.6", "dependencies": { "@devup-api/fetch": "workspace:^", "@devup-api/zod": "workspace:^", - "@hookform/resolvers": ">=5.2.2", - "react-hook-form": ">=7.70.0", + "@hookform/resolvers": ">=5.9.1", + "react-hook-form": ">=7.86.0", }, "devDependencies": { - "@tanstack/react-query": "^5.90.16", - "@testing-library/react": "^16.3.1", - "@types/node": "^25.0", + "@tanstack/react-query": "^5", + "@testing-library/react": "^16.3", + "@types/node": "^26.2", "@types/react": "^19.2", - "bun-test-env-dom": "^1.0.3", - "happy-dom": "^20.0.11", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "@typescript/typescript6": "^6.0", + "bun-test-env-dom": "^1.0", + "happy-dom": "^20.11", + "react": "^19.2", + "react-dom": "^19.2", "rollup-plugin-preserve-directives": "^0.4", - "typescript": "^5.9", - "vite": "^7.3", - "vite-plugin-dts": "^4.5", - "zod": "^4.3", + "typescript": "^7.0", + "vite": "^8.2", + "vite-plugin-dts": "^5.0", + "zod": "^4.4", }, "peerDependencies": { - "@tanstack/react-query": ">=5.0.0", + "@tanstack/react-query": ">=5.102.2", "react": "*", "react-hook-form": "*", "zod": "*", @@ -157,7 +160,7 @@ }, "packages/next-plugin": { "name": "@devup-api/next-plugin", - "version": "0.1.8", + "version": "0.1.14", "dependencies": { "@devup-api/core": "workspace:^", "@devup-api/generator": "workspace:^", @@ -165,9 +168,9 @@ "@devup-api/webpack-plugin": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "@types/webpack": "^5.28", - "typescript": "^5.9", + "typescript": "^7.0", }, "peerDependencies": { "@devup-api/core": "*", @@ -176,34 +179,34 @@ }, "packages/react-query": { "name": "@devup-api/react-query", - "version": "0.1.5", + "version": "0.1.16", "dependencies": { "@devup-api/fetch": "workspace:^", - "@tanstack/react-query": ">=5.90", }, "devDependencies": { + "@tanstack/react-query": "^5", "@testing-library/react-hooks": "^8.0.1", - "@types/node": "^25.0", + "@types/node": "^26.2", "@types/react": "^19.2", - "happy-dom": "^20.0.11", - "typescript": "^5.9", + "happy-dom": "^20.11.6", + "typescript": "^7.0", }, "peerDependencies": { - "@tanstack/react-query": "*", + "@tanstack/react-query": ">=5.102.2", "react": "*", }, }, "packages/rsbuild-plugin": { "name": "@devup-api/rsbuild-plugin", - "version": "0.1.8", + "version": "0.1.14", "dependencies": { "@devup-api/core": "workspace:^", "@devup-api/generator": "workspace:^", "@devup-api/utils": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", + "@types/node": "^26.2", + "typescript": "^7.0", }, "peerDependencies": { "@devup-api/core": "*", @@ -212,44 +215,45 @@ }, "packages/ui": { "name": "@devup-api/ui", - "version": "0.0.1", + "version": "0.1.3", "dependencies": { "@devup-api/hookform": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", - "@types/react": "^19.2.7", - "react": "^19.2.3", + "@types/node": "^26.2", + "@types/react": "^19.2", + "@typescript/typescript6": "^6.0", + "react": "^19.2", "rollup-plugin-preserve-directives": "^0.4", - "typescript": "^5.9", - "vite": "^7.3", - "vite-plugin-dts": "^4.5", + "typescript": "^7.0", + "vite": "^8.2", + "vite-plugin-dts": "^5.0", }, "peerDependencies": { - "react": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || >=19.0.0", }, }, "packages/utils": { "name": "@devup-api/utils", - "version": "0.1.6", + "version": "0.1.11", "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "openapi-types": "^12.1", - "typescript": "^5.9", + "typescript": "^7.0", }, }, "packages/vite-plugin": { "name": "@devup-api/vite-plugin", - "version": "0.1.8", + "version": "0.1.14", "dependencies": { "@devup-api/core": "workspace:^", "@devup-api/generator": "workspace:^", "@devup-api/utils": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "openapi-types": "^12.1", - "typescript": "^5.9", + "typescript": "^7.0", }, "peerDependencies": { "@devup-api/core": "*", @@ -258,16 +262,16 @@ }, "packages/webpack-plugin": { "name": "@devup-api/webpack-plugin", - "version": "0.1.8", + "version": "0.1.14", "dependencies": { "@devup-api/core": "workspace:^", "@devup-api/generator": "workspace:^", "@devup-api/utils": "workspace:^", }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "@types/webpack": "^5.28", - "typescript": "^5.9", + "typescript": "^7.0", }, "peerDependencies": { "@devup-api/core": "*", @@ -275,81 +279,47 @@ }, "packages/zod": { "name": "@devup-api/zod", - "version": "0.0.1", + "version": "0.1.4", "dependencies": { "@devup-api/fetch": "workspace:^", "zod": ">=4", }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", - "zod": "^4.3.5", + "@types/node": "^26.2", + "typescript": "^7.0", + "zod": "^4.4", }, "peerDependencies": { - "zod": "^3.0.0", + "zod": "^4.4", }, }, }, "packages": { - "@adobe/css-tools": ["@adobe/css-tools@4.4.4", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="], - - "@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], - - "@babel/compat-data": ["@babel/compat-data@7.28.5", "", {}, "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA=="], - - "@babel/core": ["@babel/core@7.28.5", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.28.3", "@babel/helpers": "^7.28.4", "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw=="], - - "@babel/generator": ["@babel/generator@7.28.5", "", { "dependencies": { "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ=="], - - "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.27.2", "", { "dependencies": { "@babel/compat-data": "^7.27.2", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ=="], - - "@babel/helper-globals": ["@babel/helper-globals@7.28.0", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="], - - "@babel/helper-module-imports": ["@babel/helper-module-imports@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w=="], - - "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.28.3", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1", "@babel/traverse": "^7.28.3" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw=="], - - "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.27.1", "", {}, "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw=="], - - "@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="], + "@adobe/css-tools": ["@adobe/css-tools@4.5.0", "", {}, "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q=="], - "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + "@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], - "@babel/helper-validator-option": ["@babel/helper-validator-option@7.27.1", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="], + "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], - "@babel/helpers": ["@babel/helpers@7.28.4", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.28.4" } }, "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w=="], + "@babel/runtime": ["@babel/runtime@7.29.7", "", {}, "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw=="], - "@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], + "@biomejs/biome": ["@biomejs/biome@2.5.10", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.10", "@biomejs/cli-darwin-x64": "2.5.10", "@biomejs/cli-linux-arm64": "2.5.10", "@biomejs/cli-linux-arm64-musl": "2.5.10", "@biomejs/cli-linux-x64": "2.5.10", "@biomejs/cli-linux-x64-musl": "2.5.10", "@biomejs/cli-win32-arm64": "2.5.10", "@biomejs/cli-win32-x64": "2.5.10" }, "bin": { "biome": "bin/biome" } }, "sha512-WRKXARA3kTuiV5sxqTpobJ/I0MVd4vk3pOL6wnp5az4LntFIhWTj1RWZq3DI9PCEN3lXcqy7p5aqUHzvq8AXyQ=="], - "@babel/plugin-transform-react-jsx-self": ["@babel/plugin-transform-react-jsx-self@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw=="], + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.5.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ItCrxKK6SXVT6flYs0qIuBd4AA3TTTl4d66Re6YI2FuGZnN85NmuYNzkiTJUyYw8qBLv69L5zTUB6uyWd++h3Q=="], - "@babel/plugin-transform-react-jsx-source": ["@babel/plugin-transform-react-jsx-source@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw=="], + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.5.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-yLsPU9pAmtChXDu8vhKAzErqe+LeeYuwuUB2FZMkRitsmdodxsYRa9KHrFispsUHzzOu+9HB3nP/TQxyia+Sjw=="], - "@babel/runtime": ["@babel/runtime@7.28.4", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="], + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.5.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-VG8uQW/86a1roLaIFvtIbEigxIdzdJ190oGyg1tV7VYeQtOS+x10sflk7WbuXgw91EtZX5DlIIIej1YqkNLlcg=="], - "@babel/template": ["@babel/template@7.27.2", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", "@babel/types": "^7.27.1" } }, "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw=="], + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.5.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-t1QAKZwQJRB4dvgJSgFiQ4BNfNPChg69BNonz854qLVxnjT3UvDzQg9mbkTJRu35ZqU0Rw10A73J8Urgbg2RPw=="], - "@babel/traverse": ["@babel/traverse@7.28.5", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", "@babel/types": "^7.28.5", "debug": "^4.3.1" } }, "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ=="], + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.5.10", "", { "os": "linux", "cpu": "x64" }, "sha512-4O6T0eq2heoHZN0a9UX+rWQoxXEBaKf+lRi2hbsGlHneUz9BWXM76nEWMK7Eeq8gzMxR1khQB6BFpAASpeXqGg=="], - "@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.5.10", "", { "os": "linux", "cpu": "x64" }, "sha512-pgDDqp9JybHm2I0KRgzN6i4+lt8xu4iqxUwLzglUMmOmyRTU1AYBGKzh9sNMOtIjah7xoWvKHlLVetvyifzoiQ=="], - "@biomejs/biome": ["@biomejs/biome@2.3.10", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.3.10", "@biomejs/cli-darwin-x64": "2.3.10", "@biomejs/cli-linux-arm64": "2.3.10", "@biomejs/cli-linux-arm64-musl": "2.3.10", "@biomejs/cli-linux-x64": "2.3.10", "@biomejs/cli-linux-x64-musl": "2.3.10", "@biomejs/cli-win32-arm64": "2.3.10", "@biomejs/cli-win32-x64": "2.3.10" }, "bin": { "biome": "bin/biome" } }, "sha512-/uWSUd1MHX2fjqNLHNL6zLYWBbrJeG412/8H7ESuK8ewoRoMPUgHDebqKrPTx/5n6f17Xzqc9hdg3MEqA5hXnQ=="], + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.5.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-pxAbxduPO4xq/Cvgaa2lOrs9BB0hEXmmDqfMNP4ZOffGOkUrD1/QGw9UAMpFQpX2P8MqTIIRuQKcmetum4Oa6A=="], - "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.3.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-M6xUjtCVnNGFfK7HMNKa593nb7fwNm43fq1Mt71kpLpb+4mE7odO8W/oWVDyBVO4ackhresy1ZYO7OJcVo/B7w=="], - - "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.3.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-Vae7+V6t/Avr8tVbFNjnFSTKZogZHFYl7MMH62P/J1kZtr0tyRQ9Fe0onjqjS2Ek9lmNLmZc/VR5uSekh+p1fg=="], - - "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.3.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-hhPw2V3/EpHKsileVOFynuWiKRgFEV48cLe0eA+G2wO4SzlwEhLEB9LhlSrVeu2mtSn205W283LkX7Fh48CaxA=="], - - "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.3.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-B9DszIHkuKtOH2IFeeVkQmSMVUjss9KtHaNXquYYWCjH8IstNgXgx5B0aSBQNr6mn4RcKKRQZXn9Zu1rM3O0/A=="], - - "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.3.10", "", { "os": "linux", "cpu": "x64" }, "sha512-wwAkWD1MR95u+J4LkWP74/vGz+tRrIQvr8kfMMJY8KOQ8+HMVleREOcPYsQX82S7uueco60L58Wc6M1I9WA9Dw=="], - - "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.3.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QTfHZQh62SDFdYc2nfmZFuTm5yYb4eO1zwfB+90YxUumRCR171tS1GoTX5OD0wrv4UsziMPmrePMtkTnNyYG3g=="], - - "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.3.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-o7lYc9n+CfRbHvkjPhm8s9FgbKdYZu5HCcGVMItLjz93EhgJ8AM44W+QckDqLA9MKDNFrR8nPbO4b73VC5kGGQ=="], - - "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.3.10", "", { "os": "win32", "cpu": "x64" }, "sha512-pHEFgq7dUEsKnqG9mx9bXihxGI49X+ar+UBrEIj3Wqj3UCZp1rNgV+OoyjFgcXsjCWpuEAF4VJdkZr3TrWdCbQ=="], + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.5.10", "", { "os": "win32", "cpu": "x64" }, "sha512-M+2dgBsl3lXRiTfgPVc2p3anS4Tocojke4rzFLScZ2Y/wmF+36dRb1iHCLiyGqOzQGyTplZH1HnEYviiAqi3nA=="], "@devup-api/core": ["@devup-api/core@workspace:packages/core"], @@ -375,341 +345,329 @@ "@devup-api/zod": ["@devup-api/zod@workspace:packages/zod"], - "@devup-ui/next-plugin": ["@devup-ui/next-plugin@1.0.59", "", { "dependencies": { "@devup-ui/wasm": "1.0.51", "@devup-ui/webpack-plugin": "1.0.49", "glob": "^13.0", "next": "^16.0" } }, "sha512-u44tjZZROuWkny/b5ZRvmiNSRvpgvrs+91npGejTx3w7dp+9y17B3GajrNkEytglT5c/45ItAaOR3fwRYwWnbA=="], - - "@devup-ui/react": ["@devup-ui/react@1.0.29", "", { "dependencies": { "csstype-extra": "latest", "react": "^19.2" } }, "sha512-RGmnTOMsksV/IOiqU9yCQZW+hQ/WAgo4qVyh+gsbzZQc4tM3fDUKctOF72Wm2Be7n2sn+JVHhocEaAWNkPeIig=="], - - "@devup-ui/wasm": ["@devup-ui/wasm@1.0.51", "", {}, "sha512-BYhdsf42OxGxe3VWxNrSC2uRfpTY5vqGRwWLSYHyOWbozuop4W04L/hGX0M2hkdz3jI9Q3DISSInMH2cIiT6CA=="], + "@devup-ui/next-plugin": ["@devup-ui/next-plugin@1.0.83", "", { "dependencies": { "@devup-ui/plugin-utils": "^1.0.13", "@devup-ui/wasm": "^1.0.78", "@devup-ui/webpack-plugin": "^1.0.66" }, "peerDependencies": { "next": "*" } }, "sha512-H3s5aRbhuz91G5UgXUlcdDCgKrbdsNowKQ47dSNGHH45fAvCeXDj0W8PKx3sfc8nzwDKX79WOIHR1KnQvUZlcg=="], - "@devup-ui/webpack-plugin": ["@devup-ui/webpack-plugin@1.0.49", "", { "dependencies": { "@devup-ui/wasm": "1.0.47" } }, "sha512-jvdmBvOPuwvdpqr/OvAQF6vw1jLyWfJ9PCytybLflMfudRq4AKd5wmB9IBLmQhAvdCo8itrn7uiWl+f4nwwl3g=="], + "@devup-ui/plugin-utils": ["@devup-ui/plugin-utils@1.0.13", "", {}, "sha512-fV0KoD4wgKDTFcXcaBSSBznylg81KJEayAVrirKYWpTeDKaeiAsVo58MU5+N+K4PL1T8bay2yHf7WKnlCgmPTg=="], - "@emnapi/core": ["@emnapi/core@1.7.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg=="], + "@devup-ui/react": ["@devup-ui/react@1.0.40", "", { "dependencies": { "csstype-extra": "latest", "react": "^19.2" } }, "sha512-Ffvl2hIbuLMQbWznAgZ/98NMxiDIh3xjh6XA7F6MPvVS8/PVw6nc8I9/1fdQe6zgx2Av6zYJM5axsOT+cQYgOA=="], - "@emnapi/runtime": ["@emnapi/runtime@1.7.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA=="], + "@devup-ui/wasm": ["@devup-ui/wasm@1.0.78", "", {}, "sha512-Ue6Gbw2o102kpQ5usa6eAHvNudUuxICtGtTUljs9MtOI2Fyvhvmm/OuNpCqBZWFudq5dzK/8ckfetcbDVtiq1g=="], - "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.1.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ=="], + "@devup-ui/webpack-plugin": ["@devup-ui/webpack-plugin@1.0.66", "", { "dependencies": { "@devup-ui/plugin-utils": "^1.0.13", "@devup-ui/wasm": "^1.0.78" } }, "sha512-eru6WOgsf55/sb6RSfQiphSi+2SDYzGx/nqc27jTkP2TT2A3bRAOycgAXFceRclf/vPKthe4l+cs9j7PehSemQ=="], - "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw=="], + "@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], - "@esbuild/android-arm": ["@esbuild/android-arm@0.27.2", "", { "os": "android", "cpu": "arm" }, "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA=="], + "@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], - "@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.2", "", { "os": "android", "cpu": "arm64" }, "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA=="], + "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], - "@esbuild/android-x64": ["@esbuild/android-x64@0.27.2", "", { "os": "android", "cpu": "x64" }, "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A=="], + "@happy-dom/global-registrator": ["@happy-dom/global-registrator@20.11.6", "", { "dependencies": { "@types/node": ">=20.0.0", "happy-dom": "^20.11.6" } }, "sha512-ZQ47qUTeNbGhHkCGExJ1oZhruoxKRaxO44RgFETl3T4c1rRxIBlAOnM3SAH4XHu7Ue2owJXP+jOx1vOuKuxcSg=="], - "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg=="], + "@hookform/resolvers": ["@hookform/resolvers@5.9.1", "", { "dependencies": { "@standard-schema/utils": "^0.3.0" }, "peerDependencies": { "@sinclair/typebox": ">=0.25.24", "@standard-schema/spec": "^1.0.0", "@typeschema/main": ">=0.13.7", "@vinejs/vine": "^2.0.0 || ^3.0.0 || ^4.0.0", "ajv": "^8.12.0", "ajv-errors": "^3.0.0", "ajv-formats": "^2.1.1", "arktype": "^2.0.0", "ata-validator": "^1.2.0", "class-transformer": ">=0.4.0", "class-validator": ">=0.12.0", "computed-types": "^1.0.0", "effect": "^3.10.3", "fluentvalidation-ts": "^3.0.0", "fp-ts": "^2.7.0", "io-ts": "^2.0.0", "joi": "^17.0.0 || ^18.0.0", "nope-validator": ">=0.12.0", "react-hook-form": "^7.55.0", "superstruct": ">=0.12.0", "typanion": "^3.3.2", "valibot": ">=0.31.0 || ^1.0.0-beta.4 || ^1.0.0-rc", "vest": ">=6.0.0", "yup": "^1.0.0", "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["@sinclair/typebox", "@standard-schema/spec", "@typeschema/main", "@vinejs/vine", "ajv", "ajv-errors", "ajv-formats", "arktype", "ata-validator", "class-transformer", "class-validator", "computed-types", "effect", "fluentvalidation-ts", "fp-ts", "io-ts", "joi", "nope-validator", "superstruct", "typanion", "valibot", "vest", "yup", "zod"] }, "sha512-7b7vsbraJxKgjVSA1Nur9tLwj539WGJUBLA7QNvXnFoT2pM5Z7G+6rlukk4B2/QrTZy6huRtH6wKeESPKuIr6w=="], - "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA=="], + "@img/colour": ["@img/colour@1.1.0", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="], - "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g=="], + "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.2" }, "os": "darwin", "cpu": "arm64" }, "sha512-RMnFX7YQsMoh7lWfcM4NEHHymBX/rLuKNPVM84XE9ONPcaSCDgE7CHIHpSgPcO2xcRthgBy1HfNO319mwhIAkg=="], - "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA=="], + "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.2" }, "os": "darwin", "cpu": "x64" }, "sha512-Xo+5uFBtLN0BKqieTxiFzFPQAUlBbbH5iBKyRX/z1JrbnYsHTfKJnUfL8+p2TPXr1pXqao4eeL4Rl144uDpK9w=="], - "@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.2", "", { "os": "linux", "cpu": "arm" }, "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw=="], + "@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.3", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "os": "freebsd" }, "sha512-lUxcqWIj2wMQ9BrwNjngcr1gWUr5xgaGThBRqPPalIC2n67Cqj1uPh8NnA/ZhAg8hUbKl+kVHKwgUIwe6ZYPrg=="], - "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw=="], + "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-9J6ypZFpQBj4YnePGoq/S38w6nz+vqg5WZLrLGY4YuSemdMq47GMLBPO42MzwdGwpg/agZ7xzZcFHa48xlywfg=="], - "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.2", "", { "os": "linux", "cpu": "ia32" }, "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w=="], + "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-m2pW1n6cns9VaubNwsZ+c3CRYjxNQWgJ5gPlnL1nbBcpkBvFm6SCFN5o0psFHI8w9n11NKhFkeEDns98tiqbEw=="], - "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.2", "", { "os": "linux", "cpu": "none" }, "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg=="], + "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.2", "", { "os": "linux", "cpu": "arm" }, "sha512-1eMLzy92I4J6rmi4mAT8yC3HxOtniyGELlzGbNMLLeqe052ahFQ0h6LFq+lh5DsDIdYViIDst08abvSbcEdLXQ=="], - "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.2", "", { "os": "linux", "cpu": "none" }, "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw=="], + "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-dqVSFynCox4C/J8kT16V7SIFAns0IjgLwkvYT7p8LQVmJ5OS5b6tI9IGflxTeuBS//zXeFIUbwt5dwxyZ17cnA=="], - "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ=="], + "@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-3z0NHDxD6n5I9gc05U1eW1AyRm+Gznzq3naMrthPNqE6oYykcogW0l/jfpJdjYnuNl8R7yI9pNbE1XiUeyq0Aw=="], - "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.2", "", { "os": "linux", "cpu": "none" }, "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA=="], + "@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.2", "", { "os": "linux", "cpu": "none" }, "sha512-bsb4rI+NldGOsXuej2r8OdSS8+zXDVaCWxyWrcv6kneTOlgAHtZABRzBBCwdsPiD90J4myNJuHpg6kA20ImW/w=="], - "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w=="], + "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-/ABshyj8gCpyIrNXnHn4LorDJ0HHm1VhXPBlxZ8zAtfVPAaSafXPGn+sUSIRiwaSBy0mmFjSjiXI5mkcwdChKQ=="], - "@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.2", "", { "os": "linux", "cpu": "x64" }, "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA=="], + "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.2", "", { "os": "linux", "cpu": "x64" }, "sha512-ITPEtgffGJ0S6G9dRyw/366tJQqFRcHWPHhC+Stpg3Z8AEMrDrTr2lhdz4f/Y/HMbRh//7Z5mBzEpVdi62Oc3w=="], - "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.2", "", { "os": "none", "cpu": "arm64" }, "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw=="], + "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-zE9EdiUzUmg5mDT5a1rk5fYJ6GWPloTwWBYDS14naqHsL+EaMpDj1AWnpLgh3u0YCORv2Tt50wrcrpYqkP97Kw=="], - "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.2", "", { "os": "none", "cpu": "x64" }, "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA=="], + "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.2", "", { "os": "linux", "cpu": "x64" }, "sha512-m0lrLiUt+lBYnCFr8qV/65yMR4E/c7/wf78I5eKTdkEakFAlZ9QlzEM3QIhhAwVeUhLAHLcCq7a7Vszq/oFNZQ=="], - "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA=="], + "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.2" }, "os": "linux", "cpu": "arm" }, "sha512-affVWCTLooy8TSxbDx2qkzuDeaWLNVBA+P//FNBirHsXpP2fuBhk5AuboYUnrDnzoXes8GFjpTx0SBFOCRg+FA=="], - "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg=="], + "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.2" }, "os": "linux", "cpu": "arm64" }, "sha512-QgKDspHPnrU+GQ55XPhGwyhC8acLVOOSyAvo1oVfFmrIXLkDNmGWzAfDZ4xK8oSA1qBQrALcHX0G5UZni/SuFQ=="], - "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.2", "", { "os": "none", "cpu": "arm64" }, "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag=="], + "@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.2" }, "os": "linux", "cpu": "ppc64" }, "sha512-sMd8rDxmpLOwv/7N44klFjOD5DUO7FLdjiXDI0hoxYaf7Ar262dQIEkosE98bps+5HPLtp/EvNqeqQtOycP/IA=="], - "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg=="], + "@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.2" }, "os": "linux", "cpu": "none" }, "sha512-0Eob78yjlYPfL5vMNWAW55l3R9Y6BQS/gOfe0ZcP9mEz9ohhKSt4im1hayiknXgf8AWrFqMvJcKIdmLmEe7yeQ=="], - "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg=="], + "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.2" }, "os": "linux", "cpu": "s390x" }, "sha512-KgAxQ0DxpNOq1rG2t5cgTgShJFGSuU7XO45cqC+1NVOuZnP6tlgZRuSYOfNupGkHID0o3cJOsw4DVeJpMovcGw=="], - "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ=="], + "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-8pqvxubL2PGdhlPy6GLqzDYMUjyRmKAwKHYKixpdJYBUK7PJ0C029XdsnpFIdgRZG68fZiGdHVWcKPvtiPB4cA=="], - "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.2", "", { "os": "win32", "cpu": "x64" }, "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ=="], + "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.2" }, "os": "linux", "cpu": "arm64" }, "sha512-Vz0iQjzzcSX3HCbfwFfCSG/9SCIqyO0mH2sXyiHaAYfBk0cRsCWXRyQYX0ovCK/PAQBbTzQ0dsPQHh5MAFL59w=="], - "@happy-dom/global-registrator": ["@happy-dom/global-registrator@20.0.11", "", { "dependencies": { "@types/node": "^20.0.0", "happy-dom": "^20.0.11" } }, "sha512-GqNqiShBT/lzkHTMC/slKBrvN0DsD4Di8ssBk4aDaVgEn+2WMzE6DXxq701ndSXj7/0cJ8mNT71pM7Bnrr6JRw=="], + "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.3", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-6O1NPKcDVj9QEdg7Hx549EX8U0rp6yXQERqru6yRN7fGBn32UvIRJUlWnk+8xDCiG76hXVBbX82NZ/ZKr0euIg=="], - "@hookform/resolvers": ["@hookform/resolvers@5.2.2", "", { "dependencies": { "@standard-schema/utils": "^0.3.0" }, "peerDependencies": { "react-hook-form": "^7.55.0" } }, "sha512-A/IxlMLShx3KjV/HeTcTfaMxdwy690+L/ZADoeaTltLx+CVuzkeVIPuybK3jrRfw7YZnmdKsVVHAlEPIAEUNlA=="], + "@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.3", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="], - "@img/colour": ["@img/colour@1.0.0", "", {}, "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw=="], + "@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.3", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "cpu": "none" }, "sha512-2rnq7bX3NzeR2T4YWgz8qiG4h3TSdMe+vN1iQXpJleSJ3SM5zQ8Fy2SyyXAWlbxpEZ2Y+Z4u1BePgJEYbSy80Q=="], - "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], + "@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-4bPwFdMbeC4JQ8L8LOyWp6nsHcboP5fxkp6iPOXz2Vg49R42TuMs2whkJ5OAP4/Ul035qOzy0AecOF9VOscn4w=="], - "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.2.4" }, "os": "darwin", "cpu": "x64" }, "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw=="], + "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-r53mXsBN6lFUDiST764SvgwUdHAqM4rPAiDzAmf4fLoB6X/rkfyTrLCg6+g17wJJiCmB3JYgHuUldCWUIRFSXw=="], - "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.2.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g=="], + "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.3", "", { "os": "win32", "cpu": "x64" }, "sha512-D4y1vNeZrIIJCN+uHaWVtH86B+aCrdMYYjicy9pXHvbGZeGYLLSd3wdVuC37FxVXlU1ARsk84eKWfWMXGYEqvA=="], - "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.2.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg=="], - - "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.2.4", "", { "os": "linux", "cpu": "arm" }, "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A=="], - - "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw=="], - - "@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.2.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA=="], - - "@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.2.4", "", { "os": "linux", "cpu": "none" }, "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA=="], + "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], - "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.2.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ=="], + "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], - "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw=="], + "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], - "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw=="], + "@jridgewell/source-map": ["@jridgewell/source-map@0.3.11", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA=="], - "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg=="], + "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.2.4" }, "os": "linux", "cpu": "arm" }, "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw=="], + "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg=="], + "@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="], - "@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.2.4" }, "os": "linux", "cpu": "ppc64" }, "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.6", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg=="], - "@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.2.4" }, "os": "linux", "cpu": "none" }, "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw=="], + "@next/env": ["@next/env@16.3.2", "", {}, "sha512-8k4YoG8cM7LWlkfzGNYCRBbFNlernLiMw4s0btVl+CmmWqn3VpYypA72/5Feb1UWdxe6tHqr5KHP4p4Y4m9luA=="], - "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.2.4" }, "os": "linux", "cpu": "s390x" }, "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg=="], + "@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.3.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ib5Llm93YCKoKWDh6ZaHq6QWTuOZ2bRkSnUwMmX8dsRIOkBNL1vVlSiUKSfixPL9SSh9pvukzqajk/klkn5vqg=="], - "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ=="], + "@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.3.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-qd98fX2+I5nYJDioW2o7nSjoxM5KvWdeDefM80igia4+C/qSIEhH4MhTE+hO/7qKM7W37/Mq+dOWp8UePSyLHw=="], - "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg=="], + "@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.3.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-vqsgb6FAOzcrCccsLXiKtAy5t8EzO+uOazuFaSkQxeY0tNONG3vpHYy8pyBafcI5SNFPTeyard6yTr6SzNGo2A=="], - "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q=="], + "@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.3.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-xIe1eujfHUB2XcxHGddxJyu6TJRPjC5NpIkQYB/32ESkt5VkQyIAjmLRS38c+s6QY+qjtY/4KarVDzXRuD7lZQ=="], - "@img/sharp-wasm32": ["@img/sharp-wasm32@0.34.5", "", { "dependencies": { "@emnapi/runtime": "^1.7.0" }, "cpu": "none" }, "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw=="], + "@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.3.2", "", { "os": "linux", "cpu": "x64" }, "sha512-Fe0SA2j8X0kmc3aveuHD7UktO3AE2+mH3LguP60vGbz7u0z+MrDXbeb5iZFYAwR7EzzzXJ2Yk966w9mGTFMqfA=="], - "@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.34.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g=="], + "@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.3.2", "", { "os": "linux", "cpu": "x64" }, "sha512-TFBipb+gyesI/2Ve4zVu7kGltBWN/R466G5/1gtt2lECfc22G1pjkTxu68Q9aFcOaXiRGTQfvDbQQFe7mYgxiQ=="], - "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.34.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg=="], + "@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.3.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-rVtmnNpBYIosDnKD/96dKxFsJnwnn1WRGG/HioSe8XCm2ksSHNrd2R6+hSjvTBxeMNhJ9pYeu/90cWB1nQLuNA=="], - "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], + "@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.3.2", "", { "os": "win32", "cpu": "x64" }, "sha512-H4Y2o2/JcHu8LtwzD5CXfHhwxwz8gfsx2HXDEw46Mtev5xHnEmB7HNtZtmriw5ReUOjRtcDqo7XSbU01FT9NlA=="], - "@isaacs/balanced-match": ["@isaacs/balanced-match@4.0.1", "", {}, "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ=="], + "@oxc-project/types": ["@oxc-project/types@0.146.0", "", {}, "sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA=="], - "@isaacs/brace-expansion": ["@isaacs/brace-expansion@5.0.0", "", { "dependencies": { "@isaacs/balanced-match": "^4.0.1" } }, "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA=="], + "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.5", "", { "os": "android", "cpu": "arm" }, "sha512-DLe/i+l8ynIBY7XEQ191TeZvCoowIGa18R+dIV30GW7DiOtp74i/xX8hs8GUjW5ARV7VZuie3d6AumSmCwbeRA=="], - "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.5", "", { "os": "android", "cpu": "arm64" }, "sha512-zXcwKlQApYAOELHd8PwKDFkagYF9Wy4e0RJ+0qnzl9Pjnpj75TEG8ufv40p2J7kCEfwZAsNiuzRIyNNMWT38ig=="], - "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], + "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-dK4QakI42nzWgJT5sm4y4y/O//D4OxM75/cH28RLV+nzIN9AY+YsbuUVrUTjlLjXR6vpyxFbSsbmNuJ6BP9sww=="], - "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], + "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-fqSALaUu1Wjd1nK2uW2kJDWdLCc8lx1IcY+MTY26Aurfdx19anlzhqXOgCFbBFQnlFDTn4TC1/7Nz4Bl2mLP3A=="], - "@jridgewell/source-map": ["@jridgewell/source-map@0.3.11", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA=="], + "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-/vCnNxlkxs9tKxNDcyWUePpJ/PgTzxIaVhoM5SmG8UV+GR/IcPam4VYxi7GIMo7PSDuNqlJqvprqii9NqqVCMw=="], - "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], + "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.5", "", { "os": "linux", "cpu": "arm" }, "sha512-abk0NLA519LxRCszmbE0jYKuQ9YPocOXTiOXOo6Yr+YAT95VH+PtqYAjOJvGKt3viEd/x4qzabAlwd5bHOOARg=="], - "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-Y7eALiJ8lr0M2HH103Js+g7V34wf6snlpZLAsHI90uLhr3PVlNsbFVAXJC9d/V6BnPyKtpSwI+NcB/RLxsQxuA=="], - "@microsoft/api-extractor": ["@microsoft/api-extractor@7.55.2", "", { "dependencies": { "@microsoft/api-extractor-model": "7.32.2", "@microsoft/tsdoc": "~0.16.0", "@microsoft/tsdoc-config": "~0.18.0", "@rushstack/node-core-library": "5.19.1", "@rushstack/rig-package": "0.6.0", "@rushstack/terminal": "0.19.5", "@rushstack/ts-command-line": "5.1.5", "diff": "~8.0.2", "lodash": "~4.17.15", "minimatch": "10.0.3", "resolve": "~1.22.1", "semver": "~7.5.4", "source-map": "~0.6.1", "typescript": "5.8.2" }, "bin": { "api-extractor": "bin/api-extractor" } }, "sha512-1jlWO4qmgqYoVUcyh+oXYRztZde/pAi7cSVzBz/rc+S7CoVzDasy8QE13dx6sLG4VRo8SfkkLbFORR6tBw4uGQ=="], + "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-xMvZgnbZg4YVnR/AX2b3oOPDTFYJvUVaJg5FedA/LuvexAtXibZQej4cnTkw3rjsJ/ggUROB64TdtETiim+FYA=="], - "@microsoft/api-extractor-model": ["@microsoft/api-extractor-model@7.32.2", "", { "dependencies": { "@microsoft/tsdoc": "~0.16.0", "@microsoft/tsdoc-config": "~0.18.0", "@rushstack/node-core-library": "5.19.1" } }, "sha512-Ussc25rAalc+4JJs9HNQE7TuO9y6jpYQX9nWD1DhqUzYPBr3Lr7O9intf+ZY8kD5HnIqeIRJX7ccCT0QyBy2Ww=="], + "@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-GRjeqTUDHTo5GwntsLaAMcBahG3nlpjftXWZLN73HiYQlhwEowvarFgQnRnQZtIp4keXX7quXFbG38uPZBa2EA=="], - "@microsoft/tsdoc": ["@microsoft/tsdoc@0.16.0", "", {}, "sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA=="], + "@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.5", "", { "os": "linux", "cpu": "s390x" }, "sha512-vLNTR45F2Uwc8AufkNXPmB4VliaXs+FvcheEogIzOXzO4l+LzieXF5A/TWxLy5HtqpsRCHUfd0lPVrrdgXdLHQ=="], - "@microsoft/tsdoc-config": ["@microsoft/tsdoc-config@0.18.0", "", { "dependencies": { "@microsoft/tsdoc": "0.16.0", "ajv": "~8.12.0", "jju": "~1.4.0", "resolve": "~1.22.2" } }, "sha512-8N/vClYyfOH+l4fLkkr9+myAoR6M7akc8ntBJ4DJdWH2b09uVfr71+LTMpNyG19fNqWDg8KEDZhx5wxuqHyGjw=="], + "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.5", "", { "os": "linux", "cpu": "x64" }, "sha512-Mgj59/HTuYeK9Gz2MA+mBWKnHsAgkBSec15ZMb1st3oIfFbX7gCjOae7GydHhzcyQi9Z/7M1QuN9bR3oFqF0jQ=="], - "@module-federation/error-codes": ["@module-federation/error-codes@0.21.6", "", {}, "sha512-MLJUCQ05KnoVl8xd6xs9a5g2/8U+eWmVxg7xiBMeR0+7OjdWUbHwcwgVFatRIwSZvFgKHfWEiI7wsU1q1XbTRQ=="], + "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.5", "", { "os": "linux", "cpu": "x64" }, "sha512-mY8AP0/ichsbhAxGnLa3d3+MwV0EfgrPND2bplI3Ym8T6R2pJ0N87bvrKVwNXmdy3jnr6eQBecdqx/HMknBmpA=="], - "@module-federation/runtime": ["@module-federation/runtime@0.21.6", "", { "dependencies": { "@module-federation/error-codes": "0.21.6", "@module-federation/runtime-core": "0.21.6", "@module-federation/sdk": "0.21.6" } }, "sha512-+caXwaQqwTNh+CQqyb4mZmXq7iEemRDrTZQGD+zyeH454JAYnJ3s/3oDFizdH6245pk+NiqDyOOkHzzFQorKhQ=="], + "@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.5", "", { "os": "none", "cpu": "arm64" }, "sha512-8SLssA2oweAxyRgDp789ACfRb/3P+zNRJpzZxSizxF9m8NUDQ4+3xjo8ttjhVGGw6Qxb70oZiEtIjaKikCO7Yw=="], - "@module-federation/runtime-core": ["@module-federation/runtime-core@0.21.6", "", { "dependencies": { "@module-federation/error-codes": "0.21.6", "@module-federation/sdk": "0.21.6" } }, "sha512-5Hd1Y5qp5lU/aTiK66lidMlM/4ji2gr3EXAtJdreJzkY+bKcI5+21GRcliZ4RAkICmvdxQU5PHPL71XmNc7Lsw=="], + "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-vGbruD5zquhoc8D9SViXgN2FBJtNdTyQ4DtG+SWiEGlJiAzoKcZ2xp+xuXCffhubVdt0NJlTZqkeRuERy7g8Cw=="], - "@module-federation/runtime-tools": ["@module-federation/runtime-tools@0.21.6", "", { "dependencies": { "@module-federation/runtime": "0.21.6", "@module-federation/webpack-bundler-runtime": "0.21.6" } }, "sha512-fnP+ZOZTFeBGiTAnxve+axGmiYn2D60h86nUISXjXClK3LUY1krUfPgf6MaD4YDJ4i51OGXZWPekeMe16pkd8Q=="], + "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.5", "", { "os": "win32", "cpu": "x64" }, "sha512-e/SXpgISz+IoqVcSSI0rx/d/he8zqLex+/rCWpnHpmVfmPIUjag9H6P7zotf0gJHwPUhQxZ/mF8tr6acebT9yw=="], - "@module-federation/sdk": ["@module-federation/sdk@0.21.6", "", {}, "sha512-x6hARETb8iqHVhEsQBysuWpznNZViUh84qV2yE7AD+g7uIzHKiYdoWqj10posbo5XKf/147qgWDzKZoKoEP2dw=="], + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], - "@module-federation/webpack-bundler-runtime": ["@module-federation/webpack-bundler-runtime@0.21.6", "", { "dependencies": { "@module-federation/runtime": "0.21.6", "@module-federation/sdk": "0.21.6" } }, "sha512-7zIp3LrcWbhGuFDTUMLJ2FJvcwjlddqhWGxi/MW3ur1a+HaO8v5tF2nl+vElKmbG1DFLU/52l3PElVcWf/YcsQ=="], + "@rollup/pluginutils": ["@rollup/pluginutils@5.4.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg=="], - "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.0.7", "", { "dependencies": { "@emnapi/core": "^1.5.0", "@emnapi/runtime": "^1.5.0", "@tybys/wasm-util": "^0.10.1" } }, "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.62.5", "", { "os": "android", "cpu": "arm" }, "sha512-jfkGfTwhQpsiSckPF8r9bU3pn3vyd72NlWaO+TgEO6WPSDnUhXzrNYCHBMOYj0ACaUgjm6eERLF+XV9a6RstoA=="], - "@next/env": ["@next/env@16.1.1", "", {}, "sha512-3oxyM97Sr2PqiVyMyrZUtrtM3jqqFxOQJVuKclDsgj/L728iZt/GyslkN4NwarledZATCenbk4Offjk1hQmaAA=="], + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.62.5", "", { "os": "android", "cpu": "arm64" }, "sha512-oGVqyQlxnrz9/ty89oHpU857VUHEl5/Xu4R2lS+aivCTrNnSsbiENzTnNaBsjxH0CNWGPhzHArOLFwo+oKXveA=="], - "@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.1.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JS3m42ifsVSJjSTzh27nW+Igfha3NdBOFScr9C80hHGrWx55pTrVL23RJbqir7k7/15SKlrLHhh/MQzqBBYrQA=="], + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.62.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bW7B8xMEq8n99Q3ieEcPRGuphurdZAaFzQc9Efyyw3FL6DZO6pMy9xhdN+kBoD7Sy05xNXSr4OyPPnpkYriS/A=="], - "@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.1.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-hbyKtrDGUkgkyQi1m1IyD3q4I/3m9ngr+V93z4oKHrPcmxwNL5iMWORvLSGAf2YujL+6HxgVvZuCYZfLfb4bGw=="], + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.62.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-YSwBS86QeHOGlrxJ1PSOIZSkzRL/JmKeunhc+lV6M1a6En8QuVCD/T/qIA0J4Gd2Y86RIOBYrLcOUtqGh9+/1w=="], - "@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.1.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-/fvHet+EYckFvRLQ0jPHJCUI5/B56+2DpI1xDSvi80r/3Ez+Eaa2Yq4tJcRTaB1kqj/HrYKn8Yplm9bNoMJpwQ=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.62.5", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-2fST8lILgl7cKbme/1KDdPCmbXbG+gqoV3bHp19L0ypX/3akYMBVdOunPleRCwonoLnXOZ/0F+Mt/v8POFmfcQ=="], - "@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.1.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-MFHrgL4TXNQbBPzkKKur4Fb5ICEJa87HM7fczFs2+HWblM7mMLdco3dvyTI+QmLBU9xgns/EeeINSZD6Ar+oLg=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.62.5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-cpIxQCP9J+EVad0a6LO1kY3ZGODlk80VlI+2I96B8xMcdHZ4pLVhfQ49JFpYqjPF91FFkQWftf57YlDcTiw9yQ=="], - "@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.1.1", "", { "os": "linux", "cpu": "x64" }, "sha512-20bYDfgOQAPUkkKBnyP9PTuHiJGM7HzNBbuqmD0jiFVZ0aOldz+VnJhbxzjcSabYsnNjMPsE0cyzEudpYxsrUQ=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.62.5", "", { "os": "linux", "cpu": "arm" }, "sha512-r9fGh3eFs3e/udWh5ZjXQtxiYK/xoFxQaYR/cELxac/Udkl5Th+IsFm0CX3Kl9hmUH/we7EoMpjJgeQNnE0+IA=="], - "@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.1.1", "", { "os": "linux", "cpu": "x64" }, "sha512-9pRbK3M4asAHQRkwaXwu601oPZHghuSC8IXNENgbBSyImHv/zY4K5udBusgdHkvJ/Tcr96jJwQYOll0qU8+fPA=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.62.5", "", { "os": "linux", "cpu": "arm" }, "sha512-xdvFdp7OM6KLJviJT2g/YuRSUjnZgGHk4RNgwIbN7X6cPugOucV60DdHXWzsBVCUdrGb6qSXnJQrrAKMmQuj3Q=="], - "@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.1.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-bdfQkggaLgnmYrFkSQfsHfOhk/mCYmjnrbRCGgkMcoOBZ4n+TRRSLmT/CU5SATzlBJ9TpioUyBW/vWFXTqQRiA=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.62.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-rRqILAndyzHzP7T9NFQrq+4HFWNhqkqkKur7eiBpfLmz01PO0JKx5Vchu3YllE4YXI/Ftgq/szrDWg5GJ0mI8g=="], - "@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.1.1", "", { "os": "win32", "cpu": "x64" }, "sha512-Ncwbw2WJ57Al5OX0k4chM68DKhEPlrXBaSXDCi2kPi5f4d8b3ejr3RRJGfKBLrn2YJL5ezNS7w2TZLHSti8CMw=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.62.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-Gf4X3qVMucayUvux6aXXPgXovocSFUC0rrffDuPI/S2nHhNMhjcZxsrAFYCOF350PRreW1XwzFj3CT/3bKsWCw=="], - "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.53", "", {}, "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ=="], + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.62.5", "", { "os": "linux", "cpu": "none" }, "sha512-+s5qA0TNM0qm8PK/a5gt/1Hpx+NV08uSuCncvhziIlQzT6AEV2fnUQo7eBtFTFO0nA9scauvoR2HusfXmQnO4w=="], - "@rollup/pluginutils": ["@rollup/pluginutils@5.3.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q=="], + "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.62.5", "", { "os": "linux", "cpu": "none" }, "sha512-ybb6QvWwWJCbBWqERpc8K3pYVGIrXlG8MEQ8IIuJY6Y9KdHQxoFoNyfkAOtKn1VHu3KuLidXvwrvGR1mEjeWCw=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.53.5", "", { "os": "android", "cpu": "arm" }, "sha512-iDGS/h7D8t7tvZ1t6+WPK04KD0MwzLZrG0se1hzBjSi5fyxlsiggoJHwh18PCFNn7tG43OWb6pdZ6Y+rMlmyNQ=="], + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.62.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-nZb1DtnOyhCmYvsC8A2CwOkopVg+IS1+fPUa7rMOAXtNw5+lLCLLPqd6XAiNrGtoQKsbvIBOwsHnBH/3wnb4HQ=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.53.5", "", { "os": "android", "cpu": "arm64" }, "sha512-wrSAViWvZHBMMlWk6EJhvg8/rjxzyEhEdgfMMjREHEq11EtJ6IP6yfcCH57YAEca2Oe3FNCE9DSTgU70EIGmVw=="], + "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.62.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-yMbj63Sp89ryrXLWyz+sy+fYD2HpOnMCLGbe4Oa1smclFSUukdtD/BgdiHaAetJNb74URD8U4hM+qG5KVzMEkg=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.53.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-S87zZPBmRO6u1YXQLwpveZm4JfPpAa6oHBX7/ghSiGH3rz/KDgAu1rKdGutV+WUI6tKDMbaBJomhnT30Y2t4VQ=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.62.5", "", { "os": "linux", "cpu": "none" }, "sha512-mhoan3OJw2kYV/e1jtIdmvUZgyBFeA6zGWsOswmR0Tg19TQbowZuR+JMLID6spbbBN7Zee2ejrgmy3+FxGrIdA=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.53.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-YTbnsAaHo6VrAczISxgpTva8EkfQus0VPEVJCEaboHtZRIb6h6j0BNxRBOwnDciFTZLDPW5r+ZBmhL/+YpTZgA=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.62.5", "", { "os": "linux", "cpu": "none" }, "sha512-5ZTLmjWbb1VZdjuyhe83K/8QO0/h11midQCBP+X5OYn32ra7eOBoM0ZqtaY4nkgNsYgmdVhMYPoyVPTjUpHf3w=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.53.5", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-1T8eY2J8rKJWzaznV7zedfdhD1BqVs1iqILhmHDq/bqCUZsrMt+j8VCTHhP0vdfbHK3e1IQ7VYx3jlKqwlf+vw=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.62.5", "", { "os": "linux", "cpu": "s390x" }, "sha512-m53kG+br6PGxOTmgBEM2DHSDs9RVjsyEbUwjJPJGTFm1grWOG8EKJggDCTb60unD4Tjby8fi7/m9XfkEWasVWg=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.53.5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-sHTiuXyBJApxRn+VFMaw1U+Qsz4kcNlxQ742snICYPrY+DDL8/ZbaC4DVIB7vgZmp3jiDaKA0WpBdP0aqPJoBQ=="], + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.62.5", "", { "os": "linux", "cpu": "x64" }, "sha512-6RHPJR1g/uvdYU8uXBnfq3nlqyZCP82Fr6NHgfGoaIeSh0YEqnX/x6uA9MmJJbnSH7swqX4F+CkGdUF+6doiQA=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.53.5", "", { "os": "linux", "cpu": "arm" }, "sha512-dV3T9MyAf0w8zPVLVBptVlzaXxka6xg1f16VAQmjg+4KMSTWDvhimI/Y6mp8oHwNrmnmVl9XxJ/w/mO4uIQONA=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.62.5", "", { "os": "linux", "cpu": "x64" }, "sha512-xs+OXQtEXgpXT0DmA5+U3qnRZHdCST/5HRQxS8wSPZTUZN/EMWeHuSIod32LQklTBZBV9DyfncKBQ8n5V3eFdw=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.53.5", "", { "os": "linux", "cpu": "arm" }, "sha512-wIGYC1x/hyjP+KAu9+ewDI+fi5XSNiUi9Bvg6KGAh2TsNMA3tSEs+Sh6jJ/r4BV/bx/CyWu2ue9kDnIdRyafcQ=="], + "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.62.5", "", { "os": "openbsd", "cpu": "x64" }, "sha512-e7hD+sl3s+mcLQDZ8pbudBVsdG6r5yN4w3LqG2TJ8sQHDpblWj5lrJs/3m01Cvlxbt4x13zu5thLjgypgtkYzw=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.53.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-Y+qVA0D9d0y2FRNiG9oM3Hut/DgODZbU9I8pLLPwAsU0tUKZ49cyV1tzmB/qRbSzGvY8lpgGkJuMyuhH7Ma+Vg=="], + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.62.5", "", { "os": "none", "cpu": "arm64" }, "sha512-GiyJaCf+WpMub/17aPcKk27QMl5W6f+KhdPTjlFOn5akH5Wa/DCM9Stdx5cDfmasyKB08MqpVQ1uJE2RkkpbXg=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.53.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-juaC4bEgJsyFVfqhtGLz8mbopaWD+WeSOYr5E16y+1of6KQjc0BpwZLuxkClqY1i8sco+MdyoXPNiCkQou09+g=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.62.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-+OQ8U2DdoEfXl8T4Fb18AjmEwbXMerKDKCL8yCPAYhKCEEKoul7rkbeGCBFCbAlaGaa7pmtRTpkAJM2LE/i5FA=="], - "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.53.5", "", { "os": "linux", "cpu": "none" }, "sha512-rIEC0hZ17A42iXtHX+EPJVL/CakHo+tT7W0pbzdAGuWOt2jxDFh7A/lRhsNHBcqL4T36+UiAgwO8pbmn3dE8wA=="], + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.62.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-KanvAZrPKbDBFwrgiU9yEVpQoox9QPV1WZOXX7HudJQY+eSlu82CtWxDU8WtuRRvtN5EGkLczkd6Y6DTcvm9wA=="], - "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.53.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-T7l409NhUE552RcAOcmJHj3xyZ2h7vMWzcwQI0hvn5tqHh3oSoclf9WgTl+0QqffWFG8MEVZZP1/OBglKZx52Q=="], + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.62.5", "", { "os": "win32", "cpu": "x64" }, "sha512-1aC3UEWTtRl3RK3VpDJ/Tqk1XI4SLTmXIthAq6wRWo8XiSXJNd+VprJM4/1P4+i6HIaFEFlVi9sTTziniD2tOQ=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.53.5", "", { "os": "linux", "cpu": "none" }, "sha512-7OK5/GhxbnrMcxIFoYfhV/TkknarkYC1hqUw1wU2xUN3TVRLNT5FmBv4KkheSG2xZ6IEbRAhTooTV2+R5Tk0lQ=="], + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.62.5", "", { "os": "win32", "cpu": "x64" }, "sha512-/gDJaRs4gl0NPIwqCz+6PkpmhhjRAD2j6P4rSNHBzUkO3naEx2mIU0pRle1vUNRQ7mE/+8OOeXLTv/J56FKiQg=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.53.5", "", { "os": "linux", "cpu": "none" }, "sha512-GwuDBE/PsXaTa76lO5eLJTyr2k8QkPipAyOrs4V/KJufHCZBJ495VCGJol35grx9xryk4V+2zd3Ri+3v7NPh+w=="], + "@rsbuild/core": ["@rsbuild/core@2.1.13", "", { "dependencies": { "@rspack/core": "~2.1.10", "@swc/helpers": "^0.5.23" }, "peerDependencies": { "core-js": ">= 3.0.0" }, "optionalPeers": ["core-js"], "bin": { "rsbuild": "./bin/rsbuild.js" } }, "sha512-Z+6MzmjOio4+bFZQ24k+7ge/oNCOdXIunAssrswTNE8AIf6mcyXpJZevRXRiOEMZasRPA8VNyh+9JngQLg729Q=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.53.5", "", { "os": "linux", "cpu": "s390x" }, "sha512-IAE1Ziyr1qNfnmiQLHBURAD+eh/zH1pIeJjeShleII7Vj8kyEm2PF77o+lf3WTHDpNJcu4IXJxNO0Zluro8bOw=="], + "@rsbuild/plugin-react": ["@rsbuild/plugin-react@2.1.0", "", { "dependencies": { "@rspack/plugin-react-refresh": "^2.0.2", "react-refresh": "^0.18.0" }, "peerDependencies": { "@rsbuild/core": "^2.0.0" }, "optionalPeers": ["@rsbuild/core"] }, "sha512-RQTIAWB/CwPjoWt9iAl+8HixeQVgZ7kEIBrWPCixfITyHdiD84h0YpUTpEUuz6kGHw1KXT9mHZ3Rwy6WG7aRDA=="], - "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.53.5", "", { "os": "linux", "cpu": "x64" }, "sha512-Pg6E+oP7GvZ4XwgRJBuSXZjcqpIW3yCBhK4BcsANvb47qMvAbCjR6E+1a/U2WXz1JJxp9/4Dno3/iSJLcm5auw=="], + "@rspack/binding": ["@rspack/binding@2.1.10", "", { "optionalDependencies": { "@rspack/binding-darwin-arm64": "2.1.10", "@rspack/binding-darwin-x64": "2.1.10", "@rspack/binding-linux-arm64-gnu": "2.1.10", "@rspack/binding-linux-arm64-musl": "2.1.10", "@rspack/binding-linux-ppc64-gnu": "2.1.10", "@rspack/binding-linux-riscv64-gnu": "2.1.10", "@rspack/binding-linux-riscv64-musl": "2.1.10", "@rspack/binding-linux-s390x-gnu": "2.1.10", "@rspack/binding-linux-x64-gnu": "2.1.10", "@rspack/binding-linux-x64-musl": "2.1.10", "@rspack/binding-wasm32-wasi": "2.1.10", "@rspack/binding-win32-arm64-msvc": "2.1.10", "@rspack/binding-win32-ia32-msvc": "2.1.10", "@rspack/binding-win32-x64-msvc": "2.1.10" } }, "sha512-vnu/UP5HnrND15lO9+VeG6eUrbTyycHNQNQ3XEiRiFojuoiGZkIZC3Hbzr8qQH44C6vScPODEPvvIVvLcO2LpQ=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.53.5", "", { "os": "linux", "cpu": "x64" }, "sha512-txGtluxDKTxaMDzUduGP0wdfng24y1rygUMnmlUJ88fzCCULCLn7oE5kb2+tRB+MWq1QDZT6ObT5RrR8HFRKqg=="], + "@rspack/binding-darwin-arm64": ["@rspack/binding-darwin-arm64@2.1.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-DZlcTpbIb2mjeS1aSG4k01UH33Zj7T+k8ZylPK6HmsKs4JvK4wgpWFC78WVv3p/Aj3MZS6DwtDLwpZ2Ihj/fpg=="], - "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.53.5", "", { "os": "none", "cpu": "arm64" }, "sha512-3DFiLPnTxiOQV993fMc+KO8zXHTcIjgaInrqlG8zDp1TlhYl6WgrOHuJkJQ6M8zHEcntSJsUp1XFZSY8C1DYbg=="], + "@rspack/binding-darwin-x64": ["@rspack/binding-darwin-x64@2.1.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-my/0h2LwxCRT6cg3oDDC2e0ZOxQLVajAdIcv0fqnQk5JRNvVuL89PuTutitnSqie1A0/JSL8OQz5XHwmoS3kow=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.53.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-nggc/wPpNTgjGg75hu+Q/3i32R00Lq1B6N1DO7MCU340MRKL3WZJMjA9U4K4gzy3dkZPXm9E1Nc81FItBVGRlA=="], + "@rspack/binding-linux-arm64-gnu": ["@rspack/binding-linux-arm64-gnu@2.1.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-laevn9g+E5PAUEGqiKe6Ju5KApsuQYp+bPI17XS3Lkl8eqL5pS/BmHYU7QMlst4GzV8+wlruVTMh//+st6Vqzg=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.53.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-U/54pTbdQpPLBdEzCT6NBCFAfSZMvmjr0twhnD9f4EIvlm9wy3jjQ38yQj1AGznrNO65EWQMgm/QUjuIVrYF9w=="], + "@rspack/binding-linux-arm64-musl": ["@rspack/binding-linux-arm64-musl@2.1.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-V71+Qz5G72+ROZXrJn5zxOszdG1AEbO8pcC/itXXtf4yRR6a3bVHKNKGhipBNxb8eI6cnD/01FH1h3ZG655jLw=="], - "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.53.5", "", { "os": "win32", "cpu": "x64" }, "sha512-2NqKgZSuLH9SXBBV2dWNRCZmocgSOx8OJSdpRaEcRlIfX8YrKxUT6z0F1NpvDVhOsl190UFTRh2F2WDWWCYp3A=="], + "@rspack/binding-linux-ppc64-gnu": ["@rspack/binding-linux-ppc64-gnu@2.1.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-U7HlNzHcDtZ+LYOtOJmtx67kHEybZzUUAaP7aEXjGYO5WTCgh/176sW2UYP0rmZLrgUNFUuzn+B98RLaClNaVg=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.53.5", "", { "os": "win32", "cpu": "x64" }, "sha512-JRpZUhCfhZ4keB5v0fe02gQJy05GqboPOaxvjugW04RLSYYoB/9t2lx2u/tMs/Na/1NXfY8QYjgRljRpN+MjTQ=="], + "@rspack/binding-linux-riscv64-gnu": ["@rspack/binding-linux-riscv64-gnu@2.1.10", "", { "os": "linux", "cpu": "none" }, "sha512-GMGTJpy9/ecE+5F5IfxZH4bXv0Wx/b2TiehTlCbTksbL+pKpLHYy0rwGdjWDKbmBkhxMMqPiC7PDnn9LbdnnLA=="], - "@rsbuild/core": ["@rsbuild/core@1.6.15", "", { "dependencies": { "@rspack/core": "1.6.8", "@rspack/lite-tapable": "~1.1.0", "@swc/helpers": "^0.5.17", "core-js": "~3.47.0", "jiti": "^2.6.1" }, "bin": { "rsbuild": "bin/rsbuild.js" } }, "sha512-LvoOF53PL6zXgdzEhgnnP51S4FseDFH1bHrobK4EK6zZX/tN8qgf5tdlmN7h4OkMv/Qs1oUfvj0QcLWSstnnvA=="], + "@rspack/binding-linux-riscv64-musl": ["@rspack/binding-linux-riscv64-musl@2.1.10", "", { "os": "linux", "cpu": "none" }, "sha512-rkurnAWc04vIbzG1QCrPBWSJadZvaOt1mazFH3EdiJO8VUiu0I1T9zdiwuDOPrd50lOKIZlcTXbd5aaAkWEnvQ=="], - "@rsbuild/plugin-react": ["@rsbuild/plugin-react@1.4.2", "", { "dependencies": { "@rspack/plugin-react-refresh": "^1.5.2", "react-refresh": "^0.18.0" }, "peerDependencies": { "@rsbuild/core": "1.x" } }, "sha512-2rJb5mOuqVof2aDq4SbB1E65+0n1vjhAADipC88jvZRNuTOulg79fh7R4tsCiBMI4VWq46gSpwekiK8G5bq6jg=="], + "@rspack/binding-linux-s390x-gnu": ["@rspack/binding-linux-s390x-gnu@2.1.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-X+DyxkriZEAF/wihI7ERDv+CAS0mbMv36aEuQ+vXzTlvS6cSmpou/r29AHbvIF3NlG1UeAbDVlOs9QrMBZjpUQ=="], - "@rspack/binding": ["@rspack/binding@1.6.8", "", { "optionalDependencies": { "@rspack/binding-darwin-arm64": "1.6.8", "@rspack/binding-darwin-x64": "1.6.8", "@rspack/binding-linux-arm64-gnu": "1.6.8", "@rspack/binding-linux-arm64-musl": "1.6.8", "@rspack/binding-linux-x64-gnu": "1.6.8", "@rspack/binding-linux-x64-musl": "1.6.8", "@rspack/binding-wasm32-wasi": "1.6.8", "@rspack/binding-win32-arm64-msvc": "1.6.8", "@rspack/binding-win32-ia32-msvc": "1.6.8", "@rspack/binding-win32-x64-msvc": "1.6.8" } }, "sha512-lUeL4mbwGo+nqRKqFDCm9vH2jv9FNMVt1X8jqayWRcOCPlj/2UVMEFgqjR7Pp2vlvnTKq//31KbDBJmDZq31RQ=="], + "@rspack/binding-linux-x64-gnu": ["@rspack/binding-linux-x64-gnu@2.1.10", "", { "os": "linux", "cpu": "x64" }, "sha512-Fat09V6jUuyo9qG7Wyj9cQ31VDfLmokXyBtGqKxY5OvSWHereB7QUub5btbPXHwbp6Iq4aAQyUbbLTzvR1YaBw=="], - "@rspack/binding-darwin-arm64": ["@rspack/binding-darwin-arm64@1.6.8", "", { "os": "darwin", "cpu": "arm64" }, "sha512-e8CTQtzaeGnf+BIzR7wRMUwKfIg0jd/sxMRc1Vd0bCMHBhSN9EsGoMuJJaKeRrSmy2nwMCNWHIG+TvT1CEKg+A=="], + "@rspack/binding-linux-x64-musl": ["@rspack/binding-linux-x64-musl@2.1.10", "", { "os": "linux", "cpu": "x64" }, "sha512-lhHOnIJ4ClpIlA1f1L8aoxEZivYLjnjq5A6jKKz7BKsm+cHK8kqqEm6lO5KqA5xQT0Lonq1o28bmKHEj6JHInw=="], - "@rspack/binding-darwin-x64": ["@rspack/binding-darwin-x64@1.6.8", "", { "os": "darwin", "cpu": "x64" }, "sha512-ku1XpTEPt6Za11zhpFWhfwrTQogcgi9RJrOUVC4FESiPO9aKyd4hJ+JiPgLY0MZOqsptK6vEAgOip+uDVXrCpg=="], + "@rspack/binding-wasm32-wasi": ["@rspack/binding-wasm32-wasi@2.1.10", "", { "dependencies": { "@emnapi/core": "1.11.3", "@emnapi/runtime": "1.11.3", "@napi-rs/wasm-runtime": "1.1.6" }, "cpu": "none" }, "sha512-KY5YbWbuvYcoaLXnV+vzZOvGRCeb6jt4EpVpKdph1h1IJjwX/ju15EQ+GOe3iecZEdf0OttQcNVcwBkLkFT9ag=="], - "@rspack/binding-linux-arm64-gnu": ["@rspack/binding-linux-arm64-gnu@1.6.8", "", { "os": "linux", "cpu": "arm64" }, "sha512-fvZX6xZPvBT8qipSpvkKMX5M7yd2BSpZNCZXcefw6gA3uC7LI3gu+er0LrDXY1PtPzVuHTyDx+abwWpagV3PiQ=="], + "@rspack/binding-win32-arm64-msvc": ["@rspack/binding-win32-arm64-msvc@2.1.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-z4GWzMLofaDGpAt9Z+MlN88LlUBDm+zM6R2GdOOPM6/4g/h3/+47OP7casmSL3AwTGYBEJqogwt08sRSosB6Cg=="], - "@rspack/binding-linux-arm64-musl": ["@rspack/binding-linux-arm64-musl@1.6.8", "", { "os": "linux", "cpu": "arm64" }, "sha512-++XMKcMNrt59HcFBLnRaJcn70k3X0GwkAegZBVpel8xYIAgvoXT5+L8P1ExId/yTFxqedaz8DbcxQnNmMozviw=="], + "@rspack/binding-win32-ia32-msvc": ["@rspack/binding-win32-ia32-msvc@2.1.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-7qcWdsZ+GuGtzKjqgy7wTN7Dso/ezIY8yhx1r2yIbcczdmXj4FhaEampMDp/25HwtKwIGBBoh6HHSt3JWxpTUg=="], - "@rspack/binding-linux-x64-gnu": ["@rspack/binding-linux-x64-gnu@1.6.8", "", { "os": "linux", "cpu": "x64" }, "sha512-tv3BWkTE1TndfX+DsE1rSTg8fBevCxujNZ3MlfZ22Wfy9x1FMXTJlWG8VIOXmaaJ1wUHzv8S7cE2YUUJ2LuiCg=="], + "@rspack/binding-win32-x64-msvc": ["@rspack/binding-win32-x64-msvc@2.1.10", "", { "os": "win32", "cpu": "x64" }, "sha512-pgp23pLrzfhGnKycxzr7ifP17lAbWZEfnx1bX8gXtYrnpJ66DRNyTKSzxB6sa/HBWjS1L8PX5TjMZ44WfPydqQ=="], - "@rspack/binding-linux-x64-musl": ["@rspack/binding-linux-x64-musl@1.6.8", "", { "os": "linux", "cpu": "x64" }, "sha512-DCGgZ5/in1O3FjHWqXnDsncRy+48cMhfuUAAUyl0yDj1NpsZu9pP+xfGLvGcQTiYrVl7IH9Aojf1eShP/77WGA=="], + "@rspack/core": ["@rspack/core@2.1.10", "", { "dependencies": { "@rspack/binding": "2.1.10" }, "peerDependencies": { "@module-federation/runtime-tools": "^0.24.1 || ^2.0.0", "@swc/helpers": "^0.5.23" }, "optionalPeers": ["@module-federation/runtime-tools", "@swc/helpers"] }, "sha512-YSS2/Xxz8uiG/KXDkqOoA3dTetNo/vysk7bAexQOrU8iuq7JuzDTTAwLKvWZnwmvME8M8m5wcM4YvfIwYmidHA=="], - "@rspack/binding-wasm32-wasi": ["@rspack/binding-wasm32-wasi@1.6.8", "", { "dependencies": { "@napi-rs/wasm-runtime": "1.0.7" }, "cpu": "none" }, "sha512-VUwdhl/lI4m6o1OGCZ9JwtMjTV/yLY5VZTQdEPKb40JMTlmZ5MBlr5xk7ByaXXYHr6I+qnqEm73iMKQvg6iknw=="], + "@rspack/plugin-react-refresh": ["@rspack/plugin-react-refresh@2.0.2", "", { "peerDependencies": { "@rspack/core": "^2.0.0", "react-refresh": ">=0.10.0 <1.0.0" }, "optionalPeers": ["@rspack/core"] }, "sha512-dGNZiCxQxgAUI9sah7gd8u+O7OJZRCmqtEJNDOd8xW5RqcieC86F7p5qcShyw6onH5pKf57evpr2VjGbaFGkZg=="], - "@rspack/binding-win32-arm64-msvc": ["@rspack/binding-win32-arm64-msvc@1.6.8", "", { "os": "win32", "cpu": "arm64" }, "sha512-23YX7zlOZlub+nPGDBUzktb4D5D6ETUAluKjXEeHIZ9m7fSlEYBnGL66YE+3t1DHXGd0OqsdwlvrNGcyo6EXDQ=="], + "@standard-schema/utils": ["@standard-schema/utils@0.3.0", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="], - "@rspack/binding-win32-ia32-msvc": ["@rspack/binding-win32-ia32-msvc@1.6.8", "", { "os": "win32", "cpu": "ia32" }, "sha512-cFgRE3APxrY4AEdooVk2LtipwNNT/9mrnjdC5lVbsIsz+SxvGbZR231bxDJEqP15+RJOaD07FO1sIjINFqXMEg=="], + "@swc/helpers": ["@swc/helpers@0.5.23", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="], - "@rspack/binding-win32-x64-msvc": ["@rspack/binding-win32-x64-msvc@1.6.8", "", { "os": "win32", "cpu": "x64" }, "sha512-cIuhVsZYd3o3Neo1JSAhJYw6BDvlxaBoqvgwRkG1rs0ExFmEmgYyG7ip9pFKnKNWph/tmW3rDYypmEfjs1is7g=="], + "@tanstack/query-core": ["@tanstack/query-core@5.102.2", "", {}, "sha512-zQ5794PXBlV5Wl7N23SR1/Ss+wPE/h2Ye4XlKpm3omN8i8b/Fd4DAdqpLS2AXj5M/RMObt3k5qy3E7kzt/AvBA=="], - "@rspack/core": ["@rspack/core@1.6.8", "", { "dependencies": { "@module-federation/runtime-tools": "0.21.6", "@rspack/binding": "1.6.8", "@rspack/lite-tapable": "1.1.0" }, "peerDependencies": { "@swc/helpers": ">=0.5.1" }, "optionalPeers": ["@swc/helpers"] }, "sha512-FolcIAH5FW4J2FET+qwjd1kNeFbCkd0VLuIHO0thyolEjaPSxw5qxG67DA7BZGm6PVcoiSgPLks1DL6eZ8c+fA=="], + "@tanstack/react-query": ["@tanstack/react-query@5.102.2", "", { "dependencies": { "@tanstack/query-core": "5.102.2" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-KxU8ZyOEuJ81eTSgXa8GQbk/jO/rz0elYtNKt3VMtM2pRjeO8ADIu7sqqmEjFKJKqco9h2N1ojIDuHs6VfDItQ=="], - "@rspack/lite-tapable": ["@rspack/lite-tapable@1.1.0", "", {}, "sha512-E2B0JhYFmVAwdDiG14+DW0Di4Ze4Jg10Pc4/lILUrd5DRCaklduz2OvJ5HYQ6G+hd+WTzqQb3QnDNfK4yvAFYw=="], + "@testing-library/dom": ["@testing-library/dom@10.4.1", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" } }, "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg=="], - "@rspack/plugin-react-refresh": ["@rspack/plugin-react-refresh@1.5.3", "", { "dependencies": { "error-stack-parser": "^2.1.4", "html-entities": "^2.6.0" }, "peerDependencies": { "react-refresh": ">=0.10.0 <1.0.0", "webpack-hot-middleware": "2.x" }, "optionalPeers": ["webpack-hot-middleware"] }, "sha512-VOnQMf3YOHkTqJ0+BJbrYga4tQAWNwoAnkgwRauXB4HOyCc5wLfBs9DcOFla/2usnRT3Sq6CMVhXmdPobwAoTA=="], + "@testing-library/jest-dom": ["@testing-library/jest-dom@7.0.1", "", { "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "picocolors": "^1.1.1", "redent": "^3.0.0" }, "peerDependencies": { "@testing-library/dom": ">=10 <11", "vitest": ">= 0.32" }, "optionalPeers": ["vitest"] }, "sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw=="], - "@rushstack/node-core-library": ["@rushstack/node-core-library@5.19.1", "", { "dependencies": { "ajv": "~8.13.0", "ajv-draft-04": "~1.0.0", "ajv-formats": "~3.0.1", "fs-extra": "~11.3.0", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", "semver": "~7.5.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-ESpb2Tajlatgbmzzukg6zyAhH+sICqJR2CNXNhXcEbz6UGCQfrKCtkxOpJTftWc8RGouroHG0Nud1SJAszvpmA=="], + "@testing-library/react": ["@testing-library/react@16.3.2", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g=="], - "@rushstack/problem-matcher": ["@rushstack/problem-matcher@0.1.1", "", { "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-Fm5XtS7+G8HLcJHCWpES5VmeMyjAKaWeyZU5qPzZC+22mPlJzAsOxymHiWIfuirtPckX3aptWws+K2d0BzniJA=="], + "@testing-library/react-hooks": ["@testing-library/react-hooks@8.0.1", "", { "dependencies": { "@babel/runtime": "^7.12.5", "react-error-boundary": "^3.1.0" }, "peerDependencies": { "@types/react": "^16.9.0 || ^17.0.0", "react": "^16.9.0 || ^17.0.0", "react-dom": "^16.9.0 || ^17.0.0", "react-test-renderer": "^16.9.0 || ^17.0.0" }, "optionalPeers": ["@types/react", "react-dom", "react-test-renderer"] }, "sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g=="], - "@rushstack/rig-package": ["@rushstack/rig-package@0.6.0", "", { "dependencies": { "resolve": "~1.22.1", "strip-json-comments": "~3.1.1" } }, "sha512-ZQmfzsLE2+Y91GF15c65L/slMRVhF6Hycq04D4TwtdGaUAbIXXg9c5pKA5KFU7M4QMaihoobp9JJYpYcaY3zOw=="], + "@testing-library/user-event": ["@testing-library/user-event@14.6.6", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-Jbs9FpkkIDw8FgSc6kOVsOv8JuuqGAL7J4X1oot77JxAoDlkNn2GRkd0aYRVuQ+pVQAiHWVkE4rX/dkF5fBiCw=="], - "@rushstack/terminal": ["@rushstack/terminal@0.19.5", "", { "dependencies": { "@rushstack/node-core-library": "5.19.1", "@rushstack/problem-matcher": "0.1.1", "supports-color": "~8.1.1" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-6k5tpdB88G0K7QrH/3yfKO84HK9ggftfUZ51p7fePyCE7+RLLHkWZbID9OFWbXuna+eeCFE7AkKnRMHMxNbz7Q=="], + "@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="], - "@rushstack/ts-command-line": ["@rushstack/ts-command-line@5.1.5", "", { "dependencies": { "@rushstack/terminal": "0.19.5", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" } }, "sha512-YmrFTFUdHXblYSa+Xc9OO9FsL/XFcckZy0ycQ6q7VSBsVs5P0uD9vcges5Q9vctGlVdu27w+Ct6IuJ458V0cTQ=="], + "@types/aria-query": ["@types/aria-query@5.0.4", "", {}, "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw=="], - "@standard-schema/utils": ["@standard-schema/utils@0.3.0", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="], + "@types/bun": ["@types/bun@1.4.0", "", { "dependencies": { "bun-types": "1.4.0" } }, "sha512-K+lZULY23vRgK/CfTjFIV+tyifaNdSMlPh9j+6mQ/cLfpOznLyAuzgV/JQysyECpkBQLVMSyvjlr2fBUSA9wFQ=="], - "@swc/helpers": ["@swc/helpers@0.5.15", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g=="], + "@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="], - "@tanstack/query-core": ["@tanstack/query-core@5.90.16", "", {}, "sha512-MvtWckSVufs/ja463/K4PyJeqT+HMlJWtw6PrCpywznd2NSgO3m4KwO9RqbFqGg6iDE8vVMFWMeQI4Io3eEYww=="], + "@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="], - "@tanstack/react-query": ["@tanstack/react-query@5.90.16", "", { "dependencies": { "@tanstack/query-core": "5.90.16" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-bpMGOmV4OPmif7TNMteU/Ehf/hoC0Kf98PDc0F4BZkFrEapRMEqI/V6YS0lyzwSV6PQpY1y4xxArUIfBW5LVxQ=="], + "@types/node": ["@types/node@26.2.0", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg=="], - "@testing-library/dom": ["@testing-library/dom@10.4.1", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" } }, "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg=="], + "@types/react": ["@types/react@19.2.18", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w=="], - "@testing-library/jest-dom": ["@testing-library/jest-dom@6.9.1", "", { "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "picocolors": "^1.1.1", "redent": "^3.0.0" } }, "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA=="], + "@types/react-dom": ["@types/react-dom@19.2.5", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-fMPwH9v7r/pp43yUd2/Mbiex5KouJwwR3dzHkhLREUC6764VyDsqxhAxv6OFEYR1RhjOyD1naqba8ECDBe7ZQg=="], - "@testing-library/react": ["@testing-library/react@16.3.1", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-gr4KtAWqIOQoucWYD/f6ki+j5chXfcPc74Col/6poTyqTmn7zRmodWahWRCp8tYd+GMqBonw6hstNzqjbs6gjw=="], + "@types/webpack": ["@types/webpack@5.28.5", "", { "dependencies": { "@types/node": "*", "tapable": "^2.2.0", "webpack": "^5" } }, "sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw=="], - "@testing-library/react-hooks": ["@testing-library/react-hooks@8.0.1", "", { "dependencies": { "@babel/runtime": "^7.12.5", "react-error-boundary": "^3.1.0" }, "peerDependencies": { "@types/react": "^16.9.0 || ^17.0.0", "react": "^16.9.0 || ^17.0.0", "react-dom": "^16.9.0 || ^17.0.0", "react-test-renderer": "^16.9.0 || ^17.0.0" }, "optionalPeers": ["@types/react", "react-dom", "react-test-renderer"] }, "sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g=="], + "@types/whatwg-mimetype": ["@types/whatwg-mimetype@3.0.2", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], - "@testing-library/user-event": ["@testing-library/user-event@14.6.1", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw=="], + "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], - "@tybys/wasm-util": ["@tybys/wasm-util@0.10.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="], + "@typescript/old": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="], - "@types/argparse": ["@types/argparse@1.0.38", "", {}, "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA=="], + "@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="], - "@types/aria-query": ["@types/aria-query@5.0.4", "", {}, "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw=="], + "@typescript/typescript-darwin-arm64": ["@typescript/typescript-darwin-arm64@7.0.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA=="], - "@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="], + "@typescript/typescript-darwin-x64": ["@typescript/typescript-darwin-x64@7.0.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA=="], - "@types/babel__generator": ["@types/babel__generator@7.27.0", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="], + "@typescript/typescript-freebsd-arm64": ["@typescript/typescript-freebsd-arm64@7.0.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ=="], - "@types/babel__template": ["@types/babel__template@7.4.4", "", { "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A=="], + "@typescript/typescript-freebsd-x64": ["@typescript/typescript-freebsd-x64@7.0.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw=="], - "@types/babel__traverse": ["@types/babel__traverse@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="], + "@typescript/typescript-linux-arm": ["@typescript/typescript-linux-arm@7.0.2", "", { "os": "linux", "cpu": "arm" }, "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ=="], - "@types/bun": ["@types/bun@1.3.4", "", { "dependencies": { "bun-types": "1.3.4" } }, "sha512-EEPTKXHP+zKGPkhRLv+HI0UEX8/o+65hqARxLy8Ov5rIxMBPNTjeZww00CIihrIQGEQBYg+0roO5qOnS/7boGA=="], + "@typescript/typescript-linux-arm64": ["@typescript/typescript-linux-arm64@7.0.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ=="], - "@types/eslint": ["@types/eslint@9.6.1", "", { "dependencies": { "@types/estree": "*", "@types/json-schema": "*" } }, "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag=="], + "@typescript/typescript-linux-loong64": ["@typescript/typescript-linux-loong64@7.0.2", "", { "os": "linux", "cpu": "none" }, "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ=="], - "@types/eslint-scope": ["@types/eslint-scope@3.7.7", "", { "dependencies": { "@types/eslint": "*", "@types/estree": "*" } }, "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg=="], + "@typescript/typescript-linux-mips64el": ["@typescript/typescript-linux-mips64el@7.0.2", "", { "os": "linux", "cpu": "none" }, "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA=="], - "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], + "@typescript/typescript-linux-ppc64": ["@typescript/typescript-linux-ppc64@7.0.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA=="], - "@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="], + "@typescript/typescript-linux-riscv64": ["@typescript/typescript-linux-riscv64@7.0.2", "", { "os": "linux", "cpu": "none" }, "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ=="], - "@types/node": ["@types/node@25.0.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA=="], + "@typescript/typescript-linux-s390x": ["@typescript/typescript-linux-s390x@7.0.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw=="], - "@types/react": ["@types/react@19.2.7", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg=="], + "@typescript/typescript-linux-x64": ["@typescript/typescript-linux-x64@7.0.2", "", { "os": "linux", "cpu": "x64" }, "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A=="], - "@types/react-dom": ["@types/react-dom@19.2.3", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="], + "@typescript/typescript-netbsd-arm64": ["@typescript/typescript-netbsd-arm64@7.0.2", "", { "os": "none", "cpu": "arm64" }, "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA=="], - "@types/webpack": ["@types/webpack@5.28.5", "", { "dependencies": { "@types/node": "*", "tapable": "^2.2.0", "webpack": "^5" } }, "sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw=="], + "@typescript/typescript-netbsd-x64": ["@typescript/typescript-netbsd-x64@7.0.2", "", { "os": "none", "cpu": "x64" }, "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA=="], - "@types/whatwg-mimetype": ["@types/whatwg-mimetype@3.0.2", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], + "@typescript/typescript-openbsd-arm64": ["@typescript/typescript-openbsd-arm64@7.0.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ=="], - "@vitejs/plugin-react": ["@vitejs/plugin-react@5.1.2", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.53", "@types/babel__core": "^7.20.5", "react-refresh": "^0.18.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-EcA07pHJouywpzsoTUqNh5NwGayl2PPVEJKUSinGGSxFGYn+shYbqMGBg6FXDqgXum9Ou/ecb+411ssw8HImJQ=="], + "@typescript/typescript-openbsd-x64": ["@typescript/typescript-openbsd-x64@7.0.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg=="], - "@volar/language-core": ["@volar/language-core@2.4.27", "", { "dependencies": { "@volar/source-map": "2.4.27" } }, "sha512-DjmjBWZ4tJKxfNC1F6HyYERNHPYS7L7OPFyCrestykNdUZMFYzI9WTyvwPcaNaHlrEUwESHYsfEw3isInncZxQ=="], + "@typescript/typescript-sunos-x64": ["@typescript/typescript-sunos-x64@7.0.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g=="], - "@volar/source-map": ["@volar/source-map@2.4.27", "", {}, "sha512-ynlcBReMgOZj2i6po+qVswtDUeeBRCTgDurjMGShbm8WYZgJ0PA4RmtebBJ0BCYol1qPv3GQF6jK7C9qoVc7lg=="], + "@typescript/typescript-win32-arm64": ["@typescript/typescript-win32-arm64@7.0.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ=="], - "@volar/typescript": ["@volar/typescript@2.4.27", "", { "dependencies": { "@volar/language-core": "2.4.27", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-eWaYCcl/uAPInSK2Lze6IqVWaBu/itVqR5InXcHXFyles4zO++Mglt3oxdgj75BDcv1Knr9Y93nowS8U3wqhxg=="], + "@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="], - "@vue/compiler-core": ["@vue/compiler-core@3.5.26", "", { "dependencies": { "@babel/parser": "^7.28.5", "@vue/shared": "3.5.26", "entities": "^7.0.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-vXyI5GMfuoBCnv5ucIT7jhHKl55Y477yxP6fc4eUswjP8FG3FFVFd41eNDArR+Uk3QKn2Z85NavjaxLxOC19/w=="], + "@typescript/typescript6": ["@typescript/typescript6@6.0.2", "", { "dependencies": { "@typescript/old": "npm:typescript@^6" }, "bin": { "tsc6": "bin/tsc6" } }, "sha512-mbCddXd+jm7hfx7w2YU64/Av4/NqqeG3GoRZgxPcgoTxYjhrcfJRw9ULch71SS4G+Q3bOXFhRvPqjguN0Hyp5w=="], - "@vue/compiler-dom": ["@vue/compiler-dom@3.5.26", "", { "dependencies": { "@vue/compiler-core": "3.5.26", "@vue/shared": "3.5.26" } }, "sha512-y1Tcd3eXs834QjswshSilCBnKGeQjQXB6PqFn/1nxcQw4pmG42G8lwz+FZPAZAby6gZeHSt/8LMPfZ4Rb+Bd/A=="], + "@vitejs/plugin-react": ["@vitejs/plugin-react@6.1.0", "", { "dependencies": { "@rolldown/pluginutils": "^1.0.1" }, "peerDependencies": { "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", "babel-plugin-react-compiler": "^1.0.0", "oxc-transform-react": "^0.145.0", "vite": "^8.0.0" }, "optionalPeers": ["@rolldown/plugin-babel", "babel-plugin-react-compiler", "oxc-transform-react"] }, "sha512-qd2BzUBehkov86WFhg0JkEFEYyCLG9uPCe6qWTY/kRlss9OvJrOF2UbIWT7p+8IzZHkEu0DNGHc4HSv+JdDLsw=="], - "@vue/compiler-vue2": ["@vue/compiler-vue2@2.7.16", "", { "dependencies": { "de-indent": "^1.0.2", "he": "^1.2.0" } }, "sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A=="], + "@volar/language-core": ["@volar/language-core@2.4.28", "", { "dependencies": { "@volar/source-map": "2.4.28" } }, "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ=="], - "@vue/language-core": ["@vue/language-core@2.2.0", "", { "dependencies": { "@volar/language-core": "~2.4.11", "@vue/compiler-dom": "^3.5.0", "@vue/compiler-vue2": "^2.7.16", "@vue/shared": "^3.5.0", "alien-signals": "^0.4.9", "minimatch": "^9.0.3", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-O1ZZFaaBGkKbsRfnVH1ifOK1/1BUkyK+3SQsfnh6PmMmD4qJcTU8godCeA96jjDRTL6zgnK7YzCHfaUlH2r0Mw=="], + "@volar/source-map": ["@volar/source-map@2.4.28", "", {}, "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ=="], - "@vue/shared": ["@vue/shared@3.5.26", "", {}, "sha512-7Z6/y3uFI5PRoKeorTOSXKcDj0MSasfNNltcslbFrPpcw6aXRUALq4IfJlaTRspiWIUOEZbrpM+iQGmCOiWe4A=="], + "@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], "@webassemblyjs/ast": ["@webassemblyjs/ast@1.14.1", "", { "dependencies": { "@webassemblyjs/helper-numbers": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2" } }, "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ=="], @@ -745,43 +703,33 @@ "@xtuc/long": ["@xtuc/long@4.2.2", "", {}, "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="], - "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], - "acorn-import-phases": ["acorn-import-phases@1.0.4", "", { "peerDependencies": { "acorn": "^8.14.0" } }, "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ=="], + "ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], - "ajv": ["ajv@8.12.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA=="], - - "ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="], - - "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="], + "ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="], "ajv-keywords": ["ajv-keywords@5.1.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3" }, "peerDependencies": { "ajv": "^8.8.2" } }, "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw=="], - "alien-signals": ["alien-signals@0.4.14", "", {}, "sha512-itUAVzhczTmP2U5yX67xVpsbbOiquusbWVyA9N+sy6+r6YVbFkahXvNCeEPWEOMhwDYwbVbGHFkVL03N9I5g+Q=="], - "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], - "argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], - "aria-query": ["aria-query@5.3.0", "", { "dependencies": { "dequal": "^2.0.3" } }, "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A=="], - "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "baseline-browser-mapping": ["baseline-browser-mapping@2.11.19", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-Grytf1xOxOEMTGRwx6rLGKkTabd4vMg3VrKdj/7joCmV0qgh4QwMMO6xh34YEXQqirAuUdgQGa5orJQQ+69RBw=="], - "baseline-browser-mapping": ["baseline-browser-mapping@2.9.9", "", { "bin": { "baseline-browser-mapping": "dist/cli.js" } }, "sha512-V8fbOCSeOFvlDj7LLChUcqbZrdKD9RU/VR260piF1790vT0mfLSwGc/Qzxv3IqiTukOpNtItePa0HBpMAj7MDg=="], - - "brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], - - "browserslist": ["browserslist@4.28.1", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="], + "browserslist": ["browserslist@4.28.8", "", { "dependencies": { "baseline-browser-mapping": "^2.11.12", "caniuse-lite": "^1.0.30001809", "electron-to-chromium": "^1.5.402", "node-releases": "^2.0.53", "update-browserslist-db": "^1.3.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA=="], "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], + "buffer-image-size": ["buffer-image-size@0.6.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-nEh+kZOPY1w+gcCMobZ6ETUp9WfibndnosbpwB1iJk/8Gt5ZF2bhS6+B6bPYz424KtwsR6Rflc3tCz1/ghX2dQ=="], + "bun-test-env-dom": ["bun-test-env-dom@1.0.3", "", { "dependencies": { "@happy-dom/global-registrator": ">=20.0", "@testing-library/dom": ">=10.4", "@testing-library/jest-dom": ">=6.9", "@testing-library/react": ">=16.3", "@testing-library/user-event": ">=14.6" } }, "sha512-Ozepvzk1s/bJSxABEjbI+Ztnm3CN1b0vRSvf0Qa0rTnuO7S0wKN2cUTsXdyIJuqE6OnlAhyoe2NGqkdeemz5/Q=="], - "bun-types": ["bun-types@1.3.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-5ua817+BZPZOlNaRgGBpZJOSAQ9RQ17pkwPD0yR7CfJg+r8DgIILByFifDTa+IPDDxzf5VNhtNlcKqFzDgJvlQ=="], + "bun-types": ["bun-types@1.4.0", "", { "dependencies": { "@types/node": "*" } }, "sha512-iIKw23BspnQQYd3prITOBxeUsxBHnwzX6YJfGMuNOZzeNcMmVqzIIVGRm1l69ogaPQmb4wB6BN8mA5bE9YuC5Q=="], - "caniuse-lite": ["caniuse-lite@1.0.30001760", "", {}, "sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw=="], + "caniuse-lite": ["caniuse-lite@1.0.30001809", "", {}, "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ=="], "chrome-trace-event": ["chrome-trace-event@1.0.4", "", {}, "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ=="], @@ -791,41 +739,29 @@ "compare-versions": ["compare-versions@6.1.1", "", {}, "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg=="], - "confbox": ["confbox@0.2.2", "", {}, "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ=="], - - "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], - - "core-js": ["core-js@3.47.0", "", {}, "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg=="], + "confbox": ["confbox@0.2.4", "", {}, "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ=="], "css.escape": ["css.escape@1.5.1", "", {}, "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg=="], "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], - "csstype-extra": ["csstype-extra@0.1.21", "", { "peerDependencies": { "typescript": "^5" } }, "sha512-+bNbaI4AB6Sh9MeWlzHe+OPPDttu8oM8g6oyOSfoDmzjn6jdaixBdo6Sbu64apL9WEUfiuXuvDiVfqoSnyolBA=="], - - "de-indent": ["de-indent@1.0.2", "", {}, "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg=="], + "csstype-extra": ["csstype-extra@0.1.35", "", { "peerDependencies": { "typescript": "^5" } }, "sha512-pEJ+ZP1nE0TT5E5XXRuNBiU44O2CCwgm1zd0ogXOX/We8GxX++T7KhThrQaSO2V2Yvdmh2OsqBWLH0+OQTUXKA=="], - "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" }, "peerDependencies": { "supports-color": "*" }, "optionalPeers": ["supports-color"] }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], - "diff": ["diff@8.0.2", "", {}, "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg=="], - "dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="], - "electron-to-chromium": ["electron-to-chromium@1.5.267", "", {}, "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw=="], - - "enhanced-resolve": ["enhanced-resolve@5.18.4", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" } }, "sha512-LgQMM4WXU3QI+SYgEc2liRgznaD5ojbmY3sb8LxyguVkIg5FxdpTkvk72te2R38/TGKxH634oLxXRGY6d7AP+Q=="], + "electron-to-chromium": ["electron-to-chromium@1.5.413", "", {}, "sha512-F1XPKvt7HVfly5WND90ec16nFsdr4g5x/cVUP3EqjeyXynupabGDqpMa84wwvuYGDnldXLBz6DLXyZXWO9TPvw=="], - "entities": ["entities@7.0.0", "", {}, "sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ=="], + "enhanced-resolve": ["enhanced-resolve@5.24.5", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-L1l8TNvomm6UVW5B253AGxQagSQr+vGwhMlrrfRS2qmhx46AMpMVJKQYLvWYbysTMY8VoicOvzHzoHMbyzB+4A=="], - "error-stack-parser": ["error-stack-parser@2.1.4", "", { "dependencies": { "stackframe": "^1.3.4" } }, "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ=="], + "entities": ["entities@7.0.1", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="], - "es-module-lexer": ["es-module-lexer@2.0.0", "", {}, "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw=="], - - "esbuild": ["esbuild@0.27.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.2", "@esbuild/android-arm": "0.27.2", "@esbuild/android-arm64": "0.27.2", "@esbuild/android-x64": "0.27.2", "@esbuild/darwin-arm64": "0.27.2", "@esbuild/darwin-x64": "0.27.2", "@esbuild/freebsd-arm64": "0.27.2", "@esbuild/freebsd-x64": "0.27.2", "@esbuild/linux-arm": "0.27.2", "@esbuild/linux-arm64": "0.27.2", "@esbuild/linux-ia32": "0.27.2", "@esbuild/linux-loong64": "0.27.2", "@esbuild/linux-mips64el": "0.27.2", "@esbuild/linux-ppc64": "0.27.2", "@esbuild/linux-riscv64": "0.27.2", "@esbuild/linux-s390x": "0.27.2", "@esbuild/linux-x64": "0.27.2", "@esbuild/netbsd-arm64": "0.27.2", "@esbuild/netbsd-x64": "0.27.2", "@esbuild/openbsd-arm64": "0.27.2", "@esbuild/openbsd-x64": "0.27.2", "@esbuild/openharmony-arm64": "0.27.2", "@esbuild/sunos-x64": "0.27.2", "@esbuild/win32-arm64": "0.27.2", "@esbuild/win32-ia32": "0.27.2", "@esbuild/win32-x64": "0.27.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw=="], + "es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], @@ -839,73 +775,59 @@ "events": ["events@3.3.0", "", {}, "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="], - "exsolve": ["exsolve@1.0.8", "", {}, "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA=="], + "exsolve": ["exsolve@1.1.1", "", {}, "sha512-9U/jZUgjnSGyntRr6y5Muu1MJcwFl6kPu7k8qLF0IMNfLqvw0NZ4nnVDq0RVoZ0RvCyumib4Ez3KYrVfilrw+g=="], "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], - "fast-uri": ["fast-uri@3.1.0", "", {}, "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA=="], + "fast-uri": ["fast-uri@3.1.6", "", {}, "sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q=="], "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], - "fs-extra": ["fs-extra@11.3.3", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg=="], - "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], - "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="], - - "gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="], - - "glob": ["glob@13.0.0", "", { "dependencies": { "minimatch": "^10.1.1", "minipass": "^7.1.2", "path-scurry": "^2.0.0" } }, "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA=="], - - "glob-to-regexp": ["glob-to-regexp@0.4.1", "", {}, "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw=="], - "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], - "happy-dom": ["happy-dom@20.0.11", "", { "dependencies": { "@types/node": "^20.0.0", "@types/whatwg-mimetype": "^3.0.2", "whatwg-mimetype": "^3.0.0" } }, "sha512-QsCdAUHAmiDeKeaNojb1OHOPF7NjcWPBR7obdu3NwH2a/oyQaLg5d0aaCy/9My6CdPChYF07dvz5chaXBGaD4g=="], + "happy-dom": ["happy-dom@20.11.6", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-Hldbg8AdAa5a5oDcZpjqnGitp7JB0hqWmfv/8qr+kft4vzSD8BHsbdRfzYvL/0QcbKcURC/yyoygbeDQarPvYg=="], "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], - "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], - - "he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="], - - "html-entities": ["html-entities@2.6.0", "", {}, "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ=="], - "husky": ["husky@9.1.7", "", { "bin": { "husky": "bin.js" } }, "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA=="], - "import-lazy": ["import-lazy@4.0.0", "", {}, "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw=="], - "indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], - "is-core-module": ["is-core-module@2.16.1", "", { "dependencies": { "hasown": "^2.0.2" } }, "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w=="], - "jest-worker": ["jest-worker@27.5.1", "", { "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } }, "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg=="], - "jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], + "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], - "jju": ["jju@1.4.0", "", {}, "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA=="], + "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], - "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], + "kolorist": ["kolorist@1.8.0", "", {}, "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ=="], - "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], + "lightningcss": ["lightningcss@1.33.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.33.0", "lightningcss-darwin-arm64": "1.33.0", "lightningcss-darwin-x64": "1.33.0", "lightningcss-freebsd-x64": "1.33.0", "lightningcss-linux-arm-gnueabihf": "1.33.0", "lightningcss-linux-arm64-gnu": "1.33.0", "lightningcss-linux-arm64-musl": "1.33.0", "lightningcss-linux-x64-gnu": "1.33.0", "lightningcss-linux-x64-musl": "1.33.0", "lightningcss-win32-arm64-msvc": "1.33.0", "lightningcss-win32-x64-msvc": "1.33.0" } }, "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA=="], - "json-parse-even-better-errors": ["json-parse-even-better-errors@2.3.1", "", {}, "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="], + "lightningcss-android-arm64": ["lightningcss-android-arm64@1.33.0", "", { "os": "android", "cpu": "arm64" }, "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg=="], - "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + "lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.33.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg=="], - "json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], + "lightningcss-darwin-x64": ["lightningcss-darwin-x64@1.33.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ=="], - "jsonfile": ["jsonfile@6.2.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg=="], + "lightningcss-freebsd-x64": ["lightningcss-freebsd-x64@1.33.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg=="], - "kolorist": ["kolorist@1.8.0", "", {}, "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ=="], + "lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.33.0", "", { "os": "linux", "cpu": "arm" }, "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ=="], - "loader-runner": ["loader-runner@4.3.1", "", {}, "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q=="], + "lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg=="], - "local-pkg": ["local-pkg@1.1.2", "", { "dependencies": { "mlly": "^1.7.4", "pkg-types": "^2.3.0", "quansync": "^0.2.11" } }, "sha512-arhlxbFRmoQHl33a0Zkle/YWlmNwoyt6QNZEIJcqNbdrsix5Lvc4HyyI3EnwxTYlZYc32EbYrQ8SzEZ7dqgg9A=="], + "lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ=="], - "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], + "lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg=="], - "lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], + "lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw=="], + + "lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.33.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA=="], + + "lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.33.0", "", { "os": "win32", "cpu": "x64" }, "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA=="], + + "local-pkg": ["local-pkg@1.2.1", "", { "dependencies": { "mlly": "^1.7.4", "pkg-types": "^2.3.0", "quansync": "^0.2.11" } }, "sha512-++gUqRDEvcnN6Zhqrr+y/CkVEHhlrR96vZn3nZZPYzMcBUyBtTKzB9NadClFIsIVSsu+3i9tfk/erqy9kAmt7Q=="], "lz-string": ["lz-string@1.5.0", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="], @@ -913,67 +835,53 @@ "merge-stream": ["merge-stream@2.0.0", "", {}, "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="], - "mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], - - "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], + "mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], "min-indent": ["min-indent@1.0.1", "", {}, "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="], - "minimatch": ["minimatch@10.0.3", "", { "dependencies": { "@isaacs/brace-expansion": "^5.0.0" } }, "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw=="], - - "minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="], + "minimizer-webpack-plugin": ["minimizer-webpack-plugin@5.6.1", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "jest-worker": "^27.4.5", "schema-utils": "^4.3.0", "terser": "^5.31.1" }, "peerDependencies": { "@minify-html/node": "*", "@swc/core": "*", "@swc/css": "*", "@swc/html": "*", "clean-css": "*", "cssnano": "*", "csso": "*", "esbuild": "*", "html-minifier-terser": "*", "lightningcss": "*", "postcss": "*", "uglify-js": "*", "webpack": "^5.1.0" }, "optionalPeers": ["@minify-html/node", "@swc/core", "@swc/css", "@swc/html", "clean-css", "cssnano", "csso", "esbuild", "html-minifier-terser", "lightningcss", "postcss", "uglify-js"] }, "sha512-DoeAZz8Q1C1znwsUzej1fdoi4jCf7/+Em27ouLqfK/+3m8G+D7yDhUwrc3CNhjSzGUN1kn7Iv4sWmjflQHenpw=="], - "mlly": ["mlly@1.8.0", "", { "dependencies": { "acorn": "^8.15.0", "pathe": "^2.0.3", "pkg-types": "^1.3.1", "ufo": "^1.6.1" } }, "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g=="], + "mlly": ["mlly@1.8.2", "", { "dependencies": { "acorn": "^8.16.0", "pathe": "^2.0.3", "pkg-types": "^1.3.1", "ufo": "^1.6.3" } }, "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA=="], "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], - "muggle-string": ["muggle-string@0.4.1", "", {}, "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ=="], - - "nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="], + "nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="], "neo-async": ["neo-async@2.6.2", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="], - "next": ["next@16.1.1", "", { "dependencies": { "@next/env": "16.1.1", "@swc/helpers": "0.5.15", "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.1.1", "@next/swc-darwin-x64": "16.1.1", "@next/swc-linux-arm64-gnu": "16.1.1", "@next/swc-linux-arm64-musl": "16.1.1", "@next/swc-linux-x64-gnu": "16.1.1", "@next/swc-linux-x64-musl": "16.1.1", "@next/swc-win32-arm64-msvc": "16.1.1", "@next/swc-win32-x64-msvc": "16.1.1", "sharp": "^0.34.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w=="], + "next": ["next@16.3.2", "", { "dependencies": { "@next/env": "16.3.2", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.5.23", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.3.2", "@next/swc-darwin-x64": "16.3.2", "@next/swc-linux-arm64-gnu": "16.3.2", "@next/swc-linux-arm64-musl": "16.3.2", "@next/swc-linux-x64-gnu": "16.3.2", "@next/swc-linux-x64-musl": "16.3.2", "@next/swc-win32-arm64-msvc": "16.3.2", "@next/swc-win32-x64-msvc": "16.3.2", "sharp": "^0.35.3" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-/ZCaubUy17Lld1SiPWxuPbCk2ihqAxF2QNQaPZeEaEb7t1I58qhsJN187D7AfpapHAqUPXH0f/thtdW9dWgWFg=="], "next-example": ["next-example@workspace:examples/next"], "next-webpack-example": ["next-webpack-example@workspace:examples/next-webpack"], - "node-releases": ["node-releases@2.0.27", "", {}, "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA=="], + "node-releases": ["node-releases@2.0.53", "", {}, "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ=="], "openapi-types": ["openapi-types@12.1.3", "", {}, "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="], "path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="], - "path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="], - - "path-scurry": ["path-scurry@2.0.1", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA=="], - "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], - "picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], + "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "pkg-types": ["pkg-types@2.3.0", "", { "dependencies": { "confbox": "^0.2.2", "exsolve": "^1.0.7", "pathe": "^2.0.3" } }, "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig=="], + "pkg-types": ["pkg-types@2.3.1", "", { "dependencies": { "confbox": "^0.2.4", "exsolve": "^1.0.8", "pathe": "^2.0.3" } }, "sha512-y+ichcgc2LrADuhLNAx8DFjVfgz91pRxfZdI3UDhxHvcVEZsenLO+7XaU5vOp0u/7V/wZ+plyuQxtrDlZJ+yeg=="], - "postcss": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="], + "postcss": ["postcss@8.5.26", "", { "dependencies": { "nanoid": "^3.3.17", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ=="], "pretty-format": ["pretty-format@27.5.1", "", { "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" } }, "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ=="], - "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], - "quansync": ["quansync@0.2.11", "", {}, "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA=="], - "randombytes": ["randombytes@2.1.0", "", { "dependencies": { "safe-buffer": "^5.1.0" } }, "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ=="], + "react": ["react@19.2.8", "", {}, "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw=="], - "react": ["react@19.2.3", "", {}, "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA=="], - - "react-dom": ["react-dom@19.2.3", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.3" } }, "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg=="], + "react-dom": ["react-dom@19.2.8", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.8" } }, "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ=="], "react-error-boundary": ["react-error-boundary@3.1.4", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "react": ">=16.13.1" } }, "sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA=="], - "react-hook-form": ["react-hook-form@7.70.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-COOMajS4FI3Wuwrs3GPpi/Jeef/5W1DRR84Yl5/ShlT3dKVFUfoGiEZ/QE6Uw8P4T2/CLJdcTVYKvWBMQTEpvw=="], + "react-hook-form": ["react-hook-form@7.86.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-4kbWJrh5jPZt1+YqVcXcGKffGcXV/XVbozknLh0Yjh0KhpoAkus21TAQhzRYqNwFkkObmnSvRlZZ3GT+ehoIrA=="], "react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="], @@ -983,25 +891,21 @@ "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], - "resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "rolldown": ["rolldown@1.2.5", "", { "dependencies": { "@oxc-project/types": "=0.146.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.5", "@rolldown/binding-android-arm64": "1.2.5", "@rolldown/binding-darwin-arm64": "1.2.5", "@rolldown/binding-darwin-x64": "1.2.5", "@rolldown/binding-freebsd-x64": "1.2.5", "@rolldown/binding-linux-arm-gnueabihf": "1.2.5", "@rolldown/binding-linux-arm64-gnu": "1.2.5", "@rolldown/binding-linux-arm64-musl": "1.2.5", "@rolldown/binding-linux-ppc64-gnu": "1.2.5", "@rolldown/binding-linux-s390x-gnu": "1.2.5", "@rolldown/binding-linux-x64-gnu": "1.2.5", "@rolldown/binding-linux-x64-musl": "1.2.5", "@rolldown/binding-openharmony-arm64": "1.2.5", "@rolldown/binding-win32-arm64-msvc": "1.2.5", "@rolldown/binding-win32-x64-msvc": "1.2.5" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-VD2IE5PUG4Oj8zz2VGykiYd5wbnjdIiSsNQb8Qu5B+noEp+A78mu2iVvpp27g8es14Tk9rofNs5Tku9iQCS4fA=="], - "rollup": ["rollup@4.53.5", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.53.5", "@rollup/rollup-android-arm64": "4.53.5", "@rollup/rollup-darwin-arm64": "4.53.5", "@rollup/rollup-darwin-x64": "4.53.5", "@rollup/rollup-freebsd-arm64": "4.53.5", "@rollup/rollup-freebsd-x64": "4.53.5", "@rollup/rollup-linux-arm-gnueabihf": "4.53.5", "@rollup/rollup-linux-arm-musleabihf": "4.53.5", "@rollup/rollup-linux-arm64-gnu": "4.53.5", "@rollup/rollup-linux-arm64-musl": "4.53.5", "@rollup/rollup-linux-loong64-gnu": "4.53.5", "@rollup/rollup-linux-ppc64-gnu": "4.53.5", "@rollup/rollup-linux-riscv64-gnu": "4.53.5", "@rollup/rollup-linux-riscv64-musl": "4.53.5", "@rollup/rollup-linux-s390x-gnu": "4.53.5", "@rollup/rollup-linux-x64-gnu": "4.53.5", "@rollup/rollup-linux-x64-musl": "4.53.5", "@rollup/rollup-openharmony-arm64": "4.53.5", "@rollup/rollup-win32-arm64-msvc": "4.53.5", "@rollup/rollup-win32-ia32-msvc": "4.53.5", "@rollup/rollup-win32-x64-gnu": "4.53.5", "@rollup/rollup-win32-x64-msvc": "4.53.5", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-iTNAbFSlRpcHeeWu73ywU/8KuU/LZmNCSxp6fjQkJBD3ivUb8tpDrXhIxEzA05HlYMEwmtaUnb3RP+YNv162OQ=="], + "rollup": ["rollup@4.62.5", "", { "dependencies": { "@types/estree": "1.0.9" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.62.5", "@rollup/rollup-android-arm64": "4.62.5", "@rollup/rollup-darwin-arm64": "4.62.5", "@rollup/rollup-darwin-x64": "4.62.5", "@rollup/rollup-freebsd-arm64": "4.62.5", "@rollup/rollup-freebsd-x64": "4.62.5", "@rollup/rollup-linux-arm-gnueabihf": "4.62.5", "@rollup/rollup-linux-arm-musleabihf": "4.62.5", "@rollup/rollup-linux-arm64-gnu": "4.62.5", "@rollup/rollup-linux-arm64-musl": "4.62.5", "@rollup/rollup-linux-loong64-gnu": "4.62.5", "@rollup/rollup-linux-loong64-musl": "4.62.5", "@rollup/rollup-linux-ppc64-gnu": "4.62.5", "@rollup/rollup-linux-ppc64-musl": "4.62.5", "@rollup/rollup-linux-riscv64-gnu": "4.62.5", "@rollup/rollup-linux-riscv64-musl": "4.62.5", "@rollup/rollup-linux-s390x-gnu": "4.62.5", "@rollup/rollup-linux-x64-gnu": "4.62.5", "@rollup/rollup-linux-x64-musl": "4.62.5", "@rollup/rollup-openbsd-x64": "4.62.5", "@rollup/rollup-openharmony-arm64": "4.62.5", "@rollup/rollup-win32-arm64-msvc": "4.62.5", "@rollup/rollup-win32-ia32-msvc": "4.62.5", "@rollup/rollup-win32-x64-gnu": "4.62.5", "@rollup/rollup-win32-x64-msvc": "4.62.5", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-/tqMfgP7GPA3PHhCmuiS4vIjrSVhHLgY++i+dhbG462euyAj7FpM4D9uq1X3BgjlqRdpcOrYhcQtfiQLNc8tqw=="], "rollup-plugin-preserve-directives": ["rollup-plugin-preserve-directives@0.4.0", "", { "dependencies": { "@rollup/pluginutils": "^5.1.0", "magic-string": "^0.30.5" }, "peerDependencies": { "rollup": "2.x || 3.x || 4.x" } }, "sha512-gx4nBxYm5BysmEQS+e2tAMrtFxrGvk+Pe5ppafRibQi0zlW7VYAbEGk6IKDw9sJGPdFWgVTE0o4BU4cdG0Fylg=="], "rsbuild-example": ["rsbuild-example@workspace:examples/rsbuild"], - "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="], "schema-utils": ["schema-utils@4.3.3", "", { "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", "ajv-formats": "^2.1.1", "ajv-keywords": "^5.1.0" } }, "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA=="], - "semver": ["semver@7.5.4", "", { "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" } }, "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA=="], + "semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="], - "serialize-javascript": ["serialize-javascript@6.0.2", "", { "dependencies": { "randombytes": "^2.1.0" } }, "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g=="], - - "sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], + "sharp": ["sharp@0.35.3", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.3", "@img/sharp-darwin-x64": "0.35.3", "@img/sharp-freebsd-wasm32": "0.35.3", "@img/sharp-libvips-darwin-arm64": "1.3.2", "@img/sharp-libvips-darwin-x64": "1.3.2", "@img/sharp-libvips-linux-arm": "1.3.2", "@img/sharp-libvips-linux-arm64": "1.3.2", "@img/sharp-libvips-linux-ppc64": "1.3.2", "@img/sharp-libvips-linux-riscv64": "1.3.2", "@img/sharp-libvips-linux-s390x": "1.3.2", "@img/sharp-libvips-linux-x64": "1.3.2", "@img/sharp-libvips-linuxmusl-arm64": "1.3.2", "@img/sharp-libvips-linuxmusl-x64": "1.3.2", "@img/sharp-linux-arm": "0.35.3", "@img/sharp-linux-arm64": "0.35.3", "@img/sharp-linux-ppc64": "0.35.3", "@img/sharp-linux-riscv64": "0.35.3", "@img/sharp-linux-s390x": "0.35.3", "@img/sharp-linux-x64": "0.35.3", "@img/sharp-linuxmusl-arm64": "0.35.3", "@img/sharp-linuxmusl-x64": "0.35.3", "@img/sharp-webcontainers-wasm32": "0.35.3", "@img/sharp-win32-arm64": "0.35.3", "@img/sharp-win32-ia32": "0.35.3", "@img/sharp-win32-x64": "0.35.3" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-ej0zVHuZGHCiABXcNxeYhpRnPNPAcvbG8RMdBAhDAxLKkCRVSpK3Iyu7qbqw3JMzoj0REeM6f3tJLtVwl0023Q=="], "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], @@ -1009,133 +913,61 @@ "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], - "sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], - - "stackframe": ["stackframe@1.3.4", "", {}, "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw=="], - - "string-argv": ["string-argv@0.3.2", "", {}, "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q=="], - "strip-indent": ["strip-indent@3.0.0", "", { "dependencies": { "min-indent": "^1.0.0" } }, "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ=="], - "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], - - "styled-jsx": ["styled-jsx@5.1.6", "", { "dependencies": { "client-only": "0.0.1" }, "peerDependencies": { "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" } }, "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA=="], + "styled-jsx": ["styled-jsx@5.1.6", "", { "dependencies": { "client-only": "0.0.1" }, "peerDependencies": { "@babel/core": "*", "babel-plugin-macros": "*", "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" }, "optionalPeers": ["@babel/core", "babel-plugin-macros"] }, "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA=="], "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], - "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="], - - "tapable": ["tapable@2.3.0", "", {}, "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="], + "tapable": ["tapable@2.3.3", "", {}, "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A=="], - "terser": ["terser@5.44.1", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw=="], + "terser": ["terser@5.50.0", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-CN9BVxWhgS/hRxtUMjtC2uRWSTcSfQFHMDWma6sKKfIivCD91sM+FOPfvwoaRMqCSrUpe1nv3jDamd9eEQ4y+w=="], - "terser-webpack-plugin": ["terser-webpack-plugin@5.3.16", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "jest-worker": "^27.4.5", "schema-utils": "^4.3.0", "serialize-javascript": "^6.0.2", "terser": "^5.31.1" }, "peerDependencies": { "webpack": "^5.1.0" } }, "sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q=="], - - "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="], + "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="], - "ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="], + "ufo": ["ufo@1.6.4", "", {}, "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA=="], - "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], + "undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="], - "universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], + "unplugin": ["unplugin@2.3.11", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="], - "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], + "unplugin-dts": ["unplugin-dts@1.0.3", "", { "dependencies": { "@rollup/pluginutils": "^5.1.4", "@volar/typescript": "^2.4.26", "compare-versions": "^6.1.1", "debug": "^4.4.0", "kolorist": "^1.8.0", "local-pkg": "^1.1.1", "magic-string": "^0.30.17", "unplugin": "^2.3.2" }, "peerDependencies": { "@microsoft/api-extractor": ">=7", "@rspack/core": "^1", "@vue/language-core": "^3.1.5", "esbuild": "*", "rolldown": "*", "rollup": ">=3", "typescript": ">=4", "vite": ">=3", "webpack": "^4 || ^5" }, "optionalPeers": ["@microsoft/api-extractor", "@rspack/core", "@vue/language-core", "esbuild", "rolldown", "rollup", "vite", "webpack"] }, "sha512-/GR887wfG4r1cWyt1UZsLRuMIjsmEbGkS9yJrz+0dsToHAYUD5CTyP3JMGVLv25j9K0mJcwAVvZno/aTuSUvNg=="], - "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + "update-browserslist-db": ["update-browserslist-db@1.3.1", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ=="], - "vite": ["vite@7.3.0", "", { "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg=="], + "vite": ["vite@8.2.2", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.5", "postcss": "^8.5.26", "rolldown": "~1.2.4", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.4.0 || ^0.5.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q=="], "vite-example": ["vite-example@workspace:examples/vite"], - "vite-plugin-dts": ["vite-plugin-dts@4.5.4", "", { "dependencies": { "@microsoft/api-extractor": "^7.50.1", "@rollup/pluginutils": "^5.1.4", "@volar/typescript": "^2.4.11", "@vue/language-core": "2.2.0", "compare-versions": "^6.1.1", "debug": "^4.4.0", "kolorist": "^1.8.0", "local-pkg": "^1.0.0", "magic-string": "^0.30.17" }, "peerDependencies": { "typescript": "*", "vite": "*" }, "optionalPeers": ["vite"] }, "sha512-d4sOM8M/8z7vRXHHq/ebbblfaxENjogAAekcfcDCCwAyvGqnPrc7f4NZbvItS+g4WTgerW0xDwSz5qz11JT3vg=="], + "vite-plugin-dts": ["vite-plugin-dts@5.0.3", "", { "dependencies": { "unplugin-dts": "1.0.3" }, "peerDependencies": { "@microsoft/api-extractor": ">=7", "rollup": ">=3", "vite": ">=3" }, "optionalPeers": ["@microsoft/api-extractor", "rollup", "vite"] }, "sha512-gIth6NdCEHWPiiRMCK3N6C8WjvdsrtEQrmsiG8h6Ov+lFP+b07Y+wcs9H0H7n146l0PDTYK4cQN1vgeG1pMdRQ=="], "vscode-uri": ["vscode-uri@3.1.0", "", {}, "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ=="], - "watchpack": ["watchpack@2.4.4", "", { "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA=="], - - "webpack": ["webpack@5.104.0", "", { "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.15.0", "acorn-import-phases": "^1.0.3", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.4", "es-module-lexer": "^2.0.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.3.1", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", "terser-webpack-plugin": "^5.3.16", "watchpack": "^2.4.4", "webpack-sources": "^3.3.3" }, "bin": { "webpack": "bin/webpack.js" } }, "sha512-5DeICTX8BVgNp6afSPYXAFjskIgWGlygQH58bcozPOXgo2r/6xx39Y1+cULZ3gTxUYQP88jmwLj2anu4Xaq84g=="], - - "webpack-sources": ["webpack-sources@3.3.3", "", {}, "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg=="], - - "whatwg-mimetype": ["whatwg-mimetype@3.0.0", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="], - - "yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], - - "zod": ["zod@4.3.5", "", {}, "sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g=="], - - "@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - - "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], + "watchpack": ["watchpack@2.5.2", "", { "dependencies": { "graceful-fs": "^4.1.2" } }, "sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg=="], - "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], + "webpack": ["webpack@5.109.2", "", { "dependencies": { "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.16.0", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.24.4", "es-module-lexer": "^2.1.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "graceful-fs": "^4.2.11", "mime-db": "^1.54.0", "minimizer-webpack-plugin": "^5.6.1", "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", "watchpack": "^2.5.2", "webpack-sources": "^3.5.1" }, "peerDependencies": { "webpack-cli": "*" }, "optionalPeers": ["webpack-cli"], "bin": { "webpack": "bin/webpack.js" } }, "sha512-U9/cvLzxObKNEZ9+TtdqrHM5/9z3lgl2c+c4BzbqGxFQvQvBAq87yql5A8pQ+rrMbS496MZJeF5enVBndIy2hw=="], - "@devup-api/zod/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "webpack-sources": ["webpack-sources@3.5.1", "", {}, "sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw=="], - "@devup-ui/next-plugin/next": ["next@16.0.10", "", { "dependencies": { "@next/env": "16.0.10", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.0.10", "@next/swc-darwin-x64": "16.0.10", "@next/swc-linux-arm64-gnu": "16.0.10", "@next/swc-linux-arm64-musl": "16.0.10", "@next/swc-linux-x64-gnu": "16.0.10", "@next/swc-linux-x64-musl": "16.0.10", "@next/swc-win32-arm64-msvc": "16.0.10", "@next/swc-win32-x64-msvc": "16.0.10", "sharp": "^0.34.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-RtWh5PUgI+vxlV3HdR+IfWA1UUHu0+Ram/JBO4vWB54cVPentCD0e+lxyAYEsDTqGGMg7qpjhKh6dc6aW7W/sA=="], + "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], - "@devup-ui/webpack-plugin/@devup-ui/wasm": ["@devup-ui/wasm@1.0.47", "", {}, "sha512-RPktfdg53bK5BqAyhfs9hA5vzAiH0D63w60S+ACaoIPXpqQaQp2Lh9pl3Mi6E+8KA0Div/hoQCLfYxuAefodrg=="], - - "@happy-dom/global-registrator/@types/node": ["@types/node@20.19.27", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug=="], - - "@microsoft/api-extractor/typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="], + "whatwg-mimetype": ["whatwg-mimetype@3.0.0", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="], - "@rsbuild/core/@swc/helpers": ["@swc/helpers@0.5.17", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A=="], + "ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="], - "@rushstack/node-core-library/ajv": ["ajv@8.13.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.4.1" } }, "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA=="], + "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="], "@testing-library/jest-dom/dom-accessibility-api": ["dom-accessibility-api@0.6.3", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="], - "@vue/language-core/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], - - "ajv-formats/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], - "esrecurse/estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="], - "glob/minimatch": ["minimatch@10.1.1", "", { "dependencies": { "@isaacs/brace-expansion": "^5.0.0" } }, "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ=="], - - "happy-dom/@types/node": ["@types/node@20.19.27", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug=="], - "mlly/pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="], - "next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], - - "path-scurry/lru-cache": ["lru-cache@11.2.4", "", {}, "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg=="], - - "schema-utils/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], - - "schema-utils/ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="], - - "sharp/semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], - - "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], - - "@devup-ui/next-plugin/next/@next/env": ["@next/env@16.0.10", "", {}, "sha512-8tuaQkyDVgeONQ1MeT9Mkk8pQmZapMKFh5B+OrFUlG3rVmYTXcXlBetBgTurKXGaIZvkoqRT9JL5K3phXcgang=="], - - "@devup-ui/next-plugin/next/@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.0.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-4XgdKtdVsaflErz+B5XeG0T5PeXKDdruDf3CRpnhN+8UebNa5N2H58+3GDgpn/9GBurrQ1uWW768FfscwYkJRg=="], - - "@devup-ui/next-plugin/next/@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.0.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-spbEObMvRKkQ3CkYVOME+ocPDFo5UqHb8EMTS78/0mQ+O1nqE8toHJVioZo4TvebATxgA8XMTHHrScPrn68OGw=="], - - "@devup-ui/next-plugin/next/@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.0.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-uQtWE3X0iGB8apTIskOMi2w/MKONrPOUCi5yLO+v3O8Mb5c7K4Q5KD1jvTpTF5gJKa3VH/ijKjKUq9O9UhwOYw=="], - - "@devup-ui/next-plugin/next/@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.0.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-llA+hiDTrYvyWI21Z0L1GiXwjQaanPVQQwru5peOgtooeJ8qx3tlqRV2P7uH2pKQaUfHxI/WVarvI5oYgGxaTw=="], - - "@devup-ui/next-plugin/next/@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.0.10", "", { "os": "linux", "cpu": "x64" }, "sha512-AK2q5H0+a9nsXbeZ3FZdMtbtu9jxW4R/NgzZ6+lrTm3d6Zb7jYrWcgjcpM1k8uuqlSy4xIyPR2YiuUr+wXsavA=="], - - "@devup-ui/next-plugin/next/@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.0.10", "", { "os": "linux", "cpu": "x64" }, "sha512-1TDG9PDKivNw5550S111gsO4RGennLVl9cipPhtkXIFVwo31YZ73nEbLjNC8qG3SgTz/QZyYyaFYMeY4BKZR/g=="], - - "@devup-ui/next-plugin/next/@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.0.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-aEZIS4Hh32xdJQbHz121pyuVZniSNoqDVx1yIr2hy+ZwJGipeqnMZBJHyMxv2tiuAXGx6/xpTcQJ6btIiBjgmg=="], - - "@devup-ui/next-plugin/next/@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.0.10", "", { "os": "win32", "cpu": "x64" }, "sha512-E+njfCoFLb01RAFEnGZn6ERoOqhK1Gl3Lfz1Kjnj0Ulfu7oJbuMyvBKNj/bw8XZnenHDASlygTjZICQW+rYW1Q=="], - - "@devup-ui/next-plugin/next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], - - "@happy-dom/global-registrator/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], - - "happy-dom/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + "next/postcss": ["postcss@8.5.23", "", { "dependencies": { "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg=="], "mlly/pkg-types/confbox": ["confbox@0.1.8", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="], } diff --git a/bunfig.toml b/bunfig.toml index 6f46ac9..39ff80d 100644 --- a/bunfig.toml +++ b/bunfig.toml @@ -2,4 +2,5 @@ coverage = true coveragePathIgnorePatterns = ["node_modules", "**/dist/**"] coverageSkipTestFiles = true -preload = ["bun-test-env-dom"] \ No newline at end of file +preload = ["bun-test-env-dom"] +coverageThreshold = 1.0 diff --git a/examples/next-webpack/package.json b/examples/next-webpack/package.json index 9b49123..7ebc21b 100644 --- a/examples/next-webpack/package.json +++ b/examples/next-webpack/package.json @@ -9,18 +9,18 @@ "lint": "next lint" }, "dependencies": { - "next": "^16.1.1", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "next": "^16.3.2", + "react": "^19.2.8", + "react-dom": "^19.2.8", "@devup-api/next-plugin": "workspace:*", "@devup-api/fetch": "workspace:*", "@devup-ui/react": "^1" }, "devDependencies": { "@devup-ui/next-plugin": "^1", - "@types/node": "^25", + "@types/node": "^26", "@types/react": "^19", "@types/react-dom": "^19", - "typescript": "^5" + "typescript": "^7" } } diff --git a/examples/next/app/page.tsx b/examples/next/app/page.tsx index 32d0e2e..c3bd902 100644 --- a/examples/next/app/page.tsx +++ b/examples/next/app/page.tsx @@ -1,6 +1,7 @@ 'use client' import { createApi, type DevupObject } from '@devup-api/fetch' +import { getUserById } from '@devup-api/fetch/server' import { createQueryClient } from '@devup-api/react-query' import { ApiCrud } from '@devup-api/ui' import { schemas } from '@devup-api/zod' @@ -14,6 +15,10 @@ const api2 = createApi({ baseUrl: 'https://api.example2.com', serverName: 'openapi2.json', }) +const api3 = createApi({ + baseUrl: 'https://api.example2.com', + serverName: 'openapi3.json', +}) const queryClient = createQueryClient(api) @@ -35,6 +40,11 @@ export default function Home() { const _object2: DevupObject<'response', 'openapi2.json'>['User'] | undefined = data?.[0] + const _results = queryClient.useQueries([ + ['GET', 'getUsers', { query: { name: 'John Doe' } }], + ['GET', '/users/{id}', { params: { id: 1 }, query: { name: 'John Doe' } }], + ]) + console.info(data, isLoading, error) const { @@ -80,6 +90,23 @@ export default function Home() { .then((res) => { console.log(res) }) + api3.POST('/form', { + body: { + email: 'name', + name: 'John Doe', + }, + }) + + api3.POST('/typed-form', { + body: { + name: 'John Doe', + tags: 'tag1,tag2', + }, + }) + + api3.POST('/typed-form', { + body: new FormData(), + }) }, [mutateAsync]) return ( @@ -87,6 +114,18 @@ export default function Home() { + { + getUserById({ + params: { id: 1 }, + query: { name: 'John Doe' }, + }).then((res) => { + console.log(res) + }) + }} + > + hello + {(() => { diff --git a/examples/next/next.config.ts b/examples/next/next.config.ts index ef237a9..346e5bc 100644 --- a/examples/next/next.config.ts +++ b/examples/next/next.config.ts @@ -6,7 +6,10 @@ const config = devupApi( reactStrictMode: true, }, { - openapiFiles: ['./openapi.json', './openapi2.json'], + openapiFiles: ['./openapi.json', './openapi2.json', './openapi3.json'], + serverActions: { + baseUrl: 'https://api.example.com', + }, }, ) diff --git a/examples/next/openapi3.json b/examples/next/openapi3.json new file mode 100644 index 0000000..1a42e1c --- /dev/null +++ b/examples/next/openapi3.json @@ -0,0 +1,3279 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "API", + "version": "0.1.0" + }, + "servers": [ + { + "url": "http://localhost:3000" + } + ], + "paths": { + "/": { + "get": { + "operationId": "root_endpoint", + "description": "Health check endpoint", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/complex-struct-body": { + "post": { + "operationId": "mod_file_with_complex_struct_body", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ComplexStructBody" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/complex-struct-body-with-rename": { + "post": { + "operationId": "mod_file_with_complex_struct_body_with_rename", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ComplexStructBodyWithRename" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/enums": { + "get": { + "operationId": "enum_endpoint", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Enum" + } + } + } + } + } + } + }, + "/enums/adjacently-tagged": { + "post": { + "operationId": "adjacently_tagged_endpoint", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdjacentlyTaggedResponse" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdjacentlyTaggedResponse" + } + } + } + } + } + } + }, + "/enums/enum2": { + "get": { + "operationId": "enum_endpoint2", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Enum2" + } + } + } + } + } + } + }, + "/enums/externally-tagged": { + "post": { + "operationId": "externally_tagged_endpoint", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternallyTaggedEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExternallyTaggedEvent" + } + } + } + } + } + } + }, + "/enums/internally-tagged": { + "post": { + "operationId": "internally_tagged_endpoint", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternallyTaggedMessage" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternallyTaggedMessage" + } + } + } + } + } + } + }, + "/enums/untagged": { + "post": { + "operationId": "untagged_endpoint", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UntaggedValue" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UntaggedValue" + } + } + } + } + } + } + }, + "/error": { + "get": { + "operationId": "error_endpoint", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/error/error-with-status": { + "get": { + "operationId": "error_endpoint_with_status_code", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/error/error-with-status2": { + "get": { + "operationId": "error_endpoint_with_status_code2", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse2" + } + } + } + }, + "404": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse2" + } + } + } + }, + "500": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse2" + } + } + } + } + } + } + }, + "/error/error2": { + "get": { + "operationId": "error_endpoint2", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse2" + } + } + } + } + } + } + }, + "/error/header-map": { + "get": { + "operationId": "header_map_endpoint", + "responses": { + "200": { + "description": "Successful response", + "headers": {}, + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse2" + } + } + } + } + } + } + }, + "/error/header-map2": { + "get": { + "operationId": "header_map_endpoint2", + "responses": { + "200": { + "description": "Successful response", + "headers": {}, + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse2" + } + } + } + } + } + } + }, + "/flatten": { + "post": { + "operationId": "list_users", + "tags": ["flatten"], + "description": "List users with pagination (demonstrates flatten for request/response)\n\nThe request accepts flattened pagination parameters (page, per_page)\nand returns a response with flattened metadata (total, has_more).", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserListRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserListResponse" + } + } + } + } + } + } + }, + "/flatten/search": { + "post": { + "operationId": "advanced_search", + "tags": ["flatten"], + "description": "Advanced search endpoint with multiple flatten fields", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdvancedSearchRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchResponse" + } + } + } + } + } + } + }, + "/foo/foo": { + "post": { + "operationId": "signup", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignupRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignupResponse" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/form": { + "post": { + "operationId": "subscribe", + "tags": ["form"], + "description": "Subscribe to newsletter via form submission", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/SubscribeRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscribeResponse" + } + } + } + } + } + } + }, + "/form/contact": { + "post": { + "operationId": "contact", + "tags": ["form"], + "description": "Submit a contact form", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ContactFormRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContactFormResponse" + } + } + } + } + } + } + }, + "/form/upload": { + "post": { + "operationId": "upload", + "tags": ["form"], + "description": "Upload a file via raw multipart form data", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContactFormResponse" + } + } + } + } + } + } + }, + "/generic/generic/{value}": { + "get": { + "operationId": "generic_endpoint", + "parameters": [ + { + "name": "value", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": ["value", "name"] + } + } + } + } + } + } + }, + "/generic/generic2": { + "get": { + "operationId": "generic_endpoint2", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "$ref": "#/components/schemas/TestStruct" + } + }, + "required": ["value", "name"] + } + } + } + } + } + } + }, + "/generic/generic3": { + "get": { + "operationId": "generic_endpoint3", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "$ref": "#/components/schemas/TestStruct" + }, + "value2": { + "type": "string" + } + }, + "required": ["value", "name", "value2"] + } + } + } + } + } + } + }, + "/generic/generic4": { + "get": { + "operationId": "generic_endpoint4", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "boolean" + }, + "value2": { + "type": "boolean" + } + }, + "required": ["value", "name", "value2"] + } + } + } + } + } + } + }, + "/generic/generic5": { + "get": { + "operationId": "generic_endpoint5", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContactResponse" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "totalPage": { + "type": "integer" + } + }, + "required": ["items", "page", "size", "totalPage"] + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/health": { + "get": { + "operationId": "health", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/hello": { + "get": { + "operationId": "mod_file_endpoint", + "tags": ["hello"], + "description": "Hello!!", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/map-query": { + "get": { + "operationId": "mod_file_with_map_query", + "parameters": [ + { + "name": "name", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "age", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "optional_age", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/memos": { + "post": { + "operationId": "create_memo", + "description": "Create a new memo", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateMemoRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateMemoRequest" + } + } + } + } + } + }, + "put": { + "operationId": "update_memo", + "description": "Update a memo", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateMemoRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateMemoRequest" + } + } + } + } + } + } + }, + "/memos/format": { + "get": { + "operationId": "get_memo_format", + "description": "Get memo response format", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/memos/{id}": { + "get": { + "operationId": "get_memo", + "description": "Get memo by id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MemoResponse" + } + } + } + } + } + } + }, + "/memos/{id}/rel": { + "get": { + "operationId": "get_memo_rel", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MemoResponseRel" + } + } + } + } + } + } + }, + "/no-schema-query": { + "get": { + "operationId": "mod_file_with_no_schema_query", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/path/multi-path/{arg}/{var1}/{var2}": { + "get": { + "operationId": "mod_file_with_multi_path", + "parameters": [ + { + "name": "arg", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "var1", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "var2", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/path/multi-path/{var1}": { + "get": { + "operationId": "mod_file_with_test_struct", + "parameters": [ + { + "name": "var1", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/path/multi-path2/{arg}/{var1}/{var2}": { + "get": { + "operationId": "mod_file_with_multi_path_2", + "parameters": [ + { + "name": "arg", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "var1", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "var2", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/path/prefix/{var}": { + "get": { + "operationId": "prefix_variable", + "parameters": [ + { + "name": "var", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/struct-body": { + "post": { + "operationId": "mod_file_with_struct_body", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StructBody" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/struct-body-with-optional": { + "post": { + "operationId": "mod_file_with_struct_body_with_optional", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/struct-query": { + "get": { + "operationId": "mod_file_with_struct_query", + "parameters": [ + { + "name": "name", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "age", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/test-struct": { + "get": { + "operationId": "mod_file_with_test_struct", + "parameters": [ + { + "name": "name", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "age", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TestStruct" + } + } + } + } + } + } + }, + "/third": { + "get": { + "operationId": "third_root_endpoint", + "description": "Third app root endpoint", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/third/hello": { + "get": { + "operationId": "third_hello_endpoint", + "tags": ["third"], + "description": "Third app hello endpoint", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/third/map-query": { + "get": { + "operationId": "third_map_query", + "tags": ["third"], + "parameters": [ + { + "name": "name", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "age", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "optional_age", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/typed-form": { + "get": { + "operationId": "list_file_uploads", + "tags": ["typed-form"], + "description": "List all file uploads", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FileUploadResponse" + } + } + } + } + } + } + }, + "post": { + "operationId": "create_file_upload", + "tags": ["typed-form"], + "description": "Create a new file upload with multipart form data", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateFileUploadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileUploadResponse" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/typed-form/{id}": { + "put": { + "operationId": "update_file_upload", + "tags": ["typed-form"], + "description": "Update a file upload with multipart form data", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/UpdateFileUploadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileUploadResponse" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + }, + "patch": { + "operationId": "patch_file_upload", + "tags": ["typed-form"], + "description": "Patch a file upload (partial update via schema_type! multipart)", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/PatchFileUploadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileUploadResponse" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/typed-header": { + "get": { + "operationId": "typed_header_jwt", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + }, + "post": { + "operationId": "typed_header", + "parameters": [ + { + "name": "user-agent", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "content-type", + "in": "header", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/users": { + "get": { + "operationId": "get_users", + "description": "Get all users (returns public response without internal_score)", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserPublicResponse" + } + } + } + } + } + } + }, + "post": { + "operationId": "create_user", + "description": "Create a new user\nRequest body uses CreateUserRequest (generated from User with only name, email)", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserPublicResponse" + } + } + } + } + } + } + }, + "/users/dto/{id}": { + "get": { + "operationId": "get_user_dto", + "description": "Get user DTO (demonstrates field rename feature)\nThe Rust struct uses user_id/display_name, but JSON uses id/name", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDTO" + } + } + } + } + } + } + }, + "/users/skip-response": { + "get": { + "operationId": "skip_response", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SkipResponse" + } + } + } + } + } + } + }, + "/users/summary": { + "get": { + "operationId": "get_users_summary", + "description": "Get user summaries (minimal fields for list views)", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserSummary" + } + } + } + } + } + } + } + }, + "/users/with-meta": { + "post": { + "operationId": "create_user_with_meta", + "description": "Create a new user with metadata (demonstrates `add` feature)\nRequest body uses CreateUserWithMeta (picks name/email, adds request_id/created_at)", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserWithMeta" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserWithMeta" + } + } + } + } + } + } + }, + "/users/{id}": { + "get": { + "operationId": "get_user", + "description": "Get user by ID (full internal view)", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AdjacentlyTaggedResponse": { + "description": "Adjacently tagged enum - serializes as `{\"type\": \"...\", \"data\": ...}`\nExample: `{\"type\": \"Success\", \"data\": {\"items\": [\"a\", \"b\"]}}`", + "oneOf": [ + { + "type": "object", + "description": "Successful response with items", + "properties": { + "data": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["items"] + }, + "type": { + "type": "string", + "enum": ["Success"] + } + }, + "required": ["type", "data"] + }, + { + "type": "object", + "description": "Error response with code and message", + "properties": { + "data": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + }, + "required": ["code", "message"] + }, + "type": { + "type": "string", + "enum": ["Error"] + } + }, + "required": ["type", "data"] + }, + { + "type": "object", + "description": "Empty response (unit variant)", + "properties": { + "type": { + "type": "string", + "enum": ["Empty"] + } + }, + "required": ["type"] + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "AdvancedSearchRequest": { + "description": "Request combining multiple flattened structs", + "allOf": [ + { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "Search query string" + } + }, + "required": ["query"] + }, + { + "$ref": "#/components/schemas/Pagination" + } + ] + }, + "ComplexStructBody": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "array": { + "type": "array", + "items": { + "type": "string" + } + }, + "map": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "nested_array": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nested_map": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nested_struct": { + "$ref": "#/components/schemas/StructBodyWithOptional" + }, + "nested_struct_array": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nested_struct_array_map": { + "type": "array", + "items": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + } + }, + "nested_struct_map": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nested_struct_map_array": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "items": { + "$ref": "#/components/schemas/StructBodyWithOptional" + }, + "type": "array" + } + } + }, + "required": [ + "name", + "age", + "nested_struct", + "array", + "map", + "nested_array", + "nested_map", + "nested_struct_array", + "nested_struct_map", + "nested_struct_array_map", + "nested_struct_map_array" + ] + }, + "ComplexStructBodyWithRename": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "array": { + "type": "array", + "items": { + "type": "string" + } + }, + "map": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "nestedArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nestedMap": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nestedStruct": { + "$ref": "#/components/schemas/StructBodyWithOptional" + }, + "nestedStructArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nestedStructArrayMap": { + "type": "array", + "items": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + } + }, + "nestedStructMap": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/StructBodyWithOptional" + } + }, + "nestedStructMapArray": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "items": { + "$ref": "#/components/schemas/StructBodyWithOptional" + }, + "type": "array" + } + } + }, + "required": [ + "name", + "age", + "nestedStruct", + "array", + "map", + "nestedArray", + "nestedMap", + "nestedStructArray", + "nestedStructMap", + "nestedStructArrayMap", + "nestedStructMapArray" + ] + }, + "ContactFormRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "subject": { + "type": "string", + "nullable": true + } + }, + "required": ["name", "email", "message"] + }, + "ContactFormResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "ticketId": { + "type": "string" + } + }, + "required": ["success", "ticketId"] + }, + "ContactResponse": { + "type": "object", + "properties": { + "adminReply": { + "type": "string", + "nullable": true + }, + "category": { + "type": "string", + "nullable": true + }, + "content": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "repliedAt": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "string", + "nullable": true + }, + "userId": { + "type": "integer" + } + }, + "required": ["id", "userId", "title", "content", "createdAt"] + }, + "CreateFileUploadRequest": { + "type": "object", + "properties": { + "document": { + "type": "string", + "format": "binary", + "nullable": true + }, + "name": { + "type": "string" + }, + "tags": { + "type": "string", + "nullable": true + }, + "thumbnail": { + "type": "string", + "format": "binary", + "nullable": true + } + }, + "required": ["name"] + }, + "CreateMemoRequest": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": ["title", "content"] + }, + "CreateUserRequest": { + "type": "object", + "description": "Full user model with all fields", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": ["name", "email"] + }, + "CreateUserWithMeta": { + "type": "object", + "description": "Full user model with all fields", + "properties": { + "createdAt": { + "type": "string", + "nullable": true + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "requestId": { + "type": "string" + } + }, + "required": ["name", "email", "requestId"] + }, + "Enum": { + "type": "string", + "enum": ["A", "B", "C"] + }, + "Enum2": { + "description": "Enum2 Description", + "oneOf": [ + { + "type": "object", + "properties": { + "A": { + "type": "string" + } + }, + "required": ["A"] + }, + { + "type": "object", + "properties": { + "B": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["name", "age"] + } + }, + "required": ["B"] + }, + { + "type": "object", + "properties": { + "C": { + "type": "integer" + } + }, + "required": ["C"] + }, + { + "type": "object", + "properties": { + "D": { + "type": "boolean" + } + }, + "required": ["D"] + }, + { + "type": "object", + "properties": { + "E": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["E"] + }, + { + "type": "object", + "properties": { + "F": { + "type": "array", + "prefixItems": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "minItems": 2, + "maxItems": 2 + } + }, + "required": ["F"] + }, + { + "type": "object", + "properties": { + "G": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "type": "string" + } + } + }, + "required": ["G"] + }, + { + "type": "object", + "properties": { + "H": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "type": "string" + } + } + }, + "required": ["H"] + }, + { + "type": "object", + "properties": { + "I": { + "$ref": "#/components/schemas/TestStruct" + } + }, + "required": ["I"] + }, + { + "type": "object", + "properties": { + "J": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TestStruct" + } + } + }, + "required": ["J"] + }, + { + "type": "object", + "properties": { + "K": { + "type": "array", + "prefixItems": [ + { + "$ref": "#/components/schemas/TestStruct" + }, + { + "$ref": "#/components/schemas/TestStruct" + } + ], + "minItems": 2, + "maxItems": 2 + } + }, + "required": ["K"] + }, + { + "type": "object", + "properties": { + "L": { + "type": "string", + "nullable": true + } + }, + "required": ["L"] + }, + { + "type": "object", + "properties": { + "M": { + "type": "array", + "items": { + "type": "string", + "nullable": true + } + } + }, + "required": ["M"] + }, + { + "type": "object", + "properties": { + "N": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "nullable": true, + "type": "string" + } + } + }, + "required": ["N"] + } + ] + }, + "ErrorResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "error": { + "type": "string" + } + }, + "required": ["error", "code"] + }, + "ErrorResponse2": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "error": { + "type": "string" + } + }, + "required": ["error", "code"] + }, + "ExternallyTaggedEvent": { + "description": "Externally tagged enum (default) - serializes as `{\"VariantName\": ...}`\nExample: `{\"Created\": {\"id\": 1, \"name\": \"test\"}}`\nThis is included for comparison with the other representations.", + "oneOf": [ + { + "type": "object", + "description": "Item was created", + "properties": { + "Created": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name"] + } + }, + "required": ["Created"] + }, + { + "type": "object", + "description": "Item was updated", + "properties": { + "Updated": { + "type": "object", + "properties": { + "id": { + "type": "integer" + } + }, + "required": ["id"] + } + }, + "required": ["Updated"] + }, + { + "type": "object", + "description": "Item was deleted", + "properties": { + "Deleted": { + "type": "integer" + } + }, + "required": ["Deleted"] + } + ] + }, + "FileUploadResponse": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "documentUrl": { + "type": "string", + "nullable": true + }, + "id": { + "type": "integer" + }, + "isActive": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "thumbnailUrl": { + "type": "string", + "nullable": true + } + }, + "required": ["id", "name", "tags", "isActive", "createdAt"] + }, + "GenericStruct": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "object" + } + }, + "required": ["value", "name"] + }, + "GenericStruct2": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "object" + }, + "value2": { + "type": "object" + } + }, + "required": ["value", "name", "value2"] + }, + "InSkipResponse": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": ["name"] + }, + "InternallyTaggedMessage": { + "description": "Internally tagged enum - serializes as `{\"type\": \"...\", ...fields...}`\nExample: `{\"type\": \"Request\", \"id\": 1, \"method\": \"GET\"}`", + "oneOf": [ + { + "type": "object", + "description": "A request message", + "properties": { + "id": { + "type": "integer" + }, + "method": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["Request"] + } + }, + "required": ["type", "id", "method"] + }, + { + "type": "object", + "description": "A response message", + "properties": { + "id": { + "type": "integer" + }, + "result": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "enum": ["Response"] + } + }, + "required": ["type", "id"] + }, + { + "type": "object", + "description": "A notification (no payload)", + "properties": { + "type": { + "type": "string", + "enum": ["Notification"] + } + }, + "required": ["type"] + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "MapQuery": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "optional_age": { + "type": "integer", + "nullable": true + } + }, + "required": ["name", "age"] + }, + "MemoCommentSchema": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "integer" + }, + "memo": { + "$ref": "#/components/schemas/MemoSchema" + }, + "memoId": { + "type": "integer" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "user": { + "$ref": "#/components/schemas/UserSchema" + }, + "userId": { + "type": "integer" + } + }, + "required": [ + "id", + "userId", + "memoId", + "content", + "createdAt", + "updatedAt", + "user", + "memo" + ] + }, + "MemoResponse": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "integer" + }, + "status": { + "$ref": "#/components/schemas/MemoStatus" + }, + "title": { + "type": "string" + }, + "userId": { + "type": "integer" + } + }, + "required": ["id", "userId", "title", "content", "status", "createdAt"] + }, + "MemoResponseComments": { + "type": "object", + "properties": { + "memoComments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MemoResponseComments_MemoComments" + } + } + }, + "required": ["memoComments"] + }, + "MemoResponseComments_MemoComments": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "integer" + }, + "memoId": { + "type": "integer" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "userId": { + "type": "integer" + } + }, + "required": [ + "id", + "userId", + "memoId", + "content", + "createdAt", + "updatedAt" + ] + }, + "MemoResponseRel": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "integer" + }, + "status": { + "$ref": "#/components/schemas/MemoStatus" + }, + "title": { + "type": "string" + }, + "user": { + "$ref": "#/components/schemas/UserSchema" + }, + "userId": { + "type": "integer" + } + }, + "required": [ + "id", + "userId", + "title", + "content", + "status", + "createdAt", + "user" + ] + }, + "MemoSchema": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "integer" + }, + "status": { + "$ref": "#/components/schemas/MemoStatus" + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "user": { + "$ref": "#/components/schemas/UserSchema" + }, + "userId": { + "type": "integer" + } + }, + "required": [ + "id", + "userId", + "title", + "content", + "status", + "createdAt", + "updatedAt", + "user" + ] + }, + "MemoSnakeCase": { + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "integer" + }, + "user_id": { + "type": "integer" + } + }, + "required": ["id", "user_id", "created_at"] + }, + "MemoStatus": { + "type": "string", + "enum": ["draft", "published", "archived"] + }, + "PaginatedResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object" + } + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "totalPage": { + "type": "integer" + } + }, + "required": ["items", "page", "size", "totalPage"] + }, + "Pagination": { + "type": "object", + "description": "Common pagination parameters that can be reused across requests", + "properties": { + "page": { + "type": "integer", + "description": "Page number (1-indexed)", + "default": 1 + }, + "per_page": { + "type": "integer", + "description": "Items per page", + "default": 20 + } + } + }, + "PatchFileUploadRequest": { + "type": "object", + "properties": { + "isActive": { + "type": "boolean", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "tags": { + "type": "string", + "nullable": true + }, + "thumbnail": { + "type": "string", + "format": "binary", + "nullable": true + } + } + }, + "ResponseMeta": { + "type": "object", + "description": "Common metadata for responses", + "properties": { + "has_more": { + "type": "boolean", + "description": "Whether there are more pages" + }, + "total": { + "type": "integer", + "description": "Total number of items" + } + }, + "required": ["total", "has_more"] + }, + "SearchResponse": { + "description": "Response combining multiple flattened structs", + "allOf": [ + { + "type": "object", + "properties": { + "found": { + "type": "boolean", + "description": "Whether any results were found" + }, + "results": { + "type": "array", + "description": "Search results", + "items": { + "type": "string" + } + } + }, + "required": ["results", "found"] + }, + { + "$ref": "#/components/schemas/ResponseMeta" + } + ] + }, + "SignupRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": ["email", "password"] + }, + "SignupResponse": { + "type": "object", + "properties": { + "birthday": { + "type": "string", + "nullable": true + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "gender": { + "type": "string", + "nullable": true + }, + "id": { + "type": "integer" + }, + "job": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "nickname": { + "type": "string", + "nullable": true + }, + "phoneNumber23": { + "type": "string" + } + }, + "required": ["id", "email", "name", "phoneNumber23", "createdAt"] + }, + "SkipResponse": { + "type": "object", + "properties": { + "email2": { + "type": "string", + "nullable": true + }, + "email4": { + "type": "string", + "nullable": true + }, + "email5": { + "type": "string", + "default": "" + }, + "email6": { + "type": "string", + "default": "default42" + }, + "in_skip": { + "$ref": "#/components/schemas/InSkipResponse" + }, + "in_skip2": { + "$ref": "#/components/schemas/InSkipResponse", + "nullable": true + }, + "in_skip3": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InSkipResponse" + } + }, + "in_skip4": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InSkipResponse" + }, + "nullable": true + }, + "in_skip5": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/InSkipResponse" + }, + "nullable": true + }, + "in_skip6": { + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": { + "$ref": "#/components/schemas/InSkipResponse" + }, + "nullable": true + }, + "name": { + "type": "string" + }, + "num": { + "type": "integer", + "default": 0 + } + }, + "required": ["name", "in_skip", "in_skip3"] + }, + "StructBody": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["name", "age"] + }, + "StructBodyWithOptional": { + "type": "object", + "properties": { + "age": { + "type": "integer", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + } + } + }, + "StructQuery": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["name", "age"] + }, + "SubscribeRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": ["name", "email"] + }, + "SubscribeResponse": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "isSubscribed": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name", "email", "isSubscribed"] + }, + "TestStruct": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["name", "age"] + }, + "ThirdMapQuery": { + "type": "object", + "properties": { + "age": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "optional_age": { + "type": "integer", + "nullable": true + } + }, + "required": ["name", "age"] + }, + "UntaggedValue": { + "description": "Untagged enum - serializes as just the variant data, no tag\nThe deserializer tries each variant in order until one matches.\nExample: `\"hello\"` or `42` or `{\"key\": \"value\"}`", + "oneOf": [ + { + "type": "string", + "description": "A string value" + }, + { + "type": "integer", + "description": "A numeric value" + }, + { + "type": "boolean", + "description": "A boolean value" + }, + { + "type": "object", + "description": "An object with key-value pairs", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": ["key", "value"] + } + ] + }, + "UpdateFileUploadRequest": { + "type": "object", + "properties": { + "document": { + "type": "string", + "format": "binary", + "nullable": true + }, + "is_active": { + "type": "boolean", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "tags": { + "type": "string", + "nullable": true + }, + "thumbnail": { + "type": "string", + "format": "binary", + "nullable": true + } + } + }, + "UpdateMemoRequest": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "title": { + "type": "string" + } + }, + "required": ["title", "content", "id"] + }, + "User": { + "type": "object", + "description": "Full user model with all fields", + "properties": { + "email": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "internal_score": { + "type": "integer", + "description": "Internal field - should be omitted in public APIs", + "nullable": true + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name", "email"] + }, + "UserDTO": { + "type": "object", + "description": "Full user model with all fields", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name"] + }, + "UserItem": { + "type": "object", + "description": "Simple user representation", + "properties": { + "email": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name", "email"] + }, + "UserListRequest": { + "description": "Request with flattened pagination parameters\n\nThe pagination fields (page, per_page) are merged into this struct's JSON representation.", + "allOf": [ + { + "type": "object", + "properties": { + "filter": { + "type": "string", + "description": "Filter users by name (optional)", + "nullable": true + }, + "sort": { + "type": "string", + "description": "Sort order: \"asc\" or \"desc\"" + } + } + }, + { + "$ref": "#/components/schemas/Pagination" + } + ] + }, + "UserListResponse": { + "description": "Paginated response with flattened metadata\n\nThe response meta fields (total, has_more) are merged into this struct's JSON representation.", + "allOf": [ + { + "type": "object", + "properties": { + "data": { + "type": "array", + "description": "List of users", + "items": { + "$ref": "#/components/schemas/UserItem" + } + } + }, + "required": ["data"] + }, + { + "$ref": "#/components/schemas/ResponseMeta" + } + ] + }, + "UserPublicResponse": { + "type": "object", + "description": "Full user model with all fields", + "properties": { + "email": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name", "email"] + }, + "UserSchema": { + "type": "object", + "description": "User model", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "Created at" + }, + "email": { + "type": "string", + "description": "User email" + }, + "id": { + "type": "integer", + "description": "User ID" + }, + "name": { + "type": "string", + "description": "User name" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "Updated at" + } + }, + "required": ["id", "email", "name", "createdAt", "updatedAt"] + }, + "UserSummary": { + "type": "object", + "description": "Full user model with all fields", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "required": ["id", "name"] + } + } + }, + "tags": [ + { + "name": "flatten" + }, + { + "name": "form" + }, + { + "name": "hello" + }, + { + "name": "typed-form" + }, + { + "name": "third" + } + ] +} diff --git a/examples/next/package.json b/examples/next/package.json index 18307b7..2f8b1ba 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -9,9 +9,9 @@ "lint": "next lint" }, "dependencies": { - "next": "^16.1.1", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "next": "^16.3.2", + "react": "^19.2.8", + "react-dom": "^19.2.8", "@devup-api/next-plugin": "workspace:*", "@devup-api/fetch": "workspace:*", "@devup-api/react-query": "workspace:*", @@ -19,13 +19,14 @@ "@devup-ui/react": "^1", "@tanstack/react-query": "^5", "@devup-api/ui": "workspace:*", - "@devup-api/hookform": "workspace:*" + "@devup-api/hookform": "workspace:*", + "zod": "^4.4" }, "devDependencies": { "@devup-ui/next-plugin": "^1", - "@types/node": "^25", + "@types/node": "^26", "@types/react": "^19", "@types/react-dom": "^19", - "typescript": "^5" + "typescript": "^7" } } diff --git a/examples/rsbuild/package.json b/examples/rsbuild/package.json index 06169fd..f9fec74 100644 --- a/examples/rsbuild/package.json +++ b/examples/rsbuild/package.json @@ -9,8 +9,8 @@ "preview": "rsbuild preview" }, "dependencies": { - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.8", + "react-dom": "^19.2.8", "@devup-api/fetch": "workspace:*" }, "devDependencies": { @@ -18,7 +18,7 @@ "@rsbuild/plugin-react": "*", "@types/react": "^19", "@types/react-dom": "^19", - "typescript": "^5", + "typescript": "^7", "@devup-api/rsbuild-plugin": "workspace:*" } } diff --git a/examples/vite/package.json b/examples/vite/package.json index 37c45a9..d28b5f0 100644 --- a/examples/vite/package.json +++ b/examples/vite/package.json @@ -9,16 +9,16 @@ "preview": "vite preview" }, "dependencies": { - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.8", + "react-dom": "^19.2.8", "@devup-api/fetch": "workspace:*" }, "devDependencies": { "@types/react": "^19", "@types/react-dom": "^19", - "@vitejs/plugin-react": "^5.1.2", - "typescript": "^5", - "vite": "^7.3.0", + "@vitejs/plugin-react": "^6.1.0", + "typescript": "^7", + "vite": "^8.2.2", "@devup-api/vite-plugin": "workspace:*" } } diff --git a/package.json b/package.json index 1784e0b..68f49fb 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,15 @@ "type": "module", "private": true, "devDependencies": { - "@biomejs/biome": "^2.3", - "@testing-library/react": "^16.3.1", + "@biomejs/biome": "^2.5", + "@devup-api/react-query": "workspace:*", + "@testing-library/react": "^16.3.2", "@testing-library/react-hooks": "^8.0.1", "@types/bun": "latest", "bun-test-env-dom": "^1.0.3", "husky": "^9", - "react": "^19.2.3", - "react-dom": "^19.2.3" + "react": "^19.2.8", + "react-dom": "^19.2.8" }, "author": "JeongMin Oh", "license": "Apache-2.0", @@ -22,7 +23,8 @@ "lint:fix": "biome check --write", "prepare": "husky", "build": "bun run -F @devup-api/core build && bun run -F @devup-api/utils build && bun run -F @devup-api/generator build && bun run -F @devup-api/fetch build && bun run -F @devup-api/zod build && bun run -F @devup-api/webpack-plugin build && bun run -F @devup-api/vite-plugin build && bun run -F @devup-api/next-plugin build && bun run -F @devup-api/rsbuild-plugin build && bun run -F @devup-api/react-query build && bun run -F @devup-api/hookform build && bun run -F @devup-api/ui build", - "publish": "bun publish --cwd packages/core && bun publish --cwd packages/utils && bun publish --cwd packages/generator && bun publish --cwd packages/fetch && bun publish --cwd packages/zod && bun publish --cwd packages/webpack-plugin && bun publish --cwd packages/vite-plugin && bun publish --cwd packages/next-plugin && bun publish --cwd packages/rsbuild-plugin && bun publish --cwd packages/react-query && bun publish --cwd packages/hookform && bun publish --cwd packages/ui" + "publish": "bun publish --cwd packages/core && bun publish --cwd packages/utils && bun publish --cwd packages/generator && bun publish --cwd packages/fetch && bun publish --cwd packages/zod && bun publish --cwd packages/webpack-plugin && bun publish --cwd packages/vite-plugin && bun publish --cwd packages/next-plugin && bun publish --cwd packages/rsbuild-plugin && bun publish --cwd packages/react-query && bun publish --cwd packages/hookform && bun publish --cwd packages/ui", + "changepacks": "bunx @changepacks/cli" }, "workspaces": [ "packages/*", diff --git a/packages/core/package.json b/packages/core/package.json index 5273a90..8c39ab4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/core", - "version": "0.1.10", + "version": "0.1.21", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -21,7 +22,7 @@ "access": "public" }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9" + "@types/node": "^26.2", + "typescript": "^7.0" } } diff --git a/packages/core/src/__tests__/types.test.ts b/packages/core/src/__tests__/types.test.ts index e488fa7..29931e1 100644 --- a/packages/core/src/__tests__/types.test.ts +++ b/packages/core/src/__tests__/types.test.ts @@ -345,6 +345,55 @@ describe('DevupObject', () => { >().toEqualTypeOf() expectTypeOf>().toEqualTypeOf() }) + + test('default (no R) accesses all component schemas merged', () => { + // DevupObject without R should merge response + request + error + type All = DevupObject< + keyof { response: never; request: never; error: never }, + 'test-api.json' + > + + // response keys accessible + type User = All['User'] + expectTypeOf().toEqualTypeOf<{ + id: number + name: string + email: string + }>() + + // request keys accessible + type CreateUser = All['CreateUserRequest'] + expectTypeOf().toEqualTypeOf<{ name: string; email: string }>() + + // error keys accessible + type ApiError = All['ApiError'] + expectTypeOf().toEqualTypeOf<{ code: string; message: string }>() + }) + + test('default DevupObject includes all schemas from all contexts', () => { + // Verify that response, request, error keys all exist + type AllKeys = keyof DevupObject< + keyof { response: never; request: never; error: never }, + 'test-api.json' + > + + // response keys + type HasUser = 'User' extends AllKeys ? true : false + type HasUserList = 'UserList' extends AllKeys ? true : false + // request keys + type HasCreateUser = 'CreateUserRequest' extends AllKeys ? true : false + type HasUpdateUser = 'UpdateUserRequest' extends AllKeys ? true : false + // error keys + type HasApiError = 'ApiError' extends AllKeys ? true : false + type HasNotFound = 'NotFoundError' extends AllKeys ? true : false + + expectTypeOf().toEqualTypeOf() + expectTypeOf().toEqualTypeOf() + expectTypeOf().toEqualTypeOf() + expectTypeOf().toEqualTypeOf() + expectTypeOf().toEqualTypeOf() + expectTypeOf().toEqualTypeOf() + }) }) // ============================================================================= diff --git a/packages/core/src/additional.ts b/packages/core/src/additional.ts index d835e75..7726b76 100644 --- a/packages/core/src/additional.ts +++ b/packages/core/src/additional.ts @@ -6,22 +6,25 @@ export type Additional< Target extends object, > = T extends keyof Target ? Target[T] & object : object -export type RequiredOptions = keyof T extends undefined +export type RequiredOptions = ('params' | 'query' | 'body') & + keyof T extends never ? never - : 'params' extends keyof T - ? T - : 'query' extends keyof T - ? T - : 'body' extends keyof T - ? T - : never + : T export type IsCold = keyof DevupApiServers extends never ? true : false export type DevupApiRequestInit = Omit & { body?: object | RequestInit['body'] params?: Record query?: | ConstructorParameters[0] - | Record + | Record< + string, + | string + | number + | boolean + | null + | undefined + | (number | string | boolean)[] + > middleware?: Middleware[] } @@ -32,9 +35,10 @@ export type ExtractValue = V extends keyof T export type BoildApiOption = Omit & Omit -export type ConditionalApiOption = IsCold extends true - ? DevupApiRequestInit - : BoildApiOption +export type ConditionalApiOption< + O, + _Cold extends boolean = IsCold, +> = _Cold extends true ? DevupApiRequestInit : BoildApiOption export type ApiOption = [ RequiredOptions, diff --git a/packages/core/src/api-struct.ts b/packages/core/src/api-struct.ts index 08f436c..0656204 100644 --- a/packages/core/src/api-struct.ts +++ b/packages/core/src/api-struct.ts @@ -28,17 +28,39 @@ export interface DevupResponseComponentStruct {} // biome-ignore lint/suspicious/noEmptyInterface: empty interface export interface DevupErrorComponentStruct {} +// biome-ignore lint/suspicious/noEmptyInterface: empty interface for augmentation by generator +export interface DevupPrecomputedMethodKeys {} + +// biome-ignore lint/suspicious/noEmptyInterface: empty interface for augmentation by generator +export interface DevupPrecomputedScopes {} + +type LowercaseMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' + +type DevupComponentStructByRole = { + response: DevupResponseComponentStruct + request: DevupRequestComponentStruct + error: DevupErrorComponentStruct +} + +type DevupObjectAll = ExtractValue< + DevupResponseComponentStruct, + T, + unknown +> & + ExtractValue & + ExtractValue + +type DevupObjectSpecific< + R extends keyof DevupComponentStructByRole, + T extends string, +> = ExtractValue + export type DevupObject< - R extends 'response' | 'request' | 'error' = 'response', + R extends keyof DevupComponentStructByRole = keyof DevupComponentStructByRole, T extends keyof DevupApiServers | (string & {}) = 'openapi.json', -> = ExtractValue< - { - response: ExtractValue - request: ExtractValue - error: ExtractValue - }, - R -> +> = [keyof DevupComponentStructByRole] extends [R] + ? DevupObjectAll + : DevupObjectSpecific export type DevupGetApiStructScope = ConditionalScope< DevupGetApiStruct, @@ -76,12 +98,53 @@ export type DevupDeleteApiStructKey = ConditionalKeys< export type DevupPatchApiStructKey = ConditionalKeys< DevupPatchApiStructScope > +export type DevupApiMethodKeys = + | 'get' + | 'post' + | 'put' + | 'delete' + | 'patch' + | 'GET' + | 'POST' + | 'PUT' + | 'DELETE' + | 'PATCH' + +export type DevupApiMethodScope< + S extends string, + M extends DevupApiMethodKeys, +> = M extends 'get' | 'GET' + ? DevupGetApiStructScope + : M extends 'post' | 'POST' + ? DevupPostApiStructScope + : M extends 'put' | 'PUT' + ? DevupPutApiStructScope + : M extends 'delete' | 'DELETE' + ? DevupDeleteApiStructScope + : M extends 'patch' | 'PATCH' + ? DevupPatchApiStructScope + : never + +export type DevupApiMethodKey< + S extends string, + M extends DevupApiMethodKeys, +> = S extends keyof DevupPrecomputedMethodKeys + ? ExtractValue< + ExtractValue, + Lowercase & LowercaseMethod, + never + > + : ConditionalKeys> + export type DevupApiStructScope = DevupGetApiStructScope & DevupPostApiStructScope & DevupPutApiStructScope & DevupDeleteApiStructScope & DevupPatchApiStructScope -export type DevupApiStructKey = ConditionalKeys< - DevupApiStructScope -> +export type DevupApiStructKey = + | DevupGetApiStructKey + | DevupPostApiStructKey + | DevupPutApiStructKey + | DevupDeleteApiStructKey + | DevupPatchApiStructKey diff --git a/packages/core/src/options.ts b/packages/core/src/options.ts index fc59687..15f6cc2 100644 --- a/packages/core/src/options.ts +++ b/packages/core/src/options.ts @@ -28,4 +28,16 @@ export interface DevupApiOptions extends DevupApiTypeGeneratorOptions { * @default {'openapi.json'} */ openapiFiles?: string[] | string + + /** + * Generate Server Action wrappers for operationId-based API calls. + * + * @default {true} + */ + serverActions?: + | boolean + | { + enabled?: boolean + baseUrl?: string + } } diff --git a/packages/core/src/url-map.ts b/packages/core/src/url-map.ts index b9669fe..1f6f291 100644 --- a/packages/core/src/url-map.ts +++ b/packages/core/src/url-map.ts @@ -1,4 +1,11 @@ +export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' + export interface UrlMapValue { - method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' + method: HttpMethod url: string + bodyType?: 'json' | 'form' | 'multipart' } + +export type UrlMapStoredValue = Omit + +export type UrlMapEntry = Partial> diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 631c09f..4da947b 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -1,6 +1,7 @@ import type { ExtractValue } from './additional' +import type { DevupApiServers } from './api-struct' -export type ConditionalKeys = keyof T extends undefined +export type ConditionalKeys = keyof DevupApiServers extends never ? F : keyof T & string export type ConditionalScope = ExtractValue diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/fetch/README.md b/packages/fetch/README.md index 3a6e782..006e63f 100644 --- a/packages/fetch/README.md +++ b/packages/fetch/README.md @@ -114,7 +114,7 @@ console.log(result.response.status) ### Using Path Parameters ```ts -// Path parameters are automatically replaced +// Path parameters are automatically replaced and URL-encoded const result = await api.get('/users/{userId}/posts/{postId}', { params: { userId: '123', @@ -124,6 +124,8 @@ const result = await api.get('/users/{userId}/posts/{postId}', { // URL becomes: /users/123/posts/456 ``` +Each value is encoded with `encodeURIComponent`, so `a/b` is sent as `a%2Fb` and stays one path segment. `.` and `..` would still be resolved as dot segments, so they throw instead of sending the request. + ### Using Query Parameters ```ts diff --git a/packages/fetch/package.json b/packages/fetch/package.json index af6bdb4..4e4e75c 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -1,20 +1,26 @@ { "name": "@devup-api/fetch", - "version": "0.1.13", + "version": "0.1.27", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" + }, + "./server": { + "types": "./dist/server.d.ts", + "import": "./dist/server.js", + "require": "./dist/server.cjs" } }, "files": [ "dist" ], "scripts": { - "build": "tsc && bun build --target node --outfile=dist/index.js src/index.ts --production --packages=external && bun build --target node --outfile=dist/index.cjs --format=cjs src/index.ts --production --packages=external" + "build": "tsc && bun -e \"await Bun.write('dist/server.d.ts', await Bun.file('src/server.d.ts').text())\" && bun build --target node --outfile=dist/index.js src/index.ts --production --packages=external && bun build --target node --outfile=dist/index.cjs --format=cjs src/index.ts --production --packages=external && bun build --target node --outfile=dist/server.js src/server.ts --production --packages=external && bun build --target node --outfile=dist/server.cjs --format=cjs src/server.ts --production --packages=external" }, "publishConfig": { "access": "public" @@ -23,7 +29,7 @@ "@devup-api/core": "workspace:^" }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9" + "@types/node": "^26.2", + "typescript": "^7.0" } } diff --git a/packages/fetch/src/__tests__/api-body-type.test.ts b/packages/fetch/src/__tests__/api-body-type.test.ts new file mode 100644 index 0000000..6497f76 --- /dev/null +++ b/packages/fetch/src/__tests__/api-body-type.test.ts @@ -0,0 +1,227 @@ +/** biome-ignore-all lint/suspicious/noExplicitAny: any is used to allow for flexibility in the type */ +import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test' +import type { UrlMapValue } from '@devup-api/core' + +// Mock the url-map module to return custom bodyType values +const mockUrlMap: Record< + string, + Record>>> +> = { + 'openapi.json': { + submitForm: { POST: { url: '/submit', bodyType: 'form' } }, + uploadFile: { + POST: { url: '/upload', bodyType: 'multipart' }, + }, + jsonEndpoint: { POST: { url: '/json', bodyType: 'json' } }, + }, +} + +mock.module('../url-map', () => ({ + DEVUP_API_URL_MAP: mockUrlMap, + getApiEndpointInfo: ( + key: string, + serverName: string, + method: string, + ): UrlMapValue => { + const stored = mockUrlMap[serverName]?.[key]?.[method] + return { method: method as 'GET', url: key, ...stored } + }, +})) + +// Import DevupApi AFTER mock.module so it picks up the mocked url-map +const { DevupApi } = await import('../api') + +const originalFetch = globalThis.fetch + +beforeEach(() => { + globalThis.fetch = mock(() => + Promise.resolve( + new Response(JSON.stringify({ success: true }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ), + ) as unknown as typeof fetch +}) + +afterEach(() => { + globalThis.fetch = originalFetch +}) + +describe('bodyType-aware serialization', () => { + test('bodyType form: plain object body serialized as URLSearchParams', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + await api.post( + 'submitForm' as never, + { body: { name: 'test', age: 25 } } as never, + ) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + expect(request.headers.get('Content-Type')).toBe( + 'application/x-www-form-urlencoded', + ) + const body = await request.text() + const params = new URLSearchParams(body) + expect(params.get('name')).toBe('test') + expect(params.get('age')).toBe('25') + } + }) + + test('bodyType multipart: plain object body serialized as FormData', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + await api.post( + 'uploadFile' as never, + { body: { name: 'test', value: 123 } } as never, + ) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + // Content-Type should NOT be explicitly set for multipart + // (browser auto-sets with boundary) + const contentType = request.headers.get('Content-Type') + expect( + contentType === null || contentType.includes('multipart/form-data'), + ).toBe(true) + expect(request.body).not.toBeNull() + } + }) + + test('bodyType undefined (default): plain object body serialized as JSON', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + // Use a path that is NOT in the URL map, so bodyType will be undefined + await api.post( + '/test' as never, + { body: { name: 'test', value: 123 } } as never, + ) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + expect(request.headers.get('Content-Type')).toBe('application/json') + const body = await request.text() + expect(body).toBe(JSON.stringify({ name: 'test', value: 123 })) + } + }) + + test('bodyType json: plain object body serialized as JSON', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + await api.post('jsonEndpoint' as never, { body: { name: 'test' } } as never) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + expect(request.headers.get('Content-Type')).toBe('application/json') + const body = await request.text() + expect(body).toBe(JSON.stringify({ name: 'test' })) + } + }) + + test('FormData body passthrough regardless of bodyType', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + const formData = new FormData() + formData.append('file', 'test') + + await api.post('submitForm' as never, { body: formData } as never) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + // FormData should be passed through as-is, not re-serialized + expect(request.body).not.toBeNull() + expect(request.body).toBeDefined() + } + }) + + test('bodyType form: nested objects are JSON.stringified in URLSearchParams', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + await api.post( + 'submitForm' as never, + { body: { data: { nested: true }, items: [1, 2] } } as never, + ) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + const body = await request.text() + const params = new URLSearchParams(body) + expect(params.get('data')).toBe(JSON.stringify({ nested: true })) + expect(params.get('items')).toBe(JSON.stringify([1, 2])) + } + }) + + test('bodyType form: null/undefined values are skipped', async () => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + await api.post( + 'submitForm' as never, + { body: { name: 'test', empty: null, missing: undefined } } as never, + ) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + const body = await request.text() + const params = new URLSearchParams(body) + expect(params.get('name')).toBe('test') + expect(params.has('empty')).toBe(false) + expect(params.has('missing')).toBe(false) + } + }) +}) diff --git a/packages/fetch/src/__tests__/api.test.ts b/packages/fetch/src/__tests__/api.test.ts index 45808a5..370d306 100644 --- a/packages/fetch/src/__tests__/api.test.ts +++ b/packages/fetch/src/__tests__/api.test.ts @@ -1,6 +1,7 @@ /** biome-ignore-all lint/suspicious/noExplicitAny: any is used to allow for flexibility in the type */ import { afterEach, beforeEach, expect, mock, test } from 'bun:test' import { DevupApi } from '../api' +import { createApi } from '../create-api' const originalFetch = globalThis.fetch @@ -19,15 +20,30 @@ afterEach(() => { globalThis.fetch = originalFetch }) +test('request defaults to GET when no method is specified', async () => { + const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') + const fetcher = globalThis.fetch as unknown as ReturnType + + await api.request('/test' as never) + + expect(fetcher).toHaveBeenCalledTimes(1) + const request = fetcher.mock.calls[0]?.[0] as Request + expect(request.method).toBe('GET') + expect(request.url).toBe('https://api.example.com/test') +}) + test.each([ ['https://api.example.com', 'https://api.example.com'], ['https://api.example.com/', 'https://api.example.com'], ['http://localhost:3000', 'http://localhost:3000'], ['http://localhost:3000/', 'http://localhost:3000'], -] as const)('constructor removes trailing slash: %s -> %s', (baseUrl, expected) => { - const api = new DevupApi(baseUrl, undefined, 'openapi.json') - expect(api.getBaseUrl()).toBe(expected) -}) +] as const)( + 'constructor removes trailing slash: %s -> %s', + (baseUrl, expected) => { + const api = new DevupApi(baseUrl, undefined, 'openapi.json') + expect(api.getBaseUrl()).toBe(expected) + }, +) test.each([ [undefined, {}], @@ -36,14 +52,17 @@ test.each([ { headers: { Authorization: 'Bearer token' } }, { headers: { Authorization: 'Bearer token' } }, ], -] as const)('constructor accepts defaultOptions: %s -> %s', (defaultOptions, expected) => { - const api = new DevupApi( - 'https://api.example.com', - defaultOptions, - 'openapi.json', - ) - expect(api.getDefaultOptions()).toEqual(expected) -}) +] as const)( + 'constructor accepts defaultOptions: %s -> %s', + (defaultOptions, expected) => { + const api = new DevupApi( + 'https://api.example.com', + defaultOptions, + 'openapi.json', + ) + expect(api.getDefaultOptions()).toEqual(expected) + }, +) test.each([ [{}, {}], @@ -51,11 +70,18 @@ test.each([ { headers: { 'Content-Type': 'application/json' } }, { headers: { 'Content-Type': 'application/json' } }, ], -] as const)('setDefaultOptions updates defaultOptions: %s -> %s', (options, expected) => { - const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') - api.setDefaultOptions(options) - expect(api.getDefaultOptions()).toEqual(expected) -}) +] as const)( + 'setDefaultOptions updates defaultOptions: %s -> %s', + (options, expected) => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + api.setDefaultOptions(options) + expect(api.getDefaultOptions()).toEqual(expected) + }, +) test.each([ ['GET', 'get'], @@ -68,20 +94,27 @@ test.each([ ['DELETE', 'DELETE'], ['PATCH', 'patch'], ['PATCH', 'PATCH'], -] as const)('HTTP method %s calls request with correct method', async (expectedMethod, methodName) => { - const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') - const mockFetch = globalThis.fetch as unknown as ReturnType - - await (api as any)[methodName]('/test' as never) - - expect(mockFetch).toHaveBeenCalledTimes(1) - const call = mockFetch.mock.calls[0] - expect(call).toBeDefined() - if (call) { - const request = call[0] as Request - expect(request.method).toBe(expectedMethod) - } -}) +] as const)( + 'HTTP method %s calls request with correct method', + async (expectedMethod, methodName) => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const mockFetch = globalThis.fetch as unknown as ReturnType + + await (api as any)[methodName]('/test' as never) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const call = mockFetch.mock.calls[0] + expect(call).toBeDefined() + if (call) { + const request = call[0] as Request + expect(request.method).toBe(expectedMethod) + } + }, +) test('request serializes plain object body to JSON', async () => { const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') @@ -201,6 +234,43 @@ test('request uses params to replace path parameters', async () => { } }) +test.each([ + ['../members', 'https://api.example.com/admin/notices/..%2Fmembers'], + ['a/b', 'https://api.example.com/admin/notices/a%2Fb'], + ['x?y=1', 'https://api.example.com/admin/notices/x%3Fy%3D1'], + ['x#y', 'https://api.example.com/admin/notices/x%23y'], +] as const)( + 'request sends path param %s as one encoded segment', + async (id, expected) => { + const api = createApi('https://api.example.com') + const mockFetch = globalThis.fetch as unknown as ReturnType + + await api.delete( + '/admin/notices/{id}' as never, + { params: { id } } as never, + ) + + expect(mockFetch).toHaveBeenCalledTimes(1) + const [request] = mockFetch.mock.calls[0] as [Request] + expect(request.url).toBe(expected) + }, +) + +test.each(['.', '..'] as const)( + 'request rejects path param %s without fetching', + async (id) => { + const api = createApi('https://api.example.com') + const mockFetch = globalThis.fetch as unknown as ReturnType + + await expect( + api.delete('/admin/notices/{id}' as never, { params: { id } } as never), + ).rejects.toThrow( + `Path parameter "id" cannot be "${id}": it would change the request path`, + ) + expect(mockFetch).not.toHaveBeenCalled() + }, +) + test('request returns response with data on success', async () => { globalThis.fetch = mock(() => Promise.resolve( @@ -539,3 +609,44 @@ test('request uses method from options when provided', async () => { expect(request.method).toBe('POST') } }) + +test('resolveEndpoint returns key as url when no URL map entry exists', () => { + const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') + const result = api.resolveEndpoint('GET' as any, '/users' as any) + expect(result.url).toBe('/users') + expect(result.method).toBe('GET') +}) + +test('resolveEndpoint returns key as url for unknown operationId', () => { + const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') + const result = api.resolveEndpoint('POST' as any, 'unknownOp' as any) + expect(result.url).toBe('unknownOp') + expect(result.method).toBe('POST') +}) + +test('resolveEndpoint normalizes lowercase method to uppercase', () => { + const api = new DevupApi('https://api.example.com', undefined, 'openapi.json') + const result = api.resolveEndpoint('get' as any, '/users' as any) + expect(result.method).toBe('GET') + expect(result.url).toBe('/users') +}) + +test.each([ + ['GET', '/users'], + ['POST', '/users'], + ['PUT', '/users/{id}'], + ['DELETE', '/users/{id}'], + ['PATCH', '/users/{id}'], +] as const)( + 'resolveEndpoint preserves method %s for path %s', + (method, path) => { + const api = new DevupApi( + 'https://api.example.com', + undefined, + 'openapi.json', + ) + const result = api.resolveEndpoint(method as any, path as any) + expect(result.method).toBe(method) + expect(result.url).toBe(path) + }, +) diff --git a/packages/fetch/src/__tests__/create-api.test.ts b/packages/fetch/src/__tests__/create-api.test.ts index 94f8c0d..393e1f7 100644 --- a/packages/fetch/src/__tests__/create-api.test.ts +++ b/packages/fetch/src/__tests__/create-api.test.ts @@ -17,24 +17,27 @@ test.each([ ['https://api.example.com', undefined], ['https://api.example.com', {}], ['https://api.example.com', { headers: { Authorization: 'Bearer token' } }], -] as const)('createApi accepts defaultOptions: %s', (baseUrl, defaultOptions) => { - const api = createApi({ baseUrl, ...defaultOptions }) - expect(api).toBeInstanceOf(DevupApi) - if (defaultOptions) { - expect(api.getDefaultOptions()).toEqual(defaultOptions) - } -}) +] as const)( + 'createApi accepts defaultOptions: %s', + (baseUrl, defaultOptions) => { + const api = createApi({ baseUrl, ...defaultOptions }) + expect(api).toBeInstanceOf(DevupApi) + if (defaultOptions) { + expect(api.getDefaultOptions()).toEqual(defaultOptions) + } + }, +) -test.each([ - ['openapi.json'], - ['openapi2.json'], -] as const)('createApi accepts serverName: %s', (serverName) => { - const api = createApi({ - baseUrl: 'https://api.example.com', - serverName: serverName as any, - }) - expect(api).toBeInstanceOf(DevupApi) -}) +test.each([['openapi.json'], ['openapi2.json']] as const)( + 'createApi accepts serverName: %s', + (serverName) => { + const api = createApi({ + baseUrl: 'https://api.example.com', + serverName: serverName as any, + }) + expect(api).toBeInstanceOf(DevupApi) + }, +) test('createApi uses default serverName when not provided', () => { const api = createApi({ baseUrl: 'https://api.example.com' }) diff --git a/packages/fetch/src/__tests__/index.test.ts b/packages/fetch/src/__tests__/index.test.ts index 3113f99..71c26e1 100644 --- a/packages/fetch/src/__tests__/index.test.ts +++ b/packages/fetch/src/__tests__/index.test.ts @@ -7,5 +7,6 @@ test('index.ts exports', () => { expect({ ...indexModule }).toEqual({ DevupApi: expect.any(Function), createApi: expect.any(Function), + serializeApiResponse: expect.any(Function), }) }) diff --git a/packages/fetch/src/__tests__/response-converter.test.ts b/packages/fetch/src/__tests__/response-converter.test.ts index c72feb5..671a7e4 100644 --- a/packages/fetch/src/__tests__/response-converter.test.ts +++ b/packages/fetch/src/__tests__/response-converter.test.ts @@ -5,27 +5,32 @@ test.each([ ['json', 'json'], ['text', 'text'], ['stream', 'stream'], -] as const)('convertResponse parses successful response with parseAs=%s', async (parseAs) => { - const request = new Request('https://api.example.com/test', { method: 'GET' }) - const response = new Response(JSON.stringify({ id: 1, name: 'test' }), { - status: 200, - headers: { 'Content-Type': 'application/json' }, - }) - - const result = await convertResponse(request, response, parseAs) - - expect('data' in result).toBe(true) - if ('data' in result) { - if (parseAs === 'stream') { - expect(result.data).toBeDefined() - } else if (parseAs === 'text') { - expect(typeof result.data).toBe('string') - } else { - expect(result.data).toEqual({ id: 1, name: 'test' }) +] as const)( + 'convertResponse parses successful response with parseAs=%s', + async (parseAs) => { + const request = new Request('https://api.example.com/test', { + method: 'GET', + }) + const response = new Response(JSON.stringify({ id: 1, name: 'test' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }) + + const result = await convertResponse(request, response, parseAs) + + expect('data' in result).toBe(true) + if ('data' in result) { + if (parseAs === 'stream') { + expect(result.data).toBeDefined() + } else if (parseAs === 'text') { + expect(typeof result.data).toBe('string') + } else { + expect(result.data).toEqual({ id: 1, name: 'test' }) + } } - } - expect(result.response).toBe(response) -}) + expect(result.response).toBe(response) + }, +) test('convertResponse handles 204 No Content with success', async () => { const request = new Request('https://api.example.com/test', { diff --git a/packages/fetch/src/__tests__/server.test.ts b/packages/fetch/src/__tests__/server.test.ts new file mode 100644 index 0000000..dd9c49d --- /dev/null +++ b/packages/fetch/src/__tests__/server.test.ts @@ -0,0 +1,65 @@ +import { describe, expect, test } from 'bun:test' +import type { DevupApiResponse } from '../api' +import { serializeApiResponse } from '../server-utils' + +describe('serializeApiResponse', () => { + test('converts successful responses to Server Action-safe plain objects', () => { + const response = new Response(JSON.stringify({ id: 1 }), { + status: 201, + statusText: 'Created', + headers: { 'X-Test': 'yes' }, + }) + // The test DOM's Response constructor strips Set-Cookie, so append it here. + response.headers.append('Set-Cookie', 'session=SECRET; HttpOnly') + response.headers.append('Set-Cookie2', 'legacy=1') + const result: DevupApiResponse<{ id: number }, { message: string }> = { + data: { id: 1 }, + isOk: true, + isError: false, + response, + } + + expect(serializeApiResponse(result)).toEqual({ + data: { id: 1 }, + isOk: true, + isError: false, + response: { + headers: { + 'content-type': 'text/plain;charset=UTF-8', + 'x-test': 'yes', + }, + redirected: false, + status: 201, + statusText: 'Created', + type: response.type, + url: '', + }, + }) + }) + + test('converts error responses to Server Action-safe plain objects', () => { + const response = new Response('missing', { status: 404 }) + response.headers.append('Set-Cookie', 'session=SECRET; HttpOnly') + response.headers.append('Set-Cookie2', 'legacy=1') + const result: DevupApiResponse<{ id: number }, { message: string }> = { + error: { message: 'Not found' }, + isOk: false, + isError: true, + response, + } + + expect(serializeApiResponse(result)).toEqual({ + error: { message: 'Not found' }, + isOk: false, + isError: true, + response: { + headers: { 'content-type': 'text/plain;charset=UTF-8' }, + redirected: false, + status: 404, + statusText: '', + type: response.type, + url: '', + }, + }) + }) +}) diff --git a/packages/fetch/src/__tests__/types.test.ts b/packages/fetch/src/__tests__/types.test.ts index c9d7403..bb98501 100644 --- a/packages/fetch/src/__tests__/types.test.ts +++ b/packages/fetch/src/__tests__/types.test.ts @@ -129,6 +129,26 @@ describe('DevupApiResponse', () => { }>() expectTypeOf().toEqualTypeOf<{ message: string; code: number }>() }) + + test('response metadata type can be customized', () => { + type SerializableResponse = { + status: number + headers: Record + } + type Response = DevupApiResponse< + { id: number }, + { message: string }, + SerializableResponse + > + + type SuccessCase = Extract + type ErrorCase = Extract + + expectTypeOf< + SuccessCase['response'] + >().toEqualTypeOf() + expectTypeOf().toEqualTypeOf() + }) }) // ============================================================================= diff --git a/packages/fetch/src/__tests__/url-map.test.ts b/packages/fetch/src/__tests__/url-map.test.ts index 2a32e98..bc034fd 100644 --- a/packages/fetch/src/__tests__/url-map.test.ts +++ b/packages/fetch/src/__tests__/url-map.test.ts @@ -2,10 +2,10 @@ import { beforeEach, expect, test } from 'bun:test' const urlMap = { foo: { - getUsers: { method: 'GET' as const, url: '/users' }, - createUser: { method: 'POST' as const, url: '/users' }, - updateUser: { method: 'PUT' as const, url: '/users/{id}' }, - deleteUser: { method: 'DELETE' as const, url: '/users/{id}' }, + getUsers: { GET: { url: '/users' } }, + createUser: { POST: { url: '/users' } }, + updateUser: { PUT: { url: '/users/{id}' } }, + deleteUser: { DELETE: { url: '/users/{id}' } }, }, } @@ -15,42 +15,62 @@ beforeEach(() => { const random = Math.random() test.each([ - ['getUsers', '/users', JSON.stringify(urlMap)], - ['createUser', '/users', JSON.stringify(urlMap)], - ['updateUser', '/users/{id}', JSON.stringify(urlMap)], - ['deleteUser', '/users/{id}', JSON.stringify(urlMap)], -] as const)('getApiEndpointInfo returns url for existing key: %s -> %s', async (key, expected, envValue) => { - process.env.DEVUP_API_URL_MAP = envValue - // Add query parameter to bypass module cache and reload - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo')?.url).toBe(expected) -}) + ['getUsers', '/users', 'GET', JSON.stringify(urlMap)], + ['createUser', '/users', 'POST', JSON.stringify(urlMap)], + ['updateUser', '/users/{id}', 'PUT', JSON.stringify(urlMap)], + ['deleteUser', '/users/{id}', 'DELETE', JSON.stringify(urlMap)], +] as const)( + 'getApiEndpointInfo returns url for existing key: %s -> %s', + async (key, expected, method, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + // Add query parameter to bypass module cache and reload + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', method)?.url).toBe(expected) + }, +) test.each([ - ['nonExistentKey', 'nonExistentKey', JSON.stringify(urlMap)], - ['unknown', 'unknown', JSON.stringify(urlMap)], - ['', '', JSON.stringify(urlMap)], - ['/users', '/users', JSON.stringify(urlMap)], -] as const)('getApiEndpointInfo returns key itself when key does not exist: %s -> %s', async (key, expected, envValue) => { - process.env.DEVUP_API_URL_MAP = envValue - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo').url).toBe(expected) -}) + ['nonExistentKey', 'nonExistentKey', 'GET', JSON.stringify(urlMap)], + ['unknown', 'unknown', 'GET', JSON.stringify(urlMap)], + ['', '', 'GET', JSON.stringify(urlMap)], + ['/users', '/users', 'GET', JSON.stringify(urlMap)], +] as const)( + 'getApiEndpointInfo returns key itself when key does not exist: %s -> %s', + async (key, expected, method, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', method).url).toBe(expected) + }, +) test.each([ - ['getUsers', { method: 'GET', url: '/users' }, JSON.stringify(urlMap)], - ['createUser', { method: 'POST', url: '/users' }, JSON.stringify(urlMap)], - ['updateUser', { method: 'PUT', url: '/users/{id}' }, JSON.stringify(urlMap)], + ['getUsers', { method: 'GET', url: '/users' }, 'GET', JSON.stringify(urlMap)], + [ + 'createUser', + { method: 'POST', url: '/users' }, + 'POST', + JSON.stringify(urlMap), + ], + [ + 'updateUser', + { method: 'PUT', url: '/users/{id}' }, + 'PUT', + JSON.stringify(urlMap), + ], [ 'deleteUser', { method: 'DELETE', url: '/users/{id}' }, + 'DELETE', JSON.stringify(urlMap), ], -] as const)('getApiEndpointInfo returns UrlMapValue for existing key: %s -> %s', async (key, expected, envValue) => { - process.env.DEVUP_API_URL_MAP = envValue - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo')).toEqual(expected) -}) +] as const)( + 'getApiEndpointInfo returns UrlMapValue for existing key: %s -> %s', + async (key, expected, method, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', method)).toEqual(expected) + }, +) test.each([ [ @@ -61,184 +81,74 @@ test.each([ ['unknown', { method: 'GET', url: 'unknown' }, JSON.stringify(urlMap)], ['', { method: 'GET', url: '' }, JSON.stringify(urlMap)], ['/users', { method: 'GET', url: '/users' }, JSON.stringify(urlMap)], -] as const)('getApiEndpointInfo returns default for non-existent key: %s -> %s', async (key, expected, envValue) => { - process.env.DEVUP_API_URL_MAP = envValue - const { getApiEndpointInfo } = await import(`../url-map`) - expect(getApiEndpointInfo(key, '')).toEqual(expected) -}) +] as const)( + 'getApiEndpointInfo returns default for non-existent key: %s -> %s', + async (key, expected, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + const { getApiEndpointInfo } = await import(`../url-map`) + expect(getApiEndpointInfo(key, '', 'GET')).toEqual(expected) + }, +) test.each([ ['anyKey', 'anyKey', '{}'], ['test', 'test', '{}'], -] as const)('getApiEndpointInfo works with empty URL map: %s -> %s', async (key, expected, envValue) => { - process.env.DEVUP_API_URL_MAP = envValue - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo').url).toBe(expected) -}) +] as const)( + 'getApiEndpointInfo works with empty URL map: %s -> %s', + async (key, expected, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', 'GET').url).toBe(expected) + }, +) test.each([ ['anyKey', { method: 'GET', url: 'anyKey' }, '{}'], ['test', { method: 'GET', url: 'test' }, '{}'], -] as const)('getApiEndpointInfo works with empty URL map: %s -> %s', async (key, expected, envValue) => { - process.env.DEVUP_API_URL_MAP = envValue - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo')).toEqual(expected) -}) +] as const)( + 'getApiEndpointInfo works with empty URL map: %s -> %s', + async (key, expected, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', 'GET')).toEqual(expected) + }, +) + +test.each([ + [['GET', 'anyKey'], '{}'], + [['POST', 'anyKey'], '{}'], + [['PUT', 'anyKey'], '{}'], + [['DELETE', 'anyKey'], '{}'], + [['PATCH', 'anyKey'], '{}'], +] as const)( + 'getApiEndpointInfo works with empty URL map: %s -> %s', + async (key, envValue) => { + process.env.DEVUP_API_URL_MAP = envValue + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key[1], 'foo', key[0]).method).toEqual(key[0]) + }, +) test.each([ ['anyKey', 'anyKey'], ['test', 'test'], -] as const)('getApiEndpointInfo works when DEVUP_API_URL_MAP is not set: %s -> %s', async (key, expected) => { - delete process.env.DEVUP_API_URL_MAP - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo').url).toBe(expected) -}) +] as const)( + 'getApiEndpointInfo works when DEVUP_API_URL_MAP is not set: %s -> %s', + async (key, expected) => { + delete process.env.DEVUP_API_URL_MAP + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', 'GET').url).toBe(expected) + }, +) test.each([ ['anyKey', 'anyKey'], ['test', 'test'], -] as const)('getApiEndpointInfo works when DEVUP_API_URL_MAP is not set: %s -> %s', async (key, expected) => { - delete process.env.DEVUP_API_URL_MAP - const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) - expect(getApiEndpointInfo(key, 'foo').url).toBe(expected) -}) - -// test.each([ -// ['anyKey', { method: 'GET', url: 'anyKey' }], -// ['test', { method: 'GET', url: 'test' }], -// ] as const)('getApiEndpointInfo works when DEVUP_API_URL_MAP is not set: %s -> %s', async (key, expected) => { -// delete process.env.DEVUP_API_URL_MAP -// const { getApiEndpointInfo } = await import(`../url-map?t=1`) -// expect(getApiEndpointInfo(key, 'foo')).toEqual(expected) -// }) - -// test('getApiEndpointInfo handles key that exists but url property is missing', async () => { -// const urlMapWithoutUrl = { -// testKey: { method: 'GET' as const }, -// } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(urlMapWithoutUrl) -// const { getApiEndpointInfo } = await import( -// `../url-map` -// ) -// // When url property is missing, optional chaining returns undefined, so key is returned -// expect(getApiEndpointInfo('testKey', 'foo').url).toBe('testKey') -// }) - -// test('DEVUP_API_URL_MAP constant is exported and accessible', async () => { -// const testUrlMap = { -// '': { testKey: { method: 'GET' as const, url: '/test' } }, -// } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(testUrlMap) -// const urlMapModule = await import( -// `../url-map` -// ) -// expect(urlMapModule).toHaveProperty('DEVUP_API_URL_MAP') -// expect(typeof urlMapModule.DEVUP_API_URL_MAP).toBe('object') -// // Directly access the constant to ensure it's covered -// const urlMap = urlMapModule.DEVUP_API_URL_MAP -// expect(urlMap).toEqual(testUrlMap) -// // Verify it's used by getApiEndpointInfo function -// expect(urlMapModule.getApiEndpointInfo('testKey', 'foo').url).toBe('/test') -// }) - -// test('DEVUP_API_URL_MAP uses fallback when env var is undefined', async () => { -// delete process.env.DEVUP_API_URL_MAP -// const urlMapModule = await import( -// `../url-map` -// ) -// // Directly access the constant to ensure the fallback path is covered -// const urlMap = urlMapModule.DEVUP_API_URL_MAP -// expect(urlMap).toEqual({}) -// expect(urlMapModule.getApiEndpointInfo('anyKey', 'foo').url).toBe('anyKey') -// // Explicitly call getApiEndpointInfo to ensure it's covered -// const result = urlMapModule.getApiEndpointInfo('anyKey', 'foo') -// expect(result).toEqual({ -// method: 'GET', -// url: 'anyKey', -// }) -// // Also test that the function exists and is callable -// expect(typeof urlMapModule.getApiEndpointInfo).toBe('function') -// }) - -// test('DEVUP_API_URL_MAP uses fallback when env var is empty string', async () => { -// process.env.DEVUP_API_URL_MAP = '' -// const urlMapModule = await import( -// `../url-map` -// ) -// // Directly access the constant to ensure the fallback path is covered -// const urlMap = urlMapModule.DEVUP_API_URL_MAP -// expect(urlMap).toEqual({}) -// expect(urlMapModule.getApiEndpointInfo('anyKey', 'foo').url).toBe('anyKey') -// expect(urlMapModule.getApiEndpointInfo('anyKey', 'foo')).toEqual({ -// method: 'GET', -// url: 'anyKey', -// }) -// }) - -// test('getApiEndpointInfo handles key where DEVUP_API_URL_MAP[key] exists but url is undefined', async () => { -// const urlMapWithUndefinedUrl = { -// testKey: { method: 'GET' as const }, -// } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(urlMapWithUndefinedUrl) -// const { getApiEndpointInfo } = await import( -// `../url-map` -// ) -// // When url property is missing, optional chaining returns undefined, so key is returned -// expect(getApiEndpointInfo('testKey', 'foo').url).toBe('testKey') -// }) - -// test('getApiEndpointInfo handles key where DEVUP_API_URL_MAP[key] exists but url is null', async () => { -// const urlMapWithNullUrl = { -// testKey: { method: 'GET' as const, url: null as unknown as string }, -// } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(urlMapWithNullUrl) -// const { getApiEndpointInfo } = await import( -// `../url-map` -// ) -// // When url is null, optional chaining returns null, so key is returned -// expect(getApiEndpointInfo('testKey', 'foo').url).toBe('testKey') -// }) - -// test('getApiEndpointInfo handles key where DEVUP_API_URL_MAP[key] exists but url is empty string', async () => { -// const urlMapWithEmptyUrl = { -// testKey: { method: 'GET' as const, url: '' }, -// } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(urlMapWithEmptyUrl) -// const { getApiEndpointInfo } = await import( -// `../url-map` -// ) -// // When url is empty string, it's falsy, so key is returned -// expect(getApiEndpointInfo('testKey', 'foo').url).toBe('testKey') -// }) - -// test('getApiEndpointInfo returns default when key does not exist in map (explicit coverage for line 10)', async () => { -// const urlMap = { existingKey: { method: 'POST' as const, url: '/existing' } } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(urlMap) -// const { getApiEndpointInfo } = await import( -// `../url-map` -// ) -// // Explicitly test the if(!result) branch to ensure line 10 is covered -// const result = getApiEndpointInfo('nonExistentKeyInMap', 'foo') -// expect(result).toEqual({ method: 'GET', url: 'nonExistentKeyInMap' }) -// expect(result.method).toBe('GET') -// expect(result.url).toBe('nonExistentKeyInMap') -// }) - -// test('getApiEndpointInfo returns result when key exists with url (explicit coverage for lines 12-13)', async () => { -// const urlMap = { -// '': { -// testKey: { method: 'PUT' as const, url: '/test/url' }, -// }, -// } -// process.env.DEVUP_API_URL_MAP = JSON.stringify(urlMap) -// const { getApiEndpointInfo } = await import( -// `../url-map?t=${Date.now()+Math.random()}` -// ) -// // Explicitly test the result.url ||= key and return result path (lines 12-13) -// const result = getApiEndpointInfo('testKey', 'foo') -// expect(result).toEqual({ method: 'PUT', url: '/test/url' }) -// expect(result.method).toBe('PUT') -// expect(result.url).toBe('/test/url') -// // Verify that url was not changed (since it already exists) -// expect(result.url).not.toBe('testKey') -// }) +] as const)( + 'getApiEndpointInfo works when DEVUP_API_URL_MAP is not set: %s -> %s', + async (key, expected) => { + delete process.env.DEVUP_API_URL_MAP + const { getApiEndpointInfo } = await import(`../url-map?t=${random}`) + expect(getApiEndpointInfo(key, 'foo', 'GET').url).toBe(expected) + }, +) diff --git a/packages/fetch/src/__tests__/utils.test.ts b/packages/fetch/src/__tests__/utils.test.ts index e43b935..c51f773 100644 --- a/packages/fetch/src/__tests__/utils.test.ts +++ b/packages/fetch/src/__tests__/utils.test.ts @@ -1,5 +1,11 @@ -import { expect, test } from 'bun:test' -import { getApiEndpoint, getQueryString, isPlainObject } from '../utils' +import { describe, expect, test } from 'bun:test' +import { + getApiEndpoint, + getQueryString, + isPlainObject, + objectToFormData, + objectToURLSearchParams, +} from '../utils' test.each([ [{}, true], @@ -103,8 +109,97 @@ test.each([ { id: '123' }, 'https://api.example.com/users/123/profile', ], -])('getApiEndpoint: baseUrl=%s, path=%s, params=%s -> %s', (baseUrl, path, params, expected) => { - expect(getApiEndpoint(baseUrl, path, params)).toBe(expected) + [ + 'https://api.example.com', + '/users/{id}', + { id: '../members' }, + 'https://api.example.com/users/..%2Fmembers', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: 'a/b' }, + 'https://api.example.com/users/a%2Fb', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: 'x?y=1' }, + 'https://api.example.com/users/x%3Fy%3D1', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: 'x#y' }, + 'https://api.example.com/users/x%23y', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: '%' }, + 'https://api.example.com/users/%25', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: 'a b' }, + 'https://api.example.com/users/a%20b', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: '공지' }, + 'https://api.example.com/users/%EA%B3%B5%EC%A7%80', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: '$&' }, + 'https://api.example.com/users/%24%26', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: '$`' }, + 'https://api.example.com/users/%24%60', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: 123 }, + 'https://api.example.com/users/123', + ], + [ + 'https://api.example.com', + '/users/{id}/friends/{id}', + { id: 'a/b' }, + 'https://api.example.com/users/a%2Fb/friends/a%2Fb', + ], + [ + 'https://api.example.com', + '/users/{id}', + { id: '' }, + 'https://api.example.com/users/', + ], + [ + 'https://api.example.com', + '/users', + { id: '..' }, + 'https://api.example.com/users', + ], +])( + 'getApiEndpoint: baseUrl=%s, path=%s, params=%s -> %s', + (baseUrl, path, params, expected) => { + expect(getApiEndpoint(baseUrl, path, params)).toBe(expected) + }, +) + +test.each(['.', '..'])('getApiEndpoint rejects path param %s', (id) => { + expect(() => + getApiEndpoint('https://api.example.com', '/users/{id}', { id }), + ).toThrow( + `Path parameter "id" cannot be "${id}": it would change the request path`, + ) }) test.each([ @@ -160,3 +255,117 @@ test.each([ ) expect(result.toString()).toBe(expected) }) + +describe('objectToURLSearchParams', () => { + test('converts simple key-value pairs', () => { + const params = objectToURLSearchParams({ name: 'test', age: 25 }) + expect(params.get('name')).toBe('test') + expect(params.get('age')).toBe('25') + }) + + test('skips null values', () => { + const params = objectToURLSearchParams({ name: 'test', skip: null }) + expect(params.get('name')).toBe('test') + expect(params.has('skip')).toBe(false) + }) + + test('skips undefined values', () => { + const params = objectToURLSearchParams({ name: 'test', skip: undefined }) + expect(params.get('name')).toBe('test') + expect(params.has('skip')).toBe(false) + }) + + test('JSON.stringifies nested objects', () => { + const nested = { key: 'value' } + const params = objectToURLSearchParams({ data: nested }) + expect(params.get('data')).toBe(JSON.stringify(nested)) + }) + + test('JSON.stringifies arrays', () => { + const arr = [1, 2, 3] + const params = objectToURLSearchParams({ items: arr }) + expect(params.get('items')).toBe(JSON.stringify(arr)) + }) + + test('converts boolean values to string', () => { + const params = objectToURLSearchParams({ active: true, deleted: false }) + expect(params.get('active')).toBe('true') + expect(params.get('deleted')).toBe('false') + }) + + test('converts number values to string', () => { + const params = objectToURLSearchParams({ count: 42, price: 9.99 }) + expect(params.get('count')).toBe('42') + expect(params.get('price')).toBe('9.99') + }) + + test('handles empty object', () => { + const params = objectToURLSearchParams({}) + expect(params.toString()).toBe('') + }) +}) + +describe('objectToFormData', () => { + test('converts simple key-value pairs', () => { + const formData = objectToFormData({ name: 'test', age: 25 }) + expect(formData.get('name')).toBe('test') + expect(formData.get('age')).toBe('25') + }) + + test('skips null values', () => { + const formData = objectToFormData({ name: 'test', skip: null }) + expect(formData.get('name')).toBe('test') + expect(formData.has('skip')).toBe(false) + }) + + test('skips undefined values', () => { + const formData = objectToFormData({ name: 'test', skip: undefined }) + expect(formData.get('name')).toBe('test') + expect(formData.has('skip')).toBe(false) + }) + + test('JSON.stringifies nested objects', () => { + const nested = { key: 'value' } + const formData = objectToFormData({ data: nested }) + expect(formData.get('data')).toBe(JSON.stringify(nested)) + }) + + test('JSON.stringifies arrays', () => { + const arr = [1, 2, 3] + const formData = objectToFormData({ items: arr }) + expect(formData.get('items')).toBe(JSON.stringify(arr)) + }) + + test('appends Blob values directly', () => { + const blob = new Blob(['hello'], { type: 'text/plain' }) + const formData = objectToFormData({ file: blob }) + const result = formData.get('file') + expect(result).toBeInstanceOf(Blob) + }) + + test('appends File values directly', () => { + const file = new File(['content'], 'test.txt', { type: 'text/plain' }) + const formData = objectToFormData({ document: file }) + const result = formData.get('document') + expect(result).toBeInstanceOf(File) + expect((result as File).name).toBe('test.txt') + }) + + test('converts boolean values to string', () => { + const formData = objectToFormData({ active: true, deleted: false }) + expect(formData.get('active')).toBe('true') + expect(formData.get('deleted')).toBe('false') + }) + + test('converts number values to string', () => { + const formData = objectToFormData({ count: 42, price: 9.99 }) + expect(formData.get('count')).toBe('42') + expect(formData.get('price')).toBe('9.99') + }) + + test('handles empty object', () => { + const formData = objectToFormData({}) + const entries = Array.from(formData.entries()) + expect(entries).toHaveLength(0) + }) +}) diff --git a/packages/fetch/src/api.ts b/packages/fetch/src/api.ts index 5719940..6533e89 100644 --- a/packages/fetch/src/api.ts +++ b/packages/fetch/src/api.ts @@ -3,38 +3,46 @@ import type { ApiOption, BoildApiOption, ConditionalKeys, + DevupApiMethodKey, + DevupApiMethodKeys, DevupApiRequestInit, DevupApiServers, DevupApiStructKey, DevupApiStructScope, - DevupDeleteApiStructKey, DevupDeleteApiStructScope, - DevupGetApiStructKey, DevupGetApiStructScope, - DevupPatchApiStructKey, DevupPatchApiStructScope, - DevupPostApiStructKey, DevupPostApiStructScope, - DevupPutApiStructKey, DevupPutApiStructScope, ExtractValue, + HttpMethod, Middleware, } from '@devup-api/core' import { convertResponse } from './response-converter' import { getApiEndpointInfo } from './url-map' -import { getApiEndpoint, getQueryString, isPlainObject } from './utils' +import { + getApiEndpoint, + getQueryString, + isPlainObject, + objectToFormData, + objectToURLSearchParams, +} from './utils' // biome-ignore lint/suspicious/noExplicitAny: any is used to allow for flexibility in the type -export type DevupApiResponse = +export type DevupApiResponse = | { data: T error?: undefined - response: Response + isOk: true + isError: false + response: TResponse } | { data?: undefined error: E - response: Response + isOk: false + isError: true + response: TResponse } export class DevupApi> { @@ -55,7 +63,7 @@ export class DevupApi> { } get< - T extends DevupGetApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -70,7 +78,7 @@ export class DevupApi> { } GET< - T extends DevupGetApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -85,7 +93,7 @@ export class DevupApi> { } post< - T extends DevupPostApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -100,7 +108,7 @@ export class DevupApi> { } POST< - T extends DevupPostApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -115,7 +123,7 @@ export class DevupApi> { } put< - T extends DevupPutApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -130,7 +138,7 @@ export class DevupApi> { } PUT< - T extends DevupPutApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -145,7 +153,7 @@ export class DevupApi> { } delete< - T extends DevupDeleteApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -160,7 +168,7 @@ export class DevupApi> { } DELETE< - T extends DevupDeleteApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -175,7 +183,7 @@ export class DevupApi> { } patch< - T extends DevupPatchApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -190,7 +198,7 @@ export class DevupApi> { } PATCH< - T extends DevupPatchApiStructKey, + T extends DevupApiMethodKey, O extends Additional>, >( path: T, @@ -213,7 +221,12 @@ export class DevupApi> { ): Promise< DevupApiResponse, ExtractValue> > { - const { method, url } = getApiEndpointInfo(path, this.serverName) + const { method, url, bodyType } = getApiEndpointInfo( + path, + this.serverName, + (options[0]?.method as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH') || + 'GET', + ) const { middleware = [], query, @@ -233,13 +246,29 @@ export class DevupApi> { headers: mergedHeaders, } if (body) { - if (isPlainObject(body)) { + if (!isPlainObject(body)) { + // Non-plain-object passthrough (FormData, Blob, string, etc.) + requestOptions.body = body + } else if (bodyType === 'form') { + // URLSearchParams serialization + requestOptions.body = objectToURLSearchParams( + body as Record, + ) + if (!requestOptions.headers.has('Content-Type')) { + requestOptions.headers.set( + 'Content-Type', + 'application/x-www-form-urlencoded', + ) + } + } else if (bodyType === 'multipart') { + // FormData serialization — do NOT set Content-Type (browser sets it with boundary) + requestOptions.body = objectToFormData(body as Record) + } else { + // Default: JSON serialization (bodyType === 'json' or undefined) requestOptions.body = JSON.stringify(body) if (!requestOptions.headers.has('Content-Type')) { requestOptions.headers.set('Content-Type', 'application/json') } - } else { - requestOptions.body = body } } const queryString = query ? `?${getQueryString(query).toString()}` : '' @@ -289,6 +318,7 @@ export class DevupApi> { > let response = ret.response + const hasError = !ret.response.ok let error: unknown = ret.error for (const middleware of finalMiddleware) { @@ -307,15 +337,15 @@ export class DevupApi> { if (middleware.onResponse) { result = await middleware.onResponse({ ...middlewareParams, - response: ret.response, + response, }) } // Call onError if there's an error and onResponse didn't return a result - if (!result && error && middleware.onError) { + if (!result && hasError && middleware.onError) { result = await middleware.onError({ ...middlewareParams, - error: ret.error, + error, }) } @@ -334,6 +364,8 @@ export class DevupApi> { return { data: ret.data, error: error, + isOk: !hasError, + isError: hasError, response, } as DevupApiResponse, ExtractValue> } @@ -353,4 +385,15 @@ export class DevupApi> { use(...middleware: Middleware[]): void { this.middleware.push(...middleware) } + + resolveEndpoint( + method: M, + key: DevupApiMethodKey, + ) { + return getApiEndpointInfo( + key, + this.serverName, + method.toUpperCase() as HttpMethod, + ) + } } diff --git a/packages/fetch/src/index.ts b/packages/fetch/src/index.ts index 1802b29..b0aef10 100644 --- a/packages/fetch/src/index.ts +++ b/packages/fetch/src/index.ts @@ -1,3 +1,4 @@ export * from '@devup-api/core' export * from './api' export { createApi } from './create-api' +export * from './server-utils' diff --git a/packages/fetch/src/server-utils.ts b/packages/fetch/src/server-utils.ts new file mode 100644 index 0000000..b3b8ef2 --- /dev/null +++ b/packages/fetch/src/server-utils.ts @@ -0,0 +1,52 @@ +import type { DevupApiResponse } from './api' + +export type SerializedResponse = { + headers: Record + redirected: boolean + status: number + statusText: string + type: string + url: string +} + +export type SerializedDevupApiResponse = DevupApiResponse< + T, + E, + SerializedResponse +> + +function serializeResponse(response: Response): SerializedResponse { + return { + headers: Object.fromEntries( + [...response.headers.entries()] + .map(([key, value]) => [key.toLowerCase(), value]) + // Browsers never expose these to JS; the result is handed to client code. + .filter(([key]) => key !== 'set-cookie' && key !== 'set-cookie2'), + ), + redirected: response.redirected, + status: response.status, + statusText: response.statusText, + type: response.type, + url: response.url, + } +} + +export function serializeApiResponse( + result: DevupApiResponse, +): DevupApiResponse { + if (result.isOk) { + return { + data: result.data, + isOk: true, + isError: false, + response: serializeResponse(result.response), + } + } + + return { + error: result.error, + isOk: false, + isError: true, + response: serializeResponse(result.response), + } +} diff --git a/packages/fetch/src/server.d.ts b/packages/fetch/src/server.d.ts new file mode 100644 index 0000000..6276642 --- /dev/null +++ b/packages/fetch/src/server.d.ts @@ -0,0 +1,7 @@ +export type ColdServerAction = (...options: unknown[]) => Promise + +export declare const actions: Record + +declare module '@devup-api/fetch/server-generated' {} + +export * from '@devup-api/fetch/server-generated' diff --git a/packages/fetch/src/server.ts b/packages/fetch/src/server.ts new file mode 100644 index 0000000..fa47391 --- /dev/null +++ b/packages/fetch/src/server.ts @@ -0,0 +1,16 @@ +export type ColdServerAction = (...options: unknown[]) => Promise + +function createColdServerAction(name: string): ColdServerAction { + return async () => { + throw new Error( + `@devup-api/fetch/server.${name} is a cold-typing placeholder. Configure a devup-api bundler plugin so this import is replaced by generated Server Actions.`, + ) + } +} + +export const actions: Record = new Proxy( + {}, + { + get: (_target, property) => createColdServerAction(String(property)), + }, +) diff --git a/packages/fetch/src/url-map.ts b/packages/fetch/src/url-map.ts index fd663d7..ab9e6fc 100644 --- a/packages/fetch/src/url-map.ts +++ b/packages/fetch/src/url-map.ts @@ -1,18 +1,15 @@ -import type { UrlMapValue } from '@devup-api/core' +import type { HttpMethod, UrlMapEntry, UrlMapValue } from '@devup-api/core' export const DEVUP_API_URL_MAP: Record< string, - Record + Record > = JSON.parse(process.env.DEVUP_API_URL_MAP || '{}') export function getApiEndpointInfo( key: string, serverName: string, + method: HttpMethod, ): UrlMapValue { - const result = DEVUP_API_URL_MAP[serverName]?.[key] ?? { - method: 'GET', - url: key, - } - result.url ||= key - return result + const stored = DEVUP_API_URL_MAP[serverName]?.[key]?.[method] + return { method, url: key, ...stored } } diff --git a/packages/fetch/src/utils.ts b/packages/fetch/src/utils.ts index 17e2991..0d3bb46 100644 --- a/packages/fetch/src/utils.ts +++ b/packages/fetch/src/utils.ts @@ -14,11 +14,50 @@ export function getApiEndpoint( ): string { let ret = `${baseUrl}${path}` for (const [key, value] of Object.entries(params ?? {})) { - ret = ret.replace(`{${key}}`, value) + const placeholder = `{${key}}` + if (!ret.includes(placeholder)) continue + const encoded = encodeURIComponent(String(value)) + // encodeURIComponent keeps "." and "..", and URL parsers resolve them as dot segments. + if (encoded === '.' || encoded === '..') { + throw new Error( + `Path parameter "${key}" cannot be "${encoded}": it would change the request path`, + ) + } + ret = ret.replaceAll(placeholder, () => encoded) } return ret } +export function objectToURLSearchParams( + obj: Record, +): URLSearchParams { + const params = new URLSearchParams() + for (const [key, value] of Object.entries(obj)) { + if (value === null || value === undefined) continue + if (typeof value === 'object') { + params.append(key, JSON.stringify(value)) + } else { + params.append(key, String(value)) + } + } + return params +} + +export function objectToFormData(obj: Record): FormData { + const formData = new FormData() + for (const [key, value] of Object.entries(obj)) { + if (value === null || value === undefined) continue + if (value instanceof File || value instanceof Blob) { + formData.append(key, value) + } else if (typeof value === 'object') { + formData.append(key, JSON.stringify(value)) + } else { + formData.append(key, String(value)) + } + } + return formData +} + export function getQueryString( query: NonNullable, ): URLSearchParams { diff --git a/packages/fetch/tsconfig.json b/packages/fetch/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/fetch/tsconfig.json +++ b/packages/fetch/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/generator/package.json b/packages/generator/package.json index f99c04e..8d97c1f 100644 --- a/packages/generator/package.json +++ b/packages/generator/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/generator", - "version": "0.1.12", + "version": "0.1.29", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -24,8 +25,8 @@ "@devup-api/utils": "workspace:^" }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", + "@types/node": "^26.2", + "typescript": "^7.0", "openapi-types": "^12.1" } } diff --git a/packages/generator/src/__tests__/__snapshots__/generate-interface.test.ts.snap b/packages/generator/src/__tests__/__snapshots__/generate-interface.test.ts.snap index d2210c7..a831f27 100644 --- a/packages/generator/src/__tests__/__snapshots__/generate-interface.test.ts.snap +++ b/packages/generator/src/__tests__/__snapshots__/generate-interface.test.ts.snap @@ -6,109 +6,33 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; + 'openapi.json': { + '/users': {}; getUsers: {}; } } - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct {} - - interface DevupErrorComponentStruct {} -}" -`; - -exports[`generateInterface returns interface for schema: %s 2`] = ` -"import "@devup-api/fetch"; -import type { DevupObject } from "@devup-api/fetch"; - -declare module "@devup-api/fetch" { - interface DevupApiServers { - [\`openapi.json\`]: never - } - - interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; - GetUsers: {}; - } - } - - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct {} - - interface DevupErrorComponentStruct {} -}" -`; - -exports[`generateInterface returns interface for schema: %s 3`] = ` -"import "@devup-api/fetch"; -import type { DevupObject } from "@devup-api/fetch"; - -declare module "@devup-api/fetch" { - interface DevupApiServers { - [\`openapi.json\`]: never - } - - interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; - get_users: {}; - } - } - - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct {} - - interface DevupErrorComponentStruct {} -}" -`; - -exports[`generateInterface returns interface for schema: %s 4`] = ` -"import "@devup-api/fetch"; -import type { DevupObject } from "@devup-api/fetch"; - -declare module "@devup-api/fetch" { - interface DevupApiServers { - [\`openapi.json\`]: never - } - - interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; - getUsers: {}; + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; } } - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct {} - - interface DevupErrorComponentStruct {} -}" -`; - -exports[`generateInterface returns interface for schema: %s 5`] = ` -"import "@devup-api/fetch"; -import type { DevupObject } from "@devup-api/fetch"; - -declare module "@devup-api/fetch" { - interface DevupApiServers { - [\`openapi.json\`]: never - } - - interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; - getUsers: {}; + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; } } @@ -120,18 +44,18 @@ declare module "@devup-api/fetch" { }" `; -exports[`generateInterface returns interface for schema: %s 6`] = ` +exports[`generateInterface returns interface for schema: %s 2`] = ` "import "@devup-api/fetch"; import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: Array['User']>; }; getUsers: { @@ -141,8 +65,8 @@ declare module "@devup-api/fetch" { } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: DevupObject<'response', 'openapi.json'>['User']; }; createUser: { @@ -151,56 +75,30 @@ declare module "@devup-api/fetch" { } } - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct { - [\`openapi.json\`]: { - User: { - id?: string; - name?: string; - }; - } - } - - interface DevupErrorComponentStruct {} -}" -`; - -exports[`generateInterface returns interface for schema: %s 7`] = ` -"import "@devup-api/fetch"; -import type { DevupObject } from "@devup-api/fetch"; - -declare module "@devup-api/fetch" { - interface DevupApiServers { - [\`openapi.json\`]: never - } - - interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: Array['User']>; - }; - GetUsers: { - response: Array['User']>; - }; + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; } } - interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; - CreateUser: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; } } interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; name?: string; @@ -212,136 +110,178 @@ declare module "@devup-api/fetch" { }" `; -exports[`generateInterface returns interface for schema: %s 8`] = ` +exports[`generateInterface handles nullable properties (OpenAPI 3.0 style) 1`] = ` "import "@devup-api/fetch"; import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { + type ResponseStatus = "active" | "inactive" + interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: Array['User']>; + 'openapi.json': { + '/users': { + response?: { + name?: string | null; + age?: number | null; + active?: boolean | null; + tags?: Array | null; + metadata?: { + key?: string; + } | null; + status?: ResponseStatus | null; + }; }; - get_users: { - response: Array['User']>; + getUsers: { + response?: { + name?: string | null; + age?: number | null; + active?: boolean | null; + tags?: Array | null; + metadata?: { + key?: string; + } | null; + status?: ResponseStatus | null; + }; }; } } - interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; - create_user: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; } } - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct { - [\`openapi.json\`]: { - User: { - id?: string; - name?: string; - }; + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; } } + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct {} + interface DevupErrorComponentStruct {} }" `; -exports[`generateInterface returns interface for schema: %s 9`] = ` +exports[`generateInterface handles nullable properties (OpenAPI 3.1 style) 1`] = ` "import "@devup-api/fetch"; import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: Array['User']>; + 'openapi.json': { + '/users': { + response?: { + name?: string | null; + age?: number | null; + active?: boolean | null; + }; }; getUsers: { - response: Array['User']>; + response?: { + name?: string | null; + age?: number | null; + active?: boolean | null; + }; }; } } - interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; - createUser: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; } } - interface DevupRequestComponentStruct {} - - interface DevupResponseComponentStruct { - [\`openapi.json\`]: { - User: { - id?: string; - name?: string; - }; + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; } } + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct {} + interface DevupErrorComponentStruct {} }" `; -exports[`generateInterface returns interface for schema: %s 10`] = ` +exports[`generateInterface handles nullable in component schemas 1`] = ` "import "@devup-api/fetch"; import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: Array['User']>; + 'openapi.json': { + '/users': { + response: DevupObject<'response', 'openapi.json'>['User']; }; getUsers: { - response: Array['User']>; + response: DevupObject<'response', 'openapi.json'>['User']; }; } } - interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; - createUser: { - response: DevupObject<'response', 'openapi.json'>['User']; - }; + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; } } interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; - name?: string; + nickname?: string | null; + bio?: string | null; }; } } @@ -356,12 +296,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; getUsers: { @@ -371,8 +311,8 @@ declare module "@devup-api/fetch" { } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; createUser: { @@ -382,8 +322,8 @@ declare module "@devup-api/fetch" { } interface DevupPutApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; updateUser: { @@ -393,15 +333,15 @@ declare module "@devup-api/fetch" { } interface DevupDeleteApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; + 'openapi.json': { + '/users': {}; deleteUser: {}; } } interface DevupPatchApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; patchUser: { @@ -410,6 +350,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: '/users' | 'createUser'; + put: '/users' | 'updateUser'; + delete: '/users' | 'deleteUser'; + patch: '/users' | 'patchUser'; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: DevupPostApiStruct['openapi.json']; + put: DevupPutApiStruct['openapi.json']; + delete: DevupDeleteApiStruct['openapi.json']; + patch: DevupPatchApiStruct['openapi.json']; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -424,12 +384,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users/{userId}\`]: { + 'openapi.json': { + '/users/{userId}': { params: { userId: string; }; @@ -444,6 +404,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users/{userId}' | 'getUser'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -458,12 +438,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { query: { page?: number; limit: number; @@ -480,6 +460,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -494,12 +494,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users/{userId}/posts\`]: { + 'openapi.json': { + '/users/{userId}/posts': { params: { userId: string; }; @@ -520,6 +520,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users/{userId}/posts' | 'getUserPosts'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -534,12 +554,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body?: { name?: string; email?: string; @@ -556,6 +576,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -570,12 +610,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body: DevupObject<'request', 'openapi.json'>['User']; response?: {}; }; @@ -586,8 +626,28 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { name?: string; email?: string; @@ -607,12 +667,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: Array['User']>; }; getUsers: { @@ -621,10 +681,30 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; name?: string; @@ -642,12 +722,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: DevupObject<'response', 'openapi.json'>['User']; }; createUser: { @@ -656,10 +736,30 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; name?: string; @@ -677,12 +777,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: { message?: string; }; @@ -695,6 +795,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -709,12 +829,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; error?: { error?: string; @@ -729,12 +849,32 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} interface DevupErrorComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { Error: { code?: string; message?: string; @@ -750,12 +890,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; error?: { error?: string; @@ -770,6 +910,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -784,12 +944,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body: DevupObject<'request', 'openapi.json'>['CreateUserRequest']; response?: {}; }; @@ -800,8 +960,28 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { CreateUserRequest: { name?: string; email?: string; @@ -821,12 +1001,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: DevupObject<'response', 'openapi.json'>['User']; }; getUsers: { @@ -835,10 +1015,30 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; name?: string; @@ -856,12 +1056,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; error: DevupObject<'error', 'openapi.json'>['Error']; }; @@ -872,12 +1072,32 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} interface DevupErrorComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { Error: { code?: string; message?: string; @@ -893,12 +1113,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: Array['User']>; }; getUsers: { @@ -907,10 +1127,30 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; name?: string; @@ -928,12 +1168,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users/{userId}\`]: { + 'openapi.json': { + '/users/{userId}': { params: { userId: string; }; @@ -948,6 +1188,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users/{userId}' | 'getUserById'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -962,17 +1222,37 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -987,12 +1267,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body?: { name?: string; email?: string; @@ -1009,6 +1289,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1023,12 +1323,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body?: { name?: string; email?: string; @@ -1045,6 +1345,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1059,12 +1379,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: { id: string; name?: string; @@ -1079,6 +1399,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1093,12 +1433,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: { id?: string; name?: string; @@ -1113,6 +1453,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1127,32 +1487,48 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: { - id?: string; -} & { + 'openapi.json': { + '/users': { + response: DevupObject<'response', 'openapi.json'>['Base'] & { extra?: string; }; }; getUsers: { - response: { - id?: string; -} & { + response: DevupObject<'response', 'openapi.json'>['Base'] & { extra?: string; }; }; } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { Base: { id?: string; }; @@ -1169,7 +1545,27 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: Record; + put: Record; + delete: Record; + patch: Record; + } } interface DevupRequestComponentStruct {} @@ -1186,12 +1582,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users/{userId}\`]: { + 'openapi.json': { + '/users/{userId}': { params: { userId: string; }; @@ -1206,6 +1602,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users/{userId}' | 'getUser'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1220,12 +1636,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body?: { name?: string; }; @@ -1240,6 +1656,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1254,16 +1690,36 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; + 'openapi.json': { + '/users': {}; getUsers: {}; } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1278,12 +1734,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users/{userId}/posts/{postId}\`]: { + 'openapi.json': { + '/users/{userId}/posts/{postId}': { params: { userId: string; postId: string; @@ -1309,8 +1765,8 @@ declare module "@devup-api/fetch" { } interface DevupPutApiStruct { - [\`openapi.json\`]: { - [\`/users/{userId}/posts/{postId}\`]: { + 'openapi.json': { + '/users/{userId}/posts/{postId}': { params: { userId: string; }; @@ -1327,8 +1783,28 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users/{userId}/posts/{postId}' | 'getUserPost'; + post: never; + put: '/users/{userId}/posts/{postId}' | 'updateUserPost'; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: DevupPutApiStruct['openapi.json']; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { UpdatePostRequest: { title?: string; content?: string; @@ -1337,7 +1813,7 @@ declare module "@devup-api/fetch" { } interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { Post: { id?: string; title?: string; @@ -1347,7 +1823,7 @@ declare module "@devup-api/fetch" { } interface DevupErrorComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { Error: { code?: string; message?: string; @@ -1363,34 +1839,44 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: ({ - id?: string; -} | { - id?: string; - role?: string; -}); + 'openapi.json': { + '/users': { + response: (DevupObject<'response', 'openapi.json'>['User'] | DevupObject<'response', 'openapi.json'>['Admin']); }; getUsers: { - response: ({ - id?: string; -} | { - id?: string; - role?: string; -}); + response: (DevupObject<'response', 'openapi.json'>['User'] | DevupObject<'response', 'openapi.json'>['Admin']); }; } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; }; @@ -1411,32 +1897,44 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { - response: ({ - id?: string; -} | { - name?: string; -}); + 'openapi.json': { + '/users': { + response: (DevupObject<'response', 'openapi.json'>['User'] | DevupObject<'response', 'openapi.json'>['Guest']); }; getUsers: { - response: ({ - id?: string; -} | { - name?: string; -}); + response: (DevupObject<'response', 'openapi.json'>['User'] | DevupObject<'response', 'openapi.json'>['Guest']); }; } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { User: { id?: string; }; @@ -1456,12 +1954,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body: unknown; response?: {}; }; @@ -1472,8 +1970,28 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { CreateUserRequest: { name?: string; }; @@ -1492,20 +2010,40 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: {}; + 'openapi.json': { + '/users': {}; getUsers: {}; } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { UserResponse: { id?: string; }; @@ -1522,12 +2060,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupPostApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { body: unknown; response?: {}; }; @@ -1538,6 +2076,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1552,12 +2110,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: unknown; }; getUsers: { @@ -1566,6 +2124,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1580,12 +2158,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; error: unknown; }; @@ -1596,6 +2174,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1610,12 +2208,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response: Array; }; getUsers: { @@ -1624,6 +2222,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1638,12 +2256,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; error: Array; }; @@ -1654,6 +2272,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1668,12 +2306,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; error: Array['Error']>; }; @@ -1684,12 +2322,32 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} interface DevupErrorComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { Error: { code?: string; message?: string; @@ -1705,12 +2363,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; getUsers: { @@ -1719,6 +2377,26 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} @@ -1733,12 +2411,12 @@ import type { DevupObject } from "@devup-api/fetch"; declare module "@devup-api/fetch" { interface DevupApiServers { - [\`openapi.json\`]: never + 'openapi.json': never } interface DevupGetApiStruct { - [\`openapi.json\`]: { - [\`/users\`]: { + 'openapi.json': { + '/users': { response?: {}; }; getUsers: { @@ -1747,12 +2425,32 @@ declare module "@devup-api/fetch" { } } + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/users' | 'getUsers'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + interface DevupRequestComponentStruct {} interface DevupResponseComponentStruct {} interface DevupErrorComponentStruct { - [\`openapi.json\`]: { + 'openapi.json': { ServerError: { error?: string; }; @@ -1760,3 +2458,765 @@ declare module "@devup-api/fetch" { } }" `; + +exports[`generateInterface handles inline response with nested $ref containing enums 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + type ItemStatus = "draft" | "published" | "archived" + type OtherStatus = "pending" | "approved" | "rejected" + + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupGetApiStruct { + 'openapi.json': { + '/items': { + response?: { + items?: Array['ItemResponse']>; + page?: number; + }; + }; + listItems: { + response?: { + items?: Array['ItemResponse']>; + page?: number; + }; + }; + '/other-items': { + response?: { + items?: Array['OtherItemResponse']>; + page?: number; + }; + }; + listOtherItems: { + response?: { + items?: Array['OtherItemResponse']>; + page?: number; + }; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/items' | 'listItems' | '/other-items' | 'listOtherItems'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct { + 'openapi.json': { + ItemResponse: { + id?: number; + status?: ItemStatus; + }; + OtherItemResponse: { + id?: number; + status?: OtherStatus; + }; + } + } + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles circular references in schema collection 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupGetApiStruct { + 'openapi.json': { + '/nodes': { + response: Array['TreeNode']>; + }; + listNodes: { + response: Array['TreeNode']>; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/nodes' | 'listNodes'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct { + 'openapi.json': { + TreeNode: { + id?: number; + name?: string; + children?: Array['TreeNode']>; + }; + } + } + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles request schema with inline enum 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + type CreateItemRequestPriority = "low" | "medium" | "high" + + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPostApiStruct { + 'openapi.json': { + '/items': { + body: DevupObject<'request', 'openapi.json'>['CreateItemRequest']; + response?: {}; + }; + createItem: { + body: DevupObject<'request', 'openapi.json'>['CreateItemRequest']; + response?: {}; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/items' | 'createItem'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct { + 'openapi.json': { + CreateItemRequest: { + name?: string; + priority?: CreateItemRequestPriority; + }; + } + } + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles response with non-JSON content type only 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupGetApiStruct { + 'openapi.json': { + '/files/{id}': { + params: { + id: string; + }; + }; + downloadFile: { + params: { + id: string; + }; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/files/{id}' | 'downloadFile'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles response schema with inline enum 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + type ItemResponseStatus = "active" | "inactive" | "archived" + + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupGetApiStruct { + 'openapi.json': { + '/items': { + response: DevupObject<'response', 'openapi.json'>['ItemResponse']; + }; + listItems: { + response: DevupObject<'response', 'openapi.json'>['ItemResponse']; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/items' | 'listItems'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct { + 'openapi.json': { + ItemResponse: { + name?: string; + status?: ItemResponseStatus; + }; + } + } + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles error schema with inline enum 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + type ErrorResponseCode = "INVALID_INPUT" | "NOT_FOUND" | "UNAUTHORIZED" + + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupGetApiStruct { + 'openapi.json': { + '/items': { + response?: {}; + error: DevupObject<'error', 'openapi.json'>['ErrorResponse']; + }; + getItems: { + response?: {}; + error: DevupObject<'error', 'openapi.json'>['ErrorResponse']; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: '/items' | 'getItems'; + post: never; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: DevupGetApiStruct['openapi.json']; + post: Record; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct { + 'openapi.json': { + ErrorResponse: { + message?: string; + code?: ErrorResponseCode; + }; + } + } +}" +`; + +exports[`generateInterface handles urlencoded request body with $ref 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPostApiStruct { + 'openapi.json': { + '/form': { + body: DevupObject<'request', 'openapi.json'>['SubscribeRequest'] | FormData; + response?: { + ok?: boolean; + }; + }; + subscribe: { + body: DevupObject<'request', 'openapi.json'>['SubscribeRequest'] | FormData; + response?: { + ok?: boolean; + }; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/form' | 'subscribe'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct { + 'openapi.json': { + SubscribeRequest: { + name?: string; + email?: string; + }; + } + } + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles urlencoded request body with inline schema 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPostApiStruct { + 'openapi.json': { + '/form/contact': { + body: { + name?: string; + email?: string; + message?: string; +} | FormData; + response?: {}; + }; + contact: { + body: { + name?: string; + email?: string; + message?: string; +} | FormData; + response?: {}; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/form/contact' | 'contact'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles typed multipart request body with $ref 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPostApiStruct { + 'openapi.json': { + '/typed-form': { + body: DevupObject<'request', 'openapi.json'>['CreateFileUploadRequest'] | FormData; + response?: { + id?: string; + }; + }; + createFileUpload: { + body: DevupObject<'request', 'openapi.json'>['CreateFileUploadRequest'] | FormData; + response?: { + id?: string; + }; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/typed-form' | 'createFileUpload'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct { + 'openapi.json': { + CreateFileUploadRequest: { + name: string; + document?: File | Blob; + tags?: Array; + thumbnail?: File | Blob; + }; + } + } + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles raw multipart with empty object schema 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPostApiStruct { + 'openapi.json': { + '/form/upload': { + body: FormData | Record; + response?: { + url?: string; + }; + }; + upload: { + body: FormData | Record; + response?: { + url?: string; + }; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/form/upload' | 'upload'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct {} + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface handles multipart PUT and PATCH endpoints 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPutApiStruct { + 'openapi.json': { + '/typed-form/{id}': { + params: { + id: string; + }; + body: DevupObject<'request', 'openapi.json'>['UpdateFileUploadRequest'] | FormData; + response?: {}; + }; + updateFileUpload: { + params: { + id: string; + }; + body: DevupObject<'request', 'openapi.json'>['UpdateFileUploadRequest'] | FormData; + response?: {}; + }; + } + } + + interface DevupPatchApiStruct { + 'openapi.json': { + '/typed-form/{id}': { + params: { + id: string; + }; + body: DevupObject<'request', 'openapi.json'>['PatchFileUploadRequest'] | FormData; + response?: {}; + }; + patchFileUpload: { + params: { + id: string; + }; + body: DevupObject<'request', 'openapi.json'>['PatchFileUploadRequest'] | FormData; + response?: {}; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: never; + put: '/typed-form/{id}' | 'updateFileUpload'; + delete: never; + patch: '/typed-form/{id}' | 'patchFileUpload'; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: Record; + put: DevupPutApiStruct['openapi.json']; + delete: Record; + patch: DevupPatchApiStruct['openapi.json']; + } + } + + interface DevupRequestComponentStruct { + 'openapi.json': { + UpdateFileUploadRequest: { + name: string; + document?: File | Blob; + }; + PatchFileUploadRequest: { + name?: string; + document?: File | Blob; + }; + } + } + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; + +exports[`generateInterface preserves JSON endpoints alongside form/multipart endpoints 1`] = ` +"import "@devup-api/fetch"; +import type { DevupObject } from "@devup-api/fetch"; + +declare module "@devup-api/fetch" { + interface DevupApiServers { + 'openapi.json': never + } + + interface DevupPostApiStruct { + 'openapi.json': { + '/users': { + body: DevupObject<'request', 'openapi.json'>['CreateUserRequest']; + response?: {}; + }; + createUser: { + body: DevupObject<'request', 'openapi.json'>['CreateUserRequest']; + response?: {}; + }; + '/form': { + body: DevupObject<'request', 'openapi.json'>['SubscribeRequest'] | FormData; + response?: {}; + }; + subscribe: { + body: DevupObject<'request', 'openapi.json'>['SubscribeRequest'] | FormData; + response?: {}; + }; + '/form/upload': { + body: FormData | Record; + response?: {}; + }; + upload: { + body: FormData | Record; + response?: {}; + }; + } + } + + interface DevupPrecomputedMethodKeys { + 'openapi.json': { + get: never; + post: '/users' | 'createUser' | '/form' | 'subscribe' | '/form/upload' | 'upload'; + put: never; + delete: never; + patch: never; + } + } + + interface DevupPrecomputedScopes { + 'openapi.json': { + get: Record; + post: DevupPostApiStruct['openapi.json']; + put: Record; + delete: Record; + patch: Record; + } + } + + interface DevupRequestComponentStruct { + 'openapi.json': { + CreateUserRequest: { + name?: string; + email?: string; + }; + SubscribeRequest: { + name?: string; + email?: string; + }; + } + } + + interface DevupResponseComponentStruct {} + + interface DevupErrorComponentStruct {} +}" +`; diff --git a/packages/generator/src/__tests__/__snapshots__/generate-schema.test.ts.snap b/packages/generator/src/__tests__/__snapshots__/generate-schema.test.ts.snap index 2cc5d04..d67a4c2 100644 --- a/packages/generator/src/__tests__/__snapshots__/generate-schema.test.ts.snap +++ b/packages/generator/src/__tests__/__snapshots__/generate-schema.test.ts.snap @@ -1052,3 +1052,74 @@ exports[`extractRequestBody handles requestBody $ref 1`] = ` }, } `; + +exports[`extractRequestBody handles requestBody with application/x-www-form-urlencoded 1`] = ` +{ + "email?": { + "default": undefined, + "type": "string", + }, + "name?": { + "default": undefined, + "type": "string", + }, +} +`; + +exports[`extractRequestBody handles requestBody $ref with application/x-www-form-urlencoded 1`] = ` +{ + "email?": { + "default": undefined, + "type": "string", + }, + "name?": { + "default": undefined, + "type": "string", + }, +} +`; + +exports[`extractRequestBody handles requestBody with multipart/form-data 1`] = ` +{ + "document?": { + "default": undefined, + "type": "File | Blob", + }, + "name?": { + "default": undefined, + "type": "string", + }, +} +`; + +exports[`extractRequestBody handles requestBody $ref with multipart/form-data 1`] = ` +{ + "file?": { + "default": undefined, + "type": "File | Blob", + }, +} +`; + +exports[`extractRequestBody prefers application/json over other content types 1`] = ` +{ + "name?": { + "default": undefined, + "type": "string", + }, +} +`; + +exports[`getTypeFromSchema handles string with format binary 1`] = ` +{ + "default": undefined, + "type": "File | Blob", +} +`; + +exports[`getTypeFromSchema handles nullable string with format binary 1`] = ` +{ + "default": undefined, + "type": "File | Blob | null", +} +`; diff --git a/packages/generator/src/__tests__/convert-case.test.ts b/packages/generator/src/__tests__/convert-case.test.ts index ef1b5e8..300d9d1 100644 --- a/packages/generator/src/__tests__/convert-case.test.ts +++ b/packages/generator/src/__tests__/convert-case.test.ts @@ -13,17 +13,23 @@ test.each([ ['HelloWorld', 'snake', 'hello_world'], ['MyVariableName', 'snake', 'my_variable_name'], ['PascalCaseString', 'snake', 'pascal_case_string'], -])('converts PascalCase to snake_case: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'snake')).toBe(expected) -}) +])( + 'converts PascalCase to snake_case: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'snake')).toBe(expected) + }, +) test.each([ ['helloWorld', 'snake', 'hello_world'], ['myVariableName', 'snake', 'my_variable_name'], ['camelCaseString', 'snake', 'camel_case_string'], -])('converts camelCase to snake_case: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'snake')).toBe(expected) -}) +])( + 'converts camelCase to snake_case: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'snake')).toBe(expected) + }, +) test.each([ ['hello_world', 'camel', 'helloWorld'], @@ -37,17 +43,23 @@ test.each([ ['HelloWorld', 'camel', 'helloWorld'], ['MyVariableName', 'camel', 'myVariableName'], ['PascalCaseString', 'camel', 'pascalCaseString'], -])('converts PascalCase to camelCase: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'camel')).toBe(expected) -}) +])( + 'converts PascalCase to camelCase: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'camel')).toBe(expected) + }, +) test.each([ ['helloWorld', 'camel', 'helloWorld'], ['myVariableName', 'camel', 'myVariableName'], ['camelCaseString', 'camel', 'camelCaseString'], -])('returns camelCase strings unchanged: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'camel')).toBe(expected) -}) +])( + 'returns camelCase strings unchanged: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'camel')).toBe(expected) + }, +) test.each([ ['hello_world', 'pascal', 'HelloWorld'], @@ -61,17 +73,23 @@ test.each([ ['helloWorld', 'pascal', 'HelloWorld'], ['myVariableName', 'pascal', 'MyVariableName'], ['camelCaseString', 'pascal', 'CamelCaseString'], -])('converts camelCase to PascalCase: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'pascal')).toBe(expected) -}) +])( + 'converts camelCase to PascalCase: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'pascal')).toBe(expected) + }, +) test.each([ ['HelloWorld', 'pascal', 'HelloWorld'], ['MyVariableName', 'pascal', 'MyVariableName'], ['PascalCaseString', 'pascal', 'PascalCaseString'], -])('returns PascalCase strings unchanged: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'pascal')).toBe(expected) -}) +])( + 'returns PascalCase strings unchanged: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'pascal')).toBe(expected) + }, +) test.each([ ['hello_world', 'maintain', 'hello_world'], @@ -86,26 +104,35 @@ test.each([ ['hello_world', undefined, 'helloWorld'], ['my_variable_name', undefined, 'myVariableName'], ['snake_case_string', undefined, 'snakeCaseString'], -])('defaults to camelCase when caseType is undefined: %s -> %s', (input, caseType, expected) => { - // biome-ignore lint/suspicious/noExplicitAny: Testing default behavior with undefined caseType - expect(convertCase(input, caseType as any)).toBe(expected) -}) +])( + 'defaults to camelCase when caseType is undefined: %s -> %s', + (input, caseType, expected) => { + // biome-ignore lint/suspicious/noExplicitAny: Testing default behavior with undefined caseType + expect(convertCase(input, caseType as any)).toBe(expected) + }, +) test.each([ ['hello_world', 'helloWorld'], ['my_variable_name', 'myVariableName'], ['snake_case_string', 'snakeCaseString'], -])('defaults to camelCase when caseType is not provided: %s -> %s', (input, expected) => { - expect(convertCase(input)).toBe(expected) -}) +])( + 'defaults to camelCase when caseType is not provided: %s -> %s', + (input, expected) => { + expect(convertCase(input)).toBe(expected) + }, +) test.each([ ['', 'camel', ''], ['a', 'camel', 'a'], ['A', 'camel', 'a'], -])('handles empty string and single characters: %s -> %s', (input, caseType, expected) => { - expect(convertCase(input, caseType as 'camel')).toBe(expected) -}) +])( + 'handles empty string and single characters: %s -> %s', + (input, caseType, expected) => { + expect(convertCase(input, caseType as 'camel')).toBe(expected) + }, +) test.each([ ['hello_world123', 'camel', 'helloWorld123'], @@ -119,7 +146,10 @@ test.each([ ['hello_world', 'invalid', 'hello_world'], ['myVariableName', 'unknown', 'myVariableName'], ['HelloWorld', 'wrong', 'HelloWorld'], -])('default case returns original string for invalid caseType: %s -> %s', (input, caseType, expected) => { - // biome-ignore lint/suspicious/noExplicitAny: Testing default case with invalid caseType values - expect(convertCase(input, caseType as any)).toBe(expected) -}) +])( + 'default case returns original string for invalid caseType: %s -> %s', + (input, caseType, expected) => { + // biome-ignore lint/suspicious/noExplicitAny: Testing default case with invalid caseType values + expect(convertCase(input, caseType as any)).toBe(expected) + }, +) diff --git a/packages/generator/src/__tests__/create-url-map.test.ts b/packages/generator/src/__tests__/create-url-map.test.ts index 9abf887..1a78a27 100644 --- a/packages/generator/src/__tests__/create-url-map.test.ts +++ b/packages/generator/src/__tests__/create-url-map.test.ts @@ -1,5 +1,5 @@ /** biome-ignore-all lint/style/noNonNullAssertion: test code */ -import { expect, test } from 'bun:test' +import { describe, expect, test } from 'bun:test' import type { UrlMapValue } from '@devup-api/core' import type { OpenAPIV3_1 } from 'openapi-types' import { createUrlMap } from '../create-url-map' @@ -10,8 +10,8 @@ test.each([ undefined, 'get_users', { - getUsers: { method: 'GET', url: '/users' }, - '/users': { method: 'GET', url: '/users' }, + getUsers: { GET: { url: '/users' } }, + '/users': { GET: { url: '/users' } }, }, ], [ @@ -19,8 +19,8 @@ test.each([ { convertCase: 'snake' as const }, 'getUsers', { - get_users: { method: 'GET', url: '/users' }, - '/users': { method: 'GET', url: '/users' }, + get_users: { GET: { url: '/users' } }, + '/users': { GET: { url: '/users' } }, }, ], [ @@ -28,8 +28,8 @@ test.each([ { convertCase: 'pascal' as const }, 'get_users', { - GetUsers: { method: 'GET', url: '/users' }, - '/users': { method: 'GET', url: '/users' }, + GetUsers: { GET: { url: '/users' } }, + '/users': { GET: { url: '/users' } }, }, ], [ @@ -37,31 +37,34 @@ test.each([ { convertCase: 'maintain' as const }, 'get_users', { - get_users: { method: 'GET', url: '/users' }, - '/users': { method: 'GET', url: '/users' }, + get_users: { GET: { url: '/users' } }, + '/users': { GET: { url: '/users' } }, }, ], -])('creates url map with %s case conversion', (_, options, operationId, expected) => { - const schema: OpenAPIV3_1.Document = { - openapi: '3.1.0', - info: { title: 'Test API', version: '1.0.0' }, - paths: { - '/users': { - get: { - operationId, - responses: {}, +])( + 'creates url map with %s case conversion', + (_, options, operationId, expected) => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/users': { + get: { + operationId, + responses: {}, + }, }, }, - }, - } + } - const result = createUrlMap({ '': schema }, options) + const result = createUrlMap({ '': schema }, options) - expect(result).toEqual({ '': expected } as Record< - string, - Record - >) -}) + expect(result).toEqual({ '': expected } as Record< + string, + Record + >) + }, +) test('converts path parameters based on convertCase', () => { const schema: OpenAPIV3_1.Document = { @@ -82,12 +85,14 @@ test('converts path parameters based on convertCase', () => { expect(result).toEqual({ '': { getUserPost: { - method: 'GET', - url: '/users/{userId}/posts/{postId}', + GET: { + url: '/users/{userId}/posts/{postId}', + }, }, '/users/{userId}/posts/{postId}': { - method: 'GET', - url: '/users/{userId}/posts/{postId}', + GET: { + url: '/users/{userId}/posts/{postId}', + }, }, }, }) @@ -99,31 +104,38 @@ test.each([ ['put', 'update_user', 'updateUser', 'PUT'], ['delete', 'delete_user', 'deleteUser', 'DELETE'], ['patch', 'patch_user', 'patchUser', 'PATCH'], -])('handles %s HTTP method', (method, operationId, expectedKey, expectedMethod) => { - const schema: OpenAPIV3_1.Document = { - openapi: '3.1.0', - info: { title: 'Test API', version: '1.0.0' }, - paths: { - '/users': { - [method]: { - operationId, - responses: {}, +])( + 'handles %s HTTP method', + (method, operationId, expectedKey, expectedMethod) => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/users': { + [method]: { + operationId, + responses: {}, + }, }, }, - }, - } - - const result = createUrlMap({ '': schema }) - - expect(result['']).toHaveProperty(expectedKey) - expect(result['']![expectedKey]?.method).toBe( - expectedMethod as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', - ) - expect(result['']).toHaveProperty('/users') - expect(result['']!['/users']?.method).toBe( - expectedMethod as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', - ) -}) + } + + const result = createUrlMap({ '': schema }) + + expect(result['']).toHaveProperty(expectedKey) + expect( + result['']![expectedKey]?.[ + expectedMethod as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' + ], + ).toBeDefined() + expect(result['']).toHaveProperty('/users') + expect( + result['']!['/users']?.[ + expectedMethod as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' + ], + ).toBeDefined() + }, +) test('handles operation without operationId', () => { const schema: OpenAPIV3_1.Document = { @@ -143,8 +155,9 @@ test('handles operation without operationId', () => { expect(result).toEqual({ '': { '/users': { - method: 'GET', - url: '/users', + GET: { + url: '/users', + }, }, }, }) @@ -238,12 +251,14 @@ test('skips operations that do not exist', () => { expect(result).toEqual({ '': { getUsers: { - method: 'GET', - url: '/users', + GET: { + url: '/users', + }, }, '/users': { - method: 'GET', - url: '/users', + GET: { + url: '/users', + }, }, }, }) @@ -268,12 +283,14 @@ test('handles complex path with multiple parameters', () => { expect(result).toEqual({ '': { get_user_post_comment: { - method: 'GET', - url: '/api/v1/users/{user_id}/posts/{post_id}/comments/{comment_id}', + GET: { + url: '/api/v1/users/{user_id}/posts/{post_id}/comments/{comment_id}', + }, }, '/api/v1/users/{user_id}/posts/{post_id}/comments/{comment_id}': { - method: 'GET', - url: '/api/v1/users/{user_id}/posts/{post_id}/comments/{comment_id}', + GET: { + url: '/api/v1/users/{user_id}/posts/{post_id}/comments/{comment_id}', + }, }, }, }) @@ -283,29 +300,32 @@ test.each([ ['camel', '/users/{userId}', '/users/{userId}'], ['snake', '/users/{user_id}', '/users/{user_id}'], ['pascal', '/users/{UserId}', '/users/{UserId}'], -])('converts path parameters with %s case: %s', (caseType, expectedPath, expectedUrl) => { - const schema: OpenAPIV3_1.Document = { - openapi: '3.1.0', - info: { title: 'Test API', version: '1.0.0' }, - paths: { - '/users/{user_id}': { - get: { - operationId: 'get_user', - responses: {}, +])( + 'converts path parameters with %s case: %s', + (caseType, expectedPath, expectedUrl) => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/users/{user_id}': { + get: { + operationId: 'get_user', + responses: {}, + }, }, }, - }, - } + } - const result = createUrlMap( - { '': schema }, - { - convertCase: caseType as 'camel' | 'snake' | 'pascal', - }, - ) + const result = createUrlMap( + { '': schema }, + { + convertCase: caseType as 'camel' | 'snake' | 'pascal', + }, + ) - expect(result[''][expectedPath]?.url).toBe(expectedUrl) -}) + expect(result[''][expectedPath]?.GET?.url).toBe(expectedUrl) + }, +) test.each([ ['camel', 'getUserList'], @@ -334,3 +354,267 @@ test.each([ expect(result['']).toHaveProperty(expectedKey) }) + +describe('bodyType emission', () => { + test('emits bodyType: form for application/x-www-form-urlencoded endpoint', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/form': { + post: { + operationId: 'subscribe', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + $ref: '#/components/schemas/SubscribeRequest', + }, + }, + }, + }, + responses: {}, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + expect(result['']!.subscribe!.POST).toEqual({ + url: '/form', + bodyType: 'form', + }) + expect(result['']!['/form']!.POST).toEqual({ + url: '/form', + bodyType: 'form', + }) + }) + + test('emits bodyType: multipart for multipart/form-data endpoint', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/upload': { + post: { + operationId: 'upload_file', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + type: 'object', + }, + }, + }, + }, + responses: {}, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + expect(result['']!.uploadFile!.POST).toEqual({ + url: '/upload', + bodyType: 'multipart', + }) + expect(result['']!['/upload']!.POST).toEqual({ + url: '/upload', + bodyType: 'multipart', + }) + }) + + test('does NOT emit bodyType for application/json endpoint', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/users': { + post: { + operationId: 'create_user', + requestBody: { + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/CreateUserRequest', + }, + }, + }, + }, + responses: {}, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + expect(result['']!.createUser!.POST).toEqual({ + url: '/users', + }) + expect(result['']!.createUser!.POST).not.toHaveProperty('bodyType') + expect(result['']!['/users']!.POST).not.toHaveProperty('bodyType') + }) + + test('does NOT emit bodyType for GET endpoint without requestBody', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/users': { + get: { + operationId: 'get_users', + responses: {}, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + expect(result['']!.getUsers!.GET).toEqual({ + url: '/users', + }) + expect(result['']!.getUsers!.GET).not.toHaveProperty('bodyType') + }) + + test('resolves $ref in requestBody to detect content type', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/form': { + post: { + operationId: 'submit_form', + requestBody: { + $ref: '#/components/requestBodies/FormBody', + }, + responses: {}, + }, + }, + }, + components: { + requestBodies: { + FormBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + type: 'object', + properties: { + name: { type: 'string' }, + }, + }, + }, + }, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + expect(result['']!.submitForm!.POST).toEqual({ + url: '/form', + bodyType: 'form', + }) + }) + + test('resolves $ref in requestBody for multipart content type', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/upload': { + post: { + operationId: 'upload_file', + requestBody: { + $ref: '#/components/requestBodies/UploadBody', + }, + responses: {}, + }, + }, + }, + components: { + requestBodies: { + UploadBody: { + content: { + 'multipart/form-data': { + schema: { + type: 'object', + }, + }, + }, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + expect(result['']!.uploadFile!.POST).toEqual({ + url: '/upload', + bodyType: 'multipart', + }) + }) + + test('handles mixed endpoints with different body types', () => { + const schema: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/users': { + post: { + operationId: 'create_user', + requestBody: { + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/User' }, + }, + }, + }, + responses: {}, + }, + }, + '/form': { + post: { + operationId: 'subscribe', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { $ref: '#/components/schemas/SubscribeRequest' }, + }, + }, + }, + responses: {}, + }, + }, + '/upload': { + post: { + operationId: 'upload_file', + requestBody: { + content: { + 'multipart/form-data': { + schema: { type: 'object' }, + }, + }, + }, + responses: {}, + }, + }, + }, + } + + const result = createUrlMap({ '': schema }) + + // JSON endpoint: no bodyType + expect(result['']!.createUser!.POST).not.toHaveProperty('bodyType') + // Form endpoint: bodyType = 'form' + expect(result['']!.subscribe!.POST!.bodyType).toBe('form') + // Multipart endpoint: bodyType = 'multipart' + expect(result['']!.uploadFile!.POST!.bodyType).toBe('multipart') + }) +}) + +// getBodyType is now internal (not exported) — tested indirectly through createUrlMap tests above diff --git a/packages/generator/src/__tests__/generate-interface.test.ts b/packages/generator/src/__tests__/generate-interface.test.ts index 044c837..b3a062c 100644 --- a/packages/generator/src/__tests__/generate-interface.test.ts +++ b/packages/generator/src/__tests__/generate-interface.test.ts @@ -3,6 +3,14 @@ import { expect, test } from 'bun:test' import type { OpenAPIV3_1 } from 'openapi-types' import { generateInterface } from '../generate-interface' +test('omits precomputed mappings when no OpenAPI documents are supplied', () => { + const output = generateInterface({}) + + expect(output).toContain('interface DevupApiServers') + expect(output).not.toContain('interface DevupPrecomputedMethodKeys') + expect(output).not.toContain('interface DevupPrecomputedScopes') +}) + const createDocument = ( document: Partial = {}, ): OpenAPIV3_1.Document => @@ -89,25 +97,128 @@ test.each([ expect( generateInterface(createSchemas(createDocument(schema as any))), ).toMatchSnapshot() +}) + +// Test nullable properties (OpenAPI 3.0 style) +test('generateInterface handles nullable properties (OpenAPI 3.0 style)', () => { + const schema = { + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + name: { type: 'string', nullable: true }, + age: { type: 'number', nullable: true }, + active: { type: 'boolean', nullable: true }, + tags: { + type: 'array', + items: { type: 'string' }, + nullable: true, + }, + metadata: { + type: 'object', + nullable: true, + properties: { + key: { type: 'string' }, + }, + }, + status: { + type: 'string', + enum: ['active', 'inactive'], + nullable: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } expect( - generateInterface(createSchemas(createDocument(schema as any)), { - convertCase: 'pascal', - }), - ).toMatchSnapshot() - expect( - generateInterface(createSchemas(createDocument(schema as any)), { - convertCase: 'snake', - }), + generateInterface(createSchemas(createDocument(schema as any))), ).toMatchSnapshot() +}) + +// Test nullable properties (OpenAPI 3.1 style with type array) +test('generateInterface handles nullable properties (OpenAPI 3.1 style)', () => { + const schema = { + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + name: { type: ['string', 'null'] }, + age: { type: ['number', 'null'] }, + active: { type: ['boolean', 'null'] }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } expect( - generateInterface(createSchemas(createDocument(schema as any)), { - convertCase: 'camel', - }), + generateInterface(createSchemas(createDocument(schema as any))), ).toMatchSnapshot() +}) + +// Test nullable in component schemas +test('generateInterface handles nullable in component schemas', () => { + const schema = { + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/User', + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + User: { + type: 'object', + properties: { + id: { type: 'string' }, + nickname: { type: 'string', nullable: true }, + bio: { type: ['string', 'null'] }, + }, + }, + }, + }, + } expect( - generateInterface(createSchemas(createDocument(schema as any)), { - convertCase: 'maintain', - }), + generateInterface(createSchemas(createDocument(schema as any))), ).toMatchSnapshot() }) @@ -1691,3 +1802,793 @@ test('generateInterface handles error response $ref that extracts schema name', generateInterface(createSchemas(createDocument(schema as any))), ).toMatchSnapshot() }) + +// Test inline response with nested $ref containing enums +// This ensures enum names are derived from the referenced schema, not context path +test('generateInterface handles inline response with nested $ref containing enums', () => { + const schema = { + paths: { + '/items': { + get: { + operationId: 'listItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + items: { + type: 'array', + items: { + $ref: '#/components/schemas/ItemResponse', + }, + }, + page: { type: 'number' }, + }, + }, + }, + }, + }, + }, + }, + }, + '/other-items': { + get: { + operationId: 'listOtherItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + items: { + type: 'array', + items: { + $ref: '#/components/schemas/OtherItemResponse', + }, + }, + page: { type: 'number' }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + ItemResponse: { + type: 'object', + properties: { + id: { type: 'number' }, + status: { + $ref: '#/components/schemas/ItemStatus', + }, + }, + }, + OtherItemResponse: { + type: 'object', + properties: { + id: { type: 'number' }, + status: { + $ref: '#/components/schemas/OtherStatus', + }, + }, + }, + ItemStatus: { + type: 'string', + enum: ['draft', 'published', 'archived'], + }, + OtherStatus: { + type: 'string', + enum: ['pending', 'approved', 'rejected'], + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Verify enum names are derived from schema names, not context path + expect(result).toContain('type ItemStatus =') + expect(result).toContain('type OtherStatus =') + // Should NOT contain ResponseItemsStatus (wrong context-based name) + expect(result).not.toContain('type ResponseItemsStatus =') + // Verify that nested $ref uses DevupObject reference instead of inline expansion + expect(result).toContain( + "DevupObject<'response', 'openapi.json'>['ItemResponse']", + ) + expect(result).toContain( + "DevupObject<'response', 'openapi.json'>['OtherItemResponse']", + ) +}) + +// Test circular reference handling in collectSchemaNames (line 83 coverage) +test('generateInterface handles circular references in schema collection', () => { + const schema = { + paths: { + '/nodes': { + get: { + operationId: 'listNodes', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + $ref: '#/components/schemas/TreeNode', + }, + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + TreeNode: { + type: 'object', + properties: { + id: { type: 'number' }, + name: { type: 'string' }, + // Circular reference - children contains TreeNode + children: { + type: 'array', + items: { + $ref: '#/components/schemas/TreeNode', + }, + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Should not cause infinite loop and should generate valid output + expect(result).toContain('TreeNode') +}) + +// Test request schema with inline enum (lines 659-661 coverage) +test('generateInterface handles request schema with inline enum', () => { + const schema = { + paths: { + '/items': { + post: { + operationId: 'createItem', + requestBody: { + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/CreateItemRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + CreateItemRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + // Inline enum - not a $ref, should be collected during schema processing + priority: { + type: 'string', + enum: ['low', 'medium', 'high'], + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Inline enum should generate type alias based on context + expect(result).toContain('type CreateItemRequestPriority =') + expect(result).toContain('"low"') +}) + +// Test error schema with inline enum (lines 705-707 coverage) +test('generateInterface handles response with non-JSON content type only', () => { + const schema = { + paths: { + '/files/{id}': { + get: { + operationId: 'downloadFile', + parameters: [ + { + name: 'id', + in: 'path', + required: true, + schema: { type: 'string' }, + }, + ], + responses: { + '200': { + description: 'File content', + content: { + 'text/plain': { + schema: { type: 'string' }, + }, + }, + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Should not have a typed response since there's no application/json + expect(result).not.toContain("DevupObject<'response'") +}) + +test('generateInterface handles response schema with inline enum', () => { + const schema = { + paths: { + '/items': { + get: { + operationId: 'listItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/ItemResponse', + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + ItemResponse: { + type: 'object', + properties: { + name: { type: 'string' }, + status: { + type: 'string', + enum: ['active', 'inactive', 'archived'], + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Inline enum in response schema should generate type alias + expect(result).toContain('type ItemResponseStatus =') + expect(result).toContain('"active"') +}) + +test('generateInterface handles error schema with inline enum', () => { + const schema = { + paths: { + '/items': { + get: { + operationId: 'getItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/ErrorResponse', + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + ErrorResponse: { + type: 'object', + properties: { + message: { type: 'string' }, + // Inline enum - not a $ref, should be collected during schema processing + code: { + type: 'string', + enum: ['INVALID_INPUT', 'NOT_FOUND', 'UNAUTHORIZED'], + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Inline enum should generate type alias based on context + expect(result).toContain('type ErrorResponseCode =') + expect(result).toContain('"INVALID_INPUT"') +}) + +// Test urlencoded request body with $ref +test('generateInterface handles urlencoded request body with $ref', () => { + const schema = { + paths: { + '/form': { + post: { + operationId: 'subscribe', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + $ref: '#/components/schemas/SubscribeRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { ok: { type: 'boolean' } }, + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + SubscribeRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + email: { type: 'string' }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Should use DevupObject reference for the urlencoded request body + expect(result).toContain( + "DevupObject<'request', 'openapi.json'>['SubscribeRequest']", + ) + // Should generate the request component + expect(result).toContain('SubscribeRequest') +}) + +// Test urlencoded request body with inline schema +test('generateInterface handles urlencoded request body with inline schema', () => { + const schema = { + paths: { + '/form/contact': { + post: { + operationId: 'contact', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + type: 'object', + properties: { + name: { type: 'string' }, + email: { type: 'string' }, + message: { type: 'string' }, + }, + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Should generate body type with string properties + expect(result).toContain('name') + expect(result).toContain('email') + expect(result).toContain('message') +}) + +// Test typed multipart request body with $ref (includes binary fields) +test('generateInterface handles typed multipart request body with $ref', () => { + const schema = { + paths: { + '/typed-form': { + post: { + operationId: 'createFileUpload', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + $ref: '#/components/schemas/CreateFileUploadRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { id: { type: 'string' } }, + }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + CreateFileUploadRequest: { + type: 'object', + required: ['name'], + properties: { + name: { type: 'string' }, + document: { type: 'string', format: 'binary' }, + tags: { type: 'array', items: { type: 'string' } }, + thumbnail: { type: 'string', format: 'binary' }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Should use DevupObject reference for the multipart request body + expect(result).toContain( + "DevupObject<'request', 'openapi.json'>['CreateFileUploadRequest']", + ) + // Should generate request component with binary fields as File | Blob + expect(result).toContain('File | Blob') +}) + +// Test raw multipart (empty object schema) +test('generateInterface handles raw multipart with empty object schema', () => { + const schema = { + paths: { + '/form/upload': { + post: { + operationId: 'upload', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + type: 'object', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { url: { type: 'string' } }, + }, + }, + }, + }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Raw multipart should use FormData | Record + expect(result).toContain('FormData | Record') +}) + +// Test typed multipart PUT and PATCH endpoints +test('generateInterface handles multipart PUT and PATCH endpoints', () => { + const schema = { + paths: { + '/typed-form/{id}': { + put: { + operationId: 'updateFileUpload', + parameters: [ + { + name: 'id', + in: 'path' as const, + required: true, + schema: { type: 'string' as const }, + }, + ], + requestBody: { + content: { + 'multipart/form-data': { + schema: { + $ref: '#/components/schemas/UpdateFileUploadRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + patch: { + operationId: 'patchFileUpload', + parameters: [ + { + name: 'id', + in: 'path' as const, + required: true, + schema: { type: 'string' as const }, + }, + ], + requestBody: { + content: { + 'multipart/form-data': { + schema: { + $ref: '#/components/schemas/PatchFileUploadRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + UpdateFileUploadRequest: { + type: 'object', + required: ['name'], + properties: { + name: { type: 'string' }, + document: { type: 'string', format: 'binary' }, + }, + }, + PatchFileUploadRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + document: { type: 'string', format: 'binary' }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // Should use DevupObject references for both multipart request bodies + expect(result).toContain( + "DevupObject<'request', 'openapi.json'>['UpdateFileUploadRequest']", + ) + expect(result).toContain( + "DevupObject<'request', 'openapi.json'>['PatchFileUploadRequest']", + ) +}) + +// Test that JSON endpoints are unchanged when form/multipart endpoints exist alongside +test('generateInterface preserves JSON endpoints alongside form/multipart endpoints', () => { + const schema = { + paths: { + '/users': { + post: { + operationId: 'createUser', + requestBody: { + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/CreateUserRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + }, + '/form': { + post: { + operationId: 'subscribe', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + $ref: '#/components/schemas/SubscribeRequest', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + }, + '/form/upload': { + post: { + operationId: 'upload', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + type: 'object', + }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + CreateUserRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + email: { type: 'string' }, + }, + }, + SubscribeRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + email: { type: 'string' }, + }, + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + expect(result).toMatchSnapshot() + // JSON endpoint should use DevupObject reference + expect(result).toContain( + "DevupObject<'request', 'openapi.json'>['CreateUserRequest']", + ) + // Urlencoded endpoint should use DevupObject reference + expect(result).toContain( + "DevupObject<'request', 'openapi.json'>['SubscribeRequest']", + ) + // Raw multipart should use FormData | Record + expect(result).toContain('FormData | Record') +}) + +test('generateInterface emits index signature for additionalProperties (not quoted key)', () => { + const schema = { + paths: { + '/news-categories': { + post: { + operationId: 'createNewsCategory', + requestBody: { + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/NewsCategoryCreateRequest', + }, + }, + }, + }, + responses: { + '201': { + description: 'Created', + content: { + 'application/json': { + schema: { type: 'string' as const }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + NewsCategoryCreateRequest: { + type: 'object' as const, + properties: { + title: { + type: 'object' as const, + properties: {}, + required: [], + additionalProperties: { type: 'string' as const }, + }, + }, + required: ['title'], + }, + }, + }, + } + const result = generateInterface(createSchemas(createDocument(schema as any))) + // Must emit a real TS index signature + expect(result).toContain('[key: string]: string') + // Must NOT emit a quoted literal key + expect(result).not.toContain("'[key: string]'") +}) diff --git a/packages/generator/src/__tests__/generate-schema.test.ts b/packages/generator/src/__tests__/generate-schema.test.ts index c7dea1f..6128e0a 100644 --- a/packages/generator/src/__tests__/generate-schema.test.ts +++ b/packages/generator/src/__tests__/generate-schema.test.ts @@ -7,6 +7,7 @@ import { formatTypeValue, getTypeFromSchema, } from '../generate-schema' +import { getRequestBodyContent } from '../openapi-utils' const createDocument = ( document: Partial = {}, @@ -1185,3 +1186,171 @@ test('extractRequestBody handles requestBody with empty content', () => { } as OpenAPIV3_1.RequestBodyObject expect(extractRequestBody(requestBody, createDocument())).toBeUndefined() }) + +// Tests for form-urlencoded content type +test('extractRequestBody handles requestBody with application/x-www-form-urlencoded', () => { + const requestBody = { + content: { + 'application/x-www-form-urlencoded': { + schema: { + type: 'object' as const, + properties: { + name: { type: 'string' as const }, + email: { type: 'string' as const }, + }, + }, + }, + }, + } as OpenAPIV3_1.RequestBodyObject + expect(extractRequestBody(requestBody, createDocument())).toMatchSnapshot() +}) + +test('extractRequestBody handles requestBody $ref with application/x-www-form-urlencoded', () => { + const requestBody = { + $ref: '#/components/requestBodies/SubscribeForm', + } as OpenAPIV3_1.ReferenceObject + const document = { + components: { + requestBodies: { + SubscribeForm: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + type: 'object' as const, + properties: { + name: { type: 'string' as const }, + email: { type: 'string' as const }, + }, + }, + }, + }, + }, + }, + }, + } + expect( + extractRequestBody(requestBody, createDocument(document)), + ).toMatchSnapshot() +}) + +// Tests for multipart/form-data content type +test('extractRequestBody handles requestBody with multipart/form-data', () => { + const requestBody = { + content: { + 'multipart/form-data': { + schema: { + type: 'object' as const, + properties: { + name: { type: 'string' as const }, + document: { type: 'string' as const, format: 'binary' }, + }, + }, + }, + }, + } as OpenAPIV3_1.RequestBodyObject + expect(extractRequestBody(requestBody, createDocument())).toMatchSnapshot() +}) + +test('extractRequestBody handles requestBody $ref with multipart/form-data', () => { + const requestBody = { + $ref: '#/components/requestBodies/FileUpload', + } as OpenAPIV3_1.ReferenceObject + const document = { + components: { + requestBodies: { + FileUpload: { + content: { + 'multipart/form-data': { + schema: { + type: 'object' as const, + properties: { + file: { type: 'string' as const, format: 'binary' }, + }, + }, + }, + }, + }, + }, + }, + } + expect( + extractRequestBody(requestBody, createDocument(document)), + ).toMatchSnapshot() +}) + +// Tests for JSON priority over other content types +test('extractRequestBody prefers application/json over other content types', () => { + const requestBody = { + content: { + 'multipart/form-data': { + schema: { + type: 'object' as const, + properties: { + file: { type: 'string' as const, format: 'binary' }, + }, + }, + }, + 'application/json': { + schema: { + type: 'object' as const, + properties: { + name: { type: 'string' as const }, + }, + }, + }, + }, + } as OpenAPIV3_1.RequestBodyObject + // Should pick JSON content (no binary field) + const result = extractRequestBody(requestBody, createDocument()) + expect(result).toMatchSnapshot() +}) + +// Tests for getRequestBodyContent helper +test('getRequestBodyContent returns undefined for undefined content', () => { + expect(getRequestBodyContent(undefined)).toBeUndefined() +}) + +test('getRequestBodyContent returns json content when available', () => { + const content = { + 'application/json': { schema: { type: 'object' as const } }, + 'multipart/form-data': { schema: { type: 'object' as const } }, + } + expect(getRequestBodyContent(content)).toBe(content['application/json']) +}) + +test('getRequestBodyContent returns urlencoded content when no json', () => { + const content = { + 'application/x-www-form-urlencoded': { + schema: { type: 'object' as const }, + }, + 'multipart/form-data': { schema: { type: 'object' as const } }, + } + expect(getRequestBodyContent(content)).toBe( + content['application/x-www-form-urlencoded'], + ) +}) + +test('getRequestBodyContent returns multipart content when no json or urlencoded', () => { + const content = { + 'multipart/form-data': { schema: { type: 'object' as const } }, + } + expect(getRequestBodyContent(content)).toBe(content['multipart/form-data']) +}) + +test('getRequestBodyContent returns undefined for unsupported content types', () => { + const content = { + 'application/xml': { schema: { type: 'object' as const } }, + } + expect(getRequestBodyContent(content)).toBeUndefined() +}) + +// Tests for format: "binary" in getTypeFromSchema +test('getTypeFromSchema handles string with format binary', () => { + const schema = { type: 'string' as const, format: 'binary' } + expect(getTypeFromSchema(schema, createDocument())).toMatchSnapshot() +}) + +test('getTypeFromSchema handles nullable string with format binary', () => { + const schema = { type: ['string', 'null'] as any, format: 'binary' } + expect(getTypeFromSchema(schema, createDocument())).toMatchSnapshot() +}) diff --git a/packages/generator/src/__tests__/generate-server-actions.test.ts b/packages/generator/src/__tests__/generate-server-actions.test.ts new file mode 100644 index 0000000..6fec471 --- /dev/null +++ b/packages/generator/src/__tests__/generate-server-actions.test.ts @@ -0,0 +1,242 @@ +import { describe, expect, test } from 'bun:test' +import type { OpenAPIV3_1 } from 'openapi-types' +import { + generateServerActionCode, + generateServerActionTypes, +} from '../generate-server-actions' + +const createDocument = ( + doc: Partial = {}, +): OpenAPIV3_1.Document => + ({ + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: {}, + ...doc, + }) as OpenAPIV3_1.Document + +describe('generateServerActionCode', () => { + test('generates top-level server action functions for operationIds by default', () => { + const result = generateServerActionCode( + { + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { '200': { description: 'Success' } }, + }, + post: { + operationId: 'createUser', + responses: { '201': { description: 'Created' } }, + }, + }, + }, + }), + }, + { serverActions: { baseUrl: 'https://api.example.com' } }, + ) + + expect(result).toContain("'use server'") + expect(result).toContain("import { createApi } from '@devup-api/fetch'") + expect(result).toContain( + "import { serializeApiResponse } from '@devup-api/fetch'", + ) + expect(result).toContain("baseUrl: 'https://api.example.com'") + expect(result).toContain('export async function getUsers(') + expect(result).toContain( + "return serializeApiResponse(await api.get('getUsers'", + ) + expect(result).toContain('export async function createUser(') + expect(result).toContain( + "return serializeApiResponse(await api.post('createUser'", + ) + }) + + test('generates actions when serverActions is omitted', () => { + const result = generateServerActionCode({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + }) + + expect(result).toContain("'use server'") + expect(result).toContain('export async function getUsers') + expect(result).toContain('DevupGetApiStructScope') + expect(result).not.toContain('DevupPostApiStructScope') + }) + + test('does not generate actions when serverActions is explicitly disabled', () => { + const result = generateServerActionCode( + { + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + }, + { serverActions: false }, + ) + + expect(result).toContain("'use server'") + expect(result).not.toContain('export async function getUsers') + expect(result).not.toContain('import ') + expect(result).toContain('export {}') + }) + + test('does not generate actions when serverActions object is disabled', () => { + const result = generateServerActionCode( + { + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + }, + { serverActions: { enabled: false } }, + ) + + expect(result).toContain("'use server'") + expect(result).not.toContain('export async function getUsers') + expect(result).not.toContain('import ') + expect(result).toContain('export {}') + }) + + test('generates all operationIds with empty serverActions config', () => { + const result = generateServerActionCode( + { + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { '200': { description: 'Success' } }, + }, + post: { + operationId: 'createUser', + responses: { '201': { description: 'Created' } }, + }, + }, + '/users/{id}': { + delete: { + operationId: 'deleteUser', + responses: { '204': { description: 'Deleted' } }, + }, + }, + }, + }), + }, + { + serverActions: {}, + }, + ) + + expect(result).toContain('export async function getUsers') + expect(result).toContain('export async function createUser') + expect(result).toContain('export async function deleteUser') + }) + + test('uses serverName when generating actions for non-default schemas', () => { + const result = generateServerActionCode( + { + 'admin.json': createDocument({ + paths: { + '/admins': { + get: { + operationId: 'getAdmins', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + }, + undefined, + ) + + expect(result).toContain("serverName: 'admin.json'") + expect(result).toContain( + "return serializeApiResponse(await api.get('getAdmins'", + ) + }) + + test('creates safe action names for invalid and duplicate operationIds', () => { + const result = generateServerActionCode({ + 'openapi.json': createDocument({ + paths: { + '/numeric': { + get: { + operationId: '123NumericUser', + responses: { '200': { description: 'Success' } }, + }, + }, + '/shared': { + get: { + operationId: 'getSharedUser', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + 'admin-api.json': createDocument({ + paths: { + '/shared': { + get: { + operationId: 'getSharedUser', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + }) + + expect(result).toContain('export async function _123numericUser(') + expect(result).toContain('export async function getSharedUser(') + expect(result).toContain( + 'export async function adminApiJson_getSharedUser(', + ) + }) +}) + +describe('generateServerActionTypes', () => { + test('declares the generated server action module', () => { + const result = generateServerActionTypes( + { + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { '200': { description: 'Success' } }, + }, + }, + }, + }), + }, + undefined, + ) + + expect(result).toContain( + "declare module '@devup-api/fetch/server-generated'", + ) + expect(result).toContain('export function getUsers(') + expect(result).toContain('Promise { expect(result).toContain('post') }) - test('handles requestBody with no application/json content', () => { + test('handles requestBody with multipart/form-data content', () => { const result = generateZodSchemas({ 'openapi.json': createDocument({ paths: { @@ -3183,8 +3183,9 @@ describe('generateZodSchemas - inline request body schema', () => { }), }) - // Should handle gracefully when no application/json content + // Should process multipart/form-data content (inline schemas still produce pathSchemas structure) expect(result).toContain('pathSchemas') + expect(result).toContain('postPathSchemas') }) test('handles requestBody with empty content', () => { @@ -4084,3 +4085,215 @@ describe('generateZodSchemas - additional coverage', () => { expect(result).toContain('requestSchemas') }) }) + +// ============================================================================= +// Binary format handling +// ============================================================================= + +describe('generateZodSchemas - binary format handling', () => { + test('generates z.instanceof(File) for format: binary in runtime schemas', () => { + const result = generateZodSchemas({ + 'openapi.json': createDocument({ + paths: { + '/upload': { + post: { + operationId: 'uploadFile', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + $ref: '#/components/schemas/FileUpload', + }, + }, + }, + }, + responses: { '200': { description: 'Success' } }, + }, + }, + }, + components: { + schemas: { + FileUpload: { + type: 'object', + properties: { + name: { type: 'string' }, + document: { type: 'string', format: 'binary' }, + }, + required: ['name'], + }, + }, + }, + }), + }) + + expect(result).toContain('requestSchemas') + expect(result).toContain('z.instanceof(File)') + expect(result).toContain('z.string()') + }) + + test('generates z.ZodType for format: binary in type declarations', () => { + const result = generateZodTypeDeclarations({ + 'openapi.json': createDocument({ + paths: { + '/upload': { + post: { + operationId: 'uploadFile', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + $ref: '#/components/schemas/FileUpload', + }, + }, + }, + }, + responses: { '200': { description: 'Success' } }, + }, + }, + }, + components: { + schemas: { + FileUpload: { + type: 'object', + properties: { + name: { type: 'string' }, + document: { type: 'string', format: 'binary' }, + }, + required: ['name'], + }, + }, + }, + }), + }) + + expect(result).toContain('z.ZodType') + expect(result).toContain('z.ZodString') + }) +}) + +// ============================================================================= +// Content type support in request body schema collection +// ============================================================================= + +describe('generateZodSchemas - multi content type support', () => { + test('collects schema names from application/x-www-form-urlencoded', () => { + const result = generateZodSchemas({ + 'openapi.json': createDocument({ + paths: { + '/form': { + post: { + operationId: 'submitForm', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + $ref: '#/components/schemas/FormInput', + }, + }, + }, + }, + responses: { '200': { description: 'Success' } }, + }, + }, + }, + components: { + schemas: { + FormInput: { + type: 'object', + properties: { + name: { type: 'string' }, + email: { type: 'string', format: 'email' }, + }, + required: ['name', 'email'], + }, + }, + }, + }), + }) + + expect(result).toContain('requestSchemas') + expect(result).toContain('FormInput') + }) + + test('collects schema names from multipart/form-data with $ref', () => { + const result = generateZodSchemas({ + 'openapi.json': createDocument({ + paths: { + '/upload': { + post: { + operationId: 'createUpload', + requestBody: { + content: { + 'multipart/form-data': { + schema: { + $ref: '#/components/schemas/UploadRequest', + }, + }, + }, + }, + responses: { '200': { description: 'Success' } }, + }, + }, + }, + components: { + schemas: { + UploadRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + file: { type: 'string', format: 'binary' }, + }, + required: ['name', 'file'], + }, + }, + }, + }), + }) + + expect(result).toContain('requestSchemas') + expect(result).toContain('UploadRequest') + expect(result).toContain('z.instanceof(File)') + }) + + test('getRequestBodySchemaName returns schema name for urlencoded body', () => { + const result = generateZodSchemas({ + 'openapi.json': createDocument({ + paths: { + '/subscribe': { + post: { + operationId: 'subscribe', + requestBody: { + content: { + 'application/x-www-form-urlencoded': { + schema: { + $ref: '#/components/schemas/SubscribeRequest', + }, + }, + }, + }, + responses: { '200': { description: 'Success' } }, + }, + }, + }, + components: { + schemas: { + SubscribeRequest: { + type: 'object', + properties: { + name: { type: 'string' }, + email: { type: 'string' }, + }, + required: ['name', 'email'], + }, + }, + }, + }), + }) + + // pathSchemas should map subscribe to SubscribeRequest schema + expect(result).toContain('requestSchemas') + expect(result).toContain('SubscribeRequest') + expect(result).toContain('pathSchemas') + expect(result).toContain('subscribe') + }) +}) diff --git a/packages/generator/src/__tests__/generated-client-compile.test.ts b/packages/generator/src/__tests__/generated-client-compile.test.ts new file mode 100644 index 0000000..a4006f4 --- /dev/null +++ b/packages/generator/src/__tests__/generated-client-compile.test.ts @@ -0,0 +1,165 @@ +import { describe, test } from 'bun:test' +import { + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmdirSync, + unlinkSync, + writeFileSync, +} from 'node:fs' +import { createRequire } from 'node:module' +import path from 'node:path' +import type { DevupApiOptions } from '@devup-api/core' +import type { OpenAPIV3_1 } from 'openapi-types' +import { generateInterface } from '../generate-interface' +import { + generateServerActionCode, + generateServerActionTypes, +} from '../generate-server-actions' + +const require = createRequire(import.meta.url) +const typescriptManifest = require.resolve('typescript/package.json') +const typescript = JSON.parse(readFileSync(typescriptManifest, 'utf8')) +const compiler = path.resolve( + path.dirname(typescriptManifest), + typescript.bin.tsc, +) +// Resolve @devup-api/fetch through its package self-reference in the fixture. +const cacheRoot = path.resolve(import.meta.dirname, '../../../fetch/.cache') + +function checkGeneratedClient(options?: DevupApiOptions, operationId = true) { + const nullable = { + anyOf: [ + { $ref: '#/components/schemas/ServiceType' }, + { type: 'null' as const }, + ], + } + const schemas: Record = { + 'openapi.json': { + openapi: '3.1.0', + info: { title: 'Nullable request', version: '1.0.0' }, + paths: { + '/inputs': { + post: { + ...(operationId ? { operationId: 'createInput' } : {}), + requestBody: { + required: true, + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/Input' }, + }, + }, + }, + responses: { '200': { description: 'Success' } }, + }, + }, + }, + components: { + schemas: { + ServiceType: { type: 'string', enum: ['B', 'E'] }, + Input: { + type: 'object', + required: ['requiredServiceType', 'nonNullable'], + properties: { + serviceType: nullable, + requiredServiceType: nullable, + nonNullable: { $ref: '#/components/schemas/ServiceType' }, + }, + }, + }, + }, + }, + } + mkdirSync(cacheRoot, { recursive: true }) + const directory = mkdtempSync(path.join(cacheRoot, 'generated-client-')) + const files = { + 'api.d.ts': generateInterface(schemas, options), + 'server.ts': generateServerActionCode(schemas, options), + 'server-module.d.ts': generateServerActionTypes(schemas, options), + 'client.ts': `import { createApi, type DevupObject } from '@devup-api/fetch' +type Input = DevupObject<'request'>['Input'] +export const input: Input = { serviceType: null, requiredServiceType: null, nonNullable: 'B' } +export const api = createApi('https://example.invalid') +export function checkTypes() { + void api.post('/inputs', { body: input }) + void api.post('/inputs', { body: { requiredServiceType: 'E', nonNullable: 'B' } }) + // @ts-expect-error values outside the enum must remain invalid + const badValue: Input = { ...input, serviceType: 'INVALID' } + // @ts-expect-error a required nullable field must still be present + const missing: Input = { nonNullable: 'B' } + // @ts-expect-error null must remain invalid on non-nullable references + const badNull: Input = { ...input, nonNullable: null } + void [badValue, missing, badNull] +} +`, + 'runtime.ts': `import { expect, spyOn } from 'bun:test' +import { api, input } from './client' +const fetcher = spyOn(globalThis, 'fetch').mockResolvedValue(Response.json({ ok: true })) +await api.post('/inputs', { body: input }) +expect(fetcher).toHaveBeenCalledTimes(1) +const request = fetcher.mock.calls[0]?.[0] +if (!(request instanceof Request)) throw new Error('Expected a Request') +expect(request.url).toBe('https://example.invalid/inputs') +expect(await request.json()).toEqual({ serviceType: null, requiredServiceType: null, nonNullable: 'B' }) +fetcher.mockRestore() +`, + 'tsconfig.json': JSON.stringify({ + compilerOptions: { + target: 'ESNext', + module: 'ESNext', + moduleResolution: 'bundler', + lib: ['ESNext', 'DOM'], + types: [], + strict: true, + noEmit: true, + noUnusedLocals: true, + noUnusedParameters: true, + skipLibCheck: true, + }, + files: ['api.d.ts', 'client.ts', 'server.ts', 'server-module.d.ts'], + }), + } + try { + for (const [file, content] of Object.entries(files)) { + writeFileSync(path.join(directory, file), content) + } + for (const command of [ + [ + process.execPath, + compiler, + '--project', + path.join(directory, 'tsconfig.json'), + ], + [process.execPath, path.join(directory, 'runtime.ts')], + ]) { + const result = Bun.spawnSync(command, { cwd: directory, timeout: 20_000 }) + if (result.exitCode !== 0) { + throw new Error( + `${result.stdout.toString()}\n${result.stderr.toString()}`, + ) + } + } + } finally { + for (const file of Object.keys(files)) { + const target = path.join(directory, file) + if (existsSync(target)) unlinkSync(target) + } + rmdirSync(directory) + } +} + +describe('generated client compatibility', () => { + test.each([false, { enabled: false }] as const)( + 'compiles disabled server actions without unused imports: %j', + (serverActions) => checkGeneratedClient({ serverActions }), + ) + + test('compiles generated actions with only the used method scopes', () => { + checkGeneratedClient() + }) + + test('compiles an empty action module when operations have no operationId', () => { + checkGeneratedClient(undefined, false) + }) +}) diff --git a/packages/generator/src/__tests__/index.test.ts b/packages/generator/src/__tests__/index.test.ts index 20f6fb5..cde9a88 100644 --- a/packages/generator/src/__tests__/index.test.ts +++ b/packages/generator/src/__tests__/index.test.ts @@ -15,9 +15,29 @@ test('index.ts exports', () => { extractPathParams: expect.any(Function), generateCrudConfigCode: expect.any(Function), generateCrudConfigTypes: expect.any(Function), + // Server Action generation + generateServerActionCode: expect.any(Function), + generateServerActionTypes: expect.any(Function), parseCrudConfigs: expect.any(Function), parseCrudConfigsFromMultiple: expect.any(Function), parseDevupOperations: expect.any(Function), parseDevupTag: expect.any(Function), + // OpenAPI utilities + CONTENT_TYPE_PRIORITY: [ + 'application/json', + 'application/x-www-form-urlencoded', + 'multipart/form-data', + ], + resolveRef: expect.any(Function), + getRequestBodyContent: expect.any(Function), + extractSchemaNameFromRef: expect.any(Function), + normalizeServerName: expect.any(Function), + isErrorStatusCode: expect.any(Function), + isNullableSchema: expect.any(Function), + isNullTypeSchema: expect.any(Function), + splitNullableUnion: expect.any(Function), + normalizeNullableUnion: expect.any(Function), + getPrimaryType: expect.any(Function), + collectSchemaNames: expect.any(Function), }) }) diff --git a/packages/generator/src/__tests__/nullable-ref.test.ts b/packages/generator/src/__tests__/nullable-ref.test.ts new file mode 100644 index 0000000..3ed9b99 --- /dev/null +++ b/packages/generator/src/__tests__/nullable-ref.test.ts @@ -0,0 +1,142 @@ +import { describe, expect, test } from 'bun:test' +import type { OpenAPIV3_1 } from 'openapi-types' +import { generateInterface } from '../generate-interface' +import { + createSchemaContext, + formatTypeValue, + getTypeFromSchema, +} from '../generate-schema' + +const reference = { $ref: '#/components/schemas/ServiceType' } +const nullable = { anyOf: [reference, { type: 'null' as const }] } + +const document: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Nullable enum reference', version: '1.0.0' }, + paths: { + '/inputs': { + post: { + requestBody: { + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/Input' }, + }, + }, + }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/Input' }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + ServiceType: { type: 'string', enum: ['B', 'E'] }, + Item: { type: 'object', properties: { id: { type: 'string' } } }, + Input: { + type: 'object', + required: ['requiredServiceType'], + properties: { + serviceType: nullable, + requiredServiceType: nullable, + nonNullable: reference, + }, + }, + }, + }, +} + +describe('nullable references', () => { + test('uses the referenced enum name without leaking the caller context', () => { + const context = createSchemaContext('Wrapper') + context.propertyPath.push('parent') + + const result = getTypeFromSchema(nullable, document, { + context, + propertyName: 'selected', + }) + + expect(formatTypeValue(result.type)).toBe('ServiceType | null') + expect(context.schemaName).toBe('Wrapper') + expect(context.propertyPath).toEqual(['parent']) + expect([...context.enums.keys()]).toEqual(['ServiceType']) + expect(context.enums.get('ServiceType')?.nullable).toBe(true) + }) + + test.each([false, true])( + 'preserves optional and required enum nullability with requestDefaultNonNullable=%s', + (requestDefaultNonNullable) => { + const output = generateInterface( + { 'openapi.json': document }, + { requestDefaultNonNullable }, + ) + // Both request and response component types must preserve the contract. + expect(output.match(/serviceType\?: ServiceType \| null/g)).toHaveLength( + 2, + ) + expect( + output.match(/requiredServiceType: ServiceType \| null/g), + ).toHaveLength(2) + expect(output.match(/nonNullable\?: ServiceType;/g)).toHaveLength(2) + }, + ) + + test.each(['anyOf', 'oneOf'] as const)( + 'preserves %s nullability when resolving a reference inline', + (keyword) => { + const { type } = getTypeFromSchema( + { [keyword]: [reference, { type: 'null' }] }, + document, + ) + expect(formatTypeValue(type)).toBe('"B" | "E" | null') + }, + ) + + for (const componentType of ['request', 'response', 'error'] as const) { + test(`${componentType} references preserve enum and object nullability`, () => { + const options = { + serverName: 'openapi.json', + componentType, + usedSchemaNames: new Set(['ServiceType', 'Item']), + } + expect( + formatTypeValue(getTypeFromSchema(nullable, document, options).type), + ).toBe('ServiceType | null') + expect( + formatTypeValue( + getTypeFromSchema( + { + oneOf: [{ $ref: '#/components/schemas/Item' }, { type: 'null' }], + }, + document, + options, + ).type, + ), + ).toBe(`DevupObject<'${componentType}', 'openapi.json'>['Item'] | null`) + }) + } + + test('preserves nullability declared on a referenced enum', () => { + const schema = { type: 'string' as const, enum: ['B', 'E'], nullable: true } + const result = getTypeFromSchema( + reference, + { + ...document, + components: { schemas: { ServiceType: schema } }, + }, + { + serverName: 'openapi.json', + componentType: 'request', + usedSchemaNames: new Set(['ServiceType']), + }, + ) + expect(formatTypeValue(result.type)).toBe('ServiceType | null') + }) +}) diff --git a/packages/generator/src/__tests__/nullable-union.test.ts b/packages/generator/src/__tests__/nullable-union.test.ts new file mode 100644 index 0000000..fcac036 --- /dev/null +++ b/packages/generator/src/__tests__/nullable-union.test.ts @@ -0,0 +1,389 @@ +import { describe, expect, test } from 'bun:test' +import type { OpenAPIV3_1 } from 'openapi-types' +import { generateInterface } from '../generate-interface' +import { + generateZodSchemas, + generateZodTypeDeclarations, +} from '../generate-zod' +import { normalizeNullableUnion, splitNullableUnion } from '../openapi-utils' + +// ============================================================================= +// Helpers +// ============================================================================= + +const REF = { $ref: '#/components/schemas/Item' } +const NULL_TYPE = { type: 'null' } +const INLINE_OBJECT = { + type: 'object', + properties: { a: { type: 'string' } }, +} + +/** + * Build a document that exercises `schema` in both a request body position + * (component reference shortcut) and a response property position (inline + * type generation). + */ +const createSchemas = ( + schema: unknown, +): Record => ({ + 'openapi.json': { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/items': { + post: { + operationId: 'createItem', + requestBody: { content: { 'application/json': { schema } } }, + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: { item: schema } }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + Item: { type: 'object', properties: { id: { type: 'string' } } }, + }, + }, + } as unknown as OpenAPIV3_1.Document, +}) + +/** + * Build a document that exercises `schema` as a property of a component + * schema, which is the only position zod schemas are emitted for. + */ +const createComponentSchemas = ( + schema: unknown, +): Record => ({ + 'openapi.json': { + openapi: '3.1.0', + info: { title: 'Test API', version: '1.0.0' }, + paths: { + '/items': { + get: { + operationId: 'getItem', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/Wrapper' }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + Wrapper: { type: 'object', properties: { item: schema } }, + Item: { type: 'object', properties: { id: { type: 'string' } } }, + }, + }, + } as unknown as OpenAPIV3_1.Document, +}) + +/** + * An OpenAPI 3.1 nullable union must generate exactly what the equivalent + * OpenAPI 3.0 `nullable: true` schema generates, on all three paths. + */ +const expectParity = (openapi31: unknown, openapi30: unknown): void => { + for (const build of [createSchemas, createComponentSchemas]) { + expect(generateInterface(build(openapi31))).toBe( + generateInterface(build(openapi30)), + ) + expect(generateZodSchemas(build(openapi31))).toBe( + generateZodSchemas(build(openapi30)), + ) + expect(generateZodTypeDeclarations(build(openapi31))).toBe( + generateZodTypeDeclarations(build(openapi30)), + ) + } +} + +// ============================================================================= +// OpenAPI 3.1 nullable notation: anyOf / oneOf with { type: 'null' } +// ============================================================================= + +describe('nullable $ref union (anyOf: [$ref, { type: "null" }])', () => { + test('matches OpenAPI 3.0 { $ref, nullable: true }', () => { + expectParity({ anyOf: [REF, NULL_TYPE] }, { ...REF, nullable: true }) + }) + + test('matches OpenAPI 3.0 with oneOf notation', () => { + expectParity({ oneOf: [REF, NULL_TYPE] }, { ...REF, nullable: true }) + }) + + test('matches OpenAPI 3.0 with the null member listed first', () => { + expectParity({ anyOf: [NULL_TYPE, REF] }, { ...REF, nullable: true }) + }) + + test('keeps the component reference instead of inlining it', () => { + const result = generateInterface(createSchemas({ anyOf: [REF, NULL_TYPE] })) + + expect(result).toContain( + "body: DevupObject<'request', 'openapi.json'>['Item']", + ) + expect(result).toContain( + "item?: DevupObject<'response', 'openapi.json'>['Item']", + ) + expect(result).not.toContain('unknown)') + }) + + test('keeps the zod request path mapping', () => { + const result = generateZodSchemas( + createSchemas({ anyOf: [REF, NULL_TYPE] }), + ) + + expect(result).toContain('createItem: openapi_json_request_Item') + expect(result).toContain("'/items': openapi_json_request_Item") + }) + + test('keeps the zod lazy reference instead of a union', () => { + const result = generateZodSchemas( + createComponentSchemas({ anyOf: [REF, NULL_TYPE] }), + ) + + expect(result).toContain('z.lazy(() => _Item)') + expect(result).not.toContain('z.union([') + }) + + test('keeps the zod type declaration unwrappable', () => { + const result = generateZodTypeDeclarations( + createComponentSchemas({ anyOf: [REF, NULL_TYPE] }), + ) + + expect(result).toContain('z.ZodLazy') + expect(result).not.toContain('z.ZodUnion<') + }) +}) + +describe('nullable inline union (anyOf: [schema, { type: "null" }])', () => { + test('object member matches OpenAPI 3.0 nullable object', () => { + expectParity( + { anyOf: [INLINE_OBJECT, NULL_TYPE] }, + { ...INLINE_OBJECT, nullable: true }, + ) + }) + + test('object member matches OpenAPI 3.0 with oneOf notation', () => { + expectParity( + { oneOf: [INLINE_OBJECT, NULL_TYPE] }, + { ...INLINE_OBJECT, nullable: true }, + ) + }) + + test('primitive member matches OpenAPI 3.0 nullable primitive', () => { + expectParity( + { anyOf: [{ type: 'string' }, NULL_TYPE] }, + { type: 'string', nullable: true }, + ) + }) + + test('generates a nullable type rather than a union with unknown', () => { + const result = generateInterface( + createSchemas({ anyOf: [{ type: 'string' }, NULL_TYPE] }), + ) + + expect(result).toContain('item?: string | null') + expect(result).not.toContain('unknown') + }) + + test('generates .nullable() rather than z.union in zod', () => { + const result = generateZodSchemas( + createComponentSchemas({ anyOf: [{ type: 'string' }, NULL_TYPE] }), + ) + + expect(result).toContain('z.string().nullable()') + expect(result).not.toContain('z.union([') + }) +}) + +// ============================================================================= +// Genuine unions must not regress +// ============================================================================= + +describe('genuine unions', () => { + const UNION = { anyOf: [{ type: 'string' }, { type: 'number' }] } + + test('stays a union in the generated interface', () => { + expect(generateInterface(createSchemas(UNION))).toContain( + 'item?: (string | number)', + ) + }) + + test('stays z.union in the generated zod schema', () => { + expect(generateZodSchemas(createComponentSchemas(UNION))).toContain( + 'z.union([z.string(), z.number()])', + ) + }) + + test('stays z.ZodUnion in the generated zod type', () => { + expect( + generateZodTypeDeclarations(createComponentSchemas(UNION)), + ).toContain('z.ZodUnion<[z.ZodString, z.ZodNumber]>') + }) + + test('union with a null member stays a union and becomes nullable', () => { + const nullableUnion = { + anyOf: [{ type: 'string' }, { type: 'number' }, NULL_TYPE], + } + + expect(generateInterface(createSchemas(nullableUnion))).toContain( + 'item?: (string | number | null)', + ) + expect(generateZodSchemas(createComponentSchemas(nullableUnion))).toContain( + 'z.union([z.string(), z.number()]).nullable()', + ) + expect( + generateZodTypeDeclarations(createComponentSchemas(nullableUnion)), + ).toContain('z.ZodNullable>') + }) + + test('union with a null member matches OpenAPI 3.0 nullable union', () => { + expectParity( + { anyOf: [{ type: 'string' }, { type: 'number' }, NULL_TYPE] }, + { anyOf: [{ type: 'string' }, { type: 'number' }], nullable: true }, + ) + }) +}) + +// ============================================================================= +// OpenAPI 3.0 input must keep working +// ============================================================================= + +describe('OpenAPI 3.0 nullable input', () => { + test('nullable primitive still generates a nullable type', () => { + const nullableString = { type: 'string', nullable: true } + + expect(generateInterface(createSchemas(nullableString))).toContain( + 'item?: string | null', + ) + expect( + generateZodSchemas(createComponentSchemas(nullableString)), + ).toContain('z.string().nullable()') + }) + + test('nullable $ref still generates the component reference', () => { + expect( + generateInterface(createSchemas({ ...REF, nullable: true })), + ).toContain("body: DevupObject<'request', 'openapi.json'>['Item']") + }) +}) + +// ============================================================================= +// splitNullableUnion / normalizeNullableUnion +// ============================================================================= + +describe('splitNullableUnion', () => { + test('removes { type: "null" } members and reports nullability', () => { + expect( + splitNullableUnion([REF, NULL_TYPE] as OpenAPIV3_1.SchemaObject[]), + ).toEqual({ + members: [REF], + nullable: true, + }) + }) + + test('reports a type array of only null as a null member', () => { + expect( + splitNullableUnion([ + REF, + { type: ['null'] }, + ] as OpenAPIV3_1.SchemaObject[]), + ).toEqual({ members: [REF], nullable: true }) + }) + + test('leaves genuine unions untouched', () => { + const members = [ + { type: 'string' }, + { type: 'number' }, + ] as OpenAPIV3_1.SchemaObject[] + + expect(splitNullableUnion(members)).toEqual({ members, nullable: false }) + }) + + test('does not treat a nullable type array member as a null member', () => { + const members = [ + { type: ['string', 'null'] }, + ] as unknown as OpenAPIV3_1.SchemaObject[] + + expect(splitNullableUnion(members)).toEqual({ members, nullable: false }) + }) + + test('does not treat a $ref member as a null member', () => { + expect(splitNullableUnion([REF] as OpenAPIV3_1.SchemaObject[])).toEqual({ + members: [REF], + nullable: false, + }) + }) +}) + +describe('normalizeNullableUnion', () => { + test('collapses a nullable $ref union to the OpenAPI 3.0 shape', () => { + expect( + normalizeNullableUnion({ + anyOf: [REF, NULL_TYPE], + } as OpenAPIV3_1.SchemaObject), + ).toEqual({ ...REF, nullable: true } as OpenAPIV3_1.SchemaObject) + }) + + test('collapses a nullable oneOf union to the OpenAPI 3.0 shape', () => { + expect( + normalizeNullableUnion({ + oneOf: [INLINE_OBJECT, NULL_TYPE], + } as OpenAPIV3_1.SchemaObject), + ).toEqual({ ...INLINE_OBJECT, nullable: true } as OpenAPIV3_1.SchemaObject) + }) + + test('keeps sibling keywords of the collapsed union', () => { + expect( + normalizeNullableUnion({ + anyOf: [{ type: 'string' }, NULL_TYPE], + description: 'nickname', + default: null, + } as unknown as OpenAPIV3_1.SchemaObject), + ).toEqual({ + type: 'string', + description: 'nickname', + default: null, + nullable: true, + } as unknown as OpenAPIV3_1.SchemaObject) + }) + + test('returns the same schema for a genuine union', () => { + const schema = { + anyOf: [{ type: 'string' }, { type: 'number' }], + } as OpenAPIV3_1.SchemaObject + + expect(normalizeNullableUnion(schema)).toBe(schema) + }) + + test('returns the same schema for a union that keeps two members', () => { + const schema = { + anyOf: [{ type: 'string' }, { type: 'number' }, NULL_TYPE], + } as OpenAPIV3_1.SchemaObject + + expect(normalizeNullableUnion(schema)).toBe(schema) + }) + + test('returns the same schema when there is no union', () => { + const schema = { type: 'string' } as OpenAPIV3_1.SchemaObject + + expect(normalizeNullableUnion(schema)).toBe(schema) + }) + + test('returns the same schema for a reference object', () => { + const schema = REF as OpenAPIV3_1.ReferenceObject + + expect(normalizeNullableUnion(schema)).toBe(schema) + }) +}) diff --git a/packages/generator/src/__tests__/types.test.ts b/packages/generator/src/__tests__/types.test.ts index a5b8f4e..c26a4c2 100644 --- a/packages/generator/src/__tests__/types.test.ts +++ b/packages/generator/src/__tests__/types.test.ts @@ -5,7 +5,11 @@ import { describe, expect, test } from 'bun:test' import type { OpenAPIV3_1 } from 'openapi-types' import { generateInterface } from '../generate-interface' -import { extractParameters, getTypeFromSchema } from '../generate-schema' +import { + createSchemaContext, + extractParameters, + getTypeFromSchema, +} from '../generate-schema' // ============================================================================= // Helper @@ -45,6 +49,51 @@ describe('getTypeFromSchema type conversion', () => { expect(result.type).toBe('"active" | "inactive" | "pending"') }) + test('enum to named type with context', () => { + const schema: OpenAPIV3_1.SchemaObject = { + type: 'string', + enum: ['active', 'inactive', 'pending'], + } + const context = createSchemaContext('User') + context.propertyPath.push('status') + const result = getTypeFromSchema(schema, doc, { + context, + propertyName: undefined, + }) + + // With context, returns the enum type name + expect(result.type).toBe('UserStatus') + // Enum should be registered in context + expect(context.enums.has('UserStatus')).toBe(true) + expect(context.enums.get('UserStatus')?.values).toEqual([ + 'active', + 'inactive', + 'pending', + ]) + }) + + test('enum in nested object with context', () => { + const schema: OpenAPIV3_1.SchemaObject = { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['draft', 'published', 'archived'], + }, + }, + } + const context = createSchemaContext('Post') + const _result = getTypeFromSchema(schema, doc, { context }) + + // Enum should be registered with property path + expect(context.enums.has('PostStatus')).toBe(true) + expect(context.enums.get('PostStatus')?.values).toEqual([ + 'draft', + 'published', + 'archived', + ]) + }) + test('array type conversion', () => { const schema: OpenAPIV3_1.SchemaObject = { type: 'array', @@ -630,3 +679,852 @@ describe('Multi-server support', () => { expect(result).toContain('getAdminUsers') }) }) + +// ============================================================================= +// Enum type generation +// ============================================================================= + +describe('Enum type generation', () => { + test('generates named type alias for enum in response', () => { + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['active', 'inactive', 'pending'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + // Should generate a named type alias for the enum + expect(result).toContain( + 'type ResponseStatus = "active" | "inactive" | "pending"', + ) + // Should use the named type in the interface + expect(result).toContain('status?: ResponseStatus') + }) + + test('generates named type alias for enum in component schema', () => { + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/User' }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + User: { + type: 'object', + properties: { + id: { type: 'string' }, + role: { + type: 'string', + enum: ['admin', 'user', 'guest'], + }, + }, + }, + }, + }, + }), + }) + + // Should generate a named type alias for the enum + expect(result).toContain('type UserRole = "admin" | "user" | "guest"') + // Should use the named type in the component + expect(result).toContain('role?: UserRole') + }) + + test('reuses same enum type for identical values', () => { + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/User' }, + }, + }, + }, + }, + }, + }, + }, + components: { + schemas: { + User: { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['active', 'inactive'], + }, + }, + }, + }, + }, + }), + }) + + // Should only have one type definition (not duplicated) + const matches = result.match(/type UserStatus/g) + expect(matches?.length).toBe(1) + }) + + test('deduplicates enum types across response and error with same name', () => { + // This test covers the branch where enum is already registered (lines 340-342, etc.) + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['success', 'pending'], + }, + }, + }, + }, + }, + }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['success', 'pending'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + // Same enum should only be defined once even if used in both response and error + const matches = result.match(/type (Response|Error)Status/g) + // Should have at most one definition (first one wins) + expect(matches?.length).toBeLessThanOrEqual(2) + }) + + test('handles enum in array response without component ref', () => { + // This covers lines 381-383 (array response with enum, not using component ref) + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/items': { + get: { + operationId: 'getItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + type: 'object', + properties: { + category: { + type: 'string', + enum: ['food', 'drink', 'other'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + expect(result).toContain( + 'type ResponseCategory = "food" | "drink" | "other"', + ) + }) + + test('handles enum in array error response without component ref', () => { + // This covers lines 515-517 (array error with enum, not using component ref) + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/items': { + get: { + operationId: 'getItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + type: 'object', + properties: { + severity: { + type: 'string', + enum: ['warning', 'error', 'critical'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + expect(result).toContain( + 'type ErrorSeverity = "warning" | "error" | "critical"', + ) + }) + + test('handles enum in error response object without component ref', () => { + // This covers lines 536-538 (error object with enum) + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/items': { + get: { + operationId: 'getItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { type: 'object', properties: {} }, + }, + }, + }, + '500': { + description: 'Error', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + errorCode: { + type: 'string', + enum: ['internal', 'timeout', 'unavailable'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + expect(result).toContain( + 'type ErrorErrorCode = "internal" | "timeout" | "unavailable"', + ) + }) + + test('generates enum name from values when no context path', () => { + // This covers generate-schema.ts lines 62-66 (fallback enum naming) + const context = createSchemaContext() // No schema name + // Don't push any property path + + const schema: OpenAPIV3_1.SchemaObject = { + type: 'string', + enum: ['red', 'green', 'blue'], + } + + const result = getTypeFromSchema(schema, createDocument(), { context }) + + // Should generate name from values: RedGreenBlueEnum + expect(result.type).toBe('RedGreenBlueEnum') + expect(context.enums.has('RedGreenBlueEnum')).toBe(true) + }) + + test('deduplicates enums when multiple operations have same enum property name', () => { + // This covers lines 340-342: duplicate enum check when merging from inline context + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['active', 'inactive'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + '/posts': { + get: { + operationId: 'getPosts', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + status: { + type: 'string', + enum: ['active', 'inactive'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + // Should only define the enum once + const matches = result.match(/type ResponseStatus/g) + expect(matches?.length).toBe(1) + }) + + test('deduplicates enums in array responses across operations', () => { + // This covers lines 381-383: duplicate enum in array response + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/items': { + get: { + operationId: 'getItems', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + type: 'object', + properties: { + priority: { + type: 'string', + enum: ['low', 'medium', 'high'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + '/tasks': { + get: { + operationId: 'getTasks', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + type: 'object', + properties: { + priority: { + type: 'string', + enum: ['low', 'medium', 'high'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + // Should only define the enum once + const matches = result.match(/type ResponsePriority/g) + expect(matches?.length).toBe(1) + }) + + test('deduplicates enums in error responses across operations', () => { + // This covers lines 474-476 and 536-538: duplicate enum in error response + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { description: 'Success' }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + level: { + type: 'string', + enum: ['warn', 'error', 'fatal'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + '/posts': { + get: { + operationId: 'getPosts', + responses: { + '200': { description: 'Success' }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + level: { + type: 'string', + enum: ['warn', 'error', 'fatal'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + // Should only define the enum once + const matches = result.match(/type ErrorLevel/g) + expect(matches?.length).toBe(1) + }) + + test('deduplicates enums in array error responses across operations', () => { + // This covers lines 515-517: duplicate enum in array error response + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/items': { + get: { + operationId: 'getItems', + responses: { + '200': { description: 'Success' }, + '422': { + description: 'Validation Error', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + type: 'object', + properties: { + severity: { + type: 'string', + enum: ['info', 'warning', 'error'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + '/orders': { + get: { + operationId: 'getOrders', + responses: { + '200': { description: 'Success' }, + '422': { + description: 'Validation Error', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + type: 'object', + properties: { + severity: { + type: 'string', + enum: ['info', 'warning', 'error'], + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + }) + + // Should only define the enum once + const matches = result.match(/type ErrorSeverity/g) + expect(matches?.length).toBe(1) + }) + + test('handles response with $ref that resolves to schema with enum (non-component ref)', () => { + // This specifically targets lines 340-342: $ref that is not in responseSchemaNames + // We use components.responses which resolves but doesn't go through the normal path + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/status': { + get: { + operationId: 'getStatus', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + // $ref to a response object (not schema) - extractSchemaNameFromRef returns null + $ref: '#/components/responses/StatusResponse', + }, + }, + }, + }, + }, + }, + }, + '/health': { + get: { + operationId: 'getHealth', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + $ref: '#/components/responses/StatusResponse', + }, + }, + }, + }, + }, + }, + }, + }, + components: { + responses: { + StatusResponse: { + type: 'object', + properties: { + state: { + type: 'string', + enum: ['healthy', 'degraded', 'down'], + }, + }, + }, + }, + }, + }), + }) + + // The enum should be generated (may have different name based on resolution) + expect(result).toMatch(/type.*=.*"healthy".*\|.*"degraded".*\|.*"down"/) + }) + + test('handles error response with $ref that resolves to schema with enum (non-component ref)', () => { + // This specifically targets lines 474-476: $ref for error that is not in errorSchemaNames + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/action': { + post: { + operationId: 'doAction', + responses: { + '200': { description: 'Success' }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + $ref: '#/components/responses/ErrorResponse', + }, + }, + }, + }, + }, + }, + }, + '/process': { + post: { + operationId: 'doProcess', + responses: { + '200': { description: 'Success' }, + '400': { + description: 'Error', + content: { + 'application/json': { + schema: { + $ref: '#/components/responses/ErrorResponse', + }, + }, + }, + }, + }, + }, + }, + }, + components: { + responses: { + ErrorResponse: { + type: 'object', + properties: { + errorType: { + type: 'string', + enum: ['validation', 'auth', 'server'], + }, + }, + }, + }, + }, + }), + }) + + expect(result).toMatch(/type.*=.*"validation".*\|.*"auth".*\|.*"server"/) + }) + + test('handles array response with items $ref that is not a component schema', () => { + // This targets lines 381-383: array response with items $ref not in responseSchemaNames + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/logs': { + get: { + operationId: 'getLogs', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + $ref: '#/components/responses/LogEntry', + }, + }, + }, + }, + }, + }, + }, + }, + '/events': { + get: { + operationId: 'getEvents', + responses: { + '200': { + description: 'Success', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + $ref: '#/components/responses/LogEntry', + }, + }, + }, + }, + }, + }, + }, + }, + }, + components: { + responses: { + LogEntry: { + type: 'object', + properties: { + level: { + type: 'string', + enum: ['debug', 'info', 'warn', 'error'], + }, + }, + }, + }, + }, + }), + }) + + expect(result).toMatch( + /type.*=.*"debug".*\|.*"info".*\|.*"warn".*\|.*"error"/, + ) + }) + + test('handles array error response with items $ref that is not a component schema', () => { + // This targets lines 515-517: array error with items $ref not in errorSchemaNames + const result = generateInterface({ + 'openapi.json': createDocument({ + paths: { + '/submit': { + post: { + operationId: 'submit', + responses: { + '200': { description: 'Success' }, + '422': { + description: 'Validation Errors', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + $ref: '#/components/responses/ValidationError', + }, + }, + }, + }, + }, + }, + }, + }, + '/update': { + put: { + operationId: 'update', + responses: { + '200': { description: 'Success' }, + '422': { + description: 'Validation Errors', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + $ref: '#/components/responses/ValidationError', + }, + }, + }, + }, + }, + }, + }, + }, + }, + components: { + responses: { + ValidationError: { + type: 'object', + properties: { + field: { type: 'string' }, + constraint: { + type: 'string', + enum: ['required', 'format', 'range', 'unique'], + }, + }, + }, + }, + }, + }), + }) + + expect(result).toMatch( + /type.*=.*"required".*\|.*"format".*\|.*"range".*\|.*"unique"/, + ) + }) +}) diff --git a/packages/generator/src/__tests__/wrap-interface-key-guard.test.ts b/packages/generator/src/__tests__/wrap-interface-key-guard.test.ts index 6f7ad95..8f3cddf 100644 --- a/packages/generator/src/__tests__/wrap-interface-key-guard.test.ts +++ b/packages/generator/src/__tests__/wrap-interface-key-guard.test.ts @@ -10,48 +10,89 @@ test.each([ ['camelCase', 'camelCase'], ['snake_case', 'snake_case'], ['PascalCase', 'PascalCase'], -] as const)('wrapInterfaceKeyGuard returns key as-is when no slash: %s -> %s', (key, expected) => { - expect(wrapInterfaceKeyGuard(key)).toBe(expected) -}) +] as const)( + 'wrapInterfaceKeyGuard returns key as-is when no slash: %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) test.each([ - ['/users', '[`/users`]'], - ['/users/{id}', '[`/users/{id}`]'], - ['/api/v1/users', '[`/api/v1/users`]'], - ['/users/{userId}/posts/{postId}', '[`/users/{userId}/posts/{postId}`]'], - ['/api/v1/users/{id}/profile', '[`/api/v1/users/{id}/profile`]'], -] as const)('wrapInterfaceKeyGuard wraps key with backticks when slash present: %s -> %s', (key, expected) => { - expect(wrapInterfaceKeyGuard(key)).toBe(expected) -}) + ['/users', "'/users'"], + ['/users/{id}', "'/users/{id}'"], + ['/api/v1/users', "'/api/v1/users'"], + ['/users/{userId}/posts/{postId}', "'/users/{userId}/posts/{postId}'"], + ['/api/v1/users/{id}/profile', "'/api/v1/users/{id}/profile'"], +] as const)( + 'wrapInterfaceKeyGuard wraps key with quotes when slash present: %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) test.each([ ['', ''], - ['/', '[`/`]'], - ['//', '[`//`]'], - ['///', '[`///`]'], -] as const)('wrapInterfaceKeyGuard handles edge cases: %s -> %s', (key, expected) => { - expect(wrapInterfaceKeyGuard(key)).toBe(expected) -}) + ['/', "'/'"], + ['//', "'//'"], + ['///', "'///'"], +] as const)( + 'wrapInterfaceKeyGuard handles edge cases: %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) test.each([ - ['users/123', '[`users/123`]'], - ['test/path/here', '[`test/path/here`]'], - ['a/b/c/d', '[`a/b/c/d`]'], -] as const)('wrapInterfaceKeyGuard wraps key with multiple slashes: %s -> %s', (key, expected) => { - expect(wrapInterfaceKeyGuard(key)).toBe(expected) -}) + ['users/123', "'users/123'"], + ['test/path/here', "'test/path/here'"], + ['a/b/c/d', "'a/b/c/d'"], +] as const)( + 'wrapInterfaceKeyGuard wraps key with multiple slashes: %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) test.each([ - ['field"name', '[`field"name`]'], - ["field'name", "[`field'name`]"], - ['field`name', '[`field`name`]'], - ['field-name', '[`field-name`]'], - ['field name', '[`field name`]'], - ['field@name', '[`field@name`]'], - ['field#name', '[`field#name`]'], + ['field"name', `'field"name'`], + ["field'name", `'field\\'name'`], // single quote needs escaping + ['field`name', "'field`name'"], + ['field-name', "'field-name'"], + ['field name', "'field name'"], + ['field@name', "'field@name'"], + ['field#name', "'field#name'"], ['field$name', 'field$name'], // $ is valid in identifiers ['field_name', 'field_name'], // _ is valid in identifiers - ['123field', '[`123field`]'], // cannot start with number -] as const)('wrapInterfaceKeyGuard wraps key with forbidden characters: %s -> %s', (key, expected) => { - expect(wrapInterfaceKeyGuard(key)).toBe(expected) -}) + ['123field', "'123field'"], // cannot start with number +] as const)( + 'wrapInterfaceKeyGuard wraps key with forbidden characters: %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) + +test.each([ + ['name?', 'name?'], // valid identifier with optional marker + ['email?', 'email?'], // valid identifier with optional marker + ['field_name?', 'field_name?'], // valid identifier with optional marker + ['field-name?', "'field-name'?"], // invalid identifier with optional marker + ['field name?', "'field name'?"], // invalid identifier with optional marker + ['/users?', "'/users'?"], // path with optional marker + ['123field?', "'123field'?"], // starts with number, with optional marker +] as const)( + 'wrapInterfaceKeyGuard handles optional keys (ending with ?): %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) + +test.each([ + ['[key: string]', '[key: string]'], + ['[key: number]', '[key: number]'], + ['[k: string]', '[k: string]'], +] as const)( + 'wrapInterfaceKeyGuard preserves index signature syntax: %s -> %s', + (key, expected) => { + expect(wrapInterfaceKeyGuard(key)).toBe(expected) + }, +) diff --git a/packages/generator/src/create-url-map.ts b/packages/generator/src/create-url-map.ts index 9ee967a..c23da20 100644 --- a/packages/generator/src/create-url-map.ts +++ b/packages/generator/src/create-url-map.ts @@ -1,16 +1,46 @@ -import type { DevupApiTypeGeneratorOptions, UrlMapValue } from '@devup-api/core' +import type { + DevupApiTypeGeneratorOptions, + HttpMethod, + UrlMapEntry, + UrlMapStoredValue, +} from '@devup-api/core' import type { OpenAPIV3_1 } from 'openapi-types' import { convertCase } from './convert-case' +import { resolveRef } from './openapi-utils' + +function getBodyType( + operation: OpenAPIV3_1.OperationObject, + document: OpenAPIV3_1.Document, +): 'form' | 'multipart' | undefined { + const requestBody = operation.requestBody + if (!requestBody) return undefined + + let content: OpenAPIV3_1.RequestBodyObject['content'] | undefined + if ('$ref' in requestBody) { + const resolved = resolveRef( + requestBody.$ref, + document, + ) + content = resolved?.content + } else { + content = requestBody.content + } + + if (!content) return undefined + if (content['application/x-www-form-urlencoded']) return 'form' + if (content['multipart/form-data']) return 'multipart' + return undefined +} export function createUrlMap( schemas: Record, options?: DevupApiTypeGeneratorOptions, -): Record> { +): Record> { const convertCaseType = options?.convertCase ?? 'camel' - const urlMaps: Record> = {} + const urlMaps: Record> = {} for (const [serverName, schema] of Object.entries(schemas)) { - const urlMap: Record = {} + const urlMap: Record = {} for (const [path, pathItem] of Object.entries(schema.paths ?? {})) { if (!pathItem) continue for (const method of ['get', 'post', 'put', 'delete', 'patch'] as const) { @@ -20,25 +50,19 @@ export function createUrlMap( // Convert param name based on case type return `{${convertCase(param, convertCaseType)}}` }) + const bodyType = getBodyType(operation, schema) + const methodKey = method.toUpperCase() as HttpMethod + const value: UrlMapStoredValue = { + url: normalizedPath, + ...(bodyType && { bodyType }), + } if (operation.operationId) { - urlMap[convertCase(operation.operationId, convertCaseType)] = { - method: method.toUpperCase() as - | 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'PATCH', - url: normalizedPath, - } + const opKey = convertCase(operation.operationId, convertCaseType) + urlMap[opKey] = { ...urlMap[opKey], [methodKey]: value } } urlMap[normalizedPath] = { - method: method.toUpperCase() as - | 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'PATCH', - url: normalizedPath, + ...urlMap[normalizedPath], + [methodKey]: value, } } } diff --git a/packages/generator/src/generate-crud-config.ts b/packages/generator/src/generate-crud-config.ts index 7962e70..d7eaa33 100644 --- a/packages/generator/src/generate-crud-config.ts +++ b/packages/generator/src/generate-crud-config.ts @@ -1,16 +1,8 @@ +import { toPascal } from '@devup-api/utils' import type { OpenAPIV3_1 } from 'openapi-types' import type { CrudConfig, CrudField } from './crud-types' import { parseCrudConfigsFromMultiple } from './parse-crud-tags' - -/** - * Convert string to PascalCase for component names - */ -function toPascalCase(str: string): string { - return str - .split(/[-_]/) - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join('') -} +import { wrapInterfaceKeyGuard } from './wrap-interface-key-guard' /** * Convert string to title case for labels @@ -161,7 +153,7 @@ function generateFieldsComponent( */ function generateCrudComponent(name: string, config: CrudConfig): string[] { const lines: string[] = [] - const componentName = `${toPascalCase(name)}Crud` + const componentName = `${toPascal(name)}Crud` const fieldsComponentName = `${componentName}Fields` // Determine edit method and operationId @@ -234,7 +226,7 @@ export function generateCrudConfigCode( // Generate component for each CRUD group for (const [name, config] of Object.entries(configs)) { - const componentName = `${toPascalCase(name)}Crud` + const componentName = `${toPascal(name)}Crud` // Get fields from create endpoint (primary form fields) const fields = config.create.fields ?? [] @@ -258,7 +250,7 @@ export function generateCrudConfigCode( // Default export lines.push('export default {') for (const name of Object.keys(configs)) { - const componentName = `${toPascalCase(name)}Crud` + const componentName = `${toPascal(name)}Crud` lines.push(` ${name}: ${componentName},`) } lines.push('};') @@ -286,7 +278,7 @@ export function generateCrudConfigTypes( lines.push("declare module '@devup-api/ui' {") lines.push(' interface DevupCrudApiNames {') for (const name of apiNames) { - lines.push(` ${name}: true`) + lines.push(` ${wrapInterfaceKeyGuard(name)}: true`) } lines.push(' }') lines.push('}') diff --git a/packages/generator/src/generate-interface.ts b/packages/generator/src/generate-interface.ts index 67d29a4..51c9d09 100644 --- a/packages/generator/src/generate-interface.ts +++ b/packages/generator/src/generate-interface.ts @@ -3,11 +3,22 @@ import { toPascal } from '@devup-api/utils' import type { OpenAPIV3_1 } from 'openapi-types' import { convertCase } from './convert-case' import { + createSchemaContext, + type EnumDefinition, extractParameters, extractRequestBody, formatTypeValue, getTypeFromSchema, } from './generate-schema' +import { + collectSchemaNames, + extractSchemaNameFromRef, + getRequestBodyContent, + isErrorStatusCode, + normalizeNullableUnion, + normalizeServerName, + resolveRef, +} from './openapi-utils' import { wrapInterfaceKeyGuard } from './wrap-interface-key-guard' export interface ParameterDefinition @@ -24,17 +35,113 @@ export interface EndpointDefinition { error?: unknown } -// Helper function to extract schema names from $ref -function extractSchemaNameFromRef(ref: string): string | null { - if (ref.startsWith('#/components/schemas/')) { - return ref.replace('#/components/schemas/', '') +// Extract schema type from a response/error object's JSON content. +// Shared logic for both success response and error response extraction. +function extractContentType( + responseObj: + | OpenAPIV3_1.ResponseObject + | OpenAPIV3_1.ReferenceObject + | undefined, + componentType: 'response' | 'error', + schemaNames: Set, + schema: OpenAPIV3_1.Document, + serverName: string, + enumContext: ReturnType, + options?: DevupApiTypeGeneratorOptions, +): unknown { + if (!responseObj) return undefined + if ('$ref' in responseObj) { + // ResponseObject reference - skip for now + return undefined + } + if (!('content' in responseObj)) return undefined + + const content = responseObj.content + const jsonContent = content?.['application/json'] + if (!jsonContent || !('schema' in jsonContent) || !jsonContent.schema) { + return undefined + } + + const contentSchema = normalizeNullableUnion(jsonContent.schema) + const contextLabel = componentType === 'response' ? 'Response' : 'Error' + const responseDefaultNonNullable = options?.responseDefaultNonNullable ?? true + + const extractInlineType = ( + schemaRef: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, + ): unknown => { + const inlineContext = createSchemaContext(contextLabel) + const { type: schemaType } = getTypeFromSchema(schemaRef, schema, { + defaultNonNullable: responseDefaultNonNullable, + context: inlineContext, + serverName, + componentType, + usedSchemaNames: schemaNames, + }) + for (const [enumName, enumDef] of inlineContext.enums) { + if (!enumContext.enums.has(enumName)) { + enumContext.enums.set(enumName, enumDef) + } + } + return schemaType + } + + // Check if schema is a direct reference to components.schemas + if ('$ref' in contentSchema) { + const schemaName = extractSchemaNameFromRef(contentSchema.$ref) + if ( + schemaName && + schema.components?.schemas?.[schemaName] && + schemaNames.has(schemaName) + ) { + return `DevupObject<'${componentType}', '${serverName}'>['${schemaName}']` + } + return extractInlineType(contentSchema) + } + + // Check if it's an array with items referencing a component schema + const schemaObj = contentSchema as OpenAPIV3_1.SchemaObject + if ( + schemaObj.type === 'array' && + schemaObj.items && + '$ref' in schemaObj.items + ) { + const schemaName = extractSchemaNameFromRef(schemaObj.items.$ref) + if ( + schemaName && + schema.components?.schemas?.[schemaName] && + schemaNames.has(schemaName) + ) { + return `Array['${schemaName}']>` + } + return extractInlineType(contentSchema) } - return null + + // Extract schema type (inline schema) + return extractInlineType(contentSchema) } -// Helper function to normalize server name by removing ./ prefix -function normalizeServerName(serverName: string): string { - return serverName.replace(/^\.\//, '') +/** + * Check if a request body uses form or multipart content type. + */ +function isFormOrMultipartRequestBody( + requestBody: OpenAPIV3_1.RequestBodyObject | OpenAPIV3_1.ReferenceObject, + document: OpenAPIV3_1.Document, +): boolean { + let content: OpenAPIV3_1.RequestBodyObject['content'] | undefined + if ('$ref' in requestBody) { + const resolved = resolveRef( + requestBody.$ref, + document, + ) + content = resolved?.content + } else { + content = requestBody.content + } + if (!content) return false + return ( + content['multipart/form-data'] !== undefined || + content['application/x-www-form-urlencoded'] !== undefined + ) } // Generate interface for a single schema @@ -50,7 +157,10 @@ function generateSchemaInterface( requestComponents: Record responseComponents: Record errorComponents: Record + enumDefinitions: Map } { + // Create context for tracking enums + const enumContext = createSchemaContext() const endpoints: Record< 'get' | 'post' | 'put' | 'delete' | 'patch', Record @@ -63,63 +173,16 @@ function generateSchemaInterface( } as const const convertCaseType = options?.convertCase ?? 'camel' - // Helper function to collect schema names from a schema object - const collectSchemaNames = ( - schemaObj: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, - targetSet: Set, - ): void => { - if ('$ref' in schemaObj) { - const schemaName = extractSchemaNameFromRef(schemaObj.$ref) - if (schemaName) { - targetSet.add(schemaName) - } - return - } - - const schema = schemaObj as OpenAPIV3_1.SchemaObject - - // Check allOf, anyOf, oneOf - if (schema.allOf) { - schema.allOf.forEach((s) => { - collectSchemaNames(s, targetSet) - }) - } - if (schema.anyOf) { - schema.anyOf.forEach((s) => { - collectSchemaNames(s, targetSet) - }) - } - if (schema.oneOf) { - schema.oneOf.forEach((s) => { - collectSchemaNames(s, targetSet) - }) - } - - // Check properties - if (schema.properties) { - Object.values(schema.properties).forEach((prop) => { - collectSchemaNames(prop, targetSet) - }) - } - - // Check items (for arrays) - if (schema.type === 'array' && 'items' in schema && schema.items) { - collectSchemaNames(schema.items, targetSet) - } - } + const collectOpts = { + followComponentRefs: true, + document: schema, + } as const // Track which schemas are used in request body and responses const requestSchemaNames = new Set() const responseSchemaNames = new Set() const errorSchemaNames = new Set() - // Helper function to check if a status code is an error response - const isErrorStatusCode = (statusCode: string): boolean => { - if (statusCode === 'default') return true - const code = parseInt(statusCode, 10) - return code >= 400 && code < 600 - } - // First, collect schema names used in request body and responses if (schema.paths) { for (const pathItem of Object.values(schema.paths)) { @@ -142,9 +205,13 @@ function generateSchemaInterface( } } else { const content = operation.requestBody.content - const jsonContent = content?.['application/json'] - if (jsonContent && 'schema' in jsonContent && jsonContent.schema) { - collectSchemaNames(jsonContent.schema, requestSchemaNames) + const bodyContent = getRequestBodyContent(content) + if (bodyContent && 'schema' in bodyContent && bodyContent.schema) { + collectSchemaNames( + bodyContent.schema, + requestSchemaNames, + collectOpts, + ) } } } @@ -174,9 +241,17 @@ function generateSchemaInterface( jsonContent.schema ) { if (isError) { - collectSchemaNames(jsonContent.schema, errorSchemaNames) + collectSchemaNames( + jsonContent.schema, + errorSchemaNames, + collectOpts, + ) } else { - collectSchemaNames(jsonContent.schema, responseSchemaNames) + collectSchemaNames( + jsonContent.schema, + responseSchemaNames, + collectOpts, + ) } } } @@ -242,13 +317,12 @@ function generateSchemaInterface( } } else { const content = operation.requestBody.content - const jsonContent = content?.['application/json'] - if (jsonContent && 'schema' in jsonContent && jsonContent.schema) { + const bodyContent = getRequestBodyContent(content) + if (bodyContent && 'schema' in bodyContent && bodyContent.schema) { + const bodySchema = normalizeNullableUnion(bodyContent.schema) // Check if schema is a direct reference to components.schemas - if ('$ref' in jsonContent.schema) { - const schemaName = extractSchemaNameFromRef( - jsonContent.schema.$ref, - ) + if ('$ref' in bodySchema) { + const schemaName = extractSchemaNameFromRef(bodySchema.$ref) // Check if schema exists in components.schemas and is used in request body if ( schemaName && @@ -267,24 +341,58 @@ function generateSchemaInterface( } } } else { - const requestBody = extractRequestBody( - operation.requestBody, - schema, - ) - if (requestBody !== undefined) { - requestBodyType = requestBody + // Check for raw multipart: multipart/form-data with empty/generic object schema + const schemaObj = bodySchema as OpenAPIV3_1.SchemaObject + const isMultipart = + content?.['multipart/form-data'] !== undefined && + !content?.['application/json'] && + !content?.['application/x-www-form-urlencoded'] + const isEmptyObject = + schemaObj.type === 'object' && + (!schemaObj.properties || + Object.keys(schemaObj.properties).length === 0) && + !schemaObj.allOf && + !schemaObj.anyOf && + !schemaObj.oneOf + + if (isMultipart && isEmptyObject) { + // Raw multipart with no typed schema + requestBodyType = 'FormData | Record' + } else { + const requestBody = extractRequestBody( + operation.requestBody, + schema, + ) + if (requestBody !== undefined) { + requestBodyType = requestBody + } } } } } } if (requestBodyType !== undefined) { + // For form/multipart endpoints, also allow FormData as body type + if (operation.requestBody) { + const isFormMultipart = isFormOrMultipartRequestBody( + operation.requestBody, + schema, + ) + if (isFormMultipart) { + const bodyStr = + typeof requestBodyType === 'string' + ? requestBodyType + : formatTypeValue(requestBodyType) + if (!bodyStr.includes('FormData')) { + requestBodyType = `${bodyStr} | FormData` + } + } + } endpoint.body = requestBodyType } // Extract response // Check if response uses a component schema - let responseType: unknown if (operation.responses) { // Prefer 200 response, fallback to first available response const successResponse = @@ -292,96 +400,22 @@ function generateSchemaInterface( operation.responses['201'] || Object.values(operation.responses)[0] - if (successResponse) { - if ('$ref' in successResponse) { - // ResponseObject reference - skip for now - // Could resolve if needed - } else if ('content' in successResponse) { - const content = successResponse.content - const jsonContent = content?.['application/json'] - if ( - jsonContent && - 'schema' in jsonContent && - jsonContent.schema - ) { - // Check if schema is a direct reference to components.schemas - if ('$ref' in jsonContent.schema) { - const schemaName = extractSchemaNameFromRef( - jsonContent.schema.$ref, - ) - // Check if schema exists in components.schemas and is used in response - if ( - schemaName && - schema.components?.schemas?.[schemaName] && - responseSchemaNames.has(schemaName) - ) { - // Use component reference - responseType = `DevupObject<'response', '${serverName}'>['${schemaName}']` - } else { - // Extract schema type with response options - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - const { type: schemaType } = getTypeFromSchema( - jsonContent.schema, - schema, - { defaultNonNullable: responseDefaultNonNullable }, - ) - responseType = schemaType - } - } else { - // Check if it's an array with items referencing a component schema - const schemaObj = - jsonContent.schema as OpenAPIV3_1.SchemaObject - if ( - schemaObj.type === 'array' && - schemaObj.items && - '$ref' in schemaObj.items - ) { - const schemaName = extractSchemaNameFromRef( - schemaObj.items.$ref, - ) - // Check if schema exists in components.schemas and is used in response - if ( - schemaName && - schema.components?.schemas?.[schemaName] && - responseSchemaNames.has(schemaName) - ) { - // Use component reference for array items - responseType = `Array['${schemaName}']>` - } else { - // Extract schema type with response options - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - const { type: schemaType } = getTypeFromSchema( - jsonContent.schema, - schema, - { defaultNonNullable: responseDefaultNonNullable }, - ) - responseType = schemaType - } - } else { - // Extract schema type with response options - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - const { type: schemaType } = getTypeFromSchema( - jsonContent.schema, - schema, - { defaultNonNullable: responseDefaultNonNullable }, - ) - responseType = schemaType - } - } - } - } + const responseType = extractContentType( + successResponse, + 'response', + responseSchemaNames, + schema, + serverName, + enumContext, + options, + ) + if (responseType !== undefined) { + endpoint.response = responseType } } - if (responseType !== undefined) { - endpoint.response = responseType - } // Extract error // Check if error uses a component schema - let errorType: unknown if (operation.responses) { // Find error responses (4xx, 5xx, or default) const errorResponse = @@ -396,92 +430,19 @@ function generateSchemaInterface( isErrorStatusCode(statusCode), )?.[1] - if (errorResponse) { - if ('$ref' in errorResponse) { - // ResponseObject reference - skip for now - // Could resolve if needed - } else if ('content' in errorResponse) { - const content = errorResponse.content - const jsonContent = content?.['application/json'] - if ( - jsonContent && - 'schema' in jsonContent && - jsonContent.schema - ) { - // Check if schema is a direct reference to components.schemas - if ('$ref' in jsonContent.schema) { - const schemaName = extractSchemaNameFromRef( - jsonContent.schema.$ref, - ) - // Check if schema exists in components.schemas and is used in error - if ( - schemaName && - schema.components?.schemas?.[schemaName] && - errorSchemaNames.has(schemaName) - ) { - // Use component reference - errorType = `DevupObject<'error', '${serverName}'>['${schemaName}']` - } else { - // Extract schema type with response options - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - const { type: schemaType } = getTypeFromSchema( - jsonContent.schema, - schema, - { defaultNonNullable: responseDefaultNonNullable }, - ) - errorType = schemaType - } - } else { - // Check if it's an array with items referencing a component schema - const schemaObj = - jsonContent.schema as OpenAPIV3_1.SchemaObject - if ( - schemaObj.type === 'array' && - schemaObj.items && - '$ref' in schemaObj.items - ) { - const schemaName = extractSchemaNameFromRef( - schemaObj.items.$ref, - ) - // Check if schema exists in components.schemas and is used in error - if ( - schemaName && - schema.components?.schemas?.[schemaName] && - errorSchemaNames.has(schemaName) - ) { - // Use component reference for array items - errorType = `Array['${schemaName}']>` - } else { - // Extract schema type with response options - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - const { type: schemaType } = getTypeFromSchema( - jsonContent.schema, - schema, - { defaultNonNullable: responseDefaultNonNullable }, - ) - errorType = schemaType - } - } else { - // Extract schema type with response options - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - const { type: schemaType } = getTypeFromSchema( - jsonContent.schema, - schema, - { defaultNonNullable: responseDefaultNonNullable }, - ) - errorType = schemaType - } - } - } - } + const errorType = extractContentType( + errorResponse, + 'error', + errorSchemaNames, + schema, + serverName, + enumContext, + options, + ) + if (errorType !== undefined) { + endpoint.error = errorType } } - if (errorType !== undefined) { - endpoint.error = errorType - } // Generate path key (normalize path by replacing {param} with converted param and removing slashes) const normalizedPath = path.replace(/\{([^}]+)\}/g, (_, param) => { @@ -503,38 +464,103 @@ function generateSchemaInterface( } // Extract components schemas + // Generate separately for each context (request/response/error) to: + // 1. Apply correct defaultNonNullable per context + // 2. Use appropriate usedSchemaNames for nested $ref resolution const requestComponents: Record = {} const responseComponents: Record = {} const errorComponents: Record = {} if (schema.components?.schemas) { + const requestDefaultNonNullable = + options?.requestDefaultNonNullable ?? false + const responseDefaultNonNullable = + options?.responseDefaultNonNullable ?? true + for (const [schemaName, schemaObj] of Object.entries( schema.components.schemas, )) { if (schemaObj) { - const requestDefaultNonNullable = - options?.requestDefaultNonNullable ?? false - const responseDefaultNonNullable = - options?.responseDefaultNonNullable ?? true - - // Determine which defaultNonNullable to use based on where schema is used - let defaultNonNullable = responseDefaultNonNullable - if (requestSchemaNames.has(schemaName)) { - defaultNonNullable = requestDefaultNonNullable + // Skip enum schemas - they are defined as top-level type aliases + // and referenced directly by type name (e.g., Gender instead of DevupObject<...>['Gender']) + const typedSchemaObj = schemaObj as OpenAPIV3_1.SchemaObject + if ('enum' in typedSchemaObj && typedSchemaObj.enum) { + // Still need to collect enum definition for top-level type alias + const schemaContext = createSchemaContext(schemaName) + getTypeFromSchema(typedSchemaObj, schema, { context: schemaContext }) + for (const [enumName, enumDef] of schemaContext.enums) { + if (!enumContext.enums.has(enumName)) { + enumContext.enums.set(enumName, enumDef) + } + } + continue } - const { type: schemaType } = getTypeFromSchema( - schemaObj as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, - schema, - { defaultNonNullable }, - ) - // Keep original schema name as-is + // Generate for request context if (requestSchemaNames.has(schemaName)) { + const schemaContext = createSchemaContext(schemaName) + const { type: schemaType } = getTypeFromSchema( + schemaObj as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, + schema, + { + defaultNonNullable: requestDefaultNonNullable, + context: schemaContext, + serverName, + componentType: 'request', + usedSchemaNames: requestSchemaNames, + }, + ) + // Merge enums + for (const [enumName, enumDef] of schemaContext.enums) { + if (!enumContext.enums.has(enumName)) { + enumContext.enums.set(enumName, enumDef) + } + } requestComponents[schemaName] = schemaType } + + // Generate for response context if (responseSchemaNames.has(schemaName)) { + const schemaContext = createSchemaContext(schemaName) + const { type: schemaType } = getTypeFromSchema( + schemaObj as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, + schema, + { + defaultNonNullable: responseDefaultNonNullable, + context: schemaContext, + serverName, + componentType: 'response', + usedSchemaNames: responseSchemaNames, + }, + ) + // Merge enums + for (const [enumName, enumDef] of schemaContext.enums) { + if (!enumContext.enums.has(enumName)) { + enumContext.enums.set(enumName, enumDef) + } + } responseComponents[schemaName] = schemaType } + + // Generate for error context if (errorSchemaNames.has(schemaName)) { + const schemaContext = createSchemaContext(schemaName) + const { type: schemaType } = getTypeFromSchema( + schemaObj as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, + schema, + { + defaultNonNullable: responseDefaultNonNullable, + context: schemaContext, + serverName, + componentType: 'error', + usedSchemaNames: errorSchemaNames, + }, + ) + // Merge enums + for (const [enumName, enumDef] of schemaContext.enums) { + if (!enumContext.enums.has(enumName)) { + enumContext.enums.set(enumName, enumDef) + } + } errorComponents[schemaName] = schemaType } } @@ -546,6 +572,7 @@ function generateSchemaInterface( requestComponents, responseComponents, errorComponents, + enumDefinitions: enumContext.enums, } } @@ -569,6 +596,9 @@ export function generateInterface( const serverResponseComponents: Record> = {} const serverErrorComponents: Record> = {} + // Collect all enum definitions across all servers + const allEnumDefinitions = new Map() + for (const [originalServerName, schema] of Object.entries(schemas)) { const normalizedServerName = normalizeServerName(originalServerName) serverNames.push(normalizedServerName) @@ -578,12 +608,20 @@ export function generateInterface( requestComponents, responseComponents, errorComponents, + enumDefinitions, } = generateSchemaInterface(schema, normalizedServerName, options) serverEndpoints[normalizedServerName] = endpoints serverRequestComponents[normalizedServerName] = requestComponents serverResponseComponents[normalizedServerName] = responseComponents serverErrorComponents[normalizedServerName] = errorComponents + + // Merge enum definitions + for (const [enumName, enumDef] of enumDefinitions) { + if (!allEnumDefinitions.has(enumName)) { + allEnumDefinitions.set(enumName, enumDef) + } + } } // Generate DevupApiServers interface (just server names with never) @@ -694,14 +732,75 @@ export function generateInterface( ? ` interface DevupErrorComponentStruct {\n${errorComponentEntries.join(';\n')}\n }` : ' interface DevupErrorComponentStruct {}' + // Generate enum type aliases + const enumTypeAliases: string[] = [] + for (const [enumName, enumDef] of allEnumDefinitions) { + const values = enumDef.values.map((v) => `"${String(v)}"`).join(' | ') + enumTypeAliases.push(` type ${enumName} = ${values}`) + } + + // Generate DevupPrecomputedMethodKeys interface + const precomputedEntries: string[] = [] + for (const serverName of serverNames) { + const methodKeyEntries: string[] = [] + for (const method of methods) { + const endpoints = serverEndpoints[serverName]?.[method] + const keys = endpoints ? Object.keys(endpoints) : [] + if (keys.length > 0) { + const keyUnion = keys.map((k) => `'${k}'`).join(' | ') + methodKeyEntries.push(` ${method}: ${keyUnion}`) + } else { + methodKeyEntries.push(` ${method}: never`) + } + } + const serverKey = wrapInterfaceKeyGuard(serverName) + precomputedEntries.push( + ` ${serverKey}: {\n${methodKeyEntries.join(';\n')};\n }`, + ) + } + const precomputedInterface = + precomputedEntries.length > 0 + ? ` interface DevupPrecomputedMethodKeys {\n${precomputedEntries.join(';\n')}\n }` + : '' + + // Generate DevupPrecomputedScopes interface (direct struct references per server+method) + const precomputedScopeEntries: string[] = [] + for (const serverName of serverNames) { + const methodScopeEntries: string[] = [] + for (const method of methods) { + const endpoints = serverEndpoints[serverName]?.[method] + if (endpoints && Object.keys(endpoints).length > 0) { + const structName = `Devup${toPascal(method)}ApiStruct` + const serverKey = wrapInterfaceKeyGuard(serverName) + methodScopeEntries.push(` ${method}: ${structName}[${serverKey}]`) + } else { + methodScopeEntries.push(` ${method}: Record`) + } + } + const serverKey = wrapInterfaceKeyGuard(serverName) + precomputedScopeEntries.push( + ` ${serverKey}: {\n${methodScopeEntries.join(';\n')};\n }`, + ) + } + const precomputedScopeInterface = + precomputedScopeEntries.length > 0 + ? ` interface DevupPrecomputedScopes {\n${precomputedScopeEntries.join(';\n')}\n }` + : '' + // Combine all interfaces const allInterfaces = [ serversInterface, ...methodInterfaces, + ...(precomputedInterface ? [precomputedInterface] : []), + ...(precomputedScopeInterface ? [precomputedScopeInterface] : []), requestComponentInterface, responseComponentInterface, errorComponentInterface, ].join('\n\n') - return `import "@devup-api/fetch";\nimport type { DevupObject } from "@devup-api/fetch";\n\ndeclare module "@devup-api/fetch" {\n${allInterfaces}\n}` + // Generate enum types outside the module declaration (global types) + const enumTypesBlock = + enumTypeAliases.length > 0 ? `${enumTypeAliases.join('\n')}\n\n` : '' + + return `import "@devup-api/fetch";\nimport type { DevupObject } from "@devup-api/fetch";\n\ndeclare module "@devup-api/fetch" {\n${enumTypesBlock}${allInterfaces}\n}` } diff --git a/packages/generator/src/generate-schema.ts b/packages/generator/src/generate-schema.ts index 50d15cc..a8aefd5 100644 --- a/packages/generator/src/generate-schema.ts +++ b/packages/generator/src/generate-schema.ts @@ -1,32 +1,105 @@ import type { OpenAPIV3_1 } from 'openapi-types' import type { ParameterDefinition } from './generate-interface' +import { + getPrimaryType, + getRequestBodyContent, + isNullableSchema, + normalizeNullableUnion, + resolveRef, + splitNullableUnion, +} from './openapi-utils' +import { wrapInterfaceKeyGuard } from './wrap-interface-key-guard' /** - * Resolve $ref reference in OpenAPI schema + * Enum definition collected during schema processing */ -function resolveSchemaRef< - T extends OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ParameterObject, ->(ref: string, document: OpenAPIV3_1.Document): T | null { - if (!ref.startsWith('#/')) { - return null +export interface EnumDefinition { + /** Unique key for the enum (e.g., "UserStatus", "OrderType") */ + name: string + /** Enum values */ + values: (string | number)[] + /** Whether the enum is nullable */ + nullable: boolean +} + +/** + * Context for tracking enums during schema processing + */ +export interface SchemaProcessingContext { + /** Map of enum key to enum definition */ + enums: Map + /** Current property path for naming enums */ + propertyPath: string[] + /** Schema name if processing a component schema */ + schemaName?: string +} + +/** + * Create a new schema processing context + */ +export function createSchemaContext( + schemaName?: string, +): SchemaProcessingContext { + return { + enums: new Map(), + propertyPath: [], + schemaName, } +} - const parts = ref.slice(2).split('/') - let current: unknown = document +/** + * Generate a unique enum name based on context + */ +function generateEnumName( + context: SchemaProcessingContext, + values: (string | number)[], +): string { + // Use schema name + property path for naming + const parts: string[] = [] + + if (context.schemaName) { + parts.push(context.schemaName) + } - for (const part of parts) { - if (current && typeof current === 'object' && part in current) { - current = (current as Record)[part] - } else { - return null - } + if (context.propertyPath.length > 0) { + parts.push(...context.propertyPath) } - if (current && typeof current === 'object' && !('$ref' in current)) { - return current as T + if (parts.length === 0) { + // Fallback: generate name from values + const valueBasedName = values + .slice(0, 3) + .map((v) => String(v).charAt(0).toUpperCase() + String(v).slice(1)) + .join('') + return `${valueBasedName}Enum` } - return null + // Convert to PascalCase + const name = parts + .map((p) => { + // Remove special characters and convert to PascalCase + return p + .replace(/[^a-zA-Z0-9]/g, ' ') + .split(' ') + .filter(Boolean) + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join('') + }) + .join('') + + return name +} + +/** + * Options for component reference handling + */ +export interface ComponentRefOptions { + /** Server name for DevupObject reference */ + serverName?: string + /** Component type: 'request' | 'response' | 'error' */ + componentType?: 'request' | 'response' | 'error' + /** Set of schema names that should be referenced as components */ + usedSchemaNames?: Set } /** @@ -37,143 +110,295 @@ export function getTypeFromSchema( document: OpenAPIV3_1.Document, options?: { defaultNonNullable?: boolean - }, + context?: SchemaProcessingContext + propertyName?: string + } & ComponentRefOptions, ): { type: unknown; default?: unknown } { const defaultNonNullable = options?.defaultNonNullable ?? false - // Handle $ref - if ('$ref' in schema) { - const resolved = resolveSchemaRef( - schema.$ref, - document, - ) - if (resolved) { - return getTypeFromSchema(resolved, document, options) - } - return { type: 'unknown', default: undefined } + const context = options?.context + + // Push property name to path if provided + if (context && options?.propertyName) { + context.propertyPath.push(options.propertyName) } - const schemaObj = schema as OpenAPIV3_1.SchemaObject + try { + // Handle $ref + if ('$ref' in schema) { + // Extract schema name from $ref + const refSchemaName = schema.$ref.startsWith('#/components/schemas/') + ? schema.$ref.replace('#/components/schemas/', '') + : undefined - // Handle allOf, anyOf, oneOf - if (schemaObj.allOf) { - const types = schemaObj.allOf.map((s) => - getTypeFromSchema(s, document, options), - ) - return { - type: - types.length > 0 - ? types.map((t) => formatTypeValue(t.type)).join(' & ') - : 'unknown', - default: schemaObj.default, + const resolved = resolveRef( + schema.$ref, + document, + ) + + // If $ref cannot be resolved, return unknown + if (!resolved) { + return { type: 'unknown', default: undefined } + } + + // Normalized nullable unions carry nullability beside $ref, not on its target. + const nullable = isNullableSchema(schema) || isNullableSchema(resolved) + + // If this $ref points to a used component schema, decide how to reference it + if ( + refSchemaName && + options?.serverName && + options?.componentType && + options?.usedSchemaNames?.has(refSchemaName) + ) { + // Check if the referenced schema is an enum + // Enums are defined at top-level as type aliases, so use direct type name + if ('enum' in resolved && resolved.enum) { + // Return the enum type name directly (e.g., "Gender" instead of DevupObject<...>['Gender']) + return { + type: nullable ? `${refSchemaName} | null` : refSchemaName, + default: undefined, + } + } + + // For object schemas, return a component reference marker + return { + type: { + __componentRef: true, + schemaName: refSchemaName, + serverName: options.serverName, + componentType: options.componentType, + ...(nullable ? { __nullable: true } : {}), + }, + default: undefined, + } + } + + // Create updated context with the referenced schema name + // Reset propertyPath since we're entering a new schema context + const updatedContext = + context && refSchemaName + ? { ...context, schemaName: refSchemaName, propertyPath: [] } + : context + + const referencedSchema = nullable + ? { ...resolved, nullable: true } + : resolved + return getTypeFromSchema(referencedSchema, document, { + ...options, + context: updatedContext, + propertyName: undefined, // Don't double-push property name + }) } - } - if (schemaObj.anyOf || schemaObj.oneOf) { - const types = (schemaObj.anyOf || schemaObj.oneOf || []).map((s) => - getTypeFromSchema(s, document, options), - ) - return { - type: - types.length > 0 - ? `(${types.map((t) => formatTypeValue(t.type)).join(' | ')})` - : 'unknown', - default: schemaObj.default, + const schemaObj = schema as OpenAPIV3_1.SchemaObject + + // Handle allOf, anyOf, oneOf + if (schemaObj.allOf) { + const types = schemaObj.allOf.map((s) => + getTypeFromSchema(s, document, { + ...options, + propertyName: undefined, + }), + ) + return { + type: + types.length > 0 + ? types.map((t) => formatTypeValue(t.type)).join(' & ') + : 'unknown', + default: schemaObj.default, + } } - } - // Handle enum - if (schemaObj.enum) { - return { - type: schemaObj.enum.map((v) => `"${String(v)}"`).join(' | '), - default: schemaObj.default, + if (schemaObj.anyOf || schemaObj.oneOf) { + // `anyOf: [S, { type: 'null' }]` is OpenAPI 3.1's nullable notation, not a + // union: collapsing keeps a `$ref` member's component identity. + const normalized = normalizeNullableUnion(schemaObj) + if (normalized !== schemaObj) { + return getTypeFromSchema(normalized, document, { + ...options, + propertyName: undefined, + }) + } + + const { members, nullable: hasNullMember } = splitNullableUnion( + schemaObj.anyOf || schemaObj.oneOf || [], + ) + const unionTypes = members.map((s) => + formatTypeValue( + getTypeFromSchema(s, document, { + ...options, + propertyName: undefined, + }).type, + ), + ) + if (hasNullMember || isNullableSchema(schemaObj)) { + unionTypes.push('null') + } + return { + type: unionTypes.length > 0 ? `(${unionTypes.join(' | ')})` : 'unknown', + default: schemaObj.default, + } } - } - // Handle primitive types - if (schemaObj.type === 'string') { - return { type: 'string', default: schemaObj.default } - } + // Check if schema is nullable + const nullable = isNullableSchema(schemaObj) + + // Handle enum + if (schemaObj.enum) { + // If context is provided, register the enum and return a reference + if (context) { + const enumName = generateEnumName(context, schemaObj.enum) + const existingEnum = context.enums.get(enumName) + + if (!existingEnum) { + context.enums.set(enumName, { + name: enumName, + values: schemaObj.enum as (string | number)[], + nullable, + }) + } - if (schemaObj.type === 'number' || schemaObj.type === 'integer') { - return { type: 'number', default: schemaObj.default } - } + return { + type: nullable ? `${enumName} | null` : enumName, + default: schemaObj.default, + } + } - if (schemaObj.type === 'boolean') { - return { type: 'boolean', default: schemaObj.default } - } + // Fallback: inline enum type (for backward compatibility) + const enumType = schemaObj.enum.map((v) => `"${String(v)}"`).join(' | ') + return { + type: nullable ? `${enumType} | null` : enumType, + default: schemaObj.default, + } + } - // Handle array - if (schemaObj.type === 'array') { - const items = schemaObj.items - if (items) { - const itemType = getTypeFromSchema(items, document, options) + // Get the actual type (handle OpenAPI 3.1 type arrays) + const actualType = getPrimaryType(schemaObj) + + // Handle primitive types + if (actualType === 'string') { + // Handle binary format for file upload fields + if (schemaObj.format === 'binary') { + return { + type: nullable ? 'File | Blob | null' : 'File | Blob', + default: schemaObj.default, + } + } return { - type: { __isArray: true, items: itemType.type }, + type: nullable ? 'string | null' : 'string', + default: schemaObj.default, + } + } + + if (actualType === 'number' || actualType === 'integer') { + return { + type: nullable ? 'number | null' : 'number', + default: schemaObj.default, + } + } + + if (actualType === 'boolean') { + return { + type: nullable ? 'boolean | null' : 'boolean', default: schemaObj.default, } } - return { type: 'unknown[]', default: schemaObj.default } - } - // Handle object - if (schemaObj.type === 'object' || schemaObj.properties) { - const props: Record = {} - const required = schemaObj.required || [] - - if (schemaObj.properties) { - for (const [key, value] of Object.entries(schemaObj.properties)) { - const propType = getTypeFromSchema(value, document, options) - // Check if property has default value - // Need to resolve $ref if present to check for default - let hasDefault = false - if ('$ref' in value) { - const resolved = resolveSchemaRef( - value.$ref, + // Handle array + if (actualType === 'array') { + const items = 'items' in schemaObj ? schemaObj.items : undefined + if (items) { + const itemType = getTypeFromSchema(items, document, { + ...options, + propertyName: undefined, + }) + return { + type: nullable + ? { __isArray: true, items: itemType.type, __nullable: true } + : { __isArray: true, items: itemType.type }, + default: schemaObj.default, + } + } + return { + type: nullable ? 'unknown[] | null' : 'unknown[]', + default: schemaObj.default, + } + } + + // Handle object + if (actualType === 'object' || schemaObj.properties) { + const props: Record = {} + const required = schemaObj.required || [] + + if (schemaObj.properties) { + for (const [key, value] of Object.entries(schemaObj.properties)) { + const propType = getTypeFromSchema(value, document, { + ...options, + propertyName: key, + }) + // Check if property has default value + // Need to resolve $ref if present to check for default + let hasDefault = false + if ('$ref' in value) { + const resolved = resolveRef( + value.$ref, + document, + ) + if (resolved) { + hasDefault = resolved.default !== undefined + } + } else { + const propSchema = value as OpenAPIV3_1.SchemaObject + hasDefault = propSchema.default !== undefined + } + const isInRequired = required.includes(key) + + // If defaultNonNullable is true and has default, treat as required + // Otherwise, mark as optional if not in required array + if (defaultNonNullable && hasDefault && !isInRequired) { + props[key] = propType + } else if (!isInRequired) { + props[`${key}?`] = propType + } else { + props[key] = propType + } + } + } + + // Handle additionalProperties + if (schemaObj.additionalProperties) { + if (schemaObj.additionalProperties === true) { + props['[key: string]'] = { type: 'unknown', default: undefined } + } else if (typeof schemaObj.additionalProperties === 'object') { + const additionalType = getTypeFromSchema( + schemaObj.additionalProperties, document, + { + ...options, + propertyName: undefined, + }, ) - if (resolved) { - hasDefault = resolved.default !== undefined + props['[key: string]'] = { + type: additionalType.type, + default: additionalType.default, } - } else { - const propSchema = value as OpenAPIV3_1.SchemaObject - hasDefault = propSchema.default !== undefined - } - const isInRequired = required.includes(key) - - // If defaultNonNullable is true and has default, treat as required - // Otherwise, mark as optional if not in required array - if (defaultNonNullable && hasDefault && !isInRequired) { - props[key] = propType - } else if (!isInRequired) { - props[`${key}?`] = propType - } else { - props[key] = propType } } - } - // Handle additionalProperties - if (schemaObj.additionalProperties) { - if (schemaObj.additionalProperties === true) { - props['[key: string]'] = { type: 'unknown', default: undefined } - } else if (typeof schemaObj.additionalProperties === 'object') { - const additionalType = getTypeFromSchema( - schemaObj.additionalProperties, - document, - options, - ) - props['[key: string]'] = { - type: additionalType.type, - default: additionalType.default, - } + return { + type: nullable ? { ...props, __nullable: true } : { ...props }, + default: schemaObj.default, } } - return { type: { ...props }, default: schemaObj.default } + // Handle oneOf/anyOf already handled above, but check again for safety + return { type: 'unknown', default: undefined } + } finally { + // Pop property name from path + if (context && options?.propertyName) { + context.propertyPath.pop() + } } - - // Handle oneOf/anyOf already handled above, but check again for safety - return { type: 'unknown', default: undefined } } /** @@ -243,14 +468,15 @@ function formatType(obj: Record, indent: number = 0): string { .map(([key, value]) => { // Handle string values (e.g., component references) if (typeof value === 'string') { - return `${nextIndentStr}${key}: ${value}` + return `${nextIndentStr}${wrapInterfaceKeyGuard(key)}: ${value}` } // Handle ParameterDefinition for params and query if (isParameterDefinition(value)) { const typeStr = formatTypeValue(value.type, nextIndent) const isOptional = value.required === false - const keyWithOptional = isOptional ? `${key}?` : key + const wrappedKey = wrapInterfaceKeyGuard(key) + const keyWithOptional = isOptional ? `${wrappedKey}?` : wrappedKey let description = '' if (value.description) { description += `${nextIndentStr}/**\n${nextIndentStr} * ${value.description}` @@ -270,7 +496,7 @@ function formatType(obj: Record, indent: number = 0): string { if (isTypeObject(value)) { const formattedValue = formatTypeValue(value.type, nextIndent) // Key already has '?' if it's optional (from getTypeFromSchema), keep it as is - return `${nextIndentStr}${key}: ${formattedValue}` + return `${nextIndentStr}${wrapInterfaceKeyGuard(key)}: ${formattedValue}` } // Check if value is an object (like params, query) with all optional properties @@ -282,7 +508,7 @@ function formatType(obj: Record, indent: number = 0): string { const optionalMarker = valueAllOptional ? '?' : '' const formattedValue = formatTypeValue(value, nextIndent) - return `${nextIndentStr}${key}${optionalMarker}: ${formattedValue}` + return `${nextIndentStr}${wrapInterfaceKeyGuard(key)}${optionalMarker}: ${formattedValue}` }) .join(';\n') @@ -313,7 +539,7 @@ function isTypeObject( */ function isArrayType( value: unknown, -): value is { __isArray: true; items: unknown } { +): value is { __isArray: true; items: unknown; __nullable?: boolean } { return ( typeof value === 'object' && value !== null && @@ -322,6 +548,38 @@ function isArrayType( ) } +/** + * Check if a value is a nullable object type marker + */ +function isNullableObject( + value: unknown, +): value is Record & { __nullable: true } { + return ( + typeof value === 'object' && + value !== null && + '__nullable' in value && + (value as Record).__nullable === true + ) +} + +/** + * Check if a value is a component reference marker + */ +function isComponentRef(value: unknown): value is { + __componentRef: true + schemaName: string + serverName: string + componentType: 'request' | 'response' | 'error' + __nullable?: boolean +} { + return ( + typeof value === 'object' && + value !== null && + '__componentRef' in value && + (value as Record).__componentRef === true + ) +} + /** * Format a type value to TypeScript type string */ @@ -330,10 +588,17 @@ export function formatTypeValue(value: unknown, indent: number = 0): string { return value } + // Handle component reference marker + if (isComponentRef(value)) { + const reference = `DevupObject<'${value.componentType}', '${value.serverName}'>['${value.schemaName}']` + return value.__nullable ? `${reference} | null` : reference + } + // Handle array type marker if (isArrayType(value)) { const itemsFormatted = formatTypeValue(value.items, indent) - return `Array<${itemsFormatted}>` + const arrayType = `Array<${itemsFormatted}>` + return value.__nullable ? `${arrayType} | null` : arrayType } // Handle { type: unknown, default?: unknown } structure @@ -341,6 +606,14 @@ export function formatTypeValue(value: unknown, indent: number = 0): string { return formatTypeValue(value.type, indent) } + // Handle nullable object type marker + if (isNullableObject(value)) { + // Remove __nullable from the object before formatting + const { __nullable, ...rest } = value + const objectType = formatType(rest as Record, indent) + return `${objectType} | null` + } + if (typeof value === 'object' && value !== null && !Array.isArray(value)) { return formatType(value as Record, indent) } @@ -372,7 +645,7 @@ export function extractParameters( for (const param of allParams) { if ('$ref' in param) { // Resolve $ref parameter - const resolved = resolveSchemaRef( + const resolved = resolveRef( param.$ref, document, ) @@ -445,13 +718,16 @@ export function extractRequestBody( } if ('$ref' in requestBody) { - const resolved = resolveSchemaRef(requestBody.$ref, document) + const resolved = resolveRef( + requestBody.$ref, + document, + ) if (resolved && 'content' in resolved && resolved.content) { const content = resolved.content as OpenAPIV3_1.RequestBodyObject['content'] - const jsonContent = content['application/json'] - if (jsonContent && 'schema' in jsonContent && jsonContent.schema) { - return getTypeFromSchema(jsonContent.schema, document, { + const bodyContent = getRequestBodyContent(content) + if (bodyContent && 'schema' in bodyContent && bodyContent.schema) { + return getTypeFromSchema(bodyContent.schema, document, { defaultNonNullable: false, }).type } @@ -461,9 +737,9 @@ export function extractRequestBody( const content = requestBody.content if (content) { - const jsonContent = content['application/json'] - if (jsonContent && 'schema' in jsonContent && jsonContent.schema) { - return getTypeFromSchema(jsonContent.schema, document, { + const bodyContent = getRequestBodyContent(content) + if (bodyContent && 'schema' in bodyContent && bodyContent.schema) { + return getTypeFromSchema(bodyContent.schema, document, { defaultNonNullable: false, }).type } diff --git a/packages/generator/src/generate-server-actions.ts b/packages/generator/src/generate-server-actions.ts new file mode 100644 index 0000000..2df35f6 --- /dev/null +++ b/packages/generator/src/generate-server-actions.ts @@ -0,0 +1,202 @@ +import type { DevupApiOptions } from '@devup-api/core' +import type { OpenAPIV3_1 } from 'openapi-types' +import { convertCase } from './convert-case' + +type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' + +type ServerActionOperation = { + actionName: string + method: HttpMethod + operationId: string + serverName: string + apiVariableName: string +} + +function isServerActionsEnabled(options?: DevupApiOptions): boolean { + const serverActions = options?.serverActions + if (typeof serverActions === 'boolean') return serverActions + if (!serverActions) return true + return serverActions.enabled !== false +} + +function getServerActionsBaseUrl(options?: DevupApiOptions): string { + const serverActions = options?.serverActions + if (typeof serverActions === 'object') return serverActions.baseUrl ?? '' + return '' +} + +function quote(value: string): string { + return `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'` +} + +function toIdentifier(value: string): string { + const identifier = value.replace(/[^a-zA-Z0-9_$]/g, '_') + return /^[a-zA-Z_$]/.test(identifier) ? identifier : `_${identifier}` +} + +function toApiVariableName(serverName: string, index: number): string { + if (index === 0) return 'api' + return toIdentifier(`${convertCase(serverName, 'camel')}Api`) +} + +function getMethodScopeType(method: HttpMethod): string { + const pascal = `${method[0]?.toUpperCase()}${method.slice(1)}` + return `Devup${pascal}ApiStructScope` +} + +function collectOperations( + schemas: Record, + options?: DevupApiOptions, +): ServerActionOperation[] { + const convertCaseType = options?.convertCase ?? 'camel' + const operations: ServerActionOperation[] = [] + const usedActionNames = new Set() + let serverIndex = 0 + + for (const [serverName, schema] of Object.entries(schemas)) { + const apiVariableName = toApiVariableName(serverName, serverIndex) + serverIndex += 1 + + for (const pathItem of Object.values(schema.paths ?? {})) { + if (!pathItem) continue + for (const method of ['get', 'post', 'put', 'delete', 'patch'] as const) { + const operation = pathItem[method] + if (!operation?.operationId) continue + + const rawActionName = toIdentifier( + convertCase(operation.operationId, convertCaseType), + ) + const actionName = usedActionNames.has(rawActionName) + ? toIdentifier(`${convertCase(serverName, 'camel')}_${rawActionName}`) + : rawActionName + usedActionNames.add(actionName) + + operations.push({ + actionName, + method, + operationId: rawActionName, + serverName, + apiVariableName, + }) + } + } + } + + return operations +} + +function generateApiDeclarations( + operations: ServerActionOperation[], + options?: DevupApiOptions, +): string { + const baseUrl = getServerActionsBaseUrl(options) + const serverNames = [ + ...new Set(operations.map((operation) => operation.serverName)), + ] + + return serverNames + .map((serverName, index) => { + const apiVariableName = toApiVariableName(serverName, index) + const serverNameProperty = + serverName === 'openapi.json' + ? '' + : `, serverName: ${quote(serverName)}` + return `const ${apiVariableName} = createApi({ baseUrl: ${quote(baseUrl)}${serverNameProperty} })` + }) + .join('\n') +} + +function generateAction(operation: ServerActionOperation): string { + const scopeType = `${operation.actionName}Scope` + const methodScopeType = getMethodScopeType(operation.method) + return `type ${scopeType} = Additional<${quote(operation.operationId)}, ${methodScopeType}<${quote(operation.serverName)}>> + +export async function ${operation.actionName}( + ...options: ApiOption<${scopeType}> +): Promise, ExtractValue<${scopeType}, 'error'>, SerializedResponse>> { + return serializeApiResponse(await ${operation.apiVariableName}.${operation.method}(${quote(operation.operationId)}, ...options)) +}` +} + +function generateActionDeclaration(operation: ServerActionOperation): string { + const scopeType = `${operation.actionName}Scope` + const methodScopeType = getMethodScopeType(operation.method) + return `type ${scopeType} = Additional<${quote(operation.operationId)}, ${methodScopeType}<${quote(operation.serverName)}>> + export function ${operation.actionName}( + ...options: ApiOption<${scopeType}> + ): Promise, ExtractValue<${scopeType}, 'error'>, SerializedResponse>>` +} + +export function generateServerActionCode( + schemas: Record, + options?: DevupApiOptions, +): string { + const operations = isServerActionsEnabled(options) + ? collectOperations(schemas, options) + : [] + const header = `// Auto-generated Server Actions from OpenAPI specs +// Do not edit this file directly +'use server' + +` + if (operations.length === 0) return `${header}export {}\n` + const apiDeclarations = generateApiDeclarations(operations, options) + const actions = operations.map(generateAction).join('\n\n') + const methodScopes = [ + ...new Set( + operations.map((operation) => getMethodScopeType(operation.method)), + ), + ] + + return `${header}import type { + Additional, + ApiOption, + ExtractValue, + ${methodScopes.join(',\n ')}, + DevupApiResponse, + SerializedResponse, +} from '@devup-api/fetch' +import { createApi } from '@devup-api/fetch' +import { serializeApiResponse } from '@devup-api/fetch' + +${apiDeclarations} + +${actions} +` +} + +export function generateServerActionTypes( + schemas: Record, + options?: DevupApiOptions, +): string { + const operations = isServerActionsEnabled(options) + ? collectOperations(schemas, options) + : [] + const header = `// Auto-generated Server Action types from OpenAPI specs +// Do not edit this file directly + +` + if (operations.length === 0) { + return `${header}declare module '@devup-api/fetch/server-generated' {}\n` + } + const declarations = operations.map(generateActionDeclaration).join('\n\n') + const methodScopes = [ + ...new Set( + operations.map((operation) => getMethodScopeType(operation.method)), + ), + ] + + return `${header}declare module '@devup-api/fetch/server-generated' { + import type { + Additional, + ApiOption, + ExtractValue, + ${methodScopes.join(',\n ')}, + DevupApiResponse, + SerializedResponse, + } from '@devup-api/fetch' + + ${declarations} +} +` +} diff --git a/packages/generator/src/generate-zod.ts b/packages/generator/src/generate-zod.ts index ca043f6..8b19d27 100644 --- a/packages/generator/src/generate-zod.ts +++ b/packages/generator/src/generate-zod.ts @@ -1,66 +1,20 @@ import type { DevupApiTypeGeneratorOptions } from '@devup-api/core' import type { OpenAPIV3_1 } from 'openapi-types' import { convertCase } from './convert-case' +import { + CONTENT_TYPE_PRIORITY, + collectSchemaNames, + extractSchemaNameFromRef, + getPrimaryType, + isErrorStatusCode, + isNullableSchema, + normalizeNullableUnion, + normalizeServerName, + resolveRef, + splitNullableUnion, +} from './openapi-utils' import { wrapInterfaceKeyGuard } from './wrap-interface-key-guard' -// ============================================================================= -// Helper Functions -// ============================================================================= - -/** - * Normalize server name by removing ./ prefix - */ -function normalizeServerName(serverName: string): string { - return serverName.replace(/^\.\//, '') -} - -/** - * Resolve $ref reference in OpenAPI schema - */ -function resolveSchemaRef< - T extends OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ParameterObject, ->(ref: string, document: OpenAPIV3_1.Document): T | null { - if (!ref.startsWith('#/')) { - return null - } - - const parts = ref.slice(2).split('/') - let current: unknown = document - - for (const part of parts) { - if (current && typeof current === 'object' && part in current) { - current = (current as Record)[part] - } else { - return null - } - } - - if (current && typeof current === 'object' && !('$ref' in current)) { - return current as T - } - - return null -} - -/** - * Extract schema name from $ref - */ -function extractSchemaNameFromRef(ref: string): string | null { - if (ref.startsWith('#/components/schemas/')) { - return ref.replace('#/components/schemas/', '') - } - return null -} - -/** - * Check if status code is an error response - */ -function isErrorStatusCode(statusCode: string): boolean { - if (statusCode === 'default') return true - const code = parseInt(statusCode, 10) - return code >= 400 && code < 600 -} - // ============================================================================= // OpenAPI to Zod Conversion // ============================================================================= @@ -83,10 +37,7 @@ function schemaToZod( // Return lazy reference for circular dependencies return `z.lazy(() => ${schemaRefs.get(schemaName)})` } - const resolved = resolveSchemaRef( - schema.$ref, - document, - ) + const resolved = resolveRef(schema.$ref, document) if (resolved) { return schemaToZod(resolved, document, schemaRefs, options) } @@ -95,37 +46,14 @@ function schemaToZod( const schemaObj = schema as OpenAPIV3_1.SchemaObject - // Handle nullable (OpenAPI 3.0 uses 'nullable', OpenAPI 3.1 uses type array with 'null') - const isNullable = (): boolean => { - // Check for OpenAPI 3.0 style nullable - if ('nullable' in schemaObj && schemaObj.nullable === true) { - return true - } - // Check for OpenAPI 3.1 style nullable (type: ["string", "null"]) - if (Array.isArray(schemaObj.type) && schemaObj.type.includes('null')) { - return true - } - return false - } - - const wrapNullable = (zodStr: string): string => { - if (isNullable()) { + const wrapNullable = (zodStr: string, forceNullable = false): string => { + if (forceNullable || isNullableSchema(schemaObj)) { return `${zodStr}.nullable()` } return zodStr } - // Helper to get the primary type from OpenAPI 3.1 type array - const getPrimaryType = (): string | undefined => { - if (Array.isArray(schemaObj.type)) { - // Filter out 'null' to get the primary type - const nonNullTypes = schemaObj.type.filter((t) => t !== 'null') - return nonNullTypes[0] - } - return schemaObj.type - } - - const primaryType = getPrimaryType() + const primaryType = getPrimaryType(schemaObj) // Handle allOf (intersection) if (schemaObj.allOf) { @@ -139,12 +67,21 @@ function schemaToZod( // Handle oneOf/anyOf (union) if (schemaObj.oneOf || schemaObj.anyOf) { - const schemas = (schemaObj.oneOf || schemaObj.anyOf || []).map((s) => + const normalized = normalizeNullableUnion(schemaObj) + if (normalized !== schemaObj) { + return schemaToZod(normalized, document, schemaRefs, options) + } + + const { members, nullable: hasNullMember } = splitNullableUnion( + schemaObj.oneOf || schemaObj.anyOf || [], + ) + const schemas = members.map((s) => schemaToZod(s, document, schemaRefs, options), ) - if (schemas.length === 0) return 'z.unknown()' - if (schemas.length === 1) return wrapNullable(schemas[0] as string) - return wrapNullable(`z.union([${schemas.join(', ')}])`) + if (schemas.length === 0) return hasNullMember ? 'z.null()' : 'z.unknown()' + if (schemas.length === 1) + return wrapNullable(schemas[0] as string, hasNullMember) + return wrapNullable(`z.union([${schemas.join(', ')}])`, hasNullMember) } // Handle enum @@ -158,6 +95,11 @@ function schemaToZod( // Handle primitive types if (primaryType === 'string') { + // Handle binary format for file upload fields + if (schemaObj.format === 'binary') { + return wrapNullable('z.instanceof(File)') + } + // Zod 4.0: Use top-level format validators instead of z.string().format() // Check format first to use top-level validators if (schemaObj.format === 'email') { @@ -257,7 +199,7 @@ function schemaToZod( // Check for default value let hasDefault = false if ('$ref' in value) { - const resolved = resolveSchemaRef( + const resolved = resolveRef( value.$ref, document, ) @@ -323,10 +265,7 @@ function schemaToZodType( // Return a lazy type reference return `z.ZodLazy` } - const resolved = resolveSchemaRef( - schema.$ref, - document, - ) + const resolved = resolveRef(schema.$ref, document) if (resolved) { return schemaToZodType(resolved, document, options) } @@ -335,35 +274,14 @@ function schemaToZodType( const schemaObj = schema as OpenAPIV3_1.SchemaObject - // Handle nullable - const isNullable = (): boolean => { - if ('nullable' in schemaObj && schemaObj.nullable === true) { - return true - } - if (Array.isArray(schemaObj.type) && schemaObj.type.includes('null')) { - return true - } - return false - } - - const wrapNullable = (zodType: string): string => { - if (isNullable()) { + const wrapNullable = (zodType: string, forceNullable = false): string => { + if (forceNullable || isNullableSchema(schemaObj)) { return `z.ZodNullable<${zodType}>` } return zodType } - // Helper to get the primary type from OpenAPI 3.1 type array - const getPrimaryType = (): string | undefined => { - if (Array.isArray(schemaObj.type)) { - // Filter out 'null' to get the primary type - const nonNullTypes = schemaObj.type.filter((t) => t !== 'null') - return nonNullTypes[0] - } - return schemaObj.type - } - - const primaryType = getPrimaryType() + const primaryType = getPrimaryType(schemaObj) // Handle allOf (intersection) if (schemaObj.allOf) { @@ -382,12 +300,19 @@ function schemaToZodType( // Handle oneOf/anyOf (union) if (schemaObj.oneOf || schemaObj.anyOf) { - const types = (schemaObj.oneOf || schemaObj.anyOf || []).map((s) => - schemaToZodType(s, document, options), + const normalized = normalizeNullableUnion(schemaObj) + if (normalized !== schemaObj) { + return schemaToZodType(normalized, document, options) + } + + const { members, nullable: hasNullMember } = splitNullableUnion( + schemaObj.oneOf || schemaObj.anyOf || [], ) - if (types.length === 0) return 'z.ZodUnknown' - if (types.length === 1) return wrapNullable(types[0] as string) - return wrapNullable(`z.ZodUnion<[${types.join(', ')}]>`) + const types = members.map((s) => schemaToZodType(s, document, options)) + if (types.length === 0) return hasNullMember ? 'z.ZodNull' : 'z.ZodUnknown' + if (types.length === 1) + return wrapNullable(types[0] as string, hasNullMember) + return wrapNullable(`z.ZodUnion<[${types.join(', ')}]>`, hasNullMember) } // Handle enum @@ -401,6 +326,9 @@ function schemaToZodType( // Handle primitive types if (primaryType === 'string') { + if (schemaObj.format === 'binary') { + return wrapNullable('z.ZodType') + } return wrapNullable('z.ZodString') } @@ -434,7 +362,7 @@ function schemaToZodType( // Check for default value let hasDefault = false if ('$ref' in value) { - const resolved = resolveSchemaRef( + const resolved = resolveRef( value.$ref, document, ) @@ -483,6 +411,8 @@ interface CollectedSchemas { requestSchemas: Record responseSchemas: Record errorSchemas: Record + /** Schemas referenced via $ref within category schemas but not themselves a category schema */ + dependencySchemas: Record pathMappings: Record< 'get' | 'post' | 'put' | 'delete' | 'patch', Record @@ -520,42 +450,6 @@ function collectSchemaUsage( } const convertCaseType = options?.convertCase ?? 'camel' - const collectSchemaNames = ( - schemaObj: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, - targetSet: Set, - ): void => { - if ('$ref' in schemaObj) { - const schemaName = extractSchemaNameFromRef(schemaObj.$ref) - if (schemaName) { - targetSet.add(schemaName) - } - return - } - - const s = schemaObj as OpenAPIV3_1.SchemaObject - - if (s.allOf) - s.allOf.forEach((sub) => { - collectSchemaNames(sub, targetSet) - }) - if (s.anyOf) - s.anyOf.forEach((sub) => { - collectSchemaNames(sub, targetSet) - }) - if (s.oneOf) - s.oneOf.forEach((sub) => { - collectSchemaNames(sub, targetSet) - }) - if (s.properties) { - Object.values(s.properties).forEach((prop) => { - collectSchemaNames(prop, targetSet) - }) - } - if (s.type === 'array' && 'items' in s && s.items) { - collectSchemaNames(s.items, targetSet) - } - } - // Helper to get direct schema name from request body const getRequestBodySchemaName = ( requestBody: OpenAPIV3_1.RequestBodyObject | OpenAPIV3_1.ReferenceObject, @@ -564,9 +458,13 @@ function collectSchemaUsage( return extractSchemaNameFromRef(requestBody.$ref) } const content = requestBody.content - const jsonContent = content?.['application/json'] - if (jsonContent?.schema && '$ref' in jsonContent.schema) { - return extractSchemaNameFromRef(jsonContent.schema.$ref) + for (const ct of CONTENT_TYPE_PRIORITY) { + const bodyContent = content?.[ct] + if (!bodyContent?.schema) continue + const bodySchema = normalizeNullableUnion(bodyContent.schema) + if ('$ref' in bodySchema) { + return extractSchemaNameFromRef(bodySchema.$ref) + } } return null } @@ -604,9 +502,12 @@ function collectSchemaUsage( } } else { const content = operation.requestBody.content - const jsonContent = content?.['application/json'] - if (jsonContent?.schema) { - collectSchemaNames(jsonContent.schema, requestSchemaNames) + for (const ct of CONTENT_TYPE_PRIORITY) { + const bodyContent = content?.[ct] + if (bodyContent?.schema) { + collectSchemaNames(bodyContent.schema, requestSchemaNames) + break + } } } } @@ -742,7 +643,45 @@ function generateSchemasForDocument( } } - return { requestSchemas, responseSchemas, errorSchemas, pathMappings } + // Collect all transitively referenced schemas from category schemas + const allCategoryNames = new Set([ + ...requestSchemaNames, + ...responseSchemaNames, + ...errorSchemaNames, + ]) + const allReferencedNames = new Set() + for (const schemaName of allCategoryNames) { + const schemaDef = schema.components?.schemas?.[schemaName] + if (schemaDef) { + collectSchemaNames( + schemaDef as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, + allReferencedNames, + { followComponentRefs: true, document: schema }, + ) + } + } + + // Generate dependency schemas (referenced via $ref but need _Name variables) + const dependencySchemas: Record = {} + for (const name of allReferencedNames) { + const schemaDef = schema.components?.schemas?.[name] + if (!schemaDef) continue + const schemaRef = schemaDef as + | OpenAPIV3_1.SchemaObject + | OpenAPIV3_1.ReferenceObject + dependencySchemas[name] = { + code: schemaToZod(schemaRef, schema, schemaRefs), + type: schemaToZodType(schemaRef, schema), + } + } + + return { + requestSchemas, + responseSchemas, + errorSchemas, + dependencySchemas, + pathMappings, + } } // ============================================================================= @@ -778,6 +717,17 @@ export function generateZodSchemas( for (const [serverName, collected] of Object.entries(serverSchemas)) { const safeServerName = serverName.replace(/[^a-zA-Z0-9]/g, '_') + // Dependency schemas (referenced via $ref, need _Name variables for z.lazy) + if (Object.keys(collected.dependencySchemas).length > 0) { + lines.push(`// Shared dependency schemas for ${serverName}`) + for (const [name, schemaInfo] of Object.entries( + collected.dependencySchemas, + )) { + lines.push(`const _${name} = ${schemaInfo.code};`) + } + lines.push('') + } + // Request schemas if (Object.keys(collected.requestSchemas).length > 0) { lines.push(`// Request schemas for ${serverName}`) diff --git a/packages/generator/src/index.ts b/packages/generator/src/index.ts index ac52774..f02852b 100644 --- a/packages/generator/src/index.ts +++ b/packages/generator/src/index.ts @@ -2,5 +2,7 @@ export * from './create-url-map' export * from './crud-types' export * from './generate-crud-config' export * from './generate-interface' +export * from './generate-server-actions' export * from './generate-zod' +export * from './openapi-utils' export * from './parse-crud-tags' diff --git a/packages/generator/src/openapi-utils.ts b/packages/generator/src/openapi-utils.ts new file mode 100644 index 0000000..aa52bdb --- /dev/null +++ b/packages/generator/src/openapi-utils.ts @@ -0,0 +1,294 @@ +import type { OpenAPIV3_1 } from 'openapi-types' + +// ============================================================================= +// Constants +// ============================================================================= + +/** + * Content type priority order: json > urlencoded > multipart. + * Used to determine which content type to use when multiple are available. + */ +export const CONTENT_TYPE_PRIORITY = [ + 'application/json', + 'application/x-www-form-urlencoded', + 'multipart/form-data', +] as const + +// ============================================================================= +// $ref Resolution +// ============================================================================= + +/** + * Resolve a JSON `$ref` reference within an OpenAPI document. + * Handles `#/` prefix stripping, path segment traversal, and null safety. + */ +export function resolveRef( + ref: string, + document: OpenAPIV3_1.Document, +): T | null { + if (!ref.startsWith('#/')) { + return null + } + + const parts = ref.slice(2).split('/') + let current: unknown = document + + for (const part of parts) { + if (current && typeof current === 'object' && part in current) { + current = (current as Record)[part] + } else { + return null + } + } + + if (current && typeof current === 'object' && !('$ref' in current)) { + return current as T + } + + return null +} + +// ============================================================================= +// Content Type Helpers +// ============================================================================= + +/** + * Get the first matching request body content from priority-ordered content types. + * Returns the `MediaTypeObject` for the highest-priority content type found. + */ +export function getRequestBodyContent( + content: OpenAPIV3_1.RequestBodyObject['content'] | undefined, +): OpenAPIV3_1.MediaTypeObject | undefined { + if (!content) return undefined + for (const ct of CONTENT_TYPE_PRIORITY) { + if (content[ct]) return content[ct] + } + return undefined +} + +// ============================================================================= +// Schema Name Extraction +// ============================================================================= + +/** + * Extract the schema name from a `$ref` string pointing to `#/components/schemas/`. + */ +export function extractSchemaNameFromRef(ref: string): string | null { + if (ref.startsWith('#/components/schemas/')) { + return ref.replace('#/components/schemas/', '') + } + return null +} + +// ============================================================================= +// Server Name Normalization +// ============================================================================= + +/** + * Normalize server name by removing the `./` prefix. + */ +export function normalizeServerName(serverName: string): string { + return serverName.replace(/^\.\//, '') +} + +// ============================================================================= +// Status Code Classification +// ============================================================================= + +/** + * Check if an HTTP status code represents an error response (4xx, 5xx, or 'default'). + */ +export function isErrorStatusCode(statusCode: string): boolean { + if (statusCode === 'default') return true + const code = parseInt(statusCode, 10) + return code >= 400 && code < 600 +} + +// ============================================================================= +// Nullable Detection +// ============================================================================= + +/** + * A schema that may carry the OpenAPI 3.0 `nullable` keyword. OpenAPI 3.1 + * dropped it from the type definitions, but devup-api still accepts it as + * input and uses it as the normalized form of a 3.1 null union. + */ +export type MaybeNullableSchema = ( + | OpenAPIV3_1.SchemaObject + | OpenAPIV3_1.ReferenceObject +) & { nullable?: boolean } + +/** + * Check if a schema is nullable (OpenAPI 3.0 or 3.1). + * OpenAPI 3.0: uses `nullable: true` + * OpenAPI 3.1: uses type array like `["string", "null"]` + */ +export function isNullableSchema(schema: MaybeNullableSchema): boolean { + if ('nullable' in schema && schema.nullable === true) { + return true + } + if ( + 'type' in schema && + Array.isArray(schema.type) && + schema.type.includes('null') + ) { + return true + } + return false +} + +/** + * Check if a schema is the JSON Schema `null` type. + * OpenAPI 3.1 expresses nullability of a `$ref` (or of any schema that cannot + * carry a `type` array) as a union member: `anyOf: [..., { type: "null" }]`. + */ +export function isNullTypeSchema( + schema: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, +): boolean { + if ('$ref' in schema) { + return false + } + const { type } = schema + if (Array.isArray(type)) { + return type.length > 0 && type.every((t) => t === 'null') + } + return type === 'null' +} + +/** + * Split the members of a union (`anyOf` / `oneOf`) into the members that carry + * an actual type and a nullability flag contributed by `{ type: "null" }`. + */ +export function splitNullableUnion( + union: (OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject)[], +): { + members: (OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject)[] + nullable: boolean +} { + const members = union.filter((member) => !isNullTypeSchema(member)) + return { members, nullable: members.length !== union.length } +} + +/** + * Normalize the OpenAPI 3.1 nullable notation `anyOf: [S, { type: "null" }]` + * into its OpenAPI 3.0 equivalent `{ ...S, nullable: true }`. + * + * Only unions that reduce to a single typed member are collapsed, so genuine + * unions keep generating a union type. Sibling keywords of the union (such as + * `description` or `default`) are preserved. + * + * Returns the given schema unchanged when there is nothing to collapse, so + * callers can detect a collapse by reference identity. + */ +export function normalizeNullableUnion( + schema: MaybeNullableSchema, +): MaybeNullableSchema { + if ('$ref' in schema) { + return schema + } + + const union = schema.anyOf ?? schema.oneOf + if (!union) { + return schema + } + + const { members, nullable } = splitNullableUnion(union) + if (!nullable || members.length !== 1) { + return schema + } + + const { anyOf, oneOf, ...siblings } = schema + return { ...siblings, ...members[0], nullable: true } +} + +// ============================================================================= +// Type Extraction +// ============================================================================= + +/** + * Get the primary (non-null) type from an OpenAPI schema. + * For OpenAPI 3.1 type arrays like `["string", "null"]`, returns `"string"`. + * For simple type strings, returns the type directly. + */ +export function getPrimaryType( + schema: OpenAPIV3_1.SchemaObject, +): string | undefined { + if (Array.isArray(schema.type)) { + return schema.type.find((t) => t !== 'null') + } + return schema.type +} + +// ============================================================================= +// Schema Name Collection +// ============================================================================= + +/** + * Recursively collect component schema names referenced by a schema object. + * + * When `followComponentRefs` is true (and `document` is provided), follows + * `$ref` into `components.schemas` to discover transitive dependencies, + * with circular-reference protection via the `visited` set. + * + * When `followComponentRefs` is false (default), only collects the direct + * schema name from `$ref` without following into the referenced schema. + */ +export function collectSchemaNames( + schemaObj: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, + targetSet: Set, + options?: { + followComponentRefs?: boolean + document?: OpenAPIV3_1.Document + visited?: Set + }, +): void { + if ('$ref' in schemaObj) { + const schemaName = extractSchemaNameFromRef(schemaObj.$ref) + if (schemaName) { + targetSet.add(schemaName) + + if (options?.followComponentRefs && options.document) { + const visited = options.visited ?? new Set() + if (visited.has(schemaName)) return + visited.add(schemaName) + + const referencedSchema = options.document.components?.schemas?.[ + schemaName + ] as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject | undefined + if (referencedSchema) { + collectSchemaNames(referencedSchema, targetSet, { + ...options, + visited, + }) + } + } + } + return + } + + const s = schemaObj as OpenAPIV3_1.SchemaObject + + if (s.allOf) { + for (const sub of s.allOf) { + collectSchemaNames(sub, targetSet, options) + } + } + if (s.anyOf) { + for (const sub of s.anyOf) { + collectSchemaNames(sub, targetSet, options) + } + } + if (s.oneOf) { + for (const sub of s.oneOf) { + collectSchemaNames(sub, targetSet, options) + } + } + if (s.properties) { + for (const prop of Object.values(s.properties)) { + collectSchemaNames(prop, targetSet, options) + } + } + if (s.type === 'array' && 'items' in s && s.items) { + collectSchemaNames(s.items, targetSet, options) + } +} diff --git a/packages/generator/src/parse-crud-tags.ts b/packages/generator/src/parse-crud-tags.ts index 2230461..8ff28a0 100644 --- a/packages/generator/src/parse-crud-tags.ts +++ b/packages/generator/src/parse-crud-tags.ts @@ -7,6 +7,7 @@ import type { DevupOperation, ParsedDevupTag, } from './crud-types' +import { resolveRef } from './openapi-utils' /** * Regex pattern for devup tags: devup:{name}:{mode} @@ -77,30 +78,6 @@ function getExpectedModeForMethod(method: string): CrudMode | null { } } -/** - * Resolve a schema reference - */ -function resolveSchemaRef( - ref: string, - document: OpenAPIV3_1.Document, -): OpenAPIV3_1.SchemaObject | null { - // Format: #/components/schemas/SchemaName - const parts = ref.split('/') - if ( - parts.length !== 4 || - parts[1] !== 'components' || - parts[2] !== 'schemas' - ) { - return null - } - const schemaName = parts[3] - return ( - (document.components?.schemas?.[ - schemaName as string - ] as OpenAPIV3_1.SchemaObject) ?? null - ) -} - /** * Extract fields from an OpenAPI schema */ @@ -111,7 +88,7 @@ function extractFieldsFromSchema( // Resolve reference if needed let resolvedSchema: OpenAPIV3_1.SchemaObject if ('$ref' in schema) { - const resolved = resolveSchemaRef(schema.$ref, document) + const resolved = resolveRef(schema.$ref, document) if (!resolved) return [] resolvedSchema = resolved } else { diff --git a/packages/generator/src/wrap-interface-key-guard.ts b/packages/generator/src/wrap-interface-key-guard.ts index f418430..b7ad613 100644 --- a/packages/generator/src/wrap-interface-key-guard.ts +++ b/packages/generator/src/wrap-interface-key-guard.ts @@ -4,17 +4,27 @@ export function wrapInterfaceKeyGuard(key: string): string { return key } - // Check if key contains forbidden characters that require wrapping + // Preserve TypeScript index signature syntax (e.g., [key: string], [key: number]) + if (/^\[.+:\s*.+\]$/.test(key)) { + return key + } + + // Check if key ends with '?' (optional marker in TypeScript) + // If so, process the base key and add '?' back at the end + const isOptional = key.endsWith('?') + const baseKey = isOptional ? key.slice(0, -1) : key + + // Check if base key contains forbidden characters that require wrapping // TypeScript identifier pattern: starts with letter/underscore/dollar, followed by letters/numbers/underscore/dollar - const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) + const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(baseKey) - if ( - !isValidIdentifier || - key.includes('"') || - key.includes("'") || - key.includes('`') - ) { - return `[\`${key}\`]` + if (!isValidIdentifier || baseKey.includes("'")) { + // Use single quotes for keys, escape if needed + const escapedKey = baseKey.includes("'") + ? baseKey.replace(/'/g, "\\'") + : baseKey + const wrapped = `'${escapedKey}'` + return isOptional ? `${wrapped}?` : wrapped } return key } diff --git a/packages/generator/tsconfig.json b/packages/generator/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/generator/tsconfig.json +++ b/packages/generator/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/hookform/package.json b/packages/hookform/package.json index 3fe6974..b523c54 100644 --- a/packages/hookform/package.json +++ b/packages/hookform/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/hookform", - "version": "0.0.1", + "version": "0.1.11", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -24,28 +25,29 @@ "dependencies": { "@devup-api/fetch": "workspace:^", "@devup-api/zod": "workspace:^", - "@hookform/resolvers": ">=5.2.2", - "react-hook-form": ">=7.70.0" + "@hookform/resolvers": ">=5.9.1", + "react-hook-form": ">=7.86.0" }, "peerDependencies": { - "@tanstack/react-query": ">=5.0.0", + "@tanstack/react-query": ">=5.102.2", "react": "*", "react-hook-form": "*", "zod": "*" }, "devDependencies": { - "@tanstack/react-query": "^5.90.16", - "@testing-library/react": "^16.3.1", - "@types/node": "^25.0", + "@tanstack/react-query": "^5", + "@testing-library/react": "^16.3", + "@typescript/typescript6": "^6.0", + "@types/node": "^26.2", "@types/react": "^19.2", - "bun-test-env-dom": "^1.0.3", - "happy-dom": "^20.0.11", - "react": "^19.2.3", - "react-dom": "^19.2.3", - "typescript": "^5.9", - "zod": "^4.3", + "bun-test-env-dom": "^1.0", + "happy-dom": "^20.11", + "react": "^19.2", + "react-dom": "^19.2", + "typescript": "^7.0", + "zod": "^4.4", "rollup-plugin-preserve-directives": "^0.4", - "vite": "^7.3", - "vite-plugin-dts": "^4.5" + "vite": "^8.2", + "vite-plugin-dts": "^5.0" } } diff --git a/packages/hookform/src/types.ts b/packages/hookform/src/types.ts index 3951013..96ede8a 100644 --- a/packages/hookform/src/types.ts +++ b/packages/hookform/src/types.ts @@ -2,17 +2,9 @@ import type { Additional, ConditionalKeys, DevupApi, + DevupApiMethodKey, + DevupApiMethodScope, DevupApiServers, - DevupDeleteApiStructKey, - DevupDeleteApiStructScope, - DevupGetApiStructKey, - DevupGetApiStructScope, - DevupPatchApiStructKey, - DevupPatchApiStructScope, - DevupPostApiStructKey, - DevupPostApiStructScope, - DevupPutApiStructKey, - DevupPutApiStructScope, ExtractValue, } from '@devup-api/fetch' import type { QueryClient, UseMutationResult } from '@tanstack/react-query' @@ -31,58 +23,22 @@ export type FetchMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' export type MethodApiStructScope< S extends string, M extends HttpMethod, -> = M extends 'post' - ? DevupPostApiStructScope - : M extends 'put' - ? DevupPutApiStructScope - : M extends 'patch' - ? DevupPatchApiStructScope - : M extends 'delete' - ? DevupDeleteApiStructScope - : never +> = DevupApiMethodScope export type MethodApiStructKey< S extends string, M extends HttpMethod, -> = M extends 'post' - ? DevupPostApiStructKey - : M extends 'put' - ? DevupPutApiStructKey - : M extends 'patch' - ? DevupPatchApiStructKey - : M extends 'delete' - ? DevupDeleteApiStructKey - : never +> = DevupApiMethodKey export type FetchMethodApiStructScope< S extends string, M extends FetchMethod, -> = M extends 'get' - ? DevupGetApiStructScope - : M extends 'post' - ? DevupPostApiStructScope - : M extends 'put' - ? DevupPutApiStructScope - : M extends 'patch' - ? DevupPatchApiStructScope - : M extends 'delete' - ? DevupDeleteApiStructScope - : never +> = DevupApiMethodScope export type FetchMethodApiStructKey< S extends string, M extends FetchMethod, -> = M extends 'get' - ? DevupGetApiStructKey - : M extends 'post' - ? DevupPostApiStructKey - : M extends 'put' - ? DevupPutApiStructKey - : M extends 'patch' - ? DevupPatchApiStructKey - : M extends 'delete' - ? DevupDeleteApiStructKey - : never +> = DevupApiMethodKey /** * Configuration for auto-fetching default values @@ -91,10 +47,6 @@ export interface FetchDefaultValuesConfig< S extends ConditionalKeys, FM extends FetchMethod = 'get', FP extends FetchMethodApiStructKey = FetchMethodApiStructKey, - FO extends Additional> = Additional< - FP, - FetchMethodApiStructScope - >, > { /** * HTTP method for fetching default values @@ -108,11 +60,16 @@ export interface FetchDefaultValuesConfig< /** * Request options for fetching (params, query, headers) */ - options?: Omit + options?: Omit>, 'body'> /** * Transform the fetched response to form default values */ - transform?: (response: ExtractValue) => unknown + transform?: ( + response: ExtractValue< + Additional>, + 'response' + >, + ) => unknown } /** diff --git a/packages/next-plugin/README.md b/packages/next-plugin/README.md index 687b939..78898aa 100644 --- a/packages/next-plugin/README.md +++ b/packages/next-plugin/README.md @@ -72,6 +72,16 @@ interface DevupApiOptions { * @default true */ responseDefaultNonNullable?: boolean + + /** + * Generate operationId-based Server Action wrappers. + * Disable with false or { enabled: false }. + * @default true + */ + serverActions?: boolean | { + enabled?: boolean + baseUrl?: string + } } ``` @@ -83,14 +93,16 @@ When using Turbopack (Next.js 13+), the plugin: 1. Reads your `openapi.json` file 2. Generates TypeScript interface definitions 3. Creates a URL map and sets it as `process.env.DEVUP_API_URL_MAP` -4. Makes types available for use with `@devup-api/fetch` +4. Generates Server Actions in `df/server.ts` by default +5. Makes types available for use with `@devup-api/fetch` ### Webpack Mode When using Webpack, the plugin uses `@devup-api/webpack-plugin` internally to: 1. Generate types during build time 2. Inject URL map via webpack DefinePlugin -3. Make types available for use with `@devup-api/fetch` +3. Generate Server Actions in `df/server.ts` by default +4. Make types available for use with `@devup-api/fetch` ## TypeScript Configuration diff --git a/packages/next-plugin/package.json b/packages/next-plugin/package.json index 80941d7..f64e84b 100644 --- a/packages/next-plugin/package.json +++ b/packages/next-plugin/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/next-plugin", - "version": "0.1.8", + "version": "0.1.18", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -30,8 +31,8 @@ "@devup-api/core": "*" }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "@types/webpack": "^5.28", - "typescript": "^5.9" + "typescript": "^7.0" } } diff --git a/packages/next-plugin/src/__tests__/plugin.test.ts b/packages/next-plugin/src/__tests__/plugin.test.ts index 2e32bbc..361cfef 100644 --- a/packages/next-plugin/src/__tests__/plugin.test.ts +++ b/packages/next-plugin/src/__tests__/plugin.test.ts @@ -41,12 +41,10 @@ const mockSchema = { const mockUrlMap = { getUsers: { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, '/users': { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, } @@ -95,37 +93,40 @@ test.each([ { openapiFiles: 'custom-openapi.json' }, ['custom-openapi.json'], ], -] as const)('devupApi handles turbo mode: config=%s, options=%s', (config: NextConfig, options: - | DevupApiOptions - | undefined, expectedFiles: string[]) => { - const originalEnv = process.env.TURBOPACK - process.env.TURBOPACK = '1' - - try { - const result = devupApi(config, options) - - expect(mockCreateTmpDir).toHaveBeenCalledWith(options?.tempDir) - expect(mockReadOpenapis).toHaveBeenCalledWith(expectedFiles) - expect(mockGenerateInterface).toHaveBeenCalledWith( - { 'openapi.json': mockSchema }, - options || {}, - ) - expect(mockWriteInterface).toHaveBeenCalledWith( - join('df', 'api.d.ts'), - mockInterfaceContent, - ) - expect(mockCreateUrlMap).toHaveBeenCalledWith( - { 'openapi.json': mockSchema }, - options || {}, - ) - expect(result.env).toEqual({ - DEVUP_API_URL_MAP: JSON.stringify(mockUrlMap), - }) - expect(result).toBe(config) - } finally { - process.env.TURBOPACK = originalEnv - } -}) +] as const)( + 'devupApi handles turbo mode: config=%s, options=%s', + (config: NextConfig, options: + | DevupApiOptions + | undefined, expectedFiles: string[]) => { + const originalEnv = process.env.TURBOPACK + process.env.TURBOPACK = '1' + + try { + const result = devupApi(config, options) + + expect(mockCreateTmpDir).toHaveBeenCalledWith(options?.tempDir) + expect(mockReadOpenapis).toHaveBeenCalledWith(expectedFiles) + expect(mockGenerateInterface).toHaveBeenCalledWith( + { 'openapi.json': mockSchema }, + options || {}, + ) + expect(mockWriteInterface).toHaveBeenCalledWith( + join('df', 'api.d.ts'), + mockInterfaceContent, + ) + expect(mockCreateUrlMap).toHaveBeenCalledWith( + { 'openapi.json': mockSchema }, + options || {}, + ) + expect(result.env).toEqual({ + DEVUP_API_URL_MAP: JSON.stringify(mockUrlMap), + }) + expect(result).toBe(config) + } finally { + process.env.TURBOPACK = originalEnv + } + }, +) test('devupApi handles turbo mode with existing env', () => { const originalEnv = process.env.TURBOPACK @@ -170,22 +171,23 @@ test.each([ [{ webpack: undefined }, undefined], [{}, { tempDir: 'custom-dir' }], [{ webpack: undefined }, { openapiFile: 'custom-openapi.json' }], -] as const)('devupApi handles webpack mode: config=%s, options=%s', (config: NextConfig, options: - | DevupApiOptions - | undefined) => { - const originalEnv = process.env.TURBOPACK - delete process.env.TURBOPACK - - try { - const result = devupApi(config, options) - - expect(result.webpack).toBeDefined() - expect(typeof result.webpack).toBe('function') - expect(result).toBe(config) - } finally { - process.env.TURBOPACK = originalEnv - } -}) +] as const)( + 'devupApi handles webpack mode: config=%s, options=%s', + (config: NextConfig, options: DevupApiOptions | undefined) => { + const originalEnv = process.env.TURBOPACK + delete process.env.TURBOPACK + + try { + const result = devupApi(config, options) + + expect(result.webpack).toBeDefined() + expect(typeof result.webpack).toBe('function') + expect(result).toBe(config) + } finally { + process.env.TURBOPACK = originalEnv + } + }, +) test('devupApi handles webpack mode with existing webpack function', () => { const originalEnv = process.env.TURBOPACK diff --git a/packages/next-plugin/src/plugin.ts b/packages/next-plugin/src/plugin.ts index 4c8fd54..a62c23e 100644 --- a/packages/next-plugin/src/plugin.ts +++ b/packages/next-plugin/src/plugin.ts @@ -1,15 +1,20 @@ -import { join, relative, resolve } from 'node:path' +import { relative, resolve } from 'node:path' import type { DevupApiOptions } from '@devup-api/core' import { createUrlMap, generateCrudConfigCode, generateCrudConfigTypes, generateInterface, + generateServerActionCode, + generateServerActionTypes, generateZodSchemas, generateZodTypeDeclarations, } from '@devup-api/generator' import { createTmpDir, + type DevupGenerators, + type DevupIOSync, + generateDevupArtifacts, normalizeOpenapiFiles, readOpenapis, writeInterface, @@ -31,39 +36,27 @@ export function devupApi( const isTurbo = process.env.TURBOPACK === '1' || process.env.TURBOPACK === 'auto' if (isTurbo) { - const tempDir = createTmpDir(options?.tempDir) - const openapiFiles = normalizeOpenapiFiles(options?.openapiFiles) - const schemas = readOpenapis(openapiFiles) - - // Generate API interface file - writeInterface( - join(tempDir, 'api.d.ts'), - generateInterface(schemas, options), - ) - - // Generate Zod schemas file - writeInterface( - join(tempDir, 'zod-schemas.js'), - generateZodSchemas(schemas, options), - ) - - // Generate Zod type declarations - writeInterface( - join(tempDir, 'zod.d.ts'), - generateZodTypeDeclarations(schemas, options), - ) + const io: DevupIOSync = { + createTmpDir, + normalizeOpenapiFiles, + readOpenapis, + writeInterface, + } - // Generate CRUD configs file - writeInterface( - join(tempDir, 'crud-configs.jsx'), - generateCrudConfigCode(schemas), - ) + const generators: DevupGenerators = { + generateInterface, + generateZodSchemas, + generateZodTypeDeclarations, + generateCrudConfigCode, + generateCrudConfigTypes, + generateServerActionCode, + generateServerActionTypes, + createUrlMap, + } - // Generate CRUD config type declarations - writeInterface(join(tempDir, 'ui.d.ts'), generateCrudConfigTypes(schemas)) + const { tempDir, urlMap } = generateDevupArtifacts(io, generators, options) - // Create urlMap and set environment variable - const urlMap = createUrlMap(schemas, options) + // Set environment variable config.env ??= {} if (urlMap && Object.keys(urlMap).length > 0) { Object.assign(config.env, { @@ -80,6 +73,7 @@ export function devupApi( '@devup-api/ui/crud': toRelativePath( resolve(tempDir, 'crud-configs.jsx'), ), + '@devup-api/fetch/server': toRelativePath(resolve(tempDir, 'server.ts')), }) return config diff --git a/packages/next-plugin/tsconfig.json b/packages/next-plugin/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/next-plugin/tsconfig.json +++ b/packages/next-plugin/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/react-query/package.json b/packages/react-query/package.json index de8d122..36baec9 100644 --- a/packages/react-query/package.json +++ b/packages/react-query/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/react-query", - "version": "0.1.5", + "version": "0.1.21", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -20,18 +21,18 @@ "access": "public" }, "dependencies": { - "@devup-api/fetch": "workspace:^", - "@tanstack/react-query": ">=5.90" + "@devup-api/fetch": "workspace:^" }, "peerDependencies": { "react": "*", - "@tanstack/react-query": "*" + "@tanstack/react-query": ">=5.102.2" }, "devDependencies": { + "@tanstack/react-query": "^5", "@testing-library/react-hooks": "^8.0.1", - "@types/node": "^25.0", + "@types/node": "^26.2", "@types/react": "^19.2", - "happy-dom": "^20.0.11", - "typescript": "^5.9" + "happy-dom": "^20.11.6", + "typescript": "^7.0" } } diff --git a/packages/react-query/src/__tests__/create-query-client.test.ts b/packages/react-query/src/__tests__/create-query-client.test.ts index ec051dd..2d2d664 100644 --- a/packages/react-query/src/__tests__/create-query-client.test.ts +++ b/packages/react-query/src/__tests__/create-query-client.test.ts @@ -9,33 +9,39 @@ test.each([ ['https://api.example.com/'], ['http://localhost:3000'], ['http://localhost:3000/'], -] as const)('createQueryClient returns DevupQueryClient instance: %s', (baseUrl) => { - const api = createApi({ baseUrl }) - const queryClient = createQueryClient(api) - expect(queryClient).toBeInstanceOf(DevupQueryClient) -}) +] as const)( + 'createQueryClient returns DevupQueryClient instance: %s', + (baseUrl) => { + const api = createApi({ baseUrl }) + const queryClient = createQueryClient(api) + expect(queryClient).toBeInstanceOf(DevupQueryClient) + }, +) test.each([ ['https://api.example.com', undefined], ['https://api.example.com', {}], ['https://api.example.com', { headers: { Authorization: 'Bearer token' } }], -] as const)('createQueryClient accepts api with defaultOptions: %s', (baseUrl, defaultOptions) => { - const api = createApi({ baseUrl, ...defaultOptions }) - const queryClient = createQueryClient(api) - expect(queryClient).toBeInstanceOf(DevupQueryClient) -}) +] as const)( + 'createQueryClient accepts api with defaultOptions: %s', + (baseUrl, defaultOptions) => { + const api = createApi({ baseUrl, ...defaultOptions }) + const queryClient = createQueryClient(api) + expect(queryClient).toBeInstanceOf(DevupQueryClient) + }, +) -test.each([ - ['openapi.json'], - ['openapi2.json'], -] as const)('createQueryClient accepts api with serverName: %s', (serverName) => { - const api = createApi({ - baseUrl: 'https://api.example.com', - serverName: serverName as any, - }) - const queryClient = createQueryClient(api) - expect(queryClient).toBeInstanceOf(DevupQueryClient) -}) +test.each([['openapi.json'], ['openapi2.json']] as const)( + 'createQueryClient accepts api with serverName: %s', + (serverName) => { + const api = createApi({ + baseUrl: 'https://api.example.com', + serverName: serverName as any, + }) + const queryClient = createQueryClient(api) + expect(queryClient).toBeInstanceOf(DevupQueryClient) + }, +) test('createQueryClient uses default serverName when not provided', () => { const api = createApi({ baseUrl: 'https://api.example.com' }) diff --git a/packages/react-query/src/__tests__/query-client.test.ts b/packages/react-query/src/__tests__/query-client.test.ts index 7d4dc54..0108db4 100644 --- a/packages/react-query/src/__tests__/query-client.test.ts +++ b/packages/react-query/src/__tests__/query-client.test.ts @@ -1,53 +1,54 @@ /** biome-ignore-all lint/suspicious/noExplicitAny: any is used to allow for flexibility in the type */ import { expect, test } from 'bun:test' import { createApi } from '@devup-api/fetch' -import { DevupQueryClient, getQueryKey } from '../query-client' +import { DevupQueryClient } from '../query-client' + +const api = createApi({ baseUrl: 'https://api.example.com' }) +const queryClient = new DevupQueryClient(api as any) test('DevupQueryClient constructor', () => { - const api = createApi({ baseUrl: 'https://api.example.com' }) - const queryClient = new DevupQueryClient(api) expect(queryClient).toBeInstanceOf(DevupQueryClient) }) test('DevupQueryClient useQuery method exists', () => { - const api = createApi({ baseUrl: 'https://api.example.com' }) - const queryClient = new DevupQueryClient(api) expect(typeof queryClient.useQuery).toBe('function') }) test('DevupQueryClient useMutation method exists', () => { - const api = createApi({ baseUrl: 'https://api.example.com' }) - const queryClient = new DevupQueryClient(api) expect(typeof queryClient.useMutation).toBe('function') }) test('DevupQueryClient useSuspenseQuery method exists', () => { - const api = createApi({ baseUrl: 'https://api.example.com' }) - const queryClient = new DevupQueryClient(api) expect(typeof queryClient.useSuspenseQuery).toBe('function') }) test('DevupQueryClient useInfiniteQuery method exists', () => { - const api = createApi({ baseUrl: 'https://api.example.com' }) - const queryClient = new DevupQueryClient(api) expect(typeof queryClient.useInfiniteQuery).toBe('function') }) +test('DevupQueryClient useQueries method exists', () => { + expect(typeof queryClient.useQueries).toBe('function') +}) + test('getQueryKey returns correct key without options', () => { - const result = getQueryKey('get', '/test', undefined) + const result = queryClient.getQueryKey('get' as any, '/test' as any) expect(result).toEqual(['get', '/test']) }) test('getQueryKey returns correct key with options', () => { const options = { params: { id: '123' } } - const result = getQueryKey('get', '/test', options) + const result = queryClient.getQueryKey( + 'get' as any, + '/test' as any, + options as any, + ) expect(result).toEqual(['get', '/test', options]) }) test('getQueryKey handles different methods', () => { const methods = ['get', 'post', 'put', 'delete', 'patch'] as const for (const method of methods) { - const result = getQueryKey(method, '/test', undefined) + const result = queryClient.getQueryKey(method as any, '/test' as any) expect(result).toEqual([method, '/test']) } }) @@ -55,21 +56,98 @@ test('getQueryKey handles different methods', () => { test('getQueryKey handles different paths', () => { const paths = ['/test', '/users', '/users/{id}'] as const for (const path of paths) { - const result = getQueryKey('get', path, undefined) + const result = queryClient.getQueryKey('get' as any, path as any) expect(result).toEqual(['get', path]) } }) test('getQueryKey handles different option types', () => { const options1 = { params: { id: '123' } } - const result1 = getQueryKey('get', '/test', options1) + const result1 = queryClient.getQueryKey( + 'get' as any, + '/test' as any, + options1 as any, + ) expect(result1).toEqual(['get', '/test', options1]) const options2 = { query: { page: 1 } } - const result2 = getQueryKey('get', '/test', options2) + const result2 = queryClient.getQueryKey( + 'get' as any, + '/test' as any, + options2 as any, + ) expect(result2).toEqual(['get', '/test', options2]) const options3 = { params: { id: '123' }, query: { page: 1 } } - const result3 = getQueryKey('get', '/test', options3) + const result3 = queryClient.getQueryKey( + 'get' as any, + '/test' as any, + options3 as any, + ) expect(result3).toEqual(['get', '/test', options3]) }) + +test('getQueryKey normalizes method to lowercase', () => { + const upper = queryClient.getQueryKey('GET' as any, '/test' as any) + const lower = queryClient.getQueryKey('get' as any, '/test' as any) + expect(upper).toEqual(lower) + expect(upper).toEqual(['get', '/test']) +}) + +test('getQueryKey normalizes method to lowercase with options', () => { + const options = { params: { id: '123' } } + const upper = queryClient.getQueryKey( + 'POST' as any, + '/test' as any, + options as any, + ) + const lower = queryClient.getQueryKey( + 'post' as any, + '/test' as any, + options as any, + ) + expect(upper).toEqual(lower) + expect(upper).toEqual(['post', '/test', options]) +}) + +test('getQueryKey normalizes all HTTP methods', () => { + const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] as const + for (const method of methods) { + const result = queryClient.getQueryKey(method as any, '/test' as any) + expect(result[0]).toBe(method.toLowerCase()) + } +}) + +test('resolveEndpoint falls back to key itself when no URL map entry', () => { + const resolved = api.resolveEndpoint('GET' as any, '/users' as any) + expect(resolved.url).toBe('/users') + expect(resolved.method).toBe('GET') +}) + +test('resolveEndpoint returns key as url for unknown operationId', () => { + const resolved = api.resolveEndpoint('GET' as any, 'unknownOp' as any) + expect(resolved.url).toBe('unknownOp') +}) + +test('getQueryKey produces consistent keys for same resolved URL', () => { + const resolvedUrl = api.resolveEndpoint('GET' as any, '/users' as any).url + const key1 = queryClient.getQueryKey('GET' as any, resolvedUrl as any) + const key2 = queryClient.getQueryKey('get' as any, '/users' as any) + expect(key1).toEqual(key2) + expect(key1).toEqual(['get', '/users']) +}) + +test('getQueryKey produces identical keys when resolved URL matches path', () => { + const key1 = queryClient.getQueryKey( + 'GET' as any, + '/users' as any, + { query: { page: 1 } } as any, + ) + const key2 = queryClient.getQueryKey( + 'get' as any, + '/users' as any, + { query: { page: 1 } } as any, + ) + expect(key1).toEqual(key2) + expect(key1).toEqual(['get', '/users', { query: { page: 1 } }]) +}) diff --git a/packages/react-query/src/__tests__/query-client.test.tsx b/packages/react-query/src/__tests__/query-client.test.tsx index 0311d81..0a930ca 100644 --- a/packages/react-query/src/__tests__/query-client.test.tsx +++ b/packages/react-query/src/__tests__/query-client.test.tsx @@ -53,6 +53,7 @@ test('DevupQueryClient useQuery with GET method', async () => { ) expect(result.current.data).toEqual({ id: 1, name: 'test' }) + expect(result.current.queryKey).toEqual(['get', '/test']) }) test('DevupQueryClient useQuery with options', async () => { @@ -75,6 +76,11 @@ test('DevupQueryClient useQuery with options', async () => { ) expect(result.current.data).toEqual({ id: 1, name: 'test' }) + expect(result.current.queryKey).toEqual([ + 'get', + '/test', + { params: { id: '123' } }, + ]) }) test('DevupQueryClient useQuery with queryOptions', async () => { @@ -97,6 +103,7 @@ test('DevupQueryClient useQuery with queryOptions', async () => { ) expect(result.current.data).toEqual({ id: 1, name: 'test' }) + expect(result.current.queryKey).toEqual(['get', '/test']) }) test('DevupQueryClient useMutation with POST method', async () => { @@ -176,6 +183,7 @@ test('DevupQueryClient useSuspenseQuery with GET method', async () => { ) expect(result.current.data).toEqual({ id: 1, name: 'test' }) + expect(result.current.queryKey).toEqual(['get', '/test']) }) test('DevupQueryClient useSuspenseQuery with options', async () => { @@ -198,6 +206,11 @@ test('DevupQueryClient useSuspenseQuery with options', async () => { ) expect(result.current.data).toEqual({ id: 1, name: 'test' }) + expect(result.current.queryKey).toEqual([ + 'get', + '/test', + { params: { id: '123' } }, + ]) }) test('DevupQueryClient useInfiniteQuery with GET method', async () => { @@ -224,6 +237,7 @@ test('DevupQueryClient useInfiniteQuery with GET method', async () => { pages: [{ id: 1, name: 'test' }], pageParams: [1], }) + expect(result.current.queryKey).toEqual(['get', '/test', {}]) }) test('DevupQueryClient useInfiniteQuery with options', async () => { @@ -251,6 +265,11 @@ test('DevupQueryClient useInfiniteQuery with options', async () => { pages: [{ id: 1, name: 'test' }], pageParams: [1], }) + expect(result.current.queryKey).toEqual([ + 'get', + '/test', + { query: { page: 1 } }, + ]) }) test('DevupQueryClient useQuery with different HTTP methods', async () => { @@ -355,3 +374,136 @@ test('DevupQueryClient useInfiniteQuery with different HTTP methods', async () = }) } }) + +test('DevupQueryClient useQueries with multiple queries', async () => { + const api = createApi({ baseUrl: 'https://api.example.com' }) + const queryClient = new DevupQueryClient(api) + + const { result } = renderHook( + () => + queryClient.useQueries([ + ['get', '/test1'], + ['get', '/test2'], + ]), + { wrapper: createWrapper() }, + ) + + await waitFor( + () => { + expect(result.current.every((r) => r.isSuccess)).toBe(true) + }, + { timeout: 5000 }, + ) + + expect(result.current).toHaveLength(2) + expect(result.current[0].data).toEqual({ id: 1, name: 'test' }) + expect(result.current[1].data).toEqual({ id: 1, name: 'test' }) +}) + +test('DevupQueryClient useQueries with options', async () => { + const api = createApi({ baseUrl: 'https://api.example.com' }) + const queryClient = new DevupQueryClient(api) + + const { result } = renderHook( + () => + queryClient.useQueries([ + ['get', '/test' as any, { params: { id: '123' } }], + ]), + { wrapper: createWrapper() }, + ) + + await waitFor( + () => { + expect(result.current[0].isSuccess).toBe(true) + }, + { timeout: 5000 }, + ) + + expect(result.current[0].data).toEqual({ id: 1, name: 'test' }) +}) + +test('DevupQueryClient useQueries with combine', async () => { + const api = createApi({ baseUrl: 'https://api.example.com' }) + const queryClient = new DevupQueryClient(api) + + const { result } = renderHook( + () => + queryClient.useQueries( + [ + ['get', '/test1' as any], + ['get', '/test2' as any], + ], + { + combine: (results) => ({ + data: results.map((r) => r.data), + pending: results.some((r) => r.isPending), + }), + }, + ), + { wrapper: createWrapper() }, + ) + + await waitFor( + () => { + expect(result.current.pending).toBe(false) + }, + { timeout: 5000 }, + ) + + expect(result.current.data).toEqual([ + { id: 1, name: 'test' }, + { id: 1, name: 'test' }, + ]) +}) + +test('DevupQueryClient useQueries with different HTTP methods', async () => { + const api = createApi({ baseUrl: 'https://api.example.com' }) + const queryClient = new DevupQueryClient(api) + + const { result } = renderHook( + () => + queryClient.useQueries([ + ['get', '/test' as any], + ['GET', '/test' as any], + ['post', '/test' as any], + ]), + { wrapper: createWrapper() }, + ) + + await waitFor( + () => { + expect(result.current.every((r) => r.isSuccess)).toBe(true) + }, + { timeout: 5000 }, + ) + + expect(result.current).toHaveLength(3) +}) + +test('DevupQueryClient useQueries with queryOptions', async () => { + const api = createApi({ baseUrl: 'https://api.example.com' }) + const queryClient = new DevupQueryClient(api) + + const { result } = renderHook( + () => + queryClient.useQueries([ + ['get', '/test' as any, undefined, { staleTime: 1000 }], + [ + 'get', + '/test2' as any, + { params: { id: '123' } }, + { staleTime: 2000 }, + ], + ]), + { wrapper: createWrapper() }, + ) + + await waitFor( + () => { + expect(result.current.every((r) => r.isSuccess)).toBe(true) + }, + { timeout: 5000 }, + ) + + expect(result.current).toHaveLength(2) +}) diff --git a/packages/react-query/src/__tests__/types.test.ts b/packages/react-query/src/__tests__/types.test.ts new file mode 100644 index 0000000..bf68750 --- /dev/null +++ b/packages/react-query/src/__tests__/types.test.ts @@ -0,0 +1,213 @@ +/** + * Type tests for DevupQueryClient + * Verify that useQueries type inference works correctly per element + */ +import { describe, expectTypeOf, test } from 'bun:test' +import type { DevupGetApiStruct } from '@devup-api/core' +import type { DevupQueryClient } from '../query-client' + +// ============================================================================= +// Test Fixtures +// ============================================================================= + +declare module '@devup-api/core' { + interface DevupApiServers { + 'react-query-test.json': never + } + + interface DevupGetApiStruct { + 'react-query-test.json': { + '/users': { + response: { id: number; name: string }[] + error: { message: string } + } + '/users/{id}': { + params: { id: string } + response: { id: number; name: string; email: string } + error: { message: string; code: number } + } + '/posts': { + response: { id: number; title: string }[] + error: { message: string } + } + } + } + + interface DevupPostApiStruct { + 'react-query-test.json': { + '/users': { + body: { name: string; email: string } + response: { id: number } + error: { message: string } + } + } + } + + interface DevupDeleteApiStruct { + 'react-query-test.json': { + '/users/{id}': { + params: { id: string } + response: { success: boolean } + error: { message: string } + } + } + } +} + +type QC = DevupQueryClient<'react-query-test.json'> + +// ============================================================================= +// useQueries - Per-element return type inference +// ============================================================================= + +describe('useQueries per-element type inference', () => { + test('different endpoints return different response types', () => { + type Result = ReturnType< + ( + qc: QC, + ) => ReturnType< + typeof qc.useQueries<[['get', '/users'], ['get', '/posts']]> + > + > + + expectTypeOf().toEqualTypeOf< + { id: number; name: string }[] | undefined + >() + expectTypeOf().toEqualTypeOf< + { id: number; title: string }[] | undefined + >() + }) + + test('different endpoints return different error types', () => { + type Result = ReturnType< + ( + qc: QC, + ) => ReturnType< + typeof qc.useQueries< + [ + ['get', '/users/{id}', { params: { id: string } }], + ['get', '/users'], + ] + > + > + > + + expectTypeOf().toEqualTypeOf< + { id: number; name: string; email: string } | undefined + >() + expectTypeOf().toEqualTypeOf<{ + message: string + code: number + } | null>() + expectTypeOf().toEqualTypeOf< + { id: number; name: string }[] | undefined + >() + expectTypeOf().toEqualTypeOf<{ + message: string + } | null>() + }) + + test('single element preserves exact type', () => { + type Result = ReturnType< + (qc: QC) => ReturnType> + > + + expectTypeOf().toEqualTypeOf< + { id: number; title: string }[] | undefined + >() + }) + + test('result types are not intersected', () => { + type Result = ReturnType< + ( + qc: QC, + ) => ReturnType< + typeof qc.useQueries<[['get', '/users'], ['get', '/posts']]> + > + > + + // result[0] should NOT have title (from /posts) + type Data0 = NonNullable[number] + expectTypeOf< + 'title' extends keyof Data0 ? true : false + >().toEqualTypeOf() + + // result[1] should NOT have name (from /users) + type Data1 = NonNullable[number] + expectTypeOf< + 'name' extends keyof Data1 ? true : false + >().toEqualTypeOf() + }) +}) + +// ============================================================================= +// useQueries - params constraint +// ============================================================================= + +describe('useQueries params constraint', () => { + test('endpoint with params accepts params option', () => { + // This should be valid: correct params provided + type _Valid = ReturnType< + ( + qc: QC, + ) => ReturnType< + typeof qc.useQueries< + [['get', '/users/{id}', { params: { id: string } }]] + > + > + > + }) + + test('endpoint without params has optional options', () => { + // This should be valid: no options needed + type _Valid = ReturnType< + (qc: QC) => ReturnType> + > + }) +}) + +// ============================================================================= +// useQuery - single query type inference (baseline) +// ============================================================================= + +describe('useQuery type inference baseline', () => { + test('response type inferred from endpoint', () => { + type Result = ReturnType< + ( + qc: QC, + ) => ReturnType< + typeof qc.useQuery< + 'get', + DevupGetApiStruct['react-query-test.json'], + '/users' + > + > + > + + expectTypeOf().toEqualTypeOf< + { id: number; name: string }[] | undefined + >() + }) + + test('error type inferred from endpoint', () => { + type Result = ReturnType< + ( + qc: QC, + ) => ReturnType< + typeof qc.useQuery< + 'get', + DevupGetApiStruct['react-query-test.json'], + '/users/{id}' + > + > + > + + expectTypeOf().toEqualTypeOf< + { id: number; name: string; email: string } | undefined + >() + expectTypeOf().toEqualTypeOf<{ + message: string + code: number + } | null>() + }) +}) diff --git a/packages/react-query/src/query-client.ts b/packages/react-query/src/query-client.ts index 67441d8..ae15caf 100644 --- a/packages/react-query/src/query-client.ts +++ b/packages/react-query/src/query-client.ts @@ -4,31 +4,117 @@ import type { ConditionalApiOption, ConditionalKeys, DevupApi, + DevupApiMethodKey, + DevupApiMethodKeys, + DevupApiMethodScope, DevupApiRequestInit, DevupApiResponse, DevupApiServers, - DevupDeleteApiStructScope, - DevupGetApiStructScope, - DevupPatchApiStructScope, - DevupPostApiStructScope, - DevupPutApiStructScope, + DevupPrecomputedScopes, ExtractValue, } from '@devup-api/fetch' import { useInfiniteQuery, useMutation, + useQueries, useQuery, useSuspenseQuery, } from '@tanstack/react-query' -export function getQueryKey( +type LowercaseMethodKeys = 'get' | 'post' | 'put' | 'delete' | 'patch' + +type ResolveScopePrecomputed< + S extends string, + M extends string, + P extends string, +> = S extends keyof DevupPrecomputedScopes + ? P extends keyof ExtractValue< + ExtractValue, + M & LowercaseMethodKeys + > + ? ExtractValue< + ExtractValue, + M & LowercaseMethodKeys + >[P] & + object + : object + : never + +type ResolveScope< + S extends ConditionalKeys, + M extends DevupApiMethodKeys, + P extends string, +> = S extends keyof DevupPrecomputedScopes + ? ResolveScopePrecomputed, P> + : Additional> + +type UseQueryOptions = Omit< + Parameters< + typeof useQuery, ExtractValue> + >[0], + 'queryFn' | 'queryKey' +> + +type UseQueriesTuple = [ + method: M, + path: P, + options?: ConditionalApiOption, + queryOptions?: UseQueryOptions, +] + +type UseQueriesEntry> = { + [M in LowercaseMethodKeys]: { + [P in DevupApiMethodKey]: + | UseQueriesTuple, P, M> + | UseQueriesTuple, P, Uppercase> + }[DevupApiMethodKey] +}[LowercaseMethodKeys] + +type InferUseQueryResult< + S extends ConditionalKeys, + Q, +> = Q extends [ + infer M extends DevupApiMethodKeys, + infer P extends string, + ...unknown[], +] + ? ReturnType< + typeof useQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + > + : ReturnType + +type UseQueriesResults< + S extends ConditionalKeys, + T extends readonly unknown[], +> = { -readonly [K in keyof T]: InferUseQueryResult } + +function getQueryKey(method: M, path: P): [string, P] +function getQueryKey( method: M, path: P, options: OP, -): [M, P, NonNullable] | [M, P] { +): [string, P, NonNullable] +function getQueryKey( + method: M, + path: P, + options?: OP, +): [string, P, NonNullable] | [string, P] { + const normalizedMethod = method.toLowerCase() return options === undefined - ? ([method, path] as [M, P]) - : ([method, path, options] as [M, P, NonNullable]) + ? ([normalizedMethod, path] as [string, P]) + : ([normalizedMethod, path, options] as [string, P, NonNullable]) +} + +function unwrapResponse({ + data, + error, + isError, +}: DevupApiResponse) { + if (isError) throw error + return data } export class DevupQueryClient> { @@ -38,120 +124,90 @@ export class DevupQueryClient> { this.api = api } - useQuery< - M extends - | 'get' - | 'post' - | 'put' - | 'delete' - | 'patch' - | 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'PATCH', - ST extends { - get: DevupGetApiStructScope - post: DevupPostApiStructScope - put: DevupPutApiStructScope - delete: DevupDeleteApiStructScope - patch: DevupPatchApiStructScope - GET: DevupGetApiStructScope - POST: DevupPostApiStructScope - PUT: DevupPutApiStructScope - DELETE: DevupDeleteApiStructScope - PATCH: DevupPatchApiStructScope - }[M], - T extends ConditionalKeys, - O extends Additional, - D extends ExtractValue, - E extends ExtractValue, - >( + private createQueryFn(queryKey: unknown[]) { + return ({ signal }: { signal: AbortSignal }) => { + const [method, path, ...rest] = queryKey + // biome-ignore lint/suspicious/noExplicitAny: can't use method as a function + return (this.api as any) + [method as string](path, { + signal, + ...(rest[0] as DevupApiRequestInit), + }) + .then(unwrapResponse) + } + } + + getQueryKey>( + method: M, + path: T, + options?: ConditionalApiOption>, + ) { + const resolved = this.api.resolveEndpoint(method, path) + return getQueryKey(method, resolved.url as T, options) + } + + useQuery>( method: M, path: T, ...options: ApiOption< - O, + ResolveScope, [ - queryOptions?: Omit< - Parameters>[0], - 'queryFn' | 'queryKey' - >, - queryClient?: Parameters>[1], + queryOptions?: UseQueryOptions>, + queryClient?: Parameters[1], ] > - ): ReturnType> { - return useQuery( + ): ReturnType< + typeof useQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + > & { + queryKey: [M, T, ...unknown[]] + } { + const queryKey = this.getQueryKey(method, path, options[0]) + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + const result = useQuery( { - queryKey: getQueryKey(method, path, options[0]), - queryFn: ({ - queryKey: [method, path, ...options], - signal, - }): Promise => - // biome-ignore lint/suspicious/noExplicitAny: can't use method as a function - (this.api as any) - [method as string](path, { - signal, - ...(options[0] as DevupApiRequestInit), - }) - .then(({ data, error }: DevupApiResponse) => { - if (error) throw error - return data - }), + queryKey, + queryFn: this.createQueryFn(queryKey), ...options[1], }, options[2], ) + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + return Object.assign(result, { queryKey }) as any } - useMutation< - M extends - | 'get' - | 'post' - | 'put' - | 'delete' - | 'patch' - | 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'PATCH', - ST extends { - get: DevupGetApiStructScope - post: DevupPostApiStructScope - put: DevupPutApiStructScope - delete: DevupDeleteApiStructScope - patch: DevupPatchApiStructScope - GET: DevupGetApiStructScope - POST: DevupPostApiStructScope - PUT: DevupPutApiStructScope - DELETE: DevupDeleteApiStructScope - PATCH: DevupPatchApiStructScope - }[M], - T extends ConditionalKeys, - O extends Additional, - D extends ExtractValue, - E extends ExtractValue, - V extends ApiOption[0], - >( + useMutation>( method: M, path: T, queryOptions?: Omit< - Parameters>[0], + Parameters< + typeof useMutation< + ExtractValue, 'response'>, + ExtractValue, 'error'>, + ApiOption>[0] + > + >[0], 'mutationFn' | 'mutationKey' >, - queryClient?: Parameters>[1], - ): ReturnType> { - return useMutation( + queryClient?: Parameters[1], + ): ReturnType< + typeof useMutation< + ExtractValue, 'response'>, + ExtractValue, 'error'>, + ApiOption>[0] + > + > { + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + return useMutation( { - mutationKey: [method, path], - mutationFn: (variables: V, { mutationKey }): Promise => + mutationKey: this.getQueryKey(method, path), + mutationFn: (variables, { mutationKey }) => // biome-ignore lint/suspicious/noExplicitAny: can't use method as a function (this.api as any) [mutationKey?.[0] as string](mutationKey?.[1] as T, variables) - .then(({ data, error }: DevupApiResponse) => { - if (error) throw error - return data - }), + .then(unwrapResponse), ...queryOptions, }, queryClient, @@ -159,121 +215,101 @@ export class DevupQueryClient> { } useSuspenseQuery< - M extends - | 'get' - | 'post' - | 'put' - | 'delete' - | 'patch' - | 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'PATCH', - ST extends { - get: DevupGetApiStructScope - post: DevupPostApiStructScope - put: DevupPutApiStructScope - delete: DevupDeleteApiStructScope - patch: DevupPatchApiStructScope - GET: DevupGetApiStructScope - POST: DevupPostApiStructScope - PUT: DevupPutApiStructScope - DELETE: DevupDeleteApiStructScope - PATCH: DevupPatchApiStructScope - }[M], - T extends ConditionalKeys, - O extends Additional, - D extends ExtractValue, - E extends ExtractValue, + M extends DevupApiMethodKeys, + T extends DevupApiMethodKey, >( method: M, path: T, ...options: ApiOption< - O, + ResolveScope, [ queryOptions?: Omit< - Parameters>[0], + Parameters< + typeof useSuspenseQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + >[0], 'queryFn' | 'queryKey' >, - queryClient?: Parameters>[1], + queryClient?: Parameters[1], ] > - ): ReturnType> { - return useSuspenseQuery( + ): ReturnType< + typeof useSuspenseQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + > & { + queryKey: [M, T, ...unknown[]] + } { + const queryKey = this.getQueryKey(method, path, options[0]) + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + const result = useSuspenseQuery( { - queryKey: getQueryKey(method, path, options[0]), - queryFn: ({ - queryKey: [method, path, ...options], - signal, - }): Promise => - // biome-ignore lint/suspicious/noExplicitAny: can't use method as a function - (this.api as any) - [method as string](path, { - signal, - ...(options[0] as DevupApiRequestInit), - }) - .then(({ data, error }: DevupApiResponse) => { - if (error) throw error - return data - }), + queryKey, + queryFn: this.createQueryFn(queryKey), ...options[1], }, options[2], ) + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + return Object.assign(result, { queryKey }) as any } useInfiniteQuery< - M extends - | 'get' - | 'post' - | 'put' - | 'delete' - | 'patch' - | 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'PATCH', - ST extends { - get: DevupGetApiStructScope - post: DevupPostApiStructScope - put: DevupPutApiStructScope - delete: DevupDeleteApiStructScope - patch: DevupPatchApiStructScope - GET: DevupGetApiStructScope - POST: DevupPostApiStructScope - PUT: DevupPutApiStructScope - DELETE: DevupDeleteApiStructScope - PATCH: DevupPatchApiStructScope - }[M], - T extends ConditionalKeys, - O extends Additional, - D extends ExtractValue, - E extends ExtractValue, + M extends DevupApiMethodKeys, + T extends DevupApiMethodKey, >( method: M, path: T, ...options: [ - options: ConditionalApiOption & + options: ConditionalApiOption> & Pick< - Parameters>[0], + Parameters< + typeof useInfiniteQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + >[0], 'getNextPageParam' | 'initialPageParam' >, queryOptions?: Omit< - Parameters>[0], + Parameters< + typeof useInfiniteQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + >[0], 'queryFn' | 'queryKey' | 'getNextPageParam' | 'initialPageParam' >, - queryClient?: Parameters>[1], + queryClient?: Parameters[1], ] - ): ReturnType> { + ): ReturnType< + typeof useInfiniteQuery< + ExtractValue, 'response'>, + ExtractValue, 'error'> + > + > & { + queryKey: [M, T, ...unknown[]] + } { const { getNextPageParam, initialPageParam, ...apiOptions } = options[0] - return useInfiniteQuery( + const queryKey = this.getQueryKey(method, path, apiOptions) + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + const result = useInfiniteQuery( { getNextPageParam, initialPageParam, - queryKey: getQueryKey(method, path, apiOptions), - queryFn: ({ queryKey, pageParam, signal }): Promise => { + queryKey, + queryFn: ({ + queryKey, + pageParam, + signal, + }: { + queryKey: unknown[] + pageParam: unknown + signal: AbortSignal + }) => { const [methodKey, pathKey, ...restOptions] = queryKey const apiOptions = restOptions[0] as DevupApiRequestInit | undefined // biome-ignore lint/suspicious/noExplicitAny: can't use method as a function @@ -289,14 +325,42 @@ export class DevupQueryClient> { }, } as DevupApiRequestInit, ) - .then(({ data, error }: DevupApiResponse) => { - if (error) throw error - return data as D - }) + .then(unwrapResponse) }, ...options[1], - } as Parameters>[0], + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + } as any, options[2], ) + // biome-ignore lint/suspicious/noExplicitAny: internal cast - type safety from signature + return Object.assign(result, { queryKey }) as any + } + + useQueries< + T extends UseQueriesEntry[], + TCombinedResult = UseQueriesResults, + >( + queries: [...T], + options?: { + combine?: (results: UseQueriesResults) => TCombinedResult + queryClient?: Parameters[1] + }, + ): TCombinedResult { + return useQueries( + { + queries: queries.map(([method, path, apiOptions, queryOptions]) => { + const queryKey = this.getQueryKey(method, path, apiOptions) + return { + queryKey, + queryFn: this.createQueryFn(queryKey), + ...queryOptions, + } + }) as Parameters[0]['queries'], + combine: options?.combine as Parameters< + typeof useQueries + >[0]['combine'], + }, + options?.queryClient, + ) as TCombinedResult } } diff --git a/packages/react-query/tsconfig.json b/packages/react-query/tsconfig.json index c6497e6..342eabe 100644 --- a/packages/react-query/tsconfig.json +++ b/packages/react-query/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/rsbuild-plugin/README.md b/packages/rsbuild-plugin/README.md index 7c184e3..5c4be53 100644 --- a/packages/rsbuild-plugin/README.md +++ b/packages/rsbuild-plugin/README.md @@ -73,6 +73,16 @@ interface DevupApiOptions { * @default true */ responseDefaultNonNullable?: boolean + + /** + * Generate operationId-based Server Action wrappers. + * Disable with false or { enabled: false }. + * @default true + */ + serverActions?: boolean | { + enabled?: boolean + baseUrl?: string + } } ``` @@ -81,7 +91,8 @@ interface DevupApiOptions { 1. Reads your `openapi.json` file during build 2. Generates TypeScript interface definitions (`api.d.ts`) 3. Creates a URL map and injects it as `process.env.DEVUP_API_URL_MAP` via Rsbuild's define feature -4. Makes types available for use with `@devup-api/fetch` +4. Generates Server Actions in `df/server.ts` by default +5. Makes types available for use with `@devup-api/fetch` ## TypeScript Configuration diff --git a/packages/rsbuild-plugin/package.json b/packages/rsbuild-plugin/package.json index 254652a..b600cf6 100644 --- a/packages/rsbuild-plugin/package.json +++ b/packages/rsbuild-plugin/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/rsbuild-plugin", - "version": "0.1.8", + "version": "0.1.18", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -29,7 +30,7 @@ "@devup-api/core": "*" }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9" + "@types/node": "^26.2", + "typescript": "^7.0" } } diff --git a/packages/rsbuild-plugin/src/__tests__/plugin.test.ts b/packages/rsbuild-plugin/src/__tests__/plugin.test.ts index 9e7f78c..8d603bf 100644 --- a/packages/rsbuild-plugin/src/__tests__/plugin.test.ts +++ b/packages/rsbuild-plugin/src/__tests__/plugin.test.ts @@ -38,12 +38,10 @@ const mockSchema = { const mockUrlMap = { getUsers: { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, '/users': { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, } @@ -114,41 +112,42 @@ test.each([ }, ['custom-openapi.json'], ], -] as const)('devupApiRsbuildPlugin returns plugin with setup hook: %s', async (options: - | DevupApiOptions - | undefined, expectedFiles: string[]) => { - const plugin = devupApiRsbuildPlugin(options) - expect(plugin.setup).toBeDefined() - expect(typeof plugin.setup).toBe('function') +] as const)( + 'devupApiRsbuildPlugin returns plugin with setup hook: %s', + async (options: DevupApiOptions | undefined, expectedFiles: string[]) => { + const plugin = devupApiRsbuildPlugin(options) + expect(plugin.setup).toBeDefined() + expect(typeof plugin.setup).toBe('function') - const build = createMockBuild() - await plugin.setup?.(build as never) + const build = createMockBuild() + await plugin.setup?.(build as never) - expect(mockCreateTmpDirAsync).toHaveBeenCalledWith(options?.tempDir) - expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) - expect(mockGenerateInterface).toHaveBeenCalledWith(mockSchema, options) - expect(mockGenerateZodSchemas).toHaveBeenCalledWith(mockSchema, options) - expect(mockGenerateZodTypeDeclarations).toHaveBeenCalledWith( - mockSchema, - options, - ) - // 5 files written: api.d.ts, zod-schemas.js, zod.d.ts, crud-config.js, ui.d.ts - expect(mockWriteInterfaceAsync).toHaveBeenCalledTimes(5) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'api.d.ts'), - mockInterfaceContent, - ) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'zod-schemas.js'), - mockZodSchemasContent, - ) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'zod.d.ts'), - mockZodTypeDeclarationsContent, - ) - expect(mockCreateUrlMap).toHaveBeenCalledWith(mockSchema, options) - expect(build.modifyRsbuildConfig).toHaveBeenCalled() -}) + expect(mockCreateTmpDirAsync).toHaveBeenCalledWith(options?.tempDir) + expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) + expect(mockGenerateInterface).toHaveBeenCalledWith(mockSchema, options) + expect(mockGenerateZodSchemas).toHaveBeenCalledWith(mockSchema, options) + expect(mockGenerateZodTypeDeclarations).toHaveBeenCalledWith( + mockSchema, + options, + ) + // 7 files written: api.d.ts, zod-schemas.js, zod.d.ts, crud-config.js, ui.d.ts, server.ts, server-module.d.ts + expect(mockWriteInterfaceAsync).toHaveBeenCalledTimes(7) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'api.d.ts'), + mockInterfaceContent, + ) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'zod-schemas.js'), + mockZodSchemasContent, + ) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'zod.d.ts'), + mockZodTypeDeclarationsContent, + ) + expect(mockCreateUrlMap).toHaveBeenCalledWith(mockSchema, options) + expect(build.modifyRsbuildConfig).toHaveBeenCalled() + }, +) test('devupApiRsbuildPlugin setup hook modifies config with urlMap and alias', async () => { const plugin = devupApiRsbuildPlugin() @@ -167,6 +166,7 @@ test('devupApiRsbuildPlugin setup hook modifies config with urlMap and alias', a alias: { '@devup-api/zod': resolve('df', 'zod-schemas.js'), '@devup-api/ui/crud': resolve('df', 'crud-configs.jsx'), + '@devup-api/fetch/server': resolve('df', 'server.ts'), }, }, source: { @@ -194,6 +194,7 @@ test('devupApiRsbuildPlugin setup hook handles config without source', async () alias: { '@devup-api/zod': resolve('df', 'zod-schemas.js'), '@devup-api/ui/crud': resolve('df', 'crud-configs.jsx'), + '@devup-api/fetch/server': resolve('df', 'server.ts'), }, }, source: { @@ -223,6 +224,7 @@ test('devupApiRsbuildPlugin setup hook handles config without define', async () alias: { '@devup-api/zod': resolve('df', 'zod-schemas.js'), '@devup-api/ui/crud': resolve('df', 'crud-configs.jsx'), + '@devup-api/fetch/server': resolve('df', 'server.ts'), }, }, source: { @@ -253,6 +255,7 @@ test('devupApiRsbuildPlugin setup hook does not add urlMap when urlMap is null', alias: { '@devup-api/zod': resolve('df', 'zod-schemas.js'), '@devup-api/ui/crud': resolve('df', 'crud-configs.jsx'), + '@devup-api/fetch/server': resolve('df', 'server.ts'), }, }, source: { @@ -279,6 +282,7 @@ test('devupApiRsbuildPlugin setup hook does not add urlMap when urlMap is undefi alias: { '@devup-api/zod': resolve('df', 'zod-schemas.js'), '@devup-api/ui/crud': resolve('df', 'crud-configs.jsx'), + '@devup-api/fetch/server': resolve('df', 'server.ts'), }, }, source: { @@ -305,6 +309,7 @@ test('devupApiRsbuildPlugin setup hook does not add urlMap when urlMap is empty alias: { '@devup-api/zod': resolve('df', 'zod-schemas.js'), '@devup-api/ui/crud': resolve('df', 'crud-configs.jsx'), + '@devup-api/fetch/server': resolve('df', 'server.ts'), }, }, source: { diff --git a/packages/rsbuild-plugin/src/plugin.ts b/packages/rsbuild-plugin/src/plugin.ts index 82dbe25..a216928 100644 --- a/packages/rsbuild-plugin/src/plugin.ts +++ b/packages/rsbuild-plugin/src/plugin.ts @@ -1,15 +1,20 @@ -import { join, resolve } from 'node:path' +import { resolve } from 'node:path' import type { DevupApiOptions } from '@devup-api/core' import { createUrlMap, generateCrudConfigCode, generateCrudConfigTypes, generateInterface, + generateServerActionCode, + generateServerActionTypes, generateZodSchemas, generateZodTypeDeclarations, } from '@devup-api/generator' import { createTmpDirAsync, + type DevupGenerators, + type DevupIOAsync, + generateDevupArtifactsAsync, normalizeOpenapiFiles, readOpenapiAsync, writeInterfaceAsync, @@ -22,46 +27,34 @@ export function devupApiRsbuildPlugin( return { name: 'devup-api', async setup(build) { - const tempDir = await createTmpDirAsync(options?.tempDir) - const openapiFiles = normalizeOpenapiFiles(options?.openapiFiles) - const schemas = await readOpenapiAsync(openapiFiles) + const io: DevupIOAsync = { + createTmpDirAsync, + normalizeOpenapiFiles, + readOpenapiAsync, + writeInterfaceAsync, + } - // Generate interface file - await writeInterfaceAsync( - join(tempDir, 'api.d.ts'), - generateInterface(schemas, options), - ) - - // Generate Zod schemas file - await writeInterfaceAsync( - join(tempDir, 'zod-schemas.js'), - generateZodSchemas(schemas, options), - ) - - // Generate Zod type declarations - await writeInterfaceAsync( - join(tempDir, 'zod.d.ts'), - generateZodTypeDeclarations(schemas, options), - ) + const generators: DevupGenerators = { + generateInterface, + generateZodSchemas, + generateZodTypeDeclarations, + generateCrudConfigCode, + generateCrudConfigTypes, + generateServerActionCode, + generateServerActionTypes, + createUrlMap, + } - // Generate CRUD configs file - await writeInterfaceAsync( - join(tempDir, 'crud-configs.jsx'), - generateCrudConfigCode(schemas), + const { tempDir, urlMap } = await generateDevupArtifactsAsync( + io, + generators, + options, ) - // Generate CRUD config type declarations - await writeInterfaceAsync( - join(tempDir, 'ui.d.ts'), - generateCrudConfigTypes(schemas), - ) - - // Create urlMap and set environment variable - const urlMap = createUrlMap(schemas, options) - // Get absolute paths for virtual modules const zodSchemasPath = resolve(tempDir, 'zod-schemas.js') const crudConfigsPath = resolve(tempDir, 'crud-configs.jsx') + const serverPath = resolve(tempDir, 'server.ts') build.modifyRsbuildConfig((config) => { config.source ??= {} @@ -82,6 +75,9 @@ export function devupApiRsbuildPlugin( ;(config.resolve.alias as Record)[ '@devup-api/ui/crud' ] = crudConfigsPath + ;(config.resolve.alias as Record)[ + '@devup-api/fetch/server' + ] = serverPath return config }) diff --git a/packages/rsbuild-plugin/tsconfig.json b/packages/rsbuild-plugin/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/rsbuild-plugin/tsconfig.json +++ b/packages/rsbuild-plugin/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/ui/package.json b/packages/ui/package.json index 19a37f1..45aed16 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/ui", - "version": "0.0.1", + "version": "0.1.8", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -25,15 +26,16 @@ "@devup-api/hookform": "workspace:^" }, "peerDependencies": { - "react": "^18.0.0 || ^19.0.0" + "react": "^18.0.0 || >=19.0.0" }, "devDependencies": { - "@types/node": "^25.0", - "@types/react": "^19.2.7", + "@typescript/typescript6": "^6.0", + "@types/node": "^26.2", + "@types/react": "^19.2", "rollup-plugin-preserve-directives": "^0.4", - "vite": "^7.3", - "vite-plugin-dts": "^4.5", - "react": "^19.2.3", - "typescript": "^5.9" + "vite": "^8.2", + "vite-plugin-dts": "^5.0", + "react": "^19.2", + "typescript": "^7.0" } } diff --git a/packages/utils/package.json b/packages/utils/package.json index 29b598d..33a704b 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/utils", - "version": "0.1.6", + "version": "0.1.15", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -20,8 +21,8 @@ "access": "public" }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", + "@types/node": "^26.2", + "typescript": "^7.0", "openapi-types": "^12.1" } } diff --git a/packages/utils/src/__tests__/create-tmp-dir.test.ts b/packages/utils/src/__tests__/create-tmp-dir.test.ts index aaebd7a..94032b1 100644 --- a/packages/utils/src/__tests__/create-tmp-dir.test.ts +++ b/packages/utils/src/__tests__/create-tmp-dir.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, expect, spyOn, test } from 'bun:test' +import { afterEach, beforeEach, expect, spyOn, test } from 'bun:test' import * as fs from 'node:fs' import * as fsPromises from 'node:fs/promises' import { createTmpDir, createTmpDirAsync } from '../create-tmp-dir' @@ -13,19 +13,28 @@ beforeEach(() => { mockMkdir = spyOn(fsPromises, 'mkdir').mockResolvedValue(undefined) }) +afterEach(() => { + mockExistsSync.mockRestore() + mockMkdirSync.mockRestore() + mockMkdir.mockRestore() +}) + test.each([ ['test-dir-1'], ['test-dir-2'], ['custom/path/to/dir'], ['nested/deep/path'], -] as const)('createTmpDir creates directory when it does not exist: %s', (tempDir) => { - mockExistsSync.mockReturnValue(false) - mockMkdirSync.mockClear() - const result = createTmpDir(tempDir) - expect(result).toBe(tempDir) - expect(mockExistsSync).toHaveBeenCalledWith(tempDir) - expect(mockMkdirSync).toHaveBeenCalledWith(tempDir, { recursive: true }) -}) +] as const)( + 'createTmpDir creates directory when it does not exist: %s', + (tempDir) => { + mockExistsSync.mockReturnValue(false) + mockMkdirSync.mockClear() + const result = createTmpDir(tempDir) + expect(result).toBe(tempDir) + expect(mockExistsSync).toHaveBeenCalledWith(tempDir) + expect(mockMkdirSync).toHaveBeenCalledWith(tempDir, { recursive: true }) + }, +) test('createTmpDir uses default value when no argument provided', () => { const defaultDir = 'df' @@ -52,13 +61,16 @@ test.each([ ['async-test-dir-2'], ['async/custom/path'], ['async/nested/deep'], -] as const)('createTmpDirAsync creates directory when it does not exist: %s', async (tempDir) => { - mockMkdir.mockClear() - mockMkdir.mockResolvedValue(undefined) - const result = await createTmpDirAsync(tempDir) - expect(result).toBe(tempDir) - expect(mockMkdir).toHaveBeenCalledWith(tempDir, { recursive: true }) -}) +] as const)( + 'createTmpDirAsync creates directory when it does not exist: %s', + async (tempDir) => { + mockMkdir.mockClear() + mockMkdir.mockResolvedValue(undefined) + const result = await createTmpDirAsync(tempDir) + expect(result).toBe(tempDir) + expect(mockMkdir).toHaveBeenCalledWith(tempDir, { recursive: true }) + }, +) test('createTmpDirAsync uses default value when no argument provided', async () => { const defaultDir = 'df' diff --git a/packages/utils/src/__tests__/generate-devup.test.ts b/packages/utils/src/__tests__/generate-devup.test.ts new file mode 100644 index 0000000..e3223d6 --- /dev/null +++ b/packages/utils/src/__tests__/generate-devup.test.ts @@ -0,0 +1,350 @@ +import { expect, mock, test } from 'bun:test' +import { join } from 'node:path' +import type { OpenAPIV3_1 } from 'openapi-types' +import type { + DevupGenerators, + DevupIOAsync, + DevupIOSync, +} from '../generate-devup' +import { + generateDevupArtifacts, + generateDevupArtifactsAsync, +} from '../generate-devup' + +const mockSchema = { + openapi: '3.1.0', + paths: { + '/users': { + get: { + operationId: 'getUsers', + responses: { + '200': { + content: { + 'application/json': { + schema: { type: 'array', items: { type: 'string' } }, + }, + }, + }, + }, + }, + }, + }, +} as unknown as OpenAPIV3_1.Document + +const mockSchemas: Record = { + 'openapi.json': mockSchema, +} + +const mockUrlMap = { getUsers: { method: 'GET', url: '/users' } } + +function createMockGenerators(): DevupGenerators<{ + openapiFiles?: string | string[] + tempDir?: string +}> { + return { + generateInterface: mock(() => 'interface-content'), + generateZodSchemas: mock(() => 'zod-schemas-content'), + generateZodTypeDeclarations: mock(() => 'zod-types-content'), + generateCrudConfigCode: mock(() => 'crud-config-content'), + generateCrudConfigTypes: mock(() => 'crud-types-content'), + generateServerActionCode: mock(() => 'server-actions-content'), + generateServerActionTypes: mock(() => 'server-actions-types-content'), + createUrlMap: mock(() => mockUrlMap), + } +} + +function createMockIOAsync(): DevupIOAsync { + return { + createTmpDirAsync: mock(async () => 'df'), + normalizeOpenapiFiles: mock(() => ['openapi.json']), + readOpenapiAsync: mock(async () => mockSchemas), + writeInterfaceAsync: mock(async () => {}), + } +} + +function createMockIOSync(): DevupIOSync { + return { + createTmpDir: mock(() => 'df'), + normalizeOpenapiFiles: mock(() => ['openapi.json']), + readOpenapis: mock(() => mockSchemas), + writeInterface: mock(() => {}), + } +} + +// ============================================================================= +// generateDevupArtifactsAsync +// ============================================================================= + +test('generateDevupArtifactsAsync returns correct artifacts', async () => { + const io = createMockIOAsync() + const generators = createMockGenerators() + + const result = await generateDevupArtifactsAsync(io, generators) + + expect(result.tempDir).toBe('df') + expect(result.schemas).toBe(mockSchemas) + expect(result.files.interface).toBe('interface-content') + expect(result.files.zodSchemas).toBe('zod-schemas-content') + expect(result.files.zodTypes).toBe('zod-types-content') + expect(result.files.crudConfig).toBe('crud-config-content') + expect(result.files.crudTypes).toBe('crud-types-content') + expect(result.files.serverActions).toBe('server-actions-content') + expect(result.files.serverActionTypes).toBe('server-actions-types-content') + expect(result.urlMap).toBe(mockUrlMap) +}) + +test('generateDevupArtifactsAsync calls IO functions correctly', async () => { + const io = createMockIOAsync() + const generators = createMockGenerators() + const options = { tempDir: 'custom-dir', openapiFiles: 'api.json' } + + await generateDevupArtifactsAsync(io, generators, options) + + expect(io.createTmpDirAsync).toHaveBeenCalledWith('custom-dir') + expect(io.normalizeOpenapiFiles).toHaveBeenCalledWith('api.json') + expect(io.readOpenapiAsync).toHaveBeenCalledWith(['openapi.json']) +}) + +test('generateDevupArtifactsAsync calls all generators with schemas and options', async () => { + const io = createMockIOAsync() + const generators = createMockGenerators() + const options = { tempDir: 'df', openapiFiles: 'openapi.json' } + + await generateDevupArtifactsAsync(io, generators, options) + + expect(generators.generateInterface).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateZodSchemas).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateZodTypeDeclarations).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateCrudConfigCode).toHaveBeenCalledWith(mockSchemas) + expect(generators.generateCrudConfigTypes).toHaveBeenCalledWith(mockSchemas) + expect(generators.generateServerActionCode).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateServerActionTypes).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.createUrlMap).toHaveBeenCalledWith(mockSchemas, options) +}) + +test('generateDevupArtifactsAsync writes all 7 files to tempDir', async () => { + const io = createMockIOAsync() + const generators = createMockGenerators() + + await generateDevupArtifactsAsync(io, generators) + + expect(io.writeInterfaceAsync).toHaveBeenCalledTimes(7) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'api.d.ts'), + 'interface-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'zod-schemas.js'), + 'zod-schemas-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'zod.d.ts'), + 'zod-types-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'crud-configs.jsx'), + 'crud-config-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'ui.d.ts'), + 'crud-types-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'server.ts'), + 'server-actions-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('df', 'server-module.d.ts'), + 'server-actions-types-content', + ) +}) + +test('generateDevupArtifactsAsync passes undefined options when none provided', async () => { + const io = createMockIOAsync() + const generators = createMockGenerators() + + await generateDevupArtifactsAsync(io, generators) + + expect(io.createTmpDirAsync).toHaveBeenCalledWith(undefined) + expect(io.normalizeOpenapiFiles).toHaveBeenCalledWith(undefined) + expect(generators.generateInterface).toHaveBeenCalledWith( + mockSchemas, + undefined, + ) + expect(generators.createUrlMap).toHaveBeenCalledWith(mockSchemas, undefined) +}) + +// ============================================================================= +// generateDevupArtifacts (sync) +// ============================================================================= + +test('generateDevupArtifacts returns correct artifacts', () => { + const io = createMockIOSync() + const generators = createMockGenerators() + + const result = generateDevupArtifacts(io, generators) + + expect(result.tempDir).toBe('df') + expect(result.schemas).toBe(mockSchemas) + expect(result.files.interface).toBe('interface-content') + expect(result.files.zodSchemas).toBe('zod-schemas-content') + expect(result.files.zodTypes).toBe('zod-types-content') + expect(result.files.crudConfig).toBe('crud-config-content') + expect(result.files.crudTypes).toBe('crud-types-content') + expect(result.files.serverActions).toBe('server-actions-content') + expect(result.files.serverActionTypes).toBe('server-actions-types-content') + expect(result.urlMap).toBe(mockUrlMap) +}) + +test('generateDevupArtifacts calls IO functions correctly', () => { + const io = createMockIOSync() + const generators = createMockGenerators() + const options = { tempDir: 'custom-dir', openapiFiles: 'api.json' } + + generateDevupArtifacts(io, generators, options) + + expect(io.createTmpDir).toHaveBeenCalledWith('custom-dir') + expect(io.normalizeOpenapiFiles).toHaveBeenCalledWith('api.json') + expect(io.readOpenapis).toHaveBeenCalledWith(['openapi.json']) +}) + +test('generateDevupArtifacts calls all generators with schemas and options', () => { + const io = createMockIOSync() + const generators = createMockGenerators() + const options = { tempDir: 'df', openapiFiles: 'openapi.json' } + + generateDevupArtifacts(io, generators, options) + + expect(generators.generateInterface).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateZodSchemas).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateZodTypeDeclarations).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateCrudConfigCode).toHaveBeenCalledWith(mockSchemas) + expect(generators.generateCrudConfigTypes).toHaveBeenCalledWith(mockSchemas) + expect(generators.generateServerActionCode).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.generateServerActionTypes).toHaveBeenCalledWith( + mockSchemas, + options, + ) + expect(generators.createUrlMap).toHaveBeenCalledWith(mockSchemas, options) +}) + +test('generateDevupArtifacts writes all 7 files to tempDir', () => { + const io = createMockIOSync() + const generators = createMockGenerators() + + generateDevupArtifacts(io, generators) + + expect(io.writeInterface).toHaveBeenCalledTimes(7) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'api.d.ts'), + 'interface-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'zod-schemas.js'), + 'zod-schemas-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'zod.d.ts'), + 'zod-types-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'crud-configs.jsx'), + 'crud-config-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'ui.d.ts'), + 'crud-types-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'server.ts'), + 'server-actions-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('df', 'server-module.d.ts'), + 'server-actions-types-content', + ) +}) + +test('generateDevupArtifacts passes undefined options when none provided', () => { + const io = createMockIOSync() + const generators = createMockGenerators() + + generateDevupArtifacts(io, generators) + + expect(io.createTmpDir).toHaveBeenCalledWith(undefined) + expect(io.normalizeOpenapiFiles).toHaveBeenCalledWith(undefined) + expect(generators.generateInterface).toHaveBeenCalledWith( + mockSchemas, + undefined, + ) + expect(generators.createUrlMap).toHaveBeenCalledWith(mockSchemas, undefined) +}) + +test('generateDevupArtifacts uses custom tempDir in file paths', () => { + const io = createMockIOSync() + ;(io.createTmpDir as ReturnType).mockReturnValue('custom-temp') + const generators = createMockGenerators() + + const result = generateDevupArtifacts(io, generators, { + tempDir: 'custom-temp', + }) + + expect(result.tempDir).toBe('custom-temp') + expect(io.writeInterface).toHaveBeenCalledWith( + join('custom-temp', 'api.d.ts'), + 'interface-content', + ) + expect(io.writeInterface).toHaveBeenCalledWith( + join('custom-temp', 'zod-schemas.js'), + 'zod-schemas-content', + ) +}) + +test('generateDevupArtifactsAsync uses custom tempDir in file paths', async () => { + const io = createMockIOAsync() + ;(io.createTmpDirAsync as ReturnType).mockResolvedValue( + 'custom-temp', + ) + const generators = createMockGenerators() + + const result = await generateDevupArtifactsAsync(io, generators, { + tempDir: 'custom-temp', + }) + + expect(result.tempDir).toBe('custom-temp') + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('custom-temp', 'api.d.ts'), + 'interface-content', + ) + expect(io.writeInterfaceAsync).toHaveBeenCalledWith( + join('custom-temp', 'zod-schemas.js'), + 'zod-schemas-content', + ) +}) diff --git a/packages/utils/src/__tests__/read-openapi.test.ts b/packages/utils/src/__tests__/read-openapi.test.ts index abff4e3..3f7083d 100644 --- a/packages/utils/src/__tests__/read-openapi.test.ts +++ b/packages/utils/src/__tests__/read-openapi.test.ts @@ -1,5 +1,5 @@ /** biome-ignore-all lint/suspicious/noExplicitAny: test */ -import { beforeEach, expect, spyOn, test } from 'bun:test' +import { afterEach, beforeEach, expect, spyOn, test } from 'bun:test' import * as fs from 'node:fs' import * as fsPromises from 'node:fs/promises' import type { OpenAPIV3_1 } from 'openapi-types' @@ -30,6 +30,11 @@ beforeEach(() => { ) }) +afterEach(() => { + mockReadFileSync.mockRestore() + mockReadFile.mockRestore() +}) + test('readOpenapi reads and parses OpenAPI file', () => { const filePath = 'openapi.json' const result = readOpenapis([filePath]) @@ -114,11 +119,14 @@ test.each([ ['./openapi.json', 'openapi.json'], ['/absolute/path/openapi.json', '/absolute/path/openapi.json'], ['src/schemas/api.json', 'src/schemas/api.json'], -])('readOpenapiAsync reads file from custom path: %s', async (filePath, expected) => { - const result = await readOpenapiAsync([filePath]) - expect(mockReadFile).toHaveBeenCalledWith(filePath, 'utf8') - expect(result).toEqual({ [expected]: mockOpenApiDoc }) -}) +])( + 'readOpenapiAsync reads file from custom path: %s', + async (filePath, expected) => { + const result = await readOpenapiAsync([filePath]) + expect(mockReadFile).toHaveBeenCalledWith(filePath, 'utf8') + expect(result).toEqual({ [expected]: mockOpenApiDoc }) + }, +) test('readOpenapiAsync parses valid JSON content', async () => { const customDoc: OpenAPIV3_1.Document = { diff --git a/packages/utils/src/__tests__/to-camel.test.ts b/packages/utils/src/__tests__/to-camel.test.ts index c654264..91d6076 100644 --- a/packages/utils/src/__tests__/to-camel.test.ts +++ b/packages/utils/src/__tests__/to-camel.test.ts @@ -29,9 +29,12 @@ test.each([ ['hello world', 'helloWorld'], ['my variable name', 'myVariableName'], ['space separated string', 'spaceSeparatedString'], -])('converts space-separated strings to camelCase: %s -> %s', (input, expected) => { - expect(toCamel(input)).toBe(expected) -}) +])( + 'converts space-separated strings to camelCase: %s -> %s', + (input, expected) => { + expect(toCamel(input)).toBe(expected) + }, +) test.each([ ['helloWorld', 'helloWorld'], @@ -82,9 +85,12 @@ test.each([ ['', ''], ['a', 'a'], ['A', 'a'], -])('handles empty string and single characters: %s -> %s', (input, expected) => { - expect(toCamel(input)).toBe(expected) -}) +])( + 'handles empty string and single characters: %s -> %s', + (input, expected) => { + expect(toCamel(input)).toBe(expected) + }, +) test.each([ ['HelloWorld-123_test', 'helloWorld123Test'], diff --git a/packages/utils/src/__tests__/to-pascal.test.ts b/packages/utils/src/__tests__/to-pascal.test.ts index 79f69eb..2de8428 100644 --- a/packages/utils/src/__tests__/to-pascal.test.ts +++ b/packages/utils/src/__tests__/to-pascal.test.ts @@ -29,9 +29,12 @@ test.each([ ['hello world', 'HelloWorld'], ['my variable name', 'MyVariableName'], ['space separated string', 'SpaceSeparatedString'], -])('converts space-separated strings to PascalCase: %s -> %s', (input, expected) => { - expect(toPascal(input)).toBe(expected) -}) +])( + 'converts space-separated strings to PascalCase: %s -> %s', + (input, expected) => { + expect(toPascal(input)).toBe(expected) + }, +) test.each([ ['HelloWorld', 'HelloWorld'], @@ -82,9 +85,12 @@ test.each([ ['', ''], ['a', 'A'], ['A', 'A'], -])('handles empty string and single characters: %s -> %s', (input, expected) => { - expect(toPascal(input)).toBe(expected) -}) +])( + 'handles empty string and single characters: %s -> %s', + (input, expected) => { + expect(toPascal(input)).toBe(expected) + }, +) test.each([ ['HelloWorld-123_test', 'HelloWorld123Test'], diff --git a/packages/utils/src/__tests__/to-snake.test.ts b/packages/utils/src/__tests__/to-snake.test.ts index f8ef6b7..150df46 100644 --- a/packages/utils/src/__tests__/to-snake.test.ts +++ b/packages/utils/src/__tests__/to-snake.test.ts @@ -29,9 +29,12 @@ test.each([ ['hello world', 'hello_world'], ['my variable name', 'my_variable_name'], ['space separated string', 'space_separated_string'], -])('converts space-separated strings to snake_case: %s -> %s', (input, expected) => { - expect(toSnake(input)).toBe(expected) -}) +])( + 'converts space-separated strings to snake_case: %s -> %s', + (input, expected) => { + expect(toSnake(input)).toBe(expected) + }, +) test.each([ ['hello_world', 'hello_world'], @@ -82,9 +85,12 @@ test.each([ ['', ''], ['a', 'a'], ['A', 'a'], -])('handles empty string and single characters: %s -> %s', (input, expected) => { - expect(toSnake(input)).toBe(expected) -}) +])( + 'handles empty string and single characters: %s -> %s', + (input, expected) => { + expect(toSnake(input)).toBe(expected) + }, +) test.each([ ['HelloWorld-123_test', 'hello_world_123_test'], diff --git a/packages/utils/src/__tests__/write-interface.test.ts b/packages/utils/src/__tests__/write-interface.test.ts index d7d8fff..70dc914 100644 --- a/packages/utils/src/__tests__/write-interface.test.ts +++ b/packages/utils/src/__tests__/write-interface.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, expect, spyOn, test } from 'bun:test' +import { afterEach, beforeEach, expect, spyOn, test } from 'bun:test' import * as fs from 'node:fs' import * as fsPromises from 'node:fs/promises' import { writeInterface, writeInterfaceAsync } from '../write-interface' @@ -11,6 +11,11 @@ beforeEach(() => { mockWriteFile = spyOn(fsPromises, 'writeFile').mockResolvedValue(undefined) }) +afterEach(() => { + mockWriteFileSync.mockRestore() + mockWriteFile.mockRestore() +}) + test('writeInterface writes content to file', () => { const filePath = 'output.ts' const content = 'export interface Test {}' @@ -101,10 +106,13 @@ test.each([ ['types/api.ts', 'export interface Api {}'], ['src/interfaces/user.ts', 'export interface User {}'], ['/absolute/path/output.ts', 'export interface Output {}'], -])('writeInterfaceAsync writes content to custom path: %s', async (filePath, content) => { - await writeInterfaceAsync(filePath, content) - expect(mockWriteFile).toHaveBeenCalledWith(filePath, content, 'utf8') -}) +])( + 'writeInterfaceAsync writes content to custom path: %s', + async (filePath, content) => { + await writeInterfaceAsync(filePath, content) + expect(mockWriteFile).toHaveBeenCalledWith(filePath, content, 'utf8') + }, +) test('writeInterfaceAsync writes empty content', async () => { const filePath = 'empty.ts' diff --git a/packages/utils/src/generate-devup.ts b/packages/utils/src/generate-devup.ts new file mode 100644 index 0000000..267a65c --- /dev/null +++ b/packages/utils/src/generate-devup.ts @@ -0,0 +1,173 @@ +import { join } from 'node:path' +import type { OpenAPIV3_1 } from 'openapi-types' + +/** + * Minimal options interface for the generation pipeline. + * Defined locally to avoid depending on @devup-api/core. + */ +interface GenerateDevupOptions { + openapiFiles?: string | string[] + tempDir?: string +} + +/** + * Generator functions injected by the caller. + * This decouples @devup-api/utils from @devup-api/generator. + */ +export interface DevupGenerators { + generateInterface: ( + schemas: Record, + options?: TOptions, + ) => string + generateZodSchemas: ( + schemas: Record, + options?: TOptions, + ) => string + generateZodTypeDeclarations: ( + schemas: Record, + options?: TOptions, + ) => string + generateCrudConfigCode: ( + schemas: Record, + ) => string + generateCrudConfigTypes: ( + schemas: Record, + ) => string + generateServerActionCode: ( + schemas: Record, + options?: TOptions, + ) => string + generateServerActionTypes: ( + schemas: Record, + options?: TOptions, + ) => string + createUrlMap: ( + schemas: Record, + options?: TOptions, + ) => Record +} + +/** + * IO functions for the async pipeline. + */ +export interface DevupIOAsync { + createTmpDirAsync: (tempDir?: string) => Promise + normalizeOpenapiFiles: (openapiFiles?: string[] | string) => string[] + readOpenapiAsync: ( + openapiFiles: string[], + ) => Promise> + writeInterfaceAsync: (filePath: string, content: string) => Promise +} + +/** + * IO functions for the sync pipeline. + */ +export interface DevupIOSync { + createTmpDir: (tempDir?: string) => string + normalizeOpenapiFiles: (openapiFiles?: string[] | string) => string[] + readOpenapis: (openapiFiles: string[]) => Record + writeInterface: (filePath: string, content: string) => void +} + +/** + * Generated file contents from the pipeline. + */ +export interface DevupGeneratedFiles { + interface: string + zodSchemas: string + zodTypes: string + crudConfig: string + crudTypes: string + serverActions: string + serverActionTypes: string +} + +/** + * Result of the generation pipeline. + */ +export interface DevupArtifacts { + tempDir: string + schemas: Record + files: DevupGeneratedFiles + urlMap: Record +} + +/** + * Async generation pipeline: read schemas → generate all outputs → write files → create URL map. + * Used by Vite, Webpack, and Rsbuild plugins. + */ +export async function generateDevupArtifactsAsync< + TOptions extends GenerateDevupOptions, +>( + io: DevupIOAsync, + generators: DevupGenerators, + options?: TOptions, +): Promise { + const tempDir = await io.createTmpDirAsync(options?.tempDir) + const openapiFiles = io.normalizeOpenapiFiles(options?.openapiFiles) + const schemas = await io.readOpenapiAsync(openapiFiles) + + const files: DevupGeneratedFiles = { + interface: generators.generateInterface(schemas, options), + zodSchemas: generators.generateZodSchemas(schemas, options), + zodTypes: generators.generateZodTypeDeclarations(schemas, options), + crudConfig: generators.generateCrudConfigCode(schemas), + crudTypes: generators.generateCrudConfigTypes(schemas), + serverActions: generators.generateServerActionCode(schemas, options), + serverActionTypes: generators.generateServerActionTypes(schemas, options), + } + + await Promise.all([ + io.writeInterfaceAsync(join(tempDir, 'api.d.ts'), files.interface), + io.writeInterfaceAsync(join(tempDir, 'zod-schemas.js'), files.zodSchemas), + io.writeInterfaceAsync(join(tempDir, 'zod.d.ts'), files.zodTypes), + io.writeInterfaceAsync(join(tempDir, 'crud-configs.jsx'), files.crudConfig), + io.writeInterfaceAsync(join(tempDir, 'ui.d.ts'), files.crudTypes), + io.writeInterfaceAsync(join(tempDir, 'server.ts'), files.serverActions), + io.writeInterfaceAsync( + join(tempDir, 'server-module.d.ts'), + files.serverActionTypes, + ), + ]) + + const urlMap = generators.createUrlMap(schemas, options) + return { tempDir, schemas, files, urlMap } +} + +/** + * Sync generation pipeline: read schemas → generate all outputs → write files → create URL map. + * Used by Next.js Turbopack plugin. + */ +export function generateDevupArtifacts( + io: DevupIOSync, + generators: DevupGenerators, + options?: TOptions, +): DevupArtifacts { + const tempDir = io.createTmpDir(options?.tempDir) + const openapiFiles = io.normalizeOpenapiFiles(options?.openapiFiles) + const schemas = io.readOpenapis(openapiFiles) + + const files: DevupGeneratedFiles = { + interface: generators.generateInterface(schemas, options), + zodSchemas: generators.generateZodSchemas(schemas, options), + zodTypes: generators.generateZodTypeDeclarations(schemas, options), + crudConfig: generators.generateCrudConfigCode(schemas), + crudTypes: generators.generateCrudConfigTypes(schemas), + serverActions: generators.generateServerActionCode(schemas, options), + serverActionTypes: generators.generateServerActionTypes(schemas, options), + } + + io.writeInterface(join(tempDir, 'api.d.ts'), files.interface) + io.writeInterface(join(tempDir, 'zod-schemas.js'), files.zodSchemas) + io.writeInterface(join(tempDir, 'zod.d.ts'), files.zodTypes) + io.writeInterface(join(tempDir, 'crud-configs.jsx'), files.crudConfig) + io.writeInterface(join(tempDir, 'ui.d.ts'), files.crudTypes) + io.writeInterface(join(tempDir, 'server.ts'), files.serverActions) + io.writeInterface( + join(tempDir, 'server-module.d.ts'), + files.serverActionTypes, + ) + + const urlMap = generators.createUrlMap(schemas, options) + return { tempDir, schemas, files, urlMap } +} diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 31e3081..767fb41 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,4 +1,5 @@ export * from './create-tmp-dir' +export * from './generate-devup' export * from './read-openapi' export * from './to-camel' export * from './to-pascal' diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/vite-plugin/README.md b/packages/vite-plugin/README.md index 7a75877..0447720 100644 --- a/packages/vite-plugin/README.md +++ b/packages/vite-plugin/README.md @@ -73,6 +73,16 @@ interface DevupApiOptions { * @default true */ responseDefaultNonNullable?: boolean + + /** + * Generate operationId-based Server Action wrappers. + * Disable with false or { enabled: false }. + * @default true + */ + serverActions?: boolean | { + enabled?: boolean + baseUrl?: string + } } ``` @@ -81,7 +91,8 @@ interface DevupApiOptions { 1. Reads your `openapi.json` file during build 2. Generates TypeScript interface definitions (`api.d.ts`) 3. Creates a URL map and injects it as `process.env.DEVUP_API_URL_MAP` -4. Makes types available for use with `@devup-api/fetch` +4. Generates Server Actions in `df/server.ts` by default +5. Makes types available for use with `@devup-api/fetch` ## TypeScript Configuration diff --git a/packages/vite-plugin/package.json b/packages/vite-plugin/package.json index e947460..408e1e8 100644 --- a/packages/vite-plugin/package.json +++ b/packages/vite-plugin/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/vite-plugin", - "version": "0.1.8", + "version": "0.1.18", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -29,8 +30,8 @@ "@devup-api/core": "*" }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "openapi-types": "^12.1", - "typescript": "^5.9" + "typescript": "^7.0" } } diff --git a/packages/vite-plugin/src/__tests__/plugin.test.ts b/packages/vite-plugin/src/__tests__/plugin.test.ts index 05c359f..462340d 100644 --- a/packages/vite-plugin/src/__tests__/plugin.test.ts +++ b/packages/vite-plugin/src/__tests__/plugin.test.ts @@ -14,6 +14,7 @@ let mockGenerateZodSchemas: ReturnType let mockGenerateZodTypeDeclarations: ReturnType let mockGenerateCrudConfigCode: ReturnType let mockGenerateCrudConfigTypes: ReturnType +let mockGenerateServerActionCode: ReturnType const mockSchema = { openapi: '3.1.0', @@ -40,12 +41,10 @@ const mockSchema = { const mockUrlMap = { getUsers: { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, '/users': { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, } @@ -55,6 +54,7 @@ const mockZodSchemasContent = 'export const schemas = {}' const mockZodTypeDeclarationsContent = 'declare module "@devup-api/zod" {}' const mockCrudConfigCodeContent = 'export function UserCrud() {}' const mockCrudConfigTypesContent = 'declare module "@devup-api/ui/crud" {}' +const mockServerActionsContent = "'use server'" beforeEach(() => { mockCreateTmpDirAsync = spyOn(utils, 'createTmpDirAsync').mockResolvedValue( @@ -89,6 +89,10 @@ beforeEach(() => { generator, 'generateCrudConfigTypes', ).mockReturnValue(mockCrudConfigTypesContent) + mockGenerateServerActionCode = spyOn( + generator, + 'generateServerActionCode', + ).mockReturnValue(mockServerActionsContent) }) test('devupApi returns plugin with correct name', () => { @@ -108,28 +112,29 @@ test.each([ }, ['custom-openapi.json'], ], -] as const)('devupApi returns plugin with config hook: %s', async (options: - | DevupApiOptions - | undefined, expectedFiles: string[]) => { - const plugin = devupApi(options) - expect(plugin.config).toBeDefined() - expect(typeof plugin.config).toBe('function') - - const result = await ( - plugin as unknown as { - config?: () => Promise<{ define: Record }> - } - ).config?.() - expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) - expect(mockCreateUrlMap).toHaveBeenCalledWith(mockSchema, options) - expect(result).toEqual({ - define: { - 'process.env.DEVUP_API_URL_MAP': JSON.stringify( - JSON.stringify(mockUrlMap), - ), - }, - }) -}) +] as const)( + 'devupApi returns plugin with config hook: %s', + async (options: DevupApiOptions | undefined, expectedFiles: string[]) => { + const plugin = devupApi(options) + expect(plugin.config).toBeDefined() + expect(typeof plugin.config).toBe('function') + + const result = await ( + plugin as unknown as { + config?: () => Promise<{ define: Record }> + } + ).config?.() + expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) + expect(mockCreateUrlMap).toHaveBeenCalledWith(mockSchema, options) + expect(result).toEqual({ + define: { + 'process.env.DEVUP_API_URL_MAP': JSON.stringify( + JSON.stringify(mockUrlMap), + ), + }, + }) + }, +) test('devupApi config hook returns empty define when urlMap is null', async () => { mockCreateUrlMap.mockReturnValue(null as never) @@ -182,24 +187,25 @@ test.each([ }, ['custom-openapi.json'], ], -] as const)('devupApi returns plugin with configResolved hook: %s', async (options: - | DevupApiOptions - | undefined, expectedFiles: string[]) => { - const plugin = devupApi(options) - expect(plugin.configResolved).toBeDefined() - expect(typeof plugin.configResolved).toBe('function') - - await ( - plugin as unknown as { configResolved?: () => Promise } - ).configResolved?.() - expect(mockCreateTmpDirAsync).toHaveBeenCalledWith(options?.tempDir) - expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) - expect(mockGenerateInterface).toHaveBeenCalledWith(mockSchema, options) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'api.d.ts'), - mockInterfaceContent, - ) -}) +] as const)( + 'devupApi returns plugin with configResolved hook: %s', + async (options: DevupApiOptions | undefined, expectedFiles: string[]) => { + const plugin = devupApi(options) + expect(plugin.configResolved).toBeDefined() + expect(typeof plugin.configResolved).toBe('function') + + await ( + plugin as unknown as { configResolved?: () => Promise } + ).configResolved?.() + expect(mockCreateTmpDirAsync).toHaveBeenCalledWith(options?.tempDir) + expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) + expect(mockGenerateInterface).toHaveBeenCalledWith(mockSchema, options) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'api.d.ts'), + mockInterfaceContent, + ) + }, +) test('devupApi plugin has both config and configResolved hooks', () => { const plugin = devupApi() @@ -296,6 +302,34 @@ test('devupApi resolveId returns null for partial ui module path', () => { expect(resolveId('@devup-api/ui/other')).toBeNull() }) +// ============================================================================= +// Virtual Server Module Tests +// ============================================================================= + +test('devupApi resolveId returns resolved virtual module for @devup-api/fetch/server', () => { + const plugin = devupApi() + const resolveId = plugin.resolveId as (id: string) => string | null + + const result = resolveId('@devup-api/fetch/server') + expect(result).toBe('\0@devup-api/fetch/server') +}) + +test('devupApi load returns server action code for virtual server module', async () => { + const plugin = devupApi() + const load = plugin.load as (id: string) => Promise + + const result = await load('\0@devup-api/fetch/server') + expect(result).toBe(mockServerActionsContent) + expect(mockGenerateServerActionCode).toHaveBeenCalled() +}) + +test('devupApi load returns null for non-resolved server module', async () => { + const plugin = devupApi() + const load = plugin.load as (id: string) => Promise + + expect(await load('@devup-api/fetch/server')).toBeNull() +}) + test('devupApi load returns crud config code for virtual ui module', async () => { const plugin = devupApi() const load = plugin.load as (id: string) => Promise diff --git a/packages/vite-plugin/src/plugin.ts b/packages/vite-plugin/src/plugin.ts index 3201e44..ff98154 100644 --- a/packages/vite-plugin/src/plugin.ts +++ b/packages/vite-plugin/src/plugin.ts @@ -1,20 +1,24 @@ -import { join } from 'node:path' import type { DevupApiOptions } from '@devup-api/core' import { createUrlMap, generateCrudConfigCode, generateCrudConfigTypes, generateInterface, + generateServerActionCode, + generateServerActionTypes, generateZodSchemas, generateZodTypeDeclarations, } from '@devup-api/generator' import { createTmpDirAsync, + type DevupArtifacts, + type DevupGenerators, + type DevupIOAsync, + generateDevupArtifactsAsync, normalizeOpenapiFiles, readOpenapiAsync, writeInterfaceAsync, } from '@devup-api/utils' -import type { OpenAPIV3_1 } from 'openapi-types' import type { Plugin } from 'vite' const VIRTUAL_ZOD_MODULE = '@devup-api/zod' @@ -23,19 +27,35 @@ const RESOLVED_VIRTUAL_ZOD_MODULE = `\0${VIRTUAL_ZOD_MODULE}` const VIRTUAL_UI_MODULE = '@devup-api/ui/crud' const RESOLVED_VIRTUAL_UI_MODULE = `\0${VIRTUAL_UI_MODULE}` +const VIRTUAL_SERVER_MODULE = '@devup-api/fetch/server' +const RESOLVED_VIRTUAL_SERVER_MODULE = `\0${VIRTUAL_SERVER_MODULE}` + export function devupApi(options?: DevupApiOptions): Plugin { - let cachedSchemas: Record | null = null - let zodSchemasCode: string | null = null - let crudConfigCode: string | null = null + let artifacts: DevupArtifacts | null = null + + const io: DevupIOAsync = { + createTmpDirAsync, + normalizeOpenapiFiles, + readOpenapiAsync, + writeInterfaceAsync, + } + + const generators: DevupGenerators = { + generateInterface, + generateZodSchemas, + generateZodTypeDeclarations, + generateCrudConfigCode, + generateCrudConfigTypes, + generateServerActionCode, + generateServerActionTypes, + createUrlMap, + } - const getSchemas = async (): Promise< - Record - > => { - if (!cachedSchemas) { - const openapiFiles = normalizeOpenapiFiles(options?.openapiFiles) - cachedSchemas = await readOpenapiAsync(openapiFiles) + const getArtifacts = async (): Promise => { + if (!artifacts) { + artifacts = await generateDevupArtifactsAsync(io, generators, options) } - return cachedSchemas + return artifacts } return { @@ -49,56 +69,37 @@ export function devupApi(options?: DevupApiOptions): Plugin { if (id === VIRTUAL_UI_MODULE) { return RESOLVED_VIRTUAL_UI_MODULE } + if (id === VIRTUAL_SERVER_MODULE) { + return RESOLVED_VIRTUAL_SERVER_MODULE + } return null }, // Load virtual module content async load(id) { if (id === RESOLVED_VIRTUAL_ZOD_MODULE) { - if (!zodSchemasCode) { - const schemas = await getSchemas() - zodSchemasCode = generateZodSchemas(schemas, options) - } - return zodSchemasCode + const { files } = await getArtifacts() + return files.zodSchemas } if (id === RESOLVED_VIRTUAL_UI_MODULE) { - if (!crudConfigCode) { - const schemas = await getSchemas() - crudConfigCode = generateCrudConfigCode(schemas) - } - return crudConfigCode + const { files } = await getArtifacts() + return files.crudConfig + } + if (id === RESOLVED_VIRTUAL_SERVER_MODULE) { + const { files } = await getArtifacts() + return files.serverActions } return null }, // Generate type definitions async configResolved() { - const tempDir = await createTmpDirAsync(options?.tempDir) - const schemas = await getSchemas() - - // Write API interface definitions - await writeInterfaceAsync( - join(tempDir, 'api.d.ts'), - generateInterface(schemas, options), - ) - - // Write Zod type declarations - await writeInterfaceAsync( - join(tempDir, 'zod.d.ts'), - generateZodTypeDeclarations(schemas, options), - ) - - // Write CRUD config type declarations - await writeInterfaceAsync( - join(tempDir, 'ui.d.ts'), - generateCrudConfigTypes(schemas), - ) + await getArtifacts() }, // Inject URL map as environment variable async config() { - const schemas = await getSchemas() - const urlMap = createUrlMap(schemas, options) + const { urlMap } = await getArtifacts() const define: Record = {} if (urlMap && Object.keys(urlMap).length > 0) { // json stringify twice to avoid JSON.parse error diff --git a/packages/vite-plugin/tsconfig.json b/packages/vite-plugin/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/vite-plugin/tsconfig.json +++ b/packages/vite-plugin/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/webpack-plugin/README.md b/packages/webpack-plugin/README.md index e9fa691..01ee273 100644 --- a/packages/webpack-plugin/README.md +++ b/packages/webpack-plugin/README.md @@ -86,6 +86,16 @@ interface DevupApiOptions { * @default true */ responseDefaultNonNullable?: boolean + + /** + * Generate operationId-based Server Action wrappers. + * Disable with false or { enabled: false }. + * @default true + */ + serverActions?: boolean | { + enabled?: boolean + baseUrl?: string + } } ``` @@ -94,7 +104,8 @@ interface DevupApiOptions { 1. Reads your `openapi.json` file during build (before compilation) 2. Generates TypeScript interface definitions (`api.d.ts`) 3. Creates a URL map and injects it as `process.env.DEVUP_API_URL_MAP` via webpack DefinePlugin -4. Makes types available for use with `@devup-api/fetch` +4. Generates Server Actions in `df/server.ts` by default +5. Makes types available for use with `@devup-api/fetch` ## TypeScript Configuration diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json index b49b7ed..0b337c2 100644 --- a/packages/webpack-plugin/package.json +++ b/packages/webpack-plugin/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/webpack-plugin", - "version": "0.1.8", + "version": "0.1.18", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -28,8 +29,8 @@ "@devup-api/core": "*" }, "devDependencies": { - "@types/node": "^25.0", + "@types/node": "^26.2", "@types/webpack": "^5.28", - "typescript": "^5.9" + "typescript": "^7.0" } } diff --git a/packages/webpack-plugin/src/__tests__/plugin.test.ts b/packages/webpack-plugin/src/__tests__/plugin.test.ts index f342a05..b87fe9e 100644 --- a/packages/webpack-plugin/src/__tests__/plugin.test.ts +++ b/packages/webpack-plugin/src/__tests__/plugin.test.ts @@ -39,12 +39,10 @@ const mockSchema = { const mockUrlMap = { getUsers: { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, '/users': { - method: 'GET' as const, - url: '/users', + GET: { url: '/users' }, }, } @@ -163,11 +161,14 @@ test.each([ convertCase: 'snake' as const, }, ], -] as const)('devupApiWebpackPlugin constructor initializes with options: %s', (options: DevupApiOptions) => { - const plugin = new devupApiWebpackPlugin(options) - expect(plugin.options).toEqual(options) - expect(plugin.initialized).toBe(false) -}) +] as const)( + 'devupApiWebpackPlugin constructor initializes with options: %s', + (options: DevupApiOptions) => { + const plugin = new devupApiWebpackPlugin(options) + expect(plugin.options).toEqual(options) + expect(plugin.initialized).toBe(false) + }, +) test('devupApiWebpackPlugin apply method registers beforeCompile hook', () => { const plugin = new devupApiWebpackPlugin() @@ -192,57 +193,64 @@ test.each([ }, ['custom-openapi.json'], ], -] as const)('devupApiWebpackPlugin beforeCompile hook executes correctly: %s', async (options: - | DevupApiOptions - | undefined, expectedFiles: string[]) => { - const plugin = new devupApiWebpackPlugin(options) - const compiler = createMockCompiler() - const definePluginApplySpy = spyOn( - compiler.webpack.DefinePlugin.prototype, - 'apply', - ).mockImplementation(() => {}) - const normalModuleReplacementPluginApplySpy = spyOn( - compiler.webpack.NormalModuleReplacementPlugin.prototype, - 'apply', - ).mockImplementation(() => {}) - plugin.apply(compiler) - - const callback = compiler._storedCallback - expect(callback).toBeDefined() - - const mockCallback = mock(() => {}) - await callback?.(null, mockCallback) - - expect(mockCreateTmpDirAsync).toHaveBeenCalledWith(options?.tempDir) - expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) - expect(mockGenerateInterface).toHaveBeenCalledWith(mockSchema, options || {}) - expect(mockGenerateZodSchemas).toHaveBeenCalledWith(mockSchema, options || {}) - expect(mockGenerateZodTypeDeclarations).toHaveBeenCalledWith( - mockSchema, - options || {}, - ) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'api.d.ts'), - mockInterfaceContent, - ) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'zod-schemas.js'), - mockZodSchemasContent, - ) - expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( - join('df', 'zod.d.ts'), - mockZodTypeDeclarationsContent, - ) - // 5 files written: api.d.ts, zod-schemas.js, zod.d.ts, crud-config.js, ui.d.ts - expect(mockWriteInterfaceAsync).toHaveBeenCalledTimes(5) - expect(mockCreateUrlMap).toHaveBeenCalledWith(mockSchema, options || {}) - expect(definePluginApplySpy).toHaveBeenCalled() - expect(normalModuleReplacementPluginApplySpy).toHaveBeenCalled() - expect(mockCallback).toHaveBeenCalled() - expect(plugin.initialized).toBe(true) - definePluginApplySpy.mockRestore() - normalModuleReplacementPluginApplySpy.mockRestore() -}) +] as const)( + 'devupApiWebpackPlugin beforeCompile hook executes correctly: %s', + async (options: DevupApiOptions | undefined, expectedFiles: string[]) => { + const plugin = new devupApiWebpackPlugin(options) + const compiler = createMockCompiler() + const definePluginApplySpy = spyOn( + compiler.webpack.DefinePlugin.prototype, + 'apply', + ).mockImplementation(() => {}) + const normalModuleReplacementPluginApplySpy = spyOn( + compiler.webpack.NormalModuleReplacementPlugin.prototype, + 'apply', + ).mockImplementation(() => {}) + plugin.apply(compiler) + + const callback = compiler._storedCallback + expect(callback).toBeDefined() + + const mockCallback = mock(() => {}) + await callback?.(null, mockCallback) + + expect(mockCreateTmpDirAsync).toHaveBeenCalledWith(options?.tempDir) + expect(mockReadOpenapiAsync).toHaveBeenCalledWith(expectedFiles) + expect(mockGenerateInterface).toHaveBeenCalledWith( + mockSchema, + options || {}, + ) + expect(mockGenerateZodSchemas).toHaveBeenCalledWith( + mockSchema, + options || {}, + ) + expect(mockGenerateZodTypeDeclarations).toHaveBeenCalledWith( + mockSchema, + options || {}, + ) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'api.d.ts'), + mockInterfaceContent, + ) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'zod-schemas.js'), + mockZodSchemasContent, + ) + expect(mockWriteInterfaceAsync).toHaveBeenCalledWith( + join('df', 'zod.d.ts'), + mockZodTypeDeclarationsContent, + ) + // 7 files written: api.d.ts, zod-schemas.js, zod.d.ts, crud-config.js, ui.d.ts, server.ts, server-module.d.ts + expect(mockWriteInterfaceAsync).toHaveBeenCalledTimes(7) + expect(mockCreateUrlMap).toHaveBeenCalledWith(mockSchema, options || {}) + expect(definePluginApplySpy).toHaveBeenCalled() + expect(normalModuleReplacementPluginApplySpy).toHaveBeenCalled() + expect(mockCallback).toHaveBeenCalled() + expect(plugin.initialized).toBe(true) + definePluginApplySpy.mockRestore() + normalModuleReplacementPluginApplySpy.mockRestore() + }, +) test('devupApiWebpackPlugin beforeCompile hook does not add DefinePlugin when urlMap is null', async () => { mockCreateUrlMap.mockReturnValueOnce(null as never) @@ -324,8 +332,8 @@ test('devupApiWebpackPlugin beforeCompile hook only runs once when called multip expect(mockGenerateInterface).toHaveBeenCalledTimes(1) expect(mockGenerateZodSchemas).toHaveBeenCalledTimes(1) expect(mockGenerateZodTypeDeclarations).toHaveBeenCalledTimes(1) - // 5 files written: api.d.ts, zod-schemas.js, zod.d.ts, crud-config.js, ui.d.ts - expect(mockWriteInterfaceAsync).toHaveBeenCalledTimes(5) + // 7 files written: api.d.ts, zod-schemas.js, zod.d.ts, crud-config.js, ui.d.ts, server.ts, server-module.d.ts + expect(mockWriteInterfaceAsync).toHaveBeenCalledTimes(7) expect(mockCreateUrlMap).toHaveBeenCalledTimes(1) expect(mockCallback1).toHaveBeenCalled() expect(mockCallback2).toHaveBeenCalled() diff --git a/packages/webpack-plugin/src/plugin.ts b/packages/webpack-plugin/src/plugin.ts index 49df231..bc68c87 100644 --- a/packages/webpack-plugin/src/plugin.ts +++ b/packages/webpack-plugin/src/plugin.ts @@ -1,15 +1,20 @@ -import { join, resolve } from 'node:path' +import { resolve } from 'node:path' import type { DevupApiOptions } from '@devup-api/core' import { createUrlMap, generateCrudConfigCode, generateCrudConfigTypes, generateInterface, + generateServerActionCode, + generateServerActionTypes, generateZodSchemas, generateZodTypeDeclarations, } from '@devup-api/generator' import { createTmpDirAsync, + type DevupGenerators, + type DevupIOAsync, + generateDevupArtifactsAsync, normalizeOpenapiFiles, readOpenapiAsync, writeInterfaceAsync, @@ -38,42 +43,31 @@ export class devupApiWebpackPlugin { try { this.initialized = true - const tempDir = await createTmpDirAsync(this.options?.tempDir) - const openapiFiles = normalizeOpenapiFiles(this.options?.openapiFiles) - const schemas = await readOpenapiAsync(openapiFiles) - - // Generate interface file - await writeInterfaceAsync( - join(tempDir, 'api.d.ts'), - generateInterface(schemas, this.options), - ) - - // Generate Zod schemas file - await writeInterfaceAsync( - join(tempDir, 'zod-schemas.js'), - generateZodSchemas(schemas, this.options), - ) - - // Generate Zod type declarations - await writeInterfaceAsync( - join(tempDir, 'zod.d.ts'), - generateZodTypeDeclarations(schemas, this.options), - ) + const io: DevupIOAsync = { + createTmpDirAsync, + normalizeOpenapiFiles, + readOpenapiAsync, + writeInterfaceAsync, + } - // Generate CRUD configs file - await writeInterfaceAsync( - join(tempDir, 'crud-configs.jsx'), - generateCrudConfigCode(schemas), - ) + const generators: DevupGenerators = { + generateInterface, + generateZodSchemas, + generateZodTypeDeclarations, + generateCrudConfigCode, + generateCrudConfigTypes, + generateServerActionCode, + generateServerActionTypes, + createUrlMap, + } - // Generate CRUD config type declarations - await writeInterfaceAsync( - join(tempDir, 'ui.d.ts'), - generateCrudConfigTypes(schemas), + const { tempDir, urlMap } = await generateDevupArtifactsAsync( + io, + generators, + this.options, ) // Create urlMap and set environment variable - const urlMap = createUrlMap(schemas, this.options) const define: Record = {} if (urlMap && Object.keys(urlMap).length > 0) { define['process.env.DEVUP_API_URL_MAP'] = JSON.stringify( @@ -100,6 +94,12 @@ export class devupApiWebpackPlugin { crudConfigPath, ).apply(compiler) + const serverPath = resolve(tempDir, 'server.ts') + new compiler.webpack.NormalModuleReplacementPlugin( + /^@devup-api\/fetch\/server$/, + serverPath, + ).apply(compiler) + callback() } catch (error) { this.initialized = false diff --git a/packages/webpack-plugin/tsconfig.json b/packages/webpack-plugin/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/webpack-plugin/tsconfig.json +++ b/packages/webpack-plugin/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force", diff --git a/packages/zod/package.json b/packages/zod/package.json index 523aa4d..7ccb864 100644 --- a/packages/zod/package.json +++ b/packages/zod/package.json @@ -1,7 +1,8 @@ { "name": "@devup-api/zod", - "version": "0.0.1", + "version": "0.1.9", "license": "Apache-2.0", + "repository": "https://github.com/dev-five-git/devup-api", "type": "module", "exports": { ".": { @@ -24,11 +25,11 @@ "zod": ">=4" }, "peerDependencies": { - "zod": "^3.0.0" + "zod": "^4.4" }, "devDependencies": { - "@types/node": "^25.0", - "typescript": "^5.9", - "zod": "^4.3.5" + "@types/node": "^26.2", + "typescript": "^7.0", + "zod": "^4.4" } } diff --git a/packages/zod/src/schema-struct.ts b/packages/zod/src/schema-struct.ts index facf9b8..72bfc42 100644 --- a/packages/zod/src/schema-struct.ts +++ b/packages/zod/src/schema-struct.ts @@ -28,23 +28,13 @@ export interface DevupZodErrorSchemas {} export type DevupZodSchema< Category extends 'response' | 'request' | 'error' = 'response', Server extends keyof DevupApiServers | (string & {}) = 'openapi.json', -> = ExtractValue< - { - response: ExtractValue< - DevupZodResponseSchemas, - Server, - Record - > - request: ExtractValue< - DevupZodRequestSchemas, - Server, - Record - > - error: ExtractValue> - }, - Category, - Record -> +> = Category extends 'response' + ? ExtractValue> + : Category extends 'request' + ? ExtractValue> + : Category extends 'error' + ? ExtractValue> + : Record /** * Access Zod schemas by category for a specific server @@ -75,36 +65,18 @@ export type DevupZodAllSchemas = { * @example * type User = DevupZodSchemaTypes['response']['User'] */ +type InferZodSchemaMap = { + [K in keyof ExtractValue>]: z.infer< + ExtractValue>[K] + > +} + export type DevupZodSchemaTypes< T extends keyof DevupApiServers | (string & {}) = 'openapi.json', > = { - response: { - [K in keyof ExtractValue< - DevupZodResponseSchemas, - T, - Record - >]: z.infer< - ExtractValue>[K] - > - } - request: { - [K in keyof ExtractValue< - DevupZodRequestSchemas, - T, - Record - >]: z.infer< - ExtractValue>[K] - > - } - error: { - [K in keyof ExtractValue< - DevupZodErrorSchemas, - T, - Record - >]: z.infer< - ExtractValue>[K] - > - } + response: InferZodSchemaMap + request: InferZodSchemaMap + error: InferZodSchemaMap } // ============================================================================= diff --git a/packages/zod/tsconfig.json b/packages/zod/tsconfig.json index fa29f35..0d1984e 100644 --- a/packages/zod/tsconfig.json +++ b/packages/zod/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { // Environment setup & latest features "lib": ["ESNext"], + "types": ["bun"], "target": "ESNext", "module": "Preserve", "moduleDetection": "force",