# @embedpdf/plugin-redaction — ./internal RedactionAction [TypeAliasDeclaration] (from packages/plugin/redaction/src/model.ts): export type RedactionAction = |{ type: 'APPLY_STARTED'} |{ type: 'APPLY_FINISHED'; result: RedactionApplyResult | null} ; RedactionAppliedEvent [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionAppliedEvent{ readonly result: RedactionApplyResult; readonly origin: ChangeOrigin; } RedactionApplyResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/RedactionApplyResult.ts): export interface RedactionApplyResult{ scope: RedactionApplyScope; results: RedactionApplyItemResult[]; removedAnnotationCount: number; meta: MutationMeta | null; } RedactionCapability [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionCapability{ canMark(): boolean; canApply(): boolean; isApplying(): boolean; getLastResult(): RedactionApplyResult | null; listPending(filter?: RedactionMarkFilter): readonly RedactionMark[]; getPending(ref: AnnotationRef): RedactionMark | null; getPendingCount(page?: PageRef): number; estimateCollateral(refs?: readonly AnnotationRef[]): RedactionCollateral; markSelection(options?: OperationOptions): Promise; markArea(page: PageRef, bounds: Rect, options?: OperationOptions): Promise; markPage(page: PageRef, options?: OperationOptions): Promise; markMatches( query: SearchQuery, options?:{ pages?: readonly PageRef[]} & OperationOptions, ): Promise; unmark( refs: readonly AnnotationRef[], options?: OperationOptions, ): Promise>; clearPending(options?: OperationOptions): Promise>; updateLabel( ref: AnnotationRef, patch: RedactionLabelPatch, options?: OperationOptions, ): Promise; apply(refs: readonly AnnotationRef[], options?: OperationOptions): Promise; applyAll(options?: OperationOptions): Promise; applyPages(pages: readonly PageRef[], options?: OperationOptions): Promise; readonly onApplied: EventHook; readonly onPendingChanged: EventHook; } RedactionCollateral [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionCollateral{ readonly count: number; readonly refs: readonly AnnotationRef[]; } RedactionConfig [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionConfig{ overlay?:{ fill?: string; text?:{ color?: string; fontFamily?: string; fontSize?: number; } ; } ; } RedactionHostCapability [TypeAliasDeclaration] (from packages/plugin/redaction/src/host-contract.ts): export type RedactionHostCapability = RedactionCapability; RedactionLabelPatch [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionLabelPatch{ overlayText?: string | null; repeat?: boolean; } RedactionMark [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionMark{ readonly ref: AnnotationRef; readonly page: PageRef; readonly pageIndex: number; readonly kind: 'area' | 'text'; readonly bounds: Rect; readonly overlayText: string | null; } RedactionMarkFilter [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionMarkFilter{ readonly page?: PageRef; } RedactionPendingChangedEvent [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionPendingChangedEvent{ readonly pages: readonly PageRef[]; } RedactionState [InterfaceDeclaration] (from packages/plugin/redaction/src/model.ts): export interface RedactionState{ applying: boolean; lastResult: RedactionApplyResult | null; } RedactionToken [VariableDeclaration] (from packages/plugin/redaction/src/token.ts): RedactionToken = createCapabilityToken('redaction', { hint: `add redactionPlugin() from '@embedpdf/plugin-redaction' to your plugins list`, } ) createRedactionCapability [FunctionDeclaration] (from packages/plugin/redaction/src/controller.ts): export function createRedactionCapability( ctx: RedactionContext, config: RedactionConfig ={ } , ): RedactionHostCapability{ const{ api, connect} = createRedactionController(ctx, config); connect(); return api; } createRedactionController [FunctionDeclaration] (from packages/plugin/redaction/src/controller.ts): export function createRedactionController( ctx: RedactionContext, config: RedactionConfig ={ } , ):{ api: RedactionHostCapability; connect(): void} { const services = createServices(ctx); const{ events, store, siblings} = services; const pending = createPendingReads(services); const marking = createMarking(ctx, services, config, pending); const applying = createApplying(ctx, services, pending); const api = composeApi('redaction', [ pending.api, marking.api, applying.api, { canMark: () => siblings.annotation.canCreate(), canApply: store.canApply, isApplying: () => store.state().applying, getLastResult: () => store.state().lastResult, onApplied: events.applied.on, onPendingChanged: events.pendingChanged.on, } , ]) satisfies RedactionHostCapability; return{ api, connect(){ subscribeChanges(ctx, services); } , } ; } initialRedactionState [VariableDeclaration] (from packages/plugin/redaction/src/model.ts): initialRedactionState = (): RedactionState => ({ applying: false, lastResult: null, } ) redactionReducer [VariableDeclaration] (from packages/plugin/redaction/src/model.ts): redactionReducer = ( state: RedactionState, action: RedactionAction, ): RedactionState =>{ switch (action.type){ case 'APPLY_STARTED': return{ ...state, applying: true} ; case 'APPLY_FINISHED': return{ applying: false, lastResult: action.result ?? state.lastResult} ; default: return state; } }