hgs-twilio-class-lib 1.1.67 → 1.1.69
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/lib/common/utils/sort.d.ts +1 -1
- package/lib/common/utils/sort.js +18 -2
- package/lib/config/AWSConfig.js +4 -4
- package/lib/config/TwilioConfig.js +2 -2
- package/lib/controller/MainController.js +3 -5
- package/lib/controller/twilio/RealTimeReportsWGDetailsController.js +3 -3
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -3
- package/lib/models/impl/WorkGroupDetailsModel.d.ts +53 -47
- package/lib/models/impl/WorkGroupDetailsModel.js +204 -156
- package/package.json +1 -2
- package/lib/controller/twilio/RTRWGQueueStatisticsCESController.d.ts +0 -58
- package/lib/controller/twilio/RTRWGQueueStatisticsCESController.js +0 -205
- package/lib/controller/twilio/RealTimeReportsWGDetailsControllerCES.d.ts +0 -11
- package/lib/controller/twilio/RealTimeReportsWGDetailsControllerCES.js +0 -93
- package/lib/controller/twilio/filterImpl/WorkGroupDetailsFilter.d.ts +0 -14
- package/lib/controller/twilio/filterImpl/WorkGroupDetailsFilter.js +0 -53
- package/lib/models/impl/QueuePeriodStatisticsModelCES.d.ts +0 -34
- package/lib/models/impl/QueuePeriodStatisticsModelCES.js +0 -93
- package/lib/models/impl/WorkGroupDetailsModelCES.d.ts +0 -21
- package/lib/models/impl/WorkGroupDetailsModelCES.js +0 -71
- package/lib/models/impl/WorkGroupQueueStatisticsModelCES.d.ts +0 -16
- package/lib/models/impl/WorkGroupQueueStatisticsModelCES.js +0 -32
- package/lib/models/types/WorkGroupDetails.type.d.ts +0 -6
- package/lib/models/types/WorkGroupDetails.type.js +0 -7
|
@@ -1,205 +0,0 @@
|
|
|
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.RTReportsQueueDetailsCESController = void 0;
|
|
13
|
-
// Helper to resolve Sync Service SID from friendly name
|
|
14
|
-
function getSyncServiceSidByFriendlyName(twilioClient, friendlyName) {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const services = yield twilioClient.sync.v1.services.list();
|
|
17
|
-
const found = services.find((svc) => svc.friendlyName === friendlyName);
|
|
18
|
-
if (!found)
|
|
19
|
-
throw new Error(`Sync Service with friendly name '${friendlyName}' not found.`);
|
|
20
|
-
return found.sid;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const QueuePeriodStatisticsModelCES_1 = require("../../models/impl/QueuePeriodStatisticsModelCES");
|
|
24
|
-
const WorkGroupQueueStatisticsModelCES_1 = require("../../models/impl/WorkGroupQueueStatisticsModelCES");
|
|
25
|
-
const Common_1 = require("../Common");
|
|
26
|
-
// Importing necessary configurations and types
|
|
27
|
-
const DatabaseConfig_1 = require("../../config/DatabaseConfig");
|
|
28
|
-
class RTReportsQueueDetailsCESController {
|
|
29
|
-
constructor(dbFactory, twilioClient, syncServiceSid) {
|
|
30
|
-
this._dbFactory = dbFactory;
|
|
31
|
-
this._twilioClient = twilioClient;
|
|
32
|
-
this._syncServiceSid = syncServiceSid;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Adds a new workgroup details record to the database.
|
|
36
|
-
*
|
|
37
|
-
* This method validates the provided workgroup details data, opens a connection
|
|
38
|
-
* to the database, starts a transaction, and adds the data to the specified
|
|
39
|
-
* object store. If validation fails or any error occurs during the database
|
|
40
|
-
* operation, it throws an error.
|
|
41
|
-
*
|
|
42
|
-
* @param {WorkGroupDetailsModel} data - The workgroup details data to be added.
|
|
43
|
-
* @returns {Promise<any>} - Returns a promise with the result of the database operation.
|
|
44
|
-
*/
|
|
45
|
-
add(data) {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
try {
|
|
48
|
-
console.log("Received_data:............", data);
|
|
49
|
-
const tableName = data.tableName;
|
|
50
|
-
console.log("received_Table_Name:", tableName);
|
|
51
|
-
console.log(" this._dbFactory_2", this._dbFactory);
|
|
52
|
-
const tableNameValidation = WorkGroupQueueStatisticsModelCES_1.WorkGroupQueueStatisticsModel.validateTableName(tableName);
|
|
53
|
-
if (tableNameValidation.length > 0) {
|
|
54
|
-
throw tableNameValidation;
|
|
55
|
-
}
|
|
56
|
-
const periodStats = new QueuePeriodStatisticsModelCES_1.QueuePeriodStatisticsModel(data.aban, data.answer, data.offer, data.sla_target, data.sum_wait_time, data.total_service_level, data.transfer_count);
|
|
57
|
-
if (periodStats.validationMessages.length > 0) {
|
|
58
|
-
throw periodStats.validationMessages; // Throw error if data validation fails
|
|
59
|
-
}
|
|
60
|
-
let syncServiceSid = data.TWILIO_FLEX_SYNC_SID;
|
|
61
|
-
if (!syncServiceSid || typeof syncServiceSid !== "string") {
|
|
62
|
-
// Try to get by friendly name
|
|
63
|
-
const friendlyName = data.TWILIO_FLEX_SYNC_FRIENDLY_NAME;
|
|
64
|
-
if (!friendlyName || typeof friendlyName !== "string") {
|
|
65
|
-
throw new Error("Sync Service SID or friendly name missing/invalid in data.");
|
|
66
|
-
}
|
|
67
|
-
syncServiceSid = yield getSyncServiceSidByFriendlyName(this._twilioClient, friendlyName);
|
|
68
|
-
}
|
|
69
|
-
console.log("Twilio Client and Sync Service SID are configured.", this._twilioClient, syncServiceSid);
|
|
70
|
-
// Ensure Sync Map exists (or create if not)
|
|
71
|
-
yield (0, Common_1.createOrUpdateSyncMap)(this._twilioClient, syncServiceSid, tableName);
|
|
72
|
-
// Set TTL for 3 days (in seconds)
|
|
73
|
-
const ttlSeconds = 3 * 24 * 60 * 60;
|
|
74
|
-
const now = Math.floor(Date.now() / 1000);
|
|
75
|
-
const expiresAt = now + ttlSeconds;
|
|
76
|
-
// Attach TTL to the record
|
|
77
|
-
const recordWithTTL = Object.assign(Object.assign({}, periodStats), { ttl: expiresAt });
|
|
78
|
-
const periodKey = data.period;
|
|
79
|
-
if (!periodKey || typeof periodKey !== "string" || !/^P_\d+$/.test(periodKey)) {
|
|
80
|
-
throw new Error("Required parameter 'period' missing or invalid in data.");
|
|
81
|
-
}
|
|
82
|
-
// Add item to Sync Map using Twilio SDK
|
|
83
|
-
const result = yield this._twilioClient.sync.v1
|
|
84
|
-
.services(syncServiceSid)
|
|
85
|
-
.syncMaps(tableName)
|
|
86
|
-
.syncMapItems.create({ key: periodKey, data: recordWithTTL });
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
console.log("Error occurred:", error);
|
|
91
|
-
return error;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Edits an existing workgroup details record in the database.
|
|
97
|
-
*
|
|
98
|
-
* This method validates the provided workgroup details data, opens a connection
|
|
99
|
-
* to the database, starts a transaction, and updates the data in the specified
|
|
100
|
-
* object store. If validation fails or any error occurs during the database
|
|
101
|
-
* operation, it throws an error.
|
|
102
|
-
*
|
|
103
|
-
* @param {WorkGroupDetailsModel} data - The workgroup details data to be edited.
|
|
104
|
-
* @returns {Promise<any>} - Returns a promise with the result of the database operation.
|
|
105
|
-
*/
|
|
106
|
-
edit(data) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
try {
|
|
109
|
-
const tableName = data.tableName;
|
|
110
|
-
const tableNameValidation = WorkGroupQueueStatisticsModelCES_1.WorkGroupQueueStatisticsModel.validateTableName(tableName);
|
|
111
|
-
if (tableNameValidation.length > 0) {
|
|
112
|
-
throw tableNameValidation;
|
|
113
|
-
}
|
|
114
|
-
const periodStats = new QueuePeriodStatisticsModelCES_1.QueuePeriodStatisticsModel(data.aban, data.answer, data.offer, data.sla_target, data.sum_wait_time, data.total_service_level, data.transfer_count);
|
|
115
|
-
if (periodStats.validationMessages.length > 0) {
|
|
116
|
-
throw periodStats.validationMessages; // Throw error if data validation fails
|
|
117
|
-
}
|
|
118
|
-
// Open database connection
|
|
119
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
120
|
-
const database = databaseConnection.result;
|
|
121
|
-
// Start database transaction
|
|
122
|
-
const dbTransaction = database.transaction(data.tableName, "readwrite");
|
|
123
|
-
// Access object store
|
|
124
|
-
let table = dbTransaction.objectStore(data.tableName);
|
|
125
|
-
// Update existing data in the object store
|
|
126
|
-
let result = table.put(periodStats, data.period);
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
console.log("Error occurred:", error);
|
|
131
|
-
return error;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Retrieves all workgroup details records from the database.
|
|
137
|
-
*
|
|
138
|
-
* This method opens a connection to the database, starts a transaction,
|
|
139
|
-
* retrieves all records from the specified object store, and returns them.
|
|
140
|
-
* If any error occurs during the database operation, it throws an error.
|
|
141
|
-
*
|
|
142
|
-
* @param {SearchParameterType} query - The search parameters for retrieving data.
|
|
143
|
-
* @returns {Promise<any>} - Returns a promise with the result of the database operation.
|
|
144
|
-
*/
|
|
145
|
-
getAll(query) {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
try {
|
|
148
|
-
const tableName = query.tableName;
|
|
149
|
-
const tableNameValidation = WorkGroupQueueStatisticsModelCES_1.WorkGroupQueueStatisticsModel.validateTableName(tableName);
|
|
150
|
-
if (tableNameValidation.length > 0) {
|
|
151
|
-
throw tableNameValidation;
|
|
152
|
-
}
|
|
153
|
-
// Open database connection
|
|
154
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
155
|
-
const database = databaseConnection.result;
|
|
156
|
-
// Start database transaction
|
|
157
|
-
const dbTransaction = database.transaction(tableName, "readwrite");
|
|
158
|
-
// Access object store
|
|
159
|
-
let table = dbTransaction.objectStore(tableName);
|
|
160
|
-
// Retrieve all data from the object store
|
|
161
|
-
let result = yield table.getAll(query);
|
|
162
|
-
return { result, meta: query }; // Return result with meta data
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
return error;
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Deletes a workgroup details record from the database.
|
|
171
|
-
*
|
|
172
|
-
* This method opens a connection to the database, starts a transaction,
|
|
173
|
-
* and deletes the record with the specified ID from the object store.
|
|
174
|
-
* If any error occurs during the database operation, it throws an error.
|
|
175
|
-
*
|
|
176
|
-
* @param {Pick<WorkGroupDetailsModel, "id">} query - The ID of the record to be deleted.
|
|
177
|
-
* @returns {Promise<any>} - Returns a promise with the result of the database operation.
|
|
178
|
-
*/
|
|
179
|
-
delete(query) {
|
|
180
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
try {
|
|
182
|
-
const tableName = query.tableName;
|
|
183
|
-
const tableNameValidation = WorkGroupQueueStatisticsModelCES_1.WorkGroupQueueStatisticsModel.validateTableName(tableName);
|
|
184
|
-
if (tableNameValidation.length > 0) {
|
|
185
|
-
throw tableNameValidation;
|
|
186
|
-
}
|
|
187
|
-
// Open database connection
|
|
188
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
189
|
-
const database = databaseConnection.result;
|
|
190
|
-
// Start database transaction
|
|
191
|
-
const dbTransaction = database.transaction(tableName, "readwrite");
|
|
192
|
-
// Access object store
|
|
193
|
-
let table = dbTransaction.objectStore(tableName);
|
|
194
|
-
// Delete data from the object store
|
|
195
|
-
let result = table.delete(query.period);
|
|
196
|
-
return result;
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
console.log("Error occurred:", error);
|
|
200
|
-
return error;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
exports.RTReportsQueueDetailsCESController = RTReportsQueueDetailsCESController;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SyncServiceFactory } from "../../twilio/impl/sync/SyncServiceFactory";
|
|
2
|
-
import { SearchParameterType } from "../../common/type/SearchParameterType";
|
|
3
|
-
import { WorkGroupDetailsModel } from "../../models/impl/WorkGroupDetailsModelCES";
|
|
4
|
-
export declare class RealTimeReportsWGDetailsCESController {
|
|
5
|
-
private _dbFactory;
|
|
6
|
-
constructor(dbFactory: SyncServiceFactory);
|
|
7
|
-
add(data: WorkGroupDetailsModel): Promise<any>;
|
|
8
|
-
edit(data: WorkGroupDetailsModel): Promise<any>;
|
|
9
|
-
getAll(query: SearchParameterType): Promise<any>;
|
|
10
|
-
delete(query: Pick<WorkGroupDetailsModel, "id">): Promise<any>;
|
|
11
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
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.RealTimeReportsWGDetailsCESController = void 0;
|
|
13
|
-
const DatabaseConfig_1 = require("../../config/DatabaseConfig");
|
|
14
|
-
const WorkGroupDetailsModelCES_1 = require("../../models/impl/WorkGroupDetailsModelCES");
|
|
15
|
-
class RealTimeReportsWGDetailsCESController {
|
|
16
|
-
constructor(dbFactory) {
|
|
17
|
-
this._dbFactory = dbFactory;
|
|
18
|
-
}
|
|
19
|
-
add(data) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
try {
|
|
22
|
-
const workgroupDetails = new WorkGroupDetailsModelCES_1.WorkGroupDetailsModel(data.id, data.workgroupname, data.queues, data.createdAt, data.updatedAt);
|
|
23
|
-
const validationErrors = workgroupDetails.validateData();
|
|
24
|
-
if (validationErrors.length > 0) {
|
|
25
|
-
throw validationErrors;
|
|
26
|
-
}
|
|
27
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
28
|
-
const database = databaseConnection.result;
|
|
29
|
-
const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable, "readwrite");
|
|
30
|
-
const table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable);
|
|
31
|
-
const result = table.add(workgroupDetails, data.id);
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.log("Error occurred:", error);
|
|
36
|
-
return error;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
edit(data) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
try {
|
|
43
|
-
const workgroupDetails = new WorkGroupDetailsModelCES_1.WorkGroupDetailsModel(data.id, data.workgroupname, data.queues, data.createdAt, data.updatedAt);
|
|
44
|
-
const validationErrors = workgroupDetails.validateData();
|
|
45
|
-
if (validationErrors.length > 0) {
|
|
46
|
-
throw validationErrors;
|
|
47
|
-
}
|
|
48
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
49
|
-
const database = databaseConnection.result;
|
|
50
|
-
const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable, "readwrite");
|
|
51
|
-
const table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable);
|
|
52
|
-
const result = table.put(workgroupDetails, data.id);
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.log("Error occurred:", error);
|
|
57
|
-
return error;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
getAll(query) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
try {
|
|
64
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
65
|
-
const database = databaseConnection.result;
|
|
66
|
-
const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable, "readwrite");
|
|
67
|
-
const table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable);
|
|
68
|
-
const result = yield table.getAll(query);
|
|
69
|
-
return { result, meta: query };
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
return error;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
delete(query) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
try {
|
|
79
|
-
const databaseConnection = yield this._dbFactory.asyncOpen(DatabaseConfig_1.databaseConfig.databaseName, DatabaseConfig_1.databaseConfig.version);
|
|
80
|
-
const database = databaseConnection.result;
|
|
81
|
-
const dbTransaction = database.transaction(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable, "readwrite");
|
|
82
|
-
const table = dbTransaction.objectStore(DatabaseConfig_1.databaseConfig.tables.realTimeReportWGDetailsCESTable);
|
|
83
|
-
const result = table.delete(query.id);
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
console.log("Error occurred:", error);
|
|
88
|
-
return error;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.RealTimeReportsWGDetailsCESController = RealTimeReportsWGDetailsCESController;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MultiFieldFilter, FilterDataObject } from "../../../common/interface/IFilter";
|
|
2
|
-
import { Filter } from "../../../common/abstract/Filter";
|
|
3
|
-
export declare class WorkGroupDetailsFilterService extends Filter {
|
|
4
|
-
private data;
|
|
5
|
-
allowedFields: {
|
|
6
|
-
uniqueName: string;
|
|
7
|
-
periodNumber: string;
|
|
8
|
-
};
|
|
9
|
-
constructor(data: any[]);
|
|
10
|
-
applyFilter(data: any[]): any[];
|
|
11
|
-
filterApply(filterParams: MultiFieldFilter): any[];
|
|
12
|
-
private validateFilters;
|
|
13
|
-
static getFilterData(filterOptions: Record<string, any[]> | null): FilterDataObject[];
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkGroupDetailsFilterService = void 0;
|
|
4
|
-
const MainFilterService_1 = require("./MainFilterService");
|
|
5
|
-
const Filter_1 = require("../../../common/abstract/Filter");
|
|
6
|
-
const FilterTypes_1 = require("../../../common/enum/FilterTypes");
|
|
7
|
-
class WorkGroupDetailsFilterService extends Filter_1.Filter {
|
|
8
|
-
constructor(data) {
|
|
9
|
-
super({ fieldName: "", value: null, filterType: FilterTypes_1.FilterTypes.Equality, caseSensitive: false, ignoreNull: true });
|
|
10
|
-
this.allowedFields = {
|
|
11
|
-
uniqueName: "string",
|
|
12
|
-
periodNumber: "string"
|
|
13
|
-
};
|
|
14
|
-
this.data = data;
|
|
15
|
-
}
|
|
16
|
-
applyFilter(data) {
|
|
17
|
-
// Implementation of applyFilter if needed
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
20
|
-
filterApply(filterParams) {
|
|
21
|
-
const validFilters = this.validateFilters(filterParams);
|
|
22
|
-
const filteredParams = { filters: validFilters };
|
|
23
|
-
return MainFilterService_1.MainFilterService.applyFilter(this.data, filteredParams);
|
|
24
|
-
}
|
|
25
|
-
validateFilters(filterParams) {
|
|
26
|
-
return filterParams.filters.filter(filter => {
|
|
27
|
-
const expectedType = this.allowedFields[filter.fieldName];
|
|
28
|
-
if (!expectedType)
|
|
29
|
-
return false;
|
|
30
|
-
switch (expectedType) {
|
|
31
|
-
case "string":
|
|
32
|
-
return typeof filter.value === "string" || typeof filter.value === "object";
|
|
33
|
-
default:
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
static getFilterData(filterOptions) {
|
|
39
|
-
// Create the filter data mappings with conditional dataList population
|
|
40
|
-
const fieldMappings = {
|
|
41
|
-
uniqueName: {
|
|
42
|
-
type: "dropdown",
|
|
43
|
-
attributeName: "uniqueName",
|
|
44
|
-
label: "Unique Name",
|
|
45
|
-
dataList: filterOptions && filterOptions.uniqueName ? filterOptions.uniqueName : [], // Conditional dataList
|
|
46
|
-
isMultiselect: true
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
// Return as an array
|
|
50
|
-
return Object.values(fieldMappings);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.WorkGroupDetailsFilterService = WorkGroupDetailsFilterService;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BaseModel } from "../abstract/BaseModel";
|
|
2
|
-
import { validationMessage } from "../interface/IBaseModel";
|
|
3
|
-
/**
|
|
4
|
-
* QueuePeriodStatisticsModel
|
|
5
|
-
* -------------------------
|
|
6
|
-
* Model for storing period statistics for a queue (Sync Map Item).
|
|
7
|
-
* Used for items inside a queue-statistics Sync Map, keyed by period (e.g., p_1).
|
|
8
|
-
* Data format matches: {"_aban":0,"_answer":0,"_offer":0,"_sla_target":30,"_sum_wait_time":0,"_total_service_level":0,"_transfer_count":0}
|
|
9
|
-
*/
|
|
10
|
-
export declare class QueuePeriodStatisticsModel extends BaseModel {
|
|
11
|
-
private _aban;
|
|
12
|
-
private _answer;
|
|
13
|
-
private _offer;
|
|
14
|
-
private _sla_target;
|
|
15
|
-
private _sum_wait_time;
|
|
16
|
-
private _total_service_level;
|
|
17
|
-
private _transfer_count;
|
|
18
|
-
constructor(aban?: number, answer?: number, offer?: number, sla_target?: number, sum_wait_time?: number, total_service_level?: number, transfer_count?: number);
|
|
19
|
-
validateData(): validationMessage[];
|
|
20
|
-
get aban(): number;
|
|
21
|
-
set aban(value: number);
|
|
22
|
-
get answer(): number;
|
|
23
|
-
set answer(value: number);
|
|
24
|
-
get offer(): number;
|
|
25
|
-
set offer(value: number);
|
|
26
|
-
get sla_target(): number;
|
|
27
|
-
set sla_target(value: number);
|
|
28
|
-
get sum_wait_time(): number;
|
|
29
|
-
set sum_wait_time(value: number);
|
|
30
|
-
get total_service_level(): number;
|
|
31
|
-
set total_service_level(value: number);
|
|
32
|
-
get transfer_count(): number;
|
|
33
|
-
set transfer_count(value: number);
|
|
34
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueuePeriodStatisticsModel = void 0;
|
|
4
|
-
const BaseModel_1 = require("../abstract/BaseModel");
|
|
5
|
-
/**
|
|
6
|
-
* QueuePeriodStatisticsModel
|
|
7
|
-
* -------------------------
|
|
8
|
-
* Model for storing period statistics for a queue (Sync Map Item).
|
|
9
|
-
* Used for items inside a queue-statistics Sync Map, keyed by period (e.g., p_1).
|
|
10
|
-
* Data format matches: {"_aban":0,"_answer":0,"_offer":0,"_sla_target":30,"_sum_wait_time":0,"_total_service_level":0,"_transfer_count":0}
|
|
11
|
-
*/
|
|
12
|
-
class QueuePeriodStatisticsModel extends BaseModel_1.BaseModel {
|
|
13
|
-
constructor(aban = 0, answer = 0, offer = 0, sla_target = 30, sum_wait_time = 0, total_service_level = 0, transfer_count = 0) {
|
|
14
|
-
super();
|
|
15
|
-
this._aban = aban;
|
|
16
|
-
this._answer = answer;
|
|
17
|
-
this._offer = offer;
|
|
18
|
-
this._sla_target = sla_target;
|
|
19
|
-
this._sum_wait_time = sum_wait_time;
|
|
20
|
-
this._total_service_level = total_service_level;
|
|
21
|
-
this._transfer_count = transfer_count;
|
|
22
|
-
}
|
|
23
|
-
validateData() {
|
|
24
|
-
this.validationMessages = [];
|
|
25
|
-
// Validate all fields are integers
|
|
26
|
-
if (!Number.isInteger(this._aban)) {
|
|
27
|
-
this.validationMessages.push({
|
|
28
|
-
type: "Error",
|
|
29
|
-
fieldDescription: "aban",
|
|
30
|
-
message: "Aban must be an integer",
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
if (!Number.isInteger(this._answer)) {
|
|
34
|
-
this.validationMessages.push({
|
|
35
|
-
type: "Error",
|
|
36
|
-
fieldDescription: "answer",
|
|
37
|
-
message: "Answer must be an integer",
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (!Number.isInteger(this._offer)) {
|
|
41
|
-
this.validationMessages.push({
|
|
42
|
-
type: "Error",
|
|
43
|
-
fieldDescription: "offer",
|
|
44
|
-
message: "Offer must be an integer",
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (!Number.isInteger(this._sla_target)) {
|
|
48
|
-
this.validationMessages.push({
|
|
49
|
-
type: "Error",
|
|
50
|
-
fieldDescription: "sla_target",
|
|
51
|
-
message: "SLA Target must be an integer",
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (!Number.isInteger(this._sum_wait_time)) {
|
|
55
|
-
this.validationMessages.push({
|
|
56
|
-
type: "Error",
|
|
57
|
-
fieldDescription: "sum_wait_time",
|
|
58
|
-
message: "Sum Wait Time must be an integer",
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (!Number.isInteger(this._total_service_level)) {
|
|
62
|
-
this.validationMessages.push({
|
|
63
|
-
type: "Error",
|
|
64
|
-
fieldDescription: "total_service_level",
|
|
65
|
-
message: "Total Service Level must be an integer",
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (!Number.isInteger(this._transfer_count)) {
|
|
69
|
-
this.validationMessages.push({
|
|
70
|
-
type: "Error",
|
|
71
|
-
fieldDescription: "transfer_count",
|
|
72
|
-
message: "Transfer Count must be an integer",
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return this.validationMessages;
|
|
76
|
-
}
|
|
77
|
-
// Getters and setters (plain, matching other models)
|
|
78
|
-
get aban() { return this._aban; }
|
|
79
|
-
set aban(value) { this._aban = value; }
|
|
80
|
-
get answer() { return this._answer; }
|
|
81
|
-
set answer(value) { this._answer = value; }
|
|
82
|
-
get offer() { return this._offer; }
|
|
83
|
-
set offer(value) { this._offer = value; }
|
|
84
|
-
get sla_target() { return this._sla_target; }
|
|
85
|
-
set sla_target(value) { this._sla_target = value; }
|
|
86
|
-
get sum_wait_time() { return this._sum_wait_time; }
|
|
87
|
-
set sum_wait_time(value) { this._sum_wait_time = value; }
|
|
88
|
-
get total_service_level() { return this._total_service_level; }
|
|
89
|
-
set total_service_level(value) { this._total_service_level = value; }
|
|
90
|
-
get transfer_count() { return this._transfer_count; }
|
|
91
|
-
set transfer_count(value) { this._transfer_count = value; }
|
|
92
|
-
}
|
|
93
|
-
exports.QueuePeriodStatisticsModel = QueuePeriodStatisticsModel;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseModel } from "../abstract/BaseModel";
|
|
2
|
-
import { validationMessage } from "../interface/IBaseModel";
|
|
3
|
-
export declare class WorkGroupDetailsModel extends BaseModel {
|
|
4
|
-
private _id;
|
|
5
|
-
private _workgroupname;
|
|
6
|
-
private _queues;
|
|
7
|
-
private _createdAt;
|
|
8
|
-
private _updatedAt;
|
|
9
|
-
constructor(id: string, workgroupname: string, queues: string[], createdAt?: Date, updatedAt?: Date);
|
|
10
|
-
validateData(): validationMessage[];
|
|
11
|
-
get id(): string;
|
|
12
|
-
set id(value: string);
|
|
13
|
-
get workgroupname(): string;
|
|
14
|
-
set workgroupname(value: string);
|
|
15
|
-
get queues(): string[];
|
|
16
|
-
set queues(value: string[]);
|
|
17
|
-
get createdAt(): Date | undefined;
|
|
18
|
-
set createdAt(value: Date | undefined);
|
|
19
|
-
get updatedAt(): Date | undefined;
|
|
20
|
-
set updatedAt(value: Date | undefined);
|
|
21
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkGroupDetailsModel = void 0;
|
|
4
|
-
const BaseModel_1 = require("../abstract/BaseModel");
|
|
5
|
-
class WorkGroupDetailsModel extends BaseModel_1.BaseModel {
|
|
6
|
-
constructor(id, workgroupname, queues, createdAt, updatedAt) {
|
|
7
|
-
super();
|
|
8
|
-
this._id = id;
|
|
9
|
-
this._workgroupname = workgroupname;
|
|
10
|
-
this._queues = queues;
|
|
11
|
-
this._createdAt = createdAt;
|
|
12
|
-
this._updatedAt = updatedAt;
|
|
13
|
-
}
|
|
14
|
-
validateData() {
|
|
15
|
-
this.validationMessages = [];
|
|
16
|
-
if (typeof this._id !== "string" || !this._id.trim()) {
|
|
17
|
-
this.validationMessages.push({
|
|
18
|
-
type: "Error",
|
|
19
|
-
fieldDescription: "id",
|
|
20
|
-
message: "ID must be a non-empty string",
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
if (typeof this._workgroupname !== "string" || !this._workgroupname.trim()) {
|
|
24
|
-
this.validationMessages.push({
|
|
25
|
-
type: "Error",
|
|
26
|
-
fieldDescription: "workgroupname",
|
|
27
|
-
message: "Workgroup name must be a non-empty string",
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (!Array.isArray(this._queues) || this._queues.length === 0) {
|
|
31
|
-
this.validationMessages.push({
|
|
32
|
-
type: "Error",
|
|
33
|
-
fieldDescription: "queues",
|
|
34
|
-
message: "At least one queue must be selected",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return this.validationMessages;
|
|
38
|
-
}
|
|
39
|
-
// Getters and setters
|
|
40
|
-
get id() {
|
|
41
|
-
return this._id;
|
|
42
|
-
}
|
|
43
|
-
set id(value) {
|
|
44
|
-
this._id = value;
|
|
45
|
-
}
|
|
46
|
-
get workgroupname() {
|
|
47
|
-
return this._workgroupname;
|
|
48
|
-
}
|
|
49
|
-
set workgroupname(value) {
|
|
50
|
-
this._workgroupname = value;
|
|
51
|
-
}
|
|
52
|
-
get queues() {
|
|
53
|
-
return this._queues;
|
|
54
|
-
}
|
|
55
|
-
set queues(value) {
|
|
56
|
-
this._queues = value;
|
|
57
|
-
}
|
|
58
|
-
get createdAt() {
|
|
59
|
-
return this._createdAt;
|
|
60
|
-
}
|
|
61
|
-
set createdAt(value) {
|
|
62
|
-
this._createdAt = value;
|
|
63
|
-
}
|
|
64
|
-
get updatedAt() {
|
|
65
|
-
return this._updatedAt;
|
|
66
|
-
}
|
|
67
|
-
set updatedAt(value) {
|
|
68
|
-
this._updatedAt = value;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.WorkGroupDetailsModel = WorkGroupDetailsModel;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseModel } from "../abstract/BaseModel";
|
|
2
|
-
import { validationMessage } from "../interface/IBaseModel";
|
|
3
|
-
/**
|
|
4
|
-
* WorkGroupQueueStatisticsModel
|
|
5
|
-
* ----------------------------
|
|
6
|
-
* Model for validating Sync Map names for queue statistics.
|
|
7
|
-
* Ensures the name matches the format: <QUEUE>_queue-statistics_<DATE>
|
|
8
|
-
*/
|
|
9
|
-
export declare class WorkGroupQueueStatisticsModel extends BaseModel {
|
|
10
|
-
validateData(): validationMessage[];
|
|
11
|
-
/**
|
|
12
|
-
* Validates a table name against the required sync map pattern.
|
|
13
|
-
* Pattern: <QUEUE>_queue-statistics_<DATE> (e.g., RONA_queue-statistics_19072025)
|
|
14
|
-
*/
|
|
15
|
-
static validateTableName(tableName: string): validationMessage[];
|
|
16
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkGroupQueueStatisticsModel = void 0;
|
|
4
|
-
const BaseModel_1 = require("../abstract/BaseModel");
|
|
5
|
-
/**
|
|
6
|
-
* WorkGroupQueueStatisticsModel
|
|
7
|
-
* ----------------------------
|
|
8
|
-
* Model for validating Sync Map names for queue statistics.
|
|
9
|
-
* Ensures the name matches the format: <QUEUE>_queue-statistics_<DATE>
|
|
10
|
-
*/
|
|
11
|
-
class WorkGroupQueueStatisticsModel extends BaseModel_1.BaseModel {
|
|
12
|
-
validateData() {
|
|
13
|
-
throw new Error("Method not implemented.");
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Validates a table name against the required sync map pattern.
|
|
17
|
-
* Pattern: <QUEUE>_queue-statistics_<DATE> (e.g., RONA_queue-statistics_19072025)
|
|
18
|
-
*/
|
|
19
|
-
static validateTableName(tableName) {
|
|
20
|
-
const regex = /^[A-Z0-9_]+_queue-statistics_\d{8}$/i;
|
|
21
|
-
const messages = [];
|
|
22
|
-
if (!regex.test(tableName)) {
|
|
23
|
-
messages.push({
|
|
24
|
-
type: "Error",
|
|
25
|
-
fieldDescription: "tableName",
|
|
26
|
-
message: "Table name must match the format <QUEUE>_queue-statistics_<DATE> (e.g., TEST_queue-statistics_19072025)",
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return messages;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.WorkGroupQueueStatisticsModel = WorkGroupQueueStatisticsModel;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkGroupDetailsAllowedFields = void 0;
|
|
4
|
-
var WorkGroupDetailsAllowedFields;
|
|
5
|
-
(function (WorkGroupDetailsAllowedFields) {
|
|
6
|
-
WorkGroupDetailsAllowedFields[WorkGroupDetailsAllowedFields["uniqueName"] = 0] = "uniqueName";
|
|
7
|
-
})(WorkGroupDetailsAllowedFields || (exports.WorkGroupDetailsAllowedFields = WorkGroupDetailsAllowedFields = {}));
|