open-agreements
Version:
Open-source legal template filling CLI and library
70 lines • 2.67 kB
TypeScript
import { type FillResult } from './engine.js';
import { type TemplateMetadata } from './metadata.js';
declare const APAP_NS = "org.accordproject.protocol@1.0.0";
export interface ApapCtoFile {
$class: `${typeof APAP_NS}.CtoFile`;
filename: string;
contents: string;
}
export interface ApapTemplatePayload {
$class: `${typeof APAP_NS}.Template`;
uri: string;
author: string;
displayName: string;
version: string;
description: string;
license: string;
keywords: string[];
metadata: {
$class: `${typeof APAP_NS}.TemplateMetadata`;
runtime: string;
template: string;
cicero: string;
};
templateModel: {
$class: `${typeof APAP_NS}.TemplateModel`;
typeName: string;
model: {
$class: `${typeof APAP_NS}.CtoModel`;
ctoFiles: ApapCtoFile[];
};
};
text: {
$class: `${typeof APAP_NS}.Text`;
templateText: string;
};
}
export interface ExportApapTemplateOptions {
templateDir: string;
concertoModelPath: string;
concertoDependencyPaths?: string[];
templateUri?: string;
}
export interface ApapAgreementDataOptions {
contractId: string;
values: Record<string, unknown>;
}
export interface FillApapAgreementOptions {
templateDir: string;
agreementData: Record<string, unknown>;
outputPath: string;
}
/**
* Serialize an APAP Template as the Concerto relationship value required by
* Agreement.template. The template's URI is the relationship identifier; a
* bare URI is not a valid relationship value for the APAP protocol model.
*/
export declare function toApapTemplateRelationship(template: Pick<ApapTemplatePayload, '$class' | 'uri'>): string;
/**
* Convert the structural subset of canonical MDoc into the TemplateMark text
* accepted by the APAP reference implementation. Requirement annotations are
* provenance metadata rather than rendered text, so they are removed while
* their enclosed operative language is retained. Unknown directives fail
* closed so future canonical constructs cannot be silently omitted.
*/
export declare function canonicalMdocToApapTemplateMark(source: string, booleanConditionFields?: ReadonlySet<string>): string;
export declare function exportTemplateToApap(options: ExportApapTemplateOptions): ApapTemplatePayload;
export declare function toApapAgreementData(template: ApapTemplatePayload, metadata: TemplateMetadata, options: ApapAgreementDataOptions): Record<string, unknown>;
export declare function fillApapAgreementToDocx(options: FillApapAgreementOptions): Promise<FillResult>;
export {};
//# sourceMappingURL=apap.d.ts.map