@ricado/api-client 2.5.8 → 2.5.9

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.
@@ -1866,6 +1866,502 @@ var PackrunController = /*#__PURE__*/function () {
1866
1866
  });
1867
1867
  });
1868
1868
  }
1869
+ /**
1870
+ * Retrive a Packrun's Latest Summary Data [GET /packhouse/sites/{siteId}/packruns/{id}/latestSummaryData]
1871
+ *
1872
+ * Retrieves the Latest Summary Data for a Packrun
1873
+ *
1874
+ * @static
1875
+ * @public
1876
+ * @param {number} siteId The Site ID
1877
+ * @param {string} id The Packrun ID
1878
+ * @return {Promise<PackrunController.PackrunLatestSummaryData>}
1879
+ */
1880
+
1881
+ }, {
1882
+ key: "getLatestSummaryData",
1883
+ value: function getLatestSummaryData(siteId, id) {
1884
+ return new Promise(function (resolve, reject) {
1885
+ _RequestHelper.default.getRequest("/packhouse/sites/".concat(siteId, "/packruns/").concat(id, "/latestSummaryData")).then(function (result) {
1886
+ var resolveValue = function () {
1887
+ var resultObject = {};
1888
+
1889
+ if (_typeof(result) === 'object' && 'id' in result) {
1890
+ resultObject.id = function () {
1891
+ if (typeof result.id !== 'string') {
1892
+ return String(result.id);
1893
+ }
1894
+
1895
+ return result.id;
1896
+ }();
1897
+ } else {
1898
+ resultObject.id = "";
1899
+ }
1900
+
1901
+ if (_typeof(result) === 'object' && 'name' in result) {
1902
+ resultObject.name = function () {
1903
+ if (typeof result.name !== 'string') {
1904
+ return String(result.name);
1905
+ }
1906
+
1907
+ return result.name;
1908
+ }();
1909
+ } else {
1910
+ resultObject.name = "";
1911
+ }
1912
+
1913
+ if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
1914
+ resultObject.createdTimestamp = function () {
1915
+ if (typeof result.createdTimestamp !== 'string') {
1916
+ return new Date(String(result.createdTimestamp));
1917
+ }
1918
+
1919
+ return new Date(result.createdTimestamp);
1920
+ }();
1921
+ } else {
1922
+ resultObject.createdTimestamp = new Date();
1923
+ }
1924
+
1925
+ if (_typeof(result) === 'object' && 'growerName' in result) {
1926
+ resultObject.growerName = function () {
1927
+ if (typeof result.growerName !== 'string') {
1928
+ return String(result.growerName);
1929
+ }
1930
+
1931
+ return result.growerName;
1932
+ }();
1933
+ } else {
1934
+ resultObject.growerName = "";
1935
+ }
1936
+
1937
+ if (_typeof(result) === 'object' && 'growerCode' in result) {
1938
+ resultObject.growerCode = function () {
1939
+ if (typeof result.growerCode !== 'string') {
1940
+ return String(result.growerCode);
1941
+ }
1942
+
1943
+ return result.growerCode;
1944
+ }();
1945
+ } else {
1946
+ resultObject.growerCode = "";
1947
+ }
1948
+
1949
+ if (_typeof(result) === 'object' && 'maturityArea' in result) {
1950
+ resultObject.maturityArea = function () {
1951
+ if (result.maturityArea === null) {
1952
+ return null;
1953
+ }
1954
+
1955
+ if (typeof result.maturityArea !== 'string') {
1956
+ return String(result.maturityArea);
1957
+ }
1958
+
1959
+ return result.maturityArea;
1960
+ }();
1961
+ } else {
1962
+ resultObject.maturityArea = null;
1963
+ }
1964
+
1965
+ if (_typeof(result) === 'object' && 'startTimestamp' in result) {
1966
+ resultObject.startTimestamp = function () {
1967
+ if (result.startTimestamp === null) {
1968
+ return null;
1969
+ }
1970
+
1971
+ if (typeof result.startTimestamp !== 'string') {
1972
+ return new Date(String(result.startTimestamp));
1973
+ }
1974
+
1975
+ return new Date(result.startTimestamp);
1976
+ }();
1977
+ } else {
1978
+ resultObject.startTimestamp = null;
1979
+ }
1980
+
1981
+ if (_typeof(result) === 'object' && 'finishTimestamp' in result) {
1982
+ resultObject.finishTimestamp = function () {
1983
+ if (result.finishTimestamp === null) {
1984
+ return null;
1985
+ }
1986
+
1987
+ if (typeof result.finishTimestamp !== 'string') {
1988
+ return new Date(String(result.finishTimestamp));
1989
+ }
1990
+
1991
+ return new Date(result.finishTimestamp);
1992
+ }();
1993
+ } else {
1994
+ resultObject.finishTimestamp = null;
1995
+ }
1996
+
1997
+ if (_typeof(result) === 'object' && 'variety' in result) {
1998
+ resultObject.variety = function () {
1999
+ var varietyObject = {};
2000
+
2001
+ if (_typeof(result.variety) === 'object' && 'id' in result.variety) {
2002
+ varietyObject.id = function () {
2003
+ if (typeof result.variety.id !== 'string') {
2004
+ return String(result.variety.id);
2005
+ }
2006
+
2007
+ return result.variety.id;
2008
+ }();
2009
+ } else {
2010
+ varietyObject.id = "";
2011
+ }
2012
+
2013
+ if (_typeof(result.variety) === 'object' && 'code' in result.variety) {
2014
+ varietyObject.code = function () {
2015
+ if (typeof result.variety.code !== 'string') {
2016
+ return String(result.variety.code);
2017
+ }
2018
+
2019
+ return result.variety.code;
2020
+ }();
2021
+ } else {
2022
+ varietyObject.code = "";
2023
+ }
2024
+
2025
+ if (_typeof(result.variety) === 'object' && 'name' in result.variety) {
2026
+ varietyObject.name = function () {
2027
+ if (typeof result.variety.name !== 'string') {
2028
+ return String(result.variety.name);
2029
+ }
2030
+
2031
+ return result.variety.name;
2032
+ }();
2033
+ } else {
2034
+ varietyObject.name = "";
2035
+ }
2036
+
2037
+ if (_typeof(result.variety) === 'object' && 'description' in result.variety) {
2038
+ varietyObject.description = function () {
2039
+ if (typeof result.variety.description !== 'string') {
2040
+ return String(result.variety.description);
2041
+ }
2042
+
2043
+ return result.variety.description;
2044
+ }();
2045
+ } else {
2046
+ varietyObject.description = "";
2047
+ }
2048
+
2049
+ if (_typeof(result.variety) === 'object' && 'image' in result.variety) {
2050
+ varietyObject.image = function () {
2051
+ if (typeof result.variety.image !== 'string') {
2052
+ return String(result.variety.image);
2053
+ }
2054
+
2055
+ return result.variety.image;
2056
+ }();
2057
+ } else {
2058
+ varietyObject.image = "";
2059
+ }
2060
+
2061
+ return varietyObject;
2062
+ }();
2063
+ } else {
2064
+ resultObject.variety = function () {
2065
+ var varietyDefaultValue = {};
2066
+ varietyDefaultValue.id = "";
2067
+ varietyDefaultValue.code = "";
2068
+ varietyDefaultValue.name = "";
2069
+ varietyDefaultValue.description = "";
2070
+ varietyDefaultValue.image = "";
2071
+ return varietyDefaultValue;
2072
+ }();
2073
+ }
2074
+
2075
+ if (_typeof(result) === 'object' && 'growingMethod' in result) {
2076
+ resultObject.growingMethod = function () {
2077
+ var growingMethodObject = {};
2078
+
2079
+ if (_typeof(result.growingMethod) === 'object' && 'id' in result.growingMethod) {
2080
+ growingMethodObject.id = function () {
2081
+ if (typeof result.growingMethod.id !== 'string') {
2082
+ return String(result.growingMethod.id);
2083
+ }
2084
+
2085
+ return result.growingMethod.id;
2086
+ }();
2087
+ } else {
2088
+ growingMethodObject.id = "";
2089
+ }
2090
+
2091
+ if (_typeof(result.growingMethod) === 'object' && 'code' in result.growingMethod) {
2092
+ growingMethodObject.code = function () {
2093
+ if (typeof result.growingMethod.code !== 'string') {
2094
+ return String(result.growingMethod.code);
2095
+ }
2096
+
2097
+ return result.growingMethod.code;
2098
+ }();
2099
+ } else {
2100
+ growingMethodObject.code = "";
2101
+ }
2102
+
2103
+ if (_typeof(result.growingMethod) === 'object' && 'name' in result.growingMethod) {
2104
+ growingMethodObject.name = function () {
2105
+ if (typeof result.growingMethod.name !== 'string') {
2106
+ return String(result.growingMethod.name);
2107
+ }
2108
+
2109
+ return result.growingMethod.name;
2110
+ }();
2111
+ } else {
2112
+ growingMethodObject.name = "";
2113
+ }
2114
+
2115
+ if (_typeof(result.growingMethod) === 'object' && 'description' in result.growingMethod) {
2116
+ growingMethodObject.description = function () {
2117
+ if (typeof result.growingMethod.description !== 'string') {
2118
+ return String(result.growingMethod.description);
2119
+ }
2120
+
2121
+ return result.growingMethod.description;
2122
+ }();
2123
+ } else {
2124
+ growingMethodObject.description = "";
2125
+ }
2126
+
2127
+ return growingMethodObject;
2128
+ }();
2129
+ } else {
2130
+ resultObject.growingMethod = function () {
2131
+ var growingMethodDefaultValue = {};
2132
+ growingMethodDefaultValue.id = "";
2133
+ growingMethodDefaultValue.code = "";
2134
+ growingMethodDefaultValue.name = "";
2135
+ growingMethodDefaultValue.description = "";
2136
+ return growingMethodDefaultValue;
2137
+ }();
2138
+ }
2139
+
2140
+ if (_typeof(result) === 'object' && 'packingLineId' in result) {
2141
+ resultObject.packingLineId = function () {
2142
+ if (typeof result.packingLineId !== 'string') {
2143
+ return String(result.packingLineId);
2144
+ }
2145
+
2146
+ return result.packingLineId;
2147
+ }();
2148
+ } else {
2149
+ resultObject.packingLineId = "";
2150
+ }
2151
+
2152
+ if (_typeof(result) === 'object' && 'packingLineName' in result) {
2153
+ resultObject.packingLineName = function () {
2154
+ if (typeof result.packingLineName !== 'string') {
2155
+ return String(result.packingLineName);
2156
+ }
2157
+
2158
+ return result.packingLineName;
2159
+ }();
2160
+ } else {
2161
+ resultObject.packingLineName = "";
2162
+ }
2163
+
2164
+ if (_typeof(result) === 'object' && 'status' in result) {
2165
+ resultObject.status = function () {
2166
+ if (typeof result.status !== 'string') {
2167
+ return String(result.status);
2168
+ }
2169
+
2170
+ return result.status;
2171
+ }();
2172
+ } else {
2173
+ resultObject.status = "";
2174
+ }
2175
+
2176
+ if (_typeof(result) === 'object' && 'allocatedBins' in result) {
2177
+ resultObject.allocatedBins = function () {
2178
+ if (typeof result.allocatedBins !== 'number') {
2179
+ return Number.isInteger(Number(result.allocatedBins)) ? Number(result.allocatedBins) : Math.floor(Number(result.allocatedBins));
2180
+ }
2181
+
2182
+ return Number.isInteger(result.allocatedBins) ? result.allocatedBins : Math.floor(result.allocatedBins);
2183
+ }();
2184
+ } else {
2185
+ resultObject.allocatedBins = 0;
2186
+ }
2187
+
2188
+ if (_typeof(result) === 'object' && 'tippedBins' in result) {
2189
+ resultObject.tippedBins = function () {
2190
+ if (typeof result.tippedBins !== 'number') {
2191
+ return Number.isInteger(Number(result.tippedBins)) ? Number(result.tippedBins) : Math.floor(Number(result.tippedBins));
2192
+ }
2193
+
2194
+ return Number.isInteger(result.tippedBins) ? result.tippedBins : Math.floor(result.tippedBins);
2195
+ }();
2196
+ } else {
2197
+ resultObject.tippedBins = 0;
2198
+ }
2199
+
2200
+ if (_typeof(result) === 'object' && 'class1FruitSizeProfile' in result) {
2201
+ resultObject.class1FruitSizeProfile = function () {
2202
+ if (Array.isArray(result.class1FruitSizeProfile) !== true) {
2203
+ return [];
2204
+ }
2205
+
2206
+ return result.class1FruitSizeProfile.map(function (class1FruitSizeProfileItem) {
2207
+ return function () {
2208
+ var class1FruitSizeProfileItemObject = {};
2209
+
2210
+ if (_typeof(class1FruitSizeProfileItem) === 'object' && 'fruitSize' in class1FruitSizeProfileItem) {
2211
+ class1FruitSizeProfileItemObject.fruitSize = function () {
2212
+ if (typeof class1FruitSizeProfileItem.fruitSize !== 'string') {
2213
+ return String(class1FruitSizeProfileItem.fruitSize);
2214
+ }
2215
+
2216
+ return class1FruitSizeProfileItem.fruitSize;
2217
+ }();
2218
+ } else {
2219
+ class1FruitSizeProfileItemObject.fruitSize = "";
2220
+ }
2221
+
2222
+ if (_typeof(class1FruitSizeProfileItem) === 'object' && 'fruitCount' in class1FruitSizeProfileItem) {
2223
+ class1FruitSizeProfileItemObject.fruitCount = function () {
2224
+ if (typeof class1FruitSizeProfileItem.fruitCount !== 'number') {
2225
+ return Number.isInteger(Number(class1FruitSizeProfileItem.fruitCount)) ? Number(class1FruitSizeProfileItem.fruitCount) : Math.floor(Number(class1FruitSizeProfileItem.fruitCount));
2226
+ }
2227
+
2228
+ return Number.isInteger(class1FruitSizeProfileItem.fruitCount) ? class1FruitSizeProfileItem.fruitCount : Math.floor(class1FruitSizeProfileItem.fruitCount);
2229
+ }();
2230
+ } else {
2231
+ class1FruitSizeProfileItemObject.fruitCount = 0;
2232
+ }
2233
+
2234
+ if (_typeof(class1FruitSizeProfileItem) === 'object' && 'percentage' in class1FruitSizeProfileItem) {
2235
+ class1FruitSizeProfileItemObject.percentage = function () {
2236
+ if (typeof class1FruitSizeProfileItem.percentage !== 'number') {
2237
+ return Number(class1FruitSizeProfileItem.percentage);
2238
+ }
2239
+
2240
+ return class1FruitSizeProfileItem.percentage;
2241
+ }();
2242
+ } else {
2243
+ class1FruitSizeProfileItemObject.percentage = 0;
2244
+ }
2245
+
2246
+ return class1FruitSizeProfileItemObject;
2247
+ }();
2248
+ });
2249
+ }();
2250
+ } else {
2251
+ resultObject.class1FruitSizeProfile = [];
2252
+ }
2253
+
2254
+ if (_typeof(result) === 'object' && 'class1TotalTrays' in result) {
2255
+ resultObject.class1TotalTrays = function () {
2256
+ if (typeof result.class1TotalTrays !== 'number') {
2257
+ return Number(result.class1TotalTrays);
2258
+ }
2259
+
2260
+ return result.class1TotalTrays;
2261
+ }();
2262
+ } else {
2263
+ resultObject.class1TotalTrays = 0;
2264
+ }
2265
+
2266
+ if (_typeof(result) === 'object' && 'class1TraysPerBin' in result) {
2267
+ resultObject.class1TraysPerBin = function () {
2268
+ if (typeof result.class1TraysPerBin !== 'number') {
2269
+ return Number(result.class1TraysPerBin);
2270
+ }
2271
+
2272
+ return result.class1TraysPerBin;
2273
+ }();
2274
+ } else {
2275
+ resultObject.class1TraysPerBin = 0;
2276
+ }
2277
+
2278
+ if (_typeof(result) === 'object' && 'class1AverageFruitSize' in result) {
2279
+ resultObject.class1AverageFruitSize = function () {
2280
+ if (typeof result.class1AverageFruitSize !== 'number') {
2281
+ return Number(result.class1AverageFruitSize);
2282
+ }
2283
+
2284
+ return result.class1AverageFruitSize;
2285
+ }();
2286
+ } else {
2287
+ resultObject.class1AverageFruitSize = 0;
2288
+ }
2289
+
2290
+ if (_typeof(result) === 'object' && 'class2TotalTrays' in result) {
2291
+ resultObject.class2TotalTrays = function () {
2292
+ if (typeof result.class2TotalTrays !== 'number') {
2293
+ return Number(result.class2TotalTrays);
2294
+ }
2295
+
2296
+ return result.class2TotalTrays;
2297
+ }();
2298
+ } else {
2299
+ resultObject.class2TotalTrays = 0;
2300
+ }
2301
+
2302
+ if (_typeof(result) === 'object' && 'classTypes' in result) {
2303
+ resultObject.classTypes = function () {
2304
+ if (Array.isArray(result.classTypes) !== true) {
2305
+ return [];
2306
+ }
2307
+
2308
+ return result.classTypes.map(function (classTypesItem) {
2309
+ return function () {
2310
+ var classTypesItemObject = {};
2311
+
2312
+ if (_typeof(classTypesItem) === 'object' && 'classType' in classTypesItem) {
2313
+ classTypesItemObject.classType = function () {
2314
+ if (typeof classTypesItem.classType !== 'string') {
2315
+ return String(classTypesItem.classType);
2316
+ }
2317
+
2318
+ return classTypesItem.classType;
2319
+ }();
2320
+ } else {
2321
+ classTypesItemObject.classType = "";
2322
+ }
2323
+
2324
+ if (_typeof(classTypesItem) === 'object' && 'name' in classTypesItem) {
2325
+ classTypesItemObject.name = function () {
2326
+ if (typeof classTypesItem.name !== 'string') {
2327
+ return String(classTypesItem.name);
2328
+ }
2329
+
2330
+ return classTypesItem.name;
2331
+ }();
2332
+ } else {
2333
+ classTypesItemObject.name = "";
2334
+ }
2335
+
2336
+ if (_typeof(classTypesItem) === 'object' && 'percentage' in classTypesItem) {
2337
+ classTypesItemObject.percentage = function () {
2338
+ if (typeof classTypesItem.percentage !== 'number') {
2339
+ return Number(classTypesItem.percentage);
2340
+ }
2341
+
2342
+ return classTypesItem.percentage;
2343
+ }();
2344
+ } else {
2345
+ classTypesItemObject.percentage = 0;
2346
+ }
2347
+
2348
+ return classTypesItemObject;
2349
+ }();
2350
+ });
2351
+ }();
2352
+ } else {
2353
+ resultObject.classTypes = [];
2354
+ }
2355
+
2356
+ return resultObject;
2357
+ }();
2358
+
2359
+ resolve(resolveValue);
2360
+ }).catch(function (error) {
2361
+ return reject(error);
2362
+ });
2363
+ });
2364
+ }
1869
2365
  /**
1870
2366
  * List all Packruns [GET /packhouse/sites/{siteId}/packruns]
1871
2367
  *
@@ -2153,6 +2649,54 @@ var _default = PackrunController;
2153
2649
  * @memberof Controllers.Packhouse.Site
2154
2650
  */
2155
2651
 
2652
+ /**
2653
+ * A **FruitSizeProfileItem** Type
2654
+ *
2655
+ * @typedef {Object} PackrunController.FruitSizeProfileItem
2656
+ * @property {string} fruitSize The Fruit Size
2657
+ * @property {number} fruitCount The Fruit Count
2658
+ * @property {number} percentage The Percentage of Total Fruit for this Fruit Size
2659
+ * @memberof Controllers.Packhouse.Site
2660
+ */
2661
+
2662
+ /**
2663
+ * A **ClassTypePercentageItem** Type
2664
+ *
2665
+ * @typedef {Object} PackrunController.ClassTypePercentageItem
2666
+ * @property {string} classType The Class Type
2667
+ * @property {string} name The Class Type Name
2668
+ * @property {number} percentage The Percentage of Total Weight for this Class Type
2669
+ * @memberof Controllers.Packhouse.Site
2670
+ */
2671
+
2672
+ /**
2673
+ * A **PackrunLatestSummaryData** Type
2674
+ *
2675
+ * @typedef {Object} PackrunController.PackrunLatestSummaryData
2676
+ * @property {string} id The Packrun ID
2677
+ * @property {string} name The Packrun Name
2678
+ * @property {Date} createdTimestamp When the Packrun was Created
2679
+ * @property {string} growerName The Grower Name
2680
+ * @property {string} growerCode The Grower Code
2681
+ * @property {?string} maturityArea The Maturity Area
2682
+ * @property {?Date} startTimestamp When the Packrun was Started
2683
+ * @property {?Date} finishTimestamp When the Packrun was Finished
2684
+ * @property {PackrunController.VarietyItem} variety The Variety for the Packrun
2685
+ * @property {PackrunController.GrowingMethodItem} growingMethod The Growing Method for the Packrun
2686
+ * @property {string} packingLineId The Packing Line ID
2687
+ * @property {string} packingLineName The Packing Line Name
2688
+ * @property {string} status The Status of this Packrun
2689
+ * @property {number} allocatedBins The Number of Bins Allocated for the Packrun
2690
+ * @property {number} tippedBins The Number of Bins Tipped for the Packrun
2691
+ * @property {Array<PackrunController.FruitSizeProfileItem>} class1FruitSizeProfile An Array of Class 1 Fruit Profiles by Size for the Packrun
2692
+ * @property {number} class1TotalTrays The Total Class 1 Trays for this Packrun
2693
+ * @property {number} class1TraysPerBin The Number of Class 1 Trays per Bin for this Packrun
2694
+ * @property {number} class1AverageFruitSize The Average Class 1 Fruit Size for this Packrun
2695
+ * @property {number} class2TotalTrays The Total Class 2 Trays for this Packrun
2696
+ * @property {Array<PackrunController.ClassTypePercentageItem>} classTypes An Array of Class Types and their Percentages for this Packrun
2697
+ * @memberof Controllers.Packhouse.Site
2698
+ */
2699
+
2156
2700
  /**
2157
2701
  * A **TimeBatch** Type
2158
2702
  *
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // Generated by genversion.
8
- var version = '2.5.8';
8
+ var version = '2.5.9';
9
9
  exports.version = version;