interaqt 0.4.4 → 0.4.6
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
CHANGED
|
@@ -1029,17 +1029,25 @@ class R {
|
|
|
1029
1029
|
constructor(t) {
|
|
1030
1030
|
if (this.raw = t, !t)
|
|
1031
1031
|
throw new Error("BoolExp raw data cannot be undefined");
|
|
1032
|
+
if (t.type !== "atom" && t.type !== "expression")
|
|
1033
|
+
throw new Error(`invalid bool expression type: ${JSON.stringify(t)}`);
|
|
1032
1034
|
}
|
|
1033
1035
|
static atom(t) {
|
|
1034
1036
|
return new R({ type: "atom", data: t });
|
|
1035
1037
|
}
|
|
1036
1038
|
static and(...t) {
|
|
1037
|
-
const e = t.filter((s) => !!s)
|
|
1038
|
-
|
|
1039
|
+
const e = t.filter((s) => !!s);
|
|
1040
|
+
if (e.length === 0)
|
|
1041
|
+
return;
|
|
1042
|
+
const [r, ...i] = e;
|
|
1043
|
+
return i.reduce((s, a) => s.and(a), r instanceof R ? r : R.atom(r));
|
|
1039
1044
|
}
|
|
1040
1045
|
static or(...t) {
|
|
1041
|
-
const e = t.filter((s) => !!s)
|
|
1042
|
-
|
|
1046
|
+
const e = t.filter((s) => !!s);
|
|
1047
|
+
if (e.length === 0)
|
|
1048
|
+
return;
|
|
1049
|
+
const [r, ...i] = e;
|
|
1050
|
+
return i.reduce((s, a) => s.or(a), r instanceof R ? r : R.atom(r));
|
|
1043
1051
|
}
|
|
1044
1052
|
isAtom() {
|
|
1045
1053
|
return this.raw.type === "atom";
|
|
@@ -1061,7 +1069,7 @@ class R {
|
|
|
1061
1069
|
return this.raw;
|
|
1062
1070
|
}
|
|
1063
1071
|
static fromValue(t) {
|
|
1064
|
-
return new R(t);
|
|
1072
|
+
return t instanceof R ? t : new R(t);
|
|
1065
1073
|
}
|
|
1066
1074
|
toJSON() {
|
|
1067
1075
|
return this.raw;
|
|
@@ -9045,10 +9053,10 @@ class Ae {
|
|
|
9045
9053
|
async retrieveData(t) {
|
|
9046
9054
|
let e;
|
|
9047
9055
|
if (C.is(this.interaction.data) || P.is(this.interaction.data)) {
|
|
9048
|
-
const r = this.interaction.data.name,
|
|
9049
|
-
this.interaction.query?.items?.map((
|
|
9050
|
-
), a = { ...t.query?.modifier || {}, ...
|
|
9051
|
-
e = await this.system.storage.find(r,
|
|
9056
|
+
const r = this.interaction.data.name, i = Object.fromEntries(
|
|
9057
|
+
this.interaction.query?.items?.map((p) => [p.name, p.value]) || []
|
|
9058
|
+
), { match: s, modifier: a, attributeQuery: o } = i, n = { ...t.query?.modifier || {}, ...a || {} }, c = t.query?.attributeQuery || [], l = typeof s == "function" ? await s.call(this.controller, t) : s, d = l instanceof R ? l : l ? R.atom(l) : void 0, h = R.and(d, t.query?.match);
|
|
9059
|
+
e = await this.system.storage.find(r, h, n, c);
|
|
9052
9060
|
} else
|
|
9053
9061
|
v(!1, `unknown data type ${this.interaction.data}`);
|
|
9054
9062
|
return e;
|