mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(core): rename some file names and methods (#6321)
* refactor(core): rename some files name and methods rename some files name and methods, fix some comments * chore: update comments update comments * chore: update comments update comments * chore: polish the words polish the words
This commit is contained in:
parent
d7b6987b48
commit
29e9bfce03
9 changed files with 19 additions and 17 deletions
|
@ -14,11 +14,11 @@ import {
|
|||
getNewUserProfileFromVerificationRecord,
|
||||
identifyUserByVerificationRecord,
|
||||
} from './helpers.js';
|
||||
import { MfaValidator } from './libraries/mfa-validator.js';
|
||||
import { ProfileValidator } from './libraries/profile-validator.js';
|
||||
import { ProvisionLibrary } from './libraries/provision-library.js';
|
||||
import { SignInExperienceValidator } from './libraries/sign-in-experience-validator.js';
|
||||
import { toUserSocialIdentityData } from './utils.js';
|
||||
import { MfaValidator } from './validators/mfa-validator.js';
|
||||
import { ProfileValidator } from './validators/profile-validator.js';
|
||||
import { ProvisionLibrary } from './validators/provision-library.js';
|
||||
import { SignInExperienceValidator } from './validators/sign-in-experience-validator.js';
|
||||
import {
|
||||
buildVerificationRecord,
|
||||
verificationRecordDataGuard,
|
||||
|
@ -283,7 +283,7 @@ export default class ExperienceInteraction {
|
|||
// TODO: missing profile fields validation
|
||||
|
||||
if (enterpriseSsoIdentity) {
|
||||
await this.provisionLibrary.provisionNewSsoIdentity(user.id, enterpriseSsoIdentity);
|
||||
await this.provisionLibrary.addSsoIdentityToUser(user.id, enterpriseSsoIdentity);
|
||||
}
|
||||
|
||||
const { provider } = this.tenant;
|
||||
|
@ -361,7 +361,7 @@ export default class ExperienceInteraction {
|
|||
const newProfile = await getNewUserProfileFromVerificationRecord(verificationRecord);
|
||||
await this.profileValidator.guardProfileUniquenessAcrossUsers(newProfile);
|
||||
|
||||
const user = await this.provisionLibrary.provisionNewUser(newProfile);
|
||||
const user = await this.provisionLibrary.createUser(newProfile);
|
||||
|
||||
this.userId = user.id;
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@ export class ProvisionLibrary {
|
|||
/**
|
||||
* Insert a new user into the Logto database using the provided profile.
|
||||
*
|
||||
* - Provision the organization for the new user based on the profile
|
||||
* - OSS only, new user provisioning
|
||||
* - Provision all JIT organizations for the user if necessary.
|
||||
* - Assign the first user to the admin role and the default tenant organization membership. [OSS only]
|
||||
*/
|
||||
async provisionNewUser(profile: InteractionProfile) {
|
||||
async createUser(profile: InteractionProfile) {
|
||||
const {
|
||||
libraries: {
|
||||
users: { generateUserId, insertUser },
|
||||
|
@ -89,7 +89,7 @@ export class ProvisionLibrary {
|
|||
return user;
|
||||
}
|
||||
|
||||
async provisionNewSsoIdentity(
|
||||
async addSsoIdentityToUser(
|
||||
userId: string,
|
||||
enterpriseSsoIdentity: Required<InteractionProfile>['enterpriseSsoIdentity']
|
||||
) {
|
|
@ -13,10 +13,10 @@ import type Libraries from '#src/tenants/Libraries.js';
|
|||
import type Queries from '#src/tenants/Queries.js';
|
||||
import assertThat from '#src/utils/assert-that.js';
|
||||
|
||||
import { PasswordValidator } from '../libraries/password-validator.js';
|
||||
import { ProfileValidator } from '../libraries/profile-validator.js';
|
||||
import { SignInExperienceValidator } from '../libraries/sign-in-experience-validator.js';
|
||||
import { interactionIdentifierToUserProfile } from '../utils.js';
|
||||
import { PasswordValidator } from '../validators/password-validator.js';
|
||||
import { ProfileValidator } from '../validators/profile-validator.js';
|
||||
import { SignInExperienceValidator } from '../validators/sign-in-experience-validator.js';
|
||||
|
||||
import { type VerificationRecord } from './verification-record.js';
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
/**
|
||||
* @fileoverview
|
||||
*
|
||||
* Since `Map` in TS does not support key value type mapping,
|
||||
* we have to manually define a `setValue` method to ensure correct key will be set
|
||||
* This class is used to store and manage all the verification records.
|
||||
*
|
||||
* Extends the Map class and adds a `setValue` method to ensure the key value type mapping.
|
||||
* Since `Map` in TS does not support key - value type mapping,
|
||||
* we have to manually define a `setValue` method to ensure correct key will be set.
|
||||
*
|
||||
* - Extends the Map class and add a `setValue` method to ensure the key value type mapping.
|
||||
* - Override the `get` method to return the correct value type.
|
||||
* - Override the `set` method to throw an error to prevent using it directly.
|
||||
*/
|
||||
|
||||
import { type VerificationType } from '@logto/schemas';
|
||||
|
||||
import { type VerificationRecord, type VerificationRecordMap } from './index.js';
|
||||
|
|
Loading…
Reference in a new issue