@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.
@@ -3022,6 +3022,11 @@ declare const STORE_DOORS: readonly [{
3022
3022
  readonly args: "p_organization_id uuid, p_table_id uuid";
3023
3023
  readonly returns: "jsonb";
3024
3024
  readonly security: "definer";
3025
+ }, {
3026
+ readonly name: "table_facts";
3027
+ readonly args: "p_organization_id uuid";
3028
+ readonly returns: "TABLE(table_id uuid, visibility text, mine boolean)";
3029
+ readonly security: "definer";
3025
3030
  }, {
3026
3031
  readonly name: "table_from_example";
3027
3032
  readonly args: "p_organization_id uuid, p_home_id uuid, p_example jsonb";
@@ -8657,6 +8662,23 @@ interface RecordsClient {
8657
8662
  tableArchived(args: {
8658
8663
  table_id: Uuid;
8659
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>>;
8660
8682
  fields(args: {
8661
8683
  table_id: Uuid;
8662
8684
  recordType?: string;
@@ -9973,6 +9995,14 @@ interface RecordsClient {
9973
9995
  sheetLabel?: string;
9974
9996
  }): Promise<RecordsResult<Uint8Array>>;
9975
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
+ }
9976
10006
 
9977
10007
  /**
9978
10008
  * THE CLIENT OPERATION LEDGER — how a browser recognises the echo of its own write.
@@ -3022,6 +3022,11 @@ declare const STORE_DOORS: readonly [{
3022
3022
  readonly args: "p_organization_id uuid, p_table_id uuid";
3023
3023
  readonly returns: "jsonb";
3024
3024
  readonly security: "definer";
3025
+ }, {
3026
+ readonly name: "table_facts";
3027
+ readonly args: "p_organization_id uuid";
3028
+ readonly returns: "TABLE(table_id uuid, visibility text, mine boolean)";
3029
+ readonly security: "definer";
3025
3030
  }, {
3026
3031
  readonly name: "table_from_example";
3027
3032
  readonly args: "p_organization_id uuid, p_home_id uuid, p_example jsonb";
@@ -8657,6 +8662,23 @@ interface RecordsClient {
8657
8662
  tableArchived(args: {
8658
8663
  table_id: Uuid;
8659
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>>;
8660
8682
  fields(args: {
8661
8683
  table_id: Uuid;
8662
8684
  recordType?: string;
@@ -9973,6 +9995,14 @@ interface RecordsClient {
9973
9995
  sheetLabel?: string;
9974
9996
  }): Promise<RecordsResult<Uint8Array>>;
9975
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
+ }
9976
10006
 
9977
10007
  /**
9978
10008
  * THE CLIENT OPERATION LEDGER — how a browser recognises the echo of its own write.
@@ -3024,6 +3024,7 @@ var STORE_DOORS = [
3024
3024
  { name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
3025
3025
  { 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" },
3026
3026
  { name: "table_decorations", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
3027
+ { name: "table_facts", args: "p_organization_id uuid", returns: "TABLE(table_id uuid, visibility text, mine boolean)", security: "definer" },
3027
3028
  { name: "table_from_example", args: "p_organization_id uuid, p_home_id uuid, p_example jsonb", returns: "jsonb", security: "definer" },
3028
3029
  { name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
3029
3030
  { name: "table_is_live", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
@@ -4519,6 +4520,7 @@ var DOORS = {
4519
4520
  // everywhere in that organization. This is the one question the rail has to
4520
4521
  // ask, under the same wall and visibility gate as `portals` itself.
4521
4522
  portalTables: "portal_tables",
4523
+ tableFacts: "table_facts",
4522
4524
  portalCard: "portal_card",
4523
4525
  portalDeclare: "portal_declare",
4524
4526
  portalInvite: "portal_invite",
@@ -5143,6 +5145,10 @@ function createRecordsClient(config) {
5143
5145
  })
5144
5146
  );
5145
5147
  },
5148
+ async tableFacts() {
5149
+ if (!doorExists(DOORS.tableFacts)) return ok(null);
5150
+ return callDoor(DOORS.tableFacts, { p_organization_id: org }, "tableFacts");
5151
+ },
5146
5152
  async tableArchived({ table_id }) {
5147
5153
  const kernel = await callDoor(DOORS.tableKernelId, {}, "tableArchived.kernel");
5148
5154
  if (!kernel.ok) return err(kernel.error);