@kubb/plugin-swr 3.4.4 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunkDRK4LTOH_cjs = require('./chunk-DRK4LTOH.cjs');
3
+ var chunkGO7HPDQP_cjs = require('./chunk-GO7HPDQP.cjs');
4
4
  require('./chunk-OQB3Y5YU.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "mutationGenerator", {
9
9
  enumerable: true,
10
- get: function () { return chunkDRK4LTOH_cjs.mutationGenerator; }
10
+ get: function () { return chunkGO7HPDQP_cjs.mutationGenerator; }
11
11
  });
12
12
  Object.defineProperty(exports, "queryGenerator", {
13
13
  enumerable: true,
14
- get: function () { return chunkDRK4LTOH_cjs.queryGenerator; }
14
+ get: function () { return chunkGO7HPDQP_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 PluginSwr } from './types-CwvU4w1t.cjs';
2
+ import { P as PluginSwr } from './types-5OuVc3nn.cjs';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
  import '@kubb/plugin-client';
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginSwr } from './types-CwvU4w1t.js';
2
+ import { P as PluginSwr } from './types-5OuVc3nn.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
  import '@kubb/plugin-client';
@@ -1,4 +1,4 @@
1
- export { mutationGenerator, queryGenerator } from './chunk-5V4WE7OH.js';
1
+ export { mutationGenerator, queryGenerator } from './chunk-HDCT362M.js';
2
2
  import './chunk-VNUP6G3W.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 chunkDRK4LTOH_cjs = require('./chunk-DRK4LTOH.cjs');
3
+ var chunkGO7HPDQP_cjs = require('./chunk-GO7HPDQP.cjs');
4
4
  var chunkOQB3Y5YU_cjs = require('./chunk-OQB3Y5YU.cjs');
5
5
  var path = require('path');
6
6
  var core = require('@kubb/core');
@@ -30,7 +30,7 @@ var pluginSwr = core.createPlugin((options) => {
30
30
  pathParamsType = "inline",
31
31
  mutationKey = chunkOQB3Y5YU_cjs.MutationKey.getTransformer,
32
32
  queryKey = chunkOQB3Y5YU_cjs.QueryKey.getTransformer,
33
- generators = [chunkDRK4LTOH_cjs.queryGenerator, chunkDRK4LTOH_cjs.mutationGenerator].filter(Boolean),
33
+ generators = [chunkGO7HPDQP_cjs.queryGenerator, chunkGO7HPDQP_cjs.mutationGenerator].filter(Boolean),
34
34
  paramsCasing
35
35
  } = options;
36
36
  return {
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 PluginSwr } from './types-CwvU4w1t.cjs';
2
+ import { O as Options, P as PluginSwr } from './types-5OuVc3nn.cjs';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-client';
5
5
  import '@kubb/plugin-oas';
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 PluginSwr } from './types-CwvU4w1t.js';
2
+ import { O as Options, P as PluginSwr } from './types-5OuVc3nn.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-client';
5
5
  import '@kubb/plugin-oas';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { queryGenerator, mutationGenerator } from './chunk-5V4WE7OH.js';
1
+ import { queryGenerator, mutationGenerator } from './chunk-HDCT362M.js';
2
2
  import { MutationKey, QueryKey } from './chunk-VNUP6G3W.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 { PluginClient } from '@kubb/plugin-client';
4
4
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
5
5
 
@@ -69,7 +69,7 @@ type Options$1 = {
69
69
  * Specify the export location for the files and define the behavior of the output
70
70
  * @default { path: 'hooks', barrelType: 'named' }
71
71
  */
72
- output?: Output;
72
+ output?: Output<Oas>;
73
73
  /**
74
74
  * Group the @tanstack/query hooks based on the provided name.
75
75
  */
@@ -141,7 +141,7 @@ type Options$1 = {
141
141
  generators?: Array<Generator<PluginReactQuery>>;
142
142
  };
143
143
  type ResolvedOptions$1 = {
144
- output: Output;
144
+ output: Output<Oas>;
145
145
  group: Options$1['group'];
146
146
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
147
147
  baseURL?: string;
@@ -211,7 +211,7 @@ type Options = {
211
211
  * Specify the export location for the files and define the behavior of the output
212
212
  * @default { path: 'hooks', barrelType: 'named' }
213
213
  */
214
- output?: Output;
214
+ output?: Output<Oas>;
215
215
  /**
216
216
  * Group the SWR hooks based on the provided name.
217
217
  */
@@ -269,7 +269,7 @@ type Options = {
269
269
  generators?: Array<Generator<PluginSwr>>;
270
270
  };
271
271
  type ResolvedOptions = {
272
- output: Output;
272
+ output: Output<Oas>;
273
273
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
274
274
  baseURL?: string;
275
275
  };
@@ -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 { PluginClient } from '@kubb/plugin-client';
4
4
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
5
5
 
@@ -69,7 +69,7 @@ type Options$1 = {
69
69
  * Specify the export location for the files and define the behavior of the output
70
70
  * @default { path: 'hooks', barrelType: 'named' }
71
71
  */
72
- output?: Output;
72
+ output?: Output<Oas>;
73
73
  /**
74
74
  * Group the @tanstack/query hooks based on the provided name.
75
75
  */
@@ -141,7 +141,7 @@ type Options$1 = {
141
141
  generators?: Array<Generator<PluginReactQuery>>;
142
142
  };
143
143
  type ResolvedOptions$1 = {
144
- output: Output;
144
+ output: Output<Oas>;
145
145
  group: Options$1['group'];
146
146
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
147
147
  baseURL?: string;
@@ -211,7 +211,7 @@ type Options = {
211
211
  * Specify the export location for the files and define the behavior of the output
212
212
  * @default { path: 'hooks', barrelType: 'named' }
213
213
  */
214
- output?: Output;
214
+ output?: Output<Oas>;
215
215
  /**
216
216
  * Group the SWR hooks based on the provided name.
217
217
  */
@@ -269,7 +269,7 @@ type Options = {
269
269
  generators?: Array<Generator<PluginSwr>>;
270
270
  };
271
271
  type ResolvedOptions = {
272
- output: Output;
272
+ output: Output<Oas>;
273
273
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
274
274
  baseURL?: string;
275
275
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-swr",
3
- "version": "3.4.4",
3
+ "version": "3.5.0",
4
4
  "description": "Generator plugin-swr",
5
5
  "keywords": [
6
6
  "typescript",
@@ -64,22 +64,22 @@
64
64
  ],
65
65
  "dependencies": {
66
66
  "remeda": "^2.19.0",
67
- "@kubb/core": "3.4.4",
68
- "@kubb/fs": "3.4.4",
69
- "@kubb/oas": "3.4.4",
70
- "@kubb/plugin-client": "3.4.4",
71
- "@kubb/plugin-oas": "3.4.4",
72
- "@kubb/plugin-ts": "3.4.4",
73
- "@kubb/plugin-zod": "3.4.4",
74
- "@kubb/react": "3.4.4"
67
+ "@kubb/core": "3.5.0",
68
+ "@kubb/fs": "3.5.0",
69
+ "@kubb/oas": "3.5.0",
70
+ "@kubb/plugin-client": "3.5.0",
71
+ "@kubb/plugin-oas": "3.5.0",
72
+ "@kubb/plugin-ts": "3.5.0",
73
+ "@kubb/plugin-zod": "3.5.0",
74
+ "@kubb/react": "3.5.0"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@types/react": "^18.3.18",
78
78
  "react": "^18.3.1",
79
79
  "tsup": "^8.3.5",
80
- "typescript": "^5.7.2",
81
- "@kubb/config-ts": "3.4.4",
82
- "@kubb/config-tsup": "3.4.4"
80
+ "typescript": "^5.7.3",
81
+ "@kubb/config-ts": "3.5.0",
82
+ "@kubb/config-tsup": "3.5.0"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@kubb/react": "^3.0.0"
@@ -1,7 +1,7 @@
1
- import { pluginClientName } from '@kubb/plugin-client'
2
1
  import { Client } from '@kubb/plugin-client/components'
3
2
  import { createReactGenerator } from '@kubb/plugin-oas'
4
- 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'
5
5
  import { pluginTsName } from '@kubb/plugin-ts'
6
6
  import { pluginZodName } from '@kubb/plugin-zod'
7
7
  import { File, useApp } from '@kubb/react'
@@ -18,6 +18,7 @@ export const mutationGenerator = createReactGenerator<PluginSwr>({
18
18
  options: { output },
19
19
  },
20
20
  } = useApp<PluginSwr>()
21
+ const oas = useOas()
21
22
  const { getSchemas, getName, getFile } = useOperationManager()
22
23
 
23
24
  const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)
@@ -58,7 +59,13 @@ export const mutationGenerator = createReactGenerator<PluginSwr>({
58
59
  }
59
60
 
60
61
  return (
61
- <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
+ >
62
69
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}
63
70
  <File.Import name="useSWRMutation" path={importPath} />
64
71
  <File.Import name={['SWRMutationResponse']} path={importPath} isTypeOnly />
@@ -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'
@@ -17,6 +18,7 @@ export const queryGenerator = createReactGenerator<PluginSwr>({
17
18
  options: { output },
18
19
  },
19
20
  } = useApp<PluginSwr>()
21
+ const oas = useOas()
20
22
  const { getSchemas, getName, getFile } = useOperationManager()
21
23
 
22
24
  const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
@@ -59,7 +61,13 @@ export const queryGenerator = createReactGenerator<PluginSwr>({
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
 
65
73
  <File.Import name={'client'} path={options.client.importPath} />
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
- import type { HttpMethod, Operation } from '@kubb/oas'
2
+ import type { HttpMethod, Oas, Operation } from '@kubb/oas'
3
3
  import type { PluginClient } from '@kubb/plugin-client'
4
4
  import type { Exclude, Generator, Include, OperationSchemas, Override, ResolvePathOptions } from '@kubb/plugin-oas'
5
5
  import type { PluginReactQuery } from '@kubb/plugin-react-query'
@@ -59,7 +59,7 @@ export type Options = {
59
59
  * Specify the export location for the files and define the behavior of the output
60
60
  * @default { path: 'hooks', barrelType: 'named' }
61
61
  */
62
- output?: Output
62
+ output?: Output<Oas>
63
63
  /**
64
64
  * Group the SWR hooks based on the provided name.
65
65
  */
@@ -118,7 +118,7 @@ export type Options = {
118
118
  }
119
119
 
120
120
  type ResolvedOptions = {
121
- output: Output
121
+ output: Output<Oas>
122
122
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
123
123
  parser: Required<NonNullable<Options['parser']>>
124
124
  queryKey: QueryKey | undefined
@@ -1,245 +0,0 @@
1
- import { QueryKey, QueryOptions, Query, MutationKey, Mutation } from './chunk-VNUP6G3W.js';
2
- import { Client } from '@kubb/plugin-client/components';
3
- import { createReactGenerator } from '@kubb/plugin-oas';
4
- import { useOperationManager } from '@kubb/plugin-oas/hooks';
5
- import { pluginTsName } from '@kubb/plugin-ts';
6
- import { pluginZodName } from '@kubb/plugin-zod';
7
- import { useApp, File } from '@kubb/react';
8
- import { difference } from 'remeda';
9
- import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
10
- import '@kubb/plugin-client';
11
-
12
- var queryGenerator = createReactGenerator({
13
- name: "swr-query",
14
- Operation({ options, operation }) {
15
- const {
16
- plugin: {
17
- options: { output }
18
- }
19
- } = useApp();
20
- const { getSchemas, getName, getFile } = useOperationManager();
21
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
22
- const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
23
- (method) => operation.method === method
24
- );
25
- const importPath = options.query ? options.query.importPath : "swr/mutation";
26
- const query = {
27
- name: getName(operation, { type: "function", prefix: "use" }),
28
- typeName: getName(operation, { type: "type" }),
29
- file: getFile(operation, { prefix: "use" })
30
- };
31
- const client = {
32
- name: getName(operation, { type: "function" })
33
- };
34
- const queryOptions = {
35
- name: getName(operation, { type: "function", suffix: "QueryOptions" })
36
- };
37
- const queryKey = {
38
- name: getName(operation, { type: "const", suffix: "QueryKey" }),
39
- typeName: getName(operation, { type: "type", suffix: "QueryKey" })
40
- };
41
- const type = {
42
- file: getFile(operation, { pluginKey: [pluginTsName] }),
43
- //todo remove type?
44
- schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
45
- };
46
- const zod = {
47
- file: getFile(operation, { pluginKey: [pluginZodName] }),
48
- schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
49
- };
50
- if (!isQuery || isMutation) {
51
- return null;
52
- }
53
- return /* @__PURE__ */ jsxs(File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
54
- options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
55
- /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
56
- /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
57
- options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
58
- /* @__PURE__ */ jsx(
59
- File.Import,
60
- {
61
- name: [
62
- type.schemas.request?.name,
63
- type.schemas.response.name,
64
- type.schemas.pathParams?.name,
65
- type.schemas.queryParams?.name,
66
- type.schemas.headerParams?.name,
67
- ...type.schemas.statusCodes?.map((item) => item.name) || []
68
- ].filter(Boolean),
69
- root: query.file.path,
70
- path: type.file.path,
71
- isTypeOnly: true
72
- }
73
- ),
74
- /* @__PURE__ */ jsx(
75
- QueryKey,
76
- {
77
- name: queryKey.name,
78
- typeName: queryKey.typeName,
79
- operation,
80
- pathParamsType: options.pathParamsType,
81
- typeSchemas: type.schemas,
82
- paramsCasing: options.paramsCasing,
83
- transformer: options.queryKey
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(
87
- Client,
88
- {
89
- name: client.name,
90
- isExportable: false,
91
- isIndexable: false,
92
- baseURL: options.client.baseURL,
93
- operation,
94
- typeSchemas: type.schemas,
95
- zodSchemas: zod.schemas,
96
- dataReturnType: options.client.dataReturnType,
97
- paramsCasing: options.paramsCasing,
98
- paramsType: options.paramsType,
99
- pathParamsType: options.pathParamsType,
100
- parser: options.parser
101
- }
102
- ),
103
- /* @__PURE__ */ jsx(
104
- QueryOptions,
105
- {
106
- name: queryOptions.name,
107
- clientName: client.name,
108
- typeSchemas: type.schemas,
109
- paramsType: options.paramsType,
110
- paramsCasing: options.paramsCasing,
111
- pathParamsType: options.pathParamsType
112
- }
113
- ),
114
- options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
115
- /* @__PURE__ */ jsx(File.Import, { name: "useSWR", path: importPath }),
116
- /* @__PURE__ */ jsx(File.Import, { name: ["SWRResponse"], path: importPath, isTypeOnly: true }),
117
- /* @__PURE__ */ jsx(
118
- Query,
119
- {
120
- name: query.name,
121
- queryOptionsName: queryOptions.name,
122
- typeSchemas: type.schemas,
123
- paramsType: options.paramsType,
124
- pathParamsType: options.pathParamsType,
125
- operation,
126
- dataReturnType: options.client.dataReturnType,
127
- queryKeyName: queryKey.name,
128
- paramsCasing: options.paramsCasing,
129
- queryKeyTypeName: queryKey.typeName
130
- }
131
- )
132
- ] })
133
- ] });
134
- }
135
- });
136
- var mutationGenerator = createReactGenerator({
137
- name: "swr-mutation",
138
- Operation({ options, operation }) {
139
- const {
140
- plugin: {
141
- options: { output }
142
- }
143
- } = useApp();
144
- const { getSchemas, getName, getFile } = useOperationManager();
145
- const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
146
- const isMutation = !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
147
- const importPath = options.mutation ? options.mutation.importPath : "swr";
148
- const mutation = {
149
- name: getName(operation, { type: "function", prefix: "use" }),
150
- typeName: getName(operation, { type: "type" }),
151
- file: getFile(operation, { prefix: "use" })
152
- };
153
- const type = {
154
- file: getFile(operation, { pluginKey: [pluginTsName] }),
155
- //todo remove type?
156
- schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
157
- };
158
- const zod = {
159
- file: getFile(operation, { pluginKey: [pluginZodName] }),
160
- schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
161
- };
162
- const client = {
163
- name: getName(operation, { type: "function" })
164
- };
165
- const mutationKey = {
166
- name: getName(operation, { type: "const", suffix: "MutationKey" }),
167
- typeName: getName(operation, { type: "type", suffix: "MutationKey" })
168
- };
169
- if (!isMutation) {
170
- return null;
171
- }
172
- return /* @__PURE__ */ jsxs(File, { baseName: mutation.file.baseName, path: mutation.file.path, meta: mutation.file.meta, banner: output?.banner, footer: output?.footer, children: [
173
- options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
174
- /* @__PURE__ */ jsx(File.Import, { name: "useSWRMutation", path: importPath }),
175
- /* @__PURE__ */ jsx(File.Import, { name: ["SWRMutationResponse"], path: importPath, isTypeOnly: true }),
176
- /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
177
- /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
178
- /* @__PURE__ */ jsx(
179
- File.Import,
180
- {
181
- name: [
182
- type.schemas.request?.name,
183
- type.schemas.response.name,
184
- type.schemas.pathParams?.name,
185
- type.schemas.queryParams?.name,
186
- type.schemas.headerParams?.name,
187
- ...type.schemas.statusCodes?.map((item) => item.name) || []
188
- ].filter(Boolean),
189
- root: mutation.file.path,
190
- path: type.file.path,
191
- isTypeOnly: true
192
- }
193
- ),
194
- /* @__PURE__ */ jsx(
195
- MutationKey,
196
- {
197
- name: mutationKey.name,
198
- typeName: mutationKey.typeName,
199
- operation,
200
- pathParamsType: options.pathParamsType,
201
- typeSchemas: type.schemas,
202
- paramsCasing: options.paramsCasing,
203
- transformer: options.mutationKey
204
- }
205
- ),
206
- /* @__PURE__ */ jsx(
207
- Client,
208
- {
209
- name: client.name,
210
- isExportable: false,
211
- isIndexable: false,
212
- baseURL: options.client.baseURL,
213
- operation,
214
- typeSchemas: type.schemas,
215
- zodSchemas: zod.schemas,
216
- dataReturnType: options.client.dataReturnType,
217
- paramsCasing: options.paramsCasing,
218
- paramsType: options.paramsType,
219
- pathParamsType: options.pathParamsType,
220
- parser: options.parser
221
- }
222
- ),
223
- options.mutation && /* @__PURE__ */ jsx(
224
- Mutation,
225
- {
226
- name: mutation.name,
227
- clientName: client.name,
228
- typeName: mutation.typeName,
229
- typeSchemas: type.schemas,
230
- operation,
231
- dataReturnType: options.client.dataReturnType,
232
- paramsType: options.paramsType,
233
- paramsCasing: options.paramsCasing,
234
- pathParamsType: options.pathParamsType,
235
- mutationKeyName: mutationKey.name,
236
- mutationKeyTypeName: mutationKey.typeName
237
- }
238
- )
239
- ] });
240
- }
241
- });
242
-
243
- export { mutationGenerator, queryGenerator };
244
- //# sourceMappingURL=chunk-5V4WE7OH.js.map
245
- //# sourceMappingURL=chunk-5V4WE7OH.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","Client"],"mappings":";;;;;;;;;;;AAWO,IAAM,iBAAiB,oBAAgC,CAAA;AAAA,EAC5D,IAAM,EAAA,WAAA;AAAA,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,cAAc,OAAQ,CAAA,YAAA;AAAA,UACtB,YAAY,OAAQ,CAAA,UAAA;AAAA,UACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,QAAQ,OAAQ,CAAA;AAAA;AAAA,OAClB;AAAA,MACC,OAAA,CAAQ,4BACPD,GAAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,MAAM,QAAS,CAAA,IAAA;AAAA,UACf,YAAY,MAAO,CAAA,IAAA;AAAA,UACnB,UAAU,QAAS,CAAA,QAAA;AAAA,UACnB,aAAa,IAAK,CAAA,OAAA;AAAA,UAClB,SAAA;AAAA,UACA,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,UAC/B,YAAY,OAAQ,CAAA,UAAA;AAAA,UACpB,cAAc,OAAQ,CAAA,YAAA;AAAA,UACtB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,iBAAiB,WAAY,CAAA,IAAA;AAAA,UAC7B,qBAAqB,WAAY,CAAA;AAAA;AAAA;AACnC,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-5V4WE7OH.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, QueryOptions } from '../components'\nimport { QueryKey } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSwr>()\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 : 'swr/mutation'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 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\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\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 <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 <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 <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name=\"useSWR\" path={importPath} />\n <File.Import name={['SWRResponse']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n paramsCasing={options.paramsCasing}\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 { MutationKey } from '../components'\nimport { Mutation } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-mutation',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSwr>()\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 : 'swr'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 <File.Import name=\"useSWRMutation\" path={importPath} />\n <File.Import name={['SWRMutationResponse']} path={importPath} isTypeOnly />\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 pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\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 {options.mutation && (\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n mutationKeyTypeName={mutationKey.typeName}\n />\n )}\n </File>\n )\n },\n})\n"]}