@frontegg/rest-api 7.84.0-alpha.0 → 7.84.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.
package/auth/enums.d.ts CHANGED
@@ -25,8 +25,7 @@ export declare enum MachineToMachineAuthStrategy {
25
25
  }
26
26
  export declare enum SignUpStrategyEnum {
27
27
  Email = "email",
28
- PhoneNumber = "phoneNumber",
29
- Username = "username"
28
+ PhoneNumber = "phoneNumber"
30
29
  }
31
30
  export declare enum EIdentifierType {
32
31
  email = "email",
package/auth/enums.js CHANGED
@@ -30,7 +30,6 @@ export let SignUpStrategyEnum;
30
30
  (function (SignUpStrategyEnum) {
31
31
  SignUpStrategyEnum["Email"] = "email";
32
32
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
33
- SignUpStrategyEnum["Username"] = "username";
34
33
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
35
34
  export let EIdentifierType;
36
35
  (function (EIdentifierType) {
package/auth/index.d.ts CHANGED
@@ -485,7 +485,6 @@ export declare class AuthenticationApi extends BaseApiClient {
485
485
  * Get vendor secure access configuration.
486
486
  */
487
487
  getVendorConfig: () => Promise<IVendorConfig>;
488
- private signUp;
489
488
  /**
490
489
  * Sign up a new user and create a new tenant.
491
490
  *
@@ -498,12 +497,6 @@ export declare class AuthenticationApi extends BaseApiClient {
498
497
  * @param body - The sign-up data
499
498
  */
500
499
  signUpUserWithPhoneNumber: (body: ISignUpUser) => Promise<ISignUpResponse>;
501
- /**
502
- * Sign up a new user and create a new tenant.
503
- *
504
- * @param body - The sign-up data
505
- */
506
- signUpUserWithUsername: (body: ISignUpUser) => Promise<ISignUpResponse>;
507
500
  /**
508
501
  * Get all current user active sessions.
509
502
  */
package/auth/index.js CHANGED
@@ -439,14 +439,14 @@ export class AuthenticationApi extends BaseApiClient {
439
439
  this.getVendorConfig = async () => {
440
440
  return this.get(`${urls.identity.configurations.v1}/public`);
441
441
  };
442
- this.signUp = async (signUpUrl, body) => {
442
+ this.signUpUser = async body => {
443
443
  const {
444
444
  shouldActivate,
445
445
  authResponse,
446
446
  userId,
447
447
  tenantId,
448
448
  activationToken
449
- } = await this.post(signUpUrl, body);
449
+ } = await this.post(`${urls.identity.users.v1}/signUp`, body);
450
450
  const response = {
451
451
  shouldActivate,
452
452
  userId,
@@ -468,14 +468,34 @@ export class AuthenticationApi extends BaseApiClient {
468
468
  activationToken
469
469
  });
470
470
  };
471
- this.signUpUser = async body => {
472
- return this.signUp(`${urls.identity.users.v1}/signUp`, body);
473
- };
474
471
  this.signUpUserWithPhoneNumber = async body => {
475
- return this.signUp(`${urls.identity.users.v1}/signUp/phoneNumber`, body);
476
- };
477
- this.signUpUserWithUsername = async body => {
478
- return this.signUp(`${urls.identity.users.v1}/signUp/username`, body);
472
+ const {
473
+ shouldActivate,
474
+ authResponse,
475
+ userId,
476
+ tenantId,
477
+ activationToken
478
+ } = await this.post(`${urls.identity.users.v1}/signUp/phoneNumber`, body);
479
+ const response = {
480
+ shouldActivate,
481
+ userId,
482
+ tenantId
483
+ };
484
+ if (!shouldActivate && authResponse) {
485
+ const {
486
+ user,
487
+ tenants,
488
+ activeTenant
489
+ } = await this.generateLoginResponseV3(authResponse);
490
+ return _extends({}, response, {
491
+ user,
492
+ tenants,
493
+ activeTenant
494
+ });
495
+ }
496
+ return _extends({}, response, {
497
+ activationToken
498
+ });
479
499
  };
480
500
  this.getCurrentUserSessions = async () => {
481
501
  return this.get(urls.identity.users.sessions.currentUser.v1);
@@ -256,7 +256,6 @@ export interface ISignUpUser {
256
256
  metadata?: string /** JSON */;
257
257
  roleIds?: string[];
258
258
  invitationToken?: string;
259
- username?: string;
260
259
  }
261
260
  export interface ISignUpResponse {
262
261
  shouldActivate: boolean;
package/constants.d.ts CHANGED
@@ -96,6 +96,7 @@ export declare const urls: {
96
96
  invites: {
97
97
  user: {
98
98
  v1: string;
99
+ v2: string;
99
100
  };
100
101
  verify: {
101
102
  v1: string;
package/constants.js CHANGED
@@ -95,7 +95,8 @@ export const urls = {
95
95
  },
96
96
  invites: {
97
97
  user: {
98
- v1: '/identity/resources/tenants/invites/v1/user'
98
+ v1: '/identity/resources/tenants/invites/v1/user',
99
+ v2: '/identity/resources/tenants/invites/v2/user'
99
100
  },
100
101
  verify: {
101
102
  v1: '/identity/resources/tenants/invites/v1/verify'
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.84.0-alpha.0
1
+ /** @license Frontegg v7.84.0
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.
@@ -40,7 +40,6 @@ exports.SignUpStrategyEnum = SignUpStrategyEnum;
40
40
  (function (SignUpStrategyEnum) {
41
41
  SignUpStrategyEnum["Email"] = "email";
42
42
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
43
- SignUpStrategyEnum["Username"] = "username";
44
43
  })(SignUpStrategyEnum || (exports.SignUpStrategyEnum = SignUpStrategyEnum = {}));
45
44
  let EIdentifierType;
46
45
  exports.EIdentifierType = EIdentifierType;
@@ -504,14 +504,14 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
504
504
  this.getVendorConfig = async () => {
505
505
  return this.get(`${_constants2.urls.identity.configurations.v1}/public`);
506
506
  };
507
- this.signUp = async (signUpUrl, body) => {
507
+ this.signUpUser = async body => {
508
508
  const {
509
509
  shouldActivate,
510
510
  authResponse,
511
511
  userId,
512
512
  tenantId,
513
513
  activationToken
514
- } = await this.post(signUpUrl, body);
514
+ } = await this.post(`${_constants2.urls.identity.users.v1}/signUp`, body);
515
515
  const response = {
516
516
  shouldActivate,
517
517
  userId,
@@ -533,14 +533,34 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
533
533
  activationToken
534
534
  });
535
535
  };
536
- this.signUpUser = async body => {
537
- return this.signUp(`${_constants2.urls.identity.users.v1}/signUp`, body);
538
- };
539
536
  this.signUpUserWithPhoneNumber = async body => {
540
- return this.signUp(`${_constants2.urls.identity.users.v1}/signUp/phoneNumber`, body);
541
- };
542
- this.signUpUserWithUsername = async body => {
543
- return this.signUp(`${_constants2.urls.identity.users.v1}/signUp/username`, body);
537
+ const {
538
+ shouldActivate,
539
+ authResponse,
540
+ userId,
541
+ tenantId,
542
+ activationToken
543
+ } = await this.post(`${_constants2.urls.identity.users.v1}/signUp/phoneNumber`, body);
544
+ const response = {
545
+ shouldActivate,
546
+ userId,
547
+ tenantId
548
+ };
549
+ if (!shouldActivate && authResponse) {
550
+ const {
551
+ user,
552
+ tenants,
553
+ activeTenant
554
+ } = await this.generateLoginResponseV3(authResponse);
555
+ return (0, _extends2.default)({}, response, {
556
+ user,
557
+ tenants,
558
+ activeTenant
559
+ });
560
+ }
561
+ return (0, _extends2.default)({}, response, {
562
+ activationToken
563
+ });
544
564
  };
545
565
  this.getCurrentUserSessions = async () => {
546
566
  return this.get(_constants2.urls.identity.users.sessions.currentUser.v1);
package/node/constants.js CHANGED
@@ -101,7 +101,8 @@ const urls = {
101
101
  },
102
102
  invites: {
103
103
  user: {
104
- v1: '/identity/resources/tenants/invites/v1/user'
104
+ v1: '/identity/resources/tenants/invites/v1/user',
105
+ v2: '/identity/resources/tenants/invites/v2/user'
105
106
  },
106
107
  verify: {
107
108
  v1: '/identity/resources/tenants/invites/v1/verify'
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.84.0-alpha.0
1
+ /** @license Frontegg v7.84.0
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.
@@ -82,6 +82,9 @@ class TeamsApi extends _BaseApiClient.BaseApiClient {
82
82
  this.createInviteUserLink = async body => {
83
83
  return this.post(_constants.urls.identity.tenants.invites.user.v1, (0, _extends2.default)({}, body));
84
84
  };
85
+ this.createInviteUserLinkV2 = async body => {
86
+ return this.post(_constants.urls.identity.tenants.invites.user.v2, (0, _extends2.default)({}, body));
87
+ };
85
88
  this.updateInviteUserLink = async body => {
86
89
  return this.patch(_constants.urls.identity.tenants.invites.user.v1, (0, _extends2.default)({}, body));
87
90
  };
@@ -31,6 +31,11 @@ class UsersApi extends _BaseApiClient.BaseApiClient {
31
31
  headers: this.extractHeadersFromOptions(options)
32
32
  });
33
33
  };
34
+ this.getUsersUsernames = async queryParams => {
35
+ return this.get(_constants.urls.identity.usernames.v1, (0, _extends2.default)({}, queryParams, {
36
+ userIds: queryParams.userIds.join(',')
37
+ }));
38
+ };
34
39
  this.getUsersGroups = async (queryParams, options) => {
35
40
  return this.get(_constants.urls.identity.users.groups.v3, (0, _extends2.default)({}, queryParams, {
36
41
  ids: queryParams.ids.join(',')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "7.84.0-alpha.0",
3
+ "version": "7.84.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
package/teams/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export declare class TeamsApi extends BaseApiClient {
24
24
  setPermanentUser: (userId: string) => Promise<void>;
25
25
  getTemporaryUserConfiguration: () => Promise<ITemporaryUserConfiguration>;
26
26
  createInviteUserLink: (body: ICreateOrUpdateInviteUserLink) => Promise<IInviteUserLinkResponse>;
27
+ createInviteUserLinkV2: (body: ICreateOrUpdateInviteUserLink) => Promise<IInviteUserLinkResponse>;
27
28
  updateInviteUserLink: (body: ICreateOrUpdateInviteUserLink) => Promise<IInviteUserLinkResponse>;
28
29
  deleteInviteUserLink: () => Promise<void>;
29
30
  getInviteUserLink: () => Promise<IInviteUserLinkResponse>;
package/teams/index.js CHANGED
@@ -75,6 +75,9 @@ export class TeamsApi extends BaseApiClient {
75
75
  this.createInviteUserLink = async body => {
76
76
  return this.post(urls.identity.tenants.invites.user.v1, _extends({}, body));
77
77
  };
78
+ this.createInviteUserLinkV2 = async body => {
79
+ return this.post(urls.identity.tenants.invites.user.v2, _extends({}, body));
80
+ };
78
81
  this.updateInviteUserLink = async body => {
79
82
  return this.patch(urls.identity.tenants.invites.user.v1, _extends({}, body));
80
83
  };
@@ -13,6 +13,7 @@ export type ITeamUser = {
13
13
  email: string;
14
14
  name: string;
15
15
  phone?: string;
16
+ username?: string;
16
17
  profileImage?: string;
17
18
  profileImageUrl?: string;
18
19
  tenantId: string;
@@ -89,6 +90,7 @@ export type IAddUser = {
89
90
  phone?: string;
90
91
  roleIds: string[];
91
92
  expirationInSeconds?: number;
93
+ username?: string;
92
94
  };
93
95
  export type IDeleteUser = {
94
96
  userId: string;
@@ -106,6 +108,7 @@ export type ISendResetPasswordLink = {
106
108
  export type ICreateOrUpdateInviteUserLink = {
107
109
  expiresInMinutes?: number;
108
110
  shouldSendEmail?: boolean;
111
+ roleIds?: string[];
109
112
  };
110
113
  /**
111
114
  * invite config
@@ -118,6 +121,7 @@ export type IInviteUserLinkResponse = {
118
121
  token: string;
119
122
  expires: Date;
120
123
  shouldSendEmail?: boolean;
124
+ roleIds?: string[];
121
125
  };
122
126
  /**
123
127
  * vendor config
package/users/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GetCurrentUserTenantsResponse, GetUserGroupsParams, GetUserGroupsResponse, GetUserJwtRequestDto, GetUserJwtResponseDto, GetUserRolesResponse, GetUsersRolesParams, IGetUsersV2Response, ISearchUserQueryParamsV2, ISearchUserQueryParamsV3, IUnlockMeRequest, IUpdateUserDto, IUserProfile, IUsersV3Data } from './interfaces';
1
+ import { GetCurrentUserTenantsResponse, GetUserGroupsParams, GetUserGroupsResponse, GetUserJwtRequestDto, GetUserJwtResponseDto, GetUserRolesResponse, GetUsersRolesParams, GetUsersUsernamesParams, GetUserUsernamesResponse, IGetUsersV2Response, ISearchUserQueryParamsV2, ISearchUserQueryParamsV3, IUnlockMeRequest, IUpdateUserDto, IUserProfile, IUsersV3Data } from './interfaces';
2
2
  import { FronteggPaginationWrapper, UserJwtOptions } from '../interfaces';
3
3
  import { BaseApiClient } from '../BaseApiClient';
4
4
  export declare class UsersApi extends BaseApiClient {
@@ -7,6 +7,7 @@ export declare class UsersApi extends BaseApiClient {
7
7
  getUsersV2: (queryParams: ISearchUserQueryParamsV2, options?: UserJwtOptions) => Promise<FronteggPaginationWrapper<IGetUsersV2Response>>;
8
8
  getUsersV3: (queryParams: ISearchUserQueryParamsV3, options?: UserJwtOptions) => Promise<FronteggPaginationWrapper<IUsersV3Data>>;
9
9
  getUsersRoles: (queryParams: GetUsersRolesParams, options?: UserJwtOptions) => Promise<GetUserRolesResponse[]>;
10
+ getUsersUsernames: (queryParams: GetUsersUsernamesParams) => Promise<FronteggPaginationWrapper<GetUserUsernamesResponse>>;
10
11
  getUsersGroups: (queryParams: GetUserGroupsParams, options?: UserJwtOptions) => Promise<GetUserGroupsResponse[]>;
11
12
  /**
12
13
  * get user tenant and user tenants by user active tenant
package/users/index.js CHANGED
@@ -24,6 +24,11 @@ export class UsersApi extends BaseApiClient {
24
24
  headers: this.extractHeadersFromOptions(options)
25
25
  });
26
26
  };
27
+ this.getUsersUsernames = async queryParams => {
28
+ return this.get(urls.identity.usernames.v1, _extends({}, queryParams, {
29
+ userIds: queryParams.userIds.join(',')
30
+ }));
31
+ };
27
32
  this.getUsersGroups = async (queryParams, options) => {
28
33
  return this.get(urls.identity.users.groups.v3, _extends({}, queryParams, {
29
34
  ids: queryParams.ids.join(',')
@@ -105,12 +105,20 @@ export declare enum GetUsersFilterPreset {
105
105
  export interface GetUsersRolesParams {
106
106
  ids: string[];
107
107
  }
108
+ export interface GetUsersUsernamesParams {
109
+ userIds: string[];
110
+ }
108
111
  export interface GetUserRolesResponse {
109
112
  vendorId: string;
110
113
  tenantId: string;
111
114
  userId: string;
112
115
  roleIds: string[];
113
116
  }
117
+ export interface GetUserUsernamesResponse {
118
+ vendorId: string;
119
+ userId: string;
120
+ username: string;
121
+ }
114
122
  export interface GetUserGroupsParams {
115
123
  ids: string[];
116
124
  }