@lotics/app-sdk 0.129.0 → 0.130.0
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 +11 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10553,8 +10553,7 @@ function clientRuntime(input) {
|
|
|
10553
10553
|
}
|
|
10554
10554
|
};
|
|
10555
10555
|
}
|
|
10556
|
-
function
|
|
10557
|
-
if (input.spelling === "key") return input;
|
|
10556
|
+
function inBodyAliases(input) {
|
|
10558
10557
|
const linked = (tableId) => input.tables.get(tableId)?.fields;
|
|
10559
10558
|
const holder = (fieldKey) => selectFieldHolder(input.tables.values(), fieldKey)?.field;
|
|
10560
10559
|
return {
|
|
@@ -10574,7 +10573,7 @@ function inBodySpelling(input) {
|
|
|
10574
10573
|
};
|
|
10575
10574
|
}
|
|
10576
10575
|
async function predictWorkflowEffects(given) {
|
|
10577
|
-
const input =
|
|
10576
|
+
const input = inBodyAliases(given);
|
|
10578
10577
|
const helpers = {
|
|
10579
10578
|
...createTimezoneAwareFunctions(input.timezone),
|
|
10580
10579
|
// Group membership and whom the caller stands in for are the server's to answer.
|
|
@@ -10601,7 +10600,6 @@ async function predictWorkflowEffects(given) {
|
|
|
10601
10600
|
step_outputs: {},
|
|
10602
10601
|
runtime: clientRuntime(input),
|
|
10603
10602
|
helpers,
|
|
10604
|
-
body_spelling: input.spelling,
|
|
10605
10603
|
record_cache: cache,
|
|
10606
10604
|
fetch_record: fetchRecord,
|
|
10607
10605
|
tables: knownTables(input.tables),
|
|
@@ -10802,20 +10800,20 @@ function publish() {
|
|
|
10802
10800
|
version += 1;
|
|
10803
10801
|
for (const listener of listeners) listener();
|
|
10804
10802
|
}
|
|
10805
|
-
function optionKeysFromBody(field,
|
|
10806
|
-
if (
|
|
10803
|
+
function optionKeysFromBody(field, values2) {
|
|
10804
|
+
if (field.type !== "select") return [...values2];
|
|
10807
10805
|
const keys2 = values2.map((one) => typeof one === "string" ? optionKeyOf(field, one) : one);
|
|
10808
10806
|
return keys2.some((one) => one === void 0) ? void 0 : keys2;
|
|
10809
10807
|
}
|
|
10810
|
-
function storedFromBody(field,
|
|
10808
|
+
function storedFromBody(field, value) {
|
|
10811
10809
|
if (field === void 0) return void 0;
|
|
10812
10810
|
switch (field.type) {
|
|
10813
10811
|
case "select":
|
|
10814
10812
|
case "select_member":
|
|
10815
|
-
if (field.multi === true) return Array.isArray(value) ? optionKeysFromBody(field,
|
|
10813
|
+
if (field.multi === true) return Array.isArray(value) ? optionKeysFromBody(field, value) : void 0;
|
|
10816
10814
|
if (value === null) return [];
|
|
10817
|
-
if (typeof value === "string") return optionKeysFromBody(field,
|
|
10818
|
-
return Array.isArray(value) ? optionKeysFromBody(field,
|
|
10815
|
+
if (typeof value === "string") return optionKeysFromBody(field, [value]);
|
|
10816
|
+
return Array.isArray(value) ? optionKeysFromBody(field, value) : void 0;
|
|
10819
10817
|
case "select_record_link": {
|
|
10820
10818
|
const linked = value === null ? [] : Array.isArray(value) ? value : [value];
|
|
10821
10819
|
if (!linked.every((one) => typeof one === "string")) return void 0;
|
|
@@ -10832,13 +10830,13 @@ function storedFromBody(field, spelling, value) {
|
|
|
10832
10830
|
return value;
|
|
10833
10831
|
}
|
|
10834
10832
|
}
|
|
10835
|
-
function stagedOf(effect
|
|
10833
|
+
function stagedOf(effect) {
|
|
10836
10834
|
if (effect.kind === "unknown") return null;
|
|
10837
10835
|
if (effect.kind === "remove") return effect;
|
|
10838
10836
|
const cells = {};
|
|
10839
10837
|
const unknown = [...effect.unknown];
|
|
10840
10838
|
for (const [key, value] of Object.entries(effect.cells)) {
|
|
10841
|
-
const stored = storedFromBody(fieldOf2(effect.table_id, key),
|
|
10839
|
+
const stored = storedFromBody(fieldOf2(effect.table_id, key), value);
|
|
10842
10840
|
if (stored === void 0) unknown.push(key);
|
|
10843
10841
|
else cells[key] = stored;
|
|
10844
10842
|
}
|
|
@@ -10882,14 +10880,12 @@ async function stageWrite(workflow, inputs) {
|
|
|
10882
10880
|
const described = model.model.workflows[workflow];
|
|
10883
10881
|
const plan = described?.plan;
|
|
10884
10882
|
if (described === void 0 || plan === void 0 || plan.length === 0) return null;
|
|
10885
|
-
const spelling = described.option_spelling ?? "key";
|
|
10886
10883
|
const minted = [];
|
|
10887
10884
|
let prediction;
|
|
10888
10885
|
try {
|
|
10889
10886
|
prediction = await predictWorkflowEffects({
|
|
10890
10887
|
plan,
|
|
10891
10888
|
inputs,
|
|
10892
|
-
spelling,
|
|
10893
10889
|
select_inputs: described.inputs ?? {},
|
|
10894
10890
|
tables: model.tables,
|
|
10895
10891
|
known: knownRecord,
|
|
@@ -10914,7 +10910,7 @@ async function stageWrite(workflow, inputs) {
|
|
|
10914
10910
|
reportMisses([{ kind: "refused", workflow, count: 1 }]);
|
|
10915
10911
|
return null;
|
|
10916
10912
|
}
|
|
10917
|
-
const staged = prediction.effects.flatMap((effect) => stagedOf(effect
|
|
10913
|
+
const staged = prediction.effects.flatMap((effect) => stagedOf(effect) ?? []);
|
|
10918
10914
|
const unknown = new Set(prediction.effects.flatMap((effect) => effect.kind === "unknown" ? [effect.table_id] : []));
|
|
10919
10915
|
if (staged.length === 0 && unknown.size === 0) {
|
|
10920
10916
|
reportMisses([{ kind: "nothing_written", workflow, count: 1 }]);
|
package/package.json
CHANGED