1
+ /* eslint-disable max-lines */
1
2
import type { BindMfa , CreateUser , MfaVerification , Scope , User } from '@logto/schemas' ;
2
3
import { MfaFactor , RoleType , Users , UsersPasswordEncryptionMethod } from '@logto/schemas' ;
3
4
import { generateStandardShortId , generateStandardId } from '@logto/shared' ;
@@ -123,14 +124,19 @@ export const createUserLibrary = (queries: Queries) => {
123
124
jsonbMode ?: 'replace' | 'merge'
124
125
) => {
125
126
const validPhoneNumber = conditional (
126
- 'primaryPhone' in set &&
127
- typeof set . primaryPhone === 'string' &&
128
- getValidPhoneNumber ( set . primaryPhone )
127
+ typeof set . primaryPhone === 'string' && getValidPhoneNumber ( set . primaryPhone )
129
128
) ;
130
129
131
130
return updateUserByIdQuery (
132
131
id ,
133
- { ...set , ...conditional ( validPhoneNumber && { primaryPhone : validPhoneNumber } ) } ,
132
+ {
133
+ ...set ,
134
+ ...conditional (
135
+ validPhoneNumber && {
136
+ primaryPhone : validPhoneNumber ,
137
+ }
138
+ ) ,
139
+ } ,
134
140
jsonbMode
135
141
) ;
136
142
} ;
@@ -148,9 +154,7 @@ export const createUserLibrary = (queries: Queries) => {
148
154
assertThat ( parameterRoles . length === roleNames . length , 'role.default_role_missing' ) ;
149
155
150
156
const validPhoneNumber = conditional (
151
- 'primaryPhone' in data &&
152
- typeof data . primaryPhone === 'string' &&
153
- getValidPhoneNumber ( data . primaryPhone )
157
+ typeof data . primaryPhone === 'string' && getValidPhoneNumber ( data . primaryPhone )
154
158
) ;
155
159
156
160
return pool . transaction ( async ( connection ) => {
@@ -368,3 +372,4 @@ export const createUserLibrary = (queries: Queries) => {
368
372
updateUserById,
369
373
} ;
370
374
} ;
375
+ /* eslint-enable max-lines */
0 commit comments