@shaxpir/duiduidui-models 1.4.15 → 1.4.18
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/repo/ShareSync.d.ts +7 -0
- package/dist/repo/ShareSync.js +20 -0
- package/package.json +1 -1
package/dist/repo/ShareSync.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface ShareSyncOptions {
|
|
|
23
23
|
webSocketConstructor?: any;
|
|
24
24
|
enableDurableStore?: boolean;
|
|
25
25
|
storageFactory?: () => Promise<any>;
|
|
26
|
+
maxBatchSize?: number;
|
|
26
27
|
}
|
|
27
28
|
export declare class ShareSyncFactory {
|
|
28
29
|
private static INSTANCE;
|
|
@@ -71,4 +72,10 @@ export declare class ShareSync {
|
|
|
71
72
|
dispose(model: Model): void;
|
|
72
73
|
onOperationError(opError: any): void;
|
|
73
74
|
private wrap;
|
|
75
|
+
/**
|
|
76
|
+
* Flush control methods for optimizing bulk write operations
|
|
77
|
+
*/
|
|
78
|
+
setAutoBatchEnabled(enabled: boolean): void;
|
|
79
|
+
isAutoBatchEnabled(): boolean;
|
|
80
|
+
flush(): void;
|
|
74
81
|
}
|
package/dist/repo/ShareSync.js
CHANGED
|
@@ -149,6 +149,7 @@ class ShareSync {
|
|
|
149
149
|
durableStore: {
|
|
150
150
|
storage: this._storage,
|
|
151
151
|
debug: this._debug,
|
|
152
|
+
maxBatchSize: options.maxBatchSize || 25, // Default 25 for better bulk write performance
|
|
152
153
|
extVersionDecoder: (docData) => {
|
|
153
154
|
if (docData &&
|
|
154
155
|
docData.meta &&
|
|
@@ -428,5 +429,24 @@ class ShareSync {
|
|
|
428
429
|
}
|
|
429
430
|
throw new Error(`can't wrap content ${kind}/${doc.id}`);
|
|
430
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Flush control methods for optimizing bulk write operations
|
|
434
|
+
*/
|
|
435
|
+
setAutoBatchEnabled(enabled) {
|
|
436
|
+
if (this._durableStore && typeof this._durableStore.setAutoBatchEnabled === 'function') {
|
|
437
|
+
this._durableStore.setAutoBatchEnabled(enabled);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
isAutoBatchEnabled() {
|
|
441
|
+
if (this._durableStore && typeof this._durableStore.isAutoBatchEnabled === 'function') {
|
|
442
|
+
return this._durableStore.isAutoBatchEnabled();
|
|
443
|
+
}
|
|
444
|
+
return true; // Default to enabled if DurableStore doesn't support it
|
|
445
|
+
}
|
|
446
|
+
flush() {
|
|
447
|
+
if (this._durableStore && typeof this._durableStore.flush === 'function') {
|
|
448
|
+
this._durableStore.flush();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
431
451
|
}
|
|
432
452
|
exports.ShareSync = ShareSync;
|