@almadar/runtime 5.9.0 → 5.9.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-Y26AXU7I.js';
1
+ export { InMemoryPersistence, OrbitalServerRuntime, collectDeclaredConfigDefaults, createOrbitalServerRuntime } from './chunk-LZYY2JJR.js';
2
2
  import './chunk-PZ5AY32C.js';
3
3
  //# sourceMappingURL=OrbitalServerRuntime.js.map
4
4
  //# sourceMappingURL=OrbitalServerRuntime.js.map
@@ -3400,7 +3400,15 @@ async function preprocessSchema(schema, options) {
3400
3400
  // Preserve other fields
3401
3401
  exposes: resolvedOrbital.original.exposes,
3402
3402
  domainContext: resolvedOrbital.original.domainContext,
3403
- design: resolvedOrbital.original.design
3403
+ design: resolvedOrbital.original.design,
3404
+ // Gap #22: pass through auxiliary entities so OrbitalServerRuntime's
3405
+ // mock-seed branch registers SearchResult / FilterTarget / PagedItem
3406
+ // alongside the molecule's primary entity. Without this, an inlined
3407
+ // .orb that has `auxiliaryEntities` populated by the Rust inline
3408
+ // phase still loses them here, and `(set @entity.searchTerm ...)` /
3409
+ // `(fetch SearchResult ...)` from no-rebind imports hit unregistered
3410
+ // persistence and silently no-op.
3411
+ auxiliaryEntities: resolvedOrbital.original.auxiliaryEntities
3404
3412
  };
3405
3413
  preprocessedOrbitals.push(preprocessedOrbital);
3406
3414
  }
@@ -4903,15 +4911,27 @@ var OrbitalServerRuntime = class {
4903
4911
  user
4904
4912
  // @user bindings from Firebase auth
4905
4913
  };
4906
- const declaredDefaults = collectDeclaredConfigDefaults(
4907
- registered.traits.find((t) => t.name === traitName)
4908
- );
4914
+ const traitDef = registered.traits.find((t) => t.name === traitName);
4915
+ const declaredDefaults = collectDeclaredConfigDefaults(traitDef);
4909
4916
  const callSiteOverride = registered.configByTrait.get(traitName);
4910
4917
  if (declaredDefaults || callSiteOverride) {
4911
4918
  bindings.config = { ...declaredDefaults ?? {}, ...callSiteOverride ?? {} };
4912
4919
  }
4920
+ if (traitDef?.scope === "collection" && entityType && !entityId) {
4921
+ try {
4922
+ const all = await this.persistence.list(entityType);
4923
+ if (Array.isArray(all) && all.length > 0) {
4924
+ const merged = Object.assign(
4925
+ [...all],
4926
+ all[0]
4927
+ );
4928
+ bindings.entity = merged;
4929
+ }
4930
+ } catch {
4931
+ }
4932
+ }
4913
4933
  if (entityType) {
4914
- bindings[entityType] = entityData;
4934
+ bindings[entityType] = bindings.entity ?? entityData;
4915
4935
  }
4916
4936
  bindingsRef = bindings;
4917
4937
  const context = {
@@ -5324,5 +5344,5 @@ function buildMatcher(src, listenerOrbital) {
5324
5344
  }
5325
5345
 
5326
5346
  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 };
5327
- //# sourceMappingURL=chunk-Y26AXU7I.js.map
5328
- //# sourceMappingURL=chunk-Y26AXU7I.js.map
5347
+ //# sourceMappingURL=chunk-LZYY2JJR.js.map
5348
+ //# sourceMappingURL=chunk-LZYY2JJR.js.map