trilean 1.6.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +13 -0
  2. package/dist/complex.d.cts +5 -6
  3. package/dist/complex.d.ts +5 -6
  4. package/dist/derived-aggregates.d.cts +5 -6
  5. package/dist/derived-aggregates.d.ts +5 -6
  6. package/dist/derived-connectives.d.cts +10 -11
  7. package/dist/derived-connectives.d.ts +10 -11
  8. package/dist/derived-patterns.d.cts +4 -5
  9. package/dist/derived-patterns.d.ts +4 -5
  10. package/dist/derived-values.d.cts +2 -3
  11. package/dist/derived-values.d.ts +2 -3
  12. package/dist/evaluation.d.cts +7 -8
  13. package/dist/evaluation.d.ts +7 -8
  14. package/dist/evaluator-budget.d.cts +6 -7
  15. package/dist/evaluator-budget.d.ts +6 -7
  16. package/dist/evaluator-collection.cjs +5 -4
  17. package/dist/evaluator-collection.d.cts +7 -7
  18. package/dist/evaluator-collection.d.ts +7 -7
  19. package/dist/evaluator-collection.js +5 -4
  20. package/dist/evaluator-effect.cjs +54 -0
  21. package/dist/evaluator-effect.d.cts +37 -0
  22. package/dist/evaluator-effect.d.ts +37 -0
  23. package/dist/evaluator-effect.js +50 -0
  24. package/dist/evaluator-factory.cjs +13 -2
  25. package/dist/evaluator-factory.d.cts +17 -6
  26. package/dist/evaluator-factory.d.ts +17 -6
  27. package/dist/evaluator-factory.js +13 -3
  28. package/dist/evaluator-indeterminacy-helpers.d.cts +26 -27
  29. package/dist/evaluator-indeterminacy-helpers.d.ts +26 -27
  30. package/dist/evaluator-operations.d.cts +10 -11
  31. package/dist/evaluator-operations.d.ts +10 -11
  32. package/dist/evaluator-test-helpers.d.cts +6 -7
  33. package/dist/evaluator-test-helpers.d.ts +6 -7
  34. package/dist/evaluator.cjs +43 -40
  35. package/dist/evaluator.d.cts +5 -5
  36. package/dist/evaluator.d.ts +5 -5
  37. package/dist/evaluator.js +43 -40
  38. package/dist/functions.d.cts +3 -4
  39. package/dist/functions.d.ts +3 -4
  40. package/dist/index.cjs +1 -0
  41. package/dist/index.d.cts +3 -3
  42. package/dist/index.d.ts +3 -3
  43. package/dist/index.js +2 -2
  44. package/dist/resolvers.d.cts +22 -6
  45. package/dist/resolvers.d.ts +22 -6
  46. package/dist/tree.d.cts +77 -78
  47. package/dist/tree.d.ts +77 -78
  48. package/package.json +3 -3
  49. package/schemas/trilean.schema.json +1 -1
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ import { hierarchicalGlobPattern, prefixPattern, wildcardPattern } from "./deriv
8
8
  import { coalesce } from "./derived-values.js";
9
9
  import { Evaluation, IndeterminateReason, IndeterminateReasonSchema, definite, firstIndeterminate, indeterminate } from "./evaluation.js";
10
10
  import { FunctionRegistry, emptyFunctionRegistry } from "./functions.js";
11
- import { EvaluationContext, Resolution, Resolvers, TreeResolution } from "./resolvers.js";
12
- import { createEvaluator, evaluatePredicate, evaluateValue } from "./evaluator-factory.js";
13
- export { type AccumulatorNode, AccumulatorNodeSchema, type AllOfNode, AllOfNodeSchema, type AndNode, AndNodeSchema, type AnyOfNode, AnyOfNodeSchema, type ArithmeticNode, ArithmeticNodeSchema, type ArithmeticOperator, ArithmeticOperatorSchema, type BooleanLiteralNode, BooleanLiteralNodeSchema, type CallNode, CallNodeSchema, type CompareNode, CompareNodeSchema, type ComparisonOperator, ComparisonOperatorSchema, type ComplexLiteralNode, ComplexLiteralNodeSchema, type ComplexPolarLiteralNode, ComplexPolarLiteralNodeSchema, type ComplexRectangularLiteralNode, ComplexRectangularLiteralNodeSchema, type ComputedValue, ComputedValueSchema, type ConditionalCase, ConditionalCaseSchema, type ConditionalNode, ConditionalNodeSchema, type DelegateNode, DelegateNodeSchema, type DurationLiteralNode, DurationLiteralNodeSchema, type DurationUnit, DurationUnitSchema, type Evaluation, type EvaluationContext, type EveryNode, EveryNodeSchema, type ExistsNode, ExistsNodeSchema, type ExpressionNode, ExpressionNodeSchema, type FoldCombiner, FoldCombinerSchema, type FoldNode, FoldNodeSchema, type FunctionRegistry, type HitPolicy, HitPolicySchema, type IndeterminateReason, IndeterminateReasonSchema, type InstantLiteralNode, InstantLiteralNodeSchema, type JsonValue, JsonValueSchema, type LookupNode, LookupNodeSchema, type MemberOfNode, MemberOfNodeSchema, type MembershipOperator, MembershipOperatorSchema, type NegateNode, NegateNodeSchema, type NotNode, NotNodeSchema, type NumberLiteralNode, NumberLiteralNodeSchema, type OrNode, OrNodeSchema, type PredicateNode, PredicateNodeSchema, type ReferenceNode, ReferenceNodeSchema, type Resolution, type Resolvers, type SomeNode, SomeNodeSchema, type TextCompareNode, TextCompareNodeSchema, type TextComparisonOperator, TextComparisonOperatorSchema, type TextLiteralNode, TextLiteralNodeSchema, type TreeReferenceNode, TreeReferenceNodeSchema, type TreeResolution, type Unit, UnitSchema, and, average, coalesce, combineUnitsForDivide, combineUnitsForMultiply, complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase, count, createEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, hierarchicalGlobPattern, iff, implies, indeterminate, nand, none, nor, not, or, prefixPattern, presenceOf, sum, unitsEqual, wildcardPattern, xor };
11
+ import { EvaluationContext, Resolution, Resolvers, SyncResolvers, TreeResolution } from "./resolvers.js";
12
+ import { EvaluatorOptions, createEvaluator, createSyncEvaluator, evaluatePredicate, evaluateValue } from "./evaluator-factory.js";
13
+ export { type AccumulatorNode, AccumulatorNodeSchema, type AllOfNode, AllOfNodeSchema, type AndNode, AndNodeSchema, type AnyOfNode, AnyOfNodeSchema, type ArithmeticNode, ArithmeticNodeSchema, type ArithmeticOperator, ArithmeticOperatorSchema, type BooleanLiteralNode, BooleanLiteralNodeSchema, type CallNode, CallNodeSchema, type CompareNode, CompareNodeSchema, type ComparisonOperator, ComparisonOperatorSchema, type ComplexLiteralNode, ComplexLiteralNodeSchema, type ComplexPolarLiteralNode, ComplexPolarLiteralNodeSchema, type ComplexRectangularLiteralNode, ComplexRectangularLiteralNodeSchema, type ComputedValue, ComputedValueSchema, type ConditionalCase, ConditionalCaseSchema, type ConditionalNode, ConditionalNodeSchema, type DelegateNode, DelegateNodeSchema, type DurationLiteralNode, DurationLiteralNodeSchema, type DurationUnit, DurationUnitSchema, type Evaluation, type EvaluationContext, type EvaluatorOptions, type EveryNode, EveryNodeSchema, type ExistsNode, ExistsNodeSchema, type ExpressionNode, ExpressionNodeSchema, type FoldCombiner, FoldCombinerSchema, type FoldNode, FoldNodeSchema, type FunctionRegistry, type HitPolicy, HitPolicySchema, type IndeterminateReason, IndeterminateReasonSchema, type InstantLiteralNode, InstantLiteralNodeSchema, type JsonValue, JsonValueSchema, type LookupNode, LookupNodeSchema, type MemberOfNode, MemberOfNodeSchema, type MembershipOperator, MembershipOperatorSchema, type NegateNode, NegateNodeSchema, type NotNode, NotNodeSchema, type NumberLiteralNode, NumberLiteralNodeSchema, type OrNode, OrNodeSchema, type PredicateNode, PredicateNodeSchema, type ReferenceNode, ReferenceNodeSchema, type Resolution, type Resolvers, type SomeNode, SomeNodeSchema, type SyncResolvers, type TextCompareNode, TextCompareNodeSchema, type TextComparisonOperator, TextComparisonOperatorSchema, type TextLiteralNode, TextLiteralNodeSchema, type TreeReferenceNode, TreeReferenceNodeSchema, type TreeResolution, type Unit, UnitSchema, and, average, coalesce, combineUnitsForDivide, combineUnitsForMultiply, complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase, count, createEvaluator, createSyncEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, hierarchicalGlobPattern, iff, implies, indeterminate, nand, none, nor, not, or, prefixPattern, presenceOf, sum, unitsEqual, wildcardPattern, xor };
package/dist/index.js CHANGED
@@ -8,5 +8,5 @@ import { IndeterminateReasonSchema, definite, firstIndeterminate, indeterminate
8
8
  import { JsonValueSchema } from "./json-value.js";
9
9
  import { AccumulatorNodeSchema, AllOfNodeSchema, AndNodeSchema, AnyOfNodeSchema, ArithmeticNodeSchema, ArithmeticOperatorSchema, BooleanLiteralNodeSchema, CallNodeSchema, CompareNodeSchema, ComparisonOperatorSchema, ComplexLiteralNodeSchema, ComplexPolarLiteralNodeSchema, ComplexRectangularLiteralNodeSchema, ConditionalCaseSchema, ConditionalNodeSchema, DelegateNodeSchema, DurationLiteralNodeSchema, EveryNodeSchema, ExistsNodeSchema, ExpressionNodeSchema, FoldCombinerSchema, FoldNodeSchema, HitPolicySchema, InstantLiteralNodeSchema, LookupNodeSchema, MemberOfNodeSchema, MembershipOperatorSchema, NegateNodeSchema, NotNodeSchema, NumberLiteralNodeSchema, OrNodeSchema, PredicateNodeSchema, ReferenceNodeSchema, SomeNodeSchema, TextCompareNodeSchema, TextComparisonOperatorSchema, TextLiteralNodeSchema, TreeReferenceNodeSchema } from "./tree.js";
10
10
  import { emptyFunctionRegistry } from "./functions.js";
11
- import { createEvaluator, evaluatePredicate, evaluateValue } from "./evaluator-factory.js";
12
- export { AccumulatorNodeSchema, AllOfNodeSchema, AndNodeSchema, AnyOfNodeSchema, ArithmeticNodeSchema, ArithmeticOperatorSchema, BooleanLiteralNodeSchema, CallNodeSchema, CompareNodeSchema, ComparisonOperatorSchema, ComplexLiteralNodeSchema, ComplexPolarLiteralNodeSchema, ComplexRectangularLiteralNodeSchema, ComputedValueSchema, ConditionalCaseSchema, ConditionalNodeSchema, DelegateNodeSchema, DurationLiteralNodeSchema, DurationUnitSchema, EveryNodeSchema, ExistsNodeSchema, ExpressionNodeSchema, FoldCombinerSchema, FoldNodeSchema, HitPolicySchema, IndeterminateReasonSchema, InstantLiteralNodeSchema, JsonValueSchema, LookupNodeSchema, MemberOfNodeSchema, MembershipOperatorSchema, NegateNodeSchema, NotNodeSchema, NumberLiteralNodeSchema, OrNodeSchema, PredicateNodeSchema, ReferenceNodeSchema, SomeNodeSchema, TextCompareNodeSchema, TextComparisonOperatorSchema, TextLiteralNodeSchema, TreeReferenceNodeSchema, UnitSchema, and, average, coalesce, combineUnitsForDivide, combineUnitsForMultiply, complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase, count, createEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, hierarchicalGlobPattern, iff, implies, indeterminate, nand, none, nor, not, or, prefixPattern, presenceOf, sum, unitsEqual, wildcardPattern, xor };
11
+ import { createEvaluator, createSyncEvaluator, evaluatePredicate, evaluateValue } from "./evaluator-factory.js";
12
+ export { AccumulatorNodeSchema, AllOfNodeSchema, AndNodeSchema, AnyOfNodeSchema, ArithmeticNodeSchema, ArithmeticOperatorSchema, BooleanLiteralNodeSchema, CallNodeSchema, CompareNodeSchema, ComparisonOperatorSchema, ComplexLiteralNodeSchema, ComplexPolarLiteralNodeSchema, ComplexRectangularLiteralNodeSchema, ComputedValueSchema, ConditionalCaseSchema, ConditionalNodeSchema, DelegateNodeSchema, DurationLiteralNodeSchema, DurationUnitSchema, EveryNodeSchema, ExistsNodeSchema, ExpressionNodeSchema, FoldCombinerSchema, FoldNodeSchema, HitPolicySchema, IndeterminateReasonSchema, InstantLiteralNodeSchema, JsonValueSchema, LookupNodeSchema, MemberOfNodeSchema, MembershipOperatorSchema, NegateNodeSchema, NotNodeSchema, NumberLiteralNodeSchema, OrNodeSchema, PredicateNodeSchema, ReferenceNodeSchema, SomeNodeSchema, TextCompareNodeSchema, TextComparisonOperatorSchema, TextLiteralNodeSchema, TreeReferenceNodeSchema, UnitSchema, and, average, coalesce, combineUnitsForDivide, combineUnitsForMultiply, complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase, count, createEvaluator, createSyncEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, hierarchicalGlobPattern, iff, implies, indeterminate, nand, none, nor, not, or, prefixPattern, presenceOf, sum, unitsEqual, wildcardPattern, xor };
@@ -4,15 +4,15 @@ import { t as JsonValue } from "./json-value-B1Hjjjri.cjs";
4
4
  /**
5
5
  * An opaque, purely in-process value supplied by the caller, never itself part of the serialised tree and never required to be JSON-serialisable. Descending into a `fold` or a quantifier replaces the context for the sub-node's evaluation with the single resolved item.
6
6
  */
7
- type EvaluationContext = unknown;
8
- type Resolution = {
7
+ export type EvaluationContext = unknown;
8
+ export type Resolution = {
9
9
  found: true;
10
10
  value: ComputedValue;
11
11
  } | {
12
12
  found: false;
13
13
  };
14
14
  /** The `resolveTree` counterpart to `Resolution`: `found: true` carries the referenced tree as opaque JSON, re-validated by the evaluator (see the `treeReference` node kind) rather than trusted as already-shaped `PredicateNode`/`ExpressionNode`. */
15
- type TreeResolution = {
15
+ export type TreeResolution = {
16
16
  found: true;
17
17
  node: JsonValue;
18
18
  } | {
@@ -21,7 +21,7 @@ type TreeResolution = {
21
21
  /**
22
22
  * Three core, required points of extension, plus two further independent optional ones (`resolveDelegate`, `resolveTree`), each supplied separately by the embedding consumer, each treated as pure data to hand over -- never as resolver logic living inside the schema itself. Plain TypeScript interfaces, not Zod schemas: resolvers are never serialised, only ever supplied in-process at evaluation time.
23
23
  */
24
- interface Resolvers {
24
+ export interface Resolvers {
25
25
  /** Resolver 1 -- a single opaque key to a single value (`reference`). */
26
26
  resolveValue: (key: JsonValue, context: EvaluationContext) => Promise<Resolution>;
27
27
  /** Resolver 2 -- an opaque table identifier plus computed keys to a single value (`lookup`). */
@@ -33,5 +33,21 @@ interface Resolvers {
33
33
  /** Optional, separate from the three core contracts -- see the `treeReference` node kind. Absence is `wrong-type`, the same deliberate-absence treatment as an unregistered `resolveDelegate`, not a masked bug -- and keeps this an additive, non-breaking interface change for every existing consumer. */
34
34
  resolveTree?: (key: JsonValue, context: EvaluationContext) => Promise<TreeResolution>;
35
35
  }
36
- //#endregion
37
- export { EvaluationContext, Resolution, Resolvers, TreeResolution };
36
+ /**
37
+ * The resolvers of a synchronous evaluator (`createSyncEvaluator`): the same points of extension as `Resolvers`, each returning its result directly instead of a promise. A resolver of a synchronous evaluator that returns a promise anyway makes the evaluation throw, since it cannot be awaited.
38
+ */
39
+ export interface SyncResolvers {
40
+ /** Synchronous counterpart of `Resolvers.resolveValue`. */
41
+ resolveValue: (key: JsonValue, context: EvaluationContext) => Resolution;
42
+ /** Synchronous counterpart of `Resolvers.resolveLookup`. */
43
+ resolveLookup: (table: JsonValue, keys: readonly ComputedValue[], context: EvaluationContext) => Resolution;
44
+ /** Synchronous counterpart of `Resolvers.resolveCollection`. */
45
+ resolveCollection: (collection: JsonValue, context: EvaluationContext) => unknown[];
46
+ /** Synchronous counterpart of `Resolvers.resolveDelegate`. */
47
+ resolveDelegate?: (system: string, payload: JsonValue, context: EvaluationContext) => Resolution;
48
+ /** Synchronous counterpart of `Resolvers.resolveTree`. */
49
+ resolveTree?: (key: JsonValue, context: EvaluationContext) => TreeResolution;
50
+ }
51
+ /** What the shared node rules accept: either flavour of resolvers, since they only ever hand each result to `wait`. */
52
+ export type EvaluatorResolvers = Resolvers | SyncResolvers;
53
+ //#endregion
@@ -4,15 +4,15 @@ import { t as JsonValue } from "./json-value-B1Hjjjri.js";
4
4
  /**
5
5
  * An opaque, purely in-process value supplied by the caller, never itself part of the serialised tree and never required to be JSON-serialisable. Descending into a `fold` or a quantifier replaces the context for the sub-node's evaluation with the single resolved item.
6
6
  */
7
- type EvaluationContext = unknown;
8
- type Resolution = {
7
+ export type EvaluationContext = unknown;
8
+ export type Resolution = {
9
9
  found: true;
10
10
  value: ComputedValue;
11
11
  } | {
12
12
  found: false;
13
13
  };
14
14
  /** The `resolveTree` counterpart to `Resolution`: `found: true` carries the referenced tree as opaque JSON, re-validated by the evaluator (see the `treeReference` node kind) rather than trusted as already-shaped `PredicateNode`/`ExpressionNode`. */
15
- type TreeResolution = {
15
+ export type TreeResolution = {
16
16
  found: true;
17
17
  node: JsonValue;
18
18
  } | {
@@ -21,7 +21,7 @@ type TreeResolution = {
21
21
  /**
22
22
  * Three core, required points of extension, plus two further independent optional ones (`resolveDelegate`, `resolveTree`), each supplied separately by the embedding consumer, each treated as pure data to hand over -- never as resolver logic living inside the schema itself. Plain TypeScript interfaces, not Zod schemas: resolvers are never serialised, only ever supplied in-process at evaluation time.
23
23
  */
24
- interface Resolvers {
24
+ export interface Resolvers {
25
25
  /** Resolver 1 -- a single opaque key to a single value (`reference`). */
26
26
  resolveValue: (key: JsonValue, context: EvaluationContext) => Promise<Resolution>;
27
27
  /** Resolver 2 -- an opaque table identifier plus computed keys to a single value (`lookup`). */
@@ -33,5 +33,21 @@ interface Resolvers {
33
33
  /** Optional, separate from the three core contracts -- see the `treeReference` node kind. Absence is `wrong-type`, the same deliberate-absence treatment as an unregistered `resolveDelegate`, not a masked bug -- and keeps this an additive, non-breaking interface change for every existing consumer. */
34
34
  resolveTree?: (key: JsonValue, context: EvaluationContext) => Promise<TreeResolution>;
35
35
  }
36
- //#endregion
37
- export { EvaluationContext, Resolution, Resolvers, TreeResolution };
36
+ /**
37
+ * The resolvers of a synchronous evaluator (`createSyncEvaluator`): the same points of extension as `Resolvers`, each returning its result directly instead of a promise. A resolver of a synchronous evaluator that returns a promise anyway makes the evaluation throw, since it cannot be awaited.
38
+ */
39
+ export interface SyncResolvers {
40
+ /** Synchronous counterpart of `Resolvers.resolveValue`. */
41
+ resolveValue: (key: JsonValue, context: EvaluationContext) => Resolution;
42
+ /** Synchronous counterpart of `Resolvers.resolveLookup`. */
43
+ resolveLookup: (table: JsonValue, keys: readonly ComputedValue[], context: EvaluationContext) => Resolution;
44
+ /** Synchronous counterpart of `Resolvers.resolveCollection`. */
45
+ resolveCollection: (collection: JsonValue, context: EvaluationContext) => unknown[];
46
+ /** Synchronous counterpart of `Resolvers.resolveDelegate`. */
47
+ resolveDelegate?: (system: string, payload: JsonValue, context: EvaluationContext) => Resolution;
48
+ /** Synchronous counterpart of `Resolvers.resolveTree`. */
49
+ resolveTree?: (key: JsonValue, context: EvaluationContext) => TreeResolution;
50
+ }
51
+ /** What the shared node rules accept: either flavour of resolvers, since they only ever hand each result to `wait`. */
52
+ export type EvaluatorResolvers = Resolvers | SyncResolvers;
53
+ //#endregion
package/dist/tree.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as JsonValue } from "./json-value-B1Hjjjri.cjs";
2
2
  import { z } from "zod";
3
3
  //#region src/tree.d.ts
4
- declare const ComparisonOperatorSchema: z.ZodEnum<{
4
+ export declare const ComparisonOperatorSchema: z.ZodEnum<{
5
5
  gt: "gt";
6
6
  gte: "gte";
7
7
  lt: "lt";
@@ -9,8 +9,8 @@ declare const ComparisonOperatorSchema: z.ZodEnum<{
9
9
  eq: "eq";
10
10
  neq: "neq";
11
11
  }>;
12
- type ComparisonOperator = z.infer<typeof ComparisonOperatorSchema>;
13
- declare const TextComparisonOperatorSchema: z.ZodEnum<{
12
+ export type ComparisonOperator = z.infer<typeof ComparisonOperatorSchema>;
13
+ export declare const TextComparisonOperatorSchema: z.ZodEnum<{
14
14
  equals: "equals";
15
15
  notEquals: "notEquals";
16
16
  matches: "matches";
@@ -18,13 +18,13 @@ declare const TextComparisonOperatorSchema: z.ZodEnum<{
18
18
  portableMatches: "portableMatches";
19
19
  portableNotMatches: "portableNotMatches";
20
20
  }>;
21
- type TextComparisonOperator = z.infer<typeof TextComparisonOperatorSchema>;
22
- declare const MembershipOperatorSchema: z.ZodEnum<{
21
+ export type TextComparisonOperator = z.infer<typeof TextComparisonOperatorSchema>;
22
+ export declare const MembershipOperatorSchema: z.ZodEnum<{
23
23
  in: "in";
24
24
  notIn: "notIn";
25
25
  }>;
26
- type MembershipOperator = z.infer<typeof MembershipOperatorSchema>;
27
- declare const ArithmeticOperatorSchema: z.ZodEnum<{
26
+ export type MembershipOperator = z.infer<typeof MembershipOperatorSchema>;
27
+ export declare const ArithmeticOperatorSchema: z.ZodEnum<{
28
28
  add: "add";
29
29
  subtract: "subtract";
30
30
  multiply: "multiply";
@@ -32,40 +32,40 @@ declare const ArithmeticOperatorSchema: z.ZodEnum<{
32
32
  power: "power";
33
33
  modulo: "modulo";
34
34
  }>;
35
- type ArithmeticOperator = z.infer<typeof ArithmeticOperatorSchema>;
36
- declare const HitPolicySchema: z.ZodEnum<{
35
+ export type ArithmeticOperator = z.infer<typeof ArithmeticOperatorSchema>;
36
+ export declare const HitPolicySchema: z.ZodEnum<{
37
37
  first: "first";
38
38
  unique: "unique";
39
39
  }>;
40
- type HitPolicy = z.infer<typeof HitPolicySchema>;
41
- declare const NotNodeSchema: z.ZodObject<{
40
+ export type HitPolicy = z.infer<typeof HitPolicySchema>;
41
+ export declare const NotNodeSchema: z.ZodObject<{
42
42
  kind: z.ZodLiteral<"not">;
43
43
  operand: typeof PredicateNodeSchema;
44
44
  }, z.core.$strip>;
45
- type NotNode = z.infer<typeof NotNodeSchema>;
46
- declare const AndNodeSchema: z.ZodObject<{
45
+ export type NotNode = z.infer<typeof NotNodeSchema>;
46
+ export declare const AndNodeSchema: z.ZodObject<{
47
47
  kind: z.ZodLiteral<"and">;
48
48
  left: typeof PredicateNodeSchema;
49
49
  right: typeof PredicateNodeSchema;
50
50
  }, z.core.$strip>;
51
- type AndNode = z.infer<typeof AndNodeSchema>;
52
- declare const OrNodeSchema: z.ZodObject<{
51
+ export type AndNode = z.infer<typeof AndNodeSchema>;
52
+ export declare const OrNodeSchema: z.ZodObject<{
53
53
  kind: z.ZodLiteral<"or">;
54
54
  left: typeof PredicateNodeSchema;
55
55
  right: typeof PredicateNodeSchema;
56
56
  }, z.core.$strip>;
57
- type OrNode = z.infer<typeof OrNodeSchema>;
58
- declare const AllOfNodeSchema: z.ZodObject<{
57
+ export type OrNode = z.infer<typeof OrNodeSchema>;
58
+ export declare const AllOfNodeSchema: z.ZodObject<{
59
59
  kind: z.ZodLiteral<"allOf">;
60
60
  operands: z.ZodArray<typeof PredicateNodeSchema>;
61
61
  }, z.core.$strip>;
62
- type AllOfNode = z.infer<typeof AllOfNodeSchema>;
63
- declare const AnyOfNodeSchema: z.ZodObject<{
62
+ export type AllOfNode = z.infer<typeof AllOfNodeSchema>;
63
+ export declare const AnyOfNodeSchema: z.ZodObject<{
64
64
  kind: z.ZodLiteral<"anyOf">;
65
65
  operands: z.ZodArray<typeof PredicateNodeSchema>;
66
66
  }, z.core.$strip>;
67
- type AnyOfNode = z.infer<typeof AnyOfNodeSchema>;
68
- declare const CompareNodeSchema: z.ZodObject<{
67
+ export type AnyOfNode = z.infer<typeof AnyOfNodeSchema>;
68
+ export declare const CompareNodeSchema: z.ZodObject<{
69
69
  kind: z.ZodLiteral<"compare">;
70
70
  op: z.ZodEnum<{
71
71
  gt: "gt";
@@ -78,8 +78,8 @@ declare const CompareNodeSchema: z.ZodObject<{
78
78
  left: typeof ExpressionNodeSchema;
79
79
  right: typeof ExpressionNodeSchema;
80
80
  }, z.core.$strip>;
81
- type CompareNode = z.infer<typeof CompareNodeSchema>;
82
- declare const TextCompareNodeSchema: z.ZodObject<{
81
+ export type CompareNode = z.infer<typeof CompareNodeSchema>;
82
+ export declare const TextCompareNodeSchema: z.ZodObject<{
83
83
  kind: z.ZodLiteral<"textCompare">;
84
84
  op: z.ZodEnum<{
85
85
  equals: "equals";
@@ -92,8 +92,8 @@ declare const TextCompareNodeSchema: z.ZodObject<{
92
92
  left: typeof ExpressionNodeSchema;
93
93
  right: typeof ExpressionNodeSchema;
94
94
  }, z.core.$strip>;
95
- type TextCompareNode = z.infer<typeof TextCompareNodeSchema>;
96
- declare const MemberOfNodeSchema: z.ZodObject<{
95
+ export type TextCompareNode = z.infer<typeof TextCompareNodeSchema>;
96
+ export declare const MemberOfNodeSchema: z.ZodObject<{
97
97
  kind: z.ZodLiteral<"memberOf">;
98
98
  op: z.ZodEnum<{
99
99
  in: "in";
@@ -102,33 +102,33 @@ declare const MemberOfNodeSchema: z.ZodObject<{
102
102
  operand: typeof ExpressionNodeSchema;
103
103
  candidates: z.ZodArray<typeof ExpressionNodeSchema>;
104
104
  }, z.core.$strip>;
105
- type MemberOfNode = z.infer<typeof MemberOfNodeSchema>;
106
- declare const ExistsNodeSchema: z.ZodObject<{
105
+ export type MemberOfNode = z.infer<typeof MemberOfNodeSchema>;
106
+ export declare const ExistsNodeSchema: z.ZodObject<{
107
107
  kind: z.ZodLiteral<"exists">;
108
108
  operand: typeof ExpressionNodeSchema;
109
109
  }, z.core.$strip>;
110
- type ExistsNode = z.infer<typeof ExistsNodeSchema>;
111
- declare const SomeNodeSchema: z.ZodObject<{
110
+ export type ExistsNode = z.infer<typeof ExistsNodeSchema>;
111
+ export declare const SomeNodeSchema: z.ZodObject<{
112
112
  kind: z.ZodLiteral<"some">;
113
113
  collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
114
114
  item: typeof PredicateNodeSchema;
115
115
  filter: z.ZodOptional<typeof PredicateNodeSchema>;
116
116
  }, z.core.$strip>;
117
- type SomeNode = z.infer<typeof SomeNodeSchema>;
118
- declare const EveryNodeSchema: z.ZodObject<{
117
+ export type SomeNode = z.infer<typeof SomeNodeSchema>;
118
+ export declare const EveryNodeSchema: z.ZodObject<{
119
119
  kind: z.ZodLiteral<"every">;
120
120
  collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
121
121
  item: typeof PredicateNodeSchema;
122
122
  filter: z.ZodOptional<typeof PredicateNodeSchema>;
123
123
  }, z.core.$strip>;
124
- type EveryNode = z.infer<typeof EveryNodeSchema>;
124
+ export type EveryNode = z.infer<typeof EveryNodeSchema>;
125
125
  /** Shared by both trees -- the only node kind valid in both PredicateNodeSchema's and ExpressionNodeSchema's own discriminated unions, appended as the last member of each below. Declared once, here, ahead of the predicate union that needs it first; the expression union further down references this exact same schema object again rather than declaring its own copy. See the `treeReference` section of README.md. */
126
- declare const TreeReferenceNodeSchema: z.ZodObject<{
126
+ export declare const TreeReferenceNodeSchema: z.ZodObject<{
127
127
  kind: z.ZodLiteral<"treeReference">;
128
128
  key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
129
129
  }, z.core.$strip>;
130
- type TreeReferenceNode = z.infer<typeof TreeReferenceNodeSchema>;
131
- declare const PredicateNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
130
+ export type TreeReferenceNode = z.infer<typeof TreeReferenceNodeSchema>;
131
+ export declare const PredicateNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
132
132
  kind: z.ZodLiteral<"not">;
133
133
  operand: typeof PredicateNodeSchema;
134
134
  }, z.core.$strip>, z.ZodObject<{
@@ -194,29 +194,29 @@ declare const PredicateNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
194
194
  kind: z.ZodLiteral<"treeReference">;
195
195
  key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
196
196
  }, z.core.$strip>], "kind">;
197
- type PredicateNode = z.infer<typeof PredicateNodeSchema>;
198
- declare const NumberLiteralNodeSchema: z.ZodObject<{
197
+ export type PredicateNode = z.infer<typeof PredicateNodeSchema>;
198
+ export declare const NumberLiteralNodeSchema: z.ZodObject<{
199
199
  kind: z.ZodLiteral<"numberLiteral">;
200
200
  value: z.ZodNumber;
201
201
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
202
202
  }, z.core.$strip>;
203
- type NumberLiteralNode = z.infer<typeof NumberLiteralNodeSchema>;
204
- declare const TextLiteralNodeSchema: z.ZodObject<{
203
+ export type NumberLiteralNode = z.infer<typeof NumberLiteralNodeSchema>;
204
+ export declare const TextLiteralNodeSchema: z.ZodObject<{
205
205
  kind: z.ZodLiteral<"textLiteral">;
206
206
  value: z.ZodString;
207
207
  }, z.core.$strip>;
208
- type TextLiteralNode = z.infer<typeof TextLiteralNodeSchema>;
209
- declare const BooleanLiteralNodeSchema: z.ZodObject<{
208
+ export type TextLiteralNode = z.infer<typeof TextLiteralNodeSchema>;
209
+ export declare const BooleanLiteralNodeSchema: z.ZodObject<{
210
210
  kind: z.ZodLiteral<"booleanLiteral">;
211
211
  value: z.ZodBoolean;
212
212
  }, z.core.$strip>;
213
- type BooleanLiteralNode = z.infer<typeof BooleanLiteralNodeSchema>;
214
- declare const InstantLiteralNodeSchema: z.ZodObject<{
213
+ export type BooleanLiteralNode = z.infer<typeof BooleanLiteralNodeSchema>;
214
+ export declare const InstantLiteralNodeSchema: z.ZodObject<{
215
215
  kind: z.ZodLiteral<"instantLiteral">;
216
216
  value: z.ZodString;
217
217
  }, z.core.$strip>;
218
- type InstantLiteralNode = z.infer<typeof InstantLiteralNodeSchema>;
219
- declare const DurationLiteralNodeSchema: z.ZodObject<{
218
+ export type InstantLiteralNode = z.infer<typeof InstantLiteralNodeSchema>;
219
+ export declare const DurationLiteralNodeSchema: z.ZodObject<{
220
220
  kind: z.ZodLiteral<"durationLiteral">;
221
221
  value: z.ZodNumber;
222
222
  unit: z.ZodEnum<{
@@ -227,28 +227,28 @@ declare const DurationLiteralNodeSchema: z.ZodObject<{
227
227
  d: "d";
228
228
  }>;
229
229
  }, z.core.$strip>;
230
- type DurationLiteralNode = z.infer<typeof DurationLiteralNodeSchema>;
230
+ export type DurationLiteralNode = z.infer<typeof DurationLiteralNodeSchema>;
231
231
  /**
232
232
  * The wire-format literal accepts either of the two authoring forms real-world complex data arrives in, discriminated structurally rather than by a `form` tag: rectangular (`re`/`im`), matching the `complex` computed-value kind's own single canonical representation exactly (see the "Complex values" section of README.md), or polar (`magnitude`/`phase`, in radians), for the domains that reason that way natively and would otherwise have to hand-compute the conversion before ever constructing the tree. `strictObject` on both members is what makes the two forms mutually exclusive on the wire -- a plain `object` would silently strip an unrecognised field rather than reject a payload that mixes both.
233
233
  *
234
234
  * The evaluator normalises whichever form was authored into the single rectangular `ComputedValue` immediately on evaluation (see the `complexLiteral` case in evaluator.ts), so nothing downstream of that -- arithmetic, `compare`, `memberOf`, `negate` -- ever sees a polar value; they keep consuming the one canonical `complex` shape unchanged.
235
235
  */
236
- declare const ComplexRectangularLiteralNodeSchema: z.ZodObject<{
236
+ export declare const ComplexRectangularLiteralNodeSchema: z.ZodObject<{
237
237
  kind: z.ZodLiteral<"complexLiteral">;
238
238
  re: z.ZodNumber;
239
239
  im: z.ZodNumber;
240
240
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
241
241
  }, z.core.$strict>;
242
- type ComplexRectangularLiteralNode = z.infer<typeof ComplexRectangularLiteralNodeSchema>;
243
- declare const ComplexPolarLiteralNodeSchema: z.ZodObject<{
242
+ export type ComplexRectangularLiteralNode = z.infer<typeof ComplexRectangularLiteralNodeSchema>;
243
+ export declare const ComplexPolarLiteralNodeSchema: z.ZodObject<{
244
244
  kind: z.ZodLiteral<"complexLiteral">;
245
245
  magnitude: z.ZodNumber;
246
246
  phase: z.ZodNumber;
247
247
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
248
248
  }, z.core.$strict>;
249
- type ComplexPolarLiteralNode = z.infer<typeof ComplexPolarLiteralNodeSchema>;
249
+ export type ComplexPolarLiteralNode = z.infer<typeof ComplexPolarLiteralNodeSchema>;
250
250
  /** Both literal forms share the one literal `kind: "complexLiteral"` value, which is exactly why this is a plain `z.union` rather than a `z.discriminatedUnion` -- `z.discriminatedUnion` requires a unique discriminant literal per member and throws ("Duplicate discriminator value") the moment two members share one. `ExpressionNodeSchema` below folds this plain union in alongside its own discriminated union of every other kind, rather than trying to host it as a normal member. */
251
- declare const ComplexLiteralNodeSchema: z.ZodUnion<readonly [z.ZodObject<{
251
+ export declare const ComplexLiteralNodeSchema: z.ZodUnion<readonly [z.ZodObject<{
252
252
  kind: z.ZodLiteral<"complexLiteral">;
253
253
  re: z.ZodNumber;
254
254
  im: z.ZodNumber;
@@ -259,14 +259,14 @@ declare const ComplexLiteralNodeSchema: z.ZodUnion<readonly [z.ZodObject<{
259
259
  phase: z.ZodNumber;
260
260
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
261
261
  }, z.core.$strict>]>;
262
- type ComplexLiteralNode = z.infer<typeof ComplexLiteralNodeSchema>;
263
- declare const ReferenceNodeSchema: z.ZodObject<{
262
+ export type ComplexLiteralNode = z.infer<typeof ComplexLiteralNodeSchema>;
263
+ export declare const ReferenceNodeSchema: z.ZodObject<{
264
264
  kind: z.ZodLiteral<"reference">;
265
265
  key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
266
266
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
267
267
  }, z.core.$strip>;
268
- type ReferenceNode = z.infer<typeof ReferenceNodeSchema>;
269
- declare const ArithmeticNodeSchema: z.ZodObject<{
268
+ export type ReferenceNode = z.infer<typeof ReferenceNodeSchema>;
269
+ export declare const ArithmeticNodeSchema: z.ZodObject<{
270
270
  kind: z.ZodLiteral<"arithmetic">;
271
271
  op: z.ZodEnum<{
272
272
  add: "add";
@@ -279,30 +279,30 @@ declare const ArithmeticNodeSchema: z.ZodObject<{
279
279
  left: typeof ExpressionNodeSchema;
280
280
  right: typeof ExpressionNodeSchema;
281
281
  }, z.core.$strip>;
282
- type ArithmeticNode = z.infer<typeof ArithmeticNodeSchema>;
283
- declare const NegateNodeSchema: z.ZodObject<{
282
+ export type ArithmeticNode = z.infer<typeof ArithmeticNodeSchema>;
283
+ export declare const NegateNodeSchema: z.ZodObject<{
284
284
  kind: z.ZodLiteral<"negate">;
285
285
  operand: typeof ExpressionNodeSchema;
286
286
  }, z.core.$strip>;
287
- type NegateNode = z.infer<typeof NegateNodeSchema>;
288
- declare const CallNodeSchema: z.ZodObject<{
287
+ export type NegateNode = z.infer<typeof NegateNodeSchema>;
288
+ export declare const CallNodeSchema: z.ZodObject<{
289
289
  kind: z.ZodLiteral<"call">;
290
290
  fn: z.ZodString;
291
291
  args: z.ZodArray<typeof ExpressionNodeSchema>;
292
292
  }, z.core.$strip>;
293
- type CallNode = z.infer<typeof CallNodeSchema>;
294
- declare const LookupNodeSchema: z.ZodObject<{
293
+ export type CallNode = z.infer<typeof CallNodeSchema>;
294
+ export declare const LookupNodeSchema: z.ZodObject<{
295
295
  kind: z.ZodLiteral<"lookup">;
296
296
  table: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
297
297
  keys: z.ZodArray<typeof ExpressionNodeSchema>;
298
298
  }, z.core.$strip>;
299
- type LookupNode = z.infer<typeof LookupNodeSchema>;
300
- declare const ConditionalCaseSchema: z.ZodObject<{
299
+ export type LookupNode = z.infer<typeof LookupNodeSchema>;
300
+ export declare const ConditionalCaseSchema: z.ZodObject<{
301
301
  when: typeof PredicateNodeSchema;
302
302
  then: typeof ExpressionNodeSchema;
303
303
  }, z.core.$strip>;
304
- type ConditionalCase = z.infer<typeof ConditionalCaseSchema>;
305
- declare const ConditionalNodeSchema: z.ZodObject<{
304
+ export type ConditionalCase = z.infer<typeof ConditionalCaseSchema>;
305
+ export declare const ConditionalNodeSchema: z.ZodObject<{
306
306
  kind: z.ZodLiteral<"conditional">;
307
307
  hitPolicy: z.ZodOptional<z.ZodEnum<{
308
308
  first: "first";
@@ -311,8 +311,8 @@ declare const ConditionalNodeSchema: z.ZodObject<{
311
311
  cases: z.ZodArray<typeof ConditionalCaseSchema>;
312
312
  fallback: typeof ExpressionNodeSchema;
313
313
  }, z.core.$strip>;
314
- type ConditionalNode = z.infer<typeof ConditionalNodeSchema>;
315
- declare const FoldCombinerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
314
+ export type ConditionalNode = z.infer<typeof ConditionalNodeSchema>;
315
+ export declare const FoldCombinerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
316
316
  mode: z.ZodLiteral<"max">;
317
317
  item: typeof ExpressionNodeSchema;
318
318
  }, z.core.$strip>, z.ZodObject<{
@@ -323,8 +323,8 @@ declare const FoldCombinerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
323
323
  initial: typeof ExpressionNodeSchema;
324
324
  combine: typeof ExpressionNodeSchema;
325
325
  }, z.core.$strip>], "mode">;
326
- type FoldCombiner = z.infer<typeof FoldCombinerSchema>;
327
- declare const FoldNodeSchema: z.ZodObject<{
326
+ export type FoldCombiner = z.infer<typeof FoldCombinerSchema>;
327
+ export declare const FoldNodeSchema: z.ZodObject<{
328
328
  kind: z.ZodLiteral<"fold">;
329
329
  collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
330
330
  filter: z.ZodOptional<typeof PredicateNodeSchema>;
@@ -340,18 +340,18 @@ declare const FoldNodeSchema: z.ZodObject<{
340
340
  combine: typeof ExpressionNodeSchema;
341
341
  }, z.core.$strip>], "mode">;
342
342
  }, z.core.$strip>;
343
- type FoldNode = z.infer<typeof FoldNodeSchema>;
344
- declare const AccumulatorNodeSchema: z.ZodObject<{
343
+ export type FoldNode = z.infer<typeof FoldNodeSchema>;
344
+ export declare const AccumulatorNodeSchema: z.ZodObject<{
345
345
  kind: z.ZodLiteral<"accumulator">;
346
346
  }, z.core.$strip>;
347
- type AccumulatorNode = z.infer<typeof AccumulatorNodeSchema>;
348
- declare const DelegateNodeSchema: z.ZodObject<{
347
+ export type AccumulatorNode = z.infer<typeof AccumulatorNodeSchema>;
348
+ export declare const DelegateNodeSchema: z.ZodObject<{
349
349
  kind: z.ZodLiteral<"delegate">;
350
350
  system: z.ZodString;
351
351
  payload: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
352
352
  }, z.core.$strip>;
353
- type DelegateNode = z.infer<typeof DelegateNodeSchema>;
354
- declare const ExpressionNodeSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
353
+ export type DelegateNode = z.infer<typeof DelegateNodeSchema>;
354
+ export declare const ExpressionNodeSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
355
355
  kind: z.ZodLiteral<"numberLiteral">;
356
356
  value: z.ZodNumber;
357
357
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
@@ -444,6 +444,5 @@ declare const ExpressionNodeSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion
444
444
  phase: z.ZodNumber;
445
445
  unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
446
446
  }, z.core.$strict>]>]>;
447
- type ExpressionNode = z.infer<typeof ExpressionNodeSchema>;
448
- //#endregion
449
- export { AccumulatorNode, AccumulatorNodeSchema, AllOfNode, AllOfNodeSchema, AndNode, AndNodeSchema, AnyOfNode, AnyOfNodeSchema, ArithmeticNode, ArithmeticNodeSchema, ArithmeticOperator, ArithmeticOperatorSchema, BooleanLiteralNode, BooleanLiteralNodeSchema, CallNode, CallNodeSchema, CompareNode, CompareNodeSchema, ComparisonOperator, ComparisonOperatorSchema, ComplexLiteralNode, ComplexLiteralNodeSchema, ComplexPolarLiteralNode, ComplexPolarLiteralNodeSchema, ComplexRectangularLiteralNode, ComplexRectangularLiteralNodeSchema, ConditionalCase, ConditionalCaseSchema, ConditionalNode, ConditionalNodeSchema, DelegateNode, DelegateNodeSchema, DurationLiteralNode, DurationLiteralNodeSchema, EveryNode, EveryNodeSchema, ExistsNode, ExistsNodeSchema, ExpressionNode, ExpressionNodeSchema, FoldCombiner, FoldCombinerSchema, FoldNode, FoldNodeSchema, HitPolicy, HitPolicySchema, InstantLiteralNode, InstantLiteralNodeSchema, LookupNode, LookupNodeSchema, MemberOfNode, MemberOfNodeSchema, MembershipOperator, MembershipOperatorSchema, NegateNode, NegateNodeSchema, NotNode, NotNodeSchema, NumberLiteralNode, NumberLiteralNodeSchema, OrNode, OrNodeSchema, PredicateNode, PredicateNodeSchema, ReferenceNode, ReferenceNodeSchema, SomeNode, SomeNodeSchema, TextCompareNode, TextCompareNodeSchema, TextComparisonOperator, TextComparisonOperatorSchema, TextLiteralNode, TextLiteralNodeSchema, TreeReferenceNode, TreeReferenceNodeSchema };
447
+ export type ExpressionNode = z.infer<typeof ExpressionNodeSchema>;
448
+ //#endregion