@kubb/plugin-svelte-query 3.4.5 → 3.5.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.
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunkL344MSSI_cjs = require('./chunk-L344MSSI.cjs');
3
+ var chunk7GM4ILPD_cjs = require('./chunk-7GM4ILPD.cjs');
4
4
  require('./chunk-5E5RFWUM.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "mutationGenerator", {
9
9
  enumerable: true,
10
- get: function () { return chunkL344MSSI_cjs.mutationGenerator; }
10
+ get: function () { return chunk7GM4ILPD_cjs.mutationGenerator; }
11
11
  });
12
12
  Object.defineProperty(exports, "queryGenerator", {
13
13
  enumerable: true,
14
- get: function () { return chunkL344MSSI_cjs.queryGenerator; }
14
+ get: function () { return chunk7GM4ILPD_cjs.queryGenerator; }
15
15
  });
16
16
  //# sourceMappingURL=generators.cjs.map
17
17
  //# sourceMappingURL=generators.cjs.map
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginSvelteQuery } from './types-CdgT4Eeh.cjs';
2
+ import { P as PluginSvelteQuery } from './types-C3C1lWLx.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 PluginSvelteQuery } from './types-CdgT4Eeh.js';
2
+ import { P as PluginSvelteQuery } from './types-C3C1lWLx.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,4 +1,4 @@
1
- export { mutationGenerator, queryGenerator } from './chunk-KACKUZF2.js';
1
+ export { mutationGenerator, queryGenerator } from './chunk-AKSVF5YB.js';
2
2
  import './chunk-EE3OWZ2P.js';
3
3
  //# sourceMappingURL=generators.js.map
4
4
  //# sourceMappingURL=generators.js.map
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkL344MSSI_cjs = require('./chunk-L344MSSI.cjs');
3
+ var chunk7GM4ILPD_cjs = require('./chunk-7GM4ILPD.cjs');
4
4
  var chunk5E5RFWUM_cjs = require('./chunk-5E5RFWUM.cjs');
5
5
  var path = require('path');
6
6
  var core = require('@kubb/core');
@@ -30,7 +30,7 @@ var pluginSvelteQuery = core.createPlugin((options) => {
30
30
  paramsCasing,
31
31
  mutationKey = chunk5E5RFWUM_cjs.MutationKey.getTransformer,
32
32
  queryKey = chunk5E5RFWUM_cjs.QueryKey.getTransformer,
33
- generators = [chunkL344MSSI_cjs.queryGenerator, chunkL344MSSI_cjs.mutationGenerator].filter(Boolean)
33
+ generators = [chunk7GM4ILPD_cjs.queryGenerator, chunk7GM4ILPD_cjs.mutationGenerator].filter(Boolean)
34
34
  } = options;
35
35
  return {
36
36
  name: pluginSvelteQueryName,
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 PluginSvelteQuery } from './types-CdgT4Eeh.cjs';
2
+ import { O as Options, P as PluginSvelteQuery } from './types-C3C1lWLx.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 PluginSvelteQuery } from './types-CdgT4Eeh.js';
2
+ import { O as Options, P as PluginSvelteQuery } from './types-C3C1lWLx.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { queryGenerator, mutationGenerator } from './chunk-KACKUZF2.js';
1
+ import { queryGenerator, mutationGenerator } from './chunk-AKSVF5YB.js';
2
2
  import { MutationKey, QueryKey } from './chunk-EE3OWZ2P.js';
3
3
  import path from 'node:path';
4
4
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
@@ -1,5 +1,5 @@
1
1
  import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { HttpMethod, Operation } from '@kubb/oas';
2
+ import { Oas, HttpMethod, Operation } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
4
 
5
5
  type Options$2 = {
@@ -7,7 +7,7 @@ type Options$2 = {
7
7
  * Specify the export location for the files and define the behavior of the output
8
8
  * @default { path: 'clients', barrelType: 'named' }
9
9
  */
10
- output?: Output;
10
+ output?: Output<Oas>;
11
11
  /**
12
12
  * Group the clients based on the provided name.
13
13
  */
@@ -91,7 +91,7 @@ type Options$2 = {
91
91
  generators?: Array<Generator<PluginClient>>;
92
92
  };
93
93
  type ResolvedOptions$2 = {
94
- output: Output;
94
+ output: Output<Oas>;
95
95
  group?: Options$2['group'];
96
96
  baseURL: string | undefined;
97
97
  parser: NonNullable<Options$2['parser']>;
@@ -169,7 +169,7 @@ type Options$1 = {
169
169
  * Specify the export location for the files and define the behavior of the output
170
170
  * @default { path: 'hooks', barrelType: 'named' }
171
171
  */
172
- output?: Output;
172
+ output?: Output<Oas>;
173
173
  /**
174
174
  * Group the @tanstack/query hooks based on the provided name.
175
175
  */
@@ -241,7 +241,7 @@ type Options$1 = {
241
241
  generators?: Array<Generator<PluginReactQuery>>;
242
242
  };
243
243
  type ResolvedOptions$1 = {
244
- output: Output;
244
+ output: Output<Oas>;
245
245
  group: Options$1['group'];
246
246
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
247
247
  baseURL?: string;
@@ -311,7 +311,7 @@ type Options = {
311
311
  * Specify the export location for the files and define the behavior of the output
312
312
  * @default { path: 'hooks', barrelType: 'named' }
313
313
  */
314
- output?: Output;
314
+ output?: Output<Oas>;
315
315
  /**
316
316
  * Group the @tanstack/query hooks based on the provided name.
317
317
  */
@@ -375,7 +375,7 @@ type Options = {
375
375
  generators?: Array<Generator<PluginSvelteQuery>>;
376
376
  };
377
377
  type ResolvedOptions = {
378
- output: Output;
378
+ output: Output<Oas>;
379
379
  group: Options['group'];
380
380
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
381
381
  baseURL?: string;
@@ -1,5 +1,5 @@
1
1
  import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { HttpMethod, Operation } from '@kubb/oas';
2
+ import { Oas, HttpMethod, Operation } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
4
 
5
5
  type Options$2 = {
@@ -7,7 +7,7 @@ type Options$2 = {
7
7
  * Specify the export location for the files and define the behavior of the output
8
8
  * @default { path: 'clients', barrelType: 'named' }
9
9
  */
10
- output?: Output;
10
+ output?: Output<Oas>;
11
11
  /**
12
12
  * Group the clients based on the provided name.
13
13
  */
@@ -91,7 +91,7 @@ type Options$2 = {
91
91
  generators?: Array<Generator<PluginClient>>;
92
92
  };
93
93
  type ResolvedOptions$2 = {
94
- output: Output;
94
+ output: Output<Oas>;
95
95
  group?: Options$2['group'];
96
96
  baseURL: string | undefined;
97
97
  parser: NonNullable<Options$2['parser']>;
@@ -169,7 +169,7 @@ type Options$1 = {
169
169
  * Specify the export location for the files and define the behavior of the output
170
170
  * @default { path: 'hooks', barrelType: 'named' }
171
171
  */
172
- output?: Output;
172
+ output?: Output<Oas>;
173
173
  /**
174
174
  * Group the @tanstack/query hooks based on the provided name.
175
175
  */
@@ -241,7 +241,7 @@ type Options$1 = {
241
241
  generators?: Array<Generator<PluginReactQuery>>;
242
242
  };
243
243
  type ResolvedOptions$1 = {
244
- output: Output;
244
+ output: Output<Oas>;
245
245
  group: Options$1['group'];
246
246
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
247
247
  baseURL?: string;
@@ -311,7 +311,7 @@ type Options = {
311
311
  * Specify the export location for the files and define the behavior of the output
312
312
  * @default { path: 'hooks', barrelType: 'named' }
313
313
  */
314
- output?: Output;
314
+ output?: Output<Oas>;
315
315
  /**
316
316
  * Group the @tanstack/query hooks based on the provided name.
317
317
  */
@@ -375,7 +375,7 @@ type Options = {
375
375
  generators?: Array<Generator<PluginSvelteQuery>>;
376
376
  };
377
377
  type ResolvedOptions = {
378
- output: Output;
378
+ output: Output<Oas>;
379
379
  group: Options['group'];
380
380
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
381
381
  baseURL?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-svelte-query",
3
- "version": "3.4.5",
3
+ "version": "3.5.1",
4
4
  "description": "Generator svelte-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -62,22 +62,22 @@
62
62
  "!/**/__tests__/**"
63
63
  ],
64
64
  "dependencies": {
65
- "remeda": "^2.19.0",
66
- "@kubb/fs": "3.4.5",
67
- "@kubb/core": "3.4.5",
68
- "@kubb/oas": "3.4.5",
69
- "@kubb/plugin-oas": "3.4.5",
70
- "@kubb/plugin-ts": "3.4.5",
71
- "@kubb/plugin-zod": "3.4.5",
72
- "@kubb/react": "3.4.5"
65
+ "remeda": "^2.19.1",
66
+ "@kubb/core": "3.5.1",
67
+ "@kubb/fs": "3.5.1",
68
+ "@kubb/oas": "3.5.1",
69
+ "@kubb/plugin-oas": "3.5.1",
70
+ "@kubb/plugin-ts": "3.5.1",
71
+ "@kubb/plugin-zod": "3.5.1",
72
+ "@kubb/react": "3.5.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/react": "^18.3.18",
76
76
  "react": "^18.3.1",
77
77
  "tsup": "^8.3.5",
78
78
  "typescript": "^5.7.3",
79
- "@kubb/config-ts": "3.4.5",
80
- "@kubb/config-tsup": "3.4.5"
79
+ "@kubb/config-ts": "3.5.1",
80
+ "@kubb/config-tsup": "3.5.1"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@kubb/react": "^3.0.0"
@@ -1,7 +1,8 @@
1
1
  import { pluginClientName } from '@kubb/plugin-client'
2
2
  import { Client } from '@kubb/plugin-client/components'
3
3
  import { createReactGenerator } from '@kubb/plugin-oas'
4
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
5
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
5
6
  import { pluginTsName } from '@kubb/plugin-ts'
6
7
  import { pluginZodName } from '@kubb/plugin-zod'
7
8
  import { File, useApp } from '@kubb/react'
@@ -17,6 +18,7 @@ export const mutationGenerator = createReactGenerator<PluginSvelteQuery>({
17
18
  options: { output },
18
19
  },
19
20
  } = useApp<PluginSvelteQuery>()
21
+ const oas = useOas()
20
22
  const { getSchemas, getName, getFile } = useOperationManager()
21
23
 
22
24
  const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)
@@ -57,7 +59,13 @@ export const mutationGenerator = createReactGenerator<PluginSvelteQuery>({
57
59
  }
58
60
 
59
61
  return (
60
- <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>
62
+ <File
63
+ baseName={mutation.file.baseName}
64
+ path={mutation.file.path}
65
+ meta={mutation.file.meta}
66
+ banner={getBanner({ oas, output })}
67
+ footer={getFooter({ oas, output })}
68
+ >
61
69
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}
62
70
 
63
71
  <File.Import name={'client'} path={options.client.importPath} />
@@ -1,6 +1,7 @@
1
1
  import { Client } from '@kubb/plugin-client/components'
2
2
  import { createReactGenerator } from '@kubb/plugin-oas'
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
4
5
  import { pluginTsName } from '@kubb/plugin-ts'
5
6
  import { pluginZodName } from '@kubb/plugin-zod'
6
7
  import { File, useApp } from '@kubb/react'
@@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator<PluginSvelteQuery>({
16
17
  options: { output },
17
18
  },
18
19
  } = useApp<PluginSvelteQuery>()
20
+ const oas = useOas()
19
21
  const { getSchemas, getName, getFile } = useOperationManager()
20
22
 
21
23
  const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
@@ -59,7 +61,13 @@ export const queryGenerator = createReactGenerator<PluginSvelteQuery>({
59
61
  }
60
62
 
61
63
  return (
62
- <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
64
+ <File
65
+ baseName={query.file.baseName}
66
+ path={query.file.path}
67
+ meta={query.file.meta}
68
+ banner={getBanner({ oas, output })}
69
+ footer={getFooter({ oas, output })}
70
+ >
63
71
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
64
72
  <File.Import name={'client'} path={options.client.importPath} />
65
73
  <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
2
 
3
- import type { HttpMethod, Operation } from '@kubb/oas'
3
+ import type { HttpMethod, Oas, Operation } from '@kubb/oas'
4
4
  import type { PluginClient } from '@kubb/plugin-client'
5
5
  import type { Exclude, Generator, Include, OperationSchemas, Override, ResolvePathOptions } from '@kubb/plugin-oas'
6
6
  import type { PluginReactQuery } from '@kubb/plugin-react-query'
@@ -60,7 +60,7 @@ export type Options = {
60
60
  * Specify the export location for the files and define the behavior of the output
61
61
  * @default { path: 'hooks', barrelType: 'named' }
62
62
  */
63
- output?: Output
63
+ output?: Output<Oas>
64
64
  /**
65
65
  * Group the @tanstack/query hooks based on the provided name.
66
66
  */
@@ -127,7 +127,7 @@ export type Options = {
127
127
  }
128
128
 
129
129
  type ResolvedOptions = {
130
- output: Output
130
+ output: Output<Oas>
131
131
  group: Options['group']
132
132
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
133
133
  parser: Required<NonNullable<Options['parser']>>
@@ -1,247 +0,0 @@
1
- import { QueryKey, Client, QueryOptions, Query, MutationKey, Mutation } from './chunk-EE3OWZ2P.js';
2
- import { createReactGenerator } from '@kubb/plugin-oas';
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks';
4
- import { pluginTsName } from '@kubb/plugin-ts';
5
- import { pluginZodName } from '@kubb/plugin-zod';
6
- import { useApp, File } from '@kubb/react';
7
- import { difference } from 'remeda';
8
- import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
9
-
10
- var queryGenerator = createReactGenerator({
11
- name: "svelte-query",
12
- Operation({ options, operation }) {
13
- const {
14
- plugin: {
15
- options: { output }
16
- }
17
- } = useApp();
18
- const { getSchemas, getName, getFile } = useOperationManager();
19
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
20
- const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
21
- (method) => operation.method === method
22
- );
23
- const importPath = options.query ? options.query.importPath : "@tanstack/svelte-query";
24
- const query = {
25
- name: getName(operation, { type: "function", prefix: "create" }),
26
- typeName: getName(operation, { type: "type" }),
27
- file: getFile(operation, { prefix: "create" })
28
- };
29
- const client = {
30
- name: getName(operation, { type: "function" })
31
- };
32
- const queryOptions = {
33
- name: getName(operation, { type: "function", suffix: "QueryOptions" })
34
- };
35
- const queryKey = {
36
- name: getName(operation, { type: "const", suffix: "QueryKey" }),
37
- typeName: getName(operation, { type: "type", suffix: "QueryKey" })
38
- };
39
- const type = {
40
- file: getFile(operation, { pluginKey: [pluginTsName] }),
41
- //todo remove type?
42
- schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
43
- };
44
- const zod = {
45
- file: getFile(operation, { pluginKey: [pluginZodName] }),
46
- schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
47
- };
48
- if (!isQuery || isMutation) {
49
- return null;
50
- }
51
- return /* @__PURE__ */ jsxs(File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
52
- options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
53
- /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
54
- /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
55
- options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
56
- /* @__PURE__ */ jsx(
57
- File.Import,
58
- {
59
- name: [
60
- type.schemas.request?.name,
61
- type.schemas.response.name,
62
- type.schemas.pathParams?.name,
63
- type.schemas.queryParams?.name,
64
- type.schemas.headerParams?.name,
65
- ...type.schemas.statusCodes?.map((item) => item.name) || []
66
- ].filter(Boolean),
67
- root: query.file.path,
68
- path: type.file.path,
69
- isTypeOnly: true
70
- }
71
- ),
72
- /* @__PURE__ */ jsx(
73
- QueryKey,
74
- {
75
- name: queryKey.name,
76
- typeName: queryKey.typeName,
77
- operation,
78
- pathParamsType: options.pathParamsType,
79
- typeSchemas: type.schemas,
80
- paramsCasing: options.paramsCasing,
81
- transformer: options.queryKey
82
- }
83
- ),
84
- /* @__PURE__ */ jsx(
85
- Client,
86
- {
87
- name: client.name,
88
- isExportable: false,
89
- isIndexable: false,
90
- baseURL: options.client.baseURL,
91
- operation,
92
- typeSchemas: type.schemas,
93
- zodSchemas: zod.schemas,
94
- dataReturnType: options.client.dataReturnType,
95
- paramsCasing: options.paramsCasing,
96
- paramsType: options.paramsType,
97
- pathParamsType: options.pathParamsType,
98
- parser: options.parser
99
- }
100
- ),
101
- /* @__PURE__ */ jsx(File.Import, { name: ["queryOptions"], path: importPath }),
102
- /* @__PURE__ */ jsx(
103
- QueryOptions,
104
- {
105
- name: queryOptions.name,
106
- clientName: client.name,
107
- queryKeyName: queryKey.name,
108
- typeSchemas: type.schemas,
109
- paramsCasing: options.paramsCasing,
110
- paramsType: options.paramsType,
111
- pathParamsType: options.pathParamsType,
112
- dataReturnType: options.client.dataReturnType
113
- }
114
- ),
115
- options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
116
- /* @__PURE__ */ jsx(File.Import, { name: ["createQuery"], path: importPath }),
117
- /* @__PURE__ */ jsx(File.Import, { name: ["QueryKey", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
118
- /* @__PURE__ */ jsx(
119
- Query,
120
- {
121
- name: query.name,
122
- queryOptionsName: queryOptions.name,
123
- typeSchemas: type.schemas,
124
- pathParamsType: options.pathParamsType,
125
- operation,
126
- paramsCasing: options.paramsCasing,
127
- paramsType: options.paramsType,
128
- dataReturnType: options.client.dataReturnType,
129
- queryKeyName: queryKey.name,
130
- queryKeyTypeName: queryKey.typeName
131
- }
132
- )
133
- ] })
134
- ] });
135
- }
136
- });
137
- var mutationGenerator = createReactGenerator({
138
- name: "svelte-query",
139
- Operation({ options, operation }) {
140
- const {
141
- plugin: {
142
- options: { output }
143
- }
144
- } = useApp();
145
- const { getSchemas, getName, getFile } = useOperationManager();
146
- const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
147
- const isMutation = !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
148
- const importPath = options.mutation ? options.mutation.importPath : "@tanstack/svelte-query";
149
- const mutation = {
150
- name: getName(operation, { type: "function", prefix: "create" }),
151
- typeName: getName(operation, { type: "type" }),
152
- file: getFile(operation, { prefix: "create" })
153
- };
154
- const type = {
155
- file: getFile(operation, { pluginKey: [pluginTsName] }),
156
- //todo remove type?
157
- schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
158
- };
159
- const zod = {
160
- file: getFile(operation, { pluginKey: [pluginZodName] }),
161
- schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
162
- };
163
- const client = {
164
- name: getName(operation, { type: "function" })
165
- };
166
- const mutationKey = {
167
- name: getName(operation, { type: "const", suffix: "MutationKey" }),
168
- typeName: getName(operation, { type: "type", suffix: "MutationKey" })
169
- };
170
- if (!isMutation) {
171
- return null;
172
- }
173
- return /* @__PURE__ */ jsxs(File, { baseName: mutation.file.baseName, path: mutation.file.path, meta: mutation.file.meta, banner: output?.banner, footer: output?.footer, children: [
174
- options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
175
- /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
176
- /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
177
- /* @__PURE__ */ jsx(
178
- File.Import,
179
- {
180
- name: [
181
- type.schemas.request?.name,
182
- type.schemas.response.name,
183
- type.schemas.pathParams?.name,
184
- type.schemas.queryParams?.name,
185
- type.schemas.headerParams?.name,
186
- ...type.schemas.statusCodes?.map((item) => item.name) || []
187
- ].filter(Boolean),
188
- root: mutation.file.path,
189
- path: type.file.path,
190
- isTypeOnly: true
191
- }
192
- ),
193
- /* @__PURE__ */ jsx(
194
- MutationKey,
195
- {
196
- name: mutationKey.name,
197
- typeName: mutationKey.typeName,
198
- operation,
199
- paramsCasing: options.paramsCasing,
200
- pathParamsType: options.pathParamsType,
201
- typeSchemas: type.schemas,
202
- transformer: options.mutationKey
203
- }
204
- ),
205
- /* @__PURE__ */ jsx(
206
- Client,
207
- {
208
- name: client.name,
209
- isExportable: false,
210
- isIndexable: false,
211
- baseURL: options.client.baseURL,
212
- operation,
213
- typeSchemas: type.schemas,
214
- zodSchemas: zod.schemas,
215
- dataReturnType: options.client.dataReturnType,
216
- paramsCasing: options.paramsCasing,
217
- paramsType: options.paramsType,
218
- pathParamsType: options.pathParamsType,
219
- parser: options.parser
220
- }
221
- ),
222
- options.mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
223
- /* @__PURE__ */ jsx(File.Import, { name: ["createMutation"], path: importPath }),
224
- /* @__PURE__ */ jsx(File.Import, { name: ["CreateMutationOptions", "CreateMutationResult"], path: importPath, isTypeOnly: true }),
225
- /* @__PURE__ */ jsx(
226
- Mutation,
227
- {
228
- name: mutation.name,
229
- clientName: client.name,
230
- typeName: mutation.typeName,
231
- typeSchemas: type.schemas,
232
- operation,
233
- paramsCasing: options.paramsCasing,
234
- dataReturnType: options.client.dataReturnType,
235
- paramsType: options.paramsType,
236
- pathParamsType: options.pathParamsType,
237
- mutationKeyName: mutationKey.name
238
- }
239
- )
240
- ] })
241
- ] });
242
- }
243
- });
244
-
245
- export { mutationGenerator, queryGenerator };
246
- //# sourceMappingURL=chunk-KACKUZF2.js.map
247
- //# sourceMappingURL=chunk-KACKUZF2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["createReactGenerator","useApp","useOperationManager","difference","pluginTsName","pluginZodName","jsxs","File","jsx","Fragment"],"mappings":";;;;;;;;;AAUO,IAAM,iBAAiB,oBAAwC,CAAA;AAAA,EACpE,IAAM,EAAA,cAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA,EAAa,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,OAAA,EAAS,EAAE,MAAO;AAAA;AACpB,QACE,MAA0B,EAAA;AAC9B,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAY,mBAAoB,EAAA;AAE7D,IAAA,MAAM,OAAU,GAAA,OAAO,OAAQ,CAAA,KAAA,KAAU,YAAY,IAAO,GAAA,OAAA,CAAQ,KAAO,EAAA,OAAA,CAAQ,IAAK,CAAA,CAAC,MAA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AY,IAAA,EAAM,CAAC,uBAAA,EAAyB,sBAAsB,CAAA,EAAG,IAAM,EAAA,UAAA,EAAY,YAAU,IAAC,EAAA,CAAA;AAAA,wBACnGC,GAAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,MAAM,QAAS,CAAA,IAAA;AAAA,YACf,YAAY,MAAO,CAAA,IAAA;AAAA,YACnB,UAAU,QAAS,CAAA,QAAA;AAAA,YACnB,aAAa,IAAK,CAAA,OAAA;AAAA,YAClB,SAAA;AAAA,YACA,cAAc,OAAQ,CAAA,YAAA;AAAA,YACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,YAC/B,YAAY,OAAQ,CAAA,UAAA;AAAA,YACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,YACxB,iBAAiB,WAAY,CAAA;AAAA;AAAA;AAC/B,OACF,EAAA;AAAA,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-KACKUZF2.js","sourcesContent":["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSvelteQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/svelte-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSvelteQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/svelte-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}\n\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}