@openfairygui/backend 0.2.0-alpha.0 → 0.2.0-alpha.1

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/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
- - backend-local advisory locking
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 });