@sedni/cloud_common 1.1.0 → 2.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/chunk-NCUZ3O3P.js +152 -0
- package/dist/index.cjs +137 -0
- package/dist/index.d.cts +87 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +63 -0
- package/dist/node-entry.cjs +1191 -0
- package/{index.js → dist/node-entry.d.cts} +8 -8
- package/dist/node-entry.d.ts +53 -0
- package/dist/node-entry.js +1078 -0
- package/package.json +16 -3
- package/tsconfig.json +20 -0
- package/tsconfig.node.json +12 -0
- package/app/models/Channel.js +0 -73
- package/app/models/ChannelDataBucket.js +0 -321
- package/app/models/Event.js +0 -90
- package/app/models/History.js +0 -106
- package/app/models/Unit.js +0 -68
- package/app/models/docs/Channel.json +0 -58
- package/app/models/docs/ChannelDataBucket.json +0 -101
- package/app/models/docs/ChannelWithData.json +0 -58
- package/app/models/docs/DataPoint.json +0 -32
- package/app/models/docs/Event.json +0 -78
- package/app/models/docs/History.json +0 -103
- package/app/models/docs/Unit.json +0 -67
- package/app/models/docs/index.js +0 -32
- package/app/types/alarm.types.js +0 -53
- package/app/types/channel.types.js +0 -43
- package/app/types/event.types.js +0 -15
- package/app/types/unit.types.js +0 -15
package/app/models/Unit.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const mongooseAutopopulate = require("mongoose-autopopulate");
|
|
3
|
-
const mongoosePaginate = require("mongoose-paginate-v2");
|
|
4
|
-
const mongooseAggregatePaginate = require("mongoose-aggregate-paginate-v2");
|
|
5
|
-
const { UnitTypes } = require("../types/unit.types");
|
|
6
|
-
|
|
7
|
-
const unitSchema = new mongoose.Schema({
|
|
8
|
-
unit_id: {
|
|
9
|
-
type: String,
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
unit_enabled: {
|
|
13
|
-
type: Boolean,
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
unit_type: {
|
|
17
|
-
type: String,
|
|
18
|
-
required: true,
|
|
19
|
-
enum : Object.values(UnitTypes),
|
|
20
|
-
},
|
|
21
|
-
unit_internal_description: {
|
|
22
|
-
type: String,
|
|
23
|
-
required: true,
|
|
24
|
-
},
|
|
25
|
-
unit_cabinet_id: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: false,
|
|
28
|
-
},
|
|
29
|
-
}, {
|
|
30
|
-
timestamps: true,
|
|
31
|
-
collection: "units",
|
|
32
|
-
toJSON: {
|
|
33
|
-
transform: function (doc, ret)
|
|
34
|
-
{
|
|
35
|
-
ret.id = ret._id;
|
|
36
|
-
delete ret._id;
|
|
37
|
-
delete ret.__v;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* ///////////////////////////////////////////////
|
|
44
|
-
* ///////////// INDEXES /////////////////
|
|
45
|
-
* ///////////////////////////////////////////////
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Index used primarily for filtering by unit_id and ensuring uniqueness
|
|
50
|
-
*/
|
|
51
|
-
unitSchema.index({ "unit_id" : 1 }, { unique: true });
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Index used primarily for filtering by unit_internal_description
|
|
55
|
-
*/
|
|
56
|
-
unitSchema.index({ "unit_internal_description" : 1 });
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* ///////////////////////////////////////////////
|
|
61
|
-
* ///////////// PLUGINS /////////////////
|
|
62
|
-
* ///////////////////////////////////////////////
|
|
63
|
-
*/
|
|
64
|
-
unitSchema.plugin(mongoosePaginate);
|
|
65
|
-
unitSchema.plugin(mongooseAggregatePaginate);
|
|
66
|
-
unitSchema.plugin(mongooseAutopopulate);
|
|
67
|
-
|
|
68
|
-
module.exports = unitSchema;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"Channel": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"id": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"format": "ObjectId",
|
|
10
|
-
"description": "MongoDB ObjectId",
|
|
11
|
-
"example": "507f1f77bcf86cd799439011",
|
|
12
|
-
"readOnly": true
|
|
13
|
-
},
|
|
14
|
-
"channel_tag": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "Channel tag",
|
|
17
|
-
"example": "MOTOR_PS_TEMP",
|
|
18
|
-
"readOnly": true
|
|
19
|
-
},
|
|
20
|
-
"channel_description": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "Channel description",
|
|
23
|
-
"example": "Motor Power Supply Temperature",
|
|
24
|
-
"readOnly": true
|
|
25
|
-
},
|
|
26
|
-
"channel_unit_id" : {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"format": "ObjectId",
|
|
29
|
-
"description": "Unit of the channel",
|
|
30
|
-
"example": "507f1f77bcf86cd799439011",
|
|
31
|
-
"readOnly": true
|
|
32
|
-
},
|
|
33
|
-
"channel_parsed": {
|
|
34
|
-
"type" : "object",
|
|
35
|
-
"description": "Parsed channel data",
|
|
36
|
-
"readOnly": true
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"required": [
|
|
40
|
-
"channel_tag",
|
|
41
|
-
"channel_description",
|
|
42
|
-
"channel_unit_id",
|
|
43
|
-
"channel_parsed"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"examples": {
|
|
48
|
-
"Channel": {
|
|
49
|
-
"value": {
|
|
50
|
-
"id": "507f1f77bcf86cd799439011",
|
|
51
|
-
"channel_tag": "MOTOR_PS_TEMP",
|
|
52
|
-
"channel_description": "Motor Power Supply Temperature",
|
|
53
|
-
"channel_type": "Analogic"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"ChannelData": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "ChannelData object. This is the bucket where the data is stored, in batches of 1 hour.",
|
|
7
|
-
"properties": {
|
|
8
|
-
"id": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"format": "ObjectId",
|
|
11
|
-
"description": "MongoDB ObjectId",
|
|
12
|
-
"example": "507f1f77bcf86cd799439011",
|
|
13
|
-
"readOnly": true
|
|
14
|
-
},
|
|
15
|
-
"start_date": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"format": "date-time",
|
|
18
|
-
"description": "Start date of the data",
|
|
19
|
-
"example": "2024-07-03T10:15:30Z",
|
|
20
|
-
"readOnly": true
|
|
21
|
-
},
|
|
22
|
-
"end_date": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"format": "date-time",
|
|
25
|
-
"description": "End date of the data",
|
|
26
|
-
"example": "2024-07-03T11:15:30Z",
|
|
27
|
-
"readOnly": true
|
|
28
|
-
},
|
|
29
|
-
"data": {
|
|
30
|
-
"type": "array",
|
|
31
|
-
"description": "Data array of DataPoint objects",
|
|
32
|
-
"items": {
|
|
33
|
-
"$ref": "#/components/schemas/DataPoint"
|
|
34
|
-
},
|
|
35
|
-
"readOnly": false
|
|
36
|
-
},
|
|
37
|
-
"size" : {
|
|
38
|
-
"type" : "integer",
|
|
39
|
-
"format" : "int64",
|
|
40
|
-
"description" : "Size of the data array",
|
|
41
|
-
"example" : 60,
|
|
42
|
-
"readOnly": true
|
|
43
|
-
},
|
|
44
|
-
"synced" : {
|
|
45
|
-
"type" : "TODO",
|
|
46
|
-
"description" : "TODO",
|
|
47
|
-
"example" : "TODO",
|
|
48
|
-
"readOnly": true
|
|
49
|
-
},
|
|
50
|
-
"sum" : {
|
|
51
|
-
"type" : "number",
|
|
52
|
-
"format" : "double",
|
|
53
|
-
"description" : "Sum of the data",
|
|
54
|
-
"example" : 69.420,
|
|
55
|
-
"readOnly": true
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"DataPoint" : {
|
|
60
|
-
"type": "object",
|
|
61
|
-
"description": "DataPoint 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.",
|
|
62
|
-
"properties": {
|
|
63
|
-
"timestamp" : {
|
|
64
|
-
"type" : "integer",
|
|
65
|
-
"format" : "int64",
|
|
66
|
-
"description" : "Timestamp of the data",
|
|
67
|
-
"example" : 1710251647000,
|
|
68
|
-
"readOnly": true
|
|
69
|
-
},
|
|
70
|
-
"value" : {
|
|
71
|
-
"type" : "number",
|
|
72
|
-
"format" : "double",
|
|
73
|
-
"description" : "Value of the data",
|
|
74
|
-
"example" : 69.420,
|
|
75
|
-
"readOnly": true
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"examples" : {
|
|
81
|
-
"ChannelData": {
|
|
82
|
-
"id" : "507f1f77bcf86cd799439011",
|
|
83
|
-
"start_date" : "2024-07-03T10:15:30Z",
|
|
84
|
-
"end_date" : "2024-07-03T11:15:30Z",
|
|
85
|
-
"data" : [
|
|
86
|
-
{
|
|
87
|
-
"timestamp" : 1710251647000,
|
|
88
|
-
"value" : 69.420
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"size" : 60,
|
|
92
|
-
"synced" : "TODO",
|
|
93
|
-
"sum" : 69.420
|
|
94
|
-
},
|
|
95
|
-
"DataPoint" : {
|
|
96
|
-
"timestamp" : 1710251647000,
|
|
97
|
-
"value" : 69.420
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"ChannelWithData": {
|
|
5
|
-
"allOf": [
|
|
6
|
-
{
|
|
7
|
-
"$ref": "#/components/schemas/Channel"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"type": "object",
|
|
11
|
-
"properties": {
|
|
12
|
-
"channel_latest_value": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"description": "Latest value of the channel",
|
|
15
|
-
"example": "25.0",
|
|
16
|
-
"readOnly": true
|
|
17
|
-
},
|
|
18
|
-
"channel_latest_timestamp": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"format": "date-time",
|
|
21
|
-
"description": "Timestamp of the latest value",
|
|
22
|
-
"example": 1700034034,
|
|
23
|
-
"readOnly": true
|
|
24
|
-
},
|
|
25
|
-
"channel_alarm_state": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"description": "Alarm state of the channel",
|
|
28
|
-
"example": "NoAlarm",
|
|
29
|
-
"readOnly": true
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"required": [
|
|
35
|
-
"channel_tag",
|
|
36
|
-
"channel_description",
|
|
37
|
-
"channel_type",
|
|
38
|
-
"channel_latest_value",
|
|
39
|
-
"channel_latest_timestamp",
|
|
40
|
-
"channel_alarm_state"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"examples": {
|
|
45
|
-
"ChannelWithData": {
|
|
46
|
-
"value": {
|
|
47
|
-
"id": "507f1f77bcf86cd799439011",
|
|
48
|
-
"channel_tag": "MOTOR_PS_TEMP",
|
|
49
|
-
"channel_description": "Motor Power Supply Temperature",
|
|
50
|
-
"channel_type": "Analogic",
|
|
51
|
-
"channel_latest_value": 420.69,
|
|
52
|
-
"channel_latest_timestamp": 1700034034,
|
|
53
|
-
"channel_alarm_state": "NoAlarm"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"DataPoint" : {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "DataPoint 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.",
|
|
7
|
-
"properties": {
|
|
8
|
-
"timestamp" : {
|
|
9
|
-
"type" : "integer",
|
|
10
|
-
"format" : "int64",
|
|
11
|
-
"description" : "Timestamp of the data",
|
|
12
|
-
"example" : 1710251647000,
|
|
13
|
-
"readOnly": true
|
|
14
|
-
},
|
|
15
|
-
"value" : {
|
|
16
|
-
"type" : "number",
|
|
17
|
-
"format" : "double",
|
|
18
|
-
"description" : "Value of the data",
|
|
19
|
-
"example" : 69.420,
|
|
20
|
-
"readOnly": true
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"examples" : {
|
|
26
|
-
"DataPoint" : {
|
|
27
|
-
"timestamp" : 1710251647000,
|
|
28
|
-
"value" : 69.420
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"Event": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"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.",
|
|
7
|
-
"properties": {
|
|
8
|
-
"id": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"format": "ObjectId",
|
|
11
|
-
"description": "MongoDB ObjectId",
|
|
12
|
-
"example": "507f1f77bcf86cd799439011",
|
|
13
|
-
"readOnly": true
|
|
14
|
-
},
|
|
15
|
-
"event_message": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"format": "text",
|
|
18
|
-
"description": "Event message",
|
|
19
|
-
"example": "Event message"
|
|
20
|
-
},
|
|
21
|
-
"event_source": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"format": "text",
|
|
24
|
-
"description": "Hostname of the source of the event",
|
|
25
|
-
"example": "RMS1"
|
|
26
|
-
},
|
|
27
|
-
"event_category": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"format": "text",
|
|
30
|
-
"description": "Event category",
|
|
31
|
-
"example": "Login",
|
|
32
|
-
"enum": "%%EVENT_CATEGORY_ENUM%%"
|
|
33
|
-
},
|
|
34
|
-
"event_type": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"format": "text",
|
|
37
|
-
"description": "Event type",
|
|
38
|
-
"example": "Login"
|
|
39
|
-
},
|
|
40
|
-
"event_timestamp": {
|
|
41
|
-
"type": "number",
|
|
42
|
-
"format": "timestamp",
|
|
43
|
-
"description": "Event timestamp",
|
|
44
|
-
"example": 1709899759
|
|
45
|
-
},
|
|
46
|
-
"event_data" : {
|
|
47
|
-
"type": "object",
|
|
48
|
-
"description": "Event data. Not validated, just stored"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"required": [
|
|
52
|
-
"event_message",
|
|
53
|
-
"event_source",
|
|
54
|
-
"event_category",
|
|
55
|
-
"event_type",
|
|
56
|
-
"event_timestamp"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"examples" : {
|
|
61
|
-
"Event" : {
|
|
62
|
-
"value" : {
|
|
63
|
-
"id": "507f1f77bcf86cd799439011",
|
|
64
|
-
"event_message": "Profile Root logged in for the next 600 seconds, replacing profile Root.",
|
|
65
|
-
"event_source": "RMS1",
|
|
66
|
-
"event_category": "Login",
|
|
67
|
-
"event_type": "LoiginSuccessful",
|
|
68
|
-
"event_timestamp": 1709899759,
|
|
69
|
-
"event_data" : {
|
|
70
|
-
"profile": "Root",
|
|
71
|
-
"duration": 600,
|
|
72
|
-
"replaced_profile": "Monitor"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"History": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"id": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"format": "ObjectId",
|
|
10
|
-
"description": "MongoDB ObjectId",
|
|
11
|
-
"example": "507f1f77bcf86cd799439011",
|
|
12
|
-
"readOnly": true
|
|
13
|
-
},
|
|
14
|
-
"channel_tag": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"format": "text",
|
|
17
|
-
"description": "Channel tag",
|
|
18
|
-
"example": "Channel tag",
|
|
19
|
-
"readOnly": true
|
|
20
|
-
},
|
|
21
|
-
"alarm_timestamp": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"format": "date-time",
|
|
24
|
-
"description": "Alarm timestamp",
|
|
25
|
-
"example": "2020-12-31T23:59:59Z",
|
|
26
|
-
"readOnly": true
|
|
27
|
-
},
|
|
28
|
-
"alarm_priority": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"format": "text",
|
|
31
|
-
"description": "Alarm priority",
|
|
32
|
-
"example": "Alarm",
|
|
33
|
-
"enum": "%%ALARM_PRIORITY_ENUM%%",
|
|
34
|
-
"readOnly": true
|
|
35
|
-
},
|
|
36
|
-
"alarm_original_state" : {
|
|
37
|
-
"type": "string",
|
|
38
|
-
"format": "text",
|
|
39
|
-
"description": "Alarm original state",
|
|
40
|
-
"example": "Inactive",
|
|
41
|
-
"enum": "%%DIAMAR_ALARM_STATE_ENUM%%",
|
|
42
|
-
"readOnly": true
|
|
43
|
-
},
|
|
44
|
-
"alarm_state" : {
|
|
45
|
-
"type": "string",
|
|
46
|
-
"format": "text",
|
|
47
|
-
"description": "Alarm new state",
|
|
48
|
-
"example": "Inactive",
|
|
49
|
-
"enum": "%%CLOUD_ALARM_STATE_ENUM%%",
|
|
50
|
-
"readOnly": true
|
|
51
|
-
},
|
|
52
|
-
"alarm_type": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"format": "text",
|
|
55
|
-
"description": "Alarm type",
|
|
56
|
-
"example" : "AlarmOpen",
|
|
57
|
-
"enum": "%%ALARM_TYPE_ENUM%%",
|
|
58
|
-
"readOnly": true
|
|
59
|
-
},
|
|
60
|
-
"alarm_value": {
|
|
61
|
-
"type": "number",
|
|
62
|
-
"format": "double",
|
|
63
|
-
"description": "Alarm value",
|
|
64
|
-
"example": 0.0,
|
|
65
|
-
"readOnly": true
|
|
66
|
-
},
|
|
67
|
-
"alarm_message": {
|
|
68
|
-
"type": "string",
|
|
69
|
-
"format": "text",
|
|
70
|
-
"description": "Alarm message",
|
|
71
|
-
"example": "Alarm message",
|
|
72
|
-
"readOnly": true
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"required": [
|
|
76
|
-
"channel_tag",
|
|
77
|
-
"alarm_timestamp",
|
|
78
|
-
"alarm_priority",
|
|
79
|
-
"alarm_original_state",
|
|
80
|
-
"alarm_state",
|
|
81
|
-
"alarm_type",
|
|
82
|
-
"alarm_value",
|
|
83
|
-
"alarm_message"
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
"examples" : {
|
|
88
|
-
"History": {
|
|
89
|
-
"value": {
|
|
90
|
-
"id": "507f1f77bcf86cd799439011",
|
|
91
|
-
"channel_tag": "Channel tag",
|
|
92
|
-
"alarm_timestamp": "2020-12-31T23:59:59Z",
|
|
93
|
-
"alarm_priority": "Alarm",
|
|
94
|
-
"alarm_original_state": "Inactive",
|
|
95
|
-
"alarm_state": "Inactive",
|
|
96
|
-
"alarm_type": "AlarmOpen",
|
|
97
|
-
"alarm_value": 0.0,
|
|
98
|
-
"alarm_message": "AlarmOpen Value: [OP]"
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": {
|
|
3
|
-
"schemas": {
|
|
4
|
-
"Unit": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"id": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"format": "ObjectId",
|
|
10
|
-
"description": "MongoDB ObjectId",
|
|
11
|
-
"example": "507f1f77bcf86cd799439011",
|
|
12
|
-
"readOnly": true
|
|
13
|
-
},
|
|
14
|
-
"unit_id": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "Unit identifier in Diamar",
|
|
17
|
-
"example": "127",
|
|
18
|
-
"readOnly": true
|
|
19
|
-
},
|
|
20
|
-
"unit_internal_description": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "Unit description",
|
|
23
|
-
"example": "Motor Power Supply",
|
|
24
|
-
"readOnly": true
|
|
25
|
-
},
|
|
26
|
-
"unit_enabled" : {
|
|
27
|
-
"type": "boolean",
|
|
28
|
-
"description": "Unit enabled",
|
|
29
|
-
"example": true,
|
|
30
|
-
"readOnly": true
|
|
31
|
-
},
|
|
32
|
-
"unit_type" : {
|
|
33
|
-
"type": "string",
|
|
34
|
-
"description": "Unit type",
|
|
35
|
-
"example": "DIM36",
|
|
36
|
-
"readOnly": true
|
|
37
|
-
},
|
|
38
|
-
"unit_cabinet_id" : {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"description": "Cabinet identifier",
|
|
41
|
-
"example": "Cabinet 1",
|
|
42
|
-
"readOnly": true
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"required": [
|
|
46
|
-
"unit_id",
|
|
47
|
-
"unit_internal_description",
|
|
48
|
-
"unit_enabled",
|
|
49
|
-
"unit_type",
|
|
50
|
-
"unit_cabinet_id"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"examples": {
|
|
55
|
-
"Unit": {
|
|
56
|
-
"value": {
|
|
57
|
-
"id": "507f1f77bcf86cd799439011",
|
|
58
|
-
"unit_id": "127",
|
|
59
|
-
"unit_internal_description": "Motor Power Supply",
|
|
60
|
-
"unit_enabled": true,
|
|
61
|
-
"unit_type": "DIM36",
|
|
62
|
-
"unit_cabinet_id": "Cabinet 1"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
package/app/models/docs/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const { AlarmTypes, AlarmPriorities, CloudAlarmStates, DiamarAlarmStates } = require("../../types/alarm.types");
|
|
2
|
-
const { EventCategories } = require("../../types/event.types");
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DOCS
|
|
6
|
-
*/
|
|
7
|
-
const ChannelDocs = require("./Channel.json");
|
|
8
|
-
const ChannelDataBucketDocs = require("./ChannelDataBucket.json");
|
|
9
|
-
const ChannelWithDataDocs = require("./ChannelWithData.json");
|
|
10
|
-
const DataPointDocs = require("./DataPoint.json");
|
|
11
|
-
const EventDocs = require("./Event.json");
|
|
12
|
-
const HistoryDocs = require("./History.json");
|
|
13
|
-
const UnitDocs = require("./Unit.json");
|
|
14
|
-
|
|
15
|
-
HistoryDocs.components.schemas.History.properties.alarm_priority.enum = Object.values(AlarmPriorities);
|
|
16
|
-
HistoryDocs.components.schemas.History.properties.alarm_state.enum = Object.values(CloudAlarmStates);
|
|
17
|
-
HistoryDocs.components.schemas.History.properties.alarm_original_state.enum = Object.values(DiamarAlarmStates);
|
|
18
|
-
HistoryDocs.components.schemas.History.properties.alarm_type.enum = Object.values(AlarmTypes);
|
|
19
|
-
|
|
20
|
-
EventDocs.components.schemas.Event.properties.event_category.enum = Object.values(EventCategories);
|
|
21
|
-
|
|
22
|
-
const Docs = {
|
|
23
|
-
ChannelDocs,
|
|
24
|
-
ChannelDataBucketDocs,
|
|
25
|
-
ChannelWithDataDocs,
|
|
26
|
-
DataPointDocs,
|
|
27
|
-
EventDocs,
|
|
28
|
-
HistoryDocs,
|
|
29
|
-
UnitDocs,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = Docs;
|
package/app/types/alarm.types.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const AlarmPriorities =
|
|
2
|
-
{
|
|
3
|
-
CRITICAL: "Critical",
|
|
4
|
-
ALARM: "Alarm",
|
|
5
|
-
WARNING: "Warning",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const DiamarAlarmStates =
|
|
9
|
-
{
|
|
10
|
-
INACTIVE: "Inactive",
|
|
11
|
-
ACKNOWLEDGED: "Acknowledged",
|
|
12
|
-
ACTIVE: "Active",
|
|
13
|
-
UNACKNOWLEDGED: "Unacknowledged",
|
|
14
|
-
UNDEFINED: "Undefined",
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const CloudAlarmStates =
|
|
18
|
-
{
|
|
19
|
-
INACTIVE: "Inactive",
|
|
20
|
-
ALARM: "Active",
|
|
21
|
-
ALARM_ACK: "Acknowledged",
|
|
22
|
-
WARNING: "WarningActive",
|
|
23
|
-
WARNING_ACK: "WarningAcknowledged",
|
|
24
|
-
RETURN_NO_ACK: "Unacknowledged",
|
|
25
|
-
INHIBITED: "Inhibited",
|
|
26
|
-
OFFSCAN : "Offscan",
|
|
27
|
-
UNDEFINED: "Undefined",
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const AlarmTypes =
|
|
31
|
-
{
|
|
32
|
-
NORMAL: "Normal",
|
|
33
|
-
ALARM_OPEN: "AlarmOpen",
|
|
34
|
-
ALARM_CLOSE: "AlarmClose",
|
|
35
|
-
ALARM_IFH: "AlarmIfh",
|
|
36
|
-
ALARM_HH: "AlarmHh",
|
|
37
|
-
ALARM_H: "AlarmH",
|
|
38
|
-
ALARM_L: "AlarmL",
|
|
39
|
-
ALARM_LL: "AlarmLl",
|
|
40
|
-
ALARM_IFL: "AlarmIfl",
|
|
41
|
-
ALARM_OFFSCAN: "AlarmOffScan",
|
|
42
|
-
ALARM_FAIL: "AlarmFail",
|
|
43
|
-
ALARM_INH: "AlarmInh",
|
|
44
|
-
ALARM_UNK: "AlarmUnk",
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
module.exports =
|
|
48
|
-
{
|
|
49
|
-
AlarmPriorities,
|
|
50
|
-
DiamarAlarmStates,
|
|
51
|
-
CloudAlarmStates,
|
|
52
|
-
AlarmTypes,
|
|
53
|
-
};
|