@lotics/app-sdk 0.123.3 → 0.123.5
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 +40 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6562,6 +6562,14 @@ var TOOL_INPUT_SEMANTICS = {
|
|
|
6562
6562
|
// `fields` is keyed by field; the tool resolves it at execute.
|
|
6563
6563
|
conflicts: { kind: "dynamic" }
|
|
6564
6564
|
},
|
|
6565
|
+
save_record: {
|
|
6566
|
+
table_id: { kind: "table_ref", rows: "change" },
|
|
6567
|
+
match: { kind: "record_data", table_from: "table_id" },
|
|
6568
|
+
set: { kind: "record_data", table_from: "table_id" },
|
|
6569
|
+
add_to: { kind: "record_data", table_from: "table_id" },
|
|
6570
|
+
// Each entry names its own child table and fields; the tool resolves them at execute.
|
|
6571
|
+
lines: { kind: "dynamic" }
|
|
6572
|
+
},
|
|
6565
6573
|
delete_records: {
|
|
6566
6574
|
// THE ONE CALL THAT TAKES ROWS. Every column of the row goes with it, so
|
|
6567
6575
|
// nothing field-keyed can carry the fact and it rides the table position —
|
|
@@ -12598,15 +12606,42 @@ function calculateLookupValue(value, linkedRecords, lookupFieldKey, linkedField,
|
|
|
12598
12606
|
return a.id < b.id ? 1 : a.id > b.id ? -1 : 0;
|
|
12599
12607
|
})[0];
|
|
12600
12608
|
const pickedValue = picked ? readPicked(picked) : void 0;
|
|
12601
|
-
|
|
12609
|
+
const cells = pickedValue === void 0 ? [] : elementsOf(pickedValue, linkedField);
|
|
12610
|
+
return cells.length > 0 ? cells : null;
|
|
12602
12611
|
}
|
|
12603
|
-
const values2 =
|
|
12604
|
-
for (const record of relevantRecords) {
|
|
12612
|
+
const values2 = relevantRecords.flatMap((record) => {
|
|
12605
12613
|
const fieldValue = readPicked(record);
|
|
12606
|
-
|
|
12607
|
-
}
|
|
12614
|
+
return fieldValue === void 0 ? [] : elementsOf(fieldValue, linkedField);
|
|
12615
|
+
});
|
|
12608
12616
|
return values2.length > 0 ? values2 : null;
|
|
12609
12617
|
}
|
|
12618
|
+
function elementsOf(picked, linkedField) {
|
|
12619
|
+
return linkedField?.type === "lookup" && Array.isArray(picked) ? lookupTerminalCells(picked, linkedField) : [picked];
|
|
12620
|
+
}
|
|
12621
|
+
function lookupTerminalCells(values2, field) {
|
|
12622
|
+
switch (field.lookup_field_type) {
|
|
12623
|
+
case void 0:
|
|
12624
|
+
return [...values2];
|
|
12625
|
+
case "select":
|
|
12626
|
+
case "select_member":
|
|
12627
|
+
case "select_record_link":
|
|
12628
|
+
case "files":
|
|
12629
|
+
return values2.flatMap(innermostLists);
|
|
12630
|
+
case "text":
|
|
12631
|
+
case "number":
|
|
12632
|
+
case "date":
|
|
12633
|
+
case "boolean":
|
|
12634
|
+
case "formula":
|
|
12635
|
+
case "rollup":
|
|
12636
|
+
case "lookup":
|
|
12637
|
+
case "button":
|
|
12638
|
+
case "autonumber":
|
|
12639
|
+
return flattenLookupValues(values2);
|
|
12640
|
+
}
|
|
12641
|
+
}
|
|
12642
|
+
function innermostLists(value) {
|
|
12643
|
+
return Array.isArray(value) && value.some(Array.isArray) ? value.flatMap(innermostLists) : [value];
|
|
12644
|
+
}
|
|
12610
12645
|
|
|
12611
12646
|
// ../shared/src/interpolate.ts
|
|
12612
12647
|
function interpolateObject(obj, context) {
|
package/package.json
CHANGED