@almadar/runtime 6.34.0 → 6.35.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-BrHSXDfp.d.ts → OrbitalServerRuntime-BY-qzEQ_.d.ts} +8 -1
- package/dist/OrbitalServerRuntime.d.ts +1 -1
- package/dist/OrbitalServerRuntime.js +8 -4
- package/dist/{chunk-TRA44DDY.js → chunk-VCEF5JOX.js} +8 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +4 -4
|
@@ -308,7 +308,7 @@ declare class StateMachineManager {
|
|
|
308
308
|
*
|
|
309
309
|
* @returns Array of transition results (one per trait that had a matching transition)
|
|
310
310
|
*/
|
|
311
|
-
sendEvent(eventKey: string, payload?: EventPayload, entityData?: EntityRow, entityByTrait?: Record<string, EntityRow>, eventId?: EventId): Array<{
|
|
311
|
+
sendEvent(eventKey: string, payload?: EventPayload, entityData?: EntityRow, entityByTrait?: Record<string, EntityRow>, eventId?: EventId, targetTrait?: string): Array<{
|
|
312
312
|
traitName: string;
|
|
313
313
|
result: TransitionResult;
|
|
314
314
|
}>;
|
|
@@ -945,6 +945,13 @@ interface OrbitalEventRequest {
|
|
|
945
945
|
eventId?: EventId;
|
|
946
946
|
payload?: EventPayload;
|
|
947
947
|
entityId?: string;
|
|
948
|
+
/**
|
|
949
|
+
* Scoped-listen delivery: dispatch to THIS trait only. A listens-matched
|
|
950
|
+
* trigger is addressed to the listening trait; without this, a trigger
|
|
951
|
+
* renamed to INIT broadcast orbital-wide and re-ran every trait's
|
|
952
|
+
* initializer (R-SCOPED-LISTEN-INIT-RENAME-FREEZE re-fire cascade).
|
|
953
|
+
*/
|
|
954
|
+
targetTrait?: string;
|
|
948
955
|
/** User context for @user bindings (from Firebase auth) */
|
|
949
956
|
user?: {
|
|
950
957
|
uid: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
export { F as ClientEffectTuple, G as ClientNavigateTuple, H as ClientNotifyTuple, J as ClientRenderUITuple, K as EffectResult, e as InMemoryPersistence, M as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, N as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, Q as RuntimeTraitTick, p as collectDeclaredConfigDefaults, T as createOrbitalServerRuntime } from './OrbitalServerRuntime-
|
|
2
|
+
export { F as ClientEffectTuple, G as ClientNavigateTuple, H as ClientNotifyTuple, J as ClientRenderUITuple, K as EffectResult, e as InMemoryPersistence, M as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, N as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, Q as RuntimeTraitTick, p as collectDeclaredConfigDefaults, T as createOrbitalServerRuntime } from './OrbitalServerRuntime-BY-qzEQ_.js';
|
|
3
3
|
import './types-C8RsO0xa.js';
|
|
4
4
|
import '@almadar/core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, createContextFromBindings, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, resolveCallSitePayloadCaptures, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-
|
|
2
|
-
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-
|
|
1
|
+
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, createContextFromBindings, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, resolveCallSitePayloadCaptures, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-VCEF5JOX.js';
|
|
2
|
+
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-VCEF5JOX.js';
|
|
3
3
|
import { isValidCronExpression } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import './chunk-OQJIK6PZ.js';
|
|
5
5
|
import './chunk-SCRAHWOC.js';
|
|
@@ -636,7 +636,8 @@ var OrbitalServerRuntime = class {
|
|
|
636
636
|
event: listener.triggers,
|
|
637
637
|
eventId: listener.triggersId,
|
|
638
638
|
payload: mappedPayload,
|
|
639
|
-
entityId: forwardedEntityId
|
|
639
|
+
entityId: forwardedEntityId,
|
|
640
|
+
targetTrait: trait.name
|
|
640
641
|
});
|
|
641
642
|
});
|
|
642
643
|
this.listenerCleanups.push(cleanup);
|
|
@@ -900,6 +901,7 @@ var OrbitalServerRuntime = class {
|
|
|
900
901
|
)
|
|
901
902
|
}));
|
|
902
903
|
const { event, eventId, payload, entityId, user } = request;
|
|
904
|
+
const targetTrait = request.targetTrait ?? payload?.["_targetTrait"];
|
|
903
905
|
const validationFailures = [];
|
|
904
906
|
for (const trait of registered.traits) {
|
|
905
907
|
const eventSchema = trait.stateMachine?.events?.find((e) => e.key === event);
|
|
@@ -927,6 +929,7 @@ var OrbitalServerRuntime = class {
|
|
|
927
929
|
const cleanPayload = payload ? { ...payload } : void 0;
|
|
928
930
|
if (cleanPayload) {
|
|
929
931
|
delete cleanPayload._activeTraits;
|
|
932
|
+
delete cleanPayload._targetTrait;
|
|
930
933
|
}
|
|
931
934
|
let entityData = {};
|
|
932
935
|
if (entityId) {
|
|
@@ -949,7 +952,8 @@ var OrbitalServerRuntime = class {
|
|
|
949
952
|
cleanPayload,
|
|
950
953
|
entityData,
|
|
951
954
|
entityByTrait,
|
|
952
|
-
eventId
|
|
955
|
+
eventId,
|
|
956
|
+
targetTrait
|
|
953
957
|
);
|
|
954
958
|
const filteredResults = activeTraits && activeTraits.length > 0 ? results.filter(({ traitName }) => activeTraits.includes(traitName)) : results;
|
|
955
959
|
if (this.config.debug && activeTraits) {
|
|
@@ -956,10 +956,11 @@ var StateMachineManager = class {
|
|
|
956
956
|
*
|
|
957
957
|
* @returns Array of transition results (one per trait that had a matching transition)
|
|
958
958
|
*/
|
|
959
|
-
sendEvent(eventKey, payload, entityData, entityByTrait, eventId) {
|
|
959
|
+
sendEvent(eventKey, payload, entityData, entityByTrait, eventId, targetTrait) {
|
|
960
960
|
const results = [];
|
|
961
961
|
const scope = scopeOf(entityData);
|
|
962
962
|
for (const [traitName, trait] of this.traits) {
|
|
963
|
+
if (targetTrait !== void 0 && traitName !== targetTrait) continue;
|
|
963
964
|
const traitState = this.getOrInitState(traitName, scope);
|
|
964
965
|
if (!traitState) continue;
|
|
965
966
|
const key = compositeKey(traitName, scope);
|
|
@@ -3862,10 +3863,13 @@ function resolveConfigRefsById(trait, idIndex) {
|
|
|
3862
3863
|
const entry = idIndex.get(field.refId);
|
|
3863
3864
|
if (!entry || entry.kind !== expectedKind) continue;
|
|
3864
3865
|
const currentName = entry.kind === "entity" ? entry.node.name : entry.kind === "event" ? entry.node.key : entry.node.name;
|
|
3865
|
-
if (!currentName
|
|
3866
|
+
if (!currentName) continue;
|
|
3867
|
+
const isTraitBinding = entry.kind === "trait" && typeof field.default === "string" && field.default.startsWith("@trait.");
|
|
3868
|
+
const nextDefault = isTraitBinding ? `@trait.${currentName}` : currentName;
|
|
3869
|
+
if (nextDefault === field.default) continue;
|
|
3866
3870
|
nextSchema ??= { ...schema };
|
|
3867
|
-
nextSchema[key] = { ...field, default:
|
|
3868
|
-
rewrites.push({ key, from: field.default, to:
|
|
3871
|
+
nextSchema[key] = { ...field, default: nextDefault };
|
|
3872
|
+
rewrites.push({ key, from: field.default, to: nextDefault });
|
|
3869
3873
|
}
|
|
3870
3874
|
if (!nextSchema) return trait;
|
|
3871
3875
|
refResolverLog.info("config-ref:id-resolve", {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, g as EffectContext, h as ExecutionEnvironment, i as EffectResult, T as TraitDefinition } from './types-C8RsO0xa.js';
|
|
2
2
|
export { j as BrowserFileMeta, k as BrowserFilePickerOptions, l as BrowserGeolocationOptions, m as BrowserGeolocationPosition, C as ConfigContext, n as Effect, a as EventListener, H as HANDLER_MANIFEST, I as IEventBus, b as RuntimeConfig, R as RuntimeEvent, d as TraitState, c as TransitionObserver, e as TransitionResult, U as Unsubscribe } from './types-C8RsO0xa.js';
|
|
3
|
-
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-
|
|
4
|
-
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-
|
|
3
|
+
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-BY-qzEQ_.js';
|
|
4
|
+
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-BY-qzEQ_.js';
|
|
5
5
|
import { EvaluationContext, SExpressionEvaluator } from '@almadar/evaluator';
|
|
6
6
|
export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
|
|
7
7
|
import { TraitConfigObject, EventPayload, PatternConfig, EntityId, EntityField, EntityRow, ServiceParams, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EffectExecutor, createContextFromBindings } from './chunk-
|
|
2
|
-
export { CALLSITE_PAYLOAD_PREFIX, EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, resolveCallSitePayloadCaptures, validateEventPayload, validatePayloadShapes } from './chunk-
|
|
1
|
+
import { EffectExecutor, createContextFromBindings } from './chunk-VCEF5JOX.js';
|
|
2
|
+
export { CALLSITE_PAYLOAD_PREFIX, EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, resolveCallSitePayloadCaptures, validateEventPayload, validatePayloadShapes } from './chunk-VCEF5JOX.js';
|
|
3
3
|
export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import './chunk-OQJIK6PZ.js';
|
|
5
5
|
export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from './chunk-O5VGKPTG.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/runtime",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.35.0",
|
|
4
4
|
"description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@almadar/core": "^10.
|
|
56
|
-
"@almadar/evaluator": "^2.
|
|
55
|
+
"@almadar/core": "^10.32.0",
|
|
56
|
+
"@almadar/evaluator": "^2.32.0",
|
|
57
57
|
"@almadar/logger": "^1.9.0",
|
|
58
58
|
"@almadar/server": "^2.25.0",
|
|
59
|
-
"@almadar/std": "^16.
|
|
59
|
+
"@almadar/std": "^16.142.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"express": "^5.0.0"
|