@frontegg/rest-api 6.0.1-alpha.4 → 7.28.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseApiClient.d.ts +16 -0
- package/BaseApiClient.js +30 -0
- package/ContextHolder/index.d.ts +160 -0
- package/ContextHolder/index.js +278 -0
- package/ContextHolder/package.json +6 -0
- package/FetchClient.d.ts +42 -0
- package/FetchClient.js +260 -0
- package/account-settings/index.d.ts +21 -7
- package/account-settings/index.js +25 -6
- package/account-settings/interfaces.d.ts +9 -2
- package/applications/index.d.ts +51 -0
- package/applications/index.js +55 -0
- package/applications/interfaces.d.ts +49 -0
- package/applications/interfaces.js +5 -0
- package/applications/package.json +6 -0
- package/audits/index.d.ts +27 -15
- package/audits/index.js +29 -16
- package/audits/interfaces.d.ts +3 -2
- package/auth/constants.d.ts +5 -0
- package/auth/constants.js +5 -0
- package/auth/enums.d.ts +8 -1
- package/auth/enums.js +9 -4
- package/auth/index.d.ts +833 -428
- package/auth/index.js +768 -385
- package/auth/interfaces.d.ts +341 -39
- package/auth/interfaces.js +19 -9
- package/auth/secutiry-poilicy/index.d.ts +60 -41
- package/auth/secutiry-poilicy/index.js +99 -45
- package/auth/secutiry-poilicy/interfaces.d.ts +62 -2
- package/auth/secutiry-poilicy/interfaces.js +5 -1
- package/auth/utils.d.ts +10 -0
- package/auth/utils.js +35 -0
- package/connectivity/index.d.ts +126 -27
- package/connectivity/index.js +120 -114
- package/constants.d.ts +115 -0
- package/constants.js +122 -5
- package/directory/index.d.ts +32 -0
- package/directory/index.js +30 -0
- package/directory/interfaces.d.ts +30 -0
- package/directory/interfaces.js +7 -0
- package/directory/package.json +6 -0
- package/entitlements/index.d.ts +15 -0
- package/entitlements/index.js +20 -0
- package/entitlements/interfaces.d.ts +13 -0
- package/entitlements/interfaces.js +11 -0
- package/entitlements/package.json +6 -0
- package/error.js +0 -2
- package/feature-flags/index.d.ts +18 -0
- package/feature-flags/index.js +44 -0
- package/feature-flags/interfaces.d.ts +5 -0
- package/feature-flags/interfaces.js +1 -0
- package/feature-flags/package.json +6 -0
- package/groups/enums.d.ts +9 -0
- package/groups/enums.js +11 -0
- package/groups/index.d.ts +73 -0
- package/groups/index.js +62 -0
- package/groups/interfaces.d.ts +64 -0
- package/groups/interfaces.js +1 -0
- package/groups/package.json +6 -0
- package/impersonate/index.d.ts +17 -0
- package/impersonate/index.js +23 -0
- package/impersonate/interfaces.d.ts +12 -0
- package/impersonate/interfaces.js +1 -0
- package/impersonate/package.json +6 -0
- package/index.d.ts +148 -53
- package/index.js +103 -31
- package/interfaces.d.ts +82 -1
- package/interfaces.js +28 -1
- package/jwt.js +19 -20
- package/metadata/index.d.ts +68 -5
- package/metadata/index.js +53 -23
- package/metadata/interfaces.d.ts +10 -2
- package/node/BaseApiClient.js +37 -0
- package/node/ContextHolder/index.js +286 -0
- package/node/FetchClient.js +268 -0
- package/node/account-settings/index.js +26 -11
- package/node/applications/index.js +62 -0
- package/node/applications/interfaces.js +12 -0
- package/node/audits/index.js +32 -27
- package/node/auth/constants.js +13 -0
- package/node/auth/enums.js +11 -5
- package/node/auth/index.js +807 -644
- package/node/auth/interfaces.js +27 -13
- package/node/auth/secutiry-poilicy/index.js +100 -66
- package/node/auth/secutiry-poilicy/interfaces.js +8 -1
- package/node/auth/utils.js +44 -0
- package/node/connectivity/index.js +123 -197
- package/node/constants.js +124 -6
- package/node/directory/index.js +37 -0
- package/node/directory/interfaces.js +14 -0
- package/node/entitlements/index.js +27 -0
- package/node/entitlements/interfaces.js +18 -0
- package/node/error.js +0 -4
- package/node/feature-flags/index.js +54 -0
- package/node/feature-flags/interfaces.js +5 -0
- package/node/groups/enums.js +19 -0
- package/node/groups/index.js +70 -0
- package/node/groups/interfaces.js +5 -0
- package/node/impersonate/index.js +29 -0
- package/node/impersonate/interfaces.js +5 -0
- package/node/index.js +324 -94
- package/node/interfaces.js +34 -1
- package/node/jwt.js +19 -25
- package/node/metadata/index.js +57 -38
- package/node/notifications/index.js +34 -31
- package/node/reports/index.js +79 -83
- package/node/roles/index.js +55 -60
- package/node/roles/interfaces.js +9 -1
- package/node/routers.js +52 -6
- package/node/security-center/index.js +26 -0
- package/node/security-center/interfaces.js +74 -0
- package/node/sub-tenants/index.js +82 -29
- package/node/sub-tenants/interfaces.js +9 -1
- package/node/subscriptions/enums.js +13 -9
- package/node/subscriptions/index.js +64 -109
- package/node/subscriptions/interfaces.js +0 -2
- package/node/subscriptions/invoices.js +20 -21
- package/node/subscriptions/managedSubscriptions.js +28 -33
- package/node/subscriptions/paymentMethods.js +23 -27
- package/node/subscriptions/paymentProviders.js +11 -8
- package/node/subscriptions/plans.js +13 -12
- package/node/subscriptions/providers/stripe/index.js +22 -27
- package/node/subscriptions/subscriptions.js +28 -33
- package/node/subscriptions/summaries.js +11 -8
- package/node/subscriptions/tenantConfiguration.js +13 -12
- package/node/subscriptions/vendorPublicConfigurations.js +17 -0
- package/node/teams/index.js +108 -121
- package/node/teams/interfaces.js +8 -1
- package/node/tenants/index.js +63 -21
- package/node/tenants/interfaces.js +18 -1
- package/node/user-phone-numbers/index.js +38 -0
- package/node/user-phone-numbers/interfaces.js +5 -0
- package/node/users/index.js +64 -0
- package/node/users/interfaces.js +27 -0
- package/node/velo/index.js +75 -0
- package/node/velo/interfaces.js +5 -0
- package/node/vendor/index.js +16 -8
- package/notifications/index.d.ts +22 -16
- package/notifications/index.js +33 -22
- package/package.json +4 -2
- package/reports/index.d.ts +50 -44
- package/reports/index.js +77 -68
- package/reports/interfaces.d.ts +2 -2
- package/roles/index.d.ts +45 -34
- package/roles/index.js +52 -41
- package/roles/interfaces.d.ts +25 -9
- package/roles/interfaces.js +6 -1
- package/routers.d.ts +6 -1
- package/routers.js +45 -2
- package/security-center/index.d.ts +15 -0
- package/security-center/index.js +19 -0
- package/security-center/interfaces.d.ts +115 -0
- package/security-center/interfaces.js +63 -0
- package/security-center/package.json +6 -0
- package/sub-tenants/index.d.ts +57 -8
- package/sub-tenants/index.js +84 -19
- package/sub-tenants/interfaces.d.ts +68 -10
- package/sub-tenants/interfaces.js +6 -1
- package/subscriptions/enums.d.ts +7 -0
- package/subscriptions/enums.js +10 -8
- package/subscriptions/index.d.ts +55 -9
- package/subscriptions/index.js +56 -9
- package/subscriptions/interfaces.d.ts +7 -3
- package/subscriptions/interfaces.js +1 -1
- package/subscriptions/invoices.d.ts +16 -13
- package/subscriptions/invoices.js +19 -14
- package/subscriptions/managedSubscriptions.d.ts +18 -15
- package/subscriptions/managedSubscriptions.js +27 -22
- package/subscriptions/paymentMethods.d.ts +16 -13
- package/subscriptions/paymentMethods.js +22 -18
- package/subscriptions/paymentProviders.d.ts +8 -5
- package/subscriptions/paymentProviders.js +9 -4
- package/subscriptions/plans.d.ts +11 -8
- package/subscriptions/plans.js +11 -6
- package/subscriptions/providers/stripe/index.d.ts +24 -21
- package/subscriptions/providers/stripe/index.js +21 -16
- package/subscriptions/subscriptions.d.ts +24 -21
- package/subscriptions/subscriptions.js +27 -22
- package/subscriptions/summaries.d.ts +7 -4
- package/subscriptions/summaries.js +8 -3
- package/subscriptions/tenantConfiguration.d.ts +6 -3
- package/subscriptions/tenantConfiguration.js +12 -7
- package/subscriptions/vendorPublicConfigurations.d.ts +5 -0
- package/subscriptions/vendorPublicConfigurations.js +10 -0
- package/teams/index.d.ts +38 -115
- package/teams/index.js +105 -79
- package/teams/interfaces.d.ts +47 -42
- package/teams/interfaces.js +5 -1
- package/tenants/index.d.ts +25 -26
- package/tenants/index.js +61 -12
- package/tenants/interfaces.d.ts +85 -0
- package/tenants/interfaces.js +14 -1
- package/user-phone-numbers/index.d.ts +32 -0
- package/user-phone-numbers/index.js +31 -0
- package/user-phone-numbers/interfaces.d.ts +32 -0
- package/user-phone-numbers/interfaces.js +1 -0
- package/user-phone-numbers/package.json +6 -0
- package/users/index.d.ts +24 -0
- package/users/index.js +55 -0
- package/users/interfaces.d.ts +144 -0
- package/users/interfaces.js +18 -0
- package/users/package.json +6 -0
- package/velo/index.d.ts +46 -0
- package/velo/index.js +68 -0
- package/velo/interfaces.d.ts +108 -0
- package/velo/interfaces.js +1 -0
- package/velo/package.json +6 -0
- package/vendor/index.d.ts +12 -6
- package/vendor/index.js +15 -4
- package/ContextHolder.d.ts +0 -29
- package/ContextHolder.js +0 -80
- package/fetch.d.ts +0 -19
- package/fetch.js +0 -203
- package/node/ContextHolder.js +0 -90
- package/node/fetch.js +0 -234
- package/node/subscriptions/providers/index.js +0 -18
- package/subscriptions/providers/index.d.ts +0 -1
- package/subscriptions/providers/index.js +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum ScimConnectionSource {
|
|
2
|
+
FRONTEGG = "frontegg",
|
|
3
|
+
OKTA = "okta",
|
|
4
|
+
AZURE_AD = "azure-ad",
|
|
5
|
+
OTHER = "other"
|
|
6
|
+
}
|
|
7
|
+
export interface Scim2ConnectionConfigResponse {
|
|
8
|
+
id: string;
|
|
9
|
+
connectionName: string;
|
|
10
|
+
source: ScimConnectionSource;
|
|
11
|
+
syncToUserManagement: boolean;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
lastSync?: Date | null;
|
|
14
|
+
}
|
|
15
|
+
export interface Scim2CreateConnectionConfigRequest {
|
|
16
|
+
source: ScimConnectionSource;
|
|
17
|
+
connectionName?: string;
|
|
18
|
+
syncToUserManagement?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface Scim2PatchConnectionConfigRequest {
|
|
21
|
+
syncToUserManagement?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface Scim2CreateConnectionConfigResponse {
|
|
24
|
+
id: string;
|
|
25
|
+
connectionName: string;
|
|
26
|
+
token: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Scim2CountResponse {
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export let ScimConnectionSource;
|
|
2
|
+
(function (ScimConnectionSource) {
|
|
3
|
+
ScimConnectionSource["FRONTEGG"] = "frontegg";
|
|
4
|
+
ScimConnectionSource["OKTA"] = "okta";
|
|
5
|
+
ScimConnectionSource["AZURE_AD"] = "azure-ad";
|
|
6
|
+
ScimConnectionSource["OTHER"] = "other";
|
|
7
|
+
})(ScimConnectionSource || (ScimConnectionSource = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UserEntitlementsContext as UserEntitlementsResponseV2 } from '@frontegg/entitlements-javascript-commons';
|
|
2
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
3
|
+
export declare class EntitlementsApi extends BaseApiClient {
|
|
4
|
+
constructor(appName: string);
|
|
5
|
+
/**
|
|
6
|
+
* Load user entitlements data v2.
|
|
7
|
+
* Including all user permissions and features data.
|
|
8
|
+
* Now the final isEntitled response is not part of it, but includes the data needed to calculate it.
|
|
9
|
+
*
|
|
10
|
+
* `authorized user`
|
|
11
|
+
*/
|
|
12
|
+
loadEntitlementsV2: () => Promise<UserEntitlementsResponseV2>;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: EntitlementsApi;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { urls } from '../constants';
|
|
2
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
3
|
+
export class EntitlementsApi extends BaseApiClient {
|
|
4
|
+
constructor(appName) {
|
|
5
|
+
super(appName);
|
|
6
|
+
this.loadEntitlementsV2 = async () => {
|
|
7
|
+
return this.get(urls.entitlements.v2);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Load user entitlements data v2.
|
|
13
|
+
* Including all user permissions and features data.
|
|
14
|
+
* Now the final isEntitled response is not part of it, but includes the data needed to calculate it.
|
|
15
|
+
*
|
|
16
|
+
* `authorized user`
|
|
17
|
+
*/
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default new EntitlementsApi('default');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Entitlement {
|
|
2
|
+
isEntitled: boolean;
|
|
3
|
+
justification?: NotEntitledJustification;
|
|
4
|
+
}
|
|
5
|
+
export declare enum NotEntitledJustification {
|
|
6
|
+
MISSING_PERMISSION = "MISSING_PERMISSION",
|
|
7
|
+
MISSING_FEATURE = "MISSING_FEATURE",
|
|
8
|
+
BUNDLE_EXPIRED = "BUNDLE_EXPIRED"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* entitlements feature flag
|
|
12
|
+
*/
|
|
13
|
+
export declare const ADMIN_PORTAL_ENTITLEMENTS_FF = "admin_portal_entitlements";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export let NotEntitledJustification;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* entitlements feature flag
|
|
5
|
+
*/
|
|
6
|
+
(function (NotEntitledJustification) {
|
|
7
|
+
NotEntitledJustification["MISSING_PERMISSION"] = "MISSING_PERMISSION";
|
|
8
|
+
NotEntitledJustification["MISSING_FEATURE"] = "MISSING_FEATURE";
|
|
9
|
+
NotEntitledJustification["BUNDLE_EXPIRED"] = "BUNDLE_EXPIRED";
|
|
10
|
+
})(NotEntitledJustification || (NotEntitledJustification = {}));
|
|
11
|
+
export const ADMIN_PORTAL_ENTITLEMENTS_FF = 'admin_portal_entitlements';
|
package/error.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IFeatureFlagsAttributes } from './interfaces';
|
|
2
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
3
|
+
export declare class FeatureFlags {
|
|
4
|
+
private _flags;
|
|
5
|
+
private static _instances;
|
|
6
|
+
constructor();
|
|
7
|
+
static getInstance(name?: string): FeatureFlags;
|
|
8
|
+
static set(featureFlags?: IFeatureFlagsAttributes, name?: string): FeatureFlags;
|
|
9
|
+
static getFeatureFlags(flags: string[], name: string): boolean[];
|
|
10
|
+
get flags(): IFeatureFlagsAttributes;
|
|
11
|
+
set(featureFlags?: IFeatureFlagsAttributes): void;
|
|
12
|
+
}
|
|
13
|
+
export declare class FeatureFlagsApi extends BaseApiClient {
|
|
14
|
+
constructor(appName: string);
|
|
15
|
+
loadFeatureFlags: () => Promise<IFeatureFlagsAttributes>;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: FeatureFlagsApi;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { urls } from '../constants';
|
|
3
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
4
|
+
const defaultFeatureFlags = {
|
|
5
|
+
flags: {}
|
|
6
|
+
};
|
|
7
|
+
export class FeatureFlags {
|
|
8
|
+
constructor() {
|
|
9
|
+
var _defaultFeatureFlags$;
|
|
10
|
+
this._flags = {};
|
|
11
|
+
this._flags = (_defaultFeatureFlags$ = defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$ : {};
|
|
12
|
+
}
|
|
13
|
+
static getInstance(name = 'default') {
|
|
14
|
+
return this._instances[name];
|
|
15
|
+
}
|
|
16
|
+
static set(featureFlags, name = 'default') {
|
|
17
|
+
const featureFlagsInstance = new FeatureFlags();
|
|
18
|
+
featureFlagsInstance.set(featureFlags);
|
|
19
|
+
FeatureFlags._instances[name] = featureFlagsInstance;
|
|
20
|
+
return featureFlagsInstance;
|
|
21
|
+
}
|
|
22
|
+
static getFeatureFlags(flags, name) {
|
|
23
|
+
const featureFlagsInstance = this.getInstance(name);
|
|
24
|
+
return flags.map(flag => (featureFlagsInstance == null ? void 0 : featureFlagsInstance._flags[flag]) === 'on');
|
|
25
|
+
}
|
|
26
|
+
get flags() {
|
|
27
|
+
var _this$flags;
|
|
28
|
+
return (_this$flags = this.flags) != null ? _this$flags : {};
|
|
29
|
+
}
|
|
30
|
+
set(featureFlags) {
|
|
31
|
+
var _defaultFeatureFlags$2;
|
|
32
|
+
this._flags = _extends({}, (_defaultFeatureFlags$2 = defaultFeatureFlags == null ? void 0 : defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$2 : {}, featureFlags != null ? featureFlags : {});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
FeatureFlags._instances = {};
|
|
36
|
+
export class FeatureFlagsApi extends BaseApiClient {
|
|
37
|
+
constructor(appName) {
|
|
38
|
+
super(appName);
|
|
39
|
+
this.loadFeatureFlags = async () => {
|
|
40
|
+
return this.get(urls.featureFlags.v1);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default new FeatureFlagsApi('default');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/groups/enums.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export let GroupRelations;
|
|
2
|
+
(function (GroupRelations) {
|
|
3
|
+
GroupRelations["roles"] = "roles";
|
|
4
|
+
GroupRelations["users"] = "users";
|
|
5
|
+
GroupRelations["rolesAndUsers"] = "rolesAndUsers";
|
|
6
|
+
})(GroupRelations || (GroupRelations = {}));
|
|
7
|
+
export let GroupManagedByEnum;
|
|
8
|
+
(function (GroupManagedByEnum) {
|
|
9
|
+
GroupManagedByEnum["FRONTEGG"] = "frontegg";
|
|
10
|
+
GroupManagedByEnum["SCIM2"] = "scim2";
|
|
11
|
+
})(GroupManagedByEnum || (GroupManagedByEnum = {}));
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ICreateGroup, ICreateGroupResponse, IGetGroup, IGetGroupQueryOptions, IGetGroupsByIds, IGroupConfigResponse, IGroupResponse, IUpdateGroup, IUpdateGroupConfig, IUpdateGroupRoles, IUpdateGroupUsers } from './interfaces';
|
|
2
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
3
|
+
export declare class GroupsApi extends BaseApiClient {
|
|
4
|
+
constructor(appName: string);
|
|
5
|
+
/**
|
|
6
|
+
* Get group by given id
|
|
7
|
+
* @param groupId - The ID of the group to retrieve
|
|
8
|
+
* @param query - Optional query parameters
|
|
9
|
+
*/
|
|
10
|
+
getGroupById: ({ groupId }: IGetGroup, query?: IGetGroupQueryOptions) => Promise<IGroupResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Get all tenant groups
|
|
13
|
+
* @param query - Optional query parameters
|
|
14
|
+
*/
|
|
15
|
+
getGroups: (query?: IGetGroupQueryOptions) => Promise<IGroupResponse[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get groups by ids
|
|
18
|
+
* @param body - Request body containing group IDs
|
|
19
|
+
* @param params - Optional query parameters
|
|
20
|
+
*/
|
|
21
|
+
getGroupsByIds: (body: IGetGroupsByIds, params?: IGetGroupQueryOptions) => Promise<IGroupResponse[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Create new group
|
|
24
|
+
* @param body - Request body to create a group
|
|
25
|
+
*/
|
|
26
|
+
createGroup: (body: ICreateGroup) => Promise<ICreateGroupResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Update existing group by Id
|
|
29
|
+
* @param groupId - The ID of the group to update
|
|
30
|
+
* @param body - Request body containing update data
|
|
31
|
+
*/
|
|
32
|
+
updateGroup: ({ groupId, ...body }: IUpdateGroup) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Delete existing group by Id
|
|
35
|
+
* @param groupId - The ID of the group to delete
|
|
36
|
+
*/
|
|
37
|
+
deleteGroup: (groupId: string) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Add roles to existing group
|
|
40
|
+
* @param groupId - The ID of the group
|
|
41
|
+
* @param body - Request body containing roles to add
|
|
42
|
+
*/
|
|
43
|
+
addRolesToGroup: (groupId: string, body: IUpdateGroupRoles) => Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Delete roles from existing group
|
|
46
|
+
* @param groupId - The ID of the group
|
|
47
|
+
* @param body - Request body containing roles to delete
|
|
48
|
+
*/
|
|
49
|
+
deleteRolesFromGroup: (groupId: string, body: IUpdateGroupRoles) => Promise<void>;
|
|
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;
|
package/groups/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["groupId"];
|
|
4
|
+
import { urls } from '../constants';
|
|
5
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
6
|
+
export class GroupsApi extends BaseApiClient {
|
|
7
|
+
constructor(appName) {
|
|
8
|
+
super(appName);
|
|
9
|
+
this.getGroupById = async ({
|
|
10
|
+
groupId
|
|
11
|
+
}, query) => {
|
|
12
|
+
return this.get(`${urls.identity.groups.v1}/${groupId}`, _extends({}, query));
|
|
13
|
+
};
|
|
14
|
+
this.getGroups = async query => {
|
|
15
|
+
return this.get(`${urls.identity.groups.v1}`, _extends({}, query));
|
|
16
|
+
};
|
|
17
|
+
this.getGroupsByIds = async (body, params) => {
|
|
18
|
+
return this.post(`${urls.identity.groups.getByIds.v1}`, body, {
|
|
19
|
+
params
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.createGroup = async body => {
|
|
23
|
+
return this.post(`${urls.identity.groups.v1}`, body);
|
|
24
|
+
};
|
|
25
|
+
this.updateGroup = async _ref => {
|
|
26
|
+
let {
|
|
27
|
+
groupId
|
|
28
|
+
} = _ref,
|
|
29
|
+
body = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
30
|
+
return this.patch(`${urls.identity.groups.v1}/${groupId}`, body);
|
|
31
|
+
};
|
|
32
|
+
this.deleteGroup = async groupId => {
|
|
33
|
+
return this.delete(`${urls.identity.groups.v1}/${groupId}`);
|
|
34
|
+
};
|
|
35
|
+
this.addRolesToGroup = async (groupId, body) => {
|
|
36
|
+
return this.post(`${urls.identity.groups.v1}/${groupId}/roles`, body);
|
|
37
|
+
};
|
|
38
|
+
this.deleteRolesFromGroup = async (groupId, body) => {
|
|
39
|
+
return this.delete(`${urls.identity.groups.v1}/${groupId}/roles`, body);
|
|
40
|
+
};
|
|
41
|
+
this.addUsersToGroup = async (groupId, body) => {
|
|
42
|
+
return this.post(`${urls.identity.groups.v1}/${groupId}/users`, body);
|
|
43
|
+
};
|
|
44
|
+
this.deleteUsersFromGroup = async (groupId, body) => {
|
|
45
|
+
return this.delete(`${urls.identity.groups.v1}/${groupId}/users`, body);
|
|
46
|
+
};
|
|
47
|
+
this.getGroupConfiguration = async () => {
|
|
48
|
+
return this.get(`${urls.identity.groups.configurations.v1}`);
|
|
49
|
+
};
|
|
50
|
+
this.updateGroupConfiguration = async body => {
|
|
51
|
+
return this.post(`${urls.identity.groups.configurations.v1}`, body);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get group by given id
|
|
57
|
+
* @param groupId - The ID of the group to retrieve
|
|
58
|
+
* @param query - Optional query parameters
|
|
59
|
+
*/
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default new GroupsApi('default');
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IRole } from '../roles/interfaces';
|
|
2
|
+
import { GroupManagedByEnum, GroupRelations } from './enums';
|
|
3
|
+
export type IGetGroup = {
|
|
4
|
+
groupId: string;
|
|
5
|
+
};
|
|
6
|
+
export type IGroupUser = {
|
|
7
|
+
id: string;
|
|
8
|
+
email: string;
|
|
9
|
+
name: string;
|
|
10
|
+
profilePictureUrl: string | null;
|
|
11
|
+
activatedForTenant?: boolean;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
};
|
|
14
|
+
export type IGroupResponse = {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
metadata?: string;
|
|
20
|
+
roles?: IRole[];
|
|
21
|
+
users?: IGroupUser[];
|
|
22
|
+
managedBy: GroupManagedByEnum;
|
|
23
|
+
};
|
|
24
|
+
export type ICreateGroup = {
|
|
25
|
+
name: string;
|
|
26
|
+
color?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
metadata?: string;
|
|
29
|
+
};
|
|
30
|
+
export type ICreateGroupResponse = {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
color?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
metadata?: string;
|
|
36
|
+
managedBy: GroupManagedByEnum;
|
|
37
|
+
};
|
|
38
|
+
export type IUpdateGroup = {
|
|
39
|
+
groupId: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
color?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
metadata?: string;
|
|
44
|
+
};
|
|
45
|
+
export type IUpdateGroupConfig = {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
rolesEnabled?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type IGroupConfigResponse = {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
rolesEnabled: boolean;
|
|
52
|
+
};
|
|
53
|
+
export type IUpdateGroupRoles = {
|
|
54
|
+
roleIds: string[];
|
|
55
|
+
};
|
|
56
|
+
export type IUpdateGroupUsers = {
|
|
57
|
+
userIds: string[];
|
|
58
|
+
};
|
|
59
|
+
export type IGetGroupQueryOptions = {
|
|
60
|
+
_groupsRelations?: GroupRelations;
|
|
61
|
+
};
|
|
62
|
+
export type IGetGroupsByIds = {
|
|
63
|
+
groupsIds: string[];
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IImpersonate, IImpersonateResponse } from './interfaces';
|
|
2
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
3
|
+
/**
|
|
4
|
+
* UsersApi class provides methods for handling user and impersonation-related API requests.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ImpersonateApi extends BaseApiClient {
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { urls } from '../constants';
|
|
2
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* UsersApi class provides methods for handling user and impersonation-related API requests.
|
|
6
|
+
*/
|
|
7
|
+
export class ImpersonateApi extends BaseApiClient {
|
|
8
|
+
constructor(appName) {
|
|
9
|
+
super(appName);
|
|
10
|
+
this.impersonate = async body => {
|
|
11
|
+
return this.post(`${urls.identity.impersonate.v1}`, body);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Impersonating user should be called after creating actor token that contains information about impersonation.
|
|
17
|
+
* `impersonate` should contain impersonated user info (userId, tenantId, and vendorId) and the actor token that was created for him to perform impersonation.
|
|
18
|
+
*
|
|
19
|
+
* @throws exception if impersonation failed
|
|
20
|
+
*/
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default new ImpersonateApi('default');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type IImpersonate = {
|
|
2
|
+
impersonatedUserId: string;
|
|
3
|
+
actorToken: string;
|
|
4
|
+
redirectUrl?: string;
|
|
5
|
+
};
|
|
6
|
+
export type IImpersonateResponse = {
|
|
7
|
+
accessToken: string;
|
|
8
|
+
tokenType: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
expiresIn: number;
|
|
11
|
+
expires: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|