@fragment-dev/cli 2026.6.4-9 → 2026.6.5-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +26 -0
  2. package/dist/{chunk-E7E3SSNY.js → chunk-3Z7YOSNF.js} +7 -7
  3. package/dist/chunk-4GF5BFDU.js +6091 -0
  4. package/dist/{chunk-BBPBM6U2.js → chunk-4GFUVXOU.js} +1 -1
  5. package/dist/chunk-4NJIQ4GG.js +168 -0
  6. package/dist/{chunk-7BSTBQQT.js → chunk-54TES6VA.js} +1 -1
  7. package/dist/{chunk-FQFTTX5G.js → chunk-5DN7VDST.js} +2 -2
  8. package/dist/{chunk-NHQR5WRV.js → chunk-5HHWLQQP.js} +3 -5
  9. package/dist/{chunk-T4Z4RK7O.js → chunk-65ZH3QK2.js} +5 -5
  10. package/dist/{chunk-62KWSLTF.js → chunk-66AHNAX3.js} +2 -2
  11. package/dist/chunk-66MJVSVR.js +14200 -0
  12. package/dist/{chunk-JZIKOZZR.js → chunk-6OHUBHOM.js} +1 -1
  13. package/dist/{chunk-BCZENACF.js → chunk-7ANSQIHO.js} +2 -2
  14. package/dist/{chunk-S7VLFN7H.js → chunk-7ODKTNDM.js} +2 -2
  15. package/dist/{chunk-ZVAUDIY3.js → chunk-7VZGNWZU.js} +2 -2
  16. package/dist/chunk-BRU5ITZE.js +229 -0
  17. package/dist/{chunk-VWUSZNWZ.js → chunk-F3APAVQ6.js} +1 -1
  18. package/dist/{chunk-5TQBOAE7.js → chunk-HLYDHSCC.js} +177 -187
  19. package/dist/{chunk-6MDLBNQB.js → chunk-IDKZFORS.js} +2 -2
  20. package/dist/{chunk-2RVHNH5N.js → chunk-IH5353LR.js} +2 -2
  21. package/dist/{chunk-CEAOURET.js → chunk-KITXRL7V.js} +2 -2
  22. package/dist/{chunk-Q4BG2YCP.js → chunk-KRY3SN6D.js} +1 -1
  23. package/dist/{chunk-4EZIO63Q.js → chunk-KWPWX7YO.js} +2 -2
  24. package/dist/{chunk-YDTITLUL.js → chunk-LUXIPN36.js} +1 -1
  25. package/dist/{chunk-57KXWXM5.js → chunk-MH2TBRE7.js} +4 -4
  26. package/dist/{chunk-JKVIZ5ZV.js → chunk-MJFFSZAZ.js} +3 -3
  27. package/dist/chunk-OAOBQSDM.js +9275 -0
  28. package/dist/{chunk-RDZBXCB4.js → chunk-OQT45AYL.js} +1 -1
  29. package/dist/{chunk-6VZ5MP7L.js → chunk-PYQBNBYQ.js} +1 -1
  30. package/dist/{chunk-LJSFUVJW.js → chunk-QG5ISRA6.js} +4 -4
  31. package/dist/{chunk-KM745DOE.js → chunk-SHOJMF7A.js} +32 -27
  32. package/dist/{chunk-HBZMMQ45.js → chunk-THGLXMNF.js} +262 -9481
  33. package/dist/{chunk-GBQQ3YMY.js → chunk-TLN6TZFS.js} +11 -3506
  34. package/dist/{chunk-K2V7SEFE.js → chunk-TUJDC72W.js} +2 -2
  35. package/dist/{chunk-WFFA3757.js → chunk-VPS4SSBG.js} +4 -4
  36. package/dist/chunk-W6O4UGRF.js +3517 -0
  37. package/dist/{chunk-ORR3NJ3H.js → chunk-X35DOMX4.js} +3 -3
  38. package/dist/{chunk-NOPAD6QK.js → chunk-XIZTVCPY.js} +2 -2
  39. package/dist/{chunk-HVEMPUSK.js → chunk-Y3ACGBDY.js} +3 -3
  40. package/dist/{chunk-JGUBMOZS.js → chunk-Y5I74W3X.js} +5 -5
  41. package/dist/chunk-YEZSTJP5.js +120 -0
  42. package/dist/{chunk-AAQXYK2V.js → chunk-YFK5FYC3.js} +2 -2
  43. package/dist/{chunk-MHQS74AE.js → chunk-ZA25L4BB.js} +2 -2
  44. package/dist/commands/add-ledger-entry.js +9 -7
  45. package/dist/commands/create-custom-link.js +9 -7
  46. package/dist/commands/create-ledger.js +9 -7
  47. package/dist/commands/delete-custom-txs.js +9 -7
  48. package/dist/commands/delete-ledger.js +9 -7
  49. package/dist/commands/delete-schema.js +9 -7
  50. package/dist/commands/designer-mcp.js +19 -0
  51. package/dist/commands/gen-graphql.js +13 -11
  52. package/dist/commands/get-schema.js +11 -8
  53. package/dist/commands/init.js +8 -6
  54. package/dist/commands/login.js +10 -7
  55. package/dist/commands/migrate-ledger-entry.js +9 -7
  56. package/dist/commands/query/ledgerAccounts.js +9 -7
  57. package/dist/commands/query/ledgers.js +9 -7
  58. package/dist/commands/query/schema.js +9 -7
  59. package/dist/commands/query/schemas.js +9 -7
  60. package/dist/commands/reverse-ledger-entry.js +9 -7
  61. package/dist/commands/start.js +8 -6
  62. package/dist/commands/store-schema.js +9 -7
  63. package/dist/commands/token.js +9 -7
  64. package/dist/commands/update-ledger-account.js +9 -7
  65. package/dist/commands/update.js +10 -7
  66. package/dist/commands/verify-schema.js +13 -11
  67. package/dist/commands/workspace.js +9 -7
  68. package/dist/commands.js +42 -38
  69. package/dist/designer/commandQueue.js +7 -0
  70. package/dist/designer/mcpServer.js +8 -0
  71. package/dist/designer/server.js +13557 -0
  72. package/dist/graphql.js +4 -5
  73. package/dist/index.js +42 -38
  74. package/dist/lib/auth.js +3 -2
  75. package/dist/lib/authenticatedCommand.js +8 -6
  76. package/dist/lib/baseCommand.js +7 -5
  77. package/dist/utils/formatValidationErrors.js +4 -3
  78. package/dist/utils/schemaValidation.js +7 -6
  79. package/dist/version.js +3 -2
  80. package/oclif.manifest.json +44 -1
  81. package/package.json +3 -1
  82. package/dist/chunk-AVOZNCFV.js +0 -2040
@@ -2,11 +2,15 @@ import {
2
2
  init_cjs_shims
3
3
  } from "./chunk-7GH3YGSC.js";
4
4
 
5
- // ../../node_modules/zod/lib/index.mjs
5
+ // node_modules/zod/v3/ZodError.js
6
+ init_cjs_shims();
7
+
8
+ // node_modules/zod/v3/helpers/util.js
6
9
  init_cjs_shims();
7
10
  var util;
8
11
  (function(util2) {
9
- util2.assertEqual = (val) => val;
12
+ util2.assertEqual = (_) => {
13
+ };
10
14
  function assertIs(_arg) {
11
15
  }
12
16
  util2.assertIs = assertIs;
@@ -50,7 +54,7 @@ var util;
50
54
  }
51
55
  return void 0;
52
56
  };
53
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
57
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
54
58
  function joinValues(array, separator = " | ") {
55
59
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
56
60
  }
@@ -102,7 +106,7 @@ var getParsedType = (data) => {
102
106
  case "string":
103
107
  return ZodParsedType.string;
104
108
  case "number":
105
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
109
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
106
110
  case "boolean":
107
111
  return ZodParsedType.boolean;
108
112
  case "function":
@@ -135,6 +139,8 @@ var getParsedType = (data) => {
135
139
  return ZodParsedType.unknown;
136
140
  }
137
141
  };
142
+
143
+ // node_modules/zod/v3/ZodError.js
138
144
  var ZodIssueCode = util.arrayToEnum([
139
145
  "invalid_type",
140
146
  "invalid_literal",
@@ -234,8 +240,9 @@ var ZodError = class _ZodError extends Error {
234
240
  const formErrors = [];
235
241
  for (const sub of this.issues) {
236
242
  if (sub.path.length > 0) {
237
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
238
- fieldErrors[sub.path[0]].push(mapper(sub));
243
+ const firstEl = sub.path[0];
244
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
245
+ fieldErrors[firstEl].push(mapper(sub));
239
246
  } else {
240
247
  formErrors.push(mapper(sub));
241
248
  }
@@ -250,6 +257,9 @@ ZodError.create = (issues) => {
250
257
  const error = new ZodError(issues);
251
258
  return error;
252
259
  };
260
+
261
+ // node_modules/zod/v3/locales/en.js
262
+ init_cjs_shims();
253
263
  var errorMap = (issue, _ctx) => {
254
264
  let message;
255
265
  switch (issue.code) {
@@ -311,6 +321,8 @@ var errorMap = (issue, _ctx) => {
311
321
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
312
322
  else if (issue.type === "number")
313
323
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
324
+ else if (issue.type === "bigint")
325
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
314
326
  else if (issue.type === "date")
315
327
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
316
328
  else
@@ -348,13 +360,20 @@ var errorMap = (issue, _ctx) => {
348
360
  }
349
361
  return { message };
350
362
  };
351
- var overrideErrorMap = errorMap;
363
+ var en_default = errorMap;
364
+
365
+ // node_modules/zod/v3/errors.js
366
+ init_cjs_shims();
367
+ var overrideErrorMap = en_default;
352
368
  function setErrorMap(map) {
353
369
  overrideErrorMap = map;
354
370
  }
355
371
  function getErrorMap() {
356
372
  return overrideErrorMap;
357
373
  }
374
+
375
+ // node_modules/zod/v3/helpers/parseUtil.js
376
+ init_cjs_shims();
358
377
  var makeIssue = (params) => {
359
378
  const { data, path, errorMaps, issueData } = params;
360
379
  const fullPath = [...path, ...issueData.path || []];
@@ -394,7 +413,7 @@ function addIssueToContext(ctx, issueData) {
394
413
  // then schema-bound map if available
395
414
  overrideMap,
396
415
  // then global override map
397
- overrideMap === errorMap ? void 0 : errorMap
416
+ overrideMap === en_default ? void 0 : en_default
398
417
  // then global default map
399
418
  ].filter((x) => !!x)
400
419
  });
@@ -463,29 +482,19 @@ var isAborted = (x) => x.status === "aborted";
463
482
  var isDirty = (x) => x.status === "dirty";
464
483
  var isValid = (x) => x.status === "valid";
465
484
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
466
- function __classPrivateFieldGet(receiver, state, kind, f) {
467
- if (kind === "a" && !f)
468
- throw new TypeError("Private accessor was defined without a getter");
469
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
470
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
471
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
472
- }
473
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
474
- if (kind === "m")
475
- throw new TypeError("Private method is not writable");
476
- if (kind === "a" && !f)
477
- throw new TypeError("Private accessor was defined without a setter");
478
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
479
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
480
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
481
- }
485
+
486
+ // node_modules/zod/v3/types.js
487
+ init_cjs_shims();
488
+
489
+ // node_modules/zod/v3/helpers/errorUtil.js
490
+ init_cjs_shims();
482
491
  var errorUtil;
483
492
  (function(errorUtil2) {
484
493
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
485
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
494
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
486
495
  })(errorUtil || (errorUtil = {}));
487
- var _ZodEnum_cache;
488
- var _ZodNativeEnum_cache;
496
+
497
+ // node_modules/zod/v3/types.js
489
498
  var ParseInputLazyPath = class {
490
499
  constructor(parent, value, path, key) {
491
500
  this._cachedPath = [];
@@ -496,7 +505,7 @@ var ParseInputLazyPath = class {
496
505
  }
497
506
  get path() {
498
507
  if (!this._cachedPath.length) {
499
- if (this._key instanceof Array) {
508
+ if (Array.isArray(this._key)) {
500
509
  this._cachedPath.push(...this._path, ...this._key);
501
510
  } else {
502
511
  this._cachedPath.push(...this._path, this._key);
@@ -534,17 +543,16 @@ function processCreateParams(params) {
534
543
  if (errorMap2)
535
544
  return { errorMap: errorMap2, description };
536
545
  const customMap = (iss, ctx) => {
537
- var _a, _b;
538
546
  const { message } = params;
539
547
  if (iss.code === "invalid_enum_value") {
540
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
548
+ return { message: message ?? ctx.defaultError };
541
549
  }
542
550
  if (typeof ctx.data === "undefined") {
543
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
551
+ return { message: message ?? required_error ?? ctx.defaultError };
544
552
  }
545
553
  if (iss.code !== "invalid_type")
546
554
  return { message: ctx.defaultError };
547
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
555
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
548
556
  };
549
557
  return { errorMap: customMap, description };
550
558
  }
@@ -596,14 +604,13 @@ var ZodType = class {
596
604
  throw result.error;
597
605
  }
598
606
  safeParse(data, params) {
599
- var _a;
600
607
  const ctx = {
601
608
  common: {
602
609
  issues: [],
603
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
604
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
610
+ async: params?.async ?? false,
611
+ contextualErrorMap: params?.errorMap
605
612
  },
606
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
613
+ path: params?.path || [],
607
614
  schemaErrorMap: this._def.errorMap,
608
615
  parent: null,
609
616
  data,
@@ -613,7 +620,6 @@ var ZodType = class {
613
620
  return handleResult(ctx, result);
614
621
  }
615
622
  "~validate"(data) {
616
- var _a, _b;
617
623
  const ctx = {
618
624
  common: {
619
625
  issues: [],
@@ -634,7 +640,7 @@ var ZodType = class {
634
640
  issues: ctx.common.issues
635
641
  };
636
642
  } catch (err) {
637
- if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
643
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
638
644
  this["~standard"].async = true;
639
645
  }
640
646
  ctx.common = {
@@ -659,10 +665,10 @@ var ZodType = class {
659
665
  const ctx = {
660
666
  common: {
661
667
  issues: [],
662
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
668
+ contextualErrorMap: params?.errorMap,
663
669
  async: true
664
670
  },
665
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
671
+ path: params?.path || [],
666
672
  schemaErrorMap: this._def.errorMap,
667
673
  parent: null,
668
674
  data,
@@ -852,13 +858,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
852
858
  var dateRegexSource = `((\\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])))`;
853
859
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
854
860
  function timeRegexSource(args) {
855
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
861
+ let secondsRegexSource = `[0-5]\\d`;
856
862
  if (args.precision) {
857
- regex = `${regex}\\.\\d{${args.precision}}`;
863
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
858
864
  } else if (args.precision == null) {
859
- regex = `${regex}(\\.\\d+)?`;
865
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
860
866
  }
861
- return regex;
867
+ const secondsQuantifier = args.precision ? "+" : "?";
868
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
862
869
  }
863
870
  function timeRegex(args) {
864
871
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -886,16 +893,20 @@ function isValidJWT(jwt, alg) {
886
893
  return false;
887
894
  try {
888
895
  const [header] = jwt.split(".");
896
+ if (!header)
897
+ return false;
889
898
  const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
890
899
  const decoded = JSON.parse(atob(base64));
891
900
  if (typeof decoded !== "object" || decoded === null)
892
901
  return false;
893
- if (!decoded.typ || !decoded.alg)
902
+ if ("typ" in decoded && decoded?.typ !== "JWT")
903
+ return false;
904
+ if (!decoded.alg)
894
905
  return false;
895
906
  if (alg && decoded.alg !== alg)
896
907
  return false;
897
908
  return true;
898
- } catch (_a) {
909
+ } catch {
899
910
  return false;
900
911
  }
901
912
  }
@@ -1054,7 +1065,7 @@ var ZodString = class _ZodString extends ZodType {
1054
1065
  } else if (check.kind === "url") {
1055
1066
  try {
1056
1067
  new URL(input.data);
1057
- } catch (_a) {
1068
+ } catch {
1058
1069
  ctx = this._getOrReturnCtx(input, ctx);
1059
1070
  addIssueToContext(ctx, {
1060
1071
  validation: "url",
@@ -1266,7 +1277,6 @@ var ZodString = class _ZodString extends ZodType {
1266
1277
  return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
1267
1278
  }
1268
1279
  datetime(options) {
1269
- var _a, _b;
1270
1280
  if (typeof options === "string") {
1271
1281
  return this._addCheck({
1272
1282
  kind: "datetime",
@@ -1278,10 +1288,10 @@ var ZodString = class _ZodString extends ZodType {
1278
1288
  }
1279
1289
  return this._addCheck({
1280
1290
  kind: "datetime",
1281
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1282
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1283
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1284
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1291
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1292
+ offset: options?.offset ?? false,
1293
+ local: options?.local ?? false,
1294
+ ...errorUtil.errToObj(options?.message)
1285
1295
  });
1286
1296
  }
1287
1297
  date(message) {
@@ -1297,8 +1307,8 @@ var ZodString = class _ZodString extends ZodType {
1297
1307
  }
1298
1308
  return this._addCheck({
1299
1309
  kind: "time",
1300
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1301
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1310
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1311
+ ...errorUtil.errToObj(options?.message)
1302
1312
  });
1303
1313
  }
1304
1314
  duration(message) {
@@ -1315,8 +1325,8 @@ var ZodString = class _ZodString extends ZodType {
1315
1325
  return this._addCheck({
1316
1326
  kind: "includes",
1317
1327
  value,
1318
- position: options === null || options === void 0 ? void 0 : options.position,
1319
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1328
+ position: options?.position,
1329
+ ...errorUtil.errToObj(options?.message)
1320
1330
  });
1321
1331
  }
1322
1332
  startsWith(value, message) {
@@ -1448,11 +1458,10 @@ var ZodString = class _ZodString extends ZodType {
1448
1458
  }
1449
1459
  };
1450
1460
  ZodString.create = (params) => {
1451
- var _a;
1452
1461
  return new ZodString({
1453
1462
  checks: [],
1454
1463
  typeName: ZodFirstPartyTypeKind.ZodString,
1455
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1464
+ coerce: params?.coerce ?? false,
1456
1465
  ...processCreateParams(params)
1457
1466
  });
1458
1467
  };
@@ -1460,9 +1469,9 @@ function floatSafeRemainder(val, step) {
1460
1469
  const valDecCount = (val.toString().split(".")[1] || "").length;
1461
1470
  const stepDecCount = (step.toString().split(".")[1] || "").length;
1462
1471
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1463
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1464
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1465
- return valInt % stepInt / Math.pow(10, decCount);
1472
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1473
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1474
+ return valInt % stepInt / 10 ** decCount;
1466
1475
  }
1467
1476
  var ZodNumber = class _ZodNumber extends ZodType {
1468
1477
  constructor() {
@@ -1672,7 +1681,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
1672
1681
  return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1673
1682
  }
1674
1683
  get isFinite() {
1675
- let max = null, min = null;
1684
+ let max = null;
1685
+ let min = null;
1676
1686
  for (const ch of this._def.checks) {
1677
1687
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1678
1688
  return true;
@@ -1691,7 +1701,7 @@ ZodNumber.create = (params) => {
1691
1701
  return new ZodNumber({
1692
1702
  checks: [],
1693
1703
  typeName: ZodFirstPartyTypeKind.ZodNumber,
1694
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1704
+ coerce: params?.coerce || false,
1695
1705
  ...processCreateParams(params)
1696
1706
  });
1697
1707
  };
@@ -1705,7 +1715,7 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
1705
1715
  if (this._def.coerce) {
1706
1716
  try {
1707
1717
  input.data = BigInt(input.data);
1708
- } catch (_a) {
1718
+ } catch {
1709
1719
  return this._getInvalidInput(input);
1710
1720
  }
1711
1721
  }
@@ -1860,11 +1870,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
1860
1870
  }
1861
1871
  };
1862
1872
  ZodBigInt.create = (params) => {
1863
- var _a;
1864
1873
  return new ZodBigInt({
1865
1874
  checks: [],
1866
1875
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1867
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1876
+ coerce: params?.coerce ?? false,
1868
1877
  ...processCreateParams(params)
1869
1878
  });
1870
1879
  };
@@ -1889,7 +1898,7 @@ var ZodBoolean = class extends ZodType {
1889
1898
  ZodBoolean.create = (params) => {
1890
1899
  return new ZodBoolean({
1891
1900
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
1892
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1901
+ coerce: params?.coerce || false,
1893
1902
  ...processCreateParams(params)
1894
1903
  });
1895
1904
  };
@@ -1908,7 +1917,7 @@ var ZodDate = class _ZodDate extends ZodType {
1908
1917
  });
1909
1918
  return INVALID;
1910
1919
  }
1911
- if (isNaN(input.data.getTime())) {
1920
+ if (Number.isNaN(input.data.getTime())) {
1912
1921
  const ctx2 = this._getOrReturnCtx(input);
1913
1922
  addIssueToContext(ctx2, {
1914
1923
  code: ZodIssueCode.invalid_date
@@ -1997,7 +2006,7 @@ var ZodDate = class _ZodDate extends ZodType {
1997
2006
  ZodDate.create = (params) => {
1998
2007
  return new ZodDate({
1999
2008
  checks: [],
2000
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2009
+ coerce: params?.coerce || false,
2001
2010
  typeName: ZodFirstPartyTypeKind.ZodDate,
2002
2011
  ...processCreateParams(params)
2003
2012
  });
@@ -2272,7 +2281,8 @@ var ZodObject = class _ZodObject extends ZodType {
2272
2281
  return this._cached;
2273
2282
  const shape = this._def.shape();
2274
2283
  const keys = util.objectKeys(shape);
2275
- return this._cached = { shape, keys };
2284
+ this._cached = { shape, keys };
2285
+ return this._cached;
2276
2286
  }
2277
2287
  _parse(input) {
2278
2288
  const parsedType = this._getType(input);
@@ -2322,9 +2332,8 @@ var ZodObject = class _ZodObject extends ZodType {
2322
2332
  });
2323
2333
  status.dirty();
2324
2334
  }
2325
- } else if (unknownKeys === "strip")
2326
- ;
2327
- else {
2335
+ } else if (unknownKeys === "strip") {
2336
+ } else {
2328
2337
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2329
2338
  }
2330
2339
  } else {
@@ -2371,11 +2380,10 @@ var ZodObject = class _ZodObject extends ZodType {
2371
2380
  unknownKeys: "strict",
2372
2381
  ...message !== void 0 ? {
2373
2382
  errorMap: (issue, ctx) => {
2374
- var _a, _b, _c, _d;
2375
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2383
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2376
2384
  if (issue.code === "unrecognized_keys")
2377
2385
  return {
2378
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
2386
+ message: errorUtil.errToObj(message).message ?? defaultError
2379
2387
  };
2380
2388
  return {
2381
2389
  message: defaultError
@@ -2506,11 +2514,11 @@ var ZodObject = class _ZodObject extends ZodType {
2506
2514
  }
2507
2515
  pick(mask) {
2508
2516
  const shape = {};
2509
- util.objectKeys(mask).forEach((key) => {
2517
+ for (const key of util.objectKeys(mask)) {
2510
2518
  if (mask[key] && this.shape[key]) {
2511
2519
  shape[key] = this.shape[key];
2512
2520
  }
2513
- });
2521
+ }
2514
2522
  return new _ZodObject({
2515
2523
  ...this._def,
2516
2524
  shape: () => shape
@@ -2518,11 +2526,11 @@ var ZodObject = class _ZodObject extends ZodType {
2518
2526
  }
2519
2527
  omit(mask) {
2520
2528
  const shape = {};
2521
- util.objectKeys(this.shape).forEach((key) => {
2529
+ for (const key of util.objectKeys(this.shape)) {
2522
2530
  if (!mask[key]) {
2523
2531
  shape[key] = this.shape[key];
2524
2532
  }
2525
- });
2533
+ }
2526
2534
  return new _ZodObject({
2527
2535
  ...this._def,
2528
2536
  shape: () => shape
@@ -2536,14 +2544,14 @@ var ZodObject = class _ZodObject extends ZodType {
2536
2544
  }
2537
2545
  partial(mask) {
2538
2546
  const newShape = {};
2539
- util.objectKeys(this.shape).forEach((key) => {
2547
+ for (const key of util.objectKeys(this.shape)) {
2540
2548
  const fieldSchema = this.shape[key];
2541
2549
  if (mask && !mask[key]) {
2542
2550
  newShape[key] = fieldSchema;
2543
2551
  } else {
2544
2552
  newShape[key] = fieldSchema.optional();
2545
2553
  }
2546
- });
2554
+ }
2547
2555
  return new _ZodObject({
2548
2556
  ...this._def,
2549
2557
  shape: () => newShape
@@ -2551,7 +2559,7 @@ var ZodObject = class _ZodObject extends ZodType {
2551
2559
  }
2552
2560
  required(mask) {
2553
2561
  const newShape = {};
2554
- util.objectKeys(this.shape).forEach((key) => {
2562
+ for (const key of util.objectKeys(this.shape)) {
2555
2563
  if (mask && !mask[key]) {
2556
2564
  newShape[key] = this.shape[key];
2557
2565
  } else {
@@ -2562,7 +2570,7 @@ var ZodObject = class _ZodObject extends ZodType {
2562
2570
  }
2563
2571
  newShape[key] = newField;
2564
2572
  }
2565
- });
2573
+ }
2566
2574
  return new _ZodObject({
2567
2575
  ...this._def,
2568
2576
  shape: () => newShape
@@ -3178,12 +3186,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
3178
3186
  return makeIssue({
3179
3187
  data: args,
3180
3188
  path: ctx.path,
3181
- errorMaps: [
3182
- ctx.common.contextualErrorMap,
3183
- ctx.schemaErrorMap,
3184
- getErrorMap(),
3185
- errorMap
3186
- ].filter((x) => !!x),
3189
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
3187
3190
  issueData: {
3188
3191
  code: ZodIssueCode.invalid_arguments,
3189
3192
  argumentsError: error
@@ -3194,12 +3197,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
3194
3197
  return makeIssue({
3195
3198
  data: returns,
3196
3199
  path: ctx.path,
3197
- errorMaps: [
3198
- ctx.common.contextualErrorMap,
3199
- ctx.schemaErrorMap,
3200
- getErrorMap(),
3201
- errorMap
3202
- ].filter((x) => !!x),
3200
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
3203
3201
  issueData: {
3204
3202
  code: ZodIssueCode.invalid_return_type,
3205
3203
  returnTypeError: error
@@ -3323,10 +3321,6 @@ function createZodEnum(values, params) {
3323
3321
  });
3324
3322
  }
3325
3323
  var ZodEnum = class _ZodEnum extends ZodType {
3326
- constructor() {
3327
- super(...arguments);
3328
- _ZodEnum_cache.set(this, void 0);
3329
- }
3330
3324
  _parse(input) {
3331
3325
  if (typeof input.data !== "string") {
3332
3326
  const ctx = this._getOrReturnCtx(input);
@@ -3338,10 +3332,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
3338
3332
  });
3339
3333
  return INVALID;
3340
3334
  }
3341
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3342
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3335
+ if (!this._cache) {
3336
+ this._cache = new Set(this._def.values);
3343
3337
  }
3344
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
3338
+ if (!this._cache.has(input.data)) {
3345
3339
  const ctx = this._getOrReturnCtx(input);
3346
3340
  const expectedValues = this._def.values;
3347
3341
  addIssueToContext(ctx, {
@@ -3390,13 +3384,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
3390
3384
  });
3391
3385
  }
3392
3386
  };
3393
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
3394
3387
  ZodEnum.create = createZodEnum;
3395
3388
  var ZodNativeEnum = class extends ZodType {
3396
- constructor() {
3397
- super(...arguments);
3398
- _ZodNativeEnum_cache.set(this, void 0);
3399
- }
3400
3389
  _parse(input) {
3401
3390
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
3402
3391
  const ctx = this._getOrReturnCtx(input);
@@ -3409,10 +3398,10 @@ var ZodNativeEnum = class extends ZodType {
3409
3398
  });
3410
3399
  return INVALID;
3411
3400
  }
3412
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3413
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3401
+ if (!this._cache) {
3402
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
3414
3403
  }
3415
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
3404
+ if (!this._cache.has(input.data)) {
3416
3405
  const expectedValues = util.objectValues(nativeEnumValues);
3417
3406
  addIssueToContext(ctx, {
3418
3407
  received: ctx.data,
@@ -3427,7 +3416,6 @@ var ZodNativeEnum = class extends ZodType {
3427
3416
  return this._def.values;
3428
3417
  }
3429
3418
  };
3430
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
3431
3419
  ZodNativeEnum.create = (values, params) => {
3432
3420
  return new ZodNativeEnum({
3433
3421
  values,
@@ -3568,7 +3556,7 @@ var ZodEffects = class extends ZodType {
3568
3556
  parent: ctx
3569
3557
  });
3570
3558
  if (!isValid(base))
3571
- return base;
3559
+ return INVALID;
3572
3560
  const result = effect.transform(base.value, checkCtx);
3573
3561
  if (result instanceof Promise) {
3574
3562
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -3577,8 +3565,11 @@ var ZodEffects = class extends ZodType {
3577
3565
  } else {
3578
3566
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3579
3567
  if (!isValid(base))
3580
- return base;
3581
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3568
+ return INVALID;
3569
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3570
+ status: status.value,
3571
+ value: result
3572
+ }));
3582
3573
  });
3583
3574
  }
3584
3575
  }
@@ -3830,16 +3821,30 @@ ZodReadonly.create = (type, params) => {
3830
3821
  ...processCreateParams(params)
3831
3822
  });
3832
3823
  };
3833
- function custom(check, params = {}, fatal) {
3824
+ function cleanParams(params, data) {
3825
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3826
+ const p2 = typeof p === "string" ? { message: p } : p;
3827
+ return p2;
3828
+ }
3829
+ function custom(check, _params = {}, fatal) {
3834
3830
  if (check)
3835
3831
  return ZodAny.create().superRefine((data, ctx) => {
3836
- var _a, _b;
3837
- if (!check(data)) {
3838
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3839
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3840
- const p2 = typeof p === "string" ? { message: p } : p;
3841
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3832
+ const r = check(data);
3833
+ if (r instanceof Promise) {
3834
+ return r.then((r2) => {
3835
+ if (!r2) {
3836
+ const params = cleanParams(_params, data);
3837
+ const _fatal = params.fatal ?? fatal ?? true;
3838
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3839
+ }
3840
+ });
3842
3841
  }
3842
+ if (!r) {
3843
+ const params = cleanParams(_params, data);
3844
+ const _fatal = params.fatal ?? fatal ?? true;
3845
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3846
+ }
3847
+ return;
3843
3848
  });
3844
3849
  return ZodAny.create();
3845
3850
  }
@@ -3936,9 +3941,16 @@ var coerce = {
3936
3941
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3937
3942
  };
3938
3943
  var NEVER = INVALID;
3939
- var z = /* @__PURE__ */ Object.freeze({
3940
- __proto__: null,
3941
- defaultErrorMap: errorMap,
3944
+
3945
+ export {
3946
+ util,
3947
+ objectUtil,
3948
+ ZodParsedType,
3949
+ getParsedType,
3950
+ ZodIssueCode,
3951
+ quotelessJson,
3952
+ ZodError,
3953
+ en_default,
3942
3954
  setErrorMap,
3943
3955
  getErrorMap,
3944
3956
  makeIssue,
@@ -3952,14 +3964,6 @@ var z = /* @__PURE__ */ Object.freeze({
3952
3964
  isDirty,
3953
3965
  isValid,
3954
3966
  isAsync,
3955
- get util() {
3956
- return util;
3957
- },
3958
- get objectUtil() {
3959
- return objectUtil;
3960
- },
3961
- ZodParsedType,
3962
- getParsedType,
3963
3967
  ZodType,
3964
3968
  datetimeRegex,
3965
3969
  ZodString,
@@ -3990,7 +3994,6 @@ var z = /* @__PURE__ */ Object.freeze({
3990
3994
  ZodNativeEnum,
3991
3995
  ZodPromise,
3992
3996
  ZodEffects,
3993
- ZodTransformer: ZodEffects,
3994
3997
  ZodOptional,
3995
3998
  ZodNullable,
3996
3999
  ZodDefault,
@@ -4001,59 +4004,46 @@ var z = /* @__PURE__ */ Object.freeze({
4001
4004
  ZodPipeline,
4002
4005
  ZodReadonly,
4003
4006
  custom,
4004
- Schema: ZodType,
4005
- ZodSchema: ZodType,
4006
4007
  late,
4007
- get ZodFirstPartyTypeKind() {
4008
- return ZodFirstPartyTypeKind;
4009
- },
4010
- coerce,
4011
- any: anyType,
4012
- array: arrayType,
4013
- bigint: bigIntType,
4014
- boolean: booleanType,
4015
- date: dateType,
4016
- discriminatedUnion: discriminatedUnionType,
4017
- effect: effectsType,
4018
- "enum": enumType,
4019
- "function": functionType,
4020
- "instanceof": instanceOfType,
4021
- intersection: intersectionType,
4022
- lazy: lazyType,
4023
- literal: literalType,
4024
- map: mapType,
4025
- nan: nanType,
4026
- nativeEnum: nativeEnumType,
4027
- never: neverType,
4028
- "null": nullType,
4029
- nullable: nullableType,
4030
- number: numberType,
4031
- object: objectType,
4032
- oboolean,
4033
- onumber,
4034
- optional: optionalType,
4008
+ ZodFirstPartyTypeKind,
4009
+ instanceOfType,
4010
+ stringType,
4011
+ numberType,
4012
+ nanType,
4013
+ bigIntType,
4014
+ booleanType,
4015
+ dateType,
4016
+ symbolType,
4017
+ undefinedType,
4018
+ nullType,
4019
+ anyType,
4020
+ unknownType,
4021
+ neverType,
4022
+ voidType,
4023
+ arrayType,
4024
+ objectType,
4025
+ strictObjectType,
4026
+ unionType,
4027
+ discriminatedUnionType,
4028
+ intersectionType,
4029
+ tupleType,
4030
+ recordType,
4031
+ mapType,
4032
+ setType,
4033
+ functionType,
4034
+ lazyType,
4035
+ literalType,
4036
+ enumType,
4037
+ nativeEnumType,
4038
+ promiseType,
4039
+ effectsType,
4040
+ optionalType,
4041
+ nullableType,
4042
+ preprocessType,
4043
+ pipelineType,
4035
4044
  ostring,
4036
- pipeline: pipelineType,
4037
- preprocess: preprocessType,
4038
- promise: promiseType,
4039
- record: recordType,
4040
- set: setType,
4041
- strictObject: strictObjectType,
4042
- string: stringType,
4043
- symbol: symbolType,
4044
- transformer: effectsType,
4045
- tuple: tupleType,
4046
- "undefined": undefinedType,
4047
- union: unionType,
4048
- unknown: unknownType,
4049
- "void": voidType,
4050
- NEVER,
4051
- ZodIssueCode,
4052
- quotelessJson,
4053
- ZodError
4054
- });
4055
-
4056
- export {
4057
- ZodError,
4058
- z
4045
+ onumber,
4046
+ oboolean,
4047
+ coerce,
4048
+ NEVER
4059
4049
  };