/** * 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 { DocumentLifecycleContext } from './context.js'; export interface DeleteLocaleResult { revision: number; documentId: string; /** The newly-created version that omits the deleted locale's content. */ documentVersionId: string; /** The content locale that was removed. */ locale: string; } /** * Remove one content locale's data from a document, in place on the same * document, by writing a new immutable version that omits that locale's * store rows (every other locale and all non-localized `'all'` rows are * carried forward by the storage primitive). * * The document's source content locale is its anchor (path + source_locale) * and can never be removed — rejected up front. The new version lands as the * workflow's default status (a fresh draft), exactly like `copyToLocale`: the * previously-published version keeps serving — including the locale being * removed — until the new version is reviewed and published. The deletion is * recoverable: the prior version still holds the locale, so restoring it * brings the content back. * * Flow: * 1. `assertActorCanPerform('update')` — removing a translation is an edit. * 2. Reject deletion of the document’s source locale. * 3. Read the document in the target locale (validates existence; supplies * `originalData` for hooks and the availability set for the presence * check). * 4. Reject when the locale has no content to delete. * 5. `hooks.beforeUpdate({ …, deleteLocale: { locale } })`. * 6. `db.commands.documents.deleteDocumentLocale({ …, status: default })`. * 7. `hooks.afterUpdate({ …, deleteLocale: { locale } })`. */ export declare function deleteLocale(ctx: DocumentLifecycleContext, params: { documentId: string; expectedRevision: number; locale: string; }): Promise;