@forinda/kickjs-db 8.11.3 → 8.12.1
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/{adapter-B1aAO8fL.d.mts → adapter-BkBhLEts.d.mts} +2 -2
- package/dist/{adapter-B1aAO8fL.d.mts.map → adapter-BkBhLEts.d.mts.map} +1 -1
- package/dist/cli.d.mts +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{create-Bsf7or0m.mjs → create-BUNHS2XX.mjs} +3 -3
- package/dist/create-BUNHS2XX.mjs.map +1 -0
- package/dist/{custom-type-B2LmdFuT.mjs → custom-type-B6DrtO46.mjs} +2 -2
- package/dist/custom-type-B6DrtO46.mjs.map +1 -0
- package/dist/devtools-events.d.mts +1 -1
- package/dist/devtools-events.mjs +1 -1
- package/dist/{index-Bot_2VFH.d.mts → index-C935uxe5.d.mts} +129 -12
- package/dist/{index-Bot_2VFH.d.mts.map → index-C935uxe5.d.mts.map} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/mysql.d.mts +2 -2
- package/dist/mysql.mjs +2 -2
- package/dist/{pg-DCCDrhAN.mjs → pg-DXzM76xd.mjs} +3 -3
- package/dist/pg-DXzM76xd.mjs.map +1 -0
- package/dist/pg.d.mts +19 -5
- package/dist/pg.d.mts.map +1 -1
- package/dist/pg.mjs +2 -2
- package/dist/pglite.d.mts +1 -1
- package/dist/pglite.mjs +1 -1
- package/dist/{schema-BjwousYZ.d.mts → schema-jLdsVhUe.d.mts} +3 -3
- package/dist/{schema-BjwousYZ.d.mts.map → schema-jLdsVhUe.d.mts.map} +1 -1
- package/dist/{schema-types-BbQzqRfa.d.mts → schema-types-CdU4u-Ow.d.mts} +3 -3
- package/dist/{schema-types-BbQzqRfa.d.mts.map → schema-types-CdU4u-Ow.d.mts.map} +1 -1
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +2 -2
- package/dist/{split-statements-BqrIZ2Zr.mjs → split-statements-B_7QYVyn.mjs} +2 -2
- package/dist/{split-statements-BqrIZ2Zr.mjs.map → split-statements-B_7QYVyn.mjs.map} +1 -1
- package/dist/sqlite.d.mts +1 -1
- package/dist/sqlite.mjs +2 -2
- package/dist/{src-DUmaOaNW.mjs → src-Ivi-0lCB.mjs} +3 -3
- package/dist/{src-DUmaOaNW.mjs.map → src-Ivi-0lCB.mjs.map} +1 -1
- package/dist/{table-6E5JCtHD.d.mts → table-BGk08X3C.d.mts} +19 -3
- package/dist/table-BGk08X3C.d.mts.map +1 -0
- package/dist/testing.d.mts +2 -2
- package/dist/testing.mjs +2 -2
- package/dist/{types-OaIxajA4.d.mts → types-8xZUYm43.d.mts} +2 -2
- package/dist/{types-OaIxajA4.d.mts.map → types-8xZUYm43.d.mts.map} +1 -1
- package/dist/{types-Bz1G4t-q.d.mts → types-DB_xyeQT.d.mts} +77 -6
- package/dist/types-DB_xyeQT.d.mts.map +1 -0
- package/package.json +2 -2
- package/dist/create-Bsf7or0m.mjs.map +0 -1
- package/dist/custom-type-B2LmdFuT.mjs.map +0 -1
- package/dist/pg-DCCDrhAN.mjs.map +0 -1
- package/dist/table-6E5JCtHD.d.mts.map +0 -1
- package/dist/types-Bz1G4t-q.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-db v8.
|
|
2
|
+
* @forinda/kickjs-db v8.12.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
const FK_ACTION_NAMES=[`cascade`,`restrict`,`set_null`,`set_default`,`no_action`];function arrayLiteral(value){return`{${value.map(v=>v==null?`NULL`:Array.isArray(v)?arrayLiteral(v):typeof v==`string`||v instanceof Date?`"${(typeof v==`string`?v:dateLiteral(v)).replace(/["\\]/g,`\\$&`)}"`:String(v)).join(`,`)}}`}function dateLiteral(d){return d.toISOString().replace(`T`,` `).replace(`Z`,`+00:00`)}const KICK_GENERATED=Symbol.for(`@forinda/kickjs-db/Generated`),KICK_NOT_NULL=Symbol.for(`@forinda/kickjs-db/NotNull`);var ColumnBuilder=class{state;constructor(type,defaults={}){this.state={type,nullable:defaults.nullable??!0,default:defaults.default??null,primaryKey:defaults.primaryKey??!1,unique:defaults.unique??!1,references:defaults.references??null,...defaults.mode?{mode:defaults.mode}:{}}}notNull(){return this.state.nullable=!1,this}primaryKey(){return this.state.primaryKey=!0,this.state.nullable=!1,this}unique(){return this.state.unique=!0,this}array(){return this.state.type=`${this.state.type}[]`,this}references(target,opts={}){for(let key of[`onDelete`,`onUpdate`]){let action=opts[key];if(action!==void 0&&!FK_ACTION_NAMES.includes(action))throw Error(`references(): ${key} '${action}' isn't an action — use ${FK_ACTION_NAMES.map(a=>`'${a}'`).join(`, `).replace(/, ([^,]*)$/,` or $1`)}`)}return this.state.references={thunk:target,onDelete:opts.onDelete??`no_action`,onUpdate:opts.onUpdate??`no_action`,...opts.name===void 0?{}:{name:opts.name}},this}default(value){return this.state.default=typeof value==`string`?value:Array.isArray(value)&&this.state.type.endsWith(`[]`)?arrayLiteral(value):value instanceof Date?dateLiteral(value):typeof value==`object`&&value?JSON.stringify(value):String(value),this.state.defaultSql=!1,this}defaultSql(expression){return this.state.default=expression,this.state.defaultSql=!0,this}$defaultFn(fn){return this.state.defaultFn=fn,this}$onUpdate(fn){return this.state.onUpdateFn=fn,this}onUpdateNow(){return this.state.managed=`updatedAt`,this}softDelete(){return this.state.managed=`softDelete`,this}generatedAlwaysAs(expression,options={}){return this.state.generated={expression,stored:options.stored??!0},this}generatedAlwaysAsIdentity(){return this.state.identity=`always`,this.state.nullable=!1,this}generatedByDefaultAsIdentity(){return this.state.identity=`byDefault`,this.state.nullable=!1,this}comment(text){return this.state.comment=text,this}colName(name){return this.state.colName=name,this}managedAs(){return this.state.managed}toJSON(name){return{name,type:this.state.type,nullable:this.state.nullable,default:this.state.default,...this.state.defaultSql?{defaultSql:!0}:{},primaryKey:this.state.primaryKey,...this.state.generated?{generated:{...this.state.generated}}:{},...this.state.identity?{identity:this.state.identity}:{},...this.state.comment===void 0?{}:{comment:this.state.comment}}}__state(){return this.state}},CustomColumnBuilder=class extends ColumnBuilder{toDriver;fromDriver;constructor(opts){super(opts.dataType()),this.toDriver=opts.toDriver,this.fromDriver=opts.fromDriver}};function customType(opts){return()=>new CustomColumnBuilder(opts)}export{KICK_NOT_NULL as a,KICK_GENERATED as i,customType as n,ColumnBuilder as r,CustomColumnBuilder as t};
|
|
12
|
-
//# sourceMappingURL=custom-type-
|
|
12
|
+
//# sourceMappingURL=custom-type-B6DrtO46.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-type-B6DrtO46.mjs","names":[],"sources":["../src/snapshot/types.ts","../src/dsl/columns/types.ts","../src/custom-type.ts"],"sourcesContent":["export type Dialect = 'postgres' | 'sqlite' | 'mysql'\n\n/** The foreign-key actions, in the snapshot's spelling. */\nexport const FK_ACTION_NAMES = [\n 'cascade',\n 'restrict',\n 'set_null',\n 'set_default',\n 'no_action',\n] as const\nexport type FkAction = (typeof FK_ACTION_NAMES)[number]\n\nexport interface ColumnSnapshot {\n name: string\n type: string\n nullable: boolean\n default: string | null\n /** `default` is SQL to evaluate (`.defaultSql()`), not a value. Absent means a value. */\n defaultSql?: true\n /**\n * Only on an introspected Postgres snapshot: `column_default` as the\n * database reports it. `default` is normalised and can't tell the literal\n * `'(f())'::text` from the expression `(f())::text`; the drift check can.\n */\n defaultRaw?: string\n primaryKey: boolean\n /** A column the database computes from others: `GENERATED ALWAYS AS (expression)`. */\n generated?: { expression: string; stored: boolean }\n /** An identity column (Postgres): `GENERATED ALWAYS | BY DEFAULT AS IDENTITY`. */\n identity?: 'always' | 'byDefault'\n /** The column's comment in the database (Postgres, MySQL). */\n comment?: string\n /**\n * Only on an introspected snapshot read back into keys: the database's own\n * name, when `casing` wouldn't give it back — rendered as `.colName()`.\n */\n colName?: string\n}\n\nexport interface IndexSnapshot {\n name: string\n /** Key parts in order: a column name, or an SQL expression wrapped in parentheses. */\n columns: string[]\n unique: boolean\n /** Partial index predicate (Postgres, SQLite), as SQL. */\n where?: string\n /** Index method, e.g. `gin`, `gist`, `hnsw` (Postgres) or `hash` (MySQL). Absent means the default. */\n using?: string\n /** Non-key columns stored in the index (Postgres `INCLUDE`). */\n include?: string[]\n /** Operator class per key part, keyed by the entry in `columns` (Postgres). */\n opclasses?: Record<string, string>\n /** Build and drop without locking writes (Postgres). Doesn't change the index itself. */\n concurrently?: boolean\n}\n\nexport interface ForeignKeySnapshot {\n name: string\n columns: string[]\n refTable: string\n refColumns: string[]\n onDelete: FkAction\n onUpdate: FkAction\n}\n\nexport interface CheckSnapshot {\n name: string\n expression: string\n}\n\nexport interface TableSnapshot {\n /**\n * Bare table name, unqualified. The schema (when any) lives in\n * {@link TableSnapshot.schema}; the map key on `SchemaSnapshot.tables` is\n * the qualified form (`billing.invoices`).\n */\n name: string\n /**\n * Named SQL schema, from `pgSchema('x').table(...)`. Absent for tables in\n * the connection's default search_path, which keeps pre-schema snapshots\n * byte-identical (and their migration hashes valid).\n */\n schema?: string\n columns: Record<string, ColumnSnapshot>\n indexes: IndexSnapshot[]\n foreignKeys: ForeignKeySnapshot[]\n checks: CheckSnapshot[]\n /**\n * The key declared with `primaryKey(name?).on(...)`: its name and column\n * order. The columns also carry `primaryKey: true`. Absent for a key\n * declared on columns, so those snapshots — and migration hashes — stay\n * as they were.\n */\n primaryKey?: { name?: string; columns: string[] }\n /** The table's comment in the database (Postgres, MySQL). */\n comment?: string\n /** Row-level security is on (Postgres); `force` applies it to the table's owner too. */\n rls?: { force?: true }\n /** Row-level security policies (Postgres). */\n policies?: PolicySnapshot[]\n}\n\n/**\n * PostgreSQL ENUM type declaration. Currently PG-only; the field is\n * optional on `SchemaSnapshot` so other dialects don't have to carry\n * a phantom `enums: {}`.\n */\nexport interface EnumSnapshot {\n name: string\n /** Allowed values, in declaration order. PG preserves the order. */\n values: readonly string[]\n}\n\n/**\n * Resolved relation graph attached as a sidecar on the snapshot.\n * Lives on `SchemaSnapshot.relations` (optional). Keyed\n * sourceTable → relationName → resolved entry. Consumed by the\n * relational-query compiler in `packages/db/src/query/`. The\n * migration pipeline does not read this field — relations are\n * query-time sugar, not DDL.\n *\n * Shaped this way (rather than re-using the runtime `RelationsDecl`)\n * so the snapshot stays JSON-serializable: no function thunks, no\n * back-references to table objects.\n */\nexport interface RelationSnapshot {\n kind: 'one' | 'many'\n /** Target table name. */\n target: string\n /** Columns on the source table that participate in the join. */\n sourceColumns: readonly string[]\n /** Columns on the target table that participate in the join. */\n targetColumns: readonly string[]\n /**\n * Optional pairing tag from `relationName: 'foo'` on both sides of\n * the relation. Disambiguates multi-FK schemas.\n */\n relationName?: string\n /**\n * For a many-to-many: the junction table, and its columns that hold the\n * source's `sourceColumns` and the target's `targetColumns`.\n */\n through?: { table: string; sourceColumns: readonly string[]; targetColumns: readonly string[] }\n /**\n * For a `morphMany` / `morphOne`: the target's type column and the value it must hold\n * (bound as a parameter). There's no foreign key behind the join.\n */\n morph?: { column: string; value: string }\n /**\n * For a `morphTo`: the source's type column, and per type value the table\n * and key column the source's id column (`sourceColumns[0]`) points at.\n * `target` holds the first of those tables.\n */\n morphTo?: {\n column: string\n targets: ReadonlyArray<{ value: string; table: string; key: string }>\n }\n}\n\n/** A row-level security policy (Postgres). */\nexport interface PolicySnapshot {\n name: string\n as: 'permissive' | 'restrictive'\n command: 'all' | 'select' | 'insert' | 'update' | 'delete'\n /** Role names; `public` is everyone. */\n to: string[]\n using?: string\n withCheck?: string\n}\n\n/** A Postgres role the schema declares (created if missing, never dropped). */\nexport interface RoleSnapshot {\n name: string\n login?: boolean\n createDb?: boolean\n createRole?: boolean\n /** Default true: privileges of roles it's a member of apply to it. */\n inherit?: boolean\n bypassRls?: boolean\n}\n\nexport interface ViewSnapshot {\n name: string\n /** The `SELECT`, as declared (or as the database reports it, when introspected). */\n definition: string\n /** A materialized view (Postgres). */\n materialized?: true\n /** Indexes on a materialized view. */\n indexes?: IndexSnapshot[]\n /**\n * The columns, when introspected — for `kick db introspect` to render.\n * Not compared: the definition decides what a view returns.\n */\n columns?: Record<string, ColumnSnapshot>\n}\n\nexport interface SchemaSnapshot {\n version: 1\n dialect: Dialect\n /**\n * Keyed by QUALIFIED name — `billing.invoices` for a table declared through\n * `pgSchema('billing')`, the bare name otherwise. Qualifying the key is what\n * lets two schemas hold same-named tables without colliding, and it makes\n * every `table: string` field on a diff `Change` already schema-correct:\n * `quoteIdent` splits on `.`, rendering `\"billing\".\"invoices\"`.\n */\n tables: Record<string, TableSnapshot>\n /**\n * Named schemas the tables in this snapshot live in, sorted. Drives\n * `CREATE SCHEMA IF NOT EXISTS` emission. PG-only; absent when no table\n * declares a schema, so existing snapshots keep their exact shape.\n */\n schemas?: readonly string[]\n /** ENUM types declared via `pgEnum()`. PG-only; absent on other dialects. */\n enums?: Record<string, EnumSnapshot>\n /**\n * Views, in declaration order — the order they're created in, so a view can\n * select from one declared before it. Absent when there are none.\n */\n views?: Record<string, ViewSnapshot>\n /** Roles declared with `pgRole()` (Postgres). Absent when none. */\n roles?: Record<string, RoleSnapshot>\n /**\n * Optional relation sidecar populated when the schema includes\n * `relations()` declarations. Absent when no relations are\n * declared so M0/M1 callers see the same snapshot shape they\n * always did.\n */\n relations?: Record<string, Record<string, RelationSnapshot>>\n}\n","import { FK_ACTION_NAMES, type ColumnSnapshot, type FkAction } from '../../snapshot/types'\n\n/**\n * Runtime + type representation of a column reference (e.g. `users.id`).\n * Carries the parent table name, the column's own name, plus runtime\n * accessors used by FK thunks and constraint builders.\n *\n * Exported so adopters can annotate self-referencing thunks without\n * spelling the shape inline:\n *\n * parentId: uuid().references((): ColumnRef => categories.id)\n *\n * Without the annotation the initializer of a self-referencing const\n * trips TS7022 — TS needs to infer the const while the initializer\n * already references it.\n */\nexport interface ColumnRef {\n __tableName: string\n __name: string\n __builder: ColumnBuilder\n __state: () => ReturnType<ColumnBuilder['__state']>\n}\n\n/**\n * Resolved FK spec — `table` / `column` are pulled by invoking `thunk()`\n * lazily. The thunk pattern lets self-referencing tables work:\n *\n * const categories = table('categories', {\n * id: uuid().primaryKey().defaultRandom(),\n * parentId: uuid().references((): ColumnRef => categories.id),\n * })\n *\n * If we resolved at `.references()` call time, `categories` would TDZ-fail\n * inside its own initializer. Storing the thunk and resolving on read\n * (extract / render / emit) defers until after the const binding lands.\n */\n/**\n * A column ref that knows its column's value type — what lets a foreign key\n * be checked against the column it points at (`fk()`). Assignable to\n * `ColumnRef`, so every existing ref-taking API keeps working.\n */\nexport type TypedColumnRef<T> = ColumnRef & { readonly __valueType?: T }\n\n/** Typed refs for a column record — one per column. */\nexport type TypedColumnRefs<C> = {\n [K in keyof C]: TypedColumnRef<C[K] extends ColumnBuilder<infer T> ? T : never>\n}\n\ndeclare const SELF_REF: unique symbol\ndeclare const SELF_REF_TO: unique symbol\n\n/** What `selfRef('id')` returns: a target thunk that names a column of this table. */\nexport type SelfRef<K extends string> = (() => ColumnRef) & { readonly [SELF_REF]: K }\n\n/**\n * A column whose foreign key is `fk(builder, selfRef(K))`, checked by `table()`\n * against its own columns. `.references()` can't carry it: a generic or\n * overloaded `.references()` makes a plain thunk in a class field circular (TS7022).\n */\nexport type SelfRefTo<K extends string> = { readonly [SELF_REF_TO]: K }\n\ntype SelfRefTarget<B> = B extends SelfRefTo<infer K> ? K : never\ntype ValueOf<B> = B extends ColumnBuilder<infer T> ? T : never\n\n/**\n * `table()`'s check on its columns: each `selfRef(K)` names one of them, of a\n * type this column can hold. A failing column reads as the reason.\n */\nexport type CheckSelfRefs<C> = {\n [P in keyof C]: [SelfRefTarget<C[P]>] extends [never]\n ? C[P]\n : SelfRefTarget<C[P]> extends keyof C\n ? [ValueOf<C[SelfRefTarget<C[P]>]>] extends [ValueOf<C[P]>]\n ? C[P]\n : `selfRef('${SelfRefTarget<C[P]>}'): that column's type doesn't match this one`\n : `selfRef('${SelfRefTarget<C[P]>}'): this table has no such column`\n}\n\nexport interface FkSpec {\n thunk: () => ColumnRef\n onDelete: FkAction\n onUpdate: FkAction\n /**\n * The constraint's name in the database.\n *\n * Omitted for schemas written by hand — the name is then derived as\n * `<table>_<column>_fk`. It is set when the schema was generated by\n * `kick db introspect`, because a database names its constraints itself:\n * Postgres' own default is `<table>_<column>_fkey`, and a DBA may have\n * chosen anything. Dropping the real name would make the next diff want to\n * rename every foreign key in the schema.\n */\n name?: string\n}\n\n/** Postgres array literal text: `{1,2}`, `{\"a\",\"b c\"}`. */\nfunction arrayLiteral(value: unknown[]): string {\n const item = (v: unknown): string =>\n v === null || v === undefined\n ? 'NULL'\n : Array.isArray(v)\n ? arrayLiteral(v)\n : typeof v === 'string' || v instanceof Date\n ? `\"${(typeof v === 'string' ? v : dateLiteral(v)).replace(/[\"\\\\]/g, '\\\\$&')}\"`\n : String(v)\n return `{${value.map(item).join(',')}}`\n}\n\n/** A Date's UTC time that Postgres, MySQL and SQLite all read: no `T`, no `Z`. */\nfunction dateLiteral(d: Date): string {\n return d.toISOString().replace('T', ' ').replace('Z', '+00:00')\n}\n\nexport interface ColumnState {\n type: string\n nullable: boolean\n default: string | null\n /** `default` is SQL to evaluate (`.defaultSql()`), not a value. */\n defaultSql?: boolean\n primaryKey: boolean\n unique: boolean\n references: FkSpec | null\n /**\n * A column kick/db maintains itself: `'updatedAt'` (set on every update),\n * `'version'` (incremented on every update), `'softDelete'` (rows with it\n * set are skipped by relational reads). Never part of the snapshot — it\n * changes queries, not the schema.\n */\n managed?: 'updatedAt' | 'version' | 'softDelete'\n generated?: { expression: string; stored: boolean }\n identity?: 'always' | 'byDefault'\n /**\n * How a bigint / numeric value is read back (`bigint({ mode })`,\n * `numeric(p, s, { mode })`). Unset, the driver's own value is returned.\n */\n mode?: 'bigint' | 'number' | 'string'\n /** `.comment()`: stored in the database on Postgres and MySQL. */\n comment?: string\n /** `.colName()`: the column's name in the database, when it isn't the key (or its `casing`). */\n colName?: string\n /** `tenantKey(tenancy)`: this is the table's tenant column. */\n tenancy?: { strategy: string; setting: string }\n /** `$defaultFn`: computed in JS for each inserted row that doesn't set it. */\n defaultFn?: () => unknown\n /** `$onUpdate`: computed in JS for each update that doesn't set it. */\n onUpdateFn?: () => unknown\n}\n\n/**\n * Type-only brand attached to a column when it's auto-assigned by the\n * database (serial / bigserial / smallserial), has a runtime default\n * (`.default(...)`), or carries an expression default\n * (`uuid().defaultRandom()`, `timestamp().defaultNow()`). `SchemaToTypes<S>`\n * reads this marker and wraps the column type in Kysely's `Generated<T>` so\n * adopters can omit the column on insert.\n *\n * Runtime is a no-op — the symbol never reaches a value.\n */\nexport const KICK_GENERATED = Symbol.for('@forinda/kickjs-db/Generated')\nexport type GeneratedBrand = { readonly [KICK_GENERATED]?: true }\n\n/**\n * Type-only brand for a column the database always computes — a generated\n * column, or an identity `GENERATED ALWAYS`. `SchemaToTypes<S>` wraps it in\n * Kysely's `GeneratedAlways<T>`, so it can't be inserted or updated.\n */\nexport const KICK_GENERATED_ALWAYS = Symbol.for('@forinda/kickjs-db/GeneratedAlways')\nexport type GeneratedAlwaysBrand = { readonly [KICK_GENERATED_ALWAYS]?: true }\n\n/**\n * Type-only brand attached to a column when `.notNull()` or `.primaryKey()`\n * is called. `SchemaToTypes<S>` reads this brand to decide whether the\n * column type is `T` (NOT NULL) or `T | null` (default nullable).\n *\n * Why a brand instead of a class generic: chained methods (notNull,\n * primaryKey) can return `this & NotNullBrand` to narrow nullability while\n * preserving the subclass identity — so `uuid().primaryKey().defaultRandom()`\n * still resolves `defaultRandom()` on `UuidBuilder`. A class generic\n * `<TNullable>` would collapse the subclass back to the parent.\n */\nexport const KICK_NOT_NULL = Symbol.for('@forinda/kickjs-db/NotNull')\nexport type NotNullBrand = { readonly [KICK_NOT_NULL]?: true }\n\n/**\n * Re-attach the nullability / generated / selfRef brands after a transform that\n * must return a *new* builder type (e.g. `.array()` widening `T` to\n * `T[]`). Without this, `integer().notNull().array()` silently dropped\n * `NotNullBrand` and the row type regressed to `number[] | null`.\n *\n * Uses the same `extends` checks as `SchemaToTypes` (client/schema-types.ts)\n * so detection stays consistent in both directions.\n */\nexport type PreserveBrands<Self, Out> = Out &\n (Self extends NotNullBrand ? NotNullBrand : unknown) &\n (Self extends GeneratedBrand ? GeneratedBrand : unknown) &\n (Self extends GeneratedAlwaysBrand ? GeneratedAlwaysBrand : unknown) &\n (Self extends SelfRefTo<infer K> ? SelfRefTo<K> : unknown)\n\n/**\n * Phantom-typed column builder. The `T` generic carries the column's TS\n * value type (number / string / Date / etc.); nullability is tracked via\n * the `NotNullBrand` intersection rather than a class generic so chain\n * methods preserve subclass identity.\n *\n * Both `T` and the brand are erased at runtime; they exist purely so\n * `SchemaToTypes<S>` can pull them out per column.\n */\nexport class ColumnBuilder<T = unknown> {\n // Phantom param shows up in the public surface so the type system sees\n // it. Reading it at runtime is intentionally not supported.\n declare readonly __t?: T\n\n protected state: ColumnState\n\n constructor(type: string, defaults: Partial<ColumnState> = {}) {\n this.state = {\n type,\n nullable: defaults.nullable ?? true,\n default: defaults.default ?? null,\n primaryKey: defaults.primaryKey ?? false,\n unique: defaults.unique ?? false,\n references: defaults.references ?? null,\n ...(defaults.mode ? { mode: defaults.mode } : {}),\n }\n }\n\n /**\n * `NOT NULL`: drops `| null` from the column's type.\n *\n * @example\n * name: text().notNull()\n */\n notNull(): this & NotNullBrand {\n this.state.nullable = false\n return this as this & NotNullBrand\n }\n\n /**\n * `PRIMARY KEY` (implies `NOT NULL`). For a key over several columns, use\n * `primaryKey().on(...)` in the table's constraints instead.\n *\n * @example\n * id: uuid().primaryKey().defaultRandom()\n */\n primaryKey(): this & NotNullBrand {\n this.state.primaryKey = true\n this.state.nullable = false\n return this as this & NotNullBrand\n }\n\n /**\n * `UNIQUE` on this column alone. Partial or multi-column: `unique(name).on(...)`\n * in the table's constraints.\n *\n * @example\n * email: varchar(320).notNull().unique()\n */\n unique(): this {\n this.state.unique = true\n return this\n }\n\n /**\n * An array of this type (`text[]`), typed `T[]`.\n *\n * @example\n * tags: text().array().notNull().default([])\n */\n array(): PreserveBrands<this, ColumnBuilder<T[]>> {\n this.state.type = `${this.state.type}[]`\n return this as unknown as PreserveBrands<this, ColumnBuilder<T[]>>\n }\n\n /**\n * A foreign key to another table's column. The target is a thunk, so tables\n * can be declared in any order. For a column of the same table, use\n * `selfRef('id')`; for two tables that point at each other, `link()`.\n * Actions: `'cascade'`, `'restrict'`, `'set_null'`, `'set_default'`,\n * `'no_action'` (the default). `name` overrides the derived constraint name.\n *\n * @example\n * authorId: uuid().notNull().references(() => users.id, { onDelete: 'cascade' })\n * parentId: uuid().references(selfRef('id'), { onDelete: 'set_null' })\n */\n references(\n target: () => ColumnRef,\n opts: { onDelete?: FkAction; onUpdate?: FkAction; name?: string } = {},\n ): this {\n // Checked here, where it's written: the schema is loaded without a type\n // check by `kick db generate`, and an unknown action reached the SQL as `undefined`.\n for (const key of ['onDelete', 'onUpdate'] as const) {\n const action = opts[key]\n if (action !== undefined && !(FK_ACTION_NAMES as readonly string[]).includes(action))\n throw new Error(\n `references(): ${key} '${action}' isn't an action — use ${FK_ACTION_NAMES.map(\n (a) => `'${a}'`,\n )\n .join(', ')\n .replace(/, ([^,]*)$/, ' or $1')}`,\n )\n }\n // Store the thunk — do NOT invoke it here. Self-referencing tables\n // pass `() => self.id` whose binding does not exist yet.\n this.state.references = {\n thunk: target,\n onDelete: opts.onDelete ?? 'no_action',\n onUpdate: opts.onUpdate ?? 'no_action',\n // Only carried when given: an absent name means \"derive it\", and\n // storing the derived value here would make it indistinguishable from\n // an explicit one that happens to match.\n ...(opts.name === undefined ? {} : { name: opts.name }),\n }\n return this\n }\n\n /**\n * Mark the column as having a runtime / DB-assigned default. The\n * `GeneratedBrand` flows into `SchemaToTypes<S>` so the column wraps\n * in `Generated<T>` — adopters can `INSERT` without specifying it.\n *\n * Accepts the natural literal for the column type — `boolean().default(false)`,\n * `integer().default(0)`, `varchar().default('active')`. Non-string\n * literals are normalised to their SQL-literal text so the snapshot\n * (`ColumnSnapshot.default: string | null`) and migration emitter stay\n * string-only. For a quoted string default the text is the value\n * itself (`'active'`); booleans/numbers emit bare (`false`, `0`). A JSON\n * column takes its value (`jsonb().default({})` stores `{}`), an array\n * column its array literal (`integer().array().default([1, 2])` stores\n * `{1,2}`), and a `Date` its UTC time (`2026-01-02 03:04:05.000+00:00`).\n */\n default(value: string | number | boolean | T): this & GeneratedBrand {\n this.state.default =\n typeof value === 'string'\n ? value\n : Array.isArray(value) && this.state.type.endsWith('[]')\n ? arrayLiteral(value)\n : value instanceof Date\n ? dateLiteral(value)\n : typeof value === 'object' && value !== null\n ? JSON.stringify(value)\n : String(value)\n this.state.defaultSql = false\n return this as this & GeneratedBrand\n }\n\n /**\n * A default that is SQL, evaluated by the database for each new row —\n * `id: text().primaryKey().defaultSql('gen_random_uuid()::text')`,\n * `slug: text().defaultSql(\"lower(hex(randomblob(8)))\")`. `.default()` is a\n * value: on a text column `.default('now()')` stores the string `now()`.\n * Written as given, so it's your dialect's SQL.\n */\n defaultSql(expression: string): this & GeneratedBrand {\n this.state.default = expression\n this.state.defaultSql = true\n return this as this & GeneratedBrand\n }\n\n /**\n * A default computed in JS for each inserted row that doesn't set this\n * column — an id generator, a slug, a value from config:\n * `id: text().primaryKey().$defaultFn(() => ulid())`. Not part of the\n * schema: the database has no default, so raw SQL inserts must set it.\n */\n $defaultFn(fn: () => T): this & GeneratedBrand {\n this.state.defaultFn = fn\n return this as this & GeneratedBrand\n }\n\n /**\n * A value computed in JS for each update (and an upsert's update branch)\n * that doesn't set this column: `revisedBy: text().$onUpdate(() => currentUser())`.\n * Like `onUpdateNow()`, with your own value. Inserts don't call it.\n */\n $onUpdate(fn: () => T): this {\n this.state.onUpdateFn = fn\n return this\n }\n\n /**\n * Set this column to the current time on every update that doesn't set it\n * itself, and on an upsert's update branch. Your own value wins. Raw `sql`\n * updates don't maintain it.\n *\n * @example\n * updatedAt: timestamp().notNull().defaultNow().onUpdateNow()\n */\n onUpdateNow(): this {\n this.state.managed = 'updatedAt'\n return this\n }\n\n /**\n * Mark this column — a nullable timestamp — as the soft-delete marker:\n * relational reads (`db.query`) skip rows where it's set, at every level,\n * unless that level passes `withDeleted: true`. Soft-delete by setting it to\n * the current time; restore by setting it back to `null`.\n *\n * The query builder (`selectFrom`) is plain SQL and still sees deleted rows:\n * add `.where('deletedAt', 'is', null)` there yourself. No schema change.\n *\n * @example\n * deletedAt: timestamp().softDelete()\n * // delete: db.updateTable('docs').set({ deletedAt: new Date() }).where('id', '=', id)\n * // include: db.query.docs.findMany({ withDeleted: true })\n */\n softDelete(): this {\n this.state.managed = 'softDelete'\n return this\n }\n\n /**\n * Computed by the database from other columns, on every write:\n * `total: numeric(12, 2).generatedAlwaysAs('price * quantity')`. The SQL is\n * passed through as written. Stored by default; `{ stored: false }` makes\n * it virtual, computed on read (MySQL, SQLite, Postgres 18+). It can't be\n * inserted or updated.\n */\n generatedAlwaysAs(\n expression: string,\n options: { stored?: boolean } = {},\n ): this & GeneratedAlwaysBrand {\n this.state.generated = { expression, stored: options.stored ?? true }\n return this as this & GeneratedAlwaysBrand\n }\n\n /**\n * An identity column the database numbers and won't let you set (Postgres)\n * — the SQL-standard successor to `serial`.\n */\n generatedAlwaysAsIdentity(): this & NotNullBrand & GeneratedAlwaysBrand {\n this.state.identity = 'always'\n this.state.nullable = false\n return this as this & NotNullBrand & GeneratedAlwaysBrand\n }\n\n /** An identity column the database numbers unless a value is given (Postgres). */\n generatedByDefaultAsIdentity(): this & NotNullBrand & GeneratedBrand {\n this.state.identity = 'byDefault'\n this.state.nullable = false\n return this as this & NotNullBrand & GeneratedBrand\n }\n\n /**\n * A comment stored with the column in the database, for whoever reads the\n * schema there (Postgres, MySQL; SQLite has none). Changing it migrates.\n */\n comment(text: string): this {\n this.state.comment = text\n return this\n }\n\n /**\n * The column's name in the database, when it isn't the key — a legacy\n * `EMAIL_ADDR` behind an `email` key. Taken as written: `casing` doesn't\n * change it. Queries, `db.query` and migrations use it; your code keeps the key.\n */\n colName(name: string): this {\n this.state.colName = name\n return this\n }\n\n /** The role kick/db maintains this column in, if any. */\n managedAs(): ColumnState['managed'] {\n return this.state.managed\n }\n\n toJSON(name: string): ColumnSnapshot {\n return {\n name,\n type: this.state.type,\n nullable: this.state.nullable,\n default: this.state.default,\n ...(this.state.defaultSql ? { defaultSql: true as const } : {}),\n primaryKey: this.state.primaryKey,\n // Only when set, so other columns serialize as they always have.\n ...(this.state.generated ? { generated: { ...this.state.generated } } : {}),\n ...(this.state.identity ? { identity: this.state.identity } : {}),\n ...(this.state.comment !== undefined ? { comment: this.state.comment } : {}),\n }\n }\n\n // Internal accessor for table()/diff to read full state including unique/references.\n __state(): Readonly<ColumnState> {\n return this.state\n }\n}\n","// customType<T>() — adopter-defined column type with optional driver\n// codecs. Lets a project introduce a typed column that doesn't ship\n// in the built-in DSL (encrypted strings, custom JSON shapes, citext,\n// PostGIS geometry, etc.) without forking the package.\n//\n// Schema usage:\n//\n// const encrypted = customType<EncryptedString>({\n// dataType: () => 'text',\n// toDriver: (s) => encrypt(s),\n// fromDriver: (raw) => decrypt(String(raw)),\n// })\n//\n// export const secrets = table('secrets', {\n// id: serial().primaryKey(),\n// value: encrypted().notNull(),\n// })\n//\n// `SchemaToTypes<typeof schema>` reads the phantom T from the\n// CustomColumnBuilder so `db.selectFrom('secrets').select('value')`\n// types `value: EncryptedString` (not `string`). Driver codecs flow\n// through the lifecycle plugin landing in M2.F-T19; until then they\n// are stored on the builder for the runtime hookup to pick up.\n\nimport { ColumnBuilder } from './dsl/columns/types'\n\nexport interface CustomTypeOptions<TJs, TDriver = unknown> {\n /**\n * SQL data type as it would appear in `CREATE TABLE` — `'text'`,\n * `'jsonb'`, `'citext'`, `'geometry(Point, 4326)'`, etc. Returned\n * via a thunk so adopters can compute the type from runtime config\n * (e.g. dialect-specific overrides).\n */\n dataType: () => string\n /** Optional encode hook applied at insert / update time. */\n toDriver?: (value: TJs) => TDriver\n /** Optional decode hook applied to selected rows. */\n fromDriver?: (driver: TDriver) => TJs\n}\n\n/**\n * ColumnBuilder subclass produced by `customType()`. Carries the\n * driver codecs so the (future) hooks pipeline can wire them through\n * a Kysely plugin without each consumer re-declaring its mapping.\n *\n * The phantom `T` flows through `SchemaToTypes<S>` exactly like any\n * other ColumnBuilder<T>, so adopters get full row-shape inference\n * for free.\n */\nexport class CustomColumnBuilder<TJs> extends ColumnBuilder<TJs> {\n /** Encode hook — run on values heading into the database. */\n readonly toDriver?: (value: TJs) => unknown\n /** Decode hook — run on row values coming out of the database. */\n readonly fromDriver?: (driver: unknown) => TJs\n\n constructor(opts: CustomTypeOptions<TJs>) {\n super(opts.dataType())\n this.toDriver = opts.toDriver as never\n this.fromDriver = opts.fromDriver as never\n }\n}\n\n/**\n * Build a reusable column factory for a custom type. The returned\n * function is what callers use inside `table('foo', { col: factory() })`\n * — same shape as the built-in `varchar()`, `text()`, etc.\n *\n * @example\n * ```ts\n * const ulid = customType<string>({\n * dataType: () => 'char(26)',\n * toDriver: (s) => s,\n * fromDriver: (raw) => String(raw),\n * })\n *\n * const events = table('events', {\n * id: ulid().primaryKey(),\n * ts: timestamp().notNull().defaultNow(),\n * })\n * ```\n */\nexport function customType<TJs>(opts: CustomTypeOptions<TJs>): () => CustomColumnBuilder<TJs> {\n return () => new CustomColumnBuilder<TJs>(opts)\n}\n"],"mappings":";;;;;;;;;;AAGA,MAAa,gBAAkB,CAC7B,UACA,WACA,WACA,cACA,WACF,ECuFA,SAAS,aAAa,MAA0B,CAS9C,MAAO,IAAI,MAAM,IARH,GACZ,GAAM,KACF,OACA,MAAM,QAAQ,CAAC,EACb,aAAa,CAAC,EACd,OAAO,GAAM,UAAY,aAAa,KACpC,KAAK,OAAO,GAAM,SAAW,EAAI,YAAY,CAAC,EAAA,CAAG,QAAQ,SAAU,MAAM,EAAE,GAC3E,OAAO,CAAC,CACO,CAAC,CAAC,KAAK,GAAG,EAAE,EACvC,CAGA,SA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,GAAI,KAAK,MAAM,UAAY,CAAE,UAAW,CAAE,GAAG,KAAK,MAAM,SAAU,CAAE,EAAI,CAAC,EACzE,GAAI,KAAK,MAAM,SAAW,CAAE,SAAU,KAAK,MAAM,QAAS,EAAI,CAAC,EAC/D,GAAI,KAAK,MAAM,UAAY,IAAA,GAA8C,CAAC,EAAnC,CAAE,QAAS,KAAK,MAAM,OAAQ,CACvE,CACF,CAGA,SAAiC,CAC/B,OAAO,KAAK,KACd,CACF,ECrba,oBAAb,cAA8C,aAAmB,CAE/D,SAEA,WAEA,YAAY,KAA8B,CACxC,MAAM,KAAK,SAAS,CAAC,EACrB,KAAK,SAAW,KAAK,SACrB,KAAK,WAAa,KAAK,UACzB,CACF,EAqBA,SAAgB,WAAgB,KAA8D,CAC5F,UAAa,IAAI,oBAAyB,IAAI,CAChD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { o as QueryErrorEvent, s as QueryEvent, u as SlowQueryEvent } from "./types-
|
|
2
|
+
import { o as QueryErrorEvent, s as QueryEvent, u as SlowQueryEvent } from "./types-8xZUYm43.mjs";
|
|
3
3
|
//#region src/devtools-events.d.ts
|
|
4
4
|
declare module '@forinda/kickjs-devtools-kit/bus' {
|
|
5
5
|
interface KickDevtoolsEventRegistry {
|
package/dist/devtools-events.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { C as TableSnapshot, S as SchemaSnapshot, _ as
|
|
3
|
-
import { b as RelationMapEntry, n as CreateDbClientOptions, r as KickDbClient } from "./types-
|
|
4
|
-
import { f as TableConstraint, l as IndexDecl, n as TableDecl } from "./table-
|
|
5
|
-
import { t as SchemaToTypes } from "./schema-types-
|
|
6
|
-
import { s as SchemaLike, t as ColumnRule } from "./schema-
|
|
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
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
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
9
|
import { InjectionToken } from "@forinda/kickjs";
|
|
@@ -1396,6 +1396,14 @@ declare function fakeRows(tableLike: unknown, options: FakeRowsOptions): Row[];
|
|
|
1396
1396
|
declare function seedFake<DB>(db: KickDbClient<DB>, schema: Record<string, unknown>, options: SeedFakeOptions): Promise<Record<string, Row[]>>;
|
|
1397
1397
|
//#endregion
|
|
1398
1398
|
//#region src/dsl/columns/builders.d.ts
|
|
1399
|
+
/**
|
|
1400
|
+
* An auto-numbered integer the database assigns: `serial` on Postgres,
|
|
1401
|
+
* `INT AUTO_INCREMENT` on MySQL, `INTEGER … AUTOINCREMENT` on SQLite.
|
|
1402
|
+
* Not null, and optional on insert.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* id: serial().primaryKey()
|
|
1406
|
+
*/
|
|
1399
1407
|
declare function serial(): ColumnBuilder<number> & GeneratedBrand & NotNullBrand;
|
|
1400
1408
|
/** How `bigint` / `numeric` values are read back, and the type they get. */
|
|
1401
1409
|
interface NumberModes {
|
|
@@ -1403,25 +1411,45 @@ interface NumberModes {
|
|
|
1403
1411
|
number: number;
|
|
1404
1412
|
string: string;
|
|
1405
1413
|
}
|
|
1414
|
+
/**
|
|
1415
|
+
* {@link serial} as a 64-bit integer (`bigserial`, MySQL `BIGINT`), typed `bigint`.
|
|
1416
|
+
*
|
|
1417
|
+
* @example
|
|
1418
|
+
* id: bigSerial().primaryKey()
|
|
1419
|
+
*/
|
|
1406
1420
|
declare function bigSerial(): ColumnBuilder<bigint> & GeneratedBrand & NotNullBrand;
|
|
1421
|
+
/** {@link serial} as a 16-bit integer (`smallserial`, MySQL `SMALLINT`). */
|
|
1407
1422
|
declare function smallSerial(): ColumnBuilder<number> & GeneratedBrand & NotNullBrand;
|
|
1423
|
+
/**
|
|
1424
|
+
* A 32-bit integer (`integer`; MySQL `INT`), typed `number`.
|
|
1425
|
+
*
|
|
1426
|
+
* @example
|
|
1427
|
+
* stock: integer().notNull().default(0)
|
|
1428
|
+
*/
|
|
1408
1429
|
declare function integer(): ColumnBuilder<number>;
|
|
1409
1430
|
/**
|
|
1410
1431
|
* A 64-bit integer. Drivers return it differently (`pg` a string,
|
|
1411
1432
|
* better-sqlite3 a number), so pick how it reads back with `mode`:
|
|
1412
1433
|
* `'bigint'` (exact), `'number'` (safe up to 2^53) or `'string'`. Without
|
|
1413
1434
|
* `mode` the driver's value is returned, typed `bigint`.
|
|
1435
|
+
*
|
|
1436
|
+
* @example
|
|
1437
|
+
* views: bigint({ mode: 'number' }).notNull().default(0)
|
|
1414
1438
|
*/
|
|
1415
1439
|
declare function bigint(): ColumnBuilder<bigint>;
|
|
1416
1440
|
declare function bigint<M extends keyof NumberModes>(options: {
|
|
1417
1441
|
mode: M;
|
|
1418
1442
|
}): ColumnBuilder<NumberModes[M]>;
|
|
1443
|
+
/** A 16-bit integer (`smallint`), typed `number`. */
|
|
1419
1444
|
declare function smallint(): ColumnBuilder<number>;
|
|
1420
1445
|
/**
|
|
1421
1446
|
* An optimistic-locking counter: an integer, not null, starting at 0, that
|
|
1422
1447
|
* every update increments. Read it with the row, then update
|
|
1423
1448
|
* `.where('version', '=', read)` — no row updated means someone else changed
|
|
1424
1449
|
* it first.
|
|
1450
|
+
*
|
|
1451
|
+
* @example
|
|
1452
|
+
* version: version()
|
|
1425
1453
|
*/
|
|
1426
1454
|
declare function version(): ColumnBuilder<number> & NotNullBrand & GeneratedBrand;
|
|
1427
1455
|
type DecimalMode = {
|
|
@@ -1431,6 +1459,9 @@ type DecimalMode = {
|
|
|
1431
1459
|
* An exact decimal, read back as a string by default so no precision is lost.
|
|
1432
1460
|
* `{ mode: 'number' }` reads it as a JS number: exact up to 15 significant
|
|
1433
1461
|
* digits, which validators enforce on input (more is refused, not rounded).
|
|
1462
|
+
*
|
|
1463
|
+
* @example
|
|
1464
|
+
* price: decimal(12, 2).notNull() // '19.99'
|
|
1434
1465
|
*/
|
|
1435
1466
|
declare function decimal(precision?: number, scale?: number): ColumnBuilder<string>;
|
|
1436
1467
|
declare function decimal<M extends DecimalMode['mode']>(precision: number | undefined, scale: number | undefined, options: {
|
|
@@ -1441,11 +1472,34 @@ declare function numeric(precision?: number, scale?: number): ColumnBuilder<stri
|
|
|
1441
1472
|
declare function numeric<M extends DecimalMode['mode']>(precision: number | undefined, scale: number | undefined, options: {
|
|
1442
1473
|
mode: M;
|
|
1443
1474
|
}): ColumnBuilder<NumberModes[M]>;
|
|
1475
|
+
/** A 4-byte float (`real`; MySQL `FLOAT`), typed `number`. Inexact: use {@link decimal} for money. */
|
|
1444
1476
|
declare function real(): ColumnBuilder<number>;
|
|
1477
|
+
/** An 8-byte float (`double precision`; MySQL `DOUBLE`), typed `number`. Inexact: use {@link decimal} for money. */
|
|
1445
1478
|
declare function doublePrecision(): ColumnBuilder<number>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Text up to `length` characters (`varchar(n)`, default 255), typed `string`.
|
|
1481
|
+
* SQLite stores it as `TEXT` and doesn't enforce the length.
|
|
1482
|
+
*
|
|
1483
|
+
* @example
|
|
1484
|
+
* email: varchar(320).notNull().unique()
|
|
1485
|
+
*/
|
|
1446
1486
|
declare function varchar(length?: number): ColumnBuilder<string>;
|
|
1487
|
+
/** Fixed-length text (`char(n)`, default 1), typed `string`. Postgres and MySQL pad it with spaces. */
|
|
1447
1488
|
declare function char(length?: number): ColumnBuilder<string>;
|
|
1489
|
+
/**
|
|
1490
|
+
* Text of any length (`text`), typed `string`.
|
|
1491
|
+
*
|
|
1492
|
+
* @example
|
|
1493
|
+
* body: text().notNull()
|
|
1494
|
+
*/
|
|
1448
1495
|
declare function text(): ColumnBuilder<string>;
|
|
1496
|
+
/**
|
|
1497
|
+
* `true` / `false` (`boolean`; MySQL `TINYINT(1)`, SQLite `INTEGER`), typed
|
|
1498
|
+
* `boolean`.
|
|
1499
|
+
*
|
|
1500
|
+
* @example
|
|
1501
|
+
* active: boolean().notNull().default(true)
|
|
1502
|
+
*/
|
|
1449
1503
|
declare function boolean(): ColumnBuilder<boolean>;
|
|
1450
1504
|
/**
|
|
1451
1505
|
* Subtype builder so `defaultNow()` can mark the resulting column as
|
|
@@ -1455,17 +1509,38 @@ declare function boolean(): ColumnBuilder<boolean>;
|
|
|
1455
1509
|
*/
|
|
1456
1510
|
declare class TimestampBuilder extends ColumnBuilder<Date> {
|
|
1457
1511
|
constructor(typeName?: string);
|
|
1512
|
+
/** Default to the current time (`CURRENT_TIMESTAMP`); optional on insert. */
|
|
1458
1513
|
defaultNow(): this & GeneratedBrand;
|
|
1459
1514
|
}
|
|
1460
1515
|
/** Fractional-second digits a time type stores: 0–6. */
|
|
1461
1516
|
interface TimeOptions {
|
|
1462
1517
|
precision?: number;
|
|
1463
1518
|
}
|
|
1464
|
-
/**
|
|
1519
|
+
/**
|
|
1520
|
+
* A date and time without a zone (`timestamp`), typed `Date`.
|
|
1521
|
+
* `{ precision: 3 }` keeps milliseconds; without one, the database's default.
|
|
1522
|
+
*
|
|
1523
|
+
* @example
|
|
1524
|
+
* updatedAt: timestamp().notNull().defaultNow().onUpdateNow()
|
|
1525
|
+
*/
|
|
1465
1526
|
declare function timestamp(opts?: TimeOptions): TimestampBuilder;
|
|
1527
|
+
/**
|
|
1528
|
+
* A zone-aware instant (`timestamptz`; MySQL `TIMESTAMP`), typed `Date`. Stored
|
|
1529
|
+
* as UTC; the zone you wrote isn't kept. `{ precision: 3 }` keeps milliseconds.
|
|
1530
|
+
*
|
|
1531
|
+
* @example
|
|
1532
|
+
* createdAt: timestamptz().notNull().defaultNow()
|
|
1533
|
+
*/
|
|
1466
1534
|
declare function timestamptz(opts?: TimeOptions): TimestampBuilder;
|
|
1535
|
+
/** A calendar date without a time (`date`), typed `Date`. */
|
|
1467
1536
|
declare function date(): ColumnBuilder<Date>;
|
|
1537
|
+
/** A time of day (`time`), typed `string` (`'14:30:00'`). `{ precision: 3 }` keeps milliseconds. */
|
|
1468
1538
|
declare function time(opts?: TimeOptions): ColumnBuilder<string>;
|
|
1539
|
+
/**
|
|
1540
|
+
* A duration (`interval`, Postgres). Typed `string`, but node-postgres parses
|
|
1541
|
+
* it into an object (`{ days: 1, hours: 2 }`); select it as `::text` to get
|
|
1542
|
+
* the string (`'1 day 02:00:00'`).
|
|
1543
|
+
*/
|
|
1469
1544
|
declare function interval(): ColumnBuilder<string>;
|
|
1470
1545
|
/**
|
|
1471
1546
|
* Subtype builder so `defaultRandom()` can mark the resulting column as
|
|
@@ -1476,8 +1551,16 @@ declare function interval(): ColumnBuilder<string>;
|
|
|
1476
1551
|
*/
|
|
1477
1552
|
declare class UuidBuilder extends ColumnBuilder<string> {
|
|
1478
1553
|
constructor();
|
|
1554
|
+
/** Default to a random UUID the database generates; optional on insert. */
|
|
1479
1555
|
defaultRandom(): this & GeneratedBrand;
|
|
1480
1556
|
}
|
|
1557
|
+
/**
|
|
1558
|
+
* A UUID (`uuid`; MySQL `CHAR(36)`, SQLite `TEXT`), typed `string`.
|
|
1559
|
+
* `.defaultRandom()` lets the database generate one.
|
|
1560
|
+
*
|
|
1561
|
+
* @example
|
|
1562
|
+
* id: uuid().primaryKey().defaultRandom()
|
|
1563
|
+
*/
|
|
1481
1564
|
declare function uuid(): UuidBuilder;
|
|
1482
1565
|
/**
|
|
1483
1566
|
* The `T` generic exists so adopters can declare their JSON shape:
|
|
@@ -1488,7 +1571,15 @@ declare function uuid(): UuidBuilder;
|
|
|
1488
1571
|
* row type narrows to `{ tags: string[] } | null`.
|
|
1489
1572
|
*/
|
|
1490
1573
|
declare function json<T = unknown>(): ColumnBuilder<T>;
|
|
1574
|
+
/**
|
|
1575
|
+
* Binary JSON (`jsonb`; `JSON` on MySQL, `TEXT` on SQLite), typed `T`.
|
|
1576
|
+
* Name the shape with the generic.
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* meta: jsonb<{ tags: string[] }>().notNull().default({ tags: [] })
|
|
1580
|
+
*/
|
|
1491
1581
|
declare function jsonb<T = unknown>(): ColumnBuilder<T>;
|
|
1582
|
+
/** Raw bytes (`bytea`; `BLOB` on MySQL and SQLite), typed `Uint8Array`. */
|
|
1492
1583
|
declare function bytea(): ColumnBuilder<Uint8Array>;
|
|
1493
1584
|
//#endregion
|
|
1494
1585
|
//#region src/dsl/view.d.ts
|
|
@@ -1534,7 +1625,25 @@ declare function view<TName extends string, C extends Record<string, ColumnBuild
|
|
|
1534
1625
|
declare function isView(value: unknown): value is ViewDecl;
|
|
1535
1626
|
//#endregion
|
|
1536
1627
|
//#region src/dsl/self-ref.d.ts
|
|
1537
|
-
|
|
1628
|
+
/**
|
|
1629
|
+
* A foreign key to a column of the table being declared. The table binds it
|
|
1630
|
+
* to its own column once it exists; a name that isn't a column fails there.
|
|
1631
|
+
*
|
|
1632
|
+
* Writing `() => categories.id` instead makes the const's type depend on its
|
|
1633
|
+
* own initializer, which TypeScript rejects (TS7022) unless the thunk is
|
|
1634
|
+
* annotated `(): ColumnRef => categories.id`. Tables that point at each other
|
|
1635
|
+
* use `link()`.
|
|
1636
|
+
*
|
|
1637
|
+
* Inside `fk()` the compiler checks it too: the column exists and holds the
|
|
1638
|
+
* same type. `.references(selfRef(...))` is checked only at runtime.
|
|
1639
|
+
*
|
|
1640
|
+
* @example
|
|
1641
|
+
* const categories = table('categories', {
|
|
1642
|
+
* id: uuid().primaryKey().defaultRandom(),
|
|
1643
|
+
* parentId: fk(uuid(), selfRef('id'), { onDelete: 'set_null' }),
|
|
1644
|
+
* })
|
|
1645
|
+
*/
|
|
1646
|
+
declare function selfRef<const K extends string>(column: K): SelfRef<K>;
|
|
1538
1647
|
//#endregion
|
|
1539
1648
|
//#region src/dsl/table-forms.d.ts
|
|
1540
1649
|
type ColumnsRecord = Record<string, ColumnBuilder>;
|
|
@@ -1585,7 +1694,7 @@ type RowOf<C extends ColumnsRecord> = { [K in keyof C]: C[K] extends ColumnBuild
|
|
|
1585
1694
|
* the table, and exporting the class is enough for `kick db generate` and
|
|
1586
1695
|
* `createDbClient({ schema })`.
|
|
1587
1696
|
*/
|
|
1588
|
-
declare function TableBase<const N extends string, C extends ColumnsRecord, const S extends string | undefined = undefined>(name: N, columns: C
|
|
1697
|
+
declare function TableBase<const N extends string, C extends ColumnsRecord, const S extends string | undefined = undefined>(name: N, columns: C & CheckSelfRefs<C>, options?: {
|
|
1589
1698
|
schema?: S;
|
|
1590
1699
|
rules?: { [K in keyof C]?: RuleFor<C[K]>; };
|
|
1591
1700
|
indexes?: (refs: TypedColumnRefs<C>) => Record<string, TableConstraint>;
|
|
@@ -1634,7 +1743,11 @@ declare function defineTable<const N extends string, const S extends string | un
|
|
|
1634
1743
|
* A foreign key whose target must hold the same type:
|
|
1635
1744
|
* `authorId: fk(uuid().notNull(), () => users.id)` — a uuid column pointing
|
|
1636
1745
|
* at a serial key is a type error. Same as `.references()` at runtime.
|
|
1746
|
+
*
|
|
1747
|
+
* With `selfRef('id')`, `table()` checks that the column exists and holds the
|
|
1748
|
+
* same type: `parentId: fk(uuid(), selfRef('id'), { onDelete: 'set_null' })`.
|
|
1637
1749
|
*/
|
|
1750
|
+
declare function fk<const K extends string, B extends ColumnBuilder>(builder: B, target: SelfRef<K>, options?: Parameters<ColumnBuilder['references']>[1]): B & SelfRefTo<K>;
|
|
1638
1751
|
declare function fk<T, B extends ColumnBuilder<T>>(builder: B & ColumnBuilder<T>, target: () => TypedColumnRef<NoInfer<T>>, options?: Parameters<ColumnBuilder['references']>[1]): B;
|
|
1639
1752
|
/**
|
|
1640
1753
|
* Add a foreign key to a column after both tables exist — how two tables
|
|
@@ -1695,10 +1808,14 @@ declare const notLike: <L>(left: L, pattern: [L] extends [Ref] ? Operand<string>
|
|
|
1695
1808
|
declare const ilike: <L>(left: L, pattern: [L] extends [Ref] ? Operand<string> : Ref<string>) => Condition;
|
|
1696
1809
|
declare const isNull: (operand: Ref | ColumnRef) => Condition;
|
|
1697
1810
|
declare const isNotNull: (operand: Ref | ColumnRef) => Condition;
|
|
1698
|
-
/**
|
|
1699
|
-
|
|
1811
|
+
/**
|
|
1812
|
+
* `left IN (…)`. An empty list matches nothing, rather than being invalid SQL.
|
|
1813
|
+
* `L` is read from `left` only: inside `and()` / `or()` a `string[]` list would
|
|
1814
|
+
* otherwise win and reject the column (`TypedColumnRef<string>` vs `string`).
|
|
1815
|
+
*/
|
|
1816
|
+
declare function inArray<L>(left: L, values: AcrossList<NoInfer<L>>): Condition;
|
|
1700
1817
|
/** `left NOT IN (…)`. An empty list matches everything. */
|
|
1701
|
-
declare function notInArray<L>(left: L, values: AcrossList<L
|
|
1818
|
+
declare function notInArray<L>(left: L, values: AcrossList<NoInfer<L>>): Condition;
|
|
1702
1819
|
/** With a value on the left, `low` must be a column or an expression. */
|
|
1703
1820
|
declare const between: <L>(left: L, low: Across<L>, high: Comparable<L>) => Condition;
|
|
1704
1821
|
/**
|
|
@@ -2102,4 +2219,4 @@ declare function markDialect<T extends object>(dialect: T, tag: DialectTag): T;
|
|
|
2102
2219
|
declare function readDialectMark(dialect: object): DialectTag | undefined;
|
|
2103
2220
|
//#endregion
|
|
2104
2221
|
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 };
|
|
2105
|
-
//# sourceMappingURL=index-
|
|
2222
|
+
//# sourceMappingURL=index-C935uxe5.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-Bot_2VFH.d.mts","names":["Dialect","Dialect","Dialect","Dialect","Dialect","Dialect"],"sources":["../src/migrate/adapter.ts","../src/migrate/drift.ts","../src/cli/config.ts","../src/snapshot/casing.ts","../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/query/relations.ts","../src/client/wrap.ts","../src/db-errors.ts","../src/migrate/errors.ts","../src/migrate/enum-drop-gate.ts","../src/migrate/journal.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/code-migration.ts","../src/migrate/source.ts","../src/adapter.ts","../src/tokens.ts","../src/client/create.ts","../src/client/plugins.ts","../src/migrate/runner.ts","../src/migrate/tenants.ts","../src/migrate/review.ts","../src/migrate/push.ts","../src/emit/pg.ts","../src/emit/sqlite.ts","../src/emit/mysql.ts","../src/cli/generate.ts","../src/cli/check.ts","../src/cli/seed.ts","../src/seed/fake.ts","../src/dsl/columns/builders.ts","../src/dsl/view.ts","../src/dsl/self-ref.ts","../src/dsl/table-forms.ts","../src/dsl/alias.ts","../src/query/operators.ts","../src/dsl/relations.ts","../src/custom-type.ts","../src/query/schema-relations-types.ts","../src/query/errors.ts","../src/query/like.ts","../src/query/order.ts","../src/dialect-marker.ts"],"mappings":";;;;;;;;;;;UAGiB;EACf;EACA;EACA;EACA;EACA;EACA;;;;;;;;;UAUe;WACN,SAASA;;EAElB,yBAAyB;;EAEzB,eAAe,QAAQ;;EAEvB,cAAc,KAAK,KAAK,6BAA6B;;EAErD,cAAc,aAAa;;;;;;EAM3B,YAAY,eAAe,6BAA6B;;;;;;;EAOxD,aAAa,gBAAgB;;;;;;EAM7B,YAAY,iBAAiB;;EAE7B,aAAa,cAAc;;;;;;;;EAQ3B,oBAAoB,aAAa,aAAa,8BAA8B;;EAE5E,aAAa,cAAc;;EAE3B,cAAc,QAAQ;;;;;;EAMtB,WA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iB,SAAS;;iBAKvC,YAAY,kBAAkB,SAAS,GAAG,KAAK,aAAa;;;;;;;iBAgB5D,gBAAgB,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"index-C935uxe5.d.mts","names":["Dialect","Dialect","Dialect","Dialect","Dialect","Dialect"],"sources":["../src/migrate/adapter.ts","../src/migrate/drift.ts","../src/cli/config.ts","../src/snapshot/casing.ts","../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/query/relations.ts","../src/client/wrap.ts","../src/db-errors.ts","../src/migrate/errors.ts","../src/migrate/enum-drop-gate.ts","../src/migrate/journal.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/code-migration.ts","../src/migrate/source.ts","../src/adapter.ts","../src/tokens.ts","../src/client/create.ts","../src/client/plugins.ts","../src/migrate/runner.ts","../src/migrate/tenants.ts","../src/migrate/review.ts","../src/migrate/push.ts","../src/emit/pg.ts","../src/emit/sqlite.ts","../src/emit/mysql.ts","../src/cli/generate.ts","../src/cli/check.ts","../src/cli/seed.ts","../src/seed/fake.ts","../src/dsl/columns/builders.ts","../src/dsl/view.ts","../src/dsl/self-ref.ts","../src/dsl/table-forms.ts","../src/dsl/alias.ts","../src/query/operators.ts","../src/dsl/relations.ts","../src/custom-type.ts","../src/query/schema-relations-types.ts","../src/query/errors.ts","../src/query/like.ts","../src/query/order.ts","../src/dialect-marker.ts"],"mappings":";;;;;;;;;;;UAGiB;EACf;EACA;EACA;EACA;EACA;EACA;;;;;;;;;UAUe;WACN,SAASA;;EAElB,yBAAyB;;EAEzB,eAAe,QAAQ;;EAEvB,cAAc,KAAK,KAAK,6BAA6B;;EAErD,cAAc,aAAa;;;;;;EAM3B,YAAY,eAAe,6BAA6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,kDAAkD;WACpD;WACA;WACA;;WAEA;EACT,YACE,qBACA,qBACA,sBACA;;;;;;;;;cAwBS,2CAA2C;WAC7C;WACA;WACA;EACT,YAAY,qBAAqB,sBAAsB;;;;;;;cAsB5C,oCAAoC;WACtC;WACA;WACA;EACT,YAAY,qBAAqB,sBAAsB,kBAAkB;;;;;;;;;;;;;;;;;;;KC1K/D;;;;;;;;;;iBAWI,WAAW,eAAe;;;;;;;;;;;;iBA4B1B,YACd,eACA,OAAM,eACN;;;;;;;;;;;iBChDc,KAAK,GAAG,YAAY,WAAW,KAAK,WAAW;;iBAK/C,IAAI,GAAG,YAAY,WAAW,KAAK,WAAW;;;;;;;;;;;;;;;;;;;;cCQjD;KAED;;iBAKI,aAAa,iBAAiB,SAAS;;iBAKvC,YAAY,kBAAkB,SAAS,GAAG,KAAK,aAAa;;;;;;;iBAgB5D,gBAAgB,kBAAkB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { C as
|
|
3
|
-
import { $ as inArray, $i as checkDrift, $n as CodeMigration, $r as detectCompositeReferences, $t as time, A as RelationalQueryUnknownRelationError, Ai as DropPolicy, An as TenantMigrationResult, Ar as MigrationError, At as buildView, B as RelationMorphTo, Bi as renderSchemaSource, Bn as migrateStatus, Br as DbDialect, Bt as date, C as RelationalQueryAliasCollisionError, Ci as CreateTable, Cn as PushOptions, Cr as readJournal, Ct as link, D as RelationalQueryMissingInverseError, Di as DropEnum, Dn as reviewMigration, Dr as parseEnumDropHeader, Dt as ViewDecl, E as RelationalQueryDepthError, Ei as DropColumn, En as ReviewResult, Er as enforceEnumDropGate, Et as MaterializedViewOptions, F as MorphSpec, Fi as RenameColumn, Fn as RunnerOptions, Fr as UnreviewedMigrationError, Ft as bigSerial, G as Operand, Gi as toKeyName, Gn as DB_PRIMARY, Gr as UniqueViolationError, Gt as json, H as RelationsDecl, Hi as extractSnapshot, Hn as safeNullComparison, Hr as ForeignKeyViolationError, Ht as doublePrecision, I as MorphToSpec, Ii as RenameTable, In as StatusEntry, Ir as CheckViolationError, It as bigint, J as eq, Jn as MigrationsOnBoot, Jr as ResolvedRelation, Jt as real, K as and, Ki as DbConfig, Kn as DB_REPLICA, Kr as translateDbError, Kt as jsonb, L as Relation, Li as SetColumnComment, Ln as migrateDown, Lr as ConnectionError, Lt as boolean, M as CustomColumnBuilder, Mi as DropView, Mn as AppliedSummary, Mr as MigrationHashError, Mt as view, N as CustomTypeOptions, Ni as PrimaryKeyShape, Nn as ReversedSummary, Nr as MigrationLockError, Nt as TimestampBuilder, O as RelationalQueryNotSupportedError, Oi as DropForeignKey, On as MigrateTenantsOptions, Or as MigrationDriftError, Ot as ViewMarks, P as customType, Pi as RemoveEnumValue, Pn as RollbackSummary, Pr as SchemaDiffSummary, Pt as UuidBuilder, Q as ilike, Qi as DriftLogger, Qn as migrationFiles, Qr as CompositeRef, Qt as text, R as RelationMany, Ri as SetRowLevelSecurity, Rn as migrateLatest, Rr as DatabaseError, Rt as bytea, S as likePattern, Si as CreateSchema, Sn as emitPg, Sr as computeMigrationHash, St as fk, T as RelationalQueryCancelledError, Ti as DropCheck, Tn as pushSchema, Tr as EnumDropHeader, Tt as selfRef, U as ThroughSpec, Ui as Casing, Un as createDbClient, Ur as NotNullViolationError, Ut as integer, V as RelationOne, Vi as fitIdentifier, Vn as migrateUp, Vr as DeadlockError, Vt as decimal, W as relations, Wi as toDbName, Wn as DB_CLIENT, Wr as SerializationFailureError, Wt as interval, X as gt, Xi as DriftBehavior, Xn as MigrationFiles, Xr as CompositeEnumReferenceError, Xt as smallSerial, Y as exists, Yi as resolveDbConfig, Yn as kickDbAdapter, Yr as ResolvedRelations, Yt as serial, Z as gte, Zi as DriftIgnore, Zn as MigrationsLocation, Zr as CompositeQueryRunner, Zt as smallint, _ as readDialectMark, _i as Change, _n as GenerateResult, _r as pushTableName, _t as StringRule, a as KyselyPlugin, ai as RenameCandidates, an as FakeContext, ar as SqliteIntrospectDb, at as ne, b as LikeMatchMode, bi as CreatePolicy, bn as SqliteRebuildRequiredError, br as JournalEntry, bt as TableDefinition, c as Selectable, ci as findRenameCandidates, cn as SeedFakeOptions, cr as introspectPg, ct as notInArray, d as Updateable, di as AddEnumValue, dn as SeedResult, dr as MemoryMigrationAdapter, dt as AliasedTable, ea as MigrationAdapter, ei as KickDbError, en as timestamp, er as MigrationDb, et as isNotNull, f as sql, fi as AddForeignKey, fn as listSeeds, fr as KICK_LOCK_TABLE, ft as alias, g as markDialect, gi as AlterRole, gn as GenerateOptions, gr as migrationsTableDdl, gt as RuleFor, h as isDialectTag, hi as AlterPrimaryKey, hn as checkMigrations, hr as lockTableName, ht as Rule, i as Kysely, ii as DiffOptions, in as version, ir as IntrospectSqliteOptions, it as lte, j as SchemaToRelationsRegister, ji as DropTable, jn as migrateTenants, jr as MigrationFailedError, jt as isView, k as RelationalQueryThroughError, ki as DropIndex, kn as MigrateTenantsResult, kr as MigrationEnumDropError, kt as ViewOptions, l as Sql, li as AddCheck, ln as fakeRows, lr as IntrospectPgOptions, lt as notLike, m as KICK_DIALECT, mi as AlterColumn, mn as CheckResult, mr as lockTableDdl, mt as NumberRule, n as ExpressionBuilder, na as MigrationRow, ni as hasAmbiguousReverse, nn as uuid, nr as MysqlIntrospectDb, nt as like, o as RawBuilder, oi as RenameHints, on as FakeOverride, or as introspectSqlite, ot as not, p as DialectTag, pi as AddIndex, pn as runSeeds, pr as KICK_MIGRATIONS_TABLE, pt as ClassRefs, q as between, qn as KickDbAdapterConfig, qr as TransactionFinishedError, qt as numeric, r as Insertable, ri as invertChanges, rn as varchar, rr as introspectMysql, rt as lt, s as ReadonlyKysely, si as diff, sn as FakeRowsOptions, sr as introspectSqliteAsync, st as notExists, t as Expression, ta as MigrationBookkeeping, ti as RemovedValueAsDefaultError, tn as timestamptz, tr as IntrospectMysqlOptions, tt as isNull, u as SqlBool, ui as AddColumn, un as seedFake, ur as PgQueryRunner, ut as or, v as asc, vi as ChangeSet, vn as generate, vr as quoteTable, vt as TableBase, w as RelationalQueryAmbiguousRelationNameError, wi as CreateView, wn as PushResult, wr as verifyMigrationHash, wt as tableFromClass, x as escapeLike, xi as CreateRole, xn as emitSqlite, xr as appendJournalEntry, xt as defineTable, y as desc, yi as CreateEnum, yn as emitMysql, yr as Journal, yt as TableClass, z as RelationMorphOne, zi as SetTableComment, zn as migrateRollback, zr as DatabaseErrorInfo, zt as char } from "./index-
|
|
4
|
-
import { A as TenancyStrategy, C as WithClause, D as BypassOptions, E as BypassInfo, F as ExtensionDefinition, I as ModelExtensions, L as FindOrCreateOptions, M as defineTenancy, N as tenantKey, O as Tenancy, P as ExtendedClient, R as UpsertOptions, S as TableRelations, T as RegisteredDB, _ as KickDbRelationsRegister, a as ManualTransaction, b as RelationMapEntry, c as ReadRoute, d as TransactionEvent, f as TransactionOptions, g as FindManyRow, h as FindManyOptions, i as KickDbClientEvents, j as TenantRequiredError, k as TenancyOptions, l as ReadRouter, m as TransactionRollbackEvent, n as CreateDbClientOptions, o as QueryErrorEvent, p as TransactionRetryEvent, r as KickDbClient, s as QueryEvent, t as BeforeQueryEvent, v as QueryNamespace, w as KickDbRegister, x as TableQueryNamespace, y as RegisteredRelations, z as InsertManyOptions } from "./types-
|
|
5
|
-
import { a as qualifiedTableName, c as CheckDecl, d as PrimaryKeyDecl, f as TableConstraint, g as unique, h as primaryKey, i as buildTable, l as IndexDecl, m as index, n as TableDecl, o as table, p as check, r as TableOptions, s as unwrapTable, t as QualifiedName, u as IndexKey } from "./table-
|
|
6
|
-
import { t as SchemaToTypes } from "./schema-types-
|
|
2
|
+
import { C as RelationSnapshot, E as TableSnapshot, T as SchemaSnapshot, _ as Dialect, a as FkSpec, b as ForeignKeySnapshot, c as KICK_GENERATED, g as ColumnSnapshot, h as CheckSnapshot, i as ColumnState, l as KICK_NOT_NULL, m as TypedColumnRefs, n as ColumnBuilder, p as TypedColumnRef, r as ColumnRef, s as GeneratedBrand, u as NotNullBrand, v as EnumSnapshot, x as IndexSnapshot, y as FkAction } from "./types-DB_xyeQT.mjs";
|
|
3
|
+
import { $ as inArray, $i as checkDrift, $n as CodeMigration, $r as detectCompositeReferences, $t as time, A as RelationalQueryUnknownRelationError, Ai as DropPolicy, An as TenantMigrationResult, Ar as MigrationError, At as buildView, B as RelationMorphTo, Bi as renderSchemaSource, Bn as migrateStatus, Br as DbDialect, Bt as date, C as RelationalQueryAliasCollisionError, Ci as CreateTable, Cn as PushOptions, Cr as readJournal, Ct as link, D as RelationalQueryMissingInverseError, Di as DropEnum, Dn as reviewMigration, Dr as parseEnumDropHeader, Dt as ViewDecl, E as RelationalQueryDepthError, Ei as DropColumn, En as ReviewResult, Er as enforceEnumDropGate, Et as MaterializedViewOptions, F as MorphSpec, Fi as RenameColumn, Fn as RunnerOptions, Fr as UnreviewedMigrationError, Ft as bigSerial, G as Operand, Gi as toKeyName, Gn as DB_PRIMARY, Gr as UniqueViolationError, Gt as json, H as RelationsDecl, Hi as extractSnapshot, Hn as safeNullComparison, Hr as ForeignKeyViolationError, Ht as doublePrecision, I as MorphToSpec, Ii as RenameTable, In as StatusEntry, Ir as CheckViolationError, It as bigint, J as eq, Jn as MigrationsOnBoot, Jr as ResolvedRelation, Jt as real, K as and, Ki as DbConfig, Kn as DB_REPLICA, Kr as translateDbError, Kt as jsonb, L as Relation, Li as SetColumnComment, Ln as migrateDown, Lr as ConnectionError, Lt as boolean, M as CustomColumnBuilder, Mi as DropView, Mn as AppliedSummary, Mr as MigrationHashError, Mt as view, N as CustomTypeOptions, Ni as PrimaryKeyShape, Nn as ReversedSummary, Nr as MigrationLockError, Nt as TimestampBuilder, O as RelationalQueryNotSupportedError, Oi as DropForeignKey, On as MigrateTenantsOptions, Or as MigrationDriftError, Ot as ViewMarks, P as customType, Pi as RemoveEnumValue, Pn as RollbackSummary, Pr as SchemaDiffSummary, Pt as UuidBuilder, Q as ilike, Qi as DriftLogger, Qn as migrationFiles, Qr as CompositeRef, Qt as text, R as RelationMany, Ri as SetRowLevelSecurity, Rn as migrateLatest, Rr as DatabaseError, Rt as bytea, S as likePattern, Si as CreateSchema, Sn as emitPg, Sr as computeMigrationHash, St as fk, T as RelationalQueryCancelledError, Ti as DropCheck, Tn as pushSchema, Tr as EnumDropHeader, Tt as selfRef, U as ThroughSpec, Ui as Casing, Un as createDbClient, Ur as NotNullViolationError, Ut as integer, V as RelationOne, Vi as fitIdentifier, Vn as migrateUp, Vr as DeadlockError, Vt as decimal, W as relations, Wi as toDbName, Wn as DB_CLIENT, Wr as SerializationFailureError, Wt as interval, X as gt, Xi as DriftBehavior, Xn as MigrationFiles, Xr as CompositeEnumReferenceError, Xt as smallSerial, Y as exists, Yi as resolveDbConfig, Yn as kickDbAdapter, Yr as ResolvedRelations, Yt as serial, Z as gte, Zi as DriftIgnore, Zn as MigrationsLocation, Zr as CompositeQueryRunner, Zt as smallint, _ as readDialectMark, _i as Change, _n as GenerateResult, _r as pushTableName, _t as StringRule, a as KyselyPlugin, ai as RenameCandidates, an as FakeContext, ar as SqliteIntrospectDb, at as ne, b as LikeMatchMode, bi as CreatePolicy, bn as SqliteRebuildRequiredError, br as JournalEntry, bt as TableDefinition, c as Selectable, ci as findRenameCandidates, cn as SeedFakeOptions, cr as introspectPg, ct as notInArray, d as Updateable, di as AddEnumValue, dn as SeedResult, dr as MemoryMigrationAdapter, dt as AliasedTable, ea as MigrationAdapter, ei as KickDbError, en as timestamp, er as MigrationDb, et as isNotNull, f as sql, fi as AddForeignKey, fn as listSeeds, fr as KICK_LOCK_TABLE, ft as alias, g as markDialect, gi as AlterRole, gn as GenerateOptions, gr as migrationsTableDdl, gt as RuleFor, h as isDialectTag, hi as AlterPrimaryKey, hn as checkMigrations, hr as lockTableName, ht as Rule, i as Kysely, ii as DiffOptions, in as version, ir as IntrospectSqliteOptions, it as lte, j as SchemaToRelationsRegister, ji as DropTable, jn as migrateTenants, jr as MigrationFailedError, jt as isView, k as RelationalQueryThroughError, ki as DropIndex, kn as MigrateTenantsResult, kr as MigrationEnumDropError, kt as ViewOptions, l as Sql, li as AddCheck, ln as fakeRows, lr as IntrospectPgOptions, lt as notLike, m as KICK_DIALECT, mi as AlterColumn, mn as CheckResult, mr as lockTableDdl, mt as NumberRule, n as ExpressionBuilder, na as MigrationRow, ni as hasAmbiguousReverse, nn as uuid, nr as MysqlIntrospectDb, nt as like, o as RawBuilder, oi as RenameHints, on as FakeOverride, or as introspectSqlite, ot as not, p as DialectTag, pi as AddIndex, pn as runSeeds, pr as KICK_MIGRATIONS_TABLE, pt as ClassRefs, q as between, qn as KickDbAdapterConfig, qr as TransactionFinishedError, qt as numeric, r as Insertable, ri as invertChanges, rn as varchar, rr as introspectMysql, rt as lt, s as ReadonlyKysely, si as diff, sn as FakeRowsOptions, sr as introspectSqliteAsync, st as notExists, t as Expression, ta as MigrationBookkeeping, ti as RemovedValueAsDefaultError, tn as timestamptz, tr as IntrospectMysqlOptions, tt as isNull, u as SqlBool, ui as AddColumn, un as seedFake, ur as PgQueryRunner, ut as or, v as asc, vi as ChangeSet, vn as generate, vr as quoteTable, vt as TableBase, w as RelationalQueryAmbiguousRelationNameError, wi as CreateView, wn as PushResult, wr as verifyMigrationHash, wt as tableFromClass, x as escapeLike, xi as CreateRole, xn as emitSqlite, xr as appendJournalEntry, xt as defineTable, y as desc, yi as CreateEnum, yn as emitMysql, yr as Journal, yt as TableClass, z as RelationMorphOne, zi as SetTableComment, zn as migrateRollback, zr as DatabaseErrorInfo, zt as char } from "./index-C935uxe5.mjs";
|
|
4
|
+
import { A as TenancyStrategy, C as WithClause, D as BypassOptions, E as BypassInfo, F as ExtensionDefinition, I as ModelExtensions, L as FindOrCreateOptions, M as defineTenancy, N as tenantKey, O as Tenancy, P as ExtendedClient, R as UpsertOptions, S as TableRelations, T as RegisteredDB, _ as KickDbRelationsRegister, a as ManualTransaction, b as RelationMapEntry, c as ReadRoute, d as TransactionEvent, f as TransactionOptions, g as FindManyRow, h as FindManyOptions, i as KickDbClientEvents, j as TenantRequiredError, k as TenancyOptions, l as ReadRouter, m as TransactionRollbackEvent, n as CreateDbClientOptions, o as QueryErrorEvent, p as TransactionRetryEvent, r as KickDbClient, s as QueryEvent, t as BeforeQueryEvent, v as QueryNamespace, w as KickDbRegister, x as TableQueryNamespace, y as RegisteredRelations, z as InsertManyOptions } from "./types-8xZUYm43.mjs";
|
|
5
|
+
import { a as qualifiedTableName, c as CheckDecl, d as PrimaryKeyDecl, f as TableConstraint, g as unique, h as primaryKey, i as buildTable, l as IndexDecl, m as index, n as TableDecl, o as table, p as check, r as TableOptions, s as unwrapTable, t as QualifiedName, u as IndexKey } from "./table-BGk08X3C.mjs";
|
|
6
|
+
import { t as SchemaToTypes } from "./schema-types-CdU4u-Ow.mjs";
|
|
7
7
|
export { type AddCheck, type AddColumn, type AddEnumValue, type AddForeignKey, type AddIndex, type AliasedTable, type AlterColumn, type AlterPrimaryKey, type AlterRole, type AppliedSummary, type BeforeQueryEvent, BypassInfo, BypassOptions, type Casing, type Change, type ChangeSet, CheckDecl, type CheckResult, type CheckSnapshot, CheckViolationError, type ClassRefs, type CodeMigration, ColumnBuilder, type ColumnRef, type ColumnSnapshot, type ColumnState, CompositeEnumReferenceError, type CompositeQueryRunner, type CompositeRef, ConnectionError, type CreateDbClientOptions, type CreateEnum, type CreatePolicy, type CreateRole, type CreateSchema, type CreateTable, type CreateView, CustomColumnBuilder, type CustomTypeOptions, DB_CLIENT, DB_PRIMARY, DB_REPLICA, DatabaseError, type DatabaseErrorInfo, type DbConfig, type DbDialect, DeadlockError, type Dialect, type DialectTag, type DiffOptions, type DriftBehavior, type DriftIgnore, type DriftLogger, type DropCheck, type DropColumn, type DropEnum, type DropForeignKey, type DropIndex, type DropPolicy, type DropTable, type DropView, type EnumDropHeader, type EnumSnapshot, type Expression, type ExpressionBuilder, type ExtendedClient, type ExtensionDefinition, type FakeContext, type FakeOverride, type FakeRowsOptions, type FindManyOptions, type FindManyRow, type FindOrCreateOptions, type FkAction, type FkSpec, type ForeignKeySnapshot, ForeignKeyViolationError, type GenerateOptions, type GenerateResult, type GeneratedBrand, IndexDecl, IndexKey, type IndexSnapshot, type InsertManyOptions, type Insertable, 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, Kysely, type KyselyPlugin, type LikeMatchMode, type ManualTransaction, MaterializedViewOptions, MemoryMigrationAdapter, type MigrateTenantsOptions, type MigrateTenantsResult, type MigrationAdapter, type MigrationBookkeeping, type MigrationDb, MigrationDriftError, MigrationEnumDropError, MigrationError, MigrationFailedError, type MigrationFiles, MigrationHashError, MigrationLockError, type MigrationRow, type MigrationsLocation, type MigrationsOnBoot, type ModelExtensions, MorphSpec, MorphToSpec, type MysqlIntrospectDb, type NotNullBrand, NotNullViolationError, type NumberRule, Operand, type PgQueryRunner, PrimaryKeyDecl, type PrimaryKeyShape, type PushOptions, type PushResult, QualifiedName, type QueryErrorEvent, type QueryEvent, type QueryNamespace, type RawBuilder, type ReadRoute, type ReadRouter, type ReadonlyKysely, type RegisteredDB, type RegisteredRelations, Relation, RelationMany, type RelationMapEntry, RelationMorphOne, RelationMorphTo, RelationOne, type RelationSnapshot, RelationalQueryAliasCollisionError, RelationalQueryAmbiguousRelationNameError, RelationalQueryCancelledError, RelationalQueryDepthError, RelationalQueryMissingInverseError, RelationalQueryNotSupportedError, RelationalQueryThroughError, RelationalQueryUnknownRelationError, RelationsDecl, type RemoveEnumValue, RemovedValueAsDefaultError, type RenameCandidates, type RenameColumn, type RenameHints, type RenameTable, type ResolvedRelation, type ResolvedRelations, type ReversedSummary, type ReviewResult, type RollbackSummary, Rule, type RuleFor, type RunnerOptions, type SchemaDiffSummary, type SchemaSnapshot, type SchemaToRelationsRegister, type SchemaToTypes, type SeedFakeOptions, type SeedResult, type Selectable, SerializationFailureError, type SetColumnComment, type SetRowLevelSecurity, type SetTableComment, type Sql, type SqlBool, type SqliteIntrospectDb, SqliteRebuildRequiredError, type StatusEntry, type StringRule, TableBase, type TableClass, TableConstraint, TableDecl, TableDefinition, TableOptions, type TableQueryNamespace, type TableRelations, type TableSnapshot, Tenancy, TenancyOptions, TenancyStrategy, type TenantMigrationResult, TenantRequiredError, ThroughSpec, TimestampBuilder, type TransactionEvent, TransactionFinishedError, type TransactionOptions, type TransactionRetryEvent, type TransactionRollbackEvent, type TypedColumnRef, type TypedColumnRefs, UniqueViolationError, UnreviewedMigrationError, type Updateable, type UpsertOptions, UuidBuilder, ViewDecl, ViewMarks, ViewOptions, type WithClause, alias, and, appendJournalEntry, asc, between, bigSerial, bigint, boolean, buildTable, buildView, bytea, char, check, checkDrift, checkMigrations, computeMigrationHash, createDbClient, customType, date, decimal, defineTable, defineTenancy, desc, detectCompositeReferences, diff, doublePrecision, emitMysql, emitPg, emitSqlite, enforceEnumDropGate, eq, escapeLike, exists, extractSnapshot, fakeRows, findRenameCandidates, fitIdentifier, fk, generate, gt, gte, hasAmbiguousReverse, ilike, inArray, index, integer, interval, introspectMysql, introspectPg, introspectSqlite, introspectSqliteAsync, invertChanges, isDialectTag, isNotNull, isNull, isView, json, jsonb, kickDbAdapter, like, likePattern, link, listSeeds, lockTableDdl, lockTableName, lt, lte, markDialect, migrateDown, migrateLatest, migrateRollback, migrateStatus, migrateTenants, migrateUp, migrationFiles, migrationsTableDdl, ne, not, notExists, notInArray, notLike, numeric, or, parseEnumDropHeader, primaryKey, pushSchema, pushTableName, qualifiedTableName, quoteTable, readDialectMark, readJournal, real, relations, renderSchemaSource, resolveDbConfig, reviewMigration, runSeeds, safeNullComparison, seedFake, selfRef, serial, smallSerial, smallint, sql, table, tableFromClass, tenantKey, text, time, timestamp, timestamptz, toDbName, toKeyName, translateDbError, unique, unwrapTable, uuid, varchar, verifyMigrationHash, version, view };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-db v8.
|
|
2
|
+
* @forinda/kickjs-db v8.12.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{B as CheckViolationError,C as readJournal,Ct as unwrapTable,D as parseEnumDropHeader,Dt as fitIdentifier,E as enforceEnumDropGate,F as MigrationHashError,G as NotNullViolationError,H as DatabaseError,I as MigrationLockError,J as translateDbError,K as SerializationFailureError,L as UnreviewedMigrationError,M as MigrationEnumDropError,N as MigrationError,O as emitPg,P as MigrationFailedError,Q as extractSnapshot,R as TransactionFinishedError,S as computeMigrationHash,St as table,U as DeadlockError,V as ConnectionError,W as ForeignKeyViolationError,X as findRenameCandidates,Y as diff,_ as emitMysql,_t as buildView,a as markDialect,at as RelationalQueryDepthError,b as introspectPg,bt as buildTable,c as defineTenancy,ct as RelationalQueryThroughError,d as migrateLatest,dt as RemovedValueAsDefaultError,et as toDbName,f as migrateRollback,g as checkDrift,h as migrationFiles,i as isDialectTag,it as RelationalQueryCancelledError,j as MigrationDriftError,l as tenantKey,lt as RelationalQueryUnknownRelationError,m as migrateUp,n as KICK_DIALECT,nt as RelationalQueryAliasCollisionError,o as readDialectMark,ot as RelationalQueryMissingInverseError,p as migrateStatus,q as UniqueViolationError,rt as RelationalQueryAmbiguousRelationNameError,s as TenantRequiredError,st as RelationalQueryNotSupportedError,t as createDbClient,tt as toKeyName,u as migrateDown,ut as KickDbError,v as SqliteRebuildRequiredError,vt as isView,w as verifyMigrationHash,wt as selfRef,x as appendJournalEntry,xt as qualifiedTableName,y as emitSqlite,yt as view}from"./create-
|
|
11
|
+
import{B as CheckViolationError,C as readJournal,Ct as unwrapTable,D as parseEnumDropHeader,Dt as fitIdentifier,E as enforceEnumDropGate,F as MigrationHashError,G as NotNullViolationError,H as DatabaseError,I as MigrationLockError,J as translateDbError,K as SerializationFailureError,L as UnreviewedMigrationError,M as MigrationEnumDropError,N as MigrationError,O as emitPg,P as MigrationFailedError,Q as extractSnapshot,R as TransactionFinishedError,S as computeMigrationHash,St as table,U as DeadlockError,V as ConnectionError,W as ForeignKeyViolationError,X as findRenameCandidates,Y as diff,_ as emitMysql,_t as buildView,a as markDialect,at as RelationalQueryDepthError,b as introspectPg,bt as buildTable,c as defineTenancy,ct as RelationalQueryThroughError,d as migrateLatest,dt as RemovedValueAsDefaultError,et as toDbName,f as migrateRollback,g as checkDrift,h as migrationFiles,i as isDialectTag,it as RelationalQueryCancelledError,j as MigrationDriftError,l as tenantKey,lt as RelationalQueryUnknownRelationError,m as migrateUp,n as KICK_DIALECT,nt as RelationalQueryAliasCollisionError,o as readDialectMark,ot as RelationalQueryMissingInverseError,p as migrateStatus,q as UniqueViolationError,rt as RelationalQueryAmbiguousRelationNameError,s as TenantRequiredError,st as RelationalQueryNotSupportedError,t as createDbClient,tt as toKeyName,u as migrateDown,ut as KickDbError,v as SqliteRebuildRequiredError,vt as isView,w as verifyMigrationHash,wt as selfRef,x as appendJournalEntry,xt as qualifiedTableName,y as emitSqlite,yt as view}from"./create-BUNHS2XX.mjs";import{$ as interval,A as index,At as introspectSqlite,Bt as CompositeEnumReferenceError,C as notExists,Ct as migrateTenants,D as alias,Dt as DB_REPLICA,E as or,Et as DB_PRIMARY,F as TableDefinition,Ft as lockTableDdl,G as bigint,H as TimestampBuilder,Ht as hasAmbiguousReverse,I as defineTable,It as lockTableName,J as char,K as boolean,L as fk,Lt as migrationsTableDdl,M as unique,Mt as MemoryMigrationAdapter,N as Rule,Nt as KICK_LOCK_TABLE,O as IndexDecl,Ot as kickDbAdapter,P as TableBase,Pt as KICK_MIGRATIONS_TABLE,Q as integer,R as link,Rt as pushTableName,S as not,St as reviewMigration,T as notLike,Tt as DB_CLIENT,U as UuidBuilder,Ut as invertChanges,Vt as detectCompositeReferences,W as bigSerial,Wt as renderSchemaSource,X as decimal,Y as date,Z as doublePrecision,_ as isNull,_t as runSeeds,a as escapeLike,at as smallSerial,b as lte,bt as pushSchema,c as and,ct as time,d as exists,dt as uuid,et as json,f as gt,ft as varchar,g as isNotNull,gt as listSeeds,h as inArray,ht as seedFake,i as desc,it as serial,j as primaryKey,jt as introspectSqliteAsync,k as check,kt as introspectMysql,l as between,lt as timestamp,m as ilike,mt as fakeRows,n as sql,nt as numeric,o as likePattern,ot as smallint,p as gte,pt as version,q as bytea,r as asc,rt as real,s as relations,st as text,t as Kysely,tt as jsonb,u as eq,ut as timestamptz,v as like,vt as checkMigrations,w as notInArray,wt as safeNullComparison,x as ne,xt as generate,y as lt,yt as resolveDbConfig,z as tableFromClass,zt as quoteTable}from"./src-Ivi-0lCB.mjs";import{a as KICK_NOT_NULL,i as KICK_GENERATED,n as customType,r as ColumnBuilder,t as CustomColumnBuilder}from"./custom-type-B6DrtO46.mjs";export{CheckViolationError,ColumnBuilder,CompositeEnumReferenceError,ConnectionError,CustomColumnBuilder,DB_CLIENT,DB_PRIMARY,DB_REPLICA,DatabaseError,DeadlockError,ForeignKeyViolationError,IndexDecl,KICK_DIALECT,KICK_GENERATED,KICK_LOCK_TABLE,KICK_MIGRATIONS_TABLE,KICK_NOT_NULL,KickDbError,Kysely,MemoryMigrationAdapter,MigrationDriftError,MigrationEnumDropError,MigrationError,MigrationFailedError,MigrationHashError,MigrationLockError,NotNullViolationError,RelationalQueryAliasCollisionError,RelationalQueryAmbiguousRelationNameError,RelationalQueryCancelledError,RelationalQueryDepthError,RelationalQueryMissingInverseError,RelationalQueryNotSupportedError,RelationalQueryThroughError,RelationalQueryUnknownRelationError,RemovedValueAsDefaultError,Rule,SerializationFailureError,SqliteRebuildRequiredError,TableBase,TableDefinition,TenantRequiredError,TimestampBuilder,TransactionFinishedError,UniqueViolationError,UnreviewedMigrationError,UuidBuilder,alias,and,appendJournalEntry,asc,between,bigSerial,bigint,boolean,buildTable,buildView,bytea,char,check,checkDrift,checkMigrations,computeMigrationHash,createDbClient,customType,date,decimal,defineTable,defineTenancy,desc,detectCompositeReferences,diff,doublePrecision,emitMysql,emitPg,emitSqlite,enforceEnumDropGate,eq,escapeLike,exists,extractSnapshot,fakeRows,findRenameCandidates,fitIdentifier,fk,generate,gt,gte,hasAmbiguousReverse,ilike,inArray,index,integer,interval,introspectMysql,introspectPg,introspectSqlite,introspectSqliteAsync,invertChanges,isDialectTag,isNotNull,isNull,isView,json,jsonb,kickDbAdapter,like,likePattern,link,listSeeds,lockTableDdl,lockTableName,lt,lte,markDialect,migrateDown,migrateLatest,migrateRollback,migrateStatus,migrateTenants,migrateUp,migrationFiles,migrationsTableDdl,ne,not,notExists,notInArray,notLike,numeric,or,parseEnumDropHeader,primaryKey,pushSchema,pushTableName,qualifiedTableName,quoteTable,readDialectMark,readJournal,real,relations,renderSchemaSource,resolveDbConfig,reviewMigration,runSeeds,safeNullComparison,seedFake,selfRef,serial,smallSerial,smallint,sql,table,tableFromClass,tenantKey,text,time,timestamp,timestamptz,toDbName,toKeyName,translateDbError,unique,unwrapTable,uuid,varchar,verifyMigrationHash,version,view};
|
package/dist/mysql.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { ea as MigrationAdapter } from "./index-
|
|
2
|
+
import { n as ColumnBuilder } from "./types-DB_xyeQT.mjs";
|
|
3
|
+
import { ea as MigrationAdapter } from "./index-C935uxe5.mjs";
|
|
4
4
|
import { Dialect } from "kysely";
|
|
5
5
|
//#region src/adapters/mysql/adapter.d.ts
|
|
6
6
|
/**
|
package/dist/mysql.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-db v8.
|
|
2
|
+
* @forinda/kickjs-db v8.12.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{a as markDialect,r as KICK_DIALECT_DATES,ut as KickDbError}from"./create-
|
|
11
|
+
import{a as markDialect,r as KICK_DIALECT_DATES,ut as KickDbError}from"./create-BUNHS2XX.mjs";import{Ft as lockTableDdl,It as lockTableName,Lt as migrationsTableDdl,Rt as pushTableName,kt as introspectMysql,zt as quoteTable}from"./src-Ivi-0lCB.mjs";import{r as ColumnBuilder}from"./custom-type-B6DrtO46.mjs";import{t as splitSqlStatements}from"./split-statements-B_7QYVyn.mjs";import{Kysely,MysqlDialect}from"kysely";function mysqlDialect(opts){let raw=opts.pool,callbackPool=typeof raw.pool?.getConnection==`function`?raw.pool:opts.pool,dialect=markDialect(new MysqlDialect({pool:callbackPool}),`mysql`),config=callbackPool.config?.connectionConfig,dates={timezone:config?.timezone??`local`,dateStrings:config?.dateStrings??!1};return Object.defineProperty(dialect,KICK_DIALECT_DATES,{value:dates,enumerable:!1}),dialect}function parseMysqlVersion(version){let trimmed=version.trim();if(/MariaDB/i.test(trimmed)){let m=/(\d+)\.(\d+)(?:\.\d+)?-MariaDB/i.exec(trimmed);if(m){let major=Number(m[1]),minor=Number(m[2]);if(Number.isFinite(major)&&Number.isFinite(minor))return{flavor:`mariadb`,major,minor}}let fallback=/^(\d+)\.(\d+)/.exec(trimmed);if(!fallback)return null;let major=Number(fallback[1]),minor=Number(fallback[2]);return!Number.isFinite(major)||!Number.isFinite(minor)?null:{flavor:`mariadb`,major,minor}}let m=/^(\d+)\.(\d+)/.exec(trimmed);if(!m)return null;let major=Number(m[1]),minor=Number(m[2]);return!Number.isFinite(major)||!Number.isFinite(minor)?null:{flavor:`mysql`,major,minor}}function parseMysqlMajorVersion(version){return parseMysqlVersion(version)?.major??null}function checkVersionSupport(parsed,raw){return parsed==null?`unparseable version string: ${raw||`<empty>`}`:parsed.flavor===`mariadb`?parsed.major>10?null:parsed.major<10||parsed.minor<5?`MariaDB 10.5+ required (detected: ${raw})`:null:parsed.major<8?`MySQL 8.0+ required (detected: ${raw})`:null}function splitMysqlStatements(sql){return splitSqlStatements(sql,`mysql`)}function mysqlAdapter(opts){if(opts.endPoolOnClose&&typeof opts.pool.end!=`function`)throw new KickDbError(`KICK_DB_POOL_NOT_CLOSABLE`,`mysqlAdapter({ endPoolOnClose: true }) needs a pool with an end() method to close`);let dialect=`mysql`,{pool}=opts,versionVerified=!1;async function assertVersion(){if(versionVerified)return;let[rows]=await pool.query("SELECT VERSION() AS `version`"),versionString=rows[0]?.version??``,failure=checkVersionSupport(parseMysqlVersion(versionString),versionString);if(failure)throw new KickDbError(`KICK_DB_RELATIONAL_NOT_SUPPORTED`,`${failure}. JSON_ARRAYAGG (required by the relational query layer) shipped in MySQL 8.0 and MariaDB 10.5. Use layer-1/layer-2 queries (selectFrom / selectAll) on older versions.`);versionVerified=!0}async function runStatements(sql){for(let stmt of splitMysqlStatements(sql))await pool.query(stmt)}async function runStatementsOnConn(conn,sql){for(let stmt of splitMysqlStatements(sql))await conn.query(stmt)}let table=opts.migrationsTable??`kick_migrations`,T=quoteTable(dialect,table),L=quoteTable(dialect,lockTableName(table)),bookkeepingTables=[table,lockTableName(table),pushTableName(table)],migrationDb;return{dialect,async ensureMigrationTables(){await assertVersion(),await runStatements(migrationsTableDdl(dialect,table)),await runStatements(lockTableDdl(dialect,table))},async listApplied(){let[rows]=await pool.query(`SELECT id, name, hash, batch, applied_at, direction
|
|
12
12
|
FROM ${T}
|
|
13
13
|
ORDER BY applied_at ASC, id ASC`);return rows.map(row=>({id:row.id,name:row.name,hash:row.hash,batch:Number(row.batch),appliedAt:row.applied_at instanceof Date?row.applied_at.toISOString():String(row.applied_at),direction:row.direction}))},async recordApplied(row){await pool.query(`INSERT INTO ${T} (id, name, hash, batch, direction)
|
|
14
14
|
VALUES (?, ?, ?, ?, ?)`,[row.id,row.name,row.hash,row.batch,row.direction])},async removeApplied(id){await pool.query(`DELETE FROM ${T} WHERE id = ?`,[id])},async acquireLock(owner,staleAfterSeconds){let[result]=await pool.query(staleAfterSeconds===void 0?`UPDATE ${L}
|