@kubb/plugin-swr 5.0.0-beta.95 → 5.0.0-beta.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +83 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +82 -82
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -28,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
enumerable: true
|
|
29
29
|
}) : target, mod));
|
|
30
30
|
//#endregion
|
|
31
|
-
let kubb_kit = require("kubb/kit");
|
|
32
|
-
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
33
31
|
let node_path = require("node:path");
|
|
34
32
|
node_path = __toESM(node_path, 1);
|
|
33
|
+
let kubb_kit = require("kubb/kit");
|
|
34
|
+
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
35
35
|
let kubb_jsx = require("kubb/jsx");
|
|
36
36
|
let kubb_jsx_jsx_runtime = require("kubb/jsx/jsx-runtime");
|
|
37
37
|
//#region ../../internals/utils/src/casing.ts
|
|
@@ -660,87 +660,6 @@ function resolveClientOperation(options) {
|
|
|
660
660
|
};
|
|
661
661
|
}
|
|
662
662
|
//#endregion
|
|
663
|
-
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
664
|
-
const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
665
|
-
const mutationKeyTransformer = ({ node }) => {
|
|
666
|
-
if (!node.path) return [];
|
|
667
|
-
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
668
|
-
};
|
|
669
|
-
function MutationKey$1({ name, node, transformer }) {
|
|
670
|
-
const paramsNode = (0, _kubb_plugin_ts.createFunctionParameters)({ params: [] });
|
|
671
|
-
const paramsSignature = declarationPrinter$4.print(paramsNode) ?? "";
|
|
672
|
-
const keys = (transformer ?? mutationKeyTransformer)({
|
|
673
|
-
node,
|
|
674
|
-
casing: "camelcase"
|
|
675
|
-
});
|
|
676
|
-
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
|
|
677
|
-
name,
|
|
678
|
-
isExportable: true,
|
|
679
|
-
isIndexable: true,
|
|
680
|
-
children: /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.Function.Arrow, {
|
|
681
|
-
name,
|
|
682
|
-
export: true,
|
|
683
|
-
params: paramsSignature,
|
|
684
|
-
singleLine: true,
|
|
685
|
-
children: `[${keys.join(", ")}] as const`
|
|
686
|
-
})
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
__name(MutationKey$1, "MutationKey");
|
|
690
|
-
//#endregion
|
|
691
|
-
//#region ../../internals/tanstack-query/src/resolver.ts
|
|
692
|
-
/**
|
|
693
|
-
* Builds the shared query namespace for a variant. Spread the result into
|
|
694
|
-
* `createResolver` once per variant the plugin supports.
|
|
695
|
-
*
|
|
696
|
-
* @example
|
|
697
|
-
* ```ts
|
|
698
|
-
* createResolver<PluginReactQuery>({
|
|
699
|
-
* query: createQueryResolver(),
|
|
700
|
-
* suspenseQuery: createQueryResolver('Suspense'),
|
|
701
|
-
* })
|
|
702
|
-
* ```
|
|
703
|
-
*/
|
|
704
|
-
function createQueryResolver(variant = "") {
|
|
705
|
-
return {
|
|
706
|
-
name(node) {
|
|
707
|
-
return `use${capitalize(this.name(node.operationId))}${variant}`;
|
|
708
|
-
},
|
|
709
|
-
optionsName(node) {
|
|
710
|
-
return `${this.name(node.operationId)}${variant}QueryOptions`;
|
|
711
|
-
},
|
|
712
|
-
keyName(node) {
|
|
713
|
-
return `${this.name(node.operationId)}${variant}QueryKey`;
|
|
714
|
-
},
|
|
715
|
-
keyTypeName(node) {
|
|
716
|
-
return `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
|
|
717
|
-
},
|
|
718
|
-
clientName(node) {
|
|
719
|
-
return `${this.name(node.operationId)}${variant}`;
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
* Builds the shared mutation namespace. Spread the result into
|
|
725
|
-
* `createResolver` and add plugin-specific methods (`optionsName`,
|
|
726
|
-
* `typeName`, `argTypeName`) next to it.
|
|
727
|
-
*
|
|
728
|
-
* @example
|
|
729
|
-
* ```ts
|
|
730
|
-
* createResolver<PluginSwr>({ mutation: { ...createMutationResolver(), argTypeName(node) {...} } })
|
|
731
|
-
* ```
|
|
732
|
-
*/
|
|
733
|
-
function createMutationResolver() {
|
|
734
|
-
return {
|
|
735
|
-
name(node) {
|
|
736
|
-
return `use${capitalize(this.name(node.operationId))}`;
|
|
737
|
-
},
|
|
738
|
-
keyName(node) {
|
|
739
|
-
return `${this.name(node.operationId)}MutationKey`;
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
//#endregion
|
|
744
663
|
//#region ../../internals/tanstack-query/src/utils.ts
|
|
745
664
|
/**
|
|
746
665
|
* The grouped request options, ordered for both the destructured signature and the
|
|
@@ -888,6 +807,87 @@ function buildQueryKeyParams(node, options) {
|
|
|
888
807
|
return (0, _kubb_plugin_ts.createFunctionParameters)({ params: groupedParam ? [groupedParam] : [] });
|
|
889
808
|
}
|
|
890
809
|
//#endregion
|
|
810
|
+
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
811
|
+
const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
812
|
+
const mutationKeyTransformer = ({ node }) => {
|
|
813
|
+
if (!node.path) return [];
|
|
814
|
+
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
815
|
+
};
|
|
816
|
+
function MutationKey$1({ name, node, transformer }) {
|
|
817
|
+
const paramsNode = (0, _kubb_plugin_ts.createFunctionParameters)({ params: [] });
|
|
818
|
+
const paramsSignature = declarationPrinter$4.print(paramsNode) ?? "";
|
|
819
|
+
const keys = (transformer ?? mutationKeyTransformer)({
|
|
820
|
+
node,
|
|
821
|
+
casing: "camelcase"
|
|
822
|
+
});
|
|
823
|
+
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
|
|
824
|
+
name,
|
|
825
|
+
isExportable: true,
|
|
826
|
+
isIndexable: true,
|
|
827
|
+
children: /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.Function.Arrow, {
|
|
828
|
+
name,
|
|
829
|
+
export: true,
|
|
830
|
+
params: paramsSignature,
|
|
831
|
+
singleLine: true,
|
|
832
|
+
children: `[${keys.join(", ")}] as const`
|
|
833
|
+
})
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
__name(MutationKey$1, "MutationKey");
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region ../../internals/tanstack-query/src/resolver.ts
|
|
839
|
+
/**
|
|
840
|
+
* Builds the shared query namespace for a variant. Spread the result into
|
|
841
|
+
* `createResolver` once per variant the plugin supports.
|
|
842
|
+
*
|
|
843
|
+
* @example
|
|
844
|
+
* ```ts
|
|
845
|
+
* createResolver<PluginReactQuery>({
|
|
846
|
+
* query: createQueryResolver(),
|
|
847
|
+
* suspenseQuery: createQueryResolver('Suspense'),
|
|
848
|
+
* })
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
function createQueryResolver(variant = "") {
|
|
852
|
+
return {
|
|
853
|
+
name(node) {
|
|
854
|
+
return `use${capitalize(this.name(node.operationId))}${variant}`;
|
|
855
|
+
},
|
|
856
|
+
optionsName(node) {
|
|
857
|
+
return `${this.name(node.operationId)}${variant}QueryOptions`;
|
|
858
|
+
},
|
|
859
|
+
keyName(node) {
|
|
860
|
+
return `${this.name(node.operationId)}${variant}QueryKey`;
|
|
861
|
+
},
|
|
862
|
+
keyTypeName(node) {
|
|
863
|
+
return `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
|
|
864
|
+
},
|
|
865
|
+
clientName(node) {
|
|
866
|
+
return `${this.name(node.operationId)}${variant}`;
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Builds the shared mutation namespace. Spread the result into
|
|
872
|
+
* `createResolver` and add plugin-specific methods (`optionsName`,
|
|
873
|
+
* `typeName`, `argTypeName`) next to it.
|
|
874
|
+
*
|
|
875
|
+
* @example
|
|
876
|
+
* ```ts
|
|
877
|
+
* createResolver<PluginSwr>({ mutation: { ...createMutationResolver(), argTypeName(node) {...} } })
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
function createMutationResolver() {
|
|
881
|
+
return {
|
|
882
|
+
name(node) {
|
|
883
|
+
return `use${capitalize(this.name(node.operationId))}`;
|
|
884
|
+
},
|
|
885
|
+
keyName(node) {
|
|
886
|
+
return `${this.name(node.operationId)}MutationKey`;
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
//#endregion
|
|
891
891
|
//#region ../../internals/tanstack-query/src/components/QueryKey.tsx
|
|
892
892
|
const declarationPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
893
893
|
const queryKeyTransformer = ({ node }) => {
|