@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/notifications/index.js
CHANGED
|
@@ -1,99 +1,24 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
1
|
import { Get, Post, Put } from '../fetch';
|
|
4
2
|
import { urls } from '../constants';
|
|
5
|
-
export function getNotifications(
|
|
6
|
-
return
|
|
3
|
+
export async function getNotifications(params) {
|
|
4
|
+
return Get(urls.notifications.v1, {
|
|
5
|
+
params
|
|
6
|
+
});
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
while (1) {
|
|
13
|
-
switch (_context.prev = _context.next) {
|
|
14
|
-
case 0:
|
|
15
|
-
return _context.abrupt("return", Get(urls.notifications.v1, {
|
|
16
|
-
params: params
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
case 1:
|
|
20
|
-
case "end":
|
|
21
|
-
return _context.stop();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}, _callee);
|
|
25
|
-
}));
|
|
26
|
-
return _getNotifications.apply(this, arguments);
|
|
8
|
+
export async function updateNotificationStatus(params) {
|
|
9
|
+
return Put(`${urls.notifications.v1}/status`, {
|
|
10
|
+
params
|
|
11
|
+
});
|
|
27
12
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
export async function updateNotificationIsPinned(params) {
|
|
14
|
+
const {
|
|
15
|
+
notificationId,
|
|
16
|
+
pinStatus
|
|
17
|
+
} = params;
|
|
18
|
+
return Put(`${urls.notifications.v1}/${pinStatus}`, {
|
|
19
|
+
notificationId
|
|
20
|
+
});
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_updateNotificationStatus = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(params) {
|
|
35
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
36
|
-
while (1) {
|
|
37
|
-
switch (_context2.prev = _context2.next) {
|
|
38
|
-
case 0:
|
|
39
|
-
return _context2.abrupt("return", Put("".concat(urls.notifications.v1, "/status"), {
|
|
40
|
-
params: params
|
|
41
|
-
}));
|
|
42
|
-
|
|
43
|
-
case 1:
|
|
44
|
-
case "end":
|
|
45
|
-
return _context2.stop();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, _callee2);
|
|
49
|
-
}));
|
|
50
|
-
return _updateNotificationStatus.apply(this, arguments);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function updateNotificationIsPinned(_x3) {
|
|
54
|
-
return _updateNotificationIsPinned.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _updateNotificationIsPinned() {
|
|
58
|
-
_updateNotificationIsPinned = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(params) {
|
|
59
|
-
var notificationId, pinStatus;
|
|
60
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
61
|
-
while (1) {
|
|
62
|
-
switch (_context3.prev = _context3.next) {
|
|
63
|
-
case 0:
|
|
64
|
-
notificationId = params.notificationId, pinStatus = params.pinStatus;
|
|
65
|
-
return _context3.abrupt("return", Put("".concat(urls.notifications.v1, "/").concat(pinStatus), {
|
|
66
|
-
notificationId: notificationId
|
|
67
|
-
}));
|
|
68
|
-
|
|
69
|
-
case 2:
|
|
70
|
-
case "end":
|
|
71
|
-
return _context3.stop();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}, _callee3);
|
|
75
|
-
}));
|
|
76
|
-
return _updateNotificationIsPinned.apply(this, arguments);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function markAllAsRead() {
|
|
80
|
-
return _markAllAsRead.apply(this, arguments);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function _markAllAsRead() {
|
|
84
|
-
_markAllAsRead = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4() {
|
|
85
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
86
|
-
while (1) {
|
|
87
|
-
switch (_context4.prev = _context4.next) {
|
|
88
|
-
case 0:
|
|
89
|
-
return _context4.abrupt("return", Post("".concat(urls.notifications.v1, "/status/mark-all-read")));
|
|
90
|
-
|
|
91
|
-
case 1:
|
|
92
|
-
case "end":
|
|
93
|
-
return _context4.stop();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}, _callee4);
|
|
97
|
-
}));
|
|
98
|
-
return _markAllAsRead.apply(this, arguments);
|
|
22
|
+
export async function markAllAsRead() {
|
|
23
|
+
return Post(`${urls.notifications.v1}/status/mark-all-read`);
|
|
99
24
|
}
|
package/package.json
CHANGED
package/reports/index.js
CHANGED
|
@@ -1,185 +1,75 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["dataFilters"],
|
|
4
|
+
_excluded2 = ["templateId", "dataFilters"],
|
|
5
|
+
_excluded3 = ["dataFilters"];
|
|
5
6
|
import { Get, Post } from '../fetch';
|
|
6
7
|
import { urls } from '../constants';
|
|
7
|
-
export function getReports(
|
|
8
|
-
return
|
|
8
|
+
export async function getReports(body) {
|
|
9
|
+
return Get(`${urls.reports.service.v2}/tenant-reports`, body);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_getReports = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(body) {
|
|
13
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
-
while (1) {
|
|
15
|
-
switch (_context.prev = _context.next) {
|
|
16
|
-
case 0:
|
|
17
|
-
return _context.abrupt("return", Get("".concat(urls.reports.service.v2, "/tenant-reports"), body));
|
|
18
|
-
|
|
19
|
-
case 1:
|
|
20
|
-
case "end":
|
|
21
|
-
return _context.stop();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}, _callee);
|
|
25
|
-
}));
|
|
26
|
-
return _getReports.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function getReport(_x2) {
|
|
30
|
-
return _getReport.apply(this, arguments);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function _getReport() {
|
|
34
|
-
_getReport = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(body) {
|
|
35
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
36
|
-
while (1) {
|
|
37
|
-
switch (_context2.prev = _context2.next) {
|
|
38
|
-
case 0:
|
|
39
|
-
return _context2.abrupt("return", Get("".concat(urls.reports.service.v2, "/").concat(body.id, "/tenant-reports")));
|
|
40
|
-
|
|
41
|
-
case 1:
|
|
42
|
-
case "end":
|
|
43
|
-
return _context2.stop();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}, _callee2);
|
|
47
|
-
}));
|
|
48
|
-
return _getReport.apply(this, arguments);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function renderReport(_x3) {
|
|
52
|
-
return _renderReport.apply(this, arguments);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function _renderReport() {
|
|
56
|
-
_renderReport = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(_ref) {
|
|
57
|
-
var dataFilters, body, html;
|
|
58
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
59
|
-
while (1) {
|
|
60
|
-
switch (_context3.prev = _context3.next) {
|
|
61
|
-
case 0:
|
|
62
|
-
dataFilters = _ref.dataFilters, body = _objectWithoutProperties(_ref, ["dataFilters"]);
|
|
63
|
-
_context3.next = 3;
|
|
64
|
-
return Get("".concat(urls.reports.trigger.v1, "/preview-report"), _extends({}, body, {
|
|
65
|
-
dataFilters: btoa(JSON.stringify(dataFilters || {})),
|
|
66
|
-
responseType: 'html'
|
|
67
|
-
}), {
|
|
68
|
-
responseType: 'plain'
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
case 3:
|
|
72
|
-
html = _context3.sent;
|
|
73
|
-
return _context3.abrupt("return", {
|
|
74
|
-
html: html
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
case 5:
|
|
78
|
-
case "end":
|
|
79
|
-
return _context3.stop();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, _callee3);
|
|
83
|
-
}));
|
|
84
|
-
return _renderReport.apply(this, arguments);
|
|
11
|
+
export async function getReport(body) {
|
|
12
|
+
return Get(`${urls.reports.service.v2}/${body.id}/tenant-reports`);
|
|
85
13
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})));
|
|
102
|
-
|
|
103
|
-
case 2:
|
|
104
|
-
case "end":
|
|
105
|
-
return _context4.stop();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}, _callee4);
|
|
109
|
-
}));
|
|
110
|
-
return _scheduleReport.apply(this, arguments);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function downloadReport(_x5) {
|
|
114
|
-
return _downloadReport.apply(this, arguments);
|
|
14
|
+
export async function renderReport(_ref) {
|
|
15
|
+
let {
|
|
16
|
+
dataFilters
|
|
17
|
+
} = _ref,
|
|
18
|
+
body = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
const html = await Get(`${urls.reports.trigger.v1}/preview-report`, _extends({}, body, {
|
|
21
|
+
dataFilters: btoa(JSON.stringify(dataFilters || {})),
|
|
22
|
+
responseType: 'html'
|
|
23
|
+
}), {
|
|
24
|
+
responseType: 'plain'
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
html
|
|
28
|
+
};
|
|
115
29
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
_context5.next = 3;
|
|
126
|
-
return Get("".concat(urls.reports.trigger.v1, "/preview-report"), _extends({}, body, {
|
|
127
|
-
dataFilters: btoa(JSON.stringify(dataFilters || {}))
|
|
128
|
-
}), {
|
|
129
|
-
responseType: 'blob'
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
case 3:
|
|
133
|
-
blob = _context5.sent;
|
|
134
|
-
contentType = 'text/html';
|
|
135
|
-
contentExt = 'html';
|
|
136
|
-
|
|
137
|
-
if (body.responseType === 'pdf') {
|
|
138
|
-
contentType = 'application/pdf';
|
|
139
|
-
contentExt = 'pdf';
|
|
140
|
-
} else if (body.responseType === 'image') {
|
|
141
|
-
contentType = 'image/jpeg';
|
|
142
|
-
contentExt = 'jpg';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
newBlob = new Blob([blob], {
|
|
146
|
-
type: contentType
|
|
147
|
-
});
|
|
148
|
-
fileURL = URL.createObjectURL(newBlob);
|
|
149
|
-
tempLink = document.createElement('a');
|
|
150
|
-
tempLink.href = fileURL;
|
|
151
|
-
tempLink.setAttribute('download', "report_".concat(body.name || '', ".").concat(contentExt));
|
|
152
|
-
tempLink.click();
|
|
153
|
-
setTimeout(tempLink.remove.bind(tempLink));
|
|
154
|
-
|
|
155
|
-
case 14:
|
|
156
|
-
case "end":
|
|
157
|
-
return _context5.stop();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}, _callee5);
|
|
30
|
+
export async function scheduleReport(_ref2) {
|
|
31
|
+
let {
|
|
32
|
+
templateId,
|
|
33
|
+
dataFilters
|
|
34
|
+
} = _ref2,
|
|
35
|
+
body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
36
|
+
|
|
37
|
+
return Post(`${urls.reports.service.v2}/${templateId}/tenant-reports`, _extends({}, body, {
|
|
38
|
+
dataFilters: btoa(JSON.stringify(dataFilters || {}))
|
|
161
39
|
}));
|
|
162
|
-
return _downloadReport.apply(this, arguments);
|
|
163
40
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
41
|
+
export async function downloadReport(_ref3) {
|
|
42
|
+
let {
|
|
43
|
+
dataFilters
|
|
44
|
+
} = _ref3,
|
|
45
|
+
body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
46
|
+
|
|
47
|
+
const blob = await Get(`${urls.reports.trigger.v1}/preview-report`, _extends({}, body, {
|
|
48
|
+
dataFilters: btoa(JSON.stringify(dataFilters || {}))
|
|
49
|
+
}), {
|
|
50
|
+
responseType: 'blob'
|
|
51
|
+
});
|
|
52
|
+
let contentType = 'text/html';
|
|
53
|
+
let contentExt = 'html';
|
|
54
|
+
|
|
55
|
+
if (body.responseType === 'pdf') {
|
|
56
|
+
contentType = 'application/pdf';
|
|
57
|
+
contentExt = 'pdf';
|
|
58
|
+
} else if (body.responseType === 'image') {
|
|
59
|
+
contentType = 'image/jpeg';
|
|
60
|
+
contentExt = 'jpg';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const newBlob = new Blob([blob], {
|
|
64
|
+
type: contentType
|
|
65
|
+
});
|
|
66
|
+
const fileURL = URL.createObjectURL(newBlob);
|
|
67
|
+
const tempLink = document.createElement('a');
|
|
68
|
+
tempLink.href = fileURL;
|
|
69
|
+
tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
|
|
70
|
+
tempLink.click();
|
|
71
|
+
setTimeout(tempLink.remove.bind(tempLink));
|
|
167
72
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
_sendReport = _asyncToGenerator(_regeneratorRuntime.mark(function _callee6(body) {
|
|
171
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
172
|
-
while (1) {
|
|
173
|
-
switch (_context6.prev = _context6.next) {
|
|
174
|
-
case 0:
|
|
175
|
-
return _context6.abrupt("return", Post("".concat(urls.reports.trigger.v1, "/tenant-reports"), body));
|
|
176
|
-
|
|
177
|
-
case 1:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context6.stop();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}, _callee6);
|
|
183
|
-
}));
|
|
184
|
-
return _sendReport.apply(this, arguments);
|
|
73
|
+
export async function sendReport(body) {
|
|
74
|
+
return Post(`${urls.reports.trigger.v1}/tenant-reports`, body);
|
|
185
75
|
}
|
package/roles/index.js
CHANGED
|
@@ -1,188 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
const _excluded = ["roleId"],
|
|
3
|
+
_excluded2 = ["roleId"],
|
|
4
|
+
_excluded3 = ["permissionId"];
|
|
4
5
|
import { Delete, Get, Patch, Post, Put } from '../fetch';
|
|
5
6
|
import { urls } from '../constants';
|
|
6
|
-
export function getRoles() {
|
|
7
|
-
return
|
|
7
|
+
export async function getRoles() {
|
|
8
|
+
return Get(urls.identity.roles.v1);
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_getRoles = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
|
|
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.identity.roles.v1));
|
|
17
|
-
|
|
18
|
-
case 1:
|
|
19
|
-
case "end":
|
|
20
|
-
return _context.stop();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}, _callee);
|
|
24
|
-
}));
|
|
25
|
-
return _getRoles.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function addRole(_x) {
|
|
29
|
-
return _addRole.apply(this, arguments);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _addRole() {
|
|
33
|
-
_addRole = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(body) {
|
|
34
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
35
|
-
while (1) {
|
|
36
|
-
switch (_context2.prev = _context2.next) {
|
|
37
|
-
case 0:
|
|
38
|
-
return _context2.abrupt("return", Post(urls.identity.roles.v1, body));
|
|
39
|
-
|
|
40
|
-
case 1:
|
|
41
|
-
case "end":
|
|
42
|
-
return _context2.stop();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}, _callee2);
|
|
46
|
-
}));
|
|
47
|
-
return _addRole.apply(this, arguments);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function deleteRole(_x2) {
|
|
51
|
-
return _deleteRole.apply(this, arguments);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _deleteRole() {
|
|
55
|
-
_deleteRole = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(_ref) {
|
|
56
|
-
var roleId;
|
|
57
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58
|
-
while (1) {
|
|
59
|
-
switch (_context3.prev = _context3.next) {
|
|
60
|
-
case 0:
|
|
61
|
-
roleId = _ref.roleId;
|
|
62
|
-
return _context3.abrupt("return", Delete("".concat(urls.identity.roles.v1, "/").concat(roleId)));
|
|
63
|
-
|
|
64
|
-
case 2:
|
|
65
|
-
case "end":
|
|
66
|
-
return _context3.stop();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, _callee3);
|
|
70
|
-
}));
|
|
71
|
-
return _deleteRole.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function updateRole(_x3) {
|
|
75
|
-
return _updateRole.apply(this, arguments);
|
|
10
|
+
export async function addRole(body) {
|
|
11
|
+
return Post(urls.identity.roles.v1, body);
|
|
76
12
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
82
|
-
while (1) {
|
|
83
|
-
switch (_context4.prev = _context4.next) {
|
|
84
|
-
case 0:
|
|
85
|
-
roleId = _ref2.roleId, body = _objectWithoutProperties(_ref2, ["roleId"]);
|
|
86
|
-
return _context4.abrupt("return", Patch("".concat(urls.identity.roles.v1, "/").concat(roleId), body));
|
|
87
|
-
|
|
88
|
-
case 2:
|
|
89
|
-
case "end":
|
|
90
|
-
return _context4.stop();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, _callee4);
|
|
94
|
-
}));
|
|
95
|
-
return _updateRole.apply(this, arguments);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function attachPermissionsToRole(_x4) {
|
|
99
|
-
return _attachPermissionsToRole.apply(this, arguments);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _attachPermissionsToRole() {
|
|
103
|
-
_attachPermissionsToRole = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(_ref3) {
|
|
104
|
-
var roleId, body;
|
|
105
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
106
|
-
while (1) {
|
|
107
|
-
switch (_context5.prev = _context5.next) {
|
|
108
|
-
case 0:
|
|
109
|
-
roleId = _ref3.roleId, body = _objectWithoutProperties(_ref3, ["roleId"]);
|
|
110
|
-
return _context5.abrupt("return", Put("".concat(urls.identity.roles.v1, "/").concat(roleId, "/permissions"), body));
|
|
111
|
-
|
|
112
|
-
case 2:
|
|
113
|
-
case "end":
|
|
114
|
-
return _context5.stop();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, _callee5);
|
|
118
|
-
}));
|
|
119
|
-
return _attachPermissionsToRole.apply(this, arguments);
|
|
13
|
+
export async function deleteRole({
|
|
14
|
+
roleId
|
|
15
|
+
}) {
|
|
16
|
+
return Delete(`${urls.identity.roles.v1}/${roleId}`);
|
|
120
17
|
}
|
|
18
|
+
export async function updateRole(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
roleId
|
|
21
|
+
} = _ref,
|
|
22
|
+
body = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
121
23
|
|
|
122
|
-
|
|
123
|
-
return _getPermissions.apply(this, arguments);
|
|
24
|
+
return Patch(`${urls.identity.roles.v1}/${roleId}`, body);
|
|
124
25
|
}
|
|
26
|
+
export async function attachPermissionsToRole(_ref2) {
|
|
27
|
+
let {
|
|
28
|
+
roleId
|
|
29
|
+
} = _ref2,
|
|
30
|
+
body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
125
31
|
|
|
126
|
-
|
|
127
|
-
_getPermissions = _asyncToGenerator(_regeneratorRuntime.mark(function _callee6() {
|
|
128
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
129
|
-
while (1) {
|
|
130
|
-
switch (_context6.prev = _context6.next) {
|
|
131
|
-
case 0:
|
|
132
|
-
return _context6.abrupt("return", Get(urls.identity.permissions.v1));
|
|
133
|
-
|
|
134
|
-
case 1:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context6.stop();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, _callee6);
|
|
140
|
-
}));
|
|
141
|
-
return _getPermissions.apply(this, arguments);
|
|
32
|
+
return Put(`${urls.identity.roles.v1}/${roleId}/permissions`, body);
|
|
142
33
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return _attachPermissionToRoles.apply(this, arguments);
|
|
34
|
+
export async function getPermissions() {
|
|
35
|
+
return Get(urls.identity.permissions.v1);
|
|
146
36
|
}
|
|
37
|
+
export async function attachPermissionToRoles(_ref3) {
|
|
38
|
+
let {
|
|
39
|
+
permissionId
|
|
40
|
+
} = _ref3,
|
|
41
|
+
body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
147
42
|
|
|
148
|
-
|
|
149
|
-
_attachPermissionToRoles = _asyncToGenerator(_regeneratorRuntime.mark(function _callee7(_ref4) {
|
|
150
|
-
var permissionId, body;
|
|
151
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
152
|
-
while (1) {
|
|
153
|
-
switch (_context7.prev = _context7.next) {
|
|
154
|
-
case 0:
|
|
155
|
-
permissionId = _ref4.permissionId, body = _objectWithoutProperties(_ref4, ["permissionId"]);
|
|
156
|
-
return _context7.abrupt("return", Put("".concat(urls.identity.permissions.v1, "/").concat(permissionId, "/roles"), body));
|
|
157
|
-
|
|
158
|
-
case 2:
|
|
159
|
-
case "end":
|
|
160
|
-
return _context7.stop();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}, _callee7);
|
|
164
|
-
}));
|
|
165
|
-
return _attachPermissionToRoles.apply(this, arguments);
|
|
43
|
+
return Put(`${urls.identity.permissions.v1}/${permissionId}/roles`, body);
|
|
166
44
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return _getPermissionCategories.apply(this, arguments);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function _getPermissionCategories() {
|
|
173
|
-
_getPermissionCategories = _asyncToGenerator(_regeneratorRuntime.mark(function _callee8() {
|
|
174
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
175
|
-
while (1) {
|
|
176
|
-
switch (_context8.prev = _context8.next) {
|
|
177
|
-
case 0:
|
|
178
|
-
return _context8.abrupt("return", Get("".concat(urls.identity.permissions.v1, "/categories")));
|
|
179
|
-
|
|
180
|
-
case 1:
|
|
181
|
-
case "end":
|
|
182
|
-
return _context8.stop();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}, _callee8);
|
|
186
|
-
}));
|
|
187
|
-
return _getPermissionCategories.apply(this, arguments);
|
|
45
|
+
export async function getPermissionCategories() {
|
|
46
|
+
return Get(`${urls.identity.permissions.v1}/categories`);
|
|
188
47
|
}
|
package/routers.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { urls } from './constants';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export const fronteggAuthApiRoutes = [`${urls.identity.auth.v1}/logout`, `${urls.identity.auth.v1}/user/saml/postlogin`, `${urls.identity.auth.v2}/user/oidc/postlogin`, `${urls.identity.auth.v1}/user`, `${urls.identity.auth.v1}/user/mfa/verify`, `${urls.identity.auth.v1}/user/token/refresh`, `${urls.identity.users.v1}`, `${urls.identity.auth.v1}/passwordless/magiclink/postlogin`, `${urls.identity.auth.v1}/passwordless/code/postlogin`, `${urls.identity.auth.v1}/passwordless/smscode/postlogin`, `${urls.identity.users.v1}/activate`, `${urls.identity.users.v1}/invitation/accept`];
|
|
3
|
+
export const fronteggRefreshTokenUrl = `${urls.identity.auth.v1}/user/token/refresh`;
|