hgs-twilio-class-lib 1.1.73 → 1.1.74
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/README.md +5 -5
- package/lib/config/DatabaseConfig.d.ts +2 -29
- package/lib/config/DatabaseConfig.js +31 -29
- package/lib/controller/RealTimeDashboardController.d.ts +39 -0
- package/lib/controller/RealTimeDashboardController.js +267 -0
- package/lib/controller/twilio/AgentActionsController.js +5 -5
- package/lib/controller/twilio/AgentScorecardController.js +4 -4
- package/lib/controller/twilio/AuditLogController.js +1 -1
- package/lib/controller/twilio/CallLogsController.js +5 -5
- package/lib/controller/twilio/CallbackAndVoicemailController.js +5 -5
- package/lib/controller/twilio/ChannelSettingTaskInfoController.js +5 -5
- package/lib/controller/twilio/ChannelSettingsController.js +1 -1
- package/lib/controller/twilio/CxConfigAssetController.js +5 -5
- package/lib/controller/twilio/CxConfigController.js +1 -1
- package/lib/controller/twilio/CxConfigExternalNumbersController.js +5 -5
- package/lib/controller/twilio/CxConfigOther.js +5 -5
- package/lib/controller/twilio/CxConfigQueueMenuController.js +5 -5
- package/lib/controller/twilio/CxConfigUIconfigController.js +5 -5
- package/lib/controller/twilio/GPMController.js +5 -5
- package/lib/controller/twilio/HoopHolidaysController.js +5 -5
- package/lib/controller/twilio/HoopMainController.js +3 -3
- package/lib/controller/twilio/HoopNotesController.js +5 -5
- package/lib/controller/twilio/HoopOperationsController.js +5 -5
- package/lib/controller/twilio/HoopOverrideBranchesController.js +5 -5
- package/lib/controller/twilio/HoopPartialDaysController.js +5 -5
- package/lib/controller/twilio/HoopProfilesListController.js +5 -5
- package/lib/controller/twilio/NavigationController.js +5 -5
- package/lib/controller/twilio/QualityFormsController.js +5 -5
- package/lib/controller/twilio/QuickLinkController.js +4 -4
- package/lib/controller/twilio/RealTimeReportQueueDetailsController.js +1 -1
- package/lib/controller/twilio/RealTimeReportsWGDetailsController.js +4 -4
- package/lib/controller/twilio/TaskInfoPanelController.js +1 -1
- package/lib/models/impl/DailySummaryModel.d.ts +60 -0
- package/lib/models/impl/DailySummaryModel.js +247 -0
- package/lib/models/impl/IntervalSummaryModel.d.ts +63 -0
- package/lib/models/impl/IntervalSummaryModel.js +261 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.js +5 -1
- package/lib/models/types/RealtimeSyncMapDetails.type.d.ts +6 -0
- package/lib/models/types/RealtimeSyncMapDetails.type.js +7 -0
- package/lib/server.js +2 -0
- package/lib/twilio/impl/sync/SyncMap.js +11 -69
- package/lib/twilio/impl/sync/SyncMapItem.d.ts +24 -4
- package/lib/twilio/impl/sync/SyncMapItem.js +134 -2
- package/lib/twilio/impl/sync/SyncMapItemsTransaction.d.ts +22 -0
- package/lib/twilio/impl/sync/SyncMapItemsTransaction.js +38 -0
- package/lib/twilio/impl/sync/SyncMapTransaction.js +2 -2
- package/lib/twilio/impl/sync/SyncResource.d.ts +1 -0
- package/lib/twilio/impl/sync/SyncResource.js +7 -0
- package/lib/twilio/impl/sync/SyncServiceFactory.d.ts +1 -1
- package/lib/twilio/impl/sync/SyncServiceFactory.js +1 -2
- package/package.json +56 -56
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Flex V2 Backend Code
|
|
2
|
-
|
|
3
|
-
Package to manage Flex V2 Backend.
|
|
4
|
-
|
|
5
|
-
Run "npm install hgs-twilio-class-lib --save"
|
|
1
|
+
# Flex V2 Backend Code
|
|
2
|
+
|
|
3
|
+
Package to manage Flex V2 Backend.
|
|
4
|
+
|
|
5
|
+
Run "npm install hgs-twilio-class-lib --save"
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
export declare const databaseConfig: {
|
|
2
2
|
databaseName: string;
|
|
3
|
+
realTimeDatabaseName: string;
|
|
3
4
|
version: number;
|
|
4
|
-
tables:
|
|
5
|
-
gpmTable: string;
|
|
6
|
-
hoopProfileList: string;
|
|
7
|
-
hoopOverrideBranches: string;
|
|
8
|
-
hoopOperations: string;
|
|
9
|
-
hoopHolidays: string;
|
|
10
|
-
hoopPartialDays: string;
|
|
11
|
-
hoopNotes: string;
|
|
12
|
-
callLogsTable: string;
|
|
13
|
-
cxConfigAssetTable: string;
|
|
14
|
-
cxConfigTable: string;
|
|
15
|
-
cxConfigOtherTable: string;
|
|
16
|
-
cxConfigUIconfigTable: string;
|
|
17
|
-
cxConfigExternalNumbersTable: string;
|
|
18
|
-
cxConfigQueueMenuTable: string;
|
|
19
|
-
callbackAndVoicemailTable: string;
|
|
20
|
-
auditLogTable: string;
|
|
21
|
-
quickLinksTable: string;
|
|
22
|
-
qualityFormsTable: string;
|
|
23
|
-
taskcompleteTable: string;
|
|
24
|
-
navigationTable: string;
|
|
25
|
-
realTimeReportWGDetailsTable: string;
|
|
26
|
-
realTimeReportQueueDetailsTable: string;
|
|
27
|
-
playbackscreenrecordingsTable: string;
|
|
28
|
-
taskInfoPanelTable: string;
|
|
29
|
-
channelSettingsTable: string;
|
|
30
|
-
agentScorecardTable: string;
|
|
31
|
-
agentActionsTable: string;
|
|
32
|
-
};
|
|
5
|
+
tables: Record<string, string>;
|
|
33
6
|
};
|
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.databaseConfig = void 0;
|
|
4
|
+
const tables = {
|
|
5
|
+
gpmTable: "gpm",
|
|
6
|
+
hoopProfileList: "hoopProfiles",
|
|
7
|
+
hoopOverrideBranches: "hoopOverrideBranches",
|
|
8
|
+
hoopOperations: "hoopOperations",
|
|
9
|
+
hoopHolidays: "hoopHolidays",
|
|
10
|
+
hoopPartialDays: "hoopPartialDays",
|
|
11
|
+
hoopNotes: "hoopNotes",
|
|
12
|
+
callLogsTable: "callLogs",
|
|
13
|
+
cxConfigAssetTable: "cxConfigAsset",
|
|
14
|
+
cxConfigTable: "cxConfig",
|
|
15
|
+
cxConfigOtherTable: "cxConfigOther",
|
|
16
|
+
cxConfigUIconfigTable: "cxConfigUIconfig",
|
|
17
|
+
cxConfigExternalNumbersTable: "cxConfigExternalNumbers",
|
|
18
|
+
cxConfigQueueMenuTable: "cxConfigQueueMenu",
|
|
19
|
+
callbackAndVoicemailTable: "callbackAndVoicemail",
|
|
20
|
+
auditLogTable: "auditLog",
|
|
21
|
+
quickLinksTable: "quickLinks",
|
|
22
|
+
qualityFormsTable: "qualityForms",
|
|
23
|
+
taskcompleteTable: "taskcomplete",
|
|
24
|
+
navigationTable: "navigation",
|
|
25
|
+
realTimeReportWGDetailsTable: "realTimeReportWGDetails",
|
|
26
|
+
realTimeReportQueueDetailsTable: "realTimeReportQueueDetails",
|
|
27
|
+
playbackscreenrecordingsTable: "Recordings-QA",
|
|
28
|
+
taskInfoPanelTable: "taskInfoPanel",
|
|
29
|
+
channelSettingsTable: "channelSettings",
|
|
30
|
+
agentScorecardTable: "agentScorecard",
|
|
31
|
+
agentActionsTable: "agentActions"
|
|
32
|
+
};
|
|
4
33
|
exports.databaseConfig = {
|
|
5
34
|
databaseName: "flex2",
|
|
35
|
+
realTimeDatabaseName: "realtime-dashboard",
|
|
6
36
|
version: 1,
|
|
7
|
-
tables:
|
|
8
|
-
gpmTable: "gpm",
|
|
9
|
-
hoopProfileList: "hoopProfiles",
|
|
10
|
-
hoopOverrideBranches: "hoopOverrideBranches",
|
|
11
|
-
hoopOperations: "hoopOperations",
|
|
12
|
-
hoopHolidays: "hoopHolidays",
|
|
13
|
-
hoopPartialDays: "hoopPartialDays",
|
|
14
|
-
hoopNotes: "hoopNotes",
|
|
15
|
-
callLogsTable: "callLogs",
|
|
16
|
-
cxConfigAssetTable: "cxConfigAsset",
|
|
17
|
-
cxConfigTable: "cxConfig",
|
|
18
|
-
cxConfigOtherTable: "cxConfigOther",
|
|
19
|
-
cxConfigUIconfigTable: "cxConfigUIconfig",
|
|
20
|
-
cxConfigExternalNumbersTable: "cxConfigExternalNumbers",
|
|
21
|
-
cxConfigQueueMenuTable: "cxConfigQueueMenu",
|
|
22
|
-
callbackAndVoicemailTable: "callbackAndVoicemail",
|
|
23
|
-
auditLogTable: "auditLog",
|
|
24
|
-
quickLinksTable: "quickLinks",
|
|
25
|
-
qualityFormsTable: "qualityForms",
|
|
26
|
-
taskcompleteTable: "taskcomplete",
|
|
27
|
-
navigationTable: "navigation",
|
|
28
|
-
realTimeReportWGDetailsTable: "realTimeReportWGDetails",
|
|
29
|
-
realTimeReportQueueDetailsTable: "realTimeReportQueueDetails",
|
|
30
|
-
playbackscreenrecordingsTable: "Recordings-QA",
|
|
31
|
-
taskInfoPanelTable: "taskInfoPanel",
|
|
32
|
-
channelSettingsTable: "channelSettings",
|
|
33
|
-
agentScorecardTable: "agentScorecard",
|
|
34
|
-
agentActionsTable: "agentActions"
|
|
35
|
-
},
|
|
37
|
+
tables: tables
|
|
36
38
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SearchParameterType } from "../common/type/SearchParameterType";
|
|
2
|
+
import { IntervalSummaryModel } from "../models/impl/IntervalSummaryModel";
|
|
3
|
+
export declare class RealTimeDashboardController {
|
|
4
|
+
private _dbFactory;
|
|
5
|
+
constructor();
|
|
6
|
+
private getDatabaseConnection;
|
|
7
|
+
private getItemTransaction;
|
|
8
|
+
private getsyncTransaction;
|
|
9
|
+
addMap(reqBody: {
|
|
10
|
+
syncMapName: string;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
getAllMaps(query: SearchParameterType & {
|
|
13
|
+
syncServiceName: string;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
getMap(query: {
|
|
16
|
+
syncMapName: string;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
deletemap(reqBody: {
|
|
19
|
+
syncMapName: string;
|
|
20
|
+
}): Promise<any>;
|
|
21
|
+
addItem(reqBody: {
|
|
22
|
+
syncMapName: string;
|
|
23
|
+
data: IntervalSummaryModel;
|
|
24
|
+
}): Promise<any>;
|
|
25
|
+
getItem(query: Pick<IntervalSummaryModel, "id"> & {
|
|
26
|
+
syncMapName: string;
|
|
27
|
+
}): Promise<any>;
|
|
28
|
+
getAllItems(query: SearchParameterType & {
|
|
29
|
+
syncMapName: string;
|
|
30
|
+
}): Promise<any>;
|
|
31
|
+
editItem(reqBody: {
|
|
32
|
+
syncMapName: string;
|
|
33
|
+
data: IntervalSummaryModel;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
deleteItem(query: Pick<IntervalSummaryModel, "id"> & {
|
|
36
|
+
syncMapName: string;
|
|
37
|
+
}): Promise<any>;
|
|
38
|
+
routeHandler(req: any, res: any): Promise<any>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RealTimeDashboardController = void 0;
|
|
13
|
+
const DatabaseFactoryCollection_1 = require("./DatabaseFactoryCollection");
|
|
14
|
+
const TwilioAuthTokenConfig_1 = require("../twilio/impl/TwilioAuthTokenConfig");
|
|
15
|
+
const TwilioClient_1 = require("../twilio/impl/TwilioClient");
|
|
16
|
+
const SyncServiceFactory_1 = require("../twilio/impl/sync/SyncServiceFactory");
|
|
17
|
+
const TwilioConfig_1 = require("../config/TwilioConfig");
|
|
18
|
+
const DatabaseConfig_1 = require("../config/DatabaseConfig");
|
|
19
|
+
const IntervalSummaryModel_1 = require("../models/impl/IntervalSummaryModel");
|
|
20
|
+
let twilConfig = new TwilioAuthTokenConfig_1.TwilioAuthTokenConfig(TwilioConfig_1.TwilioConfig.accountSid, TwilioConfig_1.TwilioConfig.authToken);
|
|
21
|
+
let twilioClient = new TwilioClient_1.TwilioClient(twilConfig);
|
|
22
|
+
class RealTimeDashboardController {
|
|
23
|
+
constructor() {
|
|
24
|
+
this._dbFactory = new SyncServiceFactory_1.SyncServiceFactory(twilioClient);
|
|
25
|
+
DatabaseFactoryCollection_1.DatabaseFactoryCollection.setdatabaseFactoryCollection("Twilio", this._dbFactory);
|
|
26
|
+
}
|
|
27
|
+
getDatabaseConnection() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.realTimeDatabaseName);
|
|
30
|
+
return databaseConnection.result;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getItemTransaction(syncMapName) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const database = yield this.getDatabaseConnection();
|
|
36
|
+
const dbTransaction = database.transactionItem(syncMapName, "readwrite");
|
|
37
|
+
return dbTransaction;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getsyncTransaction(syncMapName) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const database = yield this.getDatabaseConnection();
|
|
43
|
+
const dbTransaction = database.transaction(syncMapName, "readwrite");
|
|
44
|
+
return dbTransaction;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
addMap(reqBody) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
try {
|
|
50
|
+
const { syncMapName } = reqBody;
|
|
51
|
+
console.log("uniquename::", syncMapName);
|
|
52
|
+
if (!syncMapName) {
|
|
53
|
+
throw new Error("uniqueName is required.");
|
|
54
|
+
}
|
|
55
|
+
const dbTransaction = yield this.getsyncTransaction(syncMapName);
|
|
56
|
+
console.log("dbTransaction:::", dbTransaction);
|
|
57
|
+
// Dynamic table name from request
|
|
58
|
+
// const tableName = databaseConfig.tables[syncMapName];
|
|
59
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
60
|
+
console.log("table check:::", table);
|
|
61
|
+
return table.add(syncMapName, 48 * 60 * 60);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.error("Error adding real-time dashboard Map:", error);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
getAllMaps(query) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
try {
|
|
72
|
+
console.log("check for syncServiceName:::", query.syncServiceName);
|
|
73
|
+
const { syncServiceName } = query;
|
|
74
|
+
if (!syncServiceName) {
|
|
75
|
+
throw new Error(`Invalid syncServiceName: ${syncServiceName}`);
|
|
76
|
+
}
|
|
77
|
+
const dbTransaction = yield this.getsyncTransaction(syncServiceName);
|
|
78
|
+
const table = dbTransaction.objectStore(syncServiceName);
|
|
79
|
+
const allowedFields = [
|
|
80
|
+
"syncServiceName"
|
|
81
|
+
];
|
|
82
|
+
if (query.getFilterContent) {
|
|
83
|
+
query.allowedFields = allowedFields;
|
|
84
|
+
}
|
|
85
|
+
let result = yield table.getAll(syncServiceName);
|
|
86
|
+
console.log("syncmap name:::", result);
|
|
87
|
+
return { result };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error("Error retrieving all syncmaps:", error);
|
|
91
|
+
return error;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
getMap(query) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
try {
|
|
98
|
+
const { syncMapName } = query;
|
|
99
|
+
if (!syncMapName) {
|
|
100
|
+
throw new Error("syncMapName is required.");
|
|
101
|
+
}
|
|
102
|
+
const dbTransaction = yield this.getsyncTransaction(syncMapName);
|
|
103
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
104
|
+
const result = yield table.get(syncMapName);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.error("Error retrieving item:", error);
|
|
109
|
+
return error;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
deletemap(reqBody) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
try {
|
|
116
|
+
const { syncMapName } = reqBody;
|
|
117
|
+
if (!syncMapName) {
|
|
118
|
+
throw new Error("syncMapName is required.");
|
|
119
|
+
}
|
|
120
|
+
const dbTransaction = yield this.getsyncTransaction(syncMapName);
|
|
121
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
122
|
+
const result = yield table.delete(syncMapName);
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error("Error deleting item:", error);
|
|
127
|
+
return error;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
addItem(reqBody) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
try {
|
|
134
|
+
const { syncMapName, data } = reqBody;
|
|
135
|
+
if (!syncMapName) {
|
|
136
|
+
throw new Error("syncMapName is required.");
|
|
137
|
+
}
|
|
138
|
+
const queuedetails = new IntervalSummaryModel_1.IntervalSummaryModel(data.id, data.uniqueName, data.periodNumber, data.intOffr, data.intAns, data.intAbn, data.slaTarget, data.totalServiceLevel, data.sumTalkTime, data.sumHoldTime, data.sumWaitTime, data.longestWaitTime, data.longestHoldTime, data.longestTalkTime, data.longestInboundACDIntereaction, data.longestOutboundACDIntereaction, data.createdAt, data.updatedAt, data.eventId);
|
|
139
|
+
if (queuedetails.validationMessages.length > 0) {
|
|
140
|
+
throw queuedetails.validationMessages;
|
|
141
|
+
}
|
|
142
|
+
const dbTransaction = yield this.getItemTransaction(syncMapName);
|
|
143
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
144
|
+
const result = yield table.add(queuedetails.serialize, queuedetails.id);
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error("Error adding real-time dashboard item:", error);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
getItem(query) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
try {
|
|
156
|
+
const { syncMapName, id } = query;
|
|
157
|
+
if (!syncMapName) {
|
|
158
|
+
throw new Error("syncMapName is required.");
|
|
159
|
+
}
|
|
160
|
+
const dbTransaction = yield this.getItemTransaction(syncMapName);
|
|
161
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
162
|
+
const result = yield table.get(id);
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
console.error("Error retrieving item:", error);
|
|
167
|
+
return error;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
getAllItems(query) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
try {
|
|
174
|
+
const { syncMapName } = query;
|
|
175
|
+
if (!syncMapName) {
|
|
176
|
+
throw new Error(`Invalid syncMapName: ${syncMapName}`);
|
|
177
|
+
}
|
|
178
|
+
const dbTransaction = yield this.getItemTransaction(syncMapName);
|
|
179
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
180
|
+
const allowedFields = [
|
|
181
|
+
"uniqueName"
|
|
182
|
+
];
|
|
183
|
+
if (query.getFilterContent) {
|
|
184
|
+
query.allowedFields = allowedFields;
|
|
185
|
+
}
|
|
186
|
+
query.category = "QueueDetails";
|
|
187
|
+
let result = yield table.getAll(query);
|
|
188
|
+
return { result, meta: query };
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
console.error("Error retrieving all queue details:", error);
|
|
192
|
+
return error;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
editItem(reqBody) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
try {
|
|
199
|
+
const { syncMapName, data } = reqBody;
|
|
200
|
+
if (!syncMapName) {
|
|
201
|
+
throw new Error("syncMapName is required.");
|
|
202
|
+
}
|
|
203
|
+
const queuedetails = new IntervalSummaryModel_1.IntervalSummaryModel(data.id, data.uniqueName, data.periodNumber, data.intOffr, data.intAns, data.intAbn, data.slaTarget, data.totalServiceLevel, data.sumTalkTime, data.sumHoldTime, data.sumWaitTime, data.longestWaitTime, data.longestHoldTime, data.longestTalkTime, data.longestInboundACDIntereaction, data.longestOutboundACDIntereaction, data.createdAt, data.updatedAt, data.eventId);
|
|
204
|
+
if (queuedetails.validationMessages.length > 0) {
|
|
205
|
+
throw queuedetails.validationMessages;
|
|
206
|
+
}
|
|
207
|
+
const dbTransaction = yield this.getItemTransaction(syncMapName);
|
|
208
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
209
|
+
const key = queuedetails.id;
|
|
210
|
+
const result = yield table.put(queuedetails.serialize, key);
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
console.error("Error editing real-time item:", error);
|
|
215
|
+
return error;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
deleteItem(query) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
try {
|
|
222
|
+
const { syncMapName, id } = query;
|
|
223
|
+
if (!syncMapName) {
|
|
224
|
+
throw new Error("syncMapName is required.");
|
|
225
|
+
}
|
|
226
|
+
const dbTransaction = yield this.getItemTransaction(syncMapName);
|
|
227
|
+
const table = dbTransaction.objectStore(syncMapName);
|
|
228
|
+
const result = yield table.delete(id);
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
console.error("Error deleting item:", error);
|
|
233
|
+
return error;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
routeHandler(req, res) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
try {
|
|
240
|
+
const urlParts = req.path.split("/");
|
|
241
|
+
const method = urlParts[1];
|
|
242
|
+
if (!method) {
|
|
243
|
+
return res.status(400).json({ error: "Method is required" });
|
|
244
|
+
}
|
|
245
|
+
const selectedMethod = this[method];
|
|
246
|
+
if (!selectedMethod) {
|
|
247
|
+
return res.status(404).json({ error: `Method "${method}" not found` });
|
|
248
|
+
}
|
|
249
|
+
const input = req.method === "GET" ? req.query : req.body;
|
|
250
|
+
const result = yield selectedMethod.call(this, input);
|
|
251
|
+
return res.json({
|
|
252
|
+
status: 200,
|
|
253
|
+
message: "Success",
|
|
254
|
+
data: result
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
catch (err) {
|
|
258
|
+
console.error("RealTimeDashboard error:", err);
|
|
259
|
+
return res.status(500).json({
|
|
260
|
+
status: 500,
|
|
261
|
+
error: (err === null || err === void 0 ? void 0 : err.message) || err
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.RealTimeDashboardController = RealTimeDashboardController;
|
|
@@ -48,7 +48,7 @@ class AgentActionsController {
|
|
|
48
48
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
49
49
|
const database = databaseConnection.result;
|
|
50
50
|
// Start database transaction
|
|
51
|
-
const dbTransaction = database.
|
|
51
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentActionsTable, "readwrite");
|
|
52
52
|
// Access object store
|
|
53
53
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentActionsTable);
|
|
54
54
|
// Add new data to the object store
|
|
@@ -83,7 +83,7 @@ class AgentActionsController {
|
|
|
83
83
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
84
84
|
const database = databaseConnection.result;
|
|
85
85
|
// Start database transaction
|
|
86
|
-
const dbTransaction = database.
|
|
86
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentActionsTable, "readwrite");
|
|
87
87
|
// Access object store
|
|
88
88
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentActionsTable);
|
|
89
89
|
const key = data.taskSid;
|
|
@@ -114,7 +114,7 @@ class AgentActionsController {
|
|
|
114
114
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
115
115
|
const database = databaseConnection.result;
|
|
116
116
|
// Start database transaction
|
|
117
|
-
const dbTransaction = database.
|
|
117
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentActionsTable, "readwrite");
|
|
118
118
|
// Access object store
|
|
119
119
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentActionsTable);
|
|
120
120
|
let result = yield table.getAll(query);
|
|
@@ -131,7 +131,7 @@ class AgentActionsController {
|
|
|
131
131
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
132
132
|
const database = databaseConnection.result;
|
|
133
133
|
// Start database transaction
|
|
134
|
-
const dbTransaction = database.
|
|
134
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentActionsTable, "readwrite");
|
|
135
135
|
// Access object store
|
|
136
136
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentActionsTable);
|
|
137
137
|
const result = yield table.get(query.taskSid);
|
|
@@ -160,7 +160,7 @@ class AgentActionsController {
|
|
|
160
160
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
161
161
|
const database = databaseConnection.result;
|
|
162
162
|
// Start database transaction
|
|
163
|
-
const dbTransaction = database.
|
|
163
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentActionsTable, "readwrite");
|
|
164
164
|
// Access object store
|
|
165
165
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentActionsTable);
|
|
166
166
|
// Delete data from the object store
|
|
@@ -49,7 +49,7 @@ class AgentScorecardController {
|
|
|
49
49
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
50
50
|
const database = databaseConnection.result;
|
|
51
51
|
// Start database transaction
|
|
52
|
-
const dbTransaction = database.
|
|
52
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable, "readwrite");
|
|
53
53
|
// Access object store
|
|
54
54
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable);
|
|
55
55
|
// Add new data to the object store
|
|
@@ -84,7 +84,7 @@ class AgentScorecardController {
|
|
|
84
84
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
85
85
|
const database = databaseConnection.result;
|
|
86
86
|
// Start database transaction
|
|
87
|
-
const dbTransaction = database.
|
|
87
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable, "readwrite");
|
|
88
88
|
// Access object store
|
|
89
89
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable);
|
|
90
90
|
const key = data.id;
|
|
@@ -115,7 +115,7 @@ class AgentScorecardController {
|
|
|
115
115
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
116
116
|
const database = databaseConnection.result;
|
|
117
117
|
// Start database transaction
|
|
118
|
-
const dbTransaction = database.
|
|
118
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable, "readwrite");
|
|
119
119
|
// Access object store
|
|
120
120
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable);
|
|
121
121
|
const allowedFields = [
|
|
@@ -156,7 +156,7 @@ class AgentScorecardController {
|
|
|
156
156
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
157
157
|
const database = databaseConnection.result;
|
|
158
158
|
// Start database transaction
|
|
159
|
-
const dbTransaction = database.
|
|
159
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable, "readwrite");
|
|
160
160
|
// Access object store
|
|
161
161
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.agentScorecardTable);
|
|
162
162
|
// Delete data from the object store
|
|
@@ -26,7 +26,7 @@ class AuditLogController {
|
|
|
26
26
|
getTransaction() {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
const database = yield this.getDatabaseConnection();
|
|
29
|
-
const dbTransaction = database.
|
|
29
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.auditLogTable, "readwrite");
|
|
30
30
|
return dbTransaction;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -26,7 +26,7 @@ class CallLogsController {
|
|
|
26
26
|
}
|
|
27
27
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
28
28
|
const database = databaseConnection.result;
|
|
29
|
-
const dbTransaction = database.
|
|
29
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callLogsTable, "readwrite");
|
|
30
30
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callLogsTable);
|
|
31
31
|
let result = yield table.add(callLog.serialize, data.id, 24 * 60 * 60); // 1 day
|
|
32
32
|
return result;
|
|
@@ -43,7 +43,7 @@ class CallLogsController {
|
|
|
43
43
|
console.log(query);
|
|
44
44
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
45
45
|
const database = databaseConnection.result;
|
|
46
|
-
const dbTransaction = database.
|
|
46
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callLogsTable, "readwrite");
|
|
47
47
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callLogsTable);
|
|
48
48
|
let result = yield table.get(query.id);
|
|
49
49
|
return result;
|
|
@@ -62,7 +62,7 @@ class CallLogsController {
|
|
|
62
62
|
// changed to Specfic factory as method override is not working
|
|
63
63
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
64
64
|
const database = databaseConnection.result;
|
|
65
|
-
const dbTransaction = database.
|
|
65
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callLogsTable, "readwrite");
|
|
66
66
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callLogsTable);
|
|
67
67
|
const allowedFields = [
|
|
68
68
|
"disposition",
|
|
@@ -98,7 +98,7 @@ class CallLogsController {
|
|
|
98
98
|
}
|
|
99
99
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
100
100
|
const database = databaseConnection.result;
|
|
101
|
-
const dbTransaction = database.
|
|
101
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callLogsTable, "readwrite");
|
|
102
102
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callLogsTable);
|
|
103
103
|
const key = callLog.id;
|
|
104
104
|
let result = yield table.put(callLog.serialize, key);
|
|
@@ -116,7 +116,7 @@ class CallLogsController {
|
|
|
116
116
|
// const DataValidation = new CxConfiguratorGPMPrompt(query)
|
|
117
117
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
118
118
|
const database = databaseConnection.result;
|
|
119
|
-
const dbTransaction = database.
|
|
119
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callLogsTable, "readwrite");
|
|
120
120
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callLogsTable);
|
|
121
121
|
let result = yield table.delete(query.id);
|
|
122
122
|
return result;
|
|
@@ -26,7 +26,7 @@ class CallbackAndVoicemailController {
|
|
|
26
26
|
}
|
|
27
27
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
28
28
|
const database = databaseConnection.result;
|
|
29
|
-
const dbTransaction = database.
|
|
29
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable, "readwrite");
|
|
30
30
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable);
|
|
31
31
|
let result = yield table.add(callbackVoicemail.serialize, data.id);
|
|
32
32
|
return result;
|
|
@@ -43,7 +43,7 @@ class CallbackAndVoicemailController {
|
|
|
43
43
|
console.log(query);
|
|
44
44
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
45
45
|
const database = databaseConnection.result;
|
|
46
|
-
const dbTransaction = database.
|
|
46
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable, "readwrite");
|
|
47
47
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable);
|
|
48
48
|
let result = yield table.get(query.id);
|
|
49
49
|
return result;
|
|
@@ -62,7 +62,7 @@ class CallbackAndVoicemailController {
|
|
|
62
62
|
// changed to Specfic factory as method override is not working
|
|
63
63
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
64
64
|
const database = databaseConnection.result;
|
|
65
|
-
const dbTransaction = database.
|
|
65
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable, "readwrite");
|
|
66
66
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable);
|
|
67
67
|
let result = yield table.getAll(query);
|
|
68
68
|
return { result, meta: query };
|
|
@@ -82,7 +82,7 @@ class CallbackAndVoicemailController {
|
|
|
82
82
|
}
|
|
83
83
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
84
84
|
const database = databaseConnection.result;
|
|
85
|
-
const dbTransaction = database.
|
|
85
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable, "readwrite");
|
|
86
86
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable);
|
|
87
87
|
const key = data.id;
|
|
88
88
|
let result = yield table.put(data, key);
|
|
@@ -99,7 +99,7 @@ class CallbackAndVoicemailController {
|
|
|
99
99
|
try {
|
|
100
100
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
101
101
|
const database = databaseConnection.result;
|
|
102
|
-
const dbTransaction = database.
|
|
102
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable, "readwrite");
|
|
103
103
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.callbackAndVoicemailTable);
|
|
104
104
|
let result = yield table.delete(query.id);
|
|
105
105
|
return result;
|
|
@@ -28,7 +28,7 @@ class ChannelSettingTaskInfoController {
|
|
|
28
28
|
}
|
|
29
29
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
30
30
|
const database = databaseConnection.result;
|
|
31
|
-
const dbTransaction = database.
|
|
31
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable, "readwrite");
|
|
32
32
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable);
|
|
33
33
|
const result = yield table.add(channelSetting.serialize, channelSetting.name, 24 * 60 * 60);
|
|
34
34
|
return result;
|
|
@@ -45,7 +45,7 @@ class ChannelSettingTaskInfoController {
|
|
|
45
45
|
try {
|
|
46
46
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
47
47
|
const database = databaseConnection.result;
|
|
48
|
-
const dbTransaction = database.
|
|
48
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable, "readonly");
|
|
49
49
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable);
|
|
50
50
|
const result = yield table.get(query.name);
|
|
51
51
|
return result;
|
|
@@ -62,7 +62,7 @@ class ChannelSettingTaskInfoController {
|
|
|
62
62
|
try {
|
|
63
63
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
64
64
|
const database = databaseConnection.result;
|
|
65
|
-
const dbTransaction = database.
|
|
65
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable, "readonly");
|
|
66
66
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable);
|
|
67
67
|
const result = yield table.getAll();
|
|
68
68
|
return result;
|
|
@@ -85,7 +85,7 @@ class ChannelSettingTaskInfoController {
|
|
|
85
85
|
}
|
|
86
86
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
87
87
|
const database = databaseConnection.result;
|
|
88
|
-
const dbTransaction = database.
|
|
88
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable, "readwrite");
|
|
89
89
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable);
|
|
90
90
|
const result = yield table.put(channelSetting.serialize, channelSetting.name);
|
|
91
91
|
return result;
|
|
@@ -102,7 +102,7 @@ class ChannelSettingTaskInfoController {
|
|
|
102
102
|
try {
|
|
103
103
|
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
104
104
|
const database = databaseConnection.result;
|
|
105
|
-
const dbTransaction = database.
|
|
105
|
+
const dbTransaction = database.transactionItem(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable, "readwrite");
|
|
106
106
|
let table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.channelSettingsTable);
|
|
107
107
|
const result = yield table.delete(query.name);
|
|
108
108
|
return result;
|