@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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./chunk-C0LytTxp.js";
|
|
2
2
|
import { ast } from "@kubb/core";
|
|
3
|
+
import { buildGroupParam, caseParams, createOperationParams, getNestedAccessor, resolveGroupType, resolveParamType } from "@kubb/ast/utils";
|
|
3
4
|
import { functionPrinter } from "@kubb/plugin-ts";
|
|
4
5
|
import { File, Function, Type } from "@kubb/renderer-jsx";
|
|
5
6
|
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
6
|
-
import { getNestedAccessor } from "@kubb/ast/utils";
|
|
7
7
|
//#region ../../internals/utils/src/casing.ts
|
|
8
8
|
/**
|
|
9
9
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -278,7 +278,7 @@ function buildOperationComments(node, options = {}) {
|
|
|
278
278
|
return filteredComments.flatMap((text) => text.split(/\r?\n/).map((line) => line.trim())).filter((comment) => Boolean(comment));
|
|
279
279
|
}
|
|
280
280
|
function getOperationParameters(node, options = {}) {
|
|
281
|
-
const params =
|
|
281
|
+
const params = caseParams(node.parameters, options.paramsCasing);
|
|
282
282
|
return {
|
|
283
283
|
path: params.filter((param) => param.in === "path"),
|
|
284
284
|
query: params.filter((param) => param.in === "query"),
|
|
@@ -360,7 +360,7 @@ const mutationKeyTransformer = ({ node }) => {
|
|
|
360
360
|
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
361
361
|
};
|
|
362
362
|
function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
363
|
-
const paramsNode = ast.createFunctionParameters({ params: [] });
|
|
363
|
+
const paramsNode = ast.factory.createFunctionParameters({ params: [] });
|
|
364
364
|
const paramsSignature = declarationPrinter$10.print(paramsNode) ?? "";
|
|
365
365
|
const keys = (transformer ?? mutationKeyTransformer)({
|
|
366
366
|
node,
|
|
@@ -382,6 +382,14 @@ function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region ../../internals/tanstack-query/src/utils.ts
|
|
384
384
|
/**
|
|
385
|
+
* Returns the `TypeLiteral` members of a destructured group parameter, or `null`
|
|
386
|
+
* for a plain named parameter.
|
|
387
|
+
*/
|
|
388
|
+
function groupMembers(param) {
|
|
389
|
+
if (typeof param.name === "string") return null;
|
|
390
|
+
return param.type && typeof param.type !== "string" && param.type.kind === "TypeLiteral" ? param.type.members : [];
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
385
393
|
* Builds the shared `(…params, config = {})` parameter list for a TanStack
|
|
386
394
|
* query-options function. The trailing `config` parameter is typed as a partial
|
|
387
395
|
* `RequestConfig` with an optional `client`. Framework plugins wrap the result
|
|
@@ -390,17 +398,14 @@ function MutationKey({ name, paramsCasing, node, transformer }) {
|
|
|
390
398
|
function buildQueryOptionsParams(node, options) {
|
|
391
399
|
const { paramsType, paramsCasing, pathParamsType, resolver } = options;
|
|
392
400
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
|
|
393
|
-
return
|
|
401
|
+
return createOperationParams(node, {
|
|
394
402
|
paramsType,
|
|
395
403
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
396
404
|
paramsCasing,
|
|
397
405
|
resolver,
|
|
398
|
-
extraParams: [ast.createFunctionParameter({
|
|
406
|
+
extraParams: [ast.factory.createFunctionParameter({
|
|
399
407
|
name: "config",
|
|
400
|
-
type:
|
|
401
|
-
variant: "reference",
|
|
402
|
-
name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
|
|
403
|
-
}),
|
|
408
|
+
type: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }",
|
|
404
409
|
default: "{}"
|
|
405
410
|
})]
|
|
406
411
|
});
|
|
@@ -473,107 +478,52 @@ function resolveZodSchemaNames(node, zodResolver, parser) {
|
|
|
473
478
|
].filter((n) => Boolean(n));
|
|
474
479
|
}
|
|
475
480
|
/**
|
|
476
|
-
* Resolve the type for a single path parameter.
|
|
477
|
-
*
|
|
478
|
-
* - When the resolver's group name differs from the individual param name
|
|
479
|
-
* (e.g. kubbV4) → `GroupName['paramName']` (member access).
|
|
480
|
-
* - When they match (v5 default) → `TypeName` (direct reference).
|
|
481
|
-
*/
|
|
482
|
-
function resolvePathParamType(node, param, resolver) {
|
|
483
|
-
const individualName = resolver.resolveParamName(node, param);
|
|
484
|
-
const groupName = resolver.resolvePathParamsName(node, param);
|
|
485
|
-
if (groupName !== individualName) return ast.createParamsType({
|
|
486
|
-
variant: "member",
|
|
487
|
-
base: groupName,
|
|
488
|
-
key: param.name
|
|
489
|
-
});
|
|
490
|
-
return ast.createParamsType({
|
|
491
|
-
variant: "reference",
|
|
492
|
-
name: individualName
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Derive a query-params group type from the resolver.
|
|
497
|
-
* Returns `null` when no query params exist or when the group name
|
|
498
|
-
* equals the individual param name (no real group).
|
|
499
|
-
*/
|
|
500
|
-
function resolveQueryGroupType(node, params, resolver) {
|
|
501
|
-
if (!params.length) return null;
|
|
502
|
-
const firstParam = params[0];
|
|
503
|
-
const groupName = resolver.resolveQueryParamsName(node, firstParam);
|
|
504
|
-
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
505
|
-
return {
|
|
506
|
-
type: ast.createParamsType({
|
|
507
|
-
variant: "reference",
|
|
508
|
-
name: groupName
|
|
509
|
-
}),
|
|
510
|
-
optional: params.every((p) => !p.required)
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* Build a single `FunctionParameterNode` for a query or header group.
|
|
515
|
-
*/
|
|
516
|
-
function buildGroupParam(name, node, params, groupType, resolver) {
|
|
517
|
-
if (groupType) return [ast.createFunctionParameter({
|
|
518
|
-
name,
|
|
519
|
-
type: groupType.type,
|
|
520
|
-
optional: groupType.optional
|
|
521
|
-
})];
|
|
522
|
-
if (params.length) {
|
|
523
|
-
const structProps = params.map((p) => ({
|
|
524
|
-
name: p.name,
|
|
525
|
-
type: ast.createParamsType({
|
|
526
|
-
variant: "reference",
|
|
527
|
-
name: resolver.resolveParamName(node, p)
|
|
528
|
-
}),
|
|
529
|
-
optional: !p.required
|
|
530
|
-
}));
|
|
531
|
-
return [ast.createFunctionParameter({
|
|
532
|
-
name,
|
|
533
|
-
type: ast.createParamsType({
|
|
534
|
-
variant: "struct",
|
|
535
|
-
properties: structProps
|
|
536
|
-
}),
|
|
537
|
-
optional: params.every((p) => !p.required)
|
|
538
|
-
})];
|
|
539
|
-
}
|
|
540
|
-
return [];
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
481
|
* Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).
|
|
544
482
|
*/
|
|
545
483
|
function buildQueryKeyParams(node, options) {
|
|
546
484
|
const { pathParamsType, paramsCasing, resolver } = options;
|
|
547
|
-
const casedParams =
|
|
485
|
+
const casedParams = caseParams(node.parameters, paramsCasing);
|
|
548
486
|
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
549
487
|
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
550
|
-
const queryGroupType =
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
488
|
+
const queryGroupType = resolveGroupType({
|
|
489
|
+
node,
|
|
490
|
+
params: queryParams,
|
|
491
|
+
group: "query",
|
|
492
|
+
resolver
|
|
493
|
+
});
|
|
494
|
+
const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
555
495
|
const bodyRequired = node.requestBody?.required ?? false;
|
|
556
496
|
const params = [];
|
|
557
497
|
if (pathParams.length) {
|
|
558
|
-
const pathChildren = pathParams.map((p) =>
|
|
498
|
+
const pathChildren = pathParams.map((p) => ({
|
|
559
499
|
name: p.name,
|
|
560
|
-
type:
|
|
500
|
+
type: resolveParamType({
|
|
501
|
+
node,
|
|
502
|
+
param: p,
|
|
503
|
+
resolver
|
|
504
|
+
}),
|
|
561
505
|
optional: !p.required
|
|
562
506
|
}));
|
|
563
|
-
params.push({
|
|
564
|
-
kind: "ParameterGroup",
|
|
507
|
+
if (pathParamsType === "object") params.push(ast.factory.createFunctionParameter({
|
|
565
508
|
properties: pathChildren,
|
|
566
|
-
inline: pathParamsType === "inline",
|
|
567
509
|
default: pathChildren.every((c) => c.optional) ? "{}" : void 0
|
|
568
|
-
});
|
|
510
|
+
}));
|
|
511
|
+
else params.push(...pathChildren.map((child) => ast.factory.createFunctionParameter(child)));
|
|
569
512
|
}
|
|
570
|
-
if (bodyType) params.push(ast.createFunctionParameter({
|
|
513
|
+
if (bodyType) params.push(ast.factory.createFunctionParameter({
|
|
571
514
|
name: "data",
|
|
572
515
|
type: bodyType,
|
|
573
516
|
optional: !bodyRequired
|
|
574
517
|
}));
|
|
575
|
-
params.push(...buildGroupParam(
|
|
576
|
-
|
|
518
|
+
params.push(...buildGroupParam({
|
|
519
|
+
name: "params",
|
|
520
|
+
node,
|
|
521
|
+
params: queryParams,
|
|
522
|
+
groupType: queryGroupType,
|
|
523
|
+
resolver,
|
|
524
|
+
wrapType: (type) => type
|
|
525
|
+
}));
|
|
526
|
+
return ast.factory.createFunctionParameters({ params });
|
|
577
527
|
}
|
|
578
528
|
/**
|
|
579
529
|
* Collect the names of the required params (no default) that drive the `enabled`
|
|
@@ -582,12 +532,11 @@ function buildQueryKeyParams(node, options) {
|
|
|
582
532
|
*/
|
|
583
533
|
function getEnabledParamNames(paramsNode) {
|
|
584
534
|
const required = [];
|
|
585
|
-
for (const param of paramsNode.params)
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (!fp.optional && fp.default === void 0) required.push(fp.name);
|
|
535
|
+
for (const param of paramsNode.params) {
|
|
536
|
+
const members = groupMembers(param);
|
|
537
|
+
if (members) {
|
|
538
|
+
for (const member of members) if (!member.optional) required.push(member.name);
|
|
539
|
+
} else if (typeof param.name === "string" && !param.optional && param.default === void 0) required.push(param.name);
|
|
591
540
|
}
|
|
592
541
|
return required;
|
|
593
542
|
}
|
|
@@ -603,27 +552,25 @@ function markParamsOptional(paramsNode, names) {
|
|
|
603
552
|
if (names.length === 0) return paramsNode;
|
|
604
553
|
const nameSet = new Set(names);
|
|
605
554
|
const params = paramsNode.params.map((param) => {
|
|
606
|
-
|
|
607
|
-
|
|
555
|
+
const members = groupMembers(param);
|
|
556
|
+
if (members) {
|
|
557
|
+
const next = members.map((member) => nameSet.has(member.name) ? {
|
|
558
|
+
...member,
|
|
559
|
+
optional: true
|
|
560
|
+
} : member);
|
|
608
561
|
return {
|
|
609
|
-
...
|
|
610
|
-
|
|
611
|
-
name: child.name,
|
|
612
|
-
type: child.type,
|
|
613
|
-
rest: child.rest,
|
|
614
|
-
optional: true
|
|
615
|
-
}) : child)
|
|
562
|
+
...param,
|
|
563
|
+
type: ast.factory.createTypeLiteral({ members: next })
|
|
616
564
|
};
|
|
617
565
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
rest: fp.rest,
|
|
566
|
+
return typeof param.name === "string" && nameSet.has(param.name) ? ast.factory.createFunctionParameter({
|
|
567
|
+
name: param.name,
|
|
568
|
+
type: param.type,
|
|
569
|
+
rest: param.rest,
|
|
623
570
|
optional: true
|
|
624
|
-
}) :
|
|
571
|
+
}) : param;
|
|
625
572
|
});
|
|
626
|
-
return ast.createFunctionParameters({ params });
|
|
573
|
+
return ast.factory.createFunctionParameters({ params });
|
|
627
574
|
}
|
|
628
575
|
/**
|
|
629
576
|
* Add a non-null assertion (`!`) to the named params inside a printed client-call
|
|
@@ -751,18 +698,15 @@ const callPrinter$7 = functionPrinter({ mode: "call" });
|
|
|
751
698
|
function buildInfiniteQueryParamsNode(node, options) {
|
|
752
699
|
const { paramsType, paramsCasing, pathParamsType, resolver, pageParamGeneric } = options;
|
|
753
700
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
754
|
-
const optionsParam = ast.createFunctionParameter({
|
|
701
|
+
const optionsParam = ast.factory.createFunctionParameter({
|
|
755
702
|
name: "options",
|
|
756
|
-
type:
|
|
757
|
-
variant: "reference",
|
|
758
|
-
name: `{
|
|
703
|
+
type: `{
|
|
759
704
|
query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
|
|
760
705
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
761
|
-
}
|
|
762
|
-
}),
|
|
706
|
+
}`,
|
|
763
707
|
default: "{}"
|
|
764
708
|
});
|
|
765
|
-
return
|
|
709
|
+
return createOperationParams(node, {
|
|
766
710
|
paramsType,
|
|
767
711
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
768
712
|
paramsCasing,
|
|
@@ -951,14 +895,11 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
|
|
|
951
895
|
//#region src/components/MutationOptions.tsx
|
|
952
896
|
const declarationPrinter$5 = functionPrinter({ mode: "declaration" });
|
|
953
897
|
const callPrinter$5 = functionPrinter({ mode: "call" });
|
|
954
|
-
const keysPrinter = functionPrinter({ mode: "
|
|
898
|
+
const keysPrinter = functionPrinter({ mode: "call" });
|
|
955
899
|
function buildMutationConfigParamsNode(node, resolver) {
|
|
956
|
-
return ast.createFunctionParameters({ params: [ast.createFunctionParameter({
|
|
900
|
+
return ast.factory.createFunctionParameters({ params: [ast.factory.createFunctionParameter({
|
|
957
901
|
name: "config",
|
|
958
|
-
type:
|
|
959
|
-
variant: "reference",
|
|
960
|
-
name: buildRequestConfigType(node, resolver)
|
|
961
|
-
}),
|
|
902
|
+
type: buildRequestConfigType(node, resolver),
|
|
962
903
|
default: "{}"
|
|
963
904
|
})] });
|
|
964
905
|
}
|
|
@@ -970,7 +911,7 @@ function MutationOptions({ name, clientName, dataReturnType, node, tsResolver, p
|
|
|
970
911
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
971
912
|
const configParamsNode = buildMutationConfigParamsNode(node, tsResolver);
|
|
972
913
|
const paramsSignature = declarationPrinter$5.print(configParamsNode) ?? "";
|
|
973
|
-
const mutationArgParamsNode =
|
|
914
|
+
const mutationArgParamsNode = createOperationParams(node, {
|
|
974
915
|
paramsType: "inline",
|
|
975
916
|
pathParamsType: "inline",
|
|
976
917
|
paramsCasing,
|
|
@@ -979,17 +920,14 @@ function MutationOptions({ name, clientName, dataReturnType, node, tsResolver, p
|
|
|
979
920
|
const hasMutationParams = mutationArgParamsNode.params.length > 0;
|
|
980
921
|
const TRequest = hasMutationParams ? declarationPrinter$5.print(mutationArgParamsNode) ?? "" : "";
|
|
981
922
|
const argKeysStr = hasMutationParams ? keysPrinter.print(mutationArgParamsNode) ?? "" : "";
|
|
982
|
-
const clientCallParamsNode =
|
|
923
|
+
const clientCallParamsNode = createOperationParams(node, {
|
|
983
924
|
paramsType,
|
|
984
925
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
985
926
|
paramsCasing,
|
|
986
927
|
resolver: tsResolver,
|
|
987
|
-
extraParams: [ast.createFunctionParameter({
|
|
928
|
+
extraParams: [ast.factory.createFunctionParameter({
|
|
988
929
|
name: "config",
|
|
989
|
-
type:
|
|
990
|
-
variant: "reference",
|
|
991
|
-
name: buildRequestConfigType(node, tsResolver)
|
|
992
|
-
}),
|
|
930
|
+
type: buildRequestConfigType(node, tsResolver),
|
|
993
931
|
default: "{}"
|
|
994
932
|
})]
|
|
995
933
|
});
|
|
@@ -1020,7 +958,7 @@ function MutationOptions({ name, clientName, dataReturnType, node, tsResolver, p
|
|
|
1020
958
|
const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
|
|
1021
959
|
const callPrinter$4 = functionPrinter({ mode: "call" });
|
|
1022
960
|
function createMutationArgParams(node, options) {
|
|
1023
|
-
return
|
|
961
|
+
return createOperationParams(node, {
|
|
1024
962
|
paramsType: "inline",
|
|
1025
963
|
pathParamsType: "inline",
|
|
1026
964
|
paramsCasing: options.paramsCasing,
|
|
@@ -1045,15 +983,12 @@ function buildMutationParamsNode(node, options) {
|
|
|
1045
983
|
TRequest ? `{${TRequest}}` : "undefined",
|
|
1046
984
|
"TContext"
|
|
1047
985
|
].join(", ");
|
|
1048
|
-
return ast.createFunctionParameters({ params: [ast.createFunctionParameter({
|
|
986
|
+
return ast.factory.createFunctionParameters({ params: [ast.factory.createFunctionParameter({
|
|
1049
987
|
name: "options",
|
|
1050
|
-
type:
|
|
1051
|
-
variant: "reference",
|
|
1052
|
-
name: `{
|
|
988
|
+
type: `{
|
|
1053
989
|
mutation?: UseMutationOptions<${generics}> & { client?: QueryClient },
|
|
1054
990
|
client?: ${buildRequestConfigType(node, resolver)},
|
|
1055
|
-
}
|
|
1056
|
-
}),
|
|
991
|
+
}`,
|
|
1057
992
|
default: "{}"
|
|
1058
993
|
})] });
|
|
1059
994
|
}
|
|
@@ -1121,24 +1056,21 @@ function buildQueryParamsNode(node, options) {
|
|
|
1121
1056
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1122
1057
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1123
1058
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1124
|
-
const optionsParam = ast.createFunctionParameter({
|
|
1059
|
+
const optionsParam = ast.factory.createFunctionParameter({
|
|
1125
1060
|
name: "options",
|
|
1126
|
-
type:
|
|
1127
|
-
variant: "reference",
|
|
1128
|
-
name: `{
|
|
1061
|
+
type: `{
|
|
1129
1062
|
query?: Partial<QueryObserverOptions<${[
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1063
|
+
TData,
|
|
1064
|
+
TError,
|
|
1065
|
+
"TData",
|
|
1066
|
+
"TQueryData",
|
|
1067
|
+
"TQueryKey"
|
|
1068
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
1136
1069
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1137
|
-
}
|
|
1138
|
-
}),
|
|
1070
|
+
}`,
|
|
1139
1071
|
default: "{}"
|
|
1140
1072
|
});
|
|
1141
|
-
return
|
|
1073
|
+
return createOperationParams(node, {
|
|
1142
1074
|
paramsType,
|
|
1143
1075
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1144
1076
|
paramsCasing,
|
|
@@ -1215,18 +1147,15 @@ const callPrinter$2 = functionPrinter({ mode: "call" });
|
|
|
1215
1147
|
function buildSuspenseInfiniteQueryParamsNode(node, options) {
|
|
1216
1148
|
const { paramsType, paramsCasing, pathParamsType, resolver, pageParamGeneric } = options;
|
|
1217
1149
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
1218
|
-
const optionsParam = ast.createFunctionParameter({
|
|
1150
|
+
const optionsParam = ast.factory.createFunctionParameter({
|
|
1219
1151
|
name: "options",
|
|
1220
|
-
type:
|
|
1221
|
-
variant: "reference",
|
|
1222
|
-
name: `{
|
|
1152
|
+
type: `{
|
|
1223
1153
|
query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
|
|
1224
1154
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1225
|
-
}
|
|
1226
|
-
}),
|
|
1155
|
+
}`,
|
|
1227
1156
|
default: "{}"
|
|
1228
1157
|
});
|
|
1229
|
-
return
|
|
1158
|
+
return createOperationParams(node, {
|
|
1230
1159
|
paramsType,
|
|
1231
1160
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1232
1161
|
paramsCasing,
|
|
@@ -1420,23 +1349,20 @@ function buildSuspenseQueryParamsNode(node, options) {
|
|
|
1420
1349
|
const errorNames = resolveErrorNames(node, resolver);
|
|
1421
1350
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
1422
1351
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
1423
|
-
const optionsParam = ast.createFunctionParameter({
|
|
1352
|
+
const optionsParam = ast.factory.createFunctionParameter({
|
|
1424
1353
|
name: "options",
|
|
1425
|
-
type:
|
|
1426
|
-
variant: "reference",
|
|
1427
|
-
name: `{
|
|
1354
|
+
type: `{
|
|
1428
1355
|
query?: Partial<UseSuspenseQueryOptions<${[
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1356
|
+
TData,
|
|
1357
|
+
TError,
|
|
1358
|
+
"TData",
|
|
1359
|
+
"TQueryKey"
|
|
1360
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
1434
1361
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
|
|
1435
|
-
}
|
|
1436
|
-
}),
|
|
1362
|
+
}`,
|
|
1437
1363
|
default: "{}"
|
|
1438
1364
|
});
|
|
1439
|
-
return
|
|
1365
|
+
return createOperationParams(node, {
|
|
1440
1366
|
paramsType,
|
|
1441
1367
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
1442
1368
|
paramsCasing,
|
|
@@ -1504,4 +1430,4 @@ function SuspenseQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
1504
1430
|
//#endregion
|
|
1505
1431
|
export { operationFileEntry as _, Mutation as a, InfiniteQuery as c, queryKeyTransformer as d, resolveOperationOverrides as f, getOperationParameters as g, mutationKeyTransformer as h, Query as i, QueryOptions as l, MutationKey as m, SuspenseInfiniteQueryOptions as n, MutationOptions as o, resolveZodSchemaNames as p, SuspenseInfiniteQuery as r, InfiniteQueryOptions as s, SuspenseQuery as t, QueryKey as u, resolveOperationTypeNames as v, camelCase as y };
|
|
1506
1432
|
|
|
1507
|
-
//# sourceMappingURL=components-
|
|
1433
|
+
//# sourceMappingURL=components-Ds-e_nnK.js.map
|