@stoker-platform/node-client 0.5.96 → 0.5.98
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/bundle.cjs +5 -5
- package/dist/bundle.js +114 -106
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -479,9 +479,9 @@ const Qn = (t) => !!t && !Array.isArray(t), an = (t, e) => t.access ? Qn(t.acces
|
|
|
479
479
|
}
|
|
480
480
|
if (!p)
|
|
481
481
|
throw new Error("PERMISSION_DENIED");
|
|
482
|
-
},
|
|
482
|
+
}, Re = (t) => t && (t._methodName === "deleteField" || t.constructor.name === "DeleteTransform"), Qe = (t) => {
|
|
483
483
|
for (const e in t)
|
|
484
|
-
Object.prototype.hasOwnProperty.call(t, e) && (
|
|
484
|
+
Object.prototype.hasOwnProperty.call(t, e) && (Re(t[e]) ? delete t[e] : typeof t[e] == "object" && t[e] !== null && Qe(t[e]));
|
|
485
485
|
}, yr = (t, e, n, s, r, i, o, a, l, c, d) => {
|
|
486
486
|
const { labels: p, fields: u } = s, f = o?.collections?.[p.collection], g = { ...e, ...t };
|
|
487
487
|
Qe(g);
|
|
@@ -902,7 +902,7 @@ const Js = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
902
902
|
s.forEach((i) => {
|
|
903
903
|
if (X(i))
|
|
904
904
|
if (e[i.name]) {
|
|
905
|
-
if (
|
|
905
|
+
if (Re(e[i.name]))
|
|
906
906
|
e[`${i.name}_Array`] = e[i.name];
|
|
907
907
|
else if (Object.keys(e[i.name]).forEach((o) => {
|
|
908
908
|
const a = e[i.name][o];
|
|
@@ -918,7 +918,7 @@ const Js = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
918
918
|
delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
|
|
919
919
|
}), wt(t, s).forEach((i) => {
|
|
920
920
|
if (e[i.name])
|
|
921
|
-
if (
|
|
921
|
+
if (Re(e[i.name]))
|
|
922
922
|
e[`${i.name}_Single`] = e[i.name];
|
|
923
923
|
else {
|
|
924
924
|
const o = e[`${i.name}_Array`]?.[0];
|
|
@@ -1209,7 +1209,7 @@ function P(t, e) {
|
|
|
1209
1209
|
});
|
|
1210
1210
|
t.common.issues.push(s);
|
|
1211
1211
|
}
|
|
1212
|
-
class
|
|
1212
|
+
class Se {
|
|
1213
1213
|
constructor() {
|
|
1214
1214
|
this.value = "valid";
|
|
1215
1215
|
}
|
|
@@ -1237,7 +1237,7 @@ class Re {
|
|
|
1237
1237
|
value: o
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
|
-
return
|
|
1240
|
+
return Se.mergeObjectSync(e, s);
|
|
1241
1241
|
}
|
|
1242
1242
|
static mergeObjectSync(e, n) {
|
|
1243
1243
|
const s = {};
|
|
@@ -1310,7 +1310,7 @@ class te {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
_processInputParams(e) {
|
|
1312
1312
|
return {
|
|
1313
|
-
status: new
|
|
1313
|
+
status: new Se(),
|
|
1314
1314
|
ctx: {
|
|
1315
1315
|
common: e.parent.common,
|
|
1316
1316
|
data: e.data,
|
|
@@ -1555,7 +1555,7 @@ class Ke extends te {
|
|
|
1555
1555
|
received: i.parsedType
|
|
1556
1556
|
}), J;
|
|
1557
1557
|
}
|
|
1558
|
-
const s = new
|
|
1558
|
+
const s = new Se();
|
|
1559
1559
|
let r;
|
|
1560
1560
|
for (const i of this._def.checks)
|
|
1561
1561
|
if (i.kind === "min")
|
|
@@ -1946,7 +1946,7 @@ class Mt extends te {
|
|
|
1946
1946
|
}), J;
|
|
1947
1947
|
}
|
|
1948
1948
|
let s;
|
|
1949
|
-
const r = new
|
|
1949
|
+
const r = new Se();
|
|
1950
1950
|
for (const i of this._def.checks)
|
|
1951
1951
|
i.kind === "int" ? se.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), P(s, {
|
|
1952
1952
|
code: A.invalid_type,
|
|
@@ -2118,7 +2118,7 @@ class ln extends te {
|
|
|
2118
2118
|
if (this._getType(e) !== W.bigint)
|
|
2119
2119
|
return this._getInvalidInput(e);
|
|
2120
2120
|
let s;
|
|
2121
|
-
const r = new
|
|
2121
|
+
const r = new Se();
|
|
2122
2122
|
for (const i of this._def.checks)
|
|
2123
2123
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), P(s, {
|
|
2124
2124
|
code: A.too_small,
|
|
@@ -2271,7 +2271,7 @@ class Ln extends te {
|
|
|
2271
2271
|
code: A.invalid_date
|
|
2272
2272
|
}), J;
|
|
2273
2273
|
}
|
|
2274
|
-
const s = new
|
|
2274
|
+
const s = new Se();
|
|
2275
2275
|
let r;
|
|
2276
2276
|
for (const i of this._def.checks)
|
|
2277
2277
|
i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), P(r, {
|
|
@@ -2475,9 +2475,9 @@ class ze extends te {
|
|
|
2475
2475
|
exact: !1,
|
|
2476
2476
|
message: r.maxLength.message
|
|
2477
2477
|
}), s.dirty()), n.common.async)
|
|
2478
|
-
return Promise.all([...n.data].map((o, a) => r.type._parseAsync(new He(n, o, n.path, a)))).then((o) =>
|
|
2478
|
+
return Promise.all([...n.data].map((o, a) => r.type._parseAsync(new He(n, o, n.path, a)))).then((o) => Se.mergeArray(s, o));
|
|
2479
2479
|
const i = [...n.data].map((o, a) => r.type._parseSync(new He(n, o, n.path, a)));
|
|
2480
|
-
return
|
|
2480
|
+
return Se.mergeArray(s, i);
|
|
2481
2481
|
}
|
|
2482
2482
|
get element() {
|
|
2483
2483
|
return this._def.type;
|
|
@@ -2599,7 +2599,7 @@ class fe extends te {
|
|
|
2599
2599
|
});
|
|
2600
2600
|
}
|
|
2601
2601
|
return c;
|
|
2602
|
-
}).then((c) =>
|
|
2602
|
+
}).then((c) => Se.mergeObjectSync(s, c)) : Se.mergeObjectSync(s, l);
|
|
2603
2603
|
}
|
|
2604
2604
|
get shape() {
|
|
2605
2605
|
return this._def.shape();
|
|
@@ -2980,7 +2980,7 @@ class Ot extends te {
|
|
|
2980
2980
|
const l = this._def.items[a] || this._def.rest;
|
|
2981
2981
|
return l ? l._parse(new He(s, o, s.path, a)) : null;
|
|
2982
2982
|
}).filter((o) => !!o);
|
|
2983
|
-
return s.common.async ? Promise.all(i).then((o) =>
|
|
2983
|
+
return s.common.async ? Promise.all(i).then((o) => Se.mergeArray(n, o)) : Se.mergeArray(n, i);
|
|
2984
2984
|
}
|
|
2985
2985
|
get items() {
|
|
2986
2986
|
return this._def.items;
|
|
@@ -3024,7 +3024,7 @@ class Wn extends te {
|
|
|
3024
3024
|
value: o._parse(new He(s, s.data[a], s.path, a)),
|
|
3025
3025
|
alwaysSet: a in s.data
|
|
3026
3026
|
});
|
|
3027
|
-
return s.common.async ?
|
|
3027
|
+
return s.common.async ? Se.mergeObjectAsync(n, r) : Se.mergeObjectSync(n, r);
|
|
3028
3028
|
}
|
|
3029
3029
|
get element() {
|
|
3030
3030
|
return this._def.valueType;
|
|
@@ -3575,25 +3575,25 @@ var Y;
|
|
|
3575
3575
|
(function(t) {
|
|
3576
3576
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3577
3577
|
})(Y || (Y = {}));
|
|
3578
|
-
const Ie = Ke.create, Et = Mt.create, rn = Rs.create, cs = Ts.create,
|
|
3578
|
+
const Ie = Ke.create, Et = Mt.create, rn = Rs.create, cs = Ts.create, ve = Ss.create;
|
|
3579
3579
|
ft.create;
|
|
3580
|
-
const Rt = ze.create, qe = fe.create,
|
|
3580
|
+
const Rt = ze.create, qe = fe.create, Oe = Vn.create;
|
|
3581
3581
|
Un.create;
|
|
3582
3582
|
Ot.create;
|
|
3583
|
-
const hn = Wn.create,
|
|
3583
|
+
const hn = Wn.create, Ee = xs.create, Zn = Pt.create;
|
|
3584
3584
|
jn.create;
|
|
3585
3585
|
ct.create;
|
|
3586
3586
|
Vt.create;
|
|
3587
|
-
const In = () =>
|
|
3587
|
+
const In = () => ve().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
|
|
3588
3588
|
message: "Value is not a valid timestamp"
|
|
3589
|
-
}), xr = () =>
|
|
3589
|
+
}), xr = () => ve().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
|
|
3590
3590
|
message: "Value is not a valid server timestamp"
|
|
3591
3591
|
}), Ii = (t, e, n) => {
|
|
3592
3592
|
const s = {};
|
|
3593
3593
|
if (t.includeFields) {
|
|
3594
3594
|
const i = e.collections[t.collection];
|
|
3595
3595
|
if (!i)
|
|
3596
|
-
return hn(
|
|
3596
|
+
return hn(ve());
|
|
3597
3597
|
t.includeFields.forEach((o) => {
|
|
3598
3598
|
const a = i.fields.find((c) => c.name === o);
|
|
3599
3599
|
if (!a)
|
|
@@ -3610,14 +3610,14 @@ const In = () => Ee().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3610
3610
|
let n = hn(Ii(t, e));
|
|
3611
3611
|
return t.required || (n = n.optional()), n;
|
|
3612
3612
|
}, Ya = (t) => {
|
|
3613
|
-
let e = Rt(
|
|
3613
|
+
let e = Rt(Oe([Ie().length(20), Ie().length(28)]));
|
|
3614
3614
|
return ["OneToOne", "OneToMany"].includes(t.type) ? e = e.max(1) : (t.min && (e = e.min(t.min)), t.max && (e = e.max(t.max)), t.length && (e = e.length(t.length))), t.required ? e = e.nonempty() : e = e.optional(), e;
|
|
3615
3615
|
}, zn = (t, e, n) => {
|
|
3616
3616
|
const { softDelete: s } = t, r = s?.timestampField;
|
|
3617
3617
|
let i;
|
|
3618
3618
|
switch (e.type) {
|
|
3619
3619
|
case "String":
|
|
3620
|
-
if (i = Ie(), e.length && (i = i.length(e.length)), e.minlength && (i = i.min(e.minlength)), e.maxlength && (i = i.max(e.maxlength)), e.email && (i = i.email()), e.uuid && (i = i.uuid()), e.url && (i = i.url()), e.emoji && (i = i.emoji()), e.ip && (i = i.ip()), e.pattern && (i = i.regex(new RegExp(e.pattern))
|
|
3620
|
+
if (i = Ie(), e.length && (i = i.length(e.length)), e.minlength && (i = i.min(e.minlength)), e.maxlength && (i = i.max(e.maxlength)), e.email && (i = i.email()), e.uuid && (i = i.uuid()), e.url && (i = i.url()), e.emoji && (i = i.emoji()), e.ip && (i = i.ip()), n && (i = i.toLowerCase()), e.pattern && (i = Oe([i.regex(new RegExp(e.pattern)), Ee("")])), e.values)
|
|
3621
3621
|
if (n) {
|
|
3622
3622
|
const o = e.values.map((a) => a.toLowerCase());
|
|
3623
3623
|
i = Zn(o);
|
|
@@ -3628,14 +3628,14 @@ const In = () => Ee().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3628
3628
|
i = rn();
|
|
3629
3629
|
break;
|
|
3630
3630
|
case "Number":
|
|
3631
|
-
e.autoIncrement ? i =
|
|
3631
|
+
e.autoIncrement ? i = Oe([Ee("Pending"), Et().int()]) : (i = Et(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
|
|
3632
3632
|
message: `Value must have ${e.decimal} or fewer decimal places`
|
|
3633
3633
|
}) : i = i.int(), e.values && (i = i.refine((o) => e.values?.includes(o), {
|
|
3634
3634
|
message: "Value is not an allowed value"
|
|
3635
3635
|
})));
|
|
3636
3636
|
break;
|
|
3637
3637
|
case "Timestamp":
|
|
3638
|
-
e.name === r ? i =
|
|
3638
|
+
e.name === r ? i = ve().refine((o) => o && (o._methodName === "serverTimestamp" || o.constructor.name === "ServerTimestampTransform" || o.seconds !== void 0 && o.nanoseconds !== void 0 || o._seconds !== void 0 && o._nanoseconds !== void 0), {
|
|
3639
3639
|
message: "Value is not a valid timestamp"
|
|
3640
3640
|
}) : (i = In(), e.min && (i = i.refine((o) => o.toMillis() >= e.min, {
|
|
3641
3641
|
message: `Value is less than the minimum allowed value of ${e.min}`
|
|
@@ -3644,7 +3644,7 @@ const In = () => Ee().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3644
3644
|
})));
|
|
3645
3645
|
break;
|
|
3646
3646
|
case "Array":
|
|
3647
|
-
i = Rt(
|
|
3647
|
+
i = Rt(ve()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
|
|
3648
3648
|
let a = !0;
|
|
3649
3649
|
return o.forEach((l) => {
|
|
3650
3650
|
e.values && !e.values.includes(l) && (a = !1);
|
|
@@ -3652,12 +3652,12 @@ const In = () => Ee().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3652
3652
|
}, { message: "Value is not an allowed value" }));
|
|
3653
3653
|
break;
|
|
3654
3654
|
case "Map":
|
|
3655
|
-
i = hn(
|
|
3655
|
+
i = hn(ve()), e.required && (i = i.refine((o) => o && typeof o == "object" && Object.keys(o).length > 0, {
|
|
3656
3656
|
message: "Value must have at least one object property"
|
|
3657
3657
|
}));
|
|
3658
3658
|
break;
|
|
3659
3659
|
case "Embedding":
|
|
3660
|
-
i =
|
|
3660
|
+
i = ve();
|
|
3661
3661
|
break;
|
|
3662
3662
|
}
|
|
3663
3663
|
return !X(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
@@ -3667,12 +3667,12 @@ const In = () => Ee().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3667
3667
|
Last_Write_App: Ie(),
|
|
3668
3668
|
Last_Write_At: In(),
|
|
3669
3669
|
Last_Save_At: xr(),
|
|
3670
|
-
Last_Write_By:
|
|
3670
|
+
Last_Write_By: Oe([Ie().length(28), Ee("System")]),
|
|
3671
3671
|
Last_Write_Connection_Status: Zn(["Online", "Offline"]),
|
|
3672
3672
|
Last_Write_Version: Et().int(),
|
|
3673
3673
|
id: Ie().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
|
|
3674
3674
|
Created_At: In(),
|
|
3675
|
-
Created_By:
|
|
3675
|
+
Created_By: Oe([Ie().length(28), Ee("System")])
|
|
3676
3676
|
};
|
|
3677
3677
|
t === "create" && (s.Saved_At = xr()), t === "update" && (s.Saved_At = In(), s.Collection_Path = s.Collection_Path.optional(), s.id = s.id.optional(), s.Created_At = s.Created_At.optional(), s.Saved_At = s.Saved_At.optional(), s.Created_By = s.Created_By.optional());
|
|
3678
3678
|
const r = wt(e, e.fields), i = Array.from(r).map((l) => l.name);
|
|
@@ -3714,7 +3714,7 @@ class xi extends Tt {
|
|
|
3714
3714
|
super(`Invalid unit ${e}`);
|
|
3715
3715
|
}
|
|
3716
3716
|
}
|
|
3717
|
-
class
|
|
3717
|
+
class ke extends Tt {
|
|
3718
3718
|
}
|
|
3719
3719
|
class rt extends Tt {
|
|
3720
3720
|
constructor() {
|
|
@@ -4435,13 +4435,13 @@ class ie {
|
|
|
4435
4435
|
}
|
|
4436
4436
|
}
|
|
4437
4437
|
let fs = null;
|
|
4438
|
-
class
|
|
4438
|
+
class Te extends mn {
|
|
4439
4439
|
/**
|
|
4440
4440
|
* Get a singleton instance of UTC
|
|
4441
4441
|
* @return {FixedOffsetZone}
|
|
4442
4442
|
*/
|
|
4443
4443
|
static get utcInstance() {
|
|
4444
|
-
return fs === null && (fs = new
|
|
4444
|
+
return fs === null && (fs = new Te(0)), fs;
|
|
4445
4445
|
}
|
|
4446
4446
|
/**
|
|
4447
4447
|
* Get an instance with a specified offset
|
|
@@ -4449,7 +4449,7 @@ class be extends mn {
|
|
|
4449
4449
|
* @return {FixedOffsetZone}
|
|
4450
4450
|
*/
|
|
4451
4451
|
static instance(e) {
|
|
4452
|
-
return e === 0 ?
|
|
4452
|
+
return e === 0 ? Te.utcInstance : new Te(e);
|
|
4453
4453
|
}
|
|
4454
4454
|
/**
|
|
4455
4455
|
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
|
|
@@ -4463,7 +4463,7 @@ class be extends mn {
|
|
|
4463
4463
|
if (e) {
|
|
4464
4464
|
const n = e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
|
|
4465
4465
|
if (n)
|
|
4466
|
-
return new
|
|
4466
|
+
return new Te(ss(n[1], n[2]));
|
|
4467
4467
|
}
|
|
4468
4468
|
return null;
|
|
4469
4469
|
}
|
|
@@ -4598,8 +4598,8 @@ function at(t, e) {
|
|
|
4598
4598
|
return t;
|
|
4599
4599
|
if (Rl(t)) {
|
|
4600
4600
|
const n = t.toLowerCase();
|
|
4601
|
-
return n === "default" ? e : n === "local" || n === "system" ? es.instance : n === "utc" || n === "gmt" ?
|
|
4602
|
-
} else return ut(t) ?
|
|
4601
|
+
return n === "default" ? e : n === "local" || n === "system" ? es.instance : n === "utc" || n === "gmt" ? Te.utcInstance : Te.parseSpecifier(n) || tt.create(t);
|
|
4602
|
+
} else return ut(t) ? Te.instance(t) : typeof t == "object" && "offset" in t && typeof t.offset == "function" ? t : new _l(t);
|
|
4603
4603
|
}
|
|
4604
4604
|
const Ks = {
|
|
4605
4605
|
arab: "[٠-٩]",
|
|
@@ -4946,9 +4946,9 @@ function Ws(t) {
|
|
|
4946
4946
|
if (t == null)
|
|
4947
4947
|
return null;
|
|
4948
4948
|
if (typeof t != "object")
|
|
4949
|
-
throw new
|
|
4949
|
+
throw new ke("Week settings must be an object");
|
|
4950
4950
|
if (!$e(t.firstDay, 1, 7) || !$e(t.minimalDays, 1, 7) || !Array.isArray(t.weekend) || t.weekend.some((e) => !$e(e, 1, 7)))
|
|
4951
|
-
throw new
|
|
4951
|
+
throw new ke("Invalid week settings");
|
|
4952
4952
|
return {
|
|
4953
4953
|
firstDay: t.firstDay,
|
|
4954
4954
|
minimalDays: t.minimalDays,
|
|
@@ -5051,7 +5051,7 @@ function ss(t, e) {
|
|
|
5051
5051
|
function oo(t) {
|
|
5052
5052
|
const e = Number(t);
|
|
5053
5053
|
if (typeof t == "boolean" || t === "" || !Number.isFinite(e))
|
|
5054
|
-
throw new
|
|
5054
|
+
throw new ke(`Invalid unit value ${t}`);
|
|
5055
5055
|
return e;
|
|
5056
5056
|
}
|
|
5057
5057
|
function Gn(t, e) {
|
|
@@ -5224,9 +5224,9 @@ const Wl = {
|
|
|
5224
5224
|
FFF: Bi,
|
|
5225
5225
|
FFFF: Gi
|
|
5226
5226
|
};
|
|
5227
|
-
class
|
|
5227
|
+
class be {
|
|
5228
5228
|
static create(e, n = {}) {
|
|
5229
|
-
return new
|
|
5229
|
+
return new be(e, n);
|
|
5230
5230
|
}
|
|
5231
5231
|
static parseFormat(e) {
|
|
5232
5232
|
let n = null, s = "", r = !1;
|
|
@@ -5275,7 +5275,7 @@ class Oe {
|
|
|
5275
5275
|
g ? { weekday: f } : { weekday: f, month: "long", day: "numeric" },
|
|
5276
5276
|
"weekday"
|
|
5277
5277
|
), d = (f) => {
|
|
5278
|
-
const g =
|
|
5278
|
+
const g = be.macroTokenToFormatOpts(f);
|
|
5279
5279
|
return g ? this.formatWithSystemDefault(e, g) : f;
|
|
5280
5280
|
}, p = (f) => s ? Vl(e, f) : i({ era: f }, "era"), u = (f) => {
|
|
5281
5281
|
switch (f) {
|
|
@@ -5420,7 +5420,7 @@ class Oe {
|
|
|
5420
5420
|
return d(f);
|
|
5421
5421
|
}
|
|
5422
5422
|
};
|
|
5423
|
-
return qr(
|
|
5423
|
+
return qr(be.parseFormat(n), u);
|
|
5424
5424
|
}
|
|
5425
5425
|
formatDurationFromString(e, n) {
|
|
5426
5426
|
const s = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, r = (d) => {
|
|
@@ -5452,7 +5452,7 @@ class Oe {
|
|
|
5452
5452
|
return this.opts.signMode === "negativeLargestOnly" && f !== p.largestUnit ? k = "never" : this.opts.signMode === "all" ? k = "always" : k = "auto", this.num(d.get(f) * g, u.length, k);
|
|
5453
5453
|
} else
|
|
5454
5454
|
return u;
|
|
5455
|
-
}, o =
|
|
5455
|
+
}, o = be.parseFormat(n), a = o.reduce(
|
|
5456
5456
|
(d, { literal: p, val: u }) => p ? d : d.concat(u),
|
|
5457
5457
|
[]
|
|
5458
5458
|
), l = e.shiftTo(...a.map(r).filter((d) => d)), c = {
|
|
@@ -5520,7 +5520,7 @@ function qt(t, e) {
|
|
|
5520
5520
|
}, null, e + 4];
|
|
5521
5521
|
}
|
|
5522
5522
|
function yn(t, e) {
|
|
5523
|
-
const n = !t[e] && !t[e + 1], s = ss(t[e + 1], t[e + 2]), r = n ? null :
|
|
5523
|
+
const n = !t[e] && !t[e + 1], s = ss(t[e + 1], t[e + 2]), r = n ? null : Te.instance(s);
|
|
5524
5524
|
return [{}, r, e + 3];
|
|
5525
5525
|
}
|
|
5526
5526
|
function gn(t, e) {
|
|
@@ -5581,7 +5581,7 @@ function nc(t) {
|
|
|
5581
5581
|
p
|
|
5582
5582
|
] = t, u = ir(e, r, s, n, i, o, a);
|
|
5583
5583
|
let f;
|
|
5584
|
-
return l ? f = ec[l] : c ? f = 0 : f = ss(d, p), [u, new
|
|
5584
|
+
return l ? f = ec[l] : c ? f = 0 : f = ss(d, p), [u, new Te(f)];
|
|
5585
5585
|
}
|
|
5586
5586
|
function sc(t) {
|
|
5587
5587
|
return t.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
|
|
@@ -5589,11 +5589,11 @@ function sc(t) {
|
|
|
5589
5589
|
const rc = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, ic = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, oc = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
|
|
5590
5590
|
function Br(t) {
|
|
5591
5591
|
const [, e, n, s, r, i, o, a] = t;
|
|
5592
|
-
return [ir(e, r, s, n, i, o, a),
|
|
5592
|
+
return [ir(e, r, s, n, i, o, a), Te.utcInstance];
|
|
5593
5593
|
}
|
|
5594
5594
|
function ac(t) {
|
|
5595
5595
|
const [, e, n, s, r, i, o, a] = t;
|
|
5596
|
-
return [ir(e, a, n, s, r, i, o),
|
|
5596
|
+
return [ir(e, a, n, s, r, i, o), Te.utcInstance];
|
|
5597
5597
|
}
|
|
5598
5598
|
const lc = jt(Zl, rr), cc = jt(zl, rr), uc = jt(ql, rr), dc = jt(wo), Eo = Zt(
|
|
5599
5599
|
Jl,
|
|
@@ -5824,7 +5824,7 @@ class ne {
|
|
|
5824
5824
|
*/
|
|
5825
5825
|
static fromObject(e, n = {}) {
|
|
5826
5826
|
if (e == null || typeof e != "object")
|
|
5827
|
-
throw new
|
|
5827
|
+
throw new ke(
|
|
5828
5828
|
`Duration.fromObject: argument expected to be an object, got ${e === null ? "null" : typeof e}`
|
|
5829
5829
|
);
|
|
5830
5830
|
return new ne({
|
|
@@ -5851,7 +5851,7 @@ class ne {
|
|
|
5851
5851
|
return e;
|
|
5852
5852
|
if (typeof e == "object")
|
|
5853
5853
|
return ne.fromObject(e);
|
|
5854
|
-
throw new
|
|
5854
|
+
throw new ke(
|
|
5855
5855
|
`Unknown duration argument ${e} of type ${typeof e}`
|
|
5856
5856
|
);
|
|
5857
5857
|
}
|
|
@@ -5901,7 +5901,7 @@ class ne {
|
|
|
5901
5901
|
*/
|
|
5902
5902
|
static invalid(e, n = null) {
|
|
5903
5903
|
if (!e)
|
|
5904
|
-
throw new
|
|
5904
|
+
throw new ke("need to specify a reason the Duration is invalid");
|
|
5905
5905
|
const s = e instanceof Ue ? e : new Ue(e, n);
|
|
5906
5906
|
if (ue.throwOnInvalid)
|
|
5907
5907
|
throw new Xa(s);
|
|
@@ -5988,7 +5988,7 @@ class ne {
|
|
|
5988
5988
|
...n,
|
|
5989
5989
|
floor: n.round !== !1 && n.floor !== !1
|
|
5990
5990
|
};
|
|
5991
|
-
return this.isValid ?
|
|
5991
|
+
return this.isValid ? be.create(this.loc, s).formatDurationFromString(this, e) : Hr;
|
|
5992
5992
|
}
|
|
5993
5993
|
/**
|
|
5994
5994
|
* Returns a string representation of a Duration with all units included.
|
|
@@ -6399,7 +6399,7 @@ class ce {
|
|
|
6399
6399
|
*/
|
|
6400
6400
|
static invalid(e, n = null) {
|
|
6401
6401
|
if (!e)
|
|
6402
|
-
throw new
|
|
6402
|
+
throw new ke("need to specify a reason the Interval is invalid");
|
|
6403
6403
|
const s = e instanceof Ue ? e : new Ue(e, n);
|
|
6404
6404
|
if (ue.throwOnInvalid)
|
|
6405
6405
|
throw new Ka(s);
|
|
@@ -6774,7 +6774,7 @@ class ce {
|
|
|
6774
6774
|
* @return {string}
|
|
6775
6775
|
*/
|
|
6776
6776
|
toLocaleString(e = qn, n = {}) {
|
|
6777
|
-
return this.isValid ?
|
|
6777
|
+
return this.isValid ? be.create(this.s.loc.clone(n), e).formatInterval(this) : It;
|
|
6778
6778
|
}
|
|
6779
6779
|
/**
|
|
6780
6780
|
* Returns an ISO 8601-compliant string representation of this Interval.
|
|
@@ -7312,7 +7312,7 @@ function Uc(t) {
|
|
|
7312
7312
|
}
|
|
7313
7313
|
};
|
|
7314
7314
|
let n = null, s;
|
|
7315
|
-
return G(t.z) || (n = tt.create(t.z)), G(t.Z) || (n || (n = new
|
|
7315
|
+
return G(t.z) || (n = tt.create(t.z)), G(t.Z) || (n || (n = new Te(t.Z)), s = t.Z), G(t.q) || (t.M = (t.q - 1) * 3 + 1), G(t.h) || (t.h < 12 && t.a === 1 ? t.h += 12 : t.h === 12 && t.a === 0 && (t.h = 0)), t.G === 0 && t.y && (t.y = -t.y), G(t.u) || (t.S = tr(t.u)), [Object.keys(t).reduce((i, o) => {
|
|
7316
7316
|
const a = e(o);
|
|
7317
7317
|
return a && (i[a] = t[o]), i;
|
|
7318
7318
|
}, {}), n, s];
|
|
@@ -7324,7 +7324,7 @@ function Wc() {
|
|
|
7324
7324
|
function jc(t, e) {
|
|
7325
7325
|
if (t.literal)
|
|
7326
7326
|
return t;
|
|
7327
|
-
const n =
|
|
7327
|
+
const n = be.macroTokenToFormatOpts(t.val), s = Io(n, e);
|
|
7328
7328
|
return s == null || s.includes(void 0) ? t : s;
|
|
7329
7329
|
}
|
|
7330
7330
|
function Ro(t, e) {
|
|
@@ -7332,7 +7332,7 @@ function Ro(t, e) {
|
|
|
7332
7332
|
}
|
|
7333
7333
|
class To {
|
|
7334
7334
|
constructor(e, n) {
|
|
7335
|
-
if (this.locale = e, this.format = n, this.tokens = Ro(
|
|
7335
|
+
if (this.locale = e, this.format = n, this.tokens = Ro(be.parseFormat(n), e), this.units = this.tokens.map((s) => $c(s, e)), this.disqualifyingUnit = this.units.find((s) => s.invalidReason), !this.disqualifyingUnit) {
|
|
7336
7336
|
const [s, r] = Lc(this.units);
|
|
7337
7337
|
this.regex = RegExp(s, "i"), this.handlers = r;
|
|
7338
7338
|
}
|
|
@@ -7374,7 +7374,7 @@ function Zc(t, e, n) {
|
|
|
7374
7374
|
function Io(t, e) {
|
|
7375
7375
|
if (!t)
|
|
7376
7376
|
return null;
|
|
7377
|
-
const s =
|
|
7377
|
+
const s = be.create(e, t).dtFormatter(Wc()), r = s.formatToParts(), i = s.resolvedOptions();
|
|
7378
7378
|
return r.map((o) => Pc(o, t, i));
|
|
7379
7379
|
}
|
|
7380
7380
|
const ps = "Invalid DateTime", Xr = 864e13;
|
|
@@ -7462,7 +7462,7 @@ function xt(t, e, n, s, r, i) {
|
|
|
7462
7462
|
);
|
|
7463
7463
|
}
|
|
7464
7464
|
function Tn(t, e, n = !0) {
|
|
7465
|
-
return t.isValid ?
|
|
7465
|
+
return t.isValid ? be.create(ie.create("en-US"), {
|
|
7466
7466
|
allowZ: n,
|
|
7467
7467
|
forceSimple: !0
|
|
7468
7468
|
}).formatDateTimeFromString(t, e) : null;
|
|
@@ -7696,7 +7696,7 @@ class V {
|
|
|
7696
7696
|
*/
|
|
7697
7697
|
static utc() {
|
|
7698
7698
|
const [e, n] = ii(arguments), [s, r, i, o, a, l, c] = n;
|
|
7699
|
-
return e.zone =
|
|
7699
|
+
return e.zone = Te.utcInstance, si({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
|
|
7700
7700
|
}
|
|
7701
7701
|
/**
|
|
7702
7702
|
* Create a DateTime from a JavaScript Date object. Uses the default zone.
|
|
@@ -7734,7 +7734,7 @@ class V {
|
|
|
7734
7734
|
zone: at(n.zone, ue.defaultZone),
|
|
7735
7735
|
loc: ie.fromObject(n)
|
|
7736
7736
|
});
|
|
7737
|
-
throw new
|
|
7737
|
+
throw new ke(
|
|
7738
7738
|
`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
|
|
7739
7739
|
);
|
|
7740
7740
|
}
|
|
@@ -7756,7 +7756,7 @@ class V {
|
|
|
7756
7756
|
zone: at(n.zone, ue.defaultZone),
|
|
7757
7757
|
loc: ie.fromObject(n)
|
|
7758
7758
|
});
|
|
7759
|
-
throw new
|
|
7759
|
+
throw new ke("fromSeconds requires a numerical input");
|
|
7760
7760
|
}
|
|
7761
7761
|
/**
|
|
7762
7762
|
* Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
|
|
@@ -7901,7 +7901,7 @@ class V {
|
|
|
7901
7901
|
*/
|
|
7902
7902
|
static fromFormat(e, n, s = {}) {
|
|
7903
7903
|
if (G(e) || G(n))
|
|
7904
|
-
throw new
|
|
7904
|
+
throw new ke("fromFormat requires an input string and a format");
|
|
7905
7905
|
const { locale: r = null, numberingSystem: i = null } = s, o = ie.fromOpts({
|
|
7906
7906
|
locale: r,
|
|
7907
7907
|
numberingSystem: i,
|
|
@@ -7948,7 +7948,7 @@ class V {
|
|
|
7948
7948
|
*/
|
|
7949
7949
|
static invalid(e, n = null) {
|
|
7950
7950
|
if (!e)
|
|
7951
|
-
throw new
|
|
7951
|
+
throw new ke("need to specify a reason the DateTime is invalid");
|
|
7952
7952
|
const s = e instanceof Ue ? e : new Ue(e, n);
|
|
7953
7953
|
if (ue.throwOnInvalid)
|
|
7954
7954
|
throw new Qa(s);
|
|
@@ -7980,7 +7980,7 @@ class V {
|
|
|
7980
7980
|
* @returns {string}
|
|
7981
7981
|
*/
|
|
7982
7982
|
static expandFormat(e, n = {}) {
|
|
7983
|
-
return Ro(
|
|
7983
|
+
return Ro(be.parseFormat(e), ie.fromObject(n)).map((r) => r.val).join("");
|
|
7984
7984
|
}
|
|
7985
7985
|
static resetCache() {
|
|
7986
7986
|
en = void 0, Zs.clear();
|
|
@@ -8344,7 +8344,7 @@ class V {
|
|
|
8344
8344
|
* @return {Object}
|
|
8345
8345
|
*/
|
|
8346
8346
|
resolvedLocaleOptions(e = {}) {
|
|
8347
|
-
const { locale: n, numberingSystem: s, calendar: r } =
|
|
8347
|
+
const { locale: n, numberingSystem: s, calendar: r } = be.create(
|
|
8348
8348
|
this.loc.clone(e),
|
|
8349
8349
|
e
|
|
8350
8350
|
).resolvedOptions(this);
|
|
@@ -8360,7 +8360,7 @@ class V {
|
|
|
8360
8360
|
* @return {DateTime}
|
|
8361
8361
|
*/
|
|
8362
8362
|
toUTC(e = 0, n = {}) {
|
|
8363
|
-
return this.setZone(
|
|
8363
|
+
return this.setZone(Te.instance(e), n);
|
|
8364
8364
|
}
|
|
8365
8365
|
/**
|
|
8366
8366
|
* "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.
|
|
@@ -8550,7 +8550,7 @@ class V {
|
|
|
8550
8550
|
* @return {string}
|
|
8551
8551
|
*/
|
|
8552
8552
|
toFormat(e, n = {}) {
|
|
8553
|
-
return this.isValid ?
|
|
8553
|
+
return this.isValid ? be.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this, e) : ps;
|
|
8554
8554
|
}
|
|
8555
8555
|
/**
|
|
8556
8556
|
* Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
|
|
@@ -8572,7 +8572,7 @@ class V {
|
|
|
8572
8572
|
* @return {string}
|
|
8573
8573
|
*/
|
|
8574
8574
|
toLocaleString(e = qn, n = {}) {
|
|
8575
|
-
return this.isValid ?
|
|
8575
|
+
return this.isValid ? be.create(this.loc.clone(n), e).formatDateTime(this) : ps;
|
|
8576
8576
|
}
|
|
8577
8577
|
/**
|
|
8578
8578
|
* Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
|
|
@@ -8588,7 +8588,7 @@ class V {
|
|
|
8588
8588
|
* //=> ]
|
|
8589
8589
|
*/
|
|
8590
8590
|
toLocaleParts(e = {}) {
|
|
8591
|
-
return this.isValid ?
|
|
8591
|
+
return this.isValid ? be.create(this.loc.clone(e), e).formatDateTimeParts(this) : [];
|
|
8592
8592
|
}
|
|
8593
8593
|
/**
|
|
8594
8594
|
* Returns an ISO 8601-compliant string representation of this DateTime
|
|
@@ -8946,7 +8946,7 @@ class V {
|
|
|
8946
8946
|
*/
|
|
8947
8947
|
static min(...e) {
|
|
8948
8948
|
if (!e.every(V.isDateTime))
|
|
8949
|
-
throw new
|
|
8949
|
+
throw new ke("min requires all arguments be DateTimes");
|
|
8950
8950
|
return Zr(e, (n) => n.valueOf(), Math.min);
|
|
8951
8951
|
}
|
|
8952
8952
|
/**
|
|
@@ -8956,7 +8956,7 @@ class V {
|
|
|
8956
8956
|
*/
|
|
8957
8957
|
static max(...e) {
|
|
8958
8958
|
if (!e.every(V.isDateTime))
|
|
8959
|
-
throw new
|
|
8959
|
+
throw new ke("max requires all arguments be DateTimes");
|
|
8960
8960
|
return Zr(e, (n) => n.valueOf(), Math.max);
|
|
8961
8961
|
}
|
|
8962
8962
|
// MISC
|
|
@@ -9013,7 +9013,7 @@ class V {
|
|
|
9013
9013
|
*/
|
|
9014
9014
|
static fromFormatParser(e, n, s = {}) {
|
|
9015
9015
|
if (G(e) || G(n))
|
|
9016
|
-
throw new
|
|
9016
|
+
throw new ke(
|
|
9017
9017
|
"fromFormatParser requires an input string and a format parser"
|
|
9018
9018
|
);
|
|
9019
9019
|
const { locale: r = null, numberingSystem: i = null } = s, o = ie.fromOpts({
|
|
@@ -9022,7 +9022,7 @@ class V {
|
|
|
9022
9022
|
defaultToEN: !0
|
|
9023
9023
|
});
|
|
9024
9024
|
if (!o.equals(n.locale))
|
|
9025
|
-
throw new
|
|
9025
|
+
throw new ke(
|
|
9026
9026
|
`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`
|
|
9027
9027
|
);
|
|
9028
9028
|
const { result: a, zone: l, specificOffset: c, invalidReason: d } = n.explainFromTokens(e);
|
|
@@ -9198,7 +9198,7 @@ function Yt(t) {
|
|
|
9198
9198
|
return V.fromJSDate(t);
|
|
9199
9199
|
if (t && typeof t == "object")
|
|
9200
9200
|
return V.fromObject(t);
|
|
9201
|
-
throw new
|
|
9201
|
+
throw new ke(
|
|
9202
9202
|
`Unknown datetime argument: ${t}, of type ${typeof t}`
|
|
9203
9203
|
);
|
|
9204
9204
|
}
|
|
@@ -9207,10 +9207,10 @@ const Yc = (t, e) => {
|
|
|
9207
9207
|
if (t.includeFields) {
|
|
9208
9208
|
const s = e.collections[t.collection];
|
|
9209
9209
|
if (!s)
|
|
9210
|
-
return hn(
|
|
9210
|
+
return hn(ve());
|
|
9211
9211
|
t.includeFields.forEach((r) => {
|
|
9212
9212
|
const i = s.fields.find((o) => o.name === r);
|
|
9213
|
-
i ? n[r] = Ao(i)?.nullable() : n[r] =
|
|
9213
|
+
i ? n[r] = Ao(i)?.nullable() : n[r] = ve();
|
|
9214
9214
|
});
|
|
9215
9215
|
}
|
|
9216
9216
|
return qe({
|
|
@@ -9224,7 +9224,7 @@ const Yc = (t, e) => {
|
|
|
9224
9224
|
i = Jt(o.admin?.skipFormRequiredValidation);
|
|
9225
9225
|
}
|
|
9226
9226
|
return (!t.required || i) && (r = r.optional()), r;
|
|
9227
|
-
}, Qc = () =>
|
|
9227
|
+
}, Qc = () => ve().refine((t) => t === null || t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
|
|
9228
9228
|
message: "Must be a valid date"
|
|
9229
9229
|
}), Ao = (t, e, n) => {
|
|
9230
9230
|
let s;
|
|
@@ -9238,9 +9238,17 @@ const Yc = (t, e) => {
|
|
|
9238
9238
|
}
|
|
9239
9239
|
switch (t.type) {
|
|
9240
9240
|
case "String":
|
|
9241
|
-
s = Ie(), t.length && (s = s.length(t.length, `Must be ${t.length} character(s) long`)), t.minlength && (s = s.min(t.minlength, `Must contain at least ${t.minlength} character(s)`)), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} character(s)`)), t.email ? s = s.email("Must be a valid email address") : t.uuid ? s =
|
|
9242
|
-
|
|
9243
|
-
|
|
9241
|
+
s = Ie(), t.length && (s = s.length(t.length, `Must be ${t.length} character(s) long`)), t.minlength && (s = s.min(t.minlength, `Must contain at least ${t.minlength} character(s)`)), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} character(s)`)), t.email ? s = s.email("Must be a valid email address") : t.uuid ? s = Oe([s.uuid("Must be a valid UUID"), Ee("")]) : t.url ? s = Oe([s.url("Must be a valid URL"), Ee("")]) : t.emoji ? s = Oe([s.emoji("Must be a valid emoji"), Ee("")]) : t.ip ? s = Oe([s.ip("Must be a valid IP address"), Ee("")]) : t.pattern && (!n && a ? s = Oe(
|
|
9242
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
9243
|
+
[s.regex(new RegExp(t.pattern)), s.regex(/^blob:/), Ee("")],
|
|
9244
|
+
{
|
|
9245
|
+
message: "Must be a valid value"
|
|
9246
|
+
}
|
|
9247
|
+
) : s = Oe([
|
|
9248
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
9249
|
+
s.regex(new RegExp(t.pattern), "Must be a valid value"),
|
|
9250
|
+
Ee("")
|
|
9251
|
+
])), t.values && (s = Oe([
|
|
9244
9252
|
Zn(t.values, {
|
|
9245
9253
|
message: `Must be one of the following values: ${t.values.join(", ")}`
|
|
9246
9254
|
}),
|
|
@@ -9251,13 +9259,13 @@ const Yc = (t, e) => {
|
|
|
9251
9259
|
s = rn(), r && (s = s.describe(r.trim()));
|
|
9252
9260
|
break;
|
|
9253
9261
|
case "Number":
|
|
9254
|
-
t.autoIncrement ? s =
|
|
9262
|
+
t.autoIncrement ? s = Oe([cs(), Et().int()], {
|
|
9255
9263
|
message: "Must be a valid number"
|
|
9256
9264
|
}) : (s = Et({
|
|
9257
9265
|
message: "Must be a valid number"
|
|
9258
9266
|
}), t.min && (s = s.min(t.min, `Must be greater than or equal to ${t.min}`)), t.max && (s = s.max(t.max, `Must be less than or equal to ${t.max}`)), t.decimal ? n ? s = s.describe(`${r}Must have ${t.decimal} decimal places`) : s = s.refine((l) => t.decimal ? (l.toString().split(".")[1]?.length || 0) <= t.decimal : !1, {
|
|
9259
9267
|
message: `Must have ${t.decimal} or fewer decimal places`
|
|
9260
|
-
}) : s = s.int("Must not have decimal places"), t.values ? (n || (s =
|
|
9268
|
+
}) : s = s.int("Must not have decimal places"), t.values ? (n || (s = Oe([
|
|
9261
9269
|
s.refine((l) => t.values?.includes(l), {
|
|
9262
9270
|
message: `Must be one of the following values: ${t.values.join(", ")}`
|
|
9263
9271
|
}),
|
|
@@ -9275,7 +9283,7 @@ const Yc = (t, e) => {
|
|
|
9275
9283
|
})));
|
|
9276
9284
|
break;
|
|
9277
9285
|
case "Array":
|
|
9278
|
-
s = Rt(
|
|
9286
|
+
s = Rt(ve()), t.length && (s = s.length(t.length, `Must contain ${t.length} item(s)`)), t.minlength ? s = s.min(t.minlength, `Must contain at least ${t.minlength} item(s)`) : t.required && !i && (s = s.nonempty("Must contain at least one item")), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} item(s)`)), t.values ? (n || (s = s.refine((l) => {
|
|
9279
9287
|
let c = !0;
|
|
9280
9288
|
return l.forEach((d) => {
|
|
9281
9289
|
t.values && !t.values.includes(d) && (c = !1);
|
|
@@ -9283,12 +9291,12 @@ const Yc = (t, e) => {
|
|
|
9283
9291
|
}, { message: `Must only contain the following values: ${t.values.join(", ")}` })), s = s.describe(`${r}Must only contain the following values: ${t.values.join(", ")}`)) : r && (s = s.describe(r.trim())), t.nullable && (s = s.nullable());
|
|
9284
9292
|
break;
|
|
9285
9293
|
case "Map":
|
|
9286
|
-
t.required && !i ? n ? s = qe({}).catchall(
|
|
9294
|
+
t.required && !i ? n ? s = qe({}).catchall(ve()).describe(`${r}Must be an object. Must contain at least one object property.`) : s = hn(ve()).refine((l) => l && typeof l == "object" && Object.keys(l).length > 0, {
|
|
9287
9295
|
message: "Must not be an empty value"
|
|
9288
|
-
}) : s = qe({}).catchall(
|
|
9296
|
+
}) : s = qe({}).catchall(ve()).describe(`${r}Must be an object`);
|
|
9289
9297
|
break;
|
|
9290
9298
|
case "Computed":
|
|
9291
|
-
s =
|
|
9299
|
+
s = ve();
|
|
9292
9300
|
}
|
|
9293
9301
|
return (!t.required || i || o) && (s = s.optional()), s;
|
|
9294
9302
|
}, bu = (t, e, n, s, r) => {
|
|
@@ -9301,13 +9309,13 @@ const Yc = (t, e) => {
|
|
|
9301
9309
|
})), c.max && (a[c.name] = a[c.name].refine((d) => c.max && (!d || Object.keys(d).length <= c.max), {
|
|
9302
9310
|
message: `Must contain at most ${c.max} item(s)`
|
|
9303
9311
|
})))) : a[c.name] = Ao(c, n, s), r && (a[c.name] = a[c.name].optional()));
|
|
9304
|
-
}), !s && i && (a.operation =
|
|
9305
|
-
a[`auth-${c.labels.collection}`] = rn().optional(), a[`operations-${c.labels.collection}`] = Rt(
|
|
9312
|
+
}), !s && i && (a.operation = Oe([Ee("create"), Ee("update"), Ee("delete")]).optional(), a.password = Ie().optional(), a.passwordConfirm = Ie().optional(), Object.values(e.collections).forEach((c) => {
|
|
9313
|
+
a[`auth-${c.labels.collection}`] = rn().optional(), a[`operations-${c.labels.collection}`] = Rt(Oe([Ee("Read"), Ee("Create"), Ee("Update"), Ee("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = rn().optional(), c.access.attributeRestrictions?.forEach((d) => {
|
|
9306
9314
|
a[`attribute-${c.labels.collection}-${d.type}`] = rn().optional();
|
|
9307
9315
|
}), c.access.entityRestrictions?.restrictions?.forEach((d) => {
|
|
9308
|
-
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(
|
|
9316
|
+
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(ve()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
|
|
9309
9317
|
const p = L(c.fields, d.collectionField);
|
|
9310
|
-
a[`accessible-${c.labels.collection}-${p.collection}`] = qe({}).catchall(
|
|
9318
|
+
a[`accessible-${c.labels.collection}-${p.collection}`] = qe({}).catchall(ve()).optional();
|
|
9311
9319
|
}
|
|
9312
9320
|
});
|
|
9313
9321
|
}));
|
|
@@ -9480,7 +9488,7 @@ const Yc = (t, e) => {
|
|
|
9480
9488
|
if (!R)
|
|
9481
9489
|
throw new Error(`SCHEMA_ERROR: Field ${h.twoWay} not found in collection ${h.collection}`);
|
|
9482
9490
|
if (X(R)) {
|
|
9483
|
-
if (t === "update" && w && !(r[h.name] &&
|
|
9491
|
+
if (t === "update" && w && !(r[h.name] && Re(r[h.name])) && r[`${h.name}_Array`] && w[`${h.name}_Array`]?.length > 0)
|
|
9484
9492
|
for (const [q, Z] of Object.entries(w[h.name]))
|
|
9485
9493
|
!r[`${h.name}_Array`].includes(q) && !N?.get(h.name)?.includes(q) && (O.size += j(x, R), O.size <= 500 && v(h, x, R, q, Z.Collection_Path));
|
|
9486
9494
|
} else
|
|
@@ -9493,7 +9501,7 @@ const Yc = (t, e) => {
|
|
|
9493
9501
|
if (!R)
|
|
9494
9502
|
throw new Error(`SCHEMA_ERROR: Field ${h.twoWay} not found in collection ${h.collection}`);
|
|
9495
9503
|
if (X(R)) {
|
|
9496
|
-
if (t === "update" && w && r[h.name] &&
|
|
9504
|
+
if (t === "update" && w && r[h.name] && Re(r[h.name]) && w[`${h.name}_Array`]?.length > 0)
|
|
9497
9505
|
for (const [q, Z] of Object.entries(w[h.name]))
|
|
9498
9506
|
N?.get(h.name)?.includes(q) || (O.size += j(x, R), O.size <= 500 && v(h, x, R, q, Z.Collection_Path));
|
|
9499
9507
|
} else
|
|
@@ -10415,11 +10423,11 @@ function su(t) {
|
|
|
10415
10423
|
}
|
|
10416
10424
|
const qo = async (t, e, n, s, r, i, o) => {
|
|
10417
10425
|
const a = kt(), l = de(), { labels: c, fields: d } = s;
|
|
10418
|
-
if (
|
|
10426
|
+
if (Re(r.Email) || !r.Email)
|
|
10419
10427
|
throw new Error("VALIDATION_ERROR: Email field is required");
|
|
10420
|
-
if (
|
|
10428
|
+
if (Re(r.Role) || !r.Role)
|
|
10421
10429
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
10422
|
-
if (r.Enabled === void 0 || r.Enabled === null ||
|
|
10430
|
+
if (r.Enabled === void 0 || r.Enabled === null || Re(r.Enabled))
|
|
10423
10431
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
10424
10432
|
const p = "USER_ERROR", u = async (y, E) => {
|
|
10425
10433
|
try {
|
|
@@ -10443,7 +10451,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10443
10451
|
}
|
|
10444
10452
|
const g = {};
|
|
10445
10453
|
for (const y of d)
|
|
10446
|
-
y.saveToAuthToken && !lr(y.name) && r[y.name] !== void 0 && y.type !== "Timestamp" && y.type !== "Computed" && y.type !== "Embedding" && (
|
|
10454
|
+
y.saveToAuthToken && !lr(y.name) && r[y.name] !== void 0 && y.type !== "Timestamp" && y.type !== "Computed" && y.type !== "Embedding" && (Re(r[y.name]) ? g[y.name] = null : g[y.name] = r[y.name]);
|
|
10447
10455
|
try {
|
|
10448
10456
|
await a.setCustomUserClaims(f.uid, {
|
|
10449
10457
|
...g,
|
|
@@ -11016,7 +11024,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11016
11024
|
}, lu = async (t, e, n, s, r, i, o, a, l, c, d) => {
|
|
11017
11025
|
const p = kt(), u = de(), f = {};
|
|
11018
11026
|
for (const y of r.fields)
|
|
11019
|
-
y.saveToAuthToken && !lr(y.name) && i[y.name] !== void 0 && y.type !== "Timestamp" && y.type !== "Computed" && y.type !== "Embedding" && (
|
|
11027
|
+
y.saveToAuthToken && !lr(y.name) && i[y.name] !== void 0 && y.type !== "Timestamp" && y.type !== "Computed" && y.type !== "Embedding" && (Re(i[y.name]) ? f[y.name] = null : f[y.name] = i[y.name]);
|
|
11020
11028
|
const g = "USER_ERROR";
|
|
11021
11029
|
let k = "";
|
|
11022
11030
|
if (t === "create") {
|
|
@@ -11173,7 +11181,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11173
11181
|
delete n.id, Bo(n), ur(n);
|
|
11174
11182
|
const m = Js("update", t, n, c, w, "Online", r || "System", ht.now(), pe.serverTimestamp()), T = me(m);
|
|
11175
11183
|
for (const S of k)
|
|
11176
|
-
!X(S) &&
|
|
11184
|
+
!X(S) && Re(m[S.name]) && S.nullable && (m[S.name] = null);
|
|
11177
11185
|
Ze(m), Ze(v), _t(f, m, c), _t(f, v, c), y && !s?.providedTransaction && await Wt("update", "started", m, a, t, e, f, void 0, v);
|
|
11178
11186
|
const b = {
|
|
11179
11187
|
operation: "update",
|
|
@@ -11203,7 +11211,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11203
11211
|
}
|
|
11204
11212
|
Ze(m), delete n.id, _t(f, m, c), Mn(f, m);
|
|
11205
11213
|
for (const S of k)
|
|
11206
|
-
!X(S) &&
|
|
11214
|
+
!X(S) && Re(m[S.name]) && S.nullable && (m[S.name] = null);
|
|
11207
11215
|
try {
|
|
11208
11216
|
const S = { ...U, ...m };
|
|
11209
11217
|
Qe(S), Yo("update", f, m, v), Go("update", m, T), await dn("update", S, f, E, { operation: "update", data: m, context: o, originalRecord: me(v) }, c);
|
|
@@ -11256,9 +11264,9 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11256
11264
|
D = we.data();
|
|
11257
11265
|
const Ht = i?.permissions && Object.keys(i.permissions).length > 0 ? i.permissions : void 0;
|
|
11258
11266
|
if (m.Role && m.Role !== v.Role && !Ht && (i ||= { operation: "update", permissions: {} }, i.permissions = me(D), i.permissions.Role = m.Role), i?.permissions) {
|
|
11259
|
-
if (i.permissions.Role ||= m.Role || v.Role, i.permissions.Enabled ??= m.Enabled ?? v.Enabled,
|
|
11267
|
+
if (i.permissions.Role ||= m.Role || v.Role, i.permissions.Enabled ??= m.Enabled ?? v.Enabled, Re(i.permissions.Role) || !i.permissions.Role)
|
|
11260
11268
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
11261
|
-
if (
|
|
11269
|
+
if (Re(i.permissions.Enabled) || i.permissions.Enabled === void 0 || i.permissions.Enabled === null)
|
|
11262
11270
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
11263
11271
|
}
|
|
11264
11272
|
}
|
|
@@ -11275,7 +11283,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11275
11283
|
if (!s?.providedTransaction) {
|
|
11276
11284
|
const Ht = k.filter((_e) => "unique" in _e && _e.unique).map(async (_e) => {
|
|
11277
11285
|
if (!r || !_e.access || Be(_e, _, f, I)) {
|
|
11278
|
-
if (m[_e.name] === void 0 ||
|
|
11286
|
+
if (m[_e.name] === void 0 || Re(m[_e.name]))
|
|
11279
11287
|
return;
|
|
11280
11288
|
const Gt = We(_e, E), dr = { ...v, ...m };
|
|
11281
11289
|
if (!(r && _ && De && Gt?.custom?.serverAccess?.read !== void 0 ? await oe(Gt.custom.serverAccess.read, [
|
|
@@ -11535,7 +11543,7 @@ export {
|
|
|
11535
11543
|
Ja as getZodSchema,
|
|
11536
11544
|
Nu as initializeFirebase,
|
|
11537
11545
|
Ru as initializeStoker,
|
|
11538
|
-
|
|
11546
|
+
Re as isDeleteSentinel,
|
|
11539
11547
|
Lu as keepTimezone,
|
|
11540
11548
|
Vu as removeTimezone,
|
|
11541
11549
|
xu as runChildProcess,
|