n8n
Version:
n8n Workflow Automation Tool
92 lines (91 loc) • 4.4 kB
TypeScript
import type { PullWorkFolderRequestDto, PushWorkFolderRequestDto, SourceControlledFile } from '@n8n/api-types';
import { Logger } from '@n8n/backend-common';
import { type User } from '@n8n/db';
import type { PushResult } from 'simple-git';
import { SourceControlExportService } from './source-control-export.service.ee';
import { SourceControlGitService } from './source-control-git.service.ee';
import { SourceControlImportService } from './source-control-import.service.ee';
import { SourceControlPreferencesService } from './source-control-preferences.service.ee';
import { SourceControlContextFactory } from './source-control-context.factory';
import { SourceControlScopedService } from './source-control-scoped.service';
import { SourceControlStatusService } from './source-control-status.service.ee';
import type { ImportResult } from './types/import-result';
import type { SourceControlGetStatus } from './types/source-control-get-status';
import type { SourceControlPreferences } from './types/source-control-preferences';
import { EventService } from '../../events/event.service';
import { IWorkflowToImport } from '../../interfaces';
export declare class SourceControlService {
private readonly logger;
private gitService;
private sourceControlPreferencesService;
private sourceControlExportService;
private sourceControlImportService;
private sourceControlContextFactory;
private sourceControlScopedService;
private readonly eventService;
private readonly sourceControlStatusService;
private sshKeyName;
private sshFolder;
private gitFolder;
private isReloading;
constructor(logger: Logger, gitService: SourceControlGitService, sourceControlPreferencesService: SourceControlPreferencesService, sourceControlExportService: SourceControlExportService, sourceControlImportService: SourceControlImportService, sourceControlContextFactory: SourceControlContextFactory, sourceControlScopedService: SourceControlScopedService, eventService: EventService, sourceControlStatusService: SourceControlStatusService);
start(): Promise<void>;
private isHostKeyVerificationError;
private refreshServiceState;
reloadConfiguration(): Promise<void>;
private initGitService;
sanityCheck(): Promise<void>;
disconnect(options?: {
keepKeyPair?: boolean;
}): Promise<SourceControlPreferences>;
initializeRepository(preferences: SourceControlPreferences, user: User): Promise<{
branches: string[];
currentBranch: string;
}>;
getBranches(): Promise<{
branches: string[];
currentBranch: string;
}>;
setBranch(branch: string): Promise<{
branches: string[];
currentBranch: string;
}>;
resetWorkfolder(): Promise<ImportResult | undefined>;
pushWorkfolder(user: User, options: PushWorkFolderRequestDto): Promise<{
statusCode: number;
pushResult: PushResult | undefined;
statusResult: SourceControlledFile[];
}>;
pullWorkfolder(user: User, options: PullWorkFolderRequestDto): Promise<{
statusCode: number;
statusResult: SourceControlledFile[];
}>;
getStatus(user: User, options: SourceControlGetStatus): Promise<{
status: "unknown" | "new" | "modified" | "deleted" | "created" | "renamed" | "conflicted" | "ignored" | "staged";
type: "workflow" | "project" | "credential" | "tags" | "variables" | "file" | "folders" | "datatable";
id: string;
name: string;
updatedAt: string;
location: "local" | "remote";
file: string;
conflict: boolean;
pushed?: boolean | undefined;
isLocalPublished?: boolean | undefined;
isRemoteArchived?: boolean | undefined;
parentFolderId?: string | null | undefined;
folderPath?: string[] | undefined;
owner?: {
type: "personal" | "team";
projectId: string;
projectName: string;
} | undefined;
publishingError?: string | undefined;
}[] | import("./types/source-control-get-status").SourceControlGetStatusVerboseResult>;
setGitUserDetails(name?: string, email?: string): Promise<void>;
getRemoteFileEntity({ user, type, id, commit, }: {
user: User;
type: SourceControlledFile['type'];
id?: string;
commit?: string;
}): Promise<IWorkflowToImport>;
}