refactor: narrow graph editor api

Amp-Thread-ID: https://ampcode.com/threads/T-019f9d91-77c1-7206-a60f-ed6554ce92ab

Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-07-29 02:26:44 +00:00
co-authored by heaust
parent c1a95e4b27
commit 4ff33e4079
2 changed files with 11 additions and 29 deletions
+2 -3
View File
@@ -6,7 +6,7 @@ import {
socketTypes,
} from "./catalog.js";
export class AuthoringGraphError extends Error {
class AuthoringGraphError extends Error {
constructor(code, details = {}) {
super(code);
this.name = "AuthoringGraphError";
@@ -53,7 +53,6 @@ const deepFreeze = (value) => {
return value;
};
const sourceMaps = new WeakMap();
export const getSourceMap = (ir) => sourceMaps.get(ir);
export const mapAuthoringDiagnostic = (ir, diagnostic) => {
const details = diagnostic?.details;
const path = [
@@ -62,7 +61,7 @@ export const mapAuthoringDiagnostic = (ir, diagnostic) => {
details?.field,
diagnostic?.field,
].find((value) => typeof value === "string");
const map = getSourceMap(ir);
const map = sourceMaps.get(ir);
let match;
if (path && map)
for (const key of Object.keys(map))