@frontegg/rest-api 3.0.59 → 3.0.60

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/constants.d.ts CHANGED
@@ -70,6 +70,9 @@ export declare const urls: {
70
70
  subTenants: {
71
71
  v1: string;
72
72
  };
73
+ impersonate: {
74
+ v1: string;
75
+ };
73
76
  };
74
77
  team: {
75
78
  sso: {
package/constants.js CHANGED
@@ -69,6 +69,9 @@ export const urls = {
69
69
  },
70
70
  subTenants: {
71
71
  v1: '/identity/resources/sub-tenants/users/v1'
72
+ },
73
+ impersonate: {
74
+ v1: '/resources/impersonation/v1/impersonate'
72
75
  }
73
76
  },
74
77
  team: {
@@ -0,0 +1,8 @@
1
+ import { IImpersonate, IImpersonateResponse } from "./interfaces";
2
+ /**
3
+ * impersonating user should be called after creating actor token that contains information about impersonation.
4
+ * ``impersonate`` should contain impersonated user info (userId, tenantId, and vendorId) and the actor token that was created for him to perform impersonation.
5
+ *
6
+ * @throws exception if impersonation failed
7
+ */
8
+ export declare function impersonate(body: IImpersonate): Promise<IImpersonateResponse>;
@@ -0,0 +1,5 @@
1
+ import { urls } from "../constants";
2
+ import { Post } from "../fetch";
3
+ export async function impersonate(body) {
4
+ return Post(`${urls.identity.impersonate.v1}`, body);
5
+ }
@@ -0,0 +1,13 @@
1
+ export declare type IImpersonate = {
2
+ impersonatedUserId: string;
3
+ impersonatedTenantId: string;
4
+ impersonationVendorId: string;
5
+ token: string;
6
+ };
7
+ export declare type IImpersonateResponse = {
8
+ accessToken: string;
9
+ tokenType: string;
10
+ refreshToken: string;
11
+ expiresIn: number;
12
+ expires: string;
13
+ };
@@ -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
+ }
package/index.d.ts CHANGED
@@ -15,6 +15,7 @@ import * as vendor from './vendor';
15
15
  import * as subTenants from './sub-tenants';
16
16
  import * as featureFlags from './feature-flags';
17
17
  import * as directory from './directory';
18
+ import * as impersonate from './impersonate';
18
19
  import { ContextHolder, FronteggContext } from './ContextHolder';
19
20
  export * from './interfaces';
20
21
  export * from './auth/interfaces';
@@ -35,6 +36,7 @@ export * from './feature-flags';
35
36
  export * from './feature-flags/interfaces';
36
37
  export * from './directory';
37
38
  export * from './directory/interfaces';
39
+ export * from './impersonate/interfaces';
38
40
  import { AuthStrategyEnum, SocialLoginProviders } from './auth';
39
41
  import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from './subscriptions';
40
42
  declare const api: {
@@ -53,6 +55,7 @@ declare const api: {
53
55
  subTenants: typeof subTenants;
54
56
  featureFlags: typeof featureFlags;
55
57
  directory: typeof directory;
58
+ impersonate: typeof impersonate;
56
59
  };
57
60
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, };
58
61
  declare const _default: {
@@ -81,6 +84,7 @@ declare const _default: {
81
84
  subTenants: typeof subTenants;
82
85
  featureFlags: typeof featureFlags;
83
86
  directory: typeof directory;
87
+ impersonate: typeof impersonate;
84
88
  };
85
89
  FronteggApiError: typeof FronteggApiError;
86
90
  AuthStrategyEnum: typeof auth.AuthStrategyEnum;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.59
1
+ /** @license Frontegg v3.0.60
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.
@@ -20,6 +20,7 @@ import * as vendor from './vendor';
20
20
  import * as subTenants from './sub-tenants';
21
21
  import * as featureFlags from './feature-flags';
22
22
  import * as directory from './directory';
23
+ import * as impersonate from './impersonate';
23
24
  import { ContextHolder, FronteggContext } from './ContextHolder';
24
25
  export * from './interfaces';
25
26
  export * from './auth/interfaces';
@@ -40,6 +41,7 @@ export * from './feature-flags';
40
41
  export * from './feature-flags/interfaces';
41
42
  export * from './directory';
42
43
  export * from './directory/interfaces';
44
+ export * from './impersonate/interfaces';
43
45
  import { AuthStrategyEnum, SocialLoginProviders } from './auth';
44
46
  import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from './subscriptions';
45
47
  const api = {
@@ -57,7 +59,8 @@ const api = {
57
59
  vendor,
58
60
  subTenants,
59
61
  featureFlags,
60
- directory
62
+ directory,
63
+ impersonate
61
64
  };
62
65
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType };
63
66
  export default {
package/node/constants.js CHANGED
@@ -75,6 +75,9 @@ const urls = {
75
75
  },
76
76
  subTenants: {
77
77
  v1: '/identity/resources/sub-tenants/users/v1'
78
+ },
79
+ impersonate: {
80
+ v1: '/resources/impersonation/v1/impersonate'
78
81
  }
79
82
  },
80
83
  team: {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.impersonate = impersonate;
7
+
8
+ var _constants = require("../constants");
9
+
10
+ var _fetch = require("../fetch");
11
+
12
+ async function impersonate(body) {
13
+ return (0, _fetch.Post)(`${_constants.urls.identity.impersonate.v1}`, body);
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.59
1
+ /** @license Frontegg v3.0.60
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.
@@ -137,6 +137,8 @@ Object.keys(directory).forEach(function (key) {
137
137
  });
138
138
  });
139
139
 
140
+ var impersonate = _interopRequireWildcard(require("./impersonate"));
141
+
140
142
  var _ContextHolder = require("./ContextHolder");
141
143
 
142
144
  var _interfaces = require("./interfaces");
@@ -377,6 +379,20 @@ Object.keys(_interfaces16).forEach(function (key) {
377
379
  });
378
380
  });
379
381
 
382
+ var _interfaces17 = require("./impersonate/interfaces");
383
+
384
+ Object.keys(_interfaces17).forEach(function (key) {
385
+ if (key === "default" || key === "__esModule") return;
386
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
387
+ if (key in exports && exports[key] === _interfaces17[key]) return;
388
+ Object.defineProperty(exports, key, {
389
+ enumerable: true,
390
+ get: function () {
391
+ return _interfaces17[key];
392
+ }
393
+ });
394
+ });
395
+
380
396
  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); }
381
397
 
382
398
  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; }
@@ -396,7 +412,8 @@ const api = {
396
412
  vendor,
397
413
  subTenants,
398
414
  featureFlags,
399
- directory
415
+ directory,
416
+ impersonate
400
417
  };
401
418
  exports.api = api;
402
419
  var _default = {
package/node/routers.js CHANGED
@@ -7,7 +7,7 @@ exports.fronteggUsersUrl = exports.fronteggTenantsUrl = exports.fronteggSilentRe
7
7
 
8
8
  var _constants = require("./constants");
9
9
 
10
- const fronteggAuthApiRoutes = [`${_constants.urls.identity.auth.v1}/logout`, `${_constants.urls.identity.auth.v1}/user/saml/postlogin`, `${_constants.urls.identity.auth.v2}/user/oidc/postlogin`, `${_constants.urls.identity.auth.v1}/user`, `${_constants.urls.identity.auth.v1}/user/mfa/verify`, `${_constants.urls.identity.auth.v1}/user/token/refresh`, `${_constants.urls.identity.users.v1}`, `${_constants.urls.identity.users.v1}/signUp`, `${_constants.urls.identity.auth.v1}/passwordless/magiclink/postlogin`, `${_constants.urls.identity.auth.v1}/passwordless/code/postlogin`, `${_constants.urls.identity.auth.v1}/passwordless/smscode/postlogin`, `${_constants.urls.identity.users.v1}/activate`, `${_constants.urls.identity.users.v1}/invitation/accept`, `${_constants.urls.oauth.v1}/token`, `${_constants.urls.oauth.v1}/authorize/silent`];
10
+ const fronteggAuthApiRoutes = [`${_constants.urls.identity.auth.v1}/logout`, `${_constants.urls.identity.auth.v1}/user/saml/postlogin`, `${_constants.urls.identity.auth.v2}/user/oidc/postlogin`, `${_constants.urls.identity.auth.v1}/user`, `${_constants.urls.identity.auth.v1}/user/mfa/verify`, `${_constants.urls.identity.auth.v1}/user/token/refresh`, `${_constants.urls.identity.users.v1}`, `${_constants.urls.identity.users.v1}/signUp`, `${_constants.urls.identity.auth.v1}/passwordless/magiclink/postlogin`, `${_constants.urls.identity.auth.v1}/passwordless/code/postlogin`, `${_constants.urls.identity.auth.v1}/passwordless/smscode/postlogin`, `${_constants.urls.identity.users.v1}/activate`, `${_constants.urls.identity.users.v1}/invitation/accept`, `${_constants.urls.oauth.v1}/logout`, `${_constants.urls.oauth.v1}/token`, `${_constants.urls.oauth.v1}/authorize/silent`];
11
11
  exports.fronteggAuthApiRoutes = fronteggAuthApiRoutes;
12
12
  const fronteggRefreshTokenUrl = `${_constants.urls.identity.auth.v1}/user/token/refresh`;
13
13
  exports.fronteggRefreshTokenUrl = fronteggRefreshTokenUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.0.59",
3
+ "version": "3.0.60",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
package/routers.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { urls } from './constants';
2
- export const fronteggAuthApiRoutes = [`${urls.identity.auth.v1}/logout`, `${urls.identity.auth.v1}/user/saml/postlogin`, `${urls.identity.auth.v2}/user/oidc/postlogin`, `${urls.identity.auth.v1}/user`, `${urls.identity.auth.v1}/user/mfa/verify`, `${urls.identity.auth.v1}/user/token/refresh`, `${urls.identity.users.v1}`, `${urls.identity.users.v1}/signUp`, `${urls.identity.auth.v1}/passwordless/magiclink/postlogin`, `${urls.identity.auth.v1}/passwordless/code/postlogin`, `${urls.identity.auth.v1}/passwordless/smscode/postlogin`, `${urls.identity.users.v1}/activate`, `${urls.identity.users.v1}/invitation/accept`, `${urls.oauth.v1}/token`, `${urls.oauth.v1}/authorize/silent`];
2
+ export const fronteggAuthApiRoutes = [`${urls.identity.auth.v1}/logout`, `${urls.identity.auth.v1}/user/saml/postlogin`, `${urls.identity.auth.v2}/user/oidc/postlogin`, `${urls.identity.auth.v1}/user`, `${urls.identity.auth.v1}/user/mfa/verify`, `${urls.identity.auth.v1}/user/token/refresh`, `${urls.identity.users.v1}`, `${urls.identity.users.v1}/signUp`, `${urls.identity.auth.v1}/passwordless/magiclink/postlogin`, `${urls.identity.auth.v1}/passwordless/code/postlogin`, `${urls.identity.auth.v1}/passwordless/smscode/postlogin`, `${urls.identity.users.v1}/activate`, `${urls.identity.users.v1}/invitation/accept`, `${urls.oauth.v1}/logout`, `${urls.oauth.v1}/token`, `${urls.oauth.v1}/authorize/silent`];
3
3
  export const fronteggRefreshTokenUrl = `${urls.identity.auth.v1}/user/token/refresh`;
4
4
  export const fronteggSilentRefreshTokenUrl = `${urls.oauth.v1}/authorize/silent`;
5
5
  export const fronteggUsersUrl = `${urls.identity.users.v2}/me`;