dt-common-device 11.2.2 → 11.3.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 (233) hide show
  1. package/dist/chronicle/Cronicle.service.d.ts +6 -2
  2. package/dist/chronicle/Cronicle.service.js +19 -2
  3. package/dist/chronicle/ICronicle.interface.d.ts +1 -0
  4. package/dist/constants/ConnectionProviders.d.ts +1 -0
  5. package/dist/constants/ConnectionProviders.js +1 -0
  6. package/dist/entities/accessGroup/AccessGroup.repository.d.ts +2 -1
  7. package/dist/entities/accessGroup/AccessGroup.repository.js +4 -1
  8. package/dist/entities/accessGroup/AccessGroup.service.d.ts +2 -1
  9. package/dist/entities/accessGroup/AccessGroup.service.js +4 -3
  10. package/dist/entities/guest/Guest.repository.d.ts +1 -1
  11. package/dist/entities/guest/Guest.repository.js +5 -2
  12. package/dist/entities/guest/Guest.service.d.ts +1 -1
  13. package/dist/entities/guest/Guest.service.js +4 -1
  14. package/dist/entities/pms/IPms.d.ts +2 -1
  15. package/dist/entities/pms/IPms.js +1 -0
  16. package/dist/entities/schedules/Schedule.repository.d.ts +1 -1
  17. package/dist/entities/schedules/Schedule.repository.js +5 -2
  18. package/dist/entities/schedules/Schedule.service.d.ts +1 -1
  19. package/dist/entities/schedules/Schedule.service.js +4 -1
  20. package/dist/entities/user/User.repository.js +4 -1
  21. package/dist/entities/user/User.service.d.ts +1 -1
  22. package/dist/entities/user/User.service.js +4 -1
  23. package/dist/entities/zone/Zone.service.js +4 -1
  24. package/dist/issues/issue.types.d.ts +1 -0
  25. package/dist/issues/issue.types.js +1 -0
  26. package/dist/queue/utils/rateLimit.utils.js +6 -0
  27. package/package.json +1 -1
  28. package/dist/admin/Admin.repository.d.ts +0 -7
  29. package/dist/admin/Admin.repository.js +0 -182
  30. package/dist/admin/Admin.service.d.ts +0 -5
  31. package/dist/admin/Admin.service.js +0 -17
  32. package/dist/admin/index.d.ts +0 -1
  33. package/dist/admin/index.js +0 -17
  34. package/dist/audit/AuditProperties.d.ts +0 -16
  35. package/dist/audit/AuditProperties.js +0 -2
  36. package/dist/chronicle/IChronicle.interface.d.ts +0 -14
  37. package/dist/chronicle/IChronicle.interface.js +0 -2
  38. package/dist/chronicle/chronicle.service.d.ts +0 -4
  39. package/dist/chronicle/chronicle.service.js +0 -44
  40. package/dist/connection/Connection.repository.d.ts +0 -8
  41. package/dist/connection/Connection.repository.js +0 -92
  42. package/dist/connection/Connection.service.d.ts +0 -8
  43. package/dist/connection/Connection.service.js +0 -32
  44. package/dist/connection/IConnection.d.ts +0 -28
  45. package/dist/connection/IConnection.js +0 -16
  46. package/dist/connection/index.d.ts +0 -2
  47. package/dist/connection/index.js +0 -18
  48. package/dist/copilotQueue/examples/CopilotQueue.example.d.ts +0 -37
  49. package/dist/copilotQueue/examples/CopilotQueue.example.js +0 -140
  50. package/dist/copilotQueue/examples/index.d.ts +0 -1
  51. package/dist/copilotQueue/examples/index.js +0 -17
  52. package/dist/device/cloud/entities/CloudConnection.d.ts +0 -6
  53. package/dist/device/cloud/entities/CloudConnection.js +0 -6
  54. package/dist/device/cloud/entities/CloudDevice.d.ts +0 -16
  55. package/dist/device/cloud/entities/CloudDevice.js +0 -26
  56. package/dist/device/cloud/entities/CloudDeviceService.d.ts +0 -5
  57. package/dist/device/cloud/entities/CloudDeviceService.js +0 -9
  58. package/dist/device/cloud/entities/DeviceFactory.d.ts +0 -7
  59. package/dist/device/cloud/entities/DeviceFactory.js +0 -80
  60. package/dist/device/cloud/entities/index.d.ts +0 -3
  61. package/dist/device/cloud/entities/index.js +0 -19
  62. package/dist/device/cloud/interface.d.ts +0 -101
  63. package/dist/device/cloud/interface.js +0 -3
  64. package/dist/device/cloud/interfaces/ICloudConnection.d.ts +0 -5
  65. package/dist/device/cloud/interfaces/ICloudConnection.js +0 -2
  66. package/dist/device/cloud/interfaces/ICloudDevice.d.ts +0 -9
  67. package/dist/device/cloud/interfaces/ICloudDevice.js +0 -2
  68. package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +0 -4
  69. package/dist/device/cloud/interfaces/ICloudDeviceService.js +0 -2
  70. package/dist/device/cloud/interfaces/IConnectionService.d.ts +0 -7
  71. package/dist/device/cloud/interfaces/IConnectionService.js +0 -2
  72. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +0 -7
  73. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +0 -3
  74. package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +0 -4
  75. package/dist/device/cloud/interfaces/IDeviceFactory.js +0 -2
  76. package/dist/device/cloud/interfaces/IDeviceService.d.ts +0 -8
  77. package/dist/device/cloud/interfaces/IDeviceService.js +0 -2
  78. package/dist/device/cloud/interfaces/IDevicesService.d.ts +0 -9
  79. package/dist/device/cloud/interfaces/IDevicesService.js +0 -2
  80. package/dist/device/cloud/interfaces/IHubService.d.ts +0 -5
  81. package/dist/device/cloud/interfaces/IHubService.js +0 -2
  82. package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +0 -4
  83. package/dist/device/cloud/interfaces/IRawDataTransformer.js +0 -2
  84. package/dist/device/cloud/interfaces/IRawDevice.d.ts +0 -17
  85. package/dist/device/cloud/interfaces/IRawDevice.js +0 -11
  86. package/dist/device/cloud/interfaces/index.d.ts +0 -5
  87. package/dist/device/cloud/interfaces/index.js +0 -21
  88. package/dist/device/cloud/services/CloudDevice.service.d.ts +0 -5
  89. package/dist/device/cloud/services/CloudDevice.service.js +0 -9
  90. package/dist/device/cloud/services/Connection.service.d.ts +0 -8
  91. package/dist/device/cloud/services/Connection.service.js +0 -6
  92. package/dist/device/cloud/services/Device.service.d.ts +0 -39
  93. package/dist/device/cloud/services/Device.service.js +0 -9
  94. package/dist/device/cloud/services/DeviceCloudService.d.ts +0 -42
  95. package/dist/device/cloud/services/DeviceCloudService.js +0 -59
  96. package/dist/device/cloud/services/DeviceHub.service.d.ts +0 -3
  97. package/dist/device/cloud/services/DeviceHub.service.js +0 -6
  98. package/dist/device/cloud/services/Hub.service.d.ts +0 -25
  99. package/dist/device/cloud/services/Hub.service.js +0 -9
  100. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +0 -38
  101. package/dist/device/cloud/services/SmartThingsDeviceService.js +0 -52
  102. package/dist/device/cloud/services/index.d.ts +0 -2
  103. package/dist/device/cloud/services/index.js +0 -18
  104. package/dist/device/cloud/types.d.ts +0 -52
  105. package/dist/device/cloud/types.js +0 -15
  106. package/dist/device/index.d.ts +0 -4
  107. package/dist/device/index.js +0 -20
  108. package/dist/device/local/entities/AlertBuilder.d.ts +0 -87
  109. package/dist/device/local/entities/AlertBuilder.example.d.ts +0 -11
  110. package/dist/device/local/entities/AlertBuilder.example.js +0 -117
  111. package/dist/device/local/entities/AlertBuilder.js +0 -179
  112. package/dist/device/local/entities/IssueBuilder.d.ts +0 -109
  113. package/dist/device/local/entities/IssueBuilder.example.d.ts +0 -16
  114. package/dist/device/local/entities/IssueBuilder.example.js +0 -196
  115. package/dist/device/local/entities/IssueBuilder.js +0 -237
  116. package/dist/device/local/entities/index.d.ts +0 -2
  117. package/dist/device/local/entities/index.js +0 -7
  118. package/dist/device/local/events/EventHandler.d.ts +0 -11
  119. package/dist/device/local/events/EventHandler.js +0 -86
  120. package/dist/device/local/events/Events.d.ts +0 -54
  121. package/dist/device/local/events/Events.js +0 -57
  122. package/dist/device/local/events/index.d.ts +0 -2
  123. package/dist/device/local/events/index.js +0 -7
  124. package/dist/device/local/handler/EventHandler.d.ts +0 -7
  125. package/dist/device/local/handler/EventHandler.js +0 -44
  126. package/dist/device/local/interface.d.ts +0 -0
  127. package/dist/device/local/interface.js +0 -1
  128. package/dist/device/local/interfaces/IConnection.d.ts +0 -26
  129. package/dist/device/local/interfaces/IConnection.js +0 -14
  130. package/dist/device/local/interfaces/IDevice.d.ts +0 -68
  131. package/dist/device/local/interfaces/IDevice.js +0 -10
  132. package/dist/device/local/interfaces/IDtDevice.d.ts +0 -16
  133. package/dist/device/local/interfaces/IDtDevice.js +0 -2
  134. package/dist/device/local/interfaces/IHub.d.ts +0 -46
  135. package/dist/device/local/interfaces/IHub.js +0 -2
  136. package/dist/device/local/interfaces/IProperty.d.ts +0 -29
  137. package/dist/device/local/interfaces/IProperty.js +0 -2
  138. package/dist/device/local/interfaces/ISchedule.d.ts +0 -25
  139. package/dist/device/local/interfaces/ISchedule.js +0 -2
  140. package/dist/device/local/interfaces/index.d.ts +0 -3
  141. package/dist/device/local/interfaces/index.js +0 -19
  142. package/dist/device/local/models/Alert.model.d.ts +0 -28
  143. package/dist/device/local/models/Alert.model.js +0 -222
  144. package/dist/device/local/models/Issue.model.d.ts +0 -28
  145. package/dist/device/local/models/Issue.model.js +0 -260
  146. package/dist/device/local/repository/Alert.repository.d.ts +0 -106
  147. package/dist/device/local/repository/Alert.repository.js +0 -374
  148. package/dist/device/local/repository/Connection.repository.d.ts +0 -8
  149. package/dist/device/local/repository/Connection.repository.js +0 -92
  150. package/dist/device/local/repository/Device.repository.d.ts +0 -30
  151. package/dist/device/local/repository/Device.repository.js +0 -325
  152. package/dist/device/local/repository/Hub.repository.d.ts +0 -13
  153. package/dist/device/local/repository/Hub.repository.js +0 -139
  154. package/dist/device/local/repository/Issue.repository.d.ts +0 -113
  155. package/dist/device/local/repository/Issue.repository.js +0 -401
  156. package/dist/device/local/repository/Property.repository.d.ts +0 -8
  157. package/dist/device/local/repository/Property.repository.js +0 -95
  158. package/dist/device/local/repository/Schedule.repository.d.ts +0 -9
  159. package/dist/device/local/repository/Schedule.repository.js +0 -109
  160. package/dist/device/local/services/Alert.service.d.ts +0 -137
  161. package/dist/device/local/services/Alert.service.js +0 -475
  162. package/dist/device/local/services/AlertService.example.d.ts +0 -55
  163. package/dist/device/local/services/AlertService.example.js +0 -148
  164. package/dist/device/local/services/Connection.service.d.ts +0 -8
  165. package/dist/device/local/services/Connection.service.js +0 -32
  166. package/dist/device/local/services/Device.service.d.ts +0 -40
  167. package/dist/device/local/services/Device.service.js +0 -391
  168. package/dist/device/local/services/DeviceHub.service.d.ts +0 -11
  169. package/dist/device/local/services/DeviceHub.service.js +0 -40
  170. package/dist/device/local/services/Hub.service.d.ts +0 -12
  171. package/dist/device/local/services/Hub.service.js +0 -107
  172. package/dist/device/local/services/Issue.service.d.ts +0 -168
  173. package/dist/device/local/services/Issue.service.js +0 -642
  174. package/dist/device/local/services/IssueService.example.d.ts +0 -68
  175. package/dist/device/local/services/IssueService.example.js +0 -177
  176. package/dist/device/local/services/Property.service.d.ts +0 -8
  177. package/dist/device/local/services/Property.service.js +0 -36
  178. package/dist/device/local/services/Schedule.service.d.ts +0 -9
  179. package/dist/device/local/services/Schedule.service.js +0 -26
  180. package/dist/device/local/services/index.d.ts +0 -3
  181. package/dist/device/local/services/index.js +0 -19
  182. package/dist/pms/IPms.d.ts +0 -6
  183. package/dist/pms/IPms.js +0 -10
  184. package/dist/pms/index.d.ts +0 -1
  185. package/dist/pms/index.js +0 -18
  186. package/dist/pms/webhookQueue/examples/index.d.ts +0 -2
  187. package/dist/pms/webhookQueue/examples/index.js +0 -18
  188. package/dist/pms/webhookQueue/examples/pms-integration.d.ts +0 -65
  189. package/dist/pms/webhookQueue/examples/pms-integration.js +0 -254
  190. package/dist/pms/webhookQueue/examples/usage.d.ts +0 -7
  191. package/dist/pms/webhookQueue/examples/usage.js +0 -175
  192. package/dist/pms/webhookQueue/index.d.ts +0 -3
  193. package/dist/pms/webhookQueue/index.js +0 -20
  194. package/dist/pms/webhookQueue/interfaces/IWebhookQueue.d.ts +0 -33
  195. package/dist/pms/webhookQueue/interfaces/IWebhookQueue.js +0 -2
  196. package/dist/pms/webhookQueue/interfaces/IWebhookWorker.d.ts +0 -38
  197. package/dist/pms/webhookQueue/interfaces/IWebhookWorker.js +0 -2
  198. package/dist/pms/webhookQueue/interfaces/index.d.ts +0 -1
  199. package/dist/pms/webhookQueue/interfaces/index.js +0 -17
  200. package/dist/pms/webhookQueue/services/WebhookQueueFactory.d.ts +0 -38
  201. package/dist/pms/webhookQueue/services/WebhookQueueFactory.js +0 -131
  202. package/dist/pms/webhookQueue/services/WebhookQueueIntegration.d.ts +0 -70
  203. package/dist/pms/webhookQueue/services/WebhookQueueIntegration.js +0 -207
  204. package/dist/pms/webhookQueue/services/WebhookQueueService.d.ts +0 -45
  205. package/dist/pms/webhookQueue/services/WebhookQueueService.js +0 -270
  206. package/dist/pms/webhookQueue/services/WebhookWorker.d.ts +0 -37
  207. package/dist/pms/webhookQueue/services/WebhookWorker.js +0 -201
  208. package/dist/pms/webhookQueue/services/index.d.ts +0 -1
  209. package/dist/pms/webhookQueue/services/index.js +0 -17
  210. package/dist/pms/webhookQueue/types/index.d.ts +0 -1
  211. package/dist/pms/webhookQueue/types/index.js +0 -17
  212. package/dist/pms/webhookQueue/types/webhook.types.d.ts +0 -39
  213. package/dist/pms/webhookQueue/types/webhook.types.js +0 -2
  214. package/dist/property/IProperty.d.ts +0 -29
  215. package/dist/property/IProperty.js +0 -2
  216. package/dist/property/Property.repository.d.ts +0 -8
  217. package/dist/property/Property.repository.js +0 -109
  218. package/dist/property/Property.service.d.ts +0 -8
  219. package/dist/property/Property.service.js +0 -124
  220. package/dist/property/index.d.ts +0 -2
  221. package/dist/property/index.js +0 -18
  222. package/dist/queue/interfaces/IHttpRequestJob.d.ts +0 -9
  223. package/dist/queue/interfaces/IHttpRequestJob.js +0 -2
  224. package/dist/types/alert.types.d.ts +0 -57
  225. package/dist/types/alert.types.js +0 -22
  226. package/dist/types/config.types.d.ts +0 -19
  227. package/dist/types/config.types.js +0 -2
  228. package/dist/types/index.d.ts +0 -3
  229. package/dist/types/index.js +0 -19
  230. package/dist/types/issue.types.d.ts +0 -90
  231. package/dist/types/issue.types.js +0 -40
  232. package/dist/utils/http-utils.d.ts +0 -13
  233. package/dist/utils/http-utils.js +0 -117
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventHandler = void 0;
4
- const dt_pub_sub_1 = require("dt-pub-sub");
5
- const dt_audit_library_1 = require("dt-audit-library");
6
- class EventHandler {
7
- constructor() {
8
- this.source = "dt-common-device";
9
- }
10
- async onStateChange(deviceId, state) {
11
- await dt_pub_sub_1.eventDispatcher.publishEvent("device.state.set", { deviceId, state }, this.source);
12
- const payload = {
13
- eventType: "device.state.set",
14
- properties: {
15
- deviceId,
16
- state,
17
- },
18
- };
19
- await (0, dt_audit_library_1.publishAudit)(payload);
20
- }
21
- async onStatusChange(deviceId, status) {
22
- await dt_pub_sub_1.eventDispatcher.publishEvent("device.status.set", { deviceId, status }, this.source);
23
- const payload = {
24
- eventType: "device.status.set",
25
- properties: {
26
- deviceId,
27
- status,
28
- },
29
- };
30
- await (0, dt_audit_library_1.publishAudit)(payload);
31
- }
32
- async onBatteryLevelChange(deviceId, batteryLevel) {
33
- await dt_pub_sub_1.eventDispatcher.publishEvent("device.battery.set", { deviceId, batteryLevel }, this.source);
34
- const payload = {
35
- eventType: "device.battery.set",
36
- properties: {
37
- deviceId,
38
- batteryLevel,
39
- },
40
- };
41
- await (0, dt_audit_library_1.publishAudit)(payload);
42
- }
43
- }
44
- exports.EventHandler = EventHandler;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,26 +0,0 @@
1
- export interface IConnection {
2
- id?: string;
3
- createdAt?: Date;
4
- updatedAt?: Date;
5
- isDeleted?: boolean;
6
- connectionName: string;
7
- connectionRefId: string;
8
- propertyId: string;
9
- connectionProvider: ConnectionProvider;
10
- accessToken?: string;
11
- refreshToken?: string;
12
- clientId?: string;
13
- clientSecret: string;
14
- isActive?: boolean;
15
- metaData?: any;
16
- }
17
- export declare enum ConnectionProvider {
18
- Smartthings = "Smartthings",
19
- SaltoKS = "SaltoKS",
20
- TTLock = "TTLock",
21
- Tuya = "Tuya",
22
- Schlage = "Schlage",
23
- YaleWifi = "YaleWifi",
24
- Sensibo = "Sensibo",
25
- Devicethread = "Devicethread"
26
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConnectionProvider = void 0;
4
- var ConnectionProvider;
5
- (function (ConnectionProvider) {
6
- ConnectionProvider["Smartthings"] = "Smartthings";
7
- ConnectionProvider["SaltoKS"] = "SaltoKS";
8
- ConnectionProvider["TTLock"] = "TTLock";
9
- ConnectionProvider["Tuya"] = "Tuya";
10
- ConnectionProvider["Schlage"] = "Schlage";
11
- ConnectionProvider["YaleWifi"] = "YaleWifi";
12
- ConnectionProvider["Sensibo"] = "Sensibo";
13
- ConnectionProvider["Devicethread"] = "Devicethread";
14
- })(ConnectionProvider || (exports.ConnectionProvider = ConnectionProvider = {}));
@@ -1,68 +0,0 @@
1
- export interface IDevice {
2
- deviceId: string;
3
- propertyId: string;
4
- zoneId: string;
5
- name: string;
6
- hubId: string[];
7
- specifications: {
8
- manufacturer?: string;
9
- model?: string;
10
- firmware?: {
11
- version?: string;
12
- newVersionAvailable?: boolean;
13
- newVersion?: string;
14
- mandatoryUpdate?: boolean;
15
- };
16
- };
17
- protocol: {
18
- location?: {
19
- id?: string;
20
- name?: string;
21
- city?: string;
22
- };
23
- name?: string;
24
- room?: {
25
- id?: string;
26
- name?: string;
27
- };
28
- accountId?: string;
29
- };
30
- connection: {
31
- id: string;
32
- name: string;
33
- };
34
- deviceType: {
35
- id: string;
36
- type: string;
37
- };
38
- status: IStatus;
39
- isActive: {
40
- value: boolean;
41
- lastUpdated: string;
42
- };
43
- state?: Record<string, any>;
44
- metaData?: Record<string, any>;
45
- createdAt?: Date;
46
- updatedAt?: Date;
47
- hubDeviceDetails?: IDevice[];
48
- capabilities?: Record<string, any>;
49
- }
50
- export declare class IStatus {
51
- online: boolean;
52
- liveStatus?: "ONLINE" | "OFFLINE";
53
- error?: {
54
- type?: string;
55
- message?: string;
56
- default?: object;
57
- };
58
- lastUpdated?: string;
59
- }
60
- export interface IStatusQuery {
61
- deviceIds?: string[];
62
- zoneId?: string;
63
- propertyId?: string;
64
- }
65
- export interface IStatusUpdateRequest {
66
- query: IStatusQuery;
67
- status: IStatus;
68
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // Interfaces for DeviceService methods
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IStatus = void 0;
5
- class IStatus {
6
- constructor() {
7
- this.online = false;
8
- }
9
- }
10
- exports.IStatus = IStatus;
@@ -1,16 +0,0 @@
1
- export interface IDtDevice {
2
- id: string;
3
- name: string;
4
- type: string;
5
- zoneId: string;
6
- deviceType: string;
7
- deviceId: string;
8
- deviceNetworkId: string;
9
- propertyId: string;
10
- connectionId: string;
11
- hubId: string;
12
- isBatteryLowAlertSent: boolean;
13
- createdAt: string;
14
- updatedAt: string;
15
- isActive: boolean;
16
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,46 +0,0 @@
1
- export interface IHub {
2
- deviceId: string;
3
- propertyId: string;
4
- name: string;
5
- hubId?: string[];
6
- specifications: {
7
- manufacturer?: string;
8
- model?: string;
9
- firmware?: {
10
- version?: string;
11
- newVersionAvailable?: boolean;
12
- newVersion?: string;
13
- mandatoryUpdate?: boolean;
14
- };
15
- };
16
- protocol: {
17
- location?: {
18
- id?: string;
19
- name?: string;
20
- city?: string;
21
- };
22
- name?: string;
23
- room?: {
24
- id?: string;
25
- name?: string;
26
- };
27
- accountId?: string;
28
- };
29
- deviceType: {
30
- id: string;
31
- type: string;
32
- };
33
- status: {
34
- online: boolean;
35
- error?: {
36
- type?: string;
37
- message?: string;
38
- default?: object;
39
- };
40
- lastUpdated?: Date;
41
- };
42
- state?: object;
43
- metaData?: object;
44
- createdAt?: Date;
45
- updatedAt?: Date;
46
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,25 +0,0 @@
1
- export interface ISchedule {
2
- id?: string;
3
- name: string;
4
- deviceId: string;
5
- scheduleId: string | null;
6
- state: {
7
- targetTemperature?: number;
8
- temperatureUnit?: "C" | "F";
9
- mode?: "cool" | "heat" | "fan" | "dry" | "auto";
10
- swing?: "stopped" | "rangeFull" | "fixedTop" | "fixedMiddleTop" | "fixedMiddle" | "fixedMiddleBottom" | "fixedBottom";
11
- fanLevel?: "auto" | "low" | "medium" | "high";
12
- };
13
- startTime: string;
14
- endTime: string;
15
- recurringDays: ("Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday")[];
16
- createTime?: string;
17
- nextTime?: string;
18
- nextTimeSecondsFromNow?: number;
19
- targetTimeLocal: string;
20
- timezone: string;
21
- scheduleInheritedFrom: "zone" | "device";
22
- zoneId: string;
23
- userId: string;
24
- status?: "SET" | "UNSET";
25
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export * from "./IDevice";
2
- export * from "./IDtDevice";
3
- export * from "./ISchedule";
@@ -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("./IDevice"), exports);
18
- __exportStar(require("./IDtDevice"), exports);
19
- __exportStar(require("./ISchedule"), exports);
@@ -1,28 +0,0 @@
1
- import mongoose, { Model } from "mongoose";
2
- import { AlertCategory, AlertSeverity, EntityType, AlertDocument as IAlertDocument, CreateAlertData, UpdateAlertData } from "../../../types/alert.types";
3
- interface IAlertMethods {
4
- markAsRead(updatedBy: string): void;
5
- markAsUnread(updatedBy: string): void;
6
- activate(updatedBy: string): void;
7
- deactivate(updatedBy: string): void;
8
- snooze(until: Date, updatedBy: string): void;
9
- unsnooze(updatedBy: string): void;
10
- }
11
- interface IAlertModel extends Model<IAlertDocument, {}, IAlertMethods> {
12
- findByProperty(propertyId: string, includeDeleted?: boolean): Promise<IAlertDocument[]>;
13
- findByEntity(entityId: string, entityType: EntityType, includeDeleted?: boolean): Promise<IAlertDocument[]>;
14
- findByCategory(category: AlertCategory, includeDeleted?: boolean): Promise<IAlertDocument[]>;
15
- findBySeverity(severity: AlertSeverity, includeDeleted?: boolean): Promise<IAlertDocument[]>;
16
- findActive(includeDeleted?: boolean): Promise<IAlertDocument[]>;
17
- findUnread(includeDeleted?: boolean): Promise<IAlertDocument[]>;
18
- findSnoozed(includeDeleted?: boolean): Promise<IAlertDocument[]>;
19
- findExpiredSnooze(includeDeleted?: boolean): Promise<IAlertDocument[]>;
20
- }
21
- declare const AlertSchema: mongoose.Schema<IAlertDocument, IAlertModel, IAlertMethods, {}, {}, {}, mongoose.DefaultSchemaOptions, IAlertDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAlertDocument>, {}> & Omit<mongoose.FlatRecord<IAlertDocument> & Required<{
22
- _id: string;
23
- }> & {
24
- __v: number;
25
- }, keyof IAlertMethods> & IAlertMethods>;
26
- export declare const AlertModel: IAlertModel;
27
- export { AlertSchema };
28
- export type { IAlertDocument, CreateAlertData, UpdateAlertData, IAlertMethods, IAlertModel, };
@@ -1,222 +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 __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 __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.AlertSchema = exports.AlertModel = void 0;
37
- const mongoose_1 = __importStar(require("mongoose"));
38
- const alert_types_1 = require("../../../types/alert.types");
39
- // Main Alert schema
40
- const AlertSchema = new mongoose_1.Schema({
41
- category: {
42
- type: String,
43
- enum: Object.values(alert_types_1.AlertCategory),
44
- required: true,
45
- },
46
- propertyId: {
47
- type: String,
48
- required: true,
49
- index: true,
50
- },
51
- title: {
52
- type: String,
53
- required: true,
54
- trim: true,
55
- },
56
- description: {
57
- type: String,
58
- required: true,
59
- trim: true,
60
- },
61
- entityId: {
62
- type: String,
63
- index: true,
64
- },
65
- entityType: {
66
- type: String,
67
- enum: Object.values(alert_types_1.EntityType),
68
- required: true,
69
- index: true,
70
- },
71
- severity: {
72
- type: String,
73
- enum: Object.values(alert_types_1.AlertSeverity),
74
- default: alert_types_1.AlertSeverity.MEDIUM,
75
- },
76
- isRead: {
77
- type: Boolean,
78
- default: false,
79
- index: true,
80
- },
81
- isActive: {
82
- type: Boolean,
83
- default: true,
84
- index: true,
85
- },
86
- isDeleted: {
87
- type: Boolean,
88
- default: false,
89
- },
90
- snoozeUntil: {
91
- type: Date,
92
- },
93
- createdBy: {
94
- type: String,
95
- },
96
- updatedBy: {
97
- type: String,
98
- },
99
- createdAt: {
100
- type: Date,
101
- default: Date.now,
102
- },
103
- updatedAt: {
104
- type: Date,
105
- default: Date.now,
106
- },
107
- }, {
108
- timestamps: true,
109
- collection: "dt_alerts",
110
- });
111
- exports.AlertSchema = AlertSchema;
112
- // Compound indexes to match Prisma schema
113
- AlertSchema.index({ propertyId: 1, isActive: 1, isRead: 1 });
114
- AlertSchema.index({ entityId: 1, entityType: 1 });
115
- AlertSchema.index({ createdAt: 1 });
116
- // Pre-save middleware to update the updatedAt field
117
- AlertSchema.pre("save", function (next) {
118
- this.updatedAt = new Date();
119
- next();
120
- });
121
- // Pre-update middleware to update the updatedAt field
122
- AlertSchema.pre(["updateOne", "findOneAndUpdate", "updateMany"], function (next) {
123
- this.set({ updatedAt: new Date() });
124
- next();
125
- });
126
- // Instance methods
127
- AlertSchema.methods.markAsRead = function (updatedBy) {
128
- this.isRead = true;
129
- this.updatedBy = updatedBy;
130
- };
131
- AlertSchema.methods.markAsUnread = function (updatedBy) {
132
- this.isRead = false;
133
- this.updatedBy = updatedBy;
134
- };
135
- AlertSchema.methods.activate = function (updatedBy) {
136
- this.isActive = true;
137
- this.updatedBy = updatedBy;
138
- };
139
- AlertSchema.methods.deactivate = function (updatedBy) {
140
- this.isActive = false;
141
- this.updatedBy = updatedBy;
142
- };
143
- AlertSchema.methods.snooze = function (until, updatedBy) {
144
- this.snoozeUntil = until;
145
- this.updatedBy = updatedBy;
146
- };
147
- AlertSchema.methods.unsnooze = function (updatedBy) {
148
- this.snoozeUntil = undefined;
149
- this.updatedBy = updatedBy;
150
- };
151
- // Static methods
152
- AlertSchema.statics.findByProperty = function (propertyId, includeDeleted = false) {
153
- const query = { propertyId };
154
- if (!includeDeleted) {
155
- query.isDeleted = false;
156
- }
157
- return this.find(query).sort({ createdAt: -1 });
158
- };
159
- AlertSchema.statics.findByEntity = function (entityId, entityType, includeDeleted = false) {
160
- const query = { entityId, entityType };
161
- if (!includeDeleted) {
162
- query.isDeleted = false;
163
- }
164
- return this.find(query).sort({ createdAt: -1 });
165
- };
166
- AlertSchema.statics.findByCategory = function (category, includeDeleted = false) {
167
- const query = { category };
168
- if (!includeDeleted) {
169
- query.isDeleted = false;
170
- }
171
- return this.find(query).sort({ createdAt: -1 });
172
- };
173
- AlertSchema.statics.findBySeverity = function (severity, includeDeleted = false) {
174
- const query = { severity };
175
- if (!includeDeleted) {
176
- query.isDeleted = false;
177
- }
178
- return this.find(query).sort({ severity: -1, createdAt: -1 });
179
- };
180
- AlertSchema.statics.findActive = function (includeDeleted = false) {
181
- const query = { isActive: true };
182
- if (!includeDeleted) {
183
- query.isDeleted = false;
184
- }
185
- return this.find(query).sort({ severity: -1, createdAt: -1 });
186
- };
187
- AlertSchema.statics.findUnread = function (includeDeleted = false) {
188
- const query = { isRead: false };
189
- if (!includeDeleted) {
190
- query.isDeleted = false;
191
- }
192
- return this.find(query).sort({ severity: -1, createdAt: -1 });
193
- };
194
- AlertSchema.statics.findSnoozed = function (includeDeleted = false) {
195
- const query = { snoozeUntil: { $exists: true, $ne: null } };
196
- if (!includeDeleted) {
197
- query.isDeleted = false;
198
- }
199
- return this.find(query).sort({ snoozeUntil: 1 });
200
- };
201
- AlertSchema.statics.findExpiredSnooze = function (includeDeleted = false) {
202
- const query = {
203
- snoozeUntil: { $lt: new Date() },
204
- isActive: true,
205
- };
206
- if (!includeDeleted) {
207
- query.isDeleted = false;
208
- }
209
- return this.find(query).sort({ snoozeUntil: 1 });
210
- };
211
- // Virtual for snooze status
212
- AlertSchema.virtual("isSnoozed").get(function () {
213
- return this.snoozeUntil && this.snoozeUntil > new Date();
214
- });
215
- AlertSchema.virtual("isSnoozeExpired").get(function () {
216
- return this.snoozeUntil && this.snoozeUntil <= new Date();
217
- });
218
- // Ensure virtuals are serialized
219
- AlertSchema.set("toJSON", { virtuals: true });
220
- AlertSchema.set("toObject", { virtuals: true });
221
- // Create and export the model
222
- exports.AlertModel = mongoose_1.default.model("Alert", AlertSchema);
@@ -1,28 +0,0 @@
1
- import mongoose, { Model } from "mongoose";
2
- import { EntityType, IssueStatus, IssuePriority, IssueDocument as IIssueDocument, CreateIssueData, UpdateIssueData, AddCommentData } from "../../../types/issue.types";
3
- interface IIssueMethods {
4
- addComment(commentData: AddCommentData): void;
5
- updateComment(commentId: string, content: string, userId: string): boolean;
6
- removeComment(commentId: string): boolean;
7
- resolve(resolvedBy: string): void;
8
- reopen(updatedBy: string): void;
9
- assign(userId: string, assignedBy: string): void;
10
- unassign(unassignedBy: string): void;
11
- }
12
- interface IIssueModel extends Model<IIssueDocument, {}, IIssueMethods> {
13
- findByProperty(propertyId: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
14
- findByAssignee(assignedTo: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
15
- findByEntity(entityId: string, entityType: EntityType, includeDeleted?: boolean): Promise<IIssueDocument[]>;
16
- findByStatus(status: IssueStatus, includeDeleted?: boolean): Promise<IIssueDocument[]>;
17
- findByPriority(priority: IssuePriority, includeDeleted?: boolean): Promise<IIssueDocument[]>;
18
- findOverdue(includeDeleted?: boolean): Promise<IIssueDocument[]>;
19
- findUpcoming(days?: number, includeDeleted?: boolean): Promise<IIssueDocument[]>;
20
- }
21
- declare const IssueSchema: mongoose.Schema<IIssueDocument, IIssueModel, IIssueMethods, {}, {}, {}, mongoose.DefaultSchemaOptions, IIssueDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<IIssueDocument>, {}> & Omit<mongoose.FlatRecord<IIssueDocument> & Required<{
22
- _id: string;
23
- }> & {
24
- __v: number;
25
- }, keyof IIssueMethods> & IIssueMethods>;
26
- export declare const IssueModel: IIssueModel;
27
- export { IssueSchema };
28
- export type { IIssueDocument, CreateIssueData, UpdateIssueData, AddCommentData, IIssueMethods, IIssueModel, };