@almadar/runtime 5.11.0 → 5.11.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,4 +1,4 @@
1
- export { InMemoryPersistence, OrbitalServerRuntime, collectDeclaredConfigDefaults, createOrbitalServerRuntime } from './chunk-7CGDR3GM.js';
1
+ export { InMemoryPersistence, OrbitalServerRuntime, collectDeclaredConfigDefaults, createOrbitalServerRuntime } from './chunk-NPMVEFV6.js';
2
2
  import './chunk-PZ5AY32C.js';
3
3
  //# sourceMappingURL=OrbitalServerRuntime.js.map
4
4
  //# sourceMappingURL=OrbitalServerRuntime.js.map
@@ -4978,25 +4978,35 @@ var OrbitalServerRuntime = class {
4978
4978
  if (declaredDefaults || callSiteOverride) {
4979
4979
  bindings.config = { ...declaredDefaults ?? {}, ...callSiteOverride ?? {} };
4980
4980
  }
4981
- if (traitDef?.scope === "collection" && entityType && !entityId) {
4982
- const cached = registered.dataCache.get(entityType);
4981
+ const traitLinkedEntity = traitDef?.linkedEntity ?? entityType;
4982
+ if (traitDef?.scope === "collection" && traitLinkedEntity && !entityId) {
4983
+ const cached = registered.dataCache.get(traitLinkedEntity);
4983
4984
  if (cached !== void 0) {
4984
4985
  bindings.entity = cached;
4985
4986
  } else {
4986
4987
  try {
4987
- const all = await this.persistence.list(entityType);
4988
+ const all = await this.persistence.list(traitLinkedEntity);
4988
4989
  if (Array.isArray(all) && all.length > 0) {
4989
4990
  const merged = Object.assign(
4990
4991
  [...all],
4991
4992
  all[0]
4992
4993
  );
4993
4994
  bindings.entity = merged;
4994
- registered.dataCache.set(entityType, merged);
4995
+ registered.dataCache.set(traitLinkedEntity, merged);
4995
4996
  }
4996
4997
  } catch {
4997
4998
  }
4998
4999
  }
4999
5000
  }
5001
+ if (traitDef?.scope === "instance" && traitLinkedEntity && traitLinkedEntity !== entityType && !entityId) {
5002
+ try {
5003
+ const all = await this.persistence.list(traitLinkedEntity);
5004
+ if (Array.isArray(all) && all.length > 0 && all[0]) {
5005
+ bindings.entity = all[0];
5006
+ }
5007
+ } catch {
5008
+ }
5009
+ }
5000
5010
  if (entityType) {
5001
5011
  bindings[entityType] = bindings.entity ?? entityData;
5002
5012
  }
@@ -5411,5 +5421,5 @@ function buildMatcher(src, listenerOrbital) {
5411
5421
  }
5412
5422
 
5413
5423
  export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, OrbitalServerRuntime, StateMachineManager, buildEmitsFromTraits, collectDeclaredConfigDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createLogger, createMockPersistence, createOrbitalServerRuntime, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes };
5414
- //# sourceMappingURL=chunk-7CGDR3GM.js.map
5415
- //# sourceMappingURL=chunk-7CGDR3GM.js.map
5424
+ //# sourceMappingURL=chunk-NPMVEFV6.js.map
5425
+ //# sourceMappingURL=chunk-NPMVEFV6.js.map