@almadar/runtime 5.8.0 → 5.8.2
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,5 +1,5 @@
|
|
|
1
|
-
import { createLogger, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, validateEventPayload, formatPayloadValidationError, EffectExecutor } from './chunk-
|
|
2
|
-
export { InMemoryPersistence } from './chunk-
|
|
1
|
+
import { createLogger, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, validateEventPayload, formatPayloadValidationError, EffectExecutor } from './chunk-6XUD4OHN.js';
|
|
2
|
+
export { InMemoryPersistence } from './chunk-6XUD4OHN.js';
|
|
3
3
|
import './chunk-PZ5AY32C.js';
|
|
4
4
|
import * as nodeModule from 'module';
|
|
5
5
|
import { evaluateGuard, evaluate } from '@almadar/evaluator';
|
|
@@ -269,6 +269,9 @@ function interpolateArray(value, ctx) {
|
|
|
269
269
|
if (value.length === 0) {
|
|
270
270
|
return value;
|
|
271
271
|
}
|
|
272
|
+
if (Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string") {
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
272
275
|
if (isSExpression(value)) {
|
|
273
276
|
return evaluate(value, ctx);
|
|
274
277
|
}
|
|
@@ -2656,15 +2659,53 @@ function renameEntityInRenderUiConfig(node, oldName, newName) {
|
|
|
2656
2659
|
return next;
|
|
2657
2660
|
}
|
|
2658
2661
|
function renameEntityInEffects(effects, oldName, newName) {
|
|
2659
|
-
return effects.map((effect) =>
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2662
|
+
return effects.map((effect) => renameEntityInEffect(effect, oldName, newName));
|
|
2663
|
+
}
|
|
2664
|
+
var ENTITY_AT_POS_1 = /* @__PURE__ */ new Set(["fetch", "ref", "deref", "spawn"]);
|
|
2665
|
+
var ALL_ARGS_ARE_EFFECTS = /* @__PURE__ */ new Set([
|
|
2666
|
+
"do",
|
|
2667
|
+
"atomic",
|
|
2668
|
+
"async/race",
|
|
2669
|
+
"async/all",
|
|
2670
|
+
"async/sequence"
|
|
2671
|
+
]);
|
|
2672
|
+
var ARGS_FROM_POS_2_ARE_EFFECTS = /* @__PURE__ */ new Set([
|
|
2673
|
+
"if",
|
|
2674
|
+
"when",
|
|
2675
|
+
"let",
|
|
2676
|
+
"async/delay",
|
|
2677
|
+
"async/debounce",
|
|
2678
|
+
"async/throttle",
|
|
2679
|
+
"async/interval"
|
|
2680
|
+
]);
|
|
2681
|
+
function renameEntityInEffect(effect, oldName, newName) {
|
|
2682
|
+
if (!Array.isArray(effect) || effect.length === 0) return effect;
|
|
2683
|
+
const op = effect[0];
|
|
2684
|
+
if (typeof op !== "string") return effect;
|
|
2685
|
+
if (op === "render-ui" && effect.length >= 3) {
|
|
2686
|
+
const [, slot, config, ...rest] = effect;
|
|
2687
|
+
const nextConfig = renameEntityInRenderUiConfig(config, oldName, newName);
|
|
2688
|
+
return [op, slot, nextConfig, ...rest];
|
|
2689
|
+
}
|
|
2690
|
+
if (op === "persist" && effect.length >= 3 && effect[2] === oldName) {
|
|
2691
|
+
return [op, effect[1], newName, ...effect.slice(3)];
|
|
2692
|
+
}
|
|
2693
|
+
if (ENTITY_AT_POS_1.has(op) && effect[1] === oldName) {
|
|
2694
|
+
return [op, newName, ...effect.slice(2)];
|
|
2695
|
+
}
|
|
2696
|
+
const skipFirstNonEffectArg = ARGS_FROM_POS_2_ARE_EFFECTS.has(op);
|
|
2697
|
+
const recurseAll = ALL_ARGS_ARE_EFFECTS.has(op);
|
|
2698
|
+
if (recurseAll || skipFirstNonEffectArg) {
|
|
2699
|
+
const startIndex = skipFirstNonEffectArg ? 2 : 1;
|
|
2700
|
+
return effect.map((arg, i) => {
|
|
2701
|
+
if (i < startIndex) return arg;
|
|
2702
|
+
if (Array.isArray(arg)) {
|
|
2703
|
+
return renameEntityInEffect(arg, oldName, newName);
|
|
2704
|
+
}
|
|
2705
|
+
return arg;
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
return effect;
|
|
2668
2709
|
}
|
|
2669
2710
|
function applyLinkedEntityRename(trait, linkedEntity) {
|
|
2670
2711
|
const atomLinked = trait.linkedEntity;
|
|
@@ -2679,6 +2720,12 @@ function applyLinkedEntityRename(trait, linkedEntity) {
|
|
|
2679
2720
|
) : t.effects;
|
|
2680
2721
|
return { ...t, effects: nextEffects };
|
|
2681
2722
|
});
|
|
2723
|
+
refResolverLog.info("linkedEntity:rename", {
|
|
2724
|
+
trait: trait.name,
|
|
2725
|
+
from: atomLinked,
|
|
2726
|
+
to: linkedEntity,
|
|
2727
|
+
transitionCount: nextTransitions.length
|
|
2728
|
+
});
|
|
2682
2729
|
return {
|
|
2683
2730
|
...trait,
|
|
2684
2731
|
linkedEntity,
|
|
@@ -3433,5 +3480,5 @@ var InMemoryPersistence = class {
|
|
|
3433
3480
|
};
|
|
3434
3481
|
|
|
3435
3482
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, buildEmitsFromTraits, containsBindings, createContextFromBindings, createInitialTraitState, createLogger, createMockPersistence, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes };
|
|
3436
|
-
//# sourceMappingURL=chunk-
|
|
3437
|
-
//# sourceMappingURL=chunk-
|
|
3483
|
+
//# sourceMappingURL=chunk-6XUD4OHN.js.map
|
|
3484
|
+
//# sourceMappingURL=chunk-6XUD4OHN.js.map
|