@frontegg/rest-api 3.1.76-alpha.9502349697 → 3.1.76-alpha.9762981322
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/index.d.ts +30 -108
- package/ContextHolder/index.js +57 -153
- package/account-settings/index.d.ts +7 -19
- package/account-settings/index.js +13 -23
- package/applications/index.d.ts +44 -49
- package/applications/index.js +37 -51
- package/audits/index.d.ts +15 -27
- package/audits/index.js +17 -27
- package/auth/index.d.ts +768 -817
- package/auth/index.js +721 -902
- package/auth/secutiry-poilicy/index.d.ts +102 -58
- package/auth/secutiry-poilicy/index.js +90 -122
- package/auth/utils.d.ts +2 -2
- package/auth/utils.js +8 -9
- package/connectivity/index.d.ts +27 -126
- package/connectivity/index.js +114 -147
- package/directory/index.d.ts +22 -31
- package/directory/index.js +15 -27
- package/entitlements/index.d.ts +8 -14
- package/entitlements/index.js +4 -12
- package/feature-flags/index.d.ts +2 -8
- package/feature-flags/index.js +8 -16
- package/fetch.d.ts +24 -0
- package/fetch.js +265 -0
- package/groups/index.d.ts +49 -73
- package/groups/index.js +45 -64
- package/impersonate/index.d.ts +6 -15
- package/impersonate/index.js +5 -13
- package/index.d.ts +108 -154
- package/index.js +78 -109
- package/interfaces.d.ts +0 -10
- package/metadata/index.d.ts +7 -67
- package/metadata/index.js +32 -52
- package/node/ContextHolder/index.js +57 -153
- package/node/account-settings/index.js +16 -27
- package/node/applications/index.js +44 -51
- package/node/audits/index.js +20 -31
- package/node/auth/index.js +1035 -768
- package/node/auth/secutiry-poilicy/index.js +136 -125
- package/node/auth/utils.js +7 -9
- package/node/connectivity/index.js +187 -148
- package/node/directory/index.js +20 -29
- package/node/entitlements/index.js +5 -18
- package/node/feature-flags/index.js +9 -21
- package/node/fetch.js +306 -0
- package/node/groups/index.js +63 -65
- package/node/impersonate/index.js +5 -18
- package/node/index.js +71 -116
- package/node/metadata/index.js +52 -61
- package/node/notifications/index.js +27 -37
- package/node/reports/index.js +70 -78
- package/node/roles/index.js +51 -56
- package/node/security-center/index.js +9 -21
- package/node/sub-tenants/index.js +89 -90
- package/node/subscriptions/index.js +107 -69
- package/node/subscriptions/invoices.js +17 -25
- package/node/subscriptions/managedSubscriptions.js +27 -32
- package/node/subscriptions/paymentMethods.js +20 -27
- package/node/subscriptions/paymentProviders.js +6 -15
- package/node/subscriptions/plans.js +9 -17
- package/node/subscriptions/providers/index.js +18 -0
- package/node/subscriptions/providers/stripe/index.js +21 -26
- package/node/subscriptions/subscriptions.js +27 -32
- package/node/subscriptions/summaries.js +6 -15
- package/node/subscriptions/tenantConfiguration.js +9 -17
- package/node/subscriptions/vendorPublicConfigurations.js +6 -15
- package/node/teams/index.js +138 -130
- package/node/tenants/index.js +60 -65
- package/node/user-phone-numbers/index.js +24 -32
- package/node/users/index.js +53 -58
- package/node/vendor/index.js +6 -17
- package/notifications/index.d.ts +16 -22
- package/notifications/index.js +22 -33
- package/package.json +1 -1
- package/reports/index.d.ts +44 -50
- package/reports/index.js +62 -75
- package/roles/index.d.ts +38 -44
- package/roles/index.js +41 -57
- package/security-center/index.d.ts +2 -14
- package/security-center/index.js +6 -15
- package/sub-tenants/index.d.ts +15 -57
- package/sub-tenants/index.js +68 -88
- package/subscriptions/index.d.ts +11 -56
- package/subscriptions/index.js +11 -58
- package/subscriptions/invoices.d.ts +13 -16
- package/subscriptions/invoices.js +14 -24
- package/subscriptions/managedSubscriptions.d.ts +15 -18
- package/subscriptions/managedSubscriptions.js +22 -33
- package/subscriptions/paymentMethods.d.ts +13 -16
- package/subscriptions/paymentMethods.js +17 -26
- package/subscriptions/paymentProviders.d.ts +5 -8
- package/subscriptions/paymentProviders.js +4 -11
- package/subscriptions/plans.d.ts +8 -11
- package/subscriptions/plans.js +6 -14
- package/subscriptions/providers/index.d.ts +1 -0
- package/subscriptions/providers/index.js +1 -0
- package/subscriptions/providers/stripe/index.d.ts +21 -24
- package/subscriptions/providers/stripe/index.js +16 -27
- package/subscriptions/subscriptions.d.ts +21 -24
- package/subscriptions/subscriptions.js +22 -33
- package/subscriptions/summaries.d.ts +4 -7
- package/subscriptions/summaries.js +3 -10
- package/subscriptions/tenantConfiguration.d.ts +3 -6
- package/subscriptions/tenantConfiguration.js +7 -15
- package/subscriptions/vendorPublicConfigurations.d.ts +2 -5
- package/subscriptions/vendorPublicConfigurations.js +4 -11
- package/teams/index.d.ts +131 -35
- package/teams/index.js +93 -122
- package/tenants/index.d.ts +37 -25
- package/tenants/index.js +46 -62
- package/user-phone-numbers/index.d.ts +26 -32
- package/user-phone-numbers/index.js +19 -32
- package/users/index.d.ts +15 -21
- package/users/index.js +44 -60
- package/vendor/index.d.ts +6 -12
- package/vendor/index.js +4 -11
- package/BaseApiClient.d.ts +0 -16
- package/BaseApiClient.js +0 -39
- package/FetchClient.d.ts +0 -42
- package/FetchClient.js +0 -308
- package/node/BaseApiClient.js +0 -49
- package/node/FetchClient.js +0 -326
package/fetch.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { ContextHolder } from './ContextHolder';
|
|
3
|
+
import { fronteggHeaders } from './interfaces';
|
|
4
|
+
import { FronteggApiError } from './error';
|
|
5
|
+
import { GENERIC_ERROR_MESSAGE } from './constants';
|
|
6
|
+
export function getBaseUrl(context, url, withFronteggPrefix = true) {
|
|
7
|
+
let baseUrl;
|
|
8
|
+
|
|
9
|
+
if (typeof context.baseUrl === 'function') {
|
|
10
|
+
baseUrl = context.baseUrl(url);
|
|
11
|
+
} else {
|
|
12
|
+
baseUrl = context.baseUrl;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const prefix = context.urlPrefix || 'frontegg';
|
|
16
|
+
const removePrefix = prefix === 'frontegg' && !withFronteggPrefix;
|
|
17
|
+
|
|
18
|
+
if (!baseUrl.endsWith('/')) {
|
|
19
|
+
baseUrl += '/';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!baseUrl.endsWith(prefix) && !removePrefix) {
|
|
23
|
+
baseUrl += prefix;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return baseUrl;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function prepareUrl(context, url, params) {
|
|
30
|
+
const baseUrl = getBaseUrl(context, url);
|
|
31
|
+
const paramsToSend = await buildQueryParams(context, params);
|
|
32
|
+
let finalUrl = url.startsWith('http') ? url : `${baseUrl}${url}`;
|
|
33
|
+
const hasKeys = Object.keys(paramsToSend).length > 0;
|
|
34
|
+
|
|
35
|
+
if (paramsToSend && hasKeys) {
|
|
36
|
+
const urlParams = new URLSearchParams(paramsToSend);
|
|
37
|
+
finalUrl += `?${urlParams}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return finalUrl;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getMetadataHeaders(context) {
|
|
44
|
+
var _context$metadataHead, _context$metadataHead2;
|
|
45
|
+
|
|
46
|
+
const headers = {};
|
|
47
|
+
|
|
48
|
+
if (context != null && (_context$metadataHead = context.metadataHeaders) != null && _context$metadataHead.fronteggSdkVersion) {
|
|
49
|
+
headers[fronteggHeaders.fronteggSdkVersion] = context.metadataHeaders.fronteggSdkVersion;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (context != null && (_context$metadataHead2 = context.metadataHeaders) != null && _context$metadataHead2.framework) {
|
|
53
|
+
headers[fronteggHeaders.frameWork] = context.metadataHeaders.framework;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return headers;
|
|
57
|
+
}
|
|
58
|
+
export function getScopedTenant() {
|
|
59
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
60
|
+
const scopedTenant = urlParams.get('tenantId');
|
|
61
|
+
|
|
62
|
+
if (scopedTenant) {
|
|
63
|
+
return scopedTenant;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function buildRequestHeaders(context, contentType) {
|
|
70
|
+
var _context$tokenResolve;
|
|
71
|
+
|
|
72
|
+
const headers = getMetadataHeaders(context);
|
|
73
|
+
const authToken = await ((_context$tokenResolve = context == null ? void 0 : context.tokenResolver) != null ? _context$tokenResolve : ContextHolder.getAccessToken)();
|
|
74
|
+
const requestSource = ContextHolder.getRequestSource();
|
|
75
|
+
const scopedTenant = getScopedTenant();
|
|
76
|
+
|
|
77
|
+
if (contentType) {
|
|
78
|
+
headers[fronteggHeaders.contentType] = contentType;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (requestSource) {
|
|
82
|
+
headers[fronteggHeaders.source] = requestSource;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (authToken) {
|
|
86
|
+
headers.Authorization = `Bearer ${authToken}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (scopedTenant) {
|
|
90
|
+
headers[fronteggHeaders.scopedTenant] = scopedTenant;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
for (const additionalHeader of await getAdditionalHeaders(context)) {
|
|
94
|
+
headers[`${additionalHeader.key}`] = `${additionalHeader.value}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return headers;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function buildQueryParams(context, params) {
|
|
101
|
+
if (!params) {
|
|
102
|
+
params = {};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const additionalQueryParams = await getAdditionalQueryParams(context);
|
|
106
|
+
|
|
107
|
+
for (const queryParam of additionalQueryParams) {
|
|
108
|
+
params[queryParam.key] = queryParam.value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const keys = Object.keys(params);
|
|
112
|
+
|
|
113
|
+
for (const key of keys) {
|
|
114
|
+
const value = params[key];
|
|
115
|
+
params[key] = typeof value === 'object' ? JSON.stringify(value) : value;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return params;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function getAdditionalQueryParams(context) {
|
|
122
|
+
let output = [];
|
|
123
|
+
|
|
124
|
+
if (context.additionalQueryParamsResolver) {
|
|
125
|
+
output = await context.additionalQueryParamsResolver();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return output;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function getAdditionalHeaders(context) {
|
|
132
|
+
let output = [];
|
|
133
|
+
|
|
134
|
+
if (context.additionalHeadersResolver) {
|
|
135
|
+
output = await context.additionalHeadersResolver();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (context.tenantResolver) {
|
|
139
|
+
const resolvedTenantResult = await context.tenantResolver();
|
|
140
|
+
|
|
141
|
+
if (!!(resolvedTenantResult != null && resolvedTenantResult.tenant)) {
|
|
142
|
+
output.push({
|
|
143
|
+
key: 'frontegg-login-alias',
|
|
144
|
+
value: resolvedTenantResult.tenant
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (context.appId) {
|
|
150
|
+
output.push({
|
|
151
|
+
key: 'frontegg-requested-application-id',
|
|
152
|
+
value: context.appId
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return output;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const sendRequest = async opts => {
|
|
160
|
+
var _opts$method, _ref, _opts$credentials;
|
|
161
|
+
|
|
162
|
+
const context = ContextHolder.getContext();
|
|
163
|
+
const headers = await buildRequestHeaders(context, opts.contentType);
|
|
164
|
+
const url = await prepareUrl(context, opts.url, opts.params);
|
|
165
|
+
const response = await fetch(url, {
|
|
166
|
+
body: opts.body ? opts.contentType === 'application/json' ? JSON.stringify(opts.body) : opts.body : null,
|
|
167
|
+
method: (_opts$method = opts.method) != null ? _opts$method : 'GET',
|
|
168
|
+
headers: _extends({}, headers, opts.headers),
|
|
169
|
+
credentials: (_ref = (_opts$credentials = opts.credentials) != null ? _opts$credentials : context.requestCredentials) != null ? _ref : 'same-origin'
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
if (response.status === 302) {
|
|
173
|
+
window.location.href = await response.text();
|
|
174
|
+
return new Promise(() => {});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (!response.ok) {
|
|
178
|
+
var _context$logLevel, _context$logLevel2;
|
|
179
|
+
|
|
180
|
+
if (response.status === 413) {
|
|
181
|
+
throw new FronteggApiError('Error request is too large', response.status);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
let errorMessage;
|
|
185
|
+
let isJsonResponse = true;
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
errorMessage = await response.text();
|
|
189
|
+
errorMessage = JSON.parse(errorMessage);
|
|
190
|
+
} catch (e) {
|
|
191
|
+
isJsonResponse = false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (errorMessage.errors) {
|
|
195
|
+
errorMessage = errorMessage.errors.join(', ');
|
|
196
|
+
} else if (typeof errorMessage !== 'string') {
|
|
197
|
+
errorMessage = `Error ${response.status} - ${response.statusText}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (response.status >= 400 && response.status < 500 && ['warn'].includes((_context$logLevel = context.logLevel) != null ? _context$logLevel : '')) console.warn(errorMessage);else if (response.status === 500 && ['warn', 'error'].includes((_context$logLevel2 = context.logLevel) != null ? _context$logLevel2 : '')) console.error(errorMessage);
|
|
201
|
+
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (!opts.responseType || opts.responseType === 'json') {
|
|
205
|
+
try {
|
|
206
|
+
return await response.json();
|
|
207
|
+
} catch (e) {
|
|
208
|
+
return {};
|
|
209
|
+
}
|
|
210
|
+
} else if (opts.responseType === 'blob') {
|
|
211
|
+
const {
|
|
212
|
+
outputFileName
|
|
213
|
+
} = opts.params;
|
|
214
|
+
return await response.blob().then(blob => URL.createObjectURL(blob)).then(url => {
|
|
215
|
+
const tempLink = document.createElement('a');
|
|
216
|
+
tempLink.href = url;
|
|
217
|
+
tempLink.setAttribute('download', outputFileName || 'output');
|
|
218
|
+
tempLink.click();
|
|
219
|
+
});
|
|
220
|
+
} else {
|
|
221
|
+
return await response.text();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export const Get = async (url, params, opts) => sendRequest(_extends({
|
|
226
|
+
url,
|
|
227
|
+
method: 'GET',
|
|
228
|
+
contentType: 'application/json',
|
|
229
|
+
params
|
|
230
|
+
}, opts));
|
|
231
|
+
export const Post = async (url, body, opts) => sendRequest(_extends({
|
|
232
|
+
url,
|
|
233
|
+
method: 'POST',
|
|
234
|
+
contentType: 'application/json',
|
|
235
|
+
body
|
|
236
|
+
}, opts));
|
|
237
|
+
export const Patch = async (url, body, opts) => sendRequest(_extends({
|
|
238
|
+
url,
|
|
239
|
+
method: 'PATCH',
|
|
240
|
+
contentType: 'application/json',
|
|
241
|
+
body
|
|
242
|
+
}, opts));
|
|
243
|
+
export const Put = async (url, body, opts) => sendRequest(_extends({
|
|
244
|
+
url,
|
|
245
|
+
method: 'PUT',
|
|
246
|
+
contentType: 'application/json',
|
|
247
|
+
body
|
|
248
|
+
}, opts));
|
|
249
|
+
export const Delete = async (url, body, opts) => sendRequest(_extends({
|
|
250
|
+
url,
|
|
251
|
+
method: 'DELETE',
|
|
252
|
+
contentType: 'application/json',
|
|
253
|
+
body
|
|
254
|
+
}, opts));
|
|
255
|
+
export const PostDownload = async (url, body, params, opts) => sendRequest(_extends({
|
|
256
|
+
url,
|
|
257
|
+
method: 'POST',
|
|
258
|
+
contentType: 'application/json',
|
|
259
|
+
responseType: 'blob',
|
|
260
|
+
body,
|
|
261
|
+
params
|
|
262
|
+
}, opts));
|
|
263
|
+
export const extractHeadersFromOptions = (options = {}) => _extends({}, options.jwt ? {
|
|
264
|
+
Authorization: options.jwt
|
|
265
|
+
} : {});
|
package/groups/index.d.ts
CHANGED
|
@@ -1,73 +1,49 @@
|
|
|
1
|
-
import { ICreateGroup, ICreateGroupResponse, IGetGroup, IGetGroupQueryOptions, IGetGroupsByIds, IGroupConfigResponse, IGroupResponse, IUpdateGroup, IUpdateGroupConfig, IUpdateGroupRoles, IUpdateGroupUsers } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Add users to existing group
|
|
52
|
-
* @param groupId - The ID of the group
|
|
53
|
-
* @param body - Request body containing users to add
|
|
54
|
-
*/
|
|
55
|
-
addUsersToGroup: (groupId: string, body: IUpdateGroupUsers) => Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Delete users from existing group
|
|
58
|
-
* @param groupId - The ID of the group
|
|
59
|
-
* @param body - Request body containing users to delete
|
|
60
|
-
*/
|
|
61
|
-
deleteUsersFromGroup: (groupId: string, body: IUpdateGroupUsers) => Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Get or create default groups configuration
|
|
64
|
-
*/
|
|
65
|
-
getGroupConfiguration: () => Promise<IGroupConfigResponse>;
|
|
66
|
-
/**
|
|
67
|
-
* Create or update groups configuration
|
|
68
|
-
* @param body - Request body to update group configuration
|
|
69
|
-
*/
|
|
70
|
-
updateGroupConfiguration: (body: IUpdateGroupConfig) => Promise<IGroupConfigResponse>;
|
|
71
|
-
}
|
|
72
|
-
declare const _default: GroupsApi;
|
|
73
|
-
export default _default;
|
|
1
|
+
import { ICreateGroup, ICreateGroupResponse, IGetGroup, IGetGroupQueryOptions, IGetGroupsByIds, IGroupConfigResponse, IGroupResponse, IUpdateGroup, IUpdateGroupConfig, IUpdateGroupRoles, IUpdateGroupUsers } from "./interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Get group by given id
|
|
4
|
+
*/
|
|
5
|
+
export declare function getGroupById({ groupId }: IGetGroup, query?: IGetGroupQueryOptions): Promise<IGroupResponse>;
|
|
6
|
+
/**
|
|
7
|
+
* Get all tenant groups
|
|
8
|
+
*/
|
|
9
|
+
export declare function getGroups(query?: IGetGroupQueryOptions): Promise<IGroupResponse[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Get groups by ids
|
|
12
|
+
*/
|
|
13
|
+
export declare function getGroupsByIds(body: IGetGroupsByIds, params?: IGetGroupQueryOptions): Promise<IGroupResponse[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Create new group
|
|
16
|
+
*/
|
|
17
|
+
export declare function createGroup(body: ICreateGroup): Promise<ICreateGroupResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Update existing group by Id
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateGroup({ groupId, ...body }: IUpdateGroup): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete existing group by Id
|
|
24
|
+
*/
|
|
25
|
+
export declare function deleteGroup(groupId: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Add roles to existing group
|
|
28
|
+
*/
|
|
29
|
+
export declare function addRolesToGroup(groupId: string, body: IUpdateGroupRoles): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Delete roles from existing group
|
|
32
|
+
*/
|
|
33
|
+
export declare function deleteRolesFromGroup(groupId: string, body: IUpdateGroupRoles): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Add users to existing group
|
|
36
|
+
*/
|
|
37
|
+
export declare function addUsersToGroup(groupId: string, body: IUpdateGroupUsers): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Delete users from existing group
|
|
40
|
+
*/
|
|
41
|
+
export declare function deleteUsersFromGroup(groupId: string, body: IUpdateGroupUsers): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Get or create default groups configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare function getGroupConfiguration(): Promise<IGroupConfigResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Create or update groups configuration
|
|
48
|
+
*/
|
|
49
|
+
export declare function updateGroupConfiguration(body: IUpdateGroupConfig): Promise<IGroupConfigResponse>;
|
package/groups/index.js
CHANGED
|
@@ -1,69 +1,50 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["groupId"];
|
|
4
|
-
import { urls } from
|
|
5
|
-
import {
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return this.post(`${urls.identity.groups.v1}`, body);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
this.updateGroup = async _ref => {
|
|
31
|
-
let {
|
|
32
|
-
groupId
|
|
33
|
-
} = _ref,
|
|
34
|
-
body = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
35
|
-
|
|
36
|
-
return this.patch(`${urls.identity.groups.v1}/${groupId}`, body);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
this.deleteGroup = async groupId => {
|
|
40
|
-
return this.delete(`${urls.identity.groups.v1}/${groupId}`);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
this.addRolesToGroup = async (groupId, body) => {
|
|
44
|
-
return this.post(`${urls.identity.groups.v1}/${groupId}/roles`, body);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
this.deleteRolesFromGroup = async (groupId, body) => {
|
|
48
|
-
return this.delete(`${urls.identity.groups.v1}/${groupId}/roles`, body);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
this.addUsersToGroup = async (groupId, body) => {
|
|
52
|
-
return this.post(`${urls.identity.groups.v1}/${groupId}/users`, body);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
this.deleteUsersFromGroup = async (groupId, body) => {
|
|
56
|
-
return this.delete(`${urls.identity.groups.v1}/${groupId}/users`, body);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
this.getGroupConfiguration = async () => {
|
|
60
|
-
return this.get(`${urls.identity.groups.configurations.v1}`);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
this.updateGroupConfiguration = async body => {
|
|
64
|
-
return this.post(`${urls.identity.groups.configurations.v1}`, body);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
4
|
+
import { urls } from "../constants";
|
|
5
|
+
import { Delete, Get, Patch, Post } from "../fetch";
|
|
6
|
+
export async function getGroupById({
|
|
7
|
+
groupId
|
|
8
|
+
}, query) {
|
|
9
|
+
return Get(`${urls.identity.groups.v1}/${groupId}`, _extends({}, query));
|
|
10
|
+
}
|
|
11
|
+
export async function getGroups(query) {
|
|
12
|
+
return Get(`${urls.identity.groups.v1}`, _extends({}, query));
|
|
13
|
+
}
|
|
14
|
+
export async function getGroupsByIds(body, params) {
|
|
15
|
+
return Post(`${urls.identity.groups.getByIds.v1}`, body, {
|
|
16
|
+
params
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export async function createGroup(body) {
|
|
20
|
+
return Post(`${urls.identity.groups.v1}`, body);
|
|
21
|
+
}
|
|
22
|
+
export async function updateGroup(_ref) {
|
|
23
|
+
let {
|
|
24
|
+
groupId
|
|
25
|
+
} = _ref,
|
|
26
|
+
body = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
67
27
|
|
|
28
|
+
return Patch(`${urls.identity.groups.v1}/${groupId}`, body);
|
|
29
|
+
}
|
|
30
|
+
export async function deleteGroup(groupId) {
|
|
31
|
+
return Delete(`${urls.identity.groups.v1}/${groupId}`);
|
|
32
|
+
}
|
|
33
|
+
export async function addRolesToGroup(groupId, body) {
|
|
34
|
+
return Post(`${urls.identity.groups.v1}/${groupId}/roles`, body);
|
|
35
|
+
}
|
|
36
|
+
export async function deleteRolesFromGroup(groupId, body) {
|
|
37
|
+
return Delete(`${urls.identity.groups.v1}/${groupId}/roles`, body);
|
|
38
|
+
}
|
|
39
|
+
export async function addUsersToGroup(groupId, body) {
|
|
40
|
+
return Post(`${urls.identity.groups.v1}/${groupId}/users`, body);
|
|
41
|
+
}
|
|
42
|
+
export async function deleteUsersFromGroup(groupId, body) {
|
|
43
|
+
return Delete(`${urls.identity.groups.v1}/${groupId}/users`, body);
|
|
44
|
+
}
|
|
45
|
+
export async function getGroupConfiguration() {
|
|
46
|
+
return Get(`${urls.identity.groups.configurations.v1}`);
|
|
68
47
|
}
|
|
69
|
-
export
|
|
48
|
+
export async function updateGroupConfiguration(body) {
|
|
49
|
+
return Post(`${urls.identity.groups.configurations.v1}`, body);
|
|
50
|
+
}
|
package/impersonate/index.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import { IImpersonate, IImpersonateResponse } from
|
|
2
|
-
import { BaseApiClient } from '../BaseApiClient';
|
|
1
|
+
import { IImpersonate, IImpersonateResponse } from "./interfaces";
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* impersonating user should be called after creating actor token that contains information about impersonation.
|
|
4
|
+
* ``impersonate`` should contain impersonated user info (userId, tenantId, and vendorId) and the actor token that was created for him to perform impersonation.
|
|
5
|
+
*
|
|
6
|
+
* @throws exception if impersonation failed
|
|
5
7
|
*/
|
|
6
|
-
export declare
|
|
7
|
-
constructor(appName: string);
|
|
8
|
-
/**
|
|
9
|
-
* Impersonating user should be called after creating actor token that contains information about impersonation.
|
|
10
|
-
* `impersonate` should contain impersonated user info (userId, tenantId, and vendorId) and the actor token that was created for him to perform impersonation.
|
|
11
|
-
*
|
|
12
|
-
* @throws exception if impersonation failed
|
|
13
|
-
*/
|
|
14
|
-
impersonate: (body: IImpersonate) => Promise<IImpersonateResponse>;
|
|
15
|
-
}
|
|
16
|
-
declare const _default: ImpersonateApi;
|
|
17
|
-
export default _default;
|
|
8
|
+
export declare function impersonate(body: IImpersonate): Promise<IImpersonateResponse>;
|
package/impersonate/index.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { urls } from
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.impersonate = async body => {
|
|
8
|
-
return this.post(`${urls.identity.impersonate.v1}`, body);
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export default new ImpersonateApi('default');
|
|
1
|
+
import { urls } from "../constants";
|
|
2
|
+
import { Post } from "../fetch";
|
|
3
|
+
export async function impersonate(body) {
|
|
4
|
+
return Post(`${urls.identity.impersonate.v1}`, body);
|
|
5
|
+
}
|