@lotics/app-sdk 0.133.6 → 0.133.8
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.
|
@@ -522,6 +522,13 @@ var ID_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy
|
|
|
522
522
|
var ID_LENGTH = 12;
|
|
523
523
|
var nanoid = customAlphabet(ID_ALPHABET, ID_LENGTH);
|
|
524
524
|
var RECORD_ID_PATTERN = new RegExp(`^rec_[${ID_ALPHABET}]{${ID_LENGTH}}$`);
|
|
525
|
+
var STORED_RECORD_ID_PATTERN = new RegExp(
|
|
526
|
+
`^rec_[${ID_ALPHABET}]{${ID_LENGTH}}$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`,
|
|
527
|
+
"i"
|
|
528
|
+
);
|
|
529
|
+
function isStoredRecordId(value) {
|
|
530
|
+
return STORED_RECORD_ID_PATTERN.test(value);
|
|
531
|
+
}
|
|
525
532
|
var FILE_ID_PATTERN = new RegExp(`^fil_[${ID_ALPHABET}]{${ID_LENGTH}}$`);
|
|
526
533
|
var TABLE_ID_PATTERN = new RegExp(
|
|
527
534
|
`^tbl_[${ID_ALPHABET}]+$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`,
|
|
@@ -2292,6 +2299,7 @@ export {
|
|
|
2292
2299
|
keepAccentsForm,
|
|
2293
2300
|
searchWords,
|
|
2294
2301
|
customAlphabet,
|
|
2302
|
+
isStoredRecordId,
|
|
2295
2303
|
isTableId,
|
|
2296
2304
|
isFieldKey,
|
|
2297
2305
|
COMPARE_KEYS,
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
isEmbedded,
|
|
30
30
|
isFieldKey,
|
|
31
31
|
isRecordBound,
|
|
32
|
+
isStoredRecordId,
|
|
32
33
|
isTableId,
|
|
33
34
|
keepAccentsForm,
|
|
34
35
|
moduloDecimal,
|
|
@@ -61,7 +62,7 @@ import {
|
|
|
61
62
|
subtractDecimal,
|
|
62
63
|
sumDecimal,
|
|
63
64
|
urlParam
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-DRX4M4FJ.js";
|
|
65
66
|
|
|
66
67
|
// src/mount.tsx
|
|
67
68
|
import { createRoot } from "react-dom/client";
|
|
@@ -9817,7 +9818,7 @@ async function coerceMemberDisplay(value, ctx) {
|
|
|
9817
9818
|
return shown;
|
|
9818
9819
|
}
|
|
9819
9820
|
async function coerceRecordLinkDisplay(value, field, ctx) {
|
|
9820
|
-
if (typeof value === "string" && value
|
|
9821
|
+
if (typeof value === "string" && isStoredRecordId(value)) {
|
|
9821
9822
|
const [text2] = await coerceRecordLinkDisplay([value], field, ctx);
|
|
9822
9823
|
return text2;
|
|
9823
9824
|
}
|
|
@@ -9855,7 +9856,7 @@ function walkSegment(value, segment, ctx) {
|
|
|
9855
9856
|
case "field": {
|
|
9856
9857
|
if (value === null || value === void 0) return void 0;
|
|
9857
9858
|
if (typeof value === "string") {
|
|
9858
|
-
if (value
|
|
9859
|
+
if (isStoredRecordId(value)) {
|
|
9859
9860
|
if (segment.key === "id") return value;
|
|
9860
9861
|
throw new WorkflowEvalError(
|
|
9861
9862
|
`Cannot read "${segment.key}" off "${value}" \u2014 it is a record id, not a record. A link cell holds record ids; fetch the rows with linked(...) (e.g. linked(record["fld_link"])[0]["fld_x"]), or get_record({ table_id, record_id }) this id.`,
|
|
@@ -9933,7 +9934,7 @@ async function walkLinked(value, segment, ctx) {
|
|
|
9933
9934
|
}
|
|
9934
9935
|
function linkIds(value, via) {
|
|
9935
9936
|
if (value === void 0 || value === null) return [];
|
|
9936
|
-
if (typeof value === "string" && value
|
|
9937
|
+
if (typeof value === "string" && isStoredRecordId(value)) return [value];
|
|
9937
9938
|
if (!Array.isArray(value)) {
|
|
9938
9939
|
throw new WorkflowEvalError(
|
|
9939
9940
|
`Linked field "${via}" must be an array of record IDs (string[]), got ${typeof value}`,
|
package/dist/router.js
CHANGED
package/docs/mutations.md
CHANGED
|
@@ -440,8 +440,8 @@ Row-level query results carry a `__source_locked` addressing column automaticall
|
|
|
440
440
|
project/filter/sort/join but not grouping, where rows stop being records).
|
|
441
441
|
`readLocked(row)` — pass the **whole row**, not a cell — returns `true` for a locked record,
|
|
442
442
|
`false` when the flag is absent (`dist/row.d.ts`). Use it to render a locked state and to
|
|
443
|
-
switch the save path. `readLockedBy(row)` names who can change it — its table
|
|
444
|
-
|
|
443
|
+
switch the save path. `readLockedBy(row)` names who can change it — the people who manage its table (its owner, its
|
|
444
|
+
managers and its workspace's admins) — for a member of the app's organization; `[]` for anyone else.
|
|
445
445
|
|
|
446
446
|
### What a write against a locked record does
|
|
447
447
|
|
|
@@ -487,7 +487,7 @@ Contract points:
|
|
|
487
487
|
a whole. Include every changed field in the same call; don't submit per-field requests.
|
|
488
488
|
- **Nothing changes immediately.** The tool returns
|
|
489
489
|
`{ request_id, status: "pending" }`; the record's values update only when an
|
|
490
|
-
approver (the
|
|
490
|
+
approver (one of the people who manage the table) accepts. The submission
|
|
491
491
|
succeeds, so the automatic re-read fires and returns the *old* values — that is correct,
|
|
492
492
|
and it is why the pending state must come from the RESULT rather than from the row. Render
|
|
493
493
|
it from `data.request_id`; don't poll the record for values no one has approved yet.
|
package/package.json
CHANGED