@kubb/plugin-react-query 5.8.0-canary.20261025T212117 → 5.8.0-canary.20261025T213931
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/index.cjs +148 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +148 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -320,6 +320,146 @@ function capitalize(text) {
|
|
|
320
320
|
return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
|
|
321
321
|
}
|
|
322
322
|
//#endregion
|
|
323
|
+
//#region ../../internals/utils/src/reserved.ts
|
|
324
|
+
/**
|
|
325
|
+
* JavaScript and Java reserved words.
|
|
326
|
+
* @link https://github.com/jonschlinkert/reserved/blob/master/index.js
|
|
327
|
+
*/
|
|
328
|
+
const reservedWords = /* @__PURE__ */ new Set([
|
|
329
|
+
"abstract",
|
|
330
|
+
"arguments",
|
|
331
|
+
"await",
|
|
332
|
+
"boolean",
|
|
333
|
+
"break",
|
|
334
|
+
"byte",
|
|
335
|
+
"case",
|
|
336
|
+
"catch",
|
|
337
|
+
"char",
|
|
338
|
+
"class",
|
|
339
|
+
"const",
|
|
340
|
+
"continue",
|
|
341
|
+
"debugger",
|
|
342
|
+
"default",
|
|
343
|
+
"delete",
|
|
344
|
+
"do",
|
|
345
|
+
"double",
|
|
346
|
+
"else",
|
|
347
|
+
"enum",
|
|
348
|
+
"eval",
|
|
349
|
+
"export",
|
|
350
|
+
"extends",
|
|
351
|
+
"false",
|
|
352
|
+
"final",
|
|
353
|
+
"finally",
|
|
354
|
+
"float",
|
|
355
|
+
"for",
|
|
356
|
+
"function",
|
|
357
|
+
"goto",
|
|
358
|
+
"if",
|
|
359
|
+
"implements",
|
|
360
|
+
"import",
|
|
361
|
+
"in",
|
|
362
|
+
"instanceof",
|
|
363
|
+
"int",
|
|
364
|
+
"interface",
|
|
365
|
+
"let",
|
|
366
|
+
"long",
|
|
367
|
+
"native",
|
|
368
|
+
"new",
|
|
369
|
+
"null",
|
|
370
|
+
"package",
|
|
371
|
+
"private",
|
|
372
|
+
"protected",
|
|
373
|
+
"public",
|
|
374
|
+
"return",
|
|
375
|
+
"short",
|
|
376
|
+
"static",
|
|
377
|
+
"super",
|
|
378
|
+
"switch",
|
|
379
|
+
"synchronized",
|
|
380
|
+
"this",
|
|
381
|
+
"throw",
|
|
382
|
+
"throws",
|
|
383
|
+
"transient",
|
|
384
|
+
"true",
|
|
385
|
+
"try",
|
|
386
|
+
"typeof",
|
|
387
|
+
"var",
|
|
388
|
+
"void",
|
|
389
|
+
"volatile",
|
|
390
|
+
"while",
|
|
391
|
+
"with",
|
|
392
|
+
"yield",
|
|
393
|
+
"Array",
|
|
394
|
+
"Date",
|
|
395
|
+
"hasOwnProperty",
|
|
396
|
+
"Infinity",
|
|
397
|
+
"isFinite",
|
|
398
|
+
"isNaN",
|
|
399
|
+
"isPrototypeOf",
|
|
400
|
+
"length",
|
|
401
|
+
"Math",
|
|
402
|
+
"name",
|
|
403
|
+
"NaN",
|
|
404
|
+
"Number",
|
|
405
|
+
"Object",
|
|
406
|
+
"prototype",
|
|
407
|
+
"String",
|
|
408
|
+
"toString",
|
|
409
|
+
"undefined",
|
|
410
|
+
"valueOf"
|
|
411
|
+
]);
|
|
412
|
+
/**
|
|
413
|
+
* Returns `true` when `name` is a syntactically valid JavaScript variable name.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* isValidVarName('status') // true
|
|
418
|
+
* isValidVarName('class') // false (reserved word)
|
|
419
|
+
* isValidVarName('42foo') // false (starts with digit)
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
function isValidVarName(name) {
|
|
423
|
+
if (!name || reservedWords.has(name)) return false;
|
|
424
|
+
return isIdentifier(name);
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Returns `name` when it's a syntactically valid JavaScript variable name,
|
|
428
|
+
* otherwise prefixes it with `_` so the result is a valid identifier.
|
|
429
|
+
*
|
|
430
|
+
* Useful for sanitizing OpenAPI schema names or operation IDs that start with
|
|
431
|
+
* a digit (e.g. `409`, `504AccountCancel`) before using them as exported
|
|
432
|
+
* variable, type, or function names.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* ensureValidVarName('409') // '_409'
|
|
437
|
+
* ensureValidVarName('504AccountCancel') // '_504AccountCancel'
|
|
438
|
+
* ensureValidVarName('Pet') // 'Pet'
|
|
439
|
+
* ensureValidVarName('class') // '_class'
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
442
|
+
function ensureValidVarName(name) {
|
|
443
|
+
if (!name || isValidVarName(name)) return name;
|
|
444
|
+
return `_${name}`;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.
|
|
448
|
+
*
|
|
449
|
+
* Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys
|
|
450
|
+
* even though they are not valid variable names, so use this (not {@link isValidVarName}) when
|
|
451
|
+
* deciding whether an object key needs quoting.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* isIdentifier('name') // true
|
|
456
|
+
* isIdentifier('x-total')// false
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
function isIdentifier(name) {
|
|
460
|
+
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
323
463
|
//#region ../../internals/utils/src/strings.ts
|
|
324
464
|
/**
|
|
325
465
|
* Renders a dotted path or string array as an optional-chaining accessor expression rooted at
|
|
@@ -337,6 +477,11 @@ function getNestedAccessor(param, accessor) {
|
|
|
337
477
|
return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
|
|
338
478
|
}
|
|
339
479
|
//#endregion
|
|
480
|
+
//#region ../../internals/shared/src/resolver.ts
|
|
481
|
+
function resolveOperationName(name) {
|
|
482
|
+
return ensureValidVarName(camelCase(name));
|
|
483
|
+
}
|
|
484
|
+
//#endregion
|
|
340
485
|
//#region ../../internals/shared/src/group.ts
|
|
341
486
|
/**
|
|
342
487
|
* Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
|
|
@@ -375,7 +520,7 @@ var compatibility = {
|
|
|
375
520
|
};
|
|
376
521
|
//#endregion
|
|
377
522
|
//#region package.json
|
|
378
|
-
var version = "5.8.0-canary.
|
|
523
|
+
var version = "5.8.0-canary.20261025T213931";
|
|
379
524
|
//#endregion
|
|
380
525
|
//#region ../../internals/client/src/resolveOperationTypes.ts
|
|
381
526
|
/**
|
|
@@ -2127,7 +2272,7 @@ const suspenseQueryGenerator = createQueryGenerator({
|
|
|
2127
2272
|
* `useFooSuspense`, `useFooInfinite`, ...) and its companion helpers
|
|
2128
2273
|
* (`fooQueryKey`, `fooQueryOptions`).
|
|
2129
2274
|
*
|
|
2130
|
-
* Functions
|
|
2275
|
+
* Functions use safe camelCase identifiers; hooks get the `use`
|
|
2131
2276
|
* prefix; suspense and infinite variants are suffixed with `Suspense`/`Infinite`.
|
|
2132
2277
|
*
|
|
2133
2278
|
* @example Resolve hook and helper names
|
|
@@ -2142,6 +2287,7 @@ const suspenseQueryGenerator = createQueryGenerator({
|
|
|
2142
2287
|
*/
|
|
2143
2288
|
const resolverReactQuery = (0, kubb_kit.createResolver)({
|
|
2144
2289
|
pluginName: "plugin-react-query",
|
|
2290
|
+
name: resolveOperationName,
|
|
2145
2291
|
query: createQueryResolver(),
|
|
2146
2292
|
suspenseQuery: createQueryResolver("Suspense"),
|
|
2147
2293
|
infiniteQuery: createQueryResolver("Infinite"),
|