@ai-matrx/records-ui 0.115.87 → 0.115.88
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 +19 -1
- package/dist/index.cjs +41 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -19
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +36 -13
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +37 -13
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2590,6 +2590,11 @@ function useKeptPeople(value, roster) {
|
|
|
2590
2590
|
return people;
|
|
2591
2591
|
}
|
|
2592
2592
|
|
|
2593
|
+
// src/recordVersions.ts
|
|
2594
|
+
var recordVersions_exports = {};
|
|
2595
|
+
__reExport(recordVersions_exports, versions_star2);
|
|
2596
|
+
import * as versions_star2 from "@ai-matrx/records/versions";
|
|
2597
|
+
|
|
2593
2598
|
// src/personRetype.ts
|
|
2594
2599
|
var PAGE = 500;
|
|
2595
2600
|
var CEILING = 2e4;
|
|
@@ -2600,7 +2605,7 @@ async function readPersonColumn(client, tableId, key) {
|
|
|
2600
2605
|
const out = [];
|
|
2601
2606
|
for (let offset = 0; offset < CEILING; offset += PAGE) {
|
|
2602
2607
|
const page = await client.list({ table_id: tableId, limit: PAGE, offset });
|
|
2603
|
-
if (!page.ok) throw new Error(page.error
|
|
2608
|
+
if (!page.ok) throw new Error(refusalSentence(page.error));
|
|
2604
2609
|
for (const row of page.data.rows) {
|
|
2605
2610
|
const doc = row.document ?? {};
|
|
2606
2611
|
let ids = idsIn(doc[key]);
|
|
@@ -2638,17 +2643,36 @@ function previewPersonWords(rows, people, as) {
|
|
|
2638
2643
|
}
|
|
2639
2644
|
return { converts, keptAside, examples, partial: false };
|
|
2640
2645
|
}
|
|
2646
|
+
async function versionsNow(client, ids) {
|
|
2647
|
+
const out = /* @__PURE__ */ new Map();
|
|
2648
|
+
for (let i = 0; i < ids.length; i += 200) {
|
|
2649
|
+
const got = await client.recordHeaders({ ids: ids.slice(i, i + 200) });
|
|
2650
|
+
if (!got.ok) throw new Error(refusalSentence(got.error));
|
|
2651
|
+
for (const h of got.data ?? []) if (typeof h.version === "number") out.set(h.id, h.version);
|
|
2652
|
+
}
|
|
2653
|
+
return out;
|
|
2654
|
+
}
|
|
2655
|
+
async function writeRecordPatches(client, tableId, patches) {
|
|
2656
|
+
const versions = await versionsNow(client, patches.map((p) => p.recordId));
|
|
2657
|
+
for (let i = 0; i < patches.length; i += 100) {
|
|
2658
|
+
const changes = patches.slice(i, i + 100).map((p) => ({
|
|
2659
|
+
op: "update",
|
|
2660
|
+
record_id: p.recordId,
|
|
2661
|
+
patch: p.patch,
|
|
2662
|
+
expected_version: versions.get(p.recordId) ?? null
|
|
2663
|
+
}));
|
|
2664
|
+
const done = await (0, recordVersions_exports.changeRecordsAt)(client, { table_id: tableId, changes });
|
|
2665
|
+
if (!done.ok) throw new Error(refusalSentence(done.error));
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2641
2668
|
async function writePersonWords(client, tableId, rows, people, key, as) {
|
|
2642
|
-
const
|
|
2669
|
+
const patches = [];
|
|
2643
2670
|
for (const row of rows) {
|
|
2644
2671
|
const words2 = wordsFor(row.ids, people, as);
|
|
2645
|
-
if (words2 !== null)
|
|
2672
|
+
if (words2 !== null) patches.push({ recordId: row.recordId, patch: { [key]: words2 } });
|
|
2646
2673
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
if (!done.ok) throw new Error(done.error.message ?? "The words could not be written");
|
|
2650
|
-
}
|
|
2651
|
-
return changes.length;
|
|
2674
|
+
await writeRecordPatches(client, tableId, patches);
|
|
2675
|
+
return patches.length;
|
|
2652
2676
|
}
|
|
2653
2677
|
|
|
2654
2678
|
// src/FieldRetype.tsx
|
|
@@ -2781,11 +2805,11 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2781
2805
|
const back = await client.migrateUndo({ migration_id: migration });
|
|
2782
2806
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
2783
2807
|
if (wasPerson) {
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2808
|
+
await writeRecordPatches(
|
|
2809
|
+
client,
|
|
2810
|
+
tableId,
|
|
2811
|
+
wasPerson.rows.map((r) => ({ recordId: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }))
|
|
2812
|
+
);
|
|
2789
2813
|
}
|
|
2790
2814
|
tableShapeChanged(tableId);
|
|
2791
2815
|
onRetyped?.();
|
|
@@ -3329,11 +3353,6 @@ function groupsOf(options) {
|
|
|
3329
3353
|
return out;
|
|
3330
3354
|
}
|
|
3331
3355
|
|
|
3332
|
-
// src/recordVersions.ts
|
|
3333
|
-
var recordVersions_exports = {};
|
|
3334
|
-
__reExport(recordVersions_exports, versions_star2);
|
|
3335
|
-
import * as versions_star2 from "@ai-matrx/records/versions";
|
|
3336
|
-
|
|
3337
3356
|
// src/writeOnTheWinningVersion.ts
|
|
3338
3357
|
var writeOnTheWinningVersion_exports = {};
|
|
3339
3358
|
__reExport(writeOnTheWinningVersion_exports, versions_star3);
|
|
@@ -54459,7 +54478,11 @@ function TablePage({
|
|
|
54459
54478
|
setOpenRecord(activeRecordId);
|
|
54460
54479
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
54461
54480
|
}, [activeRecordId]);
|
|
54462
|
-
const [shownIds,
|
|
54481
|
+
const [shownIds, setShownIdsRaw] = useState152([]);
|
|
54482
|
+
const setShownIds = useCallback70(
|
|
54483
|
+
(next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
|
|
54484
|
+
[]
|
|
54485
|
+
);
|
|
54463
54486
|
const [recordExpanded, setRecordExpanded] = useState152(false);
|
|
54464
54487
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
54465
54488
|
const reportedRecord = useRef64(activeRecordId ?? null);
|