@openfairygui/backend 0.2.0-alpha.8 → 0.2.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/README.md +29 -8
- package/dist/index.cjs +1633 -27
- package/dist/index.d.cts +516 -4
- package/dist/index.d.mts +516 -4
- package/dist/index.mjs +1629 -23
- package/dist/node.cjs +1603 -9
- package/dist/node.d.cts +507 -2
- package/dist/node.d.mts +507 -2
- package/dist/node.mjs +1601 -6
- package/package.json +7 -6
- package/src/index.ts +18 -17
- package/src/node.ts +24 -8
- package/src/runtime/capabilities.ts +126 -0
- package/src/runtime/contracts.ts +518 -0
- package/src/runtime.ts +49 -623
- package/src/services/authoring-service.ts +242 -99
- package/src/services/cache-service.ts +1 -2
- package/src/services/context.ts +17 -8
- package/src/services/event-service.ts +1 -2
- package/src/services/job-service.ts +4 -5
- package/src/services/read-service.ts +1 -2
- package/src/services/runtime-service.ts +133 -27
- package/src/services/session-project-writer.ts +69 -0
- package/src/services/session-utils.ts +6 -3
- package/src/storage.ts +67 -27
- package/dist/runtime-DFatY9W0.mjs +0 -1417
- package/dist/runtime-GKzsXJdO.cjs +0 -1441
- package/dist/runtime-GyNVxAQ0.d.mts +0 -494
- package/dist/runtime-Jec6FcF5.d.cts +0 -494
- package/src/services/snapshot-utils.ts +0 -43
package/dist/node.d.cts
CHANGED
|
@@ -1,8 +1,513 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApplyUamTransactionAppError } from "@openfairygui/functions/uam";
|
|
2
|
+
import { UamProject, UamTransactionOperation } from "@openfairygui/core/uam";
|
|
2
3
|
|
|
4
|
+
//#region src/path-policy.d.ts
|
|
5
|
+
interface PathPolicyViolationError {
|
|
6
|
+
code: 'path_policy_violation';
|
|
7
|
+
message: string;
|
|
8
|
+
policy: 'save_target';
|
|
9
|
+
attemptedPath: string;
|
|
10
|
+
allowedPath: string;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/contracts.d.ts
|
|
14
|
+
declare const BACKEND_CONTRACT_VERSION: "1.1.0-p2";
|
|
15
|
+
declare const BACKEND_CAPABILITY_SCHEMA_VERSION: 2;
|
|
16
|
+
declare const BACKEND_COMPATIBILITY_POLICY: {
|
|
17
|
+
readonly incompatibleChange: "requires contractVersion bump";
|
|
18
|
+
readonly capabilitySchemaChange: "requires capabilitySchemaVersion bump";
|
|
19
|
+
readonly additiveChange: "allowed without breaking existing consumers";
|
|
20
|
+
};
|
|
21
|
+
type BackendStage = 'read' | 'authoring' | 'runtime';
|
|
22
|
+
interface BackendMessage {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
interface BackendDiagnostic {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
severity: 'info' | 'warning' | 'error';
|
|
30
|
+
path?: string;
|
|
31
|
+
nodeKind?: string;
|
|
32
|
+
resourceKind?: string;
|
|
33
|
+
gearKind?: string;
|
|
34
|
+
field?: string;
|
|
35
|
+
operationKind?: string;
|
|
36
|
+
opIndex?: number;
|
|
37
|
+
opId?: string;
|
|
38
|
+
}
|
|
39
|
+
interface BackendResponseMeta {
|
|
40
|
+
requestId: string;
|
|
41
|
+
sessionId?: string;
|
|
42
|
+
revision?: number;
|
|
43
|
+
durationMs: number;
|
|
44
|
+
warnings: BackendMessage[];
|
|
45
|
+
diagnostics: BackendDiagnostic[];
|
|
46
|
+
stage: BackendStage;
|
|
47
|
+
contractVersion: typeof BACKEND_CONTRACT_VERSION;
|
|
48
|
+
capabilitySchemaVersion: typeof BACKEND_CAPABILITY_SCHEMA_VERSION;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/runtime/contracts.d.ts
|
|
52
|
+
/** An exclusive lock owned for the lifetime of one backend session. */
|
|
53
|
+
interface BackendSessionLock {
|
|
54
|
+
/** Persist optional host metadata without changing lock ownership. */
|
|
55
|
+
writeMetadata(content: string): Promise<void>;
|
|
56
|
+
/** Release ownership. Browser implementations must also release when their document terminates. */
|
|
57
|
+
release(): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
interface BackendFileStat {
|
|
60
|
+
isFile(): boolean;
|
|
61
|
+
isDirectory(): boolean;
|
|
62
|
+
}
|
|
63
|
+
interface BackendFileSystem {
|
|
64
|
+
stat(filePath: string): Promise<BackendFileStat>;
|
|
65
|
+
readdir(dirPath: string): Promise<string[]>;
|
|
66
|
+
readFile(filePath: string): Promise<string>;
|
|
67
|
+
readFileRaw(filePath: string): Promise<Uint8Array>;
|
|
68
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
69
|
+
writeFileRaw(filePath: string, data: Uint8Array): Promise<void>;
|
|
70
|
+
mkdir(dirPath: string, options?: {
|
|
71
|
+
recursive?: boolean;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
resolvePath(filePath: string): Promise<string>;
|
|
74
|
+
acquireSessionLock(lockPath: string): Promise<BackendSessionLock>;
|
|
75
|
+
unlink(filePath: string): Promise<void>;
|
|
76
|
+
rmdir(dirPath: string): Promise<void>;
|
|
77
|
+
join(...paths: string[]): string;
|
|
78
|
+
dirname(filePath: string): string;
|
|
79
|
+
resolve(...paths: string[]): string;
|
|
80
|
+
}
|
|
81
|
+
interface BackendHostAdapter {
|
|
82
|
+
lockMetadata?(input: {
|
|
83
|
+
canonicalPathKey: string;
|
|
84
|
+
canonicalProjectPath: string;
|
|
85
|
+
lockFilePath: string;
|
|
86
|
+
}): unknown;
|
|
87
|
+
}
|
|
88
|
+
interface BackendArtifactBridgeCapability {
|
|
89
|
+
available: false;
|
|
90
|
+
requiredHost: 'node';
|
|
91
|
+
executionBoundary: 'external-bridge';
|
|
92
|
+
bridgeEntrypoint: '@openfairygui/backend/node';
|
|
93
|
+
reason: string;
|
|
94
|
+
}
|
|
95
|
+
interface BackendCapabilityManifest {
|
|
96
|
+
browserSafe: true;
|
|
97
|
+
rootEntrypoint: '@openfairygui/backend';
|
|
98
|
+
nodeEntrypoint: '@openfairygui/backend/node';
|
|
99
|
+
adapters: {
|
|
100
|
+
fileSystem: {
|
|
101
|
+
injected: true;
|
|
102
|
+
requiredFor: readonly ['openSession', 'saveSession', 'materializeSession'];
|
|
103
|
+
};
|
|
104
|
+
projectStorage: {
|
|
105
|
+
injected: true;
|
|
106
|
+
browserSafe: true;
|
|
107
|
+
requiredFor: readonly ['openProjectSession.writeback', 'saveSession', 'materializeSession'];
|
|
108
|
+
adapterFactory: 'createBackendStorageFileSystem';
|
|
109
|
+
};
|
|
110
|
+
host: {
|
|
111
|
+
injected: true;
|
|
112
|
+
requiredFor: readonly ['advisoryLockMetadata'];
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
executionBoundaries: {
|
|
116
|
+
projectSession: 'in-process-browser-safe';
|
|
117
|
+
fileBackedSession: 'adapter-backed';
|
|
118
|
+
artifactPublish: BackendArtifactBridgeCapability;
|
|
119
|
+
artifactRestore: BackendArtifactBridgeCapability;
|
|
120
|
+
};
|
|
121
|
+
diagnostics: {
|
|
122
|
+
stableCodes: true;
|
|
123
|
+
errorDiagnosticMirror: true;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface BackendCapabilities {
|
|
127
|
+
contractVersion: typeof BACKEND_CONTRACT_VERSION;
|
|
128
|
+
capabilitySchemaVersion: typeof BACKEND_CAPABILITY_SCHEMA_VERSION;
|
|
129
|
+
transactionKernelOwner: '@openfairygui/core';
|
|
130
|
+
appSeamOwner: '@openfairygui/functions';
|
|
131
|
+
runtimeOwner: '@openfairygui/backend';
|
|
132
|
+
methods: readonly ['getCapabilities', 'openSession', 'openProjectSession', 'getSession', 'applyTransaction', 'saveSession', 'materializeSession', 'closeSession', 'getEvents', 'getJob', 'listJobs', 'cancelJob', 'getCacheSnapshot', 'refreshCache'];
|
|
133
|
+
read: {
|
|
134
|
+
capabilitySnapshot: true;
|
|
135
|
+
sessionSnapshot: true;
|
|
136
|
+
};
|
|
137
|
+
authoring: {
|
|
138
|
+
applyTransaction: true;
|
|
139
|
+
saveSession: true;
|
|
140
|
+
resourceKinds: readonly string[];
|
|
141
|
+
nodeKinds: readonly string[];
|
|
142
|
+
gearKinds: readonly string[];
|
|
143
|
+
transactionScope: {
|
|
144
|
+
resourceKinds: readonly string[];
|
|
145
|
+
nodeKinds: readonly string[];
|
|
146
|
+
gearKinds: readonly string[];
|
|
147
|
+
};
|
|
148
|
+
unsupported: readonly ['artifact.publish', 'artifact.restore'];
|
|
149
|
+
};
|
|
150
|
+
artifact: {
|
|
151
|
+
publish: false;
|
|
152
|
+
restore: false;
|
|
153
|
+
status: 'bridge-required';
|
|
154
|
+
publishBridge: BackendArtifactBridgeCapability;
|
|
155
|
+
restoreBridge: BackendArtifactBridgeCapability;
|
|
156
|
+
};
|
|
157
|
+
manifest: BackendCapabilityManifest;
|
|
158
|
+
compatibilityPolicy: typeof BACKEND_COMPATIBILITY_POLICY;
|
|
159
|
+
runtime: {
|
|
160
|
+
sessionRuntime: true;
|
|
161
|
+
advisoryLocking: true;
|
|
162
|
+
coordinatedSave: true;
|
|
163
|
+
atomicSave: false;
|
|
164
|
+
staleRevisionProtection: true;
|
|
165
|
+
pathPolicy: {
|
|
166
|
+
canonicalization: 'realpath+normalized-casefold';
|
|
167
|
+
sessionIdentity: 'project-root';
|
|
168
|
+
saveTarget: 'opened-project-only';
|
|
169
|
+
outputTargets: 'deferred';
|
|
170
|
+
workspaceBoundary: 'project-root-only';
|
|
171
|
+
};
|
|
172
|
+
events: {
|
|
173
|
+
polling: true;
|
|
174
|
+
subscriptions: false;
|
|
175
|
+
retentionLimit: 1000;
|
|
176
|
+
sequenceScope: 'runtime';
|
|
177
|
+
};
|
|
178
|
+
jobs: {
|
|
179
|
+
inMemory: true;
|
|
180
|
+
cooperativeCancel: true;
|
|
181
|
+
persistent: false;
|
|
182
|
+
supportedKinds: readonly ['cache.refresh'];
|
|
183
|
+
artifactJobs: false;
|
|
184
|
+
completedRetentionLimit: 100;
|
|
185
|
+
};
|
|
186
|
+
cache: {
|
|
187
|
+
derivedReadOnly: true;
|
|
188
|
+
keyedBy: 'canonicalPathKey';
|
|
189
|
+
sourceOfTruth: false;
|
|
190
|
+
refreshMethod: 'refreshCache';
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
interface BackendSessionSnapshot {
|
|
195
|
+
sessionId: string;
|
|
196
|
+
canonicalProjectPath: string;
|
|
197
|
+
revision: number;
|
|
198
|
+
lastSavedRevision: number;
|
|
199
|
+
dirty: boolean;
|
|
200
|
+
uamFidelity: 'full' | 'unsupported';
|
|
201
|
+
lockHeld: boolean;
|
|
202
|
+
capabilities: BackendCapabilities;
|
|
203
|
+
}
|
|
204
|
+
interface MaterializeSessionSnapshot extends BackendSessionSnapshot {
|
|
205
|
+
mode: 'fullProject';
|
|
206
|
+
reason?: string;
|
|
207
|
+
materializeRevision: number;
|
|
208
|
+
saveRevision: number;
|
|
209
|
+
writtenPaths: string[];
|
|
210
|
+
skippedPaths: string[];
|
|
211
|
+
diagnostics: BackendDiagnostic[];
|
|
212
|
+
}
|
|
213
|
+
interface BackendSuccess<T> {
|
|
214
|
+
ok: true;
|
|
215
|
+
meta: BackendResponseMeta;
|
|
216
|
+
data: T;
|
|
217
|
+
}
|
|
218
|
+
interface BackendFailure<E extends BackendError = BackendError> {
|
|
219
|
+
ok: false;
|
|
220
|
+
meta: BackendResponseMeta;
|
|
221
|
+
error: E;
|
|
222
|
+
session?: BackendSessionSnapshot;
|
|
223
|
+
}
|
|
224
|
+
type BackendResult<T, E extends BackendError = BackendError> = BackendSuccess<T> | BackendFailure<E>;
|
|
225
|
+
interface SessionNotFoundError {
|
|
226
|
+
code: 'session_not_found';
|
|
227
|
+
message: string;
|
|
228
|
+
sessionId: string;
|
|
229
|
+
}
|
|
230
|
+
interface SessionStaleWriteError {
|
|
231
|
+
code: 'stale_write';
|
|
232
|
+
message: string;
|
|
233
|
+
sessionId: string;
|
|
234
|
+
canonicalPathKey: string;
|
|
235
|
+
expectedRevision: number;
|
|
236
|
+
actualRevision: number;
|
|
237
|
+
}
|
|
238
|
+
interface InProcessLockConflictError {
|
|
239
|
+
code: 'lock_conflict';
|
|
240
|
+
kind: 'in_process_session_exists';
|
|
241
|
+
message: string;
|
|
242
|
+
canonicalPathKey: string;
|
|
243
|
+
holderSessionId: string;
|
|
244
|
+
lockFilePath?: string;
|
|
245
|
+
}
|
|
246
|
+
interface AdvisoryLockConflictError {
|
|
247
|
+
code: 'lock_conflict';
|
|
248
|
+
kind: 'advisory_lock_conflict';
|
|
249
|
+
message: string;
|
|
250
|
+
canonicalPathKey: string;
|
|
251
|
+
holderSessionId?: string;
|
|
252
|
+
lockFilePath: string;
|
|
253
|
+
}
|
|
254
|
+
interface SavePartialFailureError {
|
|
255
|
+
code: 'save_partial_failure';
|
|
256
|
+
message: string;
|
|
257
|
+
sessionId: string;
|
|
258
|
+
canonicalPathKey: string;
|
|
259
|
+
attemptedRevision: number;
|
|
260
|
+
lastSavedRevision: number;
|
|
261
|
+
committedPaths: string[];
|
|
262
|
+
failedPaths: string[];
|
|
263
|
+
diskMayBePartiallyUpdated: true;
|
|
264
|
+
}
|
|
265
|
+
interface UamFidelityUnsupportedError {
|
|
266
|
+
code: 'uam_fidelity_unsupported';
|
|
267
|
+
message: string;
|
|
268
|
+
sessionId: string;
|
|
269
|
+
canonicalPathKey: string;
|
|
270
|
+
}
|
|
271
|
+
interface MaterializeValidationFailedError {
|
|
272
|
+
code: 'materialize_validation_failed';
|
|
273
|
+
message: string;
|
|
274
|
+
sessionId: string;
|
|
275
|
+
canonicalPathKey: string;
|
|
276
|
+
issueCount: number;
|
|
277
|
+
diagnostics: BackendDiagnostic[];
|
|
278
|
+
}
|
|
279
|
+
interface MaterializeWriteFailedError {
|
|
280
|
+
code: 'write_failed';
|
|
281
|
+
message: string;
|
|
282
|
+
sessionId: string;
|
|
283
|
+
canonicalPathKey: string;
|
|
284
|
+
attemptedRevision: number;
|
|
285
|
+
lastSavedRevision: number;
|
|
286
|
+
writtenPaths: string[];
|
|
287
|
+
failedPaths: string[];
|
|
288
|
+
skippedPaths: string[];
|
|
289
|
+
diagnostics: BackendDiagnostic[];
|
|
290
|
+
diskMayBePartiallyUpdated: true;
|
|
291
|
+
}
|
|
292
|
+
type BackendEventKind = 'session.opened' | 'transaction.applied' | 'transaction.rejected' | 'save.started' | 'save.completed' | 'save.failed' | 'session.closeRequested' | 'session.closed' | 'cache.invalidated' | 'cache.updated' | 'job.created' | 'job.started' | 'job.progress' | 'job.cancelRequested' | 'job.cancelled' | 'job.completed' | 'job.failed';
|
|
293
|
+
interface BackendEvent {
|
|
294
|
+
sequence: number;
|
|
295
|
+
kind: BackendEventKind;
|
|
296
|
+
timestamp: string;
|
|
297
|
+
sessionId?: string;
|
|
298
|
+
canonicalPathKey?: string;
|
|
299
|
+
revision?: number;
|
|
300
|
+
cacheRevision?: number;
|
|
301
|
+
jobId?: string;
|
|
302
|
+
diagnostics: BackendDiagnostic[];
|
|
303
|
+
payload?: unknown;
|
|
304
|
+
}
|
|
305
|
+
interface GetEventsInput {
|
|
306
|
+
sessionId: string;
|
|
307
|
+
after?: string;
|
|
308
|
+
limit?: number;
|
|
309
|
+
}
|
|
310
|
+
interface GetEventsSnapshot {
|
|
311
|
+
events: BackendEvent[];
|
|
312
|
+
oldestSequence: number;
|
|
313
|
+
currentSequence: number;
|
|
314
|
+
cursorExpired: boolean;
|
|
315
|
+
}
|
|
316
|
+
interface EventCursorInvalidError {
|
|
317
|
+
code: 'event_cursor_invalid';
|
|
318
|
+
message: string;
|
|
319
|
+
sessionId: string;
|
|
320
|
+
after: string;
|
|
321
|
+
}
|
|
322
|
+
type BackendJobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
323
|
+
type BackendJobKind = 'cache.refresh';
|
|
324
|
+
type BackendJobListStatusFilter = BackendJobStatus | 'active' | 'terminal';
|
|
325
|
+
interface BackendJobProgress {
|
|
326
|
+
completed: number;
|
|
327
|
+
total?: number;
|
|
328
|
+
message?: string;
|
|
329
|
+
}
|
|
330
|
+
interface BackendJobSnapshot {
|
|
331
|
+
jobId: string;
|
|
332
|
+
kind: BackendJobKind;
|
|
333
|
+
status: BackendJobStatus;
|
|
334
|
+
createdAt: string;
|
|
335
|
+
startedAt?: string;
|
|
336
|
+
finishedAt?: string;
|
|
337
|
+
sessionId?: string;
|
|
338
|
+
canonicalPathKey?: string;
|
|
339
|
+
revision?: number;
|
|
340
|
+
cacheRevision?: number;
|
|
341
|
+
diagnostics: BackendDiagnostic[];
|
|
342
|
+
progress?: BackendJobProgress;
|
|
343
|
+
result?: unknown;
|
|
344
|
+
error?: BackendError;
|
|
345
|
+
}
|
|
346
|
+
interface BackendJobListSnapshot {
|
|
347
|
+
jobs: BackendJobSnapshot[];
|
|
348
|
+
}
|
|
349
|
+
interface GetJobInput {
|
|
350
|
+
sessionId: string;
|
|
351
|
+
jobId: string;
|
|
352
|
+
}
|
|
353
|
+
interface ListJobsInput {
|
|
354
|
+
sessionId: string;
|
|
355
|
+
status?: BackendJobListStatusFilter;
|
|
356
|
+
kind?: BackendJobKind;
|
|
357
|
+
limit?: number;
|
|
358
|
+
}
|
|
359
|
+
interface CancelJobInput {
|
|
360
|
+
sessionId: string;
|
|
361
|
+
jobId: string;
|
|
362
|
+
}
|
|
363
|
+
interface BackendJobNotFoundError {
|
|
364
|
+
code: 'job_not_found';
|
|
365
|
+
message: string;
|
|
366
|
+
sessionId: string;
|
|
367
|
+
jobId: string;
|
|
368
|
+
}
|
|
369
|
+
interface BackendJobNotCancellableError {
|
|
370
|
+
code: 'job_not_cancellable';
|
|
371
|
+
message: string;
|
|
372
|
+
sessionId: string;
|
|
373
|
+
jobId: string;
|
|
374
|
+
status: 'completed' | 'failed' | 'cancelled';
|
|
375
|
+
}
|
|
376
|
+
interface BackendJobCancelledError {
|
|
377
|
+
code: 'job_cancelled';
|
|
378
|
+
message: string;
|
|
379
|
+
sessionId: string;
|
|
380
|
+
jobId: string;
|
|
381
|
+
}
|
|
382
|
+
interface CacheRefreshFailedError {
|
|
383
|
+
code: 'cache_refresh_failed';
|
|
384
|
+
message: string;
|
|
385
|
+
sessionId: string;
|
|
386
|
+
jobId: string;
|
|
387
|
+
causeCode?: string;
|
|
388
|
+
}
|
|
389
|
+
interface BackendCapabilityUnavailableError {
|
|
390
|
+
code: 'capability_unavailable';
|
|
391
|
+
message: string;
|
|
392
|
+
capability: 'fileSystem' | 'artifact.publish' | 'artifact.restore';
|
|
393
|
+
requiredAdapter?: 'BackendFileSystem';
|
|
394
|
+
requiredHost?: 'node';
|
|
395
|
+
bridgeBoundary?: 'external-bridge';
|
|
396
|
+
}
|
|
397
|
+
interface BackendCacheSnapshot {
|
|
398
|
+
cacheRevision: number;
|
|
399
|
+
entries: BackendCacheEntry[];
|
|
400
|
+
}
|
|
401
|
+
interface BackendCacheEntry {
|
|
402
|
+
canonicalPathKey: string;
|
|
403
|
+
sessionId?: string;
|
|
404
|
+
revision: number;
|
|
405
|
+
lastSavedRevision: number;
|
|
406
|
+
dirty: boolean;
|
|
407
|
+
valid: boolean;
|
|
408
|
+
indexedAt: string;
|
|
409
|
+
summary: {
|
|
410
|
+
resourceCount: number;
|
|
411
|
+
packageCount?: number;
|
|
412
|
+
diagnostics: BackendDiagnostic[];
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
interface GetCacheSnapshotInput {
|
|
416
|
+
sessionId: string;
|
|
417
|
+
}
|
|
418
|
+
interface RefreshCacheInput {
|
|
419
|
+
sessionId: string;
|
|
420
|
+
reason?: 'manual' | 'session_open' | 'after_save';
|
|
421
|
+
}
|
|
422
|
+
type BackendError = SessionNotFoundError | SessionStaleWriteError | InProcessLockConflictError | AdvisoryLockConflictError | SavePartialFailureError | UamFidelityUnsupportedError | MaterializeValidationFailedError | MaterializeWriteFailedError | PathPolicyViolationError | EventCursorInvalidError | BackendJobNotFoundError | BackendJobNotCancellableError | BackendJobCancelledError | CacheRefreshFailedError | BackendCapabilityUnavailableError | ApplyUamTransactionAppError;
|
|
423
|
+
interface ApplySessionTransactionInput {
|
|
424
|
+
sessionId: string;
|
|
425
|
+
expectedRevision: number;
|
|
426
|
+
operations: UamTransactionOperation[];
|
|
427
|
+
}
|
|
428
|
+
interface OpenProjectSessionInput {
|
|
429
|
+
/** Authoritative UAM project. Use BackendRuntime.openSession() when importing an existing project from storage. */
|
|
430
|
+
project: UamProject;
|
|
431
|
+
sessionId?: string;
|
|
432
|
+
canonicalProjectPath?: string;
|
|
433
|
+
canonicalPathKey?: string;
|
|
434
|
+
/** Optional writeback target for the authoritative UAM project; this is not an import source. */
|
|
435
|
+
storage?: BackendProjectSessionStorage;
|
|
436
|
+
}
|
|
437
|
+
interface BackendProjectSessionStorage {
|
|
438
|
+
fileSystem: BackendFileSystem;
|
|
439
|
+
fairyPath: string;
|
|
440
|
+
canonicalProjectPath?: string;
|
|
441
|
+
canonicalPathKey?: string;
|
|
442
|
+
}
|
|
443
|
+
interface SaveSessionInput {
|
|
444
|
+
sessionId: string;
|
|
445
|
+
expectedRevision?: number;
|
|
446
|
+
targetPath?: string;
|
|
447
|
+
fileSystem?: BackendFileSystem;
|
|
448
|
+
force?: boolean;
|
|
449
|
+
mode?: 'materializeCleanSession';
|
|
450
|
+
}
|
|
451
|
+
interface MaterializeSessionInput {
|
|
452
|
+
sessionId: string;
|
|
453
|
+
expectedRevision?: number;
|
|
454
|
+
storage?: BackendProjectSessionStorage;
|
|
455
|
+
targetPath?: string;
|
|
456
|
+
fileSystem?: BackendFileSystem;
|
|
457
|
+
mode?: 'fullProject';
|
|
458
|
+
reason?: string;
|
|
459
|
+
}
|
|
460
|
+
interface BackendRuntimeOptions {
|
|
461
|
+
fileSystem?: BackendFileSystem;
|
|
462
|
+
host?: BackendHostAdapter;
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/runtime.d.ts
|
|
466
|
+
declare class BackendRuntime {
|
|
467
|
+
private readonly fileSystem?;
|
|
468
|
+
private readonly capabilities;
|
|
469
|
+
private readonly sessions;
|
|
470
|
+
private readonly sessionsByPath;
|
|
471
|
+
private readonly eventsBySession;
|
|
472
|
+
private readonly jobsBySession;
|
|
473
|
+
private readonly cacheBySession;
|
|
474
|
+
private eventSequence;
|
|
475
|
+
private readonly context;
|
|
476
|
+
private readonly readService;
|
|
477
|
+
private readonly runtimeService;
|
|
478
|
+
private readonly authoringService;
|
|
479
|
+
private readonly cacheService;
|
|
480
|
+
private readonly eventService;
|
|
481
|
+
private readonly jobService;
|
|
482
|
+
constructor(options?: BackendRuntimeOptions);
|
|
483
|
+
getCapabilities(): BackendSuccess<BackendCapabilities>;
|
|
484
|
+
openSession(input: {
|
|
485
|
+
projectPath: string;
|
|
486
|
+
}): Promise<BackendResult<BackendSessionSnapshot, InProcessLockConflictError | AdvisoryLockConflictError | BackendCapabilityUnavailableError>>;
|
|
487
|
+
openProjectSession(input: OpenProjectSessionInput): BackendResult<BackendSessionSnapshot>;
|
|
488
|
+
getSession(input: {
|
|
489
|
+
sessionId: string;
|
|
490
|
+
}): BackendResult<BackendSessionSnapshot, SessionNotFoundError>;
|
|
491
|
+
applyTransaction(input: ApplySessionTransactionInput): Promise<BackendResult<BackendSessionSnapshot, SessionNotFoundError | SessionStaleWriteError | ApplyUamTransactionAppError>>;
|
|
492
|
+
saveSession(input: SaveSessionInput): Promise<BackendResult<BackendSessionSnapshot | MaterializeSessionSnapshot, SessionNotFoundError | SessionStaleWriteError | SavePartialFailureError | UamFidelityUnsupportedError | MaterializeValidationFailedError | MaterializeWriteFailedError | PathPolicyViolationError | InProcessLockConflictError | BackendCapabilityUnavailableError>>;
|
|
493
|
+
materializeSession(input: MaterializeSessionInput): Promise<BackendResult<MaterializeSessionSnapshot, SessionNotFoundError | SessionStaleWriteError | UamFidelityUnsupportedError | MaterializeValidationFailedError | MaterializeWriteFailedError | PathPolicyViolationError | InProcessLockConflictError | BackendCapabilityUnavailableError>>;
|
|
494
|
+
closeSession(input: {
|
|
495
|
+
sessionId: string;
|
|
496
|
+
}): Promise<BackendResult<{
|
|
497
|
+
sessionId: string;
|
|
498
|
+
closed: true;
|
|
499
|
+
}, SessionNotFoundError>>;
|
|
500
|
+
getEvents(input: GetEventsInput): BackendResult<GetEventsSnapshot, SessionNotFoundError | EventCursorInvalidError>;
|
|
501
|
+
getJob(input: GetJobInput): BackendResult<BackendJobSnapshot, SessionNotFoundError | BackendJobNotFoundError>;
|
|
502
|
+
listJobs(input: ListJobsInput): BackendResult<BackendJobListSnapshot, SessionNotFoundError>;
|
|
503
|
+
cancelJob(input: CancelJobInput): BackendResult<BackendJobSnapshot, SessionNotFoundError | BackendJobNotFoundError | BackendJobNotCancellableError>;
|
|
504
|
+
getCacheSnapshot(input: GetCacheSnapshotInput): BackendResult<BackendCacheSnapshot, SessionNotFoundError>;
|
|
505
|
+
refreshCache(input: RefreshCacheInput): BackendResult<BackendJobSnapshot, SessionNotFoundError>;
|
|
506
|
+
}
|
|
507
|
+
//#endregion
|
|
3
508
|
//#region src/node.d.ts
|
|
4
509
|
declare function createNodeBackendFileSystem(): BackendFileSystem;
|
|
5
510
|
declare function createNodeBackendHostAdapter(): BackendHostAdapter;
|
|
6
511
|
declare function createNodeBackendRuntime(options?: BackendRuntimeOptions): BackendRuntime;
|
|
7
512
|
//#endregion
|
|
8
|
-
export { type
|
|
513
|
+
export { type BackendFileStat, type BackendFileSystem, type BackendHostAdapter, BackendRuntime, type BackendRuntimeOptions, type BackendSessionLock, createNodeBackendFileSystem, createNodeBackendHostAdapter, createNodeBackendRuntime };
|