@kubb/plugin-solid-query 3.2.0 → 3.3.1

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.
@@ -2,7 +2,7 @@ import { FunctionParams } from '@kubb/react';
2
2
  import { Operation } from '@kubb/oas';
3
3
  import { OperationSchemas } from '@kubb/plugin-oas';
4
4
  import { ReactNode } from 'react';
5
- import { P as PluginSolidQuery, T as Transformer } from './types-EeNWbWqm.cjs';
5
+ import { P as PluginSolidQuery, T as Transformer } from './types-CkeKuWIN.cjs';
6
6
  import '@kubb/core';
7
7
 
8
8
  type Props$2 = {
@@ -2,7 +2,7 @@ import { FunctionParams } from '@kubb/react';
2
2
  import { Operation } from '@kubb/oas';
3
3
  import { OperationSchemas } from '@kubb/plugin-oas';
4
4
  import { ReactNode } from 'react';
5
- import { P as PluginSolidQuery, T as Transformer } from './types-EeNWbWqm.js';
5
+ import { P as PluginSolidQuery, T as Transformer } from './types-CkeKuWIN.js';
6
6
  import '@kubb/core';
7
7
 
8
8
  type Props$2 = {
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginSolidQuery } from './types-EeNWbWqm.cjs';
2
+ import { P as PluginSolidQuery } from './types-CkeKuWIN.cjs';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginSolidQuery } from './types-EeNWbWqm.js';
2
+ import { P as PluginSolidQuery } from './types-CkeKuWIN.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
package/dist/index.cjs CHANGED
@@ -35,7 +35,7 @@ var pluginSolidQuery = core.createPlugin((options) => {
35
35
  options: {
36
36
  output,
37
37
  client: {
38
- importPath: "@kubb/plugin-client/client",
38
+ importPath: "@kubb/plugin-client/clients/axios",
39
39
  dataReturnType: "data",
40
40
  pathParamsType: "inline",
41
41
  ...options.client
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","QueryKey","queryGenerator","pluginOasName","pluginTsName","pluginZodName","options","path","FileManager","camelCase","pascalCase","PluginManager","OperationGenerator"],"mappings":";;;;;;;;;;;;;;;AAeO,IAAM,oBAAuB,GAAA;AAEvB,IAAA,gBAAA,GAAmBA,iBAA+B,CAAA,CAAC,OAAY,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,kBACTC,iBAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAWC,0BAAS,CAAA,cAAA;AAAA,IACpB,UAAa,GAAA,CAACC,gCAAc,CAAA,CAAE,OAAO,OAAO,CAAA;AAAA,IAC5C,QAAQ,EAAC;AAAA,IACT;AAAA,GACE,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,oBAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,UAAY,EAAA,4BAAA;AAAA,QACZ,cAAgB,EAAA,MAAA;AAAA,QAChB,cAAgB,EAAA,QAAA;AAAA,QAChB,GAAG,OAAQ,CAAA;AAAA,OACb;AAAA,MACA,QAAA;AAAA,MACA,KAAA,EACE,KAAU,KAAA,KAAA,GACN,KACA,GAAA;AAAA,QACE,OAAA,EAAS,CAAC,KAAK,CAAA;AAAA,QACf,UAAY,EAAA,uBAAA;AAAA,QACZ,GAAG;AAAA,OACL;AAAA,MACN,UAAA;AAAA,MACA,cAAA,EAAgB,UAAe,KAAA,QAAA,GAAW,QAAW,GAAA,cAAA;AAAA,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,MAAA,MAAM,kBAAqB,GAAA,IAAIK,4BAAmB,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;AAAA,OACD,CAAA;AAED,MAAA,MAAM,KAAQ,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAC1D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA;AAE3B,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryKey } from './components'\nimport { queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((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 = 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator].filter(Boolean),\n query = {},\n paramsCasing,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\n group,\n paramsCasing,\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?.group && group) {\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(root, output.path, groupName({ group: options.group }), 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 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 const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\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(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\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"]}
1
+ {"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","QueryKey","queryGenerator","pluginOasName","pluginTsName","pluginZodName","options","path","FileManager","camelCase","pascalCase","PluginManager","OperationGenerator"],"mappings":";;;;;;;;;;;;;;;AAeO,IAAM,oBAAuB,GAAA;AAEvB,IAAA,gBAAA,GAAmBA,iBAA+B,CAAA,CAAC,OAAY,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,kBACTC,iBAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAWC,0BAAS,CAAA,cAAA;AAAA,IACpB,UAAa,GAAA,CAACC,gCAAc,CAAA,CAAE,OAAO,OAAO,CAAA;AAAA,IAC5C,QAAQ,EAAC;AAAA,IACT;AAAA,GACE,G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AAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryKey } from './components'\nimport { queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((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 = 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator].filter(Boolean),\n query = {},\n paramsCasing,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\n group,\n paramsCasing,\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?.group && group) {\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(root, output.path, groupName({ group: options.group }), 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 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 const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\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(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\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"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginSolidQuery } from './types-EeNWbWqm.cjs';
2
+ import { O as Options, P as PluginSolidQuery } from './types-CkeKuWIN.cjs';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginSolidQuery } from './types-EeNWbWqm.js';
2
+ import { O as Options, P as PluginSolidQuery } from './types-CkeKuWIN.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var pluginSolidQuery = createPlugin((options) => {
29
29
  options: {
30
30
  output,
31
31
  client: {
32
- importPath: "@kubb/plugin-client/client",
32
+ importPath: "@kubb/plugin-client/clients/axios",
33
33
  dataReturnType: "data",
34
34
  pathParamsType: "inline",
35
35
  ...options.client
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;;AAeO,IAAM,oBAAuB,GAAA;AAEvB,IAAA,gBAAA,GAAmB,YAA+B,CAAA,CAAC,OAAY,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,eAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAW,QAAS,CAAA,cAAA;AAAA,IACpB,UAAa,GAAA,CAAC,cAAc,CAAA,CAAE,OAAO,OAAO,CAAA;AAAA,IAC5C,QAAQ,EAAC;AAAA,IACT;AAAA,GACE,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,oBAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,UAAY,EAAA,4B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type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryKey } from './components'\nimport { queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((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 = 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator].filter(Boolean),\n query = {},\n paramsCasing,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\n group,\n paramsCasing,\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?.group && group) {\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(root, output.path, groupName({ group: options.group }), 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 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 const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\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(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\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"]}
1
+ {"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;;AAeO,IAAM,oBAAuB,GAAA;AAEvB,IAAA,gBAAA,GAAmB,YAA+B,CAAA,CAAC,OAAY,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,eAA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EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryKey } from './components'\nimport { queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((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 = 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator].filter(Boolean),\n query = {},\n paramsCasing,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\n group,\n paramsCasing,\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?.group && group) {\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(root, output.path, groupName({ group: options.group }), 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 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 const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\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(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\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"]}
@@ -33,7 +33,7 @@ type Options$2 = {
33
33
  * Path to the client import path that will be used to do the API calls.
34
34
  * It will be used as `import client from '${client.importPath}'`.
35
35
  * It allows both relative and absolute path but be aware that we will not change the path.
36
- * @default '@kubb/plugin-client/client'
36
+ * @default '@kubb/plugin-client/clients/axios'
37
37
  */
38
38
  importPath?: string;
39
39
  /**
@@ -68,10 +68,17 @@ type Options$2 = {
68
68
  pathParamsType?: 'object' | 'inline';
69
69
  /**
70
70
  * Which parser can be used before returning the data
71
- * - 'zod' will use `@kubb/plugin-zod` to parse the data.
71
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
72
72
  * @default 'client'
73
73
  */
74
74
  parser?: 'client' | 'zod';
75
+ /**
76
+ * Which client should be used to do the HTTP calls
77
+ * - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data.
78
+ * - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data.
79
+ * @default 'axios'
80
+ */
81
+ client?: 'axios' | 'fetch';
75
82
  transformers?: {
76
83
  /**
77
84
  * Customize the names based on the type that is provided by the plugin.
@@ -33,7 +33,7 @@ type Options$2 = {
33
33
  * Path to the client import path that will be used to do the API calls.
34
34
  * It will be used as `import client from '${client.importPath}'`.
35
35
  * It allows both relative and absolute path but be aware that we will not change the path.
36
- * @default '@kubb/plugin-client/client'
36
+ * @default '@kubb/plugin-client/clients/axios'
37
37
  */
38
38
  importPath?: string;
39
39
  /**
@@ -68,10 +68,17 @@ type Options$2 = {
68
68
  pathParamsType?: 'object' | 'inline';
69
69
  /**
70
70
  * Which parser can be used before returning the data
71
- * - 'zod' will use `@kubb/plugin-zod` to parse the data.
71
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
72
72
  * @default 'client'
73
73
  */
74
74
  parser?: 'client' | 'zod';
75
+ /**
76
+ * Which client should be used to do the HTTP calls
77
+ * - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data.
78
+ * - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data.
79
+ * @default 'axios'
80
+ */
81
+ client?: 'axios' | 'fetch';
75
82
  transformers?: {
76
83
  /**
77
84
  * Customize the names based on the type that is provided by the plugin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-solid-query",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "Generator solid-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -63,21 +63,21 @@
63
63
  ],
64
64
  "dependencies": {
65
65
  "remeda": "^2.17.4",
66
- "@kubb/core": "3.2.0",
67
- "@kubb/oas": "3.2.0",
68
- "@kubb/fs": "3.2.0",
69
- "@kubb/plugin-oas": "3.2.0",
70
- "@kubb/plugin-ts": "3.2.0",
71
- "@kubb/plugin-zod": "3.2.0",
72
- "@kubb/react": "3.2.0"
66
+ "@kubb/core": "3.3.1",
67
+ "@kubb/fs": "3.3.1",
68
+ "@kubb/oas": "3.3.1",
69
+ "@kubb/plugin-oas": "3.3.1",
70
+ "@kubb/plugin-ts": "3.3.1",
71
+ "@kubb/plugin-zod": "3.3.1",
72
+ "@kubb/react": "3.3.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/react": "^18.3.16",
76
76
  "react": "^18.3.1",
77
77
  "tsup": "^8.3.5",
78
78
  "typescript": "^5.7.2",
79
- "@kubb/config-ts": "3.2.0",
80
- "@kubb/config-tsup": "3.2.0"
79
+ "@kubb/config-ts": "3.3.1",
80
+ "@kubb/config-tsup": "3.3.1"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@kubb/react": "^3.0.0"
@@ -1,52 +1,67 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) };
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
+ method: 'GET',
18
+ url: `/pet/findByTags`,
19
+ params,
20
+ headers: { ...headers, ...config.headers },
21
+ ...config,
22
+ })
23
+ return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) }
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery(() => ({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = ResponseConfig<FindPetsByTagsQueryResponse>,
44
+ TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery(() => ({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,52 +1,67 @@
1
- import client from "axios";
2
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
3
- import type { RequestConfig } from "axios";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from 'axios'
2
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
3
+ import type { RequestConfig } from 'axios'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
+ method: 'GET',
18
+ url: `/pet/findByTags`,
19
+ params,
20
+ headers: { ...headers, ...config.headers },
21
+ ...config,
22
+ })
23
+ return findPetsByTagsQueryResponse.parse(res.data)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery(() => ({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery(() => ({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,52 +1,67 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
+ method: 'GET',
18
+ url: `/pet/findByTags`,
19
+ params,
20
+ headers: { ...headers, ...config.headers },
21
+ ...config,
22
+ })
23
+ return findPetsByTagsQueryResponse.parse(res.data)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery(() => ({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery(() => ({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,61 +1,72 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
- async function findPetsByTags({ headers, params }: {
16
- headers: FindPetsByTagsHeaderParams;
17
- params?: FindPetsByTagsQueryParams;
18
- }, config: Partial<RequestConfig> = {}) {
19
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
20
- return findPetsByTagsQueryResponse.parse(res.data);
15
+ async function findPetsByTags(
16
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
17
+ config: Partial<RequestConfig> = {},
18
+ ) {
19
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
20
+ method: 'GET',
21
+ url: `/pet/findByTags`,
22
+ params,
23
+ headers: { ...headers, ...config.headers },
24
+ ...config,
25
+ })
26
+ return findPetsByTagsQueryResponse.parse(res.data)
21
27
  }
22
28
 
23
- export function findPetsByTagsQueryOptions({ headers, params }: {
24
- headers: FindPetsByTagsHeaderParams;
25
- params?: FindPetsByTagsQueryParams;
26
- }, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params);
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async ({ signal }) => {
31
- config.signal = signal;
32
- return findPetsByTags({ headers, params }, config);
33
- },
34
- });
29
+ export function findPetsByTagsQueryOptions(
30
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsQueryKey(params)
34
+ return queryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal }) => {
37
+ config.signal = signal
38
+ return findPetsByTags({ headers, params }, config)
39
+ },
40
+ })
35
41
  }
36
42
 
37
- /**
43
+ /**
38
44
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
39
45
  * @summary Finds Pets by tags
40
46
  * {@link /pet/findByTags}
41
47
  */
42
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>({ headers, params }: {
43
- headers: FindPetsByTagsHeaderParams;
44
- params?: FindPetsByTagsQueryParams;
45
- }, options: {
46
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
47
- client?: Partial<RequestConfig>;
48
- } = {}) {
49
- const { query: queryOptions, client: config = {} } = options ?? {};
50
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
51
- const query = createQuery(() => ({
52
- ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as CreateBaseQueryOptions,
53
- queryKey,
54
- initialData: null,
55
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
56
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
57
- queryKey: TQueryKey;
58
- };
59
- query.queryKey = queryKey as TQueryKey;
60
- return query;
48
+ export function createFindPetsByTags<
49
+ TData = FindPetsByTagsQueryResponse,
50
+ TQueryData = FindPetsByTagsQueryResponse,
51
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
52
+ >(
53
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
54
+ options: {
55
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
56
+ client?: Partial<RequestConfig>
57
+ } = {},
58
+ ) {
59
+ const { query: queryOptions, client: config = {} } = options ?? {}
60
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
61
+
62
+ const query = createQuery(() => ({
63
+ ...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as CreateBaseQueryOptions),
64
+ queryKey,
65
+ initialData: null,
66
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
67
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
68
+
69
+ query.queryKey = queryKey as TQueryKey
70
+
71
+ return query
61
72
  }
@@ -1,52 +1,67 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
+ method: 'GET',
18
+ url: `/pet/findByTags`,
19
+ params,
20
+ headers: { ...headers, ...config.headers },
21
+ ...config,
22
+ })
23
+ return findPetsByTagsQueryResponse.parse(res.data)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery(() => ({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery(() => ({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,52 +1,67 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/react-query";
4
- import { queryOptions, createQuery } from "@tanstack/react-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query'
4
+ import { queryOptions, createQuery } from '@tanstack/react-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ["test", { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ['test', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
+ method: 'GET',
18
+ url: `/pet/findByTags`,
19
+ params,
20
+ headers: { ...headers, ...config.headers },
21
+ ...config,
22
+ })
23
+ return findPetsByTagsQueryResponse.parse(res.data)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery(() => ({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery(() => ({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,52 +1,67 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-query'
5
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * {@link /pet/findByTags}
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
+ method: 'GET',
18
+ url: `/pet/findByTags`,
19
+ params,
20
+ headers: { ...headers, ...config.headers },
21
+ ...config,
22
+ })
23
+ return findPetsByTagsQueryResponse.parse(res.data)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery(() => ({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery(() => ({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,51 +1,81 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "custom-query";
4
- import { queryOptions, createQuery } from "custom-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query'
4
+ import { queryOptions, createQuery } from 'custom-query'
5
5
 
6
- export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const;
6
+ export const updatePetWithFormQueryKey = (
7
+ petId: UpdatePetWithFormPathParams['petId'],
8
+ data?: UpdatePetWithFormMutationRequest,
9
+ params?: UpdatePetWithFormQueryParams,
10
+ ) => [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const
7
11
 
8
- export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>;
12
+ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
9
13
 
10
- /**
14
+ /**
11
15
  * @summary Updates a pet in the store with form data
12
16
  * {@link /pet/:petId}
13
17
  */
14
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
15
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
16
- return updatePetWithFormMutationResponse.parse(res.data);
18
+ async function updatePetWithForm(
19
+ petId: UpdatePetWithFormPathParams['petId'],
20
+ data?: UpdatePetWithFormMutationRequest,
21
+ params?: UpdatePetWithFormQueryParams,
22
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
23
+ ) {
24
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
25
+ method: 'POST',
26
+ url: `/pet/${petId}`,
27
+ params,
28
+ data,
29
+ ...config,
30
+ })
31
+ return updatePetWithFormMutationResponse.parse(res.data)
17
32
  }
18
33
 
19
- export function updatePetWithFormQueryOptions(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
20
- const queryKey = updatePetWithFormQueryKey(petId, data, params);
21
- return queryOptions({
22
- enabled: !!(petId),
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return updatePetWithForm(petId, data, params, config);
27
- },
28
- });
34
+ export function updatePetWithFormQueryOptions(
35
+ petId: UpdatePetWithFormPathParams['petId'],
36
+ data?: UpdatePetWithFormMutationRequest,
37
+ params?: UpdatePetWithFormQueryParams,
38
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
39
+ ) {
40
+ const queryKey = updatePetWithFormQueryKey(petId, data, params)
41
+ return queryOptions({
42
+ enabled: !!petId,
43
+ queryKey,
44
+ queryFn: async ({ signal }) => {
45
+ config.signal = signal
46
+ return updatePetWithForm(petId, data, params, config)
47
+ },
48
+ })
29
49
  }
30
50
 
31
- /**
51
+ /**
32
52
  * @summary Updates a pet in the store with form data
33
53
  * {@link /pet/:petId}
34
54
  */
35
- export function createUpdatePetWithForm<TData = UpdatePetWithFormMutationResponse, TQueryData = UpdatePetWithFormMutationResponse, TQueryKey extends QueryKey = UpdatePetWithFormQueryKey>(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, options: {
36
- query?: Partial<CreateBaseQueryOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>;
37
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
38
- } = {}) {
39
- const { query: queryOptions, client: config = {} } = options ?? {};
40
- const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params);
41
- const query = createQuery(() => ({
42
- ...updatePetWithFormQueryOptions(petId, data, params, config) as unknown as CreateBaseQueryOptions,
43
- queryKey,
44
- initialData: null,
45
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
46
- })) as CreateQueryResult<TData, UpdatePetWithForm405> & {
47
- queryKey: TQueryKey;
48
- };
49
- query.queryKey = queryKey as TQueryKey;
50
- return query;
55
+ export function createUpdatePetWithForm<
56
+ TData = UpdatePetWithFormMutationResponse,
57
+ TQueryData = UpdatePetWithFormMutationResponse,
58
+ TQueryKey extends QueryKey = UpdatePetWithFormQueryKey,
59
+ >(
60
+ petId: UpdatePetWithFormPathParams['petId'],
61
+ data?: UpdatePetWithFormMutationRequest,
62
+ params?: UpdatePetWithFormQueryParams,
63
+ options: {
64
+ query?: Partial<CreateBaseQueryOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>
65
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
66
+ } = {},
67
+ ) {
68
+ const { query: queryOptions, client: config = {} } = options ?? {}
69
+ const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params)
70
+
71
+ const query = createQuery(() => ({
72
+ ...(updatePetWithFormQueryOptions(petId, data, params, config) as unknown as CreateBaseQueryOptions),
73
+ queryKey,
74
+ initialData: null,
75
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
76
+ })) as CreateQueryResult<TData, UpdatePetWithForm405> & { queryKey: TQueryKey }
77
+
78
+ query.queryKey = queryKey as TQueryKey
79
+
80
+ return query
51
81
  }
package/src/plugin.ts CHANGED
@@ -37,7 +37,7 @@ export const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {
37
37
  options: {
38
38
  output,
39
39
  client: {
40
- importPath: '@kubb/plugin-client/client',
40
+ importPath: '@kubb/plugin-client/clients/axios',
41
41
  dataReturnType: 'data',
42
42
  pathParamsType: 'inline',
43
43
  ...options.client,