@kubb/plugin-vue-query 5.0.0-beta.56 → 5.0.0-beta.64
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-B79Gljyl.js → components-CAlEf7Oh.js} +114 -191
- package/dist/components-CAlEf7Oh.js.map +1 -0
- package/dist/{components-D3xIZ9FA.cjs → components-CfU59l8V.cjs} +113 -190
- package/dist/components-CfU59l8V.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-BTtcGtUY.cjs → generators-DpMLVmyi.cjs} +2 -2
- package/dist/{generators-BTtcGtUY.cjs.map → generators-DpMLVmyi.cjs.map} +1 -1
- package/dist/{generators-D95ddIFV.js → generators-fWBjs0CN.js} +2 -2
- package/dist/{generators-D95ddIFV.js.map → generators-fWBjs0CN.js.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/{types-CwabLiFK.d.ts → types-C6a_58nb.d.ts} +3 -3
- package/package.json +8 -9
- package/dist/components-B79Gljyl.js.map +0 -1
- package/dist/components-D3xIZ9FA.cjs.map +0 -1
- package/src/components/InfiniteQuery.tsx +0 -127
- package/src/components/InfiniteQueryOptions.tsx +0 -191
- package/src/components/Mutation.tsx +0 -150
- package/src/components/MutationKey.tsx +0 -1
- package/src/components/Query.tsx +0 -126
- package/src/components/QueryKey.tsx +0 -52
- package/src/components/QueryOptions.tsx +0 -116
- package/src/components/index.ts +0 -7
- package/src/generators/index.ts +0 -3
- package/src/generators/infiniteQueryGenerator.tsx +0 -196
- package/src/generators/mutationGenerator.tsx +0 -157
- package/src/generators/queryGenerator.tsx +0 -180
- package/src/index.ts +0 -2
- package/src/plugin.ts +0 -183
- package/src/resolvers/resolverVueQuery.ts +0 -76
- package/src/types.ts +0 -268
- package/src/utils.ts +0 -57
|
@@ -25,10 +25,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
27
|
let _kubb_core = require("@kubb/core");
|
|
28
|
+
let _kubb_ast_utils = require("@kubb/ast/utils");
|
|
28
29
|
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
29
30
|
let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
|
|
30
31
|
let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
|
|
31
|
-
let _kubb_ast_utils = require("@kubb/ast/utils");
|
|
32
32
|
//#region ../../internals/utils/src/casing.ts
|
|
33
33
|
/**
|
|
34
34
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -303,7 +303,7 @@ function buildOperationComments(node, options = {}) {
|
|
|
303
303
|
return filteredComments.flatMap((text) => text.split(/\r?\n/).map((line) => line.trim())).filter((comment) => Boolean(comment));
|
|
304
304
|
}
|
|
305
305
|
function getOperationParameters(node, options = {}) {
|
|
306
|
-
const params =
|
|
306
|
+
const params = (0, _kubb_ast_utils.caseParams)(node.parameters, options.paramsCasing);
|
|
307
307
|
return {
|
|
308
308
|
path: params.filter((param) => param.in === "path"),
|
|
309
309
|
query: params.filter((param) => param.in === "query"),
|
|
@@ -385,7 +385,7 @@ const mutationKeyTransformer = ({ node }) => {
|
|
|
385
385
|
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
386
386
|
};
|
|
387
387
|
function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
388
|
-
const paramsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
|
|
388
|
+
const paramsNode = _kubb_core.ast.factory.createFunctionParameters({ params: [] });
|
|
389
389
|
const paramsSignature = declarationPrinter$7.print(paramsNode) ?? "";
|
|
390
390
|
const keys = (transformer ?? mutationKeyTransformer)({
|
|
391
391
|
node,
|
|
@@ -407,6 +407,14 @@ function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
|
407
407
|
//#endregion
|
|
408
408
|
//#region ../../internals/tanstack-query/src/utils.ts
|
|
409
409
|
/**
|
|
410
|
+
* Returns the `TypeLiteral` members of a destructured group parameter, or `null`
|
|
411
|
+
* for a plain named parameter.
|
|
412
|
+
*/
|
|
413
|
+
function groupMembers(param) {
|
|
414
|
+
if (typeof param.name === "string") return null;
|
|
415
|
+
return param.type && typeof param.type !== "string" && param.type.kind === "TypeLiteral" ? param.type.members : [];
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
410
418
|
* Builds the shared `(…params, config = {})` parameter list for a TanStack
|
|
411
419
|
* query-options function. The trailing `config` parameter is typed as a partial
|
|
412
420
|
* `RequestConfig` with an optional `client`. Framework plugins wrap the result
|
|
@@ -415,17 +423,14 @@ function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
|
415
423
|
function buildQueryOptionsParams(node, options) {
|
|
416
424
|
const { paramsType, paramsCasing, pathParamsType, resolver } = options;
|
|
417
425
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
|
|
418
|
-
return
|
|
426
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
419
427
|
paramsType,
|
|
420
428
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
421
429
|
paramsCasing,
|
|
422
430
|
resolver,
|
|
423
|
-
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
431
|
+
extraParams: [_kubb_core.ast.factory.createFunctionParameter({
|
|
424
432
|
name: "config",
|
|
425
|
-
type:
|
|
426
|
-
variant: "reference",
|
|
427
|
-
name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
|
|
428
|
-
}),
|
|
433
|
+
type: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }",
|
|
429
434
|
default: "{}"
|
|
430
435
|
})]
|
|
431
436
|
});
|
|
@@ -476,107 +481,52 @@ function resolveZodSchemaNames(node, zodResolver, parser) {
|
|
|
476
481
|
].filter((n) => Boolean(n));
|
|
477
482
|
}
|
|
478
483
|
/**
|
|
479
|
-
* Resolve the type for a single path parameter.
|
|
480
|
-
*
|
|
481
|
-
* - When the resolver's group name differs from the individual param name
|
|
482
|
-
* (e.g. kubbV4) → `GroupName['paramName']` (member access).
|
|
483
|
-
* - When they match (v5 default) → `TypeName` (direct reference).
|
|
484
|
-
*/
|
|
485
|
-
function resolvePathParamType(node, param, resolver) {
|
|
486
|
-
const individualName = resolver.resolveParamName(node, param);
|
|
487
|
-
const groupName = resolver.resolvePathParamsName(node, param);
|
|
488
|
-
if (groupName !== individualName) return _kubb_core.ast.createParamsType({
|
|
489
|
-
variant: "member",
|
|
490
|
-
base: groupName,
|
|
491
|
-
key: param.name
|
|
492
|
-
});
|
|
493
|
-
return _kubb_core.ast.createParamsType({
|
|
494
|
-
variant: "reference",
|
|
495
|
-
name: individualName
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Derive a query-params group type from the resolver.
|
|
500
|
-
* Returns `null` when no query params exist or when the group name
|
|
501
|
-
* equals the individual param name (no real group).
|
|
502
|
-
*/
|
|
503
|
-
function resolveQueryGroupType(node, params, resolver) {
|
|
504
|
-
if (!params.length) return null;
|
|
505
|
-
const firstParam = params[0];
|
|
506
|
-
const groupName = resolver.resolveQueryParamsName(node, firstParam);
|
|
507
|
-
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
508
|
-
return {
|
|
509
|
-
type: _kubb_core.ast.createParamsType({
|
|
510
|
-
variant: "reference",
|
|
511
|
-
name: groupName
|
|
512
|
-
}),
|
|
513
|
-
optional: params.every((p) => !p.required)
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Build a single `FunctionParameterNode` for a query or header group.
|
|
518
|
-
*/
|
|
519
|
-
function buildGroupParam(name, node, params, groupType, resolver) {
|
|
520
|
-
if (groupType) return [_kubb_core.ast.createFunctionParameter({
|
|
521
|
-
name,
|
|
522
|
-
type: groupType.type,
|
|
523
|
-
optional: groupType.optional
|
|
524
|
-
})];
|
|
525
|
-
if (params.length) {
|
|
526
|
-
const structProps = params.map((p) => ({
|
|
527
|
-
name: p.name,
|
|
528
|
-
type: _kubb_core.ast.createParamsType({
|
|
529
|
-
variant: "reference",
|
|
530
|
-
name: resolver.resolveParamName(node, p)
|
|
531
|
-
}),
|
|
532
|
-
optional: !p.required
|
|
533
|
-
}));
|
|
534
|
-
return [_kubb_core.ast.createFunctionParameter({
|
|
535
|
-
name,
|
|
536
|
-
type: _kubb_core.ast.createParamsType({
|
|
537
|
-
variant: "struct",
|
|
538
|
-
properties: structProps
|
|
539
|
-
}),
|
|
540
|
-
optional: params.every((p) => !p.required)
|
|
541
|
-
})];
|
|
542
|
-
}
|
|
543
|
-
return [];
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
484
|
* Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).
|
|
547
485
|
*/
|
|
548
486
|
function buildQueryKeyParams(node, options) {
|
|
549
487
|
const { pathParamsType, paramsCasing, resolver } = options;
|
|
550
|
-
const casedParams =
|
|
488
|
+
const casedParams = (0, _kubb_ast_utils.caseParams)(node.parameters, paramsCasing);
|
|
551
489
|
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
552
490
|
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
553
|
-
const queryGroupType =
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
491
|
+
const queryGroupType = (0, _kubb_ast_utils.resolveGroupType)({
|
|
492
|
+
node,
|
|
493
|
+
params: queryParams,
|
|
494
|
+
group: "query",
|
|
495
|
+
resolver
|
|
496
|
+
});
|
|
497
|
+
const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
558
498
|
const bodyRequired = node.requestBody?.required ?? false;
|
|
559
499
|
const params = [];
|
|
560
500
|
if (pathParams.length) {
|
|
561
|
-
const pathChildren = pathParams.map((p) =>
|
|
501
|
+
const pathChildren = pathParams.map((p) => ({
|
|
562
502
|
name: p.name,
|
|
563
|
-
type:
|
|
503
|
+
type: (0, _kubb_ast_utils.resolveParamType)({
|
|
504
|
+
node,
|
|
505
|
+
param: p,
|
|
506
|
+
resolver
|
|
507
|
+
}),
|
|
564
508
|
optional: !p.required
|
|
565
509
|
}));
|
|
566
|
-
params.push({
|
|
567
|
-
kind: "ParameterGroup",
|
|
510
|
+
if (pathParamsType === "object") params.push(_kubb_core.ast.factory.createFunctionParameter({
|
|
568
511
|
properties: pathChildren,
|
|
569
|
-
inline: pathParamsType === "inline",
|
|
570
512
|
default: pathChildren.every((c) => c.optional) ? "{}" : void 0
|
|
571
|
-
});
|
|
513
|
+
}));
|
|
514
|
+
else params.push(...pathChildren.map((child) => _kubb_core.ast.factory.createFunctionParameter(child)));
|
|
572
515
|
}
|
|
573
|
-
if (bodyType) params.push(_kubb_core.ast.createFunctionParameter({
|
|
516
|
+
if (bodyType) params.push(_kubb_core.ast.factory.createFunctionParameter({
|
|
574
517
|
name: "data",
|
|
575
518
|
type: bodyType,
|
|
576
519
|
optional: !bodyRequired
|
|
577
520
|
}));
|
|
578
|
-
params.push(...
|
|
579
|
-
|
|
521
|
+
params.push(...(0, _kubb_ast_utils.buildGroupParam)({
|
|
522
|
+
name: "params",
|
|
523
|
+
node,
|
|
524
|
+
params: queryParams,
|
|
525
|
+
groupType: queryGroupType,
|
|
526
|
+
resolver,
|
|
527
|
+
wrapType: (type) => type
|
|
528
|
+
}));
|
|
529
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params });
|
|
580
530
|
}
|
|
581
531
|
/**
|
|
582
532
|
* Collect the names of the required params (no default) that drive the `enabled`
|
|
@@ -585,12 +535,11 @@ function buildQueryKeyParams(node, options) {
|
|
|
585
535
|
*/
|
|
586
536
|
function getEnabledParamNames(paramsNode) {
|
|
587
537
|
const required = [];
|
|
588
|
-
for (const param of paramsNode.params)
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
if (!fp.optional && fp.default === void 0) required.push(fp.name);
|
|
538
|
+
for (const param of paramsNode.params) {
|
|
539
|
+
const members = groupMembers(param);
|
|
540
|
+
if (members) {
|
|
541
|
+
for (const member of members) if (!member.optional) required.push(member.name);
|
|
542
|
+
} else if (typeof param.name === "string" && !param.optional && param.default === void 0) required.push(param.name);
|
|
594
543
|
}
|
|
595
544
|
return required;
|
|
596
545
|
}
|
|
@@ -606,27 +555,25 @@ function markParamsOptional(paramsNode, names) {
|
|
|
606
555
|
if (names.length === 0) return paramsNode;
|
|
607
556
|
const nameSet = new Set(names);
|
|
608
557
|
const params = paramsNode.params.map((param) => {
|
|
609
|
-
|
|
610
|
-
|
|
558
|
+
const members = groupMembers(param);
|
|
559
|
+
if (members) {
|
|
560
|
+
const next = members.map((member) => nameSet.has(member.name) ? {
|
|
561
|
+
...member,
|
|
562
|
+
optional: true
|
|
563
|
+
} : member);
|
|
611
564
|
return {
|
|
612
|
-
...
|
|
613
|
-
|
|
614
|
-
name: child.name,
|
|
615
|
-
type: child.type,
|
|
616
|
-
rest: child.rest,
|
|
617
|
-
optional: true
|
|
618
|
-
}) : child)
|
|
565
|
+
...param,
|
|
566
|
+
type: _kubb_core.ast.factory.createTypeLiteral({ members: next })
|
|
619
567
|
};
|
|
620
568
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
rest: fp.rest,
|
|
569
|
+
return typeof param.name === "string" && nameSet.has(param.name) ? _kubb_core.ast.factory.createFunctionParameter({
|
|
570
|
+
name: param.name,
|
|
571
|
+
type: param.type,
|
|
572
|
+
rest: param.rest,
|
|
626
573
|
optional: true
|
|
627
|
-
}) :
|
|
574
|
+
}) : param;
|
|
628
575
|
});
|
|
629
|
-
return _kubb_core.ast.createFunctionParameters({ params });
|
|
576
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params });
|
|
630
577
|
}
|
|
631
578
|
(0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
632
579
|
const queryKeyTransformer = ({ node, casing }) => {
|
|
@@ -645,43 +592,31 @@ const queryKeyTransformer = ({ node, casing }) => {
|
|
|
645
592
|
};
|
|
646
593
|
//#endregion
|
|
647
594
|
//#region src/utils.ts
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
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";
|
|
658
|
-
}
|
|
595
|
+
/**
|
|
596
|
+
* Wraps each parameter type in `MaybeRefOrGetter<…>` so a vue-query signature
|
|
597
|
+
* accepts refs or getters. Group members are wrapped individually; `skip` opts a
|
|
598
|
+
* plain parameter out by name.
|
|
599
|
+
*/
|
|
659
600
|
function wrapWithMaybeRefOrGetter(paramsNode, skip) {
|
|
660
601
|
const wrappedParams = paramsNode.params.map((param) => {
|
|
661
|
-
if (
|
|
662
|
-
const
|
|
663
|
-
return {
|
|
664
|
-
...
|
|
665
|
-
|
|
666
|
-
...
|
|
667
|
-
type:
|
|
668
|
-
|
|
669
|
-
name: `MaybeRefOrGetter<${printType(p.type)}>`
|
|
670
|
-
}) : p.type
|
|
671
|
-
}))
|
|
602
|
+
if (typeof param.name !== "string") {
|
|
603
|
+
const type = param.type;
|
|
604
|
+
if (type && typeof type !== "string" && type.kind === "TypeLiteral") return {
|
|
605
|
+
...param,
|
|
606
|
+
type: _kubb_core.ast.factory.createTypeLiteral({ members: type.members.map((member) => ({
|
|
607
|
+
...member,
|
|
608
|
+
type: `MaybeRefOrGetter<${(0, _kubb_plugin_ts.renderType)(member.type)}>`
|
|
609
|
+
})) })
|
|
672
610
|
};
|
|
611
|
+
return param;
|
|
673
612
|
}
|
|
674
|
-
|
|
675
|
-
if (skip?.(fp.name)) return fp;
|
|
613
|
+
if (skip?.(param.name)) return param;
|
|
676
614
|
return {
|
|
677
|
-
...
|
|
678
|
-
type:
|
|
679
|
-
variant: "reference",
|
|
680
|
-
name: `MaybeRefOrGetter<${printType(fp.type)}>`
|
|
681
|
-
}) : fp.type
|
|
615
|
+
...param,
|
|
616
|
+
type: param.type ? `MaybeRefOrGetter<${(0, _kubb_plugin_ts.renderType)(param.type)}>` : param.type
|
|
682
617
|
};
|
|
683
618
|
});
|
|
684
|
-
return _kubb_core.ast.createFunctionParameters({ params: wrappedParams });
|
|
619
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params: wrappedParams });
|
|
685
620
|
}
|
|
686
621
|
//#endregion
|
|
687
622
|
//#region src/components/QueryKey.tsx
|
|
@@ -806,24 +741,21 @@ function buildInfiniteQueryParamsNode(node, options) {
|
|
|
806
741
|
const errorNames = resolveErrorNames(node, resolver);
|
|
807
742
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
808
743
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
809
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
744
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
810
745
|
name: "options",
|
|
811
|
-
type:
|
|
812
|
-
variant: "reference",
|
|
813
|
-
name: `{
|
|
746
|
+
type: `{
|
|
814
747
|
query?: Partial<UseInfiniteQueryOptions<${[
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
748
|
+
TData,
|
|
749
|
+
TError,
|
|
750
|
+
"TQueryData",
|
|
751
|
+
"TQueryKey",
|
|
752
|
+
"TQueryData"
|
|
753
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
821
754
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
822
|
-
}
|
|
823
|
-
}),
|
|
755
|
+
}`,
|
|
824
756
|
default: "{}"
|
|
825
757
|
});
|
|
826
|
-
return wrapWithMaybeRefOrGetter(
|
|
758
|
+
return wrapWithMaybeRefOrGetter((0, _kubb_ast_utils.createOperationParams)(node, {
|
|
827
759
|
paramsType,
|
|
828
760
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
829
761
|
paramsCasing,
|
|
@@ -1009,9 +941,9 @@ function addToValueCalls(callStr, enabledNames = []) {
|
|
|
1009
941
|
//#region src/components/Mutation.tsx
|
|
1010
942
|
const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1011
943
|
const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1012
|
-
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "
|
|
944
|
+
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1013
945
|
function createMutationArgParams(node, options) {
|
|
1014
|
-
return
|
|
946
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1015
947
|
paramsType: "inline",
|
|
1016
948
|
pathParamsType: "inline",
|
|
1017
949
|
paramsCasing: options.paramsCasing,
|
|
@@ -1030,20 +962,17 @@ function buildMutationParamsNode(node, options) {
|
|
|
1030
962
|
resolver
|
|
1031
963
|
}));
|
|
1032
964
|
const TRequestWrapped = wrappedParamsNode.params.length > 0 ? declarationPrinter$1.print(wrappedParamsNode) ?? "" : "";
|
|
1033
|
-
return _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
|
|
965
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params: [_kubb_core.ast.factory.createFunctionParameter({
|
|
1034
966
|
name: "options",
|
|
1035
|
-
type:
|
|
1036
|
-
variant: "reference",
|
|
1037
|
-
name: `{
|
|
967
|
+
type: `{
|
|
1038
968
|
mutation?: MutationObserverOptions<${[
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
969
|
+
TData,
|
|
970
|
+
TError,
|
|
971
|
+
TRequestWrapped ? `{${TRequestWrapped}}` : "undefined",
|
|
972
|
+
"TContext"
|
|
973
|
+
].join(", ")}> & { client?: QueryClient },
|
|
1044
974
|
client?: ${buildRequestConfigType(node, resolver)},
|
|
1045
|
-
}
|
|
1046
|
-
}),
|
|
975
|
+
}`,
|
|
1047
976
|
default: "{}"
|
|
1048
977
|
})] });
|
|
1049
978
|
}
|
|
@@ -1066,19 +995,16 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
1066
995
|
TRequest ? `{${TRequest}}` : "undefined",
|
|
1067
996
|
"TContext"
|
|
1068
997
|
].join(", ");
|
|
1069
|
-
const mutationKeyParamsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
|
|
998
|
+
const mutationKeyParamsNode = _kubb_core.ast.factory.createFunctionParameters({ params: [] });
|
|
1070
999
|
const mutationKeyParamsCall = callPrinter$1.print(mutationKeyParamsNode) ?? "";
|
|
1071
|
-
const clientCallParamsNode =
|
|
1000
|
+
const clientCallParamsNode = (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1072
1001
|
paramsType,
|
|
1073
1002
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1074
1003
|
paramsCasing,
|
|
1075
1004
|
resolver: tsResolver,
|
|
1076
|
-
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
1005
|
+
extraParams: [_kubb_core.ast.factory.createFunctionParameter({
|
|
1077
1006
|
name: "config",
|
|
1078
|
-
type:
|
|
1079
|
-
variant: "reference",
|
|
1080
|
-
name: buildRequestConfigType(node, tsResolver)
|
|
1081
|
-
}),
|
|
1007
|
+
type: buildRequestConfigType(node, tsResolver),
|
|
1082
1008
|
default: "{}"
|
|
1083
1009
|
})]
|
|
1084
1010
|
});
|
|
@@ -1127,24 +1053,21 @@ function buildQueryParamsNode(node, options) {
|
|
|
1127
1053
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1128
1054
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1129
1055
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1130
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
1056
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
1131
1057
|
name: "options",
|
|
1132
|
-
type:
|
|
1133
|
-
variant: "reference",
|
|
1134
|
-
name: `{
|
|
1058
|
+
type: `{
|
|
1135
1059
|
query?: Partial<UseQueryOptions<${[
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1060
|
+
TData,
|
|
1061
|
+
TError,
|
|
1062
|
+
"TData",
|
|
1063
|
+
"TQueryData",
|
|
1064
|
+
"TQueryKey"
|
|
1065
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
1142
1066
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1143
|
-
}
|
|
1144
|
-
}),
|
|
1067
|
+
}`,
|
|
1145
1068
|
default: "{}"
|
|
1146
1069
|
});
|
|
1147
|
-
return wrapWithMaybeRefOrGetter(
|
|
1070
|
+
return wrapWithMaybeRefOrGetter((0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1148
1071
|
paramsType,
|
|
1149
1072
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1150
1073
|
paramsCasing,
|
|
@@ -1312,4 +1235,4 @@ Object.defineProperty(exports, "resolveZodSchemaNames", {
|
|
|
1312
1235
|
}
|
|
1313
1236
|
});
|
|
1314
1237
|
|
|
1315
|
-
//# sourceMappingURL=components-
|
|
1238
|
+
//# sourceMappingURL=components-CfU59l8V.cjs.map
|