/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ import { ErrorCodes } from '../../lib/errors.js'; import type { DocumentLifecycleContext } from './context.js'; export type DocumentHookCommittedPhase = 'afterCreate' | 'afterUpdate' | 'afterSave' | 'afterSystemFieldsChange' | 'afterStatusChange' | 'afterUnpublish'; export type DocumentHookSideEffectCode = typeof ErrorCodes.STORAGE | typeof ErrorCodes.UNHANDLED; export interface DocumentHookCommittedDetails { phase: DocumentHookCommittedPhase; documentId: string; documentVersionId: string; revision: number; sideEffectCode: DocumentHookSideEffectCode; } /** Read and validate the public, non-sensitive metadata from a committed hook failure. */ export declare function getDocumentHookCommittedDetails(error: unknown): DocumentHookCommittedDetails | null; /** * Run a hook after its document version has committed, preserving rejection * semantics while making the committed state machine-readable to hosts. */ export declare function runCommittedDocumentHook(ctx: DocumentLifecycleContext, details: Omit, callback: () => Promise): Promise;