odata-active-record-core
Version:
Core Active Record implementation for OData - The easiest way to interact with OData APIs
79 lines • 2.35 kB
TypeScript
import { ActiveRecord } from './active-record';
import type { IEntitySchema, IDataTypeHandler, IEntityNamespace, IValidationResult } from 'odata-active-record-contracts';
/**
* EntityNamespace class - Manages a single namespace with multiple entities
* Provides complete isolation for entities within this namespace
*/
export declare class EntityNamespace implements IEntityNamespace {
private name;
private dataTypeHandler;
private entities;
private schemas;
constructor(name: string, dataTypeHandler: IDataTypeHandler);
/**
* Get the name of this namespace
*/
getName(): string;
/**
* Register an entity within this namespace
*/
registerEntity<T = Record<string, unknown>>(entityName: string, schema: IEntitySchema<T>): void;
/**
* Get an entity by name from this namespace
*/
getEntity<T = Record<string, unknown>>(entityName: string): ActiveRecord<T> | null;
/**
* Check if an entity exists in this namespace
*/
hasEntity(entityName: string): boolean;
/**
* Get the number of entities registered in this namespace
*/
getActiveRecordCount(): number;
/**
* List all entity names in this namespace
*/
listEntities(): string[];
/**
* Remove an entity from this namespace
*/
removeEntity(entityName: string): boolean;
/**
* Get all schemas in this namespace
*/
getSchemas(): Record<string, IEntitySchema>;
/**
* Validate that all entities in this namespace are compatible
*/
validateNamespace(): IValidationResult;
/**
* Get statistics about this namespace
*/
getNamespaceStats(): {
entityCount: number;
entities: string[];
isValid: boolean;
totalFields: number;
};
/**
* Get the data type handler used by this namespace
*/
getDataTypeHandler(): IDataTypeHandler;
/**
* Check if this namespace is empty
*/
isEmpty(): boolean;
/**
* Clear all entities from this namespace
*/
clear(): void;
/**
* Get a copy of all entities in this namespace
*/
getAllEntities(): Map<string, ActiveRecord>;
/**
* Check if this namespace has any validation issues
*/
hasValidationIssues(): boolean;
}
//# sourceMappingURL=entity-namespace.d.ts.map