metal-orm 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/dialect/mssql/index.ts +2 -2
- package/src/decorators/decorator-metadata.ts +21 -0
- package/src/decorators/index.ts +1 -0
- package/src/index.ts +4 -4
- package/src/orm/orm-session.ts +6 -6
package/package.json
CHANGED
|
@@ -118,10 +118,10 @@ export class SqlServerDialect extends SqlDialectBase {
|
|
|
118
118
|
}).join(', ');
|
|
119
119
|
|
|
120
120
|
const distinct = ast.distinct ? 'DISTINCT ' : '';
|
|
121
|
-
const from = this.
|
|
121
|
+
const from = this.compileFrom(ast.from, ctx);
|
|
122
122
|
|
|
123
123
|
const joins = ast.joins.map(j => {
|
|
124
|
-
const table = this.
|
|
124
|
+
const table = this.compileFrom(j.table, ctx);
|
|
125
125
|
const cond = this.compileExpression(j.condition, ctx);
|
|
126
126
|
return `${j.kind} JOIN ${table} ON ${cond}`;
|
|
127
127
|
}).join(' ');
|
|
@@ -72,3 +72,24 @@ export const getOrCreateMetadataBag = (context: StandardDecoratorContext): Decor
|
|
|
72
72
|
export const readMetadataBag = (context: StandardDecoratorContext): DecoratorMetadataBag | undefined => {
|
|
73
73
|
return context.metadata?.[METADATA_KEY] as DecoratorMetadataBag | undefined;
|
|
74
74
|
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Reads the metadata bag from a decorated constructor when using standard decorators.
|
|
78
|
+
* @param ctor - The entity constructor.
|
|
79
|
+
* @returns The metadata bag if present.
|
|
80
|
+
*/
|
|
81
|
+
export const readMetadataBagFromConstructor = (ctor: object): DecoratorMetadataBag | undefined => {
|
|
82
|
+
const metadataSymbol = (Symbol as { metadata?: symbol }).metadata;
|
|
83
|
+
if (!metadataSymbol) return undefined;
|
|
84
|
+
const metadata = Reflect.get(ctor, metadataSymbol) as Record<PropertyKey, unknown> | undefined;
|
|
85
|
+
return metadata?.[METADATA_KEY] as DecoratorMetadataBag | undefined;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Public helper to read decorator metadata from a class constructor.
|
|
90
|
+
* Standard decorators only; legacy metadata is intentionally ignored.
|
|
91
|
+
* @param ctor - The entity constructor.
|
|
92
|
+
* @returns The metadata bag if present.
|
|
93
|
+
*/
|
|
94
|
+
export const getDecoratorMetadata = (ctor: object): DecoratorMetadataBag | undefined =>
|
|
95
|
+
readMetadataBagFromConstructor(ctor);
|
package/src/decorators/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -25,10 +25,10 @@ export * from './core/functions/datetime.js';
|
|
|
25
25
|
export * from './orm/als.js';
|
|
26
26
|
export * from './orm/hydration.js';
|
|
27
27
|
export * from './codegen/typescript.js';
|
|
28
|
-
export * from './orm/orm-session.js';
|
|
29
|
-
export * from './orm/orm.js';
|
|
30
|
-
export * from './orm/entity.js';
|
|
31
|
-
export * from './orm/lazy-batch.js';
|
|
28
|
+
export * from './orm/orm-session.js';
|
|
29
|
+
export * from './orm/orm.js';
|
|
30
|
+
export * from './orm/entity.js';
|
|
31
|
+
export * from './orm/lazy-batch.js';
|
|
32
32
|
export * from './orm/relations/has-many.js';
|
|
33
33
|
export * from './orm/relations/belongs-to.js';
|
|
34
34
|
export * from './orm/relations/many-to-many.js';
|
package/src/orm/orm-session.ts
CHANGED
|
@@ -354,12 +354,12 @@ export class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Entit
|
|
|
354
354
|
this.markRemoved(entity);
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
/**
|
|
358
|
-
* Flushes pending changes to the database.
|
|
359
|
-
*/
|
|
360
|
-
async flush(): Promise<void> {
|
|
361
|
-
await this.unitOfWork.flush();
|
|
362
|
-
}
|
|
357
|
+
/**
|
|
358
|
+
* Flushes pending changes to the database without session hooks, relation processing, or domain events.
|
|
359
|
+
*/
|
|
360
|
+
async flush(): Promise<void> {
|
|
361
|
+
await this.unitOfWork.flush();
|
|
362
|
+
}
|
|
363
363
|
|
|
364
364
|
/**
|
|
365
365
|
* Flushes pending changes with interceptors and relation processing.
|