n8n
Version:
n8n Workflow Automation Tool
51 lines (50 loc) • 3.31 kB
TypeScript
import { Logger } from '@n8n/backend-common';
import { CredentialsRepository, TagRepository, WorkflowPublishHistoryRepository, WorkflowRepository } 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 type { IWorkflowWithVersionMetadata } from '../interfaces';
import { WorkflowIndexService } from '../modules/workflow-index/workflow-index.service';
import { DataTableDDLService } from '../modules/data-table/data-table-ddl.service';
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 dataTableDDLService;
private readonly workflowRepository;
private readonly workflowPublishHistoryRepository;
private dbCredentials;
private dbTags;
private foreignKeyCommands;
constructor(logger: Logger, credentialsRepository: CredentialsRepository, tagRepository: TagRepository, dataSource: DataSource, cipher: Cipher, activeWorkflowManager: ActiveWorkflowManager, workflowIndexService: WorkflowIndexService, dataTableDDLService: DataTableDDLService, workflowRepository: WorkflowRepository, workflowPublishHistoryRepository: WorkflowPublishHistoryRepository);
initRecords(): Promise<void>;
importWorkflows(workflows: IWorkflowWithVersionMetadata[], projectId: string, { activeState }?: {
activeState?: 'false' | 'fromJson';
}): Promise<void>;
private activateWorkflow;
replaceInvalidCreds(workflow: IWorkflowBase, projectId: string): 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, skipMigrationChecks?: boolean, skipTogglingForeignKeyConstraints?: boolean): Promise<void>;
importEntitiesFromFiles(inputDir: string, transactionManager: EntityManager, entityNames: string[], entityFiles: Record<string, string[]>, customEncryptionKey?: string): Promise<void>;
private toNewCredentialFormat;
private normalizeEntityJsonColumns;
dropExistingDataTableUserTables(transactionManager: EntityManager): Promise<void>;
recreateDataTableUserTablesFromRegistry(transactionManager: EntityManager): Promise<void>;
advanceIdentitySequences(transactionManager: EntityManager, tableNames: string[]): Promise<void>;
disableForeignKeyConstraints(transactionManager: EntityManager): Promise<void>;
enableForeignKeyConstraints(transactionManager: EntityManager): Promise<void>;
validateMigrations(inputDir: string, customEncryptionKey?: string): Promise<void>;
}