fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2180 from hey-api/refactor/plugin-config

refactor: namespace plugin configs

authored by

Lubos and committed by
GitHub
2bae35a6 bfa12990

+1001 -655
+3 -1
docs/openapi-ts/plugins/custom.md
··· 73 73 _dependencies: ['@hey-api/typescript'], 74 74 _handler: handler, 75 75 _handlerLegacy: () => {}, 76 - myOption: false, // implements default value from types 76 + config: { 77 + myOption: false, // implements default value from types 78 + }, 77 79 name: 'my-plugin', 78 80 output: 'my-plugin', 79 81 };
+8 -6
packages/custom-client/src/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 20 _handlerLegacy: () => {}, 19 - bundle: false, 21 + config: { 22 + ...clientDefaultConfig, 23 + bundle: false, 24 + }, 20 25 name: '@hey-api/custom-client', 21 26 }; 22 27 23 28 /** 24 29 * Type helper for `@hey-api/custom-client` plugin, returns {@link Plugin.Config} object 25 30 */ 26 - export const customClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 27 - ...defaultConfig, 28 - ...config, 29 - }); 31 + export const customClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-false/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-number/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-string/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/bundle/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/default/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+5 -6
packages/openapi-ts-tests/test/custom/client/plugin.ts
··· 1 1 import { 2 2 type Client, 3 3 clientDefaultConfig, 4 + clientDefaultMeta, 4 5 clientPluginHandler, 6 + definePluginConfig, 5 7 type Plugin, 6 8 } from '@hey-api/openapi-ts'; 7 9 ··· 13 15 } 14 16 15 17 export const defaultConfig: Plugin.Config<Config> = { 16 - ...clientDefaultConfig, 18 + ...clientDefaultMeta, 17 19 _handler: clientPluginHandler, 18 - _handlerLegacy: () => {}, 20 + config: clientDefaultConfig, 19 21 name: __filename, 20 22 }; 21 23 22 24 /** 23 25 * Type helper for `my-client` plugin, returns {@link Plugin.Config} object 24 26 */ 25 - export const myClientPlugin: Plugin.DefineConfig<Config> = (config) => ({ 26 - ...defaultConfig, 27 - ...config, 28 - }); 27 + export const myClientPlugin = definePluginConfig(defaultConfig);
+20 -16
packages/openapi-ts-tests/test/openapi-ts.config.ts
··· 57 57 // 'invalid', 58 58 // 'servers-entry.yaml', 59 59 // ), 60 - path: path.resolve(__dirname, 'spec', '3.1.x', 'full.yaml'), 60 + // path: path.resolve(__dirname, 'spec', '3.1.x', 'full.yaml'), 61 + path: path.resolve(__dirname, 'spec', 'v3-transforms.json'), 61 62 // path: 'http://localhost:4000/', 62 63 // path: 'https://get.heyapi.dev/', 63 64 // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', ··· 86 87 // indexFile: false, 87 88 // lint: 'eslint', 88 89 path: path.resolve(__dirname, 'generated', 'sample'), 89 - tsConfigPath: path.resolve( 90 - __dirname, 91 - 'tsconfig', 92 - 'tsconfig.nodenext.json', 93 - ), 90 + // tsConfigPath: path.resolve( 91 + // __dirname, 92 + // 'tsconfig', 93 + // 'tsconfig.nodenext.json', 94 + // ), 94 95 }, 95 96 plugins: [ 96 - // customClientPlugin(), 97 + // customClientPlugin({ 98 + // baseUrl: false, 99 + // }), 97 100 // myClientPlugin(), 98 101 { 99 102 // baseUrl: false, 100 103 // exportFromIndex: true, 101 - // name: '@hey-api/client-nuxt', 102 - // name: 'legacy/fetch', 104 + // name: '@hey-api/client-fetch', 105 + name: 'legacy/angular', 103 106 // strictBaseUrl: true, 107 + // throwOnError: true, 104 108 }, 105 109 { 106 110 exportFromIndex: true, ··· 108 112 // type: 'json', 109 113 }, 110 114 { 111 - asClass: true, 115 + // asClass: true, 112 116 // auth: false, 113 117 // classNameBuilder: '{{name}}', 114 118 // classStructure: 'off', 115 119 // client: false, 116 120 // include... 117 - instance: true, 121 + // instance: true, 118 122 name: '@hey-api/sdk', 119 123 // operationId: false, 120 124 // responseStyle: 'data', 121 125 // throwOnError: true, 122 126 // transformer: '@hey-api/transformers', 123 - // transformer: true, 127 + transformer: true, 124 128 // validator: 'zod', 125 129 }, 126 130 { 127 131 // bigInt: true, 128 132 dates: true, 129 - // name: '@hey-api/transformers', 133 + name: '@hey-api/transformers', 130 134 }, 131 135 { 132 136 enums: 'typescript+namespace', ··· 134 138 // enumsConstantsIgnoreNull: true, 135 139 // exportInlineEnums: true, 136 140 // identifierCase: 'snake_case', 137 - name: '@hey-api/typescript', 141 + // name: '@hey-api/typescript', 138 142 // readOnlyWriteOnlyBehavior: 'off', 139 143 // readableNameBuilder: 'Readable{{name}}', 140 144 // writableNameBuilder: 'Writable{{name}}', ··· 155 159 { 156 160 // comments: false, 157 161 // exportFromIndex: true, 158 - name: 'valibot', 162 + // name: 'valibot', 159 163 }, 160 164 { 161 165 // comments: false, 162 166 // exportFromIndex: true, 163 167 // metadata: true, 164 - name: 'zod', 168 + // name: 'zod', 165 169 }, 166 170 ], 167 171 // useOptions: false,
+4 -27
packages/openapi-ts-tests/test/plugins.test.ts
··· 476 476 _dependencies: ['@hey-api/typescript'], 477 477 _handler: vi.fn(), 478 478 _handlerLegacy: vi.fn(), 479 - customOption: true, 479 + config: { 480 + customOption: true, 481 + }, 480 482 name: 'my-plugin', 481 483 output: 'my-plugin', 482 484 }; ··· 502 504 _dependencies: ['@hey-api/oops'], 503 505 _handler: vi.fn(), 504 506 _handlerLegacy: vi.fn(), 507 + config: {}, 505 508 name: 'my-plugin', 506 509 output: 'my-plugin', 507 510 }; ··· 516 519 plugins: [myPlugin, '@hey-api/client-fetch'], 517 520 }), 518 521 ).rejects.toThrowError(/unknown plugin/g); 519 - 520 - expect(myPlugin._handler).not.toHaveBeenCalled(); 521 - expect(myPlugin._handlerLegacy).not.toHaveBeenCalled(); 522 - }); 523 - 524 - it('throws on native plugin override', async () => { 525 - const myPlugin: Plugin.Config<{ 526 - name: any; 527 - output: string; 528 - }> = { 529 - _handler: vi.fn(), 530 - _handlerLegacy: vi.fn(), 531 - name: '@hey-api/typescript', 532 - output: 'my-plugin', 533 - }; 534 - 535 - await expect(() => 536 - createClient({ 537 - input: path.join(__dirname, 'spec', '3.1.x', 'full.yaml'), 538 - logs: { 539 - level: 'silent', 540 - }, 541 - output: path.join(outputDir, myPlugin.name, 'default'), 542 - plugins: [myPlugin, '@hey-api/client-fetch'], 543 - }), 544 - ).rejects.toThrowError(/cannot register plugin/g); 545 522 546 523 expect(myPlugin._handler).not.toHaveBeenCalled(); 547 524 expect(myPlugin._handlerLegacy).not.toHaveBeenCalled();
+6 -1
packages/openapi-ts/src/generate/__tests__/class.test.ts
··· 44 44 '@hey-api/schemas': { 45 45 _handler: () => {}, 46 46 _handlerLegacy: () => {}, 47 + config: {}, 47 48 name: '@hey-api/schemas', 48 49 }, 49 50 '@hey-api/sdk': { 50 51 _handler: () => {}, 51 52 _handlerLegacy: () => {}, 53 + config: {}, 52 54 name: '@hey-api/sdk', 53 55 }, 54 56 '@hey-api/typescript': { 55 57 _handler: () => {}, 56 58 _handlerLegacy: () => {}, 57 - enums: 'javascript', 59 + config: { 60 + enums: 'javascript', 61 + }, 58 62 name: '@hey-api/typescript', 59 63 }, 60 64 'legacy/fetch': { 61 65 _handler: () => {}, 62 66 _handlerLegacy: () => {}, 63 67 _tags: ['client'], 68 + config: {}, 64 69 name: 'legacy/fetch', 65 70 }, 66 71 },
+18 -3
packages/openapi-ts/src/generate/__tests__/core.test.ts
··· 59 59 '@hey-api/schemas': { 60 60 _handler: () => {}, 61 61 _handlerLegacy: () => {}, 62 + config: {}, 62 63 name: '@hey-api/schemas', 63 64 }, 64 65 '@hey-api/sdk': { 65 66 _handler: () => {}, 66 67 _handlerLegacy: () => {}, 68 + config: {}, 67 69 name: '@hey-api/sdk', 68 70 }, 69 71 '@hey-api/typescript': { 70 72 _handler: () => {}, 71 73 _handlerLegacy: () => {}, 72 - enums: 'javascript', 74 + config: { 75 + enums: 'javascript', 76 + }, 73 77 name: '@hey-api/typescript', 74 78 }, 75 79 'legacy/fetch': { 76 80 _handler: () => {}, 77 81 _handlerLegacy: () => {}, 78 82 _tags: ['client'], 83 + config: {}, 79 84 name: 'legacy/fetch', 80 85 }, 81 86 }, ··· 153 158 '@hey-api/schemas': { 154 159 _handler: () => {}, 155 160 _handlerLegacy: () => {}, 161 + config: {}, 156 162 name: '@hey-api/schemas', 157 163 }, 158 164 '@hey-api/sdk': { 159 165 _handler: () => {}, 160 166 _handlerLegacy: () => {}, 167 + config: {}, 161 168 name: '@hey-api/sdk', 162 169 }, 163 170 '@hey-api/typescript': { 164 171 _handler: () => {}, 165 172 _handlerLegacy: () => {}, 166 - enums: 'javascript', 173 + config: { 174 + enums: 'javascript', 175 + }, 167 176 name: '@hey-api/typescript', 168 177 }, 169 178 'legacy/fetch': { 170 179 _handler: () => {}, 171 180 _handlerLegacy: () => {}, 172 181 _tags: ['client'], 182 + config: {}, 173 183 name: 'legacy/fetch', 174 184 }, 175 185 }, ··· 230 240 '@hey-api/schemas': { 231 241 _handler: () => {}, 232 242 _handlerLegacy: () => {}, 243 + config: {}, 233 244 name: '@hey-api/schemas', 234 245 }, 235 246 '@hey-api/sdk': { 236 247 _handler: () => {}, 237 248 _handlerLegacy: () => {}, 249 + config: {}, 238 250 name: '@hey-api/sdk', 239 251 }, 240 252 '@hey-api/typescript': { 241 253 _handler: () => {}, 242 254 _handlerLegacy: () => {}, 243 - enums: 'javascript', 255 + config: { 256 + enums: 'javascript', 257 + }, 244 258 name: '@hey-api/typescript', 245 259 }, 246 260 'legacy/fetch': { 247 261 _handler: () => {}, 248 262 _handlerLegacy: () => {}, 249 263 _tags: ['client'], 264 + config: {}, 250 265 name: 'legacy/fetch', 251 266 }, 252 267 },
+1 -1
packages/openapi-ts/src/generate/client.ts
··· 36 36 }): string => { 37 37 const client = getClientPlugin(config); 38 38 39 - if ('bundle' in client && client.bundle) { 39 + if ('bundle' in client.config && client.config.bundle) { 40 40 return relativeModulePath({ 41 41 moduleOutput: 'client', 42 42 sourceOutput,
+6 -1
packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts
··· 43 43 '@hey-api/schemas': { 44 44 _handler: () => {}, 45 45 _handlerLegacy: () => {}, 46 + config: {}, 46 47 name: '@hey-api/schemas', 47 48 }, 48 49 '@hey-api/sdk': { 49 50 _handler: () => {}, 50 51 _handlerLegacy: () => {}, 52 + config: {}, 51 53 name: '@hey-api/sdk', 52 54 }, 53 55 '@hey-api/typescript': { 54 56 _handler: () => {}, 55 57 _handlerLegacy: () => {}, 56 - enums: 'javascript', 58 + config: { 59 + enums: 'javascript', 60 + }, 57 61 name: '@hey-api/typescript', 58 62 }, 59 63 'legacy/fetch': { 60 64 _handler: () => {}, 61 65 _handlerLegacy: () => {}, 62 66 _tags: ['client'], 67 + config: {}, 63 68 name: 'legacy/fetch', 64 69 }, 65 70 },
+6 -1
packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts
··· 57 57 '@hey-api/schemas': { 58 58 _handler: () => {}, 59 59 _handlerLegacy: () => {}, 60 + config: {}, 60 61 name: '@hey-api/schemas', 61 62 }, 62 63 '@hey-api/sdk': { 63 64 _handler: () => {}, 64 65 _handlerLegacy: () => {}, 66 + config: {}, 65 67 name: '@hey-api/sdk', 66 68 }, 67 69 '@hey-api/typescript': { 68 70 _handler: () => {}, 69 71 _handlerLegacy: () => {}, 70 - enums: 'javascript', 72 + config: { 73 + enums: 'javascript', 74 + }, 71 75 name: '@hey-api/typescript', 72 76 }, 73 77 'legacy/fetch': { 74 78 _handler: () => {}, 75 79 _handlerLegacy: () => {}, 76 80 _tags: ['client'], 81 + config: {}, 77 82 name: 'legacy/fetch', 78 83 }, 79 84 },
+1 -1
packages/openapi-ts/src/generate/legacy/indexFile.ts
··· 29 29 module: './core/ApiError', 30 30 }), 31 31 ); 32 - if (config.plugins['@hey-api/sdk']?.response === 'response') { 32 + if (config.plugins['@hey-api/sdk']?.config.response === 'response') { 33 33 files.index.add( 34 34 compiler.exportNamedDeclaration({ 35 35 exports: { asType: true, name: 'ApiResult' },
+9 -7
packages/openapi-ts/src/generate/legacy/output.ts
··· 36 36 // TODO: parser - move to config.input 37 37 if (client) { 38 38 if ( 39 - config.plugins['@hey-api/sdk']?.include && 40 - config.plugins['@hey-api/sdk'].asClass 39 + config.plugins['@hey-api/sdk']?.config.include && 40 + config.plugins['@hey-api/sdk'].config.asClass 41 41 ) { 42 - const regexp = new RegExp(config.plugins['@hey-api/sdk'].include); 42 + const regexp = new RegExp(config.plugins['@hey-api/sdk'].config.include); 43 43 client.services = client.services.filter((service) => 44 44 regexp.test(service.name), 45 45 ); 46 46 } 47 47 48 - if (config.plugins['@hey-api/typescript']?.include) { 49 - const regexp = new RegExp(config.plugins['@hey-api/typescript'].include); 48 + if (config.plugins['@hey-api/typescript']?.config.include) { 49 + const regexp = new RegExp( 50 + config.plugins['@hey-api/typescript'].config.include, 51 + ); 50 52 client.models = client.models.filter((model) => regexp.test(model.name)); 51 53 } 52 54 } ··· 62 64 const clientPlugin = getClientPlugin(config); 63 65 if ( 64 66 !isLegacyClient(config) && 65 - 'bundle' in clientPlugin && 66 - clientPlugin.bundle 67 + 'bundle' in clientPlugin.config && 68 + clientPlugin.config.bundle 67 69 ) { 68 70 generateClientBundle({ 69 71 outputPath,
+1 -1
packages/openapi-ts/src/generate/output.ts
··· 25 25 tsConfig?.options.moduleResolution === ts.ModuleResolutionKind.NodeNext; 26 26 27 27 const client = getClientPlugin(context.config); 28 - if ('bundle' in client && client.bundle) { 28 + if ('bundle' in client.config && client.config.bundle) { 29 29 generateClientBundle({ 30 30 outputPath, 31 31 plugin: client,
+5 -1
packages/openapi-ts/src/index.ts
··· 109 109 export { defaultPaginationKeywords } from './ir/pagination'; 110 110 export type { IR } from './ir/types'; 111 111 export type { OpenApi, OpenApiSchemaObject } from './openApi/types'; 112 - export { clientDefaultConfig } from './plugins/@hey-api/client-core/config'; 112 + export { 113 + clientDefaultConfig, 114 + clientDefaultMeta, 115 + } from './plugins/@hey-api/client-core/config'; 113 116 export { clientPluginHandler } from './plugins/@hey-api/client-core/plugin'; 114 117 export type { Client } from './plugins/@hey-api/client-core/types'; 118 + export { definePluginConfig } from './plugins/shared/utils/config'; 115 119 export type { Plugin } from './plugins/types'; 116 120 export type { UserConfig } from './types/config'; 117 121 export type { LegacyIR } from './types/types';
+86 -87
packages/openapi-ts/src/initConfigs.ts
··· 3 3 import { loadConfig } from 'c12'; 4 4 5 5 import { getLogs } from './getLogs'; 6 - import type { ClientPlugins, UserPlugins } from './plugins'; 6 + import type { UserPlugins } from './plugins'; 7 7 import { defaultPluginConfigs } from './plugins'; 8 8 import type { 9 9 AnyPluginName, 10 - DefaultPluginConfigs, 11 10 PluginContext, 12 11 PluginNames, 13 12 } from './plugins/types'; ··· 80 79 }; 81 80 82 81 const getPluginsConfig = ({ 83 - pluginConfigs, 84 82 userPlugins, 85 83 userPluginsConfig, 86 84 }: { 87 - pluginConfigs: DefaultPluginConfigs<ClientPlugins>; 88 85 userPlugins: ReadonlyArray<AnyPluginName>; 89 86 userPluginsConfig: Config['plugins']; 90 87 }): Pick<Config, 'plugins' | 'pluginOrder'> => { ··· 97 94 throw new Error(`Circular reference detected at '${name}'`); 98 95 } 99 96 100 - if (!pluginOrder.has(name)) { 101 - circularReferenceTracker.add(name); 97 + if (pluginOrder.has(name)) { 98 + return; 99 + } 102 100 103 - const pluginConfig = pluginConfigs[name as PluginNames]; 104 - if (!pluginConfig) { 105 - throw new Error( 106 - `unknown plugin dependency "${name}" - do you need to register a custom plugin with this name?`, 107 - ); 108 - } 101 + circularReferenceTracker.add(name); 109 102 110 - const defaultOptions = defaultPluginConfigs[name as PluginNames]; 111 - const userOptions = userPluginsConfig[name as PluginNames]; 112 - if (userOptions && defaultOptions) { 113 - const nativePluginOption = Object.keys(userOptions).find((key) => 114 - key.startsWith('_'), 115 - ); 116 - if (nativePluginOption) { 117 - throw new Error( 118 - `cannot register plugin "${name}" - attempting to override a native plugin option "${nativePluginOption}"`, 119 - ); 120 - } 121 - } 103 + const defaultPlugin = defaultPluginConfigs[name as PluginNames]; 104 + const userPlugin = userPluginsConfig[name as PluginNames]; 122 105 123 - const config = { 124 - _dependencies: [], 125 - ...defaultOptions, 126 - ...userOptions, 127 - }; 106 + if (!defaultPlugin && !userPlugin) { 107 + throw new Error( 108 + `unknown plugin dependency "${name}" - do you need to register a custom plugin with this name?`, 109 + ); 110 + } 128 111 129 - if (config._infer) { 130 - const context: PluginContext = { 131 - ensureDependency: (dependency) => { 112 + const plugin = { 113 + _dependencies: [], 114 + ...defaultPlugin, 115 + ...userPlugin, 116 + config: { 117 + ...defaultPlugin?.config, 118 + ...userPlugin?.config, 119 + }, 120 + }; 121 + 122 + if (plugin._infer) { 123 + const context: PluginContext = { 124 + ensureDependency: (dependency) => { 125 + if ( 126 + typeof dependency === 'string' && 127 + !plugin._dependencies.includes(dependency) 128 + ) { 129 + plugin._dependencies = [...plugin._dependencies, dependency]; 130 + } 131 + }, 132 + pluginByTag: ({ defaultPlugin, errorMessage, tag }) => { 133 + for (const userPlugin of userPlugins) { 134 + const defaultConfig = 135 + defaultPluginConfigs[userPlugin as PluginNames] || 136 + userPluginsConfig[userPlugin as PluginNames]; 132 137 if ( 133 - typeof dependency === 'string' && 134 - !config._dependencies.includes(dependency) 138 + defaultConfig && 139 + defaultConfig._tags?.includes(tag) && 140 + userPlugin !== name 135 141 ) { 136 - config._dependencies = [...config._dependencies, dependency]; 142 + return userPlugin; 137 143 } 138 - }, 139 - pluginByTag: ({ defaultPlugin, errorMessage, tag }) => { 140 - for (const userPlugin of userPlugins) { 141 - const defaultConfig = 142 - defaultPluginConfigs[userPlugin as PluginNames] || 143 - pluginConfigs[userPlugin as PluginNames]; 144 - if ( 145 - defaultConfig && 146 - defaultConfig._tags?.includes(tag) && 147 - userPlugin !== name 148 - ) { 149 - return userPlugin; 150 - } 151 - } 144 + } 152 145 153 - if (defaultPlugin) { 154 - const defaultConfig = 155 - defaultPluginConfigs[defaultPlugin as PluginNames] || 156 - pluginConfigs[defaultPlugin as PluginNames]; 157 - if ( 158 - defaultConfig && 159 - defaultConfig._tags?.includes(tag) && 160 - defaultPlugin !== name 161 - ) { 162 - return defaultPlugin; 163 - } 146 + if (defaultPlugin) { 147 + const defaultConfig = 148 + defaultPluginConfigs[defaultPlugin as PluginNames] || 149 + userPluginsConfig[defaultPlugin as PluginNames]; 150 + if ( 151 + defaultConfig && 152 + defaultConfig._tags?.includes(tag) && 153 + defaultPlugin !== name 154 + ) { 155 + return defaultPlugin; 164 156 } 157 + } 165 158 166 - throw new Error( 167 - errorMessage || 168 - `missing plugin - no plugin with tag "${tag}" found`, 169 - ); 170 - }, 171 - }; 172 - config._infer(config, context); 173 - } 159 + throw new Error( 160 + errorMessage || 161 + `missing plugin - no plugin with tag "${tag}" found`, 162 + ); 163 + }, 164 + }; 165 + // @ts-expect-error 166 + plugin._infer(plugin, context); 167 + } 174 168 175 - for (const dependency of config._dependencies) { 176 - dfs(dependency); 177 - } 169 + for (const dependency of plugin._dependencies) { 170 + dfs(dependency); 171 + } 178 172 179 - circularReferenceTracker.delete(name); 180 - pluginOrder.add(name); 173 + circularReferenceTracker.delete(name); 174 + pluginOrder.add(name); 181 175 182 - // @ts-expect-error 183 - plugins[name] = config; 184 - } 176 + // @ts-expect-error 177 + plugins[name] = plugin; 185 178 }; 186 179 187 180 for (const name of userPlugins) { ··· 233 226 const userPluginsConfig: Config['plugins'] = {}; 234 227 235 228 let definedPlugins: UserConfig['plugins'] = defaultPlugins; 229 + 236 230 if (userConfig.plugins) { 237 231 userConfig.plugins = userConfig.plugins.filter( 238 232 (plugin) => ··· 255 249 return plugin; 256 250 } 257 251 258 - if (plugin.name) { 252 + const pluginName = plugin.name; 253 + 254 + if (pluginName) { 259 255 // @ts-expect-error 260 - userPluginsConfig[plugin.name] = plugin; 256 + if (plugin._handler) { 257 + // @ts-expect-error 258 + userPluginsConfig[pluginName] = plugin; 259 + } else { 260 + // @ts-expect-error 261 + userPluginsConfig[pluginName] = { 262 + config: { ...plugin }, 263 + }; 264 + // @ts-expect-error 265 + delete userPluginsConfig[pluginName]!.config.name; 266 + } 261 267 } 262 268 263 - return plugin.name; 269 + return pluginName; 264 270 }) 265 271 .filter(Boolean); 266 272 267 - return getPluginsConfig({ 268 - pluginConfigs: { 269 - ...userPluginsConfig, 270 - ...defaultPluginConfigs, 271 - }, 272 - userPlugins, 273 - userPluginsConfig, 274 - }); 273 + return getPluginsConfig({ userPlugins, userPluginsConfig }); 275 274 }; 276 275 277 276 const getWatch = (
+1
packages/openapi-ts/src/openApi/common/parser/__tests__/type.test.ts
··· 9 9 '@hey-api/typescript': { 10 10 _handler: () => {}, 11 11 _handlerLegacy: () => {}, 12 + config: {}, 12 13 name: '@hey-api/typescript', 13 14 }, 14 15 },
+3 -3
packages/openapi-ts/src/openApi/common/parser/operation.ts
··· 157 157 config: Config; 158 158 operationKey: string; 159 159 }): boolean => { 160 - const regexp = config.plugins['@hey-api/sdk']?.filter 161 - ? new RegExp(config.plugins['@hey-api/sdk']?.filter) 160 + const regexp = config.plugins['@hey-api/sdk']?.config.filter 161 + ? new RegExp(config.plugins['@hey-api/sdk']?.config.filter) 162 162 : undefined; 163 163 return !regexp || regexp.test(operationKey); 164 164 }; ··· 179 179 operationId: string | undefined; 180 180 path: string; 181 181 }): string => { 182 - if (config.plugins['@hey-api/sdk']?.operationId && operationId) { 182 + if (config.plugins['@hey-api/sdk']?.config.operationId && operationId) { 183 183 return stringCase({ 184 184 case: 'camelCase', 185 185 value: sanitizeNamespaceIdentifier(operationId),
+3 -1
packages/openapi-ts/src/openApi/shared/utils/__tests__/operation.test.ts
··· 41 41 plugins: { 42 42 // @ts-expect-error 43 43 '@hey-api/sdk': { 44 - operationId: true, 44 + config: { 45 + operationId: true, 46 + }, 45 47 }, 46 48 }, 47 49 },
+1 -1
packages/openapi-ts/src/openApi/shared/utils/operation.ts
··· 40 40 if ( 41 41 id && 42 42 (!context.config.plugins['@hey-api/sdk'] || 43 - context.config.plugins['@hey-api/sdk'].operationId) 43 + context.config.plugins['@hey-api/sdk'].config.operationId) 44 44 ) { 45 45 result = stringCase({ 46 46 case: 'camelCase',
+1
packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.test.ts
··· 11 11 '@hey-api/typescript': { 12 12 _handler: () => {}, 13 13 _handlerLegacy: () => {}, 14 + config: {}, 14 15 name: '@hey-api/typescript', 15 16 }, 16 17 },
+8 -8
packages/openapi-ts/src/plugins/@hey-api/client-axios/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 - import { clientDefaultConfig } from '../client-core/config'; 3 + import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; 3 4 import { clientPluginHandler } from '../client-core/plugin'; 4 5 import type { Config } from './types'; 5 6 6 7 export const defaultConfig: Plugin.Config<Config> = { 7 - ...clientDefaultConfig, 8 + ...clientDefaultMeta, 8 9 _handler: clientPluginHandler, 9 - _handlerLegacy: () => {}, 10 + config: { 11 + ...clientDefaultConfig, 12 + throwOnError: false, 13 + }, 10 14 name: '@hey-api/client-axios', 11 - throwOnError: false, 12 15 }; 13 16 14 17 /** 15 18 * Type helper for `@hey-api/client-axios` plugin, returns {@link Plugin.Config} object 16 19 */ 17 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 18 - ...defaultConfig, 19 - ...config, 20 - }); 20 + export const defineConfig = definePluginConfig(defaultConfig);
+4 -4
packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts
··· 9 9 context, 10 10 plugin, 11 11 }) => { 12 - const { baseUrl } = plugin; 12 + const { baseUrl } = plugin.config; 13 13 14 14 if (baseUrl === false) { 15 15 return; ··· 49 49 name: 'ClientOptions', 50 50 }); 51 51 52 - const createClientConfig = plugin.runtimeConfigPath 52 + const createClientConfig = plugin.config.runtimeConfigPath 53 53 ? file.import({ 54 54 module: file.relativePathToFile({ 55 55 context, 56 - id: plugin.runtimeConfigPath, 56 + id: plugin.config.runtimeConfigPath, 57 57 }), 58 58 name: 'createClientConfig', 59 59 }) ··· 80 80 } 81 81 } 82 82 83 - if ('throwOnError' in plugin && plugin.throwOnError) { 83 + if ('throwOnError' in plugin.config && plugin.config.throwOnError) { 84 84 defaultValues.push({ 85 85 key: 'throwOnError', 86 86 value: true,
+6 -2
packages/openapi-ts/src/plugins/@hey-api/client-core/config.ts
··· 1 1 export const clientDefaultConfig = { 2 - _dependencies: ['@hey-api/typescript'], 3 - _tags: ['client'], 4 2 baseUrl: true, 5 3 bundle: true, 6 4 exportFromIndex: false, 5 + } as const; 6 + 7 + export const clientDefaultMeta = { 8 + _dependencies: ['@hey-api/typescript'], 9 + _handlerLegacy: () => {}, 10 + _tags: ['client'], 7 11 output: 'client', 8 12 } as const;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-core/plugin.ts
··· 5 5 6 6 export const clientPluginHandler: PluginHandler = ({ context, plugin }) => { 7 7 context.createFile({ 8 - exportFromIndex: plugin.exportFromIndex, 8 + exportFromIndex: plugin.config.exportFromIndex, 9 9 id: clientId, 10 10 path: plugin.output, 11 11 });
+1
packages/openapi-ts/src/plugins/@hey-api/client-core/utils.ts
··· 27 27 } 28 28 29 29 return { 30 + config: {}, 30 31 // @ts-expect-error 31 32 name: '', 32 33 };
+8 -8
packages/openapi-ts/src/plugins/@hey-api/client-fetch/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 - import { clientDefaultConfig } from '../client-core/config'; 3 + import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; 3 4 import { clientPluginHandler } from '../client-core/plugin'; 4 5 import type { Config } from './types'; 5 6 6 7 export const defaultConfig: Plugin.Config<Config> = { 7 - ...clientDefaultConfig, 8 + ...clientDefaultMeta, 8 9 _handler: clientPluginHandler, 9 - _handlerLegacy: () => {}, 10 + config: { 11 + ...clientDefaultConfig, 12 + throwOnError: false, 13 + }, 10 14 name: '@hey-api/client-fetch', 11 - throwOnError: false, 12 15 }; 13 16 14 17 /** 15 18 * Type helper for `@hey-api/client-fetch` plugin, returns {@link Plugin.Config} object 16 19 */ 17 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 18 - ...defaultConfig, 19 - ...config, 20 - }); 20 + export const defineConfig = definePluginConfig(defaultConfig);
+8 -8
packages/openapi-ts/src/plugins/@hey-api/client-next/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 - import { clientDefaultConfig } from '../client-core/config'; 3 + import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; 3 4 import { clientPluginHandler } from '../client-core/plugin'; 4 5 import type { Config } from './types'; 5 6 6 7 export const defaultConfig: Plugin.Config<Config> = { 7 - ...clientDefaultConfig, 8 + ...clientDefaultMeta, 8 9 _handler: clientPluginHandler, 9 - _handlerLegacy: () => {}, 10 + config: { 11 + ...clientDefaultConfig, 12 + throwOnError: false, 13 + }, 10 14 name: '@hey-api/client-next', 11 - throwOnError: false, 12 15 }; 13 16 14 17 /** 15 18 * Type helper for `@hey-api/client-next` plugin, returns {@link Plugin.Config} object 16 19 */ 17 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 18 - ...defaultConfig, 19 - ...config, 20 - }); 20 + export const defineConfig = definePluginConfig(defaultConfig);
+5 -7
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 - import { clientDefaultConfig } from '../client-core/config'; 3 + import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; 3 4 import { clientPluginHandler } from '../client-core/plugin'; 4 5 import type { Config } from './types'; 5 6 6 7 export const defaultConfig: Plugin.Config<Config> = { 7 - ...clientDefaultConfig, 8 + ...clientDefaultMeta, 8 9 _handler: clientPluginHandler, 9 - _handlerLegacy: () => {}, 10 + config: clientDefaultConfig, 10 11 name: '@hey-api/client-nuxt', 11 12 }; 12 13 13 14 /** 14 15 * Type helper for `@hey-api/client-nuxt` plugin, returns {@link Plugin.Config} object 15 16 */ 16 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 17 - ...defaultConfig, 18 - ...config, 19 - }); 17 + export const defineConfig = definePluginConfig(defaultConfig);
+3 -4
packages/openapi-ts/src/plugins/@hey-api/legacy-angular/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import type { Config } from './types'; 3 4 ··· 5 6 _handler: () => {}, 6 7 _handlerLegacy: () => {}, 7 8 _tags: ['client'], 9 + config: {}, 8 10 name: 'legacy/angular', 9 11 output: 'client', 10 12 }; ··· 12 14 /** 13 15 * Type helper for `legacy/angular` plugin, returns {@link Plugin.Config} object 14 16 */ 15 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 16 - ...defaultConfig, 17 - ...config, 18 - }); 17 + export const defineConfig = definePluginConfig(defaultConfig);
+3 -4
packages/openapi-ts/src/plugins/@hey-api/legacy-axios/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import type { Config } from './types'; 3 4 ··· 5 6 _handler: () => {}, 6 7 _handlerLegacy: () => {}, 7 8 _tags: ['client'], 9 + config: {}, 8 10 name: 'legacy/axios', 9 11 output: 'client', 10 12 }; ··· 12 14 /** 13 15 * Type helper for `legacy/axios` plugin, returns {@link Plugin.Config} object 14 16 */ 15 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 16 - ...defaultConfig, 17 - ...config, 18 - }); 17 + export const defineConfig = definePluginConfig(defaultConfig);
+3 -4
packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import type { Config } from './types'; 3 4 ··· 5 6 _handler: () => {}, 6 7 _handlerLegacy: () => {}, 7 8 _tags: ['client'], 9 + config: {}, 8 10 name: 'legacy/fetch', 9 11 output: 'client', 10 12 }; ··· 12 14 /** 13 15 * Type helper for `legacy/fetch` plugin, returns {@link Plugin.Config} object 14 16 */ 15 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 16 - ...defaultConfig, 17 - ...config, 18 - }); 17 + export const defineConfig = definePluginConfig(defaultConfig);
+3 -4
packages/openapi-ts/src/plugins/@hey-api/legacy-node/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import type { Config } from './types'; 3 4 ··· 5 6 _handler: () => {}, 6 7 _handlerLegacy: () => {}, 7 8 _tags: ['client'], 9 + config: {}, 8 10 name: 'legacy/node', 9 11 output: 'client', 10 12 }; ··· 12 14 /** 13 15 * Type helper for `legacy/node` plugin, returns {@link Plugin.Config} object 14 16 */ 15 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 16 - ...defaultConfig, 17 - ...config, 18 - }); 17 + export const defineConfig = definePluginConfig(defaultConfig);
+3 -4
packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import type { Config } from './types'; 3 4 ··· 5 6 _handler: () => {}, 6 7 _handlerLegacy: () => {}, 7 8 _tags: ['client'], 9 + config: {}, 8 10 name: 'legacy/xhr', 9 11 output: 'client', 10 12 }; ··· 12 14 /** 13 15 * Type helper for `legacy/xhr` plugin, returns {@link Plugin.Config} object 14 16 */ 15 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 16 - ...defaultConfig, 17 - ...config, 18 - }); 17 + export const defineConfig = definePluginConfig(defaultConfig);
+20 -5
packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts
··· 45 45 '@hey-api/schemas': { 46 46 _handler: () => {}, 47 47 _handlerLegacy: () => {}, 48 + config: {}, 48 49 name: '@hey-api/schemas', 49 50 }, 50 51 '@hey-api/sdk': { 51 52 _handler: () => {}, 52 53 _handlerLegacy: () => {}, 54 + config: {}, 53 55 name: '@hey-api/sdk', 54 56 }, 55 57 '@hey-api/typescript': { 56 58 _handler: () => {}, 57 59 _handlerLegacy: () => {}, 58 - enums: 'javascript', 60 + config: { 61 + enums: 'javascript', 62 + }, 59 63 name: '@hey-api/typescript', 60 64 }, 61 65 'legacy/fetch': { 62 66 _handler: () => {}, 63 67 _handlerLegacy: () => {}, 64 68 _tags: ['client'], 69 + config: {}, 65 70 name: 'legacy/fetch', 66 71 }, 67 72 }, ··· 85 90 files, 86 91 openApi, 87 92 plugin: { 88 - exportFromIndex: false, 93 + config: { 94 + exportFromIndex: false, 95 + }, 89 96 name: '@hey-api/schemas', 90 97 output: 'schemas', 91 98 }, ··· 135 142 '@hey-api/schemas': { 136 143 _handler: () => {}, 137 144 _handlerLegacy: () => {}, 145 + config: { 146 + nameBuilder: nameFn, 147 + }, 138 148 name: '@hey-api/schemas', 139 - nameBuilder: nameFn, 140 149 }, 141 150 '@hey-api/sdk': { 142 151 _handler: () => {}, 143 152 _handlerLegacy: () => {}, 153 + config: {}, 144 154 name: '@hey-api/sdk', 145 155 }, 146 156 '@hey-api/typescript': { 147 157 _handler: () => {}, 148 158 _handlerLegacy: () => {}, 149 - enums: 'javascript', 159 + config: { 160 + enums: 'javascript', 161 + }, 150 162 name: '@hey-api/typescript', 151 163 }, 152 164 'legacy/fetch': { 153 165 _handler: () => {}, 154 166 _handlerLegacy: () => {}, 155 167 _tags: ['client'], 168 + config: {}, 156 169 name: 'legacy/fetch', 157 170 }, 158 171 }, ··· 178 191 files, 179 192 openApi, 180 193 plugin: { 181 - exportFromIndex: false, 194 + config: { 195 + exportFromIndex: false, 196 + }, 182 197 name: '@hey-api/schemas', 183 198 output: 'schemas', 184 199 },
+7 -7
packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import { handler } from './plugin'; 3 4 import { handlerLegacy } from './plugin-legacy'; ··· 6 7 export const defaultConfig: Plugin.Config<Config> = { 7 8 _handler: handler, 8 9 _handlerLegacy: handlerLegacy, 9 - exportFromIndex: false, 10 + config: { 11 + exportFromIndex: false, 12 + nameBuilder: (name) => `${name}Schema`, 13 + type: 'json', 14 + }, 10 15 name: '@hey-api/schemas', 11 - nameBuilder: (name) => `${name}Schema`, 12 16 output: 'schemas', 13 - type: 'json', 14 17 }; 15 18 16 19 /** 17 20 * Type helper for `@hey-api/schemas` plugin, returns {@link Plugin.Config} object 18 21 */ 19 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 20 - ...defaultConfig, 21 - ...config, 22 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+6 -6
packages/openapi-ts/src/plugins/@hey-api/schemas/plugin-legacy.ts
··· 22 22 23 23 const result = { ...schema }; 24 24 Object.entries(result).forEach(([key, value]) => { 25 - if (config.plugins['@hey-api/schemas']?.type === 'form') { 25 + if (config.plugins['@hey-api/schemas']?.config.type === 'form') { 26 26 if ( 27 27 [ 28 28 'description', ··· 64 64 65 65 const plugin = config.plugins['@hey-api/schemas']; 66 66 67 - if (plugin?.nameBuilder) { 68 - if (typeof plugin.nameBuilder === 'function') { 69 - return plugin.nameBuilder(validName, schema); 67 + if (plugin?.config.nameBuilder) { 68 + if (typeof plugin.config.nameBuilder === 'function') { 69 + return plugin.config.nameBuilder(validName, schema); 70 70 } else { 71 - return plugin.nameBuilder.replace('{{name}}', validName); 71 + return plugin.config.nameBuilder.replace('{{name}}', validName); 72 72 } 73 73 } 74 74 ··· 84 84 85 85 files.schemas = new TypeScriptFile({ 86 86 dir: config.output.path, 87 - exportFromIndex: plugin.exportFromIndex, 87 + exportFromIndex: plugin.config.exportFromIndex, 88 88 id: 'schemas', 89 89 name: 'schemas.ts', 90 90 });
+6 -6
packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts
··· 20 20 | OpenApiV3_0_XTypes['SchemaObject'] 21 21 | OpenApiV3_1_XTypes['SchemaObject']; 22 22 }) => { 23 - if (plugin.type === 'form') { 23 + if (plugin.config.type === 'form') { 24 24 if (schema.description) { 25 25 delete schema.description; 26 26 } ··· 341 341 }): string => { 342 342 let customName = ''; 343 343 344 - if (plugin.nameBuilder) { 345 - if (typeof plugin.nameBuilder === 'function') { 346 - customName = plugin.nameBuilder(name, schema); 344 + if (plugin.config.nameBuilder) { 345 + if (typeof plugin.config.nameBuilder === 'function') { 346 + customName = plugin.config.nameBuilder(name, schema); 347 347 } else { 348 - customName = plugin.nameBuilder.replace('{{name}}', name); 348 + customName = plugin.config.nameBuilder.replace('{{name}}', name); 349 349 } 350 350 } 351 351 ··· 442 442 443 443 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 444 444 context.createFile({ 445 - exportFromIndex: plugin.exportFromIndex, 445 + exportFromIndex: plugin.config.exportFromIndex, 446 446 id: schemasId, 447 447 path: plugin.output, 448 448 });
+38 -10
packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts
··· 47 47 '@hey-api/schemas': { 48 48 _handler: () => {}, 49 49 _handlerLegacy: () => {}, 50 + config: {}, 50 51 name: '@hey-api/schemas', 51 52 }, 52 53 '@hey-api/sdk': { 53 54 _handler: () => {}, 54 55 _handlerLegacy: () => {}, 55 - asClass: true, 56 + config: { 57 + asClass: true, 58 + }, 56 59 name: '@hey-api/sdk', 57 60 }, 58 61 '@hey-api/typescript': { 59 62 _handler: () => {}, 60 63 _handlerLegacy: () => {}, 64 + config: {}, 61 65 name: '@hey-api/typescript', 62 66 }, 63 67 'legacy/fetch': { 64 68 _handler: () => {}, 65 69 _handlerLegacy: () => {}, 66 70 _tags: ['client'], 71 + config: {}, 67 72 name: 'legacy/fetch', 68 73 }, 69 74 }, ··· 121 126 files, 122 127 openApi, 123 128 plugin: { 124 - exportFromIndex: false, 129 + config: { 130 + exportFromIndex: false, 131 + }, 125 132 name: '@hey-api/sdk', 126 133 output: '', 127 134 }, ··· 210 217 '@hey-api/schemas': { 211 218 _handler: () => {}, 212 219 _handlerLegacy: () => {}, 220 + config: {}, 213 221 name: '@hey-api/schemas', 214 222 }, 215 223 '@hey-api/sdk': { 216 224 _handler: () => {}, 217 225 _handlerLegacy: () => {}, 218 - asClass: true, 226 + config: { 227 + asClass: true, 228 + }, 219 229 name: '@hey-api/sdk', 220 230 }, 221 231 '@hey-api/typescript': { 222 232 _handler: () => {}, 223 233 _handlerLegacy: () => {}, 234 + config: {}, 224 235 name: '@hey-api/typescript', 225 236 }, 226 237 'legacy/fetch': { 227 238 _handler: () => {}, 228 239 _handlerLegacy: () => {}, 229 240 _tags: ['client'], 241 + config: {}, 230 242 name: 'legacy/fetch', 231 243 }, 232 244 }, ··· 246 258 files, 247 259 openApi, 248 260 plugin: { 249 - exportFromIndex: false, 261 + config: { 262 + exportFromIndex: false, 263 + }, 250 264 name: '@hey-api/sdk', 251 265 output: '', 252 266 }, ··· 295 309 '@hey-api/schemas': { 296 310 _handler: () => {}, 297 311 _handlerLegacy: () => {}, 312 + config: {}, 298 313 name: '@hey-api/schemas', 299 314 }, 300 315 '@hey-api/sdk': { 301 316 _handler: () => {}, 302 317 _handlerLegacy: () => {}, 303 - asClass: true, 304 - methodNameBuilder, 318 + config: { 319 + asClass: true, 320 + methodNameBuilder, 321 + }, 305 322 name: '@hey-api/sdk', 306 323 }, 307 324 '@hey-api/typescript': { 308 325 _handler: () => {}, 309 326 _handlerLegacy: () => {}, 327 + config: {}, 310 328 name: '@hey-api/typescript', 311 329 }, 312 330 'legacy/fetch': { 313 331 _handler: () => {}, 314 332 _handlerLegacy: () => {}, 315 333 _tags: ['client'], 334 + config: {}, 316 335 name: 'legacy/fetch', 317 336 }, 318 337 }, ··· 332 351 files, 333 352 openApi, 334 353 plugin: { 335 - exportFromIndex: false, 354 + config: { 355 + exportFromIndex: false, 356 + }, 336 357 name: '@hey-api/sdk', 337 358 output: '', 338 359 }, ··· 383 404 '@hey-api/schemas': { 384 405 _handler: () => {}, 385 406 _handlerLegacy: () => {}, 407 + config: {}, 386 408 name: '@hey-api/schemas', 387 409 }, 388 410 '@hey-api/sdk': { 389 411 _handler: () => {}, 390 412 _handlerLegacy: () => {}, 391 - asClass: false, 392 - methodNameBuilder, 413 + config: { 414 + asClass: false, 415 + methodNameBuilder, 416 + }, 393 417 name: '@hey-api/sdk', 394 418 }, 395 419 '@hey-api/typescript': { 396 420 _handler: () => {}, 397 421 _handlerLegacy: () => {}, 422 + config: {}, 398 423 name: '@hey-api/typescript', 399 424 }, 400 425 'legacy/fetch': { 401 426 _handler: () => {}, 402 427 _handlerLegacy: () => {}, 403 428 _tags: ['client'], 429 + config: {}, 404 430 name: 'legacy/fetch', 405 431 }, 406 432 }, ··· 420 446 files, 421 447 openApi, 422 448 plugin: { 423 - exportFromIndex: false, 449 + config: { 450 + exportFromIndex: false, 451 + }, 424 452 name: '@hey-api/sdk', 425 453 output: '', 426 454 },
+1 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts
··· 75 75 operation: IR.OperationObject; 76 76 plugin: Plugin.Instance<Config>; 77 77 }): Array<Auth> => { 78 - if (!operation.security || !plugin.auth) { 78 + if (!operation.security || !plugin.config.auth) { 79 79 return []; 80 80 } 81 81
+35 -35
packages/openapi-ts/src/plugins/@hey-api/sdk/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import { handler } from './plugin'; 3 4 import { handlerLegacy } from './plugin-legacy'; ··· 7 8 _dependencies: ['@hey-api/typescript'], 8 9 _handler: handler, 9 10 _handlerLegacy: handlerLegacy, 10 - _infer: (config, context) => { 11 - if (config.client) { 12 - if (typeof config.client === 'boolean') { 13 - config.client = context.pluginByTag({ 11 + _infer: (plugin, context) => { 12 + if (plugin.config.client) { 13 + if (typeof plugin.config.client === 'boolean') { 14 + plugin.config.client = context.pluginByTag({ 14 15 defaultPlugin: '@hey-api/client-fetch', 15 16 tag: 'client', 16 - }) as unknown as typeof config.client; 17 + }) as unknown as typeof plugin.config.client; 17 18 } 18 19 19 - context.ensureDependency(config.client); 20 + context.ensureDependency(plugin.config.client); 20 21 } 21 22 22 - if (config.transformer) { 23 - if (typeof config.transformer === 'boolean') { 24 - config.transformer = context.pluginByTag({ 23 + if (plugin.config.transformer) { 24 + if (typeof plugin.config.transformer === 'boolean') { 25 + plugin.config.transformer = context.pluginByTag({ 25 26 tag: 'transformer', 26 - }) as unknown as typeof config.transformer; 27 + }) as unknown as typeof plugin.config.transformer; 27 28 } 28 29 29 - context.ensureDependency(config.transformer); 30 + context.ensureDependency(plugin.config.transformer); 30 31 } 31 32 32 - if (config.validator) { 33 - if (typeof config.validator === 'boolean') { 34 - config.validator = context.pluginByTag({ 33 + if (plugin.config.validator) { 34 + if (typeof plugin.config.validator === 'boolean') { 35 + plugin.config.validator = context.pluginByTag({ 35 36 tag: 'validator', 36 - }) as unknown as typeof config.validator; 37 + }) as unknown as typeof plugin.config.validator; 37 38 } 38 39 39 - context.ensureDependency(config.validator); 40 + context.ensureDependency(plugin.config.validator); 40 41 } 41 42 42 - if (config.instance) { 43 - if (typeof config.instance !== 'string') { 44 - config.instance = 'Sdk'; 43 + if (plugin.config.instance) { 44 + if (typeof plugin.config.instance !== 'string') { 45 + plugin.config.instance = 'Sdk'; 45 46 } 46 47 47 - config.asClass = true; 48 + plugin.config.asClass = true; 48 49 } 49 50 50 51 // TODO: add responseStyle field to all clients 51 - if (config.client !== '@hey-api/client-fetch') { 52 - config.responseStyle = 'fields'; 52 + if (plugin.config.client !== '@hey-api/client-fetch') { 53 + plugin.config.responseStyle = 'fields'; 53 54 } 54 55 }, 55 - asClass: false, 56 - auth: true, 57 - classStructure: 'auto', 58 - client: true, 59 - exportFromIndex: true, 60 - instance: false, 56 + config: { 57 + asClass: false, 58 + auth: true, 59 + classStructure: 'auto', 60 + client: true, 61 + exportFromIndex: true, 62 + instance: false, 63 + operationId: true, 64 + response: 'body', 65 + responseStyle: 'fields', 66 + }, 61 67 name: '@hey-api/sdk', 62 - operationId: true, 63 68 output: 'sdk', 64 - response: 'body', 65 - responseStyle: 'fields', 66 69 }; 67 70 68 71 /** 69 72 * Type helper for `@hey-api/sdk` plugin, returns {@link Plugin.Config} object 70 73 */ 71 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 72 - ...defaultConfig, 73 - ...config, 74 - }); 74 + export const defineConfig = definePluginConfig(defaultConfig);
+25 -18
packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts
··· 59 59 plugin, 60 60 }: { 61 61 operation: IR.OperationObject; 62 - plugin: Pick<Plugin.Instance<Config>, 'asClass' | 'methodNameBuilder'>; 62 + plugin: { 63 + config: Pick< 64 + Plugin.Instance<Config>['config'], 65 + 'asClass' | 'methodNameBuilder' 66 + >; 67 + }; 63 68 }) => { 64 - if (plugin.methodNameBuilder) { 65 - return plugin.methodNameBuilder(operation); 69 + if (plugin.config.methodNameBuilder) { 70 + return plugin.config.methodNameBuilder(operation); 66 71 } 67 72 68 - const handleIllegal = !plugin.asClass; 73 + const handleIllegal = !plugin.config.asClass; 69 74 if (handleIllegal && operation.id.match(reservedJavaScriptKeywordsRegExp)) { 70 75 return `${operation.id}_`; 71 76 } ··· 83 88 }: { 84 89 context: IR.Context; 85 90 operation: IR.OperationObject; 86 - plugin: Pick< 87 - Plugin.Instance<Config>, 88 - 'asClass' | 'classStructure' | 'instance' 89 - >; 91 + plugin: { 92 + config: Pick< 93 + Plugin.Instance<Config>['config'], 94 + 'asClass' | 'classStructure' | 'instance' 95 + >; 96 + }; 90 97 }): Map<string, ClassNameEntry> => { 91 98 const classNames = new Map<string, ClassNameEntry>(); 92 99 ··· 94 101 let methodName: string | undefined; 95 102 let classCandidates: Array<string> = []; 96 103 97 - if (plugin.classStructure === 'auto' && operation.operationId) { 104 + if (plugin.config.classStructure === 'auto' && operation.operationId) { 98 105 classCandidates = operation.operationId.split(/[./]/).filter(Boolean); 99 106 if (classCandidates.length > 1) { 100 107 const methodCandidate = classCandidates.pop()!; ··· 106 113 } 107 114 } 108 115 109 - const rootClasses = plugin.instance 110 - ? [plugin.instance as string] 116 + const rootClasses = plugin.config.instance 117 + ? [plugin.config.instance as string] 111 118 : (operation.tags ?? ['default']); 112 119 113 120 for (const rootClass of rootClasses) { ··· 375 382 } 376 383 } 377 384 378 - if (plugin.transformer === '@hey-api/transformers') { 385 + if (plugin.config.transformer === '@hey-api/transformers') { 379 386 const identifierTransformer = context 380 387 .file({ id: transformersId })! 381 388 .identifier({ ··· 411 418 }); 412 419 } 413 420 414 - if (plugin.responseStyle === 'data') { 421 + if (plugin.config.responseStyle === 'data') { 415 422 requestOptions.push({ 416 423 key: 'responseStyle', 417 - value: plugin.responseStyle, 424 + value: plugin.config.responseStyle, 418 425 }); 419 426 } 420 427 ··· 458 465 const responseType = identifierResponse.name || 'unknown'; 459 466 const errorType = identifierError.name || 'unknown'; 460 467 461 - const heyApiClient = plugin.client 468 + const heyApiClient = plugin.config.client 462 469 ? file.import({ 463 470 alias: '_heyApiClient', 464 471 module: file.relativePathToFile({ ··· 477 484 478 485 let clientExpression: ts.Expression; 479 486 480 - if (plugin.instance) { 487 + if (plugin.config.instance) { 481 488 clientExpression = compiler.binaryExpression({ 482 489 left: optionsClient, 483 490 operator: '??', ··· 508 515 types.push(responseType, errorType, 'ThrowOnError'); 509 516 } 510 517 511 - if (plugin.responseStyle === 'data') { 512 - types.push(compiler.stringLiteral({ text: plugin.responseStyle })); 518 + if (plugin.config.responseStyle === 'data') { 519 + types.push(compiler.stringLiteral({ text: plugin.config.responseStyle })); 513 520 } 514 521 515 522 return [
+9 -8
packages/openapi-ts/src/plugins/@hey-api/sdk/plugin-legacy.ts
··· 206 206 207 207 if ( 208 208 config.useOptions && 209 - config.plugins['@hey-api/sdk']?.response === 'response' 209 + config.plugins['@hey-api/sdk']?.config.response === 'response' 210 210 ) { 211 211 returnType = compiler.typeNode('ApiResult', [returnType]); 212 212 } ··· 498 498 id: string; 499 499 operation: IR.OperationObject | Operation; 500 500 }) => { 501 - if (config.plugins['@hey-api/sdk']?.methodNameBuilder) { 502 - return config.plugins['@hey-api/sdk'].methodNameBuilder(operation); 501 + if (config.plugins['@hey-api/sdk']?.config.methodNameBuilder) { 502 + return config.plugins['@hey-api/sdk'].config.methodNameBuilder(operation); 503 503 } 504 504 505 505 if (handleIllegal && id.match(reservedJavaScriptKeywordsRegExp)) { ··· 665 665 666 666 const throwOnErrorTypeGeneric: FunctionTypeParameter = { 667 667 default: 668 - ('throwOnError' in clientPlugin ? clientPlugin.throwOnError : false) ?? 669 - false, 668 + ('throwOnError' in clientPlugin.config 669 + ? clientPlugin.config.throwOnError 670 + : false) ?? false, 670 671 extends: 'boolean', 671 672 name: 'ThrowOnError', 672 673 }; 673 674 674 675 if ( 675 - !config.plugins['@hey-api/sdk']?.asClass && 676 + !config.plugins['@hey-api/sdk']?.config.asClass && 676 677 !legacyNameFromConfig(config) 677 678 ) { 678 679 for (const operation of service.operations) { ··· 812 813 813 814 files.sdk = new TypeScriptFile({ 814 815 dir: config.output.path, 815 - exportFromIndex: plugin.exportFromIndex, 816 + exportFromIndex: plugin.config.exportFromIndex, 816 817 id: 'sdk', 817 818 name: `${sdkOutput}.ts`, 818 819 }); ··· 859 860 }); 860 861 } 861 862 862 - if (config.plugins['@hey-api/sdk']?.response === 'response') { 863 + if (config.plugins['@hey-api/sdk']?.config.response === 'response') { 863 864 files.sdk.import({ 864 865 asType: true, 865 866 module: './core/ApiResult',
+18 -16
packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts
··· 42 42 43 43 return [ 44 44 compiler.propertyDeclaration({ 45 - initializer: plugin.client 45 + initializer: plugin.config.client 46 46 ? compiler.identifier({ text: '_heyApiClient' }) 47 47 : undefined, 48 48 modifier: 'protected', ··· 55 55 multiLine: true, 56 56 parameters: [ 57 57 { 58 - isRequired: !plugin.client, 58 + isRequired: !plugin.config.client, 59 59 name: 'args', 60 60 type: compiler.typeInterfaceNode({ 61 61 properties: [ 62 62 { 63 - isRequired: !plugin.client, 63 + isRequired: !plugin.config.client, 64 64 name: 'client', 65 65 type: 'Client', 66 66 }, ··· 70 70 }, 71 71 ], 72 72 statements: [ 73 - !plugin.client 73 + !plugin.config.client 74 74 ? clientAssignmentStatement 75 75 : compiler.ifStatement({ 76 76 expression: compiler.propertyAccessExpression({ ··· 126 126 */ 127 127 const generatedClasses = new Set<string>(); 128 128 129 - const clientClassNodes = plugin.instance 129 + const clientClassNodes = plugin.config.instance 130 130 ? createClientClassNodes({ plugin }) 131 131 : []; 132 132 ··· 179 179 const functionNode = compiler.methodDeclaration({ 180 180 accessLevel: 'public', 181 181 comment: createOperationComment({ operation }), 182 - isStatic: !plugin.instance, 182 + isStatic: !plugin.config.instance, 183 183 name: entry.methodName, 184 184 parameters: [ 185 185 { ··· 224 224 : [ 225 225 { 226 226 default: 227 - ('throwOnError' in client ? client.throwOnError : false) ?? 228 - false, 227 + ('throwOnError' in client.config 228 + ? client.config.throwOnError 229 + : false) ?? false, 229 230 extends: 'boolean', 230 231 name: 'ThrowOnError', 231 232 }, ··· 261 262 262 263 currentClass.nodes.push( 263 264 compiler.propertyDeclaration({ 264 - initializer: plugin.instance 265 + initializer: plugin.config.instance 265 266 ? compiler.newExpression({ 266 - argumentsArray: plugin.instance 267 + argumentsArray: plugin.config.instance 267 268 ? [ 268 269 compiler.objectExpression({ 269 270 multiLine: false, ··· 284 285 }), 285 286 }) 286 287 : compiler.identifier({ text: childClass.className }), 287 - modifier: plugin.instance ? undefined : 'static', 288 + modifier: plugin.config.instance ? undefined : 'static', 288 289 name: stringCase({ 289 290 case: 'camelCase', 290 291 value: childClass.className, ··· 296 297 297 298 const node = compiler.classDeclaration({ 298 299 exportClass: currentClass.root, 299 - extendedClasses: plugin.instance ? ['_HeyApiClient'] : undefined, 300 + extendedClasses: plugin.config.instance ? ['_HeyApiClient'] : undefined, 300 301 name: currentClass.className, 301 302 nodes: currentClass.nodes, 302 303 }); ··· 389 390 : [ 390 391 { 391 392 default: 392 - ('throwOnError' in client ? client.throwOnError : false) ?? 393 - false, 393 + ('throwOnError' in client.config 394 + ? client.config.throwOnError 395 + : false) ?? false, 394 396 extends: 'boolean', 395 397 name: 'ThrowOnError', 396 398 }, ··· 409 411 410 412 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 411 413 const file = context.createFile({ 412 - exportFromIndex: plugin.exportFromIndex, 414 + exportFromIndex: plugin.config.exportFromIndex, 413 415 id: sdkId, 414 416 path: plugin.output, 415 417 }); ··· 441 443 plugin, 442 444 }); 443 445 444 - if (plugin.asClass) { 446 + if (plugin.config.asClass) { 445 447 generateClassSdk({ context, plugin }); 446 448 } else { 447 449 generateFlatSdk({ context, plugin });
+1 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts
··· 62 62 'individual options. This might be also useful if you want to implement a', 63 63 'custom client.', 64 64 ], 65 - isRequired: !plugin.client, 65 + isRequired: !plugin.config.client, 66 66 name: 'client', 67 67 type: compiler.typeReferenceNode({ typeName: clientType.name }), 68 68 },
+1 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts
··· 139 139 operation: IR.OperationObject; 140 140 plugin: Plugin.Instance<Config>; 141 141 }) => { 142 - switch (plugin.validator) { 142 + switch (plugin.config.validator) { 143 143 case 'valibot': 144 144 return valibotResponseValidator({ context, operation }); 145 145 case 'zod':
+7 -7
packages/openapi-ts/src/plugins/@hey-api/transformers/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import { handler } from './plugin'; 3 4 import { handlerLegacy } from './plugin-legacy'; ··· 8 9 _handler: handler, 9 10 _handlerLegacy: handlerLegacy, 10 11 _tags: ['transformer'], 11 - bigInt: true, 12 - dates: true, 13 - exportFromIndex: false, 12 + config: { 13 + bigInt: true, 14 + dates: true, 15 + exportFromIndex: false, 16 + }, 14 17 name: '@hey-api/transformers', 15 18 output: 'transformers', 16 19 }; ··· 18 21 /** 19 22 * Type helper for `@hey-api/transformers`, returns {@link Plugin.Config} object 20 23 */ 21 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 22 - ...defaultConfig, 23 - ...config, 24 - }); 24 + export const defineConfig = definePluginConfig(defaultConfig);
+7 -3
packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts
··· 378 378 } 379 379 380 380 if ( 381 - plugin.dates && 381 + plugin.config.dates && 382 382 schema.type === 'string' && 383 383 (schema.format === 'date' || schema.format === 'date-time') 384 384 ) { 385 385 return dateExpressions({ dataExpression }); 386 386 } 387 387 388 - if (plugin.bigInt && schema.type === 'integer' && schema.format === 'int64') { 388 + if ( 389 + plugin.config.bigInt && 390 + schema.type === 'integer' && 391 + schema.format === 'int64' 392 + ) { 389 393 return bigIntExpressions({ dataExpression }); 390 394 } 391 395 ··· 460 464 // handles only response transformers for now 461 465 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 462 466 const file = context.createFile({ 463 - exportFromIndex: plugin.exportFromIndex, 467 + exportFromIndex: plugin.config.exportFromIndex, 464 468 id: transformersId, 465 469 path: plugin.output, 466 470 });
+9 -2
packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts
··· 45 45 '@hey-api/schemas': { 46 46 _handler: () => {}, 47 47 _handlerLegacy: () => {}, 48 + config: {}, 48 49 name: '@hey-api/schemas', 49 50 }, 50 51 '@hey-api/sdk': { 51 52 _handler: () => {}, 52 53 _handlerLegacy: () => {}, 54 + config: {}, 53 55 name: '@hey-api/sdk', 54 56 }, 55 57 '@hey-api/typescript': { 56 58 _handler: () => {}, 57 59 _handlerLegacy: () => {}, 58 - enums: 'javascript', 60 + config: { 61 + enums: 'javascript', 62 + }, 59 63 name: '@hey-api/typescript', 60 64 }, 61 65 'legacy/fetch': { 62 66 _handler: () => {}, 63 67 _handlerLegacy: () => {}, 64 68 _tags: ['client'], 69 + config: {}, 65 70 name: 'legacy/fetch', 66 71 }, 67 72 }, ··· 114 119 files, 115 120 openApi, 116 121 plugin: { 117 - exportFromIndex: false, 122 + config: { 123 + exportFromIndex: false, 124 + }, 118 125 name: '@hey-api/typescript', 119 126 output: '', 120 127 },
+3 -1
packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts
··· 55 55 56 56 if (!servers.length) { 57 57 types.push(stringType); 58 - } else if (!('strictBaseUrl' in client && client.strictBaseUrl)) { 58 + } else if ( 59 + !('strictBaseUrl' in client.config && client.config.strictBaseUrl) 60 + ) { 59 61 types.push( 60 62 compiler.typeIntersectionNode({ 61 63 types: [stringType, ts.factory.createTypeLiteralNode([])],
+15 -15
packages/openapi-ts/src/plugins/@hey-api/typescript/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 2 3 import { handler } from './plugin'; 3 4 import { handlerLegacy } from './plugin-legacy'; ··· 6 7 export const defaultConfig: Plugin.Config<Config> = { 7 8 _handler: handler, 8 9 _handlerLegacy: handlerLegacy, 9 - enums: false, 10 - enumsCase: 'SCREAMING_SNAKE_CASE', 11 - enumsConstantsIgnoreNull: false, 12 - exportFromIndex: true, 13 - exportInlineEnums: false, 14 - identifierCase: 'PascalCase', 10 + config: { 11 + enums: false, 12 + enumsCase: 'SCREAMING_SNAKE_CASE', 13 + enumsConstantsIgnoreNull: false, 14 + exportFromIndex: true, 15 + exportInlineEnums: false, 16 + identifierCase: 'PascalCase', 17 + readOnlyWriteOnlyBehavior: 'split', 18 + readableNameBuilder: '{{name}}Readable', 19 + style: 'preserve', 20 + tree: false, 21 + writableNameBuilder: '{{name}}Writable', 22 + }, 15 23 name: '@hey-api/typescript', 16 24 output: 'types', 17 - readOnlyWriteOnlyBehavior: 'split', 18 - readableNameBuilder: '{{name}}Readable', 19 - style: 'preserve', 20 - tree: false, 21 - writableNameBuilder: '{{name}}Writable', 22 25 }; 23 26 24 27 /** 25 28 * Type helper for `@hey-api/typescript` plugin, returns {@link Plugin.Config} object 26 29 */ 27 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 28 - ...defaultConfig, 29 - ...config, 30 - }); 30 + export const defineConfig = definePluginConfig(defaultConfig);
+11 -7
packages/openapi-ts/src/plugins/@hey-api/typescript/plugin-legacy.ts
··· 137 137 138 138 props.model.enums.forEach((enumerator) => { 139 139 if ( 140 - config.plugins['@hey-api/typescript']?.enums !== 'typescript+namespace' 140 + config.plugins['@hey-api/typescript']?.config.enums !== 141 + 'typescript+namespace' 141 142 ) { 142 143 return processEnum({ 143 144 ...props, ··· 184 185 ]; 185 186 186 187 if ( 187 - config.plugins['@hey-api/typescript']?.enums === 'typescript' || 188 - config.plugins['@hey-api/typescript']?.enums === 'typescript+namespace' 188 + config.plugins['@hey-api/typescript']?.config.enums === 'typescript' || 189 + config.plugins['@hey-api/typescript']?.config.enums === 190 + 'typescript+namespace' 189 191 ) { 190 192 generateEnum({ 191 193 client, ··· 204 206 meta: model.meta, 205 207 onCreated: (name) => { 206 208 // create a separate JavaScript object export 207 - if (config.plugins['@hey-api/typescript']?.enums === 'javascript') { 209 + if ( 210 + config.plugins['@hey-api/typescript']?.config.enums === 'javascript' 211 + ) { 208 212 const expression = compiler.objectExpression({ 209 213 multiLine: true, 210 214 obj: Object.entries(properties).map(([key, value]) => ({ ··· 302 306 303 307 if ( 304 308 !config.plugins['@hey-api/sdk'] && 305 - !config.plugins['@hey-api/typescript']?.tree 309 + !config.plugins['@hey-api/typescript']?.config.tree 306 310 ) { 307 311 return; 308 312 } ··· 590 594 return pathKey; 591 595 }); 592 596 593 - if (config.plugins['@hey-api/typescript']?.tree) { 597 + if (config.plugins['@hey-api/typescript']?.config.tree) { 594 598 generateType({ 595 599 client, 596 600 meta: { ··· 615 619 616 620 files.types = new TypeScriptFile({ 617 621 dir: config.output.path, 618 - exportFromIndex: plugin.exportFromIndex, 622 + exportFromIndex: plugin.config.exportFromIndex, 619 623 id: 'types', 620 624 name: 'types.ts', 621 625 });
+24 -23
packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts
··· 52 52 const name = refParts.pop()!; 53 53 const nameBuilder = 54 54 accessScope === 'read' 55 - ? plugin.readableNameBuilder 56 - : plugin.writableNameBuilder; 55 + ? plugin.config.readableNameBuilder 56 + : plugin.config.writableNameBuilder; 57 57 const processedName = processNameBuilder({ name, nameBuilder }); 58 58 refParts.push(processedName); 59 59 return refParts.join('/'); ··· 146 146 147 147 // JavaScript enums might want to ignore null values 148 148 if ( 149 - plugin.enumsConstantsIgnoreNull && 149 + plugin.config.enumsConstantsIgnoreNull && 150 150 enumObject.typeofItems.includes('object') 151 151 ) { 152 152 enumObject.obj = enumObject.obj.filter((item) => item.value !== null); ··· 208 208 209 209 if (key) { 210 210 key = stringCase({ 211 - case: plugin.enumsCase, 211 + case: plugin.config.enumsCase, 212 212 stripLeadingSeparators: false, 213 213 value: key, 214 214 }); ··· 217 217 // TypeScript enum keys cannot be numbers 218 218 if ( 219 219 numberRegExp.test(key) && 220 - (plugin.enums === 'typescript' || 221 - plugin.enums === 'typescript+namespace') 220 + (plugin.config.enums === 'typescript' || 221 + plugin.config.enums === 'typescript+namespace') 222 222 ) { 223 223 key = `_${key}`; 224 224 } ··· 265 265 if ( 266 266 !identifier.created && 267 267 !isRefOpenApiComponent($ref) && 268 - plugin.enums !== 'typescript+namespace' 268 + plugin.config.enums !== 'typescript+namespace' 269 269 ) { 270 270 return; 271 271 } ··· 437 437 }): ts.TypeNode | undefined => { 438 438 const file = context.file({ id: typesId })!; 439 439 const isRefComponent = $ref ? isRefOpenApiComponent($ref) : false; 440 - const shouldExportEnum = isRefComponent || Boolean(plugin.exportInlineEnums); 440 + const shouldExportEnum = 441 + isRefComponent || Boolean(plugin.config.exportInlineEnums); 441 442 442 443 if ($ref && shouldExportEnum) { 443 444 // when enums are disabled (default), emit only reusable components 444 445 // as types, otherwise the output would be broken if we skipped all enums 445 - if (!plugin.enums) { 446 + if (!plugin.config.enums) { 446 447 const typeNode = addTypeEnum({ 447 448 $ref, 448 449 context, ··· 455 456 } 456 457 } 457 458 458 - if (plugin.enums === 'javascript') { 459 + if (plugin.config.enums === 'javascript') { 459 460 const typeNode = addTypeEnum({ 460 461 $ref, 461 462 context, ··· 478 479 } 479 480 } 480 481 481 - if (plugin.enums === 'typescript') { 482 + if (plugin.config.enums === 'typescript') { 482 483 const enumNode = addTypeScriptEnum({ 483 484 $ref, 484 485 context, ··· 491 492 } 492 493 } 493 494 494 - if (plugin.enums === 'typescript+namespace') { 495 + if (plugin.config.enums === 'typescript+namespace') { 495 496 const enumNode = addTypeScriptEnum({ 496 497 $ref, 497 498 context, ··· 538 539 539 540 if (schema.type === 'integer' && schema.format === 'int64') { 540 541 // TODO: parser - add ability to skip type transformers 541 - if (context.config.plugins['@hey-api/transformers']?.bigInt) { 542 + if (context.config.plugins['@hey-api/transformers']?.config.bigInt) { 542 543 return compiler.typeReferenceNode({ typeName: 'bigint' }); 543 544 } 544 545 } ··· 694 695 695 696 if (schema.format === 'date-time' || schema.format === 'date') { 696 697 // TODO: parser - add ability to skip type transformers 697 - if (context.config.plugins['@hey-api/transformers']?.dates) { 698 + if (context.config.plugins['@hey-api/transformers']?.config.dates) { 698 699 return compiler.typeReferenceNode({ typeName: 'Date' }); 699 700 } 700 701 } ··· 970 971 plugin, 971 972 schema: data, 972 973 state: 973 - plugin.readOnlyWriteOnlyBehavior === 'off' 974 + plugin.config.readOnlyWriteOnlyBehavior === 'off' 974 975 ? { 975 976 path: [operation.method, operation.path, 'data'], 976 977 } ··· 1026 1027 plugin, 1027 1028 schema: errors, 1028 1029 state: 1029 - plugin.readOnlyWriteOnlyBehavior === 'off' 1030 + plugin.config.readOnlyWriteOnlyBehavior === 'off' 1030 1031 ? { 1031 1032 path: [operation.method, operation.path, 'errors'], 1032 1033 } ··· 1093 1094 plugin, 1094 1095 schema: responses, 1095 1096 state: 1096 - plugin.readOnlyWriteOnlyBehavior === 'off' 1097 + plugin.config.readOnlyWriteOnlyBehavior === 'off' 1097 1098 ? { 1098 1099 path: [operation.method, operation.path, 'responses'], 1099 1100 } ··· 1209 1210 create: true, 1210 1211 namespace: 1211 1212 refSchema.type === 'enum' && 1212 - (plugin.enums === 'typescript' || 1213 - plugin.enums === 'typescript+namespace') && 1213 + (plugin.config.enums === 'typescript' || 1214 + plugin.config.enums === 'typescript+namespace') && 1214 1215 shouldCreateTypeScriptEnum({ 1215 1216 plugin, 1216 1217 schema: refSchema as SchemaWithType<'enum'>, ··· 1315 1316 1316 1317 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 1317 1318 const file = context.createFile({ 1318 - exportFromIndex: plugin.exportFromIndex, 1319 + exportFromIndex: plugin.config.exportFromIndex, 1319 1320 id: typesId, 1320 - identifierCase: plugin.identifierCase, 1321 + identifierCase: plugin.config.identifierCase, 1321 1322 path: plugin.output, 1322 1323 }); 1323 1324 ··· 1330 1331 1331 1332 context.subscribe('schema', ({ $ref, schema }) => { 1332 1333 if ( 1333 - plugin.readOnlyWriteOnlyBehavior === 'off' || 1334 + plugin.config.readOnlyWriteOnlyBehavior === 'off' || 1334 1335 !isSchemaSplit({ schema }) 1335 1336 ) { 1336 1337 schemaToType({ ··· 1403 1404 plugin, 1404 1405 schema: requestBody.schema, 1405 1406 state: 1406 - plugin.readOnlyWriteOnlyBehavior === 'off' 1407 + plugin.config.readOnlyWriteOnlyBehavior === 'off' 1407 1408 ? { 1408 1409 // TODO: correctly populate state.path 1409 1410 path: [],
+6 -14
packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 3 + import { defaultTanStackQueryConfig } from '../query-core/config'; 2 4 import { handler } from '../query-core/plugin'; 3 5 import { handlerLegacy } from '../query-core/plugin-legacy'; 4 6 import type { Config } from './types'; ··· 7 9 _dependencies: ['@hey-api/sdk', '@hey-api/typescript'], 8 10 _handler: handler, 9 11 _handlerLegacy: handlerLegacy, 10 - comments: true, 11 - exportFromIndex: false, 12 - infiniteQueryKeyNameBuilder: '{{name}}InfiniteQueryKey', 13 - infiniteQueryOptions: true, 14 - infiniteQueryOptionsNameBuilder: '{{name}}InfiniteOptions', 15 - mutationOptions: true, 16 - mutationOptionsNameBuilder: '{{name}}Mutation', 12 + config: { 13 + ...defaultTanStackQueryConfig, 14 + }, 17 15 name: '@tanstack/angular-query-experimental', 18 16 output: '@tanstack/angular-query-experimental', 19 - queryKeyNameBuilder: '{{name}}QueryKey', 20 - queryOptions: true, 21 - queryOptionsNameBuilder: '{{name}}Options', 22 17 }; 23 18 24 19 /** 25 20 * Type helper for `@tanstack/angular-query-experimental` plugin, returns {@link Plugin.Config} object 26 21 */ 27 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 28 - ...defaultConfig, 29 - ...config, 30 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+12
packages/openapi-ts/src/plugins/@tanstack/query-core/config.ts
··· 1 + export const defaultTanStackQueryConfig = { 2 + comments: true, 3 + exportFromIndex: false, 4 + infiniteQueryKeyNameBuilder: '{{name}}InfiniteQueryKey', 5 + infiniteQueryOptions: true, 6 + infiniteQueryOptionsNameBuilder: '{{name}}InfiniteOptions', 7 + mutationOptions: true, 8 + mutationOptionsNameBuilder: '{{name}}Mutation', 9 + queryKeyNameBuilder: '{{name}}QueryKey', 10 + queryOptions: true, 11 + queryOptionsNameBuilder: '{{name}}Options', 12 + } as const;
+7 -7
packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts
··· 237 237 238 238 let customName = ''; 239 239 240 - if (plugin.infiniteQueryOptionsNameBuilder) { 241 - if (typeof plugin.infiniteQueryOptionsNameBuilder === 'function') { 242 - customName = plugin.infiniteQueryOptionsNameBuilder(name); 240 + if (plugin.config.infiniteQueryOptionsNameBuilder) { 241 + if (typeof plugin.config.infiniteQueryOptionsNameBuilder === 'function') { 242 + customName = plugin.config.infiniteQueryOptionsNameBuilder(name); 243 243 } else { 244 - customName = plugin.infiniteQueryOptionsNameBuilder.replace( 244 + customName = plugin.config.infiniteQueryOptionsNameBuilder.replace( 245 245 '{{name}}', 246 246 name, 247 247 ); ··· 265 265 state: PluginState; 266 266 }) => { 267 267 if ( 268 - !plugin.infiniteQueryOptions || 268 + !plugin.config.infiniteQueryOptions || 269 269 !(['get', 'post'] as (typeof operation.method)[]).includes(operation.method) 270 270 ) { 271 271 return state; ··· 431 431 }), 432 432 ]; 433 433 434 - if (context.config.plugins['@hey-api/sdk']?.responseStyle === 'data') { 434 + if (context.config.plugins['@hey-api/sdk']?.config.responseStyle === 'data') { 435 435 statements.push( 436 436 compiler.returnVariable({ 437 437 expression: awaitSdkExpression, ··· 451 451 } 452 452 453 453 const statement = compiler.constVariable({ 454 - comment: plugin.comments 454 + comment: plugin.config.comments 455 455 ? createOperationComment({ operation }) 456 456 : undefined, 457 457 exportConst: true,
+10 -7
packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts
··· 26 26 27 27 let customName = ''; 28 28 29 - if (plugin.mutationOptionsNameBuilder) { 30 - if (typeof plugin.mutationOptionsNameBuilder === 'function') { 31 - customName = plugin.mutationOptionsNameBuilder(name); 29 + if (plugin.config.mutationOptionsNameBuilder) { 30 + if (typeof plugin.config.mutationOptionsNameBuilder === 'function') { 31 + customName = plugin.config.mutationOptionsNameBuilder(name); 32 32 } else { 33 - customName = plugin.mutationOptionsNameBuilder.replace('{{name}}', name); 33 + customName = plugin.config.mutationOptionsNameBuilder.replace( 34 + '{{name}}', 35 + name, 36 + ); 34 37 } 35 38 } 36 39 ··· 51 54 state: PluginState; 52 55 }) => { 53 56 if ( 54 - !plugin.mutationOptions || 57 + !plugin.config.mutationOptions || 55 58 !( 56 59 ['delete', 'patch', 'post', 'put'] as (typeof operation.method)[] 57 60 ).includes(operation.method) ··· 111 114 112 115 const statements: Array<ts.Statement> = []; 113 116 114 - if (context.config.plugins['@hey-api/sdk']?.responseStyle === 'data') { 117 + if (context.config.plugins['@hey-api/sdk']?.config.responseStyle === 'data') { 115 118 statements.push( 116 119 compiler.returnVariable({ 117 120 expression: awaitSdkExpression, ··· 167 170 ], 168 171 }); 169 172 const statement = compiler.constVariable({ 170 - comment: plugin.comments 173 + comment: plugin.config.comments 171 174 ? createOperationComment({ operation }) 172 175 : undefined, 173 176 exportConst: true,
+5 -5
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts
··· 719 719 processedOperations.set(operationKey, true); 720 720 721 721 const queryFn = [ 722 - config.plugins['@hey-api/sdk']?.asClass && 722 + config.plugins['@hey-api/sdk']?.config.asClass && 723 723 transformClassName({ 724 724 config, 725 725 name: service.name, 726 726 }), 727 727 serviceFunctionIdentifier({ 728 728 config, 729 - handleIllegal: !config.plugins['@hey-api/sdk']?.asClass, 729 + handleIllegal: !config.plugins['@hey-api/sdk']?.config.asClass, 730 730 id: operation.name, 731 731 operation, 732 732 }), ··· 737 737 738 738 // queries 739 739 if ( 740 - plugin.queryOptions && 740 + plugin.config.queryOptions && 741 741 (['GET', 'POST'] as ReadonlyArray<Method>).includes(operation.method) 742 742 ) { 743 743 if (!hasQueries) { ··· 893 893 894 894 // infinite queries 895 895 if ( 896 - plugin.infiniteQueryOptions && 896 + plugin.config.infiniteQueryOptions && 897 897 (['GET', 'POST'] as ReadonlyArray<Method>).includes(operation.method) 898 898 ) { 899 899 // the actual pagination field might be nested inside parameter, e.g. body ··· 1187 1187 1188 1188 // mutations 1189 1189 if ( 1190 - plugin.mutationOptions && 1190 + plugin.config.mutationOptions && 1191 1191 (['DELETE', 'PATCH', 'POST', 'PUT'] as ReadonlyArray<Method>).includes( 1192 1192 operation.method, 1193 1193 )
+2 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts
··· 11 11 12 12 export const handler: PluginHandler = ({ context, plugin }) => { 13 13 const file = context.createFile({ 14 - exportFromIndex: plugin.exportFromIndex, 14 + exportFromIndex: plugin.config.exportFromIndex, 15 15 id: plugin.name, 16 16 path: plugin.output, 17 17 }); ··· 37 37 state.hasUsedQueryFn = false; 38 38 39 39 const sdk = context.config.plugins['@hey-api/sdk']; 40 - const classes = sdk?.asClass 40 + const classes = sdk?.config.asClass 41 41 ? operationClasses({ context, operation, plugin: sdk }) 42 42 : undefined; 43 43 const entry = classes ? classes.values().next().value : undefined;
+11 -8
packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts
··· 315 315 316 316 let customName = ''; 317 317 318 - if (plugin.infiniteQueryKeyNameBuilder) { 319 - if (typeof plugin.infiniteQueryKeyNameBuilder === 'function') { 320 - customName = plugin.infiniteQueryKeyNameBuilder(name); 318 + if (plugin.config.infiniteQueryKeyNameBuilder) { 319 + if (typeof plugin.config.infiniteQueryKeyNameBuilder === 'function') { 320 + customName = plugin.config.infiniteQueryKeyNameBuilder(name); 321 321 } else { 322 - customName = plugin.infiniteQueryKeyNameBuilder.replace('{{name}}', name); 322 + customName = plugin.config.infiniteQueryKeyNameBuilder.replace( 323 + '{{name}}', 324 + name, 325 + ); 323 326 } 324 327 } 325 328 ··· 343 346 344 347 let customName = ''; 345 348 346 - if (plugin.queryKeyNameBuilder) { 347 - if (typeof plugin.queryKeyNameBuilder === 'function') { 348 - customName = plugin.queryKeyNameBuilder(name); 349 + if (plugin.config.queryKeyNameBuilder) { 350 + if (typeof plugin.config.queryKeyNameBuilder === 'function') { 351 + customName = plugin.config.queryKeyNameBuilder(name); 349 352 } else { 350 - customName = plugin.queryKeyNameBuilder.replace('{{name}}', name); 353 + customName = plugin.config.queryKeyNameBuilder.replace('{{name}}', name); 351 354 } 352 355 } 353 356
+10 -7
packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts
··· 35 35 36 36 let customName = ''; 37 37 38 - if (plugin.queryOptionsNameBuilder) { 39 - if (typeof plugin.queryOptionsNameBuilder === 'function') { 40 - customName = plugin.queryOptionsNameBuilder(name); 38 + if (plugin.config.queryOptionsNameBuilder) { 39 + if (typeof plugin.config.queryOptionsNameBuilder === 'function') { 40 + customName = plugin.config.queryOptionsNameBuilder(name); 41 41 } else { 42 - customName = plugin.queryOptionsNameBuilder.replace('{{name}}', name); 42 + customName = plugin.config.queryOptionsNameBuilder.replace( 43 + '{{name}}', 44 + name, 45 + ); 43 46 } 44 47 } 45 48 ··· 60 63 state: PluginState; 61 64 }) => { 62 65 if ( 63 - !plugin.queryOptions || 66 + !plugin.config.queryOptions || 64 67 !(['get', 'post'] as (typeof operation.method)[]).includes(operation.method) 65 68 ) { 66 69 return state; ··· 138 141 139 142 const statements: Array<ts.Statement> = []; 140 143 141 - if (context.config.plugins['@hey-api/sdk']?.responseStyle === 'data') { 144 + if (context.config.plugins['@hey-api/sdk']?.config.responseStyle === 'data') { 142 145 statements.push( 143 146 compiler.returnVariable({ 144 147 expression: awaitSdkExpression, ··· 158 161 } 159 162 160 163 const statement = compiler.constVariable({ 161 - comment: plugin.comments 164 + comment: plugin.config.comments 162 165 ? createOperationComment({ operation }) 163 166 : undefined, 164 167 exportConst: true,
+6 -14
packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 3 + import { defaultTanStackQueryConfig } from '../query-core/config'; 2 4 import { handler } from '../query-core/plugin'; 3 5 import { handlerLegacy } from '../query-core/plugin-legacy'; 4 6 import type { Config } from './types'; ··· 7 9 _dependencies: ['@hey-api/sdk', '@hey-api/typescript'], 8 10 _handler: handler, 9 11 _handlerLegacy: handlerLegacy, 10 - comments: true, 11 - exportFromIndex: false, 12 - infiniteQueryKeyNameBuilder: '{{name}}InfiniteQueryKey', 13 - infiniteQueryOptions: true, 14 - infiniteQueryOptionsNameBuilder: '{{name}}InfiniteOptions', 15 - mutationOptions: true, 16 - mutationOptionsNameBuilder: '{{name}}Mutation', 12 + config: { 13 + ...defaultTanStackQueryConfig, 14 + }, 17 15 name: '@tanstack/react-query', 18 16 output: '@tanstack/react-query', 19 - queryKeyNameBuilder: '{{name}}QueryKey', 20 - queryOptions: true, 21 - queryOptionsNameBuilder: '{{name}}Options', 22 17 }; 23 18 24 19 /** 25 20 * Type helper for `@tanstack/react-query` plugin, returns {@link Plugin.Config} object 26 21 */ 27 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 28 - ...defaultConfig, 29 - ...config, 30 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+6 -14
packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 3 + import { defaultTanStackQueryConfig } from '../query-core/config'; 2 4 import { handler } from '../query-core/plugin'; 3 5 import { handlerLegacy } from '../query-core/plugin-legacy'; 4 6 import type { Config } from './types'; ··· 7 9 _dependencies: ['@hey-api/sdk', '@hey-api/typescript'], 8 10 _handler: handler, 9 11 _handlerLegacy: handlerLegacy, 10 - comments: true, 11 - exportFromIndex: false, 12 - infiniteQueryKeyNameBuilder: '{{name}}InfiniteQueryKey', 13 - infiniteQueryOptions: true, 14 - infiniteQueryOptionsNameBuilder: '{{name}}InfiniteOptions', 15 - mutationOptions: true, 16 - mutationOptionsNameBuilder: '{{name}}Mutation', 12 + config: { 13 + ...defaultTanStackQueryConfig, 14 + }, 17 15 name: '@tanstack/solid-query', 18 16 output: '@tanstack/solid-query', 19 - queryKeyNameBuilder: '{{name}}QueryKey', 20 - queryOptions: true, 21 - queryOptionsNameBuilder: '{{name}}Options', 22 17 }; 23 18 24 19 /** 25 20 * Type helper for `@tanstack/solid-query` plugin, returns {@link Plugin.Config} object 26 21 */ 27 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 28 - ...defaultConfig, 29 - ...config, 30 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+6 -14
packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 3 + import { defaultTanStackQueryConfig } from '../query-core/config'; 2 4 import { handler } from '../query-core/plugin'; 3 5 import { handlerLegacy } from '../query-core/plugin-legacy'; 4 6 import type { Config } from './types'; ··· 7 9 _dependencies: ['@hey-api/sdk', '@hey-api/typescript'], 8 10 _handler: handler, 9 11 _handlerLegacy: handlerLegacy, 10 - comments: true, 11 - exportFromIndex: false, 12 - infiniteQueryKeyNameBuilder: '{{name}}InfiniteQueryKey', 13 - infiniteQueryOptions: true, 14 - infiniteQueryOptionsNameBuilder: '{{name}}InfiniteOptions', 15 - mutationOptions: true, 16 - mutationOptionsNameBuilder: '{{name}}Mutation', 12 + config: { 13 + ...defaultTanStackQueryConfig, 14 + }, 17 15 name: '@tanstack/svelte-query', 18 16 output: '@tanstack/svelte-query', 19 - queryKeyNameBuilder: '{{name}}QueryKey', 20 - queryOptions: true, 21 - queryOptionsNameBuilder: '{{name}}Options', 22 17 }; 23 18 24 19 /** 25 20 * Type helper for `@tanstack/svelte-query` plugin, returns {@link Plugin.Config} object 26 21 */ 27 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 28 - ...defaultConfig, 29 - ...config, 30 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+6 -14
packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts
··· 1 + import { definePluginConfig } from '../../shared/utils/config'; 1 2 import type { Plugin } from '../../types'; 3 + import { defaultTanStackQueryConfig } from '../query-core/config'; 2 4 import { handler } from '../query-core/plugin'; 3 5 import { handlerLegacy } from '../query-core/plugin-legacy'; 4 6 import type { Config } from './types'; ··· 7 9 _dependencies: ['@hey-api/sdk', '@hey-api/typescript'], 8 10 _handler: handler, 9 11 _handlerLegacy: handlerLegacy, 10 - comments: true, 11 - exportFromIndex: false, 12 - infiniteQueryKeyNameBuilder: '{{name}}InfiniteQueryKey', 13 - infiniteQueryOptions: true, 14 - infiniteQueryOptionsNameBuilder: '{{name}}InfiniteOptions', 15 - mutationOptions: true, 16 - mutationOptionsNameBuilder: '{{name}}Mutation', 12 + config: { 13 + ...defaultTanStackQueryConfig, 14 + }, 17 15 name: '@tanstack/vue-query', 18 16 output: '@tanstack/vue-query', 19 - queryKeyNameBuilder: '{{name}}QueryKey', 20 - queryOptions: true, 21 - queryOptionsNameBuilder: '{{name}}Options', 22 17 }; 23 18 24 19 /** 25 20 * Type helper for `@tanstack/vue-query` plugin, returns {@link Plugin.Config} object 26 21 */ 27 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 28 - ...defaultConfig, 29 - ...config, 30 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+5 -5
packages/openapi-ts/src/plugins/fastify/config.ts
··· 1 + import { definePluginConfig } from '../shared/utils/config'; 1 2 import type { Plugin } from '../types'; 2 3 import { handler } from './plugin'; 3 4 import type { Config } from './types'; ··· 6 7 _dependencies: ['@hey-api/typescript'], 7 8 _handler: handler, 8 9 _handlerLegacy: () => {}, 9 - exportFromIndex: false, 10 + config: { 11 + exportFromIndex: false, 12 + }, 10 13 name: 'fastify', 11 14 output: 'fastify', 12 15 }; ··· 14 17 /** 15 18 * Type helper for `fastify` plugin, returns {@link Plugin.Config} object 16 19 */ 17 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 18 - ...defaultConfig, 19 - ...config, 20 - }); 20 + export const defineConfig = definePluginConfig(defaultConfig);
+1 -1
packages/openapi-ts/src/plugins/fastify/plugin.ts
··· 209 209 210 210 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 211 211 const file = context.createFile({ 212 - exportFromIndex: plugin.exportFromIndex, 212 + exportFromIndex: plugin.config.exportFromIndex, 213 213 id: fastifyId, 214 214 path: plugin.output, 215 215 });
+8 -2
packages/openapi-ts/src/plugins/index.ts
··· 71 71 defaultConfig as tanStackVueQuery, 72 72 } from './@tanstack/vue-query'; 73 73 import { type Config as Fastify, defaultConfig as fastify } from './fastify'; 74 - import type { DefaultPluginConfigs, Plugin } from './types'; 74 + import type { Plugin, PluginNames } from './types'; 75 75 import { type Config as Valibot, defaultConfig as valibot } from './valibot'; 76 76 import { type Config as Zod, defaultConfig as zod } from './zod'; 77 77 ··· 127 127 | Plugin.Config<Valibot> 128 128 | Plugin.Config<Zod>; 129 129 130 - export const defaultPluginConfigs: DefaultPluginConfigs<ClientPlugins> = { 130 + export const defaultPluginConfigs: { 131 + [K in PluginNames]: Plugin.Config<{ 132 + exportFromIndex?: any; 133 + name: any; 134 + output?: any; 135 + }>; 136 + } = { 131 137 '@hey-api/client-axios': heyApiClientAxios, 132 138 '@hey-api/client-fetch': heyApiClientFetch, 133 139 '@hey-api/client-next': heyApiClientNext,
+21
packages/openapi-ts/src/plugins/shared/utils/config.ts
··· 1 + import type { BaseConfig, Plugin } from '../../types'; 2 + 3 + export const definePluginConfig = 4 + <Config extends BaseConfig>(defaultConfig: Plugin.Config<Config>) => 5 + ( 6 + userConfig?: Omit<Plugin.UserConfig<Config>, 'name'>, 7 + ): Omit<Plugin.Config<Config>, 'name'> & { 8 + /** 9 + * Cast name to `any` so it doesn't throw type error in `plugins` array. 10 + * We could allow any `string` as plugin `name` in the object syntax, but 11 + * that TypeScript trick would cause all string methods to appear as 12 + * suggested auto completions, which is undesirable. 13 + */ 14 + name: any; 15 + } => ({ 16 + ...defaultConfig, 17 + config: { 18 + ...defaultConfig.config, 19 + ...userConfig, 20 + }, 21 + });
+1 -1
packages/openapi-ts/src/plugins/shared/utils/operation.ts
··· 37 37 const isNuxtClient = client.name === '@hey-api/client-nuxt'; 38 38 const plugin = context.config.plugins['@hey-api/sdk']; 39 39 return ( 40 - (plugin && !plugin.client && !plugin.instance) || 40 + (plugin && !plugin.config.client && !plugin.config.instance) || 41 41 isNuxtClient || 42 42 hasOperationDataRequired(operation) 43 43 );
+3 -1
packages/openapi-ts/src/plugins/shared/utils/ref.ts
··· 34 34 break; 35 35 } 36 36 let separate = true; 37 - if (config.plugins['@hey-api/typescript']?.identifierCase === 'preserve') { 37 + if ( 38 + config.plugins['@hey-api/typescript']?.config.identifierCase === 'preserve' 39 + ) { 38 40 separate = false; 39 41 } 40 42 const separator = separate ? '-' : '';
+12 -17
packages/openapi-ts/src/plugins/types.d.ts
··· 48 48 }) => AnyPluginName | undefined; 49 49 } 50 50 51 - interface BaseConfig { 51 + export interface BaseConfig { 52 52 /** 53 53 * Should the exports from the plugin's file be re-exported in the index 54 54 * barrel file? ··· 69 69 * defining `validator` as `true` and the plugin figures out which plugin 70 70 * should be used for validation. 71 71 */ 72 - _infer?: ( 73 - config: Config & Omit<Meta<Config>, '_infer'>, 74 - context: PluginContext, 75 - ) => void; 72 + _infer?: (config: Plugin.Config<Config>, context: PluginContext) => void; 76 73 /** 77 74 * Optional tags can be used to help with deciding plugin order and inferring 78 75 * plugin configuration options. 79 76 */ 80 77 _tags?: ReadonlyArray<PluginTag>; 81 78 } 82 - 83 - export type DefaultPluginConfigs<T> = { 84 - [K in PluginNames]: BaseConfig & 85 - Meta<any> & { 86 - _handler: Plugin.Handler<Required<Extract<T, { name: K }>>>; 87 - _handlerLegacy: Plugin.LegacyHandler<Required<Extract<T, { name: K }>>>; 88 - }; 89 - }; 90 79 91 80 /** 92 81 * Public Plugin API. 93 82 */ 94 83 export namespace Plugin { 95 - export type Config<Config extends BaseConfig> = Config & 84 + export type Config<Config extends BaseConfig> = Pick< 85 + Config, 86 + 'name' | 'output' 87 + > & 96 88 Meta<Config> & { 97 89 _handler: Plugin.Handler<Config>; 98 90 _handlerLegacy: Plugin.LegacyHandler<Config>; 99 - exportFromIndex?: boolean; 91 + config: Omit<Config, 'name' | 'output'>; 100 92 }; 101 93 94 + /** @deprecated - use `definePluginConfig()` instead */ 102 95 export type DefineConfig<Config extends BaseConfig> = ( 103 96 config?: Plugin.UserConfig<Omit<Config, 'name'>>, 104 97 ) => Omit<Plugin.Config<Config>, 'name'> & { ··· 119 112 plugin: Plugin.Instance<Config>; 120 113 }) => ReturnType; 121 114 122 - export type Instance<Config extends BaseConfig> = OmitUnderscoreKeys<Config> & 123 - Pick<Required<BaseConfig>, 'exportFromIndex' | 'output'>; 115 + export type Instance<Config extends BaseConfig> = OmitUnderscoreKeys< 116 + Plugin.Config<Config> 117 + > & 118 + Pick<Required<BaseConfig>, 'name' | 'output'>; 124 119 125 120 /** 126 121 * Plugin implementation for legacy parser.
+6 -6
packages/openapi-ts/src/plugins/valibot/config.ts
··· 1 + import { definePluginConfig } from '../shared/utils/config'; 1 2 import type { Plugin } from '../types'; 2 3 import { handler } from './plugin'; 3 4 import type { Config } from './types'; ··· 6 7 _handler: handler, 7 8 _handlerLegacy: () => {}, 8 9 _tags: ['validator'], 9 - comments: true, 10 - exportFromIndex: false, 10 + config: { 11 + comments: true, 12 + exportFromIndex: false, 13 + }, 11 14 name: 'valibot', 12 15 output: 'valibot', 13 16 }; ··· 15 18 /** 16 19 * Type helper for Valibot plugin, returns {@link Plugin.Config} object 17 20 */ 18 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 19 - ...defaultConfig, 20 - ...config, 21 - }); 21 + export const defineConfig = definePluginConfig(defaultConfig);
+4 -2
packages/openapi-ts/src/plugins/valibot/plugin.ts
··· 1141 1141 // emit nodes only if $ref points to a reusable component 1142 1142 if (identifier && identifier.name && identifier.created) { 1143 1143 const statement = compiler.constVariable({ 1144 - comment: plugin.comments ? createSchemaComment({ schema }) : undefined, 1144 + comment: plugin.config.comments 1145 + ? createSchemaComment({ schema }) 1146 + : undefined, 1145 1147 exportConst: true, 1146 1148 expression: pipesToExpression(pipes), 1147 1149 name: identifier.name, ··· 1162 1164 1163 1165 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 1164 1166 const file = context.createFile({ 1165 - exportFromIndex: plugin.exportFromIndex, 1167 + exportFromIndex: plugin.config.exportFromIndex, 1166 1168 id: valibotId, 1167 1169 identifierCase: 'camelCase', 1168 1170 path: plugin.output,
+7 -7
packages/openapi-ts/src/plugins/zod/config.ts
··· 1 + import { definePluginConfig } from '../shared/utils/config'; 1 2 import type { Plugin } from '../types'; 2 3 import { handler } from './plugin'; 3 4 import type { Config } from './types'; ··· 6 7 _handler: handler, 7 8 _handlerLegacy: () => {}, 8 9 _tags: ['validator'], 9 - comments: true, 10 - exportFromIndex: false, 11 - metadata: false, 10 + config: { 11 + comments: true, 12 + exportFromIndex: false, 13 + metadata: false, 14 + }, 12 15 name: 'zod', 13 16 output: 'zod', 14 17 }; ··· 16 19 /** 17 20 * Type helper for Zod plugin, returns {@link Plugin.Config} object 18 21 */ 19 - export const defineConfig: Plugin.DefineConfig<Config> = (config) => ({ 20 - ...defaultConfig, 21 - ...config, 22 - }); 22 + export const defineConfig = definePluginConfig(defaultConfig);
+5 -3
packages/openapi-ts/src/plugins/zod/plugin.ts
··· 997 997 anyType = zodSchema.anyType; 998 998 expression = zodSchema.expression; 999 999 1000 - if (plugin.metadata && schema.description) { 1000 + if (plugin.config.metadata && schema.description) { 1001 1001 expression = compiler.callExpression({ 1002 1002 functionName: compiler.propertyAccessExpression({ 1003 1003 expression, ··· 1126 1126 // emit nodes only if $ref points to a reusable component 1127 1127 if (identifier && identifier.name && identifier.created) { 1128 1128 const statement = compiler.constVariable({ 1129 - comment: plugin.comments ? createSchemaComment({ schema }) : undefined, 1129 + comment: plugin.config.comments 1130 + ? createSchemaComment({ schema }) 1131 + : undefined, 1130 1132 exportConst: true, 1131 1133 expression: expression!, 1132 1134 name: identifier.name, ··· 1145 1147 1146 1148 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 1147 1149 const file = context.createFile({ 1148 - exportFromIndex: plugin.exportFromIndex, 1150 + exportFromIndex: plugin.config.exportFromIndex, 1149 1151 id: zodId, 1150 1152 identifierCase: 'camelCase', 1151 1153 path: plugin.output,
+12 -2
packages/openapi-ts/src/utils/__tests__/handlebars.test.ts
··· 42 42 '@hey-api/schemas': { 43 43 _handler: () => {}, 44 44 _handlerLegacy: () => {}, 45 + config: {}, 45 46 name: '@hey-api/schemas', 46 47 }, 47 48 '@hey-api/sdk': { 48 49 _handler: () => {}, 49 50 _handlerLegacy: () => {}, 51 + config: {}, 50 52 name: '@hey-api/sdk', 51 53 }, 52 54 '@hey-api/typescript': { 53 55 _handler: () => {}, 54 56 _handlerLegacy: () => {}, 55 - enums: 'javascript', 57 + config: { 58 + enums: 'javascript', 59 + }, 56 60 name: '@hey-api/typescript', 57 61 }, 58 62 'legacy/fetch': { 59 63 _handler: () => {}, 60 64 _handlerLegacy: () => {}, 61 65 _tags: ['client'], 66 + config: {}, 62 67 name: 'legacy/fetch', 63 68 }, 64 69 }, ··· 110 115 '@hey-api/schemas': { 111 116 _handler: () => {}, 112 117 _handlerLegacy: () => {}, 118 + config: {}, 113 119 name: '@hey-api/schemas', 114 120 }, 115 121 '@hey-api/sdk': { 116 122 _handler: () => {}, 117 123 _handlerLegacy: () => {}, 124 + config: {}, 118 125 name: '@hey-api/sdk', 119 126 }, 120 127 '@hey-api/typescript': { 121 128 _handler: () => {}, 122 129 _handlerLegacy: () => {}, 123 - enums: 'javascript', 130 + config: { 131 + enums: 'javascript', 132 + }, 124 133 name: '@hey-api/typescript', 125 134 }, 126 135 'legacy/fetch': { 127 136 _handler: () => {}, 128 137 _handlerLegacy: () => {}, 129 138 _tags: ['client'], 139 + config: {}, 130 140 name: 'legacy/fetch', 131 141 }, 132 142 },
+23 -10
packages/openapi-ts/src/utils/__tests__/parse.test.ts
··· 31 31 '@hey-api/sdk': { 32 32 _handler: () => {}, 33 33 _handlerLegacy: () => {}, 34 + config: { 35 + operationId: true, 36 + response: 'body', 37 + }, 34 38 name: '@hey-api/sdk', 35 - operationId: true, 36 - response: 'body', 37 39 }, 38 40 'legacy/fetch': { 39 41 _handler: () => {}, 40 42 _handlerLegacy: () => {}, 41 43 _tags: ['client'], 44 + config: {}, 42 45 name: 'legacy/fetch', 43 46 }, 44 47 }, ··· 52 55 '@hey-api/sdk': { 53 56 _handler: () => {}, 54 57 _handlerLegacy: () => {}, 58 + config: { 59 + operationId: true, 60 + response: 'body', 61 + }, 55 62 name: '@hey-api/sdk', 56 - operationId: true, 57 - response: 'body', 58 63 }, 59 64 }, 60 65 }; ··· 66 71 '@hey-api/sdk': { 67 72 _handler: () => {}, 68 73 _handlerLegacy: () => {}, 74 + config: { 75 + operationId: false, 76 + response: 'body', 77 + }, 69 78 name: '@hey-api/sdk', 70 - operationId: false, 71 - response: 'body', 72 79 }, 73 80 }, 74 81 }; ··· 81 88 _handler: () => {}, 82 89 _handlerLegacy: () => {}, 83 90 _tags: ['client'], 91 + config: {}, 84 92 name: '@hey-api/client-fetch', 85 93 }, 86 94 '@hey-api/sdk': { 87 95 _handler: () => {}, 88 96 _handlerLegacy: () => {}, 97 + config: { 98 + operationId: true, 99 + response: 'body', 100 + }, 89 101 name: '@hey-api/sdk', 90 - operationId: true, 91 - response: 'body', 92 102 }, 93 103 }, 94 104 }; ··· 101 111 _handler: () => {}, 102 112 _handlerLegacy: () => {}, 103 113 _tags: ['client'], 114 + config: {}, 104 115 name: '@hey-api/client-fetch', 105 116 }, 106 117 '@hey-api/sdk': { 107 118 _handler: () => {}, 108 119 _handlerLegacy: () => {}, 120 + config: { 121 + operationId: false, 122 + response: 'body', 123 + }, 109 124 name: '@hey-api/sdk', 110 - operationId: false, 111 - response: 'body', 112 125 }, 113 126 }, 114 127 };
+1 -1
packages/openapi-ts/src/utils/handlebars.ts
··· 118 118 Handlebars.registerHelper( 119 119 'ifServicesResponse', 120 120 function (this: unknown, value: string, options: Handlebars.HelperOptions) { 121 - return getConfig().plugins['@hey-api/sdk']?.response === value 121 + return getConfig().plugins['@hey-api/sdk']?.config.response === value 122 122 ? options.fn(this) 123 123 : options.inverse(this); 124 124 },
+2 -1
packages/openapi-ts/src/utils/postprocess.ts
··· 52 52 operations.forEach((parserOperation) => { 53 53 const tags = 54 54 parserOperation.tags?.length && 55 - (config.plugins['@hey-api/sdk']?.asClass || legacyNameFromConfig(config)) 55 + (config.plugins['@hey-api/sdk']?.config.asClass || 56 + legacyNameFromConfig(config)) 56 57 ? parserOperation.tags.filter(unique) 57 58 : ['Default']; 58 59 tags.forEach((tag) => {
+5 -5
packages/openapi-ts/src/utils/transform.ts
··· 12 12 name: string; 13 13 }) => { 14 14 const plugin = config.plugins['@hey-api/sdk']; 15 - if (plugin?.classNameBuilder) { 15 + if (plugin?.config.classNameBuilder) { 16 16 let customName = ''; 17 17 18 - if (typeof plugin.classNameBuilder === 'function') { 19 - customName = plugin.classNameBuilder(name); 18 + if (typeof plugin.config.classNameBuilder === 'function') { 19 + customName = plugin.config.classNameBuilder(name); 20 20 } else { 21 - customName = plugin.classNameBuilder.replace('{{name}}', name); 21 + customName = plugin.config.classNameBuilder.replace('{{name}}', name); 22 22 } 23 23 24 24 return customName; ··· 29 29 30 30 export const transformTypeName = (name: string) => { 31 31 const config = getConfig(); 32 - if (config.plugins['@hey-api/typescript']?.style === 'PascalCase') { 32 + if (config.plugins['@hey-api/typescript']?.config.style === 'PascalCase') { 33 33 return stringCase({ 34 34 case: 'PascalCase', 35 35 value: name,
+4 -1
packages/openapi-ts/src/utils/type.ts
··· 25 25 }); 26 26 } 27 27 28 - if (config.plugins['@hey-api/transformers']?.dates && isModelDate(model)) { 28 + if ( 29 + config.plugins['@hey-api/transformers']?.config.dates && 30 + isModelDate(model) 31 + ) { 29 32 return compiler.typeNode('Date'); 30 33 } 31 34
+267 -41
pnpm-lock.yaml
··· 828 828 version: 3.3.2 829 829 nuxt: 830 830 specifier: 3.14.1592 831 - version: 3.14.1592(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.1)(encoding@0.1.13)(eslint@9.17.0(jiti@2.4.2))(ioredis@5.6.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.41.1)(sass@1.85.0)(terser@5.39.0)(typescript@5.8.3)(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)) 831 + version: 3.14.1592(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.1)(encoding@0.1.13)(eslint@9.17.0(jiti@2.4.2))(ioredis@5.6.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.41.1)(sass@1.85.0)(terser@5.39.0)(typescript@5.8.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)) 832 832 prettier: 833 833 specifier: 3.4.2 834 834 version: 3.4.2 ··· 12143 12143 dependencies: 12144 12144 '@ampproject/remapping': 2.3.0 12145 12145 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) 12146 - '@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)) 12146 + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.2)))(webpack@5.98.0(esbuild@0.25.0)) 12147 12147 '@angular-devkit/core': 19.2.0(chokidar@4.0.3) 12148 12148 '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.4.2)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.9(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.0) 12149 12149 '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.8.3) ··· 12193 12193 tree-kill: 1.2.2 12194 12194 tslib: 2.8.1 12195 12195 typescript: 5.8.3 12196 - webpack: 5.98.0(esbuild@0.25.2) 12197 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 12198 - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) 12196 + webpack: 5.98.0(esbuild@0.25.0) 12197 + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.2)) 12198 + webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.2)) 12199 12199 webpack-merge: 6.0.1 12200 12200 webpack-subresource-integrity: 5.1.0(webpack@5.98.0(esbuild@0.25.0)) 12201 12201 optionalDependencies: ··· 12229 12229 dependencies: 12230 12230 '@ampproject/remapping': 2.3.0 12231 12231 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) 12232 - '@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)) 12232 + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.2)))(webpack@5.98.0(esbuild@0.25.0)) 12233 12233 '@angular-devkit/core': 19.2.0(chokidar@4.0.3) 12234 12234 '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.4.2)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.9(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.0) 12235 12235 '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.8.3) ··· 12279 12279 tree-kill: 1.2.2 12280 12280 tslib: 2.8.1 12281 12281 typescript: 5.8.3 12282 - webpack: 5.98.0(esbuild@0.25.2) 12283 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 12284 - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) 12282 + webpack: 5.98.0(esbuild@0.25.0) 12283 + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.2)) 12284 + webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.2)) 12285 12285 webpack-merge: 6.0.1 12286 12286 webpack-subresource-integrity: 5.1.0(webpack@5.98.0(esbuild@0.25.0)) 12287 12287 optionalDependencies: ··· 12311 12311 - webpack-cli 12312 12312 - yaml 12313 12313 12314 - '@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))': 12314 + '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.2)))(webpack@5.98.0(esbuild@0.25.0))': 12315 12315 dependencies: 12316 12316 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) 12317 12317 rxjs: 7.8.1 12318 - webpack: 5.98.0(esbuild@0.25.2) 12319 - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) 12318 + webpack: 5.98.0(esbuild@0.25.0) 12319 + webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.2)) 12320 12320 transitivePeerDependencies: 12321 12321 - chokidar 12322 12322 ··· 14511 14511 dependencies: 14512 14512 '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.8.3) 14513 14513 typescript: 5.8.3 14514 - webpack: 5.98.0(esbuild@0.25.2) 14514 + webpack: 5.98.0(esbuild@0.25.0) 14515 14515 14516 14516 '@nodelib/fs.scandir@2.1.5': 14517 14517 dependencies: ··· 14588 14588 14589 14589 '@nuxt/devalue@2.0.2': {} 14590 14590 14591 + '@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.39.0))': 14592 + dependencies: 14593 + '@nuxt/kit': 3.15.4(magicast@0.3.5) 14594 + '@nuxt/schema': 3.16.2 14595 + execa: 7.2.0 14596 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0) 14597 + transitivePeerDependencies: 14598 + - magicast 14599 + - supports-color 14600 + 14591 14601 '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0))': 14592 14602 dependencies: 14593 14603 '@nuxt/kit': 3.15.4(magicast@0.3.5) ··· 14658 14668 - utf-8-validate 14659 14669 - vue 14660 14670 14671 + '@nuxt/devtools@1.7.0(rollup@4.41.1)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0))(vue@3.5.13(typescript@5.8.3))': 14672 + dependencies: 14673 + '@antfu/utils': 0.7.10 14674 + '@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.39.0)) 14675 + '@nuxt/devtools-wizard': 1.7.0 14676 + '@nuxt/kit': 3.15.4(magicast@0.3.5) 14677 + '@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.39.0))(vue@3.5.13(typescript@5.8.3)) 14678 + '@vue/devtools-kit': 7.6.8 14679 + birpc: 0.2.19 14680 + consola: 3.4.2 14681 + cronstrue: 2.56.0 14682 + destr: 2.0.3 14683 + error-stack-parser-es: 0.1.5 14684 + execa: 7.2.0 14685 + fast-npm-meta: 0.2.2 14686 + flatted: 3.3.3 14687 + get-port-please: 3.1.2 14688 + hookable: 5.5.3 14689 + image-meta: 0.2.1 14690 + is-installed-globally: 1.0.0 14691 + launch-editor: 2.10.0 14692 + local-pkg: 0.5.1 14693 + magicast: 0.3.5 14694 + nypm: 0.4.1 14695 + ohash: 1.1.6 14696 + pathe: 1.1.2 14697 + perfect-debounce: 1.0.0 14698 + pkg-types: 1.3.1 14699 + rc9: 2.1.2 14700 + scule: 1.3.0 14701 + semver: 7.7.1 14702 + simple-git: 3.27.0 14703 + sirv: 3.0.1 14704 + tinyglobby: 0.2.12 14705 + unimport: 3.14.6(rollup@4.41.1) 14706 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0) 14707 + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.41.1)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)) 14708 + vite-plugin-vue-inspector: 5.3.1(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)) 14709 + which: 3.0.1 14710 + ws: 8.18.1 14711 + transitivePeerDependencies: 14712 + - bufferutil 14713 + - rollup 14714 + - supports-color 14715 + - utf-8-validate 14716 + - vue 14717 + 14661 14718 '@nuxt/devtools@1.7.0(rollup@4.41.1)(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3))': 14662 14719 dependencies: 14663 14720 '@antfu/utils': 0.7.10 ··· 16995 17052 dependencies: 16996 17053 '@vue/devtools-kit': 7.7.2 16997 17054 17055 + '@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.39.0))(vue@3.5.13(typescript@5.8.3))': 17056 + dependencies: 17057 + '@vue/devtools-kit': 7.7.2 17058 + '@vue/devtools-shared': 7.7.2 17059 + mitt: 3.0.1 17060 + nanoid: 5.1.5 17061 + pathe: 1.1.2 17062 + 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.39.0)) 17063 + vue: 3.5.13(typescript@5.8.3) 17064 + transitivePeerDependencies: 17065 + - vite 17066 + 16998 17067 '@vue/devtools-core@7.6.8(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3))': 16999 17068 dependencies: 17000 17069 '@vue/devtools-kit': 7.7.2 ··· 17550 17619 '@babel/core': 7.26.9 17551 17620 find-cache-dir: 4.0.0 17552 17621 schema-utils: 4.3.0 17553 - webpack: 5.98.0(esbuild@0.25.2) 17622 + webpack: 5.98.0(esbuild@0.25.0) 17554 17623 17555 17624 babel-plugin-polyfill-corejs2@0.4.12(@babel/core@7.26.9): 17556 17625 dependencies: ··· 18084 18153 normalize-path: 3.0.0 18085 18154 schema-utils: 4.3.0 18086 18155 serialize-javascript: 6.0.2 18087 - webpack: 5.98.0(esbuild@0.25.2) 18156 + webpack: 5.98.0(esbuild@0.25.0) 18088 18157 18089 18158 core-js-compat@3.41.0: 18090 18159 dependencies: ··· 18156 18225 postcss-value-parser: 4.2.0 18157 18226 semver: 7.7.1 18158 18227 optionalDependencies: 18159 - webpack: 5.98.0(esbuild@0.25.2) 18228 + webpack: 5.98.0(esbuild@0.25.0) 18160 18229 18161 18230 css-select@5.1.0: 18162 18231 dependencies: ··· 18824 18893 '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3) 18825 18894 eslint: 9.17.0(jiti@2.4.2) 18826 18895 eslint-import-resolver-node: 0.3.9 18827 - eslint-import-resolver-typescript: 3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)) 18828 - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)) 18896 + eslint-import-resolver-typescript: 3.8.5(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@2.4.2)) 18897 + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.8.5)(eslint@9.17.0(jiti@2.4.2)) 18829 18898 eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@2.4.2)) 18830 18899 eslint-plugin-react: 7.37.4(eslint@9.17.0(jiti@2.4.2)) 18831 18900 eslint-plugin-react-hooks: 5.2.0(eslint@9.17.0(jiti@2.4.2)) ··· 18848 18917 transitivePeerDependencies: 18849 18918 - supports-color 18850 18919 18851 - eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)): 18920 + eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@2.4.2)): 18852 18921 dependencies: 18853 18922 '@nolyfill/is-core-module': 1.0.39 18854 18923 debug: 4.4.0(supports-color@9.4.0) ··· 18859 18928 stable-hash: 0.0.4 18860 18929 tinyglobby: 0.2.12 18861 18930 optionalDependencies: 18862 - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)) 18931 + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.8.5)(eslint@9.17.0(jiti@2.4.2)) 18863 18932 transitivePeerDependencies: 18864 18933 - supports-color 18865 18934 18866 - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)): 18935 + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.5)(eslint@9.17.0(jiti@2.4.2)): 18867 18936 dependencies: 18868 18937 debug: 3.2.7 18869 18938 optionalDependencies: 18870 18939 '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3) 18871 18940 eslint: 9.17.0(jiti@2.4.2) 18872 18941 eslint-import-resolver-node: 0.3.9 18873 - eslint-import-resolver-typescript: 3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)) 18942 + eslint-import-resolver-typescript: 3.8.5(eslint-plugin-import@2.31.0)(eslint@9.17.0(jiti@2.4.2)) 18874 18943 transitivePeerDependencies: 18875 18944 - supports-color 18876 18945 18877 - eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)): 18946 + eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.8.5)(eslint@9.17.0(jiti@2.4.2)): 18878 18947 dependencies: 18879 18948 '@rtsao/scc': 1.1.0 18880 18949 array-includes: 3.1.8 ··· 18885 18954 doctrine: 2.1.0 18886 18955 eslint: 9.17.0(jiti@2.4.2) 18887 18956 eslint-import-resolver-node: 0.3.9 18888 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.5(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)))(eslint@9.17.0(jiti@2.4.2)) 18957 + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.5)(eslint@9.17.0(jiti@2.4.2)) 18889 18958 hasown: 2.0.2 18890 18959 is-core-module: 2.16.1 18891 18960 is-glob: 4.0.3 ··· 20511 20580 dependencies: 20512 20581 less: 4.2.2 20513 20582 optionalDependencies: 20514 - webpack: 5.98.0(esbuild@0.25.2) 20583 + webpack: 5.98.0(esbuild@0.25.0) 20515 20584 20516 20585 less@4.2.2: 20517 20586 dependencies: ··· 20536 20605 dependencies: 20537 20606 webpack-sources: 3.2.3 20538 20607 optionalDependencies: 20539 - webpack: 5.98.0(esbuild@0.25.2) 20608 + webpack: 5.98.0(esbuild@0.25.0) 20540 20609 20541 20610 light-my-request@6.6.0: 20542 20611 dependencies: ··· 20864 20933 dependencies: 20865 20934 schema-utils: 4.3.0 20866 20935 tapable: 2.2.1 20867 - webpack: 5.98.0(esbuild@0.25.2) 20936 + webpack: 5.98.0(esbuild@0.25.0) 20868 20937 20869 20938 minimalistic-assert@1.0.1: {} 20870 20939 ··· 21432 21501 - vue-tsc 21433 21502 - xml2js 21434 21503 21504 + nuxt@3.14.1592(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.1)(encoding@0.1.13)(eslint@9.17.0(jiti@2.4.2))(ioredis@5.6.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.41.1)(sass@1.85.0)(terser@5.39.0)(typescript@5.8.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)): 21505 + dependencies: 21506 + '@nuxt/devalue': 2.0.2 21507 + '@nuxt/devtools': 1.7.0(rollup@4.41.1)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0))(vue@3.5.13(typescript@5.8.3)) 21508 + '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.41.1) 21509 + '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.41.1) 21510 + '@nuxt/telemetry': 2.6.5(magicast@0.3.5) 21511 + '@nuxt/vite-builder': 3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.4.2))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.41.1)(sass@1.85.0)(terser@5.39.0)(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) 21512 + '@unhead/dom': 1.11.20 21513 + '@unhead/shared': 1.11.20 21514 + '@unhead/ssr': 1.11.20 21515 + '@unhead/vue': 1.11.20(vue@3.5.13(typescript@5.8.3)) 21516 + '@vue/shared': 3.5.13 21517 + acorn: 8.14.0 21518 + c12: 2.0.1(magicast@0.3.5) 21519 + chokidar: 4.0.3 21520 + compatx: 0.1.8 21521 + consola: 3.4.2 21522 + cookie-es: 1.2.2 21523 + defu: 6.1.4 21524 + destr: 2.0.3 21525 + devalue: 5.1.1 21526 + errx: 0.1.0 21527 + esbuild: 0.24.2 21528 + escape-string-regexp: 5.0.0 21529 + estree-walker: 3.0.3 21530 + globby: 14.1.0 21531 + h3: 1.15.1 21532 + hookable: 5.5.3 21533 + ignore: 6.0.2 21534 + impound: 0.2.2(rollup@4.41.1) 21535 + jiti: 2.4.2 21536 + klona: 2.0.6 21537 + knitwork: 1.2.0 21538 + magic-string: 0.30.17 21539 + mlly: 1.7.4 21540 + nanotar: 0.1.1 21541 + nitropack: 2.11.6(encoding@0.1.13)(typescript@5.8.3) 21542 + nuxi: 3.22.5 21543 + nypm: 0.3.12 21544 + ofetch: 1.4.1 21545 + ohash: 1.1.6 21546 + pathe: 1.1.2 21547 + perfect-debounce: 1.0.0 21548 + pkg-types: 1.3.1 21549 + radix3: 1.1.2 21550 + scule: 1.3.0 21551 + semver: 7.7.1 21552 + std-env: 3.8.1 21553 + strip-literal: 2.1.1 21554 + tinyglobby: 0.2.10 21555 + ufo: 1.5.4 21556 + ultrahtml: 1.5.3 21557 + uncrypto: 0.1.3 21558 + unctx: 2.4.1 21559 + unenv: 1.10.0 21560 + unhead: 1.11.20 21561 + unimport: 3.14.6(rollup@4.41.1) 21562 + unplugin: 1.16.1 21563 + unplugin-vue-router: 0.10.9(rollup@4.41.1)(vue-router@4.5.0(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3)) 21564 + unstorage: 1.15.0(db0@0.3.1)(ioredis@5.6.0) 21565 + untyped: 1.5.2 21566 + vue: 3.5.13(typescript@5.8.3) 21567 + vue-bundle-renderer: 2.1.1 21568 + vue-devtools-stub: 0.1.0 21569 + vue-router: 4.5.0(vue@3.5.13(typescript@5.8.3)) 21570 + optionalDependencies: 21571 + '@parcel/watcher': 2.5.1 21572 + '@types/node': 22.10.5 21573 + transitivePeerDependencies: 21574 + - '@azure/app-configuration' 21575 + - '@azure/cosmos' 21576 + - '@azure/data-tables' 21577 + - '@azure/identity' 21578 + - '@azure/keyvault-secrets' 21579 + - '@azure/storage-blob' 21580 + - '@biomejs/biome' 21581 + - '@capacitor/preferences' 21582 + - '@deno/kv' 21583 + - '@electric-sql/pglite' 21584 + - '@libsql/client' 21585 + - '@netlify/blobs' 21586 + - '@planetscale/database' 21587 + - '@upstash/redis' 21588 + - '@vercel/blob' 21589 + - '@vercel/kv' 21590 + - aws4fetch 21591 + - better-sqlite3 21592 + - bufferutil 21593 + - db0 21594 + - drizzle-orm 21595 + - encoding 21596 + - eslint 21597 + - idb-keyval 21598 + - ioredis 21599 + - less 21600 + - lightningcss 21601 + - magicast 21602 + - meow 21603 + - mysql2 21604 + - optionator 21605 + - rolldown 21606 + - rollup 21607 + - sass 21608 + - sass-embedded 21609 + - sqlite3 21610 + - stylelint 21611 + - stylus 21612 + - sugarss 21613 + - supports-color 21614 + - terser 21615 + - typescript 21616 + - uploadthing 21617 + - utf-8-validate 21618 + - vite 21619 + - vls 21620 + - vti 21621 + - vue-tsc 21622 + - xml2js 21623 + 21435 21624 nuxt@3.14.1592(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.1)(encoding@0.1.13)(eslint@9.17.0(jiti@2.4.2))(ioredis@5.6.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.41.1)(sass@1.85.0)(terser@5.39.0)(typescript@5.8.3)(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)): 21436 21625 dependencies: 21437 21626 '@nuxt/devalue': 2.0.2 ··· 22074 22263 postcss: 8.5.2 22075 22264 semver: 7.7.1 22076 22265 optionalDependencies: 22077 - webpack: 5.98.0(esbuild@0.25.2) 22266 + webpack: 5.98.0(esbuild@0.25.0) 22078 22267 transitivePeerDependencies: 22079 22268 - typescript 22080 22269 ··· 22831 23020 neo-async: 2.6.2 22832 23021 optionalDependencies: 22833 23022 sass: 1.85.0 22834 - webpack: 5.98.0(esbuild@0.25.2) 23023 + webpack: 5.98.0(esbuild@0.25.0) 22835 23024 22836 23025 sass@1.85.0: 22837 23026 dependencies: ··· 23171 23360 dependencies: 23172 23361 iconv-lite: 0.6.3 23173 23362 source-map-js: 1.2.1 23174 - webpack: 5.98.0(esbuild@0.25.2) 23363 + webpack: 5.98.0(esbuild@0.25.0) 23175 23364 23176 23365 source-map-support@0.5.21: 23177 23366 dependencies: ··· 23552 23741 23553 23742 term-size@2.2.1: {} 23554 23743 23555 - terser-webpack-plugin@5.3.14(esbuild@0.25.2)(webpack@5.98.0(esbuild@0.25.0)): 23744 + terser-webpack-plugin@5.3.14(esbuild@0.25.0)(webpack@5.98.0(esbuild@0.25.2)): 23556 23745 dependencies: 23557 23746 '@jridgewell/trace-mapping': 0.3.25 23558 23747 jest-worker: 27.5.1 23559 23748 schema-utils: 4.3.0 23560 23749 serialize-javascript: 6.0.2 23561 23750 terser: 5.39.0 23562 - webpack: 5.98.0(esbuild@0.25.2) 23751 + webpack: 5.98.0(esbuild@0.25.0) 23563 23752 optionalDependencies: 23564 - esbuild: 0.25.2 23753 + esbuild: 0.25.0 23565 23754 23566 23755 terser@5.39.0: 23567 23756 dependencies: ··· 24240 24429 '@types/unist': 3.0.3 24241 24430 vfile-message: 4.0.2 24242 24431 24432 + 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.39.0)): 24433 + dependencies: 24434 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0) 24435 + 24243 24436 vite-hot-client@0.2.4(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)): 24244 24437 dependencies: 24245 24438 vite: 6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0) ··· 24323 24516 - rollup 24324 24517 - supports-color 24325 24518 24519 + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.41.1)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)): 24520 + dependencies: 24521 + '@antfu/utils': 0.7.10 24522 + '@rollup/pluginutils': 5.1.4(rollup@4.41.1) 24523 + debug: 4.4.0(supports-color@9.4.0) 24524 + error-stack-parser-es: 0.1.5 24525 + fs-extra: 11.3.0 24526 + open: 10.1.0 24527 + perfect-debounce: 1.0.0 24528 + picocolors: 1.1.1 24529 + sirv: 3.0.1 24530 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0) 24531 + optionalDependencies: 24532 + '@nuxt/kit': 3.15.4(magicast@0.3.5) 24533 + transitivePeerDependencies: 24534 + - rollup 24535 + - supports-color 24536 + 24326 24537 vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.41.1)(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)): 24327 24538 dependencies: 24328 24539 '@antfu/utils': 0.7.10 ··· 24356 24567 - rollup 24357 24568 - supports-color 24358 24569 - vue 24570 + 24571 + vite-plugin-vue-inspector@5.3.1(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)): 24572 + dependencies: 24573 + '@babel/core': 7.26.10 24574 + '@babel/plugin-proposal-decorators': 7.25.9(@babel/core@7.26.10) 24575 + '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/core@7.26.10) 24576 + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.26.10) 24577 + '@babel/plugin-transform-typescript': 7.26.8(@babel/core@7.26.10) 24578 + '@vue/babel-plugin-jsx': 1.4.0(@babel/core@7.26.10) 24579 + '@vue/compiler-dom': 3.5.13 24580 + kolorist: 1.8.0 24581 + magic-string: 0.30.17 24582 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.39.0) 24583 + transitivePeerDependencies: 24584 + - supports-color 24359 24585 24360 24586 vite-plugin-vue-inspector@5.3.1(vite@6.2.7(@types/node@22.10.5)(jiti@2.4.2)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)): 24361 24587 dependencies: ··· 24642 24868 24643 24869 webidl-conversions@7.0.0: {} 24644 24870 24645 - webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.0)): 24871 + webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.2)): 24646 24872 dependencies: 24647 24873 colorette: 2.0.20 24648 24874 memfs: 4.17.0 ··· 24651 24877 range-parser: 1.2.1 24652 24878 schema-utils: 4.3.0 24653 24879 optionalDependencies: 24654 - webpack: 5.98.0(esbuild@0.25.2) 24880 + webpack: 5.98.0(esbuild@0.25.0) 24655 24881 24656 - webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)): 24882 + webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.2)): 24657 24883 dependencies: 24658 24884 '@types/bonjour': 3.5.13 24659 24885 '@types/connect-history-api-fallback': 1.5.4 ··· 24680 24906 serve-index: 1.9.1 24681 24907 sockjs: 0.3.24 24682 24908 spdy: 4.0.2 24683 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 24909 + webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.2)) 24684 24910 ws: 8.18.1 24685 24911 optionalDependencies: 24686 - webpack: 5.98.0(esbuild@0.25.2) 24912 + webpack: 5.98.0(esbuild@0.25.0) 24687 24913 transitivePeerDependencies: 24688 24914 - bufferutil 24689 24915 - debug ··· 24701 24927 webpack-subresource-integrity@5.1.0(webpack@5.98.0(esbuild@0.25.0)): 24702 24928 dependencies: 24703 24929 typed-assert: 1.0.9 24704 - webpack: 5.98.0(esbuild@0.25.2) 24930 + webpack: 5.98.0(esbuild@0.25.0) 24705 24931 24706 24932 webpack-virtual-modules@0.6.2: {} 24707 24933 24708 - webpack@5.98.0(esbuild@0.25.2): 24934 + webpack@5.98.0(esbuild@0.25.0): 24709 24935 dependencies: 24710 24936 '@types/eslint-scope': 3.7.7 24711 24937 '@types/estree': 1.0.6 ··· 24727 24953 neo-async: 2.6.2 24728 24954 schema-utils: 4.3.0 24729 24955 tapable: 2.2.1 24730 - terser-webpack-plugin: 5.3.14(esbuild@0.25.2)(webpack@5.98.0(esbuild@0.25.0)) 24956 + terser-webpack-plugin: 5.3.14(esbuild@0.25.0)(webpack@5.98.0(esbuild@0.25.2)) 24731 24957 watchpack: 2.4.2 24732 24958 webpack-sources: 3.2.3 24733 24959 transitivePeerDependencies: