@forinda/kickjs-db 5.2.2 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pg.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { t as ColumnBuilder } from "./types-Dc9RQGSf.mjs";
2
+ import { t as ColumnBuilder } from "./types-fdccN5bW.mjs";
3
3
 
4
4
  //#region src/dsl/columns/pg.d.ts
5
5
  /**
package/dist/pg.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-db v5.2.2
2
+ * @forinda/kickjs-db v5.4.1
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{t as ColumnBuilder}from"./types-Cxh6cDtw.mjs";var PgEnumColumnBuilder=class extends ColumnBuilder{enumName;values;constructor(enumName,values){super(enumName),this.enumName=enumName,this.values=values}};function pgEnum(name,...values){return Object.assign(()=>new PgEnumColumnBuilder(name,values),{enumName:name,values})}function tsvector(){return new ColumnBuilder(`tsvector`)}function vector(dim){return new ColumnBuilder(dim===void 0?`vector`:`vector(${dim})`)}function citext(){return new ColumnBuilder(`citext`)}function money(){return new ColumnBuilder(`money`)}function inet(){return new ColumnBuilder(`inet`)}function cidr(){return new ColumnBuilder(`cidr`)}function xml(){return new ColumnBuilder(`xml`)}export{PgEnumColumnBuilder,cidr,citext,inet,money,pgEnum,tsvector,vector,xml};
11
+ import{t as ColumnBuilder}from"./types-Ddl8seq-.mjs";var PgEnumColumnBuilder=class extends ColumnBuilder{enumName;values;constructor(enumName,values){super(enumName),this.enumName=enumName,this.values=values}};function pgEnum(name,...values){return Object.assign(()=>new PgEnumColumnBuilder(name,values),{enumName:name,values})}function tsvector(){return new ColumnBuilder(`tsvector`)}function vector(dim){return new ColumnBuilder(dim===void 0?`vector`:`vector(${dim})`)}function citext(){return new ColumnBuilder(`citext`)}function money(){return new ColumnBuilder(`money`)}function inet(){return new ColumnBuilder(`inet`)}function cidr(){return new ColumnBuilder(`cidr`)}function xml(){return new ColumnBuilder(`xml`)}export{PgEnumColumnBuilder,cidr,citext,inet,money,pgEnum,tsvector,vector,xml};
12
12
  //# sourceMappingURL=pg.mjs.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-db v5.2.2
2
+ * @forinda/kickjs-db v5.4.1
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}}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`},this}default(value){return this.state.default=value,this}toJSON(name){return{name,type:this.state.type,nullable:this.state.nullable,default:this.state.default,primaryKey:this.state.primaryKey}}__state(){return this.state}};export{KICK_GENERATED as n,KICK_NOT_NULL as r,ColumnBuilder as t};
12
- //# sourceMappingURL=types-Cxh6cDtw.mjs.map
12
+ //# sourceMappingURL=types-Ddl8seq-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-Cxh6cDtw.mjs","names":[],"sources":["../src/dsl/columns/types.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 */\nexport interface FkSpec {\n thunk: () => ColumnRef\n onDelete: FkAction\n onUpdate: FkAction\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\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 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 * 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 }\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(): ColumnBuilder<T[]> {\n this.state.type = `${this.state.type}[]`\n return this as unknown as ColumnBuilder<T[]>\n }\n\n references(\n target: () => ColumnRef,\n opts: { onDelete?: FkAction; onUpdate?: FkAction } = {},\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 }\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 default(value: string): this & GeneratedBrand {\n this.state.default = value\n return this as this & GeneratedBrand\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 }\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"],"mappings":";;;;;;;;;;AA6DA,MAAa,eAAiB,OAAO,IAAI,+BAA+B,CAc3D,cAAgB,OAAO,IAAI,6BAA6B,CAYrE,IAAa,cAAb,KAAwC,CAKtC,MAEA,YAAY,KAAc,SAAiC,EAAE,CAAE,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,KACpC,CAGH,SAA+B,CAE7B,MADA,MAAK,MAAM,SAAW,GACf,KAGT,YAAkC,CAGhC,MAFA,MAAK,MAAM,WAAa,GACxB,KAAK,MAAM,SAAW,GACf,KAGT,QAAe,CAEb,MADA,MAAK,MAAM,OAAS,GACb,KAGT,OAA4B,CAE1B,MADA,MAAK,MAAM,KAAO,GAAG,KAAK,MAAM,KAAK,IAC9B,KAGT,WACE,OACA,KAAqD,EAAE,CACjD,CAQN,MALA,MAAK,MAAM,WAAa,CACtB,MAAO,OACP,SAAU,KAAK,UAAY,YAC3B,SAAU,KAAK,UAAY,YAC5B,CACM,KAQT,QAAQ,MAAsC,CAE5C,MADA,MAAK,MAAM,QAAU,MACd,KAGT,OAAO,KAA8B,CACnC,MAAO,CACL,KACA,KAAM,KAAK,MAAM,KACjB,SAAU,KAAK,MAAM,SACrB,QAAS,KAAK,MAAM,QACpB,WAAY,KAAK,MAAM,WACxB,CAIH,SAAiC,CAC/B,OAAO,KAAK"}
1
+ {"version":3,"file":"types-Ddl8seq-.mjs","names":[],"sources":["../src/dsl/columns/types.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 */\nexport interface FkSpec {\n thunk: () => ColumnRef\n onDelete: FkAction\n onUpdate: FkAction\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\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 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 * 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 }\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(): ColumnBuilder<T[]> {\n this.state.type = `${this.state.type}[]`\n return this as unknown as ColumnBuilder<T[]>\n }\n\n references(\n target: () => ColumnRef,\n opts: { onDelete?: FkAction; onUpdate?: FkAction } = {},\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 }\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 default(value: string): this & GeneratedBrand {\n this.state.default = value\n return this as this & GeneratedBrand\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 }\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"],"mappings":";;;;;;;;;;AA6DA,MAAa,eAAiB,OAAO,IAAI,+BAA+B,CAc3D,cAAgB,OAAO,IAAI,6BAA6B,CAYrE,IAAa,cAAb,KAAwC,CAKtC,MAEA,YAAY,KAAc,SAAiC,EAAE,CAAE,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,KACpC,CAGH,SAA+B,CAE7B,MADA,MAAK,MAAM,SAAW,GACf,KAGT,YAAkC,CAGhC,MAFA,MAAK,MAAM,WAAa,GACxB,KAAK,MAAM,SAAW,GACf,KAGT,QAAe,CAEb,MADA,MAAK,MAAM,OAAS,GACb,KAGT,OAA4B,CAE1B,MADA,MAAK,MAAM,KAAO,GAAG,KAAK,MAAM,KAAK,IAC9B,KAGT,WACE,OACA,KAAqD,EAAE,CACjD,CAQN,MALA,MAAK,MAAM,WAAa,CACtB,MAAO,OACP,SAAU,KAAK,UAAY,YAC3B,SAAU,KAAK,UAAY,YAC5B,CACM,KAQT,QAAQ,MAAsC,CAE5C,MADA,MAAK,MAAM,QAAU,MACd,KAGT,OAAO,KAA8B,CACnC,MAAO,CACL,KACA,KAAM,KAAK,MAAM,KACjB,SAAU,KAAK,MAAM,SACrB,QAAS,KAAK,MAAM,QACpB,WAAY,KAAK,MAAM,WACxB,CAIH,SAAiC,CAC/B,OAAO,KAAK"}
@@ -43,12 +43,46 @@ interface EnumSnapshot {
43
43
  /** Allowed values, in declaration order. PG preserves the order. */
44
44
  values: readonly string[];
45
45
  }
46
+ /**
47
+ * Resolved relation graph attached as a sidecar on the snapshot.
48
+ * Lives on `SchemaSnapshot.relations` (optional). Keyed
49
+ * sourceTable → relationName → resolved entry. Consumed by the
50
+ * relational-query compiler in `packages/db/src/query/`. The
51
+ * migration pipeline does not read this field — relations are
52
+ * query-time sugar, not DDL.
53
+ *
54
+ * Shaped this way (rather than re-using the runtime `RelationsDecl`)
55
+ * so the snapshot stays JSON-serializable: no function thunks, no
56
+ * back-references to table objects.
57
+ */
58
+ interface RelationSnapshot {
59
+ kind: 'one' | 'many';
60
+ /** Target table name. */
61
+ target: string;
62
+ /** Columns on the source table that participate in the join. */
63
+ sourceColumns: readonly string[];
64
+ /** Columns on the target table that participate in the join. */
65
+ targetColumns: readonly string[];
66
+ /**
67
+ * Optional pairing tag from `relationName: 'foo'` on both sides of
68
+ * the relation. Disambiguates multi-FK schemas. See
69
+ * docs/db/spec-relation-name.md (M4.B).
70
+ */
71
+ relationName?: string;
72
+ }
46
73
  interface SchemaSnapshot {
47
74
  version: 1;
48
75
  dialect: Dialect;
49
76
  tables: Record<string, TableSnapshot>;
50
77
  /** ENUM types declared via `pgEnum()`. PG-only; absent on other dialects. */
51
78
  enums?: Record<string, EnumSnapshot>;
79
+ /**
80
+ * Optional relation sidecar populated when the schema includes
81
+ * `relations()` declarations. Absent when no relations are
82
+ * declared so M0/M1 callers see the same snapshot shape they
83
+ * always did.
84
+ */
85
+ relations?: Record<string, Record<string, RelationSnapshot>>;
52
86
  }
53
87
  //#endregion
54
88
  //#region src/dsl/columns/types.d.ts
@@ -158,5 +192,5 @@ declare class ColumnBuilder<T = unknown> {
158
192
  __state(): Readonly<ColumnState>;
159
193
  }
160
194
  //#endregion
161
- export { TableSnapshot as _, GeneratedBrand as a, NotNullBrand as c, Dialect as d, EnumSnapshot as f, SchemaSnapshot as g, IndexSnapshot as h, FkSpec as i, CheckSnapshot as l, ForeignKeySnapshot as m, ColumnRef as n, KICK_GENERATED as o, FkAction as p, ColumnState as r, KICK_NOT_NULL as s, ColumnBuilder as t, ColumnSnapshot as u };
162
- //# sourceMappingURL=types-Dc9RQGSf.d.mts.map
195
+ export { SchemaSnapshot as _, GeneratedBrand as a, NotNullBrand as c, Dialect as d, EnumSnapshot as f, RelationSnapshot as g, IndexSnapshot as h, FkSpec as i, CheckSnapshot as l, ForeignKeySnapshot as m, ColumnRef as n, KICK_GENERATED as o, FkAction as p, ColumnState as r, KICK_NOT_NULL as s, ColumnBuilder as t, ColumnSnapshot as u, TableSnapshot as v };
196
+ //# sourceMappingURL=types-fdccN5bW.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-fdccN5bW.d.mts","names":[],"sources":["../src/snapshot/types.ts","../src/dsl/columns/types.ts"],"mappings":";;KAAY,OAAA;AAAA,KAEA,QAAA;AAAA,UAEK,cAAA;EACf,IAAA;EACA,IAAA;EACA,QAAA;EACA,OAAA;EACA,UAAA;AAAA;AAAA,UAGe,aAAA;EACf,IAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,UAGe,kBAAA;EACf,IAAA;EACA,OAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA,EAAU,QAAA;EACV,QAAA,EAAU,QAAA;AAAA;AAAA,UAGK,aAAA;EACf,IAAA;EACA,UAAA;AAAA;AAAA,UAGe,aAAA;EACf,IAAA;EACA,OAAA,EAAS,MAAA,SAAe,cAAA;EACxB,OAAA,EAAS,aAAA;EACT,WAAA,EAAa,kBAAA;EACb,MAAA,EAAQ,aAAA;AAAA;;;;;;UAQO,YAAA;EACf,IAAA;EAvBU;EAyBV,MAAA;AAAA;;;AArBF;;;;;AAKA;;;;;UA+BiB,gBAAA;EACf,IAAA;EA3BQ;EA6BR,MAAA;EA7BqB;EA+BrB,aAAA;EAlCA;EAoCA,aAAA;EApCwB;;;;;EA0CxB,YAAA;AAAA;AAAA,UAGe,cAAA;EACf,OAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,EAAQ,MAAA,SAAe,aAAA;;EAEvB,KAAA,GAAQ,MAAA,SAAe,YAAA;EApCjB;AAeR;;;;;EA4BE,SAAA,GAAY,MAAA,SAAe,MAAA,SAAe,gBAAA;AAAA;;;AA3F5C;;;;;AAEA;;;;;AAEA;;;;AAJA,UCgBiB,SAAA;EACf,WAAA;EACA,MAAA;EACA,SAAA,EAAW,aAAA;EACX,OAAA,QAAe,UAAA,CAAW,aAAA;AAAA;;ADR5B;;;;;;;;;AAMA;;;UCkBiB,MAAA;EACf,KAAA,QAAa,SAAA;EACb,QAAA,EAAU,QAAA;EACV,QAAA,EAAU,QAAA;AAAA;AAAA,UAGK,WAAA;EACf,IAAA;EACA,QAAA;EACA,OAAA;EACA,UAAA;EACA,MAAA;EACA,UAAA,EAAY,MAAA;AAAA;;;;ADhBd;;;;;;;cC6Ba,cAAA;AAAA,KACD,cAAA;EAAA,UAA6B,cAAA;AAAA;;;;;;;;;;;;cAa5B,aAAA;AAAA,KACD,YAAA;EAAA,UAA2B,aAAA;AAAA;;ADbvC;;;;;;;;cCwBa,aAAA;EAAA,SAGM,GAAA,GAAM,CAAA;EAAA,UAEb,KAAA,EAAO,WAAA;cAEL,IAAA,UAAc,QAAA,GAAU,OAAA,CAAQ,WAAA;EAW5C,OAAA,CAAA,UAAkB,YAAA;EAKlB,UAAA,CAAA,UAAqB,YAAA;EAMrB,MAAA,CAAA;EAKA,KAAA,CAAA,GAAS,aAAA,CAAc,CAAA;EAKvB,UAAA,CACE,MAAA,QAAc,SAAA,EACd,IAAA;IAAQ,QAAA,GAAW,QAAA;IAAU,QAAA,GAAW,QAAA;EAAA;EDrCf;;;;;ECsD3B,OAAA,CAAQ,KAAA,kBAAuB,cAAA;EAK/B,MAAA,CAAO,IAAA,WAAe,cAAA;EAWtB,OAAA,CAAA,GAAW,QAAA,CAAS,WAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
 
2
2
  import * as _$kysely from "kysely";
3
- import { Dialect, Kysely } from "kysely";
3
+ import { Dialect, Expression, ExpressionBuilder, Kysely } from "kysely";
4
4
  import * as _$_forinda_kickjs_devtools_kit_bus0 from "@forinda/kickjs-devtools-kit/bus";
5
5
 
6
6
  //#region src/extend/types.d.ts
@@ -103,6 +103,140 @@ type RegisteredDB = KickDbRegister extends {
103
103
  qb: _$kysely.Kysely<infer X>;
104
104
  } ? X : unknown : unknown;
105
105
  //#endregion
106
+ //#region src/query/types.d.ts
107
+ /**
108
+ * Adopter-augmented at typegen time, mirroring `KickDbRegister`. The
109
+ * augmentation slots a record keyed by table name; each value is a
110
+ * record of `{ relationName: RelationMapEntry }`. The kick/db typegen
111
+ * plugin emits this alongside the column-shape augmentation.
112
+ *
113
+ * declare module '@forinda/kickjs-db' {
114
+ * interface KickDbRelationsRegister {
115
+ * db: {
116
+ * users: { posts: { kind: 'many'; target: 'posts' } }
117
+ * posts: { author: { kind: 'one'; target: 'users' }, comments: { kind: 'many'; target: 'comments' } }
118
+ * comments: { post: { kind: 'one'; target: 'posts' } }
119
+ * }
120
+ * }
121
+ * }
122
+ */
123
+ interface KickDbRelationsRegister {}
124
+ /**
125
+ * One relation entry in the registry — kind (`'one'` or `'many'`) +
126
+ * the target table name. The target is a plain string key so the
127
+ * registry stays decoupled from any particular `DB` generic; the
128
+ * compile-time check that `target` lives in the local `DB` happens
129
+ * inside `WithClause`.
130
+ *
131
+ * `relationName` (optional) is the pairing tag from
132
+ * `relations()`'s helpers. When set, the resolver uses it to pair
133
+ * `one` + `many` declarations across multi-FK schemas. See
134
+ * docs/db/spec-relation-name.md (M4.B).
135
+ */
136
+ interface RelationMapEntry {
137
+ kind: 'one' | 'many';
138
+ target: string;
139
+ relationName?: string;
140
+ }
141
+ /**
142
+ * The full registered relation graph. Falls back to an open-shaped
143
+ * record when the adopter hasn't augmented `KickDbRelationsRegister`,
144
+ * preserving the M1-permissive baseline.
145
+ */
146
+ type RegisteredRelations = KickDbRelationsRegister extends {
147
+ db: infer R;
148
+ } ? R extends Record<string, Record<string, RelationMapEntry>> ? R : Record<string, Record<string, RelationMapEntry>> : Record<string, Record<string, RelationMapEntry>>;
149
+ /**
150
+ * Pull the relation map for `Table`. Returns an empty record when the
151
+ * table has no declared relations (or no augmentation present at all),
152
+ * which makes `with` resolve to `Record<string, never>` — i.e. typing
153
+ * a `with: { ... }` becomes a compile error per key.
154
+ */
155
+ type TableRelations<Table extends string> = Table extends keyof RegisteredRelations ? RegisteredRelations[Table] extends Record<string, RelationMapEntry> ? RegisteredRelations[Table] : Record<string, never> : Record<string, never>;
156
+ /**
157
+ * Kysely's `ExpressionBuilder` exposed verbatim as the second arg
158
+ * to `where` / `orderBy` callbacks. Adopters use the callable form:
159
+ *
160
+ * where: (_u, eb) => eb('isActive', '=', true)
161
+ * orderBy: (_u, eb) => eb.ref('createdAt')
162
+ *
163
+ * Helpers like `eb.and(...)`, `eb.or(...)`, `eb.ref('col')`,
164
+ * `eb.fn.count(...)` are Kysely's standard surface. There is no
165
+ * `eb.eq` — that's the callable form. There is no `eb.desc` —
166
+ * order direction lands as a separate Kysely call (e.g. wrap the
167
+ * ref expression in `sql\`... desc\``) when needed in v1.
168
+ */
169
+ type QueryOps<DB, Table extends keyof DB & string> = ExpressionBuilder<DB, Table>;
170
+ /**
171
+ * The table-bound shape passed as the first arg to callbacks. The
172
+ * declared shape is `DB[Table]`, so `u.id` resolves to the row
173
+ * field's TS type at compile time — handy for type-narrowing in
174
+ * adapter-side helpers. At runtime, the same `u` is a Proxy whose
175
+ * property reads return Kysely column refs (`eb.ref('users.id')`),
176
+ * so `eb('id', '=', u.id)` Just Works for either layer-1 or
177
+ * relational-query call sites. Most adopters keep the first arg
178
+ * underscored and reach for `eb('col', op, value)` directly.
179
+ */
180
+ type TableRefs<DB, Table extends keyof DB & string> = DB[Table];
181
+ /**
182
+ * Options bag for `findMany` / `findFirst` / `findUnique`.
183
+ *
184
+ * `with` keys are constrained to the relations declared for `Table`;
185
+ * nested `with` recursively constrains in the same way. Boolean
186
+ * shorthand (`with: { posts: true }`) eager-loads with no
187
+ * per-relation filtering; the object form takes a nested
188
+ * `FindManyOptions` for the related table.
189
+ */
190
+ interface FindManyOptions<DB = RegisteredDB, Table extends keyof DB & string = keyof DB & string> {
191
+ where?: (table: TableRefs<DB, Table>, ops: QueryOps<DB, Table>) => Expression<unknown>;
192
+ orderBy?: (table: TableRefs<DB, Table>, ops: QueryOps<DB, Table>) => Expression<unknown> | Array<Expression<unknown>>;
193
+ limit?: number;
194
+ offset?: number;
195
+ /** Override the spec's default depth guard (5). Throws `RelationalQueryDepthError` on excess. */
196
+ maxDepth?: number;
197
+ with?: WithClause<DB, TableRelations<Table>>;
198
+ }
199
+ /**
200
+ * Per-relation shape inside `with`. `true` for boolean shorthand;
201
+ * a nested `FindManyOptions` for filtered eager loads. Only relations
202
+ * whose `target` is also a key of the local `DB` are accepted —
203
+ * cross-DB relations are unrepresentable at the call site.
204
+ */
205
+ type WithClause<DB, Rels extends Record<string, RelationMapEntry>> = { [K in keyof Rels]?: Rels[K]['target'] extends keyof DB & string ? true | FindManyOptions<DB, Rels[K]['target']> : never };
206
+ /**
207
+ * Resolved row shape returned by `findMany`. Base table columns
208
+ * intersected with the per-relation slot map produced by `with`.
209
+ */
210
+ type FindManyRow<DB, Table extends keyof DB & string, Opts extends FindManyOptions<DB, Table>> = DB[Table] & WithSlots<DB, Table, Opts['with']>;
211
+ /**
212
+ * Map each present `with` key to its resolved relation slot. Absent
213
+ * keys do not appear in the result shape — adopters who omit `with`
214
+ * get the bare row type back.
215
+ */
216
+ type WithSlots<DB, Table extends keyof DB & string, W> = W extends Record<string, unknown> ? { [K in keyof W & keyof TableRelations<Table>]: ResolveRelationSlot<DB, TableRelations<Table>[K], W[K]> } : {};
217
+ /**
218
+ * Resolve one slot. `one` returns `Related | null`; `many` returns
219
+ * `Related[]`. Nested options recurse through `FindManyRow`.
220
+ */
221
+ type ResolveRelationSlot<DB, R extends RelationMapEntry, V> = R['target'] extends keyof DB & string ? V extends true ? R['kind'] extends 'one' ? DB[R['target']] | null : DB[R['target']][] : V extends FindManyOptions<DB, R['target']> ? R['kind'] extends 'one' ? FindManyRow<DB, R['target'], V> | null : FindManyRow<DB, R['target'], V>[] : never : never;
222
+ /**
223
+ * Per-table query namespace exposed as `db.query.X`. v1 ships read
224
+ * methods only — writes route through layers 1 + 2 (`selectFrom`,
225
+ * `insertInto`, etc.).
226
+ */
227
+ interface TableQueryNamespace<DB, Table extends keyof DB & string> {
228
+ findMany<O extends FindManyOptions<DB, Table>>(options?: O): Promise<Array<FindManyRow<DB, Table, O>>>;
229
+ findFirst<O extends FindManyOptions<DB, Table>>(options?: O): Promise<FindManyRow<DB, Table, O> | null>;
230
+ findUnique<O extends FindManyOptions<DB, Table>>(options: O): Promise<FindManyRow<DB, Table, O> | null>;
231
+ }
232
+ /**
233
+ * Top-level `db.query` namespace. One slot per table in `DB`. Defaults
234
+ * to `RegisteredDB` so adopters using the bare `KickDbClient`
235
+ * (relying on the `KickDbRegister` augmentation) get the right shape
236
+ * without an explicit generic.
237
+ */
238
+ type QueryNamespace<DB = RegisteredDB> = { [Table in keyof DB & string]: TableQueryNamespace<DB, Table> };
239
+ //#endregion
106
240
  //#region src/client/types.d.ts
107
241
  interface QueryEvent {
108
242
  sql: string;
@@ -171,6 +305,19 @@ interface KickDbClient<DB = RegisteredDB> {
171
305
  insertInto: Kysely<DB>['insertInto'];
172
306
  updateTable: Kysely<DB>['updateTable'];
173
307
  deleteFrom: Kysely<DB>['deleteFrom'];
308
+ /**
309
+ * Relational query namespace — `db.query.users.findMany({ with: {
310
+ * posts: true } })`. PG-only in v1; SQLite + MySQL adopters get a
311
+ * `RelationalQueryNotSupportedError` on first call. The shape is
312
+ * inferred from the local `DB` generic (which itself defaults to
313
+ * `RegisteredDB` so adopters using the bare `KickDbClient` still
314
+ * see the right table set).
315
+ *
316
+ * Available `with` keys come from the `KickDbRelationsRegister`
317
+ * augmentation emitted by the kick/db typegen plugin alongside
318
+ * the column-shape augmentation.
319
+ */
320
+ readonly query: QueryNamespace<DB>;
174
321
  on<E extends keyof KickDbClientEvents>(event: E, listener: (e: KickDbClientEvents[E]) => void | Promise<void>): this;
175
322
  off<E extends keyof KickDbClientEvents>(event: E, listener: (e: KickDbClientEvents[E]) => void | Promise<void>): this;
176
323
  transaction<T>(fn: (tx: KickDbClient<DB>) => Promise<T>): Promise<T>;
@@ -251,5 +398,5 @@ interface CreateDbClientOptions<TSchema, _DB = unknown> {
251
398
  bus?: _$_forinda_kickjs_devtools_kit_bus0.KickEventBus;
252
399
  }
253
400
  //#endregion
254
- export { QueryErrorEvent as a, TransactionEvent as c, RegisteredDB as d, ExtendedClient as f, KickDbClientEvents as i, TransactionRollbackEvent as l, ModelExtensions as m, CreateDbClientOptions as n, QueryEvent as o, ExtensionDefinition as p, KickDbClient as r, SlowQueryEvent as s, BeforeQueryEvent as t, KickDbRegister as u };
255
- //# sourceMappingURL=types-DlFKeljT.d.mts.map
401
+ export { ModelExtensions as C, ExtensionDefinition as S, TableRelations as _, QueryErrorEvent as a, RegisteredDB as b, TransactionEvent as c, FindManyRow as d, KickDbRelationsRegister as f, TableQueryNamespace as g, RelationMapEntry as h, KickDbClientEvents as i, TransactionRollbackEvent as l, RegisteredRelations as m, CreateDbClientOptions as n, QueryEvent as o, QueryNamespace as p, KickDbClient as r, SlowQueryEvent as s, BeforeQueryEvent as t, FindManyOptions as u, WithClause as v, ExtendedClient as x, KickDbRegister as y };
402
+ //# sourceMappingURL=types-s-I0Eb5S.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-s-I0Eb5S.d.mts","names":[],"sources":["../src/extend/types.ts","../src/client/register.ts","../src/query/types.ts","../src/client/types.ts"],"mappings":";;;;;;;;;;AA2CA;;;KAAY,eAAA,yBACM,EAAA,aAAe,MAAA,aAAmB,IAAA;;;;;;AASpD;UAAiB,eAAA;EAAe;EAE9B,KAAA,EAAO,OAAA,CAAQ,MAAA,OAAa,GAAA;EAAb;EAEf,OAAA,GAAU,GAAA,EAAK,GAAA;AAAA;;;;;KAOL,gBAAA,yBACM,EAAA,aAAe,MAAA,SAAe,eAAA,CAAgB,EAAA,CAAG,KAAA;;UAIlD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,OAAA;EH/CD;EGiDP,OAAA,EAAS,OAAA;EHjDe;;;;;;EGwDxB,MAAA;EHxDmF;AAUrF;;;;;EGqDE,oBAAA;EHpDqC;;;;;;;;;;;;;;;;;;;;;;;;;;;EGgFrC,GAAA,GA1CsB,mCAAA,CA0C2B,YAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forinda/kickjs-db",
3
- "version": "5.2.2",
3
+ "version": "5.4.1",
4
4
  "description": "KickJS-native ORM — code-first schema, reversible migrations, multi-dialect SQL builder",
5
5
  "keywords": [
6
6
  "kickjs",
@@ -11,7 +11,12 @@
11
11
  "mysql",
12
12
  "migrations",
13
13
  "query-builder",
14
- "@forinda/kickjs"
14
+ "@forinda/kickjs",
15
+ "@forinda/kickjs-db",
16
+ "@forinda/kickjs-db-pg",
17
+ "@forinda/kickjs-db-sqlite",
18
+ "@forinda/kickjs-db-mysql",
19
+ "@forinda/kickjs-cli"
15
20
  ],
16
21
  "type": "module",
17
22
  "main": "dist/index.mjs",
@@ -66,7 +71,7 @@
66
71
  "@types/pg": "^8.11.10",
67
72
  "kysely": "^0.28.16",
68
73
  "pg": "^8.13.1",
69
- "typescript": "^5.9.2",
74
+ "typescript": "^6.0.3",
70
75
  "@forinda/kickjs": "5.4.0",
71
76
  "@forinda/kickjs-devtools-kit": "5.3.1"
72
77
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-Dc9RQGSf.d.mts","names":[],"sources":["../src/snapshot/types.ts","../src/dsl/columns/types.ts"],"mappings":";;KAAY,OAAA;AAAA,KAEA,QAAA;AAAA,UAEK,cAAA;EACf,IAAA;EACA,IAAA;EACA,QAAA;EACA,OAAA;EACA,UAAA;AAAA;AAAA,UAGe,aAAA;EACf,IAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,UAGe,kBAAA;EACf,IAAA;EACA,OAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA,EAAU,QAAA;EACV,QAAA,EAAU,QA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