open-agreements
Version:
Open-source legal template filling CLI and library
44 lines • 2.31 kB
TypeScript
import { type FieldDefinition, type FieldSelectorMetadata } from '../metadata.js';
import { type ComputedProfile } from './computed.js';
export declare const FIELD_SELECTOR_INPUT_SCHEMA_VERSION: 1;
export declare const FIELD_SELECTOR_SCHEMA_GENERATOR: "open-agreements field-selector schema";
export interface JsonSchema {
[key: string]: unknown;
}
export interface FieldSelectorSchemaProvenance {
field_selector_id: string;
source_version: string;
generator: typeof FIELD_SELECTOR_SCHEMA_GENERATOR;
schema_version: typeof FIELD_SELECTOR_INPUT_SCHEMA_VERSION;
}
export interface FieldSelectorSchemaManifest {
schema_version: 1;
generator: 'open-agreements field-selector schema --all';
package_version: string;
runtime_revision: string;
canonicalization: 'RFC8785';
schemas: Array<{
field_selector_id: string;
path: string;
sha256: string;
}>;
}
/**
* Legal value shapes whose surrounding prose is owned by the source form.
*
* Series tokens use a stable field-name contract. Percentage inputs use either
* that name contract or an explicit percentage declaration in canonical field
* metadata (for example `redemption_interest_rate`). The same helper drives
* both the published JSON Schema and the pre-fill runtime check, so callers
* cannot pass a rendered phrase or punctuation that the form adds again.
*/
export declare function fieldValuePattern(field: FieldDefinition): string | undefined;
/** Fail malformed source-owned token/sigil values before any document work. */
export declare function assertFieldSelectorInputValueShapes(values: Record<string, unknown>, fields: FieldDefinition[]): void;
/** Return every metadata field owned by computed.json rather than the caller. */
export declare function computedFieldNames(profile: ComputedProfile | null): Set<string>;
export declare function buildFieldSelectorInputSchema(fieldSelectorId: string, metadata: FieldSelectorMetadata, computedProfile: ComputedProfile | null): JsonSchema;
export declare function getFieldSelectorInputSchema(fieldSelectorId: string, fieldSelectorDir?: string): JsonSchema;
export declare function canonicalJson(value: unknown): string;
export declare function canonicalSha256(value: unknown): string;
//# sourceMappingURL=input-schema.d.ts.map