metal-orm 1.0.15 → 1.0.16
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 +34 -27
- package/dist/decorators/index.cjs +339 -153
- package/dist/decorators/index.cjs.map +1 -1
- package/dist/decorators/index.d.cts +1 -5
- package/dist/decorators/index.d.ts +1 -5
- package/dist/decorators/index.js +339 -153
- package/dist/decorators/index.js.map +1 -1
- package/dist/index.cjs +838 -484
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -14
- package/dist/index.d.ts +17 -14
- package/dist/index.js +833 -483
- package/dist/index.js.map +1 -1
- package/dist/{select-Bkv8g8u_.d.cts → select-BKZrMRCQ.d.cts} +363 -28
- package/dist/{select-Bkv8g8u_.d.ts → select-BKZrMRCQ.d.ts} +363 -28
- package/package.json +1 -1
- package/src/codegen/naming-strategy.ts +64 -0
- package/src/codegen/typescript.ts +48 -53
- package/src/core/ddl/schema-generator.ts +3 -2
- package/src/core/ddl/schema-introspect.ts +1 -1
- package/src/core/dialect/abstract.ts +28 -0
- package/src/decorators/column.ts +13 -4
- package/src/index.ts +8 -1
- package/src/orm/entity-context.ts +30 -0
- package/src/orm/entity-meta.ts +2 -2
- package/src/orm/entity-metadata.ts +1 -6
- package/src/orm/entity.ts +88 -88
- package/src/orm/execute.ts +42 -25
- package/src/orm/execution-context.ts +12 -0
- package/src/orm/hydration-context.ts +14 -0
- package/src/orm/identity-map.ts +4 -0
- package/src/orm/interceptor-pipeline.ts +29 -0
- package/src/orm/lazy-batch.ts +6 -6
- package/src/orm/orm-session.ts +234 -0
- package/src/orm/orm.ts +58 -0
- package/src/orm/relation-change-processor.ts +5 -1
- package/src/orm/relations/belongs-to.ts +45 -44
- package/src/orm/relations/has-many.ts +44 -43
- package/src/orm/relations/has-one.ts +140 -139
- package/src/orm/relations/many-to-many.ts +46 -45
- package/src/orm/unit-of-work.ts +6 -1
- package/src/query-builder/select.ts +509 -3
- package/src/orm/orm-context.ts +0 -159
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, L as LogicalExpressionNode, N as NullExpressionNode, b as LiteralNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as ForeignKeyReference, s as IndexColumn, t as IndexDef, u as DbExecutor, H as HydrationPlan, R as RelationMap,
|
|
2
|
-
export {
|
|
1
|
+
import { O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, L as LogicalExpressionNode, N as NullExpressionNode, b as LiteralNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as ForeignKeyReference, s as IndexColumn, t as IndexDef, u as DbExecutor, H as HydrationPlan, v as NamingStrategy, R as RelationMap, w as EntityContext, x as Entity, y as HasManyRelation, z as HasOneRelation, A as BelongsToRelation, G as BelongsToManyRelation, K as HasManyCollection, M as BelongsToReference, P as ManyToManyCollection, Q as OrmSession, V as SelectQueryBuilder, X as ExecutionContext, Y as HydrationContext } from './select-BKZrMRCQ.cjs';
|
|
2
|
+
export { a8 as CascadeMode, Z as CheckConstraint, ae as ColumnToTs, a1 as ColumnType, au as DbExecutorFactory, a4 as DefaultValue, ay as DomainEventBus, ax as DomainEventHandler, aA as EntityStatus, av as ExternalTransaction, aF as HasDomainEvents, ag as HasOneReference, aq as HydrationMetadata, ao as HydrationPivotPlan, ap as HydrationRelationPlan, af as InferRow, aw as Orm, ar as OrmInterceptor, at as OrmOptions, as as OrmSessionOptions, aG as QueryLogEntry, aH as QueryLogger, aJ as QueryResult, a3 as RawDefaultValue, a2 as ReferentialAction, aD as RelationChange, aE as RelationChangeEntry, a9 as RelationDef, aC as RelationKey, a6 as RelationKinds, a7 as RelationType, aL as SimpleQueryRunner, $ as TableHooks, _ as TableOptions, aB as TrackedEntity, az as addDomainEvent, ac as belongsTo, ad as belongsToMany, a5 as col, ah as createColumn, aM as createExecutorFromQueryRunner, ai as createLiteral, aI as createQueryLoggingExecutor, a0 as defineTable, aa as hasMany, ab as hasOne, al as isCaseExpressionNode, an as isExpressionSelectionNode, ak as isFunctionNode, aj as isOperandNode, am as isWindowFunctionNode, aK as rowsToQueryResult } from './select-BKZrMRCQ.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Converts a primitive or existing operand into an operand node
|
|
@@ -1041,6 +1041,8 @@ declare const hydrateRows: (rows: Record<string, any>[], plan?: HydrationPlan) =
|
|
|
1041
1041
|
* Generates TypeScript code from query AST nodes
|
|
1042
1042
|
*/
|
|
1043
1043
|
declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandVisitor<string> {
|
|
1044
|
+
private namingStrategy;
|
|
1045
|
+
constructor(namingStrategy?: NamingStrategy);
|
|
1044
1046
|
/**
|
|
1045
1047
|
* Generates TypeScript code from a query AST
|
|
1046
1048
|
* @param ast - Query AST to generate code from
|
|
@@ -1170,17 +1172,17 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
|
|
|
1170
1172
|
private mapOp;
|
|
1171
1173
|
}
|
|
1172
1174
|
|
|
1173
|
-
declare const createEntityProxy: <TTable extends TableDef, TLazy extends keyof RelationMap<TTable> = keyof RelationMap<TTable>>(ctx:
|
|
1174
|
-
declare const createEntityFromRow: <TTable extends TableDef>(ctx:
|
|
1175
|
+
declare const createEntityProxy: <TTable extends TableDef, TLazy extends keyof RelationMap<TTable> = keyof RelationMap<TTable>>(ctx: EntityContext, table: TTable, row: Record<string, any>, lazyRelations?: TLazy[]) => Entity<TTable>;
|
|
1176
|
+
declare const createEntityFromRow: <TTable extends TableDef>(ctx: EntityContext, table: TTable, row: Record<string, any>, lazyRelations?: (keyof RelationMap<TTable>)[]) => Entity<TTable>;
|
|
1175
1177
|
|
|
1176
1178
|
type Rows$3 = Record<string, any>[];
|
|
1177
|
-
declare const loadHasManyRelation: (ctx:
|
|
1178
|
-
declare const loadHasOneRelation: (ctx:
|
|
1179
|
-
declare const loadBelongsToRelation: (ctx:
|
|
1180
|
-
declare const loadBelongsToManyRelation: (ctx:
|
|
1179
|
+
declare const loadHasManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasManyRelation) => Promise<Map<string, Rows$3>>;
|
|
1180
|
+
declare const loadHasOneRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasOneRelation) => Promise<Map<string, Record<string, any>>>;
|
|
1181
|
+
declare const loadBelongsToRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToRelation) => Promise<Map<string, Record<string, any>>>;
|
|
1182
|
+
declare const loadBelongsToManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToManyRelation) => Promise<Map<string, Rows$3>>;
|
|
1181
1183
|
|
|
1182
1184
|
interface EntityMeta<TTable extends TableDef> {
|
|
1183
|
-
ctx:
|
|
1185
|
+
ctx: EntityContext;
|
|
1184
1186
|
table: TTable;
|
|
1185
1187
|
lazyRelations: (keyof RelationMap<TTable>)[];
|
|
1186
1188
|
relationCache: Map<string, Promise<any>>;
|
|
@@ -1203,7 +1205,7 @@ declare class DefaultHasManyCollection<TChild> implements HasManyCollection<TChi
|
|
|
1203
1205
|
private items;
|
|
1204
1206
|
private readonly added;
|
|
1205
1207
|
private readonly removed;
|
|
1206
|
-
constructor(ctx:
|
|
1208
|
+
constructor(ctx: EntityContext, meta: EntityMeta<any>, root: any, relationName: string, relation: HasManyRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows$2>>, createEntity: (row: Record<string, any>) => TChild, localKey: string);
|
|
1207
1209
|
load(): Promise<TChild[]>;
|
|
1208
1210
|
getItems(): TChild[];
|
|
1209
1211
|
add(data: Partial<TChild>): TChild;
|
|
@@ -1228,7 +1230,7 @@ declare class DefaultBelongsToReference<TParent> implements BelongsToReference<T
|
|
|
1228
1230
|
private readonly targetKey;
|
|
1229
1231
|
private loaded;
|
|
1230
1232
|
private current;
|
|
1231
|
-
constructor(ctx:
|
|
1233
|
+
constructor(ctx: EntityContext, meta: EntityMeta<any>, root: any, relationName: string, relation: BelongsToRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows$1>>, createEntity: (row: Record<string, any>) => TParent, targetKey: string);
|
|
1232
1234
|
load(): Promise<TParent | null>;
|
|
1233
1235
|
get(): TParent | null;
|
|
1234
1236
|
set(data: Partial<TParent> | TParent | null): TParent | null;
|
|
@@ -1250,7 +1252,7 @@ declare class DefaultManyToManyCollection<TTarget> implements ManyToManyCollecti
|
|
|
1250
1252
|
private readonly localKey;
|
|
1251
1253
|
private loaded;
|
|
1252
1254
|
private items;
|
|
1253
|
-
constructor(ctx:
|
|
1255
|
+
constructor(ctx: EntityContext, meta: EntityMeta<any>, root: any, relationName: string, relation: BelongsToManyRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows>>, createEntity: (row: Record<string, any>) => TTarget, localKey: string);
|
|
1254
1256
|
load(): Promise<TTarget[]>;
|
|
1255
1257
|
getItems(): TTarget[];
|
|
1256
1258
|
attach(target: TTarget | number | string): void;
|
|
@@ -1264,7 +1266,8 @@ declare class DefaultManyToManyCollection<TTarget> implements ManyToManyCollecti
|
|
|
1264
1266
|
toJSON(): TTarget[];
|
|
1265
1267
|
}
|
|
1266
1268
|
|
|
1267
|
-
declare function executeHydrated<TTable extends TableDef>(
|
|
1269
|
+
declare function executeHydrated<TTable extends TableDef>(session: OrmSession, qb: SelectQueryBuilder<any, TTable>): Promise<Entity<TTable>[]>;
|
|
1270
|
+
declare function executeHydratedWithContexts<TTable extends TableDef>(_execCtx: ExecutionContext, hydCtx: HydrationContext, qb: SelectQueryBuilder<any, TTable>): Promise<Entity<TTable>[]>;
|
|
1268
1271
|
|
|
1269
1272
|
interface PostgresClientLike {
|
|
1270
1273
|
query(text: string, params?: unknown[]): Promise<{
|
|
@@ -1300,4 +1303,4 @@ interface MssqlClientLike {
|
|
|
1300
1303
|
}
|
|
1301
1304
|
declare function createMssqlExecutor(client: MssqlClientLike): DbExecutor;
|
|
1302
1305
|
|
|
1303
|
-
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, HasManyCollection, HasManyRelation, HasOneRelation, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor,
|
|
1306
|
+
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, EntityContext, ExecutionContext, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, HasManyCollection, HasManyRelation, HasOneRelation, HydrationContext, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor, OrmSession, type PostgresClientLike, PostgresDialect, RelationMap, type RenderColumnOptions, ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, TableDef, TableRef, TypeScriptGenerator, UpdateQueryBuilder, WindowFunctionNode, abs, acos, and, ascii, asin, atan, atan2, avg, between, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, columnOperand, concat, concatWs, cos, cot, count, createEntityFromRow, createEntityProxy, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createSqliteExecutor, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, degrees, denseRank, diffSchema, endOfMonth, eq, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, gt, gte, hydrateRows, inList, instr, introspectSchema, isNotNull, isNull, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rpad, rtrim, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, L as LogicalExpressionNode, N as NullExpressionNode, b as LiteralNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as ForeignKeyReference, s as IndexColumn, t as IndexDef, u as DbExecutor, H as HydrationPlan, R as RelationMap,
|
|
2
|
-
export {
|
|
1
|
+
import { O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, L as LogicalExpressionNode, N as NullExpressionNode, b as LiteralNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as ForeignKeyReference, s as IndexColumn, t as IndexDef, u as DbExecutor, H as HydrationPlan, v as NamingStrategy, R as RelationMap, w as EntityContext, x as Entity, y as HasManyRelation, z as HasOneRelation, A as BelongsToRelation, G as BelongsToManyRelation, K as HasManyCollection, M as BelongsToReference, P as ManyToManyCollection, Q as OrmSession, V as SelectQueryBuilder, X as ExecutionContext, Y as HydrationContext } from './select-BKZrMRCQ.js';
|
|
2
|
+
export { a8 as CascadeMode, Z as CheckConstraint, ae as ColumnToTs, a1 as ColumnType, au as DbExecutorFactory, a4 as DefaultValue, ay as DomainEventBus, ax as DomainEventHandler, aA as EntityStatus, av as ExternalTransaction, aF as HasDomainEvents, ag as HasOneReference, aq as HydrationMetadata, ao as HydrationPivotPlan, ap as HydrationRelationPlan, af as InferRow, aw as Orm, ar as OrmInterceptor, at as OrmOptions, as as OrmSessionOptions, aG as QueryLogEntry, aH as QueryLogger, aJ as QueryResult, a3 as RawDefaultValue, a2 as ReferentialAction, aD as RelationChange, aE as RelationChangeEntry, a9 as RelationDef, aC as RelationKey, a6 as RelationKinds, a7 as RelationType, aL as SimpleQueryRunner, $ as TableHooks, _ as TableOptions, aB as TrackedEntity, az as addDomainEvent, ac as belongsTo, ad as belongsToMany, a5 as col, ah as createColumn, aM as createExecutorFromQueryRunner, ai as createLiteral, aI as createQueryLoggingExecutor, a0 as defineTable, aa as hasMany, ab as hasOne, al as isCaseExpressionNode, an as isExpressionSelectionNode, ak as isFunctionNode, aj as isOperandNode, am as isWindowFunctionNode, aK as rowsToQueryResult } from './select-BKZrMRCQ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Converts a primitive or existing operand into an operand node
|
|
@@ -1041,6 +1041,8 @@ declare const hydrateRows: (rows: Record<string, any>[], plan?: HydrationPlan) =
|
|
|
1041
1041
|
* Generates TypeScript code from query AST nodes
|
|
1042
1042
|
*/
|
|
1043
1043
|
declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandVisitor<string> {
|
|
1044
|
+
private namingStrategy;
|
|
1045
|
+
constructor(namingStrategy?: NamingStrategy);
|
|
1044
1046
|
/**
|
|
1045
1047
|
* Generates TypeScript code from a query AST
|
|
1046
1048
|
* @param ast - Query AST to generate code from
|
|
@@ -1170,17 +1172,17 @@ declare class TypeScriptGenerator implements ExpressionVisitor<string>, OperandV
|
|
|
1170
1172
|
private mapOp;
|
|
1171
1173
|
}
|
|
1172
1174
|
|
|
1173
|
-
declare const createEntityProxy: <TTable extends TableDef, TLazy extends keyof RelationMap<TTable> = keyof RelationMap<TTable>>(ctx:
|
|
1174
|
-
declare const createEntityFromRow: <TTable extends TableDef>(ctx:
|
|
1175
|
+
declare const createEntityProxy: <TTable extends TableDef, TLazy extends keyof RelationMap<TTable> = keyof RelationMap<TTable>>(ctx: EntityContext, table: TTable, row: Record<string, any>, lazyRelations?: TLazy[]) => Entity<TTable>;
|
|
1176
|
+
declare const createEntityFromRow: <TTable extends TableDef>(ctx: EntityContext, table: TTable, row: Record<string, any>, lazyRelations?: (keyof RelationMap<TTable>)[]) => Entity<TTable>;
|
|
1175
1177
|
|
|
1176
1178
|
type Rows$3 = Record<string, any>[];
|
|
1177
|
-
declare const loadHasManyRelation: (ctx:
|
|
1178
|
-
declare const loadHasOneRelation: (ctx:
|
|
1179
|
-
declare const loadBelongsToRelation: (ctx:
|
|
1180
|
-
declare const loadBelongsToManyRelation: (ctx:
|
|
1179
|
+
declare const loadHasManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasManyRelation) => Promise<Map<string, Rows$3>>;
|
|
1180
|
+
declare const loadHasOneRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasOneRelation) => Promise<Map<string, Record<string, any>>>;
|
|
1181
|
+
declare const loadBelongsToRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToRelation) => Promise<Map<string, Record<string, any>>>;
|
|
1182
|
+
declare const loadBelongsToManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToManyRelation) => Promise<Map<string, Rows$3>>;
|
|
1181
1183
|
|
|
1182
1184
|
interface EntityMeta<TTable extends TableDef> {
|
|
1183
|
-
ctx:
|
|
1185
|
+
ctx: EntityContext;
|
|
1184
1186
|
table: TTable;
|
|
1185
1187
|
lazyRelations: (keyof RelationMap<TTable>)[];
|
|
1186
1188
|
relationCache: Map<string, Promise<any>>;
|
|
@@ -1203,7 +1205,7 @@ declare class DefaultHasManyCollection<TChild> implements HasManyCollection<TChi
|
|
|
1203
1205
|
private items;
|
|
1204
1206
|
private readonly added;
|
|
1205
1207
|
private readonly removed;
|
|
1206
|
-
constructor(ctx:
|
|
1208
|
+
constructor(ctx: EntityContext, meta: EntityMeta<any>, root: any, relationName: string, relation: HasManyRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows$2>>, createEntity: (row: Record<string, any>) => TChild, localKey: string);
|
|
1207
1209
|
load(): Promise<TChild[]>;
|
|
1208
1210
|
getItems(): TChild[];
|
|
1209
1211
|
add(data: Partial<TChild>): TChild;
|
|
@@ -1228,7 +1230,7 @@ declare class DefaultBelongsToReference<TParent> implements BelongsToReference<T
|
|
|
1228
1230
|
private readonly targetKey;
|
|
1229
1231
|
private loaded;
|
|
1230
1232
|
private current;
|
|
1231
|
-
constructor(ctx:
|
|
1233
|
+
constructor(ctx: EntityContext, meta: EntityMeta<any>, root: any, relationName: string, relation: BelongsToRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows$1>>, createEntity: (row: Record<string, any>) => TParent, targetKey: string);
|
|
1232
1234
|
load(): Promise<TParent | null>;
|
|
1233
1235
|
get(): TParent | null;
|
|
1234
1236
|
set(data: Partial<TParent> | TParent | null): TParent | null;
|
|
@@ -1250,7 +1252,7 @@ declare class DefaultManyToManyCollection<TTarget> implements ManyToManyCollecti
|
|
|
1250
1252
|
private readonly localKey;
|
|
1251
1253
|
private loaded;
|
|
1252
1254
|
private items;
|
|
1253
|
-
constructor(ctx:
|
|
1255
|
+
constructor(ctx: EntityContext, meta: EntityMeta<any>, root: any, relationName: string, relation: BelongsToManyRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows>>, createEntity: (row: Record<string, any>) => TTarget, localKey: string);
|
|
1254
1256
|
load(): Promise<TTarget[]>;
|
|
1255
1257
|
getItems(): TTarget[];
|
|
1256
1258
|
attach(target: TTarget | number | string): void;
|
|
@@ -1264,7 +1266,8 @@ declare class DefaultManyToManyCollection<TTarget> implements ManyToManyCollecti
|
|
|
1264
1266
|
toJSON(): TTarget[];
|
|
1265
1267
|
}
|
|
1266
1268
|
|
|
1267
|
-
declare function executeHydrated<TTable extends TableDef>(
|
|
1269
|
+
declare function executeHydrated<TTable extends TableDef>(session: OrmSession, qb: SelectQueryBuilder<any, TTable>): Promise<Entity<TTable>[]>;
|
|
1270
|
+
declare function executeHydratedWithContexts<TTable extends TableDef>(_execCtx: ExecutionContext, hydCtx: HydrationContext, qb: SelectQueryBuilder<any, TTable>): Promise<Entity<TTable>[]>;
|
|
1268
1271
|
|
|
1269
1272
|
interface PostgresClientLike {
|
|
1270
1273
|
query(text: string, params?: unknown[]): Promise<{
|
|
@@ -1300,4 +1303,4 @@ interface MssqlClientLike {
|
|
|
1300
1303
|
}
|
|
1301
1304
|
declare function createMssqlExecutor(client: MssqlClientLike): DbExecutor;
|
|
1302
1305
|
|
|
1303
|
-
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, HasManyCollection, HasManyRelation, HasOneRelation, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor,
|
|
1306
|
+
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, EntityContext, ExecutionContext, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, HasManyCollection, HasManyRelation, HasOneRelation, HydrationContext, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor, OrmSession, type PostgresClientLike, PostgresDialect, RelationMap, type RenderColumnOptions, ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, TableDef, TableRef, TypeScriptGenerator, UpdateQueryBuilder, WindowFunctionNode, abs, acos, and, ascii, asin, atan, atan2, avg, between, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, columnOperand, concat, concatWs, cos, cot, count, createEntityFromRow, createEntityProxy, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createSqliteExecutor, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, degrees, denseRank, diffSchema, endOfMonth, eq, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, gt, gte, hydrateRows, inList, instr, introspectSchema, isNotNull, isNull, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rpad, rtrim, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|