From d47f0c9659fb4caf17c5ca2a14d187049c533ebf Mon Sep 17 00:00:00 2001 From: Lubos Date: Fri, 24 Oct 2025 23:40:58 +0800 Subject: [PATCH 1/7] refactor: pass path to symbol meta instead of resource type --- .../main/test/openapi-ts.config.ts | 16 +++++-- packages/openapi-ts/src/index.ts | 30 +++++++++++- packages/openapi-ts/src/overrides.d.ts | 31 ------------- .../src/plugins/arktype/v2/plugin.ts | 6 +-- .../shared/utils/__tests__/meta.test.ts | 46 ------------------- .../src/plugins/shared/utils/meta.ts | 17 ------- .../src/plugins/valibot/shared/types.d.ts | 8 ++-- .../src/plugins/valibot/v1/operation.ts | 9 ++-- .../src/plugins/valibot/v1/plugin.ts | 7 ++- .../src/plugins/valibot/v1/toAst/array.ts | 2 +- .../src/plugins/valibot/v1/toAst/object.ts | 4 +- .../src/plugins/valibot/v1/toAst/tuple.ts | 2 +- .../src/plugins/valibot/v1/webhook.ts | 3 +- .../openapi-ts/src/plugins/zod/mini/plugin.ts | 22 ++++----- .../src/plugins/zod/mini/toAst/array.ts | 2 +- .../src/plugins/zod/mini/toAst/object.ts | 4 +- .../src/plugins/zod/mini/toAst/tuple.ts | 2 +- .../src/plugins/zod/shared/operation.ts | 15 +++--- .../src/plugins/zod/shared/types.d.ts | 4 +- .../src/plugins/zod/shared/webhook.ts | 8 ++-- .../openapi-ts/src/plugins/zod/v3/plugin.ts | 22 ++++----- .../src/plugins/zod/v3/toAst/array.ts | 2 +- .../src/plugins/zod/v3/toAst/object.ts | 4 +- .../src/plugins/zod/v3/toAst/tuple.ts | 2 +- .../openapi-ts/src/plugins/zod/v4/plugin.ts | 22 ++++----- .../src/plugins/zod/v4/toAst/array.ts | 2 +- .../src/plugins/zod/v4/toAst/object.ts | 4 +- .../src/plugins/zod/v4/toAst/tuple.ts | 2 +- 28 files changed, 111 insertions(+), 187 deletions(-) delete mode 100644 packages/openapi-ts/src/overrides.d.ts delete mode 100644 packages/openapi-ts/src/plugins/shared/utils/__tests__/meta.test.ts delete mode 100644 packages/openapi-ts/src/plugins/shared/utils/meta.ts diff --git a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts index 884192a79..6de2513d8 100644 --- a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts +++ b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts @@ -134,9 +134,17 @@ export default defineConfig(() => { // 'symbol:register:after': ({ plugin, symbol }) => { // console.log(`(global, ${plugin.name}) registered:`, symbol.id); // }, - // 'symbol:register:before': ({ plugin, symbol }) => { - // console.log(`(global, ${plugin.name}):`, symbol.name); - // }, + 'symbol:register:before': ({ plugin, symbol }) => { + // if (!symbol.external && !symbol.meta?.resourceType) { + // console.log(`[${plugin.name}]:`, symbol.name); + // } + if (!symbol.external && !symbol.meta?.path) { + console.log(`[${plugin.name}]:`, symbol.name, symbol.meta); + } + // if (symbol.meta?.path) { + // console.log(`[${plugin.name}]:`, symbol.name, symbol.meta.path); + // } + }, // 'symbol:setValue:after': ({ plugin, symbol }) => { // console.log(`(${plugin.name}) set value:`, symbol.id); // }, @@ -295,7 +303,7 @@ export default defineConfig(() => { // mutationOptions: { // name: '{{name}}MO', // }, - name: '@tanstack/react-query', + // name: '@tanstack/react-query', // queryKeys: { // name: '{{name}}QK', // }, diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 21aec06ff..9d21f173c 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -1,5 +1,31 @@ -// eslint-disable-next-line @typescript-eslint/triple-slash-reference -/// +// OVERRIDES +// hard-coded here because build process doesn't pick up overrides from separate files +import '@hey-api/codegen-core'; + +declare module '@hey-api/codegen-core' { + interface ProjectRenderMeta { + /** + * If specified, this will be the file extension used when importing + * other modules. By default, we don't add a file extension and let the + * runtime resolve it. + * + * @default null + */ + importFileExtension?: (string & {}) | null; + } + + interface SymbolMeta { + /** + * Path to the resource this symbol represents. + */ + path?: ReadonlyArray; + /** + * Name of the plugin that registered this symbol. + */ + pluginName?: string; + } +} +// END OVERRIDES import colors from 'ansi-colors'; // @ts-expect-error diff --git a/packages/openapi-ts/src/overrides.d.ts b/packages/openapi-ts/src/overrides.d.ts deleted file mode 100644 index b3d8e08b5..000000000 --- a/packages/openapi-ts/src/overrides.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import '@hey-api/codegen-core'; - -declare module '@hey-api/codegen-core' { - interface ProjectRenderMeta { - /** - * If specified, this will be the file extension used when importing - * other modules. By default, we don't add a file extension and let the - * runtime resolve it. - * - * @default null - */ - importFileExtension?: (string & {}) | null; - } - - interface SymbolMeta { - /** - * Name of the plugin that registered this symbol. - */ - pluginName?: string; - /** - * Type of resource this symbol represents. - */ - resourceType?: - | 'operation' - | 'parameter' - | 'requestBody' - | 'schema' - | 'server' - | 'webhook'; - } -} diff --git a/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts b/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts index d1faa5fac..d6b6bf76a 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts @@ -2,7 +2,6 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins/shared/types/schema'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; @@ -247,11 +246,10 @@ const handleComponent = ({ }): void => { const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); - const resourceType = pathToSymbolResourceType(state._path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path: state._path.value, }, name: buildName({ config: plugin.config.definitions, @@ -264,7 +262,7 @@ const handleComponent = ({ exported: true, meta: { kind: 'type', - resourceType, + path: state._path.value, }, name: buildName({ config: plugin.config.definitions.types.infer, diff --git a/packages/openapi-ts/src/plugins/shared/utils/__tests__/meta.test.ts b/packages/openapi-ts/src/plugins/shared/utils/__tests__/meta.test.ts deleted file mode 100644 index 397e00666..000000000 --- a/packages/openapi-ts/src/plugins/shared/utils/__tests__/meta.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -import { pathToSymbolResourceType } from '../meta'; - -describe('pathToSymbolResourceType', () => { - it('returns schema for components/schemas', () => { - expect(pathToSymbolResourceType(['components', 'schemas', 'Pet'])).toBe( - 'schema', - ); - }); - - it('returns parameter for components/parameters', () => { - expect( - pathToSymbolResourceType(['components', 'parameters', 'limit']), - ).toBe('parameter'); - }); - - it('returns requestBody for components/requestBodies', () => { - expect( - pathToSymbolResourceType(['components', 'requestBodies', 'Body']), - ).toBe('requestBody'); - }); - - it('returns operation for paths', () => { - expect(pathToSymbolResourceType(['paths', '/pets', 'get'])).toBe( - 'operation', - ); - }); - - it('returns server for servers', () => { - expect(pathToSymbolResourceType(['servers', 0])).toBe('server'); - }); - - it('returns webhook for webhooks', () => { - expect(pathToSymbolResourceType(['webhooks', 'onEvent'])).toBe('webhook'); - }); - - it('returns undefined for unknown paths', () => { - expect( - pathToSymbolResourceType(['components', 'unknown', 'foo']), - ).toBeUndefined(); - expect(pathToSymbolResourceType(['random', 'value'])).toBeUndefined(); - expect(pathToSymbolResourceType(['components'])).toBeUndefined(); - expect(pathToSymbolResourceType([])).toBeUndefined(); - }); -}); diff --git a/packages/openapi-ts/src/plugins/shared/utils/meta.ts b/packages/openapi-ts/src/plugins/shared/utils/meta.ts deleted file mode 100644 index bafbf7e56..000000000 --- a/packages/openapi-ts/src/plugins/shared/utils/meta.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { SymbolMeta } from '@hey-api/codegen-core'; - -export const pathToSymbolResourceType = ( - path: ReadonlyArray, -): SymbolMeta['resourceType'] => { - if (path.length >= 2) { - if (path[0] === 'components') { - if (path[1] === 'schemas') return 'schema'; - if (path[1] === 'parameters') return 'parameter'; - if (path[1] === 'requestBodies') return 'requestBody'; - } - if (path[0] === 'paths') return 'operation'; - if (path[0] === 'servers') return 'server'; - if (path[0] === 'webhooks') return 'webhook'; - } - return; -}; diff --git a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts index bac6dfec1..89a5b8133 100644 --- a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts @@ -10,13 +10,13 @@ export type IrSchemaToAstOptions = { }; export type PluginState = { - /** - * Path to the schema in the intermediary representation. - */ - _path: ReadonlyArray; hasLazyExpression: boolean; nameCase: StringCase; nameTransformer: StringName; + /** + * Path to the schema in the intermediary representation. + */ + path: ReadonlyArray; }; export type ValidatorArgs = { diff --git a/packages/openapi-ts/src/plugins/valibot/v1/operation.ts b/packages/openapi-ts/src/plugins/valibot/v1/operation.ts index a4c1ce784..032d73241 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/operation.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/operation.ts @@ -1,7 +1,6 @@ import { operationResponsesMap } from '~/ir/operation'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { toRef } from '~/plugins/shared/utils/refs'; import type { IrSchemaToAstOptions } from '../shared/types'; @@ -115,7 +114,7 @@ export const irOperationToAst = ({ const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType: pathToSymbolResourceType(state._path.value), + path: state.path.value, }, name: buildName({ config: plugin.config.requests, @@ -136,11 +135,11 @@ export const irOperationToAst = ({ const { response } = operationResponsesMap(operation); if (response) { - const path = [...state._path.value, 'responses']; + const path = [...state.path.value, 'responses']; const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType: pathToSymbolResourceType(path), + path, }, name: buildName({ config: plugin.config.responses, @@ -153,7 +152,7 @@ export const irOperationToAst = ({ schema: response, state: { ...state, - _path: toRef(path), + path: toRef(path), }, symbol, }); diff --git a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts index c3e5ea5ac..527cd8e65 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts @@ -5,7 +5,6 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins/shared/types/schema'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { createSchemaComment } from '~/plugins/shared/utils/schema'; import { tsc } from '~/tsc'; @@ -118,7 +117,7 @@ export const irSchemaToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); return pipesToAst({ pipes: itemAst, plugin }); @@ -215,7 +214,7 @@ export const irSchemaToAst = ({ symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType: pathToSymbolResourceType(state._path.value), + path: state.path.value, }, name: buildName({ config: { @@ -264,10 +263,10 @@ export const handlerV1: ValibotPlugin['Handler'] = ({ plugin }) => { 'webhook', (event) => { const state = toRefs({ - _path: event._path, hasLazyExpression: false, nameCase: plugin.config.definitions.case, nameTransformer: plugin.config.definitions.name, + path: event._path, }); switch (event.type) { diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts index 981863a26..c09f9e165 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts @@ -52,7 +52,7 @@ export const arrayToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); return pipesToAst({ pipes: schemaPipes, plugin }); diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts index 423ee7881..cd3af20d5 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts @@ -35,7 +35,7 @@ export const objectToAst = ({ schema: property, state: { ...state, - _path: toRef([...state._path.value, 'properties', name]), + path: toRef([...state.path.value, 'properties', name]), }, }); @@ -80,7 +80,7 @@ export const objectToAst = ({ schema: schema.additionalProperties, state: { ...state, - _path: toRef([...state._path.value, 'additionalProperties']), + path: toRef([...state.path.value, 'additionalProperties']), }, }); const expression = tsc.callExpression({ diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts index d100c5bdc..645bbd916 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts @@ -50,7 +50,7 @@ export const tupleToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); return pipesToAst({ pipes: schemaPipes, plugin }); diff --git a/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts b/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts index 398398e23..376bb60e2 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts @@ -1,6 +1,5 @@ import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import type { IrSchemaToAstOptions } from '../shared/types'; import { irSchemaToAst } from './plugin'; @@ -113,7 +112,7 @@ export const irWebhookToAst = ({ const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType: pathToSymbolResourceType(state._path.value), + path: state.path.value, }, name: buildName({ config: plugin.config.webhooks, diff --git a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts index 6583b6d3c..6df101a2e 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts @@ -2,7 +2,6 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins/shared/types/schema'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; @@ -103,7 +102,7 @@ export const irSchemaToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }), ); @@ -237,11 +236,10 @@ const handleComponent = ({ }): void => { const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); - const resourceType = pathToSymbolResourceType(state._path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions, @@ -254,7 +252,7 @@ const handleComponent = ({ exported: true, meta: { kind: 'type', - resourceType, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -292,15 +290,15 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { irOperationToAst({ getAst: (schema, path) => { const state = toRefs({ - _path: path, hasLazyExpression: false, + path, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, state: toRefs({ - _path: event._path, + path: event._path, }), }); break; @@ -310,8 +308,8 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.parameter.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -321,8 +319,8 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.requestBody.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -332,8 +330,8 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -341,15 +339,15 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { irWebhookToAst({ getAst: (schema, path) => { const state = toRefs({ - _path: path, hasLazyExpression: false, + path, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, state: toRefs({ - _path: event._path, + path: event._path, }), }); break; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts index 49374643f..a3c7010ea 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts @@ -49,7 +49,7 @@ export const arrayToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); if (itemAst.hasLazyExpression) { diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts index 46c8a14cd..d633be9ba 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts @@ -36,7 +36,7 @@ export const objectToAst = ({ schema: property, state: { ...state, - _path: toRef([...state._path.value, 'properties', name]), + path: toRef([...state.path.value, 'properties', name]), }, }); if (propertyAst.hasLazyExpression) { @@ -93,7 +93,7 @@ export const objectToAst = ({ schema: schema.additionalProperties, state: { ...state, - _path: toRef([...state._path.value, 'additionalProperties']), + path: toRef([...state.path.value, 'additionalProperties']), }, }); result.expression = tsc.callExpression({ diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts index 068597dd3..a8f5c057f 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts @@ -52,7 +52,7 @@ export const tupleToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); tupleElements.push(itemSchema.expression); diff --git a/packages/openapi-ts/src/plugins/zod/shared/operation.ts b/packages/openapi-ts/src/plugins/zod/shared/operation.ts index 04bcfd747..fc6ae8286 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/operation.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/operation.ts @@ -1,7 +1,6 @@ import { operationResponsesMap } from '~/ir/operation'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { exportAst } from './export'; import type { Ast, IrSchemaToAstOptions } from './types'; @@ -117,13 +116,12 @@ export const irOperationToAst = ({ schemaData.required = [...requiredProperties]; - const path = state._path?.value || []; + const path = state.path?.value || []; const ast = getAst(schemaData, path); - const resourceType = pathToSymbolResourceType(path); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path, }, name: buildName({ config: plugin.config.requests, @@ -136,7 +134,7 @@ export const irOperationToAst = ({ exported: true, meta: { kind: 'type', - resourceType, + path, }, name: buildName({ config: plugin.config.requests.types.infer, @@ -159,13 +157,12 @@ export const irOperationToAst = ({ const { response } = operationResponsesMap(operation); if (response) { - const path = [...(state._path?.value || []), 'responses']; + const path = [...(state.path?.value || []), 'responses']; const ast = getAst(response, path); - const resourceType = pathToSymbolResourceType(path); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path, }, name: buildName({ config: plugin.config.responses, @@ -178,7 +175,7 @@ export const irOperationToAst = ({ exported: true, meta: { kind: 'type', - resourceType, + path, }, name: buildName({ config: plugin.config.responses.types.infer, diff --git a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts index 90fcf86f1..7e07ced22 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts @@ -17,11 +17,11 @@ export type IrSchemaToAstOptions = { }; export type PluginState = { + hasLazyExpression: boolean; /** * Path to the schema in the intermediary representation. */ - _path: ReadonlyArray; - hasLazyExpression: boolean; + path: ReadonlyArray; }; export type ValidatorArgs = { diff --git a/packages/openapi-ts/src/plugins/zod/shared/webhook.ts b/packages/openapi-ts/src/plugins/zod/shared/webhook.ts index 62ab05468..4fcaed40f 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/webhook.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/webhook.ts @@ -1,6 +1,5 @@ import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { exportAst } from './export'; import type { Ast, IrSchemaToAstOptions } from './types'; @@ -116,13 +115,12 @@ export const irWebhookToAst = ({ schemaData.required = [...requiredProperties]; - const path = state._path?.value || []; + const path = state.path?.value || []; const ast = getAst(schemaData, path); - const resourceType = pathToSymbolResourceType(path); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path, }, name: buildName({ config: plugin.config.webhooks, @@ -135,7 +133,7 @@ export const irWebhookToAst = ({ exported: true, meta: { kind: 'type', - resourceType, + path, }, name: buildName({ config: plugin.config.webhooks.types.infer, diff --git a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts index a625aa8ba..7417b5326 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts @@ -2,7 +2,6 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins/shared/types/schema'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; @@ -89,7 +88,7 @@ export const irSchemaToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); return typeAst.expression; @@ -211,11 +210,10 @@ const handleComponent = ({ }): void => { const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); - const resourceType = pathToSymbolResourceType(state._path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions, @@ -228,7 +226,7 @@ const handleComponent = ({ exported: true, meta: { kind: 'type', - resourceType, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -265,15 +263,15 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { irOperationToAst({ getAst: (schema, path) => { const state = toRefs({ - _path: path, hasLazyExpression: false, + path, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, state: toRefs({ - _path: event._path, + path: event._path, }), }); break; @@ -283,8 +281,8 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.parameter.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -294,8 +292,8 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.requestBody.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -305,8 +303,8 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -314,15 +312,15 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { irWebhookToAst({ getAst: (schema, path) => { const state = toRefs({ - _path: path, hasLazyExpression: false, + path, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, state: toRefs({ - _path: event._path, + path: event._path, }), }); break; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts index 895d83465..7d2270939 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts @@ -52,7 +52,7 @@ export const arrayToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); if (itemAst.hasLazyExpression) { diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts index 24721e70a..5e466aedb 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts @@ -37,7 +37,7 @@ export const objectToAst = ({ schema: property, state: { ...state, - _path: toRef([...state._path.value, 'properties', name]), + path: toRef([...state.path.value, 'properties', name]), }, }); @@ -81,7 +81,7 @@ export const objectToAst = ({ schema: schema.additionalProperties, state: { ...state, - _path: toRef([...state._path.value, 'additionalProperties']), + path: toRef([...state.path.value, 'additionalProperties']), }, }); const expression = tsc.callExpression({ diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts index ec6e8f0db..b83208f7e 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts @@ -57,7 +57,7 @@ export const tupleToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); tupleElements.push(itemSchema.expression); diff --git a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts index fcb072a6a..d932f608a 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts @@ -2,7 +2,6 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins/shared/types/schema'; -import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; @@ -103,7 +102,7 @@ export const irSchemaToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }), ); @@ -239,11 +238,10 @@ const handleComponent = ({ }): void => { const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); - const resourceType = pathToSymbolResourceType(state._path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { - resourceType, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions, @@ -256,7 +254,7 @@ const handleComponent = ({ exported: true, meta: { kind: 'type', - resourceType, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -293,15 +291,15 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { irOperationToAst({ getAst: (schema, path) => { const state = toRefs({ - _path: path, hasLazyExpression: false, + path, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, state: toRefs({ - _path: event._path, + path: event._path, }), }); break; @@ -311,8 +309,8 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.parameter.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -322,8 +320,8 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.requestBody.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -333,8 +331,8 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { plugin, schema: event.schema, state: toRefs({ - _path: event._path, hasLazyExpression: false, + path: event._path, }), }); break; @@ -342,15 +340,15 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { irWebhookToAst({ getAst: (schema, path) => { const state = toRefs({ - _path: path, hasLazyExpression: false, + path, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, state: toRefs({ - _path: event._path, + path: event._path, }), }); break; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts index 0d78f2635..1087a4a95 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts @@ -49,7 +49,7 @@ export const arrayToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); if (itemAst.hasLazyExpression) { diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts index 607f0ea3e..6c778c775 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts @@ -36,7 +36,7 @@ export const objectToAst = ({ schema: property, state: { ...state, - _path: toRef([...state._path.value, 'properties', name]), + path: toRef([...state.path.value, 'properties', name]), }, }); if (propertyAst.hasLazyExpression) { @@ -93,7 +93,7 @@ export const objectToAst = ({ schema: schema.additionalProperties, state: { ...state, - _path: toRef([...state._path.value, 'additionalProperties']), + path: toRef([...state.path.value, 'additionalProperties']), }, }); result.expression = tsc.callExpression({ diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts index f875ed7b9..2e300d0ae 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts @@ -52,7 +52,7 @@ export const tupleToAst = ({ schema: item, state: { ...state, - _path: toRef([...state._path.value, 'items', index]), + path: toRef([...state.path.value, 'items', index]), }, }); tupleElements.push(itemSchema.expression); -- 2.51.2 From 013c2f5fa20456c7ae11b03ce575dc33abc0b0cd Mon Sep 17 00:00:00 2001 From: Lubos Date: Sat, 25 Oct 2025 02:16:25 +0800 Subject: [PATCH 2/7] refactor: clean up typescript plugin --- packages/openapi-ts/src/generate/client.ts | 2 +- packages/openapi-ts/src/index.ts | 2 +- .../src/plugins/@angular/common/api.ts | 2 +- .../src/plugins/@angular/common/types.d.ts | 2 +- .../plugins/@hey-api/client-angular/api.ts | 2 +- .../@hey-api/client-angular/types.d.ts | 2 +- .../src/plugins/@hey-api/client-axios/api.ts | 2 +- .../plugins/@hey-api/client-axios/types.d.ts | 2 +- .../plugins/@hey-api/client-core/types.d.ts | 2 +- .../src/plugins/@hey-api/client-fetch/api.ts | 2 +- .../plugins/@hey-api/client-fetch/types.d.ts | 2 +- .../src/plugins/@hey-api/client-next/api.ts | 2 +- .../plugins/@hey-api/client-next/types.d.ts | 2 +- .../src/plugins/@hey-api/client-nuxt/api.ts | 2 +- .../plugins/@hey-api/client-nuxt/types.d.ts | 2 +- .../src/plugins/@hey-api/client-ofetch/api.ts | 2 +- .../plugins/@hey-api/client-ofetch/types.d.ts | 2 +- .../@hey-api/legacy-angular/types.d.ts | 2 +- .../plugins/@hey-api/legacy-axios/types.d.ts | 2 +- .../plugins/@hey-api/legacy-fetch/types.d.ts | 2 +- .../plugins/@hey-api/legacy-node/types.d.ts | 2 +- .../plugins/@hey-api/legacy-xhr/types.d.ts | 2 +- .../src/plugins/@hey-api/schemas/api.ts | 2 +- .../src/plugins/@hey-api/schemas/types.d.ts | 2 +- .../src/plugins/@hey-api/sdk/api.ts | 2 +- .../src/plugins/@hey-api/sdk/operation.ts | 15 + .../src/plugins/@hey-api/sdk/types.d.ts | 8 +- .../src/plugins/@hey-api/transformers/api.ts | 2 +- .../plugins/@hey-api/transformers/plugin.ts | 1 + .../plugins/@hey-api/transformers/types.d.ts | 2 +- .../src/plugins/@hey-api/typescript/api.ts | 10 +- .../src/plugins/@hey-api/typescript/plugin.ts | 607 +----------------- .../typescript/{ => shared}/clientOptions.ts | 2 +- .../typescript/{ => shared}/export.ts | 2 +- .../typescript/{ => shared}/operation.ts | 28 +- .../@hey-api/typescript/shared/types.d.ts | 15 + .../typescript/{ => shared}/webhook.ts | 23 +- .../typescript/{ => shared}/webhooks.ts | 2 +- .../plugins/@hey-api/typescript/types.d.ts | 2 +- .../src/plugins/@hey-api/typescript/v1/api.ts | 1 + .../plugins/@hey-api/typescript/v1/plugin.ts | 210 ++++++ .../@hey-api/typescript/v1/toAst/array.ts | 51 ++ .../@hey-api/typescript/v1/toAst/boolean.ts | 22 + .../@hey-api/typescript/v1/toAst/enum.ts | 24 + .../@hey-api/typescript/v1/toAst/index.ts | 98 +++ .../@hey-api/typescript/v1/toAst/never.ts | 18 + .../@hey-api/typescript/v1/toAst/null.ts | 18 + .../@hey-api/typescript/v1/toAst/number.ts | 30 + .../@hey-api/typescript/v1/toAst/object.ts | 131 ++++ .../@hey-api/typescript/v1/toAst/string.ts | 118 ++++ .../@hey-api/typescript/v1/toAst/tuple.ts | 41 ++ .../@hey-api/typescript/v1/toAst/undefined.ts | 18 + .../@hey-api/typescript/v1/toAst/unknown.ts | 17 + .../@hey-api/typescript/v1/toAst/void.ts | 18 + .../src/plugins/@pinia/colada/api.ts | 2 +- .../src/plugins/@pinia/colada/types.d.ts | 2 +- .../angular-query-experimental/api.ts | 2 +- .../angular-query-experimental/types.d.ts | 2 +- .../query-core/infiniteQueryOptions.ts | 5 + .../src/plugins/@tanstack/react-query/api.ts | 2 +- .../plugins/@tanstack/react-query/types.d.ts | 2 +- .../src/plugins/@tanstack/solid-query/api.ts | 2 +- .../plugins/@tanstack/solid-query/types.d.ts | 2 +- .../src/plugins/@tanstack/svelte-query/api.ts | 2 +- .../plugins/@tanstack/svelte-query/types.d.ts | 2 +- .../src/plugins/@tanstack/vue-query/api.ts | 2 +- .../plugins/@tanstack/vue-query/types.d.ts | 2 +- .../openapi-ts/src/plugins/arktype/api.ts | 2 +- .../src/plugins/arktype/shared/types.d.ts | 2 +- .../openapi-ts/src/plugins/arktype/types.d.ts | 2 +- packages/openapi-ts/src/plugins/config.ts | 3 +- .../openapi-ts/src/plugins/fastify/api.ts | 2 +- .../openapi-ts/src/plugins/fastify/types.d.ts | 2 +- packages/openapi-ts/src/plugins/index.ts | 3 + .../src/plugins/shared/types/schema.d.ts | 6 +- .../src/plugins/shared/utils/config.ts | 2 +- .../src/plugins/shared/utils/instance.ts | 2 +- .../openapi-ts/src/plugins/valibot/api.ts | 2 +- .../src/plugins/valibot/shared/types.d.ts | 2 +- .../openapi-ts/src/plugins/valibot/types.d.ts | 2 +- .../src/plugins/valibot/v1/plugin.ts | 2 +- .../src/plugins/valibot/v1/toAst/array.ts | 2 +- .../src/plugins/valibot/v1/toAst/boolean.ts | 2 +- .../src/plugins/valibot/v1/toAst/enum.ts | 2 +- .../src/plugins/valibot/v1/toAst/index.ts | 2 +- .../src/plugins/valibot/v1/toAst/never.ts | 2 +- .../src/plugins/valibot/v1/toAst/null.ts | 2 +- .../src/plugins/valibot/v1/toAst/number.ts | 2 +- .../src/plugins/valibot/v1/toAst/object.ts | 2 +- .../src/plugins/valibot/v1/toAst/string.ts | 2 +- .../src/plugins/valibot/v1/toAst/tuple.ts | 2 +- .../src/plugins/valibot/v1/toAst/undefined.ts | 2 +- .../src/plugins/valibot/v1/toAst/unknown.ts | 2 +- .../src/plugins/valibot/v1/toAst/void.ts | 2 +- packages/openapi-ts/src/plugins/zod/api.ts | 2 +- .../openapi-ts/src/plugins/zod/mini/plugin.ts | 2 +- .../src/plugins/zod/mini/toAst/array.ts | 2 +- .../src/plugins/zod/mini/toAst/boolean.ts | 2 +- .../src/plugins/zod/mini/toAst/enum.ts | 2 +- .../src/plugins/zod/mini/toAst/index.ts | 2 +- .../src/plugins/zod/mini/toAst/never.ts | 2 +- .../src/plugins/zod/mini/toAst/null.ts | 2 +- .../src/plugins/zod/mini/toAst/number.ts | 2 +- .../src/plugins/zod/mini/toAst/object.ts | 2 +- .../src/plugins/zod/mini/toAst/string.ts | 2 +- .../src/plugins/zod/mini/toAst/tuple.ts | 2 +- .../src/plugins/zod/mini/toAst/undefined.ts | 2 +- .../src/plugins/zod/mini/toAst/unknown.ts | 2 +- .../src/plugins/zod/mini/toAst/void.ts | 2 +- .../src/plugins/zod/shared/types.d.ts | 2 +- .../openapi-ts/src/plugins/zod/types.d.ts | 2 +- .../openapi-ts/src/plugins/zod/v3/plugin.ts | 2 +- .../src/plugins/zod/v3/toAst/array.ts | 2 +- .../src/plugins/zod/v3/toAst/boolean.ts | 2 +- .../src/plugins/zod/v3/toAst/enum.ts | 2 +- .../src/plugins/zod/v3/toAst/index.ts | 2 +- .../src/plugins/zod/v3/toAst/never.ts | 2 +- .../src/plugins/zod/v3/toAst/null.ts | 2 +- .../src/plugins/zod/v3/toAst/number.ts | 2 +- .../src/plugins/zod/v3/toAst/object.ts | 2 +- .../src/plugins/zod/v3/toAst/string.ts | 2 +- .../src/plugins/zod/v3/toAst/tuple.ts | 2 +- .../src/plugins/zod/v3/toAst/undefined.ts | 2 +- .../src/plugins/zod/v3/toAst/unknown.ts | 2 +- .../src/plugins/zod/v3/toAst/void.ts | 2 +- .../openapi-ts/src/plugins/zod/v4/plugin.ts | 2 +- .../src/plugins/zod/v4/toAst/array.ts | 2 +- .../src/plugins/zod/v4/toAst/boolean.ts | 2 +- .../src/plugins/zod/v4/toAst/enum.ts | 2 +- .../src/plugins/zod/v4/toAst/index.ts | 2 +- .../src/plugins/zod/v4/toAst/never.ts | 2 +- .../src/plugins/zod/v4/toAst/null.ts | 2 +- .../src/plugins/zod/v4/toAst/number.ts | 2 +- .../src/plugins/zod/v4/toAst/object.ts | 2 +- .../src/plugins/zod/v4/toAst/string.ts | 2 +- .../src/plugins/zod/v4/toAst/tuple.ts | 2 +- .../src/plugins/zod/v4/toAst/undefined.ts | 2 +- .../src/plugins/zod/v4/toAst/unknown.ts | 2 +- .../src/plugins/zod/v4/toAst/void.ts | 2 +- packages/openapi-ts/src/types/config.d.ts | 3 +- 140 files changed, 1015 insertions(+), 751 deletions(-) rename packages/openapi-ts/src/plugins/@hey-api/typescript/{ => shared}/clientOptions.ts (97%) rename packages/openapi-ts/src/plugins/@hey-api/typescript/{ => shared}/export.ts (98%) rename packages/openapi-ts/src/plugins/@hey-api/typescript/{ => shared}/operation.ts (92%) create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts rename packages/openapi-ts/src/plugins/@hey-api/typescript/{ => shared}/webhook.ts (86%) rename packages/openapi-ts/src/plugins/@hey-api/typescript/{ => shared}/webhooks.ts (92%) create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/api.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/array.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/boolean.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/enum.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/index.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/never.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/null.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/number.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/object.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/string.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/tuple.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/undefined.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/unknown.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/void.ts create mode 100644 packages/openapi-ts/src/plugins/index.ts diff --git a/packages/openapi-ts/src/generate/client.ts b/packages/openapi-ts/src/generate/client.ts index a93d3d214..d8bc028c9 100644 --- a/packages/openapi-ts/src/generate/client.ts +++ b/packages/openapi-ts/src/generate/client.ts @@ -4,9 +4,9 @@ import { fileURLToPath } from 'node:url'; import type { IProject, ProjectRenderMeta } from '@hey-api/codegen-core'; +import type { DefinePlugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; -import type { DefinePlugin } from '~/plugins/types'; import type { Config } from '~/types/config'; import { ensureDirSync, relativeModulePath } from './utils'; diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 9d21f173c..da9b7ca1b 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -186,6 +186,7 @@ export type { OpenApiResponseObject, OpenApiSchemaObject, } from './openApi/types'; +export type { DefinePlugin, Plugin } from './plugins'; export type { AngularClient } from './plugins/@hey-api/client-angular'; export type { AxiosClient } from './plugins/@hey-api/client-axios'; export { @@ -201,7 +202,6 @@ export type { OfetchClient } from './plugins/@hey-api/client-ofetch'; export type { ExpressionTransformer } from './plugins/@hey-api/transformers/expressions'; export type { TypeTransformer } from './plugins/@hey-api/transformers/types'; export { definePluginConfig } from './plugins/shared/utils/config'; -export type { DefinePlugin, Plugin } from './plugins/types'; export { compiler, tsc } from './tsc'; export type { UserConfig } from './types/config'; export type { LegacyIR } from './types/types'; diff --git a/packages/openapi-ts/src/plugins/@angular/common/api.ts b/packages/openapi-ts/src/plugins/@angular/common/api.ts index ba721b633..db8534fb8 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/api.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | 'class' diff --git a/packages/openapi-ts/src/plugins/@angular/common/types.d.ts b/packages/openapi-ts/src/plugins/@angular/common/types.d.ts index 680b72b85..c3afb3a9d 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/types.d.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/types.d.ts @@ -1,4 +1,4 @@ -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts index 1fdc9a1f7..33eb298e6 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts index 5bb2cff2f..fbce45746 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts index ee544c72c..0fb4762f6 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts index 058c44449..6ff5f9ac7 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts index d76b102fe..98e667627 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts @@ -1,10 +1,10 @@ +import type { Plugin } from '~/plugins'; import type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular'; import type { HeyApiClientAxiosPlugin } from '~/plugins/@hey-api/client-axios'; import type { HeyApiClientFetchPlugin } from '~/plugins/@hey-api/client-fetch'; import type { HeyApiClientNextPlugin } from '~/plugins/@hey-api/client-next'; import type { HeyApiClientNuxtPlugin } from '~/plugins/@hey-api/client-nuxt'; import type { HeyApiClientOfetchPlugin } from '~/plugins/@hey-api/client-ofetch'; -import type { Plugin } from '~/plugins/types'; export interface PluginHandler { (...args: Parameters): void; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts index 29e1dbc4d..bf79983f1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts index 37d3b06f0..06648252a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts index d95026b35..db284b1cf 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts index 7319f3521..8e6a1be30 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts index e84b7849e..97a275a63 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts index 4f297a0bb..62fec570e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts index 2e94cdb89..82f58c08b 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts index 697618a19..4f08d0cc5 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts index 82f85d754..9072e138f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/angular'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts index 0ca49022f..5022702c8 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/axios'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts index 448d0020c..f6497c47f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/fetch'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts index 9def74381..34a193bd2 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/node'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts index 7b6d2623c..9cad4e080 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts @@ -1,5 +1,5 @@ +import type { DefinePlugin, Plugin } from '~/plugins'; import type { Client } from '~/plugins/@hey-api/client-core/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/xhr'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts index b24c4005c..3acb41aae 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'ref'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts index 856239acb..87af061fc 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts @@ -2,7 +2,7 @@ import type { OpenApiV2Schema, OpenApiV3Schema } from '~/openApi'; import type { OpenApiV2_0_XTypes } from '~/openApi/2.0.x'; import type { OpenApiV3_0_XTypes } from '~/openApi/3.0.x'; import type { OpenApiV3_1_XTypes } from '~/openApi/3.1.x'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts index 18031c2fe..2ba29bbd3 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; import { createOperationComment } from './comment'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts index f52b7b260..5d9311733 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts @@ -228,6 +228,11 @@ export const operationParameters = ({ type: pluginTypeScript.api.schemaToType({ plugin: pluginTypeScript, schema: parameter.schema, + state: { + path: { + value: [], + }, + }, }), }); } @@ -249,6 +254,11 @@ export const operationParameters = ({ type: pluginTypeScript.api.schemaToType({ plugin: pluginTypeScript, schema: parameter.schema, + state: { + path: { + value: [], + }, + }, }), }); } @@ -265,6 +275,11 @@ export const operationParameters = ({ type: pluginTypeScript.api.schemaToType({ plugin: pluginTypeScript, schema: operation.body.schema, + state: { + path: { + value: [], + }, + }, }), }); } diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts index 54994441e..76d8fef87 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts @@ -1,10 +1,6 @@ import type { IR } from '~/ir/types'; -import type { - DefinePlugin, - Plugin, - PluginClientNames, - PluginValidatorNames, -} from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; +import type { PluginClientNames, PluginValidatorNames } from '~/plugins/types'; import type { StringName } from '~/types/case'; import type { Operation } from '~/types/client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts index 5b9a9a449..55c6c02ff 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'response' | 'response-ref'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts index b74608fe7..7d1267441 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts @@ -61,6 +61,7 @@ const processSchemaType = ({ const selector = plugin.api.selector('response-ref', schema.$ref); if (!plugin.getSymbol(selector)) { + // TODO: remove // create each schema response transformer only once const refSchema = plugin.context.resolveIrRef( schema.$ref, diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts index 66efda569..fa9414af1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { IApi } from './api'; import type { ExpressionTransformer } from './expressions'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts index 3b453b007..81b588520 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts @@ -1,9 +1,9 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; -import { schemaToType } from './plugin'; +import { irSchemaToAstV1 } from './v1/api'; type SelectorType = | 'ClientOptions' @@ -19,7 +19,7 @@ type SelectorType = | 'Webhooks'; export type IApi = { - schemaToType: (args: Parameters[0]) => ts.TypeNode; + schemaToType: (args: Parameters[0]) => ts.TypeNode; /** * @param type Selector type. * @param value Depends on `type`: @@ -46,7 +46,7 @@ export class Api implements IApi { return [this.meta.name, ...(args as Selector)]; } - schemaToType(args: Parameters[0]): ts.TypeNode { - return schemaToType(args); + schemaToType(args: Parameters[0]): ts.TypeNode { + return irSchemaToAstV1(args); } } diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts index 4907d28a2..ad6d073a8 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts @@ -1,606 +1,5 @@ -import type ts from 'typescript'; - -import { deduplicateSchema } from '~/ir/schema'; -import type { IR } from '~/ir/types'; -import { buildName } from '~/openApi/shared/utils/name'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; -import { fieldName } from '~/plugins/shared/utils/case'; -import { createSchemaComment } from '~/plugins/shared/utils/schema'; -import type { Property } from '~/tsc'; -import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; -import { stringCase } from '~/utils/stringCase'; - -import { createClientOptions } from './clientOptions'; -import { exportType } from './export'; -import { operationToType } from './operation'; import type { HeyApiTypeScriptPlugin } from './types'; -import { webhookToType } from './webhook'; -import { createWebhooks } from './webhooks'; - -const arrayTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: SchemaWithType<'array'>; -}): ts.TypeNode => { - if (!schema.items) { - return tsc.typeArrayNode( - tsc.keywordTypeNode({ keyword: plugin.config.topType }), - ); - } - - schema = deduplicateSchema({ detectFormat: true, schema }); - - const itemTypes: Array = []; - - for (const item of schema.items!) { - const type = schemaToType({ - plugin, - schema: item, - }); - itemTypes.push(type); - } - - if (itemTypes.length === 1) { - return tsc.typeArrayNode(itemTypes[0]!); - } - - if (schema.logicalOperator === 'and') { - return tsc.typeArrayNode(tsc.typeIntersectionNode({ types: itemTypes })); - } - - return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemTypes })); -}; - -const booleanTypeToIdentifier = ({ - schema, -}: { - schema: SchemaWithType<'boolean'>; -}): ts.TypeNode => { - if (schema.const !== undefined) { - return tsc.literalTypeNode({ - literal: tsc.ots.boolean(schema.const as boolean), - }); - } - - return tsc.keywordTypeNode({ - keyword: 'boolean', - }); -}; - -const enumTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: SchemaWithType<'enum'>; -}): ts.TypeNode => { - const type = schemaToType({ - plugin, - schema: { - ...schema, - type: undefined, - }, - }); - return type; -}; - -const numberTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: SchemaWithType<'integer' | 'number'>; -}): ts.TypeNode => { - if (schema.const !== undefined) { - return tsc.literalTypeNode({ - literal: tsc.ots.number(schema.const as number), - }); - } - - if (schema.type === 'integer' && schema.format === 'int64') { - // TODO: parser - add ability to skip type transformers - if (plugin.getPlugin('@hey-api/transformers')?.config.bigInt) { - return tsc.typeReferenceNode({ typeName: 'bigint' }); - } - } - - return tsc.keywordTypeNode({ - keyword: 'number', - }); -}; - -const objectTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: SchemaWithType<'object'>; -}): ts.TypeNode => { - // TODO: parser - handle constants - let indexKey: ts.TypeReferenceNode | undefined; - let indexProperty: Property | undefined; - const schemaProperties: Array = []; - let indexPropertyItems: Array = []; - const required = schema.required ?? []; - let hasOptionalProperties = false; - - for (const name in schema.properties) { - const property = schema.properties[name]!; - const propertyType = schemaToType({ - plugin, - schema: property, - }); - const isRequired = required.includes(name); - schemaProperties.push({ - comment: createSchemaComment({ schema: property }), - isReadOnly: property.accessScope === 'read', - isRequired, - name: fieldName({ context: plugin.context, name }), - type: propertyType, - }); - indexPropertyItems.push(property); - - if (!isRequired) { - hasOptionalProperties = true; - } - } - - // include pattern value schemas into the index union - if (schema.patternProperties) { - for (const pattern in schema.patternProperties) { - const ir = schema.patternProperties[pattern]!; - indexPropertyItems.unshift(ir); - } - } - - const hasPatterns = - !!schema.patternProperties && - Object.keys(schema.patternProperties).length > 0; - - const addPropsRaw = schema.additionalProperties; - const addPropsObj = - addPropsRaw !== false && addPropsRaw - ? (addPropsRaw as IR.SchemaObject) - : undefined; - const shouldCreateIndex = - hasPatterns || - (!!addPropsObj && - (addPropsObj.type !== 'never' || !indexPropertyItems.length)); - - if (shouldCreateIndex) { - // only inject additionalProperties when it’s not "never" - const addProps = addPropsObj; - if (addProps && addProps.type !== 'never') { - indexPropertyItems.unshift(addProps); - } else if ( - !hasPatterns && - !indexPropertyItems.length && - addProps && - addProps.type === 'never' - ) { - // keep "never" only when there are NO patterns and NO explicit properties - indexPropertyItems = [addProps]; - } - - if (hasOptionalProperties) { - indexPropertyItems.push({ - type: 'undefined', - }); - } - - indexProperty = { - isRequired: !schema.propertyNames, - name: 'key', - type: - indexPropertyItems.length === 1 - ? schemaToType({ - plugin, - schema: indexPropertyItems[0]!, - }) - : schemaToType({ - plugin, - schema: { items: indexPropertyItems, logicalOperator: 'or' }, - }), - }; - - if (schema.propertyNames?.$ref) { - indexKey = schemaToType({ - plugin, - schema: { - $ref: schema.propertyNames.$ref, - }, - }) as ts.TypeReferenceNode; - } - } - - return tsc.typeInterfaceNode({ - indexKey, - indexProperty, - properties: schemaProperties, - useLegacyResolution: false, - }); -}; - -const stringTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: SchemaWithType<'string'>; -}): ts.TypeNode => { - if (schema.const !== undefined) { - return tsc.literalTypeNode({ - literal: tsc.stringLiteral({ text: schema.const as string }), - }); - } - - if (schema.format) { - if (schema.format === 'binary') { - return tsc.typeUnionNode({ - types: [ - tsc.typeReferenceNode({ - typeName: 'Blob', - }), - tsc.typeReferenceNode({ - typeName: 'File', - }), - ], - }); - } - - if (schema.format === 'date-time' || schema.format === 'date') { - // TODO: parser - add ability to skip type transformers - if (plugin.getPlugin('@hey-api/transformers')?.config.dates) { - return tsc.typeReferenceNode({ typeName: 'Date' }); - } - } - - if (schema.format === 'typeid' && typeof schema.example === 'string') { - const parts = String(schema.example).split('_'); - parts.pop(); // remove the ID part - const type = parts.join('_'); - - const selector = plugin.api.selector('TypeID', type); - if (!plugin.getSymbol(selector)) { - const selectorTypeId = plugin.api.selector('TypeID'); - - if (!plugin.getSymbol(selectorTypeId)) { - const symbolTypeId = plugin.registerSymbol({ - exported: true, - meta: { - kind: 'type', - }, - name: 'TypeID', - selector: selectorTypeId, - }); - const nodeTypeId = tsc.typeAliasDeclaration({ - exportType: symbolTypeId.exported, - name: symbolTypeId.placeholder, - type: tsc.templateLiteralType({ - value: [ - tsc.typeReferenceNode({ typeName: 'T' }), - '_', - tsc.keywordTypeNode({ keyword: 'string' }), - ], - }), - typeParameters: [ - tsc.typeParameterDeclaration({ - constraint: tsc.keywordTypeNode({ - keyword: 'string', - }), - name: 'T', - }), - ], - }); - plugin.setSymbolValue(symbolTypeId, nodeTypeId); - } - - const symbolTypeId = plugin.referenceSymbol(selectorTypeId); - const symbolTypeName = plugin.registerSymbol({ - exported: true, - meta: { - kind: 'type', - }, - name: stringCase({ - case: plugin.config.case, - value: `${type}_id`, - }), - selector, - }); - const node = tsc.typeAliasDeclaration({ - exportType: symbolTypeName.exported, - name: symbolTypeName.placeholder, - type: tsc.typeReferenceNode({ - typeArguments: [ - tsc.literalTypeNode({ - literal: tsc.stringLiteral({ text: type }), - }), - ], - typeName: symbolTypeId.placeholder, - }), - }); - plugin.setSymbolValue(symbolTypeName, node); - } - const symbol = plugin.referenceSymbol(selector); - return tsc.typeReferenceNode({ typeName: symbol.placeholder }); - } - } - - return tsc.keywordTypeNode({ - keyword: 'string', - }); -}; - -const tupleTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: SchemaWithType<'tuple'>; -}): ts.TypeNode => { - let itemTypes: Array = []; - - if (schema.const && Array.isArray(schema.const)) { - itemTypes = schema.const.map((value) => { - const expression = tsc.valueToExpression({ value }); - return expression ?? tsc.identifier({ text: plugin.config.topType }); - }); - } else if (schema.items) { - for (const item of schema.items) { - const type = schemaToType({ - plugin, - schema: item, - }); - itemTypes.push(type); - } - } - - return tsc.typeTupleNode({ - types: itemTypes, - }); -}; - -const schemaTypeToIdentifier = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: IR.SchemaObject; -}): ts.TypeNode => { - const transformersPlugin = plugin.getPlugin('@hey-api/transformers'); - if (transformersPlugin?.config.typeTransformers) { - for (const typeTransformer of transformersPlugin.config.typeTransformers) { - const typeNode = typeTransformer({ schema }); - if (typeNode) { - return typeNode; - } - } - } - - switch (schema.type as Required['type']) { - case 'array': - return arrayTypeToIdentifier({ - plugin, - schema: schema as SchemaWithType<'array'>, - }); - case 'boolean': - return booleanTypeToIdentifier({ - schema: schema as SchemaWithType<'boolean'>, - }); - case 'enum': - return enumTypeToIdentifier({ - plugin, - schema: schema as SchemaWithType<'enum'>, - }); - case 'integer': - case 'number': - return numberTypeToIdentifier({ - plugin, - schema: schema as SchemaWithType<'integer' | 'number'>, - }); - case 'never': - return tsc.keywordTypeNode({ - keyword: 'never', - }); - case 'null': - return tsc.literalTypeNode({ - literal: tsc.null(), - }); - case 'object': - return objectTypeToIdentifier({ - plugin, - schema: schema as SchemaWithType<'object'>, - }); - case 'string': - return stringTypeToIdentifier({ - plugin, - schema: schema as SchemaWithType<'string'>, - }); - case 'tuple': - return tupleTypeToIdentifier({ - plugin, - schema: schema as SchemaWithType<'tuple'>, - }); - case 'undefined': - return tsc.keywordTypeNode({ - keyword: 'undefined', - }); - case 'unknown': - return tsc.keywordTypeNode({ - keyword: plugin.config.topType, - }); - case 'void': - return tsc.keywordTypeNode({ - keyword: 'void', - }); - } -}; - -export const schemaToType = ({ - plugin, - schema, -}: { - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: IR.SchemaObject; -}): ts.TypeNode => { - if (schema.$ref) { - const symbol = plugin.referenceSymbol( - plugin.api.selector('ref', schema.$ref), - ); - return tsc.typeReferenceNode({ typeName: symbol.placeholder }); - } - - if (schema.type) { - return schemaTypeToIdentifier({ plugin, schema }); - } - - if (schema.items) { - schema = deduplicateSchema({ detectFormat: false, schema }); - if (schema.items) { - const itemTypes: Array = []; - - for (const item of schema.items) { - const type = schemaToType({ plugin, schema: item }); - itemTypes.push(type); - } - - return schema.logicalOperator === 'and' - ? tsc.typeIntersectionNode({ types: itemTypes }) - : tsc.typeUnionNode({ types: itemTypes }); - } - - return schemaToType({ plugin, schema }); - } - - // catch-all fallback for failed schemas - return schemaTypeToIdentifier({ - plugin, - schema: { - type: 'unknown', - }, - }); -}; - -const handleComponent = ({ - id, - plugin, - schema, -}: { - id: string; - plugin: HeyApiTypeScriptPlugin['Instance']; - schema: IR.SchemaObject; -}) => { - const type = schemaToType({ plugin, schema }); - - // Don't tag enums as 'type' since they export runtime artifacts (values) - const isEnum = schema.type === 'enum' && plugin.config.enums.enabled; - - const symbol = plugin.registerSymbol({ - exported: true, - meta: { - kind: isEnum ? undefined : 'type', - }, - name: buildName({ - config: plugin.config.definitions, - name: refToName(id), - }), - selector: plugin.api.selector('ref', id), - }); - exportType({ - plugin, - schema, - symbol, - type, - }); -}; - -export const handler: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => { - // reserve identifier for ClientOptions - const symbolClientOptions = plugin.registerSymbol({ - exported: true, - meta: { - kind: 'type', - }, - name: buildName({ - config: { - case: plugin.config.case, - }, - name: 'ClientOptions', - }), - selector: plugin.api.selector('ClientOptions'), - }); - // reserve identifier for Webhooks - const symbolWebhooks = plugin.registerSymbol({ - exported: true, - meta: { - kind: 'type', - }, - name: buildName({ - config: { - case: plugin.config.case, - }, - name: 'Webhooks', - }), - selector: plugin.api.selector('Webhooks'), - }); - - const servers: Array = []; - const webhookNames: Array = []; - - plugin.forEach( - 'operation', - 'parameter', - 'requestBody', - 'schema', - 'server', - 'webhook', - (event) => { - switch (event.type) { - case 'operation': - operationToType({ operation: event.operation, plugin }); - break; - case 'parameter': - handleComponent({ - id: event.$ref, - plugin, - schema: event.parameter.schema, - }); - break; - case 'requestBody': - handleComponent({ - id: event.$ref, - plugin, - schema: event.requestBody.schema, - }); - break; - case 'schema': - handleComponent({ - id: event.$ref, - plugin, - schema: event.schema, - }); - break; - case 'server': - servers.push(event.server); - break; - case 'webhook': - webhookNames.push( - webhookToType({ - operation: event.operation, - plugin, - }), - ); - break; - } - }, - { - order: 'declarations', - }, - ); +import { handlerV1 } from './v1/plugin'; - createClientOptions({ plugin, servers, symbolClientOptions }); - createWebhooks({ plugin, symbolWebhooks, webhookNames }); -}; +export const handler: HeyApiTypeScriptPlugin['Handler'] = (args) => + handlerV1(args); diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/clientOptions.ts similarity index 97% rename from packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts rename to packages/openapi-ts/src/plugins/@hey-api/typescript/shared/clientOptions.ts index e5a032432..3927dcb49 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/clientOptions.ts @@ -9,7 +9,7 @@ import { import { tsc } from '~/tsc'; import { parseUrl } from '~/utils/url'; -import type { HeyApiTypeScriptPlugin } from './types'; +import type { HeyApiTypeScriptPlugin } from '../types'; const stringType = tsc.keywordTypeNode({ keyword: 'string' }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/export.ts similarity index 98% rename from packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts rename to packages/openapi-ts/src/plugins/@hey-api/typescript/shared/export.ts index b84ed2e67..b2c78dad7 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/export.ts @@ -7,7 +7,7 @@ import { tsc } from '~/tsc'; import { numberRegExp } from '~/utils/regexp'; import { stringCase } from '~/utils/stringCase'; -import type { HeyApiTypeScriptPlugin } from './types'; +import type { HeyApiTypeScriptPlugin } from '../types'; const schemaToEnumObject = ({ plugin, diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts similarity index 92% rename from packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts rename to packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts index 490275976..5a8bd5cbf 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts @@ -4,8 +4,8 @@ import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import { tsc } from '~/tsc'; -import { schemaToType } from './plugin'; -import type { HeyApiTypeScriptPlugin } from './types'; +import { irSchemaToAst } from '../v1/plugin'; +import type { IrSchemaToAstOptions } from './types'; const irParametersToIrSchema = ({ parameters, @@ -46,9 +46,9 @@ const irParametersToIrSchema = ({ const operationToDataType = ({ operation, plugin, -}: { + state, +}: IrSchemaToAstOptions & { operation: IR.OperationObject; - plugin: HeyApiTypeScriptPlugin['Instance']; }) => { const data: IR.SchemaObject = { type: 'object', @@ -124,6 +124,7 @@ const operationToDataType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: plugin.config.requests, @@ -131,9 +132,10 @@ const operationToDataType = ({ }), selector: plugin.api.selector('data', operation.id), }); - const type = schemaToType({ + const type = irSchemaToAst({ plugin, schema: data, + state, }); const node = tsc.typeAliasDeclaration({ exportType: symbol.exported, @@ -146,11 +148,11 @@ const operationToDataType = ({ export const operationToType = ({ operation, plugin, -}: { + state, +}: IrSchemaToAstOptions & { operation: IR.OperationObject; - plugin: HeyApiTypeScriptPlugin['Instance']; }) => { - operationToDataType({ operation, plugin }); + operationToDataType({ operation, plugin, state }); const { error, errors, response, responses } = operationResponsesMap(operation); @@ -160,6 +162,7 @@ export const operationToType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: plugin.config.errors, @@ -167,9 +170,10 @@ export const operationToType = ({ }), selector: plugin.api.selector('errors', operation.id), }); - const type = schemaToType({ + const type = irSchemaToAst({ plugin, schema: errors, + state, }); const node = tsc.typeAliasDeclaration({ exportType: symbolErrors.exported, @@ -183,6 +187,7 @@ export const operationToType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: { @@ -216,6 +221,7 @@ export const operationToType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: plugin.config.responses, @@ -223,9 +229,10 @@ export const operationToType = ({ }), selector: plugin.api.selector('responses', operation.id), }); - const type = schemaToType({ + const type = irSchemaToAst({ plugin, schema: responses, + state, }); const node = tsc.typeAliasDeclaration({ exportType: symbolResponses.exported, @@ -239,6 +246,7 @@ export const operationToType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: { diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts new file mode 100644 index 000000000..6828485f3 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts @@ -0,0 +1,15 @@ +import type { ToRefs } from '~/plugins'; + +import type { HeyApiTypeScriptPlugin } from '../types'; + +export type IrSchemaToAstOptions = { + plugin: HeyApiTypeScriptPlugin['Instance']; + state: ToRefs; +}; + +export type PluginState = { + /** + * Path to the schema in the intermediary representation. + */ + path: ReadonlyArray; +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts similarity index 86% rename from packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts rename to packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts index d1874fae1..7d426076b 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts @@ -3,15 +3,15 @@ import { buildName } from '~/openApi/shared/utils/name'; import { createSchemaComment } from '~/plugins/shared/utils/schema'; import { tsc } from '~/tsc'; -import { schemaToType } from './plugin'; -import type { HeyApiTypeScriptPlugin } from './types'; +import { irSchemaToAst } from '../v1/plugin'; +import type { IrSchemaToAstOptions } from './types'; const operationToDataType = ({ operation, plugin, -}: { + state, +}: IrSchemaToAstOptions & { operation: IR.OperationObject; - plugin: HeyApiTypeScriptPlugin['Instance']; }): string => { const data: IR.SchemaObject = { type: 'object', @@ -27,6 +27,7 @@ const operationToDataType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: { @@ -37,9 +38,10 @@ const operationToDataType = ({ }), selector: plugin.api.selector('webhook-payload', operation.id), }); - const type = schemaToType({ + const type = irSchemaToAst({ plugin, schema: operation.body.schema, + state, }); const node = tsc.typeAliasDeclaration({ comment: createSchemaComment({ schema: operation.body.schema }), @@ -53,6 +55,7 @@ const operationToDataType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: symbolWebhookPayload.name, placeholder: symbolWebhookPayload.placeholder, @@ -79,6 +82,7 @@ const operationToDataType = ({ exported: true, meta: { kind: 'type', + path: state.path.value, }, name: buildName({ config: plugin.config.webhooks, @@ -86,9 +90,10 @@ const operationToDataType = ({ }), selector: plugin.api.selector('webhook-request', operation.id), }); - const type = schemaToType({ + const type = irSchemaToAst({ plugin, schema: data, + state, }); const node = tsc.typeAliasDeclaration({ exportType: symbolWebhookRequest.exported, @@ -103,11 +108,11 @@ const operationToDataType = ({ export const webhookToType = ({ operation, plugin, -}: { + state, +}: IrSchemaToAstOptions & { operation: IR.OperationObject; - plugin: HeyApiTypeScriptPlugin['Instance']; }): string => { - const name = operationToDataType({ operation, plugin }); + const name = operationToDataType({ operation, plugin, state }); return name; // don't handle webhook responses for now, users only need requestBody diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhooks.ts similarity index 92% rename from packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts rename to packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhooks.ts index 242373b74..7e5a285ea 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhooks.ts @@ -2,7 +2,7 @@ import type { Symbol } from '@hey-api/codegen-core'; import { tsc } from '~/tsc'; -import type { HeyApiTypeScriptPlugin } from './types'; +import type { HeyApiTypeScriptPlugin } from '../types'; export const createWebhooks = ({ plugin, diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts index fd1659c37..116b9ee1a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts @@ -1,4 +1,4 @@ -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/api.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/api.ts new file mode 100644 index 000000000..00c0d33f9 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/api.ts @@ -0,0 +1 @@ +export { irSchemaToAst as irSchemaToAstV1 } from './plugin'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts new file mode 100644 index 000000000..2e67e6a86 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts @@ -0,0 +1,210 @@ +import type ts from 'typescript'; + +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins'; +import { toRefs } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + +import { createClientOptions } from '../shared/clientOptions'; +import { exportType } from '../shared/export'; +import { operationToType } from '../shared/operation'; +import type { IrSchemaToAstOptions } from '../shared/types'; +import { webhookToType } from '../shared/webhook'; +import { createWebhooks } from '../shared/webhooks'; +import type { HeyApiTypeScriptPlugin } from '../types'; +import { irSchemaWithTypeToAst } from './toAst'; + +export const irSchemaToAst = ({ + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + schema: IR.SchemaObject; +}): ts.TypeNode => { + if (schema.$ref) { + const symbol = plugin.referenceSymbol( + plugin.api.selector('ref', schema.$ref), + ); + return tsc.typeReferenceNode({ typeName: symbol.placeholder }); + } + + if (schema.type) { + return irSchemaWithTypeToAst({ + plugin, + schema: schema as SchemaWithType, + state, + }); + } + + if (schema.items) { + schema = deduplicateSchema({ detectFormat: false, schema }); + if (schema.items) { + const itemTypes: Array = []; + + for (const item of schema.items) { + const type = irSchemaToAst({ plugin, schema: item, state }); + itemTypes.push(type); + } + + return schema.logicalOperator === 'and' + ? tsc.typeIntersectionNode({ types: itemTypes }) + : tsc.typeUnionNode({ types: itemTypes }); + } + + return irSchemaToAst({ plugin, schema, state }); + } + + // catch-all fallback for failed schemas + return irSchemaWithTypeToAst({ + plugin, + schema: { + type: 'unknown', + }, + state, + }); +}; + +const handleComponent = ({ + $ref, + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + $ref: string; + schema: IR.SchemaObject; +}) => { + const type = irSchemaToAst({ plugin, schema, state }); + + // Don't tag enums as 'type' since they export runtime artifacts (values) + const isEnum = schema.type === 'enum' && plugin.config.enums.enabled; + + const symbol = plugin.registerSymbol({ + exported: true, + meta: { + kind: isEnum ? undefined : 'type', + path: state.path.value, + }, + name: buildName({ + config: plugin.config.definitions, + name: refToName($ref), + }), + selector: plugin.api.selector('ref', $ref), + }); + exportType({ + plugin, + schema, + symbol, + type, + }); +}; + +export const handlerV1: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => { + // reserve identifier for ClientOptions + const symbolClientOptions = plugin.registerSymbol({ + exported: true, + meta: { + kind: 'type', + path: [], + }, + name: buildName({ + config: { + case: plugin.config.case, + }, + name: 'ClientOptions', + }), + selector: plugin.api.selector('ClientOptions'), + }); + // reserve identifier for Webhooks + const symbolWebhooks = plugin.registerSymbol({ + exported: true, + meta: { + kind: 'type', + path: [], + }, + name: buildName({ + config: { + case: plugin.config.case, + }, + name: 'Webhooks', + }), + selector: plugin.api.selector('Webhooks'), + }); + + const servers: Array = []; + const webhookNames: Array = []; + + plugin.forEach( + 'operation', + 'parameter', + 'requestBody', + 'schema', + 'server', + 'webhook', + (event) => { + switch (event.type) { + case 'operation': + operationToType({ + operation: event.operation, + plugin, + state: toRefs({ + path: event._path, + }), + }); + break; + case 'parameter': + handleComponent({ + $ref: event.$ref, + plugin, + schema: event.parameter.schema, + state: toRefs({ + path: event._path, + }), + }); + break; + case 'requestBody': + handleComponent({ + $ref: event.$ref, + plugin, + schema: event.requestBody.schema, + state: toRefs({ + path: event._path, + }), + }); + break; + case 'schema': + handleComponent({ + $ref: event.$ref, + plugin, + schema: event.schema, + state: toRefs({ + path: event._path, + }), + }); + break; + case 'server': + servers.push(event.server); + break; + case 'webhook': + webhookNames.push( + webhookToType({ + operation: event.operation, + plugin, + state: toRefs({ + path: event._path, + }), + }), + ); + break; + } + }, + { + order: 'declarations', + }, + ); + + createClientOptions({ plugin, servers, symbolClientOptions }); + createWebhooks({ plugin, symbolWebhooks, webhookNames }); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/array.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/array.ts new file mode 100644 index 000000000..4aceae173 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/array.ts @@ -0,0 +1,51 @@ +import type ts from 'typescript'; + +import { deduplicateSchema } from '~/ir/schema'; +import type { SchemaWithType } from '~/plugins'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; +import { irSchemaToAst } from '../plugin'; + +export const arrayToAst = ({ + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'array'>; +}): ts.TypeNode => { + if (!schema.items) { + return tsc.typeArrayNode( + tsc.keywordTypeNode({ keyword: plugin.config.topType }), + ); + } + + schema = deduplicateSchema({ detectFormat: true, schema }); + + const itemTypes: Array = []; + + if (schema.items) { + schema.items.forEach((item, index) => { + const type = irSchemaToAst({ + plugin, + schema: item, + state: { + ...state, + path: toRef([...state.path.value, 'items', index]), + }, + }); + itemTypes.push(type); + }); + } + + if (itemTypes.length === 1) { + return tsc.typeArrayNode(itemTypes[0]!); + } + + if (schema.logicalOperator === 'and') { + return tsc.typeArrayNode(tsc.typeIntersectionNode({ types: itemTypes })); + } + + return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemTypes })); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/boolean.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/boolean.ts new file mode 100644 index 000000000..e811fe51f --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/boolean.ts @@ -0,0 +1,22 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const booleanToAst = ({ + schema, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'boolean'>; +}): ts.TypeNode => { + if (schema.const !== undefined) { + return tsc.literalTypeNode({ + literal: tsc.ots.boolean(schema.const as boolean), + }); + } + + return tsc.keywordTypeNode({ + keyword: 'boolean', + }); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/enum.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/enum.ts new file mode 100644 index 000000000..61033601a --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/enum.ts @@ -0,0 +1,24 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; +import { irSchemaToAst } from '../plugin'; + +export const enumToAst = ({ + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'enum'>; +}): ts.TypeNode => { + const type = irSchemaToAst({ + plugin, + schema: { + ...schema, + type: undefined, + }, + state, + }); + return type; +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/index.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/index.ts new file mode 100644 index 000000000..23976ff0a --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/index.ts @@ -0,0 +1,98 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; +import { arrayToAst } from './array'; +import { booleanToAst } from './boolean'; +import { enumToAst } from './enum'; +import { neverToAst } from './never'; +import { nullToAst } from './null'; +import { numberToAst } from './number'; +import { objectToAst } from './object'; +import { stringToAst } from './string'; +import { tupleToAst } from './tuple'; +import { undefinedToAst } from './undefined'; +import { unknownToAst } from './unknown'; +import { voidToAst } from './void'; + +export const irSchemaWithTypeToAst = ({ + schema, + ...args +}: IrSchemaToAstOptions & { + schema: SchemaWithType; +}): ts.TypeNode => { + const transformersPlugin = args.plugin.getPlugin('@hey-api/transformers'); + if (transformersPlugin?.config.typeTransformers) { + for (const typeTransformer of transformersPlugin.config.typeTransformers) { + const typeNode = typeTransformer({ schema }); + if (typeNode) { + return typeNode; + } + } + } + + switch (schema.type) { + case 'array': + return arrayToAst({ + ...args, + schema: schema as SchemaWithType<'array'>, + }); + case 'boolean': + return booleanToAst({ + ...args, + schema: schema as SchemaWithType<'boolean'>, + }); + case 'enum': + return enumToAst({ + ...args, + schema: schema as SchemaWithType<'enum'>, + }); + case 'integer': + case 'number': + return numberToAst({ + ...args, + schema: schema as SchemaWithType<'integer' | 'number'>, + }); + case 'never': + return neverToAst({ + ...args, + schema: schema as SchemaWithType<'never'>, + }); + case 'null': + return nullToAst({ + ...args, + schema: schema as SchemaWithType<'null'>, + }); + case 'object': + return objectToAst({ + ...args, + schema: schema as SchemaWithType<'object'>, + }); + case 'string': + return stringToAst({ + ...args, + schema: schema as SchemaWithType<'string'>, + }); + case 'tuple': + return tupleToAst({ + ...args, + schema: schema as SchemaWithType<'tuple'>, + }); + case 'undefined': + return undefinedToAst({ + ...args, + schema: schema as SchemaWithType<'undefined'>, + }); + case 'unknown': + return unknownToAst({ + ...args, + schema: schema as SchemaWithType<'unknown'>, + }); + case 'void': + return voidToAst({ + ...args, + schema: schema as SchemaWithType<'void'>, + }); + } +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/never.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/never.ts new file mode 100644 index 000000000..cf523fbb9 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/never.ts @@ -0,0 +1,18 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const neverToAst = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _args: IrSchemaToAstOptions & { + schema: SchemaWithType<'never'>; + }, +): ts.TypeNode => { + const node = tsc.keywordTypeNode({ + keyword: 'never', + }); + return node; +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/null.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/null.ts new file mode 100644 index 000000000..7a17b31f6 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/null.ts @@ -0,0 +1,18 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const nullToAst = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _args: IrSchemaToAstOptions & { + schema: SchemaWithType<'null'>; + }, +): ts.TypeNode => { + const node = tsc.literalTypeNode({ + literal: tsc.null(), + }); + return node; +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/number.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/number.ts new file mode 100644 index 000000000..f9ef8b95a --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/number.ts @@ -0,0 +1,30 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const numberToAst = ({ + plugin, + schema, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'integer' | 'number'>; +}): ts.TypeNode => { + if (schema.const !== undefined) { + return tsc.literalTypeNode({ + literal: tsc.ots.number(schema.const as number), + }); + } + + if (schema.type === 'integer' && schema.format === 'int64') { + // TODO: parser - add ability to skip type transformers + if (plugin.getPlugin('@hey-api/transformers')?.config.bigInt) { + return tsc.typeReferenceNode({ typeName: 'bigint' }); + } + } + + return tsc.keywordTypeNode({ + keyword: 'number', + }); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/object.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/object.ts new file mode 100644 index 000000000..12a4616f1 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/object.ts @@ -0,0 +1,131 @@ +import type ts from 'typescript'; + +import type { IR } from '~/ir/types'; +import type { SchemaWithType } from '~/plugins'; +import { fieldName } from '~/plugins/shared/utils/case'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import type { Property } from '~/tsc'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; +import { irSchemaToAst } from '../plugin'; + +export const objectToAst = ({ + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'object'>; +}): ts.TypeNode => { + // TODO: parser - handle constants + let indexKey: ts.TypeReferenceNode | undefined; + let indexProperty: Property | undefined; + const schemaProperties: Array = []; + let indexPropertyItems: Array = []; + const required = schema.required ?? []; + let hasOptionalProperties = false; + + for (const name in schema.properties) { + const property = schema.properties[name]!; + const propertyType = irSchemaToAst({ + plugin, + schema: property, + state: { + ...state, + path: toRef([...state.path.value, 'properties', name]), + }, + }); + const isRequired = required.includes(name); + schemaProperties.push({ + comment: createSchemaComment({ schema: property }), + isReadOnly: property.accessScope === 'read', + isRequired, + name: fieldName({ context: plugin.context, name }), + type: propertyType, + }); + indexPropertyItems.push(property); + + if (!isRequired) { + hasOptionalProperties = true; + } + } + + // include pattern value schemas into the index union + if (schema.patternProperties) { + for (const pattern in schema.patternProperties) { + const ir = schema.patternProperties[pattern]!; + indexPropertyItems.unshift(ir); + } + } + + const hasPatterns = + !!schema.patternProperties && + Object.keys(schema.patternProperties).length > 0; + + const addPropsRaw = schema.additionalProperties; + const addPropsObj = + addPropsRaw !== false && addPropsRaw + ? (addPropsRaw as IR.SchemaObject) + : undefined; + const shouldCreateIndex = + hasPatterns || + (!!addPropsObj && + (addPropsObj.type !== 'never' || !indexPropertyItems.length)); + + if (shouldCreateIndex) { + // only inject additionalProperties when it’s not "never" + const addProps = addPropsObj; + if (addProps && addProps.type !== 'never') { + indexPropertyItems.unshift(addProps); + } else if ( + !hasPatterns && + !indexPropertyItems.length && + addProps && + addProps.type === 'never' + ) { + // keep "never" only when there are NO patterns and NO explicit properties + indexPropertyItems = [addProps]; + } + + if (hasOptionalProperties) { + indexPropertyItems.push({ + type: 'undefined', + }); + } + + indexProperty = { + isRequired: !schema.propertyNames, + name: 'key', + type: + indexPropertyItems.length === 1 + ? irSchemaToAst({ + plugin, + schema: indexPropertyItems[0]!, + state, + }) + : irSchemaToAst({ + plugin, + schema: { items: indexPropertyItems, logicalOperator: 'or' }, + state, + }), + }; + + if (schema.propertyNames?.$ref) { + indexKey = irSchemaToAst({ + plugin, + schema: { + $ref: schema.propertyNames.$ref, + }, + state, + }) as ts.TypeReferenceNode; + } + } + + return tsc.typeInterfaceNode({ + indexKey, + indexProperty, + properties: schemaProperties, + useLegacyResolution: false, + }); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/string.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/string.ts new file mode 100644 index 000000000..690e381c6 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/string.ts @@ -0,0 +1,118 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; +import { stringCase } from '~/utils/stringCase'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const stringToAst = ({ + plugin, + schema, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'string'>; +}): ts.TypeNode => { + if (schema.const !== undefined) { + return tsc.literalTypeNode({ + literal: tsc.stringLiteral({ text: schema.const as string }), + }); + } + + if (schema.format) { + if (schema.format === 'binary') { + return tsc.typeUnionNode({ + types: [ + tsc.typeReferenceNode({ + typeName: 'Blob', + }), + tsc.typeReferenceNode({ + typeName: 'File', + }), + ], + }); + } + + if (schema.format === 'date-time' || schema.format === 'date') { + // TODO: parser - add ability to skip type transformers + if (plugin.getPlugin('@hey-api/transformers')?.config.dates) { + return tsc.typeReferenceNode({ typeName: 'Date' }); + } + } + + if (schema.format === 'typeid' && typeof schema.example === 'string') { + const parts = String(schema.example).split('_'); + parts.pop(); // remove the ID part + const type = parts.join('_'); + + const selector = plugin.api.selector('TypeID', type); + if (!plugin.getSymbol(selector)) { + const selectorTypeId = plugin.api.selector('TypeID'); + + if (!plugin.getSymbol(selectorTypeId)) { + const symbolTypeId = plugin.registerSymbol({ + exported: true, + meta: { + kind: 'type', + path: [], + }, + name: 'TypeID', + selector: selectorTypeId, + }); + const nodeTypeId = tsc.typeAliasDeclaration({ + exportType: symbolTypeId.exported, + name: symbolTypeId.placeholder, + type: tsc.templateLiteralType({ + value: [ + tsc.typeReferenceNode({ typeName: 'T' }), + '_', + tsc.keywordTypeNode({ keyword: 'string' }), + ], + }), + typeParameters: [ + tsc.typeParameterDeclaration({ + constraint: tsc.keywordTypeNode({ + keyword: 'string', + }), + name: 'T', + }), + ], + }); + plugin.setSymbolValue(symbolTypeId, nodeTypeId); + } + + const symbolTypeId = plugin.referenceSymbol(selectorTypeId); + const symbolTypeName = plugin.registerSymbol({ + exported: true, + meta: { + kind: 'type', + path: [], + }, + name: stringCase({ + case: plugin.config.case, + value: `${type}_id`, + }), + selector, + }); + const node = tsc.typeAliasDeclaration({ + exportType: symbolTypeName.exported, + name: symbolTypeName.placeholder, + type: tsc.typeReferenceNode({ + typeArguments: [ + tsc.literalTypeNode({ + literal: tsc.stringLiteral({ text: type }), + }), + ], + typeName: symbolTypeId.placeholder, + }), + }); + plugin.setSymbolValue(symbolTypeName, node); + } + const symbol = plugin.referenceSymbol(selector); + return tsc.typeReferenceNode({ typeName: symbol.placeholder }); + } + } + + return tsc.keywordTypeNode({ + keyword: 'string', + }); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/tuple.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/tuple.ts new file mode 100644 index 000000000..94ea9386d --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/tuple.ts @@ -0,0 +1,41 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; +import { irSchemaToAst } from '../plugin'; + +export const tupleToAst = ({ + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'tuple'>; +}): ts.TypeNode => { + let itemTypes: Array = []; + + if (schema.const && Array.isArray(schema.const)) { + itemTypes = schema.const.map((value) => { + const expression = tsc.valueToExpression({ value }); + return expression ?? tsc.identifier({ text: plugin.config.topType }); + }); + } else if (schema.items) { + schema.items.forEach((item, index) => { + const type = irSchemaToAst({ + plugin, + schema: item, + state: { + ...state, + path: toRef([...state.path.value, 'items', index]), + }, + }); + itemTypes.push(type); + }); + } + + return tsc.typeTupleNode({ + types: itemTypes, + }); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/undefined.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/undefined.ts new file mode 100644 index 000000000..0fb3beb69 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/undefined.ts @@ -0,0 +1,18 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const undefinedToAst = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _args: IrSchemaToAstOptions & { + schema: SchemaWithType<'undefined'>; + }, +): ts.TypeNode => { + const node = tsc.keywordTypeNode({ + keyword: 'undefined', + }); + return node; +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/unknown.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/unknown.ts new file mode 100644 index 000000000..e9ad2777b --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/unknown.ts @@ -0,0 +1,17 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const unknownToAst = ({ + plugin, +}: IrSchemaToAstOptions & { + schema: SchemaWithType<'unknown'>; +}): ts.TypeNode => { + const node = tsc.keywordTypeNode({ + keyword: plugin.config.topType, + }); + return node; +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/void.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/void.ts new file mode 100644 index 000000000..7eb3bdf00 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/toAst/void.ts @@ -0,0 +1,18 @@ +import type ts from 'typescript'; + +import type { SchemaWithType } from '~/plugins'; +import { tsc } from '~/tsc'; + +import type { IrSchemaToAstOptions } from '../../shared/types'; + +export const voidToAst = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _args: IrSchemaToAstOptions & { + schema: SchemaWithType<'void'>; + }, +): ts.TypeNode => { + const node = tsc.keywordTypeNode({ + keyword: 'void', + }); + return node; +}; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/api.ts b/packages/openapi-ts/src/plugins/@pinia/colada/api.ts index e2eb81a04..5edf0b7d9 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/api.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | '_JSONValue' diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts b/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts index efc2d3fd4..7dac20451 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts index 450cafabc..4a6f754ea 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts index 80334a301..4f1110025 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts index db1cbe65b..303bd0a2c 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts @@ -270,6 +270,11 @@ export const createInfiniteQueryOptions = ({ const type = pluginTypeScript.api.schemaToType({ plugin: pluginTypeScript, schema: pagination.schema, + state: { + path: { + value: [], + }, + }, }); const typePageParam = `${tsNodeToString({ node: type, diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts index 3d70e15b9..13189fb81 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts index 4ac7abd75..5cfb0c9fd 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts index ae14ba2b5..c863cf681 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts index 3f2bdbb40..11f3ffe0c 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts index 8be5ab3fa..9f9c93d2c 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts index c6442afb2..f15da4664 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts index bb4cd391c..f59559ff4 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts index 1c546c59b..7f469f2d2 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/arktype/api.ts b/packages/openapi-ts/src/plugins/arktype/api.ts index 48d65b53d..10ef71405 100644 --- a/packages/openapi-ts/src/plugins/arktype/api.ts +++ b/packages/openapi-ts/src/plugins/arktype/api.ts @@ -1,7 +1,7 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; import type { ValidatorArgs } from './shared/types'; import { createRequestValidatorV2, createResponseValidatorV2 } from './v2/api'; diff --git a/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts b/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts index dfa46bcff..9fd1a8477 100644 --- a/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; -import type { ToRefs } from '~/plugins/shared/types/refs'; +import type { ToRefs } from '~/plugins'; import type { ArktypePlugin } from '../types'; diff --git a/packages/openapi-ts/src/plugins/arktype/types.d.ts b/packages/openapi-ts/src/plugins/arktype/types.d.ts index 6f78cded3..744ac7c62 100644 --- a/packages/openapi-ts/src/plugins/arktype/types.d.ts +++ b/packages/openapi-ts/src/plugins/arktype/types.d.ts @@ -1,4 +1,4 @@ -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/config.ts b/packages/openapi-ts/src/plugins/config.ts index e72265ae7..27198c07b 100644 --- a/packages/openapi-ts/src/plugins/config.ts +++ b/packages/openapi-ts/src/plugins/config.ts @@ -1,3 +1,4 @@ +import type { Plugin } from '~/plugins'; import type { AngularCommonPlugin } from '~/plugins/@angular/common'; import { defaultConfig as angularCommon } from '~/plugins/@angular/common'; import type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular'; @@ -46,7 +47,7 @@ import type { ArktypePlugin } from '~/plugins/arktype'; import { defaultConfig as arktype } from '~/plugins/arktype'; import type { FastifyPlugin } from '~/plugins/fastify'; import { defaultConfig as fastify } from '~/plugins/fastify'; -import type { Plugin, PluginNames } from '~/plugins/types'; +import type { PluginNames } from '~/plugins/types'; import type { ValibotPlugin } from '~/plugins/valibot'; import { defaultConfig as valibot } from '~/plugins/valibot'; import type { ZodPlugin } from '~/plugins/zod'; diff --git a/packages/openapi-ts/src/plugins/fastify/api.ts b/packages/openapi-ts/src/plugins/fastify/api.ts index 98130c3db..9ade20c59 100644 --- a/packages/openapi-ts/src/plugins/fastify/api.ts +++ b/packages/openapi-ts/src/plugins/fastify/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; type SelectorType = 'RouteHandler'; diff --git a/packages/openapi-ts/src/plugins/fastify/types.d.ts b/packages/openapi-ts/src/plugins/fastify/types.d.ts index 2f409a6ca..dae9b385b 100644 --- a/packages/openapi-ts/src/plugins/fastify/types.d.ts +++ b/packages/openapi-ts/src/plugins/fastify/types.d.ts @@ -1,4 +1,4 @@ -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/index.ts b/packages/openapi-ts/src/plugins/index.ts new file mode 100644 index 000000000..73f8cec72 --- /dev/null +++ b/packages/openapi-ts/src/plugins/index.ts @@ -0,0 +1,3 @@ +export type { ToRefs } from './shared/types/refs'; +export type { SchemaWithType } from './shared/types/schema'; +export type { DefinePlugin, Plugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/shared/types/schema.d.ts b/packages/openapi-ts/src/plugins/shared/types/schema.d.ts index fcef09883..9583b2932 100644 --- a/packages/openapi-ts/src/plugins/shared/types/schema.d.ts +++ b/packages/openapi-ts/src/plugins/shared/types/schema.d.ts @@ -1,8 +1,8 @@ import type { IR } from '~/ir/types'; -export interface SchemaWithType< +export type SchemaWithType< T extends Required['type'] = Required['type'], -> extends Omit { +> = Omit & { type: Extract['type'], T>; -} +}; diff --git a/packages/openapi-ts/src/plugins/shared/utils/config.ts b/packages/openapi-ts/src/plugins/shared/utils/config.ts index 44f085eb7..1e22bf28b 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/config.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/config.ts @@ -1,4 +1,4 @@ -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; export const definePluginConfig = (defaultConfig: Plugin.Config) => diff --git a/packages/openapi-ts/src/plugins/shared/utils/instance.ts b/packages/openapi-ts/src/plugins/shared/utils/instance.ts index 0cf5226be..89256c4f8 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/instance.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/instance.ts @@ -20,8 +20,8 @@ import { import type { IR } from '~/ir/types'; import type { OpenApi } from '~/openApi/types'; import type { Hooks } from '~/parser/types/hooks'; +import type { Plugin } from '~/plugins'; import type { PluginConfigMap } from '~/plugins/config'; -import type { Plugin } from '~/plugins/types'; import { jsonPointerToPath } from '~/utils/ref'; import type { WalkEvent } from '../types/instance'; diff --git a/packages/openapi-ts/src/plugins/valibot/api.ts b/packages/openapi-ts/src/plugins/valibot/api.ts index 4eb3bf2ce..de3c8442b 100644 --- a/packages/openapi-ts/src/plugins/valibot/api.ts +++ b/packages/openapi-ts/src/plugins/valibot/api.ts @@ -1,7 +1,7 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; import type { ValidatorArgs } from './shared/types'; import { createRequestValidatorV1, createResponseValidatorV1 } from './v1/api'; diff --git a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts index 89a5b8133..ddd4743d3 100644 --- a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts @@ -1,5 +1,5 @@ import type { IR } from '~/ir/types'; -import type { ToRefs } from '~/plugins/shared/types/refs'; +import type { ToRefs } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { ValibotPlugin } from '../types'; diff --git a/packages/openapi-ts/src/plugins/valibot/types.d.ts b/packages/openapi-ts/src/plugins/valibot/types.d.ts index c6e5a80be..137aa8fd0 100644 --- a/packages/openapi-ts/src/plugins/valibot/types.d.ts +++ b/packages/openapi-ts/src/plugins/valibot/types.d.ts @@ -1,4 +1,4 @@ -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts index 527cd8e65..66d50ddb3 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts @@ -4,7 +4,7 @@ import type ts from 'typescript'; import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { createSchemaComment } from '~/plugins/shared/utils/schema'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts index c09f9e165..010d56154 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import { deduplicateSchema } from '~/ir/schema'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts index d38f3b99e..0e224e2cc 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts index 233a0762e..97c64ad73 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts index c05801d8b..8b324935b 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import type { IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts index a58bafb33..7aa70703a 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts index 952f604c5..af7e8ab86 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts index c0898efd3..fde88c8f7 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts index cd3af20d5..d979c203d 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts @@ -1,6 +1,6 @@ import ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { numberRegExp } from '~/utils/regexp'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts index 7a77c9c1b..56d302bb4 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts index 645bbd916..dcf349c50 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts index 3cc866bf5..f7e046cf1 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts index 9df535c73..36c38bc57 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts index 55c11dbdb..c4222ccdf 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/api.ts b/packages/openapi-ts/src/plugins/zod/api.ts index 95b8aa298..e7417b749 100644 --- a/packages/openapi-ts/src/plugins/zod/api.ts +++ b/packages/openapi-ts/src/plugins/zod/api.ts @@ -1,7 +1,7 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '~/plugins/types'; +import type { Plugin } from '~/plugins'; import { createRequestValidatorMini, diff --git a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts index 6df101a2e..7991efa3d 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts @@ -1,7 +1,7 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts index a3c7010ea..7e9972dfe 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import { deduplicateSchema } from '~/ir/schema'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts index f555df28c..19e68dc15 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts index 97baffe9f..2c61e93c4 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts index b7400b68a..8c2a5848e 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts index a7dcc91f1..c8cd3432f 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts index 082534607..0e0c00d65 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts index 53919affd..c159d4db7 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts index d633be9ba..3abf60290 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts @@ -1,6 +1,6 @@ import ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { numberRegExp } from '~/utils/regexp'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts index 0cad6e696..aadafc6cd 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts index a8f5c057f..d529e0dd8 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts index bf6640610..62d340cd2 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts index 73d1909cd..2d45f282c 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts index c26bf8c33..c79a929d4 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts index 7e07ced22..3b6d1f45e 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; -import type { ToRefs } from '~/plugins/shared/types/refs'; +import type { ToRefs } from '~/plugins'; import type { ZodPlugin } from '../types'; diff --git a/packages/openapi-ts/src/plugins/zod/types.d.ts b/packages/openapi-ts/src/plugins/zod/types.d.ts index 6d82aff4e..2544c634e 100644 --- a/packages/openapi-ts/src/plugins/zod/types.d.ts +++ b/packages/openapi-ts/src/plugins/zod/types.d.ts @@ -1,4 +1,4 @@ -import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { DefinePlugin, Plugin } from '~/plugins'; import type { StringCase, StringName } from '~/types/case'; import type { IApi } from './api'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts index 7417b5326..0b94fdbad 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts @@ -1,7 +1,7 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts index 7d2270939..ece44f7e8 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import { deduplicateSchema } from '~/ir/schema'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts index b818fcd46..866d98257 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts index 282274e5c..334c6d346 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts index 41c535f9f..eb8294b5a 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts index 6f31ae90d..00da5988c 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts index 5247a6663..e2f42092d 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts index 3d39bb940..ff197cf43 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts index 5e466aedb..6f0ec0499 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts @@ -1,6 +1,6 @@ import ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { numberRegExp } from '~/utils/regexp'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts index b45ae09fe..57ebc4e10 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts index b83208f7e..c554ac4ee 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts index 381cd89c0..adf05afd1 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts index 5a534a02c..967ddffeb 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts index 28abe5dc1..a63b84f20 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts index d932f608a..71849299d 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts @@ -1,7 +1,7 @@ import { deduplicateSchema } from '~/ir/schema'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { refToName } from '~/utils/ref'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts index 1087a4a95..3edf44322 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts @@ -1,7 +1,7 @@ import type ts from 'typescript'; import { deduplicateSchema } from '~/ir/schema'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts index c6a23106c..ab2d5d2c4 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts index 6882759a6..c15626d00 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts index b7400b68a..8c2a5848e 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts index 9a6239563..d663cfa35 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts index ec4ca5e22..f8af254ce 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts index 800b55cbd..56eea6226 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts index 6c778c775..11b76a4ef 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts @@ -1,6 +1,6 @@ import ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { numberRegExp } from '~/utils/regexp'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts index 559d33354..d0d70fad4 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts index 2e300d0ae..4e8f6bf1f 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts index ebdf778b5..03f76fe17 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts index e0f991b92..7481ebf40 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts index b30aff23a..a443d29c7 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts @@ -1,4 +1,4 @@ -import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; import { identifiers } from '../../constants'; diff --git a/packages/openapi-ts/src/types/config.d.ts b/packages/openapi-ts/src/types/config.d.ts index 58198a637..9895eeb6d 100644 --- a/packages/openapi-ts/src/types/config.d.ts +++ b/packages/openapi-ts/src/types/config.d.ts @@ -1,5 +1,6 @@ +import type { Plugin } from '~/plugins'; import type { PluginConfigMap } from '~/plugins/config'; -import type { Plugin, PluginNames } from '~/plugins/types'; +import type { PluginNames } from '~/plugins/types'; import type { Input, UserInput, Watch } from './input'; import type { Logs } from './logs'; -- 2.51.2 From 2102b6165cd9004c9c05703161058cd3a9035153 Mon Sep 17 00:00:00 2001 From: Lubos Date: Sat, 25 Oct 2025 03:32:39 +0800 Subject: [PATCH 3/7] refactor: clean up sdk plugin --- .../main/test/openapi-ts.config.ts | 16 +- .../src/generate/__tests__/class.test.ts | 1 - .../src/generate/__tests__/core.test.ts | 3 - .../generate/legacy/__tests__/index.test.ts | 1 - .../generate/legacy/__tests__/output.test.ts | 1 - .../plugins/@angular/common/httpRequests.ts | 11 +- .../plugins/@angular/common/httpResources.ts | 11 +- .../plugins/@hey-api/client-core/client.ts | 3 + .../client-core/createClientConfig.ts | 1 + .../schemas/__tests__/schemas.test.ts | 2 - .../@hey-api/sdk/__tests__/plugin.test.ts | 4 - .../src/plugins/@hey-api/sdk/api.ts | 9 - .../src/plugins/@hey-api/sdk/comment.ts | 37 -- .../src/plugins/@hey-api/sdk/plugin.ts | 514 +----------------- .../plugins/@hey-api/sdk/{ => shared}/auth.ts | 4 +- .../src/plugins/@hey-api/sdk/shared/class.ts | 378 +++++++++++++ .../@hey-api/sdk/{ => shared}/constants.ts | 0 .../plugins/@hey-api/sdk/shared/functions.ts | 108 ++++ .../@hey-api/sdk/{ => shared}/operation.ts | 6 +- .../@hey-api/sdk/{ => shared}/signature.ts | 0 .../@hey-api/sdk/{ => shared}/typeOptions.ts | 6 +- .../@hey-api/sdk/{ => shared}/validator.ts | 2 +- .../src/plugins/@hey-api/sdk/v1/plugin.ts | 56 ++ .../typescript/__tests__/plugin.test.ts | 1 - .../plugins/@pinia/colada/mutationOptions.ts | 5 +- .../src/plugins/@pinia/colada/plugin.ts | 2 +- .../src/plugins/@pinia/colada/queryOptions.ts | 5 +- .../src/plugins/@pinia/colada/useType.ts | 2 +- .../query-core/infiniteQueryOptions.ts | 9 +- .../@tanstack/query-core/mutationOptions.ts | 5 +- .../plugins/@tanstack/query-core/plugin.ts | 2 +- .../@tanstack/query-core/queryOptions.ts | 5 +- .../plugins/@tanstack/query-core/useQuery.ts | 5 +- .../plugins/@tanstack/query-core/useType.ts | 2 +- .../src/plugins/shared/utils/operation.ts | 36 ++ .../src/utils/__tests__/handlebars.test.ts | 2 - .../src/utils/__tests__/parse.test.ts | 5 - 37 files changed, 639 insertions(+), 621 deletions(-) delete mode 100644 packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts rename packages/openapi-ts/src/plugins/@hey-api/sdk/{ => shared}/auth.ts (95%) create mode 100644 packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts rename packages/openapi-ts/src/plugins/@hey-api/sdk/{ => shared}/constants.ts (100%) create mode 100644 packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts rename packages/openapi-ts/src/plugins/@hey-api/sdk/{ => shared}/operation.ts (99%) rename packages/openapi-ts/src/plugins/@hey-api/sdk/{ => shared}/signature.ts (100%) rename packages/openapi-ts/src/plugins/@hey-api/sdk/{ => shared}/typeOptions.ts (97%) rename packages/openapi-ts/src/plugins/@hey-api/sdk/{ => shared}/validator.ts (95%) create mode 100644 packages/openapi-ts/src/plugins/@hey-api/sdk/v1/plugin.ts diff --git a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts index 6de2513d8..8777dad98 100644 --- a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts +++ b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts @@ -141,9 +141,15 @@ export default defineConfig(() => { if (!symbol.external && !symbol.meta?.path) { console.log(`[${plugin.name}]:`, symbol.name, symbol.meta); } - // if (symbol.meta?.path) { - // console.log(`[${plugin.name}]:`, symbol.name, symbol.meta.path); - // } + if (symbol.meta?.path) { + if (plugin.name === '@hey-api/sdk') { + console.log( + `[${plugin.name}]:`, + symbol.name, + symbol.meta.path, + ); + } + } }, // 'symbol:setValue:after': ({ plugin, symbol }) => { // console.log(`(${plugin.name}) set value:`, symbol.id); @@ -229,7 +235,7 @@ export default defineConfig(() => { // error: '他們_error_{{name}}', // name: '你們_errors_{{name}}', // }, - name: '@hey-api/typescript', + // name: '@hey-api/typescript', // requests: '我們_data_{{name}}', // responses: { // name: '我_responses_{{name}}', @@ -255,7 +261,7 @@ export default defineConfig(() => { // }, // include... // instance: true, - // name: '@hey-api/sdk', + name: '@hey-api/sdk', // operationId: false, // params_EXPERIMENTAL: 'experiment', // responseStyle: 'data', diff --git a/packages/openapi-ts/src/generate/__tests__/class.test.ts b/packages/openapi-ts/src/generate/__tests__/class.test.ts index af7c37d34..dd0a64aec 100644 --- a/packages/openapi-ts/src/generate/__tests__/class.test.ts +++ b/packages/openapi-ts/src/generate/__tests__/class.test.ts @@ -97,7 +97,6 @@ describe('generateLegacyClientClass', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/generate/__tests__/core.test.ts b/packages/openapi-ts/src/generate/__tests__/core.test.ts index 9da697ef8..d4fc08e61 100644 --- a/packages/openapi-ts/src/generate/__tests__/core.test.ts +++ b/packages/openapi-ts/src/generate/__tests__/core.test.ts @@ -112,7 +112,6 @@ describe('generateLegacyCore', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -270,7 +269,6 @@ describe('generateLegacyCore', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -411,7 +409,6 @@ describe('generateLegacyCore', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts b/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts index ad794d20e..e5e544b35 100644 --- a/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts +++ b/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts @@ -96,7 +96,6 @@ describe('generateIndexFile', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts b/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts index c0897c382..a10a7fad4 100644 --- a/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts +++ b/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts @@ -109,7 +109,6 @@ describe('generateLegacyOutput', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts b/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts index 0404d2d0e..5e1100b56 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts @@ -4,8 +4,11 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; -import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; -import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; +import { + createOperationComment, + isOperationOptionsRequired, +} from '~/plugins/shared/utils/operation'; import { tsc } from '~/tsc'; import { stringCase } from '~/utils/stringCase'; @@ -293,7 +296,7 @@ const generateAngularRequestMethod = ({ return tsc.methodDeclaration({ accessLevel: 'public', - comment: sdkPlugin.api.createOperationComment({ operation }), + comment: createOperationComment({ operation }), name: methodName, parameters: [ { @@ -349,7 +352,7 @@ const generateAngularRequestFunction = ({ const dataType = symbolDataType?.placeholder || 'unknown'; return tsc.constVariable({ - comment: sdkPlugin.api.createOperationComment({ operation }), + comment: createOperationComment({ operation }), exportConst: symbol.exported, expression: tsc.arrowFunction({ parameters: [ diff --git a/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts b/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts index 76f32d3b9..c81d93564 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts @@ -3,8 +3,11 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; -import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; +import { + createOperationComment, + isOperationOptionsRequired, +} from '~/plugins/shared/utils/operation'; import { tsc } from '~/tsc'; import { stringCase } from '~/utils/stringCase'; @@ -374,7 +377,7 @@ const generateAngularResourceMethod = ({ return tsc.methodDeclaration({ accessLevel: 'public', - comment: sdkPlugin.api.createOperationComment({ operation }), + comment: createOperationComment({ operation }), name: methodName, parameters: [ { @@ -426,7 +429,7 @@ const generateAngularResourceFunction = ({ const dataType = symbolDataType?.placeholder || 'unknown'; return tsc.constVariable({ - comment: sdkPlugin.api.createOperationComment({ operation }), + comment: createOperationComment({ operation }), exportConst: symbol.exported, expression: tsc.arrowFunction({ parameters: [ diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts index d1122ed2c..f48eed532 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts @@ -93,6 +93,9 @@ export const createClient: PluginHandler = ({ plugin }) => { ]; const symbolClient = plugin.registerSymbol({ + meta: { + path: [], + }, name: 'client', selector: plugin.api.selector('client'), }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts index 732d5e9d7..8231a270c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts @@ -29,6 +29,7 @@ export const createClientConfigType = ({ exported: true, meta: { kind: 'type', + path: [], }, name: 'CreateClientConfig', }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts index 7a5b30e09..783cfb197 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts @@ -100,7 +100,6 @@ describe('generateLegacySchemas', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -271,7 +270,6 @@ describe('generateLegacySchemas', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts index e0e9cf773..9a02cb63d 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts @@ -102,7 +102,6 @@ describe('handlerLegacy', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -345,7 +344,6 @@ describe('methodNameBuilder', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -510,7 +508,6 @@ describe('methodNameBuilder', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -678,7 +675,6 @@ describe('methodNameBuilder', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts index 2ba29bbd3..f63a2bb8a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts @@ -2,8 +2,6 @@ import type { Selector } from '@hey-api/codegen-core'; import type { Plugin } from '~/plugins'; -import { createOperationComment } from './comment'; - type SelectorType = | 'buildClientParams' | 'class' @@ -16,7 +14,6 @@ type SelectorType = | 'urlSearchParamsBodySerializer'; export type IApi = { - createOperationComment: typeof createOperationComment; /** * @param type Selector type. * @param value Depends on `type`: @@ -37,12 +34,6 @@ export type IApi = { export class Api implements IApi { constructor(public meta: Plugin.Name<'@hey-api/sdk'>) {} - createOperationComment( - ...args: Parameters - ): ReturnType { - return createOperationComment(...args); - } - selector(...args: ReadonlyArray): Selector { return [this.meta.name, ...(args as Selector)]; } diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts deleted file mode 100644 index c8229c101..000000000 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { IR } from '~/ir/types'; -import type { Comments } from '~/tsc'; -import { escapeComment } from '~/utils/escape'; - -export const createOperationComment = ({ - operation, -}: { - operation: IR.OperationObject; -}): Comments | undefined => { - const comments: Array = []; - - if (operation.summary) { - comments.push(escapeComment(operation.summary)); - } - - if (operation.description) { - if (comments.length) { - comments.push(''); // Add an empty line between summary and description - } - - comments.push(escapeComment(operation.description)); - } - - if (operation.deprecated) { - if (comments.length) { - comments.push(''); // Add an empty line before deprecated - } - - comments.push('@deprecated'); - } - - if (!comments.length) { - return; - } - - return comments; -}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts index 8407fe0cb..bfdbafc43 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts @@ -1,514 +1,4 @@ -import type ts from 'typescript'; - -import { clientFolderAbsolutePath } from '~/generate/client'; -import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; -import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; -import { tsc } from '~/tsc'; -import { stringCase } from '~/utils/stringCase'; - -import { nuxtTypeComposable, nuxtTypeDefault } from './constants'; -import { - operationClasses, - operationParameters, - operationStatements, -} from './operation'; -import { serviceFunctionIdentifier } from './plugin-legacy'; -import { createTypeOptions } from './typeOptions'; import type { HeyApiSdkPlugin } from './types'; +import { handlerV1 } from './v1/plugin'; -const createClientClassNodes = ({ - plugin, -}: { - plugin: HeyApiSdkPlugin['Instance']; -}): ReadonlyArray => { - const clientAssignmentStatement = tsc.expressionToStatement({ - expression: tsc.binaryExpression({ - left: tsc.propertyAccessExpression({ - expression: tsc.this(), - name: '_client', - }), - operator: '=', - right: tsc.propertyAccessExpression({ - expression: tsc.identifier({ text: 'args' }), - name: 'client', - }), - }), - }); - - const symbolClient = plugin.referenceSymbol(plugin.api.selector('Client')); - const client = getClientPlugin(plugin.context.config); - const symClient = - client.api && 'selector' in client.api - ? plugin.getSymbol( - // @ts-expect-error - client.api.selector('client'), - ) - : undefined; - - return [ - tsc.propertyDeclaration({ - initializer: symClient - ? tsc.identifier({ text: symClient.placeholder }) - : undefined, - modifier: 'protected', - name: '_client', - type: tsc.typeReferenceNode({ typeName: symbolClient.placeholder }), - }), - // @ts-expect-error - tsc.identifier({ text: '\n' }), - tsc.constructorDeclaration({ - multiLine: true, - parameters: [ - { - isRequired: !plugin.config.client, - name: 'args', - type: tsc.typeInterfaceNode({ - properties: [ - { - isRequired: !plugin.config.client, - name: 'client', - type: symbolClient.placeholder, - }, - ], - useLegacyResolution: false, - }), - }, - ], - statements: [ - !plugin.config.client - ? clientAssignmentStatement - : tsc.ifStatement({ - expression: tsc.propertyAccessExpression({ - expression: tsc.identifier({ text: 'args' }), - isOptional: true, - name: 'client', - }), - thenStatement: tsc.block({ - statements: [clientAssignmentStatement], - }), - }), - ], - }), - ]; -}; - -interface SdkClassEntry { - /** - * Name of the class. - */ - className: string; - /** - * Symbol IDs for child classes located inside this class. - */ - classes: Set; - /** - * Symbol ID for the class. - */ - id: number; - /** - * Track unique added method nodes. - */ - methods: Set; - /** - * List of class nodes containing methods. - */ - nodes: Array; - /** - * Is this a root class? - */ - root: boolean; -} - -const generateClassSdk = ({ - plugin, -}: { - plugin: HeyApiSdkPlugin['Instance']; -}) => { - const client = getClientPlugin(plugin.context.config); - const isAngularClient = client.name === '@hey-api/client-angular'; - const isNuxtClient = client.name === '@hey-api/client-nuxt'; - const sdkClasses = new Map(); - /** - * Track unique added classes. - */ - const generatedClasses = new Set(); - - const clientClassNodes = plugin.config.instance - ? createClientClassNodes({ plugin }) - : []; - - plugin.forEach( - 'operation', - ({ operation }) => { - const isRequiredOptions = isOperationOptionsRequired({ - context: plugin.context, - operation, - }); - const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript'); - const symbolResponse = isNuxtClient - ? plugin.getSymbol( - pluginTypeScript.api.selector('response', operation.id), - ) - : undefined; - - const classes = operationClasses({ - context: plugin.context, - operation, - plugin, - }); - - for (const entry of classes.values()) { - entry.path.forEach((currentClassName, index) => { - const symbolCurrentClass = plugin.referenceSymbol( - plugin.api.selector('class', currentClassName), - ); - if (!sdkClasses.has(symbolCurrentClass.id)) { - sdkClasses.set(symbolCurrentClass.id, { - className: currentClassName, - classes: new Set(), - id: symbolCurrentClass.id, - methods: new Set(), - nodes: [], - root: !index, - }); - } - - const parentClassName = entry.path[index - 1]; - if (parentClassName) { - const symbolParentClass = plugin.referenceSymbol( - plugin.api.selector('class', parentClassName), - ); - if ( - symbolParentClass.placeholder !== symbolCurrentClass.placeholder - ) { - const parentClass = sdkClasses.get(symbolParentClass.id)!; - parentClass.classes.add(symbolCurrentClass.id); - sdkClasses.set(symbolParentClass.id, parentClass); - } - } - - const isLast = entry.path.length === index + 1; - // add methods only to the last class - if (!isLast) { - return; - } - - const currentClass = sdkClasses.get(symbolCurrentClass.id)!; - - // avoid duplicate methods - if (currentClass.methods.has(entry.methodName)) { - return; - } - - const opParameters = operationParameters({ - isRequiredOptions, - operation, - plugin, - }); - const statements = operationStatements({ - isRequiredOptions, - opParameters, - operation, - plugin, - }); - const functionNode = tsc.methodDeclaration({ - accessLevel: 'public', - comment: plugin.api.createOperationComment({ operation }), - isStatic: isAngularClient ? false : !plugin.config.instance, - name: entry.methodName, - parameters: opParameters.parameters, - returnType: undefined, - statements, - types: isNuxtClient - ? [ - { - default: tsc.ots.string('$fetch'), - extends: tsc.typeNode( - plugin.referenceSymbol(plugin.api.selector('Composable')) - .placeholder, - ), - name: nuxtTypeComposable, - }, - { - default: symbolResponse - ? tsc.typeReferenceNode({ - typeName: symbolResponse.placeholder, - }) - : tsc.typeNode('undefined'), - extends: symbolResponse - ? tsc.typeReferenceNode({ - typeName: symbolResponse.placeholder, - }) - : undefined, - name: nuxtTypeDefault, - }, - ] - : [ - { - default: - ('throwOnError' in client.config - ? client.config.throwOnError - : false) ?? false, - extends: 'boolean', - name: 'ThrowOnError', - }, - ], - }); - - if (!currentClass.nodes.length) { - currentClass.nodes.push(functionNode); - } else { - currentClass.nodes.push( - // @ts-expect-error - tsc.identifier({ text: '\n' }), - functionNode, - ); - } - - currentClass.methods.add(entry.methodName); - - sdkClasses.set(symbolCurrentClass.id, currentClass); - }); - } - }, - { - order: 'declarations', - }, - ); - - const symbolHeyApiClient = plugin.registerSymbol({ - exported: false, - name: '_HeyApiClient', - }); - - const generateClass = (currentClass: SdkClassEntry) => { - if (generatedClasses.has(currentClass.id)) { - return; - } - - if (currentClass.classes.size) { - for (const childClassName of currentClass.classes) { - const childClass = sdkClasses.get(childClassName)!; - generateClass(childClass); - - currentClass.nodes.push( - tsc.propertyDeclaration({ - initializer: plugin.config.instance - ? tsc.newExpression({ - argumentsArray: plugin.config.instance - ? [ - tsc.objectExpression({ - multiLine: false, - obj: [ - { - key: 'client', - value: tsc.propertyAccessExpression({ - expression: tsc.this(), - name: '_client', - }), - }, - ], - }), - ] - : [], - expression: tsc.identifier({ - text: plugin.referenceSymbol(childClass.id).placeholder, - }), - }) - : tsc.identifier({ - text: plugin.referenceSymbol(childClass.id).placeholder, - }), - modifier: plugin.config.instance ? undefined : 'static', - name: stringCase({ - case: 'camelCase', - value: childClass.className, - }), - }), - ); - } - } - - const symbol = plugin.registerSymbol({ - exported: true, - name: currentClass.className, - selector: plugin.api.selector('class', currentClass.className), - }); - const node = tsc.classDeclaration({ - decorator: - currentClass.root && isAngularClient - ? { - args: [ - { - providedIn: 'root', - }, - ], - name: plugin.referenceSymbol(plugin.api.selector('Injectable')) - .placeholder, - } - : undefined, - exportClass: symbol.exported, - extendedClasses: plugin.config.instance - ? [symbolHeyApiClient.placeholder] - : undefined, - name: symbol.placeholder, - nodes: currentClass.nodes, - }); - plugin.setSymbolValue(symbol, node); - generatedClasses.add(symbol.id); - }; - - if (clientClassNodes.length) { - const node = tsc.classDeclaration({ - exportClass: symbolHeyApiClient.exported, - name: symbolHeyApiClient.placeholder, - nodes: clientClassNodes, - }); - plugin.setSymbolValue(symbolHeyApiClient, node); - } - - for (const sdkClass of sdkClasses.values()) { - generateClass(sdkClass); - } -}; - -const generateFlatSdk = ({ - plugin, -}: { - plugin: HeyApiSdkPlugin['Instance']; -}) => { - const client = getClientPlugin(plugin.context.config); - const isNuxtClient = client.name === '@hey-api/client-nuxt'; - - plugin.forEach( - 'operation', - ({ operation }) => { - const isRequiredOptions = isOperationOptionsRequired({ - context: plugin.context, - operation, - }); - const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript'); - const symbolResponse = isNuxtClient - ? plugin.getSymbol( - pluginTypeScript.api.selector('response', operation.id), - ) - : undefined; - const opParameters = operationParameters({ - isRequiredOptions, - operation, - plugin, - }); - const statements = operationStatements({ - isRequiredOptions, - opParameters, - operation, - plugin, - }); - const symbol = plugin.registerSymbol({ - name: serviceFunctionIdentifier({ - config: plugin.context.config, - handleIllegal: true, - id: operation.id, - operation, - }), - selector: plugin.api.selector('function', operation.id), - }); - const node = tsc.constVariable({ - comment: plugin.api.createOperationComment({ operation }), - exportConst: true, - expression: tsc.arrowFunction({ - parameters: opParameters.parameters, - returnType: undefined, - statements, - types: isNuxtClient - ? [ - { - default: tsc.ots.string('$fetch'), - extends: tsc.typeNode( - plugin.referenceSymbol(plugin.api.selector('Composable')) - .placeholder, - ), - name: nuxtTypeComposable, - }, - { - default: symbolResponse - ? tsc.typeReferenceNode({ - typeName: symbolResponse.placeholder, - }) - : tsc.typeNode('undefined'), - extends: symbolResponse - ? tsc.typeReferenceNode({ - typeName: symbolResponse.placeholder, - }) - : undefined, - name: nuxtTypeDefault, - }, - ] - : [ - { - default: - ('throwOnError' in client.config - ? client.config.throwOnError - : false) ?? false, - extends: 'boolean', - name: 'ThrowOnError', - }, - ], - }), - name: symbol.placeholder, - }); - plugin.setSymbolValue(symbol, node); - }, - { - order: 'declarations', - }, - ); -}; - -export const handler: HeyApiSdkPlugin['Handler'] = ({ plugin }) => { - const clientModule = clientFolderAbsolutePath(plugin.context.config); - plugin.registerSymbol({ - external: clientModule, - name: 'formDataBodySerializer', - selector: plugin.api.selector('formDataBodySerializer'), - }); - plugin.registerSymbol({ - external: clientModule, - name: 'urlSearchParamsBodySerializer', - selector: plugin.api.selector('urlSearchParamsBodySerializer'), - }); - plugin.registerSymbol({ - external: clientModule, - name: 'buildClientParams', - selector: plugin.api.selector('buildClientParams'), - }); - - const client = getClientPlugin(plugin.context.config); - const isAngularClient = client.name === '@hey-api/client-angular'; - const isNuxtClient = client.name === '@hey-api/client-nuxt'; - if (isNuxtClient) { - plugin.registerSymbol({ - external: clientModule, - meta: { - kind: 'type', - }, - name: 'Composable', - selector: plugin.api.selector('Composable'), - }); - } - - if (isAngularClient && plugin.config.asClass) { - plugin.registerSymbol({ - external: '@angular/core', - name: 'Injectable', - selector: plugin.api.selector('Injectable'), - }); - } - - createTypeOptions({ plugin }); - - if (plugin.config.asClass) { - generateClassSdk({ plugin }); - } else { - generateFlatSdk({ plugin }); - } -}; +export const handler: HeyApiSdkPlugin['Handler'] = (args) => handlerV1(args); diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/auth.ts similarity index 95% rename from packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts rename to packages/openapi-ts/src/plugins/@hey-api/sdk/shared/auth.ts index 3766e0cd4..4c7315c6b 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/auth.ts @@ -1,7 +1,7 @@ import type { IR } from '~/ir/types'; -import type { Auth } from '../client-core/bundle/auth'; -import type { HeyApiSdkPlugin } from './types'; +import type { Auth } from '../../client-core/bundle/auth'; +import type { HeyApiSdkPlugin } from '../types'; // TODO: parser - handle more security types const securitySchemeObjectToAuthObject = ({ diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts new file mode 100644 index 000000000..d694bea59 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts @@ -0,0 +1,378 @@ +import type ts from 'typescript'; + +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { + createOperationComment, + isOperationOptionsRequired, +} from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; +import { stringCase } from '~/utils/stringCase'; + +import type { HeyApiSdkPlugin } from '../types'; +import { nuxtTypeComposable, nuxtTypeDefault } from './constants'; +import { + operationClasses, + operationParameters, + operationStatements, +} from './operation'; + +type SdkClassEntry = { + /** + * Name of the class. + */ + className: string; + /** + * Symbol IDs for child classes located inside this class. + */ + classes: Set; + /** + * Symbol ID for the class. + */ + id: number; + /** + * Track unique added method nodes. + */ + methods: Set; + /** + * List of class nodes containing methods. + */ + nodes: Array; + /** + * Is this a root class? + */ + root: boolean; +}; + +const createClientClassNodes = ({ + plugin, +}: { + plugin: HeyApiSdkPlugin['Instance']; +}): ReadonlyArray => { + const clientAssignmentStatement = tsc.expressionToStatement({ + expression: tsc.binaryExpression({ + left: tsc.propertyAccessExpression({ + expression: tsc.this(), + name: '_client', + }), + operator: '=', + right: tsc.propertyAccessExpression({ + expression: tsc.identifier({ text: 'args' }), + name: 'client', + }), + }), + }); + + const symbolClient = plugin.referenceSymbol(plugin.api.selector('Client')); + const client = getClientPlugin(plugin.context.config); + const symClient = + client.api && 'selector' in client.api + ? plugin.getSymbol( + // @ts-expect-error + client.api.selector('client'), + ) + : undefined; + + return [ + tsc.propertyDeclaration({ + initializer: symClient + ? tsc.identifier({ text: symClient.placeholder }) + : undefined, + modifier: 'protected', + name: '_client', + type: tsc.typeReferenceNode({ typeName: symbolClient.placeholder }), + }), + // @ts-expect-error + tsc.identifier({ text: '\n' }), + tsc.constructorDeclaration({ + multiLine: true, + parameters: [ + { + isRequired: !plugin.config.client, + name: 'args', + type: tsc.typeInterfaceNode({ + properties: [ + { + isRequired: !plugin.config.client, + name: 'client', + type: symbolClient.placeholder, + }, + ], + useLegacyResolution: false, + }), + }, + ], + statements: [ + !plugin.config.client + ? clientAssignmentStatement + : tsc.ifStatement({ + expression: tsc.propertyAccessExpression({ + expression: tsc.identifier({ text: 'args' }), + isOptional: true, + name: 'client', + }), + thenStatement: tsc.block({ + statements: [clientAssignmentStatement], + }), + }), + ], + }), + ]; +}; + +export const generateClassSdk = ({ + plugin, +}: { + plugin: HeyApiSdkPlugin['Instance']; +}): void => { + const client = getClientPlugin(plugin.context.config); + const isAngularClient = client.name === '@hey-api/client-angular'; + const isNuxtClient = client.name === '@hey-api/client-nuxt'; + const sdkClasses = new Map(); + /** + * Track unique added classes. + */ + const generatedClasses = new Set(); + + const clientClassNodes = plugin.config.instance + ? createClientClassNodes({ plugin }) + : []; + + plugin.forEach( + 'operation', + ({ operation }) => { + const isRequiredOptions = isOperationOptionsRequired({ + context: plugin.context, + operation, + }); + const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript'); + const symbolResponse = isNuxtClient + ? plugin.getSymbol( + pluginTypeScript.api.selector('response', operation.id), + ) + : undefined; + + const classes = operationClasses({ + context: plugin.context, + operation, + plugin, + }); + + for (const entry of classes.values()) { + entry.path.forEach((currentClassName, index) => { + const symbolCurrentClass = plugin.referenceSymbol( + plugin.api.selector('class', currentClassName), + ); + if (!sdkClasses.has(symbolCurrentClass.id)) { + sdkClasses.set(symbolCurrentClass.id, { + className: currentClassName, + classes: new Set(), + id: symbolCurrentClass.id, + methods: new Set(), + nodes: [], + root: !index, + }); + } + + const parentClassName = entry.path[index - 1]; + if (parentClassName) { + const symbolParentClass = plugin.referenceSymbol( + plugin.api.selector('class', parentClassName), + ); + if ( + symbolParentClass.placeholder !== symbolCurrentClass.placeholder + ) { + const parentClass = sdkClasses.get(symbolParentClass.id)!; + parentClass.classes.add(symbolCurrentClass.id); + sdkClasses.set(symbolParentClass.id, parentClass); + } + } + + const isLast = entry.path.length === index + 1; + // add methods only to the last class + if (!isLast) { + return; + } + + const currentClass = sdkClasses.get(symbolCurrentClass.id)!; + + // avoid duplicate methods + if (currentClass.methods.has(entry.methodName)) { + return; + } + + const opParameters = operationParameters({ + isRequiredOptions, + operation, + plugin, + }); + const statements = operationStatements({ + isRequiredOptions, + opParameters, + operation, + plugin, + }); + const functionNode = tsc.methodDeclaration({ + accessLevel: 'public', + comment: createOperationComment({ operation }), + isStatic: isAngularClient ? false : !plugin.config.instance, + name: entry.methodName, + parameters: opParameters.parameters, + returnType: undefined, + statements, + types: isNuxtClient + ? [ + { + default: tsc.ots.string('$fetch'), + extends: tsc.typeNode( + plugin.referenceSymbol(plugin.api.selector('Composable')) + .placeholder, + ), + name: nuxtTypeComposable, + }, + { + default: symbolResponse + ? tsc.typeReferenceNode({ + typeName: symbolResponse.placeholder, + }) + : tsc.typeNode('undefined'), + extends: symbolResponse + ? tsc.typeReferenceNode({ + typeName: symbolResponse.placeholder, + }) + : undefined, + name: nuxtTypeDefault, + }, + ] + : [ + { + default: + ('throwOnError' in client.config + ? client.config.throwOnError + : false) ?? false, + extends: 'boolean', + name: 'ThrowOnError', + }, + ], + }); + + if (!currentClass.nodes.length) { + currentClass.nodes.push(functionNode); + } else { + currentClass.nodes.push( + // @ts-expect-error + tsc.identifier({ text: '\n' }), + functionNode, + ); + } + + currentClass.methods.add(entry.methodName); + + sdkClasses.set(symbolCurrentClass.id, currentClass); + }); + } + }, + { + order: 'declarations', + }, + ); + + const symbolHeyApiClient = plugin.registerSymbol({ + exported: false, + meta: { + path: [], + }, + name: '_HeyApiClient', + }); + + const generateClass = (currentClass: SdkClassEntry) => { + if (generatedClasses.has(currentClass.id)) { + return; + } + + if (currentClass.classes.size) { + for (const childClassName of currentClass.classes) { + const childClass = sdkClasses.get(childClassName)!; + generateClass(childClass); + + currentClass.nodes.push( + tsc.propertyDeclaration({ + initializer: plugin.config.instance + ? tsc.newExpression({ + argumentsArray: plugin.config.instance + ? [ + tsc.objectExpression({ + multiLine: false, + obj: [ + { + key: 'client', + value: tsc.propertyAccessExpression({ + expression: tsc.this(), + name: '_client', + }), + }, + ], + }), + ] + : [], + expression: tsc.identifier({ + text: plugin.referenceSymbol(childClass.id).placeholder, + }), + }) + : tsc.identifier({ + text: plugin.referenceSymbol(childClass.id).placeholder, + }), + modifier: plugin.config.instance ? undefined : 'static', + name: stringCase({ + case: 'camelCase', + value: childClass.className, + }), + }), + ); + } + } + + const symbol = plugin.registerSymbol({ + exported: true, + meta: { + path: [], + }, + name: currentClass.className, + selector: plugin.api.selector('class', currentClass.className), + }); + const node = tsc.classDeclaration({ + decorator: + currentClass.root && isAngularClient + ? { + args: [ + { + providedIn: 'root', + }, + ], + name: plugin.referenceSymbol(plugin.api.selector('Injectable')) + .placeholder, + } + : undefined, + exportClass: symbol.exported, + extendedClasses: plugin.config.instance + ? [symbolHeyApiClient.placeholder] + : undefined, + name: symbol.placeholder, + nodes: currentClass.nodes, + }); + plugin.setSymbolValue(symbol, node); + generatedClasses.add(symbol.id); + }; + + if (clientClassNodes.length) { + const node = tsc.classDeclaration({ + exportClass: symbolHeyApiClient.exported, + name: symbolHeyApiClient.placeholder, + nodes: clientClassNodes, + }); + plugin.setSymbolValue(symbolHeyApiClient, node); + } + + for (const sdkClass of sdkClasses.values()) { + generateClass(sdkClass); + } +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/constants.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/constants.ts similarity index 100% rename from packages/openapi-ts/src/plugins/@hey-api/sdk/constants.ts rename to packages/openapi-ts/src/plugins/@hey-api/sdk/shared/constants.ts diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts new file mode 100644 index 000000000..60b2262ad --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts @@ -0,0 +1,108 @@ +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { + createOperationComment, + isOperationOptionsRequired, +} from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; + +import { serviceFunctionIdentifier } from '../plugin-legacy'; +import type { HeyApiSdkPlugin } from '../types'; +import { nuxtTypeComposable, nuxtTypeDefault } from './constants'; +import { operationParameters, operationStatements } from './operation'; + +export const generateFlatSdk = ({ + plugin, +}: { + plugin: HeyApiSdkPlugin['Instance']; +}): void => { + const client = getClientPlugin(plugin.context.config); + const isNuxtClient = client.name === '@hey-api/client-nuxt'; + + plugin.forEach( + 'operation', + (event) => { + const { operation } = event; + const isRequiredOptions = isOperationOptionsRequired({ + context: plugin.context, + operation, + }); + const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript'); + const symbolResponse = isNuxtClient + ? plugin.getSymbol( + pluginTypeScript.api.selector('response', operation.id), + ) + : undefined; + const opParameters = operationParameters({ + isRequiredOptions, + operation, + plugin, + }); + const statements = operationStatements({ + isRequiredOptions, + opParameters, + operation, + plugin, + }); + const symbol = plugin.registerSymbol({ + meta: { + path: event._path, + }, + name: serviceFunctionIdentifier({ + config: plugin.context.config, + handleIllegal: true, + id: operation.id, + operation, + }), + selector: plugin.api.selector('function', operation.id), + }); + const node = tsc.constVariable({ + comment: createOperationComment({ operation }), + exportConst: true, + expression: tsc.arrowFunction({ + parameters: opParameters.parameters, + returnType: undefined, + statements, + types: isNuxtClient + ? [ + { + default: tsc.ots.string('$fetch'), + extends: tsc.typeNode( + plugin.referenceSymbol(plugin.api.selector('Composable')) + .placeholder, + ), + name: nuxtTypeComposable, + }, + { + default: symbolResponse + ? tsc.typeReferenceNode({ + typeName: symbolResponse.placeholder, + }) + : tsc.typeNode('undefined'), + extends: symbolResponse + ? tsc.typeReferenceNode({ + typeName: symbolResponse.placeholder, + }) + : undefined, + name: nuxtTypeDefault, + }, + ] + : [ + { + default: + ('throwOnError' in client.config + ? client.config.throwOnError + : false) ?? false, + extends: 'boolean', + name: 'ThrowOnError', + }, + ], + }), + name: symbol.placeholder, + }); + plugin.setSymbolValue(symbol, node); + }, + { + order: 'declarations', + }, + ); +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts similarity index 99% rename from packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts rename to packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts index 5d9311733..b07009c8c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts @@ -11,11 +11,11 @@ import { reservedJavaScriptKeywordsRegExp } from '~/utils/regexp'; import { stringCase } from '~/utils/stringCase'; import { transformClassName } from '~/utils/transform'; -import type { Field, Fields } from '../client-core/bundle/params'; +import type { Field, Fields } from '../../client-core/bundle/params'; +// import { getSignatureParameters } from './signature'; +import type { HeyApiSdkPlugin } from '../types'; import { operationAuth } from './auth'; import { nuxtTypeComposable, nuxtTypeDefault } from './constants'; -// import { getSignatureParameters } from './signature'; -import type { HeyApiSdkPlugin } from './types'; import { createRequestValidator, createResponseValidator } from './validator'; interface ClassNameEntry { diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/signature.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/signature.ts similarity index 100% rename from packages/openapi-ts/src/plugins/@hey-api/sdk/signature.ts rename to packages/openapi-ts/src/plugins/@hey-api/sdk/shared/signature.ts diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/typeOptions.ts similarity index 97% rename from packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts rename to packages/openapi-ts/src/plugins/@hey-api/sdk/shared/typeOptions.ts index 50efaf4c0..bba6150f9 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/typeOptions.ts @@ -2,8 +2,8 @@ import { clientFolderAbsolutePath } from '~/generate/client'; import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; import { tsc } from '~/tsc'; +import type { HeyApiSdkPlugin } from '../types'; import { nuxtTypeDefault, nuxtTypeResponse } from './constants'; -import type { HeyApiSdkPlugin } from './types'; export const createTypeOptions = ({ plugin, @@ -18,6 +18,7 @@ export const createTypeOptions = ({ external: clientModule, meta: { kind: 'type', + path: [], }, name: 'TDataShape', }); @@ -25,6 +26,7 @@ export const createTypeOptions = ({ external: clientModule, meta: { kind: 'type', + path: [], }, name: 'Client', selector: plugin.api.selector('Client'), @@ -33,6 +35,7 @@ export const createTypeOptions = ({ external: clientModule, meta: { kind: 'type', + path: [], }, name: 'Options', }); @@ -40,6 +43,7 @@ export const createTypeOptions = ({ exported: true, meta: { kind: 'type', + path: [], }, name: 'Options', selector: plugin.api.selector('Options'), diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/validator.ts similarity index 95% rename from packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts rename to packages/openapi-ts/src/plugins/@hey-api/sdk/shared/validator.ts index 1819ca02c..26dd56784 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/validator.ts @@ -2,7 +2,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; -import type { HeyApiSdkPlugin } from './types'; +import type { HeyApiSdkPlugin } from '../types'; interface ValidatorProps { operation: IR.OperationObject; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/v1/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/v1/plugin.ts new file mode 100644 index 000000000..d2fc99f44 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/v1/plugin.ts @@ -0,0 +1,56 @@ +import { clientFolderAbsolutePath } from '~/generate/client'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; + +import { generateClassSdk } from '../shared/class'; +import { generateFlatSdk } from '../shared/functions'; +import { createTypeOptions } from '../shared/typeOptions'; +import type { HeyApiSdkPlugin } from '../types'; + +export const handlerV1: HeyApiSdkPlugin['Handler'] = ({ plugin }) => { + const clientModule = clientFolderAbsolutePath(plugin.context.config); + plugin.registerSymbol({ + external: clientModule, + name: 'formDataBodySerializer', + selector: plugin.api.selector('formDataBodySerializer'), + }); + plugin.registerSymbol({ + external: clientModule, + name: 'urlSearchParamsBodySerializer', + selector: plugin.api.selector('urlSearchParamsBodySerializer'), + }); + plugin.registerSymbol({ + external: clientModule, + name: 'buildClientParams', + selector: plugin.api.selector('buildClientParams'), + }); + + const client = getClientPlugin(plugin.context.config); + const isAngularClient = client.name === '@hey-api/client-angular'; + const isNuxtClient = client.name === '@hey-api/client-nuxt'; + if (isNuxtClient) { + plugin.registerSymbol({ + external: clientModule, + meta: { + kind: 'type', + }, + name: 'Composable', + selector: plugin.api.selector('Composable'), + }); + } + + if (isAngularClient && plugin.config.asClass) { + plugin.registerSymbol({ + external: '@angular/core', + name: 'Injectable', + selector: plugin.api.selector('Injectable'), + }); + } + + createTypeOptions({ plugin }); + + if (plugin.config.asClass) { + generateClassSdk({ plugin }); + } else { + generateFlatSdk({ plugin }); + } +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts index 87819a8e5..fbf1c303d 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts @@ -100,7 +100,6 @@ describe('generateLegacyTypes', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts index 93cd67dc3..45a01250b 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts @@ -2,6 +2,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; +import { createOperationComment } from '~/plugins/shared/utils/operation'; import { tsc } from '~/tsc'; import { handleMeta } from './meta'; @@ -108,8 +109,6 @@ export const createMutationOptions = ({ }); } - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); - const symbolMutationOptions = plugin.registerSymbol({ exported: true, name: buildName({ @@ -119,7 +118,7 @@ export const createMutationOptions = ({ }); const statement = tsc.constVariable({ comment: plugin.config.comments - ? sdkPlugin.api.createOperationComment({ operation }) + ? createOperationComment({ operation }) : undefined, exportConst: symbolMutationOptions.exported, expression: tsc.arrowFunction({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts b/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts index b0ccc056d..533a56a39 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts @@ -1,4 +1,4 @@ -import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; +import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; import { stringCase } from '~/utils/stringCase'; import { createMutationOptions } from './mutationOptions'; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts index 804f168f7..4cdd209cc 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts @@ -3,6 +3,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import { + createOperationComment, hasOperationSse, isOperationOptionsRequired, } from '~/plugins/shared/utils/operation'; @@ -148,8 +149,6 @@ export const createQueryOptions = ({ }); } - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); - const symbolQueryOptionsFn = plugin.registerSymbol({ exported: true, name: buildName({ @@ -165,7 +164,7 @@ export const createQueryOptions = ({ }); const statement = tsc.constVariable({ comment: plugin.config.comments - ? sdkPlugin.api.createOperationComment({ operation }) + ? createOperationComment({ operation }) : undefined, exportConst: symbolQueryOptionsFn.exported, expression: tsc.callExpression({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts b/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts index e225c2dc8..f257f701c 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts @@ -1,6 +1,6 @@ import type { IR } from '~/ir/types'; import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; -import { operationOptionsType } from '~/plugins/@hey-api/sdk/operation'; +import { operationOptionsType } from '~/plugins/@hey-api/sdk/shared/operation'; import type { PiniaColadaPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts index 303bd0a2c..74535be7a 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts @@ -3,7 +3,10 @@ import ts from 'typescript'; import { operationPagination } from '~/ir/operation'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { + createOperationComment, + isOperationOptionsRequired, +} from '~/plugins/shared/utils/operation'; import { tsc } from '~/tsc'; import { tsNodeToString } from '~/tsc/utils'; @@ -444,8 +447,6 @@ export const createInfiniteQueryOptions = ({ }); } - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); - const symbolInfiniteQueryOptionsFn = plugin.registerSymbol({ exported: true, name: buildName({ @@ -455,7 +456,7 @@ export const createInfiniteQueryOptions = ({ }); const statement = tsc.constVariable({ comment: plugin.config.comments - ? sdkPlugin.api.createOperationComment({ operation }) + ? createOperationComment({ operation }) : undefined, exportConst: symbolInfiniteQueryOptionsFn.exported, expression: tsc.arrowFunction({ diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts index 0d9269f8c..50dbf250a 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts @@ -2,6 +2,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; +import { createOperationComment } from '~/plugins/shared/utils/operation'; import { tsc } from '~/tsc'; import { handleMeta } from './meta'; @@ -98,8 +99,6 @@ export const createMutationOptions = ({ }); } - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); - const mutationOptionsFn = 'mutationOptions'; const expression = tsc.arrowFunction({ parameters: [ @@ -132,7 +131,7 @@ export const createMutationOptions = ({ }); const statement = tsc.constVariable({ comment: plugin.config.comments - ? sdkPlugin.api.createOperationComment({ operation }) + ? createOperationComment({ operation }) : undefined, exportConst: symbolMutationOptions.exported, expression, diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 4c773dfc2..f0279656a 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -1,4 +1,4 @@ -import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; +import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; import { stringCase } from '~/utils/stringCase'; import { createInfiniteQueryOptions } from './infiniteQueryOptions'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts index d9392010f..bf460e656 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts @@ -3,6 +3,7 @@ import type ts from 'typescript'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import { + createOperationComment, hasOperationSse, isOperationOptionsRequired, } from '~/plugins/shared/utils/operation'; @@ -153,8 +154,6 @@ export const createQueryOptions = ({ }); } - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); - const symbolQueryOptionsFn = plugin.registerSymbol({ exported: plugin.config.queryOptions.exported, name: buildName({ @@ -165,7 +164,7 @@ export const createQueryOptions = ({ }); const statement = tsc.constVariable({ comment: plugin.config.comments - ? sdkPlugin.api.createOperationComment({ operation }) + ? createOperationComment({ operation }) : undefined, exportConst: symbolQueryOptionsFn.exported, expression: tsc.arrowFunction({ diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts index d9ee1d191..ec3ad8da6 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts @@ -1,6 +1,7 @@ import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import { + createOperationComment, hasOperationSse, isOperationOptionsRequired, } from '~/plugins/shared/utils/operation'; @@ -26,8 +27,6 @@ export const createUseQuery = ({ return; } - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); - const symbolUseQueryFn = plugin.registerSymbol({ exported: true, name: buildName({ @@ -51,7 +50,7 @@ export const createUseQuery = ({ ); const statement = tsc.constVariable({ comment: plugin.config.comments - ? sdkPlugin.api.createOperationComment({ operation }) + ? createOperationComment({ operation }) : undefined, exportConst: symbolUseQueryFn.exported, expression: tsc.arrowFunction({ diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts index 573f9b704..3c9cfa75f 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts @@ -1,6 +1,6 @@ import type { IR } from '~/ir/types'; import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; -import { operationOptionsType } from '~/plugins/@hey-api/sdk/operation'; +import { operationOptionsType } from '~/plugins/@hey-api/sdk/shared/operation'; import type { PluginInstance } from './types'; diff --git a/packages/openapi-ts/src/plugins/shared/utils/operation.ts b/packages/openapi-ts/src/plugins/shared/utils/operation.ts index e5b66b0c1..7b6ac7055 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/operation.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/operation.ts @@ -1,6 +1,42 @@ import { hasOperationDataRequired } from '~/ir/operation'; import type { IR } from '~/ir/types'; import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { Comments } from '~/tsc'; +import { escapeComment } from '~/utils/escape'; + +export const createOperationComment = ({ + operation, +}: { + operation: IR.OperationObject; +}): Comments | undefined => { + const comments: Array = []; + + if (operation.summary) { + comments.push(escapeComment(operation.summary)); + } + + if (operation.description) { + if (comments.length) { + comments.push(''); // Add an empty line between summary and description + } + + comments.push(escapeComment(operation.description)); + } + + if (operation.deprecated) { + if (comments.length) { + comments.push(''); // Add an empty line before deprecated + } + + comments.push('@deprecated'); + } + + if (!comments.length) { + return; + } + + return comments; +}; export const isOperationOptionsRequired = ({ context, diff --git a/packages/openapi-ts/src/utils/__tests__/handlebars.test.ts b/packages/openapi-ts/src/utils/__tests__/handlebars.test.ts index e9d378053..1cb73cea5 100644 --- a/packages/openapi-ts/src/utils/__tests__/handlebars.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/handlebars.test.ts @@ -93,7 +93,6 @@ describe('registerHandlebarHelpers', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -224,7 +223,6 @@ describe('registerHandlebarTemplates', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { diff --git a/packages/openapi-ts/src/utils/__tests__/parse.test.ts b/packages/openapi-ts/src/utils/__tests__/parse.test.ts index 5b28c5897..304276052 100644 --- a/packages/openapi-ts/src/utils/__tests__/parse.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/parse.test.ts @@ -72,7 +72,6 @@ describe('operationNameFn', () => { plugins: { '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -103,7 +102,6 @@ describe('operationNameFn', () => { ...optionsCommon.plugins, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -124,7 +122,6 @@ describe('operationNameFn', () => { ...optionsCommon.plugins, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -157,7 +154,6 @@ describe('operationNameFn', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { @@ -190,7 +186,6 @@ describe('operationNameFn', () => { }, '@hey-api/sdk': { api: { - createOperationComment: () => undefined, selector: () => [], }, config: { -- 2.51.2 From 71cb75e099315c7c0f33d228450c33a422da151c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 19:45:43 +0000 Subject: [PATCH 4/7] chore(deps): update dependency @types/bun to v1.3.0 --- packages/openapi-ts/package.json | 2 +- pnpm-lock.yaml | 175 ++++++++++++++----------------- 2 files changed, 80 insertions(+), 97 deletions(-) diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 2fcdebe7d..02ea41fd2 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -112,7 +112,7 @@ "@angular/platform-browser-dynamic": "19.2.15", "@angular/router": "19.2.15", "@config/vite-base": "workspace:*", - "@types/bun": "1.2.23", + "@types/bun": "1.3.0", "@types/cross-spawn": "6.0.6", "@types/semver": "7.7.1", "axios": "1.8.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b645422d..78d7691e8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1314,8 +1314,8 @@ importers: specifier: workspace:* version: link:../config-vite-base '@types/bun': - specifier: 1.2.23 - version: 1.2.23(@types/react@19.0.1) + specifier: 1.3.0 + version: 1.3.0(@types/react@19.0.1) '@types/cross-spawn': specifier: 6.0.6 version: 6.0.6 @@ -1336,7 +1336,7 @@ importers: version: 11.0.3 nuxt: specifier: 3.14.1592 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) ofetch: specifier: 1.4.1 version: 1.4.1 @@ -6304,8 +6304,8 @@ packages: '@types/bonjour@3.5.13': resolution: {integrity: sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==} - '@types/bun@1.2.23': - resolution: {integrity: sha512-le8ueOY5b6VKYf19xT3McVbXqLqmxzPXHsQT/q9JHgikJ2X22wyTW3g3ohz2ZMnp7dod6aduIiq8A14Xyimm0A==} + '@types/bun@1.3.0': + resolution: {integrity: sha512-+lAGCYjXjip2qY375xX/scJeVRmZ5cY0wyHYyCYxNcdEXrQ4AOe3gACgd4iQ8ksOslJtW4VNxBJ8llUwc3a6AA==} '@types/chai@5.2.2': resolution: {integrity: sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==} @@ -7522,8 +7522,8 @@ packages: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} engines: {node: '>=6'} - bun-types@1.2.23: - resolution: {integrity: sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw==} + bun-types@1.3.0: + resolution: {integrity: sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ==} peerDependencies: '@types/react': ^19 @@ -14259,7 +14259,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) - '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0)) + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0)) '@angular-devkit/core': 19.2.0(chokidar@4.0.3) '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/platform-server@19.2.0(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@19.2.0(@angular/animations@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))))(@angular/ssr@19.2.15(5c03da8199d2fcdf9ff93b70f9349edd))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.6.1)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.14(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.8.3)))(terser@5.39.0)(typescript@5.8.3)(yaml@2.8.1) '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3) @@ -14310,8 +14310,8 @@ snapshots: tslib: 2.8.1 typescript: 5.8.3 webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-middleware: 7.4.2(webpack@5.98.0) + webpack-dev-server: 5.2.0(webpack@5.98.0) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) optionalDependencies: @@ -14347,7 +14347,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) - '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0)) + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0)) '@angular-devkit/core': 19.2.0(chokidar@4.0.3) '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/platform-server@19.2.0(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@19.2.0(@angular/animations@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))))(@angular/ssr@19.2.15(5c03da8199d2fcdf9ff93b70f9349edd))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.6.1)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.14(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.8.3)))(terser@5.39.0)(typescript@5.8.3)(yaml@2.8.1) '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3) @@ -14398,8 +14398,8 @@ snapshots: tslib: 2.8.1 typescript: 5.8.3 webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-middleware: 7.4.2(webpack@5.98.0) + webpack-dev-server: 5.2.0(webpack@5.98.0) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) optionalDependencies: @@ -14486,7 +14486,7 @@ snapshots: tslib: 2.8.1 typescript: 5.8.3 webpack: 5.98.0(esbuild@0.25.4) - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-middleware: 7.4.2(webpack@5.98.0) webpack-dev-server: 5.2.2(webpack@5.98.0) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) @@ -14574,7 +14574,7 @@ snapshots: tslib: 2.8.1 typescript: 5.9.3 webpack: 5.98.0(esbuild@0.25.4) - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-middleware: 7.4.2(webpack@5.98.0) webpack-dev-server: 5.2.2(webpack@5.98.0) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) @@ -14606,12 +14606,12 @@ snapshots: - webpack-cli - yaml - '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0))': + '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0))': dependencies: '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) rxjs: 7.8.1 webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-server: 5.2.0(webpack@5.98.0) transitivePeerDependencies: - chokidar @@ -18117,32 +18117,32 @@ snapshots: '@nuxt/devalue@2.0.2': {} - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))': + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 7.2.0 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) transitivePeerDependencies: - magicast - supports-color - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))': + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 7.2.0 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) transitivePeerDependencies: - magicast - supports-color - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))': + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 7.2.0 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - magicast - supports-color @@ -18207,13 +18207,13 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@antfu/utils': 0.7.10 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) '@nuxt/devtools-wizard': 1.7.0 '@nuxt/kit': 3.15.4(magicast@0.3.5) - '@vue/devtools-core': 7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) + '@vue/devtools-core': 7.6.8(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3)) '@vue/devtools-kit': 7.6.8 birpc: 0.2.19 consola: 3.4.2 @@ -18242,9 +18242,9 @@ snapshots: sirv: 3.0.1 tinyglobby: 0.2.14 unimport: 3.14.6(rollup@4.50.0) - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) - vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) + vite-plugin-vue-inspector: 5.3.2(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) which: 3.0.1 ws: 8.18.3 transitivePeerDependencies: @@ -18254,13 +18254,13 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@antfu/utils': 0.7.10 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) '@nuxt/devtools-wizard': 1.7.0 '@nuxt/kit': 3.15.4(magicast@0.3.5) - '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) + '@vue/devtools-core': 7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) '@vue/devtools-kit': 7.6.8 birpc: 0.2.19 consola: 3.4.2 @@ -18289,9 +18289,9 @@ snapshots: sirv: 3.0.1 tinyglobby: 0.2.14 unimport: 3.14.6(rollup@4.50.0) - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) - vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) which: 3.0.1 ws: 8.18.3 transitivePeerDependencies: @@ -18301,13 +18301,13 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@antfu/utils': 0.7.10 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) '@nuxt/devtools-wizard': 1.7.0 '@nuxt/kit': 3.15.4(magicast@0.3.5) - '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3)) + '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) '@vue/devtools-kit': 7.6.8 birpc: 0.2.19 consola: 3.4.2 @@ -18336,9 +18336,9 @@ snapshots: sirv: 3.0.1 tinyglobby: 0.2.14 unimport: 3.14.6(rollup@4.50.0) - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) - vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) which: 3.0.1 ws: 8.18.3 transitivePeerDependencies: @@ -20211,9 +20211,9 @@ snapshots: dependencies: '@types/node': 22.10.5 - '@types/bun@1.2.23(@types/react@19.0.1)': + '@types/bun@1.3.0(@types/react@19.0.1)': dependencies: - bun-types: 1.2.23(@types/react@19.0.1) + bun-types: 1.3.0(@types/react@19.0.1) transitivePeerDependencies: - '@types/react' @@ -21086,38 +21086,38 @@ snapshots: dependencies: '@vue/devtools-kit': 8.0.2 - '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@vue/devtools-core@7.6.8(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 1.1.2 - vite-hot-client: 0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite-hot-client: 0.2.4(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) vue: 3.5.13(typescript@5.9.3) transitivePeerDependencies: - vite - '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 1.1.2 - vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + vite-hot-client: 0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) vue: 3.5.13(typescript@5.9.3) transitivePeerDependencies: - vite - '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3))': + '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 1.1.2 - vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) vue: 3.5.13(typescript@5.9.3) transitivePeerDependencies: - vite @@ -21931,7 +21931,7 @@ snapshots: builtin-modules@3.3.0: {} - bun-types@1.2.23(@types/react@19.0.1): + bun-types@1.3.0(@types/react@19.0.1): dependencies: '@types/node': 22.10.5 '@types/react': 19.0.1 @@ -23182,7 +23182,7 @@ snapshots: '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3) eslint: 9.17.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)) eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@2.6.1)) eslint-plugin-react: 7.37.5(eslint@9.17.0(jiti@2.6.1)) @@ -23210,7 +23210,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.1 @@ -23225,14 +23225,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3) eslint: 9.17.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)) transitivePeerDependencies: - supports-color @@ -23247,7 +23247,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.17.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -26247,10 +26247,10 @@ snapshots: - vue-tsc - xml2js - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3)) '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/telemetry': 2.6.6(magicast@0.3.5) @@ -26368,10 +26368,10 @@ snapshots: - vue-tsc - xml2js - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3)) + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/telemetry': 2.6.6(magicast@0.3.5) @@ -29470,6 +29470,10 @@ snapshots: vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) vite-hot-client: 2.1.0(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite-hot-client@0.2.4(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): + dependencies: + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) + vite-hot-client@0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) @@ -29478,10 +29482,6 @@ snapshots: dependencies: vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) - vite-hot-client@0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): - dependencies: - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) - vite-hot-client@2.1.0(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) @@ -29626,7 +29626,7 @@ snapshots: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) @@ -29637,14 +29637,14 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) optionalDependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) transitivePeerDependencies: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) @@ -29655,14 +29655,14 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) optionalDependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) transitivePeerDependencies: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) @@ -29673,7 +29673,7 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) optionalDependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) transitivePeerDependencies: @@ -29710,7 +29710,7 @@ snapshots: - supports-color - vue - vite-plugin-vue-inspector@5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): + vite-plugin-vue-inspector@5.3.2(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): dependencies: '@babel/core': 7.28.3 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) @@ -29721,11 +29721,11 @@ snapshots: '@vue/compiler-dom': 3.5.21 kolorist: 1.8.0 magic-string: 0.30.18 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) transitivePeerDependencies: - supports-color - vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): + vite-plugin-vue-inspector@5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: '@babel/core': 7.28.3 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) @@ -29736,11 +29736,11 @@ snapshots: '@vue/compiler-dom': 3.5.21 kolorist: 1.8.0 magic-string: 0.30.18 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) transitivePeerDependencies: - supports-color - vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): dependencies: '@babel/core': 7.28.3 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) @@ -29751,7 +29751,7 @@ snapshots: '@vue/compiler-dom': 3.5.21 kolorist: 1.8.0 magic-string: 0.30.18 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - supports-color @@ -29875,23 +29875,6 @@ snapshots: terser: 5.39.0 yaml: 2.8.1 - vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0): - dependencies: - esbuild: 0.25.9 - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 - postcss: 8.5.6 - rollup: 4.50.0 - tinyglobby: 0.2.15 - optionalDependencies: - '@types/node': 22.10.5 - fsevents: 2.3.3 - jiti: 2.6.1 - less: 4.2.2 - sass: 1.85.0 - terser: 5.43.1 - yaml: 2.8.0 - vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1): dependencies: esbuild: 0.25.9 @@ -30227,7 +30210,7 @@ snapshots: webidl-conversions@7.0.0: {} - webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.0)): + webpack-dev-middleware@7.4.2(webpack@5.98.0): dependencies: colorette: 2.0.20 memfs: 4.38.2 @@ -30238,7 +30221,7 @@ snapshots: optionalDependencies: webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)): + webpack-dev-server@5.2.0(webpack@5.98.0): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -30265,7 +30248,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-middleware: 7.4.2(webpack@5.98.0) ws: 8.18.3 optionalDependencies: webpack: 5.98.0(esbuild@0.25.0) @@ -30303,7 +30286,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-middleware: 7.4.2(webpack@5.98.0) ws: 8.18.3 optionalDependencies: webpack: 5.98.0(esbuild@0.25.0) -- 2.51.2 From 04da7cc218da0b95cad6892cef58c35bc53a86a9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 19:46:27 +0000 Subject: [PATCH 5/7] chore(deps): update pnpm to v10.19.0 --- docs/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/package.json b/docs/package.json index e2e596daf..d4026677b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -20,5 +20,5 @@ "vitepress-plugin-llms": "1.7.3", "vue": "3.5.13" }, - "packageManager": "pnpm@10.18.3" + "packageManager": "pnpm@10.19.0" } diff --git a/package.json b/package.json index 2360fa110..be979c2a7 100644 --- a/package.json +++ b/package.json @@ -71,5 +71,5 @@ "typescript-eslint": "8.29.1", "vitest": "3.1.1" }, - "packageManager": "pnpm@10.18.3" + "packageManager": "pnpm@10.19.0" } -- 2.51.2 From e1572888aec1e95d23eb0124fb9a5f3383e89def Mon Sep 17 00:00:00 2001 From: Lubos Date: Sat, 25 Oct 2025 05:39:15 +0800 Subject: [PATCH 6/7] feat: pass tags to symbol meta --- .changeset/plain-keys-camp.md | 5 + .../main/test/openapi-ts.config.ts | 15 +- packages/openapi-ts/src/index.ts | 4 + .../plugins/@hey-api/sdk/shared/functions.ts | 1 + .../@hey-api/typescript/shared/operation.ts | 5 + .../@hey-api/typescript/shared/types.d.ts | 10 +- .../@hey-api/typescript/shared/webhook.ts | 3 + .../plugins/@hey-api/typescript/v1/plugin.ts | 35 ++-- .../src/plugins/arktype/shared/types.d.ts | 12 +- .../src/plugins/arktype/v2/plugin.ts | 34 ++-- .../src/plugins/arktype/v2/toAst/object.ts | 4 +- .../src/plugins/shared/types/instance.d.ts | 90 +++++----- .../src/plugins/shared/utils/instance.ts | 26 +-- .../src/plugins/valibot/shared/export.ts | 42 +++++ .../valibot/{v1 => shared}/operation.ts | 25 ++- .../valibot/{v1 => shared}/pipesToAst.ts | 2 +- .../src/plugins/valibot/shared/types.d.ts | 23 +-- .../plugins/valibot/{v1 => shared}/webhook.ts | 14 +- .../src/plugins/valibot/v1/plugin.ts | 170 +++++++++--------- .../src/plugins/valibot/v1/toAst/array.ts | 35 ++-- .../src/plugins/valibot/v1/toAst/index.ts | 32 ++-- .../src/plugins/valibot/v1/toAst/number.ts | 2 +- .../src/plugins/valibot/v1/toAst/object.ts | 80 +++++---- .../src/plugins/valibot/v1/toAst/string.ts | 2 +- .../src/plugins/valibot/v1/toAst/tuple.ts | 79 ++++---- .../openapi-ts/src/plugins/zod/mini/plugin.ts | 40 ++--- .../src/plugins/zod/shared/operation.ts | 16 +- .../src/plugins/zod/shared/types.d.ts | 12 +- .../src/plugins/zod/shared/webhook.ts | 12 +- .../openapi-ts/src/plugins/zod/v3/plugin.ts | 40 ++--- .../openapi-ts/src/plugins/zod/v4/plugin.ts | 40 ++--- 31 files changed, 489 insertions(+), 421 deletions(-) create mode 100644 .changeset/plain-keys-camp.md create mode 100644 packages/openapi-ts/src/plugins/valibot/shared/export.ts rename packages/openapi-ts/src/plugins/valibot/{v1 => shared}/operation.ts (89%) rename packages/openapi-ts/src/plugins/valibot/{v1 => shared}/pipesToAst.ts (93%) rename packages/openapi-ts/src/plugins/valibot/{v1 => shared}/webhook.ts (91%) diff --git a/.changeset/plain-keys-camp.md b/.changeset/plain-keys-camp.md new file mode 100644 index 000000000..69e25c8af --- /dev/null +++ b/.changeset/plain-keys-camp.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +feat(parser): pass tags to symbol meta diff --git a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts index 8777dad98..cdc50c7d1 100644 --- a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts +++ b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts @@ -141,14 +141,13 @@ export default defineConfig(() => { if (!symbol.external && !symbol.meta?.path) { console.log(`[${plugin.name}]:`, symbol.name, symbol.meta); } - if (symbol.meta?.path) { - if (plugin.name === '@hey-api/sdk') { - console.log( - `[${plugin.name}]:`, - symbol.name, - symbol.meta.path, - ); - } + if (symbol.meta?.tags && symbol.meta?.tags.size > 0) { + console.log( + `[${plugin.name}]:`, + symbol.name, + symbol.meta.path, + symbol.meta.tags, + ); } }, // 'symbol:setValue:after': ({ plugin, symbol }) => { diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index da9b7ca1b..953ec5aab 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -23,6 +23,10 @@ declare module '@hey-api/codegen-core' { * Name of the plugin that registered this symbol. */ pluginName?: string; + /** + * Tags associated with this symbol. + */ + tags?: Set; } } // END OVERRIDES diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts index 60b2262ad..c52e76f32 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/shared/functions.ts @@ -46,6 +46,7 @@ export const generateFlatSdk = ({ const symbol = plugin.registerSymbol({ meta: { path: event._path, + tags: event.tags, }, name: serviceFunctionIdentifier({ config: plugin.context.config, diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts index 5a8bd5cbf..f1f362184 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/operation.ts @@ -125,6 +125,7 @@ const operationToDataType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.requests, @@ -163,6 +164,7 @@ export const operationToType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.errors, @@ -188,6 +190,7 @@ export const operationToType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: { @@ -222,6 +225,7 @@ export const operationToType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.responses, @@ -247,6 +251,7 @@ export const operationToType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: { diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts index 6828485f3..7a58fb3b3 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/types.d.ts @@ -1,3 +1,5 @@ +import type { SymbolMeta } from '@hey-api/codegen-core'; + import type { ToRefs } from '~/plugins'; import type { HeyApiTypeScriptPlugin } from '../types'; @@ -7,9 +9,5 @@ export type IrSchemaToAstOptions = { state: ToRefs; }; -export type PluginState = { - /** - * Path to the schema in the intermediary representation. - */ - path: ReadonlyArray; -}; +export type PluginState = Pick, 'path'> & + Pick, 'tags'>; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts index 7d426076b..e516349f5 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/shared/webhook.ts @@ -28,6 +28,7 @@ const operationToDataType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: { @@ -56,6 +57,7 @@ const operationToDataType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: symbolWebhookPayload.name, placeholder: symbolWebhookPayload.placeholder, @@ -83,6 +85,7 @@ const operationToDataType = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.webhooks, diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts index 2e67e6a86..126a4171f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/v1/plugin.ts @@ -6,12 +6,12 @@ import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins'; import { toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; +import { pathToJsonPointer, refToName } from '~/utils/ref'; import { createClientOptions } from '../shared/clientOptions'; import { exportType } from '../shared/export'; import { operationToType } from '../shared/operation'; -import type { IrSchemaToAstOptions } from '../shared/types'; +import type { IrSchemaToAstOptions, PluginState } from '../shared/types'; import { webhookToType } from '../shared/webhook'; import { createWebhooks } from '../shared/webhooks'; import type { HeyApiTypeScriptPlugin } from '../types'; @@ -68,12 +68,10 @@ export const irSchemaToAst = ({ }; const handleComponent = ({ - $ref, plugin, schema, state, }: IrSchemaToAstOptions & { - $ref: string; schema: IR.SchemaObject; }) => { const type = irSchemaToAst({ plugin, schema, state }); @@ -81,11 +79,13 @@ const handleComponent = ({ // Don't tag enums as 'type' since they export runtime artifacts (values) const isEnum = schema.type === 'enum' && plugin.config.enums.enabled; + const $ref = pathToJsonPointer(state.path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { kind: isEnum ? undefined : 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions, @@ -144,44 +144,37 @@ export const handlerV1: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => { 'server', 'webhook', (event) => { + const state = toRefs({ + path: event._path, + tags: event.tags, + }); switch (event.type) { case 'operation': operationToType({ operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'parameter': handleComponent({ - $ref: event.$ref, plugin, schema: event.parameter.schema, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'requestBody': handleComponent({ - $ref: event.$ref, plugin, schema: event.requestBody.schema, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'schema': handleComponent({ - $ref: event.$ref, plugin, schema: event.schema, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'server': @@ -192,9 +185,7 @@ export const handlerV1: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => { webhookToType({ operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }), ); break; diff --git a/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts b/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts index 9fd1a8477..cc36ea03b 100644 --- a/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts @@ -1,3 +1,4 @@ +import type { SymbolMeta } from '@hey-api/codegen-core'; import type ts from 'typescript'; import type { IR } from '~/ir/types'; @@ -17,13 +18,10 @@ export type IrSchemaToAstOptions = { state: ToRefs; }; -export type PluginState = { - /** - * Path to the schema in the intermediary representation. - */ - _path: ReadonlyArray; - hasLazyExpression: boolean; -}; +export type PluginState = Pick, 'path'> & + Pick, 'tags'> & { + hasLazyExpression: boolean; + }; export type ValidatorArgs = { operation: IR.OperationObject; diff --git a/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts b/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts index d6b6bf76a..fa08234c5 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts @@ -4,10 +4,10 @@ import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins/shared/types/schema'; import { toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; +import { pathToJsonPointer, refToName } from '~/utils/ref'; import { exportAst } from '../shared/export'; -import type { Ast, IrSchemaToAstOptions } from '../shared/types'; +import type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types'; import type { ArktypePlugin } from '../types'; import { irSchemaWithTypeToAst } from './toAst'; @@ -236,20 +236,19 @@ export const irSchemaToAst = ({ }; const handleComponent = ({ - $ref, plugin, schema, state, }: IrSchemaToAstOptions & { - $ref: string; schema: IR.SchemaObject; }): void => { + const $ref = pathToJsonPointer(state.path.value); const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); const symbol = plugin.registerSymbol({ exported: true, meta: { - path: state._path.value, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions, @@ -262,7 +261,7 @@ const handleComponent = ({ exported: true, meta: { kind: 'type', - path: state._path.value, + path: state.path.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -294,6 +293,11 @@ export const handlerV2: ArktypePlugin['Handler'] = ({ plugin }) => { 'schema', 'webhook', (event) => { + const state = toRefs({ + hasLazyExpression: false, + path: event._path, + tags: event.tags, + }); switch (event.type) { // case 'operation': // operationToZodSchema({ @@ -311,35 +315,23 @@ export const handlerV2: ArktypePlugin['Handler'] = ({ plugin }) => { // break; case 'parameter': handleComponent({ - $ref: event.$ref, plugin, schema: event.parameter.schema, - state: toRefs({ - _path: event._path, - hasLazyExpression: false, - }), + state, }); break; case 'requestBody': handleComponent({ - $ref: event.$ref, plugin, schema: event.requestBody.schema, - state: toRefs({ - _path: event._path, - hasLazyExpression: false, - }), + state, }); break; case 'schema': handleComponent({ - $ref: event.$ref, plugin, schema: event.schema, - state: toRefs({ - _path: event._path, - hasLazyExpression: false, - }), + state, }); break; // case 'webhook': diff --git a/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts b/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts index 3e974f785..1ca6e0d30 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts @@ -34,7 +34,7 @@ export const objectToAst = ({ schema: property, state: { ...state, - _path: toRef([...state._path.value, 'properties', name]), + path: toRef([...state.path.value, 'properties', name]), }, }); if (propertyAst.hasLazyExpression) { @@ -119,7 +119,7 @@ export const objectToAst = ({ schema: schema.additionalProperties, state: { ...state, - _path: toRef([...state._path.value, 'additionalProperties']), + path: toRef([...state.path.value, 'additionalProperties']), }, }); result.expression = tsc.callExpression({ diff --git a/packages/openapi-ts/src/plugins/shared/types/instance.d.ts b/packages/openapi-ts/src/plugins/shared/types/instance.d.ts index 3772be1a7..de003ced3 100644 --- a/packages/openapi-ts/src/plugins/shared/types/instance.d.ts +++ b/packages/openapi-ts/src/plugins/shared/types/instance.d.ts @@ -1,47 +1,55 @@ import type { IrTopLevelKind } from '~/ir/graph'; import type { IR } from '~/ir/types'; -type WalkEvents = - | { - _path: ReadonlyArray; - method: keyof IR.PathItemObject; - operation: IR.OperationObject; - path: string; - type: Extract; - } - | { - $ref: string; - _path: ReadonlyArray; - name: string; - parameter: IR.ParameterObject; - type: Extract; - } - | { - $ref: string; - _path: ReadonlyArray; - name: string; - requestBody: IR.RequestBodyObject; - type: Extract; - } - | { - $ref: string; - _path: ReadonlyArray; - name: string; - schema: IR.SchemaObject; - type: Extract; - } - | { - _path: ReadonlyArray; - server: IR.ServerObject; - type: Extract; - } - | { - _path: ReadonlyArray; - key: string; - method: keyof IR.PathItemObject; - operation: IR.OperationObject; - type: Extract; - }; +export type BaseEvent = { + /** + * Path to the node, derived from the pointer. + */ + _path: ReadonlyArray; + /** + * Pointer to the node in the graph. + */ + pointer: string; + /** + * Tags associated with the node. + */ + tags?: Set; +}; + +type WalkEvents = BaseEvent & + ( + | { + method: keyof IR.PathItemObject; + operation: IR.OperationObject; + path: string; + type: Extract; + } + | { + name: string; + parameter: IR.ParameterObject; + type: Extract; + } + | { + name: string; + requestBody: IR.RequestBodyObject; + type: Extract; + } + | { + name: string; + schema: IR.SchemaObject; + type: Extract; + } + | { + server: IR.ServerObject; + type: Extract; + } + | { + key: string; + method: keyof IR.PathItemObject; + operation: IR.OperationObject; + type: Extract; + } + ); export type WalkEvent = Extract< WalkEvents, diff --git a/packages/openapi-ts/src/plugins/shared/utils/instance.ts b/packages/openapi-ts/src/plugins/shared/utils/instance.ts index 89256c4f8..f3fffd15a 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/instance.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/instance.ts @@ -24,7 +24,7 @@ import type { Plugin } from '~/plugins'; import type { PluginConfigMap } from '~/plugins/config'; import { jsonPointerToPath } from '~/utils/ref'; -import type { WalkEvent } from '../types/instance'; +import type { BaseEvent, WalkEvent } from '../types/instance'; const defaultGetFilePath = (symbol: Symbol): string | undefined => { if (!symbol.meta?.pluginName || typeof symbol.meta.pluginName !== 'string') { @@ -182,20 +182,24 @@ export class PluginInstance { const result = matchIrPointerToGroup(pointer); if (!result.matched || !eventSet.has(result.kind)) return; let event: WalkEvent | undefined; + const baseEvent: BaseEvent = { + _path: jsonPointerToPath(pointer), + pointer, + tags: nodeInfo.tags, + }; switch (result.kind) { case 'operation': event = { - _path: jsonPointerToPath(pointer), + ...baseEvent, method: nodeInfo.key as keyof IR.PathItemObject, operation: nodeInfo.node as IR.OperationObject, - path: jsonPointerToPath(pointer)[1]!, + path: baseEvent._path[1] as string, type: result.kind, } satisfies WalkEvent<'operation'>; break; case 'parameter': event = { - $ref: pointer, - _path: jsonPointerToPath(pointer), + ...baseEvent, name: nodeInfo.key as string, parameter: nodeInfo.node as IR.ParameterObject, type: result.kind, @@ -203,8 +207,7 @@ export class PluginInstance { break; case 'requestBody': event = { - $ref: pointer, - _path: jsonPointerToPath(pointer), + ...baseEvent, name: nodeInfo.key as string, requestBody: nodeInfo.node as IR.RequestBodyObject, type: result.kind, @@ -212,8 +215,7 @@ export class PluginInstance { break; case 'schema': event = { - $ref: pointer, - _path: jsonPointerToPath(pointer), + ...baseEvent, name: nodeInfo.key as string, schema: nodeInfo.node as IR.SchemaObject, type: result.kind, @@ -221,15 +223,15 @@ export class PluginInstance { break; case 'server': event = { - _path: jsonPointerToPath(pointer), + ...baseEvent, server: nodeInfo.node as IR.ServerObject, type: result.kind, } satisfies WalkEvent<'server'>; break; case 'webhook': event = { - _path: jsonPointerToPath(pointer), - key: jsonPointerToPath(pointer)[1]!, + ...baseEvent, + key: baseEvent._path[1] as string, method: nodeInfo.key as keyof IR.PathItemObject, operation: nodeInfo.node as IR.OperationObject, type: result.kind, diff --git a/packages/openapi-ts/src/plugins/valibot/shared/export.ts b/packages/openapi-ts/src/plugins/valibot/shared/export.ts new file mode 100644 index 000000000..8d8f0c449 --- /dev/null +++ b/packages/openapi-ts/src/plugins/valibot/shared/export.ts @@ -0,0 +1,42 @@ +import type { Symbol } from '@hey-api/codegen-core'; +import type ts from 'typescript'; + +import type { IR } from '~/ir/types'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import { tsc } from '~/tsc'; + +import { identifiers } from '../v1/constants'; +import { pipesToAst } from './pipesToAst'; +import type { Ast, IrSchemaToAstOptions } from './types'; + +export const exportAst = ({ + ast, + plugin, + schema, + state, + symbol, +}: IrSchemaToAstOptions & { + ast: Ast; + schema: IR.SchemaObject; + symbol: Symbol; +}): void => { + const v = plugin.referenceSymbol( + plugin.api.selector('external', 'valibot.v'), + ); + + const statement = tsc.constVariable({ + comment: plugin.config.comments + ? createSchemaComment({ schema }) + : undefined, + exportConst: symbol.exported, + expression: pipesToAst({ pipes: ast.pipes, plugin }), + name: symbol.placeholder, + typeName: state.hasLazyExpression.value + ? (tsc.propertyAccessExpression({ + expression: v.placeholder, + name: ast.typeName || identifiers.types.GenericSchema.text, + }) as unknown as ts.TypeNode) + : undefined, + }); + plugin.setSymbolValue(symbol, statement); +}; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/operation.ts b/packages/openapi-ts/src/plugins/valibot/shared/operation.ts similarity index 89% rename from packages/openapi-ts/src/plugins/valibot/v1/operation.ts rename to packages/openapi-ts/src/plugins/valibot/shared/operation.ts index 032d73241..841865d01 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/operation.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/operation.ts @@ -1,16 +1,20 @@ import { operationResponsesMap } from '~/ir/operation'; import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import { toRef } from '~/plugins/shared/utils/refs'; -import type { IrSchemaToAstOptions } from '../shared/types'; -import { irSchemaToAst } from './plugin'; +import { exportAst } from './export'; +import type { Ast, IrSchemaToAstOptions } from './types'; export const irOperationToAst = ({ + getAst, operation, plugin, state, }: IrSchemaToAstOptions & { + getAst: ( + schema: IR.SchemaObject, + path: ReadonlyArray, + ) => Ast; operation: IR.OperationObject; }) => { if (plugin.config.requests.enabled) { @@ -111,10 +115,12 @@ export const irOperationToAst = ({ schemaData.required = [...requiredProperties]; + const ast = getAst(schemaData, state.path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.requests, @@ -122,7 +128,8 @@ export const irOperationToAst = ({ }), selector: plugin.api.selector('data', operation.id), }); - irSchemaToAst({ + exportAst({ + ast, plugin, schema: schemaData, state, @@ -136,10 +143,12 @@ export const irOperationToAst = ({ if (response) { const path = [...state.path.value, 'responses']; + const ast = getAst(response, path); const symbol = plugin.registerSymbol({ exported: true, meta: { path, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.responses, @@ -147,13 +156,11 @@ export const irOperationToAst = ({ }), selector: plugin.api.selector('responses', operation.id), }); - irSchemaToAst({ + exportAst({ + ast, plugin, schema: response, - state: { - ...state, - path: toRef(path), - }, + state, symbol, }); } diff --git a/packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts b/packages/openapi-ts/src/plugins/valibot/shared/pipesToAst.ts similarity index 93% rename from packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts rename to packages/openapi-ts/src/plugins/valibot/shared/pipesToAst.ts index bca4920f7..e9ad8a8e5 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/pipesToAst.ts @@ -3,7 +3,7 @@ import type ts from 'typescript'; import { tsc } from '~/tsc'; import type { ValibotPlugin } from '../types'; -import { identifiers } from './constants'; +import { identifiers } from '../v1/constants'; export const pipesToAst = ({ pipes, diff --git a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts index ddd4743d3..ef1a1ae7f 100644 --- a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts @@ -1,23 +1,26 @@ +import type { SymbolMeta } from '@hey-api/codegen-core'; +import type ts from 'typescript'; + import type { IR } from '~/ir/types'; import type { ToRefs } from '~/plugins'; -import type { StringCase, StringName } from '~/types/case'; import type { ValibotPlugin } from '../types'; +export type Ast = { + hasLazyExpression?: boolean; + pipes: Array; + typeName?: string | ts.Identifier; +}; + export type IrSchemaToAstOptions = { plugin: ValibotPlugin['Instance']; state: ToRefs; }; -export type PluginState = { - hasLazyExpression: boolean; - nameCase: StringCase; - nameTransformer: StringName; - /** - * Path to the schema in the intermediary representation. - */ - path: ReadonlyArray; -}; +export type PluginState = Pick, 'path'> & + Pick, 'tags'> & { + hasLazyExpression: boolean; + }; export type ValidatorArgs = { operation: IR.OperationObject; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts b/packages/openapi-ts/src/plugins/valibot/shared/webhook.ts similarity index 91% rename from packages/openapi-ts/src/plugins/valibot/v1/webhook.ts rename to packages/openapi-ts/src/plugins/valibot/shared/webhook.ts index 376bb60e2..9977b3d32 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/webhook.ts @@ -1,14 +1,19 @@ import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; -import type { IrSchemaToAstOptions } from '../shared/types'; -import { irSchemaToAst } from './plugin'; +import { exportAst } from './export'; +import type { Ast, IrSchemaToAstOptions } from './types'; export const irWebhookToAst = ({ + getAst, operation, plugin, state, }: IrSchemaToAstOptions & { + getAst: ( + schema: IR.SchemaObject, + path: ReadonlyArray, + ) => Ast; operation: IR.OperationObject; }) => { if (plugin.config.webhooks.enabled) { @@ -109,10 +114,12 @@ export const irWebhookToAst = ({ schemaData.required = [...requiredProperties]; + const ast = getAst(schemaData, state.path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.webhooks, @@ -120,7 +127,8 @@ export const irWebhookToAst = ({ }), selector: plugin.api.selector('webhook-request', operation.id), }); - irSchemaToAst({ + exportAst({ + ast, plugin, schema: schemaData, state, diff --git a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts index 66d50ddb3..2eef0172e 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts @@ -1,4 +1,3 @@ -import type { Symbol } from '@hey-api/codegen-core'; import type ts from 'typescript'; import { deduplicateSchema } from '~/ir/schema'; @@ -6,31 +5,25 @@ import type { IR } from '~/ir/types'; import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; -import { createSchemaComment } from '~/plugins/shared/utils/schema'; import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; +import { pathToJsonPointer, refToName } from '~/utils/ref'; +import { exportAst } from '../shared/export'; import { numberParameter } from '../shared/numbers'; -import type { IrSchemaToAstOptions, PluginState } from '../shared/types'; +import { irOperationToAst } from '../shared/operation'; +import { pipesToAst } from '../shared/pipesToAst'; +import type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types'; +import { irWebhookToAst } from '../shared/webhook'; import type { ValibotPlugin } from '../types'; import { identifiers } from './constants'; -import { irOperationToAst } from './operation'; -import { pipesToAst } from './pipesToAst'; import { irSchemaWithTypeToAst } from './toAst'; -import { irWebhookToAst } from './webhook'; export const irSchemaToAst = ({ - $ref, optional, plugin, schema, state, - symbol, }: IrSchemaToAstOptions & { - /** - * When $ref is supplied, a node will be emitted to the file. - */ - $ref?: string; /** * Accept `optional` to handle optional object properties. We can't handle * this inside the object function because `.optional()` must come before @@ -38,28 +31,21 @@ export const irSchemaToAst = ({ */ optional?: boolean; schema: IR.SchemaObject; - /** - * When symbol is supplied, the AST node will be set as its value. - */ - symbol?: Symbol; -}): Array => { - if ($ref && !symbol) { - const selector = plugin.api.selector('ref', $ref); - symbol = plugin.getSymbol(selector) || plugin.referenceSymbol(selector); - } +}): Ast => { + const ast: Ast = { + pipes: [], + }; const v = plugin.referenceSymbol( plugin.api.selector('external', 'valibot.v'), ); - let anyType: string | undefined; - let pipes: Array = []; if (schema.$ref) { const selector = plugin.api.selector('ref', schema.$ref); const refSymbol = plugin.referenceSymbol(selector); if (plugin.isSymbolRegistered(selector)) { const ref = tsc.identifier({ text: refSymbol.placeholder }); - pipes.push(ref); + ast.pipes.push(ref); } else { const lazyExpression = tsc.callExpression({ functionName: tsc.propertyAccessExpression({ @@ -76,17 +62,17 @@ export const irSchemaToAst = ({ }), ], }); - pipes.push(lazyExpression); + ast.pipes.push(lazyExpression); state.hasLazyExpression.value = true; } } else if (schema.type) { - const ast = irSchemaWithTypeToAst({ + const typeAst = irSchemaWithTypeToAst({ plugin, schema: schema as SchemaWithType, state, }); - anyType = ast.anyType; - pipes.push(ast.expression); + ast.typeName = typeAst.anyType; + ast.pipes.push(typeAst.expression); if (plugin.config.metadata && schema.description) { const expression = tsc.callExpression({ @@ -105,7 +91,7 @@ export const irSchemaToAst = ({ }), ], }); - pipes.push(expression); + ast.pipes.push(expression); } } else if (schema.items) { schema = deduplicateSchema({ schema }); @@ -120,7 +106,7 @@ export const irSchemaToAst = ({ path: toRef([...state.path.value, 'items', index]), }, }); - return pipesToAst({ pipes: itemAst, plugin }); + return pipesToAst({ pipes: itemAst.pipes, plugin }); }); if (schema.logicalOperator === 'and') { @@ -135,7 +121,7 @@ export const irSchemaToAst = ({ }), ], }); - pipes.push(intersectExpression); + ast.pipes.push(intersectExpression); } else { const unionExpression = tsc.callExpression({ functionName: tsc.propertyAccessExpression({ @@ -148,26 +134,26 @@ export const irSchemaToAst = ({ }), ], }); - pipes.push(unionExpression); + ast.pipes.push(unionExpression); } } else { const schemaPipes = irSchemaToAst({ plugin, schema, state }); - pipes.push(...schemaPipes); + ast.pipes.push(...schemaPipes.pipes); } } else { // catch-all fallback for failed schemas - const ast = irSchemaWithTypeToAst({ + const typeAst = irSchemaWithTypeToAst({ plugin, schema: { type: 'unknown', }, state, }); - anyType = ast.anyType; - pipes.push(ast.expression); + ast.typeName = typeAst.anyType; + ast.pipes.push(typeAst.expression); } - if (pipes.length) { + if (ast.pipes.length) { if (schema.accessScope === 'read') { const readonlyExpression = tsc.callExpression({ functionName: tsc.propertyAccessExpression({ @@ -175,7 +161,7 @@ export const irSchemaToAst = ({ name: identifiers.actions.readonly, }), }); - pipes.push(readonlyExpression); + ast.pipes.push(readonlyExpression); } let callParameter: ts.Expression | undefined; @@ -184,67 +170,66 @@ export const irSchemaToAst = ({ const isBigInt = schema.type === 'integer' && schema.format === 'int64'; callParameter = numberParameter({ isBigInt, value: schema.default }); if (callParameter) { - pipes = [ + ast.pipes = [ tsc.callExpression({ functionName: tsc.propertyAccessExpression({ expression: v.placeholder, name: identifiers.schemas.optional, }), - parameters: [pipesToAst({ pipes, plugin }), callParameter], + parameters: [ + pipesToAst({ pipes: ast.pipes, plugin }), + callParameter, + ], }), ]; } } if (optional && !callParameter) { - pipes = [ + ast.pipes = [ tsc.callExpression({ functionName: tsc.propertyAccessExpression({ expression: v.placeholder, name: identifiers.schemas.optional, }), - parameters: [pipesToAst({ pipes, plugin })], + parameters: [pipesToAst({ pipes: ast.pipes, plugin })], }), ]; } } - if (symbol) { - if ($ref) { - symbol = plugin.registerSymbol({ - exported: true, - meta: { - path: state.path.value, - }, - name: buildName({ - config: { - case: state.nameCase.value, - name: state.nameTransformer.value, - }, - name: refToName($ref), - }), - selector: plugin.api.selector('ref', $ref), - }); - } - const statement = tsc.constVariable({ - comment: plugin.config.comments - ? createSchemaComment({ schema }) - : undefined, - exportConst: symbol.exported, - expression: pipesToAst({ pipes, plugin }), - name: symbol.placeholder, - typeName: state.hasLazyExpression.value - ? (tsc.propertyAccessExpression({ - expression: v.placeholder, - name: anyType || identifiers.types.GenericSchema.text, - }) as unknown as ts.TypeNode) - : undefined, - }); - plugin.setSymbolValue(symbol, statement); - return []; - } + return ast as Ast; +}; - return pipes; +const handleComponent = ({ + plugin, + schema, + state, +}: IrSchemaToAstOptions & { + schema: IR.SchemaObject; +}): void => { + const $ref = pathToJsonPointer(state.path.value); + const ast = irSchemaToAst({ plugin, schema, state }); + const baseName = refToName($ref); + const symbol = plugin.registerSymbol({ + exported: true, + meta: { + path: state.path.value, + tags: state.tags?.value, + }, + name: buildName({ + config: plugin.config.definitions, + name: baseName, + }), + selector: plugin.api.selector('ref', $ref), + }); + exportAst({ + ast, + plugin, + schema, + state, + symbol, + }); }; export const handlerV1: ValibotPlugin['Handler'] = ({ plugin }) => { @@ -264,38 +249,41 @@ export const handlerV1: ValibotPlugin['Handler'] = ({ plugin }) => { (event) => { const state = toRefs({ hasLazyExpression: false, - nameCase: plugin.config.definitions.case, - nameTransformer: plugin.config.definitions.name, path: event._path, + tags: event.tags, }); - switch (event.type) { case 'operation': irOperationToAst({ + getAst: (schema, path) => { + const state = toRefs({ + hasLazyExpression: false, + path, + tags: event.tags, + }); + return irSchemaToAst({ plugin, schema, state }); + }, operation: event.operation, plugin, state, }); break; case 'parameter': - irSchemaToAst({ - $ref: event.$ref, + handleComponent({ plugin, schema: event.parameter.schema, state, }); break; case 'requestBody': - irSchemaToAst({ - $ref: event.$ref, + handleComponent({ plugin, schema: event.requestBody.schema, state, }); break; case 'schema': - irSchemaToAst({ - $ref: event.$ref, + handleComponent({ plugin, schema: event.schema, state, @@ -303,6 +291,14 @@ export const handlerV1: ValibotPlugin['Handler'] = ({ plugin }) => { break; case 'webhook': irWebhookToAst({ + getAst: (schema, path) => { + const state = toRefs({ + hasLazyExpression: false, + path, + tags: event.tags, + }); + return irSchemaToAst({ plugin, schema, state }); + }, operation: event.operation, plugin, state, diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts index 010d56154..aac05b159 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts @@ -1,13 +1,11 @@ -import type ts from 'typescript'; - import { deduplicateSchema } from '~/ir/schema'; import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import type { IrSchemaToAstOptions } from '../../shared/types'; +import { pipesToAst } from '../../shared/pipesToAst'; +import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; -import { pipesToAst } from '../pipesToAst'; import { irSchemaToAst } from '../plugin'; import { unknownToAst } from './unknown'; @@ -17,7 +15,11 @@ export const arrayToAst = ({ state, }: IrSchemaToAstOptions & { schema: SchemaWithType<'array'>; -}): ts.Expression => { +}): Omit => { + const result: Omit = { + pipes: [], + }; + const v = plugin.referenceSymbol( plugin.api.selector('external', 'valibot.v'), ); @@ -26,8 +28,6 @@ export const arrayToAst = ({ name: identifiers.schemas.array, }); - const pipes: Array = []; - if (!schema.items) { const expression = tsc.callExpression({ functionName, @@ -41,13 +41,13 @@ export const arrayToAst = ({ }), ], }); - pipes.push(expression); + result.pipes.push(expression); } else { schema = deduplicateSchema({ schema }); // at least one item is guaranteed const itemExpressions = schema.items!.map((item, index) => { - const schemaPipes = irSchemaToAst({ + const itemAst = irSchemaToAst({ plugin, schema: item, state: { @@ -55,7 +55,10 @@ export const arrayToAst = ({ path: toRef([...state.path.value, 'items', index]), }, }); - return pipesToAst({ pipes: schemaPipes, plugin }); + if (itemAst.hasLazyExpression) { + result.hasLazyExpression = true; + } + return pipesToAst({ pipes: itemAst.pipes, plugin }); }); if (itemExpressions.length === 1) { @@ -63,7 +66,7 @@ export const arrayToAst = ({ functionName, parameters: itemExpressions, }); - pipes.push(expression); + result.pipes.push(expression); } else { if (schema.logicalOperator === 'and') { // TODO: parser - handle intersection @@ -87,7 +90,7 @@ export const arrayToAst = ({ }), ], }); - pipes.push(expression); + result.pipes.push(expression); } } @@ -99,7 +102,7 @@ export const arrayToAst = ({ }), parameters: [tsc.valueToExpression({ value: schema.minItems })], }); - pipes.push(expression); + result.pipes.push(expression); } else { if (schema.minItems !== undefined) { const expression = tsc.callExpression({ @@ -109,7 +112,7 @@ export const arrayToAst = ({ }), parameters: [tsc.valueToExpression({ value: schema.minItems })], }); - pipes.push(expression); + result.pipes.push(expression); } if (schema.maxItems !== undefined) { @@ -120,9 +123,9 @@ export const arrayToAst = ({ }), parameters: [tsc.valueToExpression({ value: schema.maxItems })], }); - pipes.push(expression); + result.pipes.push(expression); } } - return pipesToAst({ pipes, plugin }); + return result as Omit; }; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts index 8b324935b..8d5948e25 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts @@ -2,6 +2,7 @@ import type ts from 'typescript'; import type { SchemaWithType } from '~/plugins'; +import { pipesToAst } from '../../shared/pipesToAst'; import type { IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; import { booleanToAst } from './boolean'; @@ -28,9 +29,12 @@ export const irSchemaWithTypeToAst = ({ switch (schema.type) { case 'array': return { - expression: arrayToAst({ - ...args, - schema: schema as SchemaWithType<'array'>, + expression: pipesToAst({ + pipes: arrayToAst({ + ...args, + schema: schema as SchemaWithType<'array'>, + }).pipes, + plugin: args.plugin, }), }; case 'boolean': @@ -70,10 +74,15 @@ export const irSchemaWithTypeToAst = ({ }), }; case 'object': - return objectToAst({ - ...args, - schema: schema as SchemaWithType<'object'>, - }); + return { + expression: pipesToAst({ + pipes: objectToAst({ + ...args, + schema: schema as SchemaWithType<'object'>, + }).pipes, + plugin: args.plugin, + }), + }; case 'string': // For string schemas with int64/uint64 formats, use number handler to generate union with transform if (schema.format === 'int64' || schema.format === 'uint64') { @@ -92,9 +101,12 @@ export const irSchemaWithTypeToAst = ({ }; case 'tuple': return { - expression: tupleToAst({ - ...args, - schema: schema as SchemaWithType<'tuple'>, + expression: pipesToAst({ + pipes: tupleToAst({ + ...args, + schema: schema as SchemaWithType<'tuple'>, + }).pipes, + plugin: args.plugin, }), }; case 'undefined': diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts index fde88c8f7..74604f6a8 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts @@ -9,9 +9,9 @@ import { needsBigIntForFormat, numberParameter, } from '../../shared/numbers'; +import { pipesToAst } from '../../shared/pipesToAst'; import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; -import { pipesToAst } from '../pipesToAst'; export const numberToAst = ({ plugin, diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts index d979c203d..6c4607545 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts @@ -5,9 +5,9 @@ import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; import { numberRegExp } from '~/utils/regexp'; -import type { IrSchemaToAstOptions } from '../../shared/types'; +import { pipesToAst } from '../../shared/pipesToAst'; +import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; -import { pipesToAst } from '../pipesToAst'; import { irSchemaToAst } from '../plugin'; export const objectToAst = ({ @@ -16,10 +16,9 @@ export const objectToAst = ({ state, }: IrSchemaToAstOptions & { schema: SchemaWithType<'object'>; -}): { - anyType: string; - expression: ts.CallExpression; -} => { +}): Omit => { + const result: Partial> = {}; + // TODO: parser - handle constants const properties: Array = []; @@ -29,7 +28,7 @@ export const objectToAst = ({ const property = schema.properties[name]!; const isRequired = required.includes(name); - const schemaPipes = irSchemaToAst({ + const propertyAst = irSchemaToAst({ optional: !isRequired, plugin, schema: property, @@ -38,6 +37,9 @@ export const objectToAst = ({ path: toRef([...state.path.value, 'properties', name]), }, }); + if (propertyAst.hasLazyExpression) { + result.hasLazyExpression = true; + } numberRegExp.lastIndex = 0; let propertyName; @@ -60,7 +62,7 @@ export const objectToAst = ({ } properties.push( tsc.propertyAssignment({ - initializer: pipesToAst({ pipes: schemaPipes, plugin }), + initializer: pipesToAst({ pipes: propertyAst.pipes, plugin }), name: propertyName, }), ); @@ -75,7 +77,7 @@ export const objectToAst = ({ schema.additionalProperties.type === 'object' && !Object.keys(properties).length ) { - const pipes = irSchemaToAst({ + const additionalAst = irSchemaToAst({ plugin, schema: schema.additionalProperties, state: { @@ -83,38 +85,38 @@ export const objectToAst = ({ path: toRef([...state.path.value, 'additionalProperties']), }, }); - const expression = tsc.callExpression({ - functionName: tsc.propertyAccessExpression({ - expression: v.placeholder, - name: identifiers.schemas.record, - }), - parameters: [ - tsc.callExpression({ - functionName: tsc.propertyAccessExpression({ - expression: v.placeholder, - name: identifiers.schemas.string, - }), - parameters: [], + if (additionalAst.hasLazyExpression) { + result.hasLazyExpression = true; + } + result.pipes = [ + tsc.callExpression({ + functionName: tsc.propertyAccessExpression({ + expression: v.placeholder, + name: identifiers.schemas.record, }), - pipesToAst({ pipes, plugin }), - ], - }); - return { - anyType: 'AnyZodObject', - expression, - }; + parameters: [ + tsc.callExpression({ + functionName: tsc.propertyAccessExpression({ + expression: v.placeholder, + name: identifiers.schemas.string, + }), + parameters: [], + }), + pipesToAst({ pipes: additionalAst.pipes, plugin }), + ], + }), + ]; + return result as Omit; } - const expression = tsc.callExpression({ - functionName: tsc.propertyAccessExpression({ - expression: v.placeholder, - name: identifiers.schemas.object, + result.pipes = [ + tsc.callExpression({ + functionName: tsc.propertyAccessExpression({ + expression: v.placeholder, + name: identifiers.schemas.object, + }), + parameters: [ts.factory.createObjectLiteralExpression(properties, true)], }), - parameters: [ts.factory.createObjectLiteralExpression(properties, true)], - }); - return { - // Zod uses AnyZodObject here, maybe we want to be more specific too - anyType: identifiers.types.GenericSchema.text, - expression, - }; + ]; + return result as Omit; }; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts index 56d302bb4..6b74f8120 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts @@ -3,9 +3,9 @@ import type ts from 'typescript'; import type { SchemaWithType } from '~/plugins'; import { tsc } from '~/tsc'; +import { pipesToAst } from '../../shared/pipesToAst'; import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; -import { pipesToAst } from '../pipesToAst'; export const stringToAst = ({ plugin, diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts index dcf349c50..9593bcc83 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts @@ -2,9 +2,9 @@ import type { SchemaWithType } from '~/plugins'; import { toRef } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import type { IrSchemaToAstOptions } from '../../shared/types'; +import { pipesToAst } from '../../shared/pipesToAst'; +import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; -import { pipesToAst } from '../pipesToAst'; import { irSchemaToAst } from '../plugin'; import { unknownToAst } from './unknown'; @@ -14,7 +14,9 @@ export const tupleToAst = ({ state, }: IrSchemaToAstOptions & { schema: SchemaWithType<'tuple'>; -}) => { +}): Omit => { + const result: Partial> = {}; + const v = plugin.referenceSymbol( plugin.api.selector('external', 'valibot.v'), ); @@ -29,18 +31,20 @@ export const tupleToAst = ({ parameters: [tsc.valueToExpression({ value })], }), ); - const expression = tsc.callExpression({ - functionName: tsc.propertyAccessExpression({ - expression: v.placeholder, - name: identifiers.schemas.tuple, - }), - parameters: [ - tsc.arrayLiteralExpression({ - elements: tupleElements, + result.pipes = [ + tsc.callExpression({ + functionName: tsc.propertyAccessExpression({ + expression: v.placeholder, + name: identifiers.schemas.tuple, }), - ], - }); - return expression; + parameters: [ + tsc.arrayLiteralExpression({ + elements: tupleElements, + }), + ], + }), + ]; + return result as Omit; } if (schema.items) { @@ -53,27 +57,36 @@ export const tupleToAst = ({ path: toRef([...state.path.value, 'items', index]), }, }); - return pipesToAst({ pipes: schemaPipes, plugin }); + if (schemaPipes.hasLazyExpression) { + result.hasLazyExpression = true; + } + return pipesToAst({ pipes: schemaPipes.pipes, plugin }); }); - const expression = tsc.callExpression({ - functionName: tsc.propertyAccessExpression({ - expression: v.placeholder, - name: identifiers.schemas.tuple, - }), - parameters: [ - tsc.arrayLiteralExpression({ - elements: tupleElements, + result.pipes = [ + tsc.callExpression({ + functionName: tsc.propertyAccessExpression({ + expression: v.placeholder, + name: identifiers.schemas.tuple, }), - ], - }); - return expression; + parameters: [ + tsc.arrayLiteralExpression({ + elements: tupleElements, + }), + ], + }), + ]; + return result as Omit; } - return unknownToAst({ - plugin, - schema: { - type: 'unknown', - }, - state, - }); + return { + pipes: [ + unknownToAst({ + plugin, + schema: { + type: 'unknown', + }, + state, + }), + ], + }; }; diff --git a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts index 7991efa3d..8821846b1 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts @@ -4,7 +4,7 @@ import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; +import { pathToJsonPointer, refToName } from '~/utils/ref'; import { identifiers } from '../constants'; import { exportAst } from '../shared/export'; @@ -226,20 +226,20 @@ export const irSchemaToAst = ({ }; const handleComponent = ({ - $ref, plugin, schema, state, }: IrSchemaToAstOptions & { - $ref: string; schema: IR.SchemaObject; }): void => { + const $ref = pathToJsonPointer(state.path.value); const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); const symbol = plugin.registerSymbol({ exported: true, meta: { path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions, @@ -253,6 +253,7 @@ const handleComponent = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -285,6 +286,11 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { 'schema', 'webhook', (event) => { + const state = toRefs({ + hasLazyExpression: false, + path: event._path, + tags: event.tags, + }); switch (event.type) { case 'operation': irOperationToAst({ @@ -292,47 +298,34 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { const state = toRefs({ hasLazyExpression: false, path, + tags: event.tags, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'parameter': handleComponent({ - $ref: event.$ref, plugin, schema: event.parameter.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'requestBody': handleComponent({ - $ref: event.$ref, plugin, schema: event.requestBody.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'schema': handleComponent({ - $ref: event.$ref, plugin, schema: event.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'webhook': @@ -341,14 +334,13 @@ export const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => { const state = toRefs({ hasLazyExpression: false, path, + tags: event.tags, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; } diff --git a/packages/openapi-ts/src/plugins/zod/shared/operation.ts b/packages/openapi-ts/src/plugins/zod/shared/operation.ts index fc6ae8286..3984d1b27 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/operation.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/operation.ts @@ -10,13 +10,12 @@ export const irOperationToAst = ({ operation, plugin, state, -}: Omit & { +}: IrSchemaToAstOptions & { getAst: ( schema: IR.SchemaObject, path: ReadonlyArray, ) => Ast; operation: IR.OperationObject; - state: Partial; }): void => { if (plugin.config.requests.enabled) { const requiredProperties = new Set(); @@ -116,12 +115,12 @@ export const irOperationToAst = ({ schemaData.required = [...requiredProperties]; - const path = state.path?.value || []; - const ast = getAst(schemaData, path); + const ast = getAst(schemaData, state.path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { - path, + path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.requests, @@ -134,7 +133,8 @@ export const irOperationToAst = ({ exported: true, meta: { kind: 'type', - path, + path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.requests.types.infer, @@ -157,12 +157,13 @@ export const irOperationToAst = ({ const { response } = operationResponsesMap(operation); if (response) { - const path = [...(state.path?.value || []), 'responses']; + const path = [...state.path.value, 'responses']; const ast = getAst(response, path); const symbol = plugin.registerSymbol({ exported: true, meta: { path, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.responses, @@ -176,6 +177,7 @@ export const irOperationToAst = ({ meta: { kind: 'type', path, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.responses.types.infer, diff --git a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts index 3b6d1f45e..302e98d48 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts @@ -1,3 +1,4 @@ +import type { SymbolMeta } from '@hey-api/codegen-core'; import type ts from 'typescript'; import type { IR } from '~/ir/types'; @@ -16,13 +17,10 @@ export type IrSchemaToAstOptions = { state: ToRefs; }; -export type PluginState = { - hasLazyExpression: boolean; - /** - * Path to the schema in the intermediary representation. - */ - path: ReadonlyArray; -}; +export type PluginState = Pick, 'path'> & + Pick, 'tags'> & { + hasLazyExpression: boolean; + }; export type ValidatorArgs = { operation: IR.OperationObject; diff --git a/packages/openapi-ts/src/plugins/zod/shared/webhook.ts b/packages/openapi-ts/src/plugins/zod/shared/webhook.ts index 4fcaed40f..4c3c2b908 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/webhook.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/webhook.ts @@ -9,13 +9,12 @@ export const irWebhookToAst = ({ operation, plugin, state, -}: Omit & { +}: IrSchemaToAstOptions & { getAst: ( schema: IR.SchemaObject, path: ReadonlyArray, ) => Ast; operation: IR.OperationObject; - state: Partial; }) => { if (plugin.config.webhooks.enabled) { const requiredProperties = new Set(); @@ -115,12 +114,12 @@ export const irWebhookToAst = ({ schemaData.required = [...requiredProperties]; - const path = state.path?.value || []; - const ast = getAst(schemaData, path); + const ast = getAst(schemaData, state.path.value); const symbol = plugin.registerSymbol({ exported: true, meta: { - path, + path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.webhooks, @@ -133,7 +132,8 @@ export const irWebhookToAst = ({ exported: true, meta: { kind: 'type', - path, + path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.webhooks.types.infer, diff --git a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts index 0b94fdbad..1505b77d1 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts @@ -4,7 +4,7 @@ import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; +import { pathToJsonPointer, refToName } from '~/utils/ref'; import { identifiers } from '../constants'; import { exportAst } from '../shared/export'; @@ -200,20 +200,20 @@ export const irSchemaToAst = ({ }; const handleComponent = ({ - $ref, plugin, schema, state, }: IrSchemaToAstOptions & { - $ref: string; schema: IR.SchemaObject; }): void => { + const $ref = pathToJsonPointer(state.path.value); const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); const symbol = plugin.registerSymbol({ exported: true, meta: { path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions, @@ -227,6 +227,7 @@ const handleComponent = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -258,6 +259,11 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { 'schema', 'webhook', (event) => { + const state = toRefs({ + hasLazyExpression: false, + path: event._path, + tags: event.tags, + }); switch (event.type) { case 'operation': irOperationToAst({ @@ -265,47 +271,34 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { const state = toRefs({ hasLazyExpression: false, path, + tags: event.tags, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'parameter': handleComponent({ - $ref: event.$ref, plugin, schema: event.parameter.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'requestBody': handleComponent({ - $ref: event.$ref, plugin, schema: event.requestBody.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'schema': handleComponent({ - $ref: event.$ref, plugin, schema: event.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'webhook': @@ -314,14 +307,13 @@ export const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => { const state = toRefs({ hasLazyExpression: false, path, + tags: event.tags, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; } diff --git a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts index 71849299d..d56e6b37d 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts @@ -4,7 +4,7 @@ import { buildName } from '~/openApi/shared/utils/name'; import type { SchemaWithType } from '~/plugins'; import { toRef, toRefs } from '~/plugins/shared/utils/refs'; import { tsc } from '~/tsc'; -import { refToName } from '~/utils/ref'; +import { pathToJsonPointer, refToName } from '~/utils/ref'; import { identifiers } from '../constants'; import { exportAst } from '../shared/export'; @@ -228,20 +228,20 @@ export const irSchemaToAst = ({ }; const handleComponent = ({ - $ref, plugin, schema, state, }: IrSchemaToAstOptions & { - $ref: string; schema: IR.SchemaObject; }): void => { + const $ref = pathToJsonPointer(state.path.value); const ast = irSchemaToAst({ plugin, schema, state }); const baseName = refToName($ref); const symbol = plugin.registerSymbol({ exported: true, meta: { path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions, @@ -255,6 +255,7 @@ const handleComponent = ({ meta: { kind: 'type', path: state.path.value, + tags: state.tags?.value, }, name: buildName({ config: plugin.config.definitions.types.infer, @@ -286,6 +287,11 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { 'schema', 'webhook', (event) => { + const state = toRefs({ + hasLazyExpression: false, + path: event._path, + tags: event.tags, + }); switch (event.type) { case 'operation': irOperationToAst({ @@ -293,47 +299,34 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { const state = toRefs({ hasLazyExpression: false, path, + tags: event.tags, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; case 'parameter': handleComponent({ - $ref: event.$ref, plugin, schema: event.parameter.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'requestBody': handleComponent({ - $ref: event.$ref, plugin, schema: event.requestBody.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'schema': handleComponent({ - $ref: event.$ref, plugin, schema: event.schema, - state: toRefs({ - hasLazyExpression: false, - path: event._path, - }), + state, }); break; case 'webhook': @@ -342,14 +335,13 @@ export const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => { const state = toRefs({ hasLazyExpression: false, path, + tags: event.tags, }); return irSchemaToAst({ plugin, schema, state }); }, operation: event.operation, plugin, - state: toRefs({ - path: event._path, - }), + state, }); break; } -- 2.51.2 From a402010ce538d6b8f6e19a7ce0f92166ac616423 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:45:06 +0000 Subject: [PATCH 7/7] chore(deps): update dependency @arethetypeswrong/cli to v0.18.2 --- package.json | 2 +- pnpm-lock.yaml | 186 +++++++++++++++++++++++++++---------------------- 2 files changed, 103 insertions(+), 85 deletions(-) diff --git a/package.json b/package.json index be979c2a7..ada45878a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "node": ">=20.19.0" }, "devDependencies": { - "@arethetypeswrong/cli": "0.17.4", + "@arethetypeswrong/cli": "0.18.2", "@changesets/cli": "2.29.7", "@changesets/get-github-info": "0.6.0", "@changesets/parse": "0.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 78d7691e8..9b50ff0d1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,8 +14,8 @@ importers: .: devDependencies: '@arethetypeswrong/cli': - specifier: 0.17.4 - version: 0.17.4 + specifier: 0.18.2 + version: 0.18.2 '@changesets/cli': specifier: 2.29.7 version: 2.29.7(@types/node@22.10.5) @@ -90,7 +90,7 @@ importers: version: 6.1.1(rollup@4.31.0)(typescript@5.9.3) tsdown: specifier: 0.15.8 - version: 0.15.8(typescript@5.9.3) + version: 0.15.8(@arethetypeswrong/core@0.18.2)(typescript@5.9.3) turbo: specifier: 2.5.8 version: 2.5.8 @@ -1336,7 +1336,7 @@ importers: version: 11.0.3 nuxt: specifier: 3.14.1592 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) ofetch: specifier: 1.4.1 version: 1.4.1 @@ -2121,14 +2121,14 @@ packages: '@antfu/utils@0.7.10': resolution: {integrity: sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww==} - '@arethetypeswrong/cli@0.17.4': - resolution: {integrity: sha512-AeiKxtf67XD/NdOqXgBOE5TZWH3EOCt+0GkbUpekOzngc+Q/cRZ5azjWyMxISxxfp0EItgm5NoSld9p7BAA5xQ==} - engines: {node: '>=18'} + '@arethetypeswrong/cli@0.18.2': + resolution: {integrity: sha512-PcFM20JNlevEDKBg4Re29Rtv2xvjvQZzg7ENnrWFSS0PHgdP2njibVFw+dRUhNkPgNfac9iUqO0ohAXqQL4hbw==} + engines: {node: '>=20'} hasBin: true - '@arethetypeswrong/core@0.17.4': - resolution: {integrity: sha512-Izvir8iIoU+X4SKtDAa5kpb+9cpifclzsbA8x/AZY0k0gIfXYQ1fa1B6Epfe6vNA2YfDX8VtrZFgvnXB6aPEoQ==} - engines: {node: '>=18'} + '@arethetypeswrong/core@0.18.2': + resolution: {integrity: sha512-GiwTmBFOU1/+UVNqqCGzFJYfBXEytUkiI+iRZ6Qx7KmUVtLm00sYySkfe203C9QtPG11yOz1ZaMek8dT/xnlgg==} + engines: {node: '>=20'} '@ark/regex@0.0.0': resolution: {integrity: sha512-p4vsWnd/LRGOdGQglbwOguIVhPmCAf5UzquvnDoxqhhPWTP84wWgi1INea8MgJ4SnI2gp37f13oA4Waz9vwNYg==} @@ -14259,7 +14259,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) - '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0)) + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0)) '@angular-devkit/core': 19.2.0(chokidar@4.0.3) '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/platform-server@19.2.0(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@19.2.0(@angular/animations@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))))(@angular/ssr@19.2.15(5c03da8199d2fcdf9ff93b70f9349edd))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.6.1)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.14(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.8.3)))(terser@5.39.0)(typescript@5.8.3)(yaml@2.8.1) '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3) @@ -14310,8 +14310,8 @@ snapshots: tslib: 2.8.1 typescript: 5.8.3 webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-middleware: 7.4.2(webpack@5.98.0) - webpack-dev-server: 5.2.0(webpack@5.98.0) + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) optionalDependencies: @@ -14347,7 +14347,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) - '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0)) + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0)) '@angular-devkit/core': 19.2.0(chokidar@4.0.3) '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/platform-server@19.2.0(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@19.2.0(@angular/animations@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))))(@angular/ssr@19.2.15(5c03da8199d2fcdf9ff93b70f9349edd))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.6.1)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.14(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.8.3)))(terser@5.39.0)(typescript@5.8.3)(yaml@2.8.1) '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3) @@ -14398,8 +14398,8 @@ snapshots: tslib: 2.8.1 typescript: 5.8.3 webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-middleware: 7.4.2(webpack@5.98.0) - webpack-dev-server: 5.2.0(webpack@5.98.0) + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) + webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) optionalDependencies: @@ -14486,7 +14486,7 @@ snapshots: tslib: 2.8.1 typescript: 5.8.3 webpack: 5.98.0(esbuild@0.25.4) - webpack-dev-middleware: 7.4.2(webpack@5.98.0) + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) webpack-dev-server: 5.2.2(webpack@5.98.0) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) @@ -14574,7 +14574,7 @@ snapshots: tslib: 2.8.1 typescript: 5.9.3 webpack: 5.98.0(esbuild@0.25.4) - webpack-dev-middleware: 7.4.2(webpack@5.98.0) + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) webpack-dev-server: 5.2.2(webpack@5.98.0) webpack-merge: 6.0.1 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) @@ -14606,12 +14606,12 @@ snapshots: - webpack-cli - yaml - '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0))': + '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0))': dependencies: '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) rxjs: 7.8.1 webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-server: 5.2.0(webpack@5.98.0) + webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) transitivePeerDependencies: - chokidar @@ -15200,9 +15200,9 @@ snapshots: '@antfu/utils@0.7.10': {} - '@arethetypeswrong/cli@0.17.4': + '@arethetypeswrong/cli@0.18.2': dependencies: - '@arethetypeswrong/core': 0.17.4 + '@arethetypeswrong/core': 0.18.2 chalk: 4.1.2 cli-table3: 0.6.5 commander: 10.0.1 @@ -15210,13 +15210,13 @@ snapshots: marked-terminal: 7.3.0(marked@9.1.6) semver: 7.7.2 - '@arethetypeswrong/core@0.17.4': + '@arethetypeswrong/core@0.18.2': dependencies: '@andrewbranch/untar.js': 1.0.3 '@loaderkit/resolve': 1.0.4 cjs-module-lexer: 1.4.3 fflate: 0.8.2 - lru-cache: 10.4.3 + lru-cache: 11.2.2 semver: 7.7.2 typescript: 5.6.1-rc validate-npm-package-name: 5.0.1 @@ -18117,32 +18117,32 @@ snapshots: '@nuxt/devalue@2.0.2': {} - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))': + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 7.2.0 - vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) transitivePeerDependencies: - magicast - supports-color - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))': + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 7.2.0 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - magicast - supports-color - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))': + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 7.2.0 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) transitivePeerDependencies: - magicast - supports-color @@ -18207,13 +18207,13 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@antfu/utils': 0.7.10 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) '@nuxt/devtools-wizard': 1.7.0 '@nuxt/kit': 3.15.4(magicast@0.3.5) - '@vue/devtools-core': 7.6.8(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3)) + '@vue/devtools-core': 7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) '@vue/devtools-kit': 7.6.8 birpc: 0.2.19 consola: 3.4.2 @@ -18242,9 +18242,9 @@ snapshots: sirv: 3.0.1 tinyglobby: 0.2.14 unimport: 3.14.6(rollup@4.50.0) - vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) - vite-plugin-vue-inspector: 5.3.2(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) which: 3.0.1 ws: 8.18.3 transitivePeerDependencies: @@ -18254,13 +18254,13 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@antfu/utils': 0.7.10 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) '@nuxt/devtools-wizard': 1.7.0 '@nuxt/kit': 3.15.4(magicast@0.3.5) - '@vue/devtools-core': 7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) + '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) '@vue/devtools-kit': 7.6.8 birpc: 0.2.19 consola: 3.4.2 @@ -18289,9 +18289,9 @@ snapshots: sirv: 3.0.1 tinyglobby: 0.2.14 unimport: 3.14.6(rollup@4.50.0) - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) - vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) which: 3.0.1 ws: 8.18.3 transitivePeerDependencies: @@ -18301,13 +18301,13 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3))': dependencies: '@antfu/utils': 0.7.10 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) '@nuxt/devtools-wizard': 1.7.0 '@nuxt/kit': 3.15.4(magicast@0.3.5) - '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) + '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3)) '@vue/devtools-kit': 7.6.8 birpc: 0.2.19 consola: 3.4.2 @@ -18336,9 +18336,9 @@ snapshots: sirv: 3.0.1 tinyglobby: 0.2.14 unimport: 3.14.6(rollup@4.50.0) - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) - vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) which: 3.0.1 ws: 8.18.3 transitivePeerDependencies: @@ -21086,38 +21086,38 @@ snapshots: dependencies: '@vue/devtools-kit': 8.0.2 - '@vue/devtools-core@7.6.8(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3))': + '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 1.1.2 - vite-hot-client: 0.2.4(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) + vite-hot-client: 0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) vue: 3.5.13(typescript@5.9.3) transitivePeerDependencies: - vite - '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 1.1.2 - vite-hot-client: 0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) + vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) vue: 3.5.13(typescript@5.9.3) transitivePeerDependencies: - vite - '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': + '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 1.1.2 - vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) + vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) vue: 3.5.13(typescript@5.9.3) transitivePeerDependencies: - vite @@ -23182,7 +23182,7 @@ snapshots: '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3) eslint: 9.17.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@2.6.1)) eslint-plugin-react: 7.37.5(eslint@9.17.0(jiti@2.6.1)) @@ -23210,7 +23210,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.1 @@ -23225,14 +23225,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3) eslint: 9.17.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) transitivePeerDependencies: - supports-color @@ -23247,7 +23247,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.17.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -26247,10 +26247,10 @@ snapshots: - vue-tsc - xml2js - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3)) + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/telemetry': 2.6.6(magicast@0.3.5) @@ -26368,10 +26368,10 @@ snapshots: - vue-tsc - xml2js - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.44)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3)) '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/telemetry': 2.6.6(magicast@0.3.5) @@ -28850,7 +28850,7 @@ snapshots: minimist: 1.2.8 strip-bom: 3.0.0 - tsdown@0.15.8(typescript@5.9.3): + tsdown@0.15.8(@arethetypeswrong/core@0.18.2)(typescript@5.9.3): dependencies: ansis: 4.2.0 cac: 6.7.14 @@ -28867,6 +28867,7 @@ snapshots: tree-kill: 1.2.2 unconfig: 7.3.3 optionalDependencies: + '@arethetypeswrong/core': 0.18.2 typescript: 5.9.3 transitivePeerDependencies: - '@ts-macro/tsc' @@ -29470,10 +29471,6 @@ snapshots: vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) vite-hot-client: 2.1.0(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) - vite-hot-client@0.2.4(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): - dependencies: - vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) - vite-hot-client@0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) @@ -29482,6 +29479,10 @@ snapshots: dependencies: vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite-hot-client@0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + dependencies: + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) + vite-hot-client@2.1.0(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) @@ -29626,7 +29627,7 @@ snapshots: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) @@ -29637,14 +29638,14 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) optionalDependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) transitivePeerDependencies: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) @@ -29655,14 +29656,14 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) optionalDependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) transitivePeerDependencies: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) @@ -29673,7 +29674,7 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) optionalDependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) transitivePeerDependencies: @@ -29710,7 +29711,7 @@ snapshots: - supports-color - vue - vite-plugin-vue-inspector@5.3.2(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): + vite-plugin-vue-inspector@5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): dependencies: '@babel/core': 7.28.3 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) @@ -29721,11 +29722,11 @@ snapshots: '@vue/compiler-dom': 3.5.21 kolorist: 1.8.0 magic-string: 0.30.18 - vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) transitivePeerDependencies: - supports-color - vite-plugin-vue-inspector@5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): + vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): dependencies: '@babel/core': 7.28.3 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) @@ -29736,11 +29737,11 @@ snapshots: '@vue/compiler-dom': 3.5.21 kolorist: 1.8.0 magic-string: 0.30.18 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - supports-color - vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): + vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): dependencies: '@babel/core': 7.28.3 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) @@ -29751,7 +29752,7 @@ snapshots: '@vue/compiler-dom': 3.5.21 kolorist: 1.8.0 magic-string: 0.30.18 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) transitivePeerDependencies: - supports-color @@ -29875,6 +29876,23 @@ snapshots: terser: 5.39.0 yaml: 2.8.1 + vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0): + dependencies: + esbuild: 0.25.9 + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + postcss: 8.5.6 + rollup: 4.50.0 + tinyglobby: 0.2.15 + optionalDependencies: + '@types/node': 22.10.5 + fsevents: 2.3.3 + jiti: 2.6.1 + less: 4.2.2 + sass: 1.85.0 + terser: 5.43.1 + yaml: 2.8.0 + vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1): dependencies: esbuild: 0.25.9 @@ -30210,7 +30228,7 @@ snapshots: webidl-conversions@7.0.0: {} - webpack-dev-middleware@7.4.2(webpack@5.98.0): + webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.0)): dependencies: colorette: 2.0.20 memfs: 4.38.2 @@ -30221,7 +30239,7 @@ snapshots: optionalDependencies: webpack: 5.98.0(esbuild@0.25.0) - webpack-dev-server@5.2.0(webpack@5.98.0): + webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -30248,7 +30266,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.98.0) + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) ws: 8.18.3 optionalDependencies: webpack: 5.98.0(esbuild@0.25.0) @@ -30286,7 +30304,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.98.0) + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) ws: 8.18.3 optionalDependencies: webpack: 5.98.0(esbuild@0.25.0) -- 2.51.2