Skip to main content
Module

x/momentum/core/module-catalog.ts

Momentum is an open-source framework for building server-side Deno applications in TypeScript. It provides the paradigms and design patterns to guide developers to create robust, scalable, and enterprise-grade applications.
Latest
File
import { TypeIdentifier } from "./deps.ts";import { ExtendedModuleMetadata, ModuleClass, ModuleMetadata,} from "./module-metadata.ts";
export class ModuleCatalog { private static readonly catalog = new Map< ModuleClass, ExtendedModuleMetadata >();
static registerMetadata( type: ModuleClass, params: TypeIdentifier[], props: Record<string, TypeIdentifier>, config: ModuleMetadata, ) { this.catalog.set(type, { ...config, type, params, props }); }
static getMetadata(type: ModuleClass) { const metadata = this.catalog.get(type); if (!metadata) { throw new Error(`Module ${type} is not registered`); } return metadata; }}