@almadar/runtime 3.1.3 → 3.1.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventBus, createUnifiedLoader, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-
|
|
1
|
+
import { EventBus, createUnifiedLoader, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-6PAKTVTR.js';
|
|
2
2
|
import './chunk-PZ5AY32C.js';
|
|
3
3
|
import { Router } from 'express';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -886,7 +886,16 @@ var EffectExecutor = class {
|
|
|
886
886
|
}
|
|
887
887
|
const { operator, args } = parsed;
|
|
888
888
|
const isCompound = operator === "do" || operator === "when";
|
|
889
|
-
const
|
|
889
|
+
const isSet3Elem = operator === "set" && args.length === 2 && typeof args[0] === "string" && args[0].startsWith("@entity.");
|
|
890
|
+
let resolvedArgs;
|
|
891
|
+
if (isCompound) {
|
|
892
|
+
resolvedArgs = args;
|
|
893
|
+
} else if (isSet3Elem) {
|
|
894
|
+
const ctx = createContextFromBindings(this.bindings, this.strictBindings, this.contextExtensions);
|
|
895
|
+
resolvedArgs = [args[0], interpolateValue(args[1], ctx)];
|
|
896
|
+
} else {
|
|
897
|
+
resolvedArgs = resolveArgs(args, this.bindings, this.strictBindings, this.contextExtensions);
|
|
898
|
+
}
|
|
890
899
|
effectLog.debug("execute", { operator, argCount: resolvedArgs.length, context: this.context.traitName });
|
|
891
900
|
if (this.debug) {
|
|
892
901
|
console.log("[EffectExecutor] Executing:", operator, resolvedArgs);
|
|
@@ -975,9 +984,25 @@ var EffectExecutor = class {
|
|
|
975
984
|
break;
|
|
976
985
|
}
|
|
977
986
|
case "set": {
|
|
978
|
-
const [entityId, field, value] = args;
|
|
979
|
-
this.handlers.set(entityId, field, value);
|
|
980
987
|
const entity = this.bindings.entity;
|
|
988
|
+
let entityId;
|
|
989
|
+
let field;
|
|
990
|
+
let value;
|
|
991
|
+
if (args.length === 2 && typeof args[0] === "string" && args[0].startsWith("@entity.")) {
|
|
992
|
+
const path = args[0];
|
|
993
|
+
field = path.slice("@entity.".length);
|
|
994
|
+
value = args[1];
|
|
995
|
+
entityId = typeof entity?.["id"] === "string" ? entity["id"] : void 0;
|
|
996
|
+
if (!entityId) {
|
|
997
|
+
effectLog.warn("set:missing-entity-id", { path });
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
entityId = args[0];
|
|
1002
|
+
field = args[1];
|
|
1003
|
+
value = args[2];
|
|
1004
|
+
}
|
|
1005
|
+
this.handlers.set(entityId, field, value);
|
|
981
1006
|
if (entity && entity["id"] === entityId) {
|
|
982
1007
|
entity[field] = value;
|
|
983
1008
|
}
|
|
@@ -2534,5 +2559,5 @@ function parseNamespacedEvent(eventName) {
|
|
|
2534
2559
|
}
|
|
2535
2560
|
|
|
2536
2561
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isNamespacedEvent, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent };
|
|
2537
|
-
//# sourceMappingURL=chunk-
|
|
2538
|
-
//# sourceMappingURL=chunk-
|
|
2562
|
+
//# sourceMappingURL=chunk-6PAKTVTR.js.map
|
|
2563
|
+
//# sourceMappingURL=chunk-6PAKTVTR.js.map
|