@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,15 +1,1619 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- 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; }; }();
4
-
5
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
6
-
7
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
-
9
- import axios from 'axios';
10
- import { toCamelCase, toSnakeCase } from '../utils/objects';
11
- import { formatPaginatedDataFromServer } from '../utils/pagination';
1
+ "use strict";
12
2
 
3
+ require("core-js/modules/es.array.filter.js");
4
+ require("core-js/modules/es.array.includes.js");
5
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
6
+ require("core-js/modules/es.string.includes.js");
7
+ require("core-js/modules/esnext.iterator.constructor.js");
8
+ require("core-js/modules/esnext.iterator.filter.js");
9
+ require("core-js/modules/esnext.iterator.for-each.js");
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ exports.default = void 0;
14
+ require("core-js/modules/es.promise.js");
15
+ var _axios = _interopRequireDefault(require("axios"));
16
+ var _objects = _interopRequireDefault(require("../utils/objects"));
17
+ var _pagination = _interopRequireDefault(require("../utils/pagination"));
18
+ const _excluded = ["upload_info"],
19
+ _excluded2 = ["uploadInfo"];
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ function cov_2kycc8t3qm() {
22
+ var path = "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/files/index.js";
23
+ var hash = "6b5dc7d16d01b744ae08e5ca21214cf16f726fac";
24
+ var global = new Function("return this")();
25
+ var gcv = "__coverage__";
26
+ var coverageData = {
27
+ path: "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/files/index.js",
28
+ statementMap: {
29
+ "0": {
30
+ start: {
31
+ line: 97,
32
+ column: 20
33
+ },
34
+ end: {
35
+ line: 97,
36
+ column: 59
37
+ }
38
+ },
39
+ "1": {
40
+ start: {
41
+ line: 99,
42
+ column: 4
43
+ },
44
+ end: {
45
+ line: 99,
46
+ column: 28
47
+ }
48
+ },
49
+ "2": {
50
+ start: {
51
+ line: 100,
52
+ column: 4
53
+ },
54
+ end: {
55
+ line: 100,
56
+ column: 28
57
+ }
58
+ },
59
+ "3": {
60
+ start: {
61
+ line: 101,
62
+ column: 4
63
+ },
64
+ end: {
65
+ line: 101,
66
+ column: 20
67
+ }
68
+ },
69
+ "4": {
70
+ start: {
71
+ line: 134,
72
+ column: 27
73
+ },
74
+ end: {
75
+ line: 134,
76
+ column: 72
77
+ }
78
+ },
79
+ "5": {
80
+ start: {
81
+ line: 136,
82
+ column: 4
83
+ },
84
+ end: {
85
+ line: 142,
86
+ column: 5
87
+ }
88
+ },
89
+ "6": {
90
+ start: {
91
+ line: 136,
92
+ column: 17
93
+ },
94
+ end: {
95
+ line: 136,
96
+ column: 18
97
+ }
98
+ },
99
+ "7": {
100
+ start: {
101
+ line: 137,
102
+ column: 6
103
+ },
104
+ end: {
105
+ line: 141,
106
+ column: 7
107
+ }
108
+ },
109
+ "8": {
110
+ start: {
111
+ line: 138,
112
+ column: 8
113
+ },
114
+ end: {
115
+ line: 140,
116
+ column: 10
117
+ }
118
+ },
119
+ "9": {
120
+ start: {
121
+ line: 144,
122
+ column: 4
123
+ },
124
+ end: {
125
+ line: 154,
126
+ column: 9
127
+ }
128
+ },
129
+ "10": {
130
+ start: {
131
+ line: 147,
132
+ column: 8
133
+ },
134
+ end: {
135
+ line: 153,
136
+ column: 10
137
+ }
138
+ },
139
+ "11": {
140
+ start: {
141
+ line: 201,
142
+ column: 27
143
+ },
144
+ end: {
145
+ line: 201,
146
+ column: 47
147
+ }
148
+ },
149
+ "12": {
150
+ start: {
151
+ line: 203,
152
+ column: 4
153
+ },
154
+ end: {
155
+ line: 214,
156
+ column: 5
157
+ }
158
+ },
159
+ "13": {
160
+ start: {
161
+ line: 203,
162
+ column: 17
163
+ },
164
+ end: {
165
+ line: 203,
166
+ column: 18
167
+ }
168
+ },
169
+ "14": {
170
+ start: {
171
+ line: 204,
172
+ column: 6
173
+ },
174
+ end: {
175
+ line: 213,
176
+ column: 7
177
+ }
178
+ },
179
+ "15": {
180
+ start: {
181
+ line: 205,
182
+ column: 8
183
+ },
184
+ end: {
185
+ line: 212,
186
+ column: 10
187
+ }
188
+ },
189
+ "16": {
190
+ start: {
191
+ line: 216,
192
+ column: 31
193
+ },
194
+ end: {
195
+ line: 216,
196
+ column: 39
197
+ }
198
+ },
199
+ "17": {
200
+ start: {
201
+ line: 218,
202
+ column: 4
203
+ },
204
+ end: {
205
+ line: 269,
206
+ column: 9
207
+ }
208
+ },
209
+ "18": {
210
+ start: {
211
+ line: 220,
212
+ column: 8
213
+ },
214
+ end: {
215
+ line: 224,
216
+ column: 11
217
+ }
218
+ },
219
+ "19": {
220
+ start: {
221
+ line: 227,
222
+ column: 8
223
+ },
224
+ end: {
225
+ line: 268,
226
+ column: 13
227
+ }
228
+ },
229
+ "20": {
230
+ start: {
231
+ line: 229,
232
+ column: 12
233
+ },
234
+ end: {
235
+ line: 243,
236
+ column: 15
237
+ }
238
+ },
239
+ "21": {
240
+ start: {
241
+ line: 234,
242
+ column: 14
243
+ },
244
+ end: {
245
+ line: 234,
246
+ column: 51
247
+ }
248
+ },
249
+ "22": {
250
+ start: {
251
+ line: 236,
252
+ column: 14
253
+ },
254
+ end: {
255
+ line: 242,
256
+ column: 17
257
+ }
258
+ },
259
+ "23": {
260
+ start: {
261
+ line: 246,
262
+ column: 12
263
+ },
264
+ end: {
265
+ line: 256,
266
+ column: 14
267
+ }
268
+ },
269
+ "24": {
270
+ start: {
271
+ line: 248,
272
+ column: 16
273
+ },
274
+ end: {
275
+ line: 254,
276
+ column: 19
277
+ }
278
+ },
279
+ "25": {
280
+ start: {
281
+ line: 259,
282
+ column: 12
283
+ },
284
+ end: {
285
+ line: 267,
286
+ column: 15
287
+ }
288
+ },
289
+ "26": {
290
+ start: {
291
+ line: 260,
292
+ column: 14
293
+ },
294
+ end: {
295
+ line: 266,
296
+ column: 17
297
+ }
298
+ },
299
+ "27": {
300
+ start: {
301
+ line: 288,
302
+ column: 4
303
+ },
304
+ end: {
305
+ line: 292,
306
+ column: 5
307
+ }
308
+ },
309
+ "28": {
310
+ start: {
311
+ line: 289,
312
+ column: 6
313
+ },
314
+ end: {
315
+ line: 291,
316
+ column: 8
317
+ }
318
+ },
319
+ "29": {
320
+ start: {
321
+ line: 294,
322
+ column: 4
323
+ },
324
+ end: {
325
+ line: 294,
326
+ column: 68
327
+ }
328
+ },
329
+ "30": {
330
+ start: {
331
+ line: 316,
332
+ column: 4
333
+ },
334
+ end: {
335
+ line: 320,
336
+ column: 5
337
+ }
338
+ },
339
+ "31": {
340
+ start: {
341
+ line: 317,
342
+ column: 6
343
+ },
344
+ end: {
345
+ line: 319,
346
+ column: 8
347
+ }
348
+ },
349
+ "32": {
350
+ start: {
351
+ line: 322,
352
+ column: 4
353
+ },
354
+ end: {
355
+ line: 324,
356
+ column: 53
357
+ }
358
+ },
359
+ "33": {
360
+ start: {
361
+ line: 324,
362
+ column: 22
363
+ },
364
+ end: {
365
+ line: 324,
366
+ column: 51
367
+ }
368
+ },
369
+ "34": {
370
+ start: {
371
+ line: 346,
372
+ column: 4
373
+ },
374
+ end: {
375
+ line: 350,
376
+ column: 5
377
+ }
378
+ },
379
+ "35": {
380
+ start: {
381
+ line: 347,
382
+ column: 6
383
+ },
384
+ end: {
385
+ line: 349,
386
+ column: 8
387
+ }
388
+ },
389
+ "36": {
390
+ start: {
391
+ line: 352,
392
+ column: 4
393
+ },
394
+ end: {
395
+ line: 354,
396
+ column: 53
397
+ }
398
+ },
399
+ "37": {
400
+ start: {
401
+ line: 354,
402
+ column: 22
403
+ },
404
+ end: {
405
+ line: 354,
406
+ column: 51
407
+ }
408
+ },
409
+ "38": {
410
+ start: {
411
+ line: 382,
412
+ column: 4
413
+ },
414
+ end: {
415
+ line: 386,
416
+ column: 87
417
+ }
418
+ },
419
+ "39": {
420
+ start: {
421
+ line: 386,
422
+ column: 28
423
+ },
424
+ end: {
425
+ line: 386,
426
+ column: 85
427
+ }
428
+ },
429
+ "40": {
430
+ start: {
431
+ line: 407,
432
+ column: 4
433
+ },
434
+ end: {
435
+ line: 411,
436
+ column: 5
437
+ }
438
+ },
439
+ "41": {
440
+ start: {
441
+ line: 408,
442
+ column: 6
443
+ },
444
+ end: {
445
+ line: 410,
446
+ column: 8
447
+ }
448
+ },
449
+ "42": {
450
+ start: {
451
+ line: 413,
452
+ column: 4
453
+ },
454
+ end: {
455
+ line: 413,
456
+ column: 75
457
+ }
458
+ },
459
+ "43": {
460
+ start: {
461
+ line: 434,
462
+ column: 4
463
+ },
464
+ end: {
465
+ line: 438,
466
+ column: 5
467
+ }
468
+ },
469
+ "44": {
470
+ start: {
471
+ line: 435,
472
+ column: 6
473
+ },
474
+ end: {
475
+ line: 437,
476
+ column: 8
477
+ }
478
+ },
479
+ "45": {
480
+ start: {
481
+ line: 440,
482
+ column: 4
483
+ },
484
+ end: {
485
+ line: 440,
486
+ column: 73
487
+ }
488
+ },
489
+ "46": {
490
+ start: {
491
+ line: 479,
492
+ column: 27
493
+ },
494
+ end: {
495
+ line: 479,
496
+ column: 42
497
+ }
498
+ },
499
+ "47": {
500
+ start: {
501
+ line: 481,
502
+ column: 4
503
+ },
504
+ end: {
505
+ line: 487,
506
+ column: 5
507
+ }
508
+ },
509
+ "48": {
510
+ start: {
511
+ line: 481,
512
+ column: 17
513
+ },
514
+ end: {
515
+ line: 481,
516
+ column: 18
517
+ }
518
+ },
519
+ "49": {
520
+ start: {
521
+ line: 482,
522
+ column: 6
523
+ },
524
+ end: {
525
+ line: 486,
526
+ column: 7
527
+ }
528
+ },
529
+ "50": {
530
+ start: {
531
+ line: 483,
532
+ column: 8
533
+ },
534
+ end: {
535
+ line: 485,
536
+ column: 10
537
+ }
538
+ },
539
+ "51": {
540
+ start: {
541
+ line: 489,
542
+ column: 35
543
+ },
544
+ end: {
545
+ line: 489,
546
+ column: 43
547
+ }
548
+ },
549
+ "52": {
550
+ start: {
551
+ line: 491,
552
+ column: 4
553
+ },
554
+ end: {
555
+ line: 491,
556
+ column: 45
557
+ }
558
+ },
559
+ "53": {
560
+ start: {
561
+ line: 513,
562
+ column: 22
563
+ },
564
+ end: {
565
+ line: 513,
566
+ column: 24
567
+ }
568
+ },
569
+ "54": {
570
+ start: {
571
+ line: 514,
572
+ column: 21
573
+ },
574
+ end: {
575
+ line: 514,
576
+ column: 53
577
+ }
578
+ },
579
+ "55": {
580
+ start: {
581
+ line: 516,
582
+ column: 4
583
+ },
584
+ end: {
585
+ line: 518,
586
+ column: 5
587
+ }
588
+ },
589
+ "56": {
590
+ start: {
591
+ line: 517,
592
+ column: 6
593
+ },
594
+ end: {
595
+ line: 517,
596
+ column: 35
597
+ }
598
+ },
599
+ "57": {
600
+ start: {
601
+ line: 520,
602
+ column: 4
603
+ },
604
+ end: {
605
+ line: 524,
606
+ column: 7
607
+ }
608
+ }
609
+ },
610
+ fnMap: {
611
+ "0": {
612
+ name: "(anonymous_0)",
613
+ decl: {
614
+ start: {
615
+ line: 96,
616
+ column: 2
617
+ },
618
+ end: {
619
+ line: 96,
620
+ column: 3
621
+ }
622
+ },
623
+ loc: {
624
+ start: {
625
+ line: 96,
626
+ column: 28
627
+ },
628
+ end: {
629
+ line: 102,
630
+ column: 3
631
+ }
632
+ },
633
+ line: 96
634
+ },
635
+ "1": {
636
+ name: "(anonymous_1)",
637
+ decl: {
638
+ start: {
639
+ line: 133,
640
+ column: 2
641
+ },
642
+ end: {
643
+ line: 133,
644
+ column: 3
645
+ }
646
+ },
647
+ loc: {
648
+ start: {
649
+ line: 133,
650
+ column: 19
651
+ },
652
+ end: {
653
+ line: 155,
654
+ column: 3
655
+ }
656
+ },
657
+ line: 133
658
+ },
659
+ "2": {
660
+ name: "(anonymous_2)",
661
+ decl: {
662
+ start: {
663
+ line: 146,
664
+ column: 12
665
+ },
666
+ end: {
667
+ line: 146,
668
+ column: 13
669
+ }
670
+ },
671
+ loc: {
672
+ start: {
673
+ line: 146,
674
+ column: 49
675
+ },
676
+ end: {
677
+ line: 154,
678
+ column: 7
679
+ }
680
+ },
681
+ line: 146
682
+ },
683
+ "3": {
684
+ name: "(anonymous_3)",
685
+ decl: {
686
+ start: {
687
+ line: 200,
688
+ column: 2
689
+ },
690
+ end: {
691
+ line: 200,
692
+ column: 3
693
+ }
694
+ },
695
+ loc: {
696
+ start: {
697
+ line: 200,
698
+ column: 28
699
+ },
700
+ end: {
701
+ line: 270,
702
+ column: 3
703
+ }
704
+ },
705
+ line: 200
706
+ },
707
+ "4": {
708
+ name: "(anonymous_4)",
709
+ decl: {
710
+ start: {
711
+ line: 219,
712
+ column: 13
713
+ },
714
+ end: {
715
+ line: 219,
716
+ column: 14
717
+ }
718
+ },
719
+ loc: {
720
+ start: {
721
+ line: 219,
722
+ column: 32
723
+ },
724
+ end: {
725
+ line: 225,
726
+ column: 7
727
+ }
728
+ },
729
+ line: 219
730
+ },
731
+ "5": {
732
+ name: "(anonymous_5)",
733
+ decl: {
734
+ start: {
735
+ line: 226,
736
+ column: 12
737
+ },
738
+ end: {
739
+ line: 226,
740
+ column: 13
741
+ }
742
+ },
743
+ loc: {
744
+ start: {
745
+ line: 226,
746
+ column: 48
747
+ },
748
+ end: {
749
+ line: 269,
750
+ column: 7
751
+ }
752
+ },
753
+ line: 226
754
+ },
755
+ "6": {
756
+ name: "(anonymous_6)",
757
+ decl: {
758
+ start: {
759
+ line: 228,
760
+ column: 16
761
+ },
762
+ end: {
763
+ line: 228,
764
+ column: 17
765
+ }
766
+ },
767
+ loc: {
768
+ start: {
769
+ line: 228,
770
+ column: 22
771
+ },
772
+ end: {
773
+ line: 244,
774
+ column: 11
775
+ }
776
+ },
777
+ line: 228
778
+ },
779
+ "7": {
780
+ name: "(anonymous_7)",
781
+ decl: {
782
+ start: {
783
+ line: 233,
784
+ column: 21
785
+ },
786
+ end: {
787
+ line: 233,
788
+ column: 22
789
+ }
790
+ },
791
+ loc: {
792
+ start: {
793
+ line: 233,
794
+ column: 40
795
+ },
796
+ end: {
797
+ line: 243,
798
+ column: 13
799
+ }
800
+ },
801
+ line: 233
802
+ },
803
+ "8": {
804
+ name: "(anonymous_8)",
805
+ decl: {
806
+ start: {
807
+ line: 245,
808
+ column: 16
809
+ },
810
+ end: {
811
+ line: 245,
812
+ column: 17
813
+ }
814
+ },
815
+ loc: {
816
+ start: {
817
+ line: 245,
818
+ column: 22
819
+ },
820
+ end: {
821
+ line: 257,
822
+ column: 11
823
+ }
824
+ },
825
+ line: 245
826
+ },
827
+ "9": {
828
+ name: "(anonymous_9)",
829
+ decl: {
830
+ start: {
831
+ line: 247,
832
+ column: 14
833
+ },
834
+ end: {
835
+ line: 247,
836
+ column: 15
837
+ }
838
+ },
839
+ loc: {
840
+ start: {
841
+ line: 247,
842
+ column: 33
843
+ },
844
+ end: {
845
+ line: 255,
846
+ column: 15
847
+ }
848
+ },
849
+ line: 247
850
+ },
851
+ "10": {
852
+ name: "(anonymous_10)",
853
+ decl: {
854
+ start: {
855
+ line: 258,
856
+ column: 16
857
+ },
858
+ end: {
859
+ line: 258,
860
+ column: 17
861
+ }
862
+ },
863
+ loc: {
864
+ start: {
865
+ line: 258,
866
+ column: 22
867
+ },
868
+ end: {
869
+ line: 268,
870
+ column: 11
871
+ }
872
+ },
873
+ line: 258
874
+ },
875
+ "11": {
876
+ name: "(anonymous_11)",
877
+ decl: {
878
+ start: {
879
+ line: 259,
880
+ column: 50
881
+ },
882
+ end: {
883
+ line: 259,
884
+ column: 51
885
+ }
886
+ },
887
+ loc: {
888
+ start: {
889
+ line: 259,
890
+ column: 69
891
+ },
892
+ end: {
893
+ line: 267,
894
+ column: 13
895
+ }
896
+ },
897
+ line: 259
898
+ },
899
+ "12": {
900
+ name: "(anonymous_12)",
901
+ decl: {
902
+ start: {
903
+ line: 287,
904
+ column: 2
905
+ },
906
+ end: {
907
+ line: 287,
908
+ column: 3
909
+ }
910
+ },
911
+ loc: {
912
+ start: {
913
+ line: 287,
914
+ column: 17
915
+ },
916
+ end: {
917
+ line: 295,
918
+ column: 3
919
+ }
920
+ },
921
+ line: 287
922
+ },
923
+ "13": {
924
+ name: "(anonymous_13)",
925
+ decl: {
926
+ start: {
927
+ line: 315,
928
+ column: 2
929
+ },
930
+ end: {
931
+ line: 315,
932
+ column: 3
933
+ }
934
+ },
935
+ loc: {
936
+ start: {
937
+ line: 315,
938
+ column: 19
939
+ },
940
+ end: {
941
+ line: 325,
942
+ column: 3
943
+ }
944
+ },
945
+ line: 315
946
+ },
947
+ "14": {
948
+ name: "(anonymous_14)",
949
+ decl: {
950
+ start: {
951
+ line: 324,
952
+ column: 12
953
+ },
954
+ end: {
955
+ line: 324,
956
+ column: 13
957
+ }
958
+ },
959
+ loc: {
960
+ start: {
961
+ line: 324,
962
+ column: 22
963
+ },
964
+ end: {
965
+ line: 324,
966
+ column: 51
967
+ }
968
+ },
969
+ line: 324
970
+ },
971
+ "15": {
972
+ name: "(anonymous_15)",
973
+ decl: {
974
+ start: {
975
+ line: 345,
976
+ column: 2
977
+ },
978
+ end: {
979
+ line: 345,
980
+ column: 3
981
+ }
982
+ },
983
+ loc: {
984
+ start: {
985
+ line: 345,
986
+ column: 14
987
+ },
988
+ end: {
989
+ line: 355,
990
+ column: 3
991
+ }
992
+ },
993
+ line: 345
994
+ },
995
+ "16": {
996
+ name: "(anonymous_16)",
997
+ decl: {
998
+ start: {
999
+ line: 354,
1000
+ column: 12
1001
+ },
1002
+ end: {
1003
+ line: 354,
1004
+ column: 13
1005
+ }
1006
+ },
1007
+ loc: {
1008
+ start: {
1009
+ line: 354,
1010
+ column: 22
1011
+ },
1012
+ end: {
1013
+ line: 354,
1014
+ column: 51
1015
+ }
1016
+ },
1017
+ line: 354
1018
+ },
1019
+ "17": {
1020
+ name: "(anonymous_17)",
1021
+ decl: {
1022
+ start: {
1023
+ line: 381,
1024
+ column: 2
1025
+ },
1026
+ end: {
1027
+ line: 381,
1028
+ column: 3
1029
+ }
1030
+ },
1031
+ loc: {
1032
+ start: {
1033
+ line: 381,
1034
+ column: 23
1035
+ },
1036
+ end: {
1037
+ line: 387,
1038
+ column: 3
1039
+ }
1040
+ },
1041
+ line: 381
1042
+ },
1043
+ "18": {
1044
+ name: "(anonymous_18)",
1045
+ decl: {
1046
+ start: {
1047
+ line: 386,
1048
+ column: 12
1049
+ },
1050
+ end: {
1051
+ line: 386,
1052
+ column: 13
1053
+ }
1054
+ },
1055
+ loc: {
1056
+ start: {
1057
+ line: 386,
1058
+ column: 28
1059
+ },
1060
+ end: {
1061
+ line: 386,
1062
+ column: 85
1063
+ }
1064
+ },
1065
+ line: 386
1066
+ },
1067
+ "19": {
1068
+ name: "(anonymous_19)",
1069
+ decl: {
1070
+ start: {
1071
+ line: 406,
1072
+ column: 2
1073
+ },
1074
+ end: {
1075
+ line: 406,
1076
+ column: 3
1077
+ }
1078
+ },
1079
+ loc: {
1080
+ start: {
1081
+ line: 406,
1082
+ column: 28
1083
+ },
1084
+ end: {
1085
+ line: 414,
1086
+ column: 3
1087
+ }
1088
+ },
1089
+ line: 406
1090
+ },
1091
+ "20": {
1092
+ name: "(anonymous_20)",
1093
+ decl: {
1094
+ start: {
1095
+ line: 433,
1096
+ column: 2
1097
+ },
1098
+ end: {
1099
+ line: 433,
1100
+ column: 3
1101
+ }
1102
+ },
1103
+ loc: {
1104
+ start: {
1105
+ line: 433,
1106
+ column: 26
1107
+ },
1108
+ end: {
1109
+ line: 441,
1110
+ column: 3
1111
+ }
1112
+ },
1113
+ line: 433
1114
+ },
1115
+ "21": {
1116
+ name: "(anonymous_21)",
1117
+ decl: {
1118
+ start: {
1119
+ line: 478,
1120
+ column: 2
1121
+ },
1122
+ end: {
1123
+ line: 478,
1124
+ column: 3
1125
+ }
1126
+ },
1127
+ loc: {
1128
+ start: {
1129
+ line: 478,
1130
+ column: 19
1131
+ },
1132
+ end: {
1133
+ line: 492,
1134
+ column: 3
1135
+ }
1136
+ },
1137
+ line: 478
1138
+ },
1139
+ "22": {
1140
+ name: "(anonymous_22)",
1141
+ decl: {
1142
+ start: {
1143
+ line: 512,
1144
+ column: 2
1145
+ },
1146
+ end: {
1147
+ line: 512,
1148
+ column: 3
1149
+ }
1150
+ },
1151
+ loc: {
1152
+ start: {
1153
+ line: 512,
1154
+ column: 65
1155
+ },
1156
+ end: {
1157
+ line: 525,
1158
+ column: 3
1159
+ }
1160
+ },
1161
+ line: 512
1162
+ }
1163
+ },
1164
+ branchMap: {
1165
+ "0": {
1166
+ loc: {
1167
+ start: {
1168
+ line: 137,
1169
+ column: 6
1170
+ },
1171
+ end: {
1172
+ line: 141,
1173
+ column: 7
1174
+ }
1175
+ },
1176
+ type: "if",
1177
+ locations: [{
1178
+ start: {
1179
+ line: 137,
1180
+ column: 6
1181
+ },
1182
+ end: {
1183
+ line: 141,
1184
+ column: 7
1185
+ }
1186
+ }, {
1187
+ start: {
1188
+ line: undefined,
1189
+ column: undefined
1190
+ },
1191
+ end: {
1192
+ line: undefined,
1193
+ column: undefined
1194
+ }
1195
+ }],
1196
+ line: 137
1197
+ },
1198
+ "1": {
1199
+ loc: {
1200
+ start: {
1201
+ line: 204,
1202
+ column: 6
1203
+ },
1204
+ end: {
1205
+ line: 213,
1206
+ column: 7
1207
+ }
1208
+ },
1209
+ type: "if",
1210
+ locations: [{
1211
+ start: {
1212
+ line: 204,
1213
+ column: 6
1214
+ },
1215
+ end: {
1216
+ line: 213,
1217
+ column: 7
1218
+ }
1219
+ }, {
1220
+ start: {
1221
+ line: undefined,
1222
+ column: undefined
1223
+ },
1224
+ end: {
1225
+ line: undefined,
1226
+ column: undefined
1227
+ }
1228
+ }],
1229
+ line: 204
1230
+ },
1231
+ "2": {
1232
+ loc: {
1233
+ start: {
1234
+ line: 288,
1235
+ column: 4
1236
+ },
1237
+ end: {
1238
+ line: 292,
1239
+ column: 5
1240
+ }
1241
+ },
1242
+ type: "if",
1243
+ locations: [{
1244
+ start: {
1245
+ line: 288,
1246
+ column: 4
1247
+ },
1248
+ end: {
1249
+ line: 292,
1250
+ column: 5
1251
+ }
1252
+ }, {
1253
+ start: {
1254
+ line: undefined,
1255
+ column: undefined
1256
+ },
1257
+ end: {
1258
+ line: undefined,
1259
+ column: undefined
1260
+ }
1261
+ }],
1262
+ line: 288
1263
+ },
1264
+ "3": {
1265
+ loc: {
1266
+ start: {
1267
+ line: 316,
1268
+ column: 4
1269
+ },
1270
+ end: {
1271
+ line: 320,
1272
+ column: 5
1273
+ }
1274
+ },
1275
+ type: "if",
1276
+ locations: [{
1277
+ start: {
1278
+ line: 316,
1279
+ column: 4
1280
+ },
1281
+ end: {
1282
+ line: 320,
1283
+ column: 5
1284
+ }
1285
+ }, {
1286
+ start: {
1287
+ line: undefined,
1288
+ column: undefined
1289
+ },
1290
+ end: {
1291
+ line: undefined,
1292
+ column: undefined
1293
+ }
1294
+ }],
1295
+ line: 316
1296
+ },
1297
+ "4": {
1298
+ loc: {
1299
+ start: {
1300
+ line: 346,
1301
+ column: 4
1302
+ },
1303
+ end: {
1304
+ line: 350,
1305
+ column: 5
1306
+ }
1307
+ },
1308
+ type: "if",
1309
+ locations: [{
1310
+ start: {
1311
+ line: 346,
1312
+ column: 4
1313
+ },
1314
+ end: {
1315
+ line: 350,
1316
+ column: 5
1317
+ }
1318
+ }, {
1319
+ start: {
1320
+ line: undefined,
1321
+ column: undefined
1322
+ },
1323
+ end: {
1324
+ line: undefined,
1325
+ column: undefined
1326
+ }
1327
+ }],
1328
+ line: 346
1329
+ },
1330
+ "5": {
1331
+ loc: {
1332
+ start: {
1333
+ line: 407,
1334
+ column: 4
1335
+ },
1336
+ end: {
1337
+ line: 411,
1338
+ column: 5
1339
+ }
1340
+ },
1341
+ type: "if",
1342
+ locations: [{
1343
+ start: {
1344
+ line: 407,
1345
+ column: 4
1346
+ },
1347
+ end: {
1348
+ line: 411,
1349
+ column: 5
1350
+ }
1351
+ }, {
1352
+ start: {
1353
+ line: undefined,
1354
+ column: undefined
1355
+ },
1356
+ end: {
1357
+ line: undefined,
1358
+ column: undefined
1359
+ }
1360
+ }],
1361
+ line: 407
1362
+ },
1363
+ "6": {
1364
+ loc: {
1365
+ start: {
1366
+ line: 434,
1367
+ column: 4
1368
+ },
1369
+ end: {
1370
+ line: 438,
1371
+ column: 5
1372
+ }
1373
+ },
1374
+ type: "if",
1375
+ locations: [{
1376
+ start: {
1377
+ line: 434,
1378
+ column: 4
1379
+ },
1380
+ end: {
1381
+ line: 438,
1382
+ column: 5
1383
+ }
1384
+ }, {
1385
+ start: {
1386
+ line: undefined,
1387
+ column: undefined
1388
+ },
1389
+ end: {
1390
+ line: undefined,
1391
+ column: undefined
1392
+ }
1393
+ }],
1394
+ line: 434
1395
+ },
1396
+ "7": {
1397
+ loc: {
1398
+ start: {
1399
+ line: 482,
1400
+ column: 6
1401
+ },
1402
+ end: {
1403
+ line: 486,
1404
+ column: 7
1405
+ }
1406
+ },
1407
+ type: "if",
1408
+ locations: [{
1409
+ start: {
1410
+ line: 482,
1411
+ column: 6
1412
+ },
1413
+ end: {
1414
+ line: 486,
1415
+ column: 7
1416
+ }
1417
+ }, {
1418
+ start: {
1419
+ line: undefined,
1420
+ column: undefined
1421
+ },
1422
+ end: {
1423
+ line: undefined,
1424
+ column: undefined
1425
+ }
1426
+ }],
1427
+ line: 482
1428
+ },
1429
+ "8": {
1430
+ loc: {
1431
+ start: {
1432
+ line: 514,
1433
+ column: 21
1434
+ },
1435
+ end: {
1436
+ line: 514,
1437
+ column: 53
1438
+ }
1439
+ },
1440
+ type: "binary-expr",
1441
+ locations: [{
1442
+ start: {
1443
+ line: 514,
1444
+ column: 21
1445
+ },
1446
+ end: {
1447
+ line: 514,
1448
+ column: 28
1449
+ }
1450
+ }, {
1451
+ start: {
1452
+ line: 514,
1453
+ column: 32
1454
+ },
1455
+ end: {
1456
+ line: 514,
1457
+ column: 53
1458
+ }
1459
+ }],
1460
+ line: 514
1461
+ },
1462
+ "9": {
1463
+ loc: {
1464
+ start: {
1465
+ line: 516,
1466
+ column: 4
1467
+ },
1468
+ end: {
1469
+ line: 518,
1470
+ column: 5
1471
+ }
1472
+ },
1473
+ type: "if",
1474
+ locations: [{
1475
+ start: {
1476
+ line: 516,
1477
+ column: 4
1478
+ },
1479
+ end: {
1480
+ line: 518,
1481
+ column: 5
1482
+ }
1483
+ }, {
1484
+ start: {
1485
+ line: undefined,
1486
+ column: undefined
1487
+ },
1488
+ end: {
1489
+ line: undefined,
1490
+ column: undefined
1491
+ }
1492
+ }],
1493
+ line: 516
1494
+ }
1495
+ },
1496
+ s: {
1497
+ "0": 0,
1498
+ "1": 0,
1499
+ "2": 0,
1500
+ "3": 0,
1501
+ "4": 0,
1502
+ "5": 0,
1503
+ "6": 0,
1504
+ "7": 0,
1505
+ "8": 0,
1506
+ "9": 0,
1507
+ "10": 0,
1508
+ "11": 0,
1509
+ "12": 0,
1510
+ "13": 0,
1511
+ "14": 0,
1512
+ "15": 0,
1513
+ "16": 0,
1514
+ "17": 0,
1515
+ "18": 0,
1516
+ "19": 0,
1517
+ "20": 0,
1518
+ "21": 0,
1519
+ "22": 0,
1520
+ "23": 0,
1521
+ "24": 0,
1522
+ "25": 0,
1523
+ "26": 0,
1524
+ "27": 0,
1525
+ "28": 0,
1526
+ "29": 0,
1527
+ "30": 0,
1528
+ "31": 0,
1529
+ "32": 0,
1530
+ "33": 0,
1531
+ "34": 0,
1532
+ "35": 0,
1533
+ "36": 0,
1534
+ "37": 0,
1535
+ "38": 0,
1536
+ "39": 0,
1537
+ "40": 0,
1538
+ "41": 0,
1539
+ "42": 0,
1540
+ "43": 0,
1541
+ "44": 0,
1542
+ "45": 0,
1543
+ "46": 0,
1544
+ "47": 0,
1545
+ "48": 0,
1546
+ "49": 0,
1547
+ "50": 0,
1548
+ "51": 0,
1549
+ "52": 0,
1550
+ "53": 0,
1551
+ "54": 0,
1552
+ "55": 0,
1553
+ "56": 0,
1554
+ "57": 0
1555
+ },
1556
+ f: {
1557
+ "0": 0,
1558
+ "1": 0,
1559
+ "2": 0,
1560
+ "3": 0,
1561
+ "4": 0,
1562
+ "5": 0,
1563
+ "6": 0,
1564
+ "7": 0,
1565
+ "8": 0,
1566
+ "9": 0,
1567
+ "10": 0,
1568
+ "11": 0,
1569
+ "12": 0,
1570
+ "13": 0,
1571
+ "14": 0,
1572
+ "15": 0,
1573
+ "16": 0,
1574
+ "17": 0,
1575
+ "18": 0,
1576
+ "19": 0,
1577
+ "20": 0,
1578
+ "21": 0,
1579
+ "22": 0
1580
+ },
1581
+ b: {
1582
+ "0": [0, 0],
1583
+ "1": [0, 0],
1584
+ "2": [0, 0],
1585
+ "3": [0, 0],
1586
+ "4": [0, 0],
1587
+ "5": [0, 0],
1588
+ "6": [0, 0],
1589
+ "7": [0, 0],
1590
+ "8": [0, 0],
1591
+ "9": [0, 0]
1592
+ },
1593
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
1594
+ hash: "6b5dc7d16d01b744ae08e5ca21214cf16f726fac"
1595
+ };
1596
+ var coverage = global[gcv] || (global[gcv] = {});
1597
+ if (!coverage[path] || coverage[path].hash !== hash) {
1598
+ coverage[path] = coverageData;
1599
+ }
1600
+ var actualCoverage = coverage[path];
1601
+ {
1602
+ // @ts-ignore
1603
+ cov_2kycc8t3qm = function () {
1604
+ return actualCoverage;
1605
+ };
1606
+ }
1607
+ return actualCoverage;
1608
+ }
1609
+ cov_2kycc8t3qm();
1610
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1611
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1612
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
1613
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
1614
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1615
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
1616
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
13
1617
  /**
14
1618
  * @typedef {Object} File
15
1619
  * @property {string} createdAt ISO 8601 Extended Format date/time string
@@ -96,19 +1700,19 @@ import { formatPaginatedDataFromServer } from '../utils/pagination';
96
1700
  *
97
1701
  * @typicalname contxtSdk.files
98
1702
  */
99
-
100
- var Files = function () {
1703
+ class Files {
101
1704
  /**
102
1705
  * @param {Object} sdk An instance of the SDK so the module can communicate with other modules
103
1706
  * @param {Object} request An instance of the request module tied to this module's audience.
104
1707
  */
105
- function Files(sdk, request) {
106
- _classCallCheck(this, Files);
107
-
108
- var baseUrl = sdk.config.audiences.files.host + '/v1';
109
-
1708
+ constructor(sdk, request) {
1709
+ cov_2kycc8t3qm().f[0]++;
1710
+ const baseUrl = (cov_2kycc8t3qm().s[0]++, `${sdk.config.audiences.files.host}/v1`);
1711
+ cov_2kycc8t3qm().s[1]++;
110
1712
  this._baseUrl = baseUrl;
1713
+ cov_2kycc8t3qm().s[2]++;
111
1714
  this._request = request;
1715
+ cov_2kycc8t3qm().s[3]++;
112
1716
  this._sdk = sdk;
113
1717
  }
114
1718
 
@@ -141,421 +1745,460 @@ var Files = function () {
141
1745
  * .then((file) => console.log(file))
142
1746
  * .catch((err) => console.log(err));
143
1747
  */
144
-
145
-
146
- _createClass(Files, [{
147
- key: 'create',
148
- value: function create(fileInfo) {
149
- var requiredFields = ['contentType', 'filename', 'organizationId'];
150
-
151
- for (var i = 0; i < requiredFields.length; i++) {
152
- if (!fileInfo[requiredFields[i]]) {
153
- return Promise.reject(new Error('A ' + requiredFields[i] + ' is required to create a file'));
154
- }
1748
+ create(fileInfo) {
1749
+ cov_2kycc8t3qm().f[1]++;
1750
+ const requiredFields = (cov_2kycc8t3qm().s[4]++, ['contentType', 'filename', 'organizationId']);
1751
+ cov_2kycc8t3qm().s[5]++;
1752
+ for (let i = (cov_2kycc8t3qm().s[6]++, 0); i < requiredFields.length; i++) {
1753
+ cov_2kycc8t3qm().s[7]++;
1754
+ if (!fileInfo[requiredFields[i]]) {
1755
+ cov_2kycc8t3qm().b[0][0]++;
1756
+ cov_2kycc8t3qm().s[8]++;
1757
+ return Promise.reject(new Error(`A ${requiredFields[i]} is required to create a file`));
1758
+ } else {
1759
+ cov_2kycc8t3qm().b[0][1]++;
155
1760
  }
156
-
157
- return this._request.post(this._baseUrl + '/files', toSnakeCase(fileInfo)).then(function (_ref) {
158
- var upload_info = _ref.upload_info,
159
- createdFile = _objectWithoutProperties(_ref, ['upload_info']);
160
-
161
- return _extends({}, toCamelCase(createdFile), {
162
- uploadInfo: toCamelCase(upload_info, {
163
- deep: false,
164
- excludeTransform: ['headers']
165
- })
166
- });
167
- });
168
1761
  }
1762
+ cov_2kycc8t3qm().s[9]++;
1763
+ return this._request.post(`${this._baseUrl}/files`, _objects.default.toSnakeCase(fileInfo)).then(_ref => {
1764
+ let upload_info = _ref.upload_info,
1765
+ createdFile = _objectWithoutProperties(_ref, _excluded);
1766
+ cov_2kycc8t3qm().f[2]++;
1767
+ cov_2kycc8t3qm().s[10]++;
1768
+ return _objectSpread(_objectSpread({}, _objects.default.toCamelCase(createdFile)), {}, {
1769
+ uploadInfo: _objects.default.toCamelCase(upload_info, {
1770
+ deep: false,
1771
+ excludeTransform: ['headers']
1772
+ })
1773
+ });
1774
+ });
1775
+ }
169
1776
 
170
- /**
171
- * A procedural method that takes care of:
172
- * 1. Creating a file record
173
- * 2. Uploading the file from information returned when creating the file
174
- * record
175
- * 3. Updating the file record's status to indicate if the upload was
176
- * successful or a failure
177
- * 4. Returning an updated copy of the file record OR an error indicating
178
- * what failed, when it failed, and potentially, why it failed
179
- *
180
- * @param {Object} fileInfo
181
- * @param {ArrayBuffer|Blob|Buffer|File|Stream} fileInfo.data The actual data of the file.
182
- * @param {Object} fileInfo.metadata Metadata about the file to be uploaded
183
- * @param {string} fileInfo.metadata.contentType The MIME type
184
- * @param {string} [fileInfo.metadata.description] A short description
185
- * @param {string} fileInfo.metadata.filename The filename
186
- * @param {string} fileInfo.metadata.organizationId The organization ID to which the file belongs
187
- *
188
- * @returns {Promise}
189
- * @fulfill {File}
190
- * @rejects {FileError}
191
- *
192
- * @example
193
- * contxtSdk
194
- * .createAndUpload({
195
- * data: fs.readFileSync(
196
- * path.join(
197
- * __dirname,
198
- * 'hawkins_national_labratory-hawkins_energy-october-2019.pdf'
199
- * )
200
- * ),
201
- * metadata: {
202
- * contentType: 'application/pdf',
203
- * description:
204
- * 'Electric Bill from Hawkins National Labratory (October 2018)',
205
- * filename:
206
- * 'hawkins_national_labratory-hawkins_energy-october-2019.pdf',
207
- * organizationId: '8ba33864-01ff-4388-a4e0-63eebf36fed3'
208
- * }
209
- * })
210
- * .then((file) => console.log(file))
211
- * .catch((err) => console.log(err));
212
- */
213
-
214
- }, {
215
- key: 'createAndUpload',
216
- value: function createAndUpload(fileInfo) {
217
- var _this = this;
218
-
219
- var requiredFields = ['data', 'metadata'];
220
-
221
- for (var i = 0; i < requiredFields.length; i++) {
222
- if (!fileInfo[requiredFields[i]]) {
223
- return Promise.reject(this._generateError({
224
- message: 'A `' + requiredFields[i] + '` field is required to create and upload a file',
225
- stage: 'validation'
226
- }));
227
- }
1777
+ /**
1778
+ * A procedural method that takes care of:
1779
+ * 1. Creating a file record
1780
+ * 2. Uploading the file from information returned when creating the file
1781
+ * record
1782
+ * 3. Updating the file record's status to indicate if the upload was
1783
+ * successful or a failure
1784
+ * 4. Returning an updated copy of the file record OR an error indicating
1785
+ * what failed, when it failed, and potentially, why it failed
1786
+ *
1787
+ * @param {Object} fileInfo
1788
+ * @param {ArrayBuffer|Blob|Buffer|File|Stream} fileInfo.data The actual data of the file.
1789
+ * @param {Object} fileInfo.metadata Metadata about the file to be uploaded
1790
+ * @param {string} fileInfo.metadata.contentType The MIME type
1791
+ * @param {string} [fileInfo.metadata.description] A short description
1792
+ * @param {string} fileInfo.metadata.filename The filename
1793
+ * @param {string} fileInfo.metadata.organizationId The organization ID to which the file belongs
1794
+ *
1795
+ * @returns {Promise}
1796
+ * @fulfill {File}
1797
+ * @rejects {FileError}
1798
+ *
1799
+ * @example
1800
+ * contxtSdk
1801
+ * .createAndUpload({
1802
+ * data: fs.readFileSync(
1803
+ * path.join(
1804
+ * __dirname,
1805
+ * 'hawkins_national_labratory-hawkins_energy-october-2019.pdf'
1806
+ * )
1807
+ * ),
1808
+ * metadata: {
1809
+ * contentType: 'application/pdf',
1810
+ * description:
1811
+ * 'Electric Bill from Hawkins National Labratory (October 2018)',
1812
+ * filename:
1813
+ * 'hawkins_national_labratory-hawkins_energy-october-2019.pdf',
1814
+ * organizationId: '8ba33864-01ff-4388-a4e0-63eebf36fed3'
1815
+ * }
1816
+ * })
1817
+ * .then((file) => console.log(file))
1818
+ * .catch((err) => console.log(err));
1819
+ */
1820
+ createAndUpload(fileInfo) {
1821
+ cov_2kycc8t3qm().f[3]++;
1822
+ const requiredFields = (cov_2kycc8t3qm().s[11]++, ['data', 'metadata']);
1823
+ cov_2kycc8t3qm().s[12]++;
1824
+ for (let i = (cov_2kycc8t3qm().s[13]++, 0); i < requiredFields.length; i++) {
1825
+ cov_2kycc8t3qm().s[14]++;
1826
+ if (!fileInfo[requiredFields[i]]) {
1827
+ cov_2kycc8t3qm().b[1][0]++;
1828
+ cov_2kycc8t3qm().s[15]++;
1829
+ return Promise.reject(this._generateError({
1830
+ message: `A \`${requiredFields[i]}\` field is required to create and upload a file`,
1831
+ stage: 'validation'
1832
+ }));
1833
+ } else {
1834
+ cov_2kycc8t3qm().b[1][1]++;
228
1835
  }
229
-
230
- var data = fileInfo.data,
231
- metadata = fileInfo.metadata;
232
-
233
-
234
- return this.create(metadata).catch(function (originalError) {
235
- throw _this._generateError({
236
- originalError: originalError,
237
- message: 'There was a problem creating the file. Please try again.',
238
- stage: 'create'
239
- });
240
- }).then(function (_ref2) {
241
- var uploadInfo = _ref2.uploadInfo,
242
- createdFile = _objectWithoutProperties(_ref2, ['uploadInfo']);
243
-
244
- return Promise.resolve().then(function () {
245
- return _this.upload({
246
- data: data,
247
- headers: uploadInfo.headers,
248
- url: uploadInfo.url
249
- }).catch(function (originalError) {
250
- _this.setUploadFailed(createdFile.id);
251
-
252
- throw _this._generateError({
253
- createdFile: createdFile,
254
- originalError: originalError,
255
- message: 'There was a problem uploading the file. Please try again.',
256
- stage: 'upload'
257
- });
1836
+ }
1837
+ const _ref2 = (cov_2kycc8t3qm().s[16]++, fileInfo),
1838
+ data = _ref2.data,
1839
+ metadata = _ref2.metadata;
1840
+ cov_2kycc8t3qm().s[17]++;
1841
+ return this.create(metadata).catch(originalError => {
1842
+ cov_2kycc8t3qm().f[4]++;
1843
+ cov_2kycc8t3qm().s[18]++;
1844
+ throw this._generateError({
1845
+ originalError,
1846
+ message: 'There was a problem creating the file. Please try again.',
1847
+ stage: 'create'
1848
+ });
1849
+ }).then(_ref3 => {
1850
+ let uploadInfo = _ref3.uploadInfo,
1851
+ createdFile = _objectWithoutProperties(_ref3, _excluded2);
1852
+ cov_2kycc8t3qm().f[5]++;
1853
+ cov_2kycc8t3qm().s[19]++;
1854
+ return Promise.resolve().then(() => {
1855
+ cov_2kycc8t3qm().f[6]++;
1856
+ cov_2kycc8t3qm().s[20]++;
1857
+ return this.upload({
1858
+ data,
1859
+ headers: uploadInfo.headers,
1860
+ url: uploadInfo.url
1861
+ }).catch(originalError => {
1862
+ cov_2kycc8t3qm().f[7]++;
1863
+ cov_2kycc8t3qm().s[21]++;
1864
+ this.setUploadFailed(createdFile.id);
1865
+ cov_2kycc8t3qm().s[22]++;
1866
+ throw this._generateError({
1867
+ createdFile,
1868
+ originalError,
1869
+ message: 'There was a problem uploading the file. Please try again.',
1870
+ stage: 'upload'
258
1871
  });
259
- }).then(function () {
260
- return _this.setUploadComplete(createdFile.id).catch(function (originalError) {
261
- throw _this._generateError({
262
- createdFile: createdFile,
263
- originalError: originalError,
264
- message: 'There was a problem updating the file status. Please try again.',
265
- stage: 'statusUpdate'
266
- });
1872
+ });
1873
+ }).then(() => {
1874
+ cov_2kycc8t3qm().f[8]++;
1875
+ cov_2kycc8t3qm().s[23]++;
1876
+ return this.setUploadComplete(createdFile.id).catch(originalError => {
1877
+ cov_2kycc8t3qm().f[9]++;
1878
+ cov_2kycc8t3qm().s[24]++;
1879
+ throw this._generateError({
1880
+ createdFile,
1881
+ originalError,
1882
+ message: 'There was a problem updating the file status. Please try again.',
1883
+ stage: 'statusUpdate'
267
1884
  });
268
- }).then(function () {
269
- return _this.get(createdFile.id).catch(function (originalError) {
270
- throw _this._generateError({
271
- createdFile: createdFile,
272
- originalError: originalError,
273
- message: 'There was a problem getting updated information about the file. Please try again.',
274
- stage: 'get'
275
- });
1885
+ });
1886
+ }).then(() => {
1887
+ cov_2kycc8t3qm().f[10]++;
1888
+ cov_2kycc8t3qm().s[25]++;
1889
+ return this.get(createdFile.id).catch(originalError => {
1890
+ cov_2kycc8t3qm().f[11]++;
1891
+ cov_2kycc8t3qm().s[26]++;
1892
+ throw this._generateError({
1893
+ createdFile,
1894
+ originalError,
1895
+ message: 'There was a problem getting updated information about the file. Please try again.',
1896
+ stage: 'get'
276
1897
  });
277
1898
  });
278
1899
  });
279
- }
280
-
281
- /**
282
- * Deletes a file and associated file actions.
283
- *
284
- * API Endpoint: '/files/:fileId'
285
- * Method: DELETE
286
- *
287
- * @param {string} fileId The ID of the file
288
- *
289
- * @returns {Promise}
290
- * @fulfill {undefined}
291
- * @reject {Error}
292
- *
293
- * @example
294
- * contxtSdk.files.delete('8704f900-28f2-4951-aaf0-1827fcd0b0cb');
295
- */
296
-
297
- }, {
298
- key: 'delete',
299
- value: function _delete(fileId) {
300
- if (!fileId) {
301
- return Promise.reject(new Error('A file ID is required to delete a file'));
302
- }
303
-
304
- return this._request.delete(this._baseUrl + '/files/' + fileId);
305
- }
306
-
307
- /**
308
- * Gets a temporary URL for the file.
309
- *
310
- * API Endpoint: '/files/:fileId/download'
311
- * Method: GET
312
- *
313
- * @param {string} fileId The ID of the file
314
- *
315
- * @returns {Promise}
316
- * @fulfill {FileToDownload} Information needed to download the file
317
- * @reject {Error}
318
- *
319
- * @example
320
- * contxtSdk.files
321
- * .download('bbcdd201-58f7-4b69-a24e-752e9490a347')
322
- * .then((file) => console.log(file))
323
- * .catch((err) => console.log(err));
324
- */
325
-
326
- }, {
327
- key: 'download',
328
- value: function download(fileId) {
329
- if (!fileId) {
330
- return Promise.reject(new Error('A file ID is required for downloading a file'));
331
- }
1900
+ });
1901
+ }
332
1902
 
333
- return this._request.get(this._baseUrl + '/files/' + fileId + '/download').then(function (file) {
334
- return toCamelCase(file);
335
- });
1903
+ /**
1904
+ * Deletes a file and associated file actions.
1905
+ *
1906
+ * API Endpoint: '/files/:fileId'
1907
+ * Method: DELETE
1908
+ *
1909
+ * @param {string} fileId The ID of the file
1910
+ *
1911
+ * @returns {Promise}
1912
+ * @fulfill {undefined}
1913
+ * @reject {Error}
1914
+ *
1915
+ * @example
1916
+ * contxtSdk.files.delete('8704f900-28f2-4951-aaf0-1827fcd0b0cb');
1917
+ */
1918
+ delete(fileId) {
1919
+ cov_2kycc8t3qm().f[12]++;
1920
+ cov_2kycc8t3qm().s[27]++;
1921
+ if (!fileId) {
1922
+ cov_2kycc8t3qm().b[2][0]++;
1923
+ cov_2kycc8t3qm().s[28]++;
1924
+ return Promise.reject(new Error('A file ID is required to delete a file'));
1925
+ } else {
1926
+ cov_2kycc8t3qm().b[2][1]++;
336
1927
  }
1928
+ cov_2kycc8t3qm().s[29]++;
1929
+ return this._request.delete(`${this._baseUrl}/files/${fileId}`);
1930
+ }
337
1931
 
338
- /**
339
- * Gets metadata about a file. This does not return the actual file.
340
- *
341
- * API Endpoint: '/files/:fileId'
342
- * Method: GET
343
- *
344
- * @param {string} fileId The ID of the file
345
- *
346
- * @returns {Promise}
347
- * @fulfill {File} Information about a file
348
- * @reject {Error}
349
- *
350
- * @example
351
- * contxtSdk.files
352
- * .get('bbcdd201-58f7-4b69-a24e-752e9490a347')
353
- * .then((file) => console.log(file))
354
- * .catch((err) => console.log(err));
355
- */
356
-
357
- }, {
358
- key: 'get',
359
- value: function get(fileId) {
360
- if (!fileId) {
361
- return Promise.reject(new Error('A file ID is required for getting information about a file'));
362
- }
363
-
364
- return this._request.get(this._baseUrl + '/files/' + fileId).then(function (file) {
365
- return toCamelCase(file);
366
- });
1932
+ /**
1933
+ * Gets a temporary URL for the file.
1934
+ *
1935
+ * API Endpoint: '/files/:fileId/download'
1936
+ * Method: GET
1937
+ *
1938
+ * @param {string} fileId The ID of the file
1939
+ *
1940
+ * @returns {Promise}
1941
+ * @fulfill {FileToDownload} Information needed to download the file
1942
+ * @reject {Error}
1943
+ *
1944
+ * @example
1945
+ * contxtSdk.files
1946
+ * .download('bbcdd201-58f7-4b69-a24e-752e9490a347')
1947
+ * .then((file) => console.log(file))
1948
+ * .catch((err) => console.log(err));
1949
+ */
1950
+ download(fileId) {
1951
+ cov_2kycc8t3qm().f[13]++;
1952
+ cov_2kycc8t3qm().s[30]++;
1953
+ if (!fileId) {
1954
+ cov_2kycc8t3qm().b[3][0]++;
1955
+ cov_2kycc8t3qm().s[31]++;
1956
+ return Promise.reject(new Error('A file ID is required for downloading a file'));
1957
+ } else {
1958
+ cov_2kycc8t3qm().b[3][1]++;
367
1959
  }
1960
+ cov_2kycc8t3qm().s[32]++;
1961
+ return this._request.get(`${this._baseUrl}/files/${fileId}/download`).then(file => {
1962
+ cov_2kycc8t3qm().f[14]++;
1963
+ cov_2kycc8t3qm().s[33]++;
1964
+ return _objects.default.toCamelCase(file);
1965
+ });
1966
+ }
368
1967
 
369
- /**
370
- * Gets a paginated list of files and their metadata. This does not return
371
- * the actual files.
372
- *
373
- * API Endpoint: '/files'
374
- * Method: GET
375
- *
376
- * @param {Object} [filesFilters]
377
- * @param {Number} [filesFilters.limit = 100] Maximum number of records to return per query
378
- * @param {Number} [filesFilters.offset = 0] How many records from the first record to start the query
379
- * @param {String} [filesFilters.orderBy = 'createdAt'] How many records from the first record to start the query
380
- * @param {Boolean} [filesFilters.reverseOrder = false] Determine the results should be sorted in reverse (ascending) order
381
- * @param {String} [filesFilters.status = 'ACTIVE'] Filter by a file's current status
382
- *
383
- * @returns {Promise}
384
- * @fulfill {FilesFromServer} Information about the files
385
- * @reject {Error}
386
- *
387
- * @example
388
- * contxtSdk.files
389
- * .getAll()
390
- * .then((files) => console.log(files))
391
- * .catch((err) => console.log(err));
392
- */
393
-
394
- }, {
395
- key: 'getAll',
396
- value: function getAll(filesFilters) {
397
- return this._request.get(this._baseUrl + '/files', {
398
- params: toSnakeCase(filesFilters)
399
- }).then(function (assetsData) {
400
- return formatPaginatedDataFromServer(assetsData);
401
- });
1968
+ /**
1969
+ * Gets metadata about a file. This does not return the actual file.
1970
+ *
1971
+ * API Endpoint: '/files/:fileId'
1972
+ * Method: GET
1973
+ *
1974
+ * @param {string} fileId The ID of the file
1975
+ *
1976
+ * @returns {Promise}
1977
+ * @fulfill {File} Information about a file
1978
+ * @reject {Error}
1979
+ *
1980
+ * @example
1981
+ * contxtSdk.files
1982
+ * .get('bbcdd201-58f7-4b69-a24e-752e9490a347')
1983
+ * .then((file) => console.log(file))
1984
+ * .catch((err) => console.log(err));
1985
+ */
1986
+ get(fileId) {
1987
+ cov_2kycc8t3qm().f[15]++;
1988
+ cov_2kycc8t3qm().s[34]++;
1989
+ if (!fileId) {
1990
+ cov_2kycc8t3qm().b[4][0]++;
1991
+ cov_2kycc8t3qm().s[35]++;
1992
+ return Promise.reject(new Error('A file ID is required for getting information about a file'));
1993
+ } else {
1994
+ cov_2kycc8t3qm().b[4][1]++;
402
1995
  }
1996
+ cov_2kycc8t3qm().s[36]++;
1997
+ return this._request.get(`${this._baseUrl}/files/${fileId}`).then(file => {
1998
+ cov_2kycc8t3qm().f[16]++;
1999
+ cov_2kycc8t3qm().s[37]++;
2000
+ return _objects.default.toCamelCase(file);
2001
+ });
2002
+ }
403
2003
 
404
- /**
405
- * Updates the upload status of a file to indicate the upload is complete.
406
- *
407
- * API Endpoint: '/files/:fileId/complete'
408
- * Method: POST
409
- *
410
- * @param {string} fileId The ID of the file to update
411
- *
412
- * @returns {Promise}
413
- * @fulfill {undefined}
414
- * @rejects {Error}
415
- *
416
- * @example
417
- * contxtSdk.files
418
- * .setUploadComplete('ecd0439e-d5be-4529-ad6a-4a9cbfa7202f')
419
- * .catch((err) => console.log(err));
420
- */
421
-
422
- }, {
423
- key: 'setUploadComplete',
424
- value: function setUploadComplete(fileId) {
425
- if (!fileId) {
426
- return Promise.reject(new Error('A file ID is required to mark a file upload as complete'));
427
- }
2004
+ /**
2005
+ * Gets a paginated list of files and their metadata. This does not return
2006
+ * the actual files.
2007
+ *
2008
+ * API Endpoint: '/files'
2009
+ * Method: GET
2010
+ *
2011
+ * @param {Object} [filesFilters]
2012
+ * @param {Number} [filesFilters.limit = 100] Maximum number of records to return per query
2013
+ * @param {Number} [filesFilters.offset = 0] How many records from the first record to start the query
2014
+ * @param {String} [filesFilters.orderBy = 'createdAt'] How many records from the first record to start the query
2015
+ * @param {Boolean} [filesFilters.reverseOrder = false] Determine the results should be sorted in reverse (ascending) order
2016
+ * @param {String} [filesFilters.status = 'ACTIVE'] Filter by a file's current status
2017
+ *
2018
+ * @returns {Promise}
2019
+ * @fulfill {FilesFromServer} Information about the files
2020
+ * @reject {Error}
2021
+ *
2022
+ * @example
2023
+ * contxtSdk.files
2024
+ * .getAll()
2025
+ * .then((files) => console.log(files))
2026
+ * .catch((err) => console.log(err));
2027
+ */
2028
+ getAll(filesFilters) {
2029
+ cov_2kycc8t3qm().f[17]++;
2030
+ cov_2kycc8t3qm().s[38]++;
2031
+ return this._request.get(`${this._baseUrl}/files`, {
2032
+ params: _objects.default.toSnakeCase(filesFilters)
2033
+ }).then(assetsData => {
2034
+ cov_2kycc8t3qm().f[18]++;
2035
+ cov_2kycc8t3qm().s[39]++;
2036
+ return _pagination.default.formatPaginatedDataFromServer(assetsData);
2037
+ });
2038
+ }
428
2039
 
429
- return this._request.post(this._baseUrl + '/files/' + fileId + '/complete');
2040
+ /**
2041
+ * Updates the upload status of a file to indicate the upload is complete.
2042
+ *
2043
+ * API Endpoint: '/files/:fileId/complete'
2044
+ * Method: POST
2045
+ *
2046
+ * @param {string} fileId The ID of the file to update
2047
+ *
2048
+ * @returns {Promise}
2049
+ * @fulfill {undefined}
2050
+ * @rejects {Error}
2051
+ *
2052
+ * @example
2053
+ * contxtSdk.files
2054
+ * .setUploadComplete('ecd0439e-d5be-4529-ad6a-4a9cbfa7202f')
2055
+ * .catch((err) => console.log(err));
2056
+ */
2057
+ setUploadComplete(fileId) {
2058
+ cov_2kycc8t3qm().f[19]++;
2059
+ cov_2kycc8t3qm().s[40]++;
2060
+ if (!fileId) {
2061
+ cov_2kycc8t3qm().b[5][0]++;
2062
+ cov_2kycc8t3qm().s[41]++;
2063
+ return Promise.reject(new Error('A file ID is required to mark a file upload as complete'));
2064
+ } else {
2065
+ cov_2kycc8t3qm().b[5][1]++;
430
2066
  }
2067
+ cov_2kycc8t3qm().s[42]++;
2068
+ return this._request.post(`${this._baseUrl}/files/${fileId}/complete`);
2069
+ }
431
2070
 
432
- /**
433
- * Updates the upload status of a file to indicate the upload has failed.
434
- *
435
- * API Endpoint: '/files/:fileId/failed'
436
- * Method: POST
437
- *
438
- * @param {string} fileId The ID of the file to update
439
- *
440
- * @returns {Promise}
441
- * @fulfill {undefined}
442
- * @rejects {Error}
443
- *
444
- * @example
445
- * contxtSdk.files
446
- * .setUploadFailed('ecd0439e-d5be-4529-ad6a-4a9cbfa7202f')
447
- * .catch((err) => console.log(err));
448
- */
449
-
450
- }, {
451
- key: 'setUploadFailed',
452
- value: function setUploadFailed(fileId) {
453
- if (!fileId) {
454
- return Promise.reject(new Error('A file ID is required to mark a file upload as failed'));
455
- }
456
-
457
- return this._request.post(this._baseUrl + '/files/' + fileId + '/failed');
2071
+ /**
2072
+ * Updates the upload status of a file to indicate the upload has failed.
2073
+ *
2074
+ * API Endpoint: '/files/:fileId/failed'
2075
+ * Method: POST
2076
+ *
2077
+ * @param {string} fileId The ID of the file to update
2078
+ *
2079
+ * @returns {Promise}
2080
+ * @fulfill {undefined}
2081
+ * @rejects {Error}
2082
+ *
2083
+ * @example
2084
+ * contxtSdk.files
2085
+ * .setUploadFailed('ecd0439e-d5be-4529-ad6a-4a9cbfa7202f')
2086
+ * .catch((err) => console.log(err));
2087
+ */
2088
+ setUploadFailed(fileId) {
2089
+ cov_2kycc8t3qm().f[20]++;
2090
+ cov_2kycc8t3qm().s[43]++;
2091
+ if (!fileId) {
2092
+ cov_2kycc8t3qm().b[6][0]++;
2093
+ cov_2kycc8t3qm().s[44]++;
2094
+ return Promise.reject(new Error('A file ID is required to mark a file upload as failed'));
2095
+ } else {
2096
+ cov_2kycc8t3qm().b[6][1]++;
458
2097
  }
2098
+ cov_2kycc8t3qm().s[45]++;
2099
+ return this._request.post(`${this._baseUrl}/files/${fileId}/failed`);
2100
+ }
459
2101
 
460
- /**
461
- * Uploads a file to the provided URL. The URL and the headers should be
462
- * sourced from the response when initially creating a File record.
463
- *
464
- * Method: PUT
465
- *
466
- * @param {Object} fileInfo
467
- * @param {ArrayBuffer|Blob|Buffer|File|Stream} fileInfo.data The data to be
468
- * uploaded
469
- * @param {Object.<string, string>} [fileInfo.headers] Headers to be appended
470
- * to the request. The key is the header name and the value is the included
471
- * value
472
- * @param {String} fileInfo.url The URL to use for the request
473
- *
474
- * @returns {Promise}
475
- * @fulfill {Object}
476
- * @reject {Error}
477
- *
478
- * @example
479
- * contxtSdk.files
480
- * .upload({
481
- * data: fs.readFileSync(
482
- * path.join(
483
- * __dirname,
484
- * 'hawkins_national_labratory-hawkins_energy-october-2019.pdf'
485
- * )
486
- * ),
487
- * headers: {
488
- * 'Content-Type': 'application/pdf'
489
- * },
490
- * url:
491
- * 'https://files.ndustrial.example.org/hawkins_national_labratory-hawkins_energy-october-2019.pdf'
492
- * })
493
- * .catch((err) => console.log(err));
494
- */
495
-
496
- }, {
497
- key: 'upload',
498
- value: function upload(fileInfo) {
499
- var requiredFields = ['data', 'url'];
500
-
501
- for (var i = 0; i < requiredFields.length; i++) {
502
- if (!fileInfo[requiredFields[i]]) {
503
- return Promise.reject(new Error('A ' + requiredFields[i] + ' is required to upload a file'));
504
- }
2102
+ /**
2103
+ * Uploads a file to the provided URL. The URL and the headers should be
2104
+ * sourced from the response when initially creating a File record.
2105
+ *
2106
+ * Method: PUT
2107
+ *
2108
+ * @param {Object} fileInfo
2109
+ * @param {ArrayBuffer|Blob|Buffer|File|Stream} fileInfo.data The data to be
2110
+ * uploaded
2111
+ * @param {Object.<string, string>} [fileInfo.headers] Headers to be appended
2112
+ * to the request. The key is the header name and the value is the included
2113
+ * value
2114
+ * @param {String} fileInfo.url The URL to use for the request
2115
+ *
2116
+ * @returns {Promise}
2117
+ * @fulfill {Object}
2118
+ * @reject {Error}
2119
+ *
2120
+ * @example
2121
+ * contxtSdk.files
2122
+ * .upload({
2123
+ * data: fs.readFileSync(
2124
+ * path.join(
2125
+ * __dirname,
2126
+ * 'hawkins_national_labratory-hawkins_energy-october-2019.pdf'
2127
+ * )
2128
+ * ),
2129
+ * headers: {
2130
+ * 'Content-Type': 'application/pdf'
2131
+ * },
2132
+ * url:
2133
+ * 'https://files.ndustrial.example.org/hawkins_national_labratory-hawkins_energy-october-2019.pdf'
2134
+ * })
2135
+ * .catch((err) => console.log(err));
2136
+ */
2137
+ upload(fileInfo) {
2138
+ cov_2kycc8t3qm().f[21]++;
2139
+ const requiredFields = (cov_2kycc8t3qm().s[46]++, ['data', 'url']);
2140
+ cov_2kycc8t3qm().s[47]++;
2141
+ for (let i = (cov_2kycc8t3qm().s[48]++, 0); i < requiredFields.length; i++) {
2142
+ cov_2kycc8t3qm().s[49]++;
2143
+ if (!fileInfo[requiredFields[i]]) {
2144
+ cov_2kycc8t3qm().b[7][0]++;
2145
+ cov_2kycc8t3qm().s[50]++;
2146
+ return Promise.reject(new Error(`A ${requiredFields[i]} is required to upload a file`));
2147
+ } else {
2148
+ cov_2kycc8t3qm().b[7][1]++;
505
2149
  }
506
-
507
- var data = fileInfo.data,
508
- headers = fileInfo.headers,
509
- url = fileInfo.url;
510
-
511
-
512
- return axios.put(url, data, { headers: headers });
513
2150
  }
2151
+ const _ref4 = (cov_2kycc8t3qm().s[51]++, fileInfo),
2152
+ data = _ref4.data,
2153
+ headers = _ref4.headers,
2154
+ url = _ref4.url;
2155
+ cov_2kycc8t3qm().s[52]++;
2156
+ return _axios.default.put(url, data, {
2157
+ headers
2158
+ });
2159
+ }
514
2160
 
515
- /**
516
- * Generates a consistent error message with information needed to debug why
517
- * creating and uploading a file may have failed.
518
- *
519
- * @param {Object} errorInfo
520
- * @param {Object} [errorInfo.createdFile] An object containing information
521
- * about a created created by Files#create
522
- * @param {string} [errorInfo.message] The message to be applied to the new
523
- * Error
524
- * @param {Error} errorInfo.originalError The original error that was thrown
525
- * that will be included in the new Error's body
526
- * @param {string} errorInfo.stage A string describing in what stage of the
527
- * create and upload process the failure occurred
528
- *
529
- * @returns {FileError}
530
- *
531
- * @private
532
- */
533
-
534
- }, {
535
- key: '_generateError',
536
- value: function _generateError(_ref3) {
537
- var createdFile = _ref3.createdFile,
538
- message = _ref3.message,
539
- originalError = _ref3.originalError,
540
- stage = _ref3.stage;
541
-
542
- var artifacts = {};
543
- var errorMsg = message || originalError.message;
544
-
545
- if (createdFile) {
546
- artifacts.file = createdFile;
547
- }
548
-
549
- return Object.assign(new Error(errorMsg), {
550
- artifacts: artifacts,
551
- originalError: originalError,
552
- stage: stage
553
- });
2161
+ /**
2162
+ * Generates a consistent error message with information needed to debug why
2163
+ * creating and uploading a file may have failed.
2164
+ *
2165
+ * @param {Object} errorInfo
2166
+ * @param {Object} [errorInfo.createdFile] An object containing information
2167
+ * about a created created by Files#create
2168
+ * @param {string} [errorInfo.message] The message to be applied to the new
2169
+ * Error
2170
+ * @param {Error} errorInfo.originalError The original error that was thrown
2171
+ * that will be included in the new Error's body
2172
+ * @param {string} errorInfo.stage A string describing in what stage of the
2173
+ * create and upload process the failure occurred
2174
+ *
2175
+ * @returns {FileError}
2176
+ *
2177
+ * @private
2178
+ */
2179
+ _generateError(_ref5) {
2180
+ let createdFile = _ref5.createdFile,
2181
+ message = _ref5.message,
2182
+ originalError = _ref5.originalError,
2183
+ stage = _ref5.stage;
2184
+ cov_2kycc8t3qm().f[22]++;
2185
+ const artifacts = (cov_2kycc8t3qm().s[53]++, {});
2186
+ const errorMsg = (cov_2kycc8t3qm().s[54]++, (cov_2kycc8t3qm().b[8][0]++, message) || (cov_2kycc8t3qm().b[8][1]++, originalError.message));
2187
+ cov_2kycc8t3qm().s[55]++;
2188
+ if (createdFile) {
2189
+ cov_2kycc8t3qm().b[9][0]++;
2190
+ cov_2kycc8t3qm().s[56]++;
2191
+ artifacts.file = createdFile;
2192
+ } else {
2193
+ cov_2kycc8t3qm().b[9][1]++;
554
2194
  }
555
- }]);
556
-
557
- return Files;
558
- }();
559
-
560
- export default Files;
2195
+ cov_2kycc8t3qm().s[57]++;
2196
+ return Object.assign(new Error(errorMsg), {
2197
+ artifacts,
2198
+ originalError,
2199
+ stage
2200
+ });
2201
+ }
2202
+ }
2203
+ var _default = exports.default = Files;
561
2204
  //# sourceMappingURL=index.js.map