/** * 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 { IDocumentCommands, IDocumentQueries, SingletonDefinition, SingletonSaveOperation } from '../../@types/index.js'; import type { DocumentLifecycleContext } from '../document-lifecycle/context.js'; type VersionWriteResult = Awaited>; type CurrentVersionMetadata = NonNullable>>; export interface SingletonSaveResult { revision: number; documentId: string; documentVersionId: string; } export interface LockedSingletonSlot { documentId: string | null; currentVersion: CurrentVersionMetadata | null; } interface PreparedSingletonSave { data: Record; originalData: Record | null; locale: string; prepareWrite: () => Promise; write: () => Promise; } /** * Assert the kind-aware singleton update ability without touching storage. * The runtime kind guard keeps this internal service from becoming an * alternate write path for an ordinary collection. */ export declare function authorizeSingletonUpdate(ctx: DocumentLifecycleContext): SingletonDefinition; /** * Resolve the mapped logical document id without running read authorization * or hooks. Client-facing callers must authorize before invoking this resolver. */ export declare function resolveSingletonDocumentId(ctx: DocumentLifecycleContext): Promise; /** Prepare singleton restore/copy outside locks, then commit under S → D → P. */ export declare function commitSingletonSave(params: { ctx: DocumentLifecycleContext; definition: SingletonDefinition; expectedRevision: number; operation: SingletonSaveOperation; prepare: (slot: LockedSingletonSlot) => Promise; }): Promise; export {};