@graphty/graphty-element 2.3.1 → 2.4.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/AGENTS.md +4 -3
- package/dist/ai.js +3 -3
- package/dist/catalog.js +28 -27
- package/dist/chunks/{AiManager-BBmGJbH4.js → AiManager-DNJCoeTO.js} +5 -5
- package/dist/chunks/{DataSource-OeN3NeyD.js → DataSource-xL3Yn0Pa.js} +72 -61
- package/dist/chunks/{GraphSession-Bef1AYw9.js → GraphSession-PFm2tJ_j.js} +2942 -2822
- package/dist/chunks/{GraphtyLogger-5KEttFUo.js → GraphtyLogger-kbOx2zq3.js} +170 -222
- package/dist/chunks/{NodeStyle-DKj7HjMJ.js → NodeStyle-CtmA7dXi.js} +16 -14
- package/dist/chunks/{VoiceInputAdapter-Dr9Gcmds.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-BbfgZWpS.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
- package/dist/chunks/{algorithms-CpX56sUB.js → algorithms-B87OPYw4.js} +780 -635
- package/dist/chunks/{capability-check-Blhb2aBB.js → capability-check-B2oYf_30.js} +1 -1
- package/dist/chunks/{detect-Cqwshr9a.js → detect-tuYQLJbT.js} +2 -2
- package/dist/chunks/{format-detection-BXGO1lSn.js → format-detection-BG6CMwPO.js} +1 -1
- package/dist/chunks/{index-C0mIoumR.js → index-6GDfNfwJ.js} +3185 -2731
- package/dist/chunks/{optionsFromZod-17lkrAJs.js → optionsFromZod-DHLLiX_8.js} +275 -267
- package/dist/chunks/{paletteRegistry-x7WOEKZY.js → paletteRegistry-jg9uS7wo.js} +72 -70
- package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
- package/dist/chunks/{registry-CSba5QGJ.js → registry-DQeq4B2K.js} +8 -8
- package/dist/chunks/{scales-BRwl51k8.js → scales-BXHmwPXC.js} +572 -399
- package/dist/chunks/{types-B7bX5c0K.js → types-C_c53VgR.js} +31 -26
- package/dist/commands.d.ts +4 -0
- package/dist/custom-elements.json +1 -1
- package/dist/extend.js +8 -8
- package/dist/graphty-catalog.json +245 -12
- package/dist/graphty.bundle.js +37843 -36551
- package/dist/graphty.js +69 -65
- package/dist/index.d.ts +3 -0
- package/dist/logging.js +2 -2
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +42 -40
- package/dist/session.js +6 -6
- package/dist/src/Edge.d.ts +4 -4
- package/dist/src/Graph.d.ts +79 -7
- package/dist/src/acceleration/AccelerationController.d.ts +20 -3
- package/dist/src/acceleration/registry.d.ts +3 -0
- package/dist/src/acceleration/types.d.ts +85 -0
- package/dist/src/algorithms/Algorithm.d.ts +13 -0
- package/dist/src/algorithms/KCoreAlgorithm.d.ts +26 -0
- package/dist/src/algorithms/LinkPredictionAlgorithm.d.ts +41 -0
- package/dist/src/cameras/InputUtils.d.ts +67 -0
- package/dist/src/cameras/XRInputHandler.d.ts +0 -8
- package/dist/src/catalog/algorithms.d.ts +5 -5
- package/dist/src/catalog/index.d.ts +2 -2
- package/dist/src/catalog/layouts.d.ts +7 -6
- package/dist/src/catalog/pluginRegistry.d.ts +62 -0
- package/dist/src/catalog/registry.d.ts +7 -0
- package/dist/src/catalog/types.d.ts +77 -6
- package/dist/src/config/EdgeStyle.d.ts +35 -0
- package/dist/src/config/index.d.ts +1 -1
- package/dist/src/data/DataSource.d.ts +1 -1
- package/dist/src/data/GEXFDataSource.d.ts +23 -0
- package/dist/src/errors/codes.d.ts +16 -1
- package/dist/src/events.d.ts +30 -0
- package/dist/src/graphty-element.d.ts +66 -26
- package/dist/src/layout/GridLayoutEngine.d.ts +37 -0
- package/dist/src/layout/LayoutEngine.d.ts +7 -7
- package/dist/src/layout/NGraphLayoutEngine.d.ts +2 -0
- package/dist/src/layout/RadialLayoutEngine.d.ts +37 -0
- package/dist/src/layout/SimulationLayoutEngine.d.ts +12 -0
- package/dist/src/managers/DataManager.d.ts +69 -2
- package/dist/src/managers/EventManager.d.ts +10 -4
- package/dist/src/managers/GraphContext.d.ts +2 -1
- package/dist/src/managers/LayoutManager.d.ts +30 -3
- package/dist/src/meshes/CustomLineRenderer.d.ts +11 -9
- package/dist/src/meshes/EdgeMesh.d.ts +18 -9
- package/dist/src/meshes/FilledArrowRenderer.d.ts +61 -23
- package/dist/src/meshes/MeshCache.d.ts +18 -0
- package/dist/src/meshes/NodeEffects.d.ts +16 -11
- package/dist/src/meshes/NodeMesh.d.ts +2 -2
- package/dist/src/meshes/PatternedLineRenderer.d.ts +5 -37
- package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
- package/dist/src/meshes/RichTextParser.d.ts +26 -0
- package/dist/src/meshes/RichTextRenderer.d.ts +0 -1
- package/dist/src/session/cost/estimate.d.ts +1 -1
- package/dist/src/session/layout.d.ts +3 -3
- package/dist/src/session/runs/RunsApi.d.ts +1 -1
- package/dist/src/session/styles/StylesApi.d.ts +6 -0
- package/dist/src/session/styles/intern.d.ts +26 -5
- package/dist/src/session/styles/repaint.d.ts +2 -1
- package/dist/src/session/types.d.ts +6 -6
- package/dist/src/xr/XRSessionManager.d.ts +1 -1
- package/dist/webgpu.d.ts +8 -0
- package/dist/webgpu.js +2 -2
- package/package.json +6 -6
- package/dist/chunks/GraphtyError-BwcnblTH.js +0 -132
|
@@ -26,9 +26,17 @@
|
|
|
26
26
|
* does today. {@link channelRole} is where that split is written down, and
|
|
27
27
|
* {@link meshChannelsFor} is the list a repaint pushes.
|
|
28
28
|
*
|
|
29
|
-
* A KEY IS OPAQUE AND SESSION-LOCAL. It
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* A KEY IS OPAQUE AND SESSION-LOCAL. It names one style for the life of the session and is
|
|
30
|
+
* meaningless outside it. Nothing may persist one, compare two from different sessions, or read
|
|
31
|
+
* anything back out of the number.
|
|
32
|
+
*
|
|
33
|
+
* A KEY IS RELEASED WHEN NOTHING IS DRAWN FROM IT, AND NEVER HANDED OUT AGAIN. The repaint counts
|
|
34
|
+
* the elements drawn from each key ({@link StyleInterner.retain}, {@link StyleInterner.release}),
|
|
35
|
+
* and a style no element holds is forgotten, so what the interner keeps follows the looks on
|
|
36
|
+
* screen rather than every edit ever made. The number is not recycled: a renderer names a cached
|
|
37
|
+
* source mesh after it, and a recycled key would hand one look's mesh to another. The storage
|
|
38
|
+
* behind a key IS recycled, which is what keeps a session that edits a size a thousand times
|
|
39
|
+
* the size of the picture it draws.
|
|
32
40
|
*
|
|
33
41
|
* Nothing here reaches Babylon.js, Lit or the DOM.
|
|
34
42
|
*/
|
|
@@ -76,7 +84,7 @@ export declare function meshChannelsFor(target: "node" | "edge"): readonly Chann
|
|
|
76
84
|
* into the interner.
|
|
77
85
|
*/
|
|
78
86
|
export interface StyleInterner<T> {
|
|
79
|
-
/** How many distinct styles
|
|
87
|
+
/** How many distinct styles are held: minted and not yet released. */
|
|
80
88
|
readonly size: number;
|
|
81
89
|
/** Start a new sequence, discarding anything pushed and not ended. */
|
|
82
90
|
begin(): void;
|
|
@@ -105,9 +113,22 @@ export interface StyleInterner<T> {
|
|
|
105
113
|
/**
|
|
106
114
|
* Finish the sequence and answer with the key the style it describes is known by.
|
|
107
115
|
* @param mint - Builds the style object, called ONLY when the sequence is new.
|
|
108
|
-
* @returns The key
|
|
116
|
+
* @returns The key, which no other style is ever given in this interner.
|
|
109
117
|
*/
|
|
110
118
|
end(mint: () => T): number;
|
|
119
|
+
/**
|
|
120
|
+
* Say that one more element is drawn from a key.
|
|
121
|
+
* @param key - The key, as {@link end} answered with.
|
|
122
|
+
*/
|
|
123
|
+
retain(key: number): void;
|
|
124
|
+
/**
|
|
125
|
+
* Say that one element fewer is drawn from a key, and forget its style when none is left.
|
|
126
|
+
*
|
|
127
|
+
* A style that has been minted and never retained is held until something retains and then
|
|
128
|
+
* releases it: minting is a lookup, and a lookup must not take a style away.
|
|
129
|
+
* @param key - The key, as {@link end} answered with.
|
|
130
|
+
*/
|
|
131
|
+
release(key: number): void;
|
|
111
132
|
/**
|
|
112
133
|
* The style one key stands for.
|
|
113
134
|
* @param key - The key, as {@link end} answered with.
|
|
@@ -168,7 +168,8 @@ export interface ElementPaint {
|
|
|
168
168
|
*
|
|
169
169
|
* This is the number a structural hash exists to keep small: it must follow the distinct
|
|
170
170
|
* SHAPES and SIZES in the picture, never the element count, and a colour encoding must not
|
|
171
|
-
* move it.
|
|
171
|
+
* move it. A mesh no element is drawn from any more is not counted: its key is released and
|
|
172
|
+
* never handed out again.
|
|
172
173
|
* @param target - Nodes or edges.
|
|
173
174
|
* @returns The count, which is at least one.
|
|
174
175
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import type { DerivedGraph, GraphSnapshot, NodeId } from "@graphty/graph-format";
|
|
16
16
|
import type { z } from "zod/v4";
|
|
17
17
|
import type { AccelerationCapabilities, AccelerationPolicy, AccelerationStatus, GraphAccelerator } from "../acceleration";
|
|
18
|
-
import type { AlgorithmKey, AttributeDescriptor, CatalogApi, EdgeId, RunId, Scope } from "../catalog/types";
|
|
18
|
+
import type { AlgorithmKey, AttributeDescriptor, CatalogApi, DeprecatedCatalogMethod, EdgeId, RunId, Scope } from "../catalog/types";
|
|
19
19
|
import type { DataConfig } from "../config/DataConfig";
|
|
20
20
|
import type { ElementPositions } from "../data/positions";
|
|
21
21
|
import type { ImportReport } from "../data/report";
|
|
@@ -347,12 +347,12 @@ export interface SessionDataApi {
|
|
|
347
347
|
* been run. A consumer wanting only the metrics that CAN run filters on `available`; both lists
|
|
348
348
|
* come off one call rather than two that could disagree.
|
|
349
349
|
*
|
|
350
|
-
* The rest of
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
350
|
+
* The rest of {@link CatalogApi} -- the methods named in `DeprecatedCatalogMethod` -- is absent
|
|
351
|
+
* rather than stubbed, and deprecated on `CatalogApi` itself. A consumer discovers that gap by
|
|
352
|
+
* autocomplete finding nothing, not by a call that throws. This type is derived from that list,
|
|
353
|
+
* so implementing one of them means deleting its name there and nothing here.
|
|
354
354
|
*/
|
|
355
|
-
export type SessionCatalogApi =
|
|
355
|
+
export type SessionCatalogApi = Omit<CatalogApi, DeprecatedCatalogMethod>;
|
|
356
356
|
/** The configuration a session carries. */
|
|
357
357
|
export interface SessionConfig {
|
|
358
358
|
/** The data configuration: id paths, weight paths, position scale, direction, id coercion. */
|
|
@@ -11,7 +11,7 @@ interface XRSessionConfig {
|
|
|
11
11
|
referenceSpaceType: XRReferenceSpaceType;
|
|
12
12
|
optionalFeatures?: string[];
|
|
13
13
|
};
|
|
14
|
-
/** Whether XR sessions track hands (`xr.input.handTracking`).
|
|
14
|
+
/** Whether XR sessions track hands (`xr.input.handTracking`). Defaults to true. */
|
|
15
15
|
handTracking?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/**
|
package/dist/webgpu.d.ts
CHANGED
|
@@ -46,6 +46,14 @@
|
|
|
46
46
|
* republishes rather than finishing that work anywhere else. Recorded in
|
|
47
47
|
* `docs/decisions/device-computes-incorrectly.md`.
|
|
48
48
|
*
|
|
49
|
+
* That the ELEMENT reports `E_DEVICE_INCORRECT` on the Windows WARP renderer is inference, by
|
|
50
|
+
* decision, not a test: no lane runs graphty-element on WARP. The host matrix (`hosts.yml`) runs
|
|
51
|
+
* only webgpu-graph-algorithms there, whose own tests show the multi-block scan failing. This
|
|
52
|
+
* file's side -- a failed check becomes `E_DEVICE_INCORRECT`, and the controller refuses the
|
|
53
|
+
* device at attach -- is pinned against a stubbed peer and a deliberately wrong fake. Adding an
|
|
54
|
+
* element job to the Windows lane is a CI cost that can be taken on later if the two halves ever
|
|
55
|
+
* disagree.
|
|
56
|
+
*
|
|
49
57
|
* ## Detection is not a fallback
|
|
50
58
|
*
|
|
51
59
|
* Finding out, before anything runs, that this host has no WebGPU and letting the element take
|
package/dist/webgpu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EXACT_MAX_NODES as n, createAccelerator as p, verifyDevice as u } from "@graphty/webgpu-graph-algorithms";
|
|
2
2
|
import { probeBrowserWebGpu as l, requestGpuContext as d } from "@graphty/webgpu-graph-algorithms/browser";
|
|
3
|
-
import { r as h } from "./chunks/registry-
|
|
4
|
-
import { G as s } from "./chunks/
|
|
3
|
+
import { r as h } from "./chunks/registry-DQeq4B2K.js";
|
|
4
|
+
import { G as s } from "./chunks/pluginRegistry-MaTIDh6l.js";
|
|
5
5
|
const a = "webgpu-graph-algorithms", w = /* @__PURE__ */ new Set(["kind", "ctx", "options", "dispose", "verify"]);
|
|
6
6
|
function b(o, e) {
|
|
7
7
|
for (const [r, t] of Object.entries(o))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphty/graphty-element",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "A Web Component library for 3D/2D graph visualization built with Lit and Babylon.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"customElements": "./dist/custom-elements.json",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"vite-plugin-eslint": "^1.8.1",
|
|
134
134
|
"vitepress": "^1.6.3",
|
|
135
135
|
"vitest": "^3.2.4",
|
|
136
|
-
"@graphty/
|
|
137
|
-
"@graphty/
|
|
136
|
+
"@graphty/webgpu-graph-algorithms": "^0.6.7",
|
|
137
|
+
"@graphty/remote-logger": "^1.3.7"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
140
140
|
"@ai-sdk/anthropic": "^2.0.50",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"ai": "^5.0.104",
|
|
147
147
|
"encrypt-storage": "^2.14.7",
|
|
148
148
|
"lit": "^3.0.0",
|
|
149
|
-
"@graphty/webgpu-graph-algorithms": "^0.6.
|
|
149
|
+
"@graphty/webgpu-graph-algorithms": "^0.6.7"
|
|
150
150
|
},
|
|
151
151
|
"peerDependenciesMeta": {
|
|
152
152
|
"@ai-sdk/anthropic": {
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
"papaparse": "^5.5.3",
|
|
185
185
|
"toposort": "^2.0.2",
|
|
186
186
|
"zod": "^3.25.28",
|
|
187
|
-
"@graphty/algorithms": "^2.0.
|
|
187
|
+
"@graphty/algorithms": "^2.0.4",
|
|
188
188
|
"@graphty/graph-format": "^1.0.5",
|
|
189
|
-
"@graphty/layout": "^1.
|
|
189
|
+
"@graphty/layout": "^1.10.0"
|
|
190
190
|
},
|
|
191
191
|
"overrides": {
|
|
192
192
|
"storybook": "$storybook"
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
const N = {
|
|
2
|
-
E_BAD_COMMAND: "E_BAD_COMMAND",
|
|
3
|
-
E_BAD_QUERY: "E_BAD_QUERY",
|
|
4
|
-
E_BAD_LAYER: "E_BAD_LAYER",
|
|
5
|
-
E_BAD_SELECTOR: "E_BAD_SELECTOR",
|
|
6
|
-
E_BAD_FORMULA: "E_BAD_FORMULA",
|
|
7
|
-
E_SELECTOR_EMPTY: "E_SELECTOR_EMPTY",
|
|
8
|
-
E_UNSCOPED_RUN_ENCODING: "E_UNSCOPED_RUN_ENCODING",
|
|
9
|
-
E_UNKNOWN_SCALE: "E_UNKNOWN_SCALE",
|
|
10
|
-
E_UNKNOWN_CHANNEL: "E_UNKNOWN_CHANNEL",
|
|
11
|
-
E_UNKNOWN_OPTION: "E_UNKNOWN_OPTION",
|
|
12
|
-
E_OPTION_RANGE: "E_OPTION_RANGE",
|
|
13
|
-
E_UNKNOWN_ATTRIBUTE: "E_UNKNOWN_ATTRIBUTE",
|
|
14
|
-
E_UNKNOWN_ALGORITHM: "E_UNKNOWN_ALGORITHM",
|
|
15
|
-
E_UNKNOWN_LAYOUT: "E_UNKNOWN_LAYOUT",
|
|
16
|
-
E_UNKNOWN_FORMAT: "E_UNKNOWN_FORMAT",
|
|
17
|
-
E_UNKNOWN_PALETTE: "E_UNKNOWN_PALETTE",
|
|
18
|
-
E_UNKNOWN_CAMERA: "E_UNKNOWN_CAMERA",
|
|
19
|
-
E_UNKNOWN_SINK: "E_UNKNOWN_SINK",
|
|
20
|
-
E_UNKNOWN_RUN: "E_UNKNOWN_RUN",
|
|
21
|
-
E_UNSTABLE_RUN_ID: "E_UNSTABLE_RUN_ID",
|
|
22
|
-
E_DUPLICATE_ID: "E_DUPLICATE_ID",
|
|
23
|
-
E_DUPLICATE_EDGE: "E_DUPLICATE_EDGE",
|
|
24
|
-
E_DUPLICATE_PLUGIN: "E_DUPLICATE_PLUGIN",
|
|
25
|
-
E_PROTECTED: "E_PROTECTED",
|
|
26
|
-
E_FETCH_FAILED: "E_FETCH_FAILED",
|
|
27
|
-
E_PARSE_FAILED: "E_PARSE_FAILED",
|
|
28
|
-
E_EDGE_ENDPOINTS_UNRESOLVED: "E_EDGE_ENDPOINTS_UNRESOLVED",
|
|
29
|
-
E_ID_MISSING: "E_ID_MISSING",
|
|
30
|
-
E_TOO_LARGE: "E_TOO_LARGE",
|
|
31
|
-
E_OUT_OF_MEMORY: "E_OUT_OF_MEMORY",
|
|
32
|
-
E_CAP_EXCEEDED: "E_CAP_EXCEEDED",
|
|
33
|
-
E_SCOPE_EMPTY: "E_SCOPE_EMPTY",
|
|
34
|
-
E_NOT_CONVERGED: "E_NOT_CONVERGED",
|
|
35
|
-
E_NO_ACCELERATOR: "E_NO_ACCELERATOR",
|
|
36
|
-
E_NO_WEBGPU: "E_NO_WEBGPU",
|
|
37
|
-
E_NO_ADAPTER: "E_NO_ADAPTER",
|
|
38
|
-
E_SOFTWARE_ONLY: "E_SOFTWARE_ONLY",
|
|
39
|
-
E_DEVICE_INCORRECT: "E_DEVICE_INCORRECT",
|
|
40
|
-
E_DEVICE_LOST: "E_DEVICE_LOST",
|
|
41
|
-
E_NO_WEBGL: "E_NO_WEBGL",
|
|
42
|
-
E_UNSUPPORTED: "E_UNSUPPORTED",
|
|
43
|
-
E_READONLY: "E_READONLY",
|
|
44
|
-
E_DISPOSED: "E_DISPOSED",
|
|
45
|
-
E_INTERNAL: "E_INTERNAL"
|
|
46
|
-
}, U = Object.freeze(Object.values(N)), C = Object.freeze([
|
|
47
|
-
N.E_NO_WEBGPU,
|
|
48
|
-
N.E_NO_ADAPTER,
|
|
49
|
-
N.E_SOFTWARE_ONLY,
|
|
50
|
-
N.E_DEVICE_INCORRECT,
|
|
51
|
-
N.E_DEVICE_LOST,
|
|
52
|
-
N.E_TOO_LARGE
|
|
53
|
-
]);
|
|
54
|
-
function s(_) {
|
|
55
|
-
return typeof _ == "string" && Object.hasOwn(N, _);
|
|
56
|
-
}
|
|
57
|
-
const r = Object.freeze({});
|
|
58
|
-
function D(_) {
|
|
59
|
-
if (typeof _ != "object" || _ === null || !("code" in _))
|
|
60
|
-
return;
|
|
61
|
-
const { code: E } = _;
|
|
62
|
-
return s(E) ? E : void 0;
|
|
63
|
-
}
|
|
64
|
-
function R(_) {
|
|
65
|
-
if (typeof _ != "object" || _ === null || !("code" in _))
|
|
66
|
-
return;
|
|
67
|
-
const { code: E } = _;
|
|
68
|
-
return typeof E == "string" && !s(E) ? E : void 0;
|
|
69
|
-
}
|
|
70
|
-
class e extends Error {
|
|
71
|
-
/**
|
|
72
|
-
* Builds an error.
|
|
73
|
-
* @param init - The code, the message, the failing area and anything else known about the
|
|
74
|
-
* failure.
|
|
75
|
-
*/
|
|
76
|
-
constructor(E) {
|
|
77
|
-
super(E.message, E.cause === void 0 ? void 0 : { cause: E.cause }), this.name = "GraphtyError", Object.setPrototypeOf(this, new.target.prototype), this.code = E.code, this.source = E.source, this.recoverable = E.recoverable ?? !1, this.details = E.details === void 0 ? r : Object.freeze({ ...E.details }), E.target !== void 0 && (this.target = E.target);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Re-reports a failure from somewhere else as a `GraphtyError`.
|
|
81
|
-
*
|
|
82
|
-
* A sibling package -- graph-io, graph-format, the WebGPU peer -- throws its own class. The
|
|
83
|
-
* class does not cross the boundary, so the element carries the code instead: when the
|
|
84
|
-
* original's `code` is one the element knows, that code wins; when it is a string the
|
|
85
|
-
* element does not know, it is kept in `details.sourceCode` and the caller's code is used.
|
|
86
|
-
* A value that is already a `GraphtyError` is returned untouched, so the most specific code
|
|
87
|
-
* survives.
|
|
88
|
-
* @param cause - The thrown value being wrapped.
|
|
89
|
-
* @param init - The code, area and facts to use when the original supplies none.
|
|
90
|
-
* @returns The error to throw.
|
|
91
|
-
*/
|
|
92
|
-
static wrap(E, O) {
|
|
93
|
-
if (E instanceof e)
|
|
94
|
-
return E;
|
|
95
|
-
const A = D(E), t = R(E), o = O.message ?? (E instanceof Error ? E.message : String(E)), T = t === void 0 ? O.details : { ...O.details, sourceCode: t };
|
|
96
|
-
return new e({
|
|
97
|
-
...O,
|
|
98
|
-
code: A ?? O.code,
|
|
99
|
-
message: o,
|
|
100
|
-
details: T,
|
|
101
|
-
cause: E
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Renders the error as plain JSON.
|
|
106
|
-
*
|
|
107
|
-
* Called by `JSON.stringify`, and used wherever an error has to survive a boundary a class
|
|
108
|
-
* cannot cross: a log line, a worker message, a bug report.
|
|
109
|
-
* @returns The serialisable form.
|
|
110
|
-
*/
|
|
111
|
-
toJSON() {
|
|
112
|
-
const E = {
|
|
113
|
-
name: this.name,
|
|
114
|
-
code: this.code,
|
|
115
|
-
message: this.message,
|
|
116
|
-
source: this.source,
|
|
117
|
-
recoverable: this.recoverable,
|
|
118
|
-
details: this.details
|
|
119
|
-
};
|
|
120
|
-
return this.target !== void 0 && (E.target = this.target), this.cause instanceof Error && (E.causeMessage = this.cause.message), E;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function L(_) {
|
|
124
|
-
return _ instanceof e;
|
|
125
|
-
}
|
|
126
|
-
export {
|
|
127
|
-
C as A,
|
|
128
|
-
e as G,
|
|
129
|
-
U as a,
|
|
130
|
-
s as b,
|
|
131
|
-
L as i
|
|
132
|
-
};
|