@ndustrial/contxt-sdk 5.5.7 → 5.6.1

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 +3427 -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 +3423 -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 +32 -36
  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 +13 -13
  202. package/src/coordinator/users.spec.js +294 -294
  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,10 +1,917 @@
1
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
-
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- import auth0 from 'auth0-js';
6
- import axios from 'axios';
1
+ "use strict";
7
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.TYPE = void 0;
7
+ require("core-js/modules/es.symbol.description.js");
8
+ require("core-js/modules/es.array.filter.js");
9
+ require("core-js/modules/es.array.map.js");
10
+ require("core-js/modules/es.promise.js");
11
+ require("core-js/modules/esnext.iterator.constructor.js");
12
+ require("core-js/modules/esnext.iterator.filter.js");
13
+ require("core-js/modules/esnext.iterator.map.js");
14
+ var _auth0Js = _interopRequireDefault(require("auth0-js"));
15
+ var _axios = _interopRequireDefault(require("axios"));
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ function cov_1ow59e1xle() {
18
+ var path = "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/sessionTypes/passwordGrantAuth.js";
19
+ var hash = "dca63e8d67cb22d81b45a7e574c3f67dad1d8dc4";
20
+ var global = new Function("return this")();
21
+ var gcv = "__coverage__";
22
+ var coverageData = {
23
+ path: "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/sessionTypes/passwordGrantAuth.js",
24
+ statementMap: {
25
+ "0": {
26
+ start: {
27
+ line: 41,
28
+ column: 4
29
+ },
30
+ end: {
31
+ line: 41,
32
+ column: 20
33
+ }
34
+ },
35
+ "1": {
36
+ start: {
37
+ line: 42,
38
+ column: 4
39
+ },
40
+ end: {
41
+ line: 42,
42
+ column: 27
43
+ }
44
+ },
45
+ "2": {
46
+ start: {
47
+ line: 44,
48
+ column: 4
49
+ },
50
+ end: {
51
+ line: 47,
52
+ column: 7
53
+ }
54
+ },
55
+ "3": {
56
+ start: {
57
+ line: 58,
58
+ column: 4
59
+ },
60
+ end: {
61
+ line: 64,
62
+ column: 7
63
+ }
64
+ },
65
+ "4": {
66
+ start: {
67
+ line: 59,
68
+ column: 6
69
+ },
70
+ end: {
71
+ line: 61,
72
+ column: 7
73
+ }
74
+ },
75
+ "5": {
76
+ start: {
77
+ line: 60,
78
+ column: 8
79
+ },
80
+ end: {
81
+ line: 60,
82
+ column: 56
83
+ }
84
+ },
85
+ "6": {
86
+ start: {
87
+ line: 63,
88
+ column: 6
89
+ },
90
+ end: {
91
+ line: 63,
92
+ column: 52
93
+ }
94
+ },
95
+ "7": {
96
+ start: {
97
+ line: 73,
98
+ column: 21
99
+ },
100
+ end: {
101
+ line: 73,
102
+ column: 75
103
+ }
104
+ },
105
+ "8": {
106
+ start: {
107
+ line: 75,
108
+ column: 4
109
+ },
110
+ end: {
111
+ line: 75,
112
+ column: 20
113
+ }
114
+ },
115
+ "9": {
116
+ start: {
117
+ line: 89,
118
+ column: 4
119
+ },
120
+ end: {
121
+ line: 107,
122
+ column: 7
123
+ }
124
+ },
125
+ "10": {
126
+ start: {
127
+ line: 90,
128
+ column: 23
129
+ },
130
+ end: {
131
+ line: 90,
132
+ column: 69
133
+ }
134
+ },
135
+ "11": {
136
+ start: {
137
+ line: 92,
138
+ column: 6
139
+ },
140
+ end: {
141
+ line: 104,
142
+ column: 8
143
+ }
144
+ },
145
+ "12": {
146
+ start: {
147
+ line: 95,
148
+ column: 10
149
+ },
150
+ end: {
151
+ line: 100,
152
+ column: 11
153
+ }
154
+ },
155
+ "13": {
156
+ start: {
157
+ line: 97,
158
+ column: 14
159
+ },
160
+ end: {
161
+ line: 97,
162
+ column: 66
163
+ }
164
+ },
165
+ "14": {
166
+ start: {
167
+ line: 99,
168
+ column: 12
169
+ },
170
+ end: {
171
+ line: 99,
172
+ column: 51
173
+ }
174
+ },
175
+ "15": {
176
+ start: {
177
+ line: 102,
178
+ column: 10
179
+ },
180
+ end: {
181
+ line: 102,
182
+ column: 47
183
+ }
184
+ },
185
+ "16": {
186
+ start: {
187
+ line: 106,
188
+ column: 6
189
+ },
190
+ end: {
191
+ line: 106,
192
+ column: 44
193
+ }
194
+ },
195
+ "17": {
196
+ start: {
197
+ line: 117,
198
+ column: 4
199
+ },
200
+ end: {
201
+ line: 121,
202
+ column: 7
203
+ }
204
+ },
205
+ "18": {
206
+ start: {
207
+ line: 118,
208
+ column: 6
209
+ },
210
+ end: {
211
+ line: 118,
212
+ column: 29
213
+ }
214
+ },
215
+ "19": {
216
+ start: {
217
+ line: 120,
218
+ column: 6
219
+ },
220
+ end: {
221
+ line: 120,
222
+ column: 66
223
+ }
224
+ },
225
+ "20": {
226
+ start: {
227
+ line: 136,
228
+ column: 4
229
+ },
230
+ end: {
231
+ line: 164,
232
+ column: 9
233
+ }
234
+ },
235
+ "21": {
236
+ start: {
237
+ line: 142,
238
+ column: 14
239
+ },
240
+ end: {
241
+ line: 142,
242
+ column: 71
243
+ }
244
+ },
245
+ "22": {
246
+ start: {
247
+ line: 145,
248
+ column: 14
249
+ },
250
+ end: {
251
+ line: 148,
252
+ column: 16
253
+ }
254
+ },
255
+ "23": {
256
+ start: {
257
+ line: 157,
258
+ column: 25
259
+ },
260
+ end: {
261
+ line: 157,
262
+ column: 33
263
+ }
264
+ },
265
+ "24": {
266
+ start: {
267
+ line: 159,
268
+ column: 8
269
+ },
270
+ end: {
271
+ line: 161,
272
+ column: 11
273
+ }
274
+ },
275
+ "25": {
276
+ start: {
277
+ line: 163,
278
+ column: 8
279
+ },
280
+ end: {
281
+ line: 163,
282
+ column: 33
283
+ }
284
+ },
285
+ "26": {
286
+ start: {
287
+ line: 176,
288
+ column: 4
289
+ },
290
+ end: {
291
+ line: 176,
292
+ column: 36
293
+ }
294
+ },
295
+ "27": {
296
+ start: {
297
+ line: 180,
298
+ column: 20
299
+ },
300
+ end: {
301
+ line: 180,
302
+ column: 39
303
+ }
304
+ }
305
+ },
306
+ fnMap: {
307
+ "0": {
308
+ name: "(anonymous_0)",
309
+ decl: {
310
+ start: {
311
+ line: 40,
312
+ column: 2
313
+ },
314
+ end: {
315
+ line: 40,
316
+ column: 3
317
+ }
318
+ },
319
+ loc: {
320
+ start: {
321
+ line: 40,
322
+ column: 19
323
+ },
324
+ end: {
325
+ line: 48,
326
+ column: 3
327
+ }
328
+ },
329
+ line: 40
330
+ },
331
+ "1": {
332
+ name: "(anonymous_1)",
333
+ decl: {
334
+ start: {
335
+ line: 57,
336
+ column: 2
337
+ },
338
+ end: {
339
+ line: 57,
340
+ column: 3
341
+ }
342
+ },
343
+ loc: {
344
+ start: {
345
+ line: 57,
346
+ column: 23
347
+ },
348
+ end: {
349
+ line: 65,
350
+ column: 3
351
+ }
352
+ },
353
+ line: 57
354
+ },
355
+ "2": {
356
+ name: "(anonymous_2)",
357
+ decl: {
358
+ start: {
359
+ line: 58,
360
+ column: 23
361
+ },
362
+ end: {
363
+ line: 58,
364
+ column: 24
365
+ }
366
+ },
367
+ loc: {
368
+ start: {
369
+ line: 58,
370
+ column: 44
371
+ },
372
+ end: {
373
+ line: 64,
374
+ column: 5
375
+ }
376
+ },
377
+ line: 58
378
+ },
379
+ "3": {
380
+ name: "(anonymous_3)",
381
+ decl: {
382
+ start: {
383
+ line: 72,
384
+ column: 2
385
+ },
386
+ end: {
387
+ line: 72,
388
+ column: 3
389
+ }
390
+ },
391
+ loc: {
392
+ start: {
393
+ line: 72,
394
+ column: 20
395
+ },
396
+ end: {
397
+ line: 76,
398
+ column: 3
399
+ }
400
+ },
401
+ line: 72
402
+ },
403
+ "4": {
404
+ name: "(anonymous_4)",
405
+ decl: {
406
+ start: {
407
+ line: 88,
408
+ column: 2
409
+ },
410
+ end: {
411
+ line: 88,
412
+ column: 3
413
+ }
414
+ },
415
+ loc: {
416
+ start: {
417
+ line: 88,
418
+ column: 28
419
+ },
420
+ end: {
421
+ line: 108,
422
+ column: 3
423
+ }
424
+ },
425
+ line: 88
426
+ },
427
+ "5": {
428
+ name: "(anonymous_5)",
429
+ decl: {
430
+ start: {
431
+ line: 89,
432
+ column: 23
433
+ },
434
+ end: {
435
+ line: 89,
436
+ column: 24
437
+ }
438
+ },
439
+ loc: {
440
+ start: {
441
+ line: 89,
442
+ column: 44
443
+ },
444
+ end: {
445
+ line: 105,
446
+ column: 5
447
+ }
448
+ },
449
+ line: 89
450
+ },
451
+ "6": {
452
+ name: "(anonymous_6)",
453
+ decl: {
454
+ start: {
455
+ line: 94,
456
+ column: 8
457
+ },
458
+ end: {
459
+ line: 94,
460
+ column: 9
461
+ }
462
+ },
463
+ loc: {
464
+ start: {
465
+ line: 94,
466
+ column: 27
467
+ },
468
+ end: {
469
+ line: 103,
470
+ column: 9
471
+ }
472
+ },
473
+ line: 94
474
+ },
475
+ "7": {
476
+ name: "(anonymous_7)",
477
+ decl: {
478
+ start: {
479
+ line: 105,
480
+ column: 12
481
+ },
482
+ end: {
483
+ line: 105,
484
+ column: 13
485
+ }
486
+ },
487
+ loc: {
488
+ start: {
489
+ line: 105,
490
+ column: 29
491
+ },
492
+ end: {
493
+ line: 107,
494
+ column: 5
495
+ }
496
+ },
497
+ line: 105
498
+ },
499
+ "8": {
500
+ name: "(anonymous_8)",
501
+ decl: {
502
+ start: {
503
+ line: 116,
504
+ column: 2
505
+ },
506
+ end: {
507
+ line: 116,
508
+ column: 3
509
+ }
510
+ },
511
+ loc: {
512
+ start: {
513
+ line: 116,
514
+ column: 11
515
+ },
516
+ end: {
517
+ line: 122,
518
+ column: 3
519
+ }
520
+ },
521
+ line: 116
522
+ },
523
+ "9": {
524
+ name: "(anonymous_9)",
525
+ decl: {
526
+ start: {
527
+ line: 117,
528
+ column: 23
529
+ },
530
+ end: {
531
+ line: 117,
532
+ column: 24
533
+ }
534
+ },
535
+ loc: {
536
+ start: {
537
+ line: 117,
538
+ column: 36
539
+ },
540
+ end: {
541
+ line: 121,
542
+ column: 5
543
+ }
544
+ },
545
+ line: 117
546
+ },
547
+ "10": {
548
+ name: "(anonymous_10)",
549
+ decl: {
550
+ start: {
551
+ line: 135,
552
+ column: 2
553
+ },
554
+ end: {
555
+ line: 135,
556
+ column: 3
557
+ }
558
+ },
559
+ loc: {
560
+ start: {
561
+ line: 135,
562
+ column: 28
563
+ },
564
+ end: {
565
+ line: 165,
566
+ column: 3
567
+ }
568
+ },
569
+ line: 135
570
+ },
571
+ "11": {
572
+ name: "(anonymous_11)",
573
+ decl: {
574
+ start: {
575
+ line: 141,
576
+ column: 17
577
+ },
578
+ end: {
579
+ line: 141,
580
+ column: 18
581
+ }
582
+ },
583
+ loc: {
584
+ start: {
585
+ line: 141,
586
+ column: 35
587
+ },
588
+ end: {
589
+ line: 143,
590
+ column: 13
591
+ }
592
+ },
593
+ line: 141
594
+ },
595
+ "12": {
596
+ name: "(anonymous_12)",
597
+ decl: {
598
+ start: {
599
+ line: 144,
600
+ column: 20
601
+ },
602
+ end: {
603
+ line: 144,
604
+ column: 21
605
+ }
606
+ },
607
+ loc: {
608
+ start: {
609
+ line: 144,
610
+ column: 34
611
+ },
612
+ end: {
613
+ line: 149,
614
+ column: 13
615
+ }
616
+ },
617
+ line: 144
618
+ },
619
+ "13": {
620
+ name: "(anonymous_13)",
621
+ decl: {
622
+ start: {
623
+ line: 156,
624
+ column: 12
625
+ },
626
+ end: {
627
+ line: 156,
628
+ column: 13
629
+ }
630
+ },
631
+ loc: {
632
+ start: {
633
+ line: 156,
634
+ column: 26
635
+ },
636
+ end: {
637
+ line: 164,
638
+ column: 7
639
+ }
640
+ },
641
+ line: 156
642
+ },
643
+ "14": {
644
+ name: "(anonymous_14)",
645
+ decl: {
646
+ start: {
647
+ line: 175,
648
+ column: 2
649
+ },
650
+ end: {
651
+ line: 175,
652
+ column: 3
653
+ }
654
+ },
655
+ loc: {
656
+ start: {
657
+ line: 175,
658
+ column: 28
659
+ },
660
+ end: {
661
+ line: 177,
662
+ column: 3
663
+ }
664
+ },
665
+ line: 175
666
+ }
667
+ },
668
+ branchMap: {
669
+ "0": {
670
+ loc: {
671
+ start: {
672
+ line: 59,
673
+ column: 6
674
+ },
675
+ end: {
676
+ line: 61,
677
+ column: 7
678
+ }
679
+ },
680
+ type: "if",
681
+ locations: [{
682
+ start: {
683
+ line: 59,
684
+ column: 6
685
+ },
686
+ end: {
687
+ line: 61,
688
+ column: 7
689
+ }
690
+ }, {
691
+ start: {
692
+ line: undefined,
693
+ column: undefined
694
+ },
695
+ end: {
696
+ line: undefined,
697
+ column: undefined
698
+ }
699
+ }],
700
+ line: 59
701
+ },
702
+ "1": {
703
+ loc: {
704
+ start: {
705
+ line: 73,
706
+ column: 24
707
+ },
708
+ end: {
709
+ line: 73,
710
+ column: 74
711
+ }
712
+ },
713
+ type: "binary-expr",
714
+ locations: [{
715
+ start: {
716
+ line: 73,
717
+ column: 24
718
+ },
719
+ end: {
720
+ line: 73,
721
+ column: 41
722
+ }
723
+ }, {
724
+ start: {
725
+ line: 73,
726
+ column: 45
727
+ },
728
+ end: {
729
+ line: 73,
730
+ column: 74
731
+ }
732
+ }],
733
+ line: 73
734
+ },
735
+ "2": {
736
+ loc: {
737
+ start: {
738
+ line: 95,
739
+ column: 10
740
+ },
741
+ end: {
742
+ line: 100,
743
+ column: 11
744
+ }
745
+ },
746
+ type: "if",
747
+ locations: [{
748
+ start: {
749
+ line: 95,
750
+ column: 10
751
+ },
752
+ end: {
753
+ line: 100,
754
+ column: 11
755
+ }
756
+ }, {
757
+ start: {
758
+ line: undefined,
759
+ column: undefined
760
+ },
761
+ end: {
762
+ line: undefined,
763
+ column: undefined
764
+ }
765
+ }],
766
+ line: 95
767
+ },
768
+ "3": {
769
+ loc: {
770
+ start: {
771
+ line: 97,
772
+ column: 14
773
+ },
774
+ end: {
775
+ line: 97,
776
+ column: 66
777
+ }
778
+ },
779
+ type: "binary-expr",
780
+ locations: [{
781
+ start: {
782
+ line: 97,
783
+ column: 15
784
+ },
785
+ end: {
786
+ line: 97,
787
+ column: 18
788
+ }
789
+ }, {
790
+ start: {
791
+ line: 97,
792
+ column: 22
793
+ },
794
+ end: {
795
+ line: 97,
796
+ column: 37
797
+ }
798
+ }, {
799
+ start: {
800
+ line: 97,
801
+ column: 42
802
+ },
803
+ end: {
804
+ line: 97,
805
+ column: 66
806
+ }
807
+ }],
808
+ line: 97
809
+ },
810
+ "4": {
811
+ loc: {
812
+ start: {
813
+ line: 146,
814
+ column: 16
815
+ },
816
+ end: {
817
+ line: 147,
818
+ column: 75
819
+ }
820
+ },
821
+ type: "binary-expr",
822
+ locations: [{
823
+ start: {
824
+ line: 146,
825
+ column: 16
826
+ },
827
+ end: {
828
+ line: 146,
829
+ column: 24
830
+ }
831
+ }, {
832
+ start: {
833
+ line: 147,
834
+ column: 16
835
+ },
836
+ end: {
837
+ line: 147,
838
+ column: 75
839
+ }
840
+ }],
841
+ line: 146
842
+ }
843
+ },
844
+ s: {
845
+ "0": 0,
846
+ "1": 0,
847
+ "2": 0,
848
+ "3": 0,
849
+ "4": 0,
850
+ "5": 0,
851
+ "6": 0,
852
+ "7": 0,
853
+ "8": 0,
854
+ "9": 0,
855
+ "10": 0,
856
+ "11": 0,
857
+ "12": 0,
858
+ "13": 0,
859
+ "14": 0,
860
+ "15": 0,
861
+ "16": 0,
862
+ "17": 0,
863
+ "18": 0,
864
+ "19": 0,
865
+ "20": 0,
866
+ "21": 0,
867
+ "22": 0,
868
+ "23": 0,
869
+ "24": 0,
870
+ "25": 0,
871
+ "26": 0,
872
+ "27": 0
873
+ },
874
+ f: {
875
+ "0": 0,
876
+ "1": 0,
877
+ "2": 0,
878
+ "3": 0,
879
+ "4": 0,
880
+ "5": 0,
881
+ "6": 0,
882
+ "7": 0,
883
+ "8": 0,
884
+ "9": 0,
885
+ "10": 0,
886
+ "11": 0,
887
+ "12": 0,
888
+ "13": 0,
889
+ "14": 0
890
+ },
891
+ b: {
892
+ "0": [0, 0],
893
+ "1": [0, 0],
894
+ "2": [0, 0],
895
+ "3": [0, 0, 0],
896
+ "4": [0, 0]
897
+ },
898
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
899
+ hash: "dca63e8d67cb22d81b45a7e574c3f67dad1d8dc4"
900
+ };
901
+ var coverage = global[gcv] || (global[gcv] = {});
902
+ if (!coverage[path] || coverage[path].hash !== hash) {
903
+ coverage[path] = coverageData;
904
+ }
905
+ var actualCoverage = coverage[path];
906
+ {
907
+ // @ts-ignore
908
+ cov_1ow59e1xle = function () {
909
+ return actualCoverage;
910
+ };
911
+ }
912
+ return actualCoverage;
913
+ }
914
+ cov_1ow59e1xle();
8
915
  /**
9
916
  * A SessionType that allows the user to authenticate with Auth0 and
10
917
  * then gain a valid JWT from the Contxt Auth service. This method
@@ -29,7 +936,7 @@ import axios from 'axios';
29
936
  * });
30
937
  */
31
938
 
32
- var PasswordGrantAuth = function () {
939
+ class PasswordGrantAuth {
33
940
  /**
34
941
  * @param {Object} sdk An instance of the SDK so the module can communicate with other modules
35
942
  * @param {Object} sdk.audiences
@@ -41,13 +948,14 @@ var PasswordGrantAuth = function () {
41
948
  * @param {Object} sdk.config.auth
42
949
  * @param {string} sdk.config.auth.clientId The Auth0 client id of the application
43
950
  */
44
- function PasswordGrantAuth(sdk) {
45
- _classCallCheck(this, PasswordGrantAuth);
46
-
951
+ constructor(sdk) {
952
+ cov_1ow59e1xle().f[0]++;
953
+ cov_1ow59e1xle().s[0]++;
47
954
  this._sdk = sdk;
955
+ cov_1ow59e1xle().s[1]++;
48
956
  this._sessionInfo = {};
49
-
50
- this._auth0 = new auth0.Authentication({
957
+ cov_1ow59e1xle().s[2]++;
958
+ this._auth0 = new _auth0Js.default.Authentication({
51
959
  domain: this._sdk.config.auth.domain,
52
960
  clientID: this._sdk.config.auth.clientId
53
961
  });
@@ -60,145 +968,152 @@ var PasswordGrantAuth = function () {
60
968
  * @fulfills {string} apiToken
61
969
  * @rejects {Error}
62
970
  */
971
+ getCurrentApiToken() {
972
+ cov_1ow59e1xle().f[1]++;
973
+ cov_1ow59e1xle().s[3]++;
974
+ return new Promise((resolve, reject) => {
975
+ cov_1ow59e1xle().f[2]++;
976
+ cov_1ow59e1xle().s[4]++;
977
+ if (!this._sessionInfo.accessToken) {
978
+ cov_1ow59e1xle().b[0][0]++;
979
+ cov_1ow59e1xle().s[5]++;
980
+ return reject(new Error('No api token found.'));
981
+ } else {
982
+ cov_1ow59e1xle().b[0][1]++;
983
+ }
984
+ cov_1ow59e1xle().s[6]++;
985
+ return resolve(this._sessionInfo.accessToken);
986
+ });
987
+ }
63
988
 
989
+ /**
990
+ * Tells caller if the current user is authenticated
991
+ *
992
+ * @returns {boolean}
993
+ */
994
+ isAuthenticated() {
995
+ cov_1ow59e1xle().f[3]++;
996
+ const hasToken = (cov_1ow59e1xle().s[7]++, !!((cov_1ow59e1xle().b[1][0]++, this._sessionInfo) && (cov_1ow59e1xle().b[1][1]++, this._sessionInfo.accessToken)));
997
+ cov_1ow59e1xle().s[8]++;
998
+ return hasToken;
999
+ }
64
1000
 
65
- _createClass(PasswordGrantAuth, [{
66
- key: 'getCurrentApiToken',
67
- value: function getCurrentApiToken() {
68
- var _this = this;
69
-
70
- return new Promise(function (resolve, reject) {
71
- if (!_this._sessionInfo.accessToken) {
72
- return reject(new Error('No api token found.'));
1001
+ /**
1002
+ * Logs the user in using Auth0 using a username a password
1003
+ *
1004
+ * @param {string} username The username of the user to authenticate
1005
+ * @param {string} password The password of the user to authenticate
1006
+ *
1007
+ * @returns {Promise}
1008
+ * @fulfills {string}
1009
+ * @rejects {Error}
1010
+ */
1011
+ logIn(username, password) {
1012
+ cov_1ow59e1xle().f[4]++;
1013
+ cov_1ow59e1xle().s[9]++;
1014
+ return new Promise((resolve, reject) => {
1015
+ cov_1ow59e1xle().f[5]++;
1016
+ const audience = (cov_1ow59e1xle().s[10]++, this._sdk.config.audiences.contxtAuth.clientId);
1017
+ cov_1ow59e1xle().s[11]++;
1018
+ this._auth0.loginWithDefaultDirectory({
1019
+ password,
1020
+ username,
1021
+ audience
1022
+ }, (err, response) => {
1023
+ cov_1ow59e1xle().f[6]++;
1024
+ cov_1ow59e1xle().s[12]++;
1025
+ if (err) {
1026
+ cov_1ow59e1xle().b[2][0]++;
1027
+ const errorMessage = (cov_1ow59e1xle().s[13]++, (cov_1ow59e1xle().b[3][0]++, err) && (cov_1ow59e1xle().b[3][1]++, err.description) || (cov_1ow59e1xle().b[3][2]++, 'Authentication failed.'));
1028
+ cov_1ow59e1xle().s[14]++;
1029
+ return reject(new Error(errorMessage));
1030
+ } else {
1031
+ cov_1ow59e1xle().b[2][1]++;
73
1032
  }
74
-
75
- return resolve(_this._sessionInfo.accessToken);
76
- });
77
- }
78
-
79
- /**
80
- * Tells caller if the current user is authenticated
81
- *
82
- * @returns {boolean}
83
- */
84
-
85
- }, {
86
- key: 'isAuthenticated',
87
- value: function isAuthenticated() {
88
- var hasToken = !!(this._sessionInfo && this._sessionInfo.accessToken);
89
-
90
- return hasToken;
91
- }
92
-
93
- /**
94
- * Logs the user in using Auth0 using a username a password
95
- *
96
- * @param {string} username The username of the user to authenticate
97
- * @param {string} password The password of the user to authenticate
98
- *
99
- * @returns {Promise}
100
- * @fulfills {string}
101
- * @rejects {Error}
102
- */
103
-
104
- }, {
105
- key: 'logIn',
106
- value: function logIn(username, password) {
107
- var _this2 = this;
108
-
109
- return new Promise(function (resolve, reject) {
110
- var audience = _this2._sdk.config.audiences.contxtAuth.clientId;
111
-
112
- _this2._auth0.loginWithDefaultDirectory({ password: password, username: username, audience: audience }, function (err, response) {
113
- if (err) {
114
- var errorMessage = err && err.description || 'Authentication failed.';
115
-
116
- return reject(new Error(errorMessage));
117
- }
118
-
119
- return resolve(response.accessToken);
120
- });
121
- }).then(function (accessToken) {
122
- return _this2._getApiToken(accessToken);
1033
+ cov_1ow59e1xle().s[15]++;
1034
+ return resolve(response.accessToken);
123
1035
  });
124
- }
125
-
126
- /**
127
- * Logs the user out by removing any stored session info.
128
- *
129
- * @returns {Promise}
130
- * @fulfills {string}
131
- */
132
-
133
- }, {
134
- key: 'logOut',
135
- value: function logOut() {
136
- var _this3 = this;
137
-
138
- return new Promise(function (resolve) {
139
- _this3._sessionInfo = {};
140
-
141
- return resolve('Logout successful - session info cleared.');
142
- });
143
- }
144
-
145
- /**
146
- * Requests an access token from Contxt Auth with the correct audiences.
147
- *
148
- * @param {string} accessToken
149
- *
150
- * @returns {Promise}
151
- * @fulfill {string} accessToken
152
- * @rejects {Error}
153
- *
154
- * @private
155
- */
156
-
157
- }, {
158
- key: '_getApiToken',
159
- value: function _getApiToken(accessToken) {
160
- var _this4 = this;
161
-
162
- return axios.post(this._sdk.config.audiences.contxtAuth.host + '/v1/token', {
163
- audiences: Object.keys(this._sdk.config.audiences).map(function (audienceName) {
164
- return _this4._sdk.config.audiences[audienceName].clientId;
165
- }).filter(function (clientId) {
166
- return clientId && clientId !== _this4._sdk.config.audiences.contxtAuth.clientId;
167
- }),
168
- nonce: 'nonce'
169
- }, {
170
- headers: { Authorization: 'Bearer ' + accessToken }
171
- }).then(function (response) {
172
- var data = response.data;
173
-
1036
+ }).then(accessToken => {
1037
+ cov_1ow59e1xle().f[7]++;
1038
+ cov_1ow59e1xle().s[16]++;
1039
+ return this._getApiToken(accessToken);
1040
+ });
1041
+ }
174
1042
 
175
- _this4._saveSession({
176
- accessToken: data.access_token
177
- });
1043
+ /**
1044
+ * Logs the user out by removing any stored session info.
1045
+ *
1046
+ * @returns {Promise}
1047
+ * @fulfills {string}
1048
+ */
1049
+ logOut() {
1050
+ cov_1ow59e1xle().f[8]++;
1051
+ cov_1ow59e1xle().s[17]++;
1052
+ return new Promise(resolve => {
1053
+ cov_1ow59e1xle().f[9]++;
1054
+ cov_1ow59e1xle().s[18]++;
1055
+ this._sessionInfo = {};
1056
+ cov_1ow59e1xle().s[19]++;
1057
+ return resolve('Logout successful - session info cleared.');
1058
+ });
1059
+ }
178
1060
 
179
- return data.access_token;
1061
+ /**
1062
+ * Requests an access token from Contxt Auth with the correct audiences.
1063
+ *
1064
+ * @param {string} accessToken
1065
+ *
1066
+ * @returns {Promise}
1067
+ * @fulfill {string} accessToken
1068
+ * @rejects {Error}
1069
+ *
1070
+ * @private
1071
+ */
1072
+ _getApiToken(accessToken) {
1073
+ cov_1ow59e1xle().f[10]++;
1074
+ cov_1ow59e1xle().s[20]++;
1075
+ return _axios.default.post(`${this._sdk.config.audiences.contxtAuth.host}/v1/token`, {
1076
+ audiences: Object.keys(this._sdk.config.audiences).map(audienceName => {
1077
+ cov_1ow59e1xle().f[11]++;
1078
+ cov_1ow59e1xle().s[21]++;
1079
+ return this._sdk.config.audiences[audienceName].clientId;
1080
+ }).filter(clientId => {
1081
+ cov_1ow59e1xle().f[12]++;
1082
+ cov_1ow59e1xle().s[22]++;
1083
+ return (cov_1ow59e1xle().b[4][0]++, clientId) && (cov_1ow59e1xle().b[4][1]++, clientId !== this._sdk.config.audiences.contxtAuth.clientId);
1084
+ }),
1085
+ nonce: 'nonce'
1086
+ }, {
1087
+ headers: {
1088
+ Authorization: `Bearer ${accessToken}`
1089
+ }
1090
+ }).then(response => {
1091
+ cov_1ow59e1xle().f[13]++;
1092
+ const _ref = (cov_1ow59e1xle().s[23]++, response),
1093
+ data = _ref.data;
1094
+ cov_1ow59e1xle().s[24]++;
1095
+ this._saveSession({
1096
+ accessToken: data.access_token
180
1097
  });
181
- }
182
-
183
- /**
184
- * Saves the session info (i.e. the Contxt access token) for future use
185
- *
186
- * @param {Object} sessionInfo
187
- * @param {string} sessionInfo.accessToken
188
- *
189
- * @private
190
- */
191
-
192
- }, {
193
- key: '_saveSession',
194
- value: function _saveSession(sessionInfo) {
195
- this._sessionInfo = sessionInfo;
196
- }
197
- }]);
198
-
199
- return PasswordGrantAuth;
200
- }();
1098
+ cov_1ow59e1xle().s[25]++;
1099
+ return data.access_token;
1100
+ });
1101
+ }
201
1102
 
202
- export var TYPE = 'passwordGrantAuth';
203
- export default PasswordGrantAuth;
1103
+ /**
1104
+ * Saves the session info (i.e. the Contxt access token) for future use
1105
+ *
1106
+ * @param {Object} sessionInfo
1107
+ * @param {string} sessionInfo.accessToken
1108
+ *
1109
+ * @private
1110
+ */
1111
+ _saveSession(sessionInfo) {
1112
+ cov_1ow59e1xle().f[14]++;
1113
+ cov_1ow59e1xle().s[26]++;
1114
+ this._sessionInfo = sessionInfo;
1115
+ }
1116
+ }
1117
+ const TYPE = exports.TYPE = (cov_1ow59e1xle().s[27]++, 'passwordGrantAuth');
1118
+ var _default = exports.default = PasswordGrantAuth;
204
1119
  //# sourceMappingURL=passwordGrantAuth.js.map