@almadar/runtime 6.9.3 → 6.9.4
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-CvWqVb68.d.ts → OrbitalServerRuntime-BNRZpSZm.d.ts} +53 -45
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +1852 -1
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/{chunk-VUXJJPIQ.js → chunk-R6Y4IJ7I.js} +1219 -3063
- package/dist/chunk-R6Y4IJ7I.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-VUXJJPIQ.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as _almadar_core from '@almadar/core';
|
|
2
|
-
import { EventPayload, EntityRow, OrbitalSchema, Orbital, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, OrbitalDefinition, Entity, TraitConfig, TraitTick } from '@almadar/core';
|
|
3
1
|
import { Router } from 'express';
|
|
4
2
|
import { I as IEventBus, g as RuntimeEvent, f as EventListener, U as Unsubscribe, T as TraitDefinition, R as RuntimeConfig, i as TransitionObserver, C as ConfigContext, h as TraitState, j as TransitionResult, E as EvaluationContextExtensions, a as EffectHandlers } from './types-cuy5gd29.js';
|
|
3
|
+
import { EventPayload, EntityRow, DeclaredTraitConfig, TraitConfig, OrbitalSchema, Orbital, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, OrbitalDefinition, Entity, TraitTick } from '@almadar/core';
|
|
5
4
|
import { P as PersistenceAdapter } from './PersistenceAdapter-B6dQCbbU.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -310,6 +309,23 @@ declare class StateMachineManager {
|
|
|
310
309
|
resetAll(): void;
|
|
311
310
|
}
|
|
312
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Pure config-default extraction — kept OUT of `OrbitalServerRuntime.ts` so the
|
|
314
|
+
* package index can re-export it without dragging that module's node-only
|
|
315
|
+
* imports (`module`/`createRequire`, the external loader) into a browser bundle.
|
|
316
|
+
* This file has zero node dependencies (types only, from `@almadar/core`).
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Walk a trait's declared `config { }` schema and return the flat
|
|
321
|
+
* `{ key: default, ... }` map. Seeds `@config.X` binding context with the
|
|
322
|
+
* atom's own declared defaults before any call-site override is applied.
|
|
323
|
+
* Mirrors the compiled path's `DEFAULT_<TRAIT>_CONFIG` constant (backend.rs).
|
|
324
|
+
*/
|
|
325
|
+
declare function collectDeclaredConfigDefaults(trait: {
|
|
326
|
+
config?: DeclaredTraitConfig;
|
|
327
|
+
} | undefined): TraitConfig | undefined;
|
|
328
|
+
|
|
313
329
|
/**
|
|
314
330
|
* External Orbital Loader
|
|
315
331
|
*
|
|
@@ -674,6 +690,41 @@ declare function parseNamespacedEvent(eventName: string): {
|
|
|
674
690
|
event: string;
|
|
675
691
|
};
|
|
676
692
|
|
|
693
|
+
/**
|
|
694
|
+
* OrbitalServerRuntime - Dynamic Server-Side Orbital Execution
|
|
695
|
+
*
|
|
696
|
+
* This runtime takes an OrbitalSchema and dynamically:
|
|
697
|
+
* 1. Registers all orbitals and their traits
|
|
698
|
+
* 2. Creates Express routes for trait communication
|
|
699
|
+
* 3. Executes state machines server-side
|
|
700
|
+
* 4. Handles cross-orbital event propagation
|
|
701
|
+
*
|
|
702
|
+
* This is the "interpreted" mode - no compilation needed.
|
|
703
|
+
* The compiler generates equivalent static code for production.
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```typescript
|
|
707
|
+
* import { OrbitalServerRuntime } from '@kflow-builder/shared/runtime';
|
|
708
|
+
* import express from 'express';
|
|
709
|
+
*
|
|
710
|
+
* const app = express();
|
|
711
|
+
* const runtime = new OrbitalServerRuntime();
|
|
712
|
+
*
|
|
713
|
+
* // Register schema (can be loaded from file, API, etc.)
|
|
714
|
+
* runtime.register(orbitalSchema);
|
|
715
|
+
*
|
|
716
|
+
* // Mount orbital routes
|
|
717
|
+
* app.use('/api/orbitals', runtime.router());
|
|
718
|
+
*
|
|
719
|
+
* // Client can now:
|
|
720
|
+
* // POST /api/orbitals/:orbital/events - Send event to orbital
|
|
721
|
+
* // GET /api/orbitals/:orbital/state - Get current state
|
|
722
|
+
* // GET /api/orbitals - List registered orbitals
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* @packageDocumentation
|
|
726
|
+
*/
|
|
727
|
+
|
|
677
728
|
/**
|
|
678
729
|
* Client-side effect tuple shipped in `OrbitalEventResponse.clientEffects`.
|
|
679
730
|
* Restricted to the three effect kinds the client knows how to apply to the
|
|
@@ -878,49 +929,6 @@ interface OrbitalServerRuntimeConfig {
|
|
|
878
929
|
contextExtensions?: EvaluationContextExtensions;
|
|
879
930
|
}
|
|
880
931
|
|
|
881
|
-
/**
|
|
882
|
-
* Check whether a schema needs preprocessing (has `uses` declarations or
|
|
883
|
-
* un-inlined cross-orbital trait references).
|
|
884
|
-
*
|
|
885
|
-
* Cross-orbital refs are trait entries like
|
|
886
|
-
* `{ ref: "Modal.traits.ModalRecordModal", ... }` with no inline
|
|
887
|
-
* `stateMachine`. If these aren't resolved before `register()` runs, the
|
|
888
|
-
* trait binder produces an empty state machine and all interactions
|
|
889
|
-
* targeting the trait are silently dropped.
|
|
890
|
-
*/
|
|
891
|
-
/**
|
|
892
|
-
* Walk a trait's DECLARED config schema (`{ icon: { type, default }, ... }`)
|
|
893
|
-
* and collect a flat `{ icon: <default>, ... }` map of just the default
|
|
894
|
-
* values. Used to seed the `@config.X` binding context with the atom's
|
|
895
|
-
* own declared defaults before any call-site override is applied. Mirrors
|
|
896
|
-
* the compiled path's `DEFAULT_<TRAIT>_CONFIG` constant emitted by
|
|
897
|
-
* backend.rs's Solution-1 plumbing.
|
|
898
|
-
*
|
|
899
|
-
* Returns `undefined` when the trait has no config schema or none of its
|
|
900
|
-
* fields declare a default — keeps the caller's existing fast-path.
|
|
901
|
-
*/
|
|
902
|
-
/**
|
|
903
|
-
* Structural shape that both `@almadar/core`'s `Trait` and
|
|
904
|
-
* `ResolvedTrait` satisfy: a `config?` map keyed by field name whose
|
|
905
|
-
* values either carry a `default` (the declared-schema form loaded
|
|
906
|
-
* from `.orb`) or are bare values (the runtime-resolved form).
|
|
907
|
-
*
|
|
908
|
-
* Widening to a structural parameter lets callers from the resolved
|
|
909
|
-
* side (e.g., `@almadar/ui`'s `useTraitStateMachine`) pass their own
|
|
910
|
-
* `ResolvedTrait` without an `as unknown as` cast.
|
|
911
|
-
*/
|
|
912
|
-
/**
|
|
913
|
-
* Read the `default` from each field of a trait's declared
|
|
914
|
-
* `config { }` schema and return the flat `{ key: default, ... }`
|
|
915
|
-
* map. Used to seed `@config.X` binding context with the atom's
|
|
916
|
-
* own declared defaults before any call-site override is applied.
|
|
917
|
-
*
|
|
918
|
-
* Mirrors the compiled path's `DEFAULT_<TRAIT>_CONFIG` constant
|
|
919
|
-
* emitted by `backend.rs` Solution-1.
|
|
920
|
-
*/
|
|
921
|
-
declare function collectDeclaredConfigDefaults(trait: {
|
|
922
|
-
config?: _almadar_core.DeclaredTraitConfig;
|
|
923
|
-
} | undefined): TraitConfig | undefined;
|
|
924
932
|
declare class OrbitalServerRuntime {
|
|
925
933
|
protected orbitals: Map<string, RegisteredOrbital>;
|
|
926
934
|
private eventBus;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '@almadar/core';
|
|
2
1
|
import 'express';
|
|
3
|
-
export { C as ClientEffectTuple, B as ClientNavigateTuple, D as ClientNotifyTuple, F as ClientRenderUITuple, G as EffectResult, H as LoaderConfig, O as OrbitalEventRequest, e as OrbitalEventResponse, J as OrbitalServerRuntime, f as OrbitalServerRuntimeConfig, R as RegisteredOrbital, j as RuntimeOrbital, k as RuntimeOrbitalSchema, l as RuntimeTrait, K as RuntimeTraitTick, n as collectDeclaredConfigDefaults, M as createOrbitalServerRuntime } from './OrbitalServerRuntime-
|
|
2
|
+
export { C as ClientEffectTuple, B as ClientNavigateTuple, D as ClientNotifyTuple, F as ClientRenderUITuple, G as EffectResult, H as LoaderConfig, O as OrbitalEventRequest, e as OrbitalEventResponse, J as OrbitalServerRuntime, f as OrbitalServerRuntimeConfig, R as RegisteredOrbital, j as RuntimeOrbital, k as RuntimeOrbitalSchema, l as RuntimeTrait, K as RuntimeTraitTick, n as collectDeclaredConfigDefaults, M as createOrbitalServerRuntime } from './OrbitalServerRuntime-BNRZpSZm.js';
|
|
4
3
|
import './types-cuy5gd29.js';
|
|
4
|
+
import '@almadar/core';
|
|
5
5
|
export { I as InMemoryPersistence, P as PersistenceAdapter } from './PersistenceAdapter-B6dQCbbU.js';
|