import type { NodeTypeAvailabilityScope } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { TransactionRunner, type OperationContext } from '@n8n/db'; import { EventService } from '../../events/event.service'; import { LoadNodesAndCredentials } from '../../load-nodes-and-credentials'; import { CacheService } from '../../services/cache/cache.service'; import { TypeAvailabilityPolicyAttachmentRepository } from './database/repositories/type-availability-policy-attachment.repository'; import { TypeAvailabilityPolicyScopeRepository } from './database/repositories/type-availability-policy-scope.repository'; import { TypeAvailabilityPolicyRepository } from './database/repositories/type-availability-policy.repository'; import type { TypeAvailabilityPolicy } from './database/entities/type-availability-policy.entity'; import type { TypeAvailabilityPolicyScope } from './database/entities/type-availability-policy-scope.entity'; import { type ComposedVerdict } from './policy-evaluator'; import type { PolicyAction, PolicyAttachment, PolicyRule } from './policy-rule.types'; import { type ShadowWarning } from './policy-shadow-lint'; export declare const LOCAL_READ_MAX_ENTRIES = 512; export type AttachmentInput = { readonly policyId: string; readonly priority: number; readonly isFloor: boolean; }; export type EffectivePolicy = { readonly scopeId: string | null; readonly kind: string; readonly projectId: string | null; readonly defaultAction: PolicyAction; readonly version: number; readonly rules: readonly PolicyRule[]; readonly attachments: readonly PolicyAttachment[]; }; export type ComposedTypeVerdict = ComposedVerdict & { readonly name: string; }; export type ComposedTypeEvaluation = { readonly verdicts: ComposedTypeVerdict[]; readonly versions: Array<{ scope: NodeTypeAvailabilityScope; version: number; }>; }; type PolicyDocumentWrite = { readonly policy: TypeAvailabilityPolicy; readonly warnings: readonly ShadowWarning[]; }; export declare class TypeAvailabilityPolicyService { private readonly policyRepository; private readonly scopeRepository; private readonly attachmentRepository; private readonly transactionRunner; private readonly eventService; private readonly cacheService; private readonly loadNodesAndCredentials; private readonly logger; constructor(policyRepository: TypeAvailabilityPolicyRepository, scopeRepository: TypeAvailabilityPolicyScopeRepository, attachmentRepository: TypeAvailabilityPolicyAttachmentRepository, transactionRunner: TransactionRunner, eventService: EventService, cacheService: CacheService, loadNodesAndCredentials: LoadNodesAndCredentials, logger: Logger); private readonly localReads; private invalidations; private readonly repeatDeletes; getEffectivePolicy(kind: string, projectId: string | null, ctx?: OperationContext): Promise; setDefaultAction(kind: string, projectId: string | null, defaultAction: PolicyAction, expectedVersion: number, updatedBy: string): Promise; private createScopeOrConflict; createPolicyDocument(kind: string, rules: readonly PolicyRule[], updatedBy: string): Promise; updatePolicyDocument(kind: string, policyId: string, rules: readonly PolicyRule[], expectedVersion: number, updatedBy: string): Promise; deletePolicyDocument(kind: string, policyId: string, updatedBy: string): Promise; getPolicyDocument(kind: string, policyId: string): Promise; listPolicyDocuments(kind: string): Promise; listPolicyDocumentsPage(kind: string, offset: number, limit: number): Promise<{ items: TypeAvailabilityPolicy[]; count: number; }>; replaceAttachments(scopeId: string, attachments: readonly AttachmentInput[], updatedBy: string): Promise<{ attachments: readonly PolicyAttachment[]; version: number; }>; setEffectivePolicy(kind: string, projectId: string | null, input: { rules: readonly PolicyRule[]; defaultAction: PolicyAction; }, expectedVersion: number, updatedBy: string): Promise<{ scopeId: string; defaultAction: PolicyAction; version: number; rules: PolicyRule[]; warnings: readonly ShadowWarning[]; }>; evaluateComposedType(kind: string, projectId: string, typeName: string): Promise; evaluateComposedTypes(kind: string, projectId: string, typeNames: readonly string[]): Promise; evaluateComposedTypesFor(kind: string, projectId: string | null, typeNames: readonly string[]): Promise; private readComposedScopes; private readEffectivePolicyCached; private readScope; private canPublish; resetLocalCaches(): void; private invalidateScopes; private dropCacheKeys; } export {};