@kubb/plugin-react-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-yMQOuFmI.cjs → components-B0j2b6y8.cjs} +99 -173
- package/dist/components-B0j2b6y8.cjs.map +1 -0
- package/dist/{components-DL0Cai7l.js → components-Ds-e_nnK.js} +99 -173
- package/dist/components-Ds-e_nnK.js.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-zGKP8yII.cjs → generators-CU6zfet7.cjs} +2 -2
- package/dist/{generators-zGKP8yII.cjs.map → generators-CU6zfet7.cjs.map} +1 -1
- package/dist/{generators-BG-Vcvfg.js → generators-nnZhtlrk.js} +2 -2
- package/dist/{generators-BG-Vcvfg.js.map → generators-nnZhtlrk.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-X7D0NSvJ.d.ts → types-ANQXv7Gr.d.ts} +3 -3
- package/package.json +8 -9
- package/dist/components-DL0Cai7l.js.map +0 -1
- package/dist/components-yMQOuFmI.cjs.map +0 -1
- package/src/components/InfiniteQuery.tsx +0 -166
- package/src/components/InfiniteQueryOptions.tsx +0 -166
- package/src/components/Mutation.tsx +0 -122
- package/src/components/MutationKey.tsx +0 -1
- package/src/components/MutationOptions.tsx +0 -104
- package/src/components/Query.tsx +0 -124
- package/src/components/QueryKey.tsx +0 -1
- package/src/components/QueryOptions.tsx +0 -85
- package/src/components/SuspenseInfiniteQuery.tsx +0 -161
- package/src/components/SuspenseInfiniteQueryOptions.tsx +0 -162
- package/src/components/SuspenseQuery.tsx +0 -119
- package/src/components/index.ts +0 -11
- package/src/generators/customHookOptionsFileGenerator.tsx +0 -90
- package/src/generators/hookOptionsGenerator.tsx +0 -129
- package/src/generators/index.ts +0 -7
- package/src/generators/infiniteQueryGenerator.tsx +0 -196
- package/src/generators/mutationGenerator.tsx +0 -172
- package/src/generators/queryGenerator.tsx +0 -181
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +0 -205
- package/src/generators/suspenseQueryGenerator.tsx +0 -184
- package/src/index.ts +0 -2
- package/src/plugin.ts +0 -203
- package/src/resolvers/resolverReactQuery.ts +0 -118
- package/src/types.ts +0 -361
- package/src/utils.ts +0 -18
|
@@ -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$10.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
|
});
|
|
@@ -498,107 +503,52 @@ function resolveZodSchemaNames(node, zodResolver, parser) {
|
|
|
498
503
|
].filter((n) => Boolean(n));
|
|
499
504
|
}
|
|
500
505
|
/**
|
|
501
|
-
* Resolve the type for a single path parameter.
|
|
502
|
-
*
|
|
503
|
-
* - When the resolver's group name differs from the individual param name
|
|
504
|
-
* (e.g. kubbV4) → `GroupName['paramName']` (member access).
|
|
505
|
-
* - When they match (v5 default) → `TypeName` (direct reference).
|
|
506
|
-
*/
|
|
507
|
-
function resolvePathParamType(node, param, resolver) {
|
|
508
|
-
const individualName = resolver.resolveParamName(node, param);
|
|
509
|
-
const groupName = resolver.resolvePathParamsName(node, param);
|
|
510
|
-
if (groupName !== individualName) return _kubb_core.ast.createParamsType({
|
|
511
|
-
variant: "member",
|
|
512
|
-
base: groupName,
|
|
513
|
-
key: param.name
|
|
514
|
-
});
|
|
515
|
-
return _kubb_core.ast.createParamsType({
|
|
516
|
-
variant: "reference",
|
|
517
|
-
name: individualName
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Derive a query-params group type from the resolver.
|
|
522
|
-
* Returns `null` when no query params exist or when the group name
|
|
523
|
-
* equals the individual param name (no real group).
|
|
524
|
-
*/
|
|
525
|
-
function resolveQueryGroupType(node, params, resolver) {
|
|
526
|
-
if (!params.length) return null;
|
|
527
|
-
const firstParam = params[0];
|
|
528
|
-
const groupName = resolver.resolveQueryParamsName(node, firstParam);
|
|
529
|
-
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
530
|
-
return {
|
|
531
|
-
type: _kubb_core.ast.createParamsType({
|
|
532
|
-
variant: "reference",
|
|
533
|
-
name: groupName
|
|
534
|
-
}),
|
|
535
|
-
optional: params.every((p) => !p.required)
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Build a single `FunctionParameterNode` for a query or header group.
|
|
540
|
-
*/
|
|
541
|
-
function buildGroupParam(name, node, params, groupType, resolver) {
|
|
542
|
-
if (groupType) return [_kubb_core.ast.createFunctionParameter({
|
|
543
|
-
name,
|
|
544
|
-
type: groupType.type,
|
|
545
|
-
optional: groupType.optional
|
|
546
|
-
})];
|
|
547
|
-
if (params.length) {
|
|
548
|
-
const structProps = params.map((p) => ({
|
|
549
|
-
name: p.name,
|
|
550
|
-
type: _kubb_core.ast.createParamsType({
|
|
551
|
-
variant: "reference",
|
|
552
|
-
name: resolver.resolveParamName(node, p)
|
|
553
|
-
}),
|
|
554
|
-
optional: !p.required
|
|
555
|
-
}));
|
|
556
|
-
return [_kubb_core.ast.createFunctionParameter({
|
|
557
|
-
name,
|
|
558
|
-
type: _kubb_core.ast.createParamsType({
|
|
559
|
-
variant: "struct",
|
|
560
|
-
properties: structProps
|
|
561
|
-
}),
|
|
562
|
-
optional: params.every((p) => !p.required)
|
|
563
|
-
})];
|
|
564
|
-
}
|
|
565
|
-
return [];
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
506
|
* Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).
|
|
569
507
|
*/
|
|
570
508
|
function buildQueryKeyParams(node, options) {
|
|
571
509
|
const { pathParamsType, paramsCasing, resolver } = options;
|
|
572
|
-
const casedParams =
|
|
510
|
+
const casedParams = (0, _kubb_ast_utils.caseParams)(node.parameters, paramsCasing);
|
|
573
511
|
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
574
512
|
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
575
|
-
const queryGroupType =
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
513
|
+
const queryGroupType = (0, _kubb_ast_utils.resolveGroupType)({
|
|
514
|
+
node,
|
|
515
|
+
params: queryParams,
|
|
516
|
+
group: "query",
|
|
517
|
+
resolver
|
|
518
|
+
});
|
|
519
|
+
const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
580
520
|
const bodyRequired = node.requestBody?.required ?? false;
|
|
581
521
|
const params = [];
|
|
582
522
|
if (pathParams.length) {
|
|
583
|
-
const pathChildren = pathParams.map((p) =>
|
|
523
|
+
const pathChildren = pathParams.map((p) => ({
|
|
584
524
|
name: p.name,
|
|
585
|
-
type:
|
|
525
|
+
type: (0, _kubb_ast_utils.resolveParamType)({
|
|
526
|
+
node,
|
|
527
|
+
param: p,
|
|
528
|
+
resolver
|
|
529
|
+
}),
|
|
586
530
|
optional: !p.required
|
|
587
531
|
}));
|
|
588
|
-
params.push({
|
|
589
|
-
kind: "ParameterGroup",
|
|
532
|
+
if (pathParamsType === "object") params.push(_kubb_core.ast.factory.createFunctionParameter({
|
|
590
533
|
properties: pathChildren,
|
|
591
|
-
inline: pathParamsType === "inline",
|
|
592
534
|
default: pathChildren.every((c) => c.optional) ? "{}" : void 0
|
|
593
|
-
});
|
|
535
|
+
}));
|
|
536
|
+
else params.push(...pathChildren.map((child) => _kubb_core.ast.factory.createFunctionParameter(child)));
|
|
594
537
|
}
|
|
595
|
-
if (bodyType) params.push(_kubb_core.ast.createFunctionParameter({
|
|
538
|
+
if (bodyType) params.push(_kubb_core.ast.factory.createFunctionParameter({
|
|
596
539
|
name: "data",
|
|
597
540
|
type: bodyType,
|
|
598
541
|
optional: !bodyRequired
|
|
599
542
|
}));
|
|
600
|
-
params.push(...
|
|
601
|
-
|
|
543
|
+
params.push(...(0, _kubb_ast_utils.buildGroupParam)({
|
|
544
|
+
name: "params",
|
|
545
|
+
node,
|
|
546
|
+
params: queryParams,
|
|
547
|
+
groupType: queryGroupType,
|
|
548
|
+
resolver,
|
|
549
|
+
wrapType: (type) => type
|
|
550
|
+
}));
|
|
551
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params });
|
|
602
552
|
}
|
|
603
553
|
/**
|
|
604
554
|
* Collect the names of the required params (no default) that drive the `enabled`
|
|
@@ -607,12 +557,11 @@ function buildQueryKeyParams(node, options) {
|
|
|
607
557
|
*/
|
|
608
558
|
function getEnabledParamNames(paramsNode) {
|
|
609
559
|
const required = [];
|
|
610
|
-
for (const param of paramsNode.params)
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
if (!fp.optional && fp.default === void 0) required.push(fp.name);
|
|
560
|
+
for (const param of paramsNode.params) {
|
|
561
|
+
const members = groupMembers(param);
|
|
562
|
+
if (members) {
|
|
563
|
+
for (const member of members) if (!member.optional) required.push(member.name);
|
|
564
|
+
} else if (typeof param.name === "string" && !param.optional && param.default === void 0) required.push(param.name);
|
|
616
565
|
}
|
|
617
566
|
return required;
|
|
618
567
|
}
|
|
@@ -628,27 +577,25 @@ function markParamsOptional(paramsNode, names) {
|
|
|
628
577
|
if (names.length === 0) return paramsNode;
|
|
629
578
|
const nameSet = new Set(names);
|
|
630
579
|
const params = paramsNode.params.map((param) => {
|
|
631
|
-
|
|
632
|
-
|
|
580
|
+
const members = groupMembers(param);
|
|
581
|
+
if (members) {
|
|
582
|
+
const next = members.map((member) => nameSet.has(member.name) ? {
|
|
583
|
+
...member,
|
|
584
|
+
optional: true
|
|
585
|
+
} : member);
|
|
633
586
|
return {
|
|
634
|
-
...
|
|
635
|
-
|
|
636
|
-
name: child.name,
|
|
637
|
-
type: child.type,
|
|
638
|
-
rest: child.rest,
|
|
639
|
-
optional: true
|
|
640
|
-
}) : child)
|
|
587
|
+
...param,
|
|
588
|
+
type: _kubb_core.ast.factory.createTypeLiteral({ members: next })
|
|
641
589
|
};
|
|
642
590
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
rest: fp.rest,
|
|
591
|
+
return typeof param.name === "string" && nameSet.has(param.name) ? _kubb_core.ast.factory.createFunctionParameter({
|
|
592
|
+
name: param.name,
|
|
593
|
+
type: param.type,
|
|
594
|
+
rest: param.rest,
|
|
648
595
|
optional: true
|
|
649
|
-
}) :
|
|
596
|
+
}) : param;
|
|
650
597
|
});
|
|
651
|
-
return _kubb_core.ast.createFunctionParameters({ params });
|
|
598
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params });
|
|
652
599
|
}
|
|
653
600
|
/**
|
|
654
601
|
* Add a non-null assertion (`!`) to the named params inside a printed client-call
|
|
@@ -776,18 +723,15 @@ const callPrinter$7 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
|
776
723
|
function buildInfiniteQueryParamsNode(node, options) {
|
|
777
724
|
const { paramsType, paramsCasing, pathParamsType, resolver, pageParamGeneric } = options;
|
|
778
725
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
779
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
726
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
780
727
|
name: "options",
|
|
781
|
-
type:
|
|
782
|
-
variant: "reference",
|
|
783
|
-
name: `{
|
|
728
|
+
type: `{
|
|
784
729
|
query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
|
|
785
730
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
786
|
-
}
|
|
787
|
-
}),
|
|
731
|
+
}`,
|
|
788
732
|
default: "{}"
|
|
789
733
|
});
|
|
790
|
-
return
|
|
734
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
791
735
|
paramsType,
|
|
792
736
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
793
737
|
paramsCasing,
|
|
@@ -976,14 +920,11 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
|
|
|
976
920
|
//#region src/components/MutationOptions.tsx
|
|
977
921
|
const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
978
922
|
const callPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
979
|
-
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "
|
|
923
|
+
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
980
924
|
function buildMutationConfigParamsNode(node, resolver) {
|
|
981
|
-
return _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
|
|
925
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params: [_kubb_core.ast.factory.createFunctionParameter({
|
|
982
926
|
name: "config",
|
|
983
|
-
type:
|
|
984
|
-
variant: "reference",
|
|
985
|
-
name: buildRequestConfigType(node, resolver)
|
|
986
|
-
}),
|
|
927
|
+
type: buildRequestConfigType(node, resolver),
|
|
987
928
|
default: "{}"
|
|
988
929
|
})] });
|
|
989
930
|
}
|
|
@@ -995,7 +936,7 @@ function MutationOptions({ name, clientName, dataReturnType, node, tsResolver, p
|
|
|
995
936
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
996
937
|
const configParamsNode = buildMutationConfigParamsNode(node, tsResolver);
|
|
997
938
|
const paramsSignature = declarationPrinter$5.print(configParamsNode) ?? "";
|
|
998
|
-
const mutationArgParamsNode =
|
|
939
|
+
const mutationArgParamsNode = (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
999
940
|
paramsType: "inline",
|
|
1000
941
|
pathParamsType: "inline",
|
|
1001
942
|
paramsCasing,
|
|
@@ -1004,17 +945,14 @@ function MutationOptions({ name, clientName, dataReturnType, node, tsResolver, p
|
|
|
1004
945
|
const hasMutationParams = mutationArgParamsNode.params.length > 0;
|
|
1005
946
|
const TRequest = hasMutationParams ? declarationPrinter$5.print(mutationArgParamsNode) ?? "" : "";
|
|
1006
947
|
const argKeysStr = hasMutationParams ? keysPrinter.print(mutationArgParamsNode) ?? "" : "";
|
|
1007
|
-
const clientCallParamsNode =
|
|
948
|
+
const clientCallParamsNode = (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1008
949
|
paramsType,
|
|
1009
950
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1010
951
|
paramsCasing,
|
|
1011
952
|
resolver: tsResolver,
|
|
1012
|
-
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
953
|
+
extraParams: [_kubb_core.ast.factory.createFunctionParameter({
|
|
1013
954
|
name: "config",
|
|
1014
|
-
type:
|
|
1015
|
-
variant: "reference",
|
|
1016
|
-
name: buildRequestConfigType(node, tsResolver)
|
|
1017
|
-
}),
|
|
955
|
+
type: buildRequestConfigType(node, tsResolver),
|
|
1018
956
|
default: "{}"
|
|
1019
957
|
})]
|
|
1020
958
|
});
|
|
@@ -1045,7 +983,7 @@ function MutationOptions({ name, clientName, dataReturnType, node, tsResolver, p
|
|
|
1045
983
|
const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1046
984
|
const callPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1047
985
|
function createMutationArgParams(node, options) {
|
|
1048
|
-
return
|
|
986
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1049
987
|
paramsType: "inline",
|
|
1050
988
|
pathParamsType: "inline",
|
|
1051
989
|
paramsCasing: options.paramsCasing,
|
|
@@ -1070,15 +1008,12 @@ function buildMutationParamsNode(node, options) {
|
|
|
1070
1008
|
TRequest ? `{${TRequest}}` : "undefined",
|
|
1071
1009
|
"TContext"
|
|
1072
1010
|
].join(", ");
|
|
1073
|
-
return _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
|
|
1011
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params: [_kubb_core.ast.factory.createFunctionParameter({
|
|
1074
1012
|
name: "options",
|
|
1075
|
-
type:
|
|
1076
|
-
variant: "reference",
|
|
1077
|
-
name: `{
|
|
1013
|
+
type: `{
|
|
1078
1014
|
mutation?: UseMutationOptions<${generics}> & { client?: QueryClient },
|
|
1079
1015
|
client?: ${buildRequestConfigType(node, resolver)},
|
|
1080
|
-
}
|
|
1081
|
-
}),
|
|
1016
|
+
}`,
|
|
1082
1017
|
default: "{}"
|
|
1083
1018
|
})] });
|
|
1084
1019
|
}
|
|
@@ -1146,24 +1081,21 @@ function buildQueryParamsNode(node, options) {
|
|
|
1146
1081
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1147
1082
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1148
1083
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1149
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
1084
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
1150
1085
|
name: "options",
|
|
1151
|
-
type:
|
|
1152
|
-
variant: "reference",
|
|
1153
|
-
name: `{
|
|
1086
|
+
type: `{
|
|
1154
1087
|
query?: Partial<QueryObserverOptions<${[
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1088
|
+
TData,
|
|
1089
|
+
TError,
|
|
1090
|
+
"TData",
|
|
1091
|
+
"TQueryData",
|
|
1092
|
+
"TQueryKey"
|
|
1093
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
1161
1094
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1162
|
-
}
|
|
1163
|
-
}),
|
|
1095
|
+
}`,
|
|
1164
1096
|
default: "{}"
|
|
1165
1097
|
});
|
|
1166
|
-
return
|
|
1098
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1167
1099
|
paramsType,
|
|
1168
1100
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1169
1101
|
paramsCasing,
|
|
@@ -1240,18 +1172,15 @@ const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
|
1240
1172
|
function buildSuspenseInfiniteQueryParamsNode(node, options) {
|
|
1241
1173
|
const { paramsType, paramsCasing, pathParamsType, resolver, pageParamGeneric } = options;
|
|
1242
1174
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
1243
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
1175
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
1244
1176
|
name: "options",
|
|
1245
|
-
type:
|
|
1246
|
-
variant: "reference",
|
|
1247
|
-
name: `{
|
|
1177
|
+
type: `{
|
|
1248
1178
|
query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
|
|
1249
1179
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1250
|
-
}
|
|
1251
|
-
}),
|
|
1180
|
+
}`,
|
|
1252
1181
|
default: "{}"
|
|
1253
1182
|
});
|
|
1254
|
-
return
|
|
1183
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1255
1184
|
paramsType,
|
|
1256
1185
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1257
1186
|
paramsCasing,
|
|
@@ -1445,23 +1374,20 @@ function buildSuspenseQueryParamsNode(node, options) {
|
|
|
1445
1374
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1446
1375
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1447
1376
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1448
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
1377
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
1449
1378
|
name: "options",
|
|
1450
|
-
type:
|
|
1451
|
-
variant: "reference",
|
|
1452
|
-
name: `{
|
|
1379
|
+
type: `{
|
|
1453
1380
|
query?: Partial<UseSuspenseQueryOptions<${[
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1381
|
+
TData,
|
|
1382
|
+
TError,
|
|
1383
|
+
"TData",
|
|
1384
|
+
"TQueryKey"
|
|
1385
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
1459
1386
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1460
|
-
}
|
|
1461
|
-
}),
|
|
1387
|
+
}`,
|
|
1462
1388
|
default: "{}"
|
|
1463
1389
|
});
|
|
1464
|
-
return
|
|
1390
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
1465
1391
|
paramsType,
|
|
1466
1392
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1467
1393
|
paramsCasing,
|
|
@@ -1654,4 +1580,4 @@ Object.defineProperty(exports, "resolveZodSchemaNames", {
|
|
|
1654
1580
|
}
|
|
1655
1581
|
});
|
|
1656
1582
|
|
|
1657
|
-
//# sourceMappingURL=components-
|
|
1583
|
+
//# sourceMappingURL=components-B0j2b6y8.cjs.map
|