metal-orm 1.0.89 → 1.0.91

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.
Files changed (57) hide show
  1. package/dist/index.cjs +2968 -2983
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +784 -251
  4. package/dist/index.d.ts +784 -251
  5. package/dist/index.js +2913 -2975
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -3
  8. package/src/codegen/typescript.ts +29 -40
  9. package/src/core/ast/expression-builders.ts +34 -53
  10. package/src/core/ast/expression-nodes.ts +51 -72
  11. package/src/core/ast/expression-visitor.ts +219 -252
  12. package/src/core/ast/expression.ts +20 -21
  13. package/src/core/ddl/introspect/utils.ts +45 -45
  14. package/src/core/dialect/abstract.ts +55 -81
  15. package/src/core/execution/db-executor.ts +4 -5
  16. package/src/core/execution/executors/mysql-executor.ts +7 -9
  17. package/src/decorators/bootstrap.ts +29 -26
  18. package/src/dto/apply-filter.ts +279 -0
  19. package/src/dto/dto-types.ts +229 -0
  20. package/src/dto/filter-types.ts +193 -0
  21. package/src/dto/index.ts +97 -0
  22. package/src/dto/openapi/generators/base.ts +29 -0
  23. package/src/dto/openapi/generators/column.ts +34 -0
  24. package/src/dto/openapi/generators/dto.ts +94 -0
  25. package/src/dto/openapi/generators/filter.ts +74 -0
  26. package/src/dto/openapi/generators/nested-dto.ts +532 -0
  27. package/src/dto/openapi/generators/pagination.ts +111 -0
  28. package/src/dto/openapi/generators/relation-filter.ts +210 -0
  29. package/src/dto/openapi/index.ts +17 -0
  30. package/src/dto/openapi/type-mappings.ts +191 -0
  31. package/src/dto/openapi/types.ts +90 -0
  32. package/src/dto/openapi/utilities.ts +45 -0
  33. package/src/dto/pagination-utils.ts +150 -0
  34. package/src/dto/transform.ts +197 -0
  35. package/src/index.ts +5 -3
  36. package/src/orm/entity-context.ts +9 -9
  37. package/src/orm/entity.ts +74 -74
  38. package/src/orm/orm-session.ts +159 -159
  39. package/src/orm/relation-change-processor.ts +3 -3
  40. package/src/orm/runtime-types.ts +5 -5
  41. package/src/orm/unit-of-work.ts +13 -25
  42. package/src/query-builder/query-ast-service.ts +287 -300
  43. package/src/query-builder/relation-filter-utils.ts +159 -160
  44. package/src/query-builder/select.ts +137 -192
  45. package/src/schema/column-types.ts +4 -4
  46. package/src/schema/types.ts +5 -1
  47. package/src/core/ast/ast-validation.ts +0 -19
  48. package/src/core/ast/param-proxy.ts +0 -47
  49. package/src/core/ast/query-visitor.ts +0 -273
  50. package/src/openapi/index.ts +0 -4
  51. package/src/openapi/query-parameters.ts +0 -207
  52. package/src/openapi/schema-extractor-input.ts +0 -193
  53. package/src/openapi/schema-extractor-output.ts +0 -427
  54. package/src/openapi/schema-extractor-utils.ts +0 -110
  55. package/src/openapi/schema-extractor.ts +0 -120
  56. package/src/openapi/schema-types.ts +0 -187
  57. package/src/openapi/type-mappers.ts +0 -227
package/dist/index.d.cts CHANGED
@@ -23,7 +23,7 @@ type ReferentialAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SE
23
23
  interface RawDefaultValue {
24
24
  raw: string;
25
25
  }
26
- type DefaultValue = unknown | RawDefaultValue;
26
+ type DefaultValue = string | number | boolean | Date | null | RawDefaultValue;
27
27
  interface ForeignKeyReference {
28
28
  /** Target table name */
29
29
  table: string;
@@ -69,7 +69,7 @@ interface ColumnDef<T extends ColumnType = ColumnType, TRuntime = unknown> {
69
69
  /** Column comment/description */
70
70
  comment?: string;
71
71
  /** Additional arguments for the column type (e.g., VARCHAR length) */
72
- args?: unknown[];
72
+ args?: (string | number)[];
73
73
  /** Table name this column belongs to (filled at runtime by defineTable) */
74
74
  table?: string;
75
75
  }
@@ -161,7 +161,7 @@ declare const col: {
161
161
  */
162
162
  custom: (type: string, opts?: {
163
163
  dialect?: string;
164
- args?: unknown[];
164
+ args?: (string | number)[];
165
165
  tsType?: unknown;
166
166
  }) => ColumnDef;
167
167
  /**
@@ -181,7 +181,7 @@ declare const col: {
181
181
  /**
182
182
  * Sets a default value for the column
183
183
  */
184
- default: <T extends ColumnType>(def: ColumnDef<T>, value: unknown) => ColumnDef<T>;
184
+ default: <T extends ColumnType>(def: ColumnDef<T>, value: DefaultValue) => ColumnDef<T>;
185
185
  /**
186
186
  * Sets a raw SQL default value for the column
187
187
  */
@@ -445,13 +445,18 @@ declare function getColumn<T extends TableDef>(table: T, key: string): ColumnDef
445
445
  * Resolves a relation definition to its target table type.
446
446
  */
447
447
  type RelationTargetTable<TRel extends RelationDef> = TRel extends HasManyRelation<infer TTarget> ? TTarget : TRel extends HasOneRelation<infer TTarget> ? TTarget : TRel extends BelongsToRelation<infer TTarget> ? TTarget : TRel extends BelongsToManyRelation<infer TTarget, TableDef> ? TTarget : never;
448
+ type JsonValue = string | number | boolean | null | JsonArray | JsonObject;
449
+ type JsonArray = Array<JsonValue>;
450
+ interface JsonObject {
451
+ [key: string]: JsonValue;
452
+ }
448
453
  type NormalizedColumnType<T extends ColumnDef> = Lowercase<T['type'] & string>;
449
454
  /**
450
455
  * Maps a ColumnDef to its TypeScript type representation
451
456
  */
452
457
  type ColumnToTs<T extends ColumnDef> = [
453
458
  unknown
454
- ] extends [T['tsType']] ? NormalizedColumnType<T> extends 'int' | 'integer' ? number : NormalizedColumnType<T> extends 'bigint' ? number | bigint : NormalizedColumnType<T> extends 'decimal' | 'float' | 'double' ? number : NormalizedColumnType<T> extends 'boolean' ? boolean : NormalizedColumnType<T> extends 'json' ? unknown : NormalizedColumnType<T> extends 'blob' | 'binary' | 'varbinary' | 'bytea' ? Buffer : NormalizedColumnType<T> extends 'date' | 'datetime' | 'timestamp' | 'timestamptz' ? string : string : Exclude<T['tsType'], undefined>;
459
+ ] extends [T['tsType']] ? NormalizedColumnType<T> extends 'int' | 'integer' ? number : NormalizedColumnType<T> extends 'bigint' ? number | bigint : NormalizedColumnType<T> extends 'decimal' | 'float' | 'double' ? number : NormalizedColumnType<T> extends 'boolean' ? boolean : NormalizedColumnType<T> extends 'json' ? JsonValue : NormalizedColumnType<T> extends 'blob' | 'binary' | 'varbinary' | 'bytea' ? Buffer : NormalizedColumnType<T> extends 'date' | 'datetime' | 'timestamp' | 'timestamptz' ? string : string : Exclude<T['tsType'], undefined>;
455
460
  /**
456
461
  * Infers a row shape from a table definition
457
462
  */
@@ -656,14 +661,6 @@ interface LiteralNode {
656
661
  /** The literal value (string, number, boolean, Date, or null) */
657
662
  value: string | number | boolean | Date | null;
658
663
  }
659
- /**
660
- * AST node representing a named parameter placeholder
661
- */
662
- interface ParamNode {
663
- type: 'Param';
664
- /** Stable parameter name */
665
- name: string;
666
- }
667
664
  /**
668
665
  * AST node representing a reference to a SELECT alias (for ORDER BY / GROUP BY).
669
666
  */
@@ -794,7 +791,7 @@ interface ArithmeticExpressionNode {
794
791
  /**
795
792
  * Union type representing any operand that can be used in expressions
796
793
  */
797
- type OperandNode = AliasRefNode | ColumnNode | LiteralNode | ParamNode | FunctionNode | JsonPathNode | ScalarSubqueryNode | CaseExpressionNode | CastExpressionNode | WindowFunctionNode | ArithmeticExpressionNode | BitwiseExpressionNode | CollateExpressionNode;
794
+ type OperandNode = AliasRefNode | ColumnNode | LiteralNode | FunctionNode | JsonPathNode | ScalarSubqueryNode | CaseExpressionNode | CastExpressionNode | WindowFunctionNode | ArithmeticExpressionNode | BitwiseExpressionNode | CollateExpressionNode;
798
795
  declare const isOperandNode: (node: unknown) => node is OperandNode;
799
796
  declare const isFunctionNode: (node: unknown) => node is FunctionNode;
800
797
  declare const isCaseExpressionNode: (node: unknown) => node is CaseExpressionNode;
@@ -1446,8 +1443,6 @@ interface ExpressionVisitor<R> {
1446
1443
  visitBetweenExpression?(node: BetweenExpressionNode): R;
1447
1444
  visitArithmeticExpression?(node: ArithmeticExpressionNode): R;
1448
1445
  visitBitwiseExpression?(node: BitwiseExpressionNode): R;
1449
- visitOperand?(node: OperandNode): R;
1450
- visitSelectQuery?(node: SelectQueryNode): R;
1451
1446
  otherwise?(node: ExpressionNode): R;
1452
1447
  }
1453
1448
  /**
@@ -1456,17 +1451,12 @@ interface ExpressionVisitor<R> {
1456
1451
  interface OperandVisitor<R> {
1457
1452
  visitColumn?(node: ColumnNode): R;
1458
1453
  visitLiteral?(node: LiteralNode): R;
1459
- visitParam?(node: ParamNode): R;
1460
1454
  visitFunction?(node: FunctionNode): R;
1461
1455
  visitJsonPath?(node: JsonPathNode): R;
1462
1456
  visitScalarSubquery?(node: ScalarSubqueryNode): R;
1463
1457
  visitCaseExpression?(node: CaseExpressionNode): R;
1464
1458
  visitCast?(node: CastExpressionNode): R;
1465
1459
  visitWindowFunction?(node: WindowFunctionNode): R;
1466
- visitArithmeticExpression?(node: ArithmeticExpressionNode): R;
1467
- visitBitwiseExpression?(node: BitwiseExpressionNode): R;
1468
- visitExpression?(node: ExpressionNode): R;
1469
- visitSelectQuery?(node: SelectQueryNode): R;
1470
1460
  visitCollate?(node: CollateExpressionNode): R;
1471
1461
  visitAliasRef?(node: AliasRefNode): R;
1472
1462
  otherwise?(node: OperandNode): R;
@@ -1483,8 +1473,6 @@ declare const registerExpressionDispatcher: (type: string, dispatcher: Expressio
1483
1473
  * Allows new node kinds without modifying the core switch.
1484
1474
  */
1485
1475
  declare const registerOperandDispatcher: (type: string, dispatcher: OperandDispatch) => void;
1486
- declare const hasExpressionDispatcher: (type: string) => boolean;
1487
- declare const hasOperandDispatcher: (type: string) => boolean;
1488
1476
  /**
1489
1477
  * Clears all registered dispatchers. Primarily for tests.
1490
1478
  */
@@ -1503,14 +1491,6 @@ declare const visitExpression: <R>(node: ExpressionNode, visitor: ExpressionVisi
1503
1491
  */
1504
1492
  declare const visitOperand: <R>(node: OperandNode, visitor: OperandVisitor<R>) => R;
1505
1493
 
1506
- type ParamProxy = ParamNode & {
1507
- [key: string]: ParamProxy;
1508
- };
1509
- type ParamProxyRoot = {
1510
- [key: string]: ParamProxy;
1511
- };
1512
- declare const createParamProxy: () => ParamProxyRoot;
1513
-
1514
1494
  /**
1515
1495
  * Adapts a schema ColumnDef to an AST-friendly ColumnRef.
1516
1496
  */
@@ -1828,8 +1808,6 @@ interface CompilerContext {
1828
1808
  params: unknown[];
1829
1809
  /** Function to add a parameter and get its placeholder */
1830
1810
  addParameter(value: unknown): string;
1831
- /** Whether Param operands are allowed (for schema generation) */
1832
- allowParams?: boolean;
1833
1811
  }
1834
1812
  /**
1835
1813
  * Result of SQL compilation
@@ -1864,9 +1842,6 @@ declare abstract class Dialect implements SelectCompiler, InsertCompiler, Update
1864
1842
  * @returns Compiled query with SQL and parameters
1865
1843
  */
1866
1844
  compileSelect(ast: SelectQueryNode): CompiledQuery;
1867
- compileSelectWithOptions(ast: SelectQueryNode, options?: {
1868
- allowParams?: boolean;
1869
- }): CompiledQuery;
1870
1845
  compileInsert(ast: InsertQueryNode): CompiledQuery;
1871
1846
  compileUpdate(ast: UpdateQueryNode): CompiledQuery;
1872
1847
  compileDelete(ast: DeleteQueryNode): CompiledQuery;
@@ -1907,12 +1882,9 @@ declare abstract class Dialect implements SelectCompiler, InsertCompiler, Update
1907
1882
  protected compileSelectForExists(ast: SelectQueryNode, ctx: CompilerContext): string;
1908
1883
  /**
1909
1884
  * Creates a new compiler context
1910
- * @param options - Optional compiler context options
1911
1885
  * @returns Compiler context with parameter management
1912
1886
  */
1913
- protected createCompilerContext(options?: {
1914
- allowParams?: boolean;
1915
- }): CompilerContext;
1887
+ protected createCompilerContext(): CompilerContext;
1916
1888
  /**
1917
1889
  * Formats a parameter placeholder
1918
1890
  * @param index - Parameter index
@@ -2400,7 +2372,6 @@ declare class QueryAstService {
2400
2372
  * @returns Normalized ordering term
2401
2373
  */
2402
2374
  private normalizeOrderingTerm;
2403
- private toParamNode;
2404
2375
  }
2405
2376
 
2406
2377
  /**
@@ -2710,7 +2681,6 @@ type NormalizedRelationIncludeTree = Record<string, NormalizedRelationIncludeNod
2710
2681
  type QueryResult = {
2711
2682
  columns: string[];
2712
2683
  values: unknown[][];
2713
- insertId?: number;
2714
2684
  };
2715
2685
  interface DbExecutor {
2716
2686
  /** Capability flags so the runtime can make correct decisions without relying on optional methods. */
@@ -3264,7 +3234,6 @@ declare class UnitOfWork {
3264
3234
  * @param results - Query results
3265
3235
  */
3266
3236
  private applyReturningResults;
3267
- private applyInsertId;
3268
3237
  /**
3269
3238
  * Normalizes a column name by removing quotes and table prefixes.
3270
3239
  * @param column - The column name to normalize
@@ -3813,191 +3782,6 @@ interface PaginatedResult<T> {
3813
3782
  pageSize: number;
3814
3783
  }
3815
3784
 
3816
- /**
3817
- * OpenAPI 3.1 JSON Schema type representation
3818
- */
3819
- type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
3820
- /**
3821
- * Common OpenAPI 3.1 JSON Schema formats
3822
- */
3823
- type JsonSchemaFormat = 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'uri' | 'binary' | 'base64';
3824
- /**
3825
- * OpenAPI 3.1 JSON Schema property definition
3826
- */
3827
- interface JsonSchemaProperty {
3828
- type?: JsonSchemaType | JsonSchemaType[];
3829
- format?: JsonSchemaFormat;
3830
- description?: string;
3831
- nullable?: boolean;
3832
- readOnly?: boolean;
3833
- writeOnly?: boolean;
3834
- minimum?: number;
3835
- maximum?: number;
3836
- minLength?: number;
3837
- maxLength?: number;
3838
- pattern?: string;
3839
- enum?: (string | number | boolean)[];
3840
- default?: unknown;
3841
- example?: unknown;
3842
- properties?: Record<string, JsonSchemaProperty>;
3843
- required?: string[];
3844
- items?: JsonSchemaProperty;
3845
- $ref?: string;
3846
- anyOf?: JsonSchemaProperty[];
3847
- allOf?: JsonSchemaProperty[];
3848
- oneOf?: JsonSchemaProperty[];
3849
- [key: string]: unknown;
3850
- }
3851
- /**
3852
- * OpenAPI 3.1 parameter definition
3853
- */
3854
- interface OpenApiParameter {
3855
- name: string;
3856
- in: 'query' | 'path' | 'header' | 'cookie';
3857
- description?: string;
3858
- required?: boolean;
3859
- deprecated?: boolean;
3860
- allowEmptyValue?: boolean;
3861
- style?: string;
3862
- explode?: boolean;
3863
- schema?: JsonSchemaProperty;
3864
- [key: string]: unknown;
3865
- }
3866
- /**
3867
- * Complete OpenAPI 3.1 Schema for an entity or query result
3868
- */
3869
- interface OpenApiSchema {
3870
- type: 'object';
3871
- properties: Record<string, JsonSchemaProperty>;
3872
- required: string[];
3873
- description?: string;
3874
- }
3875
- /**
3876
- * OpenAPI 3.1 components container
3877
- */
3878
- interface OpenApiComponents {
3879
- schemas: Record<string, OpenApiSchema>;
3880
- }
3881
- /**
3882
- * Column-level schema flags
3883
- */
3884
- interface ColumnSchemaOptions {
3885
- /** Include description from column comments */
3886
- includeDescriptions?: boolean;
3887
- /** Include enum values for enum columns */
3888
- includeEnums?: boolean;
3889
- /** Include column examples if available */
3890
- includeExamples?: boolean;
3891
- /** Include column defaults */
3892
- includeDefaults?: boolean;
3893
- /** Include nullable flag when applicable */
3894
- includeNullable?: boolean;
3895
- }
3896
- /**
3897
- * Output schema generation options (query result)
3898
- */
3899
- interface OutputSchemaOptions extends ColumnSchemaOptions {
3900
- /** Use selected columns only (from select/include) vs full entity */
3901
- mode?: 'selected' | 'full';
3902
- /** Maximum depth for relation recursion */
3903
- maxDepth?: number;
3904
- /** Inline schemas vs $ref components */
3905
- refMode?: 'inline' | 'components';
3906
- /** Selected schemas inline vs components when refMode is components */
3907
- selectedRefMode?: 'inline' | 'components';
3908
- /** Customize component names */
3909
- componentName?: (table: TableDef) => string;
3910
- /** Emit output schema as a component $ref when refMode is components */
3911
- outputAsRef?: boolean;
3912
- }
3913
- type InputRelationMode = 'ids' | 'objects' | 'mixed';
3914
- type InputSchemaMode = 'create' | 'update';
3915
- interface RelationSelection {
3916
- pick?: string[];
3917
- omit?: string[];
3918
- }
3919
- /**
3920
- * Input schema generation options (write payloads)
3921
- */
3922
- interface InputSchemaOptions extends ColumnSchemaOptions {
3923
- /** Create vs update payload shape */
3924
- mode?: InputSchemaMode;
3925
- /** Include relation payloads */
3926
- includeRelations?: boolean;
3927
- /** How relations are represented (ids, nested objects, or both) */
3928
- relationMode?: InputRelationMode;
3929
- /** Maximum depth for relation recursion */
3930
- maxDepth?: number;
3931
- /** Omit read-only/generated columns from input */
3932
- omitReadOnly?: boolean;
3933
- /** Exclude primary key columns from input */
3934
- excludePrimaryKey?: boolean;
3935
- /** Require primary key columns on update payloads */
3936
- requirePrimaryKey?: boolean;
3937
- /** Remove relation foreign keys pointing to the parent from nested inputs */
3938
- excludeRelationForeignKeys?: boolean;
3939
- /** Per-relation field selection for nested inputs */
3940
- relationSelections?: Record<string, RelationSelection>;
3941
- }
3942
- /**
3943
- * Schema generation options
3944
- */
3945
- interface SchemaOptions extends OutputSchemaOptions {
3946
- /** Input schema options, or false to skip input generation */
3947
- input?: InputSchemaOptions | false;
3948
- }
3949
- /**
3950
- * Input + output schema bundle
3951
- */
3952
- interface OpenApiSchemaBundle {
3953
- output: OpenApiSchema | JsonSchemaProperty;
3954
- input?: OpenApiSchema;
3955
- parameters?: OpenApiParameter[];
3956
- components?: OpenApiComponents;
3957
- }
3958
- /**
3959
- * Schema extraction context for handling circular references
3960
- */
3961
- interface SchemaExtractionContext {
3962
- /** Set of already visited tables to detect cycles */
3963
- visitedTables: Set<string>;
3964
- /** Map of table names to their generated schemas */
3965
- schemaCache: Map<string, OpenApiSchema>;
3966
- /** Current extraction depth */
3967
- depth: number;
3968
- /** Maximum depth to recurse */
3969
- maxDepth: number;
3970
- /** Component registry when using refMode=components */
3971
- components?: OpenApiComponents;
3972
- }
3973
-
3974
- /**
3975
- * Maps SQL column types to OpenAPI JSON Schema types
3976
- */
3977
- declare const mapColumnType: (column: ColumnDef, options?: ColumnSchemaOptions) => JsonSchemaProperty;
3978
- /**
3979
- * Maps relation type to array or single object
3980
- */
3981
- declare const mapRelationType: (relationType: string) => {
3982
- type: "object" | "array";
3983
- isNullable: boolean;
3984
- };
3985
- /**
3986
- * Gets the OpenAPI format for temporal columns
3987
- */
3988
- declare const getTemporalFormat: (sqlType: string) => JsonSchemaFormat | undefined;
3989
-
3990
- /**
3991
- * Extracts OpenAPI 3.1 schemas for output and optional input payloads.
3992
- */
3993
- declare const extractSchema: (table: TableDef, plan: HydrationPlan | undefined, projectionNodes: ProjectionNode[] | undefined, options?: SchemaOptions) => OpenApiSchemaBundle;
3994
- /**
3995
- * Converts a schema to a JSON string with optional pretty printing
3996
- */
3997
- declare const schemaToJson: (schema: OpenApiSchema, pretty?: boolean) => string;
3998
-
3999
- declare const buildFilterParameters: (table: TableDef, where: ExpressionNode | undefined, from: TableSourceNode | undefined, options?: ColumnSchemaOptions) => OpenApiParameter[];
4000
-
4001
3785
  type SelectDialectInput = Dialect | DialectKey;
4002
3786
 
4003
3787
  type ColumnSelectionValue = ColumnDef | FunctionNode | CaseExpressionNode | WindowFunctionNode | TypedExpression<unknown>;
@@ -4005,9 +3789,6 @@ type SelectionValueType<TValue> = TValue extends TypedExpression<infer TRuntime>
4005
3789
  type SelectionResult<TSelection extends Record<string, ColumnSelectionValue>> = {
4006
3790
  [K in keyof TSelection]: SelectionValueType<TSelection[K]>;
4007
3791
  };
4008
- type ParamOperandCompileOptions = {
4009
- allowParamOperands?: boolean;
4010
- };
4011
3792
  type SelectionFromKeys<TTable extends TableDef, K extends keyof TTable['columns'] & string> = Pick<InferRow<TTable>, K>;
4012
3793
  type DeepSelectEntry<TTable extends TableDef> = {
4013
3794
  type: 'root';
@@ -4357,11 +4138,6 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
4357
4138
  * Ensures that if no columns are selected, all columns from the table are selected by default.
4358
4139
  */
4359
4140
  private ensureDefaultSelection;
4360
- /**
4361
- * Validates that the query does not contain Param operands.
4362
- * Param proxies are only for schema generation, not execution.
4363
- */
4364
- private validateNoParamOperands;
4365
4141
  /**
4366
4142
  * Executes the query and returns hydrated results.
4367
4143
  * If the builder was created with an entity constructor (e.g. via selectFromEntity),
@@ -4601,7 +4377,7 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
4601
4377
  * .compile('postgres');
4602
4378
  * console.log(compiled.sql); // SELECT "id", "name" FROM "users" WHERE "active" = true
4603
4379
  */
4604
- compile(dialect: SelectDialectInput, options?: ParamOperandCompileOptions): CompiledQuery;
4380
+ compile(dialect: SelectDialectInput): CompiledQuery;
4605
4381
  /**
4606
4382
  * Converts the query to SQL string for a specific dialect
4607
4383
  * @param dialect - Database dialect to generate SQL for
@@ -4612,24 +4388,15 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
4612
4388
  * .toSql('postgres');
4613
4389
  * console.log(sql); // SELECT "id", "name" FROM "users" WHERE "active" = true
4614
4390
  */
4615
- toSql(dialect: SelectDialectInput, options?: ParamOperandCompileOptions): string;
4391
+ toSql(dialect: SelectDialectInput): string;
4616
4392
  /**
4617
- * Gets hydration plan for query
4393
+ * Gets the hydration plan for the query
4618
4394
  * @returns Hydration plan or undefined if none exists
4619
4395
  * @example
4620
4396
  * const plan = qb.include('posts').getHydrationPlan();
4621
4397
  * console.log(plan?.relations); // Information about included relations
4622
4398
  */
4623
4399
  getHydrationPlan(): HydrationPlan | undefined;
4624
- /**
4625
- * Gets OpenAPI 3.1 JSON Schemas for query output and optional input payloads
4626
- * @param options - Schema generation options
4627
- * @returns OpenAPI 3.1 JSON Schemas for query output and input payloads
4628
- * @example
4629
- * const { output } = qb.select('id', 'title', 'author').getSchema();
4630
- * console.log(JSON.stringify(output, null, 2));
4631
- */
4632
- getSchema(options?: SchemaOptions): OpenApiSchemaBundle;
4633
4400
  /**
4634
4401
  * Gets the Abstract Syntax Tree (AST) representation of the query
4635
4402
  * @returns Query AST with hydration applied
@@ -6393,7 +6160,6 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
6393
6160
  visitArithmeticExpression(arithExpr: ArithmeticExpressionNode): string;
6394
6161
  visitColumn(node: ColumnNode): string;
6395
6162
  visitLiteral(node: LiteralNode): string;
6396
- visitParam(node: ParamNode): string;
6397
6163
  visitFunction(node: FunctionNode): string;
6398
6164
  visitJsonPath(node: JsonPathNode): string;
6399
6165
  visitScalarSubquery(node: ScalarSubqueryNode): string;
@@ -6451,7 +6217,6 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
6451
6217
  * @returns TypeScript code representation
6452
6218
  */
6453
6219
  private printLiteralOperand;
6454
- private printParamOperand;
6455
6220
  /**
6456
6221
  * Prints a function operand to TypeScript code
6457
6222
  * @param fn - Function node
@@ -7256,4 +7021,772 @@ type PooledExecutorFactoryOptions<TConn> = {
7256
7021
  */
7257
7022
  declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
7258
7023
 
7259
- export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnSchemaOptions, type ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, 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 InputRelationMode, type InputSchemaMode, type InputSchemaOptions, InsertQueryBuilder, InterceptorPipeline, type IntrospectOptions, type JsonPathNode, type JsonSchemaFormat, type JsonSchemaProperty, type JsonSchemaType, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OpenApiComponents, type OpenApiParameter, type OpenApiSchema, type OpenApiSchemaBundle, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type OutputSchemaOptions, type PaginatedResult, type ParamNode, type ParamProxy, type ParamProxyRoot, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationSelection, 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 SchemaExtractionContext, type SchemaGenerateResult, type SchemaIntrospector, type SchemaOptions, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterParameters, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createParamProxy, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, entityRefs, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractSchema, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, getTemporalFormat, greatest, groupConcat, gt, gte, hasExpressionDispatcher, hasMany, hasOne, hasOperandDispatcher, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapColumnType, mapRelationType, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
7024
+ /**
7025
+ * DTO (Data Transfer Object) type utilities for metal-orm.
7026
+ * Derives API types from TableDef/Entity metadata.
7027
+ */
7028
+
7029
+ /**
7030
+ * Checks if a type is a TableDef.
7031
+ */
7032
+ type IsTableDef$1<T> = T extends {
7033
+ name: string;
7034
+ columns: any;
7035
+ } ? true : false;
7036
+ /**
7037
+ * Extracts the row type from either a TableDef or EntityConstructor.
7038
+ */
7039
+ type ExtractRow<T> = IsTableDef$1<T> extends true ? InferRow<T extends TableDef<infer C> ? TableDef<C> : never> : T extends EntityConstructor<infer E> ? E : never;
7040
+ /**
7041
+ * Utility to flatten intersection types for better IDE display.
7042
+ */
7043
+ type Simplify<T> = {
7044
+ [K in keyof T]: T[K];
7045
+ } & {};
7046
+ /**
7047
+ * Response DTO - excludes specified columns from the entity.
7048
+ * Use this to hide sensitive fields like passwordHash, apiKey, etc.
7049
+ *
7050
+ * @example
7051
+ * ```ts
7052
+ * // With TableDef
7053
+ * type UserResponse = Dto<typeof usersTable, 'passwordHash'>;
7054
+ *
7055
+ * // With Entity class
7056
+ * type UserResponse = Dto<User, 'passwordHash'>;
7057
+ *
7058
+ * // Exclude multiple fields
7059
+ * type UserPublic = Dto<User, 'passwordHash' | 'email'>;
7060
+ *
7061
+ * // Include all fields (no exclusions)
7062
+ * type UserFull = Dto<User>;
7063
+ * ```
7064
+ */
7065
+ type Dto<T extends TableDef | EntityConstructor, TExclude extends keyof ExtractRow<T> = never> = Simplify<Omit<ExtractRow<T>, TExclude>>;
7066
+ /**
7067
+ * Compose a DTO with relations.
7068
+ *
7069
+ * @example
7070
+ * ```ts
7071
+ * type UserWithPosts = WithRelations<UserResponse, {
7072
+ * posts: PostResponse[]
7073
+ * }>;
7074
+ *
7075
+ * type PostWithAuthor = WithRelations<PostResponse, {
7076
+ * author: Dto<User, 'passwordHash' | 'email'>
7077
+ * }>;
7078
+ * ```
7079
+ */
7080
+ type WithRelations<TBase, TRelations> = Simplify<TBase & TRelations>;
7081
+ type ColumnMap<T extends TableDef> = T['columns'];
7082
+ /**
7083
+ * Checks if a column has a default value.
7084
+ */
7085
+ type HasDefault<TCol extends ColumnDef> = TCol['default'] extends undefined ? false : true;
7086
+ /**
7087
+ * Checks if a column is auto-generated (autoIncrement or generated always/byDefault).
7088
+ */
7089
+ type IsAutoGenerated<TCol extends ColumnDef> = TCol['autoIncrement'] extends true ? true : TCol['generated'] extends 'always' | 'byDefault' ? true : false;
7090
+ /**
7091
+ * Checks if a column is insertable (not auto-generated).
7092
+ */
7093
+ type IsInsertable<TCol extends ColumnDef> = IsAutoGenerated<TCol> extends true ? false : true;
7094
+ /**
7095
+ * Checks if a column is required for insert (notNull, no default, not auto-generated).
7096
+ */
7097
+ type IsRequiredInsert<TCol extends ColumnDef> = TCol['notNull'] extends true ? IsAutoGenerated<TCol> extends true ? false : HasDefault<TCol> extends true ? false : true : false;
7098
+ /**
7099
+ * Keys that are required for insert (notNull, no default, not auto-generated).
7100
+ */
7101
+ type RequiredInsertKeys<T extends TableDef> = {
7102
+ [K in keyof ColumnMap<T>]: ColumnMap<T>[K] extends ColumnDef ? IsInsertable<ColumnMap<T>[K]> extends true ? IsRequiredInsert<ColumnMap<T>[K]> extends true ? K : never : never : never;
7103
+ }[keyof ColumnMap<T>];
7104
+ /**
7105
+ * Keys that are optional for insert (nullable, has default, or optional).
7106
+ */
7107
+ type OptionalInsertKeys<T extends TableDef> = {
7108
+ [K in keyof ColumnMap<T>]: ColumnMap<T>[K] extends ColumnDef ? IsInsertable<ColumnMap<T>[K]> extends true ? IsRequiredInsert<ColumnMap<T>[K]> extends false ? K : never : never : never;
7109
+ }[keyof ColumnMap<T>];
7110
+ /**
7111
+ * Create DTO - includes only insertable columns with proper optionality.
7112
+ * Auto-generated columns (autoIncrement, generated) are excluded.
7113
+ * Columns with defaults or nullable are optional.
7114
+ *
7115
+ * Works with both TableDef and EntityConstructor:
7116
+ * - For TableDef: Uses column metadata to determine required/optional fields
7117
+ * - For EntityConstructor: All fields are optional (simpler type inference)
7118
+ *
7119
+ * @example
7120
+ * ```ts
7121
+ * // With TableDef - auto-excludes id (autoIncrement), createdAt (has default)
7122
+ * type CreateUserDto = CreateDto<typeof usersTable>;
7123
+ * // → { name: string; email: string; bio?: string }
7124
+ *
7125
+ * // With Entity class - simpler inference, all fields optional
7126
+ * type CreateUserDto = CreateDto<User>;
7127
+ *
7128
+ * // Exclude additional fields (e.g., authorId comes from context)
7129
+ * type CreatePostDto = CreateDto<typeof Post, 'authorId'>;
7130
+ * ```
7131
+ */
7132
+ type CreateDto<T extends TableDef | EntityConstructor, TExclude extends keyof ExtractRow<T> = never> = T extends TableDef<any> ? Simplify<{
7133
+ [K in Exclude<RequiredInsertKeys<T>, TExclude>]: ColumnToTs<ColumnMap<T>[K]>;
7134
+ } & {
7135
+ [K in Exclude<OptionalInsertKeys<T>, TExclude>]?: ColumnToTs<ColumnMap<T>[K]>;
7136
+ }> : Simplify<{
7137
+ [K in Exclude<keyof ExtractRow<T>, TExclude>]?: ExtractRow<T>[K];
7138
+ }>;
7139
+ /**
7140
+ * Update DTO - all columns are optional (partial update).
7141
+ * Excludes specified columns (e.g., id, createdAt).
7142
+ *
7143
+ * @example
7144
+ * ```ts
7145
+ * // With TableDef
7146
+ * type UpdateUserDto = UpdateDto<typeof User>;
7147
+ * // → { name?: string; email?: string; bio?: string; ... }
7148
+ *
7149
+ * // With Entity class
7150
+ * type UpdateUserDto = UpdateDto<User>;
7151
+ *
7152
+ * // Exclude fields that shouldn't be updated
7153
+ * type UpdateUserDto = UpdateDto<typeof User, 'id' | 'createdAt'>;
7154
+ * ```
7155
+ */
7156
+ type UpdateDto<T extends TableDef | EntityConstructor, TExclude extends keyof ExtractRow<T> = never> = T extends TableDef<any> ? Simplify<{
7157
+ [K in Exclude<keyof ColumnMap<T>, TExclude>]?: ColumnToTs<ColumnMap<T>[K]>;
7158
+ }> : Simplify<{
7159
+ [K in Exclude<keyof ExtractRow<T>, TExclude>]?: ExtractRow<T>[K];
7160
+ }>;
7161
+ /**
7162
+ * Enhanced paginated response with computed navigation metadata.
7163
+ * Extends the basic PaginatedResult with additional convenience fields.
7164
+ *
7165
+ * @example
7166
+ * ```ts
7167
+ * type UsersPagedResponse = PagedResponse<UserResponse>;
7168
+ *
7169
+ * // Response:
7170
+ * // {
7171
+ * // items: UserResponse[];
7172
+ * // totalItems: number;
7173
+ * // page: number;
7174
+ * // pageSize: number;
7175
+ * // totalPages: number;
7176
+ * // hasNextPage: boolean;
7177
+ * // hasPrevPage: boolean;
7178
+ * // }
7179
+ * ```
7180
+ */
7181
+ type PagedResponse<T> = {
7182
+ items: T[];
7183
+ totalItems: number;
7184
+ page: number;
7185
+ pageSize: number;
7186
+ totalPages: number;
7187
+ hasNextPage: boolean;
7188
+ hasPrevPage: boolean;
7189
+ };
7190
+
7191
+ /**
7192
+ * Filter types for building type-safe query filters from JSON input.
7193
+ * Designed for REST API query parameters.
7194
+ */
7195
+
7196
+ /**
7197
+ * Checks if a type is a TableDef.
7198
+ */
7199
+ type IsTableDef<T> = T extends {
7200
+ name: string;
7201
+ columns: any;
7202
+ } ? true : false;
7203
+ /**
7204
+ * Maps TypeScript types to SQL column types for EntityConstructor columns.
7205
+ */
7206
+ type TsTypeToColumnType<T> = T extends string ? 'VARCHAR' : T extends number ? 'INT' : T extends boolean ? 'BOOLEAN' : T extends Date ? 'TIMESTAMP' : 'VARCHAR';
7207
+ /**
7208
+ * Extracts the column map from either a TableDef or EntityConstructor.
7209
+ * For EntityConstructor, infers column type from TypeScript property type.
7210
+ */
7211
+ type ExtractColumns<T> = IsTableDef<T> extends true ? T extends TableDef<infer C> ? C : never : T extends EntityConstructor<infer E> ? {
7212
+ [K in keyof E]: ColumnDef<TsTypeToColumnType<E[K]>, E[K]>;
7213
+ } : never;
7214
+ /**
7215
+ * Filter operators for string columns.
7216
+ */
7217
+ interface StringFilter {
7218
+ equals?: string;
7219
+ not?: string;
7220
+ in?: string[];
7221
+ notIn?: string[];
7222
+ contains?: string;
7223
+ startsWith?: string;
7224
+ endsWith?: string;
7225
+ /** Case-insensitive matching (for contains, startsWith, endsWith) */
7226
+ mode?: 'default' | 'insensitive';
7227
+ }
7228
+ /**
7229
+ * Filter operators for numeric columns (number, bigint).
7230
+ */
7231
+ interface NumberFilter {
7232
+ equals?: number;
7233
+ not?: number;
7234
+ in?: number[];
7235
+ notIn?: number[];
7236
+ lt?: number;
7237
+ lte?: number;
7238
+ gt?: number;
7239
+ gte?: number;
7240
+ }
7241
+ /**
7242
+ * Filter operators for boolean columns.
7243
+ */
7244
+ interface BooleanFilter {
7245
+ equals?: boolean;
7246
+ not?: boolean;
7247
+ }
7248
+ /**
7249
+ * Filter operators for date/datetime columns.
7250
+ * Accepts ISO date strings.
7251
+ */
7252
+ interface DateFilter {
7253
+ equals?: string;
7254
+ not?: string;
7255
+ in?: string[];
7256
+ notIn?: string[];
7257
+ lt?: string;
7258
+ lte?: string;
7259
+ gt?: string;
7260
+ gte?: string;
7261
+ }
7262
+ type NormalizedType<T extends ColumnDef> = Lowercase<T['type'] & string>;
7263
+ /**
7264
+ * Maps a column definition to its appropriate filter type.
7265
+ */
7266
+ type FieldFilter<TCol extends ColumnDef> = NormalizedType<TCol> extends 'int' | 'integer' | 'bigint' | 'decimal' | 'float' | 'double' ? NumberFilter : NormalizedType<TCol> extends 'boolean' ? BooleanFilter : NormalizedType<TCol> extends 'date' | 'datetime' | 'timestamp' | 'timestamptz' ? DateFilter : StringFilter;
7267
+ /**
7268
+ * Full where input with all columns filterable.
7269
+ * All conditions are implicitly AND-ed.
7270
+ * Works with both TableDef and EntityConstructor.
7271
+ *
7272
+ * @example
7273
+ * ```ts
7274
+ * // With TableDef
7275
+ * type UserFilter = WhereInput<typeof usersTable>;
7276
+ *
7277
+ * // With Entity class
7278
+ * type UserFilter = WhereInput<User>;
7279
+ * ```
7280
+ */
7281
+ type WhereInput<T extends TableDef | EntityConstructor> = {
7282
+ [K in keyof ExtractColumns<T>]?: ExtractColumns<T>[K] extends ColumnDef<any, any> ? FieldFilter<ExtractColumns<T>[K]> : FieldFilter<ColumnDef<any, any>>;
7283
+ };
7284
+ /**
7285
+ * Restricted where input - only specified columns are filterable.
7286
+ * Use this to limit which fields can be filtered via API.
7287
+ *
7288
+ * Works with both TableDef and EntityConstructor.
7289
+ *
7290
+ * @example
7291
+ * ```ts
7292
+ * // With TableDef - only allow filtering by name and email
7293
+ * type UserFilter = SimpleWhereInput<typeof usersTable, 'name' | 'email'>;
7294
+ *
7295
+ * // With Entity class
7296
+ * type UserFilter = SimpleWhereInput<User, 'name' | 'email'>;
7297
+ *
7298
+ * // Request: { "name": { "contains": "john" }, "email": { "endsWith": "@gmail.com" } }
7299
+ * ```
7300
+ */
7301
+ type SimpleWhereInput<T extends TableDef | EntityConstructor, K extends keyof ExtractColumns<T>> = {
7302
+ [P in K]?: ExtractColumns<T>[P] extends ColumnDef<any, any> ? FieldFilter<ExtractColumns<T>[P]> : FieldFilter<ColumnDef<any, any>>;
7303
+ };
7304
+ /**
7305
+ * All possible filter operators.
7306
+ */
7307
+ type FilterOperator = 'equals' | 'not' | 'in' | 'notIn' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith';
7308
+ /**
7309
+ * Generic filter value that covers all operator types.
7310
+ */
7311
+ type FilterValue = StringFilter | NumberFilter | BooleanFilter | DateFilter;
7312
+
7313
+ /**
7314
+ * Runtime filter application - converts JSON filter objects to query builder conditions.
7315
+ */
7316
+
7317
+ /**
7318
+ * Applies a filter object to a SelectQueryBuilder.
7319
+ * All conditions are AND-ed together.
7320
+ *
7321
+ * @param qb - The query builder to apply filters to
7322
+ * @param tableOrEntity - The table definition or entity constructor (used to resolve column references)
7323
+ * @param where - The filter object from: API request
7324
+ * @returns The query builder with filters applied
7325
+ *
7326
+ * @example
7327
+ * ```ts
7328
+ * // In a controller - using Entity class
7329
+ * @Get()
7330
+ * async list(@Query() where?: UserFilter): Promise<UserResponse[]> {
7331
+ * let query = selectFromEntity(User);
7332
+ * query = applyFilter(query, User, where);
7333
+ * return query.execute(db);
7334
+ * }
7335
+ *
7336
+ * // Using TableDef directly
7337
+ * @Get()
7338
+ * async list(@Query() where?: UserFilter): Promise<UserResponse[]> {
7339
+ * let query = selectFrom(usersTable);
7340
+ * query = applyFilter(query, usersTable, where);
7341
+ * return query.execute(db);
7342
+ * }
7343
+ *
7344
+ * // Request: { "name": { "contains": "john" }, "email": { "endsWith": "@gmail.com" } }
7345
+ * // SQL: WHERE name LIKE '%john%' AND email LIKE '%@gmail.com'
7346
+ * ```
7347
+ */
7348
+ declare function applyFilter<T, TTable extends TableDef>(qb: SelectQueryBuilder<T, TTable>, tableOrEntity: TTable | EntityConstructor, where?: WhereInput<TTable | EntityConstructor> | null): SelectQueryBuilder<T, TTable>;
7349
+ /**
7350
+ * Builds an expression tree from a filter object without applying it.
7351
+ * Useful for combining with other conditions.
7352
+ *
7353
+ * @param tableOrEntity - The table definition or entity constructor
7354
+ * @param where - The filter object
7355
+ * @returns An expression node or null if no filters
7356
+ *
7357
+ * @example
7358
+ * ```ts
7359
+ * // Using Entity class
7360
+ * const filterExpr = buildFilterExpression(User, { name: { contains: "john" } });
7361
+ *
7362
+ * // Using TableDef directly
7363
+ * const filterExpr = buildFilterExpression(usersTable, { name: { contains: "john" } });
7364
+ *
7365
+ * if (filterExpr) {
7366
+ * qb = qb.where(and(filterExpr, eq(users.columns.active, true)));
7367
+ * }
7368
+ * ```
7369
+ */
7370
+ declare function buildFilterExpression(tableOrEntity: TableDef | EntityConstructor, where?: WhereInput<TableDef | EntityConstructor> | null): ExpressionNode | null;
7371
+
7372
+ /**
7373
+ * DTO transformation utilities for working with DTO instances.
7374
+ *
7375
+ * These helpers make it easier to convert between DTO types, apply defaults,
7376
+ * and handle auto-generated fields without manual object construction.
7377
+ */
7378
+ /**
7379
+ * Transforms a CreateDto or UpdateDto into a ResponseDto by merging with auto-generated fields.
7380
+ *
7381
+ * @example
7382
+ * ```ts
7383
+ * const newUser: UserResponse = toResponse(body, {
7384
+ * id: newId,
7385
+ * createdAt: new Date().toISOString()
7386
+ * });
7387
+ *
7388
+ * // Or use the curried form for reuse
7389
+ * const createUserResponse = toResponseBuilder<UserCreateDto, UserResponse>({
7390
+ * id: () => nextId++,
7391
+ * createdAt: () => new Date().toISOString()
7392
+ * });
7393
+ * const user = createUserResponse(body);
7394
+ * ```
7395
+ */
7396
+ declare function toResponse<TInput, TOutput>(input: TInput, autoFields: Partial<TOutput>): TOutput;
7397
+ /**
7398
+ * Creates a toResponse function with pre-configured auto-fields.
7399
+ * Useful for reusing same transformation logic across multiple endpoints.
7400
+ *
7401
+ * @example
7402
+ * ```ts
7403
+ * const userResponseBuilder = toResponseBuilder<CreateUserDto, UserResponse>({
7404
+ * id: () => generateId(),
7405
+ * createdAt: () => new Date().toISOString(),
7406
+ * active: true
7407
+ * });
7408
+ *
7409
+ * app.post('/users', (req, res) => {
7410
+ * const user = userResponseBuilder(req.body);
7411
+ * res.status(201).json(user);
7412
+ * });
7413
+ * ```
7414
+ */
7415
+ declare function toResponseBuilder<TInput, TOutput>(autoFields: Partial<TOutput> | (() => Partial<TOutput>)): (input: TInput) => TOutput;
7416
+ /**
7417
+ * Merges default values into a DTO. Returns a complete object with all defaults applied.
7418
+ *
7419
+ * @example
7420
+ * ```ts
7421
+ * const user = withDefaults(body, {
7422
+ * active: true,
7423
+ * createdAt: new Date().toISOString()
7424
+ * });
7425
+ * ```
7426
+ */
7427
+ declare function withDefaults<T>(dto: Partial<T>, defaults: T): T;
7428
+ /**
7429
+ * Creates a withDefaults function with pre-configured defaults.
7430
+ *
7431
+ * @example
7432
+ * ```ts
7433
+ * const userWithDefaults = withDefaultsBuilder<CreateUserDto>({
7434
+ * active: true
7435
+ * });
7436
+ *
7437
+ * app.post('/users', (req, res) => {
7438
+ * const userInput = userWithDefaults(req.body);
7439
+ * // ...
7440
+ * });
7441
+ * ```
7442
+ */
7443
+ declare function withDefaultsBuilder<T>(defaults: T | (() => T)): (dto: Partial<T>) => T;
7444
+ /**
7445
+ * Excludes specified fields from an object. Useful for removing sensitive fields
7446
+ * from database results before sending to the client.
7447
+ *
7448
+ * @example
7449
+ * ```ts
7450
+ * const userFromDb = await db.select().from(users).where(...).first();
7451
+ * const userResponse = exclude(userFromDb, 'passwordHash', 'apiKey');
7452
+ * ```
7453
+ */
7454
+ declare function exclude<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
7455
+ /**
7456
+ * Picks only specified fields from an object. Useful for creating DTOs from
7457
+ * larger database entities.
7458
+ *
7459
+ * @example
7460
+ * ```ts
7461
+ * const userFromDb = await db.select().from(users).where(...).first();
7462
+ * const userResponse = pick(userFromDb, 'id', 'name', 'email');
7463
+ * ```
7464
+ */
7465
+ declare function pick<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
7466
+ /**
7467
+ * Maps field names from one DTO to another. Useful when your DTO has different
7468
+ * field names than your entity (e.g., camelCase vs snake_case).
7469
+ *
7470
+ * @example
7471
+ * ```ts
7472
+ * type ApiUser = { firstName: string; lastName: string };
7473
+ * type DbUser = { first_name: string; last_name: string };
7474
+ *
7475
+ * const dbUser = mapFields(apiUser, {
7476
+ * firstName: 'first_name',
7477
+ * lastName: 'last_name'
7478
+ * });
7479
+ * ```
7480
+ */
7481
+ type MappedFields<T, M extends Partial<Record<keyof T, string>>> = {
7482
+ [K in keyof M as M[K] extends string ? M[K] : never]: K extends keyof T ? T[K] : never;
7483
+ };
7484
+ declare function mapFields<T extends object, M extends Partial<Record<keyof T, string>>>(obj: T, fieldMap: M): Omit<T, keyof M> & MappedFields<T, M>;
7485
+
7486
+ /**
7487
+ * Pagination utility functions for DTO responses.
7488
+ * Converts basic PaginatedResult to enhanced PagedResponse with computed metadata.
7489
+ */
7490
+
7491
+ /**
7492
+ * Converts PaginatedResult to PagedResponse with computed metadata.
7493
+ *
7494
+ * @param result - The basic paginated result from executePaged()
7495
+ * @returns Enhanced paginated response with totalPages, hasNextPage, hasPrevPage
7496
+ *
7497
+ * @example
7498
+ * ```ts
7499
+ * // In your controller
7500
+ * const basic = await qb.executePaged(session, { page: 2, pageSize: 20 });
7501
+ * const response = toPagedResponse(basic);
7502
+ * return res.json(response);
7503
+ * // → { items: [...], totalItems: 150, page: 2, pageSize: 20,
7504
+ * // totalPages: 8, hasNextPage: true, hasPrevPage: true }
7505
+ * ```
7506
+ */
7507
+ declare function toPagedResponse<T>(result: PaginatedResult<T>): PagedResponse<T>;
7508
+ /**
7509
+ * Creates a reusable toPagedResponse function with fixed pageSize.
7510
+ * Useful when your API uses a consistent page size across all endpoints.
7511
+ *
7512
+ * @param fixedPageSize - The fixed page size to use
7513
+ * @returns A function that converts PaginatedResult to PagedResponse
7514
+ *
7515
+ * @example
7516
+ * ```ts
7517
+ * const toUserPagedResponse = toPagedResponseBuilder<UserResponse>(20);
7518
+ *
7519
+ * app.get('/users', async (req, res) => {
7520
+ * const basic = await qb.executePaged(session, { page: req.query.page || 1, pageSize: 20 });
7521
+ * const response = toUserPagedResponse(basic);
7522
+ * res.json(response);
7523
+ * });
7524
+ * ```
7525
+ */
7526
+ declare function toPagedResponseBuilder<T>(fixedPageSize: number): (result: Omit<PaginatedResult<T>, 'pageSize'> & {
7527
+ pageSize?: number;
7528
+ }) => PagedResponse<T>;
7529
+ /**
7530
+ * Calculates total pages from total items and page size.
7531
+ *
7532
+ * @param totalItems - Total number of items
7533
+ * @param pageSize - Number of items per page
7534
+ * @returns Total number of pages (minimum 1)
7535
+ *
7536
+ * @example
7537
+ * ```ts
7538
+ * const totalPages = calculateTotalPages(150, 20); // → 8
7539
+ * const totalPages = calculateTotalPages(150, 50); // → 3
7540
+ * ```
7541
+ */
7542
+ declare function calculateTotalPages(totalItems: number, pageSize: number): number;
7543
+ /**
7544
+ * Checks if there is a next page.
7545
+ *
7546
+ * @param currentPage - Current page number (1-based)
7547
+ * @param totalPages - Total number of pages
7548
+ * @returns true if there is a next page
7549
+ *
7550
+ * @example
7551
+ * ```ts
7552
+ * const hasNext = hasNextPage(2, 8); // → true
7553
+ * const hasNext = hasNextPage(8, 8); // → false
7554
+ * ```
7555
+ */
7556
+ declare function hasNextPage(currentPage: number, totalPages: number): boolean;
7557
+ /**
7558
+ * Checks if there is a previous page.
7559
+ *
7560
+ * @param currentPage - Current page number (1-based)
7561
+ * @returns true if there is a previous page
7562
+ *
7563
+ * @example
7564
+ * ```ts
7565
+ * const hasPrev = hasPrevPage(2); // → true
7566
+ * const hasPrev = hasPrevPage(1); // → false
7567
+ * ```
7568
+ */
7569
+ declare function hasPrevPage(currentPage: number): boolean;
7570
+ /**
7571
+ * Computes all pagination metadata from basic pagination info.
7572
+ *
7573
+ * @param totalItems - Total number of items
7574
+ * @param page - Current page number (1-based)
7575
+ * @param pageSize - Number of items per page
7576
+ * @returns Object with totalPages, hasNextPage, hasPrevPage
7577
+ *
7578
+ * @example
7579
+ * ```ts
7580
+ * const meta = computePaginationMetadata(150, 2, 20);
7581
+ * // → { totalPages: 8, hasNextPage: true, hasPrevPage: true }
7582
+ * ```
7583
+ */
7584
+ declare function computePaginationMetadata(totalItems: number, page: number, pageSize: number): Pick<PagedResponse<unknown>, 'totalPages' | 'hasNextPage' | 'hasPrevPage'>;
7585
+
7586
+ type OpenApiType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
7587
+ interface OpenApiSchema {
7588
+ type?: OpenApiType | OpenApiType[];
7589
+ properties?: Record<string, OpenApiSchema>;
7590
+ items?: OpenApiSchema;
7591
+ required?: string[];
7592
+ enum?: unknown[];
7593
+ format?: string;
7594
+ description?: string;
7595
+ example?: unknown;
7596
+ nullable?: boolean;
7597
+ minimum?: number;
7598
+ maximum?: number;
7599
+ default?: unknown;
7600
+ $ref?: string;
7601
+ allOf?: OpenApiSchema[];
7602
+ oneOf?: OpenApiSchema[];
7603
+ }
7604
+ interface OpenApiParameter {
7605
+ name: string;
7606
+ in: 'query' | 'path' | 'header' | 'cookie';
7607
+ required?: boolean;
7608
+ schema?: OpenApiSchema;
7609
+ description?: string;
7610
+ }
7611
+ interface OpenApiOperation {
7612
+ summary?: string;
7613
+ description?: string;
7614
+ parameters?: OpenApiParameter[];
7615
+ requestBody?: {
7616
+ description?: string;
7617
+ required?: boolean;
7618
+ content: {
7619
+ 'application/json': {
7620
+ schema: OpenApiSchema;
7621
+ };
7622
+ };
7623
+ };
7624
+ responses?: Record<string, {
7625
+ description: string;
7626
+ content?: {
7627
+ 'application/json': {
7628
+ schema: OpenApiSchema;
7629
+ };
7630
+ };
7631
+ }>;
7632
+ }
7633
+ interface OpenApiDocumentInfo {
7634
+ title: string;
7635
+ version: string;
7636
+ description?: string;
7637
+ }
7638
+ interface ApiRouteDefinition {
7639
+ path: string;
7640
+ method: 'get' | 'post' | 'put' | 'patch' | 'delete';
7641
+ operation: OpenApiOperation;
7642
+ }
7643
+ interface OpenApiComponent {
7644
+ schemas?: Record<string, OpenApiSchema>;
7645
+ parameters?: Record<string, OpenApiSchema>;
7646
+ responses?: Record<string, OpenApiSchema>;
7647
+ securitySchemes?: Record<string, unknown>;
7648
+ }
7649
+ interface OpenApiDocument {
7650
+ openapi: string;
7651
+ info: OpenApiDocumentInfo;
7652
+ paths: Record<string, Record<string, OpenApiOperation>>;
7653
+ components?: OpenApiComponent;
7654
+ }
7655
+
7656
+ interface TypeMappingStrategy {
7657
+ supports(columnType: string): boolean;
7658
+ getOpenApiType(): OpenApiType;
7659
+ getFormat(columnType: string): string | undefined;
7660
+ }
7661
+ declare class IntegerTypeStrategy implements TypeMappingStrategy {
7662
+ private readonly types;
7663
+ supports(type: string): boolean;
7664
+ getOpenApiType(): OpenApiType;
7665
+ getFormat(): string | undefined;
7666
+ }
7667
+ declare class BigIntTypeStrategy implements TypeMappingStrategy {
7668
+ private readonly types;
7669
+ supports(type: string): boolean;
7670
+ getOpenApiType(): OpenApiType;
7671
+ getFormat(): string | undefined;
7672
+ }
7673
+ declare class DecimalTypeStrategy implements TypeMappingStrategy {
7674
+ private readonly types;
7675
+ supports(type: string): boolean;
7676
+ getOpenApiType(): OpenApiType;
7677
+ getFormat(): string | undefined;
7678
+ }
7679
+ declare class BooleanTypeStrategy implements TypeMappingStrategy {
7680
+ private readonly types;
7681
+ supports(type: string): boolean;
7682
+ getOpenApiType(): OpenApiType;
7683
+ getFormat(): undefined;
7684
+ }
7685
+ declare class UuidTypeStrategy implements TypeMappingStrategy {
7686
+ private readonly types;
7687
+ supports(type: string): boolean;
7688
+ getOpenApiType(): OpenApiType;
7689
+ getFormat(): string;
7690
+ }
7691
+ declare class DateTimeTypeStrategy implements TypeMappingStrategy {
7692
+ private readonly types;
7693
+ supports(type: string): boolean;
7694
+ getOpenApiType(): OpenApiType;
7695
+ getFormat(columnType?: string): string;
7696
+ }
7697
+ declare class StringTypeStrategy implements TypeMappingStrategy {
7698
+ private readonly types;
7699
+ supports(type: string): boolean;
7700
+ getOpenApiType(): OpenApiType;
7701
+ getFormat(): undefined;
7702
+ }
7703
+ declare class DefaultTypeStrategy implements TypeMappingStrategy {
7704
+ supports(): boolean;
7705
+ getOpenApiType(): OpenApiType;
7706
+ getFormat(): undefined;
7707
+ }
7708
+ declare class TypeMappingService {
7709
+ private readonly strategies;
7710
+ constructor();
7711
+ getOpenApiType(column: ColumnDef): OpenApiType;
7712
+ getFormat(column: ColumnDef): string | undefined;
7713
+ private findStrategy;
7714
+ registerStrategy(strategy: TypeMappingStrategy, index?: number): void;
7715
+ }
7716
+ declare const typeMappingService: TypeMappingService;
7717
+ declare function columnTypeToOpenApiType(col: ColumnDef): OpenApiType;
7718
+ declare function columnTypeToOpenApiFormat(col: ColumnDef): string | undefined;
7719
+
7720
+ declare function schemaToJson(schema: OpenApiSchema): string;
7721
+ declare function deepCloneSchema(schema: OpenApiSchema): OpenApiSchema;
7722
+ declare function mergeSchemas(base: OpenApiSchema, override: Partial<OpenApiSchema>): OpenApiSchema;
7723
+ declare function generateOpenApiDocument(info: OpenApiDocumentInfo, routes: ApiRouteDefinition[]): OpenApiDocument;
7724
+
7725
+ declare function isTableDef(target: TableDef | EntityConstructor): target is TableDef;
7726
+ declare function getColumnMap(target: TableDef | EntityConstructor): Record<string, ColumnDef>;
7727
+ type TargetType<T extends TableDef | EntityConstructor> = T;
7728
+
7729
+ declare function columnToOpenApiSchema(col: ColumnDef): OpenApiSchema;
7730
+
7731
+ declare function dtoToOpenApiSchema<T extends TableDef | EntityConstructor, TExclude extends keyof any>(target: T, exclude?: TExclude[]): OpenApiSchema;
7732
+ declare function createDtoToOpenApiSchema<T extends TableDef | EntityConstructor, TExclude extends keyof any>(target: T, exclude?: TExclude[]): OpenApiSchema;
7733
+ declare function updateDtoToOpenApiSchema<T extends TableDef | EntityConstructor, TExclude extends keyof any>(target: T, exclude?: TExclude[]): OpenApiSchema;
7734
+
7735
+ declare function whereInputToOpenApiSchema<T extends TableDef | EntityConstructor>(target: T): OpenApiSchema;
7736
+
7737
+ declare function relationFilterToOpenApiSchema(relation: RelationDef, options?: {
7738
+ exclude?: string[];
7739
+ include?: string[];
7740
+ }): OpenApiSchema;
7741
+ declare function whereInputWithRelationsToOpenApiSchema<T extends TableDef | EntityConstructor>(target: T, options?: {
7742
+ columnExclude?: string[];
7743
+ columnInclude?: string[];
7744
+ relationExclude?: string[];
7745
+ relationInclude?: string[];
7746
+ maxDepth?: number;
7747
+ }): OpenApiSchema;
7748
+ declare function nestedWhereInputToOpenApiSchema<T extends TableDef | EntityConstructor>(target: T, depth?: number): OpenApiSchema;
7749
+
7750
+ interface ComponentOptions {
7751
+ prefix?: string;
7752
+ exclude?: string[];
7753
+ include?: string[];
7754
+ }
7755
+ interface NestedDtoOptions {
7756
+ maxDepth?: number;
7757
+ includeRelations?: boolean;
7758
+ componentOptions?: ComponentOptions;
7759
+ }
7760
+ interface ComponentReference {
7761
+ $ref: string;
7762
+ }
7763
+ declare function isComponentReference(schema: OpenApiSchema): schema is ComponentReference;
7764
+ declare function nestedDtoToOpenApiSchema<T extends TableDef | EntityConstructor>(target: T, options?: NestedDtoOptions): OpenApiSchema;
7765
+ declare function updateDtoWithRelationsToOpenApiSchema<T extends TableDef | EntityConstructor>(target: T, _options?: NestedDtoOptions): OpenApiSchema;
7766
+ declare function generateComponentSchemas(targets: Array<{
7767
+ name: string;
7768
+ table: TableDef | EntityConstructor;
7769
+ }>, options?: ComponentOptions): Record<string, OpenApiSchema>;
7770
+ declare function generateRelationComponents(tables: Array<{
7771
+ name: string;
7772
+ table: TableDef;
7773
+ }>, options?: ComponentOptions): Record<string, OpenApiSchema>;
7774
+ declare function createApiComponentsSection(schemas: Record<string, OpenApiSchema>, parameters?: Record<string, OpenApiSchema>, responses?: Record<string, OpenApiSchema>): OpenApiComponent;
7775
+ declare function createRef(path: string): ComponentReference;
7776
+ declare function schemaToRef(schemaName: string): ComponentReference;
7777
+ declare function parameterToRef(paramName: string): ComponentReference;
7778
+ declare function responseToRef(responseName: string): ComponentReference;
7779
+ declare function replaceWithRefs(schema: OpenApiSchema, schemaMap: Record<string, OpenApiSchema>, path?: string): OpenApiSchema;
7780
+ declare function extractReusableSchemas(schema: OpenApiSchema, existing?: Record<string, OpenApiSchema>, prefix?: string): Record<string, OpenApiSchema>;
7781
+
7782
+ interface PaginationParams {
7783
+ page?: number;
7784
+ pageSize?: number;
7785
+ sortBy?: string;
7786
+ sortOrder?: 'asc' | 'desc';
7787
+ }
7788
+ declare const paginationParamsSchema: OpenApiSchema;
7789
+ declare function toPaginationParams(): OpenApiParameter[];
7790
+ declare function pagedResponseToOpenApiSchema<T extends OpenApiSchema>(itemSchema: T): OpenApiSchema;
7791
+
7792
+ export { type AliasRefNode, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, ConstructorMaterializationStrategy, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, 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, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiOperation, type OpenApiParameter, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, 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, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, UuidTypeStrategy, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };