@kubb/plugin-vue-query 5.0.0-alpha.31 → 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-Dh9ETgiK.cjs → components-DberPyb4.cjs} +36 -35
- package/dist/components-DberPyb4.cjs.map +1 -0
- package/dist/{components-BqilTESI.js → components-Dtcq349-.js} +4 -3
- package/dist/components-Dtcq349-.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +9 -9
- package/dist/components.js +1 -1
- package/dist/{generators-TcueY7eX.cjs → generators-CAq2xhSX.cjs} +72 -72
- package/dist/{generators-TcueY7eX.cjs.map → generators-CAq2xhSX.cjs.map} +1 -1
- package/dist/{generators-C_oXqIAr.js → generators-X60LXmf_.js} +4 -4
- package/dist/{generators-C_oXqIAr.js.map → generators-X60LXmf_.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 +15 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -19
- package/dist/index.js.map +1 -1
- package/dist/{types-Cx-x7vSU.d.ts → types-Djdj3Js0.d.ts} +4 -5
- package/package.json +10 -11
- package/src/components/InfiniteQuery.tsx +4 -3
- package/src/components/InfiniteQueryOptions.tsx +4 -3
- package/src/components/Mutation.tsx +5 -3
- package/src/components/Query.tsx +4 -3
- package/src/components/QueryKey.tsx +4 -3
- package/src/components/QueryOptions.tsx +4 -12
- package/src/generators/infiniteQueryGenerator.tsx +1 -1
- package/src/generators/mutationGenerator.tsx +1 -1
- package/src/generators/queryGenerator.tsx +1 -1
- package/src/plugin.ts +31 -30
- package/dist/components-BqilTESI.js.map +0 -1
- package/dist/components-Dh9ETgiK.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
|
-
import { c as camelCase, l as pascalCase, r as MutationKey, s as QueryKey } from "./components-
|
|
3
|
-
import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-
|
|
2
|
+
import { c as camelCase, l as pascalCase, r as MutationKey, s as QueryKey } from "./components-Dtcq349-.js";
|
|
3
|
+
import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-X60LXmf_.js";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { createFile, createSource, createText } from "@kubb/ast";
|
|
5
6
|
import { createPlugin, getBarrelFiles } from "@kubb/core";
|
|
6
7
|
import { pluginClientName } from "@kubb/plugin-client";
|
|
7
8
|
import { source } from "@kubb/plugin-client/templates/clients/axios.source";
|
|
@@ -11,7 +12,7 @@ import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
|
|
|
11
12
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
12
13
|
import { pluginZodName } from "@kubb/plugin-zod";
|
|
13
14
|
//#region package.json
|
|
14
|
-
var version = "5.0.0-alpha.
|
|
15
|
+
var version = "5.0.0-alpha.33";
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region src/plugin.ts
|
|
17
18
|
const pluginVueQueryName = "plugin-vue-query";
|
|
@@ -111,32 +112,27 @@ const pluginVueQuery = createPlugin((options) => {
|
|
|
111
112
|
const baseURL = await this.getBaseURL();
|
|
112
113
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
113
114
|
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
114
|
-
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
115
|
+
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile(createFile({
|
|
115
116
|
baseName: "fetch.ts",
|
|
116
117
|
path: path.resolve(root, ".kubb/fetch.ts"),
|
|
117
|
-
sources: [{
|
|
118
|
+
sources: [createSource({
|
|
118
119
|
name: "fetch",
|
|
119
|
-
|
|
120
|
+
nodes: [createText(this.plugin.options.client.client === "fetch" ? source$1 : source)],
|
|
120
121
|
isExportable: true,
|
|
121
122
|
isIndexable: true
|
|
122
|
-
}]
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
if (!hasClientPlugin) await this.addFile({
|
|
123
|
+
})]
|
|
124
|
+
}));
|
|
125
|
+
if (!hasClientPlugin) await this.addFile(createFile({
|
|
127
126
|
baseName: "config.ts",
|
|
128
127
|
path: path.resolve(root, ".kubb/config.ts"),
|
|
129
|
-
sources: [{
|
|
128
|
+
sources: [createSource({
|
|
130
129
|
name: "config",
|
|
131
|
-
|
|
130
|
+
nodes: [createText(source$2)],
|
|
132
131
|
isExportable: false,
|
|
133
132
|
isIndexable: false
|
|
134
|
-
}]
|
|
135
|
-
|
|
136
|
-
exports: []
|
|
137
|
-
});
|
|
133
|
+
})]
|
|
134
|
+
}));
|
|
138
135
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
139
|
-
fabric: this.fabric,
|
|
140
136
|
oas,
|
|
141
137
|
driver: this.driver,
|
|
142
138
|
events: this.events,
|
|
@@ -148,7 +144,7 @@ const pluginVueQuery = createPlugin((options) => {
|
|
|
148
144
|
mode
|
|
149
145
|
}).build(...generators);
|
|
150
146
|
await this.upsertFile(...files);
|
|
151
|
-
const barrelFiles = await getBarrelFiles(this.
|
|
147
|
+
const barrelFiles = await getBarrelFiles(this.driver.fileManager.files, {
|
|
152
148
|
type: output.barrelType ?? "named",
|
|
153
149
|
root,
|
|
154
150
|
output,
|
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 { 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, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\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: pluginVueQueryName,\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 queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\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\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\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.fabric.files, {\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":";;;;;;;;;;;;;;;;ACeA,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,cAA8B,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,aAAa;EAAC;EAAgB;EAAwB;EAAkB,CAAC,OAAO,QAAQ,EACxF,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,SAAS,QAAQ;IACjB,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,gBAAgB,QAAQ,kBAAkB;IAC1C;IACA,YAAY;IACZ;IACD;GACD,UAAU,WACN;IACE,YAAY;IACZ,kBAAkB;IAClB,aAAa,KAAA;IACb,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","../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, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\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: pluginVueQueryName,\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 queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\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\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.addFile(\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":";;;;;;;;;;;;;;;;;ACiBA,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,cAA8B,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,aAAa;EAAC;EAAgB;EAAwB;EAAkB,CAAC,OAAO,QAAQ,EACxF,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;AAEhH,Q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M,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,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):
|
|
41
|
+
}: Props): KubbReactNode;
|
|
43
42
|
declare namespace MutationKey$1 {
|
|
44
43
|
var getParams: ({}: GetParamsProps) => FunctionParams;
|
|
45
44
|
var getTransformer: Transformer;
|
|
@@ -218,4 +217,4 @@ declare global {
|
|
|
218
217
|
}
|
|
219
218
|
//#endregion
|
|
220
219
|
export { Transformer as a, MutationKey$1 as i, Options as n, PluginVueQuery as r, Infinite as t };
|
|
221
|
-
//# sourceMappingURL=types-
|
|
220
|
+
//# sourceMappingURL=types-Djdj3Js0.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-vue-query",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.33",
|
|
4
4
|
"description": "Vue Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Vue.js applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue-query",
|
|
@@ -73,19 +73,18 @@
|
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@kubb/fabric-core": "0.15.1",
|
|
77
|
-
"@kubb/react-fabric": "0.15.1",
|
|
78
76
|
"remeda": "^2.33.7",
|
|
79
|
-
"@kubb/
|
|
80
|
-
"@kubb/
|
|
81
|
-
"@kubb/
|
|
82
|
-
"@kubb/plugin-
|
|
83
|
-
"@kubb/plugin-
|
|
84
|
-
"@kubb/plugin-
|
|
77
|
+
"@kubb/ast": "5.0.0-alpha.33",
|
|
78
|
+
"@kubb/core": "5.0.0-alpha.33",
|
|
79
|
+
"@kubb/oas": "5.0.0-alpha.33",
|
|
80
|
+
"@kubb/plugin-client": "5.0.0-alpha.33",
|
|
81
|
+
"@kubb/plugin-oas": "5.0.0-alpha.33",
|
|
82
|
+
"@kubb/plugin-ts": "5.0.0-alpha.33",
|
|
83
|
+
"@kubb/plugin-zod": "5.0.0-alpha.33",
|
|
84
|
+
"@kubb/renderer-jsx": "5.0.0-alpha.33"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@kubb/
|
|
88
|
-
"@kubb/react-fabric": "0.15.1"
|
|
87
|
+
"@kubb/renderer-jsx": "5.0.0-alpha.33"
|
|
89
88
|
},
|
|
90
89
|
"engines": {
|
|
91
90
|
"node": ">=22"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { getDefaultValue, 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 { PluginVueQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
9
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -147,7 +148,7 @@ export function InfiniteQuery({
|
|
|
147
148
|
dataReturnType,
|
|
148
149
|
typeSchemas,
|
|
149
150
|
operation,
|
|
150
|
-
}: Props):
|
|
151
|
+
}: Props): KubbReactNode {
|
|
151
152
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
152
153
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
153
154
|
const returnType = `UseInfiniteQueryReturnType<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getNestedAccessor } from '@internals/utils'
|
|
2
|
+
import { FunctionParams } from '@kubb/core'
|
|
2
3
|
import { getDefaultValue, 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, PluginVueQuery } from '../types.ts'
|
|
9
10
|
import { QueryKey } from './QueryKey.tsx'
|
|
10
11
|
|
|
@@ -138,7 +139,7 @@ export function InfiniteQueryOptions({
|
|
|
138
139
|
pathParamsType,
|
|
139
140
|
queryParam,
|
|
140
141
|
queryKeyName,
|
|
141
|
-
}: Props):
|
|
142
|
+
}: Props): KubbReactNode {
|
|
142
143
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
143
144
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
144
145
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { Params } from '@kubb/core'
|
|
2
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
3
|
import { isOptional, type Operation } 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 { getComments, 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 { PluginVueQuery } from '../types.ts'
|
|
8
10
|
import { MutationKey } from './MutationKey.tsx'
|
|
9
11
|
|
|
@@ -89,7 +91,7 @@ export function Mutation({
|
|
|
89
91
|
typeSchemas,
|
|
90
92
|
operation,
|
|
91
93
|
mutationKeyName,
|
|
92
|
-
}: Props):
|
|
94
|
+
}: Props): KubbReactNode {
|
|
93
95
|
const mutationKeyParams = MutationKey.getParams({
|
|
94
96
|
pathParamsType,
|
|
95
97
|
typeSchemas,
|
package/src/components/Query.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { getDefaultValue, 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 { PluginVueQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
9
|
import { QueryOptions } from './QueryOptions.tsx'
|
|
@@ -147,7 +148,7 @@ export function Query({
|
|
|
147
148
|
dataReturnType,
|
|
148
149
|
typeSchemas,
|
|
149
150
|
operation,
|
|
150
|
-
}: Props):
|
|
151
|
+
}: Props): KubbReactNode {
|
|
151
152
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
152
153
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
153
154
|
const returnType = `UseQueryReturnType<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { URLPath } from '@internals/utils'
|
|
2
|
+
import { FunctionParams } from '@kubb/core'
|
|
2
3
|
import { isOptional, type Operation } from '@kubb/oas'
|
|
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, Type } from '@kubb/renderer-jsx'
|
|
7
|
+
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
7
8
|
import type { PluginVueQuery, Transformer } from '../types'
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
@@ -66,7 +67,7 @@ const getTransformer: Transformer = ({ operation, schemas, casing }) => {
|
|
|
66
67
|
return keys
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
export function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props):
|
|
70
|
+
export function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): KubbReactNode {
|
|
70
71
|
const params = getParams({ pathParamsType, typeSchemas, paramsCasing })
|
|
71
72
|
const keys = transformer({
|
|
72
73
|
operation,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { FunctionParams } from '@kubb/core'
|
|
1
2
|
import { getDefaultValue, 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 { PluginVueQuery } from '../types.ts'
|
|
8
9
|
import { QueryKey } from './QueryKey.tsx'
|
|
9
10
|
|
|
@@ -118,16 +119,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: Ge
|
|
|
118
119
|
})
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
export function QueryOptions({
|
|
122
|
-
name,
|
|
123
|
-
clientName,
|
|
124
|
-
dataReturnType,
|
|
125
|
-
typeSchemas,
|
|
126
|
-
paramsCasing,
|
|
127
|
-
paramsType,
|
|
128
|
-
pathParamsType,
|
|
129
|
-
queryKeyName,
|
|
130
|
-
}: Props): FabricReactNode {
|
|
122
|
+
export function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): KubbReactNode {
|
|
131
123
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
132
124
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
133
125
|
|
|
@@ -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 { PluginVueQuery } 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 type { PluginVueQuery } 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 { Query, QueryKey, QueryOptions } from '../components'
|
|
12
12
|
import type { PluginVueQuery } from '../types'
|
package/src/plugin.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { camelCase, pascalCase } from '@internals/utils'
|
|
3
|
+
import { createFile, createSource, createText } from '@kubb/ast'
|
|
4
|
+
import type { FileNode } from '@kubb/ast/types'
|
|
3
5
|
import { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'
|
|
4
6
|
import { pluginClientName } from '@kubb/plugin-client'
|
|
5
7
|
import { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'
|
|
@@ -159,41 +161,40 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
|
|
|
159
161
|
|
|
160
162
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {
|
|
161
163
|
// pre add bundled
|
|
162
|
-
await this.upsertFile(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
await this.upsertFile(
|
|
165
|
+
createFile({
|
|
166
|
+
baseName: 'fetch.ts',
|
|
167
|
+
path: path.resolve(root, '.kubb/fetch.ts'),
|
|
168
|
+
sources: [
|
|
169
|
+
createSource({
|
|
170
|
+
name: 'fetch',
|
|
171
|
+
nodes: [createText(this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource)],
|
|
172
|
+
isExportable: true,
|
|
173
|
+
isIndexable: true,
|
|
174
|
+
}),
|
|
175
|
+
],
|
|
176
|
+
}),
|
|
177
|
+
)
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
if (!hasClientPlugin) {
|
|
179
|
-
await this.addFile(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
181
|
+
await this.addFile(
|
|
182
|
+
createFile({
|
|
183
|
+
baseName: 'config.ts',
|
|
184
|
+
path: path.resolve(root, '.kubb/config.ts'),
|
|
185
|
+
sources: [
|
|
186
|
+
createSource({
|
|
187
|
+
name: 'config',
|
|
188
|
+
nodes: [createText(configSource)],
|
|
189
|
+
isExportable: false,
|
|
190
|
+
isIndexable: false,
|
|
191
|
+
}),
|
|
192
|
+
],
|
|
193
|
+
}),
|
|
194
|
+
)
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
196
|
-
fabric: this.fabric,
|
|
197
198
|
oas,
|
|
198
199
|
driver: this.driver,
|
|
199
200
|
events: this.events,
|
|
@@ -208,7 +209,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
|
|
|
208
209
|
const files = await operationGenerator.build(...generators)
|
|
209
210
|
await this.upsertFile(...files)
|
|
210
211
|
|
|
211
|
-
const barrelFiles = await getBarrelFiles(this.
|
|
212
|
+
const barrelFiles = await getBarrelFiles(this.driver.fileManager.files as unknown as FileNode[], {
|
|
212
213
|
type: output.barrelType ?? 'named',
|
|
213
214
|
root,
|
|
214
215
|
output,
|