@almadar/runtime 5.8.6 → 5.9.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.
@@ -1,4 +1,4 @@
1
- export { InMemoryPersistence, OrbitalServerRuntime, collectDeclaredConfigDefaults, createOrbitalServerRuntime } from './chunk-GYPBWCOD.js';
1
+ export { InMemoryPersistence, OrbitalServerRuntime, collectDeclaredConfigDefaults, createOrbitalServerRuntime } from './chunk-Y26AXU7I.js';
2
2
  import './chunk-PZ5AY32C.js';
3
3
  //# sourceMappingURL=OrbitalServerRuntime.js.map
4
4
  //# sourceMappingURL=OrbitalServerRuntime.js.map
@@ -4004,6 +4004,29 @@ var OrbitalServerRuntime = class {
4004
4004
  }
4005
4005
  }
4006
4006
  }
4007
+ const auxiliaryEntities = orbital.auxiliaryEntities;
4008
+ if (auxiliaryEntities !== void 0 && auxiliaryEntities.length > 0 && this.config.mode === "mock" && this.persistence instanceof MockPersistenceAdapter) {
4009
+ for (const auxRef of auxiliaryEntities) {
4010
+ if (typeof auxRef === "string" || isEntityCall(auxRef)) continue;
4011
+ const auxEntity = auxRef;
4012
+ if (!auxEntity.name || !auxEntity.fields) continue;
4013
+ const auxFields = auxEntity.fields.filter(
4014
+ (f) => typeof f.name === "string" && f.name.length > 0
4015
+ ).map((f) => ({
4016
+ name: f.name,
4017
+ type: f.type,
4018
+ required: f.required,
4019
+ values: f.values,
4020
+ default: f.default
4021
+ }));
4022
+ this.persistence.registerEntity({ name: auxEntity.name, fields: auxFields });
4023
+ if (this.config.debug) {
4024
+ console.log(
4025
+ `[OrbitalRuntime] Seeded mock data for auxiliary entity: ${auxEntity.name}, count: ${this.persistence.count(auxEntity.name)}`
4026
+ );
4027
+ }
4028
+ }
4029
+ }
4007
4030
  if (this.config.debug) {
4008
4031
  console.log(
4009
4032
  `[OrbitalRuntime] Registered orbital: ${orbital.name} with ${(orbital.traits || []).length} trait(s)`
@@ -4651,6 +4674,24 @@ var OrbitalServerRuntime = class {
4651
4674
  }
4652
4675
  } else {
4653
4676
  let entities = await this.persistence.list(fetchEntityType);
4677
+ if (options?.filter !== void 0 && options.filter !== null) {
4678
+ const predicate = options.filter;
4679
+ entities = entities.filter((entity) => {
4680
+ const ctx = createContextFromBindings(
4681
+ { entity, payload: bindingsRef?.payload, current: entity },
4682
+ false
4683
+ );
4684
+ try {
4685
+ return Boolean(evaluate(predicate, ctx));
4686
+ } catch (err) {
4687
+ console.error(
4688
+ `[OrbitalServerRuntime] fetch filter eval error for ${fetchEntityType}:`,
4689
+ err
4690
+ );
4691
+ return false;
4692
+ }
4693
+ });
4694
+ }
4654
4695
  if (options?.offset && options.offset > 0) {
4655
4696
  entities = entities.slice(options.offset);
4656
4697
  }
@@ -5283,5 +5324,5 @@ function buildMatcher(src, listenerOrbital) {
5283
5324
  }
5284
5325
 
5285
5326
  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 };
5286
- //# sourceMappingURL=chunk-GYPBWCOD.js.map
5287
- //# sourceMappingURL=chunk-GYPBWCOD.js.map
5327
+ //# sourceMappingURL=chunk-Y26AXU7I.js.map
5328
+ //# sourceMappingURL=chunk-Y26AXU7I.js.map