@frontegg/rest-api 3.1.64 → 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.
@@ -0,0 +1,46 @@
1
+ import { IUserApplicationsIdPayload, IUserApplicationsDataPayload, IApplicationsResponse, IAssignUserToApplicationsBody, IUsersApplicationsIdPayload, IUsersOfApplicationsResponse, ITenantApplicationsResponse, IGetUsersOfApplicationsQuery } from "./interfaces";
2
+ /**
3
+ * Get applications id array for single user by user id
4
+ * @param userId - user id to find his applications id array
5
+ * @returns all app ids as string[]
6
+ */
7
+ export declare function getUserApplicationsId({ userId }: IUserApplicationsIdPayload): Promise<string[]>;
8
+ /**
9
+ * Get applications id array for multiple users by user id array
10
+ * @param userIds - array of all user id's
11
+ * @returns object that maps every user id to his applications id array
12
+ */
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[]>;
19
+ /**
20
+ * Get applications data by array of application ids
21
+ * @param appIds - array of application ids
22
+ * @returns array of application data
23
+ */
24
+ export declare function getApplicationsData({ appIds, includeFreeAccess }: IUserApplicationsDataPayload): Promise<IApplicationsResponse[]>;
25
+ /**
26
+ * Assign user to multiple applications
27
+ * @param appIds - string[]
28
+ * @param tenantId - string
29
+ * @param userId - string
30
+ * @returns void
31
+ */
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[]>;
@@ -0,0 +1,35 @@
1
+ import { urls } from "../constants";
2
+ import { Post, Get, Delete } from "../fetch";
3
+ export async function getUserApplicationsId({
4
+ userId
5
+ }) {
6
+ return Get(`${urls.identity.applications.v1}/${userId}/apps`);
7
+ }
8
+ export async function getUsersApplicationsId({
9
+ userIds
10
+ }) {
11
+ return Get(`${urls.identity.applications.v1}/users-apps`, {
12
+ userIds: userIds.join(',')
13
+ });
14
+ }
15
+ export async function getTenantsApplications() {
16
+ return Get(urls.applications.tenant.v1);
17
+ }
18
+ export async function getApplicationsData({
19
+ appIds,
20
+ includeFreeAccess = true
21
+ }) {
22
+ return Get(urls.applications.v1, {
23
+ ids: appIds.join(','),
24
+ _includeFreeAccess: includeFreeAccess
25
+ });
26
+ }
27
+ export async function assignUserToApplications(body) {
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);
35
+ }
@@ -0,0 +1,45 @@
1
+ export declare type IUserApplicationsIdPayload = {
2
+ userId: string;
3
+ };
4
+ export declare type IUsersApplicationsIdPayload = {
5
+ userIds: string[];
6
+ };
7
+ export declare type IGetUsersOfApplicationsQuery = {
8
+ appIds: string[];
9
+ };
10
+ export declare type IUserApplicationsDataPayload = IGetUsersOfApplicationsQuery & {
11
+ includeFreeAccess?: boolean;
12
+ };
13
+ export declare type IUsersOfApplicationsResponse = {
14
+ appId: string;
15
+ userIds: string[];
16
+ };
17
+ export declare type IAssignUserToApplicationsBody = {
18
+ userId: string;
19
+ tenantId: string;
20
+ appIds: string[];
21
+ };
22
+ export declare enum ApplicationAccessType {
23
+ FREE_ACCESS = "FREE_ACCESS",
24
+ MANAGED_ACCESS = "MANAGED_ACCESS"
25
+ }
26
+ export declare type IApplicationsResponse = {
27
+ id: string;
28
+ accessType: ApplicationAccessType;
29
+ appURL: string;
30
+ loginURL: string;
31
+ isDefault: boolean;
32
+ isActive: boolean;
33
+ name: string;
34
+ logoURL: string;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ type: string;
38
+ frontendStack: string;
39
+ description: string;
40
+ integrationFinishedAt: string;
41
+ };
42
+ export declare type ITenantApplicationsResponse = {
43
+ tenantId: string;
44
+ appIds?: string[];
45
+ };
@@ -0,0 +1,6 @@
1
+ export let ApplicationAccessType;
2
+
3
+ (function (ApplicationAccessType) {
4
+ ApplicationAccessType["FREE_ACCESS"] = "FREE_ACCESS";
5
+ ApplicationAccessType["MANAGED_ACCESS"] = "MANAGED_ACCESS";
6
+ })(ApplicationAccessType || (ApplicationAccessType = {}));
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/applications/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/constants.d.ts CHANGED
@@ -114,6 +114,9 @@ export declare const urls: {
114
114
  impersonate: {
115
115
  v1: string;
116
116
  };
117
+ applications: {
118
+ v1: string;
119
+ };
117
120
  groups: {
118
121
  v1: string;
119
122
  configurations: {
@@ -266,5 +269,11 @@ export declare const urls: {
266
269
  v1: string;
267
270
  };
268
271
  };
272
+ applications: {
273
+ v1: string;
274
+ tenant: {
275
+ v1: string;
276
+ };
277
+ };
269
278
  };
270
279
  export declare const GENERIC_ERROR_MESSAGE = "We're facing some difficulties, Please try again";
package/constants.js CHANGED
@@ -114,6 +114,9 @@ export const urls = {
114
114
  impersonate: {
115
115
  v1: '/identity/resources/impersonation/v1'
116
116
  },
117
+ applications: {
118
+ v1: '/identity/resources/applications/v1'
119
+ },
117
120
  groups: {
118
121
  v1: '/identity/resources/groups/v1',
119
122
  configurations: {
@@ -265,6 +268,12 @@ export const urls = {
265
268
  insights: {
266
269
  v1: '/security-center/resources/insights/v1'
267
270
  }
271
+ },
272
+ applications: {
273
+ v1: '/applications/resources/applications/v1',
274
+ tenant: {
275
+ v1: '/applications/resources/applications/tenant-assignments/v1'
276
+ }
268
277
  }
269
278
  };
270
279
  export const GENERIC_ERROR_MESSAGE = `We're facing some difficulties, Please try again`;
package/fetch.js CHANGED
@@ -146,6 +146,13 @@ async function getAdditionalHeaders(context) {
146
146
  }
147
147
  }
148
148
 
149
+ if (context.appId) {
150
+ output.push({
151
+ key: 'frontegg-requested-application-id',
152
+ value: context.appId
153
+ });
154
+ }
155
+
149
156
  return output;
150
157
  }
151
158
 
package/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import * as tenants from "./tenants";
11
11
  import * as accountSettings from "./account-settings";
12
12
  import * as roles from "./roles";
13
13
  import * as subscriptions from "./subscriptions";
14
+ import * as applications from "./applications";
14
15
  import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from "./subscriptions";
15
16
  import { FronteggApiError } from "./error";
16
17
  import * as vendor from "./vendor";
@@ -51,6 +52,7 @@ export * from "./users/interfaces";
51
52
  export * from "./entitlements/interfaces";
52
53
  export * from "./security-center/interfaces";
53
54
  export * from "./user-phone-numbers/interfaces";
55
+ export * from "./applications/interfaces";
54
56
  declare const api: {
55
57
  auth: typeof auth;
56
58
  teams: typeof teams;
@@ -73,6 +75,7 @@ declare const api: {
73
75
  entitlements: typeof entitlements;
74
76
  securityCenter: typeof securityCenter;
75
77
  userPhoneNumbers: typeof userPhoneNumbers;
78
+ applications: typeof applications;
76
79
  };
77
80
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy, };
78
81
  declare const _default: {
@@ -107,6 +110,7 @@ declare const _default: {
107
110
  entitlements: typeof entitlements;
108
111
  securityCenter: typeof securityCenter;
109
112
  userPhoneNumbers: typeof userPhoneNumbers;
113
+ applications: typeof applications;
110
114
  };
111
115
  FronteggApiError: typeof FronteggApiError;
112
116
  AuthStrategyEnum: typeof auth.AuthStrategyEnum;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.64
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.
@@ -16,6 +16,7 @@ import * as tenants from "./tenants";
16
16
  import * as accountSettings from "./account-settings";
17
17
  import * as roles from "./roles";
18
18
  import * as subscriptions from "./subscriptions";
19
+ import * as applications from "./applications";
19
20
  import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from "./subscriptions";
20
21
  import { FronteggApiError } from "./error";
21
22
  import * as vendor from "./vendor";
@@ -56,6 +57,7 @@ export * from "./users/interfaces";
56
57
  export * from "./entitlements/interfaces";
57
58
  export * from "./security-center/interfaces";
58
59
  export * from "./user-phone-numbers/interfaces";
60
+ export * from "./applications/interfaces";
59
61
  const api = {
60
62
  auth,
61
63
  teams,
@@ -77,7 +79,8 @@ const api = {
77
79
  users,
78
80
  entitlements,
79
81
  securityCenter,
80
- userPhoneNumbers
82
+ userPhoneNumbers,
83
+ applications
81
84
  };
82
85
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy };
83
86
  export default {
package/interfaces.d.ts CHANGED
@@ -61,6 +61,10 @@ export interface SessionContext {
61
61
  export interface ContextOptions {
62
62
  baseUrl: string | ((url: string) => string);
63
63
  clientId?: string;
64
+ /**
65
+ * Will be used to identify the application, use only for multi applications
66
+ */
67
+ appId?: string;
64
68
  tokenResolver?: () => Promise<string> | string;
65
69
  /**
66
70
  * custom login header value
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assignUserToApplications = assignUserToApplications;
7
+ exports.getApplicationsData = getApplicationsData;
8
+ exports.getTenantsApplications = getTenantsApplications;
9
+ exports.getUserApplicationsId = getUserApplicationsId;
10
+ exports.getUsersApplicationsId = getUsersApplicationsId;
11
+ exports.getUsersOfApplications = getUsersOfApplications;
12
+ exports.unassignUserFromApplications = unassignUserFromApplications;
13
+
14
+ var _constants = require("../constants");
15
+
16
+ var _fetch = require("../fetch");
17
+
18
+ async function getUserApplicationsId({
19
+ userId
20
+ }) {
21
+ return (0, _fetch.Get)(`${_constants.urls.identity.applications.v1}/${userId}/apps`);
22
+ }
23
+
24
+ async function getUsersApplicationsId({
25
+ userIds
26
+ }) {
27
+ return (0, _fetch.Get)(`${_constants.urls.identity.applications.v1}/users-apps`, {
28
+ userIds: userIds.join(',')
29
+ });
30
+ }
31
+
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
39
+ }) {
40
+ return (0, _fetch.Get)(_constants.urls.applications.v1, {
41
+ ids: appIds.join(','),
42
+ _includeFreeAccess: includeFreeAccess
43
+ });
44
+ }
45
+
46
+ async function assignUserToApplications(body) {
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);
56
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ApplicationAccessType = void 0;
7
+ let ApplicationAccessType;
8
+ exports.ApplicationAccessType = ApplicationAccessType;
9
+
10
+ (function (ApplicationAccessType) {
11
+ ApplicationAccessType["FREE_ACCESS"] = "FREE_ACCESS";
12
+ ApplicationAccessType["MANAGED_ACCESS"] = "MANAGED_ACCESS";
13
+ })(ApplicationAccessType || (exports.ApplicationAccessType = ApplicationAccessType = {}));
package/node/constants.js CHANGED
@@ -120,6 +120,9 @@ const urls = {
120
120
  impersonate: {
121
121
  v1: '/identity/resources/impersonation/v1'
122
122
  },
123
+ applications: {
124
+ v1: '/identity/resources/applications/v1'
125
+ },
123
126
  groups: {
124
127
  v1: '/identity/resources/groups/v1',
125
128
  configurations: {
@@ -271,6 +274,12 @@ const urls = {
271
274
  insights: {
272
275
  v1: '/security-center/resources/insights/v1'
273
276
  }
277
+ },
278
+ applications: {
279
+ v1: '/applications/resources/applications/v1',
280
+ tenant: {
281
+ v1: '/applications/resources/applications/tenant-assignments/v1'
282
+ }
274
283
  }
275
284
  };
276
285
  exports.urls = urls;
package/node/fetch.js CHANGED
@@ -166,6 +166,13 @@ async function getAdditionalHeaders(context) {
166
166
  }
167
167
  }
168
168
 
169
+ if (context.appId) {
170
+ output.push({
171
+ key: 'frontegg-requested-application-id',
172
+ value: context.appId
173
+ });
174
+ }
175
+
169
176
  return output;
170
177
  }
171
178
 
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.64
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.
@@ -131,6 +131,8 @@ var roles = _interopRequireWildcard(require("./roles"));
131
131
 
132
132
  var subscriptions = _interopRequireWildcard(require("./subscriptions"));
133
133
 
134
+ var applications = _interopRequireWildcard(require("./applications"));
135
+
134
136
  var _error = require("./error");
135
137
 
136
138
  var vendor = _interopRequireWildcard(require("./vendor"));
@@ -519,6 +521,20 @@ Object.keys(_interfaces22).forEach(function (key) {
519
521
  });
520
522
  });
521
523
 
524
+ var _interfaces23 = require("./applications/interfaces");
525
+
526
+ Object.keys(_interfaces23).forEach(function (key) {
527
+ if (key === "default" || key === "__esModule") return;
528
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
529
+ if (key in exports && exports[key] === _interfaces23[key]) return;
530
+ Object.defineProperty(exports, key, {
531
+ enumerable: true,
532
+ get: function () {
533
+ return _interfaces23[key];
534
+ }
535
+ });
536
+ });
537
+
522
538
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
523
539
 
524
540
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -544,7 +560,8 @@ const api = {
544
560
  users,
545
561
  entitlements,
546
562
  securityCenter,
547
- userPhoneNumbers
563
+ userPhoneNumbers,
564
+ applications
548
565
  };
549
566
  exports.api = api;
550
567
  var _default = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.1.64",
3
+ "version": "3.1.66",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {