@ndustrial/contxt-sdk 5.5.6 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +6 -0
  3. package/eslint.config.mjs +44 -0
  4. package/esm/bus/channels.js +1883 -216
  5. package/esm/bus/channels.js.map +1 -1
  6. package/esm/bus/index.browser.js +218 -37
  7. package/esm/bus/index.browser.js.map +1 -1
  8. package/esm/bus/index.js +906 -94
  9. package/esm/bus/index.js.map +1 -1
  10. package/esm/bus/webSocketConnection.browser.js +86 -12
  11. package/esm/bus/webSocketConnection.browser.js.map +1 -1
  12. package/esm/bus/webSocketConnection.js +2464 -332
  13. package/esm/bus/webSocketConnection.js.map +1 -1
  14. package/esm/config/audiences.js +37 -1
  15. package/esm/config/audiences.js.map +1 -1
  16. package/esm/config/defaults.js +37 -1
  17. package/esm/config/defaults.js.map +1 -1
  18. package/esm/config/index.js +1622 -203
  19. package/esm/config/index.js.map +1 -1
  20. package/esm/coordinator/applications.js +1019 -172
  21. package/esm/coordinator/applications.js.map +1 -1
  22. package/esm/coordinator/consent.js +603 -76
  23. package/esm/coordinator/consent.js.map +1 -1
  24. package/esm/coordinator/edgeNodes.js +520 -40
  25. package/esm/coordinator/edgeNodes.js.map +1 -1
  26. package/esm/coordinator/index.js +811 -54
  27. package/esm/coordinator/index.js.map +1 -1
  28. package/esm/coordinator/organizations.js +533 -60
  29. package/esm/coordinator/organizations.js.map +1 -1
  30. package/esm/coordinator/permissions.js +914 -107
  31. package/esm/coordinator/permissions.js.map +1 -1
  32. package/esm/coordinator/roles.js +2146 -258
  33. package/esm/coordinator/roles.js.map +1 -1
  34. package/esm/coordinator/users.js +3393 -484
  35. package/esm/coordinator/users.js.map +1 -1
  36. package/esm/events/index.js +2301 -393
  37. package/esm/events/index.js.map +1 -1
  38. package/esm/files/index.js +2053 -410
  39. package/esm/files/index.js.map +1 -1
  40. package/esm/index.js +1002 -148
  41. package/esm/index.js.map +1 -1
  42. package/esm/iot/feedTypes.js +188 -25
  43. package/esm/iot/feedTypes.js.map +1 -1
  44. package/esm/iot/feeds.js +420 -59
  45. package/esm/iot/feeds.js.map +1 -1
  46. package/esm/iot/fieldCategories.js +1172 -195
  47. package/esm/iot/fieldCategories.js.map +1 -1
  48. package/esm/iot/fieldGroupings.js +1689 -255
  49. package/esm/iot/fieldGroupings.js.map +1 -1
  50. package/esm/iot/fields.js +254 -28
  51. package/esm/iot/fields.js.map +1 -1
  52. package/esm/iot/index.js +212 -34
  53. package/esm/iot/index.js.map +1 -1
  54. package/esm/iot/outputs.js +320 -31
  55. package/esm/iot/outputs.js.map +1 -1
  56. package/esm/nionic/index.js +1097 -97
  57. package/esm/nionic/index.js.map +1 -1
  58. package/esm/request.js +1313 -221
  59. package/esm/request.js.map +1 -1
  60. package/esm/sessionTypes/auth0WebAuth.js +3395 -409
  61. package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
  62. package/esm/sessionTypes/index.js +213 -22
  63. package/esm/sessionTypes/index.js.map +1 -1
  64. package/esm/sessionTypes/machineAuth.js +1314 -144
  65. package/esm/sessionTypes/machineAuth.js.map +1 -1
  66. package/esm/sessionTypes/passwordGrantAuth.js +1060 -145
  67. package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
  68. package/esm/utils/events/formatEventUpdateToServer.js +107 -4
  69. package/esm/utils/events/formatEventUpdateToServer.js.map +1 -1
  70. package/esm/utils/events/index.js +54 -2
  71. package/esm/utils/events/index.js.map +1 -1
  72. package/esm/utils/iot/formatOutputFieldDataFromServer.js +227 -14
  73. package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  74. package/esm/utils/iot/index.js +56 -3
  75. package/esm/utils/iot/index.js.map +1 -1
  76. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +207 -7
  77. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  78. package/esm/utils/objects/createCaseChangeFn.js +449 -18
  79. package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
  80. package/esm/utils/objects/index.js +56 -3
  81. package/esm/utils/objects/index.js.map +1 -1
  82. package/esm/utils/objects/map.js +520 -26
  83. package/esm/utils/objects/map.js.map +1 -1
  84. package/esm/utils/objects/toCamelCase.js +39 -3
  85. package/esm/utils/objects/toCamelCase.js.map +1 -1
  86. package/esm/utils/objects/toSnakeCase.js +39 -3
  87. package/esm/utils/objects/toSnakeCase.js.map +1 -1
  88. package/esm/utils/pagination/formatPaginatedDataFromServer.js +268 -11
  89. package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  90. package/esm/utils/pagination/index.js +54 -2
  91. package/esm/utils/pagination/index.js.map +1 -1
  92. package/esm/utils/url/index.js +47 -2
  93. package/esm/utils/url/index.js.map +1 -1
  94. package/esm/utils/url/stringifyParams.js +176 -10
  95. package/esm/utils/url/stringifyParams.js.map +1 -1
  96. package/lib/bus/channels.js +1880 -223
  97. package/lib/bus/channels.js.map +1 -1
  98. package/lib/bus/index.browser.js +215 -43
  99. package/lib/bus/index.browser.js.map +1 -1
  100. package/lib/bus/index.js +903 -106
  101. package/lib/bus/index.js.map +1 -1
  102. package/lib/bus/webSocketConnection.browser.js +83 -15
  103. package/lib/bus/webSocketConnection.browser.js.map +1 -1
  104. package/lib/bus/webSocketConnection.js +2461 -339
  105. package/lib/bus/webSocketConnection.js.map +1 -1
  106. package/lib/config/audiences.js +33 -2
  107. package/lib/config/audiences.js.map +1 -1
  108. package/lib/config/defaults.js +33 -2
  109. package/lib/config/defaults.js.map +1 -1
  110. package/lib/config/index.js +1619 -212
  111. package/lib/config/index.js.map +1 -1
  112. package/lib/coordinator/applications.js +1016 -174
  113. package/lib/coordinator/applications.js.map +1 -1
  114. package/lib/coordinator/consent.js +600 -78
  115. package/lib/coordinator/consent.js.map +1 -1
  116. package/lib/coordinator/edgeNodes.js +517 -42
  117. package/lib/coordinator/edgeNodes.js.map +1 -1
  118. package/lib/coordinator/index.js +808 -78
  119. package/lib/coordinator/index.js.map +1 -1
  120. package/lib/coordinator/organizations.js +530 -62
  121. package/lib/coordinator/organizations.js.map +1 -1
  122. package/lib/coordinator/permissions.js +911 -109
  123. package/lib/coordinator/permissions.js.map +1 -1
  124. package/lib/coordinator/roles.js +2143 -260
  125. package/lib/coordinator/roles.js.map +1 -1
  126. package/lib/coordinator/users.js +3389 -489
  127. package/lib/coordinator/users.js.map +1 -1
  128. package/lib/events/index.js +2297 -404
  129. package/lib/events/index.js.map +1 -1
  130. package/lib/files/index.js +2050 -418
  131. package/lib/files/index.js.map +1 -1
  132. package/lib/index.js +999 -183
  133. package/lib/index.js.map +1 -1
  134. package/lib/iot/feedTypes.js +185 -27
  135. package/lib/iot/feedTypes.js.map +1 -1
  136. package/lib/iot/feeds.js +417 -61
  137. package/lib/iot/feeds.js.map +1 -1
  138. package/lib/iot/fieldCategories.js +1169 -203
  139. package/lib/iot/fieldCategories.js.map +1 -1
  140. package/lib/iot/fieldGroupings.js +1686 -263
  141. package/lib/iot/fieldGroupings.js.map +1 -1
  142. package/lib/iot/fields.js +251 -30
  143. package/lib/iot/fields.js.map +1 -1
  144. package/lib/iot/index.js +209 -55
  145. package/lib/iot/index.js.map +1 -1
  146. package/lib/iot/outputs.js +317 -34
  147. package/lib/iot/outputs.js.map +1 -1
  148. package/lib/nionic/index.js +1094 -98
  149. package/lib/nionic/index.js.map +1 -1
  150. package/lib/request.js +1310 -228
  151. package/lib/request.js.map +1 -1
  152. package/lib/sessionTypes/auth0WebAuth.js +3391 -421
  153. package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
  154. package/lib/sessionTypes/index.js +209 -26
  155. package/lib/sessionTypes/index.js.map +1 -1
  156. package/lib/sessionTypes/machineAuth.js +1311 -151
  157. package/lib/sessionTypes/machineAuth.js.map +1 -1
  158. package/lib/sessionTypes/passwordGrantAuth.js +1057 -156
  159. package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
  160. package/lib/utils/events/formatEventUpdateToServer.js +102 -4
  161. package/lib/utils/events/formatEventUpdateToServer.js.map +1 -1
  162. package/lib/utils/events/index.js +51 -10
  163. package/lib/utils/events/index.js.map +1 -1
  164. package/lib/utils/iot/formatOutputFieldDataFromServer.js +224 -18
  165. package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  166. package/lib/utils/iot/index.js +53 -15
  167. package/lib/utils/iot/index.js.map +1 -1
  168. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +203 -13
  169. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  170. package/lib/utils/objects/createCaseChangeFn.js +446 -25
  171. package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
  172. package/lib/utils/objects/index.js +53 -15
  173. package/lib/utils/objects/index.js.map +1 -1
  174. package/lib/utils/objects/map.js +517 -33
  175. package/lib/utils/objects/map.js.map +1 -1
  176. package/lib/utils/objects/toCamelCase.js +36 -11
  177. package/lib/utils/objects/toCamelCase.js.map +1 -1
  178. package/lib/utils/objects/toSnakeCase.js +36 -11
  179. package/lib/utils/objects/toSnakeCase.js.map +1 -1
  180. package/lib/utils/pagination/formatPaginatedDataFromServer.js +265 -14
  181. package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  182. package/lib/utils/pagination/index.js +51 -10
  183. package/lib/utils/pagination/index.js.map +1 -1
  184. package/lib/utils/url/index.js +44 -7
  185. package/lib/utils/url/index.js.map +1 -1
  186. package/lib/utils/url/stringifyParams.js +172 -18
  187. package/lib/utils/url/stringifyParams.js.map +1 -1
  188. package/package.json +31 -35
  189. package/src/bus/channels.js +6 -6
  190. package/src/bus/channels.spec.js +1 -1
  191. package/src/coordinator/applications.js +7 -7
  192. package/src/coordinator/applications.spec.js +1 -1
  193. package/src/coordinator/consent.js +3 -3
  194. package/src/coordinator/edgeNodes.js +3 -3
  195. package/src/coordinator/edgeNodes.spec.js +1 -1
  196. package/src/coordinator/organizations.js +4 -4
  197. package/src/coordinator/organizations.spec.js +1 -1
  198. package/src/coordinator/permissions.js +6 -6
  199. package/src/coordinator/permissions.spec.js +1 -1
  200. package/src/coordinator/roles.js +9 -9
  201. package/src/coordinator/roles.spec.js +1 -1
  202. package/src/coordinator/users.js +12 -12
  203. package/src/coordinator/users.spec.js +1 -1
  204. package/src/events/index.js +18 -18
  205. package/src/events/index.spec.js +3 -3
  206. package/src/files/index.js +9 -9
  207. package/src/files/index.spec.js +2 -2
  208. package/src/index.js +3 -1
  209. package/src/iot/feedTypes.js +2 -2
  210. package/src/iot/feeds.js +4 -4
  211. package/src/iot/feeds.spec.js +1 -1
  212. package/src/iot/fieldCategories.js +10 -10
  213. package/src/iot/fieldCategories.spec.js +2 -2
  214. package/src/iot/fieldGroupings.js +10 -10
  215. package/src/iot/fieldGroupings.spec.js +2 -2
  216. package/src/iot/fields.js +2 -2
  217. package/src/iot/fields.spec.js +1 -1
  218. package/src/iot/outputs.js +2 -2
  219. package/src/iot/outputs.spec.js +1 -1
  220. package/src/request.js +2 -4
  221. package/src/request.spec.js +1 -1
  222. package/src/sessionTypes/auth0WebAuth.spec.js +1 -1
  223. package/src/utils/events/index.js +2 -1
  224. package/src/utils/iot/formatOutputFieldDataFromServer.js +5 -5
  225. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +2 -2
  226. package/src/utils/iot/index.js +2 -1
  227. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +3 -1
  228. package/src/utils/objects/index.js +2 -1
  229. package/src/utils/pagination/formatPaginatedDataFromServer.js +3 -3
  230. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +1 -1
  231. package/src/utils/pagination/index.js +2 -1
  232. package/support/mocharc.yml +1 -1
  233. package/.eslintrc +0 -24
@@ -1,15 +1,786 @@
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 _objects = require('../utils/objects');
10
-
11
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
-
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.promise.js");
8
+ var _objects = _interopRequireDefault(require("../utils/objects"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ function cov_2rafwvh61v() {
11
+ var path = "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/coordinator/permissions.js";
12
+ var hash = "378a73bd2ec2ff22e67e3993d2ea8ba2d712db22";
13
+ var global = new Function("return this")();
14
+ var gcv = "__coverage__";
15
+ var coverageData = {
16
+ path: "/home/runner/work/contxt-sdk-js/contxt-sdk-js/src/coordinator/permissions.js",
17
+ statementMap: {
18
+ "0": {
19
+ start: {
20
+ line: 26,
21
+ column: 4
22
+ },
23
+ end: {
24
+ line: 26,
25
+ column: 28
26
+ }
27
+ },
28
+ "1": {
29
+ start: {
30
+ line: 27,
31
+ column: 4
32
+ },
33
+ end: {
34
+ line: 27,
35
+ column: 28
36
+ }
37
+ },
38
+ "2": {
39
+ start: {
40
+ line: 28,
41
+ column: 4
42
+ },
43
+ end: {
44
+ line: 28,
45
+ column: 20
46
+ }
47
+ },
48
+ "3": {
49
+ start: {
50
+ line: 29,
51
+ column: 4
52
+ },
53
+ end: {
54
+ line: 29,
55
+ column: 42
56
+ }
57
+ },
58
+ "4": {
59
+ start: {
60
+ line: 52,
61
+ column: 4
62
+ },
63
+ end: {
64
+ line: 56,
65
+ column: 5
66
+ }
67
+ },
68
+ "5": {
69
+ start: {
70
+ line: 53,
71
+ column: 6
72
+ },
73
+ end: {
74
+ line: 55,
75
+ column: 77
76
+ }
77
+ },
78
+ "6": {
79
+ start: {
80
+ line: 55,
81
+ column: 35
82
+ },
83
+ end: {
84
+ line: 55,
85
+ column: 75
86
+ }
87
+ },
88
+ "7": {
89
+ start: {
90
+ line: 58,
91
+ column: 4
92
+ },
93
+ end: {
94
+ line: 64,
95
+ column: 5
96
+ }
97
+ },
98
+ "8": {
99
+ start: {
100
+ line: 59,
101
+ column: 6
102
+ },
103
+ end: {
104
+ line: 63,
105
+ column: 8
106
+ }
107
+ },
108
+ "9": {
109
+ start: {
110
+ line: 66,
111
+ column: 4
112
+ },
113
+ end: {
114
+ line: 68,
115
+ column: 75
116
+ }
117
+ },
118
+ "10": {
119
+ start: {
120
+ line: 68,
121
+ column: 33
122
+ },
123
+ end: {
124
+ line: 68,
125
+ column: 73
126
+ }
127
+ },
128
+ "11": {
129
+ start: {
130
+ line: 92,
131
+ column: 4
132
+ },
133
+ end: {
134
+ line: 104,
135
+ column: 5
136
+ }
137
+ },
138
+ "12": {
139
+ start: {
140
+ line: 93,
141
+ column: 6
142
+ },
143
+ end: {
144
+ line: 99,
145
+ column: 7
146
+ }
147
+ },
148
+ "13": {
149
+ start: {
150
+ line: 94,
151
+ column: 8
152
+ },
153
+ end: {
154
+ line: 98,
155
+ column: 10
156
+ }
157
+ },
158
+ "14": {
159
+ start: {
160
+ line: 101,
161
+ column: 6
162
+ },
163
+ end: {
164
+ line: 103,
165
+ column: 77
166
+ }
167
+ },
168
+ "15": {
169
+ start: {
170
+ line: 103,
171
+ column: 35
172
+ },
173
+ end: {
174
+ line: 103,
175
+ column: 75
176
+ }
177
+ },
178
+ "16": {
179
+ start: {
180
+ line: 106,
181
+ column: 4
182
+ },
183
+ end: {
184
+ line: 112,
185
+ column: 5
186
+ }
187
+ },
188
+ "17": {
189
+ start: {
190
+ line: 107,
191
+ column: 6
192
+ },
193
+ end: {
194
+ line: 111,
195
+ column: 8
196
+ }
197
+ },
198
+ "18": {
199
+ start: {
200
+ line: 114,
201
+ column: 4
202
+ },
203
+ end: {
204
+ line: 120,
205
+ column: 5
206
+ }
207
+ },
208
+ "19": {
209
+ start: {
210
+ line: 115,
211
+ column: 6
212
+ },
213
+ end: {
214
+ line: 119,
215
+ column: 8
216
+ }
217
+ },
218
+ "20": {
219
+ start: {
220
+ line: 122,
221
+ column: 4
222
+ },
223
+ end: {
224
+ line: 128,
225
+ column: 75
226
+ }
227
+ },
228
+ "21": {
229
+ start: {
230
+ line: 128,
231
+ column: 33
232
+ },
233
+ end: {
234
+ line: 128,
235
+ column: 73
236
+ }
237
+ },
238
+ "22": {
239
+ start: {
240
+ line: 153,
241
+ column: 4
242
+ },
243
+ end: {
244
+ line: 159,
245
+ column: 5
246
+ }
247
+ },
248
+ "23": {
249
+ start: {
250
+ line: 154,
251
+ column: 6
252
+ },
253
+ end: {
254
+ line: 158,
255
+ column: 8
256
+ }
257
+ },
258
+ "24": {
259
+ start: {
260
+ line: 163,
261
+ column: 4
262
+ },
263
+ end: {
264
+ line: 163,
265
+ column: 77
266
+ }
267
+ }
268
+ },
269
+ fnMap: {
270
+ "0": {
271
+ name: "(anonymous_0)",
272
+ decl: {
273
+ start: {
274
+ line: 25,
275
+ column: 2
276
+ },
277
+ end: {
278
+ line: 25,
279
+ column: 3
280
+ }
281
+ },
282
+ loc: {
283
+ start: {
284
+ line: 25,
285
+ column: 60
286
+ },
287
+ end: {
288
+ line: 30,
289
+ column: 3
290
+ }
291
+ },
292
+ line: 25
293
+ },
294
+ "1": {
295
+ name: "(anonymous_1)",
296
+ decl: {
297
+ start: {
298
+ line: 51,
299
+ column: 2
300
+ },
301
+ end: {
302
+ line: 51,
303
+ column: 3
304
+ }
305
+ },
306
+ loc: {
307
+ start: {
308
+ line: 51,
309
+ column: 41
310
+ },
311
+ end: {
312
+ line: 69,
313
+ column: 3
314
+ }
315
+ },
316
+ line: 51
317
+ },
318
+ "2": {
319
+ name: "(anonymous_2)",
320
+ decl: {
321
+ start: {
322
+ line: 55,
323
+ column: 14
324
+ },
325
+ end: {
326
+ line: 55,
327
+ column: 15
328
+ }
329
+ },
330
+ loc: {
331
+ start: {
332
+ line: 55,
333
+ column: 35
334
+ },
335
+ end: {
336
+ line: 55,
337
+ column: 75
338
+ }
339
+ },
340
+ line: 55
341
+ },
342
+ "3": {
343
+ name: "(anonymous_3)",
344
+ decl: {
345
+ start: {
346
+ line: 68,
347
+ column: 12
348
+ },
349
+ end: {
350
+ line: 68,
351
+ column: 13
352
+ }
353
+ },
354
+ loc: {
355
+ start: {
356
+ line: 68,
357
+ column: 33
358
+ },
359
+ end: {
360
+ line: 68,
361
+ column: 73
362
+ }
363
+ },
364
+ line: 68
365
+ },
366
+ "4": {
367
+ name: "(anonymous_4)",
368
+ decl: {
369
+ start: {
370
+ line: 91,
371
+ column: 2
372
+ },
373
+ end: {
374
+ line: 91,
375
+ column: 3
376
+ }
377
+ },
378
+ loc: {
379
+ start: {
380
+ line: 91,
381
+ column: 49
382
+ },
383
+ end: {
384
+ line: 129,
385
+ column: 3
386
+ }
387
+ },
388
+ line: 91
389
+ },
390
+ "5": {
391
+ name: "(anonymous_5)",
392
+ decl: {
393
+ start: {
394
+ line: 103,
395
+ column: 14
396
+ },
397
+ end: {
398
+ line: 103,
399
+ column: 15
400
+ }
401
+ },
402
+ loc: {
403
+ start: {
404
+ line: 103,
405
+ column: 35
406
+ },
407
+ end: {
408
+ line: 103,
409
+ column: 75
410
+ }
411
+ },
412
+ line: 103
413
+ },
414
+ "6": {
415
+ name: "(anonymous_6)",
416
+ decl: {
417
+ start: {
418
+ line: 128,
419
+ column: 12
420
+ },
421
+ end: {
422
+ line: 128,
423
+ column: 13
424
+ }
425
+ },
426
+ loc: {
427
+ start: {
428
+ line: 128,
429
+ column: 33
430
+ },
431
+ end: {
432
+ line: 128,
433
+ column: 73
434
+ }
435
+ },
436
+ line: 128
437
+ },
438
+ "7": {
439
+ name: "(anonymous_7)",
440
+ decl: {
441
+ start: {
442
+ line: 152,
443
+ column: 2
444
+ },
445
+ end: {
446
+ line: 152,
447
+ column: 3
448
+ }
449
+ },
450
+ loc: {
451
+ start: {
452
+ line: 152,
453
+ column: 22
454
+ },
455
+ end: {
456
+ line: 164,
457
+ column: 3
458
+ }
459
+ },
460
+ line: 152
461
+ }
462
+ },
463
+ branchMap: {
464
+ "0": {
465
+ loc: {
466
+ start: {
467
+ line: 25,
468
+ column: 37
469
+ },
470
+ end: {
471
+ line: 25,
472
+ column: 58
473
+ }
474
+ },
475
+ type: "default-arg",
476
+ locations: [{
477
+ start: {
478
+ line: 25,
479
+ column: 54
480
+ },
481
+ end: {
482
+ line: 25,
483
+ column: 58
484
+ }
485
+ }],
486
+ line: 25
487
+ },
488
+ "1": {
489
+ loc: {
490
+ start: {
491
+ line: 52,
492
+ column: 4
493
+ },
494
+ end: {
495
+ line: 56,
496
+ column: 5
497
+ }
498
+ },
499
+ type: "if",
500
+ locations: [{
501
+ start: {
502
+ line: 52,
503
+ column: 4
504
+ },
505
+ end: {
506
+ line: 56,
507
+ column: 5
508
+ }
509
+ }, {
510
+ start: {
511
+ line: undefined,
512
+ column: undefined
513
+ },
514
+ end: {
515
+ line: undefined,
516
+ column: undefined
517
+ }
518
+ }],
519
+ line: 52
520
+ },
521
+ "2": {
522
+ loc: {
523
+ start: {
524
+ line: 58,
525
+ column: 4
526
+ },
527
+ end: {
528
+ line: 64,
529
+ column: 5
530
+ }
531
+ },
532
+ type: "if",
533
+ locations: [{
534
+ start: {
535
+ line: 58,
536
+ column: 4
537
+ },
538
+ end: {
539
+ line: 64,
540
+ column: 5
541
+ }
542
+ }, {
543
+ start: {
544
+ line: undefined,
545
+ column: undefined
546
+ },
547
+ end: {
548
+ line: undefined,
549
+ column: undefined
550
+ }
551
+ }],
552
+ line: 58
553
+ },
554
+ "3": {
555
+ loc: {
556
+ start: {
557
+ line: 92,
558
+ column: 4
559
+ },
560
+ end: {
561
+ line: 104,
562
+ column: 5
563
+ }
564
+ },
565
+ type: "if",
566
+ locations: [{
567
+ start: {
568
+ line: 92,
569
+ column: 4
570
+ },
571
+ end: {
572
+ line: 104,
573
+ column: 5
574
+ }
575
+ }, {
576
+ start: {
577
+ line: undefined,
578
+ column: undefined
579
+ },
580
+ end: {
581
+ line: undefined,
582
+ column: undefined
583
+ }
584
+ }],
585
+ line: 92
586
+ },
587
+ "4": {
588
+ loc: {
589
+ start: {
590
+ line: 93,
591
+ column: 6
592
+ },
593
+ end: {
594
+ line: 99,
595
+ column: 7
596
+ }
597
+ },
598
+ type: "if",
599
+ locations: [{
600
+ start: {
601
+ line: 93,
602
+ column: 6
603
+ },
604
+ end: {
605
+ line: 99,
606
+ column: 7
607
+ }
608
+ }, {
609
+ start: {
610
+ line: undefined,
611
+ column: undefined
612
+ },
613
+ end: {
614
+ line: undefined,
615
+ column: undefined
616
+ }
617
+ }],
618
+ line: 93
619
+ },
620
+ "5": {
621
+ loc: {
622
+ start: {
623
+ line: 106,
624
+ column: 4
625
+ },
626
+ end: {
627
+ line: 112,
628
+ column: 5
629
+ }
630
+ },
631
+ type: "if",
632
+ locations: [{
633
+ start: {
634
+ line: 106,
635
+ column: 4
636
+ },
637
+ end: {
638
+ line: 112,
639
+ column: 5
640
+ }
641
+ }, {
642
+ start: {
643
+ line: undefined,
644
+ column: undefined
645
+ },
646
+ end: {
647
+ line: undefined,
648
+ column: undefined
649
+ }
650
+ }],
651
+ line: 106
652
+ },
653
+ "6": {
654
+ loc: {
655
+ start: {
656
+ line: 114,
657
+ column: 4
658
+ },
659
+ end: {
660
+ line: 120,
661
+ column: 5
662
+ }
663
+ },
664
+ type: "if",
665
+ locations: [{
666
+ start: {
667
+ line: 114,
668
+ column: 4
669
+ },
670
+ end: {
671
+ line: 120,
672
+ column: 5
673
+ }
674
+ }, {
675
+ start: {
676
+ line: undefined,
677
+ column: undefined
678
+ },
679
+ end: {
680
+ line: undefined,
681
+ column: undefined
682
+ }
683
+ }],
684
+ line: 114
685
+ },
686
+ "7": {
687
+ loc: {
688
+ start: {
689
+ line: 153,
690
+ column: 4
691
+ },
692
+ end: {
693
+ line: 159,
694
+ column: 5
695
+ }
696
+ },
697
+ type: "if",
698
+ locations: [{
699
+ start: {
700
+ line: 153,
701
+ column: 4
702
+ },
703
+ end: {
704
+ line: 159,
705
+ column: 5
706
+ }
707
+ }, {
708
+ start: {
709
+ line: undefined,
710
+ column: undefined
711
+ },
712
+ end: {
713
+ line: undefined,
714
+ column: undefined
715
+ }
716
+ }],
717
+ line: 153
718
+ }
719
+ },
720
+ s: {
721
+ "0": 0,
722
+ "1": 0,
723
+ "2": 0,
724
+ "3": 0,
725
+ "4": 0,
726
+ "5": 0,
727
+ "6": 0,
728
+ "7": 0,
729
+ "8": 0,
730
+ "9": 0,
731
+ "10": 0,
732
+ "11": 0,
733
+ "12": 0,
734
+ "13": 0,
735
+ "14": 0,
736
+ "15": 0,
737
+ "16": 0,
738
+ "17": 0,
739
+ "18": 0,
740
+ "19": 0,
741
+ "20": 0,
742
+ "21": 0,
743
+ "22": 0,
744
+ "23": 0,
745
+ "24": 0
746
+ },
747
+ f: {
748
+ "0": 0,
749
+ "1": 0,
750
+ "2": 0,
751
+ "3": 0,
752
+ "4": 0,
753
+ "5": 0,
754
+ "6": 0,
755
+ "7": 0
756
+ },
757
+ b: {
758
+ "0": [0],
759
+ "1": [0, 0],
760
+ "2": [0, 0],
761
+ "3": [0, 0],
762
+ "4": [0, 0],
763
+ "5": [0, 0],
764
+ "6": [0, 0],
765
+ "7": [0, 0]
766
+ },
767
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
768
+ hash: "378a73bd2ec2ff22e67e3993d2ea8ba2d712db22"
769
+ };
770
+ var coverage = global[gcv] || (global[gcv] = {});
771
+ if (!coverage[path] || coverage[path].hash !== hash) {
772
+ coverage[path] = coverageData;
773
+ }
774
+ var actualCoverage = coverage[path];
775
+ {
776
+ // @ts-ignore
777
+ cov_2rafwvh61v = function () {
778
+ return actualCoverage;
779
+ };
780
+ }
781
+ return actualCoverage;
782
+ }
783
+ cov_2rafwvh61v();
13
784
  /**
14
785
  * @typedef {Object} ContxtUserPermissions
15
786
  * @property {number[]} applicationsExplicit Application ids the user has directly been given access to
@@ -25,21 +796,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
25
796
  *
26
797
  * @typicalname contxtSdk.coordinator.permissions
27
798
  */
28
- var Permissions = function () {
799
+ class Permissions {
29
800
  /**
30
801
  * @param {Object} sdk An instance of the SDK so the module can communicate with other modules
31
802
  * @param {Object} request An instance of the request module tied to this module's audience.
32
803
  * @param {string} baseUrl The base URL provided by the parent module
33
804
  * @param {string} [organizationId] The organization ID to be used in tenant url requests
34
805
  */
35
- function Permissions(sdk, request, baseUrl) {
36
- var organizationId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
37
-
38
- _classCallCheck(this, Permissions);
39
-
806
+ constructor(sdk, request, baseUrl) {
807
+ let organizationId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : (cov_2rafwvh61v().b[0][0]++, null);
808
+ cov_2rafwvh61v().f[0]++;
809
+ cov_2rafwvh61v().s[0]++;
40
810
  this._baseUrl = baseUrl;
811
+ cov_2rafwvh61v().s[1]++;
41
812
  this._request = request;
813
+ cov_2rafwvh61v().s[2]++;
42
814
  this._sdk = sdk;
815
+ cov_2rafwvh61v().s[3]++;
43
816
  this._organizationId = organizationId;
44
817
  }
45
818
 
@@ -62,110 +835,139 @@ var Permissions = function () {
62
835
  * .then((usersPermissions) => console.log(usersPermissions))
63
836
  * .catch((err) => console.log(err));
64
837
  */
65
-
66
-
67
- _createClass(Permissions, [{
68
- key: 'getAllByOrganizationId',
69
- value: function getAllByOrganizationId(organizationId) {
70
- if (this._organizationId) {
71
- return this._request.get(this._baseUrl + '/users/permissions').then(function (userPermissions) {
72
- return (0, _objects.toCamelCase)(userPermissions);
73
- });
74
- }
75
-
76
- if (!organizationId) {
77
- return Promise.reject(new Error('An organization ID is required for getting users permissions for an organization'));
78
- }
79
-
80
- return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/users/permissions').then(function (userPermissions) {
81
- return (0, _objects.toCamelCase)(userPermissions);
838
+ getAllByOrganizationId(organizationId) {
839
+ cov_2rafwvh61v().f[1]++;
840
+ cov_2rafwvh61v().s[4]++;
841
+ if (this._organizationId) {
842
+ cov_2rafwvh61v().b[1][0]++;
843
+ cov_2rafwvh61v().s[5]++;
844
+ return this._request.get(`${this._baseUrl}/users/permissions`).then(userPermissions => {
845
+ cov_2rafwvh61v().f[2]++;
846
+ cov_2rafwvh61v().s[6]++;
847
+ return _objects.default.toCamelCase(userPermissions);
82
848
  });
849
+ } else {
850
+ cov_2rafwvh61v().b[1][1]++;
83
851
  }
852
+ cov_2rafwvh61v().s[7]++;
853
+ if (!organizationId) {
854
+ cov_2rafwvh61v().b[2][0]++;
855
+ cov_2rafwvh61v().s[8]++;
856
+ return Promise.reject(new Error('An organization ID is required for getting users permissions for an organization'));
857
+ } else {
858
+ cov_2rafwvh61v().b[2][1]++;
859
+ }
860
+ cov_2rafwvh61v().s[9]++;
861
+ return this._request.get(`${this._baseUrl}/organizations/${organizationId}/users/permissions`).then(userPermissions => {
862
+ cov_2rafwvh61v().f[3]++;
863
+ cov_2rafwvh61v().s[10]++;
864
+ return _objects.default.toCamelCase(userPermissions);
865
+ });
866
+ }
84
867
 
85
- /**
86
- * Gets a single user's permissions within an organization
87
- *
88
- * Legacy API Endpoint: '/organizations/:organizationId/users/:userId/permissions'
89
- * API Endpoint: '/users/:userId/permissions'
90
- * Method: GET
91
- *
92
- * @param {string} organizationId The ID of the organization, optional when using the tenant API and an organization ID has been set
93
- * @param {string} userId The ID of the user
94
- *
95
- * @returns {Promise}
96
- * @fulfill {ContxtUserPermissions} A single user's permissions
97
- * @reject {Error}
98
- *
99
- * @example
100
- * contxtSdk.coordinator.permissions
101
- * .getOneByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b', 'auth0|12345')
102
- * .then((usersPermissions) => console.log(usersPermissions))
103
- * .catch((err) => console.log(err));
104
- */
105
-
106
- }, {
107
- key: 'getOneByOrganizationId',
108
- value: function getOneByOrganizationId(organizationId, userId) {
109
- if (this._organizationId) {
110
- if (!userId) {
111
- return Promise.reject(new Error("A user ID is required for getting a user's permissions for an organization"));
112
- }
113
-
114
- return this._request.get(this._baseUrl + '/users/' + userId + '/permissions').then(function (userPermissions) {
115
- return (0, _objects.toCamelCase)(userPermissions);
116
- });
117
- }
118
-
119
- if (!organizationId) {
120
- return Promise.reject(new Error("An organization ID is required for getting a user's permissions for an organization"));
121
- }
122
-
868
+ /**
869
+ * Gets a single user's permissions within an organization
870
+ *
871
+ * Legacy API Endpoint: '/organizations/:organizationId/users/:userId/permissions'
872
+ * API Endpoint: '/users/:userId/permissions'
873
+ * Method: GET
874
+ *
875
+ * @param {string} organizationId The ID of the organization, optional when using the tenant API and an organization ID has been set
876
+ * @param {string} userId The ID of the user
877
+ *
878
+ * @returns {Promise}
879
+ * @fulfill {ContxtUserPermissions} A single user's permissions
880
+ * @reject {Error}
881
+ *
882
+ * @example
883
+ * contxtSdk.coordinator.permissions
884
+ * .getOneByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b', 'auth0|12345')
885
+ * .then((usersPermissions) => console.log(usersPermissions))
886
+ * .catch((err) => console.log(err));
887
+ */
888
+ getOneByOrganizationId(organizationId, userId) {
889
+ cov_2rafwvh61v().f[4]++;
890
+ cov_2rafwvh61v().s[11]++;
891
+ if (this._organizationId) {
892
+ cov_2rafwvh61v().b[3][0]++;
893
+ cov_2rafwvh61v().s[12]++;
123
894
  if (!userId) {
895
+ cov_2rafwvh61v().b[4][0]++;
896
+ cov_2rafwvh61v().s[13]++;
124
897
  return Promise.reject(new Error("A user ID is required for getting a user's permissions for an organization"));
898
+ } else {
899
+ cov_2rafwvh61v().b[4][1]++;
125
900
  }
126
-
127
- return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/users/' + userId + '/permissions').then(function (userPermissions) {
128
- return (0, _objects.toCamelCase)(userPermissions);
901
+ cov_2rafwvh61v().s[14]++;
902
+ return this._request.get(`${this._baseUrl}/users/${userId}/permissions`).then(userPermissions => {
903
+ cov_2rafwvh61v().f[5]++;
904
+ cov_2rafwvh61v().s[15]++;
905
+ return _objects.default.toCamelCase(userPermissions);
129
906
  });
907
+ } else {
908
+ cov_2rafwvh61v().b[3][1]++;
130
909
  }
131
-
132
- /**
133
- * Gets a map of permission scopes to which the user has access
134
- *
135
- * API Endpoint: '/users/:userId/permissions'
136
- * Method: GET
137
- *
138
- * @param {string} userId The ID of the user
139
- *
140
- * @returns {Promise}
141
- * @fulfill {Object.<string, string[]>} A map of user permissions where the
142
- * key corresponds to a service ID (i.e. the ID generated by Auth0) and the
143
- * value is an array of permission scopes that are managed by Contxt (e.g.
144
- * `read:facilities` and `write:facilities`)
145
- * @reject {Error}
146
- *
147
- * @example
148
- * contxtSdk.coordinator.permissions
149
- * .getByUserId('auth0|12345')
150
- * .then((permissionsMap) => console.log(permissionsMap))
151
- * .catch((err) => console.log(err));
152
- */
153
-
154
- }, {
155
- key: 'getByUserId',
156
- value: function getByUserId(userId) {
157
- if (!userId) {
158
- return Promise.reject(new Error("A user ID is required for getting information about a user's permissions map"));
159
- }
160
-
161
- // NOTE: This response is not run through the `toCamelCase` method because
162
- // it could errantly remove underscores from service IDs.
163
- return this._request.get(this._baseUrl + '/users/' + userId + '/permissions');
910
+ cov_2rafwvh61v().s[16]++;
911
+ if (!organizationId) {
912
+ cov_2rafwvh61v().b[5][0]++;
913
+ cov_2rafwvh61v().s[17]++;
914
+ return Promise.reject(new Error("An organization ID is required for getting a user's permissions for an organization"));
915
+ } else {
916
+ cov_2rafwvh61v().b[5][1]++;
917
+ }
918
+ cov_2rafwvh61v().s[18]++;
919
+ if (!userId) {
920
+ cov_2rafwvh61v().b[6][0]++;
921
+ cov_2rafwvh61v().s[19]++;
922
+ return Promise.reject(new Error("A user ID is required for getting a user's permissions for an organization"));
923
+ } else {
924
+ cov_2rafwvh61v().b[6][1]++;
164
925
  }
165
- }]);
926
+ cov_2rafwvh61v().s[20]++;
927
+ return this._request.get(`${this._baseUrl}/organizations/${organizationId}/users/${userId}/permissions`).then(userPermissions => {
928
+ cov_2rafwvh61v().f[6]++;
929
+ cov_2rafwvh61v().s[21]++;
930
+ return _objects.default.toCamelCase(userPermissions);
931
+ });
932
+ }
166
933
 
167
- return Permissions;
168
- }();
934
+ /**
935
+ * Gets a map of permission scopes to which the user has access
936
+ *
937
+ * API Endpoint: '/users/:userId/permissions'
938
+ * Method: GET
939
+ *
940
+ * @param {string} userId The ID of the user
941
+ *
942
+ * @returns {Promise}
943
+ * @fulfill {Object.<string, string[]>} A map of user permissions where the
944
+ * key corresponds to a service ID (i.e. the ID generated by Auth0) and the
945
+ * value is an array of permission scopes that are managed by Contxt (e.g.
946
+ * `read:facilities` and `write:facilities`)
947
+ * @reject {Error}
948
+ *
949
+ * @example
950
+ * contxtSdk.coordinator.permissions
951
+ * .getByUserId('auth0|12345')
952
+ * .then((permissionsMap) => console.log(permissionsMap))
953
+ * .catch((err) => console.log(err));
954
+ */
955
+ getByUserId(userId) {
956
+ cov_2rafwvh61v().f[7]++;
957
+ cov_2rafwvh61v().s[22]++;
958
+ if (!userId) {
959
+ cov_2rafwvh61v().b[7][0]++;
960
+ cov_2rafwvh61v().s[23]++;
961
+ return Promise.reject(new Error("A user ID is required for getting information about a user's permissions map"));
962
+ } else {
963
+ cov_2rafwvh61v().b[7][1]++;
964
+ }
169
965
 
170
- exports.default = Permissions;
966
+ // NOTE: This response is not run through the `ObjectUtils.toCamelCase` method because
967
+ // it could errantly remove underscores from service IDs.
968
+ cov_2rafwvh61v().s[24]++;
969
+ return this._request.get(`${this._baseUrl}/users/${userId}/permissions`);
970
+ }
971
+ }
972
+ var _default = exports.default = Permissions;
171
973
  //# sourceMappingURL=permissions.js.map