@almadar/runtime 3.3.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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as BindingContext, E as EvaluationContextExtensions, P as PatternProps, a as EffectHandlers, b as EffectContext, c as ExecutionEnvironment, d as EffectResult, T as TraitDefinition } from './types-B8OfRFfV.js';
2
- export { e as Effect, f as EventListener, H as HANDLER_MANIFEST, I as IEventBus, R as RuntimeConfig, g as RuntimeEvent, h as TraitState, i as TransitionObserver, j as TransitionResult, U as Unsubscribe } from './types-B8OfRFfV.js';
3
- import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital } from './OrbitalServerRuntime-DMRvEfcT.js';
4
- export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, O as OrbitalEventRequest, e as OrbitalEventResponse, f as OrbitalServerRuntimeConfig, P as PersistenceAdapter, g as PreprocessOptions, h as PreprocessResult, i as PreprocessedSchema, j as ProcessEventOptions, R as RegisteredOrbital, k as RuntimeOrbital, l as RuntimeOrbitalSchema, m as RuntimeTrait, n as StateMachineManager, o as createInitialTraitState, p as findInitialState, q as findTransition, r as getIsolatedCollectionName, s as getNamespacedEvent, t as isBrowser, u as isElectron, v as isNamespacedEvent, w as isNode, x as normalizeEventKey, y as parseNamespacedEvent, z as preprocessSchema, A as processEvent } from './OrbitalServerRuntime-DMRvEfcT.js';
1
+ import { B as BindingContext, E as EvaluationContextExtensions, P as PatternProps, a as EffectHandlers, b as EffectContext, c as ExecutionEnvironment, d as EffectResult, T as TraitDefinition } from './types-CVSBlnzV.js';
2
+ export { e as Effect, f as EventListener, H as HANDLER_MANIFEST, I as IEventBus, R as RuntimeConfig, g as RuntimeEvent, h as TraitState, i as TransitionObserver, j as TransitionResult, U as Unsubscribe } from './types-CVSBlnzV.js';
3
+ import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital } from './OrbitalServerRuntime-DMe0zqCc.js';
4
+ export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, O as OrbitalEventRequest, e as OrbitalEventResponse, f as OrbitalServerRuntimeConfig, P as PersistenceAdapter, g as PreprocessOptions, h as PreprocessResult, i as PreprocessedSchema, j as ProcessEventOptions, R as RegisteredOrbital, k as RuntimeOrbital, l as RuntimeOrbitalSchema, m as RuntimeTrait, n as StateMachineManager, o as createInitialTraitState, p as findInitialState, q as findTransition, r as getIsolatedCollectionName, s as getNamespacedEvent, t as isBrowser, u as isElectron, v as isNamespacedEvent, w as isNode, x as normalizeEventKey, y as parseNamespacedEvent, z as preprocessSchema, A as processEvent } from './OrbitalServerRuntime-DMe0zqCc.js';
5
5
  import { EvaluationContext } from '@almadar/evaluator';
6
6
  export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
7
7
  import { EventPayload, EntityRow, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
@@ -290,6 +290,8 @@ declare class EffectExecutor {
290
290
  */
291
291
  executeWithResults(effects: unknown[]): Promise<EffectResult[]>;
292
292
  private extractEmitConfig;
293
+ /** Build the source metadata stamp for an emit fired from this trait. */
294
+ private sourceStamp;
293
295
  private emitSuccess;
294
296
  private emitFailure;
295
297
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent } from './chunk-II3JSETH.js';
1
+ export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent } from './chunk-7WP4AE6X.js';
2
2
  import { __export } from './chunk-PZ5AY32C.js';
3
3
  import { isInlineTrait } from '@almadar/core';
4
4
 
@@ -115,8 +115,16 @@ interface TraitDefinition {
115
115
  * Server: Express, database, integrators
116
116
  */
117
117
  interface EffectHandlers {
118
- /** Emit an event to the event bus */
119
- emit: (event: string, payload?: EventPayload) => void;
118
+ /**
119
+ * Emit an event to the event bus.
120
+ *
121
+ * `source` carries the emitter's identity (orbital + trait) so that
122
+ * source-scoped listeners (`TraitName EVENT -> TRIGGER` and
123
+ * `Orbital.TraitName EVENT -> TRIGGER` in .lolo) can filter incoming
124
+ * events by their originating trait. Omitted when the emit is
125
+ * synthesized by a non-trait context (e.g. test harness).
126
+ */
127
+ emit: (event: string, payload?: EventPayload, source?: RuntimeEvent['source']) => void;
120
128
  /** Persist data (create/update/delete/batch) */
121
129
  persist: (action: 'create' | 'update' | 'delete' | 'batch', entityType: string, data?: EntityRow) => Promise<void>;
122
130
  /** Set a field value on an entity */
@@ -235,6 +243,11 @@ type Effect = [string, ...unknown[]];
235
243
  interface EffectContext {
236
244
  /** Trait name */
237
245
  traitName: string;
246
+ /** Orbital that owns the firing trait. Used to stamp the source
247
+ * metadata on emits so source-scoped listens (`TraitName EVENT` for
248
+ * intra-orbital, `Orbital.TraitName EVENT` for cross-orbital) can
249
+ * filter by emitter identity. */
250
+ orbitalName?: string;
238
251
  /** Current state */
239
252
  state: string;
240
253
  /** Transition description */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/runtime",
3
- "version": "3.3.0",
3
+ "version": "4.0.1",
4
4
  "description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@almadar/evaluator": ">=2.8.1",
40
40
  "@almadar/std": ">=6.5.0",
41
- "@almadar/core": ">=4.8.2",
41
+ "@almadar/core": ">=5.0.0",
42
42
  "@faker-js/faker": "^9.3.0"
43
43
  },
44
44
  "peerDependencies": {