@graphty/graphty-element 2.4.0 → 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/dist/ai.js +3 -3
- package/dist/catalog.js +6 -6
- package/dist/chunks/{AiManager-BD9XK30e.js → AiManager-DNJCoeTO.js} +5 -5
- package/dist/chunks/{DataSource-B8vf2uhW.js → DataSource-xL3Yn0Pa.js} +72 -61
- package/dist/chunks/{GraphSession-dcwOjGJh.js → GraphSession-PFm2tJ_j.js} +1483 -1441
- package/dist/chunks/{GraphtyLogger-CqOVV13Y.js → GraphtyLogger-kbOx2zq3.js} +169 -221
- package/dist/chunks/{VoiceInputAdapter-D0tHHi9G.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-DTfhvhHz.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
- package/dist/chunks/{algorithms-BF0X6RPw.js → algorithms-B87OPYw4.js} +2 -2
- package/dist/chunks/{capability-check-BJzlK4oL.js → capability-check-B2oYf_30.js} +1 -1
- package/dist/chunks/{detect-vJxK7n0D.js → detect-tuYQLJbT.js} +2 -2
- package/dist/chunks/{format-detection-C80TLQ2e.js → format-detection-BG6CMwPO.js} +1 -1
- package/dist/chunks/{index-2xkq7wyD.js → index-6GDfNfwJ.js} +2928 -2856
- package/dist/chunks/{optionsFromZod-BuTOFgVM.js → optionsFromZod-DHLLiX_8.js} +237 -236
- package/dist/chunks/{paletteRegistry-A63C71Gn.js → paletteRegistry-jg9uS7wo.js} +66 -66
- package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
- package/dist/chunks/{registry-jB46Gmeb.js → registry-DQeq4B2K.js} +8 -8
- package/dist/chunks/{scales-B2d-7Bf0.js → scales-BXHmwPXC.js} +4 -4
- package/dist/extend.js +7 -7
- package/dist/graphty-catalog.json +1 -1
- package/dist/graphty.bundle.js +25128 -24837
- package/dist/graphty.js +67 -63
- package/dist/index.d.ts +3 -0
- package/dist/logging.js +2 -2
- package/dist/session.js +5 -5
- package/dist/src/Edge.d.ts +4 -4
- package/dist/src/acceleration/AccelerationController.d.ts +6 -0
- package/dist/src/acceleration/registry.d.ts +3 -0
- package/dist/src/acceleration/types.d.ts +7 -0
- package/dist/src/algorithms/Algorithm.d.ts +13 -0
- package/dist/src/cameras/InputUtils.d.ts +67 -0
- package/dist/src/cameras/XRInputHandler.d.ts +0 -8
- package/dist/src/catalog/pluginRegistry.d.ts +62 -0
- package/dist/src/catalog/registry.d.ts +7 -0
- package/dist/src/data/DataSource.d.ts +1 -1
- package/dist/src/errors/codes.d.ts +2 -1
- 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/PatternedLineRenderer.d.ts +5 -37
- package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
- 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-B93WRH3e.js +0 -134
|
@@ -1,64 +1,13 @@
|
|
|
1
|
-
import { G as c } from "./
|
|
1
|
+
import { c as G, G as c } from "./pluginRegistry-MaTIDh6l.js";
|
|
2
2
|
import { c as $ } from "./types-C_c53VgR.js";
|
|
3
|
-
|
|
4
|
-
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
5
|
-
let s = null;
|
|
6
|
-
return {
|
|
7
|
-
register(i, n) {
|
|
8
|
-
const o = e.idOf(i);
|
|
9
|
-
if (typeof o != "string" || o === "")
|
|
10
|
-
throw new c({
|
|
11
|
-
code: "E_BAD_COMMAND",
|
|
12
|
-
message: `a ${e.kind} registration needs an id`,
|
|
13
|
-
source: "registry",
|
|
14
|
-
details: { kind: e.kind, field: "id" }
|
|
15
|
-
});
|
|
16
|
-
if (e.builtInIds().includes(o))
|
|
17
|
-
throw new c({
|
|
18
|
-
code: "E_DUPLICATE_PLUGIN",
|
|
19
|
-
message: `"${o}" is the id of a ${e.kind} the element ships, and a built-in id may not be taken: a saved document that named it yesterday has to mean the same thing today`,
|
|
20
|
-
source: "registry",
|
|
21
|
-
details: { kind: e.kind, name: o, builtIn: !0 }
|
|
22
|
-
});
|
|
23
|
-
const u = t.get(o);
|
|
24
|
-
if (u !== void 0) {
|
|
25
|
-
if (e.implementationOf(u) === e.implementationOf(i))
|
|
26
|
-
return;
|
|
27
|
-
if (n?.strict === !0)
|
|
28
|
-
throw new c({
|
|
29
|
-
code: "E_DUPLICATE_PLUGIN",
|
|
30
|
-
message: `a ${e.kind} named "${o}" is already registered`,
|
|
31
|
-
source: "registry",
|
|
32
|
-
details: { kind: e.kind, name: o }
|
|
33
|
-
});
|
|
34
|
-
r.has(o) || (r.add(o), console.warn(
|
|
35
|
-
`graphty: a second ${e.kind} named "${o}" replaced the first. Register one implementation per name, or pass { strict: true } to make this throw.`
|
|
36
|
-
));
|
|
37
|
-
}
|
|
38
|
-
t.set(o, i), s = null;
|
|
39
|
-
},
|
|
40
|
-
entries() {
|
|
41
|
-
return Object.freeze([...t.values()]);
|
|
42
|
-
},
|
|
43
|
-
descriptors() {
|
|
44
|
-
return s ??= Object.freeze([...t.values()].map((i) => e.descriptorOf(i))), s;
|
|
45
|
-
},
|
|
46
|
-
byId(i) {
|
|
47
|
-
return t.get(i);
|
|
48
|
-
},
|
|
49
|
-
clearForTesting() {
|
|
50
|
-
t.clear(), r.clear(), s = null;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const _ = G({
|
|
3
|
+
const E = G({
|
|
55
4
|
kind: "sink",
|
|
56
5
|
idOf: (e) => e.descriptor.id,
|
|
57
6
|
descriptorOf: (e) => e.descriptor,
|
|
58
7
|
implementationOf: (e) => e.create,
|
|
59
8
|
builtInIds: () => $
|
|
60
9
|
});
|
|
61
|
-
function
|
|
10
|
+
function Te(e, t) {
|
|
62
11
|
const r = e.descriptor;
|
|
63
12
|
if (r === void 0 || typeof r != "object")
|
|
64
13
|
throw new c({
|
|
@@ -74,18 +23,18 @@ function Oe(e, t) {
|
|
|
74
23
|
source: "registry",
|
|
75
24
|
details: { kind: "sink", name: String(r.id), field: "create" }
|
|
76
25
|
});
|
|
77
|
-
|
|
26
|
+
E.register(e, t);
|
|
78
27
|
}
|
|
79
|
-
function
|
|
80
|
-
return
|
|
28
|
+
function F() {
|
|
29
|
+
return E.descriptors();
|
|
81
30
|
}
|
|
82
31
|
function v(e) {
|
|
83
|
-
return
|
|
32
|
+
return E.byId(e);
|
|
84
33
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
34
|
+
function Oe() {
|
|
35
|
+
E.clearForTesting();
|
|
87
36
|
}
|
|
88
|
-
const
|
|
37
|
+
const U = Object.freeze([
|
|
89
38
|
{
|
|
90
39
|
id: "console",
|
|
91
40
|
plainName: "Browser console",
|
|
@@ -158,38 +107,38 @@ const F = Object.freeze([
|
|
|
158
107
|
]
|
|
159
108
|
}
|
|
160
109
|
]);
|
|
161
|
-
function
|
|
162
|
-
return
|
|
110
|
+
function x(e) {
|
|
111
|
+
return U.find((t) => t.id === e) ?? v(e)?.descriptor;
|
|
163
112
|
}
|
|
164
|
-
const
|
|
113
|
+
const j = 3;
|
|
165
114
|
function B(e, t) {
|
|
166
|
-
let r = Array.from({ length: t.length + 1 }, (
|
|
167
|
-
for (let
|
|
168
|
-
const
|
|
169
|
-
for (let
|
|
170
|
-
const
|
|
171
|
-
|
|
115
|
+
let r = Array.from({ length: t.length + 1 }, (n, o) => o);
|
|
116
|
+
for (let n = 1; n <= e.length; n++) {
|
|
117
|
+
const o = [n];
|
|
118
|
+
for (let s = 1; s <= t.length; s++) {
|
|
119
|
+
const i = (r[s - 1] ?? 0) + (e[n - 1] === t[s - 1] ? 0 : 1);
|
|
120
|
+
o[s] = Math.min(i, (r[s] ?? 0) + 1, (o[s - 1] ?? 0) + 1);
|
|
172
121
|
}
|
|
173
|
-
r =
|
|
122
|
+
r = o;
|
|
174
123
|
}
|
|
175
124
|
return r[t.length] ?? Math.max(e.length, t.length);
|
|
176
125
|
}
|
|
177
126
|
function W(e, t) {
|
|
178
|
-
return t.map((r) => ({ name: r, distance: B(e.toLowerCase(), r.toLowerCase()) })).filter((r) => r.distance <=
|
|
127
|
+
return t.map((r) => ({ name: r, distance: B(e.toLowerCase(), r.toLowerCase()) })).filter((r) => r.distance <= j).sort((r, n) => r.distance - n.distance).slice(0, 3).map((r) => r.name);
|
|
179
128
|
}
|
|
180
|
-
function
|
|
129
|
+
function T(e) {
|
|
181
130
|
return typeof e == "number" ? e : void 0;
|
|
182
131
|
}
|
|
183
132
|
function K(e, t, r) {
|
|
184
|
-
const
|
|
133
|
+
const n = { kind: r.kind, id: r.id, option: e.name, value: t };
|
|
185
134
|
if (e.type === "enum" && e.values !== void 0) {
|
|
186
|
-
const
|
|
187
|
-
if (typeof t != "string" || !
|
|
135
|
+
const o = e.values.map((s) => s.value);
|
|
136
|
+
if (typeof t != "string" || !o.includes(t))
|
|
188
137
|
throw new c({
|
|
189
138
|
code: "E_OPTION_RANGE",
|
|
190
|
-
message: `"${e.name}" accepts ${
|
|
139
|
+
message: `"${e.name}" accepts ${o.map((s) => `"${s}"`).join(", ")}`,
|
|
191
140
|
source: "config",
|
|
192
|
-
details: { ...
|
|
141
|
+
details: { ...n, values: o }
|
|
193
142
|
});
|
|
194
143
|
return;
|
|
195
144
|
}
|
|
@@ -199,22 +148,22 @@ function K(e, t, r) {
|
|
|
199
148
|
code: "E_OPTION_RANGE",
|
|
200
149
|
message: `"${e.name}" takes a number`,
|
|
201
150
|
source: "config",
|
|
202
|
-
details:
|
|
151
|
+
details: n
|
|
203
152
|
});
|
|
204
153
|
if (e.type === "integer" && !Number.isInteger(t))
|
|
205
154
|
throw new c({
|
|
206
155
|
code: "E_OPTION_RANGE",
|
|
207
156
|
message: `"${e.name}" takes a whole number`,
|
|
208
157
|
source: "config",
|
|
209
|
-
details:
|
|
158
|
+
details: n
|
|
210
159
|
});
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
160
|
+
const o = T(e.min), s = T(e.max);
|
|
161
|
+
if (o !== void 0 && t < o || s !== void 0 && t > s)
|
|
213
162
|
throw new c({
|
|
214
163
|
code: "E_OPTION_RANGE",
|
|
215
|
-
message: `"${e.name}" is limited to ${
|
|
164
|
+
message: `"${e.name}" is limited to ${o ?? "any"} through ${s ?? "any"}`,
|
|
216
165
|
source: "config",
|
|
217
|
-
details: { ...
|
|
166
|
+
details: { ...n, min: o, max: s }
|
|
218
167
|
});
|
|
219
168
|
return;
|
|
220
169
|
}
|
|
@@ -223,37 +172,37 @@ function K(e, t, r) {
|
|
|
223
172
|
code: "E_OPTION_RANGE",
|
|
224
173
|
message: `"${e.name}" takes true or false`,
|
|
225
174
|
source: "config",
|
|
226
|
-
details:
|
|
175
|
+
details: n
|
|
227
176
|
});
|
|
228
177
|
}
|
|
229
|
-
function
|
|
230
|
-
const
|
|
231
|
-
for (const
|
|
232
|
-
if (!
|
|
233
|
-
const
|
|
178
|
+
function O(e, t, r) {
|
|
179
|
+
const n = new Map(e.map((s) => [s.name, s]));
|
|
180
|
+
for (const s of Object.keys(t))
|
|
181
|
+
if (!n.has(s)) {
|
|
182
|
+
const i = e.map((m) => m.name);
|
|
234
183
|
throw new c({
|
|
235
184
|
code: "E_UNKNOWN_OPTION",
|
|
236
|
-
message: `the ${r.kind} "${r.id}" has no option named "${
|
|
185
|
+
message: `the ${r.kind} "${r.id}" has no option named "${s}"`,
|
|
237
186
|
source: "config",
|
|
238
187
|
details: {
|
|
239
188
|
kind: r.kind,
|
|
240
189
|
id: r.id,
|
|
241
|
-
option:
|
|
242
|
-
available:
|
|
243
|
-
candidates: W(
|
|
190
|
+
option: s,
|
|
191
|
+
available: i,
|
|
192
|
+
candidates: W(s, i)
|
|
244
193
|
}
|
|
245
194
|
});
|
|
246
195
|
}
|
|
247
|
-
const
|
|
248
|
-
for (const
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
|
|
196
|
+
const o = {};
|
|
197
|
+
for (const s of e) {
|
|
198
|
+
const i = t[s.name];
|
|
199
|
+
if (i === void 0) {
|
|
200
|
+
s.default !== void 0 && (o[s.name] = s.default);
|
|
252
201
|
continue;
|
|
253
202
|
}
|
|
254
|
-
K(
|
|
203
|
+
K(s, i, r), o[s.name] = i;
|
|
255
204
|
}
|
|
256
|
-
return
|
|
205
|
+
return o;
|
|
257
206
|
}
|
|
258
207
|
var l = /* @__PURE__ */ ((e) => (e[e.SILENT = 0] = "SILENT", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e[e.TRACE = 5] = "TRACE", e))(l || {});
|
|
259
208
|
const H = {
|
|
@@ -275,7 +224,7 @@ const H = {
|
|
|
275
224
|
function be(e) {
|
|
276
225
|
return H[e.toLowerCase()];
|
|
277
226
|
}
|
|
278
|
-
const
|
|
227
|
+
const _ = {
|
|
279
228
|
enabled: !1,
|
|
280
229
|
level: l.INFO,
|
|
281
230
|
modules: "*",
|
|
@@ -285,7 +234,7 @@ const y = {
|
|
|
285
234
|
colors: !0
|
|
286
235
|
}
|
|
287
236
|
};
|
|
288
|
-
let a = { ...
|
|
237
|
+
let a = { ..._, format: { ..._.format } };
|
|
289
238
|
function z(e) {
|
|
290
239
|
a = {
|
|
291
240
|
enabled: e.enabled ?? a.enabled,
|
|
@@ -305,13 +254,13 @@ function b(e) {
|
|
|
305
254
|
if (t === void 0)
|
|
306
255
|
return a.level;
|
|
307
256
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
310
|
-
return
|
|
257
|
+
const n = t[e[r]];
|
|
258
|
+
if (n !== void 0)
|
|
259
|
+
return n;
|
|
311
260
|
}
|
|
312
261
|
return a.level;
|
|
313
262
|
}
|
|
314
|
-
function
|
|
263
|
+
function d() {
|
|
315
264
|
return { ...a, format: { ...a.format } };
|
|
316
265
|
}
|
|
317
266
|
function k(e) {
|
|
@@ -326,28 +275,28 @@ function k(e) {
|
|
|
326
275
|
return !1;
|
|
327
276
|
}
|
|
328
277
|
function ke() {
|
|
329
|
-
a = { ...
|
|
278
|
+
a = { ..._, format: { ..._.format } };
|
|
330
279
|
}
|
|
331
|
-
function
|
|
332
|
-
const { format: r } =
|
|
333
|
-
return
|
|
280
|
+
function w(e, t) {
|
|
281
|
+
const { format: r } = d(), n = t?.timestamp ?? r.timestamp, o = t?.module ?? r.module, s = [];
|
|
282
|
+
return n && s.push(`[${e.timestamp.toISOString()}]`), o && s.push(`[${e.category.join(".")}]`), s.push(`[${N[e.level]}]`), s.push(e.message), s.join(" ");
|
|
334
283
|
}
|
|
335
|
-
const
|
|
284
|
+
const S = /* @__PURE__ */ Symbol.for("graphty.lazy");
|
|
336
285
|
function Me(e) {
|
|
337
286
|
let t, r = !1;
|
|
338
|
-
const
|
|
339
|
-
return
|
|
287
|
+
const n = () => (r || (t = e(), r = !0), t);
|
|
288
|
+
return n[S] = !0, n;
|
|
340
289
|
}
|
|
341
290
|
function J(e) {
|
|
342
|
-
return typeof e == "function" &&
|
|
291
|
+
return typeof e == "function" && S in e;
|
|
343
292
|
}
|
|
344
293
|
function V(e) {
|
|
345
294
|
const t = {};
|
|
346
|
-
for (const [r,
|
|
347
|
-
t[r] = J(
|
|
295
|
+
for (const [r, n] of Object.entries(e))
|
|
296
|
+
t[r] = J(n) ? n() : n;
|
|
348
297
|
return t;
|
|
349
298
|
}
|
|
350
|
-
function
|
|
299
|
+
function Y(e) {
|
|
351
300
|
switch (e) {
|
|
352
301
|
case l.ERROR:
|
|
353
302
|
return "error";
|
|
@@ -359,17 +308,17 @@ function q(e) {
|
|
|
359
308
|
return "debug";
|
|
360
309
|
}
|
|
361
310
|
}
|
|
362
|
-
function
|
|
311
|
+
function q(e) {
|
|
363
312
|
const t = { ...e.data };
|
|
364
313
|
return e.error && (t.error = e.error.stack ?? e.error.message), Object.keys(t).length > 0 ? t : void 0;
|
|
365
314
|
}
|
|
366
|
-
function
|
|
367
|
-
const t = e.formatter ??
|
|
315
|
+
function L(e = {}) {
|
|
316
|
+
const t = e.formatter ?? w, r = e.colors ?? !0;
|
|
368
317
|
return {
|
|
369
318
|
name: "console",
|
|
370
|
-
write(
|
|
371
|
-
const
|
|
372
|
-
|
|
319
|
+
write(n) {
|
|
320
|
+
const o = t(n), s = r ? Y(n.level) : "log", i = q(n);
|
|
321
|
+
i ? console[s](o, i) : console[s](o);
|
|
373
322
|
}
|
|
374
323
|
};
|
|
375
324
|
}
|
|
@@ -388,7 +337,7 @@ function re(e) {
|
|
|
388
337
|
const t = Date.now().toString(36), r = Math.random().toString(36).substring(2, 8);
|
|
389
338
|
return `${e}-${t}-${r}`;
|
|
390
339
|
}
|
|
391
|
-
class
|
|
340
|
+
class se {
|
|
392
341
|
/**
|
|
393
342
|
* Creates a new RemoteLogClient.
|
|
394
343
|
* @param options - Configuration options
|
|
@@ -404,10 +353,10 @@ class ne {
|
|
|
404
353
|
*/
|
|
405
354
|
shouldThrottle(t) {
|
|
406
355
|
const r = Date.now();
|
|
407
|
-
for (const { pattern:
|
|
408
|
-
if (
|
|
409
|
-
const
|
|
410
|
-
return r -
|
|
356
|
+
for (const { pattern: n, intervalMs: o } of this.throttlePatterns)
|
|
357
|
+
if (n.test(t)) {
|
|
358
|
+
const s = n.source, i = this.throttleLastTimes.get(s) ?? 0;
|
|
359
|
+
return r - i < o ? !0 : (this.throttleLastTimes.set(s, r), !1);
|
|
411
360
|
}
|
|
412
361
|
return !1;
|
|
413
362
|
}
|
|
@@ -417,16 +366,16 @@ class ne {
|
|
|
417
366
|
* @param message - The log message
|
|
418
367
|
* @param data - Optional additional data to include
|
|
419
368
|
*/
|
|
420
|
-
log(t, r,
|
|
369
|
+
log(t, r, n) {
|
|
421
370
|
if (this.isClosed || this.shouldThrottle(r))
|
|
422
371
|
return;
|
|
423
|
-
const
|
|
372
|
+
const o = {
|
|
424
373
|
time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
425
374
|
level: t,
|
|
426
375
|
message: r,
|
|
427
|
-
...
|
|
376
|
+
...n !== void 0 && { data: n }
|
|
428
377
|
};
|
|
429
|
-
this.pendingLogs.push(
|
|
378
|
+
this.pendingLogs.push(o), this.scheduleBatchSend();
|
|
430
379
|
}
|
|
431
380
|
/**
|
|
432
381
|
* Schedules a batch send after the configured interval.
|
|
@@ -453,14 +402,14 @@ class ne {
|
|
|
453
402
|
*/
|
|
454
403
|
async sendWithRetry(t) {
|
|
455
404
|
let r = null;
|
|
456
|
-
for (let
|
|
405
|
+
for (let n = 0; n <= this.maxRetries; n++)
|
|
457
406
|
try {
|
|
458
407
|
await this.sendRequest(t);
|
|
459
408
|
return;
|
|
460
|
-
} catch (
|
|
461
|
-
if (r =
|
|
462
|
-
const
|
|
463
|
-
await this.sleep(
|
|
409
|
+
} catch (o) {
|
|
410
|
+
if (r = o instanceof Error ? o : new Error(String(o)), n < this.maxRetries) {
|
|
411
|
+
const s = this.retryDelayMs * Math.pow(2, n);
|
|
412
|
+
await this.sleep(s);
|
|
464
413
|
}
|
|
465
414
|
}
|
|
466
415
|
console.error("[RemoteLogClient] Failed to send logs after retries:", r?.message);
|
|
@@ -476,22 +425,22 @@ class ne {
|
|
|
476
425
|
logs: t
|
|
477
426
|
};
|
|
478
427
|
this.projectMarker !== void 0 && (r.projectMarker = this.projectMarker), this.worktreePath !== void 0 && (r.worktreePath = this.worktreePath);
|
|
479
|
-
const
|
|
480
|
-
|
|
428
|
+
const n = new AbortController(), o = setTimeout(() => {
|
|
429
|
+
n.abort();
|
|
481
430
|
}, this.timeoutMs);
|
|
482
431
|
try {
|
|
483
|
-
const
|
|
432
|
+
const s = await fetch(`${this.serverUrl}/log`, {
|
|
484
433
|
method: "POST",
|
|
485
434
|
headers: {
|
|
486
435
|
"Content-Type": "application/json"
|
|
487
436
|
},
|
|
488
437
|
body: JSON.stringify(r),
|
|
489
|
-
signal:
|
|
438
|
+
signal: n.signal
|
|
490
439
|
});
|
|
491
|
-
if (!
|
|
492
|
-
throw new Error(`HTTP ${
|
|
440
|
+
if (!s.ok)
|
|
441
|
+
throw new Error(`HTTP ${s.status}: ${s.statusText}`);
|
|
493
442
|
} finally {
|
|
494
|
-
clearTimeout(
|
|
443
|
+
clearTimeout(o);
|
|
495
444
|
}
|
|
496
445
|
}
|
|
497
446
|
/**
|
|
@@ -517,8 +466,8 @@ class ne {
|
|
|
517
466
|
this.isClosed || (this.isClosed = !0, await this.flush());
|
|
518
467
|
}
|
|
519
468
|
}
|
|
520
|
-
function
|
|
521
|
-
const t = [
|
|
469
|
+
function ne(e) {
|
|
470
|
+
const t = [w(e, { timestamp: !1, module: !0 })];
|
|
522
471
|
if (e.data && Object.keys(e.data).length > 0)
|
|
523
472
|
try {
|
|
524
473
|
t.push(JSON.stringify(e.data));
|
|
@@ -529,23 +478,23 @@ function se(e) {
|
|
|
529
478
|
Error: ${e.error.message}`), e.error.stack && t.push(`
|
|
530
479
|
${e.error.stack}`)), t.join(" ");
|
|
531
480
|
}
|
|
532
|
-
function
|
|
533
|
-
const t = e.serverUrl.replace(/\/$/, ""), r = e.sessionPrefix ?? "graphty",
|
|
534
|
-
pattern:
|
|
535
|
-
intervalMs:
|
|
536
|
-
})), h = new
|
|
481
|
+
function I(e) {
|
|
482
|
+
const t = e.serverUrl.replace(/\/$/, ""), r = e.sessionPrefix ?? "graphty", n = e.batchIntervalMs ?? 100, o = e.maxRetries ?? 3, s = e.retryDelayMs ?? 1e3, i = e.throttleMs ?? 5e3, m = e.throttlePatterns?.map((u) => ({
|
|
483
|
+
pattern: u,
|
|
484
|
+
intervalMs: i
|
|
485
|
+
})), h = new se({
|
|
537
486
|
serverUrl: t,
|
|
538
487
|
sessionPrefix: r,
|
|
539
|
-
batchIntervalMs:
|
|
540
|
-
maxRetries:
|
|
541
|
-
retryDelayMs:
|
|
542
|
-
throttlePatterns:
|
|
488
|
+
batchIntervalMs: n,
|
|
489
|
+
maxRetries: o,
|
|
490
|
+
retryDelayMs: s,
|
|
491
|
+
throttlePatterns: m
|
|
543
492
|
});
|
|
544
493
|
return {
|
|
545
494
|
name: "remote",
|
|
546
|
-
write(
|
|
547
|
-
const D =
|
|
548
|
-
h.log(C, D,
|
|
495
|
+
write(u) {
|
|
496
|
+
const D = ne(u), C = N[u.level];
|
|
497
|
+
h.log(C, D, u.data);
|
|
549
498
|
},
|
|
550
499
|
async flush() {
|
|
551
500
|
await h.flush();
|
|
@@ -560,9 +509,9 @@ function L(e) {
|
|
|
560
509
|
}
|
|
561
510
|
};
|
|
562
511
|
}
|
|
563
|
-
const
|
|
564
|
-
let
|
|
565
|
-
function
|
|
512
|
+
const y = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
513
|
+
let R;
|
|
514
|
+
function oe(e) {
|
|
566
515
|
return e.join(".");
|
|
567
516
|
}
|
|
568
517
|
function A(e) {
|
|
@@ -576,13 +525,13 @@ function A(e) {
|
|
|
576
525
|
console.error(`[GraphtyLogger] Error disposing sink "${e.name}":`, t);
|
|
577
526
|
}
|
|
578
527
|
}
|
|
579
|
-
function
|
|
528
|
+
function ie(e, t) {
|
|
580
529
|
return e.level !== void 0 && t.level > e.level ? !1 : e.categories !== void 0 && e.categories.length > 0 ? e.categories.some((r) => t.category.includes(r)) : !0;
|
|
581
530
|
}
|
|
582
531
|
function ae(e) {
|
|
583
532
|
e.data && Object.freeze(e.data), Object.freeze(e);
|
|
584
|
-
for (const t of
|
|
585
|
-
if (
|
|
533
|
+
for (const t of f.values())
|
|
534
|
+
if (ie(t, e))
|
|
586
535
|
try {
|
|
587
536
|
t.write(e);
|
|
588
537
|
} catch (r) {
|
|
@@ -590,41 +539,41 @@ function ae(e) {
|
|
|
590
539
|
}
|
|
591
540
|
}
|
|
592
541
|
function le(e) {
|
|
593
|
-
const t = (
|
|
594
|
-
if (!
|
|
542
|
+
const t = (o, s, i, m) => {
|
|
543
|
+
if (!d().enabled || !k(e) || o > b(e))
|
|
595
544
|
return;
|
|
596
|
-
const
|
|
545
|
+
const u = i ? V(i) : void 0;
|
|
597
546
|
ae({
|
|
598
547
|
timestamp: /* @__PURE__ */ new Date(),
|
|
599
|
-
level:
|
|
548
|
+
level: o,
|
|
600
549
|
category: e,
|
|
601
|
-
message:
|
|
602
|
-
data:
|
|
603
|
-
error:
|
|
550
|
+
message: s,
|
|
551
|
+
data: u,
|
|
552
|
+
error: m
|
|
604
553
|
});
|
|
605
|
-
}, r = (
|
|
606
|
-
t(
|
|
607
|
-
},
|
|
554
|
+
}, r = (o) => (s, i) => {
|
|
555
|
+
t(o, s, i);
|
|
556
|
+
}, n = (o) => d().enabled && k(e) && b(e) >= o;
|
|
608
557
|
return {
|
|
609
558
|
trace: r(l.TRACE),
|
|
610
559
|
debug: r(l.DEBUG),
|
|
611
560
|
info: r(l.INFO),
|
|
612
561
|
warn: r(l.WARN),
|
|
613
|
-
error: (
|
|
614
|
-
t(l.ERROR,
|
|
562
|
+
error: (o, s, i) => {
|
|
563
|
+
t(l.ERROR, o, i, s);
|
|
615
564
|
},
|
|
616
|
-
isTraceEnabled: () =>
|
|
617
|
-
isDebugEnabled: () =>
|
|
565
|
+
isTraceEnabled: () => n(l.TRACE),
|
|
566
|
+
isDebugEnabled: () => n(l.DEBUG)
|
|
618
567
|
};
|
|
619
568
|
}
|
|
620
569
|
function ce(e) {
|
|
621
|
-
return
|
|
570
|
+
return L({ colors: e.colors === !0 });
|
|
622
571
|
}
|
|
623
572
|
function g(e) {
|
|
624
573
|
return typeof e == "number" ? e : void 0;
|
|
625
574
|
}
|
|
626
575
|
function ue(e) {
|
|
627
|
-
return
|
|
576
|
+
return I({
|
|
628
577
|
serverUrl: typeof e.serverUrl == "string" ? e.serverUrl : "",
|
|
629
578
|
sessionPrefix: typeof e.sessionPrefix == "string" ? e.sessionPrefix : void 0,
|
|
630
579
|
batchIntervalMs: g(e.batchIntervalMs),
|
|
@@ -638,9 +587,9 @@ const P = /* @__PURE__ */ new Map([
|
|
|
638
587
|
["remote", ue]
|
|
639
588
|
]);
|
|
640
589
|
function fe() {
|
|
641
|
-
return [...P.keys(), ...
|
|
590
|
+
return [...P.keys(), ...F().map((e) => e.id)];
|
|
642
591
|
}
|
|
643
|
-
function
|
|
592
|
+
function me(e) {
|
|
644
593
|
throw new c({
|
|
645
594
|
code: "E_UNKNOWN_SINK",
|
|
646
595
|
message: `nothing is registered as the log destination "${e}". Register it with registerLogSink before naming it in a configuration.`,
|
|
@@ -648,35 +597,35 @@ function de(e) {
|
|
|
648
597
|
details: { kind: "sink", name: e, available: fe() }
|
|
649
598
|
});
|
|
650
599
|
}
|
|
651
|
-
function
|
|
652
|
-
const t = e.use, r = e.options ?? {},
|
|
653
|
-
if (
|
|
654
|
-
return
|
|
655
|
-
const
|
|
656
|
-
return (!
|
|
600
|
+
function de(e) {
|
|
601
|
+
const t = e.use, r = e.options ?? {}, n = v(t);
|
|
602
|
+
if (n)
|
|
603
|
+
return n.create(O(n.descriptor.options, r, { kind: "sink", id: t }));
|
|
604
|
+
const o = P.get(t), s = x(t);
|
|
605
|
+
return (!o || !s) && me(t), o(O(s.options, r, { kind: "sink", id: t }));
|
|
657
606
|
}
|
|
658
607
|
function p(e) {
|
|
659
|
-
const t =
|
|
660
|
-
t && t !== e && A(t),
|
|
608
|
+
const t = f.get(e.name);
|
|
609
|
+
t && t !== e && A(t), f.set(e.name, e);
|
|
661
610
|
}
|
|
662
611
|
function he(e) {
|
|
663
|
-
z(e), p(
|
|
612
|
+
z(e), p(L({ colors: d().format.colors ?? !0 }));
|
|
664
613
|
const { remoteLogUrl: t } = e;
|
|
665
|
-
t && t !==
|
|
614
|
+
t && t !== R && (R = t, p(I({ serverUrl: t })));
|
|
666
615
|
for (const r of e.sinks ?? [])
|
|
667
|
-
p("write" in r ? r :
|
|
668
|
-
return
|
|
616
|
+
p("write" in r ? r : de(r));
|
|
617
|
+
return y.clear(), Promise.resolve();
|
|
669
618
|
}
|
|
670
619
|
function ge(e) {
|
|
671
|
-
const t =
|
|
672
|
-
return t ? (
|
|
620
|
+
const t = f.get(e);
|
|
621
|
+
return t ? (f.delete(e), A(t), e === "remote" && (R = void 0), !0) : !1;
|
|
673
622
|
}
|
|
674
623
|
function pe() {
|
|
675
|
-
return Array.from(
|
|
624
|
+
return Array.from(f.values());
|
|
676
625
|
}
|
|
677
|
-
async function
|
|
626
|
+
async function _e() {
|
|
678
627
|
const e = [];
|
|
679
|
-
for (const t of
|
|
628
|
+
for (const t of f.values())
|
|
680
629
|
t.flush && e.push(
|
|
681
630
|
t.flush().catch((r) => {
|
|
682
631
|
console.error(`[GraphtyLogger] Error flushing sink "${t.name}":`, r);
|
|
@@ -684,15 +633,15 @@ async function ye() {
|
|
|
684
633
|
);
|
|
685
634
|
await Promise.all(e);
|
|
686
635
|
}
|
|
687
|
-
function
|
|
688
|
-
const t =
|
|
636
|
+
function Ee(e) {
|
|
637
|
+
const t = oe(e), r = y.get(t);
|
|
689
638
|
if (r)
|
|
690
639
|
return r;
|
|
691
|
-
const
|
|
692
|
-
return
|
|
640
|
+
const n = le(e);
|
|
641
|
+
return y.set(t, n), n;
|
|
693
642
|
}
|
|
694
|
-
function
|
|
695
|
-
return
|
|
643
|
+
function ye() {
|
|
644
|
+
return d().enabled;
|
|
696
645
|
}
|
|
697
646
|
const ve = {
|
|
698
647
|
/**
|
|
@@ -702,11 +651,11 @@ const ve = {
|
|
|
702
651
|
/**
|
|
703
652
|
* Get a logger for the specified category.
|
|
704
653
|
*/
|
|
705
|
-
getLogger:
|
|
654
|
+
getLogger: Ee,
|
|
706
655
|
/**
|
|
707
656
|
* Check if logging is enabled.
|
|
708
657
|
*/
|
|
709
|
-
isEnabled:
|
|
658
|
+
isEnabled: ye,
|
|
710
659
|
/**
|
|
711
660
|
* Add a custom sink to the logger.
|
|
712
661
|
*/
|
|
@@ -722,31 +671,30 @@ const ve = {
|
|
|
722
671
|
/**
|
|
723
672
|
* Flush all sinks that support flushing.
|
|
724
673
|
*/
|
|
725
|
-
flush:
|
|
674
|
+
flush: _e,
|
|
726
675
|
/**
|
|
727
676
|
* Render a record the way the element renders its own console line.
|
|
728
677
|
*/
|
|
729
|
-
formatRecord:
|
|
678
|
+
formatRecord: w
|
|
730
679
|
};
|
|
731
680
|
export {
|
|
732
681
|
ve as G,
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
682
|
+
U as L,
|
|
683
|
+
F as a,
|
|
684
|
+
O as b,
|
|
685
|
+
Oe as c,
|
|
737
686
|
l as d,
|
|
738
687
|
H as e,
|
|
739
688
|
N as f,
|
|
740
689
|
z as g,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
690
|
+
L as h,
|
|
691
|
+
I as i,
|
|
692
|
+
w as j,
|
|
693
|
+
d as k,
|
|
694
|
+
x as l,
|
|
746
695
|
k as m,
|
|
747
696
|
Me as n,
|
|
748
697
|
ke as o,
|
|
749
698
|
be as p,
|
|
750
|
-
|
|
751
|
-
Oe as r
|
|
699
|
+
Te as r
|
|
752
700
|
};
|