dt-common-device 7.10.4 → 7.10.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.
@@ -22,8 +22,8 @@ export declare class AlertService {
22
22
  raiseDeviceTamperAttemptAlert(device: IDevice, zone: any, source: Source): Promise<IAlertDocument | null>;
23
23
  raiseDoorLeftOpenAlert(device: IDevice, zone: any, openThreshold: number, source: Source): Promise<IAlertDocument | null>;
24
24
  raiseIncorrectCodeAlert(device: IDevice, zone: any, source: Source, accessCount: number, timeWindow: {
25
- startDate: Date;
26
- endDate: Date;
25
+ startDate: string;
26
+ endDate: string;
27
27
  }): Promise<IAlertDocument | null>;
28
28
  raiseNewDeviceAlert(device: {
29
29
  deviceId: string;
@@ -130,21 +130,18 @@ let LocalDeviceService = (() => {
130
130
  throw new Error("Device not found");
131
131
  }
132
132
  if (body?.status) {
133
- const auditType = body?.status?.online
134
- ? constants_1.DT_EVENT_TYPES.DEVICE.STATUS.ONLINE
135
- : constants_1.DT_EVENT_TYPES.DEVICE.STATUS.OFFLINE;
136
133
  if (body?.status?.online) {
137
134
  await this.handleOnlineStatus(device, device.status, body.status, auditBody?.source || Service_1.Source.SYSTEM, auditBody);
138
135
  }
139
136
  else {
140
137
  await this.handleOfflineStatus(device, device.status, body.status, auditBody?.source || Service_1.Source.SYSTEM, auditBody, body.status.error?.message);
141
138
  }
142
- if (body.state?.batteryPercentage?.value) {
143
- await this.setBatteryLevel(deviceId, body.state?.batteryPercentage?.value, auditBody?.source || Service_1.Source.SYSTEM, auditBody);
144
- }
139
+ delete body.status;
140
+ }
141
+ if (body.state?.batteryPercentage?.value) {
142
+ await this.setBatteryLevel(deviceId, body.state?.batteryPercentage?.value, auditBody?.source || Service_1.Source.SYSTEM, auditBody);
143
+ delete body.state?.batteryPercentage;
145
144
  }
146
- delete body.state?.batteryPercentage;
147
- delete body.status;
148
145
  await this.deviceRepository.updateDevice(deviceId, body);
149
146
  return await this.eventHandler.onDeviceUpdate(deviceId, body, auditBody);
150
147
  }
@@ -470,6 +467,7 @@ let LocalDeviceService = (() => {
470
467
  if (!query || Object.keys(query).length === 0) {
471
468
  throw new Error("Query is required");
472
469
  }
470
+ // TODO: Add Audit here as well onDeleteDevices
473
471
  return await this.deviceRepository.deleteDevices(query);
474
472
  }
475
473
  async queryDevices(query) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "7.10.4",
3
+ "version": "7.10.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [