@kubb/agent 5.0.0-alpha.26 → 5.0.0-alpha.28

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.
@@ -5250,37 +5250,37 @@ function toStructType({ node, params, resolver }) {
5250
5250
  });
5251
5251
  }
5252
5252
 
5253
- var __defProp$h = Object.defineProperty;
5254
- var __typeError$c = (msg) => {
5253
+ var __defProp$i = Object.defineProperty;
5254
+ var __typeError$d = (msg) => {
5255
5255
  throw TypeError(msg);
5256
5256
  };
5257
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5258
- var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
5259
- var __accessCheck$c = (obj, member, msg) => member.has(obj) || __typeError$c("Cannot " + msg);
5260
- var __privateGet$c = (obj, member, getter) => (__accessCheck$c(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
5261
- var __privateAdd$c = (obj, member, value) => member.has(obj) ? __typeError$c("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
5262
- var __privateSet$c = (obj, member, value, setter) => (__accessCheck$c(obj, member, "write to private field"), member.set(obj, value), value);
5263
- var __privateMethod$c = (obj, member, method) => (__accessCheck$c(obj, member, "access private method"), method);
5257
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5258
+ var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
5259
+ var __accessCheck$d = (obj, member, msg) => member.has(obj) || __typeError$d("Cannot " + msg);
5260
+ var __privateGet$d = (obj, member, getter) => (__accessCheck$d(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
5261
+ var __privateAdd$d = (obj, member, value) => member.has(obj) ? __typeError$d("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
5262
+ var __privateSet$d = (obj, member, value, setter) => (__accessCheck$d(obj, member, "write to private field"), member.set(obj, value), value);
5263
+ var __privateMethod$d = (obj, member, method) => (__accessCheck$d(obj, member, "access private method"), method);
5264
5264
  var __privateWrapper = (obj, member, setter, getter) => ({
5265
5265
  set _(value) {
5266
- __privateSet$c(obj, member, value);
5266
+ __privateSet$d(obj, member, value);
5267
5267
  },
5268
5268
  get _() {
5269
- return __privateGet$c(obj, member, getter);
5269
+ return __privateGet$d(obj, member, getter);
5270
5270
  }
5271
5271
  });
5272
- var _emitter, _a$c, _options$c, _URLPath_instances$a, transformParam_fn$a, eachParam_fn$a, _b$1, _head, _tail, _size, _c, _studioIsOpen, _PluginDriver_instances, emitProcessingEnd_fn, execute_fn, executeSync_fn, _d, _items, _FunctionParams_static, _e, orderItems_fn, addParams_fn, _cachedLeaves, _f;
5272
+ var _emitter, _a$d, _options$d, _URLPath_instances$b, transformParam_fn$b, eachParam_fn$b, _b$1, _head, _tail, _size, _c, _studioIsOpen, _PluginDriver_instances, emitProcessingEnd_fn, execute_fn, executeSync_fn, _d, _items, _FunctionParams_static, _e, orderItems_fn, addParams_fn, _cachedLeaves, _f;
5273
5273
  function toError(value) {
5274
5274
  return value instanceof Error ? value : new Error(String(value));
5275
5275
  }
5276
- var AsyncEventEmitter = (_a$c = class {
5276
+ var AsyncEventEmitter = (_a$d = class {
5277
5277
  /**
5278
5278
  * Maximum number of listeners per event before Node emits a memory-leak warning.
5279
5279
  * @default 10
5280
5280
  */
5281
5281
  constructor(maxListener = 10) {
5282
- __privateAdd$c(this, _emitter, new EventEmitter());
5283
- __privateGet$c(this, _emitter).setMaxListeners(maxListener);
5282
+ __privateAdd$d(this, _emitter, new EventEmitter());
5283
+ __privateGet$d(this, _emitter).setMaxListeners(maxListener);
5284
5284
  }
5285
5285
  /**
5286
5286
  * Emits `eventName` and awaits all registered listeners sequentially.
@@ -5292,7 +5292,7 @@ var AsyncEventEmitter = (_a$c = class {
5292
5292
  * ```
5293
5293
  */
5294
5294
  async emit(eventName, ...eventArgs) {
5295
- const listeners = __privateGet$c(this, _emitter).listeners(eventName);
5295
+ const listeners = __privateGet$d(this, _emitter).listeners(eventName);
5296
5296
  if (listeners.length === 0) return;
5297
5297
  for (const listener of listeners) try {
5298
5298
  await listener(...eventArgs);
@@ -5315,7 +5315,7 @@ var AsyncEventEmitter = (_a$c = class {
5315
5315
  * ```
5316
5316
  */
5317
5317
  on(eventName, handler) {
5318
- __privateGet$c(this, _emitter).on(eventName, handler);
5318
+ __privateGet$d(this, _emitter).on(eventName, handler);
5319
5319
  }
5320
5320
  /**
5321
5321
  * Registers a one-shot listener that removes itself after the first invocation.
@@ -5341,7 +5341,7 @@ var AsyncEventEmitter = (_a$c = class {
5341
5341
  * ```
5342
5342
  */
5343
5343
  off(eventName, handler) {
5344
- __privateGet$c(this, _emitter).off(eventName, handler);
5344
+ __privateGet$d(this, _emitter).off(eventName, handler);
5345
5345
  }
5346
5346
  /**
5347
5347
  * Removes all listeners from every event channel.
@@ -5352,9 +5352,9 @@ var AsyncEventEmitter = (_a$c = class {
5352
5352
  * ```
5353
5353
  */
5354
5354
  removeAll() {
5355
- __privateGet$c(this, _emitter).removeAllListeners();
5355
+ __privateGet$d(this, _emitter).removeAllListeners();
5356
5356
  }
5357
- }, _emitter = new WeakMap(), _a$c);
5357
+ }, _emitter = new WeakMap(), _a$d);
5358
5358
  function toCamelOrPascal$e(text, pascal) {
5359
5359
  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) => {
5360
5360
  if (word.length > 1 && word === word.toUpperCase()) return word;
@@ -5538,16 +5538,16 @@ function isValidVarName$b(name) {
5538
5538
  }
5539
5539
  return true;
5540
5540
  }
5541
- var URLPath$a = (_b$1 = class {
5541
+ var URLPath$b = (_b$1 = class {
5542
5542
  constructor(path2, options = {}) {
5543
- __privateAdd$c(this, _URLPath_instances$a);
5543
+ __privateAdd$d(this, _URLPath_instances$b);
5544
5544
  /**
5545
5545
  * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
5546
5546
  */
5547
- __publicField$b(this, "path");
5548
- __privateAdd$c(this, _options$c);
5547
+ __publicField$c(this, "path");
5548
+ __privateAdd$d(this, _options$d);
5549
5549
  this.path = path2;
5550
- __privateSet$c(this, _options$c, options);
5550
+ __privateSet$d(this, _options$d, options);
5551
5551
  }
5552
5552
  /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
5553
5553
  *
@@ -5628,7 +5628,7 @@ var URLPath$a = (_b$1 = class {
5628
5628
  toTemplateString({ prefix = "", replacer } = {}) {
5629
5629
  return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
5630
5630
  if (i % 2 === 0) return part;
5631
- const param = __privateMethod$c(this, _URLPath_instances$a, transformParam_fn$a).call(this, part);
5631
+ const param = __privateMethod$d(this, _URLPath_instances$b, transformParam_fn$b).call(this, part);
5632
5632
  return `\${${replacer ? replacer(param) : param}}`;
5633
5633
  }).join("")}\``;
5634
5634
  }
@@ -5645,7 +5645,7 @@ var URLPath$a = (_b$1 = class {
5645
5645
  */
5646
5646
  getParams(replacer) {
5647
5647
  const params = {};
5648
- __privateMethod$c(this, _URLPath_instances$a, eachParam_fn$a).call(this, (_raw, param) => {
5648
+ __privateMethod$d(this, _URLPath_instances$b, eachParam_fn$b).call(this, (_raw, param) => {
5649
5649
  const key = replacer ? replacer(param) : param;
5650
5650
  params[key] = key;
5651
5651
  });
@@ -5661,16 +5661,16 @@ var URLPath$a = (_b$1 = class {
5661
5661
  toURLPath() {
5662
5662
  return this.path.replace(/\{([^}]+)\}/g, ":$1");
5663
5663
  }
5664
- }, _options$c = new WeakMap(), _URLPath_instances$a = new WeakSet(), transformParam_fn$a = function(raw) {
5664
+ }, _options$d = new WeakMap(), _URLPath_instances$b = new WeakSet(), transformParam_fn$b = function(raw) {
5665
5665
  const param = isValidVarName$b(raw) ? raw : camelCase$e(raw);
5666
- return __privateGet$c(this, _options$c).casing === "camelcase" ? camelCase$e(param) : param;
5666
+ return __privateGet$d(this, _options$d).casing === "camelcase" ? camelCase$e(param) : param;
5667
5667
  }, /**
5668
5668
  * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
5669
5669
  */
5670
- eachParam_fn$a = function(fn) {
5670
+ eachParam_fn$b = function(fn) {
5671
5671
  for (const match2 of this.path.matchAll(/\{([^}]+)\}/g)) {
5672
5672
  const raw = match2[1];
5673
- fn(raw, __privateMethod$c(this, _URLPath_instances$a, transformParam_fn$a).call(this, raw));
5673
+ fn(raw, __privateMethod$d(this, _URLPath_instances$b, transformParam_fn$b).call(this, raw));
5674
5674
  }
5675
5675
  }, _b$1);
5676
5676
  function isInputPath(config) {
@@ -5752,58 +5752,58 @@ async function openInStudio(root, studioUrl, options = {}) {
5752
5752
  }
5753
5753
  var Node = class {
5754
5754
  constructor(value) {
5755
- __publicField$b(this, "value");
5756
- __publicField$b(this, "next");
5755
+ __publicField$c(this, "value");
5756
+ __publicField$c(this, "next");
5757
5757
  this.value = value;
5758
5758
  }
5759
5759
  };
5760
5760
  var Queue = (_c = class {
5761
5761
  constructor() {
5762
- __privateAdd$c(this, _head);
5763
- __privateAdd$c(this, _tail);
5764
- __privateAdd$c(this, _size);
5762
+ __privateAdd$d(this, _head);
5763
+ __privateAdd$d(this, _tail);
5764
+ __privateAdd$d(this, _size);
5765
5765
  this.clear();
5766
5766
  }
5767
5767
  enqueue(value) {
5768
5768
  const node = new Node(value);
5769
- if (__privateGet$c(this, _head)) {
5770
- __privateGet$c(this, _tail).next = node;
5771
- __privateSet$c(this, _tail, node);
5769
+ if (__privateGet$d(this, _head)) {
5770
+ __privateGet$d(this, _tail).next = node;
5771
+ __privateSet$d(this, _tail, node);
5772
5772
  } else {
5773
- __privateSet$c(this, _head, node);
5774
- __privateSet$c(this, _tail, node);
5773
+ __privateSet$d(this, _head, node);
5774
+ __privateSet$d(this, _tail, node);
5775
5775
  }
5776
5776
  __privateWrapper(this, _size)._++;
5777
5777
  }
5778
5778
  dequeue() {
5779
- const current = __privateGet$c(this, _head);
5779
+ const current = __privateGet$d(this, _head);
5780
5780
  if (!current) return;
5781
- __privateSet$c(this, _head, __privateGet$c(this, _head).next);
5781
+ __privateSet$d(this, _head, __privateGet$d(this, _head).next);
5782
5782
  __privateWrapper(this, _size)._--;
5783
- if (!__privateGet$c(this, _head)) __privateSet$c(this, _tail, void 0);
5783
+ if (!__privateGet$d(this, _head)) __privateSet$d(this, _tail, void 0);
5784
5784
  return current.value;
5785
5785
  }
5786
5786
  peek() {
5787
- if (!__privateGet$c(this, _head)) return;
5788
- return __privateGet$c(this, _head).value;
5787
+ if (!__privateGet$d(this, _head)) return;
5788
+ return __privateGet$d(this, _head).value;
5789
5789
  }
5790
5790
  clear() {
5791
- __privateSet$c(this, _head, void 0);
5792
- __privateSet$c(this, _tail, void 0);
5793
- __privateSet$c(this, _size, 0);
5791
+ __privateSet$d(this, _head, void 0);
5792
+ __privateSet$d(this, _tail, void 0);
5793
+ __privateSet$d(this, _size, 0);
5794
5794
  }
5795
5795
  get size() {
5796
- return __privateGet$c(this, _size);
5796
+ return __privateGet$d(this, _size);
5797
5797
  }
5798
5798
  *[Symbol.iterator]() {
5799
- let current = __privateGet$c(this, _head);
5799
+ let current = __privateGet$d(this, _head);
5800
5800
  while (current) {
5801
5801
  yield current.value;
5802
5802
  current = current.next;
5803
5803
  }
5804
5804
  }
5805
5805
  *drain() {
5806
- while (__privateGet$c(this, _head)) yield this.dequeue();
5806
+ while (__privateGet$d(this, _head)) yield this.dequeue();
5807
5807
  }
5808
5808
  }, _head = new WeakMap(), _tail = new WeakMap(), _size = new WeakMap(), _c);
5809
5809
  function pLimit(concurrency) {
@@ -5904,21 +5904,21 @@ function getMode(fileOrFolder) {
5904
5904
  const hookFirstNullCheck = (state) => !!(state == null ? void 0 : state.result);
5905
5905
  var PluginDriver = (_d = class {
5906
5906
  constructor(config, options) {
5907
- __privateAdd$c(this, _PluginDriver_instances);
5908
- __publicField$b(this, "config");
5909
- __publicField$b(this, "options");
5907
+ __privateAdd$d(this, _PluginDriver_instances);
5908
+ __publicField$c(this, "config");
5909
+ __publicField$c(this, "options");
5910
5910
  /**
5911
5911
  * The universal `@kubb/ast` `RootNode` produced by the adapter, set by
5912
5912
  * the build pipeline after the adapter's `parse()` resolves.
5913
5913
  */
5914
- __publicField$b(this, "rootNode");
5915
- __publicField$b(this, "adapter");
5916
- __privateAdd$c(this, _studioIsOpen, false);
5917
- __publicField$b(this, "plugins", /* @__PURE__ */ new Map());
5914
+ __publicField$c(this, "rootNode");
5915
+ __publicField$c(this, "adapter");
5916
+ __privateAdd$d(this, _studioIsOpen, false);
5917
+ __publicField$c(this, "plugins", /* @__PURE__ */ new Map());
5918
5918
  /**
5919
5919
  * @deprecated use resolvers context instead
5920
5920
  */
5921
- __publicField$b(this, "resolvePath", (params) => {
5921
+ __publicField$c(this, "resolvePath", (params) => {
5922
5922
  var _a2, _b2;
5923
5923
  const defaultPath = resolve(resolve(this.config.root, this.config.output.path), params.baseName);
5924
5924
  if (params.pluginName) return ((_a2 = this.hookForPluginSync({
@@ -5942,7 +5942,7 @@ var PluginDriver = (_d = class {
5942
5942
  /**
5943
5943
  * @deprecated use resolvers context instead
5944
5944
  */
5945
- __publicField$b(this, "resolveName", (params) => {
5945
+ __publicField$c(this, "resolveName", (params) => {
5946
5946
  var _a2, _b2, _c2;
5947
5947
  if (params.pluginName) return transformReservedWord((_b2 = (_a2 = this.hookForPluginSync({
5948
5948
  pluginName: params.pluginName,
@@ -5994,12 +5994,15 @@ var PluginDriver = (_d = class {
5994
5994
  get resolver() {
5995
5995
  return plugin.resolver;
5996
5996
  },
5997
+ get transformer() {
5998
+ return plugin.transformer;
5999
+ },
5997
6000
  openInStudio(options) {
5998
6001
  var _a2, _b2;
5999
- if (!driver.config.devtools || __privateGet$c(driver, _studioIsOpen)) return;
6002
+ if (!driver.config.devtools || __privateGet$d(driver, _studioIsOpen)) return;
6000
6003
  if (typeof driver.config.devtools !== "object") throw new Error("Devtools must be an object");
6001
6004
  if (!driver.rootNode || !driver.adapter) throw new Error("adapter is not defined, make sure you have set the parser in kubb.config.ts");
6002
- __privateSet$c(driver, _studioIsOpen, true);
6005
+ __privateSet$d(driver, _studioIsOpen, true);
6003
6006
  const studioUrl = (_b2 = (_a2 = driver.config.devtools) == null ? void 0 : _a2.studioUrl) != null ? _b2 : "https://studio.kubb.dev";
6004
6007
  return openInStudio(driver.rootNode, studioUrl, options);
6005
6008
  }
@@ -6049,7 +6052,7 @@ var PluginDriver = (_d = class {
6049
6052
  hookName,
6050
6053
  plugins: [plugin]
6051
6054
  });
6052
- const result = await __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
6055
+ const result = await __privateMethod$d(this, _PluginDriver_instances, execute_fn).call(this, {
6053
6056
  strategy: "hookFirst",
6054
6057
  hookName,
6055
6058
  parameters,
@@ -6064,7 +6067,7 @@ var PluginDriver = (_d = class {
6064
6067
  hookForPluginSync({ pluginName, hookName, parameters }) {
6065
6068
  const plugin = this.plugins.get(pluginName);
6066
6069
  if (!plugin) return null;
6067
- const result = __privateMethod$c(this, _PluginDriver_instances, executeSync_fn).call(this, {
6070
+ const result = __privateMethod$d(this, _PluginDriver_instances, executeSync_fn).call(this, {
6068
6071
  strategy: "hookFirst",
6069
6072
  hookName,
6070
6073
  parameters,
@@ -6084,7 +6087,7 @@ var PluginDriver = (_d = class {
6084
6087
  });
6085
6088
  const result = await hookFirst(plugins.map((plugin) => {
6086
6089
  return async () => {
6087
- const value = await __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
6090
+ const value = await __privateMethod$d(this, _PluginDriver_instances, execute_fn).call(this, {
6088
6091
  strategy: "hookFirst",
6089
6092
  hookName,
6090
6093
  parameters,
@@ -6108,7 +6111,7 @@ var PluginDriver = (_d = class {
6108
6111
  if (!(hookName in plugin)) continue;
6109
6112
  if (skipped == null ? void 0 : skipped.has(plugin)) continue;
6110
6113
  parseResult = {
6111
- result: __privateMethod$c(this, _PluginDriver_instances, executeSync_fn).call(this, {
6114
+ result: __privateMethod$d(this, _PluginDriver_instances, executeSync_fn).call(this, {
6112
6115
  strategy: "hookFirst",
6113
6116
  hookName,
6114
6117
  parameters,
@@ -6134,7 +6137,7 @@ var PluginDriver = (_d = class {
6134
6137
  const results = await hookParallel(plugins.map((plugin) => {
6135
6138
  return () => {
6136
6139
  pluginStartTimes.set(plugin, performance$1.now());
6137
- return __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
6140
+ return __privateMethod$d(this, _PluginDriver_instances, execute_fn).call(this, {
6138
6141
  strategy: "hookParallel",
6139
6142
  hookName,
6140
6143
  parameters,
@@ -6175,7 +6178,7 @@ var PluginDriver = (_d = class {
6175
6178
  plugins
6176
6179
  });
6177
6180
  await hookSeq(plugins.map((plugin) => {
6178
- return () => __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
6181
+ return () => __privateMethod$d(this, _PluginDriver_instances, execute_fn).call(this, {
6179
6182
  strategy: "hookSeq",
6180
6183
  hookName,
6181
6184
  parameters,
@@ -6215,7 +6218,7 @@ emitProcessingEnd_fn = function({ startTime, output, strategy, hookName, plugin,
6215
6218
  return (async () => {
6216
6219
  try {
6217
6220
  const output = typeof hook === "function" ? await Promise.resolve(hook.apply(this.getContext(plugin), parameters != null ? parameters : [])) : hook;
6218
- __privateMethod$c(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
6221
+ __privateMethod$d(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
6219
6222
  startTime,
6220
6223
  output,
6221
6224
  strategy,
@@ -6252,7 +6255,7 @@ executeSync_fn = function({ strategy, hookName, parameters, plugin }) {
6252
6255
  const startTime = performance$1.now();
6253
6256
  try {
6254
6257
  const output = typeof hook === "function" ? hook.apply(this.getContext(plugin), parameters) : hook;
6255
- __privateMethod$c(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
6258
+ __privateMethod$d(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
6256
6259
  startTime,
6257
6260
  output,
6258
6261
  strategy,
@@ -6320,7 +6323,7 @@ const fsStorage = createStorage(() => ({
6320
6323
  await clean(resolve(base));
6321
6324
  }
6322
6325
  }));
6323
- var version$1 = "5.0.0-alpha.26";
6326
+ var version$1 = "5.0.0-alpha.28";
6324
6327
  function getDiagnosticInfo() {
6325
6328
  return {
6326
6329
  nodeVersion: version$2,
@@ -6353,7 +6356,7 @@ async function setup(options) {
6353
6356
  ]
6354
6357
  });
6355
6358
  try {
6356
- if (isInputPath(userConfig) && !new URLPath$a(userConfig.input.path).isURL) {
6359
+ if (isInputPath(userConfig) && !new URLPath$b(userConfig.input.path).isURL) {
6357
6360
  await exists(userConfig.input.path);
6358
6361
  await events.emit("debug", {
6359
6362
  date: /* @__PURE__ */ new Date(),
@@ -6597,13 +6600,13 @@ function buildBarrelExports({ barrelFiles, rootDir, existingExports, config, dri
6597
6600
  function inputToAdapterSource(config) {
6598
6601
  if (Array.isArray(config.input)) return {
6599
6602
  type: "paths",
6600
- paths: config.input.map((i) => new URLPath$a(i.path).isURL ? i.path : resolve(config.root, i.path))
6603
+ paths: config.input.map((i) => new URLPath$b(i.path).isURL ? i.path : resolve(config.root, i.path))
6601
6604
  };
6602
6605
  if ("data" in config.input) return {
6603
6606
  type: "data",
6604
6607
  data: config.input.data
6605
6608
  };
6606
- if (new URLPath$a(config.input.path).isURL) return {
6609
+ if (new URLPath$b(config.input.path).isURL) return {
6607
6610
  type: "path",
6608
6611
  path: config.input.path
6609
6612
  };
@@ -6951,20 +6954,20 @@ const memoryStorage = createStorage(() => {
6951
6954
  });
6952
6955
  (_e = class {
6953
6956
  constructor() {
6954
- __privateAdd$c(this, _items, []);
6957
+ __privateAdd$d(this, _items, []);
6955
6958
  }
6956
6959
  get items() {
6957
- return __privateGet$c(this, _items).flat();
6960
+ return __privateGet$d(this, _items).flat();
6958
6961
  }
6959
6962
  add(item) {
6960
6963
  if (!item) return this;
6961
6964
  if (Array.isArray(item)) {
6962
6965
  item.filter((x2) => x2 !== void 0).forEach((it) => {
6963
- __privateGet$c(this, _items).push(it);
6966
+ __privateGet$d(this, _items).push(it);
6964
6967
  });
6965
6968
  return this;
6966
6969
  }
6967
- __privateGet$c(this, _items).push(item);
6970
+ __privateGet$d(this, _items).push(item);
6968
6971
  return this;
6969
6972
  }
6970
6973
  static toObject(items) {
@@ -6975,11 +6978,11 @@ const memoryStorage = createStorage(() => {
6975
6978
  const required = (_b2 = items.every((item) => item.required)) != null ? _b2 : true;
6976
6979
  items.forEach((item) => {
6977
6980
  var _a3, _b3;
6978
- name = __privateMethod$c(_a3 = _e, _FunctionParams_static, addParams_fn).call(_a3, name, {
6981
+ name = __privateMethod$d(_a3 = _e, _FunctionParams_static, addParams_fn).call(_a3, name, {
6979
6982
  ...item,
6980
6983
  type: void 0
6981
6984
  });
6982
- if (items.some((item2) => item2.type)) type = __privateMethod$c(_b3 = _e, _FunctionParams_static, addParams_fn).call(_b3, type, item);
6985
+ if (items.some((item2) => item2.type)) type = __privateMethod$d(_b3 = _e, _FunctionParams_static, addParams_fn).call(_b3, type, item);
6983
6986
  });
6984
6987
  return {
6985
6988
  name: `{ ${name.join(", ")} }`,
@@ -6990,25 +6993,25 @@ const memoryStorage = createStorage(() => {
6990
6993
  }
6991
6994
  toObject() {
6992
6995
  var _a2;
6993
- const items = __privateMethod$c(_a2 = _e, _FunctionParams_static, orderItems_fn).call(_a2, __privateGet$c(this, _items)).flat();
6996
+ const items = __privateMethod$d(_a2 = _e, _FunctionParams_static, orderItems_fn).call(_a2, __privateGet$d(this, _items)).flat();
6994
6997
  return _e.toObject(items);
6995
6998
  }
6996
6999
  static toString(items) {
6997
7000
  var _a2;
6998
- return __privateMethod$c(_a2 = _e, _FunctionParams_static, orderItems_fn).call(_a2, items).reduce((acc, item) => {
7001
+ return __privateMethod$d(_a2 = _e, _FunctionParams_static, orderItems_fn).call(_a2, items).reduce((acc, item) => {
6999
7002
  var _a3, _b2, _c2;
7000
7003
  if (Array.isArray(item)) {
7001
7004
  if (item.length <= 0) return acc;
7002
- const subItems = __privateMethod$c(_a3 = _e, _FunctionParams_static, orderItems_fn).call(_a3, item);
7005
+ const subItems = __privateMethod$d(_a3 = _e, _FunctionParams_static, orderItems_fn).call(_a3, item);
7003
7006
  const objectItem = _e.toObject(subItems);
7004
- return __privateMethod$c(_b2 = _e, _FunctionParams_static, addParams_fn).call(_b2, acc, objectItem);
7007
+ return __privateMethod$d(_b2 = _e, _FunctionParams_static, addParams_fn).call(_b2, acc, objectItem);
7005
7008
  }
7006
- return __privateMethod$c(_c2 = _e, _FunctionParams_static, addParams_fn).call(_c2, acc, item);
7009
+ return __privateMethod$d(_c2 = _e, _FunctionParams_static, addParams_fn).call(_c2, acc, item);
7007
7010
  }, []).join(", ");
7008
7011
  }
7009
7012
  toString() {
7010
7013
  var _a2;
7011
- const items = __privateMethod$c(_a2 = _e, _FunctionParams_static, orderItems_fn).call(_a2, __privateGet$c(this, _items));
7014
+ const items = __privateMethod$d(_a2 = _e, _FunctionParams_static, orderItems_fn).call(_a2, __privateGet$d(this, _items));
7012
7015
  return _e.toString(items);
7013
7016
  }
7014
7017
  }, _items = new WeakMap(), _FunctionParams_static = new WeakSet(), orderItems_fn = function(items) {
@@ -7028,7 +7031,7 @@ const memoryStorage = createStorage(() => {
7028
7031
  else acc.push(`${parameterName}?: ${type}`);
7029
7032
  else acc.push(`${parameterName}`);
7030
7033
  return acc;
7031
- }, __privateAdd$c(_e, _FunctionParams_static), _e);
7034
+ }, __privateAdd$d(_e, _FunctionParams_static), _e);
7032
7035
  async function isFormatterAvailable(formatter) {
7033
7036
  try {
7034
7037
  await x(formatter, ["--version"], { nodeOptions: { stdio: "ignore" } });
@@ -7048,10 +7051,10 @@ async function detectFormatter() {
7048
7051
  }
7049
7052
  var TreeNode = (_f = class {
7050
7053
  constructor(data, parent) {
7051
- __publicField$b(this, "data");
7052
- __publicField$b(this, "parent");
7053
- __publicField$b(this, "children", []);
7054
- __privateAdd$c(this, _cachedLeaves);
7054
+ __publicField$c(this, "data");
7055
+ __publicField$c(this, "parent");
7056
+ __publicField$c(this, "children", []);
7057
+ __privateAdd$d(this, _cachedLeaves);
7055
7058
  this.data = data;
7056
7059
  this.parent = parent;
7057
7060
  }
@@ -7075,10 +7078,10 @@ var TreeNode = (_f = class {
7075
7078
  */
7076
7079
  get leaves() {
7077
7080
  if (!this.children || this.children.length === 0) return [this];
7078
- if (__privateGet$c(this, _cachedLeaves)) return __privateGet$c(this, _cachedLeaves);
7081
+ if (__privateGet$d(this, _cachedLeaves)) return __privateGet$d(this, _cachedLeaves);
7079
7082
  const leaves = [];
7080
7083
  for (const child of this.children) leaves.push(...child.leaves);
7081
- __privateSet$c(this, _cachedLeaves, leaves);
7084
+ __privateSet$d(this, _cachedLeaves, leaves);
7082
7085
  return leaves;
7083
7086
  }
7084
7087
  /**
@@ -7273,25 +7276,34 @@ async function getConfigs(config, args) {
7273
7276
  ...item
7274
7277
  }));
7275
7278
  }
7276
- function mergeResolvers(...resolvers) {
7277
- return resolvers.reduce((acc, curr) => ({
7278
- ...acc,
7279
- ...curr
7280
- }), resolvers[0]);
7279
+ function withFallback(defaults, userOverrides) {
7280
+ const merged = { ...defaults };
7281
+ for (const key of Object.keys(userOverrides)) {
7282
+ const userVal = userOverrides[key];
7283
+ const defaultVal = defaults[key];
7284
+ if (typeof userVal === "function" && typeof defaultVal === "function") merged[key] = (...args) => {
7285
+ var _a2;
7286
+ return (_a2 = userVal.apply(merged, args)) != null ? _a2 : defaultVal.apply(merged, args);
7287
+ };
7288
+ else if (userVal !== void 0) merged[key] = userVal;
7289
+ }
7290
+ return merged;
7281
7291
  }
7282
7292
  function getPreset(params) {
7283
7293
  var _a2, _b2, _c2, _d2, _e2;
7284
- const { preset: presetName, presets, resolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = params;
7285
- const [defaultResolver2, ...userResolvers] = resolvers;
7294
+ const { preset: presetName, presets, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = params;
7286
7295
  const preset = presets[presetName];
7287
- const resolver = mergeResolvers(mergeResolvers(defaultResolver2, ...(_a2 = preset == null ? void 0 : preset.resolvers) != null ? _a2 : []), ...userResolvers != null ? userResolvers : []);
7288
- const transformers = [...(_b2 = preset == null ? void 0 : preset.transformers) != null ? _b2 : [], ...userTransformers != null ? userTransformers : []];
7296
+ const presetResolver = (_a2 = preset == null ? void 0 : preset.resolver) != null ? _a2 : presets["default"].resolver;
7297
+ const resolver = userResolver ? withFallback(presetResolver, userResolver) : presetResolver;
7298
+ const presetTransformers = (_b2 = preset == null ? void 0 : preset.transformers) != null ? _b2 : [];
7299
+ const presetTransformer = presetTransformers.length > 0 ? composeTransformers(...presetTransformers) : void 0;
7300
+ const transformer = presetTransformer && userTransformer ? withFallback(presetTransformer, userTransformer) : userTransformer != null ? userTransformer : presetTransformer;
7289
7301
  const presetGenerators = (_c2 = preset == null ? void 0 : preset.generators) != null ? _c2 : [];
7290
- const defaultPresetGenerators = (_e2 = (_d2 = presets["default"]) == null ? void 0 : _d2.generators) != null ? _e2 : [];
7302
+ const defaultGenerators = (_e2 = (_d2 = presets["default"]) == null ? void 0 : _d2.generators) != null ? _e2 : [];
7291
7303
  return {
7292
7304
  resolver,
7293
- transformers,
7294
- generators: presetGenerators.length > 0 || userGenerators.length ? [...presetGenerators, ...userGenerators] : defaultPresetGenerators,
7305
+ transformer,
7306
+ generators: presetGenerators.length > 0 || userGenerators.length > 0 ? [...presetGenerators, ...userGenerators] : defaultGenerators,
7295
7307
  preset
7296
7308
  };
7297
7309
  }
@@ -7313,7 +7325,7 @@ async function detectLinter() {
7313
7325
  return null;
7314
7326
  }
7315
7327
 
7316
- var version = "5.0.0-alpha.26";
7328
+ var version = "5.0.0-alpha.28";
7317
7329
 
7318
7330
  function isCommandMessage(msg) {
7319
7331
  return msg.type === "command";
@@ -7504,8 +7516,8 @@ async function loadConfig(resolvedConfigPath) {
7504
7516
  return configs[0];
7505
7517
  }
7506
7518
 
7507
- var __defProp$g = Object.defineProperty;
7508
- var __name$5 = (target, value) => __defProp$g(target, "name", {
7519
+ var __defProp$h = Object.defineProperty;
7520
+ var __name$5 = (target, value) => __defProp$h(target, "name", {
7509
7521
  value,
7510
7522
  configurable: true
7511
7523
  });
@@ -7639,18 +7651,18 @@ function isKeyword(meta, keyword) {
7639
7651
  return meta.keyword === keyword;
7640
7652
  }
7641
7653
 
7642
- var __defProp$f = Object.defineProperty;
7643
- var __typeError$b = (msg) => {
7654
+ var __defProp$g = Object.defineProperty;
7655
+ var __typeError$c = (msg) => {
7644
7656
  throw TypeError(msg);
7645
7657
  };
7646
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7647
- var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
7648
- var __accessCheck$b = (obj, member, msg) => member.has(obj) || __typeError$b("Cannot " + msg);
7649
- var __privateGet$b = (obj, member, getter) => (__accessCheck$b(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
7650
- var __privateAdd$b = (obj, member, value) => member.has(obj) ? __typeError$b("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7651
- var __privateSet$b = (obj, member, value, setter) => (__accessCheck$b(obj, member, "write to private field"), member.set(obj, value), value);
7652
- var __privateMethod$b = (obj, member, method) => (__accessCheck$b(obj, member, "access private method"), method);
7653
- var _options$b, _URLPath_instances$9, transformParam_fn$9, eachParam_fn$9, _a$b, _options2, _Oas_instances, setDiscriminator_fn, applyDiscriminatorInheritance_fn, getResponseBodyFactory_fn, _b;
7658
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7659
+ var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
7660
+ var __accessCheck$c = (obj, member, msg) => member.has(obj) || __typeError$c("Cannot " + msg);
7661
+ var __privateGet$c = (obj, member, getter) => (__accessCheck$c(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
7662
+ var __privateAdd$c = (obj, member, value) => member.has(obj) ? __typeError$c("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7663
+ var __privateSet$c = (obj, member, value, setter) => (__accessCheck$c(obj, member, "write to private field"), member.set(obj, value), value);
7664
+ var __privateMethod$c = (obj, member, method) => (__accessCheck$c(obj, member, "access private method"), method);
7665
+ var _options$c, _URLPath_instances$a, transformParam_fn$a, eachParam_fn$a, _a$c, _options2, _Oas_instances, setDiscriminator_fn, applyDiscriminatorInheritance_fn, getResponseBodyFactory_fn, _b;
7654
7666
  const STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
7655
7667
  "properties",
7656
7668
  "items",
@@ -7693,16 +7705,16 @@ function isValidVarName$a(name) {
7693
7705
  }
7694
7706
  return true;
7695
7707
  }
7696
- var URLPath$9 = (_a$b = class {
7708
+ var URLPath$a = (_a$c = class {
7697
7709
  constructor(path2, options = {}) {
7698
- __privateAdd$b(this, _URLPath_instances$9);
7710
+ __privateAdd$c(this, _URLPath_instances$a);
7699
7711
  /**
7700
7712
  * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
7701
7713
  */
7702
- __publicField$a(this, "path");
7703
- __privateAdd$b(this, _options$b);
7714
+ __publicField$b(this, "path");
7715
+ __privateAdd$c(this, _options$c);
7704
7716
  this.path = path2;
7705
- __privateSet$b(this, _options$b, options);
7717
+ __privateSet$c(this, _options$c, options);
7706
7718
  }
7707
7719
  /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
7708
7720
  *
@@ -7783,7 +7795,7 @@ var URLPath$9 = (_a$b = class {
7783
7795
  toTemplateString({ prefix = "", replacer } = {}) {
7784
7796
  return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
7785
7797
  if (i % 2 === 0) return part;
7786
- const param = __privateMethod$b(this, _URLPath_instances$9, transformParam_fn$9).call(this, part);
7798
+ const param = __privateMethod$c(this, _URLPath_instances$a, transformParam_fn$a).call(this, part);
7787
7799
  return `\${${replacer ? replacer(param) : param}}`;
7788
7800
  }).join("")}\``;
7789
7801
  }
@@ -7800,7 +7812,7 @@ var URLPath$9 = (_a$b = class {
7800
7812
  */
7801
7813
  getParams(replacer) {
7802
7814
  const params = {};
7803
- __privateMethod$b(this, _URLPath_instances$9, eachParam_fn$9).call(this, (_raw, param) => {
7815
+ __privateMethod$c(this, _URLPath_instances$a, eachParam_fn$a).call(this, (_raw, param) => {
7804
7816
  const key = replacer ? replacer(param) : param;
7805
7817
  params[key] = key;
7806
7818
  });
@@ -7816,18 +7828,18 @@ var URLPath$9 = (_a$b = class {
7816
7828
  toURLPath() {
7817
7829
  return this.path.replace(/\{([^}]+)\}/g, ":$1");
7818
7830
  }
7819
- }, _options$b = new WeakMap(), _URLPath_instances$9 = new WeakSet(), transformParam_fn$9 = function(raw) {
7831
+ }, _options$c = new WeakMap(), _URLPath_instances$a = new WeakSet(), transformParam_fn$a = function(raw) {
7820
7832
  const param = isValidVarName$a(raw) ? raw : camelCase$c(raw);
7821
- return __privateGet$b(this, _options$b).casing === "camelcase" ? camelCase$c(param) : param;
7833
+ return __privateGet$c(this, _options$c).casing === "camelcase" ? camelCase$c(param) : param;
7822
7834
  }, /**
7823
7835
  * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
7824
7836
  */
7825
- eachParam_fn$9 = function(fn) {
7837
+ eachParam_fn$a = function(fn) {
7826
7838
  for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
7827
7839
  const raw = match[1];
7828
- fn(raw, __privateMethod$b(this, _URLPath_instances$9, transformParam_fn$9).call(this, raw));
7840
+ fn(raw, __privateMethod$c(this, _URLPath_instances$a, transformParam_fn$a).call(this, raw));
7829
7841
  }
7830
- }, _a$b);
7842
+ }, _a$c);
7831
7843
  function isOpenApiV2Document(doc) {
7832
7844
  return !!doc && isPlainObject$1(doc) && !("openapi" in doc);
7833
7845
  }
@@ -7931,7 +7943,7 @@ function parseFromConfig(config, oasClass = Oas) {
7931
7943
  }
7932
7944
  }
7933
7945
  if (Array.isArray(config.input)) return merge(config.input.map((input) => path$2.resolve(config.root, input.path)), { oasClass });
7934
- if (new URLPath$9(config.input.path).isURL) return parse$1(config.input.path, { oasClass });
7946
+ if (new URLPath$a(config.input.path).isURL) return parse$1(config.input.path, { oasClass });
7935
7947
  return parse$1(path$2.resolve(config.root, config.input.path), { oasClass });
7936
7948
  }
7937
7949
  function flattenSchema(schema) {
@@ -8053,20 +8065,20 @@ const KUBB_INLINE_REF_PREFIX = "#kubb-inline-";
8053
8065
  var Oas = (_b = class extends BaseOas {
8054
8066
  constructor(document) {
8055
8067
  super(document, void 0);
8056
- __privateAdd$b(this, _Oas_instances);
8057
- __privateAdd$b(this, _options2, { discriminator: "strict" });
8058
- __publicField$a(this, "document");
8068
+ __privateAdd$c(this, _Oas_instances);
8069
+ __privateAdd$c(this, _options2, { discriminator: "strict" });
8070
+ __publicField$b(this, "document");
8059
8071
  this.document = document;
8060
8072
  }
8061
8073
  setOptions(options) {
8062
- __privateSet$b(this, _options2, {
8063
- ...__privateGet$b(this, _options2),
8074
+ __privateSet$c(this, _options2, {
8075
+ ...__privateGet$c(this, _options2),
8064
8076
  ...options
8065
8077
  });
8066
- if (__privateGet$b(this, _options2).discriminator === "inherit") __privateMethod$b(this, _Oas_instances, applyDiscriminatorInheritance_fn).call(this);
8078
+ if (__privateGet$c(this, _options2).discriminator === "inherit") __privateMethod$c(this, _Oas_instances, applyDiscriminatorInheritance_fn).call(this);
8067
8079
  }
8068
8080
  get options() {
8069
- return __privateGet$b(this, _options2);
8081
+ return __privateGet$c(this, _options2);
8070
8082
  }
8071
8083
  get($ref) {
8072
8084
  const origRef = $ref;
@@ -8144,8 +8156,8 @@ var Oas = (_b = class extends BaseOas {
8144
8156
  const $ref = isReference(schema2) ? schema2.$ref : void 0;
8145
8157
  if (schema2 && $ref) operation.schema.responses[key] = this.get($ref);
8146
8158
  });
8147
- const getResponseBody = __privateMethod$b(this, _Oas_instances, getResponseBodyFactory_fn).call(this, operation.getResponseByStatusCode(statusCode));
8148
- const { contentType } = __privateGet$b(this, _options2);
8159
+ const getResponseBody = __privateMethod$c(this, _Oas_instances, getResponseBodyFactory_fn).call(this, operation.getResponseByStatusCode(statusCode));
8160
+ const { contentType } = __privateGet$c(this, _options2);
8149
8161
  const responseBody = getResponseBody(contentType);
8150
8162
  if (responseBody === false) return {};
8151
8163
  const schema = Array.isArray(responseBody) ? responseBody[1].schema : responseBody.schema;
@@ -8153,7 +8165,7 @@ var Oas = (_b = class extends BaseOas {
8153
8165
  return this.dereferenceWithRef(schema);
8154
8166
  }
8155
8167
  getRequestSchema(operation) {
8156
- const { contentType } = __privateGet$b(this, _options2);
8168
+ const { contentType } = __privateGet$c(this, _options2);
8157
8169
  if (operation.schema.requestBody) operation.schema.requestBody = this.dereferenceWithRef(operation.schema.requestBody);
8158
8170
  const requestBody = operation.getRequestBody(contentType);
8159
8171
  if (requestBody === false) return;
@@ -8163,7 +8175,7 @@ var Oas = (_b = class extends BaseOas {
8163
8175
  }
8164
8176
  getParametersSchema(operation, inKey) {
8165
8177
  var _a2, _b2, _c;
8166
- const { contentType = operation.getContentType() } = __privateGet$b(this, _options2);
8178
+ const { contentType = operation.getContentType() } = __privateGet$c(this, _options2);
8167
8179
  const resolveParams = (params2) => params2.map((p) => this.dereferenceWithRef(p)).filter((p) => !!p && typeof p === "object" && "in" in p && "name" in p);
8168
8180
  const operationParams = resolveParams(((_a2 = operation.schema) == null ? void 0 : _a2.parameters) || []);
8169
8181
  const pathItem = (_c = (_b2 = this.api) == null ? void 0 : _b2.paths) == null ? void 0 : _c[operation.path];
@@ -8223,13 +8235,13 @@ var Oas = (_b = class extends BaseOas {
8223
8235
  */
8224
8236
  getSchemas(options = {}) {
8225
8237
  var _a2, _b2, _c, _d;
8226
- const contentType = (_a2 = options.contentType) != null ? _a2 : __privateGet$b(this, _options2).contentType;
8238
+ const contentType = (_a2 = options.contentType) != null ? _a2 : __privateGet$c(this, _options2).contentType;
8227
8239
  const includes = (_b2 = options.includes) != null ? _b2 : [
8228
8240
  "schemas",
8229
8241
  "requestBodies",
8230
8242
  "responses"
8231
8243
  ];
8232
- const shouldResolveCollisions = (_d = (_c = options.collisionDetection) != null ? _c : __privateGet$b(this, _options2).collisionDetection) != null ? _d : false;
8244
+ const shouldResolveCollisions = (_d = (_c = options.collisionDetection) != null ? _c : __privateGet$c(this, _options2).collisionDetection) != null ? _d : false;
8233
8245
  const components = this.getDefinition().components;
8234
8246
  const schemasWithMeta = [];
8235
8247
  if (includes.includes("schemas")) {
@@ -8291,7 +8303,7 @@ var Oas = (_b = class extends BaseOas {
8291
8303
  }
8292
8304
  }, _options2 = new WeakMap(), _Oas_instances = new WeakSet(), setDiscriminator_fn = function(schema) {
8293
8305
  const { mapping = {}, propertyName } = schema.discriminator;
8294
- if (__privateGet$b(this, _options2).discriminator === "inherit") Object.entries(mapping).forEach(([mappingKey, mappingValue]) => {
8306
+ if (__privateGet$c(this, _options2).discriminator === "inherit") Object.entries(mapping).forEach(([mappingKey, mappingValue]) => {
8295
8307
  var _a2, _b2, _c;
8296
8308
  if (mappingValue) {
8297
8309
  const childSchema = this.get(mappingValue);
@@ -8329,7 +8341,7 @@ var Oas = (_b = class extends BaseOas {
8329
8341
  const schemaObject = schema;
8330
8342
  if (visited.has(schemaObject)) return;
8331
8343
  visited.add(schemaObject);
8332
- if (isDiscriminator(schemaObject)) __privateMethod$b(this, _Oas_instances, setDiscriminator_fn).call(this, schemaObject);
8344
+ if (isDiscriminator(schemaObject)) __privateMethod$c(this, _Oas_instances, setDiscriminator_fn).call(this, schemaObject);
8333
8345
  if ("allOf" in schemaObject) enqueue(schemaObject.allOf);
8334
8346
  if ("oneOf" in schemaObject) enqueue(schemaObject.oneOf);
8335
8347
  if ("anyOf" in schemaObject) enqueue(schemaObject.anyOf);
@@ -8384,18 +8396,18 @@ function resolveServerUrl(server, overrides) {
8384
8396
  return url;
8385
8397
  }
8386
8398
 
8387
- var __defProp$e = Object.defineProperty;
8388
- var __typeError$a = (msg) => {
8399
+ var __defProp$f = Object.defineProperty;
8400
+ var __typeError$b = (msg) => {
8389
8401
  throw TypeError(msg);
8390
8402
  };
8391
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8392
- var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
8393
- var __accessCheck$a = (obj, member, msg) => member.has(obj) || __typeError$a("Cannot " + msg);
8394
- var __privateGet$a = (obj, member, getter) => (__accessCheck$a(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
8395
- var __privateAdd$a = (obj, member, value) => member.has(obj) ? __typeError$a("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
8396
- var __privateSet$a = (obj, member, value, setter) => (__accessCheck$a(obj, member, "write to private field"), member.set(obj, value), value);
8397
- var __privateMethod$a = (obj, member, method) => (__accessCheck$a(obj, member, "access private method"), method);
8398
- var _options$a, _context$1, _schemaNameMapping, _nameMappingInitialized, _parseCache, _SchemaGenerator_instances, ensureNameMapping_fn, getOptions_fn, getUnknownType_fn, getEmptyType_fn, parseProperties_fn, getRefAlias_fn, getParsedSchemaObject_fn, addDiscriminatorToSchema_fn, wouldCreateCircularReference_fn, parseSchemaObject_fn, doBuild_fn, _a$a;
8403
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8404
+ var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
8405
+ var __accessCheck$b = (obj, member, msg) => member.has(obj) || __typeError$b("Cannot " + msg);
8406
+ var __privateGet$b = (obj, member, getter) => (__accessCheck$b(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
8407
+ var __privateAdd$b = (obj, member, value) => member.has(obj) ? __typeError$b("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
8408
+ var __privateSet$b = (obj, member, value, setter) => (__accessCheck$b(obj, member, "write to private field"), member.set(obj, value), value);
8409
+ var __privateMethod$b = (obj, member, method) => (__accessCheck$b(obj, member, "access private method"), method);
8410
+ var _options$b, _context$1, _schemaNameMapping, _nameMappingInitialized, _parseCache, _SchemaGenerator_instances, ensureNameMapping_fn, getOptions_fn, getUnknownType_fn, getEmptyType_fn, parseProperties_fn, getRefAlias_fn, getParsedSchemaObject_fn, addDiscriminatorToSchema_fn, wouldCreateCircularReference_fn, parseSchemaObject_fn, doBuild_fn, _a$b;
8399
8411
  function getUniqueName(originalName, data) {
8400
8412
  let used = data[originalName] || 0;
8401
8413
  if (used) {
@@ -8492,29 +8504,29 @@ async function renderSchema(schema, options) {
8492
8504
  fabric.context.fileManager.upsert(...fabricChild.files);
8493
8505
  fabricChild.unmount();
8494
8506
  }
8495
- var SchemaGenerator = (_a$a = class {
8507
+ var SchemaGenerator = (_a$b = class {
8496
8508
  constructor(options, context) {
8497
- __privateAdd$a(this, _SchemaGenerator_instances);
8498
- __privateAdd$a(this, _options$a);
8499
- __privateAdd$a(this, _context$1);
8500
- __publicField$9(this, "refs", {});
8501
- __privateAdd$a(this, _schemaNameMapping, /* @__PURE__ */ new Map());
8502
- __privateAdd$a(this, _nameMappingInitialized, false);
8503
- __privateAdd$a(this, _parseCache, /* @__PURE__ */ new Map());
8504
- __privateSet$a(this, _options$a, options);
8505
- __privateSet$a(this, _context$1, context);
8509
+ __privateAdd$b(this, _SchemaGenerator_instances);
8510
+ __privateAdd$b(this, _options$b);
8511
+ __privateAdd$b(this, _context$1);
8512
+ __publicField$a(this, "refs", {});
8513
+ __privateAdd$b(this, _schemaNameMapping, /* @__PURE__ */ new Map());
8514
+ __privateAdd$b(this, _nameMappingInitialized, false);
8515
+ __privateAdd$b(this, _parseCache, /* @__PURE__ */ new Map());
8516
+ __privateSet$b(this, _options$b, options);
8517
+ __privateSet$b(this, _context$1, context);
8506
8518
  }
8507
8519
  get options() {
8508
- return __privateGet$a(this, _options$a);
8520
+ return __privateGet$b(this, _options$b);
8509
8521
  }
8510
8522
  set options(options) {
8511
- __privateSet$a(this, _options$a, {
8512
- ...__privateGet$a(this, _options$a),
8523
+ __privateSet$b(this, _options$b, {
8524
+ ...__privateGet$b(this, _options$b),
8513
8525
  ...options
8514
8526
  });
8515
8527
  }
8516
8528
  get context() {
8517
- return __privateGet$a(this, _context$1);
8529
+ return __privateGet$b(this, _context$1);
8518
8530
  }
8519
8531
  /**
8520
8532
  * Creates a type node from a given schema.
@@ -8523,7 +8535,7 @@ var SchemaGenerator = (_a$a = class {
8523
8535
  */
8524
8536
  parse(props) {
8525
8537
  var _a2, _b, _c;
8526
- const options = __privateMethod$a(this, _SchemaGenerator_instances, getOptions_fn).call(this, props.name);
8538
+ const options = __privateMethod$b(this, _SchemaGenerator_instances, getOptions_fn).call(this, props.name);
8527
8539
  let shouldCache = props.schema && typeof props.schema === "object" && !((_a2 = options.transformers) == null ? void 0 : _a2.schema);
8528
8540
  let cacheKey = "";
8529
8541
  if (shouldCache) try {
@@ -8533,14 +8545,14 @@ var SchemaGenerator = (_a$a = class {
8533
8545
  parentName: props.parentName,
8534
8546
  rootName: props.rootName
8535
8547
  });
8536
- const cached = __privateGet$a(this, _parseCache).get(cacheKey);
8548
+ const cached = __privateGet$b(this, _parseCache).get(cacheKey);
8537
8549
  if (cached) return cached;
8538
8550
  } catch {
8539
8551
  shouldCache = false;
8540
8552
  }
8541
- const defaultSchemas = __privateMethod$a(this, _SchemaGenerator_instances, parseSchemaObject_fn).call(this, props);
8553
+ const defaultSchemas = __privateMethod$b(this, _SchemaGenerator_instances, parseSchemaObject_fn).call(this, props);
8542
8554
  const result = uniqueWith(((_c = (_b = options.transformers) == null ? void 0 : _b.schema) == null ? void 0 : _c.call(_b, props, defaultSchemas)) || defaultSchemas || [], isDeepEqual);
8543
- if (shouldCache && cacheKey) __privateGet$a(this, _parseCache).set(cacheKey, result);
8555
+ if (shouldCache && cacheKey) __privateGet$b(this, _parseCache).set(cacheKey, result);
8544
8556
  return result;
8545
8557
  }
8546
8558
  static deepSearch(tree, keyword) {
@@ -8550,28 +8562,28 @@ var SchemaGenerator = (_a$a = class {
8550
8562
  if (schema.keyword === keyword) foundItems.push(schema);
8551
8563
  if (isKeyword(schema, schemaKeywords.object)) {
8552
8564
  Object.values(((_a2 = schema.args) == null ? void 0 : _a2.properties) || {}).forEach((entrySchema) => {
8553
- foundItems.push(..._a$a.deepSearch(entrySchema, keyword));
8565
+ foundItems.push(..._a$b.deepSearch(entrySchema, keyword));
8554
8566
  });
8555
8567
  Object.values(((_b = schema.args) == null ? void 0 : _b.additionalProperties) || {}).forEach((entrySchema) => {
8556
- foundItems.push(..._a$a.deepSearch([entrySchema], keyword));
8568
+ foundItems.push(..._a$b.deepSearch([entrySchema], keyword));
8557
8569
  });
8558
8570
  if ((_c = schema.args) == null ? void 0 : _c.patternProperties) Object.values(schema.args.patternProperties).forEach((entrySchemas) => {
8559
8571
  entrySchemas.forEach((entrySchema) => {
8560
- foundItems.push(..._a$a.deepSearch([entrySchema], keyword));
8572
+ foundItems.push(..._a$b.deepSearch([entrySchema], keyword));
8561
8573
  });
8562
8574
  });
8563
8575
  }
8564
8576
  if (isKeyword(schema, schemaKeywords.array)) schema.args.items.forEach((entrySchema) => {
8565
- foundItems.push(..._a$a.deepSearch([entrySchema], keyword));
8577
+ foundItems.push(..._a$b.deepSearch([entrySchema], keyword));
8566
8578
  });
8567
8579
  if (isKeyword(schema, schemaKeywords.and)) schema.args.forEach((entrySchema) => {
8568
- foundItems.push(..._a$a.deepSearch([entrySchema], keyword));
8580
+ foundItems.push(..._a$b.deepSearch([entrySchema], keyword));
8569
8581
  });
8570
8582
  if (isKeyword(schema, schemaKeywords.tuple)) schema.args.items.forEach((entrySchema) => {
8571
- foundItems.push(..._a$a.deepSearch([entrySchema], keyword));
8583
+ foundItems.push(..._a$b.deepSearch([entrySchema], keyword));
8572
8584
  });
8573
8585
  if (isKeyword(schema, schemaKeywords.union)) schema.args.forEach((entrySchema) => {
8574
- foundItems.push(..._a$a.deepSearch([entrySchema], keyword));
8586
+ foundItems.push(..._a$b.deepSearch([entrySchema], keyword));
8575
8587
  });
8576
8588
  });
8577
8589
  return foundItems;
@@ -8581,16 +8593,16 @@ var SchemaGenerator = (_a$a = class {
8581
8593
  tree == null ? void 0 : tree.forEach((schema) => {
8582
8594
  if (!foundItem && schema.keyword === keyword) foundItem = schema;
8583
8595
  if (isKeyword(schema, schemaKeywords.array)) schema.args.items.forEach((entrySchema) => {
8584
- if (!foundItem) foundItem = _a$a.find([entrySchema], keyword);
8596
+ if (!foundItem) foundItem = _a$b.find([entrySchema], keyword);
8585
8597
  });
8586
8598
  if (isKeyword(schema, schemaKeywords.and)) schema.args.forEach((entrySchema) => {
8587
- if (!foundItem) foundItem = _a$a.find([entrySchema], keyword);
8599
+ if (!foundItem) foundItem = _a$b.find([entrySchema], keyword);
8588
8600
  });
8589
8601
  if (isKeyword(schema, schemaKeywords.tuple)) schema.args.items.forEach((entrySchema) => {
8590
- if (!foundItem) foundItem = _a$a.find([entrySchema], keyword);
8602
+ if (!foundItem) foundItem = _a$b.find([entrySchema], keyword);
8591
8603
  });
8592
8604
  if (isKeyword(schema, schemaKeywords.union)) schema.args.forEach((entrySchema) => {
8593
- if (!foundItem) foundItem = _a$a.find([entrySchema], keyword);
8605
+ if (!foundItem) foundItem = _a$b.find([entrySchema], keyword);
8594
8606
  });
8595
8607
  });
8596
8608
  return foundItem;
@@ -8625,13 +8637,13 @@ var SchemaGenerator = (_a$a = class {
8625
8637
  async build(...generators) {
8626
8638
  var _a2;
8627
8639
  const { oas, contentType, include } = this.context;
8628
- if (!__privateGet$a(this, _nameMappingInitialized)) {
8640
+ if (!__privateGet$b(this, _nameMappingInitialized)) {
8629
8641
  const { schemas: schemas2, nameMapping } = oas.getSchemas({
8630
8642
  contentType,
8631
8643
  includes: include
8632
8644
  });
8633
- __privateSet$a(this, _schemaNameMapping, nameMapping);
8634
- __privateSet$a(this, _nameMappingInitialized, true);
8645
+ __privateSet$b(this, _schemaNameMapping, nameMapping);
8646
+ __privateSet$b(this, _nameMappingInitialized, true);
8635
8647
  const schemaEntries = Object.entries(schemas2);
8636
8648
  (_a2 = this.context.events) == null ? void 0 : _a2.emit("debug", {
8637
8649
  date: /* @__PURE__ */ new Date(),
@@ -8641,26 +8653,26 @@ var SchemaGenerator = (_a$a = class {
8641
8653
  ` \u2022 Generators: ${generators.length}`
8642
8654
  ]
8643
8655
  });
8644
- return __privateMethod$a(this, _SchemaGenerator_instances, doBuild_fn).call(this, schemas2, generators);
8656
+ return __privateMethod$b(this, _SchemaGenerator_instances, doBuild_fn).call(this, schemas2, generators);
8645
8657
  }
8646
8658
  const { schemas } = oas.getSchemas({
8647
8659
  contentType,
8648
8660
  includes: include
8649
8661
  });
8650
- return __privateMethod$a(this, _SchemaGenerator_instances, doBuild_fn).call(this, schemas, generators);
8662
+ return __privateMethod$b(this, _SchemaGenerator_instances, doBuild_fn).call(this, schemas, generators);
8651
8663
  }
8652
- }, _options$a = new WeakMap(), _context$1 = new WeakMap(), _schemaNameMapping = new WeakMap(), _nameMappingInitialized = new WeakMap(), _parseCache = new WeakMap(), _SchemaGenerator_instances = new WeakSet(), /**
8664
+ }, _options$b = new WeakMap(), _context$1 = new WeakMap(), _schemaNameMapping = new WeakMap(), _nameMappingInitialized = new WeakMap(), _parseCache = new WeakMap(), _SchemaGenerator_instances = new WeakSet(), /**
8653
8665
  * Ensure the name mapping is initialized (lazy initialization)
8654
8666
  */
8655
8667
  ensureNameMapping_fn = function() {
8656
- if (__privateGet$a(this, _nameMappingInitialized)) return;
8668
+ if (__privateGet$b(this, _nameMappingInitialized)) return;
8657
8669
  const { oas, contentType, include } = this.context;
8658
8670
  const { nameMapping } = oas.getSchemas({
8659
8671
  contentType,
8660
8672
  includes: include
8661
8673
  });
8662
- __privateSet$a(this, _schemaNameMapping, nameMapping);
8663
- __privateSet$a(this, _nameMappingInitialized, true);
8674
+ __privateSet$b(this, _schemaNameMapping, nameMapping);
8675
+ __privateSet$b(this, _nameMappingInitialized, true);
8664
8676
  }, getOptions_fn = function(name) {
8665
8677
  var _a2;
8666
8678
  const { override = [] } = this.context;
@@ -8672,12 +8684,12 @@ ensureNameMapping_fn = function() {
8672
8684
  })) == null ? void 0 : _a2.options) || {}
8673
8685
  };
8674
8686
  }, getUnknownType_fn = function(name) {
8675
- const options = __privateMethod$a(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
8687
+ const options = __privateMethod$b(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
8676
8688
  if (options.unknownType === "any") return schemaKeywords.any;
8677
8689
  if (options.unknownType === "void") return schemaKeywords.void;
8678
8690
  return schemaKeywords.unknown;
8679
8691
  }, getEmptyType_fn = function(name) {
8680
- const options = __privateMethod$a(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
8692
+ const options = __privateMethod$b(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
8681
8693
  if (options.emptySchemaType === "any") return schemaKeywords.any;
8682
8694
  if (options.emptySchemaType === "void") return schemaKeywords.void;
8683
8695
  return schemaKeywords.unknown;
@@ -8712,7 +8724,7 @@ parseProperties_fn = function(name, schemaObject, rootName) {
8712
8724
  ...curr
8713
8725
  }), {});
8714
8726
  let additionalPropertiesSchemas = [];
8715
- if (additionalProperties) additionalPropertiesSchemas = additionalProperties === true || !Object.keys(additionalProperties).length ? [{ keyword: __privateMethod$a(this, _SchemaGenerator_instances, getUnknownType_fn).call(this, name) }] : this.parse({
8727
+ if (additionalProperties) additionalPropertiesSchemas = additionalProperties === true || !Object.keys(additionalProperties).length ? [{ keyword: __privateMethod$b(this, _SchemaGenerator_instances, getUnknownType_fn).call(this, name) }] : this.parse({
8716
8728
  schema: additionalProperties,
8717
8729
  name: null,
8718
8730
  parentName: name,
@@ -8720,7 +8732,7 @@ parseProperties_fn = function(name, schemaObject, rootName) {
8720
8732
  });
8721
8733
  let patternPropertiesSchemas = {};
8722
8734
  if (patternProperties && typeof patternProperties === "object") patternPropertiesSchemas = Object.entries(patternProperties).reduce((acc, [pattern, patternSchema]) => {
8723
- const schemas = patternSchema === true || !Object.keys(patternSchema).length ? [{ keyword: __privateMethod$a(this, _SchemaGenerator_instances, getUnknownType_fn).call(this, name) }] : this.parse({
8735
+ const schemas = patternSchema === true || !Object.keys(patternSchema).length ? [{ keyword: __privateMethod$b(this, _SchemaGenerator_instances, getUnknownType_fn).call(this, name) }] : this.parse({
8724
8736
  schema: patternSchema,
8725
8737
  name: null,
8726
8738
  parentName: name,
@@ -8793,9 +8805,9 @@ getRefAlias_fn = function(schemaObject, name) {
8793
8805
  });
8794
8806
  } catch {
8795
8807
  }
8796
- __privateMethod$a(this, _SchemaGenerator_instances, ensureNameMapping_fn).call(this);
8808
+ __privateMethod$b(this, _SchemaGenerator_instances, ensureNameMapping_fn).call(this);
8797
8809
  const originalName = $ref.replace(/.+\//, "");
8798
- const resolvedName = __privateGet$a(this, _schemaNameMapping).get($ref) || originalName;
8810
+ const resolvedName = __privateGet$b(this, _schemaNameMapping).get($ref) || originalName;
8799
8811
  const propertyName = this.context.driver.resolveName({
8800
8812
  name: resolvedName,
8801
8813
  pluginName: this.context.plugin.name,
@@ -8816,13 +8828,13 @@ getRefAlias_fn = function(schemaObject, name) {
8816
8828
  originalName: resolvedName,
8817
8829
  path: file.path
8818
8830
  };
8819
- return __privateMethod$a(this, _SchemaGenerator_instances, getRefAlias_fn).call(this, schemaObject, name);
8831
+ return __privateMethod$b(this, _SchemaGenerator_instances, getRefAlias_fn).call(this, schemaObject, name);
8820
8832
  }, getParsedSchemaObject_fn = function(schema) {
8821
8833
  return getSchemaFactory(this.context.oas)(schema);
8822
8834
  }, addDiscriminatorToSchema_fn = function({ schema, schemaObject, discriminator }) {
8823
8835
  if (!isKeyword(schema, schemaKeywords.union)) return schema;
8824
8836
  if (discriminator.propertyName.startsWith("x-")) return schema;
8825
- const objectPropertySchema = _a$a.find(this.parse({
8837
+ const objectPropertySchema = _a$b.find(this.parse({
8826
8838
  schema: schemaObject,
8827
8839
  name: null,
8828
8840
  parentName: null,
@@ -8886,9 +8898,9 @@ wouldCreateCircularReference_fn = function(item, childSchemaName) {
8886
8898
  parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootName }) {
8887
8899
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
8888
8900
  const normalizedSchema = this.context.oas.flattenSchema(_schemaObject);
8889
- const { schemaObject, version } = __privateMethod$a(this, _SchemaGenerator_instances, getParsedSchemaObject_fn).call(this, normalizedSchema);
8890
- const options = __privateMethod$a(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
8891
- const emptyType = __privateMethod$a(this, _SchemaGenerator_instances, getEmptyType_fn).call(this, name);
8901
+ const { schemaObject, version } = __privateMethod$b(this, _SchemaGenerator_instances, getParsedSchemaObject_fn).call(this, normalizedSchema);
8902
+ const options = __privateMethod$b(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
8903
+ const emptyType = __privateMethod$b(this, _SchemaGenerator_instances, getEmptyType_fn).call(this, name);
8892
8904
  if (!schemaObject) return [{ keyword: emptyType }];
8893
8905
  const baseItems = [{
8894
8906
  keyword: schemaKeywords.schema,
@@ -8969,7 +8981,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
8969
8981
  if (schemaObject.readOnly) baseItems.push({ keyword: schemaKeywords.readOnly });
8970
8982
  if (schemaObject.writeOnly) baseItems.push({ keyword: schemaKeywords.writeOnly });
8971
8983
  if (isReference(schemaObject)) return [
8972
- ...__privateMethod$a(this, _SchemaGenerator_instances, getRefAlias_fn).call(this, schemaObject, name),
8984
+ ...__privateMethod$b(this, _SchemaGenerator_instances, getRefAlias_fn).call(this, schemaObject, name),
8973
8985
  ...baseItems.filter((item) => item.keyword === schemaKeywords.default),
8974
8986
  schemaObject.description && {
8975
8987
  keyword: schemaKeywords.describe,
@@ -9009,7 +9021,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
9009
9021
  }).filter((x) => Boolean(x))
9010
9022
  };
9011
9023
  if (discriminator) {
9012
- if (this.context && this.context.oas.options.discriminator !== "inherit") return [__privateMethod$a(this, _SchemaGenerator_instances, addDiscriminatorToSchema_fn).call(this, {
9024
+ if (this.context && this.context.oas.options.discriminator !== "inherit") return [__privateMethod$b(this, _SchemaGenerator_instances, addDiscriminatorToSchema_fn).call(this, {
9013
9025
  schemaObject: schemaWithoutOneOf,
9014
9026
  schema: union,
9015
9027
  discriminator
@@ -9040,7 +9052,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
9040
9052
  const and = {
9041
9053
  keyword: schemaKeywords.and,
9042
9054
  args: schemaObject.allOf.flatMap((item) => {
9043
- if (__privateMethod$a(this, _SchemaGenerator_instances, wouldCreateCircularReference_fn).call(this, item, name)) return [];
9055
+ if (__privateMethod$b(this, _SchemaGenerator_instances, wouldCreateCircularReference_fn).call(this, item, name)) return [];
9044
9056
  return item ? this.parse({
9045
9057
  schema: item,
9046
9058
  name,
@@ -9084,7 +9096,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
9084
9096
  parentName,
9085
9097
  rootName
9086
9098
  })];
9087
- return _a$a.combineObjects([and, ...baseItems]);
9099
+ return _a$b.combineObjects([and, ...baseItems]);
9088
9100
  }
9089
9101
  if (schemaObject.enum) {
9090
9102
  if (schemaObject.type === "array") {
@@ -9387,9 +9399,9 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
9387
9399
  }
9388
9400
  return acc;
9389
9401
  }, schemaObject);
9390
- return [...__privateMethod$a(this, _SchemaGenerator_instances, parseProperties_fn).call(this, name, schemaObjectOverridden, rootName), ...baseItems];
9402
+ return [...__privateMethod$b(this, _SchemaGenerator_instances, parseProperties_fn).call(this, name, schemaObjectOverridden, rootName), ...baseItems];
9391
9403
  }
9392
- return [...__privateMethod$a(this, _SchemaGenerator_instances, parseProperties_fn).call(this, name, schemaObject, rootName), ...baseItems];
9404
+ return [...__privateMethod$b(this, _SchemaGenerator_instances, parseProperties_fn).call(this, name, schemaObject, rootName), ...baseItems];
9393
9405
  }
9394
9406
  if (schemaObject.type) {
9395
9407
  const type = Array.isArray(schemaObject.type) ? schemaObject.type.filter((item) => item !== "null")[0] : schemaObject.type;
@@ -9416,7 +9428,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
9416
9428
  if (generator.version === "2") continue;
9417
9429
  const v1Generator = generator;
9418
9430
  for (const [name, schemaObject] of schemaEntries) {
9419
- const options = __privateMethod$a(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
9431
+ const options = __privateMethod$b(this, _SchemaGenerator_instances, getOptions_fn).call(this, name);
9420
9432
  const tree = this.parse({
9421
9433
  schema: schemaObject,
9422
9434
  name,
@@ -9462,7 +9474,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
9462
9474
  }
9463
9475
  }
9464
9476
  return results;
9465
- }, _a$a);
9477
+ }, _a$b);
9466
9478
  const KUBB_REQUIRED_REQUEST_BODY_MARKER = "__kubb_required_request_body__";
9467
9479
  function getRequestBody(operationSchema) {
9468
9480
  var _a2, _b;
@@ -9486,18 +9498,18 @@ function withRequiredRequestBodySchema(operationSchema) {
9486
9498
  };
9487
9499
  }
9488
9500
 
9489
- var __defProp$d = Object.defineProperty;
9490
- var __typeError$9 = (msg) => {
9501
+ var __defProp$e = Object.defineProperty;
9502
+ var __typeError$a = (msg) => {
9491
9503
  throw TypeError(msg);
9492
9504
  };
9493
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9494
- var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
9495
- var __accessCheck$9 = (obj, member, msg) => member.has(obj) || __typeError$9("Cannot " + msg);
9496
- var __privateGet$9 = (obj, member, getter) => (__accessCheck$9(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9497
- var __privateAdd$9 = (obj, member, value) => member.has(obj) ? __typeError$9("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9498
- var __privateSet$9 = (obj, member, value, setter) => (__accessCheck$9(obj, member, "write to private field"), member.set(obj, value), value);
9499
- var __privateMethod$9 = (obj, member, method) => (__accessCheck$9(obj, member, "access private method"), method);
9500
- var _options$9, _URLPath_instances$8, transformParam_fn$8, eachParam_fn$8, _a$9;
9505
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9506
+ var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
9507
+ var __accessCheck$a = (obj, member, msg) => member.has(obj) || __typeError$a("Cannot " + msg);
9508
+ var __privateGet$a = (obj, member, getter) => (__accessCheck$a(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9509
+ var __privateAdd$a = (obj, member, value) => member.has(obj) ? __typeError$a("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9510
+ var __privateSet$a = (obj, member, value, setter) => (__accessCheck$a(obj, member, "write to private field"), member.set(obj, value), value);
9511
+ var __privateMethod$a = (obj, member, method) => (__accessCheck$a(obj, member, "access private method"), method);
9512
+ var _options$a, _URLPath_instances$9, transformParam_fn$9, eachParam_fn$9, _a$a;
9501
9513
  function isValidVarName$9(name) {
9502
9514
  try {
9503
9515
  new Function(`var ${name}`);
@@ -9506,16 +9518,16 @@ function isValidVarName$9(name) {
9506
9518
  }
9507
9519
  return true;
9508
9520
  }
9509
- var URLPath$8 = (_a$9 = class {
9521
+ var URLPath$9 = (_a$a = class {
9510
9522
  constructor(path, options = {}) {
9511
- __privateAdd$9(this, _URLPath_instances$8);
9523
+ __privateAdd$a(this, _URLPath_instances$9);
9512
9524
  /**
9513
9525
  * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
9514
9526
  */
9515
- __publicField$8(this, "path");
9516
- __privateAdd$9(this, _options$9);
9527
+ __publicField$9(this, "path");
9528
+ __privateAdd$a(this, _options$a);
9517
9529
  this.path = path;
9518
- __privateSet$9(this, _options$9, options);
9530
+ __privateSet$a(this, _options$a, options);
9519
9531
  }
9520
9532
  /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
9521
9533
  *
@@ -9596,7 +9608,7 @@ var URLPath$8 = (_a$9 = class {
9596
9608
  toTemplateString({ prefix = "", replacer } = {}) {
9597
9609
  return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
9598
9610
  if (i % 2 === 0) return part;
9599
- const param = __privateMethod$9(this, _URLPath_instances$8, transformParam_fn$8).call(this, part);
9611
+ const param = __privateMethod$a(this, _URLPath_instances$9, transformParam_fn$9).call(this, part);
9600
9612
  return `\${${replacer ? replacer(param) : param}}`;
9601
9613
  }).join("")}\``;
9602
9614
  }
@@ -9613,7 +9625,7 @@ var URLPath$8 = (_a$9 = class {
9613
9625
  */
9614
9626
  getParams(replacer) {
9615
9627
  const params = {};
9616
- __privateMethod$9(this, _URLPath_instances$8, eachParam_fn$8).call(this, (_raw, param) => {
9628
+ __privateMethod$a(this, _URLPath_instances$9, eachParam_fn$9).call(this, (_raw, param) => {
9617
9629
  const key = replacer ? replacer(param) : param;
9618
9630
  params[key] = key;
9619
9631
  });
@@ -9629,23 +9641,23 @@ var URLPath$8 = (_a$9 = class {
9629
9641
  toURLPath() {
9630
9642
  return this.path.replace(/\{([^}]+)\}/g, ":$1");
9631
9643
  }
9632
- }, _options$9 = new WeakMap(), _URLPath_instances$8 = new WeakSet(), transformParam_fn$8 = function(raw) {
9644
+ }, _options$a = new WeakMap(), _URLPath_instances$9 = new WeakSet(), transformParam_fn$9 = function(raw) {
9633
9645
  const param = isValidVarName$9(raw) ? raw : camelCase$d(raw);
9634
- return __privateGet$9(this, _options$9).casing === "camelcase" ? camelCase$d(param) : param;
9646
+ return __privateGet$a(this, _options$a).casing === "camelcase" ? camelCase$d(param) : param;
9635
9647
  }, /**
9636
9648
  * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
9637
9649
  */
9638
- eachParam_fn$8 = function(fn) {
9650
+ eachParam_fn$9 = function(fn) {
9639
9651
  for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
9640
9652
  const raw = match[1];
9641
- fn(raw, __privateMethod$9(this, _URLPath_instances$8, transformParam_fn$8).call(this, raw));
9653
+ fn(raw, __privateMethod$a(this, _URLPath_instances$9, transformParam_fn$9).call(this, raw));
9642
9654
  }
9643
- }, _a$9);
9644
- function getComments(operation) {
9655
+ }, _a$a);
9656
+ function getComments$1(operation) {
9645
9657
  return [
9646
9658
  operation.getDescription() && `@description ${operation.getDescription()}`,
9647
9659
  operation.getSummary() && `@summary ${operation.getSummary()}`,
9648
- operation.path && `{@link ${new URLPath$8(operation.path).URL}}`,
9660
+ operation.path && `{@link ${new URLPath$9(operation.path).URL}}`,
9649
9661
  operation.isDeprecated() && "@deprecated"
9650
9662
  ].filter((x) => Boolean(x)).flatMap((text) => {
9651
9663
  return text.split(/\r?\n/).map((line) => line.trim());
@@ -9691,7 +9703,7 @@ function getPathParams(operationSchema, options = {}) {
9691
9703
  return acc;
9692
9704
  }, {});
9693
9705
  }
9694
- function getParamsMapping(operationSchema, options = {}) {
9706
+ function getParamsMapping$1(operationSchema, options = {}) {
9695
9707
  if (!(operationSchema == null ? void 0 : operationSchema.schema.properties)) return;
9696
9708
  const allEntries = [];
9697
9709
  let hasTransformation = false;
@@ -9736,18 +9748,18 @@ function isParameterSchema(schemaName) {
9736
9748
  return lowerName.includes("pathparams") || lowerName.includes("queryparams") || lowerName.includes("headerparams");
9737
9749
  }
9738
9750
 
9739
- var __defProp$c = Object.defineProperty;
9740
- var __typeError$8 = (msg) => {
9751
+ var __defProp$d = Object.defineProperty;
9752
+ var __typeError$9 = (msg) => {
9741
9753
  throw TypeError(msg);
9742
9754
  };
9743
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9744
- var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
9745
- var __accessCheck$8 = (obj, member, msg) => member.has(obj) || __typeError$8("Cannot " + msg);
9746
- var __privateGet$8 = (obj, member, getter) => (__accessCheck$8(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9747
- var __privateAdd$8 = (obj, member, value) => member.has(obj) ? __typeError$8("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9748
- var __privateSet$8 = (obj, member, value, setter) => (__accessCheck$8(obj, member, "write to private field"), member.set(obj, value), value);
9749
- var __privateMethod$8 = (obj, member, method) => (__accessCheck$8(obj, member, "access private method"), method);
9750
- var _options$8, _URLPath_instances$7, transformParam_fn$7, eachParam_fn$7, _a$8;
9755
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9756
+ var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
9757
+ var __accessCheck$9 = (obj, member, msg) => member.has(obj) || __typeError$9("Cannot " + msg);
9758
+ var __privateGet$9 = (obj, member, getter) => (__accessCheck$9(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9759
+ var __privateAdd$9 = (obj, member, value) => member.has(obj) ? __typeError$9("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9760
+ var __privateSet$9 = (obj, member, value, setter) => (__accessCheck$9(obj, member, "write to private field"), member.set(obj, value), value);
9761
+ var __privateMethod$9 = (obj, member, method) => (__accessCheck$9(obj, member, "access private method"), method);
9762
+ var _options$9, _URLPath_instances$8, transformParam_fn$8, eachParam_fn$8, _a$9;
9751
9763
  function toCamelOrPascal$b(text, pascal) {
9752
9764
  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) => {
9753
9765
  if (word.length > 1 && word === word.toUpperCase()) return word;
@@ -9788,16 +9800,16 @@ function isValidVarName$8(name) {
9788
9800
  }
9789
9801
  return true;
9790
9802
  }
9791
- var URLPath$7 = (_a$8 = class {
9803
+ var URLPath$8 = (_a$9 = class {
9792
9804
  constructor(path, options = {}) {
9793
- __privateAdd$8(this, _URLPath_instances$7);
9805
+ __privateAdd$9(this, _URLPath_instances$8);
9794
9806
  /**
9795
9807
  * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
9796
9808
  */
9797
- __publicField$7(this, "path");
9798
- __privateAdd$8(this, _options$8);
9809
+ __publicField$8(this, "path");
9810
+ __privateAdd$9(this, _options$9);
9799
9811
  this.path = path;
9800
- __privateSet$8(this, _options$8, options);
9812
+ __privateSet$9(this, _options$9, options);
9801
9813
  }
9802
9814
  /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
9803
9815
  *
@@ -9878,7 +9890,7 @@ var URLPath$7 = (_a$8 = class {
9878
9890
  toTemplateString({ prefix = "", replacer } = {}) {
9879
9891
  return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
9880
9892
  if (i % 2 === 0) return part;
9881
- const param = __privateMethod$8(this, _URLPath_instances$7, transformParam_fn$7).call(this, part);
9893
+ const param = __privateMethod$9(this, _URLPath_instances$8, transformParam_fn$8).call(this, part);
9882
9894
  return `\${${replacer ? replacer(param) : param}}`;
9883
9895
  }).join("")}\``;
9884
9896
  }
@@ -9895,7 +9907,7 @@ var URLPath$7 = (_a$8 = class {
9895
9907
  */
9896
9908
  getParams(replacer) {
9897
9909
  const params = {};
9898
- __privateMethod$8(this, _URLPath_instances$7, eachParam_fn$7).call(this, (_raw, param) => {
9910
+ __privateMethod$9(this, _URLPath_instances$8, eachParam_fn$8).call(this, (_raw, param) => {
9899
9911
  const key = replacer ? replacer(param) : param;
9900
9912
  params[key] = key;
9901
9913
  });
@@ -9911,18 +9923,18 @@ var URLPath$7 = (_a$8 = class {
9911
9923
  toURLPath() {
9912
9924
  return this.path.replace(/\{([^}]+)\}/g, ":$1");
9913
9925
  }
9914
- }, _options$8 = new WeakMap(), _URLPath_instances$7 = new WeakSet(), transformParam_fn$7 = function(raw) {
9926
+ }, _options$9 = new WeakMap(), _URLPath_instances$8 = new WeakSet(), transformParam_fn$8 = function(raw) {
9915
9927
  const param = isValidVarName$8(raw) ? raw : camelCase$b(raw);
9916
- return __privateGet$8(this, _options$8).casing === "camelcase" ? camelCase$b(param) : param;
9928
+ return __privateGet$9(this, _options$9).casing === "camelcase" ? camelCase$b(param) : param;
9917
9929
  }, /**
9918
9930
  * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
9919
9931
  */
9920
- eachParam_fn$7 = function(fn) {
9932
+ eachParam_fn$8 = function(fn) {
9921
9933
  for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
9922
9934
  const raw = match[1];
9923
- fn(raw, __privateMethod$8(this, _URLPath_instances$7, transformParam_fn$7).call(this, raw));
9935
+ fn(raw, __privateMethod$9(this, _URLPath_instances$8, transformParam_fn$8).call(this, raw));
9924
9936
  }
9925
- }, _a$8);
9937
+ }, _a$9);
9926
9938
  function getParams$1$5({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
9927
9939
  var _a2, _b;
9928
9940
  if (paramsType === "object") {
@@ -9946,14 +9958,14 @@ function getParams$1$5({ paramsType, paramsCasing, pathParamsType, typeSchemas }
9946
9958
  }
9947
9959
  __name$5(getParams$1$5, "getParams");
9948
9960
  function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
9949
- const path = new URLPath$7(operation.path);
9961
+ const path = new URLPath$8(operation.path);
9950
9962
  const params = getParams$1$5({
9951
9963
  paramsType,
9952
9964
  paramsCasing,
9953
9965
  pathParamsType,
9954
9966
  typeSchemas
9955
9967
  });
9956
- const pathParamsMapping = paramsCasing ? getParamsMapping(typeSchemas.pathParams, { casing: paramsCasing }) : void 0;
9968
+ const pathParamsMapping = paramsCasing ? getParamsMapping$1(typeSchemas.pathParams, { casing: paramsCasing }) : void 0;
9957
9969
  return /* @__PURE__ */ jsx(File.Source, {
9958
9970
  name,
9959
9971
  isExportable,
@@ -9976,7 +9988,7 @@ function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseU
9976
9988
  });
9977
9989
  }
9978
9990
  Url.getParams = getParams$1$5;
9979
- function getParams$d({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }) {
9991
+ function getParams$b({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }) {
9980
9992
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
9981
9993
  if (paramsType === "object") {
9982
9994
  const children = {
@@ -10039,12 +10051,12 @@ function getParams$d({ paramsType, paramsCasing, pathParamsType, typeSchemas, is
10039
10051
  }
10040
10052
  function Client({ name, isExportable = true, isIndexable = true, returnType, typeSchemas, baseURL, dataReturnType, parser, zodSchemas, paramsType, paramsCasing, pathParamsType, operation, urlName, children, isConfigurable = true }) {
10041
10053
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10042
- const path = new URLPath$7(operation.path);
10054
+ const path = new URLPath$8(operation.path);
10043
10055
  const contentType = operation.getContentType();
10044
10056
  const isFormData = contentType === "multipart/form-data";
10045
- const pathParamsMapping = paramsCasing && !urlName ? getParamsMapping(typeSchemas.pathParams, { casing: paramsCasing }) : void 0;
10046
- const queryParamsMapping = paramsCasing ? getParamsMapping(typeSchemas.queryParams, { casing: paramsCasing }) : void 0;
10047
- const headerParamsMapping = paramsCasing ? getParamsMapping(typeSchemas.headerParams, { casing: paramsCasing }) : void 0;
10057
+ const pathParamsMapping = paramsCasing && !urlName ? getParamsMapping$1(typeSchemas.pathParams, { casing: paramsCasing }) : void 0;
10058
+ const queryParamsMapping = paramsCasing ? getParamsMapping$1(typeSchemas.queryParams, { casing: paramsCasing }) : void 0;
10059
+ const headerParamsMapping = paramsCasing ? getParamsMapping$1(typeSchemas.headerParams, { casing: paramsCasing }) : void 0;
10048
10060
  const headers = [contentType !== "application/json" && contentType !== "multipart/form-data" ? `'Content-Type': '${contentType}'` : void 0, ((_a2 = typeSchemas.headerParams) == null ? void 0 : _a2.name) ? headerParamsMapping ? "...mappedHeaders" : "...headers" : void 0].filter(Boolean);
10049
10061
  const TError = `ResponseErrorConfig<${((_b = typeSchemas.errors) == null ? void 0 : _b.map((item) => item.name).join(" | ")) || "Error"}>`;
10050
10062
  const generics = [
@@ -10052,7 +10064,7 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, typ
10052
10064
  TError,
10053
10065
  ((_c = typeSchemas.request) == null ? void 0 : _c.name) || "unknown"
10054
10066
  ].filter(Boolean);
10055
- const params = getParams$d({
10067
+ const params = getParams$b({
10056
10068
  paramsType,
10057
10069
  paramsCasing,
10058
10070
  pathParamsType,
@@ -10092,7 +10104,7 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, typ
10092
10104
  async: true,
10093
10105
  export: isExportable,
10094
10106
  params: params.toConstructor(),
10095
- JSDoc: { comments: getComments(operation) },
10107
+ JSDoc: { comments: getComments$1(operation) },
10096
10108
  returnType,
10097
10109
  children: [
10098
10110
  isConfigurable ? "const { client: request = fetch, ...requestConfig } = config" : "",
@@ -10121,7 +10133,7 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, typ
10121
10133
  })
10122
10134
  })] });
10123
10135
  }
10124
- Client.getParams = getParams$d;
10136
+ Client.getParams = getParams$b;
10125
10137
  function buildHeaders$1(contentType, hasHeaderParams) {
10126
10138
  return [contentType !== "application/json" && contentType !== "multipart/form-data" ? `'Content-Type': '${contentType}'` : void 0, hasHeaderParams ? "...headers" : void 0].filter(Boolean);
10127
10139
  }
@@ -10172,7 +10184,7 @@ function buildReturnStatement$1({ dataReturnType, parser, zodSchemas }) {
10172
10184
  __name$5(buildReturnStatement$1, "buildReturnStatement");
10173
10185
  function generateMethod$1({ operation, name, typeSchemas, zodSchemas, baseURL, dataReturnType, parser, paramsType, paramsCasing, pathParamsType }) {
10174
10186
  var _a2, _b;
10175
- const path = new URLPath$7(operation.path, { casing: paramsCasing });
10187
+ const path = new URLPath$8(operation.path, { casing: paramsCasing });
10176
10188
  const contentType = operation.getContentType();
10177
10189
  const isFormData = contentType === "multipart/form-data";
10178
10190
  const headers = buildHeaders$1(contentType, !!((_a2 = typeSchemas.headerParams) == null ? void 0 : _a2.name));
@@ -10192,7 +10204,7 @@ function generateMethod$1({ operation, name, typeSchemas, zodSchemas, baseURL, d
10192
10204
  isFormData,
10193
10205
  headers
10194
10206
  });
10195
- const jsdoc = buildJSDoc(getComments(operation));
10207
+ const jsdoc = buildJSDoc(getComments$1(operation));
10196
10208
  const requestDataLine = buildRequestDataLine$1({
10197
10209
  parser,
10198
10210
  zodSchemas,
@@ -10250,7 +10262,7 @@ function Operations$1({ name, operations }) {
10250
10262
  const operationsObject = {};
10251
10263
  operations.forEach((operation) => {
10252
10264
  operationsObject[operation.getOperationId()] = {
10253
- path: new URLPath$7(operation.path).URL,
10265
+ path: new URLPath$8(operation.path).URL,
10254
10266
  method: operation.method
10255
10267
  };
10256
10268
  });
@@ -10309,7 +10321,7 @@ function buildReturnStatement({ dataReturnType, parser, zodSchemas }) {
10309
10321
  }
10310
10322
  function generateMethod({ operation, name, typeSchemas, zodSchemas, baseURL, dataReturnType, parser, paramsType, paramsCasing, pathParamsType }) {
10311
10323
  var _a2, _b;
10312
- const path = new URLPath$7(operation.path, { casing: paramsCasing });
10324
+ const path = new URLPath$8(operation.path, { casing: paramsCasing });
10313
10325
  const contentType = operation.getContentType();
10314
10326
  const isFormData = contentType === "multipart/form-data";
10315
10327
  const headers = buildHeaders(contentType, !!((_a2 = typeSchemas.headerParams) == null ? void 0 : _a2.name));
@@ -10329,7 +10341,7 @@ function generateMethod({ operation, name, typeSchemas, zodSchemas, baseURL, dat
10329
10341
  isFormData,
10330
10342
  headers
10331
10343
  });
10332
- const jsdoc = buildJSDoc(getComments(operation));
10344
+ const jsdoc = buildJSDoc(getComments$1(operation));
10333
10345
  const requestDataLine = buildRequestDataLine({
10334
10346
  parser,
10335
10347
  zodSchemas,
@@ -10507,6 +10519,31 @@ function Operations({ name, operations }) {
10507
10519
  })
10508
10520
  ] });
10509
10521
  }
10522
+ function Zod({ name, node, printer, inferTypeName }) {
10523
+ const output = printer.print(node);
10524
+ if (!output) return;
10525
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
10526
+ name,
10527
+ isExportable: true,
10528
+ isIndexable: true,
10529
+ children: /* @__PURE__ */ jsx(Const, {
10530
+ export: true,
10531
+ name,
10532
+ children: output
10533
+ })
10534
+ }), inferTypeName && /* @__PURE__ */ jsx(File.Source, {
10535
+ name: inferTypeName,
10536
+ isExportable: true,
10537
+ isIndexable: true,
10538
+ isTypeOnly: true,
10539
+ children: /* @__PURE__ */ jsx(Type$1, {
10540
+ export: true,
10541
+ name: inferTypeName,
10542
+ children: `z.infer<typeof ${name}>`
10543
+ })
10544
+ })] });
10545
+ }
10546
+ const ZOD_NAMESPACE_IMPORTS = /* @__PURE__ */ new Set(["zod", "zod/mini"]);
10510
10547
  function shouldCoerce(coercion, type) {
10511
10548
  if (coercion === void 0 || coercion === false) return false;
10512
10549
  if (coercion === true) return true;
@@ -10786,7 +10823,8 @@ const printerZod = definePrinter((options) => {
10786
10823
  if (transformed) base = `${base}.and(${transformed})`;
10787
10824
  }
10788
10825
  return base;
10789
- }
10826
+ },
10827
+ ...options.nodes
10790
10828
  },
10791
10829
  print(node) {
10792
10830
  const { keysToOmit } = this.options;
@@ -10805,37 +10843,6 @@ const printerZod = definePrinter((options) => {
10805
10843
  }
10806
10844
  };
10807
10845
  });
10808
- function Zod({ name, node, coercion, guidType, wrapOutput, inferTypeName, resolver, keysToOmit }) {
10809
- const output = printerZod({
10810
- coercion,
10811
- guidType,
10812
- wrapOutput,
10813
- resolver,
10814
- schemaName: name,
10815
- keysToOmit
10816
- }).print(node);
10817
- if (!output) return;
10818
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
10819
- name,
10820
- isExportable: true,
10821
- isIndexable: true,
10822
- children: /* @__PURE__ */ jsx(Const, {
10823
- export: true,
10824
- name,
10825
- children: output
10826
- })
10827
- }), inferTypeName && /* @__PURE__ */ jsx(File.Source, {
10828
- name: inferTypeName,
10829
- isExportable: true,
10830
- isIndexable: true,
10831
- isTypeOnly: true,
10832
- children: /* @__PURE__ */ jsx(Type$1, {
10833
- export: true,
10834
- name: inferTypeName,
10835
- children: `z.infer<typeof ${name}>`
10836
- })
10837
- })] });
10838
- }
10839
10846
  const printerZodMini = definePrinter((options) => {
10840
10847
  return {
10841
10848
  name: "zod-mini",
@@ -10981,7 +10988,8 @@ const printerZodMini = definePrinter((options) => {
10981
10988
  if (transformed) base = `z.intersection(${base}, ${transformed})`;
10982
10989
  }
10983
10990
  return base;
10984
- }
10991
+ },
10992
+ ...options.nodes
10985
10993
  },
10986
10994
  print(node) {
10987
10995
  const { keysToOmit } = this.options;
@@ -10999,49 +11007,18 @@ const printerZodMini = definePrinter((options) => {
10999
11007
  }
11000
11008
  };
11001
11009
  });
11002
- function ZodMini({ name, node, guidType, wrapOutput, inferTypeName, resolver, keysToOmit }) {
11003
- const output = printerZodMini({
11004
- guidType,
11005
- wrapOutput,
11006
- resolver,
11007
- schemaName: name,
11008
- keysToOmit
11009
- }).print(node);
11010
- if (!output) return;
11011
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
11012
- name,
11013
- isExportable: true,
11014
- isIndexable: true,
11015
- children: /* @__PURE__ */ jsx(Const, {
11016
- export: true,
11017
- name,
11018
- children: output
11019
- })
11020
- }), inferTypeName && /* @__PURE__ */ jsx(File.Source, {
11021
- name: inferTypeName,
11022
- isExportable: true,
11023
- isIndexable: true,
11024
- isTypeOnly: true,
11025
- children: /* @__PURE__ */ jsx(Type$1, {
11026
- export: true,
11027
- name: inferTypeName,
11028
- children: `z.infer<typeof ${name}>`
11029
- })
11030
- })] });
11031
- }
11032
- const ZOD_NAMESPACE_IMPORTS = /* @__PURE__ */ new Set(["zod", "zod/mini"]);
11033
11010
  const zodGenerator = defineGenerator({
11034
11011
  name: "zod",
11035
11012
  type: "react",
11036
- Schema({ node, adapter, options, config, resolver }) {
11037
- const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, transformers = [] } = options;
11038
- const transformedNode = transform(node, composeTransformers(...transformers));
11013
+ Schema({ node, adapter, options, config, resolver, plugin }) {
11014
+ const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = options;
11015
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
11039
11016
  if (!transformedNode.name) return;
11040
11017
  const root = path$2.resolve(config.root, config.output.path);
11041
11018
  const mode = getMode(path$2.resolve(root, output.path));
11042
11019
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
11043
11020
  const imports = adapter.getImports(transformedNode, (schemaName) => ({
11044
- name: resolver.default(schemaName, "function"),
11021
+ name: resolver.resolveSchemaName(schemaName),
11045
11022
  path: resolver.resolveFile({
11046
11023
  name: schemaName,
11047
11024
  extname: ".ts"
@@ -11051,9 +11028,8 @@ const zodGenerator = defineGenerator({
11051
11028
  group
11052
11029
  }).path
11053
11030
  }));
11054
- const inferTypeName = inferred ? resolver.resolveInferName(resolver.resolveName(transformedNode.name)) : void 0;
11055
11031
  const meta = {
11056
- name: resolver.default(transformedNode.name, "function"),
11032
+ name: resolver.resolveSchemaName(transformedNode.name),
11057
11033
  file: resolver.resolveFile({
11058
11034
  name: transformedNode.name,
11059
11035
  extname: ".ts"
@@ -11063,6 +11039,21 @@ const zodGenerator = defineGenerator({
11063
11039
  group
11064
11040
  })
11065
11041
  };
11042
+ const inferTypeName = inferred ? resolver.resolveSchemaTypeName(transformedNode.name) : void 0;
11043
+ const schemaPrinter = mini ? printerZodMini({
11044
+ guidType,
11045
+ wrapOutput,
11046
+ resolver,
11047
+ schemaName: meta.name,
11048
+ nodes: printer == null ? void 0 : printer.nodes
11049
+ }) : printerZod({
11050
+ coercion,
11051
+ guidType,
11052
+ wrapOutput,
11053
+ resolver,
11054
+ schemaName: meta.name,
11055
+ nodes: printer == null ? void 0 : printer.nodes
11056
+ });
11066
11057
  return /* @__PURE__ */ jsxs(File, {
11067
11058
  baseName: meta.file.baseName,
11068
11059
  path: meta.file.path,
@@ -11086,29 +11077,19 @@ const zodGenerator = defineGenerator({
11086
11077
  path: imp.path,
11087
11078
  name: imp.name
11088
11079
  }, [transformedNode.name, imp.path].join("-"))),
11089
- mini ? /* @__PURE__ */ jsx(ZodMini, {
11090
- name: meta.name,
11091
- node: transformedNode,
11092
- guidType,
11093
- wrapOutput,
11094
- inferTypeName,
11095
- resolver
11096
- }) : /* @__PURE__ */ jsx(Zod, {
11080
+ /* @__PURE__ */ jsx(Zod, {
11097
11081
  name: meta.name,
11098
11082
  node: transformedNode,
11099
- coercion,
11100
- guidType,
11101
- wrapOutput,
11102
- inferTypeName,
11103
- resolver
11083
+ printer: schemaPrinter,
11084
+ inferTypeName
11104
11085
  })
11105
11086
  ]
11106
11087
  });
11107
11088
  },
11108
- Operation({ node, adapter, options, config, resolver }) {
11089
+ Operation({ node, adapter, options, config, resolver, plugin }) {
11109
11090
  var _a, _b, _c;
11110
- const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, transformers } = options;
11111
- const transformedNode = transform(node, composeTransformers(...transformers));
11091
+ const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = options;
11092
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
11112
11093
  const root = path$2.resolve(config.root, config.output.path);
11113
11094
  const mode = getMode(path$2.resolve(root, output.path));
11114
11095
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
@@ -11125,9 +11106,9 @@ const zodGenerator = defineGenerator({
11125
11106
  }) };
11126
11107
  function renderSchemaEntry({ schema, name, keysToOmit }) {
11127
11108
  if (!schema) return null;
11128
- const inferTypeName = inferred ? resolver.resolveInferName(name) : void 0;
11109
+ const inferTypeName = inferred ? resolver.resolveTypeName(name) : void 0;
11129
11110
  const imports = adapter.getImports(schema, (schemaName) => ({
11130
- name: resolver.default(schemaName, "function"),
11111
+ name: resolver.resolveSchemaName(schemaName),
11131
11112
  path: resolver.resolveFile({
11132
11113
  name: schemaName,
11133
11114
  extname: ".ts"
@@ -11137,6 +11118,22 @@ const zodGenerator = defineGenerator({
11137
11118
  group
11138
11119
  }).path
11139
11120
  }));
11121
+ const schemaPrinter = mini ? printerZodMini({
11122
+ guidType,
11123
+ wrapOutput,
11124
+ resolver,
11125
+ schemaName: name,
11126
+ keysToOmit,
11127
+ nodes: printer == null ? void 0 : printer.nodes
11128
+ }) : printerZod({
11129
+ coercion,
11130
+ guidType,
11131
+ wrapOutput,
11132
+ resolver,
11133
+ schemaName: name,
11134
+ keysToOmit,
11135
+ nodes: printer == null ? void 0 : printer.nodes
11136
+ });
11140
11137
  return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
11141
11138
  root: meta.file.path,
11142
11139
  path: imp.path,
@@ -11145,23 +11142,11 @@ const zodGenerator = defineGenerator({
11145
11142
  name,
11146
11143
  imp.path,
11147
11144
  imp.name
11148
- ].join("-"))), mini ? /* @__PURE__ */ jsx(ZodMini, {
11149
- name,
11150
- node: schema,
11151
- guidType,
11152
- wrapOutput,
11153
- inferTypeName,
11154
- resolver,
11155
- keysToOmit
11156
- }) : /* @__PURE__ */ jsx(Zod, {
11145
+ ].join("-"))), /* @__PURE__ */ jsx(Zod, {
11157
11146
  name,
11158
11147
  node: schema,
11159
- coercion,
11160
- guidType,
11161
- wrapOutput,
11162
- inferTypeName,
11163
- resolver,
11164
- keysToOmit
11148
+ printer: schemaPrinter,
11149
+ inferTypeName
11165
11150
  })] });
11166
11151
  }
11167
11152
  const paramSchemas = params.map((param) => renderSchemaEntry({
@@ -11205,8 +11190,8 @@ const zodGenerator = defineGenerator({
11205
11190
  ]
11206
11191
  });
11207
11192
  },
11208
- Operations({ nodes, adapter, options, config, resolver }) {
11209
- const { output, importPath, group, operations, paramsCasing, transformers } = options;
11193
+ Operations({ nodes, adapter, options, config, resolver, plugin }) {
11194
+ const { output, importPath, group, operations, paramsCasing } = options;
11210
11195
  if (!operations) return;
11211
11196
  const root = path$2.resolve(config.root, config.output.path);
11212
11197
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
@@ -11219,7 +11204,7 @@ const zodGenerator = defineGenerator({
11219
11204
  group
11220
11205
  }) };
11221
11206
  const transformedOperations = nodes.map((node) => {
11222
- const transformedNode = transform(node, composeTransformers(...transformers));
11207
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
11223
11208
  return {
11224
11209
  node: transformedNode,
11225
11210
  data: buildSchemaNames(transformedNode, {
@@ -11420,15 +11405,15 @@ function buildLegacySchemaNames(node, params, resolver) {
11420
11405
  const zodGeneratorLegacy = defineGenerator({
11421
11406
  name: "zod-legacy",
11422
11407
  type: "react",
11423
- Schema({ node, adapter, options, config, resolver }) {
11424
- const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, transformers = [] } = options;
11425
- const transformedNode = transform(node, composeTransformers(...transformers));
11408
+ Schema({ node, adapter, options, config, resolver, plugin }) {
11409
+ const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = options;
11410
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
11426
11411
  if (!transformedNode.name) return;
11427
11412
  const root = path$2.resolve(config.root, config.output.path);
11428
11413
  const mode = getMode(path$2.resolve(root, output.path));
11429
11414
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
11430
11415
  const imports = adapter.getImports(transformedNode, (schemaName) => ({
11431
- name: resolver.default(schemaName, "function"),
11416
+ name: resolver.resolveSchemaName(schemaName),
11432
11417
  path: resolver.resolveFile({
11433
11418
  name: schemaName,
11434
11419
  extname: ".ts"
@@ -11438,9 +11423,9 @@ const zodGeneratorLegacy = defineGenerator({
11438
11423
  group
11439
11424
  }).path
11440
11425
  }));
11441
- const inferTypeName = inferred ? resolver.resolveInferName(resolver.resolveName(transformedNode.name)) : void 0;
11426
+ const inferTypeName = inferred ? resolver.resolveSchemaTypeName(transformedNode.name) : void 0;
11442
11427
  const meta = {
11443
- name: resolver.default(transformedNode.name, "function"),
11428
+ name: resolver.resolveSchemaName(transformedNode.name),
11444
11429
  file: resolver.resolveFile({
11445
11430
  name: transformedNode.name,
11446
11431
  extname: ".ts"
@@ -11450,6 +11435,20 @@ const zodGeneratorLegacy = defineGenerator({
11450
11435
  group
11451
11436
  })
11452
11437
  };
11438
+ const schemaPrinter = mini ? printerZodMini({
11439
+ guidType,
11440
+ wrapOutput,
11441
+ resolver,
11442
+ schemaName: meta.name,
11443
+ nodes: printer == null ? void 0 : printer.nodes
11444
+ }) : printerZod({
11445
+ coercion,
11446
+ guidType,
11447
+ wrapOutput,
11448
+ resolver,
11449
+ schemaName: meta.name,
11450
+ nodes: printer == null ? void 0 : printer.nodes
11451
+ });
11453
11452
  return /* @__PURE__ */ jsxs(File, {
11454
11453
  baseName: meta.file.baseName,
11455
11454
  path: meta.file.path,
@@ -11473,29 +11472,19 @@ const zodGeneratorLegacy = defineGenerator({
11473
11472
  path: imp.path,
11474
11473
  name: imp.name
11475
11474
  }, [transformedNode.name, imp.path].join("-"))),
11476
- mini ? /* @__PURE__ */ jsx(ZodMini, {
11477
- name: meta.name,
11478
- node: transformedNode,
11479
- guidType,
11480
- wrapOutput,
11481
- inferTypeName,
11482
- resolver
11483
- }) : /* @__PURE__ */ jsx(Zod, {
11475
+ /* @__PURE__ */ jsx(Zod, {
11484
11476
  name: meta.name,
11485
11477
  node: transformedNode,
11486
- coercion,
11487
- guidType,
11488
- wrapOutput,
11489
- inferTypeName,
11490
- resolver
11478
+ printer: schemaPrinter,
11479
+ inferTypeName
11491
11480
  })
11492
11481
  ]
11493
11482
  });
11494
11483
  },
11495
- Operation({ node, adapter, options, config, resolver }) {
11484
+ Operation({ node, adapter, options, config, resolver, plugin }) {
11496
11485
  var _a, _b, _c;
11497
- const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, transformers } = options;
11498
- const transformedNode = transform(node, composeTransformers(...transformers));
11486
+ const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = options;
11487
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
11499
11488
  const root = path$2.resolve(config.root, config.output.path);
11500
11489
  const mode = getMode(path$2.resolve(root, output.path));
11501
11490
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
@@ -11512,9 +11501,9 @@ const zodGeneratorLegacy = defineGenerator({
11512
11501
  }) };
11513
11502
  function renderSchemaEntry({ schema, name, keysToOmit }) {
11514
11503
  if (!schema) return null;
11515
- const inferTypeName = inferred ? resolver.resolveInferName(name) : void 0;
11504
+ const inferTypeName = inferred ? resolver.resolveTypeName(name) : void 0;
11516
11505
  const imports = adapter.getImports(schema, (schemaName) => ({
11517
- name: resolver.default(schemaName, "function"),
11506
+ name: resolver.resolveSchemaName(schemaName),
11518
11507
  path: resolver.resolveFile({
11519
11508
  name: schemaName,
11520
11509
  extname: ".ts"
@@ -11524,6 +11513,22 @@ const zodGeneratorLegacy = defineGenerator({
11524
11513
  group
11525
11514
  }).path
11526
11515
  }));
11516
+ const schemaPrinter = mini ? printerZodMini({
11517
+ guidType,
11518
+ wrapOutput,
11519
+ resolver,
11520
+ schemaName: name,
11521
+ keysToOmit,
11522
+ nodes: printer == null ? void 0 : printer.nodes
11523
+ }) : printerZod({
11524
+ coercion,
11525
+ guidType,
11526
+ wrapOutput,
11527
+ resolver,
11528
+ schemaName: name,
11529
+ keysToOmit,
11530
+ nodes: printer == null ? void 0 : printer.nodes
11531
+ });
11527
11532
  return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
11528
11533
  root: meta.file.path,
11529
11534
  path: imp.path,
@@ -11532,23 +11537,11 @@ const zodGeneratorLegacy = defineGenerator({
11532
11537
  name,
11533
11538
  imp.path,
11534
11539
  imp.name
11535
- ].join("-"))), mini ? /* @__PURE__ */ jsx(ZodMini, {
11540
+ ].join("-"))), /* @__PURE__ */ jsx(Zod, {
11536
11541
  name,
11537
11542
  node: schema,
11538
- guidType,
11539
- wrapOutput,
11540
- inferTypeName,
11541
- resolver,
11542
- keysToOmit
11543
- }) : /* @__PURE__ */ jsx(Zod, {
11544
- name,
11545
- node: schema,
11546
- coercion,
11547
- guidType,
11548
- wrapOutput,
11549
- inferTypeName,
11550
- resolver,
11551
- keysToOmit
11543
+ printer: schemaPrinter,
11544
+ inferTypeName
11552
11545
  })] });
11553
11546
  }
11554
11547
  const pathParams = params.filter((p) => p.in === "path");
@@ -11631,8 +11624,8 @@ const zodGeneratorLegacy = defineGenerator({
11631
11624
  ]
11632
11625
  });
11633
11626
  },
11634
- Operations({ nodes, adapter, options, config, resolver }) {
11635
- const { output, importPath, group, operations, paramsCasing, transformers } = options;
11627
+ Operations({ nodes, adapter, options, config, resolver, plugin }) {
11628
+ const { output, importPath, group, operations, paramsCasing } = options;
11636
11629
  if (!operations) return;
11637
11630
  const root = path$2.resolve(config.root, config.output.path);
11638
11631
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
@@ -11645,7 +11638,7 @@ const zodGeneratorLegacy = defineGenerator({
11645
11638
  group
11646
11639
  }) };
11647
11640
  const transformedOperations = nodes.map((node) => {
11648
- const transformedNode = transform(node, composeTransformers(...transformers));
11641
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
11649
11642
  return {
11650
11643
  node: transformedNode,
11651
11644
  data: buildLegacySchemaNames(transformedNode, caseParams(transformedNode.parameters, paramsCasing), resolver)
@@ -11702,44 +11695,42 @@ const zodGeneratorLegacy = defineGenerator({
11702
11695
  });
11703
11696
  }
11704
11697
  });
11705
- function toSchemaName(name, type) {
11706
- const resolved = camelCase$a(name, {
11707
- suffix: type ? "schema" : void 0,
11708
- isFile: type === "file"
11709
- });
11710
- if (type === "type") return pascalCase$6(resolved);
11711
- return resolved;
11712
- }
11713
11698
  const resolverZod = defineResolver(() => {
11714
11699
  return {
11715
11700
  name: "default",
11716
11701
  pluginName: "plugin-zod",
11717
11702
  default(name, type) {
11718
- return toSchemaName(name, type);
11703
+ return camelCase$a(name, {
11704
+ isFile: type === "file",
11705
+ suffix: type ? "schema" : void 0
11706
+ });
11719
11707
  },
11720
- resolveName(name) {
11721
- return this.default(name, "function");
11708
+ resolveSchemaName(name) {
11709
+ return camelCase$a(name, { suffix: "schema" });
11722
11710
  },
11723
- resolveInferName(name) {
11711
+ resolveSchemaTypeName(name) {
11712
+ return pascalCase$6(name, { suffix: "schema" });
11713
+ },
11714
+ resolveTypeName(name) {
11724
11715
  return pascalCase$6(name);
11725
11716
  },
11726
11717
  resolvePathName(name, type) {
11727
11718
  return this.default(name, type);
11728
11719
  },
11729
11720
  resolveParamName(node, param) {
11730
- return this.resolveName(`${node.operationId} ${param.in} ${param.name}`);
11721
+ return this.resolveSchemaName(`${node.operationId} ${param.in} ${param.name}`);
11731
11722
  },
11732
11723
  resolveResponseStatusName(node, statusCode) {
11733
- return this.resolveName(`${node.operationId} Status ${statusCode}`);
11724
+ return this.resolveSchemaName(`${node.operationId} Status ${statusCode}`);
11734
11725
  },
11735
11726
  resolveDataName(node) {
11736
- return this.resolveName(`${node.operationId} Data`);
11727
+ return this.resolveSchemaName(`${node.operationId} Data`);
11737
11728
  },
11738
11729
  resolveResponsesName(node) {
11739
- return this.resolveName(`${node.operationId} Responses`);
11730
+ return this.resolveSchemaName(`${node.operationId} Responses`);
11740
11731
  },
11741
11732
  resolveResponseName(node) {
11742
- return this.resolveName(`${node.operationId} Response`);
11733
+ return this.resolveSchemaName(`${node.operationId} Response`);
11743
11734
  },
11744
11735
  resolvePathParamsName(node, param) {
11745
11736
  return this.resolveParamName(node, param);
@@ -11757,42 +11748,44 @@ const resolverZodLegacy = defineResolver(() => {
11757
11748
  ...resolverZod,
11758
11749
  pluginName: "plugin-zod",
11759
11750
  resolveResponseStatusName(node, statusCode) {
11760
- if (statusCode === "default") return this.resolveName(`${node.operationId} Error`);
11761
- return this.resolveName(`${node.operationId} ${statusCode}`);
11751
+ if (statusCode === "default") return this.resolveSchemaName(`${node.operationId} Error`);
11752
+ return this.resolveSchemaName(`${node.operationId} ${statusCode}`);
11762
11753
  },
11763
11754
  resolveDataName(node) {
11764
11755
  const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
11765
- return this.resolveName(`${node.operationId} ${suffix}`);
11756
+ return this.resolveSchemaName(`${node.operationId} ${suffix}`);
11766
11757
  },
11767
11758
  resolveResponsesName(node) {
11768
11759
  const suffix = node.method === "GET" ? "Query" : "Mutation";
11769
- return this.resolveName(`${node.operationId} ${suffix}`);
11760
+ return this.resolveSchemaName(`${node.operationId} ${suffix}`);
11770
11761
  },
11771
11762
  resolveResponseName(node) {
11772
11763
  const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
11773
- return this.resolveName(`${node.operationId} ${suffix}`);
11764
+ return this.resolveSchemaName(`${node.operationId} ${suffix}`);
11774
11765
  },
11775
11766
  resolvePathParamsName(node, _param) {
11776
- return this.resolveName(`${node.operationId} PathParams`);
11767
+ return this.resolveSchemaName(`${node.operationId} PathParams`);
11777
11768
  },
11778
11769
  resolveQueryParamsName(node, _param) {
11779
- return this.resolveName(`${node.operationId} QueryParams`);
11770
+ return this.resolveSchemaName(`${node.operationId} QueryParams`);
11780
11771
  },
11781
11772
  resolveHeaderParamsName(node, _param) {
11782
- return this.resolveName(`${node.operationId} HeaderParams`);
11773
+ return this.resolveSchemaName(`${node.operationId} HeaderParams`);
11783
11774
  }
11784
11775
  };
11785
11776
  });
11786
- const presets$2 = definePresets({
11777
+ const presets$3 = definePresets({
11787
11778
  default: {
11788
11779
  name: "default",
11789
- resolvers: [resolverZod],
11790
- generators: [zodGenerator]
11780
+ resolver: resolverZod,
11781
+ generators: [zodGenerator],
11782
+ printer: printerZod
11791
11783
  },
11792
11784
  kubbV4: {
11793
11785
  name: "kubbV4",
11794
- resolvers: [resolverZodLegacy],
11795
- generators: [zodGeneratorLegacy]
11786
+ resolver: resolverZodLegacy,
11787
+ generators: [zodGeneratorLegacy],
11788
+ printer: printerZod
11796
11789
  }
11797
11790
  });
11798
11791
  const pluginZodName = "plugin-zod";
@@ -11800,12 +11793,12 @@ const pluginZod = createPlugin((options) => {
11800
11793
  const { output = {
11801
11794
  path: "zod",
11802
11795
  barrelType: "named"
11803
- }, group, exclude = [], include, override = [], dateType = "string", typed = false, operations = false, mini = false, guidType = "uuid", importPath = mini ? "zod/mini" : "zod", coercion = false, inferred = false, wrapOutput = void 0, paramsCasing, compatibilityPreset = "default", resolvers: userResolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = options;
11796
+ }, group, exclude = [], include, override = [], dateType = "string", typed = false, operations = false, mini = false, guidType = "uuid", importPath = mini ? "zod/mini" : "zod", coercion = false, inferred = false, wrapOutput = void 0, paramsCasing, printer, compatibilityPreset = "default", resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
11804
11797
  const preset = getPreset({
11805
11798
  preset: compatibilityPreset,
11806
- presets: presets$2,
11807
- resolvers: userResolvers,
11808
- transformers: userTransformers,
11799
+ presets: presets$3,
11800
+ resolver: userResolver,
11801
+ transformer: userTransformer,
11809
11802
  generators: userGenerators
11810
11803
  });
11811
11804
  let resolveNameWarning = false;
@@ -11815,6 +11808,9 @@ const pluginZod = createPlugin((options) => {
11815
11808
  get resolver() {
11816
11809
  return preset.resolver;
11817
11810
  },
11811
+ get transformer() {
11812
+ return preset.transformer;
11813
+ },
11818
11814
  get options() {
11819
11815
  return {
11820
11816
  output,
@@ -11835,7 +11831,7 @@ const pluginZod = createPlugin((options) => {
11835
11831
  mini,
11836
11832
  wrapOutput,
11837
11833
  paramsCasing,
11838
- transformers: preset.transformers
11834
+ printer
11839
11835
  };
11840
11836
  },
11841
11837
  resolvePath(baseName, pathMode, options2) {
@@ -210411,284 +210407,12 @@ function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }) {
210411
210407
  children: safePrint(typeNode)
210412
210408
  })] });
210413
210409
  }
210414
- function buildPropertyJSDocComments(schema) {
210415
- const meta = syncSchemaRef(schema);
210416
- const isArray = (meta == null ? void 0 : meta.primitive) === "array";
210417
- return [
210418
- meta && "description" in meta && meta.description ? `@description ${jsStringEscape$1(meta.description)}` : void 0,
210419
- meta && "deprecated" in meta && meta.deprecated ? "@deprecated" : void 0,
210420
- !isArray && meta && "min" in meta && meta.min !== void 0 ? `@minLength ${meta.min}` : void 0,
210421
- !isArray && meta && "max" in meta && meta.max !== void 0 ? `@maxLength ${meta.max}` : void 0,
210422
- meta && "pattern" in meta && meta.pattern ? `@pattern ${meta.pattern}` : void 0,
210423
- meta && "default" in meta && meta.default !== void 0 ? `@default ${"primitive" in meta && meta.primitive === "string" ? stringify$1(meta.default) : meta.default}` : void 0,
210424
- meta && "example" in meta && meta.example !== void 0 ? `@example ${meta.example}` : void 0,
210425
- meta && "primitive" in meta && meta.primitive ? [`@type ${meta.primitive}`, "optional" in schema && schema.optional ? " | undefined" : void 0].filter(Boolean).join("") : void 0
210426
- ].filter(Boolean);
210427
- }
210428
- function buildParams(node, { params, resolver }) {
210429
- return createSchema({
210430
- type: "object",
210431
- properties: params.map((param) => createProperty({
210432
- name: param.name,
210433
- required: param.required,
210434
- schema: createSchema({
210435
- type: "ref",
210436
- name: resolver.resolveParamName(node, param)
210437
- })
210438
- }))
210439
- });
210440
- }
210441
- function buildData(node, { resolver }) {
210442
- var _a;
210443
- const pathParams = node.parameters.filter((p) => p.in === "path");
210444
- const queryParams = node.parameters.filter((p) => p.in === "query");
210445
- const headerParams = node.parameters.filter((p) => p.in === "header");
210446
- return createSchema({
210447
- type: "object",
210448
- deprecated: node.deprecated,
210449
- properties: [
210450
- createProperty({
210451
- name: "data",
210452
- schema: ((_a = node.requestBody) == null ? void 0 : _a.schema) ? createSchema({
210453
- type: "ref",
210454
- name: resolver.resolveDataName(node),
210455
- optional: true
210456
- }) : createSchema({
210457
- type: "never",
210458
- primitive: void 0,
210459
- optional: true
210460
- })
210461
- }),
210462
- createProperty({
210463
- name: "pathParams",
210464
- required: pathParams.length > 0,
210465
- schema: pathParams.length > 0 ? buildParams(node, {
210466
- params: pathParams,
210467
- resolver
210468
- }) : createSchema({
210469
- type: "never",
210470
- primitive: void 0
210471
- })
210472
- }),
210473
- createProperty({
210474
- name: "queryParams",
210475
- schema: queryParams.length > 0 ? createSchema({
210476
- ...buildParams(node, {
210477
- params: queryParams,
210478
- resolver
210479
- }),
210480
- optional: true
210481
- }) : createSchema({
210482
- type: "never",
210483
- primitive: void 0,
210484
- optional: true
210485
- })
210486
- }),
210487
- createProperty({
210488
- name: "headerParams",
210489
- schema: headerParams.length > 0 ? createSchema({
210490
- ...buildParams(node, {
210491
- params: headerParams,
210492
- resolver
210493
- }),
210494
- optional: true
210495
- }) : createSchema({
210496
- type: "never",
210497
- primitive: void 0,
210498
- optional: true
210499
- })
210500
- }),
210501
- createProperty({
210502
- name: "url",
210503
- required: true,
210504
- schema: createSchema({
210505
- type: "url",
210506
- path: node.path
210507
- })
210508
- })
210509
- ]
210510
- });
210511
- }
210512
- function buildResponses(node, { resolver }) {
210513
- if (node.responses.length === 0) return null;
210514
- return createSchema({
210515
- type: "object",
210516
- properties: node.responses.map((res) => createProperty({
210517
- name: String(res.statusCode),
210518
- required: true,
210519
- schema: createSchema({
210520
- type: "ref",
210521
- name: resolver.resolveResponseStatusName(node, res.statusCode)
210522
- })
210523
- }))
210524
- });
210525
- }
210526
- function buildResponseUnion(node, { resolver }) {
210527
- const responsesWithSchema = node.responses.filter((res) => res.schema);
210528
- if (responsesWithSchema.length === 0) return null;
210529
- return createSchema({
210530
- type: "union",
210531
- members: responsesWithSchema.map((res) => createSchema({
210532
- type: "ref",
210533
- name: resolver.resolveResponseStatusName(node, res.statusCode)
210534
- }))
210535
- });
210536
- }
210537
- const printerTs = definePrinter((options) => {
210538
- const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(options.optionalType);
210539
- return {
210540
- name: "typescript",
210541
- options,
210542
- nodes: {
210543
- any: () => keywordTypeNodes.any,
210544
- unknown: () => keywordTypeNodes.unknown,
210545
- void: () => keywordTypeNodes.void,
210546
- never: () => keywordTypeNodes.never,
210547
- boolean: () => keywordTypeNodes.boolean,
210548
- null: () => keywordTypeNodes.null,
210549
- blob: () => createTypeReferenceNode("Blob", []),
210550
- string: () => keywordTypeNodes.string,
210551
- uuid: () => keywordTypeNodes.string,
210552
- email: () => keywordTypeNodes.string,
210553
- url: (node) => {
210554
- if (node.path) return createUrlTemplateType(node.path);
210555
- return keywordTypeNodes.string;
210556
- },
210557
- ipv4: () => keywordTypeNodes.string,
210558
- ipv6: () => keywordTypeNodes.string,
210559
- datetime: () => keywordTypeNodes.string,
210560
- number: () => keywordTypeNodes.number,
210561
- integer: () => keywordTypeNodes.number,
210562
- bigint: () => keywordTypeNodes.bigint,
210563
- date: dateOrStringNode,
210564
- time: dateOrStringNode,
210565
- ref(node) {
210566
- var _a, _b;
210567
- if (!node.name) return;
210568
- const refName = node.ref ? (_a = extractRefName(node.ref)) != null ? _a : node.name : node.name;
210569
- return createTypeReferenceNode(node.ref && ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix && ((_b = this.options.enumSchemaNames) == null ? void 0 : _b.has(refName)) ? this.options.resolver.resolveEnumKeyName({ name: refName }, this.options.enumTypeSuffix) : node.ref ? this.options.resolver.default(refName, "type") : refName, void 0);
210570
- },
210571
- enum(node) {
210572
- var _a, _b, _c, _d;
210573
- const values = (_c = (_b = (_a = node.namedEnumValues) == null ? void 0 : _a.map((v) => v.value)) != null ? _b : node.enumValues) != null ? _c : [];
210574
- if (this.options.enumType === "inlineLiteral" || !node.name) return (_d = createUnionDeclaration({
210575
- withParentheses: true,
210576
- nodes: values.filter((v) => v !== null && v !== void 0).map((value) => constToTypeNode(value, typeof value)).filter(Boolean)
210577
- })) != null ? _d : void 0;
210578
- return createTypeReferenceNode(ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix ? this.options.resolver.resolveEnumKeyName(node, this.options.enumTypeSuffix) : this.options.resolver.default(node.name, "type"), void 0);
210579
- },
210580
- union(node) {
210581
- var _a, _b, _c;
210582
- const members = (_a = node.members) != null ? _a : [];
210583
- const hasStringLiteral = members.some((m) => {
210584
- var _a2;
210585
- return ((_a2 = narrowSchema(m, schemaTypes.enum)) == null ? void 0 : _a2.primitive) === "string";
210586
- });
210587
- const hasPlainString = members.some((m) => isStringType(m));
210588
- if (hasStringLiteral && hasPlainString) return (_b = createUnionDeclaration({
210589
- withParentheses: true,
210590
- nodes: members.map((m) => {
210591
- if (isStringType(m)) return createIntersectionDeclaration({
210592
- nodes: [keywordTypeNodes.string, createTypeLiteralNode([])],
210593
- withParentheses: true
210594
- });
210595
- return this.transform(m);
210596
- }).filter(Boolean)
210597
- })) != null ? _b : void 0;
210598
- return (_c = createUnionDeclaration({
210599
- withParentheses: true,
210600
- nodes: buildMemberNodes(members, this.transform)
210601
- })) != null ? _c : void 0;
210602
- },
210603
- intersection(node) {
210604
- var _a;
210605
- return (_a = createIntersectionDeclaration({
210606
- withParentheses: true,
210607
- nodes: buildMemberNodes(node.members, this.transform)
210608
- })) != null ? _a : void 0;
210609
- },
210610
- array(node) {
210611
- var _a, _b;
210612
- return (_b = createArrayDeclaration({
210613
- nodes: ((_a = node.items) != null ? _a : []).map((item) => this.transform(item)).filter(Boolean),
210614
- arrayType: this.options.arrayType
210615
- })) != null ? _b : void 0;
210616
- },
210617
- tuple(node) {
210618
- return buildTupleNode(node, this.transform);
210619
- },
210620
- object(node) {
210621
- const { transform: transform2, options: options2 } = this;
210622
- const addsQuestionToken = OPTIONAL_ADDS_QUESTION_TOKEN.has(options2.optionalType);
210623
- const propertyNodes = node.properties.map((prop) => {
210624
- var _a;
210625
- const baseType = (_a = transform2(prop.schema)) != null ? _a : keywordTypeNodes.unknown;
210626
- const type = buildPropertyType(prop.schema, baseType, options2.optionalType);
210627
- const propMeta = syncSchemaRef(prop.schema);
210628
- return appendJSDocToNode({
210629
- node: createPropertySignature({
210630
- questionToken: prop.schema.optional || prop.schema.nullish ? addsQuestionToken : false,
210631
- name: prop.name,
210632
- type,
210633
- readOnly: propMeta == null ? void 0 : propMeta.readOnly
210634
- }),
210635
- comments: buildPropertyJSDocComments(prop.schema)
210636
- });
210637
- });
210638
- const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, transform2)];
210639
- if (!allElements.length) return keywordTypeNodes.object;
210640
- return createTypeLiteralNode(allElements);
210641
- }
210642
- },
210643
- print(node) {
210644
- const { name, syntaxType = "type", description, keysToOmit } = this.options;
210645
- let base = this.transform(node);
210646
- if (!base) return null;
210647
- const meta = syncSchemaRef(node);
210648
- if (!name) {
210649
- if (meta.nullable) base = createUnionDeclaration({ nodes: [base, keywordTypeNodes.null] });
210650
- if ((meta.nullish || meta.optional) && addsUndefined) base = createUnionDeclaration({ nodes: [base, keywordTypeNodes.undefined] });
210651
- return safePrint(base);
210652
- }
210653
- let inner = (keysToOmit == null ? void 0 : keysToOmit.length) ? createOmitDeclaration({
210654
- keys: keysToOmit,
210655
- type: base,
210656
- nonNullable: true
210657
- }) : base;
210658
- if (meta.nullable) inner = createUnionDeclaration({ nodes: [inner, keywordTypeNodes.null] });
210659
- if (meta.nullish || meta.optional) inner = createUnionDeclaration({ nodes: [inner, keywordTypeNodes.undefined] });
210660
- const useTypeGeneration = syntaxType === "type" || inner.kind === syntaxKind.union || !!(keysToOmit == null ? void 0 : keysToOmit.length);
210661
- return safePrint(createTypeDeclaration({
210662
- name,
210663
- isExportable: true,
210664
- type: inner,
210665
- syntax: useTypeGeneration ? "type" : "interface",
210666
- comments: buildPropertyJSDocComments({
210667
- ...meta,
210668
- description
210669
- })
210670
- }));
210671
- }
210672
- };
210673
- });
210674
- function Type({ name, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumTypeSuffix, enumKeyCasing, description, resolver, enumSchemaNames }) {
210675
- const resolvedDescription = description || (node == null ? void 0 : node.description);
210410
+ function Type({ name, node, printer, enumType, enumTypeSuffix, enumKeyCasing, resolver }) {
210676
210411
  const enumSchemaNodes = collect(node, { schema(n) {
210677
210412
  const enumNode = narrowSchema(n, schemaTypes.enum);
210678
210413
  if (enumNode == null ? void 0 : enumNode.name) return enumNode;
210679
210414
  } });
210680
- const output = printerTs({
210681
- optionalType,
210682
- arrayType,
210683
- enumType,
210684
- enumTypeSuffix,
210685
- name,
210686
- syntaxType,
210687
- description: resolvedDescription,
210688
- keysToOmit,
210689
- resolver,
210690
- enumSchemaNames
210691
- }).print(node);
210415
+ const output = printer.print(node);
210692
210416
  if (!output) return;
210693
210417
  const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node2) => {
210694
210418
  return {
@@ -210717,20 +210441,281 @@ function Type({ name, node, keysToOmit, optionalType, arrayType, syntaxType, enu
210717
210441
  children: output
210718
210442
  })] });
210719
210443
  }
210444
+ function buildPropertyJSDocComments(schema) {
210445
+ const meta = syncSchemaRef(schema);
210446
+ const isArray = (meta == null ? void 0 : meta.primitive) === "array";
210447
+ return [
210448
+ meta && "description" in meta && meta.description ? `@description ${jsStringEscape$1(meta.description)}` : void 0,
210449
+ meta && "deprecated" in meta && meta.deprecated ? "@deprecated" : void 0,
210450
+ !isArray && meta && "min" in meta && meta.min !== void 0 ? `@minLength ${meta.min}` : void 0,
210451
+ !isArray && meta && "max" in meta && meta.max !== void 0 ? `@maxLength ${meta.max}` : void 0,
210452
+ meta && "pattern" in meta && meta.pattern ? `@pattern ${meta.pattern}` : void 0,
210453
+ meta && "default" in meta && meta.default !== void 0 ? `@default ${"primitive" in meta && meta.primitive === "string" ? stringify$1(meta.default) : meta.default}` : void 0,
210454
+ meta && "example" in meta && meta.example !== void 0 ? `@example ${meta.example}` : void 0,
210455
+ meta && "primitive" in meta && meta.primitive ? [`@type ${meta.primitive}`, "optional" in schema && schema.optional ? " | undefined" : void 0].filter(Boolean).join("") : void 0
210456
+ ].filter(Boolean);
210457
+ }
210458
+ function buildParams(node, { params, resolver }) {
210459
+ return createSchema({
210460
+ type: "object",
210461
+ properties: params.map((param) => createProperty({
210462
+ name: param.name,
210463
+ required: param.required,
210464
+ schema: createSchema({
210465
+ type: "ref",
210466
+ name: resolver.resolveParamName(node, param)
210467
+ })
210468
+ }))
210469
+ });
210470
+ }
210471
+ function buildData(node, { resolver }) {
210472
+ var _a;
210473
+ const pathParams = node.parameters.filter((p) => p.in === "path");
210474
+ const queryParams = node.parameters.filter((p) => p.in === "query");
210475
+ const headerParams = node.parameters.filter((p) => p.in === "header");
210476
+ return createSchema({
210477
+ type: "object",
210478
+ deprecated: node.deprecated,
210479
+ properties: [
210480
+ createProperty({
210481
+ name: "data",
210482
+ schema: ((_a = node.requestBody) == null ? void 0 : _a.schema) ? createSchema({
210483
+ type: "ref",
210484
+ name: resolver.resolveDataName(node),
210485
+ optional: true
210486
+ }) : createSchema({
210487
+ type: "never",
210488
+ primitive: void 0,
210489
+ optional: true
210490
+ })
210491
+ }),
210492
+ createProperty({
210493
+ name: "pathParams",
210494
+ required: pathParams.length > 0,
210495
+ schema: pathParams.length > 0 ? buildParams(node, {
210496
+ params: pathParams,
210497
+ resolver
210498
+ }) : createSchema({
210499
+ type: "never",
210500
+ primitive: void 0
210501
+ })
210502
+ }),
210503
+ createProperty({
210504
+ name: "queryParams",
210505
+ schema: queryParams.length > 0 ? createSchema({
210506
+ ...buildParams(node, {
210507
+ params: queryParams,
210508
+ resolver
210509
+ }),
210510
+ optional: true
210511
+ }) : createSchema({
210512
+ type: "never",
210513
+ primitive: void 0,
210514
+ optional: true
210515
+ })
210516
+ }),
210517
+ createProperty({
210518
+ name: "headerParams",
210519
+ schema: headerParams.length > 0 ? createSchema({
210520
+ ...buildParams(node, {
210521
+ params: headerParams,
210522
+ resolver
210523
+ }),
210524
+ optional: true
210525
+ }) : createSchema({
210526
+ type: "never",
210527
+ primitive: void 0,
210528
+ optional: true
210529
+ })
210530
+ }),
210531
+ createProperty({
210532
+ name: "url",
210533
+ required: true,
210534
+ schema: createSchema({
210535
+ type: "url",
210536
+ path: node.path
210537
+ })
210538
+ })
210539
+ ]
210540
+ });
210541
+ }
210542
+ function buildResponses(node, { resolver }) {
210543
+ if (node.responses.length === 0) return null;
210544
+ return createSchema({
210545
+ type: "object",
210546
+ properties: node.responses.map((res) => createProperty({
210547
+ name: String(res.statusCode),
210548
+ required: true,
210549
+ schema: createSchema({
210550
+ type: "ref",
210551
+ name: resolver.resolveResponseStatusName(node, res.statusCode)
210552
+ })
210553
+ }))
210554
+ });
210555
+ }
210556
+ function buildResponseUnion(node, { resolver }) {
210557
+ const responsesWithSchema = node.responses.filter((res) => res.schema);
210558
+ if (responsesWithSchema.length === 0) return null;
210559
+ return createSchema({
210560
+ type: "union",
210561
+ members: responsesWithSchema.map((res) => createSchema({
210562
+ type: "ref",
210563
+ name: resolver.resolveResponseStatusName(node, res.statusCode)
210564
+ }))
210565
+ });
210566
+ }
210567
+ const printerTs = definePrinter((options) => {
210568
+ const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(options.optionalType);
210569
+ return {
210570
+ name: "typescript",
210571
+ options,
210572
+ nodes: {
210573
+ any: () => keywordTypeNodes.any,
210574
+ unknown: () => keywordTypeNodes.unknown,
210575
+ void: () => keywordTypeNodes.void,
210576
+ never: () => keywordTypeNodes.never,
210577
+ boolean: () => keywordTypeNodes.boolean,
210578
+ null: () => keywordTypeNodes.null,
210579
+ blob: () => createTypeReferenceNode("Blob", []),
210580
+ string: () => keywordTypeNodes.string,
210581
+ uuid: () => keywordTypeNodes.string,
210582
+ email: () => keywordTypeNodes.string,
210583
+ url: (node) => {
210584
+ if (node.path) return createUrlTemplateType(node.path);
210585
+ return keywordTypeNodes.string;
210586
+ },
210587
+ ipv4: () => keywordTypeNodes.string,
210588
+ ipv6: () => keywordTypeNodes.string,
210589
+ datetime: () => keywordTypeNodes.string,
210590
+ number: () => keywordTypeNodes.number,
210591
+ integer: () => keywordTypeNodes.number,
210592
+ bigint: () => keywordTypeNodes.bigint,
210593
+ date: dateOrStringNode,
210594
+ time: dateOrStringNode,
210595
+ ref(node) {
210596
+ var _a, _b;
210597
+ if (!node.name) return;
210598
+ const refName = node.ref ? (_a = extractRefName(node.ref)) != null ? _a : node.name : node.name;
210599
+ return createTypeReferenceNode(node.ref && ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix && ((_b = this.options.enumSchemaNames) == null ? void 0 : _b.has(refName)) ? this.options.resolver.resolveEnumKeyName({ name: refName }, this.options.enumTypeSuffix) : node.ref ? this.options.resolver.default(refName, "type") : refName, void 0);
210600
+ },
210601
+ enum(node) {
210602
+ var _a, _b, _c, _d;
210603
+ const values = (_c = (_b = (_a = node.namedEnumValues) == null ? void 0 : _a.map((v) => v.value)) != null ? _b : node.enumValues) != null ? _c : [];
210604
+ if (this.options.enumType === "inlineLiteral" || !node.name) return (_d = createUnionDeclaration({
210605
+ withParentheses: true,
210606
+ nodes: values.filter((v) => v !== null && v !== void 0).map((value) => constToTypeNode(value, typeof value)).filter(Boolean)
210607
+ })) != null ? _d : void 0;
210608
+ return createTypeReferenceNode(ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix ? this.options.resolver.resolveEnumKeyName(node, this.options.enumTypeSuffix) : this.options.resolver.default(node.name, "type"), void 0);
210609
+ },
210610
+ union(node) {
210611
+ var _a, _b, _c;
210612
+ const members = (_a = node.members) != null ? _a : [];
210613
+ const hasStringLiteral = members.some((m) => {
210614
+ var _a2;
210615
+ return ((_a2 = narrowSchema(m, schemaTypes.enum)) == null ? void 0 : _a2.primitive) === "string";
210616
+ });
210617
+ const hasPlainString = members.some((m) => isStringType(m));
210618
+ if (hasStringLiteral && hasPlainString) return (_b = createUnionDeclaration({
210619
+ withParentheses: true,
210620
+ nodes: members.map((m) => {
210621
+ if (isStringType(m)) return createIntersectionDeclaration({
210622
+ nodes: [keywordTypeNodes.string, createTypeLiteralNode([])],
210623
+ withParentheses: true
210624
+ });
210625
+ return this.transform(m);
210626
+ }).filter(Boolean)
210627
+ })) != null ? _b : void 0;
210628
+ return (_c = createUnionDeclaration({
210629
+ withParentheses: true,
210630
+ nodes: buildMemberNodes(members, this.transform)
210631
+ })) != null ? _c : void 0;
210632
+ },
210633
+ intersection(node) {
210634
+ var _a;
210635
+ return (_a = createIntersectionDeclaration({
210636
+ withParentheses: true,
210637
+ nodes: buildMemberNodes(node.members, this.transform)
210638
+ })) != null ? _a : void 0;
210639
+ },
210640
+ array(node) {
210641
+ var _a, _b;
210642
+ return (_b = createArrayDeclaration({
210643
+ nodes: ((_a = node.items) != null ? _a : []).map((item) => this.transform(item)).filter(Boolean),
210644
+ arrayType: this.options.arrayType
210645
+ })) != null ? _b : void 0;
210646
+ },
210647
+ tuple(node) {
210648
+ return buildTupleNode(node, this.transform);
210649
+ },
210650
+ object(node) {
210651
+ const { transform: transform2, options: options2 } = this;
210652
+ const addsQuestionToken = OPTIONAL_ADDS_QUESTION_TOKEN.has(options2.optionalType);
210653
+ const propertyNodes = node.properties.map((prop) => {
210654
+ var _a;
210655
+ const baseType = (_a = transform2(prop.schema)) != null ? _a : keywordTypeNodes.unknown;
210656
+ const type = buildPropertyType(prop.schema, baseType, options2.optionalType);
210657
+ const propMeta = syncSchemaRef(prop.schema);
210658
+ return appendJSDocToNode({
210659
+ node: createPropertySignature({
210660
+ questionToken: prop.schema.optional || prop.schema.nullish ? addsQuestionToken : false,
210661
+ name: prop.name,
210662
+ type,
210663
+ readOnly: propMeta == null ? void 0 : propMeta.readOnly
210664
+ }),
210665
+ comments: buildPropertyJSDocComments(prop.schema)
210666
+ });
210667
+ });
210668
+ const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, transform2)];
210669
+ if (!allElements.length) return keywordTypeNodes.object;
210670
+ return createTypeLiteralNode(allElements);
210671
+ },
210672
+ ...options.nodes
210673
+ },
210674
+ print(node) {
210675
+ const { name, syntaxType = "type", description, keysToOmit } = this.options;
210676
+ let base = this.transform(node);
210677
+ if (!base) return null;
210678
+ const meta = syncSchemaRef(node);
210679
+ if (!name) {
210680
+ if (meta.nullable) base = createUnionDeclaration({ nodes: [base, keywordTypeNodes.null] });
210681
+ if ((meta.nullish || meta.optional) && addsUndefined) base = createUnionDeclaration({ nodes: [base, keywordTypeNodes.undefined] });
210682
+ return safePrint(base);
210683
+ }
210684
+ let inner = (keysToOmit == null ? void 0 : keysToOmit.length) ? createOmitDeclaration({
210685
+ keys: keysToOmit,
210686
+ type: base,
210687
+ nonNullable: true
210688
+ }) : base;
210689
+ if (meta.nullable) inner = createUnionDeclaration({ nodes: [inner, keywordTypeNodes.null] });
210690
+ if (meta.nullish || meta.optional) inner = createUnionDeclaration({ nodes: [inner, keywordTypeNodes.undefined] });
210691
+ const useTypeGeneration = syntaxType === "type" || inner.kind === syntaxKind.union || !!(keysToOmit == null ? void 0 : keysToOmit.length);
210692
+ return safePrint(createTypeDeclaration({
210693
+ name,
210694
+ isExportable: true,
210695
+ type: inner,
210696
+ syntax: useTypeGeneration ? "type" : "interface",
210697
+ comments: buildPropertyJSDocComments({
210698
+ ...meta,
210699
+ description
210700
+ })
210701
+ }));
210702
+ }
210703
+ };
210704
+ });
210720
210705
  const typeGenerator = defineGenerator({
210721
210706
  name: "typescript",
210722
210707
  type: "react",
210723
- Schema({ node, adapter, options, config, resolver }) {
210708
+ Schema({ node, adapter, options, config, resolver, plugin }) {
210724
210709
  var _a, _b;
210725
- const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, transformers = [] } = options;
210726
- const transformedNode = transform(node, composeTransformers(...transformers));
210710
+ const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, printer } = options;
210711
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
210727
210712
  if (!transformedNode.name) return;
210728
210713
  const root = path$2.resolve(config.root, config.output.path);
210729
210714
  const mode = getMode(path$2.resolve(root, output.path));
210730
210715
  const enumSchemaNames = new Set(((_b = (_a = adapter.rootNode) == null ? void 0 : _a.schemas) != null ? _b : []).filter((s) => narrowSchema(s, schemaTypes.enum) && s.name).map((s) => s.name));
210731
210716
  function resolveImportName(schemaName) {
210732
210717
  if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && enumTypeSuffix && enumSchemaNames.has(schemaName)) return resolver.resolveEnumKeyName({ name: schemaName }, enumTypeSuffix);
210733
- return resolver.default(schemaName, "type");
210718
+ return resolver.resolveTypeName(schemaName);
210734
210719
  }
210735
210720
  const imports = adapter.getImports(transformedNode, (schemaName) => ({
210736
210721
  name: resolveImportName(schemaName),
@@ -210745,7 +210730,7 @@ const typeGenerator = defineGenerator({
210745
210730
  }));
210746
210731
  const isEnumSchema = !!narrowSchema(transformedNode, schemaTypes.enum);
210747
210732
  const meta = {
210748
- name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyName(transformedNode, enumTypeSuffix) : resolver.resolveName(transformedNode.name),
210733
+ name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyName(transformedNode, enumTypeSuffix) : resolver.resolveTypeName(transformedNode.name),
210749
210734
  file: resolver.resolveFile({
210750
210735
  name: transformedNode.name,
210751
210736
  extname: ".ts"
@@ -210755,6 +210740,18 @@ const typeGenerator = defineGenerator({
210755
210740
  group
210756
210741
  })
210757
210742
  };
210743
+ const schemaPrinter = printerTs({
210744
+ optionalType,
210745
+ arrayType,
210746
+ enumType,
210747
+ enumTypeSuffix,
210748
+ name: meta.name,
210749
+ syntaxType,
210750
+ description: transformedNode.description,
210751
+ resolver,
210752
+ enumSchemaNames,
210753
+ nodes: printer == null ? void 0 : printer.nodes
210754
+ });
210758
210755
  return /* @__PURE__ */ jsxs(File, {
210759
210756
  baseName: meta.file.baseName,
210760
210757
  path: meta.file.path,
@@ -210782,18 +210779,15 @@ const typeGenerator = defineGenerator({
210782
210779
  enumType,
210783
210780
  enumTypeSuffix,
210784
210781
  enumKeyCasing,
210785
- optionalType,
210786
- arrayType,
210787
- syntaxType,
210788
210782
  resolver,
210789
- enumSchemaNames
210783
+ printer: schemaPrinter
210790
210784
  })]
210791
210785
  });
210792
210786
  },
210793
- Operation({ node, adapter, options, config, resolver }) {
210787
+ Operation({ node, adapter, options, config, resolver, plugin }) {
210794
210788
  var _a, _b, _c, _d, _e;
210795
- const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, transformers = [] } = options;
210796
- const transformedNode = transform(node, composeTransformers(...transformers));
210789
+ const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, printer } = options;
210790
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
210797
210791
  const root = path$2.resolve(config.root, config.output.path);
210798
210792
  const mode = getMode(path$2.resolve(root, output.path));
210799
210793
  const params = caseParams(transformedNode.parameters, paramsCasing);
@@ -210810,7 +210804,7 @@ const typeGenerator = defineGenerator({
210810
210804
  const enumSchemaNames = new Set(((_c = (_b = adapter.rootNode) == null ? void 0 : _b.schemas) != null ? _c : []).filter((s) => narrowSchema(s, schemaTypes.enum) && s.name).map((s) => s.name));
210811
210805
  function resolveImportName(schemaName) {
210812
210806
  if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && enumTypeSuffix && enumSchemaNames.has(schemaName)) return resolver.resolveEnumKeyName({ name: schemaName }, enumTypeSuffix);
210813
- return resolver.default(schemaName, "type");
210807
+ return resolver.resolveTypeName(schemaName);
210814
210808
  }
210815
210809
  function renderSchemaType({ schema, name, keysToOmit }) {
210816
210810
  if (!schema) return null;
@@ -210825,6 +210819,19 @@ const typeGenerator = defineGenerator({
210825
210819
  group
210826
210820
  }).path
210827
210821
  }));
210822
+ const schemaPrinter = printerTs({
210823
+ optionalType,
210824
+ arrayType,
210825
+ enumType,
210826
+ enumTypeSuffix,
210827
+ name,
210828
+ syntaxType,
210829
+ description: schema.description,
210830
+ keysToOmit,
210831
+ resolver,
210832
+ enumSchemaNames,
210833
+ nodes: printer == null ? void 0 : printer.nodes
210834
+ });
210828
210835
  return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
210829
210836
  root: meta.file.path,
210830
210837
  path: imp.path,
@@ -210840,12 +210847,8 @@ const typeGenerator = defineGenerator({
210840
210847
  enumType,
210841
210848
  enumTypeSuffix,
210842
210849
  enumKeyCasing,
210843
- optionalType,
210844
- arrayType,
210845
- syntaxType,
210846
210850
  resolver,
210847
- keysToOmit,
210848
- enumSchemaNames
210851
+ printer: schemaPrinter
210849
210852
  })] });
210850
210853
  }
210851
210854
  const paramTypes = params.map((param) => renderSchemaType({
@@ -210906,43 +210909,40 @@ const typeGenerator = defineGenerator({
210906
210909
  });
210907
210910
  }
210908
210911
  });
210909
- function toTypeName(name, type) {
210910
- return pascalCase$5(name, { isFile: type === "file" });
210911
- }
210912
210912
  const resolverTs = defineResolver(() => {
210913
210913
  return {
210914
210914
  name: "default",
210915
210915
  pluginName: "plugin-ts",
210916
210916
  default(name, type) {
210917
- return toTypeName(name, type);
210917
+ return pascalCase$5(name, { isFile: type === "file" });
210918
210918
  },
210919
- resolveName(name) {
210920
- return this.default(name, "function");
210919
+ resolveTypeName(name) {
210920
+ return pascalCase$5(name);
210921
210921
  },
210922
210922
  resolvePathName(name, type) {
210923
- return this.default(name, type);
210923
+ return pascalCase$5(name, { isFile: type === "file" });
210924
210924
  },
210925
210925
  resolveParamName(node, param) {
210926
- return this.resolveName(`${node.operationId} ${param.in} ${param.name}`);
210926
+ return this.resolveTypeName(`${node.operationId} ${param.in} ${param.name}`);
210927
210927
  },
210928
210928
  resolveResponseStatusName(node, statusCode) {
210929
- return this.resolveName(`${node.operationId} Status ${statusCode}`);
210929
+ return this.resolveTypeName(`${node.operationId} Status ${statusCode}`);
210930
210930
  },
210931
210931
  resolveDataName(node) {
210932
- return this.resolveName(`${node.operationId} Data`);
210932
+ return this.resolveTypeName(`${node.operationId} Data`);
210933
210933
  },
210934
210934
  resolveRequestConfigName(node) {
210935
- return this.resolveName(`${node.operationId} RequestConfig`);
210935
+ return this.resolveTypeName(`${node.operationId} RequestConfig`);
210936
210936
  },
210937
210937
  resolveResponsesName(node) {
210938
- return this.resolveName(`${node.operationId} Responses`);
210938
+ return this.resolveTypeName(`${node.operationId} Responses`);
210939
210939
  },
210940
210940
  resolveResponseName(node) {
210941
- return this.resolveName(`${node.operationId} Response`);
210941
+ return this.resolveTypeName(`${node.operationId} Response`);
210942
210942
  },
210943
210943
  resolveEnumKeyName(node, enumTypeSuffix = "key") {
210944
210944
  var _a;
210945
- return `${this.resolveName((_a = node.name) != null ? _a : "")}${enumTypeSuffix}`;
210945
+ return `${this.resolveTypeName((_a = node.name) != null ? _a : "")}${enumTypeSuffix}`;
210946
210946
  },
210947
210947
  resolvePathParamsName(node, param) {
210948
210948
  return this.resolveParamName(node, param);
@@ -210960,29 +210960,29 @@ const resolverTsLegacy = defineResolver(() => {
210960
210960
  ...resolverTs,
210961
210961
  pluginName: "plugin-ts",
210962
210962
  resolveResponseStatusName(node, statusCode) {
210963
- if (statusCode === "default") return this.resolveName(`${node.operationId} Error`);
210964
- return this.resolveName(`${node.operationId} ${statusCode}`);
210963
+ if (statusCode === "default") return this.resolveTypeName(`${node.operationId} Error`);
210964
+ return this.resolveTypeName(`${node.operationId} ${statusCode}`);
210965
210965
  },
210966
210966
  resolveDataName(node) {
210967
210967
  const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
210968
- return this.resolveName(`${node.operationId} ${suffix}`);
210968
+ return this.resolveTypeName(`${node.operationId} ${suffix}`);
210969
210969
  },
210970
210970
  resolveResponsesName(node) {
210971
210971
  const suffix = node.method === "GET" ? "Query" : "Mutation";
210972
- return this.resolveName(`${node.operationId} ${suffix}`);
210972
+ return this.resolveTypeName(`${node.operationId} ${suffix}`);
210973
210973
  },
210974
210974
  resolveResponseName(node) {
210975
210975
  const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
210976
- return this.resolveName(`${node.operationId} ${suffix}`);
210976
+ return this.resolveTypeName(`${node.operationId} ${suffix}`);
210977
210977
  },
210978
210978
  resolvePathParamsName(node, _param) {
210979
- return this.resolveName(`${node.operationId} PathParams`);
210979
+ return this.resolveTypeName(`${node.operationId} PathParams`);
210980
210980
  },
210981
210981
  resolveQueryParamsName(node, _param) {
210982
- return this.resolveName(`${node.operationId} QueryParams`);
210982
+ return this.resolveTypeName(`${node.operationId} QueryParams`);
210983
210983
  },
210984
210984
  resolveHeaderParamsName(node, _param) {
210985
- return this.resolveName(`${node.operationId} HeaderParams`);
210985
+ return this.resolveTypeName(`${node.operationId} HeaderParams`);
210986
210986
  }
210987
210987
  };
210988
210988
  });
@@ -211140,14 +211140,14 @@ function nameUnnamedEnums(node, parentName) {
211140
211140
  const typeGeneratorLegacy = defineGenerator({
211141
211141
  name: "typescript-legacy",
211142
211142
  type: "react",
211143
- Schema({ node, adapter, options, config, resolver }) {
211144
- const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, transformers = [] } = options;
211145
- const transformedNode = transform(node, composeTransformers(...transformers));
211143
+ Schema({ node, adapter, options, config, resolver, plugin }) {
211144
+ const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group } = options;
211145
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
211146
211146
  if (!transformedNode.name) return;
211147
211147
  const root = path$2.resolve(config.root, config.output.path);
211148
211148
  const mode = getMode(path$2.resolve(root, output.path));
211149
211149
  const imports = adapter.getImports(transformedNode, (schemaName) => ({
211150
- name: resolver.default(schemaName, "type"),
211150
+ name: resolver.resolveTypeName(schemaName),
211151
211151
  path: resolver.resolveFile({
211152
211152
  name: schemaName,
211153
211153
  extname: ".ts"
@@ -211159,7 +211159,7 @@ const typeGeneratorLegacy = defineGenerator({
211159
211159
  }));
211160
211160
  const isEnumSchema = !!narrowSchema(transformedNode, schemaTypes.enum);
211161
211161
  const meta = {
211162
- name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyName(transformedNode, enumTypeSuffix) : resolver.resolveName(transformedNode.name),
211162
+ name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyName(transformedNode, enumTypeSuffix) : resolver.resolveTypeName(transformedNode.name),
211163
211163
  file: resolver.resolveFile({
211164
211164
  name: transformedNode.name,
211165
211165
  extname: ".ts"
@@ -211169,6 +211169,16 @@ const typeGeneratorLegacy = defineGenerator({
211169
211169
  group
211170
211170
  })
211171
211171
  };
211172
+ const schemaPrinter = printerTs({
211173
+ optionalType,
211174
+ arrayType,
211175
+ enumType,
211176
+ enumTypeSuffix,
211177
+ name: meta.name,
211178
+ syntaxType,
211179
+ description: transformedNode.description,
211180
+ resolver
211181
+ });
211172
211182
  return /* @__PURE__ */ jsxs(File, {
211173
211183
  baseName: meta.file.baseName,
211174
211184
  path: meta.file.path,
@@ -211196,17 +211206,15 @@ const typeGeneratorLegacy = defineGenerator({
211196
211206
  enumType,
211197
211207
  enumTypeSuffix,
211198
211208
  enumKeyCasing,
211199
- optionalType,
211200
- arrayType,
211201
- syntaxType,
211202
- resolver
211209
+ resolver,
211210
+ printer: schemaPrinter
211203
211211
  })]
211204
211212
  });
211205
211213
  },
211206
- Operation({ node, adapter, options, config, resolver }) {
211214
+ Operation({ node, adapter, options, config, resolver, plugin }) {
211207
211215
  var _a, _b, _c;
211208
- const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, transformers = [] } = options;
211209
- const transformedNode = transform(node, composeTransformers(...transformers));
211216
+ const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output } = options;
211217
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
211210
211218
  const root = path$2.resolve(config.root, config.output.path);
211211
211219
  const mode = getMode(path$2.resolve(root, output.path));
211212
211220
  const params = caseParams(node.parameters, paramsCasing);
@@ -211223,7 +211231,7 @@ const typeGeneratorLegacy = defineGenerator({
211223
211231
  function renderSchemaType({ schema, name, description, keysToOmit }) {
211224
211232
  if (!schema) return null;
211225
211233
  const imports = adapter.getImports(schema, (schemaName) => ({
211226
- name: resolver.default(schemaName, "type"),
211234
+ name: resolver.resolveTypeName(schemaName),
211227
211235
  path: resolver.resolveFile({
211228
211236
  name: schemaName,
211229
211237
  extname: ".ts"
@@ -211233,6 +211241,17 @@ const typeGeneratorLegacy = defineGenerator({
211233
211241
  group
211234
211242
  }).path
211235
211243
  }));
211244
+ const opPrinter = printerTs({
211245
+ optionalType,
211246
+ arrayType,
211247
+ enumType,
211248
+ enumTypeSuffix,
211249
+ name,
211250
+ syntaxType,
211251
+ description,
211252
+ keysToOmit,
211253
+ resolver
211254
+ });
211236
211255
  return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
211237
211256
  root: meta.file.path,
211238
211257
  path: imp.path,
@@ -211245,15 +211264,11 @@ const typeGeneratorLegacy = defineGenerator({
211245
211264
  ].join("-"))), /* @__PURE__ */ jsx(Type, {
211246
211265
  name,
211247
211266
  node: schema,
211248
- description,
211249
211267
  enumType,
211250
211268
  enumTypeSuffix,
211251
211269
  enumKeyCasing,
211252
- optionalType,
211253
- arrayType,
211254
- syntaxType,
211255
211270
  resolver,
211256
- keysToOmit
211271
+ printer: opPrinter
211257
211272
  })] });
211258
211273
  }
211259
211274
  const pathParams = params.filter((p) => p.in === "path");
@@ -211328,16 +211343,18 @@ const typeGeneratorLegacy = defineGenerator({
211328
211343
  });
211329
211344
  }
211330
211345
  });
211331
- const presets$1 = definePresets({
211346
+ const presets$2 = definePresets({
211332
211347
  default: {
211333
211348
  name: "default",
211334
- resolvers: [resolverTs],
211335
- generators: [typeGenerator]
211349
+ resolver: resolverTs,
211350
+ generators: [typeGenerator],
211351
+ printer: printerTs
211336
211352
  },
211337
211353
  kubbV4: {
211338
211354
  name: "kubbV4",
211339
- resolvers: [resolverTsLegacy],
211340
- generators: [typeGeneratorLegacy]
211355
+ resolver: resolverTsLegacy,
211356
+ generators: [typeGeneratorLegacy],
211357
+ printer: printerTs
211341
211358
  }
211342
211359
  });
211343
211360
  const pluginTsName = "plugin-ts";
@@ -211345,12 +211362,12 @@ const pluginTs = createPlugin((options) => {
211345
211362
  const { output = {
211346
211363
  path: "types",
211347
211364
  barrelType: "named"
211348
- }, group, exclude = [], include, override = [], enumType = "asConst", enumTypeSuffix = "Key", enumKeyCasing = "none", optionalType = "questionToken", arrayType = "array", syntaxType = "type", paramsCasing, compatibilityPreset = "default", resolvers: userResolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = options;
211365
+ }, group, exclude = [], include, override = [], enumType = "asConst", enumTypeSuffix = "Key", enumKeyCasing = "none", optionalType = "questionToken", arrayType = "array", syntaxType = "type", paramsCasing, printer, compatibilityPreset = "default", resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
211349
211366
  const preset = getPreset({
211350
211367
  preset: compatibilityPreset,
211351
- presets: presets$1,
211352
- resolvers: userResolvers,
211353
- transformers: userTransformers,
211368
+ presets: presets$2,
211369
+ resolver: userResolver,
211370
+ transformer: userTransformer,
211354
211371
  generators: userGenerators
211355
211372
  });
211356
211373
  let resolveNameWarning = false;
@@ -211360,6 +211377,9 @@ const pluginTs = createPlugin((options) => {
211360
211377
  get resolver() {
211361
211378
  return preset.resolver;
211362
211379
  },
211380
+ get transformer() {
211381
+ return preset.transformer;
211382
+ },
211363
211383
  get options() {
211364
211384
  return {
211365
211385
  output,
@@ -211377,7 +211397,7 @@ const pluginTs = createPlugin((options) => {
211377
211397
  enumKeyCasing,
211378
211398
  syntaxType,
211379
211399
  paramsCasing,
211380
- transformers: preset.transformers
211400
+ printer
211381
211401
  };
211382
211402
  },
211383
211403
  resolvePath(baseName, pathMode, options2) {
@@ -211480,7 +211500,8 @@ const functionPrinter = defineFunctionPrinter((options) => ({
211480
211500
  if (node.variant === "member") return `${node.base}['${node.key}']`;
211481
211501
  if (node.variant === "struct") return `{ ${node.properties.map((p) => {
211482
211502
  const typeStr = this.transform(p.type);
211483
- return p.optional ? `${p.name}?: ${typeStr}` : `${p.name}: ${typeStr}`;
211503
+ const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
211504
+ return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
211484
211505
  }).join("; ")} }`;
211485
211506
  if (node.variant === "reference") return node.name;
211486
211507
  return null;
@@ -212245,15 +212266,15 @@ const source$1 = "/**\n * RequestCredentials\n */\nexport type RequestCredential
212245
212266
 
212246
212267
  const source = "export function buildFormData<T = unknown>(data: T): FormData {\n const formData = new FormData()\n\n function appendData(key: string, value: any) {\n if (value instanceof Blob) {\n formData.append(key, value)\n return\n }\n if (value instanceof Date) {\n formData.append(key, value.toISOString())\n return\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n formData.append(key, String(value))\n return\n }\n if (typeof value === 'string') {\n formData.append(key, value)\n return\n }\n if (typeof value === 'object') {\n formData.append(key, new Blob([JSON.stringify(value)], { type: 'application/json' }))\n return\n }\n }\n\n if (data) {\n Object.entries(data).forEach(([key, value]) => {\n if (value === undefined || value === null) return\n\n if (Array.isArray(value)) {\n for (const valueItem of value) {\n if (valueItem === undefined || valueItem === null) continue\n appendData(key, valueItem)\n }\n } else {\n appendData(key, value)\n }\n })\n }\n\n return formData\n}\n";
212247
212268
 
212248
- var __typeError$7 = (msg) => {
212269
+ var __typeError$8 = (msg) => {
212249
212270
  throw TypeError(msg);
212250
212271
  };
212251
- var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
212252
- var __privateGet$7 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
212253
- var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$7("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
212254
- var __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
212255
- var __privateMethod$7 = (obj, member, method) => (__accessCheck$7(obj, member, "access private method"), method);
212256
- var _options$7, _context, _OperationGenerator_instances, matchesPattern_fn, isExcluded_fn, isIncluded_fn, _a$7;
212272
+ var __accessCheck$8 = (obj, member, msg) => member.has(obj) || __typeError$8("Cannot " + msg);
212273
+ var __privateGet$8 = (obj, member, getter) => (__accessCheck$8(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
212274
+ var __privateAdd$8 = (obj, member, value) => member.has(obj) ? __typeError$8("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
212275
+ var __privateSet$8 = (obj, member, value, setter) => (__accessCheck$8(obj, member, "write to private field"), member.set(obj, value), value);
212276
+ var __privateMethod$8 = (obj, member, method) => (__accessCheck$8(obj, member, "access private method"), method);
212277
+ var _options$8, _context, _OperationGenerator_instances, matchesPattern_fn, isExcluded_fn, isIncluded_fn, _a$8;
212257
212278
  function createParser(config) {
212258
212279
  const { mapper, handlers } = config;
212259
212280
  function parse(tree, options) {
@@ -212272,30 +212293,30 @@ function createParser(config) {
212272
212293
  function findSchemaKeyword(siblings, keyword) {
212273
212294
  return SchemaGenerator.find(siblings, schemaKeywords[keyword]);
212274
212295
  }
212275
- var OperationGenerator = (_a$7 = class {
212296
+ var OperationGenerator = (_a$8 = class {
212276
212297
  constructor(options, context) {
212277
- __privateAdd$7(this, _OperationGenerator_instances);
212278
- __privateAdd$7(this, _options$7);
212279
- __privateAdd$7(this, _context);
212280
- __privateSet$7(this, _options$7, options);
212281
- __privateSet$7(this, _context, context);
212298
+ __privateAdd$8(this, _OperationGenerator_instances);
212299
+ __privateAdd$8(this, _options$8);
212300
+ __privateAdd$8(this, _context);
212301
+ __privateSet$8(this, _options$8, options);
212302
+ __privateSet$8(this, _context, context);
212282
212303
  }
212283
212304
  get options() {
212284
- return __privateGet$7(this, _options$7);
212305
+ return __privateGet$8(this, _options$8);
212285
212306
  }
212286
212307
  set options(options) {
212287
- __privateSet$7(this, _options$7, {
212288
- ...__privateGet$7(this, _options$7),
212308
+ __privateSet$8(this, _options$8, {
212309
+ ...__privateGet$8(this, _options$8),
212289
212310
  ...options
212290
212311
  });
212291
212312
  }
212292
212313
  get context() {
212293
- return __privateGet$7(this, _context);
212314
+ return __privateGet$8(this, _context);
212294
212315
  }
212295
212316
  getOptions(operation, method) {
212296
212317
  var _a2;
212297
212318
  const { override = [] } = this.context;
212298
- return ((_a2 = override.find(({ pattern, type }) => __privateMethod$7(this, _OperationGenerator_instances, matchesPattern_fn).call(this, operation, method, type, pattern))) == null ? void 0 : _a2.options) || {};
212319
+ return ((_a2 = override.find(({ pattern, type }) => __privateMethod$8(this, _OperationGenerator_instances, matchesPattern_fn).call(this, operation, method, type, pattern))) == null ? void 0 : _a2.options) || {};
212299
212320
  }
212300
212321
  getSchemas(operation, { resolveName = (name) => name } = {}) {
212301
212322
  var _a2, _b;
@@ -212387,8 +212408,8 @@ var OperationGenerator = (_a$7 = class {
212387
212408
  const paths = oas.getPaths();
212388
212409
  return Object.entries(paths).flatMap(([path2, methods]) => Object.entries(methods).map((values) => {
212389
212410
  const [method, operation] = values;
212390
- if (__privateMethod$7(this, _OperationGenerator_instances, isExcluded_fn).call(this, operation, method)) return null;
212391
- if (this.context.include && !__privateMethod$7(this, _OperationGenerator_instances, isIncluded_fn).call(this, operation, method)) return null;
212411
+ if (__privateMethod$8(this, _OperationGenerator_instances, isExcluded_fn).call(this, operation, method)) return null;
212412
+ if (this.context.include && !__privateMethod$8(this, _OperationGenerator_instances, isIncluded_fn).call(this, operation, method)) return null;
212392
212413
  return operation ? {
212393
212414
  path: path2,
212394
212415
  method,
@@ -212459,7 +212480,7 @@ var OperationGenerator = (_a$7 = class {
212459
212480
  }
212460
212481
  return results;
212461
212482
  }
212462
- }, _options$7 = new WeakMap(), _context = new WeakMap(), _OperationGenerator_instances = new WeakSet(), matchesPattern_fn = function(operation, method, type, pattern) {
212483
+ }, _options$8 = new WeakMap(), _context = new WeakMap(), _OperationGenerator_instances = new WeakSet(), matchesPattern_fn = function(operation, method, type, pattern) {
212463
212484
  switch (type) {
212464
212485
  case "tag":
212465
212486
  return operation.getTags().some((tag) => tag.name.match(pattern));
@@ -212476,11 +212497,11 @@ var OperationGenerator = (_a$7 = class {
212476
212497
  }
212477
212498
  }, isExcluded_fn = function(operation, method) {
212478
212499
  const { exclude = [] } = this.context;
212479
- return exclude.some(({ pattern, type }) => __privateMethod$7(this, _OperationGenerator_instances, matchesPattern_fn).call(this, operation, method, type, pattern));
212500
+ return exclude.some(({ pattern, type }) => __privateMethod$8(this, _OperationGenerator_instances, matchesPattern_fn).call(this, operation, method, type, pattern));
212480
212501
  }, isIncluded_fn = function(operation, method) {
212481
212502
  const { include = [] } = this.context;
212482
- return include.some(({ pattern, type }) => __privateMethod$7(this, _OperationGenerator_instances, matchesPattern_fn).call(this, operation, method, type, pattern));
212483
- }, _a$7);
212503
+ return include.some(({ pattern, type }) => __privateMethod$8(this, _OperationGenerator_instances, matchesPattern_fn).call(this, operation, method, type, pattern));
212504
+ }, _a$8);
212484
212505
  const pluginOasName = "plugin-oas";
212485
212506
  const pluginOas = createPlugin((options) => {
212486
212507
  const { output = { path: "schemas" }, group, validate = true, generators = [jsonGenerator], serverIndex, serverVariables, contentType, oasClass, discriminator = "strict", collisionDetection = false } = options;
@@ -212704,18 +212725,18 @@ const pluginClient = createPlugin((options) => {
212704
212725
  };
212705
212726
  });
212706
212727
 
212707
- var __defProp$b = Object.defineProperty;
212708
- var __typeError$6 = (msg) => {
212728
+ var __defProp$c = Object.defineProperty;
212729
+ var __typeError$7 = (msg) => {
212709
212730
  throw TypeError(msg);
212710
212731
  };
212711
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
212712
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
212713
- var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
212714
- var __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
212715
- var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
212716
- var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
212717
- var __privateMethod$6 = (obj, member, method) => (__accessCheck$6(obj, member, "access private method"), method);
212718
- var _options$6, _URLPath_instances$6, transformParam_fn$6, eachParam_fn$6, _a$6;
212732
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
212733
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
212734
+ var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
212735
+ var __privateGet$7 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
212736
+ var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$7("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
212737
+ var __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
212738
+ var __privateMethod$7 = (obj, member, method) => (__accessCheck$7(obj, member, "access private method"), method);
212739
+ var _options$7, _URLPath_instances$7, transformParam_fn$7, eachParam_fn$7, _a$7;
212719
212740
  function toCamelOrPascal$8(text, pascal) {
212720
212741
  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) => {
212721
212742
  if (word.length > 1 && word === word.toUpperCase()) return word;
@@ -212742,16 +212763,16 @@ function isValidVarName$7(name) {
212742
212763
  }
212743
212764
  return true;
212744
212765
  }
212745
- var URLPath$6 = (_a$6 = class {
212766
+ var URLPath$7 = (_a$7 = class {
212746
212767
  constructor(path2, options = {}) {
212747
- __privateAdd$6(this, _URLPath_instances$6);
212768
+ __privateAdd$7(this, _URLPath_instances$7);
212748
212769
  /**
212749
212770
  * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
212750
212771
  */
212751
- __publicField$6(this, "path");
212752
- __privateAdd$6(this, _options$6);
212772
+ __publicField$7(this, "path");
212773
+ __privateAdd$7(this, _options$7);
212753
212774
  this.path = path2;
212754
- __privateSet$6(this, _options$6, options);
212775
+ __privateSet$7(this, _options$7, options);
212755
212776
  }
212756
212777
  /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
212757
212778
  *
@@ -212832,7 +212853,7 @@ var URLPath$6 = (_a$6 = class {
212832
212853
  toTemplateString({ prefix = "", replacer } = {}) {
212833
212854
  return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
212834
212855
  if (i % 2 === 0) return part;
212835
- const param = __privateMethod$6(this, _URLPath_instances$6, transformParam_fn$6).call(this, part);
212856
+ const param = __privateMethod$7(this, _URLPath_instances$7, transformParam_fn$7).call(this, part);
212836
212857
  return `\${${replacer ? replacer(param) : param}}`;
212837
212858
  }).join("")}\``;
212838
212859
  }
@@ -212849,7 +212870,7 @@ var URLPath$6 = (_a$6 = class {
212849
212870
  */
212850
212871
  getParams(replacer) {
212851
212872
  const params = {};
212852
- __privateMethod$6(this, _URLPath_instances$6, eachParam_fn$6).call(this, (_raw, param) => {
212873
+ __privateMethod$7(this, _URLPath_instances$7, eachParam_fn$7).call(this, (_raw, param) => {
212853
212874
  const key = replacer ? replacer(param) : param;
212854
212875
  params[key] = key;
212855
212876
  });
@@ -212865,21 +212886,21 @@ var URLPath$6 = (_a$6 = class {
212865
212886
  toURLPath() {
212866
212887
  return this.path.replace(/\{([^}]+)\}/g, ":$1");
212867
212888
  }
212868
- }, _options$6 = new WeakMap(), _URLPath_instances$6 = new WeakSet(), transformParam_fn$6 = function(raw) {
212889
+ }, _options$7 = new WeakMap(), _URLPath_instances$7 = new WeakSet(), transformParam_fn$7 = function(raw) {
212869
212890
  const param = isValidVarName$7(raw) ? raw : camelCase$8(raw);
212870
- return __privateGet$6(this, _options$6).casing === "camelcase" ? camelCase$8(param) : param;
212891
+ return __privateGet$7(this, _options$7).casing === "camelcase" ? camelCase$8(param) : param;
212871
212892
  }, /**
212872
212893
  * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
212873
212894
  */
212874
- eachParam_fn$6 = function(fn) {
212895
+ eachParam_fn$7 = function(fn) {
212875
212896
  for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
212876
212897
  const raw = match[1];
212877
- fn(raw, __privateMethod$6(this, _URLPath_instances$6, transformParam_fn$6).call(this, raw));
212898
+ fn(raw, __privateMethod$7(this, _URLPath_instances$7, transformParam_fn$7).call(this, raw));
212878
212899
  }
212879
- }, _a$6);
212880
- const declarationPrinter = functionPrinter({ mode: "declaration" });
212881
- function getParams$c({ paramsType, pathParamsType, paramsCasing, resolver, node }) {
212882
- var _a2;
212900
+ }, _a$7);
212901
+ const declarationPrinter$1 = functionPrinter({ mode: "declaration" });
212902
+ function Request({ baseURL = "", name, dataReturnType, resolver, node, paramsType, pathParamsType, paramsCasing }) {
212903
+ var _a2, _b;
212883
212904
  const paramsNode = createOperationParams(node, {
212884
212905
  paramsType,
212885
212906
  pathParamsType,
@@ -212894,22 +212915,12 @@ function getParams$c({ paramsType, pathParamsType, paramsCasing, resolver, node
212894
212915
  default: "{}"
212895
212916
  })]
212896
212917
  });
212897
- return (_a2 = declarationPrinter.print(paramsNode)) != null ? _a2 : "";
212898
- }
212899
- function Request({ baseURL = "", name, dataReturnType, resolver, node, paramsType, pathParamsType, paramsCasing }) {
212900
- var _a2;
212901
- const paramsSignature = getParams$c({
212902
- paramsType,
212903
- pathParamsType,
212904
- paramsCasing,
212905
- resolver,
212906
- node
212907
- });
212918
+ const paramsSignature = (_a2 = declarationPrinter$1.print(paramsNode)) != null ? _a2 : "";
212908
212919
  const responseType = resolver.resolveResponseName(node);
212909
212920
  const returnType = dataReturnType === "data" ? `Cypress.Chainable<${responseType}>` : `Cypress.Chainable<Cypress.Response<${responseType}>>`;
212910
212921
  const casedPathParams = caseParams(node.parameters.filter((p) => p.in === "path"), paramsCasing);
212911
212922
  const pathParamNameMap = new Map(casedPathParams.map((p) => [camelCase$8(p.name), p.name]));
212912
- const urlTemplate = new URLPath$6(node.path, { casing: paramsCasing }).toTemplateString({
212923
+ const urlTemplate = new URLPath$7(node.path, { casing: paramsCasing }).toTemplateString({
212913
212924
  prefix: baseURL,
212914
212925
  replacer: (param) => {
212915
212926
  var _a3;
@@ -212933,7 +212944,7 @@ function Request({ baseURL = "", name, dataReturnType, resolver, node, paramsTyp
212933
212944
  requestOptions.push(`headers: headers ? { ${pairs} } : undefined`);
212934
212945
  } else requestOptions.push("headers");
212935
212946
  }
212936
- if ((_a2 = node.requestBody) == null ? void 0 : _a2.schema) requestOptions.push("body: data");
212947
+ if ((_b = node.requestBody) == null ? void 0 : _b.schema) requestOptions.push("body: data");
212937
212948
  requestOptions.push("...options");
212938
212949
  return /* @__PURE__ */ jsx(File.Source, {
212939
212950
  name,
@@ -212952,17 +212963,16 @@ function Request({ baseURL = "", name, dataReturnType, resolver, node, paramsTyp
212952
212963
  })
212953
212964
  });
212954
212965
  }
212955
- Request.getParams = getParams$c;
212956
212966
  const cypressGenerator = defineGenerator({
212957
212967
  name: "cypress",
212958
212968
  type: "react",
212959
- Operation({ node, adapter, options, config, driver, resolver }) {
212969
+ Operation({ node, adapter, options, config, driver, resolver, plugin }) {
212960
212970
  var _a2, _b, _c, _d, _e, _f;
212961
- const { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType, group, transformers } = options;
212971
+ const { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType, group } = options;
212962
212972
  const root = path$2.resolve(config.root, config.output.path);
212963
212973
  const pluginTs = driver.getPlugin(pluginTsName);
212964
- if (!pluginTs) return null;
212965
- const transformedNode = transform(node, composeTransformers(...transformers));
212974
+ if (!(pluginTs == null ? void 0 : pluginTs.resolver)) return null;
212975
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
212966
212976
  const casedParams = caseParams(transformedNode.parameters, paramsCasing);
212967
212977
  const pathParams = casedParams.filter((p) => p.in === "path");
212968
212978
  const queryParams = casedParams.filter((p) => p.in === "query");
@@ -213037,15 +213047,15 @@ const resolverCypress = defineResolver(() => ({
213037
213047
  return this.default(name, "function");
213038
213048
  }
213039
213049
  }));
213040
- const presets = definePresets({
213050
+ const presets$1 = definePresets({
213041
213051
  default: {
213042
213052
  name: "default",
213043
- resolvers: [resolverCypress],
213053
+ resolver: resolverCypress,
213044
213054
  generators: [cypressGenerator]
213045
213055
  },
213046
213056
  kubbV4: {
213047
213057
  name: "kubbV4",
213048
- resolvers: [resolverCypress],
213058
+ resolver: resolverCypress,
213049
213059
  generators: [cypressGenerator]
213050
213060
  }
213051
213061
  });
@@ -213054,12 +213064,12 @@ const pluginCypress = createPlugin((options) => {
213054
213064
  const { output = {
213055
213065
  path: "cypress",
213056
213066
  barrelType: "named"
213057
- }, group, dataReturnType = "data", exclude = [], include, override = [], baseURL, paramsCasing, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", compatibilityPreset = "default", resolvers: userResolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = options;
213067
+ }, group, dataReturnType = "data", exclude = [], include, override = [], baseURL, paramsCasing, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", compatibilityPreset = "default", resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
213058
213068
  const preset = getPreset({
213059
213069
  preset: compatibilityPreset,
213060
- presets,
213061
- resolvers: [resolverCypress, ...userResolvers],
213062
- transformers: userTransformers,
213070
+ presets: presets$1,
213071
+ resolver: userResolver,
213072
+ transformer: userTransformer,
213063
213073
  generators: userGenerators
213064
213074
  });
213065
213075
  return {
@@ -213067,6 +213077,9 @@ const pluginCypress = createPlugin((options) => {
213067
213077
  get resolver() {
213068
213078
  return preset.resolver;
213069
213079
  },
213080
+ get transformer() {
213081
+ return preset.transformer;
213082
+ },
213070
213083
  get options() {
213071
213084
  return {
213072
213085
  output,
@@ -213082,8 +213095,7 @@ const pluginCypress = createPlugin((options) => {
213082
213095
  paramsCasing,
213083
213096
  paramsType,
213084
213097
  pathParamsType,
213085
- resolver: preset.resolver,
213086
- transformers: preset.transformers
213098
+ resolver: preset.resolver
213087
213099
  };
213088
213100
  },
213089
213101
  pre: [pluginTsName].filter(Boolean),
@@ -213812,6 +213824,18 @@ const pluginFaker = createPlugin((options) => {
213812
213824
  };
213813
213825
  });
213814
213826
 
213827
+ var __defProp$b = Object.defineProperty;
213828
+ var __typeError$6 = (msg) => {
213829
+ throw TypeError(msg);
213830
+ };
213831
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
213832
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
213833
+ var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
213834
+ var __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
213835
+ var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
213836
+ var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
213837
+ var __privateMethod$6 = (obj, member, method) => (__accessCheck$6(obj, member, "access private method"), method);
213838
+ var _options$6, _URLPath_instances$6, transformParam_fn$6, eachParam_fn$6, _a$6;
213815
213839
  function toCamelOrPascal$6(text, pascal) {
213816
213840
  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) => {
213817
213841
  if (word.length > 1 && word === word.toUpperCase()) return word;
@@ -213838,12 +213862,173 @@ function isValidVarName$6(name) {
213838
213862
  }
213839
213863
  return true;
213840
213864
  }
213841
- function zodExprFromOasSchema(schema) {
213842
- const types = Array.isArray(schema.type) ? schema.type : [schema.type];
213843
- const baseType = types.find((t) => t && t !== "null");
213844
- const isNullableType = types.includes("null");
213865
+ var URLPath$6 = (_a$6 = class {
213866
+ constructor(path2, options = {}) {
213867
+ __privateAdd$6(this, _URLPath_instances$6);
213868
+ /**
213869
+ * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
213870
+ */
213871
+ __publicField$6(this, "path");
213872
+ __privateAdd$6(this, _options$6);
213873
+ this.path = path2;
213874
+ __privateSet$6(this, _options$6, options);
213875
+ }
213876
+ /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
213877
+ *
213878
+ * @example
213879
+ * ```ts
213880
+ * new URLPath('/pet/{petId}').URL // '/pet/:petId'
213881
+ * ```
213882
+ */
213883
+ get URL() {
213884
+ return this.toURLPath();
213885
+ }
213886
+ /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
213887
+ *
213888
+ * @example
213889
+ * ```ts
213890
+ * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
213891
+ * new URLPath('/pet/{petId}').isURL // false
213892
+ * ```
213893
+ */
213894
+ get isURL() {
213895
+ try {
213896
+ return !!new URL(this.path).href;
213897
+ } catch {
213898
+ return false;
213899
+ }
213900
+ }
213901
+ /**
213902
+ * Converts the OpenAPI path to a TypeScript template literal string.
213903
+ *
213904
+ * @example
213905
+ * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
213906
+ * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
213907
+ */
213908
+ get template() {
213909
+ return this.toTemplateString();
213910
+ }
213911
+ /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
213912
+ *
213913
+ * @example
213914
+ * ```ts
213915
+ * new URLPath('/pet/{petId}').object
213916
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
213917
+ * ```
213918
+ */
213919
+ get object() {
213920
+ return this.toObject();
213921
+ }
213922
+ /** Returns a map of path parameter names, or `undefined` when the path has no parameters.
213923
+ *
213924
+ * @example
213925
+ * ```ts
213926
+ * new URLPath('/pet/{petId}').params // { petId: 'petId' }
213927
+ * new URLPath('/pet').params // undefined
213928
+ * ```
213929
+ */
213930
+ get params() {
213931
+ return this.getParams();
213932
+ }
213933
+ toObject({ type = "path", replacer, stringify } = {}) {
213934
+ const object = {
213935
+ url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
213936
+ params: this.getParams()
213937
+ };
213938
+ if (stringify) {
213939
+ if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
213940
+ if (object.params) return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
213941
+ return `{ url: '${object.url}' }`;
213942
+ }
213943
+ return object;
213944
+ }
213945
+ /**
213946
+ * Converts the OpenAPI path to a TypeScript template literal string.
213947
+ * An optional `replacer` can transform each extracted parameter name before interpolation.
213948
+ *
213949
+ * @example
213950
+ * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
213951
+ */
213952
+ toTemplateString({ prefix = "", replacer } = {}) {
213953
+ return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
213954
+ if (i % 2 === 0) return part;
213955
+ const param = __privateMethod$6(this, _URLPath_instances$6, transformParam_fn$6).call(this, part);
213956
+ return `\${${replacer ? replacer(param) : param}}`;
213957
+ }).join("")}\``;
213958
+ }
213959
+ /**
213960
+ * Extracts all `{param}` segments from the path and returns them as a key-value map.
213961
+ * An optional `replacer` transforms each parameter name in both key and value positions.
213962
+ * Returns `undefined` when no path parameters are found.
213963
+ *
213964
+ * @example
213965
+ * ```ts
213966
+ * new URLPath('/pet/{petId}/tag/{tagId}').getParams()
213967
+ * // { petId: 'petId', tagId: 'tagId' }
213968
+ * ```
213969
+ */
213970
+ getParams(replacer) {
213971
+ const params = {};
213972
+ __privateMethod$6(this, _URLPath_instances$6, eachParam_fn$6).call(this, (_raw, param) => {
213973
+ const key = replacer ? replacer(param) : param;
213974
+ params[key] = key;
213975
+ });
213976
+ return Object.keys(params).length > 0 ? params : void 0;
213977
+ }
213978
+ /** Converts the OpenAPI path to Express-style colon syntax.
213979
+ *
213980
+ * @example
213981
+ * ```ts
213982
+ * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
213983
+ * ```
213984
+ */
213985
+ toURLPath() {
213986
+ return this.path.replace(/\{([^}]+)\}/g, ":$1");
213987
+ }
213988
+ }, _options$6 = new WeakMap(), _URLPath_instances$6 = new WeakSet(), transformParam_fn$6 = function(raw) {
213989
+ const param = isValidVarName$6(raw) ? raw : camelCase$6(raw);
213990
+ return __privateGet$6(this, _options$6).casing === "camelcase" ? camelCase$6(param) : param;
213991
+ }, /**
213992
+ * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
213993
+ */
213994
+ eachParam_fn$6 = function(fn) {
213995
+ for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
213996
+ const raw = match[1];
213997
+ fn(raw, __privateMethod$6(this, _URLPath_instances$6, transformParam_fn$6).call(this, raw));
213998
+ }
213999
+ }, _a$6);
214000
+ function findSuccessStatusCode(responses) {
214001
+ for (const res of responses) {
214002
+ const code = Number(res.statusCode);
214003
+ if (code >= 200 && code < 300) return res.statusCode;
214004
+ }
214005
+ }
214006
+ function zodGroupExpr(entry) {
214007
+ if (typeof entry === "string") return entry;
214008
+ return `z.object({ ${entry.map((p) => `${JSON.stringify(p.name)}: ${p.schemaName}`).join(", ")} })`;
214009
+ }
214010
+ function getComments(node) {
214011
+ return [
214012
+ node.description && `@description ${node.description}`,
214013
+ node.summary && `@summary ${node.summary}`,
214014
+ node.deprecated && "@deprecated",
214015
+ `{@link ${node.path.replaceAll("{", ":").replaceAll("}", "")}}`
214016
+ ].filter((x) => Boolean(x));
214017
+ }
214018
+ function getParamsMapping(params) {
214019
+ if (!params.length) return;
214020
+ const mapping = {};
214021
+ let hasDifference = false;
214022
+ for (const p of params) {
214023
+ const camelName = camelCase$6(p.name);
214024
+ mapping[p.name] = camelName;
214025
+ if (p.name !== camelName) hasDifference = true;
214026
+ }
214027
+ return hasDifference ? mapping : void 0;
214028
+ }
214029
+ function zodExprFromSchemaNode(schema) {
213845
214030
  let expr;
213846
- switch (baseType) {
214031
+ switch (schema.type) {
213847
214032
  case "integer":
213848
214033
  expr = "z.coerce.number()";
213849
214034
  break;
@@ -213859,40 +214044,107 @@ function zodExprFromOasSchema(schema) {
213859
214044
  default:
213860
214045
  expr = "z.string()";
213861
214046
  }
213862
- if (isNullableType) expr = `${expr}.nullable()`;
214047
+ if (schema.nullable) expr = `${expr}.nullable()`;
213863
214048
  return expr;
213864
214049
  }
213865
- function getParams$b({ schemas, paramsCasing }) {
213866
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
213867
- const pathParamProperties = (_c = (_b = (_a = schemas.pathParams) == null ? void 0 : _a.schema) == null ? void 0 : _b.properties) != null ? _c : {};
213868
- const requiredFields = Array.isArray((_e = (_d = schemas.pathParams) == null ? void 0 : _d.schema) == null ? void 0 : _e.required) ? schemas.pathParams.schema.required : [];
213869
- const pathParamEntries = Object.entries(pathParamProperties).reduce((acc, [originalKey, propSchema]) => {
213870
- const key = paramsCasing === "camelcase" || !isValidVarName$6(originalKey) ? camelCase$6(originalKey) : originalKey;
213871
- acc[key] = {
213872
- value: zodExprFromOasSchema(propSchema),
213873
- optional: !requiredFields.includes(originalKey)
213874
- };
213875
- return acc;
213876
- }, {});
213877
- return FunctionParams.factory({ data: {
213878
- mode: "object",
213879
- children: {
213880
- ...pathParamEntries,
213881
- data: ((_f = schemas.request) == null ? void 0 : _f.name) ? {
213882
- value: (_g = schemas.request) == null ? void 0 : _g.name,
213883
- optional: isOptional((_h = schemas.request) == null ? void 0 : _h.schema)
213884
- } : void 0,
213885
- params: ((_i = schemas.queryParams) == null ? void 0 : _i.name) ? {
213886
- value: (_j = schemas.queryParams) == null ? void 0 : _j.name,
213887
- optional: isOptional((_k = schemas.queryParams) == null ? void 0 : _k.schema)
213888
- } : void 0,
213889
- headers: ((_l = schemas.headerParams) == null ? void 0 : _l.name) ? {
213890
- value: (_m = schemas.headerParams) == null ? void 0 : _m.name,
213891
- optional: isOptional((_n = schemas.headerParams) == null ? void 0 : _n.schema)
213892
- } : void 0
213893
- }
213894
- } });
214050
+ function buildRemappingCode(mapping, varName, sourceName) {
214051
+ return `const ${varName} = ${sourceName} ? { ${Object.entries(mapping).map(([orig, camel]) => `"${orig}": ${sourceName}.${camel}`).join(", ")} } : undefined`;
214052
+ }
214053
+ const declarationPrinter = functionPrinter({ mode: "declaration" });
214054
+ function McpHandler({ name, node, resolver, baseURL, dataReturnType, paramsCasing }) {
214055
+ var _a2, _b, _c;
214056
+ const urlPath = new URLPath$6(node.path);
214057
+ const contentType = (_a2 = node.requestBody) == null ? void 0 : _a2.contentType;
214058
+ const isFormData = contentType === "multipart/form-data";
214059
+ const casedParams = caseParams(node.parameters, paramsCasing);
214060
+ const queryParams = casedParams.filter((p) => p.in === "query");
214061
+ const headerParams = casedParams.filter((p) => p.in === "header");
214062
+ const originalPathParams = node.parameters.filter((p) => p.in === "path");
214063
+ const originalQueryParams = node.parameters.filter((p) => p.in === "query");
214064
+ const originalHeaderParams = node.parameters.filter((p) => p.in === "header");
214065
+ const requestName = ((_b = node.requestBody) == null ? void 0 : _b.schema) ? resolver.resolveDataName(node) : void 0;
214066
+ const responseName = resolver.resolveResponseName(node);
214067
+ const errorResponses = node.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => resolver.resolveResponseStatusName(node, r.statusCode));
214068
+ const generics = [
214069
+ responseName,
214070
+ `ResponseErrorConfig<${errorResponses.length > 0 ? errorResponses.join(" | ") : "Error"}>`,
214071
+ requestName || "unknown"
214072
+ ].filter(Boolean);
214073
+ const paramsNode = createOperationParams(node, {
214074
+ paramsType: "object",
214075
+ pathParamsType: "inline",
214076
+ resolver,
214077
+ paramsCasing
214078
+ });
214079
+ const paramsSignature = (_c = declarationPrinter.print(paramsNode)) != null ? _c : "";
214080
+ const pathParamsMapping = paramsCasing ? getParamsMapping(originalPathParams) : void 0;
214081
+ const queryParamsMapping = paramsCasing ? getParamsMapping(originalQueryParams) : void 0;
214082
+ const headerParamsMapping = paramsCasing ? getParamsMapping(originalHeaderParams) : void 0;
214083
+ const contentTypeHeader = contentType && contentType !== "application/json" && contentType !== "multipart/form-data" ? `'Content-Type': '${contentType}'` : void 0;
214084
+ const headers = [headerParams.length ? headerParamsMapping ? "...mappedHeaders" : "...headers" : void 0, contentTypeHeader].filter(Boolean);
214085
+ const fetchConfig = [];
214086
+ fetchConfig.push(`method: ${JSON.stringify(node.method.toUpperCase())}`);
214087
+ fetchConfig.push(`url: ${urlPath.template}`);
214088
+ if (baseURL) fetchConfig.push(`baseURL: \`${baseURL}\``);
214089
+ if (queryParams.length) fetchConfig.push(queryParamsMapping ? "params: mappedParams" : "params");
214090
+ if (requestName) fetchConfig.push(`data: ${isFormData ? "formData as FormData" : "requestData"}`);
214091
+ if (headers.length) fetchConfig.push(`headers: { ${headers.join(", ")} }`);
214092
+ const callToolResult = dataReturnType === "data" ? `return {
214093
+ content: [
214094
+ {
214095
+ type: 'text',
214096
+ text: JSON.stringify(res.data)
214097
+ }
214098
+ ],
214099
+ structuredContent: { data: res.data }
214100
+ }` : `return {
214101
+ content: [
214102
+ {
214103
+ type: 'text',
214104
+ text: JSON.stringify(res)
214105
+ }
214106
+ ],
214107
+ structuredContent: { data: res.data }
214108
+ }`;
214109
+ return /* @__PURE__ */ jsx(File.Source, {
214110
+ name,
214111
+ isExportable: true,
214112
+ isIndexable: true,
214113
+ children: /* @__PURE__ */ jsxs(Function$1, {
214114
+ name,
214115
+ async: true,
214116
+ export: true,
214117
+ params: paramsSignature,
214118
+ JSDoc: { comments: getComments(node) },
214119
+ returnType: "Promise<CallToolResult>",
214120
+ children: [
214121
+ "",
214122
+ /* @__PURE__ */ jsx("br", {}),
214123
+ /* @__PURE__ */ jsx("br", {}),
214124
+ pathParamsMapping && Object.entries(pathParamsMapping).filter(([originalName, camelCaseName]) => originalName !== camelCaseName && isValidVarName$6(originalName)).map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`).join("\n"),
214125
+ pathParamsMapping && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("br", {})] }),
214126
+ queryParamsMapping && queryParams.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
214127
+ buildRemappingCode(queryParamsMapping, "mappedParams", "params"),
214128
+ /* @__PURE__ */ jsx("br", {}),
214129
+ /* @__PURE__ */ jsx("br", {})
214130
+ ] }),
214131
+ headerParamsMapping && headerParams.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
214132
+ buildRemappingCode(headerParamsMapping, "mappedHeaders", "headers"),
214133
+ /* @__PURE__ */ jsx("br", {}),
214134
+ /* @__PURE__ */ jsx("br", {})
214135
+ ] }),
214136
+ requestName && "const requestData = data",
214137
+ /* @__PURE__ */ jsx("br", {}),
214138
+ isFormData && requestName && "const formData = buildFormData(requestData)",
214139
+ /* @__PURE__ */ jsx("br", {}),
214140
+ `const res = await fetch<${generics.join(", ")}>({ ${fetchConfig.join(", ")} })`,
214141
+ /* @__PURE__ */ jsx("br", {}),
214142
+ callToolResult
214143
+ ]
214144
+ })
214145
+ });
213895
214146
  }
214147
+ const keysPrinter = functionPrinter({ mode: "keys" });
213896
214148
  function Server({ name, serverName, serverVersion, paramsCasing, operations }) {
213897
214149
  return /* @__PURE__ */ jsxs(File.Source, {
213898
214150
  name,
@@ -213909,264 +214161,445 @@ function Server({ name, serverName, serverVersion, paramsCasing, operations }) {
213909
214161
  })
213910
214162
  `
213911
214163
  }),
213912
- operations.map(({ tool, mcp, zod }) => {
213913
- var _a, _b, _c, _d, _e;
213914
- const paramsClient = getParams$b({
213915
- schemas: zod.schemas,
213916
- paramsCasing
214164
+ operations.map(({ tool, mcp, zod, node }) => {
214165
+ var _a2;
214166
+ const pathParams = caseParams(node.parameters, paramsCasing).filter((p) => p.in === "path");
214167
+ const pathEntries = [];
214168
+ const otherEntries = [];
214169
+ for (const p of pathParams) {
214170
+ const zodParam = zod.pathParams.find((zp) => zp.name === p.name);
214171
+ pathEntries.push({
214172
+ key: p.name,
214173
+ value: zodParam ? zodParam.schemaName : zodExprFromSchemaNode(p.schema)
214174
+ });
214175
+ }
214176
+ if (zod.requestName) otherEntries.push({
214177
+ key: "data",
214178
+ value: zod.requestName
214179
+ });
214180
+ if (zod.queryParams) otherEntries.push({
214181
+ key: "params",
214182
+ value: zodGroupExpr(zod.queryParams)
213917
214183
  });
213918
- const outputSchema = (_a = zod.schemas.response) == null ? void 0 : _a.name;
214184
+ if (zod.headerParams) otherEntries.push({
214185
+ key: "headers",
214186
+ value: zodGroupExpr(zod.headerParams)
214187
+ });
214188
+ otherEntries.sort((a, b) => a.key.localeCompare(b.key));
214189
+ const entries = [...pathEntries, ...otherEntries];
214190
+ const paramsNode = entries.length ? createFunctionParameters({ params: [createParameterGroup({ properties: entries.map((e) => createFunctionParameter({
214191
+ name: e.key,
214192
+ optional: false
214193
+ })) })] }) : void 0;
214194
+ const destructured = paramsNode ? (_a2 = keysPrinter.print(paramsNode)) != null ? _a2 : "" : "";
214195
+ const inputSchema = entries.length ? `{ ${entries.map((e) => `${e.key}: ${e.value}`).join(", ")} }` : void 0;
214196
+ const outputSchema = zod.responseName;
213919
214197
  const config = [
213920
214198
  tool.title ? `title: ${JSON.stringify(tool.title)}` : null,
213921
214199
  `description: ${JSON.stringify(tool.description)}`,
213922
214200
  outputSchema ? `outputSchema: { data: ${outputSchema} }` : null
213923
214201
  ].filter(Boolean).join(",\n ");
213924
- if (((_b = zod.schemas.request) == null ? void 0 : _b.name) || ((_c = zod.schemas.headerParams) == null ? void 0 : _c.name) || ((_d = zod.schemas.queryParams) == null ? void 0 : _d.name) || ((_e = zod.schemas.pathParams) == null ? void 0 : _e.name)) return `
214202
+ if (inputSchema) return `
213925
214203
  server.registerTool(${JSON.stringify(tool.name)}, {
213926
214204
  ${config},
213927
- inputSchema: ${paramsClient.toObjectValue()},
213928
- }, async (${paramsClient.toObject()}) => {
213929
- return ${mcp.name}(${paramsClient.toObject()})
214205
+ inputSchema: ${inputSchema},
214206
+ }, async (${destructured}) => {
214207
+ return ${mcp.name}(${destructured})
213930
214208
  })
213931
214209
  `;
213932
214210
  return `
213933
214211
  server.registerTool(${JSON.stringify(tool.name)}, {
213934
214212
  ${config},
213935
214213
  }, async () => {
213936
- return ${mcp.name}(${paramsClient.toObject()})
214214
+ return ${mcp.name}()
213937
214215
  })
213938
214216
  `;
213939
214217
  }).filter(Boolean),
213940
- `
213941
- export async function startServer() {
213942
- try {
214218
+ /* @__PURE__ */ jsx(Function$1, {
214219
+ name: "startServer",
214220
+ async: true,
214221
+ export: true,
214222
+ children: `try {
213943
214223
  const transport = new StdioServerTransport()
213944
214224
  await server.connect(transport)
213945
214225
 
213946
214226
  } catch (error) {
213947
214227
  console.error('Failed to start server:', error)
213948
214228
  process.exit(1)
213949
- }
213950
- }
213951
- `
214229
+ }`
214230
+ })
213952
214231
  ]
213953
214232
  });
213954
214233
  }
213955
-
213956
- const mcpGenerator = createReactGenerator({
214234
+ const mcpGenerator = defineGenerator({
213957
214235
  name: "mcp",
213958
- Operation({ config, operation, generator, plugin }) {
213959
- var _a, _b, _c, _d, _e, _f;
213960
- const { options } = plugin;
213961
- const oas = useOas();
213962
- const { getSchemas, getName, getFile } = useOperationManager(generator);
213963
- const mcp = {
213964
- name: getName(operation, {
213965
- type: "function",
213966
- suffix: "handler"
214236
+ type: "react",
214237
+ Operation({ node, options, config, driver, resolver, plugin }) {
214238
+ var _a2, _b, _c, _d, _e, _f;
214239
+ const { output, client, paramsCasing, group } = options;
214240
+ const root = path$2.resolve(config.root, config.output.path);
214241
+ const pluginTs = driver.getPlugin(pluginTsName);
214242
+ if (!(pluginTs == null ? void 0 : pluginTs.resolver)) return null;
214243
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
214244
+ const casedParams = caseParams(transformedNode.parameters, paramsCasing);
214245
+ const pathParams = casedParams.filter((p) => p.in === "path");
214246
+ const queryParams = casedParams.filter((p) => p.in === "query");
214247
+ const headerParams = casedParams.filter((p) => p.in === "header");
214248
+ const importedTypeNames = [
214249
+ ...pathParams.map((p) => pluginTs.resolver.resolvePathParamsName(transformedNode, p)),
214250
+ ...queryParams.map((p) => pluginTs.resolver.resolveQueryParamsName(transformedNode, p)),
214251
+ ...headerParams.map((p) => pluginTs.resolver.resolveHeaderParamsName(transformedNode, p)),
214252
+ ((_a2 = transformedNode.requestBody) == null ? void 0 : _a2.schema) ? pluginTs.resolver.resolveDataName(transformedNode) : void 0,
214253
+ pluginTs.resolver.resolveResponseName(transformedNode),
214254
+ ...transformedNode.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => pluginTs.resolver.resolveResponseStatusName(transformedNode, r.statusCode))
214255
+ ].filter(Boolean);
214256
+ const meta = {
214257
+ name: resolver.resolveName(transformedNode.operationId),
214258
+ file: resolver.resolveFile({
214259
+ name: transformedNode.operationId,
214260
+ extname: ".ts",
214261
+ tag: (_b = transformedNode.tags[0]) != null ? _b : "default",
214262
+ path: transformedNode.path
214263
+ }, {
214264
+ root,
214265
+ output,
214266
+ group
213967
214267
  }),
213968
- file: getFile(operation)
213969
- };
213970
- const type = {
213971
- file: getFile(operation, { pluginName: pluginTsName }),
213972
- schemas: getSchemas(operation, {
213973
- pluginName: pluginTsName,
213974
- type: "type"
214268
+ fileTs: pluginTs.resolver.resolveFile({
214269
+ name: transformedNode.operationId,
214270
+ extname: ".ts",
214271
+ tag: (_c = transformedNode.tags[0]) != null ? _c : "default",
214272
+ path: transformedNode.path
214273
+ }, {
214274
+ root,
214275
+ output: (_e = (_d = pluginTs.options) == null ? void 0 : _d.output) != null ? _e : output,
214276
+ group: (_f = pluginTs.options) == null ? void 0 : _f.group
213975
214277
  })
213976
214278
  };
213977
214279
  return /* @__PURE__ */ jsxs(File, {
213978
- baseName: mcp.file.baseName,
213979
- path: mcp.file.path,
213980
- meta: mcp.file.meta,
213981
- banner: getBanner({
213982
- oas,
213983
- output: options.output
213984
- }),
213985
- footer: getFooter({
213986
- oas,
213987
- output: options.output
213988
- }),
214280
+ baseName: meta.file.baseName,
214281
+ path: meta.file.path,
214282
+ meta: meta.file.meta,
213989
214283
  children: [
213990
- options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
213991
- /* @__PURE__ */ jsx(File.Import, {
213992
- name: "fetch",
213993
- path: options.client.importPath
213994
- }),
214284
+ meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
214285
+ name: Array.from(new Set(importedTypeNames)).sort(),
214286
+ root: meta.file.path,
214287
+ path: meta.fileTs.path,
214288
+ isTypeOnly: true
214289
+ }),
214290
+ /* @__PURE__ */ jsx(File.Import, {
214291
+ name: ["CallToolResult"],
214292
+ path: "@modelcontextprotocol/sdk/types",
214293
+ isTypeOnly: true
214294
+ }),
214295
+ /* @__PURE__ */ jsx(File.Import, {
214296
+ name: ["buildFormData"],
214297
+ root: meta.file.path,
214298
+ path: path$2.resolve(root, ".kubb/config.ts")
214299
+ }),
214300
+ client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
213995
214301
  /* @__PURE__ */ jsx(File.Import, {
213996
214302
  name: [
213997
214303
  "Client",
213998
214304
  "RequestConfig",
213999
214305
  "ResponseErrorConfig"
214000
214306
  ],
214001
- path: options.client.importPath,
214307
+ path: client.importPath,
214002
214308
  isTypeOnly: true
214003
214309
  }),
214004
- options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
214310
+ /* @__PURE__ */ jsx(File.Import, {
214311
+ name: "fetch",
214312
+ path: client.importPath
214313
+ }),
214314
+ client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
214005
214315
  name: ["ResponseConfig"],
214006
- path: options.client.importPath,
214316
+ path: client.importPath,
214007
214317
  isTypeOnly: true
214008
214318
  })
214009
214319
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
214010
- /* @__PURE__ */ jsx(File.Import, {
214011
- name: ["fetch"],
214012
- root: mcp.file.path,
214013
- path: path$2.resolve(config.root, config.output.path, ".kubb/fetch.ts")
214014
- }),
214015
214320
  /* @__PURE__ */ jsx(File.Import, {
214016
214321
  name: [
214017
214322
  "Client",
214018
214323
  "RequestConfig",
214019
214324
  "ResponseErrorConfig"
214020
214325
  ],
214021
- root: mcp.file.path,
214022
- path: path$2.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
214326
+ root: meta.file.path,
214327
+ path: path$2.resolve(root, ".kubb/fetch.ts"),
214023
214328
  isTypeOnly: true
214024
214329
  }),
214025
- options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
214330
+ /* @__PURE__ */ jsx(File.Import, {
214331
+ name: ["fetch"],
214332
+ root: meta.file.path,
214333
+ path: path$2.resolve(root, ".kubb/fetch.ts")
214334
+ }),
214335
+ client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
214026
214336
  name: ["ResponseConfig"],
214027
- root: mcp.file.path,
214028
- path: path$2.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
214337
+ root: meta.file.path,
214338
+ path: path$2.resolve(root, ".kubb/fetch.ts"),
214029
214339
  isTypeOnly: true
214030
214340
  })
214031
214341
  ] }),
214342
+ /* @__PURE__ */ jsx(McpHandler, {
214343
+ name: meta.name,
214344
+ node: transformedNode,
214345
+ resolver: pluginTs.resolver,
214346
+ baseURL: client.baseURL,
214347
+ dataReturnType: client.dataReturnType || "data",
214348
+ paramsCasing
214349
+ })
214350
+ ]
214351
+ });
214352
+ }
214353
+ });
214354
+ const serverGenerator = defineGenerator({
214355
+ name: "operations",
214356
+ type: "react",
214357
+ Operations({ nodes, adapter, options, config, driver, resolver, plugin }) {
214358
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
214359
+ const { output, paramsCasing, group } = options;
214360
+ const root = path$2.resolve(config.root, config.output.path);
214361
+ const pluginZod = driver.getPlugin(pluginZodName);
214362
+ if (!(pluginZod == null ? void 0 : pluginZod.resolver)) return;
214363
+ const name = "server";
214364
+ const serverFile = {
214365
+ baseName: "server.ts",
214366
+ path: path$2.resolve(root, output.path, "server.ts"),
214367
+ meta: { pluginName: plugin.name }
214368
+ };
214369
+ const jsonFile = {
214370
+ baseName: ".mcp.json",
214371
+ path: path$2.resolve(root, output.path, ".mcp.json"),
214372
+ meta: { pluginName: plugin.name }
214373
+ };
214374
+ const operationsMapped = nodes.map((node) => {
214375
+ var _a3, _b2, _c2, _d2, _e2, _f2;
214376
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
214377
+ const casedParams = caseParams(transformedNode.parameters, paramsCasing);
214378
+ const pathParams = casedParams.filter((p) => p.in === "path");
214379
+ const queryParams = casedParams.filter((p) => p.in === "query");
214380
+ const headerParams = casedParams.filter((p) => p.in === "header");
214381
+ const mcpFile = resolver.resolveFile({
214382
+ name: transformedNode.operationId,
214383
+ extname: ".ts",
214384
+ tag: (_a3 = transformedNode.tags[0]) != null ? _a3 : "default",
214385
+ path: transformedNode.path
214386
+ }, {
214387
+ root,
214388
+ output,
214389
+ group
214390
+ });
214391
+ const zodFile = pluginZod.resolver.resolveFile({
214392
+ name: transformedNode.operationId,
214393
+ extname: ".ts",
214394
+ tag: (_b2 = transformedNode.tags[0]) != null ? _b2 : "default",
214395
+ path: transformedNode.path
214396
+ }, {
214397
+ root,
214398
+ output: (_d2 = (_c2 = pluginZod.options) == null ? void 0 : _c2.output) != null ? _d2 : output,
214399
+ group: (_e2 = pluginZod.options) == null ? void 0 : _e2.group
214400
+ });
214401
+ const requestName = ((_f2 = transformedNode.requestBody) == null ? void 0 : _f2.schema) ? pluginZod.resolver.resolveDataName(transformedNode) : void 0;
214402
+ const successStatus = findSuccessStatusCode(transformedNode.responses);
214403
+ const responseName = successStatus ? pluginZod.resolver.resolveResponseStatusName(transformedNode, successStatus) : void 0;
214404
+ const resolveParams = (params) => params.map((p) => ({
214405
+ name: p.name,
214406
+ schemaName: pluginZod.resolver.resolveParamName(transformedNode, p)
214407
+ }));
214408
+ return {
214409
+ tool: {
214410
+ name: transformedNode.operationId,
214411
+ title: transformedNode.summary || void 0,
214412
+ description: transformedNode.description || `Make a ${transformedNode.method.toUpperCase()} request to ${transformedNode.path}`
214413
+ },
214414
+ mcp: {
214415
+ name: resolver.resolveName(transformedNode.operationId),
214416
+ file: mcpFile
214417
+ },
214418
+ zod: {
214419
+ pathParams: resolveParams(pathParams),
214420
+ queryParams: queryParams.length ? resolveParams(queryParams) : void 0,
214421
+ headerParams: headerParams.length ? resolveParams(headerParams) : void 0,
214422
+ requestName,
214423
+ responseName,
214424
+ file: zodFile
214425
+ },
214426
+ node: transformedNode
214427
+ };
214428
+ });
214429
+ const imports = operationsMapped.flatMap(({ mcp, zod }) => {
214430
+ var _a3, _b2;
214431
+ const zodNames = [
214432
+ ...zod.pathParams.map((p) => p.schemaName),
214433
+ ...((_a3 = zod.queryParams) != null ? _a3 : []).map((p) => p.schemaName),
214434
+ ...((_b2 = zod.headerParams) != null ? _b2 : []).map((p) => p.schemaName),
214435
+ zod.requestName,
214436
+ zod.responseName
214437
+ ].filter(Boolean);
214438
+ const uniqueNames = [...new Set(zodNames)].sort();
214439
+ return [/* @__PURE__ */ jsx(File.Import, {
214440
+ name: [mcp.name],
214441
+ root: serverFile.path,
214442
+ path: mcp.file.path
214443
+ }, mcp.name), uniqueNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
214444
+ name: uniqueNames,
214445
+ root: serverFile.path,
214446
+ path: zod.file.path
214447
+ }, `zod-${mcp.name}`)].filter(Boolean);
214448
+ });
214449
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(File, {
214450
+ baseName: serverFile.baseName,
214451
+ path: serverFile.path,
214452
+ meta: serverFile.meta,
214453
+ banner: resolver.resolveBanner(adapter.rootNode, {
214454
+ output,
214455
+ config
214456
+ }),
214457
+ footer: resolver.resolveFooter(adapter.rootNode, {
214458
+ output,
214459
+ config
214460
+ }),
214461
+ children: [
214032
214462
  /* @__PURE__ */ jsx(File.Import, {
214033
- name: ["buildFormData"],
214034
- root: mcp.file.path,
214035
- path: path$2.resolve(config.root, config.output.path, ".kubb/config.ts")
214463
+ name: ["McpServer"],
214464
+ path: "@modelcontextprotocol/sdk/server/mcp"
214036
214465
  }),
214037
214466
  /* @__PURE__ */ jsx(File.Import, {
214038
- name: ["CallToolResult"],
214039
- path: "@modelcontextprotocol/sdk/types",
214040
- isTypeOnly: true
214467
+ name: ["z"],
214468
+ path: "zod"
214041
214469
  }),
214042
214470
  /* @__PURE__ */ jsx(File.Import, {
214043
- name: [
214044
- (_a = type.schemas.request) == null ? void 0 : _a.name,
214045
- type.schemas.response.name,
214046
- (_b = type.schemas.pathParams) == null ? void 0 : _b.name,
214047
- (_c = type.schemas.queryParams) == null ? void 0 : _c.name,
214048
- (_d = type.schemas.headerParams) == null ? void 0 : _d.name,
214049
- ...((_e = type.schemas.statusCodes) == null ? void 0 : _e.map((item) => item.name)) || []
214050
- ].filter(Boolean),
214051
- root: mcp.file.path,
214052
- path: type.file.path,
214053
- isTypeOnly: true
214471
+ name: ["StdioServerTransport"],
214472
+ path: "@modelcontextprotocol/sdk/server/stdio"
214054
214473
  }),
214055
- /* @__PURE__ */ jsxs(Client, {
214056
- name: mcp.name,
214057
- isConfigurable: false,
214058
- returnType: "Promise<CallToolResult>",
214059
- baseURL: options.client.baseURL,
214060
- operation,
214061
- typeSchemas: type.schemas,
214062
- zodSchemas: void 0,
214063
- dataReturnType: options.client.dataReturnType || "data",
214064
- paramsType: "object",
214065
- paramsCasing: ((_f = options.client) == null ? void 0 : _f.paramsCasing) || options.paramsCasing,
214066
- pathParamsType: "object",
214067
- parser: "client",
214068
- children: [options.client.dataReturnType === "data" && `return {
214069
- content: [
214070
- {
214071
- type: 'text',
214072
- text: JSON.stringify(res.data)
214073
- }
214074
- ],
214075
- structuredContent: { data: res.data }
214076
- }`, options.client.dataReturnType === "full" && `return {
214077
- content: [
214078
- {
214079
- type: 'text',
214080
- text: JSON.stringify(res)
214081
- }
214082
- ],
214083
- structuredContent: { data: res.data }
214084
- }`]
214474
+ imports,
214475
+ /* @__PURE__ */ jsx(Server, {
214476
+ name,
214477
+ serverName: (_c = (_b = (_a2 = adapter.rootNode) == null ? void 0 : _a2.meta) == null ? void 0 : _b.title) != null ? _c : "server",
214478
+ serverVersion: (_f = (_e = (_d = adapter.rootNode) == null ? void 0 : _d.meta) == null ? void 0 : _e.version) != null ? _f : "0.0.0",
214479
+ paramsCasing,
214480
+ operations: operationsMapped
214085
214481
  })
214086
214482
  ]
214087
- });
214483
+ }), /* @__PURE__ */ jsx(File, {
214484
+ baseName: jsonFile.baseName,
214485
+ path: jsonFile.path,
214486
+ meta: jsonFile.meta,
214487
+ children: /* @__PURE__ */ jsx(File.Source, {
214488
+ name,
214489
+ children: `
214490
+ {
214491
+ "mcpServers": {
214492
+ "${((_h = (_g = adapter.rootNode) == null ? void 0 : _g.meta) == null ? void 0 : _h.title) || "server"}": {
214493
+ "type": "stdio",
214494
+ "command": "npx",
214495
+ "args": ["tsx", "${path$2.relative(path$2.dirname(jsonFile.path), serverFile.path)}"]
214496
+ }
214497
+ }
214498
+ }
214499
+ `
214500
+ })
214501
+ })] });
214088
214502
  }
214089
214503
  });
214090
- const serverGenerator = createReactGenerator({
214504
+ const serverGeneratorLegacy = defineGenerator({
214091
214505
  name: "operations",
214092
- Operations({ operations, generator, plugin }) {
214093
- var _a, _b;
214094
- const driver = useDriver();
214095
- const { options } = plugin;
214096
- const oas = useOas();
214097
- const { getFile, getName, getSchemas } = useOperationManager(generator);
214506
+ type: "react",
214507
+ Operations({ nodes, adapter, options, config, driver, resolver, plugin }) {
214508
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
214509
+ const { output, paramsCasing, group } = options;
214510
+ const root = path$2.resolve(config.root, config.output.path);
214511
+ const pluginZod = driver.getPlugin(pluginZodName);
214512
+ if (!(pluginZod == null ? void 0 : pluginZod.resolver)) return;
214098
214513
  const name = "server";
214099
- const file = driver.getFile({
214100
- name,
214101
- extname: ".ts",
214102
- pluginName: plugin.name
214103
- });
214104
- const jsonFile = driver.getFile({
214105
- name: ".mcp",
214106
- extname: ".json",
214107
- pluginName: plugin.name
214108
- });
214109
- const operationsMapped = operations.map((operation) => {
214514
+ const serverFile = {
214515
+ baseName: "server.ts",
214516
+ path: path$2.resolve(root, output.path, "server.ts"),
214517
+ meta: { pluginName: plugin.name }
214518
+ };
214519
+ const jsonFile = {
214520
+ baseName: ".mcp.json",
214521
+ path: path$2.resolve(root, output.path, ".mcp.json"),
214522
+ meta: { pluginName: plugin.name }
214523
+ };
214524
+ const operationsMapped = nodes.map((node) => {
214525
+ var _a3, _b2, _c2, _d2, _e2, _f2;
214526
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
214527
+ const casedParams = caseParams(transformedNode.parameters, paramsCasing);
214528
+ const queryParams = casedParams.filter((p) => p.in === "query");
214529
+ const headerParams = casedParams.filter((p) => p.in === "header");
214530
+ const mcpFile = resolver.resolveFile({
214531
+ name: transformedNode.operationId,
214532
+ extname: ".ts",
214533
+ tag: (_a3 = transformedNode.tags[0]) != null ? _a3 : "default",
214534
+ path: transformedNode.path
214535
+ }, {
214536
+ root,
214537
+ output,
214538
+ group
214539
+ });
214540
+ const zodFile = pluginZod == null ? void 0 : pluginZod.resolver.resolveFile({
214541
+ name: transformedNode.operationId,
214542
+ extname: ".ts",
214543
+ tag: (_b2 = transformedNode.tags[0]) != null ? _b2 : "default",
214544
+ path: transformedNode.path
214545
+ }, {
214546
+ root,
214547
+ output: (_d2 = (_c2 = pluginZod == null ? void 0 : pluginZod.options) == null ? void 0 : _c2.output) != null ? _d2 : output,
214548
+ group: (_e2 = pluginZod == null ? void 0 : pluginZod.options) == null ? void 0 : _e2.group
214549
+ });
214550
+ const requestName = ((_f2 = transformedNode.requestBody) == null ? void 0 : _f2.schema) ? pluginZod == null ? void 0 : pluginZod.resolver.resolveDataName(transformedNode) : void 0;
214551
+ const responseName = pluginZod == null ? void 0 : pluginZod.resolver.resolveResponseName(transformedNode);
214552
+ const zodQueryParams = queryParams.length ? pluginZod == null ? void 0 : pluginZod.resolver.resolveQueryParamsName(transformedNode, queryParams[0]) : void 0;
214553
+ const zodHeaderParams = headerParams.length ? pluginZod == null ? void 0 : pluginZod.resolver.resolveHeaderParamsName(transformedNode, headerParams[0]) : void 0;
214110
214554
  return {
214111
214555
  tool: {
214112
- name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,
214113
- title: operation.getSummary() || void 0,
214114
- description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`
214556
+ name: transformedNode.operationId,
214557
+ title: transformedNode.summary || void 0,
214558
+ description: transformedNode.description || `Make a ${transformedNode.method.toUpperCase()} request to ${transformedNode.path}`
214115
214559
  },
214116
214560
  mcp: {
214117
- name: getName(operation, {
214118
- type: "function",
214119
- suffix: "handler"
214120
- }),
214121
- file: getFile(operation)
214561
+ name: resolver.resolveName(transformedNode.operationId),
214562
+ file: mcpFile
214122
214563
  },
214123
214564
  zod: {
214124
- name: getName(operation, {
214125
- type: "function",
214126
- pluginName: pluginZodName
214127
- }),
214128
- schemas: getSchemas(operation, {
214129
- pluginName: pluginZodName,
214130
- type: "function"
214131
- }),
214132
- file: getFile(operation, { pluginName: pluginZodName })
214565
+ pathParams: [],
214566
+ queryParams: zodQueryParams,
214567
+ headerParams: zodHeaderParams,
214568
+ requestName,
214569
+ responseName,
214570
+ file: zodFile
214133
214571
  },
214134
- type: { schemas: getSchemas(operation, {
214135
- pluginName: pluginTsName,
214136
- type: "type"
214137
- }) }
214572
+ node: transformedNode
214138
214573
  };
214139
214574
  });
214140
214575
  const imports = operationsMapped.flatMap(({ mcp, zod }) => {
214141
- var _a2, _b2, _c, _d, _e;
214576
+ const zodNames = [
214577
+ zod.queryParams,
214578
+ zod.headerParams,
214579
+ zod.requestName,
214580
+ zod.responseName
214581
+ ].filter(Boolean);
214142
214582
  return [/* @__PURE__ */ jsx(File.Import, {
214143
214583
  name: [mcp.name],
214144
- root: file.path,
214584
+ root: serverFile.path,
214145
214585
  path: mcp.file.path
214146
- }, mcp.name), /* @__PURE__ */ jsx(File.Import, {
214147
- name: [
214148
- (_a2 = zod.schemas.request) == null ? void 0 : _a2.name,
214149
- (_b2 = zod.schemas.pathParams) == null ? void 0 : _b2.name,
214150
- (_c = zod.schemas.queryParams) == null ? void 0 : _c.name,
214151
- (_d = zod.schemas.headerParams) == null ? void 0 : _d.name,
214152
- (_e = zod.schemas.response) == null ? void 0 : _e.name
214153
- ].filter(Boolean),
214154
- root: file.path,
214586
+ }, mcp.name), zod.file && zodNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
214587
+ name: zodNames.sort(),
214588
+ root: serverFile.path,
214155
214589
  path: zod.file.path
214156
- }, zod.name)];
214590
+ }, `zod-${mcp.name}`)].filter(Boolean);
214157
214591
  });
214158
214592
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(File, {
214159
- baseName: file.baseName,
214160
- path: file.path,
214161
- meta: file.meta,
214162
- banner: getBanner({
214163
- oas,
214164
- output: options.output,
214165
- config: driver.config
214593
+ baseName: serverFile.baseName,
214594
+ path: serverFile.path,
214595
+ meta: serverFile.meta,
214596
+ banner: resolver.resolveBanner(adapter.rootNode, {
214597
+ output,
214598
+ config
214166
214599
  }),
214167
- footer: getFooter({
214168
- oas,
214169
- output: options.output
214600
+ footer: resolver.resolveFooter(adapter.rootNode, {
214601
+ output,
214602
+ config
214170
214603
  }),
214171
214604
  children: [
214172
214605
  /* @__PURE__ */ jsx(File.Import, {
@@ -214184,9 +214617,9 @@ const serverGenerator = createReactGenerator({
214184
214617
  imports,
214185
214618
  /* @__PURE__ */ jsx(Server, {
214186
214619
  name,
214187
- serverName: (_a = oas.api.info) == null ? void 0 : _a.title,
214188
- serverVersion: oas.getVersion(),
214189
- paramsCasing: options.paramsCasing,
214620
+ serverName: (_c = (_b = (_a2 = adapter.rootNode) == null ? void 0 : _a2.meta) == null ? void 0 : _b.title) != null ? _c : "server",
214621
+ serverVersion: (_h = (_g = (_d = adapter.document) == null ? void 0 : _d.openapi) != null ? _g : (_f = (_e = adapter.rootNode) == null ? void 0 : _e.meta) == null ? void 0 : _f.version) != null ? _h : "0.0.0",
214622
+ paramsCasing,
214190
214623
  operations: operationsMapped
214191
214624
  })
214192
214625
  ]
@@ -214199,10 +214632,10 @@ const serverGenerator = createReactGenerator({
214199
214632
  children: `
214200
214633
  {
214201
214634
  "mcpServers": {
214202
- "${((_b = oas.api.info) == null ? void 0 : _b.title) || "server"}": {
214635
+ "${((_j = (_i = adapter.rootNode) == null ? void 0 : _i.meta) == null ? void 0 : _j.title) || "server"}": {
214203
214636
  "type": "stdio",
214204
214637
  "command": "npx",
214205
- "args": ["tsx", "${path$2.relative(path$2.dirname(jsonFile.path), file.path)}"]
214638
+ "args": ["tsx", "${path$2.relative(path$2.dirname(jsonFile.path), serverFile.path)}"]
214206
214639
  }
214207
214640
  }
214208
214641
  }
@@ -214211,65 +214644,87 @@ const serverGenerator = createReactGenerator({
214211
214644
  })] });
214212
214645
  }
214213
214646
  });
214214
-
214647
+ const resolverMcp = defineResolver(() => ({
214648
+ name: "default",
214649
+ pluginName: "plugin-mcp",
214650
+ default(name, type) {
214651
+ if (type === "file") return camelCase$6(name, { isFile: true });
214652
+ return camelCase$6(name, { suffix: "handler" });
214653
+ },
214654
+ resolveName(name) {
214655
+ return this.default(name, "function");
214656
+ }
214657
+ }));
214658
+ const presets = definePresets({
214659
+ default: {
214660
+ name: "default",
214661
+ resolver: resolverMcp,
214662
+ generators: [mcpGenerator, serverGenerator]
214663
+ },
214664
+ kubbV4: {
214665
+ name: "kubbV4",
214666
+ resolver: resolverMcp,
214667
+ generators: [mcpGenerator, serverGeneratorLegacy]
214668
+ }
214669
+ });
214215
214670
  const pluginMcpName = "plugin-mcp";
214216
214671
  const pluginMcp = createPlugin((options) => {
214217
- var _a, _b, _c, _d;
214672
+ var _a2, _b;
214218
214673
  const { output = {
214219
214674
  path: "mcp",
214220
214675
  barrelType: "named"
214221
- }, group, exclude = [], include, override = [], transformers = {}, generators = [mcpGenerator, serverGenerator].filter(Boolean), contentType, paramsCasing, client } = options;
214222
- const clientName = (_a = client == null ? void 0 : client.client) != null ? _a : "axios";
214676
+ }, group, exclude = [], include, override = [], paramsCasing, client, compatibilityPreset = "default", resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
214677
+ const clientName = (_a2 = client == null ? void 0 : client.client) != null ? _a2 : "axios";
214223
214678
  const clientImportPath = (_b = client == null ? void 0 : client.importPath) != null ? _b : !(client == null ? void 0 : client.bundle) ? `@kubb/plugin-client/clients/${clientName}` : void 0;
214679
+ const preset = getPreset({
214680
+ preset: compatibilityPreset,
214681
+ presets,
214682
+ resolver: userResolver,
214683
+ transformer: userTransformer,
214684
+ generators: userGenerators
214685
+ });
214224
214686
  return {
214225
214687
  name: pluginMcpName,
214226
- options: {
214227
- output,
214228
- group,
214229
- paramsCasing,
214230
- client: {
214231
- client: clientName,
214232
- clientType: (_c = client == null ? void 0 : client.clientType) != null ? _c : "function",
214233
- importPath: clientImportPath,
214234
- dataReturnType: (_d = client == null ? void 0 : client.dataReturnType) != null ? _d : "data",
214235
- bundle: client == null ? void 0 : client.bundle,
214236
- baseURL: client == null ? void 0 : client.baseURL,
214237
- paramsCasing: client == null ? void 0 : client.paramsCasing
214238
- }
214688
+ get resolver() {
214689
+ return preset.resolver;
214239
214690
  },
214240
- pre: [
214241
- pluginOasName,
214242
- pluginTsName,
214243
- pluginZodName
214244
- ].filter(Boolean),
214245
- resolvePath(baseName, pathMode, options2) {
214246
- var _a2, _b2;
214247
- const root = path$2.resolve(this.config.root, this.config.output.path);
214248
- if ((pathMode != null ? pathMode : getMode(path$2.resolve(root, output.path))) === "single")
214249
- return path$2.resolve(root, output.path);
214250
- if (group && (((_a2 = options2 == null ? void 0 : options2.group) == null ? void 0 : _a2.path) || ((_b2 = options2 == null ? void 0 : options2.group) == null ? void 0 : _b2.tag))) {
214251
- const groupName = (group == null ? void 0 : group.name) ? group.name : (ctx) => {
214252
- if ((group == null ? void 0 : group.type) === "path") return `${ctx.group.split("/")[1]}`;
214253
- return `${camelCase$6(ctx.group)}Requests`;
214254
- };
214255
- return path$2.resolve(root, output.path, groupName({ group: group.type === "path" ? options2.group.path : options2.group.tag }), baseName);
214256
- }
214257
- return path$2.resolve(root, output.path, baseName);
214691
+ get transformer() {
214692
+ return preset.transformer;
214258
214693
  },
214259
- resolveName(name, type) {
214260
- var _a2;
214261
- const resolvedName = camelCase$6(name, { isFile: type === "file" });
214262
- if (type) return ((_a2 = transformers == null ? void 0 : transformers.name) == null ? void 0 : _a2.call(transformers, resolvedName, type)) || resolvedName;
214263
- return resolvedName;
214694
+ get options() {
214695
+ var _a3, _b2;
214696
+ return {
214697
+ output,
214698
+ group: group ? {
214699
+ ...group,
214700
+ name: group.name ? group.name : (ctx) => {
214701
+ if (group.type === "path") return `${ctx.group.split("/")[1]}`;
214702
+ return `${camelCase$6(ctx.group)}Requests`;
214703
+ }
214704
+ } : void 0,
214705
+ paramsCasing,
214706
+ client: {
214707
+ client: clientName,
214708
+ clientType: (_a3 = client == null ? void 0 : client.clientType) != null ? _a3 : "function",
214709
+ importPath: clientImportPath,
214710
+ dataReturnType: (_b2 = client == null ? void 0 : client.dataReturnType) != null ? _b2 : "data",
214711
+ bundle: client == null ? void 0 : client.bundle,
214712
+ baseURL: client == null ? void 0 : client.baseURL,
214713
+ paramsCasing: client == null ? void 0 : client.paramsCasing
214714
+ },
214715
+ resolver: preset.resolver
214716
+ };
214264
214717
  },
214718
+ pre: [pluginTsName, pluginZodName].filter(Boolean),
214265
214719
  async install() {
214266
- var _a2;
214267
- const root = path$2.resolve(this.config.root, this.config.output.path);
214268
- const mode = getMode(path$2.resolve(root, output.path));
214269
- const oas = await this.getOas();
214270
- const baseURL = await this.getBaseURL();
214271
- if (baseURL) this.plugin.options.client.baseURL = baseURL;
214272
- const hasClientPlugin = !!this.getPlugin(pluginClientName);
214720
+ var _a3, _b2, _c;
214721
+ const { config, fabric, plugin, adapter, rootNode, driver } = this;
214722
+ const root = path$2.resolve(config.root, config.output.path);
214723
+ const resolver = preset.resolver;
214724
+ if (!adapter) throw new Error("Plugin cannot work without adapter being set");
214725
+ const baseURL = (_b2 = (_a3 = adapter.rootNode) == null ? void 0 : _a3.meta) == null ? void 0 : _b2.baseURL;
214726
+ if (baseURL) this.plugin.options.client.baseURL = this.plugin.options.client.baseURL || baseURL;
214727
+ const hasClientPlugin = !!driver.getPlugin(pluginClientName);
214273
214728
  if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.addFile({
214274
214729
  baseName: "fetch.ts",
214275
214730
  path: path$2.resolve(root, ".kubb/fetch.ts"),
@@ -214294,21 +214749,37 @@ const pluginMcp = createPlugin((options) => {
214294
214749
  imports: [],
214295
214750
  exports: []
214296
214751
  });
214297
- const files = await new OperationGenerator(this.plugin.options, {
214298
- fabric: this.fabric,
214299
- oas,
214300
- driver: this.driver,
214301
- events: this.events,
214302
- plugin: this.plugin,
214303
- contentType,
214752
+ const collectedOperations = [];
214753
+ const generatorContext = {
214754
+ generators: preset.generators,
214755
+ plugin,
214756
+ resolver,
214304
214757
  exclude,
214305
214758
  include,
214306
214759
  override,
214307
- mode
214308
- }).build(...generators);
214309
- await this.upsertFile(...files);
214760
+ fabric,
214761
+ adapter,
214762
+ config,
214763
+ driver
214764
+ };
214765
+ await walk(rootNode, {
214766
+ depth: "shallow",
214767
+ async schema(schemaNode) {
214768
+ await runGeneratorSchema(schemaNode, generatorContext);
214769
+ },
214770
+ async operation(operationNode) {
214771
+ if (resolver.resolveOptions(operationNode, {
214772
+ options: plugin.options,
214773
+ exclude,
214774
+ include,
214775
+ override
214776
+ }) !== null) collectedOperations.push(operationNode);
214777
+ await runGeneratorOperation(operationNode, generatorContext);
214778
+ }
214779
+ });
214780
+ await runGeneratorOperations(collectedOperations, generatorContext);
214310
214781
  const barrelFiles = await getBarrelFiles(this.fabric.files, {
214311
- type: (_a2 = output.barrelType) != null ? _a2 : "named",
214782
+ type: (_c = output.barrelType) != null ? _c : "named",
214312
214783
  root,
214313
214784
  output,
214314
214785
  meta: { pluginName: this.plugin.name }
@@ -215351,7 +215822,7 @@ function InfiniteQuery$1({ name, queryKeyTypeName, queryOptionsName, queryKeyNam
215351
215822
  export: true,
215352
215823
  generics: generics.join(", "),
215353
215824
  params: params.toConstructor(),
215354
- JSDoc: { comments: getComments(operation) },
215825
+ JSDoc: { comments: getComments$1(operation) },
215355
215826
  children: `
215356
215827
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
215357
215828
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -215710,7 +216181,7 @@ function Mutation$4({ name, mutationOptionsName, paramsCasing, pathParamsType, d
215710
216181
  name,
215711
216182
  export: true,
215712
216183
  params: params.toConstructor(),
215713
- JSDoc: { comments: getComments(operation) },
216184
+ JSDoc: { comments: getComments$1(operation) },
215714
216185
  generics: ["TContext"],
215715
216186
  children: `
215716
216187
  const { mutation = {}, client: config = {} } = options ?? {}
@@ -215852,7 +216323,7 @@ function Query$4({ name, queryKeyTypeName, queryOptionsName, queryKeyName, param
215852
216323
  export: true,
215853
216324
  generics: generics.join(", "),
215854
216325
  params: params.toConstructor(),
215855
- JSDoc: { comments: getComments(operation) },
216326
+ JSDoc: { comments: getComments$1(operation) },
215856
216327
  children: `
215857
216328
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
215858
216329
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -215993,7 +216464,7 @@ function SuspenseInfiniteQuery({ name, queryKeyTypeName, queryOptionsName, query
215993
216464
  export: true,
215994
216465
  generics: generics.join(", "),
215995
216466
  params: params.toConstructor(),
215996
- JSDoc: { comments: getComments(operation) },
216467
+ JSDoc: { comments: getComments$1(operation) },
215997
216468
  children: `
215998
216469
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
215999
216470
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -216307,7 +216778,7 @@ function SuspenseQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
216307
216778
  export: true,
216308
216779
  generics: generics.join(", "),
216309
216780
  params: params.toConstructor(),
216310
- JSDoc: { comments: getComments(operation) },
216781
+ JSDoc: { comments: getComments$1(operation) },
216311
216782
  children: `
216312
216783
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
216313
216784
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -218334,7 +218805,7 @@ function Mutation$3({ name, clientName, paramsCasing, paramsType, pathParamsType
218334
218805
  name,
218335
218806
  export: true,
218336
218807
  params: params.toConstructor(),
218337
- JSDoc: { comments: getComments(operation) },
218808
+ JSDoc: { comments: getComments$1(operation) },
218338
218809
  generics: ["TContext"],
218339
218810
  children: `
218340
218811
  const { mutation = {}, client: config = {} } = options ?? {}
@@ -218587,7 +219058,7 @@ function Query$3({ name, queryKeyTypeName, queryOptionsName, queryKeyName, param
218587
219058
  export: true,
218588
219059
  generics: generics.join(", "),
218589
219060
  params: params.toConstructor(),
218590
- JSDoc: { comments: getComments(operation) },
219061
+ JSDoc: { comments: getComments$1(operation) },
218591
219062
  children: `
218592
219063
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
218593
219064
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -219527,7 +219998,7 @@ function Mutation$2({ name, clientName, paramsCasing, paramsType, pathParamsType
219527
219998
  name,
219528
219999
  export: true,
219529
220000
  params: params.toConstructor(),
219530
- JSDoc: { comments: getComments(operation) },
220001
+ JSDoc: { comments: getComments$1(operation) },
219531
220002
  generics: ["TContext"],
219532
220003
  children: `
219533
220004
  const { mutation = {}, client: config = {} } = options ?? {}
@@ -219780,7 +220251,7 @@ function Query$2({ name, queryKeyTypeName, queryOptionsName, queryKeyName, param
219780
220251
  export: true,
219781
220252
  generics: generics.join(", "),
219782
220253
  params: params.toConstructor(),
219783
- JSDoc: { comments: getComments(operation) },
220254
+ JSDoc: { comments: getComments$1(operation) },
219784
220255
  children: `
219785
220256
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
219786
220257
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -220753,7 +221224,7 @@ function Mutation$1({ name, clientName, mutationKeyName, mutationKeyTypeName, pa
220753
221224
  name,
220754
221225
  export: true,
220755
221226
  params: params2.toConstructor(),
220756
- JSDoc: { comments: getComments(operation) },
221227
+ JSDoc: { comments: getComments$1(operation) },
220757
221228
  children: `
220758
221229
  const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
220759
221230
  const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})
@@ -220790,7 +221261,7 @@ function Mutation$1({ name, clientName, mutationKeyName, mutationKeyTypeName, pa
220790
221261
  name,
220791
221262
  export: true,
220792
221263
  params: params.toConstructor(),
220793
- JSDoc: { comments: getComments(operation) },
221264
+ JSDoc: { comments: getComments$1(operation) },
220794
221265
  children: `
220795
221266
  const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
220796
221267
  const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})
@@ -221009,7 +221480,7 @@ function Query$1({ name, typeSchemas, queryKeyName, queryKeyTypeName, queryOptio
221009
221480
  name,
221010
221481
  export: true,
221011
221482
  params: params.toConstructor(),
221012
- JSDoc: { comments: getComments(operation) },
221483
+ JSDoc: { comments: getComments$1(operation) },
221013
221484
  children: `
221014
221485
  const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}
221015
221486
 
@@ -222067,7 +222538,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
222067
222538
  export: true,
222068
222539
  generics: generics.join(", "),
222069
222540
  params: params.toConstructor(),
222070
- JSDoc: { comments: getComments(operation) },
222541
+ JSDoc: { comments: getComments$1(operation) },
222071
222542
  children: `
222072
222543
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
222073
222544
  const { client: queryClient, ...resolvedOptions } = queryConfig
@@ -222389,7 +222860,7 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
222389
222860
  name,
222390
222861
  export: true,
222391
222862
  params: params.toConstructor(),
222392
- JSDoc: { comments: getComments(operation) },
222863
+ JSDoc: { comments: getComments$1(operation) },
222393
222864
  generics: ["TContext"],
222394
222865
  children: `
222395
222866
  const { mutation = {}, client: config = {} } = options ?? {}
@@ -222542,7 +223013,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
222542
223013
  export: true,
222543
223014
  generics: generics.join(", "),
222544
223015
  params: params.toConstructor(),
222545
- JSDoc: { comments: getComments(operation) },
223016
+ JSDoc: { comments: getComments$1(operation) },
222546
223017
  children: `
222547
223018
  const { query: queryConfig = {}, client: config = {} } = options ?? {}
222548
223019
  const { client: queryClient, ...resolvedOptions } = queryConfig