trilean 1.6.2 → 1.6.3
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/dist/complex.d.cts +5 -6
- package/dist/complex.d.ts +5 -6
- package/dist/derived-aggregates.d.cts +5 -6
- package/dist/derived-aggregates.d.ts +5 -6
- package/dist/derived-connectives.d.cts +10 -11
- package/dist/derived-connectives.d.ts +10 -11
- package/dist/derived-patterns.d.cts +4 -5
- package/dist/derived-patterns.d.ts +4 -5
- package/dist/derived-values.d.cts +2 -3
- package/dist/derived-values.d.ts +2 -3
- package/dist/evaluation.d.cts +7 -8
- package/dist/evaluation.d.ts +7 -8
- package/dist/evaluator-budget.d.cts +6 -7
- package/dist/evaluator-budget.d.ts +6 -7
- package/dist/evaluator-collection.d.cts +5 -6
- package/dist/evaluator-collection.d.ts +5 -6
- package/dist/evaluator-factory.d.cts +3 -4
- package/dist/evaluator-factory.d.ts +3 -4
- package/dist/evaluator-indeterminacy-helpers.d.cts +26 -27
- package/dist/evaluator-indeterminacy-helpers.d.ts +26 -27
- package/dist/evaluator-operations.d.cts +10 -11
- package/dist/evaluator-operations.d.ts +10 -11
- package/dist/evaluator-test-helpers.d.cts +6 -7
- package/dist/evaluator-test-helpers.d.ts +6 -7
- package/dist/evaluator.d.cts +3 -4
- package/dist/evaluator.d.ts +3 -4
- package/dist/functions.d.cts +3 -4
- package/dist/functions.d.ts +3 -4
- package/dist/resolvers.d.cts +5 -6
- package/dist/resolvers.d.ts +5 -6
- package/dist/tree.d.cts +77 -78
- package/dist/tree.d.ts +77 -78
- package/package.json +3 -3
- package/schemas/trilean.schema.json +1 -1
|
@@ -4,24 +4,23 @@ import { Evaluation } from "./evaluation.cjs";
|
|
|
4
4
|
import { FunctionRegistry } from "./functions.cjs";
|
|
5
5
|
//#region src/evaluator-operations.d.ts
|
|
6
6
|
/** The three-valued AND table: `false` is absorbing regardless of the other operand's indeterminacy; otherwise both-definite folds to a boolean AND; otherwise indeterminate, with the tie-break rule (declared operand order, left before right) applied via `firstIndeterminate`. */
|
|
7
|
-
declare function combineAnd(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
7
|
+
export declare function combineAnd(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
8
8
|
/** The three-valued OR table: mirror image of `combineAnd`, with `true` absorbing. */
|
|
9
|
-
declare function combineOr(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
9
|
+
export declare function combineOr(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
10
10
|
/** `compare`'s two operands: valid kinds are `number` (matching units required), `instant` (ordered by parsed epoch millisecond), or `duration` (ordered by magnitude normalised to milliseconds) -- `text` is never valid here (see `textCompare`), and a kind mismatch between the two operands is `wrong-type`. Narrowing `right` against a literal `left.kind` case (rather than asserting it) is what lets both sides stay properly typed with no `as`. */
|
|
11
|
-
declare function compareValues(op: ComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
11
|
+
export declare function compareValues(op: ComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
12
12
|
/** `textCompare`'s two operands must both resolve to the `text` computed-value kind -- any other kind, on either operand, is `wrong-type` (see the `textCompare` section of README.md). `equals`/`notEquals` are exact string equality; `matches`/`notMatches` interpret `right`'s text as an ECMAScript regular expression tested against `left`'s text; `portableMatches`/`portableNotMatches` interpret it as a pattern in `trilean-regex`'s own restricted grammar instead, matched by that package's finite-automaton reference matcher rather than the host's native `RegExp` engine -- see the `textCompare` section of README.md for when to reach for the portable pair instead of the plain one. An invalid pattern is `wrong-type` rather than a thrown exception either way -- every data-quality problem stays inside the `Evaluation` result, per `Evaluation<T>`'s own doc comment in evaluation.ts. */
|
|
13
|
-
declare function compareText(op: TextComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
13
|
+
export declare function compareText(op: TextComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
14
14
|
/** `memberOf`'s own value-equality test between two computed values -- kind-agnostic across `number`/`text`/`instant`/`duration` (see the `memberOf` section of README.md, and its "Derived aggregates" note that this equality is kind-agnostic across every computed-value kind), unlike `compare`'s own `eq`, which rejects a `text` operand outright and directs callers to `textCompare` instead. A kind mismatch, or a `number` pair with an incompatible unit, is `wrong-type` -- never simply "not equal". Narrowing `candidate` against a literal `operand.kind` case (rather than asserting it) is the same technique `compareValues` uses above. */
|
|
15
|
-
declare function computeMembershipMatch(operand: ComputedValue, candidate: ComputedValue): Evaluation<boolean>;
|
|
15
|
+
export declare function computeMembershipMatch(operand: ComputedValue, candidate: ComputedValue): Evaluation<boolean>;
|
|
16
16
|
/** `negate` is never sugar for "zero minus the value" (see the `arithmetic`/`negate` section of README.md) -- a `duration`'s magnitude is negated directly, in its own original unit, with no subtraction or millisecond normalisation involved. */
|
|
17
|
-
declare function applyNegate(operand: ComputedValue): Evaluation<ComputedValue>;
|
|
17
|
+
export declare function applyNegate(operand: ComputedValue): Evaluation<ComputedValue>;
|
|
18
18
|
/**
|
|
19
19
|
* Dispatches `arithmetic` by operand kind. The three cross-kind temporal combinations this design defines (`instant - instant`, `instant + duration`, `duration + instant`) are checked explicitly first, in that order, against the exact operator each requires; any other combination touching an `instant` is `wrong-type` (see "Temporal values" in README.md -- e.g. adding two instants, or subtracting a `duration` from an `instant`, are deliberately *not* defined). Same-kind `duration`/`duration` combinations are delegated to `applyArithmeticOnDurations`; a `duration` paired with anything other than an `instant` or another `duration` is `wrong-type`. Everything remaining requires two `number` operands.
|
|
20
20
|
*/
|
|
21
|
-
declare function applyArithmetic(op: ArithmeticOperator, left: ComputedValue, right: ComputedValue): Evaluation<ComputedValue>;
|
|
21
|
+
export declare function applyArithmetic(op: ArithmeticOperator, left: ComputedValue, right: ComputedValue): Evaluation<ComputedValue>;
|
|
22
22
|
/** `reference`'s optional expected-unit check: when `expectedUnit` is declared (from `node.unit`), the resolved value must be numeric (`number` or `complex`) and its own unit must match. Returns the `wrong-type` `Evaluation` to return immediately if the check fails, or `undefined` if the reference may resolve as-is. */
|
|
23
|
-
declare function checkReferenceUnit(expectedUnit: Unit | undefined, resolvedValue: ComputedValue): Evaluation<never> | undefined;
|
|
23
|
+
export declare function checkReferenceUnit(expectedUnit: Unit | undefined, resolvedValue: ComputedValue): Evaluation<never> | undefined;
|
|
24
24
|
/** `call`'s own function-registry dispatch, given the `fn` name off the tree and its already-evaluated `args`. `node.fn` comes off the serialised tree, which this design treats as data that may have been authored anywhere (see README.md's opening section), while `FunctionRegistry` is an ordinary object with `Object.prototype` on its chain. A bare index lookup would therefore resolve `toString`, `valueOf`, `constructor` and friends as though a consumer had registered them; only the registry's own keys count as registered function names. */
|
|
25
|
-
declare function invokeRegisteredFunction(functions: Readonly<FunctionRegistry>, fnName: string, args: readonly ComputedValue[]): Evaluation<ComputedValue>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { applyArithmetic, applyNegate, checkReferenceUnit, combineAnd, combineOr, compareText, compareValues, computeMembershipMatch, invokeRegisteredFunction };
|
|
25
|
+
export declare function invokeRegisteredFunction(functions: Readonly<FunctionRegistry>, fnName: string, args: readonly ComputedValue[]): Evaluation<ComputedValue>;
|
|
26
|
+
//#endregion
|
|
@@ -4,24 +4,23 @@ import { Evaluation } from "./evaluation.js";
|
|
|
4
4
|
import { FunctionRegistry } from "./functions.js";
|
|
5
5
|
//#region src/evaluator-operations.d.ts
|
|
6
6
|
/** The three-valued AND table: `false` is absorbing regardless of the other operand's indeterminacy; otherwise both-definite folds to a boolean AND; otherwise indeterminate, with the tie-break rule (declared operand order, left before right) applied via `firstIndeterminate`. */
|
|
7
|
-
declare function combineAnd(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
7
|
+
export declare function combineAnd(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
8
8
|
/** The three-valued OR table: mirror image of `combineAnd`, with `true` absorbing. */
|
|
9
|
-
declare function combineOr(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
9
|
+
export declare function combineOr(left: Evaluation<boolean>, right: Evaluation<boolean>): Evaluation<boolean>;
|
|
10
10
|
/** `compare`'s two operands: valid kinds are `number` (matching units required), `instant` (ordered by parsed epoch millisecond), or `duration` (ordered by magnitude normalised to milliseconds) -- `text` is never valid here (see `textCompare`), and a kind mismatch between the two operands is `wrong-type`. Narrowing `right` against a literal `left.kind` case (rather than asserting it) is what lets both sides stay properly typed with no `as`. */
|
|
11
|
-
declare function compareValues(op: ComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
11
|
+
export declare function compareValues(op: ComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
12
12
|
/** `textCompare`'s two operands must both resolve to the `text` computed-value kind -- any other kind, on either operand, is `wrong-type` (see the `textCompare` section of README.md). `equals`/`notEquals` are exact string equality; `matches`/`notMatches` interpret `right`'s text as an ECMAScript regular expression tested against `left`'s text; `portableMatches`/`portableNotMatches` interpret it as a pattern in `trilean-regex`'s own restricted grammar instead, matched by that package's finite-automaton reference matcher rather than the host's native `RegExp` engine -- see the `textCompare` section of README.md for when to reach for the portable pair instead of the plain one. An invalid pattern is `wrong-type` rather than a thrown exception either way -- every data-quality problem stays inside the `Evaluation` result, per `Evaluation<T>`'s own doc comment in evaluation.ts. */
|
|
13
|
-
declare function compareText(op: TextComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
13
|
+
export declare function compareText(op: TextComparisonOperator, left: ComputedValue, right: ComputedValue): Evaluation<boolean>;
|
|
14
14
|
/** `memberOf`'s own value-equality test between two computed values -- kind-agnostic across `number`/`text`/`instant`/`duration` (see the `memberOf` section of README.md, and its "Derived aggregates" note that this equality is kind-agnostic across every computed-value kind), unlike `compare`'s own `eq`, which rejects a `text` operand outright and directs callers to `textCompare` instead. A kind mismatch, or a `number` pair with an incompatible unit, is `wrong-type` -- never simply "not equal". Narrowing `candidate` against a literal `operand.kind` case (rather than asserting it) is the same technique `compareValues` uses above. */
|
|
15
|
-
declare function computeMembershipMatch(operand: ComputedValue, candidate: ComputedValue): Evaluation<boolean>;
|
|
15
|
+
export declare function computeMembershipMatch(operand: ComputedValue, candidate: ComputedValue): Evaluation<boolean>;
|
|
16
16
|
/** `negate` is never sugar for "zero minus the value" (see the `arithmetic`/`negate` section of README.md) -- a `duration`'s magnitude is negated directly, in its own original unit, with no subtraction or millisecond normalisation involved. */
|
|
17
|
-
declare function applyNegate(operand: ComputedValue): Evaluation<ComputedValue>;
|
|
17
|
+
export declare function applyNegate(operand: ComputedValue): Evaluation<ComputedValue>;
|
|
18
18
|
/**
|
|
19
19
|
* Dispatches `arithmetic` by operand kind. The three cross-kind temporal combinations this design defines (`instant - instant`, `instant + duration`, `duration + instant`) are checked explicitly first, in that order, against the exact operator each requires; any other combination touching an `instant` is `wrong-type` (see "Temporal values" in README.md -- e.g. adding two instants, or subtracting a `duration` from an `instant`, are deliberately *not* defined). Same-kind `duration`/`duration` combinations are delegated to `applyArithmeticOnDurations`; a `duration` paired with anything other than an `instant` or another `duration` is `wrong-type`. Everything remaining requires two `number` operands.
|
|
20
20
|
*/
|
|
21
|
-
declare function applyArithmetic(op: ArithmeticOperator, left: ComputedValue, right: ComputedValue): Evaluation<ComputedValue>;
|
|
21
|
+
export declare function applyArithmetic(op: ArithmeticOperator, left: ComputedValue, right: ComputedValue): Evaluation<ComputedValue>;
|
|
22
22
|
/** `reference`'s optional expected-unit check: when `expectedUnit` is declared (from `node.unit`), the resolved value must be numeric (`number` or `complex`) and its own unit must match. Returns the `wrong-type` `Evaluation` to return immediately if the check fails, or `undefined` if the reference may resolve as-is. */
|
|
23
|
-
declare function checkReferenceUnit(expectedUnit: Unit | undefined, resolvedValue: ComputedValue): Evaluation<never> | undefined;
|
|
23
|
+
export declare function checkReferenceUnit(expectedUnit: Unit | undefined, resolvedValue: ComputedValue): Evaluation<never> | undefined;
|
|
24
24
|
/** `call`'s own function-registry dispatch, given the `fn` name off the tree and its already-evaluated `args`. `node.fn` comes off the serialised tree, which this design treats as data that may have been authored anywhere (see README.md's opening section), while `FunctionRegistry` is an ordinary object with `Object.prototype` on its chain. A bare index lookup would therefore resolve `toString`, `valueOf`, `constructor` and friends as though a consumer had registered them; only the registry's own keys count as registered function names. */
|
|
25
|
-
declare function invokeRegisteredFunction(functions: Readonly<FunctionRegistry>, fnName: string, args: readonly ComputedValue[]): Evaluation<ComputedValue>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { applyArithmetic, applyNegate, checkReferenceUnit, combineAnd, combineOr, compareText, compareValues, computeMembershipMatch, invokeRegisteredFunction };
|
|
25
|
+
export declare function invokeRegisteredFunction(functions: Readonly<FunctionRegistry>, fnName: string, args: readonly ComputedValue[]): Evaluation<ComputedValue>;
|
|
26
|
+
//#endregion
|
|
@@ -2,12 +2,11 @@ import { Evaluation } from "./evaluation.cjs";
|
|
|
2
2
|
import { Resolvers } from "./resolvers.cjs";
|
|
3
3
|
//#region src/evaluator-test-helpers.d.ts
|
|
4
4
|
/** A resolver reporting a fixed `{ kind: "number", value: 10, unit: { m: 1 } }` for key `"present"`, and not-found for anything else -- `resolveLookup`/`resolveCollection` are never exercised by expression-level nodes and are stubbed only to satisfy `Resolvers`. Shared across the split `evaluator.*.test.ts` files below; a test needing genuinely different resolver behaviour spreads over it (`{ ...resolvers, resolveValue: ... }`) locally rather than mutating this shared instance. */
|
|
5
|
-
declare const resolvers: Resolvers;
|
|
6
|
-
declare function expectDefinite<T>(evaluation: Evaluation<T>, expected: T): void;
|
|
7
|
-
declare function expectIndeterminate<T>(evaluation: Evaluation<T>, code: "not-found" | "wrong-type" | "domain-error"): void;
|
|
5
|
+
export declare const resolvers: Resolvers;
|
|
6
|
+
export declare function expectDefinite<T>(evaluation: Evaluation<T>, expected: T): void;
|
|
7
|
+
export declare function expectIndeterminate<T>(evaluation: Evaluation<T>, code: "not-found" | "wrong-type" | "domain-error"): void;
|
|
8
8
|
/** A narrowing type guard for a resolver context treated as a plain record, following this repo's `object -> Record<string, unknown>` narrowing convention rather than an `as Record<string, unknown>` assertion. */
|
|
9
|
-
declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
|
|
9
|
+
export declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
|
|
10
10
|
/** `Array.isArray`'s own lib.es5.d.ts type predicate narrows to `any[]`, not `unknown[]` -- this re-typed wrapper is what lets a `resolveCollection` stub return a properly `unknown[]`-typed result instead of an implicit `any[]`. */
|
|
11
|
-
declare function isUnknownArray(value: unknown): value is unknown[];
|
|
12
|
-
//#endregion
|
|
13
|
-
export { expectDefinite, expectIndeterminate, isPlainRecord, isUnknownArray, resolvers };
|
|
11
|
+
export declare function isUnknownArray(value: unknown): value is unknown[];
|
|
12
|
+
//#endregion
|
|
@@ -2,12 +2,11 @@ import { Evaluation } from "./evaluation.js";
|
|
|
2
2
|
import { Resolvers } from "./resolvers.js";
|
|
3
3
|
//#region src/evaluator-test-helpers.d.ts
|
|
4
4
|
/** A resolver reporting a fixed `{ kind: "number", value: 10, unit: { m: 1 } }` for key `"present"`, and not-found for anything else -- `resolveLookup`/`resolveCollection` are never exercised by expression-level nodes and are stubbed only to satisfy `Resolvers`. Shared across the split `evaluator.*.test.ts` files below; a test needing genuinely different resolver behaviour spreads over it (`{ ...resolvers, resolveValue: ... }`) locally rather than mutating this shared instance. */
|
|
5
|
-
declare const resolvers: Resolvers;
|
|
6
|
-
declare function expectDefinite<T>(evaluation: Evaluation<T>, expected: T): void;
|
|
7
|
-
declare function expectIndeterminate<T>(evaluation: Evaluation<T>, code: "not-found" | "wrong-type" | "domain-error"): void;
|
|
5
|
+
export declare const resolvers: Resolvers;
|
|
6
|
+
export declare function expectDefinite<T>(evaluation: Evaluation<T>, expected: T): void;
|
|
7
|
+
export declare function expectIndeterminate<T>(evaluation: Evaluation<T>, code: "not-found" | "wrong-type" | "domain-error"): void;
|
|
8
8
|
/** A narrowing type guard for a resolver context treated as a plain record, following this repo's `object -> Record<string, unknown>` narrowing convention rather than an `as Record<string, unknown>` assertion. */
|
|
9
|
-
declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
|
|
9
|
+
export declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
|
|
10
10
|
/** `Array.isArray`'s own lib.es5.d.ts type predicate narrows to `any[]`, not `unknown[]` -- this re-typed wrapper is what lets a `resolveCollection` stub return a properly `unknown[]`-typed result instead of an implicit `any[]`. */
|
|
11
|
-
declare function isUnknownArray(value: unknown): value is unknown[];
|
|
12
|
-
//#endregion
|
|
13
|
-
export { expectDefinite, expectIndeterminate, isPlainRecord, isUnknownArray, resolvers };
|
|
11
|
+
export declare function isUnknownArray(value: unknown): value is unknown[];
|
|
12
|
+
//#endregion
|
package/dist/evaluator.d.cts
CHANGED
|
@@ -8,7 +8,6 @@ import { EvaluationContext, Resolvers } from "./resolvers.cjs";
|
|
|
8
8
|
/**
|
|
9
9
|
* `evaluatePredicateInternal` and `evaluateValueInternal` below are co-located in this one file, rather than split across `predicate-evaluator.ts`/`value-evaluator.ts`, because they are mutually recursive: a predicate leaf (`compare`, `textCompare`, `memberOf`, `exists`) holds `ExpressionNode` operands, and an expression node (`conditional`'s `when`, a fold's `filter`) holds `PredicateNode` operands. Splitting them across modules would make each half import the other, and whichever module finished loading second would see the other's export as `undefined` at its own module-evaluation time -- a genuine circular-import TDZ hazard, not merely a style preference. `resolveParticipatingItems` (in `evaluator-collection.ts`) would share that same hazard if it imported `evaluatePredicateInternal` directly, since it calls back into it to evaluate each candidate's filter -- so it instead takes the evaluator as an injected `EvaluatePredicate` parameter (see that type's own doc comment), which is what lets it live in its own file with no circular dependency on this one. The pure, non-recursive value-combination logic (`combineAnd`/`compareValues`/`applyArithmetic` and their siblings) carries no such constraint either and lives in `evaluator-operations.ts`; the resource-limit infrastructure (`EvaluationBudget` and its constants), likewise self-contained, lives in `evaluator-budget.ts`.
|
|
10
10
|
*/
|
|
11
|
-
declare function evaluatePredicateInternal(node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<boolean>>;
|
|
12
|
-
declare function evaluateValueInternal(node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<ComputedValue>>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { evaluatePredicateInternal, evaluateValueInternal };
|
|
11
|
+
export declare function evaluatePredicateInternal(node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<boolean>>;
|
|
12
|
+
export declare function evaluateValueInternal(node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<ComputedValue>>;
|
|
13
|
+
//#endregion
|
package/dist/evaluator.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { EvaluationContext, Resolvers } from "./resolvers.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* `evaluatePredicateInternal` and `evaluateValueInternal` below are co-located in this one file, rather than split across `predicate-evaluator.ts`/`value-evaluator.ts`, because they are mutually recursive: a predicate leaf (`compare`, `textCompare`, `memberOf`, `exists`) holds `ExpressionNode` operands, and an expression node (`conditional`'s `when`, a fold's `filter`) holds `PredicateNode` operands. Splitting them across modules would make each half import the other, and whichever module finished loading second would see the other's export as `undefined` at its own module-evaluation time -- a genuine circular-import TDZ hazard, not merely a style preference. `resolveParticipatingItems` (in `evaluator-collection.ts`) would share that same hazard if it imported `evaluatePredicateInternal` directly, since it calls back into it to evaluate each candidate's filter -- so it instead takes the evaluator as an injected `EvaluatePredicate` parameter (see that type's own doc comment), which is what lets it live in its own file with no circular dependency on this one. The pure, non-recursive value-combination logic (`combineAnd`/`compareValues`/`applyArithmetic` and their siblings) carries no such constraint either and lives in `evaluator-operations.ts`; the resource-limit infrastructure (`EvaluationBudget` and its constants), likewise self-contained, lives in `evaluator-budget.ts`.
|
|
10
10
|
*/
|
|
11
|
-
declare function evaluatePredicateInternal(node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<boolean>>;
|
|
12
|
-
declare function evaluateValueInternal(node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<ComputedValue>>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { evaluatePredicateInternal, evaluateValueInternal };
|
|
11
|
+
export declare function evaluatePredicateInternal(node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<boolean>>;
|
|
12
|
+
export declare function evaluateValueInternal(node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Promise<Evaluation<ComputedValue>>;
|
|
13
|
+
//#endregion
|
package/dist/functions.d.cts
CHANGED
|
@@ -3,9 +3,8 @@ import { t as ComputedValue } from "./computed-value-CbRF0Izc.cjs";
|
|
|
3
3
|
/**
|
|
4
4
|
* Named functions available to a `call` expression node, supplied once at evaluator construction time (see `createEvaluator` in evaluator-factory.ts) rather than per evaluation call. A function reports a domain violation (e.g. `squareRoot` given a negative number) by returning a `domainError` rather than throwing -- this keeps `call` inside the same three-outcome model as every other node kind.
|
|
5
5
|
*/
|
|
6
|
-
type FunctionRegistry = Record<string, (args: readonly ComputedValue[]) => ComputedValue | {
|
|
6
|
+
export type FunctionRegistry = Record<string, (args: readonly ComputedValue[]) => ComputedValue | {
|
|
7
7
|
domainError: string;
|
|
8
8
|
}>;
|
|
9
|
-
declare const emptyFunctionRegistry: FunctionRegistry;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { FunctionRegistry, emptyFunctionRegistry };
|
|
9
|
+
export declare const emptyFunctionRegistry: FunctionRegistry;
|
|
10
|
+
//#endregion
|
package/dist/functions.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { t as ComputedValue } from "./computed-value-CbRF0Izc.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Named functions available to a `call` expression node, supplied once at evaluator construction time (see `createEvaluator` in evaluator-factory.ts) rather than per evaluation call. A function reports a domain violation (e.g. `squareRoot` given a negative number) by returning a `domainError` rather than throwing -- this keeps `call` inside the same three-outcome model as every other node kind.
|
|
5
5
|
*/
|
|
6
|
-
type FunctionRegistry = Record<string, (args: readonly ComputedValue[]) => ComputedValue | {
|
|
6
|
+
export type FunctionRegistry = Record<string, (args: readonly ComputedValue[]) => ComputedValue | {
|
|
7
7
|
domainError: string;
|
|
8
8
|
}>;
|
|
9
|
-
declare const emptyFunctionRegistry: FunctionRegistry;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { FunctionRegistry, emptyFunctionRegistry };
|
|
9
|
+
export declare const emptyFunctionRegistry: FunctionRegistry;
|
|
10
|
+
//#endregion
|
package/dist/resolvers.d.cts
CHANGED
|
@@ -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,4 @@ 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
|
+
//#endregion
|
package/dist/resolvers.d.ts
CHANGED
|
@@ -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,4 @@ 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
|
+
//#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
|