@forinda/kickjs-db 8.12.4 → 8.13.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.
Files changed (68) hide show
  1. package/bin/kickjs-db.mjs +11 -27
  2. package/dist/{adapter-cVrkWrul.d.mts → adapter-HRQJb4xQ.d.mts} +2 -4
  3. package/dist/adapter-HRQJb4xQ.d.mts.map +1 -0
  4. package/dist/cli.d.mts +39 -9
  5. package/dist/cli.d.mts.map +1 -1
  6. package/dist/cli.mjs +4 -4
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/{create-NrvNUwZr.mjs → create-BGFj2wGn.mjs} +3 -3
  9. package/dist/create-BGFj2wGn.mjs.map +1 -0
  10. package/dist/{custom-type-CNmg8h4k.mjs → custom-type-CyQYFrA5.mjs} +2 -2
  11. package/dist/custom-type-CyQYFrA5.mjs.map +1 -0
  12. package/dist/devtools-events.d.mts +1 -3
  13. package/dist/devtools-events.d.mts.map +1 -1
  14. package/dist/devtools-events.mjs +1 -1
  15. package/dist/{index-Nf43jLx4.d.mts → index-AaU739CK.d.mts} +329 -135
  16. package/dist/index-AaU739CK.d.mts.map +1 -0
  17. package/dist/index.d.mts +5 -5
  18. package/dist/index.mjs +2 -2
  19. package/dist/mysql.d.mts +2 -8
  20. package/dist/mysql.d.mts.map +1 -1
  21. package/dist/mysql.mjs +2 -2
  22. package/dist/mysql.mjs.map +1 -1
  23. package/dist/{pg-lghOiA3k.mjs → pg-0Zp1q4gP.mjs} +3 -3
  24. package/dist/{pg-lghOiA3k.mjs.map → pg-0Zp1q4gP.mjs.map} +1 -1
  25. package/dist/pg.d.mts +4 -12
  26. package/dist/pg.d.mts.map +1 -1
  27. package/dist/pg.mjs +2 -2
  28. package/dist/pg.mjs.map +1 -1
  29. package/dist/pglite.d.mts +1 -3
  30. package/dist/pglite.d.mts.map +1 -1
  31. package/dist/pglite.mjs +1 -1
  32. package/dist/pglite.mjs.map +1 -1
  33. package/dist/{schema-types-CdU4u-Ow.d.mts → schema-types-CsgTPOPi.d.mts} +9 -5
  34. package/dist/schema-types-CsgTPOPi.d.mts.map +1 -0
  35. package/dist/{schema-jLdsVhUe.d.mts → schema-v6Jgocab.d.mts} +3 -5
  36. package/dist/schema-v6Jgocab.d.mts.map +1 -0
  37. package/dist/schema.d.mts +1 -1
  38. package/dist/schema.mjs +2 -2
  39. package/dist/schema.mjs.map +1 -1
  40. package/dist/{split-statements-cNBnqF81.mjs → split-statements-DHYNJs5X.mjs} +2 -2
  41. package/dist/{split-statements-cNBnqF81.mjs.map → split-statements-DHYNJs5X.mjs.map} +1 -1
  42. package/dist/sqlite.d.mts +1 -7
  43. package/dist/sqlite.d.mts.map +1 -1
  44. package/dist/sqlite.mjs +2 -2
  45. package/dist/sqlite.mjs.map +1 -1
  46. package/dist/{src-BkewQb59.mjs → src-CBTegE76.mjs} +4 -4
  47. package/dist/src-CBTegE76.mjs.map +1 -0
  48. package/dist/{table-BGk08X3C.d.mts → table-B8eYtdq_.d.mts} +7 -8
  49. package/dist/table-B8eYtdq_.d.mts.map +1 -0
  50. package/dist/testing.d.mts +2 -4
  51. package/dist/testing.d.mts.map +1 -1
  52. package/dist/testing.mjs +2 -2
  53. package/dist/testing.mjs.map +1 -1
  54. package/dist/{types-8xZUYm43.d.mts → types-Bmbj69hY.d.mts} +79 -17
  55. package/dist/types-Bmbj69hY.d.mts.map +1 -0
  56. package/dist/{types-DB_xyeQT.d.mts → types-D4x2u-EZ.d.mts} +22 -5
  57. package/dist/types-D4x2u-EZ.d.mts.map +1 -0
  58. package/package.json +11 -11
  59. package/dist/adapter-cVrkWrul.d.mts.map +0 -1
  60. package/dist/create-NrvNUwZr.mjs.map +0 -1
  61. package/dist/custom-type-CNmg8h4k.mjs.map +0 -1
  62. package/dist/index-Nf43jLx4.d.mts.map +0 -1
  63. package/dist/schema-jLdsVhUe.d.mts.map +0 -1
  64. package/dist/schema-types-CdU4u-Ow.d.mts.map +0 -1
  65. package/dist/src-BkewQb59.mjs.map +0 -1
  66. package/dist/table-BGk08X3C.d.mts.map +0 -1
  67. package/dist/types-8xZUYm43.d.mts.map +0 -1
  68. package/dist/types-DB_xyeQT.d.mts.map +0 -1
@@ -1,14 +1,13 @@
1
1
 
2
- import { C as RelationSnapshot, D as ViewSnapshot, E as TableSnapshot, S as PolicySnapshot, T as SchemaSnapshot, _ as Dialect$1, b as ForeignKeySnapshot, d as SelfRef, f as SelfRefTo, g as ColumnSnapshot, h as CheckSnapshot, m as TypedColumnRefs, n as ColumnBuilder, p as TypedColumnRef, r as ColumnRef, s as GeneratedBrand, t as CheckSelfRefs, u as NotNullBrand, v as EnumSnapshot, w as RoleSnapshot, x as IndexSnapshot } from "./types-DB_xyeQT.mjs";
3
- import { b as RelationMapEntry, n as CreateDbClientOptions, r as KickDbClient } from "./types-8xZUYm43.mjs";
4
- import { f as TableConstraint, l as IndexDecl, n as TableDecl } from "./table-BGk08X3C.mjs";
5
- import { t as SchemaToTypes } from "./schema-types-CdU4u-Ow.mjs";
6
- import { s as SchemaLike, t as ColumnRule } from "./schema-jLdsVhUe.mjs";
7
- import { CompiledQuery, Expression, Expression as Expression$1, ExpressionBuilder, ExpressionBuilder as ExpressionBuilder$1, Insertable as Insertable$1, Kysely, Kysely as Kysely$1, KyselyPlugin, KyselyPlugin as KyselyPlugin$1, RawBuilder, RawBuilder as RawBuilder$1, SelectType, Selectable as Selectable$1, Sql, SqlBool, SqlBool as SqlBool$1, Updateable, sql as sql$1 } from "kysely";
8
- import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { C as RelationSnapshot, D as ViewSnapshot, E as TableSnapshot, S as PolicySnapshot, T as SchemaSnapshot, _ as Dialect$1, b as ForeignKeySnapshot, d as SelfRef, f as SelfRefTo, g as ColumnSnapshot, h as CheckSnapshot, m as TypedColumnRefs, n as ColumnBuilder, p as TypedColumnRef, r as ColumnRef, s as GeneratedBrand, t as CheckSelfRefs, u as NotNullBrand, v as EnumSnapshot, w as RoleSnapshot, x as IndexSnapshot } from "./types-D4x2u-EZ.mjs";
3
+ import { b as RelationMapEntry, n as CreateDbClientOptions, r as KickDbClient } from "./types-Bmbj69hY.mjs";
4
+ import { f as TableConstraint, l as IndexDecl, n as TableDecl } from "./table-B8eYtdq_.mjs";
5
+ import { t as SchemaToTypes } from "./schema-types-CsgTPOPi.mjs";
6
+ import { s as SchemaLike, t as ColumnRule } from "./schema-v6Jgocab.mjs";
7
+ import { Expression, Expression as Expression$1, ExpressionBuilder, Insertable, Kysely, Kysely as Kysely$1, KyselyPlugin, KyselyPlugin as KyselyPlugin$1, RawBuilder, RawBuilder as RawBuilder$1, SelectType, Selectable, Sql, SqlBool, SqlBool as SqlBool$1, Updateable, sql } from "kysely";
9
8
  import { InjectionToken } from "@forinda/kickjs";
10
9
  import { ReadonlyKysely } from "kysely/readonly";
11
- //#region src/migrate/adapter.d.ts
10
+ /** A row of the migrations table: one applied migration. */
12
11
  interface MigrationRow {
13
12
  id: string;
14
13
  name: string;
@@ -78,7 +77,7 @@ interface MigrationAdapter {
78
77
  * in TypeScript (`migration.ts`) runs with. Optional: an adapter without it
79
78
  * can't run those migrations.
80
79
  */
81
- kysely?(): Kysely<any>;
80
+ kysely?(): Kysely$1<any>;
82
81
  /** The table migrations are recorded in, when not `kick_migrations`. */
83
82
  readonly migrationsTable?: string;
84
83
  /** Close any underlying pool / connection. Caller-owned resources may keep the no-op. */
@@ -90,8 +89,10 @@ type MigrationBookkeeping = {
90
89
  } | {
91
90
  remove: string;
92
91
  };
93
- //#endregion
94
- //#region src/migrate/drift.d.ts
92
+ /**
93
+ * What a drift check does on drift: throw (`'error'`), log (`'warn'`), or skip
94
+ * the check (`'ignore'`).
95
+ */
95
96
  type DriftBehavior = 'error' | 'warn' | 'ignore';
96
97
  /**
97
98
  * What the drift check leaves out, matched by name on both sides — say the
@@ -101,13 +102,24 @@ interface DriftIgnore {
101
102
  tables?: RegExp;
102
103
  indexes?: RegExp;
103
104
  }
105
+ /** Where drift warnings go. `console` by default. */
104
106
  interface DriftLogger {
105
107
  warn: (message: string) => void;
106
108
  }
109
+ /**
110
+ * Compares a live snapshot with the one migrations expect. Under `'error'` it
111
+ * throws `MigrationDriftError` on any difference, under `'warn'` it logs it, and
112
+ * under `'ignore'` it does nothing. `ignore` leaves matching tables and indexes out.
113
+ *
114
+ * @see https://kickjs.app/guide/database/migration-recovery#drift
115
+ */
107
116
  declare function checkDrift(liveSnapshot: SchemaSnapshot, expectedSnapshot: SchemaSnapshot, behavior: DriftBehavior, log?: DriftLogger, ignore?: DriftIgnore): Promise<void>;
108
- //#endregion
109
- //#region src/cli/config.d.ts
110
117
  type MigrationAdapterFactory = () => MigrationAdapter | Promise<MigrationAdapter>;
118
+ /**
119
+ * The `db` block of `kick.config.ts`: where the schema and migrations live, the dialect, and how to connect.
120
+ *
121
+ * @see https://kickjs.app/guide/database/cli#config-fields
122
+ */
111
123
  interface DbConfig {
112
124
  schemaPath: string;
113
125
  migrationsDir: string;
@@ -164,18 +176,35 @@ interface TenantsConfig {
164
176
  /** Tenants migrated at once. Default 1. */
165
177
  concurrency?: number;
166
178
  }
179
+ /**
180
+ * Loads a config file and returns part of its `db` block with defaults filled
181
+ * in: `schemaPath` (`src/db/schema.ts`), `migrationsDir` (`db/migrations`),
182
+ * `seedsDir` (`db/seeds`), `dialect` (Postgres) and `connectionString`
183
+ * (`DATABASE_URL`), plus `adapter`, `driftCheck` and `driftIgnore` as given.
184
+ * Other fields (`casing`, `migrationsTable`, `migrationsDirs`, `tenants`) are
185
+ * not copied.
186
+ */
167
187
  declare function resolveDbConfig(opts: {
168
188
  configPath: string;
169
189
  }): Promise<DbConfig>;
170
- //#endregion
171
- //#region src/snapshot/casing.d.ts
190
+ /**
191
+ * How TypeScript keys map to database names: `'snake_case'` keeps keys
192
+ * camelCase and names tables and columns in snake_case.
193
+ *
194
+ * @see https://kickjs.app/guide/database/schema#column-names-casing
195
+ */
172
196
  type Casing = 'snake_case';
173
197
  /** A TypeScript key as the database names it: `firstName` → `first_name`. */
174
198
  declare const toDbName: (key: string) => string;
175
199
  /** A database name as a TypeScript key: `first_name` → `firstName`. */
176
200
  declare const toKeyName: (name: string) => string;
177
- //#endregion
178
- //#region src/snapshot/extract.d.ts
201
+ /**
202
+ * Builds a `SchemaSnapshot` from a schema module's exports: tables, views,
203
+ * Postgres enums and roles, and relations. Names are the database's (after
204
+ * `casing` and `.colName()`) unless `keys` is set.
205
+ *
206
+ * @see https://kickjs.app/guide/database/concepts
207
+ */
179
208
  declare function extractSnapshot(schema: Record<string, unknown>, dialect: Dialect$1, options?: {
180
209
  casing?: Casing;
181
210
  /**
@@ -184,8 +213,6 @@ declare function extractSnapshot(schema: Record<string, unknown>, dialect: Diale
184
213
  */
185
214
  keys?: boolean;
186
215
  }): SchemaSnapshot;
187
- //#endregion
188
- //#region src/snapshot/name.d.ts
189
216
  /**
190
217
  * Shorten an identifier to fit Postgres' limit, deterministically.
191
218
  *
@@ -211,8 +238,6 @@ declare function extractSnapshot(schema: Record<string, unknown>, dialect: Diale
211
238
  * every constraint name they already have.
212
239
  */
213
240
  declare function fitIdentifier(name: string): string;
214
- //#endregion
215
- //#region src/snapshot/render.d.ts
216
241
  /**
217
242
  * Render a SchemaSnapshot to TypeScript source matching the kickjs-db DSL.
218
243
  * Inverse of extractSnapshot().
@@ -230,8 +255,6 @@ declare function fitIdentifier(name: string): string;
230
255
  * Custom-named constraints fall back to the third-arg callback / FK helper.
231
256
  */
232
257
  declare function renderSchemaSource(snapshot: SchemaSnapshot): string;
233
- //#endregion
234
- //#region src/diff/types.d.ts
235
258
  /**
236
259
  * `CREATE SCHEMA IF NOT EXISTS "x"` — emitted ahead of every table change so
237
260
  * a new schema exists before anything is created inside it.
@@ -245,35 +268,42 @@ interface CreateSchema {
245
268
  kind: 'createSchema';
246
269
  schema: string;
247
270
  }
271
+ /** Create a table. */
248
272
  interface CreateTable {
249
273
  kind: 'createTable';
250
274
  table: TableSnapshot;
251
275
  }
276
+ /** Drop a table. */
252
277
  interface DropTable {
253
278
  kind: 'dropTable';
254
279
  table: TableSnapshot;
255
280
  }
281
+ /** Rename a table. */
256
282
  interface RenameTable {
257
283
  kind: 'renameTable';
258
284
  from: string;
259
285
  to: string;
260
286
  }
287
+ /** Add a column to a table. */
261
288
  interface AddColumn {
262
289
  kind: 'addColumn';
263
290
  table: string;
264
291
  column: ColumnSnapshot;
265
292
  }
293
+ /** Drop a column from a table. */
266
294
  interface DropColumn {
267
295
  kind: 'dropColumn';
268
296
  table: string;
269
297
  column: ColumnSnapshot;
270
298
  }
299
+ /** Rename a column. */
271
300
  interface RenameColumn {
272
301
  kind: 'renameColumn';
273
302
  table: string;
274
303
  from: string;
275
304
  to: string;
276
305
  }
306
+ /** Change a column's definition; `before` and `after` are the whole column. */
277
307
  interface AlterColumn {
278
308
  kind: 'alterColumn';
279
309
  table: string;
@@ -281,30 +311,36 @@ interface AlterColumn {
281
311
  before: ColumnSnapshot;
282
312
  after: ColumnSnapshot;
283
313
  }
314
+ /** Create an index. */
284
315
  interface AddIndex {
285
316
  kind: 'addIndex';
286
317
  table: string;
287
318
  index: IndexSnapshot;
288
319
  }
320
+ /** Drop an index. */
289
321
  interface DropIndex {
290
322
  kind: 'dropIndex';
291
323
  table: string;
292
324
  index: IndexSnapshot;
293
325
  }
326
+ /** Add a foreign-key constraint. */
294
327
  interface AddForeignKey {
295
328
  kind: 'addForeignKey';
296
329
  table: string;
297
330
  fk: ForeignKeySnapshot;
298
331
  }
332
+ /** Drop a foreign-key constraint. */
299
333
  interface DropForeignKey {
300
334
  kind: 'dropForeignKey';
301
335
  table: string;
302
336
  fk: ForeignKeySnapshot;
303
337
  }
338
+ /** Create a Postgres enum type. */
304
339
  interface CreateEnum {
305
340
  kind: 'createEnum';
306
341
  enum: EnumSnapshot;
307
342
  }
343
+ /** Drop a Postgres enum type. */
308
344
  interface DropEnum {
309
345
  kind: 'dropEnum';
310
346
  enum: EnumSnapshot;
@@ -377,11 +413,13 @@ interface AlterPrimaryKey {
377
413
  before: PrimaryKeyShape;
378
414
  after: PrimaryKeyShape;
379
415
  }
416
+ /** Add a `CHECK` constraint. */
380
417
  interface AddCheck {
381
418
  kind: 'addCheck';
382
419
  table: string;
383
420
  check: CheckSnapshot;
384
421
  }
422
+ /** Drop a `CHECK` constraint. */
385
423
  interface DropCheck {
386
424
  kind: 'dropCheck';
387
425
  table: string;
@@ -411,11 +449,13 @@ interface SetRowLevelSecurity {
411
449
  force?: true;
412
450
  } | null;
413
451
  }
452
+ /** Create a row-level security policy (Postgres). */
414
453
  interface CreatePolicy {
415
454
  kind: 'createPolicy';
416
455
  table: string;
417
456
  policy: PolicySnapshot;
418
457
  }
458
+ /** Drop a row-level security policy (Postgres). */
419
459
  interface DropPolicy {
420
460
  kind: 'dropPolicy';
421
461
  table: string;
@@ -449,10 +489,10 @@ interface SetColumnComment {
449
489
  from: string | null;
450
490
  to: string | null;
451
491
  }
492
+ /** One schema change `diff()` produces; `kind` says which. */
452
493
  type Change = CreateSchema | CreateTable | DropTable | RenameTable | AddColumn | DropColumn | RenameColumn | AlterColumn | AddIndex | DropIndex | AddForeignKey | DropForeignKey | CreateEnum | DropEnum | AddEnumValue | RemoveEnumValue | AlterPrimaryKey | AddCheck | DropCheck | SetTableComment | SetColumnComment | CreateView | DropView | CreateRole | AlterRole | SetRowLevelSecurity | CreatePolicy | DropPolicy;
494
+ /** The changes between two snapshots, in the order they apply. */
453
495
  type ChangeSet = Change[];
454
- //#endregion
455
- //#region src/diff/engine.d.ts
456
496
  /**
457
497
  * Renames to apply instead of a drop and an add. Names are qualified
458
498
  * (`billing.invoices`) when the table lives in a schema.
@@ -463,6 +503,7 @@ interface RenameHints {
463
503
  /** `<new table>.<old column>` → new column name. */
464
504
  columns?: Record<string, string>;
465
505
  }
506
+ /** Options for `diff()`: renames to apply instead of a drop and an add. */
466
507
  interface DiffOptions {
467
508
  renames?: RenameHints;
468
509
  /**
@@ -471,6 +512,14 @@ interface DiffOptions {
471
512
  */
472
513
  explicitRenames?: boolean;
473
514
  }
515
+ /**
516
+ * The changes that turn the `prev` snapshot into `next`, ordered so they can
517
+ * be applied in sequence. A dropped and an added table or column are paired as
518
+ * a rename when `renames` names them, or, unless `explicitRenames` is set, when
519
+ * there is exactly one of each.
520
+ *
521
+ * @see https://kickjs.app/guide/database/migrations#renames
522
+ */
474
523
  declare function diff(prev: SchemaSnapshot, next: SchemaSnapshot, options?: DiffOptions): ChangeSet;
475
524
  /** Drops that might be renames: each lists what it could have become. */
476
525
  interface RenameCandidates {
@@ -490,8 +539,6 @@ interface RenameCandidates {
490
539
  * where a drop might really be a rename, so someone should say which.
491
540
  */
492
541
  declare function findRenameCandidates(prev: SchemaSnapshot, next: SchemaSnapshot): RenameCandidates;
493
- //#endregion
494
- //#region src/diff/invert.d.ts
495
542
  /**
496
543
  * Reverse a forward ChangeSet so emitting it produces the SQL that undoes
497
544
  * the forward migration.
@@ -508,9 +555,17 @@ declare function findRenameCandidates(prev: SchemaSnapshot, next: SchemaSnapshot
508
555
  * table built up.
509
556
  */
510
557
  declare function invertChanges(forward: ChangeSet): ChangeSet;
558
+ /**
559
+ * True when the change set holds a change whose reverse can't be generated
560
+ * faithfully (a dropped table or column, an altered column, an enum value
561
+ * added or removed), so its `down.sql` is only a draft.
562
+ */
511
563
  declare function hasAmbiguousReverse(forward: ChangeSet): boolean;
512
- //#endregion
513
- //#region src/errors.d.ts
564
+ /**
565
+ * Base class for kick/db errors. `code` is a stable string to match on instead of the message.
566
+ *
567
+ * @see https://kickjs.app/guide/database/errors
568
+ */
514
569
  declare class KickDbError extends Error {
515
570
  readonly code: string;
516
571
  constructor(code: string, message: string);
@@ -533,8 +588,6 @@ declare class RemovedValueAsDefaultError extends KickDbError {
533
588
  readonly value: string;
534
589
  constructor(enumName: string, table: string, column: string, value: string);
535
590
  }
536
- //#endregion
537
- //#region src/diff/composite-detect.d.ts
538
591
  /**
539
592
  * One composite-type field that holds the target enum. The composite
540
593
  * may itself be referenced by table columns; that second level is not
@@ -585,8 +638,13 @@ declare class CompositeEnumReferenceError extends KickDbError {
585
638
  readonly refs: readonly CompositeRef[];
586
639
  constructor(refs: readonly CompositeRef[]);
587
640
  }
588
- //#endregion
589
- //#region src/query/relations.d.ts
641
+ /**
642
+ * Resolved-relation sidecar consumed by the query compiler. The
643
+ * shape is canonical and lives on `SchemaSnapshot.relations`; we
644
+ * re-export the same alias here so compile-time consumers can stay
645
+ * scoped to `query/` imports without reaching into the snapshot
646
+ * module.
647
+ */
590
648
  type ResolvedRelation = RelationSnapshot;
591
649
  /**
592
650
  * Sidecar map: source table → relation name → resolved entry. Lives
@@ -594,8 +652,6 @@ type ResolvedRelation = RelationSnapshot;
594
652
  * `extractRelations()` (`query/extract-relations.ts`).
595
653
  */
596
654
  type ResolvedRelations = Record<string, Record<string, ResolvedRelation>>;
597
- //#endregion
598
- //#region src/client/wrap.d.ts
599
655
  /**
600
656
  * A query ran on a call chain whose transaction had already finished —
601
657
  * typically a promise started inside `transaction()` that wasn't awaited.
@@ -603,8 +659,7 @@ type ResolvedRelations = Record<string, Record<string, ResolvedRelation>>;
603
659
  declare class TransactionFinishedError extends KickDbError {
604
660
  constructor();
605
661
  }
606
- //#endregion
607
- //#region src/db-errors.d.ts
662
+ /** The dialect a `DatabaseError` came from. */
608
663
  type DbDialect = 'postgres' | 'mysql' | 'sqlite';
609
664
  /** What the database reported, parsed. */
610
665
  interface DatabaseErrorInfo {
@@ -666,17 +721,32 @@ declare class ConnectionError extends DatabaseError {
666
721
  * one (a `TypeError` from your own code, an error already translated).
667
722
  */
668
723
  declare function translateDbError(err: unknown, dialect: DbDialect): unknown;
669
- //#endregion
670
- //#region src/migrate/errors.d.ts
724
+ /**
725
+ * Base class for errors from the migration runner.
726
+ *
727
+ * @see https://kickjs.app/guide/database/errors#migrations
728
+ */
671
729
  declare class MigrationError extends KickDbError {}
730
+ /**
731
+ * Another process holds the migration lock (`code: 'migration_lock_held'`).
732
+ *
733
+ * @see https://kickjs.app/guide/database/migration-recovery#a-stuck-lock
734
+ */
672
735
  declare class MigrationLockError extends MigrationError {
673
736
  constructor(message: string);
674
737
  }
738
+ /** What a drift check found, by name: what the live database added, removed or changed. */
675
739
  interface SchemaDiffSummary {
676
740
  added: string[];
677
741
  removed: string[];
678
742
  changed: string[];
679
743
  }
744
+ /**
745
+ * The live database differs from the snapshot of the last applied migration
746
+ * (`code: 'migration_drift'`). `diff` lists what differs.
747
+ *
748
+ * @see https://kickjs.app/guide/database/migration-recovery#drift
749
+ */
680
750
  declare class MigrationDriftError extends MigrationError {
681
751
  readonly diff: SchemaDiffSummary;
682
752
  constructor(message: string, diff: SchemaDiffSummary);
@@ -690,12 +760,24 @@ declare class MigrationFailedError extends MigrationError {
690
760
  readonly id: string;
691
761
  constructor(id: string, cause: unknown);
692
762
  }
763
+ /**
764
+ * A reviewed migration's files changed after review (`code: 'migration_hash_mismatch'`).
765
+ * `expected` is the recorded hash, `actual` the files' current one.
766
+ *
767
+ * @see https://kickjs.app/guide/database/migration-recovery#hash-mismatch
768
+ */
693
769
  declare class MigrationHashError extends MigrationError {
694
770
  readonly id: string;
695
771
  readonly expected: string;
696
772
  readonly actual: string;
697
773
  constructor(id: string, expected: string, actual: string);
698
774
  }
775
+ /**
776
+ * A migration not marked reviewed was about to run while `requireReviewed` is on
777
+ * (`code: 'migration_unreviewed'`). Run `kick db migrate review <id>` first.
778
+ *
779
+ * @see https://kickjs.app/guide/database/migration-recovery#unreviewed-migration
780
+ */
699
781
  declare class UnreviewedMigrationError extends MigrationError {
700
782
  readonly id: string;
701
783
  constructor(id: string);
@@ -712,8 +794,6 @@ declare class MigrationEnumDropError extends MigrationError {
712
794
  readonly columns: readonly string[];
713
795
  constructor(id: string, enums: readonly string[], removed: readonly string[], columns: readonly string[]);
714
796
  }
715
- //#endregion
716
- //#region src/migrate/enum-drop-gate.d.ts
717
797
  /**
718
798
  * Runner gate for the `-- KICK ENUM REMOVE` header.
719
799
  *
@@ -749,26 +829,33 @@ declare function parseEnumDropHeader(sql: string): EnumDropHeader | null;
749
829
  * silently otherwise.
750
830
  */
751
831
  declare function enforceEnumDropGate(id: string, sql: string, confirmEnumDrop: boolean): EnumDropHeader | null;
752
- //#endregion
753
- //#region src/migrate/journal.d.ts
832
+ /** One migration in `_journal.json`: its id, name (`tag`), recorded hash and creation time. */
754
833
  interface JournalEntry {
755
834
  id: string;
756
835
  tag: string;
757
836
  hash: string;
758
837
  createdAt: string;
759
838
  }
839
+ /** The contents of a migrations folder's `_journal.json`. */
760
840
  interface Journal {
761
841
  version: 1;
762
842
  dialect: Dialect$1;
763
843
  entries: JournalEntry[];
764
844
  }
845
+ /** Reads a migrations folder's `_journal.json`; a folder without one gives an empty journal. */
765
846
  declare function readJournal(migrationsDir: string, dialect: Dialect$1): Promise<Journal>;
847
+ /** Adds an entry to a migrations folder's `_journal.json` and writes it back. */
766
848
  declare function appendJournalEntry(migrationsDir: string, dialect: Dialect$1, entry: JournalEntry): Promise<void>;
849
+ /**
850
+ * The hash of a migration folder's `up.sql`, `down.sql` and `snapshot.json`, plus
851
+ * its `migration.ts` when it has one: `sha256:<hex>`.
852
+ */
767
853
  declare function computeMigrationHash(migrationDir: string): Promise<string>;
854
+ /** True when a migration folder's current hash equals `expected`. */
768
855
  declare function verifyMigrationHash(migrationDir: string, expected: string): Promise<boolean>;
769
- //#endregion
770
- //#region src/migrate/schema.d.ts
856
+ /** The default name of the table applied migrations are recorded in. */
771
857
  declare const KICK_MIGRATIONS_TABLE = "kick_migrations";
858
+ /** The default name of the migration lock table. */
772
859
  declare const KICK_LOCK_TABLE = "kick_migrations_lock";
773
860
  /** The lock table that goes with a migrations table. */
774
861
  declare function lockTableName(table: string): string;
@@ -779,10 +866,16 @@ declare function pushTableName(table: string): string;
779
866
  * Postgres (`meta.kick_migrations`); elsewhere a dot is part of the name.
780
867
  */
781
868
  declare function quoteTable(dialect: Dialect$1, name: string): string;
869
+ /**
870
+ * The dialect's `CREATE TABLE IF NOT EXISTS` for the migrations table and its
871
+ * `batch` index. On Postgres a schema-qualified name also creates the schema.
872
+ */
782
873
  declare function migrationsTableDdl(dialect: Dialect$1, table?: string): string;
874
+ /**
875
+ * The dialect's `CREATE TABLE IF NOT EXISTS` for the lock table that goes with
876
+ * `table`, and the insert of its single row.
877
+ */
783
878
  declare function lockTableDdl(dialect: Dialect$1, table?: string): string;
784
- //#endregion
785
- //#region src/migrate/memory-adapter.d.ts
786
879
  /**
787
880
  * In-memory MigrationAdapter for unit tests. Lock semantics are exact (single-
788
881
  * holder atomic), but applySqlInTx / applySqlNoTx / introspect are shaped as
@@ -813,8 +906,6 @@ declare class MemoryMigrationAdapter implements MigrationAdapter {
813
906
  /** Test-only inspector — what SQL we received. */
814
907
  __appliedSql(): readonly string[];
815
908
  }
816
- //#endregion
817
- //#region src/migrate/introspect-types.d.ts
818
909
  /**
819
910
  * Driver-agnostic SQL runner. Both pg.Client and pg.Pool match this shape via
820
911
  * structural typing. Lets introspectPg() stay portable across pg / pg-pool /
@@ -825,17 +916,20 @@ interface PgQueryRunner {
825
916
  rows: R[];
826
917
  }>;
827
918
  }
919
+ /** Options for `introspectPg()`. */
828
920
  interface IntrospectPgOptions {
829
921
  /** Default 'public'. */
830
922
  schema?: string;
831
923
  /** Migration tracking tables to skip. Default ['kick_migrations', 'kick_migrations_lock', 'kick_migrations_push']. */
832
924
  excludeTables?: readonly string[];
833
925
  }
834
- //#endregion
835
- //#region src/migrate/introspect-pg.d.ts
926
+ /**
927
+ * Reads a live Postgres schema into a `SchemaSnapshot`. Skips the migration
928
+ * tracking tables unless `excludeTables` says otherwise.
929
+ *
930
+ * @see https://kickjs.app/guide/database/migrations#introspection
931
+ */
836
932
  declare function introspectPg(client: PgQueryRunner, opts?: IntrospectPgOptions): Promise<SchemaSnapshot>;
837
- //#endregion
838
- //#region src/migrate/introspect-sqlite.d.ts
839
933
  /**
840
934
  * Minimal better-sqlite3 surface introspection needs (sync `.all()`).
841
935
  *
@@ -850,6 +944,7 @@ interface SqliteIntrospectDb {
850
944
  all(...params: unknown[]): unknown[];
851
945
  };
852
946
  }
947
+ /** SQLite introspection options. `excludeTables` defaults to the migration tracking tables. */
853
948
  interface IntrospectSqliteOptions {
854
949
  excludeTables?: string[];
855
950
  }
@@ -867,12 +962,11 @@ declare function introspectSqlite(db: SqliteIntrospectDb, opts?: IntrospectSqlit
867
962
  * `query` runs one statement and resolves with its rows.
868
963
  */
869
964
  declare function introspectSqliteAsync(query: (sql: string, params: unknown[]) => Promise<unknown[]>, opts?: IntrospectSqliteOptions): Promise<SchemaSnapshot>;
870
- //#endregion
871
- //#region src/migrate/introspect-mysql.d.ts
872
965
  /** Minimal mysql2 surface introspection needs. Returns `[rows, fields]`. */
873
966
  interface MysqlIntrospectDb {
874
967
  query<R = unknown>(sql: string, params?: readonly unknown[]): Promise<[R, unknown]>;
875
968
  }
969
+ /** MySQL introspection options. `excludeTables` defaults to the migration tracking tables. */
876
970
  interface IntrospectMysqlOptions {
877
971
  excludeTables?: string[];
878
972
  }
@@ -884,17 +978,13 @@ interface IntrospectMysqlOptions {
884
978
  * introspect` rather than byte-exact drift against a code-first snapshot.
885
979
  */
886
980
  declare function introspectMysql(db: MysqlIntrospectDb, opts?: IntrospectMysqlOptions): Promise<SchemaSnapshot>;
887
- //#endregion
888
- //#region src/migrate/code-migration.d.ts
889
981
  /** What a migration written in TypeScript runs with: Kysely on the migration's transaction. */
890
- type MigrationDb = Kysely<any>;
982
+ type MigrationDb = Kysely$1<any>;
891
983
  /** A migration's code, from its `migration.ts`. */
892
984
  interface CodeMigration {
893
985
  up(db: MigrationDb): Promise<void>;
894
986
  down?(db: MigrationDb): Promise<void>;
895
987
  }
896
- //#endregion
897
- //#region src/migrate/source.d.ts
898
988
  /** Migration files held in memory — what `migrationFiles()` returns. */
899
989
  interface MigrationFiles {
900
990
  readonly __migrationFiles: true;
@@ -921,9 +1011,18 @@ type MigrationsLocation = string | MigrationFiles | readonly (string | Migration
921
1011
  * TypeScript needs both: its text in `files`, its module in `modules`.
922
1012
  */
923
1013
  declare function migrationFiles(files: Record<string, string>, modules?: Record<string, unknown>): MigrationFiles;
924
- //#endregion
925
- //#region src/adapter.d.ts
1014
+ /**
1015
+ * What `kickDbAdapter` does about pending migrations on boot: throw
1016
+ * (`'fail-if-pending'`, the default), apply them (`'apply'`), or boot anyway (`'ignore'`).
1017
+ *
1018
+ * @see https://kickjs.app/guide/database/migrations#boot-time-policy
1019
+ */
926
1020
  type MigrationsOnBoot = 'fail-if-pending' | 'apply' | 'ignore';
1021
+ /**
1022
+ * Options for `kickDbAdapter()`.
1023
+ *
1024
+ * @see https://kickjs.app/guide/database/migrations#boot-time-policy
1025
+ */
927
1026
  interface KickDbAdapterConfig {
928
1027
  /** The driver-bound MigrationAdapter — pgAdapter() in @forinda/kickjs-db/pg, etc. */
929
1028
  migrationAdapter: MigrationAdapter;
@@ -980,20 +1079,45 @@ interface KickDbAdapterConfig {
980
1079
  * separately under DB_PRIMARY.
981
1080
  */
982
1081
  declare const kickDbAdapter: import("@forinda/kickjs").AdapterFactory<KickDbAdapterConfig, unknown>;
983
- //#endregion
984
- //#region src/tokens.d.ts
1082
+ /**
1083
+ * A ready-made DI token for the primary database client. Nothing registers it
1084
+ * for you: register your client under it, then `@Inject(DB_PRIMARY)`.
1085
+ *
1086
+ * @see https://kickjs.app/guide/database/
1087
+ */
985
1088
  declare const DB_PRIMARY: InjectionToken<KickDbClient>;
1089
+ /**
1090
+ * A ready-made DI token for a read-replica client. Nothing registers it for you.
1091
+ *
1092
+ * @see https://kickjs.app/guide/database/
1093
+ */
986
1094
  declare const DB_REPLICA: InjectionToken<KickDbClient>;
987
1095
  /**
988
1096
  * Alias for the default DB. Adopters who only have one database can inject
989
1097
  * `DB_CLIENT` instead of remembering whether it's primary/replica.
990
1098
  */
991
1099
  declare const DB_CLIENT: InjectionToken<KickDbClient<unknown>>;
992
- //#endregion
993
- //#region src/client/create.d.ts
1100
+ /**
1101
+ * Creates the typed database client for a schema and a Kysely dialect. Row
1102
+ * types come from `schema`; options add read replicas, tenancy, lifecycle
1103
+ * events and extra Kysely plugins.
1104
+ *
1105
+ * @example
1106
+ * ```ts
1107
+ * import Database from 'better-sqlite3'
1108
+ * import { createDbClient } from '@forinda/kickjs-db'
1109
+ * import { sqliteDialect } from '@forinda/kickjs-db/sqlite'
1110
+ * import * as schema from './schema'
1111
+ *
1112
+ * export const db = createDbClient({
1113
+ * schema,
1114
+ * dialect: sqliteDialect({ database: new Database('dev.db') }),
1115
+ * })
1116
+ * ```
1117
+ *
1118
+ * @see https://kickjs.app/guide/database/
1119
+ */
994
1120
  declare function createDbClient<TSchema, DB = SchemaToTypes<TSchema>>(opts: CreateDbClientOptions<TSchema, DB>): KickDbClient<DB>;
995
- //#endregion
996
- //#region src/client/plugins.d.ts
997
1121
  /**
998
1122
  * Pass this to `createDbClient({ plugins: [...] })` so
999
1123
  * `eb('col', '=', null)` (plus `!=` / `<>`) compiles to `IS NULL` /
@@ -1031,9 +1155,12 @@ declare function createDbClient<TSchema, DB = SchemaToTypes<TSchema>>(opts: Crea
1031
1155
  * literal `null` keyword inline so PG accepts it. Tracked upstream
1032
1156
  * at <https://github.com/forinda/kick-js/issues/220>.
1033
1157
  */
1034
- declare function safeNullComparison(): KyselyPlugin;
1035
- //#endregion
1036
- //#region src/migrate/runner.d.ts
1158
+ declare function safeNullComparison(): KyselyPlugin$1;
1159
+ /**
1160
+ * Options for the migration runner (`migrateLatest()`, `migrateUp()`, `migrateDown()`, ...).
1161
+ *
1162
+ * @see https://kickjs.app/guide/database/migrations#running-migrations-from-code
1163
+ */
1037
1164
  interface RunnerOptions {
1038
1165
  adapter: MigrationAdapter;
1039
1166
  /**
@@ -1065,10 +1192,18 @@ interface RunnerOptions {
1065
1192
  */
1066
1193
  confirmEnumDrop?: boolean;
1067
1194
  }
1195
+ /** What a forward run applied: the migration ids, and their batch (`null` when none ran). */
1068
1196
  interface AppliedSummary {
1069
1197
  applied: string[];
1070
1198
  batch: number | null;
1071
1199
  }
1200
+ /**
1201
+ * Applies every pending migration as one batch, under the migration lock.
1202
+ * Checks drift first, and refuses unreviewed or edited migrations as
1203
+ * `requireReviewed` says.
1204
+ *
1205
+ * @see https://kickjs.app/guide/database/migrations#running-migrations-from-code
1206
+ */
1072
1207
  declare function migrateLatest(opts: RunnerOptions): Promise<AppliedSummary>;
1073
1208
  /**
1074
1209
  * Apply the next pending migration — or, with `to`, every pending one up to
@@ -1077,6 +1212,7 @@ declare function migrateLatest(opts: RunnerOptions): Promise<AppliedSummary>;
1077
1212
  declare function migrateUp(opts: RunnerOptions & {
1078
1213
  to?: string;
1079
1214
  }): Promise<AppliedSummary>;
1215
+ /** What `migrateDown()` reversed. */
1080
1216
  interface ReversedSummary {
1081
1217
  /** The last migration reversed, or null when there was none. */
1082
1218
  reversed: string | null;
@@ -1090,10 +1226,12 @@ interface ReversedSummary {
1090
1226
  declare function migrateDown(opts: RunnerOptions & {
1091
1227
  to?: string;
1092
1228
  }): Promise<ReversedSummary>;
1229
+ /** What `migrateRollback()` reversed: the migration ids, and the batch. */
1093
1230
  interface RollbackSummary {
1094
1231
  reversed: string[];
1095
1232
  batch: number | null;
1096
1233
  }
1234
+ /** One migration as `migrateStatus()` reports it: its state, batch and review state. */
1097
1235
  interface StatusEntry {
1098
1236
  id: string;
1099
1237
  tag: string;
@@ -1103,13 +1241,23 @@ interface StatusEntry {
1103
1241
  appliedAt: string | null;
1104
1242
  reviewed: boolean;
1105
1243
  }
1244
+ /**
1245
+ * Lists every migration in the journal(s) with its state (applied or pending),
1246
+ * batch, applied time and review state. Creates the migrations tables if they
1247
+ * are missing; changes nothing else.
1248
+ *
1249
+ * @see https://kickjs.app/guide/database/cli#migrate-status
1250
+ */
1106
1251
  declare function migrateStatus(opts: Pick<RunnerOptions, 'adapter' | 'migrationsDir'>): Promise<StatusEntry[]>;
1107
1252
  /** Reverse the last batch — or, with `all`, every applied migration. */
1108
1253
  declare function migrateRollback(opts: RunnerOptions & {
1109
1254
  all?: boolean;
1110
1255
  }): Promise<RollbackSummary>;
1111
- //#endregion
1112
- //#region src/migrate/tenants.d.ts
1256
+ /**
1257
+ * Options for `migrateTenants()`: the runner options, plus the tenants and an adapter per tenant.
1258
+ *
1259
+ * @see https://kickjs.app/guide/database/tenancy#migrations-per-tenant
1260
+ */
1113
1261
  interface MigrateTenantsOptions extends Omit<RunnerOptions, 'adapter'> {
1114
1262
  /** The tenants to migrate, or a function returning them (read from the central database). */
1115
1263
  tenants: readonly string[] | (() => readonly string[] | Promise<readonly string[]>);
@@ -1126,12 +1274,14 @@ interface MigrateTenantsOptions extends Omit<RunnerOptions, 'adapter'> {
1126
1274
  /** Called as each tenant finishes. */
1127
1275
  onTenant?: (result: TenantMigrationResult) => void;
1128
1276
  }
1277
+ /** How one tenant's migration went: its summary, or the error. */
1129
1278
  interface TenantMigrationResult {
1130
1279
  tenant: string;
1131
1280
  /** What was applied, when it succeeded. */
1132
1281
  summary?: AppliedSummary;
1133
1282
  error?: unknown;
1134
1283
  }
1284
+ /** What `migrateTenants()` returns: each tenant's result, and the ones that failed. */
1135
1285
  interface MigrateTenantsResult {
1136
1286
  results: TenantMigrationResult[];
1137
1287
  /** The tenants whose migration failed. */
@@ -1143,8 +1293,7 @@ interface MigrateTenantsResult {
1143
1293
  * one that failed) catches up on the next run.
1144
1294
  */
1145
1295
  declare function migrateTenants(opts: MigrateTenantsOptions): Promise<MigrateTenantsResult>;
1146
- //#endregion
1147
- //#region src/migrate/review.d.ts
1296
+ /** What `reviewMigration()` did. */
1148
1297
  interface ReviewResult {
1149
1298
  id: string;
1150
1299
  /** True when the migration was already reviewed — its hash is re-recorded. */
@@ -1161,8 +1310,11 @@ interface ReviewResult {
1161
1310
  * first, so the recorded hash covers them.
1162
1311
  */
1163
1312
  declare function reviewMigration(migrationsDir: string, id: string): Promise<ReviewResult>;
1164
- //#endregion
1165
- //#region src/migrate/push.d.ts
1313
+ /**
1314
+ * Options for `push()`, which applies the schema to the database without writing a migration.
1315
+ *
1316
+ * @see https://kickjs.app/guide/database/cli#push
1317
+ */
1166
1318
  interface PushOptions {
1167
1319
  adapter: MigrationAdapter;
1168
1320
  /** The schema module — what `createDbClient({ schema })` takes. */
@@ -1178,6 +1330,7 @@ interface PushOptions {
1178
1330
  */
1179
1331
  confirmDataLoss?: (losses: string[]) => Promise<boolean>;
1180
1332
  }
1333
+ /** What `push()` did: whether there was anything to push, and how many changes. */
1181
1334
  interface PushResult {
1182
1335
  status: 'pushed' | 'no-changes';
1183
1336
  changeCount: number;
@@ -1189,11 +1342,8 @@ interface PushResult {
1189
1342
  * `kick db generate`.
1190
1343
  */
1191
1344
  declare function pushSchema(opts: PushOptions): Promise<PushResult>;
1192
- //#endregion
1193
- //#region src/emit/pg.d.ts
1345
+ /** Renders a change set as Postgres DDL, one change after another. */
1194
1346
  declare function emitPg(changes: ChangeSet): string;
1195
- //#endregion
1196
- //#region src/emit/sqlite.d.ts
1197
1347
  /**
1198
1348
  * Raised when a change set needs a SQLite table rebuild but the emitter
1199
1349
  * wasn't given the resolved snapshots to build it from (it only has the
@@ -1226,8 +1376,6 @@ interface SqliteEmitContext {
1226
1376
  * are folded into `CREATE TABLE` (SQLite has no `ADD CONSTRAINT`).
1227
1377
  */
1228
1378
  declare function emitSqlite(changes: ChangeSet, ctx?: SqliteEmitContext): string;
1229
- //#endregion
1230
- //#region src/emit/mysql.d.ts
1231
1379
  /**
1232
1380
  * Emit MySQL DDL for a change set.
1233
1381
  *
@@ -1245,8 +1393,7 @@ declare function emitSqlite(changes: ChangeSet, ctx?: SqliteEmitContext): string
1245
1393
  * column types, not standalone objects).
1246
1394
  */
1247
1395
  declare function emitMysql(changes: ChangeSet): string;
1248
- //#endregion
1249
- //#region src/cli/generate.d.ts
1396
+ /** Options for `generate()`. */
1250
1397
  interface GenerateOptions {
1251
1398
  name: string;
1252
1399
  config: DbConfig;
@@ -1306,15 +1453,27 @@ interface GenerateOptions {
1306
1453
  value: string;
1307
1454
  }) => void;
1308
1455
  }
1456
+ /** What `generate()` did: whether it wrote a migration, where, and how many changes it holds. */
1309
1457
  interface GenerateResult {
1310
1458
  status: 'created' | 'no-changes';
1311
1459
  migrationDir?: string;
1312
1460
  changeCount: number;
1313
1461
  empty?: boolean;
1314
1462
  }
1463
+ /**
1464
+ * Writes a migration for the changes between the last migration's snapshot
1465
+ * and the schema: what `kick db generate` runs. Each concurrent index change
1466
+ * gets a migration of its own. With `empty` or `typescript`, writes an empty
1467
+ * migration that carries the snapshot over.
1468
+ *
1469
+ * @see https://kickjs.app/guide/database/migrations#generating-a-migration
1470
+ */
1315
1471
  declare function generate(opts: GenerateOptions): Promise<GenerateResult>;
1316
- //#endregion
1317
- //#region src/cli/check.d.ts
1472
+ /**
1473
+ * What `checkMigrations()` found; `ok` is true when there is nothing to fix.
1474
+ *
1475
+ * @see https://kickjs.app/guide/database/cli#check
1476
+ */
1318
1477
  interface CheckResult {
1319
1478
  /** Changes in the schema that no migration covers yet — run `kick db generate`. */
1320
1479
  unmigratedChanges: number;
@@ -1333,8 +1492,11 @@ declare function checkMigrations(opts: {
1333
1492
  config: DbConfig;
1334
1493
  cwd: string;
1335
1494
  }): Promise<CheckResult>;
1336
- //#endregion
1337
- //#region src/cli/seed.d.ts
1495
+ /**
1496
+ * What `runSeeds()` ran.
1497
+ *
1498
+ * @see https://kickjs.app/guide/database/cli#seed
1499
+ */
1338
1500
  interface SeedResult {
1339
1501
  /** The seed files run, in order. */
1340
1502
  ran: string[];
@@ -1350,8 +1512,6 @@ declare function runSeeds(opts: {
1350
1512
  dir: string;
1351
1513
  names?: string[];
1352
1514
  }): Promise<SeedResult>;
1353
- //#endregion
1354
- //#region src/seed/fake.d.ts
1355
1515
  type Row = Record<string, unknown>;
1356
1516
  /** What an override gets: the row's index and a random number source seeded for that column. */
1357
1517
  interface FakeContext {
@@ -1361,6 +1521,11 @@ interface FakeContext {
1361
1521
  }
1362
1522
  /** A column's value: fixed, or computed per row. */
1363
1523
  type FakeOverride = unknown | ((ctx: FakeContext) => unknown);
1524
+ /**
1525
+ * Options for `fakeRows()`: how many rows, the seed, and values for chosen columns.
1526
+ *
1527
+ * @see https://kickjs.app/guide/database/cli#generated-sample-data
1528
+ */
1364
1529
  interface FakeRowsOptions {
1365
1530
  count: number;
1366
1531
  /** The same seed gives the same rows. Default `1`. */
@@ -1370,6 +1535,11 @@ interface FakeRowsOptions {
1370
1535
  /** Values a foreign-key column picks from, by column key — usually the parent rows' keys. */
1371
1536
  refs?: Record<string, readonly unknown[]>;
1372
1537
  }
1538
+ /**
1539
+ * Options for `seedFake()`: rows per table, the seed, and values for chosen columns.
1540
+ *
1541
+ * @see https://kickjs.app/guide/database/cli#generated-sample-data
1542
+ */
1373
1543
  interface SeedFakeOptions {
1374
1544
  /** How many rows per table, by table name (as `db.insertInto` takes it). */
1375
1545
  counts: Record<string, number>;
@@ -1401,8 +1571,6 @@ declare function fakeRows(tableLike: unknown, options: FakeRowsOptions): Row[];
1401
1571
  * ```
1402
1572
  */
1403
1573
  declare function seedFake<DB>(db: KickDbClient<DB>, schema: Record<string, unknown>, options: SeedFakeOptions): Promise<Record<string, Row[]>>;
1404
- //#endregion
1405
- //#region src/dsl/columns/builders.d.ts
1406
1574
  /**
1407
1575
  * An auto-numbered integer the database assigns: `serial` on Postgres,
1408
1576
  * `INT AUTO_INCREMENT` on MySQL, `INTEGER … AUTOINCREMENT` on SQLite.
@@ -1588,8 +1756,6 @@ declare function json<T = unknown>(): ColumnBuilder<T>;
1588
1756
  declare function jsonb<T = unknown>(): ColumnBuilder<T>;
1589
1757
  /** Raw bytes (`bytea`; `BLOB` on MySQL and SQLite), typed `Uint8Array`. */
1590
1758
  declare function bytea(): ColumnBuilder<Uint8Array>;
1591
- //#endregion
1592
- //#region src/dsl/view.d.ts
1593
1759
  /** What makes a table declaration a view: its SQL, and whether it's materialized. */
1594
1760
  interface ViewMarks {
1595
1761
  __isView: true;
@@ -1597,11 +1763,26 @@ interface ViewMarks {
1597
1763
  __definition: string;
1598
1764
  __materialized: boolean;
1599
1765
  }
1766
+ /**
1767
+ * A view declared with `view()` or `materializedView()`: a table declaration that also carries its SQL.
1768
+ *
1769
+ * @see https://kickjs.app/guide/database/schema#views
1770
+ */
1600
1771
  type ViewDecl<TName extends string = string, C extends Record<string, ColumnBuilder> = Record<string, ColumnBuilder>, TSchema extends string | undefined = string | undefined> = TableDecl<TName, C, TSchema> & ViewMarks;
1772
+ /**
1773
+ * Options for `view()`: the `SELECT` it is defined as.
1774
+ *
1775
+ * @see https://kickjs.app/guide/database/schema#views
1776
+ */
1601
1777
  interface ViewOptions {
1602
1778
  /** The `SELECT` the view is defined as, in your database's SQL. */
1603
1779
  as: string;
1604
1780
  }
1781
+ /**
1782
+ * Options for `materializedView()`: the `SELECT`, and indexes on the view.
1783
+ *
1784
+ * @see https://kickjs.app/guide/database/schema#materialized-views-postgres
1785
+ */
1605
1786
  interface MaterializedViewOptions<C extends Record<string, ColumnBuilder>> extends ViewOptions {
1606
1787
  /**
1607
1788
  * Indexes on the materialized view — a unique one lets
@@ -1630,8 +1811,6 @@ declare function buildView<TName extends string, C extends Record<string, Column
1630
1811
  declare function view<TName extends string, C extends Record<string, ColumnBuilder>>(name: TName, columns: C, options: ViewOptions): ViewDecl<TName, C, undefined> & TypedColumnRefs<C>;
1631
1812
  /** Whether a declaration is a view. */
1632
1813
  declare function isView(value: unknown): value is ViewDecl;
1633
- //#endregion
1634
- //#region src/dsl/self-ref.d.ts
1635
1814
  /**
1636
1815
  * A foreign key to a column of the table being declared. The table binds it
1637
1816
  * to its own column once it exists; a name that isn't a column fails there.
@@ -1651,8 +1830,6 @@ declare function isView(value: unknown): value is ViewDecl;
1651
1830
  * })
1652
1831
  */
1653
1832
  declare function selfRef<const K extends string>(column: K): SelfRef<K>;
1654
- //#endregion
1655
- //#region src/dsl/table-forms.d.ts
1656
1833
  type ColumnsRecord = Record<string, ColumnBuilder>;
1657
1834
  type Constraints = (refs: never) => Record<string, TableConstraint>;
1658
1835
  type Rules = Record<string, ColumnRule | SchemaLike>;
@@ -1682,6 +1859,8 @@ type ClassRefs<C extends new () => object> = TypedColumnRefs<BuilderFields<Insta
1682
1859
  * Validation a column's SQL type can't express, on a builder field. The rule
1683
1860
  * has to fit the column: `@Rule({ minLength: 2 })` on an integer column is a
1684
1861
  * type error.
1862
+ *
1863
+ * @see https://kickjs.app/guide/db-table-forms
1685
1864
  */
1686
1865
  declare function Rule(rule: StringRule): <K extends string>(prototype: { [P in K]: ColumnBuilder<string>; }, key: K) => void;
1687
1866
  declare function Rule(rule: NumberRule): <K extends string>(prototype: { [P in K]: ColumnBuilder<number>; }, key: K) => void;
@@ -1700,6 +1879,8 @@ type RowOf<C extends ColumnsRecord> = { [K in keyof C]: C[K] extends ColumnBuild
1700
1879
  * `table()`. The class is the row type and can hold methods; `User.table` is
1701
1880
  * the table, and exporting the class is enough for `kick db generate` and
1702
1881
  * `createDbClient({ schema })`.
1882
+ *
1883
+ * @see https://kickjs.app/guide/db-table-forms
1703
1884
  */
1704
1885
  declare function TableBase<const N extends string, C extends ColumnsRecord, const S extends string | undefined = undefined>(name: N, columns: C & CheckSelfRefs<C>, options?: {
1705
1886
  schema?: S;
@@ -1769,8 +1950,6 @@ declare function fk<T, B extends ColumnBuilder<T>>(builder: B & ColumnBuilder<T>
1769
1950
  * afterwards is the same as declaring it.
1770
1951
  */
1771
1952
  declare function link<T>(column: TypedColumnRef<T>, target: () => TypedColumnRef<NoInfer<T>>, options?: Parameters<ColumnBuilder['references']>[1]): void;
1772
- //#endregion
1773
- //#region src/dsl/alias.d.ts
1774
1953
  type Qualified<TName extends string, TSchema> = TSchema extends string ? `${TSchema}.${TName}` : TName;
1775
1954
  /** A table under a second name: its columns, plus `$from` for `selectFrom` / joins. */
1776
1955
  type AliasedTable<TName extends string, C extends Record<string, ColumnBuilder>, TSchema extends string | undefined, A extends string> = TypedColumnRefs<C> & {
@@ -1787,33 +1966,40 @@ type AliasedTable<TName extends string, C extends Record<string, ColumnBuilder>,
1787
1966
  * .select(['users.name', 'manager.name as managerName'])
1788
1967
  */
1789
1968
  declare function alias<TName extends string, C extends Record<string, ColumnBuilder>, TSchema extends string | undefined, A extends string>(table: TableDecl<TName, C, TSchema>, name: A): AliasedTable<TName, C, TSchema, A>;
1790
- //#endregion
1791
- //#region src/query/operators.d.ts
1792
1969
  /** The value type an operand stands for. */
1793
- type ValueOf<O> = O extends TypedColumnRef<infer T> ? T : O extends Expression<infer T> ? T : O;
1970
+ type ValueOf<O> = O extends TypedColumnRef<infer T> ? T : O extends Expression$1<infer T> ? T : O;
1794
1971
  /** What may sit across from `O`: a value of its type, or anything standing for one. */
1795
1972
  type Comparable<O> = Operand<SelectType<ValueOf<O>>>;
1796
1973
  /** A column, a Kysely expression, or a value. */
1797
- type Operand<T = unknown> = TypedColumnRef<T> | Expression<T> | T;
1974
+ type Operand<T = unknown> = TypedColumnRef<T> | Expression$1<T> | T;
1798
1975
  /** A column or an expression — anything but a plain value. */
1799
- type Ref<T = any> = TypedColumnRef<T> | Expression<T>;
1976
+ type Ref<T = any> = TypedColumnRef<T> | Expression$1<T>;
1800
1977
  /** What may sit across from `L`: anything comparable, but only a column or expression across from a value. */
1801
- type Across<L> = [L] extends [TypedColumnRef<any> | Expression<any>] ? Comparable<L> : Ref<SelectType<ValueOf<L>>>;
1978
+ type Across<L> = [L] extends [TypedColumnRef<any> | Expression$1<any>] ? Comparable<L> : Ref<SelectType<ValueOf<L>>>;
1802
1979
  /** The list across from `L`: with a value on the left, a non-empty list of columns or expressions. */
1803
- type AcrossList<L> = [L] extends [TypedColumnRef<any> | Expression<any>] ? readonly Comparable<L>[] : readonly [Across<L>, ...Across<L>[]];
1804
- type Condition = RawBuilder<SqlBool>;
1980
+ type AcrossList<L> = [L] extends [TypedColumnRef<any> | Expression$1<any>] ? readonly Comparable<L>[] : readonly [Across<L>, ...Across<L>[]];
1981
+ type Condition = RawBuilder$1<SqlBool$1>;
1982
+ /** `left = right`. */
1805
1983
  declare const eq: <L>(left: L, right: Across<L>) => Condition;
1984
+ /** `left <> right`. */
1806
1985
  declare const ne: <L>(left: L, right: Across<L>) => Condition;
1986
+ /** `left > right`. */
1807
1987
  declare const gt: <L>(left: L, right: Across<L>) => Condition;
1988
+ /** `left >= right`. */
1808
1989
  declare const gte: <L>(left: L, right: Across<L>) => Condition;
1990
+ /** `left < right`. */
1809
1991
  declare const lt: <L>(left: L, right: Across<L>) => Condition;
1992
+ /** `left <= right`. */
1810
1993
  declare const lte: <L>(left: L, right: Across<L>) => Condition;
1811
1994
  /** `left LIKE pattern` — escape user input with `escapeLike()`. */
1812
1995
  declare const like: <L>(left: L, pattern: [L] extends [Ref] ? Operand<string> : Ref<string>) => Condition;
1996
+ /** `left NOT LIKE pattern`. */
1813
1997
  declare const notLike: <L>(left: L, pattern: [L] extends [Ref] ? Operand<string> : Ref<string>) => Condition;
1814
1998
  /** Case-insensitive `LIKE` (Postgres). */
1815
1999
  declare const ilike: <L>(left: L, pattern: [L] extends [Ref] ? Operand<string> : Ref<string>) => Condition;
2000
+ /** `operand IS NULL`. */
1816
2001
  declare const isNull: (operand: Ref | ColumnRef) => Condition;
2002
+ /** `operand IS NOT NULL`. */
1817
2003
  declare const isNotNull: (operand: Ref | ColumnRef) => Condition;
1818
2004
  /**
1819
2005
  * `left IN (…)`. An empty list matches nothing, rather than being invalid SQL.
@@ -1830,15 +2016,15 @@ declare const between: <L>(left: L, low: Across<L>, high: Comparable<L>) => Cond
1830
2016
  * built conditionally: `and(eq(t.a, a), b ? eq(t.b, b) : undefined)`. With
1831
2017
  * none left it matches every row.
1832
2018
  */
1833
- declare function and(...conditions: (Expression<SqlBool> | undefined)[]): Condition;
2019
+ declare function and(...conditions: (Expression$1<SqlBool$1> | undefined)[]): Condition;
1834
2020
  /** Any of the conditions; `undefined` entries are skipped. With none left it matches no row. */
1835
- declare function or(...conditions: (Expression<SqlBool> | undefined)[]): Condition;
1836
- declare const not: (condition: Expression<SqlBool>) => Condition;
2021
+ declare function or(...conditions: (Expression$1<SqlBool$1> | undefined)[]): Condition;
2022
+ /** `NOT (condition)`. */
2023
+ declare const not: (condition: Expression$1<SqlBool$1>) => Condition;
1837
2024
  /** `EXISTS (subquery)` — pass a Kysely select; it brings its own parentheses. */
1838
- declare const exists: (subquery: Expression<unknown>) => Condition;
1839
- declare const notExists: (subquery: Expression<unknown>) => Condition;
1840
- //#endregion
1841
- //#region src/dsl/relations.d.ts
2025
+ declare const exists: (subquery: Expression$1<unknown>) => Condition;
2026
+ /** `NOT EXISTS (subquery)`. */
2027
+ declare const notExists: (subquery: Expression$1<unknown>) => Condition;
1842
2028
  /**
1843
2029
  * Generic over the target table so the typegen plugin can pull
1844
2030
  * `target['__name']` without losing the literal string at the type
@@ -1865,6 +2051,11 @@ interface RelationMorphOne<TTarget extends TableDecl<string, Record<string, Colu
1865
2051
  target: TTarget;
1866
2052
  morph: MorphSpec;
1867
2053
  }
2054
+ /**
2055
+ * A one-to-many relation from `many()`: many-to-many with `through`, polymorphic with `morph`.
2056
+ *
2057
+ * @see https://kickjs.app/guide/database/relations
2058
+ */
1868
2059
  interface RelationMany<TTarget extends TableDecl<string, Record<string, ColumnBuilder>> = TableDecl<string, Record<string, ColumnBuilder>>> {
1869
2060
  kind: 'many';
1870
2061
  target: TTarget;
@@ -1912,11 +2103,21 @@ interface MorphToSpec<TTargets extends Record<string, TableDecl<string, Record<s
1912
2103
  id: ColumnRef;
1913
2104
  targets: TTargets;
1914
2105
  }
2106
+ /**
2107
+ * The junction table of a many-to-many: the table, or the table with its foreign-key columns to each side.
2108
+ *
2109
+ * @see https://kickjs.app/guide/database/relations#many-to-many-many-through-a-junction-table
2110
+ */
1915
2111
  type ThroughSpec = TableDecl<string, Record<string, ColumnBuilder>> | {
1916
2112
  table: TableDecl<string, Record<string, ColumnBuilder>>;
1917
2113
  from: ColumnRef[];
1918
2114
  to: ColumnRef[];
1919
2115
  };
2116
+ /**
2117
+ * Any relation `relations()` can declare.
2118
+ *
2119
+ * @see https://kickjs.app/guide/database/relations
2120
+ */
1920
2121
  type Relation = RelationOne | RelationMorphOne | RelationMorphTo | RelationMany;
1921
2122
  /**
1922
2123
  * Generic so the typegen plugin can read the source table name and
@@ -1951,8 +2152,11 @@ interface Helpers {
1951
2152
  * matching `KickDbRelationsRegister` augmentation at typegen time.
1952
2153
  */
1953
2154
  declare function relations<T extends TableDecl<string, Record<string, ColumnBuilder>>, R extends Record<string, Relation>>(source: T, builder: (h: Helpers) => R): RelationsDecl<T['__name'], R>;
1954
- //#endregion
1955
- //#region src/custom-type.d.ts
2155
+ /**
2156
+ * Options for `customType()`: the column's SQL type, and optional encode and decode hooks.
2157
+ *
2158
+ * @see https://kickjs.app/guide/db-extensions
2159
+ */
1956
2160
  interface CustomTypeOptions<TJs, TDriver = unknown> {
1957
2161
  /**
1958
2162
  * SQL data type as it would appear in `CREATE TABLE` — `'text'`,
@@ -2002,8 +2206,6 @@ declare class CustomColumnBuilder<TJs> extends ColumnBuilder<TJs> {
2002
2206
  * ```
2003
2207
  */
2004
2208
  declare function customType<TJs>(opts: CustomTypeOptions<TJs>): () => CustomColumnBuilder<TJs>;
2005
- //#endregion
2006
- //#region src/query/schema-relations-types.d.ts
2007
2209
  /**
2008
2210
  * Distribute over `S` (the schema record), keeping only the entries
2009
2211
  * that are `RelationsDecl<...>`. Each entry contributes one row to
@@ -2046,8 +2248,6 @@ type MergeBySource<U extends {
2046
2248
  }> = { [Source in U['source']]: Extract<U, {
2047
2249
  source: Source;
2048
2250
  }>['relations']; };
2049
- //#endregion
2050
- //#region src/query/errors.d.ts
2051
2251
  /**
2052
2252
  * Thrown at compile time when a `with` key references a relation
2053
2253
  * that the source table doesn't declare.
@@ -2059,7 +2259,7 @@ declare class RelationalQueryUnknownRelationError extends KickDbError {
2059
2259
  }
2060
2260
  /**
2061
2261
  * Thrown at compile time when a `with` clause nests deeper than
2062
- * `maxDepth` (spec §7 R-3, default 5). Catches infinite specs on
2262
+ * `maxDepth` (default 5). Catches infinite specs on
2063
2263
  * self-referencing tables before any SQL is built.
2064
2264
  */
2065
2265
  declare class RelationalQueryDepthError extends KickDbError {
@@ -2069,7 +2269,7 @@ declare class RelationalQueryDepthError extends KickDbError {
2069
2269
  }
2070
2270
  /**
2071
2271
  * Thrown at compile time when a relation name collides with a
2072
- * literal column on the same table (spec §7 R-5). Forces the schema
2272
+ * literal column on the same table. Forces the schema
2073
2273
  * author to rename one of them so the LATERAL alias stays
2074
2274
  * unambiguous.
2075
2275
  */
@@ -2139,8 +2339,6 @@ declare class RelationalQueryThroughError extends KickDbError {
2139
2339
  readonly junction: string;
2140
2340
  constructor(sourceTable: string, relationName: string, junction: string, problem: string);
2141
2341
  }
2142
- //#endregion
2143
- //#region src/query/like.d.ts
2144
2342
  /**
2145
2343
  * LIKE / ILIKE pattern safety helpers.
2146
2344
  *
@@ -2179,8 +2377,6 @@ declare function escapeLike(input: string, escapeChar?: string): string;
2179
2377
  * ```
2180
2378
  */
2181
2379
  declare function likePattern(input: string, mode?: LikeMatchMode, escapeChar?: string): string;
2182
- //#endregion
2183
- //#region src/query/order.d.ts
2184
2380
  /**
2185
2381
  * Sort direction for a relational `orderBy`, which takes expressions:
2186
2382
  *
@@ -2189,11 +2385,9 @@ declare function likePattern(input: string, mode?: LikeMatchMode, escapeChar?: s
2189
2385
  *
2190
2386
  * Works at the top level and inside `with`, on every dialect.
2191
2387
  */
2192
- declare function desc<T>(expression: Expression<T>): Expression<T>;
2388
+ declare function desc<T>(expression: Expression$1<T>): Expression$1<T>;
2193
2389
  /** Ascending order — the default, spelled out. See {@link desc}. */
2194
- declare function asc<T>(expression: Expression<T>): Expression<T>;
2195
- //#endregion
2196
- //#region src/dialect-marker.d.ts
2390
+ declare function asc<T>(expression: Expression$1<T>): Expression$1<T>;
2197
2391
  /**
2198
2392
  * Explicit dialect tagging for `createDbClient`'s dialect detection.
2199
2393
  *
@@ -2212,6 +2406,7 @@ declare function asc<T>(expression: Expression<T>): Expression<T>;
2212
2406
  * (multiple copies of `@forinda/kickjs-db`).
2213
2407
  */
2214
2408
  declare const KICK_DIALECT: unique symbol;
2409
+ /** The SQL dialects kick/db supports. */
2215
2410
  type DialectTag = 'postgres' | 'mysql' | 'sqlite';
2216
2411
  /** Type guard — `true` when `value` is a supported dialect tag. */
2217
2412
  declare function isDialectTag(value: unknown): value is DialectTag;
@@ -2224,6 +2419,5 @@ declare function markDialect<T extends object>(dialect: T, tag: DialectTag): T;
2224
2419
  * back to ctor-name detection rather than an impossible dialect state.
2225
2420
  */
2226
2421
  declare function readDialectMark(dialect: object): DialectTag | undefined;
2227
- //#endregion
2228
- export { inArray as $, checkDrift as $i, CodeMigration as $n, detectCompositeReferences as $r, time as $t, RelationalQueryUnknownRelationError as A, DropPolicy as Ai, TenantMigrationResult as An, MigrationError as Ar, buildView as At, RelationMorphTo as B, renderSchemaSource as Bi, migrateStatus as Bn, DbDialect as Br, date as Bt, RelationalQueryAliasCollisionError as C, CreateTable as Ci, PushOptions as Cn, readJournal as Cr, link as Ct, RelationalQueryMissingInverseError as D, DropEnum as Di, reviewMigration as Dn, parseEnumDropHeader as Dr, ViewDecl as Dt, RelationalQueryDepthError as E, DropColumn as Ei, ReviewResult as En, enforceEnumDropGate as Er, MaterializedViewOptions as Et, MorphSpec as F, RenameColumn as Fi, RunnerOptions as Fn, UnreviewedMigrationError as Fr, bigSerial as Ft, Operand as G, toKeyName as Gi, DB_PRIMARY as Gn, UniqueViolationError as Gr, json as Gt, RelationsDecl as H, extractSnapshot as Hi, safeNullComparison as Hn, ForeignKeyViolationError as Hr, doublePrecision as Ht, MorphToSpec as I, RenameTable as Ii, StatusEntry as In, CheckViolationError as Ir, bigint as It, eq as J, TenantsConfig as Ji, MigrationsOnBoot as Jn, ResolvedRelation as Jr, real as Jt, and as K, DbConfig as Ki, DB_REPLICA as Kn, translateDbError as Kr, jsonb as Kt, Relation as L, SetColumnComment as Li, migrateDown as Ln, ConnectionError as Lr, boolean as Lt, CustomColumnBuilder as M, DropView as Mi, AppliedSummary as Mn, MigrationHashError as Mr, view as Mt, CustomTypeOptions as N, PrimaryKeyShape as Ni, ReversedSummary as Nn, MigrationLockError as Nr, TimestampBuilder as Nt, RelationalQueryNotSupportedError as O, DropForeignKey as Oi, MigrateTenantsOptions as On, MigrationDriftError as Or, ViewMarks as Ot, customType as P, RemoveEnumValue as Pi, RollbackSummary as Pn, SchemaDiffSummary as Pr, UuidBuilder as Pt, ilike as Q, DriftLogger as Qi, migrationFiles as Qn, CompositeRef as Qr, text as Qt, RelationMany as R, SetRowLevelSecurity as Ri, migrateLatest as Rn, DatabaseError as Rr, bytea as Rt, likePattern as S, CreateSchema as Si, emitPg as Sn, computeMigrationHash as Sr, fk as St, RelationalQueryCancelledError as T, DropCheck as Ti, pushSchema as Tn, EnumDropHeader as Tr, selfRef as Tt, ThroughSpec as U, Casing as Ui, createDbClient as Un, NotNullViolationError as Ur, integer as Ut, RelationOne as V, fitIdentifier as Vi, migrateUp as Vn, DeadlockError as Vr, decimal as Vt, relations as W, toDbName as Wi, DB_CLIENT as Wn, SerializationFailureError as Wr, interval as Wt, gt as X, DriftBehavior as Xi, MigrationFiles as Xn, CompositeEnumReferenceError as Xr, smallSerial as Xt, exists as Y, resolveDbConfig as Yi, kickDbAdapter as Yn, ResolvedRelations as Yr, serial as Yt, gte as Z, DriftIgnore as Zi, MigrationsLocation as Zn, CompositeQueryRunner as Zr, smallint as Zt, readDialectMark as _, Change as _i, GenerateResult as _n, pushTableName as _r, StringRule as _t, KyselyPlugin$1 as a, RenameCandidates as ai, FakeContext as an, SqliteIntrospectDb as ar, ne as at, LikeMatchMode as b, CreatePolicy as bi, SqliteRebuildRequiredError as bn, JournalEntry as br, TableDefinition as bt, Selectable$1 as c, findRenameCandidates as ci, SeedFakeOptions as cn, introspectPg as cr, notInArray as ct, Updateable as d, AddEnumValue as di, SeedResult as dn, MemoryMigrationAdapter as dr, AliasedTable as dt, MigrationAdapter as ea, KickDbError as ei, timestamp as en, MigrationDb as er, isNotNull as et, sql$1 as f, AddForeignKey as fi, listSeeds as fn, KICK_LOCK_TABLE as fr, alias as ft, markDialect as g, AlterRole as gi, GenerateOptions as gn, migrationsTableDdl as gr, RuleFor as gt, isDialectTag as h, AlterPrimaryKey as hi, checkMigrations as hn, lockTableName as hr, Rule as ht, Kysely$1 as i, DiffOptions as ii, version as in, IntrospectSqliteOptions as ir, lte as it, SchemaToRelationsRegister as j, DropTable as ji, migrateTenants as jn, MigrationFailedError as jr, isView as jt, RelationalQueryThroughError as k, DropIndex as ki, MigrateTenantsResult as kn, MigrationEnumDropError as kr, ViewOptions as kt, Sql as l, AddCheck as li, fakeRows as ln, IntrospectPgOptions as lr, notLike as lt, KICK_DIALECT as m, AlterColumn as mi, CheckResult as mn, lockTableDdl as mr, NumberRule as mt, ExpressionBuilder$1 as n, MigrationRow as na, hasAmbiguousReverse as ni, uuid as nn, MysqlIntrospectDb as nr, like as nt, RawBuilder$1 as o, RenameHints as oi, FakeOverride as on, introspectSqlite as or, not as ot, DialectTag as p, AddIndex as pi, runSeeds as pn, KICK_MIGRATIONS_TABLE as pr, ClassRefs as pt, between as q, MigrationAdapterFactory as qi, KickDbAdapterConfig as qn, TransactionFinishedError as qr, numeric as qt, Insertable$1 as r, invertChanges as ri, varchar as rn, introspectMysql as rr, lt as rt, ReadonlyKysely as s, diff as si, FakeRowsOptions as sn, introspectSqliteAsync as sr, notExists as st, Expression$1 as t, MigrationBookkeeping as ta, RemovedValueAsDefaultError as ti, timestamptz as tn, IntrospectMysqlOptions as tr, isNull as tt, SqlBool$1 as u, AddColumn as ui, seedFake as un, PgQueryRunner as ur, or as ut, asc as v, ChangeSet as vi, generate as vn, quoteTable as vr, TableBase as vt, RelationalQueryAmbiguousRelationNameError as w, CreateView as wi, PushResult as wn, verifyMigrationHash as wr, tableFromClass as wt, escapeLike as x, CreateRole as xi, emitSqlite as xn, appendJournalEntry as xr, defineTable as xt, desc as y, CreateEnum as yi, emitMysql as yn, Journal as yr, TableClass as yt, RelationMorphOne as z, SetTableComment as zi, migrateRollback as zn, DatabaseErrorInfo as zr, char as zt };
2229
- //# sourceMappingURL=index-Nf43jLx4.d.mts.map
2422
+ export { inArray as $, checkDrift as $i, CodeMigration as $n, detectCompositeReferences as $r, time as $t, RelationalQueryUnknownRelationError as A, DropPolicy as Ai, TenantMigrationResult as An, MigrationError as Ar, buildView as At, RelationMorphTo as B, renderSchemaSource as Bi, migrateStatus as Bn, DbDialect as Br, date as Bt, RelationalQueryAliasCollisionError as C, CreateTable as Ci, PushOptions as Cn, readJournal as Cr, link as Ct, RelationalQueryMissingInverseError as D, DropEnum as Di, reviewMigration as Dn, parseEnumDropHeader as Dr, ViewDecl as Dt, RelationalQueryDepthError as E, DropColumn as Ei, ReviewResult as En, enforceEnumDropGate as Er, MaterializedViewOptions as Et, MorphSpec as F, RenameColumn as Fi, RunnerOptions as Fn, UnreviewedMigrationError as Fr, bigSerial as Ft, Operand as G, toKeyName as Gi, DB_PRIMARY as Gn, UniqueViolationError as Gr, json as Gt, RelationsDecl as H, extractSnapshot as Hi, safeNullComparison as Hn, ForeignKeyViolationError as Hr, doublePrecision as Ht, MorphToSpec as I, RenameTable as Ii, StatusEntry as In, CheckViolationError as Ir, bigint as It, eq as J, TenantsConfig as Ji, MigrationsOnBoot as Jn, ResolvedRelation as Jr, real as Jt, and as K, DbConfig as Ki, DB_REPLICA as Kn, translateDbError as Kr, jsonb as Kt, Relation as L, SetColumnComment as Li, migrateDown as Ln, ConnectionError as Lr, boolean as Lt, CustomColumnBuilder as M, DropView as Mi, AppliedSummary as Mn, MigrationHashError as Mr, view as Mt, CustomTypeOptions as N, PrimaryKeyShape as Ni, ReversedSummary as Nn, MigrationLockError as Nr, TimestampBuilder as Nt, RelationalQueryNotSupportedError as O, DropForeignKey as Oi, MigrateTenantsOptions as On, MigrationDriftError as Or, ViewMarks as Ot, customType as P, RemoveEnumValue as Pi, RollbackSummary as Pn, SchemaDiffSummary as Pr, UuidBuilder as Pt, ilike as Q, DriftLogger as Qi, migrationFiles as Qn, CompositeRef as Qr, text as Qt, RelationMany as R, SetRowLevelSecurity as Ri, migrateLatest as Rn, DatabaseError as Rr, bytea as Rt, likePattern as S, CreateSchema as Si, emitPg as Sn, computeMigrationHash as Sr, fk as St, RelationalQueryCancelledError as T, DropCheck as Ti, pushSchema as Tn, EnumDropHeader as Tr, selfRef as Tt, ThroughSpec as U, Casing as Ui, createDbClient as Un, NotNullViolationError as Ur, integer as Ut, RelationOne as V, fitIdentifier as Vi, migrateUp as Vn, DeadlockError as Vr, decimal as Vt, relations as W, toDbName as Wi, DB_CLIENT as Wn, SerializationFailureError as Wr, interval as Wt, gt as X, DriftBehavior as Xi, MigrationFiles as Xn, CompositeEnumReferenceError as Xr, smallSerial as Xt, exists as Y, resolveDbConfig as Yi, kickDbAdapter as Yn, ResolvedRelations as Yr, serial as Yt, gte as Z, DriftIgnore as Zi, MigrationsLocation as Zn, CompositeQueryRunner as Zr, smallint as Zt, readDialectMark as _, Change as _i, GenerateResult as _n, pushTableName as _r, StringRule as _t, KyselyPlugin as a, RenameCandidates as ai, FakeContext as an, SqliteIntrospectDb as ar, ne as at, LikeMatchMode as b, CreatePolicy as bi, SqliteRebuildRequiredError as bn, JournalEntry as br, TableDefinition as bt, Selectable as c, findRenameCandidates as ci, SeedFakeOptions as cn, introspectPg as cr, notInArray as ct, Updateable as d, AddEnumValue as di, SeedResult as dn, MemoryMigrationAdapter as dr, AliasedTable as dt, MigrationAdapter as ea, KickDbError as ei, timestamp as en, MigrationDb as er, isNotNull as et, sql as f, AddForeignKey as fi, listSeeds as fn, KICK_LOCK_TABLE as fr, alias as ft, markDialect as g, AlterRole as gi, GenerateOptions as gn, migrationsTableDdl as gr, RuleFor as gt, isDialectTag as h, AlterPrimaryKey as hi, checkMigrations as hn, lockTableName as hr, Rule as ht, Kysely as i, DiffOptions as ii, version as in, IntrospectSqliteOptions as ir, lte as it, SchemaToRelationsRegister as j, DropTable as ji, migrateTenants as jn, MigrationFailedError as jr, isView as jt, RelationalQueryThroughError as k, DropIndex as ki, MigrateTenantsResult as kn, MigrationEnumDropError as kr, ViewOptions as kt, Sql as l, AddCheck as li, fakeRows as ln, IntrospectPgOptions as lr, notLike as lt, KICK_DIALECT as m, AlterColumn as mi, CheckResult as mn, lockTableDdl as mr, NumberRule as mt, ExpressionBuilder as n, MigrationRow as na, hasAmbiguousReverse as ni, uuid as nn, MysqlIntrospectDb as nr, like as nt, RawBuilder as o, RenameHints as oi, FakeOverride as on, introspectSqlite as or, not as ot, DialectTag as p, AddIndex as pi, runSeeds as pn, KICK_MIGRATIONS_TABLE as pr, ClassRefs as pt, between as q, MigrationAdapterFactory as qi, KickDbAdapterConfig as qn, TransactionFinishedError as qr, numeric as qt, Insertable as r, invertChanges as ri, varchar as rn, introspectMysql as rr, lt as rt, ReadonlyKysely as s, diff as si, FakeRowsOptions as sn, introspectSqliteAsync as sr, notExists as st, Expression as t, MigrationBookkeeping as ta, RemovedValueAsDefaultError as ti, timestamptz as tn, IntrospectMysqlOptions as tr, isNull as tt, SqlBool as u, AddColumn as ui, seedFake as un, PgQueryRunner as ur, or as ut, asc as v, ChangeSet as vi, generate as vn, quoteTable as vr, TableBase as vt, RelationalQueryAmbiguousRelationNameError as w, CreateView as wi, PushResult as wn, verifyMigrationHash as wr, tableFromClass as wt, escapeLike as x, CreateRole as xi, emitSqlite as xn, appendJournalEntry as xr, defineTable as xt, desc as y, CreateEnum as yi, emitMysql as yn, Journal as yr, TableClass as yt, RelationMorphOne as z, SetTableComment as zi, migrateRollback as zn, DatabaseErrorInfo as zr, char as zt };
2423
+ //# sourceMappingURL=index-AaU739CK.d.mts.map