import { METADATA_TYPE } from './../Constants'; import { IPropertyOptions } from './../options/IPropertyOptions'; import { IEntityRef } from '../../api/IEntityRef'; import { IClassRef } from '../../api/IClassRef'; import { DefaultPropertyRef } from './DefaultPropertyRef'; import { IEntityOptions } from '../options/IEntityOptions'; import { DefaultEntityRef } from './DefaultEntityRef'; import { ISchemaOptions } from '../options/ISchemaOptions'; import { IObjectOptions } from '../options/IObjectOptions'; import { ISchemaRef } from '../../api/ISchemaRef'; import { SchemaRef } from '../SchemaRef'; import { AbstractRegistry } from './AbstractRegistry'; import { IAbstractOptions } from '../options/IAbstractOptions'; import { IRegistryOptions } from './IRegistryOptions'; /** * Registry which handles by default class, schema, embeddalbes and properties, which are not handled by a specialized registry. * * This is a space for entities and their relations, which are grouped by a give "namespace" context. * * How entities are passed to the registry: * * 1. by annotations at startup (event from metadata registry) * - properties are appended first by annotation then entities follow * 2. by call for getEntityRefFor * 3. append during runtime by event fired through metadata registry * 4. append through reload method * */ export declare class DefaultNamespacedRegistry extends AbstractRegistry { private drained; constructor(namespace: string, options?: IRegistryOptions); /** * Initialize events for metadata changes on runtime */ prepare(): void; ready(timeout?: number): Promise; /** * Apply already added entries to the metadata registry can be added to this registry */ drainAlreadyAdded(): void; onMetadataAdd(context: METADATA_TYPE, options: IEntityOptions | IPropertyOptions | ISchemaOptions | IObjectOptions): Promise; onMetadataUpdate(context: METADATA_TYPE, options: IEntityOptions | IPropertyOptions | ISchemaOptions | IObjectOptions): Promise; onMetadataRemove(context: METADATA_TYPE, options: (IEntityOptions | IPropertyOptions | ISchemaOptions | IObjectOptions)[]): Promise; /** * Check if object has the correct namespace for this registry handle * * @param options */ validNamespace(options: IAbstractOptions): boolean; /** * react on dynamically added context * * @param context * @param entries */ onAdd(context: METADATA_TYPE, options: IEntityOptions | IPropertyOptions | ISchemaOptions | IObjectOptions): void; getOrCreateSchemaRefByName(options: ISchemaOptions): ISchemaRef; addSchemaToEntityRef(schemaRef: string | ISchemaRef, entityRef: IEntityRef, options?: { override?: boolean; onlyDefault?: boolean; }): void; /** * react on dynamically removed context * * @param context * @param entries */ onRemove(context: METADATA_TYPE, entries: (IEntityOptions | IPropertyOptions | ISchemaOptions | IObjectOptions)[]): void; /** * react on dynamically update context * * @param context * @param entries */ onUpdate(context: METADATA_TYPE, options: IEntityOptions | IPropertyOptions | ISchemaOptions | IObjectOptions): void; /** * Return all registered schema references * * @param ref * @return ISchemaRef[] */ getSchemaRefs(filter?: (x: ISchemaRef) => boolean): SchemaRef[]; /** * Return schema references for an given entity or class reference * * @param ref * @return ISchemaRef[] */ getSchemaRefsFor(ref: string): SchemaRef; /** * TODO * * @param filter */ getEntities(filter?: (x: IEntityRef) => boolean): IEntityRef[]; /** * Can get get entity ref for function. * * @param fn */ getEntityRefFor(fn: string | object | Function, skipNsCheck?: boolean): DefaultEntityRef; /** * Returns property by name for a given class or entity ref * * @param filter */ getPropertyRef(ref: IClassRef | IEntityRef, name: string): DefaultPropertyRef; /** * Returns all properties for given class or entity ref * * @param ref */ getPropertyRefs(ref: IClassRef | IEntityRef): DefaultPropertyRef[]; /** * Create properties for class or entity ref. */ createPropertiesForRef(clsRef: IClassRef): DefaultPropertyRef[]; /** * Create default property reference * * @param options */ createPropertyForOptions(options: IPropertyOptions): DefaultPropertyRef; /** * Create default entity reference * * @param options */ createEntityForOptions(options: IEntityOptions): DefaultEntityRef; /** * Create default entity reference * * @param options */ createEmbeddableForOptions(options: IObjectOptions): IClassRef; /** * Create default schema reference * * @param options */ createSchemaForOptions(options: ISchemaOptions): SchemaRef; /** * Return metadata collected in the MetadataRegistry through annotation or explizit attached data. * * @param context * @param target * @return IAbstractOptions */ getMetadata(context: METADATA_TYPE, target: Function | string, propertyName?: string): IAbstractOptions; getPropertyRefsFor(fn: string | object | Function): DefaultPropertyRef[]; create(context: string, options: IAbstractOptions): T; /** * TODO */ add(context: string, entry: T): T; /** * Create default entity reference * * @param options */ addClassRef(ref: IClassRef): IClassRef; getClassRefFor(object: string | Function | IClassRef, type: METADATA_TYPE): IClassRef; reset(): void; }