@kubb/plugin-svelte-query 4.25.1 → 4.26.0
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.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.cjs +2 -1
- 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 +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-BwpjJVpo.d.cts → types-BuXWSgLS.d.cts} +4 -4
- package/dist/{types-CWKtlWfU.d.ts → types-CP2uxaYH.d.ts} +4 -4
- package/package.json +7 -7
- package/src/plugin.ts +2 -1
- package/src/types.ts +3 -3
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as __name, n as PluginSvelteQuery, r as Transformer } from "./types-
|
|
1
|
+
import { i as __name, n as PluginSvelteQuery, r as Transformer } from "./types-BuXWSgLS.cjs";
|
|
2
2
|
import { Operation } from "@kubb/oas";
|
|
3
3
|
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
4
4
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as PluginSvelteQuery, r as Transformer } from "./types-
|
|
2
|
+
import { n as PluginSvelteQuery, r as Transformer } from "./types-CP2uxaYH.js";
|
|
3
3
|
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
4
4
|
import { Operation } from "@kubb/oas";
|
|
5
5
|
import { FunctionParams } from "@kubb/react-fabric";
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as __name, n as PluginSvelteQuery } from "./types-
|
|
1
|
+
import { i as __name, n as PluginSvelteQuery } from "./types-BuXWSgLS.cjs";
|
|
2
2
|
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
3
3
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
4
4
|
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as PluginSvelteQuery } from "./types-
|
|
2
|
+
import { n as PluginSvelteQuery } from "./types-CP2uxaYH.js";
|
|
3
3
|
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
4
4
|
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
5
5
|
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,8 @@ const pluginSvelteQuery = (0, _kubb_core.definePlugin)((options) => {
|
|
|
24
24
|
options: {
|
|
25
25
|
output,
|
|
26
26
|
client: {
|
|
27
|
-
|
|
27
|
+
bundle: client?.bundle,
|
|
28
|
+
baseURL: client?.baseURL,
|
|
28
29
|
client: clientName,
|
|
29
30
|
clientType: client?.clientType ?? "function",
|
|
30
31
|
dataReturnType: client?.dataReturnType ?? "data",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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, 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: pluginSvelteQueryName,\n options: {\n output,\n client: {\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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, 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: pluginSvelteQueryName,\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 queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/svelte-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/svelte-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\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.pluginManager.getPluginByKey([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 baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\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 pluginManager: this.pluginManager,\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 pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,wBAAwB;AAErC,MAAa,kDAAqD,YAAY;CAC5E,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAcA,+BAAY,gBAC1B,WAAWC,4BAAS,gBACpB,aAAa,CAACC,mCAAgBC,qCAAkB,CAAC,OAAO,QAAQ,EAChE,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,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;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;IACZ,GAAG;IACJ;GACP;GACA,UACE,aAAa,QACT,QACA;IACE,SAAS;KAAC;KAAQ;KAAO;KAAS;KAAS;IAC3C,YAAY;IACZ,GAAG;IACJ;GACP;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GAACC;GAAeC;GAAc,WAAW,QAAQC,iCAAgB;GAAU,CAAC,OAAO,QAAQ;EAChG,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,oCAAoBA,kBAAK,Q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Q,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,iDACE,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAU,gDAAgD,8CACjG,CAAC;KACF,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,OAAI,CAAC,gBACH,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,iDAA2B,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAIG,oCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,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,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as PluginSvelteQuery, t as Options } from "./types-
|
|
2
|
+
import { n as PluginSvelteQuery, t as Options } from "./types-CP2uxaYH.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,8 @@ const pluginSvelteQuery = definePlugin((options) => {
|
|
|
24
24
|
options: {
|
|
25
25
|
output,
|
|
26
26
|
client: {
|
|
27
|
-
|
|
27
|
+
bundle: client?.bundle,
|
|
28
|
+
baseURL: client?.baseURL,
|
|
28
29
|
client: clientName,
|
|
29
30
|
clientType: client?.clientType ?? "function",
|
|
30
31
|
dataReturnType: client?.dataReturnType ?? "data",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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, 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: pluginSvelteQueryName,\n options: {\n output,\n client: {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["options"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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, 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: pluginSvelteQueryName,\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 queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/svelte-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/svelte-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\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.pluginManager.getPluginByKey([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 baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\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 pluginManager: this.pluginManager,\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 pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,wBAAwB;AAErC,MAAa,oBAAoB,cAAiC,YAAY;CAC5E,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,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,CAAC,gBAAgB,kBAAkB,CAAC,OAAO,QAAQ,EAChE,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,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;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;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|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HttpMethod, Oas, Operation, contentType } from "@kubb/oas";
|
|
2
2
|
import { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
3
3
|
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
4
|
-
import { PluginClient } from "@kubb/plugin-client";
|
|
4
|
+
import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
|
|
5
5
|
import { Generator } from "@kubb/plugin-oas/generators";
|
|
6
6
|
|
|
7
7
|
//#region rolldown:runtime
|
|
@@ -66,7 +66,7 @@ type Options = {
|
|
|
66
66
|
* Group the @tanstack/query hooks based on the provided name.
|
|
67
67
|
*/
|
|
68
68
|
group?: Group;
|
|
69
|
-
client?: Pick<PluginClient['options'], '
|
|
69
|
+
client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
70
70
|
/**
|
|
71
71
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
72
72
|
*/
|
|
@@ -127,7 +127,7 @@ type Options = {
|
|
|
127
127
|
type ResolvedOptions = {
|
|
128
128
|
output: Output<Oas>;
|
|
129
129
|
group: Options['group'];
|
|
130
|
-
client:
|
|
130
|
+
client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
131
131
|
parser: Required<NonNullable<Options['parser']>>;
|
|
132
132
|
paramsCasing: Options['paramsCasing'];
|
|
133
133
|
paramsType: NonNullable<Options['paramsType']>;
|
|
@@ -140,4 +140,4 @@ type ResolvedOptions = {
|
|
|
140
140
|
type PluginSvelteQuery = PluginFactoryOptions<'plugin-svelte-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
141
141
|
//#endregion
|
|
142
142
|
export { __name as i, PluginSvelteQuery as n, Transformer as r, Options as t };
|
|
143
|
-
//# sourceMappingURL=types-
|
|
143
|
+
//# sourceMappingURL=types-BuXWSgLS.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
2
|
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
3
|
-
import { PluginClient } from "@kubb/plugin-client";
|
|
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
6
|
import { Generator } from "@kubb/plugin-oas/generators";
|
|
@@ -65,7 +65,7 @@ type Options = {
|
|
|
65
65
|
* Group the @tanstack/query hooks based on the provided name.
|
|
66
66
|
*/
|
|
67
67
|
group?: Group;
|
|
68
|
-
client?: Pick<PluginClient['options'], '
|
|
68
|
+
client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
69
69
|
/**
|
|
70
70
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
71
71
|
*/
|
|
@@ -126,7 +126,7 @@ type Options = {
|
|
|
126
126
|
type ResolvedOptions = {
|
|
127
127
|
output: Output<Oas>;
|
|
128
128
|
group: Options['group'];
|
|
129
|
-
client:
|
|
129
|
+
client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
130
130
|
parser: Required<NonNullable<Options['parser']>>;
|
|
131
131
|
paramsCasing: Options['paramsCasing'];
|
|
132
132
|
paramsType: NonNullable<Options['paramsType']>;
|
|
@@ -139,4 +139,4 @@ type ResolvedOptions = {
|
|
|
139
139
|
type PluginSvelteQuery = PluginFactoryOptions<'plugin-svelte-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
140
140
|
//#endregion
|
|
141
141
|
export { PluginSvelteQuery as n, Transformer as r, Options as t };
|
|
142
|
-
//# sourceMappingURL=types-
|
|
142
|
+
//# sourceMappingURL=types-CP2uxaYH.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-svelte-query",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.0",
|
|
4
4
|
"description": "Svelte Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Svelte applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte-query",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@kubb/react-fabric": "0.12.11",
|
|
77
77
|
"remeda": "^2.33.6",
|
|
78
|
-
"@kubb/core": "4.
|
|
79
|
-
"@kubb/oas": "4.
|
|
80
|
-
"@kubb/plugin-client": "4.
|
|
81
|
-
"@kubb/plugin-oas": "4.
|
|
82
|
-
"@kubb/plugin-ts": "4.
|
|
83
|
-
"@kubb/plugin-zod": "4.
|
|
78
|
+
"@kubb/core": "4.26.0",
|
|
79
|
+
"@kubb/oas": "4.26.0",
|
|
80
|
+
"@kubb/plugin-client": "4.26.0",
|
|
81
|
+
"@kubb/plugin-oas": "4.26.0",
|
|
82
|
+
"@kubb/plugin-ts": "4.26.0",
|
|
83
|
+
"@kubb/plugin-zod": "4.26.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@kubb/react-fabric": "0.12.11"
|
package/src/plugin.ts
CHANGED
|
@@ -41,7 +41,8 @@ export const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {
|
|
|
41
41
|
options: {
|
|
42
42
|
output,
|
|
43
43
|
client: {
|
|
44
|
-
|
|
44
|
+
bundle: client?.bundle,
|
|
45
|
+
baseURL: client?.baseURL,
|
|
45
46
|
client: clientName,
|
|
46
47
|
clientType: client?.clientType ?? 'function',
|
|
47
48
|
dataReturnType: client?.dataReturnType ?? 'data',
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
2
2
|
|
|
3
3
|
import type { contentType, HttpMethod, Oas, Operation } from '@kubb/oas'
|
|
4
|
-
import type { PluginClient } from '@kubb/plugin-client'
|
|
4
|
+
import type { ClientImportPath, PluginClient } from '@kubb/plugin-client'
|
|
5
5
|
import type { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from '@kubb/plugin-oas'
|
|
6
6
|
import type { Generator } from '@kubb/plugin-oas/generators'
|
|
7
7
|
|
|
@@ -70,7 +70,7 @@ export type Options = {
|
|
|
70
70
|
* Group the @tanstack/query hooks based on the provided name.
|
|
71
71
|
*/
|
|
72
72
|
group?: Group
|
|
73
|
-
client?: Pick<PluginClient['options'], '
|
|
73
|
+
client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>
|
|
74
74
|
/**
|
|
75
75
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
76
76
|
*/
|
|
@@ -132,7 +132,7 @@ export type Options = {
|
|
|
132
132
|
type ResolvedOptions = {
|
|
133
133
|
output: Output<Oas>
|
|
134
134
|
group: Options['group']
|
|
135
|
-
client:
|
|
135
|
+
client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>
|
|
136
136
|
parser: Required<NonNullable<Options['parser']>>
|
|
137
137
|
paramsCasing: Options['paramsCasing']
|
|
138
138
|
paramsType: NonNullable<Options['paramsType']>
|