@almadar/runtime 6.57.0 → 6.59.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-CgDV0DwN.d.ts → OrbitalServerRuntime-PI9Ioxdp.d.ts} +32 -1
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +46 -3
- package/dist/ServerBridge.d.ts +1 -1
- package/dist/{chunk-MMVKKLAP.js → chunk-WSNZNXZE.js} +2 -2
- package/dist/createOsHandlers.d.ts +1 -1
- package/dist/index.d.ts +12 -7
- package/dist/index.js +9 -3
- package/dist/{types-D20NPs1X.d.ts → types-TwQ8Dybu.d.ts} +15 -3
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { I as IEventBus, R as RuntimeEvent, a as EventListener, U as Unsubscribe, T as TraitDefinition, b as RuntimeConfig, c as TransitionObserver, d as TraitState, C as ConfigContext, e as TransitionResult, f as EvaluationContextExtensions, E as EffectHandlers } from './types-
|
|
2
|
+
import { I as IEventBus, R as RuntimeEvent, a as EventListener, U as Unsubscribe, T as TraitDefinition, b as RuntimeConfig, c as TransitionObserver, d as TraitState, C as ConfigContext, e as TransitionResult, f as EvaluationContextExtensions, E as EffectHandlers } from './types-TwQ8Dybu.js';
|
|
3
3
|
import { EventPayload, EventId, EntityRow, UserContext, Orbital, ServiceCallResult, TraitConfig, DeclaredTraitConfig, Entity, OrbitalSchema, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, RawUserClaims, OrbitalDefinition, TraitTick } from '@almadar/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -974,6 +974,16 @@ interface OrbitalEventRequest {
|
|
|
974
974
|
user?: RawUserClaims;
|
|
975
975
|
/** Per-tab client identity (UUID) — excludes this request's origin from live-broadcast delivery. */
|
|
976
976
|
clientId?: string;
|
|
977
|
+
/**
|
|
978
|
+
* Broadcast-class marker (T6, docs/Almadar_Tick_Loop.md §3a): the name of
|
|
979
|
+
* the tick that emitted this event. Tick-stamped dispatches are
|
|
980
|
+
* latest-state broadcasts — the client fires them without awaiting the
|
|
981
|
+
* response, and the server relays them to OTHER tabs coalesced
|
|
982
|
+
* (newest-per-key) at a snapshot rate instead of 1:1.
|
|
983
|
+
*/
|
|
984
|
+
tick?: string;
|
|
985
|
+
/** Emitting trait for a tick-stamped dispatch — builds the relay's BusEventSource (sourceless emits are dropped client-side). */
|
|
986
|
+
sourceTrait?: string;
|
|
977
987
|
}
|
|
978
988
|
/**
|
|
979
989
|
* One persist-envelope success emit, handed to the live-broadcast sink
|
|
@@ -1072,6 +1082,12 @@ interface LoaderConfig {
|
|
|
1072
1082
|
interface OrbitalServerRuntimeConfig {
|
|
1073
1083
|
/** Enable debug logging */
|
|
1074
1084
|
debug?: boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* Snapshot cadence (ms) for relaying tick-stamped broadcasts to other
|
|
1087
|
+
* clients — newest-per-(client, orbital, event) wins between flushes
|
|
1088
|
+
* (T6, docs/Almadar_Tick_Loop.md §3a). Default 50 (≈20Hz).
|
|
1089
|
+
*/
|
|
1090
|
+
tickRelayIntervalMs?: number;
|
|
1075
1091
|
/** Custom effect handlers (for integrating with your data layer) */
|
|
1076
1092
|
effectHandlers?: Partial<EffectHandlers>;
|
|
1077
1093
|
/** Persistence adapter for entity data */
|
|
@@ -1162,6 +1178,14 @@ declare class OrbitalServerRuntime {
|
|
|
1162
1178
|
private appThemeKey;
|
|
1163
1179
|
/** Wired by the hosting server (e.g. the playground SSE endpoint) via `setLiveBroadcastSink`. */
|
|
1164
1180
|
private liveBroadcastSink;
|
|
1181
|
+
/**
|
|
1182
|
+
* Tick-broadcast relay (T6): newest pending item per
|
|
1183
|
+
* (originClientId, orbital, event), flushed to the live-broadcast sink on
|
|
1184
|
+
* the `tickRelayIntervalMs` cadence — other tabs get the latest position
|
|
1185
|
+
* at snapshot rate, never 1:1 with emissions.
|
|
1186
|
+
*/
|
|
1187
|
+
private readonly tickRelayPending;
|
|
1188
|
+
private tickRelayTimer;
|
|
1165
1189
|
/**
|
|
1166
1190
|
* Trait name -> resolved `TraitConfig`, computed once per `register()` via
|
|
1167
1191
|
* `buildResolvedTraitConfigs` (`@almadar/core`). An embedded sub-trait's
|
|
@@ -1382,6 +1406,13 @@ declare class OrbitalServerRuntime {
|
|
|
1382
1406
|
setDefaultUser(user: UserContext | undefined): void;
|
|
1383
1407
|
/** The viewer a dev host is currently presenting the app as. */
|
|
1384
1408
|
getDefaultUser(): UserContext | undefined;
|
|
1409
|
+
/**
|
|
1410
|
+
* Queue a tick-stamped dispatch for coalesced snapshot relay (T6). Newest
|
|
1411
|
+
* per (originClientId, orbital, event) wins between flushes — the standard
|
|
1412
|
+
* netcode position-broadcast discipline.
|
|
1413
|
+
*/
|
|
1414
|
+
private queueTickRelay;
|
|
1415
|
+
private flushTickRelay;
|
|
1385
1416
|
/**
|
|
1386
1417
|
* The registered app's declared persona roster: the live rows of its
|
|
1387
1418
|
* `[identity]` entity, mapped onto viewers (`Almadar_LOLO_Identity.md` §4.3).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
export { F as ClientEffectTuple, G as ClientNavigateBackTuple, H as ClientNavigateTuple, J as ClientNotifyTuple, K as ClientRenderUITuple, M as EffectResult, e as InMemoryPersistence, N as LiveBroadcastItem, Q as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, T as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, V as RuntimeTraitTick, p as collectDeclaredConfigDefaults, W as createOrbitalServerRuntime } from './OrbitalServerRuntime-
|
|
3
|
-
import './types-
|
|
2
|
+
export { F as ClientEffectTuple, G as ClientNavigateBackTuple, H as ClientNavigateTuple, J as ClientNotifyTuple, K as ClientRenderUITuple, M as EffectResult, e as InMemoryPersistence, N as LiveBroadcastItem, Q as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, T as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, V as RuntimeTraitTick, p as collectDeclaredConfigDefaults, W as createOrbitalServerRuntime } from './OrbitalServerRuntime-PI9Ioxdp.js';
|
|
3
|
+
import './types-TwQ8Dybu.js';
|
|
4
4
|
import '@almadar/core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-
|
|
2
|
-
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-
|
|
1
|
+
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-WSNZNXZE.js';
|
|
2
|
+
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-WSNZNXZE.js';
|
|
3
3
|
import { isValidCronExpression } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import { createContextFromBindings, resolveCallSitePayloadCaptures, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
|
|
5
5
|
import './chunk-T4VDAB4C.js';
|
|
@@ -137,6 +137,14 @@ var OrbitalServerRuntime = class {
|
|
|
137
137
|
appThemeKey;
|
|
138
138
|
/** Wired by the hosting server (e.g. the playground SSE endpoint) via `setLiveBroadcastSink`. */
|
|
139
139
|
liveBroadcastSink = null;
|
|
140
|
+
/**
|
|
141
|
+
* Tick-broadcast relay (T6): newest pending item per
|
|
142
|
+
* (originClientId, orbital, event), flushed to the live-broadcast sink on
|
|
143
|
+
* the `tickRelayIntervalMs` cadence — other tabs get the latest position
|
|
144
|
+
* at snapshot rate, never 1:1 with emissions.
|
|
145
|
+
*/
|
|
146
|
+
tickRelayPending = /* @__PURE__ */ new Map();
|
|
147
|
+
tickRelayTimer = null;
|
|
140
148
|
/**
|
|
141
149
|
* Trait name -> resolved `TraitConfig`, computed once per `register()` via
|
|
142
150
|
* `buildResolvedTraitConfigs` (`@almadar/core`). An embedded sub-trait's
|
|
@@ -1047,6 +1055,37 @@ var OrbitalServerRuntime = class {
|
|
|
1047
1055
|
getDefaultUser() {
|
|
1048
1056
|
return this.config.defaultUser;
|
|
1049
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Queue a tick-stamped dispatch for coalesced snapshot relay (T6). Newest
|
|
1060
|
+
* per (originClientId, orbital, event) wins between flushes — the standard
|
|
1061
|
+
* netcode position-broadcast discipline.
|
|
1062
|
+
*/
|
|
1063
|
+
queueTickRelay(orbitalName, request) {
|
|
1064
|
+
const key = `${request.clientId ?? ""}:${orbitalName}:${request.event}`;
|
|
1065
|
+
this.tickRelayPending.set(key, {
|
|
1066
|
+
event: request.event,
|
|
1067
|
+
payload: request.payload,
|
|
1068
|
+
source: { orbital: orbitalName, trait: request.sourceTrait, tick: request.tick },
|
|
1069
|
+
originClientId: request.clientId
|
|
1070
|
+
});
|
|
1071
|
+
if (this.tickRelayTimer === null) {
|
|
1072
|
+
const timer = setInterval(() => this.flushTickRelay(), this.config.tickRelayIntervalMs ?? 50);
|
|
1073
|
+
if (typeof timer === "object" && typeof timer.unref === "function") timer.unref();
|
|
1074
|
+
this.tickRelayTimer = timer;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
flushTickRelay() {
|
|
1078
|
+
if (this.tickRelayPending.size === 0) {
|
|
1079
|
+
if (this.tickRelayTimer !== null) {
|
|
1080
|
+
clearInterval(this.tickRelayTimer);
|
|
1081
|
+
this.tickRelayTimer = null;
|
|
1082
|
+
}
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
const items = Array.from(this.tickRelayPending.values());
|
|
1086
|
+
this.tickRelayPending.clear();
|
|
1087
|
+
for (const item of items) this.liveBroadcastSink?.(item);
|
|
1088
|
+
}
|
|
1050
1089
|
/**
|
|
1051
1090
|
* The registered app's declared persona roster: the live rows of its
|
|
1052
1091
|
* `[identity]` entity, mapped onto viewers (`Almadar_LOLO_Identity.md` §4.3).
|
|
@@ -1252,6 +1291,9 @@ var OrbitalServerRuntime = class {
|
|
|
1252
1291
|
if (effectResults.length > 0) {
|
|
1253
1292
|
response.effectResults = effectResults;
|
|
1254
1293
|
}
|
|
1294
|
+
if (request.tick !== void 0 && this.liveBroadcastSink !== null) {
|
|
1295
|
+
this.queueTickRelay(orbitalName, request);
|
|
1296
|
+
}
|
|
1255
1297
|
return response;
|
|
1256
1298
|
} catch (error) {
|
|
1257
1299
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1522,7 +1564,8 @@ var OrbitalServerRuntime = class {
|
|
|
1522
1564
|
result = await this.config.effectHandlers.callService(
|
|
1523
1565
|
service,
|
|
1524
1566
|
action,
|
|
1525
|
-
params
|
|
1567
|
+
params,
|
|
1568
|
+
user ? { principal: user.id, role: user.role } : void 0
|
|
1526
1569
|
);
|
|
1527
1570
|
} else if (this.config.mode === "mock") {
|
|
1528
1571
|
const mockId = `mock_${service}_${action}_${Math.random().toString(36).slice(2, 10)}`;
|
package/dist/ServerBridge.d.ts
CHANGED
|
@@ -234,9 +234,9 @@ var TickScheduler = class {
|
|
|
234
234
|
}
|
|
235
235
|
tick.accumulatedMs += timestamp - tick.lastTimestamp;
|
|
236
236
|
tick.lastTimestamp = timestamp;
|
|
237
|
-
|
|
238
|
-
tick.accumulatedMs -= tick.intervalMs;
|
|
237
|
+
if (tick.accumulatedMs >= tick.intervalMs) {
|
|
239
238
|
tick.onDue();
|
|
239
|
+
tick.accumulatedMs = tick.accumulatedMs % tick.intervalMs;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as RuntimePatternValue, B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, h as EffectContext, i as ExecutionEnvironment, j as EffectResult, T as TraitDefinition } from './types-
|
|
2
|
-
export { k as BrowserFileMeta, l as BrowserFilePickerOptions, m as BrowserGeolocationOptions, n as BrowserGeolocationPosition, C as ConfigContext, o as Effect, a as EventListener, H as HANDLER_MANIFEST, I as IEventBus, b as RuntimeConfig, R as RuntimeEvent, d as TraitState, c as TransitionObserver, e as TransitionResult, U as Unsubscribe } from './types-
|
|
3
|
-
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-
|
|
4
|
-
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-
|
|
1
|
+
import { g as RuntimePatternValue, B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, h as EffectContext, i as ExecutionEnvironment, j as EffectResult, S as ServiceCallContext, T as TraitDefinition } from './types-TwQ8Dybu.js';
|
|
2
|
+
export { k as BrowserFileMeta, l as BrowserFilePickerOptions, m as BrowserGeolocationOptions, n as BrowserGeolocationPosition, C as ConfigContext, o as Effect, a as EventListener, H as HANDLER_MANIFEST, I as IEventBus, b as RuntimeConfig, R as RuntimeEvent, d as TraitState, c as TransitionObserver, e as TransitionResult, U as Unsubscribe } from './types-TwQ8Dybu.js';
|
|
3
|
+
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-PI9Ioxdp.js';
|
|
4
|
+
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-PI9Ioxdp.js';
|
|
5
5
|
import { EvaluationContext, SExpressionEvaluator } from '@almadar/evaluator';
|
|
6
6
|
export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
|
|
7
7
|
import { RenderBindingMarker, SExpr, TraitConfigObject, EventPayload, PatternConfig, EntityId, EntityField, EntityRow, EntityPersistence, ServiceParams, EntityAccessPolicies, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
|
|
@@ -146,8 +146,13 @@ declare function createUnifiedLoader(options: UnifiedLoaderOptions): UnifiedLoad
|
|
|
146
146
|
* isn't available, e.g. Node/SSR) that walks every registered tick each pass
|
|
147
147
|
* and fires whichever one(s) have crossed their own interval — so ticks due
|
|
148
148
|
* in the same pass commit together instead of on independent, uncoordinated
|
|
149
|
-
* timers.
|
|
150
|
-
* (
|
|
149
|
+
* timers. Each interval tick fires AT MOST ONCE per pass: missed beats are
|
|
150
|
+
* dropped (the phase remainder is kept, so healthy cadence is unchanged),
|
|
151
|
+
* because bursting catch-up firings after a slow pass multiplies the work
|
|
152
|
+
* that made the pass slow — an unbounded accumulator is a spiral-of-death
|
|
153
|
+
* amplifier that pegs the main thread and starves input. Framework-light:
|
|
154
|
+
* no React, usable from `OrbitalServerRuntime` (this package) and from
|
|
155
|
+
* `@almadar/ui`'s `useTraitStateMachine` alike.
|
|
151
156
|
*
|
|
152
157
|
* @packageDocumentation
|
|
153
158
|
*/
|
|
@@ -803,7 +808,7 @@ interface CreateServerEffectHandlersOptions {
|
|
|
803
808
|
trait?: string;
|
|
804
809
|
};
|
|
805
810
|
/** Consumer-supplied `call-service` handler. When absent, calls warn and return null. */
|
|
806
|
-
callService?: (service: string, action: string, params?: ServiceParams) => Promise<EventPayload | null>;
|
|
811
|
+
callService?: (service: string, action: string, params?: ServiceParams, context?: ServiceCallContext) => Promise<EventPayload | null>;
|
|
807
812
|
/**
|
|
808
813
|
* The declared `@read`/`@create`/`@update`/`@delete` directives, keyed by
|
|
809
814
|
* entity name. Build it with `entityAccessTable(schema)` from `@almadar/core`.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EffectExecutor } from './chunk-
|
|
2
|
-
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-
|
|
1
|
+
import { EffectExecutor } from './chunk-WSNZNXZE.js';
|
|
2
|
+
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-WSNZNXZE.js';
|
|
3
3
|
export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import { createContextFromBindings, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
|
|
5
5
|
export { CALLSITE_PAYLOAD_PREFIX, applyRowAccess, checkMutationAccess, containsBindings, createContextFromBindings, createMinimalContext, deferEntityBindings, extractBindings, interpolateProps, interpolateValue, resolveCallSitePayloadCaptures } from './chunk-ZJ62H3ES.js';
|
|
@@ -435,7 +435,13 @@ function createServerEffectHandlers(opts) {
|
|
|
435
435
|
try {
|
|
436
436
|
let result = null;
|
|
437
437
|
if (consumerCallService) {
|
|
438
|
-
|
|
438
|
+
const viewer = bindings?.user;
|
|
439
|
+
result = await consumerCallService(
|
|
440
|
+
service,
|
|
441
|
+
action,
|
|
442
|
+
params,
|
|
443
|
+
viewer ? { principal: viewer.id, role: viewer.role } : void 0
|
|
444
|
+
);
|
|
439
445
|
} else {
|
|
440
446
|
const mockId = `mock_${service}_${action}_${Math.random().toString(36).slice(2, 10)}`;
|
|
441
447
|
const paramsEcho = {};
|
|
@@ -121,6 +121,16 @@ interface TraitDefinition {
|
|
|
121
121
|
* Client: React hooks, DOM, router
|
|
122
122
|
* Server: Express, database, integrators
|
|
123
123
|
*/
|
|
124
|
+
/**
|
|
125
|
+
* Caller identity forwarded with a call-service dispatch (I-25) — the id and
|
|
126
|
+
* roster role of the SAME normalized viewer entity ACL enforces against.
|
|
127
|
+
* Absent when no viewer is bound (ticks, anonymous); role-gated services
|
|
128
|
+
* fail closed on absence.
|
|
129
|
+
*/
|
|
130
|
+
interface ServiceCallContext {
|
|
131
|
+
principal?: string;
|
|
132
|
+
role?: string;
|
|
133
|
+
}
|
|
124
134
|
interface EffectHandlers {
|
|
125
135
|
/**
|
|
126
136
|
* Emit an event to the event bus.
|
|
@@ -143,8 +153,10 @@ interface EffectHandlers {
|
|
|
143
153
|
persist: (action: 'create' | 'update' | 'delete' | 'batch', entityType: string, data?: EntityRow) => Promise<void>;
|
|
144
154
|
/** Set a field value on an entity */
|
|
145
155
|
set: (entityId: string, field: string, value: FieldValue) => void;
|
|
146
|
-
/** Call an external service
|
|
147
|
-
|
|
156
|
+
/** Call an external service. `context` carries the caller's identity
|
|
157
|
+
* (the same viewer entity ACL enforces against) so role-gated services
|
|
158
|
+
* can enforce server-side; hosts forward it to the integration factory. */
|
|
159
|
+
callService: (service: string, action: string, params?: ServiceParams, context?: ServiceCallContext) => Promise<EventPayload | null>;
|
|
148
160
|
/** Fetch entity data (server only) - returns data for client-side rendering.
|
|
149
161
|
*
|
|
150
162
|
* Always returns a `FetchResult` (`{rows, total}`) on success. `total`
|
|
@@ -489,4 +501,4 @@ interface TransitionObserver {
|
|
|
489
501
|
*/
|
|
490
502
|
declare const HANDLER_MANIFEST: Record<ExecutionEnvironment, string[]>;
|
|
491
503
|
|
|
492
|
-
export { type BindingContext as B, type ConfigContext as C, type EffectHandlers as E, HANDLER_MANIFEST as H, type IEventBus as I, type PatternProps as P, type RuntimeEvent as R, type TraitDefinition as T, type Unsubscribe as U, type EventListener as a, type RuntimeConfig as b, type TransitionObserver as c, type TraitState as d, type TransitionResult as e, type EvaluationContextExtensions as f, type RuntimePatternValue as g, type EffectContext as h, type ExecutionEnvironment as i, type EffectResult as j, type BrowserFileMeta as k, type BrowserFilePickerOptions as l, type BrowserGeolocationOptions as m, type BrowserGeolocationPosition as n, type Effect as o };
|
|
504
|
+
export { type BindingContext as B, type ConfigContext as C, type EffectHandlers as E, HANDLER_MANIFEST as H, type IEventBus as I, type PatternProps as P, type RuntimeEvent as R, type ServiceCallContext as S, type TraitDefinition as T, type Unsubscribe as U, type EventListener as a, type RuntimeConfig as b, type TransitionObserver as c, type TraitState as d, type TransitionResult as e, type EvaluationContextExtensions as f, type RuntimePatternValue as g, type EffectContext as h, type ExecutionEnvironment as i, type EffectResult as j, type BrowserFileMeta as k, type BrowserFilePickerOptions as l, type BrowserGeolocationOptions as m, type BrowserGeolocationPosition as n, type Effect as o };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/runtime",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.59.0",
|
|
4
4
|
"description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@almadar/core": "^10.
|
|
60
|
+
"@almadar/core": "^10.68.0",
|
|
61
61
|
"@almadar/evaluator": "^2.41.0",
|
|
62
62
|
"@almadar/logger": "^1.11.0",
|
|
63
|
-
"@almadar/server": "^2.
|
|
64
|
-
"@almadar/std": "^16.
|
|
63
|
+
"@almadar/server": "^2.37.0",
|
|
64
|
+
"@almadar/std": "^16.184.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"express": "^5.0.0"
|