@almadar/runtime 3.2.3 → 3.2.5
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-RHykAuqO.d.ts → OrbitalServerRuntime-DMRvEfcT.d.ts} +53 -1
- package/dist/OrbitalServerRuntime.d.ts +1 -1
- package/dist/OrbitalServerRuntime.js +8 -2
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/{chunk-PXASRZKG.js → chunk-JMMXSTWF.js} +3 -3
- package/dist/{chunk-PXASRZKG.js.map → chunk-JMMXSTWF.js.map} +1 -1
- package/dist/index.d.ts +128 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,138 @@
|
|
|
1
1
|
import { B as BindingContext, E as EvaluationContextExtensions, P as PatternProps, a as EffectHandlers, b as EffectContext, c as ExecutionEnvironment, d as EffectResult, T as TraitDefinition } from './types-B8OfRFfV.js';
|
|
2
2
|
export { e as Effect, f as EventListener, H as HANDLER_MANIFEST, I as IEventBus, R as RuntimeConfig, g as RuntimeEvent, h as TraitState, i as TransitionObserver, j as TransitionResult, U as Unsubscribe } from './types-B8OfRFfV.js';
|
|
3
|
-
|
|
3
|
+
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital } from './OrbitalServerRuntime-DMRvEfcT.js';
|
|
4
|
+
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, O as OrbitalEventRequest, e as OrbitalEventResponse, f as OrbitalServerRuntimeConfig, P as PersistenceAdapter, g as PreprocessOptions, h as PreprocessResult, i as PreprocessedSchema, j as ProcessEventOptions, R as RegisteredOrbital, k as RuntimeOrbital, l as RuntimeOrbitalSchema, m as RuntimeTrait, n as StateMachineManager, o as createInitialTraitState, p as findInitialState, q as findTransition, r as getIsolatedCollectionName, s as getNamespacedEvent, t as isBrowser, u as isElectron, v as isNamespacedEvent, w as isNode, x as normalizeEventKey, y as parseNamespacedEvent, z as preprocessSchema, A as processEvent } from './OrbitalServerRuntime-DMRvEfcT.js';
|
|
4
5
|
import { EvaluationContext } from '@almadar/evaluator';
|
|
5
6
|
export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
|
|
6
7
|
import { EventPayload, EntityRow, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
|
|
7
8
|
export { ServerBridgeConfig, ServerBridgeState } from './ServerBridge.js';
|
|
8
9
|
import 'express';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Unified Schema Loader
|
|
13
|
+
*
|
|
14
|
+
* Auto-detects the environment and routes to the appropriate loader:
|
|
15
|
+
* - FileSystemLoader for Node.js/Electron
|
|
16
|
+
* - HttpLoader for browser
|
|
17
|
+
*
|
|
18
|
+
* Also handles mixed loading scenarios where some imports use filesystem
|
|
19
|
+
* and others use HTTP.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* UnifiedLoader - Auto-detects environment and routes to appropriate loader.
|
|
26
|
+
*
|
|
27
|
+
* Loading Strategy:
|
|
28
|
+
* - Electron: Uses FileSystemLoader with HTTP fallback for remote URLs
|
|
29
|
+
* - Browser: Uses HttpLoader only (no filesystem access)
|
|
30
|
+
* - Node.js: Uses FileSystemLoader with HTTP for remote URLs
|
|
31
|
+
*
|
|
32
|
+
* Import Type Resolution:
|
|
33
|
+
* - `./local.orb`: FileSystem (Node/Electron) or Error (Browser)
|
|
34
|
+
* - `std/behaviors/x`: FileSystem OR HTTP (configurable)
|
|
35
|
+
* - `@scope/pkg.orb`: FileSystem OR HTTP (configurable)
|
|
36
|
+
* - `https://...`: Always HTTP
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const loader = createUnifiedLoader({
|
|
41
|
+
* basePath: "/project/schemas",
|
|
42
|
+
* stdLibPath: "/project/std", // or "https://cdn.example.com/std"
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* // Load relative file (uses FileSystem in Node, error in Browser)
|
|
46
|
+
* const local = await loader.load("./my-schema.orb");
|
|
47
|
+
*
|
|
48
|
+
* // Load from URL (always uses HTTP)
|
|
49
|
+
* const remote = await loader.load("https://example.com/schema.orb");
|
|
50
|
+
*
|
|
51
|
+
* // Load from std library (uses configured path type)
|
|
52
|
+
* const std = await loader.load("std/behaviors/game-core");
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare class UnifiedLoader implements SchemaLoader {
|
|
56
|
+
private options;
|
|
57
|
+
private httpLoader;
|
|
58
|
+
private fsLoader;
|
|
59
|
+
private fsLoaderInitialized;
|
|
60
|
+
private cache;
|
|
61
|
+
constructor(options: UnifiedLoaderOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Initialize the filesystem loader if available.
|
|
64
|
+
*/
|
|
65
|
+
private initFsLoader;
|
|
66
|
+
/**
|
|
67
|
+
* Determine which loader to use for an import path.
|
|
68
|
+
*/
|
|
69
|
+
private getLoaderForPath;
|
|
70
|
+
/**
|
|
71
|
+
* Load a schema from an import path.
|
|
72
|
+
*
|
|
73
|
+
* Note: We delegate chain management to the inner loader (HttpLoader or FsLoader).
|
|
74
|
+
* The inner loader handles circular import detection, so we don't push/pop here.
|
|
75
|
+
* We only use the unified cache to avoid duplicate loads across loaders.
|
|
76
|
+
*/
|
|
77
|
+
load(importPath: string, fromPath?: string, chain?: ImportChainLike): Promise<LoadResult<LoadedSchema>>;
|
|
78
|
+
/**
|
|
79
|
+
* Load a specific orbital from a schema by name.
|
|
80
|
+
*/
|
|
81
|
+
loadOrbital(importPath: string, orbitalName?: string, fromPath?: string, chain?: ImportChainLike): Promise<LoadResult<LoadedOrbital>>;
|
|
82
|
+
/**
|
|
83
|
+
* Resolve an import path to an absolute path/URL.
|
|
84
|
+
*/
|
|
85
|
+
resolvePath(importPath: string, fromPath?: string): LoadResult<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Clear all caches.
|
|
88
|
+
*/
|
|
89
|
+
clearCache(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Get combined cache statistics.
|
|
92
|
+
*/
|
|
93
|
+
getCacheStats(): {
|
|
94
|
+
size: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Check if filesystem loading is available.
|
|
98
|
+
*/
|
|
99
|
+
hasFilesystemAccess(): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Get current environment info.
|
|
102
|
+
*/
|
|
103
|
+
getEnvironmentInfo(): {
|
|
104
|
+
isElectron: boolean;
|
|
105
|
+
isBrowser: boolean;
|
|
106
|
+
isNode: boolean;
|
|
107
|
+
hasFilesystem: boolean;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create a unified loader with sensible defaults.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* // Basic usage
|
|
116
|
+
* const loader = createUnifiedLoader({
|
|
117
|
+
* basePath: "/schemas",
|
|
118
|
+
* stdLibPath: "/std",
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // With HTTP std library
|
|
122
|
+
* const loader = createUnifiedLoader({
|
|
123
|
+
* basePath: "/schemas",
|
|
124
|
+
* stdLibPath: "https://cdn.example.com/orbital-std",
|
|
125
|
+
* });
|
|
126
|
+
*
|
|
127
|
+
* // Force HTTP only (browser-like behavior)
|
|
128
|
+
* const loader = createUnifiedLoader({
|
|
129
|
+
* basePath: "/api/schemas",
|
|
130
|
+
* forceLoader: "http",
|
|
131
|
+
* });
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare function createUnifiedLoader(options: UnifiedLoaderOptions): UnifiedLoader;
|
|
135
|
+
|
|
10
136
|
/**
|
|
11
137
|
* BindingResolver - Platform-Agnostic Binding Resolution
|
|
12
138
|
*
|
|
@@ -529,4 +655,4 @@ declare namespace index {
|
|
|
529
655
|
export { type index_ComposeBehaviorsInput as ComposeBehaviorsInput, type index_ComposeBehaviorsResult as ComposeBehaviorsResult, type index_EventWiringEntry as EventWiringEntry, type index_LayoutStrategy as LayoutStrategy, type index_PipeStep as PipeStep, index_applyEventWiring as applyEventWiring, index_composeBehaviors as composeBehaviors, index_detectLayoutStrategy as detectLayoutStrategy, index_pipeBehaviors as pipeBehaviors };
|
|
530
656
|
}
|
|
531
657
|
|
|
532
|
-
export { BindingContext, type ClientEventBus, type ComposeBehaviorsInput, type ComposeBehaviorsResult, type CreateClientEffectHandlersOptions, EffectContext, EffectExecutor, type EffectExecutorOptions, EffectHandlers, EffectResult, type EntityField, type EntitySchema, type EventWiringEntry, ExecutionEnvironment, type LayoutStrategy, type MockPersistenceConfig, type OsHandlerContext, type OsHandlerResult, type PayloadMismatch, type PipeStep, type SlotSetter, TraitDefinition, applyEventWiring, buildEmitsFromTraits, composeBehaviors, index as composition, containsBindings, createClientEffectHandlers, createContextFromBindings, createTestExecutor, detectLayoutStrategy, extractBindings, interpolateProps, interpolateValue, pipeBehaviors, validatePayloadShapes };
|
|
658
|
+
export { BindingContext, type ClientEventBus, type ComposeBehaviorsInput, type ComposeBehaviorsResult, type CreateClientEffectHandlersOptions, EffectContext, EffectExecutor, type EffectExecutorOptions, EffectHandlers, EffectResult, type EntityField, type EntitySchema, type EventWiringEntry, ExecutionEnvironment, ImportChainLike, type LayoutStrategy, LoadResult, LoadedOrbital, LoadedSchema, type MockPersistenceConfig, type OsHandlerContext, type OsHandlerResult, type PayloadMismatch, type PipeStep, SchemaLoader, type SlotSetter, TraitDefinition, UnifiedLoaderOptions, applyEventWiring, buildEmitsFromTraits, composeBehaviors, index as composition, containsBindings, createClientEffectHandlers, createContextFromBindings, createTestExecutor, createUnifiedLoader, detectLayoutStrategy, extractBindings, interpolateProps, interpolateValue, pipeBehaviors, validatePayloadShapes };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createTestExecutor, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isNamespacedEvent, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent } from './chunk-
|
|
1
|
+
export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent } from './chunk-JMMXSTWF.js';
|
|
2
2
|
import { __export } from './chunk-PZ5AY32C.js';
|
|
3
3
|
import { isInlineTrait } from '@almadar/core';
|
|
4
4
|
|