@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.
@@ -899,6 +899,7 @@ function rememberedOpCount() {
899
899
  var SYSTEM_CONTEXT_TYPE_ID = "__system__";
900
900
 
901
901
  // src/scopes/codec.ts
902
+ var import_uuid2 = require("@ai-matrx/kit/uuid");
902
903
  var str = (v, fallback = "") => typeof v === "string" ? v : fallback;
903
904
  var strOrNull = (v) => typeof v === "string" ? v : null;
904
905
  var num = (v, fallback = 0) => {
@@ -1114,7 +1115,6 @@ function systemContextFieldFromStore(row, index) {
1114
1115
  item_class: strOrNull(row.item_class)
1115
1116
  };
1116
1117
  }
1117
- var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1118
1118
  function referencesOf(row) {
1119
1119
  const v = row.value;
1120
1120
  const list = Array.isArray(v) ? v : v == null ? [] : [v];
@@ -1124,7 +1124,7 @@ function referencesOf(row) {
1124
1124
  const out = [];
1125
1125
  for (const el of list) {
1126
1126
  let ref = null;
1127
- if (typeof el === "string" && UUID.test(el)) ref = { id: el, type: toFile ? "file" : "scope" };
1127
+ if (typeof el === "string" && (0, import_uuid2.isUuidShape)(el)) ref = { id: el, type: toFile ? "file" : "scope" };
1128
1128
  else if (el && typeof el === "object" && typeof el.id === "string") {
1129
1129
  const token = String(el.token ?? "");
1130
1130
  const own = el.label;
@@ -1611,7 +1611,7 @@ function createScopeDoors(call) {
1611
1611
  }
1612
1612
 
1613
1613
  // src/choice.ts
1614
- var import_uuid2 = require("@ai-matrx/kit/uuid");
1614
+ var import_uuid3 = require("@ai-matrx/kit/uuid");
1615
1615
  function optionKey(option) {
1616
1616
  const stored = option.metadata?.["option_key"];
1617
1617
  if (typeof stored === "string" && stored.trim() !== "") return stored;
@@ -1650,7 +1650,7 @@ function holdsARetiredChoice(document, fieldKeyOrId) {
1650
1650
  return choicesOf(document, fieldKeyOrId).some((c) => c.retired === true);
1651
1651
  }
1652
1652
  function looksLikeAnId(value) {
1653
- return typeof value === "string" && (0, import_uuid2.isUuidShape)(value);
1653
+ return typeof value === "string" && (0, import_uuid3.isUuidShape)(value);
1654
1654
  }
1655
1655
  var CHOICE_NUDGES = ["ask", "always_add", "never_add"];
1656
1656
  function asChoiceNudge(value) {
@@ -11008,7 +11008,7 @@ async function archiveTableRow(client, table, rowId) {
11008
11008
  }
11009
11009
 
11010
11010
  // src/data/table-port.ts
11011
- var import_uuid4 = require("@ai-matrx/kit/uuid");
11011
+ var import_uuid5 = require("@ai-matrx/kit/uuid");
11012
11012
 
11013
11013
  // src/button.ts
11014
11014
  var BUTTON_DOES = ["open_url", "run_action", "run_automation"];
@@ -11461,7 +11461,7 @@ function readTypedNumber(raw) {
11461
11461
  }
11462
11462
 
11463
11463
  // src/coerce.ts
11464
- var import_uuid3 = require("@ai-matrx/kit/uuid");
11464
+ var import_uuid4 = require("@ai-matrx/kit/uuid");
11465
11465
  var FIELD_KINDS = [
11466
11466
  "attachment",
11467
11467
  "checkbox",
@@ -11542,7 +11542,7 @@ function relationNamesIn(field2, text2) {
11542
11542
  const t = text2.trim();
11543
11543
  if (t === "") return [];
11544
11544
  const parts = field2.multi ? splitListCell(t) : [t];
11545
- return parts.filter((p) => !(0, import_uuid3.isUuidShape)(p));
11545
+ return parts.filter((p) => !(0, import_uuid4.isUuidShape)(p));
11546
11546
  }
11547
11547
  var MONEY_SYMBOLS = { $: "USD", "\u20AC": "EUR", "\xA3": "GBP", "\u20B9": "INR", "\u20A9": "KRW", "\u20AA": "ILS", "\u20BA": "TRY", "\u20BD": "RUB" };
11548
11548
  function columnCurrency(unit) {
@@ -11704,12 +11704,12 @@ function coerceTypedAnswer(field2, raw, opts = {}) {
11704
11704
  // value and not a refusal; the store, not this mirror, decides whether the
11705
11705
  // id is somebody here.
11706
11706
  case "member":
11707
- if ((0, import_uuid3.isUuidShape)(text2)) return { value: text2.toLowerCase() };
11707
+ if ((0, import_uuid4.isUuidShape)(text2)) return { value: text2.toLowerCase() };
11708
11708
  return {
11709
11709
  refusal: `${label} names a person in this organization, so it is chosen rather than typed. Open it and pick them.`
11710
11710
  };
11711
11711
  case "attachment":
11712
- if ((0, import_uuid3.isUuidShape)(text2)) return { value: text2.toLowerCase() };
11712
+ if ((0, import_uuid4.isUuidShape)(text2)) return { value: text2.toLowerCase() };
11713
11713
  return {
11714
11714
  refusal: `${label} holds a file, which cannot arrive as typed-in text. Open it and attach the file.`
11715
11715
  };
@@ -11720,7 +11720,7 @@ function coerceTypedAnswer(field2, raw, opts = {}) {
11720
11720
  const none = [];
11721
11721
  const many = [];
11722
11722
  for (const part of parts) {
11723
- if ((0, import_uuid3.isUuidShape)(part)) {
11723
+ if ((0, import_uuid4.isUuidShape)(part)) {
11724
11724
  if (!ids.includes(part.toLowerCase())) ids.push(part.toLowerCase());
11725
11725
  continue;
11726
11726
  }
@@ -11754,7 +11754,7 @@ function coerceTypedAnswer(field2, raw, opts = {}) {
11754
11754
  const [maybeToken, maybeId] = text2.includes(":") ? text2.split(/:(.*)/s, 2) : ["", text2];
11755
11755
  const token = (maybeToken ?? "").trim().toLowerCase() || (allowed.length === 1 ? allowed[0] : "");
11756
11756
  const id = (maybeId ?? "").trim();
11757
- if (token && (0, import_uuid3.isUuidShape)(id)) {
11757
+ if (token && (0, import_uuid4.isUuidShape)(id)) {
11758
11758
  const ref = { token, id: id.toLowerCase() };
11759
11759
  return { value: field2.multi ? [ref] : ref };
11760
11760
  }
@@ -11995,7 +11995,7 @@ function entityRefsOf2(value, kinds) {
11995
11995
  const out = [];
11996
11996
  for (const item2 of items) {
11997
11997
  const id = typeof item2 === "string" ? item2 : item2 && typeof item2 === "object" ? item2.id : null;
11998
- if (typeof id !== "string" || !(0, import_uuid4.isUuidShape)(id)) continue;
11998
+ if (typeof id !== "string" || !(0, import_uuid5.isUuidShape)(id)) continue;
11999
11999
  const raw = item2 && typeof item2 === "object" ? item2.token : null;
12000
12000
  const token = typeof raw === "string" && raw && raw !== CUSTOM_ROW_TOKEN ? raw : kinds[0];
12001
12001
  if (token) out.push({ token, id });
@@ -12007,7 +12007,7 @@ function relationIdsOf(value) {
12007
12007
  const out = [];
12008
12008
  for (const item2 of items) {
12009
12009
  const id = typeof item2 === "string" ? item2 : item2 && typeof item2 === "object" ? item2.id : null;
12010
- if (typeof id === "string" && (0, import_uuid4.isUuidShape)(id)) out.push(id);
12010
+ if (typeof id === "string" && (0, import_uuid5.isUuidShape)(id)) out.push(id);
12011
12011
  }
12012
12012
  return out;
12013
12013
  }
@@ -12104,7 +12104,7 @@ function createTableDataPort({ client, aliases }) {
12104
12104
  async function getRow(alias, id) {
12105
12105
  const binding = bindingOf(alias);
12106
12106
  if (!binding) return noSuchAlias(alias);
12107
- if (!(0, import_uuid4.isUuidShape)(id)) return refuse2("invalid_argument", `"${String(id)}" is not a row id.`);
12107
+ if (!(0, import_uuid5.isUuidShape)(id)) return refuse2("invalid_argument", `"${String(id)}" is not a row id.`);
12108
12108
  const shape = await shapeOf(alias, binding);
12109
12109
  if (!shape.ok) return shape;
12110
12110
  const read = await readByIds(binding, [id]);
@@ -12353,7 +12353,7 @@ function useStoreTable(table, options = {}) {
12353
12353
  }
12354
12354
 
12355
12355
  // src/typed-table/graduate.ts
12356
- var import_uuid5 = require("@ai-matrx/kit/uuid");
12356
+ var import_uuid6 = require("@ai-matrx/kit/uuid");
12357
12357
  var TO_CUSTOM_FIELDS = "custom_fields";
12358
12358
  var TO_ASSOCIATION = "association";
12359
12359
  var GRADUATION_BASE_COLUMNS = [
@@ -12415,7 +12415,7 @@ function graduationProblems(fields, graduation) {
12415
12415
  }
12416
12416
  function idsOf(value) {
12417
12417
  const list = Array.isArray(value) ? value : value === null || value === void 0 ? [] : [value];
12418
- return list.filter((v) => typeof v === "string" && (0, import_uuid5.isUuidShape)(v));
12418
+ return list.filter((v) => typeof v === "string" && (0, import_uuid6.isUuidShape)(v));
12419
12419
  }
12420
12420
  function graduatedRow(fields, graduation, snapshot) {
12421
12421
  const row = {
@@ -12908,7 +12908,7 @@ function allowsOtherValues(field2) {
12908
12908
  }
12909
12909
 
12910
12910
  // src/retype.ts
12911
- var import_uuid6 = require("@ai-matrx/kit/uuid");
12911
+ var import_uuid7 = require("@ai-matrx/kit/uuid");
12912
12912
  var TRUE_WORDS2 = /* @__PURE__ */ new Set(["true", "t", "yes", "y", "1", "on", "x", "\u2713", "\u2714"]);
12913
12913
  var FALSE_WORDS2 = /* @__PURE__ */ new Set(["false", "f", "no", "n", "0", "off", "\u2610"]);
12914
12914
  function valueConverts(to, value) {
@@ -12929,7 +12929,7 @@ function valueConverts(to, value) {
12929
12929
  return text2.trim() !== "" && /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i.test(text2.trim());
12930
12930
  case "list":
12931
12931
  case "relation":
12932
- return typeof value === "string" && (0, import_uuid6.isUuidShape)(text2);
12932
+ return typeof value === "string" && (0, import_uuid7.isUuidShape)(text2);
12933
12933
  default:
12934
12934
  return false;
12935
12935
  }
@@ -13467,7 +13467,7 @@ function scopeChip(scope) {
13467
13467
  }
13468
13468
 
13469
13469
  // src/table-kind.ts
13470
- var import_uuid7 = require("@ai-matrx/kit/uuid");
13470
+ var import_uuid8 = require("@ai-matrx/kit/uuid");
13471
13471
 
13472
13472
  // src/table-kind-mapping.json
13473
13473
  var table_kind_mapping_default = {
@@ -13553,7 +13553,7 @@ function tableKindMapping() {
13553
13553
  return M;
13554
13554
  }
13555
13555
  function isTableKind(slug) {
13556
- return typeof slug === "string" && slug.startsWith(TABLE_KIND_PREFIX) && (0, import_uuid7.isLowercaseUuidShape)(slug.slice(TABLE_KIND_PREFIX.length));
13556
+ return typeof slug === "string" && slug.startsWith(TABLE_KIND_PREFIX) && (0, import_uuid8.isLowercaseUuidShape)(slug.slice(TABLE_KIND_PREFIX.length));
13557
13557
  }
13558
13558
  function tableKindSlug(tableId) {
13559
13559
  const slug = `${TABLE_KIND_PREFIX}${String(tableId).trim().toLowerCase()}`;