@ndustrial/contxt-sdk 5.5.7 → 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 (230) hide show
  1. package/.nvmrc +1 -1
  2. package/eslint.config.mjs +44 -0
  3. package/esm/bus/channels.js +1883 -216
  4. package/esm/bus/channels.js.map +1 -1
  5. package/esm/bus/index.browser.js +218 -37
  6. package/esm/bus/index.browser.js.map +1 -1
  7. package/esm/bus/index.js +906 -94
  8. package/esm/bus/index.js.map +1 -1
  9. package/esm/bus/webSocketConnection.browser.js +86 -12
  10. package/esm/bus/webSocketConnection.browser.js.map +1 -1
  11. package/esm/bus/webSocketConnection.js +2464 -332
  12. package/esm/bus/webSocketConnection.js.map +1 -1
  13. package/esm/config/audiences.js +37 -1
  14. package/esm/config/audiences.js.map +1 -1
  15. package/esm/config/defaults.js +37 -1
  16. package/esm/config/defaults.js.map +1 -1
  17. package/esm/config/index.js +1622 -203
  18. package/esm/config/index.js.map +1 -1
  19. package/esm/coordinator/applications.js +1019 -172
  20. package/esm/coordinator/applications.js.map +1 -1
  21. package/esm/coordinator/consent.js +603 -76
  22. package/esm/coordinator/consent.js.map +1 -1
  23. package/esm/coordinator/edgeNodes.js +520 -40
  24. package/esm/coordinator/edgeNodes.js.map +1 -1
  25. package/esm/coordinator/index.js +811 -54
  26. package/esm/coordinator/index.js.map +1 -1
  27. package/esm/coordinator/organizations.js +533 -60
  28. package/esm/coordinator/organizations.js.map +1 -1
  29. package/esm/coordinator/permissions.js +914 -107
  30. package/esm/coordinator/permissions.js.map +1 -1
  31. package/esm/coordinator/roles.js +2146 -258
  32. package/esm/coordinator/roles.js.map +1 -1
  33. package/esm/coordinator/users.js +3393 -484
  34. package/esm/coordinator/users.js.map +1 -1
  35. package/esm/events/index.js +2301 -393
  36. package/esm/events/index.js.map +1 -1
  37. package/esm/files/index.js +2053 -410
  38. package/esm/files/index.js.map +1 -1
  39. package/esm/index.js +1002 -148
  40. package/esm/index.js.map +1 -1
  41. package/esm/iot/feedTypes.js +188 -25
  42. package/esm/iot/feedTypes.js.map +1 -1
  43. package/esm/iot/feeds.js +420 -59
  44. package/esm/iot/feeds.js.map +1 -1
  45. package/esm/iot/fieldCategories.js +1172 -195
  46. package/esm/iot/fieldCategories.js.map +1 -1
  47. package/esm/iot/fieldGroupings.js +1689 -255
  48. package/esm/iot/fieldGroupings.js.map +1 -1
  49. package/esm/iot/fields.js +254 -28
  50. package/esm/iot/fields.js.map +1 -1
  51. package/esm/iot/index.js +212 -34
  52. package/esm/iot/index.js.map +1 -1
  53. package/esm/iot/outputs.js +320 -31
  54. package/esm/iot/outputs.js.map +1 -1
  55. package/esm/nionic/index.js +1097 -97
  56. package/esm/nionic/index.js.map +1 -1
  57. package/esm/request.js +1313 -219
  58. package/esm/request.js.map +1 -1
  59. package/esm/sessionTypes/auth0WebAuth.js +3395 -409
  60. package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
  61. package/esm/sessionTypes/index.js +213 -22
  62. package/esm/sessionTypes/index.js.map +1 -1
  63. package/esm/sessionTypes/machineAuth.js +1314 -144
  64. package/esm/sessionTypes/machineAuth.js.map +1 -1
  65. package/esm/sessionTypes/passwordGrantAuth.js +1060 -145
  66. package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
  67. package/esm/utils/events/formatEventUpdateToServer.js +107 -4
  68. package/esm/utils/events/formatEventUpdateToServer.js.map +1 -1
  69. package/esm/utils/events/index.js +54 -2
  70. package/esm/utils/events/index.js.map +1 -1
  71. package/esm/utils/iot/formatOutputFieldDataFromServer.js +227 -14
  72. package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  73. package/esm/utils/iot/index.js +56 -3
  74. package/esm/utils/iot/index.js.map +1 -1
  75. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +207 -7
  76. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  77. package/esm/utils/objects/createCaseChangeFn.js +449 -18
  78. package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
  79. package/esm/utils/objects/index.js +56 -3
  80. package/esm/utils/objects/index.js.map +1 -1
  81. package/esm/utils/objects/map.js +520 -26
  82. package/esm/utils/objects/map.js.map +1 -1
  83. package/esm/utils/objects/toCamelCase.js +39 -3
  84. package/esm/utils/objects/toCamelCase.js.map +1 -1
  85. package/esm/utils/objects/toSnakeCase.js +39 -3
  86. package/esm/utils/objects/toSnakeCase.js.map +1 -1
  87. package/esm/utils/pagination/formatPaginatedDataFromServer.js +268 -11
  88. package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  89. package/esm/utils/pagination/index.js +54 -2
  90. package/esm/utils/pagination/index.js.map +1 -1
  91. package/esm/utils/url/index.js +47 -2
  92. package/esm/utils/url/index.js.map +1 -1
  93. package/esm/utils/url/stringifyParams.js +176 -10
  94. package/esm/utils/url/stringifyParams.js.map +1 -1
  95. package/lib/bus/channels.js +1880 -223
  96. package/lib/bus/channels.js.map +1 -1
  97. package/lib/bus/index.browser.js +215 -43
  98. package/lib/bus/index.browser.js.map +1 -1
  99. package/lib/bus/index.js +903 -106
  100. package/lib/bus/index.js.map +1 -1
  101. package/lib/bus/webSocketConnection.browser.js +83 -15
  102. package/lib/bus/webSocketConnection.browser.js.map +1 -1
  103. package/lib/bus/webSocketConnection.js +2461 -339
  104. package/lib/bus/webSocketConnection.js.map +1 -1
  105. package/lib/config/audiences.js +33 -2
  106. package/lib/config/audiences.js.map +1 -1
  107. package/lib/config/defaults.js +33 -2
  108. package/lib/config/defaults.js.map +1 -1
  109. package/lib/config/index.js +1619 -212
  110. package/lib/config/index.js.map +1 -1
  111. package/lib/coordinator/applications.js +1016 -174
  112. package/lib/coordinator/applications.js.map +1 -1
  113. package/lib/coordinator/consent.js +600 -78
  114. package/lib/coordinator/consent.js.map +1 -1
  115. package/lib/coordinator/edgeNodes.js +517 -42
  116. package/lib/coordinator/edgeNodes.js.map +1 -1
  117. package/lib/coordinator/index.js +808 -78
  118. package/lib/coordinator/index.js.map +1 -1
  119. package/lib/coordinator/organizations.js +530 -62
  120. package/lib/coordinator/organizations.js.map +1 -1
  121. package/lib/coordinator/permissions.js +911 -109
  122. package/lib/coordinator/permissions.js.map +1 -1
  123. package/lib/coordinator/roles.js +2143 -260
  124. package/lib/coordinator/roles.js.map +1 -1
  125. package/lib/coordinator/users.js +3389 -489
  126. package/lib/coordinator/users.js.map +1 -1
  127. package/lib/events/index.js +2297 -404
  128. package/lib/events/index.js.map +1 -1
  129. package/lib/files/index.js +2050 -418
  130. package/lib/files/index.js.map +1 -1
  131. package/lib/index.js +999 -183
  132. package/lib/index.js.map +1 -1
  133. package/lib/iot/feedTypes.js +185 -27
  134. package/lib/iot/feedTypes.js.map +1 -1
  135. package/lib/iot/feeds.js +417 -61
  136. package/lib/iot/feeds.js.map +1 -1
  137. package/lib/iot/fieldCategories.js +1169 -203
  138. package/lib/iot/fieldCategories.js.map +1 -1
  139. package/lib/iot/fieldGroupings.js +1686 -263
  140. package/lib/iot/fieldGroupings.js.map +1 -1
  141. package/lib/iot/fields.js +251 -30
  142. package/lib/iot/fields.js.map +1 -1
  143. package/lib/iot/index.js +209 -55
  144. package/lib/iot/index.js.map +1 -1
  145. package/lib/iot/outputs.js +317 -34
  146. package/lib/iot/outputs.js.map +1 -1
  147. package/lib/nionic/index.js +1094 -98
  148. package/lib/nionic/index.js.map +1 -1
  149. package/lib/request.js +1310 -226
  150. package/lib/request.js.map +1 -1
  151. package/lib/sessionTypes/auth0WebAuth.js +3391 -421
  152. package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
  153. package/lib/sessionTypes/index.js +209 -26
  154. package/lib/sessionTypes/index.js.map +1 -1
  155. package/lib/sessionTypes/machineAuth.js +1311 -151
  156. package/lib/sessionTypes/machineAuth.js.map +1 -1
  157. package/lib/sessionTypes/passwordGrantAuth.js +1057 -156
  158. package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
  159. package/lib/utils/events/formatEventUpdateToServer.js +102 -4
  160. package/lib/utils/events/formatEventUpdateToServer.js.map +1 -1
  161. package/lib/utils/events/index.js +51 -10
  162. package/lib/utils/events/index.js.map +1 -1
  163. package/lib/utils/iot/formatOutputFieldDataFromServer.js +224 -18
  164. package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  165. package/lib/utils/iot/index.js +53 -15
  166. package/lib/utils/iot/index.js.map +1 -1
  167. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +203 -13
  168. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  169. package/lib/utils/objects/createCaseChangeFn.js +446 -25
  170. package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
  171. package/lib/utils/objects/index.js +53 -15
  172. package/lib/utils/objects/index.js.map +1 -1
  173. package/lib/utils/objects/map.js +517 -33
  174. package/lib/utils/objects/map.js.map +1 -1
  175. package/lib/utils/objects/toCamelCase.js +36 -11
  176. package/lib/utils/objects/toCamelCase.js.map +1 -1
  177. package/lib/utils/objects/toSnakeCase.js +36 -11
  178. package/lib/utils/objects/toSnakeCase.js.map +1 -1
  179. package/lib/utils/pagination/formatPaginatedDataFromServer.js +265 -14
  180. package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  181. package/lib/utils/pagination/index.js +51 -10
  182. package/lib/utils/pagination/index.js.map +1 -1
  183. package/lib/utils/url/index.js +44 -7
  184. package/lib/utils/url/index.js.map +1 -1
  185. package/lib/utils/url/stringifyParams.js +172 -18
  186. package/lib/utils/url/stringifyParams.js.map +1 -1
  187. package/package.json +31 -35
  188. package/src/bus/channels.js +6 -6
  189. package/src/bus/channels.spec.js +1 -1
  190. package/src/coordinator/applications.js +7 -7
  191. package/src/coordinator/applications.spec.js +1 -1
  192. package/src/coordinator/consent.js +3 -3
  193. package/src/coordinator/edgeNodes.js +3 -3
  194. package/src/coordinator/edgeNodes.spec.js +1 -1
  195. package/src/coordinator/organizations.js +4 -4
  196. package/src/coordinator/organizations.spec.js +1 -1
  197. package/src/coordinator/permissions.js +6 -6
  198. package/src/coordinator/permissions.spec.js +1 -1
  199. package/src/coordinator/roles.js +9 -9
  200. package/src/coordinator/roles.spec.js +1 -1
  201. package/src/coordinator/users.js +12 -12
  202. package/src/coordinator/users.spec.js +1 -1
  203. package/src/events/index.js +18 -18
  204. package/src/events/index.spec.js +3 -3
  205. package/src/files/index.js +9 -9
  206. package/src/files/index.spec.js +2 -2
  207. package/src/index.js +3 -1
  208. package/src/iot/feedTypes.js +2 -2
  209. package/src/iot/feeds.js +4 -4
  210. package/src/iot/feeds.spec.js +1 -1
  211. package/src/iot/fieldCategories.js +10 -10
  212. package/src/iot/fieldCategories.spec.js +2 -2
  213. package/src/iot/fieldGroupings.js +10 -10
  214. package/src/iot/fieldGroupings.spec.js +2 -2
  215. package/src/iot/fields.js +2 -2
  216. package/src/iot/fields.spec.js +1 -1
  217. package/src/iot/outputs.js +2 -2
  218. package/src/iot/outputs.spec.js +1 -1
  219. package/src/sessionTypes/auth0WebAuth.spec.js +1 -1
  220. package/src/utils/events/index.js +2 -1
  221. package/src/utils/iot/formatOutputFieldDataFromServer.js +5 -5
  222. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +2 -2
  223. package/src/utils/iot/index.js +2 -1
  224. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +3 -1
  225. package/src/utils/objects/index.js +2 -1
  226. package/src/utils/pagination/formatPaginatedDataFromServer.js +3 -3
  227. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +1 -1
  228. package/src/utils/pagination/index.js +2 -1
  229. package/support/mocharc.yml +1 -1
  230. package/.eslintrc +0 -24
@@ -1,11 +1,962 @@
1
- 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; }; }();
2
-
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- import isPlainObject from 'lodash.isplainobject';
6
- import { toCamelCase, toSnakeCase } from '../utils/objects';
7
- import { formatPaginatedDataFromServer } from '../utils/pagination';
1
+ "use strict";
8
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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();
9
960
  /**
10
961
  * @typedef {Object} FieldCategory
11
962
  * @property {String} description
@@ -28,8 +979,7 @@ import { formatPaginatedDataFromServer } from '../utils/pagination';
28
979
  *
29
980
  * @typicalname contxtSdk.iot.fieldCategories
30
981
  */
31
-
32
- var FieldCategories = function () {
982
+ class FieldCategories {
33
983
  /**
34
984
  * @param {Object} sdk An instance of the SDK so the module can communicate
35
985
  * with other modules
@@ -37,11 +987,13 @@ var FieldCategories = function () {
37
987
  * module's audience
38
988
  * @param {string} baseUrl The base URL provided by the parent module
39
989
  */
40
- function FieldCategories(sdk, request, baseUrl) {
41
- _classCallCheck(this, FieldCategories);
42
-
990
+ constructor(sdk, request, baseUrl) {
991
+ cov_23vzckr7l5().f[0]++;
992
+ cov_23vzckr7l5().s[0]++;
43
993
  this._baseUrl = baseUrl;
994
+ cov_23vzckr7l5().s[1]++;
44
995
  this._request = request;
996
+ cov_23vzckr7l5().s[2]++;
45
997
  this._sdk = sdk;
46
998
  }
47
999
 
@@ -72,199 +1024,224 @@ var FieldCategories = function () {
72
1024
  * .then((fieldCategory) => console.log(fieldCategory))
73
1025
  * .catch((err) => console.log(err));
74
1026
  */
75
-
76
-
77
- _createClass(FieldCategories, [{
78
- key: 'create',
79
- value: function create(fieldCategory) {
80
- var requiredFields = ['name', 'description', 'organizationId'];
81
-
82
- for (var i = 0; requiredFields.length > i; i++) {
83
- var field = requiredFields[i];
84
- if (!fieldCategory[field]) {
85
- return Promise.reject(new Error('A ' + field + ' is required to create a new field category.'));
86
- }
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]++;
87
1040
  }
88
-
89
- var formattedCategory = toSnakeCase(fieldCategory);
90
-
91
- return this._request.post(this._baseUrl + '/categories', formattedCategory).then(function (fieldCategory) {
92
- return toCamelCase(fieldCategory);
93
- });
94
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
+ }
95
1050
 
96
- /**
97
- * Deletes a field category
98
- *
99
- * API Endpoint: '/categories/:categoryId'
100
- * Method: DELETE
101
- *
102
- * @param {String} categoryId The UUID of a field category
103
- *
104
- * @returns {Promise}
105
- * @fulfill {undefined}
106
- * @reject {Error}
107
- *
108
- * @example
109
- * contxtSdk.iot.fieldCategories
110
- * .delete('b3dbaae3-25dd-475b-80dc-66296630a8d0');
111
- */
112
-
113
- }, {
114
- key: 'delete',
115
- value: function _delete(categoryId) {
116
- if (!categoryId) {
117
- return Promise.reject(new Error('A categoryId is required for deleting a field category.'));
118
- }
119
-
120
- 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]++;
121
1076
  }
1077
+ cov_23vzckr7l5().s[14]++;
1078
+ return this._request.delete(`${this._baseUrl}/categories/${categoryId}`);
1079
+ }
122
1080
 
123
- /**
124
- * Gets information about a field category
125
- *
126
- * API Endpoint: '/categories/:categoryId'
127
- * Method: GET
128
- *
129
- * @param {String} categoryId The UUID of a field category
130
- *
131
- * @returns {Promise}
132
- * @fulfill {FieldCategory} Information about the field category
133
- * @reject {Error}
134
- *
135
- * @example
136
- * contxtSdk.iot.fieldCategories
137
- * .get('b3dbaae3-25dd-475b-80dc-66296630a8d0')
138
- * .then((fieldCategory) => console.log(fieldCategory))
139
- * .catch((err) => console.log(err));
140
- */
141
-
142
- }, {
143
- key: 'get',
144
- value: function get(categoryId) {
145
- if (!categoryId) {
146
- return Promise.reject(new Error('A categoryId is required for getting information about a field category.'));
147
- }
148
-
149
- return this._request.get(this._baseUrl + '/categories/' + categoryId).then(function (fieldCategory) {
150
- return toCamelCase(fieldCategory);
151
- });
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]++;
152
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
+ }
153
1116
 
154
- /**
155
- * Get a listing of all field categories available to the user.
156
- *
157
- * API Endpoint: '/categories'
158
- * Method: GET
159
- *
160
- * @param {PaginationOptions} [paginationOptions]
161
- *
162
- * @returns {Promise}
163
- * @fulfill {FieldCategoriesFromServer} Information about the field categories
164
- * @reject {Error}
165
- *
166
- * @example
167
- * contxtSdk.iot.fieldCategories
168
- * .getAll()
169
- * .then((fieldCategories) => console.log(fieldCategories))
170
- * .catch((err) => console.log(err));
171
- */
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
+ }
172
1146
 
173
- }, {
174
- key: 'getAll',
175
- value: function getAll(paginationOptions) {
176
- return this._request.get(this._baseUrl + '/categories', {
177
- params: toSnakeCase(paginationOptions)
178
- }).then(function (fieldCategories) {
179
- return formatPaginatedDataFromServer(fieldCategories);
180
- });
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]++;
181
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
+ }
182
1182
 
183
- /**
184
- * Get a listing of all field categories for a given facility ID.
185
- *
186
- * API Endpoint: '/facilities/:facilityId/categories'
187
- * Method: GET
188
- *
189
- * @param {String} facilityId
190
- *
191
- * @returns {Promise}
192
- * @fulfill {FieldCategory[]} Information about the field categories
193
- * @reject {Error}
194
- *
195
- * @example
196
- * contxtSdk.iot.fieldCategories
197
- * .getAllByFacility(187)
198
- * .then((fieldCategories) => console.log(fieldCategories))
199
- * .catch((err) => console.log(err));
200
- */
201
-
202
- }, {
203
- key: 'getAllByFacility',
204
- value: function getAllByFacility(facilityId) {
205
- if (!facilityId) {
206
- return Promise.reject(new Error('A facilityId is required for getting field categories by facility.'));
207
- }
208
-
209
- return this._request.get(this._baseUrl + '/facilities/' + facilityId + '/categories').then(function (fieldCategories) {
210
- return toCamelCase(fieldCategories);
211
- });
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]++;
212
1218
  }
213
-
214
- /**
215
- * Updates information about a field category
216
- *
217
- * API Endpoint: '/categories/:categoryId'
218
- * Method: PUT
219
- *
220
- * @param {String} categoryId The UUID of a field category
221
- * @param {Object} update
222
- * @param {string} [update.description]
223
- * @param {string} [update.name]
224
- * @param {string} [update.parentCategoryId]
225
- *
226
- * @returns {Promise}
227
- * @fulfill {FieldCategory} Information about the field category
228
- * @reject {Error}
229
- *
230
- * @example
231
- * contxtSdk.iot.fieldCategories
232
- * .update('b3dbaae3-25dd-475b-80dc-66296630a8d0', {
233
- * description: 'Power usage from all compressors in Room 2',
234
- * parentCategoryId: 'e9f8f89c-609c-4c83-8ebc-cea928af661e',
235
- * name: 'Room 2 Compressors'
236
- * })
237
- * .then((fieldCategory) => console.log(fieldCategory))
238
- * .catch((err) => console.log(err));
239
- */
240
-
241
- }, {
242
- key: 'update',
243
- value: function update(categoryId, _update) {
244
- if (!categoryId) {
245
- return Promise.reject(new Error('A categoryId is required for updating information about a field category.'));
246
- }
247
-
248
- if (!_update) {
249
- return Promise.reject(new Error('An update is required to update a field category'));
250
- }
251
-
252
- if (!isPlainObject(_update)) {
253
- return Promise.reject(new Error('The field category update must be a well-formed object with the data you wish to update.'));
254
- }
255
-
256
- var formattedUpdate = toSnakeCase(_update, {
257
- excludeKeys: ['id', 'organizationId']
258
- });
259
-
260
- return this._request.put(this._baseUrl + '/categories/' + categoryId, formattedUpdate).then(function (fieldCategory) {
261
- return toCamelCase(fieldCategory);
262
- });
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]++;
263
1226
  }
264
- }]);
265
-
266
- return FieldCategories;
267
- }();
268
-
269
- export 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;
270
1247
  //# sourceMappingURL=fieldCategories.js.map