open-agreements
Version:
Open-source legal template filling CLI and library
137 lines • 5.58 kB
TypeScript
import { z } from 'zod';
declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
export declare const ComputedPredicateSchema: z.ZodObject<{
field: z.ZodString;
op: z.ZodEnum<{
in: "in";
eq: "eq";
neq: "neq";
truthy: "truthy";
falsy: "falsy";
defined: "defined";
}>;
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>]>>;
}, z.core.$strip>;
export declare const ComputedRuleSchema: z.ZodObject<{
id: z.ZodString;
description: z.ZodOptional<z.ZodString>;
when_all: z.ZodDefault<z.ZodArray<z.ZodObject<{
field: z.ZodString;
op: z.ZodEnum<{
in: "in";
eq: "eq";
neq: "neq";
truthy: "truthy";
falsy: "falsy";
defined: "defined";
}>;
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>]>>;
}, z.core.$strip>>>;
when_any: z.ZodDefault<z.ZodArray<z.ZodObject<{
field: z.ZodString;
op: z.ZodEnum<{
in: "in";
eq: "eq";
neq: "neq";
truthy: "truthy";
falsy: "falsy";
defined: "defined";
}>;
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>]>>;
}, z.core.$strip>>>;
set_fill: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
set_audit: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
}, z.core.$strip>;
export declare const ComputedProfileSchema: z.ZodObject<{
version: z.ZodDefault<z.ZodString>;
max_passes: z.ZodDefault<z.ZodNumber>;
defaults: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
rules: z.ZodArray<z.ZodObject<{
id: z.ZodString;
description: z.ZodOptional<z.ZodString>;
when_all: z.ZodDefault<z.ZodArray<z.ZodObject<{
field: z.ZodString;
op: z.ZodEnum<{
in: "in";
eq: "eq";
neq: "neq";
truthy: "truthy";
falsy: "falsy";
defined: "defined";
}>;
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>]>>;
}, z.core.$strip>>>;
when_any: z.ZodDefault<z.ZodArray<z.ZodObject<{
field: z.ZodString;
op: z.ZodEnum<{
in: "in";
eq: "eq";
neq: "neq";
truthy: "truthy";
falsy: "falsy";
defined: "defined";
}>;
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>]>>;
}, z.core.$strip>>>;
set_fill: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
set_audit: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
}, z.core.$strip>>;
}, z.core.$strip>;
export type ComputedPrimitive = z.infer<typeof PrimitiveSchema> | string[];
export type ComputedValueMap = Record<string, ComputedPrimitive>;
export type ComputedPredicate = z.infer<typeof ComputedPredicateSchema>;
export type ComputedRule = z.infer<typeof ComputedRuleSchema>;
export type ComputedProfile = z.infer<typeof ComputedProfileSchema>;
export interface ComputedAssignmentDelta {
field: string;
scope: 'fill' | 'audit';
previous: ComputedPrimitive | undefined;
next: ComputedPrimitive;
}
export interface ComputedRuleTrace {
rule_id: string;
description?: string;
matched: boolean;
assignments: ComputedAssignmentDelta[];
}
export interface ComputedPassTrace {
pass: number;
changed: boolean;
rules: ComputedRuleTrace[];
}
export interface ComputedArtifact {
field_selector_id: string;
generated_at: string;
profile_present: boolean;
profile_version: string | null;
max_passes: number;
stabilized: boolean;
pass_count: number;
inputs: ComputedValueMap;
final_fill_values: ComputedValueMap;
derived_fill_values: ComputedValueMap;
derived_audit_values: ComputedValueMap;
passes: ComputedPassTrace[];
}
export interface EvaluatedComputedProfile {
fillValues: ComputedValueMap;
auditValues: ComputedValueMap;
passes: ComputedPassTrace[];
stabilized: boolean;
maxPasses: number;
}
export declare function loadComputedProfile(fieldSelectorDir: string): ComputedProfile | null;
export declare function evaluateComputedProfile(profile: ComputedProfile, inputValues: ComputedValueMap): EvaluatedComputedProfile;
export declare function buildComputedArtifact(args: {
fieldSelectorId: string;
inputValues: ComputedValueMap;
evaluated: EvaluatedComputedProfile;
profileVersion: string;
}): ComputedArtifact;
export declare function buildPassthroughArtifact(args: {
fieldSelectorId: string;
inputValues: ComputedValueMap;
}): ComputedArtifact;
export declare function writeComputedArtifact(outputPath: string, artifact: ComputedArtifact): void;
export {};
//# sourceMappingURL=computed.d.ts.map