@ai-matrx/messaging 0.7.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/CHANGELOG.md +52 -0
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -3
- package/dist/index.d.ts +43 -3
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +17 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +40 -7
- package/dist/react.d.ts +40 -7
- package/dist/react.js +17 -3
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -749,11 +749,13 @@ function projectParticipants(value, operation) {
|
|
|
749
749
|
for (const entry of value) {
|
|
750
750
|
if (typeof entry !== "object" || entry === null) continue;
|
|
751
751
|
const record = entry;
|
|
752
|
-
const
|
|
752
|
+
const nested = typeof record["user"] === "object" && record["user"] !== null ? record["user"] : {};
|
|
753
|
+
const id = str(record, "user_id") ?? str(nested, "user_id") ?? str(record, "id");
|
|
753
754
|
if (id === null) continue;
|
|
754
755
|
summaries.push(
|
|
755
756
|
projectUserSummary({
|
|
756
757
|
...record,
|
|
758
|
+
...nested,
|
|
757
759
|
user_id: id
|
|
758
760
|
})
|
|
759
761
|
);
|
|
@@ -1477,12 +1479,13 @@ function requireOrg(organizationId, operation) {
|
|
|
1477
1479
|
return organizationId;
|
|
1478
1480
|
}
|
|
1479
1481
|
function createMessagingRepository(options) {
|
|
1480
|
-
const {
|
|
1482
|
+
const { identity } = options;
|
|
1481
1483
|
const org = requireOrg(identity.organizationId, "createMessagingRepository");
|
|
1482
1484
|
const userCache = createReadCache({
|
|
1483
1485
|
ttlMs: options.userTtlMs ?? 5 * 6e4,
|
|
1484
1486
|
...options.now !== void 0 ? { now: options.now } : {}
|
|
1485
1487
|
});
|
|
1488
|
+
const client = options.client;
|
|
1486
1489
|
const db = () => client.schema(MESSAGING_SCHEMA);
|
|
1487
1490
|
const rpcDb = () => client.schema(MESSAGING_RPC_SCHEMA);
|
|
1488
1491
|
async function withSessionRetry(operation, run) {
|
|
@@ -1810,7 +1813,14 @@ function MessagingProvider(props) {
|
|
|
1810
1813
|
const ready = client != null && typeof userId === "string" && userId.length > 0 && typeof organizationId === "string" && organizationId.length > 0;
|
|
1811
1814
|
const hostProvidesRealtime = (0, import_react2.useIsRealtimeProviderMounted)();
|
|
1812
1815
|
if (hostProvidesRealtime) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagingRuntime, { ...props });
|
|
1813
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
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
|
+
);
|
|
1814
1824
|
}
|
|
1815
1825
|
function MessagingRuntime(props) {
|
|
1816
1826
|
const { client, userId, organizationId, children } = props;
|
|
@@ -1839,6 +1849,10 @@ function MessagingRuntime(props) {
|
|
|
1839
1849
|
(diagnosticRef.current ?? defaultDiagnostics)(event);
|
|
1840
1850
|
};
|
|
1841
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.
|
|
1842
1856
|
client,
|
|
1843
1857
|
identity,
|
|
1844
1858
|
...props.resolveSession !== void 0 ? { resolveSession: props.resolveSession } : {}
|