@kubb/plugin-react-query 5.0.0-alpha.32 → 5.0.0-alpha.33
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.
- package/dist/{components-DQiCnrXP.cjs → components-Cq0WNTay.cjs} +56 -55
- package/dist/components-Cq0WNTay.cjs.map +1 -0
- package/dist/{components-HG1bVVRU.js → components-DTiE-FKc.js} +4 -3
- package/dist/components-DTiE-FKc.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +12 -12
- package/dist/components.js +1 -1
- package/dist/{generators-CeU3eFdF.cjs → generators-B5WzWWUx.cjs} +133 -133
- package/dist/{generators-CeU3eFdF.cjs.map → generators-B5WzWWUx.cjs.map} +1 -1
- package/dist/{generators-BZKMuZRH.js → generators-DnnpkRmx.js} +4 -4
- package/dist/{generators-BZKMuZRH.js.map → generators-DnnpkRmx.js.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{types-DMLrT2SW.d.ts → types-Crg16xc2.d.ts} +5 -6
- package/package.json +10 -10
- package/src/components/InfiniteQuery.tsx +4 -3
- package/src/components/InfiniteQueryOptions.tsx +4 -3
- package/src/components/Mutation.tsx +4 -3
- package/src/components/MutationOptions.tsx +5 -3
- package/src/components/Query.tsx +4 -3
- package/src/components/QueryOptions.tsx +4 -12
- package/src/components/SuspenseInfiniteQuery.tsx +4 -3
- package/src/components/SuspenseInfiniteQueryOptions.tsx +4 -3
- package/src/components/SuspenseQuery.tsx +4 -3
- package/src/generators/customHookOptionsFileGenerator.tsx +1 -1
- package/src/generators/hookOptionsGenerator.tsx +1 -1
- package/src/generators/infiniteQueryGenerator.tsx +1 -1
- package/src/generators/mutationGenerator.tsx +1 -1
- package/src/generators/queryGenerator.tsx +1 -1
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +1 -1
- package/src/generators/suspenseQueryGenerator.tsx +1 -1
- package/src/plugin.ts +3 -3
- package/dist/components-DQiCnrXP.cjs.map +0 -1
- package/dist/components-HG1bVVRU.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../package.json","../src/plugin.ts"],"sourcesContent":["","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { createFile, createSource } from '@kubb/ast'\nimport type { FileNode } from '@kubb/ast/types'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { version } from '../package.json'\nimport { MutationKey } from './components'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport type { PluginReactQuery } from './types.ts'\n\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\nexport const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n suspense = {},\n infinite = false,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n generators = [\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n ].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n customOptions,\n paramsCasing,\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginReactQueryName,\n version,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/react-query',\n ...mutation,\n },\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : undefined,\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n exclude,\n include,\n override,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\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 (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.getPlugin(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.upsertFile(\n createFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n createSource({\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n }),\n ],\n }),\n )\n }\n\n if (!hasClientPlugin) {\n await this.upsertFile(\n createFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n createSource({\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n }),\n ],\n }),\n )\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.driver.fileManager.files as unknown as FileNode[], {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;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QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP,aAAa;KACX,MAAM;KACN,OAAO,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAUA,WAAoBC;KAC3E,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC,CACH;AAGH,OAAI,CAAC,gBACH,OAAM,KAAK,WACT,WAAW;IACT,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP,aAAa;KACX,MAAM;KACN,OAAOC;KACP,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC,CACH;GAeH,MAAM,QAAQ,MAZa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,YAAY,OAAgC;IAC/F,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../package.json","../src/plugin.ts"],"sourcesContent":["","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { createFile, createSource, createText } from '@kubb/ast'\nimport type { FileNode } from '@kubb/ast/types'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { version } from '../package.json'\nimport { MutationKey } from './components'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport type { PluginReactQuery } from './types.ts'\n\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\nexport const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n suspense = {},\n infinite = false,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n generators = [\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n ].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n customOptions,\n paramsCasing,\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginReactQueryName,\n version,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/react-query',\n ...mutation,\n },\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : undefined,\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n exclude,\n include,\n override,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\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 (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.getPlugin(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.upsertFile(\n createFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n createSource({\n name: 'fetch',\n nodes: [createText(this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n }),\n )\n }\n\n if (!hasClientPlugin) {\n await this.upsertFile(\n createFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n createSource({\n name: 'config',\n nodes: [createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n }),\n )\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.driver.fileManager.files as unknown as FileNode[], {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AC0BA,MAAa,uBAAuB;AAEpC,MAAa,mBAAmB,cAAgC,YAAY;CAC1E,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,WAAW,EAAE,EACb,WAAW,OACX,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,OAAO,QAAQ,EACjB,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,eACA,cACA,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;AAEhH,QAAO;EACL,MAAM;EACN;EACA,SAAS;GACP;GACA,QAAQ;IACN,QAAQ,QAAQ;IAChB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AAc,MAAM,eAAe,KAAK,OAAO,YAAY,OAAgC;IAC/F,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { Output, PluginFactoryOptions, ResolveNameParams, UserGroup } from "@kubb/core";
|
|
2
|
+
import { FunctionParams, Output, PluginFactoryOptions, ResolveNameParams, UserGroup } from "@kubb/core";
|
|
3
3
|
import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
|
|
4
4
|
import { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
5
5
|
import { HttpMethod, Oas, Operation, contentType } from "@kubb/oas";
|
|
6
|
-
import { FunctionParams } from "@kubb/react-fabric";
|
|
7
6
|
import { Generator } from "@kubb/plugin-oas/generators";
|
|
8
|
-
import {
|
|
7
|
+
import { KubbReactNode } from "@kubb/renderer-jsx/types";
|
|
9
8
|
|
|
10
9
|
//#region ../../internals/tanstack-query/src/types.d.ts
|
|
11
10
|
type ParamsCasing = 'camelcase' | undefined;
|
|
@@ -39,7 +38,7 @@ declare function MutationKey$1({
|
|
|
39
38
|
operation,
|
|
40
39
|
typeName,
|
|
41
40
|
transformer
|
|
42
|
-
}: Props$1):
|
|
41
|
+
}: Props$1): KubbReactNode;
|
|
43
42
|
declare namespace MutationKey$1 {
|
|
44
43
|
var getParams: ({}: GetParamsProps$1) => FunctionParams;
|
|
45
44
|
var getTransformer: Transformer;
|
|
@@ -68,7 +67,7 @@ declare function QueryKey$1({
|
|
|
68
67
|
operation,
|
|
69
68
|
typeName,
|
|
70
69
|
transformer
|
|
71
|
-
}: Props):
|
|
70
|
+
}: Props): KubbReactNode;
|
|
72
71
|
declare namespace QueryKey$1 {
|
|
73
72
|
var getParams: ({
|
|
74
73
|
pathParamsType,
|
|
@@ -277,4 +276,4 @@ declare global {
|
|
|
277
276
|
}
|
|
278
277
|
//#endregion
|
|
279
278
|
export { MutationKey$1 as a, QueryKey$1 as i, Options as n, PluginReactQuery as r, Infinite as t };
|
|
280
|
-
//# sourceMappingURL=types-
|
|
279
|
+
//# sourceMappingURL=types-Crg16xc2.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.33",
|
|
4
4
|
"description": "React Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for React applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-query",
|
|
@@ -71,18 +71,18 @@
|
|
|
71
71
|
}
|
|
72
72
|
],
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@kubb/react-fabric": "0.15.1",
|
|
75
74
|
"remeda": "^2.33.7",
|
|
76
|
-
"@kubb/ast": "5.0.0-alpha.
|
|
77
|
-
"@kubb/core": "5.0.0-alpha.
|
|
78
|
-
"@kubb/oas": "5.0.0-alpha.
|
|
79
|
-
"@kubb/plugin-client": "5.0.0-alpha.
|
|
80
|
-
"@kubb/plugin-oas": "5.0.0-alpha.
|
|
81
|
-
"@kubb/plugin-ts": "5.0.0-alpha.
|
|
82
|
-
"@kubb/plugin-zod": "5.0.0-alpha.
|
|
75
|
+
"@kubb/ast": "5.0.0-alpha.33",
|
|
76
|
+
"@kubb/core": "5.0.0-alpha.33",
|
|
77
|
+
"@kubb/oas": "5.0.0-alpha.33",
|
|
78
|
+
"@kubb/plugin-client": "5.0.0-alpha.33",
|
|
79
|
+
"@kubb/plugin-oas": "5.0.0-alpha.33",
|
|
80
|
+
"@kubb/plugin-ts": "5.0.0-alpha.33",
|
|
81
|
+
"@kubb/plugin-zod": "5.0.0-alpha.33",
|
|
82
|
+
"@kubb/renderer-jsx": "5.0.0-alpha.33"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"@kubb/
|
|
85
|
+
"@kubb/renderer-jsx": "5.0.0-alpha.33"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=22"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
2
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
4
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
|
-
import { File, Function
|
|
5
|
-
import type {
|
|
5
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
6
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
7
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
9
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -136,7 +137,7 @@ export function InfiniteQuery({
|
|
|
136
137
|
initialPageParam,
|
|
137
138
|
queryParam,
|
|
138
139
|
customOptions,
|
|
139
|
-
}: Props):
|
|
140
|
+
}: Props): KubbReactNode {
|
|
140
141
|
const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
141
142
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
142
143
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getNestedAccessor } from '@internals/utils'
|
|
2
|
+
import { FunctionParams } from '@kubb/core'
|
|
2
3
|
import { isAllOptional, isOptional } from '@kubb/oas'
|
|
3
4
|
import { ClientLegacy as Client } from '@kubb/plugin-client'
|
|
4
5
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
6
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
6
|
-
import { File, Function
|
|
7
|
-
import type {
|
|
7
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
8
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
8
9
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
9
10
|
import { QueryKey } from './QueryKey.tsx'
|
|
10
11
|
|
|
@@ -127,7 +128,7 @@ export function InfiniteQueryOptions({
|
|
|
127
128
|
pathParamsType,
|
|
128
129
|
queryParam,
|
|
129
130
|
queryKeyName,
|
|
130
|
-
}: Props):
|
|
131
|
+
}: Props): KubbReactNode {
|
|
131
132
|
const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
132
133
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
133
134
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { isOptional, type Operation } from '@kubb/oas'
|
|
2
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
4
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
|
-
import { File, Function
|
|
5
|
-
import type {
|
|
5
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
6
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
7
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
8
|
import { MutationKey } from './MutationKey.tsx'
|
|
8
9
|
import { MutationOptions } from './MutationOptions.tsx'
|
|
@@ -82,7 +83,7 @@ export function Mutation({
|
|
|
82
83
|
operation,
|
|
83
84
|
mutationKeyName,
|
|
84
85
|
customOptions,
|
|
85
|
-
}: Props):
|
|
86
|
+
}: Props): KubbReactNode {
|
|
86
87
|
const mutationKeyParams = MutationKey.getParams({
|
|
87
88
|
pathParamsType,
|
|
88
89
|
typeSchemas,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { Params } from '@kubb/core'
|
|
2
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
3
|
import { isOptional } from '@kubb/oas'
|
|
2
4
|
import { ClientLegacy as Client } from '@kubb/plugin-client'
|
|
3
5
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
6
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
|
-
import { File, Function
|
|
6
|
-
import type {
|
|
7
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
8
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
7
9
|
import type { PluginReactQuery } from '../types.ts'
|
|
8
10
|
import { MutationKey } from './MutationKey.tsx'
|
|
9
11
|
|
|
@@ -42,7 +44,7 @@ export function MutationOptions({
|
|
|
42
44
|
paramsType,
|
|
43
45
|
pathParamsType,
|
|
44
46
|
mutationKeyName,
|
|
45
|
-
}: Props):
|
|
47
|
+
}: Props): KubbReactNode {
|
|
46
48
|
const params = getParams({ typeSchemas })
|
|
47
49
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
48
50
|
const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'
|
package/src/components/Query.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
2
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
4
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
|
-
import { File, Function
|
|
5
|
-
import type {
|
|
5
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
6
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
7
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
9
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -132,7 +133,7 @@ export function Query({
|
|
|
132
133
|
typeSchemas,
|
|
133
134
|
operation,
|
|
134
135
|
customOptions,
|
|
135
|
-
}: Props):
|
|
136
|
+
}: Props): KubbReactNode {
|
|
136
137
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
137
138
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
138
139
|
const returnType = `UseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { isAllOptional, isOptional } from '@kubb/oas'
|
|
2
3
|
import { ClientLegacy as Client } from '@kubb/plugin-client'
|
|
3
4
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
5
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
|
-
import { File, Function
|
|
6
|
-
import type {
|
|
6
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
7
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
7
8
|
import type { PluginReactQuery } from '../types.ts'
|
|
8
9
|
import { QueryKey } from './QueryKey.tsx'
|
|
9
10
|
|
|
@@ -107,16 +108,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: Ge
|
|
|
107
108
|
})
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
export function QueryOptions({
|
|
111
|
-
name,
|
|
112
|
-
clientName,
|
|
113
|
-
dataReturnType,
|
|
114
|
-
typeSchemas,
|
|
115
|
-
paramsCasing,
|
|
116
|
-
paramsType,
|
|
117
|
-
pathParamsType,
|
|
118
|
-
queryKeyName,
|
|
119
|
-
}: Props): FabricReactNode {
|
|
111
|
+
export function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): KubbReactNode {
|
|
120
112
|
const params = getParams({
|
|
121
113
|
paramsType,
|
|
122
114
|
paramsCasing,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
2
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
4
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
|
-
import { File, Function
|
|
5
|
-
import type {
|
|
5
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
6
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
7
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
9
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -136,7 +137,7 @@ export function SuspenseInfiniteQuery({
|
|
|
136
137
|
customOptions,
|
|
137
138
|
initialPageParam,
|
|
138
139
|
queryParam,
|
|
139
|
-
}: Props):
|
|
140
|
+
}: Props): KubbReactNode {
|
|
140
141
|
const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
141
142
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
142
143
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getNestedAccessor } from '@internals/utils'
|
|
2
|
+
import { FunctionParams } from '@kubb/core'
|
|
2
3
|
import { isAllOptional, isOptional } from '@kubb/oas'
|
|
3
4
|
import { ClientLegacy as Client } from '@kubb/plugin-client'
|
|
4
5
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
6
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
6
|
-
import { File, Function
|
|
7
|
-
import type {
|
|
7
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
8
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
8
9
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
9
10
|
import { QueryKey } from './QueryKey.tsx'
|
|
10
11
|
|
|
@@ -127,7 +128,7 @@ export function SuspenseInfiniteQueryOptions({
|
|
|
127
128
|
pathParamsType,
|
|
128
129
|
queryParam,
|
|
129
130
|
queryKeyName,
|
|
130
|
-
}: Props):
|
|
131
|
+
}: Props): KubbReactNode {
|
|
131
132
|
const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
132
133
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
133
134
|
const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { isAllOptional, isOptional, type Operation } from '@kubb/oas'
|
|
2
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
3
4
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
4
|
-
import { File, Function
|
|
5
|
-
import type {
|
|
5
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
6
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
7
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
9
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -142,7 +143,7 @@ export function SuspenseQuery({
|
|
|
142
143
|
typeSchemas,
|
|
143
144
|
operation,
|
|
144
145
|
customOptions,
|
|
145
|
-
}: Props):
|
|
146
|
+
}: Props): KubbReactNode {
|
|
146
147
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
147
148
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
148
149
|
const returnType = `UseSuspenseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|
|
@@ -4,7 +4,7 @@ import { useDriver } from '@kubb/core/hooks'
|
|
|
4
4
|
import type { Operation } from '@kubb/oas'
|
|
5
5
|
import { createReactGenerator } from '@kubb/plugin-oas/generators'
|
|
6
6
|
import { useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
7
|
-
import { File, Function } from '@kubb/
|
|
7
|
+
import { File, Function } from '@kubb/renderer-jsx'
|
|
8
8
|
import type { PluginReactQuery } from '../types'
|
|
9
9
|
|
|
10
10
|
export const customHookOptionsFileGenerator = createReactGenerator<PluginReactQuery>({
|
|
@@ -3,7 +3,7 @@ import type { Operation } from '@kubb/oas'
|
|
|
3
3
|
import { createReactGenerator } from '@kubb/plugin-oas/generators'
|
|
4
4
|
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
5
5
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
6
|
-
import { File, Type } from '@kubb/
|
|
6
|
+
import { File, Type } from '@kubb/renderer-jsx'
|
|
7
7
|
import { difference } from 'remeda'
|
|
8
8
|
import type { PluginReactQuery } from '../types'
|
|
9
9
|
|
|
@@ -6,7 +6,7 @@ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
|
6
6
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
9
|
-
import { File } from '@kubb/
|
|
9
|
+
import { File } from '@kubb/renderer-jsx'
|
|
10
10
|
import { difference } from 'remeda'
|
|
11
11
|
import { InfiniteQuery, InfiniteQueryOptions, QueryKey } from '../components'
|
|
12
12
|
import type { PluginReactQuery } from '../types'
|
|
@@ -6,7 +6,7 @@ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
|
6
6
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
9
|
-
import { File } from '@kubb/
|
|
9
|
+
import { File } from '@kubb/renderer-jsx'
|
|
10
10
|
import { difference } from 'remeda'
|
|
11
11
|
import { Mutation, MutationKey } from '../components'
|
|
12
12
|
import { MutationOptions } from '../components/MutationOptions.tsx'
|
|
@@ -6,7 +6,7 @@ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
|
6
6
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
9
|
-
import { File } from '@kubb/
|
|
9
|
+
import { File } from '@kubb/renderer-jsx'
|
|
10
10
|
import { difference } from 'remeda'
|
|
11
11
|
import { Query, QueryKey, QueryOptions } from '../components'
|
|
12
12
|
import type { PluginReactQuery } from '../types'
|
|
@@ -6,7 +6,7 @@ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
|
6
6
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
9
|
-
import { File } from '@kubb/
|
|
9
|
+
import { File } from '@kubb/renderer-jsx'
|
|
10
10
|
import { difference } from 'remeda'
|
|
11
11
|
import { QueryKey, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions } from '../components'
|
|
12
12
|
import type { PluginReactQuery } from '../types'
|
|
@@ -6,7 +6,7 @@ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
|
6
6
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
9
|
-
import { File } from '@kubb/
|
|
9
|
+
import { File } from '@kubb/renderer-jsx'
|
|
10
10
|
import { difference } from 'remeda'
|
|
11
11
|
import { QueryKey, QueryOptions, SuspenseQuery } from '../components'
|
|
12
12
|
import type { PluginReactQuery } from '../types'
|
package/src/plugin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { camelCase, pascalCase } from '@internals/utils'
|
|
3
|
-
import { createFile, createSource } from '@kubb/ast'
|
|
3
|
+
import { createFile, createSource, createText } from '@kubb/ast'
|
|
4
4
|
import type { FileNode } from '@kubb/ast/types'
|
|
5
5
|
import { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'
|
|
6
6
|
import { pluginClientName } from '@kubb/plugin-client'
|
|
@@ -189,7 +189,7 @@ export const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {
|
|
|
189
189
|
sources: [
|
|
190
190
|
createSource({
|
|
191
191
|
name: 'fetch',
|
|
192
|
-
|
|
192
|
+
nodes: [createText(this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource)],
|
|
193
193
|
isExportable: true,
|
|
194
194
|
isIndexable: true,
|
|
195
195
|
}),
|
|
@@ -206,7 +206,7 @@ export const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {
|
|
|
206
206
|
sources: [
|
|
207
207
|
createSource({
|
|
208
208
|
name: 'config',
|
|
209
|
-
|
|
209
|
+
nodes: [createText(configSource)],
|
|
210
210
|
isExportable: false,
|
|
211
211
|
isIndexable: false,
|
|
212
212
|
}),
|