interaqt 0.7.1 → 0.7.3
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/index.js +29 -29
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts +3 -3
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/dist/runtime/activity/InteractionCall.d.ts.map +1 -1
- package/dist/runtime/boolExpression.d.ts +0 -1
- package/dist/runtime/boolExpression.d.ts.map +1 -1
- package/package.json +8 -16
package/dist/index.js
CHANGED
|
@@ -9000,41 +9000,41 @@ class ve {
|
|
|
9000
9000
|
return r === !0 ? !0 : { name: "", type: "matchAttributives", stack: i, error: r };
|
|
9001
9001
|
}
|
|
9002
9002
|
async checkPayload(t) {
|
|
9003
|
-
const e = this.interaction.payload?.items || [],
|
|
9004
|
-
for (let
|
|
9005
|
-
if (!
|
|
9006
|
-
throw new Error(`${
|
|
9007
|
-
for (let
|
|
9008
|
-
if (
|
|
9009
|
-
throw O.payloadValidationFailed(
|
|
9010
|
-
const
|
|
9011
|
-
if (
|
|
9012
|
-
if (
|
|
9013
|
-
throw O.payloadValidationFailed(
|
|
9014
|
-
if (
|
|
9015
|
-
if (
|
|
9016
|
-
throw O.payloadValidationFailed(
|
|
9017
|
-
} else if (
|
|
9018
|
-
throw O.payloadValidationFailed(
|
|
9019
|
-
if (
|
|
9020
|
-
if (
|
|
9021
|
-
const
|
|
9022
|
-
if (
|
|
9023
|
-
throw O.conceptCheckFailed(
|
|
9003
|
+
const e = t.payload || {}, i = this.interaction.payload?.items || [], r = Object.keys(e);
|
|
9004
|
+
for (let s of r)
|
|
9005
|
+
if (!i.some((a) => a.name === s))
|
|
9006
|
+
throw new Error(`${s} in payload is not defined in interaction ${this.interaction.name}`);
|
|
9007
|
+
for (let s of i) {
|
|
9008
|
+
if (s.required && !(s.name in e))
|
|
9009
|
+
throw O.payloadValidationFailed(s.name, "missing", e);
|
|
9010
|
+
const a = e[s.name];
|
|
9011
|
+
if (a === void 0) return;
|
|
9012
|
+
if (s.isCollection && !Array.isArray(a))
|
|
9013
|
+
throw O.payloadValidationFailed(s.name, "data is not array", a);
|
|
9014
|
+
if (s.isCollection) {
|
|
9015
|
+
if (s.isRef && !a.every((o) => !!o.id))
|
|
9016
|
+
throw O.payloadValidationFailed(s.name, "data not every is ref", a);
|
|
9017
|
+
} else if (s.isRef && !a.id)
|
|
9018
|
+
throw O.payloadValidationFailed(s.name, "data is not a ref", a);
|
|
9019
|
+
if (s.base)
|
|
9020
|
+
if (s.isCollection) {
|
|
9021
|
+
const o = await di(a, (n) => this.checkConcept(n, s.base));
|
|
9022
|
+
if (o !== !0)
|
|
9023
|
+
throw O.conceptCheckFailed(s.name, o);
|
|
9024
9024
|
} else {
|
|
9025
|
-
const
|
|
9026
|
-
if (
|
|
9027
|
-
throw O.conceptCheckFailed(
|
|
9025
|
+
const o = await this.checkConcept(a, s.base);
|
|
9026
|
+
if (o !== !0)
|
|
9027
|
+
throw O.conceptCheckFailed(s.name, o);
|
|
9028
9028
|
}
|
|
9029
|
-
if (
|
|
9030
|
-
const
|
|
9029
|
+
if (s.isRef) {
|
|
9030
|
+
const o = s.isCollection ? m.atom({
|
|
9031
9031
|
key: "id",
|
|
9032
|
-
value: ["in",
|
|
9032
|
+
value: ["in", a.map((n) => n.id)]
|
|
9033
9033
|
}) : m.atom({
|
|
9034
9034
|
key: "id",
|
|
9035
|
-
value: ["=",
|
|
9035
|
+
value: ["=", a.id]
|
|
9036
9036
|
});
|
|
9037
|
-
|
|
9037
|
+
s.isCollection ? await this.system.storage.find(s.base.name, o, void 0, ["*"]) : await this.system.storage.findOne(s.base.name, o, void 0, ["*"]);
|
|
9038
9038
|
}
|
|
9039
9039
|
}
|
|
9040
9040
|
}
|