@authhero/kysely-adapter 10.131.2 → 10.131.3
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 +1 -1
- package/dist/kysely-adapter.d.ts +40 -14
- package/dist/kysely-adapter.mjs +20 -8
- package/package.json +2 -2
package/dist/kysely-adapter.cjs
CHANGED
|
@@ -163,4 +163,4 @@
|
|
|
163
163
|
user_id, created_at_ts, updated_at_ts, expires_at_ts,
|
|
164
164
|
auth_connection, auth_strategy_strategy, auth_strategy_strategy_type,
|
|
165
165
|
authenticated_at, auth_params
|
|
166
|
-
FROM login_sessions`.execute(t),await h.sql`DROP TABLE login_sessions`.execute(t),await h.sql`ALTER TABLE login_sessions_new RENAME TO login_sessions`.execute(t),await t.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute(),await t.schema.createIndex("idx_login_sessions_session_id").on("login_sessions").column("session_id").execute(),await t.schema.createIndex("login_sessions_tenant_user_idx").on("login_sessions").columns(["tenant_id","user_id"]).execute(),await t.schema.createIndex("login_sessions_state_idx").on("login_sessions").column("state").execute(),await t.schema.createIndex("idx_login_sessions_expires_at_ts").on("login_sessions").column("expires_at_ts").execute()}),w(" Recreated login_sessions without hoisted authParams_* columns")}async function Sm(e){}const Om=Object.freeze(Object.defineProperty({__proto__:null,down:Sm,up:Tm},Symbol.toStringTag,{value:"Module"}));async function km(e){await e.schema.alterTable("refresh_tokens").addColumn("revoked_at_ts","bigint").execute()}async function $m(e){await e.schema.alterTable("refresh_tokens").dropColumn("revoked_at_ts").execute()}const Em=Object.freeze(Object.defineProperty({__proto__:null,down:$m,up:km},Symbol.toStringTag,{value:"Module"}));async function Pm(e){await e.schema.alterTable("clients").addColumn("owner_user_id","varchar(255)").execute(),await e.schema.alterTable("clients").addColumn("registration_type","varchar(32)").execute(),await e.schema.alterTable("clients").addColumn("registration_metadata","text").execute(),await e.schema.createIndex("idx_clients_owner_user_id").on("clients").columns(["tenant_id","owner_user_id"]).execute(),await e.schema.createTable("client_registration_tokens").addColumn("id","varchar(255)",t=>t.primaryKey()).addColumn("tenant_id","varchar(191)",t=>t.references("tenants.id").onDelete("cascade").notNull()).addColumn("token_hash","varchar(64)",t=>t.notNull()).addColumn("type","varchar(8)",t=>t.notNull()).addColumn("client_id","varchar(191)").addColumn("sub","varchar(255)").addColumn("constraints","text").addColumn("single_use","integer",t=>t.defaultTo(0).notNull()).addColumn("used_at_ts","bigint").addColumn("expires_at_ts","bigint").addColumn("created_at_ts","bigint",t=>t.notNull()).addColumn("revoked_at_ts","bigint").execute(),await e.schema.createIndex("idx_client_registration_tokens_hash").on("client_registration_tokens").columns(["tenant_id","token_hash"]).unique().execute(),await e.schema.createIndex("idx_client_registration_tokens_client").on("client_registration_tokens").columns(["tenant_id","client_id"]).execute()}async function Im(e){await e.schema.dropTable("client_registration_tokens").execute(),await e.schema.dropIndex("idx_clients_owner_user_id").execute(),await e.schema.alterTable("clients").dropColumn("registration_metadata").execute(),await e.schema.alterTable("clients").dropColumn("registration_type").execute(),await e.schema.alterTable("clients").dropColumn("owner_user_id").execute()}const zm=Object.freeze(Object.defineProperty({__proto__:null,down:Im,up:Pm},Symbol.toStringTag,{value:"Module"}));async function Dm(e){try{return await h.sql`SELECT @@version_comment`.execute(e),"mysql"}catch{return"sqlite"}}const Am=[{index:"connections_tenant_id_idx",table:"connections",reason:"composite PK (tenant_id, id)"},{index:"idx_invites_tenant_id",table:"invites",reason:"idx_invites_tenant_created (tenant_id, created_at)"},{index:"idx_organizations_tenant_id",table:"organizations",reason:"idx_organizations_tenant_name_unique (tenant_id, name)"},{index:"role_permissions_role_fk",table:"role_permissions",reason:"role_permissions_pk (tenant_id, role_id, ...)"},{index:"themes_tenant_id_idx",table:"themes",reason:"themes_pkey (tenant_id, themeId)"},{index:"users_tenant_index",table:"users",reason:"stale on PlanetScale only; commented out locally in 2024"},{index:"idx_user_organizations_tenant_id",table:"user_organizations",reason:"already dropped locally; may linger on PlanetScale"}];async function Fm(e,t,a,n){try{t==="mysql"?await h.sql.raw(`DROP INDEX IF EXISTS \`${a}\` ON \`${n}\``).execute(e):await h.sql.raw(`DROP INDEX IF EXISTS "${a}"`).execute(e)}catch(o){const r=o instanceof Error?o.message:String(o);z(` Warning: failed to drop index ${a} on ${n}: ${r}`)}}async function jm(e){const t=await Dm(e);for(const{index:a,table:n}of Am)await Fm(e,t,a,n);await e.schema.dropTable("members").ifExists().execute()}async function Rm(e){await e.schema.createTable("members").addColumn("id","varchar(255)",t=>t.notNull().primaryKey()).addColumn("tenant_id","varchar(255)",t=>t.references("tenants.id").onDelete("cascade").notNull()).addColumn("sub","varchar(255)").addColumn("email","varchar(255)").addColumn("name","varchar(255)").addColumn("status","varchar(255)").addColumn("role","varchar(255)").addColumn("picture","varchar(2083)").addColumn("created_at","varchar(255)",t=>t.notNull()).addColumn("updated_at","varchar(255)",t=>t.notNull()).execute(),await e.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute(),await e.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute(),await e.schema.createIndex("role_permissions_role_fk").on("role_permissions").columns(["tenant_id","role_id"]).execute(),await e.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(),await e.schema.createIndex("idx_invites_tenant_id").on("invites").column("tenant_id").execute(),await e.schema.createIndex("connections_tenant_id_idx").on("connections").column("tenant_id").execute()}const Mm=Object.freeze(Object.defineProperty({__proto__:null,down:Rm,up:jm},Symbol.toStringTag,{value:"Module"})),Pe={m1_init:Vo,m2_magicLink:tr,m3_updateAt:or,m4_logTable:ir,m5_userProfile:dr,m6_sessions:mr,m7_passwords:fr,m8_logsTableNewFields:yr,m9_passwordTableNewField:xr,n01_codesTable:br,n11_universalLoginSession:kr,n12_userFields:Pr,n13_userEmailIndex:Dr,n14_profileDataField:jr,n15_userEmailIndex:qr,n16_userLocale:Kr,n17_signingKeys:Qr,n18_logsFields:Wr,n19_connectionsUserinfo:Vr,n20_missingFields:ts,n21_sessionDeletedAt:os,n22_dropLogsFields:is,n23_dropUsersFields:ds,n24_logsIndexes:ms,n25_logDescMaxLength:fs,n26_logsTableExtraFields:ys,n27_usersTableNameIndex:xs,n28_usersEmailConstrain:bs,n29_increaseOtpStateLength:ks,n30_increaseTicketStateLength:Ps,n31_branding:Ds,n32_indexesAndNotNull:js,n33_vendorIdInUniversalLoginSession:qs,n34_auth0ClientInUniversalLoginSession:Ks,n35_increaseUniversalSessionStateLength:Qs,n36_authenticationCodes:Ws,n37_disableSignUps:Vs,n38_otpIpAddress:ti,n39_increaseUserAgentLength:oi,n40_userId:ii,n41_hooks:di,n42_userIdIndexes:mi,n43_userIdIndexes:fi,n44_codes:yi,n45_hookProperties:xi,n46_loginAuth0Client:bi,n47_loginAuth0Client:ki,n48_saml:Pi,n49_removeFields:Di,n50_authParamsNonce:ji,n51_connectionid:qi,n52_cert:Ki,n53_codes_primary_key:Qi,n54_cleanup_tables:Wi,n55_logs_index:Vi,n56_application_fields:tc,n57_prompt_settings:oc,n58_connection_client_id:ic,n59_connection_options:dc,n60_users_metadata:mc,n61_userLocales:fc,n62_prompt:yc,n63_connection_cleanup:xc,n64_act_as:bc,n65_code_verifier:kc,n66_email_providers:Pc,n67_drop_tickets:Dc,n68_login_useragents:jc,n70_refresh_tokens:qc,n71_session_new_fields:Kc,n72_session_primary_key:Qc,n73_drop_sessions:Wc,n74_custom_domains:Vc,n75_organizations:tl,n76_authorization_url_length:ol,n77_drop_sessions:il,n78_login_sessions:dl,n79_drop_sessions_2:ml,n80_recreate_custom_domains:fl,n81_phone:yl,n82_forms:xl,n83_addFormsIdToHooks:bl,n84_login_completed:kl,n85_add_login_session_id_to_sessions:Pl,n86_index_sessions_login_session_id:Dl,n87_code_challenge:jl,n88_add_redirect_uri_to_codes:ql,n89_add_nonce_and_state_to_codes:Kl,n90_themes:Ql,n91_resource_servers_rules_permissions:Wl,n92_role_permissions:Vl,n93_add_permissions_to_roles:td,n94_keys_connection_and_extend_columns:od,n95_create_organizations_table:id,n96_create_user_organizations_table:dd,n97_add_organization_to_user_permissions_and_roles:md,n98_clients:fd,n99_update_client_foreign_keys:Td,o001_client_grants:Sd,o002_drop_applications:$d,o003_phone_number_index:Id,o004_login_sessions_id_index:Ad,o005_connections_tenant_index:Rd,o006_remove_redundant_user_organizations_tenant_index:Jd,o007_tenant_settings:Bd,o008_merge_tenant_settings_into_tenants:Yd,o009_create_invites_table:Gd,o010_add_log_id_to_logs:Zd,o011_add_location_info_to_logs:au,o012_add_password_history:ru,o013_connection_display_name:cu,o014_client_connections:uu,o015_flows:hu,o016_add_is_system_column:gu,o017_connections_composite_key:vu,o018_login_session_state:Tu,o019_roles_resource_servers_metadata:Su,o020_session_add_timestamp_columns:Eu,o021_session_cleanup_and_ulid:zu,o022_oidc_profile_claims:Fu,o023_preferred_username:Mu,o024_user_address:Lu,o025_authparams_max_age:Uu,o026_auth0_conformant:Hu,o027_universal_login_templates:Xu,o028_custom_text:e_,o029_guardian_mfa:n_,o030_add_template_id_to_hooks:i_,o031_hooks_cleanup:d_,o032_unique_username_provider:m_,o033_add_login_id_to_refresh_tokens:f_,o034_refresh_tokens_replace_session_id_with_login_id:y_,o035_idle_expires_at_ts_indexes:x_,o036_add_connection_to_login_sessions:b_,o037_mfa_enrollments:k_,o038_add_otp_to_codes:P_,o039_rename_mfa_enrollments_to_authentication_methods:D_,o040_create_outbox_events:j_,o041_add_outbox_claim_columns:q_,o042_add_outbox_claim_index:K_,o043_add_code_hooks:Q_,o044_create_actions:W_,o045_outbox_dead_letter:V_,o046_user_registration_completed_at:tm,o047_outbox_dead_lettered_tenant_index:om,o048_add_auth_strategy_to_login_sessions:im,o049_login_sessions_auth_params:dm,o050_login_sessions_auth_params_backfill:hm,o051_relax_login_sessions_authparams:vm,o052_drop_login_sessions_hoisted_authparams:Om,o053_refresh_tokens_revoked_at:Em,o054_client_registration_tokens:zm,o055_planetscale_redundant_indexes_cleanup:Mm};async function qm(e,t=!1){be(t),t&&console.log("migrating...");const a=new Te(Pe),n=new h.Migrator({db:e,provider:a}),{error:o,results:r}=await n.migrateToLatest();if(r==null||r.forEach(s=>{s.status==="Success"?t&&console.log(`migration "${s.migrationName}" was executed successfully`):s.status==="Error"&&console.error(`failed to execute migration "${s.migrationName}"`)}),o)throw console.error("failed to migrate"),console.error(o),o}async function Jm(e,t=!1){be(t),t&&console.log("migrating...");const a=new Te(Pe),n=new h.Migrator({db:e,provider:a}),{error:o,results:r}=await n.migrateDown();if(r==null||r.forEach(s=>{s.status==="Success"?t&&console.log(`migration "${s.migrationName}" was reverted successfully`):s.status==="Error"&&console.error(`failed to execute migration "${s.migrationName}"`)}),o)throw console.error("failed to migrate"),console.error(o),o}function Ie(e,t={useTransactions:!0}){const a={actions:Ve(e),branding:Ma(e),clients:aa(e),clientConnections:ca(e),clientGrants:ha(e),clientRegistrationTokens:ba(e),codes:Lt(e),connections:Wt(e),emailProviders:xn(e),customDomains:Fa(e),flows:_t(e),forms:jn(e),hookCode:en(e),hooks:Wa(e),invites:$o(e),keys:$a(e),loginSessions:hn(e),logs:Nt(e),authenticationMethods:Ro(e),passwords:At(e),promptSettings:gn(e),refreshTokens:$n(e),resourceServers:Kn(e),rolePermissions:Zn(e),userPermissions:oo(e),userRoles:lo(e),roles:Wn(e),sessions:Et(e),sessionCleanup:Pn(e),tenants:yt(e),themes:rn(e),universalLoginTemplates:Ka(e),customText:Io(e),users:st(e),organizations:fo(e),userOrganizations:To(e),stats:Po(e),outbox:Wo(e),async transaction(n){return t.useTransactions===!1?n(a):e.transaction().execute(async o=>{const r=Ie(o,{...t,useTransactions:!1});return n(r)})}};return a}exports.default=Ie;exports.migrateDown=Jm;exports.migrateToLatest=qm;
|
|
166
|
+
FROM login_sessions`.execute(t),await h.sql`DROP TABLE login_sessions`.execute(t),await h.sql`ALTER TABLE login_sessions_new RENAME TO login_sessions`.execute(t),await t.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute(),await t.schema.createIndex("idx_login_sessions_session_id").on("login_sessions").column("session_id").execute(),await t.schema.createIndex("login_sessions_tenant_user_idx").on("login_sessions").columns(["tenant_id","user_id"]).execute(),await t.schema.createIndex("login_sessions_state_idx").on("login_sessions").column("state").execute(),await t.schema.createIndex("idx_login_sessions_expires_at_ts").on("login_sessions").column("expires_at_ts").execute()}),w(" Recreated login_sessions without hoisted authParams_* columns")}async function Sm(e){}const Om=Object.freeze(Object.defineProperty({__proto__:null,down:Sm,up:Tm},Symbol.toStringTag,{value:"Module"}));async function km(e){await e.schema.alterTable("refresh_tokens").addColumn("revoked_at_ts","bigint").execute()}async function $m(e){await e.schema.alterTable("refresh_tokens").dropColumn("revoked_at_ts").execute()}const Em=Object.freeze(Object.defineProperty({__proto__:null,down:$m,up:km},Symbol.toStringTag,{value:"Module"}));async function Pm(e){await e.schema.alterTable("clients").addColumn("owner_user_id","varchar(255)").execute(),await e.schema.alterTable("clients").addColumn("registration_type","varchar(32)").execute(),await e.schema.alterTable("clients").addColumn("registration_metadata","text").execute(),await e.schema.createIndex("idx_clients_owner_user_id").on("clients").columns(["tenant_id","owner_user_id"]).execute(),await e.schema.createTable("client_registration_tokens").addColumn("id","varchar(255)",t=>t.primaryKey()).addColumn("tenant_id","varchar(191)",t=>t.references("tenants.id").onDelete("cascade").notNull()).addColumn("token_hash","varchar(64)",t=>t.notNull()).addColumn("type","varchar(8)",t=>t.notNull()).addColumn("client_id","varchar(191)").addColumn("sub","varchar(255)").addColumn("constraints","text").addColumn("single_use","integer",t=>t.defaultTo(0).notNull()).addColumn("used_at_ts","bigint").addColumn("expires_at_ts","bigint").addColumn("created_at_ts","bigint",t=>t.notNull()).addColumn("revoked_at_ts","bigint").execute(),await e.schema.createIndex("idx_client_registration_tokens_hash").on("client_registration_tokens").columns(["tenant_id","token_hash"]).unique().execute(),await e.schema.createIndex("idx_client_registration_tokens_client").on("client_registration_tokens").columns(["tenant_id","client_id"]).execute()}async function Im(e){await e.schema.dropTable("client_registration_tokens").execute(),await e.schema.dropIndex("idx_clients_owner_user_id").execute(),await e.schema.alterTable("clients").dropColumn("registration_metadata").execute(),await e.schema.alterTable("clients").dropColumn("registration_type").execute(),await e.schema.alterTable("clients").dropColumn("owner_user_id").execute()}const zm=Object.freeze(Object.defineProperty({__proto__:null,down:Im,up:Pm},Symbol.toStringTag,{value:"Module"}));async function Dm(e){try{return await h.sql`SELECT @@version_comment`.execute(e),"mysql"}catch{return"sqlite"}}const Am=[{index:"connections_tenant_id_idx",table:"connections",reason:"composite PK (tenant_id, id)"},{index:"idx_invites_tenant_id",table:"invites",reason:"idx_invites_tenant_created (tenant_id, created_at)"},{index:"idx_organizations_tenant_id",table:"organizations",reason:"idx_organizations_tenant_name_unique (tenant_id, name)"},{index:"role_permissions_role_fk",table:"role_permissions",reason:"role_permissions_pk (tenant_id, role_id, ...)"},{index:"themes_tenant_id_idx",table:"themes",reason:"themes_pkey (tenant_id, themeId)"},{index:"users_tenant_index",table:"users",reason:"stale on PlanetScale only; commented out locally in 2024"},{index:"idx_user_organizations_tenant_id",table:"user_organizations",reason:"already dropped locally; may linger on PlanetScale"}];async function Fm(e,t,a,n){try{t==="mysql"?await h.sql.raw(`DROP INDEX IF EXISTS \`${a}\` ON \`${n}\``).execute(e):await h.sql.raw(`DROP INDEX IF EXISTS "${a}"`).execute(e)}catch(o){const r=o instanceof Error?o.message:String(o);z(` Warning: failed to drop index ${a} on ${n}: ${r}`)}}async function jm(e){const t=await Dm(e);for(const{index:a,table:n}of Am)await Fm(e,t,a,n);await e.schema.dropTable("members").ifExists().execute()}async function Rm(e){await e.schema.createTable("members").addColumn("id","varchar(255)",t=>t.notNull().primaryKey()).addColumn("tenant_id","varchar(255)",t=>t.references("tenants.id").onDelete("cascade").notNull()).addColumn("sub","varchar(255)").addColumn("email","varchar(255)").addColumn("name","varchar(255)").addColumn("status","varchar(255)").addColumn("role","varchar(255)").addColumn("picture","varchar(2083)").addColumn("created_at","varchar(255)",t=>t.notNull()).addColumn("updated_at","varchar(255)",t=>t.notNull()).execute(),await e.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute(),await e.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute(),await e.schema.createIndex("role_permissions_role_fk").on("role_permissions").columns(["tenant_id","role_id"]).execute(),await e.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(),await e.schema.createIndex("idx_invites_tenant_id").on("invites").column("tenant_id").execute(),await e.schema.createIndex("connections_tenant_id_idx").on("connections").column("tenant_id").execute()}const Mm=Object.freeze(Object.defineProperty({__proto__:null,down:Rm,up:jm},Symbol.toStringTag,{value:"Module"}));async function qm(e){await e.schema.alterTable("clients").addColumn("user_linking_mode","varchar(16)").execute()}async function Jm(e){await e.schema.alterTable("clients").dropColumn("user_linking_mode").execute()}const Lm=Object.freeze(Object.defineProperty({__proto__:null,down:Jm,up:qm},Symbol.toStringTag,{value:"Module"})),Pe={m1_init:Vo,m2_magicLink:tr,m3_updateAt:or,m4_logTable:ir,m5_userProfile:dr,m6_sessions:mr,m7_passwords:fr,m8_logsTableNewFields:yr,m9_passwordTableNewField:xr,n01_codesTable:br,n11_universalLoginSession:kr,n12_userFields:Pr,n13_userEmailIndex:Dr,n14_profileDataField:jr,n15_userEmailIndex:qr,n16_userLocale:Kr,n17_signingKeys:Qr,n18_logsFields:Wr,n19_connectionsUserinfo:Vr,n20_missingFields:ts,n21_sessionDeletedAt:os,n22_dropLogsFields:is,n23_dropUsersFields:ds,n24_logsIndexes:ms,n25_logDescMaxLength:fs,n26_logsTableExtraFields:ys,n27_usersTableNameIndex:xs,n28_usersEmailConstrain:bs,n29_increaseOtpStateLength:ks,n30_increaseTicketStateLength:Ps,n31_branding:Ds,n32_indexesAndNotNull:js,n33_vendorIdInUniversalLoginSession:qs,n34_auth0ClientInUniversalLoginSession:Ks,n35_increaseUniversalSessionStateLength:Qs,n36_authenticationCodes:Ws,n37_disableSignUps:Vs,n38_otpIpAddress:ti,n39_increaseUserAgentLength:oi,n40_userId:ii,n41_hooks:di,n42_userIdIndexes:mi,n43_userIdIndexes:fi,n44_codes:yi,n45_hookProperties:xi,n46_loginAuth0Client:bi,n47_loginAuth0Client:ki,n48_saml:Pi,n49_removeFields:Di,n50_authParamsNonce:ji,n51_connectionid:qi,n52_cert:Ki,n53_codes_primary_key:Qi,n54_cleanup_tables:Wi,n55_logs_index:Vi,n56_application_fields:tc,n57_prompt_settings:oc,n58_connection_client_id:ic,n59_connection_options:dc,n60_users_metadata:mc,n61_userLocales:fc,n62_prompt:yc,n63_connection_cleanup:xc,n64_act_as:bc,n65_code_verifier:kc,n66_email_providers:Pc,n67_drop_tickets:Dc,n68_login_useragents:jc,n70_refresh_tokens:qc,n71_session_new_fields:Kc,n72_session_primary_key:Qc,n73_drop_sessions:Wc,n74_custom_domains:Vc,n75_organizations:tl,n76_authorization_url_length:ol,n77_drop_sessions:il,n78_login_sessions:dl,n79_drop_sessions_2:ml,n80_recreate_custom_domains:fl,n81_phone:yl,n82_forms:xl,n83_addFormsIdToHooks:bl,n84_login_completed:kl,n85_add_login_session_id_to_sessions:Pl,n86_index_sessions_login_session_id:Dl,n87_code_challenge:jl,n88_add_redirect_uri_to_codes:ql,n89_add_nonce_and_state_to_codes:Kl,n90_themes:Ql,n91_resource_servers_rules_permissions:Wl,n92_role_permissions:Vl,n93_add_permissions_to_roles:td,n94_keys_connection_and_extend_columns:od,n95_create_organizations_table:id,n96_create_user_organizations_table:dd,n97_add_organization_to_user_permissions_and_roles:md,n98_clients:fd,n99_update_client_foreign_keys:Td,o001_client_grants:Sd,o002_drop_applications:$d,o003_phone_number_index:Id,o004_login_sessions_id_index:Ad,o005_connections_tenant_index:Rd,o006_remove_redundant_user_organizations_tenant_index:Jd,o007_tenant_settings:Bd,o008_merge_tenant_settings_into_tenants:Yd,o009_create_invites_table:Gd,o010_add_log_id_to_logs:Zd,o011_add_location_info_to_logs:au,o012_add_password_history:ru,o013_connection_display_name:cu,o014_client_connections:uu,o015_flows:hu,o016_add_is_system_column:gu,o017_connections_composite_key:vu,o018_login_session_state:Tu,o019_roles_resource_servers_metadata:Su,o020_session_add_timestamp_columns:Eu,o021_session_cleanup_and_ulid:zu,o022_oidc_profile_claims:Fu,o023_preferred_username:Mu,o024_user_address:Lu,o025_authparams_max_age:Uu,o026_auth0_conformant:Hu,o027_universal_login_templates:Xu,o028_custom_text:e_,o029_guardian_mfa:n_,o030_add_template_id_to_hooks:i_,o031_hooks_cleanup:d_,o032_unique_username_provider:m_,o033_add_login_id_to_refresh_tokens:f_,o034_refresh_tokens_replace_session_id_with_login_id:y_,o035_idle_expires_at_ts_indexes:x_,o036_add_connection_to_login_sessions:b_,o037_mfa_enrollments:k_,o038_add_otp_to_codes:P_,o039_rename_mfa_enrollments_to_authentication_methods:D_,o040_create_outbox_events:j_,o041_add_outbox_claim_columns:q_,o042_add_outbox_claim_index:K_,o043_add_code_hooks:Q_,o044_create_actions:W_,o045_outbox_dead_letter:V_,o046_user_registration_completed_at:tm,o047_outbox_dead_lettered_tenant_index:om,o048_add_auth_strategy_to_login_sessions:im,o049_login_sessions_auth_params:dm,o050_login_sessions_auth_params_backfill:hm,o051_relax_login_sessions_authparams:vm,o052_drop_login_sessions_hoisted_authparams:Om,o053_refresh_tokens_revoked_at:Em,o054_client_registration_tokens:zm,o055_planetscale_redundant_indexes_cleanup:Mm,o056_client_user_linking_mode:Lm};async function Km(e,t=!1){be(t),t&&console.log("migrating...");const a=new Te(Pe),n=new h.Migrator({db:e,provider:a}),{error:o,results:r}=await n.migrateToLatest();if(r==null||r.forEach(s=>{s.status==="Success"?t&&console.log(`migration "${s.migrationName}" was executed successfully`):s.status==="Error"&&console.error(`failed to execute migration "${s.migrationName}"`)}),o)throw console.error("failed to migrate"),console.error(o),o}async function Bm(e,t=!1){be(t),t&&console.log("migrating...");const a=new Te(Pe),n=new h.Migrator({db:e,provider:a}),{error:o,results:r}=await n.migrateDown();if(r==null||r.forEach(s=>{s.status==="Success"?t&&console.log(`migration "${s.migrationName}" was reverted successfully`):s.status==="Error"&&console.error(`failed to execute migration "${s.migrationName}"`)}),o)throw console.error("failed to migrate"),console.error(o),o}function Ie(e,t={useTransactions:!0}){const a={actions:Ve(e),branding:Ma(e),clients:aa(e),clientConnections:ca(e),clientGrants:ha(e),clientRegistrationTokens:ba(e),codes:Lt(e),connections:Wt(e),emailProviders:xn(e),customDomains:Fa(e),flows:_t(e),forms:jn(e),hookCode:en(e),hooks:Wa(e),invites:$o(e),keys:$a(e),loginSessions:hn(e),logs:Nt(e),authenticationMethods:Ro(e),passwords:At(e),promptSettings:gn(e),refreshTokens:$n(e),resourceServers:Kn(e),rolePermissions:Zn(e),userPermissions:oo(e),userRoles:lo(e),roles:Wn(e),sessions:Et(e),sessionCleanup:Pn(e),tenants:yt(e),themes:rn(e),universalLoginTemplates:Ka(e),customText:Io(e),users:st(e),organizations:fo(e),userOrganizations:To(e),stats:Po(e),outbox:Wo(e),async transaction(n){return t.useTransactions===!1?n(a):e.transaction().execute(async o=>{const r=Ie(o,{...t,useTransactions:!1});return n(r)})}};return a}exports.default=Ie;exports.migrateDown=Bm;exports.migrateToLatest=Km;
|
package/dist/kysely-adapter.d.ts
CHANGED
|
@@ -1881,6 +1881,10 @@ declare const clientInsertSchema: z.ZodObject<{
|
|
|
1881
1881
|
"iat_dcr"
|
|
1882
1882
|
]>>;
|
|
1883
1883
|
registration_metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
1884
|
+
user_linking_mode: z.ZodOptional<z.ZodEnum<[
|
|
1885
|
+
"builtin",
|
|
1886
|
+
"off"
|
|
1887
|
+
]>>;
|
|
1884
1888
|
}, "strip", z.ZodTypeAny, {
|
|
1885
1889
|
name: string;
|
|
1886
1890
|
client_id: string;
|
|
@@ -1933,6 +1937,7 @@ declare const clientInsertSchema: z.ZodObject<{
|
|
|
1933
1937
|
owner_user_id?: string | undefined;
|
|
1934
1938
|
registration_type?: "manual" | "open_dcr" | "iat_dcr" | undefined;
|
|
1935
1939
|
registration_metadata?: Record<string, any> | undefined;
|
|
1940
|
+
user_linking_mode?: "builtin" | "off" | undefined;
|
|
1936
1941
|
}, {
|
|
1937
1942
|
name: string;
|
|
1938
1943
|
client_id: string;
|
|
@@ -1985,6 +1990,7 @@ declare const clientInsertSchema: z.ZodObject<{
|
|
|
1985
1990
|
owner_user_id?: string | undefined;
|
|
1986
1991
|
registration_type?: "manual" | "open_dcr" | "iat_dcr" | undefined;
|
|
1987
1992
|
registration_metadata?: Record<string, any> | undefined;
|
|
1993
|
+
user_linking_mode?: "builtin" | "off" | undefined;
|
|
1988
1994
|
}>;
|
|
1989
1995
|
export type ClientInsert = z.input<typeof clientInsertSchema>;
|
|
1990
1996
|
declare const clientSchema: z.ZodObject<{
|
|
@@ -2087,6 +2093,10 @@ declare const clientSchema: z.ZodObject<{
|
|
|
2087
2093
|
"iat_dcr"
|
|
2088
2094
|
]>>;
|
|
2089
2095
|
registration_metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
2096
|
+
user_linking_mode: z.ZodOptional<z.ZodEnum<[
|
|
2097
|
+
"builtin",
|
|
2098
|
+
"off"
|
|
2099
|
+
]>>;
|
|
2090
2100
|
created_at: z.ZodString;
|
|
2091
2101
|
updated_at: z.ZodString;
|
|
2092
2102
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2143,6 +2153,7 @@ declare const clientSchema: z.ZodObject<{
|
|
|
2143
2153
|
owner_user_id?: string | undefined;
|
|
2144
2154
|
registration_type?: "manual" | "open_dcr" | "iat_dcr" | undefined;
|
|
2145
2155
|
registration_metadata?: Record<string, any> | undefined;
|
|
2156
|
+
user_linking_mode?: "builtin" | "off" | undefined;
|
|
2146
2157
|
}, {
|
|
2147
2158
|
created_at: string;
|
|
2148
2159
|
updated_at: string;
|
|
@@ -2197,6 +2208,7 @@ declare const clientSchema: z.ZodObject<{
|
|
|
2197
2208
|
owner_user_id?: string | undefined;
|
|
2198
2209
|
registration_type?: "manual" | "open_dcr" | "iat_dcr" | undefined;
|
|
2199
2210
|
registration_metadata?: Record<string, any> | undefined;
|
|
2211
|
+
user_linking_mode?: "builtin" | "off" | undefined;
|
|
2200
2212
|
}>;
|
|
2201
2213
|
export type Client = z.infer<typeof clientSchema>;
|
|
2202
2214
|
declare const clientGrantInsertSchema: z.ZodObject<{
|
|
@@ -15342,6 +15354,7 @@ declare const hookInsertSchema: z.ZodUnion<[
|
|
|
15342
15354
|
"pre-user-registration",
|
|
15343
15355
|
"post-user-registration",
|
|
15344
15356
|
"post-user-login",
|
|
15357
|
+
"post-user-update",
|
|
15345
15358
|
"validate-registration-username",
|
|
15346
15359
|
"pre-user-deletion",
|
|
15347
15360
|
"post-user-deletion"
|
|
@@ -15354,13 +15367,13 @@ declare const hookInsertSchema: z.ZodUnion<[
|
|
|
15354
15367
|
}, "strip", z.ZodTypeAny, {
|
|
15355
15368
|
url: string;
|
|
15356
15369
|
enabled: boolean;
|
|
15357
|
-
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15370
|
+
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15358
15371
|
synchronous: boolean;
|
|
15359
15372
|
priority?: number | undefined;
|
|
15360
15373
|
hook_id?: string | undefined;
|
|
15361
15374
|
}, {
|
|
15362
15375
|
url: string;
|
|
15363
|
-
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15376
|
+
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15364
15377
|
enabled?: boolean | undefined;
|
|
15365
15378
|
synchronous?: boolean | undefined;
|
|
15366
15379
|
priority?: number | undefined;
|
|
@@ -15398,11 +15411,14 @@ declare const hookInsertSchema: z.ZodUnion<[
|
|
|
15398
15411
|
z.ZodObject<{
|
|
15399
15412
|
trigger_id: z.ZodEnum<[
|
|
15400
15413
|
"post-user-login",
|
|
15414
|
+
"post-user-registration",
|
|
15415
|
+
"post-user-update",
|
|
15401
15416
|
"credentials-exchange"
|
|
15402
15417
|
]>;
|
|
15403
15418
|
template_id: z.ZodEnum<[
|
|
15404
15419
|
"ensure-username",
|
|
15405
|
-
"set-preferred-username"
|
|
15420
|
+
"set-preferred-username",
|
|
15421
|
+
"account-linking"
|
|
15406
15422
|
]>;
|
|
15407
15423
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
15408
15424
|
synchronous: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -15410,14 +15426,14 @@ declare const hookInsertSchema: z.ZodUnion<[
|
|
|
15410
15426
|
hook_id: z.ZodOptional<z.ZodString>;
|
|
15411
15427
|
}, "strip", z.ZodTypeAny, {
|
|
15412
15428
|
enabled: boolean;
|
|
15413
|
-
trigger_id: "post-user-login" | "credentials-exchange";
|
|
15429
|
+
trigger_id: "post-user-registration" | "post-user-login" | "post-user-update" | "credentials-exchange";
|
|
15414
15430
|
synchronous: boolean;
|
|
15415
|
-
template_id: "ensure-username" | "set-preferred-username";
|
|
15431
|
+
template_id: "ensure-username" | "set-preferred-username" | "account-linking";
|
|
15416
15432
|
priority?: number | undefined;
|
|
15417
15433
|
hook_id?: string | undefined;
|
|
15418
15434
|
}, {
|
|
15419
|
-
trigger_id: "post-user-login" | "credentials-exchange";
|
|
15420
|
-
template_id: "ensure-username" | "set-preferred-username";
|
|
15435
|
+
trigger_id: "post-user-registration" | "post-user-login" | "post-user-update" | "credentials-exchange";
|
|
15436
|
+
template_id: "ensure-username" | "set-preferred-username" | "account-linking";
|
|
15421
15437
|
enabled?: boolean | undefined;
|
|
15422
15438
|
synchronous?: boolean | undefined;
|
|
15423
15439
|
priority?: number | undefined;
|
|
@@ -15462,6 +15478,7 @@ declare const hookSchema: z.ZodUnion<[
|
|
|
15462
15478
|
"pre-user-registration",
|
|
15463
15479
|
"post-user-registration",
|
|
15464
15480
|
"post-user-login",
|
|
15481
|
+
"post-user-update",
|
|
15465
15482
|
"validate-registration-username",
|
|
15466
15483
|
"pre-user-deletion",
|
|
15467
15484
|
"post-user-deletion"
|
|
@@ -15474,7 +15491,7 @@ declare const hookSchema: z.ZodUnion<[
|
|
|
15474
15491
|
updated_at: string;
|
|
15475
15492
|
url: string;
|
|
15476
15493
|
enabled: boolean;
|
|
15477
|
-
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15494
|
+
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15478
15495
|
synchronous: boolean;
|
|
15479
15496
|
hook_id: string;
|
|
15480
15497
|
priority?: number | undefined;
|
|
@@ -15482,7 +15499,7 @@ declare const hookSchema: z.ZodUnion<[
|
|
|
15482
15499
|
created_at: string;
|
|
15483
15500
|
updated_at: string;
|
|
15484
15501
|
url: string;
|
|
15485
|
-
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15502
|
+
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion";
|
|
15486
15503
|
hook_id: string;
|
|
15487
15504
|
enabled?: boolean | undefined;
|
|
15488
15505
|
synchronous?: boolean | undefined;
|
|
@@ -15527,12 +15544,15 @@ declare const hookSchema: z.ZodUnion<[
|
|
|
15527
15544
|
hook_id: z.ZodString;
|
|
15528
15545
|
template_id: z.ZodEnum<[
|
|
15529
15546
|
"ensure-username",
|
|
15530
|
-
"set-preferred-username"
|
|
15547
|
+
"set-preferred-username",
|
|
15548
|
+
"account-linking"
|
|
15531
15549
|
]>;
|
|
15532
15550
|
created_at: z.ZodString;
|
|
15533
15551
|
updated_at: z.ZodString;
|
|
15534
15552
|
trigger_id: z.ZodEnum<[
|
|
15535
15553
|
"post-user-login",
|
|
15554
|
+
"post-user-registration",
|
|
15555
|
+
"post-user-update",
|
|
15536
15556
|
"credentials-exchange"
|
|
15537
15557
|
]>;
|
|
15538
15558
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -15542,17 +15562,17 @@ declare const hookSchema: z.ZodUnion<[
|
|
|
15542
15562
|
created_at: string;
|
|
15543
15563
|
updated_at: string;
|
|
15544
15564
|
enabled: boolean;
|
|
15545
|
-
trigger_id: "post-user-login" | "credentials-exchange";
|
|
15565
|
+
trigger_id: "post-user-registration" | "post-user-login" | "post-user-update" | "credentials-exchange";
|
|
15546
15566
|
synchronous: boolean;
|
|
15547
15567
|
hook_id: string;
|
|
15548
|
-
template_id: "ensure-username" | "set-preferred-username";
|
|
15568
|
+
template_id: "ensure-username" | "set-preferred-username" | "account-linking";
|
|
15549
15569
|
priority?: number | undefined;
|
|
15550
15570
|
}, {
|
|
15551
15571
|
created_at: string;
|
|
15552
15572
|
updated_at: string;
|
|
15553
|
-
trigger_id: "post-user-login" | "credentials-exchange";
|
|
15573
|
+
trigger_id: "post-user-registration" | "post-user-login" | "post-user-update" | "credentials-exchange";
|
|
15554
15574
|
hook_id: string;
|
|
15555
|
-
template_id: "ensure-username" | "set-preferred-username";
|
|
15575
|
+
template_id: "ensure-username" | "set-preferred-username" | "account-linking";
|
|
15556
15576
|
enabled?: boolean | undefined;
|
|
15557
15577
|
synchronous?: boolean | undefined;
|
|
15558
15578
|
priority?: number | undefined;
|
|
@@ -22014,6 +22034,10 @@ declare const sqlClientSchema: z.ZodObject<{
|
|
|
22014
22034
|
"fapi2_sp_mtls_mtls"
|
|
22015
22035
|
]>>;
|
|
22016
22036
|
par_request_expiry: z.ZodOptional<z.ZodNumber>;
|
|
22037
|
+
user_linking_mode: z.ZodOptional<z.ZodEnum<[
|
|
22038
|
+
"builtin",
|
|
22039
|
+
"off"
|
|
22040
|
+
]>>;
|
|
22017
22041
|
created_at: z.ZodString;
|
|
22018
22042
|
updated_at: z.ZodString;
|
|
22019
22043
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -22071,6 +22095,7 @@ declare const sqlClientSchema: z.ZodObject<{
|
|
|
22071
22095
|
organization_require_behavior?: "no_prompt" | "pre_login_prompt" | "post_login_prompt" | undefined;
|
|
22072
22096
|
compliance_level?: "none" | "fapi1_adv_pkj_par" | "fapi1_adv_mtls_par" | "fapi2_sp_pkj_mtls" | "fapi2_sp_mtls_mtls" | undefined;
|
|
22073
22097
|
par_request_expiry?: number | undefined;
|
|
22098
|
+
user_linking_mode?: "builtin" | "off" | undefined;
|
|
22074
22099
|
}, {
|
|
22075
22100
|
tenant_id: string;
|
|
22076
22101
|
created_at: string;
|
|
@@ -22126,6 +22151,7 @@ declare const sqlClientSchema: z.ZodObject<{
|
|
|
22126
22151
|
organization_require_behavior?: "no_prompt" | "pre_login_prompt" | "post_login_prompt" | undefined;
|
|
22127
22152
|
compliance_level?: "none" | "fapi1_adv_pkj_par" | "fapi1_adv_mtls_par" | "fapi2_sp_pkj_mtls" | "fapi2_sp_mtls_mtls" | undefined;
|
|
22128
22153
|
par_request_expiry?: number | undefined;
|
|
22154
|
+
user_linking_mode?: "builtin" | "off" | undefined;
|
|
22129
22155
|
}>;
|
|
22130
22156
|
declare const sqlClientRegistrationTokenSchema: z.ZodObject<{
|
|
22131
22157
|
id: z.ZodString;
|
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -7321,6 +7321,17 @@ const Wm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7321
7321
|
__proto__: null,
|
|
7322
7322
|
down: Hm,
|
|
7323
7323
|
up: Ym
|
|
7324
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
7325
|
+
async function Gm(e) {
|
|
7326
|
+
await e.schema.alterTable("clients").addColumn("user_linking_mode", "varchar(16)").execute();
|
|
7327
|
+
}
|
|
7328
|
+
async function Xm(e) {
|
|
7329
|
+
await e.schema.alterTable("clients").dropColumn("user_linking_mode").execute();
|
|
7330
|
+
}
|
|
7331
|
+
const Vm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7332
|
+
__proto__: null,
|
|
7333
|
+
down: Xm,
|
|
7334
|
+
up: Gm
|
|
7324
7335
|
}, Symbol.toStringTag, { value: "Module" })), De = {
|
|
7325
7336
|
m1_init: cr,
|
|
7326
7337
|
m2_magicLink: ur,
|
|
@@ -7474,9 +7485,10 @@ const Wm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7474
7485
|
o052_drop_login_sessions_hoisted_authparams: jm,
|
|
7475
7486
|
o053_refresh_tokens_revoked_at: Jm,
|
|
7476
7487
|
o054_client_registration_tokens: Km,
|
|
7477
|
-
o055_planetscale_redundant_indexes_cleanup: Wm
|
|
7488
|
+
o055_planetscale_redundant_indexes_cleanup: Wm,
|
|
7489
|
+
o056_client_user_linking_mode: Vm
|
|
7478
7490
|
};
|
|
7479
|
-
async function
|
|
7491
|
+
async function rh(e, t = !1) {
|
|
7480
7492
|
ke(t), t && console.log("migrating...");
|
|
7481
7493
|
const a = new Se(De), n = new ge({
|
|
7482
7494
|
db: e,
|
|
@@ -7489,7 +7501,7 @@ async function ah(e, t = !1) {
|
|
|
7489
7501
|
}), o)
|
|
7490
7502
|
throw console.error("failed to migrate"), console.error(o), o;
|
|
7491
7503
|
}
|
|
7492
|
-
async function
|
|
7504
|
+
async function sh(e, t = !1) {
|
|
7493
7505
|
ke(t), t && console.log("migrating...");
|
|
7494
7506
|
const a = new Se(De), n = new ge({
|
|
7495
7507
|
db: e,
|
|
@@ -7502,7 +7514,7 @@ async function nh(e, t = !1) {
|
|
|
7502
7514
|
}), o)
|
|
7503
7515
|
throw console.error("failed to migrate"), console.error(o), o;
|
|
7504
7516
|
}
|
|
7505
|
-
function
|
|
7517
|
+
function Zm(e, t = { useTransactions: !0 }) {
|
|
7506
7518
|
const a = {
|
|
7507
7519
|
actions: ct(e),
|
|
7508
7520
|
branding: Wa(e),
|
|
@@ -7544,7 +7556,7 @@ function Gm(e, t = { useTransactions: !0 }) {
|
|
|
7544
7556
|
outbox: rr(e),
|
|
7545
7557
|
async transaction(n) {
|
|
7546
7558
|
return t.useTransactions === !1 ? n(a) : e.transaction().execute(async (o) => {
|
|
7547
|
-
const r =
|
|
7559
|
+
const r = Zm(o, {
|
|
7548
7560
|
...t,
|
|
7549
7561
|
useTransactions: !1
|
|
7550
7562
|
});
|
|
@@ -7555,7 +7567,7 @@ function Gm(e, t = { useTransactions: !0 }) {
|
|
|
7555
7567
|
return a;
|
|
7556
7568
|
}
|
|
7557
7569
|
export {
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7570
|
+
Zm as default,
|
|
7571
|
+
sh as migrateDown,
|
|
7572
|
+
rh as migrateToLatest
|
|
7561
7573
|
};
|
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.131.
|
|
14
|
+
"version": "10.131.3",
|
|
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": "1.10.
|
|
45
|
+
"@authhero/adapter-interfaces": "1.10.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@hono/zod-openapi": "^0.19.2",
|