@kubb/plugin-react-query 5.5.3 → 5.5.4
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 +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/docs/options.md +20 -4
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -138,6 +138,32 @@ type Infinite = {
|
|
|
138
138
|
};
|
|
139
139
|
type PageParamFn<TPage = any, TParam = any> = (page: TPage, allPages: Array<TPage>, pageParam: TParam, allPageParams: Array<TParam>) => TParam | undefined | null;
|
|
140
140
|
//#endregion
|
|
141
|
+
//#region ../../internals/tanstack-query/src/components/MutationKey.d.ts
|
|
142
|
+
/**
|
|
143
|
+
* Default `mutationKey` builder. Call it from a custom builder to extend the default key.
|
|
144
|
+
*
|
|
145
|
+
* @remarks The returned segments may change between releases. Spread them instead of reading single entries.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export declare const mutationKeyTransformer: Transformer;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region ../../internals/tanstack-query/src/components/QueryKey.d.ts
|
|
155
|
+
/**
|
|
156
|
+
* Default `queryKey` builder. Call it from a custom builder to extend the default key.
|
|
157
|
+
*
|
|
158
|
+
* @remarks The returned segments may change between releases. Spread them instead of reading single entries.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare const queryKeyTransformer: Transformer;
|
|
166
|
+
//#endregion
|
|
141
167
|
//#region ../../internals/tanstack-query/src/utils.d.ts
|
|
142
168
|
/**
|
|
143
169
|
* Helper to define a typed page param function for `infinite.getNextPageParam` or
|
|
@@ -534,5 +560,5 @@ export declare const pluginReactQuery: import("kubb/kit").PluginFactory<PluginRe
|
|
|
534
560
|
*/
|
|
535
561
|
export declare const resolverReactQuery: ResolverReactQuery;
|
|
536
562
|
//#endregion
|
|
537
|
-
export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, pluginReactQuery as default };
|
|
563
|
+
export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, type Transformer, pluginReactQuery as default };
|
|
538
564
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,32 @@ type Infinite = {
|
|
|
138
138
|
};
|
|
139
139
|
type PageParamFn<TPage = any, TParam = any> = (page: TPage, allPages: Array<TPage>, pageParam: TParam, allPageParams: Array<TParam>) => TParam | undefined | null;
|
|
140
140
|
//#endregion
|
|
141
|
+
//#region ../../internals/tanstack-query/src/components/MutationKey.d.ts
|
|
142
|
+
/**
|
|
143
|
+
* Default `mutationKey` builder. Call it from a custom builder to extend the default key.
|
|
144
|
+
*
|
|
145
|
+
* @remarks The returned segments may change between releases. Spread them instead of reading single entries.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export declare const mutationKeyTransformer: Transformer;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region ../../internals/tanstack-query/src/components/QueryKey.d.ts
|
|
155
|
+
/**
|
|
156
|
+
* Default `queryKey` builder. Call it from a custom builder to extend the default key.
|
|
157
|
+
*
|
|
158
|
+
* @remarks The returned segments may change between releases. Spread them instead of reading single entries.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare const queryKeyTransformer: Transformer;
|
|
166
|
+
//#endregion
|
|
141
167
|
//#region ../../internals/tanstack-query/src/utils.d.ts
|
|
142
168
|
/**
|
|
143
169
|
* Helper to define a typed page param function for `infinite.getNextPageParam` or
|
|
@@ -534,5 +560,5 @@ export declare const pluginReactQuery: import("kubb/kit").PluginFactory<PluginRe
|
|
|
534
560
|
*/
|
|
535
561
|
export declare const resolverReactQuery: ResolverReactQuery;
|
|
536
562
|
//#endregion
|
|
537
|
-
export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, pluginReactQuery as default };
|
|
563
|
+
export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, type Transformer, pluginReactQuery as default };
|
|
538
564
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -320,7 +320,7 @@ var compatibility = {
|
|
|
320
320
|
};
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region package.json
|
|
323
|
-
var version = "5.5.
|
|
323
|
+
var version = "5.5.4";
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region ../../internals/client/src/resolveClient.ts
|
|
326
326
|
/**
|
|
@@ -846,6 +846,11 @@ function getDefaultPageParamsWarning(node, infinite) {
|
|
|
846
846
|
return `${node.operationId}: the default infinite page params expect an array response and never end for this one. Set \`infinite.getNextPageParam\` (or \`nextParam\`) to read the next page from the response.`;
|
|
847
847
|
}
|
|
848
848
|
function matchesPattern(node, ov) {
|
|
849
|
+
if ("key" in ov) {
|
|
850
|
+
const extensions = node.extensions;
|
|
851
|
+
if (!extensions || !(ov.key in extensions)) return false;
|
|
852
|
+
return ov.value === void 0 || extensions[ov.key] === ov.value;
|
|
853
|
+
}
|
|
849
854
|
const { type, pattern } = ov;
|
|
850
855
|
const matches = (value) => typeof pattern === "string" ? value === pattern : pattern.test(value);
|
|
851
856
|
if (type === "operationId") return matches(node.operationId);
|
|
@@ -1010,6 +1015,16 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
|
|
|
1010
1015
|
//#endregion
|
|
1011
1016
|
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
1012
1017
|
const declarationPrinter$5 = functionPrinter({ mode: "declaration" });
|
|
1018
|
+
/**
|
|
1019
|
+
* Default `mutationKey` builder. Call it from a custom builder to extend the default key.
|
|
1020
|
+
*
|
|
1021
|
+
* @remarks The returned segments may change between releases. Spread them instead of reading single entries.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```ts
|
|
1025
|
+
* mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1013
1028
|
const mutationKeyTransformer = ({ node }) => {
|
|
1014
1029
|
if (!node.path) return [];
|
|
1015
1030
|
return [`{ url: '${Url.toPath(node.path)}' }`];
|
|
@@ -1101,6 +1116,16 @@ function createMutationResolver() {
|
|
|
1101
1116
|
//#endregion
|
|
1102
1117
|
//#region ../../internals/tanstack-query/src/components/QueryKey.tsx
|
|
1103
1118
|
const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
|
|
1119
|
+
/**
|
|
1120
|
+
* Default `queryKey` builder. Call it from a custom builder to extend the default key.
|
|
1121
|
+
*
|
|
1122
|
+
* @remarks The returned segments may change between releases. Spread them instead of reading single entries.
|
|
1123
|
+
*
|
|
1124
|
+
* @example
|
|
1125
|
+
* ```ts
|
|
1126
|
+
* queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
|
|
1127
|
+
* ```
|
|
1128
|
+
*/
|
|
1104
1129
|
const queryKeyTransformer = ({ node, variant }) => {
|
|
1105
1130
|
if (!node.path) return [];
|
|
1106
1131
|
const { path, query } = getOperationParameters(node);
|
|
@@ -2079,6 +2104,6 @@ const pluginReactQuery = defineExtension({
|
|
|
2079
2104
|
}
|
|
2080
2105
|
});
|
|
2081
2106
|
//#endregion
|
|
2082
|
-
export { pluginReactQuery as default, pluginReactQuery, definePageParam, pluginReactQueryName, resolverReactQuery };
|
|
2107
|
+
export { pluginReactQuery as default, pluginReactQuery, definePageParam, mutationKeyTransformer, pluginReactQueryName, queryKeyTransformer, resolverReactQuery };
|
|
2083
2108
|
|
|
2084
2109
|
//# sourceMappingURL=index.js.map
|