@kubb/plugin-swr 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-C8FJ3-Cb.cjs → components-DxWGjLWg.cjs} +73 -134
- package/dist/components-DxWGjLWg.cjs.map +1 -0
- package/dist/{components-CR9NLFcO.js → components-mWBRE6E4.js} +73 -134
- package/dist/components-mWBRE6E4.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-mw3FvFJD.cjs → generators-CJ4ziuNk.cjs} +2 -2
- package/dist/{generators-mw3FvFJD.cjs.map → generators-CJ4ziuNk.cjs.map} +1 -1
- package/dist/{generators-BB6csINY.js → generators-D2blgLOY.js} +2 -2
- package/dist/{generators-BB6csINY.js.map → generators-D2blgLOY.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-Dz_j0Bqv.d.ts → types-DcBaH0gA.d.ts} +3 -3
- package/package.json +8 -8
- package/dist/components-C8FJ3-Cb.cjs.map +0 -1
- package/dist/components-CR9NLFcO.js.map +0 -1
- package/src/components/Mutation.tsx +0 -155
- package/src/components/MutationKey.tsx +0 -25
- package/src/components/Query.tsx +0 -128
- package/src/components/QueryKey.tsx +0 -1
- package/src/components/QueryOptions.tsx +0 -56
- package/src/components/index.ts +0 -5
- package/src/generators/index.ts +0 -2
- package/src/generators/mutationGenerator.tsx +0 -166
- package/src/generators/queryGenerator.tsx +0 -170
- package/src/index.ts +0 -2
- package/src/plugin.ts +0 -142
- package/src/resolvers/resolverSwr.ts +0 -56
- package/src/types.ts +0 -194
- package/src/utils.ts +0 -17
|
@@ -25,6 +25,7 @@ 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");
|
|
@@ -283,7 +284,7 @@ function buildOperationComments(node, options = {}) {
|
|
|
283
284
|
return filteredComments.flatMap((text) => text.split(/\r?\n/).map((line) => line.trim())).filter((comment) => Boolean(comment));
|
|
284
285
|
}
|
|
285
286
|
function getOperationParameters(node, options = {}) {
|
|
286
|
-
const params =
|
|
287
|
+
const params = (0, _kubb_ast_utils.caseParams)(node.parameters, options.paramsCasing);
|
|
287
288
|
return {
|
|
288
289
|
path: params.filter((param) => param.in === "path"),
|
|
289
290
|
query: params.filter((param) => param.in === "query"),
|
|
@@ -358,7 +359,7 @@ const mutationKeyTransformer = ({ node }) => {
|
|
|
358
359
|
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
359
360
|
};
|
|
360
361
|
function MutationKey$1({ name, paramsCasing, node, transformer }) {
|
|
361
|
-
const paramsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
|
|
362
|
+
const paramsNode = _kubb_core.ast.factory.createFunctionParameters({ params: [] });
|
|
362
363
|
const paramsSignature = declarationPrinter$4.print(paramsNode) ?? "";
|
|
363
364
|
const keys = (transformer ?? mutationKeyTransformer)({
|
|
364
365
|
node,
|
|
@@ -381,6 +382,14 @@ __name(MutationKey$1, "MutationKey");
|
|
|
381
382
|
//#endregion
|
|
382
383
|
//#region ../../internals/tanstack-query/src/utils.ts
|
|
383
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
|
+
/**
|
|
384
393
|
* Builds the shared `(…params, config = {})` parameter list for a TanStack
|
|
385
394
|
* query-options function. The trailing `config` parameter is typed as a partial
|
|
386
395
|
* `RequestConfig` with an optional `client`. Framework plugins wrap the result
|
|
@@ -389,17 +398,14 @@ __name(MutationKey$1, "MutationKey");
|
|
|
389
398
|
function buildQueryOptionsParams(node, options) {
|
|
390
399
|
const { paramsType, paramsCasing, pathParamsType, resolver } = options;
|
|
391
400
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
|
|
392
|
-
return
|
|
401
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
393
402
|
paramsType,
|
|
394
403
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
395
404
|
paramsCasing,
|
|
396
405
|
resolver,
|
|
397
|
-
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
406
|
+
extraParams: [_kubb_core.ast.factory.createFunctionParameter({
|
|
398
407
|
name: "config",
|
|
399
|
-
type:
|
|
400
|
-
variant: "reference",
|
|
401
|
-
name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
|
|
402
|
-
}),
|
|
408
|
+
type: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }",
|
|
403
409
|
default: "{}"
|
|
404
410
|
})]
|
|
405
411
|
});
|
|
@@ -450,107 +456,52 @@ function resolveZodSchemaNames(node, zodResolver, parser) {
|
|
|
450
456
|
].filter((n) => Boolean(n));
|
|
451
457
|
}
|
|
452
458
|
/**
|
|
453
|
-
* Resolve the type for a single path parameter.
|
|
454
|
-
*
|
|
455
|
-
* - When the resolver's group name differs from the individual param name
|
|
456
|
-
* (e.g. kubbV4) → `GroupName['paramName']` (member access).
|
|
457
|
-
* - When they match (v5 default) → `TypeName` (direct reference).
|
|
458
|
-
*/
|
|
459
|
-
function resolvePathParamType(node, param, resolver) {
|
|
460
|
-
const individualName = resolver.resolveParamName(node, param);
|
|
461
|
-
const groupName = resolver.resolvePathParamsName(node, param);
|
|
462
|
-
if (groupName !== individualName) return _kubb_core.ast.createParamsType({
|
|
463
|
-
variant: "member",
|
|
464
|
-
base: groupName,
|
|
465
|
-
key: param.name
|
|
466
|
-
});
|
|
467
|
-
return _kubb_core.ast.createParamsType({
|
|
468
|
-
variant: "reference",
|
|
469
|
-
name: individualName
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Derive a query-params group type from the resolver.
|
|
474
|
-
* Returns `null` when no query params exist or when the group name
|
|
475
|
-
* equals the individual param name (no real group).
|
|
476
|
-
*/
|
|
477
|
-
function resolveQueryGroupType(node, params, resolver) {
|
|
478
|
-
if (!params.length) return null;
|
|
479
|
-
const firstParam = params[0];
|
|
480
|
-
const groupName = resolver.resolveQueryParamsName(node, firstParam);
|
|
481
|
-
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
482
|
-
return {
|
|
483
|
-
type: _kubb_core.ast.createParamsType({
|
|
484
|
-
variant: "reference",
|
|
485
|
-
name: groupName
|
|
486
|
-
}),
|
|
487
|
-
optional: params.every((p) => !p.required)
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Build a single `FunctionParameterNode` for a query or header group.
|
|
492
|
-
*/
|
|
493
|
-
function buildGroupParam(name, node, params, groupType, resolver) {
|
|
494
|
-
if (groupType) return [_kubb_core.ast.createFunctionParameter({
|
|
495
|
-
name,
|
|
496
|
-
type: groupType.type,
|
|
497
|
-
optional: groupType.optional
|
|
498
|
-
})];
|
|
499
|
-
if (params.length) {
|
|
500
|
-
const structProps = params.map((p) => ({
|
|
501
|
-
name: p.name,
|
|
502
|
-
type: _kubb_core.ast.createParamsType({
|
|
503
|
-
variant: "reference",
|
|
504
|
-
name: resolver.resolveParamName(node, p)
|
|
505
|
-
}),
|
|
506
|
-
optional: !p.required
|
|
507
|
-
}));
|
|
508
|
-
return [_kubb_core.ast.createFunctionParameter({
|
|
509
|
-
name,
|
|
510
|
-
type: _kubb_core.ast.createParamsType({
|
|
511
|
-
variant: "struct",
|
|
512
|
-
properties: structProps
|
|
513
|
-
}),
|
|
514
|
-
optional: params.every((p) => !p.required)
|
|
515
|
-
})];
|
|
516
|
-
}
|
|
517
|
-
return [];
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
459
|
* Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).
|
|
521
460
|
*/
|
|
522
461
|
function buildQueryKeyParams(node, options) {
|
|
523
462
|
const { pathParamsType, paramsCasing, resolver } = options;
|
|
524
|
-
const casedParams =
|
|
463
|
+
const casedParams = (0, _kubb_ast_utils.caseParams)(node.parameters, paramsCasing);
|
|
525
464
|
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
526
465
|
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
527
|
-
const queryGroupType =
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
466
|
+
const queryGroupType = (0, _kubb_ast_utils.resolveGroupType)({
|
|
467
|
+
node,
|
|
468
|
+
params: queryParams,
|
|
469
|
+
group: "query",
|
|
470
|
+
resolver
|
|
471
|
+
});
|
|
472
|
+
const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
|
|
532
473
|
const bodyRequired = node.requestBody?.required ?? false;
|
|
533
474
|
const params = [];
|
|
534
475
|
if (pathParams.length) {
|
|
535
|
-
const pathChildren = pathParams.map((p) =>
|
|
476
|
+
const pathChildren = pathParams.map((p) => ({
|
|
536
477
|
name: p.name,
|
|
537
|
-
type:
|
|
478
|
+
type: (0, _kubb_ast_utils.resolveParamType)({
|
|
479
|
+
node,
|
|
480
|
+
param: p,
|
|
481
|
+
resolver
|
|
482
|
+
}),
|
|
538
483
|
optional: !p.required
|
|
539
484
|
}));
|
|
540
|
-
params.push({
|
|
541
|
-
kind: "ParameterGroup",
|
|
485
|
+
if (pathParamsType === "object") params.push(_kubb_core.ast.factory.createFunctionParameter({
|
|
542
486
|
properties: pathChildren,
|
|
543
|
-
inline: pathParamsType === "inline",
|
|
544
487
|
default: pathChildren.every((c) => c.optional) ? "{}" : void 0
|
|
545
|
-
});
|
|
488
|
+
}));
|
|
489
|
+
else params.push(...pathChildren.map((child) => _kubb_core.ast.factory.createFunctionParameter(child)));
|
|
546
490
|
}
|
|
547
|
-
if (bodyType) params.push(_kubb_core.ast.createFunctionParameter({
|
|
491
|
+
if (bodyType) params.push(_kubb_core.ast.factory.createFunctionParameter({
|
|
548
492
|
name: "data",
|
|
549
493
|
type: bodyType,
|
|
550
494
|
optional: !bodyRequired
|
|
551
495
|
}));
|
|
552
|
-
params.push(...
|
|
553
|
-
|
|
496
|
+
params.push(...(0, _kubb_ast_utils.buildGroupParam)({
|
|
497
|
+
name: "params",
|
|
498
|
+
node,
|
|
499
|
+
params: queryParams,
|
|
500
|
+
groupType: queryGroupType,
|
|
501
|
+
resolver,
|
|
502
|
+
wrapType: (type) => type
|
|
503
|
+
}));
|
|
504
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params });
|
|
554
505
|
}
|
|
555
506
|
/**
|
|
556
507
|
* Collect the names of the required params (no default) that drive the `enabled`
|
|
@@ -559,12 +510,11 @@ function buildQueryKeyParams(node, options) {
|
|
|
559
510
|
*/
|
|
560
511
|
function getEnabledParamNames(paramsNode) {
|
|
561
512
|
const required = [];
|
|
562
|
-
for (const param of paramsNode.params)
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (!fp.optional && fp.default === void 0) required.push(fp.name);
|
|
513
|
+
for (const param of paramsNode.params) {
|
|
514
|
+
const members = groupMembers(param);
|
|
515
|
+
if (members) {
|
|
516
|
+
for (const member of members) if (!member.optional) required.push(member.name);
|
|
517
|
+
} else if (typeof param.name === "string" && !param.optional && param.default === void 0) required.push(param.name);
|
|
568
518
|
}
|
|
569
519
|
return required;
|
|
570
520
|
}
|
|
@@ -580,27 +530,25 @@ function markParamsOptional(paramsNode, names) {
|
|
|
580
530
|
if (names.length === 0) return paramsNode;
|
|
581
531
|
const nameSet = new Set(names);
|
|
582
532
|
const params = paramsNode.params.map((param) => {
|
|
583
|
-
|
|
584
|
-
|
|
533
|
+
const members = groupMembers(param);
|
|
534
|
+
if (members) {
|
|
535
|
+
const next = members.map((member) => nameSet.has(member.name) ? {
|
|
536
|
+
...member,
|
|
537
|
+
optional: true
|
|
538
|
+
} : member);
|
|
585
539
|
return {
|
|
586
|
-
...
|
|
587
|
-
|
|
588
|
-
name: child.name,
|
|
589
|
-
type: child.type,
|
|
590
|
-
rest: child.rest,
|
|
591
|
-
optional: true
|
|
592
|
-
}) : child)
|
|
540
|
+
...param,
|
|
541
|
+
type: _kubb_core.ast.factory.createTypeLiteral({ members: next })
|
|
593
542
|
};
|
|
594
543
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
rest: fp.rest,
|
|
544
|
+
return typeof param.name === "string" && nameSet.has(param.name) ? _kubb_core.ast.factory.createFunctionParameter({
|
|
545
|
+
name: param.name,
|
|
546
|
+
type: param.type,
|
|
547
|
+
rest: param.rest,
|
|
600
548
|
optional: true
|
|
601
|
-
}) :
|
|
549
|
+
}) : param;
|
|
602
550
|
});
|
|
603
|
-
return _kubb_core.ast.createFunctionParameters({ params });
|
|
551
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params });
|
|
604
552
|
}
|
|
605
553
|
/**
|
|
606
554
|
* Add a non-null assertion (`!`) to the named params inside a printed client-call
|
|
@@ -675,9 +623,9 @@ function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeNa
|
|
|
675
623
|
//#region src/components/Mutation.tsx
|
|
676
624
|
const declarationPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
677
625
|
const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
678
|
-
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "
|
|
626
|
+
const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
679
627
|
function createMutationArgParams(node, options) {
|
|
680
|
-
return
|
|
628
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
681
629
|
paramsType: "inline",
|
|
682
630
|
pathParamsType: "inline",
|
|
683
631
|
paramsCasing: options.paramsCasing,
|
|
@@ -690,16 +638,13 @@ function buildMutationParamsNode(node, options) {
|
|
|
690
638
|
const errorNames = resolveErrorNames(node, resolver);
|
|
691
639
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
692
640
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
693
|
-
return _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
|
|
641
|
+
return _kubb_core.ast.factory.createFunctionParameters({ params: [_kubb_core.ast.factory.createFunctionParameter({
|
|
694
642
|
name: "options",
|
|
695
|
-
type:
|
|
696
|
-
variant: "reference",
|
|
697
|
-
name: `{
|
|
643
|
+
type: `{
|
|
698
644
|
mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },
|
|
699
645
|
client?: ${buildRequestConfigType(node, resolver)},
|
|
700
646
|
shouldFetch?: boolean,
|
|
701
|
-
}
|
|
702
|
-
}),
|
|
647
|
+
}`,
|
|
703
648
|
default: "{}"
|
|
704
649
|
})] });
|
|
705
650
|
}
|
|
@@ -729,17 +674,14 @@ function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, muta
|
|
|
729
674
|
resolver: tsResolver
|
|
730
675
|
});
|
|
731
676
|
const paramsSignature = declarationPrinter$2.print(paramsNode) ?? "";
|
|
732
|
-
const clientCallParamsNode =
|
|
677
|
+
const clientCallParamsNode = (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
733
678
|
paramsType,
|
|
734
679
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
735
680
|
paramsCasing,
|
|
736
681
|
resolver: tsResolver,
|
|
737
|
-
extraParams: [_kubb_core.ast.createFunctionParameter({
|
|
682
|
+
extraParams: [_kubb_core.ast.factory.createFunctionParameter({
|
|
738
683
|
name: "config",
|
|
739
|
-
type:
|
|
740
|
-
variant: "reference",
|
|
741
|
-
name: buildRequestConfigType(node, tsResolver)
|
|
742
|
-
}),
|
|
684
|
+
type: buildRequestConfigType(node, tsResolver),
|
|
743
685
|
default: "{}"
|
|
744
686
|
})]
|
|
745
687
|
});
|
|
@@ -849,20 +791,17 @@ function buildQueryParamsNode(node, options) {
|
|
|
849
791
|
const errorNames = resolveErrorNames(node, resolver);
|
|
850
792
|
const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
|
|
851
793
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
|
|
852
|
-
const optionsParam = _kubb_core.ast.createFunctionParameter({
|
|
794
|
+
const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
|
|
853
795
|
name: "options",
|
|
854
|
-
type:
|
|
855
|
-
variant: "reference",
|
|
856
|
-
name: `{
|
|
796
|
+
type: `{
|
|
857
797
|
query?: SWRConfiguration<${[TData, TError].join(", ")}>,
|
|
858
798
|
client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"},
|
|
859
799
|
shouldFetch?: boolean,
|
|
860
800
|
immutable?: boolean
|
|
861
|
-
}
|
|
862
|
-
}),
|
|
801
|
+
}`,
|
|
863
802
|
default: "{}"
|
|
864
803
|
});
|
|
865
|
-
return
|
|
804
|
+
return (0, _kubb_ast_utils.createOperationParams)(node, {
|
|
866
805
|
paramsType,
|
|
867
806
|
pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
|
|
868
807
|
paramsCasing,
|
|
@@ -1005,4 +944,4 @@ Object.defineProperty(exports, "resolveZodSchemaNames", {
|
|
|
1005
944
|
}
|
|
1006
945
|
});
|
|
1007
946
|
|
|
1008
|
-
//# sourceMappingURL=components-
|
|
947
|
+
//# sourceMappingURL=components-DxWGjLWg.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-DxWGjLWg.cjs","names":["declarationPrinter","MutationKey","ast","File","Function","ast","declarationPrinter","File","Function","Type","declarationPrinter","callPrinter","ast","File","Type","Function","getComments","SharedMutationKey","File","Type","declarationPrinter","callPrinter","File","Function","ast","File","Function","getComments"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/operation.ts","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/components/Mutation.tsx","../src/components/MutationKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `null` when the path has none.\n */\n params: Record<string, string> | null\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\nexport type PathCasing = 'camelcase'\n\ntype TemplateOptions = {\n /**\n * Literal text prepended inside the template literal, e.g. a base URL.\n */\n prefix?: string | null\n /**\n * Transform applied to each extracted parameter name before interpolation.\n */\n replacer?: (pathParam: string) => string\n /**\n * Casing strategy applied to path parameter names.\n */\n casing?: PathCasing\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n /**\n * Casing strategy applied to path parameter names.\n */\n casing?: PathCasing\n}\n\nfunction transformParam(raw: string, casing?: PathCasing): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return casing === 'camelcase' ? camelCase(param) : param\n}\n\nfunction toParamsObject(\n path: string,\n { replacer, casing }: { replacer?: (pathParam: string) => string; casing?: PathCasing } = {},\n): Record<string, string> | null {\n const params: Record<string, string> = {}\n\n for (const match of path.matchAll(/\\{([^}]+)\\}/g)) {\n const param = transformParam(match[1]!, casing)\n const key = replacer ? replacer(param) : param\n params[key] = key\n }\n\n return Object.keys(params).length > 0 ? params : null\n}\n\n/**\n * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\n */\nexport class Url {\n /**\n * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.\n *\n * @example\n * Url.canParse('https://petstore.swagger.io/v2') // true\n * Url.canParse('/pet/{petId}') // false\n */\n static canParse(url: string, base?: string | URL): boolean {\n return URL.canParse(url, base)\n }\n\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n */\n static toPath(path: string): string {\n return path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a TypeScript template literal string.\n * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,\n * and `casing` controls parameter identifier casing.\n *\n * @example\n * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'\n *\n * @example\n * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'\n */\n static toTemplateString(path: string, { prefix, replacer, casing }: TemplateOptions = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = transformParam(part, casing)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n\n /**\n * Returns the path and its extracted params as a structured `URLObject`, or as a stringified\n * expression when `stringify` is set.\n *\n * @example\n * Url.toObject('/pet/{petId}')\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n */\n static toObject(path: string, { type = 'path', replacer, stringify, casing }: ObjectOptions = {}): URLObject | string {\n const object: URLObject = {\n url: type === 'path' ? Url.toPath(path) : Url.toTemplateString(path, { replacer, casing }),\n params: toParamsObject(path, { replacer, casing }),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n}\n","import { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from '@kubb/ast/utils'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.resolveFile`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n }\n\n return node.path ? `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}` : null\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type — a binary type\n * (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`, `video/*`) maps to `'blob'`\n * and other `text/*` maps to `'text'`. Otherwise `undefined`, leaving the runtime client's\n * `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n\n const baseType = contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nexport function getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isSuccessStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\n/**\n * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.\n * Each member is `{ status: N; data: StatusNType; statusText: string }`.\n */\nexport function buildStatusUnionType(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string {\n const members = node.responses.map((r) => {\n const typeName = resolver.resolveResponseStatusName(node, r.statusCode)\n const statusCode = Number.parseInt(r.statusCode, 10)\n const statusLiteral = Number.isNaN(statusCode) ? 'number' : String(statusCode)\n return `{ status: ${statusLiteral}; data: ${typeName}; statusText: string }`\n })\n if (members.length === 1) return members[0]!\n return `(${members.join(' | ')})`\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","import { Url } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n paramsCasing: 'camelcase' | undefined\n pathParamsType: 'object' | 'inline'\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const mutationKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n return [`{ url: '${Url.toPath(node.path)}' }`]\n}\n\nexport function MutationKey({ name, paramsCasing, node, transformer }: Props): KubbReactNode {\n const paramsNode = ast.factory.createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: paramsCasing })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n )\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport { buildGroupParam, caseParams, createOperationParams, resolveGroupType, resolveParamType } from '@kubb/ast/utils'\nimport type { PluginTs, ResolverTs } from '@kubb/plugin-ts'\nimport type { ParamsCasing, ParamsType, PathParamsType } from './types.ts'\n\n/**\n * Returns the `TypeLiteral` members of a destructured group parameter, or `null`\n * for a plain named parameter.\n */\nfunction groupMembers(param: ast.FunctionParameterNode): ReadonlyArray<{ name: string; type: ast.TypeExpression; optional?: boolean }> | null {\n if (typeof param.name === 'string') return null\n return param.type && typeof param.type !== 'string' && param.type.kind === 'TypeLiteral' ? param.type.members : []\n}\n\n/**\n * Builds the shared `(…params, config = {})` parameter list for a TanStack\n * query-options function. The trailing `config` parameter is typed as a partial\n * `RequestConfig` with an optional `client`. Framework plugins wrap the result\n * when needed, for example vue-query applies `MaybeRefOrGetter`.\n */\nexport function buildQueryOptionsParams(\n node: ast.OperationNode,\n options: { paramsType: ParamsType; paramsCasing: ParamsCasing; pathParamsType: PathParamsType; resolver: ResolverTs },\n): ast.FunctionParametersNode {\n const { paramsType, paramsCasing, pathParamsType, resolver } = options\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n\n return createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver,\n extraParams: [\n ast.factory.createFunctionParameter({\n name: 'config',\n type: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : 'Partial<RequestConfig> & { client?: Client }',\n default: '{}',\n }),\n ],\n })\n}\n\nexport function transformName(name: string, type: string, transformers?: { name?: (name: string, type?: string) => string }): string {\n return transformers?.name?.(name, type) || name\n}\n\ntype OverrideEntry<TOptions> = {\n type: string\n pattern: string | RegExp\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: { type: string; pattern: string | RegExp }): boolean {\n const { type, pattern } = ov\n const matches = (value: string) => (typeof pattern === 'string' ? value === pattern : pattern.test(value))\n if (type === 'operationId') return matches(node.operationId)\n if (type === 'tag') return node.tags.some((t) => matches(t))\n if (type === 'path') return node.path !== undefined && matches(node.path)\n if (type === 'method') return node.method !== undefined && matches(node.method)\n return false\n}\n\n/**\n * Resolves per-operation overrides (first matching override wins).\n *\n * @example\n * ```ts\n * const opts = resolveOperationOverrides(node, override)\n * const queryOpts = 'query' in opts ? opts.query : defaultQuery\n * ```\n */\nexport function resolveOperationOverrides<TOptions>(node: ast.OperationNode, override?: ReadonlyArray<OverrideEntry<TOptions>>): Partial<TOptions> {\n if (!override) return {}\n const match = override.find((ov) => matchesPattern(node, ov))\n return match?.options ?? {}\n}\n\ntype ZodSchemaNameResolverLike = {\n resolveResponseName?: (node: ast.OperationNode) => string | undefined\n resolveDataName?: (node: ast.OperationNode) => string | undefined\n resolveQueryParamsName?: (node: ast.OperationNode, param: ast.ParameterNode) => string | undefined\n}\n\ntype ParserOption = false | 'zod' | { request?: 'zod'; response?: 'zod' } | undefined\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled.\n * The string shorthand `'zod'` also enables response parsing.\n */\nexport function resolveResponseParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.request ?? null\n}\n\n/**\n * Returns `'zod'` when query-params parsing is enabled.\n * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.\n */\nexport function resolveQueryParamsParser(parser: ParserOption): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Collects the Zod schema import names for an operation based on the active parser directions.\n *\n * - `parser: 'zod'`: response and request body names (backward-compatible behavior).\n * - `parser: { request: 'zod' }`: request body and query params names.\n * - `parser: { response: 'zod' }`: response name only.\n * - `parser: { request: 'zod', response: 'zod' }`: all three.\n *\n * Returns an empty array when no resolver is provided or `parser` is falsy.\n */\nexport function resolveZodSchemaNames(node: ast.OperationNode, zodResolver: ZodSchemaNameResolverLike | null | undefined, parser: ParserOption): string[] {\n if (!zodResolver || !parser) return []\n const { query: queryParams } = getOperationParameters(node)\n return [\n resolveResponseParser(parser) === 'zod' ? zodResolver.resolveResponseName?.(node) : null,\n resolveRequestParser(parser) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,\n resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null,\n ].filter((n): n is string => Boolean(n))\n}\n\n/**\n * Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).\n */\nexport function buildQueryKeyParams(\n node: ast.OperationNode,\n options: {\n pathParamsType: 'object' | 'inline'\n paramsCasing: 'camelcase' | undefined\n resolver: PluginTs['resolver']\n },\n): ast.FunctionParametersNode {\n const { pathParamsType, paramsCasing, resolver } = options\n\n const casedParams = caseParams(node.parameters, paramsCasing)\n const pathParams = casedParams.filter((p) => p.in === 'path')\n const queryParams = casedParams.filter((p) => p.in === 'query')\n\n const queryGroupType = resolveGroupType({ node, params: queryParams, group: 'query', resolver })\n\n const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const bodyRequired = node.requestBody?.required ?? false\n\n const params: Array<ast.FunctionParameterNode> = []\n\n // Path params\n if (pathParams.length) {\n const pathChildren = pathParams.map((p) => ({ name: p.name, type: resolveParamType({ node, param: p, resolver }), optional: !p.required }))\n if (pathParamsType === 'object') {\n params.push(ast.factory.createFunctionParameter({ properties: pathChildren, default: pathChildren.every((c) => c.optional) ? '{}' : undefined }))\n } else {\n params.push(...pathChildren.map((child) => ast.factory.createFunctionParameter(child)))\n }\n }\n\n // Request body\n if (bodyType) {\n params.push(ast.factory.createFunctionParameter({ name: 'data', type: bodyType, optional: !bodyRequired }))\n }\n\n // Query params\n params.push(...buildGroupParam({ name: 'params', node, params: queryParams, groupType: queryGroupType, resolver, wrapType: (type) => type }))\n\n return ast.factory.createFunctionParameters({ params })\n}\n\n/**\n * Collect the names of the required params (no default) that drive the `enabled`\n * guard. These are exactly the params that should be made optional in the\n * generated signatures so callers can pass `undefined` to reach the disabled state.\n */\nexport function getEnabledParamNames(paramsNode: ast.FunctionParametersNode): string[] {\n const required: string[] = []\n for (const param of paramsNode.params) {\n const members = groupMembers(param)\n if (members) {\n for (const member of members) {\n if (!member.optional) required.push(member.name)\n }\n } else if (typeof param.name === 'string' && !param.optional && param.default === undefined) {\n required.push(param.name)\n }\n }\n return required\n}\n\n/**\n * Return a copy of `paramsNode` with the named params marked optional.\n *\n * Used to align signatures with the `enabled` guard: the guard already disables\n * the query while a param is falsy, so the param should accept `undefined`. The\n * change is type-only — the `queryFn` keeps calling the client with a non-null\n * assertion (see `injectNonNullAssertions`), so the emitted runtime is unchanged.\n */\nexport function markParamsOptional(paramsNode: ast.FunctionParametersNode, names: ReadonlyArray<string>): ast.FunctionParametersNode {\n if (names.length === 0) return paramsNode\n const nameSet = new Set(names)\n const params = paramsNode.params.map((param) => {\n const members = groupMembers(param)\n if (members) {\n const next = members.map((member) => (nameSet.has(member.name) ? { ...member, optional: true } : member))\n return { ...param, type: ast.factory.createTypeLiteral({ members: next }) }\n }\n return typeof param.name === 'string' && nameSet.has(param.name)\n ? ast.factory.createFunctionParameter({ name: param.name, type: param.type, rest: param.rest, optional: true })\n : param\n })\n return ast.factory.createFunctionParameters({ params })\n}\n\n/**\n * Add a non-null assertion (`!`) to the named params inside a printed client-call\n * string. Bridges the type gap created by `markParamsOptional` while keeping the\n * runtime identical (the `!` is erased at compile time).\n *\n * Handles destructured shorthand groups (`{ petId }` → `{ petId: petId! }`) and\n * standalone identifiers (`params` → `params!`).\n */\nexport function injectNonNullAssertions(callStr: string, names: ReadonlyArray<string>): string {\n if (names.length === 0) return callStr\n const nameSet = new Set(names)\n\n // Step 1: destructured shorthand group `{ petId }` → `{ petId: petId! }`\n let result = callStr.replace(/\\{\\s*([\\w,\\s]+)\\s*\\}(?=\\s*,)/g, (match, inner: string) => {\n if (inner.includes(':') || inner.includes('...')) return match\n const keys = inner\n .split(',')\n .map((k: string) => k.trim())\n .filter(Boolean)\n if (!keys.some((k) => nameSet.has(k))) return match\n const rebuilt = keys.map((k) => (nameSet.has(k) ? `${k}: ${k}!` : k)).join(', ')\n return `{ ${rebuilt} }`\n })\n\n // Step 2: standalone identifiers like `params`, `data`\n result = result.replace(/(?<![{.:?])\\b(\\w+)\\b(?=\\s*,)/g, (match, name: string) => (nameSet.has(name) ? `${name}!` : match))\n\n return result\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\nimport { buildQueryKeyParams, getEnabledParamNames, markParamsOptional } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n tsResolver: PluginTs['resolver']\n paramsCasing: 'camelcase' | undefined\n pathParamsType: 'object' | 'inline'\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const queryKeyTransformer: Transformer = ({ node, casing }) => {\n if (!node.path) return []\n const hasQueryParams = getOperationParameters(node).query.length > 0\n const hasRequestBody = !!node.requestBody?.content?.[0]?.schema\n\n return [\n Url.toObject(node.path, { type: 'path', stringify: true, casing }),\n hasQueryParams ? '...(params ? [params] : [])' : null,\n hasRequestBody ? '...(data ? [data] : [])' : null,\n ].filter(Boolean) as Array<string>\n}\n\nexport function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeName, transformer }: Props): KubbReactNode {\n const baseParamsNode = buildQueryKeyParams(node, { pathParamsType, paramsCasing, resolver: tsResolver })\n const paramsNode = markParamsOptional(baseParamsNode, getEnabledParamNames(baseParamsNode))\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: paramsCasing })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isTypeOnly>\n <Type name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import { createOperationParams } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginSwr } from '../types.ts'\nimport { buildRequestConfigType, buildStatusUnionType, getComments, resolveErrorNames } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n mutationArgTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\nconst keysPrinter = functionPrinter({ mode: 'call' })\n\nfunction createMutationArgParams(\n node: ast.OperationNode,\n options: {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n return createOperationParams(node, {\n paramsType: 'inline',\n pathParamsType: 'inline',\n paramsCasing: options.paramsCasing,\n resolver: options.resolver,\n })\n}\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n mutationKeyTypeName: string\n mutationArgTypeName: string\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n const { dataReturnType, mutationKeyTypeName, mutationArgTypeName, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, resolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n return ast.factory.createFunctionParameters({\n params: [\n ast.factory.createFunctionParameter({\n name: 'options',\n type: `{\n mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },\n client?: ${buildRequestConfigType(node, resolver)},\n shouldFetch?: boolean,\n}`,\n default: '{}',\n }),\n ],\n })\n}\n\nexport function Mutation({\n name,\n clientName,\n mutationKeyName,\n mutationKeyTypeName,\n mutationArgTypeName,\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n node,\n tsResolver,\n}: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, tsResolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const mutationArgParamsNode = createMutationArgParams(node, { paramsCasing, resolver: tsResolver })\n const hasMutationParams = mutationArgParamsNode.params.length > 0\n const argTypeBody = hasMutationParams ? (declarationPrinter.print(mutationArgParamsNode) ?? '') : ''\n const argKeysStr = hasMutationParams ? (keysPrinter.print(mutationArgParamsNode) ?? '') : ''\n\n const generics = [TData, TError, `${mutationKeyTypeName} | null`, mutationArgTypeName]\n\n const paramsNode = buildMutationParamsNode(node, {\n paramsCasing,\n dataReturnType,\n mutationKeyTypeName,\n mutationArgTypeName,\n resolver: tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n const clientCallParamsNode = createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver: tsResolver,\n extraParams: [\n ast.factory.createFunctionParameter({\n name: 'config',\n type: buildRequestConfigType(node, tsResolver),\n default: '{}',\n }),\n ],\n })\n const clientCallStr = callPrinter.print(clientCallParamsNode) ?? ''\n\n return (\n <>\n <File.Source name={mutationArgTypeName} isExportable isIndexable isTypeOnly>\n <Type name={mutationArgTypeName} export>\n {hasMutationParams ? `{ ${argTypeBody} }` : 'never'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}()\n\n return useSWRMutation<${generics.join(', ')}>(\n shouldFetch ? mutationKey : null,\n async (_url${hasMutationParams ? `, { arg: { ${argKeysStr} } }` : ''}) => {\n return ${clientName}(${clientCallStr})\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n </>\n )\n}\n","import type { Transformer } from '@internals/tanstack-query'\nimport { MutationKey as SharedMutationKey } from '@internals/tanstack-query'\nimport type { ast } from '@kubb/core'\nimport { File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n paramsCasing: 'camelcase' | undefined\n pathParamsType: 'object' | 'inline'\n transformer: Transformer | undefined\n}\n\nexport function MutationKey({ name, typeName, node, paramsCasing, pathParamsType, transformer }: Props): KubbReactNode {\n return (\n <>\n <SharedMutationKey name={name} node={node} paramsCasing={paramsCasing} pathParamsType={pathParamsType} transformer={transformer} />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildQueryOptionsParams, getEnabledParamNames, injectNonNullAssertions, markParamsOptional } from '@internals/tanstack-query'\nimport type { PluginSwr } from '../types.ts'\nimport { buildQueryKeyParams } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function getQueryOptionsParams(\n node: ast.OperationNode,\n options: {\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n return buildQueryOptionsParams(node, options)\n}\n\nexport function QueryOptions({ name, clientName, node, tsResolver, paramsCasing, paramsType, pathParamsType }: Props): KubbReactNode {\n const queryKeyParamsNode = buildQueryKeyParams(node, { pathParamsType, paramsCasing, resolver: tsResolver })\n const enabledNames = getEnabledParamNames(queryKeyParamsNode)\n\n const paramsNode = markParamsOptional(getQueryOptionsParams(node, { paramsType, paramsCasing, pathParamsType, resolver: tsResolver }), enabledNames)\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const clientCallStr = injectNonNullAssertions(callPrinter.print(paramsNode) ?? '', enabledNames)\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n return {\n fetcher: async () => {\n return ${clientName}(${clientCallStr})\n },\n }\n`}\n </Function>\n </File.Source>\n )\n}\n","import { createOperationParams } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { getEnabledParamNames, markParamsOptional } from '@internals/tanstack-query'\nimport type { PluginSwr } from '../types.ts'\nimport { buildQueryKeyParams, buildStatusUnionType, getComments, resolveErrorNames } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildQueryParamsNode(\n node: ast.OperationNode,\n options: {\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n const { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, resolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const optionsParam = ast.factory.createFunctionParameter({\n name: 'options',\n type: `{\n query?: SWRConfiguration<${[TData, TError].join(', ')}>,\n client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : 'Partial<RequestConfig> & { client?: Client }'},\n shouldFetch?: boolean,\n immutable?: boolean\n}`,\n default: '{}',\n })\n\n return createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver,\n extraParams: [optionsParam],\n })\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n node,\n tsResolver,\n}: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, tsResolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n const generics = [TData, TError, `${queryKeyTypeName} | null`]\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { pathParamsType, paramsCasing, resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n const enabledNames = getEnabledParamNames(queryKeyParamsNode)\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { paramsType, paramsCasing, pathParamsType, resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n const paramsNode = markParamsOptional(\n buildQueryParamsNode(node, { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver: tsResolver }),\n enabledNames,\n )\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n // SWR has no `enabled` option; fold the param-presence check into the null-key gate\n // so passing `undefined` for a required param disables the request (mirrors React Query #60).\n const shouldFetchExpr = enabledNames.length ? `shouldFetch && !!(${enabledNames.join(' && ')})` : 'shouldFetch'\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n\n return useSWR<${generics.join(', ')}>(\n ${shouldFetchExpr} ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...(immutable ? {\n revalidateIfStale: false,\n revalidateOnFocus: false,\n revalidateOnReconnect: false\n } : { }),\n ...queryOptions,\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACt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