metal-orm 1.0.54 → 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/package.json
CHANGED
|
@@ -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.
|