dt-common-device 5.0.3 → 5.0.4

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 (174) hide show
  1. package/dist/config/config.js +33 -11
  2. package/dist/config/constants.d.ts +1 -1
  3. package/dist/config/constants.js +5 -5
  4. package/package.json +1 -1
  5. package/dist/admin/Admin.repository.d.ts +0 -7
  6. package/dist/admin/Admin.repository.js +0 -182
  7. package/dist/admin/Admin.service.d.ts +0 -5
  8. package/dist/admin/Admin.service.js +0 -17
  9. package/dist/admin/index.d.ts +0 -1
  10. package/dist/admin/index.js +0 -17
  11. package/dist/audit/AuditProperties.d.ts +0 -16
  12. package/dist/audit/AuditProperties.js +0 -2
  13. package/dist/connection/Connection.repository.d.ts +0 -8
  14. package/dist/connection/Connection.repository.js +0 -92
  15. package/dist/connection/Connection.service.d.ts +0 -8
  16. package/dist/connection/Connection.service.js +0 -32
  17. package/dist/connection/IConnection.d.ts +0 -28
  18. package/dist/connection/IConnection.js +0 -16
  19. package/dist/connection/index.d.ts +0 -2
  20. package/dist/connection/index.js +0 -18
  21. package/dist/device/cloud/entities/CloudConnection.d.ts +0 -6
  22. package/dist/device/cloud/entities/CloudConnection.js +0 -6
  23. package/dist/device/cloud/entities/CloudDevice.d.ts +0 -16
  24. package/dist/device/cloud/entities/CloudDevice.js +0 -26
  25. package/dist/device/cloud/entities/CloudDeviceService.d.ts +0 -5
  26. package/dist/device/cloud/entities/CloudDeviceService.js +0 -9
  27. package/dist/device/cloud/entities/DeviceFactory.d.ts +0 -7
  28. package/dist/device/cloud/entities/DeviceFactory.js +0 -80
  29. package/dist/device/cloud/entities/index.d.ts +0 -3
  30. package/dist/device/cloud/entities/index.js +0 -19
  31. package/dist/device/cloud/interface.d.ts +0 -101
  32. package/dist/device/cloud/interface.js +0 -3
  33. package/dist/device/cloud/interfaces/ICloudConnection.d.ts +0 -5
  34. package/dist/device/cloud/interfaces/ICloudConnection.js +0 -2
  35. package/dist/device/cloud/interfaces/ICloudDevice.d.ts +0 -9
  36. package/dist/device/cloud/interfaces/ICloudDevice.js +0 -2
  37. package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +0 -4
  38. package/dist/device/cloud/interfaces/ICloudDeviceService.js +0 -2
  39. package/dist/device/cloud/interfaces/IConnectionService.d.ts +0 -7
  40. package/dist/device/cloud/interfaces/IConnectionService.js +0 -2
  41. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +0 -7
  42. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +0 -3
  43. package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +0 -4
  44. package/dist/device/cloud/interfaces/IDeviceFactory.js +0 -2
  45. package/dist/device/cloud/interfaces/IDeviceService.d.ts +0 -8
  46. package/dist/device/cloud/interfaces/IDeviceService.js +0 -2
  47. package/dist/device/cloud/interfaces/IDevicesService.d.ts +0 -9
  48. package/dist/device/cloud/interfaces/IDevicesService.js +0 -2
  49. package/dist/device/cloud/interfaces/IHubService.d.ts +0 -5
  50. package/dist/device/cloud/interfaces/IHubService.js +0 -2
  51. package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +0 -4
  52. package/dist/device/cloud/interfaces/IRawDataTransformer.js +0 -2
  53. package/dist/device/cloud/interfaces/IRawDevice.d.ts +0 -17
  54. package/dist/device/cloud/interfaces/IRawDevice.js +0 -11
  55. package/dist/device/cloud/interfaces/index.d.ts +0 -5
  56. package/dist/device/cloud/interfaces/index.js +0 -21
  57. package/dist/device/cloud/services/CloudDevice.service.d.ts +0 -5
  58. package/dist/device/cloud/services/CloudDevice.service.js +0 -9
  59. package/dist/device/cloud/services/Connection.service.d.ts +0 -8
  60. package/dist/device/cloud/services/Connection.service.js +0 -6
  61. package/dist/device/cloud/services/Device.service.d.ts +0 -39
  62. package/dist/device/cloud/services/Device.service.js +0 -9
  63. package/dist/device/cloud/services/DeviceCloudService.d.ts +0 -42
  64. package/dist/device/cloud/services/DeviceCloudService.js +0 -59
  65. package/dist/device/cloud/services/DeviceHub.service.d.ts +0 -3
  66. package/dist/device/cloud/services/DeviceHub.service.js +0 -6
  67. package/dist/device/cloud/services/Hub.service.d.ts +0 -25
  68. package/dist/device/cloud/services/Hub.service.js +0 -9
  69. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +0 -38
  70. package/dist/device/cloud/services/SmartThingsDeviceService.js +0 -52
  71. package/dist/device/cloud/services/index.d.ts +0 -2
  72. package/dist/device/cloud/services/index.js +0 -18
  73. package/dist/device/cloud/types.d.ts +0 -52
  74. package/dist/device/cloud/types.js +0 -15
  75. package/dist/device/index.d.ts +0 -4
  76. package/dist/device/index.js +0 -20
  77. package/dist/device/local/entities/AlertBuilder.d.ts +0 -87
  78. package/dist/device/local/entities/AlertBuilder.example.d.ts +0 -11
  79. package/dist/device/local/entities/AlertBuilder.example.js +0 -117
  80. package/dist/device/local/entities/AlertBuilder.js +0 -179
  81. package/dist/device/local/entities/IssueBuilder.d.ts +0 -109
  82. package/dist/device/local/entities/IssueBuilder.example.d.ts +0 -16
  83. package/dist/device/local/entities/IssueBuilder.example.js +0 -196
  84. package/dist/device/local/entities/IssueBuilder.js +0 -237
  85. package/dist/device/local/entities/index.d.ts +0 -2
  86. package/dist/device/local/entities/index.js +0 -7
  87. package/dist/device/local/events/EventHandler.d.ts +0 -11
  88. package/dist/device/local/events/EventHandler.js +0 -86
  89. package/dist/device/local/events/Events.d.ts +0 -54
  90. package/dist/device/local/events/Events.js +0 -57
  91. package/dist/device/local/events/index.d.ts +0 -2
  92. package/dist/device/local/events/index.js +0 -7
  93. package/dist/device/local/handler/EventHandler.d.ts +0 -7
  94. package/dist/device/local/handler/EventHandler.js +0 -44
  95. package/dist/device/local/interface.d.ts +0 -0
  96. package/dist/device/local/interface.js +0 -1
  97. package/dist/device/local/interfaces/IConnection.d.ts +0 -26
  98. package/dist/device/local/interfaces/IConnection.js +0 -14
  99. package/dist/device/local/interfaces/IDevice.d.ts +0 -68
  100. package/dist/device/local/interfaces/IDevice.js +0 -10
  101. package/dist/device/local/interfaces/IDtDevice.d.ts +0 -16
  102. package/dist/device/local/interfaces/IDtDevice.js +0 -2
  103. package/dist/device/local/interfaces/IHub.d.ts +0 -46
  104. package/dist/device/local/interfaces/IHub.js +0 -2
  105. package/dist/device/local/interfaces/IProperty.d.ts +0 -29
  106. package/dist/device/local/interfaces/IProperty.js +0 -2
  107. package/dist/device/local/interfaces/ISchedule.d.ts +0 -25
  108. package/dist/device/local/interfaces/ISchedule.js +0 -2
  109. package/dist/device/local/interfaces/index.d.ts +0 -3
  110. package/dist/device/local/interfaces/index.js +0 -19
  111. package/dist/device/local/models/Alert.model.d.ts +0 -28
  112. package/dist/device/local/models/Alert.model.js +0 -222
  113. package/dist/device/local/models/Issue.model.d.ts +0 -28
  114. package/dist/device/local/models/Issue.model.js +0 -260
  115. package/dist/device/local/repository/Alert.repository.d.ts +0 -106
  116. package/dist/device/local/repository/Alert.repository.js +0 -374
  117. package/dist/device/local/repository/Connection.repository.d.ts +0 -8
  118. package/dist/device/local/repository/Connection.repository.js +0 -92
  119. package/dist/device/local/repository/Device.repository.d.ts +0 -30
  120. package/dist/device/local/repository/Device.repository.js +0 -325
  121. package/dist/device/local/repository/Hub.repository.d.ts +0 -13
  122. package/dist/device/local/repository/Hub.repository.js +0 -139
  123. package/dist/device/local/repository/Issue.repository.d.ts +0 -113
  124. package/dist/device/local/repository/Issue.repository.js +0 -401
  125. package/dist/device/local/repository/Property.repository.d.ts +0 -8
  126. package/dist/device/local/repository/Property.repository.js +0 -95
  127. package/dist/device/local/repository/Schedule.repository.d.ts +0 -9
  128. package/dist/device/local/repository/Schedule.repository.js +0 -109
  129. package/dist/device/local/services/Alert.service.d.ts +0 -137
  130. package/dist/device/local/services/Alert.service.js +0 -475
  131. package/dist/device/local/services/AlertService.example.d.ts +0 -55
  132. package/dist/device/local/services/AlertService.example.js +0 -148
  133. package/dist/device/local/services/Connection.service.d.ts +0 -8
  134. package/dist/device/local/services/Connection.service.js +0 -32
  135. package/dist/device/local/services/Device.service.d.ts +0 -40
  136. package/dist/device/local/services/Device.service.js +0 -391
  137. package/dist/device/local/services/DeviceHub.service.d.ts +0 -11
  138. package/dist/device/local/services/DeviceHub.service.js +0 -40
  139. package/dist/device/local/services/Hub.service.d.ts +0 -12
  140. package/dist/device/local/services/Hub.service.js +0 -107
  141. package/dist/device/local/services/Issue.service.d.ts +0 -168
  142. package/dist/device/local/services/Issue.service.js +0 -642
  143. package/dist/device/local/services/IssueService.example.d.ts +0 -68
  144. package/dist/device/local/services/IssueService.example.js +0 -177
  145. package/dist/device/local/services/Property.service.d.ts +0 -8
  146. package/dist/device/local/services/Property.service.js +0 -36
  147. package/dist/device/local/services/Schedule.service.d.ts +0 -9
  148. package/dist/device/local/services/Schedule.service.js +0 -26
  149. package/dist/device/local/services/index.d.ts +0 -3
  150. package/dist/device/local/services/index.js +0 -19
  151. package/dist/pms/IPms.d.ts +0 -6
  152. package/dist/pms/IPms.js +0 -10
  153. package/dist/pms/index.d.ts +0 -1
  154. package/dist/pms/index.js +0 -17
  155. package/dist/property/IProperty.d.ts +0 -29
  156. package/dist/property/IProperty.js +0 -2
  157. package/dist/property/Property.repository.d.ts +0 -8
  158. package/dist/property/Property.repository.js +0 -109
  159. package/dist/property/Property.service.d.ts +0 -8
  160. package/dist/property/Property.service.js +0 -124
  161. package/dist/property/index.d.ts +0 -2
  162. package/dist/property/index.js +0 -18
  163. package/dist/queue/interfaces/IHttpRequestJob.d.ts +0 -9
  164. package/dist/queue/interfaces/IHttpRequestJob.js +0 -2
  165. package/dist/types/alert.types.d.ts +0 -57
  166. package/dist/types/alert.types.js +0 -22
  167. package/dist/types/config.types.d.ts +0 -19
  168. package/dist/types/config.types.js +0 -2
  169. package/dist/types/index.d.ts +0 -3
  170. package/dist/types/index.js +0 -19
  171. package/dist/types/issue.types.d.ts +0 -90
  172. package/dist/types/issue.types.js +0 -40
  173. package/dist/utils/http-utils.d.ts +0 -13
  174. package/dist/utils/http-utils.js +0 -117
@@ -1,124 +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 __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.LocalPropertyService = void 0;
75
- const Property_repository_1 = require("./Property.repository");
76
- const typedi_1 = __importStar(require("typedi"));
77
- let LocalPropertyService = (() => {
78
- let _classDecorators = [(0, typedi_1.Service)()];
79
- let _classDescriptor;
80
- let _classExtraInitializers = [];
81
- let _classThis;
82
- var LocalPropertyService = _classThis = class {
83
- constructor() {
84
- // Use dependency injection instead of creating new instance
85
- this.propertyRepository = typedi_1.default.get(Property_repository_1.PropertyRepository);
86
- }
87
- async getPropertyPreferences(propertyId, keys) {
88
- if (!propertyId) {
89
- throw new Error("Property ID is required");
90
- }
91
- return await this.propertyRepository.getPropertyPreferences(propertyId, keys);
92
- }
93
- async getProperty(propertyId) {
94
- if (!propertyId) {
95
- throw new Error("Property ID is required");
96
- }
97
- return await this.propertyRepository.getProperty(propertyId);
98
- }
99
- async getPropertyTimeZone(propertyId) {
100
- if (!propertyId) {
101
- throw new Error("Property ID is required");
102
- }
103
- const property = await this.propertyRepository.getProperty(propertyId);
104
- if (!property) {
105
- throw new Error("Property not found");
106
- }
107
- return property.timezone;
108
- }
109
- async getAllProperties() {
110
- const properties = await this.propertyRepository.getAllProperties();
111
- return properties;
112
- }
113
- };
114
- __setFunctionName(_classThis, "LocalPropertyService");
115
- (() => {
116
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
117
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
118
- LocalPropertyService = _classThis = _classDescriptor.value;
119
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
120
- __runInitializers(_classThis, _classExtraInitializers);
121
- })();
122
- return LocalPropertyService = _classThis;
123
- })();
124
- exports.LocalPropertyService = LocalPropertyService;
@@ -1,2 +0,0 @@
1
- export * from "./IProperty";
2
- export * from "./Property.service";
@@ -1,18 +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("./IProperty"), exports);
18
- __exportStar(require("./Property.service"), exports);
@@ -1,9 +0,0 @@
1
- import { HttpCallOption } from "../types/http.types";
2
- export interface IHttpRequestJob {
3
- connectionId: string;
4
- provider: string;
5
- url: string;
6
- method: string;
7
- options: HttpCallOption;
8
- timestamp: number;
9
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,57 +0,0 @@
1
- import { EntityType } from "./issue.types";
2
- export declare enum AlertCategory {
3
- READINESS = "READINESS",
4
- OPERATIONS = "OPERATIONS",
5
- SECURITY = "SECURITY",
6
- ENERGY = "ENERGY",
7
- OTHER = "OTHER"
8
- }
9
- export declare enum AlertSeverity {
10
- INFO = "INFO",
11
- LOW = "LOW",
12
- MEDIUM = "MEDIUM",
13
- HIGH = "HIGH",
14
- CRITICAL = "CRITICAL"
15
- }
16
- export interface AlertDocument {
17
- _id: string;
18
- category: AlertCategory;
19
- propertyId: string;
20
- title: string;
21
- description: string;
22
- entityId?: string;
23
- entityType: EntityType;
24
- severity: AlertSeverity;
25
- isRead: boolean;
26
- isActive: boolean;
27
- isDeleted: boolean;
28
- snoozeUntil?: Date;
29
- createdBy?: string;
30
- updatedBy?: string;
31
- createdAt: Date;
32
- updatedAt: Date;
33
- }
34
- export interface CreateAlertData {
35
- category: AlertCategory;
36
- propertyId: string;
37
- title: string;
38
- description: string;
39
- entityId?: string;
40
- entityType: EntityType;
41
- severity?: AlertSeverity;
42
- createdBy?: string;
43
- snoozeUntil?: Date;
44
- }
45
- export interface UpdateAlertData {
46
- category?: AlertCategory;
47
- title?: string;
48
- description?: string;
49
- entityId?: string;
50
- entityType?: EntityType;
51
- severity?: AlertSeverity;
52
- isRead?: boolean;
53
- isActive?: boolean;
54
- snoozeUntil?: Date;
55
- updatedBy?: string;
56
- }
57
- export { EntityType } from "./issue.types";
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityType = exports.AlertSeverity = exports.AlertCategory = void 0;
4
- var AlertCategory;
5
- (function (AlertCategory) {
6
- AlertCategory["READINESS"] = "READINESS";
7
- AlertCategory["OPERATIONS"] = "OPERATIONS";
8
- AlertCategory["SECURITY"] = "SECURITY";
9
- AlertCategory["ENERGY"] = "ENERGY";
10
- AlertCategory["OTHER"] = "OTHER";
11
- })(AlertCategory || (exports.AlertCategory = AlertCategory = {}));
12
- var AlertSeverity;
13
- (function (AlertSeverity) {
14
- AlertSeverity["INFO"] = "INFO";
15
- AlertSeverity["LOW"] = "LOW";
16
- AlertSeverity["MEDIUM"] = "MEDIUM";
17
- AlertSeverity["HIGH"] = "HIGH";
18
- AlertSeverity["CRITICAL"] = "CRITICAL";
19
- })(AlertSeverity || (exports.AlertSeverity = AlertSeverity = {}));
20
- // Re-export EntityType from issue.types.ts to avoid duplication
21
- var issue_types_1 = require("./issue.types");
22
- Object.defineProperty(exports, "EntityType", { enumerable: true, get: function () { return issue_types_1.EntityType; } });
@@ -1,19 +0,0 @@
1
- import { IInternalEvent } from "../events/interfaces/IInternalEvent";
2
- export interface ILogger {
3
- info(message: string, ...args: any[]): void;
4
- warn(message: string, ...args: any[]): void;
5
- error(message: string, ...args: any[]): void;
6
- }
7
- type AllowedSource = "ACCESS_SERVICE" | "ADMIN_SERVICE" | "ENERGY_SERVICE";
8
- export type DeviceConfig = {
9
- SOURCE: AllowedSource;
10
- SQS_QUEUE_URL: string;
11
- DEVICE_SERVICE?: string;
12
- ADMIN_SERVICE?: string;
13
- ACCESS_SERVICE?: string;
14
- ENERGY_SERVICE?: string;
15
- INTERNAL_EVENT_HANDLER: IInternalEvent;
16
- LOGGER: ILogger;
17
- [key: string]: any;
18
- };
19
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export * from "./config.types";
2
- export * from "./issue.types";
3
- export * from "./alert.types";
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config.types"), exports);
18
- __exportStar(require("./issue.types"), exports);
19
- __exportStar(require("./alert.types"), exports);
@@ -1,90 +0,0 @@
1
- export declare enum IssuesCategory {
2
- READINESS = "READINESS",
3
- OPERATIONS = "OPERATIONS",
4
- SECURITY = "SECURITY",
5
- ENERGY = "ENERGY",
6
- OTHER = "OTHER"
7
- }
8
- export declare enum EntityType {
9
- DEVICE = "DEVICE",
10
- COLLECTION = "COLLECTION",
11
- USER = "USER",
12
- INTEGRATION = "INTEGRATION",
13
- PROPERTY = "PROPERTY",
14
- HUB = "HUB",
15
- SCHEDULE = "SCHEDULE",
16
- ALERT = "ALERT",
17
- OTHER = "OTHER"
18
- }
19
- export declare enum IssueStatus {
20
- PENDING = "PENDING",
21
- IN_PROGRESS = "IN_PROGRESS",
22
- RESOLVED = "RESOLVED",
23
- CLOSED = "CLOSED",
24
- CANCELLED = "CANCELLED",
25
- ON_HOLD = "ON_HOLD"
26
- }
27
- export declare enum IssuePriority {
28
- LOW = "LOW",
29
- MEDIUM = "MEDIUM",
30
- HIGH = "HIGH",
31
- CRITICAL = "CRITICAL",
32
- URGENT = "URGENT"
33
- }
34
- export interface IssueComment {
35
- id: string;
36
- userId: string;
37
- content: string;
38
- createdAt: Date;
39
- updatedAt?: Date;
40
- }
41
- export interface IssueDocument {
42
- _id: string;
43
- category: IssuesCategory;
44
- propertyId: string;
45
- title: string;
46
- description: string;
47
- entityId?: string;
48
- entityType: EntityType;
49
- status: IssueStatus;
50
- priority: IssuePriority;
51
- assignedTo?: string;
52
- createdBy: string;
53
- updatedBy?: string;
54
- isDeleted: boolean;
55
- createdAt: Date;
56
- updatedAt: Date;
57
- resolvedAt?: Date;
58
- dueDate?: Date;
59
- comments?: IssueComment[];
60
- }
61
- export interface CreateIssueData {
62
- category: IssuesCategory;
63
- propertyId: string;
64
- title: string;
65
- description: string;
66
- entityId?: string;
67
- entityType: EntityType;
68
- priority?: IssuePriority;
69
- assignedTo?: string;
70
- createdBy: string;
71
- dueDate?: Date;
72
- }
73
- export interface UpdateIssueData {
74
- category?: IssuesCategory;
75
- title?: string;
76
- description?: string;
77
- entityId?: string;
78
- entityType?: EntityType;
79
- status?: IssueStatus;
80
- priority?: IssuePriority;
81
- assignedTo?: string;
82
- updatedBy: string;
83
- resolvedAt?: Date;
84
- dueDate?: Date;
85
- isDeleted?: boolean;
86
- }
87
- export interface AddCommentData {
88
- userId: string;
89
- content: string;
90
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IssuePriority = exports.IssueStatus = exports.EntityType = exports.IssuesCategory = void 0;
4
- var IssuesCategory;
5
- (function (IssuesCategory) {
6
- IssuesCategory["READINESS"] = "READINESS";
7
- IssuesCategory["OPERATIONS"] = "OPERATIONS";
8
- IssuesCategory["SECURITY"] = "SECURITY";
9
- IssuesCategory["ENERGY"] = "ENERGY";
10
- IssuesCategory["OTHER"] = "OTHER";
11
- })(IssuesCategory || (exports.IssuesCategory = IssuesCategory = {}));
12
- var EntityType;
13
- (function (EntityType) {
14
- EntityType["DEVICE"] = "DEVICE";
15
- EntityType["COLLECTION"] = "COLLECTION";
16
- EntityType["USER"] = "USER";
17
- EntityType["INTEGRATION"] = "INTEGRATION";
18
- EntityType["PROPERTY"] = "PROPERTY";
19
- EntityType["HUB"] = "HUB";
20
- EntityType["SCHEDULE"] = "SCHEDULE";
21
- EntityType["ALERT"] = "ALERT";
22
- EntityType["OTHER"] = "OTHER";
23
- })(EntityType || (exports.EntityType = EntityType = {}));
24
- var IssueStatus;
25
- (function (IssueStatus) {
26
- IssueStatus["PENDING"] = "PENDING";
27
- IssueStatus["IN_PROGRESS"] = "IN_PROGRESS";
28
- IssueStatus["RESOLVED"] = "RESOLVED";
29
- IssueStatus["CLOSED"] = "CLOSED";
30
- IssueStatus["CANCELLED"] = "CANCELLED";
31
- IssueStatus["ON_HOLD"] = "ON_HOLD";
32
- })(IssueStatus || (exports.IssueStatus = IssueStatus = {}));
33
- var IssuePriority;
34
- (function (IssuePriority) {
35
- IssuePriority["LOW"] = "LOW";
36
- IssuePriority["MEDIUM"] = "MEDIUM";
37
- IssuePriority["HIGH"] = "HIGH";
38
- IssuePriority["CRITICAL"] = "CRITICAL";
39
- IssuePriority["URGENT"] = "URGENT";
40
- })(IssuePriority || (exports.IssuePriority = IssuePriority = {}));
@@ -1,13 +0,0 @@
1
- /**
2
- * Validates if a URL is properly formatted and accessible
3
- */
4
- export declare function validateServiceUrl(url: string): boolean;
5
- /**
6
- * Creates a properly configured axios instance with error handling
7
- */
8
- export declare function createAxiosInstance(baseURL?: string): import("axios").AxiosInstance;
9
- export declare function getDeviceServiceAxiosInstance(): any;
10
- /**
11
- * Retry function for failed HTTP requests
12
- */
13
- export declare function retryRequest<T>(requestFn: () => Promise<T>, maxRetries?: number, delay?: number): Promise<T>;
@@ -1,117 +0,0 @@
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.validateServiceUrl = validateServiceUrl;
7
- exports.createAxiosInstance = createAxiosInstance;
8
- exports.getDeviceServiceAxiosInstance = getDeviceServiceAxiosInstance;
9
- exports.retryRequest = retryRequest;
10
- const config_1 = require("../config/config");
11
- const axios_1 = __importDefault(require("axios"));
12
- /**
13
- * Validates if a URL is properly formatted and accessible
14
- */
15
- function validateServiceUrl(url) {
16
- try {
17
- const parsedUrl = new URL(url);
18
- return parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:";
19
- }
20
- catch (error) {
21
- (0, config_1.getConfig)().LOGGER.error(`Invalid service URL: ${url}`, error);
22
- return false;
23
- }
24
- }
25
- /**
26
- * Creates a properly configured axios instance with error handling
27
- */
28
- function createAxiosInstance(baseURL) {
29
- const instance = axios_1.default.create({
30
- baseURL,
31
- timeout: 30000, // 30 seconds timeout
32
- maxRedirects: 5,
33
- validateStatus: (status) => status < 500, // Don't throw on 4xx errors
34
- headers: {
35
- "Content-Type": "application/json",
36
- "User-Agent": "dt-common-device/1.3.0",
37
- },
38
- });
39
- // Add request interceptor for logging
40
- instance.interceptors.request.use((config) => {
41
- const logger = (0, config_1.getConfig)().LOGGER;
42
- logger.info(`Making request to: ${config.method?.toUpperCase()} ${config.url}`, {
43
- baseURL: config.baseURL,
44
- timeout: config.timeout,
45
- });
46
- return config;
47
- }, (error) => {
48
- (0, config_1.getConfig)().LOGGER.error("Request interceptor error:", error);
49
- return Promise.reject(error);
50
- });
51
- // Add response interceptor for error handling
52
- instance.interceptors.response.use((response) => {
53
- return response;
54
- }, (error) => {
55
- const logger = (0, config_1.getConfig)().LOGGER;
56
- const errorInfo = {
57
- url: error.config?.url,
58
- method: error.config?.method,
59
- status: error.response?.status,
60
- statusText: error.response?.statusText,
61
- message: error.message,
62
- code: error.code,
63
- baseURL: error.config?.baseURL,
64
- };
65
- logger.error("HTTP request failed:", errorInfo);
66
- // Log additional details for network errors
67
- if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND") {
68
- logger.error("Network connectivity issue detected. Please check:", {
69
- serviceUrl: error.config?.baseURL,
70
- errorCode: error.code,
71
- errorMessage: error.message,
72
- });
73
- }
74
- return Promise.reject(error);
75
- });
76
- return instance;
77
- }
78
- /**
79
- * Centralized axios instance for device service
80
- */
81
- let deviceServiceAxiosInstance = null;
82
- function getDeviceServiceAxiosInstance() {
83
- if (!deviceServiceAxiosInstance) {
84
- const { DEVICE_SERVICE } = (0, config_1.getConfig)();
85
- if (!DEVICE_SERVICE) {
86
- throw new Error("DEVICE_SERVICE is not configured. Call initialize() first with DEVICE_SERVICE.");
87
- }
88
- deviceServiceAxiosInstance = createAxiosInstance(DEVICE_SERVICE);
89
- }
90
- return deviceServiceAxiosInstance;
91
- }
92
- /**
93
- * Retry function for failed HTTP requests
94
- */
95
- async function retryRequest(requestFn, maxRetries = 3, delay = 1000) {
96
- let lastError;
97
- for (let attempt = 1; attempt <= maxRetries; attempt++) {
98
- try {
99
- return await requestFn();
100
- }
101
- catch (error) {
102
- lastError = error;
103
- if (attempt === maxRetries) {
104
- (0, config_1.getConfig)().LOGGER.error(`Request failed after ${maxRetries} attempts:`, error);
105
- throw error;
106
- }
107
- (0, config_1.getConfig)().LOGGER.warn(`Request attempt ${attempt} failed, retrying in ${delay}ms:`, {
108
- error: error.message,
109
- attempt,
110
- maxRetries,
111
- });
112
- await new Promise((resolve) => setTimeout(resolve, delay));
113
- delay *= 2; // Exponential backoff
114
- }
115
- }
116
- throw lastError;
117
- }