@ai-matrx/records-ui 0.115.89 → 0.115.91

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/CHANGELOG.md CHANGED
@@ -1,9 +1,29 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.115.91
4
+ ### Unreleased
5
+
6
+ - The internal `isUserId` helper (a local UUID regex) is gone; every caller uses `@ai-matrx/kit/uuid`'s `isUuidShape`, the same any-version, case-insensitive contract. It was never a public export. No consumer action.
7
+
8
+ ## 0.115.90
9
+
10
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
11
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
12
+ Diff: `git diff 152b8592f0 c55c74416d -- apps/shared/records-ui/src`
13
+
14
+ Changed shipped source files (2):
15
+ - `apps/shared/records-ui/src/FieldRetype.tsx`
16
+ - `apps/shared/records-ui/src/personRetype.ts`
17
+
3
18
  ## 0.115.89
4
19
 
5
- UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
- Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
20
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
21
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
22
+ Diff: `git diff 7560bf9edf 152b8592f0 -- apps/shared/records-ui/src`
23
+
24
+ Changed shipped source files (2):
25
+ - `apps/shared/records-ui/src/FieldRetype.tsx`
26
+ - `apps/shared/records-ui/src/personRetype.ts`
7
27
 
8
28
  ## 0.115.88
9
29
 
package/dist/index.cjs CHANGED
@@ -3147,12 +3147,11 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
3147
3147
  ] });
3148
3148
  }
3149
3149
 
3150
+ // src/memberNames.ts
3151
+ var import_uuid3 = require("@ai-matrx/kit/uuid");
3152
+
3150
3153
  // src/userIds.ts
3151
- var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3152
3154
  var PERSON_NOT_IN_ORGANIZATION = "A person no longer in this organization";
3153
- function isUserId(value) {
3154
- return typeof value === "string" && UUID.test(value);
3155
- }
3156
3155
 
3157
3156
  // src/memberNames.ts
3158
3157
  function memberWords(member) {
@@ -3198,7 +3197,7 @@ async function resolveKeptPerson(client, id, roster) {
3198
3197
  }
3199
3198
  function useKeptPeople(value, roster) {
3200
3199
  const client = (0, import_react14.useOptionalRecordsClient)();
3201
- const ids = (0, import_react13.useMemo)(() => (Array.isArray(value) ? value : [value]).filter(isUserId), [value]);
3200
+ const ids = (0, import_react13.useMemo)(() => (Array.isArray(value) ? value : [value]).filter(import_uuid3.isUuidShape), [value]);
3202
3201
  const key = ids.join(",");
3203
3202
  const [people, setPeople] = (0, import_react13.useState)(null);
3204
3203
  (0, import_react13.useEffect)(() => {
@@ -3217,10 +3216,11 @@ var recordVersions_exports = {};
3217
3216
  __reExport(recordVersions_exports, require("@ai-matrx/records/versions"));
3218
3217
 
3219
3218
  // src/personRetype.ts
3219
+ var import_uuid4 = require("@ai-matrx/kit/uuid");
3220
3220
  var PAGE = 500;
3221
3221
  var CEILING = 2e4;
3222
3222
  function idsIn(value) {
3223
- return (Array.isArray(value) ? value : [value]).filter(isUserId);
3223
+ return (Array.isArray(value) ? value : [value]).filter(import_uuid4.isUuidShape);
3224
3224
  }
3225
3225
  async function readPersonColumn(client, tableId, key) {
3226
3226
  const out = [];
@@ -3302,6 +3302,23 @@ function personWordsWritten(rows, people, as) {
3302
3302
  function personWordsPatches(rows, people, key, as) {
3303
3303
  return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words2]) => ({ recordId, patch: { [key]: words2 } }));
3304
3304
  }
3305
+ async function forgetWrittenWords(client, tableId, key, written) {
3306
+ const patches = [];
3307
+ for (let offset = 0; offset < CEILING; offset += PAGE) {
3308
+ const page = await client.list({ table_id: tableId, limit: PAGE, offset });
3309
+ if (!page.ok) throw new Error(refusalSentence(page.error));
3310
+ for (const row of page.data.rows) {
3311
+ const word = written[row.id];
3312
+ const kept = (row.document ?? {})["_retired"];
3313
+ if (word === void 0 || !Array.isArray(kept)) continue;
3314
+ const rest = kept.filter((e) => !(e?.key === key && e?.value === word));
3315
+ if (rest.length !== kept.length) patches.push({ recordId: row.id, patch: { _retired: rest } });
3316
+ }
3317
+ if (page.data.rows.length < PAGE) break;
3318
+ }
3319
+ await writeRecordPatches(client, tableId, patches);
3320
+ return patches.length;
3321
+ }
3305
3322
 
3306
3323
  // src/FieldRetype.tsx
3307
3324
  var import_jsx_runtime9 = require("react/jsx-runtime");
@@ -3431,7 +3448,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
3431
3448
  noun: "column",
3432
3449
  subject: name,
3433
3450
  undo: async () => {
3434
- const back = await client.migrateUndo({ migration_id: migration, ...wordsWritten ? { written: wordsWritten } : {} });
3451
+ const back = await client.migrateUndo({ migration_id: migration });
3435
3452
  if (!back.ok) throw new Error(refusalSentence(back.error));
3436
3453
  if (wasPerson) {
3437
3454
  await writeRecordPatches(
@@ -3439,6 +3456,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
3439
3456
  tableId,
3440
3457
  wasPerson.rows.map((r) => ({ recordId: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }))
3441
3458
  );
3459
+ if (wordsWritten) await forgetWrittenWords(client, tableId, field2.key, wordsWritten);
3442
3460
  }
3443
3461
  (0, import_react16.tableShapeChanged)(tableId);
3444
3462
  onRetyped?.();
@@ -7741,6 +7759,7 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
7741
7759
 
7742
7760
  // src/values.tsx
7743
7761
  var import_records21 = require("@ai-matrx/records");
7762
+ var import_uuid7 = require("@ai-matrx/kit/uuid");
7744
7763
 
7745
7764
  // src/personNames.ts
7746
7765
  var import_react44 = require("react");
@@ -7804,6 +7823,7 @@ var import_records20 = require("@ai-matrx/records");
7804
7823
  var import_react45 = require("react");
7805
7824
  var import_react46 = require("@ai-matrx/records/react");
7806
7825
  var import_design_system25 = require("@ai-matrx/design-system");
7826
+ var import_uuid5 = require("@ai-matrx/kit/uuid");
7807
7827
  var import_jsx_runtime28 = require("react/jsx-runtime");
7808
7828
  function same(a, b) {
7809
7829
  return JSON.stringify(a) === JSON.stringify(b);
@@ -7883,7 +7903,7 @@ function RetiredValues({
7883
7903
  const field2 = fields.find((f) => f.key === entry.key);
7884
7904
  const name = field2 ? fieldName(field2) : entry.label ?? entry.key;
7885
7905
  const shown5 = field2 ? scalarText(field2, entry.value) : typeof entry.value === "string" ? entry.value : JSON.stringify(entry.value);
7886
- const holdsUserId = (Array.isArray(entry.value) ? entry.value : [entry.value]).some(isUserId);
7906
+ const holdsUserId = (Array.isArray(entry.value) ? entry.value : [entry.value]).some(import_uuid5.isUuidShape);
7887
7907
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-0.5", "data-records-retired-key": entry.key, children: [
7888
7908
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-baseline gap-2", children: [
7889
7909
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: name }),
@@ -7904,6 +7924,7 @@ function RetiredValues({
7904
7924
  }
7905
7925
 
7906
7926
  // src/cellMarks.tsx
7927
+ var import_uuid6 = require("@ai-matrx/kit/uuid");
7907
7928
  var import_jsx_runtime29 = require("react/jsx-runtime");
7908
7929
  function keptAsideFor(document2, key) {
7909
7930
  const doc = document2;
@@ -7933,7 +7954,7 @@ function keptAsideReason(field2, entry) {
7933
7954
  function KeptAsideValue({ field: field2, entry, shown: shown5 }) {
7934
7955
  const why = keptAsideReason(field2, entry);
7935
7956
  const open = useRecordsUi().openPerson;
7936
- const person = (Array.isArray(entry.value) ? entry.value : [entry.value]).find(isUserId);
7957
+ const person = (Array.isArray(entry.value) ? entry.value : [entry.value]).find(import_uuid6.isUuidShape);
7937
7958
  const opens = open && typeof person === "string";
7938
7959
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7939
7960
  "span",
@@ -8159,7 +8180,7 @@ function LivePersonChip({ id, name }) {
8159
8180
  var NEVER_AN_ID_KINDS = /* @__PURE__ */ new Set(["member", "person", "number", "currency", "percent", "date", "datetime", "checkbox", "boolean"]);
8160
8181
  function personWordsOf(kind2, value) {
8161
8182
  const items = Array.isArray(value) ? value : [value];
8162
- const ids = items.filter(isUserId);
8183
+ const ids = items.filter(import_uuid7.isUuidShape);
8163
8184
  if (ids.length === 0) return null;
8164
8185
  const wordsColumn = !NEVER_AN_ID_KINDS.has(kind2);
8165
8186
  const named = ids.map((id) => knownPerson(id));
@@ -42676,6 +42697,7 @@ function ActionInbox({
42676
42697
  }
42677
42698
 
42678
42699
  // src/HistoryPanel.tsx
42700
+ var import_uuid8 = require("@ai-matrx/kit/uuid");
42679
42701
  var import_react250 = require("react");
42680
42702
 
42681
42703
  // src/undoChange.ts
@@ -43422,7 +43444,7 @@ function whenText(at) {
43422
43444
  function say(value, field2) {
43423
43445
  if (value === null || value === void 0 || value === "") return "nothing";
43424
43446
  if (field2) return scalarText(field2, value);
43425
- const ids = (Array.isArray(value) ? value : [value]).filter(isUserId);
43447
+ const ids = (Array.isArray(value) ? value : [value]).filter(import_uuid8.isUuidShape);
43426
43448
  if (ids.length > 0 && ids.length === (Array.isArray(value) ? value.length : 1)) {
43427
43449
  return ids.map((id) => knownPerson(id) ?? PERSON_NOT_IN_ORGANIZATION).join(", ");
43428
43450
  }
@@ -43432,6 +43454,7 @@ function say(value, field2) {
43432
43454
  }
43433
43455
 
43434
43456
  // src/CommentThread.tsx
43457
+ var import_uuid9 = require("@ai-matrx/kit/uuid");
43435
43458
  var import_react252 = require("react");
43436
43459
  var import_react253 = require("@ai-matrx/records/react");
43437
43460
  var import_design_system119 = require("@ai-matrx/design-system");
@@ -43666,7 +43689,7 @@ function Line2({
43666
43689
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("p", { className: "whitespace-pre-wrap text-xs", children: comment.body }),
43667
43690
  comment.mentions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { className: "text-[10px] text-muted-foreground", children: [
43668
43691
  "Told: ",
43669
- comment.mentions.map((m) => isUserId(m.name) ? PERSON_NOT_IN_ORGANIZATION : m.name).join(", ")
43692
+ comment.mentions.map((m) => (0, import_uuid9.isUuidShape)(m.name) ? PERSON_NOT_IN_ORGANIZATION : m.name).join(", ")
43670
43693
  ] }) : null
43671
43694
  ] });
43672
43695
  }
@@ -54029,7 +54052,7 @@ function useSlotScroll(slot) {
54029
54052
  }
54030
54053
 
54031
54054
  // src/TablePage.tsx
54032
- var import_uuid3 = require("@ai-matrx/kit/uuid");
54055
+ var import_uuid10 = require("@ai-matrx/kit/uuid");
54033
54056
  var import_outbound4 = require("@ai-matrx/kit/outbound");
54034
54057
  var import_jsx_runtime178 = require("react/jsx-runtime");
54035
54058
  var RAIL_TITLE = {
@@ -54261,7 +54284,7 @@ function openingView(activeView, activeDashboardId) {
54261
54284
  }
54262
54285
  function savedViewFromParam(activeView) {
54263
54286
  const word = typeof activeView === "string" ? activeView.trim() : "";
54264
- return (0, import_uuid3.isUuidShape)(word) ? word.toLowerCase() : null;
54287
+ return (0, import_uuid10.isUuidShape)(word) ? word.toLowerCase() : null;
54265
54288
  }
54266
54289
  function addressForView(view, layout) {
54267
54290
  return view && !view.isDefault ? view.id : layout;
@@ -55299,7 +55322,7 @@ function TablePage({
55299
55322
  QuestionPanel,
55300
55323
  {
55301
55324
  tableId,
55302
- activeQuestionId: questionsFromLink && activeItemId && (0, import_uuid3.isUuidShape)(activeItemId) ? activeItemId : null,
55325
+ activeQuestionId: questionsFromLink && activeItemId && (0, import_uuid10.isUuidShape)(activeItemId) ? activeItemId : null,
55303
55326
  draft: questionDraft
55304
55327
  }
55305
55328
  ) : main === "archived" ? (