@almadar/runtime 6.16.0 → 6.17.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-CcJfn8Hy.d.ts → OrbitalServerRuntime-CJWejtSD.d.ts} +15 -5
- package/dist/OrbitalServerRuntime.d.ts +1 -1
- package/dist/OrbitalServerRuntime.js +9 -4
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/{chunk-GNVHMOHZ.js → chunk-G2VW5WJZ.js} +15 -3
- package/dist/chunk-G2VW5WJZ.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-GNVHMOHZ.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { I as IEventBus, g as RuntimeEvent, f as EventListener, U as Unsubscribe, T as TraitDefinition, R as RuntimeConfig, i as TransitionObserver, C as ConfigContext, h as TraitState, j as TransitionResult, E as EvaluationContextExtensions, a as EffectHandlers } from './types-BA7GoDni.js';
|
|
3
|
-
import { EventPayload, EntityRow, DeclaredTraitConfig, TraitConfig, OrbitalSchema, Orbital, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, OrbitalDefinition,
|
|
3
|
+
import { EventPayload, EntityRow, DeclaredTraitConfig, TraitConfig, Entity, OrbitalSchema, Orbital, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, OrbitalDefinition, TraitTick } from '@almadar/core';
|
|
4
4
|
import { P as PersistenceAdapter } from './PersistenceAdapter-B6dQCbbU.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -325,6 +325,16 @@ declare class StateMachineManager {
|
|
|
325
325
|
declare function collectDeclaredConfigDefaults(trait: {
|
|
326
326
|
config?: DeclaredTraitConfig;
|
|
327
327
|
} | undefined): TraitConfig | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Walk an entity's `fields` array and return a flat `{ fieldName: default, … }`
|
|
330
|
+
* map. Seeds the `@entity` binding context with declared field defaults before
|
|
331
|
+
* any explicit `(set @entity.X Y)` effect or fetched persistence data is merged
|
|
332
|
+
* on top. Mirrors `collectDeclaredConfigDefaults` for the entity axis.
|
|
333
|
+
*
|
|
334
|
+
* Precedence (outermost wins): `traitFieldState` (set effects) > `entityData`
|
|
335
|
+
* (persistence row) > returned defaults (declared schema defaults).
|
|
336
|
+
*/
|
|
337
|
+
declare function collectDeclaredEntityDefaults(entity: Entity | undefined): EntityRow | undefined;
|
|
328
338
|
|
|
329
339
|
/**
|
|
330
340
|
* External Orbital Loader
|
|
@@ -782,9 +792,9 @@ interface RegisteredOrbital {
|
|
|
782
792
|
entityData: Map<string, EntityRow>;
|
|
783
793
|
/**
|
|
784
794
|
* Per-trait scalar state set by `(set @entity.X Y)`. Mirrors compiled's
|
|
785
|
-
* `state.fields`. The trait's `@entity` binding
|
|
786
|
-
*
|
|
787
|
-
*
|
|
795
|
+
* `state.fields`. The trait's `@entity` binding is a three-layer merge:
|
|
796
|
+
* declared entity field defaults < persistence entityData < this map.
|
|
797
|
+
* Mutated only by the `set` effect handler.
|
|
788
798
|
*/
|
|
789
799
|
traitFieldStates: Map<string, EntityRow>;
|
|
790
800
|
}
|
|
@@ -1191,4 +1201,4 @@ declare class OrbitalServerRuntime {
|
|
|
1191
1201
|
*/
|
|
1192
1202
|
declare function createOrbitalServerRuntime(config?: OrbitalServerRuntimeConfig): OrbitalServerRuntime;
|
|
1193
1203
|
|
|
1194
|
-
export {
|
|
1204
|
+
export { preprocessSchema as A, processEvent as B, type ClientEffectTuple as C, type ClientNavigateTuple as D, type EntitySharingMap as E, type ClientNotifyTuple as F, type ClientRenderUITuple as G, type EffectResult as H, type ImportChainLike as I, type LoaderConfig as J, OrbitalServerRuntime as K, type LoadResult as L, type RuntimeTraitTick as M, createOrbitalServerRuntime as N, type OrbitalEventRequest as O, type PreprocessOptions as P, type RegisteredOrbital as R, type SchemaLoader as S, type UnifiedLoaderOptions as U, type LoadedSchema as a, type LoadedOrbital as b, EventBus as c, type EventNamespaceMap as d, type OrbitalEventResponse as e, type OrbitalServerRuntimeConfig as f, type PreprocessResult as g, type PreprocessedSchema as h, type ProcessEventOptions as i, type RuntimeOrbital as j, type RuntimeOrbitalSchema as k, type RuntimeTrait as l, StateMachineManager as m, collectDeclaredConfigDefaults as n, collectDeclaredEntityDefaults as o, createInitialTraitState as p, findInitialState as q, findTransition as r, getIsolatedCollectionName as s, getNamespacedEvent as t, isBrowser as u, isElectron as v, isNamespacedEvent as w, isNode as x, normalizeEventKey as y, parseNamespacedEvent as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
export { C as ClientEffectTuple,
|
|
2
|
+
export { C as ClientEffectTuple, D as ClientNavigateTuple, F as ClientNotifyTuple, G as ClientRenderUITuple, H as EffectResult, J as LoaderConfig, O as OrbitalEventRequest, e as OrbitalEventResponse, K as OrbitalServerRuntime, f as OrbitalServerRuntimeConfig, R as RegisteredOrbital, j as RuntimeOrbital, k as RuntimeOrbitalSchema, l as RuntimeTrait, M as RuntimeTraitTick, n as collectDeclaredConfigDefaults, N as createOrbitalServerRuntime } from './OrbitalServerRuntime-CJWejtSD.js';
|
|
3
3
|
import './types-BA7GoDni.js';
|
|
4
4
|
import '@almadar/core';
|
|
5
5
|
export { I as InMemoryPersistence, P as PersistenceAdapter } from './PersistenceAdapter-B6dQCbbU.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, EffectExecutor } from './chunk-
|
|
2
|
-
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-
|
|
1
|
+
import { EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-G2VW5WJZ.js';
|
|
2
|
+
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-G2VW5WJZ.js';
|
|
3
3
|
import './chunk-PZ5AY32C.js';
|
|
4
4
|
import { createLogger } from '@almadar/logger';
|
|
5
5
|
import * as nodeModule from 'module';
|
|
@@ -1431,9 +1431,14 @@ var OrbitalServerRuntime = class {
|
|
|
1431
1431
|
if (declaredDefaults || callSiteOverride) {
|
|
1432
1432
|
bindings.config = { ...declaredDefaults ?? {}, ...callSiteOverride ?? {} };
|
|
1433
1433
|
}
|
|
1434
|
+
const entityFieldDefaults = collectDeclaredEntityDefaults(registered.entity);
|
|
1434
1435
|
const traitFieldState = registered.traitFieldStates.get(traitName);
|
|
1435
|
-
if (traitFieldState) {
|
|
1436
|
-
bindings.entity =
|
|
1436
|
+
if (entityFieldDefaults || traitFieldState) {
|
|
1437
|
+
bindings.entity = {
|
|
1438
|
+
...entityFieldDefaults ?? {},
|
|
1439
|
+
...bindings.entity ?? {},
|
|
1440
|
+
...traitFieldState ?? {}
|
|
1441
|
+
};
|
|
1437
1442
|
}
|
|
1438
1443
|
if (entityType) {
|
|
1439
1444
|
bindings[entityType] = bindings.entity ?? entityData;
|