@xyo-network/hash 5.0.7 → 5.1.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.
@@ -45,10 +45,10 @@
45
45
  }
46
46
  });
47
47
 
48
- // ../../../../../../node_modules/.store/@xylabs-platform-npm-5.0.10-a512399a0f/package/dist/browser/index-browser.mjs
48
+ // ../../../../../../node_modules/.store/@xylabs-platform-npm-5.0.11-37ea1a9132/package/dist/browser/index-browser.mjs
49
49
  var subtle = globalThis.crypto.subtle;
50
50
 
51
- // ../../../../../../node_modules/.store/@xylabs-threads-npm-5.0.10-51e4c454fa/package/dist/browser/worker/worker.browser.mjs
51
+ // ../../../../../../node_modules/.store/@xylabs-threads-npm-5.0.11-9d8627e89e/package/dist/browser/worker/worker.browser.mjs
52
52
  var import_is_observable_2_1_0 = __toESM(require_package(), 1);
53
53
  var __defProp2 = Object.defineProperty;
54
54
  var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
@@ -49,7 +49,7 @@
49
49
  }
50
50
  });
51
51
 
52
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/core.js
52
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/core.js
53
53
  var NEVER = Object.freeze({
54
54
  status: "aborted"
55
55
  });
@@ -102,6 +102,12 @@
102
102
  super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
103
103
  }
104
104
  };
105
+ var $ZodEncodeError = class extends Error {
106
+ constructor(name) {
107
+ super(`Encountered unidirectional transform during encode: ${name}`);
108
+ this.name = "ZodEncodeError";
109
+ }
110
+ };
105
111
  var globalConfig = {};
106
112
  function config(newConfig) {
107
113
  if (newConfig)
@@ -109,7 +115,7 @@
109
115
  return globalConfig;
110
116
  }
111
117
 
112
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/util.js
118
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/util.js
113
119
  var util_exports = {};
114
120
  __export(util_exports, {
115
121
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -123,6 +129,8 @@
123
129
  assertNever: () => assertNever,
124
130
  assertNotEqual: () => assertNotEqual,
125
131
  assignProp: () => assignProp,
132
+ base64ToUint8Array: () => base64ToUint8Array,
133
+ base64urlToUint8Array: () => base64urlToUint8Array,
126
134
  cached: () => cached,
127
135
  captureStackTrace: () => captureStackTrace,
128
136
  cleanEnum: () => cleanEnum,
@@ -141,6 +149,7 @@
141
149
  getLengthableOrigin: () => getLengthableOrigin,
142
150
  getParsedType: () => getParsedType,
143
151
  getSizableOrigin: () => getSizableOrigin,
152
+ hexToUint8Array: () => hexToUint8Array,
144
153
  isObject: () => isObject,
145
154
  isPlainObject: () => isPlainObject,
146
155
  issue: () => issue,
@@ -162,8 +171,12 @@
162
171
  propertyKeyTypes: () => propertyKeyTypes,
163
172
  randomString: () => randomString,
164
173
  required: () => required,
174
+ safeExtend: () => safeExtend,
165
175
  shallowClone: () => shallowClone,
166
176
  stringifyPrimitive: () => stringifyPrimitive,
177
+ uint8ArrayToBase64: () => uint8ArrayToBase64,
178
+ uint8ArrayToBase64url: () => uint8ArrayToBase64url,
179
+ uint8ArrayToHex: () => uint8ArrayToHex,
167
180
  unwrapMessage: () => unwrapMessage
168
181
  });
169
182
  function assertEqual(val) {
@@ -516,6 +529,11 @@
516
529
  if (!isPlainObject(shape)) {
517
530
  throw new Error("Invalid input to extend: expected a plain object");
518
531
  }
532
+ const checks = schema._zod.def.checks;
533
+ const hasChecks = checks && checks.length > 0;
534
+ if (hasChecks) {
535
+ throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
536
+ }
519
537
  const def = mergeDefs(schema._zod.def, {
520
538
  get shape() {
521
539
  const _shape = { ...schema._zod.def.shape, ...shape };
@@ -526,6 +544,21 @@
526
544
  });
527
545
  return clone(schema, def);
528
546
  }
547
+ function safeExtend(schema, shape) {
548
+ if (!isPlainObject(shape)) {
549
+ throw new Error("Invalid input to safeExtend: expected a plain object");
550
+ }
551
+ const def = {
552
+ ...schema._zod.def,
553
+ get shape() {
554
+ const _shape = { ...schema._zod.def.shape, ...shape };
555
+ assignProp(this, "shape", _shape);
556
+ return _shape;
557
+ },
558
+ checks: schema._zod.def.checks
559
+ };
560
+ return clone(schema, def);
561
+ }
529
562
  function merge(a, b) {
530
563
  const def = mergeDefs(a._zod.def, {
531
564
  get shape() {
@@ -606,6 +639,8 @@
606
639
  return clone(schema, def);
607
640
  }
608
641
  function aborted(x, startIndex = 0) {
642
+ if (x.aborted === true)
643
+ return true;
609
644
  for (let i = startIndex; i < x.issues.length; i++) {
610
645
  if (x.issues[i]?.continue !== true) {
611
646
  return true;
@@ -670,12 +705,49 @@
670
705
  return Number.isNaN(Number.parseInt(k, 10));
671
706
  }).map((el) => el[1]);
672
707
  }
708
+ function base64ToUint8Array(base642) {
709
+ const binaryString = atob(base642);
710
+ const bytes = new Uint8Array(binaryString.length);
711
+ for (let i = 0; i < binaryString.length; i++) {
712
+ bytes[i] = binaryString.charCodeAt(i);
713
+ }
714
+ return bytes;
715
+ }
716
+ function uint8ArrayToBase64(bytes) {
717
+ let binaryString = "";
718
+ for (let i = 0; i < bytes.length; i++) {
719
+ binaryString += String.fromCharCode(bytes[i]);
720
+ }
721
+ return btoa(binaryString);
722
+ }
723
+ function base64urlToUint8Array(base64url2) {
724
+ const base642 = base64url2.replace(/-/g, "+").replace(/_/g, "/");
725
+ const padding = "=".repeat((4 - base642.length % 4) % 4);
726
+ return base64ToUint8Array(base642 + padding);
727
+ }
728
+ function uint8ArrayToBase64url(bytes) {
729
+ return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
730
+ }
731
+ function hexToUint8Array(hex) {
732
+ const cleanHex = hex.replace(/^0x/, "");
733
+ if (cleanHex.length % 2 !== 0) {
734
+ throw new Error("Invalid hex string length");
735
+ }
736
+ const bytes = new Uint8Array(cleanHex.length / 2);
737
+ for (let i = 0; i < cleanHex.length; i += 2) {
738
+ bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
739
+ }
740
+ return bytes;
741
+ }
742
+ function uint8ArrayToHex(bytes) {
743
+ return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
744
+ }
673
745
  var Class = class {
674
746
  constructor(..._args) {
675
747
  }
676
748
  };
677
749
 
678
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/errors.js
750
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/errors.js
679
751
  var initializer = (inst, def) => {
680
752
  inst.name = "$ZodError";
681
753
  Object.defineProperty(inst, "_zod", {
@@ -744,7 +816,7 @@
744
816
  return fieldErrors;
745
817
  }
746
818
 
747
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/parse.js
819
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/parse.js
748
820
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
749
821
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
750
822
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -793,8 +865,36 @@
793
865
  } : { success: true, data: result.value };
794
866
  };
795
867
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
868
+ var _encode = (_Err) => (schema, value, _ctx) => {
869
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
870
+ return _parse(_Err)(schema, value, ctx);
871
+ };
872
+ var _decode = (_Err) => (schema, value, _ctx) => {
873
+ return _parse(_Err)(schema, value, _ctx);
874
+ };
875
+ var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
876
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
877
+ return _parseAsync(_Err)(schema, value, ctx);
878
+ };
879
+ var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
880
+ return _parseAsync(_Err)(schema, value, _ctx);
881
+ };
882
+ var _safeEncode = (_Err) => (schema, value, _ctx) => {
883
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
884
+ return _safeParse(_Err)(schema, value, ctx);
885
+ };
886
+ var _safeDecode = (_Err) => (schema, value, _ctx) => {
887
+ return _safeParse(_Err)(schema, value, _ctx);
888
+ };
889
+ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
890
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
891
+ return _safeParseAsync(_Err)(schema, value, ctx);
892
+ };
893
+ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
894
+ return _safeParseAsync(_Err)(schema, value, _ctx);
895
+ };
796
896
 
797
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/regexes.js
897
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/regexes.js
798
898
  var cuid = /^[cC][^\s-]{8,}$/;
799
899
  var cuid2 = /^[0-9a-z]+$/;
800
900
  var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -805,7 +905,7 @@
805
905
  var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
806
906
  var uuid = (version2) => {
807
907
  if (!version2)
808
- 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)$/;
908
+ 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)$/;
809
909
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
810
910
  };
811
911
  var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
@@ -851,7 +951,7 @@
851
951
  var lowercase = /^[^A-Z]*$/;
852
952
  var uppercase = /^[^a-z]*$/;
853
953
 
854
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/checks.js
954
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/checks.js
855
955
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
856
956
  var _a2;
857
957
  inst._zod ?? (inst._zod = {});
@@ -1237,14 +1337,14 @@
1237
1337
  };
1238
1338
  });
1239
1339
 
1240
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/versions.js
1340
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/versions.js
1241
1341
  var version = {
1242
1342
  major: 4,
1243
- minor: 0,
1244
- patch: 17
1343
+ minor: 1,
1344
+ patch: 5
1245
1345
  };
1246
1346
 
1247
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/schemas.js
1347
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/schemas.js
1248
1348
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1249
1349
  var _a2;
1250
1350
  inst ?? (inst = {});
@@ -1306,7 +1406,32 @@
1306
1406
  }
1307
1407
  return payload;
1308
1408
  };
1409
+ const handleCanaryResult = (canary, payload, ctx) => {
1410
+ if (aborted(canary)) {
1411
+ canary.aborted = true;
1412
+ return canary;
1413
+ }
1414
+ const checkResult = runChecks(payload, checks, ctx);
1415
+ if (checkResult instanceof Promise) {
1416
+ if (ctx.async === false)
1417
+ throw new $ZodAsyncError();
1418
+ return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
1419
+ }
1420
+ return inst._zod.parse(checkResult, ctx);
1421
+ };
1309
1422
  inst._zod.run = (payload, ctx) => {
1423
+ if (ctx.skipChecks) {
1424
+ return inst._zod.parse(payload, ctx);
1425
+ }
1426
+ if (ctx.direction === "backward") {
1427
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
1428
+ if (canary instanceof Promise) {
1429
+ return canary.then((canary2) => {
1430
+ return handleCanaryResult(canary2, payload, ctx);
1431
+ });
1432
+ }
1433
+ return handleCanaryResult(canary, payload, ctx);
1434
+ }
1310
1435
  const result = inst._zod.parse(payload, ctx);
1311
1436
  if (result instanceof Promise) {
1312
1437
  if (ctx.async === false)
@@ -1857,9 +1982,12 @@
1857
1982
  }
1858
1983
  var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1859
1984
  $ZodType.init(inst, def);
1860
- inst._zod.parse = (payload, _ctx) => {
1985
+ inst._zod.parse = (payload, ctx) => {
1986
+ if (ctx.direction === "backward") {
1987
+ throw new $ZodEncodeError(inst.constructor.name);
1988
+ }
1861
1989
  const _out = def.transform(payload.value, payload);
1862
- if (_ctx.async) {
1990
+ if (ctx.async) {
1863
1991
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1864
1992
  return output.then((output2) => {
1865
1993
  payload.value = output2;
@@ -1925,6 +2053,9 @@
1925
2053
  inst._zod.optin = "optional";
1926
2054
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1927
2055
  inst._zod.parse = (payload, ctx) => {
2056
+ if (ctx.direction === "backward") {
2057
+ return def.innerType._zod.run(payload, ctx);
2058
+ }
1928
2059
  if (payload.value === void 0) {
1929
2060
  payload.value = def.defaultValue;
1930
2061
  return payload;
@@ -1947,6 +2078,9 @@
1947
2078
  inst._zod.optin = "optional";
1948
2079
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1949
2080
  inst._zod.parse = (payload, ctx) => {
2081
+ if (ctx.direction === "backward") {
2082
+ return def.innerType._zod.run(payload, ctx);
2083
+ }
1950
2084
  if (payload.value === void 0) {
1951
2085
  payload.value = def.defaultValue;
1952
2086
  }
@@ -1984,6 +2118,9 @@
1984
2118
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1985
2119
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1986
2120
  inst._zod.parse = (payload, ctx) => {
2121
+ if (ctx.direction === "backward") {
2122
+ return def.innerType._zod.run(payload, ctx);
2123
+ }
1987
2124
  const result = def.innerType._zod.run(payload, ctx);
1988
2125
  if (result instanceof Promise) {
1989
2126
  return result.then((result2) => {
@@ -2022,18 +2159,26 @@
2022
2159
  defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2023
2160
  defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2024
2161
  inst._zod.parse = (payload, ctx) => {
2162
+ if (ctx.direction === "backward") {
2163
+ const right = def.out._zod.run(payload, ctx);
2164
+ if (right instanceof Promise) {
2165
+ return right.then((right2) => handlePipeResult(right2, def.in, ctx));
2166
+ }
2167
+ return handlePipeResult(right, def.in, ctx);
2168
+ }
2025
2169
  const left = def.in._zod.run(payload, ctx);
2026
2170
  if (left instanceof Promise) {
2027
- return left.then((left2) => handlePipeResult(left2, def, ctx));
2171
+ return left.then((left2) => handlePipeResult(left2, def.out, ctx));
2028
2172
  }
2029
- return handlePipeResult(left, def, ctx);
2173
+ return handlePipeResult(left, def.out, ctx);
2030
2174
  };
2031
2175
  });
2032
- function handlePipeResult(left, def, ctx) {
2176
+ function handlePipeResult(left, next, ctx) {
2033
2177
  if (left.issues.length) {
2178
+ left.aborted = true;
2034
2179
  return left;
2035
2180
  }
2036
- return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
2181
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
2037
2182
  }
2038
2183
  var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
2039
2184
  $ZodType.init(inst, def);
@@ -2042,6 +2187,9 @@
2042
2187
  defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2043
2188
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2044
2189
  inst._zod.parse = (payload, ctx) => {
2190
+ if (ctx.direction === "backward") {
2191
+ return def.innerType._zod.run(payload, ctx);
2192
+ }
2045
2193
  const result = def.innerType._zod.run(payload, ctx);
2046
2194
  if (result instanceof Promise) {
2047
2195
  return result.then(handleReadonlyResult);
@@ -2087,7 +2235,7 @@
2087
2235
  }
2088
2236
  }
2089
2237
 
2090
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/registries.js
2238
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/registries.js
2091
2239
  var $output = Symbol("ZodOutput");
2092
2240
  var $input = Symbol("ZodInput");
2093
2241
  var $ZodRegistry = class {
@@ -2138,7 +2286,7 @@
2138
2286
  }
2139
2287
  var globalRegistry = /* @__PURE__ */ registry();
2140
2288
 
2141
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/core/api.js
2289
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/core/api.js
2142
2290
  function _string(Class2, params) {
2143
2291
  return new Class2({
2144
2292
  type: "string",
@@ -2577,7 +2725,7 @@
2577
2725
  return ch;
2578
2726
  }
2579
2727
 
2580
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/classic/iso.js
2728
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/classic/iso.js
2581
2729
  var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
2582
2730
  $ZodISODateTime.init(inst, def);
2583
2731
  ZodStringFormat.init(inst, def);
@@ -2607,7 +2755,7 @@
2607
2755
  return _isoDuration(ZodISODuration, params);
2608
2756
  }
2609
2757
 
2610
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/classic/errors.js
2758
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/classic/errors.js
2611
2759
  var initializer2 = (inst, issues) => {
2612
2760
  $ZodError.init(inst, issues);
2613
2761
  inst.name = "ZodError";
@@ -2647,16 +2795,25 @@
2647
2795
  Parent: Error
2648
2796
  });
2649
2797
 
2650
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/classic/parse.js
2651
- var parse = /* @__PURE__ */ _parse(ZodRealError);
2652
- var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
2798
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/classic/parse.js
2799
+ var parse2 = /* @__PURE__ */ _parse(ZodRealError);
2800
+ var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
2653
2801
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
2654
2802
  var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
2803
+ var encode = /* @__PURE__ */ _encode(ZodRealError);
2804
+ var decode = /* @__PURE__ */ _decode(ZodRealError);
2805
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
2806
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
2807
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
2808
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
2809
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
2810
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
2655
2811
 
2656
- // ../../../../../../node_modules/.store/zod-npm-4.0.17-c6c059c49a/package/v4/classic/schemas.js
2812
+ // ../../../../../../node_modules/.store/zod-npm-4.1.5-c7a602f4fa/package/v4/classic/schemas.js
2657
2813
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2658
2814
  $ZodType.init(inst, def);
2659
2815
  inst.def = def;
2816
+ inst.type = def.type;
2660
2817
  Object.defineProperty(inst, "_def", { value: def });
2661
2818
  inst.check = (...checks) => {
2662
2819
  return inst.clone(
@@ -2676,11 +2833,19 @@
2676
2833
  reg.add(inst, meta);
2677
2834
  return inst;
2678
2835
  });
2679
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
2836
+ inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
2680
2837
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
2681
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
2838
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
2682
2839
  inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
2683
2840
  inst.spa = inst.safeParseAsync;
2841
+ inst.encode = (data, params) => encode(inst, data, params);
2842
+ inst.decode = (data, params) => decode(inst, data, params);
2843
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
2844
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
2845
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
2846
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
2847
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
2848
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
2684
2849
  inst.refine = (check, params) => inst.check(refine(check, params));
2685
2850
  inst.superRefine = (refinement) => inst.check(superRefine(refinement));
2686
2851
  inst.overwrite = (fn) => inst.check(_overwrite(fn));
@@ -2955,6 +3120,9 @@
2955
3120
  $ZodTransform.init(inst, def);
2956
3121
  ZodType.init(inst, def);
2957
3122
  inst._zod.parse = (payload, _ctx) => {
3123
+ if (_ctx.direction === "backward") {
3124
+ throw new $ZodEncodeError(inst.constructor.name);
3125
+ }
2958
3126
  payload.addIssue = (issue2) => {
2959
3127
  if (typeof issue2 === "string") {
2960
3128
  payload.issues.push(util_exports.issue(issue2, payload.value, def));
@@ -3097,7 +3265,7 @@
3097
3265
  return _superRefine(fn);
3098
3266
  }
3099
3267
 
3100
- // ../../../../../../node_modules/.store/@xylabs-typeof-npm-5.0.10-96dd02a5f3/package/dist/neutral/index.mjs
3268
+ // ../../../../../../node_modules/.store/@xylabs-typeof-npm-5.0.11-7596523424/package/dist/neutral/index.mjs
3101
3269
  function isUndefined(value) {
3102
3270
  return value === void 0;
3103
3271
  }
@@ -3108,7 +3276,7 @@
3108
3276
  return typeof value === "number";
3109
3277
  }
3110
3278
 
3111
- // ../../../../../../node_modules/.store/@xylabs-hex-npm-5.0.10-6a3860f099/package/dist/neutral/index.mjs
3279
+ // ../../../../../../node_modules/.store/@xylabs-hex-npm-5.0.11-6145371d9c/package/dist/neutral/index.mjs
3112
3280
  var HexRegExMinMax = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
3113
3281
  return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`);
3114
3282
  };
@@ -3263,7 +3431,7 @@
3263
3431
  var BigIntToJsonZod = bigint2().nonnegative().transform((x) => toHex(x));
3264
3432
  var JsonToBigIntZod = string2().transform((x) => toHex(x)).transform((x) => hexToBigInt(x));
3265
3433
 
3266
- // ../../../../../../node_modules/.store/@xylabs-threads-npm-5.0.10-51e4c454fa/package/dist/browser/worker/worker.browser.mjs
3434
+ // ../../../../../../node_modules/.store/@xylabs-threads-npm-5.0.11-9d8627e89e/package/dist/browser/worker/worker.browser.mjs
3267
3435
  var import_is_observable_2_1_0 = __toESM(require_package(), 1);
3268
3436
  var __defProp2 = Object.defineProperty;
3269
3437
  var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/hash",
3
- "version": "5.0.7",
3
+ "version": "5.1.1",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -54,20 +54,20 @@
54
54
  "wasmHashBundle": "esbuild src/worker/wasmHash.ts --bundle --outfile=dist/browser/worker/wasmHash-bundle.mjs --target=chrome120,firefox120,safari14,edge120"
55
55
  },
56
56
  "dependencies": {
57
- "@xylabs/assert": "~5.0.10",
58
- "@xylabs/hex": "~5.0.10",
59
- "@xylabs/object": "~5.0.10",
60
- "@xylabs/platform": "~5.0.10",
61
- "@xylabs/threads": "~5.0.10",
62
- "@xylabs/typeof": "~5.0.10",
63
- "@xyo-network/wasm": "~5.0.7",
57
+ "@xylabs/assert": "~5.0.11",
58
+ "@xylabs/hex": "~5.0.11",
59
+ "@xylabs/object": "~5.0.11",
60
+ "@xylabs/platform": "~5.0.11",
61
+ "@xylabs/threads": "~5.0.11",
62
+ "@xylabs/typeof": "~5.0.11",
63
+ "@xyo-network/wasm": "~5.1.1",
64
64
  "hash-wasm": "~4.12.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@xylabs/delay": "~5.0.10",
68
- "@xylabs/ts-scripts-yarn3": "~7.1.3",
69
- "@xylabs/tsconfig": "~7.1.3",
70
- "@xylabs/vitest-extended": "~5.0.10",
67
+ "@xylabs/delay": "~5.0.11",
68
+ "@xylabs/ts-scripts-yarn3": "~7.1.7",
69
+ "@xylabs/tsconfig": "~7.1.7",
70
+ "@xylabs/vitest-extended": "~5.0.11",
71
71
  "esbuild": "~0.25.9",
72
72
  "publint": "~0.3.12",
73
73
  "typescript": "~5.9.2",