@pmate/chat-sdk 0.12.0-next.75 → 0.12.0-next.76
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.
|
@@ -838,7 +838,7 @@ export class ChatSession {
|
|
|
838
838
|
this.publishGlobal();
|
|
839
839
|
}
|
|
840
840
|
/** Withdraw one conversation without retiring sibling conversations. */
|
|
841
|
-
revokeThread(threadId) {
|
|
841
|
+
async revokeThread(threadId) { await Promise.all([this.messages.revoke(threadId), this.groups?.revoke(threadId)]); }
|
|
842
842
|
/** Permanently retire this identity/team session. UI withdrawal is immediate;
|
|
843
843
|
* completion means all durable stores have crossed the same authority epoch. */
|
|
844
844
|
revokeAccess() {
|
|
@@ -195,6 +195,13 @@ export class GroupClient {
|
|
|
195
195
|
}
|
|
196
196
|
schedule(entry) { if (!this.closed && !this.withdrawn && !this.denied.has(entry.thread.id) && !isOffline())
|
|
197
197
|
this.tasks.schedule(entry.thread.id, async () => { await this.get(entry.thread, { refresh: true }); }); }
|
|
198
|
+
async revoke(threadId) {
|
|
199
|
+
this.denied.add(threadId);
|
|
200
|
+
const entry = this.entries.get(threadId);
|
|
201
|
+
if (entry)
|
|
202
|
+
this.publish(entry, { loading: false, error: Object.assign(new Error("GROUP_ACCESS_REVOKED"), { status: 403, threadId }) });
|
|
203
|
+
await this.cache.remove(threadId);
|
|
204
|
+
}
|
|
198
205
|
wake() { for (const entry of this.entries.values())
|
|
199
206
|
this.schedule(entry); }
|
|
200
207
|
hint(thread, versionNumber) {
|
|
@@ -232,6 +239,8 @@ export class GroupClient {
|
|
|
232
239
|
const value = this.normalize(await this.options.load(entry.thread.targetId, controller.signal), entry);
|
|
233
240
|
await this.checkAuthority();
|
|
234
241
|
this.assertOpen();
|
|
242
|
+
if (this.denied.has(entry.thread.id))
|
|
243
|
+
throw Object.assign(new Error("GROUP_ACCESS_REVOKED"), { status: 403, threadId: entry.thread.id });
|
|
235
244
|
if (entry.snapshot.data && value.versionNumber <= entry.snapshot.data.versionNumber)
|
|
236
245
|
await this.reload(entry);
|
|
237
246
|
const old = entry.snapshot.data;
|
package/package.json
CHANGED