metal-orm 1.0.60 → 1.0.62
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/README.md +15 -11
- package/dist/index.cjs +213 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +126 -12
- package/dist/index.d.ts +126 -12
- package/dist/index.js +209 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/bootstrap.ts +127 -119
- package/src/decorators/index.ts +4 -0
- package/src/orm/entity-materializer.ts +159 -0
- package/src/orm/entity-registry.ts +39 -0
- package/src/orm/execute.ts +62 -18
- package/src/query-builder/select/select-operations.ts +1 -2
- package/src/query-builder/select.ts +85 -15
package/dist/index.d.cts
CHANGED
|
@@ -3509,7 +3509,7 @@ type DeepSelectConfig<TTable extends TableDef> = DeepSelectEntry<TTable>[];
|
|
|
3509
3509
|
* @typeParam T - Result type for projections (unused)
|
|
3510
3510
|
* @typeParam TTable - Table definition being queried
|
|
3511
3511
|
*/
|
|
3512
|
-
declare class SelectQueryBuilder<T =
|
|
3512
|
+
declare class SelectQueryBuilder<T = EntityInstance<any>, TTable extends TableDef = TableDef> {
|
|
3513
3513
|
private readonly env;
|
|
3514
3514
|
private readonly context;
|
|
3515
3515
|
private readonly columnSelector;
|
|
@@ -3522,6 +3522,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3522
3522
|
private readonly relationFacet;
|
|
3523
3523
|
private readonly lazyRelations;
|
|
3524
3524
|
private readonly lazyRelationOptions;
|
|
3525
|
+
private readonly entityConstructor?;
|
|
3525
3526
|
/**
|
|
3526
3527
|
* Creates a new SelectQueryBuilder instance
|
|
3527
3528
|
* @param table - Table definition to query
|
|
@@ -3529,7 +3530,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3529
3530
|
* @param hydration - Optional hydration manager
|
|
3530
3531
|
* @param dependencies - Optional query builder dependencies
|
|
3531
3532
|
*/
|
|
3532
|
-
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>, lazyRelationOptions?: Map<string, RelationIncludeOptions>);
|
|
3533
|
+
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>, lazyRelationOptions?: Map<string, RelationIncludeOptions>, entityConstructor?: EntityConstructor<any>);
|
|
3533
3534
|
/**
|
|
3534
3535
|
* Creates a new SelectQueryBuilder instance with updated context and lazy relations
|
|
3535
3536
|
* @param context - Updated query context
|
|
@@ -3831,15 +3832,49 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3831
3832
|
*/
|
|
3832
3833
|
getTable(): TTable;
|
|
3833
3834
|
/**
|
|
3834
|
-
*
|
|
3835
|
+
* Ensures that if no columns are selected, all columns from the table are selected by default.
|
|
3836
|
+
*/
|
|
3837
|
+
private ensureDefaultSelection;
|
|
3838
|
+
/**
|
|
3839
|
+
* Executes the query and returns hydrated results.
|
|
3840
|
+
* If the builder was created with an entity constructor (e.g. via selectFromEntity),
|
|
3841
|
+
* this will automatically return fully materialized entity instances.
|
|
3842
|
+
*
|
|
3835
3843
|
* @param ctx - ORM session context
|
|
3836
|
-
* @returns Promise of entity instances
|
|
3844
|
+
* @returns Promise of entity instances (or objects if generic T is not an entity)
|
|
3837
3845
|
* @example
|
|
3838
|
-
* const users = await
|
|
3839
|
-
*
|
|
3840
|
-
*
|
|
3846
|
+
* const users = await selectFromEntity(User).execute(session);
|
|
3847
|
+
* // users is User[]
|
|
3848
|
+
* users[0] instanceof User; // true
|
|
3849
|
+
*/
|
|
3850
|
+
execute(ctx: OrmSession): Promise<T[]>;
|
|
3851
|
+
/**
|
|
3852
|
+
* Executes the query and returns plain row objects (POJOs), ignoring any entity materialization.
|
|
3853
|
+
* Use this if you want raw data even when using selectFromEntity.
|
|
3854
|
+
*
|
|
3855
|
+
* @param ctx - ORM session context
|
|
3856
|
+
* @returns Promise of plain entity instances
|
|
3857
|
+
* @example
|
|
3858
|
+
* const rows = await selectFromEntity(User).executePlain(session);
|
|
3859
|
+
* // rows is EntityInstance<UserTable>[] (plain objects)
|
|
3860
|
+
* rows[0] instanceof User; // false
|
|
3861
|
+
*/
|
|
3862
|
+
executePlain(ctx: OrmSession): Promise<EntityInstance<TTable>[]>;
|
|
3863
|
+
/**
|
|
3864
|
+
* Executes the query and returns results as real class instances.
|
|
3865
|
+
* Unlike execute(), this returns actual instances of the decorated entity class
|
|
3866
|
+
* with working methods and proper instanceof checks.
|
|
3867
|
+
* @param entityClass - The entity class constructor
|
|
3868
|
+
* @param ctx - ORM session context
|
|
3869
|
+
* @returns Promise of entity class instances
|
|
3870
|
+
* @example
|
|
3871
|
+
* const users = await selectFromEntity(User)
|
|
3872
|
+
* .include('posts')
|
|
3873
|
+
* .executeAs(User, session);
|
|
3874
|
+
* users[0] instanceof User; // true!
|
|
3875
|
+
* users[0].getFullName(); // works!
|
|
3841
3876
|
*/
|
|
3842
|
-
|
|
3877
|
+
executeAs<TEntity extends object>(entityClass: EntityConstructor<TEntity>, ctx: OrmSession): Promise<TEntity[]>;
|
|
3843
3878
|
/**
|
|
3844
3879
|
* Executes a count query for the current builder without LIMIT/OFFSET clauses.
|
|
3845
3880
|
*
|
|
@@ -3857,7 +3892,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3857
3892
|
page: number;
|
|
3858
3893
|
pageSize: number;
|
|
3859
3894
|
}): Promise<{
|
|
3860
|
-
items:
|
|
3895
|
+
items: T[];
|
|
3861
3896
|
totalItems: number;
|
|
3862
3897
|
}>;
|
|
3863
3898
|
/**
|
|
@@ -3870,7 +3905,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3870
3905
|
* const hydCtx = new HydrationContext();
|
|
3871
3906
|
* const users = await qb.executeWithContexts(execCtx, hydCtx);
|
|
3872
3907
|
*/
|
|
3873
|
-
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<
|
|
3908
|
+
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<T[]>;
|
|
3874
3909
|
/**
|
|
3875
3910
|
* Adds a WHERE condition to the query
|
|
3876
3911
|
* @param expr - Expression for the WHERE clause
|
|
@@ -6218,7 +6253,7 @@ type EntityTable<TEntity extends object> = Omit<TableDef<{
|
|
|
6218
6253
|
[K in RelationKeys<TEntity>]: NonNullable<TEntity[K]> extends HasManyCollection<infer TChild> ? HasManyRelation<EntityTable<NonNullable<TChild> & object>> : NonNullable<TEntity[K]> extends ManyToManyCollection<infer TTarget, infer TPivot> ? BelongsToManyRelation<EntityTable<NonNullable<TTarget> & object>, TPivot extends object ? EntityTable<NonNullable<TPivot> & object> : TableDef> : NonNullable<TEntity[K]> extends HasOneReference<infer TChild> ? HasOneRelation<EntityTable<NonNullable<TChild> & object>> : NonNullable<TEntity[K]> extends BelongsToReference<infer TParent> ? BelongsToRelation<EntityTable<NonNullable<TParent> & object>> : NonNullable<TEntity[K]> extends object ? BelongsToRelation<EntityTable<NonNullable<TEntity[K]> & object>> : never;
|
|
6219
6254
|
};
|
|
6220
6255
|
};
|
|
6221
|
-
declare const selectFromEntity: <TEntity extends object>(ctor: EntityConstructor<TEntity>) => SelectQueryBuilder<
|
|
6256
|
+
declare const selectFromEntity: <TEntity extends object>(ctor: EntityConstructor<TEntity>) => SelectQueryBuilder<TEntity, EntityTable<TEntity>>;
|
|
6222
6257
|
/**
|
|
6223
6258
|
* Public API: opt-in ergonomic entity reference (decorator-level).
|
|
6224
6259
|
*
|
|
@@ -6247,6 +6282,85 @@ interface DecoratorMetadataBag {
|
|
|
6247
6282
|
*/
|
|
6248
6283
|
declare const getDecoratorMetadata: (ctor: object) => DecoratorMetadataBag | undefined;
|
|
6249
6284
|
|
|
6285
|
+
/**
|
|
6286
|
+
* Strategy interface for materializing entity instances (Open/Closed Principle).
|
|
6287
|
+
*/
|
|
6288
|
+
interface EntityMaterializationStrategy {
|
|
6289
|
+
/**
|
|
6290
|
+
* Creates an instance of the entity class and populates it with data.
|
|
6291
|
+
* @param ctor - The entity constructor
|
|
6292
|
+
* @param data - The raw data to populate
|
|
6293
|
+
* @returns The materialized entity instance
|
|
6294
|
+
*/
|
|
6295
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6298
|
+
* Default strategy: Uses Object.create() to create instance without calling constructor.
|
|
6299
|
+
* Safe for classes with required constructor parameters.
|
|
6300
|
+
*/
|
|
6301
|
+
declare class PrototypeMaterializationStrategy implements EntityMaterializationStrategy {
|
|
6302
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6303
|
+
}
|
|
6304
|
+
/**
|
|
6305
|
+
* Alternative strategy: Calls default constructor then assigns properties.
|
|
6306
|
+
* Use when class constructor initializes important state.
|
|
6307
|
+
*/
|
|
6308
|
+
declare class ConstructorMaterializationStrategy implements EntityMaterializationStrategy {
|
|
6309
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6310
|
+
}
|
|
6311
|
+
/**
|
|
6312
|
+
* Interface for materializing query results into real entity class instances.
|
|
6313
|
+
*/
|
|
6314
|
+
interface EntityMaterializer {
|
|
6315
|
+
/**
|
|
6316
|
+
* Materializes a single row into a real entity instance.
|
|
6317
|
+
* @param entityClass - The entity constructor
|
|
6318
|
+
* @param row - The raw data row
|
|
6319
|
+
* @returns The materialized entity instance
|
|
6320
|
+
*/
|
|
6321
|
+
materialize<T>(entityClass: EntityConstructor<T>, row: Record<string, unknown>): T;
|
|
6322
|
+
/**
|
|
6323
|
+
* Materializes multiple rows into real entity instances.
|
|
6324
|
+
* @param entityClass - The entity constructor
|
|
6325
|
+
* @param rows - The raw data rows
|
|
6326
|
+
* @returns Array of materialized entity instances
|
|
6327
|
+
*/
|
|
6328
|
+
materializeMany<T>(entityClass: EntityConstructor<T>, rows: Record<string, unknown>[]): T[];
|
|
6329
|
+
}
|
|
6330
|
+
/**
|
|
6331
|
+
* Default implementation of EntityMaterializer.
|
|
6332
|
+
* Converts query results into actual class instances with working methods.
|
|
6333
|
+
*
|
|
6334
|
+
* @example
|
|
6335
|
+
* const materializer = new DefaultEntityMaterializer();
|
|
6336
|
+
* const users = materializer.materializeMany(User, queryResults);
|
|
6337
|
+
* users[0] instanceof User; // true
|
|
6338
|
+
* users[0].getFullName(); // works!
|
|
6339
|
+
*/
|
|
6340
|
+
declare class DefaultEntityMaterializer implements EntityMaterializer {
|
|
6341
|
+
private readonly strategy;
|
|
6342
|
+
constructor(strategy?: EntityMaterializationStrategy);
|
|
6343
|
+
materialize<T>(ctor: EntityConstructor<T>, row: Record<string, unknown>): T;
|
|
6344
|
+
materializeMany<T>(ctor: EntityConstructor<T>, rows: Record<string, unknown>[]): T[];
|
|
6345
|
+
/**
|
|
6346
|
+
* Recursively materializes nested relation data.
|
|
6347
|
+
*/
|
|
6348
|
+
private materializeRelations;
|
|
6349
|
+
/**
|
|
6350
|
+
* Simple heuristic to check if an object looks like an entity.
|
|
6351
|
+
*/
|
|
6352
|
+
private isEntityLike;
|
|
6353
|
+
}
|
|
6354
|
+
/**
|
|
6355
|
+
* Convenience function to materialize query results as real class instances.
|
|
6356
|
+
*
|
|
6357
|
+
* @example
|
|
6358
|
+
* const results = await selectFromEntity(User).execute(session);
|
|
6359
|
+
* const users = materializeAs(User, results);
|
|
6360
|
+
* users[0] instanceof User; // true!
|
|
6361
|
+
*/
|
|
6362
|
+
declare const materializeAs: <TEntity extends object>(ctor: EntityConstructor<TEntity>, results: Record<string, unknown>[]) => TEntity[];
|
|
6363
|
+
|
|
6250
6364
|
type PoolOptions = {
|
|
6251
6365
|
/** Maximum number of live resources (idle + leased). */
|
|
6252
6366
|
max: number;
|
|
@@ -6410,4 +6524,4 @@ type PooledExecutorFactoryOptions<TConn> = {
|
|
|
6410
6524
|
*/
|
|
6411
6525
|
declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
|
|
6412
6526
|
|
|
6413
|
-
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 ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type 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 IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, 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 ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, 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, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, 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, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, 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, 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, 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 };
|
|
6527
|
+
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 ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, 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, 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, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, 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 ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, 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, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, 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, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, 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, 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -3509,7 +3509,7 @@ type DeepSelectConfig<TTable extends TableDef> = DeepSelectEntry<TTable>[];
|
|
|
3509
3509
|
* @typeParam T - Result type for projections (unused)
|
|
3510
3510
|
* @typeParam TTable - Table definition being queried
|
|
3511
3511
|
*/
|
|
3512
|
-
declare class SelectQueryBuilder<T =
|
|
3512
|
+
declare class SelectQueryBuilder<T = EntityInstance<any>, TTable extends TableDef = TableDef> {
|
|
3513
3513
|
private readonly env;
|
|
3514
3514
|
private readonly context;
|
|
3515
3515
|
private readonly columnSelector;
|
|
@@ -3522,6 +3522,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3522
3522
|
private readonly relationFacet;
|
|
3523
3523
|
private readonly lazyRelations;
|
|
3524
3524
|
private readonly lazyRelationOptions;
|
|
3525
|
+
private readonly entityConstructor?;
|
|
3525
3526
|
/**
|
|
3526
3527
|
* Creates a new SelectQueryBuilder instance
|
|
3527
3528
|
* @param table - Table definition to query
|
|
@@ -3529,7 +3530,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3529
3530
|
* @param hydration - Optional hydration manager
|
|
3530
3531
|
* @param dependencies - Optional query builder dependencies
|
|
3531
3532
|
*/
|
|
3532
|
-
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>, lazyRelationOptions?: Map<string, RelationIncludeOptions>);
|
|
3533
|
+
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>, lazyRelationOptions?: Map<string, RelationIncludeOptions>, entityConstructor?: EntityConstructor<any>);
|
|
3533
3534
|
/**
|
|
3534
3535
|
* Creates a new SelectQueryBuilder instance with updated context and lazy relations
|
|
3535
3536
|
* @param context - Updated query context
|
|
@@ -3831,15 +3832,49 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3831
3832
|
*/
|
|
3832
3833
|
getTable(): TTable;
|
|
3833
3834
|
/**
|
|
3834
|
-
*
|
|
3835
|
+
* Ensures that if no columns are selected, all columns from the table are selected by default.
|
|
3836
|
+
*/
|
|
3837
|
+
private ensureDefaultSelection;
|
|
3838
|
+
/**
|
|
3839
|
+
* Executes the query and returns hydrated results.
|
|
3840
|
+
* If the builder was created with an entity constructor (e.g. via selectFromEntity),
|
|
3841
|
+
* this will automatically return fully materialized entity instances.
|
|
3842
|
+
*
|
|
3835
3843
|
* @param ctx - ORM session context
|
|
3836
|
-
* @returns Promise of entity instances
|
|
3844
|
+
* @returns Promise of entity instances (or objects if generic T is not an entity)
|
|
3837
3845
|
* @example
|
|
3838
|
-
* const users = await
|
|
3839
|
-
*
|
|
3840
|
-
*
|
|
3846
|
+
* const users = await selectFromEntity(User).execute(session);
|
|
3847
|
+
* // users is User[]
|
|
3848
|
+
* users[0] instanceof User; // true
|
|
3849
|
+
*/
|
|
3850
|
+
execute(ctx: OrmSession): Promise<T[]>;
|
|
3851
|
+
/**
|
|
3852
|
+
* Executes the query and returns plain row objects (POJOs), ignoring any entity materialization.
|
|
3853
|
+
* Use this if you want raw data even when using selectFromEntity.
|
|
3854
|
+
*
|
|
3855
|
+
* @param ctx - ORM session context
|
|
3856
|
+
* @returns Promise of plain entity instances
|
|
3857
|
+
* @example
|
|
3858
|
+
* const rows = await selectFromEntity(User).executePlain(session);
|
|
3859
|
+
* // rows is EntityInstance<UserTable>[] (plain objects)
|
|
3860
|
+
* rows[0] instanceof User; // false
|
|
3861
|
+
*/
|
|
3862
|
+
executePlain(ctx: OrmSession): Promise<EntityInstance<TTable>[]>;
|
|
3863
|
+
/**
|
|
3864
|
+
* Executes the query and returns results as real class instances.
|
|
3865
|
+
* Unlike execute(), this returns actual instances of the decorated entity class
|
|
3866
|
+
* with working methods and proper instanceof checks.
|
|
3867
|
+
* @param entityClass - The entity class constructor
|
|
3868
|
+
* @param ctx - ORM session context
|
|
3869
|
+
* @returns Promise of entity class instances
|
|
3870
|
+
* @example
|
|
3871
|
+
* const users = await selectFromEntity(User)
|
|
3872
|
+
* .include('posts')
|
|
3873
|
+
* .executeAs(User, session);
|
|
3874
|
+
* users[0] instanceof User; // true!
|
|
3875
|
+
* users[0].getFullName(); // works!
|
|
3841
3876
|
*/
|
|
3842
|
-
|
|
3877
|
+
executeAs<TEntity extends object>(entityClass: EntityConstructor<TEntity>, ctx: OrmSession): Promise<TEntity[]>;
|
|
3843
3878
|
/**
|
|
3844
3879
|
* Executes a count query for the current builder without LIMIT/OFFSET clauses.
|
|
3845
3880
|
*
|
|
@@ -3857,7 +3892,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3857
3892
|
page: number;
|
|
3858
3893
|
pageSize: number;
|
|
3859
3894
|
}): Promise<{
|
|
3860
|
-
items:
|
|
3895
|
+
items: T[];
|
|
3861
3896
|
totalItems: number;
|
|
3862
3897
|
}>;
|
|
3863
3898
|
/**
|
|
@@ -3870,7 +3905,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3870
3905
|
* const hydCtx = new HydrationContext();
|
|
3871
3906
|
* const users = await qb.executeWithContexts(execCtx, hydCtx);
|
|
3872
3907
|
*/
|
|
3873
|
-
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<
|
|
3908
|
+
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<T[]>;
|
|
3874
3909
|
/**
|
|
3875
3910
|
* Adds a WHERE condition to the query
|
|
3876
3911
|
* @param expr - Expression for the WHERE clause
|
|
@@ -6218,7 +6253,7 @@ type EntityTable<TEntity extends object> = Omit<TableDef<{
|
|
|
6218
6253
|
[K in RelationKeys<TEntity>]: NonNullable<TEntity[K]> extends HasManyCollection<infer TChild> ? HasManyRelation<EntityTable<NonNullable<TChild> & object>> : NonNullable<TEntity[K]> extends ManyToManyCollection<infer TTarget, infer TPivot> ? BelongsToManyRelation<EntityTable<NonNullable<TTarget> & object>, TPivot extends object ? EntityTable<NonNullable<TPivot> & object> : TableDef> : NonNullable<TEntity[K]> extends HasOneReference<infer TChild> ? HasOneRelation<EntityTable<NonNullable<TChild> & object>> : NonNullable<TEntity[K]> extends BelongsToReference<infer TParent> ? BelongsToRelation<EntityTable<NonNullable<TParent> & object>> : NonNullable<TEntity[K]> extends object ? BelongsToRelation<EntityTable<NonNullable<TEntity[K]> & object>> : never;
|
|
6219
6254
|
};
|
|
6220
6255
|
};
|
|
6221
|
-
declare const selectFromEntity: <TEntity extends object>(ctor: EntityConstructor<TEntity>) => SelectQueryBuilder<
|
|
6256
|
+
declare const selectFromEntity: <TEntity extends object>(ctor: EntityConstructor<TEntity>) => SelectQueryBuilder<TEntity, EntityTable<TEntity>>;
|
|
6222
6257
|
/**
|
|
6223
6258
|
* Public API: opt-in ergonomic entity reference (decorator-level).
|
|
6224
6259
|
*
|
|
@@ -6247,6 +6282,85 @@ interface DecoratorMetadataBag {
|
|
|
6247
6282
|
*/
|
|
6248
6283
|
declare const getDecoratorMetadata: (ctor: object) => DecoratorMetadataBag | undefined;
|
|
6249
6284
|
|
|
6285
|
+
/**
|
|
6286
|
+
* Strategy interface for materializing entity instances (Open/Closed Principle).
|
|
6287
|
+
*/
|
|
6288
|
+
interface EntityMaterializationStrategy {
|
|
6289
|
+
/**
|
|
6290
|
+
* Creates an instance of the entity class and populates it with data.
|
|
6291
|
+
* @param ctor - The entity constructor
|
|
6292
|
+
* @param data - The raw data to populate
|
|
6293
|
+
* @returns The materialized entity instance
|
|
6294
|
+
*/
|
|
6295
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6298
|
+
* Default strategy: Uses Object.create() to create instance without calling constructor.
|
|
6299
|
+
* Safe for classes with required constructor parameters.
|
|
6300
|
+
*/
|
|
6301
|
+
declare class PrototypeMaterializationStrategy implements EntityMaterializationStrategy {
|
|
6302
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6303
|
+
}
|
|
6304
|
+
/**
|
|
6305
|
+
* Alternative strategy: Calls default constructor then assigns properties.
|
|
6306
|
+
* Use when class constructor initializes important state.
|
|
6307
|
+
*/
|
|
6308
|
+
declare class ConstructorMaterializationStrategy implements EntityMaterializationStrategy {
|
|
6309
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6310
|
+
}
|
|
6311
|
+
/**
|
|
6312
|
+
* Interface for materializing query results into real entity class instances.
|
|
6313
|
+
*/
|
|
6314
|
+
interface EntityMaterializer {
|
|
6315
|
+
/**
|
|
6316
|
+
* Materializes a single row into a real entity instance.
|
|
6317
|
+
* @param entityClass - The entity constructor
|
|
6318
|
+
* @param row - The raw data row
|
|
6319
|
+
* @returns The materialized entity instance
|
|
6320
|
+
*/
|
|
6321
|
+
materialize<T>(entityClass: EntityConstructor<T>, row: Record<string, unknown>): T;
|
|
6322
|
+
/**
|
|
6323
|
+
* Materializes multiple rows into real entity instances.
|
|
6324
|
+
* @param entityClass - The entity constructor
|
|
6325
|
+
* @param rows - The raw data rows
|
|
6326
|
+
* @returns Array of materialized entity instances
|
|
6327
|
+
*/
|
|
6328
|
+
materializeMany<T>(entityClass: EntityConstructor<T>, rows: Record<string, unknown>[]): T[];
|
|
6329
|
+
}
|
|
6330
|
+
/**
|
|
6331
|
+
* Default implementation of EntityMaterializer.
|
|
6332
|
+
* Converts query results into actual class instances with working methods.
|
|
6333
|
+
*
|
|
6334
|
+
* @example
|
|
6335
|
+
* const materializer = new DefaultEntityMaterializer();
|
|
6336
|
+
* const users = materializer.materializeMany(User, queryResults);
|
|
6337
|
+
* users[0] instanceof User; // true
|
|
6338
|
+
* users[0].getFullName(); // works!
|
|
6339
|
+
*/
|
|
6340
|
+
declare class DefaultEntityMaterializer implements EntityMaterializer {
|
|
6341
|
+
private readonly strategy;
|
|
6342
|
+
constructor(strategy?: EntityMaterializationStrategy);
|
|
6343
|
+
materialize<T>(ctor: EntityConstructor<T>, row: Record<string, unknown>): T;
|
|
6344
|
+
materializeMany<T>(ctor: EntityConstructor<T>, rows: Record<string, unknown>[]): T[];
|
|
6345
|
+
/**
|
|
6346
|
+
* Recursively materializes nested relation data.
|
|
6347
|
+
*/
|
|
6348
|
+
private materializeRelations;
|
|
6349
|
+
/**
|
|
6350
|
+
* Simple heuristic to check if an object looks like an entity.
|
|
6351
|
+
*/
|
|
6352
|
+
private isEntityLike;
|
|
6353
|
+
}
|
|
6354
|
+
/**
|
|
6355
|
+
* Convenience function to materialize query results as real class instances.
|
|
6356
|
+
*
|
|
6357
|
+
* @example
|
|
6358
|
+
* const results = await selectFromEntity(User).execute(session);
|
|
6359
|
+
* const users = materializeAs(User, results);
|
|
6360
|
+
* users[0] instanceof User; // true!
|
|
6361
|
+
*/
|
|
6362
|
+
declare const materializeAs: <TEntity extends object>(ctor: EntityConstructor<TEntity>, results: Record<string, unknown>[]) => TEntity[];
|
|
6363
|
+
|
|
6250
6364
|
type PoolOptions = {
|
|
6251
6365
|
/** Maximum number of live resources (idle + leased). */
|
|
6252
6366
|
max: number;
|
|
@@ -6410,4 +6524,4 @@ type PooledExecutorFactoryOptions<TConn> = {
|
|
|
6410
6524
|
*/
|
|
6411
6525
|
declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
|
|
6412
6526
|
|
|
6413
|
-
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 ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type 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 IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, 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 ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, 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, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, 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, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, 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, 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, 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 };
|
|
6527
|
+
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 ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, 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, 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, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, 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 ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, 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, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, 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, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, 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, 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, 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 };
|