@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.
Files changed (218) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +30 -0
  3. package/ContextHolder/index.d.ts +160 -0
  4. package/ContextHolder/index.js +278 -0
  5. package/ContextHolder/package.json +6 -0
  6. package/FetchClient.d.ts +42 -0
  7. package/FetchClient.js +260 -0
  8. package/account-settings/index.d.ts +21 -7
  9. package/account-settings/index.js +25 -6
  10. package/account-settings/interfaces.d.ts +9 -2
  11. package/applications/index.d.ts +51 -0
  12. package/applications/index.js +55 -0
  13. package/applications/interfaces.d.ts +49 -0
  14. package/applications/interfaces.js +5 -0
  15. package/applications/package.json +6 -0
  16. package/audits/index.d.ts +27 -15
  17. package/audits/index.js +29 -16
  18. package/audits/interfaces.d.ts +3 -2
  19. package/auth/constants.d.ts +5 -0
  20. package/auth/constants.js +5 -0
  21. package/auth/enums.d.ts +8 -1
  22. package/auth/enums.js +9 -4
  23. package/auth/index.d.ts +833 -428
  24. package/auth/index.js +768 -385
  25. package/auth/interfaces.d.ts +341 -39
  26. package/auth/interfaces.js +19 -9
  27. package/auth/secutiry-poilicy/index.d.ts +60 -41
  28. package/auth/secutiry-poilicy/index.js +99 -45
  29. package/auth/secutiry-poilicy/interfaces.d.ts +62 -2
  30. package/auth/secutiry-poilicy/interfaces.js +5 -1
  31. package/auth/utils.d.ts +10 -0
  32. package/auth/utils.js +35 -0
  33. package/connectivity/index.d.ts +126 -27
  34. package/connectivity/index.js +120 -114
  35. package/constants.d.ts +115 -0
  36. package/constants.js +122 -5
  37. package/directory/index.d.ts +32 -0
  38. package/directory/index.js +30 -0
  39. package/directory/interfaces.d.ts +30 -0
  40. package/directory/interfaces.js +7 -0
  41. package/directory/package.json +6 -0
  42. package/entitlements/index.d.ts +15 -0
  43. package/entitlements/index.js +20 -0
  44. package/entitlements/interfaces.d.ts +13 -0
  45. package/entitlements/interfaces.js +11 -0
  46. package/entitlements/package.json +6 -0
  47. package/error.js +0 -2
  48. package/feature-flags/index.d.ts +18 -0
  49. package/feature-flags/index.js +44 -0
  50. package/feature-flags/interfaces.d.ts +5 -0
  51. package/feature-flags/interfaces.js +1 -0
  52. package/feature-flags/package.json +6 -0
  53. package/groups/enums.d.ts +9 -0
  54. package/groups/enums.js +11 -0
  55. package/groups/index.d.ts +73 -0
  56. package/groups/index.js +62 -0
  57. package/groups/interfaces.d.ts +64 -0
  58. package/groups/interfaces.js +1 -0
  59. package/groups/package.json +6 -0
  60. package/impersonate/index.d.ts +17 -0
  61. package/impersonate/index.js +23 -0
  62. package/impersonate/interfaces.d.ts +12 -0
  63. package/impersonate/interfaces.js +1 -0
  64. package/impersonate/package.json +6 -0
  65. package/index.d.ts +148 -53
  66. package/index.js +103 -31
  67. package/interfaces.d.ts +82 -1
  68. package/interfaces.js +28 -1
  69. package/jwt.js +19 -20
  70. package/metadata/index.d.ts +68 -5
  71. package/metadata/index.js +53 -23
  72. package/metadata/interfaces.d.ts +10 -2
  73. package/node/BaseApiClient.js +37 -0
  74. package/node/ContextHolder/index.js +286 -0
  75. package/node/FetchClient.js +268 -0
  76. package/node/account-settings/index.js +26 -11
  77. package/node/applications/index.js +62 -0
  78. package/node/applications/interfaces.js +12 -0
  79. package/node/audits/index.js +32 -27
  80. package/node/auth/constants.js +13 -0
  81. package/node/auth/enums.js +11 -5
  82. package/node/auth/index.js +807 -644
  83. package/node/auth/interfaces.js +27 -13
  84. package/node/auth/secutiry-poilicy/index.js +100 -66
  85. package/node/auth/secutiry-poilicy/interfaces.js +8 -1
  86. package/node/auth/utils.js +44 -0
  87. package/node/connectivity/index.js +123 -197
  88. package/node/constants.js +124 -6
  89. package/node/directory/index.js +37 -0
  90. package/node/directory/interfaces.js +14 -0
  91. package/node/entitlements/index.js +27 -0
  92. package/node/entitlements/interfaces.js +18 -0
  93. package/node/error.js +0 -4
  94. package/node/feature-flags/index.js +54 -0
  95. package/node/feature-flags/interfaces.js +5 -0
  96. package/node/groups/enums.js +19 -0
  97. package/node/groups/index.js +70 -0
  98. package/node/groups/interfaces.js +5 -0
  99. package/node/impersonate/index.js +29 -0
  100. package/node/impersonate/interfaces.js +5 -0
  101. package/node/index.js +324 -94
  102. package/node/interfaces.js +34 -1
  103. package/node/jwt.js +19 -25
  104. package/node/metadata/index.js +57 -38
  105. package/node/notifications/index.js +34 -31
  106. package/node/reports/index.js +79 -83
  107. package/node/roles/index.js +55 -60
  108. package/node/roles/interfaces.js +9 -1
  109. package/node/routers.js +52 -6
  110. package/node/security-center/index.js +26 -0
  111. package/node/security-center/interfaces.js +74 -0
  112. package/node/sub-tenants/index.js +82 -29
  113. package/node/sub-tenants/interfaces.js +9 -1
  114. package/node/subscriptions/enums.js +13 -9
  115. package/node/subscriptions/index.js +64 -109
  116. package/node/subscriptions/interfaces.js +0 -2
  117. package/node/subscriptions/invoices.js +20 -21
  118. package/node/subscriptions/managedSubscriptions.js +28 -33
  119. package/node/subscriptions/paymentMethods.js +23 -27
  120. package/node/subscriptions/paymentProviders.js +11 -8
  121. package/node/subscriptions/plans.js +13 -12
  122. package/node/subscriptions/providers/stripe/index.js +22 -27
  123. package/node/subscriptions/subscriptions.js +28 -33
  124. package/node/subscriptions/summaries.js +11 -8
  125. package/node/subscriptions/tenantConfiguration.js +13 -12
  126. package/node/subscriptions/vendorPublicConfigurations.js +17 -0
  127. package/node/teams/index.js +108 -121
  128. package/node/teams/interfaces.js +8 -1
  129. package/node/tenants/index.js +63 -21
  130. package/node/tenants/interfaces.js +18 -1
  131. package/node/user-phone-numbers/index.js +38 -0
  132. package/node/user-phone-numbers/interfaces.js +5 -0
  133. package/node/users/index.js +64 -0
  134. package/node/users/interfaces.js +27 -0
  135. package/node/velo/index.js +75 -0
  136. package/node/velo/interfaces.js +5 -0
  137. package/node/vendor/index.js +16 -8
  138. package/notifications/index.d.ts +22 -16
  139. package/notifications/index.js +33 -22
  140. package/package.json +4 -2
  141. package/reports/index.d.ts +50 -44
  142. package/reports/index.js +77 -68
  143. package/reports/interfaces.d.ts +2 -2
  144. package/roles/index.d.ts +45 -34
  145. package/roles/index.js +52 -41
  146. package/roles/interfaces.d.ts +25 -9
  147. package/roles/interfaces.js +6 -1
  148. package/routers.d.ts +6 -1
  149. package/routers.js +45 -2
  150. package/security-center/index.d.ts +15 -0
  151. package/security-center/index.js +19 -0
  152. package/security-center/interfaces.d.ts +115 -0
  153. package/security-center/interfaces.js +63 -0
  154. package/security-center/package.json +6 -0
  155. package/sub-tenants/index.d.ts +57 -8
  156. package/sub-tenants/index.js +84 -19
  157. package/sub-tenants/interfaces.d.ts +68 -10
  158. package/sub-tenants/interfaces.js +6 -1
  159. package/subscriptions/enums.d.ts +7 -0
  160. package/subscriptions/enums.js +10 -8
  161. package/subscriptions/index.d.ts +55 -9
  162. package/subscriptions/index.js +56 -9
  163. package/subscriptions/interfaces.d.ts +7 -3
  164. package/subscriptions/interfaces.js +1 -1
  165. package/subscriptions/invoices.d.ts +16 -13
  166. package/subscriptions/invoices.js +19 -14
  167. package/subscriptions/managedSubscriptions.d.ts +18 -15
  168. package/subscriptions/managedSubscriptions.js +27 -22
  169. package/subscriptions/paymentMethods.d.ts +16 -13
  170. package/subscriptions/paymentMethods.js +22 -18
  171. package/subscriptions/paymentProviders.d.ts +8 -5
  172. package/subscriptions/paymentProviders.js +9 -4
  173. package/subscriptions/plans.d.ts +11 -8
  174. package/subscriptions/plans.js +11 -6
  175. package/subscriptions/providers/stripe/index.d.ts +24 -21
  176. package/subscriptions/providers/stripe/index.js +21 -16
  177. package/subscriptions/subscriptions.d.ts +24 -21
  178. package/subscriptions/subscriptions.js +27 -22
  179. package/subscriptions/summaries.d.ts +7 -4
  180. package/subscriptions/summaries.js +8 -3
  181. package/subscriptions/tenantConfiguration.d.ts +6 -3
  182. package/subscriptions/tenantConfiguration.js +12 -7
  183. package/subscriptions/vendorPublicConfigurations.d.ts +5 -0
  184. package/subscriptions/vendorPublicConfigurations.js +10 -0
  185. package/teams/index.d.ts +38 -115
  186. package/teams/index.js +105 -79
  187. package/teams/interfaces.d.ts +47 -42
  188. package/teams/interfaces.js +5 -1
  189. package/tenants/index.d.ts +25 -26
  190. package/tenants/index.js +61 -12
  191. package/tenants/interfaces.d.ts +85 -0
  192. package/tenants/interfaces.js +14 -1
  193. package/user-phone-numbers/index.d.ts +32 -0
  194. package/user-phone-numbers/index.js +31 -0
  195. package/user-phone-numbers/interfaces.d.ts +32 -0
  196. package/user-phone-numbers/interfaces.js +1 -0
  197. package/user-phone-numbers/package.json +6 -0
  198. package/users/index.d.ts +24 -0
  199. package/users/index.js +55 -0
  200. package/users/interfaces.d.ts +144 -0
  201. package/users/interfaces.js +18 -0
  202. package/users/package.json +6 -0
  203. package/velo/index.d.ts +46 -0
  204. package/velo/index.js +68 -0
  205. package/velo/interfaces.d.ts +108 -0
  206. package/velo/interfaces.js +1 -0
  207. package/velo/package.json +6 -0
  208. package/vendor/index.d.ts +12 -6
  209. package/vendor/index.js +15 -4
  210. package/ContextHolder.d.ts +0 -29
  211. package/ContextHolder.js +0 -80
  212. package/fetch.d.ts +0 -19
  213. package/fetch.js +0 -203
  214. package/node/ContextHolder.js +0 -90
  215. package/node/fetch.js +0 -234
  216. package/node/subscriptions/providers/index.js +0 -18
  217. package/subscriptions/providers/index.d.ts +0 -1
  218. 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,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/directory/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -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';
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/entitlements/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/error.js CHANGED
@@ -4,9 +4,7 @@ export class FronteggApiError extends Error {
4
4
  this._statusCode = void 0;
5
5
  this._statusCode = statusCode;
6
6
  }
7
-
8
7
  get statusCode() {
9
8
  return this._statusCode;
10
9
  }
11
-
12
10
  }
@@ -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,5 @@
1
+ export type IFeatureFlagsAttribute = 'on' | 'off';
2
+ export type IFeatureFlagsAttributes = Record<string, IFeatureFlagsAttribute>;
3
+ export type FronteggFeatureFlags = {
4
+ flags?: IFeatureFlagsAttributes;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/feature-flags/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum GroupRelations {
2
+ roles = "roles",
3
+ users = "users",
4
+ rolesAndUsers = "rolesAndUsers"
5
+ }
6
+ export declare enum GroupManagedByEnum {
7
+ FRONTEGG = "frontegg",
8
+ SCIM2 = "scim2"
9
+ }
@@ -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;
@@ -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,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/groups/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -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 {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/impersonate/index.js",
5
+ "types": "./index.d.ts"
6
+ }