@fabriktor/fx 0.0.56 → 0.0.58
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/dist/src/chat/chat.d.ts +5 -0
- package/dist/src/chat/chat.js +12 -3
- package/package.json +1 -1
package/dist/src/chat/chat.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export type EnsureChatRoomOptions = Parameters<ChatOperator["ensureChatRoom"]>[0
|
|
|
8
8
|
export type MarkChatObjectsUploadedOptions = {
|
|
9
9
|
id: ChatReplaceOptions["id"];
|
|
10
10
|
};
|
|
11
|
+
export type ClearChatObjectsOptions = {
|
|
12
|
+
id: ChatReplaceOptions["id"];
|
|
13
|
+
};
|
|
11
14
|
export type ReactChatOptions = Parameters<ChatOperator["reactChat"]>[0];
|
|
12
15
|
export type ChatFXOptions = {
|
|
13
16
|
chat: ChatOperator;
|
|
@@ -111,6 +114,7 @@ export interface ChatFXOperator {
|
|
|
111
114
|
createChat(opts: CreateChatOptions): Promise<Chat>;
|
|
112
115
|
ensureChatRoom(opts: EnsureChatRoomOptions): Promise<string>;
|
|
113
116
|
markChatObjectsUploaded(opts: MarkChatObjectsUploadedOptions): Promise<Chat>;
|
|
117
|
+
clearChatObjects(opts: ClearChatObjectsOptions): Promise<Chat>;
|
|
114
118
|
searchChats(opts: SearchChatsOptions): Promise<SearchChatsPage>;
|
|
115
119
|
newLatestChatsCursor(opts: LatestChatsOptions): LatestChatsCursor;
|
|
116
120
|
latestChats(opts: LatestChatsOptions): Promise<LatestChatsPage>;
|
|
@@ -131,6 +135,7 @@ export declare class ChatFX implements ChatFXOperator {
|
|
|
131
135
|
createChat(opts: CreateChatOptions): Promise<Chat>;
|
|
132
136
|
ensureChatRoom(opts: EnsureChatRoomOptions): Promise<string>;
|
|
133
137
|
markChatObjectsUploaded(opts: MarkChatObjectsUploadedOptions): Promise<Chat>;
|
|
138
|
+
clearChatObjects(opts: ClearChatObjectsOptions): Promise<Chat>;
|
|
134
139
|
searchChats(opts: SearchChatsOptions): Promise<SearchChatsPage>;
|
|
135
140
|
newLatestChatsCursor(opts: LatestChatsOptions): LatestChatsCursor;
|
|
136
141
|
latestChats(opts: LatestChatsOptions): Promise<LatestChatsPage>;
|
package/dist/src/chat/chat.js
CHANGED
|
@@ -8,7 +8,6 @@ import { errRequired, errResolveFailed, errValidation } from "../core/err.js";
|
|
|
8
8
|
import { requiredOperationID } from "../core/id.js";
|
|
9
9
|
import { normalizeSearchPage, normalizeSearchPerPage, normalizeSearchQuery, runSearch, } from "../core/search.js";
|
|
10
10
|
const closeCodeNormal = 1000;
|
|
11
|
-
const closeCodeLeavingPage = 1001;
|
|
12
11
|
const wsRefreshMilliseconds = 40 * 60 * 1000;
|
|
13
12
|
const wsRefreshRetryMilliseconds = 30 * 1000;
|
|
14
13
|
const resourceChat = "chat";
|
|
@@ -44,6 +43,16 @@ export class ChatFX {
|
|
|
44
43
|
});
|
|
45
44
|
return await this.findChat(opts.id);
|
|
46
45
|
}
|
|
46
|
+
async clearChatObjects(opts) {
|
|
47
|
+
await this.chat.replaceOneChat({
|
|
48
|
+
id: opts.id,
|
|
49
|
+
in: {
|
|
50
|
+
has_objects: false,
|
|
51
|
+
objects_uploaded: false,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
return await this.findChat(opts.id);
|
|
55
|
+
}
|
|
47
56
|
async searchChats(opts) {
|
|
48
57
|
const q = normalizeSearchQuery(opts.q);
|
|
49
58
|
if (q === undefined) {
|
|
@@ -219,7 +228,7 @@ export class ChatFX {
|
|
|
219
228
|
closeSession(closeCodeNormal, reason);
|
|
220
229
|
},
|
|
221
230
|
closeLeavingPage(reason) {
|
|
222
|
-
closeSession(
|
|
231
|
+
closeSession(closeCodeNormal, reason);
|
|
223
232
|
},
|
|
224
233
|
};
|
|
225
234
|
}
|
|
@@ -287,7 +296,7 @@ export class ChatFX {
|
|
|
287
296
|
closeSession(closeCodeNormal, reason);
|
|
288
297
|
},
|
|
289
298
|
closeLeavingPage(reason) {
|
|
290
|
-
closeSession(
|
|
299
|
+
closeSession(closeCodeNormal, reason);
|
|
291
300
|
},
|
|
292
301
|
};
|
|
293
302
|
}
|