trilean 1.13.6 → 1.13.7
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/builtin-functions.cjs +1 -2
- package/dist/builtin-functions.d.cts +1 -3
- package/dist/builtin-functions.d.ts +1 -3
- package/dist/builtin-functions.js +1 -2
- package/dist/complex-division.cjs +1 -2
- package/dist/complex-division.d.cts +1 -3
- package/dist/complex-division.d.ts +1 -3
- package/dist/complex-division.js +1 -2
- package/dist/complex.cjs +1 -2
- package/dist/complex.d.cts +1 -3
- package/dist/complex.d.ts +1 -3
- package/dist/complex.js +1 -2
- package/dist/{computed-value-CbRF0Izc.d.cts → computed-value-CaFJ1YkU.d.ts} +0 -2
- package/dist/computed-value.cjs +1 -2
- package/dist/computed-value.d.cts +48 -2
- package/dist/computed-value.d.ts +1 -1
- package/dist/computed-value.js +1 -2
- package/dist/derived-aggregates.cjs +1 -2
- package/dist/derived-aggregates.d.cts +2 -4
- package/dist/derived-aggregates.d.ts +2 -4
- package/dist/derived-aggregates.js +1 -2
- package/dist/derived-connectives.cjs +1 -2
- package/dist/derived-connectives.d.cts +2 -4
- package/dist/derived-connectives.d.ts +2 -4
- package/dist/derived-connectives.js +1 -2
- package/dist/derived-patterns.cjs +1 -2
- package/dist/derived-patterns.d.cts +1 -3
- package/dist/derived-patterns.d.ts +1 -3
- package/dist/derived-patterns.js +1 -2
- package/dist/derived-values.cjs +1 -2
- package/dist/derived-values.d.cts +1 -3
- package/dist/derived-values.d.ts +1 -3
- package/dist/derived-values.js +1 -2
- package/dist/{dist-Dn-LI_AV.js → dist-ed78Tuwe.js} +2 -4
- package/dist/{dist-DO_3oafK.cjs → dist-ySX7cb5d.cjs} +2 -4
- package/dist/duration-order.cjs +1 -2
- package/dist/duration-order.d.cts +1 -3
- package/dist/duration-order.d.ts +1 -3
- package/dist/duration-order.js +1 -2
- package/dist/evaluate-document.cjs +4 -5
- package/dist/evaluate-document.d.cts +2 -4
- package/dist/evaluate-document.d.ts +2 -4
- package/dist/evaluate-document.js +4 -5
- package/dist/evaluation.cjs +1 -2
- package/dist/evaluation.d.cts +1 -3
- package/dist/evaluation.d.ts +1 -3
- package/dist/evaluation.js +1 -2
- package/dist/evaluator-budget.cjs +1 -2
- package/dist/evaluator-budget.d.cts +1 -3
- package/dist/evaluator-budget.d.ts +1 -3
- package/dist/evaluator-budget.js +1 -2
- package/dist/evaluator-collection.cjs +1 -2
- package/dist/evaluator-collection.d.cts +5 -7
- package/dist/evaluator-collection.d.ts +5 -7
- package/dist/evaluator-collection.js +1 -2
- package/dist/evaluator-compiled.cjs +3 -4
- package/dist/evaluator-compiled.d.cts +3 -5
- package/dist/evaluator-compiled.d.ts +3 -5
- package/dist/evaluator-compiled.js +3 -4
- package/dist/evaluator-effect.cjs +1 -2
- package/dist/evaluator-effect.d.cts +0 -2
- package/dist/evaluator-effect.d.ts +0 -2
- package/dist/evaluator-effect.js +1 -2
- package/dist/evaluator-factory.cjs +2 -3
- package/dist/evaluator-factory.d.cts +5 -7
- package/dist/evaluator-factory.d.ts +5 -7
- package/dist/evaluator-factory.js +2 -3
- package/dist/evaluator-indeterminacy-helpers.cjs +2 -3
- package/dist/evaluator-indeterminacy-helpers.d.cts +2 -4
- package/dist/evaluator-indeterminacy-helpers.d.ts +2 -4
- package/dist/evaluator-indeterminacy-helpers.js +2 -3
- package/dist/evaluator-literals.cjs +1 -2
- package/dist/evaluator-literals.d.cts +2 -4
- package/dist/evaluator-literals.d.ts +2 -4
- package/dist/evaluator-literals.js +1 -2
- package/dist/evaluator-operations.cjs +2 -3
- package/dist/evaluator-operations.d.cts +4 -6
- package/dist/evaluator-operations.d.ts +4 -6
- package/dist/evaluator-operations.js +2 -3
- package/dist/evaluator-test-helpers.cjs +2 -3
- package/dist/evaluator-test-helpers.d.cts +1 -3
- package/dist/evaluator-test-helpers.d.ts +1 -3
- package/dist/evaluator-test-helpers.js +2 -3
- package/dist/evaluator.cjs +2 -3
- package/dist/evaluator.d.cts +4 -6
- package/dist/evaluator.d.ts +4 -6
- package/dist/evaluator.js +2 -3
- package/dist/functions.cjs +1 -2
- package/dist/functions.d.cts +2 -4
- package/dist/functions.d.ts +2 -4
- package/dist/functions.js +1 -2
- package/dist/{index.CZzC1gGg-C3tq-f5f.cjs → index.CZzC1gGg-CQphWYWn.cjs} +23 -40
- package/dist/{index.CZzC1gGg-DVgiC1Nq.js → index.CZzC1gGg-D3-vRdPe.js} +14 -27
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +10 -10
- package/dist/input-resolvers.cjs +1 -2
- package/dist/input-resolvers.d.cts +2 -4
- package/dist/input-resolvers.d.ts +2 -4
- package/dist/input-resolvers.js +1 -2
- package/dist/integer-power.cjs +1 -2
- package/dist/integer-power.d.cts +1 -3
- package/dist/integer-power.d.ts +1 -3
- package/dist/integer-power.js +1 -2
- package/dist/{json-value-B1Hjjjri.d.cts → json-value-ZLMaKP0n.d.ts} +0 -2
- package/dist/json-value.cjs +1 -2
- package/dist/json-value.d.cts +8 -2
- package/dist/json-value.d.ts +1 -1
- package/dist/json-value.js +1 -2
- package/dist/plain-record.cjs +1 -2
- package/dist/plain-record.d.cts +1 -3
- package/dist/plain-record.d.ts +1 -3
- package/dist/plain-record.js +1 -2
- package/dist/resolvers.d.cts +3 -5
- package/dist/resolvers.d.ts +3 -5
- package/dist/tree.cjs +1 -2
- package/dist/tree.d.cts +2 -4
- package/dist/tree.d.ts +2 -4
- package/dist/tree.js +1 -2
- package/dist-cli/trilean.mjs +24 -47
- package/package.json +3 -3
- package/schemas/trilean.schema.json +1 -1
- package/dist/computed-value-CbRF0Izc.d.ts +0 -51
- package/dist/json-value-B1Hjjjri.d.ts +0 -11
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComputedValue } from "./computed-value.cjs";
|
|
2
2
|
import { Evaluation } from "./evaluation.cjs";
|
|
3
|
-
//#region src/evaluate-document.d.ts
|
|
4
3
|
export type TreeKind = "predicate" | "expression";
|
|
5
4
|
export interface EvaluateDocumentOptions {
|
|
6
5
|
/** The tree as parsed from JSON, not yet validated. */
|
|
@@ -40,5 +39,4 @@ export type DocumentEvaluation = {
|
|
|
40
39
|
*
|
|
41
40
|
* Resolution is limited to what `createInputResolvers` provides: named values, and lists of items for a `fold`, `some` or `every`. A tree that names a collection the inputs do not hold throws that resolver's error, which propagates.
|
|
42
41
|
*/
|
|
43
|
-
export declare function evaluateDocument({ tree, inputs, as, maxNodes }: EvaluateDocumentOptions): DocumentEvaluation;
|
|
44
|
-
//#endregion
|
|
42
|
+
export declare function evaluateDocument({ tree, inputs, as, maxNodes }: EvaluateDocumentOptions): DocumentEvaluation;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as ComputedValue } from "./computed-value-
|
|
1
|
+
import { t as ComputedValue } from "./computed-value-CaFJ1YkU.js";
|
|
2
2
|
import { Evaluation } from "./evaluation.js";
|
|
3
|
-
//#region src/evaluate-document.d.ts
|
|
4
3
|
export type TreeKind = "predicate" | "expression";
|
|
5
4
|
export interface EvaluateDocumentOptions {
|
|
6
5
|
/** The tree as parsed from JSON, not yet validated. */
|
|
@@ -40,5 +39,4 @@ export type DocumentEvaluation = {
|
|
|
40
39
|
*
|
|
41
40
|
* Resolution is limited to what `createInputResolvers` provides: named values, and lists of items for a `fold`, `some` or `every`. A tree that names a collection the inputs do not hold throws that resolver's error, which propagates.
|
|
42
41
|
*/
|
|
43
|
-
export declare function evaluateDocument({ tree, inputs, as, maxNodes }: EvaluateDocumentOptions): DocumentEvaluation;
|
|
44
|
-
//#endregion
|
|
42
|
+
export declare function evaluateDocument({ tree, inputs, as, maxNodes }: EvaluateDocumentOptions): DocumentEvaluation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ComputedValueSchema } from "./computed-value.js";
|
|
2
|
-
import { builtinFunctions } from "./builtin-functions.js";
|
|
3
|
-
import { ExpressionNodeSchema, PredicateNodeSchema } from "./tree.js";
|
|
4
2
|
import { createSyncEvaluator } from "./evaluator-factory.js";
|
|
5
|
-
import {
|
|
3
|
+
import { builtinFunctions } from "./builtin-functions.js";
|
|
6
4
|
import { createInputResolvers, parseInputs } from "./input-resolvers.js";
|
|
7
|
-
|
|
5
|
+
import { isPlainRecord } from "./plain-record.js";
|
|
6
|
+
import { ExpressionNodeSchema, PredicateNodeSchema } from "./tree.js";
|
|
7
|
+
// src/evaluate-document.ts
|
|
8
8
|
const predicateKinds = new Set(PredicateNodeSchema.options.map((option) => option.shape.kind.value));
|
|
9
9
|
/** What a definite expression result that `ComputedValueSchema` refuses is reported as: the only way a result fails it is a non-finite number, which JSON would write as `null`. The evaluator's arithmetic and the built-in functions already keep one from forming, so this is the last check before a value leaves the document boundary, and it fails loudly rather than print a different value from the one computed. */
|
|
10
10
|
const NOT_REPRESENTABLE = "(result): the value is not a finite number";
|
|
@@ -88,5 +88,4 @@ function evaluateDocument({ tree, inputs, as, maxNodes }) {
|
|
|
88
88
|
evaluation
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
//#endregion
|
|
92
91
|
export { evaluateDocument };
|
package/dist/evaluation.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let zod = require("zod");
|
|
3
|
-
|
|
3
|
+
// src/evaluation.ts
|
|
4
4
|
const IndeterminateReasonSchema = zod.z.object({
|
|
5
5
|
/** Which of the four reason categories applies. `not-yet-known` is the only one that is not a property of the data: it says a resolver has not been supplied the value yet, so a later evaluation may settle it either way. */
|
|
6
6
|
code: zod.z.enum([
|
|
@@ -41,7 +41,6 @@ function firstIndeterminate(...results) {
|
|
|
41
41
|
}
|
|
42
42
|
return first;
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
exports.IndeterminateReasonSchema = IndeterminateReasonSchema;
|
|
46
45
|
exports.definite = definite;
|
|
47
46
|
exports.firstIndeterminate = firstIndeterminate;
|
package/dist/evaluation.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/evaluation.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Every evaluation -- of a predicate node or an expression node -- produces exactly one of two outcomes: a definite result, or an indeterminate result carrying a reason. Never a bare boolean/number, and never a thrown exception for a data-quality problem.
|
|
5
4
|
*/
|
|
@@ -27,5 +26,4 @@ export declare function indeterminate(code: IndeterminateReason["code"], message
|
|
|
27
26
|
*
|
|
28
27
|
* The exception exists because this function is only called where a later outcome can still absorb an indeterminate one (`and`, `or`, `memberOf`, a `unique` conditional). Reporting `not-found` for such a node while another operand is still `not-yet-known` would be wrong: that operand might settle as a definite absorbing value, and the node would then be definite where `exists` had already reported its absence. Preferring `not-yet-known` keeps every non-`not-yet-known` reason a statement that no completion of the unknown values can overturn.
|
|
29
28
|
*/
|
|
30
|
-
export declare function firstIndeterminate(...results: readonly (Evaluation<unknown> | undefined)[]): IndeterminateReason | undefined;
|
|
31
|
-
//#endregion
|
|
29
|
+
export declare function firstIndeterminate(...results: readonly (Evaluation<unknown> | undefined)[]): IndeterminateReason | undefined;
|
package/dist/evaluation.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/evaluation.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Every evaluation -- of a predicate node or an expression node -- produces exactly one of two outcomes: a definite result, or an indeterminate result carrying a reason. Never a bare boolean/number, and never a thrown exception for a data-quality problem.
|
|
5
4
|
*/
|
|
@@ -27,5 +26,4 @@ export declare function indeterminate(code: IndeterminateReason["code"], message
|
|
|
27
26
|
*
|
|
28
27
|
* The exception exists because this function is only called where a later outcome can still absorb an indeterminate one (`and`, `or`, `memberOf`, a `unique` conditional). Reporting `not-found` for such a node while another operand is still `not-yet-known` would be wrong: that operand might settle as a definite absorbing value, and the node would then be definite where `exists` had already reported its absence. Preferring `not-yet-known` keeps every non-`not-yet-known` reason a statement that no completion of the unknown values can overturn.
|
|
29
28
|
*/
|
|
30
|
-
export declare function firstIndeterminate(...results: readonly (Evaluation<unknown> | undefined)[]): IndeterminateReason | undefined;
|
|
31
|
-
//#endregion
|
|
29
|
+
export declare function firstIndeterminate(...results: readonly (Evaluation<unknown> | undefined)[]): IndeterminateReason | undefined;
|
package/dist/evaluation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// src/evaluation.ts
|
|
3
3
|
const IndeterminateReasonSchema = z.object({
|
|
4
4
|
/** Which of the four reason categories applies. `not-yet-known` is the only one that is not a property of the data: it says a resolver has not been supplied the value yet, so a later evaluation may settle it either way. */
|
|
5
5
|
code: z.enum([
|
|
@@ -40,5 +40,4 @@ function firstIndeterminate(...results) {
|
|
|
40
40
|
}
|
|
41
41
|
return first;
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { IndeterminateReasonSchema, definite, firstIndeterminate, indeterminate };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_evaluation = require("./evaluation.cjs");
|
|
3
|
-
|
|
3
|
+
// src/evaluator-budget.ts
|
|
4
4
|
/** A defense-in-depth guard against a long acyclic `treeReference` chain exhausting the call stack -- distinct from, and layered on top of, the cycle detector in evaluator.ts (`visitedTreeKeys`), which catches an actual repeat immediately and more precisely. */
|
|
5
5
|
const MAX_TREE_REFERENCE_DEPTH = 100;
|
|
6
6
|
/** Default cap on the total number of predicate/expression nodes a single `evaluatePredicate`/`evaluateValue` call may visit -- see `createEvaluator`'s `maxNodes` option, threaded through to `createEvaluationBudget` below. Chosen generously above any realistic hand-authored business-rule, eligibility, or formula tree (see README.md's own consumer use cases), while still bounding an untrusted, adversarially-authored tree's total evaluation cost to a fixed, small amount of work regardless of how it is shaped. */
|
|
@@ -17,7 +17,6 @@ function createEvaluationBudget(maxNodes, maxNestingDepth) {
|
|
|
17
17
|
if (nestingDepth >= maxNestingDepth) return require_evaluation.indeterminate("domain-error", `evaluation nesting depth exceeds the maximum of ${maxNestingDepth.toString()} (resource exhausted)`);
|
|
18
18
|
} };
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
exports.DEFAULT_MAX_EVALUATION_NODES = DEFAULT_MAX_EVALUATION_NODES;
|
|
22
21
|
exports.DEFAULT_MAX_NESTING_DEPTH = DEFAULT_MAX_NESTING_DEPTH;
|
|
23
22
|
exports.MAX_TREE_REFERENCE_DEPTH = MAX_TREE_REFERENCE_DEPTH;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Evaluation } from "./evaluation.cjs";
|
|
2
|
-
//#region src/evaluator-budget.d.ts
|
|
3
2
|
/** A defense-in-depth guard against a long acyclic `treeReference` chain exhausting the call stack -- distinct from, and layered on top of, the cycle detector in evaluator.ts (`visitedTreeKeys`), which catches an actual repeat immediately and more precisely. */
|
|
4
3
|
export declare const MAX_TREE_REFERENCE_DEPTH = 100;
|
|
5
4
|
/** Default cap on the total number of predicate/expression nodes a single `evaluatePredicate`/`evaluateValue` call may visit -- see `createEvaluator`'s `maxNodes` option, threaded through to `createEvaluationBudget` below. Chosen generously above any realistic hand-authored business-rule, eligibility, or formula tree (see README.md's own consumer use cases), while still bounding an untrusted, adversarially-authored tree's total evaluation cost to a fixed, small amount of work regardless of how it is shaped. */
|
|
@@ -16,5 +15,4 @@ export interface EvaluationBudget {
|
|
|
16
15
|
checkNode: (nestingDepth: number) => Evaluation<never> | undefined;
|
|
17
16
|
}
|
|
18
17
|
/** Constructs a fresh `EvaluationBudget` for one top-level `evaluatePredicate`/`evaluateValue` call -- see `createEvaluator`'s `maxNodes`/`maxNestingDepth` options, which supply `maxNodes`/`maxNestingDepth` here. A fresh closure per call is what keeps `nodesVisited` from leaking between unrelated evaluations. */
|
|
19
|
-
export declare function createEvaluationBudget(maxNodes: number, maxNestingDepth: number): EvaluationBudget;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function createEvaluationBudget(maxNodes: number, maxNestingDepth: number): EvaluationBudget;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Evaluation } from "./evaluation.js";
|
|
2
|
-
//#region src/evaluator-budget.d.ts
|
|
3
2
|
/** A defense-in-depth guard against a long acyclic `treeReference` chain exhausting the call stack -- distinct from, and layered on top of, the cycle detector in evaluator.ts (`visitedTreeKeys`), which catches an actual repeat immediately and more precisely. */
|
|
4
3
|
export declare const MAX_TREE_REFERENCE_DEPTH = 100;
|
|
5
4
|
/** Default cap on the total number of predicate/expression nodes a single `evaluatePredicate`/`evaluateValue` call may visit -- see `createEvaluator`'s `maxNodes` option, threaded through to `createEvaluationBudget` below. Chosen generously above any realistic hand-authored business-rule, eligibility, or formula tree (see README.md's own consumer use cases), while still bounding an untrusted, adversarially-authored tree's total evaluation cost to a fixed, small amount of work regardless of how it is shaped. */
|
|
@@ -16,5 +15,4 @@ export interface EvaluationBudget {
|
|
|
16
15
|
checkNode: (nestingDepth: number) => Evaluation<never> | undefined;
|
|
17
16
|
}
|
|
18
17
|
/** Constructs a fresh `EvaluationBudget` for one top-level `evaluatePredicate`/`evaluateValue` call -- see `createEvaluator`'s `maxNodes`/`maxNestingDepth` options, which supply `maxNodes`/`maxNestingDepth` here. A fresh closure per call is what keeps `nodesVisited` from leaking between unrelated evaluations. */
|
|
19
|
-
export declare function createEvaluationBudget(maxNodes: number, maxNestingDepth: number): EvaluationBudget;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function createEvaluationBudget(maxNodes: number, maxNestingDepth: number): EvaluationBudget;
|
package/dist/evaluator-budget.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { indeterminate } from "./evaluation.js";
|
|
2
|
-
|
|
2
|
+
// src/evaluator-budget.ts
|
|
3
3
|
/** A defense-in-depth guard against a long acyclic `treeReference` chain exhausting the call stack -- distinct from, and layered on top of, the cycle detector in evaluator.ts (`visitedTreeKeys`), which catches an actual repeat immediately and more precisely. */
|
|
4
4
|
const MAX_TREE_REFERENCE_DEPTH = 100;
|
|
5
5
|
/** Default cap on the total number of predicate/expression nodes a single `evaluatePredicate`/`evaluateValue` call may visit -- see `createEvaluator`'s `maxNodes` option, threaded through to `createEvaluationBudget` below. Chosen generously above any realistic hand-authored business-rule, eligibility, or formula tree (see README.md's own consumer use cases), while still bounding an untrusted, adversarially-authored tree's total evaluation cost to a fixed, small amount of work regardless of how it is shaped. */
|
|
@@ -16,5 +16,4 @@ function createEvaluationBudget(maxNodes, maxNestingDepth) {
|
|
|
16
16
|
if (nestingDepth >= maxNestingDepth) return indeterminate("domain-error", `evaluation nesting depth exceeds the maximum of ${maxNestingDepth.toString()} (resource exhausted)`);
|
|
17
17
|
} };
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { DEFAULT_MAX_EVALUATION_NODES, DEFAULT_MAX_NESTING_DEPTH, MAX_TREE_REFERENCE_DEPTH, createEvaluationBudget };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_evaluator_effect = require("./evaluator-effect.cjs");
|
|
3
|
-
|
|
3
|
+
// src/evaluator-collection.ts
|
|
4
4
|
/**
|
|
5
5
|
* Collection resolution shared by the quantifiers (`some`/`every`) and by `fold` in evaluator.ts: resolves the opaque `collection` reference to its concrete candidate list via `resolvers.resolveCollection`, then evaluates each candidate's optional `filter` (via the injected `evaluatePredicate`, see `EvaluatePredicate`'s own doc comment) with that candidate as its own evaluation context and the accumulator reset to `undefined` -- see the README's "Evaluation context" and "Pre-filtering which items participate" sections. Deliberately stops short of deciding how an indeterminate filter combines with the rest of the surrounding node: `some`/`every` fold a filter-indeterminate item in as its own vote via the surrounding OR/AND absorption, while `fold` has no absorbing value at all and goes indeterminate outright on the same condition -- the two callers need genuinely different combination logic over these same per-item outcomes, so this helper only produces the outcomes and leaves combining them to the caller.
|
|
6
6
|
*/
|
|
@@ -29,6 +29,5 @@ function firstFilterIndeterminate(participating) {
|
|
|
29
29
|
if (filterOutcome.status === "indeterminate") return filterOutcome.reason;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
exports.firstFilterIndeterminate = firstFilterIndeterminate;
|
|
34
33
|
exports.resolveParticipatingItems = resolveParticipatingItems;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FunctionRegistry } from "./functions.cjs";
|
|
3
|
-
import { t as JsonValue } from "./json-value-B1Hjjjri.cjs";
|
|
4
|
-
import { PredicateNode } from "./tree.cjs";
|
|
1
|
+
import { ComputedValue } from "./computed-value.cjs";
|
|
5
2
|
import { Evaluation, IndeterminateReason } from "./evaluation.cjs";
|
|
6
3
|
import { EvaluationBudget } from "./evaluator-budget.cjs";
|
|
4
|
+
import { FunctionRegistry } from "./functions.cjs";
|
|
5
|
+
import { JsonValue } from "./json-value.cjs";
|
|
7
6
|
import { Task } from "./evaluator-effect.cjs";
|
|
8
7
|
import { EvaluationContext, EvaluatorResolvers } from "./resolvers.cjs";
|
|
9
|
-
|
|
8
|
+
import { PredicateNode } from "./tree.cjs";
|
|
10
9
|
/** `resolveParticipatingItems`'s own view of `evaluatePredicateInternal` -- the exact signature that function has in evaluator.ts, injected here rather than imported directly so this module has no dependency back on evaluator.ts. Evaluating a `filter` genuinely does need the full recursive predicate evaluator (a filter can itself be arbitrarily nested), but taking it as a parameter rather than an import means this collection-resolution logic and evaluator.ts's mutually-recursive `evaluatePredicateInternal`/`evaluateValueInternal` pair never import each other, so there is no circular-import hazard between the two files. */
|
|
11
10
|
export type EvaluatePredicate = (node: PredicateNode, context: EvaluationContext, resolvers: Readonly<EvaluatorResolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number) => Task<Evaluation<boolean>>;
|
|
12
11
|
/** A collection candidate paired with its own pre-filter outcome: `"include"`/`"exclude"` when `filter` resolved definitely, or the filter's own indeterminate `Evaluation` when it did not (there is no third, definite-but-neither branch -- see `resolveParticipatingItems` below). */
|
|
@@ -19,5 +18,4 @@ export interface ResolvedCollectionItem {
|
|
|
19
18
|
*/
|
|
20
19
|
export declare function resolveParticipatingItems(evaluatePredicate: EvaluatePredicate, collection: JsonValue, filter: PredicateNode | undefined, context: EvaluationContext, resolvers: Readonly<EvaluatorResolvers>, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Task<ResolvedCollectionItem[]>;
|
|
21
20
|
/** The first participating item (in declared collection order) whose `filter` evaluation was itself indeterminate, or `undefined` if every participating item's filter resolved definitely -- a filter-excluded item's own `"exclude"` outcome never counts here. Used only by `fold`, which -- unlike `some`/`every`'s OR/AND absorption -- has no absorbing value at all: any participating item's indeterminate filter makes the whole fold indeterminate outright, with no other item's outcome able to override it. */
|
|
22
|
-
export declare function firstFilterIndeterminate(participating: readonly ResolvedCollectionItem[]): IndeterminateReason | undefined;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare function firstFilterIndeterminate(participating: readonly ResolvedCollectionItem[]): IndeterminateReason | undefined;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { t as ComputedValue } from "./computed-value-
|
|
2
|
-
import { FunctionRegistry } from "./functions.js";
|
|
3
|
-
import { t as JsonValue } from "./json-value-B1Hjjjri.js";
|
|
4
|
-
import { PredicateNode } from "./tree.js";
|
|
1
|
+
import { t as ComputedValue } from "./computed-value-CaFJ1YkU.js";
|
|
5
2
|
import { Evaluation, IndeterminateReason } from "./evaluation.js";
|
|
6
3
|
import { EvaluationBudget } from "./evaluator-budget.js";
|
|
4
|
+
import { FunctionRegistry } from "./functions.js";
|
|
5
|
+
import { t as JsonValue } from "./json-value-ZLMaKP0n.js";
|
|
7
6
|
import { Task } from "./evaluator-effect.js";
|
|
8
7
|
import { EvaluationContext, EvaluatorResolvers } from "./resolvers.js";
|
|
9
|
-
|
|
8
|
+
import { PredicateNode } from "./tree.js";
|
|
10
9
|
/** `resolveParticipatingItems`'s own view of `evaluatePredicateInternal` -- the exact signature that function has in evaluator.ts, injected here rather than imported directly so this module has no dependency back on evaluator.ts. Evaluating a `filter` genuinely does need the full recursive predicate evaluator (a filter can itself be arbitrarily nested), but taking it as a parameter rather than an import means this collection-resolution logic and evaluator.ts's mutually-recursive `evaluatePredicateInternal`/`evaluateValueInternal` pair never import each other, so there is no circular-import hazard between the two files. */
|
|
11
10
|
export type EvaluatePredicate = (node: PredicateNode, context: EvaluationContext, resolvers: Readonly<EvaluatorResolvers>, accumulator: ComputedValue | undefined, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number) => Task<Evaluation<boolean>>;
|
|
12
11
|
/** A collection candidate paired with its own pre-filter outcome: `"include"`/`"exclude"` when `filter` resolved definitely, or the filter's own indeterminate `Evaluation` when it did not (there is no third, definite-but-neither branch -- see `resolveParticipatingItems` below). */
|
|
@@ -19,5 +18,4 @@ export interface ResolvedCollectionItem {
|
|
|
19
18
|
*/
|
|
20
19
|
export declare function resolveParticipatingItems(evaluatePredicate: EvaluatePredicate, collection: JsonValue, filter: PredicateNode | undefined, context: EvaluationContext, resolvers: Readonly<EvaluatorResolvers>, functions: Readonly<FunctionRegistry>, visitedTreeKeys: ReadonlySet<string>, treeReferenceDepth: number, budget: Readonly<EvaluationBudget>, nestingDepth: number): Task<ResolvedCollectionItem[]>;
|
|
21
20
|
/** The first participating item (in declared collection order) whose `filter` evaluation was itself indeterminate, or `undefined` if every participating item's filter resolved definitely -- a filter-excluded item's own `"exclude"` outcome never counts here. Used only by `fold`, which -- unlike `some`/`every`'s OR/AND absorption -- has no absorbing value at all: any participating item's indeterminate filter makes the whole fold indeterminate outright, with no other item's outcome able to override it. */
|
|
22
|
-
export declare function firstFilterIndeterminate(participating: readonly ResolvedCollectionItem[]): IndeterminateReason | undefined;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare function firstFilterIndeterminate(participating: readonly ResolvedCollectionItem[]): IndeterminateReason | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { all, wait } from "./evaluator-effect.js";
|
|
2
|
-
|
|
2
|
+
// src/evaluator-collection.ts
|
|
3
3
|
/**
|
|
4
4
|
* Collection resolution shared by the quantifiers (`some`/`every`) and by `fold` in evaluator.ts: resolves the opaque `collection` reference to its concrete candidate list via `resolvers.resolveCollection`, then evaluates each candidate's optional `filter` (via the injected `evaluatePredicate`, see `EvaluatePredicate`'s own doc comment) with that candidate as its own evaluation context and the accumulator reset to `undefined` -- see the README's "Evaluation context" and "Pre-filtering which items participate" sections. Deliberately stops short of deciding how an indeterminate filter combines with the rest of the surrounding node: `some`/`every` fold a filter-indeterminate item in as its own vote via the surrounding OR/AND absorption, while `fold` has no absorbing value at all and goes indeterminate outright on the same condition -- the two callers need genuinely different combination logic over these same per-item outcomes, so this helper only produces the outcomes and leaves combining them to the caller.
|
|
5
5
|
*/
|
|
@@ -28,5 +28,4 @@ function firstFilterIndeterminate(participating) {
|
|
|
28
28
|
if (filterOutcome.status === "indeterminate") return filterOutcome.reason;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { firstFilterIndeterminate, resolveParticipatingItems };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_evaluation = require("./evaluation.cjs");
|
|
3
3
|
const require_evaluator_budget = require("./evaluator-budget.cjs");
|
|
4
|
+
const require_evaluator = require("./evaluator.cjs");
|
|
4
5
|
const require_evaluator_effect = require("./evaluator-effect.cjs");
|
|
5
|
-
const require_evaluator_operations = require("./evaluator-operations.cjs");
|
|
6
6
|
const require_evaluator_literals = require("./evaluator-literals.cjs");
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const require_evaluator_operations = require("./evaluator-operations.cjs");
|
|
8
|
+
// src/evaluator-compiled.ts
|
|
9
9
|
/** Never charged: handed to the nodes of a tree compiled without budget counting, none of which reads it. */
|
|
10
10
|
const UNLIMITED_BUDGET = { checkNode: () => void 0 };
|
|
11
11
|
/** The `visitedTreeKeys` of a call that has not entered any `treeReference`; the interpreter copies it rather than mutating it, so one instance serves every call. */
|
|
@@ -307,5 +307,4 @@ function compilePredicateTree(node, functions, maxNodes, maxNestingDepth) {
|
|
|
307
307
|
const countedRun = new NodeCompiler(functions, maxNestingDepth, true).predicate(node, 0);
|
|
308
308
|
return (context, resolvers) => countedRun(context, resolvers, require_evaluator_budget.createEvaluationBudget(maxNodes, maxNestingDepth));
|
|
309
309
|
}
|
|
310
|
-
//#endregion
|
|
311
310
|
exports.compilePredicateTree = compilePredicateTree;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { FunctionRegistry } from "./functions.cjs";
|
|
2
|
-
import { PredicateNode } from "./tree.cjs";
|
|
3
1
|
import { Evaluation } from "./evaluation.cjs";
|
|
2
|
+
import { FunctionRegistry } from "./functions.cjs";
|
|
4
3
|
import { EvaluationContext, SyncResolvers } from "./resolvers.cjs";
|
|
5
|
-
|
|
4
|
+
import { PredicateNode } from "./tree.cjs";
|
|
6
5
|
/**
|
|
7
6
|
* A predicate tree prepared for repeated evaluation: the same result as `createSyncEvaluator`'s `evaluatePredicate` over the tree it was compiled from, for any context and resolvers.
|
|
8
7
|
*/
|
|
@@ -16,5 +15,4 @@ export type CompiledPredicate = (context: EvaluationContext, resolvers: Readonly
|
|
|
16
15
|
*
|
|
17
16
|
* Precondition: `node` is a well-formed `PredicateNode` and is not mutated after this call, since what the tree fixes is read here once. Errors: none at compile time; a call throws exactly when the interpreter would (a resolver or registered function that throws, a promise from a resolver).
|
|
18
17
|
*/
|
|
19
|
-
export declare function compilePredicateTree(node: PredicateNode, functions: Readonly<FunctionRegistry>, maxNodes: number, maxNestingDepth: number): CompiledPredicate;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function compilePredicateTree(node: PredicateNode, functions: Readonly<FunctionRegistry>, maxNodes: number, maxNestingDepth: number): CompiledPredicate;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { FunctionRegistry } from "./functions.js";
|
|
2
|
-
import { PredicateNode } from "./tree.js";
|
|
3
1
|
import { Evaluation } from "./evaluation.js";
|
|
2
|
+
import { FunctionRegistry } from "./functions.js";
|
|
4
3
|
import { EvaluationContext, SyncResolvers } from "./resolvers.js";
|
|
5
|
-
|
|
4
|
+
import { PredicateNode } from "./tree.js";
|
|
6
5
|
/**
|
|
7
6
|
* A predicate tree prepared for repeated evaluation: the same result as `createSyncEvaluator`'s `evaluatePredicate` over the tree it was compiled from, for any context and resolvers.
|
|
8
7
|
*/
|
|
@@ -16,5 +15,4 @@ export type CompiledPredicate = (context: EvaluationContext, resolvers: Readonly
|
|
|
16
15
|
*
|
|
17
16
|
* Precondition: `node` is a well-formed `PredicateNode` and is not mutated after this call, since what the tree fixes is read here once. Errors: none at compile time; a call throws exactly when the interpreter would (a resolver or registered function that throws, a promise from a resolver).
|
|
18
17
|
*/
|
|
19
|
-
export declare function compilePredicateTree(node: PredicateNode, functions: Readonly<FunctionRegistry>, maxNodes: number, maxNestingDepth: number): CompiledPredicate;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function compilePredicateTree(node: PredicateNode, functions: Readonly<FunctionRegistry>, maxNodes: number, maxNestingDepth: number): CompiledPredicate;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { definite, firstIndeterminate, indeterminate } from "./evaluation.js";
|
|
2
2
|
import { createEvaluationBudget } from "./evaluator-budget.js";
|
|
3
|
+
import { evaluatePredicateInternal, evaluateValueInternal } from "./evaluator.js";
|
|
3
4
|
import { runSync, settleSync } from "./evaluator-effect.js";
|
|
4
|
-
import { absenceEvaluation, applyArithmetic, applyNegate, checkReferenceUnit, combineAnd, combineOr, compareText, compareValues, computeMembershipMatch, invokeRegisteredFunction } from "./evaluator-operations.js";
|
|
5
5
|
import { literalValue } from "./evaluator-literals.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { absenceEvaluation, applyArithmetic, applyNegate, checkReferenceUnit, combineAnd, combineOr, compareText, compareValues, computeMembershipMatch, invokeRegisteredFunction } from "./evaluator-operations.js";
|
|
7
|
+
// src/evaluator-compiled.ts
|
|
8
8
|
/** Never charged: handed to the nodes of a tree compiled without budget counting, none of which reads it. */
|
|
9
9
|
const UNLIMITED_BUDGET = { checkNode: () => void 0 };
|
|
10
10
|
/** The `visitedTreeKeys` of a call that has not entered any `treeReference`; the interpreter copies it rather than mutating it, so one instance serves every call. */
|
|
@@ -306,5 +306,4 @@ function compilePredicateTree(node, functions, maxNodes, maxNestingDepth) {
|
|
|
306
306
|
const countedRun = new NodeCompiler(functions, maxNestingDepth, true).predicate(node, 0);
|
|
307
307
|
return (context, resolvers) => countedRun(context, resolvers, createEvaluationBudget(maxNodes, maxNestingDepth));
|
|
308
308
|
}
|
|
309
|
-
//#endregion
|
|
310
309
|
export { compilePredicateTree };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/evaluator-effect.ts
|
|
3
3
|
/**
|
|
4
4
|
* Suspends until `value` is available. The driver resumes the task with exactly that value (awaited, in the async driver), and the generator's own "next" type is `T`, so the result is typed without an assertion.
|
|
5
5
|
*/
|
|
@@ -50,7 +50,6 @@ function runSync(task) {
|
|
|
50
50
|
}
|
|
51
51
|
return step.value;
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
exports.all = all;
|
|
55
54
|
exports.runAsync = runAsync;
|
|
56
55
|
exports.runSync = runSync;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/evaluator-effect.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The evaluator's node rules are written once, as generator functions that describe *what* to wait for rather than *how* to wait for it. `evaluator.ts` `yield*`s two kinds of suspension and never touches a promise itself:
|
|
4
3
|
* - `wait`: a single resolver result that is either already a value or a promise of one.
|
|
@@ -38,5 +37,4 @@ export declare function runAsync<T>(task: Readonly<Runnable<T>>): Promise<T>;
|
|
|
38
37
|
* Runs a task to completion without awaiting anything: an `all` group's tasks run one after another, and a `wait` on a promise throws (see `settleSync`).
|
|
39
38
|
*/
|
|
40
39
|
export declare function runSync<T>(task: Readonly<Runnable<T>>): T;
|
|
41
|
-
//#endregion
|
|
42
40
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/evaluator-effect.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The evaluator's node rules are written once, as generator functions that describe *what* to wait for rather than *how* to wait for it. `evaluator.ts` `yield*`s two kinds of suspension and never touches a promise itself:
|
|
4
3
|
* - `wait`: a single resolver result that is either already a value or a promise of one.
|
|
@@ -38,5 +37,4 @@ export declare function runAsync<T>(task: Readonly<Runnable<T>>): Promise<T>;
|
|
|
38
37
|
* Runs a task to completion without awaiting anything: an `all` group's tasks run one after another, and a `wait` on a promise throws (see `settleSync`).
|
|
39
38
|
*/
|
|
40
39
|
export declare function runSync<T>(task: Readonly<Runnable<T>>): T;
|
|
41
|
-
//#endregion
|
|
42
40
|
export {};
|
package/dist/evaluator-effect.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/evaluator-effect.ts
|
|
2
2
|
/**
|
|
3
3
|
* Suspends until `value` is available. The driver resumes the task with exactly that value (awaited, in the async driver), and the generator's own "next" type is `T`, so the result is typed without an assertion.
|
|
4
4
|
*/
|
|
@@ -49,5 +49,4 @@ function runSync(task) {
|
|
|
49
49
|
}
|
|
50
50
|
return step.value;
|
|
51
51
|
}
|
|
52
|
-
//#endregion
|
|
53
52
|
export { all, runAsync, runSync, settleSync, wait };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_evaluator_budget = require("./evaluator-budget.cjs");
|
|
3
|
-
const require_evaluator_effect = require("./evaluator-effect.cjs");
|
|
4
3
|
const require_evaluator = require("./evaluator.cjs");
|
|
5
4
|
const require_evaluator_compiled = require("./evaluator-compiled.cjs");
|
|
6
5
|
const require_functions = require("./functions.cjs");
|
|
7
|
-
|
|
6
|
+
const require_evaluator_effect = require("./evaluator-effect.cjs");
|
|
7
|
+
// src/evaluator-factory.ts
|
|
8
8
|
/**
|
|
9
9
|
* Builds a bound `{ evaluatePredicate, evaluateValue }` pair over a caller-supplied function registry for `call` nodes -- the registry is bound once, at construction time, unlike `resolvers`, which are supplied fresh to every call. `maxNodes` and `maxNestingDepth` configure that same pair's own `EvaluationBudget` (see its doc comment in evaluator-budget.ts), created fresh for every top-level `evaluatePredicate`/`evaluateValue` invocation so budgets never leak between unrelated calls. The bare module-level `evaluatePredicate`/`evaluateValue` exports below are `createEvaluator({})`'s output, so both caps default to `DEFAULT_MAX_EVALUATION_NODES`/`DEFAULT_MAX_NESTING_DEPTH` for every caller that does not explicitly configure them.
|
|
10
10
|
*/
|
|
@@ -25,7 +25,6 @@ function createSyncEvaluator({ functions = require_functions.emptyFunctionRegist
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
const { evaluatePredicate, evaluateValue } = createEvaluator({});
|
|
28
|
-
//#endregion
|
|
29
28
|
exports.createEvaluator = createEvaluator;
|
|
30
29
|
exports.createSyncEvaluator = createSyncEvaluator;
|
|
31
30
|
exports.evaluatePredicate = evaluatePredicate;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FunctionRegistry } from "./functions.cjs";
|
|
3
|
-
import { ExpressionNode, PredicateNode } from "./tree.cjs";
|
|
1
|
+
import { ComputedValue } from "./computed-value.cjs";
|
|
4
2
|
import { Evaluation } from "./evaluation.cjs";
|
|
5
|
-
import { EvaluationContext, Resolvers, SyncResolvers } from "./resolvers.cjs";
|
|
6
3
|
import { CompiledPredicate } from "./evaluator-compiled.cjs";
|
|
7
|
-
|
|
4
|
+
import { FunctionRegistry } from "./functions.cjs";
|
|
5
|
+
import { EvaluationContext, Resolvers, SyncResolvers } from "./resolvers.cjs";
|
|
6
|
+
import { ExpressionNode, PredicateNode } from "./tree.cjs";
|
|
8
7
|
/**
|
|
9
8
|
* Builds a bound `{ evaluatePredicate, evaluateValue }` pair over a caller-supplied function registry for `call` nodes -- the registry is bound once, at construction time, unlike `resolvers`, which are supplied fresh to every call. `maxNodes` and `maxNestingDepth` configure that same pair's own `EvaluationBudget` (see its doc comment in evaluator-budget.ts), created fresh for every top-level `evaluatePredicate`/`evaluateValue` invocation so budgets never leak between unrelated calls. The bare module-level `evaluatePredicate`/`evaluateValue` exports below are `createEvaluator({})`'s output, so both caps default to `DEFAULT_MAX_EVALUATION_NODES`/`DEFAULT_MAX_NESTING_DEPTH` for every caller that does not explicitly configure them.
|
|
10
9
|
*/
|
|
@@ -32,5 +31,4 @@ export declare function createSyncEvaluator({ functions, maxNodes, maxNestingDep
|
|
|
32
31
|
/** Prepares `node` for repeated evaluation under changing resolvers; see `CompiledPredicate` and `compilePredicateTree`. The function it returns gives the result `evaluatePredicate` gives for the same node, context and resolvers, without walking the tree afresh on each call, and is bound to this evaluator's functions and limits. */
|
|
33
32
|
compilePredicate: (node: PredicateNode) => CompiledPredicate;
|
|
34
33
|
};
|
|
35
|
-
export declare const evaluatePredicate: (node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<boolean>>, evaluateValue: (node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<ComputedValue>>;
|
|
36
|
-
//#endregion
|
|
34
|
+
export declare const evaluatePredicate: (node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<boolean>>, evaluateValue: (node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<ComputedValue>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { t as ComputedValue } from "./computed-value-
|
|
2
|
-
import { FunctionRegistry } from "./functions.js";
|
|
3
|
-
import { ExpressionNode, PredicateNode } from "./tree.js";
|
|
1
|
+
import { t as ComputedValue } from "./computed-value-CaFJ1YkU.js";
|
|
4
2
|
import { Evaluation } from "./evaluation.js";
|
|
5
|
-
import { EvaluationContext, Resolvers, SyncResolvers } from "./resolvers.js";
|
|
6
3
|
import { CompiledPredicate } from "./evaluator-compiled.js";
|
|
7
|
-
|
|
4
|
+
import { FunctionRegistry } from "./functions.js";
|
|
5
|
+
import { EvaluationContext, Resolvers, SyncResolvers } from "./resolvers.js";
|
|
6
|
+
import { ExpressionNode, PredicateNode } from "./tree.js";
|
|
8
7
|
/**
|
|
9
8
|
* Builds a bound `{ evaluatePredicate, evaluateValue }` pair over a caller-supplied function registry for `call` nodes -- the registry is bound once, at construction time, unlike `resolvers`, which are supplied fresh to every call. `maxNodes` and `maxNestingDepth` configure that same pair's own `EvaluationBudget` (see its doc comment in evaluator-budget.ts), created fresh for every top-level `evaluatePredicate`/`evaluateValue` invocation so budgets never leak between unrelated calls. The bare module-level `evaluatePredicate`/`evaluateValue` exports below are `createEvaluator({})`'s output, so both caps default to `DEFAULT_MAX_EVALUATION_NODES`/`DEFAULT_MAX_NESTING_DEPTH` for every caller that does not explicitly configure them.
|
|
10
9
|
*/
|
|
@@ -32,5 +31,4 @@ export declare function createSyncEvaluator({ functions, maxNodes, maxNestingDep
|
|
|
32
31
|
/** Prepares `node` for repeated evaluation under changing resolvers; see `CompiledPredicate` and `compilePredicateTree`. The function it returns gives the result `evaluatePredicate` gives for the same node, context and resolvers, without walking the tree afresh on each call, and is bound to this evaluator's functions and limits. */
|
|
33
32
|
compilePredicate: (node: PredicateNode) => CompiledPredicate;
|
|
34
33
|
};
|
|
35
|
-
export declare const evaluatePredicate: (node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<boolean>>, evaluateValue: (node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<ComputedValue>>;
|
|
36
|
-
//#endregion
|
|
34
|
+
export declare const evaluatePredicate: (node: PredicateNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<boolean>>, evaluateValue: (node: ExpressionNode, context: EvaluationContext, resolvers: Readonly<Resolvers>) => Promise<Evaluation<ComputedValue>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DEFAULT_MAX_EVALUATION_NODES, createEvaluationBudget } from "./evaluator-budget.js";
|
|
2
|
-
import { runAsync, runSync } from "./evaluator-effect.js";
|
|
3
2
|
import { evaluatePredicateInternal, evaluateValueInternal } from "./evaluator.js";
|
|
4
3
|
import { compilePredicateTree } from "./evaluator-compiled.js";
|
|
5
4
|
import { emptyFunctionRegistry } from "./functions.js";
|
|
6
|
-
|
|
5
|
+
import { runAsync, runSync } from "./evaluator-effect.js";
|
|
6
|
+
// src/evaluator-factory.ts
|
|
7
7
|
/**
|
|
8
8
|
* Builds a bound `{ evaluatePredicate, evaluateValue }` pair over a caller-supplied function registry for `call` nodes -- the registry is bound once, at construction time, unlike `resolvers`, which are supplied fresh to every call. `maxNodes` and `maxNestingDepth` configure that same pair's own `EvaluationBudget` (see its doc comment in evaluator-budget.ts), created fresh for every top-level `evaluatePredicate`/`evaluateValue` invocation so budgets never leak between unrelated calls. The bare module-level `evaluatePredicate`/`evaluateValue` exports below are `createEvaluator({})`'s output, so both caps default to `DEFAULT_MAX_EVALUATION_NODES`/`DEFAULT_MAX_NESTING_DEPTH` for every caller that does not explicitly configure them.
|
|
9
9
|
*/
|
|
@@ -24,5 +24,4 @@ function createSyncEvaluator({ functions = emptyFunctionRegistry, maxNodes = DEF
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
const { evaluatePredicate, evaluateValue } = createEvaluator({});
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createEvaluator, createSyncEvaluator, evaluatePredicate, evaluateValue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_index_CZzC1gGg = require("./index.CZzC1gGg-
|
|
2
|
+
const require_index_CZzC1gGg = require("./index.CZzC1gGg-CQphWYWn.cjs");
|
|
3
3
|
const require_evaluator_factory = require("./evaluator-factory.cjs");
|
|
4
|
-
|
|
4
|
+
// src/evaluator-indeterminacy-helpers.ts
|
|
5
5
|
/**
|
|
6
6
|
* Shared fixture machinery for the two split indeterminacy test files (evaluator.indeterminacy-table.unit.test.ts, evaluator.indeterminacy-cases.unit.test.ts): systematic, table-driven coverage of README.md's "Indeterminacy reference" section, one fixture per node-kind x reason-code combination that section documents, for every `PredicateNode`/`ExpressionNode` kind implemented. This complements, rather than replaces, the ad hoc behavioural tests already spread across the evaluator.*.test.ts files and truth-tables.unit.test.ts.
|
|
7
7
|
*/
|
|
@@ -155,7 +155,6 @@ async function runFixture({ run, expected }) {
|
|
|
155
155
|
require_index_CZzC1gGg.globalExpect(result.status).toBe(expected.status);
|
|
156
156
|
if (expected.status === "indeterminate" && result.status === "indeterminate") require_index_CZzC1gGg.globalExpect(result.reason.code).toBe(expected.code);
|
|
157
157
|
}
|
|
158
|
-
//#endregion
|
|
159
158
|
exports.baseResolvers = baseResolvers;
|
|
160
159
|
exports.divideByZero = divideByZero;
|
|
161
160
|
exports.expr = expr;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { FunctionRegistry } from "./functions.cjs";
|
|
2
|
-
import { ExpressionNode, PredicateNode } from "./tree.cjs";
|
|
3
1
|
import { IndeterminateReason } from "./evaluation.cjs";
|
|
2
|
+
import { FunctionRegistry } from "./functions.cjs";
|
|
4
3
|
import { EvaluationContext, Resolvers } from "./resolvers.cjs";
|
|
5
|
-
|
|
4
|
+
import { ExpressionNode, PredicateNode } from "./tree.cjs";
|
|
6
5
|
/**
|
|
7
6
|
* Shared fixture machinery for the two split indeterminacy test files (evaluator.indeterminacy-table.unit.test.ts, evaluator.indeterminacy-cases.unit.test.ts): systematic, table-driven coverage of README.md's "Indeterminacy reference" section, one fixture per node-kind x reason-code combination that section documents, for every `PredicateNode`/`ExpressionNode` kind implemented. This complements, rather than replaces, the ad hoc behavioural tests already spread across the evaluator.*.test.ts files and truth-tables.unit.test.ts.
|
|
8
7
|
*/
|
|
@@ -53,5 +52,4 @@ export interface FixtureOverrides {
|
|
|
53
52
|
export declare function pred(description: string, node: PredicateNode, expected: Expected, overrides?: FixtureOverrides): Fixture;
|
|
54
53
|
export declare function expr(description: string, node: ExpressionNode, expected: Expected, overrides?: FixtureOverrides): Fixture;
|
|
55
54
|
export declare function runFixture({ run, expected }: Fixture): Promise<void>;
|
|
56
|
-
//#endregion
|
|
57
55
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { FunctionRegistry } from "./functions.js";
|
|
2
|
-
import { ExpressionNode, PredicateNode } from "./tree.js";
|
|
3
1
|
import { IndeterminateReason } from "./evaluation.js";
|
|
2
|
+
import { FunctionRegistry } from "./functions.js";
|
|
4
3
|
import { EvaluationContext, Resolvers } from "./resolvers.js";
|
|
5
|
-
|
|
4
|
+
import { ExpressionNode, PredicateNode } from "./tree.js";
|
|
6
5
|
/**
|
|
7
6
|
* Shared fixture machinery for the two split indeterminacy test files (evaluator.indeterminacy-table.unit.test.ts, evaluator.indeterminacy-cases.unit.test.ts): systematic, table-driven coverage of README.md's "Indeterminacy reference" section, one fixture per node-kind x reason-code combination that section documents, for every `PredicateNode`/`ExpressionNode` kind implemented. This complements, rather than replaces, the ad hoc behavioural tests already spread across the evaluator.*.test.ts files and truth-tables.unit.test.ts.
|
|
8
7
|
*/
|
|
@@ -53,5 +52,4 @@ export interface FixtureOverrides {
|
|
|
53
52
|
export declare function pred(description: string, node: PredicateNode, expected: Expected, overrides?: FixtureOverrides): Fixture;
|
|
54
53
|
export declare function expr(description: string, node: ExpressionNode, expected: Expected, overrides?: FixtureOverrides): Fixture;
|
|
55
54
|
export declare function runFixture({ run, expected }: Fixture): Promise<void>;
|
|
56
|
-
//#endregion
|
|
57
55
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { t as globalExpect } from "./index.CZzC1gGg-D3-vRdPe.js";
|
|
1
2
|
import { createEvaluator, evaluatePredicate, evaluateValue } from "./evaluator-factory.js";
|
|
2
|
-
|
|
3
|
-
//#region src/evaluator-indeterminacy-helpers.ts
|
|
3
|
+
// src/evaluator-indeterminacy-helpers.ts
|
|
4
4
|
/**
|
|
5
5
|
* Shared fixture machinery for the two split indeterminacy test files (evaluator.indeterminacy-table.unit.test.ts, evaluator.indeterminacy-cases.unit.test.ts): systematic, table-driven coverage of README.md's "Indeterminacy reference" section, one fixture per node-kind x reason-code combination that section documents, for every `PredicateNode`/`ExpressionNode` kind implemented. This complements, rather than replaces, the ad hoc behavioural tests already spread across the evaluator.*.test.ts files and truth-tables.unit.test.ts.
|
|
6
6
|
*/
|
|
@@ -154,5 +154,4 @@ async function runFixture({ run, expected }) {
|
|
|
154
154
|
globalExpect(result.status).toBe(expected.status);
|
|
155
155
|
if (expected.status === "indeterminate" && result.status === "indeterminate") globalExpect(result.reason.code).toBe(expected.code);
|
|
156
156
|
}
|
|
157
|
-
//#endregion
|
|
158
157
|
export { baseResolvers, divideByZero, expr, falseGuard, isDefinite, isDomainError, isNotFound, isPlainRecord, isUnknownArray, isWrongType, laterConditionalCaseValue, memberOfProbeValue, missingGuard, missingRef, numberLiteral, pred, reduceInitialSeed, runFixture, trueGuard, uniqueHitPolicyThirdCaseValue, untouchedReduceInitial, wrongTypeArithmetic };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_complex = require("./complex.cjs");
|
|
3
|
-
|
|
3
|
+
// src/evaluator-literals.ts
|
|
4
4
|
/**
|
|
5
5
|
* The `ComputedValue` a literal node denotes, as a new object on every call. Whichever authoring form a `complexLiteral` used (see the "Complex values" section of README.md), it is normalised here to the single rectangular `ComputedValue`, so nothing downstream (arithmetic, compare, memberOf, negate) ever sees a polar-authored value. Shared by the interpreter and the compiled path so a literal means one thing in both.
|
|
6
6
|
*/
|
|
@@ -39,5 +39,4 @@ function literalValue(node) {
|
|
|
39
39
|
default: throw new Error("unreachable literal node kind");
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
exports.literalValue = literalValue;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComputedValue } from "./computed-value.cjs";
|
|
2
2
|
import { BooleanLiteralNode, ComplexLiteralNode, DurationLiteralNode, InstantLiteralNode, NumberLiteralNode, TextLiteralNode } from "./tree.cjs";
|
|
3
|
-
//#region src/evaluator-literals.d.ts
|
|
4
3
|
/** Every expression node kind that is a constant: it evaluates to a value without consulting a resolver or any other node. */
|
|
5
4
|
export type LiteralNode = NumberLiteralNode | TextLiteralNode | BooleanLiteralNode | InstantLiteralNode | DurationLiteralNode | ComplexLiteralNode;
|
|
6
5
|
/**
|
|
7
6
|
* The `ComputedValue` a literal node denotes, as a new object on every call. Whichever authoring form a `complexLiteral` used (see the "Complex values" section of README.md), it is normalised here to the single rectangular `ComputedValue`, so nothing downstream (arithmetic, compare, memberOf, negate) ever sees a polar-authored value. Shared by the interpreter and the compiled path so a literal means one thing in both.
|
|
8
7
|
*/
|
|
9
|
-
export declare function literalValue(node: Readonly<LiteralNode>): ComputedValue;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function literalValue(node: Readonly<LiteralNode>): ComputedValue;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { t as ComputedValue } from "./computed-value-
|
|
1
|
+
import { t as ComputedValue } from "./computed-value-CaFJ1YkU.js";
|
|
2
2
|
import { BooleanLiteralNode, ComplexLiteralNode, DurationLiteralNode, InstantLiteralNode, NumberLiteralNode, TextLiteralNode } from "./tree.js";
|
|
3
|
-
//#region src/evaluator-literals.d.ts
|
|
4
3
|
/** Every expression node kind that is a constant: it evaluates to a value without consulting a resolver or any other node. */
|
|
5
4
|
export type LiteralNode = NumberLiteralNode | TextLiteralNode | BooleanLiteralNode | InstantLiteralNode | DurationLiteralNode | ComplexLiteralNode;
|
|
6
5
|
/**
|
|
7
6
|
* The `ComputedValue` a literal node denotes, as a new object on every call. Whichever authoring form a `complexLiteral` used (see the "Complex values" section of README.md), it is normalised here to the single rectangular `ComputedValue`, so nothing downstream (arithmetic, compare, memberOf, negate) ever sees a polar-authored value. Shared by the interpreter and the compiled path so a literal means one thing in both.
|
|
8
7
|
*/
|
|
9
|
-
export declare function literalValue(node: Readonly<LiteralNode>): ComputedValue;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function literalValue(node: Readonly<LiteralNode>): ComputedValue;
|