dt-common-device 13.1.3 → 13.1.5
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/admin/Admin.repository.d.ts +7 -0
- package/dist/admin/Admin.service.d.ts +5 -0
- package/dist/admin/index.d.ts +1 -0
- package/dist/alerts/AlertBuilder.example.d.ts +11 -0
- package/dist/alerts/AlertService.example.d.ts +55 -0
- package/dist/audit/AuditProperties.d.ts +16 -0
- package/dist/chronicle/Cronicle.service.d.ts +9 -0
- package/dist/chronicle/IChronicle.interface.d.ts +14 -0
- package/dist/chronicle/ICronicle.interface.d.ts +15 -0
- package/dist/chronicle/chronicle.service.d.ts +4 -0
- package/dist/chronicle/index.d.ts +2 -0
- package/dist/connection/Connection.repository.d.ts +8 -0
- package/dist/connection/Connection.service.d.ts +8 -0
- package/dist/connection/IConnection.d.ts +28 -0
- package/dist/connection/index.d.ts +2 -0
- package/dist/copilotQueue/examples/CopilotQueue.example.d.ts +37 -0
- package/dist/copilotQueue/examples/index.d.ts +1 -0
- package/dist/device/cloud/entities/CloudConnection.d.ts +6 -0
- package/dist/device/cloud/entities/CloudDevice.d.ts +16 -0
- package/dist/device/cloud/entities/CloudDeviceService.d.ts +5 -0
- package/dist/device/cloud/entities/DeviceFactory.d.ts +7 -0
- package/dist/device/cloud/entities/index.d.ts +3 -0
- package/dist/device/cloud/interface.d.ts +101 -0
- package/dist/device/cloud/interfaces/ICloudConnection.d.ts +5 -0
- package/dist/device/cloud/interfaces/ICloudDevice.d.ts +9 -0
- package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +4 -0
- package/dist/device/cloud/interfaces/IConnectionService.d.ts +7 -0
- package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +7 -0
- package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +4 -0
- package/dist/device/cloud/interfaces/IDeviceService.d.ts +8 -0
- package/dist/device/cloud/interfaces/IDevicesService.d.ts +9 -0
- package/dist/device/cloud/interfaces/IHubService.d.ts +5 -0
- package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +4 -0
- package/dist/device/cloud/interfaces/IRawDevice.d.ts +17 -0
- package/dist/device/cloud/interfaces/index.d.ts +5 -0
- package/dist/device/cloud/services/CloudDevice.service.d.ts +5 -0
- package/dist/device/cloud/services/Connection.service.d.ts +8 -0
- package/dist/device/cloud/services/Device.service.d.ts +39 -0
- package/dist/device/cloud/services/DeviceCloudService.d.ts +42 -0
- package/dist/device/cloud/services/DeviceHub.service.d.ts +3 -0
- package/dist/device/cloud/services/Hub.service.d.ts +25 -0
- package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +38 -0
- package/dist/device/cloud/services/SmartThingsDeviceService.js +52 -0
- package/dist/device/cloud/services/index.d.ts +2 -0
- package/dist/device/cloud/types.d.ts +52 -0
- package/dist/device/cloud/types.js +15 -0
- package/dist/device/index.d.ts +4 -0
- package/dist/device/local/entities/AlertBuilder.d.ts +87 -0
- package/dist/device/local/entities/AlertBuilder.example.d.ts +11 -0
- package/dist/device/local/entities/IssueBuilder.d.ts +109 -0
- package/dist/device/local/entities/IssueBuilder.example.d.ts +16 -0
- package/dist/device/local/entities/IssueBuilder.example.js +196 -0
- package/dist/device/local/entities/IssueBuilder.js +237 -0
- package/dist/device/local/entities/index.d.ts +2 -0
- package/dist/device/local/events/EventHandler.d.ts +11 -0
- package/dist/device/local/events/Events.d.ts +54 -0
- package/dist/device/local/events/index.d.ts +2 -0
- package/dist/device/local/handler/EventHandler.d.ts +7 -0
- package/dist/device/local/interface.d.ts +0 -0
- package/dist/device/local/interfaces/IConnection.d.ts +26 -0
- package/dist/device/local/interfaces/IDevice.d.ts +68 -0
- package/dist/device/local/interfaces/IDtDevice.d.ts +16 -0
- package/dist/device/local/interfaces/IHub.d.ts +46 -0
- package/dist/device/local/interfaces/IProperty.d.ts +29 -0
- package/dist/device/local/interfaces/ISchedule.d.ts +25 -0
- package/dist/device/local/interfaces/index.d.ts +3 -0
- package/dist/device/local/models/Alert.model.d.ts +28 -0
- package/dist/device/local/models/Issue.model.d.ts +28 -0
- package/dist/device/local/repository/Alert.repository.d.ts +106 -0
- package/dist/device/local/repository/Connection.repository.d.ts +8 -0
- package/dist/device/local/repository/Device.repository.d.ts +30 -0
- package/dist/device/local/repository/Hub.repository.d.ts +13 -0
- package/dist/device/local/repository/Issue.repository.d.ts +113 -0
- package/dist/device/local/repository/Property.repository.d.ts +8 -0
- package/dist/device/local/repository/Property.repository.js +95 -0
- package/dist/device/local/repository/Schedule.repository.d.ts +9 -0
- package/dist/device/local/repository/Schedule.repository.js +109 -0
- package/dist/device/local/services/Alert.service.d.ts +137 -0
- package/dist/device/local/services/AlertService.example.d.ts +55 -0
- package/dist/device/local/services/Connection.service.d.ts +8 -0
- package/dist/device/local/services/Device.service.d.ts +40 -0
- package/dist/device/local/services/DeviceHub.service.d.ts +11 -0
- package/dist/device/local/services/Hub.service.d.ts +12 -0
- package/dist/device/local/services/Issue.service.d.ts +168 -0
- package/dist/device/local/services/Issue.service.js +642 -0
- package/dist/device/local/services/IssueService.example.d.ts +68 -0
- package/dist/device/local/services/IssueService.example.js +177 -0
- package/dist/device/local/services/Property.service.d.ts +8 -0
- package/dist/device/local/services/Property.service.js +36 -0
- package/dist/device/local/services/Schedule.service.d.ts +9 -0
- package/dist/device/local/services/Schedule.service.js +26 -0
- package/dist/device/local/services/index.d.ts +3 -0
- package/dist/entities/accessGroup/AccessGroup.repository.d.ts +5 -0
- package/dist/entities/accessGroup/AccessGroup.service.d.ts +5 -0
- package/dist/entities/accessGroup/IAccessGroup.d.ts +14 -0
- package/dist/entities/accessGroup/index.d.ts +2 -0
- package/dist/entities/admin/Admin.repository.d.ts +1 -0
- package/dist/entities/admin/Admin.repository.js +13 -0
- package/dist/entities/admin/Admin.service.d.ts +1 -0
- package/dist/entities/admin/Admin.service.js +4 -0
- package/dist/entities/device/local/repository/DeviceProfile.repository.d.ts +5 -0
- package/dist/entities/guest/Guest.repository.d.ts +6 -0
- package/dist/entities/guest/Guest.service.d.ts +6 -0
- package/dist/entities/guest/IGuest.d.ts +12 -0
- package/dist/entities/guest/index.d.ts +2 -0
- package/dist/entities/schedules/ISchedule.d.ts +14 -0
- package/dist/entities/schedules/Schedule.repository.d.ts +6 -0
- package/dist/entities/schedules/Schedule.repository.js +74 -0
- package/dist/entities/schedules/Schedule.service.d.ts +6 -0
- package/dist/entities/schedules/Schedule.service.js +104 -0
- package/dist/entities/schedules/index.d.ts +2 -0
- package/dist/entities/user/IUser.d.ts +15 -0
- package/dist/entities/user/IUser.js +2 -0
- package/dist/entities/user/User.repository.d.ts +5 -0
- package/dist/entities/user/User.repository.js +68 -0
- package/dist/entities/user/User.service.d.ts +6 -0
- package/dist/entities/user/User.service.js +103 -0
- package/dist/entities/zone/IZone.d.ts +10 -0
- package/dist/entities/zone/IZone.js +2 -0
- package/dist/entities/zone/Zone.repository.d.ts +6 -0
- package/dist/entities/zone/Zone.repository.js +77 -0
- package/dist/entities/zone/Zone.service.d.ts +6 -0
- package/dist/entities/zone/Zone.service.js +104 -0
- package/dist/entities/zone/index.d.ts +2 -0
- package/dist/issues/IssueBuilder.example.d.ts +16 -0
- package/dist/issues/IssueBuilder.example.js +196 -0
- package/dist/issues/IssueService.example.d.ts +68 -0
- package/dist/issues/IssueService.example.js +292 -0
- package/dist/pms/IPms.d.ts +6 -0
- package/dist/pms/index.d.ts +1 -0
- package/dist/pms/webhookQueue/examples/index.d.ts +2 -0
- package/dist/pms/webhookQueue/examples/pms-integration.d.ts +65 -0
- package/dist/pms/webhookQueue/examples/pms-integration.js +254 -0
- package/dist/pms/webhookQueue/examples/usage.d.ts +7 -0
- package/dist/pms/webhookQueue/examples/usage.js +175 -0
- package/dist/pms/webhookQueue/index.d.ts +3 -0
- package/dist/pms/webhookQueue/interfaces/IWebhookQueue.d.ts +33 -0
- package/dist/pms/webhookQueue/interfaces/IWebhookQueue.js +2 -0
- package/dist/pms/webhookQueue/interfaces/IWebhookWorker.d.ts +38 -0
- package/dist/pms/webhookQueue/interfaces/IWebhookWorker.js +2 -0
- package/dist/pms/webhookQueue/interfaces/index.d.ts +1 -0
- package/dist/pms/webhookQueue/services/WebhookQueueFactory.d.ts +38 -0
- package/dist/pms/webhookQueue/services/WebhookQueueFactory.js +131 -0
- package/dist/pms/webhookQueue/services/WebhookQueueIntegration.d.ts +70 -0
- package/dist/pms/webhookQueue/services/WebhookQueueIntegration.js +207 -0
- package/dist/pms/webhookQueue/services/WebhookQueueService.d.ts +45 -0
- package/dist/pms/webhookQueue/services/WebhookQueueService.js +270 -0
- package/dist/pms/webhookQueue/services/WebhookWorker.d.ts +37 -0
- package/dist/pms/webhookQueue/services/WebhookWorker.js +201 -0
- package/dist/pms/webhookQueue/services/index.d.ts +1 -0
- package/dist/pms/webhookQueue/types/index.d.ts +1 -0
- package/dist/pms/webhookQueue/types/webhook.types.d.ts +39 -0
- package/dist/pms/webhookQueue/types/webhook.types.js +2 -0
- package/dist/property/IProperty.d.ts +29 -0
- package/dist/property/Property.repository.d.ts +8 -0
- package/dist/property/Property.repository.js +109 -0
- package/dist/property/Property.service.d.ts +8 -0
- package/dist/property/Property.service.js +124 -0
- package/dist/property/index.d.ts +2 -0
- package/dist/queue/interfaces/IHttpRequestJob.d.ts +9 -0
- package/dist/types/alert.types.d.ts +57 -0
- package/dist/types/config.types.d.ts +19 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/issue.types.d.ts +90 -0
- package/dist/types/issue.types.js +40 -0
- package/dist/utils/http-utils.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IssueBuilder = void 0;
|
|
4
|
+
const issue_types_1 = require("../../../types/issue.types");
|
|
5
|
+
/**
|
|
6
|
+
* IssueBuilder - A builder pattern implementation for constructing CreateIssueData objects
|
|
7
|
+
*
|
|
8
|
+
* This builder provides a fluent interface for creating issue data with proper validation
|
|
9
|
+
* and default values. It follows the Builder pattern which is a standard design pattern
|
|
10
|
+
* in TypeScript for constructing complex objects.
|
|
11
|
+
*
|
|
12
|
+
* Usage example:
|
|
13
|
+
* const issueData = new IssueBuilder()
|
|
14
|
+
* .setCategory(IssuesCategory.OPERATIONS)
|
|
15
|
+
* .setPropertyId("prop123")
|
|
16
|
+
* .setTitle("Device Maintenance Required")
|
|
17
|
+
* .setDescription("Device requires scheduled maintenance")
|
|
18
|
+
* .setEntityId("device456")
|
|
19
|
+
* .setEntityType(EntityType.DEVICE)
|
|
20
|
+
* .setPriority(IssuePriority.HIGH)
|
|
21
|
+
* .setAssignedTo("tech789")
|
|
22
|
+
* .setCreatedBy("user123")
|
|
23
|
+
* .setDueDate(new Date("2024-01-15"))
|
|
24
|
+
* .build();
|
|
25
|
+
*/
|
|
26
|
+
class IssueBuilder {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.data = {};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets the issue category
|
|
32
|
+
*/
|
|
33
|
+
setCategory(category) {
|
|
34
|
+
this.data.category = category;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sets the property ID
|
|
39
|
+
*/
|
|
40
|
+
setPropertyId(propertyId) {
|
|
41
|
+
if (!propertyId || propertyId.trim() === "") {
|
|
42
|
+
throw new Error("Property ID is required and cannot be empty");
|
|
43
|
+
}
|
|
44
|
+
this.data.propertyId = propertyId;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sets the issue title
|
|
49
|
+
*/
|
|
50
|
+
setTitle(title) {
|
|
51
|
+
if (!title || title.trim() === "") {
|
|
52
|
+
throw new Error("Title is required and cannot be empty");
|
|
53
|
+
}
|
|
54
|
+
this.data.title = title.trim();
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets the issue description
|
|
59
|
+
*/
|
|
60
|
+
setDescription(description) {
|
|
61
|
+
if (!description || description.trim() === "") {
|
|
62
|
+
throw new Error("Description is required and cannot be empty");
|
|
63
|
+
}
|
|
64
|
+
this.data.description = description.trim();
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Sets the entity ID (optional)
|
|
69
|
+
*/
|
|
70
|
+
setEntityId(entityId) {
|
|
71
|
+
if (entityId !== undefined) {
|
|
72
|
+
this.data.entityId = entityId.trim() || undefined;
|
|
73
|
+
}
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sets the entity type
|
|
78
|
+
*/
|
|
79
|
+
setEntityType(entityType) {
|
|
80
|
+
this.data.entityType = entityType;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sets the issue priority (optional, defaults to MEDIUM)
|
|
85
|
+
*/
|
|
86
|
+
setPriority(priority) {
|
|
87
|
+
if (priority !== undefined) {
|
|
88
|
+
this.data.priority = priority;
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sets the user assigned to the issue (optional)
|
|
94
|
+
*/
|
|
95
|
+
setAssignedTo(assignedTo) {
|
|
96
|
+
if (assignedTo !== undefined) {
|
|
97
|
+
this.data.assignedTo = assignedTo.trim() || undefined;
|
|
98
|
+
}
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Sets the user who created the issue (required)
|
|
103
|
+
*/
|
|
104
|
+
setCreatedBy(createdBy) {
|
|
105
|
+
if (!createdBy || createdBy.trim() === "") {
|
|
106
|
+
throw new Error("Created by user is required and cannot be empty");
|
|
107
|
+
}
|
|
108
|
+
this.data.createdBy = createdBy.trim();
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Sets the due date (optional)
|
|
113
|
+
*/
|
|
114
|
+
setDueDate(dueDate) {
|
|
115
|
+
if (dueDate !== undefined) {
|
|
116
|
+
this.data.dueDate = dueDate;
|
|
117
|
+
}
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Validates that all required fields are present
|
|
122
|
+
*/
|
|
123
|
+
validate() {
|
|
124
|
+
const requiredFields = ["category", "propertyId", "title", "description", "entityType", "createdBy"];
|
|
125
|
+
const missingFields = requiredFields.filter(field => !this.data[field]);
|
|
126
|
+
if (missingFields.length > 0) {
|
|
127
|
+
throw new Error(`Missing required fields: ${missingFields.join(", ")}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Builds and returns the CreateIssueData object
|
|
132
|
+
* @throws Error if required fields are missing
|
|
133
|
+
*/
|
|
134
|
+
build() {
|
|
135
|
+
this.validate();
|
|
136
|
+
// Set default priority if not provided
|
|
137
|
+
if (!this.data.priority) {
|
|
138
|
+
this.data.priority = issue_types_1.IssuePriority.MEDIUM;
|
|
139
|
+
}
|
|
140
|
+
return this.data;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Resets the builder to its initial state
|
|
144
|
+
*/
|
|
145
|
+
reset() {
|
|
146
|
+
this.data = {};
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Creates a new builder instance with predefined values for common issue types
|
|
151
|
+
*/
|
|
152
|
+
static createReadinessIssue() {
|
|
153
|
+
return new IssueBuilder()
|
|
154
|
+
.setCategory(issue_types_1.IssuesCategory.READINESS)
|
|
155
|
+
.setPriority(issue_types_1.IssuePriority.MEDIUM);
|
|
156
|
+
}
|
|
157
|
+
static createOperationsIssue() {
|
|
158
|
+
return new IssueBuilder()
|
|
159
|
+
.setCategory(issue_types_1.IssuesCategory.OPERATIONS)
|
|
160
|
+
.setPriority(issue_types_1.IssuePriority.HIGH);
|
|
161
|
+
}
|
|
162
|
+
static createSecurityIssue() {
|
|
163
|
+
return new IssueBuilder()
|
|
164
|
+
.setCategory(issue_types_1.IssuesCategory.SECURITY)
|
|
165
|
+
.setPriority(issue_types_1.IssuePriority.CRITICAL);
|
|
166
|
+
}
|
|
167
|
+
static createEnergyIssue() {
|
|
168
|
+
return new IssueBuilder()
|
|
169
|
+
.setCategory(issue_types_1.IssuesCategory.ENERGY)
|
|
170
|
+
.setPriority(issue_types_1.IssuePriority.LOW);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Creates a device-specific issue builder
|
|
174
|
+
*/
|
|
175
|
+
static createDeviceIssue(deviceId, propertyId) {
|
|
176
|
+
return new IssueBuilder()
|
|
177
|
+
.setEntityType(issue_types_1.EntityType.DEVICE)
|
|
178
|
+
.setEntityId(deviceId)
|
|
179
|
+
.setPropertyId(propertyId);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates a hub-specific issue builder
|
|
183
|
+
*/
|
|
184
|
+
static createHubIssue(hubId, propertyId) {
|
|
185
|
+
return new IssueBuilder()
|
|
186
|
+
.setEntityType(issue_types_1.EntityType.HUB)
|
|
187
|
+
.setEntityId(hubId)
|
|
188
|
+
.setPropertyId(propertyId);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Creates a user-specific issue builder
|
|
192
|
+
*/
|
|
193
|
+
static createUserIssue(userId, propertyId) {
|
|
194
|
+
return new IssueBuilder()
|
|
195
|
+
.setEntityType(issue_types_1.EntityType.USER)
|
|
196
|
+
.setEntityId(userId)
|
|
197
|
+
.setPropertyId(propertyId);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Creates a property-specific issue builder
|
|
201
|
+
*/
|
|
202
|
+
static createPropertyIssue(propertyId) {
|
|
203
|
+
return new IssueBuilder()
|
|
204
|
+
.setEntityType(issue_types_1.EntityType.PROPERTY)
|
|
205
|
+
.setEntityId(propertyId)
|
|
206
|
+
.setPropertyId(propertyId);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Creates a maintenance issue builder
|
|
210
|
+
*/
|
|
211
|
+
static createMaintenanceIssue(propertyId, entityId, entityType) {
|
|
212
|
+
const builder = new IssueBuilder()
|
|
213
|
+
.setCategory(issue_types_1.IssuesCategory.READINESS)
|
|
214
|
+
.setPropertyId(propertyId)
|
|
215
|
+
.setPriority(issue_types_1.IssuePriority.MEDIUM);
|
|
216
|
+
if (entityId)
|
|
217
|
+
builder.setEntityId(entityId);
|
|
218
|
+
if (entityType)
|
|
219
|
+
builder.setEntityType(entityType);
|
|
220
|
+
return builder;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Creates an urgent issue builder
|
|
224
|
+
*/
|
|
225
|
+
static createUrgentIssue(propertyId, entityId, entityType) {
|
|
226
|
+
const builder = new IssueBuilder()
|
|
227
|
+
.setCategory(issue_types_1.IssuesCategory.OPERATIONS)
|
|
228
|
+
.setPropertyId(propertyId)
|
|
229
|
+
.setPriority(issue_types_1.IssuePriority.URGENT);
|
|
230
|
+
if (entityId)
|
|
231
|
+
builder.setEntityId(entityId);
|
|
232
|
+
if (entityType)
|
|
233
|
+
builder.setEntityType(entityType);
|
|
234
|
+
return builder;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.IssueBuilder = IssueBuilder;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class EventHandler {
|
|
2
|
+
private readonly source;
|
|
3
|
+
constructor();
|
|
4
|
+
onDeviceCreate(body: any): Promise<void>;
|
|
5
|
+
onDeviceUpdate(deviceId: string, body: any): Promise<void>;
|
|
6
|
+
onDeviceDelete(deviceId: string): Promise<void>;
|
|
7
|
+
onStateChange(deviceId: string, state: any): Promise<void>;
|
|
8
|
+
onStatusChange(deviceId: string, status: any): Promise<void>;
|
|
9
|
+
onBatteryLevelChange(deviceId: string, batteryLevel: number): Promise<void>;
|
|
10
|
+
onDeviceMetaChange(deviceId: string, metaData: Record<string, any>): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const DT_EVENT_TYPES: {
|
|
2
|
+
DEVICE: {
|
|
3
|
+
DEVICE: {
|
|
4
|
+
CREATED: string;
|
|
5
|
+
UPDATED: string;
|
|
6
|
+
DELETED: string;
|
|
7
|
+
};
|
|
8
|
+
STATE: {
|
|
9
|
+
SET: string;
|
|
10
|
+
UNKNOWN: string;
|
|
11
|
+
UPDATED: string;
|
|
12
|
+
CHANGED: string;
|
|
13
|
+
};
|
|
14
|
+
STATUS: {
|
|
15
|
+
SET: string;
|
|
16
|
+
ONLINE: string;
|
|
17
|
+
OFFLINE: string;
|
|
18
|
+
UNKNOWN: string;
|
|
19
|
+
UPDATED: string;
|
|
20
|
+
CHANGED: string;
|
|
21
|
+
};
|
|
22
|
+
BATTERY: {
|
|
23
|
+
SET: string;
|
|
24
|
+
UNKNOWN: string;
|
|
25
|
+
LOW: string;
|
|
26
|
+
CRITICAL: string;
|
|
27
|
+
UPDATED: string;
|
|
28
|
+
CHANGED: string;
|
|
29
|
+
};
|
|
30
|
+
META_DATA: {
|
|
31
|
+
SET: string;
|
|
32
|
+
UPDATED: string;
|
|
33
|
+
CHANGED: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
CONNECTION: {
|
|
37
|
+
CONNECTION: {
|
|
38
|
+
CREATED: string;
|
|
39
|
+
UPDATED: string;
|
|
40
|
+
DELETED: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
PROPERTY: {
|
|
44
|
+
PROPERTY: {
|
|
45
|
+
CREATED: string;
|
|
46
|
+
UPDATED: string;
|
|
47
|
+
DELETED: string;
|
|
48
|
+
};
|
|
49
|
+
PREFERENCES: {
|
|
50
|
+
UPDATED: string;
|
|
51
|
+
CREATED: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class EventHandler {
|
|
2
|
+
private readonly source;
|
|
3
|
+
constructor();
|
|
4
|
+
onStateChange(deviceId: string, state: any): Promise<void>;
|
|
5
|
+
onStatusChange(deviceId: string, status: any): Promise<void>;
|
|
6
|
+
onBatteryLevelChange(deviceId: string, batteryLevel: number): Promise<void>;
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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, };
|
|
@@ -0,0 +1,28 @@
|
|
|
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, };
|