@shaxpir/duiduidui-models 1.24.3 → 1.25.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/dist/models/Chat.js
CHANGED
|
@@ -30,12 +30,16 @@ class SharedContent extends Content_1.Content {
|
|
|
30
30
|
this.acquire();
|
|
31
31
|
const userIds = this.getAllSharedUserIds();
|
|
32
32
|
for (const userId of userIds) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
try {
|
|
34
|
+
const manifestId = Manifest_1.Manifest.makeManifestId(userId);
|
|
35
|
+
const manifest = await this.shareSync.acquire(ContentKind_1.ContentKind.MANIFEST, manifestId);
|
|
36
|
+
if (manifest && manifest.exists()) {
|
|
37
|
+
manifest.update(this);
|
|
38
|
+
manifest.release();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
this.shareSync.onError(err, 'SharedContent.modelUpdated.manifest');
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
this.release();
|
package/dist/repo/ShareSync.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface ShareSyncOptions {
|
|
|
17
17
|
connectionListener: ConnectionListener;
|
|
18
18
|
urlProvider: () => Promise<string>;
|
|
19
19
|
opErrorCallback: (error?: any) => void;
|
|
20
|
+
errorCallback?: (error: any, context: string) => void;
|
|
20
21
|
onReadyCallback?: () => void;
|
|
21
22
|
pingInterval?: number;
|
|
22
23
|
encryptionKey?: string;
|
|
@@ -53,6 +54,7 @@ export declare class ShareSync {
|
|
|
53
54
|
private _debug;
|
|
54
55
|
private _disposalStrategy;
|
|
55
56
|
private _opErrorCallback;
|
|
57
|
+
private _errorCallback;
|
|
56
58
|
private _modelCache;
|
|
57
59
|
private _encryption;
|
|
58
60
|
private _hasDurableStore;
|
|
@@ -94,6 +96,7 @@ export declare class ShareSync {
|
|
|
94
96
|
isDocInInventory(kind: ContentKind, ref: ContentRef, minVersion?: CompactDateTime): boolean;
|
|
95
97
|
dispose(model: Model): void;
|
|
96
98
|
onOperationError(opError: any): void;
|
|
99
|
+
onError(error: any, context: string): void;
|
|
97
100
|
private wrap;
|
|
98
101
|
/**
|
|
99
102
|
* Flush control methods for optimizing bulk write operations
|
package/dist/repo/ShareSync.js
CHANGED
|
@@ -121,6 +121,7 @@ class ShareSync {
|
|
|
121
121
|
shareSync._debug = options.debug;
|
|
122
122
|
shareSync._disposalStrategy = options.disposalStrategy;
|
|
123
123
|
shareSync._opErrorCallback = options.opErrorCallback;
|
|
124
|
+
shareSync._errorCallback = options.errorCallback || null;
|
|
124
125
|
shareSync._hasDurableStore = options.enableDurableStore === true && options.namespace && options.namespace.length > 0;
|
|
125
126
|
shareSync._useDurableStoreEncryption = options.encryptionKey && options.encryptionKey.length > 0;
|
|
126
127
|
shareSync._durableStoreEncryptionKey = options.encryptionKey;
|
|
@@ -324,7 +325,7 @@ class ShareSync {
|
|
|
324
325
|
shareSync.isDebug() && console.log(`created content ${compoundKey}`);
|
|
325
326
|
const content = shareSync.wrap(body.meta.kind, doc, true);
|
|
326
327
|
this._modelCache.set(compoundKey, content);
|
|
327
|
-
|
|
328
|
+
content.modelUpdated();
|
|
328
329
|
return content;
|
|
329
330
|
}
|
|
330
331
|
async acquire(kind, id, timestamp) {
|
|
@@ -474,6 +475,11 @@ class ShareSync {
|
|
|
474
475
|
onOperationError(opError) {
|
|
475
476
|
this._opErrorCallback && this._opErrorCallback(opError);
|
|
476
477
|
}
|
|
478
|
+
onError(error, context) {
|
|
479
|
+
if (this._errorCallback) {
|
|
480
|
+
this._errorCallback(error, context);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
477
483
|
wrap(kind, doc, shouldAcquire) {
|
|
478
484
|
const shareSync = this;
|
|
479
485
|
if (kind === ContentKind_1.ContentKind.BILLING) {
|