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