@frontegg/rest-api 3.1.74 → 3.1.76-alpha.9502349697
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 +39 -0
- package/ContextHolder/index.d.ts +108 -27
- package/ContextHolder/index.js +155 -50
- package/FetchClient.d.ts +42 -0
- package/FetchClient.js +308 -0
- package/account-settings/index.d.ts +19 -7
- package/account-settings/index.js +23 -13
- package/applications/index.d.ts +49 -44
- package/applications/index.js +51 -37
- package/audits/index.d.ts +27 -15
- package/audits/index.js +27 -17
- package/auth/index.d.ts +817 -768
- package/auth/index.js +902 -721
- package/auth/secutiry-poilicy/index.d.ts +58 -102
- package/auth/secutiry-poilicy/index.js +122 -90
- package/auth/utils.d.ts +2 -2
- package/auth/utils.js +9 -8
- package/connectivity/index.d.ts +126 -27
- package/connectivity/index.js +147 -114
- package/directory/index.d.ts +31 -22
- package/directory/index.js +27 -15
- package/entitlements/index.d.ts +14 -8
- package/entitlements/index.js +12 -4
- package/feature-flags/index.d.ts +8 -2
- package/feature-flags/index.js +16 -8
- package/groups/index.d.ts +73 -49
- package/groups/index.js +64 -45
- package/impersonate/index.d.ts +15 -6
- package/impersonate/index.js +13 -5
- package/index.d.ts +154 -108
- package/index.js +109 -78
- package/interfaces.d.ts +10 -0
- package/metadata/index.d.ts +67 -7
- package/metadata/index.js +52 -32
- package/node/BaseApiClient.js +49 -0
- package/node/ContextHolder/index.js +155 -50
- package/node/FetchClient.js +326 -0
- package/node/account-settings/index.js +27 -16
- package/node/applications/index.js +51 -44
- package/node/audits/index.js +31 -20
- package/node/auth/index.js +768 -1035
- package/node/auth/secutiry-poilicy/index.js +125 -136
- package/node/auth/utils.js +9 -7
- package/node/connectivity/index.js +148 -187
- package/node/directory/index.js +29 -20
- package/node/entitlements/index.js +18 -5
- package/node/feature-flags/index.js +21 -9
- package/node/groups/index.js +65 -63
- package/node/impersonate/index.js +18 -5
- package/node/index.js +116 -71
- package/node/metadata/index.js +61 -52
- package/node/notifications/index.js +37 -27
- package/node/reports/index.js +78 -70
- package/node/roles/index.js +56 -51
- package/node/security-center/index.js +21 -9
- package/node/sub-tenants/index.js +90 -89
- package/node/subscriptions/index.js +69 -107
- package/node/subscriptions/invoices.js +25 -17
- package/node/subscriptions/managedSubscriptions.js +32 -27
- package/node/subscriptions/paymentMethods.js +27 -20
- package/node/subscriptions/paymentProviders.js +15 -6
- package/node/subscriptions/plans.js +17 -9
- package/node/subscriptions/providers/stripe/index.js +26 -21
- package/node/subscriptions/subscriptions.js +32 -27
- package/node/subscriptions/summaries.js +15 -6
- package/node/subscriptions/tenantConfiguration.js +17 -9
- package/node/subscriptions/vendorPublicConfigurations.js +15 -6
- package/node/teams/index.js +130 -138
- package/node/tenants/index.js +65 -60
- package/node/user-phone-numbers/index.js +32 -24
- package/node/users/index.js +58 -53
- package/node/vendor/index.js +17 -6
- package/notifications/index.d.ts +22 -16
- package/notifications/index.js +33 -22
- package/package.json +1 -1
- package/reports/index.d.ts +50 -44
- package/reports/index.js +75 -62
- package/roles/index.d.ts +44 -38
- package/roles/index.js +57 -41
- package/security-center/index.d.ts +14 -2
- package/security-center/index.js +15 -6
- package/sub-tenants/index.d.ts +57 -15
- package/sub-tenants/index.js +88 -68
- package/subscriptions/index.d.ts +56 -11
- package/subscriptions/index.js +58 -11
- package/subscriptions/invoices.d.ts +16 -13
- package/subscriptions/invoices.js +24 -14
- package/subscriptions/managedSubscriptions.d.ts +18 -15
- package/subscriptions/managedSubscriptions.js +33 -22
- package/subscriptions/paymentMethods.d.ts +16 -13
- package/subscriptions/paymentMethods.js +26 -17
- package/subscriptions/paymentProviders.d.ts +8 -5
- package/subscriptions/paymentProviders.js +11 -4
- package/subscriptions/plans.d.ts +11 -8
- package/subscriptions/plans.js +14 -6
- package/subscriptions/providers/stripe/index.d.ts +24 -21
- package/subscriptions/providers/stripe/index.js +27 -16
- package/subscriptions/subscriptions.d.ts +24 -21
- package/subscriptions/subscriptions.js +33 -22
- package/subscriptions/summaries.d.ts +7 -4
- package/subscriptions/summaries.js +10 -3
- package/subscriptions/tenantConfiguration.d.ts +6 -3
- package/subscriptions/tenantConfiguration.js +15 -7
- package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
- package/subscriptions/vendorPublicConfigurations.js +11 -4
- package/teams/index.d.ts +35 -131
- package/teams/index.js +122 -93
- package/tenants/index.d.ts +25 -37
- package/tenants/index.js +62 -46
- package/tenants/interfaces.d.ts +2 -0
- package/user-phone-numbers/index.d.ts +32 -26
- package/user-phone-numbers/index.js +32 -19
- package/users/index.d.ts +21 -15
- package/users/index.js +60 -44
- package/vendor/index.d.ts +12 -6
- package/vendor/index.js +11 -4
- package/fetch.d.ts +0 -24
- package/fetch.js +0 -265
- package/node/fetch.js +0 -306
- package/node/subscriptions/providers/index.js +0 -18
- package/subscriptions/providers/index.d.ts +0 -1
- package/subscriptions/providers/index.js +0 -1
package/teams/index.d.ts
CHANGED
|
@@ -1,133 +1,37 @@
|
|
|
1
1
|
import { IAddUser, IChangePassword, ILoadUsers, IResendActivationLink, ITeamUserRole, ITeamStats, ITeamUser, IUpdateProfile, IUpdateUser, IDeleteUser, ITeamUserPermission, IResendInvitationLink, IInviteUserLinkResponse, ICreateOrUpdateInviteUserLink, IInviteLinkConfiguration, IUpdateUserExpiration, ITemporaryUserConfiguration } from './interfaces';
|
|
2
2
|
import { PaginationResult } from '../interfaces';
|
|
3
|
-
import { IUserProfile } from
|
|
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
|
-
* ``authorized user``
|
|
40
|
-
*/
|
|
41
|
-
export declare function loadUsers(params: ILoadUsers): Promise<PaginationResult<ITeamUser>>;
|
|
42
|
-
/**
|
|
43
|
-
* add user to team, invitation link will be sent to the added user.
|
|
44
|
-
*
|
|
45
|
-
* ``authorized user``
|
|
46
|
-
*/
|
|
47
|
-
export declare function addUser(body: IAddUser): Promise<ITeamUser>;
|
|
48
|
-
/**
|
|
49
|
-
* delete user from team, user will be deleted.
|
|
50
|
-
*
|
|
51
|
-
* ``authorized user``
|
|
52
|
-
*/
|
|
53
|
-
export declare function deleteUser(body: IDeleteUser): Promise<ITeamUser>;
|
|
54
|
-
/**
|
|
55
|
-
* edit user roles in team
|
|
56
|
-
*
|
|
57
|
-
* ``authorized user``
|
|
58
|
-
*/
|
|
59
|
-
export declare function updateUser(body: IUpdateUser): Promise<ITeamUser>;
|
|
60
|
-
/**
|
|
61
|
-
* update user expiration time
|
|
62
|
-
*
|
|
63
|
-
* ``authorized user``
|
|
64
|
-
*/
|
|
65
|
-
export declare function updateUserExpirationTime(body: IUpdateUserExpiration): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* set user as permanent
|
|
68
|
-
*/
|
|
69
|
-
export declare function setPermanentUser(userId: string): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* get temporary user configuration
|
|
72
|
-
*/
|
|
73
|
-
export declare function getTemporaryUserConfiguration(): Promise<ITemporaryUserConfiguration>;
|
|
74
|
-
/**
|
|
75
|
-
* create link to invite user
|
|
76
|
-
*
|
|
77
|
-
* ``authorized user``
|
|
78
|
-
*/
|
|
79
|
-
export declare function createInviteUserLink(body: ICreateOrUpdateInviteUserLink): Promise<IInviteUserLinkResponse>;
|
|
80
|
-
/**
|
|
81
|
-
* update link to invite user
|
|
82
|
-
*
|
|
83
|
-
* ``authorized user``
|
|
84
|
-
*/
|
|
85
|
-
export declare function updateInviteUserLink(body: ICreateOrUpdateInviteUserLink): Promise<IInviteUserLinkResponse>;
|
|
86
|
-
/**
|
|
87
|
-
* delete link to invite user
|
|
88
|
-
*
|
|
89
|
-
* ``authorized user``
|
|
90
|
-
*/
|
|
91
|
-
export declare function deleteInviteUserLink(): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* get link to invite user
|
|
94
|
-
*
|
|
95
|
-
* ``authorized user``
|
|
96
|
-
*/
|
|
97
|
-
export declare function getInviteUserLink(): Promise<IInviteUserLinkResponse>;
|
|
98
|
-
/**
|
|
99
|
-
* get invite link configuration
|
|
100
|
-
*
|
|
101
|
-
*/
|
|
102
|
-
export declare function getInviteLinkConfiguration(): Promise<IInviteLinkConfiguration>;
|
|
103
|
-
/**
|
|
104
|
-
* load available roles that can be assigned to team users from team-management-service
|
|
105
|
-
*
|
|
106
|
-
* ``authorized user``
|
|
107
|
-
*/
|
|
108
|
-
export declare function loadAvailableRoles(): Promise<ITeamUserRole[]>;
|
|
109
|
-
export declare function loadAvailablePermissions(): Promise<ITeamUserPermission[]>;
|
|
110
|
-
/**
|
|
111
|
-
* load users stats from team-management-service
|
|
112
|
-
*
|
|
113
|
-
* ``authorized user``
|
|
114
|
-
*/
|
|
115
|
-
export declare function loadStats(): Promise<ITeamStats>;
|
|
116
|
-
/**
|
|
117
|
-
* resend activation link to specific user
|
|
118
|
-
*
|
|
119
|
-
* ``authorized user``
|
|
120
|
-
*/
|
|
121
|
-
export declare function resendActivationLink(body: IResendActivationLink): Promise<void>;
|
|
122
|
-
/**
|
|
123
|
-
* resend accept join tenant invitation link to specific user
|
|
124
|
-
*
|
|
125
|
-
* ``authorized user``
|
|
126
|
-
*/
|
|
127
|
-
export declare function resendInvitationLink(body: IResendInvitationLink): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* resend accept join all pending tenant for current hierarchy invitation link to specific user
|
|
130
|
-
*
|
|
131
|
-
* ``authorized user``
|
|
132
|
-
*/
|
|
133
|
-
export declare function resendInvitationLinkToAllTenants(body: IResendInvitationLink): Promise<void>;
|
|
3
|
+
import { IUserProfile } from '../users/interfaces';
|
|
4
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
5
|
+
export declare class TeamsApi extends BaseApiClient {
|
|
6
|
+
constructor(appName: string);
|
|
7
|
+
getProfile: (params?: object | undefined) => Promise<IUserProfile>;
|
|
8
|
+
updateProfile: (body: Partial<IUpdateProfile>) => Promise<IUserProfile>;
|
|
9
|
+
updateProfileImage: (body: FormData) => Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* change user password by providing current password and the new password.
|
|
12
|
+
*
|
|
13
|
+
* @throws exception if the current password incorrect or new password validation failed.
|
|
14
|
+
* ``authorized user``
|
|
15
|
+
*/
|
|
16
|
+
changePassword: (body: IChangePassword) => Promise<void>;
|
|
17
|
+
loadUsers: (params: ILoadUsers) => Promise<PaginationResult<ITeamUser>>;
|
|
18
|
+
addUser: (body: IAddUser) => Promise<ITeamUser>;
|
|
19
|
+
deleteUser: (body: IDeleteUser) => Promise<ITeamUser>;
|
|
20
|
+
updateUser: (body: IUpdateUser) => Promise<ITeamUser>;
|
|
21
|
+
updateUserExpirationTime: (body: IUpdateUserExpiration) => Promise<void>;
|
|
22
|
+
setPermanentUser: (userId: string) => Promise<void>;
|
|
23
|
+
getTemporaryUserConfiguration: () => Promise<ITemporaryUserConfiguration>;
|
|
24
|
+
createInviteUserLink: (body: ICreateOrUpdateInviteUserLink) => Promise<IInviteUserLinkResponse>;
|
|
25
|
+
updateInviteUserLink: (body: ICreateOrUpdateInviteUserLink) => Promise<IInviteUserLinkResponse>;
|
|
26
|
+
deleteInviteUserLink: () => Promise<void>;
|
|
27
|
+
getInviteUserLink: () => Promise<IInviteUserLinkResponse>;
|
|
28
|
+
getInviteLinkConfiguration: () => Promise<IInviteLinkConfiguration>;
|
|
29
|
+
loadAvailableRoles: () => Promise<ITeamUserRole[]>;
|
|
30
|
+
loadAvailablePermissions: () => Promise<ITeamUserPermission[]>;
|
|
31
|
+
loadStats: () => Promise<ITeamStats>;
|
|
32
|
+
resendActivationLink: (body: IResendActivationLink) => Promise<void>;
|
|
33
|
+
resendInvitationLink: (body: IResendInvitationLink) => Promise<void>;
|
|
34
|
+
resendInvitationLinkToAllTenants: (body: IResendInvitationLink) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
declare const _default: TeamsApi;
|
|
37
|
+
export default _default;
|
package/teams/index.js
CHANGED
|
@@ -1,96 +1,125 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { Get, Post, Put, Delete, Patch } from '../fetch';
|
|
3
2
|
import { urls } from '../constants';
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
3
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
4
|
+
export class TeamsApi extends BaseApiClient {
|
|
5
|
+
constructor(appName) {
|
|
6
|
+
super(appName);
|
|
7
|
+
|
|
8
|
+
this.getProfile = async params => {
|
|
9
|
+
return this.get(`${urls.identity.users.v2}/me`, params != null ? params : {
|
|
10
|
+
addRoles: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
this.updateProfile = async body => {
|
|
15
|
+
return this.put(`${urls.identity.users.v2}/me`, body);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
this.updateProfileImage = async body => {
|
|
19
|
+
return this.put(`${urls.team.profile.v1}/me/image/v1`, body, {
|
|
20
|
+
responseType: 'plain',
|
|
21
|
+
contentType: undefined
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
this.changePassword = async body => {
|
|
26
|
+
return this.post(`${urls.identity.users.v1}/passwords/change`, body);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
this.loadUsers = async params => {
|
|
30
|
+
var _params$sort, _params$sort$0$id, _params$sort2, _params$sort2$, _params$sort3, _params$sort3$;
|
|
31
|
+
|
|
32
|
+
const filters = (params.filter || []).reduce((p, n) => _extends({}, p, {
|
|
33
|
+
[n.id]: n.value
|
|
34
|
+
}), {});
|
|
35
|
+
const sorts = (_params$sort = params.sort) != null && _params$sort.length ? {
|
|
36
|
+
sortBy: (_params$sort$0$id = (_params$sort2 = params.sort) == null ? void 0 : (_params$sort2$ = _params$sort2[0]) == null ? void 0 : _params$sort2$.id) != null ? _params$sort$0$id : 'name',
|
|
37
|
+
sortDirection: (_params$sort3 = params.sort) != null && (_params$sort3$ = _params$sort3[0]) != null && _params$sort3$.desc ? 'desc' : 'asc'
|
|
38
|
+
} : null;
|
|
39
|
+
return this.get(urls.team.members.v1, _extends({
|
|
40
|
+
pageOffset: params.pageOffset,
|
|
41
|
+
pageSize: params.pageSize
|
|
42
|
+
}, filters, sorts));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
this.addUser = async body => {
|
|
46
|
+
return this.post(urls.identity.users.v2, _extends({}, body, {
|
|
47
|
+
provider: 'local'
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.deleteUser = async body => {
|
|
52
|
+
return this.delete(`${urls.team.members.v1}/${body.userId}`);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.updateUser = async body => {
|
|
56
|
+
return this.put(urls.team.members.v1, body);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.updateUserExpirationTime = async body => {
|
|
60
|
+
const {
|
|
61
|
+
userId,
|
|
62
|
+
expirationInSeconds
|
|
63
|
+
} = body;
|
|
64
|
+
return this.put(`${urls.identity.users.temporary.v1}/${userId}`, {
|
|
65
|
+
expirationInSeconds
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
this.setPermanentUser = async userId => {
|
|
70
|
+
return this.delete(`${urls.identity.users.temporary.v1}/${userId}`);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
this.getTemporaryUserConfiguration = async () => {
|
|
74
|
+
return this.get(urls.identity.users.temporary.configuration.v1);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.createInviteUserLink = async body => {
|
|
78
|
+
return this.post(urls.identity.tenants.invites.user.v1, _extends({}, body));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
this.updateInviteUserLink = async body => {
|
|
82
|
+
return this.patch(urls.identity.tenants.invites.user.v1, _extends({}, body));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
this.deleteInviteUserLink = async () => {
|
|
86
|
+
return this.delete(urls.identity.tenants.invites.user.v1);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
this.getInviteUserLink = async () => {
|
|
90
|
+
return this.get(urls.identity.tenants.invites.user.v1);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
this.getInviteLinkConfiguration = async () => {
|
|
94
|
+
return this.get(urls.identity.tenants.invites.configuration.v1);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
this.loadAvailableRoles = async () => {
|
|
98
|
+
return this.get(urls.team.roles.v1);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
this.loadAvailablePermissions = async () => {
|
|
102
|
+
return this.get(urls.identity.permissions.v1);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
this.loadStats = async () => {
|
|
106
|
+
return this.get(`${urls.team.stats.v1}/members`);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
this.resendActivationLink = async body => {
|
|
110
|
+
return this.post(`${urls.team.members.v1}/${body.userId}/resendActivationEmail`, {});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
this.resendInvitationLink = async body => {
|
|
114
|
+
return this.post(urls.identity.users.v2, _extends({}, body, {
|
|
115
|
+
provider: 'local'
|
|
116
|
+
}));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
this.resendInvitationLinkToAllTenants = async body => {
|
|
120
|
+
return this.post(urls.identity.users.invitation.resendAll.v1, _extends({}, body));
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
93
124
|
}
|
|
94
|
-
export
|
|
95
|
-
return Post(urls.identity.users.invitation.resendAll.v1, _extends({}, body));
|
|
96
|
-
}
|
|
125
|
+
export default new TeamsApi('default');
|
package/tenants/index.d.ts
CHANGED
|
@@ -1,37 +1,25 @@
|
|
|
1
|
-
import { GetHierarchyMetadataParams, GetHierarchyMetadataResponse, IGetTenantsUserCountRequest, IGetTenantsUserCountResponse, IParentTenant, ISubTenant, ISubTenantTree, ISwitchTenant, ITenantsResponse, SearchSubTenantsParams, SearchSubTenantsResponse } from
|
|
2
|
-
import { FronteggPaginationWrapper, UserJwtOptions } from
|
|
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
|
-
export declare function getSubTenantsAsTree(options?: UserJwtOptions): Promise<ISubTenantTree>;
|
|
28
|
-
/**
|
|
29
|
-
* retrieve logged in user's available parent tenants.
|
|
30
|
-
*
|
|
31
|
-
* ``authorized user``
|
|
32
|
-
*/
|
|
33
|
-
export declare function getParentTenants(options?: UserJwtOptions): Promise<IParentTenant[]>;
|
|
34
|
-
export declare function getParentTenantsById(tenantId: string, options?: UserJwtOptions): Promise<IParentTenant[]>;
|
|
35
|
-
export declare function getTenantsUsersCount(body: IGetTenantsUserCountRequest, options?: UserJwtOptions): Promise<IGetTenantsUserCountResponse[]>;
|
|
36
|
-
export declare function searchSubTenants(params: SearchSubTenantsParams, options?: UserJwtOptions): Promise<FronteggPaginationWrapper<SearchSubTenantsResponse>>;
|
|
37
|
-
export declare function getHierarchyMetadata(params: GetHierarchyMetadataParams, options?: UserJwtOptions): Promise<GetHierarchyMetadataResponse[]>;
|
|
1
|
+
import { GetHierarchyMetadataParams, GetHierarchyMetadataResponse, IGetTenantsUserCountRequest, IGetTenantsUserCountResponse, IParentTenant, ISubTenant, ISubTenantTree, ISwitchTenant, ITenantsResponse, SearchSubTenantsParams, SearchSubTenantsResponse } from './interfaces';
|
|
2
|
+
import { FronteggPaginationWrapper, UserJwtOptions } from '../interfaces';
|
|
3
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
4
|
+
export declare class TenantsApi extends BaseApiClient {
|
|
5
|
+
constructor(appName: string);
|
|
6
|
+
/**
|
|
7
|
+
* Switch logged in user to specific tenant by providing tenantId.
|
|
8
|
+
* @throws exception if invalid tenantId.
|
|
9
|
+
*/
|
|
10
|
+
switchTenant: (body: ISwitchTenant) => Promise<void>;
|
|
11
|
+
/** Retrieve logged in user's available tenants. */
|
|
12
|
+
getTenants: () => Promise<ITenantsResponse[]>;
|
|
13
|
+
/** Retrieve logged in user's available sub tenants. */
|
|
14
|
+
getSubTenants: (options?: UserJwtOptions | undefined) => Promise<ISubTenant>;
|
|
15
|
+
/** Retrieve logged in user's available sub tenants as a tree. */
|
|
16
|
+
getSubTenantsAsTree: (options?: UserJwtOptions | undefined) => Promise<ISubTenantTree>;
|
|
17
|
+
/** Retrieve logged in user's available parent tenants. */
|
|
18
|
+
getParentTenants: (options?: UserJwtOptions | undefined) => Promise<IParentTenant[]>;
|
|
19
|
+
getParentTenantsById: (tenantId: string, options?: UserJwtOptions | undefined) => Promise<IParentTenant[]>;
|
|
20
|
+
getTenantsUsersCount: (body: IGetTenantsUserCountRequest, options?: UserJwtOptions | undefined) => Promise<IGetTenantsUserCountResponse[]>;
|
|
21
|
+
searchSubTenants: (params: SearchSubTenantsParams, options?: UserJwtOptions | undefined) => Promise<FronteggPaginationWrapper<SearchSubTenantsResponse>>;
|
|
22
|
+
getHierarchyMetadata: (params: GetHierarchyMetadataParams, options?: UserJwtOptions | undefined) => Promise<GetHierarchyMetadataResponse[]>;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: TenantsApi;
|
|
25
|
+
export default _default;
|
package/tenants/index.js
CHANGED
|
@@ -1,52 +1,68 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import {
|
|
3
|
-
import { urls } from "../constants";
|
|
2
|
+
import { urls } from '../constants';
|
|
4
3
|
import { setTabTenantInSessionStorage } from '../auth/utils';
|
|
5
4
|
import { ContextHolder } from '../ContextHolder';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
6
|
+
export class TenantsApi extends BaseApiClient {
|
|
7
|
+
constructor(appName) {
|
|
8
|
+
super(appName);
|
|
9
|
+
|
|
10
|
+
this.switchTenant = async body => {
|
|
11
|
+
if (ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
|
|
12
|
+
setTabTenantInSessionStorage(body.tenantId);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return this.put(`${urls.identity.users.v1}/tenant`, body);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
this.getTenants = async () => {
|
|
19
|
+
return this.get(`${urls.identity.users.v2}/me/tenants`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
this.getSubTenants = async options => {
|
|
23
|
+
return this.get(urls.tenants.hierarchy.v1, undefined, {
|
|
24
|
+
headers: this.extractHeadersFromOptions(options)
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
this.getSubTenantsAsTree = async options => {
|
|
29
|
+
return this.get(urls.tenants.hierarchy.tree.v1, undefined, {
|
|
30
|
+
headers: this.extractHeadersFromOptions(options)
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
this.getParentTenants = async options => {
|
|
35
|
+
return this.get(urls.tenants.hierarchy.parents.v1, undefined, {
|
|
36
|
+
headers: this.extractHeadersFromOptions(options)
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
this.getParentTenantsById = async (tenantId, options) => {
|
|
41
|
+
return this.get(`${urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
|
|
42
|
+
headers: this.extractHeadersFromOptions(options)
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
this.getTenantsUsersCount = async (body, options) => {
|
|
47
|
+
return this.post(`${urls.identity.tenants.users.v1}/count`, body, {
|
|
48
|
+
headers: this.extractHeadersFromOptions(options)
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
this.searchSubTenants = async (params, options) => {
|
|
53
|
+
return this.get(urls.tenants.hierarchy.v2, params, {
|
|
54
|
+
headers: this.extractHeadersFromOptions(options)
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
this.getHierarchyMetadata = async (params, options) => {
|
|
59
|
+
return this.get(urls.tenants.hierarchy.metadata.v2, _extends({}, params, {
|
|
60
|
+
_tenantIds: params._tenantIds.join(',')
|
|
61
|
+
}), {
|
|
62
|
+
headers: this.extractHeadersFromOptions(options)
|
|
63
|
+
});
|
|
64
|
+
};
|
|
9
65
|
}
|
|
10
66
|
|
|
11
|
-
return Put(`${urls.identity.users.v1}/tenant`, body);
|
|
12
|
-
}
|
|
13
|
-
export async function getTenants() {
|
|
14
|
-
return Get(`${urls.identity.users.v2}/me/tenants`);
|
|
15
|
-
}
|
|
16
|
-
export async function getSubTenants(options) {
|
|
17
|
-
return Get(urls.tenants.hierarchy.v1, undefined, {
|
|
18
|
-
headers: extractHeadersFromOptions(options)
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export async function getSubTenantsAsTree(options) {
|
|
22
|
-
return Get(urls.tenants.hierarchy.tree.v1, undefined, {
|
|
23
|
-
headers: extractHeadersFromOptions(options)
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
export async function getParentTenants(options) {
|
|
27
|
-
return Get(urls.tenants.hierarchy.parents.v1, undefined, {
|
|
28
|
-
headers: extractHeadersFromOptions(options)
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
export async function getParentTenantsById(tenantId, options) {
|
|
32
|
-
return Get(`${urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
|
|
33
|
-
headers: extractHeadersFromOptions(options)
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export async function getTenantsUsersCount(body, options) {
|
|
37
|
-
return Post(`${urls.identity.tenants.users.v1}/count`, body, {
|
|
38
|
-
headers: extractHeadersFromOptions(options)
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export async function searchSubTenants(params, options) {
|
|
42
|
-
return Get(urls.tenants.hierarchy.v2, params, {
|
|
43
|
-
headers: extractHeadersFromOptions(options)
|
|
44
|
-
});
|
|
45
67
|
}
|
|
46
|
-
export
|
|
47
|
-
return Get(urls.tenants.hierarchy.metadata.v2, _extends({}, params, {
|
|
48
|
-
_tenantIds: params._tenantIds.join(',')
|
|
49
|
-
}), {
|
|
50
|
-
headers: extractHeadersFromOptions(options)
|
|
51
|
-
});
|
|
52
|
-
}
|
|
68
|
+
export default new TenantsApi('default');
|
package/tenants/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PaginationOrderEnum } from "../interfaces";
|
|
2
|
+
import { SubAccountAccessTypeEnum } from "../sub-tenants/interfaces";
|
|
2
3
|
export declare enum TenantSortByEnum {
|
|
3
4
|
createdAt = "createdAt",
|
|
4
5
|
name = "name",
|
|
@@ -102,6 +103,7 @@ export interface SearchSubTenantsResponse {
|
|
|
102
103
|
createdAt: Date;
|
|
103
104
|
metadata: SearchSubTenantMetadata;
|
|
104
105
|
isReseller?: boolean;
|
|
106
|
+
subAccountAccessType?: SubAccountAccessTypeEnum;
|
|
105
107
|
}
|
|
106
108
|
export interface GetHierarchyMetadataParams {
|
|
107
109
|
_tenantIds: string[];
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import { FronteggPaginationWrapper } from
|
|
2
|
-
import { ICreatePhoneNumberResponse, IDeletePhoneNumberResponse, IGetPhoneNumbersQueryParams, IPhoneNumber, IPreVerifyPhoneNumber, IPreVerifyPhoneNumberResponse, IUpdatePhoneNumber, IVerifyPhoneNumber } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { FronteggPaginationWrapper } from '../interfaces';
|
|
2
|
+
import { ICreatePhoneNumberResponse, IDeletePhoneNumberResponse, IGetPhoneNumbersQueryParams, IPhoneNumber, IPreVerifyPhoneNumber, IPreVerifyPhoneNumberResponse, IUpdatePhoneNumber, IVerifyPhoneNumber } from './interfaces';
|
|
3
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
4
|
+
export declare class PhoneNumbersApi extends BaseApiClient {
|
|
5
|
+
constructor(appName: string);
|
|
6
|
+
/**
|
|
7
|
+
* Get phone numbers of user
|
|
8
|
+
*/
|
|
9
|
+
getUserPhoneNumbers: (queryParams: IGetPhoneNumbersQueryParams) => Promise<FronteggPaginationWrapper<IPhoneNumber>>;
|
|
10
|
+
/**
|
|
11
|
+
* Create new phone number for user, by default OTC will be sent with this request
|
|
12
|
+
*/
|
|
13
|
+
createPhoneNumber: (body: IUpdatePhoneNumber) => Promise<ICreatePhoneNumberResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Delete existing phone number for user
|
|
16
|
+
*/
|
|
17
|
+
deletePhoneNumber: (phoneId: string) => Promise<IDeletePhoneNumberResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Pre verify phone number, used before verify to send OTC to user
|
|
20
|
+
*/
|
|
21
|
+
preVerifyPhoneNumber: (body: IPreVerifyPhoneNumber) => Promise<IPreVerifyPhoneNumberResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Verify phone number
|
|
24
|
+
*/
|
|
25
|
+
verifyPhoneNumber: (body: IVerifyPhoneNumber) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Verify delete phone number
|
|
28
|
+
*/
|
|
29
|
+
verifyDeletePhoneNumber: (phoneId: string, body: IVerifyPhoneNumber) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
declare const _default: PhoneNumbersApi;
|
|
32
|
+
export default _default;
|