# @embedpdf/plugin-actions — ./internal ActionContext [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionContext{ origin: ActionOrigin; source: ActionSource; event: ActionTriggerEvent; } ActionDiagnostic [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionDiagnostic{ code: | 'incomplete-tree' | 'blocked' | 'no-executor' | 'no-adapter' | 'no-session-sink' | 'unresolved-target' | 'duplicate-executor' | 'executor-inert' | 'executor-failed' | 'trigger-disabled' | 'no-commit-sink' | 'trigger-failed' | 'cascade-budget' | 'open-sequence-replayed' | 'no-submit-sink' | 'no-submit-resolver' | 'submit-payload-unavailable' | 'submit-entry-unsupported' | 'reentrant-print'; message: string; } ActionDispatchEvent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionDispatchEvent{ ctx: ActionContext; tree: PdfActionTree; result: ActionDispatchResult; } ActionDispatchResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionDispatchResult{ status: 'executed' | 'partial' | 'inert' | 'refused'; nodes: ActionNodeResult[]; diagnostics: ActionDiagnostic[]; } ActionExecutor [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionExecutor = ( node: PdfActionNode, ctx: ActionContext, ) => Promise | ActionExecutorResult; ActionExecutorResult [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionExecutorResult = |{ status: 'executed'} |{ status: 'inert'; reason: string} |{ status: 'failed'; error: string} ; ActionNodeResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionNodeResult{ path: number[]; type: PdfActionType; status: ActionNodeStatus; detail?: string; } ActionNodeStatus [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionNodeStatus = | 'executed' | 'blocked' | 'no-executor' | 'inert' | 'failed' | 'skipped'; ActionOrigin [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionOrigin = 'user' | 'hover' | 'lifecycle'; ActionPolicy [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionPolicy{ goto: ActionPolicyRow; named: ActionPolicyRow; hide: ActionPolicyRow; 'reset-form': ActionPolicyRow; javascript: ActionPolicyRow; uri: ActionPolicyRow; print: ActionPolicyRow; 'submit-form': ActionPolicyRow; } ActionPolicyDecision [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionPolicyDecision = 'allow' | 'adapter' | 'report' | 'block'; ActionPolicyPatch [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionPolicyPatch ={ readonly [K in keyof ActionPolicy]?: Partial} ; ActionPolicyRow [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionPolicyRow = Record; ActionSource [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionSource = |{ kind: 'widget'; field: FormFieldRef; annotation: AnnotationRef; page: PageRef} |{ kind: 'link'; annotation?: AnnotationRef; page?: PageRef} |{ kind: 'annotation'; annotation: AnnotationRef; page: PageRef} |{ kind: 'page'; page: PageRef} |{ kind: 'document'} |{ kind: 'api'} ; ActionStepResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionStepResult{ source: ActionSource; tree: PdfActionTree; result: ActionDispatchResult; } ActionSubmitHandler [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionSubmitHandler = ( request: ActionSubmitRequest, ctx:{ submitToDocumentHome: (() => Promise) | null} , ) => void | Promise; ActionSubmitRequest [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionSubmitRequest{ url: string | null; method: 'post' | 'get'; format: 'fdf' | 'html' | 'xfdf' | 'pdf'; flagsRaw: number; charSet?: string; entries: FormSubmissionEntry[]; origin: ActionOrigin; event: ActionTriggerEvent; } ActionTreeSource [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionTreeSource = |{ kind: 'annotation'; annotation: AnnotationRef; page: PageRef; event?: 'activate' | PdfAnnotationEventKind; } |{ kind: 'field'; field: FormFieldRef; event: PdfFieldEventKind} |{ kind: 'page'; page: PageRef; event?: 'open' | 'close'} |{ kind: 'document'; event?: DocumentTriggerEvent} ; ActionTrigger [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionTrigger = |{ scope: 'activate'; ref: AnnotationRef; page: PageRef; source?: ActionSource} |{ scope: 'annotation'; event: PdfAnnotationEventKind; ref: AnnotationRef; page: PageRef; source?: ActionSource; } |{ scope: 'page'; event: 'open' | 'close' | 'visible' | 'invisible'; page: PageRef} |{ scope: 'document'; event: DocumentTriggerEvent} ; ActionTriggerEvent [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionTriggerEvent = |{ scope: 'activate'} |{ scope: 'annotation'; name: PdfAnnotationEventKind} |{ scope: 'page'; name: 'open' | 'close' | 'visible' | 'invisible'} |{ scope: 'document'; name: DocumentTriggerEvent} ; ActionTriggerResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionTriggerResult{ status: 'executed' | 'partial' | 'inert' | 'refused'; steps: ActionStepResult[]; diagnostics: ActionDiagnostic[]; } ActionUiAdapter [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionUiAdapter{ openUri(uri: string, opts:{ isMap: boolean; origin: ActionOrigin} ): void; print(opts?: ActionUiContext): void; alert?(message: string, opts: ActionUiContext &{ icon: number; title?: string} ): void; gotoPage?(page: number, opts: ActionUiContext): void; } ActionUiContext [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionUiContext{ origin: ActionOrigin; phase: 'boot' | 'user'; } ActionsAction [TypeAliasDeclaration] (from packages/plugin/actions/src/model.ts): export type ActionsAction ={ type: 'ACTIONS_DISPATCHED'} |{ type: 'ACTIONS_POLICY_CHANGED'} ; ActionsCapability [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionsCapability{ execute(tree: PdfActionTree, ctx: ActionContext): Promise; canExecute(tree: PdfActionTree, ctx: ActionContext): boolean; executeNamed( name: PdfNamedAction, context?: Partial, ): Promise; getActionTree(source: ActionTreeSource): Promise; getPolicy(): ActionPolicy; updatePolicy(patch: ActionPolicyPatch): void; isScriptingEnabled(): boolean; dispatch(trigger: ActionTrigger): Promise; canDispatch(trigger: ActionTrigger): boolean; setUiAdapter(adapter: ActionUiAdapter | null): Unsubscribe; runDocumentVerb(verb: 'save' | 'print', operation: () => Promise | T): Promise; prepareClose(): Promise; setSubmitHandler(handler: ActionSubmitHandler | null): Unsubscribe; registerExecutor(type: PdfActionType, executor: ActionExecutor): Unsubscribe; onExecuted: EventHook; onDiagnostic: EventHook; onScriptDiagnostic: EventHook; onScriptError: EventHook; onOpenSequenceCompleted: EventHook; } ActionsConfig [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionsConfig{ policy?: ActionPolicyPatch; triggers?:{ document?: boolean; page?: boolean; annotation?: boolean} ; openSequence?: 'auto' | 'headless' | 'off'; javascript?:{ enabled: boolean; sandboxFactory?: ScriptSandboxFactory; identity?: Partial | (() => Partial); fileName?: () => string; now?: () => number; utcOffsetMinutes?: () => number; randomSeed?: () => number; budget?: ScriptBudget; maxScriptNodesPerDispatch?: number; } ; } ActionsHostCapability [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface ActionsHostCapability extends ActionsCapability{ registerAnnotCommitSink(sink: AnnotCommitSink): Unsubscribe; registerFormCommitSink(sink: FormCommitSink): Unsubscribe; scriptRealm?: ScriptRealmPort; createDetachedScriptRealm?(target: ScriptRealmTarget): DetachedScriptRealm; surfaceScriptResult(result: ScriptSurfaceResult): void; surfaceScriptCommit( commit: ScriptCommitSurface, context:{ origin: ActionOrigin; realm: ScriptRealmKind} , ): void; reportPageState(report: PageStateReport): void; registerSubmitResolver(resolver: SubmitResolver): Unsubscribe; } ActionsState [InterfaceDeclaration] (from packages/plugin/actions/src/model.ts): export interface ActionsState{ seq: number; policyRevision: number; } ActionsToken [VariableDeclaration] (from packages/plugin/actions/src/host-contract.ts): ActionsToken = PublicActionsToken as unknown as CapabilityToken AnnotCommitEntry [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface AnnotCommitEntry{ annotObjectNumber: number; page?: PageRef; patch: ScriptAnnotEffect['patch']; } AnnotCommitResult [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface AnnotCommitResult{ results: Array<{ annotObjectNumber: number; status: 'applied' | 'failed' | 'skipped'; error?: string; } >; } AnnotCommitSink [TypeAliasDeclaration] (from packages/plugin/actions/src/host-contract.ts): export type AnnotCommitSink = (entries: AnnotCommitEntry[]) => Promise; DetachedScriptRealm [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface DetachedScriptRealm extends ScriptRealmPort{ dispose(): void; } DocumentTriggerEvent [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type DocumentTriggerEvent = | 'open' | 'will-save' | 'did-save' | 'will-print' | 'did-print' | 'will-close'; FormCommitSink [TypeAliasDeclaration] (from packages/plugin/actions/src/host-contract.ts): export type FormCommitSink = (effects: FormEffect[]) => Promise; HoverPump [InterfaceDeclaration] (from packages/plugin/actions/src/hover-pump.ts): export interface HoverPump{ hover(target: HoverTarget | null): void; reset(): void; } HoverTarget [InterfaceDeclaration] (from packages/plugin/actions/src/hover-pump.ts): export interface HoverTarget{ ref: AnnotationRef; page: PageRef; source?: ActionSource; events?:{ enter?: boolean; exit?: boolean} ; } OpenSequenceCompletedEvent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface OpenSequenceCompletedEvent{ readonly result: ActionTriggerResult; } PageStateReport [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface PageStateReport{ currentPage: PageRef | null; visiblePages: readonly PageRef[]; placed: boolean; cause: 'user' | 'programmatic'; } PdfAnnotationEventKind [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type PdfAnnotationEventKind = | 'cursorEnter' | 'cursorExit' | 'mouseDown' | 'mouseUp' | 'focus' | 'blur'; PdfFieldEventKind [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type PdfFieldEventKind = 'keystroke' | 'format' | 'validate' | 'calculate'; PdfNamedAction [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type PdfNamedAction = | 'NextPage' | 'PrevPage' | 'FirstPage' | 'LastPage' | 'Print' | (string &{ } ); ScriptCommitSurface [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface ScriptCommitSurface{ uiEffects: Array; diagnostics: ScriptDiagnostic[]; error?: ScriptExecutionError; } ScriptRealmKind [TypeAliasDeclaration] (from packages/plugin/actions/src/host-contract.ts): export type ScriptRealmKind = 'document' | 'detached'; ScriptRealmPort [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface ScriptRealmPort{ transaction(body: (txn: ScriptTransaction) => Promise): Promise; budget: ScriptBudget; } ScriptRealmTarget [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface ScriptRealmTarget{ doc: DocumentHandle; document(): DocumentMeta | null; bootSources(): Promise; } ScriptSurfaceResult [InterfaceDeclaration] (from packages/plugin/actions/src/host-contract.ts): export interface ScriptSurfaceResult{ uiEffects: ScriptUiEffect[]; diagnostics: ScriptDiagnostic[]; error?: ScriptExecutionError; origin: ActionOrigin; phase: 'boot' | 'user'; realm: ScriptRealmKind; } SubmitIntent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface SubmitIntent{ url: string | null; fields: PdfActionTargetRef[] | null; exclude: boolean; includeNoValueFields: boolean; format: 'fdf' | 'html' | 'xfdf' | 'pdf'; method: 'post' | 'get'; flagsRaw: number; charSet?: string; } SubmitResolver [TypeAliasDeclaration] (from packages/plugin/actions/src/host-contract.ts): export type SubmitResolver = ( intent: SubmitIntent, ctx: ActionContext, diagnose: (diagnostic: ActionDiagnostic) => void, ) => Promise; createHoverPump [FunctionDeclaration] (from packages/plugin/actions/src/hover-pump.ts): export function createHoverPump( dispatch: (trigger: ActionTrigger) => Promise, ): HoverPump{ let delivered: HoverTarget | null = null; let desired: HoverTarget | null = null; let inFlight = false; const pump = (): void =>{ if (inFlight || sameTarget(delivered, desired)) return; inFlight = true; const from = delivered; const to = desired; delivered = to; const submissions: Array> = []; if (from && from.events?.exit !== false){ submissions.push( dispatch({ scope: 'annotation', event: 'cursorExit', ref: from.ref, page: from.page, ...(from.source ?{ source: from.source} :{ } ), } ), ); } if (to && to.events?.enter !== false){ submissions.push( dispatch({ scope: 'annotation', event: 'cursorEnter', ref: to.ref, page: to.page, ...(to.source ?{ source: to.source} :{ } ), } ), ); } void Promise.allSettled(submissions).then(() =>{ inFlight = false; pump(); } ); } ; return{ hover(target){ desired = target; pump(); } , reset(){ delivered = null; desired = null; } , } ; } eventOf [VariableDeclaration] (from packages/plugin/actions/src/contract.ts): eventOf = (trigger: ActionTrigger): ActionTriggerEvent =>{ switch (trigger.scope){ case 'activate': return{ scope: 'activate'} ; case 'annotation': return{ scope: 'annotation', name: trigger.event} ; case 'page': return{ scope: 'page', name: trigger.event} ; case 'document': return{ scope: 'document', name: trigger.event} ; } } submitEntriesToUrlEncoded [VariableDeclaration] (from packages/plugin/actions/src/submit-encoding.ts): submitEntriesToUrlEncoded = (entries: FormSubmissionEntry[]): string => entries .flatMap(({ name, value} ) => value === null ? [encodeURIComponent(name)] : Array.isArray(value) ? value.map((item) => `${ encodeURIComponent(name)} =${ encodeURIComponent(item)} `) : [`${ encodeURIComponent(name)} =${ encodeURIComponent(value)} `], ) .join('&') triggerOriginOf [VariableDeclaration] (from packages/plugin/actions/src/contract.ts): triggerOriginOf = (trigger: ActionTrigger): ActionOrigin =>{ switch (trigger.scope){ case 'activate': return 'user'; case 'annotation': return trigger.event === 'cursorEnter' || trigger.event === 'cursorExit' ? 'hover' : 'user'; case 'page': case 'document': return 'lifecycle'; } }