@kubb/plugin-react-query 5.8.0-canary.20261026T145838 → 5.8.0-canary.20261027T170749
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 +78 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +78 -14
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -499,6 +499,24 @@ function getNestedAccessor(param, accessor) {
|
|
|
499
499
|
function resolveOperationName(name) {
|
|
500
500
|
return ensureValidVarName(camelCase(name));
|
|
501
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Builds the allocation key for a declaration an operation owns. `scope` names which declaration
|
|
504
|
+
* it is, so two of them never share an allocation even when a custom resolver gives both the same
|
|
505
|
+
* name. Leave `scope` empty for the operation's own declaration.
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```ts
|
|
509
|
+
* resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
512
|
+
function operationKey(node, ...scope) {
|
|
513
|
+
return [
|
|
514
|
+
"operation",
|
|
515
|
+
node.method,
|
|
516
|
+
node.path,
|
|
517
|
+
...scope.map(String)
|
|
518
|
+
];
|
|
519
|
+
}
|
|
502
520
|
//#endregion
|
|
503
521
|
//#region ../../internals/shared/src/group.ts
|
|
504
522
|
/**
|
|
@@ -533,12 +551,12 @@ function createGroupConfig(group) {
|
|
|
533
551
|
//#endregion
|
|
534
552
|
//#region kubb-extension.json
|
|
535
553
|
var compatibility = {
|
|
536
|
-
"kubb": ">=5.
|
|
554
|
+
"kubb": ">=5.14.6",
|
|
537
555
|
"node": ">=22.22"
|
|
538
556
|
};
|
|
539
557
|
//#endregion
|
|
540
558
|
//#region package.json
|
|
541
|
-
var version = "5.8.0-canary.
|
|
559
|
+
var version = "5.8.0-canary.20261027T170749";
|
|
542
560
|
//#endregion
|
|
543
561
|
//#region ../../internals/client/src/resolveOperationTypes.ts
|
|
544
562
|
/**
|
|
@@ -765,8 +783,12 @@ function resolveClientOperation(options) {
|
|
|
765
783
|
group: operationOptions.group ?? void 0
|
|
766
784
|
});
|
|
767
785
|
const { importPath } = operationOptions;
|
|
786
|
+
const name = resolver.name(node.operationId);
|
|
768
787
|
return {
|
|
769
|
-
name: resolver.
|
|
788
|
+
name: resolver.resolveName({
|
|
789
|
+
key: operationKey(node),
|
|
790
|
+
name
|
|
791
|
+
}),
|
|
770
792
|
path: file.path,
|
|
771
793
|
clientPath: importPath === void 0 ? node_path.default.resolve(root, ".kubb/client.ts") : resolveImportPath({
|
|
772
794
|
importPath,
|
|
@@ -1376,19 +1398,39 @@ function MutationKey({ name, node, transformer, typeName }) {
|
|
|
1376
1398
|
function createQueryResolver(variant = "") {
|
|
1377
1399
|
return {
|
|
1378
1400
|
name(node) {
|
|
1379
|
-
|
|
1401
|
+
const name = `use${capitalize(this.name(node.operationId))}${variant}`;
|
|
1402
|
+
return this.resolveName({
|
|
1403
|
+
key: operationKey(node, "query", variant, "name"),
|
|
1404
|
+
name
|
|
1405
|
+
});
|
|
1380
1406
|
},
|
|
1381
1407
|
optionsName(node) {
|
|
1382
|
-
|
|
1408
|
+
const name = `${this.name(node.operationId)}${variant}QueryOptions`;
|
|
1409
|
+
return this.resolveName({
|
|
1410
|
+
key: operationKey(node, "query", variant, "optionsName"),
|
|
1411
|
+
name
|
|
1412
|
+
});
|
|
1383
1413
|
},
|
|
1384
1414
|
keyName(node) {
|
|
1385
|
-
|
|
1415
|
+
const name = `${this.name(node.operationId)}${variant}QueryKey`;
|
|
1416
|
+
return this.resolveName({
|
|
1417
|
+
key: operationKey(node, "query", variant, "keyName"),
|
|
1418
|
+
name
|
|
1419
|
+
});
|
|
1386
1420
|
},
|
|
1387
1421
|
keyTypeName(node) {
|
|
1388
|
-
|
|
1422
|
+
const name = `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
|
|
1423
|
+
return this.resolveName({
|
|
1424
|
+
key: operationKey(node, "query", variant, "keyTypeName"),
|
|
1425
|
+
name
|
|
1426
|
+
});
|
|
1389
1427
|
},
|
|
1390
1428
|
clientName(node) {
|
|
1391
|
-
|
|
1429
|
+
const name = `${this.name(node.operationId)}${variant}`;
|
|
1430
|
+
return this.resolveName({
|
|
1431
|
+
key: operationKey(node, "query", variant, "clientName"),
|
|
1432
|
+
name
|
|
1433
|
+
});
|
|
1392
1434
|
}
|
|
1393
1435
|
};
|
|
1394
1436
|
}
|
|
@@ -1405,10 +1447,18 @@ function createQueryResolver(variant = "") {
|
|
|
1405
1447
|
function createMutationResolver() {
|
|
1406
1448
|
return {
|
|
1407
1449
|
name(node) {
|
|
1408
|
-
|
|
1450
|
+
const name = `use${capitalize(this.name(node.operationId))}`;
|
|
1451
|
+
return this.resolveName({
|
|
1452
|
+
key: operationKey(node, "mutation", "name"),
|
|
1453
|
+
name
|
|
1454
|
+
});
|
|
1409
1455
|
},
|
|
1410
1456
|
keyName(node) {
|
|
1411
|
-
|
|
1457
|
+
const name = `${this.name(node.operationId)}MutationKey`;
|
|
1458
|
+
return this.resolveName({
|
|
1459
|
+
key: operationKey(node, "mutation", "keyName"),
|
|
1460
|
+
name
|
|
1461
|
+
});
|
|
1412
1462
|
}
|
|
1413
1463
|
};
|
|
1414
1464
|
}
|
|
@@ -2318,18 +2368,32 @@ const resolverReactQuery = (0, kubb_kit.createResolver)({
|
|
|
2318
2368
|
mutation: {
|
|
2319
2369
|
...createMutationResolver(),
|
|
2320
2370
|
optionsName(node) {
|
|
2321
|
-
|
|
2371
|
+
const name = `${this.name(node.operationId)}MutationOptions`;
|
|
2372
|
+
return this.resolveName({
|
|
2373
|
+
key: operationKey(node, "mutation", "optionsName"),
|
|
2374
|
+
name
|
|
2375
|
+
});
|
|
2322
2376
|
},
|
|
2323
2377
|
typeName(node) {
|
|
2324
|
-
|
|
2378
|
+
const name = capitalize(this.name(node.operationId));
|
|
2379
|
+
return this.resolveName({
|
|
2380
|
+
key: operationKey(node, "mutation", "typeName"),
|
|
2381
|
+
name
|
|
2382
|
+
});
|
|
2325
2383
|
}
|
|
2326
2384
|
},
|
|
2327
2385
|
hook: {
|
|
2328
2386
|
optionsName() {
|
|
2329
|
-
return
|
|
2387
|
+
return this.resolveName({
|
|
2388
|
+
key: ["hook", "options"],
|
|
2389
|
+
name: "HookOptions"
|
|
2390
|
+
});
|
|
2330
2391
|
},
|
|
2331
2392
|
customOptionsName() {
|
|
2332
|
-
return
|
|
2393
|
+
return this.resolveName({
|
|
2394
|
+
key: ["hook", "custom-options"],
|
|
2395
|
+
name: "getCustomHookOptions"
|
|
2396
|
+
});
|
|
2333
2397
|
}
|
|
2334
2398
|
}
|
|
2335
2399
|
});
|