@almadar/runtime 5.0.0 → 5.1.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.js +24 -2
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/{chunk-S5OLFFHT.js → chunk-T343XTYB.js} +36 -5
- package/dist/chunk-T343XTYB.js.map +1 -0
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-S5OLFFHT.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-
|
|
2
|
-
export { InMemoryPersistence } from './chunk-
|
|
1
|
+
import { createLogger, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-T343XTYB.js';
|
|
2
|
+
export { InMemoryPersistence } from './chunk-T343XTYB.js';
|
|
3
3
|
import './chunk-PZ5AY32C.js';
|
|
4
4
|
import { Router } from 'express';
|
|
5
5
|
import * as fs from 'fs';
|
|
@@ -359,6 +359,7 @@ function createOsHandlers(ctx) {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
// src/OrbitalServerRuntime.ts
|
|
362
|
+
var effectLog = createLogger("almadar:runtime:effects");
|
|
362
363
|
function collectDeclaredConfigDefaults(trait) {
|
|
363
364
|
if (!trait) return void 0;
|
|
364
365
|
const schema = trait.config;
|
|
@@ -1191,6 +1192,12 @@ var OrbitalServerRuntime = class {
|
|
|
1191
1192
|
};
|
|
1192
1193
|
this.eventBus.emit(event, eventPayload, stamp);
|
|
1193
1194
|
emittedEvents.push({ event, payload: eventPayload });
|
|
1195
|
+
effectLog.debug("emit:push", {
|
|
1196
|
+
event,
|
|
1197
|
+
cumulativeEmittedCount: emittedEvents.length,
|
|
1198
|
+
sourceTrait: stamp.trait,
|
|
1199
|
+
sourceOrbital: stamp.orbital
|
|
1200
|
+
});
|
|
1194
1201
|
},
|
|
1195
1202
|
set: async (targetId, field, value) => {
|
|
1196
1203
|
const id = targetId || entityId;
|
|
@@ -1289,6 +1296,7 @@ var OrbitalServerRuntime = class {
|
|
|
1289
1296
|
}
|
|
1290
1297
|
const type = targetEntityType || entityType;
|
|
1291
1298
|
let resultData;
|
|
1299
|
+
const sizeBefore = (await this.persistence.list(type)).length;
|
|
1292
1300
|
try {
|
|
1293
1301
|
if (action === "create" || action === "update") {
|
|
1294
1302
|
this.validateRelationCardinality(type, data || {});
|
|
@@ -1319,6 +1327,15 @@ var OrbitalServerRuntime = class {
|
|
|
1319
1327
|
break;
|
|
1320
1328
|
}
|
|
1321
1329
|
}
|
|
1330
|
+
const sizeAfter = (await this.persistence.list(type)).length;
|
|
1331
|
+
effectLog.debug("persist:store-mutate", {
|
|
1332
|
+
action,
|
|
1333
|
+
entityType: type,
|
|
1334
|
+
resultId: resultData?.id,
|
|
1335
|
+
sizeBefore,
|
|
1336
|
+
sizeAfter,
|
|
1337
|
+
delta: sizeAfter - sizeBefore
|
|
1338
|
+
});
|
|
1322
1339
|
effectResults.push({
|
|
1323
1340
|
effect: "persist",
|
|
1324
1341
|
action,
|
|
@@ -1327,6 +1344,11 @@ var OrbitalServerRuntime = class {
|
|
|
1327
1344
|
success: true
|
|
1328
1345
|
});
|
|
1329
1346
|
} catch (err) {
|
|
1347
|
+
effectLog.error("persist:store-mutate-error", {
|
|
1348
|
+
action,
|
|
1349
|
+
entityType: type,
|
|
1350
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1351
|
+
});
|
|
1330
1352
|
effectResults.push({
|
|
1331
1353
|
effect: "persist",
|
|
1332
1354
|
action,
|