@ai-matrx/records 0.57.1 → 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,26 @@
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
+
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)
14
+
15
+ * `tableList()` folds `custom.table_facts` onto every Table: `visibility` (a record column the
16
+ Table document never carried, so every lane decision fell through to its default) and
17
+ `created_by` — set ONLY to the caller's own id and only on Tables the caller made. The call is
18
+ made only when `STORE_DOORS` carries the door (the door-presence pattern): a build generated
19
+ without it asks nothing and returns the Tables exactly as before. (The code landed inside 0.57.1's commit `7f2a737913` by a sweep; this
20
+ entry is its record.) Test `__tests__/table-list-facts.test.ts`.
21
+ * New `tableArchived({ table_id })`: the archived row for one Table, or `null` — paged over the
22
+ Table kernel's archive, the same door a table's own archive uses.
23
+
3
24
  ## 0.57.1 (unpublished — lane RECORDS-UI-FIX, guide re-walk 2026-09-23)
4
25
 
5
26
  * **A refusal is not an app error.** The default error sink printed every refusal through
@@ -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
 
@@ -3823,6 +3824,7 @@ var STORE_DOORS = [
3823
3824
  { name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
3824
3825
  { name: "table_decorate", args: "p_organization_id uuid, p_table_id uuid, p_path text[], p_value jsonb DEFAULT NULL::jsonb", returns: "jsonb", security: "definer" },
3825
3826
  { name: "table_decorations", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
3827
+ { name: "table_facts", args: "p_organization_id uuid", returns: "TABLE(table_id uuid, visibility text, mine boolean)", security: "definer" },
3826
3828
  { name: "table_from_example", args: "p_organization_id uuid, p_home_id uuid, p_example jsonb", returns: "jsonb", security: "definer" },
3827
3829
  { name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
3828
3830
  { name: "table_is_live", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
@@ -5323,6 +5325,7 @@ var DOORS = {
5323
5325
  // everywhere in that organization. This is the one question the rail has to
5324
5326
  // ask, under the same wall and visibility gate as `portals` itself.
5325
5327
  portalTables: "portal_tables",
5328
+ tableFacts: "table_facts",
5326
5329
  portalCard: "portal_card",
5327
5330
  portalDeclare: "portal_declare",
5328
5331
  portalInvite: "portal_invite",
@@ -5781,6 +5784,19 @@ function sink(config) {
5781
5784
  else console.error(line);
5782
5785
  });
5783
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
+ }
5784
5800
  function createRecordsClient(config) {
5785
5801
  const schema = config.schema ?? DEFAULT_SCHEMA;
5786
5802
  const org = config.organizationId;
@@ -5955,6 +5971,10 @@ function createRecordsClient(config) {
5955
5971
  })
5956
5972
  );
5957
5973
  },
5974
+ async tableFacts() {
5975
+ if (!doorExists(DOORS.tableFacts)) return ok(null);
5976
+ return callDoor(DOORS.tableFacts, { p_organization_id: org }, "tableFacts");
5977
+ },
5958
5978
  async tableArchived({ table_id }) {
5959
5979
  const kernel = await callDoor(DOORS.tableKernelId, {}, "tableArchived.kernel");
5960
5980
  if (!kernel.ok) return err(kernel.error);