@ricado/api-client 2.5.14 → 2.5.15
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.
|
@@ -11,6 +11,8 @@ var _RTUModel = _interopRequireDefault(require("../Models/RTUModel"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
15
|
+
|
|
14
16
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
17
|
|
|
16
18
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -96,6 +98,104 @@ var RTUController = /*#__PURE__*/function () {
|
|
|
96
98
|
});
|
|
97
99
|
});
|
|
98
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Retrieve the Status of an RTU [GET /rtus/{id}/status]
|
|
103
|
+
*
|
|
104
|
+
* @static
|
|
105
|
+
* @public
|
|
106
|
+
* @param {number} id The RTU ID
|
|
107
|
+
* @return {Promise<RTUController.RTUStatusItem>}
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
}, {
|
|
111
|
+
key: "getOneStatus",
|
|
112
|
+
value: function getOneStatus(id) {
|
|
113
|
+
return new Promise(function (resolve, reject) {
|
|
114
|
+
_RequestHelper.default.getRequest("/rtus/".concat(id, "/status")).then(function (result) {
|
|
115
|
+
var resolveValue = function () {
|
|
116
|
+
var resultObject = {};
|
|
117
|
+
|
|
118
|
+
if (_typeof(result) === 'object' && 'id' in result) {
|
|
119
|
+
resultObject.id = function () {
|
|
120
|
+
if (typeof result.id !== 'number') {
|
|
121
|
+
return Number.isInteger(Number(result.id)) ? Number(result.id) : Math.floor(Number(result.id));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return Number.isInteger(result.id) ? result.id : Math.floor(result.id);
|
|
125
|
+
}();
|
|
126
|
+
} else {
|
|
127
|
+
resultObject.id = 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (_typeof(result) === 'object' && 'latency' in result) {
|
|
131
|
+
resultObject.latency = function () {
|
|
132
|
+
if (result.latency === null) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (typeof result.latency !== 'number') {
|
|
137
|
+
return Number(result.latency);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return result.latency;
|
|
141
|
+
}();
|
|
142
|
+
} else {
|
|
143
|
+
resultObject.latency = null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (_typeof(result) === 'object' && 'latencyTimestamp' in result) {
|
|
147
|
+
resultObject.latencyTimestamp = function () {
|
|
148
|
+
if (result.latencyTimestamp === null) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (typeof result.latencyTimestamp !== 'string') {
|
|
153
|
+
return new Date(String(result.latencyTimestamp));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return new Date(result.latencyTimestamp);
|
|
157
|
+
}();
|
|
158
|
+
} else {
|
|
159
|
+
resultObject.latencyTimestamp = null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (_typeof(result) === 'object' && 'lastSeenTimestamp' in result) {
|
|
163
|
+
resultObject.lastSeenTimestamp = function () {
|
|
164
|
+
if (result.lastSeenTimestamp === null) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (typeof result.lastSeenTimestamp !== 'string') {
|
|
169
|
+
return new Date(String(result.lastSeenTimestamp));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return new Date(result.lastSeenTimestamp);
|
|
173
|
+
}();
|
|
174
|
+
} else {
|
|
175
|
+
resultObject.lastSeenTimestamp = null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (_typeof(result) === 'object' && 'onlineStatus' in result) {
|
|
179
|
+
resultObject.onlineStatus = function () {
|
|
180
|
+
if (typeof result.onlineStatus !== 'boolean') {
|
|
181
|
+
return Boolean(result.onlineStatus);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return result.onlineStatus;
|
|
185
|
+
}();
|
|
186
|
+
} else {
|
|
187
|
+
resultObject.onlineStatus = false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return resultObject;
|
|
191
|
+
}();
|
|
192
|
+
|
|
193
|
+
resolve(resolveValue);
|
|
194
|
+
}).catch(function (error) {
|
|
195
|
+
return reject(error);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
99
199
|
/**
|
|
100
200
|
* List all RTUs [GET /rtus]
|
|
101
201
|
*
|
|
@@ -147,6 +247,115 @@ var RTUController = /*#__PURE__*/function () {
|
|
|
147
247
|
return _RTUModel.default.fromJSON(result);
|
|
148
248
|
}();
|
|
149
249
|
|
|
250
|
+
resolve(resolveValue);
|
|
251
|
+
}).catch(function (error) {
|
|
252
|
+
return reject(error);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Retrieve the Statuses of all RTUs [GET /rtus/statuses]
|
|
258
|
+
*
|
|
259
|
+
* An Array of Statuses for all RTUs
|
|
260
|
+
*
|
|
261
|
+
* @static
|
|
262
|
+
* @public
|
|
263
|
+
* @param {RTUController.GetAllStatusesQueryParameters} [queryParameters] The Optional Query Parameters
|
|
264
|
+
* @return {Promise<Array<RTUController.RTUStatusItem>>}
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
}, {
|
|
268
|
+
key: "getAllStatuses",
|
|
269
|
+
value: function getAllStatuses() {
|
|
270
|
+
var queryParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
271
|
+
return new Promise(function (resolve, reject) {
|
|
272
|
+
_RequestHelper.default.getRequest("/rtus/statuses", queryParameters).then(function (result) {
|
|
273
|
+
var resolveValue = function () {
|
|
274
|
+
if (Array.isArray(result) !== true) {
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return result.map(function (resultItem) {
|
|
279
|
+
return function () {
|
|
280
|
+
var resultItemObject = {};
|
|
281
|
+
|
|
282
|
+
if (_typeof(resultItem) === 'object' && 'id' in resultItem) {
|
|
283
|
+
resultItemObject.id = function () {
|
|
284
|
+
if (typeof resultItem.id !== 'number') {
|
|
285
|
+
return Number.isInteger(Number(resultItem.id)) ? Number(resultItem.id) : Math.floor(Number(resultItem.id));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return Number.isInteger(resultItem.id) ? resultItem.id : Math.floor(resultItem.id);
|
|
289
|
+
}();
|
|
290
|
+
} else {
|
|
291
|
+
resultItemObject.id = 0;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (_typeof(resultItem) === 'object' && 'latency' in resultItem) {
|
|
295
|
+
resultItemObject.latency = function () {
|
|
296
|
+
if (resultItem.latency === null) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (typeof resultItem.latency !== 'number') {
|
|
301
|
+
return Number(resultItem.latency);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return resultItem.latency;
|
|
305
|
+
}();
|
|
306
|
+
} else {
|
|
307
|
+
resultItemObject.latency = null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (_typeof(resultItem) === 'object' && 'latencyTimestamp' in resultItem) {
|
|
311
|
+
resultItemObject.latencyTimestamp = function () {
|
|
312
|
+
if (resultItem.latencyTimestamp === null) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (typeof resultItem.latencyTimestamp !== 'string') {
|
|
317
|
+
return new Date(String(resultItem.latencyTimestamp));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return new Date(resultItem.latencyTimestamp);
|
|
321
|
+
}();
|
|
322
|
+
} else {
|
|
323
|
+
resultItemObject.latencyTimestamp = null;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (_typeof(resultItem) === 'object' && 'lastSeenTimestamp' in resultItem) {
|
|
327
|
+
resultItemObject.lastSeenTimestamp = function () {
|
|
328
|
+
if (resultItem.lastSeenTimestamp === null) {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (typeof resultItem.lastSeenTimestamp !== 'string') {
|
|
333
|
+
return new Date(String(resultItem.lastSeenTimestamp));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return new Date(resultItem.lastSeenTimestamp);
|
|
337
|
+
}();
|
|
338
|
+
} else {
|
|
339
|
+
resultItemObject.lastSeenTimestamp = null;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (_typeof(resultItem) === 'object' && 'onlineStatus' in resultItem) {
|
|
343
|
+
resultItemObject.onlineStatus = function () {
|
|
344
|
+
if (typeof resultItem.onlineStatus !== 'boolean') {
|
|
345
|
+
return Boolean(resultItem.onlineStatus);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return resultItem.onlineStatus;
|
|
349
|
+
}();
|
|
350
|
+
} else {
|
|
351
|
+
resultItemObject.onlineStatus = false;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return resultItemObject;
|
|
355
|
+
}();
|
|
356
|
+
});
|
|
357
|
+
}();
|
|
358
|
+
|
|
150
359
|
resolve(resolveValue);
|
|
151
360
|
}).catch(function (error) {
|
|
152
361
|
return reject(error);
|
|
@@ -169,6 +378,14 @@ var _default = RTUController;
|
|
|
169
378
|
* @memberof Controllers
|
|
170
379
|
*/
|
|
171
380
|
|
|
381
|
+
/**
|
|
382
|
+
* The Optional Query Parameters for the getAllStatuses Function
|
|
383
|
+
*
|
|
384
|
+
* @typedef {Object} RTUController.GetAllStatusesQueryParameters
|
|
385
|
+
* @property {number[]} [rtuIds] A List of RTU IDs to Filter by
|
|
386
|
+
* @memberof Controllers
|
|
387
|
+
*/
|
|
388
|
+
|
|
172
389
|
/**
|
|
173
390
|
* The Create Data for a RTU
|
|
174
391
|
*
|
|
@@ -188,4 +405,16 @@ var _default = RTUController;
|
|
|
188
405
|
* @memberof Controllers
|
|
189
406
|
*/
|
|
190
407
|
|
|
408
|
+
/**
|
|
409
|
+
* A **RTUStatusItem** Type
|
|
410
|
+
*
|
|
411
|
+
* @typedef {Object} RTUController.RTUStatusItem
|
|
412
|
+
* @property {number} id ID of the RTU
|
|
413
|
+
* @property {?number} latency Round-Trip Latency of the RTU represented in milliseconds
|
|
414
|
+
* @property {?Date} latencyTimestamp When the Latency was last Updated
|
|
415
|
+
* @property {?Date} lastSeenTimestamp When the Last Message was Received from the RTU
|
|
416
|
+
* @property {boolean} onlineStatus Whether the RTU is considered as Online
|
|
417
|
+
* @memberof Controllers
|
|
418
|
+
*/
|
|
419
|
+
|
|
191
420
|
exports.default = _default;
|
package/lib/PackageVersion.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1281,6 +1281,15 @@ declare module '@ricado/api-client/Controllers/RTUController' {
|
|
|
1281
1281
|
* @return {Promise<boolean>}
|
|
1282
1282
|
*/
|
|
1283
1283
|
static delete(id: number): Promise<boolean>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Retrieve the Status of an RTU [GET /rtus/{id}/status]
|
|
1286
|
+
*
|
|
1287
|
+
* @static
|
|
1288
|
+
* @public
|
|
1289
|
+
* @param {number} id The RTU ID
|
|
1290
|
+
* @return {Promise<RTUController.RTUStatusItem>}
|
|
1291
|
+
*/
|
|
1292
|
+
static getOneStatus(id: number): Promise<RTUController.RTUStatusItem>;
|
|
1284
1293
|
/**
|
|
1285
1294
|
* List all RTUs [GET /rtus]
|
|
1286
1295
|
*
|
|
@@ -1299,6 +1308,17 @@ declare module '@ricado/api-client/Controllers/RTUController' {
|
|
|
1299
1308
|
* @return {Promise<RTUModel>}
|
|
1300
1309
|
*/
|
|
1301
1310
|
static create(createData: RTUController.CreateData): Promise<RTUModel>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Retrieve the Statuses of all RTUs [GET /rtus/statuses]
|
|
1313
|
+
*
|
|
1314
|
+
* An Array of Statuses for all RTUs
|
|
1315
|
+
*
|
|
1316
|
+
* @static
|
|
1317
|
+
* @public
|
|
1318
|
+
* @param {RTUController.GetAllStatusesQueryParameters} [queryParameters] The Optional Query Parameters
|
|
1319
|
+
* @return {Promise<Array<RTUController.RTUStatusItem>>}
|
|
1320
|
+
*/
|
|
1321
|
+
static getAllStatuses(queryParameters?: RTUController.GetAllStatusesQueryParameters | undefined): Promise<Array<RTUController.RTUStatusItem>>;
|
|
1302
1322
|
}
|
|
1303
1323
|
namespace RTUController {
|
|
1304
1324
|
/**
|
|
@@ -1318,6 +1338,15 @@ declare module '@ricado/api-client/Controllers/RTUController' {
|
|
|
1318
1338
|
*/
|
|
1319
1339
|
enabled?: boolean | undefined;
|
|
1320
1340
|
};
|
|
1341
|
+
/**
|
|
1342
|
+
* The Optional Query Parameters for the getAllStatuses Function
|
|
1343
|
+
*/
|
|
1344
|
+
type GetAllStatusesQueryParameters = {
|
|
1345
|
+
/**
|
|
1346
|
+
* A List of RTU IDs to Filter by
|
|
1347
|
+
*/
|
|
1348
|
+
rtuIds?: number[] | undefined;
|
|
1349
|
+
};
|
|
1321
1350
|
/**
|
|
1322
1351
|
* The Create Data for a RTU
|
|
1323
1352
|
*/
|
|
@@ -1348,6 +1377,31 @@ declare module '@ricado/api-client/Controllers/RTUController' {
|
|
|
1348
1377
|
*/
|
|
1349
1378
|
enabled?: boolean | undefined;
|
|
1350
1379
|
};
|
|
1380
|
+
/**
|
|
1381
|
+
* A **RTUStatusItem** Type
|
|
1382
|
+
*/
|
|
1383
|
+
type RTUStatusItem = {
|
|
1384
|
+
/**
|
|
1385
|
+
* ID of the RTU
|
|
1386
|
+
*/
|
|
1387
|
+
id: number;
|
|
1388
|
+
/**
|
|
1389
|
+
* Round-Trip Latency of the RTU represented in milliseconds
|
|
1390
|
+
*/
|
|
1391
|
+
latency: number | null;
|
|
1392
|
+
/**
|
|
1393
|
+
* When the Latency was last Updated
|
|
1394
|
+
*/
|
|
1395
|
+
latencyTimestamp: Date | null;
|
|
1396
|
+
/**
|
|
1397
|
+
* When the Last Message was Received from the RTU
|
|
1398
|
+
*/
|
|
1399
|
+
lastSeenTimestamp: Date | null;
|
|
1400
|
+
/**
|
|
1401
|
+
* Whether the RTU is considered as Online
|
|
1402
|
+
*/
|
|
1403
|
+
onlineStatus: boolean;
|
|
1404
|
+
};
|
|
1351
1405
|
}
|
|
1352
1406
|
import RTUModel from "@ricado/api-client/Models/RTUModel";
|
|
1353
1407
|
}
|
package/package.json
CHANGED
|
@@ -80,6 +80,126 @@ class RTUController
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Retrieve the Status of an RTU [GET /rtus/{id}/status]
|
|
85
|
+
*
|
|
86
|
+
* @static
|
|
87
|
+
* @public
|
|
88
|
+
* @param {number} id The RTU ID
|
|
89
|
+
* @return {Promise<RTUController.RTUStatusItem>}
|
|
90
|
+
*/
|
|
91
|
+
static getOneStatus(id)
|
|
92
|
+
{
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
RequestHelper.getRequest(`/rtus/${id}/status`)
|
|
95
|
+
.then((result) => {
|
|
96
|
+
let resolveValue = (function(){
|
|
97
|
+
let resultObject = {};
|
|
98
|
+
|
|
99
|
+
if(typeof result === 'object' && 'id' in result)
|
|
100
|
+
{
|
|
101
|
+
resultObject.id = (function(){
|
|
102
|
+
if(typeof result.id !== 'number')
|
|
103
|
+
{
|
|
104
|
+
return Number.isInteger(Number(result.id)) ? Number(result.id) : Math.floor(Number(result.id));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return Number.isInteger(result.id) ? result.id : Math.floor(result.id);
|
|
108
|
+
}());
|
|
109
|
+
}
|
|
110
|
+
else
|
|
111
|
+
{
|
|
112
|
+
resultObject.id = 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if(typeof result === 'object' && 'latency' in result)
|
|
116
|
+
{
|
|
117
|
+
resultObject.latency = (function(){
|
|
118
|
+
if(result.latency === null)
|
|
119
|
+
{
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if(typeof result.latency !== 'number')
|
|
124
|
+
{
|
|
125
|
+
return Number(result.latency);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return result.latency;
|
|
129
|
+
}());
|
|
130
|
+
}
|
|
131
|
+
else
|
|
132
|
+
{
|
|
133
|
+
resultObject.latency = null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if(typeof result === 'object' && 'latencyTimestamp' in result)
|
|
137
|
+
{
|
|
138
|
+
resultObject.latencyTimestamp = (function(){
|
|
139
|
+
if(result.latencyTimestamp === null)
|
|
140
|
+
{
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if(typeof result.latencyTimestamp !== 'string')
|
|
145
|
+
{
|
|
146
|
+
return new Date(String(result.latencyTimestamp));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return new Date(result.latencyTimestamp);
|
|
150
|
+
}());
|
|
151
|
+
}
|
|
152
|
+
else
|
|
153
|
+
{
|
|
154
|
+
resultObject.latencyTimestamp = null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if(typeof result === 'object' && 'lastSeenTimestamp' in result)
|
|
158
|
+
{
|
|
159
|
+
resultObject.lastSeenTimestamp = (function(){
|
|
160
|
+
if(result.lastSeenTimestamp === null)
|
|
161
|
+
{
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if(typeof result.lastSeenTimestamp !== 'string')
|
|
166
|
+
{
|
|
167
|
+
return new Date(String(result.lastSeenTimestamp));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return new Date(result.lastSeenTimestamp);
|
|
171
|
+
}());
|
|
172
|
+
}
|
|
173
|
+
else
|
|
174
|
+
{
|
|
175
|
+
resultObject.lastSeenTimestamp = null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if(typeof result === 'object' && 'onlineStatus' in result)
|
|
179
|
+
{
|
|
180
|
+
resultObject.onlineStatus = (function(){
|
|
181
|
+
if(typeof result.onlineStatus !== 'boolean')
|
|
182
|
+
{
|
|
183
|
+
return Boolean(result.onlineStatus);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return result.onlineStatus;
|
|
187
|
+
}());
|
|
188
|
+
}
|
|
189
|
+
else
|
|
190
|
+
{
|
|
191
|
+
resultObject.onlineStatus = false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return resultObject;
|
|
195
|
+
}());
|
|
196
|
+
|
|
197
|
+
resolve(resolveValue);
|
|
198
|
+
})
|
|
199
|
+
.catch(error => reject(error));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
83
203
|
/**
|
|
84
204
|
* List all RTUs [GET /rtus]
|
|
85
205
|
*
|
|
@@ -134,6 +254,137 @@ class RTUController
|
|
|
134
254
|
.catch(error => reject(error));
|
|
135
255
|
});
|
|
136
256
|
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Retrieve the Statuses of all RTUs [GET /rtus/statuses]
|
|
260
|
+
*
|
|
261
|
+
* An Array of Statuses for all RTUs
|
|
262
|
+
*
|
|
263
|
+
* @static
|
|
264
|
+
* @public
|
|
265
|
+
* @param {RTUController.GetAllStatusesQueryParameters} [queryParameters] The Optional Query Parameters
|
|
266
|
+
* @return {Promise<Array<RTUController.RTUStatusItem>>}
|
|
267
|
+
*/
|
|
268
|
+
static getAllStatuses(queryParameters = {})
|
|
269
|
+
{
|
|
270
|
+
return new Promise((resolve, reject) => {
|
|
271
|
+
RequestHelper.getRequest(`/rtus/statuses`, queryParameters)
|
|
272
|
+
.then((result) => {
|
|
273
|
+
let resolveValue = (function(){
|
|
274
|
+
if(Array.isArray(result) !== true)
|
|
275
|
+
{
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return result.map((resultItem) => {
|
|
280
|
+
return (function(){
|
|
281
|
+
let resultItemObject = {};
|
|
282
|
+
|
|
283
|
+
if(typeof resultItem === 'object' && 'id' in resultItem)
|
|
284
|
+
{
|
|
285
|
+
resultItemObject.id = (function(){
|
|
286
|
+
if(typeof resultItem.id !== 'number')
|
|
287
|
+
{
|
|
288
|
+
return Number.isInteger(Number(resultItem.id)) ? Number(resultItem.id) : Math.floor(Number(resultItem.id));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return Number.isInteger(resultItem.id) ? resultItem.id : Math.floor(resultItem.id);
|
|
292
|
+
}());
|
|
293
|
+
}
|
|
294
|
+
else
|
|
295
|
+
{
|
|
296
|
+
resultItemObject.id = 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if(typeof resultItem === 'object' && 'latency' in resultItem)
|
|
300
|
+
{
|
|
301
|
+
resultItemObject.latency = (function(){
|
|
302
|
+
if(resultItem.latency === null)
|
|
303
|
+
{
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if(typeof resultItem.latency !== 'number')
|
|
308
|
+
{
|
|
309
|
+
return Number(resultItem.latency);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return resultItem.latency;
|
|
313
|
+
}());
|
|
314
|
+
}
|
|
315
|
+
else
|
|
316
|
+
{
|
|
317
|
+
resultItemObject.latency = null;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if(typeof resultItem === 'object' && 'latencyTimestamp' in resultItem)
|
|
321
|
+
{
|
|
322
|
+
resultItemObject.latencyTimestamp = (function(){
|
|
323
|
+
if(resultItem.latencyTimestamp === null)
|
|
324
|
+
{
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if(typeof resultItem.latencyTimestamp !== 'string')
|
|
329
|
+
{
|
|
330
|
+
return new Date(String(resultItem.latencyTimestamp));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return new Date(resultItem.latencyTimestamp);
|
|
334
|
+
}());
|
|
335
|
+
}
|
|
336
|
+
else
|
|
337
|
+
{
|
|
338
|
+
resultItemObject.latencyTimestamp = null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if(typeof resultItem === 'object' && 'lastSeenTimestamp' in resultItem)
|
|
342
|
+
{
|
|
343
|
+
resultItemObject.lastSeenTimestamp = (function(){
|
|
344
|
+
if(resultItem.lastSeenTimestamp === null)
|
|
345
|
+
{
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if(typeof resultItem.lastSeenTimestamp !== 'string')
|
|
350
|
+
{
|
|
351
|
+
return new Date(String(resultItem.lastSeenTimestamp));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return new Date(resultItem.lastSeenTimestamp);
|
|
355
|
+
}());
|
|
356
|
+
}
|
|
357
|
+
else
|
|
358
|
+
{
|
|
359
|
+
resultItemObject.lastSeenTimestamp = null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if(typeof resultItem === 'object' && 'onlineStatus' in resultItem)
|
|
363
|
+
{
|
|
364
|
+
resultItemObject.onlineStatus = (function(){
|
|
365
|
+
if(typeof resultItem.onlineStatus !== 'boolean')
|
|
366
|
+
{
|
|
367
|
+
return Boolean(resultItem.onlineStatus);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return resultItem.onlineStatus;
|
|
371
|
+
}());
|
|
372
|
+
}
|
|
373
|
+
else
|
|
374
|
+
{
|
|
375
|
+
resultItemObject.onlineStatus = false;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return resultItemObject;
|
|
379
|
+
}());
|
|
380
|
+
});
|
|
381
|
+
}());
|
|
382
|
+
|
|
383
|
+
resolve(resolveValue);
|
|
384
|
+
})
|
|
385
|
+
.catch(error => reject(error));
|
|
386
|
+
});
|
|
387
|
+
}
|
|
137
388
|
}
|
|
138
389
|
|
|
139
390
|
export default RTUController;
|
|
@@ -148,6 +399,14 @@ export default RTUController;
|
|
|
148
399
|
* @memberof Controllers
|
|
149
400
|
*/
|
|
150
401
|
|
|
402
|
+
/**
|
|
403
|
+
* The Optional Query Parameters for the getAllStatuses Function
|
|
404
|
+
*
|
|
405
|
+
* @typedef {Object} RTUController.GetAllStatusesQueryParameters
|
|
406
|
+
* @property {number[]} [rtuIds] A List of RTU IDs to Filter by
|
|
407
|
+
* @memberof Controllers
|
|
408
|
+
*/
|
|
409
|
+
|
|
151
410
|
/**
|
|
152
411
|
* The Create Data for a RTU
|
|
153
412
|
*
|
|
@@ -165,4 +424,16 @@ export default RTUController;
|
|
|
165
424
|
* @property {string} [name] The RTU Name
|
|
166
425
|
* @property {boolean} [enabled] Whether the RTU is Enabled
|
|
167
426
|
* @memberof Controllers
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* A **RTUStatusItem** Type
|
|
431
|
+
*
|
|
432
|
+
* @typedef {Object} RTUController.RTUStatusItem
|
|
433
|
+
* @property {number} id ID of the RTU
|
|
434
|
+
* @property {?number} latency Round-Trip Latency of the RTU represented in milliseconds
|
|
435
|
+
* @property {?Date} latencyTimestamp When the Latency was last Updated
|
|
436
|
+
* @property {?Date} lastSeenTimestamp When the Last Message was Received from the RTU
|
|
437
|
+
* @property {boolean} onlineStatus Whether the RTU is considered as Online
|
|
438
|
+
* @memberof Controllers
|
|
168
439
|
*/
|
package/src/PackageVersion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '2.5.
|
|
2
|
+
export const version = '2.5.15';
|