@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,21 +1,2066 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
-
9
- var _uuid = require('uuid');
10
-
11
- var _lodash = require('lodash.once');
12
-
13
- var _lodash2 = _interopRequireDefault(_lodash);
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
17
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
-
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.json.stringify.js");
8
+ require("core-js/modules/es.promise.js");
9
+ var _uuid = require("uuid");
10
+ var _lodash = _interopRequireDefault(require("lodash.once"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function cov_2fh0o593ie() {
13
+ var path = "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/bus/webSocketConnection.js";
14
+ var hash = "1a9c510e85be0f75ec94b72f6bd03e919caab7bc";
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/bus/webSocketConnection.js",
19
+ statementMap: {
20
+ "0": {
21
+ start: {
22
+ line: 35,
23
+ column: 4
24
+ },
25
+ end: {
26
+ line: 35,
27
+ column: 31
28
+ }
29
+ },
30
+ "1": {
31
+ start: {
32
+ line: 36,
33
+ column: 4
34
+ },
35
+ end: {
36
+ line: 36,
37
+ column: 42
38
+ }
39
+ },
40
+ "2": {
41
+ start: {
42
+ line: 37,
43
+ column: 4
44
+ },
45
+ end: {
46
+ line: 37,
47
+ column: 32
48
+ }
49
+ },
50
+ "3": {
51
+ start: {
52
+ line: 38,
53
+ column: 4
54
+ },
55
+ end: {
56
+ line: 38,
57
+ column: 36
58
+ }
59
+ },
60
+ "4": {
61
+ start: {
62
+ line: 40,
63
+ column: 4
64
+ },
65
+ end: {
66
+ line: 43,
67
+ column: 5
68
+ }
69
+ },
70
+ "5": {
71
+ start: {
72
+ line: 41,
73
+ column: 6
74
+ },
75
+ end: {
76
+ line: 41,
77
+ column: 63
78
+ }
79
+ },
80
+ "6": {
81
+ start: {
82
+ line: 42,
83
+ column: 6
84
+ },
85
+ end: {
86
+ line: 42,
87
+ column: 50
88
+ }
89
+ },
90
+ "7": {
91
+ start: {
92
+ line: 68,
93
+ column: 4
94
+ },
95
+ end: {
96
+ line: 70,
97
+ column: 5
98
+ }
99
+ },
100
+ "8": {
101
+ start: {
102
+ line: 69,
103
+ column: 6
104
+ },
105
+ end: {
106
+ line: 69,
107
+ column: 80
108
+ }
109
+ },
110
+ "9": {
111
+ start: {
112
+ line: 72,
113
+ column: 4
114
+ },
115
+ end: {
116
+ line: 74,
117
+ column: 5
118
+ }
119
+ },
120
+ "10": {
121
+ start: {
122
+ line: 73,
123
+ column: 6
124
+ },
125
+ end: {
126
+ line: 73,
127
+ column: 72
128
+ }
129
+ },
130
+ "11": {
131
+ start: {
132
+ line: 76,
133
+ column: 4
134
+ },
135
+ end: {
136
+ line: 76,
137
+ column: 70
138
+ }
139
+ },
140
+ "12": {
141
+ start: {
142
+ line: 92,
143
+ column: 4
144
+ },
145
+ end: {
146
+ line: 92,
147
+ column: 28
148
+ }
149
+ },
150
+ "13": {
151
+ start: {
152
+ line: 104,
153
+ column: 13
154
+ },
155
+ end: {
156
+ line: 108,
157
+ column: 3
158
+ }
159
+ },
160
+ "14": {
161
+ start: {
162
+ line: 105,
163
+ column: 4
164
+ },
165
+ end: {
166
+ line: 105,
167
+ column: 31
168
+ }
169
+ },
170
+ "15": {
171
+ start: {
172
+ line: 107,
173
+ column: 4
174
+ },
175
+ end: {
176
+ line: 107,
177
+ column: 56
178
+ }
179
+ },
180
+ "16": {
181
+ start: {
182
+ line: 117,
183
+ column: 15
184
+ },
185
+ end: {
186
+ line: 129,
187
+ column: 3
188
+ }
189
+ },
190
+ "17": {
191
+ start: {
192
+ line: 120,
193
+ column: 4
194
+ },
195
+ end: {
196
+ line: 124,
197
+ column: 5
198
+ }
199
+ },
200
+ "18": {
201
+ start: {
202
+ line: 121,
203
+ column: 6
204
+ },
205
+ end: {
206
+ line: 121,
207
+ column: 45
208
+ }
209
+ },
210
+ "19": {
211
+ start: {
212
+ line: 123,
213
+ column: 6
214
+ },
215
+ end: {
216
+ line: 123,
217
+ column: 49
218
+ }
219
+ },
220
+ "20": {
221
+ start: {
222
+ line: 126,
223
+ column: 4
224
+ },
225
+ end: {
226
+ line: 128,
227
+ column: 5
228
+ }
229
+ },
230
+ "21": {
231
+ start: {
232
+ line: 127,
233
+ column: 6
234
+ },
235
+ end: {
236
+ line: 127,
237
+ column: 57
238
+ }
239
+ },
240
+ "22": {
241
+ start: {
242
+ line: 154,
243
+ column: 4
244
+ },
245
+ end: {
246
+ line: 158,
247
+ column: 5
248
+ }
249
+ },
250
+ "23": {
251
+ start: {
252
+ line: 155,
253
+ column: 6
254
+ },
255
+ end: {
256
+ line: 157,
257
+ column: 8
258
+ }
259
+ },
260
+ "24": {
261
+ start: {
262
+ line: 160,
263
+ column: 4
264
+ },
265
+ end: {
266
+ line: 162,
267
+ column: 5
268
+ }
269
+ },
270
+ "25": {
271
+ start: {
272
+ line: 161,
273
+ column: 6
274
+ },
275
+ end: {
276
+ line: 161,
277
+ column: 79
278
+ }
279
+ },
280
+ "26": {
281
+ start: {
282
+ line: 164,
283
+ column: 4
284
+ },
285
+ end: {
286
+ line: 166,
287
+ column: 5
288
+ }
289
+ },
290
+ "27": {
291
+ start: {
292
+ line: 165,
293
+ column: 6
294
+ },
295
+ end: {
296
+ line: 165,
297
+ column: 79
298
+ }
299
+ },
300
+ "28": {
301
+ start: {
302
+ line: 168,
303
+ column: 4
304
+ },
305
+ end: {
306
+ line: 170,
307
+ column: 5
308
+ }
309
+ },
310
+ "29": {
311
+ start: {
312
+ line: 169,
313
+ column: 6
314
+ },
315
+ end: {
316
+ line: 169,
317
+ column: 72
318
+ }
319
+ },
320
+ "30": {
321
+ start: {
322
+ line: 172,
323
+ column: 4
324
+ },
325
+ end: {
326
+ line: 176,
327
+ column: 7
328
+ }
329
+ },
330
+ "31": {
331
+ start: {
332
+ line: 237,
333
+ column: 4
334
+ },
335
+ end: {
336
+ line: 241,
337
+ column: 5
338
+ }
339
+ },
340
+ "32": {
341
+ start: {
342
+ line: 238,
343
+ column: 6
344
+ },
345
+ end: {
346
+ line: 238,
347
+ column: 29
348
+ }
349
+ },
350
+ "33": {
351
+ start: {
352
+ line: 239,
353
+ column: 6
354
+ },
355
+ end: {
356
+ line: 239,
357
+ column: 22
358
+ }
359
+ },
360
+ "34": {
361
+ start: {
362
+ line: 240,
363
+ column: 6
364
+ },
365
+ end: {
366
+ line: 240,
367
+ column: 19
368
+ }
369
+ },
370
+ "35": {
371
+ start: {
372
+ line: 243,
373
+ column: 4
374
+ },
375
+ end: {
376
+ line: 247,
377
+ column: 5
378
+ }
379
+ },
380
+ "36": {
381
+ start: {
382
+ line: 244,
383
+ column: 6
384
+ },
385
+ end: {
386
+ line: 246,
387
+ column: 8
388
+ }
389
+ },
390
+ "37": {
391
+ start: {
392
+ line: 249,
393
+ column: 4
394
+ },
395
+ end: {
396
+ line: 251,
397
+ column: 5
398
+ }
399
+ },
400
+ "38": {
401
+ start: {
402
+ line: 250,
403
+ column: 6
404
+ },
405
+ end: {
406
+ line: 250,
407
+ column: 80
408
+ }
409
+ },
410
+ "39": {
411
+ start: {
412
+ line: 253,
413
+ column: 4
414
+ },
415
+ end: {
416
+ line: 257,
417
+ column: 5
418
+ }
419
+ },
420
+ "40": {
421
+ start: {
422
+ line: 254,
423
+ column: 6
424
+ },
425
+ end: {
426
+ line: 256,
427
+ column: 8
428
+ }
429
+ },
430
+ "41": {
431
+ start: {
432
+ line: 259,
433
+ column: 4
434
+ },
435
+ end: {
436
+ line: 263,
437
+ column: 5
438
+ }
439
+ },
440
+ "42": {
441
+ start: {
442
+ line: 260,
443
+ column: 6
444
+ },
445
+ end: {
446
+ line: 262,
447
+ column: 8
448
+ }
449
+ },
450
+ "43": {
451
+ start: {
452
+ line: 265,
453
+ column: 4
454
+ },
455
+ end: {
456
+ line: 267,
457
+ column: 5
458
+ }
459
+ },
460
+ "44": {
461
+ start: {
462
+ line: 266,
463
+ column: 6
464
+ },
465
+ end: {
466
+ line: 266,
467
+ column: 72
468
+ }
469
+ },
470
+ "45": {
471
+ start: {
472
+ line: 269,
473
+ column: 19
474
+ },
475
+ end: {
476
+ line: 272,
477
+ column: 5
478
+ }
479
+ },
480
+ "46": {
481
+ start: {
482
+ line: 274,
483
+ column: 4
484
+ },
485
+ end: {
486
+ line: 276,
487
+ column: 5
488
+ }
489
+ },
490
+ "47": {
491
+ start: {
492
+ line: 275,
493
+ column: 6
494
+ },
495
+ end: {
496
+ line: 275,
497
+ column: 27
498
+ }
499
+ },
500
+ "48": {
501
+ start: {
502
+ line: 278,
503
+ column: 4
504
+ },
505
+ end: {
506
+ line: 311,
507
+ column: 6
508
+ }
509
+ },
510
+ "49": {
511
+ start: {
512
+ line: 280,
513
+ column: 8
514
+ },
515
+ end: {
516
+ line: 307,
517
+ column: 10
518
+ }
519
+ },
520
+ "50": {
521
+ start: {
522
+ line: 281,
523
+ column: 10
524
+ },
525
+ end: {
526
+ line: 306,
527
+ column: 13
528
+ }
529
+ },
530
+ "51": {
531
+ start: {
532
+ line: 282,
533
+ column: 26
534
+ },
535
+ end: {
536
+ line: 282,
537
+ column: 51
538
+ }
539
+ },
540
+ "52": {
541
+ start: {
542
+ line: 283,
543
+ column: 27
544
+ },
545
+ end: {
546
+ line: 283,
547
+ column: 53
548
+ }
549
+ },
550
+ "53": {
551
+ start: {
552
+ line: 285,
553
+ column: 12
554
+ },
555
+ end: {
556
+ line: 287,
557
+ column: 13
558
+ }
559
+ },
560
+ "54": {
561
+ start: {
562
+ line: 286,
563
+ column: 14
564
+ },
565
+ end: {
566
+ line: 286,
567
+ column: 50
568
+ }
569
+ },
570
+ "55": {
571
+ start: {
572
+ line: 289,
573
+ column: 12
574
+ },
575
+ end: {
576
+ line: 305,
577
+ column: 13
578
+ }
579
+ },
580
+ "56": {
581
+ start: {
582
+ line: 290,
583
+ column: 26
584
+ },
585
+ end: {
586
+ line: 292,
587
+ column: 16
588
+ }
589
+ },
590
+ "57": {
591
+ start: {
592
+ line: 291,
593
+ column: 16
594
+ },
595
+ end: {
596
+ line: 291,
597
+ column: 52
598
+ }
599
+ },
600
+ "58": {
601
+ start: {
602
+ line: 294,
603
+ column: 14
604
+ },
605
+ end: {
606
+ line: 302,
607
+ column: 16
608
+ }
609
+ },
610
+ "59": {
611
+ start: {
612
+ line: 296,
613
+ column: 18
614
+ },
615
+ end: {
616
+ line: 298,
617
+ column: 19
618
+ }
619
+ },
620
+ "60": {
621
+ start: {
622
+ line: 297,
623
+ column: 20
624
+ },
625
+ end: {
626
+ line: 297,
627
+ column: 49
628
+ }
629
+ },
630
+ "61": {
631
+ start: {
632
+ line: 297,
633
+ column: 44
634
+ },
635
+ end: {
636
+ line: 297,
637
+ column: 47
638
+ }
639
+ },
640
+ "62": {
641
+ start: {
642
+ line: 300,
643
+ column: 18
644
+ },
645
+ end: {
646
+ line: 300,
647
+ column: 29
648
+ }
649
+ },
650
+ "63": {
651
+ start: {
652
+ line: 304,
653
+ column: 14
654
+ },
655
+ end: {
656
+ line: 304,
657
+ column: 39
658
+ }
659
+ },
660
+ "64": {
661
+ start: {
662
+ line: 309,
663
+ column: 8
664
+ },
665
+ end: {
666
+ line: 309,
667
+ column: 22
668
+ }
669
+ },
670
+ "65": {
671
+ start: {
672
+ line: 325,
673
+ column: 4
674
+ },
675
+ end: {
676
+ line: 327,
677
+ column: 5
678
+ }
679
+ },
680
+ "66": {
681
+ start: {
682
+ line: 326,
683
+ column: 6
684
+ },
685
+ end: {
686
+ line: 326,
687
+ column: 72
688
+ }
689
+ },
690
+ "67": {
691
+ start: {
692
+ line: 329,
693
+ column: 4
694
+ },
695
+ end: {
696
+ line: 331,
697
+ column: 7
698
+ }
699
+ },
700
+ "68": {
701
+ start: {
702
+ line: 344,
703
+ column: 4
704
+ },
705
+ end: {
706
+ line: 366,
707
+ column: 7
708
+ }
709
+ },
710
+ "69": {
711
+ start: {
712
+ line: 345,
713
+ column: 24
714
+ },
715
+ end: {
716
+ line: 345,
717
+ column: 30
718
+ }
719
+ },
720
+ "70": {
721
+ start: {
722
+ line: 347,
723
+ column: 6
724
+ },
725
+ end: {
726
+ line: 356,
727
+ column: 8
728
+ }
729
+ },
730
+ "71": {
731
+ start: {
732
+ line: 348,
733
+ column: 22
734
+ },
735
+ end: {
736
+ line: 348,
737
+ column: 35
738
+ }
739
+ },
740
+ "72": {
741
+ start: {
742
+ line: 349,
743
+ column: 8
744
+ },
745
+ end: {
746
+ line: 349,
747
+ column: 48
748
+ }
749
+ },
750
+ "73": {
751
+ start: {
752
+ line: 351,
753
+ column: 8
754
+ },
755
+ end: {
756
+ line: 353,
757
+ column: 9
758
+ }
759
+ },
760
+ "74": {
761
+ start: {
762
+ line: 352,
763
+ column: 10
764
+ },
765
+ end: {
766
+ line: 352,
767
+ column: 31
768
+ }
769
+ },
770
+ "75": {
771
+ start: {
772
+ line: 355,
773
+ column: 8
774
+ },
775
+ end: {
776
+ line: 355,
777
+ column: 39
778
+ }
779
+ },
780
+ "76": {
781
+ start: {
782
+ line: 358,
783
+ column: 6
784
+ },
785
+ end: {
786
+ line: 365,
787
+ column: 8
788
+ }
789
+ },
790
+ "77": {
791
+ start: {
792
+ line: 377,
793
+ column: 4
794
+ },
795
+ end: {
796
+ line: 379,
797
+ column: 6
798
+ }
799
+ }
800
+ },
801
+ fnMap: {
802
+ "0": {
803
+ name: "(anonymous_0)",
804
+ decl: {
805
+ start: {
806
+ line: 34,
807
+ column: 2
808
+ },
809
+ end: {
810
+ line: 34,
811
+ column: 3
812
+ }
813
+ },
814
+ loc: {
815
+ start: {
816
+ line: 34,
817
+ column: 65
818
+ },
819
+ end: {
820
+ line: 44,
821
+ column: 3
822
+ }
823
+ },
824
+ line: 34
825
+ },
826
+ "1": {
827
+ name: "(anonymous_1)",
828
+ decl: {
829
+ start: {
830
+ line: 67,
831
+ column: 2
832
+ },
833
+ end: {
834
+ line: 67,
835
+ column: 3
836
+ }
837
+ },
838
+ loc: {
839
+ start: {
840
+ line: 67,
841
+ column: 19
842
+ },
843
+ end: {
844
+ line: 77,
845
+ column: 3
846
+ }
847
+ },
848
+ line: 67
849
+ },
850
+ "2": {
851
+ name: "(anonymous_2)",
852
+ decl: {
853
+ start: {
854
+ line: 91,
855
+ column: 2
856
+ },
857
+ end: {
858
+ line: 91,
859
+ column: 3
860
+ }
861
+ },
862
+ loc: {
863
+ start: {
864
+ line: 91,
865
+ column: 10
866
+ },
867
+ end: {
868
+ line: 93,
869
+ column: 3
870
+ }
871
+ },
872
+ line: 91
873
+ },
874
+ "3": {
875
+ name: "(anonymous_3)",
876
+ decl: {
877
+ start: {
878
+ line: 104,
879
+ column: 13
880
+ },
881
+ end: {
882
+ line: 104,
883
+ column: 14
884
+ }
885
+ },
886
+ loc: {
887
+ start: {
888
+ line: 104,
889
+ column: 24
890
+ },
891
+ end: {
892
+ line: 108,
893
+ column: 3
894
+ }
895
+ },
896
+ line: 104
897
+ },
898
+ "4": {
899
+ name: "(anonymous_4)",
900
+ decl: {
901
+ start: {
902
+ line: 117,
903
+ column: 15
904
+ },
905
+ end: {
906
+ line: 117,
907
+ column: 16
908
+ }
909
+ },
910
+ loc: {
911
+ start: {
912
+ line: 117,
913
+ column: 28
914
+ },
915
+ end: {
916
+ line: 129,
917
+ column: 3
918
+ }
919
+ },
920
+ line: 117
921
+ },
922
+ "5": {
923
+ name: "(anonymous_5)",
924
+ decl: {
925
+ start: {
926
+ line: 153,
927
+ column: 2
928
+ },
929
+ end: {
930
+ line: 153,
931
+ column: 3
932
+ }
933
+ },
934
+ loc: {
935
+ start: {
936
+ line: 153,
937
+ column: 45
938
+ },
939
+ end: {
940
+ line: 177,
941
+ column: 3
942
+ }
943
+ },
944
+ line: 153
945
+ },
946
+ "6": {
947
+ name: "(anonymous_6)",
948
+ decl: {
949
+ start: {
950
+ line: 236,
951
+ column: 2
952
+ },
953
+ end: {
954
+ line: 236,
955
+ column: 3
956
+ }
957
+ },
958
+ loc: {
959
+ start: {
960
+ line: 236,
961
+ column: 68
962
+ },
963
+ end: {
964
+ line: 312,
965
+ column: 3
966
+ }
967
+ },
968
+ line: 236
969
+ },
970
+ "7": {
971
+ name: "(anonymous_7)",
972
+ decl: {
973
+ start: {
974
+ line: 279,
975
+ column: 6
976
+ },
977
+ end: {
978
+ line: 279,
979
+ column: 7
980
+ }
981
+ },
982
+ loc: {
983
+ start: {
984
+ line: 279,
985
+ column: 18
986
+ },
987
+ end: {
988
+ line: 310,
989
+ column: 7
990
+ }
991
+ },
992
+ line: 279
993
+ },
994
+ "8": {
995
+ name: "(anonymous_8)",
996
+ decl: {
997
+ start: {
998
+ line: 280,
999
+ column: 53
1000
+ },
1001
+ end: {
1002
+ line: 280,
1003
+ column: 54
1004
+ }
1005
+ },
1006
+ loc: {
1007
+ start: {
1008
+ line: 280,
1009
+ column: 78
1010
+ },
1011
+ end: {
1012
+ line: 307,
1013
+ column: 9
1014
+ }
1015
+ },
1016
+ line: 280
1017
+ },
1018
+ "9": {
1019
+ name: "(anonymous_9)",
1020
+ decl: {
1021
+ start: {
1022
+ line: 281,
1023
+ column: 29
1024
+ },
1025
+ end: {
1026
+ line: 281,
1027
+ column: 30
1028
+ }
1029
+ },
1030
+ loc: {
1031
+ start: {
1032
+ line: 281,
1033
+ column: 50
1034
+ },
1035
+ end: {
1036
+ line: 306,
1037
+ column: 11
1038
+ }
1039
+ },
1040
+ line: 281
1041
+ },
1042
+ "10": {
1043
+ name: "(anonymous_10)",
1044
+ decl: {
1045
+ start: {
1046
+ line: 290,
1047
+ column: 31
1048
+ },
1049
+ end: {
1050
+ line: 290,
1051
+ column: 32
1052
+ }
1053
+ },
1054
+ loc: {
1055
+ start: {
1056
+ line: 290,
1057
+ column: 37
1058
+ },
1059
+ end: {
1060
+ line: 292,
1061
+ column: 15
1062
+ }
1063
+ },
1064
+ line: 290
1065
+ },
1066
+ "11": {
1067
+ name: "(anonymous_11)",
1068
+ decl: {
1069
+ start: {
1070
+ line: 295,
1071
+ column: 64
1072
+ },
1073
+ end: {
1074
+ line: 295,
1075
+ column: 65
1076
+ }
1077
+ },
1078
+ loc: {
1079
+ start: {
1080
+ line: 295,
1081
+ column: 73
1082
+ },
1083
+ end: {
1084
+ line: 301,
1085
+ column: 17
1086
+ }
1087
+ },
1088
+ line: 295
1089
+ },
1090
+ "12": {
1091
+ name: "(anonymous_12)",
1092
+ decl: {
1093
+ start: {
1094
+ line: 297,
1095
+ column: 38
1096
+ },
1097
+ end: {
1098
+ line: 297,
1099
+ column: 39
1100
+ }
1101
+ },
1102
+ loc: {
1103
+ start: {
1104
+ line: 297,
1105
+ column: 44
1106
+ },
1107
+ end: {
1108
+ line: 297,
1109
+ column: 47
1110
+ }
1111
+ },
1112
+ line: 297
1113
+ },
1114
+ "13": {
1115
+ name: "(anonymous_13)",
1116
+ decl: {
1117
+ start: {
1118
+ line: 324,
1119
+ column: 2
1120
+ },
1121
+ end: {
1122
+ line: 324,
1123
+ column: 3
1124
+ }
1125
+ },
1126
+ loc: {
1127
+ start: {
1128
+ line: 324,
1129
+ column: 38
1130
+ },
1131
+ end: {
1132
+ line: 332,
1133
+ column: 3
1134
+ }
1135
+ },
1136
+ line: 324
1137
+ },
1138
+ "14": {
1139
+ name: "(anonymous_14)",
1140
+ decl: {
1141
+ start: {
1142
+ line: 343,
1143
+ column: 2
1144
+ },
1145
+ end: {
1146
+ line: 343,
1147
+ column: 3
1148
+ }
1149
+ },
1150
+ loc: {
1151
+ start: {
1152
+ line: 343,
1153
+ column: 48
1154
+ },
1155
+ end: {
1156
+ line: 367,
1157
+ column: 3
1158
+ }
1159
+ },
1160
+ line: 343
1161
+ },
1162
+ "15": {
1163
+ name: "(anonymous_15)",
1164
+ decl: {
1165
+ start: {
1166
+ line: 344,
1167
+ column: 23
1168
+ },
1169
+ end: {
1170
+ line: 344,
1171
+ column: 24
1172
+ }
1173
+ },
1174
+ loc: {
1175
+ start: {
1176
+ line: 344,
1177
+ column: 44
1178
+ },
1179
+ end: {
1180
+ line: 366,
1181
+ column: 5
1182
+ }
1183
+ },
1184
+ line: 344
1185
+ },
1186
+ "16": {
1187
+ name: "(anonymous_16)",
1188
+ decl: {
1189
+ start: {
1190
+ line: 347,
1191
+ column: 41
1192
+ },
1193
+ end: {
1194
+ line: 347,
1195
+ column: 42
1196
+ }
1197
+ },
1198
+ loc: {
1199
+ start: {
1200
+ line: 347,
1201
+ column: 54
1202
+ },
1203
+ end: {
1204
+ line: 356,
1205
+ column: 7
1206
+ }
1207
+ },
1208
+ line: 347
1209
+ },
1210
+ "17": {
1211
+ name: "(anonymous_17)",
1212
+ decl: {
1213
+ start: {
1214
+ line: 376,
1215
+ column: 2
1216
+ },
1217
+ end: {
1218
+ line: 376,
1219
+ column: 3
1220
+ }
1221
+ },
1222
+ loc: {
1223
+ start: {
1224
+ line: 376,
1225
+ column: 17
1226
+ },
1227
+ end: {
1228
+ line: 380,
1229
+ column: 3
1230
+ }
1231
+ },
1232
+ line: 376
1233
+ }
1234
+ },
1235
+ branchMap: {
1236
+ "0": {
1237
+ loc: {
1238
+ start: {
1239
+ line: 34,
1240
+ column: 41
1241
+ },
1242
+ end: {
1243
+ line: 34,
1244
+ column: 63
1245
+ }
1246
+ },
1247
+ type: "default-arg",
1248
+ locations: [{
1249
+ start: {
1250
+ line: 34,
1251
+ column: 59
1252
+ },
1253
+ end: {
1254
+ line: 34,
1255
+ column: 63
1256
+ }
1257
+ }],
1258
+ line: 34
1259
+ },
1260
+ "1": {
1261
+ loc: {
1262
+ start: {
1263
+ line: 40,
1264
+ column: 4
1265
+ },
1266
+ end: {
1267
+ line: 43,
1268
+ column: 5
1269
+ }
1270
+ },
1271
+ type: "if",
1272
+ locations: [{
1273
+ start: {
1274
+ line: 40,
1275
+ column: 4
1276
+ },
1277
+ end: {
1278
+ line: 43,
1279
+ column: 5
1280
+ }
1281
+ }, {
1282
+ start: {
1283
+ line: undefined,
1284
+ column: undefined
1285
+ },
1286
+ end: {
1287
+ line: undefined,
1288
+ column: undefined
1289
+ }
1290
+ }],
1291
+ line: 40
1292
+ },
1293
+ "2": {
1294
+ loc: {
1295
+ start: {
1296
+ line: 68,
1297
+ column: 4
1298
+ },
1299
+ end: {
1300
+ line: 70,
1301
+ column: 5
1302
+ }
1303
+ },
1304
+ type: "if",
1305
+ locations: [{
1306
+ start: {
1307
+ line: 68,
1308
+ column: 4
1309
+ },
1310
+ end: {
1311
+ line: 70,
1312
+ column: 5
1313
+ }
1314
+ }, {
1315
+ start: {
1316
+ line: undefined,
1317
+ column: undefined
1318
+ },
1319
+ end: {
1320
+ line: undefined,
1321
+ column: undefined
1322
+ }
1323
+ }],
1324
+ line: 68
1325
+ },
1326
+ "3": {
1327
+ loc: {
1328
+ start: {
1329
+ line: 72,
1330
+ column: 4
1331
+ },
1332
+ end: {
1333
+ line: 74,
1334
+ column: 5
1335
+ }
1336
+ },
1337
+ type: "if",
1338
+ locations: [{
1339
+ start: {
1340
+ line: 72,
1341
+ column: 4
1342
+ },
1343
+ end: {
1344
+ line: 74,
1345
+ column: 5
1346
+ }
1347
+ }, {
1348
+ start: {
1349
+ line: undefined,
1350
+ column: undefined
1351
+ },
1352
+ end: {
1353
+ line: undefined,
1354
+ column: undefined
1355
+ }
1356
+ }],
1357
+ line: 72
1358
+ },
1359
+ "4": {
1360
+ loc: {
1361
+ start: {
1362
+ line: 126,
1363
+ column: 4
1364
+ },
1365
+ end: {
1366
+ line: 128,
1367
+ column: 5
1368
+ }
1369
+ },
1370
+ type: "if",
1371
+ locations: [{
1372
+ start: {
1373
+ line: 126,
1374
+ column: 4
1375
+ },
1376
+ end: {
1377
+ line: 128,
1378
+ column: 5
1379
+ }
1380
+ }, {
1381
+ start: {
1382
+ line: undefined,
1383
+ column: undefined
1384
+ },
1385
+ end: {
1386
+ line: undefined,
1387
+ column: undefined
1388
+ }
1389
+ }],
1390
+ line: 126
1391
+ },
1392
+ "5": {
1393
+ loc: {
1394
+ start: {
1395
+ line: 154,
1396
+ column: 4
1397
+ },
1398
+ end: {
1399
+ line: 158,
1400
+ column: 5
1401
+ }
1402
+ },
1403
+ type: "if",
1404
+ locations: [{
1405
+ start: {
1406
+ line: 154,
1407
+ column: 4
1408
+ },
1409
+ end: {
1410
+ line: 158,
1411
+ column: 5
1412
+ }
1413
+ }, {
1414
+ start: {
1415
+ line: undefined,
1416
+ column: undefined
1417
+ },
1418
+ end: {
1419
+ line: undefined,
1420
+ column: undefined
1421
+ }
1422
+ }],
1423
+ line: 154
1424
+ },
1425
+ "6": {
1426
+ loc: {
1427
+ start: {
1428
+ line: 160,
1429
+ column: 4
1430
+ },
1431
+ end: {
1432
+ line: 162,
1433
+ column: 5
1434
+ }
1435
+ },
1436
+ type: "if",
1437
+ locations: [{
1438
+ start: {
1439
+ line: 160,
1440
+ column: 4
1441
+ },
1442
+ end: {
1443
+ line: 162,
1444
+ column: 5
1445
+ }
1446
+ }, {
1447
+ start: {
1448
+ line: undefined,
1449
+ column: undefined
1450
+ },
1451
+ end: {
1452
+ line: undefined,
1453
+ column: undefined
1454
+ }
1455
+ }],
1456
+ line: 160
1457
+ },
1458
+ "7": {
1459
+ loc: {
1460
+ start: {
1461
+ line: 164,
1462
+ column: 4
1463
+ },
1464
+ end: {
1465
+ line: 166,
1466
+ column: 5
1467
+ }
1468
+ },
1469
+ type: "if",
1470
+ locations: [{
1471
+ start: {
1472
+ line: 164,
1473
+ column: 4
1474
+ },
1475
+ end: {
1476
+ line: 166,
1477
+ column: 5
1478
+ }
1479
+ }, {
1480
+ start: {
1481
+ line: undefined,
1482
+ column: undefined
1483
+ },
1484
+ end: {
1485
+ line: undefined,
1486
+ column: undefined
1487
+ }
1488
+ }],
1489
+ line: 164
1490
+ },
1491
+ "8": {
1492
+ loc: {
1493
+ start: {
1494
+ line: 168,
1495
+ column: 4
1496
+ },
1497
+ end: {
1498
+ line: 170,
1499
+ column: 5
1500
+ }
1501
+ },
1502
+ type: "if",
1503
+ locations: [{
1504
+ start: {
1505
+ line: 168,
1506
+ column: 4
1507
+ },
1508
+ end: {
1509
+ line: 170,
1510
+ column: 5
1511
+ }
1512
+ }, {
1513
+ start: {
1514
+ line: undefined,
1515
+ column: undefined
1516
+ },
1517
+ end: {
1518
+ line: undefined,
1519
+ column: undefined
1520
+ }
1521
+ }],
1522
+ line: 168
1523
+ },
1524
+ "9": {
1525
+ loc: {
1526
+ start: {
1527
+ line: 237,
1528
+ column: 4
1529
+ },
1530
+ end: {
1531
+ line: 241,
1532
+ column: 5
1533
+ }
1534
+ },
1535
+ type: "if",
1536
+ locations: [{
1537
+ start: {
1538
+ line: 237,
1539
+ column: 4
1540
+ },
1541
+ end: {
1542
+ line: 241,
1543
+ column: 5
1544
+ }
1545
+ }, {
1546
+ start: {
1547
+ line: undefined,
1548
+ column: undefined
1549
+ },
1550
+ end: {
1551
+ line: undefined,
1552
+ column: undefined
1553
+ }
1554
+ }],
1555
+ line: 237
1556
+ },
1557
+ "10": {
1558
+ loc: {
1559
+ start: {
1560
+ line: 243,
1561
+ column: 4
1562
+ },
1563
+ end: {
1564
+ line: 247,
1565
+ column: 5
1566
+ }
1567
+ },
1568
+ type: "if",
1569
+ locations: [{
1570
+ start: {
1571
+ line: 243,
1572
+ column: 4
1573
+ },
1574
+ end: {
1575
+ line: 247,
1576
+ column: 5
1577
+ }
1578
+ }, {
1579
+ start: {
1580
+ line: undefined,
1581
+ column: undefined
1582
+ },
1583
+ end: {
1584
+ line: undefined,
1585
+ column: undefined
1586
+ }
1587
+ }],
1588
+ line: 243
1589
+ },
1590
+ "11": {
1591
+ loc: {
1592
+ start: {
1593
+ line: 249,
1594
+ column: 4
1595
+ },
1596
+ end: {
1597
+ line: 251,
1598
+ column: 5
1599
+ }
1600
+ },
1601
+ type: "if",
1602
+ locations: [{
1603
+ start: {
1604
+ line: 249,
1605
+ column: 4
1606
+ },
1607
+ end: {
1608
+ line: 251,
1609
+ column: 5
1610
+ }
1611
+ }, {
1612
+ start: {
1613
+ line: undefined,
1614
+ column: undefined
1615
+ },
1616
+ end: {
1617
+ line: undefined,
1618
+ column: undefined
1619
+ }
1620
+ }],
1621
+ line: 249
1622
+ },
1623
+ "12": {
1624
+ loc: {
1625
+ start: {
1626
+ line: 253,
1627
+ column: 4
1628
+ },
1629
+ end: {
1630
+ line: 257,
1631
+ column: 5
1632
+ }
1633
+ },
1634
+ type: "if",
1635
+ locations: [{
1636
+ start: {
1637
+ line: 253,
1638
+ column: 4
1639
+ },
1640
+ end: {
1641
+ line: 257,
1642
+ column: 5
1643
+ }
1644
+ }, {
1645
+ start: {
1646
+ line: undefined,
1647
+ column: undefined
1648
+ },
1649
+ end: {
1650
+ line: undefined,
1651
+ column: undefined
1652
+ }
1653
+ }],
1654
+ line: 253
1655
+ },
1656
+ "13": {
1657
+ loc: {
1658
+ start: {
1659
+ line: 259,
1660
+ column: 4
1661
+ },
1662
+ end: {
1663
+ line: 263,
1664
+ column: 5
1665
+ }
1666
+ },
1667
+ type: "if",
1668
+ locations: [{
1669
+ start: {
1670
+ line: 259,
1671
+ column: 4
1672
+ },
1673
+ end: {
1674
+ line: 263,
1675
+ column: 5
1676
+ }
1677
+ }, {
1678
+ start: {
1679
+ line: undefined,
1680
+ column: undefined
1681
+ },
1682
+ end: {
1683
+ line: undefined,
1684
+ column: undefined
1685
+ }
1686
+ }],
1687
+ line: 259
1688
+ },
1689
+ "14": {
1690
+ loc: {
1691
+ start: {
1692
+ line: 265,
1693
+ column: 4
1694
+ },
1695
+ end: {
1696
+ line: 267,
1697
+ column: 5
1698
+ }
1699
+ },
1700
+ type: "if",
1701
+ locations: [{
1702
+ start: {
1703
+ line: 265,
1704
+ column: 4
1705
+ },
1706
+ end: {
1707
+ line: 267,
1708
+ column: 5
1709
+ }
1710
+ }, {
1711
+ start: {
1712
+ line: undefined,
1713
+ column: undefined
1714
+ },
1715
+ end: {
1716
+ line: undefined,
1717
+ column: undefined
1718
+ }
1719
+ }],
1720
+ line: 265
1721
+ },
1722
+ "15": {
1723
+ loc: {
1724
+ start: {
1725
+ line: 274,
1726
+ column: 4
1727
+ },
1728
+ end: {
1729
+ line: 276,
1730
+ column: 5
1731
+ }
1732
+ },
1733
+ type: "if",
1734
+ locations: [{
1735
+ start: {
1736
+ line: 274,
1737
+ column: 4
1738
+ },
1739
+ end: {
1740
+ line: 276,
1741
+ column: 5
1742
+ }
1743
+ }, {
1744
+ start: {
1745
+ line: undefined,
1746
+ column: undefined
1747
+ },
1748
+ end: {
1749
+ line: undefined,
1750
+ column: undefined
1751
+ }
1752
+ }],
1753
+ line: 274
1754
+ },
1755
+ "16": {
1756
+ loc: {
1757
+ start: {
1758
+ line: 285,
1759
+ column: 12
1760
+ },
1761
+ end: {
1762
+ line: 287,
1763
+ column: 13
1764
+ }
1765
+ },
1766
+ type: "if",
1767
+ locations: [{
1768
+ start: {
1769
+ line: 285,
1770
+ column: 12
1771
+ },
1772
+ end: {
1773
+ line: 287,
1774
+ column: 13
1775
+ }
1776
+ }, {
1777
+ start: {
1778
+ line: undefined,
1779
+ column: undefined
1780
+ },
1781
+ end: {
1782
+ line: undefined,
1783
+ column: undefined
1784
+ }
1785
+ }],
1786
+ line: 285
1787
+ },
1788
+ "17": {
1789
+ loc: {
1790
+ start: {
1791
+ line: 296,
1792
+ column: 18
1793
+ },
1794
+ end: {
1795
+ line: 298,
1796
+ column: 19
1797
+ }
1798
+ },
1799
+ type: "if",
1800
+ locations: [{
1801
+ start: {
1802
+ line: 296,
1803
+ column: 18
1804
+ },
1805
+ end: {
1806
+ line: 298,
1807
+ column: 19
1808
+ }
1809
+ }, {
1810
+ start: {
1811
+ line: undefined,
1812
+ column: undefined
1813
+ },
1814
+ end: {
1815
+ line: undefined,
1816
+ column: undefined
1817
+ }
1818
+ }],
1819
+ line: 296
1820
+ },
1821
+ "18": {
1822
+ loc: {
1823
+ start: {
1824
+ line: 325,
1825
+ column: 4
1826
+ },
1827
+ end: {
1828
+ line: 327,
1829
+ column: 5
1830
+ }
1831
+ },
1832
+ type: "if",
1833
+ locations: [{
1834
+ start: {
1835
+ line: 325,
1836
+ column: 4
1837
+ },
1838
+ end: {
1839
+ line: 327,
1840
+ column: 5
1841
+ }
1842
+ }, {
1843
+ start: {
1844
+ line: undefined,
1845
+ column: undefined
1846
+ },
1847
+ end: {
1848
+ line: undefined,
1849
+ column: undefined
1850
+ }
1851
+ }],
1852
+ line: 325
1853
+ },
1854
+ "19": {
1855
+ loc: {
1856
+ start: {
1857
+ line: 351,
1858
+ column: 8
1859
+ },
1860
+ end: {
1861
+ line: 353,
1862
+ column: 9
1863
+ }
1864
+ },
1865
+ type: "if",
1866
+ locations: [{
1867
+ start: {
1868
+ line: 351,
1869
+ column: 8
1870
+ },
1871
+ end: {
1872
+ line: 353,
1873
+ column: 9
1874
+ }
1875
+ }, {
1876
+ start: {
1877
+ line: undefined,
1878
+ column: undefined
1879
+ },
1880
+ end: {
1881
+ line: undefined,
1882
+ column: undefined
1883
+ }
1884
+ }],
1885
+ line: 351
1886
+ },
1887
+ "20": {
1888
+ loc: {
1889
+ start: {
1890
+ line: 378,
1891
+ column: 6
1892
+ },
1893
+ end: {
1894
+ line: 378,
1895
+ column: 76
1896
+ }
1897
+ },
1898
+ type: "binary-expr",
1899
+ locations: [{
1900
+ start: {
1901
+ line: 378,
1902
+ column: 6
1903
+ },
1904
+ end: {
1905
+ line: 378,
1906
+ column: 21
1907
+ }
1908
+ }, {
1909
+ start: {
1910
+ line: 378,
1911
+ column: 25
1912
+ },
1913
+ end: {
1914
+ line: 378,
1915
+ column: 76
1916
+ }
1917
+ }],
1918
+ line: 378
1919
+ }
1920
+ },
1921
+ s: {
1922
+ "0": 0,
1923
+ "1": 0,
1924
+ "2": 0,
1925
+ "3": 0,
1926
+ "4": 0,
1927
+ "5": 0,
1928
+ "6": 0,
1929
+ "7": 0,
1930
+ "8": 0,
1931
+ "9": 0,
1932
+ "10": 0,
1933
+ "11": 0,
1934
+ "12": 0,
1935
+ "13": 0,
1936
+ "14": 0,
1937
+ "15": 0,
1938
+ "16": 0,
1939
+ "17": 0,
1940
+ "18": 0,
1941
+ "19": 0,
1942
+ "20": 0,
1943
+ "21": 0,
1944
+ "22": 0,
1945
+ "23": 0,
1946
+ "24": 0,
1947
+ "25": 0,
1948
+ "26": 0,
1949
+ "27": 0,
1950
+ "28": 0,
1951
+ "29": 0,
1952
+ "30": 0,
1953
+ "31": 0,
1954
+ "32": 0,
1955
+ "33": 0,
1956
+ "34": 0,
1957
+ "35": 0,
1958
+ "36": 0,
1959
+ "37": 0,
1960
+ "38": 0,
1961
+ "39": 0,
1962
+ "40": 0,
1963
+ "41": 0,
1964
+ "42": 0,
1965
+ "43": 0,
1966
+ "44": 0,
1967
+ "45": 0,
1968
+ "46": 0,
1969
+ "47": 0,
1970
+ "48": 0,
1971
+ "49": 0,
1972
+ "50": 0,
1973
+ "51": 0,
1974
+ "52": 0,
1975
+ "53": 0,
1976
+ "54": 0,
1977
+ "55": 0,
1978
+ "56": 0,
1979
+ "57": 0,
1980
+ "58": 0,
1981
+ "59": 0,
1982
+ "60": 0,
1983
+ "61": 0,
1984
+ "62": 0,
1985
+ "63": 0,
1986
+ "64": 0,
1987
+ "65": 0,
1988
+ "66": 0,
1989
+ "67": 0,
1990
+ "68": 0,
1991
+ "69": 0,
1992
+ "70": 0,
1993
+ "71": 0,
1994
+ "72": 0,
1995
+ "73": 0,
1996
+ "74": 0,
1997
+ "75": 0,
1998
+ "76": 0,
1999
+ "77": 0
2000
+ },
2001
+ f: {
2002
+ "0": 0,
2003
+ "1": 0,
2004
+ "2": 0,
2005
+ "3": 0,
2006
+ "4": 0,
2007
+ "5": 0,
2008
+ "6": 0,
2009
+ "7": 0,
2010
+ "8": 0,
2011
+ "9": 0,
2012
+ "10": 0,
2013
+ "11": 0,
2014
+ "12": 0,
2015
+ "13": 0,
2016
+ "14": 0,
2017
+ "15": 0,
2018
+ "16": 0,
2019
+ "17": 0
2020
+ },
2021
+ b: {
2022
+ "0": [0],
2023
+ "1": [0, 0],
2024
+ "2": [0, 0],
2025
+ "3": [0, 0],
2026
+ "4": [0, 0],
2027
+ "5": [0, 0],
2028
+ "6": [0, 0],
2029
+ "7": [0, 0],
2030
+ "8": [0, 0],
2031
+ "9": [0, 0],
2032
+ "10": [0, 0],
2033
+ "11": [0, 0],
2034
+ "12": [0, 0],
2035
+ "13": [0, 0],
2036
+ "14": [0, 0],
2037
+ "15": [0, 0],
2038
+ "16": [0, 0],
2039
+ "17": [0, 0],
2040
+ "18": [0, 0],
2041
+ "19": [0, 0],
2042
+ "20": [0, 0]
2043
+ },
2044
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
2045
+ hash: "1a9c510e85be0f75ec94b72f6bd03e919caab7bc"
2046
+ };
2047
+ var coverage = global[gcv] || (global[gcv] = {});
2048
+ if (!coverage[path] || coverage[path].hash !== hash) {
2049
+ coverage[path] = coverageData;
2050
+ }
2051
+ var actualCoverage = coverage[path];
2052
+ {
2053
+ // @ts-ignore
2054
+ cov_2fh0o593ie = function () {
2055
+ return actualCoverage;
2056
+ };
2057
+ }
2058
+ return actualCoverage;
2059
+ }
2060
+ cov_2fh0o593ie();
2061
+ 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; }
2062
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
2063
+ 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); }
19
2064
  /**
20
2065
  * The WebSocket Error Event
21
2066
  *
@@ -40,47 +2085,75 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
40
2085
  * environments. Documentation for browser environments is found under
41
2086
  * `BrowserWebSocketConnection`.
42
2087
  */
43
- var WebSocketConnection = function () {
2088
+ class WebSocketConnection {
44
2089
  /**
45
2090
  * @param {WebSocket} webSocket A WebSocket connection to the message bus
46
2091
  * @param {string} organizationId UUID corresponding with an organization
47
2092
  * @param {boolean} autoAcknowledge Whether the messages should be ACK'd explicitly or not
48
2093
  */
49
- function WebSocketConnection(webSocket, organizationId) {
50
- var _this = this;
51
-
52
- var autoAcknowledge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
53
-
54
- _classCallCheck(this, WebSocketConnection);
55
-
56
- this._onError = function (error) {
57
- _this._messageHandlers = {};
58
-
2094
+ constructor(webSocket, organizationId) {
2095
+ let autoAcknowledge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (cov_2fh0o593ie().b[0][0]++, true);
2096
+ /**
2097
+ * Handles WebSocket errors.
2098
+ * The `ws` library also closes the socket when an error occurs.
2099
+ * Since the socket connection closes, the jsonRpcId and message handlers are cleared
2100
+ *
2101
+ * @param {WebSocketError} error The error event thrown
2102
+ *
2103
+ * @private
2104
+ */
2105
+ _defineProperty(this, "_onError", (cov_2fh0o593ie().s[13]++, error => {
2106
+ cov_2fh0o593ie().f[3]++;
2107
+ cov_2fh0o593ie().s[14]++;
2108
+ this._messageHandlers = {};
2109
+ cov_2fh0o593ie().s[15]++;
59
2110
  console.log('Message Bus WebSocket Error: ', error);
60
- };
61
-
62
- this._onMessage = function (message) {
63
- var messageData = void 0;
64
-
2111
+ }));
2112
+ /**
2113
+ * Handles messages sent from the Message Bus WebSocket connection.
2114
+ *
2115
+ * @param {WebSocketMessage} message The message event recieved over the WebSocket connection
2116
+ *
2117
+ * @private
2118
+ */
2119
+ _defineProperty(this, "_onMessage", (cov_2fh0o593ie().s[16]++, message => {
2120
+ cov_2fh0o593ie().f[4]++;
2121
+ let messageData;
2122
+ cov_2fh0o593ie().s[17]++;
65
2123
  try {
2124
+ cov_2fh0o593ie().s[18]++;
66
2125
  messageData = JSON.parse(message.data);
67
2126
  } catch (err) {
2127
+ cov_2fh0o593ie().s[19]++;
68
2128
  throw new Error('Invalid JSON in message');
69
2129
  }
70
-
71
- if (_this._messageHandlers[messageData.id]) {
72
- _this._messageHandlers[messageData.id](messageData);
2130
+ cov_2fh0o593ie().s[20]++;
2131
+ if (this._messageHandlers[messageData.id]) {
2132
+ cov_2fh0o593ie().b[4][0]++;
2133
+ cov_2fh0o593ie().s[21]++;
2134
+ this._messageHandlers[messageData.id](messageData);
2135
+ } else {
2136
+ cov_2fh0o593ie().b[4][1]++;
73
2137
  }
74
- };
75
-
2138
+ }));
2139
+ cov_2fh0o593ie().f[0]++;
2140
+ cov_2fh0o593ie().s[0]++;
76
2141
  this._messageHandlers = {};
2142
+ cov_2fh0o593ie().s[1]++;
77
2143
  this._organizationId = organizationId;
2144
+ cov_2fh0o593ie().s[2]++;
78
2145
  this._webSocket = webSocket;
2146
+ cov_2fh0o593ie().s[3]++;
79
2147
  this._autoAck = autoAcknowledge;
80
-
2148
+ cov_2fh0o593ie().s[4]++;
81
2149
  if (this._webSocket) {
2150
+ cov_2fh0o593ie().b[1][0]++;
2151
+ cov_2fh0o593ie().s[5]++;
82
2152
  this._webSocket.addEventListener("error", this._onError);
2153
+ cov_2fh0o593ie().s[6]++;
83
2154
  this._webSocket.onmessage = this._onMessage;
2155
+ } else {
2156
+ cov_2fh0o593ie().b[1][1]++;
84
2157
  }
85
2158
  }
86
2159
 
@@ -105,320 +2178,369 @@ var WebSocketConnection = function () {
105
2178
  * })
106
2179
  * });
107
2180
  */
108
-
109
-
110
- _createClass(WebSocketConnection, [{
111
- key: 'authorize',
112
- value: function authorize(token) {
113
- if (!token) {
114
- return Promise.reject(new Error('A token is required for authorization'));
115
- }
116
-
117
- if (!this._isConnected()) {
118
- return Promise.reject(new Error('WebSocket connection not open'));
119
- }
120
-
121
- return this._registerSingleMessageHandler('Authorize', { token: token });
2181
+ authorize(token) {
2182
+ cov_2fh0o593ie().f[1]++;
2183
+ cov_2fh0o593ie().s[7]++;
2184
+ if (!token) {
2185
+ cov_2fh0o593ie().b[2][0]++;
2186
+ cov_2fh0o593ie().s[8]++;
2187
+ return Promise.reject(new Error('A token is required for authorization'));
2188
+ } else {
2189
+ cov_2fh0o593ie().b[2][1]++;
122
2190
  }
123
-
124
- /**
125
- * Closes the websocket connection
126
- *
127
- * @example
128
- * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
129
- * .then((webSocket) => {
130
- * webSocket.close()
131
- * })
132
- * .catch((errorEvent) => {
133
- * console.log(errorEvent);
134
- * });
135
- */
136
-
137
- }, {
138
- key: 'close',
139
- value: function close() {
140
- this._webSocket.close();
2191
+ cov_2fh0o593ie().s[9]++;
2192
+ if (!this._isConnected()) {
2193
+ cov_2fh0o593ie().b[3][0]++;
2194
+ cov_2fh0o593ie().s[10]++;
2195
+ return Promise.reject(new Error('WebSocket connection not open'));
2196
+ } else {
2197
+ cov_2fh0o593ie().b[3][1]++;
141
2198
  }
2199
+ cov_2fh0o593ie().s[11]++;
2200
+ return this._registerSingleMessageHandler('Authorize', {
2201
+ token
2202
+ });
2203
+ }
142
2204
 
143
- /**
144
- * Handles WebSocket errors.
145
- * The `ws` library also closes the socket when an error occurs.
146
- * Since the socket connection closes, the jsonRpcId and message handlers are cleared
147
- *
148
- * @param {WebSocketError} error The error event thrown
149
- *
150
- * @private
151
- */
152
-
153
-
154
- /**
155
- * Handles messages sent from the Message Bus WebSocket connection.
156
- *
157
- * @param {WebSocketMessage} message The message event recieved over the WebSocket connection
158
- *
159
- * @private
160
- */
161
-
162
- }, {
163
- key: 'publish',
164
-
165
-
166
- /**
167
- * Publishes a message to a specific channel on the message bus
168
- *
169
- * @param {string} serviceClientId Client ID of the message bus service
170
- * @param {string} channel Message bus channel the message is being sent to
171
- * @param {Any} message Message being sent to the message bus. Must be valid JSON.
172
- *
173
- * @returns {Promise}
174
- * @fulfill
175
- * @reject {error} The error event from the WebSocket or the error message from the message bus
176
- *
177
- * @example
178
- * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
179
- * .then((webSocket) => {
180
- * webSocket.publish('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', {"example": 1}).then(() => {
181
- * console.log("publish successful")
182
- * })
183
- * .catch((error) => {
184
- * console.log(error)
185
- * });
186
- * });
187
- */
188
- value: function publish(serviceClientId, channel, message) {
189
- if (!serviceClientId) {
190
- return Promise.reject(new Error('A service client id is required for publishing'));
191
- }
192
-
193
- if (!channel) {
194
- return Promise.reject(new Error('A channel is required for publishing'));
195
- }
196
-
197
- if (!message) {
198
- return Promise.reject(new Error('A message is required for publishing'));
199
- }
200
-
201
- if (!this._isConnected()) {
202
- return Promise.reject(new Error('WebSocket connection not open'));
203
- }
204
-
205
- return this._registerSingleMessageHandler('Publish', {
206
- service_id: serviceClientId,
207
- channel: channel,
208
- message: message
209
- });
2205
+ /**
2206
+ * Closes the websocket connection
2207
+ *
2208
+ * @example
2209
+ * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
2210
+ * .then((webSocket) => {
2211
+ * webSocket.close()
2212
+ * })
2213
+ * .catch((errorEvent) => {
2214
+ * console.log(errorEvent);
2215
+ * });
2216
+ */
2217
+ close() {
2218
+ cov_2fh0o593ie().f[2]++;
2219
+ cov_2fh0o593ie().s[12]++;
2220
+ this._webSocket.close();
2221
+ }
2222
+ /**
2223
+ * Publishes a message to a specific channel on the message bus
2224
+ *
2225
+ * @param {string} serviceClientId Client ID of the message bus service
2226
+ * @param {string} channel Message bus channel the message is being sent to
2227
+ * @param {Any} message Message being sent to the message bus. Must be valid JSON.
2228
+ *
2229
+ * @returns {Promise}
2230
+ * @fulfill
2231
+ * @reject {error} The error event from the WebSocket or the error message from the message bus
2232
+ *
2233
+ * @example
2234
+ * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
2235
+ * .then((webSocket) => {
2236
+ * webSocket.publish('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', {"example": 1}).then(() => {
2237
+ * console.log("publish successful")
2238
+ * })
2239
+ * .catch((error) => {
2240
+ * console.log(error)
2241
+ * });
2242
+ * });
2243
+ */
2244
+ publish(serviceClientId, channel, message) {
2245
+ cov_2fh0o593ie().f[5]++;
2246
+ cov_2fh0o593ie().s[22]++;
2247
+ if (!serviceClientId) {
2248
+ cov_2fh0o593ie().b[5][0]++;
2249
+ cov_2fh0o593ie().s[23]++;
2250
+ return Promise.reject(new Error('A service client id is required for publishing'));
2251
+ } else {
2252
+ cov_2fh0o593ie().b[5][1]++;
210
2253
  }
211
-
212
- /**
213
- * Subscribes to a specific channel on the message bus and handles messages as they are received. When the handler is
214
- * called, the message is automatically acknowledged after the message completes except whenever an Error is thrown.
215
- * The user can also programmatically control when the message is acknowledged by calling `ack` at any time.
216
- *
217
- * @param {string} serviceClientId Client ID of the message bus service
218
- * @param {string} channel Message bus channel the message is being sent to
219
- * @param {string} [group] A unique identifier for the subscriber that can be shared between connections
220
- * @param {function} handler A function that gets invoked with every received message
221
- * @param {function} errorHandler A function that gets invoked with every error
222
- *
223
- * @example
224
- * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
225
- * .then((webSocket) => {
226
- * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', 'test-sub', (message) => {
227
- * console.log('Message received: ', message);
228
- * }, (error) => {
229
- * console.log('Error received: ', error);
230
- * });
231
- * });
232
- *
233
- * @example
234
- * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
235
- * .then((webSocket) => {
236
- * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', 'test-sub', (message, ack) => {
237
- * console.log('Message received: ', message);
238
- *
239
- * ack();
240
- * }, (error) => {
241
- * console.log('Error received: ', error);
242
- * });
243
- * });
244
- *
245
- * @example
246
- * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
247
- * .then((webSocket) => {
248
- * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', (message) => {
249
- * return db.save(message);
250
- * }, (error) => {
251
- * console.log('Error received: ', error);
252
- * });
253
- * });
254
- *
255
- * @example
256
- * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
257
- * .then((webSocket) => {
258
- * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', (message, ack) => {
259
- * return db.save(message)
260
- * .then(ack)
261
- * .then(() => {
262
- * // additional processing
263
- * });
264
- * }, (error) => {
265
- * console.log('Error received: ', error);
266
- * });
267
- * });
268
- */
269
-
270
- }, {
271
- key: 'subscribe',
272
- value: function subscribe(serviceClientId, channel, group, handler, errorHandler) {
273
- var _this2 = this;
274
-
275
- if (typeof group === 'function') {
276
- errorHandler = handler;
277
- handler = group;
278
- group = null;
279
- }
280
-
281
- if (!serviceClientId) {
282
- return Promise.reject(new Error('A service client id is required for subscribing'));
283
- }
284
-
285
- if (!channel) {
286
- return Promise.reject(new Error('A channel is required for subscribing'));
287
- }
288
-
289
- if (!handler) {
290
- return Promise.reject(new Error('A message handler is required for subscribing'));
291
- }
292
-
293
- if (!errorHandler) {
294
- return Promise.reject(new Error('An error handler is required for subscribing'));
295
- }
296
-
297
- if (!this._isConnected()) {
298
- return Promise.reject(new Error('WebSocket connection not open'));
299
- }
300
-
301
- var params = {
302
- service_id: serviceClientId,
303
- channel: channel
304
- };
305
-
306
- if (group) {
307
- params.group = group;
308
- }
309
-
310
- return this._registerSingleMessageHandler('Subscribe', params).then(function (result) {
311
- _this2._messageHandlers[result.subscription] = function (subscriptionMessage) {
312
- return new Promise(function (resolve, reject) {
313
- var error = subscriptionMessage.error;
314
- var result = subscriptionMessage.result;
315
-
316
- if (error) {
317
- return resolve(errorHandler(error));
318
- }
319
-
320
- try {
321
- var ack = (0, _lodash2.default)(function () {
322
- return _this2._acknowledge(result.id);
323
- });
324
-
325
- return resolve(Promise.resolve(handler(result.body, ack)).then(function (res) {
326
- if (_this2._autoAck) {
327
- return ack().then(function () {
328
- return res;
329
- });
330
- }
331
-
332
- return res;
333
- }));
334
- } catch (throwable) {
335
- return reject(throwable);
336
- }
337
- });
338
- };
339
-
340
- return result;
341
- });
2254
+ cov_2fh0o593ie().s[24]++;
2255
+ if (!channel) {
2256
+ cov_2fh0o593ie().b[6][0]++;
2257
+ cov_2fh0o593ie().s[25]++;
2258
+ return Promise.reject(new Error('A channel is required for publishing'));
2259
+ } else {
2260
+ cov_2fh0o593ie().b[6][1]++;
342
2261
  }
343
-
344
- /**
345
- * Acknowledges a Message ID has been received and processed
346
- *
347
- * @returns {Promise}
348
- * @param acknowledgedMessageId {string} The Message ID that has been received
349
- * @fulfill
350
- * @reject {error} The error event from the WebSocket or the error message from the message bus
351
- *
352
- * @private
353
- */
354
-
355
- }, {
356
- key: '_acknowledge',
357
- value: function _acknowledge(acknowledgedMessageId) {
358
- if (!this._isConnected()) {
359
- return Promise.reject(new Error('WebSocket connection not open'));
360
- }
361
-
362
- return this._registerSingleMessageHandler('Acknowledge', {
363
- message_id: acknowledgedMessageId
364
- });
2262
+ cov_2fh0o593ie().s[26]++;
2263
+ if (!message) {
2264
+ cov_2fh0o593ie().b[7][0]++;
2265
+ cov_2fh0o593ie().s[27]++;
2266
+ return Promise.reject(new Error('A message is required for publishing'));
2267
+ } else {
2268
+ cov_2fh0o593ie().b[7][1]++;
365
2269
  }
2270
+ cov_2fh0o593ie().s[28]++;
2271
+ if (!this._isConnected()) {
2272
+ cov_2fh0o593ie().b[8][0]++;
2273
+ cov_2fh0o593ie().s[29]++;
2274
+ return Promise.reject(new Error('WebSocket connection not open'));
2275
+ } else {
2276
+ cov_2fh0o593ie().b[8][1]++;
2277
+ }
2278
+ cov_2fh0o593ie().s[30]++;
2279
+ return this._registerSingleMessageHandler('Publish', {
2280
+ service_id: serviceClientId,
2281
+ channel,
2282
+ message
2283
+ });
2284
+ }
366
2285
 
367
- /**
368
- * Registers a JSON RPC message handler that expects only one response.
369
- *
370
- * @returns {Promise}
371
- * @fulfill
372
- * @reject {error} The error event from the WebSocket or the error message from the message bus
373
- *
374
- * @private
375
- */
376
-
377
- }, {
378
- key: '_registerSingleMessageHandler',
379
- value: function _registerSingleMessageHandler(method, params) {
380
- var _this3 = this;
381
-
382
- return new Promise(function (resolve, reject) {
383
- var messageId = (0, _uuid.v4)();
384
-
385
- _this3._messageHandlers[messageId] = function (message) {
386
- var error = message.error;
387
- delete _this3._messageHandlers[messageId];
388
-
2286
+ /**
2287
+ * Subscribes to a specific channel on the message bus and handles messages as they are received. When the handler is
2288
+ * called, the message is automatically acknowledged after the message completes except whenever an Error is thrown.
2289
+ * The user can also programmatically control when the message is acknowledged by calling `ack` at any time.
2290
+ *
2291
+ * @param {string} serviceClientId Client ID of the message bus service
2292
+ * @param {string} channel Message bus channel the message is being sent to
2293
+ * @param {string} [group] A unique identifier for the subscriber that can be shared between connections
2294
+ * @param {function} handler A function that gets invoked with every received message
2295
+ * @param {function} errorHandler A function that gets invoked with every error
2296
+ *
2297
+ * @example
2298
+ * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
2299
+ * .then((webSocket) => {
2300
+ * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', 'test-sub', (message) => {
2301
+ * console.log('Message received: ', message);
2302
+ * }, (error) => {
2303
+ * console.log('Error received: ', error);
2304
+ * });
2305
+ * });
2306
+ *
2307
+ * @example
2308
+ * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
2309
+ * .then((webSocket) => {
2310
+ * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', 'test-sub', (message, ack) => {
2311
+ * console.log('Message received: ', message);
2312
+ *
2313
+ * ack();
2314
+ * }, (error) => {
2315
+ * console.log('Error received: ', error);
2316
+ * });
2317
+ * });
2318
+ *
2319
+ * @example
2320
+ * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
2321
+ * .then((webSocket) => {
2322
+ * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', (message) => {
2323
+ * return db.save(message);
2324
+ * }, (error) => {
2325
+ * console.log('Error received: ', error);
2326
+ * });
2327
+ * });
2328
+ *
2329
+ * @example
2330
+ * contxtSdk.bus.connect('4f0e51c6-728b-4892-9863-6d002e61204d')
2331
+ * .then((webSocket) => {
2332
+ * webSocket.subscribe('GCXd2bwE9fgvqxygrx2J7TkDJ3ef', 'feed:1', (message, ack) => {
2333
+ * return db.save(message)
2334
+ * .then(ack)
2335
+ * .then(() => {
2336
+ * // additional processing
2337
+ * });
2338
+ * }, (error) => {
2339
+ * console.log('Error received: ', error);
2340
+ * });
2341
+ * });
2342
+ */
2343
+ subscribe(serviceClientId, channel, group, handler, errorHandler) {
2344
+ cov_2fh0o593ie().f[6]++;
2345
+ cov_2fh0o593ie().s[31]++;
2346
+ if (typeof group === 'function') {
2347
+ cov_2fh0o593ie().b[9][0]++;
2348
+ cov_2fh0o593ie().s[32]++;
2349
+ errorHandler = handler;
2350
+ cov_2fh0o593ie().s[33]++;
2351
+ handler = group;
2352
+ cov_2fh0o593ie().s[34]++;
2353
+ group = null;
2354
+ } else {
2355
+ cov_2fh0o593ie().b[9][1]++;
2356
+ }
2357
+ cov_2fh0o593ie().s[35]++;
2358
+ if (!serviceClientId) {
2359
+ cov_2fh0o593ie().b[10][0]++;
2360
+ cov_2fh0o593ie().s[36]++;
2361
+ return Promise.reject(new Error('A service client id is required for subscribing'));
2362
+ } else {
2363
+ cov_2fh0o593ie().b[10][1]++;
2364
+ }
2365
+ cov_2fh0o593ie().s[37]++;
2366
+ if (!channel) {
2367
+ cov_2fh0o593ie().b[11][0]++;
2368
+ cov_2fh0o593ie().s[38]++;
2369
+ return Promise.reject(new Error('A channel is required for subscribing'));
2370
+ } else {
2371
+ cov_2fh0o593ie().b[11][1]++;
2372
+ }
2373
+ cov_2fh0o593ie().s[39]++;
2374
+ if (!handler) {
2375
+ cov_2fh0o593ie().b[12][0]++;
2376
+ cov_2fh0o593ie().s[40]++;
2377
+ return Promise.reject(new Error('A message handler is required for subscribing'));
2378
+ } else {
2379
+ cov_2fh0o593ie().b[12][1]++;
2380
+ }
2381
+ cov_2fh0o593ie().s[41]++;
2382
+ if (!errorHandler) {
2383
+ cov_2fh0o593ie().b[13][0]++;
2384
+ cov_2fh0o593ie().s[42]++;
2385
+ return Promise.reject(new Error('An error handler is required for subscribing'));
2386
+ } else {
2387
+ cov_2fh0o593ie().b[13][1]++;
2388
+ }
2389
+ cov_2fh0o593ie().s[43]++;
2390
+ if (!this._isConnected()) {
2391
+ cov_2fh0o593ie().b[14][0]++;
2392
+ cov_2fh0o593ie().s[44]++;
2393
+ return Promise.reject(new Error('WebSocket connection not open'));
2394
+ } else {
2395
+ cov_2fh0o593ie().b[14][1]++;
2396
+ }
2397
+ const params = (cov_2fh0o593ie().s[45]++, {
2398
+ service_id: serviceClientId,
2399
+ channel
2400
+ });
2401
+ cov_2fh0o593ie().s[46]++;
2402
+ if (group) {
2403
+ cov_2fh0o593ie().b[15][0]++;
2404
+ cov_2fh0o593ie().s[47]++;
2405
+ params.group = group;
2406
+ } else {
2407
+ cov_2fh0o593ie().b[15][1]++;
2408
+ }
2409
+ cov_2fh0o593ie().s[48]++;
2410
+ return this._registerSingleMessageHandler('Subscribe', params).then(result => {
2411
+ cov_2fh0o593ie().f[7]++;
2412
+ cov_2fh0o593ie().s[49]++;
2413
+ this._messageHandlers[result.subscription] = subscriptionMessage => {
2414
+ cov_2fh0o593ie().f[8]++;
2415
+ cov_2fh0o593ie().s[50]++;
2416
+ return new Promise((resolve, reject) => {
2417
+ cov_2fh0o593ie().f[9]++;
2418
+ const error = (cov_2fh0o593ie().s[51]++, subscriptionMessage.error);
2419
+ const result = (cov_2fh0o593ie().s[52]++, subscriptionMessage.result);
2420
+ cov_2fh0o593ie().s[53]++;
389
2421
  if (error) {
390
- return reject(error);
2422
+ cov_2fh0o593ie().b[16][0]++;
2423
+ cov_2fh0o593ie().s[54]++;
2424
+ return resolve(errorHandler(error));
2425
+ } else {
2426
+ cov_2fh0o593ie().b[16][1]++;
391
2427
  }
2428
+ cov_2fh0o593ie().s[55]++;
2429
+ try {
2430
+ const ack = (cov_2fh0o593ie().s[56]++, (0, _lodash.default)(() => {
2431
+ cov_2fh0o593ie().f[10]++;
2432
+ cov_2fh0o593ie().s[57]++;
2433
+ return this._acknowledge(result.id);
2434
+ }));
2435
+ cov_2fh0o593ie().s[58]++;
2436
+ return resolve(Promise.resolve(handler(result.body, ack)).then(res => {
2437
+ cov_2fh0o593ie().f[11]++;
2438
+ cov_2fh0o593ie().s[59]++;
2439
+ if (this._autoAck) {
2440
+ cov_2fh0o593ie().b[17][0]++;
2441
+ cov_2fh0o593ie().s[60]++;
2442
+ return ack().then(() => {
2443
+ cov_2fh0o593ie().f[12]++;
2444
+ cov_2fh0o593ie().s[61]++;
2445
+ return res;
2446
+ });
2447
+ } else {
2448
+ cov_2fh0o593ie().b[17][1]++;
2449
+ }
2450
+ cov_2fh0o593ie().s[62]++;
2451
+ return res;
2452
+ }));
2453
+ } catch (throwable) {
2454
+ cov_2fh0o593ie().s[63]++;
2455
+ return reject(throwable);
2456
+ }
2457
+ });
2458
+ };
2459
+ cov_2fh0o593ie().s[64]++;
2460
+ return result;
2461
+ });
2462
+ }
392
2463
 
393
- return resolve(message.result);
394
- };
395
-
396
- _this3._webSocket.send(JSON.stringify({
397
- jsonrpc: '2.0',
398
- method: 'MessageBus.' + method,
399
- params: params,
400
- id: messageId
401
- }));
402
- });
403
- }
404
-
405
- /**
406
- * Checks whether the current WebSocket is connected to the Message Bus service.
407
- *
408
- * @returns {boolean} Whether the WebSocket is connected to the Message Bus service
409
- *
410
- * @private
411
- */
412
-
413
- }, {
414
- key: '_isConnected',
415
- value: function _isConnected() {
416
- return this._webSocket && this._webSocket.readyState === this._webSocket.OPEN;
2464
+ /**
2465
+ * Acknowledges a Message ID has been received and processed
2466
+ *
2467
+ * @returns {Promise}
2468
+ * @param acknowledgedMessageId {string} The Message ID that has been received
2469
+ * @fulfill
2470
+ * @reject {error} The error event from the WebSocket or the error message from the message bus
2471
+ *
2472
+ * @private
2473
+ */
2474
+ _acknowledge(acknowledgedMessageId) {
2475
+ cov_2fh0o593ie().f[13]++;
2476
+ cov_2fh0o593ie().s[65]++;
2477
+ if (!this._isConnected()) {
2478
+ cov_2fh0o593ie().b[18][0]++;
2479
+ cov_2fh0o593ie().s[66]++;
2480
+ return Promise.reject(new Error('WebSocket connection not open'));
2481
+ } else {
2482
+ cov_2fh0o593ie().b[18][1]++;
417
2483
  }
418
- }]);
2484
+ cov_2fh0o593ie().s[67]++;
2485
+ return this._registerSingleMessageHandler('Acknowledge', {
2486
+ message_id: acknowledgedMessageId
2487
+ });
2488
+ }
419
2489
 
420
- return WebSocketConnection;
421
- }();
2490
+ /**
2491
+ * Registers a JSON RPC message handler that expects only one response.
2492
+ *
2493
+ * @returns {Promise}
2494
+ * @fulfill
2495
+ * @reject {error} The error event from the WebSocket or the error message from the message bus
2496
+ *
2497
+ * @private
2498
+ */
2499
+ _registerSingleMessageHandler(method, params) {
2500
+ cov_2fh0o593ie().f[14]++;
2501
+ cov_2fh0o593ie().s[68]++;
2502
+ return new Promise((resolve, reject) => {
2503
+ cov_2fh0o593ie().f[15]++;
2504
+ const messageId = (cov_2fh0o593ie().s[69]++, (0, _uuid.v4)());
2505
+ cov_2fh0o593ie().s[70]++;
2506
+ this._messageHandlers[messageId] = message => {
2507
+ cov_2fh0o593ie().f[16]++;
2508
+ const error = (cov_2fh0o593ie().s[71]++, message.error);
2509
+ cov_2fh0o593ie().s[72]++;
2510
+ delete this._messageHandlers[messageId];
2511
+ cov_2fh0o593ie().s[73]++;
2512
+ if (error) {
2513
+ cov_2fh0o593ie().b[19][0]++;
2514
+ cov_2fh0o593ie().s[74]++;
2515
+ return reject(error);
2516
+ } else {
2517
+ cov_2fh0o593ie().b[19][1]++;
2518
+ }
2519
+ cov_2fh0o593ie().s[75]++;
2520
+ return resolve(message.result);
2521
+ };
2522
+ cov_2fh0o593ie().s[76]++;
2523
+ this._webSocket.send(JSON.stringify({
2524
+ jsonrpc: '2.0',
2525
+ method: `MessageBus.${method}`,
2526
+ params,
2527
+ id: messageId
2528
+ }));
2529
+ });
2530
+ }
422
2531
 
423
- exports.default = WebSocketConnection;
2532
+ /**
2533
+ * Checks whether the current WebSocket is connected to the Message Bus service.
2534
+ *
2535
+ * @returns {boolean} Whether the WebSocket is connected to the Message Bus service
2536
+ *
2537
+ * @private
2538
+ */
2539
+ _isConnected() {
2540
+ cov_2fh0o593ie().f[17]++;
2541
+ cov_2fh0o593ie().s[77]++;
2542
+ return (cov_2fh0o593ie().b[20][0]++, this._webSocket) && (cov_2fh0o593ie().b[20][1]++, this._webSocket.readyState === this._webSocket.OPEN);
2543
+ }
2544
+ }
2545
+ var _default = exports.default = WebSocketConnection;
424
2546
  //# sourceMappingURL=webSocketConnection.js.map