dt-common-device 4.0.8 → 5.0.0

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.
Files changed (232) hide show
  1. package/dist/alerts/Alert.service.d.ts +1 -1
  2. package/dist/audit/AuditUtils.d.ts +26 -2
  3. package/dist/audit/AuditUtils.js +255 -32
  4. package/dist/audit/IAuditProperties.d.ts +32 -0
  5. package/dist/audit/IAuditProperties.js +13 -0
  6. package/dist/audit/PushAudit.d.ts +5 -0
  7. package/dist/audit/PushAudit.js +16 -0
  8. package/dist/audit/index.d.ts +2 -0
  9. package/dist/audit/index.js +18 -0
  10. package/dist/config/config.d.ts +10 -3
  11. package/dist/config/config.js +120 -47
  12. package/dist/config/config.types.d.ts +1 -8
  13. package/dist/config/constants.d.ts +49 -0
  14. package/dist/config/constants.js +64 -0
  15. package/dist/db/db.d.ts +2 -0
  16. package/dist/db/db.js +23 -1
  17. package/dist/entities/accessGroup/AccessGroup.repository.d.ts +5 -0
  18. package/dist/{device/local/repository/Connection.repository.js → entities/accessGroup/AccessGroup.repository.js} +15 -35
  19. package/dist/entities/accessGroup/AccessGroup.service.d.ts +5 -0
  20. package/dist/entities/accessGroup/AccessGroup.service.js +105 -0
  21. package/dist/entities/accessGroup/IAccessGroup.d.ts +14 -0
  22. package/dist/entities/accessGroup/index.d.ts +2 -0
  23. package/dist/entities/accessGroup/index.js +18 -0
  24. package/dist/{admin → entities/admin}/Admin.repository.js +4 -4
  25. package/dist/{connection → entities/connection}/Connection.repository.js +1 -1
  26. package/dist/{device → entities/device}/local/repository/Device.repository.js +3 -3
  27. package/dist/{device → entities/device}/local/repository/Hub.repository.js +3 -3
  28. package/dist/{device → entities/device}/local/repository/Schedule.repository.js +2 -2
  29. package/dist/{device → entities/device}/local/services/Device.service.d.ts +9 -9
  30. package/dist/{device → entities/device}/local/services/Device.service.js +4 -4
  31. package/dist/entities/guest/Guest.repository.d.ts +6 -0
  32. package/dist/entities/guest/Guest.repository.js +74 -0
  33. package/dist/entities/guest/Guest.service.d.ts +6 -0
  34. package/dist/entities/guest/Guest.service.js +104 -0
  35. package/dist/entities/guest/IGuest.d.ts +12 -0
  36. package/dist/entities/guest/index.d.ts +2 -0
  37. package/dist/entities/guest/index.js +18 -0
  38. package/dist/{property → entities/property}/Property.repository.js +1 -1
  39. package/dist/entities/schedules/ISchedule.d.ts +14 -0
  40. package/dist/entities/schedules/Schedule.repository.d.ts +6 -0
  41. package/dist/entities/schedules/Schedule.repository.js +74 -0
  42. package/dist/entities/schedules/Schedule.service.d.ts +6 -0
  43. package/dist/entities/schedules/Schedule.service.js +104 -0
  44. package/dist/entities/schedules/index.d.ts +2 -0
  45. package/dist/entities/schedules/index.js +18 -0
  46. package/dist/entities/user/IUser.d.ts +15 -0
  47. package/dist/entities/user/User.repository.d.ts +5 -0
  48. package/dist/entities/user/User.repository.js +68 -0
  49. package/dist/entities/user/User.service.d.ts +6 -0
  50. package/dist/entities/user/User.service.js +103 -0
  51. package/dist/entities/zone/IZone.d.ts +10 -0
  52. package/dist/entities/zone/Zone.repository.d.ts +6 -0
  53. package/dist/{device/local/repository/Property.repository.js → entities/zone/Zone.repository.js} +14 -32
  54. package/dist/entities/zone/Zone.service.d.ts +6 -0
  55. package/dist/entities/zone/Zone.service.js +104 -0
  56. package/dist/entities/zone/index.d.ts +2 -0
  57. package/dist/entities/zone/index.js +18 -0
  58. package/dist/events/BaseEventHandler.d.ts +3 -3
  59. package/dist/events/BaseEventHandler.js +1 -1
  60. package/dist/events/DeviceEventHandler.d.ts +1 -1
  61. package/dist/events/DeviceEventHandler.js +4 -3
  62. package/dist/events/EventHandler.d.ts +10 -9
  63. package/dist/events/EventHandler.js +50 -9
  64. package/dist/events/InternalEventSubscription.js +1 -1
  65. package/dist/index.d.ts +9 -8
  66. package/dist/index.js +10 -8
  67. package/dist/issues/Issue.service.d.ts +1 -1
  68. package/dist/microservice/MicroServiceFactory.d.ts +1 -1
  69. package/dist/microservice/MicroServiceFactory.js +1 -1
  70. package/dist/utils/http.utils.d.ts +1 -2
  71. package/dist/utils/http.utils.js +5 -28
  72. package/package.json +1 -1
  73. package/dist/audit/AuditProperties.d.ts +0 -16
  74. package/dist/device/cloud/entities/CloudConnection.d.ts +0 -6
  75. package/dist/device/cloud/entities/CloudConnection.js +0 -6
  76. package/dist/device/cloud/interface.d.ts +0 -101
  77. package/dist/device/cloud/interface.js +0 -3
  78. package/dist/device/cloud/interfaces/ICloudConnection.d.ts +0 -5
  79. package/dist/device/cloud/interfaces/IConnectionService.d.ts +0 -7
  80. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +0 -7
  81. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +0 -3
  82. package/dist/device/cloud/interfaces/IDeviceService.d.ts +0 -8
  83. package/dist/device/cloud/interfaces/IDevicesService.d.ts +0 -9
  84. package/dist/device/cloud/interfaces/IHubService.d.ts +0 -5
  85. package/dist/device/cloud/interfaces/IHubService.js +0 -2
  86. package/dist/device/cloud/services/CloudDevice.service.d.ts +0 -5
  87. package/dist/device/cloud/services/CloudDevice.service.js +0 -9
  88. package/dist/device/cloud/services/Connection.service.d.ts +0 -8
  89. package/dist/device/cloud/services/Connection.service.js +0 -6
  90. package/dist/device/cloud/services/Device.service.d.ts +0 -39
  91. package/dist/device/cloud/services/Device.service.js +0 -9
  92. package/dist/device/cloud/services/DeviceCloudService.d.ts +0 -42
  93. package/dist/device/cloud/services/DeviceCloudService.js +0 -59
  94. package/dist/device/cloud/services/DeviceHub.service.d.ts +0 -3
  95. package/dist/device/cloud/services/DeviceHub.service.js +0 -6
  96. package/dist/device/cloud/services/Hub.service.d.ts +0 -25
  97. package/dist/device/cloud/services/Hub.service.js +0 -9
  98. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +0 -38
  99. package/dist/device/cloud/services/SmartThingsDeviceService.js +0 -52
  100. package/dist/device/cloud/services/index.d.ts +0 -2
  101. package/dist/device/cloud/services/index.js +0 -18
  102. package/dist/device/cloud/types.d.ts +0 -52
  103. package/dist/device/cloud/types.js +0 -15
  104. package/dist/device/index.d.ts +0 -4
  105. package/dist/device/index.js +0 -20
  106. package/dist/device/local/entities/AlertBuilder.d.ts +0 -87
  107. package/dist/device/local/entities/AlertBuilder.example.d.ts +0 -11
  108. package/dist/device/local/entities/AlertBuilder.example.js +0 -117
  109. package/dist/device/local/entities/AlertBuilder.js +0 -179
  110. package/dist/device/local/entities/IssueBuilder.d.ts +0 -109
  111. package/dist/device/local/entities/IssueBuilder.example.d.ts +0 -16
  112. package/dist/device/local/entities/IssueBuilder.example.js +0 -196
  113. package/dist/device/local/entities/IssueBuilder.js +0 -237
  114. package/dist/device/local/entities/index.d.ts +0 -2
  115. package/dist/device/local/entities/index.js +0 -7
  116. package/dist/device/local/events/EventHandler.d.ts +0 -11
  117. package/dist/device/local/events/EventHandler.js +0 -86
  118. package/dist/device/local/events/Events.d.ts +0 -54
  119. package/dist/device/local/events/Events.js +0 -57
  120. package/dist/device/local/events/index.d.ts +0 -2
  121. package/dist/device/local/events/index.js +0 -7
  122. package/dist/device/local/handler/EventHandler.d.ts +0 -7
  123. package/dist/device/local/handler/EventHandler.js +0 -44
  124. package/dist/device/local/interface.d.ts +0 -0
  125. package/dist/device/local/interface.js +0 -1
  126. package/dist/device/local/interfaces/IConnection.d.ts +0 -26
  127. package/dist/device/local/interfaces/IConnection.js +0 -14
  128. package/dist/device/local/interfaces/IHub.d.ts +0 -46
  129. package/dist/device/local/interfaces/IHub.js +0 -2
  130. package/dist/device/local/models/Alert.model.d.ts +0 -28
  131. package/dist/device/local/models/Alert.model.js +0 -222
  132. package/dist/device/local/models/Issue.model.d.ts +0 -28
  133. package/dist/device/local/models/Issue.model.js +0 -260
  134. package/dist/device/local/repository/Alert.repository.d.ts +0 -106
  135. package/dist/device/local/repository/Alert.repository.js +0 -374
  136. package/dist/device/local/repository/Connection.repository.d.ts +0 -8
  137. package/dist/device/local/repository/Issue.repository.d.ts +0 -113
  138. package/dist/device/local/repository/Issue.repository.js +0 -401
  139. package/dist/device/local/repository/Property.repository.d.ts +0 -8
  140. package/dist/device/local/services/Alert.service.d.ts +0 -137
  141. package/dist/device/local/services/Alert.service.js +0 -475
  142. package/dist/device/local/services/AlertService.example.d.ts +0 -55
  143. package/dist/device/local/services/AlertService.example.js +0 -148
  144. package/dist/device/local/services/Connection.service.d.ts +0 -8
  145. package/dist/device/local/services/Connection.service.js +0 -32
  146. package/dist/device/local/services/DeviceHub.service.d.ts +0 -11
  147. package/dist/device/local/services/DeviceHub.service.js +0 -40
  148. package/dist/device/local/services/Issue.service.d.ts +0 -168
  149. package/dist/device/local/services/Issue.service.js +0 -642
  150. package/dist/device/local/services/IssueService.example.d.ts +0 -68
  151. package/dist/device/local/services/IssueService.example.js +0 -177
  152. package/dist/device/local/services/Property.service.d.ts +0 -8
  153. package/dist/device/local/services/Property.service.js +0 -36
  154. package/dist/property/IProperty.d.ts +0 -29
  155. package/dist/property/IProperty.js +0 -2
  156. package/dist/queue/interfaces/IHttpRequestJob.d.ts +0 -9
  157. package/dist/queue/interfaces/IHttpRequestJob.js +0 -2
  158. package/dist/types/alert.types.d.ts +0 -57
  159. package/dist/types/alert.types.js +0 -22
  160. package/dist/types/config.types.d.ts +0 -19
  161. package/dist/types/config.types.js +0 -2
  162. package/dist/types/index.d.ts +0 -3
  163. package/dist/types/index.js +0 -19
  164. package/dist/types/issue.types.d.ts +0 -90
  165. package/dist/types/issue.types.js +0 -40
  166. package/dist/utils/http-utils.d.ts +0 -13
  167. package/dist/utils/http-utils.js +0 -117
  168. /package/dist/{audit/AuditProperties.js → entities/accessGroup/IAccessGroup.js} +0 -0
  169. /package/dist/{admin → entities/admin}/Admin.repository.d.ts +0 -0
  170. /package/dist/{admin → entities/admin}/Admin.service.d.ts +0 -0
  171. /package/dist/{admin → entities/admin}/Admin.service.js +0 -0
  172. /package/dist/{admin → entities/admin}/index.d.ts +0 -0
  173. /package/dist/{admin → entities/admin}/index.js +0 -0
  174. /package/dist/{connection → entities/connection}/Connection.repository.d.ts +0 -0
  175. /package/dist/{connection → entities/connection}/Connection.service.d.ts +0 -0
  176. /package/dist/{connection → entities/connection}/Connection.service.js +0 -0
  177. /package/dist/{connection → entities/connection}/IConnection.d.ts +0 -0
  178. /package/dist/{connection → entities/connection}/IConnection.js +0 -0
  179. /package/dist/{connection → entities/connection}/index.d.ts +0 -0
  180. /package/dist/{connection → entities/connection}/index.js +0 -0
  181. /package/dist/{device → entities/device}/cloud/entities/CloudDevice.d.ts +0 -0
  182. /package/dist/{device → entities/device}/cloud/entities/CloudDevice.js +0 -0
  183. /package/dist/{device → entities/device}/cloud/entities/CloudDeviceService.d.ts +0 -0
  184. /package/dist/{device → entities/device}/cloud/entities/CloudDeviceService.js +0 -0
  185. /package/dist/{device → entities/device}/cloud/entities/DeviceFactory.d.ts +0 -0
  186. /package/dist/{device → entities/device}/cloud/entities/DeviceFactory.js +0 -0
  187. /package/dist/{device → entities/device}/cloud/entities/index.d.ts +0 -0
  188. /package/dist/{device → entities/device}/cloud/entities/index.js +0 -0
  189. /package/dist/{device → entities/device}/cloud/interfaces/ICloudDevice.d.ts +0 -0
  190. /package/dist/{device → entities/device}/cloud/interfaces/ICloudDevice.js +0 -0
  191. /package/dist/{device → entities/device}/cloud/interfaces/ICloudDeviceService.d.ts +0 -0
  192. /package/dist/{device → entities/device}/cloud/interfaces/ICloudDeviceService.js +0 -0
  193. /package/dist/{device → entities/device}/cloud/interfaces/IDeviceFactory.d.ts +0 -0
  194. /package/dist/{device → entities/device}/cloud/interfaces/IDeviceFactory.js +0 -0
  195. /package/dist/{device → entities/device}/cloud/interfaces/IRawDataTransformer.d.ts +0 -0
  196. /package/dist/{device → entities/device}/cloud/interfaces/IRawDataTransformer.js +0 -0
  197. /package/dist/{device → entities/device}/cloud/interfaces/IRawDevice.d.ts +0 -0
  198. /package/dist/{device → entities/device}/cloud/interfaces/IRawDevice.js +0 -0
  199. /package/dist/{device → entities/device}/cloud/interfaces/index.d.ts +0 -0
  200. /package/dist/{device → entities/device}/cloud/interfaces/index.js +0 -0
  201. /package/dist/{device → entities/device}/local/interfaces/IDevice.d.ts +0 -0
  202. /package/dist/{device → entities/device}/local/interfaces/IDevice.js +0 -0
  203. /package/dist/{device → entities/device}/local/interfaces/IDtDevice.d.ts +0 -0
  204. /package/dist/{device → entities/device}/local/interfaces/IDtDevice.js +0 -0
  205. /package/dist/{device → entities/device}/local/interfaces/ISchedule.d.ts +0 -0
  206. /package/dist/{device → entities/device}/local/interfaces/ISchedule.js +0 -0
  207. /package/dist/{device → entities/device}/local/interfaces/index.d.ts +0 -0
  208. /package/dist/{device → entities/device}/local/interfaces/index.js +0 -0
  209. /package/dist/{device → entities/device}/local/repository/Device.repository.d.ts +0 -0
  210. /package/dist/{device → entities/device}/local/repository/Hub.repository.d.ts +0 -0
  211. /package/dist/{device → entities/device}/local/repository/Schedule.repository.d.ts +0 -0
  212. /package/dist/{device → entities/device}/local/services/Hub.service.d.ts +0 -0
  213. /package/dist/{device → entities/device}/local/services/Hub.service.js +0 -0
  214. /package/dist/{device → entities/device}/local/services/Schedule.service.d.ts +0 -0
  215. /package/dist/{device → entities/device}/local/services/Schedule.service.js +0 -0
  216. /package/dist/{device → entities/device}/local/services/index.d.ts +0 -0
  217. /package/dist/{device → entities/device}/local/services/index.js +0 -0
  218. /package/dist/{device/cloud/interfaces/ICloudConnection.js → entities/guest/IGuest.js} +0 -0
  219. /package/dist/{pms → entities/pms}/IPms.d.ts +0 -0
  220. /package/dist/{pms → entities/pms}/IPms.js +0 -0
  221. /package/dist/{pms → entities/pms}/index.d.ts +0 -0
  222. /package/dist/{pms → entities/pms}/index.js +0 -0
  223. /package/dist/{device/local/interfaces → entities/property}/IProperty.d.ts +0 -0
  224. /package/dist/{device/local/interfaces → entities/property}/IProperty.js +0 -0
  225. /package/dist/{property → entities/property}/Property.repository.d.ts +0 -0
  226. /package/dist/{property → entities/property}/Property.service.d.ts +0 -0
  227. /package/dist/{property → entities/property}/Property.service.js +0 -0
  228. /package/dist/{property → entities/property}/index.d.ts +0 -0
  229. /package/dist/{property → entities/property}/index.js +0 -0
  230. /package/dist/{device/cloud/interfaces/IConnectionService.js → entities/schedules/ISchedule.js} +0 -0
  231. /package/dist/{device/cloud/interfaces/IDeviceService.js → entities/user/IUser.js} +0 -0
  232. /package/dist/{device/cloud/interfaces/IDevicesService.js → entities/zone/IZone.js} +0 -0
@@ -1,68 +0,0 @@
1
- import { IssueService } from "./Issue.service";
2
- /**
3
- * Example usage of the updated IssueService with IssueBuilder integration
4
- * This file demonstrates various ways to use the IssueService with the new IssueBuilder
5
- */
6
- export declare class IssueServiceExample {
7
- private readonly issueService;
8
- constructor(issueService: IssueService);
9
- /**
10
- * Example 1: Using the updated createIssue method with IssueBuilder
11
- */
12
- createIssueWithBuilder(): Promise<import("../../../types/issue.types").IssueDocument>;
13
- /**
14
- * Example 2: Using convenience methods for specific issue types
15
- */
16
- createSpecificIssues(): Promise<{
17
- readinessIssue: import("../../../types/issue.types").IssueDocument;
18
- operationsIssue: import("../../../types/issue.types").IssueDocument;
19
- securityIssue: import("../../../types/issue.types").IssueDocument;
20
- energyIssue: import("../../../types/issue.types").IssueDocument;
21
- }>;
22
- /**
23
- * Example 3: Using device-specific issue methods
24
- */
25
- createDeviceIssues(): Promise<{
26
- deviceIssue1: import("../../../types/issue.types").IssueDocument;
27
- deviceIssue2: import("../../../types/issue.types").IssueDocument;
28
- }>;
29
- /**
30
- * Example 4: Using hub-specific issue methods
31
- */
32
- createHubIssues(): Promise<{
33
- hubIssue1: import("../../../types/issue.types").IssueDocument;
34
- hubIssue2: import("../../../types/issue.types").IssueDocument;
35
- }>;
36
- /**
37
- * Example 5: Using user-specific issue methods
38
- */
39
- createUserIssues(): Promise<{
40
- userIssue: import("../../../types/issue.types").IssueDocument;
41
- }>;
42
- /**
43
- * Example 6: Using maintenance and urgent issue methods
44
- */
45
- createMaintenanceAndUrgentIssues(): Promise<{
46
- maintenanceIssue: import("../../../types/issue.types").IssueDocument;
47
- urgentIssue: import("../../../types/issue.types").IssueDocument;
48
- }>;
49
- /**
50
- * Example 7: Using static factory methods with IssueBuilder
51
- */
52
- createIssuesWithStaticMethods(): Promise<{
53
- issue1: import("../../../types/issue.types").IssueDocument;
54
- issue2: import("../../../types/issue.types").IssueDocument;
55
- }>;
56
- /**
57
- * Example 8: Creating multiple issues efficiently
58
- */
59
- createMultipleIssues(): Promise<import("../../../types/issue.types").IssueDocument[]>;
60
- /**
61
- * Example 9: Creating issue with due date calculation
62
- */
63
- createIssueWithDueDate(): Promise<import("../../../types/issue.types").IssueDocument>;
64
- /**
65
- * Example 10: Backward compatibility - still works with CreateIssueData
66
- */
67
- createIssueWithLegacyData(): Promise<import("../../../types/issue.types").IssueDocument>;
68
- }
@@ -1,177 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IssueServiceExample = void 0;
4
- const IssueBuilder_1 = require("../entities/IssueBuilder");
5
- const issue_types_1 = require("../../../types/issue.types");
6
- /**
7
- * Example usage of the updated IssueService with IssueBuilder integration
8
- * This file demonstrates various ways to use the IssueService with the new IssueBuilder
9
- */
10
- class IssueServiceExample {
11
- constructor(issueService) {
12
- this.issueService = issueService;
13
- }
14
- /**
15
- * Example 1: Using the updated createIssue method with IssueBuilder
16
- */
17
- async createIssueWithBuilder() {
18
- const issueBuilder = new IssueBuilder_1.IssueBuilder()
19
- .setCategory(issue_types_1.IssuesCategory.OPERATIONS)
20
- .setPropertyId("prop123")
21
- .setTitle("Device Maintenance Required")
22
- .setDescription("Device requires scheduled maintenance")
23
- .setEntityId("device456")
24
- .setEntityType(issue_types_1.EntityType.DEVICE)
25
- .setPriority(issue_types_1.IssuePriority.HIGH)
26
- .setAssignedTo("tech789")
27
- .setCreatedBy("user123")
28
- .setDueDate(new Date("2024-01-15"));
29
- // Pass the IssueBuilder directly to createIssue
30
- const issue = await this.issueService.createIssue(issueBuilder);
31
- return issue;
32
- }
33
- /**
34
- * Example 2: Using convenience methods for specific issue types
35
- */
36
- async createSpecificIssues() {
37
- // Create a readiness issue
38
- const readinessIssue = await this.issueService.createReadinessIssue("prop123", "System Maintenance Required", "System maintenance is scheduled for tonight", "admin", "system456", issue_types_1.EntityType.PROPERTY, "maintenance-team", new Date("2024-01-20"));
39
- // Create an operations issue
40
- const operationsIssue = await this.issueService.createOperationsIssue("prop123", "Device Temperature High", "Device temperature exceeds normal operating range", "monitor", "device789", issue_types_1.EntityType.DEVICE, "tech-support", new Date("2024-01-10"));
41
- // Create a security issue
42
- const securityIssue = await this.issueService.createSecurityIssue("prop123", "Unauthorized Access Attempt", "Multiple failed login attempts detected", "security-system", "user123", issue_types_1.EntityType.USER, "security-team", new Date("2024-01-05"));
43
- // Create an energy issue
44
- const energyIssue = await this.issueService.createEnergyIssue("prop123", "High Energy Consumption", "Energy usage is 20% above normal levels", "energy-monitor", "zone456", issue_types_1.EntityType.COLLECTION, "energy-manager", new Date("2024-01-25"));
45
- return { readinessIssue, operationsIssue, securityIssue, energyIssue };
46
- }
47
- /**
48
- * Example 3: Using device-specific issue methods
49
- */
50
- async createDeviceIssues() {
51
- // Create a device issue with default category and priority
52
- const deviceIssue1 = await this.issueService.createDeviceIssue("device123", "prop456", "Device Battery Low", "Device battery level is below 20%", "system", undefined, // Use default category
53
- undefined, // Use default priority
54
- "maintenance-team", new Date("2024-01-12"));
55
- // Create a device issue with custom category and priority
56
- const deviceIssue2 = await this.issueService.createDeviceIssue("device789", "prop456", "Device Firmware Update Available", "New firmware version is available for installation", "firmware-manager", issue_types_1.IssuesCategory.READINESS, issue_types_1.IssuePriority.MEDIUM, "admin", new Date("2024-01-20"));
57
- return { deviceIssue1, deviceIssue2 };
58
- }
59
- /**
60
- * Example 4: Using hub-specific issue methods
61
- */
62
- async createHubIssues() {
63
- // Create a hub issue with default settings
64
- const hubIssue1 = await this.issueService.createHubIssue("hub123", "prop456", "Hub Connection Lost", "Hub has lost connection to the network", "network-monitor", undefined, // Use default category
65
- undefined, // Use default priority
66
- "network-admin", new Date("2024-01-05"));
67
- // Create a hub issue with custom settings
68
- const hubIssue2 = await this.issueService.createHubIssue("hub789", "prop456", "Hub Maintenance Required", "Hub requires scheduled maintenance", "maintenance-system", issue_types_1.IssuesCategory.READINESS, issue_types_1.IssuePriority.LOW, "technician", new Date("2024-01-15"));
69
- return { hubIssue1, hubIssue2 };
70
- }
71
- /**
72
- * Example 5: Using user-specific issue methods
73
- */
74
- async createUserIssues() {
75
- // Create a user issue
76
- const userIssue = await this.issueService.createUserIssue("user456", "prop303", "User Access Review Required", "User access permissions need review", "access-control", issue_types_1.IssuesCategory.SECURITY, issue_types_1.IssuePriority.MEDIUM, "hr-admin", new Date("2024-01-30"));
77
- return { userIssue };
78
- }
79
- /**
80
- * Example 6: Using maintenance and urgent issue methods
81
- */
82
- async createMaintenanceAndUrgentIssues() {
83
- // Create a maintenance issue
84
- const maintenanceIssue = await this.issueService.createMaintenanceIssue("prop505", "Scheduled Device Maintenance", "Regular maintenance is scheduled for this device", "maintenance-scheduler", "device789", issue_types_1.EntityType.DEVICE, "technician", new Date("2024-01-12"));
85
- // Create an urgent issue
86
- const urgentIssue = await this.issueService.createUrgentIssue("prop606", "Critical Hub Failure", "Hub is experiencing critical failures", "monitoring-system", "hub123", issue_types_1.EntityType.HUB, "emergency-tech", new Date("2024-01-03"));
87
- return { maintenanceIssue, urgentIssue };
88
- }
89
- /**
90
- * Example 7: Using static factory methods with IssueBuilder
91
- */
92
- async createIssuesWithStaticMethods() {
93
- // Create a device issue using static factory method
94
- const deviceIssue = IssueBuilder_1.IssueBuilder.createDeviceIssue("device123", "prop456")
95
- .setCategory(issue_types_1.IssuesCategory.OPERATIONS)
96
- .setTitle("Device Offline")
97
- .setDescription("Device has been offline for more than 5 minutes")
98
- .setPriority(issue_types_1.IssuePriority.HIGH)
99
- .setAssignedTo("tech-support")
100
- .setCreatedBy("monitor")
101
- .setDueDate(new Date("2024-01-10"));
102
- const issue1 = await this.issueService.createIssue(deviceIssue);
103
- // Create a hub issue using static factory method
104
- const hubIssue = IssueBuilder_1.IssueBuilder.createHubIssue("hub789", "prop202")
105
- .setCategory(issue_types_1.IssuesCategory.SECURITY)
106
- .setTitle("Hub Security Breach")
107
- .setDescription("Unauthorized access attempt detected on hub")
108
- .setPriority(issue_types_1.IssuePriority.CRITICAL)
109
- .setAssignedTo("security-team")
110
- .setCreatedBy("security-system")
111
- .setDueDate(new Date("2024-01-05"));
112
- const issue2 = await this.issueService.createIssue(hubIssue);
113
- return { issue1, issue2 };
114
- }
115
- /**
116
- * Example 8: Creating multiple issues efficiently
117
- */
118
- async createMultipleIssues() {
119
- const issues = [];
120
- // Create multiple device issues efficiently
121
- const deviceIds = ["device1", "device2", "device3"];
122
- const propertyId = "prop123";
123
- for (const deviceId of deviceIds) {
124
- const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(deviceId, propertyId)
125
- .setCategory(issue_types_1.IssuesCategory.OPERATIONS)
126
- .setTitle(`Device ${deviceId} Status`)
127
- .setDescription(`Status check for device ${deviceId}`)
128
- .setPriority(issue_types_1.IssuePriority.MEDIUM)
129
- .setAssignedTo("batch-processor")
130
- .setCreatedBy("batch-processor")
131
- .setDueDate(new Date("2024-01-15"));
132
- const issue = await this.issueService.createIssue(issueBuilder);
133
- issues.push(issue);
134
- }
135
- return issues;
136
- }
137
- /**
138
- * Example 9: Creating issue with due date calculation
139
- */
140
- async createIssueWithDueDate() {
141
- const dueDate = new Date();
142
- dueDate.setDate(dueDate.getDate() + 7); // Due in 7 days
143
- const issueBuilder = new IssueBuilder_1.IssueBuilder()
144
- .setCategory(issue_types_1.IssuesCategory.READINESS)
145
- .setPropertyId("prop808")
146
- .setTitle("System Update Required")
147
- .setDescription("System requires critical security update")
148
- .setEntityType(issue_types_1.EntityType.PROPERTY)
149
- .setPriority(issue_types_1.IssuePriority.HIGH)
150
- .setAssignedTo("system-admin")
151
- .setCreatedBy("update-manager")
152
- .setDueDate(dueDate);
153
- const issue = await this.issueService.createIssue(issueBuilder);
154
- return issue;
155
- }
156
- /**
157
- * Example 10: Backward compatibility - still works with CreateIssueData
158
- */
159
- async createIssueWithLegacyData() {
160
- const issueData = {
161
- category: issue_types_1.IssuesCategory.OPERATIONS,
162
- propertyId: "prop123",
163
- title: "Legacy Issue",
164
- description: "This issue was created using the old CreateIssueData format",
165
- entityId: "device456",
166
- entityType: issue_types_1.EntityType.DEVICE,
167
- priority: issue_types_1.IssuePriority.MEDIUM,
168
- assignedTo: "tech-support",
169
- createdBy: "legacy-system",
170
- dueDate: new Date("2024-01-20")
171
- };
172
- // This still works with the updated createIssue method
173
- const issue = await this.issueService.createIssue(issueData);
174
- return issue;
175
- }
176
- }
177
- exports.IssueServiceExample = IssueServiceExample;
@@ -1,8 +0,0 @@
1
- export declare class LocalPropertyService {
2
- private readonly propertyRepository;
3
- constructor();
4
- getPropertyPreferences(propertyId: string): Promise<import("../interfaces").IPropertySettings | null>;
5
- getProperty(propertyId: string): Promise<import("../interfaces").IProperty | null>;
6
- getPropertyTimeZone(propertyId: string): Promise<string>;
7
- getAllProperties(): Promise<any[]>;
8
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalPropertyService = void 0;
4
- const Property_repository_1 = require("../repository/Property.repository");
5
- class LocalPropertyService {
6
- constructor() {
7
- this.propertyRepository = new Property_repository_1.PropertyRepository();
8
- }
9
- async getPropertyPreferences(propertyId) {
10
- if (!propertyId) {
11
- throw new Error("Property ID is required");
12
- }
13
- return await this.propertyRepository.getPropertyPreferences(propertyId);
14
- }
15
- async getProperty(propertyId) {
16
- if (!propertyId) {
17
- throw new Error("Property ID is required");
18
- }
19
- return await this.propertyRepository.getProperty(propertyId);
20
- }
21
- async getPropertyTimeZone(propertyId) {
22
- if (!propertyId) {
23
- throw new Error("Property ID is required");
24
- }
25
- const property = await this.propertyRepository.getProperty(propertyId);
26
- if (!property) {
27
- throw new Error("Property not found");
28
- }
29
- return property.timezone;
30
- }
31
- async getAllProperties() {
32
- const properties = await this.propertyRepository.getAllProperties();
33
- return properties;
34
- }
35
- }
36
- exports.LocalPropertyService = LocalPropertyService;
@@ -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,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- import { HttpCallOption } from "../types/http.types";
2
- export interface IHttpRequestJob {
3
- connectionId: string;
4
- provider: string;
5
- url: string;
6
- method: string;
7
- options: HttpCallOption;
8
- timestamp: number;
9
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,57 +0,0 @@
1
- import { EntityType } from "./issue.types";
2
- export declare enum AlertCategory {
3
- READINESS = "READINESS",
4
- OPERATIONS = "OPERATIONS",
5
- SECURITY = "SECURITY",
6
- ENERGY = "ENERGY",
7
- OTHER = "OTHER"
8
- }
9
- export declare enum AlertSeverity {
10
- INFO = "INFO",
11
- LOW = "LOW",
12
- MEDIUM = "MEDIUM",
13
- HIGH = "HIGH",
14
- CRITICAL = "CRITICAL"
15
- }
16
- export interface AlertDocument {
17
- _id: string;
18
- category: AlertCategory;
19
- propertyId: string;
20
- title: string;
21
- description: string;
22
- entityId?: string;
23
- entityType: EntityType;
24
- severity: AlertSeverity;
25
- isRead: boolean;
26
- isActive: boolean;
27
- isDeleted: boolean;
28
- snoozeUntil?: Date;
29
- createdBy?: string;
30
- updatedBy?: string;
31
- createdAt: Date;
32
- updatedAt: Date;
33
- }
34
- export interface CreateAlertData {
35
- category: AlertCategory;
36
- propertyId: string;
37
- title: string;
38
- description: string;
39
- entityId?: string;
40
- entityType: EntityType;
41
- severity?: AlertSeverity;
42
- createdBy?: string;
43
- snoozeUntil?: Date;
44
- }
45
- export interface UpdateAlertData {
46
- category?: AlertCategory;
47
- title?: string;
48
- description?: string;
49
- entityId?: string;
50
- entityType?: EntityType;
51
- severity?: AlertSeverity;
52
- isRead?: boolean;
53
- isActive?: boolean;
54
- snoozeUntil?: Date;
55
- updatedBy?: string;
56
- }
57
- export { EntityType } from "./issue.types";
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityType = exports.AlertSeverity = exports.AlertCategory = void 0;
4
- var AlertCategory;
5
- (function (AlertCategory) {
6
- AlertCategory["READINESS"] = "READINESS";
7
- AlertCategory["OPERATIONS"] = "OPERATIONS";
8
- AlertCategory["SECURITY"] = "SECURITY";
9
- AlertCategory["ENERGY"] = "ENERGY";
10
- AlertCategory["OTHER"] = "OTHER";
11
- })(AlertCategory || (exports.AlertCategory = AlertCategory = {}));
12
- var AlertSeverity;
13
- (function (AlertSeverity) {
14
- AlertSeverity["INFO"] = "INFO";
15
- AlertSeverity["LOW"] = "LOW";
16
- AlertSeverity["MEDIUM"] = "MEDIUM";
17
- AlertSeverity["HIGH"] = "HIGH";
18
- AlertSeverity["CRITICAL"] = "CRITICAL";
19
- })(AlertSeverity || (exports.AlertSeverity = AlertSeverity = {}));
20
- // Re-export EntityType from issue.types.ts to avoid duplication
21
- var issue_types_1 = require("./issue.types");
22
- Object.defineProperty(exports, "EntityType", { enumerable: true, get: function () { return issue_types_1.EntityType; } });
@@ -1,19 +0,0 @@
1
- import { IInternalEvent } from "../events/interfaces/IInternalEvent";
2
- export interface ILogger {
3
- info(message: string, ...args: any[]): void;
4
- warn(message: string, ...args: any[]): void;
5
- error(message: string, ...args: any[]): void;
6
- }
7
- type AllowedSource = "ACCESS_SERVICE" | "ADMIN_SERVICE" | "ENERGY_SERVICE";
8
- export type DeviceConfig = {
9
- SOURCE: AllowedSource;
10
- SQS_QUEUE_URL: string;
11
- DEVICE_SERVICE?: string;
12
- ADMIN_SERVICE?: string;
13
- ACCESS_SERVICE?: string;
14
- ENERGY_SERVICE?: string;
15
- INTERNAL_EVENT_HANDLER: IInternalEvent;
16
- LOGGER: ILogger;
17
- [key: string]: any;
18
- };
19
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export * from "./config.types";
2
- export * from "./issue.types";
3
- export * from "./alert.types";
@@ -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("./config.types"), exports);
18
- __exportStar(require("./issue.types"), exports);
19
- __exportStar(require("./alert.types"), exports);
@@ -1,90 +0,0 @@
1
- export declare enum IssuesCategory {
2
- READINESS = "READINESS",
3
- OPERATIONS = "OPERATIONS",
4
- SECURITY = "SECURITY",
5
- ENERGY = "ENERGY",
6
- OTHER = "OTHER"
7
- }
8
- export declare enum EntityType {
9
- DEVICE = "DEVICE",
10
- COLLECTION = "COLLECTION",
11
- USER = "USER",
12
- INTEGRATION = "INTEGRATION",
13
- PROPERTY = "PROPERTY",
14
- HUB = "HUB",
15
- SCHEDULE = "SCHEDULE",
16
- ALERT = "ALERT",
17
- OTHER = "OTHER"
18
- }
19
- export declare enum IssueStatus {
20
- PENDING = "PENDING",
21
- IN_PROGRESS = "IN_PROGRESS",
22
- RESOLVED = "RESOLVED",
23
- CLOSED = "CLOSED",
24
- CANCELLED = "CANCELLED",
25
- ON_HOLD = "ON_HOLD"
26
- }
27
- export declare enum IssuePriority {
28
- LOW = "LOW",
29
- MEDIUM = "MEDIUM",
30
- HIGH = "HIGH",
31
- CRITICAL = "CRITICAL",
32
- URGENT = "URGENT"
33
- }
34
- export interface IssueComment {
35
- id: string;
36
- userId: string;
37
- content: string;
38
- createdAt: Date;
39
- updatedAt?: Date;
40
- }
41
- export interface IssueDocument {
42
- _id: string;
43
- category: IssuesCategory;
44
- propertyId: string;
45
- title: string;
46
- description: string;
47
- entityId?: string;
48
- entityType: EntityType;
49
- status: IssueStatus;
50
- priority: IssuePriority;
51
- assignedTo?: string;
52
- createdBy: string;
53
- updatedBy?: string;
54
- isDeleted: boolean;
55
- createdAt: Date;
56
- updatedAt: Date;
57
- resolvedAt?: Date;
58
- dueDate?: Date;
59
- comments?: IssueComment[];
60
- }
61
- export interface CreateIssueData {
62
- category: IssuesCategory;
63
- propertyId: string;
64
- title: string;
65
- description: string;
66
- entityId?: string;
67
- entityType: EntityType;
68
- priority?: IssuePriority;
69
- assignedTo?: string;
70
- createdBy: string;
71
- dueDate?: Date;
72
- }
73
- export interface UpdateIssueData {
74
- category?: IssuesCategory;
75
- title?: string;
76
- description?: string;
77
- entityId?: string;
78
- entityType?: EntityType;
79
- status?: IssueStatus;
80
- priority?: IssuePriority;
81
- assignedTo?: string;
82
- updatedBy: string;
83
- resolvedAt?: Date;
84
- dueDate?: Date;
85
- isDeleted?: boolean;
86
- }
87
- export interface AddCommentData {
88
- userId: string;
89
- content: string;
90
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IssuePriority = exports.IssueStatus = exports.EntityType = exports.IssuesCategory = void 0;
4
- var IssuesCategory;
5
- (function (IssuesCategory) {
6
- IssuesCategory["READINESS"] = "READINESS";
7
- IssuesCategory["OPERATIONS"] = "OPERATIONS";
8
- IssuesCategory["SECURITY"] = "SECURITY";
9
- IssuesCategory["ENERGY"] = "ENERGY";
10
- IssuesCategory["OTHER"] = "OTHER";
11
- })(IssuesCategory || (exports.IssuesCategory = IssuesCategory = {}));
12
- var EntityType;
13
- (function (EntityType) {
14
- EntityType["DEVICE"] = "DEVICE";
15
- EntityType["COLLECTION"] = "COLLECTION";
16
- EntityType["USER"] = "USER";
17
- EntityType["INTEGRATION"] = "INTEGRATION";
18
- EntityType["PROPERTY"] = "PROPERTY";
19
- EntityType["HUB"] = "HUB";
20
- EntityType["SCHEDULE"] = "SCHEDULE";
21
- EntityType["ALERT"] = "ALERT";
22
- EntityType["OTHER"] = "OTHER";
23
- })(EntityType || (exports.EntityType = EntityType = {}));
24
- var IssueStatus;
25
- (function (IssueStatus) {
26
- IssueStatus["PENDING"] = "PENDING";
27
- IssueStatus["IN_PROGRESS"] = "IN_PROGRESS";
28
- IssueStatus["RESOLVED"] = "RESOLVED";
29
- IssueStatus["CLOSED"] = "CLOSED";
30
- IssueStatus["CANCELLED"] = "CANCELLED";
31
- IssueStatus["ON_HOLD"] = "ON_HOLD";
32
- })(IssueStatus || (exports.IssueStatus = IssueStatus = {}));
33
- var IssuePriority;
34
- (function (IssuePriority) {
35
- IssuePriority["LOW"] = "LOW";
36
- IssuePriority["MEDIUM"] = "MEDIUM";
37
- IssuePriority["HIGH"] = "HIGH";
38
- IssuePriority["CRITICAL"] = "CRITICAL";
39
- IssuePriority["URGENT"] = "URGENT";
40
- })(IssuePriority || (exports.IssuePriority = IssuePriority = {}));
@@ -1,13 +0,0 @@
1
- /**
2
- * Validates if a URL is properly formatted and accessible
3
- */
4
- export declare function validateServiceUrl(url: string): boolean;
5
- /**
6
- * Creates a properly configured axios instance with error handling
7
- */
8
- export declare function createAxiosInstance(baseURL?: string): import("axios").AxiosInstance;
9
- export declare function getDeviceServiceAxiosInstance(): any;
10
- /**
11
- * Retry function for failed HTTP requests
12
- */
13
- export declare function retryRequest<T>(requestFn: () => Promise<T>, maxRetries?: number, delay?: number): Promise<T>;