arkormx 2.10.2 → 2.11.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.
@@ -1,7 +1,7 @@
1
- import { Collection } from "@h3ravel/collect.js";
2
1
  import { Kysely, Transaction } from "kysely";
3
- import { Command } from "@h3ravel/musket";
4
2
  import { PrismaClient } from "@prisma/client";
3
+ import { Collection } from "@h3ravel/collect.js";
4
+ import { Command } from "@h3ravel/musket";
5
5
 
6
6
  //#region src/types/migrations.d.ts
7
7
  type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'decimal' | 'boolean' | 'json' | 'date' | 'dateTime' | 'timestamp';
@@ -33,6 +33,13 @@ interface SchemaColumn {
33
33
  precision?: number;
34
34
  /** Number of digits to the right of the decimal point for `decimal` columns. */
35
35
  scale?: number;
36
+ /**
37
+ * SQL expression for a database-computed column (`GENERATED ALWAYS AS (…)`).
38
+ * The expression must be immutable and reference only the row's own columns.
39
+ */
40
+ generatedExpression?: string;
41
+ /** Whether the generated column is `STORED` (Postgres only supports stored). */
42
+ generatedStored?: boolean;
36
43
  primaryKeyGeneration?: PrimaryKeyGeneration;
37
44
  }
38
45
  interface SchemaIndex {
@@ -259,6 +266,81 @@ interface DatabaseTableOptions {
259
266
  timestampColumns?: TimestampColumnBehavior[];
260
267
  }
261
268
  //#endregion
269
+ //#region src/types/expression.d.ts
270
+ /**
271
+ * Serializable expression nodes produced by the expression builder (`col`, `val`,
272
+ * `raw`, `caseWhen`, `coalesce`, `json`, aggregate helpers, …).
273
+ *
274
+ * The query builder stays adapter-agnostic: it stores these nodes on the query
275
+ * spec and each {@link DatabaseAdapter} compiles (or rejects) them. Every node is
276
+ * discriminated by its `kind`.
277
+ */
278
+ type ExpressionBinaryOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'like' | 'ilike' | 'not-like' | 'not-ilike' | 'and' | 'or' | '+' | '-' | '*' | '/';
279
+ type ExpressionJsonCast = 'text' | 'number' | 'boolean';
280
+ interface ColumnExpressionNode {
281
+ kind: 'column';
282
+ /** Logical model attribute, or a joined `table.column` reference. */
283
+ name: string;
284
+ }
285
+ interface ValueExpressionNode {
286
+ kind: 'value';
287
+ value: DatabaseValue;
288
+ }
289
+ interface RawExpressionNode {
290
+ kind: 'raw';
291
+ sql: string;
292
+ bindings: DatabaseValue[];
293
+ }
294
+ interface JsonExpressionNode {
295
+ kind: 'json';
296
+ column: string;
297
+ /** Path segments below the base column (`metadata->billType` => `['billType']`). */
298
+ path: string[];
299
+ /** Optional scalar cast applied to the extracted text value. */
300
+ cast?: ExpressionJsonCast;
301
+ }
302
+ interface CaseExpressionBranch {
303
+ when: ExpressionNode;
304
+ then: ExpressionNode;
305
+ }
306
+ interface CaseExpressionNode {
307
+ kind: 'case';
308
+ cases: CaseExpressionBranch[];
309
+ else?: ExpressionNode;
310
+ }
311
+ interface FunctionExpressionNode {
312
+ kind: 'function';
313
+ name: string;
314
+ args: ExpressionNode[];
315
+ }
316
+ interface BinaryExpressionNode {
317
+ kind: 'binary';
318
+ operator: ExpressionBinaryOperator;
319
+ left: ExpressionNode;
320
+ right: ExpressionNode;
321
+ }
322
+ interface InExpressionNode {
323
+ kind: 'in';
324
+ operand: ExpressionNode;
325
+ values: ExpressionNode[];
326
+ not: boolean;
327
+ }
328
+ interface NullCheckExpressionNode {
329
+ kind: 'null-check';
330
+ operand: ExpressionNode;
331
+ not: boolean;
332
+ }
333
+ interface AggregateExpressionNode {
334
+ kind: 'aggregate';
335
+ fn: AggregateOperation;
336
+ /** Argument expression; omitted for `count(*)`. */
337
+ arg?: ExpressionNode;
338
+ distinct?: boolean;
339
+ /** Boolean-valued predicate compiled to `FILTER (WHERE …)` on Postgres. */
340
+ filter?: ExpressionNode;
341
+ }
342
+ type ExpressionNode = ColumnExpressionNode | ValueExpressionNode | RawExpressionNode | JsonExpressionNode | CaseExpressionNode | FunctionExpressionNode | BinaryExpressionNode | InExpressionNode | NullCheckExpressionNode | AggregateExpressionNode;
343
+ //#endregion
262
344
  //#region src/types/factories.d.ts
263
345
  type FactoryAttributes = Record<string, unknown>;
264
346
  type MaybePromise<T> = T | Promise<T>;
@@ -2324,6 +2406,166 @@ declare class InlineFactory<TModel, TAttributes extends FactoryAttributes> exten
2324
2406
  */
2325
2407
  declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Partial<ModelAttributes<TModel>>>(model: FactoryModelConstructor<TModel>, definition: FactoryDefinition<TAttributes>) => ModelFactory<TModel, TAttributes>;
2326
2408
  //#endregion
2409
+ //#region src/Expression.d.ts
2410
+ /**
2411
+ * A composable SQL expression. Instances are immutable — every operator returns a
2412
+ * new expression — and are accepted by `select`, `where`, `groupBy`, `orderBy`,
2413
+ * `having`, and the aggregate helpers. Adapters compile the underlying node tree.
2414
+ */
2415
+ declare abstract class Expression {
2416
+ /**
2417
+ * Serializes this expression to an adapter-compilable {@link ExpressionNode}.
2418
+ */
2419
+ abstract toExpressionNode(): ExpressionNode;
2420
+ /**
2421
+ * Type guard for values that came out of the expression builder.
2422
+ */
2423
+ static isExpression(value: unknown): value is Expression;
2424
+ eq(value: unknown): Expression;
2425
+ ne(value: unknown): Expression;
2426
+ gt(value: unknown): Expression;
2427
+ gte(value: unknown): Expression;
2428
+ lt(value: unknown): Expression;
2429
+ lte(value: unknown): Expression;
2430
+ like(value: unknown): Expression;
2431
+ ilike(value: unknown): Expression;
2432
+ notLike(value: unknown): Expression;
2433
+ notIlike(value: unknown): Expression;
2434
+ in(values: readonly unknown[]): Expression;
2435
+ notIn(values: readonly unknown[]): Expression;
2436
+ isNull(): Expression;
2437
+ isNotNull(): Expression;
2438
+ and(other: Expression): Expression;
2439
+ or(other: Expression): Expression;
2440
+ plus(value: unknown): Expression;
2441
+ minus(value: unknown): Expression;
2442
+ times(value: unknown): Expression;
2443
+ dividedBy(value: unknown): Expression;
2444
+ }
2445
+ /**
2446
+ * Fluent `CASE … WHEN … THEN … ELSE … END` builder. Immutable.
2447
+ */
2448
+ declare class CaseExpression extends Expression {
2449
+ private readonly branches;
2450
+ private readonly elseExpr?;
2451
+ constructor(branches: CaseBranch[], elseExpr?: Expression | undefined);
2452
+ when(condition: Expression, result: unknown): CaseExpression;
2453
+ else(result: unknown): CaseExpression;
2454
+ toExpressionNode(): ExpressionNode;
2455
+ }
2456
+ interface CaseBranch {
2457
+ when: Expression;
2458
+ then: Expression;
2459
+ }
2460
+ /**
2461
+ * JSON-path value extraction (`metadata ->> 'billType'`), with optional casts.
2462
+ */
2463
+ declare class JsonExpression extends Expression {
2464
+ private readonly column;
2465
+ private readonly path;
2466
+ private readonly castTo?;
2467
+ constructor(column: string, path: string[], castTo?: ExpressionJsonCast | undefined);
2468
+ asText(): JsonExpression;
2469
+ asNumber(): JsonExpression;
2470
+ asBoolean(): JsonExpression;
2471
+ toExpressionNode(): ExpressionNode;
2472
+ }
2473
+ /**
2474
+ * Aggregate expression (`sum`, `count`, `avg`, `min`, `max`) with optional filter.
2475
+ */
2476
+ declare class AggregateExpression extends Expression {
2477
+ private readonly fn;
2478
+ private readonly arg?;
2479
+ private readonly options;
2480
+ constructor(fn: AggregateOperation, arg?: Expression | undefined, options?: {
2481
+ distinct?: boolean;
2482
+ filterExpr?: Expression;
2483
+ });
2484
+ /**
2485
+ * Restricts the aggregate to rows matching `predicate` (`FILTER (WHERE …)`).
2486
+ */
2487
+ filter(predicate: Expression): AggregateExpression;
2488
+ distinct(): AggregateExpression;
2489
+ toExpressionNode(): ExpressionNode;
2490
+ }
2491
+ /**
2492
+ * Rebuilds an {@link Expression} around an already-serialized node.
2493
+ */
2494
+ declare const fromExpressionNode: (node: ExpressionNode) => Expression;
2495
+ /**
2496
+ * A typed column reference. Supports joined `table.column` syntax.
2497
+ */
2498
+ declare const col: (name: string) => Expression;
2499
+ /**
2500
+ * A bound literal value (parameterized, never interpolated).
2501
+ */
2502
+ declare const val: (value: DatabaseValue) => Expression;
2503
+ /**
2504
+ * Raw SQL escape hatch with positional `?` bindings.
2505
+ */
2506
+ declare const raw: (sql: string, bindings?: DatabaseValue[]) => Expression;
2507
+ /**
2508
+ * Starts a `CASE WHEN condition THEN result` expression.
2509
+ */
2510
+ declare const caseWhen: (condition: Expression, result: unknown) => CaseExpression;
2511
+ /**
2512
+ * `COALESCE(a, b, …)` — first non-null argument. Bare strings are columns.
2513
+ */
2514
+ declare const coalesce: (...args: unknown[]) => Expression;
2515
+ /**
2516
+ * An arbitrary SQL function call. Bare-string arguments are treated as columns.
2517
+ */
2518
+ declare const fn: (name: string, ...args: unknown[]) => Expression;
2519
+ /**
2520
+ * JSON value extraction: `json('metadata', 'billType')` => `metadata ->> 'billType'`.
2521
+ */
2522
+ declare const json: (column: string, ...path: Array<string | number>) => JsonExpression;
2523
+ /**
2524
+ * `SUM(expr)`; a bare-string argument is treated as a column.
2525
+ */
2526
+ declare const sum: (arg: unknown) => AggregateExpression;
2527
+ /**
2528
+ * `AVG(expr)`; a bare-string argument is treated as a column.
2529
+ */
2530
+ declare const avg: (arg: unknown) => AggregateExpression;
2531
+ /**
2532
+ * `MIN(expr)`; a bare-string argument is treated as a column.
2533
+ */
2534
+ declare const min: (arg: unknown) => AggregateExpression;
2535
+ /**
2536
+ * `MAX(expr)`; a bare-string argument is treated as a column.
2537
+ */
2538
+ declare const max: (arg: unknown) => AggregateExpression;
2539
+ /**
2540
+ * `COUNT(expr)` — or `COUNT(*)` when called without an argument.
2541
+ */
2542
+ declare const count: (arg?: unknown) => AggregateExpression;
2543
+ /**
2544
+ * Builds a comparison predicate: `where('createdAt', '>=', boundary)`. Handy as an
2545
+ * inline predicate for `caseWhen`, `having`, and aggregate `.filter(…)`.
2546
+ */
2547
+ declare const where: (column: string, operator: QueryScalarComparisonOperator | "like" | "ilike" | "not like" | "not ilike" | "<>" | "==", value: unknown) => Expression;
2548
+ /**
2549
+ * The expression-builder namespace passed to `static computed` factories, so a
2550
+ * model can declare a virtual attribute as `category: (e) => e.coalesce(…)`.
2551
+ */
2552
+ declare const expressionBuilder: {
2553
+ readonly col: (name: string) => Expression;
2554
+ readonly val: (value: DatabaseValue) => Expression;
2555
+ readonly raw: (sql: string, bindings?: DatabaseValue[]) => Expression;
2556
+ readonly caseWhen: (condition: Expression, result: unknown) => CaseExpression;
2557
+ readonly coalesce: (...args: unknown[]) => Expression;
2558
+ readonly fn: (name: string, ...args: unknown[]) => Expression;
2559
+ readonly json: (column: string, ...path: Array<string | number>) => JsonExpression;
2560
+ readonly sum: (arg: unknown) => AggregateExpression;
2561
+ readonly avg: (arg: unknown) => AggregateExpression;
2562
+ readonly min: (arg: unknown) => AggregateExpression;
2563
+ readonly max: (arg: unknown) => AggregateExpression;
2564
+ readonly count: (arg?: unknown) => AggregateExpression;
2565
+ readonly where: (column: string, operator: QueryScalarComparisonOperator | "like" | "ilike" | "not like" | "not ilike" | "<>" | "==", value: unknown) => Expression;
2566
+ };
2567
+ type ExpressionBuilder = typeof expressionBuilder;
2568
+ //#endregion
2327
2569
  //#region src/Model.d.ts
2328
2570
  /**
2329
2571
  * Base model class that all models should extend.
@@ -2336,6 +2578,7 @@ declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Pa
2336
2578
  declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
2337
2579
  private static readonly lifecycleStates;
2338
2580
  private static readonly castMapCache;
2581
+ private static readonly computedCache;
2339
2582
  private static readonly emittedDeprecationWarnings;
2340
2583
  private static eventsSuppressed;
2341
2584
  protected static factoryClass?: new () => ModelFactory<any, any>;
@@ -2355,6 +2598,18 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2355
2598
  protected static softDeletes: boolean;
2356
2599
  protected static deletedAtColumn: string;
2357
2600
  protected static globalScopes: Record<string, GlobalScope>;
2601
+ /**
2602
+ * Expression-backed virtual attributes. Each factory receives the expression
2603
+ * builder and returns an {@link Expression}; the name may then be used in
2604
+ * `select`, `where`, `groupBy`, `orderBy`, and `having`, and is expanded inline
2605
+ * during query building.
2606
+ *
2607
+ * @example
2608
+ * static computed = {
2609
+ * category: (e) => e.coalesce(e.col('override.category'), e.val('other')),
2610
+ * }
2611
+ */
2612
+ protected static computed?: Record<string, (builder: ExpressionBuilder) => Expression>;
2358
2613
  protected static eventListeners: Partial<Record<ModelEventName, ModelEventListener<any>[]>>;
2359
2614
  protected static dispatchesEvents: Partial<Record<ModelEventName, ModelEventDispatcher<any> | ModelEventDispatcher<any>[]>>;
2360
2615
  protected casts: CastMap;
@@ -2403,6 +2658,11 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2403
2658
  * instance field) and cached per model class.
2404
2659
  */
2405
2660
  static getCasts(): CastMap;
2661
+ /**
2662
+ * Resolves the model's `static computed` declarations into expression nodes,
2663
+ * cached per class. Returns an empty map when no computed attributes exist.
2664
+ */
2665
+ static getComputed(): Record<string, ExpressionNode>;
2406
2666
  /**
2407
2667
  * Apply built-in persistence casts (currently `json` serialisation) to a raw
2408
2668
  * attribute payload, without re-running arbitrary custom setters. Used by
@@ -3246,6 +3506,49 @@ type ModelLifecycleState = {
3246
3506
  };
3247
3507
  //#endregion
3248
3508
  //#region src/QueryBuilder.d.ts
3509
+ /** Object select projection whose values may be expressions, columns, or booleans. */
3510
+ type ExpressionSelectMap = Record<string, Expression | boolean | string>;
3511
+ /** Callback invoked with each chunk of results; return `false` to stop early. */
3512
+ type ChunkCallback<TModel> = (models: ArkormCollection<TModel>, page: number) => unknown | Promise<unknown>;
3513
+ /** Callback invoked with each record during `each`/`eachById`; return `false` to stop. */
3514
+ type EachCallback<TModel> = (model: TModel, index: number) => unknown | Promise<unknown>;
3515
+ /** Map of model attributes selected for an aggregate (`{ amount: true }`). */
3516
+ type AggregateColumnMap<TModel> = Partial<Record<keyof ModelAttributes<TModel> & string, true>>;
3517
+ /**
3518
+ * Prisma-style grouped-aggregate request: group by `by` columns and compute the
3519
+ * requested `_sum`/`_avg`/`_min`/`_max`/`_count` aggregates per group.
3520
+ */
3521
+ interface GroupByAggregateSpec<TModel> {
3522
+ by: Array<keyof ModelAttributes<TModel> & string>;
3523
+ _count?: true | AggregateColumnMap<TModel>;
3524
+ _sum?: AggregateColumnMap<TModel>;
3525
+ _avg?: AggregateColumnMap<TModel>;
3526
+ _min?: AggregateColumnMap<TModel>;
3527
+ _max?: AggregateColumnMap<TModel>;
3528
+ }
3529
+ type SameTypeAggregate<TModel, TMap> = { [K in keyof TMap]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown };
3530
+ /** The typed plain row returned for a {@link GroupByAggregateSpec} query. */
3531
+ type GroupByAggregateRow<TModel, TSpec extends GroupByAggregateSpec<TModel>> = { [K in TSpec['by'][number]]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown } & (TSpec extends {
3532
+ _count: infer C;
3533
+ } ? {
3534
+ _count: C extends AggregateColumnMap<TModel> ? { [K in keyof C]: number } : number;
3535
+ } : object) & (TSpec extends {
3536
+ _sum: infer S;
3537
+ } ? {
3538
+ _sum: { [K in keyof S]: number | null };
3539
+ } : object) & (TSpec extends {
3540
+ _avg: infer A;
3541
+ } ? {
3542
+ _avg: { [K in keyof A]: number | null };
3543
+ } : object) & (TSpec extends {
3544
+ _min: infer M;
3545
+ } ? {
3546
+ _min: SameTypeAggregate<TModel, M>;
3547
+ } : object) & (TSpec extends {
3548
+ _max: infer M;
3549
+ } ? {
3550
+ _max: SameTypeAggregate<TModel, M>;
3551
+ } : object);
3249
3552
  /**
3250
3553
  * The QueryBuilder class provides a fluent interface for building and
3251
3554
  * executing database queries.
@@ -3294,6 +3597,7 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3294
3597
  */
3295
3598
  where(where: QuerySchemaWhere<TDelegate>): this;
3296
3599
  where(callback: WhereCallback<TModel, TDelegate>): this;
3600
+ where(expression: Expression): this;
3297
3601
  /**
3298
3602
  * Adds an OR where clause to the query. Pass a callback to build a
3299
3603
  * parenthesized group of nested conditions.
@@ -3303,6 +3607,13 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3303
3607
  */
3304
3608
  orWhere(where: QuerySchemaWhere<TDelegate>): this;
3305
3609
  orWhere(callback: WhereCallback<TModel, TDelegate>): this;
3610
+ orWhere(expression: Expression): this;
3611
+ /**
3612
+ * Appends a boolean {@link Expression} as a where predicate. When the query is
3613
+ * using the Prisma-like legacy where representation, the expression is merged in
3614
+ * as a structured condition alongside it.
3615
+ */
3616
+ private appendExpressionCondition;
3306
3617
  /**
3307
3618
  * Resolve a callback into a parenthesized group condition and append it.
3308
3619
  */
@@ -3747,6 +4058,17 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3747
4058
  * @returns
3748
4059
  */
3749
4060
  orderBy(orderBy: QuerySchemaOrderBy<TDelegate>): this;
4061
+ orderBy(expression: Expression, direction?: 'asc' | 'desc'): this;
4062
+ /**
4063
+ * Appends a raw SQL `order by` fragment (with positional `?` bindings), useful
4064
+ * for ordering by a computed expression the builder does not model directly.
4065
+ *
4066
+ * @param sql
4067
+ * @param bindings
4068
+ * @param direction
4069
+ * @returns
4070
+ */
4071
+ orderByRaw(sql: string, bindings?: DatabaseValue[], direction?: 'asc' | 'desc'): this;
3750
4072
  /**
3751
4073
  * Puts the query results in random order.
3752
4074
  *
@@ -4003,6 +4325,7 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4003
4325
  * @returns
4004
4326
  */
4005
4327
  select(select: QuerySchemaSelect<TDelegate>): this;
4328
+ select(select: Record<string, Expression | boolean | string>): this;
4006
4329
  /**
4007
4330
  * Appends columns or expressions to the existing select clause.
4008
4331
  *
@@ -4010,6 +4333,7 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4010
4333
  * @returns
4011
4334
  */
4012
4335
  addSelect(select: QuerySchemaSelect<TDelegate>): this;
4336
+ addSelect(select: Record<string, Expression | boolean | string>): this;
4013
4337
  /**
4014
4338
  * Apply or remove DISTINCT from the select query.
4015
4339
  *
@@ -4025,8 +4349,48 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4025
4349
  */
4026
4350
  groupBy<TKey extends keyof ModelAttributes<TModel> & string>(columns: TKey[]): this;
4027
4351
  groupBy<TKey extends keyof ModelAttributes<TModel> & string>(...columns: TKey[]): this;
4352
+ groupBy(columns: Array<string | Expression>): this;
4353
+ groupBy(...columns: Array<string | Expression>): this;
4354
+ groupBy<TSpec extends GroupByAggregateSpec<TModel>>(spec: TSpec): Promise<GroupByAggregateRow<TModel, TSpec>[]>;
4355
+ /**
4356
+ * Appends a raw SQL `group by` fragment (with positional `?` bindings), mirroring
4357
+ * `whereRaw`/`havingRaw`. Combines with any columns/expressions already grouped.
4358
+ *
4359
+ * @param sql
4360
+ * @param bindings
4361
+ * @returns
4362
+ */
4363
+ groupByRaw(sql: string, bindings?: DatabaseValue[]): this;
4364
+ /**
4365
+ * Resolves the recorded group-by sources into adapter {@link QueryGroupByItem}s.
4366
+ * A bare string that matches a select-column alias is expanded to that column's
4367
+ * underlying expression (group-by-alias); otherwise it is treated as a column.
4368
+ */
4369
+ private buildGroupByItems;
4370
+ private isGroupByAggregateSpec;
4371
+ /**
4372
+ * Executes the query and returns plain, un-hydrated rows keyed by their select
4373
+ * alias — the natural shape for `select` + `groupBy` aggregate reports. Pass a
4374
+ * row type to describe the projection.
4375
+ *
4376
+ * @returns
4377
+ */
4378
+ getRows<TRow = Record<string, DatabaseValue>>(): Promise<TRow[]>;
4379
+ /**
4380
+ * Runs a Prisma-style grouped aggregate and returns typed rows shaped as
4381
+ * `{ <by columns>, _sum, _avg, _min, _max, _count }`.
4382
+ */
4383
+ private executeGroupByAggregate;
4384
+ private coerceNumeric;
4028
4385
  private appendHavingCondition;
4029
4386
  private buildHavingComparison;
4387
+ /**
4388
+ * Resolves the three `having` call shapes into a condition: `having(column, …)`,
4389
+ * `having(expression)` (a boolean expression predicate), and
4390
+ * `having(expression, operator, value)` (compare an aggregate to a value).
4391
+ */
4392
+ private buildHavingCondition;
4393
+ private compareExpression;
4030
4394
  /**
4031
4395
  * Adds a HAVING clause to filter grouped rows. Accepts either
4032
4396
  * `having(column, value)` (defaulting to equality) or
@@ -4039,6 +4403,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4039
4403
  */
4040
4404
  having(column: string, value: DatabaseValue): this;
4041
4405
  having(column: string, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4406
+ having(expression: Expression): this;
4407
+ having(expression: Expression, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4042
4408
  /**
4043
4409
  * Adds an OR HAVING clause to filter grouped rows.
4044
4410
  *
@@ -4049,6 +4415,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4049
4415
  */
4050
4416
  orHaving(column: string, value: DatabaseValue): this;
4051
4417
  orHaving(column: string, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4418
+ orHaving(expression: Expression): this;
4419
+ orHaving(expression: Expression, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4052
4420
  /**
4053
4421
  * Adds a raw HAVING clause, useful for filtering on aggregate expressions
4054
4422
  * such as `count(*)`. Combines with previous HAVING clauses using AND.
@@ -4276,6 +4644,88 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4276
4644
  * @returns
4277
4645
  */
4278
4646
  get(): Promise<ArkormCollection<TModel>>;
4647
+ /**
4648
+ * Processes the query results in chunks, invoking the callback with each chunk
4649
+ * as a collection. Return `false` from the callback to stop early. Resolves to
4650
+ * `false` when stopped early, otherwise `true`.
4651
+ *
4652
+ * Chunking pages with `offset`/`limit`, so add an `orderBy` for stable results
4653
+ * and prefer {@link chunkById} when modifying the records being iterated.
4654
+ *
4655
+ * @param count Rows per chunk.
4656
+ * @param callback Receives each chunk and its 1-based page number.
4657
+ * @returns
4658
+ */
4659
+ chunk(count: number, callback: ChunkCallback<TModel>): Promise<boolean>;
4660
+ /**
4661
+ * Chunks the results by comparing a monotonically increasing key column
4662
+ * (`id > lastId`) rather than by offset — safe when the callback updates the
4663
+ * records being iterated. Return `false` from the callback to stop early.
4664
+ *
4665
+ * @param count Rows per chunk.
4666
+ * @param callback Receives each chunk and its 1-based page number.
4667
+ * @param column The key column to page by (defaults to the primary key).
4668
+ * @param alias The result attribute holding the key value (defaults to `column`).
4669
+ * @returns
4670
+ */
4671
+ chunkById(count: number, callback: ChunkCallback<TModel>, column?: string, alias?: string): Promise<boolean>;
4672
+ /**
4673
+ * Iterates the query results one record at a time (chunking under the hood).
4674
+ * Return `false` from the callback to stop early.
4675
+ *
4676
+ * @param callback Receives each record and its 0-based index.
4677
+ * @param count Rows fetched per chunk (default 1000).
4678
+ * @returns
4679
+ */
4680
+ each(callback: EachCallback<TModel>, count?: number): Promise<boolean>;
4681
+ /**
4682
+ * Like {@link each}, but pages by key column ({@link chunkById}) — safe when the
4683
+ * callback updates the records being iterated.
4684
+ *
4685
+ * @param callback Receives each record and its 0-based index.
4686
+ * @param count Rows fetched per chunk (default 1000).
4687
+ * @param column The key column to page by (defaults to the primary key).
4688
+ * @param alias The result attribute holding the key value (defaults to `column`).
4689
+ * @returns
4690
+ */
4691
+ eachById(callback: EachCallback<TModel>, count?: number, column?: string, alias?: string): Promise<boolean>;
4692
+ /**
4693
+ * Streams the query results lazily as an async iterator, fetching one chunk at
4694
+ * a time so only a small window is held in memory. Iterate with `for await`.
4695
+ *
4696
+ * ```ts
4697
+ * for await (const user of User.query().orderBy({ id: 'asc' }).lazy()) {
4698
+ * // …
4699
+ * }
4700
+ * ```
4701
+ *
4702
+ * @param chunkSize Rows fetched per underlying query (default 1000).
4703
+ * @returns
4704
+ */
4705
+ lazy(chunkSize?: number): AsyncGenerator<TModel>;
4706
+ /**
4707
+ * Streams the results lazily, paging by an ascending key column — safe when the
4708
+ * consumer updates records mid-iteration. Iterate with `for await`.
4709
+ *
4710
+ * @param chunkSize Rows fetched per underlying query (default 1000).
4711
+ * @param column The key column to page by (defaults to the primary key).
4712
+ * @param alias The result attribute holding the key value (defaults to `column`).
4713
+ * @returns
4714
+ */
4715
+ lazyById(chunkSize?: number, column?: string, alias?: string): AsyncGenerator<TModel>;
4716
+ /**
4717
+ * Streams the results lazily, paging by a descending key column. Iterate with
4718
+ * `for await`.
4719
+ *
4720
+ * @param chunkSize Rows fetched per underlying query (default 1000).
4721
+ * @param column The key column to page by (defaults to the primary key).
4722
+ * @param alias The result attribute holding the key value (defaults to `column`).
4723
+ * @returns
4724
+ */
4725
+ lazyByIdDesc(chunkSize?: number, column?: string, alias?: string): AsyncGenerator<TModel>;
4726
+ private lazyByKey;
4727
+ private assertPositiveChunkSize;
4728
+ private readModelAttribute;
4279
4729
  /**
4280
4730
  * Executes the query and returns the first result as a model
4281
4731
  * instance, or null if no results are found.
@@ -4635,6 +5085,17 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4635
5085
  private tryBuildFieldCondition;
4636
5086
  private tryBuildQueryCondition;
4637
5087
  private tryBuildSelectSpec;
5088
+ /** Reads and caches the model's resolved `static computed` expression map. */
5089
+ private computedAttributes;
5090
+ /**
5091
+ * Expands references to `static computed` attribute names into their backing
5092
+ * expressions across a select spec's columns, group by, order by, where, and
5093
+ * having clauses. A no-op when the model declares no computed attributes.
5094
+ */
5095
+ private expandComputedAttributes;
5096
+ private expandComputedCondition;
5097
+ /** Converts a where comparison against a computed attribute into an expression. */
5098
+ private computedComparison;
4638
5099
  private tryBuildAggregateSpec;
4639
5100
  private requireAdapter;
4640
5101
  private executeReadRows;
@@ -5084,7 +5545,7 @@ type DatabasePrimitive = string | number | boolean | bigint | Date | null;
5084
5545
  type DatabaseValue = DatabasePrimitive | DatabaseRow | DatabaseValue[];
5085
5546
  type DatabaseRow = Record<string, unknown>;
5086
5547
  type DatabaseRows = DatabaseRow[];
5087
- type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'upsert' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawSelect' | 'rawWhere' | 'distinct' | 'groupBy' | 'joins';
5548
+ type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'upsert' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawSelect' | 'rawWhere' | 'distinct' | 'groupBy' | 'joins' | 'expressions';
5088
5549
  type AdapterCapabilities = Partial<Record<AdapterCapability, boolean>>;
5089
5550
  type QueryLogicalOperator = 'and' | 'or';
5090
5551
  type QueryComparisonOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'not-in' | 'contains' | 'starts-with' | 'ends-with' | 'is-null' | 'is-not-null';
@@ -5108,11 +5569,30 @@ interface QuerySelectColumn {
5108
5569
  alias?: string;
5109
5570
  raw?: boolean;
5110
5571
  wildcard?: boolean;
5572
+ /** A compiled expression projected in place of a physical column. */
5573
+ expression?: ExpressionNode;
5111
5574
  }
5112
5575
  interface QueryOrderBy {
5113
5576
  column: string;
5114
5577
  direction: SortDirection;
5578
+ /** Orders by a compiled expression instead of a physical column. */
5579
+ expression?: ExpressionNode;
5115
5580
  }
5581
+ /**
5582
+ * A `GROUP BY` entry: either a logical column name (string) or a compiled
5583
+ * expression / raw fragment. The query builder resolves select-alias grouping to
5584
+ * the underlying expression before it reaches the adapter.
5585
+ */
5586
+ type QueryGroupByItem = string | {
5587
+ alias: string;
5588
+ } | {
5589
+ expression: ExpressionNode;
5590
+ } | {
5591
+ raw: {
5592
+ sql: string;
5593
+ bindings?: DatabaseValue[];
5594
+ };
5595
+ };
5116
5596
  interface QueryComparisonCondition {
5117
5597
  type: 'comparison';
5118
5598
  column: string;
@@ -5179,7 +5659,12 @@ interface RawQuerySpec {
5179
5659
  sql: string;
5180
5660
  bindings?: DatabaseValue[];
5181
5661
  }
5182
- type QueryCondition = QueryComparisonCondition | QueryColumnComparisonCondition | QueryTimeCondition | QueryDayCondition | QueryExistsCondition | QueryFullTextCondition | QueryJsonCondition | QueryGroupCondition | QueryNotCondition | QueryRawCondition;
5662
+ /** A boolean-valued expression used directly as a predicate (where / having). */
5663
+ interface QueryExpressionCondition {
5664
+ type: 'expression';
5665
+ expression: ExpressionNode;
5666
+ }
5667
+ type QueryCondition = QueryComparisonCondition | QueryColumnComparisonCondition | QueryTimeCondition | QueryDayCondition | QueryExistsCondition | QueryFullTextCondition | QueryJsonCondition | QueryExpressionCondition | QueryGroupCondition | QueryNotCondition | QueryRawCondition;
5183
5668
  interface AggregateSelection {
5184
5669
  type: AggregateOperation;
5185
5670
  column?: string;
@@ -5258,7 +5743,7 @@ interface SelectSpec<TModel = unknown> {
5258
5743
  target: QueryTarget<TModel>;
5259
5744
  columns?: QuerySelectColumn[];
5260
5745
  distinct?: boolean;
5261
- groupBy?: string[];
5746
+ groupBy?: QueryGroupByItem[];
5262
5747
  having?: QueryCondition;
5263
5748
  joins?: QueryJoin[];
5264
5749
  where?: QueryCondition;
@@ -5536,6 +6021,22 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
5536
6021
  private buildFullTextCondition;
5537
6022
  private buildJsonAccessor;
5538
6023
  private buildJsonCondition;
6024
+ /**
6025
+ * Compiles a serialized {@link ExpressionNode} into a parameterized SQL fragment.
6026
+ * Shared by expression-backed select columns, `group by`, `order by`, and any
6027
+ * boolean expression used as a `where`/`having` predicate.
6028
+ *
6029
+ * @param target
6030
+ * @param node
6031
+ * @returns
6032
+ */
6033
+ private buildExpression;
6034
+ private buildExpressionColumn;
6035
+ private buildBinaryExpression;
6036
+ private buildAggregateExpression;
6037
+ private buildJsonValueExpression;
6038
+ private buildRawExpressionFragment;
6039
+ private sanitizeFunctionName;
5539
6040
  private buildWhereCondition;
5540
6041
  private buildWhereClause;
5541
6042
  private buildPaginationClause;
@@ -6476,7 +6977,8 @@ declare class MakeSeederCommand extends Command<CliApp> {
6476
6977
  //#region src/cli/commands/MigrateCommand.d.ts
6477
6978
  /**
6478
6979
  * The MigrateCommand class implements the CLI command for applying migration
6479
- * classes to the Prisma schema and running the Prisma workflow.
6980
+ * classes to the database or Prisma schema and running the Prisma workflow when
6981
+ * using the Prisma compatibility driver.
6480
6982
  *
6481
6983
  * @author Legacy (3m1n3nc3)
6482
6984
  * @since 0.1.0
@@ -6488,8 +6990,8 @@ declare class MigrateCommand extends Command<CliApp> {
6488
6990
  * Command handler for the migrate command.
6489
6991
  * This method is responsible for orchestrating the migration
6490
6992
  * process, including loading migration classes, applying them to
6491
- * the Prisma schema, and running the appropriate Prisma commands
6492
- * based on the provided options.
6993
+ * the the database or Prisma schema, and running the appropriate Prisma commands
6994
+ * when using the Prisma compatibility driver based on the provided options.
6493
6995
  *
6494
6996
  * @returns
6495
6997
  */
@@ -6666,6 +7168,19 @@ declare class ForeignKeyBuilder {
6666
7168
  as(fieldName: string): this;
6667
7169
  }
6668
7170
  //#endregion
7171
+ //#region src/helpers/generated-column.d.ts
7172
+ /**
7173
+ * The two ways to declare a generated column's expression: a raw SQL string, or a
7174
+ * factory that builds one with the expression builder.
7175
+ */
7176
+ type GeneratedColumnExpression = string | ((builder: ExpressionBuilder) => Expression);
7177
+ /**
7178
+ * Resolves a generated-column expression into raw Postgres SQL. Generated columns
7179
+ * cannot carry bind parameters (they must be immutable), so literal values are
7180
+ * inlined and aggregates are rejected.
7181
+ */
7182
+ declare const resolveGeneratedExpression: (expression: GeneratedColumnExpression) => string;
7183
+ //#endregion
6669
7184
  //#region src/database/TableBuilder.d.ts
6670
7185
  /**
6671
7186
  * The EnumBuilder class provides a fluent interface for configuring enum columns
@@ -6875,6 +7390,28 @@ declare class TableBuilder {
6875
7390
  * @returns The current TableBuilder instance for chaining.
6876
7391
  */
6877
7392
  dateTime(name: string, options?: Partial<SchemaColumn>): this;
7393
+ /**
7394
+ * Defines a database-computed column (`GENERATED ALWAYS AS (…) STORED`). The
7395
+ * expression may be a raw SQL string or an expression-builder factory, and must
7396
+ * be immutable and reference only the row's own columns. Combine with
7397
+ * {@link index} to index the generated value.
7398
+ *
7399
+ * @example
7400
+ * table.generated('category', "case when metadata->>'kind' = 'a' then 'x' else 'y' end", {
7401
+ * type: 'text',
7402
+ * })
7403
+ * table.generated('total', (e) => e.col('price').times(e.col('quantity')), { type: 'integer' })
7404
+ *
7405
+ * @param name The generated column name.
7406
+ * @param expression The SQL expression string, or a builder factory.
7407
+ * @param options Column type (default `text`), `stored` flag, and nullability.
7408
+ * @returns
7409
+ */
7410
+ generated(name: string, expression: GeneratedColumnExpression, options?: {
7411
+ type?: SchemaColumnType;
7412
+ stored?: boolean;
7413
+ nullable?: boolean;
7414
+ }): this;
6878
7415
  /**
6879
7416
  * Defines colonns for a polymorphic relationship in the table.
6880
7417
  *
@@ -7906,4 +8443,4 @@ declare class URLDriver {
7906
8443
  url(page: number): string;
7907
8444
  }
7908
8445
  //#endregion
7909
- export { buildRelationLine as $, DelegateForModelSchema as $a, EagerLoadConstraint as $i, RuntimePathMap as $n, RelatedModelFromResult as $o, QueryFullTextCondition as $r, TimestampNames as $s, getPersistedColumnMap as $t, isTransactionCapableClient as A, QuerySchemaUniqueWhere as Aa, UpsertSpec as Ai, ForeignKeyBuilder as An, HasOneRelation as Ao, AdapterModelFieldStructure as Ar, RelationMetadataType as As, createEmptyAppliedMigrationsState as At, applyDropTableOperation as B, TransactionCapableClient as Ba, CastType as Bi, MakeFactoryCommand as Bn, RelationAggregateType as Bo, DatabaseRow as Br, PrismaSchemaSyncOptions as Bs, removeAppliedMigration as Bt, getRuntimeDebugHandler as C, QuerySchemaCreateData as Ca, RelationLoadPlan as Ci, ArkormException as Cn, defineFactory as Co, createPrismaDatabaseAdapter as Cr, ModelMetadata as Cs, supportsDatabaseMigrationExecution as Ct, getUserConfig as D, QuerySchemaRow as Da, SortDirection as Di, SchemaBuilder as Dn, MorphOneRelation as Do, AdapterCapability as Dr, MorphToRelationMetadata as Ds, buildMigrationIdentity as Dt, getRuntimePrismaClient as E, QuerySchemaOrderBy as Ea, SoftDeleteQueryMode as Ei, Migration as En, MorphToManyRelation as Eo, AdapterCapabilities as Er, MorphToManyRelationMetadata as Es, toModelName as Et, PRISMA_ENUM_MEMBER_REGEX as F, RuntimeClientLike as Fa, ArkormDebugEvent as Fi, MigrateFreshCommand as Fn, BelongsToManyRelation as Fo, AggregateOperation as Fr, GeneratedMigrationFile as Fs, isMigrationApplied as Ft, applyOperationsToPrismaSchema as G, QueryBuilder as Ga, DelegateOrderBy as Gi, AttributeOptions as Gn, RelationMetadataProvider as Go, InsertManySpec as Gr, SchemaIndex as Gs, PersistedColumnMappingsState as Gt, applyMigrationRollbackToPrismaSchema as H, TransactionOptions as Ha, DelegateCreateData as Hi, CliApp as Hn, RelationConstraint as Ho, DatabaseValue as Hr, SchemaColumnType as Hs, supportsDatabaseMigrationState as Ht, PRISMA_ENUM_REGEX as I, Serializable as Ia, ArkormDebugHandler as Ii, MigrateCommand as In, Relation as Io, AggregateSelection as Ir, MigrationClass as Is, markMigrationApplied as It, buildIndexLine as J, AttributeQuerySchema as Ja, DelegateSelect as Ji, RegisteredFactory as Jn, RelationTableLookupSpec as Jo, QueryComparisonCondition as Jr, SchemaTableAlterOperation as Js, PersistedTableMetadata as Jt, buildEnumBlock as K, AttributeCreateInput as Ka, DelegateRow as Ki, Arkorm as Kn, RelationResult as Ko, InsertSpec as Kr, SchemaOperation as Ks, PersistedMetadataFeatures as Kt, PRISMA_MODEL_REGEX as L, SimplePaginationMeta as La, CastDefinition as Li, MakeSeederCommand as Ln, RelationTableLoader as Lo, AggregateSpec as Lr, MigrationInstanceLike as Ls, markMigrationRun as Lt, resetArkormRuntimeForTests as M, QuerySchemaUpdateData as Ma, AdapterQueryInspection as Mi, ModelsSyncCommand as Mn, HasManyRelation as Mo, AdapterModelStructure as Mr, AppliedMigrationRun as Ms, findAppliedMigration as Mt, runArkormTransaction as N, QuerySchemaWhere as Na, ArkormBootContext as Ni, MigrationHistoryCommand as Nn, BelongsToRelation as No, AdapterQueryOperation as Nr, AppliedMigrationsState as Ns, getLastMigrationRun as Nt, isDelegateLike as O, QuerySchemaRows as Oa, UpdateManySpec as Oi, EnumBuilder as On, MorphManyRelation as Oo, AdapterDatabaseCreationResult as Or, PivotModelStatic as Os, buildMigrationRunId as Ot, PrimaryKeyGenerationPlanner as P, RawSelectInput as Pa, ArkormConfig as Pi, MigrateRollbackCommand as Pn, SingleResultRelation as Po, AdapterTransactionContext as Pr, GenerateMigrationOptions as Ps, getLatestAppliedMigrations as Pt, buildPrimaryKeyLine as Q, AttributeWhereInput as Qa, DelegateWhere as Qi, RuntimePathKey as Qn, RelatedModelForRelationship as Qo, QueryExistsCondition as Qr, TimestampColumnBehavior as Qs, deletePersistedColumnMappingsState as Qt, applyAlterTableOperation as R, SoftDeleteConfig as Ra, CastHandler as Ri, MakeModelCommand as Rn, RelationAggregateConstraint as Ro, DatabaseAdapter as Rr, PrimaryKeyGeneration as Rs, readAppliedMigrationsState as Rt, getRuntimeClient as S, PrismaTransactionOptions as Sa, RelationFilterSpec as Si, ArkormErrorContext as Sn, ModelFactory as So, createPrismaCompatibilityAdapter as Sr, HasOneThroughRelationMetadata as Ss, supportsDatabaseCreation as St, getRuntimePaginationURLDriverFactory as T, QuerySchemaInclude as Ta, SelectSpec as Ti, MIGRATION_BRAND as Tn, MorphToRelation as To, createKyselyAdapter as Tr, MorphOneRelationMetadata as Ts, toMigrationFileSlug as Tt, applyMigrationToDatabase as U, ModelStatic as Ua, DelegateFindManyArgs as Ui, resolveCast as Un, RelationDefaultResolver as Uo, DeleteManySpec as Ur, SchemaForeignKey as Us, writeAppliedMigrationsState as Ut, applyMigrationRollbackToDatabase as V, TransactionContext as Va, ClientResolver as Vi, InitCommand as Vn, RelationColumnLookupSpec as Vo, DatabaseRows as Vr, SchemaColumn as Vs, resolveMigrationStateFilePath as Vt, applyMigrationToPrismaSchema as W, RelationshipModelStatic as Wa, DelegateInclude as Wi, Attribute as Wn, RelationDefaultValue as Wo, DeleteSpec as Wr, SchemaForeignKeyAction as Ws, writeAppliedMigrationsStateToStore as Wt, buildMigrationSource as X, AttributeSelect as Xa, DelegateUpdateArgs as Xi, RuntimeConstructor as Xn, JoinOn as Xo, QueryCondition as Xr, SchemaTableDropOperation as Xs, applyOperationsToPersistedColumnMappingsState as Xt, buildInverseRelationLine as Y, AttributeSchemaDelegate as Ya, DelegateUniqueWhere as Yi, RegisteredModel as Yn, EagerLoadRelations as Yo, QueryComparisonOperator as Yr, SchemaTableCreateOperation as Ys, PersistedTimestampColumn as Yt, buildModelBlock as Z, AttributeUpdateInput as Za, DelegateUpdateData as Zi, RuntimePathInput as Zn, JoinSource as Zo, QueryDayCondition as Zr, SchemaUniqueConstraint as Zs, createEmptyPersistedColumnMappingsState as Zt, ensureArkormConfigLoading as _, PrismaLikeSortOrder as _a, QuerySelectColumn as _i, QueryExecutionException as _n, QuerySchemaForModel as _o, SeederCallArgument as _r, BelongsToRelationMetadata as _s, resolveMigrationClassName as _t, getRuntimeCompatibilityAdapter as a, PaginationCurrentPageResolver as aa, QueryJoinNestedConstraint as ai, readPersistedColumnMappingsState as an, ModelDeclaredAttributeKey as ao, loadFactoriesFrom as ar, FactoryAttributeResolver as as, deriveRelationFieldName as at, getDefaultStubsPath as b, PrismaTransactionCapableClient as ba, RawQuerySpec as bi, ModelNotFoundException as bn, Model as bo, PrismaDatabaseAdapter as br, HasManyThroughRelationMetadata as bs, runPrismaCommand as bt, PrismaDelegateMap as c, PaginationURLDriver as ca, QueryJoinType as ci, resolveColumnMappingsFilePath as cn, ModelEventHandlerConstructor as co, loadSeedersFrom as cr, FactoryDefinition as cs, findEnumBlock as ct, inferDelegateName as d, PrismaDelegateLike as da, QueryJsonConditionKind as di, validatePersistedMetadataFeaturesForMigrations as dn, ModelLifecycleState as do, registerModels as dr, FactoryRelationshipResolver as ds, formatEnumDefaultValue as dt, EagerLoadMap as ea, TimestampNaming as ec, QueryGroupCondition as ei, getPersistedEnumMap as en, GlobalScope as eo, getRegisteredFactories as er, WhereCallback as es, buildUniqueConstraintLine as et, awaitConfiguredModelsRegistration as f, PrismaFindManyArgsLike as fa, QueryLogicalOperator as fi, writePersistedColumnMappingsState as fn, ModelOrderByInput as fo, registerPaths as fr, FactoryState as fs, formatRelationAction as ft, emitRuntimeDebugEvent as g, PrismaLikeSelect as ga, QueryScalarComparisonOperator as gi, RelationResolutionException as gn, ModelWhereInput as go, Seeder as gr, BelongsToManyRelationMetadata as gs, resolveEnumName as gt, defineConfig as h, PrismaLikeScalarFilter as ha, QueryRawCondition as hi, ScopeNotDefinedException as hn, ModelUpdateData as ho, SEEDER_BRAND as hr, DatabaseTablePersistedMetadataOptions as hs, pad as ht, RuntimeModuleLoader as i, NamingCase as ia, QueryJoinConstraint as ii, getPersistedTimestampColumns as in, ModelCreateData as io, getRegisteredSeeders as ir, ArkormCollection as is, deriveRelationAlias as it, loadArkormConfig as j, QuerySchemaUpdateArgs as ja, AdapterBindableModel as ji, SeedCommand as jn, HasManyThroughRelation as jo, AdapterModelIntrospectionOptions as jr, AppliedMigrationEntry as js, deleteAppliedMigrationsStateFromStore as jt, isQuerySchemaLike as k, QuerySchemaSelect as ka, UpdateSpec as ki, TableBuilder as kn, HasOneThroughRelation as ko, AdapterInspectionRequest as kr, RelationMetadata as ks, computeMigrationChecksum as kt, createPrismaAdapter as l, PaginationURLDriverFactory as la, QueryJoinValueConstraint as li, resolvePersistedMetadataFeatures as ln, ModelEventListener as lo, registerFactories as lr, FactoryDefinitionAttributes as ls, findModelBlock as lt, configureArkormRuntime as m, PrismaLikeOrderBy as ma, QueryOrderBy as mi, UniqueConstraintResolutionException as mn, ModelRelationshipResult as mo, resetRuntimeRegistryForTests as mr, DatabaseTableOptions as ms, getMigrationPlan as mt, PivotModel as n, ModelQuerySchemaLike as na, QueryJoinBoolean as ni, getPersistedPrimaryKeyGeneration as nn, ModelAttributes as no, getRegisteredModels as nr, LengthAwarePaginator as ns, deriveCollectionFieldName as nt, resolveRuntimeCompatibilityQuerySchema as o, PaginationMeta as oa, QueryJoinNullConstraint as oi, rebuildPersistedColumnMappingsState as on, ModelEventDispatcher as oo, loadMigrationsFrom as or, FactoryAttributes as os, deriveSingularFieldName as ot, bindAdapterToModels as p, PrismaLikeInclude as pa, QueryNotCondition as pi, UnsupportedAdapterFeatureException as pn, ModelRelationshipKey as po, registerSeeders as pr, MaybePromise as ps, generateMigrationFile as pt, buildFieldLine as q, AttributeOrderBy as qa, DelegateRows as qi, Arkormx as qn, RelationResultCache as qo, QueryColumnComparisonCondition as qr, SchemaPrimaryKey as qs, PersistedPrimaryKeyGeneration as qt, LoadedRuntimeModule as r, ModelTableCase as ra, QueryJoinColumnConstraint as ri, getPersistedTableMetadata as rn, ModelAttributesOf as ro, getRegisteredPaths as rr, Paginator as rs, deriveInverseRelationAlias as rt, resolveRuntimeCompatibilityQuerySchemaOrThrow as s, PaginationOptions as sa, QueryJoinRawConstraint as si, resetPersistedColumnMappingsCache as sn, ModelEventHandler as so, loadModelsFrom as sr, FactoryCallback as ss, escapeRegex as st, URLDriver as t, GetUserConfig as ta, QueryJoin as ti, getPersistedEnumTsType as tn, ModelAttributeValue as to, getRegisteredMigrations as tr, JoinClause as ts, createMigrationTimestamp as tt, createPrismaDelegateMap as u, PrismaClientLike as ua, QueryJsonCondition as ui, syncPersistedColumnMappingsFromState as un, ModelEventName as uo, registerMigrations as ur, FactoryModelConstructor as us, formatDefaultValue as ut, getActiveTransactionAdapter as v, PrismaLikeWhereInput as va, QueryTarget as vi, QueryExecutionExceptionContext as vn, QuerySchemaForModelInstance as vo, SeederConstructor as vr, ColumnMap as vs, resolvePrismaType as vt, getRuntimePaginationCurrentPageResolver as w, QuerySchemaFindManyArgs as wa, RelationLoadSpec as wi, DB as wn, SetBasedEagerLoader as wo, KyselyDatabaseAdapter as wr, MorphManyRelationMetadata as ws, supportsDatabaseReset as wt, getRuntimeAdapter as x, PrismaTransactionContext as xa, RelationAggregateSpec as xi, MissingDelegateException as xn, InlineFactory as xo, PrismaDelegateNameMapping as xr, HasOneRelationMetadata as xs, stripPrismaSchemaModelsAndEnums as xt, getActiveTransactionClient as y, PrismaTransactionCallback as ya, QueryTimeCondition as yi, QueryConstraintException as yn, RelatedModelClass as yo, SeederInput as yr, HasManyRelationMetadata as ys, runMigrationWithPrisma as yt, applyCreateTableOperation as z, TransactionCallback as za, CastMap as zi, MakeMigrationCommand as zn, RelationAggregateInput as zo, DatabasePrimitive as zr, PrismaMigrationWorkflowOptions as zs, readAppliedMigrationsStateFromStore as zt };
8446
+ export { buildRelationLine as $, GroupByAggregateSpec as $a, DelegateUniqueWhere as $i, RuntimePathInput as $n, SetBasedEagerLoader as $o, QueryDayCondition as $r, JsonExpressionNode as $s, getPersistedColumnMap as $t, isTransactionCapableClient as A, QuerySchemaOrderBy as Aa, SchemaColumn as Ac, SoftDeleteQueryMode as Ai, GeneratedColumnExpression as An, AggregateExpression as Ao, AdapterDatabaseCreationResult as Ar, JoinClause as As, createEmptyAppliedMigrationsState as At, applyDropTableOperation as B, Serializable as Ba, SchemaUniqueConstraint as Bc, ArkormDebugHandler as Bi, MakeModelCommand as Bn, expressionBuilder as Bo, DatabaseAdapter as Br, FactoryRelationshipResolver as Bs, removeAppliedMigration as Bt, getRuntimeDebugHandler as C, PrismaTransactionCallback as Ca, GenerateMigrationOptions as Cc, QueryTimeCondition as Ci, ArkormException as Cn, ModelRelationshipResult as Co, PrismaDelegateNameMapping as Cr, RelationTableLookupSpec as Cs, supportsDatabaseMigrationExecution as Ct, getUserConfig as D, QuerySchemaCreateData as Da, PrimaryKeyGeneration as Dc, RelationLoadPlan as Di, SchemaBuilder as Dn, QuerySchemaForModelInstance as Do, createKyselyAdapter as Dr, RelatedModelForRelationship as Ds, buildMigrationIdentity as Dt, getRuntimePrismaClient as E, PrismaTransactionOptions as Ea, MigrationInstanceLike as Ec, RelationFilterSpec as Ei, Migration as En, QuerySchemaForModel as Eo, KyselyDatabaseAdapter as Er, JoinSource as Es, toModelName as Et, PRISMA_ENUM_MEMBER_REGEX as F, QuerySchemaUpdateArgs as Fa, SchemaOperation as Fc, AdapterBindableModel as Fi, MigrationHistoryCommand as Fn, avg as Fo, AdapterQueryOperation as Fr, FactoryAttributes as Fs, isMigrationApplied as Ft, applyOperationsToPrismaSchema as G, TransactionContext as Ga, ClientResolver as Gi, resolveCast as Gn, min as Go, DeleteManySpec as Gr, CaseExpressionBranch as Gs, PersistedColumnMappingsState as Gt, applyMigrationRollbackToPrismaSchema as H, SoftDeleteConfig as Ha, TimestampNames as Hc, CastHandler as Hi, MakeFactoryCommand as Hn, fromExpressionNode as Ho, DatabaseRow as Hr, MaybePromise as Hs, supportsDatabaseMigrationState as Ht, PRISMA_ENUM_REGEX as I, QuerySchemaUpdateData as Ia, SchemaPrimaryKey as Ic, AdapterQueryInspection as Ii, MigrateRollbackCommand as In, caseWhen as Io, AdapterTransactionContext as Ir, FactoryCallback as Is, markMigrationApplied as It, buildIndexLine as J, RelationshipModelStatic as Ja, DelegateInclude as Ji, Arkorm as Jn, val as Jo, InsertSpec as Jr, ExpressionBinaryOperator as Js, PersistedTableMetadata as Jt, buildEnumBlock as K, TransactionOptions as Ka, DelegateCreateData as Ki, Attribute as Kn, raw as Ko, DeleteSpec as Kr, CaseExpressionNode as Ks, PersistedMetadataFeatures as Kt, PRISMA_MODEL_REGEX as L, QuerySchemaWhere as La, SchemaTableAlterOperation as Lc, ArkormBootContext as Li, MigrateFreshCommand as Ln, coalesce as Lo, AggregateOperation as Lr, FactoryDefinition as Ls, markMigrationRun as Lt, resetArkormRuntimeForTests as M, QuerySchemaRows as Ma, SchemaForeignKey as Mc, UpdateManySpec as Mi, ForeignKeyBuilder as Mn, Expression as Mo, AdapterModelFieldStructure as Mr, Paginator as Ms, findAppliedMigration as Mt, runArkormTransaction as N, QuerySchemaSelect as Na, SchemaForeignKeyAction as Nc, UpdateSpec as Ni, SeedCommand as Nn, ExpressionBuilder as No, AdapterModelIntrospectionOptions as Nr, ArkormCollection as Ns, getLastMigrationRun as Nt, isDelegateLike as O, QuerySchemaFindManyArgs as Oa, PrismaMigrationWorkflowOptions as Oc, RelationLoadSpec as Oi, EnumBuilder as On, RelatedModelClass as Oo, AdapterCapabilities as Or, RelatedModelFromResult as Os, buildMigrationRunId as Ot, PrimaryKeyGenerationPlanner as P, QuerySchemaUniqueWhere as Pa, SchemaIndex as Pc, UpsertSpec as Pi, ModelsSyncCommand as Pn, JsonExpression as Po, AdapterModelStructure as Pr, FactoryAttributeResolver as Ps, getLatestAppliedMigrations as Pt, buildPrimaryKeyLine as Q, GroupByAggregateRow as Qa, DelegateSelect as Qi, RuntimeConstructor as Qn, defineFactory as Qo, QueryCondition as Qr, InExpressionNode as Qs, deletePersistedColumnMappingsState as Qt, applyAlterTableOperation as R, RawSelectInput as Ra, SchemaTableCreateOperation as Rc, ArkormConfig as Ri, MigrateCommand as Rn, col as Ro, AggregateSelection as Rr, FactoryDefinitionAttributes as Rs, readAppliedMigrationsState as Rt, getRuntimeClient as S, PrismaLikeWhereInput as Sa, AppliedMigrationsState as Sc, QueryTarget as Si, ArkormErrorContext as Sn, ModelRelationshipKey as So, PrismaDatabaseAdapter as Sr, RelationResultCache as Ss, supportsDatabaseCreation as St, getRuntimePaginationURLDriverFactory as T, PrismaTransactionContext as Ta, MigrationClass as Tc, RelationAggregateSpec as Ti, MIGRATION_BRAND as Tn, ModelWhereInput as To, createPrismaDatabaseAdapter as Tr, JoinOn as Ts, toMigrationFileSlug as Tt, applyMigrationToDatabase as U, TransactionCallback as Ua, TimestampNaming as Uc, CastMap as Ui, InitCommand as Un, json as Uo, DatabaseRows as Ur, AggregateExpressionNode as Us, writeAppliedMigrationsState as Ut, applyMigrationRollbackToDatabase as V, SimplePaginationMeta as Va, TimestampColumnBehavior as Vc, CastDefinition as Vi, MakeMigrationCommand as Vn, fn as Vo, DatabasePrimitive as Vr, FactoryState as Vs, resolveMigrationStateFilePath as Vt, applyMigrationToPrismaSchema as W, TransactionCapableClient as Wa, CastType as Wi, CliApp as Wn, max as Wo, DatabaseValue as Wr, BinaryExpressionNode as Ws, writeAppliedMigrationsStateToStore as Wt, buildMigrationSource as X, EachCallback as Xa, DelegateRow as Xi, RegisteredFactory as Xn, InlineFactory as Xo, QueryComparisonCondition as Xr, ExpressionNode as Xs, applyOperationsToPersistedColumnMappingsState as Xt, buildInverseRelationLine as Y, ChunkCallback as Ya, DelegateOrderBy as Yi, Arkormx as Yn, where as Yo, QueryColumnComparisonCondition as Yr, ExpressionJsonCast as Ys, PersistedTimestampColumn as Yt, buildModelBlock as Z, ExpressionSelectMap as Za, DelegateRows as Zi, RegisteredModel as Zn, ModelFactory as Zo, QueryComparisonOperator as Zr, FunctionExpressionNode as Zs, createEmptyPersistedColumnMappingsState as Zt, ensureArkormConfigLoading as _, PrismaLikeInclude as _a, PivotModelStatic as _c, QueryNotCondition as _i, QueryExecutionException as _n, ModelEventHandlerConstructor as _o, SEEDER_BRAND as _r, RelationConstraint as _s, resolveMigrationClassName as _t, getRuntimeCompatibilityAdapter as a, GetUserConfig as aa, BelongsToManyRelationMetadata as ac, QueryJoin as ai, readPersistedColumnMappingsState as an, AttributeSelect as ao, getRegisteredPaths as ar, HasOneRelation as as, deriveRelationFieldName as at, getDefaultStubsPath as b, PrismaLikeSelect as ba, AppliedMigrationEntry as bc, QueryScalarComparisonOperator as bi, ModelNotFoundException as bn, ModelLifecycleState as bo, SeederConstructor as br, RelationMetadataProvider as bs, runPrismaCommand as bt, PrismaDelegateMap as c, NamingCase as ca, HasManyRelationMetadata as cc, QueryJoinConstraint as ci, resolveColumnMappingsFilePath as cn, DelegateForModelSchema as co, loadMigrationsFrom as cr, BelongsToRelation as cs, findEnumBlock as ct, inferDelegateName as d, PaginationOptions as da, HasOneThroughRelationMetadata as dc, QueryJoinRawConstraint as di, validatePersistedMetadataFeaturesForMigrations as dn, ModelAttributes as do, registerFactories as dr, Relation as ds, formatEnumDefaultValue as dt, DelegateUpdateArgs as ea, NullCheckExpressionNode as ec, QueryExistsCondition as ei, getPersistedEnumMap as en, QueryBuilder as eo, RuntimePathKey as er, MorphToRelation as es, buildUniqueConstraintLine as et, awaitConfiguredModelsRegistration as f, PaginationURLDriver as fa, ModelMetadata as fc, QueryJoinType as fi, writePersistedColumnMappingsState as fn, ModelAttributesOf as fo, registerMigrations as fr, RelationTableLoader as fs, formatRelationAction as ft, emitRuntimeDebugEvent as g, PrismaFindManyArgsLike as ga, MorphToRelationMetadata as gc, QueryLogicalOperator as gi, RelationResolutionException as gn, ModelEventHandler as go, resetRuntimeRegistryForTests as gr, RelationColumnLookupSpec as gs, resolveEnumName as gt, defineConfig as h, PrismaDelegateLike as ha, MorphToManyRelationMetadata as hc, QueryJsonConditionKind as hi, ScopeNotDefinedException as hn, ModelEventDispatcher as ho, registerSeeders as hr, RelationAggregateType as hs, pad as ht, RuntimeModuleLoader as i, EagerLoadMap as ia, DatabaseTablePersistedMetadataOptions as ic, QueryGroupCondition as ii, getPersistedTimestampColumns as in, AttributeSchemaDelegate as io, getRegisteredModels as ir, HasOneThroughRelation as is, deriveRelationAlias as it, loadArkormConfig as j, QuerySchemaRow as ja, SchemaColumnType as jc, SortDirection as ji, resolveGeneratedExpression as jn, CaseExpression as jo, AdapterInspectionRequest as jr, LengthAwarePaginator as js, deleteAppliedMigrationsStateFromStore as jt, isQuerySchemaLike as k, QuerySchemaInclude as ka, PrismaSchemaSyncOptions as kc, SelectSpec as ki, TableBuilder as kn, Model as ko, AdapterCapability as kr, WhereCallback as ks, computeMigrationChecksum as kt, createPrismaAdapter as l, PaginationCurrentPageResolver as la, HasManyThroughRelationMetadata as lc, QueryJoinNestedConstraint as li, resolvePersistedMetadataFeatures as ln, GlobalScope as lo, loadModelsFrom as lr, SingleResultRelation as ls, findModelBlock as lt, configureArkormRuntime as m, PrismaClientLike as ma, MorphOneRelationMetadata as mc, QueryJsonCondition as mi, UniqueConstraintResolutionException as mn, ModelDeclaredAttributeKey as mo, registerPaths as mr, RelationAggregateInput as ms, getMigrationPlan as mt, PivotModel as n, DelegateWhere as na, ValueExpressionNode as nc, QueryFullTextCondition as ni, getPersistedPrimaryKeyGeneration as nn, AttributeOrderBy as no, getRegisteredFactories as nr, MorphOneRelation as ns, deriveCollectionFieldName as nt, resolveRuntimeCompatibilityQuerySchema as o, ModelQuerySchemaLike as oa, BelongsToRelationMetadata as oc, QueryJoinBoolean as oi, rebuildPersistedColumnMappingsState as on, AttributeUpdateInput as oo, getRegisteredSeeders as or, HasManyThroughRelation as os, deriveSingularFieldName as ot, bindAdapterToModels as p, PaginationURLDriverFactory as pa, MorphManyRelationMetadata as pc, QueryJoinValueConstraint as pi, UnsupportedAdapterFeatureException as pn, ModelCreateData as po, registerModels as pr, RelationAggregateConstraint as ps, generateMigrationFile as pt, buildFieldLine as q, ModelStatic as qa, DelegateFindManyArgs as qi, AttributeOptions as qn, sum as qo, InsertManySpec as qr, ColumnExpressionNode as qs, PersistedPrimaryKeyGeneration as qt, LoadedRuntimeModule as r, EagerLoadConstraint as ra, DatabaseTableOptions as rc, QueryGroupByItem as ri, getPersistedTableMetadata as rn, AttributeQuerySchema as ro, getRegisteredMigrations as rr, MorphManyRelation as rs, deriveInverseRelationAlias as rt, resolveRuntimeCompatibilityQuerySchemaOrThrow as s, ModelTableCase as sa, ColumnMap as sc, QueryJoinColumnConstraint as si, resetPersistedColumnMappingsCache as sn, AttributeWhereInput as so, loadFactoriesFrom as sr, HasManyRelation as ss, escapeRegex as st, URLDriver as t, DelegateUpdateData as ta, RawExpressionNode as tc, QueryExpressionCondition as ti, getPersistedEnumTsType as tn, AttributeCreateInput as to, RuntimePathMap as tr, MorphToManyRelation as ts, createMigrationTimestamp as tt, createPrismaDelegateMap as u, PaginationMeta as ua, HasOneRelationMetadata as uc, QueryJoinNullConstraint as ui, syncPersistedColumnMappingsFromState as un, ModelAttributeValue as uo, loadSeedersFrom as ur, BelongsToManyRelation as us, formatDefaultValue as ut, getActiveTransactionAdapter as v, PrismaLikeOrderBy as va, RelationMetadata as vc, QueryOrderBy as vi, QueryExecutionExceptionContext as vn, ModelEventListener as vo, Seeder as vr, RelationDefaultResolver as vs, resolvePrismaType as vt, getRuntimePaginationCurrentPageResolver as w, PrismaTransactionCapableClient as wa, GeneratedMigrationFile as wc, RawQuerySpec as wi, DB as wn, ModelUpdateData as wo, createPrismaCompatibilityAdapter as wr, EagerLoadRelations as ws, supportsDatabaseReset as wt, getRuntimeAdapter as x, PrismaLikeSortOrder as xa, AppliedMigrationRun as xc, QuerySelectColumn as xi, MissingDelegateException as xn, ModelOrderByInput as xo, SeederInput as xr, RelationResult as xs, stripPrismaSchemaModelsAndEnums as xt, getActiveTransactionClient as y, PrismaLikeScalarFilter as ya, RelationMetadataType as yc, QueryRawCondition as yi, QueryConstraintException as yn, ModelEventName as yo, SeederCallArgument as yr, RelationDefaultValue as ys, runMigrationWithPrisma as yt, applyCreateTableOperation as z, RuntimeClientLike as za, SchemaTableDropOperation as zc, ArkormDebugEvent as zi, MakeSeederCommand as zn, count as zo, AggregateSpec as zr, FactoryModelConstructor as zs, readAppliedMigrationsStateFromStore as zt };