@justair/justair-library 4.8.44 → 4.8.46
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.
- package/package.json +2 -2
- package/src/index.js +2 -0
- package/src/models/monitorSuppliers.js +5 -0
- package/src/models/monitors.js +21 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justair/justair-library",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.46",
|
|
4
4
|
"description": "JustAir Internal Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
"ts-node": "^10.0.0",
|
|
26
26
|
"typescript": "^5.3.2"
|
|
27
27
|
}
|
|
28
|
-
}
|
|
28
|
+
}
|
package/src/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
monitorAuditSchema,
|
|
20
20
|
MonitorAudit,
|
|
21
21
|
parametersEnum,
|
|
22
|
+
deploymentTypesEnum,
|
|
22
23
|
} from "./models/monitors.js";
|
|
23
24
|
import { organizationsSchema, Organizations } from "./models/organizations.js";
|
|
24
25
|
import {
|
|
@@ -123,6 +124,7 @@ export {
|
|
|
123
124
|
MonitorAudit,
|
|
124
125
|
monitorAuditSchema,
|
|
125
126
|
parametersEnum,
|
|
127
|
+
deploymentTypesEnum,
|
|
126
128
|
AlertsAudit,
|
|
127
129
|
Alerts,
|
|
128
130
|
alertsSchema,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import { deploymentTypesEnum } from "./monitors.js";
|
|
2
3
|
|
|
3
4
|
const errorLogSchema = mongoose.Schema(
|
|
4
5
|
{
|
|
@@ -35,6 +36,10 @@ const monitorSuppliersSchema = mongoose.Schema(
|
|
|
35
36
|
latestErrorLogs: {
|
|
36
37
|
type: [errorLogSchema],
|
|
37
38
|
},
|
|
39
|
+
supportedDeploymentTypes: {
|
|
40
|
+
type: [String],
|
|
41
|
+
enum: Object.values(deploymentTypesEnum),
|
|
42
|
+
},
|
|
38
43
|
},
|
|
39
44
|
{
|
|
40
45
|
timestamps: true,
|
package/src/models/monitors.js
CHANGED
|
@@ -22,6 +22,11 @@ const parametersEnum = [
|
|
|
22
22
|
"H2S",
|
|
23
23
|
];
|
|
24
24
|
|
|
25
|
+
const deploymentTypesEnum = {
|
|
26
|
+
STATIONARY: "stationary",
|
|
27
|
+
MOBILE: "mobile",
|
|
28
|
+
};
|
|
29
|
+
|
|
25
30
|
const noteSchema = mongoose.Schema({
|
|
26
31
|
note: {
|
|
27
32
|
type: String,
|
|
@@ -158,6 +163,7 @@ const monitorAuditSchema = mongoose.Schema(
|
|
|
158
163
|
type: [correctionHistorySchema],
|
|
159
164
|
default: [],
|
|
160
165
|
},
|
|
166
|
+
deploymentType: String,
|
|
161
167
|
},
|
|
162
168
|
{
|
|
163
169
|
timestamps: true,
|
|
@@ -190,6 +196,8 @@ const monitorsSchema = mongoose.Schema(
|
|
|
190
196
|
"aqMesh",
|
|
191
197
|
"kunak",
|
|
192
198
|
"airLink",
|
|
199
|
+
"atmotube",
|
|
200
|
+
|
|
193
201
|
],
|
|
194
202
|
},
|
|
195
203
|
monitorType: String,
|
|
@@ -264,6 +272,11 @@ const monitorsSchema = mongoose.Schema(
|
|
|
264
272
|
type: [{ parameter: String, timestamp: Date, isPaused: Boolean }],
|
|
265
273
|
default: [],
|
|
266
274
|
},
|
|
275
|
+
deploymentType: {
|
|
276
|
+
type: String,
|
|
277
|
+
enum: Object.values(deploymentTypesEnum),
|
|
278
|
+
default: deploymentTypesEnum.STATIONARY,
|
|
279
|
+
},
|
|
267
280
|
},
|
|
268
281
|
{
|
|
269
282
|
timestamps: true,
|
|
@@ -289,6 +302,9 @@ monitorsSchema.index({ parameters: 1 });
|
|
|
289
302
|
//network metrics for anomalies
|
|
290
303
|
monitorsSchema.index({ sponsor: 1, isActive: 1, monitorSupplier: 1 });
|
|
291
304
|
|
|
305
|
+
// Deployment type filtering
|
|
306
|
+
monitorsSchema.index({ deploymentType: 1 });
|
|
307
|
+
|
|
292
308
|
// Pre-hook to log single document deletions
|
|
293
309
|
monitorsSchema.pre("findOneAndDelete", async function () {
|
|
294
310
|
const docToDelete = await this.model.findOne(this.getFilter()).lean();
|
|
@@ -311,6 +327,7 @@ monitorsSchema.pre("findOneAndDelete", async function () {
|
|
|
311
327
|
corrections: docToDelete.corrections,
|
|
312
328
|
correctionHistory: docToDelete.correctionHistory,
|
|
313
329
|
applyCorrections: docToDelete.applyCorrections,
|
|
330
|
+
deploymentType: docToDelete.deploymentType,
|
|
314
331
|
deletedAt: new Date(),
|
|
315
332
|
});
|
|
316
333
|
await auditLog.save();
|
|
@@ -338,6 +355,7 @@ monitorsSchema.pre("deleteMany", async function () {
|
|
|
338
355
|
corrections: doc.corrections,
|
|
339
356
|
correctionHistory: doc.correctionHistory,
|
|
340
357
|
applyCorrections: doc.applyCorrections,
|
|
358
|
+
deploymentType: doc.deploymentType,
|
|
341
359
|
deletedAt: new Date(),
|
|
342
360
|
}));
|
|
343
361
|
|
|
@@ -369,6 +387,7 @@ monitorsSchema.pre("deleteOne", async function () {
|
|
|
369
387
|
corrections: docToDelete.corrections,
|
|
370
388
|
correctionHistory: docToDelete.correctionHistory,
|
|
371
389
|
applyCorrections: docToDelete.applyCorrections,
|
|
390
|
+
deploymentType: docToDelete.deploymentType,
|
|
372
391
|
deletedAt: new Date(),
|
|
373
392
|
});
|
|
374
393
|
await auditLog.save();
|
|
@@ -394,6 +413,7 @@ monitorsSchema.pre("updateMany", async function () {
|
|
|
394
413
|
corrections: doc.corrections,
|
|
395
414
|
correctionHistory: doc.correctionHistory,
|
|
396
415
|
applyCorrections: doc.applyCorrections,
|
|
416
|
+
deploymentType: doc.deploymentType,
|
|
397
417
|
deletedAt: null, // Not a deletion, so this field is null
|
|
398
418
|
}));
|
|
399
419
|
|
|
@@ -404,4 +424,4 @@ monitorsSchema.pre("updateMany", async function () {
|
|
|
404
424
|
// Create the Monitors model
|
|
405
425
|
const Monitors = mongoose.model("Monitors", monitorsSchema);
|
|
406
426
|
|
|
407
|
-
export { monitorsSchema, Monitors, monitorAuditSchema, MonitorAudit, parametersEnum };
|
|
427
|
+
export { monitorsSchema, Monitors, monitorAuditSchema, MonitorAudit, parametersEnum, deploymentTypesEnum };
|