@lotics/app-sdk 0.131.6 → 0.131.7
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 +21 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9904,16 +9904,22 @@ function assertLinkId(item, via) {
|
|
|
9904
9904
|
}
|
|
9905
9905
|
return item;
|
|
9906
9906
|
}
|
|
9907
|
-
async function
|
|
9908
|
-
|
|
9909
|
-
|
|
9907
|
+
async function fetchRecordsData(recordIds, ctx) {
|
|
9908
|
+
const missing = [...new Set(recordIds.filter((id) => !ctx.record_cache.has(id)))];
|
|
9909
|
+
if (missing.length > 0) {
|
|
9910
|
+
const fetched = await ctx.fetch_record(missing);
|
|
9911
|
+
for (const id of missing) {
|
|
9912
|
+
const row2 = fetched.get(id) ?? null;
|
|
9913
|
+
ctx.record_cache.set(id, row2 === null ? null : { id: row2.id, ...row2.data, table_id: row2.table_id });
|
|
9914
|
+
}
|
|
9910
9915
|
}
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
return
|
|
9916
|
+
return new Map(recordIds.map((id) => [id, ctx.record_cache.get(id) ?? null]));
|
|
9917
|
+
}
|
|
9918
|
+
async function fetchRecordData(recordId, ctx) {
|
|
9919
|
+
return (await fetchRecordsData([recordId], ctx)).get(recordId) ?? null;
|
|
9915
9920
|
}
|
|
9916
9921
|
var LINK_FETCH_CONCURRENCY = 20;
|
|
9922
|
+
var LINK_FETCH_BATCH = 200;
|
|
9917
9923
|
var MAX_LINK_FAN_OUT = 1e4;
|
|
9918
9924
|
async function fetchRecordsBounded(ids, reading, ctx) {
|
|
9919
9925
|
if (ids.length > MAX_LINK_FAN_OUT) {
|
|
@@ -9923,10 +9929,11 @@ async function fetchRecordsBounded(ids, reading, ctx) {
|
|
|
9923
9929
|
);
|
|
9924
9930
|
}
|
|
9925
9931
|
const results = [];
|
|
9926
|
-
for (let i = 0; i < ids.length; i +=
|
|
9932
|
+
for (let i = 0; i < ids.length; i += LINK_FETCH_BATCH) {
|
|
9927
9933
|
for (let pause = checkClock(ctx); pause !== null; pause = checkClock(ctx)) await pause;
|
|
9928
|
-
const chunk = ids.slice(i, i +
|
|
9929
|
-
|
|
9934
|
+
const chunk = ids.slice(i, i + LINK_FETCH_BATCH);
|
|
9935
|
+
const rows = await fetchRecordsData(chunk.flatMap((id) => id === null ? [] : [id]), ctx);
|
|
9936
|
+
results.push(...chunk.map((id) => id === null ? null : rows.get(id) ?? null));
|
|
9930
9937
|
}
|
|
9931
9938
|
return results;
|
|
9932
9939
|
}
|
|
@@ -10633,9 +10640,11 @@ async function predictWorkflowEffects(given) {
|
|
|
10633
10640
|
const record = look(recordId);
|
|
10634
10641
|
return record === void 0 ? void 0 : knownCells(input.tables, record.table_id, { id: recordId, ...record.cells, table_id: record.table_id });
|
|
10635
10642
|
},
|
|
10636
|
-
set: () => void 0
|
|
10643
|
+
set: () => void 0,
|
|
10644
|
+
// What the prediction holds is its own model of the writes, never dropped.
|
|
10645
|
+
clear: () => void 0
|
|
10637
10646
|
};
|
|
10638
|
-
const fetchRecord = async (
|
|
10647
|
+
const fetchRecord = async (recordIds) => unread(recordIds[0] ?? "");
|
|
10639
10648
|
const ctx = {
|
|
10640
10649
|
trigger: { app_workflow: clientTrigger(input) },
|
|
10641
10650
|
step_outputs: {},
|
package/package.json
CHANGED