MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / getMetadataFromDecorator

Function getMetadataFromDecorator

packages/decorators/src/utils.ts:185–196  ·  view source on GitHub ↗
(
  target: T & Dictionary & { [MetadataStorage.PATH_SYMBOL]?: string },
)

Source from the content-addressed store, hash-verified

183
184/** Retrieves or creates the metadata object for a decorated entity class. */
185export function getMetadataFromDecorator<T = any>(
186 target: T & Dictionary & { [MetadataStorage.PATH_SYMBOL]?: string },
187): EntityMetadata<T> {
188 if (!Object.hasOwn(target, MetadataStorage.PATH_SYMBOL)) {
189 Object.defineProperty(target, MetadataStorage.PATH_SYMBOL, {
190 value: lookupPathFromDecorator(target.name),
191 writable: true,
192 });
193 }
194
195 return MetadataStorage.getMetadata(target.name, target[MetadataStorage.PATH_SYMBOL]!);
196}

Callers 15

createDecoratorFunction · 0.85
EmbeddedFunction · 0.85
ManyToManyFunction · 0.85
EntityFunction · 0.85
EmbeddableFunction · 0.85
OneToManyFunction · 0.85
TriggerFunction · 0.85
EnumFunction · 0.85
ManyToOneFunction · 0.85
PropertyFunction · 0.85
CheckFunction · 0.85
hookFunction · 0.85

Calls 2

lookupPathFromDecoratorFunction · 0.85
getMetadataMethod · 0.65

Tested by

no test coverage detected