dt-common-device 7.6.4 → 7.6.6
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.
|
@@ -71,7 +71,7 @@ export declare class AlertService {
|
|
|
71
71
|
/**
|
|
72
72
|
* Deactivate an alert with business logic
|
|
73
73
|
*/
|
|
74
|
-
deactivateAlert(
|
|
74
|
+
deactivateAlert(query: IAlertQuery, updatedBy: string): Promise<IAlertDocument | null>;
|
|
75
75
|
/**
|
|
76
76
|
* Snooze an alert with business logic
|
|
77
77
|
*/
|
|
@@ -329,6 +329,7 @@ let AlertService = (() => {
|
|
|
329
329
|
entityId: processedAlertData.entityId,
|
|
330
330
|
entityType: processedAlertData.entityType,
|
|
331
331
|
entitySubType: processedAlertData.entitySubType,
|
|
332
|
+
isActive: true,
|
|
332
333
|
});
|
|
333
334
|
if (existingAlert.length > 0) {
|
|
334
335
|
await (0, audit_1.pushAudit)({
|
|
@@ -483,15 +484,20 @@ let AlertService = (() => {
|
|
|
483
484
|
/**
|
|
484
485
|
* Deactivate an alert with business logic
|
|
485
486
|
*/
|
|
486
|
-
async deactivateAlert(
|
|
487
|
-
if (!
|
|
488
|
-
throw new Error("Alert
|
|
487
|
+
async deactivateAlert(query, updatedBy) {
|
|
488
|
+
if (!query || !updatedBy)
|
|
489
|
+
throw new Error("Alert query and updated by user are required");
|
|
490
|
+
const alerts = await this.queryAlerts(query);
|
|
491
|
+
if (!alerts.length)
|
|
492
|
+
return null;
|
|
493
|
+
if (alerts.length > 1) {
|
|
494
|
+
throw new Error("Multiple alerts found, please specify a more specific query");
|
|
489
495
|
}
|
|
490
|
-
const
|
|
491
|
-
if (!
|
|
496
|
+
const alert = await Alert_model_1.AlertModel.findById(alerts[0]._id);
|
|
497
|
+
if (!alert)
|
|
492
498
|
return null;
|
|
493
|
-
|
|
494
|
-
return await
|
|
499
|
+
alert.deactivate(updatedBy);
|
|
500
|
+
return await alert.save();
|
|
495
501
|
}
|
|
496
502
|
/**
|
|
497
503
|
* Snooze an alert with business logic
|
package/dist/config/config.js
CHANGED
|
@@ -191,7 +191,7 @@ function getLogger() {
|
|
|
191
191
|
* Throws an error if not set.
|
|
192
192
|
*/
|
|
193
193
|
function getAdminPostgresDbUri() {
|
|
194
|
-
const fullUri = process.env[db_keys
|
|
194
|
+
const fullUri = process.env[db_keys?.admin];
|
|
195
195
|
if (!fullUri) {
|
|
196
196
|
getConfig().LOGGER.error("ADMIN_DB_URI must be set in environment variables or .env file");
|
|
197
197
|
throw new Error("dt-common-device: ADMIN_DB_URI must be set in environment variables or .env file");
|
|
@@ -199,7 +199,7 @@ function getAdminPostgresDbUri() {
|
|
|
199
199
|
return fullUri;
|
|
200
200
|
}
|
|
201
201
|
function getAccessPostgresDbUri() {
|
|
202
|
-
const fullUri = process.env[db_keys
|
|
202
|
+
const fullUri = process.env[db_keys?.access];
|
|
203
203
|
if (!fullUri) {
|
|
204
204
|
getConfig().LOGGER.error("ACCESS_DB_URI must be set in environment variables or .env file");
|
|
205
205
|
throw new Error("dt-common-device: ACCESS_DB_URI must be set in environment variables or .env file");
|
|
@@ -207,7 +207,7 @@ function getAccessPostgresDbUri() {
|
|
|
207
207
|
return fullUri;
|
|
208
208
|
}
|
|
209
209
|
function getPmsPostgresDbUri() {
|
|
210
|
-
const fullUri = process.env[db_keys
|
|
210
|
+
const fullUri = process.env[db_keys?.pms];
|
|
211
211
|
if (!fullUri) {
|
|
212
212
|
getConfig().LOGGER.error("PMS_DB_URI must be set in environment variables or .env file");
|
|
213
213
|
throw new Error("dt-common-device: PMS_DB_URI must be set in environment variables or .env file");
|
package/dist/constants/Event.js
CHANGED
|
@@ -39,10 +39,7 @@ exports.DT_EVENT_TYPES = {
|
|
|
39
39
|
CHANGED: "device.state.changed",
|
|
40
40
|
},
|
|
41
41
|
STATUS: {
|
|
42
|
-
|
|
43
|
-
SUCCESS: "device.status.attempt.success",
|
|
44
|
-
FAILED: "device.status.attempt.failed",
|
|
45
|
-
},
|
|
42
|
+
UPDATED: "device.status.updated",
|
|
46
43
|
ONLINE: "device.status.online",
|
|
47
44
|
OFFLINE: "device.status.offline",
|
|
48
45
|
UNKNOWN: "device.status.unknown",
|