@ai-matrx/messaging 0.8.0 → 0.9.0

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/react.cjs CHANGED
@@ -1479,12 +1479,13 @@ function requireOrg(organizationId, operation) {
1479
1479
  return organizationId;
1480
1480
  }
1481
1481
  function createMessagingRepository(options) {
1482
- const { client, identity } = options;
1482
+ const { identity } = options;
1483
1483
  const org = requireOrg(identity.organizationId, "createMessagingRepository");
1484
1484
  const userCache = createReadCache({
1485
1485
  ttlMs: options.userTtlMs ?? 5 * 6e4,
1486
1486
  ...options.now !== void 0 ? { now: options.now } : {}
1487
1487
  });
1488
+ const client = options.client;
1488
1489
  const db = () => client.schema(MESSAGING_SCHEMA);
1489
1490
  const rpcDb = () => client.schema(MESSAGING_RPC_SCHEMA);
1490
1491
  async function withSessionRetry(operation, run) {
@@ -1812,7 +1813,14 @@ function MessagingProvider(props) {
1812
1813
  const ready = client != null && typeof userId === "string" && userId.length > 0 && typeof organizationId === "string" && organizationId.length > 0;
1813
1814
  const hostProvidesRealtime = (0, import_react2.useIsRealtimeProviderMounted)();
1814
1815
  if (hostProvidesRealtime) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagingRuntime, { ...props });
1815
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.RealtimeProvider, { client: ready ? client : null, actorId: userId ?? void 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagingRuntime, { ...props }) });
1816
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1817
+ import_react2.RealtimeProvider,
1818
+ {
1819
+ client: ready ? client : null,
1820
+ actorId: userId ?? void 0,
1821
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagingRuntime, { ...props })
1822
+ }
1823
+ );
1816
1824
  }
1817
1825
  function MessagingRuntime(props) {
1818
1826
  const { client, userId, organizationId, children } = props;
@@ -1841,6 +1849,10 @@ function MessagingRuntime(props) {
1841
1849
  (diagnosticRef.current ?? defaultDiagnostics)(event);
1842
1850
  };
1843
1851
  const repository = createMessagingRepository({
1852
+ // THE ONE NARROWING, and it lives INSIDE the package. The prop is shallow
1853
+ // so a host's fully-typed client is assignable at all (see
1854
+ // supabase-shape.ts); everything below this line works against the rich
1855
+ // contract, which `supabase-shape.test.ts` proves a real client honors.
1844
1856
  client,
1845
1857
  identity,
1846
1858
  ...props.resolveSession !== void 0 ? { resolveSession: props.resolveSession } : {}