@authhero/kysely-adapter 10.112.0 → 10.113.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/dist/kysely-adapter.cjs +2 -2
- package/dist/kysely-adapter.d.ts +106 -23
- package/dist/kysely-adapter.mjs +59 -17
- package/package.json +2 -2
package/dist/kysely-adapter.d.ts
CHANGED
|
@@ -18107,45 +18107,78 @@ declare const promptScreenSchema: z.ZodEnum<[
|
|
|
18107
18107
|
export type PromptScreen = z.infer<typeof promptScreenSchema>;
|
|
18108
18108
|
declare const customTextSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18109
18109
|
export type CustomText = z.infer<typeof customTextSchema>;
|
|
18110
|
-
declare const
|
|
18110
|
+
declare const authenticationMethodInsertSchema: z.ZodEffects<z.ZodObject<{
|
|
18111
18111
|
user_id: z.ZodString;
|
|
18112
18112
|
type: z.ZodEnum<[
|
|
18113
18113
|
"phone",
|
|
18114
18114
|
"totp",
|
|
18115
18115
|
"email",
|
|
18116
18116
|
"push",
|
|
18117
|
-
"webauthn"
|
|
18117
|
+
"webauthn-roaming",
|
|
18118
|
+
"webauthn-platform",
|
|
18119
|
+
"passkey"
|
|
18118
18120
|
]>;
|
|
18119
18121
|
phone_number: z.ZodOptional<z.ZodString>;
|
|
18120
18122
|
totp_secret: z.ZodOptional<z.ZodString>;
|
|
18123
|
+
credential_id: z.ZodOptional<z.ZodString>;
|
|
18124
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
18125
|
+
sign_count: z.ZodOptional<z.ZodNumber>;
|
|
18126
|
+
credential_backed_up: z.ZodOptional<z.ZodBoolean>;
|
|
18127
|
+
transports: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18128
|
+
friendly_name: z.ZodOptional<z.ZodString>;
|
|
18121
18129
|
confirmed: z.ZodDefault<z.ZodBoolean>;
|
|
18122
18130
|
}, "strip", z.ZodTypeAny, {
|
|
18123
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18131
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18124
18132
|
user_id: string;
|
|
18125
18133
|
confirmed: boolean;
|
|
18126
18134
|
phone_number?: string | undefined;
|
|
18135
|
+
friendly_name?: string | undefined;
|
|
18127
18136
|
totp_secret?: string | undefined;
|
|
18137
|
+
credential_id?: string | undefined;
|
|
18138
|
+
public_key?: string | undefined;
|
|
18139
|
+
sign_count?: number | undefined;
|
|
18140
|
+
credential_backed_up?: boolean | undefined;
|
|
18141
|
+
transports?: string[] | undefined;
|
|
18128
18142
|
}, {
|
|
18129
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18143
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18130
18144
|
user_id: string;
|
|
18131
18145
|
phone_number?: string | undefined;
|
|
18146
|
+
friendly_name?: string | undefined;
|
|
18132
18147
|
totp_secret?: string | undefined;
|
|
18148
|
+
credential_id?: string | undefined;
|
|
18149
|
+
public_key?: string | undefined;
|
|
18150
|
+
sign_count?: number | undefined;
|
|
18151
|
+
credential_backed_up?: boolean | undefined;
|
|
18152
|
+
transports?: string[] | undefined;
|
|
18133
18153
|
confirmed?: boolean | undefined;
|
|
18134
18154
|
}>, {
|
|
18135
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18155
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18136
18156
|
user_id: string;
|
|
18137
18157
|
confirmed: boolean;
|
|
18138
18158
|
phone_number?: string | undefined;
|
|
18159
|
+
friendly_name?: string | undefined;
|
|
18139
18160
|
totp_secret?: string | undefined;
|
|
18161
|
+
credential_id?: string | undefined;
|
|
18162
|
+
public_key?: string | undefined;
|
|
18163
|
+
sign_count?: number | undefined;
|
|
18164
|
+
credential_backed_up?: boolean | undefined;
|
|
18165
|
+
transports?: string[] | undefined;
|
|
18140
18166
|
}, {
|
|
18141
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18167
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18142
18168
|
user_id: string;
|
|
18143
18169
|
phone_number?: string | undefined;
|
|
18170
|
+
friendly_name?: string | undefined;
|
|
18144
18171
|
totp_secret?: string | undefined;
|
|
18172
|
+
credential_id?: string | undefined;
|
|
18173
|
+
public_key?: string | undefined;
|
|
18174
|
+
sign_count?: number | undefined;
|
|
18175
|
+
credential_backed_up?: boolean | undefined;
|
|
18176
|
+
transports?: string[] | undefined;
|
|
18145
18177
|
confirmed?: boolean | undefined;
|
|
18146
18178
|
}>;
|
|
18147
|
-
export type
|
|
18148
|
-
|
|
18179
|
+
export type AuthenticationMethodInsert = z.infer<typeof authenticationMethodInsertSchema>;
|
|
18180
|
+
export type AuthenticationMethodUpdate = Partial<Omit<AuthenticationMethodInsert, "user_id" | "type">>;
|
|
18181
|
+
declare const authenticationMethodSchema: z.ZodEffects<z.ZodObject<{
|
|
18149
18182
|
id: z.ZodString;
|
|
18150
18183
|
created_at: z.ZodString;
|
|
18151
18184
|
updated_at: z.ZodString;
|
|
@@ -18155,49 +18188,81 @@ declare const mfaEnrollmentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
18155
18188
|
"totp",
|
|
18156
18189
|
"email",
|
|
18157
18190
|
"push",
|
|
18158
|
-
"webauthn"
|
|
18191
|
+
"webauthn-roaming",
|
|
18192
|
+
"webauthn-platform",
|
|
18193
|
+
"passkey"
|
|
18159
18194
|
]>;
|
|
18160
18195
|
phone_number: z.ZodOptional<z.ZodString>;
|
|
18161
18196
|
totp_secret: z.ZodOptional<z.ZodString>;
|
|
18197
|
+
credential_id: z.ZodOptional<z.ZodString>;
|
|
18198
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
18199
|
+
sign_count: z.ZodOptional<z.ZodNumber>;
|
|
18200
|
+
credential_backed_up: z.ZodOptional<z.ZodBoolean>;
|
|
18201
|
+
transports: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18202
|
+
friendly_name: z.ZodOptional<z.ZodString>;
|
|
18162
18203
|
confirmed: z.ZodDefault<z.ZodBoolean>;
|
|
18163
18204
|
}, "strip", z.ZodTypeAny, {
|
|
18164
18205
|
created_at: string;
|
|
18165
18206
|
updated_at: string;
|
|
18166
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18207
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18167
18208
|
id: string;
|
|
18168
18209
|
user_id: string;
|
|
18169
18210
|
confirmed: boolean;
|
|
18170
18211
|
phone_number?: string | undefined;
|
|
18212
|
+
friendly_name?: string | undefined;
|
|
18171
18213
|
totp_secret?: string | undefined;
|
|
18214
|
+
credential_id?: string | undefined;
|
|
18215
|
+
public_key?: string | undefined;
|
|
18216
|
+
sign_count?: number | undefined;
|
|
18217
|
+
credential_backed_up?: boolean | undefined;
|
|
18218
|
+
transports?: string[] | undefined;
|
|
18172
18219
|
}, {
|
|
18173
18220
|
created_at: string;
|
|
18174
18221
|
updated_at: string;
|
|
18175
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18222
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18176
18223
|
id: string;
|
|
18177
18224
|
user_id: string;
|
|
18178
18225
|
phone_number?: string | undefined;
|
|
18226
|
+
friendly_name?: string | undefined;
|
|
18179
18227
|
totp_secret?: string | undefined;
|
|
18228
|
+
credential_id?: string | undefined;
|
|
18229
|
+
public_key?: string | undefined;
|
|
18230
|
+
sign_count?: number | undefined;
|
|
18231
|
+
credential_backed_up?: boolean | undefined;
|
|
18232
|
+
transports?: string[] | undefined;
|
|
18180
18233
|
confirmed?: boolean | undefined;
|
|
18181
18234
|
}>, {
|
|
18182
18235
|
created_at: string;
|
|
18183
18236
|
updated_at: string;
|
|
18184
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18237
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18185
18238
|
id: string;
|
|
18186
18239
|
user_id: string;
|
|
18187
18240
|
confirmed: boolean;
|
|
18188
18241
|
phone_number?: string | undefined;
|
|
18242
|
+
friendly_name?: string | undefined;
|
|
18189
18243
|
totp_secret?: string | undefined;
|
|
18244
|
+
credential_id?: string | undefined;
|
|
18245
|
+
public_key?: string | undefined;
|
|
18246
|
+
sign_count?: number | undefined;
|
|
18247
|
+
credential_backed_up?: boolean | undefined;
|
|
18248
|
+
transports?: string[] | undefined;
|
|
18190
18249
|
}, {
|
|
18191
18250
|
created_at: string;
|
|
18192
18251
|
updated_at: string;
|
|
18193
|
-
type: "push" | "email" | "phone" | "totp" | "webauthn";
|
|
18252
|
+
type: "push" | "email" | "passkey" | "phone" | "totp" | "webauthn-roaming" | "webauthn-platform";
|
|
18194
18253
|
id: string;
|
|
18195
18254
|
user_id: string;
|
|
18196
18255
|
phone_number?: string | undefined;
|
|
18256
|
+
friendly_name?: string | undefined;
|
|
18197
18257
|
totp_secret?: string | undefined;
|
|
18258
|
+
credential_id?: string | undefined;
|
|
18259
|
+
public_key?: string | undefined;
|
|
18260
|
+
sign_count?: number | undefined;
|
|
18261
|
+
credential_backed_up?: boolean | undefined;
|
|
18262
|
+
transports?: string[] | undefined;
|
|
18198
18263
|
confirmed?: boolean | undefined;
|
|
18199
18264
|
}>;
|
|
18200
|
-
export type
|
|
18265
|
+
export type AuthenticationMethod = z.infer<typeof authenticationMethodSchema>;
|
|
18201
18266
|
export interface ListFlowsResponse extends Totals {
|
|
18202
18267
|
flows: Flow[];
|
|
18203
18268
|
}
|
|
@@ -18540,12 +18605,12 @@ export interface GeoAdapter {
|
|
|
18540
18605
|
*/
|
|
18541
18606
|
getGeoInfo(headers: Record<string, string>): Promise<GeoInfo | null>;
|
|
18542
18607
|
}
|
|
18543
|
-
export interface
|
|
18544
|
-
create: (tenant_id: string,
|
|
18545
|
-
get: (tenant_id: string,
|
|
18546
|
-
list: (tenant_id: string, user_id: string) => Promise<
|
|
18547
|
-
update: (tenant_id: string,
|
|
18548
|
-
remove: (tenant_id: string,
|
|
18608
|
+
export interface AuthenticationMethodsAdapter {
|
|
18609
|
+
create: (tenant_id: string, method: AuthenticationMethodInsert) => Promise<AuthenticationMethod>;
|
|
18610
|
+
get: (tenant_id: string, method_id: string) => Promise<AuthenticationMethod | null>;
|
|
18611
|
+
list: (tenant_id: string, user_id: string) => Promise<AuthenticationMethod[]>;
|
|
18612
|
+
update: (tenant_id: string, method_id: string, data: AuthenticationMethodUpdate) => Promise<AuthenticationMethod>;
|
|
18613
|
+
remove: (tenant_id: string, method_id: string) => Promise<boolean>;
|
|
18549
18614
|
}
|
|
18550
18615
|
export interface StatsListParams {
|
|
18551
18616
|
from?: string;
|
|
@@ -18633,7 +18698,7 @@ export interface DataAdapters {
|
|
|
18633
18698
|
users: UserDataAdapter;
|
|
18634
18699
|
userRoles: UserRolesAdapter;
|
|
18635
18700
|
organizations: OrganizationsAdapter;
|
|
18636
|
-
|
|
18701
|
+
authenticationMethods: AuthenticationMethodsAdapter;
|
|
18637
18702
|
userOrganizations: UserOrganizationsAdapter;
|
|
18638
18703
|
/**
|
|
18639
18704
|
* Optional session cleanup function.
|
|
@@ -20763,13 +20828,19 @@ declare const sqlClientSchema: z.ZodObject<{
|
|
|
20763
20828
|
compliance_level?: "none" | "fapi1_adv_pkj_par" | "fapi1_adv_mtls_par" | "fapi2_sp_pkj_mtls" | "fapi2_sp_mtls_mtls" | undefined;
|
|
20764
20829
|
par_request_expiry?: number | undefined;
|
|
20765
20830
|
}>;
|
|
20766
|
-
declare const
|
|
20831
|
+
declare const sqlAuthenticationMethodSchema: z.ZodObject<{
|
|
20767
20832
|
id: z.ZodString;
|
|
20768
20833
|
tenant_id: z.ZodString;
|
|
20769
20834
|
user_id: z.ZodString;
|
|
20770
20835
|
type: z.ZodString;
|
|
20771
20836
|
phone_number: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20772
20837
|
totp_secret: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20838
|
+
credential_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20839
|
+
public_key: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20840
|
+
sign_count: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
20841
|
+
credential_backed_up: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
20842
|
+
transports: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20843
|
+
friendly_name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20773
20844
|
confirmed: z.ZodNumber;
|
|
20774
20845
|
created_at_ts: z.ZodNumber;
|
|
20775
20846
|
updated_at_ts: z.ZodNumber;
|
|
@@ -20782,7 +20853,13 @@ declare const sqlMfaEnrollmentSchema: z.ZodObject<{
|
|
|
20782
20853
|
id: string;
|
|
20783
20854
|
confirmed: number;
|
|
20784
20855
|
phone_number?: string | null | undefined;
|
|
20856
|
+
friendly_name?: string | null | undefined;
|
|
20785
20857
|
totp_secret?: string | null | undefined;
|
|
20858
|
+
credential_id?: string | null | undefined;
|
|
20859
|
+
public_key?: string | null | undefined;
|
|
20860
|
+
sign_count?: number | null | undefined;
|
|
20861
|
+
credential_backed_up?: number | null | undefined;
|
|
20862
|
+
transports?: string | null | undefined;
|
|
20786
20863
|
}, {
|
|
20787
20864
|
type: string;
|
|
20788
20865
|
tenant_id: string;
|
|
@@ -20792,7 +20869,13 @@ declare const sqlMfaEnrollmentSchema: z.ZodObject<{
|
|
|
20792
20869
|
id: string;
|
|
20793
20870
|
confirmed: number;
|
|
20794
20871
|
phone_number?: string | null | undefined;
|
|
20872
|
+
friendly_name?: string | null | undefined;
|
|
20795
20873
|
totp_secret?: string | null | undefined;
|
|
20874
|
+
credential_id?: string | null | undefined;
|
|
20875
|
+
public_key?: string | null | undefined;
|
|
20876
|
+
sign_count?: number | null | undefined;
|
|
20877
|
+
credential_backed_up?: number | null | undefined;
|
|
20878
|
+
transports?: string | null | undefined;
|
|
20796
20879
|
}>;
|
|
20797
20880
|
export interface Database {
|
|
20798
20881
|
flows: z.infer<typeof sqlFlowSchema>;
|
|
@@ -20829,7 +20912,7 @@ export interface Database {
|
|
|
20829
20912
|
invites: z.infer<typeof sqlInviteSchema>;
|
|
20830
20913
|
universal_login_templates: z.infer<typeof sqlUniversalLoginTemplateSchema>;
|
|
20831
20914
|
custom_text: z.infer<typeof sqlCustomTextSchema>;
|
|
20832
|
-
|
|
20915
|
+
authentication_methods: z.infer<typeof sqlAuthenticationMethodSchema>;
|
|
20833
20916
|
}
|
|
20834
20917
|
export declare function migrateToLatest(db: Kysely<Database>, debug?: boolean): Promise<void>;
|
|
20835
20918
|
export declare function migrateDown(db: Kysely<Database>): Promise<void>;
|
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -282,8 +282,8 @@ function Re(e) {
|
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
function Me(e) {
|
|
285
|
-
return async (t, a) => (await e.deleteFrom("
|
|
286
|
-
"
|
|
285
|
+
return async (t, a) => (await e.deleteFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where(
|
|
286
|
+
"authentication_methods.user_id",
|
|
287
287
|
"in",
|
|
288
288
|
(o) => o.selectFrom("users").select("users.user_id").where("users.tenant_id", "=", t).where(
|
|
289
289
|
(r) => r.or([
|
|
@@ -528,7 +528,13 @@ function Ve(e) {
|
|
|
528
528
|
function Xe(e) {
|
|
529
529
|
return async (t) => {
|
|
530
530
|
let a = e.selectFrom("tenants");
|
|
531
|
-
const {
|
|
531
|
+
const {
|
|
532
|
+
page: n = 0,
|
|
533
|
+
per_page: o = 50,
|
|
534
|
+
include_totals: r = !1,
|
|
535
|
+
sort: s,
|
|
536
|
+
q: i
|
|
537
|
+
} = t || {};
|
|
532
538
|
if (s && s.sort_by) {
|
|
533
539
|
const { ref: _ } = e.dynamic;
|
|
534
540
|
a = a.orderBy(_(s.sort_by), s.sort_order);
|
|
@@ -3419,13 +3425,19 @@ function no(e) {
|
|
|
3419
3425
|
function oo(e) {
|
|
3420
3426
|
return async (t, a) => {
|
|
3421
3427
|
const n = Date.now(), o = fe();
|
|
3422
|
-
return await e.insertInto("
|
|
3428
|
+
return await e.insertInto("authentication_methods").values({
|
|
3423
3429
|
id: o,
|
|
3424
3430
|
tenant_id: t,
|
|
3425
3431
|
user_id: a.user_id,
|
|
3426
3432
|
type: a.type,
|
|
3427
3433
|
phone_number: a.phone_number,
|
|
3428
3434
|
totp_secret: a.totp_secret,
|
|
3435
|
+
credential_id: a.credential_id,
|
|
3436
|
+
public_key: a.public_key,
|
|
3437
|
+
sign_count: a.sign_count,
|
|
3438
|
+
credential_backed_up: a.credential_backed_up == null ? void 0 : a.credential_backed_up ? 1 : 0,
|
|
3439
|
+
transports: a.transports ? JSON.stringify(a.transports) : void 0,
|
|
3440
|
+
friendly_name: a.friendly_name,
|
|
3429
3441
|
confirmed: a.confirmed ? 1 : 0,
|
|
3430
3442
|
created_at_ts: n,
|
|
3431
3443
|
updated_at_ts: n
|
|
@@ -3435,6 +3447,12 @@ function oo(e) {
|
|
|
3435
3447
|
type: a.type,
|
|
3436
3448
|
phone_number: a.phone_number,
|
|
3437
3449
|
totp_secret: a.totp_secret,
|
|
3450
|
+
credential_id: a.credential_id,
|
|
3451
|
+
public_key: a.public_key,
|
|
3452
|
+
sign_count: a.sign_count,
|
|
3453
|
+
credential_backed_up: a.credential_backed_up,
|
|
3454
|
+
transports: a.transports,
|
|
3455
|
+
friendly_name: a.friendly_name,
|
|
3438
3456
|
confirmed: a.confirmed ?? !1,
|
|
3439
3457
|
created_at: new Date(n).toISOString(),
|
|
3440
3458
|
updated_at: new Date(n).toISOString()
|
|
@@ -3443,13 +3461,19 @@ function oo(e) {
|
|
|
3443
3461
|
}
|
|
3444
3462
|
function ge(e) {
|
|
3445
3463
|
return async (t, a) => {
|
|
3446
|
-
const n = await e.selectFrom("
|
|
3464
|
+
const n = await e.selectFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", a).selectAll().executeTakeFirst();
|
|
3447
3465
|
return n ? {
|
|
3448
3466
|
id: n.id,
|
|
3449
3467
|
user_id: n.user_id,
|
|
3450
3468
|
type: n.type,
|
|
3451
3469
|
phone_number: n.phone_number ?? void 0,
|
|
3452
3470
|
totp_secret: n.totp_secret ?? void 0,
|
|
3471
|
+
credential_id: n.credential_id ?? void 0,
|
|
3472
|
+
public_key: n.public_key ?? void 0,
|
|
3473
|
+
sign_count: n.sign_count ?? void 0,
|
|
3474
|
+
credential_backed_up: n.credential_backed_up != null ? n.credential_backed_up === 1 : void 0,
|
|
3475
|
+
transports: n.transports ? JSON.parse(n.transports) : void 0,
|
|
3476
|
+
friendly_name: n.friendly_name ?? void 0,
|
|
3453
3477
|
confirmed: n.confirmed === 1,
|
|
3454
3478
|
created_at: M(n.created_at_ts),
|
|
3455
3479
|
updated_at: M(n.updated_at_ts)
|
|
@@ -3457,12 +3481,18 @@ function ge(e) {
|
|
|
3457
3481
|
};
|
|
3458
3482
|
}
|
|
3459
3483
|
function ro(e) {
|
|
3460
|
-
return async (t, a) => (await e.selectFrom("
|
|
3484
|
+
return async (t, a) => (await e.selectFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.user_id", "=", a).selectAll().execute()).map((o) => ({
|
|
3461
3485
|
id: o.id,
|
|
3462
3486
|
user_id: o.user_id,
|
|
3463
3487
|
type: o.type,
|
|
3464
3488
|
phone_number: o.phone_number ?? void 0,
|
|
3465
3489
|
totp_secret: o.totp_secret ?? void 0,
|
|
3490
|
+
credential_id: o.credential_id ?? void 0,
|
|
3491
|
+
public_key: o.public_key ?? void 0,
|
|
3492
|
+
sign_count: o.sign_count ?? void 0,
|
|
3493
|
+
credential_backed_up: o.credential_backed_up != null ? o.credential_backed_up === 1 : void 0,
|
|
3494
|
+
transports: o.transports ? JSON.parse(o.transports) : void 0,
|
|
3495
|
+
friendly_name: o.friendly_name ?? void 0,
|
|
3466
3496
|
confirmed: o.confirmed === 1,
|
|
3467
3497
|
created_at: M(o.created_at_ts),
|
|
3468
3498
|
updated_at: M(o.updated_at_ts)
|
|
@@ -3473,15 +3503,15 @@ function so(e) {
|
|
|
3473
3503
|
const r = {
|
|
3474
3504
|
updated_at_ts: Date.now()
|
|
3475
3505
|
};
|
|
3476
|
-
n.phone_number !== void 0 && (r.phone_number = n.phone_number), n.totp_secret !== void 0 && (r.totp_secret = n.totp_secret), n.confirmed !== void 0 && (r.confirmed = n.confirmed ? 1 : 0), await e.updateTable("
|
|
3506
|
+
n.phone_number !== void 0 && (r.phone_number = n.phone_number), n.totp_secret !== void 0 && (r.totp_secret = n.totp_secret), n.credential_id !== void 0 && (r.credential_id = n.credential_id), n.public_key !== void 0 && (r.public_key = n.public_key), n.sign_count !== void 0 && (r.sign_count = n.sign_count), n.credential_backed_up !== void 0 && (r.credential_backed_up = n.credential_backed_up ? 1 : 0), n.transports !== void 0 && (r.transports = JSON.stringify(n.transports)), n.friendly_name !== void 0 && (r.friendly_name = n.friendly_name), n.confirmed !== void 0 && (r.confirmed = n.confirmed ? 1 : 0), await e.updateTable("authentication_methods").set(r).where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", a).execute();
|
|
3477
3507
|
const s = await ge(e)(t, a);
|
|
3478
3508
|
if (!s)
|
|
3479
|
-
throw new Error(`
|
|
3509
|
+
throw new Error(`Authentication method ${a} not found`);
|
|
3480
3510
|
return s;
|
|
3481
3511
|
};
|
|
3482
3512
|
}
|
|
3483
3513
|
function io(e) {
|
|
3484
|
-
return async (t, a) => (await e.deleteFrom("
|
|
3514
|
+
return async (t, a) => (await e.deleteFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
3485
3515
|
}
|
|
3486
3516
|
function co(e) {
|
|
3487
3517
|
return {
|
|
@@ -6164,6 +6194,17 @@ const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
6164
6194
|
__proto__: null,
|
|
6165
6195
|
down: Uu,
|
|
6166
6196
|
up: qu
|
|
6197
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6198
|
+
async function Qu(e) {
|
|
6199
|
+
await e.schema.alterTable("mfa_enrollments").renameTo("authentication_methods").execute(), await e.schema.alterTable("authentication_methods").addColumn("credential_id", "varchar(512)").execute(), await e.schema.alterTable("authentication_methods").addColumn("public_key", "text").execute(), await e.schema.alterTable("authentication_methods").addColumn("sign_count", "integer").execute(), await e.schema.alterTable("authentication_methods").addColumn("credential_backed_up", "integer").execute(), await e.schema.alterTable("authentication_methods").addColumn("transports", "varchar(512)").execute(), await e.schema.alterTable("authentication_methods").addColumn("friendly_name", "varchar(255)").execute(), await e.schema.createIndex("authentication_methods_credential_id_idx").on("authentication_methods").column("credential_id").execute();
|
|
6200
|
+
}
|
|
6201
|
+
async function Hu(e) {
|
|
6202
|
+
await e.schema.dropIndex("authentication_methods_credential_id_idx").execute(), await e.schema.alterTable("authentication_methods").dropColumn("friendly_name").execute(), await e.schema.alterTable("authentication_methods").dropColumn("transports").execute(), await e.schema.alterTable("authentication_methods").dropColumn("credential_backed_up").execute(), await e.schema.alterTable("authentication_methods").dropColumn("sign_count").execute(), await e.schema.alterTable("authentication_methods").dropColumn("public_key").execute(), await e.schema.alterTable("authentication_methods").dropColumn("credential_id").execute(), await e.schema.alterTable("authentication_methods").renameTo("mfa_enrollments").execute();
|
|
6203
|
+
}
|
|
6204
|
+
const Yu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6205
|
+
__proto__: null,
|
|
6206
|
+
down: Hu,
|
|
6207
|
+
up: Qu
|
|
6167
6208
|
}, Symbol.toStringTag, { value: "Module" })), Te = {
|
|
6168
6209
|
m1_init: _o,
|
|
6169
6210
|
m2_magicLink: po,
|
|
@@ -6300,9 +6341,10 @@ const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
6300
6341
|
o035_idle_expires_at_ts_indexes: ju,
|
|
6301
6342
|
o036_add_connection_to_login_sessions: Mu,
|
|
6302
6343
|
o037_mfa_enrollments: Ku,
|
|
6303
|
-
o038_add_otp_to_codes: Bu
|
|
6344
|
+
o038_add_otp_to_codes: Bu,
|
|
6345
|
+
o039_rename_mfa_enrollments_to_authentication_methods: Yu
|
|
6304
6346
|
};
|
|
6305
|
-
async function
|
|
6347
|
+
async function e_(e, t = !1) {
|
|
6306
6348
|
t && console.log("migrating...");
|
|
6307
6349
|
const a = new we(Te), n = new ce({
|
|
6308
6350
|
db: e,
|
|
@@ -6315,7 +6357,7 @@ async function Vu(e, t = !1) {
|
|
|
6315
6357
|
}), o)
|
|
6316
6358
|
throw console.error("failed to migrate"), console.error(o), o;
|
|
6317
6359
|
}
|
|
6318
|
-
async function
|
|
6360
|
+
async function t_(e) {
|
|
6319
6361
|
console.log("migrating...");
|
|
6320
6362
|
const t = new we(Te), a = new ce({
|
|
6321
6363
|
db: e,
|
|
@@ -6326,7 +6368,7 @@ async function Xu(e) {
|
|
|
6326
6368
|
}), n)
|
|
6327
6369
|
throw console.error("failed to migrate"), console.error(n), n;
|
|
6328
6370
|
}
|
|
6329
|
-
function
|
|
6371
|
+
function a_(e, t = { useTransactions: !0 }) {
|
|
6330
6372
|
return {
|
|
6331
6373
|
branding: ga(e),
|
|
6332
6374
|
clients: Bt(e),
|
|
@@ -6343,7 +6385,7 @@ function Zu(e, t = { useTransactions: !0 }) {
|
|
|
6343
6385
|
keys: ia(e),
|
|
6344
6386
|
loginSessions: Ja(e),
|
|
6345
6387
|
logs: st(e),
|
|
6346
|
-
|
|
6388
|
+
authenticationMethods: co(e),
|
|
6347
6389
|
passwords: gt(e),
|
|
6348
6390
|
promptSettings: qa(e),
|
|
6349
6391
|
refreshTokens: en(e),
|
|
@@ -6365,7 +6407,7 @@ function Zu(e, t = { useTransactions: !0 }) {
|
|
|
6365
6407
|
};
|
|
6366
6408
|
}
|
|
6367
6409
|
export {
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6410
|
+
a_ as default,
|
|
6411
|
+
t_ as migrateDown,
|
|
6412
|
+
e_ as migrateToLatest
|
|
6371
6413
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/markusahlstrand/authhero"
|
|
13
13
|
},
|
|
14
|
-
"version": "10.
|
|
14
|
+
"version": "10.113.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"kysely": "^0.27.4",
|
|
44
44
|
"nanoid": "^5.0.8",
|
|
45
|
-
"@authhero/adapter-interfaces": "0.
|
|
45
|
+
"@authhero/adapter-interfaces": "0.150.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@hono/zod-openapi": "^0.19.2",
|