@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
package/dist/react/index.js
CHANGED
|
@@ -9316,7 +9316,8 @@ async function ensureAppAutomations(client, def, specs, options = {}) {
|
|
|
9316
9316
|
actions.push({
|
|
9317
9317
|
do: "edit_rows",
|
|
9318
9318
|
table_id: other.data.table,
|
|
9319
|
-
|
|
9319
|
+
// A Rule (`{ op, args }`) is the store's filter; a flat `{ key: value }` map is keyed.
|
|
9320
|
+
where: typeof a.where.op === "string" ? rewriteWhere(a.where, theirs.data, own.data) : keyed(a.where, theirs.data, own.data, a.table.name),
|
|
9320
9321
|
values: keyed(a.values, theirs.data, own.data, a.table.name),
|
|
9321
9322
|
...a.limit ? { limit: a.limit } : {}
|
|
9322
9323
|
});
|
|
@@ -9341,6 +9342,19 @@ async function ensureAppAutomations(client, def, specs, options = {}) {
|
|
|
9341
9342
|
}
|
|
9342
9343
|
return { ok: true, data: ids };
|
|
9343
9344
|
}
|
|
9345
|
+
function rewriteWhere(node, target, source) {
|
|
9346
|
+
const walk = (n) => {
|
|
9347
|
+
if (Array.isArray(n)) return n.map(walk);
|
|
9348
|
+
if (n && typeof n === "object") {
|
|
9349
|
+
const o = n;
|
|
9350
|
+
if (Object.keys(o).length === 1 && typeof o.field === "string") return { field: byId(target, o.field, "the edited table") };
|
|
9351
|
+
if (Object.keys(o).length === 1 && typeof o.trigger === "string") return { trigger: byId(source, o.trigger, "the triggering table") };
|
|
9352
|
+
return Object.fromEntries(Object.entries(o).map(([k, v]) => [k, walk(v)]));
|
|
9353
|
+
}
|
|
9354
|
+
return n;
|
|
9355
|
+
};
|
|
9356
|
+
return walk(node);
|
|
9357
|
+
}
|
|
9344
9358
|
function rewriteCondition(node, ids) {
|
|
9345
9359
|
const walk = (n) => {
|
|
9346
9360
|
if (Array.isArray(n)) return n.map(walk);
|