@jsdev_ninja/core 0.7.63 → 0.8.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.
package/dist/core.es.js CHANGED
@@ -318,7 +318,7 @@ var m;
318
318
  r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
319
319
  })(m || (m = {}));
320
320
  var H, G;
321
- class O {
321
+ class I {
322
322
  constructor(e, t, n, s) {
323
323
  this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
324
324
  }
@@ -326,7 +326,7 @@ class O {
326
326
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
327
327
  }
328
328
  }
329
- const Ie = (r, e) => {
329
+ const Oe = (r, e) => {
330
330
  if (Q(e))
331
331
  return { success: !0, data: e.value };
332
332
  if (!r.common.issues.length)
@@ -416,7 +416,7 @@ class _ {
416
416
  data: e,
417
417
  parsedType: A(e)
418
418
  }, a = this._parseSync({ data: e, path: s.path, parent: s });
419
- return Ie(s, a);
419
+ return Oe(s, a);
420
420
  }
421
421
  async parseAsync(e, t) {
422
422
  const n = await this.safeParseAsync(e, t);
@@ -437,7 +437,7 @@ class _ {
437
437
  data: e,
438
438
  parsedType: A(e)
439
439
  }, s = this._parse({ data: e, path: n.path, parent: n }), a = await (X(s) ? s : Promise.resolve(s));
440
- return Ie(n, a);
440
+ return Oe(n, a);
441
441
  }
442
442
  refine(e, t) {
443
443
  const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
@@ -1454,8 +1454,8 @@ class N extends _ {
1454
1454
  exact: !1,
1455
1455
  message: s.maxLength.message
1456
1456
  }), n.dirty()), t.common.async)
1457
- return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new O(t, i, t.path, o)))).then((i) => k.mergeArray(n, i));
1458
- const a = [...t.data].map((i, o) => s.type._parseSync(new O(t, i, t.path, o)));
1457
+ return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new I(t, i, t.path, o)))).then((i) => k.mergeArray(n, i));
1458
+ const a = [...t.data].map((i, o) => s.type._parseSync(new I(t, i, t.path, o)));
1459
1459
  return k.mergeArray(n, a);
1460
1460
  }
1461
1461
  get element() {
@@ -1505,7 +1505,7 @@ function U(r) {
1505
1505
  } else return r instanceof N ? new N({
1506
1506
  ...r._def,
1507
1507
  type: U(r.element)
1508
- }) : r instanceof E ? E.create(U(r.unwrap())) : r instanceof V ? V.create(U(r.unwrap())) : r instanceof I ? I.create(r.items.map((e) => U(e))) : r;
1508
+ }) : r instanceof E ? E.create(U(r.unwrap())) : r instanceof V ? V.create(U(r.unwrap())) : r instanceof O ? O.create(r.items.map((e) => U(e))) : r;
1509
1509
  }
1510
1510
  class b extends _ {
1511
1511
  constructor() {
@@ -1535,7 +1535,7 @@ class b extends _ {
1535
1535
  const g = a[u], Z = s.data[u];
1536
1536
  f.push({
1537
1537
  key: { status: "valid", value: u },
1538
- value: g._parse(new O(s, Z, s.path, u)),
1538
+ value: g._parse(new I(s, Z, s.path, u)),
1539
1539
  alwaysSet: u in s.data
1540
1540
  });
1541
1541
  }
@@ -1560,7 +1560,7 @@ class b extends _ {
1560
1560
  f.push({
1561
1561
  key: { status: "valid", value: g },
1562
1562
  value: u._parse(
1563
- new O(s, Z, s.path, g)
1563
+ new I(s, Z, s.path, g)
1564
1564
  //, ctx.child(key), value, getParsedType(value)
1565
1565
  ),
1566
1566
  alwaysSet: g in s.data
@@ -1570,10 +1570,10 @@ class b extends _ {
1570
1570
  return s.common.async ? Promise.resolve().then(async () => {
1571
1571
  const u = [];
1572
1572
  for (const g of f) {
1573
- const Z = await g.key, Oe = await g.value;
1573
+ const Z = await g.key, Ie = await g.value;
1574
1574
  u.push({
1575
1575
  key: Z,
1576
- value: Oe,
1576
+ value: Ie,
1577
1577
  alwaysSet: g.alwaysSet
1578
1578
  });
1579
1579
  }
@@ -1994,7 +1994,7 @@ re.create = (r, e, t) => new re({
1994
1994
  typeName: p.ZodIntersection,
1995
1995
  ...v(t)
1996
1996
  });
1997
- class I extends _ {
1997
+ class O extends _ {
1998
1998
  _parse(e) {
1999
1999
  const { status: t, ctx: n } = this._processInputParams(e);
2000
2000
  if (n.parsedType !== h.array)
@@ -2020,7 +2020,7 @@ class I extends _ {
2020
2020
  }), t.dirty());
2021
2021
  const a = [...n.data].map((i, o) => {
2022
2022
  const f = this._def.items[o] || this._def.rest;
2023
- return f ? f._parse(new O(n, i, n.path, o)) : null;
2023
+ return f ? f._parse(new I(n, i, n.path, o)) : null;
2024
2024
  }).filter((i) => !!i);
2025
2025
  return n.common.async ? Promise.all(a).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, a);
2026
2026
  }
@@ -2028,16 +2028,16 @@ class I extends _ {
2028
2028
  return this._def.items;
2029
2029
  }
2030
2030
  rest(e) {
2031
- return new I({
2031
+ return new O({
2032
2032
  ...this._def,
2033
2033
  rest: e
2034
2034
  });
2035
2035
  }
2036
2036
  }
2037
- I.create = (r, e) => {
2037
+ O.create = (r, e) => {
2038
2038
  if (!Array.isArray(r))
2039
2039
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2040
- return new I({
2040
+ return new O({
2041
2041
  items: r,
2042
2042
  typeName: p.ZodTuple,
2043
2043
  rest: null,
@@ -2062,8 +2062,8 @@ class ne extends _ {
2062
2062
  const s = [], a = this._def.keyType, i = this._def.valueType;
2063
2063
  for (const o in n.data)
2064
2064
  s.push({
2065
- key: a._parse(new O(n, o, n.path, o)),
2066
- value: i._parse(new O(n, n.data[o], n.path, o)),
2065
+ key: a._parse(new I(n, o, n.path, o)),
2066
+ value: i._parse(new I(n, n.data[o], n.path, o)),
2067
2067
  alwaysSet: o in n.data
2068
2068
  });
2069
2069
  return n.common.async ? k.mergeObjectAsync(t, s) : k.mergeObjectSync(t, s);
@@ -2101,8 +2101,8 @@ class ge extends _ {
2101
2101
  received: n.parsedType
2102
2102
  }), y;
2103
2103
  const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, f], u) => ({
2104
- key: s._parse(new O(n, o, n.path, [u, "key"])),
2105
- value: a._parse(new O(n, f, n.path, [u, "value"]))
2104
+ key: s._parse(new I(n, o, n.path, [u, "key"])),
2105
+ value: a._parse(new I(n, f, n.path, [u, "value"]))
2106
2106
  }));
2107
2107
  if (n.common.async) {
2108
2108
  const o = /* @__PURE__ */ new Map();
@@ -2168,7 +2168,7 @@ class z extends _ {
2168
2168
  }
2169
2169
  return { status: t.value, value: u };
2170
2170
  }
2171
- const o = [...n.data.values()].map((f, u) => a._parse(new O(n, f, n.path, u)));
2171
+ const o = [...n.data.values()].map((f, u) => a._parse(new I(n, f, n.path, u)));
2172
2172
  return n.common.async ? Promise.all(o).then((f) => i(f)) : i(o);
2173
2173
  }
2174
2174
  min(e, t) {
@@ -2274,7 +2274,7 @@ class W extends _ {
2274
2274
  args(...e) {
2275
2275
  return new W({
2276
2276
  ...this._def,
2277
- args: I.create(e).rest(D.create())
2277
+ args: O.create(e).rest(D.create())
2278
2278
  });
2279
2279
  }
2280
2280
  returns(e) {
@@ -2291,7 +2291,7 @@ class W extends _ {
2291
2291
  }
2292
2292
  static create(e, t, n) {
2293
2293
  return new W({
2294
- args: e || I.create([]).rest(D.create()),
2294
+ args: e || O.create([]).rest(D.create()),
2295
2295
  returns: t || D.create(),
2296
2296
  typeName: p.ZodFunction,
2297
2297
  ...v(n)
@@ -2738,7 +2738,7 @@ var p;
2738
2738
  })(p || (p = {}));
2739
2739
  const lt = (r, e = {
2740
2740
  message: `Input not instance of ${r.name}`
2741
- }) => De((t) => t instanceof r, e), Le = S.create, ze = P.create, ft = ve.create, ht = M.create, Ue = K.create, mt = L.create, pt = pe.create, yt = F.create, gt = ee.create, vt = Y.create, _t = D.create, xt = R.create, bt = ye.create, kt = N.create, wt = b.create, Tt = b.strictCreate, Zt = te.create, St = _e.create, Nt = re.create, Ct = I.create, Et = ne.create, Ot = ge.create, It = z.create, jt = W.create, Rt = se.create, At = ae.create, Pt = $.create, Mt = ie.create, $t = J.create, je = C.create, Vt = E.create, Dt = V.create, Lt = C.createWithPreprocess, zt = ue.create, Ut = () => Le().optional(), Bt = () => ze().optional(), Wt = () => Ue().optional(), qt = {
2741
+ }) => De((t) => t instanceof r, e), Le = S.create, ze = P.create, ft = ve.create, ht = M.create, Ue = K.create, mt = L.create, pt = pe.create, yt = F.create, gt = ee.create, vt = Y.create, _t = D.create, xt = R.create, bt = ye.create, kt = N.create, wt = b.create, Tt = b.strictCreate, Zt = te.create, St = _e.create, Nt = re.create, Ct = O.create, Et = ne.create, It = ge.create, Ot = z.create, jt = W.create, Rt = se.create, At = ae.create, Pt = $.create, Mt = ie.create, $t = J.create, je = C.create, Vt = E.create, Dt = V.create, Lt = C.createWithPreprocess, zt = ue.create, Ut = () => Le().optional(), Bt = () => ze().optional(), Wt = () => Ue().optional(), qt = {
2742
2742
  string: (r) => S.create({ ...r, coerce: !0 }),
2743
2743
  number: (r) => P.create({ ...r, coerce: !0 }),
2744
2744
  boolean: (r) => K.create({
@@ -2791,7 +2791,7 @@ var d = /* @__PURE__ */ Object.freeze({
2791
2791
  ZodUnion: te,
2792
2792
  ZodDiscriminatedUnion: _e,
2793
2793
  ZodIntersection: re,
2794
- ZodTuple: I,
2794
+ ZodTuple: O,
2795
2795
  ZodRecord: ne,
2796
2796
  ZodMap: ge,
2797
2797
  ZodSet: z,
@@ -2833,7 +2833,7 @@ var d = /* @__PURE__ */ Object.freeze({
2833
2833
  intersection: Nt,
2834
2834
  lazy: Rt,
2835
2835
  literal: At,
2836
- map: Ot,
2836
+ map: It,
2837
2837
  nan: ft,
2838
2838
  nativeEnum: Mt,
2839
2839
  never: xt,
@@ -2849,7 +2849,7 @@ var d = /* @__PURE__ */ Object.freeze({
2849
2849
  preprocess: Lt,
2850
2850
  promise: $t,
2851
2851
  record: Et,
2852
- set: It,
2852
+ set: Ot,
2853
2853
  strictObject: Tt,
2854
2854
  string: Le,
2855
2855
  symbol: pt,
@@ -2864,10 +2864,61 @@ var d = /* @__PURE__ */ Object.freeze({
2864
2864
  quotelessJson: qe,
2865
2865
  ZodError: T
2866
2866
  });
2867
+ const Be = d.object({
2868
+ country: d.string(),
2869
+ city: d.string(),
2870
+ street: d.string(),
2871
+ streetNumber: d.string(),
2872
+ floor: d.string(),
2873
+ apartmentEnterNumber: d.string(),
2874
+ apartmentNumber: d.string()
2875
+ }), Jt = d.object({
2876
+ type: d.literal("Profile"),
2877
+ id: d.string(),
2878
+ companyId: d.string(),
2879
+ storeId: d.string(),
2880
+ tenantId: d.string(),
2881
+ clientType: d.enum(["user", "company"]),
2882
+ displayName: d.string().min(1),
2883
+ email: d.string().email(),
2884
+ phoneNumber: d.object({
2885
+ code: d.string(),
2886
+ number: d.string()
2887
+ }),
2888
+ address: Be,
2889
+ isAnonymous: d.boolean(),
2890
+ createdDate: d.number(),
2891
+ lastActivityDate: d.number()
2892
+ });
2893
+ function Ht() {
2894
+ return {
2895
+ type: "Profile",
2896
+ id: "",
2897
+ companyId: "",
2898
+ storeId: "",
2899
+ tenantId: "",
2900
+ clientType: "user",
2901
+ displayName: "",
2902
+ email: "",
2903
+ phoneNumber: { code: "+972", number: "" },
2904
+ address: {
2905
+ country: "",
2906
+ city: "",
2907
+ street: "",
2908
+ streetNumber: "",
2909
+ floor: "",
2910
+ apartmentEnterNumber: "",
2911
+ apartmentNumber: ""
2912
+ },
2913
+ createdDate: 0,
2914
+ lastActivityDate: 0,
2915
+ isAnonymous: !0
2916
+ };
2917
+ }
2867
2918
  const le = d.object({
2868
2919
  lang: d.string().min(1),
2869
2920
  value: d.string().min(1)
2870
- }), Be = d.object({
2921
+ }), We = d.object({
2871
2922
  id: d.string().min(1),
2872
2923
  companyId: d.string().min(1),
2873
2924
  storeId: d.string().min(1),
@@ -2875,9 +2926,9 @@ const le = d.object({
2875
2926
  tag: d.string().min(1),
2876
2927
  locales: d.array(le),
2877
2928
  depth: d.number()
2878
- }), Ee = Be.extend({
2929
+ }), Ee = We.extend({
2879
2930
  children: d.lazy(() => Ee.array())
2880
- }), Ht = Be.extend({
2931
+ }), Gt = We.extend({
2881
2932
  index: d.number(),
2882
2933
  depth: d.number(),
2883
2934
  collapsed: d.boolean().optional(),
@@ -2931,66 +2982,15 @@ const le = d.object({
2931
2982
  lvl4: d.array(d.string())
2932
2983
  }),
2933
2984
  categoryNames: d.array(d.string())
2934
- }), Gt = xe.omit({
2985
+ }), Qt = xe.omit({
2935
2986
  id: !0,
2936
2987
  categories: !0,
2937
2988
  images: !0
2938
2989
  }).extend({
2939
2990
  image: d.instanceof(File).optional()
2940
- }), Qt = xe.extend({
2991
+ }), Xt = xe.extend({
2941
2992
  image: d.instanceof(File).optional()
2942
- }), We = d.object({
2943
- country: d.string(),
2944
- city: d.string(),
2945
- street: d.string(),
2946
- streetNumber: d.string(),
2947
- floor: d.string(),
2948
- apartmentEnterNumber: d.string(),
2949
- apartmentNumber: d.string()
2950
- }), Jt = d.object({
2951
- type: d.literal("Profile"),
2952
- id: d.string(),
2953
- companyId: d.string(),
2954
- storeId: d.string(),
2955
- tenantId: d.string(),
2956
- clientType: d.enum(["user", "company"]),
2957
- displayName: d.string().min(1),
2958
- email: d.string().email(),
2959
- phoneNumber: d.object({
2960
- code: d.string(),
2961
- number: d.string()
2962
- }),
2963
- address: We,
2964
- isAnonymous: d.boolean(),
2965
- createdDate: d.number(),
2966
- lastActivityDate: d.number()
2967
- });
2968
- function Xt() {
2969
- return {
2970
- type: "Profile",
2971
- id: "",
2972
- companyId: "",
2973
- storeId: "",
2974
- tenantId: "",
2975
- clientType: "user",
2976
- displayName: "",
2977
- email: "",
2978
- phoneNumber: { code: "+972", number: "" },
2979
- address: {
2980
- country: "",
2981
- city: "",
2982
- street: "",
2983
- streetNumber: "",
2984
- floor: "",
2985
- apartmentEnterNumber: "",
2986
- apartmentNumber: ""
2987
- },
2988
- createdDate: 0,
2989
- lastActivityDate: 0,
2990
- isAnonymous: !0
2991
- };
2992
- }
2993
- const Kt = d.object({
2993
+ }), Kt = d.object({
2994
2994
  type: d.literal("Order"),
2995
2995
  id: d.string(),
2996
2996
  companyId: d.string(),
@@ -3007,8 +3007,15 @@ const Kt = d.object({
3007
3007
  date: d.number(),
3008
3008
  deliveryDate: d.number().optional(),
3009
3009
  client: Jt,
3010
- address: We
3010
+ address: Be
3011
3011
  }), Ft = d.object({
3012
+ type: d.literal("FavoriteProduct"),
3013
+ id: d.string().uuid(),
3014
+ companyId: d.string().uuid(),
3015
+ storeId: d.string().uuid(),
3016
+ userId: d.string().uuid(),
3017
+ productId: d.string().uuid()
3018
+ }), er = d.object({
3012
3019
  type: d.literal("Cart"),
3013
3020
  id: d.string().uuid(),
3014
3021
  companyId: d.string().uuid(),
@@ -3023,15 +3030,16 @@ const Kt = d.object({
3023
3030
  )
3024
3031
  });
3025
3032
  export {
3026
- Be as BaseCategorySchema,
3027
- Ft as CartSchema,
3033
+ We as BaseCategorySchema,
3034
+ er as CartSchema,
3028
3035
  Ee as CategorySchema,
3029
- Qt as EditProductSchema,
3030
- Gt as NewProductSchema,
3036
+ Xt as EditProductSchema,
3037
+ Ft as FavoriteProductSchema,
3038
+ Qt as NewProductSchema,
3031
3039
  Kt as OrderSchema,
3032
3040
  xe as ProductSchema,
3033
3041
  Jt as ProfileSchema,
3034
- Ht as TFlattenCategorySchema,
3035
- Xt as createEmptyProfile
3042
+ Gt as TFlattenCategorySchema,
3043
+ Ht as createEmptyProfile
3036
3044
  };
3037
3045
  //# sourceMappingURL=core.es.js.map