trilean 1.1.0 → 1.3.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.
- package/README.md +130 -19
- package/dist/complex.cjs +34 -0
- package/dist/complex.d.cts +23 -0
- package/dist/complex.d.ts +23 -0
- package/dist/complex.js +30 -0
- package/dist/computed-value.cjs +10 -0
- package/dist/computed-value.d.cts +8 -0
- package/dist/computed-value.d.ts +8 -0
- package/dist/computed-value.js +10 -0
- package/dist/derived-patterns.cjs +94 -0
- package/dist/derived-patterns.d.cts +7 -0
- package/dist/derived-patterns.d.ts +7 -0
- package/dist/derived-patterns.js +91 -0
- package/dist/evaluator.cjs +113 -4
- package/dist/evaluator.js +113 -4
- package/dist/index.cjs +13 -0
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/tree.cjs +31 -1
- package/dist/tree.d.cts +53 -3
- package/dist/tree.d.ts +53 -3
- package/dist/tree.js +28 -2
- package/package.json +1 -1
- package/schemas/trilean.schema.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ComputedValue, ComputedValueSchema, DurationUnit, DurationUnitSchema, Unit, UnitSchema, combineUnitsForDivide, combineUnitsForMultiply, unitsEqual } from "./computed-value.cjs";
|
|
2
2
|
import { n as JsonValueSchema, t as JsonValue } from "./json-value-B1Hjjjri.cjs";
|
|
3
|
-
import { AccumulatorNode, AccumulatorNodeSchema, AllOfNode, AllOfNodeSchema, AndNode, AndNodeSchema, AnyOfNode, AnyOfNodeSchema, ArithmeticNode, ArithmeticNodeSchema, ArithmeticOperator, ArithmeticOperatorSchema, CallNode, CallNodeSchema, CompareNode, CompareNodeSchema, ComparisonOperator, ComparisonOperatorSchema, 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 } from "./tree.cjs";
|
|
3
|
+
import { 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 } from "./tree.cjs";
|
|
4
|
+
import { complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase } from "./complex.cjs";
|
|
4
5
|
import { average, count, presenceOf, sum } from "./derived-aggregates.cjs";
|
|
5
6
|
import { and, iff, implies, nand, none, nor, not, or, xor } from "./derived-connectives.cjs";
|
|
7
|
+
import { hierarchicalGlobPattern, prefixPattern, wildcardPattern } from "./derived-patterns.cjs";
|
|
6
8
|
import { coalesce } from "./derived-values.cjs";
|
|
7
9
|
import { Evaluation, IndeterminateReason, IndeterminateReasonSchema, definite, firstIndeterminate, indeterminate } from "./evaluation.cjs";
|
|
8
10
|
import { FunctionRegistry, emptyFunctionRegistry } from "./functions.cjs";
|
|
9
11
|
import { EvaluationContext, Resolution, Resolvers, TreeResolution } from "./resolvers.cjs";
|
|
10
12
|
import { createEvaluator, evaluatePredicate, evaluateValue } from "./evaluator.cjs";
|
|
11
|
-
export { type AccumulatorNode, AccumulatorNodeSchema, type AllOfNode, AllOfNodeSchema, type AndNode, AndNodeSchema, type AnyOfNode, AnyOfNodeSchema, type ArithmeticNode, ArithmeticNodeSchema, type ArithmeticOperator, ArithmeticOperatorSchema, type CallNode, CallNodeSchema, type CompareNode, CompareNodeSchema, type ComparisonOperator, ComparisonOperatorSchema, 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, count, createEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, iff, implies, indeterminate, nand, none, nor, not, or, presenceOf, sum, unitsEqual, xor };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ComputedValue, ComputedValueSchema, DurationUnit, DurationUnitSchema, Unit, UnitSchema, combineUnitsForDivide, combineUnitsForMultiply, unitsEqual } from "./computed-value.js";
|
|
2
2
|
import { n as JsonValueSchema, t as JsonValue } from "./json-value-B1Hjjjri.js";
|
|
3
|
-
import { AccumulatorNode, AccumulatorNodeSchema, AllOfNode, AllOfNodeSchema, AndNode, AndNodeSchema, AnyOfNode, AnyOfNodeSchema, ArithmeticNode, ArithmeticNodeSchema, ArithmeticOperator, ArithmeticOperatorSchema, CallNode, CallNodeSchema, CompareNode, CompareNodeSchema, ComparisonOperator, ComparisonOperatorSchema, 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 } from "./tree.js";
|
|
3
|
+
import { 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 } from "./tree.js";
|
|
4
|
+
import { complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase } from "./complex.js";
|
|
4
5
|
import { average, count, presenceOf, sum } from "./derived-aggregates.js";
|
|
5
6
|
import { and, iff, implies, nand, none, nor, not, or, xor } from "./derived-connectives.js";
|
|
7
|
+
import { hierarchicalGlobPattern, prefixPattern, wildcardPattern } from "./derived-patterns.js";
|
|
6
8
|
import { coalesce } from "./derived-values.js";
|
|
7
9
|
import { Evaluation, IndeterminateReason, IndeterminateReasonSchema, definite, firstIndeterminate, indeterminate } from "./evaluation.js";
|
|
8
10
|
import { FunctionRegistry, emptyFunctionRegistry } from "./functions.js";
|
|
9
11
|
import { EvaluationContext, Resolution, Resolvers, TreeResolution } from "./resolvers.js";
|
|
10
12
|
import { createEvaluator, evaluatePredicate, evaluateValue } from "./evaluator.js";
|
|
11
|
-
export { type AccumulatorNode, AccumulatorNodeSchema, type AllOfNode, AllOfNodeSchema, type AndNode, AndNodeSchema, type AnyOfNode, AnyOfNodeSchema, type ArithmeticNode, ArithmeticNodeSchema, type ArithmeticOperator, ArithmeticOperatorSchema, type CallNode, CallNodeSchema, type CompareNode, CompareNodeSchema, type ComparisonOperator, ComparisonOperatorSchema, 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, count, createEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, iff, implies, indeterminate, nand, none, nor, not, or, presenceOf, sum, unitsEqual, xor };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { complexFromPolar, complexLiteralFromPolar, complexMagnitude, complexPhase } from "./complex.js";
|
|
1
2
|
import { ComputedValueSchema, DurationUnitSchema, UnitSchema, combineUnitsForDivide, combineUnitsForMultiply, unitsEqual } from "./computed-value.js";
|
|
2
3
|
import { average, count, presenceOf, sum } from "./derived-aggregates.js";
|
|
3
4
|
import { and, iff, implies, nand, none, nor, not, or, xor } from "./derived-connectives.js";
|
|
5
|
+
import { hierarchicalGlobPattern, prefixPattern, wildcardPattern } from "./derived-patterns.js";
|
|
4
6
|
import { coalesce } from "./derived-values.js";
|
|
5
7
|
import { IndeterminateReasonSchema, definite, firstIndeterminate, indeterminate } from "./evaluation.js";
|
|
6
8
|
import { emptyFunctionRegistry } from "./functions.js";
|
|
7
9
|
import { JsonValueSchema } from "./json-value.js";
|
|
8
|
-
import { AccumulatorNodeSchema, AllOfNodeSchema, AndNodeSchema, AnyOfNodeSchema, ArithmeticNodeSchema, ArithmeticOperatorSchema, CallNodeSchema, CompareNodeSchema, ComparisonOperatorSchema, 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
|
+
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";
|
|
9
11
|
import { createEvaluator, evaluatePredicate, evaluateValue } from "./evaluator.js";
|
|
10
|
-
export { AccumulatorNodeSchema, AllOfNodeSchema, AndNodeSchema, AnyOfNodeSchema, ArithmeticNodeSchema, ArithmeticOperatorSchema, CallNodeSchema, CompareNodeSchema, ComparisonOperatorSchema, 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, count, createEvaluator, definite, emptyFunctionRegistry, evaluatePredicate, evaluateValue, firstIndeterminate, iff, implies, indeterminate, nand, none, nor, not, or, presenceOf, sum, unitsEqual, xor };
|
|
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 };
|
package/dist/tree.cjs
CHANGED
|
@@ -147,6 +147,10 @@ const TextLiteralNodeSchema = zod.z.object({
|
|
|
147
147
|
kind: zod.z.literal("textLiteral"),
|
|
148
148
|
value: zod.z.string()
|
|
149
149
|
});
|
|
150
|
+
const BooleanLiteralNodeSchema = zod.z.object({
|
|
151
|
+
kind: zod.z.literal("booleanLiteral"),
|
|
152
|
+
value: zod.z.boolean()
|
|
153
|
+
});
|
|
150
154
|
const InstantLiteralNodeSchema = zod.z.object({
|
|
151
155
|
kind: zod.z.literal("instantLiteral"),
|
|
152
156
|
/** ISO-8601 timestamp. */
|
|
@@ -157,6 +161,25 @@ const DurationLiteralNodeSchema = zod.z.object({
|
|
|
157
161
|
value: zod.z.number(),
|
|
158
162
|
unit: require_computed_value.DurationUnitSchema
|
|
159
163
|
});
|
|
164
|
+
/**
|
|
165
|
+
* 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.
|
|
166
|
+
*
|
|
167
|
+
* 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.
|
|
168
|
+
*/
|
|
169
|
+
const ComplexRectangularLiteralNodeSchema = zod.z.strictObject({
|
|
170
|
+
kind: zod.z.literal("complexLiteral"),
|
|
171
|
+
re: zod.z.number(),
|
|
172
|
+
im: zod.z.number(),
|
|
173
|
+
unit: require_computed_value.UnitSchema.optional()
|
|
174
|
+
});
|
|
175
|
+
const ComplexPolarLiteralNodeSchema = zod.z.strictObject({
|
|
176
|
+
kind: zod.z.literal("complexLiteral"),
|
|
177
|
+
magnitude: zod.z.number(),
|
|
178
|
+
phase: zod.z.number(),
|
|
179
|
+
unit: require_computed_value.UnitSchema.optional()
|
|
180
|
+
});
|
|
181
|
+
/** 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. */
|
|
182
|
+
const ComplexLiteralNodeSchema = zod.z.union([ComplexRectangularLiteralNodeSchema, ComplexPolarLiteralNodeSchema]);
|
|
160
183
|
const ReferenceNodeSchema = zod.z.object({
|
|
161
184
|
kind: zod.z.literal("reference"),
|
|
162
185
|
key: require_json_value.JsonValueSchema,
|
|
@@ -248,9 +271,11 @@ const DelegateNodeSchema = zod.z.object({
|
|
|
248
271
|
system: zod.z.string(),
|
|
249
272
|
payload: require_json_value.JsonValueSchema
|
|
250
273
|
});
|
|
251
|
-
|
|
274
|
+
/** Every expression node kind except `complexLiteral`, which cannot be a member of this same discriminated union alongside its own two forms (see `ComplexLiteralNodeSchema` above) -- folded back in below via a plain `z.union` rather than `z.discriminatedUnion`. */
|
|
275
|
+
const CoreExpressionNodeSchema = zod.z.discriminatedUnion("kind", [
|
|
252
276
|
NumberLiteralNodeSchema,
|
|
253
277
|
TextLiteralNodeSchema,
|
|
278
|
+
BooleanLiteralNodeSchema,
|
|
254
279
|
InstantLiteralNodeSchema,
|
|
255
280
|
DurationLiteralNodeSchema,
|
|
256
281
|
ReferenceNodeSchema,
|
|
@@ -264,6 +289,7 @@ const ExpressionNodeSchema = zod.z.discriminatedUnion("kind", [
|
|
|
264
289
|
DelegateNodeSchema,
|
|
265
290
|
TreeReferenceNodeSchema
|
|
266
291
|
]);
|
|
292
|
+
const ExpressionNodeSchema = zod.z.union([CoreExpressionNodeSchema, ComplexLiteralNodeSchema]);
|
|
267
293
|
//#endregion
|
|
268
294
|
exports.AccumulatorNodeSchema = AccumulatorNodeSchema;
|
|
269
295
|
exports.AllOfNodeSchema = AllOfNodeSchema;
|
|
@@ -271,9 +297,13 @@ exports.AndNodeSchema = AndNodeSchema;
|
|
|
271
297
|
exports.AnyOfNodeSchema = AnyOfNodeSchema;
|
|
272
298
|
exports.ArithmeticNodeSchema = ArithmeticNodeSchema;
|
|
273
299
|
exports.ArithmeticOperatorSchema = ArithmeticOperatorSchema;
|
|
300
|
+
exports.BooleanLiteralNodeSchema = BooleanLiteralNodeSchema;
|
|
274
301
|
exports.CallNodeSchema = CallNodeSchema;
|
|
275
302
|
exports.CompareNodeSchema = CompareNodeSchema;
|
|
276
303
|
exports.ComparisonOperatorSchema = ComparisonOperatorSchema;
|
|
304
|
+
exports.ComplexLiteralNodeSchema = ComplexLiteralNodeSchema;
|
|
305
|
+
exports.ComplexPolarLiteralNodeSchema = ComplexPolarLiteralNodeSchema;
|
|
306
|
+
exports.ComplexRectangularLiteralNodeSchema = ComplexRectangularLiteralNodeSchema;
|
|
277
307
|
exports.ConditionalCaseSchema = ConditionalCaseSchema;
|
|
278
308
|
exports.ConditionalNodeSchema = ConditionalNodeSchema;
|
|
279
309
|
exports.DelegateNodeSchema = DelegateNodeSchema;
|
package/dist/tree.d.cts
CHANGED
|
@@ -200,6 +200,11 @@ declare const TextLiteralNodeSchema: z.ZodObject<{
|
|
|
200
200
|
value: z.ZodString;
|
|
201
201
|
}, z.core.$strip>;
|
|
202
202
|
type TextLiteralNode = z.infer<typeof TextLiteralNodeSchema>;
|
|
203
|
+
declare const BooleanLiteralNodeSchema: z.ZodObject<{
|
|
204
|
+
kind: z.ZodLiteral<"booleanLiteral">;
|
|
205
|
+
value: z.ZodBoolean;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
type BooleanLiteralNode = z.infer<typeof BooleanLiteralNodeSchema>;
|
|
203
208
|
declare const InstantLiteralNodeSchema: z.ZodObject<{
|
|
204
209
|
kind: z.ZodLiteral<"instantLiteral">;
|
|
205
210
|
value: z.ZodString;
|
|
@@ -217,6 +222,38 @@ declare const DurationLiteralNodeSchema: z.ZodObject<{
|
|
|
217
222
|
}>;
|
|
218
223
|
}, z.core.$strip>;
|
|
219
224
|
type DurationLiteralNode = z.infer<typeof DurationLiteralNodeSchema>;
|
|
225
|
+
/**
|
|
226
|
+
* 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.
|
|
227
|
+
*
|
|
228
|
+
* 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.
|
|
229
|
+
*/
|
|
230
|
+
declare const ComplexRectangularLiteralNodeSchema: z.ZodObject<{
|
|
231
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
232
|
+
re: z.ZodNumber;
|
|
233
|
+
im: z.ZodNumber;
|
|
234
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
type ComplexRectangularLiteralNode = z.infer<typeof ComplexRectangularLiteralNodeSchema>;
|
|
237
|
+
declare const ComplexPolarLiteralNodeSchema: z.ZodObject<{
|
|
238
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
239
|
+
magnitude: z.ZodNumber;
|
|
240
|
+
phase: z.ZodNumber;
|
|
241
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
242
|
+
}, z.core.$strict>;
|
|
243
|
+
type ComplexPolarLiteralNode = z.infer<typeof ComplexPolarLiteralNodeSchema>;
|
|
244
|
+
/** 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. */
|
|
245
|
+
declare const ComplexLiteralNodeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
246
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
247
|
+
re: z.ZodNumber;
|
|
248
|
+
im: z.ZodNumber;
|
|
249
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
250
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
251
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
252
|
+
magnitude: z.ZodNumber;
|
|
253
|
+
phase: z.ZodNumber;
|
|
254
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
255
|
+
}, z.core.$strict>]>;
|
|
256
|
+
type ComplexLiteralNode = z.infer<typeof ComplexLiteralNodeSchema>;
|
|
220
257
|
declare const ReferenceNodeSchema: z.ZodObject<{
|
|
221
258
|
kind: z.ZodLiteral<"reference">;
|
|
222
259
|
key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
@@ -308,13 +345,16 @@ declare const DelegateNodeSchema: z.ZodObject<{
|
|
|
308
345
|
payload: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
309
346
|
}, z.core.$strip>;
|
|
310
347
|
type DelegateNode = z.infer<typeof DelegateNodeSchema>;
|
|
311
|
-
declare const ExpressionNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
348
|
+
declare const ExpressionNodeSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
312
349
|
kind: z.ZodLiteral<"numberLiteral">;
|
|
313
350
|
value: z.ZodNumber;
|
|
314
351
|
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
315
352
|
}, z.core.$strip>, z.ZodObject<{
|
|
316
353
|
kind: z.ZodLiteral<"textLiteral">;
|
|
317
354
|
value: z.ZodString;
|
|
355
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
356
|
+
kind: z.ZodLiteral<"booleanLiteral">;
|
|
357
|
+
value: z.ZodBoolean;
|
|
318
358
|
}, z.core.$strip>, z.ZodObject<{
|
|
319
359
|
kind: z.ZodLiteral<"instantLiteral">;
|
|
320
360
|
value: z.ZodString;
|
|
@@ -387,7 +427,17 @@ declare const ExpressionNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
387
427
|
}, z.core.$strip>, z.ZodObject<{
|
|
388
428
|
kind: z.ZodLiteral<"treeReference">;
|
|
389
429
|
key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
390
|
-
}, z.core.$strip>], "kind"
|
|
430
|
+
}, z.core.$strip>], "kind">, z.ZodUnion<readonly [z.ZodObject<{
|
|
431
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
432
|
+
re: z.ZodNumber;
|
|
433
|
+
im: z.ZodNumber;
|
|
434
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
435
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
436
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
437
|
+
magnitude: z.ZodNumber;
|
|
438
|
+
phase: z.ZodNumber;
|
|
439
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
440
|
+
}, z.core.$strict>]>]>;
|
|
391
441
|
type ExpressionNode = z.infer<typeof ExpressionNodeSchema>;
|
|
392
442
|
//#endregion
|
|
393
|
-
export { AccumulatorNode, AccumulatorNodeSchema, AllOfNode, AllOfNodeSchema, AndNode, AndNodeSchema, AnyOfNode, AnyOfNodeSchema, ArithmeticNode, ArithmeticNodeSchema, ArithmeticOperator, ArithmeticOperatorSchema, CallNode, CallNodeSchema, CompareNode, CompareNodeSchema, ComparisonOperator, ComparisonOperatorSchema, 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 };
|
|
443
|
+
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 };
|
package/dist/tree.d.ts
CHANGED
|
@@ -200,6 +200,11 @@ declare const TextLiteralNodeSchema: z.ZodObject<{
|
|
|
200
200
|
value: z.ZodString;
|
|
201
201
|
}, z.core.$strip>;
|
|
202
202
|
type TextLiteralNode = z.infer<typeof TextLiteralNodeSchema>;
|
|
203
|
+
declare const BooleanLiteralNodeSchema: z.ZodObject<{
|
|
204
|
+
kind: z.ZodLiteral<"booleanLiteral">;
|
|
205
|
+
value: z.ZodBoolean;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
type BooleanLiteralNode = z.infer<typeof BooleanLiteralNodeSchema>;
|
|
203
208
|
declare const InstantLiteralNodeSchema: z.ZodObject<{
|
|
204
209
|
kind: z.ZodLiteral<"instantLiteral">;
|
|
205
210
|
value: z.ZodString;
|
|
@@ -217,6 +222,38 @@ declare const DurationLiteralNodeSchema: z.ZodObject<{
|
|
|
217
222
|
}>;
|
|
218
223
|
}, z.core.$strip>;
|
|
219
224
|
type DurationLiteralNode = z.infer<typeof DurationLiteralNodeSchema>;
|
|
225
|
+
/**
|
|
226
|
+
* 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.
|
|
227
|
+
*
|
|
228
|
+
* 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.
|
|
229
|
+
*/
|
|
230
|
+
declare const ComplexRectangularLiteralNodeSchema: z.ZodObject<{
|
|
231
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
232
|
+
re: z.ZodNumber;
|
|
233
|
+
im: z.ZodNumber;
|
|
234
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
type ComplexRectangularLiteralNode = z.infer<typeof ComplexRectangularLiteralNodeSchema>;
|
|
237
|
+
declare const ComplexPolarLiteralNodeSchema: z.ZodObject<{
|
|
238
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
239
|
+
magnitude: z.ZodNumber;
|
|
240
|
+
phase: z.ZodNumber;
|
|
241
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
242
|
+
}, z.core.$strict>;
|
|
243
|
+
type ComplexPolarLiteralNode = z.infer<typeof ComplexPolarLiteralNodeSchema>;
|
|
244
|
+
/** 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. */
|
|
245
|
+
declare const ComplexLiteralNodeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
246
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
247
|
+
re: z.ZodNumber;
|
|
248
|
+
im: z.ZodNumber;
|
|
249
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
250
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
251
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
252
|
+
magnitude: z.ZodNumber;
|
|
253
|
+
phase: z.ZodNumber;
|
|
254
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
255
|
+
}, z.core.$strict>]>;
|
|
256
|
+
type ComplexLiteralNode = z.infer<typeof ComplexLiteralNodeSchema>;
|
|
220
257
|
declare const ReferenceNodeSchema: z.ZodObject<{
|
|
221
258
|
kind: z.ZodLiteral<"reference">;
|
|
222
259
|
key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
@@ -308,13 +345,16 @@ declare const DelegateNodeSchema: z.ZodObject<{
|
|
|
308
345
|
payload: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
309
346
|
}, z.core.$strip>;
|
|
310
347
|
type DelegateNode = z.infer<typeof DelegateNodeSchema>;
|
|
311
|
-
declare const ExpressionNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
348
|
+
declare const ExpressionNodeSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
312
349
|
kind: z.ZodLiteral<"numberLiteral">;
|
|
313
350
|
value: z.ZodNumber;
|
|
314
351
|
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
315
352
|
}, z.core.$strip>, z.ZodObject<{
|
|
316
353
|
kind: z.ZodLiteral<"textLiteral">;
|
|
317
354
|
value: z.ZodString;
|
|
355
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
356
|
+
kind: z.ZodLiteral<"booleanLiteral">;
|
|
357
|
+
value: z.ZodBoolean;
|
|
318
358
|
}, z.core.$strip>, z.ZodObject<{
|
|
319
359
|
kind: z.ZodLiteral<"instantLiteral">;
|
|
320
360
|
value: z.ZodString;
|
|
@@ -387,7 +427,17 @@ declare const ExpressionNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
387
427
|
}, z.core.$strip>, z.ZodObject<{
|
|
388
428
|
kind: z.ZodLiteral<"treeReference">;
|
|
389
429
|
key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
390
|
-
}, z.core.$strip>], "kind"
|
|
430
|
+
}, z.core.$strip>], "kind">, z.ZodUnion<readonly [z.ZodObject<{
|
|
431
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
432
|
+
re: z.ZodNumber;
|
|
433
|
+
im: z.ZodNumber;
|
|
434
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
435
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
436
|
+
kind: z.ZodLiteral<"complexLiteral">;
|
|
437
|
+
magnitude: z.ZodNumber;
|
|
438
|
+
phase: z.ZodNumber;
|
|
439
|
+
unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
440
|
+
}, z.core.$strict>]>]>;
|
|
391
441
|
type ExpressionNode = z.infer<typeof ExpressionNodeSchema>;
|
|
392
442
|
//#endregion
|
|
393
|
-
export { AccumulatorNode, AccumulatorNodeSchema, AllOfNode, AllOfNodeSchema, AndNode, AndNodeSchema, AnyOfNode, AnyOfNodeSchema, ArithmeticNode, ArithmeticNodeSchema, ArithmeticOperator, ArithmeticOperatorSchema, CallNode, CallNodeSchema, CompareNode, CompareNodeSchema, ComparisonOperator, ComparisonOperatorSchema, 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 };
|
|
443
|
+
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 };
|
package/dist/tree.js
CHANGED
|
@@ -146,6 +146,10 @@ const TextLiteralNodeSchema = z.object({
|
|
|
146
146
|
kind: z.literal("textLiteral"),
|
|
147
147
|
value: z.string()
|
|
148
148
|
});
|
|
149
|
+
const BooleanLiteralNodeSchema = z.object({
|
|
150
|
+
kind: z.literal("booleanLiteral"),
|
|
151
|
+
value: z.boolean()
|
|
152
|
+
});
|
|
149
153
|
const InstantLiteralNodeSchema = z.object({
|
|
150
154
|
kind: z.literal("instantLiteral"),
|
|
151
155
|
/** ISO-8601 timestamp. */
|
|
@@ -156,6 +160,25 @@ const DurationLiteralNodeSchema = z.object({
|
|
|
156
160
|
value: z.number(),
|
|
157
161
|
unit: DurationUnitSchema
|
|
158
162
|
});
|
|
163
|
+
/**
|
|
164
|
+
* 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.
|
|
165
|
+
*
|
|
166
|
+
* 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.
|
|
167
|
+
*/
|
|
168
|
+
const ComplexRectangularLiteralNodeSchema = z.strictObject({
|
|
169
|
+
kind: z.literal("complexLiteral"),
|
|
170
|
+
re: z.number(),
|
|
171
|
+
im: z.number(),
|
|
172
|
+
unit: UnitSchema.optional()
|
|
173
|
+
});
|
|
174
|
+
const ComplexPolarLiteralNodeSchema = z.strictObject({
|
|
175
|
+
kind: z.literal("complexLiteral"),
|
|
176
|
+
magnitude: z.number(),
|
|
177
|
+
phase: z.number(),
|
|
178
|
+
unit: UnitSchema.optional()
|
|
179
|
+
});
|
|
180
|
+
/** 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. */
|
|
181
|
+
const ComplexLiteralNodeSchema = z.union([ComplexRectangularLiteralNodeSchema, ComplexPolarLiteralNodeSchema]);
|
|
159
182
|
const ReferenceNodeSchema = z.object({
|
|
160
183
|
kind: z.literal("reference"),
|
|
161
184
|
key: JsonValueSchema,
|
|
@@ -247,9 +270,11 @@ const DelegateNodeSchema = z.object({
|
|
|
247
270
|
system: z.string(),
|
|
248
271
|
payload: JsonValueSchema
|
|
249
272
|
});
|
|
250
|
-
|
|
273
|
+
/** Every expression node kind except `complexLiteral`, which cannot be a member of this same discriminated union alongside its own two forms (see `ComplexLiteralNodeSchema` above) -- folded back in below via a plain `z.union` rather than `z.discriminatedUnion`. */
|
|
274
|
+
const CoreExpressionNodeSchema = z.discriminatedUnion("kind", [
|
|
251
275
|
NumberLiteralNodeSchema,
|
|
252
276
|
TextLiteralNodeSchema,
|
|
277
|
+
BooleanLiteralNodeSchema,
|
|
253
278
|
InstantLiteralNodeSchema,
|
|
254
279
|
DurationLiteralNodeSchema,
|
|
255
280
|
ReferenceNodeSchema,
|
|
@@ -263,5 +288,6 @@ const ExpressionNodeSchema = z.discriminatedUnion("kind", [
|
|
|
263
288
|
DelegateNodeSchema,
|
|
264
289
|
TreeReferenceNodeSchema
|
|
265
290
|
]);
|
|
291
|
+
const ExpressionNodeSchema = z.union([CoreExpressionNodeSchema, ComplexLiteralNodeSchema]);
|
|
266
292
|
//#endregion
|
|
267
|
-
export { AccumulatorNodeSchema, AllOfNodeSchema, AndNodeSchema, AnyOfNodeSchema, ArithmeticNodeSchema, ArithmeticOperatorSchema, CallNodeSchema, CompareNodeSchema, ComparisonOperatorSchema, 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 };
|
|
293
|
+
export { 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trilean",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Three-valued predicate and expression evaluation trees, stored as JSON and evaluated against injected resolvers, for domain logic — business rules, eligibility checks, formulas, search filters, and more — that needs to be data instead of code.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$defs":{"ExpressionNode":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"numberLiteral","type":"string"},"unit":{"additionalProperties":{"type":"number"},"propertyNames":{"type":"string"},"type":"object"},"value":{"type":"number"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"textLiteral","type":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"instantLiteral","type":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"durationLiteral","type":"string"},"unit":{"enum":["ms","s","min","h","d"],"type":"string"},"value":{"type":"number"}},"required":["kind","value","unit"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/schema0"},"kind":{"const":"reference","type":"string"},"unit":{"additionalProperties":{"type":"number"},"propertyNames":{"type":"string"},"type":"object"}},"required":["kind","key"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"arithmetic","type":"string"},"left":{"$ref":"#/$defs/ExpressionNode"},"op":{"enum":["add","subtract","multiply","divide","power","modulo"],"type":"string"},"right":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"negate","type":"string"},"operand":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","operand"],"type":"object"},{"additionalProperties":false,"properties":{"args":{"items":{"$ref":"#/$defs/ExpressionNode"},"type":"array"},"fn":{"type":"string"},"kind":{"const":"call","type":"string"}},"required":["kind","fn","args"],"type":"object"},{"additionalProperties":false,"properties":{"keys":{"items":{"$ref":"#/$defs/ExpressionNode"},"type":"array"},"kind":{"const":"lookup","type":"string"},"table":{"$ref":"#/$defs/schema0"}},"required":["kind","table","keys"],"type":"object"},{"additionalProperties":false,"properties":{"cases":{"items":{"additionalProperties":false,"properties":{"then":{"$ref":"#/$defs/ExpressionNode"},"when":{"$ref":"#/$defs/PredicateNode"}},"required":["when","then"],"type":"object"},"type":"array"},"fallback":{"$ref":"#/$defs/ExpressionNode"},"hitPolicy":{"enum":["first","unique"],"type":"string"},"kind":{"const":"conditional","type":"string"}},"required":["kind","cases","fallback"],"type":"object"},{"additionalProperties":false,"properties":{"collection":{"$ref":"#/$defs/schema0"},"combiner":{"oneOf":[{"additionalProperties":false,"properties":{"item":{"$ref":"#/$defs/ExpressionNode"},"mode":{"const":"max","type":"string"}},"required":["mode","item"],"type":"object"},{"additionalProperties":false,"properties":{"item":{"$ref":"#/$defs/ExpressionNode"},"mode":{"const":"min","type":"string"}},"required":["mode","item"],"type":"object"},{"additionalProperties":false,"properties":{"combine":{"$ref":"#/$defs/ExpressionNode"},"initial":{"$ref":"#/$defs/ExpressionNode"},"mode":{"const":"reduce","type":"string"}},"required":["mode","initial","combine"],"type":"object"}]},"filter":{"$ref":"#/$defs/PredicateNode"},"kind":{"const":"fold","type":"string"}},"required":["kind","collection","combiner"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"accumulator","type":"string"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"delegate","type":"string"},"payload":{"$ref":"#/$defs/schema0"},"system":{"type":"string"}},"required":["kind","system","payload"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/schema0"},"kind":{"const":"treeReference","type":"string"}},"required":["kind","key"],"type":"object"}]},"PredicateNode":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"not","type":"string"},"operand":{"$ref":"#/$defs/PredicateNode"}},"required":["kind","operand"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and","type":"string"},"left":{"$ref":"#/$defs/PredicateNode"},"right":{"$ref":"#/$defs/PredicateNode"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or","type":"string"},"left":{"$ref":"#/$defs/PredicateNode"},"right":{"$ref":"#/$defs/PredicateNode"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"allOf","type":"string"},"operands":{"items":{"$ref":"#/$defs/PredicateNode"},"type":"array"}},"required":["kind","operands"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"anyOf","type":"string"},"operands":{"items":{"$ref":"#/$defs/PredicateNode"},"type":"array"}},"required":["kind","operands"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"compare","type":"string"},"left":{"$ref":"#/$defs/ExpressionNode"},"op":{"enum":["gt","gte","lt","lte","eq","neq"],"type":"string"},"right":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"textCompare","type":"string"},"left":{"$ref":"#/$defs/ExpressionNode"},"op":{"enum":["equals","notEquals","matches","notMatches"],"type":"string"},"right":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"candidates":{"items":{"$ref":"#/$defs/ExpressionNode"},"type":"array"},"kind":{"const":"memberOf","type":"string"},"op":{"enum":["in","notIn"],"type":"string"},"operand":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","operand","candidates"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"exists","type":"string"},"operand":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","operand"],"type":"object"},{"additionalProperties":false,"properties":{"collection":{"$ref":"#/$defs/schema0"},"filter":{"$ref":"#/$defs/PredicateNode"},"item":{"$ref":"#/$defs/PredicateNode"},"kind":{"const":"some","type":"string"}},"required":["kind","collection","item"],"type":"object"},{"additionalProperties":false,"properties":{"collection":{"$ref":"#/$defs/schema0"},"filter":{"$ref":"#/$defs/PredicateNode"},"item":{"$ref":"#/$defs/PredicateNode"},"kind":{"const":"every","type":"string"}},"required":["kind","collection","item"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/schema0"},"kind":{"const":"treeReference","type":"string"}},"required":["kind","key"],"type":"object"}]},"schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"items":{"$ref":"#/$defs/schema0"},"type":"array"},{"additionalProperties":{"$ref":"#/$defs/schema0"},"propertyNames":{"type":"string"},"type":"object"}]}},"$id":"https://cdn.jsdelivr.net/npm/trilean@1.
|
|
1
|
+
{"$defs":{"ExpressionNode":{"anyOf":[{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"numberLiteral","type":"string"},"unit":{"additionalProperties":{"type":"number"},"propertyNames":{"type":"string"},"type":"object"},"value":{"type":"number"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"textLiteral","type":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"booleanLiteral","type":"string"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"instantLiteral","type":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"durationLiteral","type":"string"},"unit":{"enum":["ms","s","min","h","d"],"type":"string"},"value":{"type":"number"}},"required":["kind","value","unit"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/schema0"},"kind":{"const":"reference","type":"string"},"unit":{"additionalProperties":{"type":"number"},"propertyNames":{"type":"string"},"type":"object"}},"required":["kind","key"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"arithmetic","type":"string"},"left":{"$ref":"#/$defs/ExpressionNode"},"op":{"enum":["add","subtract","multiply","divide","power","modulo"],"type":"string"},"right":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"negate","type":"string"},"operand":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","operand"],"type":"object"},{"additionalProperties":false,"properties":{"args":{"items":{"$ref":"#/$defs/ExpressionNode"},"type":"array"},"fn":{"type":"string"},"kind":{"const":"call","type":"string"}},"required":["kind","fn","args"],"type":"object"},{"additionalProperties":false,"properties":{"keys":{"items":{"$ref":"#/$defs/ExpressionNode"},"type":"array"},"kind":{"const":"lookup","type":"string"},"table":{"$ref":"#/$defs/schema0"}},"required":["kind","table","keys"],"type":"object"},{"additionalProperties":false,"properties":{"cases":{"items":{"additionalProperties":false,"properties":{"then":{"$ref":"#/$defs/ExpressionNode"},"when":{"$ref":"#/$defs/PredicateNode"}},"required":["when","then"],"type":"object"},"type":"array"},"fallback":{"$ref":"#/$defs/ExpressionNode"},"hitPolicy":{"enum":["first","unique"],"type":"string"},"kind":{"const":"conditional","type":"string"}},"required":["kind","cases","fallback"],"type":"object"},{"additionalProperties":false,"properties":{"collection":{"$ref":"#/$defs/schema0"},"combiner":{"oneOf":[{"additionalProperties":false,"properties":{"item":{"$ref":"#/$defs/ExpressionNode"},"mode":{"const":"max","type":"string"}},"required":["mode","item"],"type":"object"},{"additionalProperties":false,"properties":{"item":{"$ref":"#/$defs/ExpressionNode"},"mode":{"const":"min","type":"string"}},"required":["mode","item"],"type":"object"},{"additionalProperties":false,"properties":{"combine":{"$ref":"#/$defs/ExpressionNode"},"initial":{"$ref":"#/$defs/ExpressionNode"},"mode":{"const":"reduce","type":"string"}},"required":["mode","initial","combine"],"type":"object"}]},"filter":{"$ref":"#/$defs/PredicateNode"},"kind":{"const":"fold","type":"string"}},"required":["kind","collection","combiner"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"accumulator","type":"string"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"delegate","type":"string"},"payload":{"$ref":"#/$defs/schema0"},"system":{"type":"string"}},"required":["kind","system","payload"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/schema0"},"kind":{"const":"treeReference","type":"string"}},"required":["kind","key"],"type":"object"}]},{"anyOf":[{"additionalProperties":false,"properties":{"im":{"type":"number"},"kind":{"const":"complexLiteral","type":"string"},"re":{"type":"number"},"unit":{"additionalProperties":{"type":"number"},"propertyNames":{"type":"string"},"type":"object"}},"required":["kind","re","im"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"complexLiteral","type":"string"},"magnitude":{"type":"number"},"phase":{"type":"number"},"unit":{"additionalProperties":{"type":"number"},"propertyNames":{"type":"string"},"type":"object"}},"required":["kind","magnitude","phase"],"type":"object"}]}]},"PredicateNode":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"not","type":"string"},"operand":{"$ref":"#/$defs/PredicateNode"}},"required":["kind","operand"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and","type":"string"},"left":{"$ref":"#/$defs/PredicateNode"},"right":{"$ref":"#/$defs/PredicateNode"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or","type":"string"},"left":{"$ref":"#/$defs/PredicateNode"},"right":{"$ref":"#/$defs/PredicateNode"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"allOf","type":"string"},"operands":{"items":{"$ref":"#/$defs/PredicateNode"},"type":"array"}},"required":["kind","operands"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"anyOf","type":"string"},"operands":{"items":{"$ref":"#/$defs/PredicateNode"},"type":"array"}},"required":["kind","operands"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"compare","type":"string"},"left":{"$ref":"#/$defs/ExpressionNode"},"op":{"enum":["gt","gte","lt","lte","eq","neq"],"type":"string"},"right":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"textCompare","type":"string"},"left":{"$ref":"#/$defs/ExpressionNode"},"op":{"enum":["equals","notEquals","matches","notMatches"],"type":"string"},"right":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"candidates":{"items":{"$ref":"#/$defs/ExpressionNode"},"type":"array"},"kind":{"const":"memberOf","type":"string"},"op":{"enum":["in","notIn"],"type":"string"},"operand":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","op","operand","candidates"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"exists","type":"string"},"operand":{"$ref":"#/$defs/ExpressionNode"}},"required":["kind","operand"],"type":"object"},{"additionalProperties":false,"properties":{"collection":{"$ref":"#/$defs/schema0"},"filter":{"$ref":"#/$defs/PredicateNode"},"item":{"$ref":"#/$defs/PredicateNode"},"kind":{"const":"some","type":"string"}},"required":["kind","collection","item"],"type":"object"},{"additionalProperties":false,"properties":{"collection":{"$ref":"#/$defs/schema0"},"filter":{"$ref":"#/$defs/PredicateNode"},"item":{"$ref":"#/$defs/PredicateNode"},"kind":{"const":"every","type":"string"}},"required":["kind","collection","item"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/schema0"},"kind":{"const":"treeReference","type":"string"}},"required":["kind","key"],"type":"object"}]},"schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"items":{"$ref":"#/$defs/schema0"},"type":"array"},{"additionalProperties":{"$ref":"#/$defs/schema0"},"propertyNames":{"type":"string"},"type":"object"}]}},"$id":"https://cdn.jsdelivr.net/npm/trilean@1.3.0/schemas/trilean.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"$ref":"#/$defs/PredicateNode"},{"$ref":"#/$defs/ExpressionNode"}]}
|