@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.
@@ -8662,6 +8662,23 @@ interface RecordsClient {
8662
8662
  tableArchived(args: {
8663
8663
  table_id: Uuid;
8664
8664
  }): Promise<RecordsResult<ArchivedRow | null>>;
8665
+ /**
8666
+ * WHO CAN SEE EACH TABLE, AND WHETHER THE CALLER MADE IT — `custom.table_facts`
8667
+ * (lane HUB-FIX). `visibility` and `created_by` are record COLUMNS the Table document
8668
+ * never carried, so a screen that sorts Tables into lanes asks this and folds the
8669
+ * answer onto `tableList()`'s Tables with `withTableFacts`.
8670
+ *
8671
+ * 🚨 IT IS ITS OWN CALL, NOT PART OF `tableList()` (0.57.3). 0.57.2 folded it into
8672
+ * every table list, so every screen that merely LISTS tables (the field editor's
8673
+ * relation target, the import wizard, settings) paid a second round trip it never
8674
+ * used — and every test double that answers a table list had to answer it too
8675
+ * (records-ui 0.84.5's gate: 47 tests in 15 files red). Only the lane-sorting
8676
+ * screens ask.
8677
+ *
8678
+ * The door-presence pattern: when the store's catalogue does not carry the door the
8679
+ * answer is `null` — nothing asked, nothing invented.
8680
+ */
8681
+ tableFacts(): Promise<RecordsResult<TableFact[] | null>>;
8665
8682
  fields(args: {
8666
8683
  table_id: Uuid;
8667
8684
  recordType?: string;
@@ -9978,6 +9995,14 @@ interface RecordsClient {
9978
9995
  sheetLabel?: string;
9979
9996
  }): Promise<RecordsResult<Uint8Array>>;
9980
9997
  }
9998
+ /** One Table's two lane facts, as `custom.table_facts` answers them. */
9999
+ interface TableFact {
10000
+ table_id: Uuid;
10001
+ /** The record's own `visibility` column: personal · internal · link · public. */
10002
+ visibility: string;
10003
+ /** Whether the person signed in MADE this Table. Never who did. */
10004
+ mine: boolean;
10005
+ }
9981
10006
 
9982
10007
  /**
9983
10008
  * THE CLIENT OPERATION LEDGER — how a browser recognises the echo of its own write.
@@ -8662,6 +8662,23 @@ interface RecordsClient {
8662
8662
  tableArchived(args: {
8663
8663
  table_id: Uuid;
8664
8664
  }): Promise<RecordsResult<ArchivedRow | null>>;
8665
+ /**
8666
+ * WHO CAN SEE EACH TABLE, AND WHETHER THE CALLER MADE IT — `custom.table_facts`
8667
+ * (lane HUB-FIX). `visibility` and `created_by` are record COLUMNS the Table document
8668
+ * never carried, so a screen that sorts Tables into lanes asks this and folds the
8669
+ * answer onto `tableList()`'s Tables with `withTableFacts`.
8670
+ *
8671
+ * 🚨 IT IS ITS OWN CALL, NOT PART OF `tableList()` (0.57.3). 0.57.2 folded it into
8672
+ * every table list, so every screen that merely LISTS tables (the field editor's
8673
+ * relation target, the import wizard, settings) paid a second round trip it never
8674
+ * used — and every test double that answers a table list had to answer it too
8675
+ * (records-ui 0.84.5's gate: 47 tests in 15 files red). Only the lane-sorting
8676
+ * screens ask.
8677
+ *
8678
+ * The door-presence pattern: when the store's catalogue does not carry the door the
8679
+ * answer is `null` — nothing asked, nothing invented.
8680
+ */
8681
+ tableFacts(): Promise<RecordsResult<TableFact[] | null>>;
8665
8682
  fields(args: {
8666
8683
  table_id: Uuid;
8667
8684
  recordType?: string;
@@ -9978,6 +9995,14 @@ interface RecordsClient {
9978
9995
  sheetLabel?: string;
9979
9996
  }): Promise<RecordsResult<Uint8Array>>;
9980
9997
  }
9998
+ /** One Table's two lane facts, as `custom.table_facts` answers them. */
9999
+ interface TableFact {
10000
+ table_id: Uuid;
10001
+ /** The record's own `visibility` column: personal · internal · link · public. */
10002
+ visibility: string;
10003
+ /** Whether the person signed in MADE this Table. Never who did. */
10004
+ mine: boolean;
10005
+ }
9981
10006
 
9982
10007
  /**
9983
10008
  * THE CLIENT OPERATION LEDGER — how a browser recognises the echo of its own write.
@@ -5145,6 +5145,10 @@ function createRecordsClient(config) {
5145
5145
  })
5146
5146
  );
5147
5147
  },
5148
+ async tableFacts() {
5149
+ if (!doorExists(DOORS.tableFacts)) return ok(null);
5150
+ return callDoor(DOORS.tableFacts, { p_organization_id: org }, "tableFacts");
5151
+ },
5148
5152
  async tableArchived({ table_id }) {
5149
5153
  const kernel = await callDoor(DOORS.tableKernelId, {}, "tableArchived.kernel");
5150
5154
  if (!kernel.ok) return err(kernel.error);
@@ -5328,23 +5332,6 @@ function createRecordsClient(config) {
5328
5332
  const { document } = unfold(row.document);
5329
5333
  return { ...document, id: row.id, organization_id: org };
5330
5334
  });
5331
- if (doorExists(DOORS.tableFacts)) {
5332
- const facts = await callDoor(
5333
- DOORS.tableFacts,
5334
- { p_organization_id: org },
5335
- "tableList.facts"
5336
- );
5337
- if (facts.ok) {
5338
- const byId = new Map((facts.data ?? []).map((f) => [f.table_id, f]));
5339
- const me = config.actor.user_id ?? null;
5340
- for (const table of tables) {
5341
- const fact = byId.get(table.id);
5342
- if (!fact) continue;
5343
- table.visibility = fact.visibility;
5344
- if (fact.mine && me) table.created_by = me;
5345
- }
5346
- }
5347
- }
5348
5335
  tables.sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
5349
5336
  return ok(tables);
5350
5337
  },