@almadar/runtime 4.2.3 → 4.3.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-CFMJku6Q.d.ts → OrbitalServerRuntime-DS7Zs5x1.d.ts} +10 -2
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +13 -2
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/ServerBridge.d.ts +1 -1
- package/dist/{chunk-Z72NLOSF.js → chunk-P65PKXK2.js} +49 -8
- package/dist/chunk-P65PKXK2.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{types-CVSBlnzV.d.ts → types-DwDhc9Jt.d.ts} +11 -24
- package/package.json +3 -3
- package/dist/chunk-Z72NLOSF.js.map +0 -1
package/dist/ServerBridge.d.ts
CHANGED
|
@@ -290,6 +290,9 @@ function createContextFromBindings(bindings, strictBindings, contextExtensions)
|
|
|
290
290
|
if (strictBindings) {
|
|
291
291
|
ctx.strictBindings = true;
|
|
292
292
|
}
|
|
293
|
+
if (bindings.config) {
|
|
294
|
+
ctx.config = bindings.config;
|
|
295
|
+
}
|
|
293
296
|
if (contextExtensions) {
|
|
294
297
|
Object.assign(ctx, contextExtensions);
|
|
295
298
|
}
|
|
@@ -1126,7 +1129,7 @@ var EffectExecutor = class {
|
|
|
1126
1129
|
const emitCfg = this.extractEmitConfig(rawOpt);
|
|
1127
1130
|
try {
|
|
1128
1131
|
const result = await this.handlers.fetch(entityType, options);
|
|
1129
|
-
this.emitSuccess(emitCfg, "success", result);
|
|
1132
|
+
this.emitSuccess(emitCfg, "success", { data: result });
|
|
1130
1133
|
} catch (err) {
|
|
1131
1134
|
this.emitFailure(emitCfg, err);
|
|
1132
1135
|
throw err;
|
|
@@ -1151,7 +1154,7 @@ var EffectExecutor = class {
|
|
|
1151
1154
|
} else {
|
|
1152
1155
|
this.logUnsupported("ref");
|
|
1153
1156
|
}
|
|
1154
|
-
this.emitSuccess(refEmitCfg, "on_change", result);
|
|
1157
|
+
this.emitSuccess(refEmitCfg, "on_change", { data: result });
|
|
1155
1158
|
} catch (err) {
|
|
1156
1159
|
this.emitFailure(refEmitCfg, err);
|
|
1157
1160
|
throw err;
|
|
@@ -2068,6 +2071,35 @@ var UnifiedLoader = class {
|
|
|
2068
2071
|
function createUnifiedLoader(options) {
|
|
2069
2072
|
return new UnifiedLoader(options);
|
|
2070
2073
|
}
|
|
2074
|
+
function applyEventRenames(trait, renames) {
|
|
2075
|
+
if (!renames || Object.keys(renames).length === 0) return trait;
|
|
2076
|
+
const rename = (k) => k !== void 0 && k in renames ? renames[k] : k;
|
|
2077
|
+
const sm = trait.stateMachine;
|
|
2078
|
+
if (!sm) return trait;
|
|
2079
|
+
const nextTransitions = (sm.transitions ?? []).map((t) => ({
|
|
2080
|
+
...t,
|
|
2081
|
+
event: rename(t.event) ?? t.event
|
|
2082
|
+
}));
|
|
2083
|
+
const nextEvents = (sm.events ?? []).map((e) => {
|
|
2084
|
+
const newKey = rename(e.key);
|
|
2085
|
+
if (newKey === e.key) return e;
|
|
2086
|
+
return { ...e, key: newKey ?? e.key };
|
|
2087
|
+
});
|
|
2088
|
+
const nextEmits = (trait.emits ?? []).map((em) => {
|
|
2089
|
+
if (typeof em === "string") return rename(em) ?? em;
|
|
2090
|
+
const newEvent = rename(em.event);
|
|
2091
|
+
return newEvent === em.event ? em : { ...em, event: newEvent ?? em.event };
|
|
2092
|
+
});
|
|
2093
|
+
return {
|
|
2094
|
+
...trait,
|
|
2095
|
+
stateMachine: {
|
|
2096
|
+
...sm,
|
|
2097
|
+
transitions: nextTransitions,
|
|
2098
|
+
events: nextEvents
|
|
2099
|
+
},
|
|
2100
|
+
emits: nextEmits
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2071
2103
|
var ReferenceResolver = class {
|
|
2072
2104
|
loader;
|
|
2073
2105
|
options;
|
|
@@ -2301,7 +2333,14 @@ var ReferenceResolver = class {
|
|
|
2301
2333
|
}
|
|
2302
2334
|
if (typeof traitRef !== "string" && "ref" in traitRef) {
|
|
2303
2335
|
const refObj = traitRef;
|
|
2304
|
-
return this.resolveTraitRefString(
|
|
2336
|
+
return this.resolveTraitRefString(
|
|
2337
|
+
refObj.ref,
|
|
2338
|
+
imports,
|
|
2339
|
+
refObj.config,
|
|
2340
|
+
refObj.linkedEntity,
|
|
2341
|
+
refObj.name,
|
|
2342
|
+
refObj.events
|
|
2343
|
+
);
|
|
2305
2344
|
}
|
|
2306
2345
|
if (typeof traitRef === "string") {
|
|
2307
2346
|
return this.resolveTraitRefString(traitRef, imports);
|
|
@@ -2314,7 +2353,7 @@ var ReferenceResolver = class {
|
|
|
2314
2353
|
/**
|
|
2315
2354
|
* Resolve a trait reference string.
|
|
2316
2355
|
*/
|
|
2317
|
-
resolveTraitRefString(ref, imports, config, linkedEntity, overrideName) {
|
|
2356
|
+
resolveTraitRefString(ref, imports, config, linkedEntity, overrideName, eventRenames) {
|
|
2318
2357
|
const parsed = parseImportedTraitRef(ref);
|
|
2319
2358
|
if (parsed) {
|
|
2320
2359
|
const imported = imports.orbitals.get(parsed.alias);
|
|
@@ -2335,7 +2374,8 @@ var ReferenceResolver = class {
|
|
|
2335
2374
|
]
|
|
2336
2375
|
};
|
|
2337
2376
|
}
|
|
2338
|
-
const
|
|
2377
|
+
const baseTrait = overrideName ? { ...trait, name: overrideName } : trait;
|
|
2378
|
+
const renamedTrait = applyEventRenames(baseTrait, eventRenames);
|
|
2339
2379
|
return {
|
|
2340
2380
|
success: true,
|
|
2341
2381
|
data: {
|
|
@@ -2349,7 +2389,8 @@ var ReferenceResolver = class {
|
|
|
2349
2389
|
}
|
|
2350
2390
|
const localTrait = this.localTraits.get(ref);
|
|
2351
2391
|
if (localTrait) {
|
|
2352
|
-
const
|
|
2392
|
+
const baseLocal = overrideName ? { ...localTrait, name: overrideName } : localTrait;
|
|
2393
|
+
const renamedLocalTrait = applyEventRenames(baseLocal, eventRenames);
|
|
2353
2394
|
return {
|
|
2354
2395
|
success: true,
|
|
2355
2396
|
data: {
|
|
@@ -2692,5 +2733,5 @@ function parseNamespacedEvent(eventName) {
|
|
|
2692
2733
|
}
|
|
2693
2734
|
|
|
2694
2735
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent };
|
|
2695
|
-
//# sourceMappingURL=chunk-
|
|
2696
|
-
//# sourceMappingURL=chunk-
|
|
2736
|
+
//# sourceMappingURL=chunk-P65PKXK2.js.map
|
|
2737
|
+
//# sourceMappingURL=chunk-P65PKXK2.js.map
|