@kubb/plugin-react-query 3.0.0-alpha.10 → 3.0.0-alpha.12
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/chunk-AGLJPONA.cjs +1423 -0
- package/dist/chunk-AGLJPONA.cjs.map +1 -0
- package/dist/{chunk-ZYTZV43V.js → chunk-I7X4HNDR.js} +228 -285
- package/dist/chunk-I7X4HNDR.js.map +1 -0
- package/dist/components.cjs +23 -12
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +2 -12
- package/dist/components.js.map +1 -1
- package/dist/{index-5kpkk-7M.d.cts → index-BzoLlZve.d.cts} +0 -8
- package/dist/{index-5kpkk-7M.d.ts → index-BzoLlZve.d.ts} +0 -8
- package/dist/index.cjs +52 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -26
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/__snapshots__/mutateAsQuery/updatePetWithForm.ts +3 -3
- package/src/__snapshots__/pathParamsTypeInline/getPetById.ts +2 -2
- package/src/__snapshots__/pathParamsTypeObject/getPetById.ts +3 -3
- package/src/__snapshots__/queryOptions/getPetById.ts +3 -3
- package/src/components/Mutation.tsx +4 -20
- package/src/components/Query.tsx +3 -4
- package/src/components/QueryImports.tsx +2 -2
- package/src/components/QueryOptions.tsx +5 -15
- package/src/components/SchemaType.tsx +17 -2
- package/src/components/__snapshots__/gen/showPetById.ts +1 -1
- package/dist/chunk-7ZODZVKP.cjs +0 -1470
- package/dist/chunk-7ZODZVKP.cjs.map +0 -1
- package/dist/chunk-ZYTZV43V.js.map +0 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-react-query/dist/index.cjs","../src/plugin.ts","../src/OperationGenerator.ts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C,MAAA;AAEO,MAAA;AACT,IAAA;AACmB,IAAA;AAC0C,MAAA;AAEnB,MAAA;AACI,MAAA;AACN,MAAA;AAEP,MAAA;AAC7B,QAAA;AACoB,QAAA;AACP,QAAA;AACsB,QAAA;AACnC,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AAE4C,MAAA;AAClB,MAAA;AAEQ,MAAA;AACU,QAAA;AACzC,UAAA;AACA,UAAA;AACwB,UAAA;AAClB,UAAA;AACmB,YAAA;AACzB,UAAA;AACa,UAAA;AACd,QAAA;AAEgC,QAAA;AACnC,MAAA;AACF,IAAA;AACF,EAAA;AACD;ADkBkD;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-react-query/dist/index.cjs","sourcesContent":[null,"import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { Mutation, Query, QueryKey, QueryOptions } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\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' },\n group,\n exclude = [],\n include,\n override = [],\n parser,\n suspense = {},\n infinite,\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n mutate = {},\n query = {},\n queryOptions = {},\n templates,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginReactQueryName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n client: {\n importPath: '@kubb/plugin-client/client',\n ...options.client,\n },\n dataReturnType,\n pathParamsType,\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n query: query\n ? {\n queryKey: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n }\n : false,\n queryOptions,\n mutate: mutate\n ? {\n variablesType: 'hook',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutate,\n }\n : false,\n templates: {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...templates,\n },\n parser,\n },\n pre: [pluginOasName, pluginTsName, 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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n prefix: 'use',\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 [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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 const files = await operationGenerator.build()\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 { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { Query } from './components/Query.tsx'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport { QueryOptions } from './components/QueryOptions.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\nimport type { FileMeta, PluginReactQuery } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginReactQuery['resolvedOptions'], PluginReactQuery, FileMeta> {\n async operation(operation: Operation, options: PluginReactQuery['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const templates = {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...options.templates,\n }\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutate = !isQuery && options.mutate && options.mutate.methods.some((method) => operation.method === method)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n {isMutate && templates?.mutation && <Mutation.File templates={templates.mutation} />}\n {isQuery && templates?.query && templates.queryKey && templates.queryOptions && templates.queryImports && (\n <Query.File\n templates={{\n query: templates.query,\n queryKey: templates.queryKey,\n queryOptions: templates.queryOptions,\n queryImports: templates.queryImports,\n }}\n />\n )}\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/OperationGenerator.tsx","../src/plugin.ts"],"names":["Generator","createRoot","Mutation","Query","QueryOptions","QueryKey","QueryImports","jsx","App","Oas","jsxs","createPlugin","transformers","pluginOasName","pluginTsName","pluginZodName","options","path","FileManager","camelCase","renderTemplate","pascalCase","PluginManager"],"mappings":";;;;;;;;;;;;;;;;;;AAcO,IAAM,kBAAA,GAAN,cAAiCA,4BAA2E,CAAA;AAAA,EACjH,MAAM,SAAU,CAAA,SAAA,EAAsB,OAA+E,EAAA;AACnH,IAAA,MAAM,EAAE,GAAK,EAAA,aAAA,EAAe,MAAQ,EAAA,IAAA,KAAS,IAAK,CAAA,OAAA,CAAA;AAElD,IAAA,MAAM,OAAOC,gBAAW,CAAA;AAAA,MACtB,QAAQ,aAAc,CAAA,MAAA;AAAA,KACvB,CAAA,CAAA;AAED,IAAA,MAAM,SAAY,GAAA;AAAA,MAChB,UAAUC,0BAAS,CAAA,SAAA;AAAA,MACnB,OAAOC,uBAAM,CAAA,SAAA;AAAA,MACb,cAAcC,8BAAa,CAAA,SAAA;AAAA,MAC3B,UAAUC,0BAAS,CAAA,SAAA;AAAA,MACnB,cAAcC,8BAAa,CAAA,SAAA;AAAA,MAC3B,GAAG,OAAQ,CAAA,SAAA;AAAA,KACb,CAAA;AAEA,IAAA,MAAM,OAAU,GAAA,OAAO,OAAQ,CAAA,KAAA,KAAU,YAAY,IAAO,GAAA,OAAA,CAAQ,KAAO,EAAA,OAAA,CAAQ,IAAK,CAAA,CAAC,MAAW,KAAA,SAAA,CAAU,WAAW,MAAM,CAAA,CAAA;AAC/H,IAAA,MAAM,QAAW,GAAA,CAAC,OAAW,IAAA,OAAA,CAAQ,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hE,MAAA,MAAM,kBAAqB,GAAA,IAAI,kBAAmB,CAAA,IAAA,CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA,EAAa,cAAc,OAAQ,CAAA,WAAA;AAAA,QACnC,OAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA,IAAA;AAAA,OACD,CAAA,CAAA;AAED,MAAM,MAAA,KAAA,GAAQ,MAAM,kBAAA,CAAmB,KAAM,EAAA,CAAA;AAC7C,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA,CAAA;AAE3B,MAAI,IAAA,IAAA,CAAK,MAAO,CAAA,MAAA,CAAO,UAAY,EAAA;AACjC,QAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,UACxD,IAAA;AAAA,UACA,MAAA;AAAA,UACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,UACxB,IAAM,EAAA;AAAA,YACJ,SAAA,EAAW,KAAK,MAAO,CAAA,GAAA;AAAA,WACzB;AAAA,UACA,QAAQ,IAAK,CAAA,MAAA;AAAA,SACd,CAAA,CAAA;AAED,QAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,OACnC;AAAA,KACF;AAAA,GACF,CAAA;AACF,CAAC","file":"index.cjs","sourcesContent":["import { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { Query } from './components/Query.tsx'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport { QueryOptions } from './components/QueryOptions.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\nimport type { FileMeta, PluginReactQuery } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginReactQuery['resolvedOptions'], PluginReactQuery, FileMeta> {\n async operation(operation: Operation, options: PluginReactQuery['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const templates = {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...options.templates,\n }\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutate = !isQuery && options.mutate && options.mutate.methods.some((method) => operation.method === method)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n {isMutate && templates?.mutation && <Mutation.File templates={templates.mutation} />}\n {isQuery && templates?.query && templates.queryKey && templates.queryOptions && templates.queryImports && (\n <Query.File\n templates={{\n query: templates.query,\n queryKey: templates.queryKey,\n queryOptions: templates.queryOptions,\n queryImports: templates.queryImports,\n }}\n />\n )}\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { Mutation, Query, QueryKey, QueryOptions } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\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' },\n group,\n exclude = [],\n include,\n override = [],\n parser,\n suspense = {},\n infinite,\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n mutate = {},\n query = {},\n queryOptions = {},\n templates,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginReactQueryName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n client: {\n importPath: '@kubb/plugin-client/client',\n ...options.client,\n },\n dataReturnType,\n pathParamsType,\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n query: query\n ? {\n queryKey: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n }\n : false,\n queryOptions,\n mutate: mutate\n ? {\n variablesType: 'hook',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutate,\n }\n : false,\n templates: {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...templates,\n },\n parser,\n },\n pre: [pluginOasName, pluginTsName, 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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n prefix: 'use',\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 [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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 const files = await operationGenerator.build()\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"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from
|
|
1
|
+
import { Mutation, Query, QueryOptions, QueryKey, QueryImports } from './chunk-I7X4HNDR.js';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { createPlugin, FileManager, PluginManager } from '@kubb/core';
|
|
4
|
+
import { camelCase, pascalCase } from '@kubb/core/transformers';
|
|
5
|
+
import { renderTemplate } from '@kubb/core/utils';
|
|
6
|
+
import { pluginOasName, OperationGenerator as OperationGenerator$1 } from '@kubb/plugin-oas';
|
|
7
|
+
import { pluginTsName } from '@kubb/plugin-ts';
|
|
8
|
+
import { pluginZodName } from '@kubb/plugin-zod';
|
|
9
|
+
import { Oas } from '@kubb/plugin-oas/components';
|
|
10
|
+
import { createRoot, App } from '@kubb/react';
|
|
11
|
+
import { jsx, jsxs } from '@kubb/react/jsx-runtime';
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import { FileManager, PluginManager, createPlugin } from "@kubb/core";
|
|
12
|
-
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
13
|
-
import { renderTemplate } from "@kubb/core/utils";
|
|
14
|
-
import { pluginOasName } from "@kubb/plugin-oas";
|
|
15
|
-
import { pluginTsName } from "@kubb/plugin-ts";
|
|
16
|
-
import { pluginZodName } from "@kubb/plugin-zod";
|
|
17
|
-
|
|
18
|
-
// src/OperationGenerator.tsx
|
|
19
|
-
import { OperationGenerator as Generator } from "@kubb/plugin-oas";
|
|
20
|
-
import { Oas } from "@kubb/plugin-oas/components";
|
|
21
|
-
import { App, createRoot } from "@kubb/react";
|
|
22
|
-
import { jsx, jsxs } from "@kubb/react/jsx-runtime";
|
|
23
|
-
var OperationGenerator = class extends Generator {
|
|
13
|
+
var OperationGenerator = class extends OperationGenerator$1 {
|
|
24
14
|
async operation(operation, options) {
|
|
25
15
|
const { oas, pluginManager, plugin, mode } = this.context;
|
|
26
16
|
const root = createRoot({
|
|
@@ -180,8 +170,7 @@ var pluginReactQuery = createPlugin((options) => {
|
|
|
180
170
|
}
|
|
181
171
|
};
|
|
182
172
|
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
173
|
+
|
|
174
|
+
export { pluginReactQuery, pluginReactQueryName };
|
|
175
|
+
//# sourceMappingURL=index.js.map
|
|
187
176
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts","../src/OperationGenerator.tsx"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { Mutation, Query, QueryKey, QueryOptions } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\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' },\n group,\n exclude = [],\n include,\n override = [],\n parser,\n suspense = {},\n infinite,\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n mutate = {},\n query = {},\n queryOptions = {},\n templates,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginReactQueryName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n client: {\n importPath: '@kubb/plugin-client/client',\n ...options.client,\n },\n dataReturnType,\n pathParamsType,\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n query: query\n ? {\n queryKey: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n }\n : false,\n queryOptions,\n mutate: mutate\n ? {\n variablesType: 'hook',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutate,\n }\n : false,\n templates: {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...templates,\n },\n parser,\n },\n pre: [pluginOasName, pluginTsName, 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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n prefix: 'use',\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 [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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 const files = await operationGenerator.build()\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 { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { Query } from './components/Query.tsx'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport { QueryOptions } from './components/QueryOptions.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\nimport type { FileMeta, PluginReactQuery } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginReactQuery['resolvedOptions'], PluginReactQuery, FileMeta> {\n async operation(operation: Operation, options: PluginReactQuery['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const templates = {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...options.templates,\n }\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutate = !isQuery && options.mutate && options.mutate.methods.some((method) => operation.method === method)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n {isMutate && templates?.mutation && <Mutation.File templates={templates.mutation} />}\n {isQuery && templates?.query && templates.queryKey && templates.queryOptions && templates.queryImports && (\n <Query.File\n templates={{\n query: templates.query,\n queryKey: templates.queryKey,\n queryOptions: templates.queryOptions,\n queryImports: templates.queryImports,\n }}\n />\n )}\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,UAAU;AAEjB,SAAS,aAAa,eAAe,oBAAoB;AACzD,SAAS,WAAW,kBAAkB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAE9B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;;;ACR9B,SAAS,sBAAsB,iBAAiB;AAChD,SAAS,WAAW;AACpB,SAAS,KAAK,kBAAkB;AAmCtB,SACsC,KADtC;AAvBH,IAAM,qBAAN,cAAiC,UAA2E;AAAA,EACjH,MAAM,UAAU,WAAsB,SAA+E;AACnH,UAAM,EAAE,KAAK,eAAe,QAAQ,KAAK,IAAI,KAAK;AAElD,UAA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B,CAAA,IAAA,CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA,EAAa,cAAc,OAAQ,CAAA,WAAA;AAAA,QACnC,OAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA,IAAA;AAAA,OACD,CAAA,CAAA;AAED,MAAM,MAAA,KAAA,GAAQ,MAAM,kBAAA,CAAmB,KAAM,EAAA,CAAA;AAC7C,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA,CAAA;AAE3B,MAAI,IAAA,IAAA,CAAK,MAAO,CAAA,MAAA,CAAO,UAAY,EAAA;AACjC,QAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,UACxD,IAAA;AAAA,UACA,MAAA;AAAA,UACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,UACxB,IAAM,EAAA;AAAA,YACJ,SAAA,EAAW,KAAK,MAAO,CAAA,GAAA;AAAA,WACzB;AAAA,UACA,QAAQ,IAAK,CAAA,MAAA;AAAA,SACd,CAAA,CAAA;AAED,QAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,OACnC;AAAA,KACF;AAAA,GACF,CAAA;AACF,CAAC","file":"index.js","sourcesContent":["import { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { Query } from './components/Query.tsx'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport { QueryOptions } from './components/QueryOptions.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\nimport type { FileMeta, PluginReactQuery } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginReactQuery['resolvedOptions'], PluginReactQuery, FileMeta> {\n async operation(operation: Operation, options: PluginReactQuery['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const templates = {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...options.templates,\n }\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutate = !isQuery && options.mutate && options.mutate.methods.some((method) => operation.method === method)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n {isMutate && templates?.mutation && <Mutation.File templates={templates.mutation} />}\n {isQuery && templates?.query && templates.queryKey && templates.queryOptions && templates.queryImports && (\n <Query.File\n templates={{\n query: templates.query,\n queryKey: templates.queryKey,\n queryOptions: templates.queryOptions,\n queryImports: templates.queryImports,\n }}\n />\n )}\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { Mutation, Query, QueryKey, QueryOptions } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryImports } from './components/QueryImports.tsx'\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' },\n group,\n exclude = [],\n include,\n override = [],\n parser,\n suspense = {},\n infinite,\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n mutate = {},\n query = {},\n queryOptions = {},\n templates,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginReactQueryName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n client: {\n importPath: '@kubb/plugin-client/client',\n ...options.client,\n },\n dataReturnType,\n pathParamsType,\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n query: query\n ? {\n queryKey: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n }\n : false,\n queryOptions,\n mutate: mutate\n ? {\n variablesType: 'hook',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutate,\n }\n : false,\n templates: {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n queryKey: QueryKey.templates,\n queryImports: QueryImports.templates,\n ...templates,\n },\n parser,\n },\n pre: [pluginOasName, pluginTsName, 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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n prefix: 'use',\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 [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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 const files = await operationGenerator.build()\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.12",
|
|
4
4
|
"description": "Generator react-query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"faker",
|
|
@@ -54,27 +54,27 @@
|
|
|
54
54
|
"!/**/__tests__/**"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@kubb/core": "3.0.0-alpha.
|
|
58
|
-
"@kubb/fs": "3.0.0-alpha.
|
|
59
|
-
"@kubb/oas": "3.0.0-alpha.
|
|
60
|
-
"@kubb/parser-ts": "3.0.0-alpha.
|
|
61
|
-
"@kubb/plugin-faker": "3.0.0-alpha.
|
|
62
|
-
"@kubb/plugin-oas": "3.0.0-alpha.
|
|
63
|
-
"@kubb/plugin-ts": "3.0.0-alpha.
|
|
64
|
-
"@kubb/
|
|
65
|
-
"@kubb/
|
|
57
|
+
"@kubb/core": "3.0.0-alpha.12",
|
|
58
|
+
"@kubb/fs": "3.0.0-alpha.12",
|
|
59
|
+
"@kubb/oas": "3.0.0-alpha.12",
|
|
60
|
+
"@kubb/parser-ts": "3.0.0-alpha.12",
|
|
61
|
+
"@kubb/plugin-faker": "3.0.0-alpha.12",
|
|
62
|
+
"@kubb/plugin-oas": "3.0.0-alpha.12",
|
|
63
|
+
"@kubb/plugin-ts": "3.0.0-alpha.12",
|
|
64
|
+
"@kubb/react": "3.0.0-alpha.12",
|
|
65
|
+
"@kubb/plugin-zod": "3.0.0-alpha.12"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/react": "^18.3.5",
|
|
69
69
|
"react": "^18.3.1",
|
|
70
70
|
"tsup": "^8.2.4",
|
|
71
71
|
"typescript": "^5.5.4",
|
|
72
|
-
"@kubb/config-biome": "3.0.0-alpha.
|
|
73
|
-
"@kubb/config-ts": "3.0.0-alpha.
|
|
74
|
-
"@kubb/config-tsup": "3.0.0-alpha.
|
|
72
|
+
"@kubb/config-biome": "3.0.0-alpha.12",
|
|
73
|
+
"@kubb/config-ts": "3.0.0-alpha.12",
|
|
74
|
+
"@kubb/config-tsup": "3.0.0-alpha.12"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@kubb/react": "3.0.0-alpha.
|
|
77
|
+
"@kubb/react": "3.0.0-alpha.12"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=20"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from "@kubb/plugin-client/client";
|
|
2
|
-
import type { UseBaseQueryOptions, UseQueryResult, QueryKey
|
|
2
|
+
import type { UseBaseQueryOptions, UseQueryResult, QueryKey } from "@tanstack/react-query";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
|
|
5
5
|
type UpdatePetWithFormClient = typeof client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>;
|
|
@@ -24,9 +24,9 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
24
24
|
|
|
25
25
|
export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>;
|
|
26
26
|
|
|
27
|
-
export function updatePetWithFormQueryOptions
|
|
27
|
+
export function updatePetWithFormQueryOptions({ petId }: {
|
|
28
28
|
petId: UpdatePetWithFormPathParams["petId"];
|
|
29
|
-
}, params?: UpdatePetWithForm["queryParams"], data?: UpdatePetWithForm["request"], options: UpdatePetWithForm["client"]["parameters"] = {})
|
|
29
|
+
}, params?: UpdatePetWithForm["queryParams"], data?: UpdatePetWithForm["request"], options: UpdatePetWithForm["client"]["parameters"] = {}) {
|
|
30
30
|
const queryKey = updatePetWithFormQueryKey({ petId }, params, data);
|
|
31
31
|
return {
|
|
32
32
|
queryKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from "@kubb/plugin-client/client";
|
|
2
|
-
import type { UseBaseQueryOptions, UseQueryResult, QueryKey
|
|
2
|
+
import type { UseBaseQueryOptions, UseQueryResult, QueryKey } from "@tanstack/react-query";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
|
|
5
5
|
type GetPetByIdClient = typeof client<GetPetByIdQueryResponse, GetPetById400 | GetPetById404, never>;
|
|
@@ -22,7 +22,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
22
22
|
|
|
23
23
|
export type GetPetByIdQueryKey = ReturnType<typeof getPetByIdQueryKey>;
|
|
24
24
|
|
|
25
|
-
export function getPetByIdQueryOptions
|
|
25
|
+
export function getPetByIdQueryOptions(petId: GetPetByIdPathParams["petId"], options: GetPetById["client"]["parameters"] = {}) {
|
|
26
26
|
const queryKey = getPetByIdQueryKey(petId);
|
|
27
27
|
return {
|
|
28
28
|
queryKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from "@kubb/plugin-client/client";
|
|
2
|
-
import type { UseBaseQueryOptions, UseQueryResult, QueryKey
|
|
2
|
+
import type { UseBaseQueryOptions, UseQueryResult, QueryKey } from "@tanstack/react-query";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
|
|
5
5
|
type GetPetByIdClient = typeof client<GetPetByIdQueryResponse, GetPetById400 | GetPetById404, never>;
|
|
@@ -24,9 +24,9 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
24
24
|
|
|
25
25
|
export type GetPetByIdQueryKey = ReturnType<typeof getPetByIdQueryKey>;
|
|
26
26
|
|
|
27
|
-
export function getPetByIdQueryOptions
|
|
27
|
+
export function getPetByIdQueryOptions({ petId }: {
|
|
28
28
|
petId: GetPetByIdPathParams["petId"];
|
|
29
|
-
}, options: GetPetById["client"]["parameters"] = {})
|
|
29
|
+
}, options: GetPetById["client"]["parameters"] = {}) {
|
|
30
30
|
const queryKey = getPetByIdQueryKey({ petId });
|
|
31
31
|
return {
|
|
32
32
|
queryKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from "@kubb/plugin-client/client";
|
|
2
|
-
import type {
|
|
2
|
+
import type { QueryKey } from "@tanstack/react-query";
|
|
3
3
|
|
|
4
4
|
type GetPetByIdClient = typeof client<GetPetByIdQueryResponse, GetPetById400 | GetPetById404, never>;
|
|
5
5
|
|
|
@@ -23,9 +23,9 @@ import type { UseBaseQueryOptions, QueryKey, WithRequired } from "@tanstack/reac
|
|
|
23
23
|
|
|
24
24
|
export type GetPetByIdQueryKey = ReturnType<typeof getPetByIdQueryKey>;
|
|
25
25
|
|
|
26
|
-
export function getPetByIdQueryOptions
|
|
26
|
+
export function getPetByIdQueryOptions({ petId }: {
|
|
27
27
|
petId: GetPetByIdPathParams["petId"];
|
|
28
|
-
}, options: GetPetById["client"]["parameters"] = {})
|
|
28
|
+
}, options: GetPetById["client"]["parameters"] = {}) {
|
|
29
29
|
const queryKey = getPetByIdQueryKey({ petId });
|
|
30
30
|
return {
|
|
31
31
|
queryKey,
|
|
@@ -2,8 +2,8 @@ import transformers from '@kubb/core/transformers'
|
|
|
2
2
|
import { FunctionParams, URLPath } from '@kubb/core/utils'
|
|
3
3
|
import { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
4
4
|
import { getASTParams, getComments } from '@kubb/plugin-oas/utils'
|
|
5
|
-
import { File, Function, useApp } from '@kubb/react'
|
|
6
5
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
6
|
+
import { File, Function, useApp } from '@kubb/react'
|
|
7
7
|
|
|
8
8
|
import { SchemaType } from './SchemaType.tsx'
|
|
9
9
|
|
|
@@ -118,32 +118,16 @@ function RootTemplate({ children }: RootTemplateProps) {
|
|
|
118
118
|
},
|
|
119
119
|
} = useApp<PluginReactQuery>()
|
|
120
120
|
|
|
121
|
-
const {
|
|
121
|
+
const { getFile } = useOperationManager()
|
|
122
122
|
const operation = useOperation()
|
|
123
|
-
|
|
124
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })
|
|
125
123
|
const file = getFile(operation)
|
|
126
|
-
const fileType = getFile(operation, { pluginKey: [pluginTsName] })
|
|
127
124
|
|
|
128
125
|
return (
|
|
129
126
|
<File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
|
|
130
127
|
<File.Import name={'client'} path={importPath} />
|
|
131
|
-
|
|
132
|
-
<File.Import
|
|
133
|
-
name={[
|
|
134
|
-
schemas.request?.name,
|
|
135
|
-
schemas.response.name,
|
|
136
|
-
schemas.pathParams?.name,
|
|
137
|
-
schemas.queryParams?.name,
|
|
138
|
-
schemas.headerParams?.name,
|
|
139
|
-
...(schemas.errors?.map((error) => error.name) || []),
|
|
140
|
-
].filter(Boolean)}
|
|
141
|
-
root={file.path}
|
|
142
|
-
path={fileType.path}
|
|
143
|
-
isTypeOnly
|
|
144
|
-
/>
|
|
128
|
+
|
|
145
129
|
<File.Import
|
|
146
|
-
name={['UseMutationOptions'
|
|
130
|
+
name={['UseMutationOptions']}
|
|
147
131
|
path={typeof mutate !== 'boolean' && mutate.importPath ? mutate.importPath : '@tanstack/react-query'}
|
|
148
132
|
isTypeOnly
|
|
149
133
|
/>
|
package/src/components/Query.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PackageManager } from '@kubb/core'
|
|
2
2
|
import transformers from '@kubb/core/transformers'
|
|
3
3
|
import { FunctionParams, URLPath } from '@kubb/core/utils'
|
|
4
|
-
import { File, Function, useApp } from '@kubb/react'
|
|
5
|
-
import { pluginTsName } from '@kubb/plugin-ts'
|
|
6
|
-
import { pluginZodName } from '@kubb/plugin-zod'
|
|
7
4
|
import { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
8
5
|
import { getASTParams, getComments } from '@kubb/plugin-oas/utils'
|
|
6
|
+
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
|
+
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
|
+
import { File, Function, useApp } from '@kubb/react'
|
|
9
9
|
|
|
10
10
|
import { getImportNames, reactQueryDepRegex } from '../utils.ts'
|
|
11
11
|
import { QueryImports } from './QueryImports.tsx'
|
|
@@ -550,7 +550,6 @@ Query.File = function ({ templates }: FileProps): ReactNode {
|
|
|
550
550
|
<File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
|
|
551
551
|
{parser === 'zod' && <File.Import name={[zodSchemas.response?.name]} root={file.path} path={fileZodSchemas.path} />}
|
|
552
552
|
<File.Import name={'client'} path={importPath} />
|
|
553
|
-
<File.Import name={['ResponseConfig']} path={importPath} isTypeOnly />
|
|
554
553
|
<File.Import
|
|
555
554
|
name={[
|
|
556
555
|
schemas.request?.name,
|
|
@@ -29,7 +29,7 @@ function Template({ path, hookPath = path, isInfinite, hookName, queryOptions, o
|
|
|
29
29
|
<File.Import name={[hookName]} path={hookPath} />
|
|
30
30
|
|
|
31
31
|
{queryOptions && <File.Import name={[queryOptions].filter(Boolean)} path={path} />}
|
|
32
|
-
<File.Import name={['QueryKey',
|
|
32
|
+
<File.Import name={['QueryKey', isInfinite ? 'InfiniteData' : undefined].filter(Boolean)} path={path} isTypeOnly />
|
|
33
33
|
</>
|
|
34
34
|
)
|
|
35
35
|
}
|
|
@@ -132,7 +132,7 @@ const defaultTemplates = {
|
|
|
132
132
|
)}
|
|
133
133
|
<File.Import name={['unref']} path={'vue'} />
|
|
134
134
|
<File.Import name={['MaybeRef']} path={'vue'} isTypeOnly />
|
|
135
|
-
<File.Import name={['QueryKey'
|
|
135
|
+
<File.Import name={['QueryKey']} path={path} isTypeOnly />
|
|
136
136
|
</>
|
|
137
137
|
)
|
|
138
138
|
}
|
|
@@ -3,14 +3,14 @@ import transformers from '@kubb/core/transformers'
|
|
|
3
3
|
import { FunctionParams, URLPath } from '@kubb/core/utils'
|
|
4
4
|
import { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
5
5
|
import { getASTParams } from '@kubb/plugin-oas/utils'
|
|
6
|
-
import { Function, useApp, File } from '@kubb/react'
|
|
7
6
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
7
|
+
import { File, Function, useApp } from '@kubb/react'
|
|
8
8
|
|
|
9
9
|
import { isRequired } from '@kubb/oas'
|
|
10
10
|
import type { HttpMethod } from '@kubb/oas'
|
|
11
|
+
import { pluginTsName } from '@kubb/plugin-ts'
|
|
11
12
|
import type { ReactNode } from 'react'
|
|
12
13
|
import type { Infinite, PluginReactQuery, Suspense } from '../types.ts'
|
|
13
|
-
import { pluginTsName } from '@kubb/plugin-ts'
|
|
14
14
|
import { reactQueryDepRegex } from '../utils.ts'
|
|
15
15
|
|
|
16
16
|
type TemplateProps = {
|
|
@@ -22,14 +22,6 @@ type TemplateProps = {
|
|
|
22
22
|
* Parameters/options/props that need to be used
|
|
23
23
|
*/
|
|
24
24
|
params: string
|
|
25
|
-
/**
|
|
26
|
-
* Generics that needs to be added for TypeScript
|
|
27
|
-
*/
|
|
28
|
-
generics?: string
|
|
29
|
-
/**
|
|
30
|
-
* ReturnType(see async for adding Promise type)
|
|
31
|
-
*/
|
|
32
|
-
returnType?: string
|
|
33
25
|
/**
|
|
34
26
|
* Options for JSdocs
|
|
35
27
|
*/
|
|
@@ -55,7 +47,7 @@ type TemplateProps = {
|
|
|
55
47
|
parser: string | undefined
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
function Template({ name, params,
|
|
50
|
+
function Template({ name, params, JSDoc, hook, client, infinite, dataReturnType, parser }: TemplateProps): ReactNode {
|
|
59
51
|
const isV5 = new PackageManager().isValidSync(reactQueryDepRegex, '>=5')
|
|
60
52
|
const isFormData = client.contentType === 'multipart/form-data'
|
|
61
53
|
const headers = [
|
|
@@ -150,7 +142,7 @@ function Template({ name, params, generics, returnType, JSDoc, hook, client, inf
|
|
|
150
142
|
|
|
151
143
|
return (
|
|
152
144
|
<File.Source name={name} isExportable isIndexable>
|
|
153
|
-
<Function name={name} export
|
|
145
|
+
<Function name={name} export params={params} JSDoc={JSDoc}>
|
|
154
146
|
{`
|
|
155
147
|
const queryKey = ${hook.queryKey}
|
|
156
148
|
|
|
@@ -203,7 +195,7 @@ function Template({ name, params, generics, returnType, JSDoc, hook, client, inf
|
|
|
203
195
|
|
|
204
196
|
return (
|
|
205
197
|
<File.Source name={name} isExportable isIndexable>
|
|
206
|
-
<Function name={name} export
|
|
198
|
+
<Function name={name} export params={params} JSDoc={JSDoc}>
|
|
207
199
|
{`
|
|
208
200
|
const queryKey = ${hook.queryKey}
|
|
209
201
|
|
|
@@ -477,8 +469,6 @@ export function QueryOptions({ factory, infinite, suspense, resultType, dataRetu
|
|
|
477
469
|
<Template
|
|
478
470
|
name={queryOptionsName}
|
|
479
471
|
params={params.toString()}
|
|
480
|
-
generics={generics.toString()}
|
|
481
|
-
returnType={`WithRequired<${resultType}<${resultGenerics.join(', ')}>, 'queryKey'>`}
|
|
482
472
|
client={client}
|
|
483
473
|
hook={hook}
|
|
484
474
|
infinite={infinite}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
2
2
|
import { File, Type, useApp } from '@kubb/react'
|
|
3
3
|
|
|
4
|
+
import { pluginTsName } from '@kubb/plugin-ts'
|
|
4
5
|
import type { ReactNode } from 'react'
|
|
5
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
6
|
-
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
|
|
8
8
|
export function SchemaType(): ReactNode {
|
|
9
9
|
const {
|
|
@@ -11,9 +11,11 @@ export function SchemaType(): ReactNode {
|
|
|
11
11
|
options: { dataReturnType },
|
|
12
12
|
},
|
|
13
13
|
} = useApp<PluginReactQuery>()
|
|
14
|
-
const { getSchemas, getName } = useOperationManager()
|
|
14
|
+
const { getSchemas, getName, getFile } = useOperationManager()
|
|
15
15
|
const operation = useOperation()
|
|
16
16
|
|
|
17
|
+
const file = getFile(operation)
|
|
18
|
+
const fileType = getFile(operation, { pluginKey: [pluginTsName] })
|
|
17
19
|
const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })
|
|
18
20
|
|
|
19
21
|
const [TData, TError, TRequest, TPathParams, TQueryParams, THeaderParams, TResponse] = [
|
|
@@ -32,6 +34,19 @@ export function SchemaType(): ReactNode {
|
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<>
|
|
37
|
+
<File.Import
|
|
38
|
+
name={[
|
|
39
|
+
schemas.request?.name,
|
|
40
|
+
schemas.response.name,
|
|
41
|
+
schemas.pathParams?.name,
|
|
42
|
+
schemas.queryParams?.name,
|
|
43
|
+
schemas.headerParams?.name,
|
|
44
|
+
...(schemas.errors?.map((error) => error.name) || []),
|
|
45
|
+
].filter(Boolean)}
|
|
46
|
+
root={file.path}
|
|
47
|
+
path={fileType.path}
|
|
48
|
+
isTypeOnly
|
|
49
|
+
/>
|
|
35
50
|
<File.Source name={clientType} isTypeOnly>
|
|
36
51
|
<Type name={clientType}>{`typeof client<${TResponse}, ${TError}, ${isFormData ? 'FormData' : TRequest}>`}</Type>
|
|
37
52
|
</File.Source>
|
|
@@ -19,7 +19,7 @@ export const GetPetsUuidQueryKey = () => [{ url: '/pets/:uuid', params: {uuid:
|
|
|
19
19
|
|
|
20
20
|
export type GetPetsUuidQueryKey = ReturnType<typeof GetPetsUuidQueryKey>
|
|
21
21
|
|
|
22
|
-
export function GetPetsUuidQueryOptions
|
|
22
|
+
export function GetPetsUuidQueryOptions(options: GetPetsUuid['client']['parameters'] = {}) {
|
|
23
23
|
|
|
24
24
|
const queryKey = GetPetsUuidQueryKey()
|
|
25
25
|
|