import { DeepPartial, SeederCollection, LogFn } from './common'; import { SeederCollectionReadingOptions, SeederConfig } from './config'; export * from './config'; export * from './helpers'; /** * Allows to seed database. It is a main Mongo Seeding class. */ export declare class Seeder { /** * Transformer functions for collections before data import. */ static Transformers: { replaceDocumentIdWithUnderscoreId: (collection: SeederCollection) => SeederCollection; setCreatedAtTimestamp: (collection: SeederCollection) => SeederCollection; setUpdatedAtTimestamp: (collection: SeederCollection) => SeederCollection; }; /** * Logger instance */ log: LogFn; /** * Configuration for seeding database. */ config: SeederConfig; /** * Constructs a new `Seeder` instance and loads configuration for data import. * * @param config Optional partial object with database seeding configuration. The object is merged with the default configuration object. To use all default settings, simply omit this parameter. */ constructor(config?: DeepPartial); /** * Populates collections and their documents from given path. * The path has to contain file structure described on https://github.com/pkosiec/mongo-seeding/blob/main/docs/import-data-definition.md. * * @param path File path * @param partialConfig Optional partial collection reading configuration object. It is merged with default configuration object. To use all default settings, simply omit this parameter. */ readCollectionsFromPath: (path: string, partialConfig?: DeepPartial | undefined) => SeederCollection[]; /** * Connects to a database and imports all collections. * * @param collections Array of collection definitions * @param partialConfig Optional partial configuration object. Ita allows to change the database seeding configuration for single data import. It is merged with default configuration object. To use the configuration provided in `Seeder` constructor, simply omit this parameter. */ import: (collections: SeederCollection[], partialConfig?: DeepPartial | undefined) => Promise; }