@stoker-platform/node-client 0.5.93 → 0.5.95
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 +3 -3
- package/dist/bundle.js +32 -31
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -3575,7 +3575,7 @@ 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 xe = Ke.create, vt = Pt.create, rn = Ss.create, ds = Is.create,
|
|
3578
|
+
const xe = Ke.create, vt = Pt.create, rn = Ss.create, ds = Is.create, _e = xs.create;
|
|
3579
3579
|
ft.create;
|
|
3580
3580
|
const Tt = ze.create, qe = fe.create, Se = Vn.create;
|
|
3581
3581
|
Un.create;
|
|
@@ -3584,16 +3584,16 @@ const hn = Wn.create, Ie = As.create, Zn = Lt.create;
|
|
|
3584
3584
|
jn.create;
|
|
3585
3585
|
ct.create;
|
|
3586
3586
|
Ut.create;
|
|
3587
|
-
const In = () =>
|
|
3587
|
+
const In = () => _e().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 = () => _e().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(_e());
|
|
3597
3597
|
t.includeFields.forEach((o) => {
|
|
3598
3598
|
const a = i.fields.find((c) => c.name === o);
|
|
3599
3599
|
if (!a)
|
|
@@ -3635,7 +3635,7 @@ const In = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3635
3635
|
})));
|
|
3636
3636
|
break;
|
|
3637
3637
|
case "Timestamp":
|
|
3638
|
-
e.name === r ? i =
|
|
3638
|
+
e.name === r ? i = _e().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 = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3644
3644
|
})));
|
|
3645
3645
|
break;
|
|
3646
3646
|
case "Array":
|
|
3647
|
-
i = Tt(
|
|
3647
|
+
i = Tt(_e()), 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 = () => we().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(_e()), 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 = _e();
|
|
3661
3661
|
break;
|
|
3662
3662
|
}
|
|
3663
3663
|
return !X(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
@@ -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(_e());
|
|
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] = _e();
|
|
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 = () => _e().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;
|
|
@@ -9275,7 +9275,7 @@ const Yc = (t, e) => {
|
|
|
9275
9275
|
})));
|
|
9276
9276
|
break;
|
|
9277
9277
|
case "Array":
|
|
9278
|
-
s = Tt(
|
|
9278
|
+
s = Tt(_e()), 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
9279
|
let c = !0;
|
|
9280
9280
|
return l.forEach((d) => {
|
|
9281
9281
|
t.values && !t.values.includes(d) && (c = !1);
|
|
@@ -9283,12 +9283,12 @@ const Yc = (t, e) => {
|
|
|
9283
9283
|
}, { 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
9284
|
break;
|
|
9285
9285
|
case "Map":
|
|
9286
|
-
t.required && !i ? n ? s = qe({}).catchall(
|
|
9286
|
+
t.required && !i ? n ? s = qe({}).catchall(_e()).describe(`${r}Must be an object. Must contain at least one object property.`) : s = hn(_e()).refine((l) => l && typeof l == "object" && Object.keys(l).length > 0, {
|
|
9287
9287
|
message: "Must not be an empty value"
|
|
9288
|
-
}) : s = qe({}).catchall(
|
|
9288
|
+
}) : s = qe({}).catchall(_e()).describe(`${r}Must be an object`);
|
|
9289
9289
|
break;
|
|
9290
9290
|
case "Computed":
|
|
9291
|
-
s =
|
|
9291
|
+
s = _e();
|
|
9292
9292
|
}
|
|
9293
9293
|
return (!t.required || i || o) && (s = s.optional()), s;
|
|
9294
9294
|
}, bu = (t, e, n, s, r) => {
|
|
@@ -9305,9 +9305,9 @@ const Yc = (t, e) => {
|
|
|
9305
9305
|
a[`auth-${c.labels.collection}`] = rn().optional(), a[`operations-${c.labels.collection}`] = Tt(Se([Ie("Read"), Ie("Create"), Ie("Update"), Ie("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = rn().optional(), c.access.attributeRestrictions?.forEach((d) => {
|
|
9306
9306
|
a[`attribute-${c.labels.collection}-${d.type}`] = rn().optional();
|
|
9307
9307
|
}), c.access.entityRestrictions?.restrictions?.forEach((d) => {
|
|
9308
|
-
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(
|
|
9308
|
+
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(_e()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
|
|
9309
9309
|
const m = P(c.fields, d.collectionField);
|
|
9310
|
-
a[`accessible-${c.labels.collection}-${m.collection}`] = qe({}).catchall(
|
|
9310
|
+
a[`accessible-${c.labels.collection}-${m.collection}`] = qe({}).catchall(_e()).optional();
|
|
9311
9311
|
}
|
|
9312
9312
|
});
|
|
9313
9313
|
}));
|
|
@@ -11148,8 +11148,8 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11148
11148
|
throw new Error("VALIDATION_ERROR: User operations are only permitted for auth collections");
|
|
11149
11149
|
if (i?.operation === "delete" && i.permissions)
|
|
11150
11150
|
throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
|
|
11151
|
-
const y = f.fields.filter((T) => T.saveToAuthToken && !ur(T.name)), w = f.auth && i?.operation === "create", S = f.auth && i?.operation === "delete", q = f.auth && !w && !S && (i?.operation === "update" || n.Role || n.Enabled !== void 0 || n.Name || n.Email || n.Photo_URL || // eslint-disable-next-line security/detect-object-injection
|
|
11152
|
-
y.some((T) => n[T.name] !== void 0)), Z = (T) => T.User_ID && (f.auth && !w && !S && i?.operation === "update" || n.Role && n.Role !== T.Role || n.Enabled !== void 0 && n.Enabled !== T.Enabled || n.Name && n.Name !== T.Name || n.Email && n.Email !== T.Email || n.Photo_URL && n.Photo_URL !== T.Photo_URL || y.some(
|
|
11151
|
+
const y = f.fields.filter((T) => T.saveToAuthToken && !ur(T.name)), w = f.auth && i?.operation === "create", S = f.auth && i?.operation === "delete", q = f.auth && !w && !S && (i?.operation === "update" || O.User_ID && (n.Role || n.Enabled !== void 0 || n.Name || n.Email || n.Photo_URL || // eslint-disable-next-line security/detect-object-injection
|
|
11152
|
+
y.some((T) => n[T.name] !== void 0))), Z = (T) => T.User_ID && (f.auth && !w && !S && i?.operation === "update" || n.Role && n.Role !== T.Role || n.Enabled !== void 0 && n.Enabled !== T.Enabled || n.Name && n.Name !== T.Name || n.Email && n.Email !== T.Email || n.Photo_URL && n.Photo_URL !== T.Photo_URL || y.some(
|
|
11153
11153
|
// eslint-disable-next-line security/detect-object-injection
|
|
11154
11154
|
(Q) => n[Q.name] !== void 0 && n[Q.name] !== T[Q.name]
|
|
11155
11155
|
));
|
|
@@ -11211,8 +11211,8 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11211
11211
|
if (ee && (ee.size += 3), !s?.providedTransaction) {
|
|
11212
11212
|
if (!me.exists)
|
|
11213
11213
|
throw new Error("VERSION_ERROR");
|
|
11214
|
-
const
|
|
11215
|
-
if (
|
|
11214
|
+
const we = me.data();
|
|
11215
|
+
if (we.force && h.Last_Write_At.valueOf() < we.time.valueOf())
|
|
11216
11216
|
throw new Error("VERSION_ERROR");
|
|
11217
11217
|
if (!Te.exists)
|
|
11218
11218
|
throw new Error("MAINTENANCE_MODE");
|
|
@@ -11233,10 +11233,10 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11233
11233
|
if (ee && (ee.size += Lo(a, t, e, c, v, N).length), w && O.User_ID || S && !O.User_ID)
|
|
11234
11234
|
throw new Error("USER_ERROR");
|
|
11235
11235
|
if (Z(O)) {
|
|
11236
|
-
const
|
|
11237
|
-
if (ee && ee.size++, !
|
|
11236
|
+
const we = await T.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
|
|
11237
|
+
if (ee && ee.size++, !we?.exists)
|
|
11238
11238
|
throw new Error("PERMISSION_DENIED");
|
|
11239
|
-
j =
|
|
11239
|
+
j = we.data();
|
|
11240
11240
|
const pt = i?.permissions && Object.keys(i.permissions).length > 0 ? i.permissions : void 0;
|
|
11241
11241
|
if (h.Role && h.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions = ye(j), i.permissions.Role = h.Role), i?.permissions) {
|
|
11242
11242
|
if (i.permissions.Role ||= h.Role || O.Role, i.permissions.Enabled ??= h.Enabled ?? O.Enabled, ke(i.permissions.Role) || !i.permissions.Role)
|
|
@@ -11246,13 +11246,14 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11246
11246
|
}
|
|
11247
11247
|
}
|
|
11248
11248
|
if (w) {
|
|
11249
|
-
const
|
|
11250
|
-
if (Qe(
|
|
11249
|
+
const we = { ...O, ...h };
|
|
11250
|
+
if (Qe(we), !we.Role)
|
|
11251
11251
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
11252
|
-
if (
|
|
11252
|
+
if (we.Enabled === void 0 || we.Enabled === null)
|
|
11253
11253
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
11254
|
-
if (!
|
|
11254
|
+
if (!we.Email)
|
|
11255
11255
|
throw new Error("VALIDATION_ERROR: Email field is required");
|
|
11256
|
+
i?.permissions && (i.permissions.Role ||= we.Role, i.permissions.Enabled ??= we.Enabled);
|
|
11256
11257
|
}
|
|
11257
11258
|
if (!s?.providedTransaction) {
|
|
11258
11259
|
const pt = b.filter((Oe) => "unique" in Oe && Oe.unique).map(async (Oe) => {
|
|
@@ -11279,13 +11280,13 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11279
11280
|
await Promise.all(pt);
|
|
11280
11281
|
}
|
|
11281
11282
|
if (r && v?.Role) {
|
|
11282
|
-
const
|
|
11283
|
-
if (!(E.custom?.serverAccess?.update !== void 0 ? await oe(E.custom.serverAccess.update, [
|
|
11283
|
+
const we = v.Role, pt = { ...O, ...h };
|
|
11284
|
+
if (!(E.custom?.serverAccess?.update !== void 0 ? await oe(E.custom.serverAccess.update, [we, pt, O]) : !0))
|
|
11284
11285
|
throw new Error("PERMISSION_DENIED");
|
|
11285
11286
|
for (const Gt of f.fields) {
|
|
11286
11287
|
const _n = Ue(Gt, E);
|
|
11287
11288
|
if (Object.prototype.hasOwnProperty.call(h, Gt.name) && _n?.custom?.serverAccess?.update !== void 0 && !await oe(_n.custom.serverAccess.update, [
|
|
11288
|
-
|
|
11289
|
+
we,
|
|
11289
11290
|
pt,
|
|
11290
11291
|
O
|
|
11291
11292
|
]))
|