n8n
Version:
n8n Workflow Automation Tool
43 lines (42 loc) • 2.6 kB
TypeScript
import { Logger } from '@n8n/backend-common';
import type { IWorkflowDb } from '@n8n/db';
import { CredentialsRepository, TagRepository, WorkflowPublishHistoryRepository } from '@n8n/db';
import { DataSource, EntityManager } from '@n8n/typeorm';
import { type IWorkflowBase } from 'n8n-workflow';
import { Cipher } from 'n8n-core';
import { ActiveWorkflowManager } from '../active-workflow-manager';
import { WorkflowIndexService } from '../modules/workflow-index/workflow-index.service';
import { DatabaseConfig } from '@n8n/config';
export declare class ImportService {
private readonly logger;
private readonly credentialsRepository;
private readonly tagRepository;
private readonly dataSource;
private readonly cipher;
private readonly activeWorkflowManager;
private readonly workflowIndexService;
private readonly databaseConfig;
private readonly workflowPublishHistoryRepository;
private dbCredentials;
private dbTags;
private foreignKeyCommands;
constructor(logger: Logger, credentialsRepository: CredentialsRepository, tagRepository: TagRepository, dataSource: DataSource, cipher: Cipher, activeWorkflowManager: ActiveWorkflowManager, workflowIndexService: WorkflowIndexService, databaseConfig: DatabaseConfig, workflowPublishHistoryRepository: WorkflowPublishHistoryRepository);
initRecords(): Promise<void>;
importWorkflows(workflows: IWorkflowDb[], projectId: string): Promise<void>;
replaceInvalidCreds(workflow: IWorkflowBase): Promise<void>;
isTableEmpty(tableName: string): Promise<boolean>;
areAllEntityTablesEmpty(tableNames: string[]): Promise<boolean>;
truncateEntityTable(tableName: string, transactionManager: EntityManager): Promise<void>;
getImportMetadata(inputDir: string): Promise<{
tableNames: string[];
entityFiles: Record<string, string[]>;
}>;
readEntityFile(filePath: string, customEncryptionKey?: string): Promise<Array<Record<string, unknown>>>;
private decompressEntitiesZip;
importEntities(inputDir: string, truncateTables: boolean, keyFilePath?: string): Promise<void>;
importEntitiesFromFiles(inputDir: string, transactionManager: EntityManager, entityNames: string[], entityFiles: Record<string, string[]>, customEncryptionKey?: string): Promise<void>;
private toNewCredentialFormat;
disableForeignKeyConstraints(transactionManager: EntityManager): Promise<void>;
enableForeignKeyConstraints(transactionManager: EntityManager): Promise<void>;
validateMigrations(inputDir: string, customEncryptionKey?: string): Promise<void>;
}