@kubb/plugin-react-query 4.32.4 → 4.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-BsskoyWP.cjs → components-BHQT9ZLc.cjs} +270 -74
- package/dist/components-BHQT9ZLc.cjs.map +1 -0
- package/dist/{components-CpfLKZrt.js → components-CpyHYGOw.js} +268 -84
- package/dist/components-CpyHYGOw.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +18 -79
- package/dist/components.js +1 -1
- package/dist/{generators-_w8AJ3mw.js → generators-CpiBv5eE.js} +3 -3
- package/dist/{generators-_w8AJ3mw.js.map → generators-CpiBv5eE.js.map} +1 -1
- package/dist/{generators-CZwfG1GA.cjs → generators-W_darhpm.cjs} +4 -4
- package/dist/{generators-CZwfG1GA.cjs.map → generators-W_darhpm.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +43 -7
- package/dist/generators.js +1 -1
- package/dist/index.cjs +6 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-BX92kwMX.d.ts → types--pHE21AC.d.ts} +71 -4
- package/package.json +11 -7
- package/src/components/InfiniteQueryOptions.tsx +1 -1
- package/src/components/MutationKey.tsx +1 -54
- package/src/components/QueryKey.tsx +1 -87
- package/src/components/SuspenseInfiniteQueryOptions.tsx +1 -1
- package/src/plugin.ts +1 -1
- package/src/types.ts +4 -10
- package/dist/components-BsskoyWP.cjs.map +0 -1
- package/dist/components-CpfLKZrt.js.map +0 -1
|
@@ -27,11 +27,239 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
let _kubb_oas = require("@kubb/oas");
|
|
28
28
|
let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
29
29
|
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
30
|
-
let _kubb_core_utils = require("@kubb/core/utils");
|
|
31
30
|
let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
32
31
|
let _kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
33
|
-
//#region src/
|
|
34
|
-
|
|
32
|
+
//#region ../../internals/utils/src/casing.ts
|
|
33
|
+
/**
|
|
34
|
+
* Shared implementation for camelCase and PascalCase conversion.
|
|
35
|
+
* Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
|
|
36
|
+
* and capitalizes each word according to `pascal`.
|
|
37
|
+
*
|
|
38
|
+
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
39
|
+
*/
|
|
40
|
+
function toCamelOrPascal(text, pascal) {
|
|
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) => {
|
|
42
|
+
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
43
|
+
if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
|
|
44
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
45
|
+
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Splits `text` on `.` and applies `transformPart` to each segment.
|
|
49
|
+
* The last segment receives `isLast = true`, all earlier segments receive `false`.
|
|
50
|
+
* Segments are joined with `/` to form a file path.
|
|
51
|
+
*/
|
|
52
|
+
function applyToFileParts(text, transformPart) {
|
|
53
|
+
const parts = text.split(".");
|
|
54
|
+
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts `text` to camelCase.
|
|
58
|
+
* When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* camelCase('hello-world') // 'helloWorld'
|
|
62
|
+
* camelCase('pet.petId', { isFile: true }) // 'pet/petId'
|
|
63
|
+
*/
|
|
64
|
+
function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
65
|
+
if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
|
|
66
|
+
prefix,
|
|
67
|
+
suffix
|
|
68
|
+
} : {}));
|
|
69
|
+
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Converts `text` to PascalCase.
|
|
73
|
+
* When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* pascalCase('hello-world') // 'HelloWorld'
|
|
77
|
+
* pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'
|
|
78
|
+
*/
|
|
79
|
+
function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
80
|
+
if (isFile) return applyToFileParts(text, (part, isLast) => isLast ? pascalCase(part, {
|
|
81
|
+
prefix,
|
|
82
|
+
suffix
|
|
83
|
+
}) : camelCase(part));
|
|
84
|
+
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region ../../internals/utils/src/object.ts
|
|
88
|
+
/**
|
|
89
|
+
* Converts a dot-notation path or string array into an optional-chaining accessor expression.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* getNestedAccessor('pagination.next.id', 'lastPage')
|
|
93
|
+
* // → "lastPage?.['pagination']?.['next']?.['id']"
|
|
94
|
+
*/
|
|
95
|
+
function getNestedAccessor(param, accessor) {
|
|
96
|
+
const parts = Array.isArray(param) ? param : param.split(".");
|
|
97
|
+
if (parts.length === 0 || parts.length === 1 && parts[0] === "") return void 0;
|
|
98
|
+
return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../../internals/utils/src/reserved.ts
|
|
102
|
+
/**
|
|
103
|
+
* Returns `true` when `name` is a syntactically valid JavaScript variable name.
|
|
104
|
+
*/
|
|
105
|
+
function isValidVarName(name) {
|
|
106
|
+
try {
|
|
107
|
+
new Function(`var ${name}`);
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region ../../internals/utils/src/urlPath.ts
|
|
115
|
+
/**
|
|
116
|
+
* Parses and transforms an OpenAPI/Swagger path string into various URL formats.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* const p = new URLPath('/pet/{petId}')
|
|
120
|
+
* p.URL // '/pet/:petId'
|
|
121
|
+
* p.template // '`/pet/${petId}`'
|
|
122
|
+
*/
|
|
123
|
+
var URLPath = class {
|
|
124
|
+
/** The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`. */
|
|
125
|
+
path;
|
|
126
|
+
#options;
|
|
127
|
+
constructor(path, options = {}) {
|
|
128
|
+
this.path = path;
|
|
129
|
+
this.#options = options;
|
|
130
|
+
}
|
|
131
|
+
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
|
|
132
|
+
get URL() {
|
|
133
|
+
return this.toURLPath();
|
|
134
|
+
}
|
|
135
|
+
/** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`). */
|
|
136
|
+
get isURL() {
|
|
137
|
+
try {
|
|
138
|
+
return !!new URL(this.path).href;
|
|
139
|
+
} catch {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
|
|
148
|
+
* new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
|
|
149
|
+
*/
|
|
150
|
+
get template() {
|
|
151
|
+
return this.toTemplateString();
|
|
152
|
+
}
|
|
153
|
+
/** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set. */
|
|
154
|
+
get object() {
|
|
155
|
+
return this.toObject();
|
|
156
|
+
}
|
|
157
|
+
/** Returns a map of path parameter names, or `undefined` when the path has no parameters. */
|
|
158
|
+
get params() {
|
|
159
|
+
return this.getParams();
|
|
160
|
+
}
|
|
161
|
+
#transformParam(raw) {
|
|
162
|
+
const param = isValidVarName(raw) ? raw : camelCase(raw);
|
|
163
|
+
return this.#options.casing === "camelcase" ? camelCase(param) : param;
|
|
164
|
+
}
|
|
165
|
+
/** Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name. */
|
|
166
|
+
#eachParam(fn) {
|
|
167
|
+
for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
|
|
168
|
+
const raw = match[1];
|
|
169
|
+
fn(raw, this.#transformParam(raw));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
toObject({ type = "path", replacer, stringify } = {}) {
|
|
173
|
+
const object = {
|
|
174
|
+
url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
|
|
175
|
+
params: this.getParams()
|
|
176
|
+
};
|
|
177
|
+
if (stringify) {
|
|
178
|
+
if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
|
|
179
|
+
if (object.params) return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
|
|
180
|
+
return `{ url: '${object.url}' }`;
|
|
181
|
+
}
|
|
182
|
+
return object;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
186
|
+
* An optional `replacer` can transform each extracted parameter name before interpolation.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
|
|
190
|
+
*/
|
|
191
|
+
toTemplateString({ prefix = "", replacer } = {}) {
|
|
192
|
+
return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
|
|
193
|
+
if (i % 2 === 0) return part;
|
|
194
|
+
const param = this.#transformParam(part);
|
|
195
|
+
return `\${${replacer ? replacer(param) : param}}`;
|
|
196
|
+
}).join("")}\``;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Extracts all `{param}` segments from the path and returns them as a key-value map.
|
|
200
|
+
* An optional `replacer` transforms each parameter name in both key and value positions.
|
|
201
|
+
* Returns `undefined` when no path parameters are found.
|
|
202
|
+
*/
|
|
203
|
+
getParams(replacer) {
|
|
204
|
+
const params = {};
|
|
205
|
+
this.#eachParam((_raw, param) => {
|
|
206
|
+
const key = replacer ? replacer(param) : param;
|
|
207
|
+
params[key] = key;
|
|
208
|
+
});
|
|
209
|
+
return Object.keys(params).length > 0 ? params : void 0;
|
|
210
|
+
}
|
|
211
|
+
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
|
|
212
|
+
toURLPath() {
|
|
213
|
+
return this.path.replace(/\{([^}]+)\}/g, ":$1");
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
218
|
+
function getParams$10({}) {
|
|
219
|
+
return _kubb_react_fabric.FunctionParams.factory({});
|
|
220
|
+
}
|
|
221
|
+
__name(getParams$10, "getParams");
|
|
222
|
+
const getTransformer$1 = /* @__PURE__ */ __name(({ operation, casing }) => {
|
|
223
|
+
return [`{ url: '${new URLPath(operation.path, { casing }).toURLPath()}' }`];
|
|
224
|
+
}, "getTransformer");
|
|
225
|
+
function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer$1 }) {
|
|
226
|
+
const params = getParams$10({
|
|
227
|
+
pathParamsType,
|
|
228
|
+
typeSchemas
|
|
229
|
+
});
|
|
230
|
+
const keys = transformer({
|
|
231
|
+
operation,
|
|
232
|
+
schemas: typeSchemas,
|
|
233
|
+
casing: paramsCasing
|
|
234
|
+
});
|
|
235
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
236
|
+
name,
|
|
237
|
+
isExportable: true,
|
|
238
|
+
isIndexable: true,
|
|
239
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function.Arrow, {
|
|
240
|
+
name,
|
|
241
|
+
export: true,
|
|
242
|
+
params: params.toConstructor(),
|
|
243
|
+
singleLine: true,
|
|
244
|
+
children: `[${keys.join(", ")}] as const`
|
|
245
|
+
})
|
|
246
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
247
|
+
name: typeName,
|
|
248
|
+
isExportable: true,
|
|
249
|
+
isIndexable: true,
|
|
250
|
+
isTypeOnly: true,
|
|
251
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Type, {
|
|
252
|
+
name: typeName,
|
|
253
|
+
export: true,
|
|
254
|
+
children: `ReturnType<typeof ${name}>`
|
|
255
|
+
})
|
|
256
|
+
})] });
|
|
257
|
+
}
|
|
258
|
+
MutationKey.getParams = getParams$10;
|
|
259
|
+
MutationKey.getTransformer = getTransformer$1;
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region ../../internals/tanstack-query/src/components/QueryKey.tsx
|
|
262
|
+
function getParams$9({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
35
263
|
return _kubb_react_fabric.FunctionParams.factory({
|
|
36
264
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
37
265
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
@@ -42,27 +270,27 @@ function getParams$10({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
42
270
|
} : void 0,
|
|
43
271
|
data: typeSchemas.request?.name ? {
|
|
44
272
|
type: typeSchemas.request?.name,
|
|
45
|
-
|
|
273
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
46
274
|
} : void 0,
|
|
47
275
|
params: typeSchemas.queryParams?.name ? {
|
|
48
276
|
type: typeSchemas.queryParams?.name,
|
|
49
|
-
|
|
277
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
50
278
|
} : void 0
|
|
51
279
|
});
|
|
52
280
|
}
|
|
53
|
-
__name(getParams$
|
|
54
|
-
const getTransformer
|
|
281
|
+
__name(getParams$9, "getParams");
|
|
282
|
+
const getTransformer = ({ operation, schemas, casing }) => {
|
|
55
283
|
return [
|
|
56
|
-
new
|
|
284
|
+
new URLPath(operation.path, { casing }).toObject({
|
|
57
285
|
type: "path",
|
|
58
286
|
stringify: true
|
|
59
287
|
}),
|
|
60
288
|
schemas.queryParams?.name ? "...(params ? [params] : [])" : void 0,
|
|
61
289
|
schemas.request?.name ? "...(data ? [data] : [])" : void 0
|
|
62
290
|
].filter(Boolean);
|
|
63
|
-
}
|
|
64
|
-
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer
|
|
65
|
-
const params = getParams$
|
|
291
|
+
};
|
|
292
|
+
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }) {
|
|
293
|
+
const params = getParams$9({
|
|
66
294
|
pathParamsType,
|
|
67
295
|
typeSchemas,
|
|
68
296
|
paramsCasing
|
|
@@ -95,11 +323,11 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
95
323
|
})
|
|
96
324
|
})] });
|
|
97
325
|
}
|
|
98
|
-
QueryKey.getParams = getParams$
|
|
99
|
-
QueryKey.getTransformer = getTransformer
|
|
326
|
+
QueryKey.getParams = getParams$9;
|
|
327
|
+
QueryKey.getTransformer = getTransformer;
|
|
100
328
|
//#endregion
|
|
101
329
|
//#region src/components/QueryOptions.tsx
|
|
102
|
-
function getParams$
|
|
330
|
+
function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
103
331
|
if (paramsType === "object") {
|
|
104
332
|
const children = {
|
|
105
333
|
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
@@ -159,9 +387,9 @@ function getParams$9({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
159
387
|
}
|
|
160
388
|
});
|
|
161
389
|
}
|
|
162
|
-
__name(getParams$
|
|
390
|
+
__name(getParams$8, "getParams");
|
|
163
391
|
function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
|
|
164
|
-
const params = getParams$
|
|
392
|
+
const params = getParams$8({
|
|
165
393
|
paramsType,
|
|
166
394
|
paramsCasing,
|
|
167
395
|
pathParamsType,
|
|
@@ -209,10 +437,10 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
209
437
|
})
|
|
210
438
|
});
|
|
211
439
|
}
|
|
212
|
-
QueryOptions.getParams = getParams$
|
|
440
|
+
QueryOptions.getParams = getParams$8;
|
|
213
441
|
//#endregion
|
|
214
442
|
//#region src/components/InfiniteQuery.tsx
|
|
215
|
-
function getParams$
|
|
443
|
+
function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
|
|
216
444
|
if (paramsType === "object") {
|
|
217
445
|
const children = {
|
|
218
446
|
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
@@ -282,7 +510,7 @@ function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
|
|
|
282
510
|
}
|
|
283
511
|
});
|
|
284
512
|
}
|
|
285
|
-
__name(getParams$
|
|
513
|
+
__name(getParams$7, "getParams");
|
|
286
514
|
function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas, operation, initialPageParam, queryParam, customOptions }) {
|
|
287
515
|
const responseType = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
288
516
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
@@ -312,7 +540,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
312
540
|
typeSchemas,
|
|
313
541
|
paramsCasing
|
|
314
542
|
});
|
|
315
|
-
const params = getParams$
|
|
543
|
+
const params = getParams$7({
|
|
316
544
|
paramsCasing,
|
|
317
545
|
paramsType,
|
|
318
546
|
pathParamsType,
|
|
@@ -349,10 +577,10 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
349
577
|
})
|
|
350
578
|
});
|
|
351
579
|
}
|
|
352
|
-
InfiniteQuery.getParams = getParams$
|
|
580
|
+
InfiniteQuery.getParams = getParams$7;
|
|
353
581
|
//#endregion
|
|
354
582
|
//#region src/components/InfiniteQueryOptions.tsx
|
|
355
|
-
function getParams$
|
|
583
|
+
function getParams$6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
356
584
|
if (paramsType === "object") {
|
|
357
585
|
const children = {
|
|
358
586
|
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
@@ -412,7 +640,7 @@ function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
412
640
|
}
|
|
413
641
|
});
|
|
414
642
|
}
|
|
415
|
-
__name(getParams$
|
|
643
|
+
__name(getParams$6, "getParams");
|
|
416
644
|
function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, nextParam, previousParam, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName }) {
|
|
417
645
|
const queryFnDataType = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
418
646
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
@@ -423,7 +651,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
423
651
|
})() : "string" : typeof initialPageParam === "boolean" ? "boolean" : "unknown";
|
|
424
652
|
const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : void 0;
|
|
425
653
|
const pageParamType = queryParamType ? isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType : fallbackPageParamType;
|
|
426
|
-
const params = getParams$
|
|
654
|
+
const params = getParams$6({
|
|
427
655
|
paramsType,
|
|
428
656
|
paramsCasing,
|
|
429
657
|
pathParamsType,
|
|
@@ -446,11 +674,11 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
446
674
|
let getPreviousPageParamExpr;
|
|
447
675
|
if (hasNewParams) {
|
|
448
676
|
if (nextParam) {
|
|
449
|
-
const accessor =
|
|
677
|
+
const accessor = getNestedAccessor(nextParam, "lastPage");
|
|
450
678
|
if (accessor) getNextPageParamExpr = `getNextPageParam: (lastPage) => ${accessor}`;
|
|
451
679
|
}
|
|
452
680
|
if (previousParam) {
|
|
453
|
-
const accessor =
|
|
681
|
+
const accessor = getNestedAccessor(previousParam, "firstPage");
|
|
454
682
|
if (accessor) getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`;
|
|
455
683
|
}
|
|
456
684
|
} else if (cursorParam) {
|
|
@@ -525,51 +753,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
525
753
|
})
|
|
526
754
|
});
|
|
527
755
|
}
|
|
528
|
-
InfiniteQueryOptions.getParams = getParams$
|
|
529
|
-
//#endregion
|
|
530
|
-
//#region src/components/MutationKey.tsx
|
|
531
|
-
function getParams$6({}) {
|
|
532
|
-
return _kubb_react_fabric.FunctionParams.factory({});
|
|
533
|
-
}
|
|
534
|
-
__name(getParams$6, "getParams");
|
|
535
|
-
const getTransformer = ({ operation, casing }) => {
|
|
536
|
-
return [`{ url: '${new _kubb_core_utils.URLPath(operation.path, { casing }).toURLPath()}' }`];
|
|
537
|
-
};
|
|
538
|
-
function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }) {
|
|
539
|
-
const params = getParams$6({
|
|
540
|
-
pathParamsType,
|
|
541
|
-
typeSchemas
|
|
542
|
-
});
|
|
543
|
-
const keys = transformer({
|
|
544
|
-
operation,
|
|
545
|
-
schemas: typeSchemas,
|
|
546
|
-
casing: paramsCasing
|
|
547
|
-
});
|
|
548
|
-
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
549
|
-
name,
|
|
550
|
-
isExportable: true,
|
|
551
|
-
isIndexable: true,
|
|
552
|
-
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function.Arrow, {
|
|
553
|
-
name,
|
|
554
|
-
export: true,
|
|
555
|
-
params: params.toConstructor(),
|
|
556
|
-
singleLine: true,
|
|
557
|
-
children: `[${keys.join(", ")}] as const`
|
|
558
|
-
})
|
|
559
|
-
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
560
|
-
name: typeName,
|
|
561
|
-
isExportable: true,
|
|
562
|
-
isIndexable: true,
|
|
563
|
-
isTypeOnly: true,
|
|
564
|
-
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Type, {
|
|
565
|
-
name: typeName,
|
|
566
|
-
export: true,
|
|
567
|
-
children: `ReturnType<typeof ${name}>`
|
|
568
|
-
})
|
|
569
|
-
})] });
|
|
570
|
-
}
|
|
571
|
-
MutationKey.getParams = getParams$6;
|
|
572
|
-
MutationKey.getTransformer = getTransformer;
|
|
756
|
+
InfiniteQueryOptions.getParams = getParams$6;
|
|
573
757
|
//#endregion
|
|
574
758
|
//#region src/components/MutationOptions.tsx
|
|
575
759
|
function getParams$5({ typeSchemas }) {
|
|
@@ -1131,11 +1315,11 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
|
|
|
1131
1315
|
let getPreviousPageParamExpr;
|
|
1132
1316
|
if (hasNewParams) {
|
|
1133
1317
|
if (nextParam) {
|
|
1134
|
-
const accessor =
|
|
1318
|
+
const accessor = getNestedAccessor(nextParam, "lastPage");
|
|
1135
1319
|
if (accessor) getNextPageParamExpr = `getNextPageParam: (lastPage) => ${accessor}`;
|
|
1136
1320
|
}
|
|
1137
1321
|
if (previousParam) {
|
|
1138
|
-
const accessor =
|
|
1322
|
+
const accessor = getNestedAccessor(previousParam, "firstPage");
|
|
1139
1323
|
if (accessor) getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`;
|
|
1140
1324
|
}
|
|
1141
1325
|
} else if (cursorParam) {
|
|
@@ -1434,5 +1618,17 @@ Object.defineProperty(exports, "__toESM", {
|
|
|
1434
1618
|
return __toESM;
|
|
1435
1619
|
}
|
|
1436
1620
|
});
|
|
1621
|
+
Object.defineProperty(exports, "camelCase", {
|
|
1622
|
+
enumerable: true,
|
|
1623
|
+
get: function() {
|
|
1624
|
+
return camelCase;
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
Object.defineProperty(exports, "pascalCase", {
|
|
1628
|
+
enumerable: true,
|
|
1629
|
+
get: function() {
|
|
1630
|
+
return pascalCase;
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1437
1633
|
|
|
1438
|
-
//# sourceMappingURL=components-
|
|
1634
|
+
//# sourceMappingURL=components-BHQT9ZLc.cjs.map
|