@ndustrial/contxt-sdk 5.5.7 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/.nvmrc +1 -1
  2. package/eslint.config.mjs +44 -0
  3. package/esm/bus/channels.js +1883 -216
  4. package/esm/bus/channels.js.map +1 -1
  5. package/esm/bus/index.browser.js +218 -37
  6. package/esm/bus/index.browser.js.map +1 -1
  7. package/esm/bus/index.js +906 -94
  8. package/esm/bus/index.js.map +1 -1
  9. package/esm/bus/webSocketConnection.browser.js +86 -12
  10. package/esm/bus/webSocketConnection.browser.js.map +1 -1
  11. package/esm/bus/webSocketConnection.js +2464 -332
  12. package/esm/bus/webSocketConnection.js.map +1 -1
  13. package/esm/config/audiences.js +37 -1
  14. package/esm/config/audiences.js.map +1 -1
  15. package/esm/config/defaults.js +37 -1
  16. package/esm/config/defaults.js.map +1 -1
  17. package/esm/config/index.js +1622 -203
  18. package/esm/config/index.js.map +1 -1
  19. package/esm/coordinator/applications.js +1019 -172
  20. package/esm/coordinator/applications.js.map +1 -1
  21. package/esm/coordinator/consent.js +603 -76
  22. package/esm/coordinator/consent.js.map +1 -1
  23. package/esm/coordinator/edgeNodes.js +520 -40
  24. package/esm/coordinator/edgeNodes.js.map +1 -1
  25. package/esm/coordinator/index.js +811 -54
  26. package/esm/coordinator/index.js.map +1 -1
  27. package/esm/coordinator/organizations.js +533 -60
  28. package/esm/coordinator/organizations.js.map +1 -1
  29. package/esm/coordinator/permissions.js +914 -107
  30. package/esm/coordinator/permissions.js.map +1 -1
  31. package/esm/coordinator/roles.js +2146 -258
  32. package/esm/coordinator/roles.js.map +1 -1
  33. package/esm/coordinator/users.js +3393 -484
  34. package/esm/coordinator/users.js.map +1 -1
  35. package/esm/events/index.js +2301 -393
  36. package/esm/events/index.js.map +1 -1
  37. package/esm/files/index.js +2053 -410
  38. package/esm/files/index.js.map +1 -1
  39. package/esm/index.js +1002 -148
  40. package/esm/index.js.map +1 -1
  41. package/esm/iot/feedTypes.js +188 -25
  42. package/esm/iot/feedTypes.js.map +1 -1
  43. package/esm/iot/feeds.js +420 -59
  44. package/esm/iot/feeds.js.map +1 -1
  45. package/esm/iot/fieldCategories.js +1172 -195
  46. package/esm/iot/fieldCategories.js.map +1 -1
  47. package/esm/iot/fieldGroupings.js +1689 -255
  48. package/esm/iot/fieldGroupings.js.map +1 -1
  49. package/esm/iot/fields.js +254 -28
  50. package/esm/iot/fields.js.map +1 -1
  51. package/esm/iot/index.js +212 -34
  52. package/esm/iot/index.js.map +1 -1
  53. package/esm/iot/outputs.js +320 -31
  54. package/esm/iot/outputs.js.map +1 -1
  55. package/esm/nionic/index.js +1097 -97
  56. package/esm/nionic/index.js.map +1 -1
  57. package/esm/request.js +1313 -219
  58. package/esm/request.js.map +1 -1
  59. package/esm/sessionTypes/auth0WebAuth.js +3395 -409
  60. package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
  61. package/esm/sessionTypes/index.js +213 -22
  62. package/esm/sessionTypes/index.js.map +1 -1
  63. package/esm/sessionTypes/machineAuth.js +1314 -144
  64. package/esm/sessionTypes/machineAuth.js.map +1 -1
  65. package/esm/sessionTypes/passwordGrantAuth.js +1060 -145
  66. package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
  67. package/esm/utils/events/formatEventUpdateToServer.js +107 -4
  68. package/esm/utils/events/formatEventUpdateToServer.js.map +1 -1
  69. package/esm/utils/events/index.js +54 -2
  70. package/esm/utils/events/index.js.map +1 -1
  71. package/esm/utils/iot/formatOutputFieldDataFromServer.js +227 -14
  72. package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  73. package/esm/utils/iot/index.js +56 -3
  74. package/esm/utils/iot/index.js.map +1 -1
  75. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +207 -7
  76. package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  77. package/esm/utils/objects/createCaseChangeFn.js +449 -18
  78. package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
  79. package/esm/utils/objects/index.js +56 -3
  80. package/esm/utils/objects/index.js.map +1 -1
  81. package/esm/utils/objects/map.js +520 -26
  82. package/esm/utils/objects/map.js.map +1 -1
  83. package/esm/utils/objects/toCamelCase.js +39 -3
  84. package/esm/utils/objects/toCamelCase.js.map +1 -1
  85. package/esm/utils/objects/toSnakeCase.js +39 -3
  86. package/esm/utils/objects/toSnakeCase.js.map +1 -1
  87. package/esm/utils/pagination/formatPaginatedDataFromServer.js +268 -11
  88. package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  89. package/esm/utils/pagination/index.js +54 -2
  90. package/esm/utils/pagination/index.js.map +1 -1
  91. package/esm/utils/url/index.js +47 -2
  92. package/esm/utils/url/index.js.map +1 -1
  93. package/esm/utils/url/stringifyParams.js +176 -10
  94. package/esm/utils/url/stringifyParams.js.map +1 -1
  95. package/lib/bus/channels.js +1880 -223
  96. package/lib/bus/channels.js.map +1 -1
  97. package/lib/bus/index.browser.js +215 -43
  98. package/lib/bus/index.browser.js.map +1 -1
  99. package/lib/bus/index.js +903 -106
  100. package/lib/bus/index.js.map +1 -1
  101. package/lib/bus/webSocketConnection.browser.js +83 -15
  102. package/lib/bus/webSocketConnection.browser.js.map +1 -1
  103. package/lib/bus/webSocketConnection.js +2461 -339
  104. package/lib/bus/webSocketConnection.js.map +1 -1
  105. package/lib/config/audiences.js +33 -2
  106. package/lib/config/audiences.js.map +1 -1
  107. package/lib/config/defaults.js +33 -2
  108. package/lib/config/defaults.js.map +1 -1
  109. package/lib/config/index.js +1619 -212
  110. package/lib/config/index.js.map +1 -1
  111. package/lib/coordinator/applications.js +1016 -174
  112. package/lib/coordinator/applications.js.map +1 -1
  113. package/lib/coordinator/consent.js +600 -78
  114. package/lib/coordinator/consent.js.map +1 -1
  115. package/lib/coordinator/edgeNodes.js +517 -42
  116. package/lib/coordinator/edgeNodes.js.map +1 -1
  117. package/lib/coordinator/index.js +808 -78
  118. package/lib/coordinator/index.js.map +1 -1
  119. package/lib/coordinator/organizations.js +530 -62
  120. package/lib/coordinator/organizations.js.map +1 -1
  121. package/lib/coordinator/permissions.js +911 -109
  122. package/lib/coordinator/permissions.js.map +1 -1
  123. package/lib/coordinator/roles.js +2143 -260
  124. package/lib/coordinator/roles.js.map +1 -1
  125. package/lib/coordinator/users.js +3389 -489
  126. package/lib/coordinator/users.js.map +1 -1
  127. package/lib/events/index.js +2297 -404
  128. package/lib/events/index.js.map +1 -1
  129. package/lib/files/index.js +2050 -418
  130. package/lib/files/index.js.map +1 -1
  131. package/lib/index.js +999 -183
  132. package/lib/index.js.map +1 -1
  133. package/lib/iot/feedTypes.js +185 -27
  134. package/lib/iot/feedTypes.js.map +1 -1
  135. package/lib/iot/feeds.js +417 -61
  136. package/lib/iot/feeds.js.map +1 -1
  137. package/lib/iot/fieldCategories.js +1169 -203
  138. package/lib/iot/fieldCategories.js.map +1 -1
  139. package/lib/iot/fieldGroupings.js +1686 -263
  140. package/lib/iot/fieldGroupings.js.map +1 -1
  141. package/lib/iot/fields.js +251 -30
  142. package/lib/iot/fields.js.map +1 -1
  143. package/lib/iot/index.js +209 -55
  144. package/lib/iot/index.js.map +1 -1
  145. package/lib/iot/outputs.js +317 -34
  146. package/lib/iot/outputs.js.map +1 -1
  147. package/lib/nionic/index.js +1094 -98
  148. package/lib/nionic/index.js.map +1 -1
  149. package/lib/request.js +1310 -226
  150. package/lib/request.js.map +1 -1
  151. package/lib/sessionTypes/auth0WebAuth.js +3391 -421
  152. package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
  153. package/lib/sessionTypes/index.js +209 -26
  154. package/lib/sessionTypes/index.js.map +1 -1
  155. package/lib/sessionTypes/machineAuth.js +1311 -151
  156. package/lib/sessionTypes/machineAuth.js.map +1 -1
  157. package/lib/sessionTypes/passwordGrantAuth.js +1057 -156
  158. package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
  159. package/lib/utils/events/formatEventUpdateToServer.js +102 -4
  160. package/lib/utils/events/formatEventUpdateToServer.js.map +1 -1
  161. package/lib/utils/events/index.js +51 -10
  162. package/lib/utils/events/index.js.map +1 -1
  163. package/lib/utils/iot/formatOutputFieldDataFromServer.js +224 -18
  164. package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
  165. package/lib/utils/iot/index.js +53 -15
  166. package/lib/utils/iot/index.js.map +1 -1
  167. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +203 -13
  168. package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
  169. package/lib/utils/objects/createCaseChangeFn.js +446 -25
  170. package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
  171. package/lib/utils/objects/index.js +53 -15
  172. package/lib/utils/objects/index.js.map +1 -1
  173. package/lib/utils/objects/map.js +517 -33
  174. package/lib/utils/objects/map.js.map +1 -1
  175. package/lib/utils/objects/toCamelCase.js +36 -11
  176. package/lib/utils/objects/toCamelCase.js.map +1 -1
  177. package/lib/utils/objects/toSnakeCase.js +36 -11
  178. package/lib/utils/objects/toSnakeCase.js.map +1 -1
  179. package/lib/utils/pagination/formatPaginatedDataFromServer.js +265 -14
  180. package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
  181. package/lib/utils/pagination/index.js +51 -10
  182. package/lib/utils/pagination/index.js.map +1 -1
  183. package/lib/utils/url/index.js +44 -7
  184. package/lib/utils/url/index.js.map +1 -1
  185. package/lib/utils/url/stringifyParams.js +172 -18
  186. package/lib/utils/url/stringifyParams.js.map +1 -1
  187. package/package.json +31 -35
  188. package/src/bus/channels.js +6 -6
  189. package/src/bus/channels.spec.js +1 -1
  190. package/src/coordinator/applications.js +7 -7
  191. package/src/coordinator/applications.spec.js +1 -1
  192. package/src/coordinator/consent.js +3 -3
  193. package/src/coordinator/edgeNodes.js +3 -3
  194. package/src/coordinator/edgeNodes.spec.js +1 -1
  195. package/src/coordinator/organizations.js +4 -4
  196. package/src/coordinator/organizations.spec.js +1 -1
  197. package/src/coordinator/permissions.js +6 -6
  198. package/src/coordinator/permissions.spec.js +1 -1
  199. package/src/coordinator/roles.js +9 -9
  200. package/src/coordinator/roles.spec.js +1 -1
  201. package/src/coordinator/users.js +12 -12
  202. package/src/coordinator/users.spec.js +1 -1
  203. package/src/events/index.js +18 -18
  204. package/src/events/index.spec.js +3 -3
  205. package/src/files/index.js +9 -9
  206. package/src/files/index.spec.js +2 -2
  207. package/src/index.js +3 -1
  208. package/src/iot/feedTypes.js +2 -2
  209. package/src/iot/feeds.js +4 -4
  210. package/src/iot/feeds.spec.js +1 -1
  211. package/src/iot/fieldCategories.js +10 -10
  212. package/src/iot/fieldCategories.spec.js +2 -2
  213. package/src/iot/fieldGroupings.js +10 -10
  214. package/src/iot/fieldGroupings.spec.js +2 -2
  215. package/src/iot/fields.js +2 -2
  216. package/src/iot/fields.spec.js +1 -1
  217. package/src/iot/outputs.js +2 -2
  218. package/src/iot/outputs.spec.js +1 -1
  219. package/src/sessionTypes/auth0WebAuth.spec.js +1 -1
  220. package/src/utils/events/index.js +2 -1
  221. package/src/utils/iot/formatOutputFieldDataFromServer.js +5 -5
  222. package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +2 -2
  223. package/src/utils/iot/index.js +2 -1
  224. package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +3 -1
  225. package/src/utils/objects/index.js +2 -1
  226. package/src/utils/pagination/formatPaginatedDataFromServer.js +3 -3
  227. package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +1 -1
  228. package/src/utils/pagination/index.js +2 -1
  229. package/support/mocharc.yml +1 -1
  230. package/.eslintrc +0 -24
@@ -1,9 +1,786 @@
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 { toCamelCase } from '../utils/objects';
1
+ "use strict";
6
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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();
7
784
  /**
8
785
  * @typedef {Object} ContxtUserPermissions
9
786
  * @property {number[]} applicationsExplicit Application ids the user has directly been given access to
@@ -19,22 +796,23 @@ import { toCamelCase } from '../utils/objects';
19
796
  *
20
797
  * @typicalname contxtSdk.coordinator.permissions
21
798
  */
22
-
23
- var Permissions = function () {
799
+ class Permissions {
24
800
  /**
25
801
  * @param {Object} sdk An instance of the SDK so the module can communicate with other modules
26
802
  * @param {Object} request An instance of the request module tied to this module's audience.
27
803
  * @param {string} baseUrl The base URL provided by the parent module
28
804
  * @param {string} [organizationId] The organization ID to be used in tenant url requests
29
805
  */
30
- function Permissions(sdk, request, baseUrl) {
31
- var organizationId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
32
-
33
- _classCallCheck(this, Permissions);
34
-
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]++;
35
810
  this._baseUrl = baseUrl;
811
+ cov_2rafwvh61v().s[1]++;
36
812
  this._request = request;
813
+ cov_2rafwvh61v().s[2]++;
37
814
  this._sdk = sdk;
815
+ cov_2rafwvh61v().s[3]++;
38
816
  this._organizationId = organizationId;
39
817
  }
40
818
 
@@ -57,110 +835,139 @@ var Permissions = function () {
57
835
  * .then((usersPermissions) => console.log(usersPermissions))
58
836
  * .catch((err) => console.log(err));
59
837
  */
60
-
61
-
62
- _createClass(Permissions, [{
63
- key: 'getAllByOrganizationId',
64
- value: function getAllByOrganizationId(organizationId) {
65
- if (this._organizationId) {
66
- return this._request.get(this._baseUrl + '/users/permissions').then(function (userPermissions) {
67
- return toCamelCase(userPermissions);
68
- });
69
- }
70
-
71
- if (!organizationId) {
72
- return Promise.reject(new Error('An organization ID is required for getting users permissions for an organization'));
73
- }
74
-
75
- return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/users/permissions').then(function (userPermissions) {
76
- return 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);
77
848
  });
849
+ } else {
850
+ cov_2rafwvh61v().b[1][1]++;
78
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
+ }
79
867
 
80
- /**
81
- * Gets a single user's permissions within an organization
82
- *
83
- * Legacy API Endpoint: '/organizations/:organizationId/users/:userId/permissions'
84
- * API Endpoint: '/users/:userId/permissions'
85
- * Method: GET
86
- *
87
- * @param {string} organizationId The ID of the organization, optional when using the tenant API and an organization ID has been set
88
- * @param {string} userId The ID of the user
89
- *
90
- * @returns {Promise}
91
- * @fulfill {ContxtUserPermissions} A single user's permissions
92
- * @reject {Error}
93
- *
94
- * @example
95
- * contxtSdk.coordinator.permissions
96
- * .getOneByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b', 'auth0|12345')
97
- * .then((usersPermissions) => console.log(usersPermissions))
98
- * .catch((err) => console.log(err));
99
- */
100
-
101
- }, {
102
- key: 'getOneByOrganizationId',
103
- value: function getOneByOrganizationId(organizationId, userId) {
104
- if (this._organizationId) {
105
- if (!userId) {
106
- return Promise.reject(new Error("A user ID is required for getting a user's permissions for an organization"));
107
- }
108
-
109
- return this._request.get(this._baseUrl + '/users/' + userId + '/permissions').then(function (userPermissions) {
110
- return toCamelCase(userPermissions);
111
- });
112
- }
113
-
114
- if (!organizationId) {
115
- return Promise.reject(new Error("An organization ID is required for getting a user's permissions for an organization"));
116
- }
117
-
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]++;
118
894
  if (!userId) {
895
+ cov_2rafwvh61v().b[4][0]++;
896
+ cov_2rafwvh61v().s[13]++;
119
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]++;
120
900
  }
121
-
122
- return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/users/' + userId + '/permissions').then(function (userPermissions) {
123
- return 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);
124
906
  });
907
+ } else {
908
+ cov_2rafwvh61v().b[3][1]++;
125
909
  }
126
-
127
- /**
128
- * Gets a map of permission scopes to which the user has access
129
- *
130
- * API Endpoint: '/users/:userId/permissions'
131
- * Method: GET
132
- *
133
- * @param {string} userId The ID of the user
134
- *
135
- * @returns {Promise}
136
- * @fulfill {Object.<string, string[]>} A map of user permissions where the
137
- * key corresponds to a service ID (i.e. the ID generated by Auth0) and the
138
- * value is an array of permission scopes that are managed by Contxt (e.g.
139
- * `read:facilities` and `write:facilities`)
140
- * @reject {Error}
141
- *
142
- * @example
143
- * contxtSdk.coordinator.permissions
144
- * .getByUserId('auth0|12345')
145
- * .then((permissionsMap) => console.log(permissionsMap))
146
- * .catch((err) => console.log(err));
147
- */
148
-
149
- }, {
150
- key: 'getByUserId',
151
- value: function getByUserId(userId) {
152
- if (!userId) {
153
- return Promise.reject(new Error("A user ID is required for getting information about a user's permissions map"));
154
- }
155
-
156
- // NOTE: This response is not run through the `toCamelCase` method because
157
- // it could errantly remove underscores from service IDs.
158
- 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]++;
159
925
  }
160
- }]);
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
+ }
161
933
 
162
- return Permissions;
163
- }();
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
+ }
164
965
 
165
- export 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;
166
973
  //# sourceMappingURL=permissions.js.map