@openfairygui/backend 0.2.0-alpha.4 → 0.2.0-alpha.6

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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_runtime = require("./runtime-jKuQmcqM.cjs");
2
+ const require_runtime = require("./runtime--ytGfQCF.cjs");
3
3
  exports.BACKEND_CAPABILITY_SCHEMA_VERSION = require_runtime.BACKEND_CAPABILITY_SCHEMA_VERSION;
4
4
  exports.BACKEND_COMPATIBILITY_POLICY = require_runtime.BACKEND_COMPATIBILITY_POLICY;
5
5
  exports.BACKEND_CONTRACT_VERSION = require_runtime.BACKEND_CONTRACT_VERSION;
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as BackendSuccess, B as OpenProjectSessionInput, C as BackendJobProgress, D as BackendRuntime, E as BackendResult, F as GetEventsInput, G as BACKEND_CAPABILITY_SCHEMA_VERSION, H as SavePartialFailureError, I as GetEventsSnapshot, J as BackendDiagnostic, K as BACKEND_COMPATIBILITY_POLICY, L as GetJobInput, M as CancelJobInput, N as EventCursorInvalidError, O as BackendRuntimeOptions, P as GetCacheSnapshotInput, R as InProcessLockConflictError, S as BackendJobNotFoundError, T as BackendJobStatus, U as SessionNotFoundError, V as RefreshCacheInput, W as SessionStaleWriteError, X as BackendResponseMeta, Y as BackendMessage, Z as BackendStage, _ as BackendJobErrors, a as BackendCacheSnapshot, b as BackendJobListStatusFilter, c as BackendCapabilityUnavailableError, d as BackendEventKind, f as BackendFailure, g as BackendHostAdapter, h as BackendFileSystem, i as BackendCacheEntry, j as CacheRefreshFailedError, k as BackendSessionSnapshot, l as BackendError, m as BackendFileStat, n as ApplySessionTransactionInput, o as BackendCapabilities, p as BackendFileHandle, q as BACKEND_CONTRACT_VERSION, r as BackendArtifactBridgeCapability, s as BackendCapabilityManifest, t as AdvisoryLockConflictError, u as BackendEvent, v as BackendJobKind, w as BackendJobSnapshot, x as BackendJobNotCancellableError, y as BackendJobListSnapshot, z as ListJobsInput } from "./runtime-IrXqqmko.cjs";
1
+ import { A as BackendSuccess, B as OpenProjectSessionInput, C as BackendJobProgress, D as BackendRuntime, E as BackendResult, F as GetEventsInput, G as BACKEND_CAPABILITY_SCHEMA_VERSION, H as SavePartialFailureError, I as GetEventsSnapshot, J as BackendDiagnostic, K as BACKEND_COMPATIBILITY_POLICY, L as GetJobInput, M as CancelJobInput, N as EventCursorInvalidError, O as BackendRuntimeOptions, P as GetCacheSnapshotInput, R as InProcessLockConflictError, S as BackendJobNotFoundError, T as BackendJobStatus, U as SessionNotFoundError, V as RefreshCacheInput, W as SessionStaleWriteError, X as BackendResponseMeta, Y as BackendMessage, Z as BackendStage, _ as BackendJobErrors, a as BackendCacheSnapshot, b as BackendJobListStatusFilter, c as BackendCapabilityUnavailableError, d as BackendEventKind, f as BackendFailure, g as BackendHostAdapter, h as BackendFileSystem, i as BackendCacheEntry, j as CacheRefreshFailedError, k as BackendSessionSnapshot, l as BackendError, m as BackendFileStat, n as ApplySessionTransactionInput, o as BackendCapabilities, p as BackendFileHandle, q as BACKEND_CONTRACT_VERSION, r as BackendArtifactBridgeCapability, s as BackendCapabilityManifest, t as AdvisoryLockConflictError, u as BackendEvent, v as BackendJobKind, w as BackendJobSnapshot, x as BackendJobNotCancellableError, y as BackendJobListSnapshot, z as ListJobsInput } from "./runtime-DlM27Izm.cjs";
2
2
  export { type AdvisoryLockConflictError, type ApplySessionTransactionInput, BACKEND_CAPABILITY_SCHEMA_VERSION, BACKEND_COMPATIBILITY_POLICY, BACKEND_CONTRACT_VERSION, type BackendArtifactBridgeCapability, type BackendCacheEntry, type BackendCacheSnapshot, type BackendCapabilities, type BackendCapabilityManifest, type BackendCapabilityUnavailableError, type BackendDiagnostic, type BackendError, type BackendEvent, type BackendEventKind, type BackendFailure, type BackendFileHandle, type BackendFileStat, type BackendFileSystem, type BackendHostAdapter, type BackendJobErrors, type BackendJobKind, type BackendJobListSnapshot, type BackendJobListStatusFilter, type BackendJobNotCancellableError, type BackendJobNotFoundError, type BackendJobProgress, type BackendJobSnapshot, type BackendJobStatus, type BackendMessage, type BackendResponseMeta, type BackendResult, BackendRuntime, type BackendRuntimeOptions, type BackendSessionSnapshot, type BackendStage, type BackendSuccess, type CacheRefreshFailedError, type CancelJobInput, type EventCursorInvalidError, type GetCacheSnapshotInput, type GetEventsInput, type GetEventsSnapshot, type GetJobInput, type InProcessLockConflictError, type ListJobsInput, type OpenProjectSessionInput, type RefreshCacheInput, type SavePartialFailureError, type SessionNotFoundError, type SessionStaleWriteError };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as BackendSuccess, B as OpenProjectSessionInput, C as BackendJobProgress, D as BackendRuntime, E as BackendResult, F as GetEventsInput, G as BACKEND_CAPABILITY_SCHEMA_VERSION, H as SavePartialFailureError, I as GetEventsSnapshot, J as BackendDiagnostic, K as BACKEND_COMPATIBILITY_POLICY, L as GetJobInput, M as CancelJobInput, N as EventCursorInvalidError, O as BackendRuntimeOptions, P as GetCacheSnapshotInput, R as InProcessLockConflictError, S as BackendJobNotFoundError, T as BackendJobStatus, U as SessionNotFoundError, V as RefreshCacheInput, W as SessionStaleWriteError, X as BackendResponseMeta, Y as BackendMessage, Z as BackendStage, _ as BackendJobErrors, a as BackendCacheSnapshot, b as BackendJobListStatusFilter, c as BackendCapabilityUnavailableError, d as BackendEventKind, f as BackendFailure, g as BackendHostAdapter, h as BackendFileSystem, i as BackendCacheEntry, j as CacheRefreshFailedError, k as BackendSessionSnapshot, l as BackendError, m as BackendFileStat, n as ApplySessionTransactionInput, o as BackendCapabilities, p as BackendFileHandle, q as BACKEND_CONTRACT_VERSION, r as BackendArtifactBridgeCapability, s as BackendCapabilityManifest, t as AdvisoryLockConflictError, u as BackendEvent, v as BackendJobKind, w as BackendJobSnapshot, x as BackendJobNotCancellableError, y as BackendJobListSnapshot, z as ListJobsInput } from "./runtime-u1Bq_ysz.mjs";
1
+ import { A as BackendSuccess, B as OpenProjectSessionInput, C as BackendJobProgress, D as BackendRuntime, E as BackendResult, F as GetEventsInput, G as BACKEND_CAPABILITY_SCHEMA_VERSION, H as SavePartialFailureError, I as GetEventsSnapshot, J as BackendDiagnostic, K as BACKEND_COMPATIBILITY_POLICY, L as GetJobInput, M as CancelJobInput, N as EventCursorInvalidError, O as BackendRuntimeOptions, P as GetCacheSnapshotInput, R as InProcessLockConflictError, S as BackendJobNotFoundError, T as BackendJobStatus, U as SessionNotFoundError, V as RefreshCacheInput, W as SessionStaleWriteError, X as BackendResponseMeta, Y as BackendMessage, Z as BackendStage, _ as BackendJobErrors, a as BackendCacheSnapshot, b as BackendJobListStatusFilter, c as BackendCapabilityUnavailableError, d as BackendEventKind, f as BackendFailure, g as BackendHostAdapter, h as BackendFileSystem, i as BackendCacheEntry, j as CacheRefreshFailedError, k as BackendSessionSnapshot, l as BackendError, m as BackendFileStat, n as ApplySessionTransactionInput, o as BackendCapabilities, p as BackendFileHandle, q as BACKEND_CONTRACT_VERSION, r as BackendArtifactBridgeCapability, s as BackendCapabilityManifest, t as AdvisoryLockConflictError, u as BackendEvent, v as BackendJobKind, w as BackendJobSnapshot, x as BackendJobNotCancellableError, y as BackendJobListSnapshot, z as ListJobsInput } from "./runtime-BPuZITUC.mjs";
2
2
  export { type AdvisoryLockConflictError, type ApplySessionTransactionInput, BACKEND_CAPABILITY_SCHEMA_VERSION, BACKEND_COMPATIBILITY_POLICY, BACKEND_CONTRACT_VERSION, type BackendArtifactBridgeCapability, type BackendCacheEntry, type BackendCacheSnapshot, type BackendCapabilities, type BackendCapabilityManifest, type BackendCapabilityUnavailableError, type BackendDiagnostic, type BackendError, type BackendEvent, type BackendEventKind, type BackendFailure, type BackendFileHandle, type BackendFileStat, type BackendFileSystem, type BackendHostAdapter, type BackendJobErrors, type BackendJobKind, type BackendJobListSnapshot, type BackendJobListStatusFilter, type BackendJobNotCancellableError, type BackendJobNotFoundError, type BackendJobProgress, type BackendJobSnapshot, type BackendJobStatus, type BackendMessage, type BackendResponseMeta, type BackendResult, BackendRuntime, type BackendRuntimeOptions, type BackendSessionSnapshot, type BackendStage, type BackendSuccess, type CacheRefreshFailedError, type CancelJobInput, type EventCursorInvalidError, type GetCacheSnapshotInput, type GetEventsInput, type GetEventsSnapshot, type GetJobInput, type InProcessLockConflictError, type ListJobsInput, type OpenProjectSessionInput, type RefreshCacheInput, type SavePartialFailureError, type SessionNotFoundError, type SessionStaleWriteError };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as BACKEND_CONTRACT_VERSION, n as BACKEND_CAPABILITY_SCHEMA_VERSION, r as BACKEND_COMPATIBILITY_POLICY, t as BackendRuntime } from "./runtime-BG5qOVkJ.mjs";
1
+ import { i as BACKEND_CONTRACT_VERSION, n as BACKEND_CAPABILITY_SCHEMA_VERSION, r as BACKEND_COMPATIBILITY_POLICY, t as BackendRuntime } from "./runtime-CqARWlcn.mjs";
2
2
  export { BACKEND_CAPABILITY_SCHEMA_VERSION, BACKEND_COMPATIBILITY_POLICY, BACKEND_CONTRACT_VERSION, BackendRuntime };
package/dist/node.cjs CHANGED
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_runtime = require("./runtime-jKuQmcqM.cjs");
24
+ const require_runtime = require("./runtime--ytGfQCF.cjs");
25
25
  let node_fs_promises = require("node:fs/promises");
26
26
  node_fs_promises = __toESM(node_fs_promises);
27
27
  let node_path = require("node:path");
package/dist/node.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { D as BackendRuntime, O as BackendRuntimeOptions, g as BackendHostAdapter, h as BackendFileSystem, m as BackendFileStat, p as BackendFileHandle } from "./runtime-IrXqqmko.cjs";
1
+ import { D as BackendRuntime, O as BackendRuntimeOptions, g as BackendHostAdapter, h as BackendFileSystem, m as BackendFileStat, p as BackendFileHandle } from "./runtime-DlM27Izm.cjs";
2
2
 
3
3
  //#region src/node.d.ts
4
4
  declare function createNodeBackendFileSystem(): BackendFileSystem;
package/dist/node.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { D as BackendRuntime, O as BackendRuntimeOptions, g as BackendHostAdapter, h as BackendFileSystem, m as BackendFileStat, p as BackendFileHandle } from "./runtime-u1Bq_ysz.mjs";
1
+ import { D as BackendRuntime, O as BackendRuntimeOptions, g as BackendHostAdapter, h as BackendFileSystem, m as BackendFileStat, p as BackendFileHandle } from "./runtime-BPuZITUC.mjs";
2
2
 
3
3
  //#region src/node.d.ts
4
4
  declare function createNodeBackendFileSystem(): BackendFileSystem;
package/dist/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as BackendRuntime } from "./runtime-BG5qOVkJ.mjs";
1
+ import { t as BackendRuntime } from "./runtime-CqARWlcn.mjs";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  //#region src/node.ts
@@ -255,6 +255,16 @@ function createWriterFileSystem(fileSystem, committedPaths, failedPaths) {
255
255
  }
256
256
  };
257
257
  }
258
+ function toBackendDiagnostics(error) {
259
+ return error.diagnostics.length > 0 ? error.diagnostics.map((diagnostic) => ({ ...diagnostic })) : [{
260
+ code: error.code,
261
+ message: error.message,
262
+ severity: "error",
263
+ operationKind: error.operationKind,
264
+ opIndex: error.opIndex,
265
+ opId: error.opId
266
+ }];
267
+ }
258
268
  var AuthoringService = class {
259
269
  constructor(context, cacheService, eventService) {
260
270
  this.context = context;
@@ -282,20 +292,18 @@ var AuthoringService = class {
282
292
  operations: input.operations
283
293
  });
284
294
  if (result.ok === false) {
295
+ const diagnostics = toBackendDiagnostics(result.error);
285
296
  this.eventService.emit({
286
297
  kind: "transaction.rejected",
287
298
  sessionId: session.sessionId,
288
299
  canonicalPathKey: session.canonicalPathKey,
289
300
  revision: session.revision,
290
- diagnostics: result.error.issues?.map((issue) => ({
291
- code: result.error.code,
292
- message: issue.message,
293
- severity: "error"
294
- })) ?? []
301
+ diagnostics
295
302
  });
296
303
  return failure("authoring", startedAt, result.error, toSessionSnapshot(session, this.context.capabilities), {
297
304
  sessionId: session.sessionId,
298
- revision: session.revision
305
+ revision: session.revision,
306
+ diagnostics
299
307
  });
300
308
  }
301
309
  session.project = result.project;
@@ -18,6 +18,14 @@ interface BackendDiagnostic {
18
18
  code: string;
19
19
  message: string;
20
20
  severity: 'info' | 'warning' | 'error';
21
+ path?: string;
22
+ nodeKind?: string;
23
+ resourceKind?: string;
24
+ gearKind?: string;
25
+ field?: string;
26
+ operationKind?: string;
27
+ opIndex?: number;
28
+ opId?: string;
21
29
  }
22
30
  interface BackendResponseMeta {
23
31
  requestId: string;
@@ -254,6 +254,16 @@ function createWriterFileSystem(fileSystem, committedPaths, failedPaths) {
254
254
  }
255
255
  };
256
256
  }
257
+ function toBackendDiagnostics(error) {
258
+ return error.diagnostics.length > 0 ? error.diagnostics.map((diagnostic) => ({ ...diagnostic })) : [{
259
+ code: error.code,
260
+ message: error.message,
261
+ severity: "error",
262
+ operationKind: error.operationKind,
263
+ opIndex: error.opIndex,
264
+ opId: error.opId
265
+ }];
266
+ }
257
267
  var AuthoringService = class {
258
268
  constructor(context, cacheService, eventService) {
259
269
  this.context = context;
@@ -281,20 +291,18 @@ var AuthoringService = class {
281
291
  operations: input.operations
282
292
  });
283
293
  if (result.ok === false) {
294
+ const diagnostics = toBackendDiagnostics(result.error);
284
295
  this.eventService.emit({
285
296
  kind: "transaction.rejected",
286
297
  sessionId: session.sessionId,
287
298
  canonicalPathKey: session.canonicalPathKey,
288
299
  revision: session.revision,
289
- diagnostics: result.error.issues?.map((issue) => ({
290
- code: result.error.code,
291
- message: issue.message,
292
- severity: "error"
293
- })) ?? []
300
+ diagnostics
294
301
  });
295
302
  return failure("authoring", startedAt, result.error, toSessionSnapshot(session, this.context.capabilities), {
296
303
  sessionId: session.sessionId,
297
- revision: session.revision
304
+ revision: session.revision,
305
+ diagnostics
298
306
  });
299
307
  }
300
308
  session.project = result.project;
@@ -18,6 +18,14 @@ interface BackendDiagnostic {
18
18
  code: string;
19
19
  message: string;
20
20
  severity: 'info' | 'warning' | 'error';
21
+ path?: string;
22
+ nodeKind?: string;
23
+ resourceKind?: string;
24
+ gearKind?: string;
25
+ field?: string;
26
+ operationKind?: string;
27
+ opIndex?: number;
28
+ opId?: string;
21
29
  }
22
30
  interface BackendResponseMeta {
23
31
  requestId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/backend",
3
- "version": "0.2.0-alpha.4",
3
+ "version": "0.2.0-alpha.6",
4
4
  "description": "FairyGUI Headless Authoring SDK — stateful backend runtime and session services.",
5
5
  "author": "OpenFairyGUI Contributors",
6
6
  "license": "MIT",
@@ -52,8 +52,8 @@
52
52
  "runtime"
53
53
  ],
54
54
  "dependencies": {
55
- "@openfairygui/core": "0.2.0-alpha.4",
56
- "@openfairygui/functions": "0.2.0-alpha.4"
55
+ "@openfairygui/core": "0.2.0-alpha.6",
56
+ "@openfairygui/functions": "0.2.0-alpha.6"
57
57
  },
58
58
  "devDependencies": {
59
59
  "ava": "^7.0.0",
package/src/contracts.ts CHANGED
@@ -17,6 +17,14 @@ export interface BackendDiagnostic {
17
17
  code: string;
18
18
  message: string;
19
19
  severity: 'info' | 'warning' | 'error';
20
+ path?: string;
21
+ nodeKind?: string;
22
+ resourceKind?: string;
23
+ gearKind?: string;
24
+ field?: string;
25
+ operationKind?: string;
26
+ opIndex?: number;
27
+ opId?: string;
20
28
  }
21
29
 
22
30
  export interface BackendResponseMeta {
@@ -14,6 +14,7 @@ import type {
14
14
  SessionNotFoundError,
15
15
  SessionStaleWriteError,
16
16
  } from '../runtime.js';
17
+ import type { BackendDiagnostic } from '../contracts.js';
17
18
  import { validateSaveTarget, type PathPolicyViolationError } from '../path-policy.js';
18
19
  import { createSessionNotFoundError, createStaleWriteError, toSessionSnapshot } from './session-utils.js';
19
20
 
@@ -75,6 +76,21 @@ function createWriterFileSystem(
75
76
  };
76
77
  }
77
78
 
79
+ function toBackendDiagnostics(error: ApplyUamTransactionAppError): BackendDiagnostic[] {
80
+ return error.diagnostics.length > 0
81
+ ? error.diagnostics.map((diagnostic) => ({ ...diagnostic }))
82
+ : [
83
+ {
84
+ code: error.code,
85
+ message: error.message,
86
+ severity: 'error',
87
+ operationKind: error.operationKind,
88
+ opIndex: error.opIndex,
89
+ opId: error.opId,
90
+ },
91
+ ];
92
+ }
93
+
78
94
  export class AuthoringService {
79
95
  public constructor(
80
96
  private readonly context: BackendContext,
@@ -119,17 +135,13 @@ export class AuthoringService {
119
135
  operations: input.operations,
120
136
  });
121
137
  if (result.ok === false) {
138
+ const diagnostics = toBackendDiagnostics(result.error);
122
139
  this.eventService.emit({
123
140
  kind: 'transaction.rejected',
124
141
  sessionId: session.sessionId,
125
142
  canonicalPathKey: session.canonicalPathKey,
126
143
  revision: session.revision,
127
- diagnostics:
128
- result.error.issues?.map((issue) => ({
129
- code: result.error.code,
130
- message: issue.message,
131
- severity: 'error' as const,
132
- })) ?? [],
144
+ diagnostics,
133
145
  });
134
146
  return failure(
135
147
  'authoring',
@@ -139,6 +151,7 @@ export class AuthoringService {
139
151
  {
140
152
  sessionId: session.sessionId,
141
153
  revision: session.revision,
154
+ diagnostics,
142
155
  },
143
156
  );
144
157
  }