@ai-matrx/records 0.84.5 → 0.84.6
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 +6 -0
- package/dist/app-table/index.cjs +36 -0
- package/dist/app-table/index.cjs.map +1 -1
- package/dist/app-table/index.d.cts +3 -3
- package/dist/app-table/index.d.ts +3 -3
- package/dist/app-table/index.js +36 -0
- package/dist/app-table/index.js.map +1 -1
- package/dist/{client-TU-nvgcF.d.ts → client-Cx2JV38-.d.ts} +7 -1
- package/dist/{client-CesQciPd.d.cts → client-xErw4ZgF.d.cts} +7 -1
- package/dist/core/index.cjs +36 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +5 -4
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.js +36 -0
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +36 -0
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.d.cts +2 -2
- package/dist/data/index.d.ts +2 -2
- package/dist/data/index.js +36 -0
- package/dist/data/index.js.map +1 -1
- package/dist/{declareTable-COXYIOiT.d.ts → declareTable-CYzGWD5K.d.ts} +2 -2
- package/dist/{declareTable-B9sr2E0h.d.cts → declareTable-G-H3AK48.d.cts} +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +46 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +16 -1
- package/dist/react/index.d.ts +16 -1
- package/dist/react/index.js +46 -1
- package/dist/react/index.js.map +1 -1
- package/dist/{table-kind-C5T-DOdc.d.ts → table-kind-B_qYmQJG.d.ts} +10 -1
- package/dist/{table-kind-B4vIKJVM.d.cts → table-kind-KMjVs-rk.d.cts} +10 -1
- package/package.json +3 -3
package/dist/react/index.cjs
CHANGED
|
@@ -3588,6 +3588,10 @@ var OWED_BY = {
|
|
|
3588
3588
|
// clone; they reach the main database when the chair applies them, after
|
|
3589
3589
|
// visionreach_w4_a_the_store_asks_before_an_agent_changes_a_table.sql (its field_declare body).
|
|
3590
3590
|
reverse_columns: "VIEWS-AND-FIELDS BL \u2014 matrx-frontend migrations/campaign/viewsfields_bl_a_link_shows_on_both_tables.sql (chair's production apply)",
|
|
3591
|
+
// SEED-ENTITY (2026-10-08): the same links through SEVERAL reverse columns in one call; applied to production
|
|
3592
|
+
// through the ledgered runner. Until `pnpm records:generate` lists it, `reverseLinksFields` asks it as an owed door
|
|
3593
|
+
// and a store without it answers `door_absent` (the caller falls back to one call per column).
|
|
3594
|
+
reverse_links_many_fields: "SEED-ENTITY \u2014 matrx-frontend migrations/campaign/seedentity_reverse_links_many_fields.sql (applied 2026-10-08)",
|
|
3591
3595
|
reverse_links_many: "VIEWS-AND-FIELDS BL \u2014 matrx-frontend migrations/campaign/viewsfields_bl_a_link_shows_on_both_tables.sql (chair's production apply)",
|
|
3592
3596
|
// Live on Matrx Main since 2026-10-06 (applied through the Supabase MCP); STORE_DOORS lists it at the
|
|
3593
3597
|
// next `pnpm records:generate`, until then `listKeyset` asks it as an owed door.
|
|
@@ -3828,6 +3832,7 @@ var DOORS = {
|
|
|
3828
3832
|
// links through one of them. Called through `owedDoor` until `pnpm records:generate` lists them.
|
|
3829
3833
|
reverseColumns: "reverse_columns",
|
|
3830
3834
|
reverseLinksMany: "reverse_links_many",
|
|
3835
|
+
reverseLinksManyFields: "reverse_links_many_fields",
|
|
3831
3836
|
homeAdd: "home_add",
|
|
3832
3837
|
recordReparent: "record_reparent",
|
|
3833
3838
|
containmentChain: "containment_chain",
|
|
@@ -5724,6 +5729,37 @@ function createRecordsClient(given) {
|
|
|
5724
5729
|
}
|
|
5725
5730
|
return ok(out);
|
|
5726
5731
|
},
|
|
5732
|
+
async reverseLinksFields(args) {
|
|
5733
|
+
const ids = [...new Set(args.record_ids.filter((id) => typeof id === "string" && id.length > 0))];
|
|
5734
|
+
const fieldIds = [...new Set(args.source_field_ids)];
|
|
5735
|
+
const out = Object.fromEntries(fieldIds.map((id) => [id, {}]));
|
|
5736
|
+
for (let f2 = 0; f2 < fieldIds.length || f2 === 0; f2 += 20) {
|
|
5737
|
+
for (let at = 0; at < ids.length; at += REVERSE_LINKS_RECORDS_PER_CALL) {
|
|
5738
|
+
const result = await owedDoor(
|
|
5739
|
+
DOORS.reverseLinksManyFields,
|
|
5740
|
+
{
|
|
5741
|
+
p_organization_id: org,
|
|
5742
|
+
p_table_id: args.table_id,
|
|
5743
|
+
p_field_ids: fieldIds.slice(f2, f2 + 20),
|
|
5744
|
+
p_record_ids: ids.slice(at, at + REVERSE_LINKS_RECORDS_PER_CALL),
|
|
5745
|
+
p_limit: args.limit ?? 10,
|
|
5746
|
+
p_offset: args.offset ?? 0
|
|
5747
|
+
},
|
|
5748
|
+
"reverseLinksFields"
|
|
5749
|
+
);
|
|
5750
|
+
if (!result.ok) return result;
|
|
5751
|
+
for (const row of result.data ?? []) {
|
|
5752
|
+
if (!row?.record_id || !row.field_id) continue;
|
|
5753
|
+
(out[row.field_id] ??= {})[row.record_id] = {
|
|
5754
|
+
total: typeof row.total === "number" ? row.total : 0,
|
|
5755
|
+
links: Array.isArray(row.links) ? row.links : []
|
|
5756
|
+
};
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
if (fieldIds.length === 0) break;
|
|
5760
|
+
}
|
|
5761
|
+
return ok(out);
|
|
5762
|
+
},
|
|
5727
5763
|
async relationNamesMatch(args) {
|
|
5728
5764
|
const distinct = [];
|
|
5729
5765
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8478,6 +8514,16 @@ function useReverseLinks(tableId, columns, recordIds, limit = 3, offset = 0) {
|
|
|
8478
8514
|
if (!tableId || columns.length === 0 || recordIds.length === 0 || !doorReady(client.config, DOORS.reverseLinksMany)) {
|
|
8479
8515
|
return { ok: true, data: {} };
|
|
8480
8516
|
}
|
|
8517
|
+
const out = {};
|
|
8518
|
+
const all = await answerOrRefusal(
|
|
8519
|
+
() => client.reverseLinksFields({ table_id: tableId, source_field_ids: columns.map((c) => c.source_field_id), record_ids: recordIds, limit, offset }),
|
|
8520
|
+
"reverseLinksFields"
|
|
8521
|
+
);
|
|
8522
|
+
if (all.ok) {
|
|
8523
|
+
for (const c of columns) out[c.key] = all.data[c.source_field_id] ?? {};
|
|
8524
|
+
return { ok: true, data: out };
|
|
8525
|
+
}
|
|
8526
|
+
if (all.error.code !== "door_absent") return all;
|
|
8481
8527
|
const answers = await Promise.all(
|
|
8482
8528
|
columns.map(
|
|
8483
8529
|
(c) => answerOrRefusal(
|
|
@@ -8486,7 +8532,6 @@ function useReverseLinks(tableId, columns, recordIds, limit = 3, offset = 0) {
|
|
|
8486
8532
|
)
|
|
8487
8533
|
)
|
|
8488
8534
|
);
|
|
8489
|
-
const out = {};
|
|
8490
8535
|
for (let i = 0; i < columns.length; i += 1) {
|
|
8491
8536
|
const answer = answers[i];
|
|
8492
8537
|
if (!answer.ok) return answer;
|