@kubb/plugin-client 6.0.0 → 6.0.1

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
@@ -142,9 +142,9 @@ type ClientOptions = OutputOptions & {
142
142
  validator?: ValidatorOptions;
143
143
  /**
144
144
  * Shape of the value a generated operation function resolves to. Applies to the standalone
145
- * functions and the class-based SDK; not to the query-hook plugins (`@kubb/plugin-react-query`,
146
- * `@kubb/plugin-vue-query`, `@kubb/plugin-swr`), which keep calling the client directly and
147
- * expect the full result.
145
+ * functions and the class-based SDK. The query-hook plugins (`@kubb/plugin-react-query`,
146
+ * `@kubb/plugin-vue-query`, `@kubb/plugin-swr`) and `@kubb/plugin-mcp` read it to unwrap the
147
+ * call they make, and their own `returnType` sets what a hook resolves to.
148
148
  *
149
149
  * @default 'full'
150
150
  * @example
@@ -344,5 +344,4 @@ export declare function clientDependencies(options: Pick<ClientOptions, 'validat
344
344
  optional: boolean;
345
345
  };
346
346
  };
347
- export { type ClientOptions, type ClientResolvedOptions, type Options, type PluginClient, type ResolvedOptions, type ResolverClient, pluginClient as default };
348
- //# sourceMappingURL=index.d.cts.map
347
+ export { type ClientOptions, type ClientResolvedOptions, type Options, type PluginClient, type ResolvedOptions, type ResolverClient, pluginClient as default };
package/dist/index.d.ts CHANGED
@@ -142,9 +142,9 @@ type ClientOptions = OutputOptions & {
142
142
  validator?: ValidatorOptions;
143
143
  /**
144
144
  * Shape of the value a generated operation function resolves to. Applies to the standalone
145
- * functions and the class-based SDK; not to the query-hook plugins (`@kubb/plugin-react-query`,
146
- * `@kubb/plugin-vue-query`, `@kubb/plugin-swr`), which keep calling the client directly and
147
- * expect the full result.
145
+ * functions and the class-based SDK. The query-hook plugins (`@kubb/plugin-react-query`,
146
+ * `@kubb/plugin-vue-query`, `@kubb/plugin-swr`) and `@kubb/plugin-mcp` read it to unwrap the
147
+ * call they make, and their own `returnType` sets what a hook resolves to.
148
148
  *
149
149
  * @default 'full'
150
150
  * @example
@@ -344,5 +344,4 @@ export declare function clientDependencies(options: Pick<ClientOptions, 'validat
344
344
  optional: boolean;
345
345
  };
346
346
  };
347
- export { type ClientOptions, type ClientResolvedOptions, type Options, type PluginClient, type ResolvedOptions, type ResolverClient, pluginClient as default };
348
- //# sourceMappingURL=index.d.ts.map
347
+ export { type ClientOptions, type ClientResolvedOptions, type Options, type PluginClient, type ResolvedOptions, type ResolverClient, pluginClient as default };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Diagnostics, Resolver, addGenerator, ast, casing, createResolver, defineExtension, defineGenerator, injectFile, macroDedupeUnion, setMacros, setResolver, text, useConfig } from "@kubb/kit";
1
+ import { Diagnostics, Resolver, addGenerator, ast, casing, createResolver, defineExtension, defineGenerator, injectFile, macroDedupeUnion, memo, setMacros, setResolver, text, useConfig } from "@kubb/kit";
2
2
  import path from "node:path";
3
3
  import { createFunctionParameter, createFunctionParameters, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
4
4
  import { File, Function, jsxRenderer } from "@kubb/renderer-jsx";
5
- import { pluginZodName } from "@kubb/plugin-zod";
5
+ import { pluginZodName as pluginZodName$1 } from "@kubb/plugin-zod";
6
6
  import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
7
7
  import { fileURLToPath } from "node:url";
8
8
  // kubb-extension.json
@@ -11,7 +11,7 @@ var compatibility = {
11
11
  "node": ">=22.22"
12
12
  };
13
13
  // package.json
14
- var version = "6.0.0";
14
+ var version = "6.0.1";
15
15
  // ../../internals/utils/src/reserved.ts
16
16
  /**
17
17
  * JavaScript and Java reserved words.
@@ -460,7 +460,7 @@ function operationKey(node, ...scope) {
460
460
  ];
461
461
  }
462
462
  // ../../internals/client/src/resolveOperationTypes.ts
463
- const pluginZodName$1 = "plugin-zod";
463
+ const pluginZodName = "plugin-zod";
464
464
  function getResponseHeadersEntries({ node, types }) {
465
465
  const resolve = types.response.headers;
466
466
  if (!resolve) return [];
@@ -544,7 +544,7 @@ function toZodTypeResolver(resolver) {
544
544
  function resolveOperationTypes(driver, pluginName) {
545
545
  return driver.memo(`operationTypes:${pluginName}`, () => {
546
546
  const pluginTs = driver.getPlugin(pluginTsName);
547
- const pluginZod = driver.getPlugin(pluginZodName$1);
547
+ const pluginZod = driver.getPlugin(pluginZodName);
548
548
  if (pluginTs && pluginZod?.options?.inferred !== "codec") {
549
549
  const resolver = driver.getResolver(pluginTsName);
550
550
  return {
@@ -562,7 +562,7 @@ function resolveOperationTypes(driver, pluginName) {
562
562
  location: { kind: "config" },
563
563
  plugin: pluginName
564
564
  });
565
- const resolver = toZodTypeResolver(driver.getResolver(pluginZodName$1));
565
+ const resolver = toZodTypeResolver(driver.getResolver(pluginZodName));
566
566
  return {
567
567
  response: resolver.response,
568
568
  resolver,
@@ -780,8 +780,8 @@ function buildValidatorLiteral(hooks, keys) {
780
780
  function resolveOperationData({ node, ctx, types }) {
781
781
  const { driver, resolver, root } = ctx;
782
782
  const { output, validator, importPath } = ctx.options;
783
- const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null;
784
- const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null;
783
+ const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName$1) : null;
784
+ const zodResolver = pluginZod ? driver.getResolver(pluginZodName$1) : null;
785
785
  return {
786
786
  node,
787
787
  name: resolver.resolveName({
@@ -1643,8 +1643,7 @@ function collectImportsByFile(ops, pick) {
1643
1643
  ops.forEach((op) => {
1644
1644
  const { file, names } = pick(op);
1645
1645
  if (!file || names.length === 0) return;
1646
- if (!namesByPath.has(file.path)) namesByPath.set(file.path, /* @__PURE__ */ new Set());
1647
- const set = namesByPath.get(file.path);
1646
+ const set = memo(namesByPath, file.path, () => /* @__PURE__ */ new Set());
1648
1647
  names.forEach((n) => set.add(n));
1649
1648
  filesByPath.set(file.path, file);
1650
1649
  });
@@ -1904,7 +1903,7 @@ function setupClient({ name, resolved, macros = [], client }) {
1904
1903
  function clientDependencies(options) {
1905
1904
  return {
1906
1905
  [pluginTsName]: { optional: true },
1907
- [pluginZodName]: { optional: !isValidatorEnabled(options.validator) }
1906
+ [pluginZodName$1]: { optional: !isValidatorEnabled(options.validator) }
1908
1907
  };
1909
1908
  }
1910
1909
  // src/plugin.ts