/** * 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 { type TreeAuditCapability } from './audit.js'; import type { StructuralMutationReceipt, TreeDeleteMutationResult } from '../../@types/index.js'; import type { DocumentLifecycleContext } from './context.js'; interface PlaceParams { expectedRevision: number; documentId: string; parentDocumentId: string | null; beforeDocumentId?: string | null; afterDocumentId?: string | null; ifUnplaced?: boolean; /** Re-fire the post-commit hook when the requested placement is already current. */ reconcile?: boolean; } /** Place, re-parent, or reorder a node; explicit no-op retries may reconcile hooks. */ export declare function placeTreeNode(ctx: DocumentLifecycleContext, params: PlaceParams): Promise<{ orderKey: string; } & StructuralMutationReceipt>; /** Internal placement, only inside the initiating create/save transaction. */ export declare function appendTreeRoot(ctx: DocumentLifecycleContext, documentId: string): Promise; /** Placement failure aborts the initiating save, including its version and audit. */ export declare function selfHealTreePlacement(ctx: DocumentLifecycleContext, documentId: string): Promise; /** Remove a node to the unplaced state; an already-unplaced node is a true no-op. */ export declare function removeFromTree(ctx: DocumentLifecycleContext, params: { documentId: string; expectedRevision: number; reconcile?: boolean; }): Promise; /** * Reconcile delete-time edges and append parent plus child-specific audit rows. * The caller owns the transaction; delete uses this beside soft-delete/audit. */ export declare function reconcileTreeOnDeleteInTransaction(ctx: DocumentLifecycleContext, documentId: string, capability: TreeAuditCapability): Promise; /** Fire the promotion invalidation after its transaction commits. */ export declare function firePromoteTreeChange(ctx: DocumentLifecycleContext, documentId: string, result: TreeDeleteMutationResult): Promise; /** Standalone audited reconciliation used by internal tooling and tests. */ export declare function promoteChildrenAndRemove(ctx: DocumentLifecycleContext, params: { documentId: string; expectedRevision: number; }): Promise; export {};