/** * Standards-shaped export. * * The output is an AnnotationPage a host can store and any conformant consumer * can read. It is deliberately not a list of Mango's internal projections: a * host that has to understand `ResolvedAnnotation` in order to persist an * annotation is a host coupled to Mango's rendering model, and that model is * allowed to change. * * Three things are reported alongside the JSON rather than being decided here, * because each of them is a judgement the caller has to make: whether the * document is valid, what private data was withheld, and which annotations * still need a real identifier. */ import { type CanonicalAnnotationPage, type JsonObject, type SerializationProfile, type ValidationResult } from '@mango-iiif/w3c-parser'; import type { ResolvedAnnotation } from '../../iiif/annotationResolver'; import { type MangoDiagnostic } from './diagnostics'; export type ExportOptions = { /** Public HTTP(S) identifier for the page. A draft URN when absent. */ pageId?: string; /** Canvas the annotations target, for projections with no document. */ canvasId?: string; profile?: SerializationProfile; /** * Include private application data. * * Off by default, and the caller has to pass it deliberately. Defaulting the * other way would mean every ordinary export leaked private notes, which is * the failure this flag exists to make impossible to reach by accident. */ includePrivate?: boolean; /** Permits the expert-only motivations during validation. */ expert?: boolean; /** Require resolvable HTTP(S) identifiers. For publication, not for drafts. */ requireHttpIds?: boolean; }; export type ExcludedField = { annotationId: string; keys: string[]; }; export type ExportResult = { /** AnnotationPage JSON-LD. */ page: JsonObject; /** The canonical page, for a caller that wants to keep editing it. */ document: CanonicalAnnotationPage; /** Validation suitable for keeping the document as a local draft. */ draftValidation: ValidationResult; /** Strict validation for a payload intended to be published as IIIF. */ publicationValidation: ValidationResult; /** * @deprecated Selects draft or publication validation according to * `requireHttpIds`. New callers should choose the named result explicitly. */ validation: ValidationResult; /** Private data withheld, per annotation. Empty when nothing was withheld. */ excludedPrivateFields: ExcludedField[]; /** Annotations still carrying a draft identifier. */ unresolvedIdentities: string[]; /** Page identifier still needing a public HTTP(S) identity. */ unresolvedPageIdentity?: string; diagnostics: MangoDiagnostic[]; }; export declare const exportAnnotationPage: (annotations: readonly ResolvedAnnotation[], options?: ExportOptions) => ExportResult; /** True when the page is safe to publish rather than only to store locally. */ export declare const isPublishable: (result: ExportResult) => boolean;