@ai-matrx/records 0.57.2 → 0.57.3

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,5 +1,15 @@
1
1
  # Changelog — @ai-matrx/records
2
2
 
3
+ ## 0.57.3 (unpublished — lane HUB-FIX)
4
+
5
+ * **The lane facts are their own call.** 0.57.2 folded `custom.table_facts` into every
6
+ `tableList()`, so every screen that only LISTS tables paid a second round trip, and every
7
+ test double that answers a table list had to answer it too (records-ui 0.84.5's publish gate:
8
+ 47 tests in 15 files red). `tableList()` is back to one door; new `tableFacts()` (door-presence:
9
+ `null` when the catalogue has no such door) and pure `withTableFacts(tables, facts, me)`, which
10
+ sets `visibility` and — only on the caller's own Tables — `created_by`. Exported from `/core`
11
+ with `TableFact`. Tests: `table-list-facts.test.ts` (tableList never asks for the facts).
12
+
3
13
  ## 0.57.2 (unpublished — lane HUB-FIX, 2026-09-23; `custom.table_facts` is live on the main database, ledger 2026-09-23 11:51Z, and `STORE_DOORS` is regenerated to carry it)
4
14
 
5
15
  * `tableList()` folds `custom.table_facts` onto every Table: `visibility` (a record column the
@@ -2317,7 +2317,8 @@ __export(core_exports, {
2317
2317
  stableFilterKey: () => stableFilterKey,
2318
2318
  staleWriteDetail: () => staleWriteDetail,
2319
2319
  supabaseDataSource: () => supabaseDataSource,
2320
- toAoa: () => toAoa
2320
+ toAoa: () => toAoa,
2321
+ withTableFacts: () => withTableFacts
2321
2322
  });
2322
2323
  module.exports = __toCommonJS(core_exports);
2323
2324
 
@@ -5783,6 +5784,19 @@ function sink(config) {
5783
5784
  else console.error(line);
5784
5785
  });
5785
5786
  }
5787
+ function withTableFacts(tables, facts, me) {
5788
+ if (!facts) return [...tables];
5789
+ const byId = new Map(facts.map((f) => [f.table_id, f]));
5790
+ return tables.map((table) => {
5791
+ const fact = byId.get(table.id);
5792
+ if (!fact) return table;
5793
+ return {
5794
+ ...table,
5795
+ visibility: fact.visibility,
5796
+ ...fact.mine && me ? { created_by: me } : {}
5797
+ };
5798
+ });
5799
+ }
5786
5800
  function createRecordsClient(config) {
5787
5801
  const schema = config.schema ?? DEFAULT_SCHEMA;
5788
5802
  const org = config.organizationId;
@@ -5957,6 +5971,10 @@ function createRecordsClient(config) {
5957
5971
  })
5958
5972
  );
5959
5973
  },
5974
+ async tableFacts() {
5975
+ if (!doorExists(DOORS.tableFacts)) return ok(null);
5976
+ return callDoor(DOORS.tableFacts, { p_organization_id: org }, "tableFacts");
5977
+ },
5960
5978
  async tableArchived({ table_id }) {
5961
5979
  const kernel = await callDoor(DOORS.tableKernelId, {}, "tableArchived.kernel");
5962
5980
  if (!kernel.ok) return err(kernel.error);
@@ -6140,23 +6158,6 @@ function createRecordsClient(config) {
6140
6158
  const { document } = unfold(row.document);
6141
6159
  return { ...document, id: row.id, organization_id: org };
6142
6160
  });
6143
- if (doorExists(DOORS.tableFacts)) {
6144
- const facts = await callDoor(
6145
- DOORS.tableFacts,
6146
- { p_organization_id: org },
6147
- "tableList.facts"
6148
- );
6149
- if (facts.ok) {
6150
- const byId = new Map((facts.data ?? []).map((f) => [f.table_id, f]));
6151
- const me = config.actor.user_id ?? null;
6152
- for (const table of tables) {
6153
- const fact = byId.get(table.id);
6154
- if (!fact) continue;
6155
- table.visibility = fact.visibility;
6156
- if (fact.mine && me) table.created_by = me;
6157
- }
6158
- }
6159
- }
6160
6161
  tables.sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
6161
6162
  return ok(tables);
6162
6163
  },