@almadar/evaluator 2.32.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -22
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isSExpr, isBinding, getOperator, getArgs, isFieldValue, isEventPayloadValue, isSessionHistoryEntry, isPlanSnapshot, OrbitalZodSchema, safeParseOrbitalSchema } from '@almadar/core';
|
|
2
2
|
export { CORE_BINDINGS, ExpressionSchema, SExprSchema, collectBindings, getArgs, getOperator, isBinding, isSExpr, isSExprAtom, isSExprCall, isValidBinding, parseBinding, sexpr, walkSExpr } from '@almadar/core';
|
|
3
|
-
import {
|
|
3
|
+
import { assertOperatorArity } from '@almadar/std/registry';
|
|
4
4
|
|
|
5
5
|
// types/expression.ts
|
|
6
6
|
|
|
@@ -104,27 +104,6 @@ function resolveBinding(binding, ctx) {
|
|
|
104
104
|
}
|
|
105
105
|
return value;
|
|
106
106
|
}
|
|
107
|
-
var require2 = createRequire(import.meta.url);
|
|
108
|
-
var canonicalOperators = require2("@almadar/std/canonical-operators.json");
|
|
109
|
-
var ARITY = new Map(
|
|
110
|
-
Object.entries(canonicalOperators.operators).map(
|
|
111
|
-
([name, meta]) => [
|
|
112
|
-
name,
|
|
113
|
-
{ min: meta.minArity ?? 0, max: meta.maxArity === void 0 ? null : meta.maxArity }
|
|
114
|
-
]
|
|
115
|
-
)
|
|
116
|
-
);
|
|
117
|
-
function assertOperatorArity(op, argCount) {
|
|
118
|
-
const bounds = ARITY.get(op);
|
|
119
|
-
if (!bounds) return;
|
|
120
|
-
const { min, max } = bounds;
|
|
121
|
-
if (argCount < min || max !== null && argCount > max) {
|
|
122
|
-
const range = max === null ? `at least ${min}` : min === max ? `${min}` : `${min}..${max}`;
|
|
123
|
-
throw new Error(
|
|
124
|
-
`(${op} \u2026): expected ${range} argument(s), got ${argCount} \u2014 same bounds the compiled path enforces (canonical-operators.json)`
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
107
|
|
|
129
108
|
// operators/arithmetic.ts
|
|
130
109
|
function evalAdd(args, evaluate2, ctx) {
|