@almadar/runtime 6.31.0 → 6.33.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-DpAwIrmv.d.ts → OrbitalServerRuntime-Cep380it.d.ts} +13 -14
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +181 -137
- package/dist/ServerBridge.d.ts +1 -1
- package/dist/{chunk-YFH577FH.js → chunk-JZDLN2FS.js} +415 -50
- package/dist/chunk-O5VGKPTG.js +435 -0
- package/dist/chunk-OQJIK6PZ.js +163 -0
- package/dist/chunk-SCRAHWOC.js +82 -0
- package/dist/createOsHandlers.d.ts +1 -1
- package/dist/index.d.ts +37 -18
- package/dist/index.js +53 -3
- package/dist/mockRandom.d.ts +54 -0
- package/dist/mockRandom.js +2 -0
- package/dist/{types-D-9feVsj.d.ts → types-ConZnrpe.d.ts} +41 -1
- package/dist/ui/index.d.ts +419 -0
- package/dist/ui/index.js +3 -0
- package/package.json +17 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { I as IEventBus,
|
|
3
|
-
import { EventPayload, EntityRow, Orbital, ServiceCallResult, TraitConfig, DeclaredTraitConfig, Entity,
|
|
2
|
+
import { I as IEventBus, R as RuntimeEvent, a as EventListener, U as Unsubscribe, T as TraitDefinition, b as RuntimeConfig, c as TransitionObserver, C as ConfigContext, d as TraitState, e as TransitionResult, f as EvaluationContextExtensions, E as EffectHandlers } from './types-ConZnrpe.js';
|
|
3
|
+
import { EventPayload, EntityRow, Orbital, ServiceCallResult, TraitConfig, DeclaredTraitConfig, Entity, OrbitalSchema, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, OrbitalDefinition, TraitTick } from '@almadar/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* EventBus - Platform-Agnostic Pub/Sub Implementation
|
|
@@ -358,17 +358,6 @@ interface SubstrateServices {
|
|
|
358
358
|
declare function collectDeclaredConfigDefaults(trait: {
|
|
359
359
|
config?: DeclaredTraitConfig;
|
|
360
360
|
} | undefined): TraitConfig | undefined;
|
|
361
|
-
/**
|
|
362
|
-
* Convert a call-site config map into plain runtime values.
|
|
363
|
-
*
|
|
364
|
-
* A `CallSiteConfig` may contain either plain wiring values
|
|
365
|
-
* (`TraitConfigValue`) or annotated `ConfigFieldDeclaration` objects
|
|
366
|
-
* (`{ type, default, label, ... }`). The runtime binding context expects
|
|
367
|
-
* only values, so this helper extracts `.default` from declarations and
|
|
368
|
-
* passes plain values through unchanged. Entries that are not recognized as
|
|
369
|
-
* declarations by `isCallSiteConfigDeclaration` are returned as-is.
|
|
370
|
-
*/
|
|
371
|
-
declare function normalizeCallSiteConfigToValues(config: CallSiteConfig | undefined): TraitConfig | undefined;
|
|
372
361
|
/**
|
|
373
362
|
* Walk an entity's `fields` array and return a flat `{ fieldName: default, … }`
|
|
374
363
|
* map. Seeds the `@entity` binding context with declared field defaults before
|
|
@@ -1063,6 +1052,16 @@ declare class OrbitalServerRuntime {
|
|
|
1063
1052
|
private substrateHandlers;
|
|
1064
1053
|
private substrateHandlersPromise;
|
|
1065
1054
|
private resolvedSchema;
|
|
1055
|
+
/**
|
|
1056
|
+
* Trait name -> resolved `TraitConfig`, computed once per `register()` via
|
|
1057
|
+
* `buildResolvedTraitConfigs` (`@almadar/core`). An embedded sub-trait's
|
|
1058
|
+
* OWN declared config schema (`registered.traits` / `collectDeclaredConfigDefaults`)
|
|
1059
|
+
* carries `@config.X` forwards verbatim — this map chains those through to
|
|
1060
|
+
* the trait that actually embeds it (see `embedded-trait-config.ts` for the
|
|
1061
|
+
* full rationale). Used as a fallback layer in `buildBindingContext` behind
|
|
1062
|
+
* `declaredDefaults` and ahead of `callSiteOverride`.
|
|
1063
|
+
*/
|
|
1064
|
+
private resolvedTraitConfigs;
|
|
1066
1065
|
constructor(config?: OrbitalServerRuntimeConfig);
|
|
1067
1066
|
/**
|
|
1068
1067
|
* Lazily wire the OS-level effect handlers (fs/net/child_process), merging
|
|
@@ -1311,4 +1310,4 @@ declare class OrbitalServerRuntime {
|
|
|
1311
1310
|
*/
|
|
1312
1311
|
declare function createOrbitalServerRuntime(config?: OrbitalServerRuntimeConfig): OrbitalServerRuntime;
|
|
1313
1312
|
|
|
1314
|
-
export {
|
|
1313
|
+
export { normalizeEventKey as A, parseNamespacedEvent as B, preprocessSchema as C, processEvent as D, type EntitySharingMap as E, type ClientEffectTuple as F, type ClientNavigateTuple as G, type ClientNotifyTuple as H, type ImportChainLike as I, type ClientRenderUITuple as J, type EffectResult as K, type LoadResult as L, type LoaderConfig as M, OrbitalServerRuntime as N, type OrbitalEventRequest as O, type PersistenceAdapter as P, type RuntimeTraitTick as Q, type RegisteredOrbital as R, type SchemaLoader as S, createOrbitalServerRuntime as T, type UnifiedLoaderOptions as U, type LoadedSchema as a, type LoadedOrbital as b, EventBus as c, type EventNamespaceMap as d, InMemoryPersistence as e, type OrbitalEventResponse as f, type OrbitalServerRuntimeConfig as g, type PreprocessOptions as h, type PreprocessResult as i, type PreprocessedSchema as j, type ProcessEventOptions as k, type RuntimeOrbital as l, type RuntimeOrbitalSchema as m, type RuntimeTrait as n, StateMachineManager as o, collectDeclaredConfigDefaults as p, collectDeclaredEntityDefaults as q, createInitialTraitState as r, findInitialState as s, findTransition as t, getIsolatedCollectionName as u, getNamespacedEvent as v, isBrowser as w, isElectron as x, isNamespacedEvent as y, isNode as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
export {
|
|
3
|
-
import './types-
|
|
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-Cep380it.js';
|
|
3
|
+
import './types-ConZnrpe.js';
|
|
4
4
|
import '@almadar/core';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, createContextFromBindings, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, 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-JZDLN2FS.js';
|
|
2
|
+
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-JZDLN2FS.js';
|
|
3
3
|
import { isValidCronExpression } from './chunk-OU3ITB5S.js';
|
|
4
|
+
import './chunk-OQJIK6PZ.js';
|
|
5
|
+
import './chunk-SCRAHWOC.js';
|
|
4
6
|
import './chunk-MLKGABMK.js';
|
|
5
7
|
import { createLogger } from '@almadar/logger';
|
|
6
8
|
import * as nodeModule from 'module';
|
|
7
9
|
import { evaluateGuard, evaluate } from '@almadar/evaluator';
|
|
8
|
-
import { isInlineTrait, isEntityCall } from '@almadar/core';
|
|
10
|
+
import { buildResolvedTraitConfigs, isInlineTrait, isEntityCall } from '@almadar/core';
|
|
9
11
|
|
|
10
12
|
var _resolvedNodeRequire = null;
|
|
11
13
|
function nodeRequire(modulePath) {
|
|
@@ -72,6 +74,16 @@ var OrbitalServerRuntime = class {
|
|
|
72
74
|
substrateHandlers = null;
|
|
73
75
|
substrateHandlersPromise = null;
|
|
74
76
|
resolvedSchema = null;
|
|
77
|
+
/**
|
|
78
|
+
* Trait name -> resolved `TraitConfig`, computed once per `register()` via
|
|
79
|
+
* `buildResolvedTraitConfigs` (`@almadar/core`). An embedded sub-trait's
|
|
80
|
+
* OWN declared config schema (`registered.traits` / `collectDeclaredConfigDefaults`)
|
|
81
|
+
* carries `@config.X` forwards verbatim — this map chains those through to
|
|
82
|
+
* the trait that actually embeds it (see `embedded-trait-config.ts` for the
|
|
83
|
+
* full rationale). Used as a fallback layer in `buildBindingContext` behind
|
|
84
|
+
* `declaredDefaults` and ahead of `callSiteOverride`.
|
|
85
|
+
*/
|
|
86
|
+
resolvedTraitConfigs = {};
|
|
75
87
|
constructor(config = {}) {
|
|
76
88
|
this.config = {
|
|
77
89
|
mode: "mock",
|
|
@@ -257,6 +269,7 @@ var OrbitalServerRuntime = class {
|
|
|
257
269
|
this.setupEventListeners();
|
|
258
270
|
this.setupTicks();
|
|
259
271
|
this.resolvedSchema = schema;
|
|
272
|
+
this.resolvedTraitConfigs = buildResolvedTraitConfigs(schema);
|
|
260
273
|
}
|
|
261
274
|
/**
|
|
262
275
|
* Register an OrbitalSchema synchronously (for backward compatibility).
|
|
@@ -273,6 +286,7 @@ var OrbitalServerRuntime = class {
|
|
|
273
286
|
this.setupEventListeners();
|
|
274
287
|
this.setupTicks();
|
|
275
288
|
this.resolvedSchema = schema;
|
|
289
|
+
this.resolvedTraitConfigs = buildResolvedTraitConfigs(schema);
|
|
276
290
|
}
|
|
277
291
|
/**
|
|
278
292
|
* Returns the schema that this runtime is currently executing, post-
|
|
@@ -814,146 +828,163 @@ var OrbitalServerRuntime = class {
|
|
|
814
828
|
* response as they arrive rather than buffering and flushing at the end.
|
|
815
829
|
*/
|
|
816
830
|
async processOrbitalEvent(orbitalName, request, onPush) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
traitName,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
831
|
+
try {
|
|
832
|
+
await this.ensureOsHandlers();
|
|
833
|
+
await this.ensureAgentSubstrateHandlers();
|
|
834
|
+
const registered = this.orbitals.get(orbitalName);
|
|
835
|
+
if (!registered) {
|
|
836
|
+
return {
|
|
837
|
+
success: false,
|
|
838
|
+
transitioned: false,
|
|
839
|
+
states: {},
|
|
840
|
+
emittedEvents: [],
|
|
841
|
+
error: `Orbital not found: ${orbitalName}`
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
const payloadRow = request.payload?.["row"];
|
|
845
|
+
const payloadRowAsPayload = payloadRow !== null && typeof payloadRow === "object" && !Array.isArray(payloadRow) ? payloadRow : void 0;
|
|
846
|
+
const payloadRowId = payloadRowAsPayload?.["id"];
|
|
847
|
+
renderLog.debug("processOrbitalEvent:enter", {
|
|
848
|
+
orbital: orbitalName,
|
|
849
|
+
event: request.event,
|
|
850
|
+
hasPayloadRow: payloadRowAsPayload !== void 0,
|
|
851
|
+
payloadRowId: typeof payloadRowId === "string" || typeof payloadRowId === "number" ? payloadRowId : void 0,
|
|
852
|
+
entityId: request.entityId
|
|
853
|
+
});
|
|
854
|
+
busLog.debug("bus:incoming", () => ({
|
|
855
|
+
orbital: orbitalName,
|
|
856
|
+
event: request.event,
|
|
857
|
+
payload: JSON.stringify(request.payload ?? null),
|
|
858
|
+
entityId: request.entityId,
|
|
859
|
+
traitStates: JSON.stringify(
|
|
860
|
+
Array.from(registered.manager.getAllStates().entries()).map(([traitName, state]) => ({
|
|
861
|
+
traitName,
|
|
862
|
+
currentState: state.currentState
|
|
863
|
+
}))
|
|
864
|
+
)
|
|
865
|
+
}));
|
|
866
|
+
xOrbitalLog.info("processOrbitalEvent:enter", () => ({
|
|
867
|
+
orbital: orbitalName,
|
|
868
|
+
event: request.event,
|
|
869
|
+
traitsInOrbital: registered.traits.map((t) => t.name).join(","),
|
|
870
|
+
payloadActiveTraits: JSON.stringify(
|
|
871
|
+
request.payload?.["_activeTraits"] ?? null
|
|
872
|
+
)
|
|
873
|
+
}));
|
|
874
|
+
const { event, payload, entityId, user } = request;
|
|
875
|
+
const validationFailures = [];
|
|
876
|
+
for (const trait of registered.traits) {
|
|
877
|
+
const eventSchema = trait.stateMachine?.events?.find((e) => e.key === event);
|
|
878
|
+
if (eventSchema?.payloadSchema && eventSchema.payloadSchema.length > 0) {
|
|
879
|
+
validationFailures.push(
|
|
880
|
+
...validateEventPayload(event, payload, eventSchema.payloadSchema)
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (validationFailures.length > 0) {
|
|
885
|
+
return {
|
|
886
|
+
success: false,
|
|
887
|
+
transitioned: false,
|
|
888
|
+
states: {},
|
|
889
|
+
emittedEvents: [],
|
|
890
|
+
error: formatPayloadValidationError(validationFailures)
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
const emittedEvents = [];
|
|
894
|
+
const fetchedData = {};
|
|
895
|
+
const clientEffects = [];
|
|
896
|
+
const clientEffectsByTrait = [];
|
|
897
|
+
const effectResults = [];
|
|
898
|
+
const activeTraits = payload?._activeTraits;
|
|
899
|
+
const cleanPayload = payload ? { ...payload } : void 0;
|
|
900
|
+
if (cleanPayload) {
|
|
901
|
+
delete cleanPayload._activeTraits;
|
|
902
|
+
}
|
|
903
|
+
let entityData = {};
|
|
904
|
+
if (entityId) {
|
|
905
|
+
const stored = await this.persistence.getById(
|
|
906
|
+
registered.entity.name,
|
|
907
|
+
entityId
|
|
866
908
|
);
|
|
909
|
+
if (stored) {
|
|
910
|
+
entityData = stored;
|
|
911
|
+
}
|
|
867
912
|
}
|
|
868
|
-
|
|
869
|
-
|
|
913
|
+
const entityByTrait = {};
|
|
914
|
+
for (const [name, fields] of registered.traitFieldStates) {
|
|
915
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
916
|
+
entityByTrait[name] = fields;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
const results = registered.manager.sendEvent(
|
|
920
|
+
event,
|
|
921
|
+
cleanPayload,
|
|
922
|
+
entityData,
|
|
923
|
+
entityByTrait
|
|
924
|
+
);
|
|
925
|
+
const filteredResults = activeTraits && activeTraits.length > 0 ? results.filter(({ traitName }) => activeTraits.includes(traitName)) : results;
|
|
926
|
+
if (this.config.debug && activeTraits) {
|
|
927
|
+
busLog.debug("dispatch:filter-traits", () => ({
|
|
928
|
+
total: results.length,
|
|
929
|
+
active: filteredResults.length,
|
|
930
|
+
activeTraits: activeTraits.join(",")
|
|
931
|
+
}));
|
|
932
|
+
}
|
|
933
|
+
for (const { traitName, result } of filteredResults) {
|
|
934
|
+
if (result.effects.length > 0) {
|
|
935
|
+
await this.executeEffects(
|
|
936
|
+
registered,
|
|
937
|
+
traitName,
|
|
938
|
+
result.effects,
|
|
939
|
+
cleanPayload,
|
|
940
|
+
entityData,
|
|
941
|
+
entityId,
|
|
942
|
+
emittedEvents,
|
|
943
|
+
fetchedData,
|
|
944
|
+
clientEffects,
|
|
945
|
+
effectResults,
|
|
946
|
+
user,
|
|
947
|
+
clientEffectsByTrait,
|
|
948
|
+
onPush
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
const states = {};
|
|
953
|
+
for (const [name, state] of registered.manager.getAllStates()) {
|
|
954
|
+
states[name] = state.currentState;
|
|
955
|
+
}
|
|
956
|
+
const response = {
|
|
957
|
+
success: true,
|
|
958
|
+
transitioned: results.length > 0,
|
|
959
|
+
states,
|
|
960
|
+
emittedEvents
|
|
961
|
+
};
|
|
962
|
+
if (clientEffects.length > 0) {
|
|
963
|
+
response.clientEffects = clientEffects;
|
|
964
|
+
}
|
|
965
|
+
if (clientEffectsByTrait.length > 0) {
|
|
966
|
+
response.clientEffectsByTrait = clientEffectsByTrait;
|
|
967
|
+
}
|
|
968
|
+
if (effectResults.length > 0) {
|
|
969
|
+
response.effectResults = effectResults;
|
|
970
|
+
}
|
|
971
|
+
return response;
|
|
972
|
+
} catch (error) {
|
|
973
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
974
|
+
xOrbitalLog.error("processOrbitalEvent:error", {
|
|
975
|
+
orbital: orbitalName,
|
|
976
|
+
event: request.event,
|
|
977
|
+
entityId: request.entityId,
|
|
978
|
+
error: message
|
|
979
|
+
});
|
|
870
980
|
return {
|
|
871
981
|
success: false,
|
|
872
982
|
transitioned: false,
|
|
873
983
|
states: {},
|
|
874
984
|
emittedEvents: [],
|
|
875
|
-
error:
|
|
985
|
+
error: message
|
|
876
986
|
};
|
|
877
987
|
}
|
|
878
|
-
const emittedEvents = [];
|
|
879
|
-
const fetchedData = {};
|
|
880
|
-
const clientEffects = [];
|
|
881
|
-
const clientEffectsByTrait = [];
|
|
882
|
-
const effectResults = [];
|
|
883
|
-
const activeTraits = payload?._activeTraits;
|
|
884
|
-
const cleanPayload = payload ? { ...payload } : void 0;
|
|
885
|
-
if (cleanPayload) {
|
|
886
|
-
delete cleanPayload._activeTraits;
|
|
887
|
-
}
|
|
888
|
-
let entityData = {};
|
|
889
|
-
if (entityId) {
|
|
890
|
-
const stored = await this.persistence.getById(
|
|
891
|
-
registered.entity.name,
|
|
892
|
-
entityId
|
|
893
|
-
);
|
|
894
|
-
if (stored) {
|
|
895
|
-
entityData = stored;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
const entityByTrait = {};
|
|
899
|
-
for (const [name, fields] of registered.traitFieldStates) {
|
|
900
|
-
if (fields && Object.keys(fields).length > 0) {
|
|
901
|
-
entityByTrait[name] = fields;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
const results = registered.manager.sendEvent(
|
|
905
|
-
event,
|
|
906
|
-
cleanPayload,
|
|
907
|
-
entityData,
|
|
908
|
-
entityByTrait
|
|
909
|
-
);
|
|
910
|
-
const filteredResults = activeTraits && activeTraits.length > 0 ? results.filter(({ traitName }) => activeTraits.includes(traitName)) : results;
|
|
911
|
-
if (this.config.debug && activeTraits) {
|
|
912
|
-
busLog.debug("dispatch:filter-traits", () => ({
|
|
913
|
-
total: results.length,
|
|
914
|
-
active: filteredResults.length,
|
|
915
|
-
activeTraits: activeTraits.join(",")
|
|
916
|
-
}));
|
|
917
|
-
}
|
|
918
|
-
for (const { traitName, result } of filteredResults) {
|
|
919
|
-
if (result.effects.length > 0) {
|
|
920
|
-
await this.executeEffects(
|
|
921
|
-
registered,
|
|
922
|
-
traitName,
|
|
923
|
-
result.effects,
|
|
924
|
-
cleanPayload,
|
|
925
|
-
entityData,
|
|
926
|
-
entityId,
|
|
927
|
-
emittedEvents,
|
|
928
|
-
fetchedData,
|
|
929
|
-
clientEffects,
|
|
930
|
-
effectResults,
|
|
931
|
-
user,
|
|
932
|
-
clientEffectsByTrait,
|
|
933
|
-
onPush
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
const states = {};
|
|
938
|
-
for (const [name, state] of registered.manager.getAllStates()) {
|
|
939
|
-
states[name] = state.currentState;
|
|
940
|
-
}
|
|
941
|
-
const response = {
|
|
942
|
-
success: true,
|
|
943
|
-
transitioned: results.length > 0,
|
|
944
|
-
states,
|
|
945
|
-
emittedEvents
|
|
946
|
-
};
|
|
947
|
-
if (clientEffects.length > 0) {
|
|
948
|
-
response.clientEffects = clientEffects;
|
|
949
|
-
}
|
|
950
|
-
if (clientEffectsByTrait.length > 0) {
|
|
951
|
-
response.clientEffectsByTrait = clientEffectsByTrait;
|
|
952
|
-
}
|
|
953
|
-
if (effectResults.length > 0) {
|
|
954
|
-
response.effectResults = effectResults;
|
|
955
|
-
}
|
|
956
|
-
return response;
|
|
957
988
|
}
|
|
958
989
|
/**
|
|
959
990
|
* Execute effects from a transition
|
|
@@ -1446,9 +1477,22 @@ var OrbitalServerRuntime = class {
|
|
|
1446
1477
|
};
|
|
1447
1478
|
const traitDef = registered.traits.find((t) => t.name === traitName);
|
|
1448
1479
|
const declaredDefaults = collectDeclaredConfigDefaults(traitDef);
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1451
|
-
|
|
1480
|
+
const resolvedDefaults = this.resolvedTraitConfigs[traitName];
|
|
1481
|
+
const callSiteOverrideRaw = registered.configByTrait.get(traitName);
|
|
1482
|
+
const callSiteOverride = callSiteOverrideRaw ? resolveCallSitePayloadCaptures(
|
|
1483
|
+
Object.fromEntries(
|
|
1484
|
+
Object.entries(callSiteOverrideRaw).filter(
|
|
1485
|
+
([, v]) => !(typeof v === "string" && v.startsWith("@config."))
|
|
1486
|
+
)
|
|
1487
|
+
),
|
|
1488
|
+
payload
|
|
1489
|
+
) : void 0;
|
|
1490
|
+
if (declaredDefaults || resolvedDefaults || callSiteOverride) {
|
|
1491
|
+
bindings.config = {
|
|
1492
|
+
...declaredDefaults ?? {},
|
|
1493
|
+
...resolvedDefaults ?? {},
|
|
1494
|
+
...callSiteOverride ?? {}
|
|
1495
|
+
};
|
|
1452
1496
|
}
|
|
1453
1497
|
const entityFieldDefaults = collectDeclaredEntityDefaults(registered.entity);
|
|
1454
1498
|
const traitFieldState = registered.traitFieldStates.get(traitName);
|
package/dist/ServerBridge.d.ts
CHANGED