@dbs-portal/core-module-registry
Version:
Core module registry system for automatic module discovery and registration
72 lines • 3.71 kB
TypeScript
/**
* Module Registry Utilities
*
* Utility functions and classes for module registry operations
*/
export { ModuleCache } from './ModuleCache';
export type { CacheOptions, CacheStats } from './ModuleCache';
export { BrowserEventEmitter, defaultEventEmitter } from './BrowserEventEmitter';
export type { EventListener, EventEmitterInterface } from './BrowserEventEmitter';
export { getPath, getFs, getGlob, initializePlatformModules, preloadBrowserModules, getPlatformInfo, createPlatformError, clearModuleCache } from './platform-modules';
export type { PlatformPath, PlatformFs, PlatformGlob } from './platform-modules';
export { detectEnvironment, loadConditionalModule, loadConditionalModuleSync, getPathSeparator, getCurrentDirectory, isDevelopment, isProduction, isTest, isBrowser, isNode, getEnvironmentName, getPlatformName, createLogger, hasFeature, assertFeature, warnMissingFeature, ENV, FEATURES } from './environment';
export type { EnvironmentInfo } from './environment';
export type { BrowserPath } from './browser-path';
export type { BrowserFileSystem } from './browser-fs';
export type { BrowserGlob } from './browser-glob';
export declare const loadModuleAsync: (modulePath: string) => Promise<any>;
export declare const normalizeModuleId: (id: string) => string;
export declare const isValidModuleId: (id: string) => boolean;
export declare const resolveModulePath: (baseDir: string, moduleId: string) => string;
export declare const getModulePackageName: (moduleId: string) => string;
export declare const hasPermission: (userPermissions: string[], requiredPermissions: string[]) => boolean;
export declare const hasRole: (userRoles: string[], requiredRoles: string[]) => boolean;
export declare const filterModulesByPermissions: <T extends {
permissions: string[];
}>(modules: T[], userPermissions: string[]) => T[];
export declare const filterModulesByRoles: <T extends {
roles?: string[];
}>(modules: T[], userRoles: string[]) => T[];
export declare const sortModulesByPriority: <T extends {
priority: number;
}>(modules: T[]) => T[];
export declare const sortModulesByName: <T extends {
name: string;
}>(modules: T[]) => T[];
export declare const groupModulesByCategory: <T extends {
category: string;
}>(modules: T[]) => Record<string, T[]>;
export declare const validateModuleId: (id: string) => {
valid: boolean;
error?: string;
};
export declare const resolveDependencies: <T extends {
id: string;
dependencies: string[];
}>(modules: T[]) => T[];
export declare class ModuleRegistryError extends Error {
readonly moduleId?: string | undefined;
readonly cause?: Error | undefined;
constructor(message: string, moduleId?: string | undefined, cause?: Error | undefined);
}
export declare class ModuleValidationError extends ModuleRegistryError {
readonly validationErrors?: Array<{
field: string;
message: string;
}> | undefined;
constructor(message: string, moduleId?: string, validationErrors?: Array<{
field: string;
message: string;
}> | undefined);
}
export declare class ModuleDiscoveryError extends ModuleRegistryError {
readonly source?: string | undefined;
constructor(message: string, source?: string | undefined, cause?: Error);
}
export declare const measurePerformance: <T>(operation: () => Promise<T>, label: string) => Promise<{
result: T;
duration: number;
}>;
export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => ((...args: Parameters<T>) => void);
export declare const throttle: <T extends (...args: any[]) => any>(func: T, limit: number) => ((...args: Parameters<T>) => void);
//# sourceMappingURL=index.d.ts.map