import { type array, type describe, type listable, type satisfy } from "@ark/util"; import type { NodeSchema, Prerequisite, innerAttachedAs, nodeOfKind } from "./kinds.ts"; import { BaseNode } from "./node.ts"; import type { NodeParseContext } from "./parse.ts"; import type { Intersection } from "./roots/intersection.ts"; import type { BaseRoot } from "./roots/root.ts"; import type { BaseScope } from "./scope.ts"; import type { NodeCompiler } from "./shared/compile.ts"; import type { BaseNodeDeclaration } from "./shared/declare.ts"; import { Disjoint } from "./shared/disjoint.ts"; import { type ConstraintKind, type IntersectionContext, type NodeKind, type RootKind, type StructuralKind, type UnknownAttachments, type kindLeftOf } from "./shared/implement.ts"; import type { JsonSchema } from "./shared/jsonSchema.ts"; import type { ToJsonSchema } from "./shared/toJsonSchema.ts"; import type { TraverseAllows, TraverseApply } from "./shared/traversal.ts"; import { arkKind } from "./shared/utils.ts"; import type { Structure } from "./structure/structure.ts"; export declare namespace Constraint { interface Declaration extends BaseNodeDeclaration { kind: ConstraintKind; } type ReductionResult = BaseRoot | Disjoint | Intersection.Inner.mutable; interface Attachments { impliedBasis: BaseRoot | null; impliedSiblings?: array | null; } type PrimitiveKind = Exclude; } export declare abstract class BaseConstraint< /** @ts-ignore allow instantiation assignment to the base type */ out d extends Constraint.Declaration = Constraint.Declaration> extends BaseNode { readonly [arkKind]: "constraint"; constructor(attachments: UnknownAttachments, $: BaseScope); abstract readonly impliedBasis: BaseRoot | null; readonly impliedSiblings?: array; intersect(r: r): intersectConstraintKinds; } export declare abstract class InternalPrimitiveConstraint extends BaseConstraint { abstract traverseAllows: TraverseAllows; abstract readonly compiledCondition: string; abstract readonly compiledNegation: string; abstract reduceJsonSchema(base: JsonSchema.Constrainable, ctx: ToJsonSchema.Context): JsonSchema.Constrainable; traverseApply: TraverseApply; compile(js: NodeCompiler): void; get errorContext(): d["errorContext"]; get compiledErrorContext(): string; } export declare const constraintKeyParser: (kind: kind) => (schema: listable>, ctx: NodeParseContext) => innerAttachedAs | undefined; type ConstraintGroupKind = satisfy; interface ConstraintIntersectionState { kind: kind; baseInner: Record; l: BaseConstraint[]; r: BaseConstraint[]; roots: BaseRoot[]; ctx: IntersectionContext; } export declare const intersectConstraints: (s: ConstraintIntersectionState) => nodeOfKind> | Disjoint; export declare const flattenConstraints: (inner: object) => BaseConstraint[]; type FlatIntersectionInner = Intersection.Inner & Structure.Inner; export declare const unflattenConstraints: (constraints: array) => FlatIntersectionInner; export type constraintKindLeftOf = ConstraintKind & kindLeftOf; export type constraintKindOrLeftOf = kind | constraintKindLeftOf; export type intersectConstraintKinds = nodeOfKind | Disjoint | null; export declare const throwInvalidOperandError: (...args: Parameters) => never; export declare const writeInvalidOperandMessage: (kind: kind, expected: expected, actual: actual) => string; export type writeInvalidOperandMessage = `${Capitalize} operand must be ${describe>} (was ${describe>>})`; export {};