open-agreements
Version:
Open-source legal template filling CLI and library
124 lines • 5.75 kB
TypeScript
/**
* Zod schemas for selector-contract fieldSelector manifests.
*
* A `FieldSelectorManifest` (`field-selectors/<id>/fields/<field_id>.json`)
* models one fillable concept as an ordered list of deterministic locators
* (`occurrences`), one per place the value is written. A `TemplateManifest`
* (`field-selectors/<id>/template-manifest.json`) pins the source and declares
* which legacy `replacements.json` keys the selector engine now owns
* (`migrated_keys`).
*
* The manifest carries NO RFC-2119 `requirement` level: the legal level is owned
* by legal-explainer's contract-spec requirements and joined to OA fields via
* `field_id ⟷ template_metadata_fields`, never duplicated here. Schemas are
* `.strict()` so a stray `requirement` key (or any typo) is rejected.
*/
import { z } from 'zod';
export declare const LocatorSchema: z.ZodObject<{
scope: z.ZodOptional<z.ZodArray<z.ZodObject<{
kind: z.ZodLiteral<"section">;
headingText: z.ZodOptional<z.ZodString>;
headingRegex: z.ZodOptional<z.ZodString>;
headingStyleId: z.ZodOptional<z.ZodString>;
untilLevel: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>>>;
primary: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"regex">;
pattern: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
group: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"contextual">;
contextPattern: z.ZodString;
targetPattern: z.ZodString;
rowLabelPattern: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"fingerprint">;
contentFingerprint: z.ZodString;
}, z.core.$strict>], "kind">;
assertions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"regex">;
pattern: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
group: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"contextual">;
contextPattern: z.ZodString;
targetPattern: z.ZodString;
rowLabelPattern: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"fingerprint">;
contentFingerprint: z.ZodString;
}, z.core.$strict>], "kind">>>;
}, z.core.$strict>;
export declare const POSTCONDITION_NAMES: readonly ["no_unresolved_placeholder", "all_occurrences_identical", "no_double_dollar", "no_double_percent"];
export type PostconditionName = (typeof POSTCONDITION_NAMES)[number];
export declare const FAILURE_BEHAVIORS: readonly ["block_render_and_request_review", "warn", "skip"];
export type FailureBehavior = (typeof FAILURE_BEHAVIORS)[number];
export declare const FieldSelectorManifestSchema: z.ZodObject<{
schema_version: z.ZodNumber;
field_id: z.ZodString;
field_label: z.ZodString;
description: z.ZodString;
source_template_version: z.ZodString;
occurrences: z.ZodArray<z.ZodObject<{
scope: z.ZodOptional<z.ZodArray<z.ZodObject<{
kind: z.ZodLiteral<"section">;
headingText: z.ZodOptional<z.ZodString>;
headingRegex: z.ZodOptional<z.ZodString>;
headingStyleId: z.ZodOptional<z.ZodString>;
untilLevel: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>>>;
primary: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"regex">;
pattern: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
group: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"contextual">;
contextPattern: z.ZodString;
targetPattern: z.ZodString;
rowLabelPattern: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"fingerprint">;
contentFingerprint: z.ZodString;
}, z.core.$strict>], "kind">;
assertions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"regex">;
pattern: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
group: z.ZodOptional<z.ZodNumber>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"contextual">;
contextPattern: z.ZodString;
targetPattern: z.ZodString;
rowLabelPattern: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"fingerprint">;
contentFingerprint: z.ZodString;
}, z.core.$strict>], "kind">>>;
}, z.core.$strict>>;
postconditions: z.ZodDefault<z.ZodArray<z.ZodEnum<{
no_unresolved_placeholder: "no_unresolved_placeholder";
all_occurrences_identical: "all_occurrences_identical";
no_double_dollar: "no_double_dollar";
no_double_percent: "no_double_percent";
}>>>;
failure_behavior: z.ZodEnum<{
warn: "warn";
block_render_and_request_review: "block_render_and_request_review";
skip: "skip";
}>;
fixtures: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
}, z.core.$strict>;
export type FieldSelectorManifest = z.infer<typeof FieldSelectorManifestSchema>;
export declare const TemplateManifestSchema: z.ZodObject<{
schema_version: z.ZodNumber;
template_id: z.ZodString;
template_version: z.ZodString;
source_sha256: z.ZodString;
part_hashes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
migrated_keys: z.ZodDefault<z.ZodArray<z.ZodString>>;
}, z.core.$strict>;
export type TemplateManifest = z.infer<typeof TemplateManifestSchema>;
//# sourceMappingURL=manifest-schema.d.ts.map