@lotics/app-sdk 0.127.11 → 0.127.13
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/{chunk-IVFIVJE6.js → chunk-7OXMZ332.js} +4 -0
- package/dist/index.js +43 -19
- package/dist/router.js +1 -1
- package/package.json +1 -1
|
@@ -273,6 +273,9 @@ var TABLE_ID_PATTERN = new RegExp(
|
|
|
273
273
|
`^tbl_[${ID_ALPHABET}]+$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`,
|
|
274
274
|
"i"
|
|
275
275
|
);
|
|
276
|
+
function isTableId(value) {
|
|
277
|
+
return TABLE_ID_PATTERN.test(value);
|
|
278
|
+
}
|
|
276
279
|
var PREFIXED_ID_PATTERN = new RegExp(`^[a-z]{3}_[${ID_ALPHABET}]{${ID_LENGTH}}$`);
|
|
277
280
|
var MEMBER_ID_PATTERN = new RegExp(`^[${ID_ALPHABET}]{${ID_LENGTH},}$`);
|
|
278
281
|
var CPU_PROFILE_ID_PATTERN = new RegExp(`^cpf_[${ID_ALPHABET}]{${ID_LENGTH}}$`);
|
|
@@ -2066,6 +2069,7 @@ export {
|
|
|
2066
2069
|
keepAccentsForm,
|
|
2067
2070
|
searchWords,
|
|
2068
2071
|
customAlphabet,
|
|
2072
|
+
isTableId,
|
|
2069
2073
|
isFieldKey,
|
|
2070
2074
|
COMPARE_KEYS,
|
|
2071
2075
|
isRecordBound,
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
isEmbedded,
|
|
26
26
|
isFieldKey,
|
|
27
27
|
isRecordBound,
|
|
28
|
+
isTableId,
|
|
28
29
|
keepAccentsForm,
|
|
29
30
|
moduloDecimal,
|
|
30
31
|
multiplyDecimal,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
subtractDecimal,
|
|
52
53
|
sumDecimal,
|
|
53
54
|
urlParam
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-7OXMZ332.js";
|
|
55
56
|
|
|
56
57
|
// src/mount.tsx
|
|
57
58
|
import { createRoot } from "react-dom/client";
|
|
@@ -8360,6 +8361,7 @@ function rowWriteOf(step) {
|
|
|
8360
8361
|
|
|
8361
8362
|
// ../shared/src/walk_workflow_expression.ts
|
|
8362
8363
|
var LINKED_CALL = "linked";
|
|
8364
|
+
var TEXT_CALL = "text";
|
|
8363
8365
|
var GRAMMAR_NAME_SHAPE = `${LINKED_CALL}(record["fld_link"])[0] fetches one linked row`;
|
|
8364
8366
|
var RUNTIME_KEY_SET = new Set(RUNTIME_KEYS);
|
|
8365
8367
|
var CURRENT_MEMBER_IN_ANY_GROUP = "current_member_in_any_group";
|
|
@@ -8402,7 +8404,7 @@ function isHelper(name) {
|
|
|
8402
8404
|
return HELPERS.has(name);
|
|
8403
8405
|
}
|
|
8404
8406
|
var HELPER_MENU = [
|
|
8405
|
-
`text \u2014 ${Object.keys(expression_string_exports).sort().join(", ")}`,
|
|
8407
|
+
`text \u2014 ${[...Object.keys(expression_string_exports), TEXT_CALL].sort().join(", ")}`,
|
|
8406
8408
|
`number \u2014 ${Object.keys(expression_math_exports).sort().join(", ")}`,
|
|
8407
8409
|
`array \u2014 ${Object.keys(expression_array_exports).sort().join(", ")}`,
|
|
8408
8410
|
`object \u2014 ${Object.keys(expression_object_exports).sort().join(", ")}`,
|
|
@@ -9163,7 +9165,7 @@ function evaluateLambda(params, body, ctx, items) {
|
|
|
9163
9165
|
}
|
|
9164
9166
|
function evalAnchorContext(ctx) {
|
|
9165
9167
|
return {
|
|
9166
|
-
tables: ctx.tables,
|
|
9168
|
+
tables: ctx.tables.current,
|
|
9167
9169
|
steps_by_id: ctx.steps_by_id,
|
|
9168
9170
|
// The whole stack, so a read anchors to the loop it NAMES rather than to
|
|
9169
9171
|
// whichever is innermost — the anchor half of the same nesting bug.
|
|
@@ -9294,7 +9296,10 @@ async function readAfter(root, source, path, coerce, ctx) {
|
|
|
9294
9296
|
const value = await root;
|
|
9295
9297
|
return walkPath(path, coerce, ctx, readRecordAnchor(source, path, ctx.anchor_context), 0, value, null, void 0, void 0);
|
|
9296
9298
|
}
|
|
9297
|
-
function
|
|
9299
|
+
function knownTables(tables) {
|
|
9300
|
+
return { current: tables, hold: (tableId) => tables.get(tableId) ?? null };
|
|
9301
|
+
}
|
|
9302
|
+
function walkPath(path, coerce, ctx, anchor, from, start, startTable, startField, startTerminal, startCarried) {
|
|
9298
9303
|
let current = start;
|
|
9299
9304
|
let table = startTable;
|
|
9300
9305
|
let prevField = startField;
|
|
@@ -9303,7 +9308,13 @@ function walkPath(path, coerce, ctx, anchor, from, start, startTable, startField
|
|
|
9303
9308
|
const segment = path[i];
|
|
9304
9309
|
const isLast = i === path.length - 1;
|
|
9305
9310
|
if (anchor && i === anchor.envelopeLen) table ??= anchor.table;
|
|
9306
|
-
const
|
|
9311
|
+
const asked = i === from ? startCarried : void 0;
|
|
9312
|
+
const carried = asked === void 0 ? carriedTable(current, ctx) : asked;
|
|
9313
|
+
if (carried instanceof Promise) {
|
|
9314
|
+
return carried.then(
|
|
9315
|
+
(settled) => walkPath(path, coerce, ctx, anchor, i, current, table, prevField, terminalField, settled)
|
|
9316
|
+
);
|
|
9317
|
+
}
|
|
9307
9318
|
if (carried?.at === "self") table = carried.table;
|
|
9308
9319
|
const field = (segment.at === "field" || segment.at === "key") && table ? findField(table, segment.key) : void 0;
|
|
9309
9320
|
if (isLast) {
|
|
@@ -9313,10 +9324,14 @@ function walkPath(path, coerce, ctx, anchor, from, start, startTable, startField
|
|
|
9313
9324
|
if (walked instanceof Promise) {
|
|
9314
9325
|
return walkPending({ path, coerce, ctx, anchor, table, carried, field, terminal_field: terminalField }, i, walked);
|
|
9315
9326
|
}
|
|
9316
|
-
|
|
9327
|
+
if (walked === void 0 || walked === null) return walked;
|
|
9328
|
+
const next = tableAfter(segment, table, carried, ctx);
|
|
9329
|
+
if (next instanceof Promise) {
|
|
9330
|
+
return next.then((advanced) => walkPath(path, coerce, ctx, anchor, i + 1, walked, advanced, field, terminalField));
|
|
9331
|
+
}
|
|
9332
|
+
table = next;
|
|
9317
9333
|
prevField = field;
|
|
9318
9334
|
current = walked;
|
|
9319
|
-
if (current === void 0 || current === null) return current;
|
|
9320
9335
|
}
|
|
9321
9336
|
if (terminalField && isScalarWrappedField(terminalField)) {
|
|
9322
9337
|
current = unwrapScalarField(current);
|
|
@@ -9341,8 +9356,11 @@ function optionAliases(value, field) {
|
|
|
9341
9356
|
return resolve(value);
|
|
9342
9357
|
}
|
|
9343
9358
|
function coerceOptionAliases(value, of, ctx) {
|
|
9344
|
-
const
|
|
9345
|
-
|
|
9359
|
+
const held2 = heldTable(of.table_id, ctx);
|
|
9360
|
+
return held2 instanceof Promise ? held2.then((table) => aliasesOf(value, of, table, ctx)) : aliasesOf(value, of, held2, ctx);
|
|
9361
|
+
}
|
|
9362
|
+
function aliasesOf(value, of, table, ctx) {
|
|
9363
|
+
if (table === null) {
|
|
9346
9364
|
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 } });
|
|
9347
9365
|
}
|
|
9348
9366
|
const field = findField(table, of.field_key);
|
|
@@ -9360,12 +9378,11 @@ async function walkPending(read2, at2, walked) {
|
|
|
9360
9378
|
const { path, coerce, ctx, anchor, carried, field, terminal_field: terminalField } = read2;
|
|
9361
9379
|
const current = await walked;
|
|
9362
9380
|
if (current === void 0 || current === null) return current;
|
|
9363
|
-
const table = tableAfter(path[at2], read2.table, carried, ctx);
|
|
9381
|
+
const table = await tableAfter(path[at2], read2.table, carried, ctx);
|
|
9364
9382
|
return walkPath(path, coerce, ctx, anchor, at2 + 1, current, table, field, terminalField);
|
|
9365
9383
|
}
|
|
9366
9384
|
function tableAfter(segment, table, carried, ctx) {
|
|
9367
|
-
|
|
9368
|
-
return carried?.at === "data" && isKeyNamed(segment, "data") ? carried.table : advanced;
|
|
9385
|
+
return carried?.at === "data" && isKeyNamed(segment, "data") ? carried.table : advanceTable(segment, table, ctx);
|
|
9369
9386
|
}
|
|
9370
9387
|
function isScalarWrappedField(field) {
|
|
9371
9388
|
if (field.type === "formula") return field.formula.options !== void 0;
|
|
@@ -9377,9 +9394,15 @@ function unwrapScalarField(value) {
|
|
|
9377
9394
|
}
|
|
9378
9395
|
function carriedTable(value, ctx) {
|
|
9379
9396
|
if (!isPlainObject(value) || !("table_id" in value) || typeof value.table_id !== "string") return null;
|
|
9380
|
-
const
|
|
9381
|
-
|
|
9382
|
-
|
|
9397
|
+
const at2 = isPlainObject(value.data) ? "data" : "self";
|
|
9398
|
+
const table = heldTable(value.table_id, ctx);
|
|
9399
|
+
if (table instanceof Promise) return table.then((loaded2) => loaded2 === null ? null : { table: loaded2, at: at2 });
|
|
9400
|
+
return table === null ? null : { table, at: at2 };
|
|
9401
|
+
}
|
|
9402
|
+
function heldTable(tableId, ctx) {
|
|
9403
|
+
const held2 = ctx.tables.current.get(tableId);
|
|
9404
|
+
if (held2 !== void 0) return held2;
|
|
9405
|
+
return isTableId(tableId) ? ctx.tables.hold(tableId) : null;
|
|
9383
9406
|
}
|
|
9384
9407
|
function isPlainObject(value) {
|
|
9385
9408
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -9450,8 +9473,9 @@ async function coerceRecordLinkDisplay(value, field, ctx) {
|
|
|
9450
9473
|
}
|
|
9451
9474
|
if (!Array.isArray(value)) return value;
|
|
9452
9475
|
assertCheap(ctx.evaluation_budget, value);
|
|
9453
|
-
const
|
|
9454
|
-
|
|
9476
|
+
const held2 = heldTable(field.table_id, ctx);
|
|
9477
|
+
const target = held2 instanceof Promise ? await held2 : held2;
|
|
9478
|
+
if (target === null) {
|
|
9455
9479
|
throw new WorkflowEvalError(`Showing "${field.key}" reads rows of table ${field.table_id}, which this run does not hold.`, { kind: "unknown_table", extra: { table_id: field.table_id } });
|
|
9456
9480
|
}
|
|
9457
9481
|
const rows = await fetchRecordsBounded(
|
|
@@ -9467,7 +9491,7 @@ function advanceTable(segment, currentTable, ctx) {
|
|
|
9467
9491
|
if (segment.at === "linked" && currentTable) {
|
|
9468
9492
|
const linkField = findField(currentTable, segment.via);
|
|
9469
9493
|
if (linkField?.type === "select_record_link") {
|
|
9470
|
-
return
|
|
9494
|
+
return heldTable(linkField.table_id, ctx);
|
|
9471
9495
|
}
|
|
9472
9496
|
}
|
|
9473
9497
|
return null;
|
|
@@ -10294,7 +10318,7 @@ async function predictWorkflowEffects(input) {
|
|
|
10294
10318
|
helpers,
|
|
10295
10319
|
record_cache: cache,
|
|
10296
10320
|
fetch_record: fetchRecord,
|
|
10297
|
-
tables: input.tables,
|
|
10321
|
+
tables: knownTables(input.tables),
|
|
10298
10322
|
trigger_table: null,
|
|
10299
10323
|
member_lookup: async () => unread("member display"),
|
|
10300
10324
|
lexical_bindings: [{}],
|
package/dist/router.js
CHANGED
package/package.json
CHANGED