import { ImportConfig } from '../types'; import { backupHandler as defaultBackupHandler, setupBranchConfig as defaultSetupBranchConfig } from '../utils'; import { ContentstackClient, log as defaultLog, handleAndLogError as defaultHandleAndLogError } from '@contentstack/cli-utilities'; /** * Dependencies for ImportSetup - can be injected for testing */ export interface ImportSetupDeps { backupHandler?: typeof defaultBackupHandler; setupBranchConfig?: typeof defaultSetupBranchConfig; log?: typeof defaultLog; handleAndLogError?: typeof defaultHandleAndLogError; } export default class ImportSetup { protected config: ImportConfig; private readonly managementAPIClient; private readonly importConfig; private readonly stackAPIClient; dependencyTree: { [key: string]: string[]; }; private readonly backupHandler; private readonly setupBranchConfig; private readonly log; private readonly handleAndLogError; constructor(config: ImportConfig, managementAPIClient: ContentstackClient, deps?: ImportSetupDeps); /** * Generate mapper logic * This method generates dependency tree based on the selected modules * @returns {Promise>} */ protected generateDependencyTree(): Promise; /** * Run module imports based on the selected modules * This method dynamically imports modules based on the selected modules * and runs the start method of each module * @returns {Promise} */ protected runModuleImports(): Promise; /** * Start the import setup process * This method generates mapper logic and runs module imports * based on the selected modules * @returns {Promise} */ start(): Promise; }