@tracelog/lib 2.0.1-rc.69.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -237,7 +237,7 @@ const dt = () => {
237
237
  default:
238
238
  return Ne;
239
239
  }
240
- }, pt = 1e3, Tt = 50, _t = "2.0.1", vt = _t, It = () => {
240
+ }, pt = 1e3, Tt = 50, _t = "2.0.0", vt = _t, It = () => {
241
241
  if (typeof window > "u" || typeof document > "u")
242
242
  return !1;
243
243
  try {
@@ -2205,7 +2205,7 @@ class Ht extends p {
2205
2205
  return this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t), e ? !0 : Promise.resolve(!0);
2206
2206
  if (e) {
2207
2207
  const o = this.dataSenders.map((l) => l.sendEventsQueueSync(t)).some((l) => l);
2208
- return o ? (this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t)) : (this.clearSendInterval(), a("warn", "Sync flush complete failure, events kept in queue for retry", {
2208
+ return o ? (this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t)) : (this.clearSendInterval(), a("warn", "Sync flush failed for all integrations, events remain in queue for next flush", {
2209
2209
  data: { eventCount: s.length }
2210
2210
  })), o;
2211
2211
  } else {
@@ -2219,9 +2219,21 @@ class Ht extends p {
2219
2219
  );
2220
2220
  return Promise.allSettled(i).then((o) => {
2221
2221
  const l = o.some((c) => this.isSuccessfulResult(c));
2222
- return l ? (this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t)) : a("warn", "Async flush complete failure, events kept in queue for retry", {
2223
- data: { eventCount: r.length }
2224
- }), l;
2222
+ if (l) {
2223
+ this.removeProcessedEvents(s), this.clearSendInterval(), this.emitEventsQueue(t);
2224
+ const c = o.filter((d) => !this.isSuccessfulResult(d)).length;
2225
+ c > 0 && a(
2226
+ "warn",
2227
+ "Async flush completed with partial success, events removed from queue and persisted per failed integration",
2228
+ {
2229
+ data: { eventCount: r.length, succeededCount: o.length - c, failedCount: c }
2230
+ }
2231
+ );
2232
+ } else
2233
+ this.removeProcessedEvents(s), this.clearSendInterval(), a("error", "Async flush failed for all integrations, events persisted per-integration for recovery", {
2234
+ data: { eventCount: r.length, integrations: this.dataSenders.length }
2235
+ });
2236
+ return l;
2225
2237
  });
2226
2238
  }
2227
2239
  }
@@ -2233,25 +2245,19 @@ class Ht extends p {
2233
2245
  this.emitEventsQueue(e);
2234
2246
  return;
2235
2247
  }
2236
- const t = [...this.eventsQueue], r = t.map((l) => l.id), s = this.dataSenders.map(
2237
- async (l) => l.sendEventsQueue(e, {
2248
+ const t = [...this.eventsQueue], r = t.map((c) => c.id), s = this.dataSenders.map(
2249
+ async (c) => c.sendEventsQueue(e, {
2238
2250
  onSuccess: () => {
2239
2251
  },
2240
2252
  onFailure: () => {
2241
2253
  }
2242
2254
  })
2243
2255
  ), i = await Promise.allSettled(s);
2244
- if (i.some((l) => this.isSuccessfulResult(l))) {
2245
- this.removeProcessedEvents(r), this.emitEventsQueue(e);
2246
- const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
2247
- l > 0 && a("warn", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
2248
- data: { eventCount: t.length, failedCount: l }
2249
- });
2250
- } else
2251
- a("warn", "Periodic send complete failure, events kept in queue for retry", {
2252
- data: { eventCount: t.length }
2253
- });
2254
- this.eventsQueue.length === 0 && this.clearSendInterval();
2256
+ this.removeProcessedEvents(r), i.some((c) => this.isSuccessfulResult(c)) && this.emitEventsQueue(e), this.eventsQueue.length === 0 && this.clearSendInterval();
2257
+ const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
2258
+ l > 0 && a("warn", "Events send completed with some failures, removed from queue and persisted per-integration", {
2259
+ data: { eventCount: t.length, failedCount: l }
2260
+ });
2255
2261
  }
2256
2262
  buildEventsPayload() {
2257
2263
  const e = /* @__PURE__ */ new Map(), t = [];