hgs-twilio-class-lib 1.1.88 → 1.1.90
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.
|
@@ -45,7 +45,7 @@ class AgentScoreDataController {
|
|
|
45
45
|
}
|
|
46
46
|
const dbTransaction = yield this.getsyncTransaction(syncMapName);
|
|
47
47
|
const table = dbTransaction.objectStore(syncMapName);
|
|
48
|
-
return
|
|
48
|
+
return table.add(syncMapName, Id, ttl);
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
console.error("Error adding real-time dashboard Map:", error);
|
|
@@ -17,6 +17,7 @@ export declare class SyncServiceFactory extends ServiceResourceFactory {
|
|
|
17
17
|
cmp(first: any, second: any): number;
|
|
18
18
|
getDatabase(): any;
|
|
19
19
|
private checkDatabaseExists;
|
|
20
|
+
private getOrCreateDatabase;
|
|
20
21
|
private setDatabaseDetails;
|
|
21
22
|
private syncServiceOpen;
|
|
22
23
|
}
|
|
@@ -26,7 +26,9 @@ class SyncServiceFactory extends ServiceResourceFactory_1.ServiceResourceFactory
|
|
|
26
26
|
}
|
|
27
27
|
asyncOpen(name, version) {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
yield this.
|
|
29
|
+
const sid = yield this.getOrCreateDatabase(name, version);
|
|
30
|
+
this._syncServiceSid = sid;
|
|
31
|
+
SyncServiceFactory._syncServiceInstance = this.syncService(sid);
|
|
30
32
|
if (this._syncServiceSid) {
|
|
31
33
|
return new Promise((resolve) => {
|
|
32
34
|
resolve(new SyncOpenRequest_1.SyncOpenDBRequest(new SyncResource_1.SyncResource(this._syncServiceSid ? this._syncServiceSid : ""), 'done'));
|
|
@@ -86,6 +88,20 @@ class SyncServiceFactory extends ServiceResourceFactory_1.ServiceResourceFactory
|
|
|
86
88
|
return existingSyncService;
|
|
87
89
|
});
|
|
88
90
|
}
|
|
91
|
+
getOrCreateDatabase(name, version) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const existing = yield this.checkDatabaseExists(name, version);
|
|
94
|
+
if (existing.length > 0) {
|
|
95
|
+
return existing[0].sid;
|
|
96
|
+
}
|
|
97
|
+
// Create Sync Service
|
|
98
|
+
const friendlyName = version ? `${name}-${version}` : name;
|
|
99
|
+
const created = yield this.syncService.create({
|
|
100
|
+
friendlyName
|
|
101
|
+
});
|
|
102
|
+
return created.sid;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
89
105
|
setDatabaseDetails(name, version) {
|
|
90
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
107
|
const existingResource = yield this.checkDatabaseExists(name, version);
|