@almadar/runtime 3.2.6 → 4.0.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-DMRvEfcT.d.ts → OrbitalServerRuntime-CXfyKGAS.d.ts} +7 -5
- package/dist/OrbitalServerRuntime.d.ts +1 -1
- package/dist/OrbitalServerRuntime.js +1 -30
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/{chunk-XPHQYI5G.js → chunk-WIWVHE3P.js} +3 -8
- package/dist/chunk-WIWVHE3P.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-XPHQYI5G.js.map +0 -1
|
@@ -748,14 +748,16 @@ interface OrbitalEventResponse {
|
|
|
748
748
|
success: boolean;
|
|
749
749
|
transitioned: boolean;
|
|
750
750
|
states: Record<string, string>;
|
|
751
|
+
/**
|
|
752
|
+
* Events emitted during processing, in declaration order. Payloads are
|
|
753
|
+
* typed against `@almadar/core`'s `EventPayload` — the recursive record of
|
|
754
|
+
* primitive + nested EventPayload values the state machine already uses
|
|
755
|
+
* internally. Kept as the single source of truth for emit-payload shape.
|
|
756
|
+
*/
|
|
751
757
|
emittedEvents: Array<{
|
|
752
758
|
event: string;
|
|
753
|
-
payload?:
|
|
759
|
+
payload?: EventPayload;
|
|
754
760
|
}>;
|
|
755
|
-
/** Entity data fetched by `fetch` effects - keyed by entity type */
|
|
756
|
-
data?: {
|
|
757
|
-
[entityType: string]: EntityRow | EntityRow[];
|
|
758
|
-
};
|
|
759
761
|
/** Client-side effects to execute (render-ui, navigate, notify) */
|
|
760
762
|
clientEffects?: Array<unknown>;
|
|
761
763
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
export { B as EffectResult, C as LoaderConfig, D as LocalPersistenceAdapter, O as OrbitalEventRequest, e as OrbitalEventResponse, F as OrbitalServerRuntime, f as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, k as RuntimeOrbital, l as RuntimeOrbitalSchema, m as RuntimeTrait, G as RuntimeTraitTick, H as createOrbitalServerRuntime } from './OrbitalServerRuntime-
|
|
2
|
+
export { B as EffectResult, C as LoaderConfig, D as LocalPersistenceAdapter, O as OrbitalEventRequest, e as OrbitalEventResponse, F as OrbitalServerRuntime, f as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, k as RuntimeOrbital, l as RuntimeOrbitalSchema, m as RuntimeTrait, G as RuntimeTraitTick, H as createOrbitalServerRuntime } from './OrbitalServerRuntime-CXfyKGAS.js';
|
|
3
3
|
import './types-B8OfRFfV.js';
|
|
4
4
|
import '@almadar/core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventBus, createUnifiedLoader, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-
|
|
1
|
+
import { EventBus, createUnifiedLoader, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-WIWVHE3P.js';
|
|
2
2
|
import './chunk-PZ5AY32C.js';
|
|
3
3
|
import { Router } from 'express';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -1223,32 +1223,6 @@ var OrbitalServerRuntime = class {
|
|
|
1223
1223
|
);
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
const persistedTypes = /* @__PURE__ */ new Set();
|
|
1227
|
-
for (const er of effectResults) {
|
|
1228
|
-
if ((er.effect === "persist" || er.effect === "set" || er.effect === "swap") && er.success && er.entityType) {
|
|
1229
|
-
persistedTypes.add(er.entityType);
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
const refTypes = /* @__PURE__ */ new Set();
|
|
1233
|
-
for (const trait of registered.traits) {
|
|
1234
|
-
const transitions = trait.stateMachine?.transitions ?? [];
|
|
1235
|
-
for (const trans of transitions) {
|
|
1236
|
-
for (const eff of trans.effects ?? []) {
|
|
1237
|
-
if (Array.isArray(eff) && eff[0] === "ref" && typeof eff[1] === "string") {
|
|
1238
|
-
refTypes.add(eff[1]);
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
for (const mutatedEntityType of persistedTypes) {
|
|
1244
|
-
if (refTypes.has(mutatedEntityType)) {
|
|
1245
|
-
try {
|
|
1246
|
-
const fresh = await this.persistence.list(mutatedEntityType);
|
|
1247
|
-
fetchedData[mutatedEntityType] = fresh;
|
|
1248
|
-
} catch {
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
1226
|
const states = {};
|
|
1253
1227
|
for (const [name, state] of registered.manager.getAllStates()) {
|
|
1254
1228
|
states[name] = state.currentState;
|
|
@@ -1259,9 +1233,6 @@ var OrbitalServerRuntime = class {
|
|
|
1259
1233
|
states,
|
|
1260
1234
|
emittedEvents
|
|
1261
1235
|
};
|
|
1262
|
-
if (Object.keys(fetchedData).length > 0) {
|
|
1263
|
-
response.data = fetchedData;
|
|
1264
|
-
}
|
|
1265
1236
|
if (clientEffects.length > 0) {
|
|
1266
1237
|
response.clientEffects = clientEffects;
|
|
1267
1238
|
}
|