@banta/sdk 5.1.0 → 5.2.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.
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ChatMessage, CommentsOrder, Notification, User, UrlCard, FilterMode } from '@banta/common';
2
+ import { ChatMessage, CommentsOrder, Notification, User, UrlCard, FilterMode, Topic } from '@banta/common';
3
3
  import { ChatSourceBase } from './chat-source-base';
4
4
  import { AttachmentResolver, AttachmentScraper } from './attachment-scraper';
5
5
  export interface ChatSourceOptions {
@@ -14,7 +14,42 @@ export declare abstract class ChatBackendBase {
14
14
  constructor();
15
15
  abstract getSourceForTopic(topicId: string, options?: ChatSourceOptions): Promise<ChatSourceBase>;
16
16
  abstract getSourceForThread(topicId: string, messageId: string, options?: ChatSourceOptions): Promise<ChatSourceBase>;
17
+ /**
18
+ * Get the count of the given topic
19
+ * @param topicId
20
+ * @returns
21
+ */
17
22
  abstract getSourceCountForTopic(topicId: string): Promise<number>;
23
+ /**
24
+ * Get the count of the given topics.
25
+ * @param topicId Topics to count messages on. Maximum of 1000.
26
+ * @returns
27
+ */
28
+ abstract getSourceCountForTopics(topicIds: string[]): Promise<Record<string, number>>;
29
+ /**
30
+ * Get information about the given topic.
31
+ * @param topicId
32
+ * @returns The topic object, or undefined if no such topic was found.
33
+ */
34
+ abstract getTopic(topicId: string): Promise<Topic | undefined>;
35
+ /**
36
+ * Get information about the given topics
37
+ * @param topicIds The topic IDs to look up. Maximum of 1000.
38
+ * @returns An array of matching topic objects.
39
+ */
40
+ abstract getTopicsById(topicIds: string[]): Promise<Topic[]>;
41
+ /**
42
+ * Get a set of messages from the given topic.
43
+ * @param topicId
44
+ * @returns
45
+ */
46
+ abstract getMessages(topicId: string, sort?: CommentsOrder, filter?: FilterMode, offset?: number, limit?: number): Promise<ChatMessage[]>;
47
+ /**
48
+ * Get a set of messages from the given topic.
49
+ * @param topicId
50
+ * @returns
51
+ */
52
+ abstract getReplies(parentMessageId: string, sort?: CommentsOrder, filter?: FilterMode, offset?: number, limit?: number): Promise<ChatMessage[]>;
18
53
  abstract refreshMessage(message: ChatMessage): Promise<ChatMessage>;
19
54
  abstract getMessage(topicId: string, messageId: string): Promise<ChatMessage>;
20
55
  abstract getSubMessage(topicId: string, parentMessageId: string, messageId: string): Promise<ChatMessage>;
@@ -19,11 +19,11 @@ export declare class ChatSource extends SocketRPC implements ChatSourceBase {
19
19
  private _state;
20
20
  get sortOrder(): "newest" | "oldest" | "likes";
21
21
  get filterMode(): string;
22
- get state(): "connected" | "connecting" | "lost" | "restored";
23
- set state(value: "connected" | "connecting" | "lost" | "restored");
22
+ get state(): "lost" | "connected" | "connecting" | "restored";
23
+ set state(value: "lost" | "connected" | "connecting" | "restored");
24
24
  private _connectionStateChanged;
25
25
  private _connectionStateChanged$;
26
- get connectionStateChanged(): import("rxjs").Observable<"connected" | "connecting" | "lost" | "restored">;
26
+ get connectionStateChanged(): import("rxjs").Observable<"lost" | "connected" | "connecting" | "restored">;
27
27
  private wasRestored;
28
28
  bind(socket: DurableSocket): Promise<this>;
29
29
  private mapOrUpdateMessages;
@@ -36,7 +36,7 @@ export declare class StaticChatSource implements ChatSourceBase {
36
36
  unlikeMessage(messageId: string): Promise<void>;
37
37
  editMessage(messageId: string, text: string): Promise<void>;
38
38
  deleteMessage(messageId: string): Promise<void>;
39
- connectionStateChanged: Subject<"connected" | "connecting" | "lost" | "restored">;
39
+ connectionStateChanged: Subject<"lost" | "connected" | "connecting" | "restored">;
40
40
  state: 'connecting' | 'connected' | 'lost' | 'restored';
41
41
  get errorState(): any;
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banta/sdk",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"