@kubb/plugin-vue-query 5.10.4 → 5.10.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/README.md CHANGED
@@ -29,6 +29,8 @@
29
29
  ## Installation
30
30
 
31
31
  ```bash
32
+ npx kubb add plugin-vue-query
33
+ # or
32
34
  bun add @kubb/plugin-vue-query
33
35
  # or
34
36
  pnpm add @kubb/plugin-vue-query
@@ -36,6 +38,8 @@ pnpm add @kubb/plugin-vue-query
36
38
  npm install @kubb/plugin-vue-query
37
39
  ```
38
40
 
41
+ `kubb add` installs the version the [Kubb registry](https://kubb.dev/registry) pins and adds `pluginVueQuery()` to your `kubb.config.ts`. Run `npx kubb init` first if you have no config.
42
+
39
43
  ## Documentation
40
44
 
41
45
  See the [full documentation](https://kubb.dev/extensions/kubb-labs/plugin-vue-query) for configuration options and examples.
package/dist/index.cjs CHANGED
@@ -35,7 +35,7 @@ var compatibility = {
35
35
  "node": ">=22.22"
36
36
  };
37
37
  // package.json
38
- var version = "5.10.4";
38
+ var version = "5.10.5";
39
39
  // ../../internals/client/src/resolveClient.ts
40
40
  /**
41
41
  * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
@@ -339,7 +339,7 @@ function operationFileEntry(node, name, extname = ".ts") {
339
339
  * operation. The plugin itself and every plugin that imports from it call this, so they all get
340
340
  * the same path.
341
341
  *
342
- * When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name
342
+ * When that path matches the file of a component schema in `ctx.schemas`, ignoring case, the file name
343
343
  * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.
344
344
  * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.
345
345
  * Only the file name changes. The declarations keep their names.
@@ -358,7 +358,7 @@ function resolveOperationFile(options) {
358
358
  group: options.group ?? void 0
359
359
  };
360
360
  return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {
361
- const schemaPaths = memo(`${resolver.pluginName}:schemaFilePaths`, () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => schema.name ? [resolver.file({
361
+ const schemaPaths = memo(`${resolver.pluginName}:schemaFilePaths`, () => new Set(ctx.schemas.flatMap((schema) => schema.name ? [resolver.file({
362
362
  name: schema.name,
363
363
  extname: ".ts",
364
364
  ...location
@@ -627,11 +627,12 @@ function resolveImportPath(options) {
627
627
  * and import path therefore match the `<op>` actually emitted, even when an `override` changes it.
628
628
  */
629
629
  function resolveClientOperation(options) {
630
- const { clientPlugin, driver, node, root, output, memo } = options;
630
+ const { clientPlugin, ctx, node, root, output } = options;
631
+ const { memo } = ctx;
631
632
  if (!clientPlugin) return null;
632
633
  return memo(`${clientPlugin.pluginName}:clientOperation:${node.operationId}`, () => {
633
- const resolver = driver.getResolver(clientPlugin.pluginName);
634
- const pluginOptions = driver.getPlugin(clientPlugin.pluginName)?.options ?? {};
634
+ const resolver = ctx.getResolver(clientPlugin.pluginName);
635
+ const pluginOptions = ctx.getPlugin(clientPlugin.pluginName)?.options ?? {};
635
636
  const { exclude, include, override } = pluginOptions;
636
637
  const operationOptions = Boolean(exclude?.length || include?.length || override?.length) && resolver.default ? resolver.default.options(node, {
637
638
  options: pluginOptions,
@@ -742,16 +743,16 @@ function toZodTypeResolver(resolver) {
742
743
  *
743
744
  * @example
744
745
  * ```ts
745
- * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)
746
+ * const types = resolveOperationTypes(ctx, ctx.plugin.name)
746
747
  * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod
747
748
  * ```
748
749
  */
749
- function resolveOperationTypes(driver, pluginName) {
750
- return driver.memo(`operationTypes:${pluginName}`, () => {
751
- const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
752
- const pluginZod = driver.getPlugin(pluginZodName);
750
+ function resolveOperationTypes(ctx, pluginName) {
751
+ return ctx.memo(`operationTypes:${pluginName}`, () => {
752
+ const pluginTs = ctx.getPlugin(_kubb_plugin_ts.pluginTsName);
753
+ const pluginZod = ctx.getPlugin(pluginZodName);
753
754
  if (pluginTs && pluginZod?.options?.inferred !== "codec") {
754
- const resolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
755
+ const resolver = ctx.getResolver(_kubb_plugin_ts.pluginTsName);
755
756
  return {
756
757
  response: resolver.response,
757
758
  resolver,
@@ -767,7 +768,7 @@ function resolveOperationTypes(driver, pluginName) {
767
768
  location: { kind: "config" },
768
769
  plugin: pluginName
769
770
  });
770
- const resolver = toZodTypeResolver(driver.getResolver(pluginZodName));
771
+ const resolver = toZodTypeResolver(ctx.getResolver(pluginZodName));
771
772
  return {
772
773
  response: resolver.response,
773
774
  resolver,
@@ -792,7 +793,7 @@ function resolveHookFile(node, ctx, options) {
792
793
  location: { kind: "config" },
793
794
  plugin: resolver.pluginName
794
795
  });
795
- const types = resolveOperationTypes(ctx.driver, resolver.pluginName);
796
+ const types = resolveOperationTypes(ctx, resolver.pluginName);
796
797
  const tsResolver = types.resolver;
797
798
  const headerTypeNames = returnType === "data" || !contractOp.typedHeaders ? [] : getResponseHeadersTypeNames({
798
799
  node,
@@ -1650,7 +1651,7 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
1650
1651
  },
1651
1652
  operation(node, ctx) {
1652
1653
  if (!_kubb_kit.ast.http.isOperation(node)) return null;
1653
- const { driver, resolver, root } = ctx;
1654
+ const { resolver, root } = ctx;
1654
1655
  const { output, query, infinite, client, group } = ctx.options;
1655
1656
  const infiniteOptions = infinite && typeof infinite === "object" ? infinite : null;
1656
1657
  if (!infiniteOptions) return null;
@@ -1659,11 +1660,10 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
1659
1660
  const importPath = query ? query.importPath : "@tanstack/vue-query";
1660
1661
  const contractOp = resolveClientOperation({
1661
1662
  clientPlugin: { pluginName: client.pluginName },
1662
- driver,
1663
+ ctx,
1663
1664
  node,
1664
1665
  root,
1665
- output,
1666
- memo: ctx.memo
1666
+ output
1667
1667
  });
1668
1668
  if (!contractOp) return null;
1669
1669
  const queryName = resolver.infiniteQuery.name(node);
@@ -1678,7 +1678,7 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
1678
1678
  returnType: ctx.options.returnType,
1679
1679
  keyTypeName: queryKeyTypeName,
1680
1680
  extraTypeNames: [resolvePageParamType(node, {
1681
- resolver: resolveOperationTypes(ctx.driver, ctx.resolver.pluginName).resolver,
1681
+ resolver: resolveOperationTypes(ctx, ctx.resolver.pluginName).resolver,
1682
1682
  initialPageParam: infiniteOptions.initialPageParam,
1683
1683
  queryParam: infiniteOptions.queryParam
1684
1684
  }).queryParamsTypeName]
@@ -1858,7 +1858,7 @@ const mutationGenerator = (0, _kubb_kit.defineGenerator)({
1858
1858
  renderer: _kubb_renderer_jsx.jsxRenderer,
1859
1859
  operation(node, ctx) {
1860
1860
  if (!_kubb_kit.ast.http.isOperation(node)) return null;
1861
- const { driver, resolver, root } = ctx;
1861
+ const { resolver, root } = ctx;
1862
1862
  const { output, query, mutation, client, group, hooks } = ctx.options;
1863
1863
  const { isMutation } = classifyOperation(node, {
1864
1864
  query,
@@ -1868,11 +1868,10 @@ const mutationGenerator = (0, _kubb_kit.defineGenerator)({
1868
1868
  const importPath = mutation ? mutation.importPath : "@tanstack/vue-query";
1869
1869
  const contractOp = resolveClientOperation({
1870
1870
  clientPlugin: { pluginName: client.pluginName },
1871
- driver,
1871
+ ctx,
1872
1872
  node,
1873
1873
  root,
1874
- output,
1875
- memo: ctx.memo
1874
+ output
1876
1875
  });
1877
1876
  if (!contractOp) return null;
1878
1877
  const mutationHookName = resolver.mutation.name(node);
@@ -1934,7 +1933,7 @@ const queryGenerator = (0, _kubb_kit.defineGenerator)({
1934
1933
  renderer: _kubb_renderer_jsx.jsxRenderer,
1935
1934
  operation(node, ctx) {
1936
1935
  if (!_kubb_kit.ast.http.isOperation(node)) return null;
1937
- const { driver, resolver, root } = ctx;
1936
+ const { resolver, root } = ctx;
1938
1937
  const { output, query, mutation, client, group, hooks } = ctx.options;
1939
1938
  const { isQuery, isMutation } = classifyOperation(node, {
1940
1939
  query,
@@ -1944,11 +1943,10 @@ const queryGenerator = (0, _kubb_kit.defineGenerator)({
1944
1943
  const importPath = query ? query.importPath : "@tanstack/vue-query";
1945
1944
  const contractOp = resolveClientOperation({
1946
1945
  clientPlugin: { pluginName: client.pluginName },
1947
- driver,
1946
+ ctx,
1948
1947
  node,
1949
1948
  root,
1950
- output,
1951
- memo: ctx.memo
1949
+ output
1952
1950
  });
1953
1951
  if (!contractOp) return null;
1954
1952
  const queryName = resolver.query.name(node);