@ricado/api-client 2.4.0 → 2.4.2
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/FruitProfileController.js +2 -1
- package/lib/Controllers/Lab/Site/ProbeCalibrationController.js +921 -0
- package/lib/Controllers/Lab/Site/SampleController.js +151 -47
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +2 -1
- package/lib/Controllers/Lab/Site/index.js +3 -0
- package/lib/Models/Lab/Site/ProbeCalibrationModel.js +303 -0
- package/lib/Models/Lab/Site/SampleModel.js +46 -2
- package/lib/Models/Lab/Site/index.js +3 -0
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +585 -19
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/FruitProfileController.js +2 -1
- package/src/Controllers/Lab/Site/ProbeCalibrationController.js +1052 -0
- package/src/Controllers/Lab/Site/SampleController.js +157 -56
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +2 -1
- package/src/Controllers/Lab/Site/index.js +2 -0
- package/src/Models/Lab/Site/ProbeCalibrationModel.js +290 -0
- package/src/Models/Lab/Site/SampleModel.js +52 -2
- package/src/Models/Lab/Site/index.js +2 -0
- package/src/PackageVersion.js +1 -1
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _RequestHelper = _interopRequireDefault(require("../../../RequestHelper"));
|
|
9
|
+
|
|
10
|
+
var _ProbeCalibrationModel = _interopRequireDefault(require("../../../Models/Lab/Site/ProbeCalibrationModel"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
+
|
|
16
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
+
|
|
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); } }
|
|
19
|
+
|
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Controller Class for Probe Calibrations
|
|
24
|
+
*
|
|
25
|
+
* @class
|
|
26
|
+
*/
|
|
27
|
+
var ProbeCalibrationController = /*#__PURE__*/function () {
|
|
28
|
+
function ProbeCalibrationController() {
|
|
29
|
+
_classCallCheck(this, ProbeCalibrationController);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_createClass(ProbeCalibrationController, null, [{
|
|
33
|
+
key: "getOne",
|
|
34
|
+
value:
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve a Probe Calibration [GET /lab/sites/{siteId}/probe-calibrations/{id}]
|
|
37
|
+
*
|
|
38
|
+
* @static
|
|
39
|
+
* @public
|
|
40
|
+
* @param {number} siteId The Site ID
|
|
41
|
+
* @param {string} id The Probe Calibration ID
|
|
42
|
+
* @return {Promise<ProbeCalibrationModel>}
|
|
43
|
+
*/
|
|
44
|
+
function getOne(siteId, id) {
|
|
45
|
+
return new Promise(function (resolve, reject) {
|
|
46
|
+
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id)).then(function (result) {
|
|
47
|
+
var resolveValue = function () {
|
|
48
|
+
return _ProbeCalibrationModel.default.fromJSON(result, siteId);
|
|
49
|
+
}();
|
|
50
|
+
|
|
51
|
+
resolve(resolveValue);
|
|
52
|
+
}).catch(function (error) {
|
|
53
|
+
return reject(error);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Update a Probe Calibration [PATCH /lab/sites/{siteId}/probe-calibrations/{id}]
|
|
59
|
+
*
|
|
60
|
+
* @static
|
|
61
|
+
* @public
|
|
62
|
+
* @param {number} siteId The Site ID
|
|
63
|
+
* @param {string} id The Probe Calibration ID
|
|
64
|
+
* @param {ProbeCalibrationController.UpdateData} updateData The Probe Calibration Update Data
|
|
65
|
+
* @return {Promise<ProbeCalibrationModel>}
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
}, {
|
|
69
|
+
key: "update",
|
|
70
|
+
value: function update(siteId, id, updateData) {
|
|
71
|
+
return new Promise(function (resolve, reject) {
|
|
72
|
+
_RequestHelper.default.patchRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id), updateData).then(function (result) {
|
|
73
|
+
var resolveValue = function () {
|
|
74
|
+
return _ProbeCalibrationModel.default.fromJSON(result, siteId);
|
|
75
|
+
}();
|
|
76
|
+
|
|
77
|
+
resolve(resolveValue);
|
|
78
|
+
}).catch(function (error) {
|
|
79
|
+
return reject(error);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Delete a Probe Calibration [DELETE /lab/sites/{siteId}/probe-calibrations/{id}]
|
|
85
|
+
*
|
|
86
|
+
* @static
|
|
87
|
+
* @public
|
|
88
|
+
* @param {number} siteId The Site ID
|
|
89
|
+
* @param {string} id The Probe Calibration ID
|
|
90
|
+
* @return {Promise<boolean>}
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
}, {
|
|
94
|
+
key: "delete",
|
|
95
|
+
value: function _delete(siteId, id) {
|
|
96
|
+
return new Promise(function (resolve, reject) {
|
|
97
|
+
_RequestHelper.default.deleteRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id)).then(function (result) {
|
|
98
|
+
resolve(result !== null && result !== void 0 ? result : true);
|
|
99
|
+
}).catch(function (error) {
|
|
100
|
+
return reject(error);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Retrieve Comments [GET /lab/sites/{siteId}/probe-calibrations/{id}/comments]
|
|
106
|
+
*
|
|
107
|
+
* Retrieves Comments for a Probe Calibration
|
|
108
|
+
*
|
|
109
|
+
* @static
|
|
110
|
+
* @public
|
|
111
|
+
* @param {number} siteId The Site ID
|
|
112
|
+
* @param {string} id The Probe Calibration ID
|
|
113
|
+
* @return {Promise<Array<ProbeCalibrationController.CommentItem>>}
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
}, {
|
|
117
|
+
key: "getComments",
|
|
118
|
+
value: function getComments(siteId, id) {
|
|
119
|
+
return new Promise(function (resolve, reject) {
|
|
120
|
+
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id, "/comments")).then(function (result) {
|
|
121
|
+
var resolveValue = function () {
|
|
122
|
+
if (Array.isArray(result) !== true) {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return result.map(function (resultItem) {
|
|
127
|
+
return function () {
|
|
128
|
+
var resultItemObject = {};
|
|
129
|
+
|
|
130
|
+
if (_typeof(resultItem) === 'object' && 'id' in resultItem) {
|
|
131
|
+
resultItemObject.id = function () {
|
|
132
|
+
if (typeof resultItem.id !== 'string') {
|
|
133
|
+
return String(resultItem.id);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return resultItem.id;
|
|
137
|
+
}();
|
|
138
|
+
} else {
|
|
139
|
+
resultItemObject.id = "";
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (_typeof(resultItem) === 'object' && 'userAccount' in resultItem) {
|
|
143
|
+
resultItemObject.userAccount = function () {
|
|
144
|
+
var userAccountObject = {};
|
|
145
|
+
|
|
146
|
+
if (_typeof(resultItem.userAccount) === 'object' && 'id' in resultItem.userAccount) {
|
|
147
|
+
userAccountObject.id = function () {
|
|
148
|
+
if (resultItem.userAccount.id === null) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (typeof resultItem.userAccount.id !== 'string') {
|
|
153
|
+
return String(resultItem.userAccount.id);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return resultItem.userAccount.id;
|
|
157
|
+
}();
|
|
158
|
+
} else {
|
|
159
|
+
userAccountObject.id = null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (_typeof(resultItem.userAccount) === 'object' && 'firstName' in resultItem.userAccount) {
|
|
163
|
+
userAccountObject.firstName = function () {
|
|
164
|
+
if (resultItem.userAccount.firstName === null) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (typeof resultItem.userAccount.firstName !== 'string') {
|
|
169
|
+
return String(resultItem.userAccount.firstName);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return resultItem.userAccount.firstName;
|
|
173
|
+
}();
|
|
174
|
+
} else {
|
|
175
|
+
userAccountObject.firstName = null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (_typeof(resultItem.userAccount) === 'object' && 'lastName' in resultItem.userAccount) {
|
|
179
|
+
userAccountObject.lastName = function () {
|
|
180
|
+
if (resultItem.userAccount.lastName === null) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (typeof resultItem.userAccount.lastName !== 'string') {
|
|
185
|
+
return String(resultItem.userAccount.lastName);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return resultItem.userAccount.lastName;
|
|
189
|
+
}();
|
|
190
|
+
} else {
|
|
191
|
+
userAccountObject.lastName = null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return userAccountObject;
|
|
195
|
+
}();
|
|
196
|
+
} else {
|
|
197
|
+
resultItemObject.userAccount = function () {
|
|
198
|
+
var userAccountDefaultValue = {};
|
|
199
|
+
userAccountDefaultValue.id = null;
|
|
200
|
+
userAccountDefaultValue.firstName = null;
|
|
201
|
+
userAccountDefaultValue.lastName = null;
|
|
202
|
+
return userAccountDefaultValue;
|
|
203
|
+
}();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (_typeof(resultItem) === 'object' && 'content' in resultItem) {
|
|
207
|
+
resultItemObject.content = function () {
|
|
208
|
+
if (resultItem.content === null) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (typeof resultItem.content !== 'string') {
|
|
213
|
+
return String(resultItem.content);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return resultItem.content;
|
|
217
|
+
}();
|
|
218
|
+
} else {
|
|
219
|
+
resultItemObject.content = null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (_typeof(resultItem) === 'object' && 'createdTimestamp' in resultItem) {
|
|
223
|
+
resultItemObject.createdTimestamp = function () {
|
|
224
|
+
if (resultItem.createdTimestamp === null) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (typeof resultItem.createdTimestamp !== 'string') {
|
|
229
|
+
return new Date(String(resultItem.createdTimestamp));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return new Date(resultItem.createdTimestamp);
|
|
233
|
+
}();
|
|
234
|
+
} else {
|
|
235
|
+
resultItemObject.createdTimestamp = null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (_typeof(resultItem) === 'object' && 'updatedTimestamp' in resultItem) {
|
|
239
|
+
resultItemObject.updatedTimestamp = function () {
|
|
240
|
+
if (resultItem.updatedTimestamp === null) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (typeof resultItem.updatedTimestamp !== 'string') {
|
|
245
|
+
return new Date(String(resultItem.updatedTimestamp));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return new Date(resultItem.updatedTimestamp);
|
|
249
|
+
}();
|
|
250
|
+
} else {
|
|
251
|
+
resultItemObject.updatedTimestamp = null;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return resultItemObject;
|
|
255
|
+
}();
|
|
256
|
+
});
|
|
257
|
+
}();
|
|
258
|
+
|
|
259
|
+
resolve(resolveValue);
|
|
260
|
+
}).catch(function (error) {
|
|
261
|
+
return reject(error);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Create a Comment [POST /lab/sites/{siteId}/probe-calibrations/{id}/comments]
|
|
267
|
+
*
|
|
268
|
+
* Create a Comment for a Probe Calibration
|
|
269
|
+
*
|
|
270
|
+
* @static
|
|
271
|
+
* @public
|
|
272
|
+
* @param {number} siteId The Site ID
|
|
273
|
+
* @param {string} id The Probe Calibration ID
|
|
274
|
+
* @param {string} content The Content of the New Comment
|
|
275
|
+
* @return {Promise<ProbeCalibrationController.CommentItem>}
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
}, {
|
|
279
|
+
key: "createComment",
|
|
280
|
+
value: function createComment(siteId, id, content) {
|
|
281
|
+
return new Promise(function (resolve, reject) {
|
|
282
|
+
_RequestHelper.default.postRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id, "/comments"), {
|
|
283
|
+
content: content
|
|
284
|
+
}).then(function (result) {
|
|
285
|
+
var resolveValue = function () {
|
|
286
|
+
var resultObject = {};
|
|
287
|
+
|
|
288
|
+
if (_typeof(result) === 'object' && 'id' in result) {
|
|
289
|
+
resultObject.id = function () {
|
|
290
|
+
if (typeof result.id !== 'string') {
|
|
291
|
+
return String(result.id);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return result.id;
|
|
295
|
+
}();
|
|
296
|
+
} else {
|
|
297
|
+
resultObject.id = "";
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (_typeof(result) === 'object' && 'userAccount' in result) {
|
|
301
|
+
resultObject.userAccount = function () {
|
|
302
|
+
var userAccountObject = {};
|
|
303
|
+
|
|
304
|
+
if (_typeof(result.userAccount) === 'object' && 'id' in result.userAccount) {
|
|
305
|
+
userAccountObject.id = function () {
|
|
306
|
+
if (result.userAccount.id === null) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (typeof result.userAccount.id !== 'string') {
|
|
311
|
+
return String(result.userAccount.id);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return result.userAccount.id;
|
|
315
|
+
}();
|
|
316
|
+
} else {
|
|
317
|
+
userAccountObject.id = null;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (_typeof(result.userAccount) === 'object' && 'firstName' in result.userAccount) {
|
|
321
|
+
userAccountObject.firstName = function () {
|
|
322
|
+
if (result.userAccount.firstName === null) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (typeof result.userAccount.firstName !== 'string') {
|
|
327
|
+
return String(result.userAccount.firstName);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return result.userAccount.firstName;
|
|
331
|
+
}();
|
|
332
|
+
} else {
|
|
333
|
+
userAccountObject.firstName = null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (_typeof(result.userAccount) === 'object' && 'lastName' in result.userAccount) {
|
|
337
|
+
userAccountObject.lastName = function () {
|
|
338
|
+
if (result.userAccount.lastName === null) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (typeof result.userAccount.lastName !== 'string') {
|
|
343
|
+
return String(result.userAccount.lastName);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return result.userAccount.lastName;
|
|
347
|
+
}();
|
|
348
|
+
} else {
|
|
349
|
+
userAccountObject.lastName = null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return userAccountObject;
|
|
353
|
+
}();
|
|
354
|
+
} else {
|
|
355
|
+
resultObject.userAccount = function () {
|
|
356
|
+
var userAccountDefaultValue = {};
|
|
357
|
+
userAccountDefaultValue.id = null;
|
|
358
|
+
userAccountDefaultValue.firstName = null;
|
|
359
|
+
userAccountDefaultValue.lastName = null;
|
|
360
|
+
return userAccountDefaultValue;
|
|
361
|
+
}();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (_typeof(result) === 'object' && 'content' in result) {
|
|
365
|
+
resultObject.content = function () {
|
|
366
|
+
if (result.content === null) {
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (typeof result.content !== 'string') {
|
|
371
|
+
return String(result.content);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return result.content;
|
|
375
|
+
}();
|
|
376
|
+
} else {
|
|
377
|
+
resultObject.content = null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
|
|
381
|
+
resultObject.createdTimestamp = function () {
|
|
382
|
+
if (result.createdTimestamp === null) {
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (typeof result.createdTimestamp !== 'string') {
|
|
387
|
+
return new Date(String(result.createdTimestamp));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return new Date(result.createdTimestamp);
|
|
391
|
+
}();
|
|
392
|
+
} else {
|
|
393
|
+
resultObject.createdTimestamp = null;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (_typeof(result) === 'object' && 'updatedTimestamp' in result) {
|
|
397
|
+
resultObject.updatedTimestamp = function () {
|
|
398
|
+
if (result.updatedTimestamp === null) {
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (typeof result.updatedTimestamp !== 'string') {
|
|
403
|
+
return new Date(String(result.updatedTimestamp));
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return new Date(result.updatedTimestamp);
|
|
407
|
+
}();
|
|
408
|
+
} else {
|
|
409
|
+
resultObject.updatedTimestamp = null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return resultObject;
|
|
413
|
+
}();
|
|
414
|
+
|
|
415
|
+
resolve(resolveValue);
|
|
416
|
+
}).catch(function (error) {
|
|
417
|
+
return reject(error);
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Retrieve a Comment [GET /lab/sites/{siteId}/probe-calibrations/{id}/comments/{commentId}]
|
|
423
|
+
*
|
|
424
|
+
* Retrieves Comments for a Probe Calibration
|
|
425
|
+
*
|
|
426
|
+
* @static
|
|
427
|
+
* @public
|
|
428
|
+
* @param {number} siteId The Site ID
|
|
429
|
+
* @param {string} id The Probe Calibration ID
|
|
430
|
+
* @param {string} commentId The Comment ID
|
|
431
|
+
* @return {Promise<ProbeCalibrationController.CommentItem>}
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
}, {
|
|
435
|
+
key: "getOneComment",
|
|
436
|
+
value: function getOneComment(siteId, id, commentId) {
|
|
437
|
+
return new Promise(function (resolve, reject) {
|
|
438
|
+
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id, "/comments/").concat(commentId)).then(function (result) {
|
|
439
|
+
var resolveValue = function () {
|
|
440
|
+
var resultObject = {};
|
|
441
|
+
|
|
442
|
+
if (_typeof(result) === 'object' && 'id' in result) {
|
|
443
|
+
resultObject.id = function () {
|
|
444
|
+
if (typeof result.id !== 'string') {
|
|
445
|
+
return String(result.id);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return result.id;
|
|
449
|
+
}();
|
|
450
|
+
} else {
|
|
451
|
+
resultObject.id = "";
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (_typeof(result) === 'object' && 'userAccount' in result) {
|
|
455
|
+
resultObject.userAccount = function () {
|
|
456
|
+
var userAccountObject = {};
|
|
457
|
+
|
|
458
|
+
if (_typeof(result.userAccount) === 'object' && 'id' in result.userAccount) {
|
|
459
|
+
userAccountObject.id = function () {
|
|
460
|
+
if (result.userAccount.id === null) {
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (typeof result.userAccount.id !== 'string') {
|
|
465
|
+
return String(result.userAccount.id);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return result.userAccount.id;
|
|
469
|
+
}();
|
|
470
|
+
} else {
|
|
471
|
+
userAccountObject.id = null;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (_typeof(result.userAccount) === 'object' && 'firstName' in result.userAccount) {
|
|
475
|
+
userAccountObject.firstName = function () {
|
|
476
|
+
if (result.userAccount.firstName === null) {
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (typeof result.userAccount.firstName !== 'string') {
|
|
481
|
+
return String(result.userAccount.firstName);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return result.userAccount.firstName;
|
|
485
|
+
}();
|
|
486
|
+
} else {
|
|
487
|
+
userAccountObject.firstName = null;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (_typeof(result.userAccount) === 'object' && 'lastName' in result.userAccount) {
|
|
491
|
+
userAccountObject.lastName = function () {
|
|
492
|
+
if (result.userAccount.lastName === null) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (typeof result.userAccount.lastName !== 'string') {
|
|
497
|
+
return String(result.userAccount.lastName);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
return result.userAccount.lastName;
|
|
501
|
+
}();
|
|
502
|
+
} else {
|
|
503
|
+
userAccountObject.lastName = null;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return userAccountObject;
|
|
507
|
+
}();
|
|
508
|
+
} else {
|
|
509
|
+
resultObject.userAccount = function () {
|
|
510
|
+
var userAccountDefaultValue = {};
|
|
511
|
+
userAccountDefaultValue.id = null;
|
|
512
|
+
userAccountDefaultValue.firstName = null;
|
|
513
|
+
userAccountDefaultValue.lastName = null;
|
|
514
|
+
return userAccountDefaultValue;
|
|
515
|
+
}();
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (_typeof(result) === 'object' && 'content' in result) {
|
|
519
|
+
resultObject.content = function () {
|
|
520
|
+
if (result.content === null) {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (typeof result.content !== 'string') {
|
|
525
|
+
return String(result.content);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return result.content;
|
|
529
|
+
}();
|
|
530
|
+
} else {
|
|
531
|
+
resultObject.content = null;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
|
|
535
|
+
resultObject.createdTimestamp = function () {
|
|
536
|
+
if (result.createdTimestamp === null) {
|
|
537
|
+
return null;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (typeof result.createdTimestamp !== 'string') {
|
|
541
|
+
return new Date(String(result.createdTimestamp));
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return new Date(result.createdTimestamp);
|
|
545
|
+
}();
|
|
546
|
+
} else {
|
|
547
|
+
resultObject.createdTimestamp = null;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
if (_typeof(result) === 'object' && 'updatedTimestamp' in result) {
|
|
551
|
+
resultObject.updatedTimestamp = function () {
|
|
552
|
+
if (result.updatedTimestamp === null) {
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (typeof result.updatedTimestamp !== 'string') {
|
|
557
|
+
return new Date(String(result.updatedTimestamp));
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return new Date(result.updatedTimestamp);
|
|
561
|
+
}();
|
|
562
|
+
} else {
|
|
563
|
+
resultObject.updatedTimestamp = null;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
return resultObject;
|
|
567
|
+
}();
|
|
568
|
+
|
|
569
|
+
resolve(resolveValue);
|
|
570
|
+
}).catch(function (error) {
|
|
571
|
+
return reject(error);
|
|
572
|
+
});
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Update a Comment [PATCH /lab/sites/{siteId}/probe-calibrations/{id}/comments/{commentId}]
|
|
577
|
+
*
|
|
578
|
+
* Update a Comment for a Probe Calibration
|
|
579
|
+
*
|
|
580
|
+
* @static
|
|
581
|
+
* @public
|
|
582
|
+
* @param {number} siteId The Site ID
|
|
583
|
+
* @param {string} id The Probe Calibration ID
|
|
584
|
+
* @param {string} commentId The Comment ID
|
|
585
|
+
* @param {string} content The Updated Content for the Comment
|
|
586
|
+
* @return {Promise<ProbeCalibrationController.CommentItem>}
|
|
587
|
+
*/
|
|
588
|
+
|
|
589
|
+
}, {
|
|
590
|
+
key: "updateOneComment",
|
|
591
|
+
value: function updateOneComment(siteId, id, commentId, content) {
|
|
592
|
+
return new Promise(function (resolve, reject) {
|
|
593
|
+
_RequestHelper.default.patchRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id, "/comments/").concat(commentId), {
|
|
594
|
+
content: content
|
|
595
|
+
}).then(function (result) {
|
|
596
|
+
var resolveValue = function () {
|
|
597
|
+
var resultObject = {};
|
|
598
|
+
|
|
599
|
+
if (_typeof(result) === 'object' && 'id' in result) {
|
|
600
|
+
resultObject.id = function () {
|
|
601
|
+
if (typeof result.id !== 'string') {
|
|
602
|
+
return String(result.id);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
return result.id;
|
|
606
|
+
}();
|
|
607
|
+
} else {
|
|
608
|
+
resultObject.id = "";
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (_typeof(result) === 'object' && 'userAccount' in result) {
|
|
612
|
+
resultObject.userAccount = function () {
|
|
613
|
+
var userAccountObject = {};
|
|
614
|
+
|
|
615
|
+
if (_typeof(result.userAccount) === 'object' && 'id' in result.userAccount) {
|
|
616
|
+
userAccountObject.id = function () {
|
|
617
|
+
if (result.userAccount.id === null) {
|
|
618
|
+
return null;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (typeof result.userAccount.id !== 'string') {
|
|
622
|
+
return String(result.userAccount.id);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
return result.userAccount.id;
|
|
626
|
+
}();
|
|
627
|
+
} else {
|
|
628
|
+
userAccountObject.id = null;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (_typeof(result.userAccount) === 'object' && 'firstName' in result.userAccount) {
|
|
632
|
+
userAccountObject.firstName = function () {
|
|
633
|
+
if (result.userAccount.firstName === null) {
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (typeof result.userAccount.firstName !== 'string') {
|
|
638
|
+
return String(result.userAccount.firstName);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return result.userAccount.firstName;
|
|
642
|
+
}();
|
|
643
|
+
} else {
|
|
644
|
+
userAccountObject.firstName = null;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (_typeof(result.userAccount) === 'object' && 'lastName' in result.userAccount) {
|
|
648
|
+
userAccountObject.lastName = function () {
|
|
649
|
+
if (result.userAccount.lastName === null) {
|
|
650
|
+
return null;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
if (typeof result.userAccount.lastName !== 'string') {
|
|
654
|
+
return String(result.userAccount.lastName);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
return result.userAccount.lastName;
|
|
658
|
+
}();
|
|
659
|
+
} else {
|
|
660
|
+
userAccountObject.lastName = null;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
return userAccountObject;
|
|
664
|
+
}();
|
|
665
|
+
} else {
|
|
666
|
+
resultObject.userAccount = function () {
|
|
667
|
+
var userAccountDefaultValue = {};
|
|
668
|
+
userAccountDefaultValue.id = null;
|
|
669
|
+
userAccountDefaultValue.firstName = null;
|
|
670
|
+
userAccountDefaultValue.lastName = null;
|
|
671
|
+
return userAccountDefaultValue;
|
|
672
|
+
}();
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (_typeof(result) === 'object' && 'content' in result) {
|
|
676
|
+
resultObject.content = function () {
|
|
677
|
+
if (result.content === null) {
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (typeof result.content !== 'string') {
|
|
682
|
+
return String(result.content);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
return result.content;
|
|
686
|
+
}();
|
|
687
|
+
} else {
|
|
688
|
+
resultObject.content = null;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
|
|
692
|
+
resultObject.createdTimestamp = function () {
|
|
693
|
+
if (result.createdTimestamp === null) {
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if (typeof result.createdTimestamp !== 'string') {
|
|
698
|
+
return new Date(String(result.createdTimestamp));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return new Date(result.createdTimestamp);
|
|
702
|
+
}();
|
|
703
|
+
} else {
|
|
704
|
+
resultObject.createdTimestamp = null;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (_typeof(result) === 'object' && 'updatedTimestamp' in result) {
|
|
708
|
+
resultObject.updatedTimestamp = function () {
|
|
709
|
+
if (result.updatedTimestamp === null) {
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
if (typeof result.updatedTimestamp !== 'string') {
|
|
714
|
+
return new Date(String(result.updatedTimestamp));
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
return new Date(result.updatedTimestamp);
|
|
718
|
+
}();
|
|
719
|
+
} else {
|
|
720
|
+
resultObject.updatedTimestamp = null;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
return resultObject;
|
|
724
|
+
}();
|
|
725
|
+
|
|
726
|
+
resolve(resolveValue);
|
|
727
|
+
}).catch(function (error) {
|
|
728
|
+
return reject(error);
|
|
729
|
+
});
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Delete a Comment [DELETE /lab/sites/{siteId}/probe-calibrations/{id}/comments/{commentId}]
|
|
734
|
+
*
|
|
735
|
+
* Delete a Comment for a Probe Calibration
|
|
736
|
+
*
|
|
737
|
+
* @static
|
|
738
|
+
* @public
|
|
739
|
+
* @param {number} siteId The Site ID
|
|
740
|
+
* @param {string} id The Probe Calibration ID
|
|
741
|
+
* @param {string} commentId The Comment ID
|
|
742
|
+
* @return {Promise<boolean>}
|
|
743
|
+
*/
|
|
744
|
+
|
|
745
|
+
}, {
|
|
746
|
+
key: "deleteOneComment",
|
|
747
|
+
value: function deleteOneComment(siteId, id, commentId) {
|
|
748
|
+
return new Promise(function (resolve, reject) {
|
|
749
|
+
_RequestHelper.default.deleteRequest("/lab/sites/".concat(siteId, "/probe-calibrations/").concat(id, "/comments/").concat(commentId)).then(function (result) {
|
|
750
|
+
resolve(result !== null && result !== void 0 ? result : true);
|
|
751
|
+
}).catch(function (error) {
|
|
752
|
+
return reject(error);
|
|
753
|
+
});
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* List all Probe Calibrations [GET /lab/sites/{siteId}/probe-calibrations]
|
|
758
|
+
*
|
|
759
|
+
* @static
|
|
760
|
+
* @public
|
|
761
|
+
* @param {number} siteId The Site ID
|
|
762
|
+
* @param {ProbeCalibrationController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
763
|
+
* @return {Promise<ProbeCalibrationModel[]>}
|
|
764
|
+
*/
|
|
765
|
+
|
|
766
|
+
}, {
|
|
767
|
+
key: "getAll",
|
|
768
|
+
value: function getAll(siteId) {
|
|
769
|
+
var queryParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
770
|
+
return new Promise(function (resolve, reject) {
|
|
771
|
+
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/probe-calibrations"), queryParameters).then(function (result) {
|
|
772
|
+
var resolveValue = function () {
|
|
773
|
+
if (Array.isArray(result) !== true) {
|
|
774
|
+
return [];
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
return result.map(function (resultItem) {
|
|
778
|
+
return function () {
|
|
779
|
+
return _ProbeCalibrationModel.default.fromJSON(resultItem, siteId);
|
|
780
|
+
}();
|
|
781
|
+
});
|
|
782
|
+
}();
|
|
783
|
+
|
|
784
|
+
resolve(resolveValue);
|
|
785
|
+
}).catch(function (error) {
|
|
786
|
+
return reject(error);
|
|
787
|
+
});
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Create a Probe Calibration [POST /lab/sites/{siteId}/probe-calibrations]
|
|
792
|
+
*
|
|
793
|
+
* @static
|
|
794
|
+
* @public
|
|
795
|
+
* @param {number} siteId The Site ID
|
|
796
|
+
* @param {ProbeCalibrationController.CreateData} createData The Probe Calibration Create Data
|
|
797
|
+
* @return {Promise<ProbeCalibrationModel>}
|
|
798
|
+
*/
|
|
799
|
+
|
|
800
|
+
}, {
|
|
801
|
+
key: "create",
|
|
802
|
+
value: function create(siteId, createData) {
|
|
803
|
+
return new Promise(function (resolve, reject) {
|
|
804
|
+
_RequestHelper.default.postRequest("/lab/sites/".concat(siteId, "/probe-calibrations"), createData).then(function (result) {
|
|
805
|
+
var resolveValue = function () {
|
|
806
|
+
return _ProbeCalibrationModel.default.fromJSON(result, siteId);
|
|
807
|
+
}();
|
|
808
|
+
|
|
809
|
+
resolve(resolveValue);
|
|
810
|
+
}).catch(function (error) {
|
|
811
|
+
return reject(error);
|
|
812
|
+
});
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Retrieve the Latest Probe Calibrations [GET /lab/sites/{siteId}/probe-calibrations/latest]
|
|
817
|
+
*
|
|
818
|
+
* Retrieves the Latest Probe Calibrations for all Rack Positions
|
|
819
|
+
*
|
|
820
|
+
* @static
|
|
821
|
+
* @public
|
|
822
|
+
* @param {number} siteId The Site ID
|
|
823
|
+
* @return {Promise<ProbeCalibrationModel[]>}
|
|
824
|
+
*/
|
|
825
|
+
|
|
826
|
+
}, {
|
|
827
|
+
key: "getLatestProbeCalibrations",
|
|
828
|
+
value: function getLatestProbeCalibrations(siteId) {
|
|
829
|
+
return new Promise(function (resolve, reject) {
|
|
830
|
+
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/probe-calibrations/latest")).then(function (result) {
|
|
831
|
+
var resolveValue = function () {
|
|
832
|
+
if (Array.isArray(result) !== true) {
|
|
833
|
+
return [];
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
return result.map(function (resultItem) {
|
|
837
|
+
return function () {
|
|
838
|
+
return _ProbeCalibrationModel.default.fromJSON(resultItem, siteId);
|
|
839
|
+
}();
|
|
840
|
+
});
|
|
841
|
+
}();
|
|
842
|
+
|
|
843
|
+
resolve(resolveValue);
|
|
844
|
+
}).catch(function (error) {
|
|
845
|
+
return reject(error);
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
}]);
|
|
850
|
+
|
|
851
|
+
return ProbeCalibrationController;
|
|
852
|
+
}();
|
|
853
|
+
|
|
854
|
+
var _default = ProbeCalibrationController;
|
|
855
|
+
/**
|
|
856
|
+
* The Optional Query Parameters for the getAll Function
|
|
857
|
+
*
|
|
858
|
+
* @typedef {Object} ProbeCalibrationController.GetAllQueryParameters
|
|
859
|
+
* @property {string} [rackPositionId] The Rack Position ID this Probe Calibration is associated with
|
|
860
|
+
* @property {string} [userId] ID of the User who Completed this Probe Calibration
|
|
861
|
+
* @property {string} [userName] Name of the User who Completed this Probe Calibration
|
|
862
|
+
* @property {Date} [createdTimestampBegin] Filter by the Timestamp when Probe Calibrations were Created. Results Greater than or Equal to Timestamp
|
|
863
|
+
* @property {Date} [createdTimestampEnd] Filter by the Timestamp when Probe Calibrations were Created. Results Less than or Equal to Timestamp
|
|
864
|
+
* @property {Date} [updateTimestampBegin] Filter by the Timestamp when Probe Calibrations were last Updated. Results Greater than or Equal to Timestamp
|
|
865
|
+
* @property {Date} [updateTimestampEnd] Filter by the Timestamp when Probe Calibrations were last Updated. Results Less than or Equal to Timestamp
|
|
866
|
+
* @memberof Controllers.Lab.Site
|
|
867
|
+
*/
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* The Create Data for a Probe Calibration
|
|
871
|
+
*
|
|
872
|
+
* @typedef {Object} ProbeCalibrationController.CreateData
|
|
873
|
+
* @property {string} rackPositionId The Rack Position ID this Probe Calibration is associated with
|
|
874
|
+
* @property {Date} [createdTimestamp] When this Probe Calibration was Created
|
|
875
|
+
* @property {string} userId ID of the User who Completed this Probe Calibration
|
|
876
|
+
* @property {string} userName Name of the User who Completed this Probe Calibration
|
|
877
|
+
* @property {number} preCalibrationOffset The Calibration Offset prior to this Probe Calibration being Created
|
|
878
|
+
* @property {number} postCalibrationOffset The Calibration Offset after this Probe Calibration was Created
|
|
879
|
+
* @property {number} preCalibrationTemperature The Temperature Probe reading prior to this Probe Calibration being Created
|
|
880
|
+
* @property {number} postCalibrationTemperature The Temperature Probe reading after this Probe Calibration was Created
|
|
881
|
+
* @memberof Controllers.Lab.Site
|
|
882
|
+
*/
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* The Update Data for a Probe Calibration
|
|
886
|
+
*
|
|
887
|
+
* @typedef {Object} ProbeCalibrationController.UpdateData
|
|
888
|
+
* @property {string} [rackPositionId] The Rack Position ID this Probe Calibration is associated with
|
|
889
|
+
* @property {Date} [createdTimestamp] When this Probe Calibration was Created
|
|
890
|
+
* @property {string} [userId] ID of the User who Completed this Probe Calibration
|
|
891
|
+
* @property {string} [userName] Name of the User who Completed this Probe Calibration
|
|
892
|
+
* @property {number} [preCalibrationOffset] The Calibration Offset prior to this Probe Calibration being Created
|
|
893
|
+
* @property {number} [postCalibrationOffset] The Calibration Offset after this Probe Calibration was Created
|
|
894
|
+
* @property {number} [preCalibrationTemperature] The Temperature Probe reading prior to this Probe Calibration being Created
|
|
895
|
+
* @property {number} [postCalibrationTemperature] The Temperature Probe reading after this Probe Calibration was Created
|
|
896
|
+
* @memberof Controllers.Lab.Site
|
|
897
|
+
*/
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* A **UserAccount** Type
|
|
901
|
+
*
|
|
902
|
+
* @typedef {Object} ProbeCalibrationController.UserAccount
|
|
903
|
+
* @property {?string} id The User Account ID
|
|
904
|
+
* @property {?string} firstName The User's First Name
|
|
905
|
+
* @property {?string} lastName The User's Last Name
|
|
906
|
+
* @memberof Controllers.Lab.Site
|
|
907
|
+
*/
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* A **CommentItem** Type
|
|
911
|
+
*
|
|
912
|
+
* @typedef {Object} ProbeCalibrationController.CommentItem
|
|
913
|
+
* @property {string} id The Comment ID
|
|
914
|
+
* @property {ProbeCalibrationController.UserAccount} userAccount
|
|
915
|
+
* @property {?string} content The Content of the Comment
|
|
916
|
+
* @property {?Date} createdTimestamp When the Comment was Created
|
|
917
|
+
* @property {?Date} updatedTimestamp When the Comment was last Updated
|
|
918
|
+
* @memberof Controllers.Lab.Site
|
|
919
|
+
*/
|
|
920
|
+
|
|
921
|
+
exports.default = _default;
|