@frontegg/rest-api 6.0.1-alpha.4 → 7.28.0-alpha.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.
- package/BaseApiClient.d.ts +16 -0
- package/BaseApiClient.js +30 -0
- package/ContextHolder/index.d.ts +160 -0
- package/ContextHolder/index.js +278 -0
- package/ContextHolder/package.json +6 -0
- package/FetchClient.d.ts +42 -0
- package/FetchClient.js +260 -0
- package/account-settings/index.d.ts +21 -7
- package/account-settings/index.js +25 -6
- package/account-settings/interfaces.d.ts +9 -2
- package/applications/index.d.ts +51 -0
- package/applications/index.js +55 -0
- package/applications/interfaces.d.ts +49 -0
- package/applications/interfaces.js +5 -0
- package/applications/package.json +6 -0
- package/audits/index.d.ts +27 -15
- package/audits/index.js +29 -16
- package/audits/interfaces.d.ts +3 -2
- package/auth/constants.d.ts +5 -0
- package/auth/constants.js +5 -0
- package/auth/enums.d.ts +8 -1
- package/auth/enums.js +9 -4
- package/auth/index.d.ts +833 -428
- package/auth/index.js +768 -385
- package/auth/interfaces.d.ts +341 -39
- package/auth/interfaces.js +19 -9
- package/auth/secutiry-poilicy/index.d.ts +60 -41
- package/auth/secutiry-poilicy/index.js +99 -45
- package/auth/secutiry-poilicy/interfaces.d.ts +62 -2
- package/auth/secutiry-poilicy/interfaces.js +5 -1
- package/auth/utils.d.ts +10 -0
- package/auth/utils.js +35 -0
- package/connectivity/index.d.ts +126 -27
- package/connectivity/index.js +120 -114
- package/constants.d.ts +115 -0
- package/constants.js +122 -5
- package/directory/index.d.ts +32 -0
- package/directory/index.js +30 -0
- package/directory/interfaces.d.ts +30 -0
- package/directory/interfaces.js +7 -0
- package/directory/package.json +6 -0
- package/entitlements/index.d.ts +15 -0
- package/entitlements/index.js +20 -0
- package/entitlements/interfaces.d.ts +13 -0
- package/entitlements/interfaces.js +11 -0
- package/entitlements/package.json +6 -0
- package/error.js +0 -2
- package/feature-flags/index.d.ts +18 -0
- package/feature-flags/index.js +44 -0
- package/feature-flags/interfaces.d.ts +5 -0
- package/feature-flags/interfaces.js +1 -0
- package/feature-flags/package.json +6 -0
- package/groups/enums.d.ts +9 -0
- package/groups/enums.js +11 -0
- package/groups/index.d.ts +73 -0
- package/groups/index.js +62 -0
- package/groups/interfaces.d.ts +64 -0
- package/groups/interfaces.js +1 -0
- package/groups/package.json +6 -0
- package/impersonate/index.d.ts +17 -0
- package/impersonate/index.js +23 -0
- package/impersonate/interfaces.d.ts +12 -0
- package/impersonate/interfaces.js +1 -0
- package/impersonate/package.json +6 -0
- package/index.d.ts +148 -53
- package/index.js +103 -31
- package/interfaces.d.ts +82 -1
- package/interfaces.js +28 -1
- package/jwt.js +19 -20
- package/metadata/index.d.ts +68 -5
- package/metadata/index.js +53 -23
- package/metadata/interfaces.d.ts +10 -2
- package/node/BaseApiClient.js +37 -0
- package/node/ContextHolder/index.js +286 -0
- package/node/FetchClient.js +268 -0
- package/node/account-settings/index.js +26 -11
- package/node/applications/index.js +62 -0
- package/node/applications/interfaces.js +12 -0
- package/node/audits/index.js +32 -27
- package/node/auth/constants.js +13 -0
- package/node/auth/enums.js +11 -5
- package/node/auth/index.js +807 -644
- package/node/auth/interfaces.js +27 -13
- package/node/auth/secutiry-poilicy/index.js +100 -66
- package/node/auth/secutiry-poilicy/interfaces.js +8 -1
- package/node/auth/utils.js +44 -0
- package/node/connectivity/index.js +123 -197
- package/node/constants.js +124 -6
- package/node/directory/index.js +37 -0
- package/node/directory/interfaces.js +14 -0
- package/node/entitlements/index.js +27 -0
- package/node/entitlements/interfaces.js +18 -0
- package/node/error.js +0 -4
- package/node/feature-flags/index.js +54 -0
- package/node/feature-flags/interfaces.js +5 -0
- package/node/groups/enums.js +19 -0
- package/node/groups/index.js +70 -0
- package/node/groups/interfaces.js +5 -0
- package/node/impersonate/index.js +29 -0
- package/node/impersonate/interfaces.js +5 -0
- package/node/index.js +324 -94
- package/node/interfaces.js +34 -1
- package/node/jwt.js +19 -25
- package/node/metadata/index.js +57 -38
- package/node/notifications/index.js +34 -31
- package/node/reports/index.js +79 -83
- package/node/roles/index.js +55 -60
- package/node/roles/interfaces.js +9 -1
- package/node/routers.js +52 -6
- package/node/security-center/index.js +26 -0
- package/node/security-center/interfaces.js +74 -0
- package/node/sub-tenants/index.js +82 -29
- package/node/sub-tenants/interfaces.js +9 -1
- package/node/subscriptions/enums.js +13 -9
- package/node/subscriptions/index.js +64 -109
- package/node/subscriptions/interfaces.js +0 -2
- package/node/subscriptions/invoices.js +20 -21
- package/node/subscriptions/managedSubscriptions.js +28 -33
- package/node/subscriptions/paymentMethods.js +23 -27
- package/node/subscriptions/paymentProviders.js +11 -8
- package/node/subscriptions/plans.js +13 -12
- package/node/subscriptions/providers/stripe/index.js +22 -27
- package/node/subscriptions/subscriptions.js +28 -33
- package/node/subscriptions/summaries.js +11 -8
- package/node/subscriptions/tenantConfiguration.js +13 -12
- package/node/subscriptions/vendorPublicConfigurations.js +17 -0
- package/node/teams/index.js +108 -121
- package/node/teams/interfaces.js +8 -1
- package/node/tenants/index.js +63 -21
- package/node/tenants/interfaces.js +18 -1
- package/node/user-phone-numbers/index.js +38 -0
- package/node/user-phone-numbers/interfaces.js +5 -0
- package/node/users/index.js +64 -0
- package/node/users/interfaces.js +27 -0
- package/node/velo/index.js +75 -0
- package/node/velo/interfaces.js +5 -0
- package/node/vendor/index.js +16 -8
- package/notifications/index.d.ts +22 -16
- package/notifications/index.js +33 -22
- package/package.json +4 -2
- package/reports/index.d.ts +50 -44
- package/reports/index.js +77 -68
- package/reports/interfaces.d.ts +2 -2
- package/roles/index.d.ts +45 -34
- package/roles/index.js +52 -41
- package/roles/interfaces.d.ts +25 -9
- package/roles/interfaces.js +6 -1
- package/routers.d.ts +6 -1
- package/routers.js +45 -2
- package/security-center/index.d.ts +15 -0
- package/security-center/index.js +19 -0
- package/security-center/interfaces.d.ts +115 -0
- package/security-center/interfaces.js +63 -0
- package/security-center/package.json +6 -0
- package/sub-tenants/index.d.ts +57 -8
- package/sub-tenants/index.js +84 -19
- package/sub-tenants/interfaces.d.ts +68 -10
- package/sub-tenants/interfaces.js +6 -1
- package/subscriptions/enums.d.ts +7 -0
- package/subscriptions/enums.js +10 -8
- package/subscriptions/index.d.ts +55 -9
- package/subscriptions/index.js +56 -9
- package/subscriptions/interfaces.d.ts +7 -3
- package/subscriptions/interfaces.js +1 -1
- package/subscriptions/invoices.d.ts +16 -13
- package/subscriptions/invoices.js +19 -14
- package/subscriptions/managedSubscriptions.d.ts +18 -15
- package/subscriptions/managedSubscriptions.js +27 -22
- package/subscriptions/paymentMethods.d.ts +16 -13
- package/subscriptions/paymentMethods.js +22 -18
- package/subscriptions/paymentProviders.d.ts +8 -5
- package/subscriptions/paymentProviders.js +9 -4
- package/subscriptions/plans.d.ts +11 -8
- package/subscriptions/plans.js +11 -6
- package/subscriptions/providers/stripe/index.d.ts +24 -21
- package/subscriptions/providers/stripe/index.js +21 -16
- package/subscriptions/subscriptions.d.ts +24 -21
- package/subscriptions/subscriptions.js +27 -22
- package/subscriptions/summaries.d.ts +7 -4
- package/subscriptions/summaries.js +8 -3
- package/subscriptions/tenantConfiguration.d.ts +6 -3
- package/subscriptions/tenantConfiguration.js +12 -7
- package/subscriptions/vendorPublicConfigurations.d.ts +5 -0
- package/subscriptions/vendorPublicConfigurations.js +10 -0
- package/teams/index.d.ts +38 -115
- package/teams/index.js +105 -79
- package/teams/interfaces.d.ts +47 -42
- package/teams/interfaces.js +5 -1
- package/tenants/index.d.ts +25 -26
- package/tenants/index.js +61 -12
- package/tenants/interfaces.d.ts +85 -0
- package/tenants/interfaces.js +14 -1
- package/user-phone-numbers/index.d.ts +32 -0
- package/user-phone-numbers/index.js +31 -0
- package/user-phone-numbers/interfaces.d.ts +32 -0
- package/user-phone-numbers/interfaces.js +1 -0
- package/user-phone-numbers/package.json +6 -0
- package/users/index.d.ts +24 -0
- package/users/index.js +55 -0
- package/users/interfaces.d.ts +144 -0
- package/users/interfaces.js +18 -0
- package/users/package.json +6 -0
- package/velo/index.d.ts +46 -0
- package/velo/index.js +68 -0
- package/velo/interfaces.d.ts +108 -0
- package/velo/interfaces.js +1 -0
- package/velo/package.json +6 -0
- package/vendor/index.d.ts +12 -6
- package/vendor/index.js +15 -4
- package/ContextHolder.d.ts +0 -29
- package/ContextHolder.js +0 -80
- package/fetch.d.ts +0 -19
- package/fetch.js +0 -203
- package/node/ContextHolder.js +0 -90
- package/node/fetch.js +0 -234
- package/node/subscriptions/providers/index.js +0 -18
- package/subscriptions/providers/index.d.ts +0 -1
- package/subscriptions/providers/index.js +0 -1
package/node/jwt.js
CHANGED
|
@@ -4,90 +4,84 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.jwtDecode = exports.InvalidTokenError = exports.InvalidCharacterError = void 0;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The code was extracted from:
|
|
9
|
+
* https://github.com/davidchambers/Base64.js
|
|
10
|
+
*/
|
|
8
11
|
|
|
12
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
9
13
|
class InvalidCharacterError extends Error {
|
|
10
14
|
constructor(message) {
|
|
11
15
|
super(message);
|
|
12
16
|
}
|
|
13
|
-
|
|
14
17
|
}
|
|
15
|
-
|
|
16
18
|
exports.InvalidCharacterError = InvalidCharacterError;
|
|
17
|
-
|
|
18
19
|
function polyfill(input) {
|
|
19
20
|
const str = String(input).replace(/=+$/, '');
|
|
20
|
-
|
|
21
21
|
if (str.length % 4 === 1) {
|
|
22
22
|
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
23
23
|
}
|
|
24
|
-
|
|
25
24
|
let output = '';
|
|
26
|
-
|
|
27
|
-
for (
|
|
25
|
+
// noinspection JSAssignmentUsedAsCondition,JSUnusedAssignment,CommaExpressionJS
|
|
26
|
+
for (
|
|
27
|
+
// initialize result and counters
|
|
28
|
+
let bc = 0, bs, buffer, idx = 0;
|
|
29
|
+
// get next character
|
|
30
|
+
// tslint:disable-next-line:no-conditional-assignment
|
|
31
|
+
buffer = str.charAt(idx++);
|
|
32
|
+
// character found in table? initialize bit storage and add its ascii value;
|
|
33
|
+
// tslint:disable-next-line:no-conditional-assignment
|
|
34
|
+
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
|
35
|
+
// and if not first of each 4 characters,
|
|
36
|
+
// convert the first 8 bits to one ascii character
|
|
37
|
+
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
|
|
38
|
+
// try to find character in table (0-63, not found => -1)
|
|
28
39
|
buffer = chars.indexOf(buffer);
|
|
29
40
|
}
|
|
30
|
-
|
|
31
41
|
return output;
|
|
32
42
|
}
|
|
33
|
-
|
|
34
43
|
const atob = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
|
|
35
|
-
|
|
36
44
|
function b64DecodeUnicode(str) {
|
|
37
45
|
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
38
46
|
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
39
|
-
|
|
40
47
|
if (code.length < 2) {
|
|
41
48
|
code = '0' + code;
|
|
42
49
|
}
|
|
43
|
-
|
|
44
50
|
return '%' + code;
|
|
45
51
|
}));
|
|
46
52
|
}
|
|
47
|
-
|
|
48
53
|
const base64UrlDecode = str => {
|
|
49
54
|
let output = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
50
|
-
|
|
51
55
|
switch (output.length % 4) {
|
|
52
56
|
case 0:
|
|
53
57
|
break;
|
|
54
|
-
|
|
55
58
|
case 2:
|
|
56
59
|
output += '==';
|
|
57
60
|
break;
|
|
58
|
-
|
|
59
61
|
case 3:
|
|
60
62
|
output += '=';
|
|
61
63
|
break;
|
|
62
|
-
|
|
63
64
|
default:
|
|
64
65
|
throw new Error('Illegal base64url string!');
|
|
65
66
|
}
|
|
66
|
-
|
|
67
67
|
try {
|
|
68
68
|
return b64DecodeUnicode(output);
|
|
69
69
|
} catch (err) {
|
|
70
70
|
return atob(output);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
|
|
74
73
|
class InvalidTokenError extends Error {
|
|
75
74
|
constructor(message) {
|
|
76
75
|
super(message);
|
|
77
76
|
}
|
|
78
|
-
|
|
79
77
|
}
|
|
80
|
-
|
|
81
78
|
exports.InvalidTokenError = InvalidTokenError;
|
|
82
|
-
|
|
83
79
|
const jwtDecode = (token, options = {}) => {
|
|
84
80
|
const pos = !!options.header ? 0 : 1;
|
|
85
|
-
|
|
86
81
|
try {
|
|
87
82
|
return JSON.parse(base64UrlDecode(token.split('.')[pos]));
|
|
88
83
|
} catch (e) {
|
|
89
84
|
throw new InvalidTokenError('Invalid token specified: ' + e.message);
|
|
90
85
|
}
|
|
91
86
|
};
|
|
92
|
-
|
|
93
87
|
exports.jwtDecode = jwtDecode;
|
package/node/metadata/index.js
CHANGED
|
@@ -3,42 +3,61 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
exports.default = exports.MetadataApi = void 0;
|
|
7
|
+
var _BaseApiClient = require("../BaseApiClient");
|
|
8
|
+
class MetadataApi extends _BaseApiClient.BaseApiClient {
|
|
9
|
+
constructor(appName) {
|
|
10
|
+
super(appName);
|
|
11
|
+
this.getMetadata = async body => {
|
|
12
|
+
var _data$rows, _data$rows2;
|
|
13
|
+
const data = await this.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}`);
|
|
16
|
+
};
|
|
17
|
+
this.getAdminBoxMetadata = async () => {
|
|
18
|
+
return this.get('/metadata/admin-box');
|
|
19
|
+
};
|
|
20
|
+
this.updateAdminBoxMetadata = async body => {
|
|
21
|
+
return this.post('/metadata/admin-box', body);
|
|
22
|
+
};
|
|
23
|
+
this.getIpMetadata = async ip => {
|
|
24
|
+
const data = await this.get(`/metadata/ip/${ip}`);
|
|
25
|
+
if (data) return data;
|
|
26
|
+
throw new Error(`ip metadata not found`);
|
|
27
|
+
};
|
|
28
|
+
this.getCurrentUserIpMetadata = async () => {
|
|
29
|
+
const data = await this.get(`/metadata/ipme`);
|
|
30
|
+
if (data) return data;
|
|
31
|
+
throw new Error(`ip metadata not found`);
|
|
32
|
+
};
|
|
33
|
+
this.getNotificationsMetadata = async () => {
|
|
34
|
+
return this.getMetadata({
|
|
35
|
+
entityName: 'notifications'
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
this.getSamlMetadata = async () => {
|
|
39
|
+
return this.getMetadata({
|
|
40
|
+
entityName: 'saml'
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.getAuditsMetadata = async () => {
|
|
44
|
+
return this.getMetadata({
|
|
45
|
+
entityName: 'audits'
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
this.getIpAdressMetadata = async ip => {
|
|
49
|
+
return this.getIpMetadata(ip);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves metadata based on the given criteria.
|
|
55
|
+
*
|
|
56
|
+
* @param body - Metadata request parameters.
|
|
57
|
+
* @returns Metadata matching the criteria.
|
|
58
|
+
* @throws Will throw an error if metadata is not found.
|
|
59
|
+
*/
|
|
22
60
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
exports.getNotificationsMetadata = getNotificationsMetadata;
|
|
29
|
-
|
|
30
|
-
const getSamlMetadata = async () => getMetadata({
|
|
31
|
-
entityName: 'saml'
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
exports.getSamlMetadata = getSamlMetadata;
|
|
35
|
-
|
|
36
|
-
const getAuditsMetadata = async () => getMetadata({
|
|
37
|
-
entityName: 'audits'
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
exports.getAuditsMetadata = getAuditsMetadata;
|
|
41
|
-
|
|
42
|
-
const getIpAdressMetadata = async ip => getIpMetadata(ip);
|
|
43
|
-
|
|
44
|
-
exports.getIpAdressMetadata = getIpAdressMetadata;
|
|
61
|
+
exports.MetadataApi = MetadataApi;
|
|
62
|
+
var _default = new MetadataApi('default');
|
|
63
|
+
exports.default = _default;
|
|
@@ -3,37 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.markAllAsRead = markAllAsRead;
|
|
8
|
-
exports.updateNotificationIsPinned = updateNotificationIsPinned;
|
|
9
|
-
exports.updateNotificationStatus = updateNotificationStatus;
|
|
10
|
-
|
|
11
|
-
var _fetch = require("../fetch");
|
|
12
|
-
|
|
6
|
+
exports.default = exports.NotificationsApi = void 0;
|
|
13
7
|
var _constants = require("../constants");
|
|
8
|
+
var _BaseApiClient = require("../BaseApiClient");
|
|
9
|
+
class NotificationsApi extends _BaseApiClient.BaseApiClient {
|
|
10
|
+
constructor(appName) {
|
|
11
|
+
super(appName);
|
|
12
|
+
this.getNotifications = async params => {
|
|
13
|
+
return this.get(_constants.urls.notifications.v1, {
|
|
14
|
+
params
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
this.updateNotificationStatus = async params => {
|
|
18
|
+
return this.put(`${_constants.urls.notifications.v1}/status`, {
|
|
19
|
+
params
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.updateNotificationIsPinned = async params => {
|
|
23
|
+
const {
|
|
24
|
+
notificationId,
|
|
25
|
+
pinStatus
|
|
26
|
+
} = params;
|
|
27
|
+
return this.put(`${_constants.urls.notifications.v1}/${pinStatus}`, {
|
|
28
|
+
notificationId
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
this.markAllAsRead = async () => {
|
|
32
|
+
return this.post(`${_constants.urls.notifications.v1}/status/mark-all-read`);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function updateNotificationStatus(params) {
|
|
22
|
-
return (0, _fetch.Put)(`${_constants.urls.notifications.v1}/status`, {
|
|
23
|
-
params
|
|
24
|
-
});
|
|
36
|
+
/**
|
|
37
|
+
* Get notifications
|
|
38
|
+
*/
|
|
25
39
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
notificationId,
|
|
30
|
-
pinStatus
|
|
31
|
-
} = params;
|
|
32
|
-
return (0, _fetch.Put)(`${_constants.urls.notifications.v1}/${pinStatus}`, {
|
|
33
|
-
notificationId
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function markAllAsRead() {
|
|
38
|
-
return (0, _fetch.Post)(`${_constants.urls.notifications.v1}/status/mark-all-read`);
|
|
39
|
-
}
|
|
40
|
+
exports.NotificationsApi = NotificationsApi;
|
|
41
|
+
var _default = new NotificationsApi('default');
|
|
42
|
+
exports.default = _default;
|
package/node/reports/index.js
CHANGED
|
@@ -1,96 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
exports.getReport = getReport;
|
|
10
|
-
exports.getReports = getReports;
|
|
11
|
-
exports.renderReport = renderReport;
|
|
12
|
-
exports.scheduleReport = scheduleReport;
|
|
13
|
-
exports.sendReport = sendReport;
|
|
14
|
-
|
|
7
|
+
exports.default = exports.ReportsApi = void 0;
|
|
15
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
|
-
|
|
17
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
18
|
-
|
|
19
|
-
var _fetch = require("../fetch");
|
|
20
|
-
|
|
21
10
|
var _constants = require("../constants");
|
|
22
|
-
|
|
11
|
+
var _BaseApiClient = require("../BaseApiClient");
|
|
23
12
|
const _excluded = ["dataFilters"],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
13
|
+
_excluded2 = ["templateId", "dataFilters"],
|
|
14
|
+
_excluded3 = ["dataFilters"];
|
|
15
|
+
class ReportsApi extends _BaseApiClient.BaseApiClient {
|
|
16
|
+
constructor(appName) {
|
|
17
|
+
super(appName);
|
|
18
|
+
this.getReports = async body => {
|
|
19
|
+
return this.get(`${_constants.urls.reports.service.v2}/tenant-reports`, body);
|
|
20
|
+
};
|
|
21
|
+
this.getReport = async body => {
|
|
22
|
+
return this.get(`${_constants.urls.reports.service.v2}/${body.id}/tenant-reports`);
|
|
23
|
+
};
|
|
24
|
+
this.renderReport = async _ref => {
|
|
25
|
+
let {
|
|
26
|
+
dataFilters
|
|
27
|
+
} = _ref,
|
|
28
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
29
|
+
const html = await this.get(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
|
|
30
|
+
dataFilters: btoa(JSON.stringify(dataFilters || {})),
|
|
31
|
+
responseType: 'html'
|
|
32
|
+
}), {
|
|
33
|
+
responseType: 'plain'
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
html
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
this.scheduleReport = async _ref2 => {
|
|
40
|
+
let {
|
|
41
|
+
templateId,
|
|
42
|
+
dataFilters
|
|
43
|
+
} = _ref2,
|
|
44
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
45
|
+
return this.post(`${_constants.urls.reports.service.v2}/${templateId}/tenant-reports`, (0, _extends2.default)({}, body, {
|
|
46
|
+
dataFilters: btoa(JSON.stringify(dataFilters || {}))
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
this.downloadReport = async _ref3 => {
|
|
50
|
+
let {
|
|
51
|
+
dataFilters
|
|
52
|
+
} = _ref3,
|
|
53
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
|
|
54
|
+
const blob = await this.get(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
|
|
55
|
+
dataFilters: btoa(JSON.stringify(dataFilters || {}))
|
|
56
|
+
}), {
|
|
57
|
+
responseType: 'blob'
|
|
58
|
+
});
|
|
59
|
+
let contentType = 'text/html';
|
|
60
|
+
let contentExt = 'html';
|
|
61
|
+
if (body.responseType === 'pdf') {
|
|
62
|
+
contentType = 'application/pdf';
|
|
63
|
+
contentExt = 'pdf';
|
|
64
|
+
} else if (body.responseType === 'image') {
|
|
65
|
+
contentType = 'image/jpeg';
|
|
66
|
+
contentExt = 'jpg';
|
|
67
|
+
}
|
|
68
|
+
const newBlob = new Blob([blob], {
|
|
69
|
+
type: contentType
|
|
70
|
+
});
|
|
71
|
+
const fileURL = URL.createObjectURL(newBlob);
|
|
72
|
+
const tempLink = document.createElement('a');
|
|
73
|
+
tempLink.href = fileURL;
|
|
74
|
+
tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
|
|
75
|
+
tempLink.click();
|
|
76
|
+
setTimeout(tempLink.remove.bind(tempLink));
|
|
77
|
+
};
|
|
78
|
+
this.sendReport = async body => {
|
|
79
|
+
return this.post(`${_constants.urls.reports.trigger.v1}/tenant-reports`, body);
|
|
80
|
+
};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
|
|
90
|
-
tempLink.click();
|
|
91
|
-
setTimeout(tempLink.remove.bind(tempLink));
|
|
83
|
+
/**
|
|
84
|
+
* Get all active tenant reports from reports service by active vendor.
|
|
85
|
+
* Optional: pass filters and sort options to reports.
|
|
86
|
+
*
|
|
87
|
+
* @returns list of reports objects
|
|
88
|
+
*/
|
|
92
89
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
90
|
+
exports.ReportsApi = ReportsApi;
|
|
91
|
+
var _default = new ReportsApi('default');
|
|
92
|
+
exports.default = _default;
|
package/node/roles/index.js
CHANGED
|
@@ -1,71 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
exports.attachPermissionToRoles = attachPermissionToRoles;
|
|
10
|
-
exports.attachPermissionsToRole = attachPermissionsToRole;
|
|
11
|
-
exports.deleteRole = deleteRole;
|
|
12
|
-
exports.getPermissionCategories = getPermissionCategories;
|
|
13
|
-
exports.getPermissions = getPermissions;
|
|
14
|
-
exports.getRoles = getRoles;
|
|
15
|
-
exports.updateRole = updateRole;
|
|
16
|
-
|
|
7
|
+
exports.default = exports.RolesApi = void 0;
|
|
17
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
18
|
-
|
|
19
|
-
var _fetch = require("../fetch");
|
|
20
|
-
|
|
21
9
|
var _constants = require("../constants");
|
|
22
|
-
|
|
10
|
+
var _BaseApiClient = require("../BaseApiClient");
|
|
23
11
|
const _excluded = ["roleId"],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
_excluded2 = ["roleId"],
|
|
13
|
+
_excluded3 = ["permissionId"];
|
|
14
|
+
class RolesApi extends _BaseApiClient.BaseApiClient {
|
|
15
|
+
constructor(appName) {
|
|
16
|
+
super(appName);
|
|
17
|
+
this.getRoles = async () => {
|
|
18
|
+
return this.get(_constants.urls.identity.roles.v1);
|
|
19
|
+
};
|
|
20
|
+
this.addRole = async body => {
|
|
21
|
+
return this.post(_constants.urls.identity.roles.v1, body);
|
|
22
|
+
};
|
|
23
|
+
this.deleteRole = async ({
|
|
24
|
+
roleId
|
|
25
|
+
}) => {
|
|
26
|
+
return this.delete(`${_constants.urls.identity.roles.v1}/${roleId}`);
|
|
27
|
+
};
|
|
28
|
+
this.updateRole = async _ref => {
|
|
29
|
+
let {
|
|
30
|
+
roleId
|
|
31
|
+
} = _ref,
|
|
32
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
33
|
+
return this.patch(`${_constants.urls.identity.roles.v1}/${roleId}`, body);
|
|
34
|
+
};
|
|
35
|
+
this.attachPermissionsToRole = async _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
roleId
|
|
38
|
+
} = _ref2,
|
|
39
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
40
|
+
return this.put(`${_constants.urls.identity.roles.v1}/${roleId}/permissions`, body);
|
|
41
|
+
};
|
|
42
|
+
this.getPermissions = async () => {
|
|
43
|
+
return this.get(_constants.urls.identity.permissions.v1);
|
|
44
|
+
};
|
|
45
|
+
this.attachPermissionToRoles = async _ref3 => {
|
|
46
|
+
let {
|
|
47
|
+
permissionId
|
|
48
|
+
} = _ref3,
|
|
49
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
|
|
50
|
+
return this.put(`${_constants.urls.identity.permissions.v1}/${permissionId}/roles`, body);
|
|
51
|
+
};
|
|
52
|
+
this.getPermissionCategories = async () => {
|
|
53
|
+
return this.get(`${_constants.urls.identity.permissions.v1}/categories`);
|
|
54
|
+
};
|
|
55
|
+
this.addRoleV2 = async body => {
|
|
56
|
+
return this.post(_constants.urls.identity.roles.v2, body);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
34
59
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return (0, _fetch.Delete)(`${_constants.urls.identity.roles.v1}/${roleId}`);
|
|
60
|
+
/**
|
|
61
|
+
* Gets tenant related roles
|
|
62
|
+
*/
|
|
39
63
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
roleId
|
|
44
|
-
} = _ref,
|
|
45
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
46
|
-
return (0, _fetch.Patch)(`${_constants.urls.identity.roles.v1}/${roleId}`, body);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function attachPermissionsToRole(_ref2) {
|
|
50
|
-
let {
|
|
51
|
-
roleId
|
|
52
|
-
} = _ref2,
|
|
53
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
54
|
-
return (0, _fetch.Put)(`${_constants.urls.identity.roles.v1}/${roleId}/permissions`, body);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function getPermissions() {
|
|
58
|
-
return (0, _fetch.Get)(_constants.urls.identity.permissions.v1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function attachPermissionToRoles(_ref3) {
|
|
62
|
-
let {
|
|
63
|
-
permissionId
|
|
64
|
-
} = _ref3,
|
|
65
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
|
|
66
|
-
return (0, _fetch.Put)(`${_constants.urls.identity.permissions.v1}/${permissionId}/roles`, body);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function getPermissionCategories() {
|
|
70
|
-
return (0, _fetch.Get)(`${_constants.urls.identity.permissions.v1}/categories`);
|
|
71
|
-
}
|
|
64
|
+
exports.RolesApi = RolesApi;
|
|
65
|
+
var _default = new RolesApi('default');
|
|
66
|
+
exports.default = _default;
|
package/node/roles/interfaces.js
CHANGED
|
@@ -2,4 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.PermissionAssignmentTypeEnum = void 0;
|
|
7
|
+
let PermissionAssignmentTypeEnum;
|
|
8
|
+
exports.PermissionAssignmentTypeEnum = PermissionAssignmentTypeEnum;
|
|
9
|
+
(function (PermissionAssignmentTypeEnum) {
|
|
10
|
+
PermissionAssignmentTypeEnum["NEVER"] = "NEVER";
|
|
11
|
+
PermissionAssignmentTypeEnum["ALWAYS"] = "ALWAYS";
|
|
12
|
+
PermissionAssignmentTypeEnum["ASSIGNABLE"] = "ASSIGNABLE";
|
|
13
|
+
})(PermissionAssignmentTypeEnum || (exports.PermissionAssignmentTypeEnum = PermissionAssignmentTypeEnum = {}));
|
package/node/routers.js
CHANGED
|
@@ -3,11 +3,57 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.fronteggRefreshTokenUrl = exports.
|
|
7
|
-
|
|
6
|
+
exports.fronteggUsersUrl = exports.fronteggTenantsV3Url = exports.fronteggTenantsUrl = exports.fronteggSilentRefreshTokenUrl = exports.fronteggRefreshTokenUrl = exports.fronteggEntitlementsV2Url = exports.fronteggAuthApiRoutesRegex = void 0;
|
|
8
7
|
var _constants = require("./constants");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const fronteggAuthApiRoutesRegex = [
|
|
9
|
+
// Logout urls:
|
|
10
|
+
// - `${urls.identity.auth.v1}/logout`,
|
|
11
|
+
// - `${urls.oauth.v1}/logout`,
|
|
12
|
+
/^(.*)\/logout$/g, '/logout',
|
|
13
|
+
// Saml urls:
|
|
14
|
+
// - `${urls.identity.auth.v1}/user/saml/postlogin`,
|
|
15
|
+
// - `${urls.identity.auth.v2}/user/oidc/postlogin`,
|
|
16
|
+
/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,
|
|
17
|
+
// impersonation url:
|
|
18
|
+
/^\/identity\/resources\/impersonation\/v[0-9]$/g,
|
|
19
|
+
// Passwordless urls:
|
|
20
|
+
// - `${urls.identity.auth.v1}/passwordless/magiclink/postlogin`,
|
|
21
|
+
// - `${urls.identity.auth.v1}/passwordless/code/postlogin`,
|
|
22
|
+
// - `${urls.identity.auth.v1}/passwordless/smscode/postlogin`,
|
|
23
|
+
// - `${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`,
|
|
24
|
+
/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,
|
|
25
|
+
// Webauthn postlogin urls:
|
|
26
|
+
/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,
|
|
27
|
+
// General login urls:
|
|
28
|
+
// - `${urls.identity.auth.v1}/user`,
|
|
29
|
+
// - `${urls.identity.auth.v1}/user/token/refresh`,
|
|
30
|
+
// - `${urls.identity.users.v1}`,
|
|
31
|
+
// - `${urls.identity.users.v1}/signUp`,
|
|
32
|
+
// - `${urls.identity.users.v1}/activate`,
|
|
33
|
+
// - `${urls.identity.users.v1}/invitation/accept`,
|
|
34
|
+
/^\/identity\/resources\/auth\/v[0-9]*\/user$/g, /^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g, /^\/identity\/resources\/users\/v[0-9]*\/signUp$/g, /^\/identity\/resources\/users\/v[0-9]*\/activate$/g, /^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,
|
|
35
|
+
// - `${urls.identity.auth.v1}/user/mfa/verify`,
|
|
36
|
+
// - `${urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`,
|
|
37
|
+
// - `${urls.identity.auth.v1}/user/mfa/authenticator/${deviceId}/verify`,
|
|
38
|
+
// - `${urls.identity.auth.v1}/user/mfa/sms/enroll/verify`,
|
|
39
|
+
// - `${urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`,
|
|
40
|
+
// - `${urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`,
|
|
41
|
+
// - `${urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}/verify`,
|
|
42
|
+
/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g, /^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,
|
|
43
|
+
// Oauth urls:
|
|
44
|
+
// - `${urls.oauth.v1}/token`
|
|
45
|
+
// - `${urls.oauth.v1}/authorize/silent`
|
|
46
|
+
/^\/oauth\/token$/g, /^\/oauth\/authorize\/silent$/g];
|
|
47
|
+
exports.fronteggAuthApiRoutesRegex = fronteggAuthApiRoutesRegex;
|
|
12
48
|
const fronteggRefreshTokenUrl = `${_constants.urls.identity.auth.v1}/user/token/refresh`;
|
|
13
|
-
exports.fronteggRefreshTokenUrl = fronteggRefreshTokenUrl;
|
|
49
|
+
exports.fronteggRefreshTokenUrl = fronteggRefreshTokenUrl;
|
|
50
|
+
const fronteggSilentRefreshTokenUrl = `${_constants.urls.oauth.v1}/authorize/silent`;
|
|
51
|
+
exports.fronteggSilentRefreshTokenUrl = fronteggSilentRefreshTokenUrl;
|
|
52
|
+
const fronteggUsersUrl = `${_constants.urls.identity.users.v2}/me`;
|
|
53
|
+
exports.fronteggUsersUrl = fronteggUsersUrl;
|
|
54
|
+
const fronteggTenantsUrl = `${_constants.urls.identity.users.v2}/me/tenants`;
|
|
55
|
+
exports.fronteggTenantsUrl = fronteggTenantsUrl;
|
|
56
|
+
const fronteggTenantsV3Url = `${_constants.urls.identity.users.v3}/me/tenants`;
|
|
57
|
+
exports.fronteggTenantsV3Url = fronteggTenantsV3Url;
|
|
58
|
+
const fronteggEntitlementsV2Url = _constants.urls.entitlements.v2;
|
|
59
|
+
exports.fronteggEntitlementsV2Url = fronteggEntitlementsV2Url;
|