metal-orm 1.0.39 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -543,6 +543,14 @@ interface LiteralNode {
543
543
  /** The literal value (string, number, boolean, or null) */
544
544
  value: string | number | boolean | null;
545
545
  }
546
+ /**
547
+ * AST node representing a reference to a SELECT alias (for ORDER BY / GROUP BY).
548
+ */
549
+ interface AliasRefNode {
550
+ type: 'AliasRef';
551
+ /** Alias name to reference */
552
+ name: string;
553
+ }
546
554
  /**
547
555
  * AST node representing a column reference
548
556
  */
@@ -630,10 +638,19 @@ interface WindowFunctionNode {
630
638
  /** Optional alias for the result */
631
639
  alias?: string;
632
640
  }
641
+ /**
642
+ * AST node representing an arithmetic expression (e.g., a + b)
643
+ */
644
+ interface ArithmeticExpressionNode {
645
+ type: 'ArithmeticExpression';
646
+ left: OperandNode;
647
+ operator: '+' | '-' | '*' | '/';
648
+ right: OperandNode;
649
+ }
633
650
  /**
634
651
  * Union type representing any operand that can be used in expressions
635
652
  */
636
- type OperandNode = ColumnNode | LiteralNode | FunctionNode | JsonPathNode | ScalarSubqueryNode | CaseExpressionNode | WindowFunctionNode;
653
+ type OperandNode = AliasRefNode | ColumnNode | LiteralNode | FunctionNode | JsonPathNode | ScalarSubqueryNode | CaseExpressionNode | WindowFunctionNode;
637
654
  declare const isOperandNode: (node: any) => node is OperandNode;
638
655
  declare const isFunctionNode: (node: any) => node is FunctionNode;
639
656
  declare const isCaseExpressionNode: (node: any) => node is CaseExpressionNode;
@@ -712,7 +729,7 @@ interface BetweenExpressionNode {
712
729
  /**
713
730
  * Union type representing any supported expression node
714
731
  */
715
- type ExpressionNode = BinaryExpressionNode | LogicalExpressionNode | NullExpressionNode | InExpressionNode | ExistsExpressionNode | BetweenExpressionNode;
732
+ type ExpressionNode = BinaryExpressionNode | LogicalExpressionNode | NullExpressionNode | InExpressionNode | ExistsExpressionNode | BetweenExpressionNode | ArithmeticExpressionNode;
716
733
 
717
734
  type LiteralValue = LiteralNode['value'];
718
735
  type ValueOperandInput = OperandNode | LiteralValue;
@@ -729,6 +746,10 @@ declare const columnOperand: (col: ColumnRef | ColumnNode) => ColumnNode;
729
746
  * Primarily semantic; SQL rendering still uses the provided table/alias name.
730
747
  */
731
748
  declare const outerRef: (col: ColumnRef | ColumnNode) => ColumnNode;
749
+ /**
750
+ * References a SELECT alias (useful for ORDER BY / GROUP BY).
751
+ */
752
+ declare const aliasRef: (name: string) => AliasRefNode;
732
753
  /**
733
754
  * Creates an outer-scoped column reference using a specific table or alias name.
734
755
  */
@@ -836,6 +857,10 @@ declare const between: (left: OperandNode | ColumnRef, lower: OperandNode | Colu
836
857
  * @returns NOT BETWEEN expression node
837
858
  */
838
859
  declare const notBetween: (left: OperandNode | ColumnRef, lower: OperandNode | ColumnRef | string | number, upper: OperandNode | ColumnRef | string | number) => BetweenExpressionNode;
860
+ declare const add: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
861
+ declare const sub: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
862
+ declare const mul: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
863
+ declare const div: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
839
864
  /**
840
865
  * Creates a JSON path expression
841
866
  * @param col - Source column
@@ -981,6 +1006,7 @@ interface ExpressionVisitor<R> {
981
1006
  visitInExpression?(node: InExpressionNode): R;
982
1007
  visitExistsExpression?(node: ExistsExpressionNode): R;
983
1008
  visitBetweenExpression?(node: BetweenExpressionNode): R;
1009
+ visitArithmeticExpression?(node: ArithmeticExpressionNode): R;
984
1010
  otherwise?(node: ExpressionNode): R;
985
1011
  }
986
1012
  /**
@@ -994,6 +1020,7 @@ interface OperandVisitor<R> {
994
1020
  visitScalarSubquery?(node: ScalarSubqueryNode): R;
995
1021
  visitCaseExpression?(node: CaseExpressionNode): R;
996
1022
  visitWindowFunction?(node: WindowFunctionNode): R;
1023
+ visitAliasRef?(node: AliasRefNode): R;
997
1024
  otherwise?(node: OperandNode): R;
998
1025
  }
999
1026
  type ExpressionDispatch = <R>(node: any, visitor: ExpressionVisitor<R>) => R;
@@ -1095,15 +1122,23 @@ interface DerivedTableNode {
1095
1122
  columnAliases?: string[];
1096
1123
  }
1097
1124
  type TableSourceNode = TableNode | FunctionTableNode | DerivedTableNode;
1125
+ /**
1126
+ * Any expression that can appear in ORDER BY / GROUP BY terms.
1127
+ */
1128
+ type OrderingTerm = OperandNode | ExpressionNode | AliasRefNode;
1098
1129
  /**
1099
1130
  * AST node representing an ORDER BY clause
1100
1131
  */
1101
1132
  interface OrderByNode {
1102
1133
  type: 'OrderBy';
1103
- /** Column to order by */
1104
- column: ColumnNode;
1134
+ /** Expression/operand/alias to order by */
1135
+ term: OrderingTerm;
1105
1136
  /** Order direction (ASC or DESC) */
1106
1137
  direction: OrderDirection;
1138
+ /** Optional nulls ordering (NULLS FIRST/LAST) */
1139
+ nulls?: 'FIRST' | 'LAST';
1140
+ /** Optional collation */
1141
+ collation?: string;
1107
1142
  }
1108
1143
  /**
1109
1144
  * AST node representing a Common Table Expression (CTE)
@@ -1149,7 +1184,7 @@ interface SelectQueryNode {
1149
1184
  /** Optional WHERE clause */
1150
1185
  where?: ExpressionNode;
1151
1186
  /** Optional GROUP BY clause */
1152
- groupBy?: ColumnNode[];
1187
+ groupBy?: OrderingTerm[];
1153
1188
  /** Optional HAVING clause */
1154
1189
  having?: ExpressionNode;
1155
1190
  /** Optional ORDER BY clause */
@@ -1423,6 +1458,10 @@ declare abstract class Dialect implements SelectCompiler, InsertCompiler, Update
1423
1458
  * @returns Compiled SQL operand
1424
1459
  */
1425
1460
  protected compileOperand(node: OperandNode, ctx: CompilerContext): string;
1461
+ /**
1462
+ * Compiles an ordering term (operand, expression, or alias reference).
1463
+ */
1464
+ protected compileOrderingTerm(term: OrderingTerm, ctx: CompilerContext): string;
1426
1465
  private registerDefaultExpressionCompilers;
1427
1466
  private registerDefaultOperandCompilers;
1428
1467
  protected compileJsonPath(node: JsonPathNode): string;
@@ -1494,10 +1533,10 @@ declare class SelectQueryState {
1494
1533
  withHaving(predicate: ExpressionNode): SelectQueryState;
1495
1534
  /**
1496
1535
  * Adds GROUP BY columns to the query
1497
- * @param columns - Columns to group by
1536
+ * @param columns - Terms to group by
1498
1537
  * @returns New SelectQueryState with GROUP BY clause
1499
1538
  */
1500
- withGroupBy(columns: ColumnNode[]): SelectQueryState;
1539
+ withGroupBy(columns: OrderingTerm[]): SelectQueryState;
1501
1540
  /**
1502
1541
  * Adds ORDER BY clauses to the query
1503
1542
  * @param orderBy - ORDER BY nodes
@@ -1660,6 +1699,7 @@ declare class HydrationManager {
1660
1699
  private getProjectionNames;
1661
1700
  private buildProjectionAliasMap;
1662
1701
  private mapOrderBy;
1702
+ private mapOrderingTerm;
1663
1703
  private buildPagingColumns;
1664
1704
  }
1665
1705
 
@@ -1746,7 +1786,7 @@ declare class QueryAstService {
1746
1786
  * @param col - Column to group by
1747
1787
  * @returns Updated query state with GROUP BY clause
1748
1788
  */
1749
- withGroupBy(col: ColumnDef | ColumnNode): SelectQueryState;
1789
+ withGroupBy(col: ColumnDef | OrderingTerm): SelectQueryState;
1750
1790
  /**
1751
1791
  * Adds a HAVING clause to the query
1752
1792
  * @param expr - Expression for the HAVING clause
@@ -1759,7 +1799,7 @@ declare class QueryAstService {
1759
1799
  * @param direction - Order direction (ASC/DESC)
1760
1800
  * @returns Updated query state with ORDER BY clause
1761
1801
  */
1762
- withOrderBy(col: ColumnDef | ColumnNode, direction: OrderDirection): SelectQueryState;
1802
+ withOrderBy(term: ColumnDef | OrderingTerm, direction: OrderDirection, nulls?: 'FIRST' | 'LAST', collation?: string): SelectQueryState;
1763
1803
  /**
1764
1804
  * Adds a DISTINCT clause to the query
1765
1805
  * @param cols - Columns to make distinct
@@ -1785,6 +1825,7 @@ declare class QueryAstService {
1785
1825
  * @returns Combined expression
1786
1826
  */
1787
1827
  private combineExpressions;
1828
+ private normalizeOrderingTerm;
1788
1829
  }
1789
1830
 
1790
1831
  /**
@@ -2543,15 +2584,11 @@ declare class SelectQueryBuilder<T = any, TTable extends TableDef = TableDef> {
2543
2584
  */
2544
2585
  where(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
2545
2586
  /**
2546
-
2547
2587
  * Adds a GROUP BY clause to the query
2548
-
2549
- * @param col - Column definition or column node to group by
2550
-
2588
+ * @param term - Column definition or ordering term to group by
2551
2589
  * @returns New query builder instance with the GROUP BY clause
2552
-
2553
2590
  */
2554
- groupBy(col: ColumnDef | ColumnNode): SelectQueryBuilder<T, TTable>;
2591
+ groupBy(term: ColumnDef | OrderingTerm): SelectQueryBuilder<T, TTable>;
2555
2592
  /**
2556
2593
 
2557
2594
  * Adds a HAVING condition to the query
@@ -2563,17 +2600,16 @@ declare class SelectQueryBuilder<T = any, TTable extends TableDef = TableDef> {
2563
2600
  */
2564
2601
  having(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
2565
2602
  /**
2566
-
2567
2603
  * Adds an ORDER BY clause to the query
2568
-
2569
- * @param col - Column definition or column node to order by
2570
-
2571
- * @param direction - Order direction (defaults to ASC)
2572
-
2604
+ * @param term - Column definition or ordering term to order by
2605
+ * @param directionOrOptions - Order direction or options (defaults to ASC)
2573
2606
  * @returns New query builder instance with the ORDER BY clause
2574
-
2575
2607
  */
2576
- orderBy(col: ColumnDef | ColumnNode, direction?: OrderDirection): SelectQueryBuilder<T, TTable>;
2608
+ orderBy(term: ColumnDef | OrderingTerm, directionOrOptions?: OrderDirection | {
2609
+ direction?: OrderDirection;
2610
+ nulls?: 'FIRST' | 'LAST';
2611
+ collation?: string;
2612
+ }): SelectQueryBuilder<T, TTable>;
2577
2613
  /**
2578
2614
 
2579
2615
  * Adds a DISTINCT clause to the query
@@ -2913,6 +2949,8 @@ declare abstract class SqlDialectBase extends Dialect {
2913
2949
  protected compileHaving(ast: SelectQueryNode, ctx: CompilerContext): string;
2914
2950
  protected stripTrailingSemicolon(sql: string): string;
2915
2951
  protected wrapSetOperand(sql: string): string;
2952
+ protected renderOrderByNulls(order: OrderByNode): string | undefined;
2953
+ protected renderOrderByCollation(order: OrderByNode): string | undefined;
2916
2954
  }
2917
2955
 
2918
2956
  /**
@@ -2978,6 +3016,8 @@ declare class SqlServerDialect extends Dialect {
2978
3016
  private compileSelectCore;
2979
3017
  private compileOrderBy;
2980
3018
  private compilePagination;
3019
+ private renderOrderByNulls;
3020
+ private renderOrderByCollation;
2981
3021
  private compileTableSource;
2982
3022
  private compileDerivedTable;
2983
3023
  private compileCtes;
@@ -3519,12 +3559,17 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
3519
3559
  * @returns TypeScript code representation
3520
3560
  */
3521
3561
  private printOperand;
3562
+ /**
3563
+ * Prints an ordering term (operand/expression/alias) to TypeScript code.
3564
+ */
3565
+ private printOrderingTerm;
3522
3566
  visitBinaryExpression(binary: BinaryExpressionNode): string;
3523
3567
  visitLogicalExpression(logical: LogicalExpressionNode): string;
3524
3568
  visitNullExpression(nullExpr: NullExpressionNode): string;
3525
3569
  visitInExpression(inExpr: InExpressionNode): string;
3526
3570
  visitExistsExpression(existsExpr: ExistsExpressionNode): string;
3527
3571
  visitBetweenExpression(betweenExpr: BetweenExpressionNode): string;
3572
+ visitArithmeticExpression(arithExpr: ArithmeticExpressionNode): string;
3528
3573
  visitColumn(node: ColumnNode): string;
3529
3574
  visitLiteral(node: LiteralNode): string;
3530
3575
  visitFunction(node: FunctionNode): string;
@@ -3532,6 +3577,7 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
3532
3577
  visitScalarSubquery(node: ScalarSubqueryNode): string;
3533
3578
  visitCaseExpression(node: CaseExpressionNode): string;
3534
3579
  visitWindowFunction(node: WindowFunctionNode): string;
3580
+ visitAliasRef(node: AliasRefNode): string;
3535
3581
  /**
3536
3582
  * Prints a binary expression to TypeScript code
3537
3583
  * @param binary - Binary expression node
@@ -3544,6 +3590,7 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
3544
3590
  * @returns TypeScript code representation
3545
3591
  */
3546
3592
  private printLogicalExpression;
3593
+ private printArithmeticExpression;
3547
3594
  /**
3548
3595
  * Prints an IN expression to TypeScript code
3549
3596
  * @param inExpr - IN expression node
@@ -3870,4 +3917,4 @@ interface CreateTediousClientOptions {
3870
3917
  declare function createTediousMssqlClient(connection: TediousConnectionLike, { Request, TYPES }: TediousModule, options?: CreateTediousClientOptions): MssqlClientLike;
3871
3918
  declare function createTediousExecutor(connection: TediousConnectionLike, module: TediousModule, options?: CreateTediousClientOptions): DbExecutor;
3872
3919
 
3873
- export { type AnyDomainEvent, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ExternalTransaction, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, addDomainEvent, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createColumn, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createLiteral, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
3920
+ export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ExternalTransaction, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createColumn, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createLiteral, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, mul, neq, notBetween, notExists, notInList, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
package/dist/index.d.ts CHANGED
@@ -543,6 +543,14 @@ interface LiteralNode {
543
543
  /** The literal value (string, number, boolean, or null) */
544
544
  value: string | number | boolean | null;
545
545
  }
546
+ /**
547
+ * AST node representing a reference to a SELECT alias (for ORDER BY / GROUP BY).
548
+ */
549
+ interface AliasRefNode {
550
+ type: 'AliasRef';
551
+ /** Alias name to reference */
552
+ name: string;
553
+ }
546
554
  /**
547
555
  * AST node representing a column reference
548
556
  */
@@ -630,10 +638,19 @@ interface WindowFunctionNode {
630
638
  /** Optional alias for the result */
631
639
  alias?: string;
632
640
  }
641
+ /**
642
+ * AST node representing an arithmetic expression (e.g., a + b)
643
+ */
644
+ interface ArithmeticExpressionNode {
645
+ type: 'ArithmeticExpression';
646
+ left: OperandNode;
647
+ operator: '+' | '-' | '*' | '/';
648
+ right: OperandNode;
649
+ }
633
650
  /**
634
651
  * Union type representing any operand that can be used in expressions
635
652
  */
636
- type OperandNode = ColumnNode | LiteralNode | FunctionNode | JsonPathNode | ScalarSubqueryNode | CaseExpressionNode | WindowFunctionNode;
653
+ type OperandNode = AliasRefNode | ColumnNode | LiteralNode | FunctionNode | JsonPathNode | ScalarSubqueryNode | CaseExpressionNode | WindowFunctionNode;
637
654
  declare const isOperandNode: (node: any) => node is OperandNode;
638
655
  declare const isFunctionNode: (node: any) => node is FunctionNode;
639
656
  declare const isCaseExpressionNode: (node: any) => node is CaseExpressionNode;
@@ -712,7 +729,7 @@ interface BetweenExpressionNode {
712
729
  /**
713
730
  * Union type representing any supported expression node
714
731
  */
715
- type ExpressionNode = BinaryExpressionNode | LogicalExpressionNode | NullExpressionNode | InExpressionNode | ExistsExpressionNode | BetweenExpressionNode;
732
+ type ExpressionNode = BinaryExpressionNode | LogicalExpressionNode | NullExpressionNode | InExpressionNode | ExistsExpressionNode | BetweenExpressionNode | ArithmeticExpressionNode;
716
733
 
717
734
  type LiteralValue = LiteralNode['value'];
718
735
  type ValueOperandInput = OperandNode | LiteralValue;
@@ -729,6 +746,10 @@ declare const columnOperand: (col: ColumnRef | ColumnNode) => ColumnNode;
729
746
  * Primarily semantic; SQL rendering still uses the provided table/alias name.
730
747
  */
731
748
  declare const outerRef: (col: ColumnRef | ColumnNode) => ColumnNode;
749
+ /**
750
+ * References a SELECT alias (useful for ORDER BY / GROUP BY).
751
+ */
752
+ declare const aliasRef: (name: string) => AliasRefNode;
732
753
  /**
733
754
  * Creates an outer-scoped column reference using a specific table or alias name.
734
755
  */
@@ -836,6 +857,10 @@ declare const between: (left: OperandNode | ColumnRef, lower: OperandNode | Colu
836
857
  * @returns NOT BETWEEN expression node
837
858
  */
838
859
  declare const notBetween: (left: OperandNode | ColumnRef, lower: OperandNode | ColumnRef | string | number, upper: OperandNode | ColumnRef | string | number) => BetweenExpressionNode;
860
+ declare const add: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
861
+ declare const sub: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
862
+ declare const mul: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
863
+ declare const div: (left: OperandNode | ColumnRef, right: OperandNode | ColumnRef | string | number) => ArithmeticExpressionNode;
839
864
  /**
840
865
  * Creates a JSON path expression
841
866
  * @param col - Source column
@@ -981,6 +1006,7 @@ interface ExpressionVisitor<R> {
981
1006
  visitInExpression?(node: InExpressionNode): R;
982
1007
  visitExistsExpression?(node: ExistsExpressionNode): R;
983
1008
  visitBetweenExpression?(node: BetweenExpressionNode): R;
1009
+ visitArithmeticExpression?(node: ArithmeticExpressionNode): R;
984
1010
  otherwise?(node: ExpressionNode): R;
985
1011
  }
986
1012
  /**
@@ -994,6 +1020,7 @@ interface OperandVisitor<R> {
994
1020
  visitScalarSubquery?(node: ScalarSubqueryNode): R;
995
1021
  visitCaseExpression?(node: CaseExpressionNode): R;
996
1022
  visitWindowFunction?(node: WindowFunctionNode): R;
1023
+ visitAliasRef?(node: AliasRefNode): R;
997
1024
  otherwise?(node: OperandNode): R;
998
1025
  }
999
1026
  type ExpressionDispatch = <R>(node: any, visitor: ExpressionVisitor<R>) => R;
@@ -1095,15 +1122,23 @@ interface DerivedTableNode {
1095
1122
  columnAliases?: string[];
1096
1123
  }
1097
1124
  type TableSourceNode = TableNode | FunctionTableNode | DerivedTableNode;
1125
+ /**
1126
+ * Any expression that can appear in ORDER BY / GROUP BY terms.
1127
+ */
1128
+ type OrderingTerm = OperandNode | ExpressionNode | AliasRefNode;
1098
1129
  /**
1099
1130
  * AST node representing an ORDER BY clause
1100
1131
  */
1101
1132
  interface OrderByNode {
1102
1133
  type: 'OrderBy';
1103
- /** Column to order by */
1104
- column: ColumnNode;
1134
+ /** Expression/operand/alias to order by */
1135
+ term: OrderingTerm;
1105
1136
  /** Order direction (ASC or DESC) */
1106
1137
  direction: OrderDirection;
1138
+ /** Optional nulls ordering (NULLS FIRST/LAST) */
1139
+ nulls?: 'FIRST' | 'LAST';
1140
+ /** Optional collation */
1141
+ collation?: string;
1107
1142
  }
1108
1143
  /**
1109
1144
  * AST node representing a Common Table Expression (CTE)
@@ -1149,7 +1184,7 @@ interface SelectQueryNode {
1149
1184
  /** Optional WHERE clause */
1150
1185
  where?: ExpressionNode;
1151
1186
  /** Optional GROUP BY clause */
1152
- groupBy?: ColumnNode[];
1187
+ groupBy?: OrderingTerm[];
1153
1188
  /** Optional HAVING clause */
1154
1189
  having?: ExpressionNode;
1155
1190
  /** Optional ORDER BY clause */
@@ -1423,6 +1458,10 @@ declare abstract class Dialect implements SelectCompiler, InsertCompiler, Update
1423
1458
  * @returns Compiled SQL operand
1424
1459
  */
1425
1460
  protected compileOperand(node: OperandNode, ctx: CompilerContext): string;
1461
+ /**
1462
+ * Compiles an ordering term (operand, expression, or alias reference).
1463
+ */
1464
+ protected compileOrderingTerm(term: OrderingTerm, ctx: CompilerContext): string;
1426
1465
  private registerDefaultExpressionCompilers;
1427
1466
  private registerDefaultOperandCompilers;
1428
1467
  protected compileJsonPath(node: JsonPathNode): string;
@@ -1494,10 +1533,10 @@ declare class SelectQueryState {
1494
1533
  withHaving(predicate: ExpressionNode): SelectQueryState;
1495
1534
  /**
1496
1535
  * Adds GROUP BY columns to the query
1497
- * @param columns - Columns to group by
1536
+ * @param columns - Terms to group by
1498
1537
  * @returns New SelectQueryState with GROUP BY clause
1499
1538
  */
1500
- withGroupBy(columns: ColumnNode[]): SelectQueryState;
1539
+ withGroupBy(columns: OrderingTerm[]): SelectQueryState;
1501
1540
  /**
1502
1541
  * Adds ORDER BY clauses to the query
1503
1542
  * @param orderBy - ORDER BY nodes
@@ -1660,6 +1699,7 @@ declare class HydrationManager {
1660
1699
  private getProjectionNames;
1661
1700
  private buildProjectionAliasMap;
1662
1701
  private mapOrderBy;
1702
+ private mapOrderingTerm;
1663
1703
  private buildPagingColumns;
1664
1704
  }
1665
1705
 
@@ -1746,7 +1786,7 @@ declare class QueryAstService {
1746
1786
  * @param col - Column to group by
1747
1787
  * @returns Updated query state with GROUP BY clause
1748
1788
  */
1749
- withGroupBy(col: ColumnDef | ColumnNode): SelectQueryState;
1789
+ withGroupBy(col: ColumnDef | OrderingTerm): SelectQueryState;
1750
1790
  /**
1751
1791
  * Adds a HAVING clause to the query
1752
1792
  * @param expr - Expression for the HAVING clause
@@ -1759,7 +1799,7 @@ declare class QueryAstService {
1759
1799
  * @param direction - Order direction (ASC/DESC)
1760
1800
  * @returns Updated query state with ORDER BY clause
1761
1801
  */
1762
- withOrderBy(col: ColumnDef | ColumnNode, direction: OrderDirection): SelectQueryState;
1802
+ withOrderBy(term: ColumnDef | OrderingTerm, direction: OrderDirection, nulls?: 'FIRST' | 'LAST', collation?: string): SelectQueryState;
1763
1803
  /**
1764
1804
  * Adds a DISTINCT clause to the query
1765
1805
  * @param cols - Columns to make distinct
@@ -1785,6 +1825,7 @@ declare class QueryAstService {
1785
1825
  * @returns Combined expression
1786
1826
  */
1787
1827
  private combineExpressions;
1828
+ private normalizeOrderingTerm;
1788
1829
  }
1789
1830
 
1790
1831
  /**
@@ -2543,15 +2584,11 @@ declare class SelectQueryBuilder<T = any, TTable extends TableDef = TableDef> {
2543
2584
  */
2544
2585
  where(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
2545
2586
  /**
2546
-
2547
2587
  * Adds a GROUP BY clause to the query
2548
-
2549
- * @param col - Column definition or column node to group by
2550
-
2588
+ * @param term - Column definition or ordering term to group by
2551
2589
  * @returns New query builder instance with the GROUP BY clause
2552
-
2553
2590
  */
2554
- groupBy(col: ColumnDef | ColumnNode): SelectQueryBuilder<T, TTable>;
2591
+ groupBy(term: ColumnDef | OrderingTerm): SelectQueryBuilder<T, TTable>;
2555
2592
  /**
2556
2593
 
2557
2594
  * Adds a HAVING condition to the query
@@ -2563,17 +2600,16 @@ declare class SelectQueryBuilder<T = any, TTable extends TableDef = TableDef> {
2563
2600
  */
2564
2601
  having(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
2565
2602
  /**
2566
-
2567
2603
  * Adds an ORDER BY clause to the query
2568
-
2569
- * @param col - Column definition or column node to order by
2570
-
2571
- * @param direction - Order direction (defaults to ASC)
2572
-
2604
+ * @param term - Column definition or ordering term to order by
2605
+ * @param directionOrOptions - Order direction or options (defaults to ASC)
2573
2606
  * @returns New query builder instance with the ORDER BY clause
2574
-
2575
2607
  */
2576
- orderBy(col: ColumnDef | ColumnNode, direction?: OrderDirection): SelectQueryBuilder<T, TTable>;
2608
+ orderBy(term: ColumnDef | OrderingTerm, directionOrOptions?: OrderDirection | {
2609
+ direction?: OrderDirection;
2610
+ nulls?: 'FIRST' | 'LAST';
2611
+ collation?: string;
2612
+ }): SelectQueryBuilder<T, TTable>;
2577
2613
  /**
2578
2614
 
2579
2615
  * Adds a DISTINCT clause to the query
@@ -2913,6 +2949,8 @@ declare abstract class SqlDialectBase extends Dialect {
2913
2949
  protected compileHaving(ast: SelectQueryNode, ctx: CompilerContext): string;
2914
2950
  protected stripTrailingSemicolon(sql: string): string;
2915
2951
  protected wrapSetOperand(sql: string): string;
2952
+ protected renderOrderByNulls(order: OrderByNode): string | undefined;
2953
+ protected renderOrderByCollation(order: OrderByNode): string | undefined;
2916
2954
  }
2917
2955
 
2918
2956
  /**
@@ -2978,6 +3016,8 @@ declare class SqlServerDialect extends Dialect {
2978
3016
  private compileSelectCore;
2979
3017
  private compileOrderBy;
2980
3018
  private compilePagination;
3019
+ private renderOrderByNulls;
3020
+ private renderOrderByCollation;
2981
3021
  private compileTableSource;
2982
3022
  private compileDerivedTable;
2983
3023
  private compileCtes;
@@ -3519,12 +3559,17 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
3519
3559
  * @returns TypeScript code representation
3520
3560
  */
3521
3561
  private printOperand;
3562
+ /**
3563
+ * Prints an ordering term (operand/expression/alias) to TypeScript code.
3564
+ */
3565
+ private printOrderingTerm;
3522
3566
  visitBinaryExpression(binary: BinaryExpressionNode): string;
3523
3567
  visitLogicalExpression(logical: LogicalExpressionNode): string;
3524
3568
  visitNullExpression(nullExpr: NullExpressionNode): string;
3525
3569
  visitInExpression(inExpr: InExpressionNode): string;
3526
3570
  visitExistsExpression(existsExpr: ExistsExpressionNode): string;
3527
3571
  visitBetweenExpression(betweenExpr: BetweenExpressionNode): string;
3572
+ visitArithmeticExpression(arithExpr: ArithmeticExpressionNode): string;
3528
3573
  visitColumn(node: ColumnNode): string;
3529
3574
  visitLiteral(node: LiteralNode): string;
3530
3575
  visitFunction(node: FunctionNode): string;
@@ -3532,6 +3577,7 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
3532
3577
  visitScalarSubquery(node: ScalarSubqueryNode): string;
3533
3578
  visitCaseExpression(node: CaseExpressionNode): string;
3534
3579
  visitWindowFunction(node: WindowFunctionNode): string;
3580
+ visitAliasRef(node: AliasRefNode): string;
3535
3581
  /**
3536
3582
  * Prints a binary expression to TypeScript code
3537
3583
  * @param binary - Binary expression node
@@ -3544,6 +3590,7 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
3544
3590
  * @returns TypeScript code representation
3545
3591
  */
3546
3592
  private printLogicalExpression;
3593
+ private printArithmeticExpression;
3547
3594
  /**
3548
3595
  * Prints an IN expression to TypeScript code
3549
3596
  * @param inExpr - IN expression node
@@ -3870,4 +3917,4 @@ interface CreateTediousClientOptions {
3870
3917
  declare function createTediousMssqlClient(connection: TediousConnectionLike, { Request, TYPES }: TediousModule, options?: CreateTediousClientOptions): MssqlClientLike;
3871
3918
  declare function createTediousExecutor(connection: TediousConnectionLike, module: TediousModule, options?: CreateTediousClientOptions): DbExecutor;
3872
3919
 
3873
- export { type AnyDomainEvent, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ExternalTransaction, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, addDomainEvent, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createColumn, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createLiteral, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
3920
+ export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ExternalTransaction, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createColumn, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createLiteral, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, mul, neq, notBetween, notExists, notInList, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };