@frontegg/rest-api 3.0.1 → 3.0.4
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.
- package/ContextHolder.js +67 -101
- package/account-settings/index.js +4 -43
- package/audits/index.js +16 -69
- package/auth/enums.js +2 -2
- package/auth/index.d.ts +4 -0
- package/auth/index.js +354 -2044
- package/auth/interfaces.js +1 -1
- package/auth/secutiry-poilicy/index.js +45 -254
- package/connectivity/index.js +79 -73
- package/constants.js +1 -1
- package/error.js +9 -33
- package/fetch.js +165 -519
- package/index.js +26 -26
- package/jwt.js +19 -45
- package/metadata/index.js +19 -159
- package/node/ContextHolder.js +68 -104
- package/node/account-settings/index.js +4 -46
- package/node/audits/index.js +15 -68
- package/node/auth/enums.js +2 -2
- package/node/auth/index.js +487 -2099
- package/node/auth/interfaces.js +2 -2
- package/node/auth/secutiry-poilicy/index.js +36 -240
- package/node/connectivity/index.js +78 -71
- package/node/constants.js +1 -1
- package/node/error.js +9 -38
- package/node/fetch.js +166 -521
- package/node/index.js +47 -49
- package/node/jwt.js +19 -51
- package/node/metadata/index.js +19 -163
- package/node/notifications/index.js +18 -94
- package/node/reports/index.js +62 -171
- package/node/roles/index.js +34 -172
- package/node/routers.js +2 -2
- package/node/sub-tenants/index.js +12 -126
- package/node/subscriptions/enums.js +4 -4
- package/node/subscriptions/index.js +10 -10
- package/node/subscriptions/interfaces.js +1 -1
- package/node/subscriptions/invoices.js +10 -70
- package/node/subscriptions/managedSubscriptions.js +16 -111
- package/node/subscriptions/paymentMethods.js +15 -69
- package/node/subscriptions/paymentProviders.js +2 -26
- package/node/subscriptions/plans.js +4 -46
- package/node/subscriptions/providers/index.js +1 -1
- package/node/subscriptions/providers/stripe/index.js +10 -106
- package/node/subscriptions/subscriptions.js +16 -111
- package/node/subscriptions/summaries.js +2 -26
- package/node/subscriptions/tenantConfiguration.js +4 -46
- package/node/teams/index.js +57 -406
- package/node/tenants/index.js +8 -86
- package/node/vendor/index.js +2 -26
- package/notifications/index.js +18 -93
- package/package.json +1 -1
- package/reports/index.js +65 -175
- package/roles/index.js +34 -175
- package/routers.js +2 -2
- package/sub-tenants/index.js +12 -127
- package/subscriptions/enums.js +4 -4
- package/subscriptions/invoices.js +12 -70
- package/subscriptions/managedSubscriptions.js +20 -115
- package/subscriptions/paymentMethods.js +16 -70
- package/subscriptions/paymentProviders.js +2 -22
- package/subscriptions/plans.js +4 -43
- package/subscriptions/providers/stripe/index.js +10 -106
- package/subscriptions/subscriptions.js +20 -115
- package/subscriptions/summaries.js +2 -22
- package/subscriptions/tenantConfiguration.js +4 -43
- package/teams/index.js +56 -420
- package/tenants/index.js +8 -85
- package/vendor/index.js +2 -23
package/node/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/** @license Frontegg v3.0.
|
|
1
|
+
/** @license Frontegg v3.0.4
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
5
5
|
*/
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
9
|
-
|
|
10
8
|
Object.defineProperty(exports, "__esModule", {
|
|
11
9
|
value: true
|
|
12
10
|
});
|
|
@@ -25,59 +23,59 @@ var _exportNames = {
|
|
|
25
23
|
};
|
|
26
24
|
Object.defineProperty(exports, "AuthStrategyEnum", {
|
|
27
25
|
enumerable: true,
|
|
28
|
-
get: function
|
|
26
|
+
get: function () {
|
|
29
27
|
return auth.AuthStrategyEnum;
|
|
30
28
|
}
|
|
31
29
|
});
|
|
32
30
|
Object.defineProperty(exports, "ContextHolder", {
|
|
33
31
|
enumerable: true,
|
|
34
|
-
get: function
|
|
32
|
+
get: function () {
|
|
35
33
|
return _ContextHolder.ContextHolder;
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
Object.defineProperty(exports, "FronteggApiError", {
|
|
39
37
|
enumerable: true,
|
|
40
|
-
get: function
|
|
38
|
+
get: function () {
|
|
41
39
|
return _error.FronteggApiError;
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
42
|
Object.defineProperty(exports, "FronteggContext", {
|
|
45
43
|
enumerable: true,
|
|
46
|
-
get: function
|
|
44
|
+
get: function () {
|
|
47
45
|
return _ContextHolder.FronteggContext;
|
|
48
46
|
}
|
|
49
47
|
});
|
|
50
48
|
Object.defineProperty(exports, "ISubscriptionCancellationPolicy", {
|
|
51
49
|
enumerable: true,
|
|
52
|
-
get: function
|
|
50
|
+
get: function () {
|
|
53
51
|
return subscriptions.ISubscriptionCancellationPolicy;
|
|
54
52
|
}
|
|
55
53
|
});
|
|
56
54
|
Object.defineProperty(exports, "ISubscriptionStatus", {
|
|
57
55
|
enumerable: true,
|
|
58
|
-
get: function
|
|
56
|
+
get: function () {
|
|
59
57
|
return subscriptions.ISubscriptionStatus;
|
|
60
58
|
}
|
|
61
59
|
});
|
|
62
60
|
Object.defineProperty(exports, "PaymentMethodType", {
|
|
63
61
|
enumerable: true,
|
|
64
|
-
get: function
|
|
62
|
+
get: function () {
|
|
65
63
|
return subscriptions.PaymentMethodType;
|
|
66
64
|
}
|
|
67
65
|
});
|
|
68
66
|
Object.defineProperty(exports, "ProviderType", {
|
|
69
67
|
enumerable: true,
|
|
70
|
-
get: function
|
|
68
|
+
get: function () {
|
|
71
69
|
return subscriptions.ProviderType;
|
|
72
70
|
}
|
|
73
71
|
});
|
|
74
72
|
Object.defineProperty(exports, "SocialLoginProviders", {
|
|
75
73
|
enumerable: true,
|
|
76
|
-
get: function
|
|
74
|
+
get: function () {
|
|
77
75
|
return auth.SocialLoginProviders;
|
|
78
76
|
}
|
|
79
77
|
});
|
|
80
|
-
exports.fetch = exports
|
|
78
|
+
exports.fetch = exports.default = exports.api = void 0;
|
|
81
79
|
|
|
82
80
|
var auth = _interopRequireWildcard(require("./auth"));
|
|
83
81
|
|
|
@@ -121,7 +119,7 @@ Object.keys(_interfaces).forEach(function (key) {
|
|
|
121
119
|
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
122
120
|
Object.defineProperty(exports, key, {
|
|
123
121
|
enumerable: true,
|
|
124
|
-
get: function
|
|
122
|
+
get: function () {
|
|
125
123
|
return _interfaces[key];
|
|
126
124
|
}
|
|
127
125
|
});
|
|
@@ -135,7 +133,7 @@ Object.keys(_interfaces2).forEach(function (key) {
|
|
|
135
133
|
if (key in exports && exports[key] === _interfaces2[key]) return;
|
|
136
134
|
Object.defineProperty(exports, key, {
|
|
137
135
|
enumerable: true,
|
|
138
|
-
get: function
|
|
136
|
+
get: function () {
|
|
139
137
|
return _interfaces2[key];
|
|
140
138
|
}
|
|
141
139
|
});
|
|
@@ -149,7 +147,7 @@ Object.keys(_interfaces3).forEach(function (key) {
|
|
|
149
147
|
if (key in exports && exports[key] === _interfaces3[key]) return;
|
|
150
148
|
Object.defineProperty(exports, key, {
|
|
151
149
|
enumerable: true,
|
|
152
|
-
get: function
|
|
150
|
+
get: function () {
|
|
153
151
|
return _interfaces3[key];
|
|
154
152
|
}
|
|
155
153
|
});
|
|
@@ -163,7 +161,7 @@ Object.keys(_interfaces4).forEach(function (key) {
|
|
|
163
161
|
if (key in exports && exports[key] === _interfaces4[key]) return;
|
|
164
162
|
Object.defineProperty(exports, key, {
|
|
165
163
|
enumerable: true,
|
|
166
|
-
get: function
|
|
164
|
+
get: function () {
|
|
167
165
|
return _interfaces4[key];
|
|
168
166
|
}
|
|
169
167
|
});
|
|
@@ -177,7 +175,7 @@ Object.keys(_interfaces5).forEach(function (key) {
|
|
|
177
175
|
if (key in exports && exports[key] === _interfaces5[key]) return;
|
|
178
176
|
Object.defineProperty(exports, key, {
|
|
179
177
|
enumerable: true,
|
|
180
|
-
get: function
|
|
178
|
+
get: function () {
|
|
181
179
|
return _interfaces5[key];
|
|
182
180
|
}
|
|
183
181
|
});
|
|
@@ -191,7 +189,7 @@ Object.keys(_interfaces6).forEach(function (key) {
|
|
|
191
189
|
if (key in exports && exports[key] === _interfaces6[key]) return;
|
|
192
190
|
Object.defineProperty(exports, key, {
|
|
193
191
|
enumerable: true,
|
|
194
|
-
get: function
|
|
192
|
+
get: function () {
|
|
195
193
|
return _interfaces6[key];
|
|
196
194
|
}
|
|
197
195
|
});
|
|
@@ -205,7 +203,7 @@ Object.keys(_interfaces7).forEach(function (key) {
|
|
|
205
203
|
if (key in exports && exports[key] === _interfaces7[key]) return;
|
|
206
204
|
Object.defineProperty(exports, key, {
|
|
207
205
|
enumerable: true,
|
|
208
|
-
get: function
|
|
206
|
+
get: function () {
|
|
209
207
|
return _interfaces7[key];
|
|
210
208
|
}
|
|
211
209
|
});
|
|
@@ -219,7 +217,7 @@ Object.keys(_interfaces8).forEach(function (key) {
|
|
|
219
217
|
if (key in exports && exports[key] === _interfaces8[key]) return;
|
|
220
218
|
Object.defineProperty(exports, key, {
|
|
221
219
|
enumerable: true,
|
|
222
|
-
get: function
|
|
220
|
+
get: function () {
|
|
223
221
|
return _interfaces8[key];
|
|
224
222
|
}
|
|
225
223
|
});
|
|
@@ -233,7 +231,7 @@ Object.keys(_interfaces9).forEach(function (key) {
|
|
|
233
231
|
if (key in exports && exports[key] === _interfaces9[key]) return;
|
|
234
232
|
Object.defineProperty(exports, key, {
|
|
235
233
|
enumerable: true,
|
|
236
|
-
get: function
|
|
234
|
+
get: function () {
|
|
237
235
|
return _interfaces9[key];
|
|
238
236
|
}
|
|
239
237
|
});
|
|
@@ -247,7 +245,7 @@ Object.keys(_interfaces10).forEach(function (key) {
|
|
|
247
245
|
if (key in exports && exports[key] === _interfaces10[key]) return;
|
|
248
246
|
Object.defineProperty(exports, key, {
|
|
249
247
|
enumerable: true,
|
|
250
|
-
get: function
|
|
248
|
+
get: function () {
|
|
251
249
|
return _interfaces10[key];
|
|
252
250
|
}
|
|
253
251
|
});
|
|
@@ -261,7 +259,7 @@ Object.keys(_interfaces11).forEach(function (key) {
|
|
|
261
259
|
if (key in exports && exports[key] === _interfaces11[key]) return;
|
|
262
260
|
Object.defineProperty(exports, key, {
|
|
263
261
|
enumerable: true,
|
|
264
|
-
get: function
|
|
262
|
+
get: function () {
|
|
265
263
|
return _interfaces11[key];
|
|
266
264
|
}
|
|
267
265
|
});
|
|
@@ -275,7 +273,7 @@ Object.keys(_interfaces12).forEach(function (key) {
|
|
|
275
273
|
if (key in exports && exports[key] === _interfaces12[key]) return;
|
|
276
274
|
Object.defineProperty(exports, key, {
|
|
277
275
|
enumerable: true,
|
|
278
|
-
get: function
|
|
276
|
+
get: function () {
|
|
279
277
|
return _interfaces12[key];
|
|
280
278
|
}
|
|
281
279
|
});
|
|
@@ -289,7 +287,7 @@ Object.keys(_interfaces13).forEach(function (key) {
|
|
|
289
287
|
if (key in exports && exports[key] === _interfaces13[key]) return;
|
|
290
288
|
Object.defineProperty(exports, key, {
|
|
291
289
|
enumerable: true,
|
|
292
|
-
get: function
|
|
290
|
+
get: function () {
|
|
293
291
|
return _interfaces13[key];
|
|
294
292
|
}
|
|
295
293
|
});
|
|
@@ -303,7 +301,7 @@ Object.keys(_interfaces14).forEach(function (key) {
|
|
|
303
301
|
if (key in exports && exports[key] === _interfaces14[key]) return;
|
|
304
302
|
Object.defineProperty(exports, key, {
|
|
305
303
|
enumerable: true,
|
|
306
|
-
get: function
|
|
304
|
+
get: function () {
|
|
307
305
|
return _interfaces14[key];
|
|
308
306
|
}
|
|
309
307
|
});
|
|
@@ -317,37 +315,37 @@ Object.keys(_routers).forEach(function (key) {
|
|
|
317
315
|
if (key in exports && exports[key] === _routers[key]) return;
|
|
318
316
|
Object.defineProperty(exports, key, {
|
|
319
317
|
enumerable: true,
|
|
320
|
-
get: function
|
|
318
|
+
get: function () {
|
|
321
319
|
return _routers[key];
|
|
322
320
|
}
|
|
323
321
|
});
|
|
324
322
|
});
|
|
325
323
|
|
|
326
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
327
|
-
|
|
328
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
auth
|
|
332
|
-
teams
|
|
333
|
-
metadata
|
|
334
|
-
reports
|
|
335
|
-
connectivity
|
|
336
|
-
notifications
|
|
337
|
-
audits
|
|
338
|
-
tenants
|
|
339
|
-
accountSettings
|
|
340
|
-
roles
|
|
341
|
-
subscriptions
|
|
342
|
-
vendor
|
|
343
|
-
subTenants
|
|
324
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
325
|
+
|
|
326
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
327
|
+
|
|
328
|
+
const api = {
|
|
329
|
+
auth,
|
|
330
|
+
teams,
|
|
331
|
+
metadata,
|
|
332
|
+
reports,
|
|
333
|
+
connectivity,
|
|
334
|
+
notifications,
|
|
335
|
+
audits,
|
|
336
|
+
tenants,
|
|
337
|
+
accountSettings,
|
|
338
|
+
roles,
|
|
339
|
+
subscriptions,
|
|
340
|
+
vendor,
|
|
341
|
+
subTenants
|
|
344
342
|
};
|
|
345
343
|
exports.api = api;
|
|
346
344
|
var _default = {
|
|
347
|
-
fetch
|
|
345
|
+
fetch,
|
|
348
346
|
ContextHolder: _ContextHolder.ContextHolder,
|
|
349
347
|
FronteggContext: _ContextHolder.FronteggContext,
|
|
350
|
-
api
|
|
348
|
+
api,
|
|
351
349
|
FronteggApiError: _error.FronteggApiError,
|
|
352
350
|
AuthStrategyEnum: auth.AuthStrategyEnum,
|
|
353
351
|
SocialLoginProviders: auth.SocialLoginProviders,
|
|
@@ -356,4 +354,4 @@ var _default = {
|
|
|
356
354
|
PaymentMethodType: subscriptions.PaymentMethodType,
|
|
357
355
|
ProviderType: subscriptions.ProviderType
|
|
358
356
|
};
|
|
359
|
-
exports
|
|
357
|
+
exports.default = _default;
|
package/node/jwt.js
CHANGED
|
@@ -1,66 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.jwtDecode = exports.InvalidTokenError = exports.InvalidCharacterError = void 0;
|
|
7
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
|
-
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
21
|
-
|
|
22
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
23
|
-
|
|
24
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
|
-
|
|
26
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
27
|
-
|
|
28
|
-
var InvalidCharacterError = function (_Error) {
|
|
29
|
-
(0, _inherits2["default"])(InvalidCharacterError, _Error);
|
|
30
|
-
|
|
31
|
-
var _super = _createSuper(InvalidCharacterError);
|
|
32
|
-
|
|
33
|
-
function InvalidCharacterError(message) {
|
|
34
|
-
(0, _classCallCheck2["default"])(this, InvalidCharacterError);
|
|
35
|
-
return _super.call(this, message);
|
|
9
|
+
class InvalidCharacterError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
36
12
|
}
|
|
37
13
|
|
|
38
|
-
|
|
39
|
-
}((0, _wrapNativeSuper2["default"])(Error));
|
|
14
|
+
}
|
|
40
15
|
|
|
41
16
|
exports.InvalidCharacterError = InvalidCharacterError;
|
|
42
17
|
|
|
43
18
|
function polyfill(input) {
|
|
44
|
-
|
|
19
|
+
const str = String(input).replace(/=+$/, '');
|
|
45
20
|
|
|
46
21
|
if (str.length % 4 === 1) {
|
|
47
22
|
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
48
23
|
}
|
|
49
24
|
|
|
50
|
-
|
|
25
|
+
let output = '';
|
|
51
26
|
|
|
52
|
-
for (
|
|
27
|
+
for (let bc = 0, bs, buffer, idx = 0; buffer = str.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
|
|
53
28
|
buffer = chars.indexOf(buffer);
|
|
54
29
|
}
|
|
55
30
|
|
|
56
31
|
return output;
|
|
57
32
|
}
|
|
58
33
|
|
|
59
|
-
|
|
34
|
+
const atob = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
|
|
60
35
|
|
|
61
36
|
function b64DecodeUnicode(str) {
|
|
62
|
-
return decodeURIComponent(atob(str).replace(/(.)/g,
|
|
63
|
-
|
|
37
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
38
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
64
39
|
|
|
65
40
|
if (code.length < 2) {
|
|
66
41
|
code = '0' + code;
|
|
@@ -70,8 +45,8 @@ function b64DecodeUnicode(str) {
|
|
|
70
45
|
}));
|
|
71
46
|
}
|
|
72
47
|
|
|
73
|
-
|
|
74
|
-
|
|
48
|
+
const base64UrlDecode = str => {
|
|
49
|
+
let output = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
75
50
|
|
|
76
51
|
switch (output.length % 4) {
|
|
77
52
|
case 0:
|
|
@@ -96,24 +71,17 @@ var base64UrlDecode = function base64UrlDecode(str) {
|
|
|
96
71
|
}
|
|
97
72
|
};
|
|
98
73
|
|
|
99
|
-
|
|
100
|
-
(
|
|
101
|
-
|
|
102
|
-
var _super2 = _createSuper(InvalidTokenError);
|
|
103
|
-
|
|
104
|
-
function InvalidTokenError(message) {
|
|
105
|
-
(0, _classCallCheck2["default"])(this, InvalidTokenError);
|
|
106
|
-
return _super2.call(this, message);
|
|
74
|
+
class InvalidTokenError extends Error {
|
|
75
|
+
constructor(message) {
|
|
76
|
+
super(message);
|
|
107
77
|
}
|
|
108
78
|
|
|
109
|
-
|
|
110
|
-
}((0, _wrapNativeSuper2["default"])(Error));
|
|
79
|
+
}
|
|
111
80
|
|
|
112
81
|
exports.InvalidTokenError = InvalidTokenError;
|
|
113
82
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var pos = !!options.header ? 0 : 1;
|
|
83
|
+
const jwtDecode = (token, options = {}) => {
|
|
84
|
+
const pos = !!options.header ? 0 : 1;
|
|
117
85
|
|
|
118
86
|
try {
|
|
119
87
|
return JSON.parse(base64UrlDecode(token.split('.')[pos]));
|
package/node/metadata/index.js
CHANGED
|
@@ -1,188 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.getSamlMetadata = exports.getNotificationsMetadata = exports.getIpAdressMetadata = exports.getAuditsMetadata = void 0;
|
|
9
7
|
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
8
|
var _fetch = require("../fetch");
|
|
15
9
|
|
|
16
|
-
function getMetadata(
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _getMetadata() {
|
|
21
|
-
_getMetadata = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee5(body) {
|
|
22
|
-
var _data$rows, _data$rows2;
|
|
23
|
-
|
|
24
|
-
var data;
|
|
25
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
26
|
-
while (1) {
|
|
27
|
-
switch (_context5.prev = _context5.next) {
|
|
28
|
-
case 0:
|
|
29
|
-
_context5.next = 2;
|
|
30
|
-
return (0, _fetch.Get)('/metadata', body);
|
|
31
|
-
|
|
32
|
-
case 2:
|
|
33
|
-
data = _context5.sent;
|
|
10
|
+
async function getMetadata(body) {
|
|
11
|
+
var _data$rows, _data$rows2;
|
|
34
12
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return _context5.abrupt("return", data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0]);
|
|
41
|
-
|
|
42
|
-
case 5:
|
|
43
|
-
throw new Error("metadata not found: ".concat(body.entityName));
|
|
44
|
-
|
|
45
|
-
case 6:
|
|
46
|
-
case "end":
|
|
47
|
-
return _context5.stop();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, _callee5);
|
|
51
|
-
}));
|
|
52
|
-
return _getMetadata.apply(this, arguments);
|
|
13
|
+
const data = await (0, _fetch.Get)('/metadata', body);
|
|
14
|
+
if (data != null && (_data$rows = data.rows) != null && _data$rows[0]) return data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0];
|
|
15
|
+
throw new Error(`metadata not found: ${body.entityName}`);
|
|
53
16
|
}
|
|
54
17
|
|
|
55
|
-
function getIpMetadata(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
function _getIpMetadata() {
|
|
60
|
-
_getIpMetadata = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee6(ip) {
|
|
61
|
-
var data;
|
|
62
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
63
|
-
while (1) {
|
|
64
|
-
switch (_context6.prev = _context6.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
_context6.next = 2;
|
|
67
|
-
return (0, _fetch.Get)("/metadata/ip/".concat(ip));
|
|
68
|
-
|
|
69
|
-
case 2:
|
|
70
|
-
data = _context6.sent;
|
|
71
|
-
|
|
72
|
-
if (!data) {
|
|
73
|
-
_context6.next = 5;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return _context6.abrupt("return", data);
|
|
78
|
-
|
|
79
|
-
case 5:
|
|
80
|
-
throw new Error("ip metadata not found");
|
|
81
|
-
|
|
82
|
-
case 6:
|
|
83
|
-
case "end":
|
|
84
|
-
return _context6.stop();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}, _callee6);
|
|
88
|
-
}));
|
|
89
|
-
return _getIpMetadata.apply(this, arguments);
|
|
18
|
+
async function getIpMetadata(ip) {
|
|
19
|
+
const data = await (0, _fetch.Get)(`/metadata/ip/${ip}`);
|
|
20
|
+
if (data) return data;
|
|
21
|
+
throw new Error(`ip metadata not found`);
|
|
90
22
|
}
|
|
91
23
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
while (1) {
|
|
96
|
-
switch (_context.prev = _context.next) {
|
|
97
|
-
case 0:
|
|
98
|
-
return _context.abrupt("return", getMetadata({
|
|
99
|
-
entityName: 'notifications'
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
case 1:
|
|
103
|
-
case "end":
|
|
104
|
-
return _context.stop();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}, _callee);
|
|
108
|
-
}));
|
|
109
|
-
|
|
110
|
-
return function getNotificationsMetadata() {
|
|
111
|
-
return _ref.apply(this, arguments);
|
|
112
|
-
};
|
|
113
|
-
}();
|
|
24
|
+
const getNotificationsMetadata = async () => getMetadata({
|
|
25
|
+
entityName: 'notifications'
|
|
26
|
+
});
|
|
114
27
|
|
|
115
28
|
exports.getNotificationsMetadata = getNotificationsMetadata;
|
|
116
29
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
while (1) {
|
|
121
|
-
switch (_context2.prev = _context2.next) {
|
|
122
|
-
case 0:
|
|
123
|
-
return _context2.abrupt("return", getMetadata({
|
|
124
|
-
entityName: 'saml'
|
|
125
|
-
}));
|
|
126
|
-
|
|
127
|
-
case 1:
|
|
128
|
-
case "end":
|
|
129
|
-
return _context2.stop();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}, _callee2);
|
|
133
|
-
}));
|
|
134
|
-
|
|
135
|
-
return function getSamlMetadata() {
|
|
136
|
-
return _ref2.apply(this, arguments);
|
|
137
|
-
};
|
|
138
|
-
}();
|
|
30
|
+
const getSamlMetadata = async () => getMetadata({
|
|
31
|
+
entityName: 'saml'
|
|
32
|
+
});
|
|
139
33
|
|
|
140
34
|
exports.getSamlMetadata = getSamlMetadata;
|
|
141
35
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
while (1) {
|
|
146
|
-
switch (_context3.prev = _context3.next) {
|
|
147
|
-
case 0:
|
|
148
|
-
return _context3.abrupt("return", getMetadata({
|
|
149
|
-
entityName: 'audits'
|
|
150
|
-
}));
|
|
151
|
-
|
|
152
|
-
case 1:
|
|
153
|
-
case "end":
|
|
154
|
-
return _context3.stop();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}, _callee3);
|
|
158
|
-
}));
|
|
159
|
-
|
|
160
|
-
return function getAuditsMetadata() {
|
|
161
|
-
return _ref3.apply(this, arguments);
|
|
162
|
-
};
|
|
163
|
-
}();
|
|
36
|
+
const getAuditsMetadata = async () => getMetadata({
|
|
37
|
+
entityName: 'audits'
|
|
38
|
+
});
|
|
164
39
|
|
|
165
40
|
exports.getAuditsMetadata = getAuditsMetadata;
|
|
166
41
|
|
|
167
|
-
|
|
168
|
-
var _ref4 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(ip) {
|
|
169
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
170
|
-
while (1) {
|
|
171
|
-
switch (_context4.prev = _context4.next) {
|
|
172
|
-
case 0:
|
|
173
|
-
return _context4.abrupt("return", getIpMetadata(ip));
|
|
174
|
-
|
|
175
|
-
case 1:
|
|
176
|
-
case "end":
|
|
177
|
-
return _context4.stop();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}, _callee4);
|
|
181
|
-
}));
|
|
182
|
-
|
|
183
|
-
return function getIpAdressMetadata(_x3) {
|
|
184
|
-
return _ref4.apply(this, arguments);
|
|
185
|
-
};
|
|
186
|
-
}();
|
|
42
|
+
const getIpAdressMetadata = async ip => getIpMetadata(ip);
|
|
187
43
|
|
|
188
44
|
exports.getIpAdressMetadata = getIpAdressMetadata;
|