dt-common-device 11.2.0 → 11.2.2

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 (233) 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/audit/AuditProperties.d.ts +16 -0
  8. package/dist/audit/AuditProperties.js +2 -0
  9. package/dist/chronicle/Cronicle.service.d.ts +2 -6
  10. package/dist/chronicle/Cronicle.service.js +2 -19
  11. package/dist/chronicle/IChronicle.interface.d.ts +14 -0
  12. package/dist/chronicle/IChronicle.interface.js +2 -0
  13. package/dist/chronicle/ICronicle.interface.d.ts +0 -1
  14. package/dist/chronicle/chronicle.service.d.ts +4 -0
  15. package/dist/chronicle/chronicle.service.js +44 -0
  16. package/dist/config/config.js +5 -0
  17. package/dist/config/config.types.d.ts +1 -1
  18. package/dist/config/constants.d.ts +7 -0
  19. package/dist/config/constants.js +7 -2
  20. package/dist/connection/Connection.repository.d.ts +8 -0
  21. package/dist/connection/Connection.repository.js +92 -0
  22. package/dist/connection/Connection.service.d.ts +8 -0
  23. package/dist/connection/Connection.service.js +32 -0
  24. package/dist/connection/IConnection.d.ts +28 -0
  25. package/dist/connection/IConnection.js +16 -0
  26. package/dist/connection/index.d.ts +2 -0
  27. package/dist/connection/index.js +18 -0
  28. package/dist/constants/ConnectionProviders.d.ts +1 -0
  29. package/dist/constants/ConnectionProviders.js +1 -0
  30. package/dist/copilotQueue/examples/CopilotQueue.example.d.ts +37 -0
  31. package/dist/copilotQueue/examples/CopilotQueue.example.js +140 -0
  32. package/dist/copilotQueue/examples/index.d.ts +1 -0
  33. package/dist/copilotQueue/examples/index.js +17 -0
  34. package/dist/device/cloud/entities/CloudConnection.d.ts +6 -0
  35. package/dist/device/cloud/entities/CloudConnection.js +6 -0
  36. package/dist/device/cloud/entities/CloudDevice.d.ts +16 -0
  37. package/dist/device/cloud/entities/CloudDevice.js +26 -0
  38. package/dist/device/cloud/entities/CloudDeviceService.d.ts +5 -0
  39. package/dist/device/cloud/entities/CloudDeviceService.js +9 -0
  40. package/dist/device/cloud/entities/DeviceFactory.d.ts +7 -0
  41. package/dist/device/cloud/entities/DeviceFactory.js +80 -0
  42. package/dist/device/cloud/entities/index.d.ts +3 -0
  43. package/dist/device/cloud/entities/index.js +19 -0
  44. package/dist/device/cloud/interface.d.ts +101 -0
  45. package/dist/device/cloud/interface.js +3 -0
  46. package/dist/device/cloud/interfaces/ICloudConnection.d.ts +5 -0
  47. package/dist/device/cloud/interfaces/ICloudConnection.js +2 -0
  48. package/dist/device/cloud/interfaces/ICloudDevice.d.ts +9 -0
  49. package/dist/device/cloud/interfaces/ICloudDevice.js +2 -0
  50. package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +4 -0
  51. package/dist/device/cloud/interfaces/ICloudDeviceService.js +2 -0
  52. package/dist/device/cloud/interfaces/IConnectionService.d.ts +7 -0
  53. package/dist/device/cloud/interfaces/IConnectionService.js +2 -0
  54. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +7 -0
  55. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +3 -0
  56. package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +4 -0
  57. package/dist/device/cloud/interfaces/IDeviceFactory.js +2 -0
  58. package/dist/device/cloud/interfaces/IDeviceService.d.ts +8 -0
  59. package/dist/device/cloud/interfaces/IDeviceService.js +2 -0
  60. package/dist/device/cloud/interfaces/IDevicesService.d.ts +9 -0
  61. package/dist/device/cloud/interfaces/IDevicesService.js +2 -0
  62. package/dist/device/cloud/interfaces/IHubService.d.ts +5 -0
  63. package/dist/device/cloud/interfaces/IHubService.js +2 -0
  64. package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +4 -0
  65. package/dist/device/cloud/interfaces/IRawDataTransformer.js +2 -0
  66. package/dist/device/cloud/interfaces/IRawDevice.d.ts +17 -0
  67. package/dist/device/cloud/interfaces/IRawDevice.js +11 -0
  68. package/dist/device/cloud/interfaces/index.d.ts +5 -0
  69. package/dist/device/cloud/interfaces/index.js +21 -0
  70. package/dist/device/cloud/services/CloudDevice.service.d.ts +5 -0
  71. package/dist/device/cloud/services/CloudDevice.service.js +9 -0
  72. package/dist/device/cloud/services/Connection.service.d.ts +8 -0
  73. package/dist/device/cloud/services/Connection.service.js +6 -0
  74. package/dist/device/cloud/services/Device.service.d.ts +39 -0
  75. package/dist/device/cloud/services/Device.service.js +9 -0
  76. package/dist/device/cloud/services/DeviceCloudService.d.ts +42 -0
  77. package/dist/device/cloud/services/DeviceCloudService.js +59 -0
  78. package/dist/device/cloud/services/DeviceHub.service.d.ts +3 -0
  79. package/dist/device/cloud/services/DeviceHub.service.js +6 -0
  80. package/dist/device/cloud/services/Hub.service.d.ts +25 -0
  81. package/dist/device/cloud/services/Hub.service.js +9 -0
  82. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +38 -0
  83. package/dist/device/cloud/services/SmartThingsDeviceService.js +52 -0
  84. package/dist/device/cloud/services/index.d.ts +2 -0
  85. package/dist/device/cloud/services/index.js +18 -0
  86. package/dist/device/cloud/types.d.ts +52 -0
  87. package/dist/device/cloud/types.js +15 -0
  88. package/dist/device/index.d.ts +4 -0
  89. package/dist/device/index.js +20 -0
  90. package/dist/device/local/entities/AlertBuilder.d.ts +87 -0
  91. package/dist/device/local/entities/AlertBuilder.example.d.ts +11 -0
  92. package/dist/device/local/entities/AlertBuilder.example.js +117 -0
  93. package/dist/device/local/entities/AlertBuilder.js +179 -0
  94. package/dist/device/local/entities/IssueBuilder.d.ts +109 -0
  95. package/dist/device/local/entities/IssueBuilder.example.d.ts +16 -0
  96. package/dist/device/local/entities/IssueBuilder.example.js +196 -0
  97. package/dist/device/local/entities/IssueBuilder.js +237 -0
  98. package/dist/device/local/entities/index.d.ts +2 -0
  99. package/dist/device/local/entities/index.js +7 -0
  100. package/dist/device/local/events/EventHandler.d.ts +11 -0
  101. package/dist/device/local/events/EventHandler.js +86 -0
  102. package/dist/device/local/events/Events.d.ts +54 -0
  103. package/dist/device/local/events/Events.js +57 -0
  104. package/dist/device/local/events/index.d.ts +2 -0
  105. package/dist/device/local/events/index.js +7 -0
  106. package/dist/device/local/handler/EventHandler.d.ts +7 -0
  107. package/dist/device/local/handler/EventHandler.js +44 -0
  108. package/dist/device/local/interface.d.ts +0 -0
  109. package/dist/device/local/interface.js +1 -0
  110. package/dist/device/local/interfaces/IConnection.d.ts +26 -0
  111. package/dist/device/local/interfaces/IConnection.js +14 -0
  112. package/dist/device/local/interfaces/IDevice.d.ts +68 -0
  113. package/dist/device/local/interfaces/IDevice.js +10 -0
  114. package/dist/device/local/interfaces/IDtDevice.d.ts +16 -0
  115. package/dist/device/local/interfaces/IDtDevice.js +2 -0
  116. package/dist/device/local/interfaces/IHub.d.ts +46 -0
  117. package/dist/device/local/interfaces/IHub.js +2 -0
  118. package/dist/device/local/interfaces/IProperty.d.ts +29 -0
  119. package/dist/device/local/interfaces/IProperty.js +2 -0
  120. package/dist/device/local/interfaces/ISchedule.d.ts +25 -0
  121. package/dist/device/local/interfaces/ISchedule.js +2 -0
  122. package/dist/device/local/interfaces/index.d.ts +3 -0
  123. package/dist/device/local/interfaces/index.js +19 -0
  124. package/dist/device/local/models/Alert.model.d.ts +28 -0
  125. package/dist/device/local/models/Alert.model.js +222 -0
  126. package/dist/device/local/models/Issue.model.d.ts +28 -0
  127. package/dist/device/local/models/Issue.model.js +260 -0
  128. package/dist/device/local/repository/Alert.repository.d.ts +106 -0
  129. package/dist/device/local/repository/Alert.repository.js +374 -0
  130. package/dist/device/local/repository/Connection.repository.d.ts +8 -0
  131. package/dist/device/local/repository/Connection.repository.js +92 -0
  132. package/dist/device/local/repository/Device.repository.d.ts +30 -0
  133. package/dist/device/local/repository/Device.repository.js +325 -0
  134. package/dist/device/local/repository/Hub.repository.d.ts +13 -0
  135. package/dist/device/local/repository/Hub.repository.js +139 -0
  136. package/dist/device/local/repository/Issue.repository.d.ts +113 -0
  137. package/dist/device/local/repository/Issue.repository.js +401 -0
  138. package/dist/device/local/repository/Property.repository.d.ts +8 -0
  139. package/dist/device/local/repository/Property.repository.js +95 -0
  140. package/dist/device/local/repository/Schedule.repository.d.ts +9 -0
  141. package/dist/device/local/repository/Schedule.repository.js +109 -0
  142. package/dist/device/local/services/Alert.service.d.ts +137 -0
  143. package/dist/device/local/services/Alert.service.js +475 -0
  144. package/dist/device/local/services/AlertService.example.d.ts +55 -0
  145. package/dist/device/local/services/AlertService.example.js +148 -0
  146. package/dist/device/local/services/Connection.service.d.ts +8 -0
  147. package/dist/device/local/services/Connection.service.js +32 -0
  148. package/dist/device/local/services/Device.service.d.ts +40 -0
  149. package/dist/device/local/services/Device.service.js +391 -0
  150. package/dist/device/local/services/DeviceHub.service.d.ts +11 -0
  151. package/dist/device/local/services/DeviceHub.service.js +40 -0
  152. package/dist/device/local/services/Hub.service.d.ts +12 -0
  153. package/dist/device/local/services/Hub.service.js +107 -0
  154. package/dist/device/local/services/Issue.service.d.ts +168 -0
  155. package/dist/device/local/services/Issue.service.js +642 -0
  156. package/dist/device/local/services/IssueService.example.d.ts +68 -0
  157. package/dist/device/local/services/IssueService.example.js +177 -0
  158. package/dist/device/local/services/Property.service.d.ts +8 -0
  159. package/dist/device/local/services/Property.service.js +36 -0
  160. package/dist/device/local/services/Schedule.service.d.ts +9 -0
  161. package/dist/device/local/services/Schedule.service.js +26 -0
  162. package/dist/device/local/services/index.d.ts +3 -0
  163. package/dist/device/local/services/index.js +19 -0
  164. package/dist/entities/accessGroup/AccessGroup.repository.d.ts +1 -2
  165. package/dist/entities/accessGroup/AccessGroup.repository.js +1 -4
  166. package/dist/entities/accessGroup/AccessGroup.service.d.ts +1 -2
  167. package/dist/entities/accessGroup/AccessGroup.service.js +3 -4
  168. package/dist/entities/guest/Guest.repository.d.ts +1 -1
  169. package/dist/entities/guest/Guest.repository.js +2 -5
  170. package/dist/entities/guest/Guest.service.d.ts +1 -1
  171. package/dist/entities/guest/Guest.service.js +1 -4
  172. package/dist/entities/schedules/Schedule.repository.d.ts +1 -1
  173. package/dist/entities/schedules/Schedule.repository.js +2 -5
  174. package/dist/entities/schedules/Schedule.service.d.ts +1 -1
  175. package/dist/entities/schedules/Schedule.service.js +1 -4
  176. package/dist/entities/user/User.repository.js +1 -4
  177. package/dist/entities/user/User.service.d.ts +1 -1
  178. package/dist/entities/user/User.service.js +1 -4
  179. package/dist/entities/zone/Zone.service.js +1 -4
  180. package/dist/pms/IPms.d.ts +6 -0
  181. package/dist/pms/IPms.js +10 -0
  182. package/dist/pms/index.d.ts +1 -0
  183. package/dist/pms/index.js +18 -0
  184. package/dist/pms/webhookQueue/examples/index.d.ts +2 -0
  185. package/dist/pms/webhookQueue/examples/index.js +18 -0
  186. package/dist/pms/webhookQueue/examples/pms-integration.d.ts +65 -0
  187. package/dist/pms/webhookQueue/examples/pms-integration.js +254 -0
  188. package/dist/pms/webhookQueue/examples/usage.d.ts +7 -0
  189. package/dist/pms/webhookQueue/examples/usage.js +175 -0
  190. package/dist/pms/webhookQueue/index.d.ts +3 -0
  191. package/dist/pms/webhookQueue/index.js +20 -0
  192. package/dist/pms/webhookQueue/interfaces/IWebhookQueue.d.ts +33 -0
  193. package/dist/pms/webhookQueue/interfaces/IWebhookQueue.js +2 -0
  194. package/dist/pms/webhookQueue/interfaces/IWebhookWorker.d.ts +38 -0
  195. package/dist/pms/webhookQueue/interfaces/IWebhookWorker.js +2 -0
  196. package/dist/pms/webhookQueue/interfaces/index.d.ts +1 -0
  197. package/dist/pms/webhookQueue/interfaces/index.js +17 -0
  198. package/dist/pms/webhookQueue/services/WebhookQueueFactory.d.ts +38 -0
  199. package/dist/pms/webhookQueue/services/WebhookQueueFactory.js +131 -0
  200. package/dist/pms/webhookQueue/services/WebhookQueueIntegration.d.ts +70 -0
  201. package/dist/pms/webhookQueue/services/WebhookQueueIntegration.js +207 -0
  202. package/dist/pms/webhookQueue/services/WebhookQueueService.d.ts +45 -0
  203. package/dist/pms/webhookQueue/services/WebhookQueueService.js +270 -0
  204. package/dist/pms/webhookQueue/services/WebhookWorker.d.ts +37 -0
  205. package/dist/pms/webhookQueue/services/WebhookWorker.js +201 -0
  206. package/dist/pms/webhookQueue/services/index.d.ts +1 -0
  207. package/dist/pms/webhookQueue/services/index.js +17 -0
  208. package/dist/pms/webhookQueue/types/index.d.ts +1 -0
  209. package/dist/pms/webhookQueue/types/index.js +17 -0
  210. package/dist/pms/webhookQueue/types/webhook.types.d.ts +39 -0
  211. package/dist/pms/webhookQueue/types/webhook.types.js +2 -0
  212. package/dist/property/IProperty.d.ts +29 -0
  213. package/dist/property/IProperty.js +2 -0
  214. package/dist/property/Property.repository.d.ts +8 -0
  215. package/dist/property/Property.repository.js +109 -0
  216. package/dist/property/Property.service.d.ts +8 -0
  217. package/dist/property/Property.service.js +124 -0
  218. package/dist/property/index.d.ts +2 -0
  219. package/dist/property/index.js +18 -0
  220. package/dist/queue/interfaces/IHttpRequestJob.d.ts +9 -0
  221. package/dist/queue/interfaces/IHttpRequestJob.js +2 -0
  222. package/dist/queue/utils/rateLimit.utils.js +6 -0
  223. package/dist/types/alert.types.d.ts +57 -0
  224. package/dist/types/alert.types.js +22 -0
  225. package/dist/types/config.types.d.ts +19 -0
  226. package/dist/types/config.types.js +2 -0
  227. package/dist/types/index.d.ts +3 -0
  228. package/dist/types/index.js +19 -0
  229. package/dist/types/issue.types.d.ts +90 -0
  230. package/dist/types/issue.types.js +40 -0
  231. package/dist/utils/http-utils.d.ts +13 -0
  232. package/dist/utils/http-utils.js +117 -0
  233. package/package.json +1 -1
@@ -0,0 +1,40 @@
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.DeviceHubService = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const config_1 = require("../../../config/config");
9
+ class DeviceHubService {
10
+ constructor() {
11
+ const { DEVICE_SERVICE } = (0, config_1.getConfig)();
12
+ if (!DEVICE_SERVICE) {
13
+ throw new Error("DEVICE_SERVICE is not configured. Call initialize() first with DEVICE_SERVICE.");
14
+ }
15
+ this.baseUrl = DEVICE_SERVICE;
16
+ }
17
+ async addHub(body) {
18
+ return await axios_1.default.post(`${this.baseUrl}/devices/hubs`, body);
19
+ }
20
+ //get hubs takes an array of hub ids as query params
21
+ async getHubs(hubIds) {
22
+ const query = hubIds && hubIds.length ? `?ids=${hubIds.join(",")}` : "";
23
+ return await axios_1.default.get(`${this.baseUrl}/devices/hubs${query}`);
24
+ }
25
+ //get hub takes a hub id in params
26
+ async getHub(hubId) {
27
+ return await axios_1.default.get(`${this.baseUrl}/devices/hubs/${hubId}`);
28
+ }
29
+ async updateHub(hubId, body) {
30
+ return await axios_1.default.put(`${this.baseUrl}/devices/hubs/${hubId}`, body);
31
+ }
32
+ async deleteHub(hubId) {
33
+ return await axios_1.default.delete(`${this.baseUrl}/devices/hubs/${hubId}`);
34
+ }
35
+ async deleteAllHubs(hubIds) {
36
+ const query = hubIds.length ? `?ids=${hubIds.join(",")}` : "";
37
+ return await axios_1.default.delete(`${this.baseUrl}/devices/hubs${query}`);
38
+ }
39
+ }
40
+ exports.DeviceHubService = DeviceHubService;
@@ -0,0 +1,12 @@
1
+ import { IDevice } from "../interfaces";
2
+ export declare class LocalHubService {
3
+ private readonly hubRepository;
4
+ constructor();
5
+ addHub(body: Partial<IDevice>): Promise<IDevice>;
6
+ getHubs(hubIds: string[]): Promise<IDevice[]>;
7
+ getHub(hubId: string): Promise<IDevice>;
8
+ updateHub(hubId: string, body: Partial<IDevice>): Promise<IDevice>;
9
+ getStatus(hubId: string): Promise<any>;
10
+ deleteHub(hubId: string): Promise<any>;
11
+ deleteAllHubs(hubIds: string[]): Promise<any>;
12
+ }
@@ -0,0 +1,107 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.LocalHubService = void 0;
45
+ const Hub_repository_1 = require("../repository/Hub.repository");
46
+ const typedi_1 = __importDefault(require("typedi"));
47
+ const typedi_2 = require("typedi");
48
+ let LocalHubService = (() => {
49
+ let _classDecorators = [(0, typedi_2.Service)()];
50
+ let _classDescriptor;
51
+ let _classExtraInitializers = [];
52
+ let _classThis;
53
+ var LocalHubService = _classThis = class {
54
+ constructor() {
55
+ this.hubRepository = typedi_1.default.get(Hub_repository_1.HubRepository);
56
+ }
57
+ async addHub(body) {
58
+ return await this.hubRepository.addHub(body);
59
+ }
60
+ async getHubs(hubIds) {
61
+ if (!hubIds.length) {
62
+ throw new Error("At least one hub ID is required");
63
+ }
64
+ return await this.hubRepository.getHubs(hubIds);
65
+ }
66
+ async getHub(hubId) {
67
+ if (!hubId) {
68
+ throw new Error("Hub ID is required");
69
+ }
70
+ return await this.hubRepository.getHub(hubId);
71
+ }
72
+ async updateHub(hubId, body) {
73
+ if (!hubId) {
74
+ throw new Error("Hub ID is required");
75
+ }
76
+ return await this.hubRepository.updateHub(hubId, body);
77
+ }
78
+ async getStatus(hubId) {
79
+ if (!hubId) {
80
+ throw new Error("Hub ID is required");
81
+ }
82
+ return await this.hubRepository.getStatus(hubId);
83
+ }
84
+ async deleteHub(hubId) {
85
+ if (!hubId) {
86
+ throw new Error("Hub ID is required");
87
+ }
88
+ return await this.hubRepository.deleteHub(hubId);
89
+ }
90
+ async deleteAllHubs(hubIds) {
91
+ if (!hubIds.length) {
92
+ throw new Error("At least one hub ID is required");
93
+ }
94
+ return await this.hubRepository.deleteAllHubs(hubIds);
95
+ }
96
+ };
97
+ __setFunctionName(_classThis, "LocalHubService");
98
+ (() => {
99
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
100
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
101
+ LocalHubService = _classThis = _classDescriptor.value;
102
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
103
+ __runInitializers(_classThis, _classExtraInitializers);
104
+ })();
105
+ return LocalHubService = _classThis;
106
+ })();
107
+ exports.LocalHubService = LocalHubService;
@@ -0,0 +1,168 @@
1
+ import { IssueRepository } from "../repository/Issue.repository";
2
+ import { IIssueDocument } from "../models/Issue.model";
3
+ import { CreateIssueData, UpdateIssueData, AddCommentData, IssueStatus, IssuePriority, IssuesCategory, EntityType } from "../../../types/issue.types";
4
+ import { IssueBuilder } from "../entities/IssueBuilder";
5
+ export declare class IssueService {
6
+ private readonly issueRepository;
7
+ constructor(issueRepository: IssueRepository);
8
+ /**
9
+ * Create a readiness issue using IssueBuilder
10
+ */
11
+ createReadinessIssue(propertyId: string, title: string, description: string, createdBy: string, entityId?: string, entityType?: EntityType, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
12
+ /**
13
+ * Create an operations issue using IssueBuilder
14
+ */
15
+ createOperationsIssue(propertyId: string, title: string, description: string, createdBy: string, entityId?: string, entityType?: EntityType, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
16
+ /**
17
+ * Create a security issue using IssueBuilder
18
+ */
19
+ createSecurityIssue(propertyId: string, title: string, description: string, createdBy: string, entityId?: string, entityType?: EntityType, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
20
+ /**
21
+ * Create an energy issue using IssueBuilder
22
+ */
23
+ createEnergyIssue(propertyId: string, title: string, description: string, createdBy: string, entityId?: string, entityType?: EntityType, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
24
+ /**
25
+ * Create a device-specific issue using IssueBuilder
26
+ */
27
+ createDeviceIssue(deviceId: string, propertyId: string, title: string, description: string, createdBy: string, category?: IssuesCategory, priority?: IssuePriority, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
28
+ /**
29
+ * Create a hub-specific issue using IssueBuilder
30
+ */
31
+ createHubIssue(hubId: string, propertyId: string, title: string, description: string, createdBy: string, category?: IssuesCategory, priority?: IssuePriority, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
32
+ /**
33
+ * Create a user-specific issue using IssueBuilder
34
+ */
35
+ createUserIssue(userId: string, propertyId: string, title: string, description: string, createdBy: string, category?: IssuesCategory, priority?: IssuePriority, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
36
+ /**
37
+ * Create a maintenance issue using IssueBuilder
38
+ */
39
+ createMaintenanceIssue(propertyId: string, title: string, description: string, createdBy: string, entityId?: string, entityType?: EntityType, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
40
+ /**
41
+ * Create an urgent issue using IssueBuilder
42
+ */
43
+ createUrgentIssue(propertyId: string, title: string, description: string, createdBy: string, entityId?: string, entityType?: EntityType, assignedTo?: string, dueDate?: Date): Promise<IIssueDocument>;
44
+ /**
45
+ * Create a new issue with business logic validation
46
+ * Accepts either a CreateIssueData object or an IssueBuilder instance
47
+ */
48
+ createIssue(issueData: CreateIssueData | IssueBuilder): Promise<IIssueDocument>;
49
+ /**
50
+ * Get issue by ID with business logic
51
+ */
52
+ getIssueById(id: string, includeDeleted?: boolean): Promise<IIssueDocument | null>;
53
+ /**
54
+ * Get all issues with business logic filtering
55
+ */
56
+ getIssues(filters?: {
57
+ propertyId?: string;
58
+ assignedTo?: string;
59
+ status?: IssueStatus;
60
+ priority?: IssuePriority;
61
+ category?: IssuesCategory;
62
+ entityType?: EntityType;
63
+ entityId?: string;
64
+ includeDeleted?: boolean;
65
+ limit?: number;
66
+ skip?: number;
67
+ }): Promise<IIssueDocument[]>;
68
+ /**
69
+ * Update an issue with business logic validation
70
+ */
71
+ updateIssue(id: string, updateData: UpdateIssueData): Promise<IIssueDocument | null>;
72
+ /**
73
+ * Soft delete an issue with business logic
74
+ */
75
+ deleteIssue(id: string, deletedBy: string): Promise<boolean>;
76
+ /**
77
+ * Permanently delete an issue
78
+ */
79
+ permanentlyDeleteIssue(id: string): Promise<boolean>;
80
+ /**
81
+ * Add a comment with business logic
82
+ */
83
+ addComment(issueId: string, commentData: AddCommentData): Promise<IIssueDocument | null>;
84
+ /**
85
+ * Update a comment on an issue
86
+ */
87
+ updateComment(issueId: string, commentId: string, content: string, userId: string): Promise<boolean>;
88
+ /**
89
+ * Remove a comment from an issue
90
+ */
91
+ removeComment(issueId: string, commentId: string): Promise<boolean>;
92
+ /**
93
+ * Resolve an issue with business logic
94
+ */
95
+ resolveIssue(id: string, resolvedBy: string): Promise<IIssueDocument | null>;
96
+ /**
97
+ * Reopen a resolved issue
98
+ */
99
+ reopenIssue(id: string, reopenedBy: string): Promise<IIssueDocument | null>;
100
+ /**
101
+ * Assign an issue with business logic
102
+ */
103
+ assignIssue(id: string, userId: string, assignedBy: string): Promise<IIssueDocument | null>;
104
+ /**
105
+ * Unassign an issue
106
+ */
107
+ unassignIssue(id: string, unassignedBy: string): Promise<IIssueDocument | null>;
108
+ /**
109
+ * Get issues by property with business logic
110
+ */
111
+ getIssuesByProperty(propertyId: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
112
+ /**
113
+ * Get issues assigned to a user with business logic
114
+ */
115
+ getIssuesByAssignee(assignedTo: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
116
+ /**
117
+ * Get issues by entity
118
+ */
119
+ getIssuesByEntity(entityId: string, entityType: EntityType, includeDeleted?: boolean): Promise<IIssueDocument[]>;
120
+ /**
121
+ * Get issues by status
122
+ */
123
+ getIssuesByStatus(status: IssueStatus, includeDeleted?: boolean): Promise<IIssueDocument[]>;
124
+ /**
125
+ * Get issues by priority
126
+ */
127
+ getIssuesByPriority(priority: IssuePriority, includeDeleted?: boolean): Promise<IIssueDocument[]>;
128
+ /**
129
+ * Get overdue issues with business logic
130
+ */
131
+ getOverdueIssues(includeDeleted?: boolean): Promise<IIssueDocument[]>;
132
+ /**
133
+ * Get upcoming issues (due within specified days)
134
+ */
135
+ getUpcomingIssues(days?: number, includeDeleted?: boolean): Promise<IIssueDocument[]>;
136
+ /**
137
+ * Get issue statistics with business logic
138
+ */
139
+ getIssueStatistics(propertyId?: string): Promise<{
140
+ total: number;
141
+ pending: number;
142
+ inProgress: number;
143
+ resolved: number;
144
+ closed: number;
145
+ overdue: number;
146
+ byPriority: Record<IssuePriority, number>;
147
+ byCategory: Record<IssuesCategory, number>;
148
+ }>;
149
+ /**
150
+ * Search issues with business logic
151
+ */
152
+ searchIssues(searchTerm: string, filters?: {
153
+ propertyId?: string;
154
+ includeDeleted?: boolean;
155
+ limit?: number;
156
+ skip?: number;
157
+ }): Promise<IIssueDocument[]>;
158
+ private validateIssueData;
159
+ private validateFilters;
160
+ private validateUpdateData;
161
+ private validateStatusTransition;
162
+ private validatePriorityChange;
163
+ private determineDefaultPriority;
164
+ private applyBusinessRules;
165
+ private shouldUpdateStatusOnComment;
166
+ private calculateAverageResponseTime;
167
+ private calculateResolutionRate;
168
+ }