@ai-matrx/records-ui 0.3.1 → 0.3.2

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/dist/index.d.cts CHANGED
@@ -1037,17 +1037,36 @@ declare function personActor(userId: Uuid$1 | null | undefined): RecordsActor;
1037
1037
  *
1038
1038
  * `RecordsDataSource` is deliberately a small structural subset of
1039
1039
  * `SupabaseClient` — the package holds no key and opens no connection, the host
1040
- * hands it a client that already carries the person's session. Structurally the
1041
- * two agree. PROVING it does not fit in the type checker's budget: a generated
1042
- * `Database` type makes `schema().from().select()` enormous, and a host app
1043
- * that passes its client straight into `config` gets
1044
- * `TS2589: Type instantiation is excessively deep and possibly infinite` in its
1045
- * own build (matrx-frontend, 2026-09-18, on all three campaign routes at once).
1040
+ * hands it a client that already carries the person's session.
1046
1041
  *
1047
- * So the assertion is made HERE, once, where it is explained — rather than as a
1048
- * cast copied into every route that mounts a screen.
1042
+ * IT IS NOT AN IDENTITY CAST, and it cost a live screen to learn why
1043
+ * (2026-09-19, /data-v2's first load): the port's `rpc(fn, args, { schema })`
1044
+ * says the schema OUT LOUD, because every door of this store is `custom.<name>`
1045
+ * and every door of the trust layer is `iam.<name>`. supabase-js's own
1046
+ * `rpc(fn, args, options)` has no `schema` option at all — its third argument is
1047
+ * `{ head, get, count }` — so a client passed straight through silently asked
1048
+ * its default PostgREST profile and the store answered, correctly and uselessly,
1049
+ * "Could not find the function public.table_kernel_id ... PGRST202". The schema
1050
+ * is chosen the one way supabase-js offers: `client.schema(name).rpc(...)`.
1051
+ *
1052
+ * `schema(name).from(table)` already agrees structurally and is passed through.
1053
+ *
1054
+ * `fallbackSchema` is the profile a call that says NOTHING is sent to. No caller
1055
+ * in `@ai-matrx/records` omits the option — `callDoor` always says `custom` and
1056
+ * `trustDoor` always says `iam` — so it never fires today; it exists so that a
1057
+ * call which one day forgets lands on the store rather than silently on
1058
+ * `public`. It is a FALLBACK and not the answer: a version of this adapter that
1059
+ * sent EVERY door to one fixed schema would route the `iam` trust doors (the
1060
+ * external principal, the publish binding) into `custom` and get a PGRST202
1061
+ * naming the wrong schema.
1062
+ *
1063
+ * The cast itself stays HERE, once, where it is explained: a generated
1064
+ * `Database` type makes `schema().from().select()` enormous, and a host app that
1065
+ * passes its client straight into `config` gets `TS2589: Type instantiation is
1066
+ * excessively deep and possibly infinite` in its own build (matrx-frontend,
1067
+ * 2026-09-18, on all three campaign routes at once).
1049
1068
  */
1050
- declare function recordsDataSource(client: object, schema?: string): RecordsDataSource;
1069
+ declare function recordsDataSource(client: object, fallbackSchema?: string): RecordsDataSource;
1051
1070
 
1052
1071
  type TableLane = "mine" | "organization" | "system" | "community";
1053
1072
  /** The four lanes, in the order a person reads them. Never a flat list. */
package/dist/index.d.ts CHANGED
@@ -1037,17 +1037,36 @@ declare function personActor(userId: Uuid$1 | null | undefined): RecordsActor;
1037
1037
  *
1038
1038
  * `RecordsDataSource` is deliberately a small structural subset of
1039
1039
  * `SupabaseClient` — the package holds no key and opens no connection, the host
1040
- * hands it a client that already carries the person's session. Structurally the
1041
- * two agree. PROVING it does not fit in the type checker's budget: a generated
1042
- * `Database` type makes `schema().from().select()` enormous, and a host app
1043
- * that passes its client straight into `config` gets
1044
- * `TS2589: Type instantiation is excessively deep and possibly infinite` in its
1045
- * own build (matrx-frontend, 2026-09-18, on all three campaign routes at once).
1040
+ * hands it a client that already carries the person's session.
1046
1041
  *
1047
- * So the assertion is made HERE, once, where it is explained — rather than as a
1048
- * cast copied into every route that mounts a screen.
1042
+ * IT IS NOT AN IDENTITY CAST, and it cost a live screen to learn why
1043
+ * (2026-09-19, /data-v2's first load): the port's `rpc(fn, args, { schema })`
1044
+ * says the schema OUT LOUD, because every door of this store is `custom.<name>`
1045
+ * and every door of the trust layer is `iam.<name>`. supabase-js's own
1046
+ * `rpc(fn, args, options)` has no `schema` option at all — its third argument is
1047
+ * `{ head, get, count }` — so a client passed straight through silently asked
1048
+ * its default PostgREST profile and the store answered, correctly and uselessly,
1049
+ * "Could not find the function public.table_kernel_id ... PGRST202". The schema
1050
+ * is chosen the one way supabase-js offers: `client.schema(name).rpc(...)`.
1051
+ *
1052
+ * `schema(name).from(table)` already agrees structurally and is passed through.
1053
+ *
1054
+ * `fallbackSchema` is the profile a call that says NOTHING is sent to. No caller
1055
+ * in `@ai-matrx/records` omits the option — `callDoor` always says `custom` and
1056
+ * `trustDoor` always says `iam` — so it never fires today; it exists so that a
1057
+ * call which one day forgets lands on the store rather than silently on
1058
+ * `public`. It is a FALLBACK and not the answer: a version of this adapter that
1059
+ * sent EVERY door to one fixed schema would route the `iam` trust doors (the
1060
+ * external principal, the publish binding) into `custom` and get a PGRST202
1061
+ * naming the wrong schema.
1062
+ *
1063
+ * The cast itself stays HERE, once, where it is explained: a generated
1064
+ * `Database` type makes `schema().from().select()` enormous, and a host app that
1065
+ * passes its client straight into `config` gets `TS2589: Type instantiation is
1066
+ * excessively deep and possibly infinite` in its own build (matrx-frontend,
1067
+ * 2026-09-18, on all three campaign routes at once).
1049
1068
  */
1050
- declare function recordsDataSource(client: object, schema?: string): RecordsDataSource;
1069
+ declare function recordsDataSource(client: object, fallbackSchema?: string): RecordsDataSource;
1051
1070
 
1052
1071
  type TableLane = "mine" | "organization" | "system" | "community";
1053
1072
  /** The four lanes, in the order a person reads them. Never a flat list. */
package/dist/index.js CHANGED
@@ -5596,11 +5596,16 @@ function RecordsMount({
5596
5596
  function personActor(userId) {
5597
5597
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
5598
5598
  }
5599
- function recordsDataSource(client, schema = "custom") {
5599
+ function recordsDataSource(client, fallbackSchema = "custom") {
5600
5600
  const supabase = client;
5601
5601
  return {
5602
- rpc: (fn, args) => supabase.schema(schema).rpc(fn, args),
5603
- schema: (name) => supabase.schema(name)
5602
+ rpc(fn, args, options) {
5603
+ const on = supabase.schema(options?.schema ?? fallbackSchema);
5604
+ return on.rpc(fn, args);
5605
+ },
5606
+ schema(name) {
5607
+ return supabase.schema(name);
5608
+ }
5604
5609
  };
5605
5610
  }
5606
5611