@tracelog/lib 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +32 -26
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +1 -1
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +38 -32
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +1 -0
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.js +38 -32
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -284,7 +284,7 @@ const It = () => {
|
|
|
284
284
|
default:
|
|
285
285
|
return ke;
|
|
286
286
|
}
|
|
287
|
-
}, Nt = 1e3, Ot = 50, Pt = "2.
|
|
287
|
+
}, Nt = 1e3, Ot = 50, Pt = "2.3.0", Dt = Pt, Ke = () => typeof window < "u" && typeof sessionStorage < "u", kt = () => {
|
|
288
288
|
try {
|
|
289
289
|
const s = new URLSearchParams(window.location.search);
|
|
290
290
|
s.delete(We);
|
|
@@ -1781,6 +1781,7 @@ class tr extends I {
|
|
|
1781
1781
|
eventsQueue = [];
|
|
1782
1782
|
pendingEventsBuffer = [];
|
|
1783
1783
|
sendIntervalId = null;
|
|
1784
|
+
sendInProgress = !1;
|
|
1784
1785
|
rateLimitCounter = 0;
|
|
1785
1786
|
rateLimitWindowStart = 0;
|
|
1786
1787
|
lastSessionId = null;
|
|
@@ -2338,32 +2339,37 @@ class tr extends I {
|
|
|
2338
2339
|
}
|
|
2339
2340
|
}
|
|
2340
2341
|
async sendEventsQueue() {
|
|
2341
|
-
if (!this.get("sessionId") || this.eventsQueue.length === 0)
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
const t = [...this.eventsQueue], r = t.map((l) => l.id), n = this.dataSenders.map(
|
|
2349
|
-
async (l) => l.sendEventsQueue(e, {
|
|
2350
|
-
onSuccess: () => {
|
|
2351
|
-
},
|
|
2352
|
-
onFailure: () => {
|
|
2342
|
+
if (!(!this.get("sessionId") || this.eventsQueue.length === 0 || this.sendInProgress)) {
|
|
2343
|
+
this.sendInProgress = !0;
|
|
2344
|
+
try {
|
|
2345
|
+
const e = this.buildEventsPayload();
|
|
2346
|
+
if (this.dataSenders.length === 0) {
|
|
2347
|
+
this.emitEventsQueue(e);
|
|
2348
|
+
return;
|
|
2353
2349
|
}
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2350
|
+
const t = [...this.eventsQueue], r = t.map((l) => l.id), n = this.dataSenders.map(
|
|
2351
|
+
async (l) => l.sendEventsQueue(e, {
|
|
2352
|
+
onSuccess: () => {
|
|
2353
|
+
},
|
|
2354
|
+
onFailure: () => {
|
|
2355
|
+
}
|
|
2356
|
+
})
|
|
2357
|
+
), i = await Promise.allSettled(n);
|
|
2358
|
+
if (i.some((l) => this.isSuccessfulResult(l))) {
|
|
2359
|
+
this.removeProcessedEvents(r), this.emitEventsQueue(e);
|
|
2360
|
+
const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
|
|
2361
|
+
l > 0 && a("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
|
|
2362
|
+
data: { eventCount: t.length, failedCount: l }
|
|
2363
|
+
});
|
|
2364
|
+
} else
|
|
2365
|
+
a("debug", "Periodic send complete failure, events kept in queue for retry", {
|
|
2366
|
+
data: { eventCount: t.length }
|
|
2367
|
+
});
|
|
2368
|
+
this.eventsQueue.length === 0 && this.clearSendInterval();
|
|
2369
|
+
} finally {
|
|
2370
|
+
this.sendInProgress = !1;
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2367
2373
|
}
|
|
2368
2374
|
buildEventsPayload() {
|
|
2369
2375
|
const e = /* @__PURE__ */ new Map(), t = [];
|