@almadar/runtime 4.0.0 → 4.0.1

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 { I as IEventBus } from './types-B8OfRFfV.js';
1
+ import { I as IEventBus } from './types-CVSBlnzV.js';
2
2
  import { EventPayload } from '@almadar/core';
3
3
 
4
4
  /**
@@ -1010,16 +1010,24 @@ var EffectExecutor = class {
1010
1010
  on_message: asStr(block.on_message) ?? asStr(block.onMessage)
1011
1011
  };
1012
1012
  }
1013
+ /** Build the source metadata stamp for an emit fired from this trait. */
1014
+ sourceStamp() {
1015
+ return {
1016
+ orbital: this.context.orbitalName,
1017
+ trait: this.context.traitName,
1018
+ transition: this.context.transition
1019
+ };
1020
+ }
1013
1021
  emitSuccess(emit, key, payload) {
1014
1022
  const eventName = emit?.[key];
1015
1023
  if (eventName) {
1016
- this.handlers.emit(eventName, payload);
1024
+ this.handlers.emit(eventName, payload, this.sourceStamp());
1017
1025
  }
1018
1026
  }
1019
1027
  emitFailure(emit, err) {
1020
1028
  if (!emit?.failure) return;
1021
1029
  const error = err instanceof Error ? err.message : String(err);
1022
- this.handlers.emit(emit.failure, { error });
1030
+ this.handlers.emit(emit.failure, { error }, this.sourceStamp());
1023
1031
  }
1024
1032
  /**
1025
1033
  * Narrow the generic emit config into the `os/watch-*` handler surface
@@ -1043,7 +1051,7 @@ var EffectExecutor = class {
1043
1051
  case "emit": {
1044
1052
  const event = args[0];
1045
1053
  const payload = args[1];
1046
- this.handlers.emit(event, payload);
1054
+ this.handlers.emit(event, payload, this.sourceStamp());
1047
1055
  break;
1048
1056
  }
1049
1057
  case "set": {
@@ -2684,5 +2692,5 @@ function parseNamespacedEvent(eventName) {
2684
2692
  }
2685
2693
 
2686
2694
  export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent };
2687
- //# sourceMappingURL=chunk-WIWVHE3P.js.map
2688
- //# sourceMappingURL=chunk-WIWVHE3P.js.map
2695
+ //# sourceMappingURL=chunk-7WP4AE6X.js.map
2696
+ //# sourceMappingURL=chunk-7WP4AE6X.js.map