@frontegg/rest-api 3.0.98 → 3.0.100

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
@@ -11,6 +11,7 @@ export declare const urls: {
11
11
  users: {
12
12
  v1: string;
13
13
  v2: string;
14
+ v3: string;
14
15
  apiTokens: {
15
16
  v1: string;
16
17
  };
@@ -72,6 +73,9 @@ export declare const urls: {
72
73
  v1: string;
73
74
  };
74
75
  };
76
+ users: {
77
+ v1: string;
78
+ };
75
79
  };
76
80
  roles: {
77
81
  v1: string;
@@ -119,6 +123,12 @@ export declare const urls: {
119
123
  tree: {
120
124
  v1: string;
121
125
  };
126
+ parents: {
127
+ v1: string;
128
+ };
129
+ };
130
+ subTenants: {
131
+ v1: string;
122
132
  };
123
133
  };
124
134
  integrations: {
package/constants.js CHANGED
@@ -11,6 +11,7 @@ export const urls = {
11
11
  users: {
12
12
  v1: '/identity/resources/users/v1',
13
13
  v2: '/identity/resources/users/v2',
14
+ v3: '/identity/resources/users/v3',
14
15
  apiTokens: {
15
16
  v1: '/identity/resources/users/api-tokens/v1'
16
17
  },
@@ -71,6 +72,9 @@ export const urls = {
71
72
  configuration: {
72
73
  v1: '/identity/resources/tenants/invites/v1/configuration'
73
74
  }
75
+ },
76
+ users: {
77
+ v1: "/identity/resources/tenants/users/v1"
74
78
  }
75
79
  },
76
80
  roles: {
@@ -118,7 +122,13 @@ export const urls = {
118
122
  v1: '/tenants/resources/hierarchy/v1',
119
123
  tree: {
120
124
  v1: '/tenants/resources/hierarchy/v1/tree'
125
+ },
126
+ parents: {
127
+ v1: '/tenants/resources/hierarchy/v1/parents'
121
128
  }
129
+ },
130
+ subTenants: {
131
+ v1: '/tenants/resources/sub-tenants/resources/v1'
122
132
  }
123
133
  },
124
134
  integrations: {
package/fetch.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ContextOptions } from './interfaces';
1
+ import { ContextOptions, UserJwtOptions } from './interfaces';
2
2
  interface RequestOptions {
3
3
  url: string;
4
4
  method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
@@ -16,4 +16,7 @@ export declare const Patch: (url: string, body?: any, opts?: Pick<RequestOptions
16
16
  export declare const Put: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
17
17
  export declare const Delete: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
18
18
  export declare const PostDownload: (url: string, body?: any, params?: any, opts?: any) => Promise<any>;
19
+ export declare const extractHeadersFromOptions: (options?: UserJwtOptions) => {
20
+ Authorization?: string;
21
+ };
19
22
  export {};
package/fetch.js CHANGED
@@ -212,4 +212,7 @@ export const PostDownload = async (url, body, params, opts) => sendRequest(_exte
212
212
  responseType: 'blob',
213
213
  body,
214
214
  params
215
- }, opts));
215
+ }, opts));
216
+ export const extractHeadersFromOptions = (options = {}) => _extends({}, options.jwt ? {
217
+ Authorization: options.jwt
218
+ } : {});
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as auth from "./auth";
2
+ import { AuthStrategyEnum, MachineToMachineAuthStrategy, SocialLoginProviders } from "./auth";
2
3
  import * as teams from "./teams";
3
4
  import * as metadata from "./metadata";
4
5
  import * as reports from "./reports";
@@ -10,6 +11,7 @@ import * as tenants from "./tenants";
10
11
  import * as accountSettings from "./account-settings";
11
12
  import * as roles from "./roles";
12
13
  import * as subscriptions from "./subscriptions";
14
+ import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from "./subscriptions";
13
15
  import { FronteggApiError } from "./error";
14
16
  import * as vendor from "./vendor";
15
17
  import * as subTenants from "./sub-tenants";
@@ -17,6 +19,7 @@ import * as featureFlags from "./feature-flags";
17
19
  import * as directory from "./directory";
18
20
  import * as impersonate from "./impersonate";
19
21
  import * as groups from "./groups";
22
+ import * as users from "./users";
20
23
  import { ContextHolder, FronteggContext } from "./ContextHolder";
21
24
  export * from "./interfaces";
22
25
  export * from "./auth/interfaces";
@@ -40,8 +43,7 @@ export * from "./directory/interfaces";
40
43
  export * from "./impersonate/interfaces";
41
44
  export * from "./groups/interfaces";
42
45
  export * from "./groups/enums";
43
- import { AuthStrategyEnum, SocialLoginProviders, MachineToMachineAuthStrategy } from "./auth";
44
- import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from "./subscriptions";
46
+ export * from "./users/interfaces";
45
47
  declare const api: {
46
48
  auth: typeof auth;
47
49
  teams: typeof teams;
@@ -60,6 +62,7 @@ declare const api: {
60
62
  directory: typeof directory;
61
63
  impersonate: typeof impersonate;
62
64
  groups: typeof groups;
65
+ users: typeof users;
63
66
  };
64
67
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy, };
65
68
  declare const _default: {
@@ -90,6 +93,7 @@ declare const _default: {
90
93
  directory: typeof directory;
91
94
  impersonate: typeof impersonate;
92
95
  groups: typeof groups;
96
+ users: typeof users;
93
97
  };
94
98
  FronteggApiError: typeof FronteggApiError;
95
99
  AuthStrategyEnum: typeof auth.AuthStrategyEnum;
package/index.js CHANGED
@@ -1,9 +1,10 @@
1
- /** @license Frontegg v3.0.98
1
+ /** @license Frontegg v3.0.100
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.
5
5
  */
6
6
  import * as auth from "./auth";
7
+ import { AuthStrategyEnum, MachineToMachineAuthStrategy, SocialLoginProviders } from "./auth";
7
8
  import * as teams from "./teams";
8
9
  import * as metadata from "./metadata";
9
10
  import * as reports from "./reports";
@@ -15,6 +16,7 @@ import * as tenants from "./tenants";
15
16
  import * as accountSettings from "./account-settings";
16
17
  import * as roles from "./roles";
17
18
  import * as subscriptions from "./subscriptions";
19
+ import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from "./subscriptions";
18
20
  import { FronteggApiError } from "./error";
19
21
  import * as vendor from "./vendor";
20
22
  import * as subTenants from "./sub-tenants";
@@ -22,6 +24,7 @@ import * as featureFlags from "./feature-flags";
22
24
  import * as directory from "./directory";
23
25
  import * as impersonate from "./impersonate";
24
26
  import * as groups from "./groups";
27
+ import * as users from "./users";
25
28
  import { ContextHolder, FronteggContext } from "./ContextHolder";
26
29
  export * from "./interfaces";
27
30
  export * from "./auth/interfaces";
@@ -45,8 +48,7 @@ export * from "./directory/interfaces";
45
48
  export * from "./impersonate/interfaces";
46
49
  export * from "./groups/interfaces";
47
50
  export * from "./groups/enums";
48
- import { AuthStrategyEnum, SocialLoginProviders, MachineToMachineAuthStrategy } from "./auth";
49
- import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from "./subscriptions";
51
+ export * from "./users/interfaces";
50
52
  const api = {
51
53
  auth,
52
54
  teams,
@@ -64,7 +66,8 @@ const api = {
64
66
  featureFlags,
65
67
  directory,
66
68
  impersonate,
67
- groups
69
+ groups,
70
+ users
68
71
  };
69
72
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy };
70
73
  export default {
package/interfaces.d.ts CHANGED
@@ -6,6 +6,12 @@ export interface PaginationResult<T> {
6
6
  totalPages: number;
7
7
  items: T[];
8
8
  }
9
+ export interface FronteggPaginationLinks {
10
+ next: string;
11
+ prev: string;
12
+ first: string;
13
+ last: string;
14
+ }
9
15
  export interface FronteggPaginationResult<T> {
10
16
  _metadata: {
11
17
  totalPages: number;
@@ -13,6 +19,9 @@ export interface FronteggPaginationResult<T> {
13
19
  };
14
20
  items: T[];
15
21
  }
22
+ export interface FronteggPaginationWrapper<T> extends FronteggPaginationResult<T> {
23
+ _links?: FronteggPaginationLinks;
24
+ }
16
25
  export interface KeyValuePair {
17
26
  key: string;
18
27
  value: string;
@@ -53,3 +62,6 @@ export interface RedirectOptions {
53
62
  replace?: boolean;
54
63
  preserveQueryParams?: boolean;
55
64
  }
65
+ export interface UserJwtOptions {
66
+ jwt?: string;
67
+ }
package/node/constants.js CHANGED
@@ -17,6 +17,7 @@ const urls = {
17
17
  users: {
18
18
  v1: '/identity/resources/users/v1',
19
19
  v2: '/identity/resources/users/v2',
20
+ v3: '/identity/resources/users/v3',
20
21
  apiTokens: {
21
22
  v1: '/identity/resources/users/api-tokens/v1'
22
23
  },
@@ -77,6 +78,9 @@ const urls = {
77
78
  configuration: {
78
79
  v1: '/identity/resources/tenants/invites/v1/configuration'
79
80
  }
81
+ },
82
+ users: {
83
+ v1: "/identity/resources/tenants/users/v1"
80
84
  }
81
85
  },
82
86
  roles: {
@@ -124,7 +128,13 @@ const urls = {
124
128
  v1: '/tenants/resources/hierarchy/v1',
125
129
  tree: {
126
130
  v1: '/tenants/resources/hierarchy/v1/tree'
131
+ },
132
+ parents: {
133
+ v1: '/tenants/resources/hierarchy/v1/parents'
127
134
  }
135
+ },
136
+ subTenants: {
137
+ v1: '/tenants/resources/sub-tenants/resources/v1'
128
138
  }
129
139
  },
130
140
  integrations: {
package/node/fetch.js CHANGED
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.Put = exports.PostDownload = exports.Post = exports.Patch = exports.Get = exports.Delete = void 0;
8
+ exports.extractHeadersFromOptions = exports.Put = exports.PostDownload = exports.Post = exports.Patch = exports.Get = exports.Delete = void 0;
9
9
  exports.getBaseUrl = getBaseUrl;
10
10
 
11
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -243,4 +243,10 @@ const PostDownload = async (url, body, params, opts) => sendRequest((0, _extends
243
243
  params
244
244
  }, opts));
245
245
 
246
- exports.PostDownload = PostDownload;
246
+ exports.PostDownload = PostDownload;
247
+
248
+ const extractHeadersFromOptions = (options = {}) => (0, _extends2.default)({}, options.jwt ? {
249
+ Authorization: options.jwt
250
+ } : {});
251
+
252
+ exports.extractHeadersFromOptions = extractHeadersFromOptions;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.98
1
+ /** @license Frontegg v3.0.100
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.
@@ -11,8 +11,8 @@ Object.defineProperty(exports, "__esModule", {
11
11
  var _exportNames = {
12
12
  api: true,
13
13
  AuthStrategyEnum: true,
14
- SocialLoginProviders: true,
15
14
  MachineToMachineAuthStrategy: true,
15
+ SocialLoginProviders: true,
16
16
  fetch: true,
17
17
  ISubscriptionCancellationPolicy: true,
18
18
  ISubscriptionStatus: true,
@@ -148,6 +148,8 @@ var impersonate = _interopRequireWildcard(require("./impersonate"));
148
148
 
149
149
  var groups = _interopRequireWildcard(require("./groups"));
150
150
 
151
+ var users = _interopRequireWildcard(require("./users"));
152
+
151
153
  var _ContextHolder = require("./ContextHolder");
152
154
 
153
155
  var _interfaces = require("./interfaces");
@@ -430,6 +432,20 @@ Object.keys(_enums).forEach(function (key) {
430
432
  });
431
433
  });
432
434
 
435
+ var _interfaces19 = require("./users/interfaces");
436
+
437
+ Object.keys(_interfaces19).forEach(function (key) {
438
+ if (key === "default" || key === "__esModule") return;
439
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
440
+ if (key in exports && exports[key] === _interfaces19[key]) return;
441
+ Object.defineProperty(exports, key, {
442
+ enumerable: true,
443
+ get: function () {
444
+ return _interfaces19[key];
445
+ }
446
+ });
447
+ });
448
+
433
449
  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); }
434
450
 
435
451
  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; }
@@ -451,7 +467,8 @@ const api = {
451
467
  featureFlags,
452
468
  directory,
453
469
  impersonate,
454
- groups
470
+ groups,
471
+ users
455
472
  };
456
473
  exports.api = api;
457
474
  var _default = {
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.addUserRolesForSubTenants = addUserRolesForSubTenants;
7
7
  exports.addUserToTenantAndSubTenants = addUserToTenantAndSubTenants;
8
+ exports.createSubTenant = createSubTenant;
9
+ exports.deleteSubTenant = deleteSubTenant;
8
10
  exports.loadAllUsers = loadAllUsers;
9
11
  exports.removeUserFromTenantAndSubTenants = removeUserFromTenantAndSubTenants;
10
12
  exports.removeUserRolesFromSubTenants = removeUserRolesFromSubTenants;
11
13
  exports.setUserRolesForSubTenants = setUserRolesForSubTenants;
14
+ exports.updateSubAccountAccess = updateSubAccountAccess;
12
15
 
13
16
  var _fetch = require("../fetch");
14
17
 
@@ -22,8 +25,10 @@ async function addUserToTenantAndSubTenants(body) {
22
25
  return (0, _fetch.Post)(_constants.urls.identity.subTenants.v1, body);
23
26
  }
24
27
 
25
- async function removeUserFromTenantAndSubTenants(body) {
26
- return (0, _fetch.Delete)(_constants.urls.identity.subTenants.v1, body);
28
+ async function removeUserFromTenantAndSubTenants(body, options) {
29
+ return (0, _fetch.Delete)(_constants.urls.identity.subTenants.v1, body, {
30
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
31
+ });
27
32
  }
28
33
 
29
34
  async function addUserRolesForSubTenants(userId, body) {
@@ -34,6 +39,26 @@ async function removeUserRolesFromSubTenants(userId, body) {
34
39
  return (0, _fetch.Delete)(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body);
35
40
  }
36
41
 
37
- async function setUserRolesForSubTenants(userId, body) {
38
- return (0, _fetch.Patch)(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body);
42
+ async function setUserRolesForSubTenants(userId, body, options) {
43
+ return (0, _fetch.Patch)(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body, {
44
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
45
+ });
46
+ }
47
+
48
+ async function createSubTenant(body, options) {
49
+ return (0, _fetch.Post)(_constants.urls.tenants.subTenants.v1, body, {
50
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
51
+ });
52
+ }
53
+
54
+ async function deleteSubTenant(tenantId, options) {
55
+ return (0, _fetch.Delete)(`${_constants.urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
56
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
57
+ });
58
+ }
59
+
60
+ async function updateSubAccountAccess(userId, body, options) {
61
+ return (0, _fetch.Put)(`${_constants.urls.identity.subTenants.v1}/${userId}/access`, body, {
62
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
63
+ });
39
64
  }
@@ -3,9 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getParentTenants = getParentTenants;
6
7
  exports.getSubTenants = getSubTenants;
7
8
  exports.getSubTenantsAsTree = getSubTenantsAsTree;
8
9
  exports.getTenants = getTenants;
10
+ exports.getTenantsUsersCount = getTenantsUsersCount;
9
11
  exports.switchTenant = switchTenant;
10
12
 
11
13
  var _fetch = require("../fetch");
@@ -20,10 +22,24 @@ async function getTenants() {
20
22
  return (0, _fetch.Get)(`${_constants.urls.identity.users.v2}/me/tenants`);
21
23
  }
22
24
 
23
- async function getSubTenants() {
24
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.v1);
25
+ async function getSubTenants(options) {
26
+ return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.v1, undefined, {
27
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
28
+ });
25
29
  }
26
30
 
27
- async function getSubTenantsAsTree() {
28
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.tree.v1);
31
+ async function getSubTenantsAsTree(options) {
32
+ return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.tree.v1, undefined, {
33
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
34
+ });
35
+ }
36
+
37
+ async function getParentTenants(options) {
38
+ return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.parents.v1, undefined, {
39
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
40
+ });
41
+ }
42
+
43
+ async function getTenantsUsersCount(body) {
44
+ return (0, _fetch.Post)(`${_constants.urls.identity.tenants.users.v1}/count`, body);
29
45
  }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GetUserJwt = GetUserJwt;
7
+ exports.getUsersV3 = getUsersV3;
8
+
9
+ var _fetch = require("../fetch");
10
+
11
+ var _constants = require("../constants");
12
+
13
+ async function GetUserJwt(body) {
14
+ return (0, _fetch.Post)(`${_constants.urls.identity.users.v3}/me/token`, body);
15
+ }
16
+
17
+ async function getUsersV3(queryParams, options) {
18
+ return (0, _fetch.Get)(_constants.urls.identity.users.v3, queryParams, {
19
+ headers: (0, _fetch.extractHeadersFromOptions)(options)
20
+ });
21
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SortByEnum = exports.PaginationOrderEnum = void 0;
7
+ let SortByEnum;
8
+ exports.SortByEnum = SortByEnum;
9
+
10
+ (function (SortByEnum) {
11
+ SortByEnum["createdAt"] = "createdAt";
12
+ SortByEnum["name"] = "name";
13
+ SortByEnum["email"] = "email";
14
+ SortByEnum["id"] = "id";
15
+ SortByEnum["verified"] = "verified";
16
+ SortByEnum["isLocked"] = "isLocked";
17
+ SortByEnum["provider"] = "provider";
18
+ SortByEnum["tenantId"] = "tenantId";
19
+ })(SortByEnum || (exports.SortByEnum = SortByEnum = {}));
20
+
21
+ let PaginationOrderEnum;
22
+ exports.PaginationOrderEnum = PaginationOrderEnum;
23
+
24
+ (function (PaginationOrderEnum) {
25
+ PaginationOrderEnum["ASC"] = "ASC";
26
+ PaginationOrderEnum["DESC"] = "DESC";
27
+ })(PaginationOrderEnum || (exports.PaginationOrderEnum = PaginationOrderEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.0.98",
3
+ "version": "3.0.100",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -1,8 +1,11 @@
1
- import { PaginationResult } from "../interfaces";
2
- import { AddUserToSubTenantsRequest, ILoadAllUsers, ISubTenantUser, RemoveUserFromSubTenantsRequest, UpdateUserRolesForSubTenantsRequestDto } from "./interfaces";
1
+ import { PaginationResult, UserJwtOptions } from "../interfaces";
2
+ import { AddUserToSubTenantsRequest, CreateSubTenantRequest, CreateSubTenantResponse, ILoadAllUsers, ISubTenantUser, RemoveUserFromSubTenantsRequest, UpdateSubAccountAccessRequestDto, UpdateUserRolesForSubTenantsRequestDto } from "./interfaces";
3
3
  export declare function loadAllUsers(params: ILoadAllUsers): Promise<PaginationResult<ISubTenantUser>>;
4
4
  export declare function addUserToTenantAndSubTenants(body: AddUserToSubTenantsRequest): Promise<void>;
5
- export declare function removeUserFromTenantAndSubTenants(body: RemoveUserFromSubTenantsRequest): Promise<void>;
5
+ export declare function removeUserFromTenantAndSubTenants(body: RemoveUserFromSubTenantsRequest, options?: UserJwtOptions): Promise<void>;
6
6
  export declare function addUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto): Promise<void>;
7
7
  export declare function removeUserRolesFromSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto): Promise<void>;
8
- export declare function setUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto): Promise<void>;
8
+ export declare function setUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
9
+ export declare function createSubTenant(body: CreateSubTenantRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
10
+ export declare function deleteSubTenant(tenantId: string, options?: UserJwtOptions): Promise<void>;
11
+ export declare function updateSubAccountAccess(userId: string, body: UpdateSubAccountAccessRequestDto, options?: UserJwtOptions): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { Delete, Get, Patch, Post } from "../fetch";
1
+ import { Delete, extractHeadersFromOptions, Get, Patch, Post, Put } from "../fetch";
2
2
  import { urls } from "../constants";
3
3
  export async function loadAllUsers(params) {
4
4
  return Get(urls.identity.subTenants.v1, params);
@@ -6,8 +6,10 @@ export async function loadAllUsers(params) {
6
6
  export async function addUserToTenantAndSubTenants(body) {
7
7
  return Post(urls.identity.subTenants.v1, body);
8
8
  }
9
- export async function removeUserFromTenantAndSubTenants(body) {
10
- return Delete(urls.identity.subTenants.v1, body);
9
+ export async function removeUserFromTenantAndSubTenants(body, options) {
10
+ return Delete(urls.identity.subTenants.v1, body, {
11
+ headers: extractHeadersFromOptions(options)
12
+ });
11
13
  }
12
14
  export async function addUserRolesForSubTenants(userId, body) {
13
15
  return Post(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
@@ -15,6 +17,23 @@ export async function addUserRolesForSubTenants(userId, body) {
15
17
  export async function removeUserRolesFromSubTenants(userId, body) {
16
18
  return Delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
17
19
  }
18
- export async function setUserRolesForSubTenants(userId, body) {
19
- return Patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
20
+ export async function setUserRolesForSubTenants(userId, body, options) {
21
+ return Patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
22
+ headers: extractHeadersFromOptions(options)
23
+ });
24
+ }
25
+ export async function createSubTenant(body, options) {
26
+ return Post(urls.tenants.subTenants.v1, body, {
27
+ headers: extractHeadersFromOptions(options)
28
+ });
29
+ }
30
+ export async function deleteSubTenant(tenantId, options) {
31
+ return Delete(`${urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
32
+ headers: extractHeadersFromOptions(options)
33
+ });
34
+ }
35
+ export async function updateSubAccountAccess(userId, body, options) {
36
+ return Put(`${urls.identity.subTenants.v1}/${userId}/access`, body, {
37
+ headers: extractHeadersFromOptions(options)
38
+ });
20
39
  }
@@ -85,3 +85,35 @@ export interface UpdateUserRolesForSubTenantsRequestDto {
85
85
  ipAddress?: string;
86
86
  userAgent?: string;
87
87
  }
88
+ export interface CreateSubTenantRequest {
89
+ tenantId: string;
90
+ name: string;
91
+ parentTenantId: string;
92
+ status?: string;
93
+ website?: string;
94
+ applicationUrl?: string;
95
+ logo?: string;
96
+ logoUrl?: string;
97
+ address?: string;
98
+ timezone?: string;
99
+ currency?: string;
100
+ creatorName?: string;
101
+ creatorEmail?: string;
102
+ isReseller?: boolean;
103
+ }
104
+ export interface CreateSubTenantResponse {
105
+ tenantId: string;
106
+ name: string;
107
+ status?: string;
108
+ website?: string;
109
+ applicationUrl?: string;
110
+ logo?: string;
111
+ logoUrl?: string;
112
+ address?: string;
113
+ timezone?: string;
114
+ updatedAt?: Date;
115
+ currency?: string;
116
+ }
117
+ export interface UpdateSubAccountAccessRequestDto {
118
+ allowAccess: boolean;
119
+ }
@@ -1,4 +1,5 @@
1
- import { ISubTenant, ISubTenantTree, ISwitchTenant, ITenantsResponse } from './interfaces';
1
+ import { IGetTenantsUserCountRequest, IGetTenantsUserCountResponse, IParentTenant, ISubTenant, ISubTenantTree, ISwitchTenant, ITenantsResponse } from "./interfaces";
2
+ import { UserJwtOptions } from "../interfaces";
2
3
  /**
3
4
  * switch logged in user to specific tenant by providing tenantId.
4
5
  *
@@ -17,10 +18,17 @@ export declare function getTenants(): Promise<ITenantsResponse[]>;
17
18
  *
18
19
  * ``authorized user``
19
20
  */
20
- export declare function getSubTenants(): Promise<ISubTenant>;
21
+ export declare function getSubTenants(options?: UserJwtOptions): Promise<ISubTenant>;
21
22
  /**
22
23
  * retrieve logged in user's available sub tenants as a tree.
23
24
  *
24
25
  * ``authorized user``
25
26
  */
26
- export declare function getSubTenantsAsTree(): Promise<ISubTenantTree>;
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 getTenantsUsersCount(body: IGetTenantsUserCountRequest): Promise<IGetTenantsUserCountResponse[]>;
package/tenants/index.js CHANGED
@@ -1,14 +1,26 @@
1
- import { Get, Put } from '../fetch';
2
- import { urls } from '../constants';
1
+ import { extractHeadersFromOptions, Get, Post, Put } from "../fetch";
2
+ import { urls } from "../constants";
3
3
  export async function switchTenant(body) {
4
4
  return Put(`${urls.identity.users.v1}/tenant`, body);
5
5
  }
6
6
  export async function getTenants() {
7
7
  return Get(`${urls.identity.users.v2}/me/tenants`);
8
8
  }
9
- export async function getSubTenants() {
10
- return Get(urls.tenants.hierarchy.v1);
9
+ export async function getSubTenants(options) {
10
+ return Get(urls.tenants.hierarchy.v1, undefined, {
11
+ headers: extractHeadersFromOptions(options)
12
+ });
11
13
  }
12
- export async function getSubTenantsAsTree() {
13
- return Get(urls.tenants.hierarchy.tree.v1);
14
+ export async function getSubTenantsAsTree(options) {
15
+ return Get(urls.tenants.hierarchy.tree.v1, undefined, {
16
+ headers: extractHeadersFromOptions(options)
17
+ });
18
+ }
19
+ export async function getParentTenants(options) {
20
+ return Get(urls.tenants.hierarchy.parents.v1, undefined, {
21
+ headers: extractHeadersFromOptions(options)
22
+ });
23
+ }
24
+ export async function getTenantsUsersCount(body) {
25
+ return Post(`${urls.identity.tenants.users.v1}/count`, body);
14
26
  }
@@ -47,11 +47,15 @@ export interface ITenantsResponseV2 extends ITenantsResponse {
47
47
  export interface ISubTenant {
48
48
  tenantId: string;
49
49
  tenantName?: string;
50
+ status?: string;
51
+ createdAt?: Date;
50
52
  level: number;
51
53
  }
52
54
  export interface ISubTenantTree {
53
55
  tenantId: string;
54
56
  tenantName?: string;
57
+ status?: string;
58
+ createdAt?: Date;
55
59
  children: ISubTenantTree[];
56
60
  }
57
61
  export interface ITenantHierarchyNode {
@@ -60,3 +64,17 @@ export interface ITenantHierarchyNode {
60
64
  tenantId: string;
61
65
  parentId: string;
62
66
  }
67
+ export interface IParentTenant {
68
+ tenantId: string;
69
+ level: number;
70
+ tenantName: string;
71
+ status: string;
72
+ createdAt: Date;
73
+ }
74
+ export interface IGetTenantsUserCountRequest {
75
+ tenantIds: string[];
76
+ }
77
+ export interface IGetTenantsUserCountResponse {
78
+ tenantId: string;
79
+ totalUsers: number;
80
+ }
@@ -0,0 +1,4 @@
1
+ import { GetUserJwtRequestDto, GetUserJwtResponseDto, ISearchUserQueryParamsV3, IUsersV3Data } from "./interfaces";
2
+ import { FronteggPaginationWrapper, UserJwtOptions } from "../interfaces";
3
+ export declare function GetUserJwt(body: GetUserJwtRequestDto): Promise<GetUserJwtResponseDto>;
4
+ export declare function getUsersV3(queryParams: ISearchUserQueryParamsV3, options?: UserJwtOptions): Promise<FronteggPaginationWrapper<IUsersV3Data>>;
package/users/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { extractHeadersFromOptions, Get, Post } from "../fetch";
2
+ import { urls } from "../constants";
3
+ export async function GetUserJwt(body) {
4
+ return Post(`${urls.identity.users.v3}/me/token`, body);
5
+ }
6
+ export async function getUsersV3(queryParams, options) {
7
+ return Get(urls.identity.users.v3, queryParams, {
8
+ headers: extractHeadersFromOptions(options)
9
+ });
10
+ }
@@ -0,0 +1,49 @@
1
+ export declare enum SortByEnum {
2
+ createdAt = "createdAt",
3
+ name = "name",
4
+ email = "email",
5
+ id = "id",
6
+ verified = "verified",
7
+ isLocked = "isLocked",
8
+ provider = "provider",
9
+ tenantId = "tenantId"
10
+ }
11
+ export declare enum PaginationOrderEnum {
12
+ ASC = "ASC",
13
+ DESC = "DESC"
14
+ }
15
+ export interface GetUserJwtRequestDto {
16
+ tenantId: string;
17
+ }
18
+ export interface GetUserJwtResponseDto {
19
+ accessToken: string;
20
+ expires: string;
21
+ expiresIn: number;
22
+ }
23
+ export interface ISearchUserQueryParamsV3 {
24
+ _limit?: number;
25
+ _offset?: number;
26
+ _email?: string;
27
+ _tenantId?: string;
28
+ ids?: string;
29
+ _sortBy?: SortByEnum;
30
+ _order?: PaginationOrderEnum;
31
+ }
32
+ export interface IUsersV3Data {
33
+ sub?: string;
34
+ verified?: boolean;
35
+ mfaEnrolled?: boolean;
36
+ mfaBypass?: boolean;
37
+ phoneNumber?: string;
38
+ provider?: string;
39
+ tenantId?: string;
40
+ tenantIds?: string[];
41
+ activatedForTenant?: boolean;
42
+ isLocked?: boolean;
43
+ invisible?: boolean;
44
+ superUser?: boolean;
45
+ metadata?: string;
46
+ createdAt?: Date;
47
+ lastLogin?: Date;
48
+ subAccountAccessAllowed?: boolean;
49
+ }
@@ -0,0 +1,19 @@
1
+ export let SortByEnum;
2
+
3
+ (function (SortByEnum) {
4
+ SortByEnum["createdAt"] = "createdAt";
5
+ SortByEnum["name"] = "name";
6
+ SortByEnum["email"] = "email";
7
+ SortByEnum["id"] = "id";
8
+ SortByEnum["verified"] = "verified";
9
+ SortByEnum["isLocked"] = "isLocked";
10
+ SortByEnum["provider"] = "provider";
11
+ SortByEnum["tenantId"] = "tenantId";
12
+ })(SortByEnum || (SortByEnum = {}));
13
+
14
+ export let PaginationOrderEnum;
15
+
16
+ (function (PaginationOrderEnum) {
17
+ PaginationOrderEnum["ASC"] = "ASC";
18
+ PaginationOrderEnum["DESC"] = "DESC";
19
+ })(PaginationOrderEnum || (PaginationOrderEnum = {}));
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/users/index.js",
5
+ "types": "./index.d.ts"
6
+ }