@ricado/api-client 2.3.28 → 2.4.1
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/ricado.api.client.js +1 -1
- package/lib/Controllers/Lab/Site/DehydratorController.js +198 -0
- package/lib/Controllers/Lab/Site/FruitProfileController.js +204 -0
- package/lib/Controllers/Lab/Site/LabController.js +222 -0
- package/lib/Controllers/Lab/Site/RackController.js +222 -0
- package/lib/Controllers/Lab/Site/RackPositionController.js +207 -0
- package/lib/Controllers/Lab/Site/SampleController.js +1023 -0
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +192 -0
- package/lib/Controllers/Lab/Site/SampleResultController.js +905 -0
- package/lib/Controllers/Lab/Site/index.js +46 -0
- package/lib/Controllers/Lab/index.js +25 -0
- package/lib/Controllers/Packhouse/Site/ShiftController.js +304 -0
- package/lib/Controllers/index.js +9 -6
- package/lib/Models/Lab/Site/DehydratorModel.js +250 -0
- package/lib/Models/Lab/Site/FruitProfileModel.js +303 -0
- package/lib/Models/Lab/Site/LabModel.js +365 -0
- package/lib/Models/Lab/Site/RackModel.js +358 -0
- package/lib/Models/Lab/Site/RackPositionModel.js +525 -0
- package/lib/Models/Lab/Site/SampleFailureReasonModel.js +195 -0
- package/lib/Models/Lab/Site/SampleModel.js +545 -0
- package/lib/Models/Lab/Site/SampleResultModel.js +545 -0
- package/lib/Models/Lab/Site/index.js +46 -0
- package/lib/Models/Lab/index.js +25 -0
- package/lib/Models/index.js +7 -4
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +10441 -7526
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/DehydratorController.js +175 -0
- package/src/Controllers/Lab/Site/FruitProfileController.js +181 -0
- package/src/Controllers/Lab/Site/LabController.js +199 -0
- package/src/Controllers/Lab/Site/RackController.js +199 -0
- package/src/Controllers/Lab/Site/RackPositionController.js +184 -0
- package/src/Controllers/Lab/Site/SampleController.js +1160 -0
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +169 -0
- package/src/Controllers/Lab/Site/SampleResultController.js +1036 -0
- package/src/Controllers/Lab/Site/index.js +30 -0
- package/src/Controllers/Lab/index.js +16 -0
- package/src/Controllers/Packhouse/Site/ShiftController.js +367 -0
- package/src/Controllers/index.js +2 -0
- package/src/Models/Lab/Site/DehydratorModel.js +234 -0
- package/src/Models/Lab/Site/FruitProfileModel.js +290 -0
- package/src/Models/Lab/Site/LabModel.js +372 -0
- package/src/Models/Lab/Site/RackModel.js +358 -0
- package/src/Models/Lab/Site/RackPositionModel.js +600 -0
- package/src/Models/Lab/Site/SampleFailureReasonModel.js +170 -0
- package/src/Models/Lab/Site/SampleModel.js +565 -0
- package/src/Models/Lab/Site/SampleResultModel.js +565 -0
- package/src/Models/Lab/Site/index.js +30 -0
- package/src/Models/Lab/index.js +16 -0
- package/src/Models/index.js +2 -0
- package/src/PackageVersion.js +1 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _BaseModel2 = _interopRequireDefault(require("../../../Models/BaseModel"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
|
|
16
|
+
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); } }
|
|
17
|
+
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
+
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
+
|
|
24
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Model Class for a Fruit Profile
|
|
36
|
+
*
|
|
37
|
+
* @class
|
|
38
|
+
* @hideconstructor
|
|
39
|
+
* @extends BaseModel
|
|
40
|
+
*/
|
|
41
|
+
var FruitProfileModel = /*#__PURE__*/function (_BaseModel) {
|
|
42
|
+
_inherits(FruitProfileModel, _BaseModel);
|
|
43
|
+
|
|
44
|
+
var _super = _createSuper(FruitProfileModel);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* FruitProfileModel Constructor
|
|
48
|
+
*
|
|
49
|
+
* @protected
|
|
50
|
+
* @param {number} siteId The Site ID associated with this Fruit Profile
|
|
51
|
+
*/
|
|
52
|
+
function FruitProfileModel(siteId) {
|
|
53
|
+
var _this;
|
|
54
|
+
|
|
55
|
+
_classCallCheck(this, FruitProfileModel);
|
|
56
|
+
|
|
57
|
+
_this = _super.call(this);
|
|
58
|
+
/**
|
|
59
|
+
* The Fruit Profile ID
|
|
60
|
+
*
|
|
61
|
+
* @type {string}
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
_this.id = "";
|
|
66
|
+
/**
|
|
67
|
+
* The Fruit Profile Name
|
|
68
|
+
*
|
|
69
|
+
* @type {string}
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
_this.name = "";
|
|
74
|
+
/**
|
|
75
|
+
* The Fruit Profile Description
|
|
76
|
+
*
|
|
77
|
+
* @type {string}
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
_this.description = "";
|
|
82
|
+
/**
|
|
83
|
+
* The Fruit Profile Image Source
|
|
84
|
+
*
|
|
85
|
+
* @type {string}
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
_this.image = "";
|
|
90
|
+
/**
|
|
91
|
+
* The Typical Warm Up Duration (in seconds) for a Sample to reach the Minimum Target Temperature
|
|
92
|
+
*
|
|
93
|
+
* @type {number}
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
_this.nominalWarmUpDuration = 0;
|
|
98
|
+
/**
|
|
99
|
+
* The Minimum Duration (in seconds) that a Sample should be within the Min and Max Target Temperatures be Successful
|
|
100
|
+
*
|
|
101
|
+
* @type {number}
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
_this.minimumWithinTargetDuration = 0;
|
|
106
|
+
/**
|
|
107
|
+
* The Maximum Duration (in seconds) that a Sample should be Dehydrated for before it Fails
|
|
108
|
+
*
|
|
109
|
+
* @type {number}
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
_this.maximumTotalDuration = 0;
|
|
114
|
+
/**
|
|
115
|
+
* The Minimum Target Temperature for a Sample to be Successful
|
|
116
|
+
*
|
|
117
|
+
* @type {number}
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
_this.minimumTargetTemperature = 0;
|
|
122
|
+
/**
|
|
123
|
+
* The Maximum Target Temperature for a Sample to be Successful
|
|
124
|
+
*
|
|
125
|
+
* @type {number}
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
_this.maximumTargetTemperature = 0;
|
|
130
|
+
/**
|
|
131
|
+
* Whether the Fruit Profile has been deleted
|
|
132
|
+
*
|
|
133
|
+
* @type {boolean}
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
_this.deleted = false;
|
|
138
|
+
/**
|
|
139
|
+
* When the Fruit Profile was last updated
|
|
140
|
+
*
|
|
141
|
+
* @type {Date}
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
_this.updateTimestamp = new Date();
|
|
146
|
+
/**
|
|
147
|
+
* The Site ID associated with this Fruit Profile
|
|
148
|
+
*
|
|
149
|
+
* @type {number}
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
_this.siteId = siteId;
|
|
154
|
+
return _this;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Create a new **FruitProfileModel** from a JSON Object or JSON String
|
|
158
|
+
*
|
|
159
|
+
* @static
|
|
160
|
+
* @public
|
|
161
|
+
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
162
|
+
* @param {number} siteId The Site ID associated with this Fruit Profile
|
|
163
|
+
* @return {FruitProfileModel}
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
_createClass(FruitProfileModel, null, [{
|
|
168
|
+
key: "fromJSON",
|
|
169
|
+
value: function fromJSON(json, siteId) {
|
|
170
|
+
var model = new FruitProfileModel(siteId);
|
|
171
|
+
/**
|
|
172
|
+
* The JSON Object
|
|
173
|
+
*
|
|
174
|
+
* @type {Object<string, any>}
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
var jsonObject = {};
|
|
178
|
+
|
|
179
|
+
if (typeof json === 'string') {
|
|
180
|
+
jsonObject = JSON.parse(json);
|
|
181
|
+
} else if (_typeof(json) === 'object') {
|
|
182
|
+
jsonObject = json;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if ('id' in jsonObject) {
|
|
186
|
+
model.id = function () {
|
|
187
|
+
if (typeof jsonObject['id'] !== 'string') {
|
|
188
|
+
return String(jsonObject['id']);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return jsonObject['id'];
|
|
192
|
+
}();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if ('name' in jsonObject) {
|
|
196
|
+
model.name = function () {
|
|
197
|
+
if (typeof jsonObject['name'] !== 'string') {
|
|
198
|
+
return String(jsonObject['name']);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return jsonObject['name'];
|
|
202
|
+
}();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if ('description' in jsonObject) {
|
|
206
|
+
model.description = function () {
|
|
207
|
+
if (typeof jsonObject['description'] !== 'string') {
|
|
208
|
+
return String(jsonObject['description']);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return jsonObject['description'];
|
|
212
|
+
}();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if ('image' in jsonObject) {
|
|
216
|
+
model.image = function () {
|
|
217
|
+
if (typeof jsonObject['image'] !== 'string') {
|
|
218
|
+
return String(jsonObject['image']);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return jsonObject['image'];
|
|
222
|
+
}();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if ('nominalWarmUpDuration' in jsonObject) {
|
|
226
|
+
model.nominalWarmUpDuration = function () {
|
|
227
|
+
if (typeof jsonObject['nominalWarmUpDuration'] !== 'number') {
|
|
228
|
+
return Number.isInteger(Number(jsonObject['nominalWarmUpDuration'])) ? Number(jsonObject['nominalWarmUpDuration']) : Math.floor(Number(jsonObject['nominalWarmUpDuration']));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return Number.isInteger(jsonObject['nominalWarmUpDuration']) ? jsonObject['nominalWarmUpDuration'] : Math.floor(jsonObject['nominalWarmUpDuration']);
|
|
232
|
+
}();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if ('minimumWithinTargetDuration' in jsonObject) {
|
|
236
|
+
model.minimumWithinTargetDuration = function () {
|
|
237
|
+
if (typeof jsonObject['minimumWithinTargetDuration'] !== 'number') {
|
|
238
|
+
return Number.isInteger(Number(jsonObject['minimumWithinTargetDuration'])) ? Number(jsonObject['minimumWithinTargetDuration']) : Math.floor(Number(jsonObject['minimumWithinTargetDuration']));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return Number.isInteger(jsonObject['minimumWithinTargetDuration']) ? jsonObject['minimumWithinTargetDuration'] : Math.floor(jsonObject['minimumWithinTargetDuration']);
|
|
242
|
+
}();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if ('maximumTotalDuration' in jsonObject) {
|
|
246
|
+
model.maximumTotalDuration = function () {
|
|
247
|
+
if (typeof jsonObject['maximumTotalDuration'] !== 'number') {
|
|
248
|
+
return Number.isInteger(Number(jsonObject['maximumTotalDuration'])) ? Number(jsonObject['maximumTotalDuration']) : Math.floor(Number(jsonObject['maximumTotalDuration']));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return Number.isInteger(jsonObject['maximumTotalDuration']) ? jsonObject['maximumTotalDuration'] : Math.floor(jsonObject['maximumTotalDuration']);
|
|
252
|
+
}();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if ('minimumTargetTemperature' in jsonObject) {
|
|
256
|
+
model.minimumTargetTemperature = function () {
|
|
257
|
+
if (typeof jsonObject['minimumTargetTemperature'] !== 'number') {
|
|
258
|
+
return Number(jsonObject['minimumTargetTemperature']);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return jsonObject['minimumTargetTemperature'];
|
|
262
|
+
}();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if ('maximumTargetTemperature' in jsonObject) {
|
|
266
|
+
model.maximumTargetTemperature = function () {
|
|
267
|
+
if (typeof jsonObject['maximumTargetTemperature'] !== 'number') {
|
|
268
|
+
return Number(jsonObject['maximumTargetTemperature']);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return jsonObject['maximumTargetTemperature'];
|
|
272
|
+
}();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if ('deleted' in jsonObject) {
|
|
276
|
+
model.deleted = function () {
|
|
277
|
+
if (typeof jsonObject['deleted'] !== 'boolean') {
|
|
278
|
+
return Boolean(jsonObject['deleted']);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return jsonObject['deleted'];
|
|
282
|
+
}();
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if ('updateTimestamp' in jsonObject) {
|
|
286
|
+
model.updateTimestamp = function () {
|
|
287
|
+
if (typeof jsonObject['updateTimestamp'] !== 'string') {
|
|
288
|
+
return new Date(String(jsonObject['updateTimestamp']));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return new Date(jsonObject['updateTimestamp']);
|
|
292
|
+
}();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return model;
|
|
296
|
+
}
|
|
297
|
+
}]);
|
|
298
|
+
|
|
299
|
+
return FruitProfileModel;
|
|
300
|
+
}(_BaseModel2.default);
|
|
301
|
+
|
|
302
|
+
var _default = FruitProfileModel;
|
|
303
|
+
exports.default = _default;
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _BaseModel2 = _interopRequireDefault(require("../../../Models/BaseModel"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
|
|
16
|
+
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); } }
|
|
17
|
+
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
+
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
+
|
|
24
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Model Class for a Lab
|
|
36
|
+
*
|
|
37
|
+
* @class
|
|
38
|
+
* @hideconstructor
|
|
39
|
+
* @extends BaseModel
|
|
40
|
+
*/
|
|
41
|
+
var LabModel = /*#__PURE__*/function (_BaseModel) {
|
|
42
|
+
_inherits(LabModel, _BaseModel);
|
|
43
|
+
|
|
44
|
+
var _super = _createSuper(LabModel);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* LabModel Constructor
|
|
48
|
+
*
|
|
49
|
+
* @protected
|
|
50
|
+
* @param {number} siteId The Site ID associated with this Lab
|
|
51
|
+
*/
|
|
52
|
+
function LabModel(siteId) {
|
|
53
|
+
var _this;
|
|
54
|
+
|
|
55
|
+
_classCallCheck(this, LabModel);
|
|
56
|
+
|
|
57
|
+
_this = _super.call(this);
|
|
58
|
+
/**
|
|
59
|
+
* The Lab ID
|
|
60
|
+
*
|
|
61
|
+
* @type {string}
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
_this.id = "";
|
|
66
|
+
/**
|
|
67
|
+
* The RTU this Lab belongs to
|
|
68
|
+
*
|
|
69
|
+
* @type {?number}
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
_this.rtuId = null;
|
|
74
|
+
/**
|
|
75
|
+
* The Lab Name
|
|
76
|
+
*
|
|
77
|
+
* @type {string}
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
_this.name = "";
|
|
82
|
+
/**
|
|
83
|
+
* A Short Name for the Lab Name. Typically used in Reports and Tables showing multiple Labs
|
|
84
|
+
*
|
|
85
|
+
* @type {string}
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
_this.shortName = "";
|
|
90
|
+
/**
|
|
91
|
+
* The Points used by this Lab
|
|
92
|
+
*
|
|
93
|
+
* @type {Object}
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
_this.points = {};
|
|
98
|
+
/**
|
|
99
|
+
* The Rack Objects that belong to this Lab
|
|
100
|
+
*
|
|
101
|
+
* @type {Array<{id: string, displayOrder: number}>}
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
_this.racks = [];
|
|
106
|
+
/**
|
|
107
|
+
* The Alarm Groups that are used by this Lab
|
|
108
|
+
*
|
|
109
|
+
* @type {string[]}
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
_this.alarmGroups = [];
|
|
114
|
+
/**
|
|
115
|
+
* The Inspect Integration Configuration for this Lab
|
|
116
|
+
*
|
|
117
|
+
* @type {?{points: Object, enabled: boolean, apiBaseUrl: string}}
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
_this.inspectIntegration = null;
|
|
122
|
+
/**
|
|
123
|
+
* Whether the Lab has been deleted
|
|
124
|
+
*
|
|
125
|
+
* @type {boolean}
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
_this.deleted = false;
|
|
130
|
+
/**
|
|
131
|
+
* When the Lab was last updated
|
|
132
|
+
*
|
|
133
|
+
* @type {Date}
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
_this.updateTimestamp = new Date();
|
|
138
|
+
/**
|
|
139
|
+
* The Site ID associated with this Lab
|
|
140
|
+
*
|
|
141
|
+
* @type {number}
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
_this.siteId = siteId;
|
|
146
|
+
return _this;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Create a new **LabModel** from a JSON Object or JSON String
|
|
150
|
+
*
|
|
151
|
+
* @static
|
|
152
|
+
* @public
|
|
153
|
+
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
154
|
+
* @param {number} siteId The Site ID associated with this Lab
|
|
155
|
+
* @return {LabModel}
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
_createClass(LabModel, null, [{
|
|
160
|
+
key: "fromJSON",
|
|
161
|
+
value: function fromJSON(json, siteId) {
|
|
162
|
+
var model = new LabModel(siteId);
|
|
163
|
+
/**
|
|
164
|
+
* The JSON Object
|
|
165
|
+
*
|
|
166
|
+
* @type {Object<string, any>}
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
var jsonObject = {};
|
|
170
|
+
|
|
171
|
+
if (typeof json === 'string') {
|
|
172
|
+
jsonObject = JSON.parse(json);
|
|
173
|
+
} else if (_typeof(json) === 'object') {
|
|
174
|
+
jsonObject = json;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if ('id' in jsonObject) {
|
|
178
|
+
model.id = function () {
|
|
179
|
+
if (typeof jsonObject['id'] !== 'string') {
|
|
180
|
+
return String(jsonObject['id']);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return jsonObject['id'];
|
|
184
|
+
}();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if ('rtuId' in jsonObject) {
|
|
188
|
+
model.rtuId = function () {
|
|
189
|
+
if (jsonObject['rtuId'] === null) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (typeof jsonObject['rtuId'] !== 'number') {
|
|
194
|
+
return Number.isInteger(Number(jsonObject['rtuId'])) ? Number(jsonObject['rtuId']) : Math.floor(Number(jsonObject['rtuId']));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return Number.isInteger(jsonObject['rtuId']) ? jsonObject['rtuId'] : Math.floor(jsonObject['rtuId']);
|
|
198
|
+
}();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if ('name' in jsonObject) {
|
|
202
|
+
model.name = function () {
|
|
203
|
+
if (typeof jsonObject['name'] !== 'string') {
|
|
204
|
+
return String(jsonObject['name']);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return jsonObject['name'];
|
|
208
|
+
}();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if ('shortName' in jsonObject) {
|
|
212
|
+
model.shortName = function () {
|
|
213
|
+
if (typeof jsonObject['shortName'] !== 'string') {
|
|
214
|
+
return String(jsonObject['shortName']);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return jsonObject['shortName'];
|
|
218
|
+
}();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if ('points' in jsonObject) {
|
|
222
|
+
model.points = function () {
|
|
223
|
+
if (_typeof(jsonObject['points']) !== 'object') {
|
|
224
|
+
return Object(jsonObject['points']);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return jsonObject['points'];
|
|
228
|
+
}();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if ('racks' in jsonObject) {
|
|
232
|
+
model.racks = function () {
|
|
233
|
+
if (Array.isArray(jsonObject['racks']) !== true) {
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return jsonObject['racks'].map(function (racksItem) {
|
|
238
|
+
return function () {
|
|
239
|
+
var racksItemObject = {};
|
|
240
|
+
|
|
241
|
+
if (_typeof(racksItem) === 'object' && 'id' in racksItem) {
|
|
242
|
+
racksItemObject.id = function () {
|
|
243
|
+
if (typeof racksItem.id !== 'string') {
|
|
244
|
+
return String(racksItem.id);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return racksItem.id;
|
|
248
|
+
}();
|
|
249
|
+
} else {
|
|
250
|
+
racksItemObject.id = "";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (_typeof(racksItem) === 'object' && 'displayOrder' in racksItem) {
|
|
254
|
+
racksItemObject.displayOrder = function () {
|
|
255
|
+
if (typeof racksItem.displayOrder !== 'number') {
|
|
256
|
+
return Number.isInteger(Number(racksItem.displayOrder)) ? Number(racksItem.displayOrder) : Math.floor(Number(racksItem.displayOrder));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return Number.isInteger(racksItem.displayOrder) ? racksItem.displayOrder : Math.floor(racksItem.displayOrder);
|
|
260
|
+
}();
|
|
261
|
+
} else {
|
|
262
|
+
racksItemObject.displayOrder = 0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return racksItemObject;
|
|
266
|
+
}();
|
|
267
|
+
});
|
|
268
|
+
}();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if ('alarmGroups' in jsonObject) {
|
|
272
|
+
model.alarmGroups = function () {
|
|
273
|
+
if (Array.isArray(jsonObject['alarmGroups']) !== true) {
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return jsonObject['alarmGroups'].map(function (alarmGroupsItem) {
|
|
278
|
+
return function () {
|
|
279
|
+
if (typeof alarmGroupsItem !== 'string') {
|
|
280
|
+
return String(alarmGroupsItem);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return alarmGroupsItem;
|
|
284
|
+
}();
|
|
285
|
+
});
|
|
286
|
+
}();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if ('inspectIntegration' in jsonObject) {
|
|
290
|
+
model.inspectIntegration = function () {
|
|
291
|
+
if (jsonObject['inspectIntegration'] === null) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
var inspectIntegrationObject = {};
|
|
296
|
+
|
|
297
|
+
if (_typeof(jsonObject['inspectIntegration']) === 'object' && 'points' in jsonObject['inspectIntegration']) {
|
|
298
|
+
inspectIntegrationObject.points = function () {
|
|
299
|
+
if (_typeof(jsonObject['inspectIntegration'].points) !== 'object') {
|
|
300
|
+
return Object(jsonObject['inspectIntegration'].points);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return jsonObject['inspectIntegration'].points;
|
|
304
|
+
}();
|
|
305
|
+
} else {
|
|
306
|
+
inspectIntegrationObject.points = {};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (_typeof(jsonObject['inspectIntegration']) === 'object' && 'enabled' in jsonObject['inspectIntegration']) {
|
|
310
|
+
inspectIntegrationObject.enabled = function () {
|
|
311
|
+
if (typeof jsonObject['inspectIntegration'].enabled !== 'boolean') {
|
|
312
|
+
return Boolean(jsonObject['inspectIntegration'].enabled);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return jsonObject['inspectIntegration'].enabled;
|
|
316
|
+
}();
|
|
317
|
+
} else {
|
|
318
|
+
inspectIntegrationObject.enabled = false;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (_typeof(jsonObject['inspectIntegration']) === 'object' && 'apiBaseUrl' in jsonObject['inspectIntegration']) {
|
|
322
|
+
inspectIntegrationObject.apiBaseUrl = function () {
|
|
323
|
+
if (typeof jsonObject['inspectIntegration'].apiBaseUrl !== 'string') {
|
|
324
|
+
return String(jsonObject['inspectIntegration'].apiBaseUrl);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return jsonObject['inspectIntegration'].apiBaseUrl;
|
|
328
|
+
}();
|
|
329
|
+
} else {
|
|
330
|
+
inspectIntegrationObject.apiBaseUrl = "";
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return inspectIntegrationObject;
|
|
334
|
+
}();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if ('deleted' in jsonObject) {
|
|
338
|
+
model.deleted = function () {
|
|
339
|
+
if (typeof jsonObject['deleted'] !== 'boolean') {
|
|
340
|
+
return Boolean(jsonObject['deleted']);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return jsonObject['deleted'];
|
|
344
|
+
}();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if ('updateTimestamp' in jsonObject) {
|
|
348
|
+
model.updateTimestamp = function () {
|
|
349
|
+
if (typeof jsonObject['updateTimestamp'] !== 'string') {
|
|
350
|
+
return new Date(String(jsonObject['updateTimestamp']));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return new Date(jsonObject['updateTimestamp']);
|
|
354
|
+
}();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return model;
|
|
358
|
+
}
|
|
359
|
+
}]);
|
|
360
|
+
|
|
361
|
+
return LabModel;
|
|
362
|
+
}(_BaseModel2.default);
|
|
363
|
+
|
|
364
|
+
var _default = LabModel;
|
|
365
|
+
exports.default = _default;
|