@shaxpir/duiduidui-models 1.25.8 → 1.25.10
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/models/Chat.js +11 -0
- package/dist/models/SharedContent.js +6 -0
- package/package.json +1 -1
package/dist/models/Chat.js
CHANGED
|
@@ -54,25 +54,36 @@ class Chat extends SharedContent_1.SharedContent {
|
|
|
54
54
|
*/
|
|
55
55
|
async modelUpdated() {
|
|
56
56
|
this.checkDisposed('Chat.modelUpdated');
|
|
57
|
+
const chatId = this.id;
|
|
58
|
+
const title = this.title;
|
|
59
|
+
console.log(`[Chat.modelUpdated] START chat=${chatId} title=${JSON.stringify(title)} acquireCount=${this.acquireCount}`);
|
|
57
60
|
// Update manifests for all participants
|
|
58
61
|
await super.modelUpdated();
|
|
62
|
+
console.log(`[Chat.modelUpdated] after super.modelUpdated chat=${chatId} acquireCount=${this.acquireCount}`);
|
|
59
63
|
// Update workspace stubs for all participants
|
|
60
64
|
const stub = this.toStub();
|
|
61
65
|
const userIds = this.getAllSharedUserIds();
|
|
66
|
+
console.log(`[Chat.modelUpdated] stub.title=${JSON.stringify(stub.title)} userIds=${JSON.stringify(userIds)}`);
|
|
62
67
|
for (const userId of userIds) {
|
|
63
68
|
try {
|
|
64
69
|
const workspaceId = shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.WORKSPACE);
|
|
65
70
|
const workspace = await this.shareSync.acquire(ContentKind_1.ContentKind.WORKSPACE, workspaceId);
|
|
66
71
|
if (workspace && workspace.exists()) {
|
|
72
|
+
console.log(`[Chat.modelUpdated] upserting stub for user=${userId} workspace=${workspaceId}`);
|
|
67
73
|
// Cast needed to avoid circular dependency between Chat and Workspace
|
|
68
74
|
workspace.upsertChatStub(stub);
|
|
69
75
|
workspace.release();
|
|
70
76
|
}
|
|
77
|
+
else {
|
|
78
|
+
console.log(`[Chat.modelUpdated] workspace not found for user=${userId} workspace=${workspaceId}`);
|
|
79
|
+
}
|
|
71
80
|
}
|
|
72
81
|
catch (err) {
|
|
82
|
+
console.error(`[Chat.modelUpdated] ERROR for user=${userId}:`, err);
|
|
73
83
|
this.shareSync.onError(err, 'Chat.modelUpdated.workspaceStub');
|
|
74
84
|
}
|
|
75
85
|
}
|
|
86
|
+
console.log(`[Chat.modelUpdated] END chat=${chatId}`);
|
|
76
87
|
}
|
|
77
88
|
// ---- Getters ----
|
|
78
89
|
get payload() {
|
|
@@ -28,21 +28,27 @@ class SharedContent extends Content_1.Content {
|
|
|
28
28
|
async modelUpdated() {
|
|
29
29
|
this.checkDisposed("SharedContent.modelUpdated");
|
|
30
30
|
this.acquire();
|
|
31
|
+
const contentId = this.id;
|
|
31
32
|
const userIds = this.getAllSharedUserIds();
|
|
32
33
|
for (const userId of userIds) {
|
|
33
34
|
try {
|
|
34
35
|
const manifestId = Manifest_1.Manifest.makeManifestId(userId);
|
|
36
|
+
console.log(`[SharedContent.modelUpdated] acquiring manifest ${manifestId} for content=${contentId}`);
|
|
35
37
|
const manifest = await this.shareSync.acquire(ContentKind_1.ContentKind.MANIFEST, manifestId);
|
|
38
|
+
console.log(`[SharedContent.modelUpdated] acquired manifest ${manifestId} exists=${manifest?.exists()}`);
|
|
36
39
|
if (manifest && manifest.exists()) {
|
|
37
40
|
manifest.update(this);
|
|
38
41
|
manifest.release();
|
|
42
|
+
console.log(`[SharedContent.modelUpdated] updated and released manifest ${manifestId}`);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
catch (err) {
|
|
46
|
+
console.error(`[SharedContent.modelUpdated] ERROR acquiring manifest for user=${userId}:`, err);
|
|
42
47
|
this.shareSync.onError(err, 'SharedContent.modelUpdated.manifest');
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
this.release();
|
|
51
|
+
console.log(`[SharedContent.modelUpdated] released content=${contentId} acquireCount=${this.acquireCount}`);
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
exports.SharedContent = SharedContent;
|