@ndustrial/contxt-sdk 5.5.6 → 5.6.0

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.
Files changed (233) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +6 -0
  3. package/eslint.config.mjs +44 -0
  4. package/esm/bus/channels.js +1883 -216
  5. package/esm/bus/channels.js.map +1 -1
  6. package/esm/bus/index.browser.js +218 -37
  7. package/esm/bus/index.browser.js.map +1 -1
  8. package/esm/bus/index.js +906 -94
  9. package/esm/bus/index.js.map +1 -1
  10. package/esm/bus/webSocketConnection.browser.js +86 -12
  11. package/esm/bus/webSocketConnection.browser.js.map +1 -1
  12. package/esm/bus/webSocketConnection.js +2464 -332
  13. package/esm/bus/webSocketConnection.js.map +1 -1
  14. package/esm/config/audiences.js +37 -1
  15. package/esm/config/audiences.js.map +1 -1
  16. package/esm/config/defaults.js +37 -1
  17. package/esm/config/defaults.js.map +1 -1
  18. package/esm/config/index.js +1622 -203
  19. package/esm/config/index.js.map +1 -1
  20. package/esm/coordinator/applications.js +1019 -172
  21. package/esm/coordinator/applications.js.map +1 -1
  22. package/esm/coordinator/consent.js +603 -76
  23. package/esm/coordinator/consent.js.map +1 -1
  24. package/esm/coordinator/edgeNodes.js +520 -40
  25. package/esm/coordinator/edgeNodes.js.map +1 -1
  26. package/esm/coordinator/index.js +811 -54
  27. package/esm/coordinator/index.js.map +1 -1
  28. package/esm/coordinator/organizations.js +533 -60
  29. package/esm/coordinator/organizations.js.map +1 -1
  30. package/esm/coordinator/permissions.js +914 -107
  31. package/esm/coordinator/permissions.js.map +1 -1
  32. package/esm/coordinator/roles.js +2146 -258
  33. package/esm/coordinator/roles.js.map +1 -1
  34. package/esm/coordinator/users.js +3393 -484
  35. package/esm/coordinator/users.js.map +1 -1
  36. package/esm/events/index.js +2301 -393
  37. package/esm/events/index.js.map +1 -1
  38. package/esm/files/index.js +2053 -410
  39. package/esm/files/index.js.map +1 -1
  40. package/esm/index.js +1002 -148
  41. package/esm/index.js.map +1 -1
  42. package/esm/iot/feedTypes.js +188 -25
  43. package/esm/iot/feedTypes.js.map +1 -1
  44. package/esm/iot/feeds.js +420 -59
  45. package/esm/iot/feeds.js.map +1 -1
  46. package/esm/iot/fieldCategories.js +1172 -195
  47. package/esm/iot/fieldCategories.js.map +1 -1
  48. package/esm/iot/fieldGroupings.js +1689 -255
  49. package/esm/iot/fieldGroupings.js.map +1 -1
  50. package/esm/iot/fields.js +254 -28
  51. package/esm/iot/fields.js.map +1 -1
  52. package/esm/iot/index.js +212 -34
  53. package/esm/iot/index.js.map +1 -1
  54. package/esm/iot/outputs.js +320 -31
  55. package/esm/iot/outputs.js.map +1 -1
  56. package/esm/nionic/index.js +1097 -97
  57. package/esm/nionic/index.js.map +1 -1
  58. package/esm/request.js +1313 -221
  59. package/esm/request.js.map +1 -1
  60. package/esm/sessionTypes/auth0WebAuth.js +3395 -409
  61. package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
  62. package/esm/sessionTypes/index.js +213 -22
  63. package/esm/sessionTypes/index.js.map +1 -1
  64. package/esm/sessionTypes/machineAuth.js +1314 -144
  65. package/esm/sessionTypes/machineAuth.js.map +1 -1
  66. package/esm/sessionTypes/passwordGrantAuth.js +1060 -145
  67. package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
  68. package/esm/utils/events/formatEventUpdateToServer.js +107 -4
  69. package/esm/utils/events/formatEventUpdateToServer.js.map +1 -1
  70. package/esm/utils/events/index.js +54 -2
  71. package/esm/utils/events/index.js.map +1 -1
  72. package/esm/utils/iot/formatOutputFieldDataFromServer.js +227 -14
  73. package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  74. package/esm/utils/iot/index.js +56 -3
  75. package/esm/utils/iot/index.js.map +1 -1
  76. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +207 -7
  77. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  78. package/esm/utils/objects/createCaseChangeFn.js +449 -18
  79. package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
  80. package/esm/utils/objects/index.js +56 -3
  81. package/esm/utils/objects/index.js.map +1 -1
  82. package/esm/utils/objects/map.js +520 -26
  83. package/esm/utils/objects/map.js.map +1 -1
  84. package/esm/utils/objects/toCamelCase.js +39 -3
  85. package/esm/utils/objects/toCamelCase.js.map +1 -1
  86. package/esm/utils/objects/toSnakeCase.js +39 -3
  87. package/esm/utils/objects/toSnakeCase.js.map +1 -1
  88. package/esm/utils/pagination/formatPaginatedDataFromServer.js +268 -11
  89. package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  90. package/esm/utils/pagination/index.js +54 -2
  91. package/esm/utils/pagination/index.js.map +1 -1
  92. package/esm/utils/url/index.js +47 -2
  93. package/esm/utils/url/index.js.map +1 -1
  94. package/esm/utils/url/stringifyParams.js +176 -10
  95. package/esm/utils/url/stringifyParams.js.map +1 -1
  96. package/lib/bus/channels.js +1880 -223
  97. package/lib/bus/channels.js.map +1 -1
  98. package/lib/bus/index.browser.js +215 -43
  99. package/lib/bus/index.browser.js.map +1 -1
  100. package/lib/bus/index.js +903 -106
  101. package/lib/bus/index.js.map +1 -1
  102. package/lib/bus/webSocketConnection.browser.js +83 -15
  103. package/lib/bus/webSocketConnection.browser.js.map +1 -1
  104. package/lib/bus/webSocketConnection.js +2461 -339
  105. package/lib/bus/webSocketConnection.js.map +1 -1
  106. package/lib/config/audiences.js +33 -2
  107. package/lib/config/audiences.js.map +1 -1
  108. package/lib/config/defaults.js +33 -2
  109. package/lib/config/defaults.js.map +1 -1
  110. package/lib/config/index.js +1619 -212
  111. package/lib/config/index.js.map +1 -1
  112. package/lib/coordinator/applications.js +1016 -174
  113. package/lib/coordinator/applications.js.map +1 -1
  114. package/lib/coordinator/consent.js +600 -78
  115. package/lib/coordinator/consent.js.map +1 -1
  116. package/lib/coordinator/edgeNodes.js +517 -42
  117. package/lib/coordinator/edgeNodes.js.map +1 -1
  118. package/lib/coordinator/index.js +808 -78
  119. package/lib/coordinator/index.js.map +1 -1
  120. package/lib/coordinator/organizations.js +530 -62
  121. package/lib/coordinator/organizations.js.map +1 -1
  122. package/lib/coordinator/permissions.js +911 -109
  123. package/lib/coordinator/permissions.js.map +1 -1
  124. package/lib/coordinator/roles.js +2143 -260
  125. package/lib/coordinator/roles.js.map +1 -1
  126. package/lib/coordinator/users.js +3389 -489
  127. package/lib/coordinator/users.js.map +1 -1
  128. package/lib/events/index.js +2297 -404
  129. package/lib/events/index.js.map +1 -1
  130. package/lib/files/index.js +2050 -418
  131. package/lib/files/index.js.map +1 -1
  132. package/lib/index.js +999 -183
  133. package/lib/index.js.map +1 -1
  134. package/lib/iot/feedTypes.js +185 -27
  135. package/lib/iot/feedTypes.js.map +1 -1
  136. package/lib/iot/feeds.js +417 -61
  137. package/lib/iot/feeds.js.map +1 -1
  138. package/lib/iot/fieldCategories.js +1169 -203
  139. package/lib/iot/fieldCategories.js.map +1 -1
  140. package/lib/iot/fieldGroupings.js +1686 -263
  141. package/lib/iot/fieldGroupings.js.map +1 -1
  142. package/lib/iot/fields.js +251 -30
  143. package/lib/iot/fields.js.map +1 -1
  144. package/lib/iot/index.js +209 -55
  145. package/lib/iot/index.js.map +1 -1
  146. package/lib/iot/outputs.js +317 -34
  147. package/lib/iot/outputs.js.map +1 -1
  148. package/lib/nionic/index.js +1094 -98
  149. package/lib/nionic/index.js.map +1 -1
  150. package/lib/request.js +1310 -228
  151. package/lib/request.js.map +1 -1
  152. package/lib/sessionTypes/auth0WebAuth.js +3391 -421
  153. package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
  154. package/lib/sessionTypes/index.js +209 -26
  155. package/lib/sessionTypes/index.js.map +1 -1
  156. package/lib/sessionTypes/machineAuth.js +1311 -151
  157. package/lib/sessionTypes/machineAuth.js.map +1 -1
  158. package/lib/sessionTypes/passwordGrantAuth.js +1057 -156
  159. package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
  160. package/lib/utils/events/formatEventUpdateToServer.js +102 -4
  161. package/lib/utils/events/formatEventUpdateToServer.js.map +1 -1
  162. package/lib/utils/events/index.js +51 -10
  163. package/lib/utils/events/index.js.map +1 -1
  164. package/lib/utils/iot/formatOutputFieldDataFromServer.js +224 -18
  165. package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  166. package/lib/utils/iot/index.js +53 -15
  167. package/lib/utils/iot/index.js.map +1 -1
  168. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +203 -13
  169. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  170. package/lib/utils/objects/createCaseChangeFn.js +446 -25
  171. package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
  172. package/lib/utils/objects/index.js +53 -15
  173. package/lib/utils/objects/index.js.map +1 -1
  174. package/lib/utils/objects/map.js +517 -33
  175. package/lib/utils/objects/map.js.map +1 -1
  176. package/lib/utils/objects/toCamelCase.js +36 -11
  177. package/lib/utils/objects/toCamelCase.js.map +1 -1
  178. package/lib/utils/objects/toSnakeCase.js +36 -11
  179. package/lib/utils/objects/toSnakeCase.js.map +1 -1
  180. package/lib/utils/pagination/formatPaginatedDataFromServer.js +265 -14
  181. package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  182. package/lib/utils/pagination/index.js +51 -10
  183. package/lib/utils/pagination/index.js.map +1 -1
  184. package/lib/utils/url/index.js +44 -7
  185. package/lib/utils/url/index.js.map +1 -1
  186. package/lib/utils/url/stringifyParams.js +172 -18
  187. package/lib/utils/url/stringifyParams.js.map +1 -1
  188. package/package.json +31 -35
  189. package/src/bus/channels.js +6 -6
  190. package/src/bus/channels.spec.js +1 -1
  191. package/src/coordinator/applications.js +7 -7
  192. package/src/coordinator/applications.spec.js +1 -1
  193. package/src/coordinator/consent.js +3 -3
  194. package/src/coordinator/edgeNodes.js +3 -3
  195. package/src/coordinator/edgeNodes.spec.js +1 -1
  196. package/src/coordinator/organizations.js +4 -4
  197. package/src/coordinator/organizations.spec.js +1 -1
  198. package/src/coordinator/permissions.js +6 -6
  199. package/src/coordinator/permissions.spec.js +1 -1
  200. package/src/coordinator/roles.js +9 -9
  201. package/src/coordinator/roles.spec.js +1 -1
  202. package/src/coordinator/users.js +12 -12
  203. package/src/coordinator/users.spec.js +1 -1
  204. package/src/events/index.js +18 -18
  205. package/src/events/index.spec.js +3 -3
  206. package/src/files/index.js +9 -9
  207. package/src/files/index.spec.js +2 -2
  208. package/src/index.js +3 -1
  209. package/src/iot/feedTypes.js +2 -2
  210. package/src/iot/feeds.js +4 -4
  211. package/src/iot/feeds.spec.js +1 -1
  212. package/src/iot/fieldCategories.js +10 -10
  213. package/src/iot/fieldCategories.spec.js +2 -2
  214. package/src/iot/fieldGroupings.js +10 -10
  215. package/src/iot/fieldGroupings.spec.js +2 -2
  216. package/src/iot/fields.js +2 -2
  217. package/src/iot/fields.spec.js +1 -1
  218. package/src/iot/outputs.js +2 -2
  219. package/src/iot/outputs.spec.js +1 -1
  220. package/src/request.js +2 -4
  221. package/src/request.spec.js +1 -1
  222. package/src/sessionTypes/auth0WebAuth.spec.js +1 -1
  223. package/src/utils/events/index.js +2 -1
  224. package/src/utils/iot/formatOutputFieldDataFromServer.js +5 -5
  225. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +2 -2
  226. package/src/utils/iot/index.js +2 -1
  227. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +3 -1
  228. package/src/utils/objects/index.js +2 -1
  229. package/src/utils/pagination/formatPaginatedDataFromServer.js +3 -3
  230. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +1 -1
  231. package/src/utils/pagination/index.js +2 -1
  232. package/support/mocharc.yml +1 -1
  233. package/.eslintrc +0 -24
@@ -1,23 +1,962 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
-
9
- var _lodash = require('lodash.isplainobject');
10
-
11
- var _lodash2 = _interopRequireDefault(_lodash);
12
-
13
- var _objects = require('../utils/objects');
14
-
15
- var _pagination = require('../utils/pagination');
16
-
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
-
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.promise.js");
8
+ var _lodash = _interopRequireDefault(require("lodash.isplainobject"));
9
+ var _objects = _interopRequireDefault(require("../utils/objects"));
10
+ var _pagination = _interopRequireDefault(require("../utils/pagination"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function cov_23vzckr7l5() {
13
+ var path = "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/iot/fieldCategories.js";
14
+ var hash = "1e11e5c3a08510de2f57624ee54d6b87cb300b4d";
15
+ var global = new Function("return this")();
16
+ var gcv = "__coverage__";
17
+ var coverageData = {
18
+ path: "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/iot/fieldCategories.js",
19
+ statementMap: {
20
+ "0": {
21
+ start: {
22
+ line: 36,
23
+ column: 4
24
+ },
25
+ end: {
26
+ line: 36,
27
+ column: 28
28
+ }
29
+ },
30
+ "1": {
31
+ start: {
32
+ line: 37,
33
+ column: 4
34
+ },
35
+ end: {
36
+ line: 37,
37
+ column: 28
38
+ }
39
+ },
40
+ "2": {
41
+ start: {
42
+ line: 38,
43
+ column: 4
44
+ },
45
+ end: {
46
+ line: 38,
47
+ column: 20
48
+ }
49
+ },
50
+ "3": {
51
+ start: {
52
+ line: 69,
53
+ column: 27
54
+ },
55
+ end: {
56
+ line: 69,
57
+ column: 68
58
+ }
59
+ },
60
+ "4": {
61
+ start: {
62
+ line: 71,
63
+ column: 4
64
+ },
65
+ end: {
66
+ line: 78,
67
+ column: 5
68
+ }
69
+ },
70
+ "5": {
71
+ start: {
72
+ line: 71,
73
+ column: 17
74
+ },
75
+ end: {
76
+ line: 71,
77
+ column: 18
78
+ }
79
+ },
80
+ "6": {
81
+ start: {
82
+ line: 72,
83
+ column: 20
84
+ },
85
+ end: {
86
+ line: 72,
87
+ column: 37
88
+ }
89
+ },
90
+ "7": {
91
+ start: {
92
+ line: 73,
93
+ column: 6
94
+ },
95
+ end: {
96
+ line: 77,
97
+ column: 7
98
+ }
99
+ },
100
+ "8": {
101
+ start: {
102
+ line: 74,
103
+ column: 8
104
+ },
105
+ end: {
106
+ line: 76,
107
+ column: 10
108
+ }
109
+ },
110
+ "9": {
111
+ start: {
112
+ line: 80,
113
+ column: 30
114
+ },
115
+ end: {
116
+ line: 80,
117
+ column: 68
118
+ }
119
+ },
120
+ "10": {
121
+ start: {
122
+ line: 82,
123
+ column: 4
124
+ },
125
+ end: {
126
+ line: 84,
127
+ column: 71
128
+ }
129
+ },
130
+ "11": {
131
+ start: {
132
+ line: 84,
133
+ column: 31
134
+ },
135
+ end: {
136
+ line: 84,
137
+ column: 69
138
+ }
139
+ },
140
+ "12": {
141
+ start: {
142
+ line: 104,
143
+ column: 4
144
+ },
145
+ end: {
146
+ line: 108,
147
+ column: 5
148
+ }
149
+ },
150
+ "13": {
151
+ start: {
152
+ line: 105,
153
+ column: 6
154
+ },
155
+ end: {
156
+ line: 107,
157
+ column: 8
158
+ }
159
+ },
160
+ "14": {
161
+ start: {
162
+ line: 110,
163
+ column: 4
164
+ },
165
+ end: {
166
+ line: 110,
167
+ column: 77
168
+ }
169
+ },
170
+ "15": {
171
+ start: {
172
+ line: 132,
173
+ column: 4
174
+ },
175
+ end: {
176
+ line: 138,
177
+ column: 5
178
+ }
179
+ },
180
+ "16": {
181
+ start: {
182
+ line: 133,
183
+ column: 6
184
+ },
185
+ end: {
186
+ line: 137,
187
+ column: 8
188
+ }
189
+ },
190
+ "17": {
191
+ start: {
192
+ line: 140,
193
+ column: 4
194
+ },
195
+ end: {
196
+ line: 142,
197
+ column: 71
198
+ }
199
+ },
200
+ "18": {
201
+ start: {
202
+ line: 142,
203
+ column: 31
204
+ },
205
+ end: {
206
+ line: 142,
207
+ column: 69
208
+ }
209
+ },
210
+ "19": {
211
+ start: {
212
+ line: 164,
213
+ column: 4
214
+ },
215
+ end: {
216
+ line: 170,
217
+ column: 8
218
+ }
219
+ },
220
+ "20": {
221
+ start: {
222
+ line: 169,
223
+ column: 8
224
+ },
225
+ end: {
226
+ line: 169,
227
+ column: 70
228
+ }
229
+ },
230
+ "21": {
231
+ start: {
232
+ line: 192,
233
+ column: 4
234
+ },
235
+ end: {
236
+ line: 198,
237
+ column: 5
238
+ }
239
+ },
240
+ "22": {
241
+ start: {
242
+ line: 193,
243
+ column: 6
244
+ },
245
+ end: {
246
+ line: 197,
247
+ column: 8
248
+ }
249
+ },
250
+ "23": {
251
+ start: {
252
+ line: 200,
253
+ column: 4
254
+ },
255
+ end: {
256
+ line: 202,
257
+ column: 75
258
+ }
259
+ },
260
+ "24": {
261
+ start: {
262
+ line: 202,
263
+ column: 33
264
+ },
265
+ end: {
266
+ line: 202,
267
+ column: 73
268
+ }
269
+ },
270
+ "25": {
271
+ start: {
272
+ line: 232,
273
+ column: 4
274
+ },
275
+ end: {
276
+ line: 238,
277
+ column: 5
278
+ }
279
+ },
280
+ "26": {
281
+ start: {
282
+ line: 233,
283
+ column: 6
284
+ },
285
+ end: {
286
+ line: 237,
287
+ column: 8
288
+ }
289
+ },
290
+ "27": {
291
+ start: {
292
+ line: 240,
293
+ column: 4
294
+ },
295
+ end: {
296
+ line: 244,
297
+ column: 5
298
+ }
299
+ },
300
+ "28": {
301
+ start: {
302
+ line: 241,
303
+ column: 6
304
+ },
305
+ end: {
306
+ line: 243,
307
+ column: 8
308
+ }
309
+ },
310
+ "29": {
311
+ start: {
312
+ line: 246,
313
+ column: 4
314
+ },
315
+ end: {
316
+ line: 252,
317
+ column: 5
318
+ }
319
+ },
320
+ "30": {
321
+ start: {
322
+ line: 247,
323
+ column: 6
324
+ },
325
+ end: {
326
+ line: 251,
327
+ column: 8
328
+ }
329
+ },
330
+ "31": {
331
+ start: {
332
+ line: 254,
333
+ column: 28
334
+ },
335
+ end: {
336
+ line: 256,
337
+ column: 6
338
+ }
339
+ },
340
+ "32": {
341
+ start: {
342
+ line: 258,
343
+ column: 4
344
+ },
345
+ end: {
346
+ line: 260,
347
+ column: 71
348
+ }
349
+ },
350
+ "33": {
351
+ start: {
352
+ line: 260,
353
+ column: 31
354
+ },
355
+ end: {
356
+ line: 260,
357
+ column: 69
358
+ }
359
+ }
360
+ },
361
+ fnMap: {
362
+ "0": {
363
+ name: "(anonymous_0)",
364
+ decl: {
365
+ start: {
366
+ line: 35,
367
+ column: 2
368
+ },
369
+ end: {
370
+ line: 35,
371
+ column: 3
372
+ }
373
+ },
374
+ loc: {
375
+ start: {
376
+ line: 35,
377
+ column: 37
378
+ },
379
+ end: {
380
+ line: 39,
381
+ column: 3
382
+ }
383
+ },
384
+ line: 35
385
+ },
386
+ "1": {
387
+ name: "(anonymous_1)",
388
+ decl: {
389
+ start: {
390
+ line: 68,
391
+ column: 2
392
+ },
393
+ end: {
394
+ line: 68,
395
+ column: 3
396
+ }
397
+ },
398
+ loc: {
399
+ start: {
400
+ line: 68,
401
+ column: 24
402
+ },
403
+ end: {
404
+ line: 85,
405
+ column: 3
406
+ }
407
+ },
408
+ line: 68
409
+ },
410
+ "2": {
411
+ name: "(anonymous_2)",
412
+ decl: {
413
+ start: {
414
+ line: 84,
415
+ column: 12
416
+ },
417
+ end: {
418
+ line: 84,
419
+ column: 13
420
+ }
421
+ },
422
+ loc: {
423
+ start: {
424
+ line: 84,
425
+ column: 31
426
+ },
427
+ end: {
428
+ line: 84,
429
+ column: 69
430
+ }
431
+ },
432
+ line: 84
433
+ },
434
+ "3": {
435
+ name: "(anonymous_3)",
436
+ decl: {
437
+ start: {
438
+ line: 103,
439
+ column: 2
440
+ },
441
+ end: {
442
+ line: 103,
443
+ column: 3
444
+ }
445
+ },
446
+ loc: {
447
+ start: {
448
+ line: 103,
449
+ column: 21
450
+ },
451
+ end: {
452
+ line: 111,
453
+ column: 3
454
+ }
455
+ },
456
+ line: 103
457
+ },
458
+ "4": {
459
+ name: "(anonymous_4)",
460
+ decl: {
461
+ start: {
462
+ line: 131,
463
+ column: 2
464
+ },
465
+ end: {
466
+ line: 131,
467
+ column: 3
468
+ }
469
+ },
470
+ loc: {
471
+ start: {
472
+ line: 131,
473
+ column: 18
474
+ },
475
+ end: {
476
+ line: 143,
477
+ column: 3
478
+ }
479
+ },
480
+ line: 131
481
+ },
482
+ "5": {
483
+ name: "(anonymous_5)",
484
+ decl: {
485
+ start: {
486
+ line: 142,
487
+ column: 12
488
+ },
489
+ end: {
490
+ line: 142,
491
+ column: 13
492
+ }
493
+ },
494
+ loc: {
495
+ start: {
496
+ line: 142,
497
+ column: 31
498
+ },
499
+ end: {
500
+ line: 142,
501
+ column: 69
502
+ }
503
+ },
504
+ line: 142
505
+ },
506
+ "6": {
507
+ name: "(anonymous_6)",
508
+ decl: {
509
+ start: {
510
+ line: 163,
511
+ column: 2
512
+ },
513
+ end: {
514
+ line: 163,
515
+ column: 3
516
+ }
517
+ },
518
+ loc: {
519
+ start: {
520
+ line: 163,
521
+ column: 28
522
+ },
523
+ end: {
524
+ line: 171,
525
+ column: 3
526
+ }
527
+ },
528
+ line: 163
529
+ },
530
+ "7": {
531
+ name: "(anonymous_7)",
532
+ decl: {
533
+ start: {
534
+ line: 168,
535
+ column: 12
536
+ },
537
+ end: {
538
+ line: 168,
539
+ column: 13
540
+ }
541
+ },
542
+ loc: {
543
+ start: {
544
+ line: 169,
545
+ column: 8
546
+ },
547
+ end: {
548
+ line: 169,
549
+ column: 70
550
+ }
551
+ },
552
+ line: 169
553
+ },
554
+ "8": {
555
+ name: "(anonymous_8)",
556
+ decl: {
557
+ start: {
558
+ line: 191,
559
+ column: 2
560
+ },
561
+ end: {
562
+ line: 191,
563
+ column: 3
564
+ }
565
+ },
566
+ loc: {
567
+ start: {
568
+ line: 191,
569
+ column: 31
570
+ },
571
+ end: {
572
+ line: 203,
573
+ column: 3
574
+ }
575
+ },
576
+ line: 191
577
+ },
578
+ "9": {
579
+ name: "(anonymous_9)",
580
+ decl: {
581
+ start: {
582
+ line: 202,
583
+ column: 12
584
+ },
585
+ end: {
586
+ line: 202,
587
+ column: 13
588
+ }
589
+ },
590
+ loc: {
591
+ start: {
592
+ line: 202,
593
+ column: 33
594
+ },
595
+ end: {
596
+ line: 202,
597
+ column: 73
598
+ }
599
+ },
600
+ line: 202
601
+ },
602
+ "10": {
603
+ name: "(anonymous_10)",
604
+ decl: {
605
+ start: {
606
+ line: 231,
607
+ column: 2
608
+ },
609
+ end: {
610
+ line: 231,
611
+ column: 3
612
+ }
613
+ },
614
+ loc: {
615
+ start: {
616
+ line: 231,
617
+ column: 29
618
+ },
619
+ end: {
620
+ line: 261,
621
+ column: 3
622
+ }
623
+ },
624
+ line: 231
625
+ },
626
+ "11": {
627
+ name: "(anonymous_11)",
628
+ decl: {
629
+ start: {
630
+ line: 260,
631
+ column: 12
632
+ },
633
+ end: {
634
+ line: 260,
635
+ column: 13
636
+ }
637
+ },
638
+ loc: {
639
+ start: {
640
+ line: 260,
641
+ column: 31
642
+ },
643
+ end: {
644
+ line: 260,
645
+ column: 69
646
+ }
647
+ },
648
+ line: 260
649
+ }
650
+ },
651
+ branchMap: {
652
+ "0": {
653
+ loc: {
654
+ start: {
655
+ line: 73,
656
+ column: 6
657
+ },
658
+ end: {
659
+ line: 77,
660
+ column: 7
661
+ }
662
+ },
663
+ type: "if",
664
+ locations: [{
665
+ start: {
666
+ line: 73,
667
+ column: 6
668
+ },
669
+ end: {
670
+ line: 77,
671
+ column: 7
672
+ }
673
+ }, {
674
+ start: {
675
+ line: undefined,
676
+ column: undefined
677
+ },
678
+ end: {
679
+ line: undefined,
680
+ column: undefined
681
+ }
682
+ }],
683
+ line: 73
684
+ },
685
+ "1": {
686
+ loc: {
687
+ start: {
688
+ line: 104,
689
+ column: 4
690
+ },
691
+ end: {
692
+ line: 108,
693
+ column: 5
694
+ }
695
+ },
696
+ type: "if",
697
+ locations: [{
698
+ start: {
699
+ line: 104,
700
+ column: 4
701
+ },
702
+ end: {
703
+ line: 108,
704
+ column: 5
705
+ }
706
+ }, {
707
+ start: {
708
+ line: undefined,
709
+ column: undefined
710
+ },
711
+ end: {
712
+ line: undefined,
713
+ column: undefined
714
+ }
715
+ }],
716
+ line: 104
717
+ },
718
+ "2": {
719
+ loc: {
720
+ start: {
721
+ line: 132,
722
+ column: 4
723
+ },
724
+ end: {
725
+ line: 138,
726
+ column: 5
727
+ }
728
+ },
729
+ type: "if",
730
+ locations: [{
731
+ start: {
732
+ line: 132,
733
+ column: 4
734
+ },
735
+ end: {
736
+ line: 138,
737
+ column: 5
738
+ }
739
+ }, {
740
+ start: {
741
+ line: undefined,
742
+ column: undefined
743
+ },
744
+ end: {
745
+ line: undefined,
746
+ column: undefined
747
+ }
748
+ }],
749
+ line: 132
750
+ },
751
+ "3": {
752
+ loc: {
753
+ start: {
754
+ line: 192,
755
+ column: 4
756
+ },
757
+ end: {
758
+ line: 198,
759
+ column: 5
760
+ }
761
+ },
762
+ type: "if",
763
+ locations: [{
764
+ start: {
765
+ line: 192,
766
+ column: 4
767
+ },
768
+ end: {
769
+ line: 198,
770
+ column: 5
771
+ }
772
+ }, {
773
+ start: {
774
+ line: undefined,
775
+ column: undefined
776
+ },
777
+ end: {
778
+ line: undefined,
779
+ column: undefined
780
+ }
781
+ }],
782
+ line: 192
783
+ },
784
+ "4": {
785
+ loc: {
786
+ start: {
787
+ line: 232,
788
+ column: 4
789
+ },
790
+ end: {
791
+ line: 238,
792
+ column: 5
793
+ }
794
+ },
795
+ type: "if",
796
+ locations: [{
797
+ start: {
798
+ line: 232,
799
+ column: 4
800
+ },
801
+ end: {
802
+ line: 238,
803
+ column: 5
804
+ }
805
+ }, {
806
+ start: {
807
+ line: undefined,
808
+ column: undefined
809
+ },
810
+ end: {
811
+ line: undefined,
812
+ column: undefined
813
+ }
814
+ }],
815
+ line: 232
816
+ },
817
+ "5": {
818
+ loc: {
819
+ start: {
820
+ line: 240,
821
+ column: 4
822
+ },
823
+ end: {
824
+ line: 244,
825
+ column: 5
826
+ }
827
+ },
828
+ type: "if",
829
+ locations: [{
830
+ start: {
831
+ line: 240,
832
+ column: 4
833
+ },
834
+ end: {
835
+ line: 244,
836
+ column: 5
837
+ }
838
+ }, {
839
+ start: {
840
+ line: undefined,
841
+ column: undefined
842
+ },
843
+ end: {
844
+ line: undefined,
845
+ column: undefined
846
+ }
847
+ }],
848
+ line: 240
849
+ },
850
+ "6": {
851
+ loc: {
852
+ start: {
853
+ line: 246,
854
+ column: 4
855
+ },
856
+ end: {
857
+ line: 252,
858
+ column: 5
859
+ }
860
+ },
861
+ type: "if",
862
+ locations: [{
863
+ start: {
864
+ line: 246,
865
+ column: 4
866
+ },
867
+ end: {
868
+ line: 252,
869
+ column: 5
870
+ }
871
+ }, {
872
+ start: {
873
+ line: undefined,
874
+ column: undefined
875
+ },
876
+ end: {
877
+ line: undefined,
878
+ column: undefined
879
+ }
880
+ }],
881
+ line: 246
882
+ }
883
+ },
884
+ s: {
885
+ "0": 0,
886
+ "1": 0,
887
+ "2": 0,
888
+ "3": 0,
889
+ "4": 0,
890
+ "5": 0,
891
+ "6": 0,
892
+ "7": 0,
893
+ "8": 0,
894
+ "9": 0,
895
+ "10": 0,
896
+ "11": 0,
897
+ "12": 0,
898
+ "13": 0,
899
+ "14": 0,
900
+ "15": 0,
901
+ "16": 0,
902
+ "17": 0,
903
+ "18": 0,
904
+ "19": 0,
905
+ "20": 0,
906
+ "21": 0,
907
+ "22": 0,
908
+ "23": 0,
909
+ "24": 0,
910
+ "25": 0,
911
+ "26": 0,
912
+ "27": 0,
913
+ "28": 0,
914
+ "29": 0,
915
+ "30": 0,
916
+ "31": 0,
917
+ "32": 0,
918
+ "33": 0
919
+ },
920
+ f: {
921
+ "0": 0,
922
+ "1": 0,
923
+ "2": 0,
924
+ "3": 0,
925
+ "4": 0,
926
+ "5": 0,
927
+ "6": 0,
928
+ "7": 0,
929
+ "8": 0,
930
+ "9": 0,
931
+ "10": 0,
932
+ "11": 0
933
+ },
934
+ b: {
935
+ "0": [0, 0],
936
+ "1": [0, 0],
937
+ "2": [0, 0],
938
+ "3": [0, 0],
939
+ "4": [0, 0],
940
+ "5": [0, 0],
941
+ "6": [0, 0]
942
+ },
943
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
944
+ hash: "1e11e5c3a08510de2f57624ee54d6b87cb300b4d"
945
+ };
946
+ var coverage = global[gcv] || (global[gcv] = {});
947
+ if (!coverage[path] || coverage[path].hash !== hash) {
948
+ coverage[path] = coverageData;
949
+ }
950
+ var actualCoverage = coverage[path];
951
+ {
952
+ // @ts-ignore
953
+ cov_23vzckr7l5 = function () {
954
+ return actualCoverage;
955
+ };
956
+ }
957
+ return actualCoverage;
958
+ }
959
+ cov_23vzckr7l5();
21
960
  /**
22
961
  * @typedef {Object} FieldCategory
23
962
  * @property {String} description
@@ -40,7 +979,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
40
979
  *
41
980
  * @typicalname contxtSdk.iot.fieldCategories
42
981
  */
43
- var FieldCategories = function () {
982
+ class FieldCategories {
44
983
  /**
45
984
  * @param {Object} sdk An instance of the SDK so the module can communicate
46
985
  * with other modules
@@ -48,11 +987,13 @@ var FieldCategories = function () {
48
987
  * module's audience
49
988
  * @param {string} baseUrl The base URL provided by the parent module
50
989
  */
51
- function FieldCategories(sdk, request, baseUrl) {
52
- _classCallCheck(this, FieldCategories);
53
-
990
+ constructor(sdk, request, baseUrl) {
991
+ cov_23vzckr7l5().f[0]++;
992
+ cov_23vzckr7l5().s[0]++;
54
993
  this._baseUrl = baseUrl;
994
+ cov_23vzckr7l5().s[1]++;
55
995
  this._request = request;
996
+ cov_23vzckr7l5().s[2]++;
56
997
  this._sdk = sdk;
57
998
  }
58
999
 
@@ -83,199 +1024,224 @@ var FieldCategories = function () {
83
1024
  * .then((fieldCategory) => console.log(fieldCategory))
84
1025
  * .catch((err) => console.log(err));
85
1026
  */
86
-
87
-
88
- _createClass(FieldCategories, [{
89
- key: 'create',
90
- value: function create(fieldCategory) {
91
- var requiredFields = ['name', 'description', 'organizationId'];
92
-
93
- for (var i = 0; requiredFields.length > i; i++) {
94
- var field = requiredFields[i];
95
- if (!fieldCategory[field]) {
96
- return Promise.reject(new Error('A ' + field + ' is required to create a new field category.'));
97
- }
1027
+ create(fieldCategory) {
1028
+ cov_23vzckr7l5().f[1]++;
1029
+ const requiredFields = (cov_23vzckr7l5().s[3]++, ['name', 'description', 'organizationId']);
1030
+ cov_23vzckr7l5().s[4]++;
1031
+ for (let i = (cov_23vzckr7l5().s[5]++, 0); requiredFields.length > i; i++) {
1032
+ const field = (cov_23vzckr7l5().s[6]++, requiredFields[i]);
1033
+ cov_23vzckr7l5().s[7]++;
1034
+ if (!fieldCategory[field]) {
1035
+ cov_23vzckr7l5().b[0][0]++;
1036
+ cov_23vzckr7l5().s[8]++;
1037
+ return Promise.reject(new Error(`A ${field} is required to create a new field category.`));
1038
+ } else {
1039
+ cov_23vzckr7l5().b[0][1]++;
98
1040
  }
99
-
100
- var formattedCategory = (0, _objects.toSnakeCase)(fieldCategory);
101
-
102
- return this._request.post(this._baseUrl + '/categories', formattedCategory).then(function (fieldCategory) {
103
- return (0, _objects.toCamelCase)(fieldCategory);
104
- });
105
1041
  }
1042
+ const formattedCategory = (cov_23vzckr7l5().s[9]++, _objects.default.toSnakeCase(fieldCategory));
1043
+ cov_23vzckr7l5().s[10]++;
1044
+ return this._request.post(`${this._baseUrl}/categories`, formattedCategory).then(fieldCategory => {
1045
+ cov_23vzckr7l5().f[2]++;
1046
+ cov_23vzckr7l5().s[11]++;
1047
+ return _objects.default.toCamelCase(fieldCategory);
1048
+ });
1049
+ }
106
1050
 
107
- /**
108
- * Deletes a field category
109
- *
110
- * API Endpoint: '/categories/:categoryId'
111
- * Method: DELETE
112
- *
113
- * @param {String} categoryId The UUID of a field category
114
- *
115
- * @returns {Promise}
116
- * @fulfill {undefined}
117
- * @reject {Error}
118
- *
119
- * @example
120
- * contxtSdk.iot.fieldCategories
121
- * .delete('b3dbaae3-25dd-475b-80dc-66296630a8d0');
122
- */
123
-
124
- }, {
125
- key: 'delete',
126
- value: function _delete(categoryId) {
127
- if (!categoryId) {
128
- return Promise.reject(new Error('A categoryId is required for deleting a field category.'));
129
- }
130
-
131
- return this._request.delete(this._baseUrl + '/categories/' + categoryId);
1051
+ /**
1052
+ * Deletes a field category
1053
+ *
1054
+ * API Endpoint: '/categories/:categoryId'
1055
+ * Method: DELETE
1056
+ *
1057
+ * @param {String} categoryId The UUID of a field category
1058
+ *
1059
+ * @returns {Promise}
1060
+ * @fulfill {undefined}
1061
+ * @reject {Error}
1062
+ *
1063
+ * @example
1064
+ * contxtSdk.iot.fieldCategories
1065
+ * .delete('b3dbaae3-25dd-475b-80dc-66296630a8d0');
1066
+ */
1067
+ delete(categoryId) {
1068
+ cov_23vzckr7l5().f[3]++;
1069
+ cov_23vzckr7l5().s[12]++;
1070
+ if (!categoryId) {
1071
+ cov_23vzckr7l5().b[1][0]++;
1072
+ cov_23vzckr7l5().s[13]++;
1073
+ return Promise.reject(new Error('A categoryId is required for deleting a field category.'));
1074
+ } else {
1075
+ cov_23vzckr7l5().b[1][1]++;
132
1076
  }
1077
+ cov_23vzckr7l5().s[14]++;
1078
+ return this._request.delete(`${this._baseUrl}/categories/${categoryId}`);
1079
+ }
133
1080
 
134
- /**
135
- * Gets information about a field category
136
- *
137
- * API Endpoint: '/categories/:categoryId'
138
- * Method: GET
139
- *
140
- * @param {String} categoryId The UUID of a field category
141
- *
142
- * @returns {Promise}
143
- * @fulfill {FieldCategory} Information about the field category
144
- * @reject {Error}
145
- *
146
- * @example
147
- * contxtSdk.iot.fieldCategories
148
- * .get('b3dbaae3-25dd-475b-80dc-66296630a8d0')
149
- * .then((fieldCategory) => console.log(fieldCategory))
150
- * .catch((err) => console.log(err));
151
- */
152
-
153
- }, {
154
- key: 'get',
155
- value: function get(categoryId) {
156
- if (!categoryId) {
157
- return Promise.reject(new Error('A categoryId is required for getting information about a field category.'));
158
- }
159
-
160
- return this._request.get(this._baseUrl + '/categories/' + categoryId).then(function (fieldCategory) {
161
- return (0, _objects.toCamelCase)(fieldCategory);
162
- });
1081
+ /**
1082
+ * Gets information about a field category
1083
+ *
1084
+ * API Endpoint: '/categories/:categoryId'
1085
+ * Method: GET
1086
+ *
1087
+ * @param {String} categoryId The UUID of a field category
1088
+ *
1089
+ * @returns {Promise}
1090
+ * @fulfill {FieldCategory} Information about the field category
1091
+ * @reject {Error}
1092
+ *
1093
+ * @example
1094
+ * contxtSdk.iot.fieldCategories
1095
+ * .get('b3dbaae3-25dd-475b-80dc-66296630a8d0')
1096
+ * .then((fieldCategory) => console.log(fieldCategory))
1097
+ * .catch((err) => console.log(err));
1098
+ */
1099
+ get(categoryId) {
1100
+ cov_23vzckr7l5().f[4]++;
1101
+ cov_23vzckr7l5().s[15]++;
1102
+ if (!categoryId) {
1103
+ cov_23vzckr7l5().b[2][0]++;
1104
+ cov_23vzckr7l5().s[16]++;
1105
+ return Promise.reject(new Error('A categoryId is required for getting information about a field category.'));
1106
+ } else {
1107
+ cov_23vzckr7l5().b[2][1]++;
163
1108
  }
1109
+ cov_23vzckr7l5().s[17]++;
1110
+ return this._request.get(`${this._baseUrl}/categories/${categoryId}`).then(fieldCategory => {
1111
+ cov_23vzckr7l5().f[5]++;
1112
+ cov_23vzckr7l5().s[18]++;
1113
+ return _objects.default.toCamelCase(fieldCategory);
1114
+ });
1115
+ }
164
1116
 
165
- /**
166
- * Get a listing of all field categories available to the user.
167
- *
168
- * API Endpoint: '/categories'
169
- * Method: GET
170
- *
171
- * @param {PaginationOptions} [paginationOptions]
172
- *
173
- * @returns {Promise}
174
- * @fulfill {FieldCategoriesFromServer} Information about the field categories
175
- * @reject {Error}
176
- *
177
- * @example
178
- * contxtSdk.iot.fieldCategories
179
- * .getAll()
180
- * .then((fieldCategories) => console.log(fieldCategories))
181
- * .catch((err) => console.log(err));
182
- */
1117
+ /**
1118
+ * Get a listing of all field categories available to the user.
1119
+ *
1120
+ * API Endpoint: '/categories'
1121
+ * Method: GET
1122
+ *
1123
+ * @param {PaginationOptions} [paginationOptions]
1124
+ *
1125
+ * @returns {Promise}
1126
+ * @fulfill {FieldCategoriesFromServer} Information about the field categories
1127
+ * @reject {Error}
1128
+ *
1129
+ * @example
1130
+ * contxtSdk.iot.fieldCategories
1131
+ * .getAll()
1132
+ * .then((fieldCategories) => console.log(fieldCategories))
1133
+ * .catch((err) => console.log(err));
1134
+ */
1135
+ getAll(paginationOptions) {
1136
+ cov_23vzckr7l5().f[6]++;
1137
+ cov_23vzckr7l5().s[19]++;
1138
+ return this._request.get(`${this._baseUrl}/categories`, {
1139
+ params: _objects.default.toSnakeCase(paginationOptions)
1140
+ }).then(fieldCategories => {
1141
+ cov_23vzckr7l5().f[7]++;
1142
+ cov_23vzckr7l5().s[20]++;
1143
+ return _pagination.default.formatPaginatedDataFromServer(fieldCategories);
1144
+ });
1145
+ }
183
1146
 
184
- }, {
185
- key: 'getAll',
186
- value: function getAll(paginationOptions) {
187
- return this._request.get(this._baseUrl + '/categories', {
188
- params: (0, _objects.toSnakeCase)(paginationOptions)
189
- }).then(function (fieldCategories) {
190
- return (0, _pagination.formatPaginatedDataFromServer)(fieldCategories);
191
- });
1147
+ /**
1148
+ * Get a listing of all field categories for a given facility ID.
1149
+ *
1150
+ * API Endpoint: '/facilities/:facilityId/categories'
1151
+ * Method: GET
1152
+ *
1153
+ * @param {String} facilityId
1154
+ *
1155
+ * @returns {Promise}
1156
+ * @fulfill {FieldCategory[]} Information about the field categories
1157
+ * @reject {Error}
1158
+ *
1159
+ * @example
1160
+ * contxtSdk.iot.fieldCategories
1161
+ * .getAllByFacility(187)
1162
+ * .then((fieldCategories) => console.log(fieldCategories))
1163
+ * .catch((err) => console.log(err));
1164
+ */
1165
+ getAllByFacility(facilityId) {
1166
+ cov_23vzckr7l5().f[8]++;
1167
+ cov_23vzckr7l5().s[21]++;
1168
+ if (!facilityId) {
1169
+ cov_23vzckr7l5().b[3][0]++;
1170
+ cov_23vzckr7l5().s[22]++;
1171
+ return Promise.reject(new Error('A facilityId is required for getting field categories by facility.'));
1172
+ } else {
1173
+ cov_23vzckr7l5().b[3][1]++;
192
1174
  }
1175
+ cov_23vzckr7l5().s[23]++;
1176
+ return this._request.get(`${this._baseUrl}/facilities/${facilityId}/categories`).then(fieldCategories => {
1177
+ cov_23vzckr7l5().f[9]++;
1178
+ cov_23vzckr7l5().s[24]++;
1179
+ return _objects.default.toCamelCase(fieldCategories);
1180
+ });
1181
+ }
193
1182
 
194
- /**
195
- * Get a listing of all field categories for a given facility ID.
196
- *
197
- * API Endpoint: '/facilities/:facilityId/categories'
198
- * Method: GET
199
- *
200
- * @param {String} facilityId
201
- *
202
- * @returns {Promise}
203
- * @fulfill {FieldCategory[]} Information about the field categories
204
- * @reject {Error}
205
- *
206
- * @example
207
- * contxtSdk.iot.fieldCategories
208
- * .getAllByFacility(187)
209
- * .then((fieldCategories) => console.log(fieldCategories))
210
- * .catch((err) => console.log(err));
211
- */
212
-
213
- }, {
214
- key: 'getAllByFacility',
215
- value: function getAllByFacility(facilityId) {
216
- if (!facilityId) {
217
- return Promise.reject(new Error('A facilityId is required for getting field categories by facility.'));
218
- }
219
-
220
- return this._request.get(this._baseUrl + '/facilities/' + facilityId + '/categories').then(function (fieldCategories) {
221
- return (0, _objects.toCamelCase)(fieldCategories);
222
- });
1183
+ /**
1184
+ * Updates information about a field category
1185
+ *
1186
+ * API Endpoint: '/categories/:categoryId'
1187
+ * Method: PUT
1188
+ *
1189
+ * @param {String} categoryId The UUID of a field category
1190
+ * @param {Object} update
1191
+ * @param {string} [update.description]
1192
+ * @param {string} [update.name]
1193
+ * @param {string} [update.parentCategoryId]
1194
+ *
1195
+ * @returns {Promise}
1196
+ * @fulfill {FieldCategory} Information about the field category
1197
+ * @reject {Error}
1198
+ *
1199
+ * @example
1200
+ * contxtSdk.iot.fieldCategories
1201
+ * .update('b3dbaae3-25dd-475b-80dc-66296630a8d0', {
1202
+ * description: 'Power usage from all compressors in Room 2',
1203
+ * parentCategoryId: 'e9f8f89c-609c-4c83-8ebc-cea928af661e',
1204
+ * name: 'Room 2 Compressors'
1205
+ * })
1206
+ * .then((fieldCategory) => console.log(fieldCategory))
1207
+ * .catch((err) => console.log(err));
1208
+ */
1209
+ update(categoryId, update) {
1210
+ cov_23vzckr7l5().f[10]++;
1211
+ cov_23vzckr7l5().s[25]++;
1212
+ if (!categoryId) {
1213
+ cov_23vzckr7l5().b[4][0]++;
1214
+ cov_23vzckr7l5().s[26]++;
1215
+ return Promise.reject(new Error('A categoryId is required for updating information about a field category.'));
1216
+ } else {
1217
+ cov_23vzckr7l5().b[4][1]++;
223
1218
  }
224
-
225
- /**
226
- * Updates information about a field category
227
- *
228
- * API Endpoint: '/categories/:categoryId'
229
- * Method: PUT
230
- *
231
- * @param {String} categoryId The UUID of a field category
232
- * @param {Object} update
233
- * @param {string} [update.description]
234
- * @param {string} [update.name]
235
- * @param {string} [update.parentCategoryId]
236
- *
237
- * @returns {Promise}
238
- * @fulfill {FieldCategory} Information about the field category
239
- * @reject {Error}
240
- *
241
- * @example
242
- * contxtSdk.iot.fieldCategories
243
- * .update('b3dbaae3-25dd-475b-80dc-66296630a8d0', {
244
- * description: 'Power usage from all compressors in Room 2',
245
- * parentCategoryId: 'e9f8f89c-609c-4c83-8ebc-cea928af661e',
246
- * name: 'Room 2 Compressors'
247
- * })
248
- * .then((fieldCategory) => console.log(fieldCategory))
249
- * .catch((err) => console.log(err));
250
- */
251
-
252
- }, {
253
- key: 'update',
254
- value: function update(categoryId, _update) {
255
- if (!categoryId) {
256
- return Promise.reject(new Error('A categoryId is required for updating information about a field category.'));
257
- }
258
-
259
- if (!_update) {
260
- return Promise.reject(new Error('An update is required to update a field category'));
261
- }
262
-
263
- if (!(0, _lodash2.default)(_update)) {
264
- return Promise.reject(new Error('The field category update must be a well-formed object with the data you wish to update.'));
265
- }
266
-
267
- var formattedUpdate = (0, _objects.toSnakeCase)(_update, {
268
- excludeKeys: ['id', 'organizationId']
269
- });
270
-
271
- return this._request.put(this._baseUrl + '/categories/' + categoryId, formattedUpdate).then(function (fieldCategory) {
272
- return (0, _objects.toCamelCase)(fieldCategory);
273
- });
1219
+ cov_23vzckr7l5().s[27]++;
1220
+ if (!update) {
1221
+ cov_23vzckr7l5().b[5][0]++;
1222
+ cov_23vzckr7l5().s[28]++;
1223
+ return Promise.reject(new Error('An update is required to update a field category'));
1224
+ } else {
1225
+ cov_23vzckr7l5().b[5][1]++;
274
1226
  }
275
- }]);
276
-
277
- return FieldCategories;
278
- }();
279
-
280
- exports.default = FieldCategories;
1227
+ cov_23vzckr7l5().s[29]++;
1228
+ if (!(0, _lodash.default)(update)) {
1229
+ cov_23vzckr7l5().b[6][0]++;
1230
+ cov_23vzckr7l5().s[30]++;
1231
+ return Promise.reject(new Error('The field category update must be a well-formed object with the data you wish to update.'));
1232
+ } else {
1233
+ cov_23vzckr7l5().b[6][1]++;
1234
+ }
1235
+ const formattedUpdate = (cov_23vzckr7l5().s[31]++, _objects.default.toSnakeCase(update, {
1236
+ excludeKeys: ['id', 'organizationId']
1237
+ }));
1238
+ cov_23vzckr7l5().s[32]++;
1239
+ return this._request.put(`${this._baseUrl}/categories/${categoryId}`, formattedUpdate).then(fieldCategory => {
1240
+ cov_23vzckr7l5().f[11]++;
1241
+ cov_23vzckr7l5().s[33]++;
1242
+ return _objects.default.toCamelCase(fieldCategory);
1243
+ });
1244
+ }
1245
+ }
1246
+ var _default = exports.default = FieldCategories;
281
1247
  //# sourceMappingURL=fieldCategories.js.map