@frontegg/rest-api 7.75.0 → 7.76.0-alpha.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/index.js +10 -1
- package/auth/interfaces.d.ts +8 -3
- package/constants.d.ts +3 -0
- package/constants.js +3 -0
- package/index.d.ts +4 -0
- package/index.js +4 -1
- package/node/auth/index.js +9 -1
- package/node/constants.js +3 -0
- package/node/index.js +4 -1
- package/node/usernames/index.js +29 -0
- package/node/usernames/interfaces.js +5 -0
- package/package.json +1 -1
- package/usernames/index.d.ts +19 -0
- package/usernames/index.js +22 -0
- package/usernames/interfaces.d.ts +7 -0
- package/usernames/interfaces.js +1 -0
- package/usernames/package.json +6 -0
package/auth/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { BaseApiClient } from '../BaseApiClient';
|
|
|
17
17
|
import { EntitlementsApi } from '../entitlements';
|
|
18
18
|
import { ContextHolder } from '../ContextHolder';
|
|
19
19
|
import { SecurityPolicyApi } from './secutiry-poilicy';
|
|
20
|
+
import { AuthStrategyEnum } from './enums';
|
|
20
21
|
export class AuthenticationApi extends BaseApiClient {
|
|
21
22
|
constructor(appName) {
|
|
22
23
|
super(appName);
|
|
@@ -562,11 +563,19 @@ export class AuthenticationApi extends BaseApiClient {
|
|
|
562
563
|
});
|
|
563
564
|
};
|
|
564
565
|
this.passwordlessPreLogin = async _ref => {
|
|
566
|
+
var _usernameToTypeMapper;
|
|
565
567
|
let {
|
|
566
568
|
type
|
|
567
569
|
} = _ref,
|
|
568
570
|
body = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
569
|
-
|
|
571
|
+
const usernameToTypeMapper = {
|
|
572
|
+
[AuthStrategyEnum.UsernameAndCode]: AuthStrategyEnum.Code,
|
|
573
|
+
[AuthStrategyEnum.UsernameAndMagicLink]: AuthStrategyEnum.MagicLink,
|
|
574
|
+
[AuthStrategyEnum.UsernameAndSms]: AuthStrategyEnum.SmsCode,
|
|
575
|
+
[AuthStrategyEnum.UsernameAndPassword]: AuthStrategyEnum.EmailAndPassword
|
|
576
|
+
};
|
|
577
|
+
const mappedType = ((_usernameToTypeMapper = usernameToTypeMapper[type]) == null ? void 0 : _usernameToTypeMapper.toLowerCase()) || type.toLowerCase();
|
|
578
|
+
return this.post(`${urls.identity.auth.v1}/passwordless/${mappedType}/prelogin`, body);
|
|
570
579
|
};
|
|
571
580
|
this.passwordlessPostLoginV2 = async _ref2 => {
|
|
572
581
|
let {
|
package/auth/interfaces.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { AuthStrategyEnum, MachineToMachineAuthStrategy, SignUpStrategyEnum, Soc
|
|
|
4
4
|
import { ISamlRolesGroup } from '../teams/interfaces';
|
|
5
5
|
export * from './secutiry-poilicy/interfaces';
|
|
6
6
|
export type IPreLogin = {
|
|
7
|
-
email
|
|
7
|
+
email?: string;
|
|
8
|
+
username?: string;
|
|
8
9
|
tenantId?: string;
|
|
9
10
|
};
|
|
10
11
|
export type IPostLogin = {
|
|
@@ -26,7 +27,8 @@ export type IOidcPostLoginV2 = {
|
|
|
26
27
|
redirectUri?: string;
|
|
27
28
|
};
|
|
28
29
|
export type ILogin = {
|
|
29
|
-
email
|
|
30
|
+
email?: string;
|
|
31
|
+
username?: string;
|
|
30
32
|
password: string;
|
|
31
33
|
recaptchaToken?: string;
|
|
32
34
|
invitationToken?: string;
|
|
@@ -391,13 +393,16 @@ export interface IBasePasswordlessPreLogin {
|
|
|
391
393
|
export interface IEmailPasswordlessPreLogin extends IBasePasswordlessPreLogin {
|
|
392
394
|
email: string;
|
|
393
395
|
}
|
|
396
|
+
export interface IUsernamePasswordlessPreLogin extends IBasePasswordlessPreLogin {
|
|
397
|
+
username: string;
|
|
398
|
+
}
|
|
394
399
|
export interface IUserIDPasswordlessPreLogin extends IBasePasswordlessPreLogin {
|
|
395
400
|
userId: string;
|
|
396
401
|
}
|
|
397
402
|
export interface IPhoneNumberPasswordlessPreLogin extends IBasePasswordlessPreLogin {
|
|
398
403
|
phoneNumber: string;
|
|
399
404
|
}
|
|
400
|
-
export type IPasswordlessPreLogin = IEmailPasswordlessPreLogin | IUserIDPasswordlessPreLogin | IPhoneNumberPasswordlessPreLogin;
|
|
405
|
+
export type IPasswordlessPreLogin = IEmailPasswordlessPreLogin | IUserIDPasswordlessPreLogin | IUsernamePasswordlessPreLogin | IPhoneNumberPasswordlessPreLogin;
|
|
401
406
|
export interface IPasswordlessPostLogin {
|
|
402
407
|
token: string;
|
|
403
408
|
recaptchaToken?: string;
|
package/constants.d.ts
CHANGED
package/constants.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { SecurityCenterApi } from './security-center';
|
|
|
27
27
|
import { PhoneNumbersApi } from './user-phone-numbers';
|
|
28
28
|
import { ApplicationsApi } from './applications';
|
|
29
29
|
import { VeloApi } from './velo';
|
|
30
|
+
import { UsernamesApi } from './usernames';
|
|
30
31
|
import { UserEmailPolicyApi } from './users-emails-policy';
|
|
31
32
|
export * from './interfaces';
|
|
32
33
|
export * from './auth/interfaces';
|
|
@@ -90,6 +91,7 @@ declare const api: {
|
|
|
90
91
|
userPhoneNumbers: PhoneNumbersApi;
|
|
91
92
|
applications: ApplicationsApi;
|
|
92
93
|
velo: VeloApi;
|
|
94
|
+
usernames: UsernamesApi;
|
|
93
95
|
userEmailPolicy: UserEmailPolicyApi;
|
|
94
96
|
};
|
|
95
97
|
export type FronteggApiClient = {
|
|
@@ -117,6 +119,7 @@ export type FronteggApiClient = {
|
|
|
117
119
|
userPhoneNumbers: PhoneNumbersApi;
|
|
118
120
|
applications: ApplicationsApi;
|
|
119
121
|
velo: VeloApi;
|
|
122
|
+
usernames: UsernamesApi;
|
|
120
123
|
userEmailPolicy: UserEmailPolicyApi;
|
|
121
124
|
};
|
|
122
125
|
declare const createApiClient: (appName: string) => FronteggApiClient;
|
|
@@ -169,6 +172,7 @@ declare const _default: {
|
|
|
169
172
|
userPhoneNumbers: PhoneNumbersApi;
|
|
170
173
|
applications: ApplicationsApi;
|
|
171
174
|
velo: VeloApi;
|
|
175
|
+
usernames: UsernamesApi;
|
|
172
176
|
userEmailPolicy: UserEmailPolicyApi;
|
|
173
177
|
};
|
|
174
178
|
createApiClient: (appName: string) => FronteggApiClient;
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v7.
|
|
1
|
+
/** @license Frontegg v7.76.0-alpha.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.
|
|
@@ -32,6 +32,7 @@ import DefaultSecurityCenterApi, { SecurityCenterApi } from './security-center';
|
|
|
32
32
|
import DefaultPhoneNumbersApi, { PhoneNumbersApi } from './user-phone-numbers';
|
|
33
33
|
import DefaultApplicationsApi, { ApplicationsApi } from './applications';
|
|
34
34
|
import DefaultVeloApi, { VeloApi } from './velo';
|
|
35
|
+
import DefaultUsernamesApi, { UsernamesApi } from './usernames';
|
|
35
36
|
import DefaultUserEmailPolicyApi, { UserEmailPolicyApi } from './users-emails-policy';
|
|
36
37
|
export * from './interfaces';
|
|
37
38
|
export * from './auth/interfaces';
|
|
@@ -95,6 +96,7 @@ const api = {
|
|
|
95
96
|
userPhoneNumbers: DefaultPhoneNumbersApi,
|
|
96
97
|
applications: DefaultApplicationsApi,
|
|
97
98
|
velo: DefaultVeloApi,
|
|
99
|
+
usernames: DefaultUsernamesApi,
|
|
98
100
|
userEmailPolicy: DefaultUserEmailPolicyApi
|
|
99
101
|
};
|
|
100
102
|
const createApiClient = appName => ({
|
|
@@ -122,6 +124,7 @@ const createApiClient = appName => ({
|
|
|
122
124
|
userPhoneNumbers: new PhoneNumbersApi(appName),
|
|
123
125
|
applications: new ApplicationsApi(appName),
|
|
124
126
|
velo: new VeloApi(appName),
|
|
127
|
+
usernames: new UsernamesApi(appName),
|
|
125
128
|
userEmailPolicy: new UserEmailPolicyApi(appName)
|
|
126
129
|
});
|
|
127
130
|
export { fetch, FetchClient, ContextHolder, FronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy };
|
package/node/auth/index.js
CHANGED
|
@@ -628,11 +628,19 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
|
|
|
628
628
|
});
|
|
629
629
|
};
|
|
630
630
|
this.passwordlessPreLogin = async _ref => {
|
|
631
|
+
var _usernameToTypeMapper;
|
|
631
632
|
let {
|
|
632
633
|
type
|
|
633
634
|
} = _ref,
|
|
634
635
|
body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
635
|
-
|
|
636
|
+
const usernameToTypeMapper = {
|
|
637
|
+
[_enums.AuthStrategyEnum.UsernameAndCode]: _enums.AuthStrategyEnum.Code,
|
|
638
|
+
[_enums.AuthStrategyEnum.UsernameAndMagicLink]: _enums.AuthStrategyEnum.MagicLink,
|
|
639
|
+
[_enums.AuthStrategyEnum.UsernameAndSms]: _enums.AuthStrategyEnum.SmsCode,
|
|
640
|
+
[_enums.AuthStrategyEnum.UsernameAndPassword]: _enums.AuthStrategyEnum.EmailAndPassword
|
|
641
|
+
};
|
|
642
|
+
const mappedType = ((_usernameToTypeMapper = usernameToTypeMapper[type]) == null ? void 0 : _usernameToTypeMapper.toLowerCase()) || type.toLowerCase();
|
|
643
|
+
return this.post(`${_constants2.urls.identity.auth.v1}/passwordless/${mappedType}/prelogin`, body);
|
|
636
644
|
};
|
|
637
645
|
this.passwordlessPostLoginV2 = async _ref2 => {
|
|
638
646
|
let {
|
package/node/constants.js
CHANGED
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v7.
|
|
1
|
+
/** @license Frontegg v7.76.0-alpha.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.
|
|
@@ -173,6 +173,7 @@ var _securityCenter = _interopRequireWildcard(require("./security-center"));
|
|
|
173
173
|
var _userPhoneNumbers = _interopRequireWildcard(require("./user-phone-numbers"));
|
|
174
174
|
var _applications = _interopRequireWildcard(require("./applications"));
|
|
175
175
|
var _velo = _interopRequireWildcard(require("./velo"));
|
|
176
|
+
var _usernames = _interopRequireWildcard(require("./usernames"));
|
|
176
177
|
var _usersEmailsPolicy = _interopRequireWildcard(require("./users-emails-policy"));
|
|
177
178
|
var _interfaces = require("./interfaces");
|
|
178
179
|
Object.keys(_interfaces).forEach(function (key) {
|
|
@@ -567,6 +568,7 @@ const api = {
|
|
|
567
568
|
userPhoneNumbers: _userPhoneNumbers.default,
|
|
568
569
|
applications: _applications.default,
|
|
569
570
|
velo: _velo.default,
|
|
571
|
+
usernames: _usernames.default,
|
|
570
572
|
userEmailPolicy: _usersEmailsPolicy.default
|
|
571
573
|
};
|
|
572
574
|
exports.api = api;
|
|
@@ -595,6 +597,7 @@ const createApiClient = appName => ({
|
|
|
595
597
|
userPhoneNumbers: new _userPhoneNumbers.PhoneNumbersApi(appName),
|
|
596
598
|
applications: new _applications.ApplicationsApi(appName),
|
|
597
599
|
velo: new _velo.VeloApi(appName),
|
|
600
|
+
usernames: new _usernames.UsernamesApi(appName),
|
|
598
601
|
userEmailPolicy: new _usersEmailsPolicy.UserEmailPolicyApi(appName)
|
|
599
602
|
});
|
|
600
603
|
exports.createApiClient = createApiClient;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.UsernamesApi = void 0;
|
|
7
|
+
var _BaseApiClient = require("../BaseApiClient");
|
|
8
|
+
var _constants = require("../constants");
|
|
9
|
+
class UsernamesApi extends _BaseApiClient.BaseApiClient {
|
|
10
|
+
constructor(appName) {
|
|
11
|
+
super(appName);
|
|
12
|
+
this.getUserOwnUsername = async () => {
|
|
13
|
+
return this.get(`${_constants.urls.identity.usernames.v1}/me`);
|
|
14
|
+
};
|
|
15
|
+
this.createUsername = async body => {
|
|
16
|
+
return this.post(`${_constants.urls.identity.usernames.v1}`, body);
|
|
17
|
+
};
|
|
18
|
+
this.deleteUsername = async username => {
|
|
19
|
+
return this.delete(`${_constants.urls.identity.usernames.v1}/${username}`);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get own username of user
|
|
25
|
+
*/
|
|
26
|
+
}
|
|
27
|
+
exports.UsernamesApi = UsernamesApi;
|
|
28
|
+
var _default = new UsernamesApi('default');
|
|
29
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
2
|
+
import { ICreateUsername, IGetUserOwnUsernameResponse } from './interfaces';
|
|
3
|
+
export declare class UsernamesApi extends BaseApiClient {
|
|
4
|
+
constructor(appName: string);
|
|
5
|
+
/**
|
|
6
|
+
* Get own username of user
|
|
7
|
+
*/
|
|
8
|
+
getUserOwnUsername: () => Promise<IGetUserOwnUsernameResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Create new username for user
|
|
11
|
+
*/
|
|
12
|
+
createUsername: (body: ICreateUsername) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Delete existing username for user
|
|
15
|
+
*/
|
|
16
|
+
deleteUsername: (username: string) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: UsernamesApi;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseApiClient } from '../BaseApiClient';
|
|
2
|
+
import { urls } from '../constants';
|
|
3
|
+
export class UsernamesApi extends BaseApiClient {
|
|
4
|
+
constructor(appName) {
|
|
5
|
+
super(appName);
|
|
6
|
+
this.getUserOwnUsername = async () => {
|
|
7
|
+
return this.get(`${urls.identity.usernames.v1}/me`);
|
|
8
|
+
};
|
|
9
|
+
this.createUsername = async body => {
|
|
10
|
+
return this.post(`${urls.identity.usernames.v1}`, body);
|
|
11
|
+
};
|
|
12
|
+
this.deleteUsername = async username => {
|
|
13
|
+
return this.delete(`${urls.identity.usernames.v1}/${username}`);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get own username of user
|
|
19
|
+
*/
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default new UsernamesApi('default');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|