@rpcbase/auth 0.133.0 → 0.134.0

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 (30) hide show
  1. package/dist/{handler-CyP6R8FM.js → handler-4-ccxPqk.js} +2 -2
  2. package/dist/{handler-CyP6R8FM.js.map → handler-4-ccxPqk.js.map} +1 -1
  3. package/dist/{handler-VH4B70Zr.js → handler-BIFPHnwb.js} +2 -2
  4. package/dist/{handler-VH4B70Zr.js.map → handler-BIFPHnwb.js.map} +1 -1
  5. package/dist/{handler-CbSJDqWW.js → handler-BOCOLt9O.js} +2 -2
  6. package/dist/{handler-CbSJDqWW.js.map → handler-BOCOLt9O.js.map} +1 -1
  7. package/dist/{handler-D6zJn86A.js → handler-BlhyOTyk.js} +2 -2
  8. package/dist/{handler-D6zJn86A.js.map → handler-BlhyOTyk.js.map} +1 -1
  9. package/dist/{handler-gfRB07A8.js → handler-BvztD8II.js} +2 -2
  10. package/dist/{handler-gfRB07A8.js.map → handler-BvztD8II.js.map} +1 -1
  11. package/dist/{handler-Bt53h0sk.js → handler-DG8GMWwR.js} +2 -2
  12. package/dist/{handler-Bt53h0sk.js.map → handler-DG8GMWwR.js.map} +1 -1
  13. package/dist/{handler-BNDemOGd.js → handler-DZiCZNkX.js} +2 -2
  14. package/dist/{handler-BNDemOGd.js.map → handler-DZiCZNkX.js.map} +1 -1
  15. package/dist/{handler-D8HfTbUs.js → handler-Dbkf3cD8.js} +2 -2
  16. package/dist/{handler-D8HfTbUs.js.map → handler-Dbkf3cD8.js.map} +1 -1
  17. package/dist/{handler-C4cw739Z.js → handler-EYTkh4N4.js} +2 -2
  18. package/dist/{handler-C4cw739Z.js.map → handler-EYTkh4N4.js.map} +1 -1
  19. package/dist/{handler-B5I4pH46.js → handler-Y6JMPCW0.js} +2 -2
  20. package/dist/{handler-B5I4pH46.js.map → handler-Y6JMPCW0.js.map} +1 -1
  21. package/dist/{index-Bxz6YdiB.js → index-DznfuMJi.js} +2 -2
  22. package/dist/{index-Bxz6YdiB.js.map → index-DznfuMJi.js.map} +1 -1
  23. package/dist/{index-C_uBu_fP.js → index-sfjvVpg9.js} +2 -2
  24. package/dist/{index-C_uBu_fP.js.map → index-sfjvVpg9.js.map} +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/routes.js +1 -1
  27. package/dist/{schemas-Dn3gHDGz.js → schemas-BYptELX5.js} +406 -154
  28. package/dist/schemas-BYptELX5.js.map +1 -0
  29. package/package.json +1 -1
  30. package/dist/schemas-Dn3gHDGz.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ var _a$1;
1
2
  function $constructor(name, initializer2, params) {
2
3
  function init(inst, def) {
3
4
  if (!inst._zod) {
@@ -60,7 +61,8 @@ class $ZodEncodeError extends Error {
60
61
  this.name = "ZodEncodeError";
61
62
  }
62
63
  }
63
- const globalConfig = {};
64
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
65
+ const globalConfig = globalThis.__zod_globalConfig;
64
66
  function config(newConfig) {
65
67
  return globalConfig;
66
68
  }
@@ -143,7 +145,10 @@ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace
143
145
  function isObject(data) {
144
146
  return typeof data === "object" && data !== null && !Array.isArray(data);
145
147
  }
146
- const allowsEval = cached(() => {
148
+ const allowsEval = /* @__PURE__ */ cached(() => {
149
+ if (globalConfig.jitless) {
150
+ return false;
151
+ }
147
152
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
148
153
  return false;
149
154
  }
@@ -176,6 +181,10 @@ function shallowClone(o) {
176
181
  return { ...o };
177
182
  if (Array.isArray(o))
178
183
  return [...o];
184
+ if (o instanceof Map)
185
+ return new Map(o);
186
+ if (o instanceof Set)
187
+ return new Set(o);
179
188
  return o;
180
189
  }
181
190
  const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
@@ -296,6 +305,9 @@ function safeExtend(schema, shape) {
296
305
  return clone(schema, def);
297
306
  }
298
307
  function merge(a, b) {
308
+ if (a._zod.def.checks?.length) {
309
+ throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
310
+ }
299
311
  const def = mergeDefs(a._zod.def, {
300
312
  get shape() {
301
313
  const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
@@ -305,8 +317,7 @@ function merge(a, b) {
305
317
  get catchall() {
306
318
  return b._zod.def.catchall;
307
319
  },
308
- checks: []
309
- // delete existing checks
320
+ checks: b._zod.def.checks ?? []
310
321
  });
311
322
  return clone(a, def);
312
323
  }
@@ -389,6 +400,16 @@ function aborted(x, startIndex = 0) {
389
400
  }
390
401
  return false;
391
402
  }
403
+ function explicitlyAborted(x, startIndex = 0) {
404
+ if (x.aborted === true)
405
+ return true;
406
+ for (let i = startIndex; i < x.issues.length; i++) {
407
+ if (x.issues[i]?.continue === false) {
408
+ return true;
409
+ }
410
+ }
411
+ return false;
412
+ }
392
413
  function prefixIssues(path, issues) {
393
414
  return issues.map((iss) => {
394
415
  var _a2;
@@ -401,17 +422,14 @@ function unwrapMessage(message) {
401
422
  return typeof message === "string" ? message : message?.message;
402
423
  }
403
424
  function finalizeIssue(iss, ctx, config2) {
404
- const full = { ...iss, path: iss.path ?? [] };
405
- if (!iss.message) {
406
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
407
- full.message = message;
425
+ 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";
426
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
427
+ rest.path ?? (rest.path = []);
428
+ rest.message = message;
429
+ if (ctx?.reportInput) {
430
+ rest.input = _input;
408
431
  }
409
- delete full.inst;
410
- delete full.continue;
411
- if (!ctx?.reportInput) {
412
- delete full.input;
413
- }
414
- return full;
432
+ return rest;
415
433
  }
416
434
  function getLengthableOrigin(input) {
417
435
  if (Array.isArray(input))
@@ -465,30 +483,33 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
465
483
  }
466
484
  function formatError(error, mapper = (issue2) => issue2.message) {
467
485
  const fieldErrors = { _errors: [] };
468
- const processError = (error2) => {
486
+ const processError = (error2, path = []) => {
469
487
  for (const issue2 of error2.issues) {
470
488
  if (issue2.code === "invalid_union" && issue2.errors.length) {
471
- issue2.errors.map((issues) => processError({ issues }));
489
+ issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
472
490
  } else if (issue2.code === "invalid_key") {
473
- processError({ issues: issue2.issues });
491
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
474
492
  } else if (issue2.code === "invalid_element") {
475
- processError({ issues: issue2.issues });
476
- } else if (issue2.path.length === 0) {
477
- fieldErrors._errors.push(mapper(issue2));
493
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
478
494
  } else {
479
- let curr = fieldErrors;
480
- let i = 0;
481
- while (i < issue2.path.length) {
482
- const el = issue2.path[i];
483
- const terminal = i === issue2.path.length - 1;
484
- if (!terminal) {
485
- curr[el] = curr[el] || { _errors: [] };
486
- } else {
487
- curr[el] = curr[el] || { _errors: [] };
488
- curr[el]._errors.push(mapper(issue2));
495
+ const fullpath = [...path, ...issue2.path];
496
+ if (fullpath.length === 0) {
497
+ fieldErrors._errors.push(mapper(issue2));
498
+ } else {
499
+ let curr = fieldErrors;
500
+ let i = 0;
501
+ while (i < fullpath.length) {
502
+ const el = fullpath[i];
503
+ const terminal = i === fullpath.length - 1;
504
+ if (!terminal) {
505
+ curr[el] = curr[el] || { _errors: [] };
506
+ } else {
507
+ curr[el] = curr[el] || { _errors: [] };
508
+ curr[el]._errors.push(mapper(issue2));
509
+ }
510
+ curr = curr[el];
511
+ i++;
489
512
  }
490
- curr = curr[el];
491
- i++;
492
513
  }
493
514
  }
494
515
  }
@@ -497,7 +518,7 @@ function formatError(error, mapper = (issue2) => issue2.message) {
497
518
  return fieldErrors;
498
519
  }
499
520
  const _parse = (_Err) => (schema, value, _ctx, _params) => {
500
- const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
521
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
501
522
  const result = schema._zod.run({ value, issues: [] }, ctx);
502
523
  if (result instanceof Promise) {
503
524
  throw new $ZodAsyncError();
@@ -510,7 +531,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
510
531
  return result.value;
511
532
  };
512
533
  const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
513
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
534
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
514
535
  let result = schema._zod.run({ value, issues: [] }, ctx);
515
536
  if (result instanceof Promise)
516
537
  result = await result;
@@ -534,7 +555,7 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
534
555
  };
535
556
  const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
536
557
  const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
537
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
558
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
538
559
  let result = schema._zod.run({ value, issues: [] }, ctx);
539
560
  if (result instanceof Promise)
540
561
  result = await result;
@@ -545,34 +566,34 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
545
566
  };
546
567
  const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
547
568
  const _encode = (_Err) => (schema, value, _ctx) => {
548
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
569
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
549
570
  return _parse(_Err)(schema, value, ctx);
550
571
  };
551
572
  const _decode = (_Err) => (schema, value, _ctx) => {
552
573
  return _parse(_Err)(schema, value, _ctx);
553
574
  };
554
575
  const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
555
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
576
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
556
577
  return _parseAsync(_Err)(schema, value, ctx);
557
578
  };
558
579
  const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
559
580
  return _parseAsync(_Err)(schema, value, _ctx);
560
581
  };
561
582
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
562
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
583
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
563
584
  return _safeParse(_Err)(schema, value, ctx);
564
585
  };
565
586
  const _safeDecode = (_Err) => (schema, value, _ctx) => {
566
587
  return _safeParse(_Err)(schema, value, _ctx);
567
588
  };
568
589
  const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
569
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
590
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
570
591
  return _safeParseAsync(_Err)(schema, value, ctx);
571
592
  };
572
593
  const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
573
594
  return _safeParseAsync(_Err)(schema, value, _ctx);
574
595
  };
575
- const cuid = /^[cC][^\s-]{8,}$/;
596
+ const cuid = /^[cC][0-9a-z]{6,}$/;
576
597
  const cuid2 = /^[0-9a-z]+$/;
577
598
  const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
578
599
  const xid = /^[0-9a-vA-V]{20}$/;
@@ -596,6 +617,7 @@ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-
596
617
  const 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])$/;
597
618
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
598
619
  const base64url = /^[A-Za-z0-9_-]*$/;
620
+ const httpProtocol = /^https?$/;
599
621
  const e164 = /^\+[1-9]\d{6,14}$/;
600
622
  const 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])))`;
601
623
  const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
@@ -886,8 +908,8 @@ class Doc {
886
908
  }
887
909
  const version = {
888
910
  major: 4,
889
- minor: 3,
890
- patch: 6
911
+ minor: 4,
912
+ patch: 3
891
913
  };
892
914
  const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
893
915
  var _a2;
@@ -915,6 +937,8 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
915
937
  let asyncResult;
916
938
  for (const ch of checks2) {
917
939
  if (ch._zod.def.when) {
940
+ if (explicitlyAborted(payload))
941
+ continue;
918
942
  const shouldRun = ch._zod.def.when(payload);
919
943
  if (!shouldRun)
920
944
  continue;
@@ -1055,6 +1079,19 @@ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1055
1079
  inst._zod.check = (payload) => {
1056
1080
  try {
1057
1081
  const trimmed = payload.value.trim();
1082
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1083
+ if (!/^https?:\/\//i.test(trimmed)) {
1084
+ payload.issues.push({
1085
+ code: "invalid_format",
1086
+ format: "url",
1087
+ note: "Invalid URL format",
1088
+ input: payload.value,
1089
+ inst,
1090
+ continue: !def.abort
1091
+ });
1092
+ return;
1093
+ }
1094
+ }
1058
1095
  const url = new URL(trimmed);
1059
1096
  if (def.hostname) {
1060
1097
  def.hostname.lastIndex = 0;
@@ -1203,6 +1240,8 @@ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1203
1240
  function isValidBase64(data) {
1204
1241
  if (data === "")
1205
1242
  return true;
1243
+ if (/\s/.test(data))
1244
+ return false;
1206
1245
  if (data.length % 4 !== 0)
1207
1246
  return false;
1208
1247
  try {
@@ -1365,15 +1404,27 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1365
1404
  return payload;
1366
1405
  };
1367
1406
  });
1368
- function handlePropertyResult(result, final, key, input, isOptionalOut) {
1407
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1408
+ const isPresent = key in input;
1369
1409
  if (result.issues.length) {
1370
- if (isOptionalOut && !(key in input)) {
1410
+ if (isOptionalIn && isOptionalOut && !isPresent) {
1371
1411
  return;
1372
1412
  }
1373
1413
  final.issues.push(...prefixIssues(key, result.issues));
1374
1414
  }
1415
+ if (!isPresent && !isOptionalIn) {
1416
+ if (!result.issues.length) {
1417
+ final.issues.push({
1418
+ code: "invalid_type",
1419
+ expected: "nonoptional",
1420
+ input: void 0,
1421
+ path: [key]
1422
+ });
1423
+ }
1424
+ return;
1425
+ }
1375
1426
  if (result.value === void 0) {
1376
- if (key in input) {
1427
+ if (isPresent) {
1377
1428
  final.value[key] = void 0;
1378
1429
  }
1379
1430
  } else {
@@ -1401,8 +1452,11 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1401
1452
  const keySet = def.keySet;
1402
1453
  const _catchall = def.catchall._zod;
1403
1454
  const t = _catchall.def.type;
1455
+ const isOptionalIn = _catchall.optin === "optional";
1404
1456
  const isOptionalOut = _catchall.optout === "optional";
1405
1457
  for (const key in input) {
1458
+ if (key === "__proto__")
1459
+ continue;
1406
1460
  if (keySet.has(key))
1407
1461
  continue;
1408
1462
  if (t === "never") {
@@ -1411,9 +1465,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1411
1465
  }
1412
1466
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1413
1467
  if (r instanceof Promise) {
1414
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
1468
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
1415
1469
  } else {
1416
- handlePropertyResult(r, payload, key, input, isOptionalOut);
1470
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1417
1471
  }
1418
1472
  }
1419
1473
  if (unrecognized.length) {
@@ -1479,12 +1533,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1479
1533
  const shape = value.shape;
1480
1534
  for (const key of value.keys) {
1481
1535
  const el = shape[key];
1536
+ const isOptionalIn = el._zod.optin === "optional";
1482
1537
  const isOptionalOut = el._zod.optout === "optional";
1483
1538
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1484
1539
  if (r instanceof Promise) {
1485
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
1540
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
1486
1541
  } else {
1487
- handlePropertyResult(r, payload, key, input, isOptionalOut);
1542
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1488
1543
  }
1489
1544
  }
1490
1545
  if (!catchall) {
@@ -1515,9 +1570,10 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
1515
1570
  const id = ids[key];
1516
1571
  const k = esc(key);
1517
1572
  const schema = shape[key];
1573
+ const isOptionalIn = schema?._zod?.optin === "optional";
1518
1574
  const isOptionalOut = schema?._zod?.optout === "optional";
1519
1575
  doc.write(`const ${id} = ${parseStr(key)};`);
1520
- if (isOptionalOut) {
1576
+ if (isOptionalIn && isOptionalOut) {
1521
1577
  doc.write(`
1522
1578
  if (${id}.issues.length) {
1523
1579
  if (${k} in input) {
@@ -1536,6 +1592,33 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
1536
1592
  newResult[${k}] = ${id}.value;
1537
1593
  }
1538
1594
 
1595
+ `);
1596
+ } else if (!isOptionalIn) {
1597
+ doc.write(`
1598
+ const ${id}_present = ${k} in input;
1599
+ if (${id}.issues.length) {
1600
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1601
+ ...iss,
1602
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1603
+ })));
1604
+ }
1605
+ if (!${id}_present && !${id}.issues.length) {
1606
+ payload.issues.push({
1607
+ code: "invalid_type",
1608
+ expected: "nonoptional",
1609
+ input: undefined,
1610
+ path: [${k}]
1611
+ });
1612
+ }
1613
+
1614
+ if (${id}_present) {
1615
+ if (${id}.value === undefined) {
1616
+ newResult[${k}] = undefined;
1617
+ } else {
1618
+ newResult[${k}] = ${id}.value;
1619
+ }
1620
+ }
1621
+
1539
1622
  `);
1540
1623
  } else {
1541
1624
  doc.write(`
@@ -1629,10 +1712,9 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1629
1712
  }
1630
1713
  return void 0;
1631
1714
  });
1632
- const single = def.options.length === 1;
1633
- const first = def.options[0]._zod.run;
1715
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
1634
1716
  inst._zod.parse = (payload, ctx) => {
1635
- if (single) {
1717
+ if (first) {
1636
1718
  return first(payload, ctx);
1637
1719
  }
1638
1720
  let async = false;
@@ -1778,6 +1860,7 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1778
1860
  });
1779
1861
  const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1780
1862
  $ZodType.init(inst, def);
1863
+ inst._zod.optin = "optional";
1781
1864
  inst._zod.parse = (payload, ctx) => {
1782
1865
  if (ctx.direction === "backward") {
1783
1866
  throw new $ZodEncodeError(inst.constructor.name);
@@ -1787,6 +1870,7 @@ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def)
1787
1870
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1788
1871
  return output.then((output2) => {
1789
1872
  payload.value = output2;
1873
+ payload.fallback = true;
1790
1874
  return payload;
1791
1875
  });
1792
1876
  }
@@ -1794,11 +1878,12 @@ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def)
1794
1878
  throw new $ZodAsyncError();
1795
1879
  }
1796
1880
  payload.value = _out;
1881
+ payload.fallback = true;
1797
1882
  return payload;
1798
1883
  };
1799
1884
  });
1800
1885
  function handleOptionalResult(result, input) {
1801
- if (result.issues.length && input === void 0) {
1886
+ if (input === void 0 && (result.issues.length || result.fallback)) {
1802
1887
  return { issues: [], value: void 0 };
1803
1888
  }
1804
1889
  return result;
@@ -1816,10 +1901,11 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
1816
1901
  });
1817
1902
  inst._zod.parse = (payload, ctx) => {
1818
1903
  if (def.innerType._zod.optin === "optional") {
1904
+ const input = payload.value;
1819
1905
  const result = def.innerType._zod.run(payload, ctx);
1820
1906
  if (result instanceof Promise)
1821
- return result.then((r) => handleOptionalResult(r, payload.value));
1822
- return handleOptionalResult(result, payload.value);
1907
+ return result.then((r) => handleOptionalResult(r, input));
1908
+ return handleOptionalResult(result, input);
1823
1909
  }
1824
1910
  if (payload.value === void 0) {
1825
1911
  return payload;
@@ -1918,7 +2004,7 @@ function handleNonOptionalResult(payload, inst) {
1918
2004
  }
1919
2005
  const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1920
2006
  $ZodType.init(inst, def);
1921
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2007
+ inst._zod.optin = "optional";
1922
2008
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1923
2009
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1924
2010
  inst._zod.parse = (payload, ctx) => {
@@ -1938,6 +2024,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1938
2024
  input: payload.value
1939
2025
  });
1940
2026
  payload.issues = [];
2027
+ payload.fallback = true;
1941
2028
  }
1942
2029
  return payload;
1943
2030
  });
@@ -1952,6 +2039,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1952
2039
  input: payload.value
1953
2040
  });
1954
2041
  payload.issues = [];
2042
+ payload.fallback = true;
1955
2043
  }
1956
2044
  return payload;
1957
2045
  };
@@ -1982,7 +2070,7 @@ function handlePipeResult(left, next, ctx) {
1982
2070
  left.aborted = true;
1983
2071
  return left;
1984
2072
  }
1985
- return next._zod.run({ value: left.value, issues: left.issues }, ctx);
2073
+ return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
1986
2074
  }
1987
2075
  const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
1988
2076
  $ZodType.init(inst, def);
@@ -2500,7 +2588,7 @@ function _refine(Class, fn, _params) {
2500
2588
  return schema;
2501
2589
  }
2502
2590
  // @__NO_SIDE_EFFECTS__
2503
- function _superRefine(fn) {
2591
+ function _superRefine(fn, params) {
2504
2592
  const ch = /* @__PURE__ */ _check((payload) => {
2505
2593
  payload.addIssue = (issue$1) => {
2506
2594
  if (typeof issue$1 === "string") {
@@ -2517,7 +2605,7 @@ function _superRefine(fn) {
2517
2605
  }
2518
2606
  };
2519
2607
  return fn(payload.value, payload);
2520
- });
2608
+ }, params);
2521
2609
  return ch;
2522
2610
  }
2523
2611
  // @__NO_SIDE_EFFECTS__
@@ -2598,7 +2686,7 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
2598
2686
  delete result.schema.examples;
2599
2687
  delete result.schema.default;
2600
2688
  }
2601
- if (ctx.io === "input" && result.schema._prefault)
2689
+ if (ctx.io === "input" && "_prefault" in result.schema)
2602
2690
  (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
2603
2691
  delete result.schema._prefault;
2604
2692
  const _result = ctx.seen.get(schema);
@@ -2779,10 +2867,15 @@ function finalize(ctx, schema) {
2779
2867
  result.$id = ctx.external.uri(id);
2780
2868
  }
2781
2869
  Object.assign(result, root.def ?? root.schema);
2870
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
2871
+ if (rootMetaId !== void 0 && result.id === rootMetaId)
2872
+ delete result.id;
2782
2873
  const defs = ctx.external?.defs ?? {};
2783
2874
  for (const entry of ctx.seen.entries()) {
2784
2875
  const seen = entry[1];
2785
2876
  if (seen.def && seen.defId) {
2877
+ if (seen.def.id === seen.defId)
2878
+ delete seen.def.id;
2786
2879
  defs[seen.defId] = seen.def;
2787
2880
  }
2788
2881
  }
@@ -2838,6 +2931,8 @@ function isTransforming(_schema, _ctx) {
2838
2931
  return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2839
2932
  }
2840
2933
  if (def.type === "pipe") {
2934
+ if (_schema._zod.traits.has("$ZodCodec"))
2935
+ return true;
2841
2936
  return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
2842
2937
  }
2843
2938
  if (def.type === "object") {
@@ -2954,7 +3049,10 @@ const arrayProcessor = (schema, ctx, _json, params) => {
2954
3049
  if (typeof maximum === "number")
2955
3050
  json.maxItems = maximum;
2956
3051
  json.type = "array";
2957
- json.items = process(def.element, ctx, { ...params, path: [...params.path, "items"] });
3052
+ json.items = process(def.element, ctx, {
3053
+ ...params,
3054
+ path: [...params.path, "items"]
3055
+ });
2958
3056
  };
2959
3057
  const objectProcessor = (schema, ctx, _json, params) => {
2960
3058
  const json = _json;
@@ -3069,7 +3167,8 @@ const catchProcessor = (schema, ctx, json, params) => {
3069
3167
  };
3070
3168
  const pipeProcessor = (schema, ctx, _json, params) => {
3071
3169
  const def = schema._zod.def;
3072
- const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
3170
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
3171
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
3073
3172
  process(innerType, ctx, params);
3074
3173
  const seen = ctx.seen.get(schema);
3075
3174
  seen.ref = innerType;
@@ -3149,7 +3248,7 @@ const initializer = (inst, issues) => {
3149
3248
  }
3150
3249
  });
3151
3250
  };
3152
- const ZodRealError = $constructor("ZodError", initializer, {
3251
+ const ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, {
3153
3252
  Parent: Error
3154
3253
  });
3155
3254
  const parse = /* @__PURE__ */ _parse(ZodRealError);
@@ -3164,6 +3263,43 @@ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3164
3263
  const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3165
3264
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3166
3265
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3266
+ const _installedGroups = /* @__PURE__ */ new WeakMap();
3267
+ function _installLazyMethods(inst, group, methods) {
3268
+ const proto = Object.getPrototypeOf(inst);
3269
+ let installed = _installedGroups.get(proto);
3270
+ if (!installed) {
3271
+ installed = /* @__PURE__ */ new Set();
3272
+ _installedGroups.set(proto, installed);
3273
+ }
3274
+ if (installed.has(group))
3275
+ return;
3276
+ installed.add(group);
3277
+ for (const key in methods) {
3278
+ const fn = methods[key];
3279
+ Object.defineProperty(proto, key, {
3280
+ configurable: true,
3281
+ enumerable: false,
3282
+ get() {
3283
+ const bound = fn.bind(this);
3284
+ Object.defineProperty(this, key, {
3285
+ configurable: true,
3286
+ writable: true,
3287
+ enumerable: true,
3288
+ value: bound
3289
+ });
3290
+ return bound;
3291
+ },
3292
+ set(v) {
3293
+ Object.defineProperty(this, key, {
3294
+ configurable: true,
3295
+ writable: true,
3296
+ enumerable: true,
3297
+ value: v
3298
+ });
3299
+ }
3300
+ });
3301
+ }
3302
+ }
3167
3303
  const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3168
3304
  $ZodType.init(inst, def);
3169
3305
  Object.assign(inst["~standard"], {
@@ -3176,23 +3312,6 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3176
3312
  inst.def = def;
3177
3313
  inst.type = def.type;
3178
3314
  Object.defineProperty(inst, "_def", { value: def });
3179
- inst.check = (...checks) => {
3180
- return inst.clone(mergeDefs(def, {
3181
- checks: [
3182
- ...def.checks ?? [],
3183
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
3184
- ]
3185
- }), {
3186
- parent: true
3187
- });
3188
- };
3189
- inst.with = inst.check;
3190
- inst.clone = (def2, params) => clone(inst, def2, params);
3191
- inst.brand = () => inst;
3192
- inst.register = ((reg, meta) => {
3193
- reg.add(inst, meta);
3194
- return inst;
3195
- });
3196
3315
  inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3197
3316
  inst.safeParse = (data, params) => safeParse(inst, data, params);
3198
3317
  inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
@@ -3206,45 +3325,108 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3206
3325
  inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3207
3326
  inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3208
3327
  inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3209
- inst.refine = (check, params) => inst.check(refine(check, params));
3210
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
3211
- inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite(fn));
3212
- inst.optional = () => optional(inst);
3213
- inst.exactOptional = () => exactOptional(inst);
3214
- inst.nullable = () => nullable(inst);
3215
- inst.nullish = () => optional(nullable(inst));
3216
- inst.nonoptional = (params) => nonoptional(inst, params);
3217
- inst.array = () => array(inst);
3218
- inst.or = (arg) => union([inst, arg]);
3219
- inst.and = (arg) => intersection(inst, arg);
3220
- inst.transform = (tx) => pipe(inst, transform(tx));
3221
- inst.default = (def2) => _default(inst, def2);
3222
- inst.prefault = (def2) => prefault(inst, def2);
3223
- inst.catch = (params) => _catch(inst, params);
3224
- inst.pipe = (target) => pipe(inst, target);
3225
- inst.readonly = () => readonly(inst);
3226
- inst.describe = (description) => {
3227
- const cl = inst.clone();
3228
- globalRegistry.add(cl, { description });
3229
- return cl;
3230
- };
3328
+ _installLazyMethods(inst, "ZodType", {
3329
+ check(...chks) {
3330
+ const def2 = this.def;
3331
+ return this.clone(mergeDefs(def2, {
3332
+ checks: [
3333
+ ...def2.checks ?? [],
3334
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
3335
+ ]
3336
+ }), { parent: true });
3337
+ },
3338
+ with(...chks) {
3339
+ return this.check(...chks);
3340
+ },
3341
+ clone(def2, params) {
3342
+ return clone(this, def2, params);
3343
+ },
3344
+ brand() {
3345
+ return this;
3346
+ },
3347
+ register(reg, meta) {
3348
+ reg.add(this, meta);
3349
+ return this;
3350
+ },
3351
+ refine(check, params) {
3352
+ return this.check(refine(check, params));
3353
+ },
3354
+ superRefine(refinement, params) {
3355
+ return this.check(superRefine(refinement, params));
3356
+ },
3357
+ overwrite(fn) {
3358
+ return this.check(/* @__PURE__ */ _overwrite(fn));
3359
+ },
3360
+ optional() {
3361
+ return optional(this);
3362
+ },
3363
+ exactOptional() {
3364
+ return exactOptional(this);
3365
+ },
3366
+ nullable() {
3367
+ return nullable(this);
3368
+ },
3369
+ nullish() {
3370
+ return optional(nullable(this));
3371
+ },
3372
+ nonoptional(params) {
3373
+ return nonoptional(this, params);
3374
+ },
3375
+ array() {
3376
+ return array(this);
3377
+ },
3378
+ or(arg) {
3379
+ return union([this, arg]);
3380
+ },
3381
+ and(arg) {
3382
+ return intersection(this, arg);
3383
+ },
3384
+ transform(tx) {
3385
+ return pipe(this, transform(tx));
3386
+ },
3387
+ default(d) {
3388
+ return _default(this, d);
3389
+ },
3390
+ prefault(d) {
3391
+ return prefault(this, d);
3392
+ },
3393
+ catch(params) {
3394
+ return _catch(this, params);
3395
+ },
3396
+ pipe(target) {
3397
+ return pipe(this, target);
3398
+ },
3399
+ readonly() {
3400
+ return readonly(this);
3401
+ },
3402
+ describe(description) {
3403
+ const cl = this.clone();
3404
+ globalRegistry.add(cl, { description });
3405
+ return cl;
3406
+ },
3407
+ meta(...args) {
3408
+ if (args.length === 0)
3409
+ return globalRegistry.get(this);
3410
+ const cl = this.clone();
3411
+ globalRegistry.add(cl, args[0]);
3412
+ return cl;
3413
+ },
3414
+ isOptional() {
3415
+ return this.safeParse(void 0).success;
3416
+ },
3417
+ isNullable() {
3418
+ return this.safeParse(null).success;
3419
+ },
3420
+ apply(fn) {
3421
+ return fn(this);
3422
+ }
3423
+ });
3231
3424
  Object.defineProperty(inst, "description", {
3232
3425
  get() {
3233
3426
  return globalRegistry.get(inst)?.description;
3234
3427
  },
3235
3428
  configurable: true
3236
3429
  });
3237
- inst.meta = (...args) => {
3238
- if (args.length === 0) {
3239
- return globalRegistry.get(inst);
3240
- }
3241
- const cl = inst.clone();
3242
- globalRegistry.add(cl, args[0]);
3243
- return cl;
3244
- };
3245
- inst.isOptional = () => inst.safeParse(void 0).success;
3246
- inst.isNullable = () => inst.safeParse(null).success;
3247
- inst.apply = (fn) => fn(inst);
3248
3430
  return inst;
3249
3431
  });
3250
3432
  const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
@@ -3255,21 +3437,53 @@ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
3255
3437
  inst.format = bag.format ?? null;
3256
3438
  inst.minLength = bag.minimum ?? null;
3257
3439
  inst.maxLength = bag.maximum ?? null;
3258
- inst.regex = (...args) => inst.check(/* @__PURE__ */ _regex(...args));
3259
- inst.includes = (...args) => inst.check(/* @__PURE__ */ _includes(...args));
3260
- inst.startsWith = (...args) => inst.check(/* @__PURE__ */ _startsWith(...args));
3261
- inst.endsWith = (...args) => inst.check(/* @__PURE__ */ _endsWith(...args));
3262
- inst.min = (...args) => inst.check(/* @__PURE__ */ _minLength(...args));
3263
- inst.max = (...args) => inst.check(/* @__PURE__ */ _maxLength(...args));
3264
- inst.length = (...args) => inst.check(/* @__PURE__ */ _length(...args));
3265
- inst.nonempty = (...args) => inst.check(/* @__PURE__ */ _minLength(1, ...args));
3266
- inst.lowercase = (params) => inst.check(/* @__PURE__ */ _lowercase(params));
3267
- inst.uppercase = (params) => inst.check(/* @__PURE__ */ _uppercase(params));
3268
- inst.trim = () => inst.check(/* @__PURE__ */ _trim());
3269
- inst.normalize = (...args) => inst.check(/* @__PURE__ */ _normalize(...args));
3270
- inst.toLowerCase = () => inst.check(/* @__PURE__ */ _toLowerCase());
3271
- inst.toUpperCase = () => inst.check(/* @__PURE__ */ _toUpperCase());
3272
- inst.slugify = () => inst.check(/* @__PURE__ */ _slugify());
3440
+ _installLazyMethods(inst, "_ZodString", {
3441
+ regex(...args) {
3442
+ return this.check(/* @__PURE__ */ _regex(...args));
3443
+ },
3444
+ includes(...args) {
3445
+ return this.check(/* @__PURE__ */ _includes(...args));
3446
+ },
3447
+ startsWith(...args) {
3448
+ return this.check(/* @__PURE__ */ _startsWith(...args));
3449
+ },
3450
+ endsWith(...args) {
3451
+ return this.check(/* @__PURE__ */ _endsWith(...args));
3452
+ },
3453
+ min(...args) {
3454
+ return this.check(/* @__PURE__ */ _minLength(...args));
3455
+ },
3456
+ max(...args) {
3457
+ return this.check(/* @__PURE__ */ _maxLength(...args));
3458
+ },
3459
+ length(...args) {
3460
+ return this.check(/* @__PURE__ */ _length(...args));
3461
+ },
3462
+ nonempty(...args) {
3463
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
3464
+ },
3465
+ lowercase(params) {
3466
+ return this.check(/* @__PURE__ */ _lowercase(params));
3467
+ },
3468
+ uppercase(params) {
3469
+ return this.check(/* @__PURE__ */ _uppercase(params));
3470
+ },
3471
+ trim() {
3472
+ return this.check(/* @__PURE__ */ _trim());
3473
+ },
3474
+ normalize(...args) {
3475
+ return this.check(/* @__PURE__ */ _normalize(...args));
3476
+ },
3477
+ toLowerCase() {
3478
+ return this.check(/* @__PURE__ */ _toLowerCase());
3479
+ },
3480
+ toUpperCase() {
3481
+ return this.check(/* @__PURE__ */ _toUpperCase());
3482
+ },
3483
+ slugify() {
3484
+ return this.check(/* @__PURE__ */ _slugify());
3485
+ }
3486
+ });
3273
3487
  });
3274
3488
  const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
3275
3489
  $ZodString.init(inst, def);
@@ -3414,11 +3628,23 @@ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
3414
3628
  ZodType.init(inst, def);
3415
3629
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3416
3630
  inst.element = def.element;
3417
- inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength(minLength, params));
3418
- inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength(1, params));
3419
- inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength(maxLength, params));
3420
- inst.length = (len, params) => inst.check(/* @__PURE__ */ _length(len, params));
3421
- inst.unwrap = () => inst.element;
3631
+ _installLazyMethods(inst, "ZodArray", {
3632
+ min(n, params) {
3633
+ return this.check(/* @__PURE__ */ _minLength(n, params));
3634
+ },
3635
+ nonempty(params) {
3636
+ return this.check(/* @__PURE__ */ _minLength(1, params));
3637
+ },
3638
+ max(n, params) {
3639
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
3640
+ },
3641
+ length(n, params) {
3642
+ return this.check(/* @__PURE__ */ _length(n, params));
3643
+ },
3644
+ unwrap() {
3645
+ return this.element;
3646
+ }
3647
+ });
3422
3648
  });
3423
3649
  function array(element, params) {
3424
3650
  return /* @__PURE__ */ _array(ZodArray, element, params);
@@ -3430,23 +3656,47 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
3430
3656
  defineLazy(inst, "shape", () => {
3431
3657
  return def.shape;
3432
3658
  });
3433
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
3434
- inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
3435
- inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
3436
- inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
3437
- inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
3438
- inst.strip = () => inst.clone({ ...inst._zod.def, catchall: void 0 });
3439
- inst.extend = (incoming) => {
3440
- return extend(inst, incoming);
3441
- };
3442
- inst.safeExtend = (incoming) => {
3443
- return safeExtend(inst, incoming);
3444
- };
3445
- inst.merge = (other) => merge(inst, other);
3446
- inst.pick = (mask) => pick(inst, mask);
3447
- inst.omit = (mask) => omit(inst, mask);
3448
- inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
3449
- inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
3659
+ _installLazyMethods(inst, "ZodObject", {
3660
+ keyof() {
3661
+ return _enum(Object.keys(this._zod.def.shape));
3662
+ },
3663
+ catchall(catchall) {
3664
+ return this.clone({ ...this._zod.def, catchall });
3665
+ },
3666
+ passthrough() {
3667
+ return this.clone({ ...this._zod.def, catchall: unknown() });
3668
+ },
3669
+ loose() {
3670
+ return this.clone({ ...this._zod.def, catchall: unknown() });
3671
+ },
3672
+ strict() {
3673
+ return this.clone({ ...this._zod.def, catchall: never() });
3674
+ },
3675
+ strip() {
3676
+ return this.clone({ ...this._zod.def, catchall: void 0 });
3677
+ },
3678
+ extend(incoming) {
3679
+ return extend(this, incoming);
3680
+ },
3681
+ safeExtend(incoming) {
3682
+ return safeExtend(this, incoming);
3683
+ },
3684
+ merge(other) {
3685
+ return merge(this, other);
3686
+ },
3687
+ pick(mask) {
3688
+ return pick(this, mask);
3689
+ },
3690
+ omit(mask) {
3691
+ return omit(this, mask);
3692
+ },
3693
+ partial(...args) {
3694
+ return partial(ZodOptional, this, args[0]);
3695
+ },
3696
+ required(...args) {
3697
+ return required(ZodNonOptional, this, args[0]);
3698
+ }
3699
+ });
3450
3700
  });
3451
3701
  function object(shape, params) {
3452
3702
  const def = {
@@ -3552,10 +3802,12 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
3552
3802
  if (output instanceof Promise) {
3553
3803
  return output.then((output2) => {
3554
3804
  payload.value = output2;
3805
+ payload.fallback = true;
3555
3806
  return payload;
3556
3807
  });
3557
3808
  }
3558
3809
  payload.value = output;
3810
+ payload.fallback = true;
3559
3811
  return payload;
3560
3812
  };
3561
3813
  });
@@ -3694,8 +3946,8 @@ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3694
3946
  function refine(fn, _params = {}) {
3695
3947
  return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
3696
3948
  }
3697
- function superRefine(fn) {
3698
- return /* @__PURE__ */ _superRefine(fn);
3949
+ function superRefine(fn, params) {
3950
+ return /* @__PURE__ */ _superRefine(fn, params);
3699
3951
  }
3700
3952
  export {
3701
3953
  array as a,
@@ -3703,4 +3955,4 @@ export {
3703
3955
  object as o,
3704
3956
  string as s
3705
3957
  };
3706
- //# sourceMappingURL=schemas-Dn3gHDGz.js.map
3958
+ //# sourceMappingURL=schemas-BYptELX5.js.map