@sedni/cloud_common 2.1.0 → 3.0.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.
package/dist/index.js CHANGED
@@ -1,65 +1,1102 @@
1
1
  import {
2
+ ActivationModes,
3
+ AddedAlarmsJson,
4
+ AlarmIndicatorJson,
2
5
  AlarmPriorities,
6
+ AlarmStates,
3
7
  AlarmTypes,
8
+ AutomaticSemiAutoJson,
9
+ BackgroundJson,
10
+ BreakerJson,
11
+ BreakerPmsJson,
12
+ CabinetDesigns,
13
+ CabinetJson,
14
+ ChannelJson,
4
15
  CloudAlarmStates,
16
+ CommandJson,
17
+ CommandsOpClJson,
18
+ CommandsStartStopJson,
19
+ CompressorDesigns,
20
+ CompressorJson,
21
+ ControlLockJson,
22
+ DamperAutomatedJson,
23
+ DamperJson,
24
+ DialJson,
5
25
  DiamarAlarmStates,
26
+ DigitalAlarmStates,
27
+ DigitalJson,
28
+ DigitalStates,
29
+ DisplayJson,
30
+ DynamicTextJson,
6
31
  EventCategories,
7
32
  EventCriticalities,
33
+ FanDesigns,
34
+ FanDirections,
35
+ FanJson,
36
+ FanRunStates,
37
+ FanTypes,
38
+ FeedbackOpClJson,
39
+ FeedbackRunningStoppedJson,
40
+ GeneratorJson,
41
+ GeneratorPmsJson,
42
+ ImageAuxiliaryJson,
43
+ InfoLocations,
44
+ LedTypes,
45
+ LevelBarJson,
46
+ LevelBarOrientations,
47
+ LineAuxiliaryJson,
48
+ LineJson,
49
+ LinkAuxiliaryJson,
50
+ LinkDesigns,
51
+ LocalizedTextJson,
52
+ LocationJson,
53
+ LogicExpressionJson,
54
+ LogicExpressionsJson,
55
+ MarkTypes,
56
+ MimicElementTypes,
57
+ OpClStates,
58
+ OperationModeStates,
59
+ OperationModesJson,
60
+ OrderOpClJson,
61
+ OrderStartStopJson,
62
+ PolylineAuxiliaryJson,
63
+ PrioritiesJson,
64
+ PriorityDataJson,
65
+ PumpAutomatedJson,
66
+ PumpJson,
67
+ RemoteLocalJson,
68
+ RepeaterDesigns,
69
+ RepeaterJson,
70
+ RunningStoppedStates,
71
+ ScaleJson,
72
+ ScalePositions,
73
+ ShaftJson,
74
+ SliderJson,
75
+ SliderOrientations,
76
+ SquareAuxiliaryJson,
77
+ StationDesigns,
78
+ StationJson,
79
+ TankJson,
80
+ TextAnchorPoints,
81
+ TextAttributesJson,
82
+ TextAuxiliaryJson,
83
+ TextChannelJson,
84
+ TitleAligns,
85
+ TitleJson,
86
+ ToggleJson,
87
+ TripResetJson,
88
+ UnitDesigns,
89
+ UnitJson,
8
90
  UnitTypes,
9
- init_alarm_types,
10
- init_event_types,
11
- init_unit_types
12
- } from "./chunk-AOC7BD5E.js";
91
+ ValueTypes,
92
+ ValveAutomatedJson,
93
+ ValveDesigns,
94
+ ValveJson,
95
+ ZDepths
96
+ } from "./chunk-FO3TASV6.js";
13
97
 
14
- // app/index.ts
15
- init_alarm_types();
98
+ // app/models/Channel.ts
99
+ import mongoose from "mongoose";
100
+ import mongooseAutopopulate from "mongoose-autopopulate";
101
+ import mongoosePaginate from "mongoose-paginate-v2";
102
+ import mongooseAggregatePaginate from "mongoose-aggregate-paginate-v2";
103
+ var channelSchema = new mongoose.Schema({
104
+ channel_tag: {
105
+ type: String,
106
+ required: true
107
+ },
108
+ channel_description: {
109
+ type: String,
110
+ required: true
111
+ },
112
+ channel_unit_id: {
113
+ type: mongoose.Schema.Types.ObjectId,
114
+ ref: "Unit",
115
+ required: true,
116
+ autopopulate: true
117
+ },
118
+ channel_parsed: {
119
+ type: Object,
120
+ required: true
121
+ },
122
+ channel_last_bucket_sync: {
123
+ type: Date,
124
+ required: false
125
+ }
126
+ }, {
127
+ timestamps: {
128
+ createdAt: true,
129
+ updatedAt: true
130
+ },
131
+ collection: "channels",
132
+ toJSON: {
133
+ transform: function(doc, ret) {
134
+ ret.id = ret._id;
135
+ ret.channel_unit = ret.channel_unit_id;
136
+ ret.channel_unit_id = ret.channel_unit_id.unit_id;
137
+ delete ret._id;
138
+ delete ret.__v;
139
+ }
140
+ }
141
+ });
142
+ channelSchema.index({ "channel_tag": 1 }, { unique: true });
143
+ channelSchema.index({ "channel_description": 1 });
144
+ channelSchema.plugin(mongoosePaginate);
145
+ channelSchema.plugin(mongooseAggregatePaginate);
146
+ channelSchema.plugin(mongooseAutopopulate);
147
+ var Channel_default = channelSchema;
148
+
149
+ // app/models/ChannelDataBucket.ts
150
+ import mongoose2 from "mongoose";
151
+ import mongoosePaginate2 from "mongoose-paginate-v2";
152
+ import mongooseAggregatePaginate2 from "mongoose-aggregate-paginate-v2";
153
+ var dataPointSchema = new mongoose2.Schema({
154
+ channel_id: {
155
+ type: String,
156
+ required: true,
157
+ index: true
158
+ },
159
+ timestamp: {
160
+ type: Number,
161
+ required: true
162
+ },
163
+ value: {
164
+ type: Number,
165
+ required: true
166
+ }
167
+ }, {
168
+ _id: false
169
+ });
170
+ var channeldataBucketSchema = new mongoose2.Schema({
171
+ start_date: {
172
+ type: Date,
173
+ required: true,
174
+ default: Date.now
175
+ },
176
+ end_date: {
177
+ type: Date,
178
+ required: true,
179
+ default: function() {
180
+ return new Date(Date.now() + 1e3 * 60 * 60);
181
+ }
182
+ },
183
+ data: {
184
+ type: [dataPointSchema],
185
+ required: true,
186
+ default: []
187
+ },
188
+ size: {
189
+ type: Number,
190
+ required: true,
191
+ default: 0
192
+ },
193
+ synced: {
194
+ type: Number,
195
+ required: true,
196
+ default: 0
197
+ },
198
+ sum: {
199
+ type: Number,
200
+ required: true,
201
+ default: 0
202
+ }
203
+ }, {
204
+ toJSON: {
205
+ transform: function(doc, ret) {
206
+ ret.id = ret._id;
207
+ delete ret._id;
208
+ delete ret.__v;
209
+ ret.start_date = ret.start_date.getTime();
210
+ ret.end_date = ret.end_date.getTime();
211
+ ret.avg = ret.sum / ret.size;
212
+ }
213
+ },
214
+ versionKey: false
215
+ });
216
+ channeldataBucketSchema.index({ start_date: 1, end_date: 1 }, { background: true });
217
+ channeldataBucketSchema.index({ start_date: 1, end_date: 1, "data.channel_id": 1 }, { background: true });
218
+ channeldataBucketSchema.index({ start_date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 365, background: true });
219
+ channeldataBucketSchema.plugin(mongoosePaginate2);
220
+ channeldataBucketSchema.plugin(mongooseAggregatePaginate2);
221
+ var ChannelDataBucket_default = channeldataBucketSchema;
222
+
223
+ // app/models/ChannelDataPoint.ts
224
+ import mongoose3 from "mongoose";
225
+ import mongoosePaginate3 from "mongoose-paginate-v2";
226
+ import mongooseAggregatePaginate3 from "mongoose-aggregate-paginate-v2";
227
+ var channelDataPointSchema = new mongoose3.Schema({
228
+ c: {
229
+ type: String,
230
+ required: true,
231
+ index: true,
232
+ alias: "channel_id"
233
+ },
234
+ t: {
235
+ type: Date,
236
+ required: true,
237
+ alias: "timestamp"
238
+ },
239
+ v: {
240
+ type: Number,
241
+ required: true,
242
+ alias: "value"
243
+ }
244
+ }, {
245
+ collection: "channel_data_points",
246
+ timestamps: false,
247
+ timeseries: {
248
+ timeField: "t",
249
+ metaField: "c",
250
+ granularity: "seconds"
251
+ },
252
+ toJSON: { getters: true },
253
+ toObject: { getters: true },
254
+ versionKey: false
255
+ });
256
+ channelDataPointSchema.index({ c: 1, t: 1 });
257
+ var oneYear = 60 * 60 * 24 * 365;
258
+ channelDataPointSchema.addTTLIndex = function(expirationTimeInSeconds = oneYear, ttlField = "t", metaField = "c") {
259
+ this.index({
260
+ [ttlField]: 1
261
+ }, {
262
+ expireAfterSeconds: expirationTimeInSeconds,
263
+ partialFilterExpression: {
264
+ [metaField]: {
265
+ $exists: true
266
+ }
267
+ },
268
+ name: "ttl_index_" + ttlField
269
+ });
270
+ };
271
+ channelDataPointSchema.plugin(mongoosePaginate3);
272
+ channelDataPointSchema.plugin(mongooseAggregatePaginate3);
273
+ var ChannelDataPoint_default = channelDataPointSchema;
274
+
275
+ // app/models/Event.ts
276
+ import mongoose4 from "mongoose";
277
+ import mongoosePaginate4 from "mongoose-paginate-v2";
278
+ import mongooseAggregatePaginate4 from "mongoose-aggregate-paginate-v2";
279
+ var eventSchema = new mongoose4.Schema({
280
+ event_message: {
281
+ type: String,
282
+ required: true
283
+ },
284
+ event_source: {
285
+ type: String,
286
+ required: true
287
+ },
288
+ event_user: {
289
+ type: String,
290
+ required: false
291
+ },
292
+ event_category: {
293
+ type: String,
294
+ required: true,
295
+ enum: Object.values(EventCategories)
296
+ },
297
+ event_criticality: {
298
+ type: String,
299
+ required: true,
300
+ enum: Object.values(EventCriticalities)
301
+ },
302
+ event_type: {
303
+ type: String,
304
+ required: true
305
+ },
306
+ event_timestamp: {
307
+ type: Date,
308
+ default: Date.now
309
+ },
310
+ event_data: {
311
+ type: Object
312
+ }
313
+ }, {
314
+ timestamps: {
315
+ createdAt: true,
316
+ updatedAt: false
317
+ },
318
+ versionKey: false,
319
+ toJSON: {
320
+ transform: function(doc, ret) {
321
+ ret.id = ret._id;
322
+ delete ret._id;
323
+ delete ret.createdAt;
324
+ ret.event_timestamp = ret.event_timestamp.getTime();
325
+ }
326
+ }
327
+ });
328
+ eventSchema.index({ "event_type": 1 });
329
+ eventSchema.index({ "event_category": 1 });
330
+ var oneYear2 = 60 * 60 * 24 * 365;
331
+ eventSchema.addTTLIndex = function(expirationTimeInSeconds = oneYear2, ttlField = "event_timestamp") {
332
+ this.index({ [ttlField]: 1 }, { expireAfterSeconds: expirationTimeInSeconds });
333
+ };
334
+ eventSchema.plugin(mongoosePaginate4);
335
+ eventSchema.plugin(mongooseAggregatePaginate4);
336
+ var Event_default = eventSchema;
337
+
338
+ // app/models/History.ts
339
+ import mongoose5 from "mongoose";
340
+ import mongoosePaginate5 from "mongoose-paginate-v2";
341
+ import mongooseAggregatePaginate5 from "mongoose-aggregate-paginate-v2";
342
+ var historySchema = new mongoose5.Schema({
343
+ channel_tag: {
344
+ type: String,
345
+ required: true
346
+ },
347
+ alarm_timestamp: {
348
+ type: Date,
349
+ required: true,
350
+ default: Date.now
351
+ },
352
+ alarm_priority: {
353
+ type: String,
354
+ required: true,
355
+ enum: Object.values(AlarmPriorities)
356
+ },
357
+ alarm_original_state: {
358
+ type: String,
359
+ required: true,
360
+ enum: Object.values(DiamarAlarmStates)
361
+ },
362
+ alarm_state: {
363
+ type: String,
364
+ required: true,
365
+ enum: Object.values(CloudAlarmStates)
366
+ },
367
+ alarm_type: {
368
+ type: String,
369
+ required: true,
370
+ enum: Object.values(AlarmTypes)
371
+ },
372
+ alarm_value: {
373
+ type: Number,
374
+ required: false
375
+ },
376
+ alarm_message: {
377
+ type: String,
378
+ required: false
379
+ },
380
+ alarm_data: {
381
+ type: Object,
382
+ required: false
383
+ }
384
+ }, {
385
+ timestamps: {
386
+ createdAt: false,
387
+ updatedAt: false
388
+ },
389
+ versionKey: false,
390
+ collection: "history",
391
+ toJSON: {
392
+ transform: function(doc, ret) {
393
+ ret.id = ret._id;
394
+ delete ret._id;
395
+ delete ret.__v;
396
+ ret.alarm_timestamp = new Date(ret.alarm_timestamp).getTime();
397
+ ret.alarm = {
398
+ alarm_priority: ret.alarm_priority,
399
+ alarm_state: ret.alarm_original_state ?? "Inactive",
400
+ alarm_type: ret.alarm_type,
401
+ alarm_value: ret.alarm_value === null ? "inf" : `${ret.alarm_value}`,
402
+ alarm_timestamp: new Date(ret.alarm_timestamp).getTime()
403
+ };
404
+ }
405
+ }
406
+ });
407
+ historySchema.index({ "channel_tag": 1 });
408
+ var oneYear3 = 60 * 60 * 24 * 365;
409
+ historySchema.addTTLIndex = function(expirationTimeInSeconds = oneYear3, ttlField = "alarm_timestamp") {
410
+ this.index({ [ttlField]: 1 }, { expireAfterSeconds: expirationTimeInSeconds });
411
+ };
412
+ historySchema.plugin(mongoosePaginate5);
413
+ historySchema.plugin(mongooseAggregatePaginate5);
414
+ var History_default = historySchema;
415
+
416
+ // app/models/Unit.ts
417
+ import mongoose6 from "mongoose";
418
+ import mongoosePaginate6 from "mongoose-paginate-v2";
419
+ import mongooseAggregatePaginate6 from "mongoose-aggregate-paginate-v2";
420
+ var unitSchema = new mongoose6.Schema({
421
+ unit_id: {
422
+ type: String,
423
+ required: true
424
+ },
425
+ unit_enabled: {
426
+ type: Boolean,
427
+ required: true
428
+ },
429
+ unit_type: {
430
+ type: String,
431
+ required: true,
432
+ enum: Object.values(UnitTypes)
433
+ },
434
+ unit_internal_description: {
435
+ type: String,
436
+ required: true
437
+ },
438
+ unit_cabinet_id: {
439
+ type: String,
440
+ required: false
441
+ }
442
+ }, {
443
+ timestamps: true,
444
+ collection: "units",
445
+ toJSON: {
446
+ transform: function(doc, ret) {
447
+ ret.id = ret._id;
448
+ delete ret._id;
449
+ delete ret.__v;
450
+ }
451
+ }
452
+ });
453
+ unitSchema.index({ "unit_id": 1 }, { unique: true });
454
+ unitSchema.index({ "unit_internal_description": 1 });
455
+ unitSchema.plugin(mongoosePaginate6);
456
+ unitSchema.plugin(mongooseAggregatePaginate6);
457
+ var Unit_default = unitSchema;
458
+
459
+ // app/models/docs/Channel.json
460
+ var Channel_default2 = {
461
+ components: {
462
+ schemas: {
463
+ Channel: {
464
+ type: "object",
465
+ properties: {
466
+ id: {
467
+ type: "string",
468
+ format: "ObjectId",
469
+ description: "MongoDB ObjectId",
470
+ example: "507f1f77bcf86cd799439011",
471
+ readOnly: true
472
+ },
473
+ channel_tag: {
474
+ type: "string",
475
+ description: "Channel tag",
476
+ example: "MOTOR_PS_TEMP",
477
+ readOnly: true
478
+ },
479
+ channel_description: {
480
+ type: "string",
481
+ description: "Channel description",
482
+ example: "Motor Power Supply Temperature",
483
+ readOnly: true
484
+ },
485
+ channel_unit_id: {
486
+ type: "string",
487
+ format: "ObjectId",
488
+ description: "Unit of the channel",
489
+ example: "507f1f77bcf86cd799439011",
490
+ readOnly: true
491
+ },
492
+ channel_parsed: {
493
+ type: "object",
494
+ description: "Parsed channel data",
495
+ readOnly: true
496
+ }
497
+ },
498
+ required: [
499
+ "channel_tag",
500
+ "channel_description",
501
+ "channel_unit_id",
502
+ "channel_parsed"
503
+ ]
504
+ }
505
+ },
506
+ examples: {
507
+ Channel: {
508
+ value: {
509
+ id: "507f1f77bcf86cd799439011",
510
+ channel_tag: "MOTOR_PS_TEMP",
511
+ channel_description: "Motor Power Supply Temperature",
512
+ channel_type: "Analogic"
513
+ }
514
+ }
515
+ }
516
+ }
517
+ };
518
+
519
+ // app/models/docs/ChannelDataBucket.json
520
+ var ChannelDataBucket_default2 = {
521
+ components: {
522
+ schemas: {
523
+ ChannelData: {
524
+ type: "object",
525
+ description: "ChannelData object. This is the bucket where the data is stored, in batches of 1 hour.",
526
+ properties: {
527
+ id: {
528
+ type: "string",
529
+ format: "ObjectId",
530
+ description: "MongoDB ObjectId",
531
+ example: "507f1f77bcf86cd799439011",
532
+ readOnly: true
533
+ },
534
+ start_date: {
535
+ type: "string",
536
+ format: "date-time",
537
+ description: "Start date of the data",
538
+ example: "2024-07-03T10:15:30Z",
539
+ readOnly: true
540
+ },
541
+ end_date: {
542
+ type: "string",
543
+ format: "date-time",
544
+ description: "End date of the data",
545
+ example: "2024-07-03T11:15:30Z",
546
+ readOnly: true
547
+ },
548
+ data: {
549
+ type: "array",
550
+ description: "Data array of DataPoint objects",
551
+ items: {
552
+ $ref: "#/components/schemas/DataPoint"
553
+ },
554
+ readOnly: false
555
+ },
556
+ size: {
557
+ type: "integer",
558
+ format: "int64",
559
+ description: "Size of the data array",
560
+ example: 60,
561
+ readOnly: true
562
+ },
563
+ synced: {
564
+ type: "TODO",
565
+ description: "TODO",
566
+ example: "TODO",
567
+ readOnly: true
568
+ },
569
+ sum: {
570
+ type: "number",
571
+ format: "double",
572
+ description: "Sum of the data",
573
+ example: 69.42,
574
+ readOnly: true
575
+ }
576
+ }
577
+ }
578
+ },
579
+ examples: {
580
+ ChannelData: {
581
+ id: "507f1f77bcf86cd799439011",
582
+ start_date: "2024-07-03T10:15:30Z",
583
+ end_date: "2024-07-03T11:15:30Z",
584
+ data: [
585
+ {
586
+ t: 1710251647e3,
587
+ v: 69.42
588
+ }
589
+ ],
590
+ size: 60,
591
+ synced: "TODO",
592
+ sum: 69.42
593
+ }
594
+ }
595
+ }
596
+ };
597
+
598
+ // app/models/docs/ChannelWithData.json
599
+ var ChannelWithData_default = {
600
+ components: {
601
+ schemas: {
602
+ ChannelWithData: {
603
+ allOf: [
604
+ {
605
+ $ref: "#/components/schemas/Channel"
606
+ },
607
+ {
608
+ type: "object",
609
+ properties: {
610
+ channel_latest_value: {
611
+ type: "string",
612
+ description: "Latest value of the channel",
613
+ example: "25.0",
614
+ readOnly: true
615
+ },
616
+ channel_latest_timestamp: {
617
+ type: "string",
618
+ format: "date-time",
619
+ description: "Timestamp of the latest value",
620
+ example: 1700034034,
621
+ readOnly: true
622
+ },
623
+ channel_alarm_state: {
624
+ type: "string",
625
+ description: "Alarm state of the channel",
626
+ example: "NoAlarm",
627
+ readOnly: true
628
+ }
629
+ }
630
+ }
631
+ ],
632
+ required: [
633
+ "channel_tag",
634
+ "channel_description",
635
+ "channel_type",
636
+ "channel_latest_value",
637
+ "channel_latest_timestamp",
638
+ "channel_alarm_state"
639
+ ]
640
+ }
641
+ },
642
+ examples: {
643
+ ChannelWithData: {
644
+ value: {
645
+ id: "507f1f77bcf86cd799439011",
646
+ channel_tag: "MOTOR_PS_TEMP",
647
+ channel_description: "Motor Power Supply Temperature",
648
+ channel_type: "Analogic",
649
+ channel_latest_value: 420.69,
650
+ channel_latest_timestamp: 1700034034,
651
+ channel_alarm_state: "NoAlarm"
652
+ }
653
+ }
654
+ }
655
+ }
656
+ };
657
+
658
+ // app/models/docs/ChannelDataPoint.json
659
+ var ChannelDataPoint_default2 = {
660
+ components: {
661
+ schemas: {
662
+ ChannelDataPoint: {
663
+ type: "object",
664
+ description: "ChannelDataPoint object. This is the object that is sent to and from the API. It includes only the timestamp and the value. No id is included because the data is stored inside a larger bucket in the database.",
665
+ properties: {
666
+ c: {
667
+ type: "string",
668
+ description: "Channel ID associated with the data point",
669
+ example: "U001_001",
670
+ readOnly: true
671
+ },
672
+ t: {
673
+ type: "integer",
674
+ format: "int64",
675
+ description: "Timestamp of the data",
676
+ example: 1710251647e3,
677
+ readOnly: true
678
+ },
679
+ v: {
680
+ type: "number",
681
+ format: "double",
682
+ description: "Value of the data",
683
+ example: 69.42,
684
+ readOnly: true
685
+ }
686
+ }
687
+ }
688
+ },
689
+ examples: {
690
+ ChannelDataPoint: {
691
+ c: "U001_001",
692
+ t: 1710251647e3,
693
+ v: 69.42
694
+ }
695
+ }
696
+ }
697
+ };
698
+
699
+ // app/models/docs/Event.json
700
+ var Event_default2 = {
701
+ components: {
702
+ schemas: {
703
+ Event: {
704
+ type: "object",
705
+ description: "Event object. This is the object that is sent to and from the API. It includes the id as a string, the timestamp as a number and the creation timestamp is not included.",
706
+ properties: {
707
+ id: {
708
+ type: "string",
709
+ format: "ObjectId",
710
+ description: "MongoDB ObjectId",
711
+ example: "507f1f77bcf86cd799439011",
712
+ readOnly: true
713
+ },
714
+ event_message: {
715
+ type: "string",
716
+ format: "text",
717
+ description: "Event message",
718
+ example: "Event message"
719
+ },
720
+ event_source: {
721
+ type: "string",
722
+ format: "text",
723
+ description: "Hostname of the source of the event",
724
+ example: "RMS1"
725
+ },
726
+ event_category: {
727
+ type: "string",
728
+ format: "text",
729
+ description: "Event category",
730
+ example: "Login",
731
+ enum: "%%EVENT_CATEGORY_ENUM%%"
732
+ },
733
+ event_type: {
734
+ type: "string",
735
+ format: "text",
736
+ description: "Event type",
737
+ example: "Login"
738
+ },
739
+ event_timestamp: {
740
+ type: "number",
741
+ format: "timestamp",
742
+ description: "Event timestamp",
743
+ example: 1709899759
744
+ },
745
+ event_data: {
746
+ type: "object",
747
+ description: "Event data. Not validated, just stored"
748
+ }
749
+ },
750
+ required: [
751
+ "event_message",
752
+ "event_source",
753
+ "event_category",
754
+ "event_type",
755
+ "event_timestamp"
756
+ ]
757
+ }
758
+ },
759
+ examples: {
760
+ Event: {
761
+ value: {
762
+ id: "507f1f77bcf86cd799439011",
763
+ event_message: "Profile Root logged in for the next 600 seconds, replacing profile Root.",
764
+ event_source: "RMS1",
765
+ event_category: "Login",
766
+ event_type: "LoiginSuccessful",
767
+ event_timestamp: 1709899759,
768
+ event_data: {
769
+ profile: "Root",
770
+ duration: 600,
771
+ replaced_profile: "Monitor"
772
+ }
773
+ }
774
+ }
775
+ }
776
+ }
777
+ };
778
+
779
+ // app/models/docs/History.json
780
+ var History_default2 = {
781
+ components: {
782
+ schemas: {
783
+ History: {
784
+ type: "object",
785
+ properties: {
786
+ id: {
787
+ type: "string",
788
+ format: "ObjectId",
789
+ description: "MongoDB ObjectId",
790
+ example: "507f1f77bcf86cd799439011",
791
+ readOnly: true
792
+ },
793
+ channel_tag: {
794
+ type: "string",
795
+ format: "text",
796
+ description: "Channel tag",
797
+ example: "Channel tag",
798
+ readOnly: true
799
+ },
800
+ alarm_timestamp: {
801
+ type: "string",
802
+ format: "date-time",
803
+ description: "Alarm timestamp",
804
+ example: "2020-12-31T23:59:59Z",
805
+ readOnly: true
806
+ },
807
+ alarm_priority: {
808
+ type: "string",
809
+ format: "text",
810
+ description: "Alarm priority",
811
+ example: "Alarm",
812
+ enum: "%%ALARM_PRIORITY_ENUM%%",
813
+ readOnly: true
814
+ },
815
+ alarm_original_state: {
816
+ type: "string",
817
+ format: "text",
818
+ description: "Alarm original state",
819
+ example: "Inactive",
820
+ enum: "%%DIAMAR_ALARM_STATE_ENUM%%",
821
+ readOnly: true
822
+ },
823
+ alarm_state: {
824
+ type: "string",
825
+ format: "text",
826
+ description: "Alarm new state",
827
+ example: "Inactive",
828
+ enum: "%%CLOUD_ALARM_STATE_ENUM%%",
829
+ readOnly: true
830
+ },
831
+ alarm_type: {
832
+ type: "string",
833
+ format: "text",
834
+ description: "Alarm type",
835
+ example: "AlarmOpen",
836
+ enum: "%%ALARM_TYPE_ENUM%%",
837
+ readOnly: true
838
+ },
839
+ alarm_value: {
840
+ type: "number",
841
+ format: "double",
842
+ description: "Alarm value",
843
+ example: 0,
844
+ readOnly: true
845
+ },
846
+ alarm_message: {
847
+ type: "string",
848
+ format: "text",
849
+ description: "Alarm message",
850
+ example: "Alarm message",
851
+ readOnly: true
852
+ }
853
+ },
854
+ required: [
855
+ "channel_tag",
856
+ "alarm_timestamp",
857
+ "alarm_priority",
858
+ "alarm_original_state",
859
+ "alarm_state",
860
+ "alarm_type",
861
+ "alarm_value",
862
+ "alarm_message"
863
+ ]
864
+ }
865
+ },
866
+ examples: {
867
+ History: {
868
+ value: {
869
+ id: "507f1f77bcf86cd799439011",
870
+ channel_tag: "Channel tag",
871
+ alarm_timestamp: "2020-12-31T23:59:59Z",
872
+ alarm_priority: "Alarm",
873
+ alarm_original_state: "Inactive",
874
+ alarm_state: "Inactive",
875
+ alarm_type: "AlarmOpen",
876
+ alarm_value: 0,
877
+ alarm_message: "AlarmOpen Value: [OP]"
878
+ }
879
+ }
880
+ }
881
+ }
882
+ };
16
883
 
17
- // app/types/channel.types.ts
18
- var ChannelBaseTypes = {
19
- VIRTUAL_ANALOG: "VirtualAnalog",
20
- VIRTUAL_DIGITAL: "VirtualDigital",
21
- VIRTUAL_STRING: "VirtualString",
22
- WIRED_ANALOG: "WiredAnalog",
23
- WIRED_DIGITAL: "WiredDigital"
24
- };
25
- var ChannelSpecificTypes = {
26
- // Wired types
27
- DIGITAL_INPUT: "DigitalInput",
28
- DIGITAL_OUTPUT: "DigitalOutput",
29
- ANALOG_INPUT: "AnalogInput",
30
- ANALOG_OUTPUT: "AnalogOutput",
31
- // Virtual types
32
- ANALOG_SOFTWARE: "AnalogSoftware",
33
- DIGITAL_SOFTWARE: "DigitalSoftware",
34
- VIRTUAL_STRING: "VirtualString",
35
- COMMAND: "Command",
36
- // Virtual logic types
37
- BROADCAST_COMMAND: "BroadcastCommand",
38
- // To be deleted in the near future
39
- SOFTWARE: "Software",
40
- ANALOG_TIMER: "AnalogTimer",
41
- // Serial types
42
- SERIAL_DIGITAL_INPUT: "SerialDigitalInput",
43
- SERIAL_DIGITAL_OUTPUT: "SerialDigitalOutput",
44
- SERIAL_LINE_COMMAND: "SerialLineCommand",
45
- SERIAL_ANALOG_INPUT: "SerialAnalogInput",
46
- SERIAL_ANALOG_OUTPUT: "SerialAnalogOutput"
884
+ // app/models/docs/Unit.json
885
+ var Unit_default2 = {
886
+ components: {
887
+ schemas: {
888
+ Unit: {
889
+ type: "object",
890
+ properties: {
891
+ id: {
892
+ type: "string",
893
+ format: "ObjectId",
894
+ description: "MongoDB ObjectId",
895
+ example: "507f1f77bcf86cd799439011",
896
+ readOnly: true
897
+ },
898
+ unit_id: {
899
+ type: "string",
900
+ description: "Unit identifier in Diamar",
901
+ example: "127",
902
+ readOnly: true
903
+ },
904
+ unit_internal_description: {
905
+ type: "string",
906
+ description: "Unit description",
907
+ example: "Motor Power Supply",
908
+ readOnly: true
909
+ },
910
+ unit_enabled: {
911
+ type: "boolean",
912
+ description: "Unit enabled",
913
+ example: true,
914
+ readOnly: true
915
+ },
916
+ unit_type: {
917
+ type: "string",
918
+ description: "Unit type",
919
+ example: "DIM36",
920
+ readOnly: true
921
+ },
922
+ unit_cabinet_id: {
923
+ type: "string",
924
+ description: "Cabinet identifier",
925
+ example: "Cabinet 1",
926
+ readOnly: true
927
+ }
928
+ },
929
+ required: [
930
+ "unit_id",
931
+ "unit_internal_description",
932
+ "unit_enabled",
933
+ "unit_type",
934
+ "unit_cabinet_id"
935
+ ]
936
+ }
937
+ },
938
+ examples: {
939
+ Unit: {
940
+ value: {
941
+ id: "507f1f77bcf86cd799439011",
942
+ unit_id: "127",
943
+ unit_internal_description: "Motor Power Supply",
944
+ unit_enabled: true,
945
+ unit_type: "DIM36",
946
+ unit_cabinet_id: "Cabinet 1"
947
+ }
948
+ }
949
+ }
950
+ }
47
951
  };
48
952
 
953
+ // app/models/docs/index.ts
954
+ History_default2.components.schemas.History.properties.alarm_priority.enum = Object.values(AlarmPriorities);
955
+ History_default2.components.schemas.History.properties.alarm_state.enum = Object.values(CloudAlarmStates);
956
+ History_default2.components.schemas.History.properties.alarm_original_state.enum = Object.values(DiamarAlarmStates);
957
+ History_default2.components.schemas.History.properties.alarm_type.enum = Object.values(AlarmTypes);
958
+ Event_default2.components.schemas.Event.properties.event_category.enum = Object.values(EventCategories);
959
+ var Docs = {
960
+ ChannelDocs: Channel_default2,
961
+ ChannelDataBucketDocs: ChannelDataBucket_default2,
962
+ ChannelWithDataDocs: ChannelWithData_default,
963
+ ChannelDataPointDocs: ChannelDataPoint_default2,
964
+ EventDocs: Event_default2,
965
+ HistoryDocs: History_default2,
966
+ UnitDocs: Unit_default2
967
+ };
968
+ var docs_default = Docs;
969
+
49
970
  // app/index.ts
50
- init_event_types();
51
- init_unit_types();
971
+ import mongoose7 from "mongoose";
972
+ import mongooseAutopopulate2 from "mongoose-autopopulate";
973
+ import mongoosePaginate7 from "mongoose-paginate-v2";
974
+ import mongooseAggregatePaginate7 from "mongoose-aggregate-paginate-v2";
975
+ var Schemas = {
976
+ Channel: Channel_default,
977
+ ChannelDataBucket: ChannelDataBucket_default,
978
+ ChannelDataPoint: ChannelDataPoint_default,
979
+ Event: Event_default,
980
+ History: History_default,
981
+ Unit: Unit_default
982
+ };
983
+ var Mimics = {
984
+ // Auxiliary
985
+ ImageAuxiliaryJson,
986
+ LineAuxiliaryJson,
987
+ LinkAuxiliaryJson,
988
+ PolylineAuxiliaryJson,
989
+ SquareAuxiliaryJson,
990
+ TextAuxiliaryJson,
991
+ // Channel
992
+ ChannelJson,
993
+ // Control elements
994
+ CompressorJson,
995
+ DamperJson,
996
+ DamperAutomatedJson,
997
+ FanJson,
998
+ PumpJson,
999
+ PumpAutomatedJson,
1000
+ TankJson,
1001
+ ValveJson,
1002
+ ValveAutomatedJson,
1003
+ // Elements
1004
+ AlarmIndicatorJson,
1005
+ CommandJson,
1006
+ DialJson,
1007
+ DigitalJson,
1008
+ DisplayJson,
1009
+ DynamicTextJson,
1010
+ LevelBarJson,
1011
+ SliderJson,
1012
+ TextChannelJson,
1013
+ ToggleJson,
1014
+ // IAS elements
1015
+ CabinetJson,
1016
+ RepeaterJson,
1017
+ StationJson,
1018
+ UnitJson,
1019
+ // Support
1020
+ AddedAlarmsJson,
1021
+ BackgroundJson,
1022
+ LineJson,
1023
+ LocalizedTextJson,
1024
+ LocationJson,
1025
+ LogicExpressionJson,
1026
+ LogicExpressionsJson,
1027
+ ScaleJson,
1028
+ TextAttributesJson,
1029
+ TitleJson,
1030
+ // Traits
1031
+ AutomaticSemiAutoJson,
1032
+ CommandsOpClJson,
1033
+ CommandsStartStopJson,
1034
+ ControlLockJson,
1035
+ FeedbackOpClJson,
1036
+ FeedbackRunningStoppedJson,
1037
+ OrderOpClJson,
1038
+ OrderStartStopJson,
1039
+ RemoteLocalJson,
1040
+ TripResetJson,
1041
+ // PMS elements
1042
+ BreakerJson,
1043
+ BreakerPmsJson,
1044
+ GeneratorJson,
1045
+ GeneratorPmsJson,
1046
+ OperationModesJson,
1047
+ PriorityDataJson,
1048
+ PrioritiesJson,
1049
+ ShaftJson
1050
+ };
1051
+ var MimicsTypes = {
1052
+ MimicElementTypes,
1053
+ ZDepths,
1054
+ TitleAligns,
1055
+ DigitalStates,
1056
+ DigitalAlarmStates,
1057
+ AlarmStates,
1058
+ ActivationModes,
1059
+ TextAnchorPoints,
1060
+ ValveDesigns,
1061
+ FanDesigns,
1062
+ FanRunStates,
1063
+ FanDirections,
1064
+ FanTypes,
1065
+ LevelBarOrientations,
1066
+ SliderOrientations,
1067
+ CompressorDesigns,
1068
+ LedTypes,
1069
+ InfoLocations,
1070
+ MarkTypes,
1071
+ ScalePositions,
1072
+ ValueTypes,
1073
+ OperationModeStates,
1074
+ UnitDesigns,
1075
+ StationDesigns,
1076
+ RepeaterDesigns,
1077
+ CabinetDesigns,
1078
+ LinkDesigns,
1079
+ OpClStates,
1080
+ RunningStoppedStates
1081
+ };
52
1082
  var Types = {
53
1083
  AlarmTypes,
54
1084
  AlarmPriorities,
55
1085
  CloudAlarmStates,
56
1086
  DiamarAlarmStates,
57
- ChannelBaseTypes,
58
- ChannelSpecificTypes,
59
1087
  EventCategories,
60
- EventCriticalities,
61
- UnitTypes
1088
+ Mimics: MimicsTypes
1089
+ };
1090
+ var index_default = {
1091
+ Schemas,
1092
+ Docs: docs_default,
1093
+ Mimics,
1094
+ Types,
1095
+ mongoose: mongoose7,
1096
+ mongoosePaginate: mongoosePaginate7,
1097
+ mongooseAggregatePaginate: mongooseAggregatePaginate7,
1098
+ mongooseAutopopulate: mongooseAutopopulate2
62
1099
  };
63
1100
  export {
64
- Types
1101
+ index_default as default
65
1102
  };