@kubb/plugin-vue-query 5.5.3 → 5.5.5

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.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
@@ -397,5 +423,5 @@ export declare const pluginVueQuery: import("kubb/kit").PluginFactory<PluginVueQ
397
423
  */
398
424
  export declare const resolverVueQuery: ResolverVueQuery;
399
425
  //#endregion
400
- export { type PageParamFn, type PluginVueQuery, type ResolverVueQuery, pluginVueQuery as default };
426
+ export { type PageParamFn, type PluginVueQuery, type ResolverVueQuery, type Transformer, pluginVueQuery as default };
401
427
  //# 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
@@ -397,5 +423,5 @@ export declare const pluginVueQuery: import("kubb/kit").PluginFactory<PluginVueQ
397
423
  */
398
424
  export declare const resolverVueQuery: ResolverVueQuery;
399
425
  //#endregion
400
- export { type PageParamFn, type PluginVueQuery, type ResolverVueQuery, pluginVueQuery as default };
426
+ export { type PageParamFn, type PluginVueQuery, type ResolverVueQuery, type Transformer, pluginVueQuery as default };
401
427
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -235,12 +235,23 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
235
235
  *
236
236
  * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
237
237
  */
238
- function toCamelOrPascal(text, pascal) {
238
+ function convert(text, pascal) {
239
239
  return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
240
240
  if (word.length > 1 && word === word.toUpperCase()) return word;
241
241
  return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
242
242
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
243
243
  }
244
+ const cache = /* @__PURE__ */ new Map();
245
+ const cacheLimit = 1e4;
246
+ function toCamelOrPascal(text, pascal) {
247
+ const key = `${pascal ? "P" : "c"}${text}`;
248
+ const cached = cache.get(key);
249
+ if (cached !== void 0) return cached;
250
+ const result = convert(text, pascal);
251
+ if (cache.size >= cacheLimit) cache.clear();
252
+ cache.set(key, result);
253
+ return result;
254
+ }
244
255
  /**
245
256
  * Converts `text` to camelCase.
246
257
  *
@@ -319,7 +330,7 @@ var compatibility = {
319
330
  };
320
331
  //#endregion
321
332
  //#region package.json
322
- var version = "5.5.3";
333
+ var version = "5.5.5";
323
334
  //#endregion
324
335
  //#region ../../internals/tanstack-query/src/components/HookFile.tsx
325
336
  /**
@@ -809,6 +820,16 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
809
820
  //#endregion
810
821
  //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
811
822
  const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
823
+ /**
824
+ * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
825
+ *
826
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
827
+ *
828
+ * @example
829
+ * ```ts
830
+ * mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
831
+ * ```
832
+ */
812
833
  const mutationKeyTransformer = ({ node }) => {
813
834
  if (!node.path) return [];
814
835
  return [`{ url: '${Url.toPath(node.path)}' }`];
@@ -900,6 +921,16 @@ function createMutationResolver() {
900
921
  //#endregion
901
922
  //#region ../../internals/tanstack-query/src/components/QueryKey.tsx
902
923
  const declarationPrinter$3 = functionPrinter({ mode: "declaration" });
924
+ /**
925
+ * Default `queryKey` builder. Call it from a custom builder to extend the default key.
926
+ *
927
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
928
+ *
929
+ * @example
930
+ * ```ts
931
+ * queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
932
+ * ```
933
+ */
903
934
  const queryKeyTransformer = ({ node, variant }) => {
904
935
  if (!node.path) return [];
905
936
  const { path, query } = getOperationParameters(node);
@@ -1724,6 +1755,6 @@ const pluginVueQuery = defineExtension({
1724
1755
  }
1725
1756
  });
1726
1757
  //#endregion
1727
- export { pluginVueQuery as default, pluginVueQuery, definePageParam, pluginVueQueryName, resolverVueQuery };
1758
+ export { pluginVueQuery as default, pluginVueQuery, definePageParam, mutationKeyTransformer, pluginVueQueryName, queryKeyTransformer, resolverVueQuery };
1728
1759
 
1729
1760
  //# sourceMappingURL=index.js.map