@authhero/kysely-adapter 12.8.3 → 12.10.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.
@@ -0,0 +1,4 @@
1
+ import { Kysely } from "kysely";
2
+ import { Database } from "../../src/db";
3
+ export declare function up(db: Kysely<Database>): Promise<void>;
4
+ export declare function down(db: Kysely<Database>): Promise<void>;
@@ -8,6 +8,7 @@ import * as pageHooks from "./2026-08-11T12:00:00_page_hooks";
8
8
  import * as refreshTokenSessionId from "./2026-08-20T12:00:00_refresh_token_session_id";
9
9
  import * as refreshTokenSessionIdBackfill from "./2026-08-21T12:00:00_refresh_token_session_id_backfill";
10
10
  import * as tenantOperationRows from "./2026-09-01T12:00:00_tenant_operation_rows";
11
+ import * as tokenExchangeProfiles from "./2026-09-25T12:00:00_token_exchange_profiles";
11
12
  /**
12
13
  * Kysely runs these in key order and refuses to start if an already-executed
13
14
  * migration sorts after a pending one, so the keys must sort in execution
@@ -34,5 +35,6 @@ declare const _default: {
34
35
  "2026-08-20T12:00:00_refresh_token_session_id": typeof refreshTokenSessionId;
35
36
  "2026-08-21T12:00:00_refresh_token_session_id_backfill": typeof refreshTokenSessionIdBackfill;
36
37
  "2026-09-01T12:00:00_tenant_operation_rows": typeof tenantOperationRows;
38
+ "2026-09-25T12:00:00_token_exchange_profiles": typeof tokenExchangeProfiles;
37
39
  };
38
40
  export default _default;
@@ -0,0 +1,43 @@
1
+ import { Kysely } from "kysely";
2
+ import { Database } from "../src/db";
3
+ export interface PlannedStatement {
4
+ sql: string;
5
+ parameters: readonly unknown[];
6
+ }
7
+ export interface PlannedMigration {
8
+ name: string;
9
+ /** Writes (DDL and DML) the migration would execute, in order. */
10
+ statements: PlannedStatement[];
11
+ /**
12
+ * Set when the migration threw during planning. The statements captured
13
+ * before the failure are still listed. This can be a dry-run artifact: a
14
+ * migration that reads a column an earlier pending migration adds will fail
15
+ * here because the earlier migration was never applied.
16
+ */
17
+ error?: string;
18
+ /** True when planning stopped at MAX_STATEMENTS_PER_MIGRATION. */
19
+ truncated?: boolean;
20
+ }
21
+ export interface MigrationPlan {
22
+ /** Migrations already recorded as executed, in order. */
23
+ executed: string[];
24
+ /** Migrations `migrateToLatest` would run, in order. */
25
+ pending: PlannedMigration[];
26
+ }
27
+ /**
28
+ * Dry run of `migrateToLatest`: lists the pending migrations and the SQL each
29
+ * would execute, without changing the database.
30
+ *
31
+ * Each pending migration's `up` runs against a wrapper around `db` that
32
+ * passes reads through and captures writes. Nothing is written — including
33
+ * the `kysely_migration` bookkeeping tables, which are only read if present.
34
+ *
35
+ * Because captured writes are never applied, the plan can diverge from a real
36
+ * run where a migration depends on its own or an earlier migration's writes:
37
+ * "tolerate duplicate column" guards never fire (so an already-present column
38
+ * still shows up as an ALTER), and reads of not-yet-created columns fail (see
39
+ * `PlannedMigration.error`).
40
+ */
41
+ export declare function planMigrations(db: Kysely<Database>): Promise<MigrationPlan>;
42
+ /** Renders a plan as an SQL-ish script for printing. */
43
+ export declare function formatMigrationPlan(plan: MigrationPlan): string;
@@ -3,7 +3,7 @@ import { Kysely } from "kysely";
3
3
  import { Database } from "../db";
4
4
  export declare function create(db: Kysely<Database>): (tenant_id: string, code: CodeInsert) => Promise<{
5
5
  code_id: string;
6
- code_type: "otp" | "password_reset" | "email_verification" | "mfa_otp" | "authorization_code" | "oauth2_state" | "ticket" | "client_assertion_jti";
6
+ code_type: "otp" | "password_reset" | "email_verification" | "mfa_otp" | "authorization_code" | "oauth2_state" | "ticket" | "client_assertion_jti" | "subject_token_jti";
7
7
  expires_at: string;
8
8
  created_at: string;
9
9
  login_id?: string | undefined;
@@ -792,6 +792,7 @@ declare const sqlClientSchema: z.ZodObject<{
792
792
  owner_user_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
793
793
  registration_type: z.ZodNullable<z.ZodOptional<z.ZodString>>;
794
794
  registration_metadata: z.ZodNullable<z.ZodOptional<z.ZodString>>;
795
+ token_exchange: z.ZodNullable<z.ZodOptional<z.ZodString>>;
795
796
  }, z.core.$strip>;
796
797
  export declare const sqlClientRegistrationTokenSchema: z.ZodObject<{
797
798
  id: z.ZodString;
@@ -938,6 +939,17 @@ export interface Database {
938
939
  created_at: string;
939
940
  updated_at: string;
940
941
  };
942
+ token_exchange_profiles: {
943
+ id: string;
944
+ tenant_id: string;
945
+ name: string;
946
+ subject_token_type: string;
947
+ action_id: string | null;
948
+ type: string;
949
+ jwt_verification: string | null;
950
+ created_at: string;
951
+ updated_at: string;
952
+ };
941
953
  scim_configurations: {
942
954
  connection_id: string;
943
955
  tenant_id: string;
@@ -2,6 +2,8 @@ import { Kysely } from "kysely";
2
2
  import { Database } from "./db";
3
3
  import { DataAdapters } from "@authhero/adapter-interfaces";
4
4
  export { migrateToLatest, migrateDown } from "../migrate/migrate";
5
+ export { planMigrations, formatMigrationPlan } from "../migrate/plan";
6
+ export type { MigrationPlan, PlannedMigration, PlannedStatement, } from "../migrate/plan";
5
7
  export type { Database } from "./db";
6
8
  export { createProxyRoutesAdapter, createProxyDataAdapter, } from "./proxyRoutes";
7
9
  export default function createAdapters(db: Kysely<Database>, databaseOptions?: {
@@ -0,0 +1,4 @@
1
+ import { Kysely } from "kysely";
2
+ import { TokenExchangeProfilesAdapter } from "@authhero/adapter-interfaces";
3
+ import { Database } from "../db";
4
+ export declare function createTokenExchangeProfilesAdapter(db: Kysely<Database>): TokenExchangeProfilesAdapter;
@@ -0,0 +1 @@
1
+ export { createTokenExchangeProfilesAdapter } from "./adapter";
@@ -0,0 +1,4 @@
1
+ import { TokenExchangeProfile } from "@authhero/adapter-interfaces";
2
+ import { Database } from "../db";
3
+ export type TokenExchangeProfileRow = Database["token_exchange_profiles"];
4
+ export declare function rowToTokenExchangeProfile(row: TokenExchangeProfileRow): TokenExchangeProfile;