@utk09/ui-observability 0.7.0 → 0.9.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 +79 -1
- package/README.md +170 -41
- package/dist/bus/bus.d.ts +75 -11
- package/dist/bus/links.d.ts +6 -3
- package/dist/bus-CtJWf9QN.cjs +2 -0
- package/dist/bus-CtJWf9QN.cjs.map +1 -0
- package/dist/{bus-DfAbg_pg.js → bus-D8kH58tb.js} +176 -73
- package/dist/bus-D8kH58tb.js.map +1 -0
- package/dist/capture/console.d.ts +37 -0
- package/dist/capture/errors.d.ts +2 -4
- package/dist/capture/interactions.d.ts +7 -6
- package/dist/capture/long-frames.d.ts +31 -0
- package/dist/capture/network.d.ts +23 -9
- package/dist/capture/storm.d.ts +17 -0
- package/dist/capture/types.d.ts +5 -3
- package/dist/console-BpHfWstv.cjs +2 -0
- package/dist/console-BpHfWstv.cjs.map +1 -0
- package/dist/console-DjLbryED.js +82 -0
- package/dist/console-DjLbryED.js.map +1 -0
- package/dist/constants-Br3b89Wg.cjs +2 -0
- package/dist/constants-Br3b89Wg.cjs.map +1 -0
- package/dist/constants-DM94FjVX.js +96 -0
- package/dist/constants-DM94FjVX.js.map +1 -0
- package/dist/constants.d.ts +51 -10
- package/dist/core/breadcrumbs.d.ts +1 -1
- package/dist/core/diagnostics.d.ts +2 -2
- package/dist/core/journey.d.ts +16 -4
- package/dist/core/logger.d.ts +6 -2
- package/dist/core/pipeline.d.ts +20 -11
- package/dist/core/record.d.ts +14 -6
- package/dist/core/remote-rules.d.ts +17 -0
- package/dist/core/remote-sampling.d.ts +65 -0
- package/dist/core/runtime.d.ts +52 -18
- package/dist/core/sampling.d.ts +5 -2
- package/dist/core/sender.d.ts +18 -10
- package/dist/deadline-B5DINjD5.js +111 -0
- package/dist/deadline-B5DINjD5.js.map +1 -0
- package/dist/deadline-Cbg2cbUw.cjs +2 -0
- package/dist/deadline-Cbg2cbUw.cjs.map +1 -0
- package/dist/error-like-Ywo5uRHo.js +19 -0
- package/dist/error-like-Ywo5uRHo.js.map +1 -0
- package/dist/error-like-gGRx2s36.cjs +2 -0
- package/dist/error-like-gGRx2s36.cjs.map +1 -0
- package/dist/errors-CpGRhhIf.cjs +3 -0
- package/dist/errors-CpGRhhIf.cjs.map +1 -0
- package/dist/{errors-4MQyjZVj.js → errors-DH4QJS0u.js} +38 -20
- package/dist/errors-DH4QJS0u.js.map +1 -0
- package/dist/global-scope-BN-Io_yv.cjs +2 -0
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -0
- package/dist/global-scope-dp2jADRl.js +19 -0
- package/dist/global-scope-dp2jADRl.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -5
- package/dist/index.js +633 -463
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-DNdf1fmL.cjs +2 -0
- package/dist/indexeddb-storage-DNdf1fmL.cjs.map +1 -0
- package/dist/{indexeddb-storage-0LtUALBg.js → indexeddb-storage-n1qkFBGA.js} +17 -17
- package/dist/indexeddb-storage-n1qkFBGA.js.map +1 -0
- package/dist/interactions-31eHGwEQ.cjs +2 -0
- package/dist/interactions-31eHGwEQ.cjs.map +1 -0
- package/dist/{interactions-BaCmoGLB.js → interactions-OU94MPXs.js} +22 -19
- package/dist/interactions-OU94MPXs.js.map +1 -0
- package/dist/journey-CE2EcwHW.cjs +2 -0
- package/dist/journey-CE2EcwHW.cjs.map +1 -0
- package/dist/journey-CeJ1QoT2.js +162 -0
- package/dist/journey-CeJ1QoT2.js.map +1 -0
- package/dist/library-request-C9uJFlbq.cjs +2 -0
- package/dist/library-request-C9uJFlbq.cjs.map +1 -0
- package/dist/library-request-DvhuplAB.js +14 -0
- package/dist/library-request-DvhuplAB.js.map +1 -0
- package/dist/long-frames-B8VdA_ny.cjs +2 -0
- package/dist/long-frames-B8VdA_ny.cjs.map +1 -0
- package/dist/long-frames-C_7OutLs.js +65 -0
- package/dist/long-frames-C_7OutLs.js.map +1 -0
- package/dist/models/batch.d.ts +1 -1
- package/dist/models/bus.d.ts +23 -4
- package/dist/models/config.d.ts +132 -11
- package/dist/models/log-record.d.ts +12 -6
- package/dist/network-BAV7ipyn.cjs +2 -0
- package/dist/network-BAV7ipyn.cjs.map +1 -0
- package/dist/network-D_lloS5t.js +174 -0
- package/dist/network-D_lloS5t.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs +2 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -0
- package/dist/patch-CCWfuEY7.js +9 -0
- package/dist/patch-CCWfuEY7.js.map +1 -0
- package/dist/{platform-ByQllE_W.cjs → platform-D4wu1eIF.cjs} +2 -2
- package/dist/platform-D4wu1eIF.cjs.map +1 -0
- package/dist/{platform-YuByH8A5.js → platform-IHBZGqUe.js} +9 -9
- package/dist/platform-IHBZGqUe.js.map +1 -0
- package/dist/remote-rules-Bt1XsdEQ.js +86 -0
- package/dist/remote-rules-Bt1XsdEQ.js.map +1 -0
- package/dist/remote-rules-kuDf5gbe.cjs +2 -0
- package/dist/remote-rules-kuDf5gbe.cjs.map +1 -0
- package/dist/sampling-BI15ds9D.cjs +2 -0
- package/dist/sampling-BI15ds9D.cjs.map +1 -0
- package/dist/sampling-o0VY1mqQ.js +63 -0
- package/dist/sampling-o0VY1mqQ.js.map +1 -0
- package/dist/sanitize-B9UheVKc.js +123 -0
- package/dist/sanitize-B9UheVKc.js.map +1 -0
- package/dist/sanitize-DSIP7amZ.cjs +2 -0
- package/dist/sanitize-DSIP7amZ.cjs.map +1 -0
- package/dist/{sender-BIob8eZz.js → sender-BnNj9bOX.js} +415 -272
- package/dist/sender-BnNj9bOX.js.map +1 -0
- package/dist/sender-D0OsyB1c.cjs +3 -0
- package/dist/sender-D0OsyB1c.cjs.map +1 -0
- package/dist/storage/emergency-queue.d.ts +1 -1
- package/dist/storage/factory.d.ts +1 -1
- package/dist/storage/idb-driver.d.ts +1 -1
- package/dist/storage/local-storage.d.ts +3 -3
- package/dist/storage/memory-storage.d.ts +3 -3
- package/dist/storm-BTw0J6eE.js +10 -0
- package/dist/storm-BTw0J6eE.js.map +1 -0
- package/dist/storm-Y-yuBhvv.cjs +2 -0
- package/dist/storm-Y-yuBhvv.cjs.map +1 -0
- package/dist/transport/compression.d.ts +1 -1
- package/dist/transport/custom-transport.d.ts +20 -0
- package/dist/transport/errors.d.ts +2 -1
- package/dist/transport/exit-flush.d.ts +32 -13
- package/dist/transport/http-transport.d.ts +57 -25
- package/dist/transport/memory-transport.d.ts +30 -0
- package/dist/transport/retry-engine.d.ts +7 -7
- package/dist/transport/serializers/select.d.ts +12 -1
- package/dist/transport/status-transport.d.ts +74 -0
- package/dist/utils/console.d.ts +1 -1
- package/dist/utils/deadline.d.ts +7 -0
- package/dist/utils/error-like.d.ts +25 -0
- package/dist/utils/global-scope.d.ts +20 -0
- package/dist/utils/identity.d.ts +1 -1
- package/dist/utils/library-console.d.ts +11 -0
- package/dist/utils/library-request.d.ts +12 -0
- package/dist/utils/patch.d.ts +9 -0
- package/dist/utils/platform.d.ts +3 -3
- package/dist/utils/sequence.d.ts +0 -5
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/tracing.d.ts +3 -3
- package/dist/utils/unref.d.ts +2 -2
- package/dist/{web-vitals-DHZ0yA_H.js → web-vitals-Bflr5jSA.js} +4 -2
- package/dist/web-vitals-Bflr5jSA.js.map +1 -0
- package/dist/web-vitals-DFuoTQbZ.cjs +2 -0
- package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -0
- package/package.json +2 -2
- package/dist/bus-DeZzr2bx.cjs +0 -2
- package/dist/bus-DeZzr2bx.cjs.map +0 -1
- package/dist/bus-DfAbg_pg.js.map +0 -1
- package/dist/constants-C8nZQBmQ.js +0 -86
- package/dist/constants-C8nZQBmQ.js.map +0 -1
- package/dist/constants-IBL_jd5R.cjs +0 -2
- package/dist/constants-IBL_jd5R.cjs.map +0 -1
- package/dist/errors-4MQyjZVj.js.map +0 -1
- package/dist/errors-CUdShXe7.cjs +0 -3
- package/dist/errors-CUdShXe7.cjs.map +0 -1
- package/dist/indexeddb-storage-0LtUALBg.js.map +0 -1
- package/dist/indexeddb-storage-CcEJlq2l.cjs +0 -2
- package/dist/indexeddb-storage-CcEJlq2l.cjs.map +0 -1
- package/dist/interactions-BMNPQ3WH.cjs +0 -2
- package/dist/interactions-BMNPQ3WH.cjs.map +0 -1
- package/dist/interactions-BaCmoGLB.js.map +0 -1
- package/dist/network-DBNvxCE3.cjs +0 -2
- package/dist/network-DBNvxCE3.cjs.map +0 -1
- package/dist/network-jQ2t8rU4.js +0 -111
- package/dist/network-jQ2t8rU4.js.map +0 -1
- package/dist/platform-ByQllE_W.cjs.map +0 -1
- package/dist/platform-YuByH8A5.js.map +0 -1
- package/dist/sampling-CbYySsZ1.js +0 -251
- package/dist/sampling-CbYySsZ1.js.map +0 -1
- package/dist/sampling-Cs50xsZl.cjs +0 -2
- package/dist/sampling-Cs50xsZl.cjs.map +0 -1
- package/dist/sender-BIob8eZz.js.map +0 -1
- package/dist/sender-iOjzcueM.cjs +0 -3
- package/dist/sender-iOjzcueM.cjs.map +0 -1
- package/dist/unref-16maCyKA.js +0 -8
- package/dist/unref-16maCyKA.js.map +0 -1
- package/dist/unref-CU9Nyz_9.cjs +0 -2
- package/dist/unref-CU9Nyz_9.cjs.map +0 -1
- package/dist/web-vitals-B2FYsEAU.cjs +0 -2
- package/dist/web-vitals-B2FYsEAU.cjs.map +0 -1
- package/dist/web-vitals-DHZ0yA_H.js.map +0 -1
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { A as e, At as t, B as n, Ct as r, Gt as i, J as a, Kt as o, Lt as s, M as c, Nt as l, Q as u, R as d, Rt as f, V as p, Wt as m, X as h, Xt as ee, Y as te, Z as ne, b as g, cn as re, d as _, fn as v, ft as y, gt as b, ht as x, j as S, jt as C, ln as w, nn as T, on as ie, pn as ae, pt as oe, q as se, rn as E, sn as ce, tn as le, vt as ue, wt as de, yt as fe } from "./constants-DM94FjVX.js";
|
|
2
|
+
import { o as pe, t as me } from "./sampling-o0VY1mqQ.js";
|
|
3
|
+
import { o as he, t as D } from "./sanitize-B9UheVKc.js";
|
|
4
|
+
import { n as O, r as k, s as A, t as j } from "./deadline-B5DINjD5.js";
|
|
5
|
+
import { n as M, t as N } from "./remote-rules-Bt1XsdEQ.js";
|
|
6
|
+
import { n as P } from "./library-request-DvhuplAB.js";
|
|
4
7
|
//#region src/models/batch.ts
|
|
5
|
-
function
|
|
8
|
+
function F(e) {
|
|
6
9
|
if (typeof e != "object" || !e) return !1;
|
|
7
10
|
let t = Reflect.get(e, "id"), n = Reflect.get(e, "createdAt"), r = Reflect.get(e, "attempts"), i = Reflect.get(e, "records");
|
|
8
11
|
return typeof t == "string" && typeof n == "number" && typeof r == "number" && Array.isArray(i);
|
|
9
12
|
}
|
|
10
|
-
function
|
|
13
|
+
function I(e, t) {
|
|
11
14
|
if (e.records.length < 2) return null;
|
|
12
15
|
let n = Math.floor(e.records.length / 2), r = (n) => ({
|
|
13
|
-
id:
|
|
16
|
+
id: A(t),
|
|
14
17
|
records: n,
|
|
15
18
|
createdAt: e.createdAt,
|
|
16
19
|
attempts: e.attempts
|
|
@@ -19,13 +22,13 @@ function P(e, t) {
|
|
|
19
22
|
}
|
|
20
23
|
//#endregion
|
|
21
24
|
//#region src/utils/lock.ts
|
|
22
|
-
function
|
|
25
|
+
function L(e, t, n, { skipIfBusy: r = !0 } = {}) {
|
|
23
26
|
let i = globalThis.navigator?.locks;
|
|
24
27
|
return i?.request ? t.guardAsync("storage.degraded", `The library could not get the lock ${e}.`, () => i.request(e, { ifAvailable: r }, (e) => e ? n() : Promise.resolve(void 0))) : n();
|
|
25
28
|
}
|
|
26
29
|
//#endregion
|
|
27
30
|
//#region src/storage/keys.ts
|
|
28
|
-
function
|
|
31
|
+
function R(e, t) {
|
|
29
32
|
let n = [];
|
|
30
33
|
return t.guard("storage.unavailable", "The library could not list the localStorage keys.", () => {
|
|
31
34
|
for (let t = 0; t < localStorage.length; t++) {
|
|
@@ -36,53 +39,53 @@ function I(e, t) {
|
|
|
36
39
|
}
|
|
37
40
|
//#endregion
|
|
38
41
|
//#region src/storage/emergency-queue.ts
|
|
39
|
-
function
|
|
42
|
+
function ge(e) {
|
|
40
43
|
let t = String(e.createdAt).padStart(14, "0");
|
|
41
|
-
return `${
|
|
44
|
+
return `${n}${t}.${e.id}`;
|
|
42
45
|
}
|
|
43
|
-
function
|
|
46
|
+
function _e(e, t) {
|
|
44
47
|
let n = t.guard("storage.degraded", "An emergency entry is not valid JSON. The library dropped it.", () => JSON.parse(e));
|
|
45
|
-
return n === void 0 ? null :
|
|
48
|
+
return n === void 0 ? null : F(n) ? n : (t.report("storage.degraded", "An emergency entry is not a batch. The library dropped it."), null);
|
|
46
49
|
}
|
|
47
|
-
async function
|
|
48
|
-
let
|
|
49
|
-
for (let
|
|
50
|
-
let
|
|
51
|
-
let e = localStorage.getItem(
|
|
52
|
-
return localStorage.removeItem(
|
|
50
|
+
async function ve(e, t) {
|
|
51
|
+
let r = 0;
|
|
52
|
+
for (let i of R(n, t)) {
|
|
53
|
+
let n = t.guard("storage.unavailable", "The library could not read the emergency queue.", () => {
|
|
54
|
+
let e = localStorage.getItem(i);
|
|
55
|
+
return localStorage.removeItem(i), e;
|
|
53
56
|
});
|
|
54
|
-
if (!
|
|
55
|
-
let a =
|
|
57
|
+
if (!n) continue;
|
|
58
|
+
let a = _e(n, t);
|
|
56
59
|
if (a !== null) try {
|
|
57
|
-
await
|
|
60
|
+
await O(e.save(a), T), r++;
|
|
58
61
|
} catch (e) {
|
|
59
|
-
t.report("storage.degraded", "The library could not recover an emergency batch.", { key:
|
|
62
|
+
t.report("storage.degraded", "The library could not recover an emergency batch.", { key: i }, e);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
|
-
return
|
|
65
|
+
return r;
|
|
63
66
|
}
|
|
64
|
-
function
|
|
65
|
-
let
|
|
66
|
-
t.guard("storage.quota_exceeded",
|
|
67
|
-
let
|
|
68
|
-
for (let e of
|
|
69
|
-
localStorage.setItem(
|
|
67
|
+
function z(e, t) {
|
|
68
|
+
let r = `writing the emergency queue, ${String(e.records.length)} records`;
|
|
69
|
+
t.guard("storage.quota_exceeded", r, () => {
|
|
70
|
+
let r = R(n, t);
|
|
71
|
+
for (let e of r.slice(0, Math.max(0, r.length - 20 + 1))) localStorage.removeItem(e);
|
|
72
|
+
localStorage.setItem(ge(e), JSON.stringify(e));
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
|
-
async function
|
|
73
|
-
return await
|
|
75
|
+
async function ye(e, t) {
|
|
76
|
+
return await L("ui-observability.emergency", t, () => ve(e, t), { skipIfBusy: !1 }) ?? 0;
|
|
74
77
|
}
|
|
75
78
|
//#endregion
|
|
76
79
|
//#region src/storage/local-storage.ts
|
|
77
|
-
function
|
|
80
|
+
function be(e) {
|
|
78
81
|
let t = String(e.createdAt).padStart(14, "0");
|
|
79
|
-
return `${
|
|
82
|
+
return `${g}${t}.${e.id}`;
|
|
80
83
|
}
|
|
81
|
-
function
|
|
82
|
-
let t =
|
|
84
|
+
function xe(e) {
|
|
85
|
+
let t = g.length, n = Number(e.slice(t, t + 14));
|
|
83
86
|
return Number.isFinite(n) ? n : null;
|
|
84
87
|
}
|
|
85
|
-
var
|
|
88
|
+
var Se = class {
|
|
86
89
|
limits;
|
|
87
90
|
diagnostics;
|
|
88
91
|
onGap;
|
|
@@ -127,7 +130,7 @@ var pe = class {
|
|
|
127
130
|
this.removeKey(e), t.batches++, t.records += n?.records.length ?? 0;
|
|
128
131
|
}, r = [];
|
|
129
132
|
for (let t of this.keys()) {
|
|
130
|
-
let i =
|
|
133
|
+
let i = xe(t);
|
|
131
134
|
i === null || i < e ? n(t) : r.push(t);
|
|
132
135
|
}
|
|
133
136
|
let i = r.length - this.limits.maxBatches;
|
|
@@ -147,7 +150,7 @@ var pe = class {
|
|
|
147
150
|
return Promise.resolve();
|
|
148
151
|
}
|
|
149
152
|
write(e, t) {
|
|
150
|
-
return this.diagnostics.guard("storage.quota_exceeded", t, () => (localStorage.setItem(
|
|
153
|
+
return this.diagnostics.guard("storage.quota_exceeded", t, () => (localStorage.setItem(be(e), JSON.stringify(e)), !0)) === !0;
|
|
151
154
|
}
|
|
152
155
|
evictForQuota() {
|
|
153
156
|
let e = this.keys(), t = {
|
|
@@ -168,7 +171,7 @@ var pe = class {
|
|
|
168
171
|
let t = this.diagnostics.guard("storage.unavailable", "The library could not read a stored batch.", () => localStorage.getItem(e));
|
|
169
172
|
if (!t) return null;
|
|
170
173
|
let n = this.diagnostics.guard("storage.degraded", "A stored batch is corrupt. The library removed it.", () => JSON.parse(t));
|
|
171
|
-
return n === void 0 ? null :
|
|
174
|
+
return n === void 0 ? null : F(n) ? n : (this.diagnostics.report("storage.degraded", "A stored entry is not a batch. The library dropped it."), null);
|
|
172
175
|
}
|
|
173
176
|
keyOf(e) {
|
|
174
177
|
return this.keys().find((t) => t.endsWith(`.${e}`)) ?? null;
|
|
@@ -182,18 +185,18 @@ var pe = class {
|
|
|
182
185
|
});
|
|
183
186
|
}
|
|
184
187
|
keys() {
|
|
185
|
-
return
|
|
188
|
+
return R(g, this.diagnostics);
|
|
186
189
|
}
|
|
187
190
|
};
|
|
188
191
|
//#endregion
|
|
189
192
|
//#region src/storage/memory-storage.ts
|
|
190
|
-
function
|
|
193
|
+
function B(e) {
|
|
191
194
|
return e.reduce((e, t) => e + t.records.length, 0);
|
|
192
195
|
}
|
|
193
|
-
var
|
|
196
|
+
var V = class {
|
|
194
197
|
limits;
|
|
195
198
|
onGap;
|
|
196
|
-
name =
|
|
199
|
+
name = ce;
|
|
197
200
|
batches = [];
|
|
198
201
|
constructor(e, t) {
|
|
199
202
|
this.limits = e, this.onGap = t;
|
|
@@ -217,12 +220,12 @@ var W = class {
|
|
|
217
220
|
records: 0,
|
|
218
221
|
reason: "expired"
|
|
219
222
|
}, n = this.batches.filter((t) => t.createdAt < e);
|
|
220
|
-
this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records +=
|
|
223
|
+
this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records += B(n);
|
|
221
224
|
let r = this.batches.length - this.limits.maxBatches;
|
|
222
225
|
if (r > 0) {
|
|
223
226
|
t.reason = "over_capacity";
|
|
224
227
|
let e = this.batches.slice(0, r);
|
|
225
|
-
this.batches = this.batches.slice(r), t.batches += e.length, t.records +=
|
|
228
|
+
this.batches = this.batches.slice(r), t.batches += e.length, t.records += B(e);
|
|
226
229
|
}
|
|
227
230
|
return t.batches > 0 && this.onGap?.(t), Promise.resolve(t);
|
|
228
231
|
}
|
|
@@ -235,8 +238,8 @@ var W = class {
|
|
|
235
238
|
close() {
|
|
236
239
|
return this.batches = [], Promise.resolve();
|
|
237
240
|
}
|
|
238
|
-
},
|
|
239
|
-
name:
|
|
241
|
+
}, Ce = {
|
|
242
|
+
name: re,
|
|
240
243
|
save: () => Promise.resolve(),
|
|
241
244
|
take: () => Promise.resolve([]),
|
|
242
245
|
remove: () => Promise.resolve(),
|
|
@@ -250,91 +253,109 @@ var W = class {
|
|
|
250
253
|
clear: () => Promise.resolve(),
|
|
251
254
|
close: () => Promise.resolve()
|
|
252
255
|
};
|
|
253
|
-
function
|
|
256
|
+
function we(e) {
|
|
254
257
|
return e.guard("storage.unavailable", "The library could not read indexedDB.", () => globalThis.indexedDB != null) === !0;
|
|
255
258
|
}
|
|
256
|
-
function
|
|
257
|
-
return e.guard("storage.unavailable", "The library could not write a test key to localStorage.", () => (localStorage.setItem(
|
|
259
|
+
function Te(e) {
|
|
260
|
+
return e.guard("storage.unavailable", "The library could not write a test key to localStorage.", () => (localStorage.setItem(w, "1"), localStorage.removeItem(w), !0)) === !0;
|
|
258
261
|
}
|
|
259
|
-
async function
|
|
260
|
-
if (e === "none") return
|
|
261
|
-
if (e === "memory") return new
|
|
262
|
+
async function Ee(e, t, n, r, i) {
|
|
263
|
+
if (e === "none") return Ce;
|
|
264
|
+
if (e === "memory") return new V(n, i);
|
|
262
265
|
if (e === "indexeddb" || e === "auto") {
|
|
263
|
-
if (
|
|
266
|
+
if (we(r)) {
|
|
264
267
|
let e = await r.guardAsync("storage.unavailable", "The library could not open IndexedDB.", async () => {
|
|
265
|
-
let { IndexedDbStorage: e } = await import("./indexeddb-storage-
|
|
268
|
+
let { IndexedDbStorage: e } = await import("./indexeddb-storage-n1qkFBGA.js"), a = new e(t, n, r, i);
|
|
266
269
|
return await a.open(), a;
|
|
267
270
|
});
|
|
268
271
|
if (e) return e;
|
|
269
272
|
}
|
|
270
|
-
if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB is not available. The library uses memory storage instead."), new
|
|
273
|
+
if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB is not available. The library uses memory storage instead."), new V(n, i);
|
|
274
|
+
}
|
|
275
|
+
return Te(r) ? new Se(n, r, i) : (r.report("storage.degraded", "No persistent storage is available. The library keeps undelivered records in memory only."), new V(n, i));
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/transport/errors.ts
|
|
279
|
+
var H = class extends Error {
|
|
280
|
+
kind;
|
|
281
|
+
status;
|
|
282
|
+
retryAfterMs;
|
|
283
|
+
maxBytes;
|
|
284
|
+
constructor(e, t, n, r, i, a) {
|
|
285
|
+
super(t, a === void 0 ? void 0 : { cause: a }), this.kind = e, this.status = n, this.retryAfterMs = r, this.maxBytes = i, this.name = "TransportError";
|
|
271
286
|
}
|
|
272
|
-
|
|
287
|
+
};
|
|
288
|
+
function De(e) {
|
|
289
|
+
if (!e) return;
|
|
290
|
+
let t = Number(e);
|
|
291
|
+
if (Number.isFinite(t)) return Math.max(0, t * b);
|
|
292
|
+
let n = Date.parse(e);
|
|
293
|
+
return Number.isNaN(n) ? void 0 : Math.max(0, n - Date.now());
|
|
273
294
|
}
|
|
274
295
|
//#endregion
|
|
275
296
|
//#region src/transport/serializers/ecs.ts
|
|
276
|
-
function
|
|
277
|
-
return
|
|
297
|
+
function Oe(e) {
|
|
298
|
+
return ue.test(e) ? Number(BigInt(e) / fe) : Date.now();
|
|
278
299
|
}
|
|
279
|
-
function
|
|
300
|
+
function ke(e) {
|
|
280
301
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : typeof e == "bigint" ? e.toString() : null;
|
|
281
302
|
}
|
|
282
|
-
function
|
|
303
|
+
function Ae(e, t, n) {
|
|
283
304
|
let r = e[t];
|
|
284
305
|
r === void 0 ? e[t] = n : Array.isArray(r) ? r.push(n) : e[t] = [r, n];
|
|
285
306
|
}
|
|
286
|
-
function
|
|
287
|
-
let i =
|
|
288
|
-
if (i !== null)
|
|
307
|
+
function U(e, t, n, r) {
|
|
308
|
+
let i = ke(n);
|
|
309
|
+
if (i !== null) Ae(e, t, i);
|
|
289
310
|
else if (typeof n == "object" && n && !r.has(n)) {
|
|
290
|
-
if (r.add(n), Array.isArray(n)) for (let i of n)
|
|
291
|
-
else for (let [i, a] of Object.entries(n))
|
|
311
|
+
if (r.add(n), Array.isArray(n)) for (let i of n) U(e, t, i, r);
|
|
312
|
+
else for (let [i, a] of Object.entries(n)) U(e, `${t}.${i}`, a, r);
|
|
292
313
|
r.delete(n);
|
|
293
314
|
}
|
|
294
315
|
}
|
|
295
|
-
function
|
|
316
|
+
function W(e) {
|
|
296
317
|
let t = Object.create(null), n = /* @__PURE__ */ new WeakSet();
|
|
297
|
-
for (let [r, i] of Object.entries(e))
|
|
318
|
+
for (let [r, i] of Object.entries(e)) U(t, r, i, n);
|
|
298
319
|
return t;
|
|
299
320
|
}
|
|
300
|
-
var
|
|
321
|
+
var je = {
|
|
301
322
|
name: "ecs",
|
|
302
323
|
serialize(e) {
|
|
303
324
|
return {
|
|
304
325
|
body: `${e.map((e) => {
|
|
305
|
-
let t =
|
|
326
|
+
let t = Oe(e.timeUnixNano);
|
|
306
327
|
return JSON.stringify({
|
|
307
328
|
"@timestamp": new Date(t).toISOString(),
|
|
308
329
|
message: e.body,
|
|
309
|
-
log: { level:
|
|
330
|
+
log: { level: d[e.severityText] ?? e.severityText.toLowerCase() },
|
|
310
331
|
trace: { id: e.traceId },
|
|
311
332
|
span: { id: e.spanId },
|
|
312
333
|
service: {
|
|
313
|
-
name: e.resource[
|
|
314
|
-
version: e.resource[
|
|
315
|
-
environment: e.resource[
|
|
334
|
+
name: e.resource[s],
|
|
335
|
+
version: e.resource[f],
|
|
336
|
+
environment: e.resource[l]
|
|
316
337
|
},
|
|
317
|
-
user_agent: { original: e.resource[
|
|
338
|
+
user_agent: { original: e.resource[C] },
|
|
318
339
|
url: { full: e.attributes["url.full"] ?? e.attributes["page.url"] },
|
|
319
340
|
labels: {
|
|
320
|
-
...
|
|
321
|
-
...
|
|
341
|
+
...W(e.resource),
|
|
342
|
+
...W(e.attributes)
|
|
322
343
|
}
|
|
323
344
|
});
|
|
324
345
|
}).join("\n")}\n`,
|
|
325
|
-
contentType:
|
|
346
|
+
contentType: S
|
|
326
347
|
};
|
|
327
348
|
}
|
|
328
349
|
};
|
|
329
350
|
//#endregion
|
|
330
351
|
//#region src/transport/serializers/otlp.ts
|
|
331
|
-
function
|
|
332
|
-
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.
|
|
352
|
+
function G(e) {
|
|
353
|
+
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isSafeInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(G).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: K(e) } } : null;
|
|
333
354
|
}
|
|
334
|
-
function
|
|
355
|
+
function K(e) {
|
|
335
356
|
let t = [];
|
|
336
357
|
for (let [n, r] of Object.entries(e)) {
|
|
337
|
-
let e =
|
|
358
|
+
let e = G(r);
|
|
338
359
|
e && t.push({
|
|
339
360
|
key: n,
|
|
340
361
|
value: e
|
|
@@ -342,30 +363,30 @@ function J(e) {
|
|
|
342
363
|
}
|
|
343
364
|
return t;
|
|
344
365
|
}
|
|
345
|
-
var
|
|
346
|
-
function
|
|
347
|
-
let t =
|
|
366
|
+
var q = /* @__PURE__ */ new WeakMap();
|
|
367
|
+
function Me(e) {
|
|
368
|
+
let t = q.get(e);
|
|
348
369
|
if (t !== void 0) return t;
|
|
349
370
|
let n = JSON.stringify(e);
|
|
350
|
-
return
|
|
371
|
+
return q.set(e, n), n;
|
|
351
372
|
}
|
|
352
|
-
var
|
|
353
|
-
name:
|
|
354
|
-
serialize(
|
|
355
|
-
let
|
|
356
|
-
for (let
|
|
357
|
-
let
|
|
358
|
-
r ? r.records.push(
|
|
359
|
-
resource:
|
|
360
|
-
records: [
|
|
373
|
+
var Ne = {
|
|
374
|
+
name: ee,
|
|
375
|
+
serialize(t) {
|
|
376
|
+
let n = /* @__PURE__ */ new Map();
|
|
377
|
+
for (let e of t) {
|
|
378
|
+
let t = Me(e.resource), r = n.get(t);
|
|
379
|
+
r ? r.records.push(e) : n.set(t, {
|
|
380
|
+
resource: e.resource,
|
|
381
|
+
records: [e]
|
|
361
382
|
});
|
|
362
383
|
}
|
|
363
|
-
let
|
|
364
|
-
resource: { attributes:
|
|
384
|
+
let r = [...n.values()].map((e) => ({
|
|
385
|
+
resource: { attributes: K(e.resource) },
|
|
365
386
|
scopeLogs: [{
|
|
366
387
|
scope: {
|
|
367
|
-
name:
|
|
368
|
-
version:
|
|
388
|
+
name: v,
|
|
389
|
+
version: ae
|
|
369
390
|
},
|
|
370
391
|
logRecords: e.records.map((e) => ({
|
|
371
392
|
timeUnixNano: e.timeUnixNano,
|
|
@@ -376,24 +397,109 @@ var Ce = {
|
|
|
376
397
|
traceId: e.traceId,
|
|
377
398
|
spanId: e.spanId,
|
|
378
399
|
flags: e.traceFlags,
|
|
379
|
-
attributes:
|
|
400
|
+
attributes: K(e.attributes)
|
|
380
401
|
}))
|
|
381
402
|
}]
|
|
382
403
|
}));
|
|
383
404
|
return {
|
|
384
|
-
body: JSON.stringify({ resourceLogs:
|
|
385
|
-
contentType:
|
|
405
|
+
body: JSON.stringify({ resourceLogs: r }),
|
|
406
|
+
contentType: e
|
|
386
407
|
};
|
|
387
408
|
}
|
|
388
409
|
};
|
|
389
410
|
//#endregion
|
|
390
411
|
//#region src/transport/serializers/select.ts
|
|
391
|
-
function
|
|
392
|
-
return e === "otlp" ?
|
|
412
|
+
function Pe(e) {
|
|
413
|
+
return e === "otlp" ? Ne : e === "ecs" ? je : e;
|
|
414
|
+
}
|
|
415
|
+
function J(e, t, n, r) {
|
|
416
|
+
try {
|
|
417
|
+
return Pe(e).serialize(t.records);
|
|
418
|
+
} catch (e) {
|
|
419
|
+
n.report("transport.serialize_failed", r, { batchId: t.id }, e);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
393
422
|
}
|
|
394
423
|
//#endregion
|
|
395
|
-
//#region src/transport/
|
|
396
|
-
var
|
|
424
|
+
//#region src/transport/status-transport.ts
|
|
425
|
+
var Y = class {
|
|
426
|
+
config;
|
|
427
|
+
diagnostics;
|
|
428
|
+
onSampling;
|
|
429
|
+
throttledUntil = 0;
|
|
430
|
+
constructor(e, t, n = () => void 0) {
|
|
431
|
+
this.config = e, this.diagnostics = t, this.onSampling = n;
|
|
432
|
+
}
|
|
433
|
+
throttledForMs() {
|
|
434
|
+
return Math.max(0, this.throttledUntil - Date.now());
|
|
435
|
+
}
|
|
436
|
+
serialize(e) {
|
|
437
|
+
return J(this.config.serializer, e, this.diagnostics, "The serializer threw an error. The library dropped the batch.");
|
|
438
|
+
}
|
|
439
|
+
accept(e) {
|
|
440
|
+
this.throttledUntil = 0, this.config.sampling.remote && e != null && this.onSampling(e);
|
|
441
|
+
}
|
|
442
|
+
reject(e, t, n) {
|
|
443
|
+
let r = String(e);
|
|
444
|
+
if (e === 401 || e === 403) {
|
|
445
|
+
let t = n.advice === void 0 ? "" : ` ${n.advice}`;
|
|
446
|
+
return this.diagnostics.report("transport.rejected_credentials", `The server returned ${r}.${t}`, {
|
|
447
|
+
status: e,
|
|
448
|
+
endpoint: this.config.endpoint
|
|
449
|
+
}), new H("permanent", `The server rejected the batch with ${r}.`, e);
|
|
450
|
+
}
|
|
451
|
+
if (e === 413) return new H("too_large", "The payload is too large.", e, void 0, n.maxBytes);
|
|
452
|
+
if (e === 429 || e === 503) {
|
|
453
|
+
let t = e === 429, r = n.retryAfterMs === void 0 ? void 0 : Math.min(n.retryAfterMs, o);
|
|
454
|
+
return this.throttledUntil = Date.now() + (r ?? 2e3), t && this.diagnostics.report("transport.throttled", "The server throttles the requests.", { retryAfterMs: r }), new H("throttled", t ? "The server throttles the requests." : "The service is not available.", e, r);
|
|
455
|
+
}
|
|
456
|
+
return e === 408 || e >= 500 ? new H("transient", `The server returned the error ${r}.`, e) : (this.diagnostics.report("transport.dropped_permanent", `The server rejected the batch with ${r}. The library dropped it.`, {
|
|
457
|
+
batchId: t,
|
|
458
|
+
status: e
|
|
459
|
+
}), new H("permanent", `The server rejected the batch with ${r}.`, e));
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/transport/custom-transport.ts
|
|
464
|
+
function X(e, t) {
|
|
465
|
+
return {
|
|
466
|
+
body: t.body,
|
|
467
|
+
contentType: t.contentType,
|
|
468
|
+
batchId: e.id,
|
|
469
|
+
attempt: e.attempts,
|
|
470
|
+
records: e.records
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function Fe(e) {
|
|
474
|
+
if (typeof e != "object" || !e) return !1;
|
|
475
|
+
let t = Reflect.get(e, "status");
|
|
476
|
+
return typeof t == "number" && Number.isInteger(t) && t >= 100 && t <= 599;
|
|
477
|
+
}
|
|
478
|
+
function Z(e) {
|
|
479
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : void 0;
|
|
480
|
+
}
|
|
481
|
+
var Ie = class extends Y {
|
|
482
|
+
async send(e) {
|
|
483
|
+
let { transport: n } = this.config;
|
|
484
|
+
if (!n || e.records.length === 0) return;
|
|
485
|
+
let r = this.serialize(e);
|
|
486
|
+
if (!r) return;
|
|
487
|
+
let i = X(e, r), a;
|
|
488
|
+
try {
|
|
489
|
+
a = await O(P(() => he(() => n(i))), t);
|
|
490
|
+
} catch (e) {
|
|
491
|
+
let t = e instanceof j ? e : void 0;
|
|
492
|
+
throw new H(t ? "timeout" : "transient", t?.message ?? "The custom transport failed.", void 0, void 0, void 0, e);
|
|
493
|
+
}
|
|
494
|
+
if (!Fe(a)) throw this.diagnostics.report("transport.http_error", "The custom transport returned no valid status. The library sends the batch again later.", { batchId: e.id }), new H("transient", "The custom transport returned no valid status.");
|
|
495
|
+
let { status: o } = a;
|
|
496
|
+
if (o >= 200 && o < 300) this.accept(a.sampling);
|
|
497
|
+
else throw this.reject(o, e.id, {
|
|
498
|
+
retryAfterMs: Z(a.retryAfterMs),
|
|
499
|
+
maxBytes: Z(a.maxBytes)
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}, Le = class {
|
|
397
503
|
deps;
|
|
398
504
|
installed = !1;
|
|
399
505
|
onVisibility = () => {
|
|
@@ -428,147 +534,173 @@ var we = class {
|
|
|
428
534
|
});
|
|
429
535
|
}
|
|
430
536
|
flush(e) {
|
|
431
|
-
let {
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
-
|
|
537
|
+
let { config: t, diagnostics: n } = this.deps;
|
|
538
|
+
if (e === "hidden") {
|
|
539
|
+
this.flushAlive();
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (t.transport) {
|
|
543
|
+
this.flushCustom(e, t.transportOnExit);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
let i = this.endpointUrl();
|
|
547
|
+
if (i === null) return;
|
|
548
|
+
let o = this.deps.drainForExit();
|
|
549
|
+
if (!o || o.records.length === 0) return;
|
|
550
|
+
let s = this.serialize(o, e);
|
|
551
|
+
if (!s) return;
|
|
552
|
+
if (D(s.body) > 6e4) {
|
|
553
|
+
z(o, n);
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
i.searchParams.set(r, o.id), i.searchParams.set(de, e);
|
|
557
|
+
let l = i.toString(), u = this.deps.exitHeaders();
|
|
558
|
+
if (u) {
|
|
559
|
+
this.keepaliveFetch(l, s.body, e, () => {
|
|
560
|
+
let e = new Headers(u);
|
|
561
|
+
return e.set(h, s.contentType), e.set(a, o.id), e;
|
|
562
|
+
});
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (t.headers) {
|
|
566
|
+
z(o, n);
|
|
439
567
|
return;
|
|
440
568
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
569
|
+
let d = this.beacon(l, s.body);
|
|
570
|
+
d !== "sent" && (d === "refused" ? z(o, n) : this.keepaliveFetch(l, s.body, e, () => new Headers({ [h]: c })));
|
|
571
|
+
}
|
|
572
|
+
flushAlive() {
|
|
573
|
+
let { diagnostics: e } = this.deps, t = "The flush of the hidden document failed.";
|
|
574
|
+
e.guard("pipeline.crashed", t, () => {
|
|
575
|
+
Promise.resolve(this.deps.flushAlive()).catch((n) => {
|
|
576
|
+
e.report("pipeline.crashed", t, void 0, n);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
flushCustom(e, t) {
|
|
581
|
+
let { diagnostics: n } = this.deps, r = this.deps.drainForExit();
|
|
582
|
+
if (!r || r.records.length === 0) return;
|
|
583
|
+
let i = this.serialize(r, e);
|
|
584
|
+
i && (t === void 0 || n.guard("transport.http_error", "The transportOnExit hook threw an error.", () => P(() => t(X(r, i)))) !== !0) && z(r, n);
|
|
444
585
|
}
|
|
445
|
-
|
|
446
|
-
return
|
|
586
|
+
serialize(e, t) {
|
|
587
|
+
return J(this.deps.config.serializer, e, this.deps.diagnostics, `The ${t} exit flush could not serialize its batch.`);
|
|
447
588
|
}
|
|
448
589
|
endpointUrl() {
|
|
449
590
|
let { endpoint: e } = this.deps.config;
|
|
450
591
|
return e ? this.deps.diagnostics.guard("config.invalid", `The exit flush cannot use the endpoint ${e}.`, () => new URL(e)) ?? null : null;
|
|
451
592
|
}
|
|
452
593
|
beacon(e, t) {
|
|
453
|
-
return this.deps.diagnostics.guard("transport.http_error", "sendBeacon", () => {
|
|
594
|
+
return this.deps.diagnostics.guard("transport.http_error", "The sendBeacon call failed.", () => {
|
|
454
595
|
let n = globalThis.navigator;
|
|
455
596
|
return n?.sendBeacon ? n.sendBeacon(e, new Blob([t], { type: "text/plain;charset=UTF-8" })) ? "sent" : "refused" : "unavailable";
|
|
456
597
|
}) ?? "unavailable";
|
|
457
598
|
}
|
|
458
|
-
keepaliveFetch(e, n, r) {
|
|
599
|
+
keepaliveFetch(e, t, n, r) {
|
|
459
600
|
let { config: i, diagnostics: a } = this.deps;
|
|
460
|
-
a.guard("transport.http_error", "The keepalive fetch
|
|
601
|
+
a.guard("transport.http_error", "The keepalive fetch failed.", () => {
|
|
461
602
|
fetch(e, {
|
|
462
603
|
method: "POST",
|
|
463
|
-
body:
|
|
464
|
-
headers:
|
|
604
|
+
body: t,
|
|
605
|
+
headers: r(),
|
|
465
606
|
credentials: i.credentials,
|
|
466
607
|
keepalive: !0
|
|
467
608
|
}).catch((e) => {
|
|
468
|
-
a.report("transport.http_error", "The exit flush failed.", { reason:
|
|
609
|
+
a.report("transport.http_error", "The exit flush failed.", { reason: n }, e);
|
|
469
610
|
});
|
|
470
611
|
});
|
|
471
612
|
}
|
|
472
613
|
};
|
|
473
614
|
//#endregion
|
|
474
615
|
//#region src/transport/compression.ts
|
|
475
|
-
async function
|
|
616
|
+
async function Re(e) {
|
|
476
617
|
let t = globalThis.CompressionStream;
|
|
477
618
|
if (t === void 0) return null;
|
|
478
|
-
let n = new Blob([e]).stream().pipeThrough(new t(
|
|
619
|
+
let n = new Blob([e]).stream().pipeThrough(new t(p)), r = await new Response(n).arrayBuffer();
|
|
479
620
|
return new Uint8Array(r);
|
|
480
621
|
}
|
|
481
622
|
//#endregion
|
|
482
|
-
//#region src/transport/errors.ts
|
|
483
|
-
var Z = class extends Error {
|
|
484
|
-
kind;
|
|
485
|
-
status;
|
|
486
|
-
retryAfterMs;
|
|
487
|
-
maxBytes;
|
|
488
|
-
constructor(e, t, n, r, i) {
|
|
489
|
-
super(t), this.kind = e, this.status = n, this.retryAfterMs = r, this.maxBytes = i, this.name = "TransportError";
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
function Ee(e) {
|
|
493
|
-
if (!e) return;
|
|
494
|
-
let t = Number(e);
|
|
495
|
-
if (Number.isFinite(t)) return Math.max(0, t * le);
|
|
496
|
-
let n = Date.parse(e);
|
|
497
|
-
return Number.isNaN(n) ? void 0 : Math.max(0, n - Date.now());
|
|
498
|
-
}
|
|
499
|
-
//#endregion
|
|
500
623
|
//#region src/transport/http-transport.ts
|
|
501
|
-
var Q = class {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
this.config = e, this.diagnostics = t;
|
|
624
|
+
var Q = "In a cross-origin iframe, the session cookie is a third-party cookie. The browser often blocks it. Forward the records to the platform document. As an alternative, issue the cookie with the Partitioned attribute.", ze = class extends Y {
|
|
625
|
+
cachedHeaders;
|
|
626
|
+
async send(e, t) {
|
|
627
|
+
let { endpoint: n } = this.config;
|
|
628
|
+
n && e.records.length !== 0 && await this.post(e, n, t);
|
|
507
629
|
}
|
|
508
|
-
|
|
509
|
-
let {
|
|
510
|
-
|
|
630
|
+
lastHeaders() {
|
|
631
|
+
let { headers: e } = this.config;
|
|
632
|
+
if (!e) return;
|
|
633
|
+
if (typeof e != "function") return e;
|
|
634
|
+
let t = this.cachedHeaders;
|
|
635
|
+
return t?.source === e && t.endpoint === this.config.endpoint ? t.headers : void 0;
|
|
636
|
+
}
|
|
637
|
+
async post(e, t, n) {
|
|
638
|
+
let r = this.serialize(e);
|
|
639
|
+
if (!r) return;
|
|
640
|
+
let i = await this.attempt(e, t, r, n);
|
|
641
|
+
if (this.rejectsCredentials(i.status) && typeof this.config.headers == "function" && (this.cachedHeaders = void 0, i = await this.attempt(e, t, r, n)), i.ok) {
|
|
642
|
+
this.accept(i.headers.get(u));
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
let a = i.status, o = De(i.headers.get(ne)), s = a === 413 ? await this.readMaxBytes(i) : void 0;
|
|
646
|
+
throw this.reject(a, e.id, {
|
|
647
|
+
retryAfterMs: o,
|
|
648
|
+
maxBytes: s,
|
|
649
|
+
advice: Q
|
|
650
|
+
});
|
|
511
651
|
}
|
|
512
|
-
|
|
513
|
-
return
|
|
652
|
+
rejectsCredentials(e) {
|
|
653
|
+
return e === 401 || e === 403;
|
|
654
|
+
}
|
|
655
|
+
async attempt(e, n, r, i) {
|
|
656
|
+
let o = Date.now() + t, s = new Headers(await this.before(this.resolveHeaders(n), o));
|
|
657
|
+
s.set(h, r.contentType), s.set(a, e.id), s.set(se, String(e.attempts));
|
|
658
|
+
let c = await this.before(this.encodeBody(r.body), o);
|
|
659
|
+
typeof c != "string" && s.set(te, p);
|
|
660
|
+
let l = this.keepalive(c);
|
|
661
|
+
return l && i?.(), this.dispatch(n, s, c, o, l);
|
|
514
662
|
}
|
|
515
|
-
async
|
|
516
|
-
let { config: n } = this, i;
|
|
663
|
+
async before(e, t) {
|
|
517
664
|
try {
|
|
518
|
-
|
|
519
|
-
} catch
|
|
520
|
-
this.
|
|
521
|
-
return;
|
|
665
|
+
return await O(e, Math.max(0, t - Date.now()));
|
|
666
|
+
} catch {
|
|
667
|
+
throw this.timeout();
|
|
522
668
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
let
|
|
526
|
-
|
|
527
|
-
let l = await this.dispatch(t, a, s);
|
|
528
|
-
if (l.ok) this.throttledUntil = 0;
|
|
529
|
-
else throw await this.classify(l, e.id);
|
|
669
|
+
}
|
|
670
|
+
timeout() {
|
|
671
|
+
let e = `The request took longer than ${String(t)} ms.`;
|
|
672
|
+
return this.diagnostics.report("transport.timeout", e, { endpoint: this.config.endpoint }), new H("timeout", e);
|
|
530
673
|
}
|
|
531
674
|
async encodeBody(e) {
|
|
532
675
|
let { config: t } = this;
|
|
533
|
-
return t.compression !== "gzip" ||
|
|
676
|
+
return t.compression !== "gzip" || D(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "The library could not compress the payload.", () => Re(e)) ?? e;
|
|
534
677
|
}
|
|
535
|
-
async dispatch(e, t, n) {
|
|
536
|
-
let { config:
|
|
537
|
-
|
|
538
|
-
},
|
|
539
|
-
|
|
678
|
+
async dispatch(e, t, n, r, i) {
|
|
679
|
+
let { config: a } = this, o = new AbortController(), s = setTimeout(() => {
|
|
680
|
+
o.abort();
|
|
681
|
+
}, Math.max(0, r - Date.now()));
|
|
682
|
+
k(s);
|
|
540
683
|
try {
|
|
541
|
-
return await fetch(e, {
|
|
684
|
+
return await P(() => fetch(e, {
|
|
542
685
|
method: "POST",
|
|
543
686
|
headers: t,
|
|
544
687
|
body: n,
|
|
545
|
-
credentials:
|
|
546
|
-
signal:
|
|
547
|
-
cache: "no-store"
|
|
548
|
-
|
|
688
|
+
credentials: a.credentials,
|
|
689
|
+
signal: o.signal,
|
|
690
|
+
cache: "no-store",
|
|
691
|
+
keepalive: i
|
|
692
|
+
}));
|
|
549
693
|
} catch {
|
|
550
|
-
if (
|
|
694
|
+
if (o.signal.aborted) throw this.timeout();
|
|
551
695
|
let e = globalThis.navigator?.onLine;
|
|
552
|
-
throw new
|
|
696
|
+
throw new H(e === !1 ? "offline" : "transient", "A network error occurred.");
|
|
553
697
|
} finally {
|
|
554
|
-
clearTimeout(
|
|
698
|
+
clearTimeout(s);
|
|
555
699
|
}
|
|
556
700
|
}
|
|
557
|
-
|
|
558
|
-
let
|
|
559
|
-
|
|
560
|
-
status: n,
|
|
561
|
-
endpoint: this.config.endpoint
|
|
562
|
-
}), new Z("permanent", `The server rejected the batch with ${String(n)}.`, n);
|
|
563
|
-
if (n === 413) return new Z("too_large", "The payload is too large.", n, void 0, await this.readMaxBytes(e));
|
|
564
|
-
if (n === 429 || n === 503) {
|
|
565
|
-
let e = n === 429;
|
|
566
|
-
return this.throttledUntil = Date.now() + (r ?? 2e3), e && this.diagnostics.report("transport.throttled", "The server throttles the requests.", { retryAfterMs: r }), new Z("throttled", e ? "The server throttles the requests." : "The service is not available.", n, r);
|
|
567
|
-
}
|
|
568
|
-
return n === 408 || n >= 500 ? new Z("transient", `The server returned the error ${String(n)}.`, n) : (this.diagnostics.report("transport.dropped_permanent", `The server rejected the batch with ${String(n)}. The library dropped it.`, {
|
|
569
|
-
batchId: t,
|
|
570
|
-
status: n
|
|
571
|
-
}), new Z("permanent", `The server rejected the batch with ${String(n)}.`, n));
|
|
701
|
+
keepalive(e) {
|
|
702
|
+
let t = globalThis.document?.visibilityState === "hidden", n = typeof e == "string" ? D(e) : e.byteLength;
|
|
703
|
+
return t && n <= 6e4;
|
|
572
704
|
}
|
|
573
705
|
async readMaxBytes(e) {
|
|
574
706
|
return this.diagnostics.guardAsync("transport.http_error", "The library could not read the body of the 413 response.", async () => {
|
|
@@ -576,11 +708,18 @@ var Q = class {
|
|
|
576
708
|
return typeof t.maxBytes == "number" ? t.maxBytes : void 0;
|
|
577
709
|
});
|
|
578
710
|
}
|
|
579
|
-
async resolveHeaders() {
|
|
580
|
-
let { headers:
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
711
|
+
async resolveHeaders(e) {
|
|
712
|
+
let { headers: t } = this.config;
|
|
713
|
+
if (!t) return {};
|
|
714
|
+
if (typeof t != "function") return t;
|
|
715
|
+
let n = await this.diagnostics.guardAsync("transport.http_error", "The headers() function threw an error.", () => Promise.resolve(t()));
|
|
716
|
+
return n && (this.cachedHeaders = {
|
|
717
|
+
source: t,
|
|
718
|
+
endpoint: e,
|
|
719
|
+
headers: n
|
|
720
|
+
}), n ?? {};
|
|
721
|
+
}
|
|
722
|
+
}, Be = class {
|
|
584
723
|
storage;
|
|
585
724
|
transport;
|
|
586
725
|
diagnostics;
|
|
@@ -597,10 +736,10 @@ var Q = class {
|
|
|
597
736
|
this.storage = e, this.transport = t, this.diagnostics = n, this.config = r, this.batchesPerDrain = i;
|
|
598
737
|
}
|
|
599
738
|
start() {
|
|
600
|
-
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(
|
|
739
|
+
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(i);
|
|
601
740
|
}
|
|
602
741
|
nudge() {
|
|
603
|
-
this.draining || this.schedule(
|
|
742
|
+
this.draining || this.schedule(m);
|
|
604
743
|
}
|
|
605
744
|
async storeFailed(e, t) {
|
|
606
745
|
let n = this.toStorable(e, t);
|
|
@@ -616,23 +755,23 @@ var Q = class {
|
|
|
616
755
|
let t = setTimeout(() => {
|
|
617
756
|
this.drain();
|
|
618
757
|
}, e);
|
|
619
|
-
this.timer = t,
|
|
758
|
+
this.timer = t, k(t);
|
|
620
759
|
}
|
|
621
760
|
bounded(e) {
|
|
622
|
-
return
|
|
761
|
+
return O(e, T);
|
|
623
762
|
}
|
|
624
763
|
clearTimer() {
|
|
625
764
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
626
765
|
}
|
|
627
766
|
backoffMs() {
|
|
628
|
-
let e = Math.min(
|
|
767
|
+
let e = Math.min(m * 2 ** this.attempt, o);
|
|
629
768
|
return Math.random() * e;
|
|
630
769
|
}
|
|
631
770
|
async drain() {
|
|
632
771
|
if (!this.draining) {
|
|
633
772
|
this.draining = !0;
|
|
634
773
|
try {
|
|
635
|
-
await
|
|
774
|
+
await L("ui-observability.drain", this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(i);
|
|
636
775
|
} finally {
|
|
637
776
|
this.draining = !1;
|
|
638
777
|
}
|
|
@@ -640,25 +779,25 @@ var Q = class {
|
|
|
640
779
|
}
|
|
641
780
|
async drainLocked() {
|
|
642
781
|
try {
|
|
643
|
-
if (globalThis.navigator?.onLine === !1) return this.schedule(
|
|
782
|
+
if (globalThis.navigator?.onLine === !1) return this.schedule(i), !0;
|
|
644
783
|
let e = await this.bounded(this.storage.take(this.batchesPerDrain));
|
|
645
|
-
if (e.length === 0) return this.schedule(
|
|
784
|
+
if (e.length === 0) return this.schedule(i), !0;
|
|
646
785
|
for (let t of e) if (this.stopped || !await this.deliver(t)) return !0;
|
|
647
|
-
return this.schedule(e.length === this.batchesPerDrain ? 0 :
|
|
786
|
+
return this.schedule(e.length === this.batchesPerDrain ? 0 : i), !0;
|
|
648
787
|
} catch (e) {
|
|
649
788
|
return this.diagnostics.report("storage.degraded", "The drain loop threw an error.", void 0, e), this.attempt++, this.schedule(this.backoffMs()), !0;
|
|
650
789
|
}
|
|
651
790
|
}
|
|
652
791
|
async deliver(e) {
|
|
653
|
-
if (e.attempts >=
|
|
792
|
+
if (e.attempts >= E.maxAttempts) return this.diagnostics.report("storage.dead_lettered", `The library dropped a batch after ${e.attempts.toString()} attempts.`, {
|
|
654
793
|
batchId: e.id,
|
|
655
794
|
records: e.records.length
|
|
656
795
|
}), await this.bounded(this.storage.remove(e.id)), !0;
|
|
657
796
|
try {
|
|
658
797
|
return await this.transport.send(e), await this.bounded(this.storage.remove(e.id)), this.attempt = 0, !0;
|
|
659
798
|
} catch (t) {
|
|
660
|
-
let n = t instanceof
|
|
661
|
-
return n?.kind === "permanent" || n?.kind === "too_large" ? (await this.replaceStored(e, t), !0) : n?.kind === "offline" ? (this.schedule(
|
|
799
|
+
let n = t instanceof H ? t : void 0;
|
|
800
|
+
return n?.kind === "permanent" || n?.kind === "too_large" ? (await this.replaceStored(e, t), !0) : n?.kind === "offline" ? (this.schedule(i), !1) : n?.kind === "throttled" ? (this.attempt++, this.schedule(n.retryAfterMs ?? this.backoffMs()), !1) : (await this.bounded(this.storage.bumpAttempts(e.id, e.attempts + 1)), this.attempt++, this.schedule(n?.retryAfterMs ?? this.backoffMs()), !1);
|
|
662
801
|
}
|
|
663
802
|
}
|
|
664
803
|
async replaceStored(e, t) {
|
|
@@ -667,10 +806,10 @@ var Q = class {
|
|
|
667
806
|
for (let e of n) await this.bounded(this.storage.save(e));
|
|
668
807
|
}
|
|
669
808
|
toStorable(e, t) {
|
|
670
|
-
let n = t instanceof
|
|
809
|
+
let n = t instanceof H ? t : void 0;
|
|
671
810
|
if (n?.kind === "permanent") return [];
|
|
672
811
|
if (n?.kind !== "too_large") return [e];
|
|
673
|
-
let r =
|
|
812
|
+
let r = I(e, this.diagnostics);
|
|
674
813
|
return r ? (this.diagnostics.report("transport.batch_split", "The server refused the batch because it is too large.", {
|
|
675
814
|
from: e.records.length,
|
|
676
815
|
to: r[0].records.length,
|
|
@@ -683,12 +822,12 @@ var Q = class {
|
|
|
683
822
|
};
|
|
684
823
|
//#endregion
|
|
685
824
|
//#region src/core/pipeline.ts
|
|
686
|
-
function
|
|
687
|
-
return e.attributes[
|
|
825
|
+
function Ve(e) {
|
|
826
|
+
return e.attributes[_] === oe;
|
|
688
827
|
}
|
|
689
|
-
var
|
|
828
|
+
var He = {
|
|
690
829
|
logs: {
|
|
691
|
-
flushIntervalMs:
|
|
830
|
+
flushIntervalMs: y,
|
|
692
831
|
batchSize: 100
|
|
693
832
|
},
|
|
694
833
|
metrics: {
|
|
@@ -719,12 +858,12 @@ var ke = {
|
|
|
719
858
|
let e = setTimeout(() => {
|
|
720
859
|
this.timer = null, this.onFlush(this);
|
|
721
860
|
}, this.options.flushIntervalMs);
|
|
722
|
-
this.timer = e,
|
|
861
|
+
this.timer = e, k(e);
|
|
723
862
|
}
|
|
724
863
|
clearTimer() {
|
|
725
864
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
726
865
|
}
|
|
727
|
-
},
|
|
866
|
+
}, Ue = class {
|
|
728
867
|
transport;
|
|
729
868
|
storage;
|
|
730
869
|
retry;
|
|
@@ -732,11 +871,12 @@ var ke = {
|
|
|
732
871
|
streams;
|
|
733
872
|
unconfirmed = /* @__PURE__ */ new Map();
|
|
734
873
|
queue = [];
|
|
735
|
-
|
|
874
|
+
open = /* @__PURE__ */ new Set();
|
|
875
|
+
ceiling = new me();
|
|
736
876
|
inFlight = 0;
|
|
737
877
|
pumpScheduled = !1;
|
|
738
878
|
stopped = !1;
|
|
739
|
-
constructor(e, t, n, r, i =
|
|
879
|
+
constructor(e, t, n, r, i = He) {
|
|
740
880
|
this.transport = e, this.storage = t, this.retry = n, this.diagnostics = r;
|
|
741
881
|
let a = (e) => {
|
|
742
882
|
this.claim(e);
|
|
@@ -747,7 +887,7 @@ var ke = {
|
|
|
747
887
|
};
|
|
748
888
|
}
|
|
749
889
|
push(e) {
|
|
750
|
-
this.stopped || (e.observedTimeUnixNano =
|
|
890
|
+
this.stopped || (e.observedTimeUnixNano = pe(), this.route(e));
|
|
751
891
|
}
|
|
752
892
|
drainPending() {
|
|
753
893
|
return this.toBatch([...this.streams.metrics.take(), ...this.streams.logs.take()]);
|
|
@@ -760,12 +900,17 @@ var ke = {
|
|
|
760
900
|
...this.streams.logs.take()
|
|
761
901
|
]);
|
|
762
902
|
}
|
|
903
|
+
async flushPending() {
|
|
904
|
+
this.enqueue(this.stopped ? null : this.drainPending()), await Promise.all([...this.open].map((e) => e.done));
|
|
905
|
+
}
|
|
763
906
|
destroy() {
|
|
764
907
|
this.stopped = !0, this.streams.logs.stop(), this.streams.metrics.stop(), this.queue.length = 0;
|
|
908
|
+
for (let e of this.open) e.resolve();
|
|
909
|
+
this.open.clear();
|
|
765
910
|
}
|
|
766
911
|
toBatch(e) {
|
|
767
912
|
return e.length === 0 ? null : {
|
|
768
|
-
id:
|
|
913
|
+
id: A(this.diagnostics),
|
|
769
914
|
records: e,
|
|
770
915
|
createdAt: Date.now(),
|
|
771
916
|
attempts: 0
|
|
@@ -773,7 +918,7 @@ var ke = {
|
|
|
773
918
|
}
|
|
774
919
|
route(e) {
|
|
775
920
|
try {
|
|
776
|
-
let t =
|
|
921
|
+
let t = Ve(e) ? this.streams.metrics : this.streams.logs;
|
|
777
922
|
if (!this.ceiling.allow(e)) {
|
|
778
923
|
this.diagnostics.count("record.dropped_by_ceiling");
|
|
779
924
|
return;
|
|
@@ -784,16 +929,18 @@ var ke = {
|
|
|
784
929
|
}
|
|
785
930
|
}
|
|
786
931
|
claim(e) {
|
|
787
|
-
|
|
788
|
-
id: O(this.diagnostics),
|
|
789
|
-
records: t,
|
|
790
|
-
createdAt: Date.now(),
|
|
791
|
-
attempts: 0
|
|
792
|
-
};
|
|
793
|
-
this.unconfirmed.set(n.id, n), this.enqueue(n);
|
|
932
|
+
this.enqueue(this.toBatch(e.take()));
|
|
794
933
|
}
|
|
795
934
|
enqueue(e) {
|
|
796
|
-
|
|
935
|
+
if (!e) return;
|
|
936
|
+
let t, n = {
|
|
937
|
+
batch: e,
|
|
938
|
+
done: new Promise((e) => {
|
|
939
|
+
t = e;
|
|
940
|
+
}),
|
|
941
|
+
resolve: t
|
|
942
|
+
};
|
|
943
|
+
this.unconfirmed.set(e.id, e), this.open.add(n), this.queue.push(n), !this.pumpScheduled && (this.pumpScheduled = !0, queueMicrotask(() => {
|
|
797
944
|
this.pumpScheduled = !1, this.pump();
|
|
798
945
|
}));
|
|
799
946
|
}
|
|
@@ -805,12 +952,13 @@ var ke = {
|
|
|
805
952
|
}
|
|
806
953
|
}
|
|
807
954
|
async run(e) {
|
|
955
|
+
let { batch: t } = e;
|
|
808
956
|
try {
|
|
809
|
-
await this.dispatch(
|
|
810
|
-
} catch (
|
|
811
|
-
this.diagnostics.report("pipeline.crashed", "A dispatch rejected its promise. This must not occur.", { batchId:
|
|
957
|
+
await this.dispatch(t);
|
|
958
|
+
} catch (e) {
|
|
959
|
+
this.diagnostics.report("pipeline.crashed", "A dispatch rejected its promise. This must not occur.", { batchId: t.id }, e);
|
|
812
960
|
} finally {
|
|
813
|
-
this.inFlight--, this.pump();
|
|
961
|
+
this.inFlight--, this.open.delete(e), e.resolve(), this.pump();
|
|
814
962
|
}
|
|
815
963
|
}
|
|
816
964
|
async dispatch(e) {
|
|
@@ -825,7 +973,9 @@ var ke = {
|
|
|
825
973
|
return;
|
|
826
974
|
}
|
|
827
975
|
try {
|
|
828
|
-
await this.transport.send(e)
|
|
976
|
+
await this.transport.send(e, () => {
|
|
977
|
+
this.unconfirmed.delete(e.id);
|
|
978
|
+
});
|
|
829
979
|
} catch (t) {
|
|
830
980
|
await this.storeFailed({
|
|
831
981
|
...e,
|
|
@@ -846,62 +996,55 @@ var ke = {
|
|
|
846
996
|
}
|
|
847
997
|
async store(e) {
|
|
848
998
|
await this.diagnostics.guardAsync("storage.degraded", "The library could not store an undelivered batch.", async () => {
|
|
849
|
-
await
|
|
999
|
+
await O(this.storage.save(e), T), this.retry.nudge();
|
|
850
1000
|
});
|
|
851
1001
|
}
|
|
852
|
-
},
|
|
1002
|
+
}, We = class e {
|
|
853
1003
|
storage;
|
|
854
|
-
transport;
|
|
855
1004
|
retry;
|
|
856
1005
|
pipeline;
|
|
857
1006
|
exitFlush;
|
|
858
1007
|
diagnostics;
|
|
859
|
-
constructor(e, t, n, r, i
|
|
860
|
-
this.storage = e, this.
|
|
1008
|
+
constructor(e, t, n, r, i) {
|
|
1009
|
+
this.storage = e, this.retry = t, this.pipeline = n, this.exitFlush = r, this.diagnostics = i;
|
|
861
1010
|
}
|
|
862
1011
|
static async create(t) {
|
|
863
|
-
let { config: n, diagnostics: r } = t, i = await
|
|
1012
|
+
let { config: n, diagnostics: r } = t, i = await Ee(n.storage, le, E, r, t.onGap), a = (e) => {
|
|
1013
|
+
let i = M(e, r);
|
|
1014
|
+
i && N(t.remote, n, i);
|
|
1015
|
+
}, o = n.transport ? void 0 : new ze(n, r, a), s = o ?? new Ie(n, r, a), c = new Be(i, s, r, n), l = new Ue(s, i, c, r), u = new Le({
|
|
864
1016
|
config: n,
|
|
865
1017
|
diagnostics: r,
|
|
866
|
-
drainForExit: () =>
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
let d = !1;
|
|
1018
|
+
drainForExit: () => l.drainForExit(),
|
|
1019
|
+
flushAlive: () => l.flushPending(),
|
|
1020
|
+
exitHeaders: () => o?.lastHeaders()
|
|
1021
|
+
}), d = !1;
|
|
871
1022
|
try {
|
|
872
|
-
u.install(),
|
|
1023
|
+
u.install(), c.start(), d = !0;
|
|
873
1024
|
} finally {
|
|
874
|
-
d || (u.uninstall(),
|
|
1025
|
+
d || (u.uninstall(), c.stop());
|
|
875
1026
|
}
|
|
876
|
-
|
|
1027
|
+
let f = new e(i, c, l, u, r);
|
|
1028
|
+
return f.importEmergency(), f;
|
|
877
1029
|
}
|
|
878
1030
|
push(e) {
|
|
879
1031
|
this.pipeline.push(e);
|
|
880
1032
|
}
|
|
881
1033
|
async flush() {
|
|
882
|
-
|
|
883
|
-
if (e) try {
|
|
884
|
-
await this.transport.send(e);
|
|
885
|
-
} catch (t) {
|
|
886
|
-
await this.diagnostics.guardAsync("storage.degraded", "The library could not store the batch that flush() drained.", async () => {
|
|
887
|
-
await this.retry.storeFailed({
|
|
888
|
-
...e,
|
|
889
|
-
attempts: e.attempts + 1
|
|
890
|
-
}, t);
|
|
891
|
-
}), this.diagnostics.report("transport.http_error", "The send from flush() failed. The library stored the batch for a retry.", {
|
|
892
|
-
batchId: e.id,
|
|
893
|
-
records: e.records.length
|
|
894
|
-
}, t);
|
|
895
|
-
}
|
|
1034
|
+
await this.pipeline.flushPending();
|
|
896
1035
|
}
|
|
897
1036
|
async queueDepth() {
|
|
898
1037
|
return await this.diagnostics.guardAsync("storage.degraded", "The library could not count the batches in storage.", () => this.storage.count()) ?? 0;
|
|
899
1038
|
}
|
|
900
1039
|
async destroy() {
|
|
901
|
-
this.exitFlush.flush("shutdown"), this.exitFlush.uninstall(), this.retry.stop(), this.pipeline.destroy(), await this.storage.close();
|
|
1040
|
+
await this.diagnostics.guardAsync("pipeline.crashed", "The flush before shutdown failed.", () => this.flush()), this.exitFlush.flush("shutdown"), this.exitFlush.uninstall(), this.retry.stop(), this.pipeline.destroy(), await this.storage.close();
|
|
1041
|
+
}
|
|
1042
|
+
async importEmergency() {
|
|
1043
|
+
let e = await this.diagnostics.guardAsync("storage.degraded", "The emergency import failed.", () => ye(this.storage, this.diagnostics));
|
|
1044
|
+
e !== void 0 && e > 0 && this.retry.nudge();
|
|
902
1045
|
}
|
|
903
1046
|
};
|
|
904
1047
|
//#endregion
|
|
905
|
-
export {
|
|
1048
|
+
export { We as Sender };
|
|
906
1049
|
|
|
907
|
-
//# sourceMappingURL=sender-
|
|
1050
|
+
//# sourceMappingURL=sender-BnNj9bOX.js.map
|