@frontegg/rest-api 3.1.65 → 3.1.66

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.
@@ -1,4 +1,4 @@
1
- import { IUserApplicationsIdPayload, IUserApplicationsDataPayload, IApplicationsResponse, IAssignUserToApplicationsBody, IUsersApplicationsIdPayload } from "./interfaces";
1
+ import { IUserApplicationsIdPayload, IUserApplicationsDataPayload, IApplicationsResponse, IAssignUserToApplicationsBody, IUsersApplicationsIdPayload, IUsersOfApplicationsResponse, ITenantApplicationsResponse, IGetUsersOfApplicationsQuery } from "./interfaces";
2
2
  /**
3
3
  * Get applications id array for single user by user id
4
4
  * @param userId - user id to find his applications id array
@@ -11,12 +11,17 @@ export declare function getUserApplicationsId({ userId }: IUserApplicationsIdPay
11
11
  * @returns object that maps every user id to his applications id array
12
12
  */
13
13
  export declare function getUsersApplicationsId({ userIds }: IUsersApplicationsIdPayload): Promise<Record<string, string[]>>;
14
+ /**
15
+ * Get applications data array for specific tenant
16
+ * @returns array of object with tenant id and his applications id array
17
+ */
18
+ export declare function getTenantsApplications(): Promise<ITenantApplicationsResponse[]>;
14
19
  /**
15
20
  * Get applications data by array of application ids
16
21
  * @param appIds - array of application ids
17
- * @returns IApplicationsResponse
22
+ * @returns array of application data
18
23
  */
19
- export declare function getUserApplicationsData({ appIds }: IUserApplicationsDataPayload): Promise<IApplicationsResponse>;
24
+ export declare function getApplicationsData({ appIds, includeFreeAccess }: IUserApplicationsDataPayload): Promise<IApplicationsResponse[]>;
20
25
  /**
21
26
  * Assign user to multiple applications
22
27
  * @param appIds - string[]
@@ -25,3 +30,17 @@ export declare function getUserApplicationsData({ appIds }: IUserApplicationsDat
25
30
  * @returns void
26
31
  */
27
32
  export declare function assignUserToApplications(body: IAssignUserToApplicationsBody): Promise<void>;
33
+ /**
34
+ * Unassign user from multiple applications
35
+ * @param appIds - string[]
36
+ * @param tenantId - string
37
+ * @param userId - string
38
+ * @returns void
39
+ */
40
+ export declare function unassignUserFromApplications(body: IAssignUserToApplicationsBody): Promise<void>;
41
+ /**
42
+ * Get users array for each application for array of applications
43
+ * @param appIds - array of applications
44
+ * @returns array of objects with application id and his users array
45
+ */
46
+ export declare function getUsersOfApplications(query: IGetUsersOfApplicationsQuery): Promise<IUsersOfApplicationsResponse[]>;
@@ -1,5 +1,5 @@
1
1
  import { urls } from "../constants";
2
- import { Post, Get } from "../fetch";
2
+ import { Post, Get, Delete } from "../fetch";
3
3
  export async function getUserApplicationsId({
4
4
  userId
5
5
  }) {
@@ -12,13 +12,24 @@ export async function getUsersApplicationsId({
12
12
  userIds: userIds.join(',')
13
13
  });
14
14
  }
15
- export async function getUserApplicationsData({
16
- appIds
15
+ export async function getTenantsApplications() {
16
+ return Get(urls.applications.tenant.v1);
17
+ }
18
+ export async function getApplicationsData({
19
+ appIds,
20
+ includeFreeAccess = true
17
21
  }) {
18
22
  return Get(urls.applications.v1, {
19
- ids: appIds.join(',')
23
+ ids: appIds.join(','),
24
+ _includeFreeAccess: includeFreeAccess
20
25
  });
21
26
  }
22
27
  export async function assignUserToApplications(body) {
23
28
  return Post(`${urls.identity.applications.v1}/user-apps`, body);
29
+ }
30
+ export async function unassignUserFromApplications(body) {
31
+ return Delete(`${urls.identity.applications.v1}/user-apps`, body);
32
+ }
33
+ export async function getUsersOfApplications(query) {
34
+ return Get(`${urls.identity.applications.v1}/apps-users`, query);
24
35
  }
@@ -4,9 +4,16 @@ export declare type IUserApplicationsIdPayload = {
4
4
  export declare type IUsersApplicationsIdPayload = {
5
5
  userIds: string[];
6
6
  };
7
- export declare type IUserApplicationsDataPayload = {
7
+ export declare type IGetUsersOfApplicationsQuery = {
8
8
  appIds: string[];
9
9
  };
10
+ export declare type IUserApplicationsDataPayload = IGetUsersOfApplicationsQuery & {
11
+ includeFreeAccess?: boolean;
12
+ };
13
+ export declare type IUsersOfApplicationsResponse = {
14
+ appId: string;
15
+ userIds: string[];
16
+ };
10
17
  export declare type IAssignUserToApplicationsBody = {
11
18
  userId: string;
12
19
  tenantId: string;
@@ -32,3 +39,7 @@ export declare type IApplicationsResponse = {
32
39
  description: string;
33
40
  integrationFinishedAt: string;
34
41
  };
42
+ export declare type ITenantApplicationsResponse = {
43
+ tenantId: string;
44
+ appIds?: string[];
45
+ };
package/constants.d.ts CHANGED
@@ -271,6 +271,9 @@ export declare const urls: {
271
271
  };
272
272
  applications: {
273
273
  v1: string;
274
+ tenant: {
275
+ v1: string;
276
+ };
274
277
  };
275
278
  };
276
279
  export declare const GENERIC_ERROR_MESSAGE = "We're facing some difficulties, Please try again";
package/constants.js CHANGED
@@ -270,7 +270,10 @@ export const urls = {
270
270
  }
271
271
  },
272
272
  applications: {
273
- v1: '/applications/resources/applications/v1'
273
+ v1: '/applications/resources/applications/v1',
274
+ tenant: {
275
+ v1: '/applications/resources/applications/tenant-assignments/v1'
276
+ }
274
277
  }
275
278
  };
276
279
  export const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.65
1
+ /** @license Frontegg v3.1.66
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.assignUserToApplications = assignUserToApplications;
7
- exports.getUserApplicationsData = getUserApplicationsData;
7
+ exports.getApplicationsData = getApplicationsData;
8
+ exports.getTenantsApplications = getTenantsApplications;
8
9
  exports.getUserApplicationsId = getUserApplicationsId;
9
10
  exports.getUsersApplicationsId = getUsersApplicationsId;
11
+ exports.getUsersOfApplications = getUsersOfApplications;
12
+ exports.unassignUserFromApplications = unassignUserFromApplications;
10
13
 
11
14
  var _constants = require("../constants");
12
15
 
@@ -26,14 +29,28 @@ async function getUsersApplicationsId({
26
29
  });
27
30
  }
28
31
 
29
- async function getUserApplicationsData({
30
- appIds
32
+ async function getTenantsApplications() {
33
+ return (0, _fetch.Get)(_constants.urls.applications.tenant.v1);
34
+ }
35
+
36
+ async function getApplicationsData({
37
+ appIds,
38
+ includeFreeAccess = true
31
39
  }) {
32
40
  return (0, _fetch.Get)(_constants.urls.applications.v1, {
33
- ids: appIds.join(',')
41
+ ids: appIds.join(','),
42
+ _includeFreeAccess: includeFreeAccess
34
43
  });
35
44
  }
36
45
 
37
46
  async function assignUserToApplications(body) {
38
47
  return (0, _fetch.Post)(`${_constants.urls.identity.applications.v1}/user-apps`, body);
48
+ }
49
+
50
+ async function unassignUserFromApplications(body) {
51
+ return (0, _fetch.Delete)(`${_constants.urls.identity.applications.v1}/user-apps`, body);
52
+ }
53
+
54
+ async function getUsersOfApplications(query) {
55
+ return (0, _fetch.Get)(`${_constants.urls.identity.applications.v1}/apps-users`, query);
39
56
  }
package/node/constants.js CHANGED
@@ -276,7 +276,10 @@ const urls = {
276
276
  }
277
277
  },
278
278
  applications: {
279
- v1: '/applications/resources/applications/v1'
279
+ v1: '/applications/resources/applications/v1',
280
+ tenant: {
281
+ v1: '/applications/resources/applications/tenant-assignments/v1'
282
+ }
280
283
  }
281
284
  };
282
285
  exports.urls = urls;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.65
1
+ /** @license Frontegg v3.1.66
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.1.65",
3
+ "version": "3.1.66",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {