bulbul-chat
Advanced tools
Comparing version 2.5.3 to 2.5.4
@@ -29,3 +29,3 @@ import { ChannelStoragStateType } from './useChannelsData'; | ||
}): Promise<ChatChannel>; | ||
getByExternalId(channelExternalId: string, chatClient: ChatClient): Promise<ChatChannel>; | ||
getByExternalId(channelExternalId: string, chatClient: ChatClient, persist: boolean): Promise<ChatChannel>; | ||
state(): ChannelStoragStateType; | ||
@@ -32,0 +32,0 @@ onUpdate(callback: (data: any) => void): () => void; |
@@ -208,3 +208,3 @@ "use strict"; | ||
}; | ||
ChannelsStorage.prototype.getByExternalId = function (channelExternalId, chatClient) { | ||
ChannelsStorage.prototype.getByExternalId = function (channelExternalId, chatClient, persist) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -224,3 +224,5 @@ var doc, channels; | ||
if (channels.length > 0) { | ||
this.upsert(channels); | ||
if (persist) { | ||
this.upsert(channels); | ||
} | ||
return [2 /*return*/, channels[0]]; | ||
@@ -227,0 +229,0 @@ } |
@@ -23,3 +23,3 @@ import ChannelMessageStorage from './ChannelMessageStorage'; | ||
getChannel(channelId: string): Promise<ChatChannel>; | ||
getChannelByExternalId(channelExternalId: string): Promise<ChatChannel>; | ||
getChannelByExternalId(channelExternalId: string, persist?: boolean): Promise<ChatChannel>; | ||
subscribeChannel(channelId: string): CallableFunction; | ||
@@ -26,0 +26,0 @@ subscribeChannelsUpdate(): () => void; |
@@ -146,3 +146,3 @@ "use strict"; | ||
if (cm.id === (channelMembership === null || channelMembership === void 0 ? void 0 : channelMembership.id)) { | ||
return __assign({}, channelMembership); | ||
return __assign(__assign({}, cm), channelMembership); | ||
} | ||
@@ -265,7 +265,8 @@ return cm; | ||
}; | ||
ChatService.prototype.getChannelByExternalId = function (channelExternalId) { | ||
ChatService.prototype.getChannelByExternalId = function (channelExternalId, persist) { | ||
if (persist === void 0) { persist = true; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.channelsStorage.getByExternalId(channelExternalId, this.chatClient)]; | ||
case 0: return [4 /*yield*/, this.channelsStorage.getByExternalId(channelExternalId, this.chatClient, persist)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
@@ -272,0 +273,0 @@ } |
@@ -118,3 +118,3 @@ "use strict"; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, chatService.getChannelByExternalId(channelExternalId)]; | ||
case 0: return [4 /*yield*/, chatService.getChannelByExternalId(channelExternalId, false)]; | ||
case 1: | ||
@@ -121,0 +121,0 @@ channel = _a.sent(); |
{ | ||
"name": "bulbul-chat", | ||
"version": "2.5.3", | ||
"version": "2.5.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -156,3 +156,4 @@ import { ChannelStoragStateType } from './useChannelsData'; | ||
channelExternalId: string, | ||
chatClient: ChatClient | ||
chatClient: ChatClient, | ||
persist: boolean | ||
): Promise<ChatChannel> { | ||
@@ -165,3 +166,5 @@ const doc = this.channelsCollection.findBy({ | ||
if (channels.length > 0) { | ||
this.upsert(channels); | ||
if (persist) { | ||
this.upsert(channels); | ||
} | ||
return channels[0]; | ||
@@ -168,0 +171,0 @@ } |
@@ -112,3 +112,3 @@ import { diffInSeconds } from './utils'; | ||
if (cm.id === channelMembership?.id) { | ||
return { ...channelMembership }; | ||
return { ...cm, ...channelMembership }; | ||
} | ||
@@ -218,6 +218,10 @@ return cm; | ||
async getChannelByExternalId(channelExternalId: string) { | ||
async getChannelByExternalId( | ||
channelExternalId: string, | ||
persist: boolean = true | ||
) { | ||
return await this.channelsStorage.getByExternalId( | ||
channelExternalId, | ||
this.chatClient | ||
this.chatClient, | ||
persist | ||
); | ||
@@ -224,0 +228,0 @@ } |
@@ -85,3 +85,4 @@ import { diffInSeconds } from './utils'; | ||
const channel = await chatService.getChannelByExternalId( | ||
channelExternalId | ||
channelExternalId, | ||
false | ||
); | ||
@@ -88,0 +89,0 @@ const channelMessageStorage = chatService.channelMessageStorage( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
216911
3951