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

Merge pull request #2882 from hey-api/refactor/selector-tanstack-query

refactor: remove selectors from tanstack query plugins

authored by

Lubos and committed by
GitHub
4bf4e946 56f3a250

+190 -306
+2
packages/openapi-ts/src/index.ts
··· 18 18 category?: 19 19 | 'client' 20 20 | 'external' 21 + | 'hook' 21 22 | 'schema' 22 23 | 'sdk' 23 24 | 'type' 25 + | 'utility' 24 26 | (string & {}); 25 27 /** 26 28 * Path to the resource this symbol represents.
-8
packages/openapi-ts/src/plugins/@pinia/colada/api.ts
··· 4 4 5 5 type SelectorType = 6 6 | '_JSONValue' 7 - | 'AxiosError' 8 - | 'createQueryKey' 9 7 | 'defineQueryOptions' 10 - | 'QueryKey' 11 - | 'queryOptionsFn' 12 8 | 'serializeQueryKeyValue' 13 9 | 'UseMutationOptions' 14 10 | 'UseQueryOptions'; ··· 18 14 * @param type Selector type. 19 15 * @param value Depends on `type`: 20 16 * - `_JSONValue`: never 21 - * - `AxiosError`: never 22 - * - `createQueryKey`: never 23 17 * - `defineQueryOptions`: never 24 - * - `QueryKey`: never 25 - * - `queryOptionsFn`: `operation.id` string 26 18 * - `serializeQueryKeyValue`: never 27 19 * - `UseMutationOptions`: never 28 20 * - `UseQueryOptions`: never
+4 -1
packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts
··· 27 27 plugin.registerSymbol({ 28 28 external: 'axios', 29 29 kind: 'type', 30 + meta: { 31 + category: 'external', 32 + resource: 'axios.AxiosError', 33 + }, 30 34 name: 'AxiosError', 31 - selector: plugin.api.selector('AxiosError'), 32 35 }); 33 36 34 37 const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');
+20 -8
packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts
··· 22 22 plugin: PiniaColadaPlugin['Instance']; 23 23 }) => { 24 24 const symbolCreateQueryKey = plugin.registerSymbol({ 25 + meta: { 26 + category: 'utility', 27 + resource: 'createQueryKey', 28 + tool: plugin.name, 29 + }, 25 30 name: buildName({ 26 31 config: { 27 32 case: plugin.config.case, 28 33 }, 29 34 name: 'createQueryKey', 30 35 }), 31 - selector: plugin.api.selector('createQueryKey'), 32 36 }); 33 - const symbolQueryKeyType = plugin.referenceSymbol( 34 - plugin.api.selector('QueryKey'), 35 - ); 37 + const symbolQueryKeyType = plugin.referenceSymbol({ 38 + category: 'type', 39 + resource: 'QueryKey', 40 + tool: plugin.name, 41 + }); 36 42 const symbolJsonValue = plugin.referenceSymbol( 37 43 plugin.api.selector('_JSONValue'), 38 44 ); ··· 281 287 }); 282 288 } 283 289 284 - const symbolCreateQueryKey = plugin.referenceSymbol( 285 - plugin.api.selector('createQueryKey'), 286 - ); 290 + const symbolCreateQueryKey = plugin.referenceSymbol({ 291 + category: 'utility', 292 + resource: 'createQueryKey', 293 + tool: plugin.name, 294 + }); 287 295 const createQueryKeyCallExpression = tsc.callExpression({ 288 296 functionName: symbolCreateQueryKey.placeholder, 289 297 parameters: [tsc.ots.string(id), 'options', tagsExpression], ··· 331 339 const symbolQueryKeyType = plugin.registerSymbol({ 332 340 exported: true, 333 341 kind: 'type', 342 + meta: { 343 + category: 'type', 344 + resource: 'QueryKey', 345 + tool: plugin.name, 346 + }, 334 347 name: 'QueryKey', 335 - selector: plugin.api.selector('QueryKey'), 336 348 }); 337 349 const queryKeyType = tsc.typeAliasDeclaration({ 338 350 exportType: symbolQueryKeyType.exported,
+19 -5
packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts
··· 39 39 context: plugin.context, 40 40 operation, 41 41 }); 42 - if (!plugin.getSymbol(plugin.api.selector('createQueryKey'))) { 42 + if ( 43 + !plugin.getSymbol({ 44 + category: 'utility', 45 + resource: 'createQueryKey', 46 + tool: plugin.name, 47 + }) 48 + ) { 43 49 createQueryKeyType({ plugin }); 44 50 createQueryKeyFunction({ plugin }); 45 51 } ··· 64 70 parameters: [optionsParamName], 65 71 }); 66 72 } else { 67 - const symbolCreateQueryKey = plugin.referenceSymbol( 68 - plugin.api.selector('createQueryKey'), 69 - ); 73 + const symbolCreateQueryKey = plugin.referenceSymbol({ 74 + category: 'utility', 75 + resource: 'createQueryKey', 76 + tool: plugin.name, 77 + }); 70 78 // Optionally include tags when configured 71 79 let tagsExpr: ts.Expression | undefined; 72 80 if ( ··· 151 159 152 160 const symbolQueryOptionsFn = plugin.registerSymbol({ 153 161 exported: true, 162 + meta: { 163 + category: 'hook', 164 + resource: 'operation', 165 + resourceId: operation.id, 166 + role: 'queryOptions', 167 + tool: plugin.name, 168 + }, 154 169 name: buildName({ 155 170 config: plugin.config.queryOptions, 156 171 name: operation.id, 157 172 }), 158 - selector: plugin.api.selector('queryOptionsFn', operation.id), 159 173 }); 160 174 const symbolDefineQueryOptions = plugin.registerSymbol({ 161 175 external: plugin.name,
+4 -1
packages/openapi-ts/src/plugins/@pinia/colada/useType.ts
··· 37 37 typeErrorName = 'Error'; 38 38 } 39 39 if (client.name === '@hey-api/client-axios') { 40 - const symbol = plugin.referenceSymbol(plugin.api.selector('AxiosError')); 40 + const symbol = plugin.referenceSymbol({ 41 + category: 'external', 42 + resource: 'axios.AxiosError', 43 + }); 41 44 typeErrorName = `${symbol.placeholder}<${typeErrorName}>`; 42 45 } 43 46 return typeErrorName;
+2 -46
packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 - 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 6 - | 'AxiosError' 7 - | 'createInfiniteParams' 8 - | 'createQueryKey' 9 - | 'DefaultError' 10 - | 'infiniteQueryOptions' 11 - | 'InfiniteData' 12 - | 'MutationOptions' 13 - | 'queryOptions' 14 - | 'queryOptionsFn' 15 - | 'QueryKey' 16 - | 'useQuery'; 17 - 18 - export type IApi = { 19 - /** 20 - * @param type Selector type. 21 - * @param value Depends on `type`: 22 - * - `AxiosError`: never 23 - * - `createInfiniteParams`: never 24 - * - `createQueryKey`: never 25 - * - `DefaultError`: never 26 - * - `infiniteQueryOptions`: never 27 - * - `InfiniteData`: never 28 - * - `MutationOptions`: never 29 - * - `queryOptions`: never 30 - * - `queryOptionsFn`: `operation.id` string 31 - * - `QueryKey`: never 32 - * - `useQuery`: never 33 - * @returns Selector array 34 - * @deprecated 35 - */ 36 - selector: (type: SelectorType, value?: string) => Selector; 37 - }; 38 - 39 - export class Api implements IApi { 40 - constructor( 41 - public meta: Plugin.Name<'@tanstack/angular-query-experimental'>, 42 - ) {} 1 + export type IApi = any; 43 2 44 - selector(...args: ReadonlyArray<string | undefined>): Selector { 45 - return [this.meta.name, ...(args as Selector)]; 46 - } 47 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/config.ts
··· 6 6 import type { TanStackAngularQueryPlugin } from './types'; 7 7 8 8 export const defaultConfig: TanStackAngularQueryPlugin['Config'] = { 9 - api: new Api({ 10 - name: '@tanstack/angular-query-experimental', 11 - }), 9 + api: new Api(), 12 10 config: { 13 11 case: 'camelCase', 14 12 comments: true,
+37 -15
packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts
··· 25 25 plugin: PluginInstance; 26 26 }) => { 27 27 const symbolCreateInfiniteParams = plugin.registerSymbol({ 28 + meta: { 29 + category: 'utility', 30 + resource: 'createInfiniteParams', 31 + tool: plugin.name, 32 + }, 28 33 name: buildName({ 29 34 config: { 30 35 case: plugin.config.case, 31 36 }, 32 37 name: 'createInfiniteParams', 33 38 }), 34 - selector: plugin.api.selector('createInfiniteParams'), 35 39 }); 36 40 37 41 const fn = tsc.constVariable({ ··· 242 246 operation, 243 247 }); 244 248 245 - if (!plugin.getSymbol(plugin.api.selector('createQueryKey'))) { 249 + if ( 250 + !plugin.getSymbol({ 251 + category: 'utility', 252 + resource: 'createQueryKey', 253 + tool: plugin.name, 254 + }) 255 + ) { 246 256 createQueryKeyType({ plugin }); 247 257 createQueryKeyFunction({ plugin }); 248 258 } 249 259 250 - if (!plugin.getSymbol(plugin.api.selector('createInfiniteParams'))) { 260 + if ( 261 + !plugin.getSymbol({ 262 + category: 'utility', 263 + resource: 'createInfiniteParams', 264 + tool: plugin.name, 265 + }) 266 + ) { 251 267 createInfiniteParamsFunction({ plugin }); 252 268 } 253 269 254 - const symbolInfiniteQueryOptions = plugin.referenceSymbol( 255 - plugin.api.selector('infiniteQueryOptions'), 256 - ); 257 - const symbolInfiniteDataType = plugin.referenceSymbol( 258 - plugin.api.selector('InfiniteData'), 259 - ); 270 + const symbolInfiniteQueryOptions = plugin.referenceSymbol({ 271 + category: 'external', 272 + resource: `${plugin.name}.infiniteQueryOptions`, 273 + }); 274 + const symbolInfiniteDataType = plugin.referenceSymbol({ 275 + category: 'external', 276 + resource: `${plugin.name}.InfiniteData`, 277 + }); 260 278 261 279 const typeData = useTypeData({ operation, plugin }); 262 280 const typeError = useTypeError({ operation, plugin }); 263 281 const typeResponse = useTypeResponse({ operation, plugin }); 264 282 265 - const symbolQueryKeyType = plugin.referenceSymbol( 266 - plugin.api.selector('QueryKey'), 267 - ); 283 + const symbolQueryKeyType = plugin.referenceSymbol({ 284 + category: 'type', 285 + resource: 'QueryKey', 286 + tool: plugin.name, 287 + }); 268 288 const typeQueryKey = `${symbolQueryKeyType.placeholder}<${typeData}>`; 269 289 const typePageObjectParam = `Pick<${typeQueryKey}[0], 'body' | 'headers' | 'path' | 'query'>`; 270 290 const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript'); ··· 330 350 }), 331 351 }); 332 352 333 - const symbolCreateInfiniteParams = plugin.referenceSymbol( 334 - plugin.api.selector('createInfiniteParams'), 335 - ); 353 + const symbolCreateInfiniteParams = plugin.referenceSymbol({ 354 + category: 'utility', 355 + resource: 'createInfiniteParams', 356 + tool: plugin.name, 357 + }); 336 358 337 359 const statements: Array<ts.Statement> = [ 338 360 tsc.constVariable({
+4 -3
packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts
··· 18 18 plugin: PluginInstance; 19 19 queryFn: string; 20 20 }): void => { 21 - const symbolMutationOptionsType = plugin.referenceSymbol( 22 - plugin.api.selector('MutationOptions'), 23 - ); 21 + const symbolMutationOptionsType = plugin.referenceSymbol({ 22 + category: 'external', 23 + resource: `${plugin.name}.MutationOptions`, 24 + }); 24 25 25 26 const typeData = useTypeData({ operation, plugin }); 26 27 const typeError = useTypeError({ operation, plugin });
+28 -7
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts
··· 11 11 plugin.registerSymbol({ 12 12 external: plugin.name, 13 13 kind: 'type', 14 + meta: { 15 + category: 'external', 16 + resource: `${plugin.name}.DefaultError`, 17 + }, 14 18 name: 'DefaultError', 15 - selector: plugin.api.selector('DefaultError'), 16 19 }); 17 20 plugin.registerSymbol({ 18 21 external: plugin.name, 19 22 kind: 'type', 23 + meta: { 24 + category: 'external', 25 + resource: `${plugin.name}.InfiniteData`, 26 + }, 20 27 name: 'InfiniteData', 21 - selector: plugin.api.selector('InfiniteData'), 22 28 }); 23 29 const mutationsType = 24 30 plugin.name === '@tanstack/angular-query-experimental' || ··· 29 35 plugin.registerSymbol({ 30 36 external: plugin.name, 31 37 kind: 'type', 38 + meta: { 39 + category: 'external', 40 + resource: `${plugin.name}.MutationOptions`, 41 + }, 32 42 name: mutationsType, 33 - selector: plugin.api.selector('MutationOptions'), 34 43 }); 35 44 plugin.registerSymbol({ 36 45 external: plugin.name, 46 + meta: { 47 + category: 'external', 48 + resource: `${plugin.name}.infiniteQueryOptions`, 49 + }, 37 50 name: 'infiniteQueryOptions', 38 - selector: plugin.api.selector('infiniteQueryOptions'), 39 51 }); 40 52 plugin.registerSymbol({ 41 53 external: plugin.name, 54 + meta: { 55 + category: 'external', 56 + resource: `${plugin.name}.queryOptions`, 57 + }, 42 58 name: 'queryOptions', 43 - selector: plugin.api.selector('queryOptions'), 44 59 }); 45 60 plugin.registerSymbol({ 46 61 external: plugin.name, 62 + meta: { 63 + category: 'external', 64 + resource: `${plugin.name}.useQuery`, 65 + }, 47 66 name: 'useQuery', 48 - selector: plugin.api.selector('useQuery'), 49 67 }); 50 68 plugin.registerSymbol({ 51 69 external: 'axios', 52 70 kind: 'type', 71 + meta: { 72 + category: 'external', 73 + resource: 'axios.AxiosError', 74 + }, 53 75 name: 'AxiosError', 54 - selector: plugin.api.selector('AxiosError'), 55 76 }); 56 77 57 78 const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');
+20 -8
packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts
··· 21 21 plugin: PluginInstance; 22 22 }) => { 23 23 const symbolCreateQueryKey = plugin.registerSymbol({ 24 + meta: { 25 + category: 'utility', 26 + resource: 'createQueryKey', 27 + tool: plugin.name, 28 + }, 24 29 name: buildName({ 25 30 config: { 26 31 case: plugin.config.case, 27 32 }, 28 33 name: 'createQueryKey', 29 34 }), 30 - selector: plugin.api.selector('createQueryKey'), 31 35 }); 32 - const symbolQueryKeyType = plugin.referenceSymbol( 33 - plugin.api.selector('QueryKey'), 34 - ); 36 + const symbolQueryKeyType = plugin.referenceSymbol({ 37 + category: 'type', 38 + resource: 'QueryKey', 39 + tool: plugin.name, 40 + }); 35 41 36 42 const returnType = tsc.indexedAccessTypeNode({ 37 43 indexType: tsc.literalTypeNode({ ··· 267 273 }); 268 274 } 269 275 270 - const symbolCreateQueryKey = plugin.referenceSymbol( 271 - plugin.api.selector('createQueryKey'), 272 - ); 276 + const symbolCreateQueryKey = plugin.referenceSymbol({ 277 + category: 'utility', 278 + resource: 'createQueryKey', 279 + tool: plugin.name, 280 + }); 273 281 const createQueryKeyCallExpression = tsc.callExpression({ 274 282 functionName: symbolCreateQueryKey.placeholder, 275 283 parameters: [ ··· 309 317 const symbolQueryKeyType = plugin.registerSymbol({ 310 318 exported: true, 311 319 kind: 'type', 320 + meta: { 321 + category: 'type', 322 + resource: 'QueryKey', 323 + tool: plugin.name, 324 + }, 312 325 name: 'QueryKey', 313 - selector: plugin.api.selector('QueryKey'), 314 326 }); 315 327 const queryKeyType = tsc.typeAliasDeclaration({ 316 328 exportType: symbolQueryKeyType.exported,
+18 -5
packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts
··· 38 38 operation, 39 39 }); 40 40 41 - if (!plugin.getSymbol(plugin.api.selector('createQueryKey'))) { 41 + if ( 42 + !plugin.getSymbol({ 43 + category: 'utility', 44 + resource: 'createQueryKey', 45 + tool: plugin.name, 46 + }) 47 + ) { 42 48 createQueryKeyType({ plugin }); 43 49 createQueryKeyFunction({ plugin }); 44 50 } 45 51 46 - const symbolQueryOptions = plugin.referenceSymbol( 47 - plugin.api.selector('queryOptions'), 48 - ); 52 + const symbolQueryOptions = plugin.referenceSymbol({ 53 + category: 'external', 54 + resource: `${plugin.name}.queryOptions`, 55 + }); 49 56 50 57 const symbolQueryKey = plugin.registerSymbol({ 51 58 exported: true, ··· 156 163 157 164 const symbolQueryOptionsFn = plugin.registerSymbol({ 158 165 exported: plugin.config.queryOptions.exported, 166 + meta: { 167 + category: 'hook', 168 + resource: 'operation', 169 + resourceId: operation.id, 170 + role: 'queryOptions', 171 + tool: plugin.name, 172 + }, 159 173 name: buildName({ 160 174 config: plugin.config.queryOptions, 161 175 name: operation.id, 162 176 }), 163 - selector: plugin.api.selector('queryOptionsFn', operation.id), 164 177 }); 165 178 const statement = tsc.constVariable({ 166 179 comment: plugin.config.comments
+11 -6
packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts
··· 35 35 }), 36 36 }); 37 37 38 - const symbolUseQuery = plugin.referenceSymbol( 39 - plugin.api.selector('useQuery'), 40 - ); 38 + const symbolUseQuery = plugin.referenceSymbol({ 39 + category: 'external', 40 + resource: `${plugin.name}.useQuery`, 41 + }); 41 42 42 43 const isRequiredOptions = isOperationOptionsRequired({ 43 44 context: plugin.context, ··· 45 46 }); 46 47 const typeData = useTypeData({ operation, plugin }); 47 48 48 - const symbolQueryOptionsFn = plugin.referenceSymbol( 49 - plugin.api.selector('queryOptionsFn', operation.id), 50 - ); 49 + const symbolQueryOptionsFn = plugin.referenceSymbol({ 50 + category: 'hook', 51 + resource: 'operation', 52 + resourceId: operation.id, 53 + role: 'queryOptions', 54 + tool: plugin.name, 55 + }); 51 56 const statement = tsc.constVariable({ 52 57 comment: plugin.config.comments 53 58 ? createOperationComment({ operation })
+8 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts
··· 34 34 35 35 let typeErrorName: string | undefined = symbolErrorType?.placeholder; 36 36 if (!typeErrorName) { 37 - const symbol = plugin.referenceSymbol(plugin.api.selector('DefaultError')); 37 + const symbol = plugin.referenceSymbol({ 38 + category: 'external', 39 + resource: `${plugin.name}.DefaultError`, 40 + }); 38 41 typeErrorName = symbol.placeholder; 39 42 } 40 43 if (client.name === '@hey-api/client-axios') { 41 - const symbol = plugin.referenceSymbol(plugin.api.selector('AxiosError')); 44 + const symbol = plugin.referenceSymbol({ 45 + category: 'external', 46 + resource: 'axios.AxiosError', 47 + }); 42 48 typeErrorName = `${symbol.placeholder}<${typeErrorName}>`; 43 49 } 44 50 return typeErrorName;
+2 -44
packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 - 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 6 - | 'AxiosError' 7 - | 'createInfiniteParams' 8 - | 'createQueryKey' 9 - | 'DefaultError' 10 - | 'infiniteQueryOptions' 11 - | 'InfiniteData' 12 - | 'MutationOptions' 13 - | 'queryOptions' 14 - | 'queryOptionsFn' 15 - | 'QueryKey' 16 - | 'useQuery'; 17 - 18 - export type IApi = { 19 - /** 20 - * @param type Selector type. 21 - * @param value Depends on `type`: 22 - * - `AxiosError`: never 23 - * - `createInfiniteParams`: never 24 - * - `createQueryKey`: never 25 - * - `DefaultError`: never 26 - * - `infiniteQueryOptions`: never 27 - * - `InfiniteData`: never 28 - * - `MutationOptions`: never 29 - * - `queryOptions`: never 30 - * - `queryOptionsFn`: `operation.id` string 31 - * - `QueryKey`: never 32 - * - `useQuery`: never 33 - * @returns Selector array 34 - * @deprecated 35 - */ 36 - selector: (type: SelectorType, value?: string) => Selector; 37 - }; 1 + export type IApi = any; 38 2 39 - export class Api implements IApi { 40 - constructor(public meta: Plugin.Name<'@tanstack/react-query'>) {} 41 - 42 - selector(...args: ReadonlyArray<string | undefined>): Selector { 43 - return [this.meta.name, ...(args as Selector)]; 44 - } 45 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts
··· 6 6 import type { TanStackReactQueryPlugin } from './types'; 7 7 8 8 export const defaultConfig: TanStackReactQueryPlugin['Config'] = { 9 - api: new Api({ 10 - name: '@tanstack/react-query', 11 - }), 9 + api: new Api(), 12 10 config: { 13 11 case: 'camelCase', 14 12 comments: true,
+2 -44
packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 - 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 6 - | 'AxiosError' 7 - | 'createInfiniteParams' 8 - | 'createQueryKey' 9 - | 'DefaultError' 10 - | 'infiniteQueryOptions' 11 - | 'InfiniteData' 12 - | 'MutationOptions' 13 - | 'queryOptions' 14 - | 'queryOptionsFn' 15 - | 'QueryKey' 16 - | 'useQuery'; 17 - 18 - export type IApi = { 19 - /** 20 - * @param type Selector type. 21 - * @param value Depends on `type`: 22 - * - `AxiosError`: never 23 - * - `createInfiniteParams`: never 24 - * - `createQueryKey`: never 25 - * - `DefaultError`: never 26 - * - `infiniteQueryOptions`: never 27 - * - `InfiniteData`: never 28 - * - `MutationOptions`: never 29 - * - `queryOptions`: never 30 - * - `queryOptionsFn`: `operation.id` string 31 - * - `QueryKey`: never 32 - * - `useQuery`: never 33 - * @returns Selector array 34 - * @deprecated 35 - */ 36 - selector: (type: SelectorType, value?: string) => Selector; 37 - }; 1 + export type IApi = any; 38 2 39 - export class Api implements IApi { 40 - constructor(public meta: Plugin.Name<'@tanstack/solid-query'>) {} 41 - 42 - selector(...args: ReadonlyArray<string | undefined>): Selector { 43 - return [this.meta.name, ...(args as Selector)]; 44 - } 45 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts
··· 6 6 import type { TanStackSolidQueryPlugin } from './types'; 7 7 8 8 export const defaultConfig: TanStackSolidQueryPlugin['Config'] = { 9 - api: new Api({ 10 - name: '@tanstack/solid-query', 11 - }), 9 + api: new Api(), 12 10 config: { 13 11 case: 'camelCase', 14 12 comments: true,
+2 -44
packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 - 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 6 - | 'AxiosError' 7 - | 'createInfiniteParams' 8 - | 'createQueryKey' 9 - | 'DefaultError' 10 - | 'infiniteQueryOptions' 11 - | 'InfiniteData' 12 - | 'MutationOptions' 13 - | 'queryOptions' 14 - | 'queryOptionsFn' 15 - | 'QueryKey' 16 - | 'useQuery'; 17 - 18 - export type IApi = { 19 - /** 20 - * @param type Selector type. 21 - * @param value Depends on `type`: 22 - * - `AxiosError`: never 23 - * - `createInfiniteParams`: never 24 - * - `createQueryKey`: never 25 - * - `DefaultError`: never 26 - * - `infiniteQueryOptions`: never 27 - * - `InfiniteData`: never 28 - * - `MutationOptions`: never 29 - * - `queryOptions`: never 30 - * - `queryOptionsFn`: `operation.id` string 31 - * - `QueryKey`: never 32 - * - `useQuery`: never 33 - * @returns Selector array 34 - * @deprecated 35 - */ 36 - selector: (type: SelectorType, value?: string) => Selector; 37 - }; 1 + export type IApi = any; 38 2 39 - export class Api implements IApi { 40 - constructor(public meta: Plugin.Name<'@tanstack/svelte-query'>) {} 41 - 42 - selector(...args: ReadonlyArray<string | undefined>): Selector { 43 - return [this.meta.name, ...(args as Selector)]; 44 - } 45 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts
··· 6 6 import type { TanStackSvelteQueryPlugin } from './types'; 7 7 8 8 export const defaultConfig: TanStackSvelteQueryPlugin['Config'] = { 9 - api: new Api({ 10 - name: '@tanstack/svelte-query', 11 - }), 9 + api: new Api(), 12 10 config: { 13 11 case: 'camelCase', 14 12 comments: true,
+2 -44
packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 - 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 6 - | 'AxiosError' 7 - | 'createInfiniteParams' 8 - | 'createQueryKey' 9 - | 'DefaultError' 10 - | 'infiniteQueryOptions' 11 - | 'InfiniteData' 12 - | 'MutationOptions' 13 - | 'queryOptions' 14 - | 'queryOptionsFn' 15 - | 'QueryKey' 16 - | 'useQuery'; 17 - 18 - export type IApi = { 19 - /** 20 - * @param type Selector type. 21 - * @param value Depends on `type`: 22 - * - `AxiosError`: never 23 - * - `createInfiniteParams`: never 24 - * - `createQueryKey`: never 25 - * - `DefaultError`: never 26 - * - `infiniteQueryOptions`: never 27 - * - `InfiniteData`: never 28 - * - `MutationOptions`: never 29 - * - `queryOptions`: never 30 - * - `queryOptionsFn`: `operation.id` string 31 - * - `QueryKey`: never 32 - * - `useQuery`: never 33 - * @returns Selector array 34 - * @deprecated 35 - */ 36 - selector: (type: SelectorType, value?: string) => Selector; 37 - }; 1 + export type IApi = any; 38 2 39 - export class Api implements IApi { 40 - constructor(public meta: Plugin.Name<'@tanstack/vue-query'>) {} 41 - 42 - selector(...args: ReadonlyArray<string | undefined>): Selector { 43 - return [this.meta.name, ...(args as Selector)]; 44 - } 45 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts
··· 6 6 import type { TanStackVueQueryPlugin } from './types'; 7 7 8 8 export const defaultConfig: TanStackVueQueryPlugin['Config'] = { 9 - api: new Api({ 10 - name: '@tanstack/vue-query', 11 - }), 9 + api: new Api(), 12 10 config: { 13 11 case: 'camelCase', 14 12 comments: true,