@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
@@ -283,6 +283,13 @@ function announceRecordChanged(recordId) {
283
283
  }
284
284
  }
285
285
  }
286
+ var removed = /* @__PURE__ */ new Set();
287
+ function markRecordRemoved(recordId) {
288
+ removed.add(recordId);
289
+ }
290
+ function markRecordRestored(recordId) {
291
+ removed.delete(recordId);
292
+ }
286
293
  function onRecordChanged(listener) {
287
294
  listeners.add(listener);
288
295
  return () => listeners.delete(listener);
@@ -1812,6 +1819,10 @@ var OWED_BY = {
1812
1819
  // clone; they reach the main database when the chair applies them, after
1813
1820
  // visionreach_w4_a_the_store_asks_before_an_agent_changes_a_table.sql (its field_declare body).
1814
1821
  reverse_columns: "VIEWS-AND-FIELDS BL \u2014 matrx-frontend migrations/campaign/viewsfields_bl_a_link_shows_on_both_tables.sql (chair's production apply)",
1822
+ // SEED-ENTITY (2026-10-08): the same links through SEVERAL reverse columns in one call; applied to production
1823
+ // through the ledgered runner. Until `pnpm records:generate` lists it, `reverseLinksFields` asks it as an owed door
1824
+ // and a store without it answers `door_absent` (the caller falls back to one call per column).
1825
+ reverse_links_many_fields: "SEED-ENTITY \u2014 matrx-frontend migrations/campaign/seedentity_reverse_links_many_fields.sql (applied 2026-10-08)",
1815
1826
  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)",
1816
1827
  // Live on Matrx Main since 2026-10-06 (applied through the Supabase MCP); STORE_DOORS lists it at the
1817
1828
  // next `pnpm records:generate`, until then `listKeyset` asks it as an owed door.
@@ -2052,6 +2063,7 @@ var DOORS = {
2052
2063
  // links through one of them. Called through `owedDoor` until `pnpm records:generate` lists them.
2053
2064
  reverseColumns: "reverse_columns",
2054
2065
  reverseLinksMany: "reverse_links_many",
2066
+ reverseLinksManyFields: "reverse_links_many_fields",
2055
2067
  homeAdd: "home_add",
2056
2068
  recordReparent: "record_reparent",
2057
2069
  containmentChain: "containment_chain",
@@ -3112,7 +3124,10 @@ function createRecordsClient(given) {
3112
3124
  { p_organization_id: org, p_record_id: record_id },
3113
3125
  "recordDelete"
3114
3126
  );
3115
- if (result.ok) announceRecordChanged(record_id);
3127
+ if (result.ok) {
3128
+ markRecordRemoved(record_id);
3129
+ announceRecordChanged(record_id);
3130
+ }
3116
3131
  return result;
3117
3132
  },
3118
3133
  async recordRestore({ record_id }) {
@@ -3121,7 +3136,10 @@ function createRecordsClient(given) {
3121
3136
  { p_organization_id: org, p_record_id: record_id },
3122
3137
  "recordRestore"
3123
3138
  );
3124
- if (result.ok) announceRecordChanged(record_id);
3139
+ if (result.ok) {
3140
+ markRecordRestored(record_id);
3141
+ announceRecordChanged(record_id);
3142
+ }
3125
3143
  return result;
3126
3144
  },
3127
3145
  async tableArchive({ table_id, chunk, includeTable }) {
@@ -3922,6 +3940,37 @@ function createRecordsClient(given) {
3922
3940
  }
3923
3941
  return ok(out);
3924
3942
  },
3943
+ async reverseLinksFields(args) {
3944
+ const ids = [...new Set(args.record_ids.filter((id) => typeof id === "string" && id.length > 0))];
3945
+ const fieldIds = [...new Set(args.source_field_ids)];
3946
+ const out = Object.fromEntries(fieldIds.map((id) => [id, {}]));
3947
+ for (let f = 0; f < fieldIds.length || f === 0; f += 20) {
3948
+ for (let at = 0; at < ids.length; at += REVERSE_LINKS_RECORDS_PER_CALL) {
3949
+ const result = await owedDoor(
3950
+ DOORS.reverseLinksManyFields,
3951
+ {
3952
+ p_organization_id: org,
3953
+ p_table_id: args.table_id,
3954
+ p_field_ids: fieldIds.slice(f, f + 20),
3955
+ p_record_ids: ids.slice(at, at + REVERSE_LINKS_RECORDS_PER_CALL),
3956
+ p_limit: args.limit ?? 10,
3957
+ p_offset: args.offset ?? 0
3958
+ },
3959
+ "reverseLinksFields"
3960
+ );
3961
+ if (!result.ok) return result;
3962
+ for (const row of result.data ?? []) {
3963
+ if (!row?.record_id || !row.field_id) continue;
3964
+ (out[row.field_id] ??= {})[row.record_id] = {
3965
+ total: typeof row.total === "number" ? row.total : 0,
3966
+ links: Array.isArray(row.links) ? row.links : []
3967
+ };
3968
+ }
3969
+ }
3970
+ if (fieldIds.length === 0) break;
3971
+ }
3972
+ return ok(out);
3973
+ },
3925
3974
  async relationNamesMatch(args) {
3926
3975
  const distinct = [];
3927
3976
  const seen = /* @__PURE__ */ new Set();