metal-orm 1.1.21 → 1.1.23

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.ts CHANGED
@@ -436,19 +436,14 @@ interface TableOptions {
436
436
  charset?: string;
437
437
  collation?: string;
438
438
  }
439
- interface TableHooks<TEntity = unknown, TContext = unknown> {
440
- beforeInsert?(ctx: TContext, entity: TEntity): Promise<void> | void;
441
- afterInsert?(ctx: TContext, entity: TEntity): Promise<void> | void;
442
- beforeUpdate?(ctx: TContext, entity: TEntity): Promise<void> | void;
443
- afterUpdate?(ctx: TContext, entity: TEntity): Promise<void> | void;
444
- beforeDelete?(ctx: TContext, entity: TEntity): Promise<void> | void;
445
- afterDelete?(ctx: TContext, entity: TEntity): Promise<void> | void;
446
- }
447
439
  /**
448
- * Definition of a database table with its columns and relationships
440
+ * Definition of a database table with its columns and relationships.
441
+ *
442
+ * Runtime lifecycle policy intentionally does not live here. TableDef is
443
+ * mapping/schema metadata and can be shared by multiple OrmSession instances.
449
444
  * @typeParam T - Type of the columns record
450
445
  */
451
- interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDef>, TEntity = unknown, TContext = unknown> {
446
+ interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDef>> {
452
447
  /** Name of the table */
453
448
  name: string;
454
449
  /** Optional schema/catalog name */
@@ -457,8 +452,6 @@ interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDe
457
452
  columns: T;
458
453
  /** Record of relationship definitions keyed by relation name */
459
454
  relations: Record<string, RelationDef>;
460
- /** Optional lifecycle hooks */
461
- hooks?: TableHooks<TEntity, TContext>;
462
455
  /** Composite primary key definition (falls back to column.primary flags) */
463
456
  primaryKey?: string[];
464
457
  /** Secondary indexes */
@@ -473,11 +466,12 @@ interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDe
473
466
  collation?: string;
474
467
  }
475
468
  /**
476
- * Creates a table definition with columns and relationships
469
+ * Creates a table definition with columns and relationships.
477
470
  * @typeParam T - Type of the columns record
478
471
  * @param name - Name of the table
479
- * @param columns - Record of column definitions
472
+ * @param columns - Record of column definitions keyed by property name
480
473
  * @param relations - Record of relationship definitions (optional)
474
+ * @param options - Schema/table options (optional)
481
475
  * @returns Complete table definition with runtime-filled column metadata
482
476
  *
483
477
  * @example
@@ -489,7 +483,7 @@ interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDe
489
483
  * });
490
484
  * ```
491
485
  */
492
- declare const defineTable: <T extends Record<string, ColumnDef>, TEntity = unknown, TContext = unknown>(name: string, columns: T, relations?: Record<string, RelationDef>, hooks?: TableHooks<TEntity, TContext>, options?: TableOptions) => TableDef<T, TEntity, TContext>;
486
+ declare const defineTable: <T extends Record<string, ColumnDef>>(name: string, columns: T, relations?: Record<string, RelationDef>, options?: TableOptions) => TableDef<T>;
493
487
  /**
494
488
  * Assigns relations to a table definition while preserving literal typing.
495
489
  */
@@ -1992,23 +1986,6 @@ interface HydrationMetadata {
1992
1986
  [key: string]: unknown;
1993
1987
  }
1994
1988
 
1995
- type ProcedureDirection = 'in' | 'out' | 'inout';
1996
- interface ProcedureRefNode {
1997
- name: string;
1998
- schema?: string;
1999
- }
2000
- interface ProcedureParamNode {
2001
- name: string;
2002
- direction: ProcedureDirection;
2003
- value?: OperandNode;
2004
- dbType?: string;
2005
- }
2006
- interface ProcedureCallNode {
2007
- type: 'ProcedureCall';
2008
- ref: ProcedureRefNode;
2009
- params: ProcedureParamNode[];
2010
- }
2011
-
2012
1989
  /**
2013
1990
  * Context provided to function renderers.
2014
1991
  */
@@ -2050,30 +2027,16 @@ interface TableFunctionStrategy {
2050
2027
  getRenderer(key: string): TableFunctionRenderer | undefined;
2051
2028
  }
2052
2029
 
2053
- /**
2054
- * Context for SQL compilation with parameter management
2055
- */
2030
+ /** Context for SQL compilation with parameter management. */
2056
2031
  interface CompilerContext {
2057
- /** Array of parameters */
2058
2032
  params: unknown[];
2059
- /** Function to add a parameter and get its placeholder */
2060
2033
  addParameter(value: unknown): string;
2061
2034
  }
2062
- /**
2063
- * Result of SQL compilation
2064
- */
2035
+ /** Result of SQL compilation. */
2065
2036
  interface CompiledQuery {
2066
- /** Generated SQL string */
2067
2037
  sql: string;
2068
- /** Parameters for the query */
2069
2038
  params: unknown[];
2070
2039
  }
2071
- interface CompiledProcedureCall extends CompiledQuery {
2072
- outParams: {
2073
- source: 'none' | 'firstResultSet' | 'lastResultSet';
2074
- names: string[];
2075
- };
2076
- }
2077
2040
  interface SelectCompiler {
2078
2041
  compileSelect(ast: SelectQueryNode): CompiledQuery;
2079
2042
  }
@@ -2087,143 +2050,85 @@ interface DeleteCompiler {
2087
2050
  compileDelete(ast: DeleteQueryNode): CompiledQuery;
2088
2051
  }
2089
2052
  /**
2090
- * Abstract base class for SQL dialect implementations
2053
+ * Public dialect contract consumed by builders and the ORM runtime.
2054
+ * Optional backend features such as stored procedures live in dedicated
2055
+ * capability interfaces; mutation-wide behavior shared by the runtime stays
2056
+ * in this small core contract.
2091
2057
  */
2092
- declare abstract class Dialect implements SelectCompiler, InsertCompiler, UpdateCompiler, DeleteCompiler {
2093
- /** Dialect identifier used for function rendering and formatting */
2058
+ interface Dialect extends SelectCompiler, InsertCompiler, UpdateCompiler, DeleteCompiler {
2059
+ quoteIdentifier(id: string): string;
2060
+ supportsDmlReturningClause(): boolean;
2061
+ }
2062
+ /**
2063
+ * Shared implementation infrastructure for SQL dialects.
2064
+ *
2065
+ * This is deliberately separate from the public Dialect contract: custom
2066
+ * dialects may extend this class, extend SqlDialectBase, or use composition.
2067
+ */
2068
+ declare abstract class DialectBase implements Dialect {
2094
2069
  protected abstract readonly dialect: DialectName$1;
2095
- /**
2096
- * Compiles a SELECT query AST to SQL
2097
- * @param ast - Query AST to compile
2098
- * @returns Compiled query with SQL and parameters
2099
- */
2070
+ private readonly expressionCompilerRegistry;
2071
+ private readonly selectAstNormalizer;
2072
+ protected readonly functionStrategy: FunctionStrategy;
2073
+ protected readonly tableFunctionStrategy: TableFunctionStrategy;
2074
+ protected constructor(functionStrategy?: FunctionStrategy, tableFunctionStrategy?: TableFunctionStrategy);
2100
2075
  compileSelect(ast: SelectQueryNode): CompiledQuery;
2101
2076
  compileInsert(ast: InsertQueryNode): CompiledQuery;
2102
2077
  compileUpdate(ast: UpdateQueryNode): CompiledQuery;
2103
2078
  compileDelete(ast: DeleteQueryNode): CompiledQuery;
2104
- abstract compileProcedureCall(ast: ProcedureCallNode): CompiledProcedureCall;
2105
2079
  supportsDmlReturningClause(): boolean;
2106
- /**
2107
- * Compiles SELECT query AST to SQL (to be implemented by concrete dialects)
2108
- * @param ast - Query AST
2109
- * @param ctx - Compiler context
2110
- * @returns SQL string
2111
- */
2112
2080
  protected abstract compileSelectAst(ast: SelectQueryNode, ctx: CompilerContext): string;
2113
2081
  protected abstract compileInsertAst(ast: InsertQueryNode, ctx: CompilerContext): string;
2114
2082
  protected abstract compileUpdateAst(ast: UpdateQueryNode, ctx: CompilerContext): string;
2115
2083
  protected abstract compileDeleteAst(ast: DeleteQueryNode, ctx: CompilerContext): string;
2116
- /**
2117
- * Quotes an SQL identifier (to be implemented by concrete dialects)
2118
- * @param id - Identifier to quote
2119
- * @returns Quoted identifier
2120
- */
2121
2084
  abstract quoteIdentifier(id: string): string;
2122
- /**
2123
- * Compiles a WHERE clause
2124
- * @param where - WHERE expression
2125
- * @param ctx - Compiler context
2126
- * @returns SQL WHERE clause or empty string
2127
- */
2128
2085
  protected compileWhere(where: ExpressionNode | undefined, ctx: CompilerContext): string;
2129
2086
  protected compileReturning(returning: ColumnNode[] | undefined, _ctx: CompilerContext): string;
2130
- /**
2131
- * Generates subquery for EXISTS expressions
2132
- * Rule: Always forces SELECT 1, ignoring column list
2133
- * Maintains FROM, JOINs, WHERE, GROUP BY, ORDER BY, LIMIT/OFFSET
2134
- * Does not add ';' at the end
2135
- * @param ast - Query AST
2136
- * @param ctx - Compiler context
2137
- * @returns SQL for EXISTS subquery
2138
- */
2139
2087
  protected compileSelectForExists(ast: SelectQueryNode, ctx: CompilerContext): string;
2140
- /**
2141
- * Creates a new compiler context
2142
- * @returns Compiler context with parameter management
2143
- */
2144
2088
  protected createCompilerContext(): CompilerContext;
2145
- /**
2146
- * Formats a parameter placeholder
2147
- * @param index - Parameter index
2148
- * @returns Formatted placeholder string
2149
- */
2150
2089
  protected formatPlaceholder(_index: number): string;
2151
- /**
2152
- * Whether the current dialect supports a given set operation.
2153
- * Override in concrete dialects to restrict support.
2154
- */
2155
2090
  protected supportsSetOperation(_kind: SetOperationKind): boolean;
2156
- /**
2157
- * Validates set-operation semantics:
2158
- * - Ensures the dialect supports requested operators.
2159
- * - Enforces that only the outermost compound query may have ORDER/LIMIT/OFFSET.
2160
- * @param ast - Query to validate
2161
- * @param isOutermost - Whether this node is the outermost compound query
2162
- */
2163
- protected validateSetOperations(ast: SelectQueryNode, isOutermost?: boolean): void;
2164
- /**
2165
- * Hoists CTEs from set-operation operands to the outermost query so WITH appears once.
2166
- * @param ast - Query AST
2167
- * @returns Normalized AST without inner CTEs and a list of hoisted CTEs
2168
- */
2169
- private hoistCtes;
2170
- /**
2171
- * Normalizes a SELECT AST before compilation (validation + CTE hoisting).
2172
- * @param ast - Query AST
2173
- * @returns Normalized query AST
2174
- */
2175
2091
  protected normalizeSelectAst(ast: SelectQueryNode): SelectQueryNode;
2176
- private readonly expressionCompilers;
2177
- private readonly operandCompilers;
2178
- protected readonly functionStrategy: FunctionStrategy;
2179
- protected readonly tableFunctionStrategy: TableFunctionStrategy;
2180
- protected constructor(functionStrategy?: FunctionStrategy, tableFunctionStrategy?: TableFunctionStrategy);
2181
- /**
2182
- * Creates a new Dialect instance (for testing purposes)
2183
- * @param functionStrategy - Optional function strategy
2184
- * @returns New Dialect instance
2185
- */
2186
- static create(functionStrategy?: FunctionStrategy, tableFunctionStrategy?: TableFunctionStrategy): Dialect;
2187
- /**
2188
- * Registers an expression compiler for a specific node type
2189
- * @param type - Expression node type
2190
- * @param compiler - Compiler function
2191
- */
2192
2092
  protected registerExpressionCompiler<T extends ExpressionNode>(type: T['type'], compiler: (node: T, ctx: CompilerContext) => string): void;
2193
- /**
2194
- * Registers an operand compiler for a specific node type
2195
- * @param type - Operand node type
2196
- * @param compiler - Compiler function
2197
- */
2198
2093
  protected registerOperandCompiler<T extends OperandNode>(type: T['type'], compiler: (node: T, ctx: CompilerContext) => string): void;
2199
- /**
2200
- * Compiles an expression node
2201
- * @param node - Expression node to compile
2202
- * @param ctx - Compiler context
2203
- * @returns Compiled SQL expression
2204
- */
2205
2094
  protected compileExpression(node: ExpressionNode, ctx: CompilerContext): string;
2206
- /**
2207
- * Compiles an operand node
2208
- * @param node - Operand node to compile
2209
- * @param ctx - Compiler context
2210
- * @returns Compiled SQL operand
2211
- */
2212
2095
  protected compileOperand(node: OperandNode, ctx: CompilerContext): string;
2213
- /**
2214
- * Compiles an ordering term (operand, expression, or alias reference).
2215
- */
2216
2096
  protected compileOrderingTerm(term: OrderingTerm, ctx: CompilerContext): string;
2217
- private registerDefaultExpressionCompilers;
2218
- private registerDefaultOperandCompilers;
2219
2097
  protected compileJsonPath(_node: JsonPathNode): string;
2220
- /**
2221
- * Compiles a function operand, using the dialect's function strategy.
2222
- */
2223
2098
  protected compileFunctionOperand(fnNode: FunctionNode, ctx: CompilerContext): string;
2099
+ /** Creates a minimal dialect implementation for isolated compiler tests. */
2100
+ static create(functionStrategy?: FunctionStrategy, tableFunctionStrategy?: TableFunctionStrategy): Dialect;
2224
2101
  }
2225
2102
 
2226
2103
  type DialectKey = 'postgres' | 'mysql' | 'sqlite' | 'mssql' | (string & {});
2104
+ type DialectFactoryFn = () => Dialect;
2105
+ declare class DialectFactory {
2106
+ private static registry;
2107
+ private static defaultsInitialized;
2108
+ private static ensureDefaults;
2109
+ /**
2110
+ * Register (or override) a dialect factory for a key.
2111
+ *
2112
+ * Implementations are structural: extending DialectBase/SqlDialectBase is
2113
+ * optional. A composed object satisfying Dialect is a valid registration.
2114
+ */
2115
+ static register(key: DialectKey, factory: DialectFactoryFn): void;
2116
+ /**
2117
+ * Resolve a key into a Dialect instance.
2118
+ * Throws if the key is not registered.
2119
+ */
2120
+ static create(key: DialectKey): Dialect;
2121
+ /**
2122
+ * Clear all registrations (mainly for tests).
2123
+ * Built-ins will be re-registered lazily on the next create().
2124
+ */
2125
+ static clear(): void;
2126
+ }
2127
+ /**
2128
+ * Helper to normalize either a Dialect instance OR a key into a Dialect instance.
2129
+ * This is what query builders will use.
2130
+ */
2131
+ declare const resolveDialectInput: (dialect: Dialect | DialectKey) => Dialect;
2227
2132
 
2228
2133
  /**
2229
2134
  * Node types that can be used in query projections
@@ -3183,7 +3088,7 @@ interface MorphManyRelationMetadata {
3183
3088
  cascade?: CascadeMode;
3184
3089
  }
3185
3090
  /**
3186
- * Union type for all relation metadata.
3091
+ * Union type for all relation metadata types.
3187
3092
  */
3188
3093
  type RelationMetadata = HasManyRelationMetadata | HasOneRelationMetadata | BelongsToRelationMetadata | BelongsToManyRelationMetadata | MorphToRelationMetadata | MorphOneRelationMetadata | MorphManyRelationMetadata;
3189
3094
 
@@ -3918,6 +3823,24 @@ declare class IdentityMap {
3918
3823
  private toIdentityKey;
3919
3824
  }
3920
3825
 
3826
+ /**
3827
+ * Entity lifecycle hooks executed by the Unit of Work.
3828
+ *
3829
+ * Hooks are runtime/session configuration. They are intentionally not stored on
3830
+ * TableDef so the same mapping can be used by independent sessions with
3831
+ * different lifecycle policies.
3832
+ */
3833
+ interface TableHooks<TEntity = unknown, TContext = unknown> {
3834
+ beforeInsert?(ctx: TContext, entity: TEntity): Promise<void> | void;
3835
+ afterInsert?(ctx: TContext, entity: TEntity): Promise<void> | void;
3836
+ beforeUpdate?(ctx: TContext, entity: TEntity): Promise<void> | void;
3837
+ afterUpdate?(ctx: TContext, entity: TEntity): Promise<void> | void;
3838
+ beforeDelete?(ctx: TContext, entity: TEntity): Promise<void> | void;
3839
+ afterDelete?(ctx: TContext, entity: TEntity): Promise<void> | void;
3840
+ }
3841
+ /** @internal */
3842
+ type TableHookResolver = (table: TableDef) => TableHooks | undefined;
3843
+
3921
3844
  /**
3922
3845
  * Unit of Work pattern implementation for tracking entity changes.
3923
3846
  */
@@ -3926,6 +3849,7 @@ declare class UnitOfWork {
3926
3849
  private readonly executor;
3927
3850
  private readonly identityMap;
3928
3851
  private readonly hookContext;
3852
+ private readonly resolveTableHooks;
3929
3853
  private readonly trackedEntities;
3930
3854
  /**
3931
3855
  * Creates a new UnitOfWork instance.
@@ -3933,8 +3857,9 @@ declare class UnitOfWork {
3933
3857
  * @param executor - The database executor
3934
3858
  * @param identityMap - The identity map
3935
3859
  * @param hookContext - Function to get the hook context
3860
+ * @param resolveTableHooks - Session/runtime lifecycle hook resolver
3936
3861
  */
3937
- constructor(dialect: Dialect, executor: DbExecutor, identityMap: IdentityMap, hookContext: () => unknown);
3862
+ constructor(dialect: Dialect, executor: DbExecutor, identityMap: IdentityMap, hookContext: () => unknown, resolveTableHooks?: TableHookResolver);
3938
3863
  /**
3939
3864
  * Gets the identity buckets map.
3940
3865
  */
@@ -4018,7 +3943,7 @@ declare class UnitOfWork {
4018
3943
  */
4019
3944
  private flushDelete;
4020
3945
  /**
4021
- * Runs a table hook if defined.
3946
+ * Runs a lifecycle hook if defined.
4022
3947
  * @param hook - The hook function
4023
3948
  * @param tracked - The tracked entity
4024
3949
  */
@@ -4368,6 +4293,8 @@ type SaveGraphInputPayload<TEntity> = ColumnInput$1<TEntity> & RelationInput<TEn
4368
4293
  */
4369
4294
  type PatchGraphInputPayload<TEntity> = Partial<ColumnInput$1<TEntity>> & Partial<RelationInput<TEntity>>;
4370
4295
 
4296
+ type LifecycleHookTarget = TableDef | EntityConstructor<object>;
4297
+ type LifecycleHookEntity<TTarget extends LifecycleHookTarget> = TTarget extends TableDef ? EntityInstance<TTarget> : TTarget extends EntityConstructor<object> ? InstanceType<TTarget> : never;
4371
4298
  /**
4372
4299
  * Interface for ORM interceptors that allow hooking into the flush lifecycle.
4373
4300
  */
@@ -4431,6 +4358,7 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
4431
4358
  /** The tenant ID for multi-tenancy support */
4432
4359
  readonly tenantId?: string | number;
4433
4360
  private readonly interceptors;
4361
+ private readonly tableHooks;
4434
4362
  private saveGraphDefaults?;
4435
4363
  private transactionDepth;
4436
4364
  private savepointCounter;
@@ -4511,6 +4439,12 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
4511
4439
  * @returns Array of tracked entities
4512
4440
  */
4513
4441
  getEntitiesForTable(table: TableDef): TrackedEntity[];
4442
+ /**
4443
+ * Registers INSERT/UPDATE/DELETE lifecycle hooks for this Session only.
4444
+ * The target can be a TableDef or a decorated entity constructor.
4445
+ * Registering again for the same table replaces the previous hook set.
4446
+ */
4447
+ registerTableHooks<TTarget extends LifecycleHookTarget>(target: TTarget, hooks: TableHooks<LifecycleHookEntity<TTarget>, OrmSession<E>>): void;
4514
4448
  /**
4515
4449
  * Registers an interceptor for flush lifecycle hooks.
4516
4450
  * @param interceptor - The interceptor to register
@@ -4519,7 +4453,7 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
4519
4453
  /**
4520
4454
  * Registers a domain event handler.
4521
4455
  * @param type - The event type
4522
- * @param handler - The event handler
4456
+ * @param handler - The domain event handler
4523
4457
  */
4524
4458
  registerDomainEventHandler<TType extends E['type']>(type: TType, handler: DomainEventHandler<Extract<E, {
4525
4459
  type: TType;
@@ -4598,7 +4532,9 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
4598
4532
  */
4599
4533
  remove(entity: object): Promise<void>;
4600
4534
  /**
4601
- * Flushes pending changes to the database without session hooks, relation processing, or domain events.
4535
+ * Flushes pending changes to the database without session interceptors,
4536
+ * relation processing, or domain events. Table lifecycle hooks still run
4537
+ * because they are part of the Unit of Work.
4602
4538
  */
4603
4539
  flush(): Promise<void>;
4604
4540
  /**
@@ -5879,6 +5815,42 @@ declare class DeleteQueryBuilder<T> {
5879
5815
  getAST(): DeleteQueryNode;
5880
5816
  }
5881
5817
 
5818
+ type ProcedureDirection = 'in' | 'out' | 'inout';
5819
+ interface ProcedureRefNode {
5820
+ name: string;
5821
+ schema?: string;
5822
+ }
5823
+ interface ProcedureParamNode {
5824
+ name: string;
5825
+ direction: ProcedureDirection;
5826
+ value?: OperandNode;
5827
+ dbType?: string;
5828
+ }
5829
+ interface ProcedureCallNode {
5830
+ type: 'ProcedureCall';
5831
+ ref: ProcedureRefNode;
5832
+ params: ProcedureParamNode[];
5833
+ }
5834
+
5835
+ interface CompiledProcedureCall extends CompiledQuery {
5836
+ outParams: {
5837
+ source: 'none' | 'firstResultSet' | 'lastResultSet';
5838
+ names: string[];
5839
+ };
5840
+ }
5841
+ /**
5842
+ * Optional dialect capability for stored-procedure compilation.
5843
+ *
5844
+ * Dialects that do not support procedures simply do not implement this
5845
+ * interface; unsupported behavior is resolved at the capability boundary
5846
+ * rather than through mandatory methods that only throw.
5847
+ */
5848
+ interface ProcedureCompiler {
5849
+ compileProcedureCall(ast: ProcedureCallNode): CompiledProcedureCall;
5850
+ }
5851
+ declare const isProcedureCompiler: (value: unknown) => value is ProcedureCompiler;
5852
+ declare const requireProcedureCompiler: (value: unknown) => ProcedureCompiler;
5853
+
5882
5854
  interface ProcedureExecutionResult {
5883
5855
  resultSets: QueryResult[];
5884
5856
  out: Record<string, unknown>;
@@ -5903,7 +5875,6 @@ declare class ProcedureCallBuilder {
5903
5875
  toSql(dialect: ProcedureDialectInput): string;
5904
5876
  getAST(): ProcedureCallNode;
5905
5877
  execute(session: OrmSession): Promise<ProcedureExecutionResult>;
5906
- private validateMssqlOutDbType;
5907
5878
  }
5908
5879
  declare const callProcedure: (name: string, options?: CallProcedureOptions) => ProcedureCallBuilder;
5909
5880
 
@@ -6006,11 +5977,10 @@ interface ReturningStrategy {
6006
5977
  }
6007
5978
 
6008
5979
  /**
6009
- * Base class for SQL dialects.
6010
- * Provides a common framework for compiling AST nodes into SQL strings.
6011
- * Specific dialects should extend this class and implement dialect-specific logic.
5980
+ * Reusable SQL implementation built on the structural Dialect contract.
5981
+ * Dialects extend this only when its standard SELECT/DML behavior is useful.
6012
5982
  */
6013
- declare abstract class SqlDialectBase extends Dialect {
5983
+ declare abstract class SqlDialectBase extends DialectBase {
6014
5984
  abstract quoteIdentifier(id: string): string;
6015
5985
  protected paginationStrategy: PaginationStrategy;
6016
5986
  protected returningStrategy: ReturningStrategy;
@@ -6060,7 +6030,7 @@ declare abstract class SqlDialectBase extends Dialect {
6060
6030
  /**
6061
6031
  * MySQL dialect implementation
6062
6032
  */
6063
- declare class MySqlDialect extends SqlDialectBase {
6033
+ declare class MySqlDialect extends SqlDialectBase implements ProcedureCompiler {
6064
6034
  protected readonly dialect = "mysql";
6065
6035
  /**
6066
6036
  * Creates a new MySqlDialect instance
@@ -6085,7 +6055,7 @@ declare class MySqlDialect extends SqlDialectBase {
6085
6055
  /**
6086
6056
  * Microsoft SQL Server dialect implementation
6087
6057
  */
6088
- declare class SqlServerDialect extends SqlDialectBase {
6058
+ declare class SqlServerDialect extends SqlDialectBase implements ProcedureCompiler {
6089
6059
  protected readonly dialect = "mssql";
6090
6060
  /**
6091
6061
  * Creates a new SqlServerDialect instance
@@ -6158,13 +6128,12 @@ declare class SqliteDialect extends SqlDialectBase {
6158
6128
  protected formatReturningColumns(returning: ColumnNode[]): string;
6159
6129
  protected compileUpsertClause(ast: InsertQueryNode, ctx: CompilerContext): string;
6160
6130
  supportsDmlReturningClause(): boolean;
6161
- compileProcedureCall(_ast: ProcedureCallNode): CompiledProcedureCall;
6162
6131
  }
6163
6132
 
6164
6133
  /**
6165
6134
  * PostgreSQL dialect implementation
6166
6135
  */
6167
- declare class PostgresDialect extends SqlDialectBase {
6136
+ declare class PostgresDialect extends SqlDialectBase implements ProcedureCompiler {
6168
6137
  protected readonly dialect = "postgres";
6169
6138
  /**
6170
6139
  * Creates a new PostgresDialect instance
@@ -7907,12 +7876,12 @@ declare const jsonify: <T extends object>(value: T) => Jsonify<T>;
7907
7876
  */
7908
7877
  interface EntityOptions {
7909
7878
  tableName?: string;
7910
- hooks?: TableHooks;
7911
7879
  /** Entity type: 'table' (default) or 'view'. Views are read-only. */
7912
7880
  type?: 'table' | 'view';
7913
7881
  }
7914
7882
  /**
7915
7883
  * Class decorator to mark a class as an entity and configure its table mapping.
7884
+ * Runtime lifecycle hooks are registered on OrmSession, not entity metadata.
7916
7885
  * @param options - Configuration options for the entity.
7917
7886
  * @returns A class decorator that registers the entity metadata.
7918
7887
  */
@@ -10151,7 +10120,8 @@ declare class TreeManager<T extends TableDef> {
10151
10120
  */
10152
10121
  insertAsChild(parentId: unknown | null, data: Record<string, unknown>): Promise<unknown>;
10153
10122
  /**
10154
- * Removes a node and re-parents its children to the node's parent.
10123
+ * Removes a node from its current tree position, promotes its direct children
10124
+ * to the removed node's parent, and retains the removed row as a standalone root.
10155
10125
  */
10156
10126
  removeFromTree(node: TreeNodeResult): Promise<void>;
10157
10127
  /**
@@ -10175,6 +10145,8 @@ declare class TreeManager<T extends TableDef> {
10175
10145
  private createNodeResult;
10176
10146
  private getBounds;
10177
10147
  private getPrimaryKeyName;
10148
+ private getScopeEntries;
10149
+ private getScopeExpressions;
10178
10150
  private getMaxRght;
10179
10151
  private shiftForInsert;
10180
10152
  private shiftForDelete;
@@ -10493,4 +10465,4 @@ declare class BulkUpsertExecutor extends BulkBaseExecutor<UpsertExecutorOptions>
10493
10465
  }
10494
10466
  declare function bulkUpsert<TTable extends TableDef>(session: OrmSession, table: TTable, rows: InsertRow[], options?: BulkUpsertOptions): Promise<BulkResult>;
10495
10467
 
10496
- export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetterSqlite3ClientLike, type BetterSqlite3Statement, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, type BulkBaseOptions, type BulkConcurrency, BulkDeleteExecutor, type BulkDeleteOptions, BulkInsertExecutor, type BulkInsertOptions, type BulkResult, BulkUpdateExecutor, type BulkUpdateOptions, BulkUpsertExecutor, type BulkUpsertOptions, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, type CallProcedureOptions, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type ChunkCompleteInfo, type ChunkOutcome, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConflictBuilder, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type CursorPageInfo, type CursorPageOptions, type CursorPageResult, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultMorphManyCollection, DefaultMorphOneReference, DefaultMorphToReference, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExecutionPayload, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type InsertRow, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type InvalidationStrategy, type IsDistinctExpressionNode, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, MorphMany, type MorphManyOptions, type MorphManyRelation, MorphOne, type MorphOneOptions, type MorphOneRelation, MorphTo, type MorphToOptions, type MorphToRelation, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, type NotExpressionNode, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmCacheOptions, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, ProcedureCallBuilder, type ProcedureCallNode, type ProcedureDirection, type ProcedureExecutionResult, type ProcedureOutOptions, type ProcedureParamNode, type ProcedureRefNode, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, type UpdateRow, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type VectorInput, type VectorMetric, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, addEntityRelation, addRelation, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, buildScopeConditions, bulkDelete, bulkDeleteWhere, bulkInsert, bulkUpdate, bulkUpdateWhere, bulkUpsert, calculateRowDepths, calculateTotalPages, callProcedure, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cosineDistance, cot, count, countAll, createApiComponentsSection, createBetterSqlite3Executor, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dotProduct, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, euclideanDistance, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeProcedureAst, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, innerProduct, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isDistinctFrom, isExpressionSelectionNode, isFunctionNode, isMorphRelation, isNotDistinctFrom, isNotNull, isNull, isNullableColumn, isOperandNode, isSingleTargetRelation, isTableDef, isTreeConfig, isValidDuration, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, l1Distance, l2Distance, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, loadMorphManyRelation, loadMorphOneRelation, loadMorphToRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, manhattanDistance, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, morphMany, morphOne, morphTo, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, not, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, parseDuration, payloadResultSets, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, syncTreeEntityMetadata, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toExecutionPayload, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, vectorDistance, vectorMatch, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
10468
+ export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetterSqlite3ClientLike, type BetterSqlite3Statement, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, type BulkBaseOptions, type BulkConcurrency, BulkDeleteExecutor, type BulkDeleteOptions, BulkInsertExecutor, type BulkInsertOptions, type BulkResult, BulkUpdateExecutor, type BulkUpdateOptions, BulkUpsertExecutor, type BulkUpsertOptions, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, type CallProcedureOptions, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type ChunkCompleteInfo, type ChunkOutcome, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CompiledProcedureCall, type CompiledQuery, type CompilerContext, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConflictBuilder, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type CursorPageInfo, type CursorPageOptions, type CursorPageResult, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultMorphManyCollection, DefaultMorphOneReference, DefaultMorphToReference, DefaultTypeStrategy, type DefaultValue, type DeleteCompiler, DeleteQueryBuilder, type Dialect, DialectBase, DialectFactory, type DialectKey, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExecutionPayload, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, type InsertCompiler, InsertQueryBuilder, type InsertRow, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type InvalidationStrategy, type IsDistinctExpressionNode, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, MorphMany, type MorphManyOptions, type MorphManyRelation, MorphOne, type MorphOneOptions, type MorphOneRelation, MorphTo, type MorphToOptions, type MorphToRelation, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, type NotExpressionNode, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmCacheOptions, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, ProcedureCallBuilder, type ProcedureCallNode, type ProcedureCompiler, type ProcedureDirection, type ProcedureExecutionResult, type ProcedureOutOptions, type ProcedureParamNode, type ProcedureRefNode, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, type SelectCompiler, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHookResolver, type TableHooks, type TableOptions, type TableRef$1 as TableRef, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateCompiler, type UpdateDto, UpdateQueryBuilder, type UpdateRow, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type VectorInput, type VectorMetric, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, addEntityRelation, addRelation, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, buildScopeConditions, bulkDelete, bulkDeleteWhere, bulkInsert, bulkUpdate, bulkUpdateWhere, bulkUpsert, calculateRowDepths, calculateTotalPages, callProcedure, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cosineDistance, cot, count, countAll, createApiComponentsSection, createBetterSqlite3Executor, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dotProduct, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, euclideanDistance, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeProcedureAst, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, innerProduct, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isDistinctFrom, isExpressionSelectionNode, isFunctionNode, isMorphRelation, isNotDistinctFrom, isNotNull, isNull, isNullableColumn, isOperandNode, isProcedureCompiler, isSingleTargetRelation, isTableDef, isTreeConfig, isValidDuration, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, l1Distance, l2Distance, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, loadMorphManyRelation, loadMorphOneRelation, loadMorphToRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, manhattanDistance, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, morphMany, morphOne, morphTo, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, not, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, parseDuration, payloadResultSets, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, requireProcedureCompiler, resolveDialectInput, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, syncTreeEntityMetadata, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toExecutionPayload, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, vectorDistance, vectorMatch, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };