dt-common-device 7.1.3 → 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();
@@ -61,9 +61,9 @@ export declare class IssueService {
61
61
  */
62
62
  createMaintenanceIssue(data: CreateIssueData): Promise<IIssueDocument>;
63
63
  /**
64
- * Create an urgent issue using IssueBuilder
64
+ * Create a high priority issue using IssueBuilder
65
65
  */
66
- createUrgentIssue(data: CreateIssueData): Promise<IIssueDocument>;
66
+ createHighPriorityIssue(data: CreateIssueData): Promise<IIssueDocument>;
67
67
  /**
68
68
  * Create a new issue with business logic validation
69
69
  * Accepts either a CreateIssueData object or an IssueBuilder instance
@@ -291,7 +291,7 @@ let IssueService = (() => {
291
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.`,
292
292
  createdBy: source,
293
293
  category: issue_types_1.IssuesCategory.ENERGY,
294
- priority: issue_types_1.IssuePriority.MEDIUM,
294
+ priority: issue_types_1.IssuePriority.CRITICAL,
295
295
  type: issue_types_1.IssueType.BATTERY_LOW,
296
296
  });
297
297
  }
@@ -329,10 +329,10 @@ let IssueService = (() => {
329
329
  return await this.createIssue(issueBuilder);
330
330
  }
331
331
  /**
332
- * Create an urgent issue using IssueBuilder
332
+ * Create a high priority issue using IssueBuilder
333
333
  */
334
- async createUrgentIssue(data) {
335
- const issueBuilder = IssueBuilder_1.IssueBuilder.createUrgentIssue(data.propertyId, data.type, data.entityId, data.entityType)
334
+ async createHighPriorityIssue(data) {
335
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createHighPriorityIssue(data.propertyId, data.type, data.entityId, data.entityType)
336
336
  .setTitle(data.title)
337
337
  .setDescription(data.description)
338
338
  .setCreatedBy(data.createdBy);
@@ -732,13 +732,13 @@ let IssueService = (() => {
732
732
  determineDefaultPriority(category) {
733
733
  // Business logic: Determine default priority based on category
734
734
  const categoryPriorities = {
735
- [issue_types_1.IssuesCategory.READINESS]: issue_types_1.IssuePriority.MEDIUM,
735
+ [issue_types_1.IssuesCategory.READINESS]: issue_types_1.IssuePriority.LOW,
736
736
  [issue_types_1.IssuesCategory.OPERATIONS]: issue_types_1.IssuePriority.HIGH,
737
737
  [issue_types_1.IssuesCategory.SECURITY]: issue_types_1.IssuePriority.CRITICAL,
738
- [issue_types_1.IssuesCategory.ENERGY]: issue_types_1.IssuePriority.LOW,
739
- [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,
740
740
  };
741
- return categoryPriorities[category] || issue_types_1.IssuePriority.MEDIUM;
741
+ return categoryPriorities[category] || issue_types_1.IssuePriority.LOW;
742
742
  }
743
743
  applyBusinessRules(filters) {
744
744
  // Business logic: Apply additional filters based on business rules
@@ -55,7 +55,7 @@ export declare class IssueBuilder {
55
55
  */
56
56
  setEntityType(entityType: EntityType): this;
57
57
  /**
58
- * Sets the issue priority (optional, defaults to MEDIUM)
58
+ * Sets the issue priority (optional, defaults to LOW)
59
59
  */
60
60
  setPriority(priority?: IssuePriority): this;
61
61
  /**
@@ -111,8 +111,8 @@ export declare class IssueBuilder {
111
111
  */
112
112
  static createMaintenanceIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
113
113
  /**
114
- * Creates an urgent issue builder
114
+ * Creates a high priority issue builder
115
115
  */
116
- static createUrgentIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
116
+ static createHighPriorityIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
117
117
  static createCloudAccountAuthorizationIssue(propertyId: string, entityId: string, entityType: EntityType, type: IssueType): IssueBuilder;
118
118
  }
@@ -100,7 +100,7 @@ class IssueBuilder {
100
100
  return this;
101
101
  }
102
102
  /**
103
- * Sets the issue priority (optional, defaults to MEDIUM)
103
+ * Sets the issue priority (optional, defaults to LOW)
104
104
  */
105
105
  setPriority(priority) {
106
106
  if (priority !== undefined) {
@@ -163,7 +163,7 @@ class IssueBuilder {
163
163
  this.validate();
164
164
  // Set default priority if not provided
165
165
  if (!this.data.priority) {
166
- this.data.priority = issue_types_1.IssuePriority.MEDIUM;
166
+ this.data.priority = issue_types_1.IssuePriority.LOW;
167
167
  }
168
168
  return this.data;
169
169
  }
@@ -180,7 +180,7 @@ class IssueBuilder {
180
180
  static createReadinessIssue() {
181
181
  return new IssueBuilder()
182
182
  .setCategory(issue_types_1.IssuesCategory.READINESS)
183
- .setPriority(issue_types_1.IssuePriority.MEDIUM);
183
+ .setPriority(issue_types_1.IssuePriority.LOW);
184
184
  }
185
185
  static createOperationsIssue() {
186
186
  return new IssueBuilder()
@@ -248,7 +248,8 @@ class IssueBuilder {
248
248
  const builder = new IssueBuilder()
249
249
  .setCategory(issue_types_1.IssuesCategory.READINESS)
250
250
  .setPropertyId(propertyId)
251
- .setType(type);
251
+ .setType(type)
252
+ .setPriority(issue_types_1.IssuePriority.LOW);
252
253
  if (entityId)
253
254
  builder.setEntityId(entityId);
254
255
  if (entityType)
@@ -256,14 +257,14 @@ class IssueBuilder {
256
257
  return builder;
257
258
  }
258
259
  /**
259
- * Creates an urgent issue builder
260
+ * Creates a high priority issue builder
260
261
  */
261
- static createUrgentIssue(propertyId, type, entityId, entityType) {
262
+ static createHighPriorityIssue(propertyId, type, entityId, entityType) {
262
263
  const builder = new IssueBuilder()
263
264
  .setCategory(issue_types_1.IssuesCategory.OPERATIONS)
264
265
  .setPropertyId(propertyId)
265
266
  .setType(type)
266
- .setPriority(issue_types_1.IssuePriority.URGENT);
267
+ .setPriority(issue_types_1.IssuePriority.HIGH);
267
268
  if (entityId)
268
269
  builder.setEntityId(entityId);
269
270
  if (entityType)
@@ -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.3",
3
+ "version": "7.1.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [