@ai-matrx/records 0.84.4 → 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.
Files changed (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/app-table/index.cjs +51 -2
  3. package/dist/app-table/index.cjs.map +1 -1
  4. package/dist/app-table/index.d.cts +3 -3
  5. package/dist/app-table/index.d.ts +3 -3
  6. package/dist/app-table/index.js +51 -2
  7. package/dist/app-table/index.js.map +1 -1
  8. package/dist/{client-TU-nvgcF.d.ts → client-Cx2JV38-.d.ts} +7 -1
  9. package/dist/{client-CesQciPd.d.cts → client-xErw4ZgF.d.cts} +7 -1
  10. package/dist/core/index.cjs +59 -4
  11. package/dist/core/index.cjs.map +1 -1
  12. package/dist/core/index.d.cts +12 -5
  13. package/dist/core/index.d.ts +12 -5
  14. package/dist/core/index.js +59 -4
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/data/index.cjs +51 -2
  17. package/dist/data/index.cjs.map +1 -1
  18. package/dist/data/index.d.cts +2 -2
  19. package/dist/data/index.d.ts +2 -2
  20. package/dist/data/index.js +51 -2
  21. package/dist/data/index.js.map +1 -1
  22. package/dist/{declareTable-COXYIOiT.d.ts → declareTable-CYzGWD5K.d.ts} +2 -2
  23. package/dist/{declareTable-B9sr2E0h.d.cts → declareTable-G-H3AK48.d.cts} +2 -2
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js.map +1 -1
  28. package/dist/react/index.cjs +66 -5
  29. package/dist/react/index.cjs.map +1 -1
  30. package/dist/react/index.d.cts +16 -1
  31. package/dist/react/index.d.ts +16 -1
  32. package/dist/react/index.js +66 -5
  33. package/dist/react/index.js.map +1 -1
  34. package/dist/{table-kind-C5T-DOdc.d.ts → table-kind-B_qYmQJG.d.ts} +10 -1
  35. package/dist/{table-kind-B4vIKJVM.d.cts → table-kind-KMjVs-rk.d.cts} +10 -1
  36. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- import { N as NewFieldSpec } from '../declareTable-B9sr2E0h.cjs';
1
+ import { N as NewFieldSpec } from '../declareTable-G-H3AK48.cjs';
2
2
  import { U as Uuid, h as RecordsResult, n as RecordPageSort } from '../record-1yDCn169.cjs';
3
- import { R as RecordsClient } from '../client-CesQciPd.cjs';
4
- import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-B4vIKJVM.cjs';
3
+ import { R as RecordsClient } from '../client-xErw4ZgF.cjs';
4
+ import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-KMjVs-rk.cjs';
5
5
  import '../field-snQG2jMq.cjs';
6
6
  import '../subscription-B_WaT-kr.cjs';
7
7
  import '../ports-y1QNfM80.cjs';
@@ -1,7 +1,7 @@
1
- import { N as NewFieldSpec } from '../declareTable-COXYIOiT.js';
1
+ import { N as NewFieldSpec } from '../declareTable-CYzGWD5K.js';
2
2
  import { U as Uuid, h as RecordsResult, n as RecordPageSort } from '../record-1yDCn169.js';
3
- import { R as RecordsClient } from '../client-TU-nvgcF.js';
4
- import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-C5T-DOdc.js';
3
+ import { R as RecordsClient } from '../client-Cx2JV38-.js';
4
+ import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-B_qYmQJG.js';
5
5
  import '../field-BIJiFPc0.js';
6
6
  import '../subscription-CUok1vAm.js';
7
7
  import '../ports-Y5gLbCXe.js';
@@ -419,6 +419,13 @@ function announceRecordChanged(recordId) {
419
419
  }
420
420
  }
421
421
  }
422
+ var removed = /* @__PURE__ */ new Set();
423
+ function markRecordRemoved(recordId) {
424
+ removed.add(recordId);
425
+ }
426
+ function markRecordRestored(recordId) {
427
+ removed.delete(recordId);
428
+ }
422
429
  function onRecordChanged(listener) {
423
430
  listeners.add(listener);
424
431
  return () => listeners.delete(listener);
@@ -1924,6 +1931,10 @@ var OWED_BY = {
1924
1931
  // clone; they reach the main database when the chair applies them, after
1925
1932
  // visionreach_w4_a_the_store_asks_before_an_agent_changes_a_table.sql (its field_declare body).
1926
1933
  reverse_columns: "VIEWS-AND-FIELDS BL \u2014 matrx-frontend migrations/campaign/viewsfields_bl_a_link_shows_on_both_tables.sql (chair's production apply)",
1934
+ // SEED-ENTITY (2026-10-08): the same links through SEVERAL reverse columns in one call; applied to production
1935
+ // through the ledgered runner. Until `pnpm records:generate` lists it, `reverseLinksFields` asks it as an owed door
1936
+ // and a store without it answers `door_absent` (the caller falls back to one call per column).
1937
+ reverse_links_many_fields: "SEED-ENTITY \u2014 matrx-frontend migrations/campaign/seedentity_reverse_links_many_fields.sql (applied 2026-10-08)",
1927
1938
  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)",
1928
1939
  // Live on Matrx Main since 2026-10-06 (applied through the Supabase MCP); STORE_DOORS lists it at the
1929
1940
  // next `pnpm records:generate`, until then `listKeyset` asks it as an owed door.
@@ -2164,6 +2175,7 @@ var DOORS = {
2164
2175
  // links through one of them. Called through `owedDoor` until `pnpm records:generate` lists them.
2165
2176
  reverseColumns: "reverse_columns",
2166
2177
  reverseLinksMany: "reverse_links_many",
2178
+ reverseLinksManyFields: "reverse_links_many_fields",
2167
2179
  homeAdd: "home_add",
2168
2180
  recordReparent: "record_reparent",
2169
2181
  containmentChain: "containment_chain",
@@ -3224,7 +3236,10 @@ function createRecordsClient(given) {
3224
3236
  { p_organization_id: org, p_record_id: record_id },
3225
3237
  "recordDelete"
3226
3238
  );
3227
- if (result.ok) announceRecordChanged(record_id);
3239
+ if (result.ok) {
3240
+ markRecordRemoved(record_id);
3241
+ announceRecordChanged(record_id);
3242
+ }
3228
3243
  return result;
3229
3244
  },
3230
3245
  async recordRestore({ record_id }) {
@@ -3233,7 +3248,10 @@ function createRecordsClient(given) {
3233
3248
  { p_organization_id: org, p_record_id: record_id },
3234
3249
  "recordRestore"
3235
3250
  );
3236
- if (result.ok) announceRecordChanged(record_id);
3251
+ if (result.ok) {
3252
+ markRecordRestored(record_id);
3253
+ announceRecordChanged(record_id);
3254
+ }
3237
3255
  return result;
3238
3256
  },
3239
3257
  async tableArchive({ table_id, chunk, includeTable }) {
@@ -4034,6 +4052,37 @@ function createRecordsClient(given) {
4034
4052
  }
4035
4053
  return ok(out);
4036
4054
  },
4055
+ async reverseLinksFields(args) {
4056
+ const ids = [...new Set(args.record_ids.filter((id) => typeof id === "string" && id.length > 0))];
4057
+ const fieldIds = [...new Set(args.source_field_ids)];
4058
+ const out = Object.fromEntries(fieldIds.map((id) => [id, {}]));
4059
+ for (let f2 = 0; f2 < fieldIds.length || f2 === 0; f2 += 20) {
4060
+ for (let at = 0; at < ids.length; at += REVERSE_LINKS_RECORDS_PER_CALL) {
4061
+ const result = await owedDoor(
4062
+ DOORS.reverseLinksManyFields,
4063
+ {
4064
+ p_organization_id: org,
4065
+ p_table_id: args.table_id,
4066
+ p_field_ids: fieldIds.slice(f2, f2 + 20),
4067
+ p_record_ids: ids.slice(at, at + REVERSE_LINKS_RECORDS_PER_CALL),
4068
+ p_limit: args.limit ?? 10,
4069
+ p_offset: args.offset ?? 0
4070
+ },
4071
+ "reverseLinksFields"
4072
+ );
4073
+ if (!result.ok) return result;
4074
+ for (const row of result.data ?? []) {
4075
+ if (!row?.record_id || !row.field_id) continue;
4076
+ (out[row.field_id] ??= {})[row.record_id] = {
4077
+ total: typeof row.total === "number" ? row.total : 0,
4078
+ links: Array.isArray(row.links) ? row.links : []
4079
+ };
4080
+ }
4081
+ }
4082
+ if (fieldIds.length === 0) break;
4083
+ }
4084
+ return ok(out);
4085
+ },
4037
4086
  async relationNamesMatch(args) {
4038
4087
  const distinct = [];
4039
4088
  const seen = /* @__PURE__ */ new Set();