@graphty/graphty-element 2.0.0 → 2.0.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 +4 -4
- package/dist/catalog.js +5 -5
- package/dist/chunks/{AiManager-D22fxCNb.js → AiManager-awS0MNr1.js} +4 -4
- package/dist/chunks/{Algorithm-BhwPK-aS.js → Algorithm-BdcqHKps.js} +1 -1
- package/dist/chunks/{DataSource-7S-7S3M1.js → DataSource-DK4GZBKg.js} +2 -2
- package/dist/chunks/{GraphSession-DwlThkoy.js → GraphSession-D87eymV8.js} +5 -5
- package/dist/chunks/GraphtyLogger-CK03SnJi.js +752 -0
- package/dist/chunks/{VoiceInputAdapter-BrCQEMf0.js → VoiceInputAdapter-CcnCmxo5.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-BE1pfwMC.js → XRPivotCameraController-UjMsbran.js} +2 -2
- package/dist/chunks/{cameras-D5LX3ttm.js → cameras-BeIAlMWR.js} +1 -1
- package/dist/chunks/{capability-check-MH9salUj.js → capability-check-DcKFwS6q.js} +1 -1
- package/dist/chunks/{detect-5cVtGFHg.js → detect-B-YbbP7i.js} +1 -1
- package/dist/chunks/{format-detection-Bos-Q387.js → format-detection-DohSEZnb.js} +1 -1
- package/dist/chunks/{index-CqZp3iwq.js → index-uohvGegX.js} +14 -14
- package/dist/chunks/{paletteRegistry-BSjlD98O.js → paletteRegistry-B-oS4YxP.js} +2 -2
- package/dist/chunks/{scales-DPUY-fFk.js → scales-DvGid5Ln.js} +3 -3
- package/dist/extend.js +5 -5
- package/dist/graphty-catalog.json +1 -1
- package/dist/graphty.bundle.js +1 -1
- package/dist/graphty.js +4 -4
- package/dist/logging.js +2 -2
- package/dist/session.js +4 -4
- package/package.json +12 -10
- package/dist/chunks/GraphtyLogger-DoYeIghs.js +0 -609
|
@@ -1,609 +0,0 @@
|
|
|
1
|
-
import { G as l } from "./GraphtyError-B3eKs4yg.js";
|
|
2
|
-
import { c as G } from "./types-B7bX5c0K.js";
|
|
3
|
-
import { RemoteLogClient as C } from "@graphty/remote-logger";
|
|
4
|
-
function P(e) {
|
|
5
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
6
|
-
let o = null;
|
|
7
|
-
return {
|
|
8
|
-
register(s, r) {
|
|
9
|
-
const i = e.idOf(s);
|
|
10
|
-
if (typeof i != "string" || i === "")
|
|
11
|
-
throw new l({
|
|
12
|
-
code: "E_BAD_COMMAND",
|
|
13
|
-
message: `a ${e.kind} registration needs an id`,
|
|
14
|
-
source: "registry",
|
|
15
|
-
details: { kind: e.kind, field: "id" }
|
|
16
|
-
});
|
|
17
|
-
if (e.builtInIds().includes(i))
|
|
18
|
-
throw new l({
|
|
19
|
-
code: "E_DUPLICATE_PLUGIN",
|
|
20
|
-
message: `"${i}" 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`,
|
|
21
|
-
source: "registry",
|
|
22
|
-
details: { kind: e.kind, name: i, builtIn: !0 }
|
|
23
|
-
});
|
|
24
|
-
const u = t.get(i);
|
|
25
|
-
if (u !== void 0) {
|
|
26
|
-
if (e.implementationOf(u) === e.implementationOf(s))
|
|
27
|
-
return;
|
|
28
|
-
if (r?.strict === !0)
|
|
29
|
-
throw new l({
|
|
30
|
-
code: "E_DUPLICATE_PLUGIN",
|
|
31
|
-
message: `a ${e.kind} named "${i}" is already registered`,
|
|
32
|
-
source: "registry",
|
|
33
|
-
details: { kind: e.kind, name: i }
|
|
34
|
-
});
|
|
35
|
-
n.has(i) || (n.add(i), console.warn(
|
|
36
|
-
`graphty: a second ${e.kind} named "${i}" replaced the first. Register one implementation per name, or pass { strict: true } to make this throw.`
|
|
37
|
-
));
|
|
38
|
-
}
|
|
39
|
-
t.set(i, s), o = null;
|
|
40
|
-
},
|
|
41
|
-
entries() {
|
|
42
|
-
return Object.freeze([...t.values()]);
|
|
43
|
-
},
|
|
44
|
-
descriptors() {
|
|
45
|
-
return o ??= Object.freeze([...t.values()].map((s) => e.descriptorOf(s))), o;
|
|
46
|
-
},
|
|
47
|
-
byId(s) {
|
|
48
|
-
return t.get(s);
|
|
49
|
-
},
|
|
50
|
-
clearForTesting() {
|
|
51
|
-
t.clear(), n.clear(), o = null;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
const w = P({
|
|
56
|
-
kind: "sink",
|
|
57
|
-
idOf: (e) => e.descriptor.id,
|
|
58
|
-
descriptorOf: (e) => e.descriptor,
|
|
59
|
-
implementationOf: (e) => e.create,
|
|
60
|
-
builtInIds: () => G
|
|
61
|
-
});
|
|
62
|
-
function he(e, t) {
|
|
63
|
-
const n = e.descriptor;
|
|
64
|
-
if (n === void 0 || typeof n != "object")
|
|
65
|
-
throw new l({
|
|
66
|
-
code: "E_BAD_COMMAND",
|
|
67
|
-
message: "registerLogSink takes a registration with a descriptor",
|
|
68
|
-
source: "registry",
|
|
69
|
-
details: { kind: "sink", field: "descriptor" }
|
|
70
|
-
});
|
|
71
|
-
if (typeof e.create != "function")
|
|
72
|
-
throw new l({
|
|
73
|
-
code: "E_BAD_COMMAND",
|
|
74
|
-
message: `the log destination "${String(n.id)}" was registered without a create function`,
|
|
75
|
-
source: "registry",
|
|
76
|
-
details: { kind: "sink", name: String(n.id), field: "create" }
|
|
77
|
-
});
|
|
78
|
-
w.register(e, t);
|
|
79
|
-
}
|
|
80
|
-
function U() {
|
|
81
|
-
return w.descriptors();
|
|
82
|
-
}
|
|
83
|
-
function I(e) {
|
|
84
|
-
return w.byId(e);
|
|
85
|
-
}
|
|
86
|
-
function ye() {
|
|
87
|
-
w.clearForTesting();
|
|
88
|
-
}
|
|
89
|
-
const F = Object.freeze([
|
|
90
|
-
{
|
|
91
|
-
id: "console",
|
|
92
|
-
plainName: "Browser console",
|
|
93
|
-
description: "Writes each record to the developer console, one line per record.",
|
|
94
|
-
options: [
|
|
95
|
-
{
|
|
96
|
-
name: "colors",
|
|
97
|
-
plainName: "Coloured output",
|
|
98
|
-
type: "boolean",
|
|
99
|
-
// TRUE BECAUSE THAT IS WHAT THE ELEMENT ACTUALLY DOES. The console the element
|
|
100
|
-
// attaches reads `format.colors ?? true`, so a descriptor saying false made a
|
|
101
|
-
// settings panel built from this table show "Coloured output: off" while the
|
|
102
|
-
// element was colouring, and `configure({ sinks: [{ use: "console" }] })`
|
|
103
|
-
// silently turned colour off by filling in a default nobody chose.
|
|
104
|
-
default: !0,
|
|
105
|
-
description: "Tint each line by its level."
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: "remote",
|
|
111
|
-
plainName: "Remote log server",
|
|
112
|
-
description: "Batches records and posts them to a log server, for a device whose console nobody can see -- a headset, a phone, a kiosk.",
|
|
113
|
-
options: [
|
|
114
|
-
{
|
|
115
|
-
name: "serverUrl",
|
|
116
|
-
plainName: "Server address",
|
|
117
|
-
type: "string",
|
|
118
|
-
description: "Where records are posted, such as http://localhost:9080."
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: "sessionPrefix",
|
|
122
|
-
plainName: "Session prefix",
|
|
123
|
-
type: "string",
|
|
124
|
-
default: "graphty",
|
|
125
|
-
description: "Prefixes the session id each batch is filed under."
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: "batchIntervalMs",
|
|
129
|
-
plainName: "Batch interval",
|
|
130
|
-
type: "integer",
|
|
131
|
-
default: 100,
|
|
132
|
-
min: 0,
|
|
133
|
-
description: "How long records are collected before a batch is sent, in milliseconds."
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "maxRetries",
|
|
137
|
-
plainName: "Retries",
|
|
138
|
-
type: "integer",
|
|
139
|
-
default: 3,
|
|
140
|
-
min: 0,
|
|
141
|
-
description: "How many times a failed batch is resent before it is dropped."
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: "retryDelayMs",
|
|
145
|
-
plainName: "Retry delay",
|
|
146
|
-
type: "integer",
|
|
147
|
-
default: 1e3,
|
|
148
|
-
min: 0,
|
|
149
|
-
description: "How long to wait between retries, in milliseconds."
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: "throttleMs",
|
|
153
|
-
plainName: "Throttle window",
|
|
154
|
-
type: "integer",
|
|
155
|
-
default: 5e3,
|
|
156
|
-
min: 0,
|
|
157
|
-
description: "How long a repeated message is suppressed for, in milliseconds."
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
]);
|
|
162
|
-
function j(e) {
|
|
163
|
-
return F.find((t) => t.id === e) ?? I(e)?.descriptor;
|
|
164
|
-
}
|
|
165
|
-
const x = 3;
|
|
166
|
-
function B(e, t) {
|
|
167
|
-
let n = Array.from({ length: t.length + 1 }, (o, s) => s);
|
|
168
|
-
for (let o = 1; o <= e.length; o++) {
|
|
169
|
-
const s = [o];
|
|
170
|
-
for (let r = 1; r <= t.length; r++) {
|
|
171
|
-
const i = (n[r - 1] ?? 0) + (e[o - 1] === t[r - 1] ? 0 : 1);
|
|
172
|
-
s[r] = Math.min(i, (n[r] ?? 0) + 1, (s[r - 1] ?? 0) + 1);
|
|
173
|
-
}
|
|
174
|
-
n = s;
|
|
175
|
-
}
|
|
176
|
-
return n[t.length] ?? Math.max(e.length, t.length);
|
|
177
|
-
}
|
|
178
|
-
function W(e, t) {
|
|
179
|
-
return t.map((n) => ({ name: n, distance: B(e.toLowerCase(), n.toLowerCase()) })).filter((n) => n.distance <= x).sort((n, o) => n.distance - o.distance).slice(0, 3).map((n) => n.name);
|
|
180
|
-
}
|
|
181
|
-
function v(e) {
|
|
182
|
-
return typeof e == "number" ? e : void 0;
|
|
183
|
-
}
|
|
184
|
-
function z(e, t, n) {
|
|
185
|
-
const o = { kind: n.kind, id: n.id, option: e.name, value: t };
|
|
186
|
-
if (e.type === "enum" && e.values !== void 0) {
|
|
187
|
-
const s = e.values.map((r) => r.value);
|
|
188
|
-
if (typeof t != "string" || !s.includes(t))
|
|
189
|
-
throw new l({
|
|
190
|
-
code: "E_OPTION_RANGE",
|
|
191
|
-
message: `"${e.name}" accepts ${s.map((r) => `"${r}"`).join(", ")}`,
|
|
192
|
-
source: "config",
|
|
193
|
-
details: { ...o, values: s }
|
|
194
|
-
});
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (e.type === "number" || e.type === "integer") {
|
|
198
|
-
if (typeof t != "number" || !Number.isFinite(t))
|
|
199
|
-
throw new l({
|
|
200
|
-
code: "E_OPTION_RANGE",
|
|
201
|
-
message: `"${e.name}" takes a number`,
|
|
202
|
-
source: "config",
|
|
203
|
-
details: o
|
|
204
|
-
});
|
|
205
|
-
if (e.type === "integer" && !Number.isInteger(t))
|
|
206
|
-
throw new l({
|
|
207
|
-
code: "E_OPTION_RANGE",
|
|
208
|
-
message: `"${e.name}" takes a whole number`,
|
|
209
|
-
source: "config",
|
|
210
|
-
details: o
|
|
211
|
-
});
|
|
212
|
-
const s = v(e.min), r = v(e.max);
|
|
213
|
-
if (s !== void 0 && t < s || r !== void 0 && t > r)
|
|
214
|
-
throw new l({
|
|
215
|
-
code: "E_OPTION_RANGE",
|
|
216
|
-
message: `"${e.name}" is limited to ${s ?? "any"} through ${r ?? "any"}`,
|
|
217
|
-
source: "config",
|
|
218
|
-
details: { ...o, min: s, max: r }
|
|
219
|
-
});
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (e.type === "boolean" && typeof t != "boolean")
|
|
223
|
-
throw new l({
|
|
224
|
-
code: "E_OPTION_RANGE",
|
|
225
|
-
message: `"${e.name}" takes true or false`,
|
|
226
|
-
source: "config",
|
|
227
|
-
details: o
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
function E(e, t, n) {
|
|
231
|
-
const o = new Map(e.map((r) => [r.name, r]));
|
|
232
|
-
for (const r of Object.keys(t))
|
|
233
|
-
if (!o.has(r)) {
|
|
234
|
-
const i = e.map((u) => u.name);
|
|
235
|
-
throw new l({
|
|
236
|
-
code: "E_UNKNOWN_OPTION",
|
|
237
|
-
message: `the ${n.kind} "${n.id}" has no option named "${r}"`,
|
|
238
|
-
source: "config",
|
|
239
|
-
details: {
|
|
240
|
-
kind: n.kind,
|
|
241
|
-
id: n.id,
|
|
242
|
-
option: r,
|
|
243
|
-
available: i,
|
|
244
|
-
candidates: W(r, i)
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
const s = {};
|
|
249
|
-
for (const r of e) {
|
|
250
|
-
const i = t[r.name];
|
|
251
|
-
if (i === void 0) {
|
|
252
|
-
r.default !== void 0 && (s[r.name] = r.default);
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
z(r, i, n), s[r.name] = i;
|
|
256
|
-
}
|
|
257
|
-
return s;
|
|
258
|
-
}
|
|
259
|
-
var c = /* @__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))(c || {});
|
|
260
|
-
const K = {
|
|
261
|
-
silent: 0,
|
|
262
|
-
error: 1,
|
|
263
|
-
warn: 2,
|
|
264
|
-
info: 3,
|
|
265
|
-
debug: 4,
|
|
266
|
-
trace: 5
|
|
267
|
-
/* TRACE */
|
|
268
|
-
}, S = {
|
|
269
|
-
0: "SILENT",
|
|
270
|
-
1: "ERROR",
|
|
271
|
-
2: "WARN",
|
|
272
|
-
3: "INFO",
|
|
273
|
-
4: "DEBUG",
|
|
274
|
-
5: "TRACE"
|
|
275
|
-
};
|
|
276
|
-
function we(e) {
|
|
277
|
-
return K[e.toLowerCase()];
|
|
278
|
-
}
|
|
279
|
-
const y = {
|
|
280
|
-
enabled: !1,
|
|
281
|
-
level: c.INFO,
|
|
282
|
-
modules: "*",
|
|
283
|
-
format: {
|
|
284
|
-
timestamp: !0,
|
|
285
|
-
module: !0,
|
|
286
|
-
colors: !0
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
let a = { ...y, format: { ...y.format } };
|
|
290
|
-
function H(e) {
|
|
291
|
-
a = {
|
|
292
|
-
enabled: e.enabled ?? a.enabled,
|
|
293
|
-
level: e.level ?? a.level,
|
|
294
|
-
modules: e.modules ?? a.modules,
|
|
295
|
-
moduleLevels: e.moduleLevels ?? a.moduleLevels,
|
|
296
|
-
format: {
|
|
297
|
-
timestamp: e.format?.timestamp ?? a.format.timestamp,
|
|
298
|
-
timestampFormat: e.format?.timestampFormat ?? a.format.timestampFormat,
|
|
299
|
-
module: e.format?.module ?? a.format.module,
|
|
300
|
-
colors: e.format?.colors ?? a.format.colors
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function O(e) {
|
|
305
|
-
const t = a.moduleLevels;
|
|
306
|
-
if (t === void 0)
|
|
307
|
-
return a.level;
|
|
308
|
-
for (let n = e.length - 1; n >= 0; n--) {
|
|
309
|
-
const o = t[e[n]];
|
|
310
|
-
if (o !== void 0)
|
|
311
|
-
return o;
|
|
312
|
-
}
|
|
313
|
-
return a.level;
|
|
314
|
-
}
|
|
315
|
-
function d() {
|
|
316
|
-
return { ...a, format: { ...a.format } };
|
|
317
|
-
}
|
|
318
|
-
function R(e) {
|
|
319
|
-
if (!a.enabled || e.length === 0)
|
|
320
|
-
return !1;
|
|
321
|
-
if (a.modules === "*")
|
|
322
|
-
return !0;
|
|
323
|
-
const t = a.modules;
|
|
324
|
-
for (const n of t)
|
|
325
|
-
if (e.includes(n))
|
|
326
|
-
return !0;
|
|
327
|
-
return !1;
|
|
328
|
-
}
|
|
329
|
-
function be() {
|
|
330
|
-
a = { ...y, format: { ...y.format } };
|
|
331
|
-
}
|
|
332
|
-
function N(e, t) {
|
|
333
|
-
const { format: n } = d(), o = t?.timestamp ?? n.timestamp, s = t?.module ?? n.module, r = [];
|
|
334
|
-
return o && r.push(`[${e.timestamp.toISOString()}]`), s && r.push(`[${e.category.join(".")}]`), r.push(`[${S[e.level]}]`), r.push(e.message), r.join(" ");
|
|
335
|
-
}
|
|
336
|
-
const _ = /* @__PURE__ */ Symbol.for("graphty.lazy");
|
|
337
|
-
function ke(e) {
|
|
338
|
-
let t, n = !1;
|
|
339
|
-
const o = () => (n || (t = e(), n = !0), t);
|
|
340
|
-
return o[_] = !0, o;
|
|
341
|
-
}
|
|
342
|
-
function V(e) {
|
|
343
|
-
return typeof e == "function" && _ in e;
|
|
344
|
-
}
|
|
345
|
-
function Y(e) {
|
|
346
|
-
const t = {};
|
|
347
|
-
for (const [n, o] of Object.entries(e))
|
|
348
|
-
t[n] = V(o) ? o() : o;
|
|
349
|
-
return t;
|
|
350
|
-
}
|
|
351
|
-
function q(e) {
|
|
352
|
-
switch (e) {
|
|
353
|
-
case c.ERROR:
|
|
354
|
-
return "error";
|
|
355
|
-
case c.WARN:
|
|
356
|
-
return "warn";
|
|
357
|
-
case c.INFO:
|
|
358
|
-
return "info";
|
|
359
|
-
default:
|
|
360
|
-
return "debug";
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function J(e) {
|
|
364
|
-
const t = { ...e.data };
|
|
365
|
-
return e.error && (t.error = e.error.stack ?? e.error.message), Object.keys(t).length > 0 ? t : void 0;
|
|
366
|
-
}
|
|
367
|
-
function M(e = {}) {
|
|
368
|
-
const t = e.formatter ?? N, n = e.colors ?? !0;
|
|
369
|
-
return {
|
|
370
|
-
name: "console",
|
|
371
|
-
write(o) {
|
|
372
|
-
const s = t(o), r = n ? q(o.level) : "log", i = J(o);
|
|
373
|
-
i ? console[r](s, i) : console[r](s);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
function X(e) {
|
|
378
|
-
const t = [N(e, { timestamp: !1, module: !0 })];
|
|
379
|
-
if (e.data && Object.keys(e.data).length > 0)
|
|
380
|
-
try {
|
|
381
|
-
t.push(JSON.stringify(e.data));
|
|
382
|
-
} catch {
|
|
383
|
-
t.push("[non-serializable data]");
|
|
384
|
-
}
|
|
385
|
-
return e.error && (t.push(`
|
|
386
|
-
Error: ${e.error.message}`), e.error.stack && t.push(`
|
|
387
|
-
${e.error.stack}`)), t.join(" ");
|
|
388
|
-
}
|
|
389
|
-
function L(e) {
|
|
390
|
-
const t = e.serverUrl.replace(/\/$/, ""), n = e.sessionPrefix ?? "graphty", o = e.batchIntervalMs ?? 100, s = e.maxRetries ?? 3, r = e.retryDelayMs ?? 1e3, i = e.throttleMs ?? 5e3, u = e.throttlePatterns?.map((f) => ({
|
|
391
|
-
pattern: f,
|
|
392
|
-
intervalMs: i
|
|
393
|
-
})), g = new C({
|
|
394
|
-
serverUrl: t,
|
|
395
|
-
sessionPrefix: n,
|
|
396
|
-
batchIntervalMs: o,
|
|
397
|
-
maxRetries: s,
|
|
398
|
-
retryDelayMs: r,
|
|
399
|
-
throttlePatterns: u
|
|
400
|
-
});
|
|
401
|
-
return {
|
|
402
|
-
name: "remote",
|
|
403
|
-
write(f) {
|
|
404
|
-
const D = X(f), $ = S[f.level];
|
|
405
|
-
g.log($, D, f.data);
|
|
406
|
-
},
|
|
407
|
-
async flush() {
|
|
408
|
-
await g.flush();
|
|
409
|
-
},
|
|
410
|
-
/*
|
|
411
|
-
* The client holds a batch timer, and before `dispose` existed nothing ever stopped it:
|
|
412
|
-
* removing this destination left it posting to a server the page had stopped listening
|
|
413
|
-
* to. `close` sends what is buffered first, so records already accepted are not lost.
|
|
414
|
-
*/
|
|
415
|
-
async dispose() {
|
|
416
|
-
await g.close();
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
const b = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
421
|
-
let k;
|
|
422
|
-
function Z(e) {
|
|
423
|
-
return e.join(".");
|
|
424
|
-
}
|
|
425
|
-
function A(e) {
|
|
426
|
-
if (e.dispose)
|
|
427
|
-
try {
|
|
428
|
-
const t = e.dispose();
|
|
429
|
-
t instanceof Promise && t.catch((n) => {
|
|
430
|
-
console.error(`[GraphtyLogger] Error disposing sink "${e.name}":`, n);
|
|
431
|
-
});
|
|
432
|
-
} catch (t) {
|
|
433
|
-
console.error(`[GraphtyLogger] Error disposing sink "${e.name}":`, t);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
function Q(e, t) {
|
|
437
|
-
return e.level !== void 0 && t.level > e.level ? !1 : e.categories !== void 0 && e.categories.length > 0 ? e.categories.some((n) => t.category.includes(n)) : !0;
|
|
438
|
-
}
|
|
439
|
-
function ee(e) {
|
|
440
|
-
e.data && Object.freeze(e.data), Object.freeze(e);
|
|
441
|
-
for (const t of m.values())
|
|
442
|
-
if (Q(t, e))
|
|
443
|
-
try {
|
|
444
|
-
t.write(e);
|
|
445
|
-
} catch (n) {
|
|
446
|
-
console.error(`[GraphtyLogger] Error in sink "${t.name}":`, n);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
function te(e) {
|
|
450
|
-
const t = (s, r, i, u) => {
|
|
451
|
-
if (!d().enabled || !R(e) || s > O(e))
|
|
452
|
-
return;
|
|
453
|
-
const f = i ? Y(i) : void 0;
|
|
454
|
-
ee({
|
|
455
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
456
|
-
level: s,
|
|
457
|
-
category: e,
|
|
458
|
-
message: r,
|
|
459
|
-
data: f,
|
|
460
|
-
error: u
|
|
461
|
-
});
|
|
462
|
-
}, n = (s) => (r, i) => {
|
|
463
|
-
t(s, r, i);
|
|
464
|
-
}, o = (s) => d().enabled && R(e) && O(e) >= s;
|
|
465
|
-
return {
|
|
466
|
-
trace: n(c.TRACE),
|
|
467
|
-
debug: n(c.DEBUG),
|
|
468
|
-
info: n(c.INFO),
|
|
469
|
-
warn: n(c.WARN),
|
|
470
|
-
error: (s, r, i) => {
|
|
471
|
-
t(c.ERROR, s, i, r);
|
|
472
|
-
},
|
|
473
|
-
isTraceEnabled: () => o(c.TRACE),
|
|
474
|
-
isDebugEnabled: () => o(c.DEBUG)
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
function ne(e) {
|
|
478
|
-
return M({ colors: e.colors === !0 });
|
|
479
|
-
}
|
|
480
|
-
function p(e) {
|
|
481
|
-
return typeof e == "number" ? e : void 0;
|
|
482
|
-
}
|
|
483
|
-
function re(e) {
|
|
484
|
-
return L({
|
|
485
|
-
serverUrl: typeof e.serverUrl == "string" ? e.serverUrl : "",
|
|
486
|
-
sessionPrefix: typeof e.sessionPrefix == "string" ? e.sessionPrefix : void 0,
|
|
487
|
-
batchIntervalMs: p(e.batchIntervalMs),
|
|
488
|
-
maxRetries: p(e.maxRetries),
|
|
489
|
-
retryDelayMs: p(e.retryDelayMs),
|
|
490
|
-
throttleMs: p(e.throttleMs)
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
const T = /* @__PURE__ */ new Map([
|
|
494
|
-
["console", ne],
|
|
495
|
-
["remote", re]
|
|
496
|
-
]);
|
|
497
|
-
function oe() {
|
|
498
|
-
return [...T.keys(), ...U().map((e) => e.id)];
|
|
499
|
-
}
|
|
500
|
-
function se(e) {
|
|
501
|
-
throw new l({
|
|
502
|
-
code: "E_UNKNOWN_SINK",
|
|
503
|
-
message: `nothing is registered as the log destination "${e}". Register it with registerLogSink before naming it in a configuration.`,
|
|
504
|
-
source: "config",
|
|
505
|
-
details: { kind: "sink", name: e, available: oe() }
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
function ie(e) {
|
|
509
|
-
const t = e.use, n = e.options ?? {}, o = I(t);
|
|
510
|
-
if (o)
|
|
511
|
-
return o.create(E(o.descriptor.options, n, { kind: "sink", id: t }));
|
|
512
|
-
const s = T.get(t), r = j(t);
|
|
513
|
-
return (!s || !r) && se(t), s(E(r.options, n, { kind: "sink", id: t }));
|
|
514
|
-
}
|
|
515
|
-
function h(e) {
|
|
516
|
-
const t = m.get(e.name);
|
|
517
|
-
t && t !== e && A(t), m.set(e.name, e);
|
|
518
|
-
}
|
|
519
|
-
function ae(e) {
|
|
520
|
-
H(e), h(M({ colors: d().format.colors ?? !0 }));
|
|
521
|
-
const { remoteLogUrl: t } = e;
|
|
522
|
-
t && t !== k && (k = t, h(L({ serverUrl: t })));
|
|
523
|
-
for (const n of e.sinks ?? [])
|
|
524
|
-
h("write" in n ? n : ie(n));
|
|
525
|
-
return b.clear(), Promise.resolve();
|
|
526
|
-
}
|
|
527
|
-
function ce(e) {
|
|
528
|
-
const t = m.get(e);
|
|
529
|
-
return t ? (m.delete(e), A(t), e === "remote" && (k = void 0), !0) : !1;
|
|
530
|
-
}
|
|
531
|
-
function le() {
|
|
532
|
-
return Array.from(m.values());
|
|
533
|
-
}
|
|
534
|
-
async function ue() {
|
|
535
|
-
const e = [];
|
|
536
|
-
for (const t of m.values())
|
|
537
|
-
t.flush && e.push(
|
|
538
|
-
t.flush().catch((n) => {
|
|
539
|
-
console.error(`[GraphtyLogger] Error flushing sink "${t.name}":`, n);
|
|
540
|
-
})
|
|
541
|
-
);
|
|
542
|
-
await Promise.all(e);
|
|
543
|
-
}
|
|
544
|
-
function fe(e) {
|
|
545
|
-
const t = Z(e), n = b.get(t);
|
|
546
|
-
if (n)
|
|
547
|
-
return n;
|
|
548
|
-
const o = te(e);
|
|
549
|
-
return b.set(t, o), o;
|
|
550
|
-
}
|
|
551
|
-
function me() {
|
|
552
|
-
return d().enabled;
|
|
553
|
-
}
|
|
554
|
-
const Ne = {
|
|
555
|
-
/**
|
|
556
|
-
* Configure the logging system.
|
|
557
|
-
*/
|
|
558
|
-
configure: ae,
|
|
559
|
-
/**
|
|
560
|
-
* Get a logger for the specified category.
|
|
561
|
-
*/
|
|
562
|
-
getLogger: fe,
|
|
563
|
-
/**
|
|
564
|
-
* Check if logging is enabled.
|
|
565
|
-
*/
|
|
566
|
-
isEnabled: me,
|
|
567
|
-
/**
|
|
568
|
-
* Add a custom sink to the logger.
|
|
569
|
-
*/
|
|
570
|
-
addSink: h,
|
|
571
|
-
/**
|
|
572
|
-
* Remove a sink by name.
|
|
573
|
-
*/
|
|
574
|
-
removeSink: ce,
|
|
575
|
-
/**
|
|
576
|
-
* Get all registered sinks.
|
|
577
|
-
*/
|
|
578
|
-
getSinks: le,
|
|
579
|
-
/**
|
|
580
|
-
* Flush all sinks that support flushing.
|
|
581
|
-
*/
|
|
582
|
-
flush: ue,
|
|
583
|
-
/**
|
|
584
|
-
* Render a record the way the element renders its own console line.
|
|
585
|
-
*/
|
|
586
|
-
formatRecord: N
|
|
587
|
-
};
|
|
588
|
-
export {
|
|
589
|
-
Ne as G,
|
|
590
|
-
F as L,
|
|
591
|
-
U as a,
|
|
592
|
-
E as b,
|
|
593
|
-
ye as c,
|
|
594
|
-
c as d,
|
|
595
|
-
K as e,
|
|
596
|
-
S as f,
|
|
597
|
-
H as g,
|
|
598
|
-
M as h,
|
|
599
|
-
L as i,
|
|
600
|
-
N as j,
|
|
601
|
-
d as k,
|
|
602
|
-
j as l,
|
|
603
|
-
R as m,
|
|
604
|
-
ke as n,
|
|
605
|
-
be as o,
|
|
606
|
-
we as p,
|
|
607
|
-
P as q,
|
|
608
|
-
he as r
|
|
609
|
-
};
|