meca
Version:
Types and utilities for working with MECA
55 lines • 1.83 kB
TypeScript
import type { GenericParent } from 'myst-common';
import type { Element, DeclarationAttributes } from 'xml-js';
import type { Logger } from 'myst-cli-utils';
export declare const MANIFEST = "manifest.xml";
export declare const MANIFEST_DTD = "manifest-1.0.dtd";
type Options = {
log?: Logger;
source?: string;
};
export declare enum ItemTypes {
articleMetadata = "article-metadata",
articleSupportingFile = "article-supporting-file",
manuscript = "manuscript",
manuscriptSupportingFile = "manuscript-supporting-file",
articleSource = "article-source",
articleSourceEnvironment = "article-source-environment",
articleSourceDirectory = "article-source-directory",
transferMetadata = "transfer-metadata"
}
export type ManifestItem = {
id?: string;
itemType?: string;
version?: string;
title?: string;
description?: string;
href: string;
mediaType?: string;
fileOrder?: string;
metadata?: Record<string, string>;
};
export declare class ManifestXml {
declaration?: DeclarationAttributes;
doctype?: string;
rawXML: string;
raw: Element;
log: Logger;
tree: GenericParent;
source?: string;
constructor(data: string, opts?: Options);
get localDtd(): string;
validateXml(remoteDtd?: string): Promise<boolean | undefined>;
get version(): string;
get items(): ManifestItem[];
get itemTypes(): string[];
get articleMetadata(): ManifestItem | undefined;
get transferMetadata(): ManifestItem[];
}
type WriteOptions = {
/** Some publishers prefer `href` instead of `xlink:href`, which is in the spec */
noXLink?: boolean;
dtdUrl?: string;
};
export declare function createManifestXml(manifestItems: ManifestItem[], opts?: WriteOptions): string;
export {};
//# sourceMappingURL=manifest.d.ts.map