dt-common-device 11.0.1 → 11.0.3
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/audit/PushAudit.js +5 -1
- package/dist/chronicle/Cronicle.service.d.ts +6 -2
- package/dist/chronicle/Cronicle.service.js +19 -2
- package/dist/chronicle/ICronicle.interface.d.ts +1 -0
- package/dist/config/config.js +3 -5
- package/dist/config/constants.js +1 -0
- package/dist/entities/accessGroup/AccessGroup.repository.d.ts +2 -1
- package/dist/entities/accessGroup/AccessGroup.repository.js +4 -1
- package/dist/entities/accessGroup/AccessGroup.service.d.ts +2 -1
- package/dist/entities/accessGroup/AccessGroup.service.js +4 -3
- package/dist/entities/device/local/services/Device.service.js +4 -0
- package/dist/entities/guest/Guest.repository.d.ts +1 -1
- package/dist/entities/guest/Guest.repository.js +5 -2
- package/dist/entities/guest/Guest.service.d.ts +1 -1
- package/dist/entities/guest/Guest.service.js +4 -1
- package/dist/entities/schedules/Schedule.repository.d.ts +1 -1
- package/dist/entities/schedules/Schedule.repository.js +5 -2
- package/dist/entities/schedules/Schedule.service.d.ts +1 -1
- package/dist/entities/schedules/Schedule.service.js +4 -1
- package/dist/entities/user/User.repository.js +4 -1
- package/dist/entities/user/User.service.d.ts +1 -1
- package/dist/entities/user/User.service.js +4 -1
- package/dist/entities/zone/Zone.service.js +4 -1
- package/dist/issues/Issue.service.js +1 -1
- package/package.json +2 -2
- package/dist/admin/Admin.repository.d.ts +0 -7
- package/dist/admin/Admin.repository.js +0 -182
- package/dist/admin/Admin.service.d.ts +0 -5
- package/dist/admin/Admin.service.js +0 -17
- package/dist/admin/index.d.ts +0 -1
- package/dist/admin/index.js +0 -17
- package/dist/audit/AuditProperties.d.ts +0 -16
- package/dist/audit/AuditProperties.js +0 -2
- package/dist/chronicle/IChronicle.interface.d.ts +0 -14
- package/dist/chronicle/IChronicle.interface.js +0 -2
- package/dist/chronicle/chronicle.service.d.ts +0 -4
- package/dist/chronicle/chronicle.service.js +0 -44
- package/dist/connection/Connection.repository.d.ts +0 -8
- package/dist/connection/Connection.repository.js +0 -92
- package/dist/connection/Connection.service.d.ts +0 -8
- package/dist/connection/Connection.service.js +0 -32
- package/dist/connection/IConnection.d.ts +0 -28
- package/dist/connection/IConnection.js +0 -16
- package/dist/connection/index.d.ts +0 -2
- package/dist/connection/index.js +0 -18
- package/dist/copilotQueue/examples/CopilotQueue.example.d.ts +0 -37
- package/dist/copilotQueue/examples/CopilotQueue.example.js +0 -140
- package/dist/copilotQueue/examples/index.d.ts +0 -1
- package/dist/copilotQueue/examples/index.js +0 -17
- package/dist/device/cloud/entities/CloudConnection.d.ts +0 -6
- package/dist/device/cloud/entities/CloudConnection.js +0 -6
- package/dist/device/cloud/entities/CloudDevice.d.ts +0 -16
- package/dist/device/cloud/entities/CloudDevice.js +0 -26
- package/dist/device/cloud/entities/CloudDeviceService.d.ts +0 -5
- package/dist/device/cloud/entities/CloudDeviceService.js +0 -9
- package/dist/device/cloud/entities/DeviceFactory.d.ts +0 -7
- package/dist/device/cloud/entities/DeviceFactory.js +0 -80
- package/dist/device/cloud/entities/index.d.ts +0 -3
- package/dist/device/cloud/entities/index.js +0 -19
- package/dist/device/cloud/interface.d.ts +0 -101
- package/dist/device/cloud/interface.js +0 -3
- package/dist/device/cloud/interfaces/ICloudConnection.d.ts +0 -5
- package/dist/device/cloud/interfaces/ICloudConnection.js +0 -2
- package/dist/device/cloud/interfaces/ICloudDevice.d.ts +0 -9
- package/dist/device/cloud/interfaces/ICloudDevice.js +0 -2
- package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +0 -4
- package/dist/device/cloud/interfaces/ICloudDeviceService.js +0 -2
- package/dist/device/cloud/interfaces/IConnectionService.d.ts +0 -7
- package/dist/device/cloud/interfaces/IConnectionService.js +0 -2
- package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +0 -7
- package/dist/device/cloud/interfaces/IDeviceConnectionService.js +0 -3
- package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +0 -4
- package/dist/device/cloud/interfaces/IDeviceFactory.js +0 -2
- package/dist/device/cloud/interfaces/IDeviceService.d.ts +0 -8
- package/dist/device/cloud/interfaces/IDeviceService.js +0 -2
- package/dist/device/cloud/interfaces/IDevicesService.d.ts +0 -9
- package/dist/device/cloud/interfaces/IDevicesService.js +0 -2
- package/dist/device/cloud/interfaces/IHubService.d.ts +0 -5
- package/dist/device/cloud/interfaces/IHubService.js +0 -2
- package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +0 -4
- package/dist/device/cloud/interfaces/IRawDataTransformer.js +0 -2
- package/dist/device/cloud/interfaces/IRawDevice.d.ts +0 -17
- package/dist/device/cloud/interfaces/IRawDevice.js +0 -11
- package/dist/device/cloud/interfaces/index.d.ts +0 -5
- package/dist/device/cloud/interfaces/index.js +0 -21
- package/dist/device/cloud/services/CloudDevice.service.d.ts +0 -5
- package/dist/device/cloud/services/CloudDevice.service.js +0 -9
- package/dist/device/cloud/services/Connection.service.d.ts +0 -8
- package/dist/device/cloud/services/Connection.service.js +0 -6
- package/dist/device/cloud/services/Device.service.d.ts +0 -39
- package/dist/device/cloud/services/Device.service.js +0 -9
- package/dist/device/cloud/services/DeviceCloudService.d.ts +0 -42
- package/dist/device/cloud/services/DeviceCloudService.js +0 -59
- package/dist/device/cloud/services/DeviceHub.service.d.ts +0 -3
- package/dist/device/cloud/services/DeviceHub.service.js +0 -6
- package/dist/device/cloud/services/Hub.service.d.ts +0 -25
- package/dist/device/cloud/services/Hub.service.js +0 -9
- package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +0 -38
- package/dist/device/cloud/services/SmartThingsDeviceService.js +0 -52
- package/dist/device/cloud/services/index.d.ts +0 -2
- package/dist/device/cloud/services/index.js +0 -18
- package/dist/device/cloud/types.d.ts +0 -52
- package/dist/device/cloud/types.js +0 -15
- package/dist/device/index.d.ts +0 -4
- package/dist/device/index.js +0 -20
- package/dist/device/local/entities/AlertBuilder.d.ts +0 -87
- package/dist/device/local/entities/AlertBuilder.example.d.ts +0 -11
- package/dist/device/local/entities/AlertBuilder.example.js +0 -117
- package/dist/device/local/entities/AlertBuilder.js +0 -179
- package/dist/device/local/entities/IssueBuilder.d.ts +0 -109
- package/dist/device/local/entities/IssueBuilder.example.d.ts +0 -16
- package/dist/device/local/entities/IssueBuilder.example.js +0 -196
- package/dist/device/local/entities/IssueBuilder.js +0 -237
- package/dist/device/local/entities/index.d.ts +0 -2
- package/dist/device/local/entities/index.js +0 -7
- package/dist/device/local/events/EventHandler.d.ts +0 -11
- package/dist/device/local/events/EventHandler.js +0 -86
- package/dist/device/local/events/Events.d.ts +0 -54
- package/dist/device/local/events/Events.js +0 -57
- package/dist/device/local/events/index.d.ts +0 -2
- package/dist/device/local/events/index.js +0 -7
- package/dist/device/local/handler/EventHandler.d.ts +0 -7
- package/dist/device/local/handler/EventHandler.js +0 -44
- package/dist/device/local/interface.d.ts +0 -0
- package/dist/device/local/interface.js +0 -1
- package/dist/device/local/interfaces/IConnection.d.ts +0 -26
- package/dist/device/local/interfaces/IConnection.js +0 -14
- package/dist/device/local/interfaces/IDevice.d.ts +0 -68
- package/dist/device/local/interfaces/IDevice.js +0 -10
- package/dist/device/local/interfaces/IDtDevice.d.ts +0 -16
- package/dist/device/local/interfaces/IDtDevice.js +0 -2
- package/dist/device/local/interfaces/IHub.d.ts +0 -46
- package/dist/device/local/interfaces/IHub.js +0 -2
- package/dist/device/local/interfaces/IProperty.d.ts +0 -29
- package/dist/device/local/interfaces/IProperty.js +0 -2
- package/dist/device/local/interfaces/ISchedule.d.ts +0 -25
- package/dist/device/local/interfaces/ISchedule.js +0 -2
- package/dist/device/local/interfaces/index.d.ts +0 -3
- package/dist/device/local/interfaces/index.js +0 -19
- package/dist/device/local/models/Alert.model.d.ts +0 -28
- package/dist/device/local/models/Alert.model.js +0 -222
- package/dist/device/local/models/Issue.model.d.ts +0 -28
- package/dist/device/local/models/Issue.model.js +0 -260
- package/dist/device/local/repository/Alert.repository.d.ts +0 -106
- package/dist/device/local/repository/Alert.repository.js +0 -374
- package/dist/device/local/repository/Connection.repository.d.ts +0 -8
- package/dist/device/local/repository/Connection.repository.js +0 -92
- package/dist/device/local/repository/Device.repository.d.ts +0 -30
- package/dist/device/local/repository/Device.repository.js +0 -325
- package/dist/device/local/repository/Hub.repository.d.ts +0 -13
- package/dist/device/local/repository/Hub.repository.js +0 -139
- package/dist/device/local/repository/Issue.repository.d.ts +0 -113
- package/dist/device/local/repository/Issue.repository.js +0 -401
- package/dist/device/local/repository/Property.repository.d.ts +0 -8
- package/dist/device/local/repository/Property.repository.js +0 -95
- package/dist/device/local/repository/Schedule.repository.d.ts +0 -9
- package/dist/device/local/repository/Schedule.repository.js +0 -109
- package/dist/device/local/services/Alert.service.d.ts +0 -137
- package/dist/device/local/services/Alert.service.js +0 -475
- package/dist/device/local/services/AlertService.example.d.ts +0 -55
- package/dist/device/local/services/AlertService.example.js +0 -148
- package/dist/device/local/services/Connection.service.d.ts +0 -8
- package/dist/device/local/services/Connection.service.js +0 -32
- package/dist/device/local/services/Device.service.d.ts +0 -40
- package/dist/device/local/services/Device.service.js +0 -391
- package/dist/device/local/services/DeviceHub.service.d.ts +0 -11
- package/dist/device/local/services/DeviceHub.service.js +0 -40
- package/dist/device/local/services/Hub.service.d.ts +0 -12
- package/dist/device/local/services/Hub.service.js +0 -107
- package/dist/device/local/services/Issue.service.d.ts +0 -168
- package/dist/device/local/services/Issue.service.js +0 -642
- package/dist/device/local/services/IssueService.example.d.ts +0 -68
- package/dist/device/local/services/IssueService.example.js +0 -177
- package/dist/device/local/services/Property.service.d.ts +0 -8
- package/dist/device/local/services/Property.service.js +0 -36
- package/dist/device/local/services/Schedule.service.d.ts +0 -9
- package/dist/device/local/services/Schedule.service.js +0 -26
- package/dist/device/local/services/index.d.ts +0 -3
- package/dist/device/local/services/index.js +0 -19
- package/dist/pms/IPms.d.ts +0 -6
- package/dist/pms/IPms.js +0 -10
- package/dist/pms/index.d.ts +0 -1
- package/dist/pms/index.js +0 -18
- package/dist/pms/webhookQueue/examples/index.d.ts +0 -2
- package/dist/pms/webhookQueue/examples/index.js +0 -18
- package/dist/pms/webhookQueue/examples/pms-integration.d.ts +0 -65
- package/dist/pms/webhookQueue/examples/pms-integration.js +0 -254
- package/dist/pms/webhookQueue/examples/usage.d.ts +0 -7
- package/dist/pms/webhookQueue/examples/usage.js +0 -175
- package/dist/pms/webhookQueue/index.d.ts +0 -3
- package/dist/pms/webhookQueue/index.js +0 -20
- package/dist/pms/webhookQueue/interfaces/IWebhookQueue.d.ts +0 -33
- package/dist/pms/webhookQueue/interfaces/IWebhookQueue.js +0 -2
- package/dist/pms/webhookQueue/interfaces/IWebhookWorker.d.ts +0 -38
- package/dist/pms/webhookQueue/interfaces/IWebhookWorker.js +0 -2
- package/dist/pms/webhookQueue/interfaces/index.d.ts +0 -1
- package/dist/pms/webhookQueue/interfaces/index.js +0 -17
- package/dist/pms/webhookQueue/services/WebhookQueueFactory.d.ts +0 -38
- package/dist/pms/webhookQueue/services/WebhookQueueFactory.js +0 -131
- package/dist/pms/webhookQueue/services/WebhookQueueIntegration.d.ts +0 -70
- package/dist/pms/webhookQueue/services/WebhookQueueIntegration.js +0 -207
- package/dist/pms/webhookQueue/services/WebhookQueueService.d.ts +0 -45
- package/dist/pms/webhookQueue/services/WebhookQueueService.js +0 -270
- package/dist/pms/webhookQueue/services/WebhookWorker.d.ts +0 -37
- package/dist/pms/webhookQueue/services/WebhookWorker.js +0 -201
- package/dist/pms/webhookQueue/services/index.d.ts +0 -1
- package/dist/pms/webhookQueue/services/index.js +0 -17
- package/dist/pms/webhookQueue/types/index.d.ts +0 -1
- package/dist/pms/webhookQueue/types/index.js +0 -17
- package/dist/pms/webhookQueue/types/webhook.types.d.ts +0 -39
- package/dist/pms/webhookQueue/types/webhook.types.js +0 -2
- package/dist/property/IProperty.d.ts +0 -29
- package/dist/property/IProperty.js +0 -2
- package/dist/property/Property.repository.d.ts +0 -8
- package/dist/property/Property.repository.js +0 -109
- package/dist/property/Property.service.d.ts +0 -8
- package/dist/property/Property.service.js +0 -124
- package/dist/property/index.d.ts +0 -2
- package/dist/property/index.js +0 -18
- package/dist/queue/interfaces/IHttpRequestJob.d.ts +0 -9
- package/dist/queue/interfaces/IHttpRequestJob.js +0 -2
- package/dist/types/alert.types.d.ts +0 -57
- package/dist/types/alert.types.js +0 -22
- package/dist/types/config.types.d.ts +0 -19
- package/dist/types/config.types.js +0 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -19
- package/dist/types/issue.types.d.ts +0 -90
- package/dist/types/issue.types.js +0 -40
- package/dist/utils/http-utils.d.ts +0 -13
- package/dist/utils/http-utils.js +0 -117
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventHandler = void 0;
|
|
4
|
-
const dt_pub_sub_1 = require("dt-pub-sub");
|
|
5
|
-
const dt_audit_library_1 = require("dt-audit-library");
|
|
6
|
-
class EventHandler {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.source = "dt-common-device";
|
|
9
|
-
}
|
|
10
|
-
async onStateChange(deviceId, state) {
|
|
11
|
-
await dt_pub_sub_1.eventDispatcher.publishEvent("device.state.set", { deviceId, state }, this.source);
|
|
12
|
-
const payload = {
|
|
13
|
-
eventType: "device.state.set",
|
|
14
|
-
properties: {
|
|
15
|
-
deviceId,
|
|
16
|
-
state,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
await (0, dt_audit_library_1.publishAudit)(payload);
|
|
20
|
-
}
|
|
21
|
-
async onStatusChange(deviceId, status) {
|
|
22
|
-
await dt_pub_sub_1.eventDispatcher.publishEvent("device.status.set", { deviceId, status }, this.source);
|
|
23
|
-
const payload = {
|
|
24
|
-
eventType: "device.status.set",
|
|
25
|
-
properties: {
|
|
26
|
-
deviceId,
|
|
27
|
-
status,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
await (0, dt_audit_library_1.publishAudit)(payload);
|
|
31
|
-
}
|
|
32
|
-
async onBatteryLevelChange(deviceId, batteryLevel) {
|
|
33
|
-
await dt_pub_sub_1.eventDispatcher.publishEvent("device.battery.set", { deviceId, batteryLevel }, this.source);
|
|
34
|
-
const payload = {
|
|
35
|
-
eventType: "device.battery.set",
|
|
36
|
-
properties: {
|
|
37
|
-
deviceId,
|
|
38
|
-
batteryLevel,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
await (0, dt_audit_library_1.publishAudit)(payload);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.EventHandler = EventHandler;
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface IConnection {
|
|
2
|
-
id?: string;
|
|
3
|
-
createdAt?: Date;
|
|
4
|
-
updatedAt?: Date;
|
|
5
|
-
isDeleted?: boolean;
|
|
6
|
-
connectionName: string;
|
|
7
|
-
connectionRefId: string;
|
|
8
|
-
propertyId: string;
|
|
9
|
-
connectionProvider: ConnectionProvider;
|
|
10
|
-
accessToken?: string;
|
|
11
|
-
refreshToken?: string;
|
|
12
|
-
clientId?: string;
|
|
13
|
-
clientSecret: string;
|
|
14
|
-
isActive?: boolean;
|
|
15
|
-
metaData?: any;
|
|
16
|
-
}
|
|
17
|
-
export declare enum ConnectionProvider {
|
|
18
|
-
Smartthings = "Smartthings",
|
|
19
|
-
SaltoKS = "SaltoKS",
|
|
20
|
-
TTLock = "TTLock",
|
|
21
|
-
Tuya = "Tuya",
|
|
22
|
-
Schlage = "Schlage",
|
|
23
|
-
YaleWifi = "YaleWifi",
|
|
24
|
-
Sensibo = "Sensibo",
|
|
25
|
-
Devicethread = "Devicethread"
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConnectionProvider = void 0;
|
|
4
|
-
var ConnectionProvider;
|
|
5
|
-
(function (ConnectionProvider) {
|
|
6
|
-
ConnectionProvider["Smartthings"] = "Smartthings";
|
|
7
|
-
ConnectionProvider["SaltoKS"] = "SaltoKS";
|
|
8
|
-
ConnectionProvider["TTLock"] = "TTLock";
|
|
9
|
-
ConnectionProvider["Tuya"] = "Tuya";
|
|
10
|
-
ConnectionProvider["Schlage"] = "Schlage";
|
|
11
|
-
ConnectionProvider["YaleWifi"] = "YaleWifi";
|
|
12
|
-
ConnectionProvider["Sensibo"] = "Sensibo";
|
|
13
|
-
ConnectionProvider["Devicethread"] = "Devicethread";
|
|
14
|
-
})(ConnectionProvider || (exports.ConnectionProvider = ConnectionProvider = {}));
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export interface IDevice {
|
|
2
|
-
deviceId: string;
|
|
3
|
-
propertyId: string;
|
|
4
|
-
zoneId: string;
|
|
5
|
-
name: string;
|
|
6
|
-
hubId: string[];
|
|
7
|
-
specifications: {
|
|
8
|
-
manufacturer?: string;
|
|
9
|
-
model?: string;
|
|
10
|
-
firmware?: {
|
|
11
|
-
version?: string;
|
|
12
|
-
newVersionAvailable?: boolean;
|
|
13
|
-
newVersion?: string;
|
|
14
|
-
mandatoryUpdate?: boolean;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
protocol: {
|
|
18
|
-
location?: {
|
|
19
|
-
id?: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
city?: string;
|
|
22
|
-
};
|
|
23
|
-
name?: string;
|
|
24
|
-
room?: {
|
|
25
|
-
id?: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
};
|
|
28
|
-
accountId?: string;
|
|
29
|
-
};
|
|
30
|
-
connection: {
|
|
31
|
-
id: string;
|
|
32
|
-
name: string;
|
|
33
|
-
};
|
|
34
|
-
deviceType: {
|
|
35
|
-
id: string;
|
|
36
|
-
type: string;
|
|
37
|
-
};
|
|
38
|
-
status: IStatus;
|
|
39
|
-
isActive: {
|
|
40
|
-
value: boolean;
|
|
41
|
-
lastUpdated: string;
|
|
42
|
-
};
|
|
43
|
-
state?: Record<string, any>;
|
|
44
|
-
metaData?: Record<string, any>;
|
|
45
|
-
createdAt?: Date;
|
|
46
|
-
updatedAt?: Date;
|
|
47
|
-
hubDeviceDetails?: IDevice[];
|
|
48
|
-
capabilities?: Record<string, any>;
|
|
49
|
-
}
|
|
50
|
-
export declare class IStatus {
|
|
51
|
-
online: boolean;
|
|
52
|
-
liveStatus?: "ONLINE" | "OFFLINE";
|
|
53
|
-
error?: {
|
|
54
|
-
type?: string;
|
|
55
|
-
message?: string;
|
|
56
|
-
default?: object;
|
|
57
|
-
};
|
|
58
|
-
lastUpdated?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface IStatusQuery {
|
|
61
|
-
deviceIds?: string[];
|
|
62
|
-
zoneId?: string;
|
|
63
|
-
propertyId?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface IStatusUpdateRequest {
|
|
66
|
-
query: IStatusQuery;
|
|
67
|
-
status: IStatus;
|
|
68
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface IDtDevice {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
type: string;
|
|
5
|
-
zoneId: string;
|
|
6
|
-
deviceType: string;
|
|
7
|
-
deviceId: string;
|
|
8
|
-
deviceNetworkId: string;
|
|
9
|
-
propertyId: string;
|
|
10
|
-
connectionId: string;
|
|
11
|
-
hubId: string;
|
|
12
|
-
isBatteryLowAlertSent: boolean;
|
|
13
|
-
createdAt: string;
|
|
14
|
-
updatedAt: string;
|
|
15
|
-
isActive: boolean;
|
|
16
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export interface IHub {
|
|
2
|
-
deviceId: string;
|
|
3
|
-
propertyId: string;
|
|
4
|
-
name: string;
|
|
5
|
-
hubId?: string[];
|
|
6
|
-
specifications: {
|
|
7
|
-
manufacturer?: string;
|
|
8
|
-
model?: string;
|
|
9
|
-
firmware?: {
|
|
10
|
-
version?: string;
|
|
11
|
-
newVersionAvailable?: boolean;
|
|
12
|
-
newVersion?: string;
|
|
13
|
-
mandatoryUpdate?: boolean;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
protocol: {
|
|
17
|
-
location?: {
|
|
18
|
-
id?: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
city?: string;
|
|
21
|
-
};
|
|
22
|
-
name?: string;
|
|
23
|
-
room?: {
|
|
24
|
-
id?: string;
|
|
25
|
-
name?: string;
|
|
26
|
-
};
|
|
27
|
-
accountId?: string;
|
|
28
|
-
};
|
|
29
|
-
deviceType: {
|
|
30
|
-
id: string;
|
|
31
|
-
type: string;
|
|
32
|
-
};
|
|
33
|
-
status: {
|
|
34
|
-
online: boolean;
|
|
35
|
-
error?: {
|
|
36
|
-
type?: string;
|
|
37
|
-
message?: string;
|
|
38
|
-
default?: object;
|
|
39
|
-
};
|
|
40
|
-
lastUpdated?: Date;
|
|
41
|
-
};
|
|
42
|
-
state?: object;
|
|
43
|
-
metaData?: object;
|
|
44
|
-
createdAt?: Date;
|
|
45
|
-
updatedAt?: Date;
|
|
46
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface IProperty {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
apartment: string;
|
|
5
|
-
city: string;
|
|
6
|
-
country: string;
|
|
7
|
-
state: string;
|
|
8
|
-
street: string;
|
|
9
|
-
zipCode: string;
|
|
10
|
-
createdBy?: string;
|
|
11
|
-
isDeleted: boolean;
|
|
12
|
-
imageURL: string;
|
|
13
|
-
timezone: string;
|
|
14
|
-
officialName?: string;
|
|
15
|
-
sameAsOfficialName?: boolean;
|
|
16
|
-
phoneNumber?: string;
|
|
17
|
-
phoneNumberCountryCode?: string;
|
|
18
|
-
propertyKey?: string;
|
|
19
|
-
hubNetworkId?: string;
|
|
20
|
-
isTimeZoneOverridden: boolean;
|
|
21
|
-
createdAt: string;
|
|
22
|
-
updatedAt: string;
|
|
23
|
-
propertyBillingId?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface IPropertySettings {
|
|
26
|
-
id: string;
|
|
27
|
-
propertyId: string;
|
|
28
|
-
settings: Record<string, any>;
|
|
29
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ISchedule {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
deviceId: string;
|
|
5
|
-
scheduleId: string | null;
|
|
6
|
-
state: {
|
|
7
|
-
targetTemperature?: number;
|
|
8
|
-
temperatureUnit?: "C" | "F";
|
|
9
|
-
mode?: "cool" | "heat" | "fan" | "dry" | "auto";
|
|
10
|
-
swing?: "stopped" | "rangeFull" | "fixedTop" | "fixedMiddleTop" | "fixedMiddle" | "fixedMiddleBottom" | "fixedBottom";
|
|
11
|
-
fanLevel?: "auto" | "low" | "medium" | "high";
|
|
12
|
-
};
|
|
13
|
-
startTime: string;
|
|
14
|
-
endTime: string;
|
|
15
|
-
recurringDays: ("Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday")[];
|
|
16
|
-
createTime?: string;
|
|
17
|
-
nextTime?: string;
|
|
18
|
-
nextTimeSecondsFromNow?: number;
|
|
19
|
-
targetTimeLocal: string;
|
|
20
|
-
timezone: string;
|
|
21
|
-
scheduleInheritedFrom: "zone" | "device";
|
|
22
|
-
zoneId: string;
|
|
23
|
-
userId: string;
|
|
24
|
-
status?: "SET" | "UNSET";
|
|
25
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./IDevice"), exports);
|
|
18
|
-
__exportStar(require("./IDtDevice"), exports);
|
|
19
|
-
__exportStar(require("./ISchedule"), exports);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import mongoose, { Model } from "mongoose";
|
|
2
|
-
import { AlertCategory, AlertSeverity, EntityType, AlertDocument as IAlertDocument, CreateAlertData, UpdateAlertData } from "../../../types/alert.types";
|
|
3
|
-
interface IAlertMethods {
|
|
4
|
-
markAsRead(updatedBy: string): void;
|
|
5
|
-
markAsUnread(updatedBy: string): void;
|
|
6
|
-
activate(updatedBy: string): void;
|
|
7
|
-
deactivate(updatedBy: string): void;
|
|
8
|
-
snooze(until: Date, updatedBy: string): void;
|
|
9
|
-
unsnooze(updatedBy: string): void;
|
|
10
|
-
}
|
|
11
|
-
interface IAlertModel extends Model<IAlertDocument, {}, IAlertMethods> {
|
|
12
|
-
findByProperty(propertyId: string, includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
13
|
-
findByEntity(entityId: string, entityType: EntityType, includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
14
|
-
findByCategory(category: AlertCategory, includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
15
|
-
findBySeverity(severity: AlertSeverity, includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
16
|
-
findActive(includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
17
|
-
findUnread(includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
18
|
-
findSnoozed(includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
19
|
-
findExpiredSnooze(includeDeleted?: boolean): Promise<IAlertDocument[]>;
|
|
20
|
-
}
|
|
21
|
-
declare const AlertSchema: mongoose.Schema<IAlertDocument, IAlertModel, IAlertMethods, {}, {}, {}, mongoose.DefaultSchemaOptions, IAlertDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAlertDocument>, {}> & Omit<mongoose.FlatRecord<IAlertDocument> & Required<{
|
|
22
|
-
_id: string;
|
|
23
|
-
}> & {
|
|
24
|
-
__v: number;
|
|
25
|
-
}, keyof IAlertMethods> & IAlertMethods>;
|
|
26
|
-
export declare const AlertModel: IAlertModel;
|
|
27
|
-
export { AlertSchema };
|
|
28
|
-
export type { IAlertDocument, CreateAlertData, UpdateAlertData, IAlertMethods, IAlertModel, };
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AlertSchema = exports.AlertModel = void 0;
|
|
37
|
-
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
-
const alert_types_1 = require("../../../types/alert.types");
|
|
39
|
-
// Main Alert schema
|
|
40
|
-
const AlertSchema = new mongoose_1.Schema({
|
|
41
|
-
category: {
|
|
42
|
-
type: String,
|
|
43
|
-
enum: Object.values(alert_types_1.AlertCategory),
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
propertyId: {
|
|
47
|
-
type: String,
|
|
48
|
-
required: true,
|
|
49
|
-
index: true,
|
|
50
|
-
},
|
|
51
|
-
title: {
|
|
52
|
-
type: String,
|
|
53
|
-
required: true,
|
|
54
|
-
trim: true,
|
|
55
|
-
},
|
|
56
|
-
description: {
|
|
57
|
-
type: String,
|
|
58
|
-
required: true,
|
|
59
|
-
trim: true,
|
|
60
|
-
},
|
|
61
|
-
entityId: {
|
|
62
|
-
type: String,
|
|
63
|
-
index: true,
|
|
64
|
-
},
|
|
65
|
-
entityType: {
|
|
66
|
-
type: String,
|
|
67
|
-
enum: Object.values(alert_types_1.EntityType),
|
|
68
|
-
required: true,
|
|
69
|
-
index: true,
|
|
70
|
-
},
|
|
71
|
-
severity: {
|
|
72
|
-
type: String,
|
|
73
|
-
enum: Object.values(alert_types_1.AlertSeverity),
|
|
74
|
-
default: alert_types_1.AlertSeverity.MEDIUM,
|
|
75
|
-
},
|
|
76
|
-
isRead: {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: false,
|
|
79
|
-
index: true,
|
|
80
|
-
},
|
|
81
|
-
isActive: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: true,
|
|
84
|
-
index: true,
|
|
85
|
-
},
|
|
86
|
-
isDeleted: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: false,
|
|
89
|
-
},
|
|
90
|
-
snoozeUntil: {
|
|
91
|
-
type: Date,
|
|
92
|
-
},
|
|
93
|
-
createdBy: {
|
|
94
|
-
type: String,
|
|
95
|
-
},
|
|
96
|
-
updatedBy: {
|
|
97
|
-
type: String,
|
|
98
|
-
},
|
|
99
|
-
createdAt: {
|
|
100
|
-
type: Date,
|
|
101
|
-
default: Date.now,
|
|
102
|
-
},
|
|
103
|
-
updatedAt: {
|
|
104
|
-
type: Date,
|
|
105
|
-
default: Date.now,
|
|
106
|
-
},
|
|
107
|
-
}, {
|
|
108
|
-
timestamps: true,
|
|
109
|
-
collection: "dt_alerts",
|
|
110
|
-
});
|
|
111
|
-
exports.AlertSchema = AlertSchema;
|
|
112
|
-
// Compound indexes to match Prisma schema
|
|
113
|
-
AlertSchema.index({ propertyId: 1, isActive: 1, isRead: 1 });
|
|
114
|
-
AlertSchema.index({ entityId: 1, entityType: 1 });
|
|
115
|
-
AlertSchema.index({ createdAt: 1 });
|
|
116
|
-
// Pre-save middleware to update the updatedAt field
|
|
117
|
-
AlertSchema.pre("save", function (next) {
|
|
118
|
-
this.updatedAt = new Date();
|
|
119
|
-
next();
|
|
120
|
-
});
|
|
121
|
-
// Pre-update middleware to update the updatedAt field
|
|
122
|
-
AlertSchema.pre(["updateOne", "findOneAndUpdate", "updateMany"], function (next) {
|
|
123
|
-
this.set({ updatedAt: new Date() });
|
|
124
|
-
next();
|
|
125
|
-
});
|
|
126
|
-
// Instance methods
|
|
127
|
-
AlertSchema.methods.markAsRead = function (updatedBy) {
|
|
128
|
-
this.isRead = true;
|
|
129
|
-
this.updatedBy = updatedBy;
|
|
130
|
-
};
|
|
131
|
-
AlertSchema.methods.markAsUnread = function (updatedBy) {
|
|
132
|
-
this.isRead = false;
|
|
133
|
-
this.updatedBy = updatedBy;
|
|
134
|
-
};
|
|
135
|
-
AlertSchema.methods.activate = function (updatedBy) {
|
|
136
|
-
this.isActive = true;
|
|
137
|
-
this.updatedBy = updatedBy;
|
|
138
|
-
};
|
|
139
|
-
AlertSchema.methods.deactivate = function (updatedBy) {
|
|
140
|
-
this.isActive = false;
|
|
141
|
-
this.updatedBy = updatedBy;
|
|
142
|
-
};
|
|
143
|
-
AlertSchema.methods.snooze = function (until, updatedBy) {
|
|
144
|
-
this.snoozeUntil = until;
|
|
145
|
-
this.updatedBy = updatedBy;
|
|
146
|
-
};
|
|
147
|
-
AlertSchema.methods.unsnooze = function (updatedBy) {
|
|
148
|
-
this.snoozeUntil = undefined;
|
|
149
|
-
this.updatedBy = updatedBy;
|
|
150
|
-
};
|
|
151
|
-
// Static methods
|
|
152
|
-
AlertSchema.statics.findByProperty = function (propertyId, includeDeleted = false) {
|
|
153
|
-
const query = { propertyId };
|
|
154
|
-
if (!includeDeleted) {
|
|
155
|
-
query.isDeleted = false;
|
|
156
|
-
}
|
|
157
|
-
return this.find(query).sort({ createdAt: -1 });
|
|
158
|
-
};
|
|
159
|
-
AlertSchema.statics.findByEntity = function (entityId, entityType, includeDeleted = false) {
|
|
160
|
-
const query = { entityId, entityType };
|
|
161
|
-
if (!includeDeleted) {
|
|
162
|
-
query.isDeleted = false;
|
|
163
|
-
}
|
|
164
|
-
return this.find(query).sort({ createdAt: -1 });
|
|
165
|
-
};
|
|
166
|
-
AlertSchema.statics.findByCategory = function (category, includeDeleted = false) {
|
|
167
|
-
const query = { category };
|
|
168
|
-
if (!includeDeleted) {
|
|
169
|
-
query.isDeleted = false;
|
|
170
|
-
}
|
|
171
|
-
return this.find(query).sort({ createdAt: -1 });
|
|
172
|
-
};
|
|
173
|
-
AlertSchema.statics.findBySeverity = function (severity, includeDeleted = false) {
|
|
174
|
-
const query = { severity };
|
|
175
|
-
if (!includeDeleted) {
|
|
176
|
-
query.isDeleted = false;
|
|
177
|
-
}
|
|
178
|
-
return this.find(query).sort({ severity: -1, createdAt: -1 });
|
|
179
|
-
};
|
|
180
|
-
AlertSchema.statics.findActive = function (includeDeleted = false) {
|
|
181
|
-
const query = { isActive: true };
|
|
182
|
-
if (!includeDeleted) {
|
|
183
|
-
query.isDeleted = false;
|
|
184
|
-
}
|
|
185
|
-
return this.find(query).sort({ severity: -1, createdAt: -1 });
|
|
186
|
-
};
|
|
187
|
-
AlertSchema.statics.findUnread = function (includeDeleted = false) {
|
|
188
|
-
const query = { isRead: false };
|
|
189
|
-
if (!includeDeleted) {
|
|
190
|
-
query.isDeleted = false;
|
|
191
|
-
}
|
|
192
|
-
return this.find(query).sort({ severity: -1, createdAt: -1 });
|
|
193
|
-
};
|
|
194
|
-
AlertSchema.statics.findSnoozed = function (includeDeleted = false) {
|
|
195
|
-
const query = { snoozeUntil: { $exists: true, $ne: null } };
|
|
196
|
-
if (!includeDeleted) {
|
|
197
|
-
query.isDeleted = false;
|
|
198
|
-
}
|
|
199
|
-
return this.find(query).sort({ snoozeUntil: 1 });
|
|
200
|
-
};
|
|
201
|
-
AlertSchema.statics.findExpiredSnooze = function (includeDeleted = false) {
|
|
202
|
-
const query = {
|
|
203
|
-
snoozeUntil: { $lt: new Date() },
|
|
204
|
-
isActive: true,
|
|
205
|
-
};
|
|
206
|
-
if (!includeDeleted) {
|
|
207
|
-
query.isDeleted = false;
|
|
208
|
-
}
|
|
209
|
-
return this.find(query).sort({ snoozeUntil: 1 });
|
|
210
|
-
};
|
|
211
|
-
// Virtual for snooze status
|
|
212
|
-
AlertSchema.virtual("isSnoozed").get(function () {
|
|
213
|
-
return this.snoozeUntil && this.snoozeUntil > new Date();
|
|
214
|
-
});
|
|
215
|
-
AlertSchema.virtual("isSnoozeExpired").get(function () {
|
|
216
|
-
return this.snoozeUntil && this.snoozeUntil <= new Date();
|
|
217
|
-
});
|
|
218
|
-
// Ensure virtuals are serialized
|
|
219
|
-
AlertSchema.set("toJSON", { virtuals: true });
|
|
220
|
-
AlertSchema.set("toObject", { virtuals: true });
|
|
221
|
-
// Create and export the model
|
|
222
|
-
exports.AlertModel = mongoose_1.default.model("Alert", AlertSchema);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import mongoose, { Model } from "mongoose";
|
|
2
|
-
import { EntityType, IssueStatus, IssuePriority, IssueDocument as IIssueDocument, CreateIssueData, UpdateIssueData, AddCommentData } from "../../../types/issue.types";
|
|
3
|
-
interface IIssueMethods {
|
|
4
|
-
addComment(commentData: AddCommentData): void;
|
|
5
|
-
updateComment(commentId: string, content: string, userId: string): boolean;
|
|
6
|
-
removeComment(commentId: string): boolean;
|
|
7
|
-
resolve(resolvedBy: string): void;
|
|
8
|
-
reopen(updatedBy: string): void;
|
|
9
|
-
assign(userId: string, assignedBy: string): void;
|
|
10
|
-
unassign(unassignedBy: string): void;
|
|
11
|
-
}
|
|
12
|
-
interface IIssueModel extends Model<IIssueDocument, {}, IIssueMethods> {
|
|
13
|
-
findByProperty(propertyId: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
14
|
-
findByAssignee(assignedTo: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
15
|
-
findByEntity(entityId: string, entityType: EntityType, includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
16
|
-
findByStatus(status: IssueStatus, includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
17
|
-
findByPriority(priority: IssuePriority, includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
18
|
-
findOverdue(includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
19
|
-
findUpcoming(days?: number, includeDeleted?: boolean): Promise<IIssueDocument[]>;
|
|
20
|
-
}
|
|
21
|
-
declare const IssueSchema: mongoose.Schema<IIssueDocument, IIssueModel, IIssueMethods, {}, {}, {}, mongoose.DefaultSchemaOptions, IIssueDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<IIssueDocument>, {}> & Omit<mongoose.FlatRecord<IIssueDocument> & Required<{
|
|
22
|
-
_id: string;
|
|
23
|
-
}> & {
|
|
24
|
-
__v: number;
|
|
25
|
-
}, keyof IIssueMethods> & IIssueMethods>;
|
|
26
|
-
export declare const IssueModel: IIssueModel;
|
|
27
|
-
export { IssueSchema };
|
|
28
|
-
export type { IIssueDocument, CreateIssueData, UpdateIssueData, AddCommentData, IIssueMethods, IIssueModel, };
|