@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
package/lib/bus/index.js CHANGED
@@ -1,27 +1,796 @@
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 _ws = require('ws');
10
-
11
- var _ws2 = _interopRequireDefault(_ws);
12
-
13
- var _channels = require('./channels');
14
-
15
- var _channels2 = _interopRequireDefault(_channels);
16
-
17
- var _webSocketConnection = require('./webSocketConnection');
18
-
19
- var _webSocketConnection2 = _interopRequireDefault(_webSocketConnection);
20
-
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
-
23
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
-
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.promise.js");
8
+ var _ws = _interopRequireDefault(require("ws"));
9
+ var _channels = _interopRequireDefault(require("./channels"));
10
+ var _webSocketConnection = _interopRequireDefault(require("./webSocketConnection"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function cov_1wasg7lsrg() {
13
+ var path = "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/bus/index.js";
14
+ var hash = "eeed1619552842c41d2f216c6fb12670fda24b64";
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/index.js",
19
+ statementMap: {
20
+ "0": {
21
+ start: {
22
+ line: 48,
23
+ column: 25
24
+ },
25
+ end: {
26
+ line: 50,
27
+ column: 1
28
+ }
29
+ },
30
+ "1": {
31
+ start: {
32
+ line: 66,
33
+ column: 20
34
+ },
35
+ end: {
36
+ line: 66,
37
+ column: 54
38
+ }
39
+ },
40
+ "2": {
41
+ start: {
42
+ line: 67,
43
+ column: 29
44
+ },
45
+ end: {
46
+ line: 67,
47
+ column: 68
48
+ }
49
+ },
50
+ "3": {
51
+ start: {
52
+ line: 69,
53
+ column: 4
54
+ },
55
+ end: {
56
+ line: 69,
57
+ column: 46
58
+ }
59
+ },
60
+ "4": {
61
+ start: {
62
+ line: 70,
63
+ column: 4
64
+ },
65
+ end: {
66
+ line: 70,
67
+ column: 28
68
+ }
69
+ },
70
+ "5": {
71
+ start: {
72
+ line: 71,
73
+ column: 4
74
+ },
75
+ end: {
76
+ line: 71,
77
+ column: 28
78
+ }
79
+ },
80
+ "6": {
81
+ start: {
82
+ line: 72,
83
+ column: 4
84
+ },
85
+ end: {
86
+ line: 72,
87
+ column: 20
88
+ }
89
+ },
90
+ "7": {
91
+ start: {
92
+ line: 73,
93
+ column: 4
94
+ },
95
+ end: {
96
+ line: 73,
97
+ column: 26
98
+ }
99
+ },
100
+ "8": {
101
+ start: {
102
+ line: 74,
103
+ column: 4
104
+ },
105
+ end: {
106
+ line: 74,
107
+ column: 63
108
+ }
109
+ },
110
+ "9": {
111
+ start: {
112
+ line: 76,
113
+ column: 4
114
+ },
115
+ end: {
116
+ line: 76,
117
+ column: 56
118
+ }
119
+ },
120
+ "10": {
121
+ start: {
122
+ line: 105,
123
+ column: 4
124
+ },
125
+ end: {
126
+ line: 162,
127
+ column: 7
128
+ }
129
+ },
130
+ "11": {
131
+ start: {
132
+ line: 106,
133
+ column: 6
134
+ },
135
+ end: {
136
+ line: 108,
137
+ column: 7
138
+ }
139
+ },
140
+ "12": {
141
+ start: {
142
+ line: 107,
143
+ column: 8
144
+ },
145
+ end: {
146
+ line: 107,
147
+ column: 57
148
+ }
149
+ },
150
+ "13": {
151
+ start: {
152
+ line: 110,
153
+ column: 6
154
+ },
155
+ end: {
156
+ line: 161,
157
+ column: 11
158
+ }
159
+ },
160
+ "14": {
161
+ start: {
162
+ line: 113,
163
+ column: 21
164
+ },
165
+ end: {
166
+ line: 121,
167
+ column: 11
168
+ }
169
+ },
170
+ "15": {
171
+ start: {
172
+ line: 123,
173
+ column: 10
174
+ },
175
+ end: {
176
+ line: 131,
177
+ column: 12
178
+ }
179
+ },
180
+ "16": {
181
+ start: {
182
+ line: 124,
183
+ column: 12
184
+ },
185
+ end: {
186
+ line: 128,
187
+ column: 14
188
+ }
189
+ },
190
+ "17": {
191
+ start: {
192
+ line: 130,
193
+ column: 12
194
+ },
195
+ end: {
196
+ line: 130,
197
+ column: 54
198
+ }
199
+ },
200
+ "18": {
201
+ start: {
202
+ line: 133,
203
+ column: 10
204
+ },
205
+ end: {
206
+ line: 142,
207
+ column: 13
208
+ }
209
+ },
210
+ "19": {
211
+ start: {
212
+ line: 134,
213
+ column: 12
214
+ },
215
+ end: {
216
+ line: 134,
217
+ column: 52
218
+ }
219
+ },
220
+ "20": {
221
+ start: {
222
+ line: 135,
223
+ column: 12
224
+ },
225
+ end: {
226
+ line: 141,
227
+ column: 13
228
+ }
229
+ },
230
+ "21": {
231
+ start: {
232
+ line: 136,
233
+ column: 14
234
+ },
235
+ end: {
236
+ line: 140,
237
+ column: 15
238
+ }
239
+ },
240
+ "22": {
241
+ start: {
242
+ line: 137,
243
+ column: 16
244
+ },
245
+ end: {
246
+ line: 137,
247
+ column: 47
248
+ }
249
+ },
250
+ "23": {
251
+ start: {
252
+ line: 139,
253
+ column: 16
254
+ },
255
+ end: {
256
+ line: 139,
257
+ column: 79
258
+ }
259
+ },
260
+ "24": {
261
+ start: {
262
+ line: 144,
263
+ column: 10
264
+ },
265
+ end: {
266
+ line: 157,
267
+ column: 13
268
+ }
269
+ },
270
+ "25": {
271
+ start: {
272
+ line: 145,
273
+ column: 30
274
+ },
275
+ end: {
276
+ line: 145,
277
+ column: 70
278
+ }
279
+ },
280
+ "26": {
281
+ start: {
282
+ line: 146,
283
+ column: 12
284
+ },
285
+ end: {
286
+ line: 146,
287
+ column: 52
288
+ }
289
+ },
290
+ "27": {
291
+ start: {
292
+ line: 147,
293
+ column: 12
294
+ },
295
+ end: {
296
+ line: 149,
297
+ column: 13
298
+ }
299
+ },
300
+ "28": {
301
+ start: {
302
+ line: 148,
303
+ column: 14
304
+ },
305
+ end: {
306
+ line: 148,
307
+ column: 32
308
+ }
309
+ },
310
+ "29": {
311
+ start: {
312
+ line: 150,
313
+ column: 12
314
+ },
315
+ end: {
316
+ line: 156,
317
+ column: 13
318
+ }
319
+ },
320
+ "30": {
321
+ start: {
322
+ line: 151,
323
+ column: 14
324
+ },
325
+ end: {
326
+ line: 155,
327
+ column: 15
328
+ }
329
+ },
330
+ "31": {
331
+ start: {
332
+ line: 152,
333
+ column: 16
334
+ },
335
+ end: {
336
+ line: 152,
337
+ column: 52
338
+ }
339
+ },
340
+ "32": {
341
+ start: {
342
+ line: 154,
343
+ column: 16
344
+ },
345
+ end: {
346
+ line: 154,
347
+ column: 79
348
+ }
349
+ },
350
+ "33": {
351
+ start: {
352
+ line: 160,
353
+ column: 10
354
+ },
355
+ end: {
356
+ line: 160,
357
+ column: 22
358
+ }
359
+ },
360
+ "34": {
361
+ start: {
362
+ line: 177,
363
+ column: 4
364
+ },
365
+ end: {
366
+ line: 177,
367
+ column: 44
368
+ }
369
+ }
370
+ },
371
+ fnMap: {
372
+ "0": {
373
+ name: "(anonymous_0)",
374
+ decl: {
375
+ start: {
376
+ line: 65,
377
+ column: 2
378
+ },
379
+ end: {
380
+ line: 65,
381
+ column: 3
382
+ }
383
+ },
384
+ loc: {
385
+ start: {
386
+ line: 65,
387
+ column: 36
388
+ },
389
+ end: {
390
+ line: 77,
391
+ column: 3
392
+ }
393
+ },
394
+ line: 65
395
+ },
396
+ "1": {
397
+ name: "(anonymous_1)",
398
+ decl: {
399
+ start: {
400
+ line: 104,
401
+ column: 2
402
+ },
403
+ end: {
404
+ line: 104,
405
+ column: 3
406
+ }
407
+ },
408
+ loc: {
409
+ start: {
410
+ line: 104,
411
+ column: 44
412
+ },
413
+ end: {
414
+ line: 163,
415
+ column: 3
416
+ }
417
+ },
418
+ line: 104
419
+ },
420
+ "2": {
421
+ name: "(anonymous_2)",
422
+ decl: {
423
+ start: {
424
+ line: 105,
425
+ column: 23
426
+ },
427
+ end: {
428
+ line: 105,
429
+ column: 24
430
+ }
431
+ },
432
+ loc: {
433
+ start: {
434
+ line: 105,
435
+ column: 44
436
+ },
437
+ end: {
438
+ line: 162,
439
+ column: 5
440
+ }
441
+ },
442
+ line: 105
443
+ },
444
+ "3": {
445
+ name: "(anonymous_3)",
446
+ decl: {
447
+ start: {
448
+ line: 112,
449
+ column: 14
450
+ },
451
+ end: {
452
+ line: 112,
453
+ column: 15
454
+ }
455
+ },
456
+ loc: {
457
+ start: {
458
+ line: 112,
459
+ column: 28
460
+ },
461
+ end: {
462
+ line: 158,
463
+ column: 9
464
+ }
465
+ },
466
+ line: 112
467
+ },
468
+ "4": {
469
+ name: "(anonymous_4)",
470
+ decl: {
471
+ start: {
472
+ line: 123,
473
+ column: 22
474
+ },
475
+ end: {
476
+ line: 123,
477
+ column: 23
478
+ }
479
+ },
480
+ loc: {
481
+ start: {
482
+ line: 123,
483
+ column: 33
484
+ },
485
+ end: {
486
+ line: 131,
487
+ column: 11
488
+ }
489
+ },
490
+ line: 123
491
+ },
492
+ "5": {
493
+ name: "(anonymous_5)",
494
+ decl: {
495
+ start: {
496
+ line: 133,
497
+ column: 39
498
+ },
499
+ end: {
500
+ line: 133,
501
+ column: 40
502
+ }
503
+ },
504
+ loc: {
505
+ start: {
506
+ line: 133,
507
+ column: 50
508
+ },
509
+ end: {
510
+ line: 142,
511
+ column: 11
512
+ }
513
+ },
514
+ line: 133
515
+ },
516
+ "6": {
517
+ name: "(anonymous_6)",
518
+ decl: {
519
+ start: {
520
+ line: 144,
521
+ column: 39
522
+ },
523
+ end: {
524
+ line: 144,
525
+ column: 40
526
+ }
527
+ },
528
+ loc: {
529
+ start: {
530
+ line: 144,
531
+ column: 55
532
+ },
533
+ end: {
534
+ line: 157,
535
+ column: 11
536
+ }
537
+ },
538
+ line: 144
539
+ },
540
+ "7": {
541
+ name: "(anonymous_7)",
542
+ decl: {
543
+ start: {
544
+ line: 159,
545
+ column: 15
546
+ },
547
+ end: {
548
+ line: 159,
549
+ column: 16
550
+ }
551
+ },
552
+ loc: {
553
+ start: {
554
+ line: 159,
555
+ column: 24
556
+ },
557
+ end: {
558
+ line: 161,
559
+ column: 9
560
+ }
561
+ },
562
+ line: 159
563
+ },
564
+ "8": {
565
+ name: "(anonymous_8)",
566
+ decl: {
567
+ start: {
568
+ line: 176,
569
+ column: 2
570
+ },
571
+ end: {
572
+ line: 176,
573
+ column: 3
574
+ }
575
+ },
576
+ loc: {
577
+ start: {
578
+ line: 176,
579
+ column: 41
580
+ },
581
+ end: {
582
+ line: 178,
583
+ column: 3
584
+ }
585
+ },
586
+ line: 176
587
+ }
588
+ },
589
+ branchMap: {
590
+ "0": {
591
+ loc: {
592
+ start: {
593
+ line: 106,
594
+ column: 6
595
+ },
596
+ end: {
597
+ line: 108,
598
+ column: 7
599
+ }
600
+ },
601
+ type: "if",
602
+ locations: [{
603
+ start: {
604
+ line: 106,
605
+ column: 6
606
+ },
607
+ end: {
608
+ line: 108,
609
+ column: 7
610
+ }
611
+ }, {
612
+ start: {
613
+ line: undefined,
614
+ column: undefined
615
+ },
616
+ end: {
617
+ line: undefined,
618
+ column: undefined
619
+ }
620
+ }],
621
+ line: 106
622
+ },
623
+ "1": {
624
+ loc: {
625
+ start: {
626
+ line: 135,
627
+ column: 12
628
+ },
629
+ end: {
630
+ line: 141,
631
+ column: 13
632
+ }
633
+ },
634
+ type: "if",
635
+ locations: [{
636
+ start: {
637
+ line: 135,
638
+ column: 12
639
+ },
640
+ end: {
641
+ line: 141,
642
+ column: 13
643
+ }
644
+ }, {
645
+ start: {
646
+ line: undefined,
647
+ column: undefined
648
+ },
649
+ end: {
650
+ line: undefined,
651
+ column: undefined
652
+ }
653
+ }],
654
+ line: 135
655
+ },
656
+ "2": {
657
+ loc: {
658
+ start: {
659
+ line: 147,
660
+ column: 12
661
+ },
662
+ end: {
663
+ line: 149,
664
+ column: 13
665
+ }
666
+ },
667
+ type: "if",
668
+ locations: [{
669
+ start: {
670
+ line: 147,
671
+ column: 12
672
+ },
673
+ end: {
674
+ line: 149,
675
+ column: 13
676
+ }
677
+ }, {
678
+ start: {
679
+ line: undefined,
680
+ column: undefined
681
+ },
682
+ end: {
683
+ line: undefined,
684
+ column: undefined
685
+ }
686
+ }],
687
+ line: 147
688
+ },
689
+ "3": {
690
+ loc: {
691
+ start: {
692
+ line: 150,
693
+ column: 12
694
+ },
695
+ end: {
696
+ line: 156,
697
+ column: 13
698
+ }
699
+ },
700
+ type: "if",
701
+ locations: [{
702
+ start: {
703
+ line: 150,
704
+ column: 12
705
+ },
706
+ end: {
707
+ line: 156,
708
+ column: 13
709
+ }
710
+ }, {
711
+ start: {
712
+ line: undefined,
713
+ column: undefined
714
+ },
715
+ end: {
716
+ line: undefined,
717
+ column: undefined
718
+ }
719
+ }],
720
+ line: 150
721
+ }
722
+ },
723
+ s: {
724
+ "0": 0,
725
+ "1": 0,
726
+ "2": 0,
727
+ "3": 0,
728
+ "4": 0,
729
+ "5": 0,
730
+ "6": 0,
731
+ "7": 0,
732
+ "8": 0,
733
+ "9": 0,
734
+ "10": 0,
735
+ "11": 0,
736
+ "12": 0,
737
+ "13": 0,
738
+ "14": 0,
739
+ "15": 0,
740
+ "16": 0,
741
+ "17": 0,
742
+ "18": 0,
743
+ "19": 0,
744
+ "20": 0,
745
+ "21": 0,
746
+ "22": 0,
747
+ "23": 0,
748
+ "24": 0,
749
+ "25": 0,
750
+ "26": 0,
751
+ "27": 0,
752
+ "28": 0,
753
+ "29": 0,
754
+ "30": 0,
755
+ "31": 0,
756
+ "32": 0,
757
+ "33": 0,
758
+ "34": 0
759
+ },
760
+ f: {
761
+ "0": 0,
762
+ "1": 0,
763
+ "2": 0,
764
+ "3": 0,
765
+ "4": 0,
766
+ "5": 0,
767
+ "6": 0,
768
+ "7": 0,
769
+ "8": 0
770
+ },
771
+ b: {
772
+ "0": [0, 0],
773
+ "1": [0, 0],
774
+ "2": [0, 0],
775
+ "3": [0, 0]
776
+ },
777
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
778
+ hash: "eeed1619552842c41d2f216c6fb12670fda24b64"
779
+ };
780
+ var coverage = global[gcv] || (global[gcv] = {});
781
+ if (!coverage[path] || coverage[path].hash !== hash) {
782
+ coverage[path] = coverageData;
783
+ }
784
+ var actualCoverage = coverage[path];
785
+ {
786
+ // @ts-ignore
787
+ cov_1wasg7lsrg = function () {
788
+ return actualCoverage;
789
+ };
790
+ }
791
+ return actualCoverage;
792
+ }
793
+ cov_1wasg7lsrg();
25
794
  /**
26
795
  * The raw WebSocket created by ws
27
796
  *
@@ -64,9 +833,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
64
833
  /**
65
834
  * @type {BusConfig}
66
835
  */
67
- var defaultBusConfig = {
836
+ const defaultBusConfig = (cov_1wasg7lsrg().s[0]++, {
68
837
  autoAcknowledge: true
69
- };
838
+ });
70
839
 
71
840
  /**
72
841
  * Module that provides access to the message bus. This is for Node
@@ -75,27 +844,30 @@ var defaultBusConfig = {
75
844
  *
76
845
  * @typicalname contxtSdk.bus
77
846
  */
78
-
79
- var Bus = function () {
847
+ class Bus {
80
848
  /**
81
849
  * @param {Object} sdk An instance of the SDK so the module can communicate with other modules
82
850
  * @param {Object} request An instance of the request module tied to this module's audience.
83
851
  * @param {BusConfig} config A config object for the Bus instance
84
852
  */
85
- function Bus(sdk, request, config) {
86
- _classCallCheck(this, Bus);
87
-
88
- var baseUrl = '' + sdk.config.audiences.bus.host;
89
- var baseWebSocketUrl = '' + sdk.config.audiences.bus.webSocket;
90
-
853
+ constructor(sdk, request, config) {
854
+ cov_1wasg7lsrg().f[0]++;
855
+ const baseUrl = (cov_1wasg7lsrg().s[1]++, `${sdk.config.audiences.bus.host}`);
856
+ const baseWebSocketUrl = (cov_1wasg7lsrg().s[2]++, `${sdk.config.audiences.bus.webSocket}`);
857
+ cov_1wasg7lsrg().s[3]++;
91
858
  this._baseWebSocketUrl = baseWebSocketUrl;
859
+ cov_1wasg7lsrg().s[4]++;
92
860
  this._baseUrl = baseUrl;
861
+ cov_1wasg7lsrg().s[5]++;
93
862
  this._request = request;
863
+ cov_1wasg7lsrg().s[6]++;
94
864
  this._sdk = sdk;
865
+ cov_1wasg7lsrg().s[7]++;
95
866
  this._webSockets = {};
867
+ cov_1wasg7lsrg().s[8]++;
96
868
  this._config = Object.assign({}, defaultBusConfig, config);
97
-
98
- this.channels = new _channels2.default(sdk, request, baseUrl);
869
+ cov_1wasg7lsrg().s[9]++;
870
+ this.channels = new _channels.default(sdk, request, baseUrl);
99
871
  }
100
872
 
101
873
  /**
@@ -123,83 +895,108 @@ var Bus = function () {
123
895
  * console.log(errorEvent);
124
896
  * });
125
897
  */
126
-
127
-
128
- _createClass(Bus, [{
129
- key: 'connect',
130
- value: function connect(organizationId, onClose, onError) {
131
- var _this = this;
132
-
133
- return new Promise(function (resolve, reject) {
134
- if (_this._webSockets[organizationId]) {
135
- return resolve(_this._webSockets[organizationId]);
136
- }
137
-
138
- return _this._sdk.auth.getCurrentApiToken('contxtAuth').then(function (apiToken) {
139
- var ws = new _ws2.default(_this._baseWebSocketUrl + '/organizations/' + organizationId + '/stream', [], {
140
- headers: {
141
- Authorization: 'Bearer ' + apiToken
898
+ connect(organizationId, onClose, onError) {
899
+ cov_1wasg7lsrg().f[1]++;
900
+ cov_1wasg7lsrg().s[10]++;
901
+ return new Promise((resolve, reject) => {
902
+ cov_1wasg7lsrg().f[2]++;
903
+ cov_1wasg7lsrg().s[11]++;
904
+ if (this._webSockets[organizationId]) {
905
+ cov_1wasg7lsrg().b[0][0]++;
906
+ cov_1wasg7lsrg().s[12]++;
907
+ return resolve(this._webSockets[organizationId]);
908
+ } else {
909
+ cov_1wasg7lsrg().b[0][1]++;
910
+ }
911
+ cov_1wasg7lsrg().s[13]++;
912
+ return this._sdk.auth.getCurrentApiToken('contxtAuth').then(apiToken => {
913
+ cov_1wasg7lsrg().f[3]++;
914
+ const ws = (cov_1wasg7lsrg().s[14]++, new _ws.default(`${this._baseWebSocketUrl}/organizations/${organizationId}/stream`, [], {
915
+ headers: {
916
+ Authorization: `Bearer ${apiToken}`
917
+ }
918
+ }));
919
+ cov_1wasg7lsrg().s[15]++;
920
+ ws.onopen = event => {
921
+ cov_1wasg7lsrg().f[4]++;
922
+ cov_1wasg7lsrg().s[16]++;
923
+ this._webSockets[organizationId] = new _webSocketConnection.default(ws, organizationId, this._config.autoAcknowledge);
924
+ cov_1wasg7lsrg().s[17]++;
925
+ resolve(this._webSockets[organizationId]);
926
+ };
927
+ cov_1wasg7lsrg().s[18]++;
928
+ ws.addEventListener("close", event => {
929
+ cov_1wasg7lsrg().f[5]++;
930
+ cov_1wasg7lsrg().s[19]++;
931
+ this._webSockets[organizationId] = null;
932
+ cov_1wasg7lsrg().s[20]++;
933
+ if (onClose) {
934
+ cov_1wasg7lsrg().b[1][0]++;
935
+ cov_1wasg7lsrg().s[21]++;
936
+ try {
937
+ cov_1wasg7lsrg().s[22]++;
938
+ onClose(organizationId, event);
939
+ } catch (ex) {
940
+ cov_1wasg7lsrg().s[23]++;
941
+ console.log('Message Bus Error calling onClose callback: ', ex);
142
942
  }
143
- });
144
-
145
- ws.onopen = function (event) {
146
- _this._webSockets[organizationId] = new _webSocketConnection2.default(ws, organizationId, _this._config.autoAcknowledge);
147
-
148
- resolve(_this._webSockets[organizationId]);
149
- };
150
-
151
- ws.addEventListener("close", function (event) {
152
- _this._webSockets[organizationId] = null;
153
- if (onClose) {
154
- try {
155
- onClose(organizationId, event);
156
- } catch (ex) {
157
- console.log('Message Bus Error calling onClose callback: ', ex);
158
- }
159
- }
160
- });
161
-
162
- ws.addEventListener("error", function (errorEvent) {
163
- var connected = _this._webSockets[organizationId] != null;
164
- _this._webSockets[organizationId] = null;
165
- if (!connected) {
166
- reject(errorEvent);
167
- }
168
- if (onError) {
169
- try {
170
- onError(organizationId, errorEvent);
171
- } catch (ex) {
172
- console.log('Message Bus Error calling onError callback: ', ex);
173
- }
943
+ } else {
944
+ cov_1wasg7lsrg().b[1][1]++;
945
+ }
946
+ });
947
+ cov_1wasg7lsrg().s[24]++;
948
+ ws.addEventListener("error", errorEvent => {
949
+ cov_1wasg7lsrg().f[6]++;
950
+ const connected = (cov_1wasg7lsrg().s[25]++, this._webSockets[organizationId] != null);
951
+ cov_1wasg7lsrg().s[26]++;
952
+ this._webSockets[organizationId] = null;
953
+ cov_1wasg7lsrg().s[27]++;
954
+ if (!connected) {
955
+ cov_1wasg7lsrg().b[2][0]++;
956
+ cov_1wasg7lsrg().s[28]++;
957
+ reject(errorEvent);
958
+ } else {
959
+ cov_1wasg7lsrg().b[2][1]++;
960
+ }
961
+ cov_1wasg7lsrg().s[29]++;
962
+ if (onError) {
963
+ cov_1wasg7lsrg().b[3][0]++;
964
+ cov_1wasg7lsrg().s[30]++;
965
+ try {
966
+ cov_1wasg7lsrg().s[31]++;
967
+ onError(organizationId, errorEvent);
968
+ } catch (ex) {
969
+ cov_1wasg7lsrg().s[32]++;
970
+ console.log('Message Bus Error calling onError callback: ', ex);
174
971
  }
175
- });
176
- }).catch(function (err) {
177
- reject(err);
972
+ } else {
973
+ cov_1wasg7lsrg().b[3][1]++;
974
+ }
178
975
  });
976
+ }).catch(err => {
977
+ cov_1wasg7lsrg().f[7]++;
978
+ cov_1wasg7lsrg().s[33]++;
979
+ reject(err);
179
980
  });
180
- }
181
-
182
- /**
183
- * Gets the WebSocketConnection for an organization id
184
- * If a connection already exists for that organization id, the connection is returned, otherwise returns undefined.
185
- *
186
- * @param {string} organizationId UUID corresponding with an organization
187
- *
188
- * @returns {WebSocketConnection}
189
- *
190
- * @example
191
- * const messageBusWebSocket = contxtSdk.bus.getWebSocketConnection('4f0e51c6-728b-4892-9863-6d002e61204d');
192
- */
193
-
194
- }, {
195
- key: 'getWebSocketConnection',
196
- value: function getWebSocketConnection(organizationId) {
197
- return this._webSockets[organizationId];
198
- }
199
- }]);
200
-
201
- return Bus;
202
- }();
981
+ });
982
+ }
203
983
 
204
- exports.default = Bus;
984
+ /**
985
+ * Gets the WebSocketConnection for an organization id
986
+ * If a connection already exists for that organization id, the connection is returned, otherwise returns undefined.
987
+ *
988
+ * @param {string} organizationId UUID corresponding with an organization
989
+ *
990
+ * @returns {WebSocketConnection}
991
+ *
992
+ * @example
993
+ * const messageBusWebSocket = contxtSdk.bus.getWebSocketConnection('4f0e51c6-728b-4892-9863-6d002e61204d');
994
+ */
995
+ getWebSocketConnection(organizationId) {
996
+ cov_1wasg7lsrg().f[8]++;
997
+ cov_1wasg7lsrg().s[34]++;
998
+ return this._webSockets[organizationId];
999
+ }
1000
+ }
1001
+ var _default = exports.default = Bus;
205
1002
  //# sourceMappingURL=index.js.map