@kubb/plugin-vue-query 5.0.0-beta.4 → 5.0.0-beta.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -22
- package/dist/{components-D1UhYFgY.js → components-B79Gljyl.js} +483 -565
- package/dist/components-B79Gljyl.js.map +1 -0
- package/dist/{components-qfOFRSoM.cjs → components-D3xIZ9FA.cjs} +513 -565
- package/dist/components-D3xIZ9FA.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +4 -68
- package/dist/components.js +1 -1
- package/dist/{generators-C4gs_P1i.cjs → generators-BTtcGtUY.cjs} +225 -314
- package/dist/generators-BTtcGtUY.cjs.map +1 -0
- package/dist/generators-D95ddIFV.js +620 -0
- package/dist/generators-D95ddIFV.js.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +21 -6
- package/dist/generators.js +1 -1
- package/dist/index.cjs +158 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -4
- package/dist/index.js +160 -27
- package/dist/index.js.map +1 -1
- package/dist/types-CwabLiFK.d.ts +266 -0
- package/package.json +18 -27
- package/src/components/InfiniteQuery.tsx +18 -50
- package/src/components/InfiniteQueryOptions.tsx +64 -82
- package/src/components/Mutation.tsx +35 -44
- package/src/components/Query.tsx +18 -51
- package/src/components/QueryKey.tsx +9 -61
- package/src/components/QueryOptions.tsx +22 -99
- package/src/generators/infiniteQueryGenerator.tsx +55 -67
- package/src/generators/mutationGenerator.tsx +53 -65
- package/src/generators/queryGenerator.tsx +52 -65
- package/src/plugin.ts +48 -32
- package/src/resolvers/resolverVueQuery.ts +63 -6
- package/src/types.ts +132 -60
- package/src/utils.ts +45 -25
- package/dist/components-D1UhYFgY.js.map +0 -1
- package/dist/components-qfOFRSoM.cjs.map +0 -1
- package/dist/generators-C4gs_P1i.cjs.map +0 -1
- package/dist/generators-CbnIVBgY.js +0 -709
- package/dist/generators-CbnIVBgY.js.map +0 -1
- package/dist/types-nVDTfuS1.d.ts +0 -194
- package/extension.yaml +0 -793
- /package/dist/{chunk--u3MIqq1.js → chunk-C0LytTxp.js} +0 -0
|
@@ -28,6 +28,7 @@ let _kubb_core = require("@kubb/core");
|
|
|
28
28
|
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
29
29
|
let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
|
|
30
30
|
let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
|
|
31
|
+
let _kubb_ast_utils = require("@kubb/ast/utils");
|
|
31
32
|
//#region ../../internals/utils/src/casing.ts
|
|
32
33
|
/**
|
|
33
34
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -39,50 +40,20 @@ let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
|
|
|
39
40
|
function toCamelOrPascal(text, pascal) {
|
|
40
41
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
41
42
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
42
|
-
|
|
43
|
-
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
43
|
+
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
44
44
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Splits `text` on `.` and applies `transformPart` to each segment.
|
|
48
|
-
* The last segment receives `isLast = true`, all earlier segments receive `false`.
|
|
49
|
-
* Segments are joined with `/` to form a file path.
|
|
50
|
-
*
|
|
51
|
-
* Only splits on dots followed by a letter so that version numbers
|
|
52
|
-
* embedded in operationIds (e.g. `v2025.0`) are kept intact.
|
|
53
|
-
*/
|
|
54
|
-
function applyToFileParts(text, transformPart) {
|
|
55
|
-
const parts = text.split(/\.(?=[a-zA-Z])/);
|
|
56
|
-
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
47
|
* Converts `text` to camelCase.
|
|
60
|
-
* When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
|
|
61
48
|
*
|
|
62
|
-
* @example
|
|
63
|
-
* camelCase('hello-world')
|
|
64
|
-
* camelCase('pet.petId', { isFile: true }) // 'pet/petId'
|
|
65
|
-
*/
|
|
66
|
-
function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
67
|
-
if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
|
|
68
|
-
prefix,
|
|
69
|
-
suffix
|
|
70
|
-
} : {}));
|
|
71
|
-
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region ../../internals/utils/src/object.ts
|
|
75
|
-
/**
|
|
76
|
-
* Converts a dot-notation path or string array into an optional-chaining accessor expression.
|
|
49
|
+
* @example Word boundaries
|
|
50
|
+
* `camelCase('hello-world') // 'helloWorld'`
|
|
77
51
|
*
|
|
78
|
-
* @example
|
|
79
|
-
*
|
|
80
|
-
* // → "lastPage?.['pagination']?.['next']?.['id']"
|
|
52
|
+
* @example With a prefix
|
|
53
|
+
* `camelCase('tag', { prefix: 'create' }) // 'createTag'`
|
|
81
54
|
*/
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
|
|
85
|
-
return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
|
|
55
|
+
function camelCase(text, { prefix = "", suffix = "" } = {}) {
|
|
56
|
+
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
86
57
|
}
|
|
87
58
|
//#endregion
|
|
88
59
|
//#region ../../internals/utils/src/reserved.ts
|
|
@@ -188,99 +159,80 @@ function isValidVarName(name) {
|
|
|
188
159
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
|
|
189
160
|
}
|
|
190
161
|
//#endregion
|
|
191
|
-
//#region ../../internals/utils/src/
|
|
162
|
+
//#region ../../internals/utils/src/url.ts
|
|
163
|
+
function transformParam(raw, casing) {
|
|
164
|
+
const param = isValidVarName(raw) ? raw : camelCase(raw);
|
|
165
|
+
return casing === "camelcase" ? camelCase(param) : param;
|
|
166
|
+
}
|
|
167
|
+
function toParamsObject(path, { replacer, casing } = {}) {
|
|
168
|
+
const params = {};
|
|
169
|
+
for (const match of path.matchAll(/\{([^}]+)\}/g)) {
|
|
170
|
+
const param = transformParam(match[1], casing);
|
|
171
|
+
const key = replacer ? replacer(param) : param;
|
|
172
|
+
params[key] = key;
|
|
173
|
+
}
|
|
174
|
+
return Object.keys(params).length > 0 ? params : null;
|
|
175
|
+
}
|
|
192
176
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* const p = new URLPath('/pet/{petId}')
|
|
197
|
-
* p.URL // '/pet/:petId'
|
|
198
|
-
* p.template // '`/pet/${petId}`'
|
|
177
|
+
* Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
|
|
199
178
|
*/
|
|
200
|
-
var
|
|
179
|
+
var Url = class Url {
|
|
201
180
|
/**
|
|
202
|
-
*
|
|
203
|
-
*/
|
|
204
|
-
path;
|
|
205
|
-
#options;
|
|
206
|
-
constructor(path, options = {}) {
|
|
207
|
-
this.path = path;
|
|
208
|
-
this.#options = options;
|
|
209
|
-
}
|
|
210
|
-
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
|
|
181
|
+
* Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.
|
|
211
182
|
*
|
|
212
183
|
* @example
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* ```
|
|
184
|
+
* Url.canParse('https://petstore.swagger.io/v2') // true
|
|
185
|
+
* Url.canParse('/pet/{petId}') // false
|
|
216
186
|
*/
|
|
217
|
-
|
|
218
|
-
return
|
|
187
|
+
static canParse(url, base) {
|
|
188
|
+
return URL.canParse(url, base);
|
|
219
189
|
}
|
|
220
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* Converts an OpenAPI/Swagger path to Express-style colon syntax.
|
|
221
192
|
*
|
|
222
193
|
* @example
|
|
223
|
-
*
|
|
224
|
-
* new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
|
|
225
|
-
* new URLPath('/pet/{petId}').isURL // false
|
|
226
|
-
* ```
|
|
194
|
+
* Url.toPath('/pet/{petId}') // '/pet/:petId'
|
|
227
195
|
*/
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return !!new URL(this.path).href;
|
|
231
|
-
} catch {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
196
|
+
static toPath(path) {
|
|
197
|
+
return path.replace(/\{([^}]+)\}/g, ":$1");
|
|
234
198
|
}
|
|
235
199
|
/**
|
|
236
|
-
* Converts
|
|
200
|
+
* Converts an OpenAPI/Swagger path to a TypeScript template literal string.
|
|
201
|
+
* `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
|
|
202
|
+
* and `casing` controls parameter identifier casing.
|
|
237
203
|
*
|
|
238
204
|
* @example
|
|
239
|
-
*
|
|
240
|
-
* new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
|
|
241
|
-
*/
|
|
242
|
-
get template() {
|
|
243
|
-
return this.toTemplateString();
|
|
244
|
-
}
|
|
245
|
-
/** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
|
|
205
|
+
* Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
|
|
246
206
|
*
|
|
247
207
|
* @example
|
|
248
|
-
*
|
|
249
|
-
* new URLPath('/pet/{petId}').object
|
|
250
|
-
* // { url: '/pet/:petId', params: { petId: 'petId' } }
|
|
251
|
-
* ```
|
|
208
|
+
* Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
|
|
252
209
|
*/
|
|
253
|
-
|
|
254
|
-
|
|
210
|
+
static toTemplateString(path, { prefix, replacer, casing } = {}) {
|
|
211
|
+
const result = path.split(/\{([^}]+)\}/).map((part, i) => {
|
|
212
|
+
if (i % 2 === 0) return part;
|
|
213
|
+
const param = transformParam(part, casing);
|
|
214
|
+
return `\${${replacer ? replacer(param) : param}}`;
|
|
215
|
+
}).join("");
|
|
216
|
+
return `\`${prefix ?? ""}${result}\``;
|
|
255
217
|
}
|
|
256
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Returns the path and its extracted params as a structured `URLObject`, or as a stringified
|
|
220
|
+
* expression when `stringify` is set.
|
|
257
221
|
*
|
|
258
222
|
* @example
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
* new URLPath('/pet').params // undefined
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
get params() {
|
|
265
|
-
return this.getParams();
|
|
266
|
-
}
|
|
267
|
-
#transformParam(raw) {
|
|
268
|
-
const param = isValidVarName(raw) ? raw : camelCase(raw);
|
|
269
|
-
return this.#options.casing === "camelcase" ? camelCase(param) : param;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
|
|
223
|
+
* Url.toObject('/pet/{petId}')
|
|
224
|
+
* // { url: '/pet/:petId', params: { petId: 'petId' } }
|
|
273
225
|
*/
|
|
274
|
-
|
|
275
|
-
for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
|
|
276
|
-
const raw = match[1];
|
|
277
|
-
fn(raw, this.#transformParam(raw));
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
toObject({ type = "path", replacer, stringify } = {}) {
|
|
226
|
+
static toObject(path, { type = "path", replacer, stringify, casing } = {}) {
|
|
281
227
|
const object = {
|
|
282
|
-
url: type === "path" ?
|
|
283
|
-
|
|
228
|
+
url: type === "path" ? Url.toPath(path) : Url.toTemplateString(path, {
|
|
229
|
+
replacer,
|
|
230
|
+
casing
|
|
231
|
+
}),
|
|
232
|
+
params: toParamsObject(path, {
|
|
233
|
+
replacer,
|
|
234
|
+
casing
|
|
235
|
+
})
|
|
284
236
|
};
|
|
285
237
|
if (stringify) {
|
|
286
238
|
if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
|
|
@@ -289,64 +241,153 @@ var URLPath = class {
|
|
|
289
241
|
}
|
|
290
242
|
return object;
|
|
291
243
|
}
|
|
292
|
-
/**
|
|
293
|
-
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
294
|
-
* An optional `replacer` can transform each extracted parameter name before interpolation.
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
|
|
298
|
-
*/
|
|
299
|
-
toTemplateString({ prefix = "", replacer } = {}) {
|
|
300
|
-
return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
|
|
301
|
-
if (i % 2 === 0) return part;
|
|
302
|
-
const param = this.#transformParam(part);
|
|
303
|
-
return `\${${replacer ? replacer(param) : param}}`;
|
|
304
|
-
}).join("")}\``;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Extracts all `{param}` segments from the path and returns them as a key-value map.
|
|
308
|
-
* An optional `replacer` transforms each parameter name in both key and value positions.
|
|
309
|
-
* Returns `undefined` when no path parameters are found.
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
* ```ts
|
|
313
|
-
* new URLPath('/pet/{petId}/tag/{tagId}').getParams()
|
|
314
|
-
* // { petId: 'petId', tagId: 'tagId' }
|
|
315
|
-
* ```
|
|
316
|
-
*/
|
|
317
|
-
getParams(replacer) {
|
|
318
|
-
const params = {};
|
|
319
|
-
this.#eachParam((_raw, param) => {
|
|
320
|
-
const key = replacer ? replacer(param) : param;
|
|
321
|
-
params[key] = key;
|
|
322
|
-
});
|
|
323
|
-
return Object.keys(params).length > 0 ? params : void 0;
|
|
324
|
-
}
|
|
325
|
-
/** Converts the OpenAPI path to Express-style colon syntax.
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
* ```ts
|
|
329
|
-
* new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
|
|
330
|
-
* ```
|
|
331
|
-
*/
|
|
332
|
-
toURLPath() {
|
|
333
|
-
return this.path.replace(/\{([^}]+)\}/g, ":$1");
|
|
334
|
-
}
|
|
335
244
|
};
|
|
336
245
|
//#endregion
|
|
337
|
-
//#region ../../internals/
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
246
|
+
//#region ../../internals/shared/src/operation.ts
|
|
247
|
+
/**
|
|
248
|
+
* Builds the `ResolverFileParams` every operation generator passes to
|
|
249
|
+
* `resolver.resolveFile`: a file named `name`, tagged by the operation's first
|
|
250
|
+
* tag (or `'default'`), at the operation's path. Centralizes the entry object
|
|
251
|
+
* that was repeated at dozens of call sites across the client and query plugins.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group })
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
function operationFileEntry(node, name, extname = ".ts") {
|
|
259
|
+
return {
|
|
260
|
+
name,
|
|
261
|
+
extname,
|
|
262
|
+
tag: node.tags[0] ?? "default",
|
|
263
|
+
path: node.path
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function getOperationLink(node, link) {
|
|
267
|
+
if (!link) return null;
|
|
268
|
+
if (typeof link === "function") return link(node) ?? null;
|
|
269
|
+
if (link === "urlPath") return node.path ? `{@link ${Url.toPath(node.path)}}` : null;
|
|
270
|
+
return node.path ? `{@link ${node.path.replaceAll("{", ":").replaceAll("}", "")}}` : null;
|
|
271
|
+
}
|
|
272
|
+
function getContentTypeInfo(node) {
|
|
273
|
+
const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? [];
|
|
274
|
+
const isMultipleContentTypes = contentTypes.length > 1;
|
|
275
|
+
return {
|
|
276
|
+
contentTypes,
|
|
277
|
+
isMultipleContentTypes,
|
|
278
|
+
contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(" | ") : "",
|
|
279
|
+
defaultContentType: contentTypes[0] ?? "application/json",
|
|
280
|
+
hasFormData: contentTypes.some((ct) => ct === "multipart/form-data")
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function buildRequestConfigType(node, resolver) {
|
|
284
|
+
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
285
|
+
const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node);
|
|
286
|
+
return `${requestName ? `Partial<RequestConfig<${requestName}>>` : "Partial<RequestConfig>"} & { ${["client?: Client", isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join("; ")} }`;
|
|
287
|
+
}
|
|
288
|
+
function buildOperationComments(node, options = {}) {
|
|
289
|
+
const { link = "pathTemplate", linkPosition = "afterDeprecated", splitLines = false } = options;
|
|
290
|
+
const linkComment = getOperationLink(node, link);
|
|
291
|
+
const filteredComments = (linkPosition === "beforeDeprecated" ? [
|
|
292
|
+
node.description && `@description ${node.description}`,
|
|
293
|
+
node.summary && `@summary ${node.summary}`,
|
|
294
|
+
linkComment,
|
|
295
|
+
node.deprecated && "@deprecated"
|
|
296
|
+
] : [
|
|
297
|
+
node.description && `@description ${node.description}`,
|
|
298
|
+
node.summary && `@summary ${node.summary}`,
|
|
299
|
+
node.deprecated && "@deprecated",
|
|
300
|
+
linkComment
|
|
301
|
+
]).filter((comment) => Boolean(comment));
|
|
302
|
+
if (!splitLines) return filteredComments;
|
|
303
|
+
return filteredComments.flatMap((text) => text.split(/\r?\n/).map((line) => line.trim())).filter((comment) => Boolean(comment));
|
|
304
|
+
}
|
|
305
|
+
function getOperationParameters(node, options = {}) {
|
|
306
|
+
const params = _kubb_core.ast.caseParams(node.parameters, options.paramsCasing);
|
|
307
|
+
return {
|
|
308
|
+
path: params.filter((param) => param.in === "path"),
|
|
309
|
+
query: params.filter((param) => param.in === "query"),
|
|
310
|
+
header: params.filter((param) => param.in === "header"),
|
|
311
|
+
cookie: params.filter((param) => param.in === "cookie")
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function getStatusCodeNumber(statusCode) {
|
|
315
|
+
const code = Number(statusCode);
|
|
316
|
+
return Number.isNaN(code) ? null : code;
|
|
317
|
+
}
|
|
318
|
+
function isSuccessStatusCode(statusCode) {
|
|
319
|
+
const code = getStatusCodeNumber(statusCode);
|
|
320
|
+
return code !== null && code >= 200 && code < 300;
|
|
341
321
|
}
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
return
|
|
345
|
-
}
|
|
346
|
-
function
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
322
|
+
function isErrorStatusCode(statusCode) {
|
|
323
|
+
const code = getStatusCodeNumber(statusCode);
|
|
324
|
+
return code !== null && code >= 400;
|
|
325
|
+
}
|
|
326
|
+
function resolveErrorNames(node, resolver) {
|
|
327
|
+
return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
|
|
328
|
+
}
|
|
329
|
+
function resolveSuccessNames(node, resolver) {
|
|
330
|
+
return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
|
|
331
|
+
}
|
|
332
|
+
function resolveStatusCodeNames(node, resolver) {
|
|
333
|
+
return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.
|
|
337
|
+
* Each member is `{ status: N; data: StatusNType; statusText: string }`.
|
|
338
|
+
*/
|
|
339
|
+
function buildStatusUnionType(node, resolver) {
|
|
340
|
+
const members = node.responses.map((r) => {
|
|
341
|
+
const typeName = resolver.resolveResponseStatusName(node, r.statusCode);
|
|
342
|
+
const statusCode = Number.parseInt(r.statusCode, 10);
|
|
343
|
+
return `{ status: ${Number.isNaN(statusCode) ? "number" : String(statusCode)}; data: ${typeName}; statusText: string }`;
|
|
344
|
+
});
|
|
345
|
+
if (members.length === 1) return members[0];
|
|
346
|
+
return `(${members.join(" | ")})`;
|
|
347
|
+
}
|
|
348
|
+
const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
|
|
349
|
+
function resolveOperationTypeNames(node, resolver, options = {}) {
|
|
350
|
+
const cacheKey = `${node.operationId}\0${options.paramsCasing ?? ""}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${(options.exclude ?? []).join(",")}`;
|
|
351
|
+
let byResolver = typeNamesByResolver.get(resolver);
|
|
352
|
+
if (byResolver) {
|
|
353
|
+
const cached = byResolver.get(cacheKey);
|
|
354
|
+
if (cached) return cached;
|
|
355
|
+
} else {
|
|
356
|
+
byResolver = /* @__PURE__ */ new Map();
|
|
357
|
+
typeNamesByResolver.set(resolver, byResolver);
|
|
358
|
+
}
|
|
359
|
+
const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing });
|
|
360
|
+
const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
|
|
361
|
+
const exclude = new Set(options.exclude ?? []);
|
|
362
|
+
const paramNames = [
|
|
363
|
+
...path.map((param) => resolver.resolvePathParamsName(node, param)),
|
|
364
|
+
...query.map((param) => resolver.resolveQueryParamsName(node, param)),
|
|
365
|
+
...header.map((param) => resolver.resolveHeaderParamsName(node, param))
|
|
366
|
+
];
|
|
367
|
+
const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(node)];
|
|
368
|
+
const result = (options.order === "body-response-first" ? [
|
|
369
|
+
...bodyAndResponseNames,
|
|
370
|
+
...paramNames,
|
|
371
|
+
...responseStatusNames
|
|
372
|
+
] : [
|
|
373
|
+
...paramNames,
|
|
374
|
+
...bodyAndResponseNames,
|
|
375
|
+
...responseStatusNames
|
|
376
|
+
]).filter((name) => Boolean(name) && !exclude.has(name));
|
|
377
|
+
byResolver.set(cacheKey, result);
|
|
378
|
+
return result;
|
|
379
|
+
}
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
382
|
+
const declarationPrinter$7 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
383
|
+
const mutationKeyTransformer = ({ node }) => {
|
|
384
|
+
if (!node.path) return [];
|
|
385
|
+
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
386
|
+
};
|
|
387
|
+
function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
388
|
+
const paramsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
|
|
389
|
+
const paramsSignature = declarationPrinter$7.print(paramsNode) ?? "";
|
|
390
|
+
const keys = (transformer ?? mutationKeyTransformer)({
|
|
350
391
|
node,
|
|
351
392
|
casing: paramsCasing
|
|
352
393
|
});
|
|
@@ -363,28 +404,76 @@ function MutationKey({ name, paramsCasing, node, transformer = getTransformer$1
|
|
|
363
404
|
})
|
|
364
405
|
});
|
|
365
406
|
}
|
|
366
|
-
MutationKey.getParams = getParams$4;
|
|
367
|
-
MutationKey.getTransformer = getTransformer$1;
|
|
368
407
|
//#endregion
|
|
369
408
|
//#region ../../internals/tanstack-query/src/utils.ts
|
|
370
409
|
/**
|
|
371
|
-
*
|
|
410
|
+
* Builds the shared `(…params, config = {})` parameter list for a TanStack
|
|
411
|
+
* query-options function. The trailing `config` parameter is typed as a partial
|
|
412
|
+
* `RequestConfig` with an optional `client`. Framework plugins wrap the result
|
|
413
|
+
* when needed, for example vue-query applies `MaybeRefOrGetter`.
|
|
372
414
|
*/
|
|
373
|
-
function
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
415
|
+
function buildQueryOptionsParams(node, options) {
|
|
416
|
+
const { paramsType, paramsCasing, pathParamsType, resolver } = options;
|
|
417
|
+
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
|
|
418
|
+
return _kubb_core.ast.createOperationParams(node, {
|
|
419
|
+
paramsType,
|
|
420
|
+
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
421
|
+
paramsCasing,
|
|
422
|
+
resolver,
|
|
423
|
+
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
424
|
+
name: "config",
|
|
425
|
+
type: _kubb_core.ast.createParamsType({
|
|
426
|
+
variant: "reference",
|
|
427
|
+
name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
|
|
428
|
+
}),
|
|
429
|
+
default: "{}"
|
|
430
|
+
})]
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Returns `'zod'` when response-direction parsing is enabled.
|
|
435
|
+
* The string shorthand `'zod'` also enables response parsing.
|
|
436
|
+
*/
|
|
437
|
+
function resolveResponseParser(parser) {
|
|
438
|
+
if (!parser) return null;
|
|
439
|
+
if (parser === "zod") return "zod";
|
|
440
|
+
return parser.response ?? null;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Returns `'zod'` when request body parsing is enabled.
|
|
444
|
+
* The string shorthand `'zod'` also enables request body parsing (existing behavior).
|
|
445
|
+
*/
|
|
446
|
+
function resolveRequestParser(parser) {
|
|
447
|
+
if (!parser) return null;
|
|
448
|
+
if (parser === "zod") return "zod";
|
|
449
|
+
return parser.request ?? null;
|
|
380
450
|
}
|
|
381
451
|
/**
|
|
382
|
-
*
|
|
452
|
+
* Returns `'zod'` when query-params parsing is enabled.
|
|
453
|
+
* Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.
|
|
383
454
|
*/
|
|
384
|
-
function
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
455
|
+
function resolveQueryParamsParser(parser) {
|
|
456
|
+
if (!parser || parser === "zod") return null;
|
|
457
|
+
return parser.request ?? null;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Collects the Zod schema import names for an operation based on the active parser directions.
|
|
461
|
+
*
|
|
462
|
+
* - `parser: 'zod'`: response and request body names (backward-compatible behavior).
|
|
463
|
+
* - `parser: { request: 'zod' }`: request body and query params names.
|
|
464
|
+
* - `parser: { response: 'zod' }`: response name only.
|
|
465
|
+
* - `parser: { request: 'zod', response: 'zod' }`: all three.
|
|
466
|
+
*
|
|
467
|
+
* Returns an empty array when no resolver is provided or `parser` is falsy.
|
|
468
|
+
*/
|
|
469
|
+
function resolveZodSchemaNames(node, zodResolver, parser) {
|
|
470
|
+
if (!zodResolver || !parser) return [];
|
|
471
|
+
const { query: queryParams } = getOperationParameters(node);
|
|
472
|
+
return [
|
|
473
|
+
resolveResponseParser(parser) === "zod" ? zodResolver.resolveResponseName?.(node) : null,
|
|
474
|
+
resolveRequestParser(parser) === "zod" && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,
|
|
475
|
+
resolveQueryParamsParser(parser) === "zod" && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]) : null
|
|
476
|
+
].filter((n) => Boolean(n));
|
|
388
477
|
}
|
|
389
478
|
/**
|
|
390
479
|
* Resolve the type for a single path parameter.
|
|
@@ -408,30 +497,14 @@ function resolvePathParamType(node, param, resolver) {
|
|
|
408
497
|
}
|
|
409
498
|
/**
|
|
410
499
|
* Derive a query-params group type from the resolver.
|
|
411
|
-
* Returns `
|
|
500
|
+
* Returns `null` when no query params exist or when the group name
|
|
412
501
|
* equals the individual param name (no real group).
|
|
413
502
|
*/
|
|
414
503
|
function resolveQueryGroupType(node, params, resolver) {
|
|
415
|
-
if (!params.length) return
|
|
504
|
+
if (!params.length) return null;
|
|
416
505
|
const firstParam = params[0];
|
|
417
506
|
const groupName = resolver.resolveQueryParamsName(node, firstParam);
|
|
418
|
-
if (groupName === resolver.resolveParamName(node, firstParam)) return
|
|
419
|
-
return {
|
|
420
|
-
type: _kubb_core.ast.createParamsType({
|
|
421
|
-
variant: "reference",
|
|
422
|
-
name: groupName
|
|
423
|
-
}),
|
|
424
|
-
optional: params.every((p) => !p.required)
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Derive a header-params group type from the resolver.
|
|
429
|
-
*/
|
|
430
|
-
function resolveHeaderGroupType(node, params, resolver) {
|
|
431
|
-
if (!params.length) return void 0;
|
|
432
|
-
const firstParam = params[0];
|
|
433
|
-
const groupName = resolver.resolveHeaderParamsName(node, firstParam);
|
|
434
|
-
if (groupName === resolver.resolveParamName(node, firstParam)) return void 0;
|
|
507
|
+
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
435
508
|
return {
|
|
436
509
|
type: _kubb_core.ast.createParamsType({
|
|
437
510
|
variant: "reference",
|
|
@@ -481,7 +554,7 @@ function buildQueryKeyParams(node, options) {
|
|
|
481
554
|
const bodyType = node.requestBody?.content?.[0]?.schema ? _kubb_core.ast.createParamsType({
|
|
482
555
|
variant: "reference",
|
|
483
556
|
name: resolver.resolveDataName(node)
|
|
484
|
-
}) :
|
|
557
|
+
}) : null;
|
|
485
558
|
const bodyRequired = node.requestBody?.required ?? false;
|
|
486
559
|
const params = [];
|
|
487
560
|
if (pathParams.length) {
|
|
@@ -506,47 +579,84 @@ function buildQueryKeyParams(node, options) {
|
|
|
506
579
|
return _kubb_core.ast.createFunctionParameters({ params });
|
|
507
580
|
}
|
|
508
581
|
/**
|
|
509
|
-
*
|
|
510
|
-
*
|
|
582
|
+
* Collect the names of the required params (no default) that drive the `enabled`
|
|
583
|
+
* guard. These are exactly the params that should be made optional in the
|
|
584
|
+
* generated signatures so callers can pass `undefined` to reach the disabled state.
|
|
511
585
|
*/
|
|
512
|
-
function
|
|
513
|
-
const
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
586
|
+
function getEnabledParamNames(paramsNode) {
|
|
587
|
+
const required = [];
|
|
588
|
+
for (const param of paramsNode.params) if ("kind" in param && param.kind === "ParameterGroup") {
|
|
589
|
+
const group = param;
|
|
590
|
+
for (const child of group.properties) if (!child.optional && child.default === void 0) required.push(child.name);
|
|
591
|
+
} else {
|
|
592
|
+
const fp = param;
|
|
593
|
+
if (!fp.optional && fp.default === void 0) required.push(fp.name);
|
|
594
|
+
}
|
|
595
|
+
return required;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Return a copy of `paramsNode` with the named params marked optional.
|
|
599
|
+
*
|
|
600
|
+
* Used to align signatures with the `enabled` guard: the guard already disables
|
|
601
|
+
* the query while a param is falsy, so the param should accept `undefined`. The
|
|
602
|
+
* change is type-only — the `queryFn` keeps calling the client with a non-null
|
|
603
|
+
* assertion (see `injectNonNullAssertions`), so the emitted runtime is unchanged.
|
|
604
|
+
*/
|
|
605
|
+
function markParamsOptional(paramsNode, names) {
|
|
606
|
+
if (names.length === 0) return paramsNode;
|
|
607
|
+
const nameSet = new Set(names);
|
|
608
|
+
const params = paramsNode.params.map((param) => {
|
|
609
|
+
if ("kind" in param && param.kind === "ParameterGroup") {
|
|
610
|
+
const group = param;
|
|
611
|
+
return {
|
|
612
|
+
...group,
|
|
613
|
+
properties: group.properties.map((child) => nameSet.has(child.name) ? _kubb_core.ast.createFunctionParameter({
|
|
614
|
+
name: child.name,
|
|
615
|
+
type: child.type,
|
|
616
|
+
rest: child.rest,
|
|
617
|
+
optional: true
|
|
618
|
+
}) : child)
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
const fp = param;
|
|
622
|
+
return nameSet.has(fp.name) ? _kubb_core.ast.createFunctionParameter({
|
|
623
|
+
name: fp.name,
|
|
624
|
+
type: fp.type,
|
|
625
|
+
rest: fp.rest,
|
|
626
|
+
optional: true
|
|
627
|
+
}) : fp;
|
|
628
|
+
});
|
|
538
629
|
return _kubb_core.ast.createFunctionParameters({ params });
|
|
539
630
|
}
|
|
631
|
+
(0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
632
|
+
const queryKeyTransformer = ({ node, casing }) => {
|
|
633
|
+
if (!node.path) return [];
|
|
634
|
+
const hasQueryParams = getOperationParameters(node).query.length > 0;
|
|
635
|
+
const hasRequestBody = !!node.requestBody?.content?.[0]?.schema;
|
|
636
|
+
return [
|
|
637
|
+
Url.toObject(node.path, {
|
|
638
|
+
type: "path",
|
|
639
|
+
stringify: true,
|
|
640
|
+
casing
|
|
641
|
+
}),
|
|
642
|
+
hasQueryParams ? "...(params ? [params] : [])" : null,
|
|
643
|
+
hasRequestBody ? "...(data ? [data] : [])" : null
|
|
644
|
+
].filter(Boolean);
|
|
645
|
+
};
|
|
540
646
|
//#endregion
|
|
541
647
|
//#region src/utils.ts
|
|
542
|
-
function
|
|
543
|
-
|
|
648
|
+
function printType(typeNode) {
|
|
649
|
+
if (!typeNode) return "unknown";
|
|
650
|
+
if (typeNode.variant === "reference") return typeNode.name;
|
|
651
|
+
if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
|
|
652
|
+
if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
|
|
653
|
+
const typeStr = printType(p.type);
|
|
654
|
+
const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
|
|
655
|
+
return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
|
|
656
|
+
}).join("; ")} }`;
|
|
657
|
+
return "unknown";
|
|
544
658
|
}
|
|
545
|
-
|
|
546
|
-
//#region src/components/QueryKey.tsx
|
|
547
|
-
const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
548
|
-
const callPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
549
|
-
function wrapWithMaybeRefOrGetter(paramsNode) {
|
|
659
|
+
function wrapWithMaybeRefOrGetter(paramsNode, skip) {
|
|
550
660
|
const wrappedParams = paramsNode.params.map((param) => {
|
|
551
661
|
if ("kind" in param && param.kind === "ParameterGroup") {
|
|
552
662
|
const group = param;
|
|
@@ -556,59 +666,38 @@ function wrapWithMaybeRefOrGetter(paramsNode) {
|
|
|
556
666
|
...p,
|
|
557
667
|
type: p.type ? _kubb_core.ast.createParamsType({
|
|
558
668
|
variant: "reference",
|
|
559
|
-
name: `MaybeRefOrGetter<${printType
|
|
669
|
+
name: `MaybeRefOrGetter<${printType(p.type)}>`
|
|
560
670
|
}) : p.type
|
|
561
671
|
}))
|
|
562
672
|
};
|
|
563
673
|
}
|
|
564
674
|
const fp = param;
|
|
675
|
+
if (skip?.(fp.name)) return fp;
|
|
565
676
|
return {
|
|
566
677
|
...fp,
|
|
567
678
|
type: fp.type ? _kubb_core.ast.createParamsType({
|
|
568
679
|
variant: "reference",
|
|
569
|
-
name: `MaybeRefOrGetter<${printType
|
|
680
|
+
name: `MaybeRefOrGetter<${printType(fp.type)}>`
|
|
570
681
|
}) : fp.type
|
|
571
682
|
};
|
|
572
683
|
});
|
|
573
684
|
return _kubb_core.ast.createFunctionParameters({ params: wrappedParams });
|
|
574
685
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
|
|
580
|
-
const typeStr = printType$4(p.type);
|
|
581
|
-
const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
|
|
582
|
-
return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
|
|
583
|
-
}).join("; ")} }`;
|
|
584
|
-
return "unknown";
|
|
585
|
-
}
|
|
586
|
-
__name(printType$4, "printType");
|
|
587
|
-
function getParams$3(node, options) {
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/components/QueryKey.tsx
|
|
688
|
+
const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
689
|
+
function buildQueryKeyParamsNode(node, options) {
|
|
588
690
|
return wrapWithMaybeRefOrGetter(buildQueryKeyParams(node, options));
|
|
589
691
|
}
|
|
590
|
-
|
|
591
|
-
const
|
|
592
|
-
const path = new URLPath(node.path, { casing });
|
|
593
|
-
const hasQueryParams = node.parameters.some((p) => p.in === "query");
|
|
594
|
-
const hasRequestBody = !!node.requestBody?.content?.[0]?.schema;
|
|
595
|
-
return [
|
|
596
|
-
path.toObject({
|
|
597
|
-
type: "path",
|
|
598
|
-
stringify: true
|
|
599
|
-
}),
|
|
600
|
-
hasQueryParams ? "...(params ? [params] : [])" : void 0,
|
|
601
|
-
hasRequestBody ? "...(data ? [data] : [])" : void 0
|
|
602
|
-
].filter(Boolean);
|
|
603
|
-
};
|
|
604
|
-
function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeName, transformer = getTransformer }) {
|
|
605
|
-
const paramsNode = getParams$3(node, {
|
|
692
|
+
function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeName, transformer }) {
|
|
693
|
+
const baseParamsNode = buildQueryKeyParamsNode(node, {
|
|
606
694
|
pathParamsType,
|
|
607
695
|
paramsCasing,
|
|
608
696
|
resolver: tsResolver
|
|
609
697
|
});
|
|
698
|
+
const paramsNode = markParamsOptional(baseParamsNode, getEnabledParamNames(baseParamsNode));
|
|
610
699
|
const paramsSignature = declarationPrinter$5.print(paramsNode) ?? "";
|
|
611
|
-
const keys = transformer({
|
|
700
|
+
const keys = (transformer ?? queryKeyTransformer)({
|
|
612
701
|
node,
|
|
613
702
|
casing: paramsCasing
|
|
614
703
|
});
|
|
@@ -635,103 +724,35 @@ function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeNa
|
|
|
635
724
|
})
|
|
636
725
|
})] });
|
|
637
726
|
}
|
|
638
|
-
QueryKey.getParams = getParams$3;
|
|
639
|
-
QueryKey.getTransformer = getTransformer;
|
|
640
|
-
QueryKey.callPrinter = callPrinter$5;
|
|
641
727
|
//#endregion
|
|
642
728
|
//#region src/components/QueryOptions.tsx
|
|
643
729
|
const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
644
730
|
const callPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
645
731
|
function getQueryOptionsParams(node, options) {
|
|
646
|
-
|
|
647
|
-
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
|
|
648
|
-
return wrapOperationParamsWithMaybeRef$2(_kubb_core.ast.createOperationParams(node, {
|
|
649
|
-
paramsType,
|
|
650
|
-
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
651
|
-
paramsCasing,
|
|
652
|
-
resolver,
|
|
653
|
-
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
654
|
-
name: "config",
|
|
655
|
-
type: _kubb_core.ast.createParamsType({
|
|
656
|
-
variant: "reference",
|
|
657
|
-
name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
|
|
658
|
-
}),
|
|
659
|
-
default: "{}"
|
|
660
|
-
})]
|
|
661
|
-
}));
|
|
662
|
-
}
|
|
663
|
-
function wrapOperationParamsWithMaybeRef$2(paramsNode) {
|
|
664
|
-
const wrappedParams = paramsNode.params.map((param) => {
|
|
665
|
-
if ("kind" in param && param.kind === "ParameterGroup") {
|
|
666
|
-
const group = param;
|
|
667
|
-
return {
|
|
668
|
-
...group,
|
|
669
|
-
properties: group.properties.map((p) => ({
|
|
670
|
-
...p,
|
|
671
|
-
type: p.type ? _kubb_core.ast.createParamsType({
|
|
672
|
-
variant: "reference",
|
|
673
|
-
name: `MaybeRefOrGetter<${printType$3(p.type)}>`
|
|
674
|
-
}) : p.type
|
|
675
|
-
}))
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
const fp = param;
|
|
679
|
-
if (fp.name === "config") return fp;
|
|
680
|
-
return {
|
|
681
|
-
...fp,
|
|
682
|
-
type: fp.type ? _kubb_core.ast.createParamsType({
|
|
683
|
-
variant: "reference",
|
|
684
|
-
name: `MaybeRefOrGetter<${printType$3(fp.type)}>`
|
|
685
|
-
}) : fp.type
|
|
686
|
-
};
|
|
687
|
-
});
|
|
688
|
-
return _kubb_core.ast.createFunctionParameters({ params: wrappedParams });
|
|
689
|
-
}
|
|
690
|
-
__name(wrapOperationParamsWithMaybeRef$2, "wrapOperationParamsWithMaybeRef");
|
|
691
|
-
function printType$3(typeNode) {
|
|
692
|
-
if (!typeNode) return "unknown";
|
|
693
|
-
if (typeNode.variant === "reference") return typeNode.name;
|
|
694
|
-
if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
|
|
695
|
-
if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
|
|
696
|
-
const typeStr = printType$3(p.type);
|
|
697
|
-
const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
|
|
698
|
-
return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
|
|
699
|
-
}).join("; ")} }`;
|
|
700
|
-
return "unknown";
|
|
701
|
-
}
|
|
702
|
-
__name(printType$3, "printType");
|
|
703
|
-
function buildEnabledCheck(paramsNode) {
|
|
704
|
-
const required = [];
|
|
705
|
-
for (const param of paramsNode.params) if ("kind" in param && param.kind === "ParameterGroup") {
|
|
706
|
-
const group = param;
|
|
707
|
-
for (const child of group.properties) if (!child.optional && child.default === void 0) required.push(child.name);
|
|
708
|
-
} else {
|
|
709
|
-
const fp = param;
|
|
710
|
-
if (!fp.optional && fp.default === void 0) required.push(fp.name);
|
|
711
|
-
}
|
|
712
|
-
return required.join(" && ");
|
|
732
|
+
return wrapWithMaybeRefOrGetter(buildQueryOptionsParams(node, options), (name) => name === "config");
|
|
713
733
|
}
|
|
714
734
|
function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
|
|
715
|
-
const
|
|
735
|
+
const successNames = resolveSuccessNames(node, tsResolver);
|
|
736
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
|
|
716
737
|
const errorNames = resolveErrorNames(node, tsResolver);
|
|
717
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
738
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
|
|
718
739
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
719
|
-
const
|
|
740
|
+
const queryKeyParamsNode = buildQueryKeyParamsNode(node, {
|
|
741
|
+
pathParamsType,
|
|
742
|
+
paramsCasing,
|
|
743
|
+
resolver: tsResolver
|
|
744
|
+
});
|
|
745
|
+
const queryKeyParamsCall = callPrinter$4.print(queryKeyParamsNode) ?? "";
|
|
746
|
+
const enabledNames = getEnabledParamNames(queryKeyParamsNode);
|
|
747
|
+
const enabledText = enabledNames.length ? `enabled: () => ${enabledNames.map((n) => `!!toValue(${n})`).join(" && ")},` : "";
|
|
748
|
+
const paramsNode = markParamsOptional(getQueryOptionsParams(node, {
|
|
720
749
|
paramsType,
|
|
721
750
|
paramsCasing,
|
|
722
751
|
pathParamsType,
|
|
723
752
|
resolver: tsResolver
|
|
724
|
-
});
|
|
753
|
+
}), enabledNames);
|
|
725
754
|
const paramsSignature = declarationPrinter$4.print(paramsNode) ?? "";
|
|
726
755
|
const clientCallStr = (callPrinter$4.print(paramsNode) ?? "").replace(/\bconfig\b(?=[^,]*$)/, "{ ...config, signal: config.signal ?? signal }");
|
|
727
|
-
const queryKeyParamsNode = QueryKey.getParams(node, {
|
|
728
|
-
pathParamsType,
|
|
729
|
-
paramsCasing,
|
|
730
|
-
resolver: tsResolver
|
|
731
|
-
});
|
|
732
|
-
const queryKeyParamsCall = callPrinter$4.print(queryKeyParamsNode) ?? "";
|
|
733
|
-
const enabledSource = buildEnabledCheck(queryKeyParamsNode);
|
|
734
|
-
const enabledText = enabledSource ? `enabled: () => !!(${enabledSource}),` : "";
|
|
735
756
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
736
757
|
name,
|
|
737
758
|
isExportable: true,
|
|
@@ -742,11 +763,10 @@ function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, para
|
|
|
742
763
|
params: paramsSignature,
|
|
743
764
|
children: `
|
|
744
765
|
const queryKey = ${queryKeyName}(${queryKeyParamsCall})
|
|
745
|
-
return queryOptions<${TData}, ${TError}, ${TData}>({
|
|
746
|
-
${enabledText}
|
|
766
|
+
return queryOptions<${TData}, ${TError}, ${TData}>({${enabledText ? `\n ${enabledText}` : ""}
|
|
747
767
|
queryKey,
|
|
748
768
|
queryFn: async ({ signal }) => {
|
|
749
|
-
return ${clientName}(${addToValueCalls$1(clientCallStr)})
|
|
769
|
+
return ${clientName}(${addToValueCalls$1(clientCallStr, enabledNames)})
|
|
750
770
|
},
|
|
751
771
|
})
|
|
752
772
|
`
|
|
@@ -760,30 +780,31 @@ function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, para
|
|
|
760
780
|
* Handles both inline params (`petId, config`) and object shorthand
|
|
761
781
|
* params (`{ petId }, config`) by expanding to `{ petId: toValue(petId) }`.
|
|
762
782
|
*/
|
|
763
|
-
function addToValueCalls$1(callStr) {
|
|
783
|
+
function addToValueCalls$1(callStr, enabledNames = []) {
|
|
784
|
+
const optional = new Set(enabledNames);
|
|
764
785
|
let result = callStr.replace(/\{\s*([\w,\s]+)\s*\}(?=\s*,)/g, (match, inner) => {
|
|
765
786
|
if (inner.includes(":") || inner.includes("...")) return match;
|
|
766
|
-
return `{ ${inner.split(",").map((k) => k.trim()).filter(Boolean).map((k) => `${k}: toValue(${k})`).join(", ")} }`;
|
|
787
|
+
return `{ ${inner.split(",").map((k) => k.trim()).filter(Boolean).map((k) => `${k}: toValue(${optional.has(k) ? `${k}!` : k})`).join(", ")} }`;
|
|
767
788
|
});
|
|
768
789
|
result = result.replace(/(?<![{.:?])\b(\w+)\b(?=\s*,)/g, (match, name) => {
|
|
769
790
|
if (name === "config" || name === "signal" || name === "undefined") return match;
|
|
770
791
|
if (match.includes("toValue(")) return match;
|
|
771
|
-
return `toValue(${name})`;
|
|
792
|
+
return `toValue(${optional.has(name) ? `${name}!` : name})`;
|
|
772
793
|
});
|
|
773
794
|
return result;
|
|
774
795
|
}
|
|
775
796
|
__name(addToValueCalls$1, "addToValueCalls");
|
|
776
|
-
QueryOptions.getParams = getQueryOptionsParams;
|
|
777
797
|
//#endregion
|
|
778
798
|
//#region src/components/InfiniteQuery.tsx
|
|
779
799
|
const declarationPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
780
800
|
const callPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
781
|
-
function
|
|
801
|
+
function buildInfiniteQueryParamsNode(node, options) {
|
|
782
802
|
const { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver } = options;
|
|
783
|
-
const
|
|
784
|
-
const
|
|
803
|
+
const successNames = resolveSuccessNames(node, resolver);
|
|
804
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
|
|
805
|
+
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
785
806
|
const errorNames = resolveErrorNames(node, resolver);
|
|
786
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
807
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
787
808
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
788
809
|
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
789
810
|
name: "options",
|
|
@@ -802,59 +823,19 @@ function getParams$2(node, options) {
|
|
|
802
823
|
}),
|
|
803
824
|
default: "{}"
|
|
804
825
|
});
|
|
805
|
-
return
|
|
826
|
+
return wrapWithMaybeRefOrGetter(_kubb_core.ast.createOperationParams(node, {
|
|
806
827
|
paramsType,
|
|
807
828
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
808
829
|
paramsCasing,
|
|
809
830
|
resolver,
|
|
810
831
|
extraParams: [optionsParam]
|
|
811
|
-
}));
|
|
812
|
-
}
|
|
813
|
-
__name(getParams$2, "getParams");
|
|
814
|
-
function wrapOperationParamsWithMaybeRef$1(paramsNode) {
|
|
815
|
-
const wrappedParams = paramsNode.params.map((param) => {
|
|
816
|
-
if ("kind" in param && param.kind === "ParameterGroup") {
|
|
817
|
-
const group = param;
|
|
818
|
-
return {
|
|
819
|
-
...group,
|
|
820
|
-
properties: group.properties.map((p) => ({
|
|
821
|
-
...p,
|
|
822
|
-
type: p.type ? _kubb_core.ast.createParamsType({
|
|
823
|
-
variant: "reference",
|
|
824
|
-
name: `MaybeRefOrGetter<${printType$2(p.type)}>`
|
|
825
|
-
}) : p.type
|
|
826
|
-
}))
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
const fp = param;
|
|
830
|
-
if (fp.name === "options") return fp;
|
|
831
|
-
return {
|
|
832
|
-
...fp,
|
|
833
|
-
type: fp.type ? _kubb_core.ast.createParamsType({
|
|
834
|
-
variant: "reference",
|
|
835
|
-
name: `MaybeRefOrGetter<${printType$2(fp.type)}>`
|
|
836
|
-
}) : fp.type
|
|
837
|
-
};
|
|
838
|
-
});
|
|
839
|
-
return _kubb_core.ast.createFunctionParameters({ params: wrappedParams });
|
|
832
|
+
}), (name) => name === "options");
|
|
840
833
|
}
|
|
841
|
-
__name(wrapOperationParamsWithMaybeRef$1, "wrapOperationParamsWithMaybeRef");
|
|
842
|
-
function printType$2(typeNode) {
|
|
843
|
-
if (!typeNode) return "unknown";
|
|
844
|
-
if (typeNode.variant === "reference") return typeNode.name;
|
|
845
|
-
if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
|
|
846
|
-
if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
|
|
847
|
-
const typeStr = printType$2(p.type);
|
|
848
|
-
const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
|
|
849
|
-
return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
|
|
850
|
-
}).join("; ")} }`;
|
|
851
|
-
return "unknown";
|
|
852
|
-
}
|
|
853
|
-
__name(printType$2, "printType");
|
|
854
834
|
function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, paramsCasing, pathParamsType, dataReturnType, node, tsResolver }) {
|
|
855
|
-
const
|
|
835
|
+
const successNames = resolveSuccessNames(node, tsResolver);
|
|
836
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
|
|
856
837
|
const errorNames = resolveErrorNames(node, tsResolver);
|
|
857
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
838
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
|
|
858
839
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
859
840
|
const returnType = `UseInfiniteQueryReturnType<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
|
|
860
841
|
const generics = [
|
|
@@ -862,12 +843,13 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
862
843
|
`TQueryData = ${TData}`,
|
|
863
844
|
`TQueryKey extends QueryKey = ${queryKeyTypeName}`
|
|
864
845
|
];
|
|
865
|
-
const queryKeyParamsNode =
|
|
846
|
+
const queryKeyParamsNode = buildQueryKeyParamsNode(node, {
|
|
866
847
|
pathParamsType,
|
|
867
848
|
paramsCasing,
|
|
868
849
|
resolver: tsResolver
|
|
869
850
|
});
|
|
870
851
|
const queryKeyParamsCall = callPrinter$3.print(queryKeyParamsNode) ?? "";
|
|
852
|
+
const enabledNames = getEnabledParamNames(queryKeyParamsNode);
|
|
871
853
|
const queryOptionsParamsNode = getQueryOptionsParams(node, {
|
|
872
854
|
paramsType,
|
|
873
855
|
paramsCasing,
|
|
@@ -875,13 +857,13 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
875
857
|
resolver: tsResolver
|
|
876
858
|
});
|
|
877
859
|
const queryOptionsParamsCall = callPrinter$3.print(queryOptionsParamsNode) ?? "";
|
|
878
|
-
const paramsNode =
|
|
860
|
+
const paramsNode = markParamsOptional(buildInfiniteQueryParamsNode(node, {
|
|
879
861
|
paramsType,
|
|
880
862
|
paramsCasing,
|
|
881
863
|
pathParamsType,
|
|
882
864
|
dataReturnType,
|
|
883
865
|
resolver: tsResolver
|
|
884
|
-
});
|
|
866
|
+
}), enabledNames);
|
|
885
867
|
const paramsSignature = declarationPrinter$3.print(paramsNode) ?? "";
|
|
886
868
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
887
869
|
name,
|
|
@@ -892,7 +874,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
892
874
|
export: true,
|
|
893
875
|
generics: generics.join(", "),
|
|
894
876
|
params: paramsSignature,
|
|
895
|
-
JSDoc: { comments:
|
|
877
|
+
JSDoc: { comments: buildOperationComments(node) },
|
|
896
878
|
children: `
|
|
897
879
|
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
898
880
|
const { client: queryClient, ...resolvedOptions } = queryConfig
|
|
@@ -911,14 +893,14 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
911
893
|
})
|
|
912
894
|
});
|
|
913
895
|
}
|
|
914
|
-
InfiniteQuery.getParams = getParams$2;
|
|
915
896
|
//#endregion
|
|
916
897
|
//#region src/components/InfiniteQueryOptions.tsx
|
|
917
898
|
const declarationPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
918
899
|
const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
919
900
|
function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, nextParam, previousParam, node, tsResolver, paramsCasing, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName }) {
|
|
920
|
-
const
|
|
921
|
-
const
|
|
901
|
+
const successNames = resolveSuccessNames(node, tsResolver);
|
|
902
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
|
|
903
|
+
const queryFnDataType = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
|
|
922
904
|
const errorNames = resolveErrorNames(node, tsResolver);
|
|
923
905
|
const errorType = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
924
906
|
const isInitialPageParamDefined = initialPageParam !== void 0 && initialPageParam !== null;
|
|
@@ -926,59 +908,48 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
926
908
|
const parts = initialPageParam.split(" as ");
|
|
927
909
|
return parts[parts.length - 1] ?? "unknown";
|
|
928
910
|
})() : "string" : typeof initialPageParam === "boolean" ? "boolean" : "unknown";
|
|
929
|
-
const rawQueryParams = node
|
|
911
|
+
const rawQueryParams = getOperationParameters(node).query;
|
|
930
912
|
const queryParamsTypeName = rawQueryParams.length > 0 ? (() => {
|
|
931
913
|
const groupName = tsResolver.resolveQueryParamsName(node, rawQueryParams[0]);
|
|
932
|
-
return groupName !== tsResolver.resolveParamName(node, rawQueryParams[0]) ? groupName :
|
|
933
|
-
})() :
|
|
934
|
-
const queryParamType = queryParam && queryParamsTypeName ? `${queryParamsTypeName}['${queryParam}']` :
|
|
914
|
+
return groupName !== tsResolver.resolveParamName(node, rawQueryParams[0]) ? groupName : null;
|
|
915
|
+
})() : null;
|
|
916
|
+
const queryParamType = queryParam && queryParamsTypeName ? `${queryParamsTypeName}['${queryParam}']` : null;
|
|
935
917
|
const pageParamType = queryParamType ? isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType : fallbackPageParamType;
|
|
936
|
-
const
|
|
918
|
+
const queryKeyParamsNode = buildQueryKeyParamsNode(node, {
|
|
919
|
+
pathParamsType,
|
|
920
|
+
paramsCasing,
|
|
921
|
+
resolver: tsResolver
|
|
922
|
+
});
|
|
923
|
+
const queryKeyParamsCall = callPrinter$2.print(queryKeyParamsNode) ?? "";
|
|
924
|
+
const enabledNames = getEnabledParamNames(queryKeyParamsNode);
|
|
925
|
+
const enabledText = enabledNames.length ? `enabled: () => ${enabledNames.map((n) => `!!toValue(${n})`).join(" && ")},` : "";
|
|
926
|
+
const paramsNode = markParamsOptional(getQueryOptionsParams(node, {
|
|
937
927
|
paramsType,
|
|
938
928
|
paramsCasing,
|
|
939
929
|
pathParamsType,
|
|
940
930
|
resolver: tsResolver
|
|
941
|
-
});
|
|
931
|
+
}), enabledNames);
|
|
942
932
|
const paramsSignature = declarationPrinter$2.print(paramsNode) ?? "";
|
|
943
933
|
const clientCallStr = (callPrinter$2.print(paramsNode) ?? "").replace(/\bconfig\b(?=[^,]*$)/, "{ ...config, signal: config.signal ?? signal }");
|
|
944
|
-
const
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
const enabledSource = buildEnabledCheck(queryKeyParamsNode);
|
|
951
|
-
const enabledText = enabledSource ? `enabled: () => !!(${enabledSource}),` : "";
|
|
952
|
-
const hasNewParams = nextParam !== void 0 || previousParam !== void 0;
|
|
953
|
-
let getNextPageParamExpr;
|
|
954
|
-
let getPreviousPageParamExpr;
|
|
955
|
-
if (hasNewParams) {
|
|
956
|
-
if (nextParam) {
|
|
957
|
-
const accessor = getNestedAccessor(nextParam, "lastPage");
|
|
958
|
-
if (accessor) getNextPageParamExpr = `getNextPageParam: (lastPage) => ${accessor}`;
|
|
934
|
+
const hasNewParams = nextParam != null || previousParam != null;
|
|
935
|
+
const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
|
|
936
|
+
if (hasNewParams) {
|
|
937
|
+
const nextAccessor = nextParam ? (0, _kubb_ast_utils.getNestedAccessor)(nextParam, "lastPage") : null;
|
|
938
|
+
const prevAccessor = previousParam ? (0, _kubb_ast_utils.getNestedAccessor)(previousParam, "firstPage") : null;
|
|
939
|
+
return [nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : null, prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : null];
|
|
959
940
|
}
|
|
960
|
-
if (
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
}
|
|
964
|
-
} else if (cursorParam) {
|
|
965
|
-
getNextPageParamExpr = `getNextPageParam: (lastPage) => lastPage['${cursorParam}']`;
|
|
966
|
-
getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`;
|
|
967
|
-
} else {
|
|
968
|
-
if (dataReturnType === "full") getNextPageParamExpr = "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1";
|
|
969
|
-
else getNextPageParamExpr = "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1";
|
|
970
|
-
getPreviousPageParamExpr = "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1";
|
|
971
|
-
}
|
|
941
|
+
if (cursorParam) return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`];
|
|
942
|
+
return [dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" : "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1", "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1"];
|
|
943
|
+
})();
|
|
972
944
|
const queryOptionsArr = [
|
|
973
945
|
`initialPageParam: ${typeof initialPageParam === "string" ? JSON.stringify(initialPageParam) : initialPageParam}`,
|
|
974
946
|
getNextPageParamExpr,
|
|
975
947
|
getPreviousPageParamExpr
|
|
976
948
|
].filter(Boolean);
|
|
977
|
-
const infiniteOverrideParams = queryParam && queryParamsTypeName ? `
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
} as ${queryParamsTypeName}` : "";
|
|
949
|
+
const infiniteOverrideParams = queryParam && queryParamsTypeName ? `params = {
|
|
950
|
+
...(params ?? {}),
|
|
951
|
+
['${queryParam}']: pageParam as unknown as ${queryParamsTypeName}['${queryParam}'],
|
|
952
|
+
} as ${queryParamsTypeName}` : "";
|
|
982
953
|
if (infiniteOverrideParams) return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
983
954
|
name,
|
|
984
955
|
isExportable: true,
|
|
@@ -988,16 +959,15 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
988
959
|
export: true,
|
|
989
960
|
params: paramsSignature,
|
|
990
961
|
children: `
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
})
|
|
962
|
+
const queryKey = ${queryKeyName}(${queryKeyParamsCall})
|
|
963
|
+
return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({${enabledText ? `\n ${enabledText}` : ""}
|
|
964
|
+
queryKey,
|
|
965
|
+
queryFn: async ({ signal, pageParam }) => {
|
|
966
|
+
${infiniteOverrideParams}
|
|
967
|
+
return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
|
|
968
|
+
},
|
|
969
|
+
${queryOptionsArr.join(",\n ")}
|
|
970
|
+
})
|
|
1001
971
|
`
|
|
1002
972
|
})
|
|
1003
973
|
});
|
|
@@ -1010,58 +980,55 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
1010
980
|
export: true,
|
|
1011
981
|
params: paramsSignature,
|
|
1012
982
|
children: `
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
})
|
|
983
|
+
const queryKey = ${queryKeyName}(${queryKeyParamsCall})
|
|
984
|
+
return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({${enabledText ? `\n ${enabledText}` : ""}
|
|
985
|
+
queryKey,
|
|
986
|
+
queryFn: async ({ signal }) => {
|
|
987
|
+
return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
|
|
988
|
+
},
|
|
989
|
+
${queryOptionsArr.join(",\n ")}
|
|
990
|
+
})
|
|
1022
991
|
`
|
|
1023
992
|
})
|
|
1024
993
|
});
|
|
1025
994
|
}
|
|
1026
|
-
function addToValueCalls(callStr) {
|
|
995
|
+
function addToValueCalls(callStr, enabledNames = []) {
|
|
996
|
+
const optional = new Set(enabledNames);
|
|
1027
997
|
let result = callStr.replace(/\{\s*([\w,\s]+)\s*\}(?=\s*,)/g, (match, inner) => {
|
|
1028
998
|
if (inner.includes(":") || inner.includes("...")) return match;
|
|
1029
|
-
return `{ ${inner.split(",").map((k) => k.trim()).filter(Boolean).map((k) => `${k}: toValue(${k})`).join(", ")} }`;
|
|
999
|
+
return `{ ${inner.split(",").map((k) => k.trim()).filter(Boolean).map((k) => `${k}: toValue(${optional.has(k) ? `${k}!` : k})`).join(", ")} }`;
|
|
1030
1000
|
});
|
|
1031
1001
|
result = result.replace(/(?<![{.:?])\b(\w+)\b(?=\s*,)/g, (match, name) => {
|
|
1032
1002
|
if (name === "config" || name === "signal" || name === "undefined") return match;
|
|
1033
1003
|
if (match.includes("toValue(")) return match;
|
|
1034
|
-
return `toValue(${name})`;
|
|
1004
|
+
return `toValue(${optional.has(name) ? `${name}!` : name})`;
|
|
1035
1005
|
});
|
|
1036
1006
|
return result;
|
|
1037
1007
|
}
|
|
1038
|
-
InfiniteQueryOptions.getParams = (node, options) => getQueryOptionsParams(node, options);
|
|
1039
1008
|
//#endregion
|
|
1040
1009
|
//#region src/components/Mutation.tsx
|
|
1041
1010
|
const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1042
1011
|
const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1043
1012
|
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "keys" });
|
|
1044
|
-
function
|
|
1013
|
+
function createMutationArgParams(node, options) {
|
|
1014
|
+
return _kubb_core.ast.createOperationParams(node, {
|
|
1015
|
+
paramsType: "inline",
|
|
1016
|
+
pathParamsType: "inline",
|
|
1017
|
+
paramsCasing: options.paramsCasing,
|
|
1018
|
+
resolver: options.resolver
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
function buildMutationParamsNode(node, options) {
|
|
1045
1022
|
const { paramsCasing, dataReturnType, resolver } = options;
|
|
1046
|
-
const
|
|
1047
|
-
const
|
|
1023
|
+
const successNames = resolveSuccessNames(node, resolver);
|
|
1024
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
|
|
1048
1025
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1049
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
1026
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1050
1027
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1051
|
-
const
|
|
1028
|
+
const wrappedParamsNode = wrapWithMaybeRefOrGetter(createMutationArgParams(node, {
|
|
1052
1029
|
paramsCasing,
|
|
1053
1030
|
resolver
|
|
1054
|
-
})
|
|
1055
|
-
const fp = param;
|
|
1056
|
-
return {
|
|
1057
|
-
...fp,
|
|
1058
|
-
type: fp.type ? _kubb_core.ast.createParamsType({
|
|
1059
|
-
variant: "reference",
|
|
1060
|
-
name: `MaybeRefOrGetter<${printType$1(fp.type)}>`
|
|
1061
|
-
}) : fp.type
|
|
1062
|
-
};
|
|
1063
|
-
});
|
|
1064
|
-
const wrappedParamsNode = _kubb_core.ast.createFunctionParameters({ params: mutationArgWrapped });
|
|
1031
|
+
}));
|
|
1065
1032
|
const TRequestWrapped = wrappedParamsNode.params.length > 0 ? declarationPrinter$1.print(wrappedParamsNode) ?? "" : "";
|
|
1066
1033
|
return _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
|
|
1067
1034
|
name: "options",
|
|
@@ -1071,34 +1038,22 @@ function getParams$1(node, options) {
|
|
|
1071
1038
|
mutation?: MutationObserverOptions<${[
|
|
1072
1039
|
TData,
|
|
1073
1040
|
TError,
|
|
1074
|
-
TRequestWrapped ? `{${TRequestWrapped}}` : "
|
|
1041
|
+
TRequestWrapped ? `{${TRequestWrapped}}` : "undefined",
|
|
1075
1042
|
"TContext"
|
|
1076
1043
|
].join(", ")}> & { client?: QueryClient },
|
|
1077
|
-
client?: ${
|
|
1044
|
+
client?: ${buildRequestConfigType(node, resolver)},
|
|
1078
1045
|
}`
|
|
1079
1046
|
}),
|
|
1080
1047
|
default: "{}"
|
|
1081
1048
|
})] });
|
|
1082
1049
|
}
|
|
1083
|
-
__name(getParams$1, "getParams");
|
|
1084
|
-
function printType$1(typeNode) {
|
|
1085
|
-
if (!typeNode) return "unknown";
|
|
1086
|
-
if (typeNode.variant === "reference") return typeNode.name;
|
|
1087
|
-
if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
|
|
1088
|
-
if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
|
|
1089
|
-
const typeStr = printType$1(p.type);
|
|
1090
|
-
const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
|
|
1091
|
-
return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
|
|
1092
|
-
}).join("; ")} }`;
|
|
1093
|
-
return "unknown";
|
|
1094
|
-
}
|
|
1095
|
-
__name(printType$1, "printType");
|
|
1096
1050
|
function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType, dataReturnType, node, tsResolver, mutationKeyName }) {
|
|
1097
|
-
const
|
|
1051
|
+
const successNames = resolveSuccessNames(node, tsResolver);
|
|
1052
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
|
|
1098
1053
|
const errorNames = resolveErrorNames(node, tsResolver);
|
|
1099
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
1054
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
|
|
1100
1055
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1101
|
-
const mutationArgParamsNode =
|
|
1056
|
+
const mutationArgParamsNode = createMutationArgParams(node, {
|
|
1102
1057
|
paramsCasing,
|
|
1103
1058
|
resolver: tsResolver
|
|
1104
1059
|
});
|
|
@@ -1108,10 +1063,10 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
1108
1063
|
const generics = [
|
|
1109
1064
|
TData,
|
|
1110
1065
|
TError,
|
|
1111
|
-
TRequest ? `{${TRequest}}` : "
|
|
1066
|
+
TRequest ? `{${TRequest}}` : "undefined",
|
|
1112
1067
|
"TContext"
|
|
1113
1068
|
].join(", ");
|
|
1114
|
-
const mutationKeyParamsNode =
|
|
1069
|
+
const mutationKeyParamsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
|
|
1115
1070
|
const mutationKeyParamsCall = callPrinter$1.print(mutationKeyParamsNode) ?? "";
|
|
1116
1071
|
const clientCallParamsNode = _kubb_core.ast.createOperationParams(node, {
|
|
1117
1072
|
paramsType,
|
|
@@ -1122,13 +1077,13 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
1122
1077
|
name: "config",
|
|
1123
1078
|
type: _kubb_core.ast.createParamsType({
|
|
1124
1079
|
variant: "reference",
|
|
1125
|
-
name: node
|
|
1080
|
+
name: buildRequestConfigType(node, tsResolver)
|
|
1126
1081
|
}),
|
|
1127
1082
|
default: "{}"
|
|
1128
1083
|
})]
|
|
1129
1084
|
});
|
|
1130
1085
|
const clientCallStr = callPrinter$1.print(clientCallParamsNode) ?? "";
|
|
1131
|
-
const paramsNode =
|
|
1086
|
+
const paramsNode = buildMutationParamsNode(node, {
|
|
1132
1087
|
paramsCasing,
|
|
1133
1088
|
dataReturnType,
|
|
1134
1089
|
resolver: tsResolver
|
|
@@ -1142,7 +1097,7 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
1142
1097
|
name,
|
|
1143
1098
|
export: true,
|
|
1144
1099
|
params: paramsSignature,
|
|
1145
|
-
JSDoc: { comments:
|
|
1100
|
+
JSDoc: { comments: buildOperationComments(node) },
|
|
1146
1101
|
generics: ["TContext"],
|
|
1147
1102
|
children: `
|
|
1148
1103
|
const { mutation = {}, client: config = {} } = options ?? {}
|
|
@@ -1160,17 +1115,17 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
1160
1115
|
})
|
|
1161
1116
|
});
|
|
1162
1117
|
}
|
|
1163
|
-
Mutation.getParams = getParams$1;
|
|
1164
1118
|
//#endregion
|
|
1165
1119
|
//#region src/components/Query.tsx
|
|
1166
1120
|
const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1167
1121
|
const callPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1168
|
-
function
|
|
1122
|
+
function buildQueryParamsNode(node, options) {
|
|
1169
1123
|
const { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver } = options;
|
|
1170
|
-
const
|
|
1171
|
-
const
|
|
1124
|
+
const successNames = resolveSuccessNames(node, resolver);
|
|
1125
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
|
|
1126
|
+
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
1172
1127
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1173
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
1128
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1174
1129
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1175
1130
|
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
1176
1131
|
name: "options",
|
|
@@ -1189,56 +1144,19 @@ function getParams(node, options) {
|
|
|
1189
1144
|
}),
|
|
1190
1145
|
default: "{}"
|
|
1191
1146
|
});
|
|
1192
|
-
return
|
|
1147
|
+
return wrapWithMaybeRefOrGetter(_kubb_core.ast.createOperationParams(node, {
|
|
1193
1148
|
paramsType,
|
|
1194
1149
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1195
1150
|
paramsCasing,
|
|
1196
1151
|
resolver,
|
|
1197
1152
|
extraParams: [optionsParam]
|
|
1198
|
-
}));
|
|
1199
|
-
}
|
|
1200
|
-
function wrapOperationParamsWithMaybeRef(paramsNode) {
|
|
1201
|
-
const wrappedParams = paramsNode.params.map((param) => {
|
|
1202
|
-
if ("kind" in param && param.kind === "ParameterGroup") {
|
|
1203
|
-
const group = param;
|
|
1204
|
-
return {
|
|
1205
|
-
...group,
|
|
1206
|
-
properties: group.properties.map((p) => ({
|
|
1207
|
-
...p,
|
|
1208
|
-
type: p.type ? _kubb_core.ast.createParamsType({
|
|
1209
|
-
variant: "reference",
|
|
1210
|
-
name: `MaybeRefOrGetter<${printType(p.type)}>`
|
|
1211
|
-
}) : p.type
|
|
1212
|
-
}))
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
const fp = param;
|
|
1216
|
-
if (fp.name === "options") return fp;
|
|
1217
|
-
return {
|
|
1218
|
-
...fp,
|
|
1219
|
-
type: fp.type ? _kubb_core.ast.createParamsType({
|
|
1220
|
-
variant: "reference",
|
|
1221
|
-
name: `MaybeRefOrGetter<${printType(fp.type)}>`
|
|
1222
|
-
}) : fp.type
|
|
1223
|
-
};
|
|
1224
|
-
});
|
|
1225
|
-
return _kubb_core.ast.createFunctionParameters({ params: wrappedParams });
|
|
1226
|
-
}
|
|
1227
|
-
function printType(typeNode) {
|
|
1228
|
-
if (!typeNode) return "unknown";
|
|
1229
|
-
if (typeNode.variant === "reference") return typeNode.name;
|
|
1230
|
-
if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
|
|
1231
|
-
if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
|
|
1232
|
-
const typeStr = printType(p.type);
|
|
1233
|
-
const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
|
|
1234
|
-
return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
|
|
1235
|
-
}).join("; ")} }`;
|
|
1236
|
-
return "unknown";
|
|
1153
|
+
}), (name) => name === "options");
|
|
1237
1154
|
}
|
|
1238
1155
|
function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, paramsCasing, pathParamsType, dataReturnType, node, tsResolver }) {
|
|
1239
|
-
const
|
|
1156
|
+
const successNames = resolveSuccessNames(node, tsResolver);
|
|
1157
|
+
const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
|
|
1240
1158
|
const errorNames = resolveErrorNames(node, tsResolver);
|
|
1241
|
-
const TData = dataReturnType === "data" ? responseName :
|
|
1159
|
+
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
|
|
1242
1160
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1243
1161
|
const returnType = `UseQueryReturnType<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
|
|
1244
1162
|
const generics = [
|
|
@@ -1246,12 +1164,13 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
|
|
|
1246
1164
|
`TQueryData = ${TData}`,
|
|
1247
1165
|
`TQueryKey extends QueryKey = ${queryKeyTypeName}`
|
|
1248
1166
|
];
|
|
1249
|
-
const queryKeyParamsNode =
|
|
1167
|
+
const queryKeyParamsNode = buildQueryKeyParamsNode(node, {
|
|
1250
1168
|
pathParamsType,
|
|
1251
1169
|
paramsCasing,
|
|
1252
1170
|
resolver: tsResolver
|
|
1253
1171
|
});
|
|
1254
1172
|
const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? "";
|
|
1173
|
+
const enabledNames = getEnabledParamNames(queryKeyParamsNode);
|
|
1255
1174
|
const queryOptionsParamsNode = getQueryOptionsParams(node, {
|
|
1256
1175
|
paramsType,
|
|
1257
1176
|
paramsCasing,
|
|
@@ -1259,13 +1178,13 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
|
|
|
1259
1178
|
resolver: tsResolver
|
|
1260
1179
|
});
|
|
1261
1180
|
const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? "";
|
|
1262
|
-
const paramsNode =
|
|
1181
|
+
const paramsNode = markParamsOptional(buildQueryParamsNode(node, {
|
|
1263
1182
|
paramsType,
|
|
1264
1183
|
paramsCasing,
|
|
1265
1184
|
pathParamsType,
|
|
1266
1185
|
dataReturnType,
|
|
1267
1186
|
resolver: tsResolver
|
|
1268
|
-
});
|
|
1187
|
+
}), enabledNames);
|
|
1269
1188
|
const paramsSignature = declarationPrinter.print(paramsNode) ?? "";
|
|
1270
1189
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
1271
1190
|
name,
|
|
@@ -1276,7 +1195,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
|
|
|
1276
1195
|
export: true,
|
|
1277
1196
|
generics: generics.join(", "),
|
|
1278
1197
|
params: paramsSignature,
|
|
1279
|
-
JSDoc: { comments:
|
|
1198
|
+
JSDoc: { comments: buildOperationComments(node) },
|
|
1280
1199
|
children: `
|
|
1281
1200
|
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
1282
1201
|
const { client: queryClient, ...resolvedOptions } = queryConfig
|
|
@@ -1295,7 +1214,6 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
|
|
|
1295
1214
|
})
|
|
1296
1215
|
});
|
|
1297
1216
|
}
|
|
1298
|
-
Query.getParams = getParams;
|
|
1299
1217
|
//#endregion
|
|
1300
1218
|
Object.defineProperty(exports, "InfiniteQuery", {
|
|
1301
1219
|
enumerable: true,
|
|
@@ -1357,11 +1275,41 @@ Object.defineProperty(exports, "camelCase", {
|
|
|
1357
1275
|
return camelCase;
|
|
1358
1276
|
}
|
|
1359
1277
|
});
|
|
1360
|
-
Object.defineProperty(exports, "
|
|
1278
|
+
Object.defineProperty(exports, "getOperationParameters", {
|
|
1279
|
+
enumerable: true,
|
|
1280
|
+
get: function() {
|
|
1281
|
+
return getOperationParameters;
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
Object.defineProperty(exports, "mutationKeyTransformer", {
|
|
1285
|
+
enumerable: true,
|
|
1286
|
+
get: function() {
|
|
1287
|
+
return mutationKeyTransformer;
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
Object.defineProperty(exports, "operationFileEntry", {
|
|
1291
|
+
enumerable: true,
|
|
1292
|
+
get: function() {
|
|
1293
|
+
return operationFileEntry;
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
Object.defineProperty(exports, "queryKeyTransformer", {
|
|
1297
|
+
enumerable: true,
|
|
1298
|
+
get: function() {
|
|
1299
|
+
return queryKeyTransformer;
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
Object.defineProperty(exports, "resolveOperationTypeNames", {
|
|
1303
|
+
enumerable: true,
|
|
1304
|
+
get: function() {
|
|
1305
|
+
return resolveOperationTypeNames;
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
Object.defineProperty(exports, "resolveZodSchemaNames", {
|
|
1361
1309
|
enumerable: true,
|
|
1362
1310
|
get: function() {
|
|
1363
|
-
return
|
|
1311
|
+
return resolveZodSchemaNames;
|
|
1364
1312
|
}
|
|
1365
1313
|
});
|
|
1366
1314
|
|
|
1367
|
-
//# sourceMappingURL=components-
|
|
1315
|
+
//# sourceMappingURL=components-D3xIZ9FA.cjs.map
|