@ai-matrx/records 0.99.14 → 0.99.15

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.
@@ -578,6 +578,7 @@ function rememberedOpCount() {
578
578
  var SYSTEM_CONTEXT_TYPE_ID = "__system__";
579
579
 
580
580
  // src/scopes/codec.ts
581
+ import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
581
582
  var str = (v, fallback = "") => typeof v === "string" ? v : fallback;
582
583
  var strOrNull = (v) => typeof v === "string" ? v : null;
583
584
  var num = (v, fallback = 0) => {
@@ -793,7 +794,6 @@ function systemContextFieldFromStore(row, index) {
793
794
  item_class: strOrNull(row.item_class)
794
795
  };
795
796
  }
796
- var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
797
797
  function referencesOf(row) {
798
798
  const v = row.value;
799
799
  const list = Array.isArray(v) ? v : v == null ? [] : [v];
@@ -803,7 +803,7 @@ function referencesOf(row) {
803
803
  const out = [];
804
804
  for (const el of list) {
805
805
  let ref = null;
806
- if (typeof el === "string" && UUID.test(el)) ref = { id: el, type: toFile ? "file" : "scope" };
806
+ if (typeof el === "string" && isUuidShape2(el)) ref = { id: el, type: toFile ? "file" : "scope" };
807
807
  else if (el && typeof el === "object" && typeof el.id === "string") {
808
808
  const token = String(el.token ?? "");
809
809
  const own = el.label;
@@ -1290,7 +1290,7 @@ function createScopeDoors(call) {
1290
1290
  }
1291
1291
 
1292
1292
  // src/choice.ts
1293
- import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
1293
+ import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
1294
1294
  function optionKey(option) {
1295
1295
  const stored = option.metadata?.["option_key"];
1296
1296
  if (typeof stored === "string" && stored.trim() !== "") return stored;
@@ -1329,7 +1329,7 @@ function holdsARetiredChoice(document, fieldKeyOrId) {
1329
1329
  return choicesOf(document, fieldKeyOrId).some((c) => c.retired === true);
1330
1330
  }
1331
1331
  function looksLikeAnId(value) {
1332
- return typeof value === "string" && isUuidShape2(value);
1332
+ return typeof value === "string" && isUuidShape3(value);
1333
1333
  }
1334
1334
  var CHOICE_NUDGES = ["ask", "always_add", "never_add"];
1335
1335
  function asChoiceNudge(value) {
@@ -10687,7 +10687,7 @@ async function archiveTableRow(client, table, rowId) {
10687
10687
  }
10688
10688
 
10689
10689
  // src/data/table-port.ts
10690
- import { isUuidShape as isUuidShape4 } from "@ai-matrx/kit/uuid";
10690
+ import { isUuidShape as isUuidShape5 } from "@ai-matrx/kit/uuid";
10691
10691
 
10692
10692
  // src/button.ts
10693
10693
  var BUTTON_DOES = ["open_url", "run_action", "run_automation"];
@@ -11140,7 +11140,7 @@ function readTypedNumber(raw) {
11140
11140
  }
11141
11141
 
11142
11142
  // src/coerce.ts
11143
- import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
11143
+ import { isUuidShape as isUuidShape4 } from "@ai-matrx/kit/uuid";
11144
11144
  var FIELD_KINDS = [
11145
11145
  "attachment",
11146
11146
  "checkbox",
@@ -11221,7 +11221,7 @@ function relationNamesIn(field2, text2) {
11221
11221
  const t = text2.trim();
11222
11222
  if (t === "") return [];
11223
11223
  const parts = field2.multi ? splitListCell(t) : [t];
11224
- return parts.filter((p) => !isUuidShape3(p));
11224
+ return parts.filter((p) => !isUuidShape4(p));
11225
11225
  }
11226
11226
  var MONEY_SYMBOLS = { $: "USD", "\u20AC": "EUR", "\xA3": "GBP", "\u20B9": "INR", "\u20A9": "KRW", "\u20AA": "ILS", "\u20BA": "TRY", "\u20BD": "RUB" };
11227
11227
  function columnCurrency(unit) {
@@ -11383,12 +11383,12 @@ function coerceTypedAnswer(field2, raw, opts = {}) {
11383
11383
  // value and not a refusal; the store, not this mirror, decides whether the
11384
11384
  // id is somebody here.
11385
11385
  case "member":
11386
- if (isUuidShape3(text2)) return { value: text2.toLowerCase() };
11386
+ if (isUuidShape4(text2)) return { value: text2.toLowerCase() };
11387
11387
  return {
11388
11388
  refusal: `${label} names a person in this organization, so it is chosen rather than typed. Open it and pick them.`
11389
11389
  };
11390
11390
  case "attachment":
11391
- if (isUuidShape3(text2)) return { value: text2.toLowerCase() };
11391
+ if (isUuidShape4(text2)) return { value: text2.toLowerCase() };
11392
11392
  return {
11393
11393
  refusal: `${label} holds a file, which cannot arrive as typed-in text. Open it and attach the file.`
11394
11394
  };
@@ -11399,7 +11399,7 @@ function coerceTypedAnswer(field2, raw, opts = {}) {
11399
11399
  const none = [];
11400
11400
  const many = [];
11401
11401
  for (const part of parts) {
11402
- if (isUuidShape3(part)) {
11402
+ if (isUuidShape4(part)) {
11403
11403
  if (!ids.includes(part.toLowerCase())) ids.push(part.toLowerCase());
11404
11404
  continue;
11405
11405
  }
@@ -11433,7 +11433,7 @@ function coerceTypedAnswer(field2, raw, opts = {}) {
11433
11433
  const [maybeToken, maybeId] = text2.includes(":") ? text2.split(/:(.*)/s, 2) : ["", text2];
11434
11434
  const token = (maybeToken ?? "").trim().toLowerCase() || (allowed.length === 1 ? allowed[0] : "");
11435
11435
  const id = (maybeId ?? "").trim();
11436
- if (token && isUuidShape3(id)) {
11436
+ if (token && isUuidShape4(id)) {
11437
11437
  const ref = { token, id: id.toLowerCase() };
11438
11438
  return { value: field2.multi ? [ref] : ref };
11439
11439
  }
@@ -11674,7 +11674,7 @@ function entityRefsOf2(value, kinds) {
11674
11674
  const out = [];
11675
11675
  for (const item2 of items) {
11676
11676
  const id = typeof item2 === "string" ? item2 : item2 && typeof item2 === "object" ? item2.id : null;
11677
- if (typeof id !== "string" || !isUuidShape4(id)) continue;
11677
+ if (typeof id !== "string" || !isUuidShape5(id)) continue;
11678
11678
  const raw = item2 && typeof item2 === "object" ? item2.token : null;
11679
11679
  const token = typeof raw === "string" && raw && raw !== CUSTOM_ROW_TOKEN ? raw : kinds[0];
11680
11680
  if (token) out.push({ token, id });
@@ -11686,7 +11686,7 @@ function relationIdsOf(value) {
11686
11686
  const out = [];
11687
11687
  for (const item2 of items) {
11688
11688
  const id = typeof item2 === "string" ? item2 : item2 && typeof item2 === "object" ? item2.id : null;
11689
- if (typeof id === "string" && isUuidShape4(id)) out.push(id);
11689
+ if (typeof id === "string" && isUuidShape5(id)) out.push(id);
11690
11690
  }
11691
11691
  return out;
11692
11692
  }
@@ -11783,7 +11783,7 @@ function createTableDataPort({ client, aliases }) {
11783
11783
  async function getRow(alias, id) {
11784
11784
  const binding = bindingOf(alias);
11785
11785
  if (!binding) return noSuchAlias(alias);
11786
- if (!isUuidShape4(id)) return refuse2("invalid_argument", `"${String(id)}" is not a row id.`);
11786
+ if (!isUuidShape5(id)) return refuse2("invalid_argument", `"${String(id)}" is not a row id.`);
11787
11787
  const shape = await shapeOf(alias, binding);
11788
11788
  if (!shape.ok) return shape;
11789
11789
  const read = await readByIds(binding, [id]);
@@ -12032,7 +12032,7 @@ function useStoreTable(table, options = {}) {
12032
12032
  }
12033
12033
 
12034
12034
  // src/typed-table/graduate.ts
12035
- import { isUuidShape as isUuidShape5 } from "@ai-matrx/kit/uuid";
12035
+ import { isUuidShape as isUuidShape6 } from "@ai-matrx/kit/uuid";
12036
12036
  var TO_CUSTOM_FIELDS = "custom_fields";
12037
12037
  var TO_ASSOCIATION = "association";
12038
12038
  var GRADUATION_BASE_COLUMNS = [
@@ -12094,7 +12094,7 @@ function graduationProblems(fields, graduation) {
12094
12094
  }
12095
12095
  function idsOf(value) {
12096
12096
  const list = Array.isArray(value) ? value : value === null || value === void 0 ? [] : [value];
12097
- return list.filter((v) => typeof v === "string" && isUuidShape5(v));
12097
+ return list.filter((v) => typeof v === "string" && isUuidShape6(v));
12098
12098
  }
12099
12099
  function graduatedRow(fields, graduation, snapshot) {
12100
12100
  const row = {
@@ -12587,7 +12587,7 @@ function allowsOtherValues(field2) {
12587
12587
  }
12588
12588
 
12589
12589
  // src/retype.ts
12590
- import { isUuidShape as isUuidShape6 } from "@ai-matrx/kit/uuid";
12590
+ import { isUuidShape as isUuidShape7 } from "@ai-matrx/kit/uuid";
12591
12591
  var TRUE_WORDS2 = /* @__PURE__ */ new Set(["true", "t", "yes", "y", "1", "on", "x", "\u2713", "\u2714"]);
12592
12592
  var FALSE_WORDS2 = /* @__PURE__ */ new Set(["false", "f", "no", "n", "0", "off", "\u2610"]);
12593
12593
  function valueConverts(to, value) {
@@ -12608,7 +12608,7 @@ function valueConverts(to, value) {
12608
12608
  return text2.trim() !== "" && /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i.test(text2.trim());
12609
12609
  case "list":
12610
12610
  case "relation":
12611
- return typeof value === "string" && isUuidShape6(text2);
12611
+ return typeof value === "string" && isUuidShape7(text2);
12612
12612
  default:
12613
12613
  return false;
12614
12614
  }