dt-common-device 7.6.2 → 7.6.4
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/alerts/Alert.service.d.ts +2 -5
- package/dist/alerts/Alert.service.js +4 -4
- package/dist/constants/Event.d.ts +52 -10
- package/dist/constants/Event.js +52 -10
- package/dist/events/DeviceEventHandler.js +1 -1
- package/dist/events/InternalEventSubscription.js +2 -0
- package/dist/issues/Issue.service.d.ts +2 -5
- package/dist/issues/Issue.service.js +4 -4
- package/package.json +1 -1
|
@@ -22,12 +22,9 @@ export declare class AlertService {
|
|
|
22
22
|
raiseDoorLeftOpenAlert(device: IDevice, zone: any, openThreshold: number, source: Source): Promise<IAlertDocument | null>;
|
|
23
23
|
raiseNewDeviceAlert(device: {
|
|
24
24
|
deviceId: string;
|
|
25
|
-
deviceType:
|
|
26
|
-
type: any;
|
|
27
|
-
};
|
|
28
|
-
propertyId: string;
|
|
25
|
+
deviceType: string;
|
|
29
26
|
name: string;
|
|
30
|
-
},
|
|
27
|
+
}, propertyId: string, source: Source): Promise<IAlertDocument | null>;
|
|
31
28
|
raiseDoorOpenFrequentAlert(device: IDevice, zone: any, accessTimes: number, openThreshold: number, source: Source): Promise<IAlertDocument | null>;
|
|
32
29
|
raiseDoorOpenOutsideBusinessHoursAlert(device: IDevice, zone: any, source: Source): Promise<IAlertDocument | null>;
|
|
33
30
|
/**
|
|
@@ -176,14 +176,14 @@ let AlertService = (() => {
|
|
|
176
176
|
type: alert_types_1.AlertType.DOOR_LEFT_OPEN,
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
async raiseNewDeviceAlert(device,
|
|
179
|
+
async raiseNewDeviceAlert(device, propertyId, source) {
|
|
180
180
|
return await this.createAlert({
|
|
181
181
|
entityId: device.deviceId,
|
|
182
182
|
entityType: alert_types_1.EntityType.DEVICE,
|
|
183
|
-
entitySubType: device?.deviceType
|
|
184
|
-
propertyId:
|
|
183
|
+
entitySubType: device?.deviceType,
|
|
184
|
+
propertyId: propertyId,
|
|
185
185
|
title: "New Device Detected",
|
|
186
|
-
description:
|
|
186
|
+
description: `New device ${device.name} has been detected.`,
|
|
187
187
|
createdBy: source,
|
|
188
188
|
category: alert_types_1.AlertCategory.OPERATIONS,
|
|
189
189
|
severity: alert_types_1.AlertSeverity.INFO,
|
|
@@ -36,15 +36,16 @@ export declare const DT_EVENT_TYPES: {
|
|
|
36
36
|
CHANGED: string;
|
|
37
37
|
};
|
|
38
38
|
STATUS: {
|
|
39
|
+
ATTEMPT: {
|
|
40
|
+
SUCCESS: string;
|
|
41
|
+
FAILED: string;
|
|
42
|
+
};
|
|
39
43
|
ONLINE: string;
|
|
40
44
|
OFFLINE: string;
|
|
41
45
|
UNKNOWN: string;
|
|
42
46
|
};
|
|
43
47
|
BATTERY: {
|
|
44
48
|
REPLACED: string;
|
|
45
|
-
STATE: {
|
|
46
|
-
REPLACE: string;
|
|
47
|
-
};
|
|
48
49
|
LEVEL: {
|
|
49
50
|
UNKNOWN: string;
|
|
50
51
|
NORMAL: string;
|
|
@@ -75,13 +76,6 @@ export declare const DT_EVENT_TYPES: {
|
|
|
75
76
|
UNPROCESSED: string;
|
|
76
77
|
UNHANDLED: string;
|
|
77
78
|
};
|
|
78
|
-
ISSUE: {
|
|
79
|
-
CREATED: string;
|
|
80
|
-
CANCELLED: string;
|
|
81
|
-
RESOLVED: string;
|
|
82
|
-
UPDATED: string;
|
|
83
|
-
DELETED: string;
|
|
84
|
-
};
|
|
85
79
|
};
|
|
86
80
|
CONNECTION: {
|
|
87
81
|
CREATE: {
|
|
@@ -181,6 +175,30 @@ export declare const DT_EVENT_TYPES: {
|
|
|
181
175
|
SUCCESS: string;
|
|
182
176
|
FAILED: string;
|
|
183
177
|
};
|
|
178
|
+
CANCEL: {
|
|
179
|
+
SUCCESS: string;
|
|
180
|
+
FAILED: string;
|
|
181
|
+
};
|
|
182
|
+
RESOLVE: {
|
|
183
|
+
SUCCESS: string;
|
|
184
|
+
FAILED: string;
|
|
185
|
+
};
|
|
186
|
+
IGNORE: {
|
|
187
|
+
SUCCESS: string;
|
|
188
|
+
FAILED: string;
|
|
189
|
+
};
|
|
190
|
+
CLOSE: {
|
|
191
|
+
SUCCESS: string;
|
|
192
|
+
FAILED: string;
|
|
193
|
+
};
|
|
194
|
+
IN_PROGRESS: {
|
|
195
|
+
SUCCESS: string;
|
|
196
|
+
FAILED: string;
|
|
197
|
+
};
|
|
198
|
+
ON_HOLD: {
|
|
199
|
+
SUCCESS: string;
|
|
200
|
+
FAILED: string;
|
|
201
|
+
};
|
|
184
202
|
};
|
|
185
203
|
ALERT: {
|
|
186
204
|
CREATE: {
|
|
@@ -196,5 +214,29 @@ export declare const DT_EVENT_TYPES: {
|
|
|
196
214
|
SUCCESS: string;
|
|
197
215
|
FAILED: string;
|
|
198
216
|
};
|
|
217
|
+
ACTIVATE: {
|
|
218
|
+
SUCCESS: string;
|
|
219
|
+
FAILED: string;
|
|
220
|
+
};
|
|
221
|
+
DEACTIVATE: {
|
|
222
|
+
SUCCESS: string;
|
|
223
|
+
FAILED: string;
|
|
224
|
+
};
|
|
225
|
+
SNOOZE: {
|
|
226
|
+
SUCCESS: string;
|
|
227
|
+
FAILED: string;
|
|
228
|
+
};
|
|
229
|
+
UNSNOOZE: {
|
|
230
|
+
SUCCESS: string;
|
|
231
|
+
FAILED: string;
|
|
232
|
+
};
|
|
233
|
+
MARK_AS_READ: {
|
|
234
|
+
SUCCESS: string;
|
|
235
|
+
FAILED: string;
|
|
236
|
+
};
|
|
237
|
+
MARK_AS_UNREAD: {
|
|
238
|
+
SUCCESS: string;
|
|
239
|
+
FAILED: string;
|
|
240
|
+
};
|
|
199
241
|
};
|
|
200
242
|
};
|
package/dist/constants/Event.js
CHANGED
|
@@ -39,15 +39,16 @@ exports.DT_EVENT_TYPES = {
|
|
|
39
39
|
CHANGED: "device.state.changed",
|
|
40
40
|
},
|
|
41
41
|
STATUS: {
|
|
42
|
+
ATTEMPT: {
|
|
43
|
+
SUCCESS: "device.status.attempt.success",
|
|
44
|
+
FAILED: "device.status.attempt.failed",
|
|
45
|
+
},
|
|
42
46
|
ONLINE: "device.status.online",
|
|
43
47
|
OFFLINE: "device.status.offline",
|
|
44
48
|
UNKNOWN: "device.status.unknown",
|
|
45
49
|
},
|
|
46
50
|
BATTERY: {
|
|
47
51
|
REPLACED: "device.battery.replaced",
|
|
48
|
-
STATE: {
|
|
49
|
-
REPLACE: "device.battery.state.replace",
|
|
50
|
-
},
|
|
51
52
|
LEVEL: {
|
|
52
53
|
UNKNOWN: "device.battery.level.unknown",
|
|
53
54
|
NORMAL: "device.battery.level.normal",
|
|
@@ -78,13 +79,6 @@ exports.DT_EVENT_TYPES = {
|
|
|
78
79
|
UNPROCESSED: "device.webhook.unprocessed",
|
|
79
80
|
UNHANDLED: "device.webhook.unhandled",
|
|
80
81
|
},
|
|
81
|
-
ISSUE: {
|
|
82
|
-
CREATED: "device.issue.created",
|
|
83
|
-
CANCELLED: "device.issue.cancelled",
|
|
84
|
-
RESOLVED: "device.issue.resolved",
|
|
85
|
-
UPDATED: "device.issue.updated",
|
|
86
|
-
DELETED: "device.issue.deleted",
|
|
87
|
-
},
|
|
88
82
|
},
|
|
89
83
|
CONNECTION: {
|
|
90
84
|
CREATE: {
|
|
@@ -184,6 +178,30 @@ exports.DT_EVENT_TYPES = {
|
|
|
184
178
|
SUCCESS: "issue.delete.success",
|
|
185
179
|
FAILED: "issue.delete.failed",
|
|
186
180
|
},
|
|
181
|
+
CANCEL: {
|
|
182
|
+
SUCCESS: "issue.cancel.success",
|
|
183
|
+
FAILED: "issue.cancel.failed",
|
|
184
|
+
},
|
|
185
|
+
RESOLVE: {
|
|
186
|
+
SUCCESS: "issue.resolve.success",
|
|
187
|
+
FAILED: "issue.resolve.failed",
|
|
188
|
+
},
|
|
189
|
+
IGNORE: {
|
|
190
|
+
SUCCESS: "issue.ignore.success",
|
|
191
|
+
FAILED: "issue.ignore.failed",
|
|
192
|
+
},
|
|
193
|
+
CLOSE: {
|
|
194
|
+
SUCCESS: "issue.close.success",
|
|
195
|
+
FAILED: "issue.close.failed",
|
|
196
|
+
},
|
|
197
|
+
IN_PROGRESS: {
|
|
198
|
+
SUCCESS: "issue.in_progress.success",
|
|
199
|
+
FAILED: "issue.in_progress.failed",
|
|
200
|
+
},
|
|
201
|
+
ON_HOLD: {
|
|
202
|
+
SUCCESS: "issue.on_hold.success",
|
|
203
|
+
FAILED: "issue.on_hold.failed",
|
|
204
|
+
},
|
|
187
205
|
},
|
|
188
206
|
ALERT: {
|
|
189
207
|
CREATE: {
|
|
@@ -199,5 +217,29 @@ exports.DT_EVENT_TYPES = {
|
|
|
199
217
|
SUCCESS: "alert.delete.success",
|
|
200
218
|
FAILED: "alert.delete.failed",
|
|
201
219
|
},
|
|
220
|
+
ACTIVATE: {
|
|
221
|
+
SUCCESS: "alert.activate.success",
|
|
222
|
+
FAILED: "alert.activate.failed",
|
|
223
|
+
},
|
|
224
|
+
DEACTIVATE: {
|
|
225
|
+
SUCCESS: "alert.deactivate.success",
|
|
226
|
+
FAILED: "alert.deactivate.failed",
|
|
227
|
+
},
|
|
228
|
+
SNOOZE: {
|
|
229
|
+
SUCCESS: "alert.snooze.success",
|
|
230
|
+
FAILED: "alert.snooze.failed",
|
|
231
|
+
},
|
|
232
|
+
UNSNOOZE: {
|
|
233
|
+
SUCCESS: "alert.unsnooze.success",
|
|
234
|
+
FAILED: "alert.unsnooze.failed",
|
|
235
|
+
},
|
|
236
|
+
MARK_AS_READ: {
|
|
237
|
+
SUCCESS: "alert.mark_as_read.success",
|
|
238
|
+
FAILED: "alert.mark_as_read.failed",
|
|
239
|
+
},
|
|
240
|
+
MARK_AS_UNREAD: {
|
|
241
|
+
SUCCESS: "alert.mark_as_unread.success",
|
|
242
|
+
FAILED: "alert.mark_as_unread.failed",
|
|
243
|
+
},
|
|
202
244
|
},
|
|
203
245
|
};
|
|
@@ -90,7 +90,7 @@ let DeviceEventHandler = (() => {
|
|
|
90
90
|
Event_1.DT_EVENT_TYPES.DEVICE.STATUS.ONLINE,
|
|
91
91
|
Event_1.DT_EVENT_TYPES.DEVICE.STATUS.OFFLINE,
|
|
92
92
|
Event_1.DT_EVENT_TYPES.DEVICE.STATUS.UNKNOWN,
|
|
93
|
-
Event_1.DT_EVENT_TYPES.DEVICE.BATTERY.
|
|
93
|
+
Event_1.DT_EVENT_TYPES.DEVICE.BATTERY.REPLACED,
|
|
94
94
|
Event_1.DT_EVENT_TYPES.DEVICE.BATTERY.LEVEL.UNKNOWN,
|
|
95
95
|
Event_1.DT_EVENT_TYPES.DEVICE.BATTERY.LEVEL.LOW,
|
|
96
96
|
Event_1.DT_EVENT_TYPES.DEVICE.BATTERY.LEVEL.CRITICAL,
|
|
@@ -87,7 +87,9 @@ class InternalEventSubscription {
|
|
|
87
87
|
}
|
|
88
88
|
try {
|
|
89
89
|
if (this.reservationSqsQueueUrl) {
|
|
90
|
+
this.logger.info(`Subscribing to reservation events : ${this.reservationSqsQueueUrl}`);
|
|
90
91
|
await dt_pub_sub_1.eventDispatcher.subscribeToQueue(this.reservationSqsQueueUrl, this.handleMessage.bind(this));
|
|
92
|
+
this.logger.info(`Successfully subscribed to reservation events : ${this.reservationSqsQueueUrl}`);
|
|
91
93
|
}
|
|
92
94
|
await dt_pub_sub_1.eventDispatcher.subscribeToQueue(this.sqsQueueUrl, this.handleMessage.bind(this));
|
|
93
95
|
this.isSubscribed = true;
|
|
@@ -49,12 +49,9 @@ export declare class IssueService {
|
|
|
49
49
|
createDeviceBatteryIssue(device: IDevice, batteryLevel: number, threshold: number, priority: IssuePriority, source: Source): Promise<IIssueDocument | null>;
|
|
50
50
|
createAccountMissingDeviceIssue(device: {
|
|
51
51
|
deviceId: string;
|
|
52
|
-
deviceType:
|
|
53
|
-
type: any;
|
|
54
|
-
};
|
|
55
|
-
propertyId: string;
|
|
52
|
+
deviceType: string;
|
|
56
53
|
name: string;
|
|
57
|
-
},
|
|
54
|
+
}, propertyId: string, source: Source): Promise<IIssueDocument | null>;
|
|
58
55
|
createAccountUnauthorizedIssue(account: {
|
|
59
56
|
accountId: string;
|
|
60
57
|
accountType: EntitySubType;
|
|
@@ -273,14 +273,14 @@ let IssueService = (() => {
|
|
|
273
273
|
type: issue_types_1.IssueType.BATTERY_LOW,
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
async createAccountMissingDeviceIssue(device,
|
|
276
|
+
async createAccountMissingDeviceIssue(device, propertyId, source) {
|
|
277
277
|
return await this.createIssue({
|
|
278
278
|
entityId: device.deviceId,
|
|
279
279
|
entityType: issue_types_1.EntityType.DEVICE,
|
|
280
|
-
entitySubType: device.deviceType
|
|
281
|
-
propertyId:
|
|
280
|
+
entitySubType: device.deviceType,
|
|
281
|
+
propertyId: propertyId,
|
|
282
282
|
title: "Device Missing",
|
|
283
|
-
description: `${device.name} is missing from the account.
|
|
283
|
+
description: `${device.name} is missing from the account. Requires Attention.`,
|
|
284
284
|
createdBy: source,
|
|
285
285
|
category: issue_types_1.IssuesCategory.OPERATIONS,
|
|
286
286
|
priority: issue_types_1.IssuePriority.CRITICAL,
|