@forinda/kickjs-db 8.1.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cli.d.mts +1 -1
  2. package/dist/cli.d.mts.map +1 -1
  3. package/dist/cli.mjs +4 -3
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/{create-CwuC1odW.mjs → create-HnlQadLo.mjs} +7 -7
  6. package/dist/create-HnlQadLo.mjs.map +1 -0
  7. package/dist/{custom-type-DeGuRFuz.mjs → custom-type-Ctbe_IU7.mjs} +2 -2
  8. package/dist/{custom-type-DeGuRFuz.mjs.map → custom-type-Ctbe_IU7.mjs.map} +1 -1
  9. package/dist/devtools-events.d.mts +1 -1
  10. package/dist/devtools-events.mjs +1 -1
  11. package/dist/{index-2fEnHqpn.d.mts → index-CycSeW1r.d.mts} +80 -18
  12. package/dist/index-CycSeW1r.d.mts.map +1 -0
  13. package/dist/index.d.mts +3 -3
  14. package/dist/index.mjs +2 -2
  15. package/dist/mysql.d.mts +1 -1
  16. package/dist/mysql.d.mts.map +1 -1
  17. package/dist/mysql.mjs +2 -2
  18. package/dist/mysql.mjs.map +1 -1
  19. package/dist/{pg-CsmRByEZ.mjs → pg-S7rfvX4T.mjs} +3 -3
  20. package/dist/{pg-CsmRByEZ.mjs.map → pg-S7rfvX4T.mjs.map} +1 -1
  21. package/dist/pg.d.mts +1 -1
  22. package/dist/pg.d.mts.map +1 -1
  23. package/dist/pg.mjs +2 -2
  24. package/dist/pg.mjs.map +1 -1
  25. package/dist/schema.mjs +2 -2
  26. package/dist/{split-statements-BPCw9cII.mjs → split-statements-Cy-Bnpw-.mjs} +2 -2
  27. package/dist/{split-statements-BPCw9cII.mjs.map → split-statements-Cy-Bnpw-.mjs.map} +1 -1
  28. package/dist/sqlite.d.mts +1 -1
  29. package/dist/sqlite.d.mts.map +1 -1
  30. package/dist/sqlite.mjs +3 -3
  31. package/dist/sqlite.mjs.map +1 -1
  32. package/dist/{src-DUtVGG2c.mjs → src-DtmQZMw4.mjs} +10 -9
  33. package/dist/src-DtmQZMw4.mjs.map +1 -0
  34. package/dist/testing.d.mts +1 -1
  35. package/dist/testing.mjs +2 -2
  36. package/dist/{types-BZoTujcR.d.mts → types-BnYMhgYq.d.mts} +13 -7
  37. package/dist/types-BnYMhgYq.d.mts.map +1 -0
  38. package/package.json +9 -9
  39. package/dist/create-CwuC1odW.mjs.map +0 -1
  40. package/dist/index-2fEnHqpn.d.mts.map +0 -1
  41. package/dist/src-DUtVGG2c.mjs.map +0 -1
  42. package/dist/types-BZoTujcR.d.mts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-db v8.1.0
2
+ * @forinda/kickjs-db v8.3.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,4 +9,4 @@
9
9
  * @license MIT
10
10
  */
11
11
  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={}){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:String(value),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}managedAs(){return this.state.managed}toJSON(name){return{name,type:this.state.type,nullable:this.state.nullable,default:this.state.default,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-DeGuRFuz.mjs.map
12
+ //# sourceMappingURL=custom-type-Ctbe_IU7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-type-DeGuRFuz.mjs","names":[],"sources":["../src/dsl/columns/types.ts","../src/custom-type.ts"],"sourcesContent":["import type { ColumnSnapshot, 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\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\nexport interface ColumnState {\n type: string\n nullable: boolean\n default: string | null\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 /** `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 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\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 notNull(): this & NotNullBrand {\n this.state.nullable = false\n return this as this & NotNullBrand\n }\n\n primaryKey(): this & NotNullBrand {\n this.state.primaryKey = true\n this.state.nullable = false\n return this as this & NotNullBrand\n }\n\n unique(): this {\n this.state.unique = true\n return this\n }\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 references(\n target: () => ColumnRef,\n opts: { onDelete?: FkAction; onUpdate?: FkAction; name?: string } = {},\n ): this {\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`).\n */\n default(value: string | number | boolean): this & GeneratedBrand {\n this.state.default = typeof value === 'string' ? value : String(value)\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 — `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 asked `withDeleted: true`. Soft-delete by setting it.\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 /** 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 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":";;;;;;;;;;AA0GA,MAAa,eAAiB,OAA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AQ,QAAU,EAAK,EAC7D,IACT,CAMA,2BAAwE,CAGtE,MAFA,MAAK,MAAM,SAAW,SACtB,KAAK,MAAM,SAAW,GACf,IACT,CAGA,8BAAqE,CAGnE,MAFA,MAAK,MAAM,SAAW,YACtB,KAAK,MAAM,SAAW,GACf,IACT,CAMA,QAAQ,KAAoB,CAE1B,MADA,MAAK,MAAM,QAAU,KACd,IACT,CAGA,WAAoC,CAClC,OAAO,KAAK,MAAM,OACpB,CAEA,OAAO,KAA8B,CACnC,MAAO,CACL,KACA,KAAM,KAAK,MAAM,KACjB,SAAU,KAAK,MAAM,SACrB,QAAS,KAAK,MAAM,QACpB,WAAY,KAAK,MAAM,WAEvB,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,EC5Ra,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
+ {"version":3,"file":"custom-type-Ctbe_IU7.mjs","names":[],"sources":["../src/dsl/columns/types.ts","../src/custom-type.ts"],"sourcesContent":["import type { ColumnSnapshot, 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\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\nexport interface ColumnState {\n type: string\n nullable: boolean\n default: string | null\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 /** `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 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\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 notNull(): this & NotNullBrand {\n this.state.nullable = false\n return this as this & NotNullBrand\n }\n\n primaryKey(): this & NotNullBrand {\n this.state.primaryKey = true\n this.state.nullable = false\n return this as this & NotNullBrand\n }\n\n unique(): this {\n this.state.unique = true\n return this\n }\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 references(\n target: () => ColumnRef,\n opts: { onDelete?: FkAction; onUpdate?: FkAction; name?: string } = {},\n ): this {\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`).\n */\n default(value: string | number | boolean): this & GeneratedBrand {\n this.state.default = typeof value === 'string' ? value : String(value)\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 — `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 asked `withDeleted: true`. Soft-delete by setting it.\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 /** 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 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":";;;;;;;;;;AA0GA,MAAa,eAAiB,OAAO,IAAI,8BAA8B,EAsB1D,cAAgB,OAAO,IAAI,4BAA4B,EA0BpE,IAAa,cAAb,KAAwC,CAKtC,MAEA,YAAY,KAAc,SAAiC,CAAC,EAAG,CAC7D,KAAK,MAAQ,CACX,KACA,SAAU,SAAS,UAAY,GAC/B,QAAS,SAAS,SAAW,KAC7B,WAAY,SAAS,YAAc,GACnC,OAAQ,SAAS,QAAU,GAC3B,WAAY,SAAS,YAAc,KACnC,GAAI,SAAS,KAAO,CAAE,KAAM,SAAS,IAAK,EAAI,CAAC,CACjD,CACF,CAEA,SAA+B,CAE7B,MADA,MAAK,MAAM,SAAW,GACf,IACT,CAEA,YAAkC,CAGhC,MAFA,MAAK,MAAM,WAAa,GACxB,KAAK,MAAM,SAAW,GACf,IACT,CAEA,QAAe,CAEb,MADA,MAAK,MAAM,OAAS,GACb,IACT,CAEA,OAAkD,CAEhD,MADA,MAAK,MAAM,KAAO,GAAG,KAAK,MAAM,KAAK,IAC9B,IACT,CAEA,WACE,OACA,KAAoE,CAAC,EAC/D,CAYN,MATA,MAAK,MAAM,WAAa,CACtB,MAAO,OACP,SAAU,KAAK,UAAY,YAC3B,SAAU,KAAK,UAAY,YAI3B,GAAI,KAAK,OAAS,IAAA,GAAY,CAAC,EAAI,CAAE,KAAM,KAAK,IAAK,CACvD,EACO,IACT,CAcA,QAAQ,MAAyD,CAE/D,MADA,MAAK,MAAM,QAAU,OAAO,OAAU,SAAW,MAAQ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WAAgB,KAA8D,CAC5F,UAAa,IAAI,oBAAyB,IAAI,CAChD"}
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as QueryErrorEvent, o as QueryEvent, s as SlowQueryEvent } from "./types-BZoTujcR.mjs";
2
+ import { a as QueryErrorEvent, o as QueryEvent, s as SlowQueryEvent } from "./types-BnYMhgYq.mjs";
3
3
  //#region src/devtools-events.d.ts
4
4
  declare module '@forinda/kickjs-devtools-kit/bus' {
5
5
  interface KickDevtoolsEventRegistry {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-db v8.1.0
2
+ * @forinda/kickjs-db v8.3.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,10 +1,10 @@
1
1
 
2
2
  import { C as TableSnapshot, S as SchemaSnapshot, _ as ForeignKeySnapshot, b as RelationSnapshot, d as TypedColumnRefs, f as CheckSnapshot, h as EnumSnapshot, l as NotNullBrand, m as Dialect$1, n as ColumnRef, o as GeneratedBrand, p as ColumnSnapshot, t as ColumnBuilder, u as TypedColumnRef, v as IndexSnapshot, w as ViewSnapshot, x as RoleSnapshot, y as PolicySnapshot } from "./types-DNAKmwPO.mjs";
3
- import { _ as RelationMapEntry, n as CreateDbClientOptions, r as KickDbClient } from "./types-BZoTujcR.mjs";
3
+ import { _ as RelationMapEntry, n as CreateDbClientOptions, r as KickDbClient } from "./types-BnYMhgYq.mjs";
4
4
  import { f as TableConstraint, l as IndexDecl, n as TableDecl } from "./table-CGPsm5i7.mjs";
5
5
  import { t as SchemaToTypes } from "./schema-types-DH-d43Pf.mjs";
6
6
  import { o as SchemaLike, t as ColumnRule } from "./schema-BjGAg-s1.mjs";
7
- import { CompiledQuery, Expression, ExpressionBuilder, Kysely, KyselyPlugin, RawBuilder, SelectType, SqlBool } from "kysely";
7
+ import { CompiledQuery, Expression, Expression as Expression$1, ExpressionBuilder, ExpressionBuilder as ExpressionBuilder$1, Kysely, Kysely as Kysely$1, KyselyPlugin, KyselyPlugin as KyselyPlugin$1, RawBuilder, RawBuilder as RawBuilder$1, SelectType, Sql, SqlBool, SqlBool as SqlBool$1, sql as sql$1 } from "kysely";
8
8
  import { InjectionToken } from "@forinda/kickjs";
9
9
  import { AsyncLocalStorage } from "node:async_hooks";
10
10
  import { ReadonlyKysely } from "kysely/readonly";
@@ -736,6 +736,8 @@ declare const KICK_MIGRATIONS_TABLE = "kick_migrations";
736
736
  declare const KICK_LOCK_TABLE = "kick_migrations_lock";
737
737
  /** The lock table that goes with a migrations table. */
738
738
  declare function lockTableName(table: string): string;
739
+ /** Where `kick db push` keeps what it last pushed, next to the migrations table. */
740
+ declare function pushTableName(table: string): string;
739
741
  /**
740
742
  * A table name quoted for the dialect. A dotted name is schema-qualified on
741
743
  * Postgres (`meta.kick_migrations`); elsewhere a dot is part of the name.
@@ -788,7 +790,7 @@ interface PgQueryRunner {
788
790
  interface IntrospectPgOptions {
789
791
  /** Default 'public'. */
790
792
  schema?: string;
791
- /** Migration tracking tables to skip. Default ['kick_migrations', 'kick_migrations_lock']. */
793
+ /** Migration tracking tables to skip. Default ['kick_migrations', 'kick_migrations_lock', 'kick_migrations_push']. */
792
794
  excludeTables?: readonly string[];
793
795
  }
794
796
  //#endregion
@@ -845,13 +847,53 @@ interface IntrospectMysqlOptions {
845
847
  */
846
848
  declare function introspectMysql(db: MysqlIntrospectDb, opts?: IntrospectMysqlOptions): Promise<SchemaSnapshot>;
847
849
  //#endregion
850
+ //#region src/migrate/code-migration.d.ts
851
+ /** What a migration written in TypeScript runs with: Kysely on the migration's transaction. */
852
+ type MigrationDb = Kysely<any>;
853
+ /** A migration's code, from its `migration.ts`. */
854
+ interface CodeMigration {
855
+ up(db: MigrationDb): Promise<void>;
856
+ down?(db: MigrationDb): Promise<void>;
857
+ }
858
+ //#endregion
859
+ //#region src/migrate/source.d.ts
860
+ /** Migration files held in memory — what `migrationFiles()` returns. */
861
+ interface MigrationFiles {
862
+ readonly __migrationFiles: true;
863
+ /** File text by `_journal.json` or `<id>/<file>`. */
864
+ readonly files: ReadonlyMap<string, string>;
865
+ /** Loaded `migration.ts` modules by migration id. */
866
+ readonly modules: ReadonlyMap<string, CodeMigration>;
867
+ }
868
+ /** Where migrations live: a folder, bundled files, or several of either, run as one history. */
869
+ type MigrationsLocation = string | MigrationFiles | readonly (string | MigrationFiles)[];
870
+ /**
871
+ * Migrations from files already in memory, keyed by path — what a bundler's
872
+ * glob gives you — for a deploy that ships no migrations folder:
873
+ *
874
+ * ```ts
875
+ * const migrations = migrationFiles(
876
+ * import.meta.glob('../../db/migrations/**', { query: '?raw', import: 'default', eager: true }),
877
+ * import.meta.glob('../../db/migrations/*\/migration.ts', { eager: true }),
878
+ * )
879
+ * ```
880
+ *
881
+ * `files` must be the files' exact text (`?raw`): the runner hashes it to
882
+ * check a reviewed migration wasn't changed. A migration written in
883
+ * TypeScript needs both: its text in `files`, its module in `modules`.
884
+ */
885
+ declare function migrationFiles(files: Record<string, string>, modules?: Record<string, unknown>): MigrationFiles;
886
+ //#endregion
848
887
  //#region src/adapter.d.ts
849
888
  type MigrationsOnBoot = 'fail-if-pending' | 'apply' | 'ignore';
850
889
  interface KickDbAdapterConfig {
851
890
  /** The driver-bound MigrationAdapter — pgAdapter() in @forinda/kickjs-db/pg, etc. */
852
891
  migrationAdapter: MigrationAdapter;
853
- /** Directory containing the generated migrations + _journal.json — or several, run as one history. */
854
- migrationsDir: string | readonly string[];
892
+ /**
893
+ * Directory containing the generated migrations + _journal.json — or several,
894
+ * run as one history. `migrationFiles()` in place of one, for a bundled deploy.
895
+ */
896
+ migrationsDir: MigrationsLocation;
855
897
  /** Boot policy. Default 'fail-if-pending' — mirror the operator-explicit philosophy. */
856
898
  migrationsOnBoot?: MigrationsOnBoot;
857
899
  /** Drift detection mode. Default 'error' outside dev. */
@@ -954,9 +996,10 @@ interface RunnerOptions {
954
996
  adapter: MigrationAdapter;
955
997
  /**
956
998
  * The migrations folder — or several, run as one history ordered by
957
- * migration id. Each keeps its own journal and snapshots.
999
+ * migration id. Each keeps its own journal and snapshots. Bundled files
1000
+ * (`migrationFiles()`) work in place of a folder.
958
1001
  */
959
- migrationsDir: string | readonly string[];
1002
+ migrationsDir: MigrationsLocation;
960
1003
  /** When true, refuse to apply migrations whose meta.json.reviewed is false. Defaults to true outside dev. */
961
1004
  requireReviewed?: boolean;
962
1005
  /** Owner string written into the lock table for diagnostics. */
@@ -1068,6 +1111,34 @@ interface ReviewResult {
1068
1111
  */
1069
1112
  declare function reviewMigration(migrationsDir: string, id: string): Promise<ReviewResult>;
1070
1113
  //#endregion
1114
+ //#region src/migrate/push.d.ts
1115
+ interface PushOptions {
1116
+ adapter: MigrationAdapter;
1117
+ /** The schema module — what `createDbClient({ schema })` takes. */
1118
+ schema: Record<string, unknown>;
1119
+ casing?: Casing;
1120
+ /** Renames known up front. */
1121
+ renames?: RenameHints;
1122
+ /** Asked which dropped tables and columns are really renames. */
1123
+ askRenames?: (candidates: RenameCandidates) => Promise<RenameHints>;
1124
+ /**
1125
+ * Asked before changes that lose data (a dropped table or column, a
1126
+ * changed column type, a removed enum value). Without it, they're refused.
1127
+ */
1128
+ confirmDataLoss?: (losses: string[]) => Promise<boolean>;
1129
+ }
1130
+ interface PushResult {
1131
+ status: 'pushed' | 'no-changes';
1132
+ changeCount: number;
1133
+ }
1134
+ /**
1135
+ * Make the database match the schema, with no migration file — for
1136
+ * prototyping. Refused in production and on a database with migrations
1137
+ * applied: once a database has a migration history, changes go through
1138
+ * `kick db generate`.
1139
+ */
1140
+ declare function pushSchema(opts: PushOptions): Promise<PushResult>;
1141
+ //#endregion
1071
1142
  //#region src/emit/pg.d.ts
1072
1143
  declare function emitPg(changes: ChangeSet): string;
1073
1144
  //#endregion
@@ -1182,15 +1253,6 @@ interface GenerateResult {
1182
1253
  }
1183
1254
  declare function generate(opts: GenerateOptions): Promise<GenerateResult>;
1184
1255
  //#endregion
1185
- //#region src/migrate/code-migration.d.ts
1186
- /** What a migration written in TypeScript runs with: Kysely on the migration's transaction. */
1187
- type MigrationDb = Kysely<any>;
1188
- /** A migration's code, from its `migration.ts`. */
1189
- interface CodeMigration {
1190
- up(db: MigrationDb): Promise<void>;
1191
- down?(db: MigrationDb): Promise<void>;
1192
- }
1193
- //#endregion
1194
1256
  //#region src/cli/check.d.ts
1195
1257
  interface CheckResult {
1196
1258
  /** Changes in the schema that no migration covers yet — run `kick db generate`. */
@@ -1874,5 +1936,5 @@ declare function markDialect<T extends object>(dialect: T, tag: DialectTag): T;
1874
1936
  */
1875
1937
  declare function readDialectMark(dialect: object): DialectTag | undefined;
1876
1938
  //#endregion
1877
- export { NumberRule as $, parseEnumDropHeader as $n, DropEnum as $r, generate as $t, Operand as A, introspectMysql as An, DiffOptions as Ar, json as At, isNull as B, KICK_MIGRATIONS_TABLE as Bn, AlterColumn as Br, timestamptz as Bt, customType as C, DriftLogger as Ci, DB_PRIMARY as Cn, CompositeQueryRunner as Cr, bytea as Ct, RelationsDecl as D, MigrationRow as Di, kickDbAdapter as Dn, RemovedValueAsDefaultError as Dr, doublePrecision as Dt, RelationOne as E, MigrationBookkeeping as Ei, MigrationsOnBoot as En, KickDbError as Er, decimal as Et, gt as F, introspectPg as Fn, AddCheck as Fr, smallSerial as Ft, not as G, Journal as Gn, CreateEnum as Gr, listSeeds as Gt, lt as H, lockTableName as Hn, AlterRole as Hr, varchar as Ht, gte as I, IntrospectPgOptions as In, AddColumn as Ir, smallint as It, notLike as J, computeMigrationHash as Jn, CreateSchema as Jr, checkMigrations as Jt, notExists as K, JournalEntry as Kn, CreatePolicy as Kr, runSeeds as Kt, ilike as L, PgQueryRunner as Ln, AddEnumValue as Lr, text as Lt, between as M, SqliteIntrospectDb as Mn, RenameHints as Mr, numeric as Mt, eq as N, introspectSqlite as Nn, diff as Nr, real as Nt, ThroughSpec as O, IntrospectMysqlOptions as On, hasAmbiguousReverse as Or, integer as Ot, exists as P, introspectSqliteAsync as Pn, findRenameCandidates as Pr, serial as Pt, ClassRefs as Q, enforceEnumDropGate as Qn, DropColumn as Qr, GenerateResult as Qt, inArray as R, MemoryMigrationAdapter as Rn, AddForeignKey as Rr, time as Rt, CustomTypeOptions as S, DriftBehavior as Si, DB_CLIENT as Sn, CompositeEnumReferenceError as Sr, boolean as St, RelationMany as T, MigrationAdapter as Ti, KickDbAdapterConfig as Tn, detectCompositeReferences as Tr, date as Tt, lte as U, migrationsTableDdl as Un, Change as Ur, version as Ut, like as V, lockTableDdl as Vn, AlterPrimaryKey as Vr, uuid as Vt, ne as W, quoteTable as Wn, ChangeSet as Wr, SeedResult as Wt, AliasedTable as X, verifyMigrationHash as Xn, CreateView as Xr, MigrationDb as Xt, or as Y, readJournal as Yn, CreateTable as Yr, CodeMigration as Yt, alias as Z, EnumDropHeader as Zn, DropCheck as Zr, GenerateOptions as Zt, RelationalQueryNotSupportedError as _, toKeyName as _i, migrateRollback as _n, UniqueViolationError as _r, view as _t, markDialect as a, PrimaryKeyShape as ai, reviewMigration as an, MigrationLockError as ar, TableDefinition as at, SchemaToRelationsRegister as b, TenantsConfig as bi, safeNullComparison as bn, ResolvedRelation as br, bigSerial as bt, desc as c, RenameTable as ci, TenantMigrationResult as cn, CheckViolationError as cr, link as ct, likePattern as d, SetTableComment as di, ReversedSummary as dn, DatabaseErrorInfo as dr, MaterializedViewOptions as dt, DropForeignKey as ei, emitMysql as en, MigrationDriftError as er, Rule as et, RelationalQueryAliasCollisionError as f, renderSchemaSource as fi, RollbackSummary as fn, DbDialect as fr, ViewDecl as ft, RelationalQueryMissingInverseError as g, toDbName as gi, migrateLatest as gn, SerializationFailureError as gr, isView as gt, RelationalQueryDepthError as h, Casing as hi, migrateDown as hn, NotNullViolationError as hr, buildView as ht, isDialectTag as i, DropView as ii, ReviewResult as in, MigrationHashError as ir, TableClass as it, and as j, IntrospectSqliteOptions as jn, RenameCandidates as jr, jsonb as jt, relations as k, MysqlIntrospectDb as kn, invertChanges as kr, interval as kt, LikeMatchMode as l, SetColumnComment as li, migrateTenants as ln, ConnectionError as lr, tableFromClass as lt, RelationalQueryCancelledError as m, extractSnapshot as mi, StatusEntry as mn, ForeignKeyViolationError as mr, ViewOptions as mt, DialectTag as n, DropPolicy as ni, emitSqlite as nn, MigrationError as nr, StringRule as nt, readDialectMark as o, RemoveEnumValue as oi, MigrateTenantsOptions as on, SchemaDiffSummary as or, defineTable as ot, RelationalQueryAmbiguousRelationNameError as p, fitIdentifier as pi, RunnerOptions as pn, DeadlockError as pr, ViewMarks as pt, notInArray as q, appendJournalEntry as qn, CreateRole as qr, CheckResult as qt, KICK_DIALECT as r, DropTable as ri, emitPg as rn, MigrationFailedError as rr, TableBase as rt, asc as s, RenameColumn as si, MigrateTenantsResult as sn, UnreviewedMigrationError as sr, fk as st, ReadonlyKysely as t, DropIndex as ti, SqliteRebuildRequiredError as tn, MigrationEnumDropError as tr, RuleFor as tt, escapeLike as u, SetRowLevelSecurity as ui, AppliedSummary as un, DatabaseError as ur, selfRef as ut, RelationalQueryThroughError as v, DbConfig as vi, migrateStatus as vn, translateDbError as vr, TimestampBuilder as vt, Relation as w, checkDrift as wi, DB_REPLICA as wn, CompositeRef as wr, char as wt, CustomColumnBuilder as x, resolveDbConfig as xi, createDbClient as xn, ResolvedRelations as xr, bigint as xt, RelationalQueryUnknownRelationError as y, MigrationAdapterFactory as yi, migrateUp as yn, TransactionFinishedError as yr, UuidBuilder as yt, isNotNull as z, KICK_LOCK_TABLE as zn, AddIndex as zr, timestamp as zt };
1878
- //# sourceMappingURL=index-2fEnHqpn.d.mts.map
1939
+ export { not as $, KICK_LOCK_TABLE as $n, AddForeignKey as $r, listSeeds as $t, CustomTypeOptions as A, Casing as Ai, createDbClient as An, NotNullViolationError as Ar, boolean as At, between as B, MigrationAdapter as Bi, CodeMigration as Bn, detectCompositeReferences as Br, numeric as Bt, RelationalQueryDepthError as C, RenameTable as Ci, StatusEntry as Cn, CheckViolationError as Cr, buildView as Ct, RelationalQueryUnknownRelationError as D, renderSchemaSource as Di, migrateStatus as Dn, DbDialect as Dr, UuidBuilder as Dt, RelationalQueryThroughError as E, SetTableComment as Ei, migrateRollback as En, DatabaseErrorInfo as Er, TimestampBuilder as Et, RelationsDecl as F, TenantsConfig as Fi, MigrationsOnBoot as Fn, ResolvedRelation as Fr, doublePrecision as Ft, ilike as G, IntrospectSqliteOptions as Gn, DiffOptions as Gr, text as Gt, exists as H, MigrationRow as Hi, IntrospectMysqlOptions as Hn, RemovedValueAsDefaultError as Hr, serial as Ht, ThroughSpec as I, resolveDbConfig as Ii, kickDbAdapter as In, ResolvedRelations as Ir, integer as It, isNull as J, introspectSqliteAsync as Jn, diff as Jr, timestamptz as Jt, inArray as K, SqliteIntrospectDb as Kn, RenameCandidates as Kr, time as Kt, relations as L, DriftBehavior as Li, MigrationFiles as Ln, CompositeEnumReferenceError as Lr, interval as Lt, Relation as M, toKeyName as Mi, DB_PRIMARY as Mn, UniqueViolationError as Mr, char as Mt, RelationMany as N, DbConfig as Ni, DB_REPLICA as Nn, translateDbError as Nr, date as Nt, SchemaToRelationsRegister as O, fitIdentifier as Oi, migrateUp as On, DeadlockError as Or, bigSerial as Ot, RelationOne as P, MigrationAdapterFactory as Pi, KickDbAdapterConfig as Pn, TransactionFinishedError as Pr, decimal as Pt, ne as Q, MemoryMigrationAdapter as Qn, AddEnumValue as Qr, SeedResult as Qt, Operand as R, DriftLogger as Ri, MigrationsLocation as Rn, CompositeQueryRunner as Rr, json as Rt, RelationalQueryCancelledError as S, RenameColumn as Si, RunnerOptions as Sn, UnreviewedMigrationError as Sr, ViewOptions as St, RelationalQueryNotSupportedError as T, SetRowLevelSecurity as Ti, migrateLatest as Tn, DatabaseError as Tr, view as Tt, gt as U, MysqlIntrospectDb as Un, hasAmbiguousReverse as Ur, smallSerial as Ut, eq as V, MigrationBookkeeping as Vi, MigrationDb as Vn, KickDbError as Vr, real as Vt, gte as W, introspectMysql as Wn, invertChanges as Wr, smallint as Wt, lt as X, IntrospectPgOptions as Xn, AddCheck as Xr, varchar as Xt, like as Y, introspectPg as Yn, findRenameCandidates as Yr, uuid as Yt, lte as Z, PgQueryRunner as Zn, AddColumn as Zr, version as Zt, LikeMatchMode as _, DropPolicy as _i, TenantMigrationResult as _n, MigrationError as _r, tableFromClass as _t, RawBuilder$1 as a, ChangeSet as ai, generate as an, quoteTable as ar, alias as at, RelationalQueryAliasCollisionError as b, PrimaryKeyShape as bi, ReversedSummary as bn, MigrationLockError as br, ViewDecl as bt, SqlBool$1 as c, CreateRole as ci, emitSqlite as cn, appendJournalEntry as cr, Rule as ct, KICK_DIALECT as d, CreateView as di, PushResult as dn, verifyMigrationHash as dr, TableBase as dt, AddIndex as ei, runSeeds as en, KICK_MIGRATIONS_TABLE as er, notExists as et, isDialectTag as f, DropCheck as fi, pushSchema as fn, EnumDropHeader as fr, TableClass as ft, desc as g, DropIndex as gi, MigrateTenantsResult as gn, MigrationEnumDropError as gr, link as gt, asc as h, DropForeignKey as hi, MigrateTenantsOptions as hn, MigrationDriftError as hr, fk as ht, KyselyPlugin$1 as i, Change as ii, GenerateResult as in, pushTableName as ir, AliasedTable as it, customType as j, toDbName as ji, DB_CLIENT as jn, SerializationFailureError as jr, bytea as jt, CustomColumnBuilder as k, extractSnapshot as ki, safeNullComparison as kn, ForeignKeyViolationError as kr, bigint as kt, sql$1 as l, CreateSchema as li, emitPg as ln, computeMigrationHash as lr, RuleFor as lt, readDialectMark as m, DropEnum as mi, reviewMigration as mn, parseEnumDropHeader as mr, defineTable as mt, ExpressionBuilder$1 as n, AlterPrimaryKey as ni, checkMigrations as nn, lockTableName as nr, notLike as nt, ReadonlyKysely as o, CreateEnum as oi, emitMysql as on, Journal as or, ClassRefs as ot, markDialect as p, DropColumn as pi, ReviewResult as pn, enforceEnumDropGate as pr, TableDefinition as pt, isNotNull as q, introspectSqlite as qn, RenameHints as qr, timestamp as qt, Kysely$1 as r, AlterRole as ri, GenerateOptions as rn, migrationsTableDdl as rr, or as rt, Sql as s, CreatePolicy as si, SqliteRebuildRequiredError as sn, JournalEntry as sr, NumberRule as st, Expression$1 as t, AlterColumn as ti, CheckResult as tn, lockTableDdl as tr, notInArray as tt, DialectTag as u, CreateTable as ui, PushOptions as un, readJournal as ur, StringRule as ut, escapeLike as v, DropTable as vi, migrateTenants as vn, MigrationFailedError as vr, selfRef as vt, RelationalQueryMissingInverseError as w, SetColumnComment as wi, migrateDown as wn, ConnectionError as wr, isView as wt, RelationalQueryAmbiguousRelationNameError as x, RemoveEnumValue as xi, RollbackSummary as xn, SchemaDiffSummary as xr, ViewMarks as xt, likePattern as y, DropView as yi, AppliedSummary as yn, MigrationHashError as yr, MaterializedViewOptions as yt, and as z, checkDrift as zi, migrationFiles as zn, CompositeRef as zr, jsonb as zt };
1940
+ //# sourceMappingURL=index-CycSeW1r.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CycSeW1r.d.mts","names":[],"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/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,SAAS;;EAElB,yBAAyB;;EAEzB,eAAe,QAAQ;;EAEvB,cAAc,KAAK,KAAK,6BAA6B;;EAErD,cAAc,aAAa;;EAE3B,YAAY,gBAAgB;;EAE5B,eAAe;;EAEf,aAAa,cAAc;;;;;;;;EAQ3B,oBAAoB,aAAa,aAAa,8BAA8B;;EAE5E,aAAa,cAAc;;EAE3B,cAAc,QAAQ;;;;;;EAMtB,WAAW;;WAEF;;EAET,SAAS;;;KAIC;EAAyB,QAAQ,KAAK;;EAAiC;;;;KCqFvE;UAEK;EACf,OAAO;;iBAGa,WACpB,cAAc,gBACd,kBAAkB,gBAClB,UAAU,eACV,MAAK,cACJ;;;KCtJS,gCAAgC,mBAAmB,QAAQ;UAEtD;EACf;EACA;;EAEA;EACA,SAAS;;;;;;;;EAQT,aAAa;;;;;EAKb;;;;;;EAMA;;EAEA;;;;;;;EAOA;;;;;;EAMA,UAAU;;;;;EAKV,UAAU;;UAGK;;EAEf,gCAAgC;;EAEhC,UAAU,qBAAqB,mBAAmB,QAAQ;;EAE1D;;iBAGoB,gBAAgB;EAAQ;IAAuB,QAAQ;;;KC7CjE;;cAcC,WAAQ;;cAGR,YAAS;;;iBCkCN,gBACd,QAAQ,yBACR,SAAS,WACT;EAAW,SAAS;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCxBa,cAAc;;;;;;;;;;;;;;;;;;;iBCtBd,mBAAmB,UAAU;;;;;;;;;;;;UCP5B;EACf;EACA;;UAGe;EACf;EACA,OAAO;;UAGQ;EACf;EACA,OAAO;;UAGQ;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,QAAQ;;UAGO;EACf;EACA;EACA,QAAQ;;UAGO;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AW,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
2
  import { C as TableSnapshot, S as SchemaSnapshot, _ as ForeignKeySnapshot, b as RelationSnapshot, c as KICK_NOT_NULL, d as TypedColumnRefs, f as CheckSnapshot, g as FkAction, h as EnumSnapshot, i as FkSpec, l as NotNullBrand, m as Dialect, n as ColumnRef, o as GeneratedBrand, p as ColumnSnapshot, r as ColumnState, s as KICK_GENERATED, t as ColumnBuilder, u as TypedColumnRef, v as IndexSnapshot } from "./types-DNAKmwPO.mjs";
3
- import { $ as NumberRule, $n as parseEnumDropHeader, $r as DropEnum, $t as generate, A as Operand, An as introspectMysql, Ar as DiffOptions, At as json, B as isNull, Bn as KICK_MIGRATIONS_TABLE, Br as AlterColumn, Bt as timestamptz, C as customType, Ci as DriftLogger, Cn as DB_PRIMARY, Cr as CompositeQueryRunner, Ct as bytea, D as RelationsDecl, Di as MigrationRow, Dn as kickDbAdapter, Dr as RemovedValueAsDefaultError, Dt as doublePrecision, E as RelationOne, Ei as MigrationBookkeeping, En as MigrationsOnBoot, Er as KickDbError, Et as decimal, F as gt, Fn as introspectPg, Fr as AddCheck, Ft as smallSerial, G as not, Gn as Journal, Gr as CreateEnum, Gt as listSeeds, H as lt, Hn as lockTableName, Hr as AlterRole, Ht as varchar, I as gte, In as IntrospectPgOptions, Ir as AddColumn, It as smallint, J as notLike, Jn as computeMigrationHash, Jr as CreateSchema, Jt as checkMigrations, K as notExists, Kn as JournalEntry, Kr as CreatePolicy, Kt as runSeeds, L as ilike, Ln as PgQueryRunner, Lr as AddEnumValue, Lt as text, M as between, Mn as SqliteIntrospectDb, Mr as RenameHints, Mt as numeric, N as eq, Nn as introspectSqlite, Nr as diff, Nt as real, O as ThroughSpec, On as IntrospectMysqlOptions, Or as hasAmbiguousReverse, Ot as integer, P as exists, Pn as introspectSqliteAsync, Pr as findRenameCandidates, Pt as serial, Q as ClassRefs, Qn as enforceEnumDropGate, Qr as DropColumn, Qt as GenerateResult, R as inArray, Rn as MemoryMigrationAdapter, Rr as AddForeignKey, Rt as time, S as CustomTypeOptions, Si as DriftBehavior, Sn as DB_CLIENT, Sr as CompositeEnumReferenceError, St as boolean, T as RelationMany, Ti as MigrationAdapter, Tn as KickDbAdapterConfig, Tr as detectCompositeReferences, Tt as date, U as lte, Un as migrationsTableDdl, Ur as Change, Ut as version, V as like, Vn as lockTableDdl, Vr as AlterPrimaryKey, Vt as uuid, W as ne, Wn as quoteTable, Wr as ChangeSet, Wt as SeedResult, X as AliasedTable, Xn as verifyMigrationHash, Xr as CreateView, Xt as MigrationDb, Y as or, Yn as readJournal, Yr as CreateTable, Yt as CodeMigration, Z as alias, Zn as EnumDropHeader, Zr as DropCheck, Zt as GenerateOptions, _ as RelationalQueryNotSupportedError, _i as toKeyName, _n as migrateRollback, _r as UniqueViolationError, _t as view, a as markDialect, ai as PrimaryKeyShape, an as reviewMigration, ar as MigrationLockError, at as TableDefinition, b as SchemaToRelationsRegister, bn as safeNullComparison, br as ResolvedRelation, bt as bigSerial, c as desc, ci as RenameTable, cn as TenantMigrationResult, cr as CheckViolationError, ct as link, d as likePattern, di as SetTableComment, dn as ReversedSummary, dr as DatabaseErrorInfo, dt as MaterializedViewOptions, ei as DropForeignKey, en as emitMysql, er as MigrationDriftError, et as Rule, f as RelationalQueryAliasCollisionError, fi as renderSchemaSource, fn as RollbackSummary, fr as DbDialect, ft as ViewDecl, g as RelationalQueryMissingInverseError, gi as toDbName, gn as migrateLatest, gr as SerializationFailureError, gt as isView, h as RelationalQueryDepthError, hi as Casing, hn as migrateDown, hr as NotNullViolationError, ht as buildView, i as isDialectTag, ii as DropView, in as ReviewResult, ir as MigrationHashError, it as TableClass, j as and, jn as IntrospectSqliteOptions, jr as RenameCandidates, jt as jsonb, k as relations, kn as MysqlIntrospectDb, kr as invertChanges, kt as interval, l as LikeMatchMode, li as SetColumnComment, ln as migrateTenants, lr as ConnectionError, lt as tableFromClass, m as RelationalQueryCancelledError, mi as extractSnapshot, mn as StatusEntry, mr as ForeignKeyViolationError, mt as ViewOptions, n as DialectTag, ni as DropPolicy, nn as emitSqlite, nr as MigrationError, nt as StringRule, o as readDialectMark, oi as RemoveEnumValue, on as MigrateTenantsOptions, or as SchemaDiffSummary, ot as defineTable, p as RelationalQueryAmbiguousRelationNameError, pi as fitIdentifier, pn as RunnerOptions, pr as DeadlockError, pt as ViewMarks, q as notInArray, qn as appendJournalEntry, qr as CreateRole, qt as CheckResult, r as KICK_DIALECT, ri as DropTable, rn as emitPg, rr as MigrationFailedError, rt as TableBase, s as asc, si as RenameColumn, sn as MigrateTenantsResult, sr as UnreviewedMigrationError, st as fk, t as ReadonlyKysely, ti as DropIndex, tn as SqliteRebuildRequiredError, tr as MigrationEnumDropError, tt as RuleFor, u as escapeLike, ui as SetRowLevelSecurity, un as AppliedSummary, ur as DatabaseError, ut as selfRef, v as RelationalQueryThroughError, vi as DbConfig, vn as migrateStatus, vr as translateDbError, vt as TimestampBuilder, w as Relation, wi as checkDrift, wn as DB_REPLICA, wr as CompositeRef, wt as char, x as CustomColumnBuilder, xi as resolveDbConfig, xn as createDbClient, xr as ResolvedRelations, xt as bigint, y as RelationalQueryUnknownRelationError, yn as migrateUp, yr as TransactionFinishedError, yt as UuidBuilder, z as isNotNull, zn as KICK_LOCK_TABLE, zr as AddIndex, zt as timestamp } from "./index-2fEnHqpn.mjs";
4
- import { A as tenantKey, C as BypassInfo, D as TenancyStrategy, E as TenancyOptions, F as UpsertOptions, M as ExtensionDefinition, N as ModelExtensions, O as TenantRequiredError, P as FindOrCreateOptions, S as RegisteredDB, T as Tenancy, _ as RelationMapEntry, a as QueryErrorEvent, b as WithClause, c as TransactionEvent, d as TransactionRollbackEvent, f as FindManyOptions, g as RegisteredRelations, h as QueryNamespace, i as KickDbClientEvents, j as ExtendedClient, k as defineTenancy, l as TransactionOptions, m as KickDbRelationsRegister, n as CreateDbClientOptions, o as QueryEvent, p as FindManyRow, r as KickDbClient, t as BeforeQueryEvent, u as TransactionRetryEvent, v as TableQueryNamespace, w as BypassOptions, x as KickDbRegister, y as TableRelations } from "./types-BZoTujcR.mjs";
3
+ import { $ as not, $n as KICK_LOCK_TABLE, $r as AddForeignKey, $t as listSeeds, A as CustomTypeOptions, Ai as Casing, An as createDbClient, Ar as NotNullViolationError, At as boolean, B as between, Bi as MigrationAdapter, Bn as CodeMigration, Br as detectCompositeReferences, Bt as numeric, C as RelationalQueryDepthError, Ci as RenameTable, Cn as StatusEntry, Cr as CheckViolationError, Ct as buildView, D as RelationalQueryUnknownRelationError, Di as renderSchemaSource, Dn as migrateStatus, Dr as DbDialect, Dt as UuidBuilder, E as RelationalQueryThroughError, Ei as SetTableComment, En as migrateRollback, Er as DatabaseErrorInfo, Et as TimestampBuilder, F as RelationsDecl, Fn as MigrationsOnBoot, Fr as ResolvedRelation, Ft as doublePrecision, G as ilike, Gn as IntrospectSqliteOptions, Gr as DiffOptions, Gt as text, H as exists, Hi as MigrationRow, Hn as IntrospectMysqlOptions, Hr as RemovedValueAsDefaultError, Ht as serial, I as ThroughSpec, Ii as resolveDbConfig, In as kickDbAdapter, Ir as ResolvedRelations, It as integer, J as isNull, Jn as introspectSqliteAsync, Jr as diff, Jt as timestamptz, K as inArray, Kn as SqliteIntrospectDb, Kr as RenameCandidates, Kt as time, L as relations, Li as DriftBehavior, Ln as MigrationFiles, Lr as CompositeEnumReferenceError, Lt as interval, M as Relation, Mi as toKeyName, Mn as DB_PRIMARY, Mr as UniqueViolationError, Mt as char, N as RelationMany, Ni as DbConfig, Nn as DB_REPLICA, Nr as translateDbError, Nt as date, O as SchemaToRelationsRegister, Oi as fitIdentifier, On as migrateUp, Or as DeadlockError, Ot as bigSerial, P as RelationOne, Pn as KickDbAdapterConfig, Pr as TransactionFinishedError, Pt as decimal, Q as ne, Qn as MemoryMigrationAdapter, Qr as AddEnumValue, Qt as SeedResult, R as Operand, Ri as DriftLogger, Rn as MigrationsLocation, Rr as CompositeQueryRunner, Rt as json, S as RelationalQueryCancelledError, Si as RenameColumn, Sn as RunnerOptions, Sr as UnreviewedMigrationError, St as ViewOptions, T as RelationalQueryNotSupportedError, Ti as SetRowLevelSecurity, Tn as migrateLatest, Tr as DatabaseError, Tt as view, U as gt, Un as MysqlIntrospectDb, Ur as hasAmbiguousReverse, Ut as smallSerial, V as eq, Vi as MigrationBookkeeping, Vn as MigrationDb, Vr as KickDbError, Vt as real, W as gte, Wn as introspectMysql, Wr as invertChanges, Wt as smallint, X as lt, Xn as IntrospectPgOptions, Xr as AddCheck, Xt as varchar, Y as like, Yn as introspectPg, Yr as findRenameCandidates, Yt as uuid, Z as lte, Zn as PgQueryRunner, Zr as AddColumn, Zt as version, _ as LikeMatchMode, _i as DropPolicy, _n as TenantMigrationResult, _r as MigrationError, _t as tableFromClass, a as RawBuilder, ai as ChangeSet, an as generate, ar as quoteTable, at as alias, b as RelationalQueryAliasCollisionError, bi as PrimaryKeyShape, bn as ReversedSummary, br as MigrationLockError, bt as ViewDecl, c as SqlBool, ci as CreateRole, cn as emitSqlite, cr as appendJournalEntry, ct as Rule, d as KICK_DIALECT, di as CreateView, dn as PushResult, dr as verifyMigrationHash, dt as TableBase, ei as AddIndex, en as runSeeds, er as KICK_MIGRATIONS_TABLE, et as notExists, f as isDialectTag, fi as DropCheck, fn as pushSchema, fr as EnumDropHeader, ft as TableClass, g as desc, gi as DropIndex, gn as MigrateTenantsResult, gr as MigrationEnumDropError, gt as link, h as asc, hi as DropForeignKey, hn as MigrateTenantsOptions, hr as MigrationDriftError, ht as fk, i as KyselyPlugin, ii as Change, in as GenerateResult, ir as pushTableName, it as AliasedTable, j as customType, ji as toDbName, jn as DB_CLIENT, jr as SerializationFailureError, jt as bytea, k as CustomColumnBuilder, ki as extractSnapshot, kn as safeNullComparison, kr as ForeignKeyViolationError, kt as bigint, l as sql, li as CreateSchema, ln as emitPg, lr as computeMigrationHash, lt as RuleFor, m as readDialectMark, mi as DropEnum, mn as reviewMigration, mr as parseEnumDropHeader, mt as defineTable, n as ExpressionBuilder, ni as AlterPrimaryKey, nn as checkMigrations, nr as lockTableName, nt as notLike, o as ReadonlyKysely, oi as CreateEnum, on as emitMysql, or as Journal, ot as ClassRefs, p as markDialect, pi as DropColumn, pn as ReviewResult, pr as enforceEnumDropGate, pt as TableDefinition, q as isNotNull, qn as introspectSqlite, qr as RenameHints, qt as timestamp, r as Kysely, ri as AlterRole, rn as GenerateOptions, rr as migrationsTableDdl, rt as or, s as Sql, si as CreatePolicy, sn as SqliteRebuildRequiredError, sr as JournalEntry, st as NumberRule, t as Expression, ti as AlterColumn, tn as CheckResult, tr as lockTableDdl, tt as notInArray, u as DialectTag, ui as CreateTable, un as PushOptions, ur as readJournal, ut as StringRule, v as escapeLike, vi as DropTable, vn as migrateTenants, vr as MigrationFailedError, vt as selfRef, w as RelationalQueryMissingInverseError, wi as SetColumnComment, wn as migrateDown, wr as ConnectionError, wt as isView, x as RelationalQueryAmbiguousRelationNameError, xi as RemoveEnumValue, xn as RollbackSummary, xr as SchemaDiffSummary, xt as ViewMarks, y as likePattern, yi as DropView, yn as AppliedSummary, yr as MigrationHashError, yt as MaterializedViewOptions, z as and, zi as checkDrift, zn as migrationFiles, zr as CompositeRef, zt as jsonb } from "./index-CycSeW1r.mjs";
4
+ import { A as tenantKey, C as BypassInfo, D as TenancyStrategy, E as TenancyOptions, F as UpsertOptions, M as ExtensionDefinition, N as ModelExtensions, O as TenantRequiredError, P as FindOrCreateOptions, S as RegisteredDB, T as Tenancy, _ as RelationMapEntry, a as QueryErrorEvent, b as WithClause, c as TransactionEvent, d as TransactionRollbackEvent, f as FindManyOptions, g as RegisteredRelations, h as QueryNamespace, i as KickDbClientEvents, j as ExtendedClient, k as defineTenancy, l as TransactionOptions, m as KickDbRelationsRegister, n as CreateDbClientOptions, o as QueryEvent, p as FindManyRow, r as KickDbClient, t as BeforeQueryEvent, u as TransactionRetryEvent, v as TableQueryNamespace, w as BypassOptions, x as KickDbRegister, y as TableRelations } from "./types-BnYMhgYq.mjs";
5
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-CGPsm5i7.mjs";
6
6
  import { t as SchemaToTypes } from "./schema-types-DH-d43Pf.mjs";
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 DriftLogger, type DropCheck, type DropColumn, type DropEnum, type DropForeignKey, type DropIndex, type DropPolicy, type DropTable, type DropView, type EnumDropHeader, type EnumSnapshot, type ExtendedClient, type ExtensionDefinition, type FindManyOptions, type FindManyRow, type FindOrCreateOptions, type FkAction, type FkSpec, type ForeignKeySnapshot, ForeignKeyViolationError, type GenerateOptions, type GenerateResult, type GeneratedBrand, IndexDecl, IndexKey, type IndexSnapshot, type IntrospectMysqlOptions, type IntrospectPgOptions, type IntrospectSqliteOptions, type Journal, type JournalEntry, KICK_DIALECT, KICK_GENERATED, KICK_LOCK_TABLE, KICK_MIGRATIONS_TABLE, KICK_NOT_NULL, type KickDbAdapterConfig, type KickDbClient, type KickDbClientEvents, KickDbError, type KickDbRegister, type KickDbRelationsRegister, type LikeMatchMode, MaterializedViewOptions, MemoryMigrationAdapter, type MigrateTenantsOptions, type MigrateTenantsResult, type MigrationAdapter, type MigrationBookkeeping, type MigrationDb, MigrationDriftError, MigrationEnumDropError, MigrationError, MigrationFailedError, MigrationHashError, MigrationLockError, type MigrationRow, type MigrationsOnBoot, type ModelExtensions, type MysqlIntrospectDb, type NotNullBrand, NotNullViolationError, type NumberRule, Operand, type PgQueryRunner, PrimaryKeyDecl, type PrimaryKeyShape, QualifiedName, type QueryErrorEvent, type QueryEvent, type QueryNamespace, type ReadonlyKysely, type RegisteredDB, type RegisteredRelations, Relation, RelationMany, type RelationMapEntry, RelationOne, type RelationSnapshot, RelationalQueryAliasCollisionError, RelationalQueryAmbiguousRelationNameError, RelationalQueryCancelledError, RelationalQueryDepthError, RelationalQueryMissingInverseError, RelationalQueryNotSupportedError, 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 SeedResult, SerializationFailureError, type SetColumnComment, type SetRowLevelSecurity, type SetTableComment, 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 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, 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, migrationsTableDdl, ne, not, notExists, notInArray, notLike, numeric, or, parseEnumDropHeader, primaryKey, qualifiedTableName, quoteTable, readDialectMark, readJournal, real, relations, renderSchemaSource, resolveDbConfig, reviewMigration, runSeeds, safeNullComparison, selfRef, serial, smallSerial, smallint, table, tableFromClass, tenantKey, text, time, timestamp, timestamptz, toDbName, toKeyName, translateDbError, unique, unwrapTable, uuid, varchar, verifyMigrationHash, version, view };
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 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 FindManyOptions, type FindManyRow, type FindOrCreateOptions, type FkAction, type FkSpec, type ForeignKeySnapshot, ForeignKeyViolationError, type GenerateOptions, type GenerateResult, type GeneratedBrand, IndexDecl, IndexKey, type IndexSnapshot, type IntrospectMysqlOptions, type IntrospectPgOptions, type IntrospectSqliteOptions, type Journal, type JournalEntry, KICK_DIALECT, KICK_GENERATED, KICK_LOCK_TABLE, KICK_MIGRATIONS_TABLE, KICK_NOT_NULL, type KickDbAdapterConfig, type KickDbClient, type KickDbClientEvents, KickDbError, type KickDbRegister, type KickDbRelationsRegister, Kysely, type KyselyPlugin, type LikeMatchMode, 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, 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 ReadonlyKysely, type RegisteredDB, type RegisteredRelations, Relation, RelationMany, type RelationMapEntry, 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 SeedResult, 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 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, 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, 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.1.0
2
+ * @forinda/kickjs-db v8.3.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,4 +8,4 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{$ as RelationalQueryCancelledError,A as MigrationFailedError,B as NotNullViolationError,D as MigrationDriftError,E as emitPg,F as CheckViolationError,G as findRenameCandidates,H as UniqueViolationError,I as ConnectionError,L as DatabaseError,M as MigrationLockError,N as UnreviewedMigrationError,O as MigrationEnumDropError,P as TransactionFinishedError,Q as RelationalQueryAmbiguousRelationNameError,R as DeadlockError,S as verifyMigrationHash,St as fitIdentifier,T as parseEnumDropHeader,U as translateDbError,V as SerializationFailureError,W as diff,X as toKeyName,Y as toDbName,Z as RelationalQueryAliasCollisionError,_ as SqliteRebuildRequiredError,_t as table,a as markDialect,at as KickDbError,b as computeMigrationHash,c as defineTenancy,d as migrateLatest,et as RelationalQueryDepthError,f as migrateRollback,ft as buildView,g as emitMysql,gt as qualifiedTableName,h as checkDrift,ht as buildTable,i as isDialectTag,it as RelationalQueryUnknownRelationError,j as MigrationHashError,k as MigrationError,l as tenantKey,m as migrateUp,mt as view,n as KICK_DIALECT,nt as RelationalQueryNotSupportedError,o as readDialectMark,ot as RemovedValueAsDefaultError,p as migrateStatus,pt as isView,q as extractSnapshot,rt as RelationalQueryThroughError,s as TenantRequiredError,t as createDbClient,tt as RelationalQueryMissingInverseError,u as migrateDown,v as emitSqlite,vt as unwrapTable,w as enforceEnumDropGate,x as readJournal,y as appendJournalEntry,yt as selfRef,z as ForeignKeyViolationError}from"./create-CwuC1odW.mjs";import{$ as jsonb,A as unique,At as KICK_MIGRATIONS_TABLE,B as TimestampBuilder,C as notLike,Ct as kickDbAdapter,D as check,Dt as introspectPg,E as IndexDecl,Et as introspectSqliteAsync,F as fk,Ft as CompositeEnumReferenceError,G as bytea,H as bigSerial,I as link,It as detectCompositeReferences,J as decimal,K as char,L as tableFromClass,Lt as hasAmbiguousReverse,M as TableBase,Mt as lockTableName,N as TableDefinition,Nt as migrationsTableDdl,O as index,Ot as MemoryMigrationAdapter,P as defineTable,Pt as quoteTable,Q as json,Rt as invertChanges,S as notInArray,St as DB_REPLICA,T as alias,Tt as introspectSqlite,U as bigint,V as UuidBuilder,W as boolean,X as integer,Y as doublePrecision,Z as interval,_ as lt,_t as reviewMigration,a as relations,at as text,b as not,bt as DB_CLIENT,c as eq,ct as timestamptz,d as gte,dt as version,et as numeric,f as ilike,ft as listSeeds,g as like,gt as resolveDbConfig,h as isNull,ht as generate,i as likePattern,it as smallint,j as Rule,jt as lockTableDdl,k as primaryKey,kt as KICK_LOCK_TABLE,l as exists,lt as uuid,m as isNotNull,mt as checkMigrations,n as desc,nt as serial,o as and,ot as time,p as inArray,pt as runSeeds,q as date,r as escapeLike,rt as smallSerial,s as between,st as timestamp,t as asc,tt as real,u as gt,ut as varchar,v as lte,vt as migrateTenants,w as or,wt as introspectMysql,x as notExists,xt as DB_PRIMARY,y as ne,yt as safeNullComparison,zt as renderSchemaSource}from"./src-DUtVGG2c.mjs";import{a as KICK_NOT_NULL,i as KICK_GENERATED,n as customType,r as ColumnBuilder,t as CustomColumnBuilder}from"./custom-type-DeGuRFuz.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,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,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,migrationsTableDdl,ne,not,notExists,notInArray,notLike,numeric,or,parseEnumDropHeader,primaryKey,qualifiedTableName,quoteTable,readDialectMark,readJournal,real,relations,renderSchemaSource,resolveDbConfig,reviewMigration,runSeeds,safeNullComparison,selfRef,serial,smallSerial,smallint,table,tableFromClass,tenantKey,text,time,timestamp,timestamptz,toDbName,toKeyName,translateDbError,unique,unwrapTable,uuid,varchar,verifyMigrationHash,version,view};
11
+ import{$ as RelationalQueryAmbiguousRelationNameError,A as MigrationError,B as ForeignKeyViolationError,C as verifyMigrationHash,Ct as fitIdentifier,D as emitPg,E as parseEnumDropHeader,F as TransactionFinishedError,G as diff,H as SerializationFailureError,I as CheckViolationError,J as extractSnapshot,K as findRenameCandidates,L as ConnectionError,M as MigrationHashError,N as MigrationLockError,O as MigrationDriftError,P as UnreviewedMigrationError,Q as RelationalQueryAliasCollisionError,R as DatabaseError,S as readJournal,T as enforceEnumDropGate,U as UniqueViolationError,V as NotNullViolationError,W as translateDbError,X as toDbName,Z as toKeyName,_ as emitMysql,_t as qualifiedTableName,a as markDialect,at as RelationalQueryUnknownRelationError,b as appendJournalEntry,bt as selfRef,c as defineTenancy,d as migrateLatest,et as RelationalQueryCancelledError,f as migrateRollback,g as checkDrift,gt as buildTable,h as migrationFiles,ht as view,i as isDialectTag,it as RelationalQueryThroughError,j as MigrationFailedError,k as MigrationEnumDropError,l as tenantKey,m as migrateUp,mt as isView,n as KICK_DIALECT,nt as RelationalQueryMissingInverseError,o as readDialectMark,ot as KickDbError,p as migrateStatus,pt as buildView,rt as RelationalQueryNotSupportedError,s as TenantRequiredError,st as RemovedValueAsDefaultError,t as createDbClient,tt as RelationalQueryDepthError,u as migrateDown,v as SqliteRebuildRequiredError,vt as table,x as computeMigrationHash,y as emitSqlite,yt as unwrapTable,z as DeadlockError}from"./create-HnlQadLo.mjs";import{$ as interval,A as index,At as introspectPg,Bt as detectCompositeReferences,C as notExists,Ct as DB_CLIENT,D as alias,Dt as introspectMysql,E as or,Et as kickDbAdapter,F as TableDefinition,Ft as lockTableName,G as bigint,H as TimestampBuilder,Ht as invertChanges,I as defineTable,It as migrationsTableDdl,J as char,K as boolean,L as fk,Lt as pushTableName,M as unique,Mt as KICK_LOCK_TABLE,N as Rule,Nt as KICK_MIGRATIONS_TABLE,O as IndexDecl,Ot as introspectSqlite,P as TableBase,Pt as lockTableDdl,Q as integer,R as link,Rt as quoteTable,S as not,St as safeNullComparison,T as notLike,Tt as DB_REPLICA,U as UuidBuilder,Ut as renderSchemaSource,Vt as hasAmbiguousReverse,W as bigSerial,X as decimal,Y as date,Z as doublePrecision,_ as isNull,_t as resolveDbConfig,a as escapeLike,at as smallSerial,b as lte,bt as reviewMigration,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 checkMigrations,h as inArray,ht as runSeeds,i as desc,it as serial,j as primaryKey,jt as MemoryMigrationAdapter,k as check,kt as introspectSqliteAsync,l as between,lt as timestamp,m as ilike,mt as listSeeds,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 pushSchema,w as notInArray,wt as DB_PRIMARY,x as ne,xt as migrateTenants,y as lt,yt as generate,z as tableFromClass,zt as CompositeEnumReferenceError}from"./src-DtmQZMw4.mjs";import{a as KICK_NOT_NULL,i as KICK_GENERATED,n as customType,r as ColumnBuilder,t as CustomColumnBuilder}from"./custom-type-Ctbe_IU7.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,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,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
2
  import { t as ColumnBuilder } from "./types-DNAKmwPO.mjs";
3
- import { Ti as MigrationAdapter } from "./index-2fEnHqpn.mjs";
3
+ import { Bi as MigrationAdapter } from "./index-CycSeW1r.mjs";
4
4
  import { Dialect } from "kysely";
5
5
  //#region src/adapters/mysql/adapter.d.ts
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mysql.d.mts","names":[],"sources":["../src/adapters/mysql/adapter.ts","../src/adapters/mysql/dialect.ts","../src/dsl/columns/mysql.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBA+BiB;EAIf,MAAM,aAAa,aAAa,iBAAiB,SAAS;EAC1D;;iBAGe;EAEf,MAAM,aAAa,aAAa,iBAAiB,SAAS;EAC1D,iBAAiB,QAAQ;EACzB,QAAQ;;iBAGO;;;;;EAKf;;;;;;EAMA,MAAM;;;;;;;EA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HANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-db v8.1.0
2
+ * @forinda/kickjs-db v8.3.0
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,at as KickDbError,r as KICK_DIALECT_DATES}from"./create-CwuC1odW.mjs";import{Mt as lockTableName,Nt as migrationsTableDdl,Pt as quoteTable,jt as lockTableDdl,wt as introspectMysql}from"./src-DUtVGG2c.mjs";import{r as ColumnBuilder}from"./custom-type-DeGuRFuz.mjs";import{t as splitSqlStatements}from"./split-statements-BPCw9cII.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)],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
11
+ import{a as markDialect,ot as KickDbError,r as KICK_DIALECT_DATES}from"./create-HnlQadLo.mjs";import{Dt as introspectMysql,Ft as lockTableName,It as migrationsTableDdl,Lt as pushTableName,Pt as lockTableDdl,Rt as quoteTable}from"./src-DtmQZMw4.mjs";import{r as ColumnBuilder}from"./custom-type-Ctbe_IU7.mjs";import{t as splitSqlStatements}from"./split-statements-Cy-Bnpw-.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){let[result]=await pool.query(`UPDATE ${L}