@logto/schemas 1.30.1 → 1.31.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/alterations/1.31.0-1753689065-add-forgot-password-methods-to-sie-table.ts +20 -0
- package/alterations-js/1.31.0-1753689065-add-forgot-password-methods-to-sie-table.js +16 -0
- package/lib/consts/subscriptions.d.ts +8 -2
- package/lib/consts/subscriptions.js +7 -1
- package/lib/db-entries/sign-in-experience.d.ts +4 -2
- package/lib/db-entries/sign-in-experience.js +5 -1
- package/lib/foundations/jsonb-types/custom-profile-fields.d.ts +73 -50
- package/lib/foundations/jsonb-types/custom-profile-fields.js +3 -2
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +6 -0
- package/lib/foundations/jsonb-types/sign-in-experience.js +6 -0
- package/lib/foundations/jsonb-types/users.d.ts +0 -94
- package/lib/foundations/jsonb-types/users.js +0 -11
- package/lib/types/consent.d.ts +0 -40
- package/lib/types/custom-profile-fields.d.ts +389 -376
- package/lib/types/custom-profile-fields.js +42 -23
- package/lib/types/interactions.d.ts +0 -120
- package/lib/types/interactions.js +0 -31
- package/lib/types/logto-config/jwt-customizer.d.ts +0 -20
- package/lib/types/sign-in-experience.d.ts +7 -6
- package/lib/types/sign-in-experience.js +4 -3
- package/lib/types/user.d.ts +0 -60
- package/lib/types/verification-records/code-verification.d.ts +73 -1
- package/lib/types/verification-records/code-verification.js +14 -0
- package/lib/types/verification-records/verification-type.d.ts +2 -0
- package/lib/types/verification-records/verification-type.js +2 -0
- package/package.json +6 -6
- package/tables/sign_in_experiences.sql +1 -0
|
@@ -7,7 +7,7 @@ import { consoleUserPreferenceKey, guideRequestsKey } from './user.js';
|
|
|
7
7
|
const baseProfileFieldGuard = z.object({
|
|
8
8
|
name: z.string(),
|
|
9
9
|
type: customProfileFieldTypeGuard,
|
|
10
|
-
label: z.string(),
|
|
10
|
+
label: z.string().min(1).optional(),
|
|
11
11
|
description: z.string().optional(),
|
|
12
12
|
required: z.boolean(),
|
|
13
13
|
});
|
|
@@ -41,17 +41,20 @@ export const dateProfileFieldGuard = baseProfileFieldGuard.extend({
|
|
|
41
41
|
})
|
|
42
42
|
.optional(),
|
|
43
43
|
});
|
|
44
|
-
export const checkboxProfileFieldGuard = baseProfileFieldGuard.extend({
|
|
44
|
+
export const checkboxProfileFieldGuard = baseProfileFieldGuard.omit({ description: true }).extend({
|
|
45
45
|
type: z.literal(CustomProfileFieldType.Checkbox),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
required: z.literal(false),
|
|
47
|
+
config: z
|
|
48
|
+
.object({
|
|
49
|
+
defaultValue: z.literal('true').or(z.literal('false')),
|
|
50
|
+
})
|
|
51
|
+
.optional(),
|
|
49
52
|
});
|
|
50
53
|
export const selectProfileFieldGuard = baseProfileFieldGuard.extend({
|
|
51
54
|
type: z.literal(CustomProfileFieldType.Select),
|
|
52
55
|
config: z.object({
|
|
53
56
|
placeholder: z.string().optional(),
|
|
54
|
-
options: z.array(z.object({ label: z.string(), value: z.string() })),
|
|
57
|
+
options: z.array(z.object({ label: z.string().optional(), value: z.string() })),
|
|
55
58
|
}),
|
|
56
59
|
});
|
|
57
60
|
export const urlProfileFieldGuard = baseProfileFieldGuard.extend({
|
|
@@ -126,16 +129,9 @@ export const updateCustomProfileFieldSieOrderGuard = z.object({
|
|
|
126
129
|
name: z.string(),
|
|
127
130
|
sieOrder: z.number(),
|
|
128
131
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
primaryEmail: true,
|
|
133
|
-
primaryPhone: true,
|
|
134
|
-
})
|
|
135
|
-
.extend({
|
|
136
|
-
email: z.string().nullable().optional(),
|
|
137
|
-
phone: z.string().nullable().optional(),
|
|
138
|
-
});
|
|
132
|
+
/**
|
|
133
|
+
* Reserved custom data keys, which are used by the system and should not be used by custom profile fields.
|
|
134
|
+
*/
|
|
139
135
|
export const reservedCustomDataKeyGuard = z
|
|
140
136
|
.object({
|
|
141
137
|
[userOnboardingDataKey]: z.string(),
|
|
@@ -149,11 +145,34 @@ export const reservedCustomDataKeys = Object.freeze(reservedCustomDataKeyGuard.k
|
|
|
149
145
|
* Disallow sign-in identifiers related field keys in custom profile fields, as this is conflicting
|
|
150
146
|
* with the built-in sign-in/sign-up experience flows.
|
|
151
147
|
*/
|
|
148
|
+
export const signInIdentifierKeyGuard = Users.createGuard
|
|
149
|
+
.pick({
|
|
150
|
+
username: true,
|
|
151
|
+
primaryEmail: true,
|
|
152
|
+
primaryPhone: true,
|
|
153
|
+
})
|
|
154
|
+
.extend({
|
|
155
|
+
email: z.string().nullable().optional(),
|
|
156
|
+
phone: z.string().nullable().optional(),
|
|
157
|
+
});
|
|
152
158
|
export const reservedSignInIdentifierKeys = Object.freeze(signInIdentifierKeyGuard.keyof().options);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Reserved user profile keys.
|
|
161
|
+
* Currently only `preferredUsername` is reserved since it is the standard username property used
|
|
162
|
+
* by most identity providers. Should not allow user updating this field via profile related APIs.
|
|
163
|
+
*/
|
|
164
|
+
export const reservedBuiltInProfileKeyGuard = userProfileGuard.pick({ preferredUsername: true });
|
|
165
|
+
export const reservedBuiltInProfileKeys = Object.freeze(reservedBuiltInProfileKeyGuard.keyof().options);
|
|
166
|
+
export var SupportedDateFormat;
|
|
167
|
+
(function (SupportedDateFormat) {
|
|
168
|
+
SupportedDateFormat["US"] = "MM/dd/yyyy";
|
|
169
|
+
SupportedDateFormat["UK"] = "dd/MM/yyyy";
|
|
170
|
+
SupportedDateFormat["ISO"] = "yyyy-MM-dd";
|
|
171
|
+
SupportedDateFormat["Custom"] = "custom";
|
|
172
|
+
})(SupportedDateFormat || (SupportedDateFormat = {}));
|
|
173
|
+
export var Gender;
|
|
174
|
+
(function (Gender) {
|
|
175
|
+
Gender["Female"] = "female";
|
|
176
|
+
Gender["Male"] = "male";
|
|
177
|
+
Gender["Other"] = "prefer_not_to_say";
|
|
178
|
+
})(Gender || (Gender = {}));
|
|
@@ -587,22 +587,6 @@ export declare const bindBackupCodePayloadGuard: z.ZodObject<{
|
|
|
587
587
|
type: MfaFactor.BackupCode;
|
|
588
588
|
}>;
|
|
589
589
|
export type BindBackupCodePayload = z.infer<typeof bindBackupCodePayloadGuard>;
|
|
590
|
-
export declare const bindEmailVerificationCodePayloadGuard: z.ZodObject<{
|
|
591
|
-
type: z.ZodLiteral<MfaFactor.EmailVerificationCode>;
|
|
592
|
-
}, "strip", z.ZodTypeAny, {
|
|
593
|
-
type: MfaFactor.EmailVerificationCode;
|
|
594
|
-
}, {
|
|
595
|
-
type: MfaFactor.EmailVerificationCode;
|
|
596
|
-
}>;
|
|
597
|
-
export type BindEmailVerificationCodePayload = z.infer<typeof bindEmailVerificationCodePayloadGuard>;
|
|
598
|
-
export declare const bindPhoneVerificationCodePayloadGuard: z.ZodObject<{
|
|
599
|
-
type: z.ZodLiteral<MfaFactor.PhoneVerificationCode>;
|
|
600
|
-
}, "strip", z.ZodTypeAny, {
|
|
601
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
602
|
-
}, {
|
|
603
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
604
|
-
}>;
|
|
605
|
-
export type BindPhoneVerificationCodePayload = z.infer<typeof bindPhoneVerificationCodePayloadGuard>;
|
|
606
590
|
export declare const bindMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
607
591
|
type: z.ZodLiteral<MfaFactor.TOTP>;
|
|
608
592
|
code: z.ZodString;
|
|
@@ -713,18 +697,6 @@ export declare const bindMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
713
697
|
type: MfaFactor.BackupCode;
|
|
714
698
|
}, {
|
|
715
699
|
type: MfaFactor.BackupCode;
|
|
716
|
-
}>, z.ZodObject<{
|
|
717
|
-
type: z.ZodLiteral<MfaFactor.EmailVerificationCode>;
|
|
718
|
-
}, "strip", z.ZodTypeAny, {
|
|
719
|
-
type: MfaFactor.EmailVerificationCode;
|
|
720
|
-
}, {
|
|
721
|
-
type: MfaFactor.EmailVerificationCode;
|
|
722
|
-
}>, z.ZodObject<{
|
|
723
|
-
type: z.ZodLiteral<MfaFactor.PhoneVerificationCode>;
|
|
724
|
-
}, "strip", z.ZodTypeAny, {
|
|
725
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
726
|
-
}, {
|
|
727
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
728
700
|
}>]>;
|
|
729
701
|
export type BindMfaPayload = z.infer<typeof bindMfaPayloadGuard>;
|
|
730
702
|
/** @deprecated Legacy interaction API use only */
|
|
@@ -861,34 +833,6 @@ export declare const backupCodeVerificationPayloadGuard: z.ZodObject<{
|
|
|
861
833
|
type: MfaFactor.BackupCode;
|
|
862
834
|
}>;
|
|
863
835
|
export type BackupCodeVerificationPayload = z.infer<typeof backupCodeVerificationPayloadGuard>;
|
|
864
|
-
export declare const emailVerificationCodeVerificationPayloadGuard: z.ZodObject<{
|
|
865
|
-
type: z.ZodLiteral<MfaFactor.EmailVerificationCode>;
|
|
866
|
-
email: z.ZodString;
|
|
867
|
-
code: z.ZodString;
|
|
868
|
-
}, "strip", z.ZodTypeAny, {
|
|
869
|
-
code: string;
|
|
870
|
-
type: MfaFactor.EmailVerificationCode;
|
|
871
|
-
email: string;
|
|
872
|
-
}, {
|
|
873
|
-
code: string;
|
|
874
|
-
type: MfaFactor.EmailVerificationCode;
|
|
875
|
-
email: string;
|
|
876
|
-
}>;
|
|
877
|
-
export type EmailVerificationCodeVerificationPayload = z.infer<typeof emailVerificationCodeVerificationPayloadGuard>;
|
|
878
|
-
export declare const phoneVerificationCodeVerificationPayloadGuard: z.ZodObject<{
|
|
879
|
-
type: z.ZodLiteral<MfaFactor.PhoneVerificationCode>;
|
|
880
|
-
phone: z.ZodString;
|
|
881
|
-
code: z.ZodString;
|
|
882
|
-
}, "strip", z.ZodTypeAny, {
|
|
883
|
-
code: string;
|
|
884
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
885
|
-
phone: string;
|
|
886
|
-
}, {
|
|
887
|
-
code: string;
|
|
888
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
889
|
-
phone: string;
|
|
890
|
-
}>;
|
|
891
|
-
export type PhoneVerificationCodeVerificationPayload = z.infer<typeof phoneVerificationCodeVerificationPayloadGuard>;
|
|
892
836
|
export declare const verifyMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
893
837
|
type: z.ZodLiteral<MfaFactor.TOTP>;
|
|
894
838
|
code: z.ZodString;
|
|
@@ -1015,30 +959,6 @@ export declare const verifyMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Z
|
|
|
1015
959
|
}, {
|
|
1016
960
|
code: string;
|
|
1017
961
|
type: MfaFactor.BackupCode;
|
|
1018
|
-
}>, z.ZodObject<{
|
|
1019
|
-
type: z.ZodLiteral<MfaFactor.EmailVerificationCode>;
|
|
1020
|
-
email: z.ZodString;
|
|
1021
|
-
code: z.ZodString;
|
|
1022
|
-
}, "strip", z.ZodTypeAny, {
|
|
1023
|
-
code: string;
|
|
1024
|
-
type: MfaFactor.EmailVerificationCode;
|
|
1025
|
-
email: string;
|
|
1026
|
-
}, {
|
|
1027
|
-
code: string;
|
|
1028
|
-
type: MfaFactor.EmailVerificationCode;
|
|
1029
|
-
email: string;
|
|
1030
|
-
}>, z.ZodObject<{
|
|
1031
|
-
type: z.ZodLiteral<MfaFactor.PhoneVerificationCode>;
|
|
1032
|
-
phone: z.ZodString;
|
|
1033
|
-
code: z.ZodString;
|
|
1034
|
-
}, "strip", z.ZodTypeAny, {
|
|
1035
|
-
code: string;
|
|
1036
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
1037
|
-
phone: string;
|
|
1038
|
-
}, {
|
|
1039
|
-
code: string;
|
|
1040
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
1041
|
-
phone: string;
|
|
1042
962
|
}>]>;
|
|
1043
963
|
export type VerifyMfaPayload = z.infer<typeof verifyMfaPayloadGuard>;
|
|
1044
964
|
export declare const pendingTotpGuard: z.ZodObject<{
|
|
@@ -1191,28 +1111,6 @@ export declare const bindBackupCodeGuard: z.ZodObject<{
|
|
|
1191
1111
|
codes: string[];
|
|
1192
1112
|
}>;
|
|
1193
1113
|
export type BindBackupCode = z.infer<typeof bindBackupCodeGuard>;
|
|
1194
|
-
export declare const bindEmailVerificationCodeGuard: z.ZodObject<{
|
|
1195
|
-
type: z.ZodLiteral<MfaFactor.EmailVerificationCode>;
|
|
1196
|
-
email: z.ZodString;
|
|
1197
|
-
}, "strip", z.ZodTypeAny, {
|
|
1198
|
-
type: MfaFactor.EmailVerificationCode;
|
|
1199
|
-
email: string;
|
|
1200
|
-
}, {
|
|
1201
|
-
type: MfaFactor.EmailVerificationCode;
|
|
1202
|
-
email: string;
|
|
1203
|
-
}>;
|
|
1204
|
-
export type BindEmailVerificationCode = z.infer<typeof bindEmailVerificationCodeGuard>;
|
|
1205
|
-
export declare const bindPhoneVerificationCodeGuard: z.ZodObject<{
|
|
1206
|
-
type: z.ZodLiteral<MfaFactor.PhoneVerificationCode>;
|
|
1207
|
-
phone: z.ZodString;
|
|
1208
|
-
}, "strip", z.ZodTypeAny, {
|
|
1209
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
1210
|
-
phone: string;
|
|
1211
|
-
}, {
|
|
1212
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
1213
|
-
phone: string;
|
|
1214
|
-
}>;
|
|
1215
|
-
export type BindPhoneVerificationCode = z.infer<typeof bindPhoneVerificationCodeGuard>;
|
|
1216
1114
|
export declare const bindMfaGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1217
1115
|
type: z.ZodLiteral<MfaFactor.TOTP>;
|
|
1218
1116
|
secret: z.ZodString;
|
|
@@ -1255,24 +1153,6 @@ export declare const bindMfaGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
1255
1153
|
}, {
|
|
1256
1154
|
type: MfaFactor.BackupCode;
|
|
1257
1155
|
codes: string[];
|
|
1258
|
-
}>, z.ZodObject<{
|
|
1259
|
-
type: z.ZodLiteral<MfaFactor.EmailVerificationCode>;
|
|
1260
|
-
email: z.ZodString;
|
|
1261
|
-
}, "strip", z.ZodTypeAny, {
|
|
1262
|
-
type: MfaFactor.EmailVerificationCode;
|
|
1263
|
-
email: string;
|
|
1264
|
-
}, {
|
|
1265
|
-
type: MfaFactor.EmailVerificationCode;
|
|
1266
|
-
email: string;
|
|
1267
|
-
}>, z.ZodObject<{
|
|
1268
|
-
type: z.ZodLiteral<MfaFactor.PhoneVerificationCode>;
|
|
1269
|
-
phone: z.ZodString;
|
|
1270
|
-
}, "strip", z.ZodTypeAny, {
|
|
1271
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
1272
|
-
phone: string;
|
|
1273
|
-
}, {
|
|
1274
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
1275
|
-
phone: string;
|
|
1276
1156
|
}>]>;
|
|
1277
1157
|
export type BindMfa = z.infer<typeof bindMfaGuard>;
|
|
1278
1158
|
export declare const verifyMfaResultGuard: z.ZodObject<{
|
|
@@ -187,19 +187,10 @@ export const bindWebAuthnPayloadGuard = z.object({
|
|
|
187
187
|
export const bindBackupCodePayloadGuard = z.object({
|
|
188
188
|
type: z.literal(MfaFactor.BackupCode),
|
|
189
189
|
});
|
|
190
|
-
// TODO @sijie: Implement binding
|
|
191
|
-
export const bindEmailVerificationCodePayloadGuard = z.object({
|
|
192
|
-
type: z.literal(MfaFactor.EmailVerificationCode),
|
|
193
|
-
});
|
|
194
|
-
export const bindPhoneVerificationCodePayloadGuard = z.object({
|
|
195
|
-
type: z.literal(MfaFactor.PhoneVerificationCode),
|
|
196
|
-
});
|
|
197
190
|
export const bindMfaPayloadGuard = z.discriminatedUnion('type', [
|
|
198
191
|
bindTotpPayloadGuard,
|
|
199
192
|
bindWebAuthnPayloadGuard,
|
|
200
193
|
bindBackupCodePayloadGuard,
|
|
201
|
-
bindEmailVerificationCodePayloadGuard,
|
|
202
|
-
bindPhoneVerificationCodePayloadGuard,
|
|
203
194
|
]);
|
|
204
195
|
/** @deprecated Legacy interaction API use only */
|
|
205
196
|
export const totpVerificationPayloadGuard = bindTotpPayloadGuard;
|
|
@@ -217,22 +208,10 @@ export const backupCodeVerificationPayloadGuard = z.object({
|
|
|
217
208
|
type: z.literal(MfaFactor.BackupCode),
|
|
218
209
|
code: z.string(),
|
|
219
210
|
});
|
|
220
|
-
export const emailVerificationCodeVerificationPayloadGuard = z.object({
|
|
221
|
-
type: z.literal(MfaFactor.EmailVerificationCode),
|
|
222
|
-
email: z.string(),
|
|
223
|
-
code: z.string(),
|
|
224
|
-
});
|
|
225
|
-
export const phoneVerificationCodeVerificationPayloadGuard = z.object({
|
|
226
|
-
type: z.literal(MfaFactor.PhoneVerificationCode),
|
|
227
|
-
phone: z.string(),
|
|
228
|
-
code: z.string(),
|
|
229
|
-
});
|
|
230
211
|
export const verifyMfaPayloadGuard = z.discriminatedUnion('type', [
|
|
231
212
|
totpVerificationPayloadGuard,
|
|
232
213
|
webAuthnVerificationPayloadGuard,
|
|
233
214
|
backupCodeVerificationPayloadGuard,
|
|
234
|
-
emailVerificationCodeVerificationPayloadGuard,
|
|
235
|
-
phoneVerificationCodeVerificationPayloadGuard,
|
|
236
215
|
]);
|
|
237
216
|
export const pendingTotpGuard = z.object({
|
|
238
217
|
type: z.literal(MfaFactor.TOTP),
|
|
@@ -274,21 +253,11 @@ export const bindWebAuthnGuard = z.object({
|
|
|
274
253
|
name: z.string().optional(),
|
|
275
254
|
});
|
|
276
255
|
export const bindBackupCodeGuard = pendingBackupCodeGuard;
|
|
277
|
-
export const bindEmailVerificationCodeGuard = z.object({
|
|
278
|
-
type: z.literal(MfaFactor.EmailVerificationCode),
|
|
279
|
-
email: z.string(),
|
|
280
|
-
});
|
|
281
|
-
export const bindPhoneVerificationCodeGuard = z.object({
|
|
282
|
-
type: z.literal(MfaFactor.PhoneVerificationCode),
|
|
283
|
-
phone: z.string(),
|
|
284
|
-
});
|
|
285
256
|
// The type for binding new mfa verification to a user, not always equals to the pending type.
|
|
286
257
|
export const bindMfaGuard = z.discriminatedUnion('type', [
|
|
287
258
|
bindTotpGuard,
|
|
288
259
|
bindWebAuthnGuard,
|
|
289
260
|
bindBackupCodeGuard,
|
|
290
|
-
bindEmailVerificationCodeGuard,
|
|
291
|
-
bindPhoneVerificationCodeGuard,
|
|
292
261
|
]);
|
|
293
262
|
export const verifyMfaResultGuard = z.object({
|
|
294
263
|
type: z.nativeEnum(MfaFactor),
|
|
@@ -123,16 +123,6 @@ export declare const jwtCustomizerUserContextGuard: z.ZodObject<Pick<{
|
|
|
123
123
|
usedAt?: string | undefined;
|
|
124
124
|
}[];
|
|
125
125
|
lastUsedAt?: string | undefined;
|
|
126
|
-
} | {
|
|
127
|
-
type: import("../../foundations/index.js").MfaFactor.EmailVerificationCode;
|
|
128
|
-
id: string;
|
|
129
|
-
createdAt: string;
|
|
130
|
-
lastUsedAt?: string | undefined;
|
|
131
|
-
} | {
|
|
132
|
-
type: import("../../foundations/index.js").MfaFactor.PhoneVerificationCode;
|
|
133
|
-
id: string;
|
|
134
|
-
createdAt: string;
|
|
135
|
-
lastUsedAt?: string | undefined;
|
|
136
126
|
})[], z.ZodTypeDef, ({
|
|
137
127
|
type: import("../../foundations/index.js").MfaFactor.TOTP;
|
|
138
128
|
id: string;
|
|
@@ -159,16 +149,6 @@ export declare const jwtCustomizerUserContextGuard: z.ZodObject<Pick<{
|
|
|
159
149
|
usedAt?: string | undefined;
|
|
160
150
|
}[];
|
|
161
151
|
lastUsedAt?: string | undefined;
|
|
162
|
-
} | {
|
|
163
|
-
type: import("../../foundations/index.js").MfaFactor.EmailVerificationCode;
|
|
164
|
-
id: string;
|
|
165
|
-
createdAt: string;
|
|
166
|
-
lastUsedAt?: string | undefined;
|
|
167
|
-
} | {
|
|
168
|
-
type: import("../../foundations/index.js").MfaFactor.PhoneVerificationCode;
|
|
169
|
-
id: string;
|
|
170
|
-
createdAt: string;
|
|
171
|
-
lastUsedAt?: string | undefined;
|
|
172
152
|
})[]>;
|
|
173
153
|
isSuspended: ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
174
154
|
lastSignInAt: ZodType<number | null, z.ZodTypeDef, number | null>;
|
|
@@ -12,7 +12,7 @@ type ForgotPassword = {
|
|
|
12
12
|
* the need to load the full connector metadata that is not needed for rendering.
|
|
13
13
|
*/
|
|
14
14
|
export type ExperienceSocialConnector = Omit<ConnectorMetadata, 'description' | 'configTemplate' | 'formItems' | 'readme' | 'customData'>;
|
|
15
|
-
export type FullSignInExperience = SignInExperience & {
|
|
15
|
+
export type FullSignInExperience = Omit<SignInExperience, 'forgotPasswordMethods'> & {
|
|
16
16
|
socialConnectors: ExperienceSocialConnector[];
|
|
17
17
|
ssoConnectors: SsoConnectorMetadata[];
|
|
18
18
|
forgotPassword: ForgotPassword;
|
|
@@ -35,7 +35,7 @@ export type FullSignInExperience = SignInExperience & {
|
|
|
35
35
|
};
|
|
36
36
|
customProfileFields?: Readonly<CustomProfileField[]>;
|
|
37
37
|
};
|
|
38
|
-
export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
38
|
+
export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
|
|
39
39
|
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
40
40
|
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
41
41
|
color: z.ZodType<{
|
|
@@ -137,7 +137,8 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
|
137
137
|
}>;
|
|
138
138
|
sentinelPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy>;
|
|
139
139
|
emailBlocklistPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy>;
|
|
140
|
-
|
|
140
|
+
forgotPasswordMethods: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").ForgotPasswordMethod[] | null, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").ForgotPasswordMethod[] | null>;
|
|
141
|
+
}, "forgotPasswordMethods"> & {
|
|
141
142
|
socialConnectors: z.ZodArray<z.ZodObject<Omit<{
|
|
142
143
|
id: z.ZodString;
|
|
143
144
|
target: z.ZodString;
|
|
@@ -679,7 +680,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
|
679
680
|
type: CaptchaType;
|
|
680
681
|
siteKey: string;
|
|
681
682
|
}>>;
|
|
682
|
-
customProfileFields: z.
|
|
683
|
+
customProfileFields: z.ZodArray<import("../index.js").Guard<CustomProfileField>, "many">;
|
|
683
684
|
}, "strip", z.ZodTypeAny, {
|
|
684
685
|
id: string;
|
|
685
686
|
tenantId: string;
|
|
@@ -858,6 +859,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
|
858
859
|
phone: boolean;
|
|
859
860
|
};
|
|
860
861
|
isDevelopmentTenant: boolean;
|
|
862
|
+
customProfileFields: CustomProfileField[];
|
|
861
863
|
googleOneTap?: {
|
|
862
864
|
connectorId: string;
|
|
863
865
|
clientId: string;
|
|
@@ -870,7 +872,6 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
|
870
872
|
type: CaptchaType;
|
|
871
873
|
siteKey: string;
|
|
872
874
|
} | undefined;
|
|
873
|
-
customProfileFields?: CustomProfileField[] | undefined;
|
|
874
875
|
}, {
|
|
875
876
|
id: string;
|
|
876
877
|
tenantId: string;
|
|
@@ -1049,6 +1050,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
|
1049
1050
|
phone: boolean;
|
|
1050
1051
|
};
|
|
1051
1052
|
isDevelopmentTenant: boolean;
|
|
1053
|
+
customProfileFields: CustomProfileField[];
|
|
1052
1054
|
googleOneTap?: {
|
|
1053
1055
|
connectorId: string;
|
|
1054
1056
|
clientId: string;
|
|
@@ -1061,6 +1063,5 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
|
|
|
1061
1063
|
type: CaptchaType;
|
|
1062
1064
|
siteKey: string;
|
|
1063
1065
|
} | undefined;
|
|
1064
|
-
customProfileFields?: CustomProfileField[] | undefined;
|
|
1065
1066
|
}>;
|
|
1066
1067
|
export {};
|
|
@@ -3,7 +3,9 @@ import { z } from 'zod';
|
|
|
3
3
|
import { CustomProfileFields, SignInExperiences, } from '../db-entries/index.js';
|
|
4
4
|
import { CaptchaType } from '../foundations/jsonb-types/index.js';
|
|
5
5
|
import { ssoConnectorMetadataGuard } from './sso-connector.js';
|
|
6
|
-
export const fullSignInExperienceGuard = SignInExperiences.guard
|
|
6
|
+
export const fullSignInExperienceGuard = SignInExperiences.guard
|
|
7
|
+
.omit({ forgotPasswordMethods: true })
|
|
8
|
+
.extend({
|
|
7
9
|
socialConnectors: connectorMetadataGuard
|
|
8
10
|
.omit({
|
|
9
11
|
description: true,
|
|
@@ -25,6 +27,5 @@ export const fullSignInExperienceGuard = SignInExperiences.guard.extend({
|
|
|
25
27
|
siteKey: z.string(),
|
|
26
28
|
})
|
|
27
29
|
.optional(),
|
|
28
|
-
|
|
29
|
-
customProfileFields: CustomProfileFields.guard.array().optional(),
|
|
30
|
+
customProfileFields: CustomProfileFields.guard.array(),
|
|
30
31
|
});
|
package/lib/types/user.d.ts
CHANGED
|
@@ -89,16 +89,6 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
|
|
|
89
89
|
usedAt?: string | undefined;
|
|
90
90
|
}[];
|
|
91
91
|
lastUsedAt?: string | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
type: MfaFactor.EmailVerificationCode;
|
|
94
|
-
id: string;
|
|
95
|
-
createdAt: string;
|
|
96
|
-
lastUsedAt?: string | undefined;
|
|
97
|
-
} | {
|
|
98
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
99
|
-
id: string;
|
|
100
|
-
createdAt: string;
|
|
101
|
-
lastUsedAt?: string | undefined;
|
|
102
92
|
})[], z.ZodTypeDef, ({
|
|
103
93
|
type: MfaFactor.TOTP;
|
|
104
94
|
id: string;
|
|
@@ -125,16 +115,6 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
|
|
|
125
115
|
usedAt?: string | undefined;
|
|
126
116
|
}[];
|
|
127
117
|
lastUsedAt?: string | undefined;
|
|
128
|
-
} | {
|
|
129
|
-
type: MfaFactor.EmailVerificationCode;
|
|
130
|
-
id: string;
|
|
131
|
-
createdAt: string;
|
|
132
|
-
lastUsedAt?: string | undefined;
|
|
133
|
-
} | {
|
|
134
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
135
|
-
id: string;
|
|
136
|
-
createdAt: string;
|
|
137
|
-
lastUsedAt?: string | undefined;
|
|
138
118
|
})[]>;
|
|
139
119
|
isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
140
120
|
lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
|
|
@@ -259,16 +239,6 @@ export declare const userProfileResponseGuard: z.ZodObject<Pick<{
|
|
|
259
239
|
usedAt?: string | undefined;
|
|
260
240
|
}[];
|
|
261
241
|
lastUsedAt?: string | undefined;
|
|
262
|
-
} | {
|
|
263
|
-
type: MfaFactor.EmailVerificationCode;
|
|
264
|
-
id: string;
|
|
265
|
-
createdAt: string;
|
|
266
|
-
lastUsedAt?: string | undefined;
|
|
267
|
-
} | {
|
|
268
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
269
|
-
id: string;
|
|
270
|
-
createdAt: string;
|
|
271
|
-
lastUsedAt?: string | undefined;
|
|
272
242
|
})[], z.ZodTypeDef, ({
|
|
273
243
|
type: MfaFactor.TOTP;
|
|
274
244
|
id: string;
|
|
@@ -295,16 +265,6 @@ export declare const userProfileResponseGuard: z.ZodObject<Pick<{
|
|
|
295
265
|
usedAt?: string | undefined;
|
|
296
266
|
}[];
|
|
297
267
|
lastUsedAt?: string | undefined;
|
|
298
|
-
} | {
|
|
299
|
-
type: MfaFactor.EmailVerificationCode;
|
|
300
|
-
id: string;
|
|
301
|
-
createdAt: string;
|
|
302
|
-
lastUsedAt?: string | undefined;
|
|
303
|
-
} | {
|
|
304
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
305
|
-
id: string;
|
|
306
|
-
createdAt: string;
|
|
307
|
-
lastUsedAt?: string | undefined;
|
|
308
268
|
})[]>;
|
|
309
269
|
isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
310
270
|
lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
|
|
@@ -487,16 +447,6 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
|
|
|
487
447
|
usedAt?: string | undefined;
|
|
488
448
|
}[];
|
|
489
449
|
lastUsedAt?: string | undefined;
|
|
490
|
-
} | {
|
|
491
|
-
type: MfaFactor.EmailVerificationCode;
|
|
492
|
-
id: string;
|
|
493
|
-
createdAt: string;
|
|
494
|
-
lastUsedAt?: string | undefined;
|
|
495
|
-
} | {
|
|
496
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
497
|
-
id: string;
|
|
498
|
-
createdAt: string;
|
|
499
|
-
lastUsedAt?: string | undefined;
|
|
500
450
|
})[], z.ZodTypeDef, ({
|
|
501
451
|
type: MfaFactor.TOTP;
|
|
502
452
|
id: string;
|
|
@@ -523,16 +473,6 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
|
|
|
523
473
|
usedAt?: string | undefined;
|
|
524
474
|
}[];
|
|
525
475
|
lastUsedAt?: string | undefined;
|
|
526
|
-
} | {
|
|
527
|
-
type: MfaFactor.EmailVerificationCode;
|
|
528
|
-
id: string;
|
|
529
|
-
createdAt: string;
|
|
530
|
-
lastUsedAt?: string | undefined;
|
|
531
|
-
} | {
|
|
532
|
-
type: MfaFactor.PhoneVerificationCode;
|
|
533
|
-
id: string;
|
|
534
|
-
createdAt: string;
|
|
535
|
-
lastUsedAt?: string | undefined;
|
|
536
476
|
})[]>;
|
|
537
477
|
isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
538
478
|
lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
|
|
@@ -2,10 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
import { SignInIdentifier, TemplateType } from '../../foundations/index.js';
|
|
3
3
|
import { type VerificationCodeIdentifier } from '../interactions.js';
|
|
4
4
|
import { VerificationType } from './verification-type.js';
|
|
5
|
-
export type CodeVerificationType = VerificationType.EmailVerificationCode | VerificationType.PhoneVerificationCode;
|
|
5
|
+
export type CodeVerificationType = VerificationType.EmailVerificationCode | VerificationType.PhoneVerificationCode | VerificationType.MfaEmailVerificationCode | VerificationType.MfaPhoneVerificationCode;
|
|
6
6
|
type SignInIdentifierTypeOf = {
|
|
7
7
|
[VerificationType.EmailVerificationCode]: SignInIdentifier.Email;
|
|
8
8
|
[VerificationType.PhoneVerificationCode]: SignInIdentifier.Phone;
|
|
9
|
+
[VerificationType.MfaEmailVerificationCode]: SignInIdentifier.Email;
|
|
10
|
+
[VerificationType.MfaPhoneVerificationCode]: SignInIdentifier.Phone;
|
|
9
11
|
};
|
|
10
12
|
export type VerificationCodeIdentifierOf<T extends CodeVerificationType> = VerificationCodeIdentifier<SignInIdentifierTypeOf[T]>;
|
|
11
13
|
/** The JSON data type for the `CodeVerification` record */
|
|
@@ -86,4 +88,74 @@ export declare const phoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
|
86
88
|
templateType: TemplateType;
|
|
87
89
|
verified: boolean;
|
|
88
90
|
}>;
|
|
91
|
+
export declare const mfaEmailCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
templateType: z.ZodNativeEnum<typeof TemplateType>;
|
|
94
|
+
verified: z.ZodBoolean;
|
|
95
|
+
} & {
|
|
96
|
+
type: z.ZodLiteral<VerificationType.MfaEmailVerificationCode>;
|
|
97
|
+
identifier: z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<SignInIdentifier.Email>;
|
|
99
|
+
value: z.ZodString;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
value: string;
|
|
102
|
+
type: SignInIdentifier.Email;
|
|
103
|
+
}, {
|
|
104
|
+
value: string;
|
|
105
|
+
type: SignInIdentifier.Email;
|
|
106
|
+
}>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
type: VerificationType.MfaEmailVerificationCode;
|
|
109
|
+
id: string;
|
|
110
|
+
identifier: {
|
|
111
|
+
value: string;
|
|
112
|
+
type: SignInIdentifier.Email;
|
|
113
|
+
};
|
|
114
|
+
templateType: TemplateType;
|
|
115
|
+
verified: boolean;
|
|
116
|
+
}, {
|
|
117
|
+
type: VerificationType.MfaEmailVerificationCode;
|
|
118
|
+
id: string;
|
|
119
|
+
identifier: {
|
|
120
|
+
value: string;
|
|
121
|
+
type: SignInIdentifier.Email;
|
|
122
|
+
};
|
|
123
|
+
templateType: TemplateType;
|
|
124
|
+
verified: boolean;
|
|
125
|
+
}>;
|
|
126
|
+
export declare const mfaPhoneCodeVerificationRecordDataGuard: z.ZodObject<{
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
templateType: z.ZodNativeEnum<typeof TemplateType>;
|
|
129
|
+
verified: z.ZodBoolean;
|
|
130
|
+
} & {
|
|
131
|
+
type: z.ZodLiteral<VerificationType.MfaPhoneVerificationCode>;
|
|
132
|
+
identifier: z.ZodObject<{
|
|
133
|
+
type: z.ZodLiteral<SignInIdentifier.Phone>;
|
|
134
|
+
value: z.ZodString;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
value: string;
|
|
137
|
+
type: SignInIdentifier.Phone;
|
|
138
|
+
}, {
|
|
139
|
+
value: string;
|
|
140
|
+
type: SignInIdentifier.Phone;
|
|
141
|
+
}>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
type: VerificationType.MfaPhoneVerificationCode;
|
|
144
|
+
id: string;
|
|
145
|
+
identifier: {
|
|
146
|
+
value: string;
|
|
147
|
+
type: SignInIdentifier.Phone;
|
|
148
|
+
};
|
|
149
|
+
templateType: TemplateType;
|
|
150
|
+
verified: boolean;
|
|
151
|
+
}, {
|
|
152
|
+
type: VerificationType.MfaPhoneVerificationCode;
|
|
153
|
+
id: string;
|
|
154
|
+
identifier: {
|
|
155
|
+
value: string;
|
|
156
|
+
type: SignInIdentifier.Phone;
|
|
157
|
+
};
|
|
158
|
+
templateType: TemplateType;
|
|
159
|
+
verified: boolean;
|
|
160
|
+
}>;
|
|
89
161
|
export {};
|
|
@@ -20,3 +20,17 @@ export const phoneCodeVerificationRecordDataGuard = basicCodeVerificationRecordD
|
|
|
20
20
|
value: z.string(),
|
|
21
21
|
}),
|
|
22
22
|
});
|
|
23
|
+
export const mfaEmailCodeVerificationRecordDataGuard = basicCodeVerificationRecordDataGuard.extend({
|
|
24
|
+
type: z.literal(VerificationType.MfaEmailVerificationCode),
|
|
25
|
+
identifier: z.object({
|
|
26
|
+
type: z.literal(SignInIdentifier.Email),
|
|
27
|
+
value: z.string(),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
export const mfaPhoneCodeVerificationRecordDataGuard = basicCodeVerificationRecordDataGuard.extend({
|
|
31
|
+
type: z.literal(VerificationType.MfaPhoneVerificationCode),
|
|
32
|
+
identifier: z.object({
|
|
33
|
+
type: z.literal(SignInIdentifier.Phone),
|
|
34
|
+
value: z.string(),
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
@@ -3,6 +3,8 @@ export declare enum VerificationType {
|
|
|
3
3
|
Password = "Password",
|
|
4
4
|
EmailVerificationCode = "EmailVerificationCode",
|
|
5
5
|
PhoneVerificationCode = "PhoneVerificationCode",
|
|
6
|
+
MfaEmailVerificationCode = "MfaEmailVerificationCode",
|
|
7
|
+
MfaPhoneVerificationCode = "MfaPhoneVerificationCode",
|
|
6
8
|
Social = "Social",
|
|
7
9
|
EnterpriseSso = "EnterpriseSso",
|
|
8
10
|
TOTP = "Totp",
|
|
@@ -4,6 +4,8 @@ export var VerificationType;
|
|
|
4
4
|
VerificationType["Password"] = "Password";
|
|
5
5
|
VerificationType["EmailVerificationCode"] = "EmailVerificationCode";
|
|
6
6
|
VerificationType["PhoneVerificationCode"] = "PhoneVerificationCode";
|
|
7
|
+
VerificationType["MfaEmailVerificationCode"] = "MfaEmailVerificationCode";
|
|
8
|
+
VerificationType["MfaPhoneVerificationCode"] = "MfaPhoneVerificationCode";
|
|
7
9
|
VerificationType["Social"] = "Social";
|
|
8
10
|
VerificationType["EnterpriseSso"] = "EnterpriseSso";
|
|
9
11
|
VerificationType["TOTP"] = "Totp";
|