@kubb/plugin-client 3.0.0-alpha.15 → 3.0.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/client.ts +1 -1
  2. package/dist/{chunk-TNO4CNBR.cjs → chunk-44KNIIBT.cjs} +52 -30
  3. package/dist/chunk-44KNIIBT.cjs.map +1 -0
  4. package/dist/chunk-HGQQGWKN.js +130 -0
  5. package/dist/chunk-HGQQGWKN.js.map +1 -0
  6. package/dist/chunk-NEK3OJBX.cjs +133 -0
  7. package/dist/chunk-NEK3OJBX.cjs.map +1 -0
  8. package/dist/{chunk-H2OOHGK2.js → chunk-XB4BUZDK.js} +51 -29
  9. package/dist/chunk-XB4BUZDK.js.map +1 -0
  10. package/dist/client.cjs.map +1 -1
  11. package/dist/client.d.cts +1 -1
  12. package/dist/client.d.ts +1 -1
  13. package/dist/client.js.map +1 -1
  14. package/dist/components.cjs +3 -3
  15. package/dist/components.d.cts +29 -4
  16. package/dist/components.d.ts +29 -4
  17. package/dist/components.js +1 -1
  18. package/dist/generators.cjs +4 -4
  19. package/dist/generators.d.cts +1 -3
  20. package/dist/generators.d.ts +1 -3
  21. package/dist/generators.js +2 -2
  22. package/dist/index.cjs +4 -4
  23. package/dist/index.d.cts +1 -3
  24. package/dist/index.d.ts +1 -3
  25. package/dist/index.js +2 -2
  26. package/dist/{types-CzL-44IA.d.cts → types-j-ah_78Y.d.cts} +9 -17
  27. package/dist/{types-CzL-44IA.d.ts → types-j-ah_78Y.d.ts} +9 -17
  28. package/package.json +14 -13
  29. package/src/components/Client.tsx +75 -55
  30. package/src/generators/__snapshots__/deletePet.ts +17 -0
  31. package/src/generators/__snapshots__/deletePetObject.ts +25 -0
  32. package/src/generators/__snapshots__/findByTags.ts +12 -0
  33. package/src/generators/__snapshots__/findByTagsFull.ts +12 -0
  34. package/src/generators/__snapshots__/findByTagsWithZod.ts +12 -0
  35. package/src/generators/__snapshots__/findByTagsWithZodFull.ts +12 -0
  36. package/src/generators/__snapshots__/importPath.ts +12 -0
  37. package/src/generators/__snapshots__/operations.ts +82 -0
  38. package/src/generators/__snapshots__/updatePetById.ts +15 -0
  39. package/src/generators/clientGenerator.tsx +40 -21
  40. package/src/generators/operationsGenerator.tsx +1 -1
  41. package/src/plugin.ts +4 -4
  42. package/src/types.ts +7 -4
  43. package/dist/chunk-BAX6ZFGY.js +0 -122
  44. package/dist/chunk-BAX6ZFGY.js.map +0 -1
  45. package/dist/chunk-H2OOHGK2.js.map +0 -1
  46. package/dist/chunk-TNO4CNBR.cjs.map +0 -1
  47. package/dist/chunk-XDWPA5EL.cjs +0 -125
  48. package/dist/chunk-XDWPA5EL.cjs.map +0 -1
  49. package/src/components/__snapshots__/Client/showPetById.ts +0 -8
  50. package/src/components/__snapshots__/Operations/showPetById.ts +0 -6
  51. package/src/components/__snapshots__/Query/showPetById.ts +0 -15
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generators/clientGenerator.tsx","../src/plugin.ts","../src/generators/operationsGenerator.tsx"],"names":["pluginZodName","options","createReactGenerator","useApp","jsx","File"],"mappings":";;;;;;;;;;;;AAQO,IAAM,kBAAkB,oBAAmC,CAAA;AAAA,EAChE,IAAM,EAAA,QAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA,EAAa,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,MAAA,EAAQ,EAAE,MAAO,EAAA;AAAA,QACf,MAAqB,EAAA,CAAA;AACzB,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAY,mBAAoB,EAAA,CAAA;AAE7D,IAAA,MAAM,MAAS,GAAA;AAAA,MACb,MAAM,OAAQ,CAAA,SAAA,EAAW,EAAE,IAAA,EAAM,YAAY,CAAA;AAAA,MAC7C,IAAA,EAAM,QAAQ,SAAS,CAAA;AAAA,KACzB,CAAA;AAEA,IAAA,MAAM,IAAO,GAAA;AAAA,MACX,IAAA,E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UAAA,EAAc,EAAA;AACzB,IAAM,MAAA,EAAE,aAAc,EAAA,GAAIC,MAAqB,EAAA,CAAA;AAE/C,IAAA,MAAM,IAAO,GAAA,YAAA,CAAA;AACb,IAAM,MAAA,IAAA,GAAO,aAAc,CAAA,OAAA,CAAQ,EAAE,IAAA,EAAM,OAAS,EAAA,KAAA,EAAO,SAAW,EAAA,CAAC,gBAAgB,CAAA,EAAG,CAAA,CAAA;AAE1F,IAAA,uBACEC,GAACC,CAAAA,IAAAA,EAAA,EAAK,QAAU,EAAA,IAAA,CAAK,UAAU,IAAM,EAAA,IAAA,CAAK,IAAM,EAAA,IAAA,EAAM,KAAK,IACzD,EAAA,QAAA,kBAAAD,IAAC,UAAW,EAAA,EAAA,IAAA,EAAY,YAAwB,CAClD,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,CAAC","file":"chunk-XB4BUZDK.js","sourcesContent":["import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { Client } from '../components/Client'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ options, operation }) {\n const {\n plugin: { output },\n } = useApp<PluginClient>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return (\n <File baseName={client.file.baseName} path={client.file.path} meta={client.file.meta}>\n <File.Import name={'client'} path={options.importPath} />\n <File.Import name={['RequestConfig']} path={options.importPath} isTypeOnly />\n {options.parser === 'zod' && <File.Import extName={output?.extName} name={[zod.schemas.response.name]} root={client.file.path} path={zod.file.path} />}\n <File.Import\n extName={output?.extName}\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={client.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = createPlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n operations = false,\n importPath = '@kubb/plugin-client/client',\n parser = 'client',\n } = options\n\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginClientName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n parser,\n dataReturnType,\n importPath,\n pathParamsType,\n baseURL: undefined,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...[clientGenerator, operations ? operationsGenerator : undefined].filter(Boolean))\n\n await this.addFile(...files)\n\n if (this.config.output.exportType) {\n const barrelFiles = await this.fileManager.getBarrelFiles({\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n }\n },\n }\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { File, useApp } from '@kubb/react'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations }) {\n const { pluginManager } = useApp<PluginClient>()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey: [pluginClientName] })\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta}>\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../client.ts"],"names":["axios"],"mappings":";;;;;;;;;;;AA8Ba,IAAA,aAAA,GAAgBA,uBAAM,MAAO,CAAA;AAAA,EACxC,OAAS,EAAA,OAAO,UAAe,KAAA,WAAA,GAAc,UAAa,GAAA,KAAA,CAAA;AAAA,EAC1D,SAAS,OAAO,aAAA,KAAkB,cAAe,IAAK,CAAA,KAAA,CAAM,aAAa,CAAqB,GAAA,KAAA,CAAA;AAChG,CAAC,EAAA;AAEY,IAAA,WAAA,GAAc,OAAsD,MAAsE,KAAA;AACrJ,EAAA,MAAM,UAAU,aAAc,CAAA,OAAA,CAAsC,MAAM,CAAE,CAAA,KAAA,CAAM,CAAC,CAA0B,KAAA;AAC3G,IAAM,MAAA,CAAA,CAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAO,OAAA,OAAA,CAAA;AACT,EAAA;AAEA,IAAO,cAAQ,GAAA","file":"client.cjs","sourcesContent":["import axios from 'axios'\n\nimport type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options'\n params?: unknown\n data?: TData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n headers?: AxiosRequestConfig['headers']\n}\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers?: AxiosResponse['headers']\n}\n\nexport const axiosInstance = axios.create({\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? (JSON.parse(AXIOS_HEADERS) as AxiosHeaders) : undefined,\n})\n\nexport const axiosClient = async <TData, TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n const promise = axiosInstance.request<TData, ResponseConfig<TData>>(config).catch((e: AxiosError<TError>) => {\n throw e\n })\n\n return promise\n}\n\nexport default axiosClient\n"]}
1
+ {"version":3,"sources":["../client.ts"],"names":["axios"],"mappings":";;;;;;;;;;;AA8Ba,IAAA,aAAA,GAAgBA,uBAAM,MAAO,CAAA;AAAA,EACxC,OAAS,EAAA,OAAO,UAAe,KAAA,WAAA,GAAc,UAAa,GAAA,KAAA,CAAA;AAAA,EAC1D,SAAS,OAAO,aAAA,KAAkB,cAAe,IAAK,CAAA,KAAA,CAAM,aAAa,CAAqB,GAAA,KAAA,CAAA;AAChG,CAAC,EAAA;AAEY,IAAA,WAAA,GAAc,OAAsD,MAAsE,KAAA;AACrJ,EAAA,MAAM,UAAU,aAAc,CAAA,OAAA,CAAsC,MAAM,CAAE,CAAA,KAAA,CAAM,CAAC,CAA0B,KAAA;AAC3G,IAAM,MAAA,CAAA,CAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAO,OAAA,OAAA,CAAA;AACT,EAAA;AAEA,IAAO,cAAQ,GAAA","file":"client.cjs","sourcesContent":["import axios from 'axios'\n\nimport type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n headers?: AxiosRequestConfig['headers']\n}\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers?: AxiosResponse['headers']\n}\n\nexport const axiosInstance = axios.create({\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? (JSON.parse(AXIOS_HEADERS) as AxiosHeaders) : undefined,\n})\n\nexport const axiosClient = async <TData, TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n const promise = axiosInstance.request<TData, ResponseConfig<TData>>(config).catch((e: AxiosError<TError>) => {\n throw e\n })\n\n return promise\n}\n\nexport default axiosClient\n"]}
package/dist/client.d.cts CHANGED
@@ -9,7 +9,7 @@ type RequestConfig<TData = unknown> = {
9
9
  url?: string;
10
10
  method: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options';
11
11
  params?: unknown;
12
- data?: TData;
12
+ data?: TData | FormData;
13
13
  responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
14
14
  signal?: AbortSignal;
15
15
  headers?: AxiosRequestConfig['headers'];
package/dist/client.d.ts CHANGED
@@ -9,7 +9,7 @@ type RequestConfig<TData = unknown> = {
9
9
  url?: string;
10
10
  method: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options';
11
11
  params?: unknown;
12
- data?: TData;
12
+ data?: TData | FormData;
13
13
  responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
14
14
  signal?: AbortSignal;
15
15
  headers?: AxiosRequestConfig['headers'];
@@ -1 +1 @@
1
- {"version":3,"sources":["../client.ts"],"names":[],"mappings":";;;AA8Ba,IAAA,aAAA,GAAgB,MAAM,MAAO,CAAA;AAAA,EACxC,OAAS,EAAA,OAAO,UAAe,KAAA,WAAA,GAAc,UAAa,GAAA,KAAA,CAAA;AAAA,EAC1D,SAAS,OAAO,aAAA,KAAkB,cAAe,IAAK,CAAA,KAAA,CAAM,aAAa,CAAqB,GAAA,KAAA,CAAA;AAChG,CAAC,EAAA;AAEY,IAAA,WAAA,GAAc,OAAsD,MAAsE,KAAA;AACrJ,EAAA,MAAM,UAAU,aAAc,CAAA,OAAA,CAAsC,MAAM,CAAE,CAAA,KAAA,CAAM,CAAC,CAA0B,KAAA;AAC3G,IAAM,MAAA,CAAA,CAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAO,OAAA,OAAA,CAAA;AACT,EAAA;AAEA,IAAO,cAAQ,GAAA","file":"client.js","sourcesContent":["import axios from 'axios'\n\nimport type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options'\n params?: unknown\n data?: TData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n headers?: AxiosRequestConfig['headers']\n}\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers?: AxiosResponse['headers']\n}\n\nexport const axiosInstance = axios.create({\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? (JSON.parse(AXIOS_HEADERS) as AxiosHeaders) : undefined,\n})\n\nexport const axiosClient = async <TData, TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n const promise = axiosInstance.request<TData, ResponseConfig<TData>>(config).catch((e: AxiosError<TError>) => {\n throw e\n })\n\n return promise\n}\n\nexport default axiosClient\n"]}
1
+ {"version":3,"sources":["../client.ts"],"names":[],"mappings":";;;AA8Ba,IAAA,aAAA,GAAgB,MAAM,MAAO,CAAA;AAAA,EACxC,OAAS,EAAA,OAAO,UAAe,KAAA,WAAA,GAAc,UAAa,GAAA,KAAA,CAAA;AAAA,EAC1D,SAAS,OAAO,aAAA,KAAkB,cAAe,IAAK,CAAA,KAAA,CAAM,aAAa,CAAqB,GAAA,KAAA,CAAA;AAChG,CAAC,EAAA;AAEY,IAAA,WAAA,GAAc,OAAsD,MAAsE,KAAA;AACrJ,EAAA,MAAM,UAAU,aAAc,CAAA,OAAA,CAAsC,MAAM,CAAE,CAAA,KAAA,CAAM,CAAC,CAA0B,KAAA;AAC3G,IAAM,MAAA,CAAA,CAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAO,OAAA,OAAA,CAAA;AACT,EAAA;AAEA,IAAO,cAAQ,GAAA","file":"client.js","sourcesContent":["import axios from 'axios'\n\nimport type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n headers?: AxiosRequestConfig['headers']\n}\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers?: AxiosResponse['headers']\n}\n\nexport const axiosInstance = axios.create({\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? (JSON.parse(AXIOS_HEADERS) as AxiosHeaders) : undefined,\n})\n\nexport const axiosClient = async <TData, TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n const promise = axiosInstance.request<TData, ResponseConfig<TData>>(config).catch((e: AxiosError<TError>) => {\n throw e\n })\n\n return promise\n}\n\nexport default axiosClient\n"]}
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkXDWPA5EL_cjs = require('./chunk-XDWPA5EL.cjs');
3
+ var chunkNEK3OJBX_cjs = require('./chunk-NEK3OJBX.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Client", {
8
8
  enumerable: true,
9
- get: function () { return chunkXDWPA5EL_cjs.Client; }
9
+ get: function () { return chunkNEK3OJBX_cjs.Client; }
10
10
  });
11
11
  Object.defineProperty(exports, "Operations", {
12
12
  enumerable: true,
13
- get: function () { return chunkXDWPA5EL_cjs.Operations; }
13
+ get: function () { return chunkNEK3OJBX_cjs.Operations; }
14
14
  });
15
15
  //# sourceMappingURL=components.cjs.map
16
16
  //# sourceMappingURL=components.cjs.map
@@ -1,9 +1,34 @@
1
- export { C as Client } from './types-CzL-44IA.cjs';
2
1
  import { Operation } from '@kubb/oas';
2
+ import { OperationSchemas } from '@kubb/plugin-oas';
3
+ import { FunctionParams } from '@kubb/react';
4
+ import { KubbNode } from '@kubb/react/types';
5
+ import { P as PluginClient } from './types-j-ah_78Y.cjs';
3
6
  import '@kubb/core';
4
7
  import '@kubb/fs/types';
5
- import '@kubb/plugin-oas';
6
- import '@kubb/react/types';
8
+
9
+ type Props = {
10
+ /**
11
+ * Name of the function
12
+ */
13
+ name: string;
14
+ isExportable?: boolean;
15
+ isIndexable?: boolean;
16
+ baseURL: string | undefined;
17
+ dataReturnType: PluginClient['resolvedOptions']['dataReturnType'];
18
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
19
+ parser: PluginClient['resolvedOptions']['parser'] | undefined;
20
+ typeSchemas: OperationSchemas;
21
+ zodSchemas: OperationSchemas | undefined;
22
+ operation: Operation;
23
+ };
24
+ type GetParamsProps = {
25
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
26
+ typeSchemas: OperationSchemas;
27
+ };
28
+ declare function Client({ name, isExportable, isIndexable, typeSchemas, baseURL, dataReturnType, parser, zodSchemas, pathParamsType, operation, }: Props): KubbNode;
29
+ declare namespace Client {
30
+ var getParams: ({ pathParamsType, typeSchemas }: GetParamsProps) => FunctionParams;
31
+ }
7
32
 
8
33
  type OperationsProps = {
9
34
  name: string;
@@ -11,4 +36,4 @@ type OperationsProps = {
11
36
  };
12
37
  declare function Operations({ name, operations }: OperationsProps): JSX.Element;
13
38
 
14
- export { Operations };
39
+ export { Client, Operations };
@@ -1,9 +1,34 @@
1
- export { C as Client } from './types-CzL-44IA.js';
2
1
  import { Operation } from '@kubb/oas';
2
+ import { OperationSchemas } from '@kubb/plugin-oas';
3
+ import { FunctionParams } from '@kubb/react';
4
+ import { KubbNode } from '@kubb/react/types';
5
+ import { P as PluginClient } from './types-j-ah_78Y.js';
3
6
  import '@kubb/core';
4
7
  import '@kubb/fs/types';
5
- import '@kubb/plugin-oas';
6
- import '@kubb/react/types';
8
+
9
+ type Props = {
10
+ /**
11
+ * Name of the function
12
+ */
13
+ name: string;
14
+ isExportable?: boolean;
15
+ isIndexable?: boolean;
16
+ baseURL: string | undefined;
17
+ dataReturnType: PluginClient['resolvedOptions']['dataReturnType'];
18
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
19
+ parser: PluginClient['resolvedOptions']['parser'] | undefined;
20
+ typeSchemas: OperationSchemas;
21
+ zodSchemas: OperationSchemas | undefined;
22
+ operation: Operation;
23
+ };
24
+ type GetParamsProps = {
25
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
26
+ typeSchemas: OperationSchemas;
27
+ };
28
+ declare function Client({ name, isExportable, isIndexable, typeSchemas, baseURL, dataReturnType, parser, zodSchemas, pathParamsType, operation, }: Props): KubbNode;
29
+ declare namespace Client {
30
+ var getParams: ({ pathParamsType, typeSchemas }: GetParamsProps) => FunctionParams;
31
+ }
7
32
 
8
33
  type OperationsProps = {
9
34
  name: string;
@@ -11,4 +36,4 @@ type OperationsProps = {
11
36
  };
12
37
  declare function Operations({ name, operations }: OperationsProps): JSX.Element;
13
38
 
14
- export { Operations };
39
+ export { Client, Operations };
@@ -1,3 +1,3 @@
1
- export { Client, Operations } from './chunk-BAX6ZFGY.js';
1
+ export { Client, Operations } from './chunk-HGQQGWKN.js';
2
2
  //# sourceMappingURL=components.js.map
3
3
  //# sourceMappingURL=components.js.map
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunkTNO4CNBR_cjs = require('./chunk-TNO4CNBR.cjs');
4
- require('./chunk-XDWPA5EL.cjs');
3
+ var chunk44KNIIBT_cjs = require('./chunk-44KNIIBT.cjs');
4
+ require('./chunk-NEK3OJBX.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "clientGenerator", {
9
9
  enumerable: true,
10
- get: function () { return chunkTNO4CNBR_cjs.clientGenerator; }
10
+ get: function () { return chunk44KNIIBT_cjs.clientGenerator; }
11
11
  });
12
12
  Object.defineProperty(exports, "operationsGenerator", {
13
13
  enumerable: true,
14
- get: function () { return chunkTNO4CNBR_cjs.operationsGenerator; }
14
+ get: function () { return chunk44KNIIBT_cjs.operationsGenerator; }
15
15
  });
16
16
  //# sourceMappingURL=generators.cjs.map
17
17
  //# sourceMappingURL=generators.cjs.map
@@ -1,9 +1,7 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginClient } from './types-CzL-44IA.cjs';
2
+ import { P as PluginClient } from './types-j-ah_78Y.cjs';
3
3
  import '@kubb/core';
4
4
  import '@kubb/fs/types';
5
- import '@kubb/oas';
6
- import '@kubb/react/types';
7
5
 
8
6
  declare const clientGenerator: _kubb_plugin_oas.Generator<PluginClient>;
9
7
 
@@ -1,9 +1,7 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginClient } from './types-CzL-44IA.js';
2
+ import { P as PluginClient } from './types-j-ah_78Y.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/fs/types';
5
- import '@kubb/oas';
6
- import '@kubb/react/types';
7
5
 
8
6
  declare const clientGenerator: _kubb_plugin_oas.Generator<PluginClient>;
9
7
 
@@ -1,4 +1,4 @@
1
- export { clientGenerator, operationsGenerator } from './chunk-H2OOHGK2.js';
2
- import './chunk-BAX6ZFGY.js';
1
+ export { clientGenerator, operationsGenerator } from './chunk-XB4BUZDK.js';
2
+ import './chunk-HGQQGWKN.js';
3
3
  //# sourceMappingURL=generators.js.map
4
4
  //# sourceMappingURL=generators.js.map
package/dist/index.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunkTNO4CNBR_cjs = require('./chunk-TNO4CNBR.cjs');
4
- require('./chunk-XDWPA5EL.cjs');
3
+ var chunk44KNIIBT_cjs = require('./chunk-44KNIIBT.cjs');
4
+ require('./chunk-NEK3OJBX.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "pluginClient", {
9
9
  enumerable: true,
10
- get: function () { return chunkTNO4CNBR_cjs.pluginClient; }
10
+ get: function () { return chunk44KNIIBT_cjs.pluginClient; }
11
11
  });
12
12
  Object.defineProperty(exports, "pluginClientName", {
13
13
  enumerable: true,
14
- get: function () { return chunkTNO4CNBR_cjs.pluginClientName; }
14
+ get: function () { return chunk44KNIIBT_cjs.pluginClientName; }
15
15
  });
16
16
  //# sourceMappingURL=index.cjs.map
17
17
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,9 +1,7 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginClient } from './types-CzL-44IA.cjs';
2
+ import { O as Options, P as PluginClient } from './types-j-ah_78Y.cjs';
3
3
  import '@kubb/fs/types';
4
4
  import '@kubb/plugin-oas';
5
- import '@kubb/oas';
6
- import '@kubb/react/types';
7
5
 
8
6
  declare const pluginClientName = "plugin-client";
9
7
  declare const pluginClient: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginClient>;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginClient } from './types-CzL-44IA.js';
2
+ import { O as Options, P as PluginClient } from './types-j-ah_78Y.js';
3
3
  import '@kubb/fs/types';
4
4
  import '@kubb/plugin-oas';
5
- import '@kubb/oas';
6
- import '@kubb/react/types';
7
5
 
8
6
  declare const pluginClientName = "plugin-client";
9
7
  declare const pluginClient: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginClient>;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { pluginClient, pluginClientName } from './chunk-H2OOHGK2.js';
2
- import './chunk-BAX6ZFGY.js';
1
+ export { pluginClient, pluginClientName } from './chunk-XB4BUZDK.js';
2
+ import './chunk-HGQQGWKN.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,19 +1,6 @@
1
1
  import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { OperationSchemas, ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
4
- import { Operation } from '@kubb/oas';
5
- import { KubbNode } from '@kubb/react/types';
6
-
7
- type Props = {
8
- /**
9
- * Name of the function
10
- */
11
- name: string;
12
- options: PluginClient['resolvedOptions'];
13
- typedSchemas: OperationSchemas;
14
- operation: Operation;
15
- };
16
- declare function Client({ name, options, typedSchemas, operation }: Props): KubbNode;
3
+ import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
17
4
 
18
5
  type Options = {
19
6
  output?: {
@@ -83,7 +70,6 @@ type Options = {
83
70
  * @default '@kubb/plugin-client/client'
84
71
  */
85
72
  importPath?: string;
86
- template?: typeof Client;
87
73
  /**
88
74
  * ReturnType that needs to be used when calling client().
89
75
  *
@@ -104,6 +90,12 @@ type Options = {
104
90
  * @private
105
91
  */
106
92
  pathParamsType?: 'object' | 'inline';
93
+ /**
94
+ * Which parser can be used before returning the data
95
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
96
+ * @default 'client'
97
+ */
98
+ parser?: 'client' | 'zod';
107
99
  transformers?: {
108
100
  /**
109
101
  * Customize the names based on the type that is provided by the plugin.
@@ -113,11 +105,11 @@ type Options = {
113
105
  };
114
106
  type ResolvedOptions = {
115
107
  baseURL: string | undefined;
108
+ parser: NonNullable<Options['parser']>;
116
109
  importPath: NonNullable<Options['importPath']>;
117
- template: NonNullable<Options['template']>;
118
110
  dataReturnType: NonNullable<Options['dataReturnType']>;
119
111
  pathParamsType: NonNullable<Options['pathParamsType']>;
120
112
  };
121
113
  type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
122
114
 
123
- export { Client as C, type Options as O, type PluginClient as P };
115
+ export type { Options as O, PluginClient as P };
@@ -1,19 +1,6 @@
1
1
  import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { OperationSchemas, ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
4
- import { Operation } from '@kubb/oas';
5
- import { KubbNode } from '@kubb/react/types';
6
-
7
- type Props = {
8
- /**
9
- * Name of the function
10
- */
11
- name: string;
12
- options: PluginClient['resolvedOptions'];
13
- typedSchemas: OperationSchemas;
14
- operation: Operation;
15
- };
16
- declare function Client({ name, options, typedSchemas, operation }: Props): KubbNode;
3
+ import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
17
4
 
18
5
  type Options = {
19
6
  output?: {
@@ -83,7 +70,6 @@ type Options = {
83
70
  * @default '@kubb/plugin-client/client'
84
71
  */
85
72
  importPath?: string;
86
- template?: typeof Client;
87
73
  /**
88
74
  * ReturnType that needs to be used when calling client().
89
75
  *
@@ -104,6 +90,12 @@ type Options = {
104
90
  * @private
105
91
  */
106
92
  pathParamsType?: 'object' | 'inline';
93
+ /**
94
+ * Which parser can be used before returning the data
95
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
96
+ * @default 'client'
97
+ */
98
+ parser?: 'client' | 'zod';
107
99
  transformers?: {
108
100
  /**
109
101
  * Customize the names based on the type that is provided by the plugin.
@@ -113,11 +105,11 @@ type Options = {
113
105
  };
114
106
  type ResolvedOptions = {
115
107
  baseURL: string | undefined;
108
+ parser: NonNullable<Options['parser']>;
116
109
  importPath: NonNullable<Options['importPath']>;
117
- template: NonNullable<Options['template']>;
118
110
  dataReturnType: NonNullable<Options['dataReturnType']>;
119
111
  pathParamsType: NonNullable<Options['pathParamsType']>;
120
112
  };
121
113
  type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
122
114
 
123
- export { Client as C, type Options as O, type PluginClient as P };
115
+ export type { Options as O, PluginClient as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "3.0.0-alpha.15",
3
+ "version": "3.0.0-alpha.17",
4
4
  "description": "Generator plugin-client",
5
5
  "keywords": [
6
6
  "typescript",
@@ -72,27 +72,28 @@
72
72
  "!/**/__tests__/**"
73
73
  ],
74
74
  "dependencies": {
75
- "@kubb/core": "3.0.0-alpha.15",
76
- "@kubb/fs": "3.0.0-alpha.15",
77
- "@kubb/oas": "3.0.0-alpha.15",
78
- "@kubb/parser-ts": "3.0.0-alpha.15",
79
- "@kubb/plugin-oas": "3.0.0-alpha.15",
80
- "@kubb/plugin-ts": "3.0.0-alpha.15",
81
- "@kubb/react": "3.0.0-alpha.15"
75
+ "@kubb/core": "3.0.0-alpha.17",
76
+ "@kubb/fs": "3.0.0-alpha.17",
77
+ "@kubb/oas": "3.0.0-alpha.17",
78
+ "@kubb/parser-ts": "3.0.0-alpha.17",
79
+ "@kubb/plugin-oas": "3.0.0-alpha.17",
80
+ "@kubb/plugin-ts": "3.0.0-alpha.17",
81
+ "@kubb/plugin-zod": "3.0.0-alpha.17",
82
+ "@kubb/react": "3.0.0-alpha.17"
82
83
  },
83
84
  "devDependencies": {
84
85
  "@types/react": "^18.3.5",
85
86
  "axios": "^1.7.7",
86
87
  "react": "^18.3.1",
87
88
  "tsup": "^8.2.4",
88
- "typescript": "^5.5.4",
89
- "@kubb/config-biome": "3.0.0-alpha.15",
90
- "@kubb/config-ts": "3.0.0-alpha.15",
91
- "@kubb/config-tsup": "3.0.0-alpha.15"
89
+ "typescript": "^5.6.2",
90
+ "@kubb/config-biome": "3.0.0-alpha.17",
91
+ "@kubb/config-ts": "3.0.0-alpha.17",
92
+ "@kubb/config-tsup": "3.0.0-alpha.17"
92
93
  },
93
94
  "peerDependencies": {
94
95
  "axios": "^1.7.2",
95
- "@kubb/react": "3.0.0-alpha.15"
96
+ "@kubb/react": "3.0.0-alpha.17"
96
97
  },
97
98
  "peerDependenciesMeta": {
98
99
  "axios": {