@banta/sdk 5.7.0 → 5.8.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/esm2022/lib/chat-source-base.mjs +1 -1
- package/esm2022/lib/chat-source.mjs +31 -2
- package/esm2022/lib/static-chat-source.mjs +4 -1
- package/fesm2022/banta-sdk.mjs +33 -1
- package/fesm2022/banta-sdk.mjs.map +1 -1
- package/lib/chat-source-base.d.ts +1 -0
- package/lib/chat-source.d.ts +13 -0
- package/lib/static-chat-source.d.ts +1 -0
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ export interface ChatSourceBase {
|
|
|
23
23
|
send(message: ChatMessage): Promise<ChatMessage>;
|
|
24
24
|
close(): any;
|
|
25
25
|
getCount(): Promise<number>;
|
|
26
|
+
loadSince(id: string): Promise<ChatMessage[]>;
|
|
26
27
|
getExistingMessages(): Promise<ChatMessage[]>;
|
|
27
28
|
loadAfter(message: ChatMessage, count: number): Promise<ChatMessage[]>;
|
|
28
29
|
get(id: string): Promise<ChatMessage>;
|
package/lib/chat-source.d.ts
CHANGED
|
@@ -28,6 +28,19 @@ export declare class ChatSource extends SocketRPC implements ChatSourceBase {
|
|
|
28
28
|
bind(socket: DurableSocket): Promise<this>;
|
|
29
29
|
private mapOrUpdateMessages;
|
|
30
30
|
private mapOrUpdateMessage;
|
|
31
|
+
/**
|
|
32
|
+
* Ask server for messages that have occurred since the message with the given ID.
|
|
33
|
+
* This is used during brief reconnects to avoid dropping messages, while also not
|
|
34
|
+
* causing mobbing as everyone reconnects after an issue. The backend can choose to
|
|
35
|
+
* not service this request, instead returning undefined. In that case, the client
|
|
36
|
+
* is expected to fetch the existing messages and start state anew.
|
|
37
|
+
*
|
|
38
|
+
* TODO: this is not yet used
|
|
39
|
+
*
|
|
40
|
+
* @param id
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
loadSince(id: string): Promise<ChatMessage[]>;
|
|
31
44
|
getExistingMessages(): Promise<ChatMessage[]>;
|
|
32
45
|
private ensureConnection;
|
|
33
46
|
editMessage(messageId: string, text: string): Promise<void>;
|
|
@@ -29,6 +29,7 @@ export declare class StaticChatSource implements ChatSourceBase {
|
|
|
29
29
|
send(message: ChatMessage): Promise<ChatMessage>;
|
|
30
30
|
close(): void;
|
|
31
31
|
getCount(): Promise<number>;
|
|
32
|
+
loadSince(id: string): Promise<any>;
|
|
32
33
|
getExistingMessages(): Promise<ChatMessage[]>;
|
|
33
34
|
loadAfter(message: ChatMessage, count: number): Promise<ChatMessage[]>;
|
|
34
35
|
get(id: string): Promise<ChatMessage>;
|