dt-common-device 7.1.2 → 7.1.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.
@@ -77,7 +77,7 @@ const AlertSchema = new mongoose_1.Schema({
77
77
  severity: {
78
78
  type: String,
79
79
  enum: Object.values(alert_types_1.AlertSeverity),
80
- default: alert_types_1.AlertSeverity.MEDIUM,
80
+ default: alert_types_1.AlertSeverity.LOW,
81
81
  },
82
82
  isRead: {
83
83
  type: Boolean,
@@ -77,7 +77,7 @@ let AlertRepository = (() => {
77
77
  try {
78
78
  const alert = new Alert_model_1.AlertModel({
79
79
  ...alertData,
80
- severity: alertData.severity || alert_types_1.AlertSeverity.MEDIUM,
80
+ severity: alertData.severity || alert_types_1.AlertSeverity.LOW,
81
81
  isRead: false,
82
82
  isActive: true,
83
83
  isDeleted: false,
@@ -200,7 +200,7 @@ let AlertService = (() => {
200
200
  * Raise alert for device battery level below threshold (READINESS + OPERATIONAL + ENERGY)
201
201
  */
202
202
  async raiseDeviceBatteryAlert(device, batteryLevel, threshold, source) {
203
- return await this.raiseDeviceAlert(device.deviceId, device.propertyId, device.zoneId, "Device Battery Low", `Device ${device.name} (${device.deviceId}) battery level is ${batteryLevel}%, which is below the property threshold of ${threshold}%.`, alert_types_1.AlertCategory.ENERGY, alert_types_1.AlertSeverity.MEDIUM, source);
203
+ return await this.raiseDeviceAlert(device.deviceId, device.propertyId, device.zoneId, "Device Battery Low", `Device ${device.name} (${device.deviceId}) battery level is ${batteryLevel}%, which is below the property threshold of ${threshold}%.`, alert_types_1.AlertCategory.ENERGY, alert_types_1.AlertSeverity.HIGH, source);
204
204
  }
205
205
  /**
206
206
  * Raise alert for device issue (jammed or malfunctioned) (READINESS + OPERATIONAL)
@@ -538,13 +538,13 @@ let AlertService = (() => {
538
538
  determineDefaultSeverity(category) {
539
539
  // Business logic: Determine default severity based on category
540
540
  const categorySeverities = {
541
- [alert_types_1.AlertCategory.READINESS]: alert_types_1.AlertSeverity.MEDIUM,
541
+ [alert_types_1.AlertCategory.READINESS]: alert_types_1.AlertSeverity.LOW,
542
542
  [alert_types_1.AlertCategory.OPERATIONS]: alert_types_1.AlertSeverity.HIGH,
543
543
  [alert_types_1.AlertCategory.SECURITY]: alert_types_1.AlertSeverity.CRITICAL,
544
544
  [alert_types_1.AlertCategory.ENERGY]: alert_types_1.AlertSeverity.LOW,
545
- [alert_types_1.AlertCategory.OTHER]: alert_types_1.AlertSeverity.MEDIUM,
545
+ [alert_types_1.AlertCategory.OTHER]: alert_types_1.AlertSeverity.LOW,
546
546
  };
547
- return categorySeverities[category] || alert_types_1.AlertSeverity.MEDIUM;
547
+ return categorySeverities[category] || alert_types_1.AlertSeverity.LOW;
548
548
  }
549
549
  applyBusinessRules(filters) {
550
550
  // Business logic: Apply additional filters based on business rules
@@ -49,7 +49,7 @@ export declare class AlertBuilder {
49
49
  */
50
50
  setEntityType(entityType: EntityType): this;
51
51
  /**
52
- * Sets the alert severity (optional, defaults to MEDIUM)
52
+ * Sets the alert severity (optional, defaults to LOW)
53
53
  */
54
54
  setSeverity(severity?: AlertSeverity): this;
55
55
  /**
@@ -89,7 +89,7 @@ class AlertBuilder {
89
89
  return this;
90
90
  }
91
91
  /**
92
- * Sets the alert severity (optional, defaults to MEDIUM)
92
+ * Sets the alert severity (optional, defaults to LOW)
93
93
  */
94
94
  setSeverity(severity) {
95
95
  if (severity !== undefined) {
@@ -141,7 +141,7 @@ class AlertBuilder {
141
141
  this.validate();
142
142
  // Set default severity if not provided
143
143
  if (!this.data.severity) {
144
- this.data.severity = alert_types_1.AlertSeverity.MEDIUM;
144
+ this.data.severity = alert_types_1.AlertSeverity.LOW;
145
145
  }
146
146
  return this.data;
147
147
  }
@@ -158,7 +158,7 @@ class AlertBuilder {
158
158
  static createReadinessAlert() {
159
159
  return new AlertBuilder()
160
160
  .setCategory(alert_types_1.AlertCategory.READINESS)
161
- .setSeverity(alert_types_1.AlertSeverity.MEDIUM);
161
+ .setSeverity(alert_types_1.AlertSeverity.LOW);
162
162
  }
163
163
  static createOperationsAlert() {
164
164
  return new AlertBuilder()
@@ -9,7 +9,6 @@ export declare enum AlertCategory {
9
9
  export declare enum AlertSeverity {
10
10
  INFO = "INFO",
11
11
  LOW = "LOW",
12
- MEDIUM = "MEDIUM",
13
12
  HIGH = "HIGH",
14
13
  CRITICAL = "CRITICAL"
15
14
  }
@@ -13,7 +13,6 @@ var AlertSeverity;
13
13
  (function (AlertSeverity) {
14
14
  AlertSeverity["INFO"] = "INFO";
15
15
  AlertSeverity["LOW"] = "LOW";
16
- AlertSeverity["MEDIUM"] = "MEDIUM";
17
16
  AlertSeverity["HIGH"] = "HIGH";
18
17
  AlertSeverity["CRITICAL"] = "CRITICAL";
19
18
  })(AlertSeverity || (exports.AlertSeverity = AlertSeverity = {}));
@@ -95,7 +95,7 @@ const IssueSchema = new mongoose_1.Schema({
95
95
  priority: {
96
96
  type: String,
97
97
  enum: Object.values(issue_types_1.IssuePriority),
98
- default: issue_types_1.IssuePriority.MEDIUM,
98
+ default: issue_types_1.IssuePriority.LOW,
99
99
  },
100
100
  assignedTo: {
101
101
  type: String,
@@ -84,7 +84,7 @@ let IssueRepository = (() => {
84
84
  const issue = new Issue_model_1.IssueModel({
85
85
  ...issueData,
86
86
  status: issue_types_1.IssueStatus.PENDING,
87
- priority: issueData.priority || issue_types_1.IssuePriority.MEDIUM,
87
+ priority: issueData.priority || issue_types_1.IssuePriority.LOW,
88
88
  isDeleted: false,
89
89
  });
90
90
  return await issue.save();
@@ -1,5 +1,5 @@
1
1
  import { IIssueDocument } from "./Issue.model";
2
- import { CreateIssueData, UpdateIssueData, AddCommentData, IssuePriority, IssuesCategory, EntityType, IIssueQuery } from "./issue.types";
2
+ import { CreateIssueData, UpdateIssueData, AddCommentData, IssuePriority, IssuesCategory, EntityType, IIssueQuery, IssueType } from "./issue.types";
3
3
  import { IssueBuilder } from "./IssueBuilder";
4
4
  import { Source } from "../constants/Service";
5
5
  import { IDevice } from "../entities/device/local/interfaces";
@@ -41,6 +41,7 @@ export declare class IssueService {
41
41
  title: string;
42
42
  description: string;
43
43
  createdBy: string;
44
+ type: IssueType;
44
45
  }): Promise<IIssueDocument>;
45
46
  /**
46
47
  * Create issue for device going offline longer than baseline
@@ -60,9 +61,9 @@ export declare class IssueService {
60
61
  */
61
62
  createMaintenanceIssue(data: CreateIssueData): Promise<IIssueDocument>;
62
63
  /**
63
- * Create an urgent issue using IssueBuilder
64
+ * Create a high priority issue using IssueBuilder
64
65
  */
65
- createUrgentIssue(data: CreateIssueData): Promise<IIssueDocument>;
66
+ createHighPriorityIssue(data: CreateIssueData): Promise<IIssueDocument>;
66
67
  /**
67
68
  * Create a new issue with business logic validation
68
69
  * Accepts either a CreateIssueData object or an IssueBuilder instance
@@ -93,7 +93,6 @@ let IssueService = (() => {
93
93
  async createReadinessIssue(data) {
94
94
  const issueBuilder = IssueBuilder_1.IssueBuilder.createReadinessIssue()
95
95
  .setPropertyId(data.propertyId)
96
- .setZoneId(data.zoneId)
97
96
  .setTitle(data.title)
98
97
  .setDescription(data.description)
99
98
  .setCreatedBy(data.createdBy);
@@ -105,6 +104,10 @@ let IssueService = (() => {
105
104
  issueBuilder.setAssignedTo(data.assignedTo);
106
105
  if (data.dueDate)
107
106
  issueBuilder.setDueDate(data.dueDate);
107
+ if (data.zoneId)
108
+ issueBuilder.setZoneId(data.zoneId);
109
+ if (data.type)
110
+ issueBuilder.setType(data.type);
108
111
  return await this.createIssue(issueBuilder);
109
112
  }
110
113
  /**
@@ -113,7 +116,6 @@ let IssueService = (() => {
113
116
  async createOperationsIssue(data) {
114
117
  const issueBuilder = IssueBuilder_1.IssueBuilder.createOperationsIssue()
115
118
  .setPropertyId(data.propertyId)
116
- .setZoneId(data.zoneId)
117
119
  .setTitle(data.title)
118
120
  .setDescription(data.description)
119
121
  .setCreatedBy(data.createdBy);
@@ -125,6 +127,10 @@ let IssueService = (() => {
125
127
  issueBuilder.setAssignedTo(data.assignedTo);
126
128
  if (data.dueDate)
127
129
  issueBuilder.setDueDate(data.dueDate);
130
+ if (data.zoneId)
131
+ issueBuilder.setZoneId(data.zoneId);
132
+ if (data.type)
133
+ issueBuilder.setType(data.type);
128
134
  return await this.createIssue(issueBuilder);
129
135
  }
130
136
  /**
@@ -133,7 +139,6 @@ let IssueService = (() => {
133
139
  async createSecurityIssue(data) {
134
140
  const issueBuilder = IssueBuilder_1.IssueBuilder.createSecurityIssue()
135
141
  .setPropertyId(data.propertyId)
136
- .setZoneId(data.zoneId)
137
142
  .setTitle(data.title)
138
143
  .setDescription(data.description)
139
144
  .setCreatedBy(data.createdBy);
@@ -145,6 +150,10 @@ let IssueService = (() => {
145
150
  issueBuilder.setAssignedTo(data.assignedTo);
146
151
  if (data.dueDate)
147
152
  issueBuilder.setDueDate(data.dueDate);
153
+ if (data.zoneId)
154
+ issueBuilder.setZoneId(data.zoneId);
155
+ if (data.type)
156
+ issueBuilder.setType(data.type);
148
157
  return await this.createIssue(issueBuilder);
149
158
  }
150
159
  /**
@@ -153,7 +162,6 @@ let IssueService = (() => {
153
162
  async createEnergyIssue(data) {
154
163
  const issueBuilder = IssueBuilder_1.IssueBuilder.createEnergyIssue()
155
164
  .setPropertyId(data.propertyId)
156
- .setZoneId(data.zoneId)
157
165
  .setTitle(data.title)
158
166
  .setDescription(data.description)
159
167
  .setCreatedBy(data.createdBy);
@@ -165,13 +173,17 @@ let IssueService = (() => {
165
173
  issueBuilder.setAssignedTo(data.assignedTo);
166
174
  if (data.dueDate)
167
175
  issueBuilder.setDueDate(data.dueDate);
176
+ if (data.type)
177
+ issueBuilder.setType(data.type);
178
+ if (data.zoneId)
179
+ issueBuilder.setZoneId(data.zoneId);
168
180
  return await this.createIssue(issueBuilder);
169
181
  }
170
182
  /**
171
183
  * Create a device-specific issue using IssueBuilder
172
184
  */
173
185
  async createDeviceIssue(data) {
174
- const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.zoneId)
186
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.type)
175
187
  .setTitle(data.title)
176
188
  .setDescription(data.description)
177
189
  .setCreatedBy(data.createdBy);
@@ -183,13 +195,15 @@ let IssueService = (() => {
183
195
  issueBuilder.setAssignedTo(data.assignedTo);
184
196
  if (data.dueDate)
185
197
  issueBuilder.setDueDate(data.dueDate);
198
+ if (data.zoneId)
199
+ issueBuilder.setZoneId(data.zoneId);
186
200
  return await this.createIssue(issueBuilder);
187
201
  }
188
202
  /**
189
203
  * Create a hub-specific issue using IssueBuilder
190
204
  */
191
205
  async createHubIssue(data) {
192
- const issueBuilder = IssueBuilder_1.IssueBuilder.createHubIssue(data.entityId, data.propertyId, data.zoneId)
206
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createHubIssue(data.entityId, data.propertyId, data.type)
193
207
  .setTitle(data.title)
194
208
  .setDescription(data.description)
195
209
  .setCreatedBy(data.createdBy);
@@ -201,13 +215,15 @@ let IssueService = (() => {
201
215
  issueBuilder.setAssignedTo(data.assignedTo);
202
216
  if (data.dueDate)
203
217
  issueBuilder.setDueDate(data.dueDate);
218
+ if (data.zoneId)
219
+ issueBuilder.setZoneId(data.zoneId);
204
220
  return await this.createIssue(issueBuilder);
205
221
  }
206
222
  /**
207
223
  * Create a user-specific issue using IssueBuilder
208
224
  */
209
225
  async createUserIssue(data) {
210
- const issueBuilder = IssueBuilder_1.IssueBuilder.createUserIssue(data.entityId, data.propertyId, data.zoneId)
226
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createUserIssue(data.entityId, data.propertyId, data.type)
211
227
  .setTitle(data.title)
212
228
  .setDescription(data.description)
213
229
  .setCreatedBy(data.createdBy);
@@ -219,10 +235,12 @@ let IssueService = (() => {
219
235
  issueBuilder.setAssignedTo(data.assignedTo);
220
236
  if (data.dueDate)
221
237
  issueBuilder.setDueDate(data.dueDate);
238
+ if (data.zoneId)
239
+ issueBuilder.setZoneId(data.zoneId);
222
240
  return await this.createIssue(issueBuilder);
223
241
  }
224
242
  async createCloudAccountAuthorizationIssue(data) {
225
- const issueBuilder = IssueBuilder_1.IssueBuilder.createCloudAccountAuthorizationIssue(data.propertyId, data.entityId, data.entityType)
243
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createCloudAccountAuthorizationIssue(data.propertyId, data.entityId, data.entityType, data.type)
226
244
  .setTitle(data.title)
227
245
  .setDescription(data.description)
228
246
  .setCreatedBy(data.createdBy);
@@ -273,7 +291,7 @@ let IssueService = (() => {
273
291
  description: `Device ${device.name} (${device.deviceId}) battery level is ${batteryLevel}%, which is below the property threshold of ${threshold}%. Please replace or charge the device battery.`,
274
292
  createdBy: source,
275
293
  category: issue_types_1.IssuesCategory.ENERGY,
276
- priority: issue_types_1.IssuePriority.MEDIUM,
294
+ priority: issue_types_1.IssuePriority.CRITICAL,
277
295
  type: issue_types_1.IssueType.BATTERY_LOW,
278
296
  });
279
297
  }
@@ -298,7 +316,7 @@ let IssueService = (() => {
298
316
  * Create a maintenance issue using IssueBuilder
299
317
  */
300
318
  async createMaintenanceIssue(data) {
301
- const issueBuilder = IssueBuilder_1.IssueBuilder.createMaintenanceIssue(data.propertyId, data.zoneId, data.entityId, data.entityType)
319
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createMaintenanceIssue(data.propertyId, data.type, data.entityId, data.entityType)
302
320
  .setTitle(data.title)
303
321
  .setDescription(data.description)
304
322
  .setCreatedBy(data.createdBy);
@@ -306,13 +324,15 @@ let IssueService = (() => {
306
324
  issueBuilder.setAssignedTo(data.assignedTo);
307
325
  if (data.dueDate)
308
326
  issueBuilder.setDueDate(data.dueDate);
327
+ if (data.zoneId)
328
+ issueBuilder.setZoneId(data.zoneId);
309
329
  return await this.createIssue(issueBuilder);
310
330
  }
311
331
  /**
312
- * Create an urgent issue using IssueBuilder
332
+ * Create a high priority issue using IssueBuilder
313
333
  */
314
- async createUrgentIssue(data) {
315
- const issueBuilder = IssueBuilder_1.IssueBuilder.createUrgentIssue(data.propertyId, data.zoneId, data.entityId, data.entityType)
334
+ async createHighPriorityIssue(data) {
335
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createHighPriorityIssue(data.propertyId, data.type, data.entityId, data.entityType)
316
336
  .setTitle(data.title)
317
337
  .setDescription(data.description)
318
338
  .setCreatedBy(data.createdBy);
@@ -320,6 +340,8 @@ let IssueService = (() => {
320
340
  issueBuilder.setAssignedTo(data.assignedTo);
321
341
  if (data.dueDate)
322
342
  issueBuilder.setDueDate(data.dueDate);
343
+ if (data.zoneId)
344
+ issueBuilder.setZoneId(data.zoneId);
323
345
  return await this.createIssue(issueBuilder);
324
346
  }
325
347
  /**
@@ -710,13 +732,13 @@ let IssueService = (() => {
710
732
  determineDefaultPriority(category) {
711
733
  // Business logic: Determine default priority based on category
712
734
  const categoryPriorities = {
713
- [issue_types_1.IssuesCategory.READINESS]: issue_types_1.IssuePriority.MEDIUM,
735
+ [issue_types_1.IssuesCategory.READINESS]: issue_types_1.IssuePriority.LOW,
714
736
  [issue_types_1.IssuesCategory.OPERATIONS]: issue_types_1.IssuePriority.HIGH,
715
737
  [issue_types_1.IssuesCategory.SECURITY]: issue_types_1.IssuePriority.CRITICAL,
716
- [issue_types_1.IssuesCategory.ENERGY]: issue_types_1.IssuePriority.LOW,
717
- [issue_types_1.IssuesCategory.OTHER]: issue_types_1.IssuePriority.MEDIUM,
738
+ [issue_types_1.IssuesCategory.ENERGY]: issue_types_1.IssuePriority.HIGH,
739
+ [issue_types_1.IssuesCategory.OTHER]: issue_types_1.IssuePriority.LOW,
718
740
  };
719
- return categoryPriorities[category] || issue_types_1.IssuePriority.MEDIUM;
741
+ return categoryPriorities[category] || issue_types_1.IssuePriority.LOW;
720
742
  }
721
743
  applyBusinessRules(filters) {
722
744
  // Business logic: Apply additional filters based on business rules
@@ -1,4 +1,4 @@
1
- import { CreateIssueData, IssuesCategory, IssuePriority, EntityType } from "./issue.types";
1
+ import { CreateIssueData, IssuesCategory, IssuePriority, EntityType, IssueType } from "./issue.types";
2
2
  /**
3
3
  * IssueBuilder - A builder pattern implementation for constructing CreateIssueData objects
4
4
  *
@@ -34,6 +34,10 @@ export declare class IssueBuilder {
34
34
  * Sets the zone ID (optional)
35
35
  */
36
36
  setZoneId(zoneId?: string): this;
37
+ /**
38
+ * Sets the issue type
39
+ */
40
+ setType(type: IssueType): this;
37
41
  /**
38
42
  * Sets the issue title
39
43
  */
@@ -51,7 +55,7 @@ export declare class IssueBuilder {
51
55
  */
52
56
  setEntityType(entityType: EntityType): this;
53
57
  /**
54
- * Sets the issue priority (optional, defaults to MEDIUM)
58
+ * Sets the issue priority (optional, defaults to LOW)
55
59
  */
56
60
  setPriority(priority?: IssuePriority): this;
57
61
  /**
@@ -89,26 +93,26 @@ export declare class IssueBuilder {
89
93
  /**
90
94
  * Creates a device-specific issue builder
91
95
  */
92
- static createDeviceIssue(deviceId: string, propertyId: string, zoneId?: string): IssueBuilder;
96
+ static createDeviceIssue(deviceId: string, propertyId: string, type: IssueType): IssueBuilder;
93
97
  /**
94
98
  * Creates a hub-specific issue builder
95
99
  */
96
- static createHubIssue(hubId: string, propertyId: string, zoneId?: string): IssueBuilder;
100
+ static createHubIssue(hubId: string, propertyId: string, type: IssueType): IssueBuilder;
97
101
  /**
98
102
  * Creates a user-specific issue builder
99
103
  */
100
- static createUserIssue(userId: string, propertyId: string, zoneId?: string): IssueBuilder;
104
+ static createUserIssue(userId: string, propertyId: string, type: IssueType): IssueBuilder;
101
105
  /**
102
106
  * Creates a property-specific issue builder
103
107
  */
104
- static createPropertyIssue(propertyId: string, zoneId?: string): IssueBuilder;
108
+ static createPropertyIssue(propertyId: string, type: IssueType): IssueBuilder;
105
109
  /**
106
110
  * Creates a maintenance issue builder
107
111
  */
108
- static createMaintenanceIssue(propertyId: string, zoneId?: string, entityId?: string, entityType?: EntityType): IssueBuilder;
112
+ static createMaintenanceIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
109
113
  /**
110
- * Creates an urgent issue builder
114
+ * Creates a high priority issue builder
111
115
  */
112
- static createUrgentIssue(propertyId: string, zoneId?: string, entityId?: string, entityType?: EntityType): IssueBuilder;
113
- static createCloudAccountAuthorizationIssue(propertyId: string, entityId: string, entityType: EntityType): IssueBuilder;
116
+ static createHighPriorityIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
117
+ static createCloudAccountAuthorizationIssue(propertyId: string, entityId: string, entityType: EntityType, type: IssueType): IssueBuilder;
114
118
  }
@@ -56,6 +56,13 @@ class IssueBuilder {
56
56
  }
57
57
  return this;
58
58
  }
59
+ /**
60
+ * Sets the issue type
61
+ */
62
+ setType(type) {
63
+ this.data.type = type;
64
+ return this;
65
+ }
59
66
  /**
60
67
  * Sets the issue title
61
68
  */
@@ -93,7 +100,7 @@ class IssueBuilder {
93
100
  return this;
94
101
  }
95
102
  /**
96
- * Sets the issue priority (optional, defaults to MEDIUM)
103
+ * Sets the issue priority (optional, defaults to LOW)
97
104
  */
98
105
  setPriority(priority) {
99
106
  if (priority !== undefined) {
@@ -137,6 +144,7 @@ class IssueBuilder {
137
144
  "category",
138
145
  "propertyId",
139
146
  "title",
147
+ "type",
140
148
  "description",
141
149
  "entityId",
142
150
  "entityType",
@@ -155,7 +163,7 @@ class IssueBuilder {
155
163
  this.validate();
156
164
  // Set default priority if not provided
157
165
  if (!this.data.priority) {
158
- this.data.priority = issue_types_1.IssuePriority.MEDIUM;
166
+ this.data.priority = issue_types_1.IssuePriority.LOW;
159
167
  }
160
168
  return this.data;
161
169
  }
@@ -172,7 +180,7 @@ class IssueBuilder {
172
180
  static createReadinessIssue() {
173
181
  return new IssueBuilder()
174
182
  .setCategory(issue_types_1.IssuesCategory.READINESS)
175
- .setPriority(issue_types_1.IssuePriority.MEDIUM);
183
+ .setPriority(issue_types_1.IssuePriority.LOW);
176
184
  }
177
185
  static createOperationsIssue() {
178
186
  return new IssueBuilder()
@@ -192,87 +200,83 @@ class IssueBuilder {
192
200
  /**
193
201
  * Creates a device-specific issue builder
194
202
  */
195
- static createDeviceIssue(deviceId, propertyId, zoneId) {
203
+ static createDeviceIssue(deviceId, propertyId, type) {
196
204
  const builder = new IssueBuilder()
197
205
  .setEntityType(issue_types_1.EntityType.DEVICE)
198
206
  .setEntityId(deviceId)
199
- .setPropertyId(propertyId);
200
- if (zoneId)
201
- builder.setZoneId(zoneId);
207
+ .setPropertyId(propertyId)
208
+ .setType(type);
202
209
  return builder;
203
210
  }
204
211
  /**
205
212
  * Creates a hub-specific issue builder
206
213
  */
207
- static createHubIssue(hubId, propertyId, zoneId) {
214
+ static createHubIssue(hubId, propertyId, type) {
208
215
  const builder = new IssueBuilder()
209
216
  .setEntityType(issue_types_1.EntityType.HUB)
210
217
  .setEntityId(hubId)
211
- .setPropertyId(propertyId);
212
- if (zoneId)
213
- builder.setZoneId(zoneId);
218
+ .setPropertyId(propertyId)
219
+ .setType(type);
214
220
  return builder;
215
221
  }
216
222
  /**
217
223
  * Creates a user-specific issue builder
218
224
  */
219
- static createUserIssue(userId, propertyId, zoneId) {
225
+ static createUserIssue(userId, propertyId, type) {
220
226
  const builder = new IssueBuilder()
221
227
  .setEntityType(issue_types_1.EntityType.USER)
222
228
  .setEntityId(userId)
223
- .setPropertyId(propertyId);
224
- if (zoneId)
225
- builder.setZoneId(zoneId);
229
+ .setPropertyId(propertyId)
230
+ .setType(type);
226
231
  return builder;
227
232
  }
228
233
  /**
229
234
  * Creates a property-specific issue builder
230
235
  */
231
- static createPropertyIssue(propertyId, zoneId) {
236
+ static createPropertyIssue(propertyId, type) {
232
237
  const builder = new IssueBuilder()
233
238
  .setEntityType(issue_types_1.EntityType.PROPERTY)
234
239
  .setEntityId(propertyId)
235
- .setPropertyId(propertyId);
236
- if (zoneId)
237
- builder.setZoneId(zoneId);
240
+ .setPropertyId(propertyId)
241
+ .setType(type);
238
242
  return builder;
239
243
  }
240
244
  /**
241
245
  * Creates a maintenance issue builder
242
246
  */
243
- static createMaintenanceIssue(propertyId, zoneId, entityId, entityType) {
247
+ static createMaintenanceIssue(propertyId, type, entityId, entityType) {
244
248
  const builder = new IssueBuilder()
245
249
  .setCategory(issue_types_1.IssuesCategory.READINESS)
246
- .setPropertyId(propertyId);
250
+ .setPropertyId(propertyId)
251
+ .setType(type)
252
+ .setPriority(issue_types_1.IssuePriority.LOW);
247
253
  if (entityId)
248
254
  builder.setEntityId(entityId);
249
255
  if (entityType)
250
256
  builder.setEntityType(entityType);
251
- if (zoneId)
252
- builder.setZoneId(zoneId);
253
257
  return builder;
254
258
  }
255
259
  /**
256
- * Creates an urgent issue builder
260
+ * Creates a high priority issue builder
257
261
  */
258
- static createUrgentIssue(propertyId, zoneId, entityId, entityType) {
262
+ static createHighPriorityIssue(propertyId, type, entityId, entityType) {
259
263
  const builder = new IssueBuilder()
260
264
  .setCategory(issue_types_1.IssuesCategory.OPERATIONS)
261
265
  .setPropertyId(propertyId)
262
- .setPriority(issue_types_1.IssuePriority.URGENT);
266
+ .setType(type)
267
+ .setPriority(issue_types_1.IssuePriority.HIGH);
263
268
  if (entityId)
264
269
  builder.setEntityId(entityId);
265
270
  if (entityType)
266
271
  builder.setEntityType(entityType);
267
- if (zoneId)
268
- builder.setZoneId(zoneId);
269
272
  return builder;
270
273
  }
271
- static createCloudAccountAuthorizationIssue(propertyId, entityId, entityType) {
274
+ static createCloudAccountAuthorizationIssue(propertyId, entityId, entityType, type) {
272
275
  const builder = new IssueBuilder()
273
276
  .setEntityType(entityType)
274
277
  .setEntityId(entityId)
275
- .setPropertyId(propertyId);
278
+ .setPropertyId(propertyId)
279
+ .setType(type);
276
280
  return builder;
277
281
  }
278
282
  }
@@ -29,10 +29,8 @@ export declare enum IssueStatus {
29
29
  }
30
30
  export declare enum IssuePriority {
31
31
  LOW = "LOW",
32
- MEDIUM = "MEDIUM",
33
32
  HIGH = "HIGH",
34
- CRITICAL = "CRITICAL",
35
- URGENT = "URGENT"
33
+ CRITICAL = "CRITICAL"
36
34
  }
37
35
  export interface IssueComment {
38
36
  id: string;
@@ -36,10 +36,8 @@ var IssueStatus;
36
36
  var IssuePriority;
37
37
  (function (IssuePriority) {
38
38
  IssuePriority["LOW"] = "LOW";
39
- IssuePriority["MEDIUM"] = "MEDIUM";
40
39
  IssuePriority["HIGH"] = "HIGH";
41
40
  IssuePriority["CRITICAL"] = "CRITICAL";
42
- IssuePriority["URGENT"] = "URGENT";
43
41
  })(IssuePriority || (exports.IssuePriority = IssuePriority = {}));
44
42
  var IssueType;
45
43
  (function (IssueType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [