UNPKG

n8n

Version:

n8n Workflow Automation Tool

122 lines (121 loc) 6.61 kB
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 { 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 sourceControlScopedService; private readonly eventService; private readonly sourceControlStatusService; private sshKeyName; private sshFolder; private gitFolder; constructor(logger: Logger, gitService: SourceControlGitService, sourceControlPreferencesService: SourceControlPreferencesService, sourceControlExportService: SourceControlExportService, sourceControlImportService: SourceControlImportService, sourceControlScopedService: SourceControlScopedService, eventService: EventService, sourceControlStatusService: SourceControlStatusService); init(): 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<{ type: "workflow" | "project" | "credential" | "file" | "tags" | "variables" | "folders"; status: "unknown" | "new" | "modified" | "deleted" | "created" | "renamed" | "conflicted" | "ignored" | "staged"; file: string; id: string; name: string; updatedAt: string; location: "local" | "remote"; conflict: boolean; pushed?: boolean | undefined; owner?: { type: "personal" | "team"; projectId: string; projectName: string; } | undefined; }[] | { wfRemoteVersionIds: import("./types/source-control-workflow-version-id").SourceControlWorkflowVersionId[]; wfLocalVersionIds: import("./types/source-control-workflow-version-id").SourceControlWorkflowVersionId[]; wfMissingInLocal: import("./types/source-control-workflow-version-id").SourceControlWorkflowVersionId[]; wfMissingInRemote: import("./types/source-control-workflow-version-id").SourceControlWorkflowVersionId[]; wfModifiedInEither: import("./types/source-control-workflow-version-id").SourceControlWorkflowVersionId[]; credMissingInLocal: import("./types/exportable-credential").StatusExportableCredential[]; credMissingInRemote: import("./types/exportable-credential").StatusExportableCredential[]; credModifiedInEither: import("./types/exportable-credential").StatusExportableCredential[]; varMissingInLocal: import("./types/exportable-variable").ExportableVariable[]; varMissingInRemote: import("@n8n/db").Variables[]; varModifiedInEither: import("./types/exportable-variable").ExportableVariable[]; tagsMissingInLocal: import("@n8n/db").TagEntity[]; tagsMissingInRemote: import("@n8n/db").TagEntity[]; tagsModifiedInEither: import("@n8n/db").TagEntity[]; mappingsMissingInLocal: import("@n8n/db").WorkflowTagMapping[]; mappingsMissingInRemote: import("@n8n/db").WorkflowTagMapping[]; foldersMissingInLocal: import("./types/exportable-folders").ExportableFolder[]; foldersMissingInRemote: import("./types/exportable-folders").ExportableFolder[]; foldersModifiedInEither: import("./types/exportable-folders").ExportableFolder[]; projectsRemote: import("./types/exportable-project").ExportableProjectWithFileName[]; projectsLocal: import("./types/exportable-project").ExportableProjectWithFileName[]; projectsMissingInLocal: import("./types/exportable-project").ExportableProjectWithFileName[]; projectsMissingInRemote: import("./types/exportable-project").ExportableProjectWithFileName[]; projectsModifiedInEither: import("./types/exportable-project").ExportableProjectWithFileName[]; sourceControlledFiles: { type: "workflow" | "project" | "credential" | "file" | "tags" | "variables" | "folders"; status: "unknown" | "new" | "modified" | "deleted" | "created" | "renamed" | "conflicted" | "ignored" | "staged"; file: string; id: string; name: string; updatedAt: string; location: "local" | "remote"; conflict: boolean; pushed?: boolean | undefined; owner?: { type: "personal" | "team"; projectId: string; projectName: string; } | undefined; }[]; }>; setGitUserDetails(name?: string, email?: string): Promise<void>; getRemoteFileEntity({ user, type, id, commit, }: { user: User; type: SourceControlledFile['type']; id?: string; commit?: string; }): Promise<IWorkflowToImport>; }