@utk09/ui-observability 0.2.0 → 0.3.0
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/CHANGELOG.md +32 -3
- package/README.md +30 -15
- package/dist/capture/network.d.ts +1 -1
- package/dist/constants-BmO0GRWM.cjs +2 -0
- package/dist/{constants-DkrpC_xK.cjs.map → constants-BmO0GRWM.cjs.map} +1 -1
- package/dist/{constants-NJNXpfPi.js → constants-CQr0wwbQ.js} +6 -4
- package/dist/{constants-NJNXpfPi.js.map → constants-CQr0wwbQ.js.map} +1 -1
- package/dist/constants.d.ts +8 -2
- package/dist/core/diagnostics.d.ts +1 -1
- package/dist/core/pipeline.d.ts +19 -6
- package/dist/core/runtime.d.ts +3 -1
- package/dist/core/sampling.d.ts +42 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +513 -448
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-CH9NocOC.cjs → indexeddb-storage-DeEh8Ag-.cjs} +2 -2
- package/dist/{indexeddb-storage-CH9NocOC.cjs.map → indexeddb-storage-DeEh8Ag-.cjs.map} +1 -1
- package/dist/{indexeddb-storage-DAoHV_oL.js → indexeddb-storage-bibcl7ZS.js} +2 -2
- package/dist/{indexeddb-storage-DAoHV_oL.js.map → indexeddb-storage-bibcl7ZS.js.map} +1 -1
- package/dist/models/config.d.ts +69 -2
- package/dist/transport/exit-flush.d.ts +1 -1
- package/dist/utils/platform.d.ts +7 -0
- package/dist/utils/tracing.d.ts +17 -1
- package/package.json +6 -4
- package/dist/constants-DkrpC_xK.cjs +0 -2
package/dist/index.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import { $ as e, $t as t, A as n, At as r, B as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as p, Gt as m, H as h, It as
|
|
2
|
-
import { context as St, isSpanContextValid as Ct, propagation as wt, trace as Tt } from "@opentelemetry/api";
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as p, Gt as m, H as h, It as g, J as ee, Jt as te, K as ne, Kt as re, L as _, Lt as ie, M as ae, Mt as oe, N as se, Nt as ce, O as le, Ot as ue, Pt as de, Qt as fe, R as pe, S as me, St as he, T as ge, Tt as _e, Ut as ve, V as ye, Vt as v, W as be, Wt as xe, Xt as Se, Yt as Ce, Zt as we, _ as Te, _t as Ee, a as y, an as De, at as Oe, b as ke, bt as Ae, c as je, ct as Me, d as Ne, dt as Pe, en as Fe, et as Ie, ft as Le, g as Re, gt as ze, h as Be, ht as Ve, i as He, in as Ue, it as We, j as Ge, jt as Ke, k as qe, kt as Je, l as b, lt as Ye, m as Xe, mt as Ze, n as x, nn as Qe, nt as $e, o as et, on as tt, ot as nt, p as rt, pt as it, q as at, r as ot, rn as st, rt as S, s as ct, st as lt, t as ut, tn as dt, tt as C, u as ft, ut as pt, v as mt, wt as ht, x as gt, xt as _t, yt as vt, zt as yt } from "./constants-CQr0wwbQ.js";
|
|
3
2
|
//#region src/utils/timer.ts
|
|
4
|
-
function
|
|
3
|
+
function bt(e) {
|
|
5
4
|
return Math.round((performance.now() - e) * d) / d;
|
|
6
5
|
}
|
|
7
|
-
function
|
|
8
|
-
e.logMetric(`${t}.duration`,
|
|
6
|
+
function xt(e, t, n, r, i) {
|
|
7
|
+
e.logMetric(`${t}.duration`, bt(n), "ms", "histogram", {
|
|
9
8
|
status: r,
|
|
10
9
|
...i
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
|
-
function
|
|
12
|
+
function St(e, t, n, r, i) {
|
|
14
13
|
e.error(`${t} failed`, r, {
|
|
15
|
-
"action.duration_ms":
|
|
14
|
+
"action.duration_ms": bt(n),
|
|
16
15
|
status: "FAILURE",
|
|
17
16
|
...i
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
|
-
function
|
|
19
|
+
function Ct(e, t, n, r) {
|
|
21
20
|
let i = performance.now();
|
|
22
21
|
try {
|
|
23
22
|
let a = n();
|
|
24
|
-
return
|
|
23
|
+
return xt(e, t, i, "SUCCESS", r), a;
|
|
25
24
|
} catch (n) {
|
|
26
|
-
throw
|
|
25
|
+
throw St(e, t, i, n, r), n;
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
async function
|
|
28
|
+
async function wt(e, t, n, r) {
|
|
30
29
|
let i = performance.now();
|
|
31
30
|
try {
|
|
32
31
|
let a = await n();
|
|
33
|
-
return
|
|
32
|
+
return xt(e, t, i, "SUCCESS", r), a;
|
|
34
33
|
} catch (n) {
|
|
35
|
-
throw
|
|
34
|
+
throw St(e, t, i, n, r), n;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
//#endregion
|
|
39
38
|
//#region src/core/logger.ts
|
|
40
|
-
function
|
|
39
|
+
function Tt(e) {
|
|
41
40
|
return e instanceof Error ? e : Error(String(e));
|
|
42
41
|
}
|
|
43
|
-
var
|
|
42
|
+
var w = class e {
|
|
44
43
|
runtime;
|
|
45
44
|
namespace;
|
|
46
45
|
options;
|
|
@@ -77,7 +76,7 @@ var S = class e {
|
|
|
77
76
|
logEvent = (e, t) => {
|
|
78
77
|
this.write("INFO", "event", e, t);
|
|
79
78
|
};
|
|
80
|
-
logMetric = (e, t, n =
|
|
79
|
+
logMetric = (e, t, n = ae, r = "gauge", i) => {
|
|
81
80
|
this.write("INFO", "metric", e, {
|
|
82
81
|
"metric.name": e,
|
|
83
82
|
"metric.value": t,
|
|
@@ -86,8 +85,8 @@ var S = class e {
|
|
|
86
85
|
...i
|
|
87
86
|
});
|
|
88
87
|
};
|
|
89
|
-
timeSync = (e, t, n) =>
|
|
90
|
-
timeAsync = (e, t, n) =>
|
|
88
|
+
timeSync = (e, t, n) => Ct(this, e, t, n);
|
|
89
|
+
timeAsync = (e, t, n) => wt(this, e, t, n);
|
|
91
90
|
write(e, t, n, r) {
|
|
92
91
|
if (!this.runtime.builder.isEnabled(e)) return;
|
|
93
92
|
let i = this.runtime.builder.build({
|
|
@@ -106,7 +105,7 @@ var S = class e {
|
|
|
106
105
|
}
|
|
107
106
|
writeError(e, t, n, r) {
|
|
108
107
|
if (!this.runtime.builder.isEnabled(e)) return;
|
|
109
|
-
let i = n === void 0 ? void 0 :
|
|
108
|
+
let i = n === void 0 ? void 0 : Tt(n), a = this.runtime.builder.build({
|
|
110
109
|
level: e,
|
|
111
110
|
type: "system",
|
|
112
111
|
body: t,
|
|
@@ -127,18 +126,18 @@ var S = class e {
|
|
|
127
126
|
};
|
|
128
127
|
//#endregion
|
|
129
128
|
//#region src/utils/unref.ts
|
|
130
|
-
function
|
|
129
|
+
function T(e) {
|
|
131
130
|
typeof e != "number" && e.unref?.();
|
|
132
131
|
}
|
|
133
132
|
//#endregion
|
|
134
133
|
//#region src/models/bus.ts
|
|
135
|
-
function
|
|
134
|
+
function E(e) {
|
|
136
135
|
return {
|
|
137
|
-
p:
|
|
136
|
+
p: me,
|
|
138
137
|
m: e
|
|
139
138
|
};
|
|
140
139
|
}
|
|
141
|
-
function
|
|
140
|
+
function D(e) {
|
|
142
141
|
if (typeof e != "object" || !e) return null;
|
|
143
142
|
let t = e;
|
|
144
143
|
if (t.p !== "ui-observability/1" || typeof t.m != "object" || t.m === null) return null;
|
|
@@ -147,12 +146,12 @@ function T(e) {
|
|
|
147
146
|
}
|
|
148
147
|
//#endregion
|
|
149
148
|
//#region src/bus/links.ts
|
|
150
|
-
var
|
|
151
|
-
function
|
|
149
|
+
var Et = Symbol.for(ie);
|
|
150
|
+
function Dt(e, t) {
|
|
152
151
|
if (typeof window > "u" || window.parent === window) return null;
|
|
153
152
|
let n;
|
|
154
153
|
try {
|
|
155
|
-
n = window.parent[
|
|
154
|
+
n = window.parent[Et];
|
|
156
155
|
} catch {
|
|
157
156
|
return null;
|
|
158
157
|
}
|
|
@@ -170,10 +169,10 @@ function Nt(e, t) {
|
|
|
170
169
|
}
|
|
171
170
|
};
|
|
172
171
|
}
|
|
173
|
-
function
|
|
172
|
+
function Ot(e, t) {
|
|
174
173
|
if (typeof window > "u" || window.parent === window) return null;
|
|
175
174
|
let n = (t) => {
|
|
176
|
-
let n =
|
|
175
|
+
let n = D(t.data);
|
|
177
176
|
n && t.source === window.parent && e(n, {
|
|
178
177
|
link: "parent",
|
|
179
178
|
origin: t.origin
|
|
@@ -183,7 +182,7 @@ function Pt(e, t) {
|
|
|
183
182
|
kind: "parent",
|
|
184
183
|
post(e) {
|
|
185
184
|
t.guard("bus.send_failed", "postMessage to parent", () => {
|
|
186
|
-
window.parent.postMessage(
|
|
185
|
+
window.parent.postMessage(E(e), "*");
|
|
187
186
|
});
|
|
188
187
|
},
|
|
189
188
|
close() {
|
|
@@ -191,10 +190,10 @@ function Pt(e, t) {
|
|
|
191
190
|
}
|
|
192
191
|
};
|
|
193
192
|
}
|
|
194
|
-
function
|
|
193
|
+
function kt(e, t, n) {
|
|
195
194
|
if (typeof window > "u") return null;
|
|
196
|
-
let r = /* @__PURE__ */ new Set([window.location.origin, ...t]), i = /* @__PURE__ */ new
|
|
197
|
-
let a =
|
|
195
|
+
let r = /* @__PURE__ */ new Set([window.location.origin, ...t]), i = /* @__PURE__ */ new Map(), a = (t) => {
|
|
196
|
+
let a = D(t.data);
|
|
198
197
|
if (a) {
|
|
199
198
|
if (!r.has(t.origin)) {
|
|
200
199
|
n.report("bus.untrusted_origin", `ignored a bus message from ${t.origin}. Add it to bus.trustedOrigins if it is yours.`, {
|
|
@@ -203,7 +202,7 @@ function Ft(e, t, n) {
|
|
|
203
202
|
});
|
|
204
203
|
return;
|
|
205
204
|
}
|
|
206
|
-
t.source && i.
|
|
205
|
+
t.source && i.set(t.source, t.origin), e(a, {
|
|
207
206
|
link: "children",
|
|
208
207
|
origin: t.origin
|
|
209
208
|
});
|
|
@@ -212,14 +211,14 @@ function Ft(e, t, n) {
|
|
|
212
211
|
return addEventListener("message", a), {
|
|
213
212
|
kind: "children",
|
|
214
213
|
post(e) {
|
|
215
|
-
for (let t of i) {
|
|
216
|
-
let
|
|
217
|
-
if (
|
|
214
|
+
for (let [t, r] of i) {
|
|
215
|
+
let a = t;
|
|
216
|
+
if (a.closed) {
|
|
218
217
|
i.delete(t);
|
|
219
218
|
continue;
|
|
220
219
|
}
|
|
221
220
|
n.guard("bus.send_failed", "postMessage to child", () => {
|
|
222
|
-
|
|
221
|
+
a.postMessage(E(e), r);
|
|
223
222
|
});
|
|
224
223
|
}
|
|
225
224
|
},
|
|
@@ -228,12 +227,12 @@ function Ft(e, t, n) {
|
|
|
228
227
|
}
|
|
229
228
|
};
|
|
230
229
|
}
|
|
231
|
-
function
|
|
230
|
+
function At(e, t, n) {
|
|
232
231
|
let r = globalThis.BroadcastChannel;
|
|
233
232
|
if (r === void 0) return null;
|
|
234
233
|
let i = n.guard("bus.send_failed", "opening BroadcastChannel", () => new r(e));
|
|
235
234
|
return i ? (i.onmessage = (e) => {
|
|
236
|
-
let n =
|
|
235
|
+
let n = D(e.data);
|
|
237
236
|
n && t(n, {
|
|
238
237
|
link: "broadcast",
|
|
239
238
|
origin: "same-origin"
|
|
@@ -242,7 +241,7 @@ function It(e, t, n) {
|
|
|
242
241
|
kind: "broadcast",
|
|
243
242
|
post(e) {
|
|
244
243
|
n.guard("bus.send_failed", "BroadcastChannel.postMessage", () => {
|
|
245
|
-
i.postMessage(
|
|
244
|
+
i.postMessage(E(e));
|
|
246
245
|
});
|
|
247
246
|
},
|
|
248
247
|
close() {
|
|
@@ -252,10 +251,10 @@ function It(e, t, n) {
|
|
|
252
251
|
}
|
|
253
252
|
}) : null;
|
|
254
253
|
}
|
|
255
|
-
function
|
|
254
|
+
function jt(e, t, n) {
|
|
256
255
|
let r = globalThis.fin?.InterApplicationBus;
|
|
257
256
|
return r ? (n.guardAsync("bus.send_failed", "InterApplicationBus.subscribe", () => r.subscribe({ uuid: "*" }, e, (e) => {
|
|
258
|
-
let n =
|
|
257
|
+
let n = D(e);
|
|
259
258
|
n && t(n, {
|
|
260
259
|
link: "openfin",
|
|
261
260
|
origin: "openfin"
|
|
@@ -263,15 +262,15 @@ function Lt(e, t, n) {
|
|
|
263
262
|
})), {
|
|
264
263
|
kind: "openfin",
|
|
265
264
|
post(t) {
|
|
266
|
-
n.guardAsync("bus.send_failed", "InterApplicationBus.publish", () => r.publish(e,
|
|
265
|
+
n.guardAsync("bus.send_failed", "InterApplicationBus.publish", () => r.publish(e, E(t)));
|
|
267
266
|
},
|
|
268
267
|
close() {}
|
|
269
268
|
}) : null;
|
|
270
269
|
}
|
|
271
|
-
function
|
|
270
|
+
function Mt(e, t) {
|
|
272
271
|
let n = globalThis, r = n.postMessage;
|
|
273
272
|
return n.WorkerGlobalScope === void 0 || !r ? null : (n.addEventListener?.("message", (t) => {
|
|
274
|
-
let n =
|
|
273
|
+
let n = D(t.data);
|
|
275
274
|
n && e(n, {
|
|
276
275
|
link: "owner",
|
|
277
276
|
origin: "same-origin"
|
|
@@ -280,15 +279,15 @@ function Rt(e, t) {
|
|
|
280
279
|
kind: "owner",
|
|
281
280
|
post(e) {
|
|
282
281
|
t.guard("bus.send_failed", "worker postMessage", () => {
|
|
283
|
-
r(
|
|
282
|
+
r(E(e));
|
|
284
283
|
});
|
|
285
284
|
},
|
|
286
285
|
close() {}
|
|
287
286
|
});
|
|
288
287
|
}
|
|
289
|
-
function
|
|
288
|
+
function Nt(e, t, n) {
|
|
290
289
|
let r = (e) => {
|
|
291
|
-
let n =
|
|
290
|
+
let n = D(e.data);
|
|
292
291
|
n && t(n, {
|
|
293
292
|
link: "worker",
|
|
294
293
|
origin: "same-origin"
|
|
@@ -298,7 +297,7 @@ function zt(e, t, n) {
|
|
|
298
297
|
kind: "worker",
|
|
299
298
|
post(t) {
|
|
300
299
|
n.guard("bus.send_failed", "postMessage to a worker", () => {
|
|
301
|
-
e.postMessage(
|
|
300
|
+
e.postMessage(E(t));
|
|
302
301
|
});
|
|
303
302
|
},
|
|
304
303
|
close() {
|
|
@@ -308,14 +307,14 @@ function zt(e, t, n) {
|
|
|
308
307
|
}
|
|
309
308
|
//#endregion
|
|
310
309
|
//#region src/bus/bus.ts
|
|
311
|
-
var
|
|
312
|
-
timeoutMs:
|
|
310
|
+
var Pt = {
|
|
311
|
+
timeoutMs: gt,
|
|
313
312
|
maxAttempts: 3
|
|
314
|
-
},
|
|
313
|
+
}, Ft = [
|
|
315
314
|
"children",
|
|
316
315
|
"direct",
|
|
317
316
|
"worker"
|
|
318
|
-
],
|
|
317
|
+
], It = class {
|
|
319
318
|
config;
|
|
320
319
|
diagnostics;
|
|
321
320
|
platform;
|
|
@@ -330,7 +329,7 @@ var Bt = {
|
|
|
330
329
|
isOpenFinProvider = !1;
|
|
331
330
|
resolved = !1;
|
|
332
331
|
awaitingWelcome = null;
|
|
333
|
-
constructor(e, t, n, r, i, a, o =
|
|
332
|
+
constructor(e, t, n, r, i, a, o = Pt) {
|
|
334
333
|
this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a, this.handshakeOptions = o;
|
|
335
334
|
}
|
|
336
335
|
getRole() {
|
|
@@ -344,7 +343,7 @@ var Bt = {
|
|
|
344
343
|
if (e.mode === "off") return this.role = "sender", this.resolved = !0, this.role;
|
|
345
344
|
if (this.isOpenFinProvider = this.resolveOpenFinProvider(), e.mode === "sender" || e.mode === "forwarder") return this.role = e.mode, this.openControlLinks(), this.role === "forwarder" && (this.upstream = this.candidateUpstream(), this.upstream || this.diagnostics.report("bus.no_owner", "bus.mode is \"forwarder\" but there is no owner to forward to. Records will be dropped.")), this.resolved = !0, this.announce(), this.role;
|
|
346
345
|
this.openControlLinks();
|
|
347
|
-
let t =
|
|
346
|
+
let t = Dt(this.receive, this.diagnostics);
|
|
348
347
|
if (t) return this.role = "forwarder", this.upstream = t, this.resolved = !0, this.diagnostics.report("bus.role_resolved", "attached directly to the same-origin parent runtime", {
|
|
349
348
|
role: "forwarder",
|
|
350
349
|
via: "direct"
|
|
@@ -395,7 +394,7 @@ var Bt = {
|
|
|
395
394
|
this.receive(e, n);
|
|
396
395
|
}
|
|
397
396
|
attachWorker(e) {
|
|
398
|
-
this.links.push(
|
|
397
|
+
this.links.push(Nt(e, this.receive, this.diagnostics));
|
|
399
398
|
}
|
|
400
399
|
broadcastJourney(e) {
|
|
401
400
|
this.post({
|
|
@@ -450,7 +449,7 @@ var Bt = {
|
|
|
450
449
|
}
|
|
451
450
|
};
|
|
452
451
|
canOwn(e) {
|
|
453
|
-
return this.role === "sender" ? e === "openfin" ? this.isOpenFinProvider :
|
|
452
|
+
return this.role === "sender" ? e === "openfin" ? this.isOpenFinProvider : Ft.includes(e) : !1;
|
|
454
453
|
}
|
|
455
454
|
resolveOpenFinProvider() {
|
|
456
455
|
let e = this.config.bus.openFinRole;
|
|
@@ -471,16 +470,16 @@ var Bt = {
|
|
|
471
470
|
}
|
|
472
471
|
}
|
|
473
472
|
candidateUpstream() {
|
|
474
|
-
return this.platform.isWorker ?
|
|
473
|
+
return this.platform.isWorker ? Mt(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : Ot(this.receive, this.diagnostics);
|
|
475
474
|
}
|
|
476
475
|
openControlLinks() {
|
|
477
476
|
let e = (e) => {
|
|
478
477
|
e && this.links.push(e);
|
|
479
478
|
};
|
|
480
|
-
this.platform.isTopLevelDocument && (e(
|
|
479
|
+
this.platform.isTopLevelDocument && (e(kt(this.receive, this.config.bus.trustedOrigins, this.diagnostics)), e(At(ke, this.receive, this.diagnostics))), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
|
|
481
480
|
}
|
|
482
481
|
ensureOpenFinLink() {
|
|
483
|
-
return this.openFinLink ??=
|
|
482
|
+
return this.openFinLink ??= jt(ke, this.receive, this.diagnostics), this.openFinLink;
|
|
484
483
|
}
|
|
485
484
|
handshake(e) {
|
|
486
485
|
return new Promise((t) => {
|
|
@@ -494,7 +493,7 @@ var Bt = {
|
|
|
494
493
|
let i = setTimeout(() => {
|
|
495
494
|
r(!1);
|
|
496
495
|
}, this.handshakeOptions.timeoutMs);
|
|
497
|
-
|
|
496
|
+
T(i), e.post({
|
|
498
497
|
t: "hello",
|
|
499
498
|
from: this.contextId,
|
|
500
499
|
tabId: this.tabId
|
|
@@ -511,7 +510,51 @@ var Bt = {
|
|
|
511
510
|
from: this.contextId
|
|
512
511
|
});
|
|
513
512
|
}
|
|
514
|
-
},
|
|
513
|
+
}, O = null;
|
|
514
|
+
function k(e, t) {
|
|
515
|
+
let n = e[t];
|
|
516
|
+
return n !== void 0 && e instanceof n;
|
|
517
|
+
}
|
|
518
|
+
function Lt(e) {
|
|
519
|
+
if (O) return O;
|
|
520
|
+
let t = globalThis, n = t.navigator?.userAgent ?? "", r = "browser", i, a, o = !1, s = t.fin?.me;
|
|
521
|
+
return k(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", o = !0) : k(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", o = !0) : k(t, "WorkerGlobalScope") ? (r = "web_worker", o = !0) : s === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 || Rt(n) ? r = "mobile_webview" : typeof document > "u" && typeof process < "u" && (r = "node") : (r = Ve.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "reading fin.me.identity", () => {
|
|
522
|
+
let e = s.identity;
|
|
523
|
+
i = e?.uuid, a = e?.name;
|
|
524
|
+
})), O = {
|
|
525
|
+
platform: r,
|
|
526
|
+
openfinUuid: i,
|
|
527
|
+
openfinName: a,
|
|
528
|
+
userAgent: n,
|
|
529
|
+
isWorker: o,
|
|
530
|
+
isTopLevelDocument: zt()
|
|
531
|
+
}, O;
|
|
532
|
+
}
|
|
533
|
+
function Rt(t) {
|
|
534
|
+
return ut.test(t) ? !0 : (e.test(t) || lt.test(t) && pt.test(t)) && t.includes("AppleWebKit") && !t.includes("Safari/");
|
|
535
|
+
}
|
|
536
|
+
function zt() {
|
|
537
|
+
if (typeof window > "u") return !1;
|
|
538
|
+
try {
|
|
539
|
+
return window.self === window.top;
|
|
540
|
+
} catch {
|
|
541
|
+
return !1;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function Bt() {
|
|
545
|
+
try {
|
|
546
|
+
return typeof location < "u" ? location.href : "";
|
|
547
|
+
} catch {
|
|
548
|
+
return "";
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function A(e) {
|
|
552
|
+
let t = e.search(/[?#]/);
|
|
553
|
+
return t === -1 ? e : e.slice(0, t);
|
|
554
|
+
}
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region src/capture/errors.ts
|
|
557
|
+
var Vt = class {
|
|
515
558
|
ctx;
|
|
516
559
|
name = "errors";
|
|
517
560
|
installed = !1;
|
|
@@ -531,13 +574,14 @@ var Bt = {
|
|
|
531
574
|
let t = e.target, n = t?.src ?? t?.href ?? "";
|
|
532
575
|
if (t !== null && t !== globalThis && n !== "") {
|
|
533
576
|
if (!this.ctx.config.capture.resourceErrors) return;
|
|
577
|
+
let e = this.ctx.config.capture.fullUrls ? n : A(n);
|
|
534
578
|
this.ctx.breadcrumbs.push({
|
|
535
579
|
t: Date.now(),
|
|
536
580
|
category: "http",
|
|
537
|
-
message: `resource failed: ${
|
|
581
|
+
message: `resource failed: ${e}`
|
|
538
582
|
}), this.ctx.logger.warn("resource failed to load", {
|
|
539
583
|
"error.type": "resource",
|
|
540
|
-
"resource.url":
|
|
584
|
+
"resource.url": e,
|
|
541
585
|
"resource.tag": t.tagName.toLowerCase()
|
|
542
586
|
});
|
|
543
587
|
return;
|
|
@@ -581,7 +625,7 @@ var Bt = {
|
|
|
581
625
|
};
|
|
582
626
|
//#endregion
|
|
583
627
|
//#region src/capture/interactions.ts
|
|
584
|
-
function
|
|
628
|
+
function Ht(e) {
|
|
585
629
|
if (e === null) return "unknown";
|
|
586
630
|
let t = e.tagName.toLowerCase(), n = e.getAttribute("data-testid") ?? e.getAttribute("data-test-id");
|
|
587
631
|
if (n !== null) return `[data-testid="${n}"]`;
|
|
@@ -591,10 +635,10 @@ function Wt(e) {
|
|
|
591
635
|
let i = e.getAttribute("class")?.trim() ?? "";
|
|
592
636
|
return i === "" ? t : `${t}.${i.split(/\s+/).slice(0, 2).join(".")}`;
|
|
593
637
|
}
|
|
594
|
-
function
|
|
638
|
+
function j() {
|
|
595
639
|
return history;
|
|
596
640
|
}
|
|
597
|
-
var
|
|
641
|
+
var Ut = class {
|
|
598
642
|
ctx;
|
|
599
643
|
name = "interactions";
|
|
600
644
|
installed = !1;
|
|
@@ -608,10 +652,10 @@ var Gt = class {
|
|
|
608
652
|
this.installed || typeof document > "u" || (this.installed = !0, this.lastUrl = location.href, this.ctx.config.capture.interactions && addEventListener("click", this.onClick, !0), this.ctx.config.capture.navigation && (this.installHistory(), addEventListener("popstate", this.onNavigate), addEventListener("hashchange", this.onNavigate)));
|
|
609
653
|
}
|
|
610
654
|
uninstall() {
|
|
611
|
-
this.installed && (this.installed = !1, removeEventListener("click", this.onClick, !0), removeEventListener("popstate", this.onNavigate), removeEventListener("hashchange", this.onNavigate), this.originalPushState && (
|
|
655
|
+
this.installed && (this.installed = !1, removeEventListener("click", this.onClick, !0), removeEventListener("popstate", this.onNavigate), removeEventListener("hashchange", this.onNavigate), this.originalPushState && (j().pushState = this.originalPushState), this.originalReplaceState && (j().replaceState = this.originalReplaceState), this.originalPushState = null, this.originalReplaceState = null);
|
|
612
656
|
}
|
|
613
657
|
onClick = (e) => {
|
|
614
|
-
let t = e.target, n =
|
|
658
|
+
let t = e.target, n = Ht(t instanceof Element ? t : null), r = t instanceof HTMLElement ? t.innerText.trim().slice(0, 50) : "";
|
|
615
659
|
this.ctx.tracing.rotate("interaction"), this.ctx.breadcrumbs.push({
|
|
616
660
|
t: Date.now(),
|
|
617
661
|
category: "click",
|
|
@@ -621,15 +665,18 @@ var Gt = class {
|
|
|
621
665
|
};
|
|
622
666
|
onNavigate = () => {
|
|
623
667
|
let e = this.lastUrl, t = location.href;
|
|
624
|
-
|
|
668
|
+
if (e === t) return;
|
|
669
|
+
this.lastUrl = t;
|
|
670
|
+
let n = this.ctx.config.capture.fullUrls, r = n ? e : A(e), i = n ? t : A(t);
|
|
671
|
+
this.ctx.tracing.rotate("navigation"), this.ctx.breadcrumbs.push({
|
|
625
672
|
t: Date.now(),
|
|
626
673
|
category: "navigation",
|
|
627
|
-
message: `${
|
|
628
|
-
}), this.ctx.logger.logEvent("NAVIGATION", { "page.url.previous":
|
|
674
|
+
message: `${r} -> ${i}`
|
|
675
|
+
}), this.ctx.logger.logEvent("NAVIGATION", { "page.url.previous": r });
|
|
629
676
|
};
|
|
630
677
|
installHistory() {
|
|
631
678
|
if (typeof history > "u" || this.originalPushState) return;
|
|
632
|
-
let e =
|
|
679
|
+
let e = j(), t = e.pushState, n = e.replaceState;
|
|
633
680
|
this.originalPushState = t, this.originalReplaceState = n;
|
|
634
681
|
let r = this.onNavigate;
|
|
635
682
|
e.pushState = function(...e) {
|
|
@@ -641,15 +688,15 @@ var Gt = class {
|
|
|
641
688
|
};
|
|
642
689
|
//#endregion
|
|
643
690
|
//#region src/capture/types.ts
|
|
644
|
-
function
|
|
691
|
+
function Wt(e, t) {
|
|
645
692
|
return t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
|
|
646
693
|
}
|
|
647
694
|
//#endregion
|
|
648
695
|
//#region src/capture/network.ts
|
|
649
|
-
function
|
|
696
|
+
function M() {
|
|
650
697
|
return XMLHttpRequest.prototype;
|
|
651
698
|
}
|
|
652
|
-
var
|
|
699
|
+
var Gt = class {
|
|
653
700
|
ctx;
|
|
654
701
|
name = "network";
|
|
655
702
|
originalFetch = null;
|
|
@@ -662,10 +709,10 @@ var qt = class {
|
|
|
662
709
|
this.ctx.config.capture.fetch && this.installFetch(), this.ctx.config.capture.xhr && this.installXhr();
|
|
663
710
|
}
|
|
664
711
|
uninstall() {
|
|
665
|
-
this.originalFetch &&= (globalThis.fetch = this.originalFetch, null), this.originalOpen &&= (
|
|
712
|
+
this.originalFetch &&= (globalThis.fetch = this.originalFetch, null), this.originalOpen &&= (M().open = this.originalOpen, null), this.originalSend &&= (M().send = this.originalSend, null);
|
|
666
713
|
}
|
|
667
714
|
ignored(e) {
|
|
668
|
-
return
|
|
715
|
+
return Wt(e, this.ctx.config.capture.ignoreUrls);
|
|
669
716
|
}
|
|
670
717
|
installFetch() {
|
|
671
718
|
if (typeof globalThis.fetch != "function" || this.originalFetch) return;
|
|
@@ -678,7 +725,7 @@ var qt = class {
|
|
|
678
725
|
let o = typeof i == "string" ? i : i instanceof URL ? i.href : i.url, s = (a?.method ?? (i instanceof Request ? i.method : "GET")).toUpperCase();
|
|
679
726
|
if (n(o)) return e(i, a);
|
|
680
727
|
let c = i, l = a;
|
|
681
|
-
if (
|
|
728
|
+
if (Wt(o, t.config.capture.propagateTraceHeaderTo)) try {
|
|
682
729
|
let e = Object.entries(t.tracing.headers());
|
|
683
730
|
if (i instanceof Request) {
|
|
684
731
|
let t = new Headers(i.headers);
|
|
@@ -708,7 +755,7 @@ var qt = class {
|
|
|
708
755
|
if (typeof XMLHttpRequest > "u" || this.originalOpen) return;
|
|
709
756
|
let e = (e) => this.ignored(e), t = (e, t, n, r) => {
|
|
710
757
|
this.record(e, t, n, r, void 0);
|
|
711
|
-
}, n =
|
|
758
|
+
}, n = M(), r = n.open, i = n.send;
|
|
712
759
|
this.originalOpen = r, this.originalSend = i, n.open = function(e, t, ...n) {
|
|
713
760
|
this.__uiobs = {
|
|
714
761
|
method: e.toUpperCase(),
|
|
@@ -727,41 +774,42 @@ var qt = class {
|
|
|
727
774
|
};
|
|
728
775
|
}
|
|
729
776
|
record(e, t, n, r, i) {
|
|
730
|
-
this.ctx.
|
|
731
|
-
|
|
777
|
+
let a = this.ctx.config.capture.fullUrls ? t : A(t);
|
|
778
|
+
this.ctx.diagnostics.guard("capture.record_failed", `recording ${e} ${a}`, () => {
|
|
779
|
+
let t = Math.round(r);
|
|
732
780
|
this.ctx.breadcrumbs.push({
|
|
733
781
|
t: Date.now(),
|
|
734
782
|
category: "http",
|
|
735
|
-
message: `${e} ${
|
|
736
|
-
data: { durationMs:
|
|
783
|
+
message: `${e} ${a} ${n === 0 ? "failed" : String(n)}`,
|
|
784
|
+
data: { durationMs: t }
|
|
737
785
|
});
|
|
738
786
|
let o = {
|
|
739
787
|
"http.request.method": e,
|
|
740
|
-
"url.full":
|
|
788
|
+
"url.full": a,
|
|
741
789
|
"http.response.status_code": n,
|
|
742
|
-
"http.duration_ms":
|
|
790
|
+
"http.duration_ms": t
|
|
743
791
|
};
|
|
744
792
|
if (n === 0) {
|
|
745
|
-
this.ctx.logger.error(`${e} ${
|
|
793
|
+
this.ctx.logger.error(`${e} ${a} failed`, i, o);
|
|
746
794
|
return;
|
|
747
795
|
}
|
|
748
796
|
if (n >= 400) {
|
|
749
|
-
this.ctx.logger.warn(`${e} ${
|
|
797
|
+
this.ctx.logger.warn(`${e} ${a} returned ${String(n)}`, o);
|
|
750
798
|
return;
|
|
751
799
|
}
|
|
752
|
-
this.ctx.logger.debug(`${e} ${
|
|
800
|
+
this.ctx.logger.debug(`${e} ${a}`, o);
|
|
753
801
|
});
|
|
754
802
|
}
|
|
755
803
|
};
|
|
756
804
|
//#endregion
|
|
757
805
|
//#region src/capture/web-vitals.ts
|
|
758
|
-
function
|
|
806
|
+
function Kt() {
|
|
759
807
|
return import(
|
|
760
808
|
/* @vite-ignore */
|
|
761
809
|
"web-vitals"
|
|
762
810
|
);
|
|
763
811
|
}
|
|
764
|
-
var
|
|
812
|
+
var qt = class {
|
|
765
813
|
ctx;
|
|
766
814
|
name = "web-vitals";
|
|
767
815
|
installed = !1;
|
|
@@ -775,7 +823,7 @@ var Yt = class {
|
|
|
775
823
|
this.installed = !1;
|
|
776
824
|
}
|
|
777
825
|
async loadWebVitals() {
|
|
778
|
-
let e = this.ctx.config.capture.webVitalsLoader ??
|
|
826
|
+
let e = this.ctx.config.capture.webVitalsLoader ?? Kt, t = await this.ctx.diagnostics.guardAsync("capture.install_failed", "loading web-vitals", e);
|
|
779
827
|
if (!t) {
|
|
780
828
|
this.ctx.diagnostics.report("capture.install_failed", "web-vitals is not available, so LCP, CLS and INP are unavailable. Navigation timing still works.");
|
|
781
829
|
return;
|
|
@@ -807,38 +855,38 @@ var Yt = class {
|
|
|
807
855
|
};
|
|
808
856
|
//#endregion
|
|
809
857
|
//#region src/models/log-record.ts
|
|
810
|
-
function
|
|
858
|
+
function Jt() {
|
|
811
859
|
return `${String(Date.now())}000000`;
|
|
812
860
|
}
|
|
813
|
-
function
|
|
861
|
+
function Yt(e) {
|
|
814
862
|
if (typeof e != "object" || !e) return !1;
|
|
815
863
|
let t = e;
|
|
816
864
|
return typeof t.body == "string" && typeof t.severityText == "string" && typeof t.timeUnixNano == "string" && typeof t.attributes == "object" && t.attributes !== null && typeof t.resource == "object" && t.resource !== null;
|
|
817
865
|
}
|
|
818
866
|
//#endregion
|
|
819
867
|
//#region src/utils/identity.ts
|
|
820
|
-
function
|
|
868
|
+
function N(e) {
|
|
821
869
|
let t = new Uint8Array(e);
|
|
822
870
|
if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") crypto.getRandomValues(t);
|
|
823
871
|
else for (let n = 0; n < e; n++) t[n] = Math.floor(Math.random() * 256);
|
|
824
872
|
return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
825
873
|
}
|
|
826
|
-
function
|
|
874
|
+
function P() {
|
|
827
875
|
try {
|
|
828
876
|
if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
|
|
829
877
|
} catch {}
|
|
830
|
-
return
|
|
878
|
+
return N(16);
|
|
831
879
|
}
|
|
832
880
|
function Xt(e, t, n) {
|
|
833
881
|
return n.guard("storage.unavailable", `reading ${e}Storage`, () => (e === "local" ? localStorage : sessionStorage).getItem(t)) ?? null;
|
|
834
882
|
}
|
|
835
|
-
function
|
|
883
|
+
function F(e, t, n, r) {
|
|
836
884
|
r.guard("storage.unavailable", `writing ${e}Storage`, () => {
|
|
837
885
|
(e === "local" ? localStorage : sessionStorage).setItem(t, n);
|
|
838
886
|
});
|
|
839
887
|
}
|
|
840
888
|
function Zt(e) {
|
|
841
|
-
let t =
|
|
889
|
+
let t = P(), n = Date.now(), r = P(), i = Xt("local", v, e);
|
|
842
890
|
if (i) try {
|
|
843
891
|
let e = JSON.parse(i);
|
|
844
892
|
e.id && n - (e.lastSeenAt ?? 0) < 18e5 && (r = e.id);
|
|
@@ -849,9 +897,9 @@ function Zt(e) {
|
|
|
849
897
|
id: r,
|
|
850
898
|
lastSeenAt: n
|
|
851
899
|
});
|
|
852
|
-
|
|
900
|
+
F("local", v, a, e);
|
|
853
901
|
let o = Xt("session", "ui-observability.tab", e) ?? "";
|
|
854
|
-
return o || (o =
|
|
902
|
+
return o || (o = P(), F("session", fe, o, e)), {
|
|
855
903
|
sessionId: r,
|
|
856
904
|
tabId: o,
|
|
857
905
|
contextId: t
|
|
@@ -866,7 +914,7 @@ function $t(e, t) {
|
|
|
866
914
|
id: e,
|
|
867
915
|
lastSeenAt: n
|
|
868
916
|
});
|
|
869
|
-
|
|
917
|
+
F("local", v, r, t);
|
|
870
918
|
}
|
|
871
919
|
//#endregion
|
|
872
920
|
//#region src/models/batch.ts
|
|
@@ -878,7 +926,7 @@ function en(e) {
|
|
|
878
926
|
function tn(e) {
|
|
879
927
|
if (e.records.length < 2) return null;
|
|
880
928
|
let t = Math.floor(e.records.length / 2), n = (t) => ({
|
|
881
|
-
id:
|
|
929
|
+
id: P(),
|
|
882
930
|
records: t,
|
|
883
931
|
createdAt: e.createdAt,
|
|
884
932
|
attempts: e.attempts
|
|
@@ -893,7 +941,7 @@ function nn(e, t, n, { skipIfBusy: r = !0 } = {}) {
|
|
|
893
941
|
}
|
|
894
942
|
//#endregion
|
|
895
943
|
//#region src/storage/keys.ts
|
|
896
|
-
function
|
|
944
|
+
function I(e, t) {
|
|
897
945
|
let n = [];
|
|
898
946
|
return t.guard("storage.unavailable", "enumerating localStorage", () => {
|
|
899
947
|
for (let t = 0; t < localStorage.length; t++) {
|
|
@@ -906,7 +954,7 @@ function N(e, t) {
|
|
|
906
954
|
//#region src/storage/emergency-queue.ts
|
|
907
955
|
function rn(e) {
|
|
908
956
|
let t = String(e.createdAt).padStart(14, "0");
|
|
909
|
-
return `${
|
|
957
|
+
return `${_}${t}.${e.id}`;
|
|
910
958
|
}
|
|
911
959
|
function an(e, t) {
|
|
912
960
|
let n = t.guard("storage.degraded", "an emergency entry was not JSON and was dropped", () => JSON.parse(e));
|
|
@@ -914,7 +962,7 @@ function an(e, t) {
|
|
|
914
962
|
}
|
|
915
963
|
async function on(e, t) {
|
|
916
964
|
let n = 0;
|
|
917
|
-
for (let r of
|
|
965
|
+
for (let r of I(_, t)) {
|
|
918
966
|
let i = t.guard("storage.unavailable", "reading the emergency queue", () => {
|
|
919
967
|
let e = localStorage.getItem(r);
|
|
920
968
|
return localStorage.removeItem(r), e;
|
|
@@ -932,7 +980,7 @@ async function on(e, t) {
|
|
|
932
980
|
function sn(e, t) {
|
|
933
981
|
let n = `writing the emergency queue, ${String(e.records.length)} records`;
|
|
934
982
|
t.guard("storage.quota_exceeded", n, () => {
|
|
935
|
-
let n =
|
|
983
|
+
let n = I(_, t);
|
|
936
984
|
for (let e of n.slice(0, Math.max(0, n.length - 20 + 1))) localStorage.removeItem(e);
|
|
937
985
|
localStorage.setItem(rn(e), JSON.stringify(e));
|
|
938
986
|
});
|
|
@@ -944,13 +992,13 @@ async function cn(e, t) {
|
|
|
944
992
|
//#region src/storage/local-storage.ts
|
|
945
993
|
function ln(e) {
|
|
946
994
|
let t = String(e.createdAt).padStart(14, "0");
|
|
947
|
-
return `${
|
|
995
|
+
return `${mt}${t}.${e.id}`;
|
|
948
996
|
}
|
|
949
997
|
var un = class {
|
|
950
998
|
limits;
|
|
951
999
|
diagnostics;
|
|
952
1000
|
onGap;
|
|
953
|
-
name =
|
|
1001
|
+
name = te;
|
|
954
1002
|
constructor(e, t, n) {
|
|
955
1003
|
this.limits = e, this.diagnostics = t, this.onGap = n;
|
|
956
1004
|
}
|
|
@@ -1043,18 +1091,18 @@ var un = class {
|
|
|
1043
1091
|
});
|
|
1044
1092
|
}
|
|
1045
1093
|
keys() {
|
|
1046
|
-
return
|
|
1094
|
+
return I(mt, this.diagnostics);
|
|
1047
1095
|
}
|
|
1048
1096
|
};
|
|
1049
1097
|
//#endregion
|
|
1050
1098
|
//#region src/storage/memory-storage.ts
|
|
1051
|
-
function
|
|
1099
|
+
function dn(e) {
|
|
1052
1100
|
return e.reduce((e, t) => e + t.records.length, 0);
|
|
1053
1101
|
}
|
|
1054
|
-
var
|
|
1102
|
+
var L = class {
|
|
1055
1103
|
limits;
|
|
1056
1104
|
onGap;
|
|
1057
|
-
name =
|
|
1105
|
+
name = Ce;
|
|
1058
1106
|
batches = [];
|
|
1059
1107
|
constructor(e, t) {
|
|
1060
1108
|
this.limits = e, this.onGap = t;
|
|
@@ -1078,12 +1126,12 @@ var F = class {
|
|
|
1078
1126
|
records: 0,
|
|
1079
1127
|
reason: "expired"
|
|
1080
1128
|
}, n = this.batches.filter((t) => t.createdAt < e);
|
|
1081
|
-
this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records +=
|
|
1129
|
+
this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records += dn(n);
|
|
1082
1130
|
let r = this.batches.length - this.limits.maxBatches;
|
|
1083
1131
|
if (r > 0) {
|
|
1084
1132
|
t.reason = "over_capacity";
|
|
1085
1133
|
let e = this.batches.slice(0, r);
|
|
1086
|
-
this.batches = this.batches.slice(r), t.batches += e.length, t.records +=
|
|
1134
|
+
this.batches = this.batches.slice(r), t.batches += e.length, t.records += dn(e);
|
|
1087
1135
|
}
|
|
1088
1136
|
return t.batches > 0 && this.onGap?.(t), Promise.resolve(t);
|
|
1089
1137
|
}
|
|
@@ -1096,8 +1144,8 @@ var F = class {
|
|
|
1096
1144
|
close() {
|
|
1097
1145
|
return this.batches = [], Promise.resolve();
|
|
1098
1146
|
}
|
|
1099
|
-
},
|
|
1100
|
-
name:
|
|
1147
|
+
}, fn = {
|
|
1148
|
+
name: Se,
|
|
1101
1149
|
save: () => Promise.resolve(),
|
|
1102
1150
|
take: () => Promise.resolve([]),
|
|
1103
1151
|
remove: () => Promise.resolve(),
|
|
@@ -1111,112 +1159,112 @@ var F = class {
|
|
|
1111
1159
|
clear: () => Promise.resolve(),
|
|
1112
1160
|
close: () => Promise.resolve()
|
|
1113
1161
|
};
|
|
1114
|
-
function
|
|
1162
|
+
function pn(e) {
|
|
1115
1163
|
return e.guard("storage.unavailable", "reading indexedDB", () => globalThis.indexedDB != null) === !0;
|
|
1116
1164
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return e.guard("storage.unavailable", "probing localStorage", () => (localStorage.setItem(
|
|
1165
|
+
function mn(e) {
|
|
1166
|
+
return e.guard("storage.unavailable", "probing localStorage", () => (localStorage.setItem(we, "1"), localStorage.removeItem(we), !0)) === !0;
|
|
1119
1167
|
}
|
|
1120
|
-
async function
|
|
1121
|
-
if (e === "none") return
|
|
1122
|
-
if (e === "memory") return new
|
|
1168
|
+
async function hn(e, t, n, r, i) {
|
|
1169
|
+
if (e === "none") return fn;
|
|
1170
|
+
if (e === "memory") return new L(n, i);
|
|
1123
1171
|
if (e === "indexeddb" || e === "auto") {
|
|
1124
|
-
if (
|
|
1172
|
+
if (pn(r)) {
|
|
1125
1173
|
let e = await r.guardAsync("storage.unavailable", "opening IndexedDB", async () => {
|
|
1126
|
-
let { IndexedDbStorage: e } = await import("./indexeddb-storage-
|
|
1174
|
+
let { IndexedDbStorage: e } = await import("./indexeddb-storage-bibcl7ZS.js");
|
|
1127
1175
|
return new e(t, n, r, i);
|
|
1128
1176
|
});
|
|
1129
1177
|
if (e) return e;
|
|
1130
1178
|
}
|
|
1131
|
-
if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB was asked for by name and is unavailable, using memory"), new
|
|
1179
|
+
if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB was asked for by name and is unavailable, using memory"), new L(n, i);
|
|
1132
1180
|
}
|
|
1133
|
-
return
|
|
1181
|
+
return mn(r) ? new un(n, r, i) : (r.report("storage.degraded", "no persistent storage available, offline logs are memory only"), new L(n, i));
|
|
1134
1182
|
}
|
|
1135
1183
|
//#endregion
|
|
1136
1184
|
//#region src/utils/sanitize.ts
|
|
1137
|
-
function
|
|
1185
|
+
function R(e, t) {
|
|
1138
1186
|
if (e.length <= t) return e;
|
|
1139
|
-
let n =
|
|
1187
|
+
let n = gn(e.charCodeAt(t - 1)) ? t - 1 : t;
|
|
1140
1188
|
return `${e.slice(0, n)}… [truncated ${String(e.length - n)} chars]`;
|
|
1141
1189
|
}
|
|
1142
|
-
function
|
|
1190
|
+
function gn(e) {
|
|
1143
1191
|
return e >= 55296 && e <= 56319;
|
|
1144
1192
|
}
|
|
1145
|
-
function
|
|
1193
|
+
function _n(e) {
|
|
1146
1194
|
return `[Element ${(e.nodeName ?? "NODE").toLowerCase()}${e.id ? `#${e.id}` : ""}${typeof e.className == "string" && e.className ? `.${e.className.trim().split(/\s+/).slice(0, 3).join(".")}` : ""}]`;
|
|
1147
1195
|
}
|
|
1148
|
-
function
|
|
1196
|
+
function z(e, t) {
|
|
1149
1197
|
let n = { bytes: 0 };
|
|
1150
1198
|
return {
|
|
1151
|
-
value:
|
|
1199
|
+
value: V(e, t, /* @__PURE__ */ new WeakSet(), 0, n),
|
|
1152
1200
|
bytes: n.bytes
|
|
1153
1201
|
};
|
|
1154
1202
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return t.bytes +=
|
|
1203
|
+
function B(e, t) {
|
|
1204
|
+
return t.bytes += H(e) + 2, e;
|
|
1157
1205
|
}
|
|
1158
|
-
function
|
|
1206
|
+
function V(e, t, n, r, i) {
|
|
1159
1207
|
if (e == null) return i.bytes += 4, e;
|
|
1160
|
-
if (typeof e == "string") return R(
|
|
1208
|
+
if (typeof e == "string") return B(R(e, t.maxAttributeChars), i);
|
|
1161
1209
|
if (typeof e == "number") return i.bytes += 8, Number.isFinite(e) ? e : String(e);
|
|
1162
1210
|
if (typeof e == "boolean") return i.bytes += 5, e;
|
|
1163
|
-
if (typeof e == "bigint") return
|
|
1164
|
-
if (typeof e == "symbol") return
|
|
1165
|
-
if (typeof e == "function") return
|
|
1166
|
-
if (r >= t.maxDepth) return
|
|
1167
|
-
if (n.has(e)) return
|
|
1211
|
+
if (typeof e == "bigint") return B(`${e.toString()}n`, i);
|
|
1212
|
+
if (typeof e == "symbol") return B(e.toString(), i);
|
|
1213
|
+
if (typeof e == "function") return B(`[Function ${e.name === "" ? "anonymous" : e.name}]`, i);
|
|
1214
|
+
if (r >= t.maxDepth) return B("[MaxDepth]", i);
|
|
1215
|
+
if (n.has(e)) return B("[Circular]", i);
|
|
1168
1216
|
n.add(e), i.bytes += 2;
|
|
1169
1217
|
try {
|
|
1170
1218
|
if (e instanceof Error) return {
|
|
1171
|
-
name:
|
|
1172
|
-
message: R(
|
|
1173
|
-
stack: e.stack ? R(
|
|
1174
|
-
cause: e.cause ?
|
|
1219
|
+
name: B(e.name, i),
|
|
1220
|
+
message: B(R(e.message, t.maxAttributeChars), i),
|
|
1221
|
+
stack: e.stack ? B(R(e.stack, t.maxStackChars), i) : void 0,
|
|
1222
|
+
cause: e.cause ? V(e.cause, t, n, r + 1, i) : void 0
|
|
1175
1223
|
};
|
|
1176
|
-
if (e instanceof Date) return
|
|
1177
|
-
if (e instanceof RegExp) return
|
|
1224
|
+
if (e instanceof Date) return B(e.toISOString(), i);
|
|
1225
|
+
if (e instanceof RegExp) return B(e.toString(), i);
|
|
1178
1226
|
if (e instanceof Map) {
|
|
1179
1227
|
let a = e, o = {}, s = 0;
|
|
1180
1228
|
for (let [e, c] of a) {
|
|
1181
1229
|
if (s >= t.maxArrayLength) {
|
|
1182
|
-
o["…"] =
|
|
1230
|
+
o["…"] = B(`[${String(a.size - t.maxArrayLength)} more entries]`, i);
|
|
1183
1231
|
break;
|
|
1184
1232
|
}
|
|
1185
1233
|
s++;
|
|
1186
1234
|
let l = String(e);
|
|
1187
|
-
i.bytes +=
|
|
1235
|
+
i.bytes += H(l) + 4, o[l] = V(c, t, n, r + 1, i);
|
|
1188
1236
|
}
|
|
1189
1237
|
return o;
|
|
1190
1238
|
}
|
|
1191
|
-
if (e instanceof Set) return
|
|
1239
|
+
if (e instanceof Set) return V([...e].slice(0, t.maxArrayLength), t, n, r, i);
|
|
1192
1240
|
if (ArrayBuffer.isView(e)) {
|
|
1193
1241
|
let t = e.length ?? 0;
|
|
1194
|
-
return
|
|
1242
|
+
return B(`[${e.constructor.name}(${String(t)})]`, i);
|
|
1195
1243
|
}
|
|
1196
|
-
if (e instanceof Promise) return
|
|
1197
|
-
if (typeof Node < "u" && e instanceof Node) return
|
|
1244
|
+
if (e instanceof Promise) return B("[Promise]", i);
|
|
1245
|
+
if (typeof Node < "u" && e instanceof Node) return B(_n(e), i);
|
|
1198
1246
|
if (Array.isArray(e)) {
|
|
1199
|
-
let a = e, o = a.slice(0, t.maxArrayLength).map((e) =>
|
|
1200
|
-
return a.length > t.maxArrayLength && o.push(
|
|
1247
|
+
let a = e, o = a.slice(0, t.maxArrayLength).map((e) => V(e, t, n, r + 1, i));
|
|
1248
|
+
return a.length > t.maxArrayLength && o.push(B(`[${String(a.length - t.maxArrayLength)} more items]`, i)), o;
|
|
1201
1249
|
}
|
|
1202
1250
|
let a = e.toJSON;
|
|
1203
|
-
if (typeof a == "function") return
|
|
1251
|
+
if (typeof a == "function") return V(a.call(e), t, n, r + 1, i);
|
|
1204
1252
|
let o = e, s = Object.keys(o), c = {}, l = 0;
|
|
1205
1253
|
for (let e of s) {
|
|
1206
1254
|
if (l >= t.maxAttributeCount) {
|
|
1207
|
-
c["…"] =
|
|
1255
|
+
c["…"] = B(`[${String(s.length - l)} more keys]`, i);
|
|
1208
1256
|
break;
|
|
1209
1257
|
}
|
|
1210
|
-
l++, i.bytes +=
|
|
1258
|
+
l++, i.bytes += H(e) + 4, c[e] = V(o[e], t, n, r + 1, i);
|
|
1211
1259
|
}
|
|
1212
1260
|
return c;
|
|
1213
1261
|
} catch (e) {
|
|
1214
|
-
return
|
|
1262
|
+
return B(`[Unserializable: ${e instanceof Error ? e.name : "error"}]`, i);
|
|
1215
1263
|
} finally {
|
|
1216
1264
|
n.delete(e);
|
|
1217
1265
|
}
|
|
1218
1266
|
}
|
|
1219
|
-
function
|
|
1267
|
+
function H(e) {
|
|
1220
1268
|
let t = 0;
|
|
1221
1269
|
for (let n = 0; n < e.length; n++) {
|
|
1222
1270
|
let r = e.charCodeAt(n);
|
|
@@ -1226,7 +1274,7 @@ function B(e) {
|
|
|
1226
1274
|
}
|
|
1227
1275
|
//#endregion
|
|
1228
1276
|
//#region src/transport/exit-flush.ts
|
|
1229
|
-
var
|
|
1277
|
+
var vn = class {
|
|
1230
1278
|
deps;
|
|
1231
1279
|
installed = !1;
|
|
1232
1280
|
onVisibility = () => {
|
|
@@ -1263,15 +1311,15 @@ var _n = class {
|
|
|
1263
1311
|
flush(e) {
|
|
1264
1312
|
let { diagnostics: t } = this.deps, n = this.endpointUrl();
|
|
1265
1313
|
if (n === null) return;
|
|
1266
|
-
let r = this.deps.
|
|
1314
|
+
let r = this.deps.drainForExit();
|
|
1267
1315
|
if (!r || r.records.length === 0) return;
|
|
1268
1316
|
let i = t.guard("transport.serialize_failed", `the ${e} exit flush could not serialize its batch`, () => this.deps.config.serializer.serialize(r.records));
|
|
1269
1317
|
if (!i) return;
|
|
1270
|
-
if (
|
|
1318
|
+
if (H(i.body) > 6e4) {
|
|
1271
1319
|
sn(r, t);
|
|
1272
1320
|
return;
|
|
1273
1321
|
}
|
|
1274
|
-
n.searchParams.set(
|
|
1322
|
+
n.searchParams.set(ze, r.id), n.searchParams.set(Ee, e);
|
|
1275
1323
|
let a = n.toString();
|
|
1276
1324
|
this.beacon(a, i.body) || this.keepaliveFetch(a, i.body, e);
|
|
1277
1325
|
}
|
|
@@ -1291,7 +1339,7 @@ var _n = class {
|
|
|
1291
1339
|
fetch(e, {
|
|
1292
1340
|
method: "POST",
|
|
1293
1341
|
body: t,
|
|
1294
|
-
headers: { [
|
|
1342
|
+
headers: { [at]: n },
|
|
1295
1343
|
credentials: i.credentials,
|
|
1296
1344
|
keepalive: !0
|
|
1297
1345
|
}).catch((e) => {
|
|
@@ -1302,15 +1350,15 @@ var _n = class {
|
|
|
1302
1350
|
};
|
|
1303
1351
|
//#endregion
|
|
1304
1352
|
//#region src/transport/compression.ts
|
|
1305
|
-
async function
|
|
1353
|
+
async function yn(e) {
|
|
1306
1354
|
let t = globalThis.CompressionStream;
|
|
1307
1355
|
if (t === void 0) return null;
|
|
1308
|
-
let n = new Blob([e]).stream().pipeThrough(new t(
|
|
1356
|
+
let n = new Blob([e]).stream().pipeThrough(new t(pe)), r = await new Response(n).arrayBuffer();
|
|
1309
1357
|
return new Uint8Array(r);
|
|
1310
1358
|
}
|
|
1311
1359
|
//#endregion
|
|
1312
1360
|
//#region src/transport/errors.ts
|
|
1313
|
-
var
|
|
1361
|
+
var U = class extends Error {
|
|
1314
1362
|
kind;
|
|
1315
1363
|
status;
|
|
1316
1364
|
retryAfterMs;
|
|
@@ -1319,16 +1367,16 @@ var V = class extends Error {
|
|
|
1319
1367
|
super(t), this.kind = e, this.status = n, this.retryAfterMs = r, this.maxBytes = i, this.name = "TransportError";
|
|
1320
1368
|
}
|
|
1321
1369
|
};
|
|
1322
|
-
function
|
|
1370
|
+
function bn(e) {
|
|
1323
1371
|
if (!e) return;
|
|
1324
1372
|
let t = Number(e);
|
|
1325
|
-
if (Number.isFinite(t)) return Math.max(0, t *
|
|
1373
|
+
if (Number.isFinite(t)) return Math.max(0, t * Ye);
|
|
1326
1374
|
let n = Date.parse(e);
|
|
1327
1375
|
return Number.isNaN(n) ? void 0 : Math.max(0, n - Date.now());
|
|
1328
1376
|
}
|
|
1329
1377
|
//#endregion
|
|
1330
1378
|
//#region src/transport/http-transport.ts
|
|
1331
|
-
var
|
|
1379
|
+
var xn = class {
|
|
1332
1380
|
config;
|
|
1333
1381
|
diagnostics;
|
|
1334
1382
|
throttledUntil = 0;
|
|
@@ -1350,9 +1398,9 @@ var bn = class {
|
|
|
1350
1398
|
return;
|
|
1351
1399
|
}
|
|
1352
1400
|
let r = new Headers(await this.resolveHeaders());
|
|
1353
|
-
r.set(
|
|
1401
|
+
r.set(at, n.contentType), r.set(p, e.id), r.set(be, String(e.attempts));
|
|
1354
1402
|
let i = await this.encodeBody(n.body);
|
|
1355
|
-
typeof i != "string" && r.set(
|
|
1403
|
+
typeof i != "string" && r.set(ne, pe);
|
|
1356
1404
|
let a = await this.dispatch(r, i);
|
|
1357
1405
|
if (a.ok) {
|
|
1358
1406
|
this.throttledUntil = 0;
|
|
@@ -1362,13 +1410,13 @@ var bn = class {
|
|
|
1362
1410
|
}
|
|
1363
1411
|
async encodeBody(e) {
|
|
1364
1412
|
let { config: t } = this;
|
|
1365
|
-
return t.compression !== "gzip" ||
|
|
1413
|
+
return t.compression !== "gzip" || H(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "gzipping the payload", () => yn(e)) ?? e;
|
|
1366
1414
|
}
|
|
1367
1415
|
async dispatch(e, t) {
|
|
1368
1416
|
let { config: n } = this, r = new AbortController(), i = setTimeout(() => {
|
|
1369
1417
|
r.abort();
|
|
1370
|
-
},
|
|
1371
|
-
|
|
1418
|
+
}, Ae);
|
|
1419
|
+
T(i);
|
|
1372
1420
|
try {
|
|
1373
1421
|
return await fetch(n.endpoint, {
|
|
1374
1422
|
method: "POST",
|
|
@@ -1379,28 +1427,28 @@ var bn = class {
|
|
|
1379
1427
|
cache: "no-store"
|
|
1380
1428
|
});
|
|
1381
1429
|
} catch {
|
|
1382
|
-
if (r.signal.aborted) throw new
|
|
1430
|
+
if (r.signal.aborted) throw new U("timeout", `request exceeded ${String(Ae)}ms`);
|
|
1383
1431
|
let e = globalThis.navigator?.onLine;
|
|
1384
|
-
throw new
|
|
1432
|
+
throw new U(e === !1 ? "offline" : "transient", "network error");
|
|
1385
1433
|
} finally {
|
|
1386
1434
|
clearTimeout(i);
|
|
1387
1435
|
}
|
|
1388
1436
|
}
|
|
1389
1437
|
async classify(e, t) {
|
|
1390
|
-
let n = e.status, r =
|
|
1438
|
+
let n = e.status, r = bn(e.headers.get(ee));
|
|
1391
1439
|
if (n === 401 || n === 403) return this.diagnostics.report("transport.rejected_credentials", `server returned ${String(n)}. In a cross-origin iframe the session cookie is a third-party cookie and is very likely blocked. Forward to the platform document instead of promoting to sender, or issue the cookie with the Partitioned attribute.`, {
|
|
1392
1440
|
status: n,
|
|
1393
1441
|
endpoint: this.config.endpoint
|
|
1394
|
-
}), new
|
|
1395
|
-
if (n === 413) return new
|
|
1442
|
+
}), new U("permanent", `rejected with ${String(n)}`, n);
|
|
1443
|
+
if (n === 413) return new U("too_large", "payload too large", n, void 0, await this.readMaxBytes(e));
|
|
1396
1444
|
if (n === 429 || n === 503) {
|
|
1397
1445
|
let e = n === 429;
|
|
1398
|
-
return this.throttledUntil = Date.now() + (r ?? 2e3), e && this.diagnostics.report("transport.throttled", "server throttled us", { retryAfterMs: r }), new
|
|
1446
|
+
return this.throttledUntil = Date.now() + (r ?? 2e3), e && this.diagnostics.report("transport.throttled", "server throttled us", { retryAfterMs: r }), new U("throttled", e ? "throttled" : "service unavailable", n, r);
|
|
1399
1447
|
}
|
|
1400
|
-
return n === 408 || n >= 500 ? new
|
|
1448
|
+
return n === 408 || n >= 500 ? new U("transient", `server error ${String(n)}`, n) : (this.diagnostics.report("transport.dropped_permanent", `server rejected the batch with ${String(n)}, dropping it`, {
|
|
1401
1449
|
batchId: t,
|
|
1402
1450
|
status: n
|
|
1403
|
-
}), new
|
|
1451
|
+
}), new U("permanent", `rejected with ${String(n)}`, n));
|
|
1404
1452
|
}
|
|
1405
1453
|
async readMaxBytes(e) {
|
|
1406
1454
|
return this.diagnostics.guardAsync("transport.http_error", "reading the 413 body", async () => {
|
|
@@ -1412,7 +1460,7 @@ var bn = class {
|
|
|
1412
1460
|
let { headers: e } = this.config;
|
|
1413
1461
|
return e ? typeof e == "function" ? await this.diagnostics.guardAsync("transport.http_error", "headers() threw", () => Promise.resolve(e())) ?? {} : e : {};
|
|
1414
1462
|
}
|
|
1415
|
-
},
|
|
1463
|
+
}, Sn = class {
|
|
1416
1464
|
storage;
|
|
1417
1465
|
transport;
|
|
1418
1466
|
diagnostics;
|
|
@@ -1432,7 +1480,7 @@ var bn = class {
|
|
|
1432
1480
|
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(f);
|
|
1433
1481
|
}
|
|
1434
1482
|
nudge() {
|
|
1435
|
-
this.draining || this.schedule(
|
|
1483
|
+
this.draining || this.schedule(de);
|
|
1436
1484
|
}
|
|
1437
1485
|
stop() {
|
|
1438
1486
|
this.stopped = !0, typeof removeEventListener < "u" && removeEventListener("online", this.onOnline), this.clearTimer();
|
|
@@ -1443,13 +1491,13 @@ var bn = class {
|
|
|
1443
1491
|
let t = setTimeout(() => {
|
|
1444
1492
|
this.drain();
|
|
1445
1493
|
}, e);
|
|
1446
|
-
this.timer = t,
|
|
1494
|
+
this.timer = t, T(t);
|
|
1447
1495
|
}
|
|
1448
1496
|
clearTimer() {
|
|
1449
1497
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1450
1498
|
}
|
|
1451
1499
|
backoffMs() {
|
|
1452
|
-
let e = Math.min(
|
|
1500
|
+
let e = Math.min(de * 2 ** this.attempt, g);
|
|
1453
1501
|
return Math.random() * e;
|
|
1454
1502
|
}
|
|
1455
1503
|
async drain() {
|
|
@@ -1481,7 +1529,7 @@ var bn = class {
|
|
|
1481
1529
|
try {
|
|
1482
1530
|
return await this.transport.send(e), await this.storage.remove(e.id), this.attempt = 0, !0;
|
|
1483
1531
|
} catch (t) {
|
|
1484
|
-
let n = t instanceof
|
|
1532
|
+
let n = t instanceof U ? t : void 0;
|
|
1485
1533
|
return n?.kind === "permanent" ? (await this.storage.remove(e.id), !0) : n?.kind === "too_large" ? (await this.splitStored(e, n.maxBytes), !0) : n?.kind === "offline" ? (this.schedule(f), !1) : (await this.storage.bumpAttempts(e.id, e.attempts + 1), this.attempt++, this.schedule(n?.retryAfterMs ?? this.backoffMs()), !1);
|
|
1486
1534
|
}
|
|
1487
1535
|
}
|
|
@@ -1501,14 +1549,14 @@ var bn = class {
|
|
|
1501
1549
|
});
|
|
1502
1550
|
for (let e of n) await this.storage.save(e);
|
|
1503
1551
|
}
|
|
1504
|
-
},
|
|
1552
|
+
}, Cn = {
|
|
1505
1553
|
TRACE: "debug",
|
|
1506
1554
|
DEBUG: "debug",
|
|
1507
1555
|
INFO: "info",
|
|
1508
1556
|
WARN: "warn",
|
|
1509
1557
|
ERROR: "error",
|
|
1510
1558
|
FATAL: "error"
|
|
1511
|
-
},
|
|
1559
|
+
}, wn = class {
|
|
1512
1560
|
minLevel;
|
|
1513
1561
|
constructor(e) {
|
|
1514
1562
|
this.minLevel = e;
|
|
@@ -1517,55 +1565,15 @@ var bn = class {
|
|
|
1517
1565
|
this.minLevel = e;
|
|
1518
1566
|
}
|
|
1519
1567
|
write(e, t, n) {
|
|
1520
|
-
if (this.minLevel === null ||
|
|
1521
|
-
let r = `%c${
|
|
1568
|
+
if (this.minLevel === null || S[e] < S[this.minLevel] || typeof console > "u") return;
|
|
1569
|
+
let r = `%c${We}%c ${e}`;
|
|
1522
1570
|
if (n === void 0) {
|
|
1523
|
-
console[
|
|
1571
|
+
console[Cn[e]](r, s, "", t);
|
|
1524
1572
|
return;
|
|
1525
1573
|
}
|
|
1526
|
-
console[
|
|
1527
|
-
}
|
|
1528
|
-
}, H = null;
|
|
1529
|
-
function U(e, t) {
|
|
1530
|
-
let n = e[t];
|
|
1531
|
-
return n !== void 0 && e instanceof n;
|
|
1532
|
-
}
|
|
1533
|
-
function wn(e) {
|
|
1534
|
-
if (H) return H;
|
|
1535
|
-
let t = globalThis, n = t.navigator?.userAgent ?? "", r = "browser", i, a, o = !1, s = t.fin?.me;
|
|
1536
|
-
return U(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", o = !0) : U(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", o = !0) : U(t, "WorkerGlobalScope") ? (r = "web_worker", o = !0) : s === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 || Tn(n) ? r = "mobile_webview" : typeof document > "u" && typeof process < "u" && (r = "node") : (r = Ue.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "reading fin.me.identity", () => {
|
|
1537
|
-
let e = s.identity;
|
|
1538
|
-
i = e?.uuid, a = e?.name;
|
|
1539
|
-
})), H = {
|
|
1540
|
-
platform: r,
|
|
1541
|
-
openfinUuid: i,
|
|
1542
|
-
openfinName: a,
|
|
1543
|
-
userAgent: n,
|
|
1544
|
-
isWorker: o,
|
|
1545
|
-
isTopLevelDocument: En()
|
|
1546
|
-
}, H;
|
|
1547
|
-
}
|
|
1548
|
-
function Tn(t) {
|
|
1549
|
-
return ft.test(t) ? !0 : (e.test(t) || dt.test(t) && ht.test(t)) && t.includes("AppleWebKit") && !t.includes("Safari/");
|
|
1550
|
-
}
|
|
1551
|
-
function En() {
|
|
1552
|
-
if (typeof window > "u") return !1;
|
|
1553
|
-
try {
|
|
1554
|
-
return window.self === window.top;
|
|
1555
|
-
} catch {
|
|
1556
|
-
return !1;
|
|
1574
|
+
console[Cn[e]](r, s, "", t, n);
|
|
1557
1575
|
}
|
|
1558
|
-
}
|
|
1559
|
-
function Dn() {
|
|
1560
|
-
try {
|
|
1561
|
-
return typeof location < "u" ? location.href : "";
|
|
1562
|
-
} catch {
|
|
1563
|
-
return "";
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
//#endregion
|
|
1567
|
-
//#region src/utils/sequence.ts
|
|
1568
|
-
var On = class {
|
|
1576
|
+
}, Tn = class {
|
|
1569
1577
|
value = 0;
|
|
1570
1578
|
next() {
|
|
1571
1579
|
return ++this.value;
|
|
@@ -1573,64 +1581,84 @@ var On = class {
|
|
|
1573
1581
|
reset() {
|
|
1574
1582
|
this.value = 0;
|
|
1575
1583
|
}
|
|
1576
|
-
}
|
|
1577
|
-
//#endregion
|
|
1578
|
-
//#region src/utils/tracing.ts
|
|
1584
|
+
}, En = /^[0-9a-f]{32}$/, Dn = /^[0-9a-f]{16}$/, On = /[1-9a-f]/;
|
|
1579
1585
|
function kn() {
|
|
1580
|
-
return
|
|
1586
|
+
return import(
|
|
1587
|
+
/* @vite-ignore */
|
|
1588
|
+
"@opentelemetry/api"
|
|
1589
|
+
);
|
|
1581
1590
|
}
|
|
1582
|
-
function An() {
|
|
1583
|
-
return
|
|
1591
|
+
function An(e) {
|
|
1592
|
+
return En.test(e.traceId) && On.test(e.traceId) && Dn.test(e.spanId) && On.test(e.spanId);
|
|
1584
1593
|
}
|
|
1585
1594
|
function jn() {
|
|
1595
|
+
return N(16);
|
|
1596
|
+
}
|
|
1597
|
+
function Mn() {
|
|
1598
|
+
return N(8);
|
|
1599
|
+
}
|
|
1600
|
+
function Nn() {
|
|
1586
1601
|
return {
|
|
1587
|
-
traceId:
|
|
1588
|
-
spanId:
|
|
1602
|
+
traceId: jn(),
|
|
1603
|
+
spanId: Mn(),
|
|
1589
1604
|
traceFlags: 1,
|
|
1590
1605
|
startedAt: Date.now()
|
|
1591
1606
|
};
|
|
1592
1607
|
}
|
|
1593
|
-
function
|
|
1608
|
+
function Pn(e) {
|
|
1594
1609
|
return {
|
|
1595
1610
|
traceId: e.traceId,
|
|
1596
1611
|
spanId: e.spanId,
|
|
1597
1612
|
traceFlags: e.traceFlags
|
|
1598
1613
|
};
|
|
1599
1614
|
}
|
|
1600
|
-
var
|
|
1615
|
+
var Fn = class {
|
|
1601
1616
|
diagnostics;
|
|
1602
1617
|
maxAgeMs;
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1618
|
+
load;
|
|
1619
|
+
ambient = Nn();
|
|
1620
|
+
otel;
|
|
1621
|
+
constructor(e, t = st, n = kn) {
|
|
1622
|
+
this.diagnostics = e, this.maxAgeMs = t, this.load = n;
|
|
1623
|
+
}
|
|
1624
|
+
async loadOtel() {
|
|
1625
|
+
try {
|
|
1626
|
+
this.otel = await this.load();
|
|
1627
|
+
} catch (e) {
|
|
1628
|
+
this.diagnostics.report("trace.otel_failed", "@opentelemetry/api is not available, so records carry this library's own trace ids", void 0, e);
|
|
1629
|
+
}
|
|
1606
1630
|
}
|
|
1607
1631
|
resolve() {
|
|
1608
|
-
let e = this.
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1632
|
+
let e = this.activeSpanContext();
|
|
1633
|
+
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Pn(this.ambient)) : e;
|
|
1634
|
+
}
|
|
1635
|
+
activeSpanContext() {
|
|
1636
|
+
let e = this.otel;
|
|
1637
|
+
if (e) return this.diagnostics.guard("trace.otel_failed", "reading the active OpenTelemetry span", () => {
|
|
1638
|
+
let t = e.trace.getActiveSpan();
|
|
1639
|
+
if (t === void 0) return;
|
|
1640
|
+
let n = t.spanContext();
|
|
1641
|
+
if (An(n)) return {
|
|
1642
|
+
traceId: n.traceId,
|
|
1643
|
+
spanId: n.spanId,
|
|
1644
|
+
traceFlags: n.traceFlags
|
|
1616
1645
|
};
|
|
1617
1646
|
});
|
|
1618
|
-
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Mn(this.ambient)) : e;
|
|
1619
1647
|
}
|
|
1620
1648
|
rotate(e) {
|
|
1621
|
-
return this.ambient =
|
|
1649
|
+
return this.ambient = Nn(), Pn(this.ambient);
|
|
1622
1650
|
}
|
|
1623
1651
|
headers() {
|
|
1624
|
-
let e = {};
|
|
1625
|
-
if (this.diagnostics.guard("trace.otel_failed", "injecting OpenTelemetry headers", () => {
|
|
1626
|
-
|
|
1652
|
+
let e = {}, t = this.otel;
|
|
1653
|
+
if (t && this.diagnostics.guard("trace.otel_failed", "injecting OpenTelemetry headers", () => {
|
|
1654
|
+
t.propagation.inject(t.context.active(), e);
|
|
1627
1655
|
}), !e.traceparent) {
|
|
1628
1656
|
let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
|
|
1629
|
-
e[
|
|
1657
|
+
e[Qe] = `00-${t.traceId}-${t.spanId}-${n}`;
|
|
1630
1658
|
}
|
|
1631
1659
|
return e;
|
|
1632
1660
|
}
|
|
1633
|
-
},
|
|
1661
|
+
}, In = class {
|
|
1634
1662
|
buffer;
|
|
1635
1663
|
pointer = 0;
|
|
1636
1664
|
filled = !1;
|
|
@@ -1650,15 +1678,15 @@ var Nn = class {
|
|
|
1650
1678
|
};
|
|
1651
1679
|
//#endregion
|
|
1652
1680
|
//#region src/transport/serializers/ecs.ts
|
|
1653
|
-
function
|
|
1654
|
-
return
|
|
1681
|
+
function Ln(e) {
|
|
1682
|
+
return Pe.test(e) ? Number(BigInt(e) / Le) : Date.now();
|
|
1655
1683
|
}
|
|
1656
|
-
var
|
|
1684
|
+
var Rn = {
|
|
1657
1685
|
name: "ecs",
|
|
1658
1686
|
serialize(e) {
|
|
1659
1687
|
return {
|
|
1660
1688
|
body: `${e.map((e) => {
|
|
1661
|
-
let t =
|
|
1689
|
+
let t = Ln(e.timeUnixNano);
|
|
1662
1690
|
return JSON.stringify({
|
|
1663
1691
|
"@timestamp": new Date(t).toISOString(),
|
|
1664
1692
|
message: e.body,
|
|
@@ -1667,10 +1695,10 @@ var In = {
|
|
|
1667
1695
|
span: { id: e.spanId },
|
|
1668
1696
|
service: {
|
|
1669
1697
|
name: e.resource[c],
|
|
1670
|
-
version: e.resource[
|
|
1698
|
+
version: e.resource[ue],
|
|
1671
1699
|
environment: e.resource[o]
|
|
1672
1700
|
},
|
|
1673
|
-
user_agent: { original: e.resource[
|
|
1701
|
+
user_agent: { original: e.resource[_t] },
|
|
1674
1702
|
url: { full: e.attributes["url.full"] ?? e.attributes["page.url"] },
|
|
1675
1703
|
labels: {
|
|
1676
1704
|
...e.resource,
|
|
@@ -1678,19 +1706,19 @@ var In = {
|
|
|
1678
1706
|
}
|
|
1679
1707
|
});
|
|
1680
1708
|
}).join("\n")}\n`,
|
|
1681
|
-
contentType:
|
|
1709
|
+
contentType: qe
|
|
1682
1710
|
};
|
|
1683
1711
|
}
|
|
1684
1712
|
};
|
|
1685
1713
|
//#endregion
|
|
1686
1714
|
//#region src/transport/serializers/otlp.ts
|
|
1687
|
-
function
|
|
1688
|
-
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(
|
|
1715
|
+
function zn(e) {
|
|
1716
|
+
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(zn).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: W(e) } } : null;
|
|
1689
1717
|
}
|
|
1690
1718
|
function W(e) {
|
|
1691
1719
|
let t = [];
|
|
1692
1720
|
for (let [n, r] of Object.entries(e)) {
|
|
1693
|
-
let e =
|
|
1721
|
+
let e = zn(r);
|
|
1694
1722
|
e && t.push({
|
|
1695
1723
|
key: n,
|
|
1696
1724
|
value: e
|
|
@@ -1698,19 +1726,19 @@ function W(e) {
|
|
|
1698
1726
|
}
|
|
1699
1727
|
return t;
|
|
1700
1728
|
}
|
|
1701
|
-
var
|
|
1702
|
-
function
|
|
1703
|
-
let t =
|
|
1729
|
+
var Bn = /* @__PURE__ */ new WeakMap();
|
|
1730
|
+
function Vn(e) {
|
|
1731
|
+
let t = Bn.get(e);
|
|
1704
1732
|
if (t !== void 0) return t;
|
|
1705
1733
|
let n = JSON.stringify(e);
|
|
1706
|
-
return
|
|
1734
|
+
return Bn.set(e, n), n;
|
|
1707
1735
|
}
|
|
1708
1736
|
var G = {
|
|
1709
|
-
name:
|
|
1737
|
+
name: yt,
|
|
1710
1738
|
serialize(e) {
|
|
1711
1739
|
let t = /* @__PURE__ */ new Map();
|
|
1712
1740
|
for (let n of e) {
|
|
1713
|
-
let e =
|
|
1741
|
+
let e = Vn(n.resource), r = t.get(e);
|
|
1714
1742
|
if (r) {
|
|
1715
1743
|
r.records.push(n);
|
|
1716
1744
|
continue;
|
|
@@ -1724,8 +1752,8 @@ var G = {
|
|
|
1724
1752
|
resource: { attributes: W(e.resource) },
|
|
1725
1753
|
scopeLogs: [{
|
|
1726
1754
|
scope: {
|
|
1727
|
-
name:
|
|
1728
|
-
version:
|
|
1755
|
+
name: Fe,
|
|
1756
|
+
version: dt
|
|
1729
1757
|
},
|
|
1730
1758
|
logRecords: e.records.map((e) => ({
|
|
1731
1759
|
timeUnixNano: e.timeUnixNano,
|
|
@@ -1742,27 +1770,27 @@ var G = {
|
|
|
1742
1770
|
}));
|
|
1743
1771
|
return {
|
|
1744
1772
|
body: JSON.stringify({ resourceLogs: n }),
|
|
1745
|
-
contentType:
|
|
1773
|
+
contentType: le
|
|
1746
1774
|
};
|
|
1747
1775
|
}
|
|
1748
1776
|
};
|
|
1749
1777
|
//#endregion
|
|
1750
1778
|
//#region src/core/config.ts
|
|
1751
|
-
function
|
|
1779
|
+
function Hn(e) {
|
|
1752
1780
|
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
1753
1781
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return e === void 0 ? t ?? G : e === "otlp" ? G : e === "ecs" ?
|
|
1782
|
+
function Un(e, t, n) {
|
|
1783
|
+
return e === void 0 ? t ?? G : e === "otlp" ? G : e === "ecs" ? Rn : Hn(e) ? e : (n.report("config.invalid", `serializer must be "${yt}", "ecs" or an implementation`), G);
|
|
1756
1784
|
}
|
|
1757
|
-
function
|
|
1785
|
+
function Wn(e, t) {
|
|
1758
1786
|
return e === void 0 ? t : e === !1 ? null : e === !0 ? l : e;
|
|
1759
1787
|
}
|
|
1760
|
-
function
|
|
1761
|
-
let r = n ??
|
|
1788
|
+
function Gn(e, t, n) {
|
|
1789
|
+
let r = n ?? Ge, i = {
|
|
1762
1790
|
...r,
|
|
1763
1791
|
...e,
|
|
1764
|
-
serializer:
|
|
1765
|
-
console:
|
|
1792
|
+
serializer: Un(e.serializer, n?.serializer, t),
|
|
1793
|
+
console: Wn(e.console, r.console),
|
|
1766
1794
|
sampling: {
|
|
1767
1795
|
...r.sampling,
|
|
1768
1796
|
...e.sampling,
|
|
@@ -1786,23 +1814,23 @@ function Un(e, t, n) {
|
|
|
1786
1814
|
} catch (e) {
|
|
1787
1815
|
t.report("config.invalid", `endpoint is not a valid absolute URL: ${i.endpoint}`, void 0, e);
|
|
1788
1816
|
}
|
|
1789
|
-
i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record will report service.name as '${
|
|
1817
|
+
i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record will report service.name as '${tt}'.`), tt);
|
|
1790
1818
|
let a = i.sampling.defaultRate;
|
|
1791
1819
|
(typeof a != "number" || a < 0 || a > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1, got ${String(a)}`), i.sampling.defaultRate = 1);
|
|
1792
1820
|
let o = Object.entries(i.sampling.rates);
|
|
1793
1821
|
for (let [e, n] of o) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1, got ${String(n)}`), i.sampling.rates[e] = 1);
|
|
1794
1822
|
i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint), i.endpoint && !i.capture.ignoreUrls.includes(i.endpoint) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, i.endpoint]);
|
|
1795
|
-
let s = /* @__PURE__ */ new Set([...Object.keys(
|
|
1823
|
+
let s = /* @__PURE__ */ new Set([...Object.keys(Ge), ...De]);
|
|
1796
1824
|
for (let n of Object.keys(e)) s.has(n) || t.report("config.invalid", `unknown config key "${n}", ignored. Typo?`);
|
|
1797
1825
|
return i;
|
|
1798
1826
|
}
|
|
1799
|
-
function
|
|
1800
|
-
for (let n of Object.keys(t))
|
|
1801
|
-
for (let n of
|
|
1827
|
+
function Kn(e, t) {
|
|
1828
|
+
for (let n of Object.keys(t)) ge.includes(n) || Object.assign(e, { [n]: t[n] });
|
|
1829
|
+
for (let n of ge) Object.assign(e[n], t[n]);
|
|
1802
1830
|
}
|
|
1803
1831
|
//#endregion
|
|
1804
1832
|
//#region src/core/context.ts
|
|
1805
|
-
var
|
|
1833
|
+
var qn = class {
|
|
1806
1834
|
map = /* @__PURE__ */ new Map();
|
|
1807
1835
|
set(e, t) {
|
|
1808
1836
|
this.map.set(e, t);
|
|
@@ -1822,12 +1850,12 @@ var Gn = class {
|
|
|
1822
1850
|
getAll() {
|
|
1823
1851
|
return Object.fromEntries(this.map);
|
|
1824
1852
|
}
|
|
1825
|
-
},
|
|
1853
|
+
}, Jn = class {
|
|
1826
1854
|
handler;
|
|
1827
1855
|
throttleMs;
|
|
1828
1856
|
counters = /* @__PURE__ */ new Map();
|
|
1829
1857
|
lastEmitted = /* @__PURE__ */ new Map();
|
|
1830
|
-
constructor(e, t =
|
|
1858
|
+
constructor(e, t = se) {
|
|
1831
1859
|
this.handler = e, this.throttleMs = t;
|
|
1832
1860
|
}
|
|
1833
1861
|
setHandler(e) {
|
|
@@ -1852,7 +1880,7 @@ var Gn = class {
|
|
|
1852
1880
|
if (this.handler) try {
|
|
1853
1881
|
this.handler(o);
|
|
1854
1882
|
} catch (e) {
|
|
1855
|
-
this.count("handler.threw"), typeof console < "u" && console.warn(`${
|
|
1883
|
+
this.count("handler.threw"), typeof console < "u" && console.warn(`${We} onDiagnostic handler threw`, e);
|
|
1856
1884
|
}
|
|
1857
1885
|
}
|
|
1858
1886
|
guard(e, t, n) {
|
|
@@ -1877,22 +1905,22 @@ var Gn = class {
|
|
|
1877
1905
|
reset() {
|
|
1878
1906
|
this.counters.clear(), this.lastEmitted.clear();
|
|
1879
1907
|
}
|
|
1880
|
-
},
|
|
1881
|
-
maxAgeMs:
|
|
1908
|
+
}, Yn = {
|
|
1909
|
+
maxAgeMs: Ie,
|
|
1882
1910
|
endOnOwnerClose: !1,
|
|
1883
|
-
urlParam:
|
|
1911
|
+
urlParam: $e
|
|
1884
1912
|
};
|
|
1885
1913
|
function K(e, t) {
|
|
1886
1914
|
let n = Reflect.get(e, t);
|
|
1887
1915
|
return typeof n == "string" && n !== "" ? n : void 0;
|
|
1888
1916
|
}
|
|
1889
|
-
function
|
|
1917
|
+
function Xn(e, t) {
|
|
1890
1918
|
let n = Reflect.get(e, t);
|
|
1891
1919
|
return typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
1892
1920
|
}
|
|
1893
|
-
function
|
|
1921
|
+
function Zn(e) {
|
|
1894
1922
|
if (typeof e != "object" || !e) return null;
|
|
1895
|
-
let t = K(e, "id"), n = K(e, "name"), r =
|
|
1923
|
+
let t = K(e, "id"), n = K(e, "name"), r = Xn(e, "startedAt");
|
|
1896
1924
|
return t === void 0 || n === void 0 || r === void 0 ? null : {
|
|
1897
1925
|
id: t,
|
|
1898
1926
|
name: n,
|
|
@@ -1901,35 +1929,35 @@ function Yn(e) {
|
|
|
1901
1929
|
ownerContextId: K(e, "ownerContextId") ?? ""
|
|
1902
1930
|
};
|
|
1903
1931
|
}
|
|
1904
|
-
function
|
|
1932
|
+
function Qn(e) {
|
|
1905
1933
|
if (typeof e != "object" || !e) return null;
|
|
1906
1934
|
let t = K(e, "i"), n = K(e, "n");
|
|
1907
1935
|
return t === void 0 || n === void 0 ? null : {
|
|
1908
1936
|
id: t,
|
|
1909
1937
|
name: n,
|
|
1910
|
-
startedAt:
|
|
1938
|
+
startedAt: Xn(e, "s") ?? Date.now(),
|
|
1911
1939
|
parentId: void 0,
|
|
1912
1940
|
ownerContextId: ""
|
|
1913
1941
|
};
|
|
1914
1942
|
}
|
|
1915
|
-
function
|
|
1943
|
+
function $n(e) {
|
|
1916
1944
|
let t = JSON.stringify({
|
|
1917
1945
|
i: e.id,
|
|
1918
1946
|
n: e.name.slice(0, 64),
|
|
1919
1947
|
s: e.startedAt
|
|
1920
1948
|
}), n = new TextEncoder().encode(t), r = "";
|
|
1921
1949
|
for (let e of n) r += String.fromCharCode(e);
|
|
1922
|
-
return btoa(r).replace(
|
|
1950
|
+
return btoa(r).replace(Re, "-").replace(Te, "_").replace(Be, "");
|
|
1923
1951
|
}
|
|
1924
|
-
function
|
|
1952
|
+
function er(e, t) {
|
|
1925
1953
|
let n = new Promise((e, n) => {
|
|
1926
|
-
|
|
1954
|
+
T(setTimeout(() => {
|
|
1927
1955
|
n(/* @__PURE__ */ Error(`timed out after ${String(t)}ms`));
|
|
1928
1956
|
}, t));
|
|
1929
1957
|
});
|
|
1930
1958
|
return Promise.race([e, n]);
|
|
1931
1959
|
}
|
|
1932
|
-
var
|
|
1960
|
+
var tr = class {
|
|
1933
1961
|
options;
|
|
1934
1962
|
diagnostics;
|
|
1935
1963
|
contextId;
|
|
@@ -1945,14 +1973,14 @@ var $n = class {
|
|
|
1945
1973
|
async bootstrap() {
|
|
1946
1974
|
let e = this.readUrlToken();
|
|
1947
1975
|
if (e && this.adopt(e, "url")) return;
|
|
1948
|
-
let t = this.diagnostics.guard("storage.unavailable", "reading the persisted journey", () => sessionStorage.getItem(
|
|
1976
|
+
let t = this.diagnostics.guard("storage.unavailable", "reading the persisted journey", () => sessionStorage.getItem(C));
|
|
1949
1977
|
if (t && this.restore(t)) return;
|
|
1950
1978
|
let n = await this.readOpenFinToken();
|
|
1951
1979
|
n !== null && this.adopt(n, "openfin.customData");
|
|
1952
1980
|
}
|
|
1953
1981
|
start(e, t = {}) {
|
|
1954
1982
|
let n = {
|
|
1955
|
-
id: t.id ??
|
|
1983
|
+
id: t.id ?? P(),
|
|
1956
1984
|
name: e,
|
|
1957
1985
|
startedAt: Date.now(),
|
|
1958
1986
|
parentId: t.parent ? this.journey?.id : void 0,
|
|
@@ -1970,7 +1998,7 @@ var $n = class {
|
|
|
1970
1998
|
getToken() {
|
|
1971
1999
|
let e = this.journey;
|
|
1972
2000
|
if (e === null) return;
|
|
1973
|
-
let t =
|
|
2001
|
+
let t = $n(e);
|
|
1974
2002
|
if (t.length > 256) {
|
|
1975
2003
|
this.diagnostics.report("journey.token_too_large", "journey token exceeded the size cap and was not issued", { length: t.length });
|
|
1976
2004
|
return;
|
|
@@ -1994,7 +2022,7 @@ var $n = class {
|
|
|
1994
2022
|
this.clearTimer();
|
|
1995
2023
|
}
|
|
1996
2024
|
restore(e) {
|
|
1997
|
-
let t =
|
|
2025
|
+
let t = Zn(this.diagnostics.guard("storage.degraded", "parsing the persisted journey", () => JSON.parse(e)));
|
|
1998
2026
|
return t === null ? !1 : Date.now() - t.startedAt > this.options.maxAgeMs ? (this.diagnostics.report("journey.expired", "discarded a persisted journey older than maxAgeMs", { name: t.name }), this.clearStored(), !1) : (this.setJourney(t), this.diagnostics.report("journey.adopted", `resumed journey "${t.name}"`, {
|
|
1999
2027
|
source: "sessionStorage",
|
|
2000
2028
|
journeyId: t.id
|
|
@@ -2002,22 +2030,22 @@ var $n = class {
|
|
|
2002
2030
|
}
|
|
2003
2031
|
decodeToken(e) {
|
|
2004
2032
|
return this.diagnostics.guard("config.invalid", "decoding a seeded journey token", () => {
|
|
2005
|
-
let t = e.replace(
|
|
2006
|
-
return
|
|
2033
|
+
let t = e.replace(rt, "+").replace(Xe, "/"), n = (4 - t.length % 4) % 4, r = "=".repeat(n), i = Uint8Array.from(atob(t + r), (e) => e.charCodeAt(0));
|
|
2034
|
+
return Qn(JSON.parse(new TextDecoder().decode(i)));
|
|
2007
2035
|
}) ?? null;
|
|
2008
2036
|
}
|
|
2009
2037
|
setJourney(e) {
|
|
2010
2038
|
if (this.journey = e, this.clearTimer(), this.diagnostics.guard("storage.unavailable", "persisting the journey", () => {
|
|
2011
|
-
e === null ? sessionStorage.removeItem(
|
|
2039
|
+
e === null ? sessionStorage.removeItem(C) : sessionStorage.setItem(C, JSON.stringify(e));
|
|
2012
2040
|
}), e === null) return;
|
|
2013
2041
|
let t = Math.max(this.options.maxAgeMs - (Date.now() - e.startedAt), 0), n = setTimeout(() => {
|
|
2014
2042
|
this.diagnostics.report("journey.expired", `journey "${e.name}" hit maxAgeMs and was ended automatically`, { journeyId: e.id }), this.journey = null, this.expiryTimer = null, this.clearStored();
|
|
2015
2043
|
}, t);
|
|
2016
|
-
this.expiryTimer = n,
|
|
2044
|
+
this.expiryTimer = n, T(n);
|
|
2017
2045
|
}
|
|
2018
2046
|
clearStored() {
|
|
2019
2047
|
this.diagnostics.guard("storage.unavailable", "clearing the persisted journey", () => {
|
|
2020
|
-
sessionStorage.removeItem(
|
|
2048
|
+
sessionStorage.removeItem(C);
|
|
2021
2049
|
});
|
|
2022
2050
|
}
|
|
2023
2051
|
clearTimer() {
|
|
@@ -2029,14 +2057,14 @@ var $n = class {
|
|
|
2029
2057
|
async readOpenFinToken() {
|
|
2030
2058
|
let e = globalThis.fin?.me, t = e?.getOptions;
|
|
2031
2059
|
if (t === void 0) return null;
|
|
2032
|
-
let n = (await this.diagnostics.guardAsync("openfin.unavailable", "reading fin.me.getOptions()", () =>
|
|
2060
|
+
let n = (await this.diagnostics.guardAsync("openfin.unavailable", "reading fin.me.getOptions()", () => er(t.call(e), Ze)))?.customData?.[it];
|
|
2033
2061
|
return typeof n == "string" ? n : null;
|
|
2034
2062
|
}
|
|
2035
2063
|
};
|
|
2036
2064
|
//#endregion
|
|
2037
2065
|
//#region src/core/sampling.ts
|
|
2038
|
-
function
|
|
2039
|
-
let t =
|
|
2066
|
+
function nr(e) {
|
|
2067
|
+
let t = ye;
|
|
2040
2068
|
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, h);
|
|
2041
2069
|
return t >>> 0;
|
|
2042
2070
|
}
|
|
@@ -2044,31 +2072,49 @@ function q(e, t) {
|
|
|
2044
2072
|
let n = e.attributes[t];
|
|
2045
2073
|
return typeof n == "string" ? n : "";
|
|
2046
2074
|
}
|
|
2047
|
-
function
|
|
2075
|
+
function rr(e, t) {
|
|
2048
2076
|
let { rates: n, defaultRate: r } = t.sampling, i, a = -1;
|
|
2049
2077
|
for (let [t, r] of Object.entries(n)) (e === t || e.startsWith(`${t}.`)) && t.length > a && (i = r, a = t.length);
|
|
2050
2078
|
return i ?? r;
|
|
2051
2079
|
}
|
|
2052
|
-
function
|
|
2053
|
-
if (e.
|
|
2054
|
-
let n =
|
|
2055
|
-
return n >= 1 ? !0 : n <= 0 ? !1 :
|
|
2056
|
-
}
|
|
2080
|
+
function ir(e, t) {
|
|
2081
|
+
if (e.level === "ERROR" || e.level === "FATAL" || t.sampling.alwaysSampleTypes.includes(e.type)) return !0;
|
|
2082
|
+
let n = rr(e.namespace, t);
|
|
2083
|
+
return n >= 1 ? !0 : n <= 0 ? !1 : nr(e.journeyId || e.traceId) / Ue < n;
|
|
2084
|
+
}
|
|
2085
|
+
function ar(e, t) {
|
|
2086
|
+
return ir({
|
|
2087
|
+
level: e.severityText,
|
|
2088
|
+
type: q(e, b),
|
|
2089
|
+
namespace: q(e, x),
|
|
2090
|
+
journeyId: q(e, y),
|
|
2091
|
+
traceId: e.traceId
|
|
2092
|
+
}, t);
|
|
2093
|
+
}
|
|
2094
|
+
var or = class {
|
|
2095
|
+
windowStart = 0;
|
|
2096
|
+
count = 0;
|
|
2097
|
+
allow(e) {
|
|
2098
|
+
if (e.severityText !== "ERROR" && e.severityText !== "FATAL") return !0;
|
|
2099
|
+
let t = Date.now();
|
|
2100
|
+
return t - this.windowStart > 1e4 && (this.windowStart = t, this.count = 0), this.count++, this.count <= 500;
|
|
2101
|
+
}
|
|
2102
|
+
};
|
|
2057
2103
|
//#endregion
|
|
2058
2104
|
//#region src/core/pipeline.ts
|
|
2059
|
-
function
|
|
2060
|
-
return e.attributes[
|
|
2105
|
+
function sr(e) {
|
|
2106
|
+
return e.attributes[b] === nt;
|
|
2061
2107
|
}
|
|
2062
|
-
var
|
|
2108
|
+
var cr = {
|
|
2063
2109
|
logs: {
|
|
2064
|
-
flushIntervalMs:
|
|
2110
|
+
flushIntervalMs: Oe,
|
|
2065
2111
|
batchSize: 100
|
|
2066
2112
|
},
|
|
2067
2113
|
metrics: {
|
|
2068
|
-
flushIntervalMs:
|
|
2114
|
+
flushIntervalMs: Me,
|
|
2069
2115
|
batchSize: 500
|
|
2070
2116
|
}
|
|
2071
|
-
},
|
|
2117
|
+
}, lr = class {
|
|
2072
2118
|
options;
|
|
2073
2119
|
onFlush;
|
|
2074
2120
|
pending = [];
|
|
@@ -2096,13 +2142,12 @@ var ir = {
|
|
|
2096
2142
|
let e = setTimeout(() => {
|
|
2097
2143
|
this.timer = null, this.onFlush(this);
|
|
2098
2144
|
}, this.options.flushIntervalMs);
|
|
2099
|
-
this.timer = e,
|
|
2145
|
+
this.timer = e, T(e);
|
|
2100
2146
|
}
|
|
2101
2147
|
clearTimer() {
|
|
2102
2148
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
2103
2149
|
}
|
|
2104
|
-
},
|
|
2105
|
-
config;
|
|
2150
|
+
}, ur = class {
|
|
2106
2151
|
transport;
|
|
2107
2152
|
storage;
|
|
2108
2153
|
retry;
|
|
@@ -2110,43 +2155,50 @@ var ir = {
|
|
|
2110
2155
|
streams;
|
|
2111
2156
|
unconfirmed = /* @__PURE__ */ new Map();
|
|
2112
2157
|
queue = [];
|
|
2158
|
+
ceiling = new or();
|
|
2113
2159
|
inFlight = 0;
|
|
2114
2160
|
pumpScheduled = !1;
|
|
2115
2161
|
stopped = !1;
|
|
2116
|
-
constructor(e, t, n, r, i
|
|
2117
|
-
this.
|
|
2118
|
-
let
|
|
2162
|
+
constructor(e, t, n, r, i = cr) {
|
|
2163
|
+
this.transport = e, this.storage = t, this.retry = n, this.diagnostics = r;
|
|
2164
|
+
let a = (e) => {
|
|
2119
2165
|
this.claim(e);
|
|
2120
2166
|
};
|
|
2121
2167
|
this.streams = {
|
|
2122
|
-
logs: new
|
|
2123
|
-
metrics: new
|
|
2168
|
+
logs: new lr(i.logs, a),
|
|
2169
|
+
metrics: new lr(i.metrics, a)
|
|
2124
2170
|
};
|
|
2125
2171
|
}
|
|
2126
2172
|
push(e) {
|
|
2127
|
-
this.stopped || (e.observedTimeUnixNano =
|
|
2173
|
+
this.stopped || (e.observedTimeUnixNano = Jt(), this.route(e));
|
|
2128
2174
|
}
|
|
2129
2175
|
drainPending() {
|
|
2130
|
-
|
|
2131
|
-
|
|
2176
|
+
return this.toBatch([...this.streams.metrics.take(), ...this.streams.logs.take()]);
|
|
2177
|
+
}
|
|
2178
|
+
drainForExit() {
|
|
2179
|
+
let e = [...this.unconfirmed.values()].flatMap((e) => e.records);
|
|
2180
|
+
return this.unconfirmed.clear(), this.toBatch([
|
|
2181
|
+
...e,
|
|
2132
2182
|
...this.streams.metrics.take(),
|
|
2133
2183
|
...this.streams.logs.take()
|
|
2134
|
-
];
|
|
2135
|
-
|
|
2136
|
-
|
|
2184
|
+
]);
|
|
2185
|
+
}
|
|
2186
|
+
destroy() {
|
|
2187
|
+
this.stopped = !0, this.streams.logs.stop(), this.streams.metrics.stop(), this.queue.length = 0;
|
|
2188
|
+
}
|
|
2189
|
+
toBatch(e) {
|
|
2190
|
+
return e.length === 0 ? null : {
|
|
2191
|
+
id: P(),
|
|
2137
2192
|
records: e,
|
|
2138
2193
|
createdAt: Date.now(),
|
|
2139
2194
|
attempts: 0
|
|
2140
2195
|
};
|
|
2141
2196
|
}
|
|
2142
|
-
destroy() {
|
|
2143
|
-
this.stopped = !0, this.streams.logs.stop(), this.streams.metrics.stop(), this.queue.length = 0;
|
|
2144
|
-
}
|
|
2145
2197
|
route(e) {
|
|
2146
2198
|
try {
|
|
2147
|
-
let t =
|
|
2148
|
-
if (!
|
|
2149
|
-
this.diagnostics.count("record.
|
|
2199
|
+
let t = sr(e) ? this.streams.metrics : this.streams.logs;
|
|
2200
|
+
if (!this.ceiling.allow(e)) {
|
|
2201
|
+
this.diagnostics.count("record.dropped_by_ceiling");
|
|
2150
2202
|
return;
|
|
2151
2203
|
}
|
|
2152
2204
|
t.add(e);
|
|
@@ -2156,7 +2208,7 @@ var ir = {
|
|
|
2156
2208
|
}
|
|
2157
2209
|
claim(e) {
|
|
2158
2210
|
let t = e.take(), n = {
|
|
2159
|
-
id:
|
|
2211
|
+
id: P(),
|
|
2160
2212
|
records: t,
|
|
2161
2213
|
createdAt: Date.now(),
|
|
2162
2214
|
attempts: 0
|
|
@@ -2221,7 +2273,7 @@ var ir = {
|
|
|
2221
2273
|
function J(e) {
|
|
2222
2274
|
return e;
|
|
2223
2275
|
}
|
|
2224
|
-
var
|
|
2276
|
+
var dr = class {
|
|
2225
2277
|
deps;
|
|
2226
2278
|
resourceCache = null;
|
|
2227
2279
|
constructor(e) {
|
|
@@ -2232,94 +2284,102 @@ var sr = class {
|
|
|
2232
2284
|
}
|
|
2233
2285
|
isEnabled(e) {
|
|
2234
2286
|
let { config: t } = this.deps;
|
|
2235
|
-
return t.enabled ?
|
|
2287
|
+
return t.enabled ? S[e] >= S[t.minLevel] : !1;
|
|
2236
2288
|
}
|
|
2237
2289
|
build(e) {
|
|
2238
2290
|
let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o } = this.deps;
|
|
2239
2291
|
if (!this.isEnabled(e.level)) return n.count("record.dropped_by_level"), null;
|
|
2240
|
-
let s = r.resolve(), c = i.current()
|
|
2292
|
+
let s = r.resolve(), c = i.current();
|
|
2293
|
+
if (!ir({
|
|
2294
|
+
level: e.level,
|
|
2295
|
+
type: e.type,
|
|
2296
|
+
namespace: e.namespace,
|
|
2297
|
+
journeyId: c?.id ?? "",
|
|
2298
|
+
traceId: s.traceId
|
|
2299
|
+
}, t)) return n.count("record.dropped_by_sampling"), null;
|
|
2300
|
+
let l = a.next(), u = Bt(), d = t.capture.fullUrls ? u : A(u), f, p = 0;
|
|
2241
2301
|
try {
|
|
2242
|
-
let t =
|
|
2243
|
-
|
|
2302
|
+
let t = z(this.deps.context.getAll(), o), n = z(e.scoped ?? {}, o), r = z(e.payload ?? {}, o);
|
|
2303
|
+
p = t.bytes + n.bytes + r.bytes, f = {
|
|
2244
2304
|
...J(t.value),
|
|
2245
2305
|
...J(n.value),
|
|
2246
2306
|
...J(r.value)
|
|
2247
2307
|
};
|
|
2248
2308
|
} catch (e) {
|
|
2249
|
-
n.report("record.sanitize_failed", "attributes could not be sanitized", void 0, e),
|
|
2309
|
+
n.report("record.sanitize_failed", "attributes could not be sanitized", void 0, e), f = { [Ne]: !0 };
|
|
2250
2310
|
}
|
|
2251
|
-
|
|
2252
|
-
let
|
|
2253
|
-
|
|
2254
|
-
let
|
|
2255
|
-
timeUnixNano:
|
|
2311
|
+
f[b] = e.type, f[je] = l, f[x] = e.namespace, f[ft] = d, c && (f[y] = c.id, f[et] = c.name, c.parentId !== void 0 && (f[ct] = c.parentId));
|
|
2312
|
+
let m = R(e.body, o.maxBodyChars);
|
|
2313
|
+
m !== e.body && n.count("record.truncated");
|
|
2314
|
+
let h = {
|
|
2315
|
+
timeUnixNano: Jt(),
|
|
2256
2316
|
traceId: s.traceId,
|
|
2257
2317
|
spanId: s.spanId,
|
|
2258
2318
|
traceFlags: s.traceFlags,
|
|
2259
|
-
severityNumber:
|
|
2319
|
+
severityNumber: ve[e.level],
|
|
2260
2320
|
severityText: e.level,
|
|
2261
|
-
body:
|
|
2262
|
-
attributes:
|
|
2321
|
+
body: m,
|
|
2322
|
+
attributes: f,
|
|
2263
2323
|
resource: this.resource()
|
|
2264
|
-
},
|
|
2265
|
-
if (
|
|
2266
|
-
let e = n.guard("record.sanitize_failed", "redact hook threw", () => h
|
|
2324
|
+
}, g = t.redact;
|
|
2325
|
+
if (g) {
|
|
2326
|
+
let e = n.guard("record.sanitize_failed", "redact hook threw", () => g(h));
|
|
2267
2327
|
if (e === null) return n.count("record.dropped_by_redact"), null;
|
|
2268
|
-
if (e !== void 0 && e !==
|
|
2269
|
-
if (
|
|
2270
|
-
let t =
|
|
2271
|
-
|
|
2328
|
+
if (e !== void 0 && e !== h) {
|
|
2329
|
+
if (Yt(e)) {
|
|
2330
|
+
let t = z(e.attributes, o);
|
|
2331
|
+
h = {
|
|
2272
2332
|
...e,
|
|
2273
2333
|
attributes: J(t.value)
|
|
2274
|
-
},
|
|
2334
|
+
}, p = t.bytes;
|
|
2275
2335
|
} else n.report("record.sanitize_failed", "redact hook returned something that is not a record, keeping the original");
|
|
2276
2336
|
}
|
|
2277
2337
|
}
|
|
2278
|
-
if (
|
|
2338
|
+
if (p > o.maxRecordBytes) {
|
|
2279
2339
|
n.report("record.truncated", "attributes exceeded the size budget and were dropped", {
|
|
2280
|
-
bytes:
|
|
2281
|
-
body:
|
|
2340
|
+
bytes: p,
|
|
2341
|
+
body: h.body
|
|
2282
2342
|
});
|
|
2283
2343
|
let t = {
|
|
2284
|
-
[
|
|
2285
|
-
[
|
|
2286
|
-
[
|
|
2287
|
-
[
|
|
2288
|
-
[
|
|
2289
|
-
[
|
|
2344
|
+
[b]: e.type,
|
|
2345
|
+
[je]: l,
|
|
2346
|
+
[x]: e.namespace,
|
|
2347
|
+
[ft]: d,
|
|
2348
|
+
[He]: !0,
|
|
2349
|
+
[ot]: p
|
|
2290
2350
|
};
|
|
2291
|
-
c && (t[
|
|
2351
|
+
c && (t[y] = c.id, t[et] = c.name), h.attributes = t;
|
|
2292
2352
|
}
|
|
2293
|
-
return
|
|
2353
|
+
return h;
|
|
2294
2354
|
}
|
|
2295
2355
|
resource() {
|
|
2296
2356
|
if (this.resourceCache) return this.resourceCache;
|
|
2297
2357
|
let { config: e, identity: n, platform: i } = this.deps;
|
|
2298
2358
|
return this.resourceCache = {
|
|
2299
2359
|
[c]: e.serviceName,
|
|
2300
|
-
[
|
|
2360
|
+
[ue]: e.serviceVersion,
|
|
2301
2361
|
[o]: e.environment,
|
|
2302
|
-
[
|
|
2303
|
-
[
|
|
2304
|
-
[
|
|
2305
|
-
[
|
|
2306
|
-
[
|
|
2362
|
+
[oe]: Fe,
|
|
2363
|
+
[ce]: dt,
|
|
2364
|
+
[Ke]: t,
|
|
2365
|
+
[ht]: i.platform,
|
|
2366
|
+
[Je]: n.sessionId,
|
|
2307
2367
|
[r]: n.tabId,
|
|
2308
|
-
[
|
|
2309
|
-
[
|
|
2368
|
+
[he]: n.contextId,
|
|
2369
|
+
[_t]: i.userAgent,
|
|
2310
2370
|
...i.openfinUuid === void 0 ? {} : { [u]: i.openfinUuid },
|
|
2311
|
-
...i.openfinName === void 0 ? {} : { [
|
|
2371
|
+
...i.openfinName === void 0 ? {} : { [_e]: i.openfinName }
|
|
2312
2372
|
}, this.resourceCache;
|
|
2313
2373
|
}
|
|
2314
|
-
}, Y = Symbol.for(
|
|
2374
|
+
}, Y = Symbol.for(ie), X = class e {
|
|
2315
2375
|
diagnostics;
|
|
2316
2376
|
config;
|
|
2317
2377
|
platform;
|
|
2318
2378
|
identity;
|
|
2319
|
-
context = new
|
|
2379
|
+
context = new qn();
|
|
2320
2380
|
breadcrumbs;
|
|
2321
2381
|
tracing;
|
|
2322
|
-
sequence = new
|
|
2382
|
+
sequence = new Tn();
|
|
2323
2383
|
journey;
|
|
2324
2384
|
builder;
|
|
2325
2385
|
console;
|
|
@@ -2337,11 +2397,11 @@ var sr = class {
|
|
|
2337
2397
|
destroyed = !1;
|
|
2338
2398
|
lastGapAt = 0;
|
|
2339
2399
|
constructor(e) {
|
|
2340
|
-
this.diagnostics = new
|
|
2400
|
+
this.diagnostics = new Jn(e.onDiagnostic), this.platform = Lt(this.diagnostics), this.config = Gn(e, this.diagnostics), this.identity = Zt(this.diagnostics), this.breadcrumbs = new In(50), this.tracing = new Fn(this.diagnostics, void 0, this.config.otelLoader), this.tracing.loadOtel(), this.console = new wn(this.config.console), this.journey = new tr(Yn, this.diagnostics, this.identity.contextId, (e) => {
|
|
2341
2401
|
this.bus.broadcastJourney(e);
|
|
2342
|
-
}), this.builder = new
|
|
2402
|
+
}), this.builder = new dr({
|
|
2343
2403
|
config: this.config,
|
|
2344
|
-
limits:
|
|
2404
|
+
limits: vt,
|
|
2345
2405
|
diagnostics: this.diagnostics,
|
|
2346
2406
|
context: this.context,
|
|
2347
2407
|
journey: this.journey,
|
|
@@ -2349,7 +2409,7 @@ var sr = class {
|
|
|
2349
2409
|
sequence: this.sequence,
|
|
2350
2410
|
identity: this.identity,
|
|
2351
2411
|
platform: this.platform
|
|
2352
|
-
}), this.bus = new
|
|
2412
|
+
}), this.bus = new It(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
2353
2413
|
onRecords: (e) => {
|
|
2354
2414
|
this.ingestForwarded(e);
|
|
2355
2415
|
},
|
|
@@ -2377,7 +2437,7 @@ var sr = class {
|
|
|
2377
2437
|
return globalThis[Y] = r, r.init(), r;
|
|
2378
2438
|
}
|
|
2379
2439
|
reconfigure(e) {
|
|
2380
|
-
|
|
2440
|
+
Kn(this.config, Gn(e, this.diagnostics, this.config)), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.ready && this.reinstallCaptures(), this.diagnostics.report("config.reconfigured", "configure() was called again, the existing runtime was updated");
|
|
2381
2441
|
}
|
|
2382
2442
|
async init() {
|
|
2383
2443
|
try {
|
|
@@ -2390,10 +2450,10 @@ var sr = class {
|
|
|
2390
2450
|
}
|
|
2391
2451
|
}
|
|
2392
2452
|
async becomeSender() {
|
|
2393
|
-
this.storage = await
|
|
2453
|
+
this.storage = await hn(this.config.storage, xe, m, this.diagnostics, this.reportGap), this.transport = new xn(this.config, this.diagnostics), this.retry = new Sn(this.storage, this.transport, this.diagnostics, this.config), this.pipeline = new ur(this.transport, this.storage, this.retry, this.diagnostics), this.exitFlush = new vn({
|
|
2394
2454
|
config: this.config,
|
|
2395
2455
|
diagnostics: this.diagnostics,
|
|
2396
|
-
|
|
2456
|
+
drainForExit: () => this.pipeline?.drainForExit() ?? null
|
|
2397
2457
|
}), await cn(this.storage, this.diagnostics), this.retry.start(), this.exitFlush.install();
|
|
2398
2458
|
}
|
|
2399
2459
|
installCaptures() {
|
|
@@ -2402,9 +2462,9 @@ var sr = class {
|
|
|
2402
2462
|
diagnostics: this.diagnostics,
|
|
2403
2463
|
breadcrumbs: this.breadcrumbs,
|
|
2404
2464
|
tracing: this.tracing,
|
|
2405
|
-
logger: new
|
|
2465
|
+
logger: new w(this, a)
|
|
2406
2466
|
}, t = this.config.capture;
|
|
2407
|
-
(t.errors || t.rejections || t.resourceErrors) && this.captures.push(new
|
|
2467
|
+
(t.errors || t.rejections || t.resourceErrors) && this.captures.push(new Vt(e)), (t.fetch || t.xhr) && this.captures.push(new Gt(e)), (t.interactions || t.navigation) && this.captures.push(new Ut(e)), t.webVitals && this.captures.push(new qt(e));
|
|
2408
2468
|
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `installing ${e.name}`, () => {
|
|
2409
2469
|
e.install();
|
|
2410
2470
|
});
|
|
@@ -2456,10 +2516,14 @@ var sr = class {
|
|
|
2456
2516
|
return;
|
|
2457
2517
|
}
|
|
2458
2518
|
for (let t of e) {
|
|
2459
|
-
if (!
|
|
2519
|
+
if (!Yt(t)) {
|
|
2460
2520
|
this.diagnostics.count("record.dropped_malformed");
|
|
2461
2521
|
continue;
|
|
2462
2522
|
}
|
|
2523
|
+
if (!ar(t, this.config)) {
|
|
2524
|
+
this.diagnostics.count("record.dropped_by_sampling");
|
|
2525
|
+
continue;
|
|
2526
|
+
}
|
|
2463
2527
|
this.pipeline?.push(t);
|
|
2464
2528
|
}
|
|
2465
2529
|
}
|
|
@@ -2471,19 +2535,19 @@ var sr = class {
|
|
|
2471
2535
|
}
|
|
2472
2536
|
reportGap = (e) => {
|
|
2473
2537
|
let t = Date.now();
|
|
2474
|
-
t - this.lastGapAt < 6e4 || (this.lastGapAt = t, new
|
|
2538
|
+
t - this.lastGapAt < 6e4 || (this.lastGapAt = t, new w(this, re).warn("stored records were dropped before delivery", {
|
|
2475
2539
|
"gap.batches": e.batches,
|
|
2476
2540
|
"gap.records": e.records,
|
|
2477
2541
|
"gap.reason": e.reason
|
|
2478
2542
|
}));
|
|
2479
2543
|
};
|
|
2480
2544
|
regenerateTabId() {
|
|
2481
|
-
let e =
|
|
2545
|
+
let e = P();
|
|
2482
2546
|
this.diagnostics.report("bus.role_resolved", "another context claimed this tab id, most likely a duplicated tab. Regenerating.", {
|
|
2483
2547
|
was: this.identity.tabId,
|
|
2484
2548
|
now: e
|
|
2485
2549
|
}), this.identity.tabId = e, this.diagnostics.guard("storage.unavailable", "persisting the new tab id", () => {
|
|
2486
|
-
sessionStorage.setItem(
|
|
2550
|
+
sessionStorage.setItem(fe, e);
|
|
2487
2551
|
}), this.builder.invalidateResource();
|
|
2488
2552
|
}
|
|
2489
2553
|
async queueDepth() {
|
|
@@ -2514,93 +2578,94 @@ var sr = class {
|
|
|
2514
2578
|
function Q() {
|
|
2515
2579
|
return X.current() || X.configure({});
|
|
2516
2580
|
}
|
|
2517
|
-
function
|
|
2581
|
+
function fr(e) {
|
|
2518
2582
|
X.configure(e), Z.clear();
|
|
2519
2583
|
}
|
|
2520
|
-
function
|
|
2521
|
-
|
|
2522
|
-
|
|
2584
|
+
function pr(e, t) {
|
|
2585
|
+
if (t) return new w(Q(), e, t);
|
|
2586
|
+
let n = Z.get(e);
|
|
2587
|
+
return n || (n = new w(Q(), e), Z.set(e, n)), n;
|
|
2523
2588
|
}
|
|
2524
2589
|
function $() {
|
|
2525
|
-
return
|
|
2590
|
+
return pr("app");
|
|
2526
2591
|
}
|
|
2527
|
-
function
|
|
2592
|
+
function mr(e, t) {
|
|
2528
2593
|
$().trace(e, t);
|
|
2529
2594
|
}
|
|
2530
|
-
function
|
|
2595
|
+
function hr(e, t) {
|
|
2531
2596
|
$().debug(e, t);
|
|
2532
2597
|
}
|
|
2533
|
-
function
|
|
2598
|
+
function gr(e, t) {
|
|
2534
2599
|
$().info(e, t);
|
|
2535
2600
|
}
|
|
2536
|
-
function
|
|
2601
|
+
function _r(e, t) {
|
|
2537
2602
|
$().warn(e, t);
|
|
2538
2603
|
}
|
|
2539
|
-
function
|
|
2604
|
+
function vr(e, t, n) {
|
|
2540
2605
|
$().error(e, t, n);
|
|
2541
2606
|
}
|
|
2542
|
-
function
|
|
2607
|
+
function yr(e, t) {
|
|
2543
2608
|
$().logAction(e, t);
|
|
2544
2609
|
}
|
|
2545
|
-
function
|
|
2610
|
+
function br(e, t) {
|
|
2546
2611
|
$().logEvent(e, t);
|
|
2547
2612
|
}
|
|
2548
|
-
function
|
|
2613
|
+
function xr(e, t, n, r, i) {
|
|
2549
2614
|
$().logMetric(e, t, n, r, i);
|
|
2550
2615
|
}
|
|
2551
|
-
function
|
|
2616
|
+
function Sr(e, t, n) {
|
|
2552
2617
|
return $().timeSync(e, t, n);
|
|
2553
2618
|
}
|
|
2554
|
-
function
|
|
2619
|
+
function Cr(e, t, n) {
|
|
2555
2620
|
return $().timeAsync(e, t, n);
|
|
2556
2621
|
}
|
|
2557
|
-
function
|
|
2622
|
+
function wr(e, t) {
|
|
2558
2623
|
Q().context.set(e, t);
|
|
2559
2624
|
}
|
|
2560
|
-
function
|
|
2625
|
+
function Tr(e) {
|
|
2561
2626
|
Q().context.setMany(e);
|
|
2562
2627
|
}
|
|
2563
|
-
function
|
|
2628
|
+
function Er(e) {
|
|
2564
2629
|
Q().context.remove(e);
|
|
2565
2630
|
}
|
|
2566
|
-
function
|
|
2631
|
+
function Dr(e, t) {
|
|
2567
2632
|
return Q().journey.start(e, t);
|
|
2568
2633
|
}
|
|
2569
|
-
function
|
|
2634
|
+
function Or() {
|
|
2570
2635
|
Q().journey.end();
|
|
2571
2636
|
}
|
|
2572
|
-
function
|
|
2637
|
+
function kr() {
|
|
2573
2638
|
return Q().journey.current();
|
|
2574
2639
|
}
|
|
2575
|
-
function
|
|
2640
|
+
function Ar() {
|
|
2576
2641
|
return Q().journey.getToken();
|
|
2577
2642
|
}
|
|
2578
|
-
function
|
|
2643
|
+
function jr(e) {
|
|
2579
2644
|
return Q().journey.adopt(e, "manual", !0);
|
|
2580
2645
|
}
|
|
2581
|
-
function
|
|
2646
|
+
function Mr(e) {
|
|
2582
2647
|
Q().registerWorker(e);
|
|
2583
2648
|
}
|
|
2584
|
-
function
|
|
2649
|
+
function Nr() {
|
|
2585
2650
|
Q().tracing.rotate("explicit");
|
|
2586
2651
|
}
|
|
2587
|
-
function
|
|
2652
|
+
function Pr() {
|
|
2588
2653
|
return Q().tracing.headers();
|
|
2589
2654
|
}
|
|
2590
|
-
function
|
|
2655
|
+
function Fr() {
|
|
2591
2656
|
return Q().flush();
|
|
2592
2657
|
}
|
|
2593
|
-
function
|
|
2658
|
+
function Ir() {
|
|
2594
2659
|
return Q().queueDepth();
|
|
2595
2660
|
}
|
|
2596
|
-
function
|
|
2661
|
+
function Lr() {
|
|
2597
2662
|
return Q().diagnostics.snapshot();
|
|
2598
2663
|
}
|
|
2599
|
-
async function
|
|
2664
|
+
async function Rr() {
|
|
2600
2665
|
let e = X.current();
|
|
2601
2666
|
Z.clear(), await e?.destroy();
|
|
2602
2667
|
}
|
|
2603
2668
|
//#endregion
|
|
2604
|
-
export {
|
|
2669
|
+
export { w as OneLogger, jr as adoptJourney, fr as configure, kr as currentJourney, hr as debug, Or as endJourney, vr as error, Fr as flush, Lr as getDiagnosticCounters, Ar as getJourneyToken, pr as getLogger, Ir as getQueueDepth, Pr as getTraceHeaders, gr as info, yr as logAction, br as logEvent, xr as logMetric, Mr as registerWorker, Er as removeContext, wr as setContext, Tr as setContextMap, Rr as shutdown, Dr as startJourney, Nr as startTrace, Cr as timeAsync, Sr as timeSync, mr as trace, _r as warn };
|
|
2605
2670
|
|
|
2606
2671
|
//# sourceMappingURL=index.js.map
|