UNPKG

@entity-factory/core

Version:

Create entities on the fly for mocking and testing

23 lines (22 loc) 1.5 kB
import { Blueprint } from './blueprint/Blueprint'; import { BlueprintBuilder } from './blueprint/BlueprintBuilder'; import { EntityObjectType } from './common/EntityObjectType'; import { EntityFactoryExecutor } from './EntityFactoryExecutor'; import { EntityFactoryGeneratorMethod } from './EntityFactoryGeneratorMethod'; import { EntityFactoryOptions } from './EntityFactoryOptions'; import { EntityFactoryRegisterCallback } from './EntityFactoryRegisterCallback'; export declare class EntityFactory implements EntityFactoryExecutor { private readonly options; private readonly profiles; private readonly adapter; constructor(options?: EntityFactoryOptions); for(entity: string): BlueprintBuilder<Record<string, any>>; for<EntityType = any>(entity: string | EntityObjectType<EntityType>): BlueprintBuilder<EntityType>; gen<Entity = any>(count: EntityFactoryGeneratorMethod<Entity>): Promise<Entity>; gen<Entity = any>(count: 1, factoryMethod: EntityFactoryGeneratorMethod<Entity>): Promise<Entity>; gen<Entity = any>(count: number, factoryMethod: EntityFactoryGeneratorMethod<Entity>): Promise<Entity[]>; hasBlueprint(entity: EntityObjectType<any> | string): boolean; getProfile(entity: string): Blueprint<Record<string, any>, any, any>; getProfile<Entity>(entity: string | EntityObjectType<Entity>): Blueprint<Entity, any, any>; register<Entity>(fixture: Blueprint<Entity, any, any> | EntityFactoryRegisterCallback<Entity>): EntityFactory; }