@almadar/evaluator 2.44.0 → 2.46.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-DDh6RIVu.d.ts → index-DmefVNGd.d.ts} +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -10
- 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()) */
|
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);
|
|
@@ -1569,6 +1564,26 @@ function evalPath(args, evaluate2, ctx) {
|
|
|
1569
1564
|
return segments.join(".");
|
|
1570
1565
|
}
|
|
1571
1566
|
|
|
1567
|
+
// std/json.ts
|
|
1568
|
+
function evalJsonParse(args, evaluate2, ctx) {
|
|
1569
|
+
const val = evaluate2(args[0], ctx);
|
|
1570
|
+
if (typeof val !== "string") return null;
|
|
1571
|
+
try {
|
|
1572
|
+
return JSON.parse(val);
|
|
1573
|
+
} catch {
|
|
1574
|
+
return null;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function evalJsonStringify(args, evaluate2, ctx) {
|
|
1578
|
+
const val = evaluate2(args[0], ctx);
|
|
1579
|
+
try {
|
|
1580
|
+
const out = JSON.stringify(val);
|
|
1581
|
+
return out === void 0 ? null : out;
|
|
1582
|
+
} catch {
|
|
1583
|
+
return null;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1572
1587
|
// std/validate.ts
|
|
1573
1588
|
function evalValidateRequired(args, evaluate2, ctx) {
|
|
1574
1589
|
const value = evaluate2(args[0], ctx);
|
|
@@ -4366,7 +4381,6 @@ var OPERATOR_TABLE = {
|
|
|
4366
4381
|
"to-string": (args, evaluate2, ctx) => String(evaluate2(args[0], ctx)),
|
|
4367
4382
|
"array/len": evalArrayLen,
|
|
4368
4383
|
"array/range": evalArrayRange,
|
|
4369
|
-
"array/empty?": evalArrayEmpty,
|
|
4370
4384
|
"array/first": evalArrayFirst,
|
|
4371
4385
|
"array/last": evalArrayLast,
|
|
4372
4386
|
"array/nth": evalArrayNth,
|
|
@@ -4420,11 +4434,12 @@ var OPERATOR_TABLE = {
|
|
|
4420
4434
|
"object/mapValues": evalObjectMapValues,
|
|
4421
4435
|
"object/mapKeys": evalObjectMapKeys,
|
|
4422
4436
|
"object/filter": evalObjectFilter,
|
|
4423
|
-
"object/empty?": evalObjectEmpty,
|
|
4424
4437
|
"object/equals": evalObjectEquals,
|
|
4425
4438
|
"object/clone": evalObjectClone,
|
|
4426
4439
|
"object/deepClone": evalObjectDeepClone,
|
|
4427
4440
|
"path": evalPath,
|
|
4441
|
+
"json/parse": evalJsonParse,
|
|
4442
|
+
"json/stringify": evalJsonStringify,
|
|
4428
4443
|
"validate/required": evalValidateRequired,
|
|
4429
4444
|
"validate/string": evalValidateString,
|
|
4430
4445
|
"validate/number": evalValidateNumber,
|