dt-common-device 13.0.25 → 13.0.27
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/config/config.d.ts +1 -0
- package/dist/config/config.js +9 -0
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/constants.js +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/db/db.d.ts +1 -0
- package/dist/db/db.js +11 -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/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/index.d.ts +1 -0
- package/dist/index.js +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/dist/webhooks/index.d.ts +2 -0
- package/dist/webhooks/index.js +18 -0
- package/dist/webhooks/interface/webhook.interface.d.ts +32 -0
- package/dist/webhooks/interface/webhook.interface.js +2 -0
- package/dist/webhooks/webhook.repository.d.ts +6 -0
- package/dist/webhooks/webhook.repository.js +74 -0
- package/dist/webhooks/webhook.service.d.ts +11 -0
- package/dist/webhooks/webhook.service.js +141 -0
- package/package.json +2 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBasicIssue = createBasicIssue;
|
|
4
|
+
exports.createDeviceIssue = createDeviceIssue;
|
|
5
|
+
exports.createSecurityIssue = createSecurityIssue;
|
|
6
|
+
exports.createEnergyIssue = createEnergyIssue;
|
|
7
|
+
exports.createHubIssue = createHubIssue;
|
|
8
|
+
exports.createUserIssue = createUserIssue;
|
|
9
|
+
exports.createPropertyIssue = createPropertyIssue;
|
|
10
|
+
exports.createMaintenanceIssue = createMaintenanceIssue;
|
|
11
|
+
exports.createUrgentIssue = createUrgentIssue;
|
|
12
|
+
exports.createMultipleIssues = createMultipleIssues;
|
|
13
|
+
exports.createIssueWithDueDate = createIssueWithDueDate;
|
|
14
|
+
exports.createUnassignedIssue = createUnassignedIssue;
|
|
15
|
+
const IssueBuilder_1 = require("./IssueBuilder");
|
|
16
|
+
const issue_types_1 = require("../../../types/issue.types");
|
|
17
|
+
/**
|
|
18
|
+
* Example usage of IssueBuilder
|
|
19
|
+
* This file demonstrates various ways to use the IssueBuilder pattern
|
|
20
|
+
*/
|
|
21
|
+
// Example 1: Basic issue creation
|
|
22
|
+
function createBasicIssue() {
|
|
23
|
+
const issueData = new IssueBuilder_1.IssueBuilder()
|
|
24
|
+
.setCategory(issue_types_1.IssuesCategory.OPERATIONS)
|
|
25
|
+
.setPropertyId("prop123")
|
|
26
|
+
.setTitle("Device Maintenance Required")
|
|
27
|
+
.setDescription("Device requires scheduled maintenance")
|
|
28
|
+
.setEntityId("device456")
|
|
29
|
+
.setEntityType(issue_types_1.EntityType.DEVICE)
|
|
30
|
+
.setPriority(issue_types_1.IssuePriority.HIGH)
|
|
31
|
+
.setAssignedTo("tech789")
|
|
32
|
+
.setCreatedBy("user123")
|
|
33
|
+
.setDueDate(new Date("2024-01-15"))
|
|
34
|
+
.build();
|
|
35
|
+
return issueData;
|
|
36
|
+
}
|
|
37
|
+
// Example 2: Using static factory methods
|
|
38
|
+
function createDeviceIssue() {
|
|
39
|
+
const issueData = IssueBuilder_1.IssueBuilder.createDeviceIssue("device123", "prop456")
|
|
40
|
+
.setCategory(issue_types_1.IssuesCategory.READINESS)
|
|
41
|
+
.setTitle("Device Firmware Update")
|
|
42
|
+
.setDescription("Device firmware update is available")
|
|
43
|
+
.setPriority(issue_types_1.IssuePriority.MEDIUM)
|
|
44
|
+
.setAssignedTo("admin")
|
|
45
|
+
.setCreatedBy("system")
|
|
46
|
+
.setDueDate(new Date("2024-01-20"))
|
|
47
|
+
.build();
|
|
48
|
+
return issueData;
|
|
49
|
+
}
|
|
50
|
+
// Example 3: Using predefined issue types
|
|
51
|
+
function createSecurityIssue() {
|
|
52
|
+
const issueData = IssueBuilder_1.IssueBuilder.createSecurityIssue()
|
|
53
|
+
.setPropertyId("prop789")
|
|
54
|
+
.setTitle("Security Breach Detected")
|
|
55
|
+
.setDescription("Unauthorized access attempt detected")
|
|
56
|
+
.setEntityId("user123")
|
|
57
|
+
.setEntityType(issue_types_1.EntityType.USER)
|
|
58
|
+
.setAssignedTo("security-team")
|
|
59
|
+
.setCreatedBy("security-system")
|
|
60
|
+
.setDueDate(new Date("2024-01-10"))
|
|
61
|
+
.build();
|
|
62
|
+
return issueData;
|
|
63
|
+
}
|
|
64
|
+
// Example 4: Creating energy issue
|
|
65
|
+
function createEnergyIssue() {
|
|
66
|
+
const issueData = IssueBuilder_1.IssueBuilder.createEnergyIssue()
|
|
67
|
+
.setPropertyId("prop101")
|
|
68
|
+
.setTitle("High Energy Consumption")
|
|
69
|
+
.setDescription("Energy usage is 20% above normal levels")
|
|
70
|
+
.setEntityId("zone456")
|
|
71
|
+
.setEntityType(issue_types_1.EntityType.COLLECTION)
|
|
72
|
+
.setAssignedTo("energy-manager")
|
|
73
|
+
.setCreatedBy("energy-monitor")
|
|
74
|
+
.setDueDate(new Date("2024-01-25"))
|
|
75
|
+
.build();
|
|
76
|
+
return issueData;
|
|
77
|
+
}
|
|
78
|
+
// Example 5: Creating hub issue
|
|
79
|
+
function createHubIssue() {
|
|
80
|
+
const issueData = IssueBuilder_1.IssueBuilder.createHubIssue("hub789", "prop202")
|
|
81
|
+
.setCategory(issue_types_1.IssuesCategory.OPERATIONS)
|
|
82
|
+
.setTitle("Hub Connection Lost")
|
|
83
|
+
.setDescription("Hub has lost connection to the network")
|
|
84
|
+
.setPriority(issue_types_1.IssuePriority.CRITICAL)
|
|
85
|
+
.setAssignedTo("network-admin")
|
|
86
|
+
.setCreatedBy("network-monitor")
|
|
87
|
+
.setDueDate(new Date("2024-01-05"))
|
|
88
|
+
.build();
|
|
89
|
+
return issueData;
|
|
90
|
+
}
|
|
91
|
+
// Example 6: Creating user-specific issue
|
|
92
|
+
function createUserIssue() {
|
|
93
|
+
const issueData = IssueBuilder_1.IssueBuilder.createUserIssue("user456", "prop303")
|
|
94
|
+
.setCategory(issue_types_1.IssuesCategory.SECURITY)
|
|
95
|
+
.setTitle("User Access Review Required")
|
|
96
|
+
.setDescription("User access permissions need review")
|
|
97
|
+
.setPriority(issue_types_1.IssuePriority.MEDIUM)
|
|
98
|
+
.setAssignedTo("hr-admin")
|
|
99
|
+
.setCreatedBy("access-control")
|
|
100
|
+
.setDueDate(new Date("2024-01-30"))
|
|
101
|
+
.build();
|
|
102
|
+
return issueData;
|
|
103
|
+
}
|
|
104
|
+
// Example 7: Creating property-specific issue
|
|
105
|
+
function createPropertyIssue() {
|
|
106
|
+
const issueData = IssueBuilder_1.IssueBuilder.createPropertyIssue("prop404")
|
|
107
|
+
.setCategory(issue_types_1.IssuesCategory.READINESS)
|
|
108
|
+
.setTitle("Property Maintenance Schedule")
|
|
109
|
+
.setDescription("Annual property maintenance is due")
|
|
110
|
+
.setPriority(issue_types_1.IssuePriority.LOW)
|
|
111
|
+
.setAssignedTo("property-manager")
|
|
112
|
+
.setCreatedBy("maintenance-system")
|
|
113
|
+
.setDueDate(new Date("2024-02-15"))
|
|
114
|
+
.build();
|
|
115
|
+
return issueData;
|
|
116
|
+
}
|
|
117
|
+
// Example 8: Creating maintenance issue
|
|
118
|
+
function createMaintenanceIssue() {
|
|
119
|
+
const issueData = IssueBuilder_1.IssueBuilder.createMaintenanceIssue("prop505", "device789", issue_types_1.EntityType.DEVICE)
|
|
120
|
+
.setTitle("Scheduled Device Maintenance")
|
|
121
|
+
.setDescription("Regular maintenance is scheduled for this device")
|
|
122
|
+
.setAssignedTo("technician")
|
|
123
|
+
.setCreatedBy("maintenance-scheduler")
|
|
124
|
+
.setDueDate(new Date("2024-01-12"))
|
|
125
|
+
.build();
|
|
126
|
+
return issueData;
|
|
127
|
+
}
|
|
128
|
+
// Example 9: Creating urgent issue
|
|
129
|
+
function createUrgentIssue() {
|
|
130
|
+
const issueData = IssueBuilder_1.IssueBuilder.createUrgentIssue("prop606", "hub123", issue_types_1.EntityType.HUB)
|
|
131
|
+
.setTitle("Critical Hub Failure")
|
|
132
|
+
.setDescription("Hub is experiencing critical failures")
|
|
133
|
+
.setAssignedTo("emergency-tech")
|
|
134
|
+
.setCreatedBy("monitoring-system")
|
|
135
|
+
.setDueDate(new Date("2024-01-03"))
|
|
136
|
+
.build();
|
|
137
|
+
return issueData;
|
|
138
|
+
}
|
|
139
|
+
// Example 10: Reusing builder instance
|
|
140
|
+
function createMultipleIssues() {
|
|
141
|
+
const builder = new IssueBuilder_1.IssueBuilder()
|
|
142
|
+
.setPropertyId("prop707")
|
|
143
|
+
.setCreatedBy("batch-processor");
|
|
144
|
+
const issue1 = builder
|
|
145
|
+
.setCategory(issue_types_1.IssuesCategory.OPERATIONS)
|
|
146
|
+
.setTitle("Device Temperature High")
|
|
147
|
+
.setDescription("Device temperature exceeds normal operating range")
|
|
148
|
+
.setEntityId("device789")
|
|
149
|
+
.setEntityType(issue_types_1.EntityType.DEVICE)
|
|
150
|
+
.setPriority(issue_types_1.IssuePriority.HIGH)
|
|
151
|
+
.setAssignedTo("tech-support")
|
|
152
|
+
.build();
|
|
153
|
+
const issue2 = builder
|
|
154
|
+
.reset()
|
|
155
|
+
.setPropertyId("prop707")
|
|
156
|
+
.setCategory(issue_types_1.IssuesCategory.ENERGY)
|
|
157
|
+
.setTitle("Low Battery Warning")
|
|
158
|
+
.setDescription("Device battery level is below 20%")
|
|
159
|
+
.setEntityId("device789")
|
|
160
|
+
.setEntityType(issue_types_1.EntityType.DEVICE)
|
|
161
|
+
.setPriority(issue_types_1.IssuePriority.MEDIUM)
|
|
162
|
+
.setAssignedTo("maintenance-team")
|
|
163
|
+
.setCreatedBy("batch-processor")
|
|
164
|
+
.build();
|
|
165
|
+
return [issue1, issue2];
|
|
166
|
+
}
|
|
167
|
+
// Example 11: Creating issue with due date calculation
|
|
168
|
+
function createIssueWithDueDate() {
|
|
169
|
+
const dueDate = new Date();
|
|
170
|
+
dueDate.setDate(dueDate.getDate() + 7); // Due in 7 days
|
|
171
|
+
const issueData = new IssueBuilder_1.IssueBuilder()
|
|
172
|
+
.setCategory(issue_types_1.IssuesCategory.READINESS)
|
|
173
|
+
.setPropertyId("prop808")
|
|
174
|
+
.setTitle("System Update Required")
|
|
175
|
+
.setDescription("System requires critical security update")
|
|
176
|
+
.setEntityType(issue_types_1.EntityType.PROPERTY)
|
|
177
|
+
.setPriority(issue_types_1.IssuePriority.HIGH)
|
|
178
|
+
.setAssignedTo("system-admin")
|
|
179
|
+
.setCreatedBy("update-manager")
|
|
180
|
+
.setDueDate(dueDate)
|
|
181
|
+
.build();
|
|
182
|
+
return issueData;
|
|
183
|
+
}
|
|
184
|
+
// Example 12: Creating issue without assignment
|
|
185
|
+
function createUnassignedIssue() {
|
|
186
|
+
const issueData = new IssueBuilder_1.IssueBuilder()
|
|
187
|
+
.setCategory(issue_types_1.IssuesCategory.OTHER)
|
|
188
|
+
.setPropertyId("prop909")
|
|
189
|
+
.setTitle("General Inquiry")
|
|
190
|
+
.setDescription("General inquiry about system functionality")
|
|
191
|
+
.setEntityType(issue_types_1.EntityType.PROPERTY)
|
|
192
|
+
.setPriority(issue_types_1.IssuePriority.LOW)
|
|
193
|
+
.setCreatedBy("user-inquiry")
|
|
194
|
+
.build();
|
|
195
|
+
return issueData;
|
|
196
|
+
}
|
|
@@ -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
|
+
}
|