@ai-matrx/records 0.87.2 → 0.87.4
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/CHANGELOG.md +2 -2
- package/dist/react/index.cjs +15 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +15 -1
- package/dist/react/index.js.map +1 -1
- package/dist/typed-table/index.cjs +15 -1
- package/dist/typed-table/index.cjs.map +1 -1
- package/dist/typed-table/index.js +15 -1
- package/dist/typed-table/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -6769,7 +6769,8 @@ async function ensureAppAutomations(client, def, specs, options = {}) {
|
|
|
6769
6769
|
actions.push({
|
|
6770
6770
|
do: "edit_rows",
|
|
6771
6771
|
table_id: other.data.table,
|
|
6772
|
-
|
|
6772
|
+
// A Rule (`{ op, args }`) is the store's filter; a flat `{ key: value }` map is keyed.
|
|
6773
|
+
where: typeof a.where.op === "string" ? rewriteWhere(a.where, theirs.data, own.data) : keyed(a.where, theirs.data, own.data, a.table.name),
|
|
6773
6774
|
values: keyed(a.values, theirs.data, own.data, a.table.name),
|
|
6774
6775
|
...a.limit ? { limit: a.limit } : {}
|
|
6775
6776
|
});
|
|
@@ -6794,6 +6795,19 @@ async function ensureAppAutomations(client, def, specs, options = {}) {
|
|
|
6794
6795
|
}
|
|
6795
6796
|
return { ok: true, data: ids };
|
|
6796
6797
|
}
|
|
6798
|
+
function rewriteWhere(node, target, source) {
|
|
6799
|
+
const walk = (n) => {
|
|
6800
|
+
if (Array.isArray(n)) return n.map(walk);
|
|
6801
|
+
if (n && typeof n === "object") {
|
|
6802
|
+
const o = n;
|
|
6803
|
+
if (Object.keys(o).length === 1 && typeof o.field === "string") return { field: byId(target, o.field, "the edited table") };
|
|
6804
|
+
if (Object.keys(o).length === 1 && typeof o.trigger === "string") return { trigger: byId(source, o.trigger, "the triggering table") };
|
|
6805
|
+
return Object.fromEntries(Object.entries(o).map(([k, v]) => [k, walk(v)]));
|
|
6806
|
+
}
|
|
6807
|
+
return n;
|
|
6808
|
+
};
|
|
6809
|
+
return walk(node);
|
|
6810
|
+
}
|
|
6797
6811
|
function rewriteCondition(node, ids) {
|
|
6798
6812
|
const walk = (n) => {
|
|
6799
6813
|
if (Array.isArray(n)) return n.map(walk);
|