import { Connection } from 'typeorm'; import { IPluginConfig } from '@metad/server-common'; import { ConfigService } from '@metad/server-config'; import { IEmployee, IOrganization, IRole, ITenant, IUser } from '@metad/contracts'; export declare enum SeederTypeEnum { ALL = "all", DEFAULT = "default", TENANT = "tenant" } export declare class SeedDataService { protected readonly configService: ConfigService; connection: Connection; log: { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; }; organizations: IOrganization[]; defaultOrganization: IOrganization; tenant: ITenant; roles: IRole[]; superAdminUsers: IUser[]; defaultUsers: IUser[]; defaultCandidateUsers: IUser[]; defaultEmployees: IEmployee[]; adminUser: IUser; config: IPluginConfig; seedType: SeederTypeEnum; constructor(configService: ConfigService); /** * This config is applied only for `yarn seed:*` type calls because * that is when connection is created by this service itself. */ overrideDbConfig: { logging: boolean; logger: string; }; /** * Seed All Data */ runAllSeed(): Promise; /** * Seed Default Data */ runDefaultSeed(fromAPI: boolean): Promise; /** * Seed Tenant Data */ runTenantSeed(name: string): Promise; runTenantEmailTSeed(name: string): Promise; /** * Seed Default & Random Data */ excuteDemoSeed(): Promise; /** * Populate Database with Basic Default Data */ private seedBasicDefaultData; /** * Populate default data for default tenant */ private seedDefaultData; /** * Create a new Tenant and initialize the corresponding default data * * @param tenantName */ seedTenantDefaultData(tenantName: string): Promise; runRolePermissionsSeed(tenantName: string): Promise; /** * Cleans all the previous generate screenshots, reports etc */ protected cleanUpPreviousRuns(): Promise; /** * Create connection from database */ protected createConnection(): Promise; /** * Close connection from database */ protected closeConnection(): Promise; /** * Use this wrapper function for all seed functions which are not essential. * Essentials seeds are ONLY those which are required to start the UI/login */ tryExecute(name: string, p: Promise): Promise | Promise; /** * Retrieve entities metadata */ private getEntities; /** * Cleans all the entities * Removes all data from database */ private cleanAll; /** * Reset the database, truncate all tables (remove all data) */ private resetDatabase; private handleError; seedTenantMoreDefault(connection: Connection, tenant: ITenant): Promise; seedOrganizationDemo(connection: Connection, tenant: ITenant, organization: IOrganization): Promise; }