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 #2880 from hey-api/refactor/selector-client

refactor: remove selectors from client plugins

authored by

Lubos and committed by
GitHub
c2d16f21 dfd1a2eb

+77 -426
+3 -22
packages/custom-client/src/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: CustomClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: '@hey-api/custom-client', 44 - }), 25 + api: new Api(), 45 26 config: { 46 27 ...clientDefaultConfig, 47 28 bundle: false,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-false/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-number/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-string/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/bundle/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/default/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+3 -22
packages/openapi-ts-tests/main/test/custom/client/plugin.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 2 1 import { 3 2 type Client, 4 3 clientDefaultConfig, ··· 8 7 definePluginConfig, 9 8 } from '@hey-api/openapi-ts'; 10 9 11 - type SelectorType = 'client'; 10 + export type IApi = any; 12 11 13 - export type IApi = { 14 - /** 15 - * @param type Selector type. 16 - * @param value Depends on `type`: 17 - * - `client`: never 18 - * @returns Selector array 19 - */ 20 - selector: (type: SelectorType, value?: string) => Selector; 21 - }; 22 - 23 - export class Api implements IApi { 24 - constructor(public meta: Pick<Config, 'name'>) {} 25 - 26 - selector(...args: ReadonlyArray<string | undefined>): Selector { 27 - return [this.meta.name, ...(args as Selector)]; 28 - } 29 - } 12 + export class Api implements IApi {} 30 13 31 14 export type Config = Client.Config & { 32 15 /** ··· 39 22 40 23 export const defaultConfig: MyClientPlugin['Config'] = { 41 24 ...clientDefaultMeta, 42 - api: new Api({ 43 - name: __filename, 44 - }), 25 + api: new Api(), 45 26 config: clientDefaultConfig, 46 27 handler: clientPluginHandler, 47 28 name: __filename,
+7 -1
packages/openapi-ts/src/index.ts
··· 15 15 } 16 16 17 17 interface SymbolMeta { 18 - category?: 'external' | 'schema' | 'sdk' | 'type' | (string & {}); 18 + category?: 19 + | 'client' 20 + | 'external' 21 + | 'schema' 22 + | 'sdk' 23 + | 'type' 24 + | (string & {}); 19 25 /** 20 26 * Path to the resource this symbol represents. 21 27 */
+3 -9
packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts
··· 3 3 4 4 import type { IR } from '~/ir/types'; 5 5 import { buildName } from '~/openApi/shared/utils/name'; 6 - import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; 7 6 import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; 8 7 import { 9 8 createOperationComment, ··· 210 209 operation: IR.OperationObject; 211 210 plugin: AngularCommonPlugin['Instance']; 212 211 }) => { 213 - const client = getClientPlugin(plugin.context.config); 214 - const symbolClient = 215 - client.api && 'selector' in client.api 216 - ? plugin.getSymbol( 217 - // @ts-expect-error 218 - client.api.selector('client'), 219 - ) 220 - : undefined; 212 + const symbolClient = plugin.getSymbol({ 213 + category: 'client', 214 + }); 221 215 222 216 const optionsClient = tsc.propertyAccessExpression({ 223 217 expression: tsc.identifier({ text: 'options' }),
+2 -23
packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 1 + export type IApi = any; 2 2 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 'client'; 6 - 7 - export type IApi = { 8 - /** 9 - * @param type Selector type. 10 - * @param value Depends on `type`: 11 - * - `client`: never 12 - * @returns Selector array 13 - * @deprecated 14 - */ 15 - selector: (type: SelectorType, value?: string) => Selector; 16 - }; 17 - 18 - export class Api implements IApi { 19 - constructor(public meta: Plugin.Name<'@hey-api/client-angular'>) {} 20 - 21 - selector(...args: ReadonlyArray<string | undefined>): Selector { 22 - return [this.meta.name, ...(args as Selector)]; 23 - } 24 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@hey-api/client-angular/config.ts
··· 10 10 11 11 export const defaultConfig: HeyApiClientAngularPlugin['Config'] = { 12 12 ...clientDefaultMeta, 13 - api: new Api({ 14 - name: '@hey-api/client-angular', 15 - }), 13 + api: new Api(), 16 14 config: { 17 15 ...clientDefaultConfig, 18 16 throwOnError: false,
+2 -23
packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 1 + export type IApi = any; 2 2 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 'client'; 6 - 7 - export type IApi = { 8 - /** 9 - * @param type Selector type. 10 - * @param value Depends on `type`: 11 - * - `client`: never 12 - * @returns Selector array 13 - * @deprecated 14 - */ 15 - selector: (type: SelectorType, value?: string) => Selector; 16 - }; 17 - 18 - export class Api implements IApi { 19 - constructor(public meta: Plugin.Name<'@hey-api/client-axios'>) {} 20 - 21 - selector(...args: ReadonlyArray<string | undefined>): Selector { 22 - return [this.meta.name, ...(args as Selector)]; 23 - } 24 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@hey-api/client-axios/config.ts
··· 10 10 11 11 export const defaultConfig: HeyApiClientAxiosPlugin['Config'] = { 12 12 ...clientDefaultMeta, 13 - api: new Api({ 14 - name: '@hey-api/client-axios', 15 - }), 13 + api: new Api(), 16 14 config: { 17 15 ...clientDefaultConfig, 18 16 throwOnError: false,
+3 -1
packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts
··· 94 94 ]; 95 95 96 96 const symbolClient = plugin.registerSymbol({ 97 + meta: { 98 + category: 'client', 99 + }, 97 100 name: 'client', 98 - selector: plugin.api.selector('client'), 99 101 }); 100 102 const statement = tsc.constVariable({ 101 103 exportConst: true,
+2 -23
packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 1 + export type IApi = any; 2 2 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 'client'; 6 - 7 - export type IApi = { 8 - /** 9 - * @param type Selector type. 10 - * @param value Depends on `type`: 11 - * - `client`: never 12 - * @returns Selector array 13 - * @deprecated 14 - */ 15 - selector: (type: SelectorType, value?: string) => Selector; 16 - }; 17 - 18 - export class Api implements IApi { 19 - constructor(public meta: Plugin.Name<'@hey-api/client-fetch'>) {} 20 - 21 - selector(...args: ReadonlyArray<string | undefined>): Selector { 22 - return [this.meta.name, ...(args as Selector)]; 23 - } 24 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@hey-api/client-fetch/config.ts
··· 10 10 11 11 export const defaultConfig: HeyApiClientFetchPlugin['Config'] = { 12 12 ...clientDefaultMeta, 13 - api: new Api({ 14 - name: '@hey-api/client-fetch', 15 - }), 13 + api: new Api(), 16 14 config: { 17 15 ...clientDefaultConfig, 18 16 throwOnError: false,
+2 -23
packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 1 + export type IApi = any; 2 2 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 'client'; 6 - 7 - export type IApi = { 8 - /** 9 - * @param type Selector type. 10 - * @param value Depends on `type`: 11 - * - `client`: never 12 - * @returns Selector array 13 - * @deprecated 14 - */ 15 - selector: (type: SelectorType, value?: string) => Selector; 16 - }; 17 - 18 - export class Api implements IApi { 19 - constructor(public meta: Plugin.Name<'@hey-api/client-next'>) {} 20 - 21 - selector(...args: ReadonlyArray<string | undefined>): Selector { 22 - return [this.meta.name, ...(args as Selector)]; 23 - } 24 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@hey-api/client-next/config.ts
··· 10 10 11 11 export const defaultConfig: HeyApiClientNextPlugin['Config'] = { 12 12 ...clientDefaultMeta, 13 - api: new Api({ 14 - name: '@hey-api/client-next', 15 - }), 13 + api: new Api(), 16 14 config: { 17 15 ...clientDefaultConfig, 18 16 throwOnError: false,
+2 -23
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 1 + export type IApi = any; 2 2 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 'client'; 6 - 7 - export type IApi = { 8 - /** 9 - * @param type Selector type. 10 - * @param value Depends on `type`: 11 - * - `client`: never 12 - * @returns Selector array 13 - * @deprecated 14 - */ 15 - selector: (type: SelectorType, value?: string) => Selector; 16 - }; 17 - 18 - export class Api implements IApi { 19 - constructor(public meta: Plugin.Name<'@hey-api/client-nuxt'>) {} 20 - 21 - selector(...args: ReadonlyArray<string | undefined>): Selector { 22 - return [this.meta.name, ...(args as Selector)]; 23 - } 24 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/config.ts
··· 10 10 11 11 export const defaultConfig: HeyApiClientNuxtPlugin['Config'] = { 12 12 ...clientDefaultMeta, 13 - api: new Api({ 14 - name: '@hey-api/client-nuxt', 15 - }), 13 + api: new Api(), 16 14 config: clientDefaultConfig, 17 15 handler: clientPluginHandler, 18 16 name: '@hey-api/client-nuxt',
+2 -23
packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts
··· 1 - import type { Selector } from '@hey-api/codegen-core'; 1 + export type IApi = any; 2 2 3 - import type { Plugin } from '~/plugins'; 4 - 5 - type SelectorType = 'client'; 6 - 7 - export type IApi = { 8 - /** 9 - * @param type Selector type. 10 - * @param value Depends on `type`: 11 - * - `client`: never 12 - * @returns Selector array 13 - * @deprecated 14 - */ 15 - selector: (type: SelectorType, value?: string) => Selector; 16 - }; 17 - 18 - export class Api implements IApi { 19 - constructor(public meta: Plugin.Name<'@hey-api/client-ofetch'>) {} 20 - 21 - selector(...args: ReadonlyArray<string | undefined>): Selector { 22 - return [this.meta.name, ...(args as Selector)]; 23 - } 24 - } 3 + export class Api implements IApi {}
+1 -3
packages/openapi-ts/src/plugins/@hey-api/client-ofetch/config.ts
··· 10 10 11 11 export const defaultConfig: HeyApiClientOfetchPlugin['Config'] = { 12 12 ...clientDefaultMeta, 13 - api: new Api({ 14 - name: '@hey-api/client-ofetch', 15 - }), 13 + api: new Api(), 16 14 config: { 17 15 ...clientDefaultConfig, 18 16 throwOnError: false,
+3 -8
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts
··· 63 63 }); 64 64 65 65 const symbolClient = plugin.referenceSymbol(plugin.api.selector('Client')); 66 - const client = getClientPlugin(plugin.context.config); 67 - const symClient = 68 - client.api && 'selector' in client.api 69 - ? plugin.getSymbol( 70 - // @ts-expect-error 71 - client.api.selector('client'), 72 - ) 73 - : undefined; 66 + const symClient = plugin.getSymbol({ 67 + category: 'client', 68 + }); 74 69 75 70 return [ 76 71 tsc.propertyDeclaration({
+5 -7
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts
··· 683 683 } 684 684 } 685 685 686 - const symbolClient = 687 - plugin.config.client && client.api && 'selector' in client.api 688 - ? plugin.getSymbol( 689 - // @ts-expect-error 690 - client.api.selector('client'), 691 - ) 692 - : undefined; 686 + const symbolClient = plugin.config.client 687 + ? plugin.getSymbol({ 688 + category: 'client', 689 + }) 690 + : undefined; 693 691 694 692 const optionsClient = tsc.propertyAccessExpression({ 695 693 expression: tsc.identifier({ text: 'options' }),
+4 -12
packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts
··· 5 5 import { hasOperationDataRequired } from '~/ir/operation'; 6 6 import type { IR } from '~/ir/types'; 7 7 import { buildName } from '~/openApi/shared/utils/name'; 8 - import { 9 - getClientBaseUrlKey, 10 - getClientPlugin, 11 - } from '~/plugins/@hey-api/client-core/utils'; 8 + import { getClientBaseUrlKey } from '~/plugins/@hey-api/client-core/utils'; 12 9 import { type Property, tsc } from '~/tsc'; 13 10 14 11 import type { PiniaColadaPlugin } from './types'; ··· 56 53 const symbolOptions = plugin.referenceSymbol( 57 54 sdkPlugin.api.selector('Options'), 58 55 ); 59 - const client = getClientPlugin(plugin.context.config); 60 - const symbolClient = 61 - client.api && 'selector' in client.api 62 - ? plugin.getSymbol( 63 - // @ts-expect-error 64 - client.api.selector('client'), 65 - ) 66 - : undefined; 56 + const symbolClient = plugin.getSymbol({ 57 + category: 'client', 58 + }); 67 59 68 60 const clientModule = clientFolderAbsolutePath(plugin.context.config); 69 61 const symbolSerializeQueryValue = plugin.registerSymbol({
+4 -12
packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts
··· 4 4 import { hasOperationDataRequired } from '~/ir/operation'; 5 5 import type { IR } from '~/ir/types'; 6 6 import { buildName } from '~/openApi/shared/utils/name'; 7 - import { 8 - getClientBaseUrlKey, 9 - getClientPlugin, 10 - } from '~/plugins/@hey-api/client-core/utils'; 7 + import { getClientBaseUrlKey } from '~/plugins/@hey-api/client-core/utils'; 11 8 import { type Property, tsc } from '~/tsc'; 12 9 13 10 import type { PluginInstance } from './types'; ··· 48 45 49 46 const baseUrlKey = getClientBaseUrlKey(plugin.context.config); 50 47 51 - const client = getClientPlugin(plugin.context.config); 52 - const symbolClient = 53 - client.api && 'selector' in client.api 54 - ? plugin.getSymbol( 55 - // @ts-expect-error 56 - client.api.selector('client'), 57 - ) 58 - : undefined; 48 + const symbolClient = plugin.getSymbol({ 49 + category: 'client', 50 + }); 59 51 60 52 const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); 61 53 const symbolOptions = plugin.referenceSymbol(