dt-common-device 13.0.3 → 13.0.7

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 (265) hide show
  1. package/dist/admin/Admin.repository.d.ts +7 -0
  2. package/dist/admin/Admin.repository.js +182 -0
  3. package/dist/admin/Admin.service.d.ts +5 -0
  4. package/dist/admin/Admin.service.js +17 -0
  5. package/dist/admin/index.d.ts +1 -0
  6. package/dist/admin/index.js +17 -0
  7. package/dist/alerts/AlertBuilder.example.d.ts +11 -0
  8. package/dist/alerts/AlertBuilder.example.js +117 -0
  9. package/dist/alerts/AlertService.example.d.ts +55 -0
  10. package/dist/alerts/AlertService.example.js +150 -0
  11. package/dist/audit/AuditProperties.d.ts +16 -0
  12. package/dist/audit/AuditProperties.js +2 -0
  13. package/dist/chronicle/Cronicle.service.d.ts +9 -0
  14. package/dist/chronicle/Cronicle.service.js +76 -0
  15. package/dist/chronicle/IChronicle.interface.d.ts +14 -0
  16. package/dist/chronicle/IChronicle.interface.js +2 -0
  17. package/dist/chronicle/ICronicle.interface.d.ts +15 -0
  18. package/dist/chronicle/ICronicle.interface.js +2 -0
  19. package/dist/chronicle/chronicle.service.d.ts +4 -0
  20. package/dist/chronicle/chronicle.service.js +44 -0
  21. package/dist/chronicle/index.d.ts +2 -0
  22. package/dist/chronicle/index.js +5 -0
  23. package/dist/connection/Connection.repository.d.ts +8 -0
  24. package/dist/connection/Connection.repository.js +92 -0
  25. package/dist/connection/Connection.service.d.ts +8 -0
  26. package/dist/connection/Connection.service.js +32 -0
  27. package/dist/connection/IConnection.d.ts +28 -0
  28. package/dist/connection/IConnection.js +16 -0
  29. package/dist/connection/index.d.ts +2 -0
  30. package/dist/connection/index.js +18 -0
  31. package/dist/copilotQueue/examples/CopilotQueue.example.d.ts +37 -0
  32. package/dist/copilotQueue/examples/CopilotQueue.example.js +140 -0
  33. package/dist/copilotQueue/examples/index.d.ts +1 -0
  34. package/dist/copilotQueue/examples/index.js +17 -0
  35. package/dist/device/cloud/entities/CloudConnection.d.ts +6 -0
  36. package/dist/device/cloud/entities/CloudConnection.js +6 -0
  37. package/dist/device/cloud/entities/CloudDevice.d.ts +16 -0
  38. package/dist/device/cloud/entities/CloudDevice.js +26 -0
  39. package/dist/device/cloud/entities/CloudDeviceService.d.ts +5 -0
  40. package/dist/device/cloud/entities/CloudDeviceService.js +9 -0
  41. package/dist/device/cloud/entities/DeviceFactory.d.ts +7 -0
  42. package/dist/device/cloud/entities/DeviceFactory.js +80 -0
  43. package/dist/device/cloud/entities/index.d.ts +3 -0
  44. package/dist/device/cloud/entities/index.js +19 -0
  45. package/dist/device/cloud/interface.d.ts +101 -0
  46. package/dist/device/cloud/interface.js +3 -0
  47. package/dist/device/cloud/interfaces/ICloudConnection.d.ts +5 -0
  48. package/dist/device/cloud/interfaces/ICloudConnection.js +2 -0
  49. package/dist/device/cloud/interfaces/ICloudDevice.d.ts +9 -0
  50. package/dist/device/cloud/interfaces/ICloudDevice.js +2 -0
  51. package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +4 -0
  52. package/dist/device/cloud/interfaces/ICloudDeviceService.js +2 -0
  53. package/dist/device/cloud/interfaces/IConnectionService.d.ts +7 -0
  54. package/dist/device/cloud/interfaces/IConnectionService.js +2 -0
  55. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +7 -0
  56. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +3 -0
  57. package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +4 -0
  58. package/dist/device/cloud/interfaces/IDeviceFactory.js +2 -0
  59. package/dist/device/cloud/interfaces/IDeviceService.d.ts +8 -0
  60. package/dist/device/cloud/interfaces/IDeviceService.js +2 -0
  61. package/dist/device/cloud/interfaces/IDevicesService.d.ts +9 -0
  62. package/dist/device/cloud/interfaces/IDevicesService.js +2 -0
  63. package/dist/device/cloud/interfaces/IHubService.d.ts +5 -0
  64. package/dist/device/cloud/interfaces/IHubService.js +2 -0
  65. package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +4 -0
  66. package/dist/device/cloud/interfaces/IRawDataTransformer.js +2 -0
  67. package/dist/device/cloud/interfaces/IRawDevice.d.ts +17 -0
  68. package/dist/device/cloud/interfaces/IRawDevice.js +11 -0
  69. package/dist/device/cloud/interfaces/index.d.ts +5 -0
  70. package/dist/device/cloud/interfaces/index.js +21 -0
  71. package/dist/device/cloud/services/CloudDevice.service.d.ts +5 -0
  72. package/dist/device/cloud/services/CloudDevice.service.js +9 -0
  73. package/dist/device/cloud/services/Connection.service.d.ts +8 -0
  74. package/dist/device/cloud/services/Connection.service.js +6 -0
  75. package/dist/device/cloud/services/Device.service.d.ts +39 -0
  76. package/dist/device/cloud/services/Device.service.js +9 -0
  77. package/dist/device/cloud/services/DeviceCloudService.d.ts +42 -0
  78. package/dist/device/cloud/services/DeviceCloudService.js +59 -0
  79. package/dist/device/cloud/services/DeviceHub.service.d.ts +3 -0
  80. package/dist/device/cloud/services/DeviceHub.service.js +6 -0
  81. package/dist/device/cloud/services/Hub.service.d.ts +25 -0
  82. package/dist/device/cloud/services/Hub.service.js +9 -0
  83. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +38 -0
  84. package/dist/device/cloud/services/SmartThingsDeviceService.js +52 -0
  85. package/dist/device/cloud/services/index.d.ts +2 -0
  86. package/dist/device/cloud/services/index.js +18 -0
  87. package/dist/device/cloud/types.d.ts +52 -0
  88. package/dist/device/cloud/types.js +15 -0
  89. package/dist/device/index.d.ts +4 -0
  90. package/dist/device/index.js +20 -0
  91. package/dist/device/local/entities/AlertBuilder.d.ts +87 -0
  92. package/dist/device/local/entities/AlertBuilder.example.d.ts +11 -0
  93. package/dist/device/local/entities/AlertBuilder.example.js +117 -0
  94. package/dist/device/local/entities/AlertBuilder.js +179 -0
  95. package/dist/device/local/entities/IssueBuilder.d.ts +109 -0
  96. package/dist/device/local/entities/IssueBuilder.example.d.ts +16 -0
  97. package/dist/device/local/entities/IssueBuilder.example.js +196 -0
  98. package/dist/device/local/entities/IssueBuilder.js +237 -0
  99. package/dist/device/local/entities/index.d.ts +2 -0
  100. package/dist/device/local/entities/index.js +7 -0
  101. package/dist/device/local/events/EventHandler.d.ts +11 -0
  102. package/dist/device/local/events/EventHandler.js +86 -0
  103. package/dist/device/local/events/Events.d.ts +54 -0
  104. package/dist/device/local/events/Events.js +57 -0
  105. package/dist/device/local/events/index.d.ts +2 -0
  106. package/dist/device/local/events/index.js +7 -0
  107. package/dist/device/local/handler/EventHandler.d.ts +7 -0
  108. package/dist/device/local/handler/EventHandler.js +44 -0
  109. package/dist/device/local/interface.d.ts +0 -0
  110. package/dist/device/local/interface.js +1 -0
  111. package/dist/device/local/interfaces/IConnection.d.ts +26 -0
  112. package/dist/device/local/interfaces/IConnection.js +14 -0
  113. package/dist/device/local/interfaces/IDevice.d.ts +68 -0
  114. package/dist/device/local/interfaces/IDevice.js +10 -0
  115. package/dist/device/local/interfaces/IDtDevice.d.ts +16 -0
  116. package/dist/device/local/interfaces/IDtDevice.js +2 -0
  117. package/dist/device/local/interfaces/IHub.d.ts +46 -0
  118. package/dist/device/local/interfaces/IHub.js +2 -0
  119. package/dist/device/local/interfaces/IProperty.d.ts +29 -0
  120. package/dist/device/local/interfaces/IProperty.js +2 -0
  121. package/dist/device/local/interfaces/ISchedule.d.ts +25 -0
  122. package/dist/device/local/interfaces/ISchedule.js +2 -0
  123. package/dist/device/local/interfaces/index.d.ts +3 -0
  124. package/dist/device/local/interfaces/index.js +19 -0
  125. package/dist/device/local/models/Alert.model.d.ts +28 -0
  126. package/dist/device/local/models/Alert.model.js +222 -0
  127. package/dist/device/local/models/Issue.model.d.ts +28 -0
  128. package/dist/device/local/models/Issue.model.js +260 -0
  129. package/dist/device/local/repository/Alert.repository.d.ts +106 -0
  130. package/dist/device/local/repository/Alert.repository.js +374 -0
  131. package/dist/device/local/repository/Connection.repository.d.ts +8 -0
  132. package/dist/device/local/repository/Connection.repository.js +92 -0
  133. package/dist/device/local/repository/Device.repository.d.ts +30 -0
  134. package/dist/device/local/repository/Device.repository.js +325 -0
  135. package/dist/device/local/repository/Hub.repository.d.ts +13 -0
  136. package/dist/device/local/repository/Hub.repository.js +139 -0
  137. package/dist/device/local/repository/Issue.repository.d.ts +113 -0
  138. package/dist/device/local/repository/Issue.repository.js +401 -0
  139. package/dist/device/local/repository/Property.repository.d.ts +8 -0
  140. package/dist/device/local/repository/Property.repository.js +95 -0
  141. package/dist/device/local/repository/Schedule.repository.d.ts +9 -0
  142. package/dist/device/local/repository/Schedule.repository.js +109 -0
  143. package/dist/device/local/services/Alert.service.d.ts +137 -0
  144. package/dist/device/local/services/Alert.service.js +475 -0
  145. package/dist/device/local/services/AlertService.example.d.ts +55 -0
  146. package/dist/device/local/services/AlertService.example.js +148 -0
  147. package/dist/device/local/services/Connection.service.d.ts +8 -0
  148. package/dist/device/local/services/Connection.service.js +32 -0
  149. package/dist/device/local/services/Device.service.d.ts +40 -0
  150. package/dist/device/local/services/Device.service.js +391 -0
  151. package/dist/device/local/services/DeviceHub.service.d.ts +11 -0
  152. package/dist/device/local/services/DeviceHub.service.js +40 -0
  153. package/dist/device/local/services/Hub.service.d.ts +12 -0
  154. package/dist/device/local/services/Hub.service.js +107 -0
  155. package/dist/device/local/services/Issue.service.d.ts +168 -0
  156. package/dist/device/local/services/Issue.service.js +642 -0
  157. package/dist/device/local/services/IssueService.example.d.ts +68 -0
  158. package/dist/device/local/services/IssueService.example.js +177 -0
  159. package/dist/device/local/services/Property.service.d.ts +8 -0
  160. package/dist/device/local/services/Property.service.js +36 -0
  161. package/dist/device/local/services/Schedule.service.d.ts +9 -0
  162. package/dist/device/local/services/Schedule.service.js +26 -0
  163. package/dist/device/local/services/index.d.ts +3 -0
  164. package/dist/device/local/services/index.js +19 -0
  165. package/dist/entities/accessGroup/AccessGroup.repository.d.ts +5 -0
  166. package/dist/entities/accessGroup/AccessGroup.repository.js +72 -0
  167. package/dist/entities/accessGroup/AccessGroup.service.d.ts +5 -0
  168. package/dist/entities/accessGroup/AccessGroup.service.js +105 -0
  169. package/dist/entities/accessGroup/IAccessGroup.d.ts +14 -0
  170. package/dist/entities/accessGroup/IAccessGroup.js +2 -0
  171. package/dist/entities/accessGroup/index.d.ts +2 -0
  172. package/dist/entities/accessGroup/index.js +18 -0
  173. package/dist/entities/admin/Admin.repository.d.ts +1 -1
  174. package/dist/entities/admin/Admin.repository.js +8 -4
  175. package/dist/entities/admin/Admin.service.d.ts +2 -2
  176. package/dist/entities/admin/Admin.service.js +4 -3
  177. package/dist/entities/device/local/repository/DeviceProfile.repository.d.ts +5 -0
  178. package/dist/entities/device/local/repository/DeviceProfile.repository.js +75 -0
  179. package/dist/entities/guest/Guest.repository.d.ts +6 -0
  180. package/dist/entities/guest/Guest.repository.js +74 -0
  181. package/dist/entities/guest/Guest.service.d.ts +6 -0
  182. package/dist/entities/guest/Guest.service.js +104 -0
  183. package/dist/entities/guest/IGuest.d.ts +12 -0
  184. package/dist/entities/guest/IGuest.js +2 -0
  185. package/dist/entities/guest/index.d.ts +2 -0
  186. package/dist/entities/guest/index.js +18 -0
  187. package/dist/entities/schedules/ISchedule.d.ts +14 -0
  188. package/dist/entities/schedules/ISchedule.js +2 -0
  189. package/dist/entities/schedules/Schedule.repository.d.ts +6 -0
  190. package/dist/entities/schedules/Schedule.repository.js +74 -0
  191. package/dist/entities/schedules/Schedule.service.d.ts +6 -0
  192. package/dist/entities/schedules/Schedule.service.js +104 -0
  193. package/dist/entities/schedules/index.d.ts +2 -0
  194. package/dist/entities/schedules/index.js +18 -0
  195. package/dist/entities/user/IUser.d.ts +15 -0
  196. package/dist/entities/user/IUser.js +2 -0
  197. package/dist/entities/user/User.repository.d.ts +5 -0
  198. package/dist/entities/user/User.repository.js +68 -0
  199. package/dist/entities/user/User.service.d.ts +6 -0
  200. package/dist/entities/user/User.service.js +103 -0
  201. package/dist/entities/zone/IZone.d.ts +10 -0
  202. package/dist/entities/zone/IZone.js +2 -0
  203. package/dist/entities/zone/Zone.repository.d.ts +6 -0
  204. package/dist/entities/zone/Zone.repository.js +77 -0
  205. package/dist/entities/zone/Zone.service.d.ts +6 -0
  206. package/dist/entities/zone/Zone.service.js +104 -0
  207. package/dist/entities/zone/index.d.ts +2 -0
  208. package/dist/entities/zone/index.js +18 -0
  209. package/dist/issues/IssueBuilder.example.d.ts +16 -0
  210. package/dist/issues/IssueBuilder.example.js +196 -0
  211. package/dist/issues/IssueService.example.d.ts +68 -0
  212. package/dist/issues/IssueService.example.js +292 -0
  213. package/dist/pms/IPms.d.ts +6 -0
  214. package/dist/pms/IPms.js +10 -0
  215. package/dist/pms/index.d.ts +1 -0
  216. package/dist/pms/index.js +18 -0
  217. package/dist/pms/webhookQueue/examples/index.d.ts +2 -0
  218. package/dist/pms/webhookQueue/examples/index.js +18 -0
  219. package/dist/pms/webhookQueue/examples/pms-integration.d.ts +65 -0
  220. package/dist/pms/webhookQueue/examples/pms-integration.js +254 -0
  221. package/dist/pms/webhookQueue/examples/usage.d.ts +7 -0
  222. package/dist/pms/webhookQueue/examples/usage.js +175 -0
  223. package/dist/pms/webhookQueue/index.d.ts +3 -0
  224. package/dist/pms/webhookQueue/index.js +20 -0
  225. package/dist/pms/webhookQueue/interfaces/IWebhookQueue.d.ts +33 -0
  226. package/dist/pms/webhookQueue/interfaces/IWebhookQueue.js +2 -0
  227. package/dist/pms/webhookQueue/interfaces/IWebhookWorker.d.ts +38 -0
  228. package/dist/pms/webhookQueue/interfaces/IWebhookWorker.js +2 -0
  229. package/dist/pms/webhookQueue/interfaces/index.d.ts +1 -0
  230. package/dist/pms/webhookQueue/interfaces/index.js +17 -0
  231. package/dist/pms/webhookQueue/services/WebhookQueueFactory.d.ts +38 -0
  232. package/dist/pms/webhookQueue/services/WebhookQueueFactory.js +131 -0
  233. package/dist/pms/webhookQueue/services/WebhookQueueIntegration.d.ts +70 -0
  234. package/dist/pms/webhookQueue/services/WebhookQueueIntegration.js +207 -0
  235. package/dist/pms/webhookQueue/services/WebhookQueueService.d.ts +45 -0
  236. package/dist/pms/webhookQueue/services/WebhookQueueService.js +270 -0
  237. package/dist/pms/webhookQueue/services/WebhookWorker.d.ts +37 -0
  238. package/dist/pms/webhookQueue/services/WebhookWorker.js +201 -0
  239. package/dist/pms/webhookQueue/services/index.d.ts +1 -0
  240. package/dist/pms/webhookQueue/services/index.js +17 -0
  241. package/dist/pms/webhookQueue/types/index.d.ts +1 -0
  242. package/dist/pms/webhookQueue/types/index.js +17 -0
  243. package/dist/pms/webhookQueue/types/webhook.types.d.ts +39 -0
  244. package/dist/pms/webhookQueue/types/webhook.types.js +2 -0
  245. package/dist/property/IProperty.d.ts +29 -0
  246. package/dist/property/IProperty.js +2 -0
  247. package/dist/property/Property.repository.d.ts +8 -0
  248. package/dist/property/Property.repository.js +109 -0
  249. package/dist/property/Property.service.d.ts +8 -0
  250. package/dist/property/Property.service.js +124 -0
  251. package/dist/property/index.d.ts +2 -0
  252. package/dist/property/index.js +18 -0
  253. package/dist/queue/interfaces/IHttpRequestJob.d.ts +9 -0
  254. package/dist/queue/interfaces/IHttpRequestJob.js +2 -0
  255. package/dist/types/alert.types.d.ts +57 -0
  256. package/dist/types/alert.types.js +22 -0
  257. package/dist/types/config.types.d.ts +19 -0
  258. package/dist/types/config.types.js +2 -0
  259. package/dist/types/index.d.ts +3 -0
  260. package/dist/types/index.js +19 -0
  261. package/dist/types/issue.types.d.ts +90 -0
  262. package/dist/types/issue.types.js +40 -0
  263. package/dist/utils/http-utils.d.ts +13 -0
  264. package/dist/utils/http-utils.js +117 -0
  265. package/package.json +1 -1
@@ -0,0 +1,68 @@
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
+ }
@@ -0,0 +1,177 @@
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;
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,36 @@
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;
@@ -0,0 +1,9 @@
1
+ import { ISchedule } from "../interfaces/ISchedule";
2
+ export declare class LocalScheduleService {
3
+ private readonly scheduleRepository;
4
+ constructor();
5
+ getSchedule(scheduleId: string): Promise<any>;
6
+ setSchedule(scheduleId: string, schedule: ISchedule): Promise<any>;
7
+ getScheduleByZone(zoneId: string): Promise<any>;
8
+ deleteSchedule(scheduleId: string): Promise<any>;
9
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LocalScheduleService = void 0;
7
+ const typedi_1 = __importDefault(require("typedi"));
8
+ const Schedule_repository_1 = require("../repository/Schedule.repository");
9
+ class LocalScheduleService {
10
+ constructor() {
11
+ this.scheduleRepository = typedi_1.default.get(Schedule_repository_1.ScheduleRepository);
12
+ }
13
+ async getSchedule(scheduleId) {
14
+ return await this.scheduleRepository.getSchedule(scheduleId);
15
+ }
16
+ async setSchedule(scheduleId, schedule) {
17
+ return await this.scheduleRepository.setSchedule(scheduleId, schedule);
18
+ }
19
+ async getScheduleByZone(zoneId) {
20
+ return await this.scheduleRepository.getScheduleByZone(zoneId);
21
+ }
22
+ async deleteSchedule(scheduleId) {
23
+ return await this.scheduleRepository.deleteSchedule(scheduleId);
24
+ }
25
+ }
26
+ exports.LocalScheduleService = LocalScheduleService;
@@ -0,0 +1,3 @@
1
+ export * from "./Device.service";
2
+ export * from "./Hub.service";
3
+ export * from "./Schedule.service";
@@ -0,0 +1,19 @@
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("./Device.service"), exports);
18
+ __exportStar(require("./Hub.service"), exports);
19
+ __exportStar(require("./Schedule.service"), exports);
@@ -0,0 +1,5 @@
1
+ export declare class AccessGroupRepository {
2
+ private readonly postgres;
3
+ constructor();
4
+ getAccessGroup(accessGroupId: string): Promise<any>;
5
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.AccessGroupRepository = void 0;
42
+ const typedi_1 = require("typedi");
43
+ const db_1 = require("../../db");
44
+ let AccessGroupRepository = (() => {
45
+ let _classDecorators = [(0, typedi_1.Service)()];
46
+ let _classDescriptor;
47
+ let _classExtraInitializers = [];
48
+ let _classThis;
49
+ var AccessGroupRepository = _classThis = class {
50
+ constructor() {
51
+ this.postgres = (0, db_1.getPostgresClient)();
52
+ }
53
+ async getAccessGroup(accessGroupId) {
54
+ const query = `
55
+ SELECT * FROM dt_collections
56
+ WHERE "id" = $1
57
+ `;
58
+ const result = await this.postgres.query(query, [accessGroupId]);
59
+ return result.rows[0];
60
+ }
61
+ };
62
+ __setFunctionName(_classThis, "AccessGroupRepository");
63
+ (() => {
64
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
65
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
66
+ AccessGroupRepository = _classThis = _classDescriptor.value;
67
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
68
+ __runInitializers(_classThis, _classExtraInitializers);
69
+ })();
70
+ return AccessGroupRepository = _classThis;
71
+ })();
72
+ exports.AccessGroupRepository = AccessGroupRepository;
@@ -0,0 +1,5 @@
1
+ export declare class AccessGroupService {
2
+ private readonly accessGroupRepository;
3
+ constructor();
4
+ getAccessGroup(accessGroupId: string): Promise<any>;
5
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
19
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
20
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
21
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
22
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
23
+ var _, done = false;
24
+ for (var i = decorators.length - 1; i >= 0; i--) {
25
+ var context = {};
26
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
27
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
28
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
29
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
30
+ if (kind === "accessor") {
31
+ if (result === void 0) continue;
32
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
33
+ if (_ = accept(result.get)) descriptor.get = _;
34
+ if (_ = accept(result.set)) descriptor.set = _;
35
+ if (_ = accept(result.init)) initializers.unshift(_);
36
+ }
37
+ else if (_ = accept(result)) {
38
+ if (kind === "field") initializers.unshift(_);
39
+ else descriptor[key] = _;
40
+ }
41
+ }
42
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
43
+ done = true;
44
+ };
45
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
46
+ var useValue = arguments.length > 2;
47
+ for (var i = 0; i < initializers.length; i++) {
48
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
49
+ }
50
+ return useValue ? value : void 0;
51
+ };
52
+ var __importStar = (this && this.__importStar) || (function () {
53
+ var ownKeys = function(o) {
54
+ ownKeys = Object.getOwnPropertyNames || function (o) {
55
+ var ar = [];
56
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
57
+ return ar;
58
+ };
59
+ return ownKeys(o);
60
+ };
61
+ return function (mod) {
62
+ if (mod && mod.__esModule) return mod;
63
+ var result = {};
64
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
65
+ __setModuleDefault(result, mod);
66
+ return result;
67
+ };
68
+ })();
69
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
70
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
71
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
72
+ };
73
+ Object.defineProperty(exports, "__esModule", { value: true });
74
+ exports.AccessGroupService = void 0;
75
+ const typedi_1 = __importStar(require("typedi"));
76
+ const AccessGroup_repository_1 = require("./AccessGroup.repository");
77
+ let AccessGroupService = (() => {
78
+ let _classDecorators = [(0, typedi_1.Service)()];
79
+ let _classDescriptor;
80
+ let _classExtraInitializers = [];
81
+ let _classThis;
82
+ var AccessGroupService = _classThis = class {
83
+ constructor() {
84
+ this.accessGroupRepository = typedi_1.default.get(AccessGroup_repository_1.AccessGroupRepository);
85
+ }
86
+ async getAccessGroup(accessGroupId) {
87
+ if (!accessGroupId) {
88
+ throw new Error("Access Group ID is required");
89
+ }
90
+ return await this.accessGroupRepository.getAccessGroup(accessGroupId);
91
+ }
92
+ };
93
+ __setFunctionName(_classThis, "AccessGroupService");
94
+ (() => {
95
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
96
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
97
+ AccessGroupService = _classThis = _classDescriptor.value;
98
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
99
+ __runInitializers(_classThis, _classExtraInitializers);
100
+ })();
101
+ return AccessGroupService = _classThis;
102
+ })();
103
+ exports.AccessGroupService = AccessGroupService;
104
+ // Accessgroup.getAccessGroup(accessGroupId)
105
+ // GetAccessGroup()
@@ -0,0 +1,14 @@
1
+ export interface IAccessGroup {
2
+ id: string;
3
+ propertyId: string;
4
+ name: string;
5
+ displayName: string;
6
+ type: string;
7
+ externalId?: string;
8
+ refId?: string;
9
+ isDeleted: boolean;
10
+ createdBy: string;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ accessibleBy: string[];
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./AccessGroup.service";
2
+ export * from "./IAccessGroup";
@@ -0,0 +1,18 @@
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("./AccessGroup.service"), exports);
18
+ __exportStar(require("./IAccessGroup"), exports);
@@ -6,7 +6,7 @@ export declare class AdminRepository {
6
6
  private readonly redisUtils;
7
7
  constructor();
8
8
  getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<any[]>;
9
- getZonesByAccessGroups(accessGroupIds: string[]): Promise<any[]>;
9
+ getZonesByAccessGroups(accessGroupIds: string[], type?: string[]): Promise<any[]>;
10
10
  getAccessGroup(accessGroupId: string, propertyId?: string): Promise<IAccessGroup | null>;
11
11
  getZoneAccessGroupByZoneId(zoneId: string): Promise<IZoneAccessGroup[] | null>;
12
12
  getZone(zoneId: string, propertyId?: string): Promise<IZone | null>;
@@ -207,7 +207,7 @@ let AdminRepository = (() => {
207
207
  // );
208
208
  return collectionZoneDevices;
209
209
  }
210
- async getZonesByAccessGroups(accessGroupIds) {
210
+ async getZonesByAccessGroups(accessGroupIds, type) {
211
211
  // Fetch zone IDs associated with these access groups
212
212
  const zonesIdsQuery = `
213
213
  SELECT DISTINCT z."zoneId"
@@ -221,13 +221,17 @@ let AdminRepository = (() => {
221
221
  if (zonesIds.length === 0) {
222
222
  return [];
223
223
  }
224
- // Fetch zone type IDs for guest rooms and rooms
224
+ // Use default types if not provided
225
+ const zoneTypesToFilter = type || ["Guest Room", "Room"];
226
+ // Fetch zone type IDs for the specified type
225
227
  const zoneTypesQuery = `
226
228
  SELECT id
227
229
  FROM "dt_zoneTypes"
228
- WHERE name IN ('Guest Room', 'Room')
230
+ WHERE name = ANY($1)
229
231
  `;
230
- const zoneTypes = await this.postgres.query(zoneTypesQuery);
232
+ const zoneTypes = await this.postgres.query(zoneTypesQuery, [
233
+ zoneTypesToFilter,
234
+ ]);
231
235
  const guestRoomZoneTypeIds = zoneTypes.rows.map((e) => e.id);
232
236
  // Fetch zones matching both sets of IDs
233
237
  const zonesQuery = `
@@ -3,8 +3,8 @@ export declare class AdminService {
3
3
  private readonly adminRepository;
4
4
  private readonly redisUtils;
5
5
  constructor();
6
- getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<any[] | undefined>;
7
- getZonesByAccessGroups(accessGroupIds: string[]): Promise<any[] | undefined>;
6
+ getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<any[]>;
7
+ getZonesByAccessGroups(accessGroupIds: string[], type?: string[]): Promise<any[]>;
8
8
  getAccessGroup(accessGroupId: string, propertyId?: string): Promise<IAccessGroup | null>;
9
9
  getAccessGroupByZoneId(zoneId: string): Promise<IAccessGroup[] | []>;
10
10
  getZone(zoneId: string, propertyId?: string): Promise<IZone | null>;