@almadar/evaluator 2.43.0 → 2.45.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-DY9A18IY.d.ts → index-DmefVNGd.d.ts} +16 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/operators/index.d.ts +1 -1
- package/dist/operators/index.js +3 -0
- package/dist/operators/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -18,6 +18,18 @@ interface EvaluationContext {
|
|
|
18
18
|
entity: EntityRow;
|
|
19
19
|
/** Payload data for @payload bindings */
|
|
20
20
|
payload: EventPayload;
|
|
21
|
+
/**
|
|
22
|
+
* The composing effect's triggering payload, for a trait embedded via
|
|
23
|
+
* `@trait.X` inline into a parent's render-ui. The lolo lowerer hoists a
|
|
24
|
+
* JSX render site's `?field` reads into the embedded child's config as
|
|
25
|
+
* `@callsitePayload.<field>` — mirrors the compiled path's
|
|
26
|
+
* `CALLSITE_PAYLOAD_PREFIX` (`orbital-core/src/schema/types.rs`) and
|
|
27
|
+
* `@almadar/core`'s `CORE_BINDINGS` root `callsitePayload`. Set by
|
|
28
|
+
* `OrbitalServerRuntime.executeEffects` / the client's
|
|
29
|
+
* `useTraitStateMachine` when re-running an embedded child's lifecycle
|
|
30
|
+
* transition under its embedder's payload.
|
|
31
|
+
*/
|
|
32
|
+
callsitePayload?: EventPayload;
|
|
21
33
|
/** Current state for @state binding */
|
|
22
34
|
state: string;
|
|
23
35
|
/** Current timestamp for @now binding (defaults to Date.now()) */
|
|
@@ -343,7 +355,10 @@ declare function evalLast(args: SExpr[], evaluate: Evaluator$2, ctx: EvaluationC
|
|
|
343
355
|
*/
|
|
344
356
|
declare function evalNth(args: SExpr[], evaluate: Evaluator$2, ctx: EvaluationContext): RuntimeValue;
|
|
345
357
|
/**
|
|
346
|
-
*
|
|
358
|
+
* Array-concat semantics for a collection of args. Not wired to any bare
|
|
359
|
+
* "concat" S-expr head (removed as an ambiguous alias — use 'array/concat'
|
|
360
|
+
* or std/array.ts's evalArrayConcat, which is what "array/concat" dispatches
|
|
361
|
+
* to); kept as a plain exported utility.
|
|
347
362
|
*/
|
|
348
363
|
declare function evalConcat(args: SExpr[], evaluate: Evaluator$2, ctx: EvaluationContext): RuntimeValue[];
|
|
349
364
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SExpr, RuntimeValue, ListenPayloadEvaluator } from '@almadar/core';
|
|
2
2
|
export { CORE_BINDINGS, CoreBinding, Expression, ExpressionSchema, ParsedBinding, SExpr, SExprAtom, SExprSchema, UserContext, collectBindings, getArgs, getOperator, isBinding, isSExpr, isSExprAtom, isSExprCall, isValidBinding, parseBinding, sexpr, walkSExpr } from '@almadar/core';
|
|
3
|
-
import { E as EvaluationContext } from './index-
|
|
4
|
-
export { c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalAtomic, h as evalCallService, i as evalCeil, j as evalClamp, k as evalConcat, l as evalCount, m as evalDecrement, n as evalDeref, o as evalDespawn, p as evalDivide, q as evalDo, r as evalEmit, s as evalEmpty, t as evalEqual, u as evalFilter, v as evalFind, w as evalFirst, x as evalFloor, y as evalFn, z as evalGreaterThan, A as evalGreaterThanOrEqual, B as evalIf, C as evalIncludes, D as evalIncrement, F as evalLast, G as evalLessThan, H as evalLessThanOrEqual, I as evalLet, J as evalList, K as evalMap, L as evalMatches, M as evalMax, N as evalMin, O as evalModulo, P as evalMultiply, Q as evalNavigate, R as evalNot, S as evalNotEqual, T as evalNotify, U as evalNth, V as evalOr, W as evalPersist, X as evalRef, Y as evalRenderUI, Z as evalRound, _ as evalSet, $ as evalSetDynamic, a0 as evalSpawn, a1 as evalSubtract, a2 as evalSum, a3 as evalSwap, a4 as evalWatch, a5 as evalWhen, a6 as resolveBinding } from './index-
|
|
3
|
+
import { E as EvaluationContext } from './index-DmefVNGd.js';
|
|
4
|
+
export { c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalAtomic, h as evalCallService, i as evalCeil, j as evalClamp, k as evalConcat, l as evalCount, m as evalDecrement, n as evalDeref, o as evalDespawn, p as evalDivide, q as evalDo, r as evalEmit, s as evalEmpty, t as evalEqual, u as evalFilter, v as evalFind, w as evalFirst, x as evalFloor, y as evalFn, z as evalGreaterThan, A as evalGreaterThanOrEqual, B as evalIf, C as evalIncludes, D as evalIncrement, F as evalLast, G as evalLessThan, H as evalLessThanOrEqual, I as evalLet, J as evalList, K as evalMap, L as evalMatches, M as evalMax, N as evalMin, O as evalModulo, P as evalMultiply, Q as evalNavigate, R as evalNot, S as evalNotEqual, T as evalNotify, U as evalNth, V as evalOr, W as evalPersist, X as evalRef, Y as evalRenderUI, Z as evalRound, _ as evalSet, $ as evalSetDynamic, a0 as evalSpawn, a1 as evalSubtract, a2 as evalSum, a3 as evalSwap, a4 as evalWatch, a5 as evalWhen, a6 as resolveBinding } from './index-DmefVNGd.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* S-Expression Evaluator
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,9 @@ function resolveBinding(binding, ctx) {
|
|
|
63
63
|
case "payload":
|
|
64
64
|
value = ctx.payload;
|
|
65
65
|
break;
|
|
66
|
+
case "callsitePayload":
|
|
67
|
+
value = ctx.callsitePayload;
|
|
68
|
+
break;
|
|
66
69
|
case "state":
|
|
67
70
|
return ctx.state;
|
|
68
71
|
// @state has no path
|
|
@@ -1035,10 +1038,6 @@ function evalArrayRange(args, evaluate2, ctx) {
|
|
|
1035
1038
|
}
|
|
1036
1039
|
return out;
|
|
1037
1040
|
}
|
|
1038
|
-
function evalArrayEmpty(args, evaluate2, ctx) {
|
|
1039
|
-
const arr = evaluate2(args[0], ctx);
|
|
1040
|
-
return !arr || arr.length === 0;
|
|
1041
|
-
}
|
|
1042
1041
|
function evalArrayFirst(args, evaluate2, ctx) {
|
|
1043
1042
|
const arr = evaluate2(args[0], ctx);
|
|
1044
1043
|
return arr?.[0] ?? null;
|
|
@@ -1526,10 +1525,6 @@ function evalObjectFilter(args, evaluate2, ctx) {
|
|
|
1526
1525
|
}
|
|
1527
1526
|
return result;
|
|
1528
1527
|
}
|
|
1529
|
-
function evalObjectEmpty(args, evaluate2, ctx) {
|
|
1530
|
-
const obj = evaluate2(args[0], ctx);
|
|
1531
|
-
return !obj || Object.keys(obj).length === 0;
|
|
1532
|
-
}
|
|
1533
1528
|
function evalObjectEquals(args, evaluate2, ctx) {
|
|
1534
1529
|
const a = evaluate2(args[0], ctx);
|
|
1535
1530
|
const b = evaluate2(args[1], ctx);
|
|
@@ -4163,6 +4158,13 @@ function evalPathReachable(args, evaluate2, ctx) {
|
|
|
4163
4158
|
|
|
4164
4159
|
// SExpressionEvaluator.ts
|
|
4165
4160
|
var UNKNOWN_OPERATOR = /* @__PURE__ */ Symbol("unknown-operator");
|
|
4161
|
+
function assertNotAmbiguousConcat(op) {
|
|
4162
|
+
if (op === "concat") {
|
|
4163
|
+
throw new Error(
|
|
4164
|
+
"Ambiguous operator 'concat': use 'str/concat' (string) or 'array/concat' (array)"
|
|
4165
|
+
);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4166
4168
|
var OPERATOR_TABLE = {
|
|
4167
4169
|
"+": evalAdd,
|
|
4168
4170
|
"-": evalSubtract,
|
|
@@ -4201,7 +4203,6 @@ var OPERATOR_TABLE = {
|
|
|
4201
4203
|
"first": evalFirst,
|
|
4202
4204
|
"last": evalLast,
|
|
4203
4205
|
"nth": evalNth,
|
|
4204
|
-
"concat": evalConcat,
|
|
4205
4206
|
"includes": evalIncludes,
|
|
4206
4207
|
"empty": evalEmpty,
|
|
4207
4208
|
"list": evalList,
|
|
@@ -4360,7 +4361,6 @@ var OPERATOR_TABLE = {
|
|
|
4360
4361
|
"to-string": (args, evaluate2, ctx) => String(evaluate2(args[0], ctx)),
|
|
4361
4362
|
"array/len": evalArrayLen,
|
|
4362
4363
|
"array/range": evalArrayRange,
|
|
4363
|
-
"array/empty?": evalArrayEmpty,
|
|
4364
4364
|
"array/first": evalArrayFirst,
|
|
4365
4365
|
"array/last": evalArrayLast,
|
|
4366
4366
|
"array/nth": evalArrayNth,
|
|
@@ -4414,7 +4414,6 @@ var OPERATOR_TABLE = {
|
|
|
4414
4414
|
"object/mapValues": evalObjectMapValues,
|
|
4415
4415
|
"object/mapKeys": evalObjectMapKeys,
|
|
4416
4416
|
"object/filter": evalObjectFilter,
|
|
4417
|
-
"object/empty?": evalObjectEmpty,
|
|
4418
4417
|
"object/equals": evalObjectEquals,
|
|
4419
4418
|
"object/clone": evalObjectClone,
|
|
4420
4419
|
"object/deepClone": evalObjectDeepClone,
|
|
@@ -4705,6 +4704,7 @@ var SExpressionEvaluator = class {
|
|
|
4705
4704
|
} else {
|
|
4706
4705
|
const op = getOperator(expr);
|
|
4707
4706
|
const args = getArgs(expr);
|
|
4707
|
+
assertNotAmbiguousConcat(op);
|
|
4708
4708
|
assertOperatorArity(op, args.length);
|
|
4709
4709
|
const impl = OPERATOR_TABLE[op];
|
|
4710
4710
|
for (const item of expr) {
|
|
@@ -4787,6 +4787,7 @@ var SExpressionEvaluator = class {
|
|
|
4787
4787
|
* Dispatch to the appropriate operator implementation.
|
|
4788
4788
|
*/
|
|
4789
4789
|
dispatchOperator(op, args, ctx) {
|
|
4790
|
+
assertNotAmbiguousConcat(op);
|
|
4790
4791
|
assertOperatorArity(op, args.length);
|
|
4791
4792
|
const impl = OPERATOR_TABLE[op];
|
|
4792
4793
|
if (impl === void 0) return UNKNOWN_OPERATOR;
|