@openfairygui/backend 0.2.0-alpha.0 → 0.2.0-alpha.2
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/LICENSE +21 -0
- package/README.md +24 -1
- package/dist/index.cjs +5 -1119
- package/dist/index.d.cts +2 -364
- package/dist/index.d.mts +2 -364
- package/dist/index.mjs +2 -1091
- package/dist/node.cjs +107 -0
- package/dist/node.d.cts +8 -0
- package/dist/node.d.mts +8 -0
- package/dist/node.mjs +78 -0
- package/dist/runtime-BL9Pkfc7.cjs +1217 -0
- package/dist/runtime-BPWzx-Tv.mjs +1193 -0
- package/dist/runtime-OO1sHuCl.d.mts +424 -0
- package/dist/runtime-qcSlD_9-.d.cts +424 -0
- package/package.json +65 -53
- package/src/index.ts +6 -1
- package/src/node.ts +96 -0
- package/src/runtime.ts +155 -80
- package/src/services/artifact-service.ts +11 -1
- package/src/services/authoring-service.ts +151 -37
- package/src/services/context.ts +14 -3
- package/src/services/event-service.ts +1 -1
- package/src/services/runtime-service.ts +155 -24
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenFairyGUI Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -11,7 +11,8 @@ It owns:
|
|
|
11
11
|
- project/session lifecycle
|
|
12
12
|
- revisioned request handling
|
|
13
13
|
- coordinated but non-atomic save semantics
|
|
14
|
-
-
|
|
14
|
+
- browser-safe project sessions
|
|
15
|
+
- adapter-backed file sessions and backend-local advisory locking
|
|
15
16
|
- capability discovery
|
|
16
17
|
- transport-neutral bootstrap
|
|
17
18
|
|
|
@@ -26,9 +27,12 @@ It also provides:
|
|
|
26
27
|
- polling runtime events with per-runtime monotonic sequence and bounded retention
|
|
27
28
|
- `cache.refresh` in-memory jobs with cooperative cancel and terminal retention
|
|
28
29
|
- revision-bound derived read-only cache snapshots
|
|
30
|
+
- explicit Node bridge boundaries for publish/restore
|
|
29
31
|
|
|
30
32
|
It does **not** redefine transaction grammar or expose `Document`.
|
|
31
33
|
It also does **not** implement MCP or any transport-specific wire protocol.
|
|
34
|
+
The root `@openfairygui/backend` entrypoint is browser-safe: file-backed sessions require an injected
|
|
35
|
+
`BackendFileSystem`, while the default Node filesystem/runtime lives under `@openfairygui/backend/node`.
|
|
32
36
|
|
|
33
37
|
## Relationship to other packages
|
|
34
38
|
|
|
@@ -38,16 +42,35 @@ It also does **not** implement MCP or any transport-specific wire protocol.
|
|
|
38
42
|
|
|
39
43
|
## Example
|
|
40
44
|
|
|
45
|
+
Browser-safe project session:
|
|
46
|
+
|
|
41
47
|
```ts
|
|
42
48
|
import { BackendRuntime } from '@openfairygui/backend';
|
|
43
49
|
|
|
44
50
|
const runtime = new BackendRuntime();
|
|
51
|
+
const opened = runtime.openProjectSession({ project: uamProject });
|
|
52
|
+
if (!opened.ok) throw new Error(opened.error.message);
|
|
53
|
+
|
|
54
|
+
const applied = await runtime.applyTransaction({
|
|
55
|
+
sessionId: opened.data.sessionId,
|
|
56
|
+
expectedRevision: opened.data.revision,
|
|
57
|
+
operations,
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Node file-backed session:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { createNodeBackendRuntime } from '@openfairygui/backend/node';
|
|
65
|
+
|
|
66
|
+
const runtime = createNodeBackendRuntime();
|
|
45
67
|
const opened = await runtime.openSession({ projectPath: './MyProject' });
|
|
46
68
|
if (!opened.ok) throw new Error(opened.error.message);
|
|
47
69
|
|
|
48
70
|
const capabilities = runtime.getCapabilities();
|
|
49
71
|
console.log(capabilities.data.runtimeOwner);
|
|
50
72
|
console.log(capabilities.data.contractVersion);
|
|
73
|
+
console.log(capabilities.data.artifact.publishBridge.executionBoundary);
|
|
51
74
|
console.log(capabilities.data.compatibilityPolicy.incompatibleChange);
|
|
52
75
|
|
|
53
76
|
const refresh = runtime.refreshCache({ sessionId: opened.data.sessionId });
|