@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/ContextHolder.js
CHANGED
|
@@ -1,114 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export var ContextHolder = function () {
|
|
4
|
-
function ContextHolder() {
|
|
5
|
-
_classCallCheck(this, ContextHolder);
|
|
6
|
-
|
|
1
|
+
export class ContextHolder {
|
|
2
|
+
constructor() {
|
|
7
3
|
this.context = null;
|
|
8
4
|
this.accessToken = null;
|
|
9
5
|
this.user = null;
|
|
10
6
|
|
|
11
|
-
this.onRedirectTo =
|
|
12
|
-
|
|
7
|
+
this.onRedirectTo = path => window.location.href = path;
|
|
8
|
+
|
|
9
|
+
this.logout = () => window.location.href = '/account/logout';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static getInstance() {
|
|
13
|
+
if (!ContextHolder.instance) {
|
|
14
|
+
ContextHolder.instance = new ContextHolder();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return ContextHolder.instance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static setContext(context) {
|
|
21
|
+
ContextHolder.getInstance().context = context;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static setAccessToken(accessToken) {
|
|
25
|
+
ContextHolder.getInstance().accessToken = accessToken;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static setUser(user) {
|
|
29
|
+
ContextHolder.getInstance().user = user;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static setOnRedirectTo(onRedirectTo) {
|
|
33
|
+
ContextHolder.getInstance().onRedirectTo = onRedirectTo;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static setLogout(logout, logoutUrl) {
|
|
37
|
+
ContextHolder.getInstance().logout = callback => {
|
|
38
|
+
if (!callback) {
|
|
39
|
+
ContextHolder.onRedirectTo(logoutUrl);
|
|
40
|
+
} else {
|
|
41
|
+
logout(callback);
|
|
42
|
+
}
|
|
13
43
|
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static getContext() {
|
|
47
|
+
var _ContextHolder$getIns;
|
|
14
48
|
|
|
15
|
-
|
|
16
|
-
|
|
49
|
+
return (_ContextHolder$getIns = ContextHolder.getInstance().context) != null ? _ContextHolder$getIns : {
|
|
50
|
+
baseUrl: window.location.href,
|
|
51
|
+
tokenResolver: () => 'my-authentication-token',
|
|
52
|
+
logLevel: 'error'
|
|
17
53
|
};
|
|
18
54
|
}
|
|
19
55
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!ContextHolder.instance) {
|
|
24
|
-
ContextHolder.instance = new ContextHolder();
|
|
25
|
-
}
|
|
56
|
+
static getAccessToken() {
|
|
57
|
+
return ContextHolder.getInstance().accessToken;
|
|
58
|
+
}
|
|
26
59
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
key: "setContext",
|
|
31
|
-
value: function setContext(context) {
|
|
32
|
-
ContextHolder.getInstance().context = context;
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "setAccessToken",
|
|
36
|
-
value: function setAccessToken(accessToken) {
|
|
37
|
-
ContextHolder.getInstance().accessToken = accessToken;
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "setUser",
|
|
41
|
-
value: function setUser(user) {
|
|
42
|
-
ContextHolder.getInstance().user = user;
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "setOnRedirectTo",
|
|
46
|
-
value: function setOnRedirectTo(onRedirectTo) {
|
|
47
|
-
ContextHolder.getInstance().onRedirectTo = onRedirectTo;
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "setLogout",
|
|
51
|
-
value: function setLogout(logout, logoutUrl) {
|
|
52
|
-
ContextHolder.getInstance().logout = function (callback) {
|
|
53
|
-
if (!callback) {
|
|
54
|
-
ContextHolder.onRedirectTo(logoutUrl);
|
|
55
|
-
} else {
|
|
56
|
-
logout(callback);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
key: "getContext",
|
|
62
|
-
value: function getContext() {
|
|
63
|
-
var _ContextHolder$getIns;
|
|
64
|
-
|
|
65
|
-
return (_ContextHolder$getIns = ContextHolder.getInstance().context) != null ? _ContextHolder$getIns : {
|
|
66
|
-
baseUrl: window.location.href,
|
|
67
|
-
tokenResolver: function tokenResolver() {
|
|
68
|
-
return 'my-authentication-token';
|
|
69
|
-
},
|
|
70
|
-
logLevel: 'error'
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "getAccessToken",
|
|
75
|
-
value: function getAccessToken() {
|
|
76
|
-
return ContextHolder.getInstance().accessToken;
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "getUser",
|
|
80
|
-
value: function getUser() {
|
|
81
|
-
return ContextHolder.getInstance().user;
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "onRedirectTo",
|
|
85
|
-
value: function onRedirectTo(path, opts) {
|
|
86
|
-
return ContextHolder.getInstance().onRedirectTo(path, opts);
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "logout",
|
|
90
|
-
value: function logout(callback) {
|
|
91
|
-
return ContextHolder.getInstance().logout(callback);
|
|
92
|
-
}
|
|
93
|
-
}]);
|
|
60
|
+
static getUser() {
|
|
61
|
+
return ContextHolder.getInstance().user;
|
|
62
|
+
}
|
|
94
63
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ContextHolder.instance = void 0;
|
|
98
|
-
export var FronteggContext = {
|
|
99
|
-
getContext: function getContext() {
|
|
100
|
-
return ContextHolder.getContext();
|
|
101
|
-
},
|
|
102
|
-
getAccessToken: function getAccessToken() {
|
|
103
|
-
return ContextHolder.getAccessToken();
|
|
104
|
-
},
|
|
105
|
-
getUser: function getUser() {
|
|
106
|
-
return ContextHolder.getUser();
|
|
107
|
-
},
|
|
108
|
-
onRedirectTo: function onRedirectTo(path, opts) {
|
|
109
|
-
return ContextHolder.onRedirectTo(path, opts);
|
|
110
|
-
},
|
|
111
|
-
logout: function logout(callback) {
|
|
112
|
-
return ContextHolder.logout(callback);
|
|
64
|
+
static onRedirectTo(path, opts) {
|
|
65
|
+
return ContextHolder.getInstance().onRedirectTo(path, opts);
|
|
113
66
|
}
|
|
67
|
+
|
|
68
|
+
static logout(callback) {
|
|
69
|
+
return ContextHolder.getInstance().logout(callback);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
ContextHolder.instance = void 0;
|
|
74
|
+
export const FronteggContext = {
|
|
75
|
+
getContext: () => ContextHolder.getContext(),
|
|
76
|
+
getAccessToken: () => ContextHolder.getAccessToken(),
|
|
77
|
+
getUser: () => ContextHolder.getUser(),
|
|
78
|
+
onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts),
|
|
79
|
+
logout: callback => ContextHolder.logout(callback)
|
|
114
80
|
};
|
|
@@ -1,47 +1,8 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
1
|
import { urls } from '../constants';
|
|
4
2
|
import { Put, Get } from '../fetch';
|
|
5
|
-
export function updateSettings(
|
|
6
|
-
return
|
|
3
|
+
export async function updateSettings(body) {
|
|
4
|
+
return Put(urls.tenants.accountSettings.v1, body);
|
|
7
5
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_updateSettings = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(body) {
|
|
11
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
-
while (1) {
|
|
13
|
-
switch (_context.prev = _context.next) {
|
|
14
|
-
case 0:
|
|
15
|
-
return _context.abrupt("return", Put(urls.tenants.accountSettings.v1, body));
|
|
16
|
-
|
|
17
|
-
case 1:
|
|
18
|
-
case "end":
|
|
19
|
-
return _context.stop();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}, _callee);
|
|
23
|
-
}));
|
|
24
|
-
return _updateSettings.apply(this, arguments);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getSettings() {
|
|
28
|
-
return _getSettings.apply(this, arguments);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _getSettings() {
|
|
32
|
-
_getSettings = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
|
|
33
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
34
|
-
while (1) {
|
|
35
|
-
switch (_context2.prev = _context2.next) {
|
|
36
|
-
case 0:
|
|
37
|
-
return _context2.abrupt("return", Get(urls.tenants.accountSettings.v1));
|
|
38
|
-
|
|
39
|
-
case 1:
|
|
40
|
-
case "end":
|
|
41
|
-
return _context2.stop();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, _callee2);
|
|
45
|
-
}));
|
|
46
|
-
return _getSettings.apply(this, arguments);
|
|
6
|
+
export async function getSettings() {
|
|
7
|
+
return Get(urls.tenants.accountSettings.v1);
|
|
47
8
|
}
|
package/audits/index.js
CHANGED
|
@@ -1,74 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
const _excluded = ["endpoint", "headerProps"];
|
|
4
3
|
import { Get, PostDownload } from '../fetch';
|
|
5
4
|
import { urls } from '../constants';
|
|
6
|
-
export function getAudits(
|
|
7
|
-
return
|
|
5
|
+
export async function getAudits(params) {
|
|
6
|
+
return Get(urls.audits.v1, params);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_getAudits = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(params) {
|
|
12
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13
|
-
while (1) {
|
|
14
|
-
switch (_context.prev = _context.next) {
|
|
15
|
-
case 0:
|
|
16
|
-
return _context.abrupt("return", Get(urls.audits.v1, params));
|
|
17
|
-
|
|
18
|
-
case 1:
|
|
19
|
-
case "end":
|
|
20
|
-
return _context.stop();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}, _callee);
|
|
24
|
-
}));
|
|
25
|
-
return _getAudits.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getAuditsStats(_x2) {
|
|
29
|
-
return _getAuditsStats.apply(this, arguments);
|
|
8
|
+
export async function getAuditsStats(params) {
|
|
9
|
+
return Get(`${urls.audits.v1}/stats`, params);
|
|
30
10
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case "end":
|
|
42
|
-
return _context2.stop();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}, _callee2);
|
|
46
|
-
}));
|
|
47
|
-
return _getAuditsStats.apply(this, arguments);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function exportAudits(_x3) {
|
|
51
|
-
return _exportAudits.apply(this, arguments);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _exportAudits() {
|
|
55
|
-
_exportAudits = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(params) {
|
|
56
|
-
var endpoint, headerProps, restParams;
|
|
57
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58
|
-
while (1) {
|
|
59
|
-
switch (_context3.prev = _context3.next) {
|
|
60
|
-
case 0:
|
|
61
|
-
endpoint = params.endpoint, headerProps = params.headerProps, restParams = _objectWithoutProperties(params, ["endpoint", "headerProps"]);
|
|
62
|
-
return _context3.abrupt("return", PostDownload("".concat(urls.audits.v1, "/export/").concat(endpoint), {
|
|
63
|
-
properties: headerProps
|
|
64
|
-
}, restParams));
|
|
65
|
-
|
|
66
|
-
case 2:
|
|
67
|
-
case "end":
|
|
68
|
-
return _context3.stop();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}, _callee3);
|
|
72
|
-
}));
|
|
73
|
-
return _exportAudits.apply(this, arguments);
|
|
11
|
+
export async function exportAudits(params) {
|
|
12
|
+
const {
|
|
13
|
+
endpoint,
|
|
14
|
+
headerProps
|
|
15
|
+
} = params,
|
|
16
|
+
restParams = _objectWithoutPropertiesLoose(params, _excluded);
|
|
17
|
+
|
|
18
|
+
return PostDownload(`${urls.audits.v1}/export/${endpoint}`, {
|
|
19
|
+
properties: headerProps
|
|
20
|
+
}, restParams);
|
|
74
21
|
}
|
package/auth/enums.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let SocialLoginProviders;
|
|
2
2
|
|
|
3
3
|
(function (SocialLoginProviders) {
|
|
4
4
|
SocialLoginProviders["Microsoft"] = "microsoft";
|
|
@@ -7,7 +7,7 @@ export var SocialLoginProviders;
|
|
|
7
7
|
SocialLoginProviders["Github"] = "github";
|
|
8
8
|
})(SocialLoginProviders || (SocialLoginProviders = {}));
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export let AuthStrategyEnum;
|
|
11
11
|
|
|
12
12
|
(function (AuthStrategyEnum) {
|
|
13
13
|
AuthStrategyEnum["EmailAndPassword"] = "EmailAndPassword";
|
package/auth/index.d.ts
CHANGED
|
@@ -243,6 +243,10 @@ export declare function signUpUser(body: ISignUpUser): Promise<ISignUpResponse>;
|
|
|
243
243
|
* Get all current user active sessions
|
|
244
244
|
*/
|
|
245
245
|
export declare function getCurrentUserSessions(): Promise<ISessionResponse[]>;
|
|
246
|
+
/**
|
|
247
|
+
* Get current user session
|
|
248
|
+
*/
|
|
249
|
+
export declare function getCurrentUserSession(): Promise<ISessionResponse>;
|
|
246
250
|
/**
|
|
247
251
|
* Get session configurations
|
|
248
252
|
*/
|