@flexprice/mcp-server 2.1.5 → 2.1.9

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.
Files changed (202) hide show
  1. package/bin/mcp-server.js +1020 -923
  2. package/bin/mcp-server.js.map +47 -55
  3. package/bun.lock +49 -41
  4. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.d.ts +16 -0
  5. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.d.ts.map +1 -0
  6. package/esm/funcs/{subscriptionsResumeSubscription.js → subscriptionsQuerySubscriptionLineItems.js} +10 -16
  7. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.js.map +1 -0
  8. package/esm/landing-page.d.ts.map +1 -1
  9. package/esm/landing-page.js +8 -2
  10. package/esm/landing-page.js.map +1 -1
  11. package/esm/lib/config.d.ts +3 -3
  12. package/esm/lib/config.js +3 -3
  13. package/esm/mcp-server/cli/serve/impl.js +1 -1
  14. package/esm/mcp-server/cli/serve/impl.js.map +1 -1
  15. package/esm/mcp-server/mcp-server.js +1 -1
  16. package/esm/mcp-server/server.d.ts.map +1 -1
  17. package/esm/mcp-server/server.js +3 -7
  18. package/esm/mcp-server/server.js.map +1 -1
  19. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.d.ts +7 -0
  20. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.d.ts.map +1 -0
  21. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.js +35 -0
  22. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.js.map +1 -0
  23. package/esm/models/createpricerequest.d.ts +1 -1
  24. package/esm/models/createpricerequest.d.ts.map +1 -1
  25. package/esm/models/createpricerequest.js +1 -1
  26. package/esm/models/createpricerequest.js.map +1 -1
  27. package/esm/models/createsubscriptionrequest.d.ts +1 -2
  28. package/esm/models/createsubscriptionrequest.d.ts.map +1 -1
  29. package/esm/models/createsubscriptionrequest.js +1 -2
  30. package/esm/models/createsubscriptionrequest.js.map +1 -1
  31. package/esm/models/customerfilter.d.ts +3 -0
  32. package/esm/models/customerfilter.d.ts.map +1 -1
  33. package/esm/models/customerfilter.js +1 -0
  34. package/esm/models/customerfilter.js.map +1 -1
  35. package/esm/models/executesubscriptionmodifyrequest.d.ts +2 -0
  36. package/esm/models/executesubscriptionmodifyrequest.d.ts.map +1 -1
  37. package/esm/models/executesubscriptionmodifyrequest.js +3 -0
  38. package/esm/models/executesubscriptionmodifyrequest.js.map +1 -1
  39. package/esm/models/groupedinvoicingaction.d.ts +12 -0
  40. package/esm/models/groupedinvoicingaction.d.ts.map +1 -0
  41. package/esm/models/groupedinvoicingaction.js +13 -0
  42. package/esm/models/groupedinvoicingaction.js.map +1 -0
  43. package/esm/models/invoicebillingreason.d.ts +4 -0
  44. package/esm/models/invoicebillingreason.d.ts.map +1 -1
  45. package/esm/models/invoicebillingreason.js +4 -0
  46. package/esm/models/invoicebillingreason.js.map +1 -1
  47. package/esm/models/listsubscriptionlineitemsresponse.d.ts +9 -0
  48. package/esm/models/listsubscriptionlineitemsresponse.d.ts.map +1 -0
  49. package/esm/models/listsubscriptionlineitemsresponse.js +11 -0
  50. package/esm/models/listsubscriptionlineitemsresponse.js.map +1 -0
  51. package/esm/models/planfilter.d.ts +3 -0
  52. package/esm/models/planfilter.d.ts.map +1 -1
  53. package/esm/models/planfilter.js +1 -0
  54. package/esm/models/planfilter.js.map +1 -1
  55. package/esm/models/priceprice.d.ts +1 -1
  56. package/esm/models/priceprice.d.ts.map +1 -1
  57. package/esm/models/priceprice.js +1 -1
  58. package/esm/models/priceprice.js.map +1 -1
  59. package/esm/models/priceresponse.d.ts +1 -1
  60. package/esm/models/priceresponse.d.ts.map +1 -1
  61. package/esm/models/priceresponse.js +1 -1
  62. package/esm/models/priceresponse.js.map +1 -1
  63. package/esm/models/querysubscriptionlineitemsop.d.ts +6 -0
  64. package/esm/models/querysubscriptionlineitemsop.d.ts.map +1 -0
  65. package/esm/models/querysubscriptionlineitemsop.js +11 -0
  66. package/esm/models/querysubscriptionlineitemsop.js.map +1 -0
  67. package/esm/models/submodifygroupedinvoicingparams.d.ts +9 -0
  68. package/esm/models/submodifygroupedinvoicingparams.d.ts.map +1 -0
  69. package/esm/models/submodifygroupedinvoicingparams.js +11 -0
  70. package/esm/models/submodifygroupedinvoicingparams.js.map +1 -0
  71. package/esm/models/subscriptionfilter.d.ts +1 -0
  72. package/esm/models/subscriptionfilter.d.ts.map +1 -1
  73. package/esm/models/subscriptionfilter.js +1 -0
  74. package/esm/models/subscriptionfilter.js.map +1 -1
  75. package/esm/models/subscriptioninheritanceconfig.d.ts +1 -0
  76. package/esm/models/subscriptioninheritanceconfig.d.ts.map +1 -1
  77. package/esm/models/subscriptioninheritanceconfig.js +6 -3
  78. package/esm/models/subscriptioninheritanceconfig.js.map +1 -1
  79. package/esm/models/subscriptionlineitemfilter.d.ts +39 -0
  80. package/esm/models/subscriptionlineitemfilter.d.ts.map +1 -0
  81. package/esm/models/subscriptionlineitemfilter.js +39 -0
  82. package/esm/models/subscriptionlineitemfilter.js.map +1 -0
  83. package/esm/models/subscriptionlineitemresponse.d.ts +0 -1
  84. package/esm/models/subscriptionlineitemresponse.d.ts.map +1 -1
  85. package/esm/models/subscriptionlineitemresponse.js +0 -1
  86. package/esm/models/subscriptionlineitemresponse.js.map +1 -1
  87. package/esm/models/subscriptionmodifytype.d.ts +2 -0
  88. package/esm/models/subscriptionmodifytype.d.ts.map +1 -1
  89. package/esm/models/subscriptionmodifytype.js +2 -0
  90. package/esm/models/subscriptionmodifytype.js.map +1 -1
  91. package/esm/models/subscriptionpricecreaterequest.d.ts +1 -1
  92. package/esm/models/subscriptionpricecreaterequest.d.ts.map +1 -1
  93. package/esm/models/subscriptionpricecreaterequest.js +1 -1
  94. package/esm/models/subscriptionpricecreaterequest.js.map +1 -1
  95. package/esm/models/subscriptionsubscriptionlineitem.d.ts +0 -1
  96. package/esm/models/subscriptionsubscriptionlineitem.d.ts.map +1 -1
  97. package/esm/models/subscriptionsubscriptionlineitem.js +0 -1
  98. package/esm/models/subscriptionsubscriptionlineitem.js.map +1 -1
  99. package/esm/models/subscriptiontype.d.ts +4 -0
  100. package/esm/models/subscriptiontype.d.ts.map +1 -1
  101. package/esm/models/subscriptiontype.js +4 -0
  102. package/esm/models/subscriptiontype.js.map +1 -1
  103. package/esm/tool-names.d.ts.map +1 -1
  104. package/esm/tool-names.js +4 -12
  105. package/esm/tool-names.js.map +1 -1
  106. package/esm/tsconfig.tsbuildinfo +1 -1
  107. package/esm/types/bigint.d.ts.map +1 -1
  108. package/esm/types/bigint.js +4 -3
  109. package/esm/types/bigint.js.map +1 -1
  110. package/manifest.json +5 -13
  111. package/package.json +1 -1
  112. package/src/funcs/{subscriptionsListSubscriptionPauses.ts → subscriptionsQuerySubscriptionLineItems.ts} +15 -23
  113. package/src/landing-page.ts +8 -2
  114. package/src/lib/config.ts +3 -3
  115. package/src/mcp-server/cli/serve/impl.ts +1 -1
  116. package/src/mcp-server/mcp-server.ts +1 -1
  117. package/src/mcp-server/server.ts +3 -7
  118. package/src/mcp-server/tools/{subscriptionsListSubscriptionPauses.ts → subscriptionsQuerySubscriptionLineItems.ts} +8 -8
  119. package/src/models/createpricerequest.ts +2 -2
  120. package/src/models/createsubscriptionrequest.ts +4 -4
  121. package/src/models/customerfilter.ts +2 -0
  122. package/src/models/executesubscriptionmodifyrequest.ts +7 -0
  123. package/src/models/groupedinvoicingaction.ts +17 -0
  124. package/src/models/invoicebillingreason.ts +4 -0
  125. package/src/models/listsubscriptionlineitemsresponse.ts +25 -0
  126. package/src/models/planfilter.ts +2 -0
  127. package/src/models/priceprice.ts +3 -3
  128. package/src/models/priceresponse.ts +3 -3
  129. package/src/models/querysubscriptionlineitemsop.ts +21 -0
  130. package/src/models/submodifygroupedinvoicingparams.ts +25 -0
  131. package/src/models/subscriptionfilter.ts +4 -0
  132. package/src/models/subscriptioninheritanceconfig.ts +15 -3
  133. package/src/models/subscriptionlineitemfilter.ts +77 -0
  134. package/src/models/subscriptionlineitemresponse.ts +0 -2
  135. package/src/models/subscriptionmodifytype.ts +2 -0
  136. package/src/models/subscriptionpricecreaterequest.ts +2 -2
  137. package/src/models/subscriptionsubscriptionlineitem.ts +0 -2
  138. package/src/models/subscriptiontype.ts +4 -0
  139. package/src/tool-names.ts +4 -12
  140. package/src/types/bigint.ts +18 -17
  141. package/esm/funcs/subscriptionsListSubscriptionPauses.d.ts +0 -16
  142. package/esm/funcs/subscriptionsListSubscriptionPauses.d.ts.map +0 -1
  143. package/esm/funcs/subscriptionsListSubscriptionPauses.js +0 -87
  144. package/esm/funcs/subscriptionsListSubscriptionPauses.js.map +0 -1
  145. package/esm/funcs/subscriptionsPauseSubscription.d.ts +0 -16
  146. package/esm/funcs/subscriptionsPauseSubscription.d.ts.map +0 -1
  147. package/esm/funcs/subscriptionsPauseSubscription.js +0 -88
  148. package/esm/funcs/subscriptionsPauseSubscription.js.map +0 -1
  149. package/esm/funcs/subscriptionsResumeSubscription.d.ts +0 -16
  150. package/esm/funcs/subscriptionsResumeSubscription.d.ts.map +0 -1
  151. package/esm/funcs/subscriptionsResumeSubscription.js.map +0 -1
  152. package/esm/mcp-server/tools/subscriptionsListSubscriptionPauses.d.ts +0 -7
  153. package/esm/mcp-server/tools/subscriptionsListSubscriptionPauses.d.ts.map +0 -1
  154. package/esm/mcp-server/tools/subscriptionsListSubscriptionPauses.js +0 -35
  155. package/esm/mcp-server/tools/subscriptionsListSubscriptionPauses.js.map +0 -1
  156. package/esm/mcp-server/tools/subscriptionsPauseSubscription.d.ts +0 -7
  157. package/esm/mcp-server/tools/subscriptionsPauseSubscription.d.ts.map +0 -1
  158. package/esm/mcp-server/tools/subscriptionsPauseSubscription.js +0 -35
  159. package/esm/mcp-server/tools/subscriptionsPauseSubscription.js.map +0 -1
  160. package/esm/mcp-server/tools/subscriptionsResumeSubscription.d.ts +0 -7
  161. package/esm/mcp-server/tools/subscriptionsResumeSubscription.d.ts.map +0 -1
  162. package/esm/mcp-server/tools/subscriptionsResumeSubscription.js +0 -35
  163. package/esm/mcp-server/tools/subscriptionsResumeSubscription.js.map +0 -1
  164. package/esm/models/listsubscriptionpausesop.d.ts +0 -10
  165. package/esm/models/listsubscriptionpausesop.d.ts.map +0 -1
  166. package/esm/models/listsubscriptionpausesop.js +0 -14
  167. package/esm/models/listsubscriptionpausesop.js.map +0 -1
  168. package/esm/models/listsubscriptionpausesresponse.d.ts +0 -11
  169. package/esm/models/listsubscriptionpausesresponse.d.ts.map +0 -1
  170. package/esm/models/listsubscriptionpausesresponse.js +0 -10
  171. package/esm/models/listsubscriptionpausesresponse.js.map +0 -1
  172. package/esm/models/pausesubscriptionop.d.ts +0 -12
  173. package/esm/models/pausesubscriptionop.d.ts.map +0 -1
  174. package/esm/models/pausesubscriptionop.js +0 -16
  175. package/esm/models/pausesubscriptionop.js.map +0 -1
  176. package/esm/models/pausesubscriptionrequest.d.ts +0 -18
  177. package/esm/models/pausesubscriptionrequest.d.ts.map +0 -1
  178. package/esm/models/pausesubscriptionrequest.js +0 -15
  179. package/esm/models/pausesubscriptionrequest.js.map +0 -1
  180. package/esm/models/resumesubscriptionop.d.ts +0 -12
  181. package/esm/models/resumesubscriptionop.d.ts.map +0 -1
  182. package/esm/models/resumesubscriptionop.js +0 -16
  183. package/esm/models/resumesubscriptionop.js.map +0 -1
  184. package/esm/models/resumesubscriptionrequest.d.ts +0 -14
  185. package/esm/models/resumesubscriptionrequest.d.ts.map +0 -1
  186. package/esm/models/resumesubscriptionrequest.js +0 -11
  187. package/esm/models/resumesubscriptionrequest.js.map +0 -1
  188. package/esm/models/subscriptionpauseresponse.d.ts +0 -33
  189. package/esm/models/subscriptionpauseresponse.d.ts.map +0 -1
  190. package/esm/models/subscriptionpauseresponse.js +0 -30
  191. package/esm/models/subscriptionpauseresponse.js.map +0 -1
  192. package/src/funcs/subscriptionsPauseSubscription.ts +0 -153
  193. package/src/funcs/subscriptionsResumeSubscription.ts +0 -153
  194. package/src/mcp-server/tools/subscriptionsPauseSubscription.ts +0 -44
  195. package/src/mcp-server/tools/subscriptionsResumeSubscription.ts +0 -44
  196. package/src/models/listsubscriptionpausesop.ts +0 -29
  197. package/src/models/listsubscriptionpausesresponse.ts +0 -28
  198. package/src/models/pausesubscriptionop.ts +0 -39
  199. package/src/models/pausesubscriptionrequest.ts +0 -45
  200. package/src/models/resumesubscriptionop.ts +0 -39
  201. package/src/models/resumesubscriptionrequest.ts +0 -27
  202. package/src/models/subscriptionpauseresponse.ts +0 -74
package/bin/mcp-server.js CHANGED
@@ -85,10 +85,10 @@ function $constructor(name, initializer, params) {
85
85
  }
86
86
  Object.defineProperty(Definition, "name", { value: name });
87
87
  function _(def) {
88
- var _a;
88
+ var _a2;
89
89
  const inst = params?.Parent ? new Definition : this;
90
90
  init(inst, def);
91
- (_a = inst._zod).deferred ?? (_a.deferred = []);
91
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
92
92
  for (const fn of inst._zod.deferred) {
93
93
  fn();
94
94
  }
@@ -110,11 +110,8 @@ function config(newConfig) {
110
110
  Object.assign(globalConfig, newConfig);
111
111
  return globalConfig;
112
112
  }
113
- var NEVER, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig;
113
+ var _a, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig;
114
114
  var init_core = __esm(() => {
115
- NEVER = Object.freeze({
116
- status: "aborted"
117
- });
118
115
  $brand = Symbol("zod_brand");
119
116
  $ZodAsyncError = class $ZodAsyncError extends Error {
120
117
  constructor() {
@@ -127,7 +124,8 @@ var init_core = __esm(() => {
127
124
  this.name = "ZodEncodeError";
128
125
  }
129
126
  };
130
- globalConfig = {};
127
+ (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
128
+ globalConfig = globalThis.__zod_globalConfig;
131
129
  });
132
130
 
133
131
  // node_modules/zod/v4/core/util.js
@@ -172,6 +170,7 @@ __export(exports_util, {
172
170
  floatSafeRemainder: () => floatSafeRemainder,
173
171
  finalizeIssue: () => finalizeIssue,
174
172
  extend: () => extend,
173
+ explicitlyAborted: () => explicitlyAborted,
175
174
  escapeRegex: () => escapeRegex,
176
175
  esc: () => esc,
177
176
  defineLazy: () => defineLazy,
@@ -242,19 +241,12 @@ function cleanRegex(source) {
242
241
  return source.slice(start, end);
243
242
  }
244
243
  function floatSafeRemainder(val, step) {
245
- const valDecCount = (val.toString().split(".")[1] || "").length;
246
- const stepString = step.toString();
247
- let stepDecCount = (stepString.split(".")[1] || "").length;
248
- if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
249
- const match = stepString.match(/\d?e-(\d?)/);
250
- if (match?.[1]) {
251
- stepDecCount = Number.parseInt(match[1]);
252
- }
253
- }
254
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
255
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
256
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
257
- return valInt % stepInt / 10 ** decCount;
244
+ const ratio = val / step;
245
+ const roundedRatio = Math.round(ratio);
246
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
247
+ if (Math.abs(ratio - roundedRatio) < tolerance)
248
+ return 0;
249
+ return ratio - roundedRatio;
258
250
  }
259
251
  function defineLazy(object, key, getter) {
260
252
  let value = undefined;
@@ -353,6 +345,10 @@ function shallowClone(o) {
353
345
  return { ...o };
354
346
  if (Array.isArray(o))
355
347
  return [...o];
348
+ if (o instanceof Map)
349
+ return new Map(o);
350
+ if (o instanceof Set)
351
+ return new Set(o);
356
352
  return o;
357
353
  }
358
354
  function numKeys(data) {
@@ -521,6 +517,9 @@ function safeExtend(schema, shape) {
521
517
  return clone(schema, def);
522
518
  }
523
519
  function merge(a, b) {
520
+ if (a._zod.def.checks?.length) {
521
+ throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
522
+ }
524
523
  const def = mergeDefs(a._zod.def, {
525
524
  get shape() {
526
525
  const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
@@ -530,7 +529,7 @@ function merge(a, b) {
530
529
  get catchall() {
531
530
  return b._zod.def.catchall;
532
531
  },
533
- checks: []
532
+ checks: b._zod.def.checks ?? []
534
533
  });
535
534
  return clone(a, def);
536
535
  }
@@ -613,10 +612,20 @@ function aborted(x, startIndex = 0) {
613
612
  }
614
613
  return false;
615
614
  }
615
+ function explicitlyAborted(x, startIndex = 0) {
616
+ if (x.aborted === true)
617
+ return true;
618
+ for (let i = startIndex;i < x.issues.length; i++) {
619
+ if (x.issues[i]?.continue === false) {
620
+ return true;
621
+ }
622
+ }
623
+ return false;
624
+ }
616
625
  function prefixIssues(path, issues) {
617
626
  return issues.map((iss) => {
618
- var _a;
619
- (_a = iss).path ?? (_a.path = []);
627
+ var _a2;
628
+ (_a2 = iss).path ?? (_a2.path = []);
620
629
  iss.path.unshift(path);
621
630
  return iss;
622
631
  });
@@ -625,17 +634,14 @@ function unwrapMessage(message) {
625
634
  return typeof message === "string" ? message : message?.message;
626
635
  }
627
636
  function finalizeIssue(iss, ctx, config2) {
628
- const full = { ...iss, path: iss.path ?? [] };
629
- if (!iss.message) {
630
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
631
- full.message = message;
632
- }
633
- delete full.inst;
634
- delete full.continue;
635
- if (!ctx?.reportInput) {
636
- delete full.input;
637
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
638
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
639
+ rest.path ?? (rest.path = []);
640
+ rest.message = message;
641
+ if (ctx?.reportInput) {
642
+ rest.input = _input;
637
643
  }
638
- return full;
644
+ return rest;
639
645
  }
640
646
  function getSizableOrigin(input) {
641
647
  if (input instanceof Set)
@@ -777,9 +783,13 @@ var EVALUATING, captureStackTrace, allowsEval, getParsedType = (data) => {
777
783
  }
778
784
  }, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES;
779
785
  var init_util = __esm(() => {
780
- EVALUATING = Symbol("evaluating");
786
+ init_core();
787
+ EVALUATING = /* @__PURE__ */ Symbol("evaluating");
781
788
  captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
782
- allowsEval = cached(() => {
789
+ allowsEval = /* @__PURE__ */ cached(() => {
790
+ if (globalConfig.jitless) {
791
+ return false;
792
+ }
783
793
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
784
794
  return false;
785
795
  }
@@ -791,8 +801,15 @@ var init_util = __esm(() => {
791
801
  return false;
792
802
  }
793
803
  });
794
- propertyKeyTypes = new Set(["string", "number", "symbol"]);
795
- primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
804
+ propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
805
+ primitiveTypes = /* @__PURE__ */ new Set([
806
+ "string",
807
+ "number",
808
+ "bigint",
809
+ "boolean",
810
+ "symbol",
811
+ "undefined"
812
+ ]);
796
813
  NUMBER_FORMAT_RANGES = {
797
814
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
798
815
  int32: [-2147483648, 2147483647],
@@ -822,30 +839,33 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
822
839
  }
823
840
  function formatError(error, mapper = (issue2) => issue2.message) {
824
841
  const fieldErrors = { _errors: [] };
825
- const processError = (error2) => {
842
+ const processError = (error2, path = []) => {
826
843
  for (const issue2 of error2.issues) {
827
844
  if (issue2.code === "invalid_union" && issue2.errors.length) {
828
- issue2.errors.map((issues) => processError({ issues }));
845
+ issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
829
846
  } else if (issue2.code === "invalid_key") {
830
- processError({ issues: issue2.issues });
847
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
831
848
  } else if (issue2.code === "invalid_element") {
832
- processError({ issues: issue2.issues });
833
- } else if (issue2.path.length === 0) {
834
- fieldErrors._errors.push(mapper(issue2));
849
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
835
850
  } else {
836
- let curr = fieldErrors;
837
- let i = 0;
838
- while (i < issue2.path.length) {
839
- const el = issue2.path[i];
840
- const terminal = i === issue2.path.length - 1;
841
- if (!terminal) {
842
- curr[el] = curr[el] || { _errors: [] };
843
- } else {
844
- curr[el] = curr[el] || { _errors: [] };
845
- curr[el]._errors.push(mapper(issue2));
851
+ const fullpath = [...path, ...issue2.path];
852
+ if (fullpath.length === 0) {
853
+ fieldErrors._errors.push(mapper(issue2));
854
+ } else {
855
+ let curr = fieldErrors;
856
+ let i = 0;
857
+ while (i < fullpath.length) {
858
+ const el = fullpath[i];
859
+ const terminal = i === fullpath.length - 1;
860
+ if (!terminal) {
861
+ curr[el] = curr[el] || { _errors: [] };
862
+ } else {
863
+ curr[el] = curr[el] || { _errors: [] };
864
+ curr[el]._errors.push(mapper(issue2));
865
+ }
866
+ curr = curr[el];
867
+ i++;
846
868
  }
847
- curr = curr[el];
848
- i++;
849
869
  }
850
870
  }
851
871
  }
@@ -907,7 +927,7 @@ var init_errors = __esm(() => {
907
927
 
908
928
  // node_modules/zod/v4/core/parse.js
909
929
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
910
- const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
930
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
911
931
  const result = schema._zod.run({ value, issues: [] }, ctx);
912
932
  if (result instanceof Promise) {
913
933
  throw new $ZodAsyncError;
@@ -919,7 +939,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
919
939
  }
920
940
  return result.value;
921
941
  }, parse, _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
922
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
942
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
923
943
  let result = schema._zod.run({ value, issues: [] }, ctx);
924
944
  if (result instanceof Promise)
925
945
  result = await result;
@@ -940,7 +960,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
940
960
  error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
941
961
  } : { success: true, data: result.value };
942
962
  }, safeParse, _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
943
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
963
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
944
964
  let result = schema._zod.run({ value, issues: [] }, ctx);
945
965
  if (result instanceof Promise)
946
966
  result = await result;
@@ -949,22 +969,22 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
949
969
  error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
950
970
  } : { success: true, data: result.value };
951
971
  }, safeParseAsync, _encode = (_Err) => (schema, value, _ctx) => {
952
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
972
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
953
973
  return _parse(_Err)(schema, value, ctx);
954
974
  }, _decode = (_Err) => (schema, value, _ctx) => {
955
975
  return _parse(_Err)(schema, value, _ctx);
956
976
  }, _encodeAsync = (_Err) => async (schema, value, _ctx) => {
957
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
977
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
958
978
  return _parseAsync(_Err)(schema, value, ctx);
959
979
  }, _decodeAsync = (_Err) => async (schema, value, _ctx) => {
960
980
  return _parseAsync(_Err)(schema, value, _ctx);
961
981
  }, _safeEncode = (_Err) => (schema, value, _ctx) => {
962
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
982
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
963
983
  return _safeParse(_Err)(schema, value, ctx);
964
984
  }, _safeDecode = (_Err) => (schema, value, _ctx) => {
965
985
  return _safeParse(_Err)(schema, value, _ctx);
966
986
  }, _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
967
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
987
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
968
988
  return _safeParseAsync(_Err)(schema, value, ctx);
969
989
  }, _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
970
990
  return _safeParseAsync(_Err)(schema, value, _ctx);
@@ -1005,12 +1025,12 @@ var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid = (version) => {
1005
1025
  if (!version)
1006
1026
  return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
1007
1027
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
1008
- }, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164, dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`, date, string = (params) => {
1028
+ }, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, httpProtocol, e164, dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`, date, string = (params) => {
1009
1029
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1010
1030
  return new RegExp(`^${regex}$`);
1011
1031
  }, bigint, integer, number, boolean, _null, lowercase, uppercase;
1012
1032
  var init_regexes = __esm(() => {
1013
- cuid = /^[cC][^\s-]{8,}$/;
1033
+ cuid = /^[cC][0-9a-z]{6,}$/;
1014
1034
  cuid2 = /^[0-9a-z]+$/;
1015
1035
  ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1016
1036
  xid = /^[0-9a-vA-V]{20}$/;
@@ -1025,6 +1045,7 @@ var init_regexes = __esm(() => {
1025
1045
  cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1026
1046
  base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1027
1047
  base64url = /^[A-Za-z0-9_-]*$/;
1048
+ httpProtocol = /^https?$/;
1028
1049
  e164 = /^\+[1-9]\d{6,14}$/;
1029
1050
  date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
1030
1051
  bigint = /^-?\d+n?$/;
@@ -1043,10 +1064,10 @@ var init_checks = __esm(() => {
1043
1064
  init_regexes();
1044
1065
  init_util();
1045
1066
  $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
1046
- var _a;
1067
+ var _a2;
1047
1068
  inst._zod ?? (inst._zod = {});
1048
1069
  inst._zod.def = def;
1049
- (_a = inst._zod).onattach ?? (_a.onattach = []);
1070
+ (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
1050
1071
  });
1051
1072
  numericOriginMap = {
1052
1073
  number: "number",
@@ -1112,8 +1133,8 @@ var init_checks = __esm(() => {
1112
1133
  $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1113
1134
  $ZodCheck.init(inst, def);
1114
1135
  inst._zod.onattach.push((inst2) => {
1115
- var _a;
1116
- (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
1136
+ var _a2;
1137
+ (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
1117
1138
  });
1118
1139
  inst._zod.check = (payload) => {
1119
1140
  if (typeof payload.value !== typeof def.value)
@@ -1211,9 +1232,9 @@ var init_checks = __esm(() => {
1211
1232
  };
1212
1233
  });
1213
1234
  $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
1214
- var _a;
1235
+ var _a2;
1215
1236
  $ZodCheck.init(inst, def);
1216
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1237
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1217
1238
  const val = payload.value;
1218
1239
  return !nullish(val) && val.length !== undefined;
1219
1240
  });
@@ -1240,9 +1261,9 @@ var init_checks = __esm(() => {
1240
1261
  };
1241
1262
  });
1242
1263
  $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
1243
- var _a;
1264
+ var _a2;
1244
1265
  $ZodCheck.init(inst, def);
1245
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1266
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1246
1267
  const val = payload.value;
1247
1268
  return !nullish(val) && val.length !== undefined;
1248
1269
  });
@@ -1269,9 +1290,9 @@ var init_checks = __esm(() => {
1269
1290
  };
1270
1291
  });
1271
1292
  $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
1272
- var _a;
1293
+ var _a2;
1273
1294
  $ZodCheck.init(inst, def);
1274
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1295
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1275
1296
  const val = payload.value;
1276
1297
  return !nullish(val) && val.length !== undefined;
1277
1298
  });
@@ -1300,7 +1321,7 @@ var init_checks = __esm(() => {
1300
1321
  };
1301
1322
  });
1302
1323
  $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1303
- var _a, _b;
1324
+ var _a2, _b;
1304
1325
  $ZodCheck.init(inst, def);
1305
1326
  inst._zod.onattach.push((inst2) => {
1306
1327
  const bag = inst2._zod.bag;
@@ -1311,7 +1332,7 @@ var init_checks = __esm(() => {
1311
1332
  }
1312
1333
  });
1313
1334
  if (def.pattern)
1314
- (_a = inst._zod).check ?? (_a.check = (payload) => {
1335
+ (_a2 = inst._zod).check ?? (_a2.check = (payload) => {
1315
1336
  def.pattern.lastIndex = 0;
1316
1337
  if (def.pattern.test(payload.value))
1317
1338
  return;
@@ -1474,8 +1495,8 @@ var version;
1474
1495
  var init_versions = __esm(() => {
1475
1496
  version = {
1476
1497
  major: 4,
1477
- minor: 3,
1478
- patch: 6
1498
+ minor: 4,
1499
+ patch: 3
1479
1500
  };
1480
1501
  });
1481
1502
 
@@ -1483,6 +1504,8 @@ var init_versions = __esm(() => {
1483
1504
  function isValidBase64(data) {
1484
1505
  if (data === "")
1485
1506
  return true;
1507
+ if (/\s/.test(data))
1508
+ return false;
1486
1509
  if (data.length % 4 !== 0)
1487
1510
  return false;
1488
1511
  try {
@@ -1525,15 +1548,27 @@ function handleArrayResult(result, final, index) {
1525
1548
  }
1526
1549
  final.value[index] = result.value;
1527
1550
  }
1528
- function handlePropertyResult(result, final, key, input, isOptionalOut) {
1551
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1552
+ const isPresent = key in input;
1529
1553
  if (result.issues.length) {
1530
- if (isOptionalOut && !(key in input)) {
1554
+ if (isOptionalIn && isOptionalOut && !isPresent) {
1531
1555
  return;
1532
1556
  }
1533
1557
  final.issues.push(...prefixIssues(key, result.issues));
1534
1558
  }
1559
+ if (!isPresent && !isOptionalIn) {
1560
+ if (!result.issues.length) {
1561
+ final.issues.push({
1562
+ code: "invalid_type",
1563
+ expected: "nonoptional",
1564
+ input: undefined,
1565
+ path: [key]
1566
+ });
1567
+ }
1568
+ return;
1569
+ }
1535
1570
  if (result.value === undefined) {
1536
- if (key in input) {
1571
+ if (isPresent) {
1537
1572
  final.value[key] = undefined;
1538
1573
  }
1539
1574
  } else {
@@ -1561,8 +1596,11 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1561
1596
  const keySet = def.keySet;
1562
1597
  const _catchall = def.catchall._zod;
1563
1598
  const t = _catchall.def.type;
1599
+ const isOptionalIn = _catchall.optin === "optional";
1564
1600
  const isOptionalOut = _catchall.optout === "optional";
1565
1601
  for (const key in input) {
1602
+ if (key === "__proto__")
1603
+ continue;
1566
1604
  if (keySet.has(key))
1567
1605
  continue;
1568
1606
  if (t === "never") {
@@ -1571,9 +1609,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1571
1609
  }
1572
1610
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1573
1611
  if (r instanceof Promise) {
1574
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
1612
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
1575
1613
  } else {
1576
- handlePropertyResult(r, payload, key, input, isOptionalOut);
1614
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1577
1615
  }
1578
1616
  }
1579
1617
  if (unrecognized.length) {
@@ -1694,7 +1732,7 @@ function handleIntersectionResults(result, left, right) {
1694
1732
  return result;
1695
1733
  }
1696
1734
  function handleOptionalResult(result, input) {
1697
- if (result.issues.length && input === undefined) {
1735
+ if (input === undefined && (result.issues.length || result.fallback)) {
1698
1736
  return { issues: [], value: undefined };
1699
1737
  }
1700
1738
  return result;
@@ -1721,7 +1759,7 @@ function handlePipeResult(left, next, ctx) {
1721
1759
  left.aborted = true;
1722
1760
  return left;
1723
1761
  }
1724
- return next._zod.run({ value: left.value, issues: left.issues }, ctx);
1762
+ return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
1725
1763
  }
1726
1764
  function handleReadonlyResult(payload) {
1727
1765
  payload.value = Object.freeze(payload.value);
@@ -1741,7 +1779,7 @@ function handleRefineResult(result, payload, input, inst) {
1741
1779
  payload.issues.push(issue(_iss));
1742
1780
  }
1743
1781
  }
1744
- var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodLazy, $ZodCustom;
1782
+ var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodLazy, $ZodCustom;
1745
1783
  var init_schemas = __esm(() => {
1746
1784
  init_checks();
1747
1785
  init_core();
@@ -1751,7 +1789,7 @@ var init_schemas = __esm(() => {
1751
1789
  init_versions();
1752
1790
  init_util();
1753
1791
  $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1754
- var _a;
1792
+ var _a2;
1755
1793
  inst ?? (inst = {});
1756
1794
  inst._zod.def = def;
1757
1795
  inst._zod.bag = inst._zod.bag || {};
@@ -1766,7 +1804,7 @@ var init_schemas = __esm(() => {
1766
1804
  }
1767
1805
  }
1768
1806
  if (checks.length === 0) {
1769
- (_a = inst._zod).deferred ?? (_a.deferred = []);
1807
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
1770
1808
  inst._zod.deferred?.push(() => {
1771
1809
  inst._zod.run = inst._zod.parse;
1772
1810
  });
@@ -1776,6 +1814,8 @@ var init_schemas = __esm(() => {
1776
1814
  let asyncResult;
1777
1815
  for (const ch of checks2) {
1778
1816
  if (ch._zod.def.when) {
1817
+ if (explicitlyAborted(payload))
1818
+ continue;
1779
1819
  const shouldRun = ch._zod.def.when(payload);
1780
1820
  if (!shouldRun)
1781
1821
  continue;
@@ -1915,6 +1955,19 @@ var init_schemas = __esm(() => {
1915
1955
  inst._zod.check = (payload) => {
1916
1956
  try {
1917
1957
  const trimmed = payload.value.trim();
1958
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1959
+ if (!/^https?:\/\//i.test(trimmed)) {
1960
+ payload.issues.push({
1961
+ code: "invalid_format",
1962
+ format: "url",
1963
+ note: "Invalid URL format",
1964
+ input: payload.value,
1965
+ inst,
1966
+ continue: !def.abort
1967
+ });
1968
+ return;
1969
+ }
1970
+ }
1918
1971
  const url = new URL(trimmed);
1919
1972
  if (def.hostname) {
1920
1973
  def.hostname.lastIndex = 0;
@@ -2318,12 +2371,13 @@ var init_schemas = __esm(() => {
2318
2371
  const shape = value.shape;
2319
2372
  for (const key of value.keys) {
2320
2373
  const el = shape[key];
2374
+ const isOptionalIn = el._zod.optin === "optional";
2321
2375
  const isOptionalOut = el._zod.optout === "optional";
2322
2376
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
2323
2377
  if (r instanceof Promise) {
2324
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
2378
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
2325
2379
  } else {
2326
- handlePropertyResult(r, payload, key, input, isOptionalOut);
2380
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2327
2381
  }
2328
2382
  }
2329
2383
  if (!catchall) {
@@ -2354,9 +2408,10 @@ var init_schemas = __esm(() => {
2354
2408
  const id = ids[key];
2355
2409
  const k = esc(key);
2356
2410
  const schema = shape[key];
2411
+ const isOptionalIn = schema?._zod?.optin === "optional";
2357
2412
  const isOptionalOut = schema?._zod?.optout === "optional";
2358
2413
  doc.write(`const ${id} = ${parseStr(key)};`);
2359
- if (isOptionalOut) {
2414
+ if (isOptionalIn && isOptionalOut) {
2360
2415
  doc.write(`
2361
2416
  if (${id}.issues.length) {
2362
2417
  if (${k} in input) {
@@ -2375,6 +2430,33 @@ var init_schemas = __esm(() => {
2375
2430
  newResult[${k}] = ${id}.value;
2376
2431
  }
2377
2432
 
2433
+ `);
2434
+ } else if (!isOptionalIn) {
2435
+ doc.write(`
2436
+ const ${id}_present = ${k} in input;
2437
+ if (${id}.issues.length) {
2438
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2439
+ ...iss,
2440
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2441
+ })));
2442
+ }
2443
+ if (!${id}_present && !${id}.issues.length) {
2444
+ payload.issues.push({
2445
+ code: "invalid_type",
2446
+ expected: "nonoptional",
2447
+ input: undefined,
2448
+ path: [${k}]
2449
+ });
2450
+ }
2451
+
2452
+ if (${id}_present) {
2453
+ if (${id}.value === undefined) {
2454
+ newResult[${k}] = undefined;
2455
+ } else {
2456
+ newResult[${k}] = ${id}.value;
2457
+ }
2458
+ }
2459
+
2378
2460
  `);
2379
2461
  } else {
2380
2462
  doc.write(`
@@ -2448,10 +2530,9 @@ var init_schemas = __esm(() => {
2448
2530
  }
2449
2531
  return;
2450
2532
  });
2451
- const single = def.options.length === 1;
2452
- const first = def.options[0]._zod.run;
2533
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
2453
2534
  inst._zod.parse = (payload, ctx) => {
2454
- if (single) {
2535
+ if (first) {
2455
2536
  return first(payload, ctx);
2456
2537
  }
2457
2538
  let async = false;
@@ -2528,7 +2609,7 @@ var init_schemas = __esm(() => {
2528
2609
  if (opt) {
2529
2610
  return opt._zod.run(payload, ctx);
2530
2611
  }
2531
- if (def.unionFallback) {
2612
+ if (def.unionFallback || ctx.direction === "backward") {
2532
2613
  return _super(payload, ctx);
2533
2614
  }
2534
2615
  payload.issues.push({
@@ -2536,6 +2617,7 @@ var init_schemas = __esm(() => {
2536
2617
  errors: [],
2537
2618
  note: "No matching discriminator",
2538
2619
  discriminator: def.discriminator,
2620
+ options: Array.from(disc.value.keys()),
2539
2621
  input,
2540
2622
  path: [def.discriminator],
2541
2623
  inst
@@ -2579,19 +2661,35 @@ var init_schemas = __esm(() => {
2579
2661
  for (const key of values) {
2580
2662
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2581
2663
  recordKeys.add(typeof key === "number" ? key.toString() : key);
2664
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2665
+ if (keyResult instanceof Promise) {
2666
+ throw new Error("Async schemas not supported in object keys currently");
2667
+ }
2668
+ if (keyResult.issues.length) {
2669
+ payload.issues.push({
2670
+ code: "invalid_key",
2671
+ origin: "record",
2672
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2673
+ input: key,
2674
+ path: [key],
2675
+ inst
2676
+ });
2677
+ continue;
2678
+ }
2679
+ const outKey = keyResult.value;
2582
2680
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2583
2681
  if (result instanceof Promise) {
2584
2682
  proms.push(result.then((result2) => {
2585
2683
  if (result2.issues.length) {
2586
2684
  payload.issues.push(...prefixIssues(key, result2.issues));
2587
2685
  }
2588
- payload.value[key] = result2.value;
2686
+ payload.value[outKey] = result2.value;
2589
2687
  }));
2590
2688
  } else {
2591
2689
  if (result.issues.length) {
2592
2690
  payload.issues.push(...prefixIssues(key, result.issues));
2593
2691
  }
2594
- payload.value[key] = result.value;
2692
+ payload.value[outKey] = result.value;
2595
2693
  }
2596
2694
  }
2597
2695
  }
@@ -2615,6 +2713,8 @@ var init_schemas = __esm(() => {
2615
2713
  for (const key of Reflect.ownKeys(input)) {
2616
2714
  if (key === "__proto__")
2617
2715
  continue;
2716
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
2717
+ continue;
2618
2718
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2619
2719
  if (keyResult instanceof Promise) {
2620
2720
  throw new Error("Async schemas not supported in object keys currently");
@@ -2710,6 +2810,7 @@ var init_schemas = __esm(() => {
2710
2810
  });
2711
2811
  $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
2712
2812
  $ZodType.init(inst, def);
2813
+ inst._zod.optin = "optional";
2713
2814
  inst._zod.parse = (payload, ctx) => {
2714
2815
  if (ctx.direction === "backward") {
2715
2816
  throw new $ZodEncodeError(inst.constructor.name);
@@ -2719,6 +2820,7 @@ var init_schemas = __esm(() => {
2719
2820
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2720
2821
  return output.then((output2) => {
2721
2822
  payload.value = output2;
2823
+ payload.fallback = true;
2722
2824
  return payload;
2723
2825
  });
2724
2826
  }
@@ -2726,6 +2828,7 @@ var init_schemas = __esm(() => {
2726
2828
  throw new $ZodAsyncError;
2727
2829
  }
2728
2830
  payload.value = _out;
2831
+ payload.fallback = true;
2729
2832
  return payload;
2730
2833
  };
2731
2834
  });
@@ -2742,10 +2845,11 @@ var init_schemas = __esm(() => {
2742
2845
  });
2743
2846
  inst._zod.parse = (payload, ctx) => {
2744
2847
  if (def.innerType._zod.optin === "optional") {
2848
+ const input = payload.value;
2745
2849
  const result = def.innerType._zod.run(payload, ctx);
2746
2850
  if (result instanceof Promise)
2747
- return result.then((r) => handleOptionalResult(r, payload.value));
2748
- return handleOptionalResult(result, payload.value);
2851
+ return result.then((r) => handleOptionalResult(r, input));
2852
+ return handleOptionalResult(result, input);
2749
2853
  }
2750
2854
  if (payload.value === undefined) {
2751
2855
  return payload;
@@ -2827,7 +2931,7 @@ var init_schemas = __esm(() => {
2827
2931
  });
2828
2932
  $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
2829
2933
  $ZodType.init(inst, def);
2830
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2934
+ inst._zod.optin = "optional";
2831
2935
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2832
2936
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2833
2937
  inst._zod.parse = (payload, ctx) => {
@@ -2847,6 +2951,7 @@ var init_schemas = __esm(() => {
2847
2951
  input: payload.value
2848
2952
  });
2849
2953
  payload.issues = [];
2954
+ payload.fallback = true;
2850
2955
  }
2851
2956
  return payload;
2852
2957
  });
@@ -2861,6 +2966,7 @@ var init_schemas = __esm(() => {
2861
2966
  input: payload.value
2862
2967
  });
2863
2968
  payload.issues = [];
2969
+ payload.fallback = true;
2864
2970
  }
2865
2971
  return payload;
2866
2972
  };
@@ -2886,6 +2992,9 @@ var init_schemas = __esm(() => {
2886
2992
  return handlePipeResult(left, def.out, ctx);
2887
2993
  };
2888
2994
  });
2995
+ $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
2996
+ $ZodPipe.init(inst, def);
2997
+ });
2889
2998
  $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
2890
2999
  $ZodType.init(inst, def);
2891
3000
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
@@ -2905,7 +3014,12 @@ var init_schemas = __esm(() => {
2905
3014
  });
2906
3015
  $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
2907
3016
  $ZodType.init(inst, def);
2908
- defineLazy(inst._zod, "innerType", () => def.getter());
3017
+ defineLazy(inst._zod, "innerType", () => {
3018
+ const d = def;
3019
+ if (!d._cachedInner)
3020
+ d._cachedInner = def.getter();
3021
+ return d._cachedInner;
3022
+ });
2909
3023
  defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
2910
3024
  defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
2911
3025
  defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
@@ -3031,6 +3145,10 @@ var error = () => {
3031
3145
  case "invalid_key":
3032
3146
  return `Invalid key in ${issue2.origin}`;
3033
3147
  case "invalid_union":
3148
+ if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
3149
+ const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
3150
+ return `Invalid discriminator value. Expected ${opts}`;
3151
+ }
3034
3152
  return "Invalid input";
3035
3153
  case "invalid_element":
3036
3154
  return `Invalid value in ${issue2.origin}`;
@@ -3090,11 +3208,11 @@ class $ZodRegistry {
3090
3208
  function registry() {
3091
3209
  return new $ZodRegistry;
3092
3210
  }
3093
- var _a, $output, $input, globalRegistry;
3211
+ var _a2, $output, $input, globalRegistry;
3094
3212
  var init_registries = __esm(() => {
3095
3213
  $output = Symbol("ZodOutput");
3096
3214
  $input = Symbol("ZodInput");
3097
- (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3215
+ (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
3098
3216
  globalRegistry = globalThis.__zod_globalRegistry;
3099
3217
  });
3100
3218
 
@@ -3577,7 +3695,7 @@ function _refine(Class2, fn, _params) {
3577
3695
  });
3578
3696
  return schema;
3579
3697
  }
3580
- function _superRefine(fn) {
3698
+ function _superRefine(fn, params) {
3581
3699
  const ch = _check((payload) => {
3582
3700
  payload.addIssue = (issue2) => {
3583
3701
  if (typeof issue2 === "string") {
@@ -3594,7 +3712,7 @@ function _superRefine(fn) {
3594
3712
  }
3595
3713
  };
3596
3714
  return fn(payload.value, payload);
3597
- });
3715
+ }, params);
3598
3716
  return ch;
3599
3717
  }
3600
3718
  function _check(fn, params) {
@@ -3632,7 +3750,7 @@ function initializeContext(params) {
3632
3750
  };
3633
3751
  }
3634
3752
  function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
3635
- var _a2;
3753
+ var _a3;
3636
3754
  const def = schema._zod.def;
3637
3755
  const seen = ctx.seen.get(schema);
3638
3756
  if (seen) {
@@ -3679,8 +3797,8 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
3679
3797
  delete result.schema.examples;
3680
3798
  delete result.schema.default;
3681
3799
  }
3682
- if (ctx.io === "input" && result.schema._prefault)
3683
- (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
3800
+ if (ctx.io === "input" && "_prefault" in result.schema)
3801
+ (_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
3684
3802
  delete result.schema._prefault;
3685
3803
  const _result = ctx.seen.get(schema);
3686
3804
  return _result.schema;
@@ -3849,7 +3967,7 @@ function finalize(ctx, schema) {
3849
3967
  result.$schema = "http://json-schema.org/draft-07/schema#";
3850
3968
  } else if (ctx.target === "draft-04") {
3851
3969
  result.$schema = "http://json-schema.org/draft-04/schema#";
3852
- } else if (ctx.target === "openapi-3.0") {} else {}
3970
+ } else if (ctx.target === "openapi-3.0") {}
3853
3971
  if (ctx.external?.uri) {
3854
3972
  const id = ctx.external.registry.get(schema)?.id;
3855
3973
  if (!id)
@@ -3857,10 +3975,15 @@ function finalize(ctx, schema) {
3857
3975
  result.$id = ctx.external.uri(id);
3858
3976
  }
3859
3977
  Object.assign(result, root.def ?? root.schema);
3978
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
3979
+ if (rootMetaId !== undefined && result.id === rootMetaId)
3980
+ delete result.id;
3860
3981
  const defs = ctx.external?.defs ?? {};
3861
3982
  for (const entry of ctx.seen.entries()) {
3862
3983
  const seen = entry[1];
3863
3984
  if (seen.def && seen.defId) {
3985
+ if (seen.def.id === seen.defId)
3986
+ delete seen.def.id;
3864
3987
  defs[seen.defId] = seen.def;
3865
3988
  }
3866
3989
  }
@@ -3915,6 +4038,8 @@ function isTransforming(_schema, _ctx) {
3915
4038
  return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3916
4039
  }
3917
4040
  if (def.type === "pipe") {
4041
+ if (_schema._zod.traits.has("$ZodCodec"))
4042
+ return true;
3918
4043
  return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
3919
4044
  }
3920
4045
  if (def.type === "object") {
@@ -4031,39 +4156,28 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4031
4156
  json.type = "integer";
4032
4157
  else
4033
4158
  json.type = "number";
4034
- if (typeof exclusiveMinimum === "number") {
4035
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
4159
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
4160
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum2 ?? Number.POSITIVE_INFINITY);
4161
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
4162
+ if (exMin) {
4163
+ if (legacy) {
4036
4164
  json.minimum = exclusiveMinimum;
4037
4165
  json.exclusiveMinimum = true;
4038
4166
  } else {
4039
4167
  json.exclusiveMinimum = exclusiveMinimum;
4040
4168
  }
4041
- }
4042
- if (typeof minimum === "number") {
4169
+ } else if (typeof minimum === "number") {
4043
4170
  json.minimum = minimum;
4044
- if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
4045
- if (exclusiveMinimum >= minimum)
4046
- delete json.minimum;
4047
- else
4048
- delete json.exclusiveMinimum;
4049
- }
4050
4171
  }
4051
- if (typeof exclusiveMaximum === "number") {
4052
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
4172
+ if (exMax) {
4173
+ if (legacy) {
4053
4174
  json.maximum = exclusiveMaximum;
4054
4175
  json.exclusiveMaximum = true;
4055
4176
  } else {
4056
4177
  json.exclusiveMaximum = exclusiveMaximum;
4057
4178
  }
4058
- }
4059
- if (typeof maximum2 === "number") {
4179
+ } else if (typeof maximum2 === "number") {
4060
4180
  json.maximum = maximum2;
4061
- if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
4062
- if (exclusiveMaximum <= maximum2)
4063
- delete json.maximum;
4064
- else
4065
- delete json.exclusiveMaximum;
4066
- }
4067
4181
  }
4068
4182
  if (typeof multipleOf === "number")
4069
4183
  json.multipleOf = multipleOf;
@@ -4114,7 +4228,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4114
4228
  if (val === undefined) {
4115
4229
  if (ctx.unrepresentable === "throw") {
4116
4230
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
4117
- } else {}
4231
+ }
4118
4232
  } else if (typeof val === "bigint") {
4119
4233
  if (ctx.unrepresentable === "throw") {
4120
4234
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -4209,7 +4323,10 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4209
4323
  if (typeof maximum2 === "number")
4210
4324
  json.maxItems = maximum2;
4211
4325
  json.type = "array";
4212
- json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
4326
+ json.items = process2(def.element, ctx, {
4327
+ ...params,
4328
+ path: [...params.path, "items"]
4329
+ });
4213
4330
  }, objectProcessor = (schema, ctx, _json, params) => {
4214
4331
  const json = _json;
4215
4332
  const def = schema._zod.def;
@@ -4391,7 +4508,8 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4391
4508
  json.default = catchValue;
4392
4509
  }, pipeProcessor = (schema, ctx, _json, params) => {
4393
4510
  const def = schema._zod.def;
4394
- const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
4511
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
4512
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
4395
4513
  process2(innerType, ctx, params);
4396
4514
  const seen = ctx.seen.get(schema);
4397
4515
  seen.ref = innerType;
@@ -4575,8 +4693,8 @@ var init_errors2 = __esm(() => {
4575
4693
  init_core2();
4576
4694
  init_core2();
4577
4695
  init_util();
4578
- ZodError = $constructor("ZodError", initializer2);
4579
- ZodRealError = $constructor("ZodError", initializer2, {
4696
+ ZodError = /* @__PURE__ */ $constructor("ZodError", initializer2);
4697
+ ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
4580
4698
  Parent: Error
4581
4699
  });
4582
4700
  });
@@ -4601,6 +4719,42 @@ var init_parse2 = __esm(() => {
4601
4719
  });
4602
4720
 
4603
4721
  // node_modules/zod/v4/classic/schemas.js
4722
+ function _installLazyMethods(inst, group2, methods) {
4723
+ const proto = Object.getPrototypeOf(inst);
4724
+ let installed = _installedGroups.get(proto);
4725
+ if (!installed) {
4726
+ installed = new Set;
4727
+ _installedGroups.set(proto, installed);
4728
+ }
4729
+ if (installed.has(group2))
4730
+ return;
4731
+ installed.add(group2);
4732
+ for (const key in methods) {
4733
+ const fn = methods[key];
4734
+ Object.defineProperty(proto, key, {
4735
+ configurable: true,
4736
+ enumerable: false,
4737
+ get() {
4738
+ const bound = fn.bind(this);
4739
+ Object.defineProperty(this, key, {
4740
+ configurable: true,
4741
+ writable: true,
4742
+ enumerable: true,
4743
+ value: bound
4744
+ });
4745
+ return bound;
4746
+ },
4747
+ set(v) {
4748
+ Object.defineProperty(this, key, {
4749
+ configurable: true,
4750
+ writable: true,
4751
+ enumerable: true,
4752
+ value: v
4753
+ });
4754
+ }
4755
+ });
4756
+ }
4757
+ }
4604
4758
  function string2(params) {
4605
4759
  return _string(ZodString, params);
4606
4760
  }
@@ -4667,6 +4821,14 @@ function intersection(left, right) {
4667
4821
  });
4668
4822
  }
4669
4823
  function record(keyType, valueType, params) {
4824
+ if (!valueType || !valueType._zod) {
4825
+ return new ZodRecord({
4826
+ type: "record",
4827
+ keyType: string2(),
4828
+ valueType: keyType,
4829
+ ...exports_util.normalizeParams(valueType)
4830
+ });
4831
+ }
4670
4832
  return new ZodRecord({
4671
4833
  type: "record",
4672
4834
  keyType,
@@ -4770,13 +4932,17 @@ function custom(fn, _params) {
4770
4932
  function refine(fn, _params = {}) {
4771
4933
  return _refine(ZodCustom, fn, _params);
4772
4934
  }
4773
- function superRefine(fn) {
4774
- return _superRefine(fn);
4935
+ function superRefine(fn, params) {
4936
+ return _superRefine(fn, params);
4775
4937
  }
4776
4938
  function preprocess(fn, schema) {
4777
- return pipe(transform(fn), schema);
4939
+ return new ZodPreprocess({
4940
+ type: "pipe",
4941
+ in: transform(fn),
4942
+ out: schema
4943
+ });
4778
4944
  }
4779
- var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodLazy, ZodCustom;
4945
+ var _installedGroups, ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodPreprocess, ZodReadonly, ZodLazy, ZodCustom;
4780
4946
  var init_schemas2 = __esm(() => {
4781
4947
  init_core2();
4782
4948
  init_core2();
@@ -4785,6 +4951,7 @@ var init_schemas2 = __esm(() => {
4785
4951
  init_checks2();
4786
4952
  init_iso();
4787
4953
  init_parse2();
4954
+ _installedGroups = /* @__PURE__ */ new WeakMap;
4788
4955
  ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
4789
4956
  $ZodType.init(inst, def);
4790
4957
  Object.assign(inst["~standard"], {
@@ -4797,23 +4964,6 @@ var init_schemas2 = __esm(() => {
4797
4964
  inst.def = def;
4798
4965
  inst.type = def.type;
4799
4966
  Object.defineProperty(inst, "_def", { value: def });
4800
- inst.check = (...checks2) => {
4801
- return inst.clone(exports_util.mergeDefs(def, {
4802
- checks: [
4803
- ...def.checks ?? [],
4804
- ...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
4805
- ]
4806
- }), {
4807
- parent: true
4808
- });
4809
- };
4810
- inst.with = inst.check;
4811
- inst.clone = (def2, params) => clone(inst, def2, params);
4812
- inst.brand = () => inst;
4813
- inst.register = (reg, meta2) => {
4814
- reg.add(inst, meta2);
4815
- return inst;
4816
- };
4817
4967
  inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
4818
4968
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
4819
4969
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
@@ -4827,45 +4977,108 @@ var init_schemas2 = __esm(() => {
4827
4977
  inst.safeDecode = (data, params) => safeDecode(inst, data, params);
4828
4978
  inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
4829
4979
  inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
4830
- inst.refine = (check, params) => inst.check(refine(check, params));
4831
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
4832
- inst.overwrite = (fn) => inst.check(_overwrite(fn));
4833
- inst.optional = () => optional(inst);
4834
- inst.exactOptional = () => exactOptional(inst);
4835
- inst.nullable = () => nullable(inst);
4836
- inst.nullish = () => optional(nullable(inst));
4837
- inst.nonoptional = (params) => nonoptional(inst, params);
4838
- inst.array = () => array(inst);
4839
- inst.or = (arg) => union([inst, arg]);
4840
- inst.and = (arg) => intersection(inst, arg);
4841
- inst.transform = (tx) => pipe(inst, transform(tx));
4842
- inst.default = (def2) => _default(inst, def2);
4843
- inst.prefault = (def2) => prefault(inst, def2);
4844
- inst.catch = (params) => _catch(inst, params);
4845
- inst.pipe = (target) => pipe(inst, target);
4846
- inst.readonly = () => readonly(inst);
4847
- inst.describe = (description) => {
4848
- const cl = inst.clone();
4849
- globalRegistry.add(cl, { description });
4850
- return cl;
4851
- };
4980
+ _installLazyMethods(inst, "ZodType", {
4981
+ check(...chks) {
4982
+ const def2 = this.def;
4983
+ return this.clone(exports_util.mergeDefs(def2, {
4984
+ checks: [
4985
+ ...def2.checks ?? [],
4986
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
4987
+ ]
4988
+ }), { parent: true });
4989
+ },
4990
+ with(...chks) {
4991
+ return this.check(...chks);
4992
+ },
4993
+ clone(def2, params) {
4994
+ return clone(this, def2, params);
4995
+ },
4996
+ brand() {
4997
+ return this;
4998
+ },
4999
+ register(reg, meta2) {
5000
+ reg.add(this, meta2);
5001
+ return this;
5002
+ },
5003
+ refine(check, params) {
5004
+ return this.check(refine(check, params));
5005
+ },
5006
+ superRefine(refinement, params) {
5007
+ return this.check(superRefine(refinement, params));
5008
+ },
5009
+ overwrite(fn) {
5010
+ return this.check(_overwrite(fn));
5011
+ },
5012
+ optional() {
5013
+ return optional(this);
5014
+ },
5015
+ exactOptional() {
5016
+ return exactOptional(this);
5017
+ },
5018
+ nullable() {
5019
+ return nullable(this);
5020
+ },
5021
+ nullish() {
5022
+ return optional(nullable(this));
5023
+ },
5024
+ nonoptional(params) {
5025
+ return nonoptional(this, params);
5026
+ },
5027
+ array() {
5028
+ return array(this);
5029
+ },
5030
+ or(arg) {
5031
+ return union([this, arg]);
5032
+ },
5033
+ and(arg) {
5034
+ return intersection(this, arg);
5035
+ },
5036
+ transform(tx) {
5037
+ return pipe(this, transform(tx));
5038
+ },
5039
+ default(d) {
5040
+ return _default(this, d);
5041
+ },
5042
+ prefault(d) {
5043
+ return prefault(this, d);
5044
+ },
5045
+ catch(params) {
5046
+ return _catch(this, params);
5047
+ },
5048
+ pipe(target) {
5049
+ return pipe(this, target);
5050
+ },
5051
+ readonly() {
5052
+ return readonly(this);
5053
+ },
5054
+ describe(description) {
5055
+ const cl = this.clone();
5056
+ globalRegistry.add(cl, { description });
5057
+ return cl;
5058
+ },
5059
+ meta(...args) {
5060
+ if (args.length === 0)
5061
+ return globalRegistry.get(this);
5062
+ const cl = this.clone();
5063
+ globalRegistry.add(cl, args[0]);
5064
+ return cl;
5065
+ },
5066
+ isOptional() {
5067
+ return this.safeParse(undefined).success;
5068
+ },
5069
+ isNullable() {
5070
+ return this.safeParse(null).success;
5071
+ },
5072
+ apply(fn) {
5073
+ return fn(this);
5074
+ }
5075
+ });
4852
5076
  Object.defineProperty(inst, "description", {
4853
5077
  get() {
4854
5078
  return globalRegistry.get(inst)?.description;
4855
5079
  },
4856
5080
  configurable: true
4857
5081
  });
4858
- inst.meta = (...args) => {
4859
- if (args.length === 0) {
4860
- return globalRegistry.get(inst);
4861
- }
4862
- const cl = inst.clone();
4863
- globalRegistry.add(cl, args[0]);
4864
- return cl;
4865
- };
4866
- inst.isOptional = () => inst.safeParse(undefined).success;
4867
- inst.isNullable = () => inst.safeParse(null).success;
4868
- inst.apply = (fn) => fn(inst);
4869
5082
  return inst;
4870
5083
  });
4871
5084
  _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
@@ -4876,21 +5089,53 @@ var init_schemas2 = __esm(() => {
4876
5089
  inst.format = bag.format ?? null;
4877
5090
  inst.minLength = bag.minimum ?? null;
4878
5091
  inst.maxLength = bag.maximum ?? null;
4879
- inst.regex = (...args) => inst.check(_regex(...args));
4880
- inst.includes = (...args) => inst.check(_includes(...args));
4881
- inst.startsWith = (...args) => inst.check(_startsWith(...args));
4882
- inst.endsWith = (...args) => inst.check(_endsWith(...args));
4883
- inst.min = (...args) => inst.check(_minLength(...args));
4884
- inst.max = (...args) => inst.check(_maxLength(...args));
4885
- inst.length = (...args) => inst.check(_length(...args));
4886
- inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
4887
- inst.lowercase = (params) => inst.check(_lowercase(params));
4888
- inst.uppercase = (params) => inst.check(_uppercase(params));
4889
- inst.trim = () => inst.check(_trim());
4890
- inst.normalize = (...args) => inst.check(_normalize(...args));
4891
- inst.toLowerCase = () => inst.check(_toLowerCase());
4892
- inst.toUpperCase = () => inst.check(_toUpperCase());
4893
- inst.slugify = () => inst.check(_slugify());
5092
+ _installLazyMethods(inst, "_ZodString", {
5093
+ regex(...args) {
5094
+ return this.check(_regex(...args));
5095
+ },
5096
+ includes(...args) {
5097
+ return this.check(_includes(...args));
5098
+ },
5099
+ startsWith(...args) {
5100
+ return this.check(_startsWith(...args));
5101
+ },
5102
+ endsWith(...args) {
5103
+ return this.check(_endsWith(...args));
5104
+ },
5105
+ min(...args) {
5106
+ return this.check(_minLength(...args));
5107
+ },
5108
+ max(...args) {
5109
+ return this.check(_maxLength(...args));
5110
+ },
5111
+ length(...args) {
5112
+ return this.check(_length(...args));
5113
+ },
5114
+ nonempty(...args) {
5115
+ return this.check(_minLength(1, ...args));
5116
+ },
5117
+ lowercase(params) {
5118
+ return this.check(_lowercase(params));
5119
+ },
5120
+ uppercase(params) {
5121
+ return this.check(_uppercase(params));
5122
+ },
5123
+ trim() {
5124
+ return this.check(_trim());
5125
+ },
5126
+ normalize(...args) {
5127
+ return this.check(_normalize(...args));
5128
+ },
5129
+ toLowerCase() {
5130
+ return this.check(_toLowerCase());
5131
+ },
5132
+ toUpperCase() {
5133
+ return this.check(_toUpperCase());
5134
+ },
5135
+ slugify() {
5136
+ return this.check(_slugify());
5137
+ }
5138
+ });
4894
5139
  });
4895
5140
  ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
4896
5141
  $ZodString.init(inst, def);
@@ -5007,21 +5252,53 @@ var init_schemas2 = __esm(() => {
5007
5252
  $ZodNumber.init(inst, def);
5008
5253
  ZodType.init(inst, def);
5009
5254
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
5010
- inst.gt = (value, params) => inst.check(_gt(value, params));
5011
- inst.gte = (value, params) => inst.check(_gte(value, params));
5012
- inst.min = (value, params) => inst.check(_gte(value, params));
5013
- inst.lt = (value, params) => inst.check(_lt(value, params));
5014
- inst.lte = (value, params) => inst.check(_lte(value, params));
5015
- inst.max = (value, params) => inst.check(_lte(value, params));
5016
- inst.int = (params) => inst.check(int(params));
5017
- inst.safe = (params) => inst.check(int(params));
5018
- inst.positive = (params) => inst.check(_gt(0, params));
5019
- inst.nonnegative = (params) => inst.check(_gte(0, params));
5020
- inst.negative = (params) => inst.check(_lt(0, params));
5021
- inst.nonpositive = (params) => inst.check(_lte(0, params));
5022
- inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
5023
- inst.step = (value, params) => inst.check(_multipleOf(value, params));
5024
- inst.finite = () => inst;
5255
+ _installLazyMethods(inst, "ZodNumber", {
5256
+ gt(value, params) {
5257
+ return this.check(_gt(value, params));
5258
+ },
5259
+ gte(value, params) {
5260
+ return this.check(_gte(value, params));
5261
+ },
5262
+ min(value, params) {
5263
+ return this.check(_gte(value, params));
5264
+ },
5265
+ lt(value, params) {
5266
+ return this.check(_lt(value, params));
5267
+ },
5268
+ lte(value, params) {
5269
+ return this.check(_lte(value, params));
5270
+ },
5271
+ max(value, params) {
5272
+ return this.check(_lte(value, params));
5273
+ },
5274
+ int(params) {
5275
+ return this.check(int(params));
5276
+ },
5277
+ safe(params) {
5278
+ return this.check(int(params));
5279
+ },
5280
+ positive(params) {
5281
+ return this.check(_gt(0, params));
5282
+ },
5283
+ nonnegative(params) {
5284
+ return this.check(_gte(0, params));
5285
+ },
5286
+ negative(params) {
5287
+ return this.check(_lt(0, params));
5288
+ },
5289
+ nonpositive(params) {
5290
+ return this.check(_lte(0, params));
5291
+ },
5292
+ multipleOf(value, params) {
5293
+ return this.check(_multipleOf(value, params));
5294
+ },
5295
+ step(value, params) {
5296
+ return this.check(_multipleOf(value, params));
5297
+ },
5298
+ finite() {
5299
+ return this;
5300
+ }
5301
+ });
5025
5302
  const bag = inst._zod.bag;
5026
5303
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
5027
5304
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
@@ -5095,11 +5372,23 @@ var init_schemas2 = __esm(() => {
5095
5372
  ZodType.init(inst, def);
5096
5373
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
5097
5374
  inst.element = def.element;
5098
- inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
5099
- inst.nonempty = (params) => inst.check(_minLength(1, params));
5100
- inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
5101
- inst.length = (len, params) => inst.check(_length(len, params));
5102
- inst.unwrap = () => inst.element;
5375
+ _installLazyMethods(inst, "ZodArray", {
5376
+ min(n, params) {
5377
+ return this.check(_minLength(n, params));
5378
+ },
5379
+ nonempty(params) {
5380
+ return this.check(_minLength(1, params));
5381
+ },
5382
+ max(n, params) {
5383
+ return this.check(_maxLength(n, params));
5384
+ },
5385
+ length(n, params) {
5386
+ return this.check(_length(n, params));
5387
+ },
5388
+ unwrap() {
5389
+ return this.element;
5390
+ }
5391
+ });
5103
5392
  });
5104
5393
  ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
5105
5394
  $ZodObjectJIT.init(inst, def);
@@ -5108,23 +5397,47 @@ var init_schemas2 = __esm(() => {
5108
5397
  exports_util.defineLazy(inst, "shape", () => {
5109
5398
  return def.shape;
5110
5399
  });
5111
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
5112
- inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
5113
- inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
5114
- inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
5115
- inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
5116
- inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
5117
- inst.extend = (incoming) => {
5118
- return exports_util.extend(inst, incoming);
5119
- };
5120
- inst.safeExtend = (incoming) => {
5121
- return exports_util.safeExtend(inst, incoming);
5122
- };
5123
- inst.merge = (other) => exports_util.merge(inst, other);
5124
- inst.pick = (mask) => exports_util.pick(inst, mask);
5125
- inst.omit = (mask) => exports_util.omit(inst, mask);
5126
- inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);
5127
- inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);
5400
+ _installLazyMethods(inst, "ZodObject", {
5401
+ keyof() {
5402
+ return _enum(Object.keys(this._zod.def.shape));
5403
+ },
5404
+ catchall(catchall) {
5405
+ return this.clone({ ...this._zod.def, catchall });
5406
+ },
5407
+ passthrough() {
5408
+ return this.clone({ ...this._zod.def, catchall: unknown() });
5409
+ },
5410
+ loose() {
5411
+ return this.clone({ ...this._zod.def, catchall: unknown() });
5412
+ },
5413
+ strict() {
5414
+ return this.clone({ ...this._zod.def, catchall: never() });
5415
+ },
5416
+ strip() {
5417
+ return this.clone({ ...this._zod.def, catchall: undefined });
5418
+ },
5419
+ extend(incoming) {
5420
+ return exports_util.extend(this, incoming);
5421
+ },
5422
+ safeExtend(incoming) {
5423
+ return exports_util.safeExtend(this, incoming);
5424
+ },
5425
+ merge(other) {
5426
+ return exports_util.merge(this, other);
5427
+ },
5428
+ pick(mask) {
5429
+ return exports_util.pick(this, mask);
5430
+ },
5431
+ omit(mask) {
5432
+ return exports_util.omit(this, mask);
5433
+ },
5434
+ partial(...args) {
5435
+ return exports_util.partial(ZodOptional, this, args[0]);
5436
+ },
5437
+ required(...args) {
5438
+ return exports_util.required(ZodNonOptional, this, args[0]);
5439
+ }
5440
+ });
5128
5441
  });
5129
5442
  ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
5130
5443
  $ZodUnion.init(inst, def);
@@ -5225,10 +5538,12 @@ var init_schemas2 = __esm(() => {
5225
5538
  if (output instanceof Promise) {
5226
5539
  return output.then((output2) => {
5227
5540
  payload.value = output2;
5541
+ payload.fallback = true;
5228
5542
  return payload;
5229
5543
  });
5230
5544
  }
5231
5545
  payload.value = output;
5546
+ payload.fallback = true;
5232
5547
  return payload;
5233
5548
  };
5234
5549
  });
@@ -5283,6 +5598,10 @@ var init_schemas2 = __esm(() => {
5283
5598
  inst.in = def.in;
5284
5599
  inst.out = def.out;
5285
5600
  });
5601
+ ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
5602
+ ZodPipe.init(inst, def);
5603
+ $ZodPreprocess.init(inst, def);
5604
+ });
5286
5605
  ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
5287
5606
  $ZodReadonly.init(inst, def);
5288
5607
  ZodType.init(inst, def);
@@ -10794,7 +11113,7 @@ var require_dbcs_codec = __commonJS((exports) => {
10794
11113
  if (resCode !== undefined) {
10795
11114
  dbcsCode = resCode;
10796
11115
  nextChar = uCode;
10797
- } else {}
11116
+ }
10798
11117
  }
10799
11118
  seqObj = undefined;
10800
11119
  } else if (uCode >= 0) {
@@ -10859,7 +11178,7 @@ var require_dbcs_codec = __commonJS((exports) => {
10859
11178
  newBuf[j++] = dbcsCode >> 8;
10860
11179
  newBuf[j++] = dbcsCode & 255;
10861
11180
  }
10862
- } else {}
11181
+ }
10863
11182
  this.seqObj = undefined;
10864
11183
  }
10865
11184
  if (this.leadSurrogate !== -1) {
@@ -34707,7 +35026,9 @@ var init_schemas3 = __esm(() => {
34707
35026
  ...def,
34708
35027
  checks: [
34709
35028
  ...def.checks ?? [],
34710
- ...checks3.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
35029
+ ...checks3.map((ch) => typeof ch === "function" ? {
35030
+ _zod: { check: ch, def: { check: "custom" }, onattach: [] }
35031
+ } : ch)
34711
35032
  ]
34712
35033
  }, { parent: true });
34713
35034
  };
@@ -37235,12 +37556,12 @@ var require_code = __commonJS((exports) => {
37235
37556
  return item === "" || item === '""';
37236
37557
  }
37237
37558
  get str() {
37238
- var _a2;
37239
- return (_a2 = this._str) !== null && _a2 !== undefined ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
37559
+ var _a3;
37560
+ return (_a3 = this._str) !== null && _a3 !== undefined ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
37240
37561
  }
37241
37562
  get names() {
37242
- var _a2;
37243
- return (_a2 = this._names) !== null && _a2 !== undefined ? _a2 : this._names = this._items.reduce((names, c) => {
37563
+ var _a3;
37564
+ return (_a3 = this._names) !== null && _a3 !== undefined ? _a3 : this._names = this._items.reduce((names, c) => {
37244
37565
  if (c instanceof Name)
37245
37566
  names[c.str] = (names[c.str] || 0) + 1;
37246
37567
  return names;
@@ -37385,8 +37706,8 @@ var require_scope = __commonJS((exports) => {
37385
37706
  return `${prefix}${ng.index++}`;
37386
37707
  }
37387
37708
  _nameGroup(prefix) {
37388
- var _a2, _b;
37389
- if (((_b = (_a2 = this._parent) === null || _a2 === undefined ? undefined : _a2._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
37709
+ var _a3, _b;
37710
+ if (((_b = (_a3 = this._parent) === null || _a3 === undefined ? undefined : _a3._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
37390
37711
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
37391
37712
  }
37392
37713
  return this._names[prefix] = { prefix, index: 0 };
@@ -37421,12 +37742,12 @@ var require_scope = __commonJS((exports) => {
37421
37742
  return new ValueScopeName(prefix, this._newName(prefix));
37422
37743
  }
37423
37744
  value(nameOrPrefix, value) {
37424
- var _a2;
37745
+ var _a3;
37425
37746
  if (value.ref === undefined)
37426
37747
  throw new Error("CodeGen: ref must be passed in value");
37427
37748
  const name = this.toName(nameOrPrefix);
37428
37749
  const { prefix } = name;
37429
- const valueKey = (_a2 = value.key) !== null && _a2 !== undefined ? _a2 : value.ref;
37750
+ const valueKey = (_a3 = value.key) !== null && _a3 !== undefined ? _a3 : value.ref;
37430
37751
  let vs = this._values[prefix];
37431
37752
  if (vs) {
37432
37753
  const _name = vs.get(valueKey);
@@ -37754,8 +38075,8 @@ var require_codegen = __commonJS((exports) => {
37754
38075
  return this;
37755
38076
  }
37756
38077
  optimizeNames(names, constants) {
37757
- var _a2;
37758
- this.else = (_a2 = this.else) === null || _a2 === undefined ? undefined : _a2.optimizeNames(names, constants);
38078
+ var _a3;
38079
+ this.else = (_a3 = this.else) === null || _a3 === undefined ? undefined : _a3.optimizeNames(names, constants);
37759
38080
  if (!(super.optimizeNames(names, constants) || this.else))
37760
38081
  return;
37761
38082
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -37866,16 +38187,16 @@ var require_codegen = __commonJS((exports) => {
37866
38187
  return code;
37867
38188
  }
37868
38189
  optimizeNodes() {
37869
- var _a2, _b;
38190
+ var _a3, _b;
37870
38191
  super.optimizeNodes();
37871
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNodes();
38192
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNodes();
37872
38193
  (_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
37873
38194
  return this;
37874
38195
  }
37875
38196
  optimizeNames(names, constants) {
37876
- var _a2, _b;
38197
+ var _a3, _b;
37877
38198
  super.optimizeNames(names, constants);
37878
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNames(names, constants);
38199
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNames(names, constants);
37879
38200
  (_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants);
37880
38201
  return this;
37881
38202
  }
@@ -38598,8 +38919,8 @@ var require_applicability = __commonJS((exports) => {
38598
38919
  }
38599
38920
  exports.shouldUseGroup = shouldUseGroup;
38600
38921
  function shouldUseRule(schema, rule) {
38601
- var _a2;
38602
- return schema[rule.keyword] !== undefined || ((_a2 = rule.definition.implements) === null || _a2 === undefined ? undefined : _a2.some((kwd) => schema[kwd] !== undefined));
38922
+ var _a3;
38923
+ return schema[rule.keyword] !== undefined || ((_a3 = rule.definition.implements) === null || _a3 === undefined ? undefined : _a3.some((kwd) => schema[kwd] !== undefined));
38603
38924
  }
38604
38925
  exports.shouldUseRule = shouldUseRule;
38605
38926
  });
@@ -38974,14 +39295,14 @@ var require_keyword = __commonJS((exports) => {
38974
39295
  }
38975
39296
  exports.macroKeywordCode = macroKeywordCode;
38976
39297
  function funcKeywordCode(cxt, def) {
38977
- var _a2;
39298
+ var _a3;
38978
39299
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
38979
39300
  checkAsyncKeyword(it, def);
38980
39301
  const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
38981
39302
  const validateRef = useKeyword(gen, keyword, validate);
38982
39303
  const valid = gen.let("valid");
38983
39304
  cxt.block$data(valid, validateKeyword);
38984
- cxt.ok((_a2 = def.valid) !== null && _a2 !== undefined ? _a2 : valid);
39305
+ cxt.ok((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid);
38985
39306
  function validateKeyword() {
38986
39307
  if (def.errors === false) {
38987
39308
  assignValid();
@@ -39012,8 +39333,8 @@ var require_keyword = __commonJS((exports) => {
39012
39333
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
39013
39334
  }
39014
39335
  function reportErrs(errors4) {
39015
- var _a3;
39016
- gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid), errors4);
39336
+ var _a4;
39337
+ gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== undefined ? _a4 : valid), errors4);
39017
39338
  }
39018
39339
  }
39019
39340
  exports.funcKeywordCode = funcKeywordCode;
@@ -39968,7 +40289,7 @@ var require_compile = __commonJS((exports) => {
39968
40289
 
39969
40290
  class SchemaEnv {
39970
40291
  constructor(env) {
39971
- var _a2;
40292
+ var _a3;
39972
40293
  this.refs = {};
39973
40294
  this.dynamicAnchors = {};
39974
40295
  let schema;
@@ -39977,7 +40298,7 @@ var require_compile = __commonJS((exports) => {
39977
40298
  this.schema = env.schema;
39978
40299
  this.schemaId = env.schemaId;
39979
40300
  this.root = env.root || this;
39980
- this.baseId = (_a2 = env.baseId) !== null && _a2 !== undefined ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
40301
+ this.baseId = (_a3 = env.baseId) !== null && _a3 !== undefined ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
39981
40302
  this.schemaPath = env.schemaPath;
39982
40303
  this.localRefs = env.localRefs;
39983
40304
  this.meta = env.meta;
@@ -40072,14 +40393,14 @@ var require_compile = __commonJS((exports) => {
40072
40393
  }
40073
40394
  exports.compileSchema = compileSchema;
40074
40395
  function resolveRef(root, baseId, ref) {
40075
- var _a2;
40396
+ var _a3;
40076
40397
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
40077
40398
  const schOrFunc = root.refs[ref];
40078
40399
  if (schOrFunc)
40079
40400
  return schOrFunc;
40080
40401
  let _sch = resolve.call(this, root, ref);
40081
40402
  if (_sch === undefined) {
40082
- const schema = (_a2 = root.localRefs) === null || _a2 === undefined ? undefined : _a2[ref];
40403
+ const schema = (_a3 = root.localRefs) === null || _a3 === undefined ? undefined : _a3[ref];
40083
40404
  const { schemaId } = this.opts;
40084
40405
  if (schema)
40085
40406
  _sch = new SchemaEnv({ schema, schemaId, root, baseId });
@@ -40148,8 +40469,8 @@ var require_compile = __commonJS((exports) => {
40148
40469
  "definitions"
40149
40470
  ]);
40150
40471
  function getJsonPointer(parsedRef, { baseId, schema, root }) {
40151
- var _a2;
40152
- if (((_a2 = parsedRef.fragment) === null || _a2 === undefined ? undefined : _a2[0]) !== "/")
40472
+ var _a3;
40473
+ if (((_a3 = parsedRef.fragment) === null || _a3 === undefined ? undefined : _a3[0]) !== "/")
40153
40474
  return;
40154
40475
  for (const part of parsedRef.fragment.slice(1).split("/")) {
40155
40476
  if (typeof schema === "boolean")
@@ -40197,6 +40518,9 @@ var require_data = __commonJS((exports, module) => {
40197
40518
  var require_utils4 = __commonJS((exports, module) => {
40198
40519
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
40199
40520
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
40521
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
40522
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
40523
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
40200
40524
  function stringArrayToHexStripped(input) {
40201
40525
  let acc = "";
40202
40526
  let code = 0;
@@ -40390,27 +40714,77 @@ var require_utils4 = __commonJS((exports, module) => {
40390
40714
  }
40391
40715
  return output.join("");
40392
40716
  }
40393
- function normalizeComponentEncoding(component, esc2) {
40394
- const func = esc2 !== true ? escape : unescape;
40395
- if (component.scheme !== undefined) {
40396
- component.scheme = func(component.scheme);
40397
- }
40398
- if (component.userinfo !== undefined) {
40399
- component.userinfo = func(component.userinfo);
40400
- }
40401
- if (component.host !== undefined) {
40402
- component.host = func(component.host);
40717
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
40718
+ var HOST_DELIM_RE = /[@/?#:]/g;
40719
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
40720
+ function reescapeHostDelimiters(host, isIP) {
40721
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
40722
+ re.lastIndex = 0;
40723
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
40724
+ }
40725
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
40726
+ if (input.indexOf("%") === -1) {
40727
+ return input;
40403
40728
  }
40404
- if (component.path !== undefined) {
40405
- component.path = func(component.path);
40729
+ let output = "";
40730
+ for (let i = 0;i < input.length; i++) {
40731
+ if (input[i] === "%" && i + 2 < input.length) {
40732
+ const hex = input.slice(i + 1, i + 3);
40733
+ if (isHexPair(hex)) {
40734
+ const normalizedHex = hex.toUpperCase();
40735
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
40736
+ if (decodeUnreserved && isUnreserved(decoded)) {
40737
+ output += decoded;
40738
+ } else {
40739
+ output += "%" + normalizedHex;
40740
+ }
40741
+ i += 2;
40742
+ continue;
40743
+ }
40744
+ }
40745
+ output += input[i];
40406
40746
  }
40407
- if (component.query !== undefined) {
40408
- component.query = func(component.query);
40747
+ return output;
40748
+ }
40749
+ function normalizePathEncoding(input) {
40750
+ let output = "";
40751
+ for (let i = 0;i < input.length; i++) {
40752
+ if (input[i] === "%" && i + 2 < input.length) {
40753
+ const hex = input.slice(i + 1, i + 3);
40754
+ if (isHexPair(hex)) {
40755
+ const normalizedHex = hex.toUpperCase();
40756
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
40757
+ if (decoded !== "." && isUnreserved(decoded)) {
40758
+ output += decoded;
40759
+ } else {
40760
+ output += "%" + normalizedHex;
40761
+ }
40762
+ i += 2;
40763
+ continue;
40764
+ }
40765
+ }
40766
+ if (isPathCharacter(input[i])) {
40767
+ output += input[i];
40768
+ } else {
40769
+ output += escape(input[i]);
40770
+ }
40409
40771
  }
40410
- if (component.fragment !== undefined) {
40411
- component.fragment = func(component.fragment);
40772
+ return output;
40773
+ }
40774
+ function escapePreservingEscapes(input) {
40775
+ let output = "";
40776
+ for (let i = 0;i < input.length; i++) {
40777
+ if (input[i] === "%" && i + 2 < input.length) {
40778
+ const hex = input.slice(i + 1, i + 3);
40779
+ if (isHexPair(hex)) {
40780
+ output += "%" + hex.toUpperCase();
40781
+ i += 2;
40782
+ continue;
40783
+ }
40784
+ }
40785
+ output += escape(input[i]);
40412
40786
  }
40413
- return component;
40787
+ return output;
40414
40788
  }
40415
40789
  function recomposeAuthority(component) {
40416
40790
  const uriTokens = [];
@@ -40425,7 +40799,7 @@ var require_utils4 = __commonJS((exports, module) => {
40425
40799
  if (ipV6res.isIPV6 === true) {
40426
40800
  host = `[${ipV6res.escapedHost}]`;
40427
40801
  } else {
40428
- host = component.host;
40802
+ host = reescapeHostDelimiters(host, false);
40429
40803
  }
40430
40804
  }
40431
40805
  uriTokens.push(host);
@@ -40439,7 +40813,10 @@ var require_utils4 = __commonJS((exports, module) => {
40439
40813
  module.exports = {
40440
40814
  nonSimpleDomain,
40441
40815
  recomposeAuthority,
40442
- normalizeComponentEncoding,
40816
+ reescapeHostDelimiters,
40817
+ normalizePercentEncoding,
40818
+ normalizePathEncoding,
40819
+ escapePreservingEscapes,
40443
40820
  removeDotSegments,
40444
40821
  isIPv4,
40445
40822
  isUUID,
@@ -40624,11 +41001,11 @@ var require_schemes = __commonJS((exports, module) => {
40624
41001
 
40625
41002
  // node_modules/fast-uri/index.js
40626
41003
  var require_fast_uri = __commonJS((exports, module) => {
40627
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils4();
41004
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils4();
40628
41005
  var { SCHEMES, getSchemeHandler } = require_schemes();
40629
41006
  function normalize(uri, options) {
40630
41007
  if (typeof uri === "string") {
40631
- uri = serialize(parse6(uri, options), options);
41008
+ uri = normalizeString(uri, options);
40632
41009
  } else if (typeof uri === "object") {
40633
41010
  uri = parse6(serialize(uri, options), options);
40634
41011
  }
@@ -40694,19 +41071,9 @@ var require_fast_uri = __commonJS((exports, module) => {
40694
41071
  return target;
40695
41072
  }
40696
41073
  function equal(uriA, uriB, options) {
40697
- if (typeof uriA === "string") {
40698
- uriA = unescape(uriA);
40699
- uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
40700
- } else if (typeof uriA === "object") {
40701
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
40702
- }
40703
- if (typeof uriB === "string") {
40704
- uriB = unescape(uriB);
40705
- uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
40706
- } else if (typeof uriB === "object") {
40707
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
40708
- }
40709
- return uriA.toLowerCase() === uriB.toLowerCase();
41074
+ const normalizedA = normalizeComparableURI(uriA, options);
41075
+ const normalizedB = normalizeComparableURI(uriB, options);
41076
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
40710
41077
  }
40711
41078
  function serialize(cmpts, opts) {
40712
41079
  const component = {
@@ -40732,12 +41099,12 @@ var require_fast_uri = __commonJS((exports, module) => {
40732
41099
  schemeHandler.serialize(component, options);
40733
41100
  if (component.path !== undefined) {
40734
41101
  if (!options.skipEscape) {
40735
- component.path = escape(component.path);
41102
+ component.path = escapePreservingEscapes(component.path);
40736
41103
  if (component.scheme !== undefined) {
40737
41104
  component.path = component.path.split("%3A").join(":");
40738
41105
  }
40739
41106
  } else {
40740
- component.path = unescape(component.path);
41107
+ component.path = normalizePercentEncoding(component.path);
40741
41108
  }
40742
41109
  }
40743
41110
  if (options.reference !== "suffix" && component.scheme) {
@@ -40772,7 +41139,16 @@ var require_fast_uri = __commonJS((exports, module) => {
40772
41139
  return uriTokens.join("");
40773
41140
  }
40774
41141
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
40775
- function parse6(uri, opts) {
41142
+ function getParseError(parsed, matches) {
41143
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
41144
+ return 'URI path must start with "/" when authority is present.';
41145
+ }
41146
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
41147
+ return "URI port is malformed.";
41148
+ }
41149
+ return;
41150
+ }
41151
+ function parseWithStatus(uri, opts) {
40776
41152
  const options = Object.assign({}, opts);
40777
41153
  const parsed = {
40778
41154
  scheme: undefined,
@@ -40783,6 +41159,7 @@ var require_fast_uri = __commonJS((exports, module) => {
40783
41159
  query: undefined,
40784
41160
  fragment: undefined
40785
41161
  };
41162
+ let malformedAuthorityOrPort = false;
40786
41163
  let isIP = false;
40787
41164
  if (options.reference === "suffix") {
40788
41165
  if (options.scheme) {
@@ -40803,6 +41180,11 @@ var require_fast_uri = __commonJS((exports, module) => {
40803
41180
  if (isNaN(parsed.port)) {
40804
41181
  parsed.port = matches[5];
40805
41182
  }
41183
+ const parseError = getParseError(parsed, matches);
41184
+ if (parseError !== undefined) {
41185
+ parsed.error = parsed.error || parseError;
41186
+ malformedAuthorityOrPort = true;
41187
+ }
40806
41188
  if (parsed.host) {
40807
41189
  const ipv4result = isIPv4(parsed.host);
40808
41190
  if (ipv4result === false) {
@@ -40841,14 +41223,18 @@ var require_fast_uri = __commonJS((exports, module) => {
40841
41223
  parsed.scheme = unescape(parsed.scheme);
40842
41224
  }
40843
41225
  if (parsed.host !== undefined) {
40844
- parsed.host = unescape(parsed.host);
41226
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
40845
41227
  }
40846
41228
  }
40847
41229
  if (parsed.path) {
40848
- parsed.path = escape(unescape(parsed.path));
41230
+ parsed.path = normalizePathEncoding(parsed.path);
40849
41231
  }
40850
41232
  if (parsed.fragment) {
40851
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
41233
+ try {
41234
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
41235
+ } catch {
41236
+ parsed.error = parsed.error || "URI malformed";
41237
+ }
40852
41238
  }
40853
41239
  }
40854
41240
  if (schemeHandler && schemeHandler.parse) {
@@ -40857,7 +41243,29 @@ var require_fast_uri = __commonJS((exports, module) => {
40857
41243
  } else {
40858
41244
  parsed.error = parsed.error || "URI can not be parsed.";
40859
41245
  }
40860
- return parsed;
41246
+ return { parsed, malformedAuthorityOrPort };
41247
+ }
41248
+ function parse6(uri, opts) {
41249
+ return parseWithStatus(uri, opts).parsed;
41250
+ }
41251
+ function normalizeString(uri, opts) {
41252
+ return normalizeStringWithStatus(uri, opts).normalized;
41253
+ }
41254
+ function normalizeStringWithStatus(uri, opts) {
41255
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
41256
+ return {
41257
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
41258
+ malformedAuthorityOrPort
41259
+ };
41260
+ }
41261
+ function normalizeComparableURI(uri, opts) {
41262
+ if (typeof uri === "string") {
41263
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
41264
+ return malformedAuthorityOrPort ? undefined : normalized;
41265
+ }
41266
+ if (typeof uri === "object") {
41267
+ return serialize(uri, opts);
41268
+ }
40861
41269
  }
40862
41270
  var fastUri = {
40863
41271
  SCHEMES,
@@ -40960,9 +41368,9 @@ var require_core = __commonJS((exports) => {
40960
41368
  };
40961
41369
  var MAX_EXPRESSION = 200;
40962
41370
  function requiredOptions(o) {
40963
- var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
41371
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
40964
41372
  const s = o.strict;
40965
- const _optz = (_a2 = o.code) === null || _a2 === undefined ? undefined : _a2.optimize;
41373
+ const _optz = (_a3 = o.code) === null || _a3 === undefined ? undefined : _a3.optimize;
40966
41374
  const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;
40967
41375
  const regExp = (_c = (_b = o.code) === null || _b === undefined ? undefined : _b.regExp) !== null && _c !== undefined ? _c : defaultRegExp;
40968
41376
  const uriResolver = (_d = o.uriResolver) !== null && _d !== undefined ? _d : uri_1.default;
@@ -40992,7 +41400,7 @@ var require_core = __commonJS((exports) => {
40992
41400
  constructor(opts = {}) {
40993
41401
  this.schemas = {};
40994
41402
  this.refs = {};
40995
- this.formats = {};
41403
+ this.formats = Object.create(null);
40996
41404
  this._compilations = new Set;
40997
41405
  this._loading = {};
40998
41406
  this._cache = new Map;
@@ -41421,7 +41829,7 @@ var require_core = __commonJS((exports) => {
41421
41829
  }
41422
41830
  }
41423
41831
  function addRule(keyword, definition, dataType) {
41424
- var _a2;
41832
+ var _a3;
41425
41833
  const post = definition === null || definition === undefined ? undefined : definition.post;
41426
41834
  if (dataType && post)
41427
41835
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -41447,7 +41855,7 @@ var require_core = __commonJS((exports) => {
41447
41855
  else
41448
41856
  ruleGroup.rules.push(rule);
41449
41857
  RULES.all[keyword] = rule;
41450
- (_a2 = definition.implements) === null || _a2 === undefined || _a2.forEach((kwd) => this.addKeyword(kwd));
41858
+ (_a3 = definition.implements) === null || _a3 === undefined || _a3.forEach((kwd) => this.addKeyword(kwd));
41451
41859
  }
41452
41860
  function addBeforeRule(ruleGroup, rule, before) {
41453
41861
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -41575,10 +41983,10 @@ var require_ref2 = __commonJS((exports) => {
41575
41983
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
41576
41984
  }
41577
41985
  function addEvaluatedFrom(source) {
41578
- var _a2;
41986
+ var _a3;
41579
41987
  if (!it.opts.unevaluated)
41580
41988
  return;
41581
- const schEvaluated = (_a2 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a2 === undefined ? undefined : _a2.evaluated;
41989
+ const schEvaluated = (_a3 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a3 === undefined ? undefined : _a3.evaluated;
41582
41990
  if (it.props !== true) {
41583
41991
  if (schEvaluated && !schEvaluated.dynamicProps) {
41584
41992
  if (schEvaluated.props !== undefined) {
@@ -43105,7 +43513,7 @@ var require_discriminator = __commonJS((exports) => {
43105
43513
  return _valid;
43106
43514
  }
43107
43515
  function getMapping() {
43108
- var _a2;
43516
+ var _a3;
43109
43517
  const oneOfMapping = {};
43110
43518
  const topRequired = hasRequired(parentSchema);
43111
43519
  let tagRequired = true;
@@ -43119,7 +43527,7 @@ var require_discriminator = __commonJS((exports) => {
43119
43527
  if (sch === undefined)
43120
43528
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
43121
43529
  }
43122
- const propSch = (_a2 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a2 === undefined ? undefined : _a2[tagName];
43530
+ const propSch = (_a3 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a3 === undefined ? undefined : _a3[tagName];
43123
43531
  if (typeof propSch != "object") {
43124
43532
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
43125
43533
  }
@@ -43599,12 +44007,12 @@ var require_code3 = __commonJS((exports) => {
43599
44007
  return item === "" || item === '""';
43600
44008
  }
43601
44009
  get str() {
43602
- var _a2;
43603
- return (_a2 = this._str) !== null && _a2 !== undefined ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
44010
+ var _a3;
44011
+ return (_a3 = this._str) !== null && _a3 !== undefined ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
43604
44012
  }
43605
44013
  get names() {
43606
- var _a2;
43607
- return (_a2 = this._names) !== null && _a2 !== undefined ? _a2 : this._names = this._items.reduce((names, c) => {
44014
+ var _a3;
44015
+ return (_a3 = this._names) !== null && _a3 !== undefined ? _a3 : this._names = this._items.reduce((names, c) => {
43608
44016
  if (c instanceof Name)
43609
44017
  names[c.str] = (names[c.str] || 0) + 1;
43610
44018
  return names;
@@ -43749,8 +44157,8 @@ var require_scope2 = __commonJS((exports) => {
43749
44157
  return `${prefix}${ng.index++}`;
43750
44158
  }
43751
44159
  _nameGroup(prefix) {
43752
- var _a2, _b;
43753
- if (((_b = (_a2 = this._parent) === null || _a2 === undefined ? undefined : _a2._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
44160
+ var _a3, _b;
44161
+ if (((_b = (_a3 = this._parent) === null || _a3 === undefined ? undefined : _a3._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
43754
44162
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
43755
44163
  }
43756
44164
  return this._names[prefix] = { prefix, index: 0 };
@@ -43785,12 +44193,12 @@ var require_scope2 = __commonJS((exports) => {
43785
44193
  return new ValueScopeName(prefix, this._newName(prefix));
43786
44194
  }
43787
44195
  value(nameOrPrefix, value) {
43788
- var _a2;
44196
+ var _a3;
43789
44197
  if (value.ref === undefined)
43790
44198
  throw new Error("CodeGen: ref must be passed in value");
43791
44199
  const name = this.toName(nameOrPrefix);
43792
44200
  const { prefix } = name;
43793
- const valueKey = (_a2 = value.key) !== null && _a2 !== undefined ? _a2 : value.ref;
44201
+ const valueKey = (_a3 = value.key) !== null && _a3 !== undefined ? _a3 : value.ref;
43794
44202
  let vs = this._values[prefix];
43795
44203
  if (vs) {
43796
44204
  const _name = vs.get(valueKey);
@@ -44118,8 +44526,8 @@ var require_codegen2 = __commonJS((exports) => {
44118
44526
  return this;
44119
44527
  }
44120
44528
  optimizeNames(names, constants) {
44121
- var _a2;
44122
- this.else = (_a2 = this.else) === null || _a2 === undefined ? undefined : _a2.optimizeNames(names, constants);
44529
+ var _a3;
44530
+ this.else = (_a3 = this.else) === null || _a3 === undefined ? undefined : _a3.optimizeNames(names, constants);
44123
44531
  if (!(super.optimizeNames(names, constants) || this.else))
44124
44532
  return;
44125
44533
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -44230,16 +44638,16 @@ var require_codegen2 = __commonJS((exports) => {
44230
44638
  return code;
44231
44639
  }
44232
44640
  optimizeNodes() {
44233
- var _a2, _b;
44641
+ var _a3, _b;
44234
44642
  super.optimizeNodes();
44235
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNodes();
44643
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNodes();
44236
44644
  (_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
44237
44645
  return this;
44238
44646
  }
44239
44647
  optimizeNames(names, constants) {
44240
- var _a2, _b;
44648
+ var _a3, _b;
44241
44649
  super.optimizeNames(names, constants);
44242
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNames(names, constants);
44650
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNames(names, constants);
44243
44651
  (_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants);
44244
44652
  return this;
44245
44653
  }
@@ -44962,8 +45370,8 @@ var require_applicability2 = __commonJS((exports) => {
44962
45370
  }
44963
45371
  exports.shouldUseGroup = shouldUseGroup;
44964
45372
  function shouldUseRule(schema, rule) {
44965
- var _a2;
44966
- return schema[rule.keyword] !== undefined || ((_a2 = rule.definition.implements) === null || _a2 === undefined ? undefined : _a2.some((kwd) => schema[kwd] !== undefined));
45373
+ var _a3;
45374
+ return schema[rule.keyword] !== undefined || ((_a3 = rule.definition.implements) === null || _a3 === undefined ? undefined : _a3.some((kwd) => schema[kwd] !== undefined));
44967
45375
  }
44968
45376
  exports.shouldUseRule = shouldUseRule;
44969
45377
  });
@@ -45338,14 +45746,14 @@ var require_keyword2 = __commonJS((exports) => {
45338
45746
  }
45339
45747
  exports.macroKeywordCode = macroKeywordCode;
45340
45748
  function funcKeywordCode(cxt, def) {
45341
- var _a2;
45749
+ var _a3;
45342
45750
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
45343
45751
  checkAsyncKeyword(it, def);
45344
45752
  const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
45345
45753
  const validateRef = useKeyword(gen, keyword, validate);
45346
45754
  const valid = gen.let("valid");
45347
45755
  cxt.block$data(valid, validateKeyword);
45348
- cxt.ok((_a2 = def.valid) !== null && _a2 !== undefined ? _a2 : valid);
45756
+ cxt.ok((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid);
45349
45757
  function validateKeyword() {
45350
45758
  if (def.errors === false) {
45351
45759
  assignValid();
@@ -45376,8 +45784,8 @@ var require_keyword2 = __commonJS((exports) => {
45376
45784
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
45377
45785
  }
45378
45786
  function reportErrs(errors4) {
45379
- var _a3;
45380
- gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid), errors4);
45787
+ var _a4;
45788
+ gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== undefined ? _a4 : valid), errors4);
45381
45789
  }
45382
45790
  }
45383
45791
  exports.funcKeywordCode = funcKeywordCode;
@@ -46290,7 +46698,7 @@ var require_compile2 = __commonJS((exports) => {
46290
46698
 
46291
46699
  class SchemaEnv {
46292
46700
  constructor(env) {
46293
- var _a2;
46701
+ var _a3;
46294
46702
  this.refs = {};
46295
46703
  this.dynamicAnchors = {};
46296
46704
  let schema;
@@ -46299,7 +46707,7 @@ var require_compile2 = __commonJS((exports) => {
46299
46707
  this.schema = env.schema;
46300
46708
  this.schemaId = env.schemaId;
46301
46709
  this.root = env.root || this;
46302
- this.baseId = (_a2 = env.baseId) !== null && _a2 !== undefined ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
46710
+ this.baseId = (_a3 = env.baseId) !== null && _a3 !== undefined ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
46303
46711
  this.schemaPath = env.schemaPath;
46304
46712
  this.localRefs = env.localRefs;
46305
46713
  this.meta = env.meta;
@@ -46394,14 +46802,14 @@ var require_compile2 = __commonJS((exports) => {
46394
46802
  }
46395
46803
  exports.compileSchema = compileSchema;
46396
46804
  function resolveRef(root, baseId, ref) {
46397
- var _a2;
46805
+ var _a3;
46398
46806
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
46399
46807
  const schOrFunc = root.refs[ref];
46400
46808
  if (schOrFunc)
46401
46809
  return schOrFunc;
46402
46810
  let _sch = resolve.call(this, root, ref);
46403
46811
  if (_sch === undefined) {
46404
- const schema = (_a2 = root.localRefs) === null || _a2 === undefined ? undefined : _a2[ref];
46812
+ const schema = (_a3 = root.localRefs) === null || _a3 === undefined ? undefined : _a3[ref];
46405
46813
  const { schemaId } = this.opts;
46406
46814
  if (schema)
46407
46815
  _sch = new SchemaEnv({ schema, schemaId, root, baseId });
@@ -46470,8 +46878,8 @@ var require_compile2 = __commonJS((exports) => {
46470
46878
  "definitions"
46471
46879
  ]);
46472
46880
  function getJsonPointer(parsedRef, { baseId, schema, root }) {
46473
- var _a2;
46474
- if (((_a2 = parsedRef.fragment) === null || _a2 === undefined ? undefined : _a2[0]) !== "/")
46881
+ var _a3;
46882
+ if (((_a3 = parsedRef.fragment) === null || _a3 === undefined ? undefined : _a3[0]) !== "/")
46475
46883
  return;
46476
46884
  for (const part of parsedRef.fragment.slice(1).split("/")) {
46477
46885
  if (typeof schema === "boolean")
@@ -46602,9 +47010,9 @@ var require_core3 = __commonJS((exports) => {
46602
47010
  };
46603
47011
  var MAX_EXPRESSION = 200;
46604
47012
  function requiredOptions(o) {
46605
- var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
47013
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
46606
47014
  const s = o.strict;
46607
- const _optz = (_a2 = o.code) === null || _a2 === undefined ? undefined : _a2.optimize;
47015
+ const _optz = (_a3 = o.code) === null || _a3 === undefined ? undefined : _a3.optimize;
46608
47016
  const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;
46609
47017
  const regExp = (_c = (_b = o.code) === null || _b === undefined ? undefined : _b.regExp) !== null && _c !== undefined ? _c : defaultRegExp;
46610
47018
  const uriResolver = (_d = o.uriResolver) !== null && _d !== undefined ? _d : uri_1.default;
@@ -46634,7 +47042,7 @@ var require_core3 = __commonJS((exports) => {
46634
47042
  constructor(opts = {}) {
46635
47043
  this.schemas = {};
46636
47044
  this.refs = {};
46637
- this.formats = {};
47045
+ this.formats = Object.create(null);
46638
47046
  this._compilations = new Set;
46639
47047
  this._loading = {};
46640
47048
  this._cache = new Map;
@@ -47063,7 +47471,7 @@ var require_core3 = __commonJS((exports) => {
47063
47471
  }
47064
47472
  }
47065
47473
  function addRule(keyword, definition, dataType) {
47066
- var _a2;
47474
+ var _a3;
47067
47475
  const post = definition === null || definition === undefined ? undefined : definition.post;
47068
47476
  if (dataType && post)
47069
47477
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -47089,7 +47497,7 @@ var require_core3 = __commonJS((exports) => {
47089
47497
  else
47090
47498
  ruleGroup.rules.push(rule);
47091
47499
  RULES.all[keyword] = rule;
47092
- (_a2 = definition.implements) === null || _a2 === undefined || _a2.forEach((kwd) => this.addKeyword(kwd));
47500
+ (_a3 = definition.implements) === null || _a3 === undefined || _a3.forEach((kwd) => this.addKeyword(kwd));
47093
47501
  }
47094
47502
  function addBeforeRule(ruleGroup, rule, before) {
47095
47503
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -47217,10 +47625,10 @@ var require_ref3 = __commonJS((exports) => {
47217
47625
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
47218
47626
  }
47219
47627
  function addEvaluatedFrom(source) {
47220
- var _a2;
47628
+ var _a3;
47221
47629
  if (!it.opts.unevaluated)
47222
47630
  return;
47223
- const schEvaluated = (_a2 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a2 === undefined ? undefined : _a2.evaluated;
47631
+ const schEvaluated = (_a3 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a3 === undefined ? undefined : _a3.evaluated;
47224
47632
  if (it.props !== true) {
47225
47633
  if (schEvaluated && !schEvaluated.dynamicProps) {
47226
47634
  if (schEvaluated.props !== undefined) {
@@ -48747,7 +49155,7 @@ var require_discriminator2 = __commonJS((exports) => {
48747
49155
  return _valid;
48748
49156
  }
48749
49157
  function getMapping() {
48750
- var _a2;
49158
+ var _a3;
48751
49159
  const oneOfMapping = {};
48752
49160
  const topRequired = hasRequired(parentSchema);
48753
49161
  let tagRequired = true;
@@ -48761,7 +49169,7 @@ var require_discriminator2 = __commonJS((exports) => {
48761
49169
  if (sch === undefined)
48762
49170
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
48763
49171
  }
48764
- const propSch = (_a2 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a2 === undefined ? undefined : _a2[tagName];
49172
+ const propSch = (_a3 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a3 === undefined ? undefined : _a3[tagName];
48765
49173
  if (typeof propSch != "object") {
48766
49174
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
48767
49175
  }
@@ -49117,9 +49525,9 @@ var require_dist2 = __commonJS((exports, module) => {
49117
49525
  return f;
49118
49526
  };
49119
49527
  function addFormats(ajv, list, fs, exportName) {
49120
- var _a2;
49528
+ var _a3;
49121
49529
  var _b;
49122
- (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
49530
+ (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
49123
49531
  for (const f of list)
49124
49532
  ajv.addFormat(f, fs[f]);
49125
49533
  }
@@ -50571,9 +50979,9 @@ var init_config = __esm(() => {
50571
50979
  SDK_METADATA = {
50572
50980
  language: "typescript",
50573
50981
  openapiDocVersion: "1.0",
50574
- sdkVersion: "2.1.5",
50575
- genVersion: "2.881.4",
50576
- userAgent: "speakeasy-sdk/mcp-typescript 2.1.5 2.881.4 1.0 @flexprice/mcp-server"
50982
+ sdkVersion: "2.1.9",
50983
+ genVersion: "2.882.0",
50984
+ userAgent: "speakeasy-sdk/mcp-typescript 2.1.9 2.882.0 1.0 @flexprice/mcp-server"
50577
50985
  };
50578
50986
  });
50579
50987
 
@@ -53576,6 +53984,7 @@ var init_customerfilter = __esm(() => {
53576
53984
  external_ids: array(string2()).optional(),
53577
53985
  filters: array(FilterCondition$zodSchema).optional(),
53578
53986
  limit: int().optional(),
53987
+ metadata: record(string2(), string2()).optional(),
53579
53988
  offset: int().optional(),
53580
53989
  order: CustomerFilterOrder$zodSchema.optional(),
53581
53990
  sort: array(SortCondition$zodSchema).optional(),
@@ -54139,7 +54548,7 @@ For USD: $12.50`),
54139
54548
  tier_mode: BillingTier$zodSchema.optional(),
54140
54549
  tiers: array(PricePriceTier$zodSchema).optional(),
54141
54550
  transform_quantity: PriceJSONBTransformQuantity$zodSchema.optional(),
54142
- trial_period: int().optional().describe(`TrialPeriod is the number of days for the trial period
54551
+ trial_period_days: int().optional().describe(`TrialPeriodDays is the number of days for the trial period
54143
54552
  Note: This is only applicable for recurring prices (BILLING_CADENCE_RECURRING)`),
54144
54553
  type: PriceType$zodSchema.optional(),
54145
54554
  updated_at: exports_iso.datetime({ offset: true }).optional(),
@@ -54243,7 +54652,6 @@ var init_subscriptionsubscriptionlineitem = __esm(() => {
54243
54652
  subscription_id: string2().optional(),
54244
54653
  subscription_phase_id: string2().optional(),
54245
54654
  tenant_id: string2().optional(),
54246
- trial_period: int().optional(),
54247
54655
  updated_at: exports_iso.datetime({ offset: true }).optional(),
54248
54656
  updated_by: string2().optional()
54249
54657
  });
@@ -55570,6 +55978,8 @@ var init_invoicebillingreason = __esm(() => {
55570
55978
  "SUBSCRIPTION_CREATE",
55571
55979
  "SUBSCRIPTION_CYCLE",
55572
55980
  "SUBSCRIPTION_UPDATE",
55981
+ "SUBSCRIPTION_TRIAL_END",
55982
+ "SUBSCRIPTION_TRIAL_START",
55573
55983
  "PRORATION",
55574
55984
  "MANUAL"
55575
55985
  ]);
@@ -56547,7 +56957,7 @@ For USD: $12.50`),
56547
56957
  tier_mode: BillingTier$zodSchema.optional(),
56548
56958
  tiers: array(PricePriceTier$zodSchema).optional(),
56549
56959
  transform_quantity: PriceJSONBTransformQuantity$zodSchema.optional(),
56550
- trial_period: int().optional().describe(`TrialPeriod is the number of days for the trial period
56960
+ trial_period_days: int().optional().describe(`TrialPeriodDays is the number of days for the trial period
56551
56961
  Note: This is only applicable for recurring prices (BILLING_CADENCE_RECURRING)`),
56552
56962
  type: PriceType$zodSchema.optional(),
56553
56963
  updated_at: exports_iso.datetime({ offset: true }).optional(),
@@ -56749,8 +57159,10 @@ var init_subscriptiontype = __esm(() => {
56749
57159
  init_zod();
56750
57160
  SubscriptionType$zodSchema = _enum([
56751
57161
  "standalone",
57162
+ "delegated_invoicing",
56752
57163
  "parent",
56753
- "inherited"
57164
+ "inherited",
57165
+ "grouped_invoicing"
56754
57166
  ]);
56755
57167
  });
56756
57168
 
@@ -58969,6 +59381,7 @@ var init_planfilter = __esm(() => {
58969
59381
  filters: array(FilterCondition$zodSchema).optional().describe("filters allows complex filtering based on multiple fields"),
58970
59382
  limit: int().optional(),
58971
59383
  lookup_key: string2().optional(),
59384
+ metadata: record(string2(), string2()).optional(),
58972
59385
  offset: int().optional(),
58973
59386
  order: PlanFilterOrder$zodSchema.optional(),
58974
59387
  plan_ids: array(string2()).optional(),
@@ -59437,7 +59850,7 @@ var init_createpricerequest = __esm(() => {
59437
59850
  tier_mode: BillingTier$zodSchema.optional(),
59438
59851
  tiers: array(CreatePriceTier$zodSchema).optional(),
59439
59852
  transform_quantity: PriceTransformQuantity$zodSchema.optional(),
59440
- trial_period: int().optional(),
59853
+ trial_period_days: int().optional(),
59441
59854
  type: PriceType$zodSchema
59442
59855
  });
59443
59856
  });
@@ -61118,7 +61531,7 @@ var init_subscriptionpricecreaterequest = __esm(() => {
61118
61531
  tier_mode: BillingTier$zodSchema.optional(),
61119
61532
  tiers: array(CreatePriceTier$zodSchema).optional(),
61120
61533
  transform_quantity: PriceTransformQuantity$zodSchema.optional(),
61121
- trial_period: int().optional(),
61534
+ trial_period_days: int().optional(),
61122
61535
  type: PriceType$zodSchema
61123
61536
  });
61124
61537
  });
@@ -61202,9 +61615,14 @@ var SubscriptionInheritanceConfig$zodSchema;
61202
61615
  var init_subscriptioninheritanceconfig = __esm(() => {
61203
61616
  init_zod();
61204
61617
  SubscriptionInheritanceConfig$zodSchema = object({
61205
- external_customer_ids_to_inherit_subscription: array(string2()).optional(),
61206
- invoicing_customer_external_id: string2().optional(),
61207
- parent_subscription_id: string2().optional()
61618
+ external_customer_ids_to_inherit_subscription: array(string2()).optional().describe(`ExternalCustomerIDsToInheritSubscription: child customer external IDs for which
61619
+ inherited skeleton subscriptions will be created. Only valid for parent behavior.`),
61620
+ invoicing_customer_external_id: string2().optional().describe(`InvoicingCustomerExternalID sets a different billing recipient (external ID).
61621
+ Required for delegated; rejected for inherited; optional for others.`),
61622
+ parent_subscription_id: string2().optional().describe(`ParentSubscriptionID links this subscription to an existing parent.
61623
+ Required for inherited and grouped_invoicing; rejected for standalone, delegated, parent.`),
61624
+ subscriptions_ids_for_grouped_invoicing: array(string2()).optional().describe(`SubscriptionsIDsForGroupedInvoicing: existing standalone subscription IDs to convert to
61625
+ grouped_invoicing under this parent at creation time. Only valid for parent behavior.`)
61208
61626
  });
61209
61627
  });
61210
61628
 
@@ -61288,8 +61706,8 @@ and must be same as what you provided as external_id while creating the customer
61288
61706
  start_date: exports_iso.datetime({ offset: true }).optional(),
61289
61707
  subscription_status: SubscriptionStatus$zodSchema.optional(),
61290
61708
  tax_rate_overrides: array(TaxRateOverride$zodSchema).optional().describe("tax_rate_overrides is the tax rate overrides\tto be applied to the subscription"),
61291
- trial_end: exports_iso.datetime({ offset: true }).optional(),
61292
- trial_start: exports_iso.datetime({ offset: true }).optional()
61709
+ trial_period_days: int().optional().describe(`TrialPeriodDays: nil = inherit trial length from plan recurring-fixed prices (must be uniform).
61710
+ 0 = explicitly no trial (overrides catalog). >0 = override duration in days.`)
61293
61711
  });
61294
61712
  });
61295
61713
 
@@ -61450,7 +61868,6 @@ var init_subscriptionlineitemresponse = __esm(() => {
61450
61868
  subscription_id: string2().optional(),
61451
61869
  subscription_phase_id: string2().optional(),
61452
61870
  tenant_id: string2().optional(),
61453
- trial_period: int().optional(),
61454
61871
  updated_at: exports_iso.datetime({ offset: true }).optional(),
61455
61872
  updated_by: string2().optional()
61456
61873
  });
@@ -61965,6 +62382,28 @@ Use when applying a plan change (e.g. upgrade or downgrade). Executes proration
61965
62382
  };
61966
62383
  });
61967
62384
 
62385
+ // src/models/groupedinvoicingaction.ts
62386
+ var GroupedInvoicingAction$zodSchema;
62387
+ var init_groupedinvoicingaction = __esm(() => {
62388
+ init_zod();
62389
+ GroupedInvoicingAction$zodSchema = _enum([
62390
+ "add",
62391
+ "remove"
62392
+ ]);
62393
+ });
62394
+
62395
+ // src/models/submodifygroupedinvoicingparams.ts
62396
+ var SubModifyGroupedInvoicingParams$zodSchema;
62397
+ var init_submodifygroupedinvoicingparams = __esm(() => {
62398
+ init_zod();
62399
+ init_groupedinvoicingaction();
62400
+ SubModifyGroupedInvoicingParams$zodSchema = object({
62401
+ action: GroupedInvoicingAction$zodSchema,
62402
+ child_subscription_ids: array(string2()).optional(),
62403
+ parent_subscription_id: string2().optional().describe("ParentSubscriptionID is required for action 'add'.")
62404
+ });
62405
+ });
62406
+
61968
62407
  // src/models/submodifyinheritancerequest.ts
61969
62408
  var SubModifyInheritanceRequest$zodSchema;
61970
62409
  var init_submodifyinheritancerequest = __esm(() => {
@@ -62002,7 +62441,8 @@ var init_subscriptionmodifytype = __esm(() => {
62002
62441
  init_zod();
62003
62442
  SubscriptionModifyType$zodSchema = _enum([
62004
62443
  "inheritance",
62005
- "quantity_change"
62444
+ "quantity_change",
62445
+ "grouped_invoicing"
62006
62446
  ]);
62007
62447
  });
62008
62448
 
@@ -62010,10 +62450,12 @@ var init_subscriptionmodifytype = __esm(() => {
62010
62450
  var ExecuteSubscriptionModifyRequest$zodSchema;
62011
62451
  var init_executesubscriptionmodifyrequest = __esm(() => {
62012
62452
  init_zod();
62453
+ init_submodifygroupedinvoicingparams();
62013
62454
  init_submodifyinheritancerequest();
62014
62455
  init_submodifyquantitychangerequest();
62015
62456
  init_subscriptionmodifytype();
62016
62457
  ExecuteSubscriptionModifyRequest$zodSchema = object({
62458
+ grouped_invoicing_params: SubModifyGroupedInvoicingParams$zodSchema.optional(),
62017
62459
  inheritance_params: SubModifyInheritanceRequest$zodSchema.optional(),
62018
62460
  quantity_change_params: SubModifyQuantityChangeRequest$zodSchema.optional(),
62019
62461
  type: SubscriptionModifyType$zodSchema
@@ -63682,326 +64124,30 @@ async function $do63(client$, request, options) {
63682
64124
  response: doResult.value
63683
64125
  }];
63684
64126
  }
63685
- var init_subscriptionsListAllSubscriptionSchedules = __esm(() => {
63686
- init_encodings();
63687
- init_primitives();
63688
- init_schemas4();
63689
- init_security();
63690
- init_url();
63691
- init_listallsubscriptionschedulesop();
63692
- init_async();
63693
- });
63694
-
63695
- // src/mcp-server/tools/subscriptionsListAllSubscriptionSchedules.ts
63696
- var args62, tool$subscriptionsListAllSubscriptionSchedules;
63697
- var init_subscriptionsListAllSubscriptionSchedules2 = __esm(() => {
63698
- init_subscriptionsListAllSubscriptionSchedules();
63699
- init_listallsubscriptionschedulesop();
63700
- init_tools();
63701
- args62 = {
63702
- request: ListAllSubscriptionSchedulesRequest$zodSchema.optional()
63703
- };
63704
- tool$subscriptionsListAllSubscriptionSchedules = {
63705
- name: "list-all-subscription-schedules",
63706
- description: `List all subscription schedules
63707
-
63708
- Use when listing or searching scheduled changes across subscriptions (e.g. admin view). Returns schedules with optional filtering.`,
63709
- scopes: ["read"],
63710
- annotations: {
63711
- title: "",
63712
- destructiveHint: false,
63713
- idempotentHint: false,
63714
- openWorldHint: false,
63715
- readOnlyHint: true
63716
- },
63717
- args: args62,
63718
- tool: async (client, args63, ctx) => {
63719
- const [result] = await subscriptionsListAllSubscriptionSchedules(client, args63.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63720
- if (!result.ok) {
63721
- return {
63722
- content: [{ type: "text", text: result.error.message }],
63723
- isError: true
63724
- };
63725
- }
63726
- return formatResult(result.value);
63727
- }
63728
- };
63729
- });
63730
-
63731
- // src/models/subscriptionpauseresponse.ts
63732
- var SubscriptionPauseResponse$zodSchema;
63733
- var init_subscriptionpauseresponse = __esm(() => {
63734
- init_zod();
63735
- init_pausemode();
63736
- init_pausestatus();
63737
- init_resumemode();
63738
- init_status();
63739
- SubscriptionPauseResponse$zodSchema = object({
63740
- created_at: exports_iso.datetime({ offset: true }).optional(),
63741
- created_by: string2().optional(),
63742
- environment_id: string2().optional().describe("EnvironmentID is the environment identifier for the pause"),
63743
- id: string2().optional().describe("ID is the unique identifier for the subscription pause"),
63744
- metadata: record(string2(), string2()).optional(),
63745
- original_period_end: exports_iso.datetime({ offset: true }).optional().describe("OriginalPeriodEnd is the end of the billing period when the pause was created"),
63746
- original_period_start: exports_iso.datetime({ offset: true }).optional().describe("OriginalPeriodStart is the start of the billing period when the pause was created"),
63747
- pause_end: exports_iso.datetime({ offset: true }).optional().describe("PauseEnd is when the pause will end (null for indefinite)"),
63748
- pause_mode: PauseMode$zodSchema.optional(),
63749
- pause_start: exports_iso.datetime({ offset: true }).optional().describe("PauseStart is when the pause actually started"),
63750
- pause_status: PauseStatus$zodSchema.optional(),
63751
- reason: string2().optional().describe("Reason is the reason for pausing"),
63752
- resume_mode: ResumeMode$zodSchema.optional(),
63753
- resumed_at: exports_iso.datetime({ offset: true }).optional().describe("ResumedAt is when the pause was actually ended (if manually resumed)"),
63754
- status: Status$zodSchema.optional(),
63755
- subscription_id: string2().optional().describe("SubscriptionID is the identifier for the subscription"),
63756
- tenant_id: string2().optional(),
63757
- updated_at: exports_iso.datetime({ offset: true }).optional(),
63758
- updated_by: string2().optional()
63759
- }).describe("Response object containing subscription pause information");
63760
- });
63761
-
63762
- // src/models/listsubscriptionpausesresponse.ts
63763
- var ListSubscriptionPausesResponse$zodSchema;
63764
- var init_listsubscriptionpausesresponse = __esm(() => {
63765
- init_zod();
63766
- init_subscriptionpauseresponse();
63767
- ListSubscriptionPausesResponse$zodSchema = object({
63768
- items: array(SubscriptionPauseResponse$zodSchema).optional().describe(`List of subscription pause objects
63769
- @Description Array of subscription pauses`),
63770
- total: int().optional().describe(`Total number of pauses
63771
- @Description Total count of subscription pauses in the response`)
63772
- }).describe("Response object for listing subscription pauses with total count");
63773
- });
63774
-
63775
- // src/models/listsubscriptionpausesop.ts
63776
- var ListSubscriptionPausesRequest$zodSchema, ListSubscriptionPausesResponseResponse$zodSchema;
63777
- var init_listsubscriptionpausesop = __esm(() => {
63778
- init_zod();
63779
- init_errorresponse();
63780
- init_listsubscriptionpausesresponse();
63781
- ListSubscriptionPausesRequest$zodSchema = object({
63782
- id: string2().describe("Subscription ID")
63783
- });
63784
- ListSubscriptionPausesResponseResponse$zodSchema = union([
63785
- array(ListSubscriptionPausesResponse$zodSchema).describe("OK"),
63786
- ErrorResponse$zodSchema
63787
- ]);
63788
- });
63789
-
63790
- // src/funcs/subscriptionsListSubscriptionPauses.ts
63791
- function subscriptionsListSubscriptionPauses(client$, request, options) {
63792
- return new APIPromise($do64(client$, request, options));
63793
- }
63794
- async function $do64(client$, request, options) {
63795
- const parsed$ = safeParse4(request, (value$) => ListSubscriptionPausesRequest$zodSchema.parse(value$), "Input validation failed");
63796
- if (!parsed$.ok) {
63797
- return [parsed$, { status: "invalid" }];
63798
- }
63799
- const payload$ = parsed$.value;
63800
- const body$ = null;
63801
- const pathParams$ = {
63802
- id: encodeSimple("id", payload$.id, {
63803
- explode: false,
63804
- charEncoding: "percent"
63805
- })
63806
- };
63807
- const path$ = pathToFunc("/subscriptions/{id}/pauses")(pathParams$);
63808
- const headers$ = new Headers(compactMap({
63809
- Accept: "application/json"
63810
- }));
63811
- const securityInput = await extractSecurity(client$._options.security);
63812
- const requestSecurity = resolveGlobalSecurity(securityInput);
63813
- const context = {
63814
- options: client$._options,
63815
- baseURL: options?.serverURL ?? client$._baseURL ?? "",
63816
- operationID: "listSubscriptionPauses",
63817
- oAuth2Scopes: null,
63818
- resolvedSecurity: requestSecurity,
63819
- securitySource: client$._options.security,
63820
- retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
63821
- retryCodes: options?.retryCodes || [
63822
- "429",
63823
- "500",
63824
- "502",
63825
- "503",
63826
- "504"
63827
- ]
63828
- };
63829
- const requestRes = client$._createRequest(context, {
63830
- security: requestSecurity,
63831
- method: "GET",
63832
- baseURL: options?.serverURL,
63833
- path: path$,
63834
- headers: headers$,
63835
- body: body$,
63836
- userAgent: client$._options.userAgent,
63837
- timeoutMs: options?.timeoutMs || client$._options.timeoutMs || -1
63838
- }, options);
63839
- if (!requestRes.ok) {
63840
- return [requestRes, { status: "invalid" }];
63841
- }
63842
- const req$ = requestRes.value;
63843
- const doResult = await client$._do(req$, {
63844
- context,
63845
- errorCodes: [],
63846
- retryConfig: context.retryConfig,
63847
- retryCodes: context.retryCodes
63848
- });
63849
- if (!doResult.ok) {
63850
- return [doResult, { status: "request-error", request: req$ }];
63851
- }
63852
- return [doResult, {
63853
- status: "complete",
63854
- request: req$,
63855
- response: doResult.value
63856
- }];
63857
- }
63858
- var init_subscriptionsListSubscriptionPauses = __esm(() => {
63859
- init_encodings();
63860
- init_primitives();
63861
- init_schemas4();
63862
- init_security();
63863
- init_url();
63864
- init_listsubscriptionpausesop();
63865
- init_async();
63866
- });
63867
-
63868
- // src/mcp-server/tools/subscriptionsListSubscriptionPauses.ts
63869
- var args63, tool$subscriptionsListSubscriptionPauses;
63870
- var init_subscriptionsListSubscriptionPauses2 = __esm(() => {
63871
- init_subscriptionsListSubscriptionPauses();
63872
- init_listsubscriptionpausesop();
63873
- init_tools();
63874
- args63 = {
63875
- request: ListSubscriptionPausesRequest$zodSchema
63876
- };
63877
- tool$subscriptionsListSubscriptionPauses = {
63878
- name: "list-subscription-pauses",
63879
- description: `List all pauses for a subscription
63880
-
63881
- Use when showing pause history for a subscription (e.g. support or audit). Returns all past and future pauses.`,
63882
- scopes: ["read"],
63883
- annotations: {
63884
- title: "",
63885
- destructiveHint: false,
63886
- idempotentHint: false,
63887
- openWorldHint: false,
63888
- readOnlyHint: true
63889
- },
63890
- args: args63,
63891
- tool: async (client, args64, ctx) => {
63892
- const [result] = await subscriptionsListSubscriptionPauses(client, args64.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63893
- if (!result.ok) {
63894
- return {
63895
- content: [{ type: "text", text: result.error.message }],
63896
- isError: true
63897
- };
63898
- }
63899
- return formatResult(result.value);
63900
- }
63901
- };
63902
- });
63903
-
63904
- // src/models/listsubscriptionschedulesop.ts
63905
- var ListSubscriptionSchedulesRequest$zodSchema;
63906
- var init_listsubscriptionschedulesop = __esm(() => {
63907
- init_zod();
63908
- ListSubscriptionSchedulesRequest$zodSchema = object({
63909
- subscription_id: string2().describe("Subscription ID")
63910
- });
63911
- });
63912
-
63913
- // src/funcs/subscriptionsListSubscriptionSchedules.ts
63914
- function subscriptionsListSubscriptionSchedules(client$, request, options) {
63915
- return new APIPromise($do65(client$, request, options));
63916
- }
63917
- async function $do65(client$, request, options) {
63918
- const parsed$ = safeParse4(request, (value$) => ListSubscriptionSchedulesRequest$zodSchema.parse(value$), "Input validation failed");
63919
- if (!parsed$.ok) {
63920
- return [parsed$, { status: "invalid" }];
63921
- }
63922
- const payload$ = parsed$.value;
63923
- const body$ = null;
63924
- const pathParams$ = {
63925
- subscription_id: encodeSimple("subscription_id", payload$.subscription_id, {
63926
- explode: false,
63927
- charEncoding: "percent"
63928
- })
63929
- };
63930
- const path$ = pathToFunc("/v1/subscriptions/{subscription_id}/schedules")(pathParams$);
63931
- const headers$ = new Headers(compactMap({
63932
- Accept: "application/json"
63933
- }));
63934
- const securityInput = await extractSecurity(client$._options.security);
63935
- const requestSecurity = resolveGlobalSecurity(securityInput);
63936
- const context = {
63937
- options: client$._options,
63938
- baseURL: options?.serverURL ?? client$._baseURL ?? "",
63939
- operationID: "listSubscriptionSchedules",
63940
- oAuth2Scopes: null,
63941
- resolvedSecurity: requestSecurity,
63942
- securitySource: client$._options.security,
63943
- retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
63944
- retryCodes: options?.retryCodes || [
63945
- "429",
63946
- "500",
63947
- "502",
63948
- "503",
63949
- "504"
63950
- ]
63951
- };
63952
- const requestRes = client$._createRequest(context, {
63953
- security: requestSecurity,
63954
- method: "GET",
63955
- baseURL: options?.serverURL,
63956
- path: path$,
63957
- headers: headers$,
63958
- body: body$,
63959
- userAgent: client$._options.userAgent,
63960
- timeoutMs: options?.timeoutMs || client$._options.timeoutMs || -1
63961
- }, options);
63962
- if (!requestRes.ok) {
63963
- return [requestRes, { status: "invalid" }];
63964
- }
63965
- const req$ = requestRes.value;
63966
- const doResult = await client$._do(req$, {
63967
- context,
63968
- errorCodes: [],
63969
- retryConfig: context.retryConfig,
63970
- retryCodes: context.retryCodes
63971
- });
63972
- if (!doResult.ok) {
63973
- return [doResult, { status: "request-error", request: req$ }];
63974
- }
63975
- return [doResult, {
63976
- status: "complete",
63977
- request: req$,
63978
- response: doResult.value
63979
- }];
63980
- }
63981
- var init_subscriptionsListSubscriptionSchedules = __esm(() => {
64127
+ var init_subscriptionsListAllSubscriptionSchedules = __esm(() => {
63982
64128
  init_encodings();
63983
64129
  init_primitives();
63984
64130
  init_schemas4();
63985
64131
  init_security();
63986
64132
  init_url();
63987
- init_listsubscriptionschedulesop();
64133
+ init_listallsubscriptionschedulesop();
63988
64134
  init_async();
63989
64135
  });
63990
64136
 
63991
- // src/mcp-server/tools/subscriptionsListSubscriptionSchedules.ts
63992
- var args64, tool$subscriptionsListSubscriptionSchedules;
63993
- var init_subscriptionsListSubscriptionSchedules2 = __esm(() => {
63994
- init_subscriptionsListSubscriptionSchedules();
63995
- init_listsubscriptionschedulesop();
64137
+ // src/mcp-server/tools/subscriptionsListAllSubscriptionSchedules.ts
64138
+ var args62, tool$subscriptionsListAllSubscriptionSchedules;
64139
+ var init_subscriptionsListAllSubscriptionSchedules2 = __esm(() => {
64140
+ init_subscriptionsListAllSubscriptionSchedules();
64141
+ init_listallsubscriptionschedulesop();
63996
64142
  init_tools();
63997
- args64 = {
63998
- request: ListSubscriptionSchedulesRequest$zodSchema
64143
+ args62 = {
64144
+ request: ListAllSubscriptionSchedulesRequest$zodSchema.optional()
63999
64145
  };
64000
- tool$subscriptionsListSubscriptionSchedules = {
64001
- name: "list-subscription-schedules",
64002
- description: `List subscription schedules
64146
+ tool$subscriptionsListAllSubscriptionSchedules = {
64147
+ name: "list-all-subscription-schedules",
64148
+ description: `List all subscription schedules
64003
64149
 
64004
- Use when listing scheduled changes for a subscription (e.g. upcoming plan change or renewal). Returns all schedules for that subscription.`,
64150
+ Use when listing or searching scheduled changes across subscriptions (e.g. admin view). Returns schedules with optional filtering.`,
64005
64151
  scopes: ["read"],
64006
64152
  annotations: {
64007
64153
  title: "",
@@ -64010,9 +64156,9 @@ Use when listing scheduled changes for a subscription (e.g. upcoming plan change
64010
64156
  openWorldHint: false,
64011
64157
  readOnlyHint: true
64012
64158
  },
64013
- args: args64,
64014
- tool: async (client, args65, ctx) => {
64015
- const [result] = await subscriptionsListSubscriptionSchedules(client, args65.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64159
+ args: args62,
64160
+ tool: async (client, args63, ctx) => {
64161
+ const [result] = await subscriptionsListAllSubscriptionSchedules(client, args63.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64016
64162
  if (!result.ok) {
64017
64163
  return {
64018
64164
  content: [{ type: "text", text: result.error.message }],
@@ -64024,71 +64170,34 @@ Use when listing scheduled changes for a subscription (e.g. upcoming plan change
64024
64170
  };
64025
64171
  });
64026
64172
 
64027
- // src/models/pausesubscriptionrequest.ts
64028
- var PauseSubscriptionRequest$zodSchema;
64029
- var init_pausesubscriptionrequest = __esm(() => {
64030
- init_zod();
64031
- init_pausemode();
64032
- PauseSubscriptionRequest$zodSchema = object({
64033
- dry_run: boolean2().optional().describe(`Whether to perform a dry run
64034
- @Description If true, validates the request and shows impact without actually pausing the subscription
64035
- @Example false`),
64036
- metadata: record(string2(), string2()).optional().describe(`Additional metadata as key-value pairs
64037
- @Description Optional metadata for storing additional information about the pause
64038
- @Example {"requested_by": "customer", "channel": "support_ticket"}`),
64039
- pause_days: int().optional().describe(`Duration of the pause in days
64040
- @Description Number of days to pause the subscription. Cannot be used together with pause_end. Must be greater than 0
64041
- @Example 30`),
64042
- pause_end: exports_iso.datetime({ offset: true }).optional().describe(`End date for the subscription pause
64043
- @Description ISO 8601 timestamp when the pause should end. Cannot be used together with pause_days. Must be after pause_start
64044
- @Example "2024-02-15T00:00:00Z"`),
64045
- pause_mode: PauseMode$zodSchema,
64046
- pause_start: exports_iso.datetime({ offset: true }).optional().describe(`Start date for the subscription pause
64047
- @Description ISO 8601 timestamp when the pause should begin. Required when pause_mode is "scheduled"
64048
- @Example "2024-01-15T00:00:00Z"`),
64049
- reason: string2().optional().describe(`Reason for pausing the subscription
64050
- @Description Optional reason for the pause. Maximum 255 characters
64051
- @Example "Customer requested temporary suspension"`)
64052
- }).describe("Request object for pausing an active subscription with various pause modes and options");
64053
- });
64054
-
64055
- // src/models/pausesubscriptionop.ts
64056
- var PauseSubscriptionRequestRequest$zodSchema, PauseSubscriptionResponse$zodSchema;
64057
- var init_pausesubscriptionop = __esm(() => {
64173
+ // src/models/listsubscriptionschedulesop.ts
64174
+ var ListSubscriptionSchedulesRequest$zodSchema;
64175
+ var init_listsubscriptionschedulesop = __esm(() => {
64058
64176
  init_zod();
64059
- init_errorresponse();
64060
- init_pausesubscriptionrequest();
64061
- init_subscriptionpauseresponse();
64062
- PauseSubscriptionRequestRequest$zodSchema = object({
64063
- body: PauseSubscriptionRequest$zodSchema.describe("Pause subscription request"),
64064
- id: string2().describe("Subscription ID")
64177
+ ListSubscriptionSchedulesRequest$zodSchema = object({
64178
+ subscription_id: string2().describe("Subscription ID")
64065
64179
  });
64066
- PauseSubscriptionResponse$zodSchema = union([
64067
- SubscriptionPauseResponse$zodSchema,
64068
- ErrorResponse$zodSchema
64069
- ]);
64070
64180
  });
64071
64181
 
64072
- // src/funcs/subscriptionsPauseSubscription.ts
64073
- function subscriptionsPauseSubscription(client$, request, options) {
64074
- return new APIPromise($do66(client$, request, options));
64182
+ // src/funcs/subscriptionsListSubscriptionSchedules.ts
64183
+ function subscriptionsListSubscriptionSchedules(client$, request, options) {
64184
+ return new APIPromise($do64(client$, request, options));
64075
64185
  }
64076
- async function $do66(client$, request, options) {
64077
- const parsed$ = safeParse4(request, (value$) => PauseSubscriptionRequestRequest$zodSchema.parse(value$), "Input validation failed");
64186
+ async function $do64(client$, request, options) {
64187
+ const parsed$ = safeParse4(request, (value$) => ListSubscriptionSchedulesRequest$zodSchema.parse(value$), "Input validation failed");
64078
64188
  if (!parsed$.ok) {
64079
64189
  return [parsed$, { status: "invalid" }];
64080
64190
  }
64081
64191
  const payload$ = parsed$.value;
64082
- const body$ = encodeJSON("body", payload$.body, { explode: true });
64192
+ const body$ = null;
64083
64193
  const pathParams$ = {
64084
- id: encodeSimple("id", payload$.id, {
64194
+ subscription_id: encodeSimple("subscription_id", payload$.subscription_id, {
64085
64195
  explode: false,
64086
64196
  charEncoding: "percent"
64087
64197
  })
64088
64198
  };
64089
- const path$ = pathToFunc("/subscriptions/{id}/pause")(pathParams$);
64199
+ const path$ = pathToFunc("/v1/subscriptions/{subscription_id}/schedules")(pathParams$);
64090
64200
  const headers$ = new Headers(compactMap({
64091
- "Content-Type": "application/json",
64092
64201
  Accept: "application/json"
64093
64202
  }));
64094
64203
  const securityInput = await extractSecurity(client$._options.security);
@@ -64096,7 +64205,7 @@ async function $do66(client$, request, options) {
64096
64205
  const context = {
64097
64206
  options: client$._options,
64098
64207
  baseURL: options?.serverURL ?? client$._baseURL ?? "",
64099
- operationID: "pauseSubscription",
64208
+ operationID: "listSubscriptionSchedules",
64100
64209
  oAuth2Scopes: null,
64101
64210
  resolvedSecurity: requestSecurity,
64102
64211
  securitySource: client$._options.security,
@@ -64111,7 +64220,7 @@ async function $do66(client$, request, options) {
64111
64220
  };
64112
64221
  const requestRes = client$._createRequest(context, {
64113
64222
  security: requestSecurity,
64114
- method: "POST",
64223
+ method: "GET",
64115
64224
  baseURL: options?.serverURL,
64116
64225
  path: path$,
64117
64226
  headers: headers$,
@@ -64138,41 +64247,41 @@ async function $do66(client$, request, options) {
64138
64247
  response: doResult.value
64139
64248
  }];
64140
64249
  }
64141
- var init_subscriptionsPauseSubscription = __esm(() => {
64250
+ var init_subscriptionsListSubscriptionSchedules = __esm(() => {
64142
64251
  init_encodings();
64143
64252
  init_primitives();
64144
64253
  init_schemas4();
64145
64254
  init_security();
64146
64255
  init_url();
64147
- init_pausesubscriptionop();
64256
+ init_listsubscriptionschedulesop();
64148
64257
  init_async();
64149
64258
  });
64150
64259
 
64151
- // src/mcp-server/tools/subscriptionsPauseSubscription.ts
64152
- var args65, tool$subscriptionsPauseSubscription;
64153
- var init_subscriptionsPauseSubscription2 = __esm(() => {
64154
- init_subscriptionsPauseSubscription();
64155
- init_pausesubscriptionop();
64260
+ // src/mcp-server/tools/subscriptionsListSubscriptionSchedules.ts
64261
+ var args63, tool$subscriptionsListSubscriptionSchedules;
64262
+ var init_subscriptionsListSubscriptionSchedules2 = __esm(() => {
64263
+ init_subscriptionsListSubscriptionSchedules();
64264
+ init_listsubscriptionschedulesop();
64156
64265
  init_tools();
64157
- args65 = {
64158
- request: PauseSubscriptionRequestRequest$zodSchema
64266
+ args63 = {
64267
+ request: ListSubscriptionSchedulesRequest$zodSchema
64159
64268
  };
64160
- tool$subscriptionsPauseSubscription = {
64161
- name: "pause-subscription",
64162
- description: `Pause a subscription
64269
+ tool$subscriptionsListSubscriptionSchedules = {
64270
+ name: "list-subscription-schedules",
64271
+ description: `List subscription schedules
64163
64272
 
64164
- Use when temporarily stopping a subscription (e.g. customer hold or seasonal pause). Billing and access pause; resume when ready.`,
64165
- scopes: ["write"],
64273
+ Use when listing scheduled changes for a subscription (e.g. upcoming plan change or renewal). Returns all schedules for that subscription.`,
64274
+ scopes: ["read"],
64166
64275
  annotations: {
64167
64276
  title: "",
64168
64277
  destructiveHint: false,
64169
64278
  idempotentHint: false,
64170
64279
  openWorldHint: false,
64171
- readOnlyHint: false
64280
+ readOnlyHint: true
64172
64281
  },
64173
- args: args65,
64174
- tool: async (client, args66, ctx) => {
64175
- const [result] = await subscriptionsPauseSubscription(client, args66.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64282
+ args: args63,
64283
+ tool: async (client, args64, ctx) => {
64284
+ const [result] = await subscriptionsListSubscriptionSchedules(client, args64.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64176
64285
  if (!result.ok) {
64177
64286
  return {
64178
64287
  content: [{ type: "text", text: result.error.message }],
@@ -64284,9 +64393,9 @@ var init_previewsubscriptionchangeop = __esm(() => {
64284
64393
 
64285
64394
  // src/funcs/subscriptionsPreviewSubscriptionChange.ts
64286
64395
  function subscriptionsPreviewSubscriptionChange(client$, request, options) {
64287
- return new APIPromise($do67(client$, request, options));
64396
+ return new APIPromise($do65(client$, request, options));
64288
64397
  }
64289
- async function $do67(client$, request, options) {
64398
+ async function $do65(client$, request, options) {
64290
64399
  const parsed$ = safeParse4(request, (value$) => PreviewSubscriptionChangeRequest$zodSchema.parse(value$), "Input validation failed");
64291
64400
  if (!parsed$.ok) {
64292
64401
  return [parsed$, { status: "invalid" }];
@@ -64362,12 +64471,12 @@ var init_subscriptionsPreviewSubscriptionChange = __esm(() => {
64362
64471
  });
64363
64472
 
64364
64473
  // src/mcp-server/tools/subscriptionsPreviewSubscriptionChange.ts
64365
- var args66, tool$subscriptionsPreviewSubscriptionChange;
64474
+ var args64, tool$subscriptionsPreviewSubscriptionChange;
64366
64475
  var init_subscriptionsPreviewSubscriptionChange2 = __esm(() => {
64367
64476
  init_subscriptionsPreviewSubscriptionChange();
64368
64477
  init_previewsubscriptionchangeop();
64369
64478
  init_tools();
64370
- args66 = {
64479
+ args64 = {
64371
64480
  request: PreviewSubscriptionChangeRequest$zodSchema
64372
64481
  };
64373
64482
  tool$subscriptionsPreviewSubscriptionChange = {
@@ -64383,9 +64492,9 @@ Use when showing a customer the cost of a plan change before they confirm (e.g.
64383
64492
  openWorldHint: false,
64384
64493
  readOnlyHint: false
64385
64494
  },
64386
- args: args66,
64387
- tool: async (client, args67, ctx) => {
64388
- const [result] = await subscriptionsPreviewSubscriptionChange(client, args67.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64495
+ args: args64,
64496
+ tool: async (client, args65, ctx) => {
64497
+ const [result] = await subscriptionsPreviewSubscriptionChange(client, args65.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64389
64498
  if (!result.ok) {
64390
64499
  return {
64391
64500
  content: [{ type: "text", text: result.error.message }],
@@ -64416,9 +64525,9 @@ var init_previewsubscriptionmodifyop = __esm(() => {
64416
64525
 
64417
64526
  // src/funcs/subscriptionsPreviewSubscriptionModify.ts
64418
64527
  function subscriptionsPreviewSubscriptionModify(client$, request, options) {
64419
- return new APIPromise($do68(client$, request, options));
64528
+ return new APIPromise($do66(client$, request, options));
64420
64529
  }
64421
- async function $do68(client$, request, options) {
64530
+ async function $do66(client$, request, options) {
64422
64531
  const parsed$ = safeParse4(request, (value$) => PreviewSubscriptionModifyRequest$zodSchema.parse(value$), "Input validation failed");
64423
64532
  if (!parsed$.ok) {
64424
64533
  return [parsed$, { status: "invalid" }];
@@ -64494,12 +64603,12 @@ var init_subscriptionsPreviewSubscriptionModify = __esm(() => {
64494
64603
  });
64495
64604
 
64496
64605
  // src/mcp-server/tools/subscriptionsPreviewSubscriptionModify.ts
64497
- var args67, tool$subscriptionsPreviewSubscriptionModify;
64606
+ var args65, tool$subscriptionsPreviewSubscriptionModify;
64498
64607
  var init_subscriptionsPreviewSubscriptionModify2 = __esm(() => {
64499
64608
  init_subscriptionsPreviewSubscriptionModify();
64500
64609
  init_previewsubscriptionmodifyop();
64501
64610
  init_tools();
64502
- args67 = {
64611
+ args65 = {
64503
64612
  request: PreviewSubscriptionModifyRequest$zodSchema
64504
64613
  };
64505
64614
  tool$subscriptionsPreviewSubscriptionModify = {
@@ -64515,9 +64624,9 @@ Preview the impact of a mid-cycle subscription modification without committing c
64515
64624
  openWorldHint: false,
64516
64625
  readOnlyHint: true
64517
64626
  },
64518
- args: args67,
64519
- tool: async (client, args68, ctx) => {
64520
- const [result] = await subscriptionsPreviewSubscriptionModify(client, args68.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64627
+ args: args65,
64628
+ tool: async (client, args66, ctx) => {
64629
+ const [result] = await subscriptionsPreviewSubscriptionModify(client, args66.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64521
64630
  if (!result.ok) {
64522
64631
  return {
64523
64632
  content: [{ type: "text", text: result.error.message }],
@@ -64569,15 +64678,17 @@ When nil, period/cancel cutoff logic is not applied by this field (see TimeRange
64569
64678
  subscription_ids: array(string2()).optional(),
64570
64679
  subscription_status: array(SubscriptionStatus$zodSchema).optional().describe("SubscriptionStatus filters by subscription status"),
64571
64680
  subscription_type: array(SubscriptionType$zodSchema).optional().describe("SubscriptionType filters by subscription type"),
64681
+ trial_end_due_lte: exports_iso.datetime({ offset: true }).optional().describe(`TrialEndDueLTE, when set, restricts to subscriptions with trial_end not nil and trial_end <= trial_end_due_lte.
64682
+ Use with subscription_status trialing for trial-end cron processing.`),
64572
64683
  with_line_items: boolean2().optional().describe("WithLineItems includes line items in the response")
64573
64684
  });
64574
64685
  });
64575
64686
 
64576
64687
  // src/funcs/subscriptionsQuerySubscription.ts
64577
64688
  function subscriptionsQuerySubscription(client$, request, options) {
64578
- return new APIPromise($do69(client$, request, options));
64689
+ return new APIPromise($do67(client$, request, options));
64579
64690
  }
64580
- async function $do69(client$, request, options) {
64691
+ async function $do67(client$, request, options) {
64581
64692
  const parsed$ = safeParse4(request, (value$) => SubscriptionFilter$zodSchema.parse(value$), "Input validation failed");
64582
64693
  if (!parsed$.ok) {
64583
64694
  return [parsed$, { status: "invalid" }];
@@ -64647,12 +64758,12 @@ var init_subscriptionsQuerySubscription = __esm(() => {
64647
64758
  });
64648
64759
 
64649
64760
  // src/mcp-server/tools/subscriptionsQuerySubscription.ts
64650
- var args68, tool$subscriptionsQuerySubscription;
64761
+ var args66, tool$subscriptionsQuerySubscription;
64651
64762
  var init_subscriptionsQuerySubscription2 = __esm(() => {
64652
64763
  init_subscriptionsQuerySubscription();
64653
64764
  init_subscriptionfilter();
64654
64765
  init_tools();
64655
- args68 = {
64766
+ args66 = {
64656
64767
  request: SubscriptionFilter$zodSchema.describe(`Filter`)
64657
64768
  };
64658
64769
  tool$subscriptionsQuerySubscription = {
@@ -64668,9 +64779,9 @@ Use when listing or searching subscriptions (e.g. admin view or customer subscri
64668
64779
  openWorldHint: false,
64669
64780
  readOnlyHint: false
64670
64781
  },
64671
- args: args68,
64672
- tool: async (client, args69, ctx) => {
64673
- const [result] = await subscriptionsQuerySubscription(client, args69.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64782
+ args: args66,
64783
+ tool: async (client, args67, ctx) => {
64784
+ const [result] = await subscriptionsQuerySubscription(client, args67.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64674
64785
  if (!result.ok) {
64675
64786
  return {
64676
64787
  content: [{ type: "text", text: result.error.message }],
@@ -64682,34 +64793,54 @@ Use when listing or searching subscriptions (e.g. admin view or customer subscri
64682
64793
  };
64683
64794
  });
64684
64795
 
64685
- // src/models/removeaddonrequest.ts
64686
- var RemoveAddonRequest$zodSchema;
64687
- var init_removeaddonrequest = __esm(() => {
64796
+ // src/models/subscriptionlineitemfilter.ts
64797
+ var SubscriptionLineItemFilterOrder$zodSchema, SubscriptionLineItemFilter$zodSchema;
64798
+ var init_subscriptionlineitemfilter = __esm(() => {
64688
64799
  init_zod();
64689
- init_prorationbehavior();
64690
- RemoveAddonRequest$zodSchema = object({
64691
- addon_association_id: string2(),
64692
- effective_date: exports_iso.datetime({ offset: true }).optional().describe(`EffectiveDate is the date the cancellation takes effect.
64693
- When nil the addon is cancelled at the end of the current period.
64694
- When provided it must fall within [CurrentPeriodStart, CurrentPeriodEnd]; mid-period
64695
- values combined with create_prorations will issue a wallet credit for unused time.`),
64696
- proration_behavior: ProrationBehavior$zodSchema.optional(),
64697
- reason: string2().optional()
64800
+ init_filtercondition();
64801
+ init_sortcondition();
64802
+ init_status();
64803
+ init_subscriptionlineitementitytype();
64804
+ SubscriptionLineItemFilterOrder$zodSchema = _enum([
64805
+ "asc",
64806
+ "desc"
64807
+ ]);
64808
+ SubscriptionLineItemFilter$zodSchema = object({
64809
+ active_filter: boolean2().default(true),
64810
+ addon_association_ids: array(string2()).optional(),
64811
+ billing_periods: array(string2()).optional(),
64812
+ currencies: array(string2()).optional(),
64813
+ current_period_start: exports_iso.datetime({ offset: true }).optional(),
64814
+ customer_ids: array(string2()).optional(),
64815
+ end_time: exports_iso.datetime({ offset: true }).optional(),
64816
+ entity_ids: array(string2()).optional(),
64817
+ entity_type: SubscriptionLineItemEntityType$zodSchema.optional(),
64818
+ expand: string2().optional(),
64819
+ filters: array(FilterCondition$zodSchema).optional(),
64820
+ limit: int().optional(),
64821
+ meter_ids: array(string2()).optional(),
64822
+ offset: int().optional(),
64823
+ order: SubscriptionLineItemFilterOrder$zodSchema.optional(),
64824
+ price_ids: array(string2()).optional(),
64825
+ sort: array(SortCondition$zodSchema).optional(),
64826
+ start_time: exports_iso.datetime({ offset: true }).optional(),
64827
+ status: Status$zodSchema.optional(),
64828
+ subscription_ids: array(string2()).optional().describe("Specific filters")
64698
64829
  });
64699
64830
  });
64700
64831
 
64701
- // src/funcs/subscriptionsRemoveSubscriptionAddon.ts
64702
- function subscriptionsRemoveSubscriptionAddon(client$, request, options) {
64703
- return new APIPromise($do70(client$, request, options));
64832
+ // src/funcs/subscriptionsQuerySubscriptionLineItems.ts
64833
+ function subscriptionsQuerySubscriptionLineItems(client$, request, options) {
64834
+ return new APIPromise($do68(client$, request, options));
64704
64835
  }
64705
- async function $do70(client$, request, options) {
64706
- const parsed$ = safeParse4(request, (value$) => RemoveAddonRequest$zodSchema.parse(value$), "Input validation failed");
64836
+ async function $do68(client$, request, options) {
64837
+ const parsed$ = safeParse4(request, (value$) => SubscriptionLineItemFilter$zodSchema.parse(value$), "Input validation failed");
64707
64838
  if (!parsed$.ok) {
64708
64839
  return [parsed$, { status: "invalid" }];
64709
64840
  }
64710
64841
  const payload$ = parsed$.value;
64711
64842
  const body$ = encodeJSON("body", payload$, { explode: true });
64712
- const path$ = pathToFunc("/subscriptions/addon")();
64843
+ const path$ = pathToFunc("/subscriptions/lineitems/search")();
64713
64844
  const headers$ = new Headers(compactMap({
64714
64845
  "Content-Type": "application/json",
64715
64846
  Accept: "application/json"
@@ -64719,7 +64850,7 @@ async function $do70(client$, request, options) {
64719
64850
  const context = {
64720
64851
  options: client$._options,
64721
64852
  baseURL: options?.serverURL ?? client$._baseURL ?? "",
64722
- operationID: "removeSubscriptionAddon",
64853
+ operationID: "querySubscriptionLineItems",
64723
64854
  oAuth2Scopes: null,
64724
64855
  resolvedSecurity: requestSecurity,
64725
64856
  securitySource: client$._options.security,
@@ -64734,7 +64865,7 @@ async function $do70(client$, request, options) {
64734
64865
  };
64735
64866
  const requestRes = client$._createRequest(context, {
64736
64867
  security: requestSecurity,
64737
- method: "DELETE",
64868
+ method: "POST",
64738
64869
  baseURL: options?.serverURL,
64739
64870
  path: path$,
64740
64871
  headers: headers$,
@@ -64761,41 +64892,41 @@ async function $do70(client$, request, options) {
64761
64892
  response: doResult.value
64762
64893
  }];
64763
64894
  }
64764
- var init_subscriptionsRemoveSubscriptionAddon = __esm(() => {
64895
+ var init_subscriptionsQuerySubscriptionLineItems = __esm(() => {
64765
64896
  init_encodings();
64766
64897
  init_primitives();
64767
64898
  init_schemas4();
64768
64899
  init_security();
64769
64900
  init_url();
64770
- init_removeaddonrequest();
64901
+ init_subscriptionlineitemfilter();
64771
64902
  init_async();
64772
64903
  });
64773
64904
 
64774
- // src/mcp-server/tools/subscriptionsRemoveSubscriptionAddon.ts
64775
- var args69, tool$subscriptionsRemoveSubscriptionAddon;
64776
- var init_subscriptionsRemoveSubscriptionAddon2 = __esm(() => {
64777
- init_subscriptionsRemoveSubscriptionAddon();
64778
- init_removeaddonrequest();
64905
+ // src/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.ts
64906
+ var args67, tool$subscriptionsQuerySubscriptionLineItems;
64907
+ var init_subscriptionsQuerySubscriptionLineItems2 = __esm(() => {
64908
+ init_subscriptionsQuerySubscriptionLineItems();
64909
+ init_subscriptionlineitemfilter();
64779
64910
  init_tools();
64780
- args69 = {
64781
- request: RemoveAddonRequest$zodSchema.describe(`Remove Addon Request`)
64911
+ args67 = {
64912
+ request: SubscriptionLineItemFilter$zodSchema.describe(`Filter`)
64782
64913
  };
64783
- tool$subscriptionsRemoveSubscriptionAddon = {
64784
- name: "remove-subscription-addon",
64785
- description: `Remove addon from subscription
64914
+ tool$subscriptionsQuerySubscriptionLineItems = {
64915
+ name: "query-subscription-line-items",
64916
+ description: `Search subscription line items
64786
64917
 
64787
- Use when removing an add-on from a subscription (e.g. downgrade or opt-out).`,
64788
- scopes: ["delete"],
64918
+ List subscription line items with a JSON filter (subscription, customer, price, pagination, expand=prices, etc.).`,
64919
+ scopes: ["read"],
64789
64920
  annotations: {
64790
64921
  title: "",
64791
- destructiveHint: true,
64922
+ destructiveHint: false,
64792
64923
  idempotentHint: false,
64793
64924
  openWorldHint: false,
64794
- readOnlyHint: false
64925
+ readOnlyHint: true
64795
64926
  },
64796
- args: args69,
64797
- tool: async (client, args70, ctx) => {
64798
- const [result] = await subscriptionsRemoveSubscriptionAddon(client, args70.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64927
+ args: args67,
64928
+ tool: async (client, args68, ctx) => {
64929
+ const [result] = await subscriptionsQuerySubscriptionLineItems(client, args68.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64799
64930
  if (!result.ok) {
64800
64931
  return {
64801
64932
  content: [{ type: "text", text: result.error.message }],
@@ -64807,57 +64938,34 @@ Use when removing an add-on from a subscription (e.g. downgrade or opt-out).`,
64807
64938
  };
64808
64939
  });
64809
64940
 
64810
- // src/models/resumesubscriptionrequest.ts
64811
- var ResumeSubscriptionRequest$zodSchema;
64812
- var init_resumesubscriptionrequest = __esm(() => {
64813
- init_zod();
64814
- init_resumemode();
64815
- ResumeSubscriptionRequest$zodSchema = object({
64816
- dry_run: boolean2().optional().describe(`Whether to perform a dry run
64817
- @Description If true, validates the request and shows impact without actually resuming the subscription
64818
- @Example false`),
64819
- metadata: record(string2(), string2()).optional().describe(`Additional metadata as key-value pairs
64820
- @Description Optional metadata for storing additional information about the resume operation
64821
- @Example {"resumed_by": "admin", "reason": "issue_resolved"}`),
64822
- resume_mode: ResumeMode$zodSchema
64823
- }).describe("Request object for resuming a paused subscription");
64824
- });
64825
-
64826
- // src/models/resumesubscriptionop.ts
64827
- var ResumeSubscriptionRequestRequest$zodSchema, ResumeSubscriptionResponse$zodSchema;
64828
- var init_resumesubscriptionop = __esm(() => {
64941
+ // src/models/removeaddonrequest.ts
64942
+ var RemoveAddonRequest$zodSchema;
64943
+ var init_removeaddonrequest = __esm(() => {
64829
64944
  init_zod();
64830
- init_errorresponse();
64831
- init_resumesubscriptionrequest();
64832
- init_subscriptionpauseresponse();
64833
- ResumeSubscriptionRequestRequest$zodSchema = object({
64834
- body: ResumeSubscriptionRequest$zodSchema.describe("Resume subscription request"),
64835
- id: string2().describe("Subscription ID")
64945
+ init_prorationbehavior();
64946
+ RemoveAddonRequest$zodSchema = object({
64947
+ addon_association_id: string2(),
64948
+ effective_date: exports_iso.datetime({ offset: true }).optional().describe(`EffectiveDate is the date the cancellation takes effect.
64949
+ When nil the addon is cancelled at the end of the current period.
64950
+ When provided it must fall within [CurrentPeriodStart, CurrentPeriodEnd]; mid-period
64951
+ values combined with create_prorations will issue a wallet credit for unused time.`),
64952
+ proration_behavior: ProrationBehavior$zodSchema.optional(),
64953
+ reason: string2().optional()
64836
64954
  });
64837
- ResumeSubscriptionResponse$zodSchema = union([
64838
- SubscriptionPauseResponse$zodSchema,
64839
- ErrorResponse$zodSchema
64840
- ]);
64841
64955
  });
64842
64956
 
64843
- // src/funcs/subscriptionsResumeSubscription.ts
64844
- function subscriptionsResumeSubscription(client$, request, options) {
64845
- return new APIPromise($do71(client$, request, options));
64957
+ // src/funcs/subscriptionsRemoveSubscriptionAddon.ts
64958
+ function subscriptionsRemoveSubscriptionAddon(client$, request, options) {
64959
+ return new APIPromise($do69(client$, request, options));
64846
64960
  }
64847
- async function $do71(client$, request, options) {
64848
- const parsed$ = safeParse4(request, (value$) => ResumeSubscriptionRequestRequest$zodSchema.parse(value$), "Input validation failed");
64961
+ async function $do69(client$, request, options) {
64962
+ const parsed$ = safeParse4(request, (value$) => RemoveAddonRequest$zodSchema.parse(value$), "Input validation failed");
64849
64963
  if (!parsed$.ok) {
64850
64964
  return [parsed$, { status: "invalid" }];
64851
64965
  }
64852
64966
  const payload$ = parsed$.value;
64853
- const body$ = encodeJSON("body", payload$.body, { explode: true });
64854
- const pathParams$ = {
64855
- id: encodeSimple("id", payload$.id, {
64856
- explode: false,
64857
- charEncoding: "percent"
64858
- })
64859
- };
64860
- const path$ = pathToFunc("/subscriptions/{id}/resume")(pathParams$);
64967
+ const body$ = encodeJSON("body", payload$, { explode: true });
64968
+ const path$ = pathToFunc("/subscriptions/addon")();
64861
64969
  const headers$ = new Headers(compactMap({
64862
64970
  "Content-Type": "application/json",
64863
64971
  Accept: "application/json"
@@ -64867,7 +64975,7 @@ async function $do71(client$, request, options) {
64867
64975
  const context = {
64868
64976
  options: client$._options,
64869
64977
  baseURL: options?.serverURL ?? client$._baseURL ?? "",
64870
- operationID: "resumeSubscription",
64978
+ operationID: "removeSubscriptionAddon",
64871
64979
  oAuth2Scopes: null,
64872
64980
  resolvedSecurity: requestSecurity,
64873
64981
  securitySource: client$._options.security,
@@ -64882,7 +64990,7 @@ async function $do71(client$, request, options) {
64882
64990
  };
64883
64991
  const requestRes = client$._createRequest(context, {
64884
64992
  security: requestSecurity,
64885
- method: "POST",
64993
+ method: "DELETE",
64886
64994
  baseURL: options?.serverURL,
64887
64995
  path: path$,
64888
64996
  headers: headers$,
@@ -64909,41 +65017,41 @@ async function $do71(client$, request, options) {
64909
65017
  response: doResult.value
64910
65018
  }];
64911
65019
  }
64912
- var init_subscriptionsResumeSubscription = __esm(() => {
65020
+ var init_subscriptionsRemoveSubscriptionAddon = __esm(() => {
64913
65021
  init_encodings();
64914
65022
  init_primitives();
64915
65023
  init_schemas4();
64916
65024
  init_security();
64917
65025
  init_url();
64918
- init_resumesubscriptionop();
65026
+ init_removeaddonrequest();
64919
65027
  init_async();
64920
65028
  });
64921
65029
 
64922
- // src/mcp-server/tools/subscriptionsResumeSubscription.ts
64923
- var args70, tool$subscriptionsResumeSubscription;
64924
- var init_subscriptionsResumeSubscription2 = __esm(() => {
64925
- init_subscriptionsResumeSubscription();
64926
- init_resumesubscriptionop();
65030
+ // src/mcp-server/tools/subscriptionsRemoveSubscriptionAddon.ts
65031
+ var args68, tool$subscriptionsRemoveSubscriptionAddon;
65032
+ var init_subscriptionsRemoveSubscriptionAddon2 = __esm(() => {
65033
+ init_subscriptionsRemoveSubscriptionAddon();
65034
+ init_removeaddonrequest();
64927
65035
  init_tools();
64928
- args70 = {
64929
- request: ResumeSubscriptionRequestRequest$zodSchema
65036
+ args68 = {
65037
+ request: RemoveAddonRequest$zodSchema.describe(`Remove Addon Request`)
64930
65038
  };
64931
- tool$subscriptionsResumeSubscription = {
64932
- name: "resume-subscription",
64933
- description: `Resume a paused subscription
65039
+ tool$subscriptionsRemoveSubscriptionAddon = {
65040
+ name: "remove-subscription-addon",
65041
+ description: `Remove addon from subscription
64934
65042
 
64935
- Use when reactivating a paused subscription (e.g. end of hold). Billing and access resume from the resume date.`,
64936
- scopes: ["write"],
65043
+ Use when removing an add-on from a subscription (e.g. downgrade or opt-out).`,
65044
+ scopes: ["delete"],
64937
65045
  annotations: {
64938
65046
  title: "",
64939
- destructiveHint: false,
65047
+ destructiveHint: true,
64940
65048
  idempotentHint: false,
64941
65049
  openWorldHint: false,
64942
65050
  readOnlyHint: false
64943
65051
  },
64944
- args: args70,
64945
- tool: async (client, args71, ctx) => {
64946
- const [result] = await subscriptionsResumeSubscription(client, args71.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65052
+ args: args68,
65053
+ tool: async (client, args69, ctx) => {
65054
+ const [result] = await subscriptionsRemoveSubscriptionAddon(client, args69.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64947
65055
  if (!result.ok) {
64948
65056
  return {
64949
65057
  content: [{ type: "text", text: result.error.message }],
@@ -64987,9 +65095,9 @@ var init_updatesubscriptionop = __esm(() => {
64987
65095
 
64988
65096
  // src/funcs/subscriptionsUpdateSubscription.ts
64989
65097
  function subscriptionsUpdateSubscription(client$, request, options) {
64990
- return new APIPromise($do72(client$, request, options));
65098
+ return new APIPromise($do70(client$, request, options));
64991
65099
  }
64992
- async function $do72(client$, request, options) {
65100
+ async function $do70(client$, request, options) {
64993
65101
  const parsed$ = safeParse4(request, (value$) => UpdateSubscriptionRequestRequest$zodSchema.parse(value$), "Input validation failed");
64994
65102
  if (!parsed$.ok) {
64995
65103
  return [parsed$, { status: "invalid" }];
@@ -65065,12 +65173,12 @@ var init_subscriptionsUpdateSubscription = __esm(() => {
65065
65173
  });
65066
65174
 
65067
65175
  // src/mcp-server/tools/subscriptionsUpdateSubscription.ts
65068
- var args71, tool$subscriptionsUpdateSubscription;
65176
+ var args69, tool$subscriptionsUpdateSubscription;
65069
65177
  var init_subscriptionsUpdateSubscription2 = __esm(() => {
65070
65178
  init_subscriptionsUpdateSubscription();
65071
65179
  init_updatesubscriptionop();
65072
65180
  init_tools();
65073
- args71 = {
65181
+ args69 = {
65074
65182
  request: UpdateSubscriptionRequestRequest$zodSchema
65075
65183
  };
65076
65184
  tool$subscriptionsUpdateSubscription = {
@@ -65086,9 +65194,9 @@ Use when changing subscription details (e.g. quantity, billing anchor, or parent
65086
65194
  openWorldHint: false,
65087
65195
  readOnlyHint: false
65088
65196
  },
65089
- args: args71,
65090
- tool: async (client, args72, ctx) => {
65091
- const [result] = await subscriptionsUpdateSubscription(client, args72.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65197
+ args: args69,
65198
+ tool: async (client, args70, ctx) => {
65199
+ const [result] = await subscriptionsUpdateSubscription(client, args70.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65092
65200
  if (!result.ok) {
65093
65201
  return {
65094
65202
  content: [{ type: "text", text: result.error.message }],
@@ -65147,9 +65255,9 @@ var init_updatesubscriptionlineitemop = __esm(() => {
65147
65255
 
65148
65256
  // src/funcs/subscriptionsUpdateSubscriptionLineItem.ts
65149
65257
  function subscriptionsUpdateSubscriptionLineItem(client$, request, options) {
65150
- return new APIPromise($do73(client$, request, options));
65258
+ return new APIPromise($do71(client$, request, options));
65151
65259
  }
65152
- async function $do73(client$, request, options) {
65260
+ async function $do71(client$, request, options) {
65153
65261
  const parsed$ = safeParse4(request, (value$) => UpdateSubscriptionLineItemRequestRequest$zodSchema.parse(value$), "Input validation failed");
65154
65262
  if (!parsed$.ok) {
65155
65263
  return [parsed$, { status: "invalid" }];
@@ -65225,12 +65333,12 @@ var init_subscriptionsUpdateSubscriptionLineItem = __esm(() => {
65225
65333
  });
65226
65334
 
65227
65335
  // src/mcp-server/tools/subscriptionsUpdateSubscriptionLineItem.ts
65228
- var args72, tool$subscriptionsUpdateSubscriptionLineItem;
65336
+ var args70, tool$subscriptionsUpdateSubscriptionLineItem;
65229
65337
  var init_subscriptionsUpdateSubscriptionLineItem2 = __esm(() => {
65230
65338
  init_subscriptionsUpdateSubscriptionLineItem();
65231
65339
  init_updatesubscriptionlineitemop();
65232
65340
  init_tools();
65233
- args72 = {
65341
+ args70 = {
65234
65342
  request: UpdateSubscriptionLineItemRequestRequest$zodSchema
65235
65343
  };
65236
65344
  tool$subscriptionsUpdateSubscriptionLineItem = {
@@ -65246,9 +65354,9 @@ Use when changing a subscription line item (e.g. quantity or price). Implemented
65246
65354
  openWorldHint: false,
65247
65355
  readOnlyHint: false
65248
65356
  },
65249
- args: args72,
65250
- tool: async (client, args73, ctx) => {
65251
- const [result] = await subscriptionsUpdateSubscriptionLineItem(client, args73.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65357
+ args: args70,
65358
+ tool: async (client, args71, ctx) => {
65359
+ const [result] = await subscriptionsUpdateSubscriptionLineItem(client, args71.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65252
65360
  if (!result.ok) {
65253
65361
  return {
65254
65362
  content: [{ type: "text", text: result.error.message }],
@@ -65264,16 +65372,16 @@ Use when changing a subscription line item (e.g. quantity or price). Implemented
65264
65372
  function createMCPServer(deps) {
65265
65373
  const server = new McpServer({
65266
65374
  name: "Flexprice",
65267
- version: "2.1.5"
65375
+ version: "2.1.9"
65268
65376
  });
65269
65377
  const getClient = deps.getSDK || (() => new FlexpriceCore({
65270
65378
  security: deps.security,
65271
65379
  serverURL: deps.serverURL,
65272
65380
  serverIdx: deps.serverIdx,
65273
65381
  debugLogger: deps.logger.level === "debug" ? {
65274
- log: (...args73) => console.log(...args73),
65275
- group: (...args73) => console.group(...args73),
65276
- groupEnd: (...args73) => console.groupEnd(...args73)
65382
+ log: (...args71) => console.log(...args71),
65383
+ group: (...args71) => console.group(...args71),
65384
+ groupEnd: (...args71) => console.groupEnd(...args71)
65277
65385
  } : undefined
65278
65386
  }));
65279
65387
  const scopes = new Set(deps.scopes);
@@ -65332,6 +65440,7 @@ function createMCPServer(deps) {
65332
65440
  tool(tool$subscriptionsCreateSubscription);
65333
65441
  tool(tool$subscriptionsAddSubscriptionAddon);
65334
65442
  tool(tool$subscriptionsRemoveSubscriptionAddon);
65443
+ tool(tool$subscriptionsQuerySubscriptionLineItems);
65335
65444
  tool(tool$subscriptionsUpdateSubscriptionLineItem);
65336
65445
  tool(tool$subscriptionsDeleteSubscriptionLineItem);
65337
65446
  tool(tool$subscriptionsQuerySubscription);
@@ -65348,9 +65457,6 @@ function createMCPServer(deps) {
65348
65457
  tool(tool$subscriptionsCreateSubscriptionLineItem);
65349
65458
  tool(tool$subscriptionsExecuteSubscriptionModify);
65350
65459
  tool(tool$subscriptionsPreviewSubscriptionModify);
65351
- tool(tool$subscriptionsPauseSubscription);
65352
- tool(tool$subscriptionsListSubscriptionPauses);
65353
- tool(tool$subscriptionsResumeSubscription);
65354
65460
  tool(tool$subscriptionsGetSubscriptionV2);
65355
65461
  tool(tool$subscriptionsListAllSubscriptionSchedules);
65356
65462
  tool(tool$subscriptionsGetSubscriptionSchedule);
@@ -65429,14 +65535,12 @@ var init_server2 = __esm(() => {
65429
65535
  init_subscriptionsGetSubscriptionUsage2();
65430
65536
  init_subscriptionsGetSubscriptionV22();
65431
65537
  init_subscriptionsListAllSubscriptionSchedules2();
65432
- init_subscriptionsListSubscriptionPauses2();
65433
65538
  init_subscriptionsListSubscriptionSchedules2();
65434
- init_subscriptionsPauseSubscription2();
65435
65539
  init_subscriptionsPreviewSubscriptionChange2();
65436
65540
  init_subscriptionsPreviewSubscriptionModify2();
65437
65541
  init_subscriptionsQuerySubscription2();
65542
+ init_subscriptionsQuerySubscriptionLineItems2();
65438
65543
  init_subscriptionsRemoveSubscriptionAddon2();
65439
- init_subscriptionsResumeSubscription2();
65440
65544
  init_subscriptionsUpdateSubscription2();
65441
65545
  init_subscriptionsUpdateSubscriptionLineItem2();
65442
65546
  });
@@ -65738,6 +65842,12 @@ Use when adding an optional product or add-on to an existing subscription (e.g.
65738
65842
  description: `Remove addon from subscription
65739
65843
 
65740
65844
  Use when removing an add-on from a subscription (e.g. downgrade or opt-out).`
65845
+ },
65846
+ {
65847
+ name: "query-subscription-line-items",
65848
+ description: `Search subscription line items
65849
+
65850
+ List subscription line items with a JSON filter (subscription, customer, price, pagination, expand=prices, etc.).`
65741
65851
  },
65742
65852
  {
65743
65853
  name: "update-subscription-line-item",
@@ -65834,24 +65944,6 @@ Execute a mid-cycle subscription modification (inheritance or quantity change).`
65834
65944
  description: `Preview subscription modification
65835
65945
 
65836
65946
  Preview the impact of a mid-cycle subscription modification without committing changes.`
65837
- },
65838
- {
65839
- name: "pause-subscription",
65840
- description: `Pause a subscription
65841
-
65842
- Use when temporarily stopping a subscription (e.g. customer hold or seasonal pause). Billing and access pause; resume when ready.`
65843
- },
65844
- {
65845
- name: "list-subscription-pauses",
65846
- description: `List all pauses for a subscription
65847
-
65848
- Use when showing pause history for a subscription (e.g. support or audit). Returns all past and future pauses.`
65849
- },
65850
- {
65851
- name: "resume-subscription",
65852
- description: `Resume a paused subscription
65853
-
65854
- Use when reactivating a paused subscription (e.g. end of hold). Billing and access resume from the resume date.`
65855
65947
  },
65856
65948
  {
65857
65949
  name: "get-subscription-v2",
@@ -65888,8 +65980,13 @@ Use when listing scheduled changes for a subscription (e.g. upcoming plan change
65888
65980
 
65889
65981
  // src/landing-page.ts
65890
65982
  function landingPageExpress(req, res) {
65891
- const origin = new URL(req.host).href;
65892
- res.type("html").send(landingPageHTML(origin));
65983
+ const proto = req.get("x-forwarded-proto")?.split(",")[0]?.trim() || req.protocol;
65984
+ const host = req.get("host");
65985
+ if (!host) {
65986
+ res.status(400).send("Missing Host header");
65987
+ return;
65988
+ }
65989
+ res.type("html").send(landingPageHTML(`${proto}://${host}`));
65893
65990
  }
65894
65991
  function landingPageHTML(origin) {
65895
65992
  const o = origin;
@@ -66951,7 +67048,7 @@ async function startStreamableHTTP(cliFlags) {
66951
67048
  app.use((req, res, next) => {
66952
67049
  res.header("Access-Control-Allow-Origin", "*");
66953
67050
  res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
66954
- res.header("Access-Control-Allow-Headers", "Content-Type, *");
67051
+ res.header("Access-Control-Allow-Headers", "*");
66955
67052
  if (req.method === "OPTIONS") {
66956
67053
  res.sendStatus(204);
66957
67054
  return;
@@ -69427,7 +69524,7 @@ var routes = buildRouteMap({
69427
69524
  var app = buildApplication(routes, {
69428
69525
  name: "mcp",
69429
69526
  versionInfo: {
69430
- currentVersion: "2.1.5"
69527
+ currentVersion: "2.1.9"
69431
69528
  }
69432
69529
  });
69433
69530
  run(app, process4.argv.slice(2), buildContext(process4));
@@ -69435,5 +69532,5 @@ export {
69435
69532
  app
69436
69533
  };
69437
69534
 
69438
- //# debugId=C82BE3DD4332E7B264756E2164756E21
69535
+ //# debugId=53CBA9DD7057299464756E2164756E21
69439
69536
  //# sourceMappingURL=mcp-server.js.map