n8n
Version:
n8n Workflow Automation Tool
59 lines (58 loc) • 2.74 kB
TypeScript
import type { User, WorkflowEntity } from '@n8n/db';
import { SharedWorkflowRepository, FolderRepository, WorkflowRepository } from '@n8n/db';
import { type Scope } from '@n8n/permissions';
import type { EntityManager } from '@n8n/typeorm';
import { RoleService } from '../services/role.service';
export type FindWorkflowsForUserOptions = {
filters?: {
name?: string;
active?: boolean;
tagNames?: string[];
folderId?: string;
projectId?: string;
};
offset?: number;
limit?: number;
includePinnedData?: boolean;
includeTags?: boolean;
includeProjects?: boolean;
includeActiveVersion?: boolean;
};
export declare class WorkflowFinderService {
private readonly sharedWorkflowRepository;
private readonly folderRepository;
private readonly roleService;
private readonly workflowRepository;
constructor(sharedWorkflowRepository: SharedWorkflowRepository, folderRepository: FolderRepository, roleService: RoleService, workflowRepository: WorkflowRepository);
findWorkflowForUser(workflowId: string, user: User, scopes: Scope[], options?: {
includeTags?: boolean;
includeParentFolder?: boolean;
includeActiveVersion?: boolean;
em?: EntityManager;
}): Promise<WorkflowEntity | null>;
findWorkflowHeadForUser(workflowId: string, user: User, scopes: Scope[]): Promise<{
versionId: string;
updatedAt: Date;
} | null>;
private buildSingleWorkflowReadWhere;
private findAllWhere;
findWorkflowIdsWithScopeForUser(workflowIds: string[], user: User, scopes: Scope[]): Promise<Set<string>>;
findExistingWorkflowIds(workflowIds: string[]): Promise<Set<string>>;
findWorkflowsByIdsForUser(workflowIds: string[], user: User, scopes: Scope[], options?: {
includeParentFolder?: boolean;
includeTags?: boolean;
}): Promise<WorkflowEntity[]>;
findWorkflowIdsByFolder(folderIds: string[]): Promise<Map<string, string[]>>;
findRootWorkflowIdsInProject(projectId: string): Promise<string[]>;
findOwnedWorkflowsBySourceWorkflowIds(projectId: string, sourceWorkflowIds: string[], options?: {
includeActiveVersion?: boolean;
includeParentFolder?: boolean;
}): Promise<WorkflowEntity[]>;
hasProjectScopeForUser(user: User, scopes: Scope[], projectId: string): Promise<boolean>;
findProjectIdForFolder(folderId: string): Promise<string | null>;
findAllWorkflowIdsForUser(user: User, scopes: Scope[], folderId?: string, projectId?: string): Promise<string[]>;
findWorkflowsForUser(user: User, scopes: Scope[], options?: FindWorkflowsForUserOptions): Promise<{
workflows: WorkflowEntity[];
count: number;
}>;
}