@ai-matrx/messaging 0.15.1 → 0.15.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.
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +16 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +16 -3
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -1874,10 +1874,23 @@ function createMessagingRepository(options) {
|
|
|
1874
1874
|
});
|
|
1875
1875
|
return found;
|
|
1876
1876
|
}
|
|
1877
|
+
const conversationOrganizations = /* @__PURE__ */ new Map();
|
|
1877
1878
|
async function organizationOfExisting(conversationId) {
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1879
|
+
const known = conversationOrganizations.get(conversationId);
|
|
1880
|
+
if (known !== void 0) return known;
|
|
1881
|
+
const operation = "organizationOfExisting";
|
|
1882
|
+
const { data, error } = await withSessionRetry(
|
|
1883
|
+
operation,
|
|
1884
|
+
async () => db().from(TABLES.conversations).select("organization_id").eq("id", conversationId).single()
|
|
1885
|
+
);
|
|
1886
|
+
if (error !== null) throw normalizeMessagingError(error, operation);
|
|
1887
|
+
const own = data?.["organization_id"];
|
|
1888
|
+
if (typeof own !== "string" || own.length === 0) {
|
|
1889
|
+
throw invalidResponse(operation, `conversation ${conversationId} has no organization`);
|
|
1890
|
+
}
|
|
1891
|
+
const organization = own;
|
|
1892
|
+
conversationOrganizations.set(conversationId, organization);
|
|
1893
|
+
return organization;
|
|
1881
1894
|
}
|
|
1882
1895
|
const repository = {
|
|
1883
1896
|
organizationId: org,
|