@ndustrial/contxt-sdk 5.5.6 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +6 -0
  3. package/eslint.config.mjs +44 -0
  4. package/esm/bus/channels.js +1883 -216
  5. package/esm/bus/channels.js.map +1 -1
  6. package/esm/bus/index.browser.js +218 -37
  7. package/esm/bus/index.browser.js.map +1 -1
  8. package/esm/bus/index.js +906 -94
  9. package/esm/bus/index.js.map +1 -1
  10. package/esm/bus/webSocketConnection.browser.js +86 -12
  11. package/esm/bus/webSocketConnection.browser.js.map +1 -1
  12. package/esm/bus/webSocketConnection.js +2464 -332
  13. package/esm/bus/webSocketConnection.js.map +1 -1
  14. package/esm/config/audiences.js +37 -1
  15. package/esm/config/audiences.js.map +1 -1
  16. package/esm/config/defaults.js +37 -1
  17. package/esm/config/defaults.js.map +1 -1
  18. package/esm/config/index.js +1622 -203
  19. package/esm/config/index.js.map +1 -1
  20. package/esm/coordinator/applications.js +1019 -172
  21. package/esm/coordinator/applications.js.map +1 -1
  22. package/esm/coordinator/consent.js +603 -76
  23. package/esm/coordinator/consent.js.map +1 -1
  24. package/esm/coordinator/edgeNodes.js +520 -40
  25. package/esm/coordinator/edgeNodes.js.map +1 -1
  26. package/esm/coordinator/index.js +811 -54
  27. package/esm/coordinator/index.js.map +1 -1
  28. package/esm/coordinator/organizations.js +533 -60
  29. package/esm/coordinator/organizations.js.map +1 -1
  30. package/esm/coordinator/permissions.js +914 -107
  31. package/esm/coordinator/permissions.js.map +1 -1
  32. package/esm/coordinator/roles.js +2146 -258
  33. package/esm/coordinator/roles.js.map +1 -1
  34. package/esm/coordinator/users.js +3393 -484
  35. package/esm/coordinator/users.js.map +1 -1
  36. package/esm/events/index.js +2301 -393
  37. package/esm/events/index.js.map +1 -1
  38. package/esm/files/index.js +2053 -410
  39. package/esm/files/index.js.map +1 -1
  40. package/esm/index.js +1002 -148
  41. package/esm/index.js.map +1 -1
  42. package/esm/iot/feedTypes.js +188 -25
  43. package/esm/iot/feedTypes.js.map +1 -1
  44. package/esm/iot/feeds.js +420 -59
  45. package/esm/iot/feeds.js.map +1 -1
  46. package/esm/iot/fieldCategories.js +1172 -195
  47. package/esm/iot/fieldCategories.js.map +1 -1
  48. package/esm/iot/fieldGroupings.js +1689 -255
  49. package/esm/iot/fieldGroupings.js.map +1 -1
  50. package/esm/iot/fields.js +254 -28
  51. package/esm/iot/fields.js.map +1 -1
  52. package/esm/iot/index.js +212 -34
  53. package/esm/iot/index.js.map +1 -1
  54. package/esm/iot/outputs.js +320 -31
  55. package/esm/iot/outputs.js.map +1 -1
  56. package/esm/nionic/index.js +1097 -97
  57. package/esm/nionic/index.js.map +1 -1
  58. package/esm/request.js +1313 -221
  59. package/esm/request.js.map +1 -1
  60. package/esm/sessionTypes/auth0WebAuth.js +3395 -409
  61. package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
  62. package/esm/sessionTypes/index.js +213 -22
  63. package/esm/sessionTypes/index.js.map +1 -1
  64. package/esm/sessionTypes/machineAuth.js +1314 -144
  65. package/esm/sessionTypes/machineAuth.js.map +1 -1
  66. package/esm/sessionTypes/passwordGrantAuth.js +1060 -145
  67. package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
  68. package/esm/utils/events/formatEventUpdateToServer.js +107 -4
  69. package/esm/utils/events/formatEventUpdateToServer.js.map +1 -1
  70. package/esm/utils/events/index.js +54 -2
  71. package/esm/utils/events/index.js.map +1 -1
  72. package/esm/utils/iot/formatOutputFieldDataFromServer.js +227 -14
  73. package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  74. package/esm/utils/iot/index.js +56 -3
  75. package/esm/utils/iot/index.js.map +1 -1
  76. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +207 -7
  77. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  78. package/esm/utils/objects/createCaseChangeFn.js +449 -18
  79. package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
  80. package/esm/utils/objects/index.js +56 -3
  81. package/esm/utils/objects/index.js.map +1 -1
  82. package/esm/utils/objects/map.js +520 -26
  83. package/esm/utils/objects/map.js.map +1 -1
  84. package/esm/utils/objects/toCamelCase.js +39 -3
  85. package/esm/utils/objects/toCamelCase.js.map +1 -1
  86. package/esm/utils/objects/toSnakeCase.js +39 -3
  87. package/esm/utils/objects/toSnakeCase.js.map +1 -1
  88. package/esm/utils/pagination/formatPaginatedDataFromServer.js +268 -11
  89. package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  90. package/esm/utils/pagination/index.js +54 -2
  91. package/esm/utils/pagination/index.js.map +1 -1
  92. package/esm/utils/url/index.js +47 -2
  93. package/esm/utils/url/index.js.map +1 -1
  94. package/esm/utils/url/stringifyParams.js +176 -10
  95. package/esm/utils/url/stringifyParams.js.map +1 -1
  96. package/lib/bus/channels.js +1880 -223
  97. package/lib/bus/channels.js.map +1 -1
  98. package/lib/bus/index.browser.js +215 -43
  99. package/lib/bus/index.browser.js.map +1 -1
  100. package/lib/bus/index.js +903 -106
  101. package/lib/bus/index.js.map +1 -1
  102. package/lib/bus/webSocketConnection.browser.js +83 -15
  103. package/lib/bus/webSocketConnection.browser.js.map +1 -1
  104. package/lib/bus/webSocketConnection.js +2461 -339
  105. package/lib/bus/webSocketConnection.js.map +1 -1
  106. package/lib/config/audiences.js +33 -2
  107. package/lib/config/audiences.js.map +1 -1
  108. package/lib/config/defaults.js +33 -2
  109. package/lib/config/defaults.js.map +1 -1
  110. package/lib/config/index.js +1619 -212
  111. package/lib/config/index.js.map +1 -1
  112. package/lib/coordinator/applications.js +1016 -174
  113. package/lib/coordinator/applications.js.map +1 -1
  114. package/lib/coordinator/consent.js +600 -78
  115. package/lib/coordinator/consent.js.map +1 -1
  116. package/lib/coordinator/edgeNodes.js +517 -42
  117. package/lib/coordinator/edgeNodes.js.map +1 -1
  118. package/lib/coordinator/index.js +808 -78
  119. package/lib/coordinator/index.js.map +1 -1
  120. package/lib/coordinator/organizations.js +530 -62
  121. package/lib/coordinator/organizations.js.map +1 -1
  122. package/lib/coordinator/permissions.js +911 -109
  123. package/lib/coordinator/permissions.js.map +1 -1
  124. package/lib/coordinator/roles.js +2143 -260
  125. package/lib/coordinator/roles.js.map +1 -1
  126. package/lib/coordinator/users.js +3389 -489
  127. package/lib/coordinator/users.js.map +1 -1
  128. package/lib/events/index.js +2297 -404
  129. package/lib/events/index.js.map +1 -1
  130. package/lib/files/index.js +2050 -418
  131. package/lib/files/index.js.map +1 -1
  132. package/lib/index.js +999 -183
  133. package/lib/index.js.map +1 -1
  134. package/lib/iot/feedTypes.js +185 -27
  135. package/lib/iot/feedTypes.js.map +1 -1
  136. package/lib/iot/feeds.js +417 -61
  137. package/lib/iot/feeds.js.map +1 -1
  138. package/lib/iot/fieldCategories.js +1169 -203
  139. package/lib/iot/fieldCategories.js.map +1 -1
  140. package/lib/iot/fieldGroupings.js +1686 -263
  141. package/lib/iot/fieldGroupings.js.map +1 -1
  142. package/lib/iot/fields.js +251 -30
  143. package/lib/iot/fields.js.map +1 -1
  144. package/lib/iot/index.js +209 -55
  145. package/lib/iot/index.js.map +1 -1
  146. package/lib/iot/outputs.js +317 -34
  147. package/lib/iot/outputs.js.map +1 -1
  148. package/lib/nionic/index.js +1094 -98
  149. package/lib/nionic/index.js.map +1 -1
  150. package/lib/request.js +1310 -228
  151. package/lib/request.js.map +1 -1
  152. package/lib/sessionTypes/auth0WebAuth.js +3391 -421
  153. package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
  154. package/lib/sessionTypes/index.js +209 -26
  155. package/lib/sessionTypes/index.js.map +1 -1
  156. package/lib/sessionTypes/machineAuth.js +1311 -151
  157. package/lib/sessionTypes/machineAuth.js.map +1 -1
  158. package/lib/sessionTypes/passwordGrantAuth.js +1057 -156
  159. package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
  160. package/lib/utils/events/formatEventUpdateToServer.js +102 -4
  161. package/lib/utils/events/formatEventUpdateToServer.js.map +1 -1
  162. package/lib/utils/events/index.js +51 -10
  163. package/lib/utils/events/index.js.map +1 -1
  164. package/lib/utils/iot/formatOutputFieldDataFromServer.js +224 -18
  165. package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  166. package/lib/utils/iot/index.js +53 -15
  167. package/lib/utils/iot/index.js.map +1 -1
  168. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +203 -13
  169. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  170. package/lib/utils/objects/createCaseChangeFn.js +446 -25
  171. package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
  172. package/lib/utils/objects/index.js +53 -15
  173. package/lib/utils/objects/index.js.map +1 -1
  174. package/lib/utils/objects/map.js +517 -33
  175. package/lib/utils/objects/map.js.map +1 -1
  176. package/lib/utils/objects/toCamelCase.js +36 -11
  177. package/lib/utils/objects/toCamelCase.js.map +1 -1
  178. package/lib/utils/objects/toSnakeCase.js +36 -11
  179. package/lib/utils/objects/toSnakeCase.js.map +1 -1
  180. package/lib/utils/pagination/formatPaginatedDataFromServer.js +265 -14
  181. package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  182. package/lib/utils/pagination/index.js +51 -10
  183. package/lib/utils/pagination/index.js.map +1 -1
  184. package/lib/utils/url/index.js +44 -7
  185. package/lib/utils/url/index.js.map +1 -1
  186. package/lib/utils/url/stringifyParams.js +172 -18
  187. package/lib/utils/url/stringifyParams.js.map +1 -1
  188. package/package.json +31 -35
  189. package/src/bus/channels.js +6 -6
  190. package/src/bus/channels.spec.js +1 -1
  191. package/src/coordinator/applications.js +7 -7
  192. package/src/coordinator/applications.spec.js +1 -1
  193. package/src/coordinator/consent.js +3 -3
  194. package/src/coordinator/edgeNodes.js +3 -3
  195. package/src/coordinator/edgeNodes.spec.js +1 -1
  196. package/src/coordinator/organizations.js +4 -4
  197. package/src/coordinator/organizations.spec.js +1 -1
  198. package/src/coordinator/permissions.js +6 -6
  199. package/src/coordinator/permissions.spec.js +1 -1
  200. package/src/coordinator/roles.js +9 -9
  201. package/src/coordinator/roles.spec.js +1 -1
  202. package/src/coordinator/users.js +12 -12
  203. package/src/coordinator/users.spec.js +1 -1
  204. package/src/events/index.js +18 -18
  205. package/src/events/index.spec.js +3 -3
  206. package/src/files/index.js +9 -9
  207. package/src/files/index.spec.js +2 -2
  208. package/src/index.js +3 -1
  209. package/src/iot/feedTypes.js +2 -2
  210. package/src/iot/feeds.js +4 -4
  211. package/src/iot/feeds.spec.js +1 -1
  212. package/src/iot/fieldCategories.js +10 -10
  213. package/src/iot/fieldCategories.spec.js +2 -2
  214. package/src/iot/fieldGroupings.js +10 -10
  215. package/src/iot/fieldGroupings.spec.js +2 -2
  216. package/src/iot/fields.js +2 -2
  217. package/src/iot/fields.spec.js +1 -1
  218. package/src/iot/outputs.js +2 -2
  219. package/src/iot/outputs.spec.js +1 -1
  220. package/src/request.js +2 -4
  221. package/src/request.spec.js +1 -1
  222. package/src/sessionTypes/auth0WebAuth.spec.js +1 -1
  223. package/src/utils/events/index.js +2 -1
  224. package/src/utils/iot/formatOutputFieldDataFromServer.js +5 -5
  225. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +2 -2
  226. package/src/utils/iot/index.js +2 -1
  227. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +3 -1
  228. package/src/utils/objects/index.js +2 -1
  229. package/src/utils/pagination/formatPaginatedDataFromServer.js +3 -3
  230. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +1 -1
  231. package/src/utils/pagination/index.js +2 -1
  232. package/support/mocharc.yml +1 -1
  233. package/.eslintrc +0 -24
@@ -1,24 +1,917 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TYPE = undefined;
7
-
8
- 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; }; }();
9
-
10
- var _auth0Js = require('auth0-js');
11
-
12
- var _auth0Js2 = _interopRequireDefault(_auth0Js);
13
-
14
- var _axios = require('axios');
15
-
16
- var _axios2 = _interopRequireDefault(_axios);
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
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();
22
915
  /**
23
916
  * A SessionType that allows the user to authenticate with Auth0 and
24
917
  * then gain a valid JWT from the Contxt Auth service. This method
@@ -43,7 +936,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
43
936
  * });
44
937
  */
45
938
 
46
- var PasswordGrantAuth = function () {
939
+ class PasswordGrantAuth {
47
940
  /**
48
941
  * @param {Object} sdk An instance of the SDK so the module can communicate with other modules
49
942
  * @param {Object} sdk.audiences
@@ -55,13 +948,14 @@ var PasswordGrantAuth = function () {
55
948
  * @param {Object} sdk.config.auth
56
949
  * @param {string} sdk.config.auth.clientId The Auth0 client id of the application
57
950
  */
58
- function PasswordGrantAuth(sdk) {
59
- _classCallCheck(this, PasswordGrantAuth);
60
-
951
+ constructor(sdk) {
952
+ cov_1ow59e1xle().f[0]++;
953
+ cov_1ow59e1xle().s[0]++;
61
954
  this._sdk = sdk;
955
+ cov_1ow59e1xle().s[1]++;
62
956
  this._sessionInfo = {};
63
-
64
- this._auth0 = new _auth0Js2.default.Authentication({
957
+ cov_1ow59e1xle().s[2]++;
958
+ this._auth0 = new _auth0Js.default.Authentication({
65
959
  domain: this._sdk.config.auth.domain,
66
960
  clientID: this._sdk.config.auth.clientId
67
961
  });
@@ -74,145 +968,152 @@ var PasswordGrantAuth = function () {
74
968
  * @fulfills {string} apiToken
75
969
  * @rejects {Error}
76
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
+ }
77
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
+ }
78
1000
 
79
- _createClass(PasswordGrantAuth, [{
80
- key: 'getCurrentApiToken',
81
- value: function getCurrentApiToken() {
82
- var _this = this;
83
-
84
- return new Promise(function (resolve, reject) {
85
- if (!_this._sessionInfo.accessToken) {
86
- 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]++;
87
1032
  }
88
-
89
- return resolve(_this._sessionInfo.accessToken);
90
- });
91
- }
92
-
93
- /**
94
- * Tells caller if the current user is authenticated
95
- *
96
- * @returns {boolean}
97
- */
98
-
99
- }, {
100
- key: 'isAuthenticated',
101
- value: function isAuthenticated() {
102
- var hasToken = !!(this._sessionInfo && this._sessionInfo.accessToken);
103
-
104
- return hasToken;
105
- }
106
-
107
- /**
108
- * Logs the user in using Auth0 using a username a password
109
- *
110
- * @param {string} username The username of the user to authenticate
111
- * @param {string} password The password of the user to authenticate
112
- *
113
- * @returns {Promise}
114
- * @fulfills {string}
115
- * @rejects {Error}
116
- */
117
-
118
- }, {
119
- key: 'logIn',
120
- value: function logIn(username, password) {
121
- var _this2 = this;
122
-
123
- return new Promise(function (resolve, reject) {
124
- var audience = _this2._sdk.config.audiences.contxtAuth.clientId;
125
-
126
- _this2._auth0.loginWithDefaultDirectory({ password: password, username: username, audience: audience }, function (err, response) {
127
- if (err) {
128
- var errorMessage = err && err.description || 'Authentication failed.';
129
-
130
- return reject(new Error(errorMessage));
131
- }
132
-
133
- return resolve(response.accessToken);
134
- });
135
- }).then(function (accessToken) {
136
- return _this2._getApiToken(accessToken);
1033
+ cov_1ow59e1xle().s[15]++;
1034
+ return resolve(response.accessToken);
137
1035
  });
138
- }
139
-
140
- /**
141
- * Logs the user out by removing any stored session info.
142
- *
143
- * @returns {Promise}
144
- * @fulfills {string}
145
- */
146
-
147
- }, {
148
- key: 'logOut',
149
- value: function logOut() {
150
- var _this3 = this;
151
-
152
- return new Promise(function (resolve) {
153
- _this3._sessionInfo = {};
154
-
155
- return resolve('Logout successful - session info cleared.');
156
- });
157
- }
158
-
159
- /**
160
- * Requests an access token from Contxt Auth with the correct audiences.
161
- *
162
- * @param {string} accessToken
163
- *
164
- * @returns {Promise}
165
- * @fulfill {string} accessToken
166
- * @rejects {Error}
167
- *
168
- * @private
169
- */
170
-
171
- }, {
172
- key: '_getApiToken',
173
- value: function _getApiToken(accessToken) {
174
- var _this4 = this;
175
-
176
- return _axios2.default.post(this._sdk.config.audiences.contxtAuth.host + '/v1/token', {
177
- audiences: Object.keys(this._sdk.config.audiences).map(function (audienceName) {
178
- return _this4._sdk.config.audiences[audienceName].clientId;
179
- }).filter(function (clientId) {
180
- return clientId && clientId !== _this4._sdk.config.audiences.contxtAuth.clientId;
181
- }),
182
- nonce: 'nonce'
183
- }, {
184
- headers: { Authorization: 'Bearer ' + accessToken }
185
- }).then(function (response) {
186
- var data = response.data;
187
-
1036
+ }).then(accessToken => {
1037
+ cov_1ow59e1xle().f[7]++;
1038
+ cov_1ow59e1xle().s[16]++;
1039
+ return this._getApiToken(accessToken);
1040
+ });
1041
+ }
188
1042
 
189
- _this4._saveSession({
190
- accessToken: data.access_token
191
- });
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
+ }
192
1060
 
193
- 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
194
1097
  });
195
- }
196
-
197
- /**
198
- * Saves the session info (i.e. the Contxt access token) for future use
199
- *
200
- * @param {Object} sessionInfo
201
- * @param {string} sessionInfo.accessToken
202
- *
203
- * @private
204
- */
205
-
206
- }, {
207
- key: '_saveSession',
208
- value: function _saveSession(sessionInfo) {
209
- this._sessionInfo = sessionInfo;
210
- }
211
- }]);
212
-
213
- return PasswordGrantAuth;
214
- }();
1098
+ cov_1ow59e1xle().s[25]++;
1099
+ return data.access_token;
1100
+ });
1101
+ }
215
1102
 
216
- var TYPE = exports.TYPE = 'passwordGrantAuth';
217
- exports.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;
218
1119
  //# sourceMappingURL=passwordGrantAuth.js.map