import { type Scope, type WorkflowSharingRole } from '@n8n/permissions'; import { DataSource } from '@n8n/typeorm'; import type { EntityManager, FindManyOptions, FindOptionsWhere, SelectQueryBuilder } from '@n8n/typeorm'; import { BaseRepository } from './base-repository'; import { type PublishHistoryScope, WorkflowPublishHistoryRepository } from './workflow-publish-history.repository'; import type { User } from '../entities'; import { Project, SharedWorkflow } from '../entities'; import { type OperationContext, TransactionRunner } from '../services/transaction'; export declare class SharedWorkflowRepository extends BaseRepository { private readonly workflowPublishHistoryRepository; constructor(dataSource: DataSource, transactionRunner: TransactionRunner, workflowPublishHistoryRepository: WorkflowPublishHistoryRepository); findWorkflowIdsForGlobalAccess(projectId?: string): Promise; findWorkflowIdsAccessibleToUser({ userId, workflowRoleSlugs, projectRoleSlugs, projectId, }: { userId: string; workflowRoleSlugs: string[]; projectRoleSlugs: string[]; projectId?: string; }): Promise; findWorkflowIdsSharedWithUser(userId: string): Promise; findOwnedWorkflowIdsInPersonalProject(userId: string): Promise; findOwnedWorkflowRemovalCandidates(projectId: string, workflowIds: string[], options?: { includeArchived?: boolean; }): Promise>; findWorkflowIdsInUserProjects(workflowIds: string[], userId: string, projectRoleSlugs: string[]): Promise>; findOwnedWorkflowIdsByProjects(projectIds: string[]): Promise; findOwnerProjectsByWorkflowIds(workflowIds: string[]): Promise>; findSharingRole(userId: string, workflowId: string): Promise; makeOwnerOfAllWorkflows(project: Project): Promise; makeOwner(workflowIds: string[], projectId: string, trx?: EntityManager): Promise; findWithFields(workflowIds: string[], { select }: Pick, 'select'>): Promise; deleteByIds(sharedWorkflowIds: string[], projectId: string, trx?: EntityManager): Promise; findProjectIds(workflowId: string): Promise; findTeamProjectIds(workflowId: string): Promise; findProjectIdsByRole(workflowId: string, roles: string[]): Promise; getWorkflowOwningProject(workflowId: string, ctx?: OperationContext): Promise; getRelationsByWorkflowIdsAndProjectIds(workflowIds: string[], projectIds: string[]): Promise; getAllRelationsForWorkflows(workflowIds: string[]): Promise; getSharedPersonalWorkflowsCount(): Promise; findWorkflowWithOptions(workflowId: string, options?: { where?: FindOptionsWhere; includeTags?: boolean; includeParentFolder?: boolean; includeActiveVersion?: boolean; publishHistory?: PublishHistoryScope; } & ({ em?: EntityManager; ctx?: never; } | { ctx?: OperationContext; em?: never; })): Promise; buildSharedWorkflowIdsSubquery(user: User, sharingOptions: { scopes?: Scope[]; globalScopes?: Scope[]; projectRoles?: string[]; workflowRoles?: string[]; isPersonalProject?: boolean; personalProjectOwnerId?: string; onlySharedWithMe?: boolean; projectId?: string; }): SelectQueryBuilder; }