@ricado/api-client 2.4.0 → 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.
|
@@ -32,58 +32,48 @@ var SampleController = /*#__PURE__*/function () {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
_createClass(SampleController, null, [{
|
|
35
|
-
key: "
|
|
35
|
+
key: "getOne",
|
|
36
36
|
value:
|
|
37
37
|
/**
|
|
38
|
-
* Retrieve
|
|
39
|
-
*
|
|
40
|
-
* Retrieves Temperature Data for a Sample
|
|
38
|
+
* Retrieve a Sample [GET /lab/sites/{siteId}/samples/{id}]
|
|
41
39
|
*
|
|
42
40
|
* @static
|
|
43
41
|
* @public
|
|
44
42
|
* @param {number} siteId The Site ID
|
|
45
43
|
* @param {string} id The Sample ID
|
|
46
|
-
* @return {Promise<
|
|
44
|
+
* @return {Promise<SampleModel>}
|
|
47
45
|
*/
|
|
48
|
-
function
|
|
46
|
+
function getOne(siteId, id) {
|
|
49
47
|
return new Promise(function (resolve, reject) {
|
|
50
48
|
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples/").concat(id)).then(function (result) {
|
|
51
49
|
var resolveValue = function () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return result.map(function (resultItem) {
|
|
57
|
-
return function () {
|
|
58
|
-
var resultItemObject = {};
|
|
59
|
-
|
|
60
|
-
if (_typeof(resultItem) === 'object' && 'timestamp' in resultItem) {
|
|
61
|
-
resultItemObject.timestamp = function () {
|
|
62
|
-
if (typeof resultItem.timestamp !== 'string') {
|
|
63
|
-
return new Date(String(resultItem.timestamp));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return new Date(resultItem.timestamp);
|
|
67
|
-
}();
|
|
68
|
-
} else {
|
|
69
|
-
resultItemObject.timestamp = new Date();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (_typeof(resultItem) === 'object' && 'temperature' in resultItem) {
|
|
73
|
-
resultItemObject.temperature = function () {
|
|
74
|
-
if (typeof resultItem.temperature !== 'number') {
|
|
75
|
-
return Number(resultItem.temperature);
|
|
76
|
-
}
|
|
50
|
+
return _SampleModel.default.fromJSON(result, siteId);
|
|
51
|
+
}();
|
|
77
52
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
53
|
+
resolve(resolveValue);
|
|
54
|
+
}).catch(function (error) {
|
|
55
|
+
return reject(error);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Update a Sample [PATCH /lab/sites/{siteId}/samples/{id}]
|
|
61
|
+
*
|
|
62
|
+
* @static
|
|
63
|
+
* @public
|
|
64
|
+
* @param {number} siteId The Site ID
|
|
65
|
+
* @param {string} id The Sample ID
|
|
66
|
+
* @param {SampleController.UpdateData} updateData The Sample Update Data
|
|
67
|
+
* @return {Promise<SampleModel>}
|
|
68
|
+
*/
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
}, {
|
|
71
|
+
key: "update",
|
|
72
|
+
value: function update(siteId, id, updateData) {
|
|
73
|
+
return new Promise(function (resolve, reject) {
|
|
74
|
+
_RequestHelper.default.patchRequest("/lab/sites/".concat(siteId, "/samples/").concat(id), updateData).then(function (result) {
|
|
75
|
+
var resolveValue = function () {
|
|
76
|
+
return _SampleModel.default.fromJSON(result, siteId);
|
|
87
77
|
}();
|
|
88
78
|
|
|
89
79
|
resolve(resolveValue);
|
|
@@ -92,6 +82,27 @@ var SampleController = /*#__PURE__*/function () {
|
|
|
92
82
|
});
|
|
93
83
|
});
|
|
94
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Delete a Sample [DELETE /lab/sites/{siteId}/samples/{id}]
|
|
87
|
+
*
|
|
88
|
+
* @static
|
|
89
|
+
* @public
|
|
90
|
+
* @param {number} siteId The Site ID
|
|
91
|
+
* @param {string} id The Sample ID
|
|
92
|
+
* @return {Promise<boolean>}
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
}, {
|
|
96
|
+
key: "delete",
|
|
97
|
+
value: function _delete(siteId, id) {
|
|
98
|
+
return new Promise(function (resolve, reject) {
|
|
99
|
+
_RequestHelper.default.deleteRequest("/lab/sites/".concat(siteId, "/samples/").concat(id)).then(function (result) {
|
|
100
|
+
resolve(result !== null && result !== void 0 ? result : true);
|
|
101
|
+
}).catch(function (error) {
|
|
102
|
+
return reject(error);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
95
106
|
/**
|
|
96
107
|
* Retrieve Comments [GET /lab/sites/{siteId}/samples/{id}/comments]
|
|
97
108
|
*
|
|
@@ -771,6 +782,67 @@ var SampleController = /*#__PURE__*/function () {
|
|
|
771
782
|
});
|
|
772
783
|
});
|
|
773
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* Retrieve Temperature Data [GET /lab/sites/{siteId}/samples/{id}/temperature-data]
|
|
787
|
+
*
|
|
788
|
+
* Retrieves Temperature Data for a Sample
|
|
789
|
+
*
|
|
790
|
+
* @static
|
|
791
|
+
* @public
|
|
792
|
+
* @param {number} siteId The Site ID
|
|
793
|
+
* @param {string} id The Sample ID
|
|
794
|
+
* @return {Promise<Array<SampleController.TemperatureDataItem>>}
|
|
795
|
+
*/
|
|
796
|
+
|
|
797
|
+
}, {
|
|
798
|
+
key: "getTemperatureData",
|
|
799
|
+
value: function getTemperatureData(siteId, id) {
|
|
800
|
+
return new Promise(function (resolve, reject) {
|
|
801
|
+
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/temperature-data")).then(function (result) {
|
|
802
|
+
var resolveValue = function () {
|
|
803
|
+
if (Array.isArray(result) !== true) {
|
|
804
|
+
return [];
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
return result.map(function (resultItem) {
|
|
808
|
+
return function () {
|
|
809
|
+
var resultItemObject = {};
|
|
810
|
+
|
|
811
|
+
if (_typeof(resultItem) === 'object' && 'timestamp' in resultItem) {
|
|
812
|
+
resultItemObject.timestamp = function () {
|
|
813
|
+
if (typeof resultItem.timestamp !== 'string') {
|
|
814
|
+
return new Date(String(resultItem.timestamp));
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return new Date(resultItem.timestamp);
|
|
818
|
+
}();
|
|
819
|
+
} else {
|
|
820
|
+
resultItemObject.timestamp = new Date();
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
if (_typeof(resultItem) === 'object' && 'temperature' in resultItem) {
|
|
824
|
+
resultItemObject.temperature = function () {
|
|
825
|
+
if (typeof resultItem.temperature !== 'number') {
|
|
826
|
+
return Number(resultItem.temperature);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return resultItem.temperature;
|
|
830
|
+
}();
|
|
831
|
+
} else {
|
|
832
|
+
resultItemObject.temperature = 0;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
return resultItemObject;
|
|
836
|
+
}();
|
|
837
|
+
});
|
|
838
|
+
}();
|
|
839
|
+
|
|
840
|
+
resolve(resolveValue);
|
|
841
|
+
}).catch(function (error) {
|
|
842
|
+
return reject(error);
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
}
|
|
774
846
|
/**
|
|
775
847
|
* List all Samples [GET /lab/sites/{siteId}/samples]
|
|
776
848
|
*
|
|
@@ -894,11 +966,26 @@ var _default = SampleController;
|
|
|
894
966
|
*/
|
|
895
967
|
|
|
896
968
|
/**
|
|
897
|
-
*
|
|
969
|
+
* The Update Data for a Sample
|
|
898
970
|
*
|
|
899
|
-
* @typedef {Object} SampleController.
|
|
900
|
-
* @property {
|
|
901
|
-
* @property {
|
|
971
|
+
* @typedef {Object} SampleController.UpdateData
|
|
972
|
+
* @property {string} [labId] The Lab ID this Sample is associated with
|
|
973
|
+
* @property {Date} [createdTimestamp] When this Sample was Created
|
|
974
|
+
* @property {string} [createdSource] The Source that Created this Sample
|
|
975
|
+
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'System'
|
|
976
|
+
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'System'
|
|
977
|
+
* @property {?Date} [scheduledTimestamp] Optional Scheduled Timestamp when this Sample should Begin
|
|
978
|
+
* @property {?Date} [startTimestamp] When this Sample was Started
|
|
979
|
+
* @property {?Date} [finishTimestamp] When this Sample was Finished
|
|
980
|
+
* @property {?Date} [publishTimestamp] When this Sample was Published
|
|
981
|
+
* @property {?string} [publishUserId] ID of the User who Published this Sample
|
|
982
|
+
* @property {?string} [publishUserName] Name of the User who Published this Sample
|
|
983
|
+
* @property {string} [fruitProfileId] The Fruit Profile for this Sample
|
|
984
|
+
* @property {string} [rackPositionId] The Rack Position used for this Sample
|
|
985
|
+
* @property {string} [dehydratorId] The Dehydrator used for this Sample
|
|
986
|
+
* @property {?string} [outcome] The Outcome of this Sample
|
|
987
|
+
* @property {?string} [failureReasonId] A Sample Failure Reason ID if this Sample Failed
|
|
988
|
+
* @property {?string} [resultId] The Sample Result ID asociated with this Sample
|
|
902
989
|
* @memberof Controllers.Lab.Site
|
|
903
990
|
*/
|
|
904
991
|
|
|
@@ -924,4 +1011,13 @@ var _default = SampleController;
|
|
|
924
1011
|
* @memberof Controllers.Lab.Site
|
|
925
1012
|
*/
|
|
926
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* A **TemperatureDataItem** Type
|
|
1016
|
+
*
|
|
1017
|
+
* @typedef {Object} SampleController.TemperatureDataItem
|
|
1018
|
+
* @property {Date} timestamp The Timestamp for the Temperature Value
|
|
1019
|
+
* @property {number} temperature The Temperature Value
|
|
1020
|
+
* @memberof Controllers.Lab.Site
|
|
1021
|
+
*/
|
|
1022
|
+
|
|
927
1023
|
exports.default = _default;
|
package/lib/PackageVersion.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -7511,17 +7511,36 @@ declare module '@ricado/api-client/Controllers/Lab/Site/SampleController' {
|
|
|
7511
7511
|
*/
|
|
7512
7512
|
class SampleController {
|
|
7513
7513
|
/**
|
|
7514
|
-
* Retrieve
|
|
7514
|
+
* Retrieve a Sample [GET /lab/sites/{siteId}/samples/{id}]
|
|
7515
7515
|
*
|
|
7516
|
-
*
|
|
7516
|
+
* @static
|
|
7517
|
+
* @public
|
|
7518
|
+
* @param {number} siteId The Site ID
|
|
7519
|
+
* @param {string} id The Sample ID
|
|
7520
|
+
* @return {Promise<SampleModel>}
|
|
7521
|
+
*/
|
|
7522
|
+
static getOne(siteId: number, id: string): Promise<SampleModel>;
|
|
7523
|
+
/**
|
|
7524
|
+
* Update a Sample [PATCH /lab/sites/{siteId}/samples/{id}]
|
|
7517
7525
|
*
|
|
7518
7526
|
* @static
|
|
7519
7527
|
* @public
|
|
7520
7528
|
* @param {number} siteId The Site ID
|
|
7521
7529
|
* @param {string} id The Sample ID
|
|
7522
|
-
* @
|
|
7530
|
+
* @param {SampleController.UpdateData} updateData The Sample Update Data
|
|
7531
|
+
* @return {Promise<SampleModel>}
|
|
7523
7532
|
*/
|
|
7524
|
-
static
|
|
7533
|
+
static update(siteId: number, id: string, updateData: SampleController.UpdateData): Promise<SampleModel>;
|
|
7534
|
+
/**
|
|
7535
|
+
* Delete a Sample [DELETE /lab/sites/{siteId}/samples/{id}]
|
|
7536
|
+
*
|
|
7537
|
+
* @static
|
|
7538
|
+
* @public
|
|
7539
|
+
* @param {number} siteId The Site ID
|
|
7540
|
+
* @param {string} id The Sample ID
|
|
7541
|
+
* @return {Promise<boolean>}
|
|
7542
|
+
*/
|
|
7543
|
+
static delete(siteId: number, id: string): Promise<boolean>;
|
|
7525
7544
|
/**
|
|
7526
7545
|
* Retrieve Comments [GET /lab/sites/{siteId}/samples/{id}/comments]
|
|
7527
7546
|
*
|
|
@@ -7599,6 +7618,18 @@ declare module '@ricado/api-client/Controllers/Lab/Site/SampleController' {
|
|
|
7599
7618
|
* @return {Promise<SampleResultModel>}
|
|
7600
7619
|
*/
|
|
7601
7620
|
static getSampleResult(siteId: number, id: string): Promise<SampleResultModel>;
|
|
7621
|
+
/**
|
|
7622
|
+
* Retrieve Temperature Data [GET /lab/sites/{siteId}/samples/{id}/temperature-data]
|
|
7623
|
+
*
|
|
7624
|
+
* Retrieves Temperature Data for a Sample
|
|
7625
|
+
*
|
|
7626
|
+
* @static
|
|
7627
|
+
* @public
|
|
7628
|
+
* @param {number} siteId The Site ID
|
|
7629
|
+
* @param {string} id The Sample ID
|
|
7630
|
+
* @return {Promise<Array<SampleController.TemperatureDataItem>>}
|
|
7631
|
+
*/
|
|
7632
|
+
static getTemperatureData(siteId: number, id: string): Promise<Array<SampleController.TemperatureDataItem>>;
|
|
7602
7633
|
/**
|
|
7603
7634
|
* List all Samples [GET /lab/sites/{siteId}/samples]
|
|
7604
7635
|
*
|
|
@@ -7804,17 +7835,77 @@ declare module '@ricado/api-client/Controllers/Lab/Site/SampleController' {
|
|
|
7804
7835
|
resultId?: string | null;
|
|
7805
7836
|
};
|
|
7806
7837
|
/**
|
|
7807
|
-
*
|
|
7838
|
+
* The Update Data for a Sample
|
|
7808
7839
|
*/
|
|
7809
|
-
export type
|
|
7840
|
+
export type UpdateData = {
|
|
7810
7841
|
/**
|
|
7811
|
-
* The
|
|
7842
|
+
* The Lab ID this Sample is associated with
|
|
7812
7843
|
*/
|
|
7813
|
-
|
|
7844
|
+
labId?: string;
|
|
7814
7845
|
/**
|
|
7815
|
-
*
|
|
7846
|
+
* When this Sample was Created
|
|
7816
7847
|
*/
|
|
7817
|
-
|
|
7848
|
+
createdTimestamp?: Date;
|
|
7849
|
+
/**
|
|
7850
|
+
* The Source that Created this Sample
|
|
7851
|
+
*/
|
|
7852
|
+
createdSource?: string;
|
|
7853
|
+
/**
|
|
7854
|
+
* ID of the User who Created this Sample. Only applies if the `createdSource` is 'System'
|
|
7855
|
+
*/
|
|
7856
|
+
createdUserId?: string | null;
|
|
7857
|
+
/**
|
|
7858
|
+
* Name of the User who Created this Sample. Only applies if the `createdSource` is 'System'
|
|
7859
|
+
*/
|
|
7860
|
+
createdUserName?: string | null;
|
|
7861
|
+
/**
|
|
7862
|
+
* Optional Scheduled Timestamp when this Sample should Begin
|
|
7863
|
+
*/
|
|
7864
|
+
scheduledTimestamp?: Date | null;
|
|
7865
|
+
/**
|
|
7866
|
+
* When this Sample was Started
|
|
7867
|
+
*/
|
|
7868
|
+
startTimestamp?: Date | null;
|
|
7869
|
+
/**
|
|
7870
|
+
* When this Sample was Finished
|
|
7871
|
+
*/
|
|
7872
|
+
finishTimestamp?: Date | null;
|
|
7873
|
+
/**
|
|
7874
|
+
* When this Sample was Published
|
|
7875
|
+
*/
|
|
7876
|
+
publishTimestamp?: Date | null;
|
|
7877
|
+
/**
|
|
7878
|
+
* ID of the User who Published this Sample
|
|
7879
|
+
*/
|
|
7880
|
+
publishUserId?: string | null;
|
|
7881
|
+
/**
|
|
7882
|
+
* Name of the User who Published this Sample
|
|
7883
|
+
*/
|
|
7884
|
+
publishUserName?: string | null;
|
|
7885
|
+
/**
|
|
7886
|
+
* The Fruit Profile for this Sample
|
|
7887
|
+
*/
|
|
7888
|
+
fruitProfileId?: string;
|
|
7889
|
+
/**
|
|
7890
|
+
* The Rack Position used for this Sample
|
|
7891
|
+
*/
|
|
7892
|
+
rackPositionId?: string;
|
|
7893
|
+
/**
|
|
7894
|
+
* The Dehydrator used for this Sample
|
|
7895
|
+
*/
|
|
7896
|
+
dehydratorId?: string;
|
|
7897
|
+
/**
|
|
7898
|
+
* The Outcome of this Sample
|
|
7899
|
+
*/
|
|
7900
|
+
outcome?: string | null;
|
|
7901
|
+
/**
|
|
7902
|
+
* A Sample Failure Reason ID if this Sample Failed
|
|
7903
|
+
*/
|
|
7904
|
+
failureReasonId?: string | null;
|
|
7905
|
+
/**
|
|
7906
|
+
* The Sample Result ID asociated with this Sample
|
|
7907
|
+
*/
|
|
7908
|
+
resultId?: string | null;
|
|
7818
7909
|
};
|
|
7819
7910
|
/**
|
|
7820
7911
|
* A **UserAccount** Type
|
|
@@ -7855,9 +7946,22 @@ declare module '@ricado/api-client/Controllers/Lab/Site/SampleController' {
|
|
|
7855
7946
|
*/
|
|
7856
7947
|
updatedTimestamp: Date | null;
|
|
7857
7948
|
};
|
|
7949
|
+
/**
|
|
7950
|
+
* A **TemperatureDataItem** Type
|
|
7951
|
+
*/
|
|
7952
|
+
export type TemperatureDataItem = {
|
|
7953
|
+
/**
|
|
7954
|
+
* The Timestamp for the Temperature Value
|
|
7955
|
+
*/
|
|
7956
|
+
timestamp: Date;
|
|
7957
|
+
/**
|
|
7958
|
+
* The Temperature Value
|
|
7959
|
+
*/
|
|
7960
|
+
temperature: number;
|
|
7961
|
+
};
|
|
7858
7962
|
}
|
|
7859
|
-
import SampleResultModel from "@ricado/api-client/Models/Lab/Site/SampleResultModel";
|
|
7860
7963
|
import SampleModel from "@ricado/api-client/Models/Lab/Site/SampleModel";
|
|
7964
|
+
import SampleResultModel from "@ricado/api-client/Models/Lab/Site/SampleResultModel";
|
|
7861
7965
|
}
|
|
7862
7966
|
|
|
7863
7967
|
declare module '@ricado/api-client/Controllers/Lab/Site/SampleFailureReasonController' {
|
package/package.json
CHANGED
|
@@ -16,66 +16,46 @@ import SampleResultModel from '../../../Models/Lab/Site/SampleResultModel';
|
|
|
16
16
|
class SampleController
|
|
17
17
|
{
|
|
18
18
|
/**
|
|
19
|
-
* Retrieve
|
|
20
|
-
*
|
|
21
|
-
* Retrieves Temperature Data for a Sample
|
|
19
|
+
* Retrieve a Sample [GET /lab/sites/{siteId}/samples/{id}]
|
|
22
20
|
*
|
|
23
21
|
* @static
|
|
24
22
|
* @public
|
|
25
23
|
* @param {number} siteId The Site ID
|
|
26
24
|
* @param {string} id The Sample ID
|
|
27
|
-
* @return {Promise<
|
|
25
|
+
* @return {Promise<SampleModel>}
|
|
28
26
|
*/
|
|
29
|
-
static
|
|
27
|
+
static getOne(siteId, id)
|
|
30
28
|
{
|
|
31
29
|
return new Promise((resolve, reject) => {
|
|
32
30
|
RequestHelper.getRequest(`/lab/sites/${siteId}/samples/${id}`)
|
|
33
31
|
.then((result) => {
|
|
34
32
|
let resolveValue = (function(){
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return result.map((resultItem) => {
|
|
41
|
-
return (function(){
|
|
42
|
-
let resultItemObject = {};
|
|
43
|
-
|
|
44
|
-
if(typeof resultItem === 'object' && 'timestamp' in resultItem)
|
|
45
|
-
{
|
|
46
|
-
resultItemObject.timestamp = (function(){
|
|
47
|
-
if(typeof resultItem.timestamp !== 'string')
|
|
48
|
-
{
|
|
49
|
-
return new Date(String(resultItem.timestamp));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return new Date(resultItem.timestamp);
|
|
53
|
-
}());
|
|
54
|
-
}
|
|
55
|
-
else
|
|
56
|
-
{
|
|
57
|
-
resultItemObject.timestamp = new Date();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if(typeof resultItem === 'object' && 'temperature' in resultItem)
|
|
61
|
-
{
|
|
62
|
-
resultItemObject.temperature = (function(){
|
|
63
|
-
if(typeof resultItem.temperature !== 'number')
|
|
64
|
-
{
|
|
65
|
-
return Number(resultItem.temperature);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return resultItem.temperature;
|
|
69
|
-
}());
|
|
70
|
-
}
|
|
71
|
-
else
|
|
72
|
-
{
|
|
73
|
-
resultItemObject.temperature = 0;
|
|
74
|
-
}
|
|
33
|
+
return SampleModel.fromJSON(result, siteId);
|
|
34
|
+
}());
|
|
75
35
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
36
|
+
resolve(resolveValue);
|
|
37
|
+
})
|
|
38
|
+
.catch(error => reject(error));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Update a Sample [PATCH /lab/sites/{siteId}/samples/{id}]
|
|
44
|
+
*
|
|
45
|
+
* @static
|
|
46
|
+
* @public
|
|
47
|
+
* @param {number} siteId The Site ID
|
|
48
|
+
* @param {string} id The Sample ID
|
|
49
|
+
* @param {SampleController.UpdateData} updateData The Sample Update Data
|
|
50
|
+
* @return {Promise<SampleModel>}
|
|
51
|
+
*/
|
|
52
|
+
static update(siteId, id, updateData)
|
|
53
|
+
{
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
RequestHelper.patchRequest(`/lab/sites/${siteId}/samples/${id}`, updateData)
|
|
56
|
+
.then((result) => {
|
|
57
|
+
let resolveValue = (function(){
|
|
58
|
+
return SampleModel.fromJSON(result, siteId);
|
|
79
59
|
}());
|
|
80
60
|
|
|
81
61
|
resolve(resolveValue);
|
|
@@ -84,6 +64,26 @@ class SampleController
|
|
|
84
64
|
});
|
|
85
65
|
}
|
|
86
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Delete a Sample [DELETE /lab/sites/{siteId}/samples/{id}]
|
|
69
|
+
*
|
|
70
|
+
* @static
|
|
71
|
+
* @public
|
|
72
|
+
* @param {number} siteId The Site ID
|
|
73
|
+
* @param {string} id The Sample ID
|
|
74
|
+
* @return {Promise<boolean>}
|
|
75
|
+
*/
|
|
76
|
+
static delete(siteId, id)
|
|
77
|
+
{
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
RequestHelper.deleteRequest(`/lab/sites/${siteId}/samples/${id}`)
|
|
80
|
+
.then((result) => {
|
|
81
|
+
resolve(result ?? true);
|
|
82
|
+
})
|
|
83
|
+
.catch(error => reject(error));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
87
|
/**
|
|
88
88
|
* Retrieve Comments [GET /lab/sites/{siteId}/samples/{id}/comments]
|
|
89
89
|
*
|
|
@@ -918,6 +918,75 @@ class SampleController
|
|
|
918
918
|
});
|
|
919
919
|
}
|
|
920
920
|
|
|
921
|
+
/**
|
|
922
|
+
* Retrieve Temperature Data [GET /lab/sites/{siteId}/samples/{id}/temperature-data]
|
|
923
|
+
*
|
|
924
|
+
* Retrieves Temperature Data for a Sample
|
|
925
|
+
*
|
|
926
|
+
* @static
|
|
927
|
+
* @public
|
|
928
|
+
* @param {number} siteId The Site ID
|
|
929
|
+
* @param {string} id The Sample ID
|
|
930
|
+
* @return {Promise<Array<SampleController.TemperatureDataItem>>}
|
|
931
|
+
*/
|
|
932
|
+
static getTemperatureData(siteId, id)
|
|
933
|
+
{
|
|
934
|
+
return new Promise((resolve, reject) => {
|
|
935
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/samples/${id}/temperature-data`)
|
|
936
|
+
.then((result) => {
|
|
937
|
+
let resolveValue = (function(){
|
|
938
|
+
if(Array.isArray(result) !== true)
|
|
939
|
+
{
|
|
940
|
+
return [];
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
return result.map((resultItem) => {
|
|
944
|
+
return (function(){
|
|
945
|
+
let resultItemObject = {};
|
|
946
|
+
|
|
947
|
+
if(typeof resultItem === 'object' && 'timestamp' in resultItem)
|
|
948
|
+
{
|
|
949
|
+
resultItemObject.timestamp = (function(){
|
|
950
|
+
if(typeof resultItem.timestamp !== 'string')
|
|
951
|
+
{
|
|
952
|
+
return new Date(String(resultItem.timestamp));
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
return new Date(resultItem.timestamp);
|
|
956
|
+
}());
|
|
957
|
+
}
|
|
958
|
+
else
|
|
959
|
+
{
|
|
960
|
+
resultItemObject.timestamp = new Date();
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
if(typeof resultItem === 'object' && 'temperature' in resultItem)
|
|
964
|
+
{
|
|
965
|
+
resultItemObject.temperature = (function(){
|
|
966
|
+
if(typeof resultItem.temperature !== 'number')
|
|
967
|
+
{
|
|
968
|
+
return Number(resultItem.temperature);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
return resultItem.temperature;
|
|
972
|
+
}());
|
|
973
|
+
}
|
|
974
|
+
else
|
|
975
|
+
{
|
|
976
|
+
resultItemObject.temperature = 0;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
return resultItemObject;
|
|
980
|
+
}());
|
|
981
|
+
});
|
|
982
|
+
}());
|
|
983
|
+
|
|
984
|
+
resolve(resolveValue);
|
|
985
|
+
})
|
|
986
|
+
.catch(error => reject(error));
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
|
|
921
990
|
/**
|
|
922
991
|
* List all Samples [GET /lab/sites/{siteId}/samples]
|
|
923
992
|
*
|
|
@@ -1036,11 +1105,26 @@ export default SampleController;
|
|
|
1036
1105
|
*/
|
|
1037
1106
|
|
|
1038
1107
|
/**
|
|
1039
|
-
*
|
|
1108
|
+
* The Update Data for a Sample
|
|
1040
1109
|
*
|
|
1041
|
-
* @typedef {Object} SampleController.
|
|
1042
|
-
* @property {
|
|
1043
|
-
* @property {
|
|
1110
|
+
* @typedef {Object} SampleController.UpdateData
|
|
1111
|
+
* @property {string} [labId] The Lab ID this Sample is associated with
|
|
1112
|
+
* @property {Date} [createdTimestamp] When this Sample was Created
|
|
1113
|
+
* @property {string} [createdSource] The Source that Created this Sample
|
|
1114
|
+
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'System'
|
|
1115
|
+
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'System'
|
|
1116
|
+
* @property {?Date} [scheduledTimestamp] Optional Scheduled Timestamp when this Sample should Begin
|
|
1117
|
+
* @property {?Date} [startTimestamp] When this Sample was Started
|
|
1118
|
+
* @property {?Date} [finishTimestamp] When this Sample was Finished
|
|
1119
|
+
* @property {?Date} [publishTimestamp] When this Sample was Published
|
|
1120
|
+
* @property {?string} [publishUserId] ID of the User who Published this Sample
|
|
1121
|
+
* @property {?string} [publishUserName] Name of the User who Published this Sample
|
|
1122
|
+
* @property {string} [fruitProfileId] The Fruit Profile for this Sample
|
|
1123
|
+
* @property {string} [rackPositionId] The Rack Position used for this Sample
|
|
1124
|
+
* @property {string} [dehydratorId] The Dehydrator used for this Sample
|
|
1125
|
+
* @property {?string} [outcome] The Outcome of this Sample
|
|
1126
|
+
* @property {?string} [failureReasonId] A Sample Failure Reason ID if this Sample Failed
|
|
1127
|
+
* @property {?string} [resultId] The Sample Result ID asociated with this Sample
|
|
1044
1128
|
* @memberof Controllers.Lab.Site
|
|
1045
1129
|
*/
|
|
1046
1130
|
|
|
@@ -1064,4 +1148,13 @@ export default SampleController;
|
|
|
1064
1148
|
* @property {?Date} createdTimestamp When the Comment was Created
|
|
1065
1149
|
* @property {?Date} updatedTimestamp When the Comment was last Updated
|
|
1066
1150
|
* @memberof Controllers.Lab.Site
|
|
1151
|
+
*/
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* A **TemperatureDataItem** Type
|
|
1155
|
+
*
|
|
1156
|
+
* @typedef {Object} SampleController.TemperatureDataItem
|
|
1157
|
+
* @property {Date} timestamp The Timestamp for the Temperature Value
|
|
1158
|
+
* @property {number} temperature The Temperature Value
|
|
1159
|
+
* @memberof Controllers.Lab.Site
|
|
1067
1160
|
*/
|
package/src/PackageVersion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '2.4.
|
|
2
|
+
export const version = '2.4.1';
|