@authhero/kysely-adapter 12.9.0 → 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.
- package/README.md +9 -1
- package/dist/kysely-adapter.cjs +2 -1
- package/dist/kysely-adapter.d.ts +44 -2
- package/dist/kysely-adapter.mjs +1182 -1088
- package/dist/types/migrate/plan.d.ts +43 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/kysely-adapter.d.ts
CHANGED
|
@@ -1036,6 +1036,48 @@ interface Database {
|
|
|
1036
1036
|
declare function migrateToLatest(db: Kysely<Database>, debug?: boolean): Promise<void>;
|
|
1037
1037
|
declare function migrateDown(db: Kysely<Database>, debug?: boolean): Promise<void>;
|
|
1038
1038
|
|
|
1039
|
+
interface PlannedStatement {
|
|
1040
|
+
sql: string;
|
|
1041
|
+
parameters: readonly unknown[];
|
|
1042
|
+
}
|
|
1043
|
+
interface PlannedMigration {
|
|
1044
|
+
name: string;
|
|
1045
|
+
/** Writes (DDL and DML) the migration would execute, in order. */
|
|
1046
|
+
statements: PlannedStatement[];
|
|
1047
|
+
/**
|
|
1048
|
+
* Set when the migration threw during planning. The statements captured
|
|
1049
|
+
* before the failure are still listed. This can be a dry-run artifact: a
|
|
1050
|
+
* migration that reads a column an earlier pending migration adds will fail
|
|
1051
|
+
* here because the earlier migration was never applied.
|
|
1052
|
+
*/
|
|
1053
|
+
error?: string;
|
|
1054
|
+
/** True when planning stopped at MAX_STATEMENTS_PER_MIGRATION. */
|
|
1055
|
+
truncated?: boolean;
|
|
1056
|
+
}
|
|
1057
|
+
interface MigrationPlan {
|
|
1058
|
+
/** Migrations already recorded as executed, in order. */
|
|
1059
|
+
executed: string[];
|
|
1060
|
+
/** Migrations `migrateToLatest` would run, in order. */
|
|
1061
|
+
pending: PlannedMigration[];
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Dry run of `migrateToLatest`: lists the pending migrations and the SQL each
|
|
1065
|
+
* would execute, without changing the database.
|
|
1066
|
+
*
|
|
1067
|
+
* Each pending migration's `up` runs against a wrapper around `db` that
|
|
1068
|
+
* passes reads through and captures writes. Nothing is written — including
|
|
1069
|
+
* the `kysely_migration` bookkeeping tables, which are only read if present.
|
|
1070
|
+
*
|
|
1071
|
+
* Because captured writes are never applied, the plan can diverge from a real
|
|
1072
|
+
* run where a migration depends on its own or an earlier migration's writes:
|
|
1073
|
+
* "tolerate duplicate column" guards never fire (so an already-present column
|
|
1074
|
+
* still shows up as an ALTER), and reads of not-yet-created columns fail (see
|
|
1075
|
+
* `PlannedMigration.error`).
|
|
1076
|
+
*/
|
|
1077
|
+
declare function planMigrations(db: Kysely<Database>): Promise<MigrationPlan>;
|
|
1078
|
+
/** Renders a plan as an SQL-ish script for printing. */
|
|
1079
|
+
declare function formatMigrationPlan(plan: MigrationPlan): string;
|
|
1080
|
+
|
|
1039
1081
|
declare function createProxyRoutesAdapter(db: Kysely<Database>): ProxyRoutesAdapter;
|
|
1040
1082
|
|
|
1041
1083
|
/**
|
|
@@ -1050,5 +1092,5 @@ declare function createAdapters(db: Kysely<Database>, databaseOptions?: {
|
|
|
1050
1092
|
useTransactions: boolean;
|
|
1051
1093
|
}): DataAdapters;
|
|
1052
1094
|
|
|
1053
|
-
export { createProxyDataAdapter, createProxyRoutesAdapter, createAdapters as default, migrateDown, migrateToLatest };
|
|
1054
|
-
export type { Database };
|
|
1095
|
+
export { createProxyDataAdapter, createProxyRoutesAdapter, createAdapters as default, formatMigrationPlan, migrateDown, migrateToLatest, planMigrations };
|
|
1096
|
+
export type { Database, MigrationPlan, PlannedMigration, PlannedStatement };
|