@almadar/runtime 6.4.1 → 6.5.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-BtG18R0H.d.ts → OrbitalServerRuntime-DhrQA78C.d.ts} +1 -1
- package/dist/OrbitalServerRuntime.d.ts +1 -1
- package/dist/OrbitalServerRuntime.js +1 -1
- package/dist/ServerBridge.js +4 -4
- package/dist/ServerBridge.js.map +1 -1
- package/dist/{chunk-ODKFBOQG.js → chunk-VCDCBBYE.js} +161 -100
- package/dist/chunk-VCDCBBYE.js.map +1 -0
- package/dist/createOsHandlers.js +10 -7
- package/dist/createOsHandlers.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +22 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ODKFBOQG.js.map +0 -1
|
@@ -315,7 +315,7 @@ function createContextFromBindings(bindings, strictBindings, contextExtensions)
|
|
|
315
315
|
var smLog = createLogger("almadar:runtime:sm");
|
|
316
316
|
function findInitialState(trait) {
|
|
317
317
|
if (!trait.states || trait.states.length === 0) {
|
|
318
|
-
|
|
318
|
+
smLog.warn("trait-has-no-states", { trait: trait.name });
|
|
319
319
|
return "unknown";
|
|
320
320
|
}
|
|
321
321
|
const markedInitial = trait.states.find((s) => s.isInitial)?.name;
|
|
@@ -422,10 +422,12 @@ function processEvent(options) {
|
|
|
422
422
|
lastFailedGuardTransition = transition;
|
|
423
423
|
} catch (error) {
|
|
424
424
|
if (guardMode === "strict") {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
425
|
+
smLog.error("guard-error-blocks-transition", {
|
|
426
|
+
from: traitState.currentState,
|
|
427
|
+
to: transition.to,
|
|
428
|
+
event: normalizedEvent,
|
|
429
|
+
error: error instanceof Error ? error : String(error)
|
|
430
|
+
});
|
|
429
431
|
return {
|
|
430
432
|
executed: false,
|
|
431
433
|
newState: traitState.currentState,
|
|
@@ -439,7 +441,9 @@ function processEvent(options) {
|
|
|
439
441
|
guardResult: false
|
|
440
442
|
};
|
|
441
443
|
}
|
|
442
|
-
|
|
444
|
+
smLog.error("guard-evaluation-error", {
|
|
445
|
+
error: error instanceof Error ? error : String(error)
|
|
446
|
+
});
|
|
443
447
|
return {
|
|
444
448
|
executed: true,
|
|
445
449
|
newState: transition.to,
|
|
@@ -945,7 +949,7 @@ var EffectExecutor = class {
|
|
|
945
949
|
const parsed = parseEffect(effect);
|
|
946
950
|
if (!parsed) {
|
|
947
951
|
if (this.debug) {
|
|
948
|
-
|
|
952
|
+
effectLog.warn("invalid-effect-format", () => ({ effectJson: JSON.stringify(effect ?? null) }));
|
|
949
953
|
}
|
|
950
954
|
return;
|
|
951
955
|
}
|
|
@@ -980,14 +984,16 @@ var EffectExecutor = class {
|
|
|
980
984
|
}
|
|
981
985
|
effectLog.debug("execute", { operator, argCount: resolvedArgs.length, context: this.context.traitName });
|
|
982
986
|
if (this.debug) {
|
|
983
|
-
|
|
987
|
+
effectLog.debug("executing", () => ({ operator, argsJson: JSON.stringify(resolvedArgs) }));
|
|
984
988
|
}
|
|
985
989
|
try {
|
|
986
990
|
await this.dispatch(operator, resolvedArgs);
|
|
987
991
|
effectLog.debug("execute:result", { operator, success: true });
|
|
988
992
|
} catch (error) {
|
|
989
|
-
effectLog.
|
|
990
|
-
|
|
993
|
+
effectLog.error("execute:error", {
|
|
994
|
+
operator,
|
|
995
|
+
error: error instanceof Error ? error : String(error)
|
|
996
|
+
});
|
|
991
997
|
throw error;
|
|
992
998
|
}
|
|
993
999
|
}
|
|
@@ -1314,7 +1320,7 @@ var EffectExecutor = class {
|
|
|
1314
1320
|
this.handlers.watch(watchEntityType, watchOptions);
|
|
1315
1321
|
} else {
|
|
1316
1322
|
if (this.debug) {
|
|
1317
|
-
|
|
1323
|
+
effectLog.debug("watch:noop-server", { entityType: typeof args[0] === "string" ? args[0] : void 0 });
|
|
1318
1324
|
}
|
|
1319
1325
|
}
|
|
1320
1326
|
break;
|
|
@@ -1357,7 +1363,10 @@ var EffectExecutor = class {
|
|
|
1357
1363
|
const data = args[2];
|
|
1358
1364
|
this.handlers.log(message, level, data);
|
|
1359
1365
|
} else {
|
|
1360
|
-
|
|
1366
|
+
effectLog.debug("log:fallback", () => ({
|
|
1367
|
+
message: typeof args[0] === "string" ? args[0] : JSON.stringify(args[0] ?? null),
|
|
1368
|
+
extraJson: JSON.stringify(args.slice(1))
|
|
1369
|
+
}));
|
|
1361
1370
|
}
|
|
1362
1371
|
break;
|
|
1363
1372
|
}
|
|
@@ -1392,7 +1401,9 @@ var EffectExecutor = class {
|
|
|
1392
1401
|
const type = args[1] || "info";
|
|
1393
1402
|
this.handlers.notify(message, type);
|
|
1394
1403
|
} else {
|
|
1395
|
-
|
|
1404
|
+
const category = typeof args[1] === "string" ? args[1] : "info";
|
|
1405
|
+
const message = typeof args[0] === "string" ? args[0] : JSON.stringify(args[0] ?? null);
|
|
1406
|
+
effectLog.info("notify", { category, message });
|
|
1396
1407
|
}
|
|
1397
1408
|
break;
|
|
1398
1409
|
}
|
|
@@ -1552,16 +1563,14 @@ var EffectExecutor = class {
|
|
|
1552
1563
|
}
|
|
1553
1564
|
default: {
|
|
1554
1565
|
if (this.debug) {
|
|
1555
|
-
|
|
1566
|
+
effectLog.warn("unknown-operator", { operator });
|
|
1556
1567
|
}
|
|
1557
1568
|
}
|
|
1558
1569
|
}
|
|
1559
1570
|
}
|
|
1560
1571
|
logUnsupported(operator) {
|
|
1561
1572
|
if (this.debug) {
|
|
1562
|
-
|
|
1563
|
-
`[EffectExecutor] Effect "${operator}" not supported on this platform`
|
|
1564
|
-
);
|
|
1573
|
+
effectLog.warn("unsupported-on-platform", { operator });
|
|
1565
1574
|
}
|
|
1566
1575
|
}
|
|
1567
1576
|
};
|
|
@@ -1762,7 +1771,7 @@ var MockPersistenceAdapter = class {
|
|
|
1762
1771
|
seedFromInstances(entityName, instances) {
|
|
1763
1772
|
const store = this.getStore(entityName);
|
|
1764
1773
|
if (this.config.debug) {
|
|
1765
|
-
|
|
1774
|
+
mockLog.debug("seeding-from-instances", { count: instances.length, entity: entityName });
|
|
1766
1775
|
}
|
|
1767
1776
|
for (const instance of instances) {
|
|
1768
1777
|
const id = instance.id || this.nextId(entityName);
|
|
@@ -1782,7 +1791,7 @@ var MockPersistenceAdapter = class {
|
|
|
1782
1791
|
const store = this.getStore(entityName);
|
|
1783
1792
|
const normalized = entityName.toLowerCase();
|
|
1784
1793
|
if (this.config.debug) {
|
|
1785
|
-
|
|
1794
|
+
mockLog.debug("seeding", { count, entity: entityName });
|
|
1786
1795
|
}
|
|
1787
1796
|
const generated = [];
|
|
1788
1797
|
for (let i = 0; i < count; i++) {
|
|
@@ -3327,6 +3336,7 @@ var UnifiedLoader = class {
|
|
|
3327
3336
|
function createUnifiedLoader(options) {
|
|
3328
3337
|
return new UnifiedLoader(options);
|
|
3329
3338
|
}
|
|
3339
|
+
createLogger("almadar:runtime:studio-config");
|
|
3330
3340
|
|
|
3331
3341
|
// src/UsesIntegration.ts
|
|
3332
3342
|
async function preprocessSchema(schema, options) {
|
|
@@ -3539,6 +3549,9 @@ var effectLog2 = createLogger("almadar:runtime:effects");
|
|
|
3539
3549
|
var busLog = createLogger("almadar:runtime:bus");
|
|
3540
3550
|
var renderLog2 = createLogger("almadar:runtime:render-ui");
|
|
3541
3551
|
var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
|
|
3552
|
+
var persistLog = createLogger("almadar:runtime:persist");
|
|
3553
|
+
var registerLog = createLogger("almadar:runtime:register");
|
|
3554
|
+
var dynamicLog = createLogger("almadar:runtime:dynamic");
|
|
3542
3555
|
function isNodeEnv() {
|
|
3543
3556
|
return typeof process !== "undefined" && Boolean(process.versions?.node);
|
|
3544
3557
|
}
|
|
@@ -3615,7 +3628,7 @@ var OrbitalServerRuntime = class {
|
|
|
3615
3628
|
debug: config.debug
|
|
3616
3629
|
});
|
|
3617
3630
|
if (config.debug) {
|
|
3618
|
-
|
|
3631
|
+
persistLog.debug("mock:init", { adapter: "MockPersistenceAdapter" });
|
|
3619
3632
|
}
|
|
3620
3633
|
} else {
|
|
3621
3634
|
this.persistence = config.persistence || new InMemoryPersistence();
|
|
@@ -3677,15 +3690,11 @@ var OrbitalServerRuntime = class {
|
|
|
3677
3690
|
scopedPaths: this.config.loaderConfig?.scopedPaths
|
|
3678
3691
|
});
|
|
3679
3692
|
if (this.config.debug) {
|
|
3680
|
-
|
|
3681
|
-
`[OrbitalRuntime] Default loader constructed: basePath=${basePath} stdLibPath=${stdLibPath}`
|
|
3682
|
-
);
|
|
3693
|
+
registerLog.debug("loader:constructed", { basePath, stdLibPath });
|
|
3683
3694
|
}
|
|
3684
3695
|
} catch (err) {
|
|
3685
3696
|
if (this.config.debug) {
|
|
3686
|
-
|
|
3687
|
-
`[OrbitalRuntime] Could not auto-construct loader: ${err instanceof Error ? err.message : String(err)}`
|
|
3688
|
-
);
|
|
3697
|
+
registerLog.warn("loader:construct-failed", { error: err instanceof Error ? err : String(err) });
|
|
3689
3698
|
}
|
|
3690
3699
|
}
|
|
3691
3700
|
}
|
|
@@ -3709,13 +3718,13 @@ var OrbitalServerRuntime = class {
|
|
|
3709
3718
|
*/
|
|
3710
3719
|
async register(schema) {
|
|
3711
3720
|
if (this.config.debug) {
|
|
3712
|
-
|
|
3721
|
+
registerLog.debug("register:schema", { name: schema.name });
|
|
3713
3722
|
}
|
|
3714
3723
|
if (needsPreprocessing(schema)) {
|
|
3715
3724
|
await this.ensureLoader();
|
|
3716
3725
|
if (this.loader) {
|
|
3717
3726
|
if (this.config.debug) {
|
|
3718
|
-
|
|
3727
|
+
registerLog.debug("register:auto-preprocessing", { name: schema.name });
|
|
3719
3728
|
}
|
|
3720
3729
|
const result = await preprocessSchema(schema, {
|
|
3721
3730
|
basePath: this.config.loaderConfig?.basePath || process.cwd(),
|
|
@@ -3739,9 +3748,7 @@ var OrbitalServerRuntime = class {
|
|
|
3739
3748
|
...result.data.eventNamespaces
|
|
3740
3749
|
};
|
|
3741
3750
|
} else if (this.config.debug) {
|
|
3742
|
-
|
|
3743
|
-
`[OrbitalRuntime] Schema has uses/refs but no loader available \u2014 proceeding without preprocessing. Cross-orbital trait refs will be empty.`
|
|
3744
|
-
);
|
|
3751
|
+
registerLog.warn("register:no-loader", { name: schema.name });
|
|
3745
3752
|
}
|
|
3746
3753
|
}
|
|
3747
3754
|
for (const orbital of schema.orbitals) {
|
|
@@ -3758,7 +3765,7 @@ var OrbitalServerRuntime = class {
|
|
|
3758
3765
|
*/
|
|
3759
3766
|
registerSync(schema) {
|
|
3760
3767
|
if (this.config.debug) {
|
|
3761
|
-
|
|
3768
|
+
registerLog.debug("register:schema-sync", { name: schema.name });
|
|
3762
3769
|
}
|
|
3763
3770
|
for (const orbital of schema.orbitals) {
|
|
3764
3771
|
this.registerOrbital(orbital);
|
|
@@ -3851,7 +3858,7 @@ var OrbitalServerRuntime = class {
|
|
|
3851
3858
|
const cached = this.preprocessedCache.get(cacheKey);
|
|
3852
3859
|
if (cached) {
|
|
3853
3860
|
if (this.config.debug) {
|
|
3854
|
-
|
|
3861
|
+
registerLog.debug("preprocess:cache-hit", { name: schema.name });
|
|
3855
3862
|
}
|
|
3856
3863
|
this.register(cached.schema);
|
|
3857
3864
|
this.entitySharingMap = { ...this.entitySharingMap, ...cached.entitySharing };
|
|
@@ -3864,7 +3871,7 @@ var OrbitalServerRuntime = class {
|
|
|
3864
3871
|
};
|
|
3865
3872
|
}
|
|
3866
3873
|
if (this.config.debug) {
|
|
3867
|
-
|
|
3874
|
+
registerLog.debug("preprocess:start", { name: schema.name });
|
|
3868
3875
|
}
|
|
3869
3876
|
const result = await preprocessSchema(schema, {
|
|
3870
3877
|
basePath: this.config.loaderConfig?.basePath || ".",
|
|
@@ -3971,25 +3978,29 @@ var OrbitalServerRuntime = class {
|
|
|
3971
3978
|
if (entity?.name && entity.instances && Array.isArray(entity.instances)) {
|
|
3972
3979
|
const instances = entity.instances;
|
|
3973
3980
|
if (instances.length > 0) {
|
|
3974
|
-
|
|
3981
|
+
persistLog.debug("seed:start", { entity: entity.name, count: instances.length });
|
|
3975
3982
|
const results = await Promise.all(
|
|
3976
3983
|
instances.map(async (instance) => {
|
|
3977
3984
|
try {
|
|
3978
3985
|
const result = await this.persistence.create(entity.name, instance);
|
|
3979
|
-
|
|
3986
|
+
persistLog.debug("seed:instance", { entity: entity.name, id: instance.id ?? "no-id" });
|
|
3980
3987
|
return result;
|
|
3981
3988
|
} catch (err) {
|
|
3982
|
-
|
|
3989
|
+
persistLog.error("seed:instance-error", {
|
|
3990
|
+
entity: entity.name,
|
|
3991
|
+
id: instance.id,
|
|
3992
|
+
error: err instanceof Error ? err : String(err)
|
|
3993
|
+
});
|
|
3983
3994
|
return null;
|
|
3984
3995
|
}
|
|
3985
3996
|
})
|
|
3986
3997
|
);
|
|
3987
3998
|
const successCount = results.filter((r) => r !== null).length;
|
|
3988
|
-
|
|
3999
|
+
persistLog.debug("seed:done", { entity: entity.name, success: successCount, total: instances.length });
|
|
3989
4000
|
}
|
|
3990
4001
|
} else if (this.config.mode === "mock" && this.persistence instanceof MockPersistenceAdapter) {
|
|
3991
4002
|
if (this.config.debug) {
|
|
3992
|
-
|
|
4003
|
+
persistLog.debug("mock:generate", { entity: entity?.name });
|
|
3993
4004
|
}
|
|
3994
4005
|
if (entity?.name && entity.fields) {
|
|
3995
4006
|
const fields = entity.fields.filter(
|
|
@@ -4003,7 +4014,7 @@ var OrbitalServerRuntime = class {
|
|
|
4003
4014
|
}));
|
|
4004
4015
|
this.persistence.registerEntity({ name: entity.name, fields });
|
|
4005
4016
|
if (this.config.debug) {
|
|
4006
|
-
|
|
4017
|
+
persistLog.debug("mock:seeded", { entity: entity.name, count: this.persistence.count(entity.name) });
|
|
4007
4018
|
}
|
|
4008
4019
|
}
|
|
4009
4020
|
}
|
|
@@ -4024,16 +4035,18 @@ var OrbitalServerRuntime = class {
|
|
|
4024
4035
|
}));
|
|
4025
4036
|
this.persistence.registerEntity({ name: auxEntity.name, fields: auxFields });
|
|
4026
4037
|
if (this.config.debug) {
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4038
|
+
persistLog.debug("mock:seeded-auxiliary", {
|
|
4039
|
+
entity: auxEntity.name,
|
|
4040
|
+
count: this.persistence.count(auxEntity.name)
|
|
4041
|
+
});
|
|
4030
4042
|
}
|
|
4031
4043
|
}
|
|
4032
4044
|
}
|
|
4033
4045
|
if (this.config.debug) {
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4046
|
+
registerLog.debug("register:orbital", {
|
|
4047
|
+
name: orbital.name,
|
|
4048
|
+
traitCount: (orbital.traits || []).length
|
|
4049
|
+
});
|
|
4037
4050
|
}
|
|
4038
4051
|
}
|
|
4039
4052
|
/**
|
|
@@ -4041,7 +4054,10 @@ var OrbitalServerRuntime = class {
|
|
|
4041
4054
|
*/
|
|
4042
4055
|
registerOrbital(orbital) {
|
|
4043
4056
|
this.registerOrbitalAsync(orbital).catch((err) => {
|
|
4044
|
-
|
|
4057
|
+
registerLog.error("register:failed", {
|
|
4058
|
+
name: orbital.name,
|
|
4059
|
+
error: err instanceof Error ? err : String(err)
|
|
4060
|
+
});
|
|
4045
4061
|
});
|
|
4046
4062
|
}
|
|
4047
4063
|
/**
|
|
@@ -4060,9 +4076,13 @@ var OrbitalServerRuntime = class {
|
|
|
4060
4076
|
const cleanup = this.eventBus.on(bareEvent, async (event) => {
|
|
4061
4077
|
if (!matcher(event.source)) return;
|
|
4062
4078
|
if (this.config.debug) {
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4079
|
+
xOrbitalLog.debug("listen:received", () => ({
|
|
4080
|
+
receiverOrbital: orbitalName,
|
|
4081
|
+
receiverTrait: trait.name,
|
|
4082
|
+
event: listener.event,
|
|
4083
|
+
sourceOrbital: event.source?.orbital ?? "?",
|
|
4084
|
+
sourceTrait: event.source?.trait ?? "?"
|
|
4085
|
+
}));
|
|
4066
4086
|
}
|
|
4067
4087
|
let mappedPayload = event.payload;
|
|
4068
4088
|
if (listener.payloadMapping && event.payload) {
|
|
@@ -4107,9 +4127,7 @@ var OrbitalServerRuntime = class {
|
|
|
4107
4127
|
}
|
|
4108
4128
|
}
|
|
4109
4129
|
if (this.config.debug && this.tickBindings.length > 0) {
|
|
4110
|
-
|
|
4111
|
-
`[OrbitalRuntime] Registered ${this.tickBindings.length} tick(s)`
|
|
4112
|
-
);
|
|
4130
|
+
registerLog.debug("register:ticks", { count: this.tickBindings.length });
|
|
4113
4131
|
}
|
|
4114
4132
|
}
|
|
4115
4133
|
/**
|
|
@@ -4125,9 +4143,12 @@ var OrbitalServerRuntime = class {
|
|
|
4125
4143
|
intervalMs = 1e3;
|
|
4126
4144
|
}
|
|
4127
4145
|
if (this.config.debug) {
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4146
|
+
registerLog.debug("register:tick", {
|
|
4147
|
+
orbital: orbitalName,
|
|
4148
|
+
trait: traitName,
|
|
4149
|
+
tick: tick.name,
|
|
4150
|
+
intervalMs
|
|
4151
|
+
});
|
|
4131
4152
|
}
|
|
4132
4153
|
const timerId = setInterval(async () => {
|
|
4133
4154
|
await this.executeTick(orbitalName, traitName, tick, registered);
|
|
@@ -4146,9 +4167,7 @@ var OrbitalServerRuntime = class {
|
|
|
4146
4167
|
parseIntervalString(interval) {
|
|
4147
4168
|
const match = interval.match(/^(\d+)(ms|s|m|h)?$/);
|
|
4148
4169
|
if (!match) {
|
|
4149
|
-
|
|
4150
|
-
`[OrbitalRuntime] Invalid interval format: ${interval}, defaulting to 1000ms`
|
|
4151
|
-
);
|
|
4170
|
+
registerLog.warn("register:tick-invalid-interval", { interval, defaultMs: 1e3 });
|
|
4152
4171
|
return 1e3;
|
|
4153
4172
|
}
|
|
4154
4173
|
const value = parseInt(match[1], 10);
|
|
@@ -4179,9 +4198,12 @@ var OrbitalServerRuntime = class {
|
|
|
4179
4198
|
entities = entities.filter((e) => appliesToSet.has(e.id));
|
|
4180
4199
|
}
|
|
4181
4200
|
if (this.config.debug && entities.length > 0) {
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4201
|
+
effectLog2.debug("tick:processing", () => ({
|
|
4202
|
+
orbital: orbitalName,
|
|
4203
|
+
trait: traitName,
|
|
4204
|
+
tick: tick.name,
|
|
4205
|
+
entityCount: entities.length
|
|
4206
|
+
}));
|
|
4185
4207
|
}
|
|
4186
4208
|
for (const entity of entities) {
|
|
4187
4209
|
if (tick.guard) {
|
|
@@ -4197,17 +4219,19 @@ var OrbitalServerRuntime = class {
|
|
|
4197
4219
|
);
|
|
4198
4220
|
if (!guardPasses) {
|
|
4199
4221
|
if (this.config.debug) {
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4222
|
+
effectLog2.debug("tick:guard-failed", () => ({
|
|
4223
|
+
tick: tick.name,
|
|
4224
|
+
entityId: typeof entity.id === "string" ? entity.id : void 0
|
|
4225
|
+
}));
|
|
4203
4226
|
}
|
|
4204
4227
|
continue;
|
|
4205
4228
|
}
|
|
4206
4229
|
} catch (error) {
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4230
|
+
effectLog2.error("tick:guard-error", {
|
|
4231
|
+
tick: tick.name,
|
|
4232
|
+
entityId: typeof entity.id === "string" ? entity.id : void 0,
|
|
4233
|
+
error: error instanceof Error ? error : String(error)
|
|
4234
|
+
});
|
|
4211
4235
|
continue;
|
|
4212
4236
|
}
|
|
4213
4237
|
}
|
|
@@ -4229,17 +4253,18 @@ var OrbitalServerRuntime = class {
|
|
|
4229
4253
|
tickEffectResults
|
|
4230
4254
|
);
|
|
4231
4255
|
if (this.config.debug) {
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4256
|
+
effectLog2.debug("tick:effects-executed", () => ({
|
|
4257
|
+
tick: tick.name,
|
|
4258
|
+
entityId: typeof entity.id === "string" ? entity.id : void 0
|
|
4259
|
+
}));
|
|
4235
4260
|
}
|
|
4236
4261
|
}
|
|
4237
4262
|
}
|
|
4238
4263
|
} catch (error) {
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
error
|
|
4242
|
-
);
|
|
4264
|
+
effectLog2.error("tick:execute-error", {
|
|
4265
|
+
tick: tick.name,
|
|
4266
|
+
error: error instanceof Error ? error : String(error)
|
|
4267
|
+
});
|
|
4243
4268
|
}
|
|
4244
4269
|
}
|
|
4245
4270
|
/**
|
|
@@ -4400,7 +4425,11 @@ var OrbitalServerRuntime = class {
|
|
|
4400
4425
|
);
|
|
4401
4426
|
const filteredResults = activeTraits && activeTraits.length > 0 ? results.filter(({ traitName }) => activeTraits.includes(traitName)) : results;
|
|
4402
4427
|
if (this.config.debug && activeTraits) {
|
|
4403
|
-
|
|
4428
|
+
busLog.debug("dispatch:filter-traits", () => ({
|
|
4429
|
+
total: results.length,
|
|
4430
|
+
active: filteredResults.length,
|
|
4431
|
+
activeTraits: activeTraits.join(",")
|
|
4432
|
+
}));
|
|
4404
4433
|
}
|
|
4405
4434
|
for (const { traitName, result } of filteredResults) {
|
|
4406
4435
|
if (result.effects.length > 0) {
|
|
@@ -4455,7 +4484,12 @@ var OrbitalServerRuntime = class {
|
|
|
4455
4484
|
const handlers = {
|
|
4456
4485
|
emit: (event, eventPayload, source) => {
|
|
4457
4486
|
if (this.config.debug) {
|
|
4458
|
-
|
|
4487
|
+
busLog.debug("emit:dispatch", () => ({
|
|
4488
|
+
event,
|
|
4489
|
+
payloadJson: JSON.stringify(eventPayload ?? null),
|
|
4490
|
+
sourceOrbital: source?.orbital,
|
|
4491
|
+
sourceTrait: source?.trait
|
|
4492
|
+
}));
|
|
4459
4493
|
}
|
|
4460
4494
|
const stamp = source ?? {
|
|
4461
4495
|
orbital: registered.schema.name,
|
|
@@ -4654,9 +4688,7 @@ var OrbitalServerRuntime = class {
|
|
|
4654
4688
|
...paramsEcho
|
|
4655
4689
|
};
|
|
4656
4690
|
} else {
|
|
4657
|
-
|
|
4658
|
-
`[OrbitalRuntime] call-service not configured: ${service}.${action}`
|
|
4659
|
-
);
|
|
4691
|
+
effectLog2.warn("call-service:not-configured", { service, action });
|
|
4660
4692
|
}
|
|
4661
4693
|
effectResults.push({
|
|
4662
4694
|
effect: "call-service",
|
|
@@ -4710,10 +4742,10 @@ var OrbitalServerRuntime = class {
|
|
|
4710
4742
|
try {
|
|
4711
4743
|
return Boolean(evaluate(predicate, ctx));
|
|
4712
4744
|
} catch (err) {
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
err
|
|
4716
|
-
);
|
|
4745
|
+
effectLog2.error("fetch:filter-eval-error", {
|
|
4746
|
+
entityType: fetchEntityType,
|
|
4747
|
+
error: err instanceof Error ? err : String(err)
|
|
4748
|
+
});
|
|
4717
4749
|
return false;
|
|
4718
4750
|
}
|
|
4719
4751
|
});
|
|
@@ -4733,7 +4765,10 @@ var OrbitalServerRuntime = class {
|
|
|
4733
4765
|
}
|
|
4734
4766
|
return result === null ? null : { rows: result, total };
|
|
4735
4767
|
} catch (error) {
|
|
4736
|
-
|
|
4768
|
+
effectLog2.error("fetch:error", {
|
|
4769
|
+
entityType: fetchEntityType,
|
|
4770
|
+
error: error instanceof Error ? error : String(error)
|
|
4771
|
+
});
|
|
4737
4772
|
return null;
|
|
4738
4773
|
}
|
|
4739
4774
|
},
|
|
@@ -4742,7 +4777,10 @@ var OrbitalServerRuntime = class {
|
|
|
4742
4777
|
try {
|
|
4743
4778
|
return await handlers.fetch(refEntityType, options);
|
|
4744
4779
|
} catch (error) {
|
|
4745
|
-
|
|
4780
|
+
effectLog2.error("ref:error", {
|
|
4781
|
+
entityType: refEntityType,
|
|
4782
|
+
error: error instanceof Error ? error : String(error)
|
|
4783
|
+
});
|
|
4746
4784
|
return null;
|
|
4747
4785
|
}
|
|
4748
4786
|
},
|
|
@@ -4838,7 +4876,7 @@ var OrbitalServerRuntime = class {
|
|
|
4838
4876
|
},
|
|
4839
4877
|
watch: (_watchEntityType, _watchOptions) => {
|
|
4840
4878
|
if (this.config.debug) {
|
|
4841
|
-
|
|
4879
|
+
effectLog2.debug("watch:noop-server", { entityType: _watchEntityType });
|
|
4842
4880
|
}
|
|
4843
4881
|
},
|
|
4844
4882
|
atomic: async (atomicEffects) => {
|
|
@@ -4894,13 +4932,18 @@ var OrbitalServerRuntime = class {
|
|
|
4894
4932
|
},
|
|
4895
4933
|
notify: (message, type) => {
|
|
4896
4934
|
if (this.config.debug) {
|
|
4897
|
-
|
|
4935
|
+
effectLog2.info("notify", { type, message });
|
|
4898
4936
|
}
|
|
4899
4937
|
pushClientEffect(["notify", message, { type }]);
|
|
4900
4938
|
},
|
|
4901
4939
|
log: (message, level) => {
|
|
4902
|
-
|
|
4903
|
-
|
|
4940
|
+
if (level === "error") {
|
|
4941
|
+
dynamicLog.error(message);
|
|
4942
|
+
} else if (level === "warn") {
|
|
4943
|
+
dynamicLog.warn(message);
|
|
4944
|
+
} else {
|
|
4945
|
+
dynamicLog.debug(message);
|
|
4946
|
+
}
|
|
4904
4947
|
},
|
|
4905
4948
|
// Allow custom handlers to override
|
|
4906
4949
|
...this.config.effectHandlers
|
|
@@ -5030,7 +5073,10 @@ var OrbitalServerRuntime = class {
|
|
|
5030
5073
|
}
|
|
5031
5074
|
}
|
|
5032
5075
|
if (this.config.debug) {
|
|
5033
|
-
|
|
5076
|
+
persistLog.debug("cascade-delete", {
|
|
5077
|
+
count: affectedRecords.length,
|
|
5078
|
+
entityType: referringEntityType
|
|
5079
|
+
});
|
|
5034
5080
|
}
|
|
5035
5081
|
break;
|
|
5036
5082
|
case "nullify":
|
|
@@ -5049,7 +5095,11 @@ var OrbitalServerRuntime = class {
|
|
|
5049
5095
|
}
|
|
5050
5096
|
}
|
|
5051
5097
|
if (this.config.debug) {
|
|
5052
|
-
|
|
5098
|
+
persistLog.debug("nullify", {
|
|
5099
|
+
field: field.name,
|
|
5100
|
+
count: affectedRecords.length,
|
|
5101
|
+
entityType: referringEntityType
|
|
5102
|
+
});
|
|
5053
5103
|
}
|
|
5054
5104
|
break;
|
|
5055
5105
|
}
|
|
@@ -5060,7 +5110,11 @@ var OrbitalServerRuntime = class {
|
|
|
5060
5110
|
const maxDepth = 2;
|
|
5061
5111
|
if (depth >= maxDepth || visited.has(entityType)) {
|
|
5062
5112
|
if (this.config.debug) {
|
|
5063
|
-
|
|
5113
|
+
persistLog.debug("populate:skip", {
|
|
5114
|
+
entityType,
|
|
5115
|
+
depth,
|
|
5116
|
+
visited: visited.has(entityType)
|
|
5117
|
+
});
|
|
5064
5118
|
}
|
|
5065
5119
|
return;
|
|
5066
5120
|
}
|
|
@@ -5076,7 +5130,7 @@ var OrbitalServerRuntime = class {
|
|
|
5076
5130
|
}
|
|
5077
5131
|
if (!entityFields) {
|
|
5078
5132
|
if (this.config.debug) {
|
|
5079
|
-
|
|
5133
|
+
persistLog.warn("populate:no-entity-def", { entityType });
|
|
5080
5134
|
}
|
|
5081
5135
|
return;
|
|
5082
5136
|
}
|
|
@@ -5087,7 +5141,7 @@ var OrbitalServerRuntime = class {
|
|
|
5087
5141
|
});
|
|
5088
5142
|
if (!relationField?.relation?.entity) {
|
|
5089
5143
|
if (this.config.debug) {
|
|
5090
|
-
|
|
5144
|
+
persistLog.warn("populate:no-relation-field", { includeField, entityType });
|
|
5091
5145
|
}
|
|
5092
5146
|
continue;
|
|
5093
5147
|
}
|
|
@@ -5117,7 +5171,10 @@ var OrbitalServerRuntime = class {
|
|
|
5117
5171
|
}
|
|
5118
5172
|
} catch (error) {
|
|
5119
5173
|
if (this.config.debug) {
|
|
5120
|
-
|
|
5174
|
+
persistLog.error("populate:fetch-related-error", {
|
|
5175
|
+
entityType: relatedEntityType,
|
|
5176
|
+
error: error instanceof Error ? error : String(error)
|
|
5177
|
+
});
|
|
5121
5178
|
}
|
|
5122
5179
|
}
|
|
5123
5180
|
}
|
|
@@ -5153,7 +5210,11 @@ var OrbitalServerRuntime = class {
|
|
|
5153
5210
|
}
|
|
5154
5211
|
}
|
|
5155
5212
|
if (this.config.debug) {
|
|
5156
|
-
|
|
5213
|
+
persistLog.debug("populate:done", {
|
|
5214
|
+
field: populatedFieldName,
|
|
5215
|
+
count: entities.length,
|
|
5216
|
+
entityType
|
|
5217
|
+
});
|
|
5157
5218
|
}
|
|
5158
5219
|
}
|
|
5159
5220
|
}
|
|
@@ -5337,5 +5398,5 @@ function buildMatcher(src, listenerOrbital) {
|
|
|
5337
5398
|
}
|
|
5338
5399
|
|
|
5339
5400
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, OrbitalServerRuntime, StateMachineManager, buildEmitsFromTraits, collectDeclaredConfigDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMockPersistence, createOrbitalServerRuntime, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes };
|
|
5340
|
-
//# sourceMappingURL=chunk-
|
|
5341
|
-
//# sourceMappingURL=chunk-
|
|
5401
|
+
//# sourceMappingURL=chunk-VCDCBBYE.js.map
|
|
5402
|
+
//# sourceMappingURL=chunk-VCDCBBYE.js.map
|