arkormx 2.10.2 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,45 @@ 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
+ /** Map of model attributes selected for an aggregate (`{ amount: true }`). */
3512
+ type AggregateColumnMap<TModel> = Partial<Record<keyof ModelAttributes<TModel> & string, true>>;
3513
+ /**
3514
+ * Prisma-style grouped-aggregate request: group by `by` columns and compute the
3515
+ * requested `_sum`/`_avg`/`_min`/`_max`/`_count` aggregates per group.
3516
+ */
3517
+ interface GroupByAggregateSpec<TModel> {
3518
+ by: Array<keyof ModelAttributes<TModel> & string>;
3519
+ _count?: true | AggregateColumnMap<TModel>;
3520
+ _sum?: AggregateColumnMap<TModel>;
3521
+ _avg?: AggregateColumnMap<TModel>;
3522
+ _min?: AggregateColumnMap<TModel>;
3523
+ _max?: AggregateColumnMap<TModel>;
3524
+ }
3525
+ type SameTypeAggregate<TModel, TMap> = { [K in keyof TMap]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown };
3526
+ /** The typed plain row returned for a {@link GroupByAggregateSpec} query. */
3527
+ type GroupByAggregateRow<TModel, TSpec extends GroupByAggregateSpec<TModel>> = { [K in TSpec['by'][number]]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown } & (TSpec extends {
3528
+ _count: infer C;
3529
+ } ? {
3530
+ _count: C extends AggregateColumnMap<TModel> ? { [K in keyof C]: number } : number;
3531
+ } : object) & (TSpec extends {
3532
+ _sum: infer S;
3533
+ } ? {
3534
+ _sum: { [K in keyof S]: number | null };
3535
+ } : object) & (TSpec extends {
3536
+ _avg: infer A;
3537
+ } ? {
3538
+ _avg: { [K in keyof A]: number | null };
3539
+ } : object) & (TSpec extends {
3540
+ _min: infer M;
3541
+ } ? {
3542
+ _min: SameTypeAggregate<TModel, M>;
3543
+ } : object) & (TSpec extends {
3544
+ _max: infer M;
3545
+ } ? {
3546
+ _max: SameTypeAggregate<TModel, M>;
3547
+ } : object);
3249
3548
  /**
3250
3549
  * The QueryBuilder class provides a fluent interface for building and
3251
3550
  * executing database queries.
@@ -3294,6 +3593,7 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3294
3593
  */
3295
3594
  where(where: QuerySchemaWhere<TDelegate>): this;
3296
3595
  where(callback: WhereCallback<TModel, TDelegate>): this;
3596
+ where(expression: Expression): this;
3297
3597
  /**
3298
3598
  * Adds an OR where clause to the query. Pass a callback to build a
3299
3599
  * parenthesized group of nested conditions.
@@ -3303,6 +3603,13 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3303
3603
  */
3304
3604
  orWhere(where: QuerySchemaWhere<TDelegate>): this;
3305
3605
  orWhere(callback: WhereCallback<TModel, TDelegate>): this;
3606
+ orWhere(expression: Expression): this;
3607
+ /**
3608
+ * Appends a boolean {@link Expression} as a where predicate. When the query is
3609
+ * using the Prisma-like legacy where representation, the expression is merged in
3610
+ * as a structured condition alongside it.
3611
+ */
3612
+ private appendExpressionCondition;
3306
3613
  /**
3307
3614
  * Resolve a callback into a parenthesized group condition and append it.
3308
3615
  */
@@ -3747,6 +4054,17 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3747
4054
  * @returns
3748
4055
  */
3749
4056
  orderBy(orderBy: QuerySchemaOrderBy<TDelegate>): this;
4057
+ orderBy(expression: Expression, direction?: 'asc' | 'desc'): this;
4058
+ /**
4059
+ * Appends a raw SQL `order by` fragment (with positional `?` bindings), useful
4060
+ * for ordering by a computed expression the builder does not model directly.
4061
+ *
4062
+ * @param sql
4063
+ * @param bindings
4064
+ * @param direction
4065
+ * @returns
4066
+ */
4067
+ orderByRaw(sql: string, bindings?: DatabaseValue[], direction?: 'asc' | 'desc'): this;
3750
4068
  /**
3751
4069
  * Puts the query results in random order.
3752
4070
  *
@@ -4003,6 +4321,7 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4003
4321
  * @returns
4004
4322
  */
4005
4323
  select(select: QuerySchemaSelect<TDelegate>): this;
4324
+ select(select: Record<string, Expression | boolean | string>): this;
4006
4325
  /**
4007
4326
  * Appends columns or expressions to the existing select clause.
4008
4327
  *
@@ -4010,6 +4329,7 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4010
4329
  * @returns
4011
4330
  */
4012
4331
  addSelect(select: QuerySchemaSelect<TDelegate>): this;
4332
+ addSelect(select: Record<string, Expression | boolean | string>): this;
4013
4333
  /**
4014
4334
  * Apply or remove DISTINCT from the select query.
4015
4335
  *
@@ -4025,8 +4345,48 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4025
4345
  */
4026
4346
  groupBy<TKey extends keyof ModelAttributes<TModel> & string>(columns: TKey[]): this;
4027
4347
  groupBy<TKey extends keyof ModelAttributes<TModel> & string>(...columns: TKey[]): this;
4348
+ groupBy(columns: Array<string | Expression>): this;
4349
+ groupBy(...columns: Array<string | Expression>): this;
4350
+ groupBy<TSpec extends GroupByAggregateSpec<TModel>>(spec: TSpec): Promise<GroupByAggregateRow<TModel, TSpec>[]>;
4351
+ /**
4352
+ * Appends a raw SQL `group by` fragment (with positional `?` bindings), mirroring
4353
+ * `whereRaw`/`havingRaw`. Combines with any columns/expressions already grouped.
4354
+ *
4355
+ * @param sql
4356
+ * @param bindings
4357
+ * @returns
4358
+ */
4359
+ groupByRaw(sql: string, bindings?: DatabaseValue[]): this;
4360
+ /**
4361
+ * Resolves the recorded group-by sources into adapter {@link QueryGroupByItem}s.
4362
+ * A bare string that matches a select-column alias is expanded to that column's
4363
+ * underlying expression (group-by-alias); otherwise it is treated as a column.
4364
+ */
4365
+ private buildGroupByItems;
4366
+ private isGroupByAggregateSpec;
4367
+ /**
4368
+ * Executes the query and returns plain, un-hydrated rows keyed by their select
4369
+ * alias — the natural shape for `select` + `groupBy` aggregate reports. Pass a
4370
+ * row type to describe the projection.
4371
+ *
4372
+ * @returns
4373
+ */
4374
+ getRows<TRow = Record<string, DatabaseValue>>(): Promise<TRow[]>;
4375
+ /**
4376
+ * Runs a Prisma-style grouped aggregate and returns typed rows shaped as
4377
+ * `{ <by columns>, _sum, _avg, _min, _max, _count }`.
4378
+ */
4379
+ private executeGroupByAggregate;
4380
+ private coerceNumeric;
4028
4381
  private appendHavingCondition;
4029
4382
  private buildHavingComparison;
4383
+ /**
4384
+ * Resolves the three `having` call shapes into a condition: `having(column, …)`,
4385
+ * `having(expression)` (a boolean expression predicate), and
4386
+ * `having(expression, operator, value)` (compare an aggregate to a value).
4387
+ */
4388
+ private buildHavingCondition;
4389
+ private compareExpression;
4030
4390
  /**
4031
4391
  * Adds a HAVING clause to filter grouped rows. Accepts either
4032
4392
  * `having(column, value)` (defaulting to equality) or
@@ -4039,6 +4399,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4039
4399
  */
4040
4400
  having(column: string, value: DatabaseValue): this;
4041
4401
  having(column: string, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4402
+ having(expression: Expression): this;
4403
+ having(expression: Expression, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4042
4404
  /**
4043
4405
  * Adds an OR HAVING clause to filter grouped rows.
4044
4406
  *
@@ -4049,6 +4411,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4049
4411
  */
4050
4412
  orHaving(column: string, value: DatabaseValue): this;
4051
4413
  orHaving(column: string, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4414
+ orHaving(expression: Expression): this;
4415
+ orHaving(expression: Expression, operator: QueryScalarComparisonOperator, value: DatabaseValue): this;
4052
4416
  /**
4053
4417
  * Adds a raw HAVING clause, useful for filtering on aggregate expressions
4054
4418
  * such as `count(*)`. Combines with previous HAVING clauses using AND.
@@ -4635,6 +4999,17 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4635
4999
  private tryBuildFieldCondition;
4636
5000
  private tryBuildQueryCondition;
4637
5001
  private tryBuildSelectSpec;
5002
+ /** Reads and caches the model's resolved `static computed` expression map. */
5003
+ private computedAttributes;
5004
+ /**
5005
+ * Expands references to `static computed` attribute names into their backing
5006
+ * expressions across a select spec's columns, group by, order by, where, and
5007
+ * having clauses. A no-op when the model declares no computed attributes.
5008
+ */
5009
+ private expandComputedAttributes;
5010
+ private expandComputedCondition;
5011
+ /** Converts a where comparison against a computed attribute into an expression. */
5012
+ private computedComparison;
4638
5013
  private tryBuildAggregateSpec;
4639
5014
  private requireAdapter;
4640
5015
  private executeReadRows;
@@ -5084,7 +5459,7 @@ type DatabasePrimitive = string | number | boolean | bigint | Date | null;
5084
5459
  type DatabaseValue = DatabasePrimitive | DatabaseRow | DatabaseValue[];
5085
5460
  type DatabaseRow = Record<string, unknown>;
5086
5461
  type DatabaseRows = DatabaseRow[];
5087
- type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'upsert' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawSelect' | 'rawWhere' | 'distinct' | 'groupBy' | 'joins';
5462
+ type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'upsert' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawSelect' | 'rawWhere' | 'distinct' | 'groupBy' | 'joins' | 'expressions';
5088
5463
  type AdapterCapabilities = Partial<Record<AdapterCapability, boolean>>;
5089
5464
  type QueryLogicalOperator = 'and' | 'or';
5090
5465
  type QueryComparisonOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'not-in' | 'contains' | 'starts-with' | 'ends-with' | 'is-null' | 'is-not-null';
@@ -5108,11 +5483,30 @@ interface QuerySelectColumn {
5108
5483
  alias?: string;
5109
5484
  raw?: boolean;
5110
5485
  wildcard?: boolean;
5486
+ /** A compiled expression projected in place of a physical column. */
5487
+ expression?: ExpressionNode;
5111
5488
  }
5112
5489
  interface QueryOrderBy {
5113
5490
  column: string;
5114
5491
  direction: SortDirection;
5492
+ /** Orders by a compiled expression instead of a physical column. */
5493
+ expression?: ExpressionNode;
5115
5494
  }
5495
+ /**
5496
+ * A `GROUP BY` entry: either a logical column name (string) or a compiled
5497
+ * expression / raw fragment. The query builder resolves select-alias grouping to
5498
+ * the underlying expression before it reaches the adapter.
5499
+ */
5500
+ type QueryGroupByItem = string | {
5501
+ alias: string;
5502
+ } | {
5503
+ expression: ExpressionNode;
5504
+ } | {
5505
+ raw: {
5506
+ sql: string;
5507
+ bindings?: DatabaseValue[];
5508
+ };
5509
+ };
5116
5510
  interface QueryComparisonCondition {
5117
5511
  type: 'comparison';
5118
5512
  column: string;
@@ -5179,7 +5573,12 @@ interface RawQuerySpec {
5179
5573
  sql: string;
5180
5574
  bindings?: DatabaseValue[];
5181
5575
  }
5182
- type QueryCondition = QueryComparisonCondition | QueryColumnComparisonCondition | QueryTimeCondition | QueryDayCondition | QueryExistsCondition | QueryFullTextCondition | QueryJsonCondition | QueryGroupCondition | QueryNotCondition | QueryRawCondition;
5576
+ /** A boolean-valued expression used directly as a predicate (where / having). */
5577
+ interface QueryExpressionCondition {
5578
+ type: 'expression';
5579
+ expression: ExpressionNode;
5580
+ }
5581
+ type QueryCondition = QueryComparisonCondition | QueryColumnComparisonCondition | QueryTimeCondition | QueryDayCondition | QueryExistsCondition | QueryFullTextCondition | QueryJsonCondition | QueryExpressionCondition | QueryGroupCondition | QueryNotCondition | QueryRawCondition;
5183
5582
  interface AggregateSelection {
5184
5583
  type: AggregateOperation;
5185
5584
  column?: string;
@@ -5258,7 +5657,7 @@ interface SelectSpec<TModel = unknown> {
5258
5657
  target: QueryTarget<TModel>;
5259
5658
  columns?: QuerySelectColumn[];
5260
5659
  distinct?: boolean;
5261
- groupBy?: string[];
5660
+ groupBy?: QueryGroupByItem[];
5262
5661
  having?: QueryCondition;
5263
5662
  joins?: QueryJoin[];
5264
5663
  where?: QueryCondition;
@@ -5536,6 +5935,22 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
5536
5935
  private buildFullTextCondition;
5537
5936
  private buildJsonAccessor;
5538
5937
  private buildJsonCondition;
5938
+ /**
5939
+ * Compiles a serialized {@link ExpressionNode} into a parameterized SQL fragment.
5940
+ * Shared by expression-backed select columns, `group by`, `order by`, and any
5941
+ * boolean expression used as a `where`/`having` predicate.
5942
+ *
5943
+ * @param target
5944
+ * @param node
5945
+ * @returns
5946
+ */
5947
+ private buildExpression;
5948
+ private buildExpressionColumn;
5949
+ private buildBinaryExpression;
5950
+ private buildAggregateExpression;
5951
+ private buildJsonValueExpression;
5952
+ private buildRawExpressionFragment;
5953
+ private sanitizeFunctionName;
5539
5954
  private buildWhereCondition;
5540
5955
  private buildWhereClause;
5541
5956
  private buildPaginationClause;
@@ -6476,7 +6891,8 @@ declare class MakeSeederCommand extends Command<CliApp> {
6476
6891
  //#region src/cli/commands/MigrateCommand.d.ts
6477
6892
  /**
6478
6893
  * The MigrateCommand class implements the CLI command for applying migration
6479
- * classes to the Prisma schema and running the Prisma workflow.
6894
+ * classes to the database or Prisma schema and running the Prisma workflow when
6895
+ * using the Prisma compatibility driver.
6480
6896
  *
6481
6897
  * @author Legacy (3m1n3nc3)
6482
6898
  * @since 0.1.0
@@ -6488,8 +6904,8 @@ declare class MigrateCommand extends Command<CliApp> {
6488
6904
  * Command handler for the migrate command.
6489
6905
  * This method is responsible for orchestrating the migration
6490
6906
  * process, including loading migration classes, applying them to
6491
- * the Prisma schema, and running the appropriate Prisma commands
6492
- * based on the provided options.
6907
+ * the the database or Prisma schema, and running the appropriate Prisma commands
6908
+ * when using the Prisma compatibility driver based on the provided options.
6493
6909
  *
6494
6910
  * @returns
6495
6911
  */
@@ -6666,6 +7082,19 @@ declare class ForeignKeyBuilder {
6666
7082
  as(fieldName: string): this;
6667
7083
  }
6668
7084
  //#endregion
7085
+ //#region src/helpers/generated-column.d.ts
7086
+ /**
7087
+ * The two ways to declare a generated column's expression: a raw SQL string, or a
7088
+ * factory that builds one with the expression builder.
7089
+ */
7090
+ type GeneratedColumnExpression = string | ((builder: ExpressionBuilder) => Expression);
7091
+ /**
7092
+ * Resolves a generated-column expression into raw Postgres SQL. Generated columns
7093
+ * cannot carry bind parameters (they must be immutable), so literal values are
7094
+ * inlined and aggregates are rejected.
7095
+ */
7096
+ declare const resolveGeneratedExpression: (expression: GeneratedColumnExpression) => string;
7097
+ //#endregion
6669
7098
  //#region src/database/TableBuilder.d.ts
6670
7099
  /**
6671
7100
  * The EnumBuilder class provides a fluent interface for configuring enum columns
@@ -6875,6 +7304,28 @@ declare class TableBuilder {
6875
7304
  * @returns The current TableBuilder instance for chaining.
6876
7305
  */
6877
7306
  dateTime(name: string, options?: Partial<SchemaColumn>): this;
7307
+ /**
7308
+ * Defines a database-computed column (`GENERATED ALWAYS AS (…) STORED`). The
7309
+ * expression may be a raw SQL string or an expression-builder factory, and must
7310
+ * be immutable and reference only the row's own columns. Combine with
7311
+ * {@link index} to index the generated value.
7312
+ *
7313
+ * @example
7314
+ * table.generated('category', "case when metadata->>'kind' = 'a' then 'x' else 'y' end", {
7315
+ * type: 'text',
7316
+ * })
7317
+ * table.generated('total', (e) => e.col('price').times(e.col('quantity')), { type: 'integer' })
7318
+ *
7319
+ * @param name The generated column name.
7320
+ * @param expression The SQL expression string, or a builder factory.
7321
+ * @param options Column type (default `text`), `stored` flag, and nullability.
7322
+ * @returns
7323
+ */
7324
+ generated(name: string, expression: GeneratedColumnExpression, options?: {
7325
+ type?: SchemaColumnType;
7326
+ stored?: boolean;
7327
+ nullable?: boolean;
7328
+ }): this;
6878
7329
  /**
6879
7330
  * Defines colonns for a polymorphic relationship in the table.
6880
7331
  *
@@ -7906,4 +8357,4 @@ declare class URLDriver {
7906
8357
  url(page: number): string;
7907
8358
  }
7908
8359
  //#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 };
8360
+ export { buildRelationLine as $, AttributeCreateInput as $a, DelegateUniqueWhere as $i, RuntimePathInput as $n, MorphToManyRelation as $o, QueryDayCondition as $r, RawExpressionNode as $s, getPersistedColumnMap as $t, isTransactionCapableClient as A, QuerySchemaOrderBy as Aa, SchemaForeignKey as Ac, SoftDeleteQueryMode as Ai, GeneratedColumnExpression as An, Expression as Ao, AdapterDatabaseCreationResult as Ar, Paginator as As, createEmptyAppliedMigrationsState as At, applyDropTableOperation as B, Serializable as Ba, TimestampNames as Bc, ArkormDebugHandler as Bi, MakeModelCommand as Bn, fromExpressionNode as Bo, DatabaseAdapter as Br, MaybePromise as Bs, removeAppliedMigration as Bt, getRuntimeDebugHandler as C, PrismaTransactionCallback as Ca, MigrationClass as Cc, QueryTimeCondition as Ci, ArkormException as Cn, ModelWhereInput as Co, PrismaDelegateNameMapping as Cr, JoinOn as Cs, supportsDatabaseMigrationExecution as Ct, getUserConfig as D, QuerySchemaCreateData as Da, PrismaSchemaSyncOptions as Dc, RelationLoadPlan as Di, SchemaBuilder as Dn, Model as Do, createKyselyAdapter as Dr, WhereCallback as Ds, buildMigrationIdentity as Dt, getRuntimePrismaClient as E, PrismaTransactionOptions as Ea, PrismaMigrationWorkflowOptions as Ec, RelationFilterSpec as Ei, Migration as En, RelatedModelClass as Eo, KyselyDatabaseAdapter as Er, RelatedModelFromResult as Es, toModelName as Et, PRISMA_ENUM_MEMBER_REGEX as F, QuerySchemaUpdateArgs as Fa, SchemaTableAlterOperation as Fc, AdapterBindableModel as Fi, MigrationHistoryCommand as Fn, coalesce as Fo, AdapterQueryOperation as Fr, FactoryDefinition as Fs, isMigrationApplied as Ft, applyOperationsToPrismaSchema as G, TransactionContext as Ga, ClientResolver as Gi, resolveCast as Gn, sum as Go, DeleteManySpec as Gr, ColumnExpressionNode as Gs, PersistedColumnMappingsState as Gt, applyMigrationRollbackToPrismaSchema as H, SoftDeleteConfig as Ha, CastHandler as Hi, MakeFactoryCommand as Hn, max as Ho, DatabaseRow as Hr, BinaryExpressionNode as Hs, supportsDatabaseMigrationState as Ht, PRISMA_ENUM_REGEX as I, QuerySchemaUpdateData as Ia, SchemaTableCreateOperation as Ic, AdapterQueryInspection as Ii, MigrateRollbackCommand as In, col as Io, AdapterTransactionContext as Ir, FactoryDefinitionAttributes as Is, markMigrationApplied as It, buildIndexLine as J, RelationshipModelStatic as Ja, DelegateInclude as Ji, Arkorm as Jn, InlineFactory as Jo, InsertSpec as Jr, ExpressionNode as Js, PersistedTableMetadata as Jt, buildEnumBlock as K, TransactionOptions as Ka, DelegateCreateData as Ki, Attribute as Kn, val as Ko, DeleteSpec as Kr, ExpressionBinaryOperator as Ks, PersistedMetadataFeatures as Kt, PRISMA_MODEL_REGEX as L, QuerySchemaWhere as La, SchemaTableDropOperation as Lc, ArkormBootContext as Li, MigrateFreshCommand as Ln, count as Lo, AggregateOperation as Lr, FactoryModelConstructor as Ls, markMigrationRun as Lt, resetArkormRuntimeForTests as M, QuerySchemaRows as Ma, SchemaIndex as Mc, UpdateManySpec as Mi, ForeignKeyBuilder as Mn, JsonExpression as Mo, AdapterModelFieldStructure as Mr, FactoryAttributeResolver as Ms, findAppliedMigration as Mt, runArkormTransaction as N, QuerySchemaSelect as Na, SchemaOperation as Nc, UpdateSpec as Ni, SeedCommand as Nn, avg as No, AdapterModelIntrospectionOptions as Nr, FactoryAttributes as Ns, getLastMigrationRun as Nt, isDelegateLike as O, QuerySchemaFindManyArgs as Oa, SchemaColumn as Oc, RelationLoadSpec as Oi, EnumBuilder as On, AggregateExpression as Oo, AdapterCapabilities as Or, JoinClause as Os, buildMigrationRunId as Ot, PrimaryKeyGenerationPlanner as P, QuerySchemaUniqueWhere as Pa, SchemaPrimaryKey as Pc, UpsertSpec as Pi, ModelsSyncCommand as Pn, caseWhen as Po, AdapterModelStructure as Pr, FactoryCallback as Ps, getLatestAppliedMigrations as Pt, buildPrimaryKeyLine as Q, QueryBuilder as Qa, DelegateSelect as Qi, RuntimeConstructor as Qn, MorphToRelation as Qo, QueryCondition as Qr, NullCheckExpressionNode as Qs, deletePersistedColumnMappingsState as Qt, applyAlterTableOperation as R, RawSelectInput as Ra, SchemaUniqueConstraint as Rc, ArkormConfig as Ri, MigrateCommand as Rn, expressionBuilder as Ro, AggregateSelection as Rr, FactoryRelationshipResolver as Rs, readAppliedMigrationsState as Rt, getRuntimeClient as S, PrismaLikeWhereInput as Sa, GeneratedMigrationFile as Sc, QueryTarget as Si, ArkormErrorContext as Sn, ModelUpdateData as So, PrismaDatabaseAdapter as Sr, EagerLoadRelations as Ss, supportsDatabaseCreation as St, getRuntimePaginationURLDriverFactory as T, PrismaTransactionContext as Ta, PrimaryKeyGeneration as Tc, RelationAggregateSpec as Ti, MIGRATION_BRAND as Tn, QuerySchemaForModelInstance as To, createPrismaDatabaseAdapter as Tr, RelatedModelForRelationship as Ts, toMigrationFileSlug as Tt, applyMigrationToDatabase as U, TransactionCallback as Ua, CastMap as Ui, InitCommand as Un, min as Uo, DatabaseRows as Ur, CaseExpressionBranch as Us, writeAppliedMigrationsState as Ut, applyMigrationRollbackToDatabase as V, SimplePaginationMeta as Va, TimestampNaming as Vc, CastDefinition as Vi, MakeMigrationCommand as Vn, json as Vo, DatabasePrimitive as Vr, AggregateExpressionNode as Vs, resolveMigrationStateFilePath as Vt, applyMigrationToPrismaSchema as W, TransactionCapableClient as Wa, CastType as Wi, CliApp as Wn, raw as Wo, DatabaseValue as Wr, CaseExpressionNode as Ws, writeAppliedMigrationsStateToStore as Wt, buildMigrationSource as X, GroupByAggregateRow as Xa, DelegateRow as Xi, RegisteredFactory as Xn, defineFactory as Xo, QueryComparisonCondition as Xr, InExpressionNode as Xs, applyOperationsToPersistedColumnMappingsState as Xt, buildInverseRelationLine as Y, ExpressionSelectMap as Ya, DelegateOrderBy as Yi, Arkormx as Yn, ModelFactory as Yo, QueryColumnComparisonCondition as Yr, FunctionExpressionNode as Ys, PersistedTimestampColumn as Yt, buildModelBlock as Z, GroupByAggregateSpec as Za, DelegateRows as Zi, RegisteredModel as Zn, SetBasedEagerLoader as Zo, QueryComparisonOperator as Zr, JsonExpressionNode as Zs, createEmptyPersistedColumnMappingsState as Zt, ensureArkormConfigLoading as _, PrismaLikeInclude as _a, RelationMetadataType as _c, QueryNotCondition as _i, QueryExecutionException as _n, ModelEventName as _o, SEEDER_BRAND as _r, RelationDefaultValue as _s, resolveMigrationClassName as _t, getRuntimeCompatibilityAdapter as a, GetUserConfig as aa, ColumnMap as ac, QueryJoin as ai, readPersistedColumnMappingsState as an, AttributeWhereInput as ao, getRegisteredPaths as ar, HasManyRelation as as, deriveRelationFieldName as at, getDefaultStubsPath as b, PrismaLikeSelect as ba, AppliedMigrationsState as bc, QueryScalarComparisonOperator as bi, ModelNotFoundException as bn, ModelRelationshipKey as bo, SeederConstructor as br, RelationResultCache as bs, runPrismaCommand as bt, PrismaDelegateMap as c, NamingCase as ca, HasOneRelationMetadata as cc, QueryJoinConstraint as ci, resolveColumnMappingsFilePath as cn, ModelAttributeValue as co, loadMigrationsFrom as cr, BelongsToManyRelation as cs, findEnumBlock as ct, inferDelegateName as d, PaginationOptions as da, MorphManyRelationMetadata as dc, QueryJoinRawConstraint as di, validatePersistedMetadataFeaturesForMigrations as dn, ModelCreateData as do, registerFactories as dr, RelationAggregateConstraint as ds, formatEnumDefaultValue as dt, DelegateUpdateArgs as ea, ValueExpressionNode as ec, QueryExistsCondition as ei, getPersistedEnumMap as en, AttributeOrderBy as eo, RuntimePathKey as er, MorphOneRelation as es, buildUniqueConstraintLine as et, awaitConfiguredModelsRegistration as f, PaginationURLDriver as fa, MorphOneRelationMetadata as fc, QueryJoinType as fi, writePersistedColumnMappingsState as fn, ModelDeclaredAttributeKey as fo, registerMigrations as fr, RelationAggregateInput as fs, formatRelationAction as ft, emitRuntimeDebugEvent as g, PrismaFindManyArgsLike as ga, RelationMetadata as gc, QueryLogicalOperator as gi, RelationResolutionException as gn, ModelEventListener as go, resetRuntimeRegistryForTests as gr, RelationDefaultResolver as gs, resolveEnumName as gt, defineConfig as h, PrismaDelegateLike as ha, PivotModelStatic as hc, QueryJsonConditionKind as hi, ScopeNotDefinedException as hn, ModelEventHandlerConstructor as ho, registerSeeders as hr, RelationConstraint as hs, pad as ht, RuntimeModuleLoader as i, EagerLoadMap as ia, BelongsToRelationMetadata as ic, QueryGroupCondition as ii, getPersistedTimestampColumns as in, AttributeUpdateInput as io, getRegisteredModels as ir, HasManyThroughRelation as is, deriveRelationAlias as it, loadArkormConfig as j, QuerySchemaRow as ja, SchemaForeignKeyAction as jc, SortDirection as ji, resolveGeneratedExpression as jn, ExpressionBuilder as jo, AdapterInspectionRequest as jr, ArkormCollection as js, deleteAppliedMigrationsStateFromStore as jt, isQuerySchemaLike as k, QuerySchemaInclude as ka, SchemaColumnType as kc, SelectSpec as ki, TableBuilder as kn, CaseExpression as ko, AdapterCapability as kr, LengthAwarePaginator as ks, computeMigrationChecksum as kt, createPrismaAdapter as l, PaginationCurrentPageResolver as la, HasOneThroughRelationMetadata as lc, QueryJoinNestedConstraint as li, resolvePersistedMetadataFeatures as ln, ModelAttributes as lo, loadModelsFrom as lr, Relation as ls, findModelBlock as lt, configureArkormRuntime as m, PrismaClientLike as ma, MorphToRelationMetadata as mc, QueryJsonCondition as mi, UniqueConstraintResolutionException as mn, ModelEventHandler as mo, registerPaths as mr, RelationColumnLookupSpec as ms, getMigrationPlan as mt, PivotModel as n, DelegateWhere as na, DatabaseTablePersistedMetadataOptions as nc, QueryFullTextCondition as ni, getPersistedPrimaryKeyGeneration as nn, AttributeSchemaDelegate as no, getRegisteredFactories as nr, HasOneThroughRelation as ns, deriveCollectionFieldName as nt, resolveRuntimeCompatibilityQuerySchema as o, ModelQuerySchemaLike as oa, HasManyRelationMetadata as oc, QueryJoinBoolean as oi, rebuildPersistedColumnMappingsState as on, DelegateForModelSchema as oo, getRegisteredSeeders as or, BelongsToRelation as os, deriveSingularFieldName as ot, bindAdapterToModels as p, PaginationURLDriverFactory as pa, MorphToManyRelationMetadata as pc, QueryJoinValueConstraint as pi, UnsupportedAdapterFeatureException as pn, ModelEventDispatcher as po, registerModels as pr, RelationAggregateType as ps, generateMigrationFile as pt, buildFieldLine as q, ModelStatic as qa, DelegateFindManyArgs as qi, AttributeOptions as qn, where as qo, InsertManySpec as qr, ExpressionJsonCast as qs, PersistedPrimaryKeyGeneration as qt, LoadedRuntimeModule as r, EagerLoadConstraint as ra, BelongsToManyRelationMetadata as rc, QueryGroupByItem as ri, getPersistedTableMetadata as rn, AttributeSelect as ro, getRegisteredMigrations as rr, HasOneRelation as rs, deriveInverseRelationAlias as rt, resolveRuntimeCompatibilityQuerySchemaOrThrow as s, ModelTableCase as sa, HasManyThroughRelationMetadata as sc, QueryJoinColumnConstraint as si, resetPersistedColumnMappingsCache as sn, GlobalScope as so, loadFactoriesFrom as sr, SingleResultRelation as ss, escapeRegex as st, URLDriver as t, DelegateUpdateData as ta, DatabaseTableOptions as tc, QueryExpressionCondition as ti, getPersistedEnumTsType as tn, AttributeQuerySchema as to, RuntimePathMap as tr, MorphManyRelation as ts, createMigrationTimestamp as tt, createPrismaDelegateMap as u, PaginationMeta as ua, ModelMetadata as uc, QueryJoinNullConstraint as ui, syncPersistedColumnMappingsFromState as un, ModelAttributesOf as uo, loadSeedersFrom as ur, RelationTableLoader as us, formatDefaultValue as ut, getActiveTransactionAdapter as v, PrismaLikeOrderBy as va, AppliedMigrationEntry as vc, QueryOrderBy as vi, QueryExecutionExceptionContext as vn, ModelLifecycleState as vo, Seeder as vr, RelationMetadataProvider as vs, resolvePrismaType as vt, getRuntimePaginationCurrentPageResolver as w, PrismaTransactionCapableClient as wa, MigrationInstanceLike as wc, RawQuerySpec as wi, DB as wn, QuerySchemaForModel as wo, createPrismaCompatibilityAdapter as wr, JoinSource as ws, supportsDatabaseReset as wt, getRuntimeAdapter as x, PrismaLikeSortOrder as xa, GenerateMigrationOptions as xc, QuerySelectColumn as xi, MissingDelegateException as xn, ModelRelationshipResult as xo, SeederInput as xr, RelationTableLookupSpec as xs, stripPrismaSchemaModelsAndEnums as xt, getActiveTransactionClient as y, PrismaLikeScalarFilter as ya, AppliedMigrationRun as yc, QueryRawCondition as yi, QueryConstraintException as yn, ModelOrderByInput as yo, SeederCallArgument as yr, RelationResult as ys, runMigrationWithPrisma as yt, applyCreateTableOperation as z, RuntimeClientLike as za, TimestampColumnBehavior as zc, ArkormDebugEvent as zi, MakeSeederCommand as zn, fn as zo, AggregateSpec as zr, FactoryState as zs, readAppliedMigrationsStateFromStore as zt };