@kubb/plugin-react-query 4.33.0 → 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
|
@@ -1,12 +1,240 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isAllOptional, isOptional } from "@kubb/oas";
|
|
3
3
|
import { getComments, getPathParams } from "@kubb/plugin-oas/utils";
|
|
4
|
-
import { File, Function, FunctionParams, Type } from "@kubb/react-fabric";
|
|
5
|
-
import { URLPath, getNestedAccessor } from "@kubb/core/utils";
|
|
4
|
+
import { File, Function as Function$1, FunctionParams, Type } from "@kubb/react-fabric";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
7
6
|
import { Client } from "@kubb/plugin-client/components";
|
|
8
|
-
//#region src/
|
|
9
|
-
|
|
7
|
+
//#region ../../internals/utils/src/casing.ts
|
|
8
|
+
/**
|
|
9
|
+
* Shared implementation for camelCase and PascalCase conversion.
|
|
10
|
+
* Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
|
|
11
|
+
* and capitalizes each word according to `pascal`.
|
|
12
|
+
*
|
|
13
|
+
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
14
|
+
*/
|
|
15
|
+
function toCamelOrPascal(text, pascal) {
|
|
16
|
+
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) => {
|
|
17
|
+
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
18
|
+
if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
|
|
19
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
20
|
+
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Splits `text` on `.` and applies `transformPart` to each segment.
|
|
24
|
+
* The last segment receives `isLast = true`, all earlier segments receive `false`.
|
|
25
|
+
* Segments are joined with `/` to form a file path.
|
|
26
|
+
*/
|
|
27
|
+
function applyToFileParts(text, transformPart) {
|
|
28
|
+
const parts = text.split(".");
|
|
29
|
+
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Converts `text` to camelCase.
|
|
33
|
+
* When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* camelCase('hello-world') // 'helloWorld'
|
|
37
|
+
* camelCase('pet.petId', { isFile: true }) // 'pet/petId'
|
|
38
|
+
*/
|
|
39
|
+
function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
40
|
+
if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
|
|
41
|
+
prefix,
|
|
42
|
+
suffix
|
|
43
|
+
} : {}));
|
|
44
|
+
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Converts `text` to PascalCase.
|
|
48
|
+
* When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* pascalCase('hello-world') // 'HelloWorld'
|
|
52
|
+
* pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'
|
|
53
|
+
*/
|
|
54
|
+
function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
55
|
+
if (isFile) return applyToFileParts(text, (part, isLast) => isLast ? pascalCase(part, {
|
|
56
|
+
prefix,
|
|
57
|
+
suffix
|
|
58
|
+
}) : camelCase(part));
|
|
59
|
+
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../../internals/utils/src/object.ts
|
|
63
|
+
/**
|
|
64
|
+
* Converts a dot-notation path or string array into an optional-chaining accessor expression.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* getNestedAccessor('pagination.next.id', 'lastPage')
|
|
68
|
+
* // → "lastPage?.['pagination']?.['next']?.['id']"
|
|
69
|
+
*/
|
|
70
|
+
function getNestedAccessor(param, accessor) {
|
|
71
|
+
const parts = Array.isArray(param) ? param : param.split(".");
|
|
72
|
+
if (parts.length === 0 || parts.length === 1 && parts[0] === "") return void 0;
|
|
73
|
+
return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region ../../internals/utils/src/reserved.ts
|
|
77
|
+
/**
|
|
78
|
+
* Returns `true` when `name` is a syntactically valid JavaScript variable name.
|
|
79
|
+
*/
|
|
80
|
+
function isValidVarName(name) {
|
|
81
|
+
try {
|
|
82
|
+
new Function(`var ${name}`);
|
|
83
|
+
} catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../../internals/utils/src/urlPath.ts
|
|
90
|
+
/**
|
|
91
|
+
* Parses and transforms an OpenAPI/Swagger path string into various URL formats.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const p = new URLPath('/pet/{petId}')
|
|
95
|
+
* p.URL // '/pet/:petId'
|
|
96
|
+
* p.template // '`/pet/${petId}`'
|
|
97
|
+
*/
|
|
98
|
+
var URLPath = class {
|
|
99
|
+
/** The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`. */
|
|
100
|
+
path;
|
|
101
|
+
#options;
|
|
102
|
+
constructor(path, options = {}) {
|
|
103
|
+
this.path = path;
|
|
104
|
+
this.#options = options;
|
|
105
|
+
}
|
|
106
|
+
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
|
|
107
|
+
get URL() {
|
|
108
|
+
return this.toURLPath();
|
|
109
|
+
}
|
|
110
|
+
/** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`). */
|
|
111
|
+
get isURL() {
|
|
112
|
+
try {
|
|
113
|
+
return !!new URL(this.path).href;
|
|
114
|
+
} catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
|
|
123
|
+
* new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
|
|
124
|
+
*/
|
|
125
|
+
get template() {
|
|
126
|
+
return this.toTemplateString();
|
|
127
|
+
}
|
|
128
|
+
/** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set. */
|
|
129
|
+
get object() {
|
|
130
|
+
return this.toObject();
|
|
131
|
+
}
|
|
132
|
+
/** Returns a map of path parameter names, or `undefined` when the path has no parameters. */
|
|
133
|
+
get params() {
|
|
134
|
+
return this.getParams();
|
|
135
|
+
}
|
|
136
|
+
#transformParam(raw) {
|
|
137
|
+
const param = isValidVarName(raw) ? raw : camelCase(raw);
|
|
138
|
+
return this.#options.casing === "camelcase" ? camelCase(param) : param;
|
|
139
|
+
}
|
|
140
|
+
/** Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name. */
|
|
141
|
+
#eachParam(fn) {
|
|
142
|
+
for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
|
|
143
|
+
const raw = match[1];
|
|
144
|
+
fn(raw, this.#transformParam(raw));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
toObject({ type = "path", replacer, stringify } = {}) {
|
|
148
|
+
const object = {
|
|
149
|
+
url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
|
|
150
|
+
params: this.getParams()
|
|
151
|
+
};
|
|
152
|
+
if (stringify) {
|
|
153
|
+
if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
|
|
154
|
+
if (object.params) return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
|
|
155
|
+
return `{ url: '${object.url}' }`;
|
|
156
|
+
}
|
|
157
|
+
return object;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
161
|
+
* An optional `replacer` can transform each extracted parameter name before interpolation.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
|
|
165
|
+
*/
|
|
166
|
+
toTemplateString({ prefix = "", replacer } = {}) {
|
|
167
|
+
return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
|
|
168
|
+
if (i % 2 === 0) return part;
|
|
169
|
+
const param = this.#transformParam(part);
|
|
170
|
+
return `\${${replacer ? replacer(param) : param}}`;
|
|
171
|
+
}).join("")}\``;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Extracts all `{param}` segments from the path and returns them as a key-value map.
|
|
175
|
+
* An optional `replacer` transforms each parameter name in both key and value positions.
|
|
176
|
+
* Returns `undefined` when no path parameters are found.
|
|
177
|
+
*/
|
|
178
|
+
getParams(replacer) {
|
|
179
|
+
const params = {};
|
|
180
|
+
this.#eachParam((_raw, param) => {
|
|
181
|
+
const key = replacer ? replacer(param) : param;
|
|
182
|
+
params[key] = key;
|
|
183
|
+
});
|
|
184
|
+
return Object.keys(params).length > 0 ? params : void 0;
|
|
185
|
+
}
|
|
186
|
+
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`. */
|
|
187
|
+
toURLPath() {
|
|
188
|
+
return this.path.replace(/\{([^}]+)\}/g, ":$1");
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
193
|
+
function getParams$10({}) {
|
|
194
|
+
return FunctionParams.factory({});
|
|
195
|
+
}
|
|
196
|
+
__name(getParams$10, "getParams");
|
|
197
|
+
const getTransformer$1 = /* @__PURE__ */ __name(({ operation, casing }) => {
|
|
198
|
+
return [`{ url: '${new URLPath(operation.path, { casing }).toURLPath()}' }`];
|
|
199
|
+
}, "getTransformer");
|
|
200
|
+
function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer$1 }) {
|
|
201
|
+
const params = getParams$10({
|
|
202
|
+
pathParamsType,
|
|
203
|
+
typeSchemas
|
|
204
|
+
});
|
|
205
|
+
const keys = transformer({
|
|
206
|
+
operation,
|
|
207
|
+
schemas: typeSchemas,
|
|
208
|
+
casing: paramsCasing
|
|
209
|
+
});
|
|
210
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
|
|
211
|
+
name,
|
|
212
|
+
isExportable: true,
|
|
213
|
+
isIndexable: true,
|
|
214
|
+
children: /* @__PURE__ */ jsx(Function$1.Arrow, {
|
|
215
|
+
name,
|
|
216
|
+
export: true,
|
|
217
|
+
params: params.toConstructor(),
|
|
218
|
+
singleLine: true,
|
|
219
|
+
children: `[${keys.join(", ")}] as const`
|
|
220
|
+
})
|
|
221
|
+
}), /* @__PURE__ */ jsx(File.Source, {
|
|
222
|
+
name: typeName,
|
|
223
|
+
isExportable: true,
|
|
224
|
+
isIndexable: true,
|
|
225
|
+
isTypeOnly: true,
|
|
226
|
+
children: /* @__PURE__ */ jsx(Type, {
|
|
227
|
+
name: typeName,
|
|
228
|
+
export: true,
|
|
229
|
+
children: `ReturnType<typeof ${name}>`
|
|
230
|
+
})
|
|
231
|
+
})] });
|
|
232
|
+
}
|
|
233
|
+
MutationKey.getParams = getParams$10;
|
|
234
|
+
MutationKey.getTransformer = getTransformer$1;
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region ../../internals/tanstack-query/src/components/QueryKey.tsx
|
|
237
|
+
function getParams$9({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
10
238
|
return FunctionParams.factory({
|
|
11
239
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
12
240
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
@@ -17,16 +245,16 @@ function getParams$10({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
17
245
|
} : void 0,
|
|
18
246
|
data: typeSchemas.request?.name ? {
|
|
19
247
|
type: typeSchemas.request?.name,
|
|
20
|
-
|
|
248
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
21
249
|
} : void 0,
|
|
22
250
|
params: typeSchemas.queryParams?.name ? {
|
|
23
251
|
type: typeSchemas.queryParams?.name,
|
|
24
|
-
|
|
252
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
25
253
|
} : void 0
|
|
26
254
|
});
|
|
27
255
|
}
|
|
28
|
-
__name(getParams$
|
|
29
|
-
const getTransformer
|
|
256
|
+
__name(getParams$9, "getParams");
|
|
257
|
+
const getTransformer = ({ operation, schemas, casing }) => {
|
|
30
258
|
return [
|
|
31
259
|
new URLPath(operation.path, { casing }).toObject({
|
|
32
260
|
type: "path",
|
|
@@ -35,9 +263,9 @@ const getTransformer$1 = /* @__PURE__ */ __name(({ operation, schemas, casing })
|
|
|
35
263
|
schemas.queryParams?.name ? "...(params ? [params] : [])" : void 0,
|
|
36
264
|
schemas.request?.name ? "...(data ? [data] : [])" : void 0
|
|
37
265
|
].filter(Boolean);
|
|
38
|
-
}
|
|
39
|
-
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer
|
|
40
|
-
const params = getParams$
|
|
266
|
+
};
|
|
267
|
+
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }) {
|
|
268
|
+
const params = getParams$9({
|
|
41
269
|
pathParamsType,
|
|
42
270
|
typeSchemas,
|
|
43
271
|
paramsCasing
|
|
@@ -51,7 +279,7 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
51
279
|
name,
|
|
52
280
|
isExportable: true,
|
|
53
281
|
isIndexable: true,
|
|
54
|
-
children: /* @__PURE__ */ jsx(Function.Arrow, {
|
|
282
|
+
children: /* @__PURE__ */ jsx(Function$1.Arrow, {
|
|
55
283
|
name,
|
|
56
284
|
export: true,
|
|
57
285
|
params: params.toConstructor(),
|
|
@@ -70,11 +298,11 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
70
298
|
})
|
|
71
299
|
})] });
|
|
72
300
|
}
|
|
73
|
-
QueryKey.getParams = getParams$
|
|
74
|
-
QueryKey.getTransformer = getTransformer
|
|
301
|
+
QueryKey.getParams = getParams$9;
|
|
302
|
+
QueryKey.getTransformer = getTransformer;
|
|
75
303
|
//#endregion
|
|
76
304
|
//#region src/components/QueryOptions.tsx
|
|
77
|
-
function getParams$
|
|
305
|
+
function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
78
306
|
if (paramsType === "object") {
|
|
79
307
|
const children = {
|
|
80
308
|
...getPathParams(typeSchemas.pathParams, {
|
|
@@ -134,9 +362,9 @@ function getParams$9({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
134
362
|
}
|
|
135
363
|
});
|
|
136
364
|
}
|
|
137
|
-
__name(getParams$
|
|
365
|
+
__name(getParams$8, "getParams");
|
|
138
366
|
function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
|
|
139
|
-
const params = getParams$
|
|
367
|
+
const params = getParams$8({
|
|
140
368
|
paramsType,
|
|
141
369
|
paramsCasing,
|
|
142
370
|
pathParamsType,
|
|
@@ -164,7 +392,7 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
164
392
|
name,
|
|
165
393
|
isExportable: true,
|
|
166
394
|
isIndexable: true,
|
|
167
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
395
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
168
396
|
name,
|
|
169
397
|
export: true,
|
|
170
398
|
params: params.toConstructor(),
|
|
@@ -184,10 +412,10 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
184
412
|
})
|
|
185
413
|
});
|
|
186
414
|
}
|
|
187
|
-
QueryOptions.getParams = getParams$
|
|
415
|
+
QueryOptions.getParams = getParams$8;
|
|
188
416
|
//#endregion
|
|
189
417
|
//#region src/components/InfiniteQuery.tsx
|
|
190
|
-
function getParams$
|
|
418
|
+
function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
|
|
191
419
|
if (paramsType === "object") {
|
|
192
420
|
const children = {
|
|
193
421
|
...getPathParams(typeSchemas.pathParams, {
|
|
@@ -257,7 +485,7 @@ function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
|
|
|
257
485
|
}
|
|
258
486
|
});
|
|
259
487
|
}
|
|
260
|
-
__name(getParams$
|
|
488
|
+
__name(getParams$7, "getParams");
|
|
261
489
|
function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas, operation, initialPageParam, queryParam, customOptions }) {
|
|
262
490
|
const responseType = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
263
491
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
@@ -287,7 +515,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
287
515
|
typeSchemas,
|
|
288
516
|
paramsCasing
|
|
289
517
|
});
|
|
290
|
-
const params = getParams$
|
|
518
|
+
const params = getParams$7({
|
|
291
519
|
paramsCasing,
|
|
292
520
|
paramsType,
|
|
293
521
|
pathParamsType,
|
|
@@ -299,7 +527,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
299
527
|
name,
|
|
300
528
|
isExportable: true,
|
|
301
529
|
isIndexable: true,
|
|
302
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
530
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
303
531
|
name,
|
|
304
532
|
export: true,
|
|
305
533
|
generics: generics.join(", "),
|
|
@@ -324,10 +552,10 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
324
552
|
})
|
|
325
553
|
});
|
|
326
554
|
}
|
|
327
|
-
InfiniteQuery.getParams = getParams$
|
|
555
|
+
InfiniteQuery.getParams = getParams$7;
|
|
328
556
|
//#endregion
|
|
329
557
|
//#region src/components/InfiniteQueryOptions.tsx
|
|
330
|
-
function getParams$
|
|
558
|
+
function getParams$6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
331
559
|
if (paramsType === "object") {
|
|
332
560
|
const children = {
|
|
333
561
|
...getPathParams(typeSchemas.pathParams, {
|
|
@@ -387,7 +615,7 @@ function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
387
615
|
}
|
|
388
616
|
});
|
|
389
617
|
}
|
|
390
|
-
__name(getParams$
|
|
618
|
+
__name(getParams$6, "getParams");
|
|
391
619
|
function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, nextParam, previousParam, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName }) {
|
|
392
620
|
const queryFnDataType = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
393
621
|
const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
@@ -398,7 +626,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
398
626
|
})() : "string" : typeof initialPageParam === "boolean" ? "boolean" : "unknown";
|
|
399
627
|
const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : void 0;
|
|
400
628
|
const pageParamType = queryParamType ? isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType : fallbackPageParamType;
|
|
401
|
-
const params = getParams$
|
|
629
|
+
const params = getParams$6({
|
|
402
630
|
paramsType,
|
|
403
631
|
paramsCasing,
|
|
404
632
|
pathParamsType,
|
|
@@ -454,7 +682,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
454
682
|
name,
|
|
455
683
|
isExportable: true,
|
|
456
684
|
isIndexable: true,
|
|
457
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
685
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
458
686
|
name,
|
|
459
687
|
export: true,
|
|
460
688
|
params: params.toConstructor(),
|
|
@@ -479,7 +707,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
479
707
|
name,
|
|
480
708
|
isExportable: true,
|
|
481
709
|
isIndexable: true,
|
|
482
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
710
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
483
711
|
name,
|
|
484
712
|
export: true,
|
|
485
713
|
params: params.toConstructor(),
|
|
@@ -500,51 +728,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
500
728
|
})
|
|
501
729
|
});
|
|
502
730
|
}
|
|
503
|
-
InfiniteQueryOptions.getParams = getParams$
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region src/components/MutationKey.tsx
|
|
506
|
-
function getParams$6({}) {
|
|
507
|
-
return FunctionParams.factory({});
|
|
508
|
-
}
|
|
509
|
-
__name(getParams$6, "getParams");
|
|
510
|
-
const getTransformer = ({ operation, casing }) => {
|
|
511
|
-
return [`{ url: '${new URLPath(operation.path, { casing }).toURLPath()}' }`];
|
|
512
|
-
};
|
|
513
|
-
function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }) {
|
|
514
|
-
const params = getParams$6({
|
|
515
|
-
pathParamsType,
|
|
516
|
-
typeSchemas
|
|
517
|
-
});
|
|
518
|
-
const keys = transformer({
|
|
519
|
-
operation,
|
|
520
|
-
schemas: typeSchemas,
|
|
521
|
-
casing: paramsCasing
|
|
522
|
-
});
|
|
523
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
|
|
524
|
-
name,
|
|
525
|
-
isExportable: true,
|
|
526
|
-
isIndexable: true,
|
|
527
|
-
children: /* @__PURE__ */ jsx(Function.Arrow, {
|
|
528
|
-
name,
|
|
529
|
-
export: true,
|
|
530
|
-
params: params.toConstructor(),
|
|
531
|
-
singleLine: true,
|
|
532
|
-
children: `[${keys.join(", ")}] as const`
|
|
533
|
-
})
|
|
534
|
-
}), /* @__PURE__ */ jsx(File.Source, {
|
|
535
|
-
name: typeName,
|
|
536
|
-
isExportable: true,
|
|
537
|
-
isIndexable: true,
|
|
538
|
-
isTypeOnly: true,
|
|
539
|
-
children: /* @__PURE__ */ jsx(Type, {
|
|
540
|
-
name: typeName,
|
|
541
|
-
export: true,
|
|
542
|
-
children: `ReturnType<typeof ${name}>`
|
|
543
|
-
})
|
|
544
|
-
})] });
|
|
545
|
-
}
|
|
546
|
-
MutationKey.getParams = getParams$6;
|
|
547
|
-
MutationKey.getTransformer = getTransformer;
|
|
731
|
+
InfiniteQueryOptions.getParams = getParams$6;
|
|
548
732
|
//#endregion
|
|
549
733
|
//#region src/components/MutationOptions.tsx
|
|
550
734
|
function getParams$5({ typeSchemas }) {
|
|
@@ -602,7 +786,7 @@ function MutationOptions({ name, clientName, dataReturnType, typeSchemas, params
|
|
|
602
786
|
name,
|
|
603
787
|
isExportable: true,
|
|
604
788
|
isIndexable: true,
|
|
605
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
789
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
606
790
|
name,
|
|
607
791
|
export: true,
|
|
608
792
|
params: params.toConstructor(),
|
|
@@ -703,7 +887,7 @@ function Mutation({ name, mutationOptionsName, paramsCasing, pathParamsType, dat
|
|
|
703
887
|
name,
|
|
704
888
|
isExportable: true,
|
|
705
889
|
isIndexable: true,
|
|
706
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
890
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
707
891
|
name,
|
|
708
892
|
export: true,
|
|
709
893
|
params: params.toConstructor(),
|
|
@@ -844,7 +1028,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
|
|
|
844
1028
|
name,
|
|
845
1029
|
isExportable: true,
|
|
846
1030
|
isIndexable: true,
|
|
847
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
1031
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
848
1032
|
name,
|
|
849
1033
|
export: true,
|
|
850
1034
|
generics: generics.join(", "),
|
|
@@ -984,7 +1168,7 @@ function SuspenseInfiniteQuery({ name, queryKeyTypeName, queryOptionsName, query
|
|
|
984
1168
|
name,
|
|
985
1169
|
isExportable: true,
|
|
986
1170
|
isIndexable: true,
|
|
987
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
1171
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
988
1172
|
name,
|
|
989
1173
|
export: true,
|
|
990
1174
|
generics: generics.join(", "),
|
|
@@ -1139,7 +1323,7 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
|
|
|
1139
1323
|
name,
|
|
1140
1324
|
isExportable: true,
|
|
1141
1325
|
isIndexable: true,
|
|
1142
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
1326
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
1143
1327
|
name,
|
|
1144
1328
|
export: true,
|
|
1145
1329
|
params: params.toConstructor(),
|
|
@@ -1164,7 +1348,7 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
|
|
|
1164
1348
|
name,
|
|
1165
1349
|
isExportable: true,
|
|
1166
1350
|
isIndexable: true,
|
|
1167
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
1351
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
1168
1352
|
name,
|
|
1169
1353
|
export: true,
|
|
1170
1354
|
params: params.toConstructor(),
|
|
@@ -1304,7 +1488,7 @@ function SuspenseQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
1304
1488
|
name,
|
|
1305
1489
|
isExportable: true,
|
|
1306
1490
|
isIndexable: true,
|
|
1307
|
-
children: /* @__PURE__ */ jsx(Function, {
|
|
1491
|
+
children: /* @__PURE__ */ jsx(Function$1, {
|
|
1308
1492
|
name,
|
|
1309
1493
|
export: true,
|
|
1310
1494
|
generics: generics.join(", "),
|
|
@@ -1331,6 +1515,6 @@ function SuspenseQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
1331
1515
|
}
|
|
1332
1516
|
SuspenseQuery.getParams = getParams;
|
|
1333
1517
|
//#endregion
|
|
1334
|
-
export { Mutation as a,
|
|
1518
|
+
export { Mutation as a, InfiniteQuery as c, MutationKey as d, camelCase as f, Query as i, QueryOptions as l, SuspenseInfiniteQueryOptions as n, MutationOptions as o, pascalCase as p, SuspenseInfiniteQuery as r, InfiniteQueryOptions as s, SuspenseQuery as t, QueryKey as u };
|
|
1335
1519
|
|
|
1336
|
-
//# sourceMappingURL=components-
|
|
1520
|
+
//# sourceMappingURL=components-CpyHYGOw.js.map
|