@almadar/runtime 6.12.0 → 6.14.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/{OrbitalServerRuntime-D4UFgl5l.d.ts → OrbitalServerRuntime-Cg1CiUdz.d.ts} +18 -3
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +19 -15
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/ServerBridge.d.ts +1 -1
- package/dist/{chunk-QJ4UEHGC.js → chunk-QVGSVPYW.js} +44 -6
- package/dist/chunk-QVGSVPYW.js.map +1 -0
- package/dist/createOsHandlers.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/{types-ymgqmXOq.d.ts → types-GFwSbdv_.d.ts} +8 -0
- package/package.json +1 -1
- package/dist/chunk-QJ4UEHGC.js.map +0 -1
package/dist/ServerBridge.d.ts
CHANGED
|
@@ -306,6 +306,9 @@ function createContextFromBindings(bindings, strictBindings, contextExtensions)
|
|
|
306
306
|
if (bindings.config) {
|
|
307
307
|
ctx.config = bindings.config;
|
|
308
308
|
}
|
|
309
|
+
if (bindings.locals) {
|
|
310
|
+
ctx.locals = bindings.locals;
|
|
311
|
+
}
|
|
309
312
|
if (contextExtensions) {
|
|
310
313
|
Object.assign(ctx, contextExtensions);
|
|
311
314
|
}
|
|
@@ -854,7 +857,7 @@ function resolveArgs(args, bindings, strictBindings, contextExtensions) {
|
|
|
854
857
|
const ctx = createContextFromBindings(bindings, strictBindings, contextExtensions);
|
|
855
858
|
return args.map((arg) => interpolateValue(arg, ctx));
|
|
856
859
|
}
|
|
857
|
-
var EffectExecutor = class {
|
|
860
|
+
var EffectExecutor = class _EffectExecutor {
|
|
858
861
|
handlers;
|
|
859
862
|
bindings;
|
|
860
863
|
context;
|
|
@@ -941,7 +944,7 @@ var EffectExecutor = class {
|
|
|
941
944
|
registered.push(name);
|
|
942
945
|
}
|
|
943
946
|
}
|
|
944
|
-
registered.push("do", "when");
|
|
947
|
+
registered.push("do", "when", "let", "if");
|
|
945
948
|
return registered;
|
|
946
949
|
}
|
|
947
950
|
/**
|
|
@@ -956,7 +959,7 @@ var EffectExecutor = class {
|
|
|
956
959
|
return;
|
|
957
960
|
}
|
|
958
961
|
const { operator, args } = parsed;
|
|
959
|
-
const isCompound = operator === "do" || operator === "when";
|
|
962
|
+
const isCompound = operator === "do" || operator === "when" || operator === "let" || operator === "if";
|
|
960
963
|
const isSetPathForm = operator === "set" && args.length >= 2 && typeof args[0] === "string" && args[0].startsWith("@entity.");
|
|
961
964
|
const isFetchLike = (operator === "fetch" || operator === "ref" || operator === "deref" || operator === "os/watch-collection" || operator === "os/watch") && args.length >= 2 && args[1] !== null && typeof args[1] === "object" && !Array.isArray(args[1]);
|
|
962
965
|
let resolvedArgs;
|
|
@@ -1038,7 +1041,7 @@ var EffectExecutor = class {
|
|
|
1038
1041
|
}
|
|
1039
1042
|
const start = Date.now();
|
|
1040
1043
|
const { operator, args: rawArgs } = parsed;
|
|
1041
|
-
const isCompound = operator === "do" || operator === "when";
|
|
1044
|
+
const isCompound = operator === "do" || operator === "when" || operator === "let" || operator === "if";
|
|
1042
1045
|
const resolvedArgs = isCompound ? rawArgs : resolveArgs(rawArgs, this.bindings, this.strictBindings, this.contextExtensions);
|
|
1043
1046
|
try {
|
|
1044
1047
|
await this.dispatch(operator, resolvedArgs);
|
|
@@ -1463,6 +1466,41 @@ var EffectExecutor = class {
|
|
|
1463
1466
|
}
|
|
1464
1467
|
break;
|
|
1465
1468
|
}
|
|
1469
|
+
case "if": {
|
|
1470
|
+
const ctx = createContextFromBindings(this.bindings, false, this.contextExtensions);
|
|
1471
|
+
const cond = interpolateValue(args[0], ctx);
|
|
1472
|
+
const branch = cond ? args[1] : args[2];
|
|
1473
|
+
if (Array.isArray(branch)) {
|
|
1474
|
+
await this.execute(branch);
|
|
1475
|
+
}
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
case "let": {
|
|
1479
|
+
const rawBindings = args[0];
|
|
1480
|
+
const body = args[1];
|
|
1481
|
+
const locals = new Map(this.bindings.locals);
|
|
1482
|
+
const pairs = Array.isArray(rawBindings) ? rawBindings.flatMap(
|
|
1483
|
+
(b) => Array.isArray(b) && typeof b[0] === "string" ? [[b[0], b[1]]] : []
|
|
1484
|
+
) : Object.entries(rawBindings);
|
|
1485
|
+
for (const [name, valueExpr] of pairs) {
|
|
1486
|
+
const ctx = createContextFromBindings(
|
|
1487
|
+
{ ...this.bindings, locals },
|
|
1488
|
+
false,
|
|
1489
|
+
this.contextExtensions
|
|
1490
|
+
);
|
|
1491
|
+
locals.set(name, interpolateValue(valueExpr, ctx));
|
|
1492
|
+
}
|
|
1493
|
+
const bodyExecutor = new _EffectExecutor({
|
|
1494
|
+
handlers: this.handlers,
|
|
1495
|
+
bindings: { ...this.bindings, locals },
|
|
1496
|
+
context: this.context,
|
|
1497
|
+
debug: this.debug,
|
|
1498
|
+
strictBindings: this.strictBindings,
|
|
1499
|
+
contextExtensions: this.contextExtensions
|
|
1500
|
+
});
|
|
1501
|
+
await bodyExecutor.execute(body);
|
|
1502
|
+
break;
|
|
1503
|
+
}
|
|
1466
1504
|
// OS trigger operators (server-side only)
|
|
1467
1505
|
//
|
|
1468
1506
|
// Each may carry `emit:` inside a trailing options object. The
|
|
@@ -3674,5 +3712,5 @@ var InMemoryPersistence = class {
|
|
|
3674
3712
|
};
|
|
3675
3713
|
|
|
3676
3714
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, buildEmitsFromTraits, collectDeclaredConfigDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMockPersistence, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes };
|
|
3677
|
-
//# sourceMappingURL=chunk-
|
|
3678
|
-
//# sourceMappingURL=chunk-
|
|
3715
|
+
//# sourceMappingURL=chunk-QVGSVPYW.js.map
|
|
3716
|
+
//# sourceMappingURL=chunk-QVGSVPYW.js.map
|