@lotics/app-sdk 0.130.0 → 0.130.1
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 +6 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9482,32 +9482,14 @@ function walkPath(path, coerce, ctx, anchor, from, start, startTable, startField
|
|
|
9482
9482
|
if (coerce.mode === "display" && terminalField) {
|
|
9483
9483
|
return coerceFieldDisplay(current, terminalField, terminalOwner, ctx);
|
|
9484
9484
|
}
|
|
9485
|
-
if (coerce.mode === "alias") return coerceOptionAliases(current, coerce.of, ctx);
|
|
9486
9485
|
return current;
|
|
9487
9486
|
}
|
|
9488
9487
|
function coercionOf(read2) {
|
|
9489
|
-
|
|
9490
|
-
if (read2.of === void 0) throw new WorkflowEvalError("A read coerced to its alias names no select.", { kind: "alias_without_field" });
|
|
9491
|
-
return { mode: "alias", of: read2.of };
|
|
9488
|
+
return { mode: read2.coerce ?? "raw" };
|
|
9492
9489
|
}
|
|
9493
|
-
function
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
if (Array.isArray(v)) return v.map(resolve);
|
|
9497
|
-
return typeof v === "string" ? aliasOf.get(v) ?? v : v;
|
|
9498
|
-
};
|
|
9499
|
-
return resolve(value);
|
|
9500
|
-
}
|
|
9501
|
-
function coerceOptionAliases(value, of, ctx) {
|
|
9502
|
-
const options = optionsBehind(of, heldTable(of.table_id, ctx), ctx, 0);
|
|
9503
|
-
return options instanceof Promise ? options.then((held2) => aliasesOf(value, of, held2, ctx)) : aliasesOf(value, of, options, ctx);
|
|
9504
|
-
}
|
|
9505
|
-
function optionsBehind(of, held2, ctx, hops, unheld = "refuse") {
|
|
9506
|
-
if (held2 instanceof Promise) return held2.then((table) => optionsBehind(of, table, ctx, hops, unheld));
|
|
9507
|
-
if (held2 === null) {
|
|
9508
|
-
if (unheld === "unknown") return void 0;
|
|
9509
|
-
throw new WorkflowEvalError(`Reading "${of.field_key}" as its alias reads table ${of.table_id}, which this run does not hold.`, { kind: "unknown_table", extra: { table_id: of.table_id } });
|
|
9510
|
-
}
|
|
9490
|
+
function optionsBehind(of, held2, ctx, hops) {
|
|
9491
|
+
if (held2 instanceof Promise) return held2.then((table) => optionsBehind(of, table, ctx, hops));
|
|
9492
|
+
if (held2 === null) return void 0;
|
|
9511
9493
|
const field = findField(held2, of.field_key);
|
|
9512
9494
|
if (field?.type === "select") return field.options;
|
|
9513
9495
|
if (field?.type === "formula") return field.formula.options;
|
|
@@ -9515,17 +9497,7 @@ function optionsBehind(of, held2, ctx, hops, unheld = "refuse") {
|
|
|
9515
9497
|
const through = findField(held2, field.source_field_key);
|
|
9516
9498
|
if (through?.type !== "select_record_link") return void 0;
|
|
9517
9499
|
const next = { table_id: through.table_id, field_key: field.lookup_field_key };
|
|
9518
|
-
return optionsBehind(next, heldTable(next.table_id, ctx), ctx, hops + 1
|
|
9519
|
-
}
|
|
9520
|
-
function aliasesOf(value, of, options, ctx) {
|
|
9521
|
-
if (options === void 0) {
|
|
9522
|
-
throw new WorkflowEvalError(`Reading "${of.field_key}" of table ${of.table_id} as its alias reads a field that holds no options.`, { kind: "no_options", extra: { table_id: of.table_id, field_key: of.field_key } });
|
|
9523
|
-
}
|
|
9524
|
-
if (!Array.isArray(value)) return optionAliases(value, { options });
|
|
9525
|
-
assertCheap(ctx.evaluation_budget, value);
|
|
9526
|
-
const aliased = optionAliases(value, { options });
|
|
9527
|
-
charge(ctx, builtSize(aliased));
|
|
9528
|
-
return aliased;
|
|
9500
|
+
return optionsBehind(next, heldTable(next.table_id, ctx), ctx, hops + 1);
|
|
9529
9501
|
}
|
|
9530
9502
|
async function walkPending(read2, at2, walked) {
|
|
9531
9503
|
const { path, coerce, ctx, anchor, carried, field, terminal_field: terminalField, owners } = read2;
|
|
@@ -9577,7 +9549,7 @@ async function coerceFieldDisplay(value, field, owner, ctx) {
|
|
|
9577
9549
|
return coerceMemberDisplay(value, ctx);
|
|
9578
9550
|
case "lookup":
|
|
9579
9551
|
if (field.lookup_field_type !== "select") return value;
|
|
9580
|
-
const behind = owner === null ? void 0 : await optionsBehind({ table_id: owner.id, field_key: field.key }, owner, ctx, 0
|
|
9552
|
+
const behind = owner === null ? void 0 : await optionsBehind({ table_id: owner.id, field_key: field.key }, owner, ctx, 0);
|
|
9581
9553
|
const options = behind ?? field.lookup_field_options;
|
|
9582
9554
|
return options ? coerceOptionKeysDeep(value, options, ctx) : value;
|
|
9583
9555
|
default:
|
package/package.json
CHANGED