lody 0.72.0 → 0.74.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.
@@ -3,8 +3,8 @@ import { readFile, mkdir, writeFile, rename } from "node:fs/promises";
3
3
  import os__default from "node:os";
4
4
  import path__default from "node:path";
5
5
  import process from "node:process";
6
- const reviewViewerVersion = "0.72.0";
7
- const reviewViewerSha256 = "e395b367a7644fe83bc050d0c646810914a2844824fd2b5d11d24ae4f55b6893";
6
+ const reviewViewerVersion = "0.74.0";
7
+ const reviewViewerSha256 = "1f06e6a56f50a0f2e72ab32443bccf66dc536395d1cdf67dc511161824fcc0b0";
8
8
  const reviewViewerFileName = "standalone.html";
9
9
  const DEFAULT_CDN_BASES = ["https://cdn.jsdelivr.net/npm", "https://unpkg.com"];
10
10
  function cacheDir() {
@@ -1895,6 +1895,60 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1895
1895
  });
1896
1896
  };
1897
1897
  });
1898
+ function handleExclusiveUnionResults(results, final, inst, ctx) {
1899
+ const successes = results.filter((r) => r.issues.length === 0);
1900
+ if (successes.length === 1) {
1901
+ final.value = successes[0].value;
1902
+ return final;
1903
+ }
1904
+ if (successes.length === 0) {
1905
+ final.issues.push({
1906
+ code: "invalid_union",
1907
+ input: final.value,
1908
+ inst,
1909
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1910
+ });
1911
+ } else {
1912
+ final.issues.push({
1913
+ code: "invalid_union",
1914
+ input: final.value,
1915
+ inst,
1916
+ errors: [],
1917
+ inclusive: false
1918
+ });
1919
+ }
1920
+ return final;
1921
+ }
1922
+ const $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => {
1923
+ $ZodUnion.init(inst, def);
1924
+ def.inclusive = false;
1925
+ const single = def.options.length === 1;
1926
+ const first = def.options[0]._zod.run;
1927
+ inst._zod.parse = (payload, ctx) => {
1928
+ if (single) {
1929
+ return first(payload, ctx);
1930
+ }
1931
+ let async = false;
1932
+ const results = [];
1933
+ for (const option of def.options) {
1934
+ const result = option._zod.run({
1935
+ value: payload.value,
1936
+ issues: []
1937
+ }, ctx);
1938
+ if (result instanceof Promise) {
1939
+ results.push(result);
1940
+ async = true;
1941
+ } else {
1942
+ results.push(result);
1943
+ }
1944
+ }
1945
+ if (!async)
1946
+ return handleExclusiveUnionResults(results, payload, inst, ctx);
1947
+ return Promise.all(results).then((results2) => {
1948
+ return handleExclusiveUnionResults(results2, payload, inst, ctx);
1949
+ });
1950
+ };
1951
+ });
1898
1952
  const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
1899
1953
  def.inclusive = false;
1900
1954
  $ZodUnion.init(inst, def);
@@ -4461,6 +4515,20 @@ function union(options, params) {
4461
4515
  ...normalizeParams(params)
4462
4516
  });
4463
4517
  }
4518
+ const ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
4519
+ ZodUnion.init(inst, def);
4520
+ $ZodXor.init(inst, def);
4521
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
4522
+ inst.options = def.options;
4523
+ });
4524
+ function xor(options, params) {
4525
+ return new ZodXor({
4526
+ type: "union",
4527
+ options,
4528
+ inclusive: false,
4529
+ ...normalizeParams(params)
4530
+ });
4531
+ }
4464
4532
  const ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
4465
4533
  ZodUnion.init(inst, def);
4466
4534
  $ZodDiscriminatedUnion.init(inst, def);
@@ -4765,13 +4833,15 @@ function preprocess(fn, schema) {
4765
4833
  }
4766
4834
  export {
4767
4835
  $constructor as $,
4768
- looseObject as A,
4769
- optional as B,
4770
- datetime as C,
4771
- custom as D,
4772
- toJSONSchema as E,
4773
- ZodOptional as F,
4774
- tuple as G,
4836
+ datetime as A,
4837
+ custom as B,
4838
+ toJSONSchema as C,
4839
+ ZodOptional as D,
4840
+ never as E,
4841
+ xor as F,
4842
+ int as G,
4843
+ url as H,
4844
+ tuple as I,
4775
4845
  NEVER as N,
4776
4846
  ZodNumber as Z,
4777
4847
  _coercedNumber as _,
@@ -4782,23 +4852,23 @@ export {
4782
4852
  unknown as e,
4783
4853
  ZodError as f,
4784
4854
  _null as g,
4785
- intersection as h,
4786
- int as i,
4787
- url as j,
4788
- normalizeParams as k,
4855
+ normalizeParams as h,
4856
+ $ZodObject as i,
4857
+ defineLazy as j,
4858
+ $ZodType as k,
4789
4859
  literal as l,
4790
- $ZodObject as m,
4860
+ parse$1 as m,
4791
4861
  number as n,
4792
4862
  object as o,
4793
4863
  preprocess as p,
4794
- defineLazy as q,
4864
+ safeParse$1 as q,
4795
4865
  record as r,
4796
4866
  string as s,
4797
- $ZodType as t,
4867
+ parseAsync$1 as t,
4798
4868
  union as u,
4799
- parse$1 as v,
4800
- safeParse$1 as w,
4801
- parseAsync$1 as x,
4802
- safeParseAsync$1 as y,
4803
- clone as z
4869
+ safeParseAsync$1 as v,
4870
+ clone as w,
4871
+ looseObject as x,
4872
+ intersection as y,
4873
+ optional as z
4804
4874
  };