@frontegg/rest-api 7.73.0 → 7.74.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/index.js +1 -1
- package/node/auth/index.js +9 -1
- package/node/index.js +1 -1
- package/package.json +1 -1
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/index.js
CHANGED
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/index.js
CHANGED