@forinda/kickjs-db 7.2.1 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.mts +10 -10
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/custom-type-j8k__3sL.mjs +12 -0
- package/dist/custom-type-j8k__3sL.mjs.map +1 -0
- package/dist/devtools-events.d.mts +2 -1
- package/dist/devtools-events.mjs +1 -1
- package/dist/{index-Ci5DXgUh.d.mts → index-DF69HndC.d.mts} +39 -312
- package/dist/index-DF69HndC.d.mts.map +1 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/mysql.d.mts +11 -12
- package/dist/mysql.d.mts.map +1 -1
- package/dist/mysql.mjs +2 -2
- package/dist/mysql.mjs.map +1 -1
- package/dist/pg-BJmYKLhI.mjs +12 -0
- package/dist/pg-BJmYKLhI.mjs.map +1 -0
- package/dist/pg.d.mts +21 -21
- package/dist/pg.d.mts.map +1 -1
- package/dist/pg.mjs +2 -2
- package/dist/pg.mjs.map +1 -1
- package/dist/schema.d.mts +88 -0
- package/dist/schema.d.mts.map +1 -0
- package/dist/schema.mjs +12 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/sqlite.d.mts +7 -8
- package/dist/sqlite.d.mts.map +1 -1
- package/dist/sqlite.mjs +2 -2
- package/dist/src-BnHTLx5l.mjs +166 -0
- package/dist/src-BnHTLx5l.mjs.map +1 -0
- package/dist/table-Bl5SbKRg.d.mts +309 -0
- package/dist/table-Bl5SbKRg.d.mts.map +1 -0
- package/dist/{types-NkfgZHEN.d.mts → types-DtvYnaXL.d.mts} +3 -4
- package/dist/types-DtvYnaXL.d.mts.map +1 -0
- package/package.json +14 -9
- package/dist/index-Ci5DXgUh.d.mts.map +0 -1
- package/dist/src-BLr8KOo1.mjs +0 -156
- package/dist/src-BLr8KOo1.mjs.map +0 -1
- package/dist/types-NkfgZHEN.d.mts.map +0 -1
|
@@ -1,120 +1,38 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { C as IndexSnapshot, E as TableSnapshot, S as ForeignKeySnapshot, T as SchemaSnapshot, b as EnumSnapshot, g as NotNullBrand, l as ColumnBuilder, n as TableDecl, p as GeneratedBrand, u as ColumnRef, v as ColumnSnapshot, w as RelationSnapshot, y as Dialect$1 } from "./table-Bl5SbKRg.mjs";
|
|
3
|
+
import { h as RelationMapEntry, n as CreateDbClientOptions, r as KickDbClient } from "./types-DtvYnaXL.mjs";
|
|
3
4
|
import { InjectionToken } from "@forinda/kickjs";
|
|
4
5
|
import { Generated, KyselyPlugin } from "kysely";
|
|
5
6
|
import { ReadonlyKysely } from "kysely/readonly";
|
|
6
|
-
//#region src/snapshot/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
name: string;
|
|
11
|
-
type: string;
|
|
12
|
-
nullable: boolean;
|
|
13
|
-
default: string | null;
|
|
14
|
-
primaryKey: boolean;
|
|
15
|
-
}
|
|
16
|
-
interface IndexSnapshot {
|
|
17
|
-
name: string;
|
|
18
|
-
columns: string[];
|
|
19
|
-
unique: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface ForeignKeySnapshot {
|
|
22
|
-
name: string;
|
|
23
|
-
columns: string[];
|
|
24
|
-
refTable: string;
|
|
25
|
-
refColumns: string[];
|
|
26
|
-
onDelete: FkAction;
|
|
27
|
-
onUpdate: FkAction;
|
|
28
|
-
}
|
|
29
|
-
interface CheckSnapshot {
|
|
30
|
-
name: string;
|
|
31
|
-
expression: string;
|
|
32
|
-
}
|
|
33
|
-
interface TableSnapshot {
|
|
34
|
-
/**
|
|
35
|
-
* Bare table name, unqualified. The schema (when any) lives in
|
|
36
|
-
* {@link TableSnapshot.schema}; the map key on `SchemaSnapshot.tables` is
|
|
37
|
-
* the qualified form (`billing.invoices`).
|
|
38
|
-
*/
|
|
39
|
-
name: string;
|
|
40
|
-
/**
|
|
41
|
-
* Named SQL schema, from `pgSchema('x').table(...)`. Absent for tables in
|
|
42
|
-
* the connection's default search_path, which keeps pre-schema snapshots
|
|
43
|
-
* byte-identical (and their migration hashes valid).
|
|
44
|
-
*/
|
|
45
|
-
schema?: string;
|
|
46
|
-
columns: Record<string, ColumnSnapshot>;
|
|
47
|
-
indexes: IndexSnapshot[];
|
|
48
|
-
foreignKeys: ForeignKeySnapshot[];
|
|
49
|
-
checks: CheckSnapshot[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* PostgreSQL ENUM type declaration. Currently PG-only; the field is
|
|
53
|
-
* optional on `SchemaSnapshot` so other dialects don't have to carry
|
|
54
|
-
* a phantom `enums: {}`.
|
|
55
|
-
*/
|
|
56
|
-
interface EnumSnapshot {
|
|
57
|
-
name: string;
|
|
58
|
-
/** Allowed values, in declaration order. PG preserves the order. */
|
|
59
|
-
values: readonly string[];
|
|
60
|
-
}
|
|
7
|
+
//#region src/snapshot/extract.d.ts
|
|
8
|
+
declare function extractSnapshot(schema: Record<string, unknown>, dialect: Dialect$1): SchemaSnapshot;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/snapshot/name.d.ts
|
|
61
11
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* migration
|
|
67
|
-
*
|
|
12
|
+
* Shorten an identifier to fit Postgres' limit, deterministically.
|
|
13
|
+
*
|
|
14
|
+
* Postgres does not reject an over-long constraint name — it truncates it
|
|
15
|
+
* silently, so two long names that share a prefix become the same name and the
|
|
16
|
+
* migration fails on the second one:
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
19
|
+
* ERROR: constraint "finance_vote_head_account_reference_ledgers_fin…" already exists
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* A schema with 1,326 foreign keys had 38 names over the limit and two
|
|
23
|
+
* colliding pairs (#647). The migration stops at the first collision, so
|
|
24
|
+
* everything after it goes unapplied.
|
|
68
25
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
26
|
+
* Shortening keeps three things: a readable head, the `_fk` / `_unique` suffix
|
|
27
|
+
* that says what the constraint IS, and a hash of the **full** name in between
|
|
28
|
+
* so two names that differ anywhere still differ here. The hash is taken over
|
|
29
|
+
* the untruncated input, which is what makes the result stable across
|
|
30
|
+
* regenerations — the same schema always produces the same name.
|
|
31
|
+
*
|
|
32
|
+
* Names within the limit are returned untouched, so existing schemas keep
|
|
33
|
+
* every constraint name they already have.
|
|
72
34
|
*/
|
|
73
|
-
|
|
74
|
-
kind: 'one' | 'many';
|
|
75
|
-
/** Target table name. */
|
|
76
|
-
target: string;
|
|
77
|
-
/** Columns on the source table that participate in the join. */
|
|
78
|
-
sourceColumns: readonly string[];
|
|
79
|
-
/** Columns on the target table that participate in the join. */
|
|
80
|
-
targetColumns: readonly string[];
|
|
81
|
-
/**
|
|
82
|
-
* Optional pairing tag from `relationName: 'foo'` on both sides of
|
|
83
|
-
* the relation. Disambiguates multi-FK schemas. See
|
|
84
|
-
* docs/db/spec-relation-name.md (M4.B).
|
|
85
|
-
*/
|
|
86
|
-
relationName?: string;
|
|
87
|
-
}
|
|
88
|
-
interface SchemaSnapshot {
|
|
89
|
-
version: 1;
|
|
90
|
-
dialect: Dialect$1;
|
|
91
|
-
/**
|
|
92
|
-
* Keyed by QUALIFIED name — `billing.invoices` for a table declared through
|
|
93
|
-
* `pgSchema('billing')`, the bare name otherwise. Qualifying the key is what
|
|
94
|
-
* lets two schemas hold same-named tables without colliding, and it makes
|
|
95
|
-
* every `table: string` field on a diff `Change` already schema-correct:
|
|
96
|
-
* `quoteIdent` splits on `.`, rendering `"billing"."invoices"`.
|
|
97
|
-
*/
|
|
98
|
-
tables: Record<string, TableSnapshot>;
|
|
99
|
-
/**
|
|
100
|
-
* Named schemas the tables in this snapshot live in, sorted. Drives
|
|
101
|
-
* `CREATE SCHEMA IF NOT EXISTS` emission. PG-only; absent when no table
|
|
102
|
-
* declares a schema, so existing snapshots keep their exact shape.
|
|
103
|
-
*/
|
|
104
|
-
schemas?: readonly string[];
|
|
105
|
-
/** ENUM types declared via `pgEnum()`. PG-only; absent on other dialects. */
|
|
106
|
-
enums?: Record<string, EnumSnapshot>;
|
|
107
|
-
/**
|
|
108
|
-
* Optional relation sidecar populated when the schema includes
|
|
109
|
-
* `relations()` declarations. Absent when no relations are
|
|
110
|
-
* declared so M0/M1 callers see the same snapshot shape they
|
|
111
|
-
* always did.
|
|
112
|
-
*/
|
|
113
|
-
relations?: Record<string, Record<string, RelationSnapshot>>;
|
|
114
|
-
}
|
|
115
|
-
//#endregion
|
|
116
|
-
//#region src/snapshot/extract.d.ts
|
|
117
|
-
declare function extractSnapshot(schema: Record<string, unknown>, dialect: Dialect$1): SchemaSnapshot;
|
|
35
|
+
declare function fitIdentifier(name: string): string;
|
|
118
36
|
//#endregion
|
|
119
37
|
//#region src/snapshot/render.d.ts
|
|
120
38
|
/**
|
|
@@ -235,8 +153,6 @@ interface AddEnumValue {
|
|
|
235
153
|
* `-- KICK ENUM REMOVE` header. The runner refuses to apply such a
|
|
236
154
|
* migration without `confirmEnumDrop: true` on `RunnerOptions` (or
|
|
237
155
|
* `--confirm-enum-drop` from the CLI).
|
|
238
|
-
*
|
|
239
|
-
* Spec: docs/db/spec-enum-value-removal.md.
|
|
240
156
|
*/
|
|
241
157
|
interface RemoveEnumValue {
|
|
242
158
|
kind: 'removeEnumValue';
|
|
@@ -259,7 +175,7 @@ interface RemoveEnumValue {
|
|
|
259
175
|
* declared on the prior snapshot, or `null` when the column has no
|
|
260
176
|
* default. The emitter wraps the type swap in
|
|
261
177
|
* `DROP DEFAULT` / `SET DEFAULT … ::"<enum>"` brackets only when
|
|
262
|
-
* this is non-null.
|
|
178
|
+
* this is non-null.
|
|
263
179
|
*/
|
|
264
180
|
affectedColumns: readonly {
|
|
265
181
|
table: string;
|
|
@@ -307,8 +223,6 @@ declare class KickDbError extends Error {
|
|
|
307
223
|
*
|
|
308
224
|
* The operator's options: change the column's default in the schema
|
|
309
225
|
* to a value that survives the removal, or drop the default entirely.
|
|
310
|
-
*
|
|
311
|
-
* Spec: docs/db/spec-default-preservation.md.
|
|
312
226
|
*/
|
|
313
227
|
declare class RemovedValueAsDefaultError extends KickDbError {
|
|
314
228
|
readonly enum: string;
|
|
@@ -397,8 +311,7 @@ declare class UnreviewedMigrationError extends MigrationError {
|
|
|
397
311
|
/**
|
|
398
312
|
* Thrown by the runner when a migration carries the `-- KICK ENUM
|
|
399
313
|
* REMOVE` header and the operator hasn't passed `confirmEnumDrop:
|
|
400
|
-
* true` (CLI: `--confirm-enum-drop`).
|
|
401
|
-
* docs/db/spec-enum-value-removal.md §4.
|
|
314
|
+
* true` (CLI: `--confirm-enum-drop`).
|
|
402
315
|
*/
|
|
403
316
|
declare class MigrationEnumDropError extends MigrationError {
|
|
404
317
|
readonly id: string;
|
|
@@ -418,7 +331,11 @@ declare class MigrationEnumDropError extends MigrationError {
|
|
|
418
331
|
* `MigrationEnumDropError` when the header is present and
|
|
419
332
|
* `confirmEnumDrop` is falsy.
|
|
420
333
|
*
|
|
421
|
-
*
|
|
334
|
+
* Why a gate: PostgreSQL has no `ALTER TYPE … DROP VALUE`, so removing
|
|
335
|
+
* a value means renaming and recreating the type and casting every
|
|
336
|
+
* column with `USING`. That cast fails on any row still holding the
|
|
337
|
+
* removed value, so the operator should review the migration before it
|
|
338
|
+
* runs rather than find out mid-deploy.
|
|
422
339
|
*/
|
|
423
340
|
/**
|
|
424
341
|
* Parsed payload from the header block. Empty arrays for keys not
|
|
@@ -667,191 +584,6 @@ declare const DB_REPLICA: InjectionToken<KickDbClient>;
|
|
|
667
584
|
*/
|
|
668
585
|
declare const DB_CLIENT: InjectionToken<KickDbClient<unknown>>;
|
|
669
586
|
//#endregion
|
|
670
|
-
//#region src/dsl/columns/types.d.ts
|
|
671
|
-
/**
|
|
672
|
-
* Runtime + type representation of a column reference (e.g. `users.id`).
|
|
673
|
-
* Carries the parent table name, the column's own name, plus runtime
|
|
674
|
-
* accessors used by FK thunks and constraint builders.
|
|
675
|
-
*
|
|
676
|
-
* Exported so adopters can annotate self-referencing thunks without
|
|
677
|
-
* spelling the shape inline:
|
|
678
|
-
*
|
|
679
|
-
* parentId: uuid().references((): ColumnRef => categories.id)
|
|
680
|
-
*
|
|
681
|
-
* Without the annotation the initializer of a self-referencing const
|
|
682
|
-
* trips TS7022 — TS needs to infer the const while the initializer
|
|
683
|
-
* already references it.
|
|
684
|
-
*/
|
|
685
|
-
interface ColumnRef {
|
|
686
|
-
__tableName: string;
|
|
687
|
-
__name: string;
|
|
688
|
-
__builder: ColumnBuilder;
|
|
689
|
-
__state: () => ReturnType<ColumnBuilder['__state']>;
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* Resolved FK spec — `table` / `column` are pulled by invoking `thunk()`
|
|
693
|
-
* lazily. The thunk pattern lets self-referencing tables work:
|
|
694
|
-
*
|
|
695
|
-
* const categories = table('categories', {
|
|
696
|
-
* id: uuid().primaryKey().defaultRandom(),
|
|
697
|
-
* parentId: uuid().references((): ColumnRef => categories.id),
|
|
698
|
-
* })
|
|
699
|
-
*
|
|
700
|
-
* If we resolved at `.references()` call time, `categories` would TDZ-fail
|
|
701
|
-
* inside its own initializer. Storing the thunk and resolving on read
|
|
702
|
-
* (extract / render / emit) defers until after the const binding lands.
|
|
703
|
-
*/
|
|
704
|
-
interface FkSpec {
|
|
705
|
-
thunk: () => ColumnRef;
|
|
706
|
-
onDelete: FkAction;
|
|
707
|
-
onUpdate: FkAction;
|
|
708
|
-
}
|
|
709
|
-
interface ColumnState {
|
|
710
|
-
type: string;
|
|
711
|
-
nullable: boolean;
|
|
712
|
-
default: string | null;
|
|
713
|
-
primaryKey: boolean;
|
|
714
|
-
unique: boolean;
|
|
715
|
-
references: FkSpec | null;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Type-only brand attached to a column when it's auto-assigned by the
|
|
719
|
-
* database (serial / bigserial / smallserial), has a runtime default
|
|
720
|
-
* (`.default(...)`), or carries an expression default
|
|
721
|
-
* (`uuid().defaultRandom()`, `timestamp().defaultNow()`). `SchemaToTypes<S>`
|
|
722
|
-
* reads this marker and wraps the column type in Kysely's `Generated<T>` so
|
|
723
|
-
* adopters can omit the column on insert.
|
|
724
|
-
*
|
|
725
|
-
* Runtime is a no-op — the symbol never reaches a value.
|
|
726
|
-
*/
|
|
727
|
-
declare const KICK_GENERATED: unique symbol;
|
|
728
|
-
type GeneratedBrand = {
|
|
729
|
-
readonly [KICK_GENERATED]?: true;
|
|
730
|
-
};
|
|
731
|
-
/**
|
|
732
|
-
* Type-only brand attached to a column when `.notNull()` or `.primaryKey()`
|
|
733
|
-
* is called. `SchemaToTypes<S>` reads this brand to decide whether the
|
|
734
|
-
* column type is `T` (NOT NULL) or `T | null` (default nullable).
|
|
735
|
-
*
|
|
736
|
-
* Why a brand instead of a class generic: chained methods (notNull,
|
|
737
|
-
* primaryKey) can return `this & NotNullBrand` to narrow nullability while
|
|
738
|
-
* preserving the subclass identity — so `uuid().primaryKey().defaultRandom()`
|
|
739
|
-
* still resolves `defaultRandom()` on `UuidBuilder`. A class generic
|
|
740
|
-
* `<TNullable>` would collapse the subclass back to the parent.
|
|
741
|
-
*/
|
|
742
|
-
declare const KICK_NOT_NULL: unique symbol;
|
|
743
|
-
type NotNullBrand = {
|
|
744
|
-
readonly [KICK_NOT_NULL]?: true;
|
|
745
|
-
};
|
|
746
|
-
/**
|
|
747
|
-
* Re-attach the nullability / generated brands after a transform that
|
|
748
|
-
* must return a *new* builder type (e.g. `.array()` widening `T` to
|
|
749
|
-
* `T[]`). Without this, `integer().notNull().array()` silently dropped
|
|
750
|
-
* `NotNullBrand` and the row type regressed to `number[] | null`.
|
|
751
|
-
*
|
|
752
|
-
* Uses the same `extends` checks as `SchemaToTypes` (client/schema-types.ts)
|
|
753
|
-
* so detection stays consistent in both directions.
|
|
754
|
-
*/
|
|
755
|
-
type PreserveBrands<Self, Out> = Out & (Self extends NotNullBrand ? NotNullBrand : unknown) & (Self extends GeneratedBrand ? GeneratedBrand : unknown);
|
|
756
|
-
/**
|
|
757
|
-
* Phantom-typed column builder. The `T` generic carries the column's TS
|
|
758
|
-
* value type (number / string / Date / etc.); nullability is tracked via
|
|
759
|
-
* the `NotNullBrand` intersection rather than a class generic so chain
|
|
760
|
-
* methods preserve subclass identity.
|
|
761
|
-
*
|
|
762
|
-
* Both `T` and the brand are erased at runtime; they exist purely so
|
|
763
|
-
* `SchemaToTypes<S>` can pull them out per column.
|
|
764
|
-
*/
|
|
765
|
-
declare class ColumnBuilder<T = unknown> {
|
|
766
|
-
readonly __t?: T;
|
|
767
|
-
protected state: ColumnState;
|
|
768
|
-
constructor(type: string, defaults?: Partial<ColumnState>);
|
|
769
|
-
notNull(): this & NotNullBrand;
|
|
770
|
-
primaryKey(): this & NotNullBrand;
|
|
771
|
-
unique(): this;
|
|
772
|
-
array(): PreserveBrands<this, ColumnBuilder<T[]>>;
|
|
773
|
-
references(target: () => ColumnRef, opts?: {
|
|
774
|
-
onDelete?: FkAction;
|
|
775
|
-
onUpdate?: FkAction;
|
|
776
|
-
}): this;
|
|
777
|
-
/**
|
|
778
|
-
* Mark the column as having a runtime / DB-assigned default. The
|
|
779
|
-
* `GeneratedBrand` flows into `SchemaToTypes<S>` so the column wraps
|
|
780
|
-
* in `Generated<T>` — adopters can `INSERT` without specifying it.
|
|
781
|
-
*
|
|
782
|
-
* Accepts the natural literal for the column type — `boolean().default(false)`,
|
|
783
|
-
* `integer().default(0)`, `varchar().default('active')`. Non-string
|
|
784
|
-
* literals are normalised to their SQL-literal text so the snapshot
|
|
785
|
-
* (`ColumnSnapshot.default: string | null`) and migration emitter stay
|
|
786
|
-
* string-only. For a quoted string default the text is the value
|
|
787
|
-
* itself (`'active'`); booleans/numbers emit bare (`false`, `0`).
|
|
788
|
-
*/
|
|
789
|
-
default(value: string | number | boolean): this & GeneratedBrand;
|
|
790
|
-
toJSON(name: string): ColumnSnapshot;
|
|
791
|
-
__state(): Readonly<ColumnState>;
|
|
792
|
-
}
|
|
793
|
-
//#endregion
|
|
794
|
-
//#region src/dsl/constraints.d.ts
|
|
795
|
-
interface IndexDecl {
|
|
796
|
-
name: string;
|
|
797
|
-
columns: string[];
|
|
798
|
-
unique: boolean;
|
|
799
|
-
}
|
|
800
|
-
interface ColRef {
|
|
801
|
-
__name: string;
|
|
802
|
-
}
|
|
803
|
-
declare function index(name: string): {
|
|
804
|
-
on(...cols: ColRef[]): IndexDecl;
|
|
805
|
-
};
|
|
806
|
-
declare function unique(name: string): {
|
|
807
|
-
on(...cols: ColRef[]): IndexDecl;
|
|
808
|
-
};
|
|
809
|
-
//#endregion
|
|
810
|
-
//#region src/dsl/table.d.ts
|
|
811
|
-
interface TableDecl<TName extends string = string, C extends Record<string, ColumnBuilder> = Record<string, ColumnBuilder>, TSchema extends string | undefined = string | undefined> {
|
|
812
|
-
__isTable: true;
|
|
813
|
-
__name: TName;
|
|
814
|
-
__columns: C;
|
|
815
|
-
__indexes: IndexDecl[];
|
|
816
|
-
/**
|
|
817
|
-
* Named SQL schema this table lives in, from `pgSchema('x').table(...)`.
|
|
818
|
-
* `undefined` means the connection's default search_path (`public` on PG),
|
|
819
|
-
* which is every table declared through the bare `table()` factory.
|
|
820
|
-
*
|
|
821
|
-
* PostgreSQL only — `assertSchemasSupported()` rejects a declared schema
|
|
822
|
-
* on MySQL/SQLite at snapshot time rather than emitting subtly wrong DDL.
|
|
823
|
-
*/
|
|
824
|
-
__schema?: TSchema;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Fully-qualified name used as the snapshot key, the Kysely table key, and
|
|
828
|
-
* the emitted identifier. `quoteIdent` splits on `.`, so `billing.invoices`
|
|
829
|
-
* renders as `"billing"."invoices"` with no further work.
|
|
830
|
-
*
|
|
831
|
-
* Unqualified tables keep their bare name, so every pre-schema snapshot,
|
|
832
|
-
* migration hash, and `KickDbSchema` key is byte-identical to before.
|
|
833
|
-
*/
|
|
834
|
-
type QualifiedName<TName extends string, TSchema extends string | undefined> = TSchema extends string ? `${TSchema}.${TName}` : TName;
|
|
835
|
-
/** Runtime counterpart of {@link QualifiedName}. */
|
|
836
|
-
declare function qualifiedTableName(decl: {
|
|
837
|
-
__name: string;
|
|
838
|
-
__schema?: string | undefined;
|
|
839
|
-
}): string;
|
|
840
|
-
type TableRefs<TName extends string, C extends Record<string, ColumnBuilder>, TSchema extends string | undefined = undefined> = TableDecl<TName, C, TSchema> & { [K in keyof C]: ColumnRef; };
|
|
841
|
-
type ConstraintBuilder<C extends Record<string, ColumnBuilder>> = (refs: { [K in keyof C]: ColumnRef; }) => Record<string, IndexDecl>;
|
|
842
|
-
/**
|
|
843
|
-
* Declare a typed table. The `TName extends string` generic narrows to the
|
|
844
|
-
* literal table name so `SchemaToTypes<S>` can index by it without losing
|
|
845
|
-
* the constant — `table('users', …)` widens to `TableDecl<'users', …>`,
|
|
846
|
-
* not `TableDecl<string, …>`.
|
|
847
|
-
*/
|
|
848
|
-
declare function table<TName extends string, C extends Record<string, ColumnBuilder>>(name: TName, columns: C, constraints?: ConstraintBuilder<C>): TableRefs<TName, C>;
|
|
849
|
-
/**
|
|
850
|
-
* Shared table constructor. `table()` passes `schema: undefined`;
|
|
851
|
-
* `pgSchema('x').table()` passes the schema name through.
|
|
852
|
-
*/
|
|
853
|
-
declare function buildTable<TName extends string, C extends Record<string, ColumnBuilder>, TSchema extends string | undefined>(name: TName, columns: C, constraints: ConstraintBuilder<C> | undefined, schema: TSchema): TableRefs<TName, C, TSchema>;
|
|
854
|
-
//#endregion
|
|
855
587
|
//#region src/client/schema-types.d.ts
|
|
856
588
|
/**
|
|
857
589
|
* Pull each column's TS type and nullability into the row shape Kysely
|
|
@@ -949,7 +681,6 @@ interface RunnerOptions {
|
|
|
949
681
|
/**
|
|
950
682
|
* Allow migrations carrying the `-- KICK ENUM REMOVE` header to
|
|
951
683
|
* apply. Default `false`. CLI exposes via `--confirm-enum-drop`.
|
|
952
|
-
* Spec: docs/db/spec-enum-value-removal.md.
|
|
953
684
|
*/
|
|
954
685
|
confirmEnumDrop?: boolean;
|
|
955
686
|
}
|
|
@@ -1188,8 +919,7 @@ interface RelationOne<TTarget extends TableDecl<string, Record<string, ColumnBui
|
|
|
1188
919
|
/**
|
|
1189
920
|
* Disambiguates this relation from sibling `one` relations on the
|
|
1190
921
|
* same source table that point at the same target. Pair with the
|
|
1191
|
-
* matching `relationName` on the inverse `many` side.
|
|
1192
|
-
* docs/db/spec-relation-name.md.
|
|
922
|
+
* matching `relationName` on the inverse `many` side.
|
|
1193
923
|
*/
|
|
1194
924
|
relationName?: string;
|
|
1195
925
|
}
|
|
@@ -1370,8 +1100,6 @@ declare class RelationalQueryAliasCollisionError extends KickDbError {
|
|
|
1370
1100
|
* `AbortController.abort(reason)` — on the `cause` field for adopter
|
|
1371
1101
|
* inspection (e.g. distinguishing HTTP timeout from explicit
|
|
1372
1102
|
* cancellation from user-disconnect).
|
|
1373
|
-
*
|
|
1374
|
-
* Spec: docs/db/spec-abortsignal-threading.md.
|
|
1375
1103
|
*/
|
|
1376
1104
|
declare class RelationalQueryCancelledError extends KickDbError {
|
|
1377
1105
|
readonly cause?: unknown;
|
|
@@ -1391,8 +1119,7 @@ declare class RelationalQueryNotSupportedError extends KickDbError {
|
|
|
1391
1119
|
* on the **target** table shares the same `relationName` AND points
|
|
1392
1120
|
* back at the same source — the actual ambiguity case for resolver
|
|
1393
1121
|
* step 1. Scope is per `(sourceTable, targetTable, relationName)`:
|
|
1394
|
-
* the same tag can be reused across unrelated table pairs.
|
|
1395
|
-
* docs/db/spec-relation-name.md §7 R-2.
|
|
1122
|
+
* the same tag can be reused across unrelated table pairs.
|
|
1396
1123
|
*/
|
|
1397
1124
|
declare class RelationalQueryAmbiguousRelationNameError extends KickDbError {
|
|
1398
1125
|
readonly sourceTable: string;
|
|
@@ -1489,5 +1216,5 @@ declare function markDialect<T extends object>(dialect: T, tag: DialectTag): T;
|
|
|
1489
1216
|
*/
|
|
1490
1217
|
declare function readDialectMark(dialect: object): DialectTag | undefined;
|
|
1491
1218
|
//#endregion
|
|
1492
|
-
export { GenerateOptions as $,
|
|
1493
|
-
//# sourceMappingURL=index-
|
|
1219
|
+
export { GenerateOptions as $, readJournal as $t, bigSerial as A, DropColumn as An, DriftBehavior as At, json as B, extractSnapshot as Bn, IntrospectPgOptions as Bt, Relation as C, AddIndex as Cn, SchemaToTypes as Ct, relations as D, CreateEnum as Dn, KickDbAdapterConfig as Dt, RelationsDecl as E, ChangeSet as En, DB_REPLICA as Et, date as F, RemoveEnumValue as Fn, introspectMysql as Ft, smallSerial as G, lockTableDdl as Gt, numeric as H, MemoryMigrationAdapter as Ht, decimal as I, RenameColumn as In, IntrospectSqliteOptions as It, time as J, MigrationRow as Jt, smallint as K, migrationsTableDdl as Kt, doublePrecision as L, RenameTable as Ln, SqliteIntrospectDb as Lt, boolean as M, DropForeignKey as Mn, checkDrift as Mt, bytea as N, DropIndex as Nn, IntrospectMysqlOptions as Nt, TimestampBuilder as O, CreateSchema as On, MigrationsOnBoot as Ot, char as P, DropTable as Pn, MysqlIntrospectDb as Pt, varchar as Q, computeMigrationHash as Qt, integer as R, renderSchemaSource as Rn, introspectSqlite as Rt, customType as S, AddForeignKey as Sn, createDbClient as St, RelationOne as T, Change as Tn, DB_PRIMARY as Tt, real as U, KICK_LOCK_TABLE as Ut, jsonb as V, PgQueryRunner as Vt, serial as W, KICK_MIGRATIONS_TABLE as Wt, timestamptz as X, JournalEntry as Xt, timestamp as Y, Journal as Yt, uuid as Z, appendJournalEntry as Zt, SchemaToRelationsRegister as _, hasAmbiguousReverse as _n, migrateLatest as _t, markDialect as a, MigrationEnumDropError as an, emitMysql as at, CustomColumnBuilder as b, AddColumn as bn, migrateUp as bt, escapeLike as c, MigrationLockError as cn, emitPg as ct, RelationalQueryAmbiguousRelationNameError as d, CompositeEnumReferenceError as dn, AppliedSummary as dt, verifyMigrationHash as en, GenerateResult as et, RelationalQueryCancelledError as f, CompositeQueryRunner as fn, ReversedSummary as ft, RelationalQueryUnknownRelationError as g, RemovedValueAsDefaultError as gn, migrateDown as gt, RelationalQueryNotSupportedError as h, KickDbError as hn, StatusEntry as ht, isDialectTag as i, MigrationDriftError as in, resolveDbConfig as it, bigint as j, DropEnum as jn, DriftLogger as jt, UuidBuilder as k, CreateTable as kn, kickDbAdapter as kt, likePattern as l, SchemaDiffSummary as ln, ReviewResult as lt, RelationalQueryMissingInverseError as m, detectCompositeReferences as mn, RunnerOptions as mt, DialectTag as n, enforceEnumDropGate as nn, DbConfig as nt, readDialectMark as o, MigrationError as on, SqliteRebuildRequiredError as ot, RelationalQueryDepthError as p, CompositeRef as pn, RollbackSummary as pt, text as q, MigrationAdapter as qt, KICK_DIALECT as r, parseEnumDropHeader as rn, MigrationAdapterFactory as rt, LikeMatchMode as s, MigrationHashError as sn, emitSqlite as st, ReadonlyKysely as t, EnumDropHeader as tn, generate as tt, RelationalQueryAliasCollisionError as u, UnreviewedMigrationError as un, reviewMigration as ut, ResolvedRelation as v, invertChanges as vn, migrateRollback as vt, RelationMany as w, AlterColumn as wn, DB_CLIENT as wt, CustomTypeOptions as x, AddEnumValue as xn, safeNullComparison as xt, ResolvedRelations as y, diff as yn, migrateStatus as yt, interval as z, fitIdentifier as zn, introspectPg as zt };
|
|
1220
|
+
//# sourceMappingURL=index-DF69HndC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DF69HndC.d.mts","names":[],"sources":["../src/snapshot/extract.ts","../src/snapshot/name.ts","../src/snapshot/render.ts","../src/diff/types.ts","../src/diff/engine.ts","../src/diff/invert.ts","../src/errors.ts","../src/diff/composite-detect.ts","../src/migrate/errors.ts","../src/migrate/enum-drop-gate.ts","../src/migrate/journal.ts","../src/migrate/adapter.ts","../src/migrate/schema.ts","../src/migrate/memory-adapter.ts","../src/migrate/introspect-types.ts","../src/migrate/introspect-pg.ts","../src/migrate/introspect-sqlite.ts","../src/migrate/introspect-mysql.ts","../src/migrate/drift.ts","../src/adapter.ts","../src/tokens.ts","../src/client/schema-types.ts","../src/client/create.ts","../src/client/plugins.ts","../src/migrate/runner.ts","../src/migrate/review.ts","../src/emit/pg.ts","../src/emit/sqlite.ts","../src/emit/mysql.ts","../src/cli/config.ts","../src/cli/generate.ts","../src/dsl/columns/builders.ts","../src/dsl/relations.ts","../src/custom-type.ts","../src/query/relations.ts","../src/query/schema-relations-types.ts","../src/query/errors.ts","../src/query/like.ts","../src/dialect-marker.ts"],"mappings":";;;;;;;iBAiEgB,gBAAgB,QAAQ,yBAAyB,SAAS,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCfpE,cAAc;;;;;;;;;;;;;;;;;;;iBCxBd,mBAAmB,UAAU;;;;;;;;;;;;UCT5B;EACf;EACA;;UAGe;EACf;EACA,OAAO;;UAGQ;EACf;EACA,OAAO;;UAGQ;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,QAAQ;;UAGO;EACf;EACA;EACA,QAAQ;;UAGO;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,QAAQ;EACR,OAAO;;UAGQ;EACf;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA,IAAI;;UAGW;EACf;EACA;EACA,IAAI;;UAGW;EACf;EACA,MAAM;;UAGS;EACf;EACA,MAAM;;;;;;;;;;UAWS;EACf;EACA;EACA;;EAEA;;;;;;;;;;UAWe;EACf;;EAEA;;EAEA;;;;;;EAMA;;;;;;;;;;;;EAYA;IAA4B;IAAe;IAAgB;;;KAGjD,SACR,eACA,cACA,YACA,cACA,YACA,aACA,eACA,cACA,WACA,YACA,gBACA,iBACA,aACA,WACA,eACA;KAEQ,YAAY;;;iBClKR,KAAK,MAAM,gBAAgB,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;iBCalD,cAAc,SAAS,YAAY;iBA+GnC,oBAAoB,SAAS;;;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AS;;iBAKvC,YAAY,kBAAkB,SAAS,GAAG,KAAK,aAAa;;;;;;;iBAgB5D,gBAAgB,kBAAkB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { C as
|
|
4
|
-
|
|
2
|
+
import { C as IndexSnapshot, E as TableSnapshot, S as ForeignKeySnapshot, T as SchemaSnapshot, _ as CheckSnapshot, a as table, b as EnumSnapshot, c as unique, d as ColumnState, f as FkSpec, g as NotNullBrand, h as KICK_NOT_NULL, i as qualifiedTableName, l as ColumnBuilder, m as KICK_GENERATED, n as TableDecl, o as IndexDecl, p as GeneratedBrand, r as buildTable, s as index, t as QualifiedName, u as ColumnRef, v as ColumnSnapshot, w as RelationSnapshot, x as FkAction, y as Dialect } from "./table-Bl5SbKRg.mjs";
|
|
3
|
+
import { $ as GenerateOptions, $t as readJournal, A as bigSerial, An as DropColumn, At as DriftBehavior, B as json, Bn as extractSnapshot, Bt as IntrospectPgOptions, C as Relation, Cn as AddIndex, Ct as SchemaToTypes, D as relations, Dn as CreateEnum, Dt as KickDbAdapterConfig, E as RelationsDecl, En as ChangeSet, Et as DB_REPLICA, F as date, Fn as RemoveEnumValue, Ft as introspectMysql, G as smallSerial, Gt as lockTableDdl, H as numeric, Ht as MemoryMigrationAdapter, I as decimal, In as RenameColumn, It as IntrospectSqliteOptions, J as time, Jt as MigrationRow, K as smallint, Kt as migrationsTableDdl, L as doublePrecision, Ln as RenameTable, Lt as SqliteIntrospectDb, M as boolean, Mn as DropForeignKey, Mt as checkDrift, N as bytea, Nn as DropIndex, Nt as IntrospectMysqlOptions, O as TimestampBuilder, On as CreateSchema, Ot as MigrationsOnBoot, P as char, Pn as DropTable, Pt as MysqlIntrospectDb, Q as varchar, Qt as computeMigrationHash, R as integer, Rn as renderSchemaSource, Rt as introspectSqlite, S as customType, Sn as AddForeignKey, St as createDbClient, T as RelationOne, Tn as Change, Tt as DB_PRIMARY, U as real, Ut as KICK_LOCK_TABLE, V as jsonb, Vt as PgQueryRunner, W as serial, Wt as KICK_MIGRATIONS_TABLE, X as timestamptz, Xt as JournalEntry, Y as timestamp, Yt as Journal, Z as uuid, Zt as appendJournalEntry, _ as SchemaToRelationsRegister, _n as hasAmbiguousReverse, _t as migrateLatest, a as markDialect, an as MigrationEnumDropError, at as emitMysql, b as CustomColumnBuilder, bn as AddColumn, bt as migrateUp, c as escapeLike, cn as MigrationLockError, ct as emitPg, d as RelationalQueryAmbiguousRelationNameError, dn as CompositeEnumReferenceError, dt as AppliedSummary, en as verifyMigrationHash, et as GenerateResult, f as RelationalQueryCancelledError, fn as CompositeQueryRunner, ft as ReversedSummary, g as RelationalQueryUnknownRelationError, gn as RemovedValueAsDefaultError, gt as migrateDown, h as RelationalQueryNotSupportedError, hn as KickDbError, ht as StatusEntry, i as isDialectTag, in as MigrationDriftError, it as resolveDbConfig, j as bigint, jn as DropEnum, jt as DriftLogger, k as UuidBuilder, kn as CreateTable, kt as kickDbAdapter, l as likePattern, ln as SchemaDiffSummary, lt as ReviewResult, m as RelationalQueryMissingInverseError, mn as detectCompositeReferences, mt as RunnerOptions, n as DialectTag, nn as enforceEnumDropGate, nt as DbConfig, o as readDialectMark, on as MigrationError, ot as SqliteRebuildRequiredError, p as RelationalQueryDepthError, pn as CompositeRef, pt as RollbackSummary, q as text, qt as MigrationAdapter, r as KICK_DIALECT, rn as parseEnumDropHeader, s as LikeMatchMode, sn as MigrationHashError, st as emitSqlite, t as ReadonlyKysely, tn as EnumDropHeader, tt as generate, u as RelationalQueryAliasCollisionError, un as UnreviewedMigrationError, ut as reviewMigration, v as ResolvedRelation, vn as invertChanges, vt as migrateRollback, w as RelationMany, wn as AlterColumn, wt as DB_CLIENT, x as CustomTypeOptions, xn as AddEnumValue, xt as safeNullComparison, y as ResolvedRelations, yn as diff, yt as migrateStatus, z as interval, zn as fitIdentifier, zt as introspectPg } from "./index-DF69HndC.mjs";
|
|
4
|
+
import { C as ModelExtensions, S as ExtensionDefinition, _ as TableRelations, a as QueryErrorEvent, b as RegisteredDB, c as TransactionEvent, d as FindManyRow, f as KickDbRelationsRegister, g as TableQueryNamespace, h as RelationMapEntry, i as KickDbClientEvents, l as TransactionRollbackEvent, m as RegisteredRelations, n as CreateDbClientOptions, o as QueryEvent, p as QueryNamespace, r as KickDbClient, t as BeforeQueryEvent, u as FindManyOptions, v as WithClause, x as ExtendedClient, y as KickDbRegister } from "./types-DtvYnaXL.mjs";
|
|
5
|
+
export { type AddColumn, type AddEnumValue, type AddForeignKey, type AddIndex, type AlterColumn, type AppliedSummary, type BeforeQueryEvent, type Change, type ChangeSet, type CheckSnapshot, ColumnBuilder, type ColumnRef, type ColumnSnapshot, type ColumnState, CompositeEnumReferenceError, type CompositeQueryRunner, type CompositeRef, type CreateDbClientOptions, type CreateEnum, type CreateSchema, type CreateTable, CustomColumnBuilder, type CustomTypeOptions, DB_CLIENT, DB_PRIMARY, DB_REPLICA, type DbConfig, type Dialect, type DialectTag, type DriftBehavior, type DriftLogger, type DropColumn, type DropEnum, type DropForeignKey, type DropIndex, type DropTable, type EnumDropHeader, type EnumSnapshot, type ExtendedClient, type ExtensionDefinition, type FindManyOptions, type FindManyRow, type FkAction, type FkSpec, type ForeignKeySnapshot, type GenerateOptions, type GenerateResult, type GeneratedBrand, IndexDecl, type IndexSnapshot, type IntrospectMysqlOptions, type IntrospectPgOptions, type IntrospectSqliteOptions, type Journal, type JournalEntry, KICK_DIALECT, KICK_GENERATED, KICK_LOCK_TABLE, KICK_MIGRATIONS_TABLE, KICK_NOT_NULL, type KickDbAdapterConfig, type KickDbClient, type KickDbClientEvents, KickDbError, type KickDbRegister, type KickDbRelationsRegister, type LikeMatchMode, MemoryMigrationAdapter, type MigrationAdapter, MigrationDriftError, MigrationEnumDropError, MigrationError, MigrationHashError, MigrationLockError, type MigrationRow, type MigrationsOnBoot, type ModelExtensions, type MysqlIntrospectDb, type NotNullBrand, type PgQueryRunner, QualifiedName, type QueryErrorEvent, type QueryEvent, type QueryNamespace, type ReadonlyKysely, type RegisteredDB, type RegisteredRelations, Relation, RelationMany, type RelationMapEntry, RelationOne, type RelationSnapshot, RelationalQueryAliasCollisionError, RelationalQueryAmbiguousRelationNameError, RelationalQueryCancelledError, RelationalQueryDepthError, RelationalQueryMissingInverseError, RelationalQueryNotSupportedError, RelationalQueryUnknownRelationError, RelationsDecl, type RemoveEnumValue, RemovedValueAsDefaultError, type RenameColumn, type RenameTable, type ResolvedRelation, type ResolvedRelations, type ReversedSummary, type ReviewResult, type RollbackSummary, type RunnerOptions, type SchemaDiffSummary, type SchemaSnapshot, type SchemaToRelationsRegister, type SchemaToTypes, type SqliteIntrospectDb, SqliteRebuildRequiredError, type StatusEntry, TableDecl, type TableQueryNamespace, type TableRelations, type TableSnapshot, TimestampBuilder, type TransactionEvent, type TransactionRollbackEvent, UnreviewedMigrationError, UuidBuilder, type WithClause, appendJournalEntry, bigSerial, bigint, boolean, buildTable, bytea, char, checkDrift, computeMigrationHash, createDbClient, customType, date, decimal, detectCompositeReferences, diff, doublePrecision, emitMysql, emitPg, emitSqlite, enforceEnumDropGate, escapeLike, extractSnapshot, fitIdentifier, generate, hasAmbiguousReverse, index, integer, interval, introspectMysql, introspectPg, introspectSqlite, invertChanges, isDialectTag, json, jsonb, kickDbAdapter, likePattern, lockTableDdl, markDialect, migrateDown, migrateLatest, migrateRollback, migrateStatus, migrateUp, migrationsTableDdl, numeric, parseEnumDropHeader, qualifiedTableName, readDialectMark, readJournal, real, relations, renderSchemaSource, resolveDbConfig, reviewMigration, safeNullComparison, serial, smallSerial, smallint, table, text, time, timestamp, timestamptz, unique, uuid, varchar, verifyMigrationHash };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-db v7.
|
|
2
|
+
* @forinda/kickjs-db v7.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{$ as
|
|
11
|
+
import{$ as introspectMysql,A as varchar,At as RelationalQueryDepthError,B as DB_CLIENT,C as smallSerial,Ct as invertChanges,D as timestamp,Dt as RelationalQueryAliasCollisionError,E as time,Et as extractSnapshot,F as createDbClient,Ft as RemovedValueAsDefaultError,G as migrateLatest,H as DB_REPLICA,I as KICK_DIALECT,It as buildTable,J as migrateUp,K as migrateRollback,L as isDialectTag,Lt as qualifiedTableName,M as resolveDbConfig,Mt as RelationalQueryNotSupportedError,N as reviewMigration,Nt as RelationalQueryUnknownRelationError,O as timestamptz,Ot as RelationalQueryAmbiguousRelationNameError,P as safeNullComparison,Pt as KickDbError,Q as emitSqlite,R as markDialect,Rt as table,S as serial,St as hasAmbiguousReverse,T as text,Tt as renderSchemaSource,U as kickDbAdapter,V as DB_PRIMARY,W as migrateDown,X as emitMysql,Y as checkDrift,Z as SqliteRebuildRequiredError,_ as interval,_t as MigrationHashError,a as unique,at as lockTableDdl,b as numeric,bt as CompositeEnumReferenceError,c as bigSerial,ct as computeMigrationHash,d as bytea,dt as enforceEnumDropGate,et as introspectSqlite,f as char,ft as parseEnumDropHeader,g as integer,gt as MigrationError,h as doublePrecision,ht as MigrationEnumDropError,i as index,it as KICK_MIGRATIONS_TABLE,j as generate,jt as RelationalQueryMissingInverseError,k as uuid,kt as RelationalQueryCancelledError,l as bigint,lt as readJournal,m as decimal,mt as MigrationDriftError,n as likePattern,nt as MemoryMigrationAdapter,o as TimestampBuilder,ot as migrationsTableDdl,p as date,pt as emitPg,q as migrateStatus,r as relations,rt as KICK_LOCK_TABLE,s as UuidBuilder,st as appendJournalEntry,t as escapeLike,tt as introspectPg,u as boolean,ut as verifyMigrationHash,v as json,vt as MigrationLockError,w as smallint,wt as diff,x as real,xt as detectCompositeReferences,y as jsonb,yt as UnreviewedMigrationError,z as readDialectMark,zt as fitIdentifier}from"./src-BnHTLx5l.mjs";import{a as KICK_NOT_NULL,i as KICK_GENERATED,n as customType,r as ColumnBuilder,t as CustomColumnBuilder}from"./custom-type-j8k__3sL.mjs";export{ColumnBuilder,CompositeEnumReferenceError,CustomColumnBuilder,DB_CLIENT,DB_PRIMARY,DB_REPLICA,KICK_DIALECT,KICK_GENERATED,KICK_LOCK_TABLE,KICK_MIGRATIONS_TABLE,KICK_NOT_NULL,KickDbError,MemoryMigrationAdapter,MigrationDriftError,MigrationEnumDropError,MigrationError,MigrationHashError,MigrationLockError,RelationalQueryAliasCollisionError,RelationalQueryAmbiguousRelationNameError,RelationalQueryCancelledError,RelationalQueryDepthError,RelationalQueryMissingInverseError,RelationalQueryNotSupportedError,RelationalQueryUnknownRelationError,RemovedValueAsDefaultError,SqliteRebuildRequiredError,TimestampBuilder,UnreviewedMigrationError,UuidBuilder,appendJournalEntry,bigSerial,bigint,boolean,buildTable,bytea,char,checkDrift,computeMigrationHash,createDbClient,customType,date,decimal,detectCompositeReferences,diff,doublePrecision,emitMysql,emitPg,emitSqlite,enforceEnumDropGate,escapeLike,extractSnapshot,fitIdentifier,generate,hasAmbiguousReverse,index,integer,interval,introspectMysql,introspectPg,introspectSqlite,invertChanges,isDialectTag,json,jsonb,kickDbAdapter,likePattern,lockTableDdl,markDialect,migrateDown,migrateLatest,migrateRollback,migrateStatus,migrateUp,migrationsTableDdl,numeric,parseEnumDropHeader,qualifiedTableName,readDialectMark,readJournal,real,relations,renderSchemaSource,resolveDbConfig,reviewMigration,safeNullComparison,serial,smallSerial,smallint,table,text,time,timestamp,timestamptz,unique,uuid,varchar,verifyMigrationHash};
|
package/dist/mysql.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { qt as MigrationAdapter } from "./index-DF69HndC.mjs";
|
|
3
3
|
import { Dialect } from "kysely";
|
|
4
4
|
//#region src/adapters/mysql/adapter.d.ts
|
|
5
5
|
/**
|
|
@@ -15,15 +15,15 @@ import { Dialect } from "kysely";
|
|
|
15
15
|
* callers pass `R = ResultSetHeader`). Each adapter call site picks
|
|
16
16
|
* the row shape it expects via the type parameter.
|
|
17
17
|
*/
|
|
18
|
-
interface MysqlConnectionLike {
|
|
18
|
+
export interface MysqlConnectionLike {
|
|
19
19
|
query<R = unknown>(sql: string, params?: readonly unknown[]): Promise<[R, unknown]>;
|
|
20
20
|
release(): void;
|
|
21
21
|
}
|
|
22
|
-
interface MysqlPoolLike {
|
|
22
|
+
export interface MysqlPoolLike {
|
|
23
23
|
query<R = unknown>(sql: string, params?: readonly unknown[]): Promise<[R, unknown]>;
|
|
24
24
|
getConnection(): Promise<MysqlConnectionLike>;
|
|
25
25
|
}
|
|
26
|
-
interface MysqlAdapterOptions {
|
|
26
|
+
export interface MysqlAdapterOptions {
|
|
27
27
|
/**
|
|
28
28
|
* mysql2-compatible Pool. Caller-owned — `close()` on the adapter
|
|
29
29
|
* does NOT end the pool because adopters typically share a single
|
|
@@ -36,7 +36,7 @@ interface MysqlAdapterOptions {
|
|
|
36
36
|
* adopters distinguish MySQL from MariaDB without re-grepping the
|
|
37
37
|
* raw string.
|
|
38
38
|
*/
|
|
39
|
-
interface ParsedMysqlVersion {
|
|
39
|
+
export interface ParsedMysqlVersion {
|
|
40
40
|
flavor: 'mysql' | 'mariadb';
|
|
41
41
|
major: number;
|
|
42
42
|
minor: number;
|
|
@@ -54,7 +54,7 @@ interface ParsedMysqlVersion {
|
|
|
54
54
|
*
|
|
55
55
|
* Returns `null` on unparseable input.
|
|
56
56
|
*/
|
|
57
|
-
declare function parseMysqlVersion(version: string): ParsedMysqlVersion | null;
|
|
57
|
+
export declare function parseMysqlVersion(version: string): ParsedMysqlVersion | null;
|
|
58
58
|
/**
|
|
59
59
|
* Back-compat shim — pre-existing API surface that returned the
|
|
60
60
|
* major version only. Kept exported so adopters depending on it
|
|
@@ -62,7 +62,7 @@ declare function parseMysqlVersion(version: string): ParsedMysqlVersion | null;
|
|
|
62
62
|
*
|
|
63
63
|
* @deprecated Use `parseMysqlVersion` for full version + flavor info.
|
|
64
64
|
*/
|
|
65
|
-
declare function parseMysqlMajorVersion(version: string): number | null;
|
|
65
|
+
export declare function parseMysqlMajorVersion(version: string): number | null;
|
|
66
66
|
/**
|
|
67
67
|
* Split a SQL blob into individual statements at the top-level `;`
|
|
68
68
|
* boundary. Respects single-quote / double-quote / backtick string
|
|
@@ -94,7 +94,7 @@ declare function parseMysqlMajorVersion(version: string): number | null;
|
|
|
94
94
|
* Documented in the README; turn on `multipleStatements: true` on
|
|
95
95
|
* the pool if you hit it.
|
|
96
96
|
*/
|
|
97
|
-
declare function splitMysqlStatements(sql: string): string[];
|
|
97
|
+
export declare function splitMysqlStatements(sql: string): string[];
|
|
98
98
|
/**
|
|
99
99
|
* MigrationAdapter implementation backed by mysql2.
|
|
100
100
|
*
|
|
@@ -121,10 +121,10 @@ declare function splitMysqlStatements(sql: string): string[];
|
|
|
121
121
|
* code `KICK_DB_INTROSPECT_NOT_SUPPORTED`. Drift detection lands
|
|
122
122
|
* in a follow-up that walks `information_schema`.
|
|
123
123
|
*/
|
|
124
|
-
declare function mysqlAdapter(opts: MysqlAdapterOptions): MigrationAdapter;
|
|
124
|
+
export declare function mysqlAdapter(opts: MysqlAdapterOptions): MigrationAdapter;
|
|
125
125
|
//#endregion
|
|
126
126
|
//#region src/adapters/mysql/dialect.d.ts
|
|
127
|
-
interface MysqlDialectOptions {
|
|
127
|
+
export interface MysqlDialectOptions {
|
|
128
128
|
/**
|
|
129
129
|
* mysql2-compatible pool. Both `mysql.createPool(...)` from
|
|
130
130
|
* `mysql2/promise` and `mysql2.createPool(...)` (callback API
|
|
@@ -158,7 +158,6 @@ interface MysqlDialectOptions {
|
|
|
158
158
|
* export const migrationAdapter = mysqlAdapter({ pool })
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
|
-
declare function mysqlDialect(opts: MysqlDialectOptions): Dialect;
|
|
161
|
+
export declare function mysqlDialect(opts: MysqlDialectOptions): Dialect;
|
|
162
162
|
//#endregion
|
|
163
|
-
export { MysqlAdapterOptions, MysqlConnectionLike, MysqlDialectOptions, MysqlPoolLike, ParsedMysqlVersion, mysqlAdapter, mysqlDialect, parseMysqlMajorVersion, parseMysqlVersion, splitMysqlStatements };
|
|
164
163
|
//# sourceMappingURL=mysql.d.mts.map
|
package/dist/mysql.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql.d.mts","names":[],"sources":["../src/adapters/mysql/adapter.ts","../src/adapters/mysql/dialect.ts"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"mysql.d.mts","names":[],"sources":["../src/adapters/mysql/adapter.ts","../src/adapters/mysql/dialect.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAwBiB;EACf,MAAM,aAAa,aAAa,8BAA8B,SAAS;EACvE;;iBAGe;EACf,MAAM,aAAa,aAAa,8BAA8B,SAAS;EACvE,iBAAiB,QAAQ;;iBAGV;;;;;;EAMf,MAAM;;;;;;;iBAiBS;EACf;EACA;EACA;;;;;;;;;;;;;;;wBAgBc,kBAAkB,kBAAkB;;;;;;;;wBA4CpC,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6DvB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2IrB,aAAa,MAAM,sBAAsB;;;iBCtTxC;;;;;;EAMf,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6BQ,aAAa,MAAM,sBAAsB"}
|