n8n
Version:
n8n Workflow Automation Tool
49 lines (48 loc) • 2.19 kB
TypeScript
import type { SharedCredentials, User } from '@n8n/db';
import { CredentialsEntity, CredentialsRepository, SharedCredentialsRepository } from '@n8n/db';
import type { CredentialSharingRole, ProjectRole, Scope } from '@n8n/permissions';
import type { EntityManager } from '@n8n/typeorm';
import { RoleService } from '../services/role.service';
export declare class CredentialsFinderService {
private readonly sharedCredentialsRepository;
private readonly credentialsRepository;
private readonly roleService;
constructor(sharedCredentialsRepository: SharedCredentialsRepository, credentialsRepository: CredentialsRepository, roleService: RoleService);
private fetchGlobalCredentials;
hasGlobalReadOnlyAccess(scopes: Scope[]): boolean;
findGlobalCredentialById(credentialId: string, relations?: {
shared: {
project: boolean;
};
}): Promise<CredentialsEntity | null>;
findCredentialById(credentialId: string): Promise<CredentialsEntity | null>;
private mergeAndDeduplicateCredentials;
findCredentialsForUser(user: User, scopes: Scope[]): Promise<CredentialsEntity[]>;
findCredentialForUser(credentialsId: string, user: User, scopes: Scope[]): Promise<CredentialsEntity | null>;
findAllCredentialsForUser(user: User, scopes: Scope[], trx?: EntityManager, options?: {
includeGlobalCredentials?: boolean;
}): Promise<{
projectId: string;
name: string;
data: string;
type: string;
shared: SharedCredentials[];
isManaged: boolean;
isGlobal: boolean;
isResolvable: boolean;
resolvableAllowFallback: boolean;
resolverId: string | null;
id: string;
generateId(): void;
createdAt: Date;
updatedAt: Date;
setUpdateDate(): void;
}[]>;
findCredentialIdsWithScopeForUser(credentialIds: string[], user: User, scopes: Scope[]): Promise<Set<string>>;
getCredentialIdsByUserAndRole(userIds: string[], options: {
scopes: Scope[];
} | {
projectRoles: ProjectRole[];
credentialRoles: CredentialSharingRole[];
}, trx?: EntityManager): Promise<string[]>;
}