raindrop-ai 0.0.55 → 0.0.56
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/{index-BAwkDswC.d.mts → index-hNK1lILi.d.mts} +6 -0
- package/dist/{index-BAwkDswC.d.ts → index-hNK1lILi.d.ts} +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -1
- package/dist/index.mjs +28 -1
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -347,6 +347,7 @@ declare class Raindrop {
|
|
|
347
347
|
private _tracing;
|
|
348
348
|
private partialEventBuffer;
|
|
349
349
|
private partialEventTimeouts;
|
|
350
|
+
private inFlightRequests;
|
|
350
351
|
debugLogs: boolean;
|
|
351
352
|
constructor(config: AnalyticsConfig);
|
|
352
353
|
private formatEndpoint;
|
|
@@ -422,6 +423,11 @@ declare class Raindrop {
|
|
|
422
423
|
* @param eventId - The ID of the partial event to flush.
|
|
423
424
|
*/
|
|
424
425
|
private flushPartialEvent;
|
|
426
|
+
/**
|
|
427
|
+
* Internal implementation of flushPartialEvent without request tracking.
|
|
428
|
+
* @param eventId - The ID of the partial event to flush.
|
|
429
|
+
*/
|
|
430
|
+
private _flushPartialEventInternal;
|
|
425
431
|
/**
|
|
426
432
|
* Sends a single prepared event object to the 'events/track_partial' endpoint.
|
|
427
433
|
* @param event - The event data conforming to ClientAiTrack schema.
|
|
@@ -347,6 +347,7 @@ declare class Raindrop {
|
|
|
347
347
|
private _tracing;
|
|
348
348
|
private partialEventBuffer;
|
|
349
349
|
private partialEventTimeouts;
|
|
350
|
+
private inFlightRequests;
|
|
350
351
|
debugLogs: boolean;
|
|
351
352
|
constructor(config: AnalyticsConfig);
|
|
352
353
|
private formatEndpoint;
|
|
@@ -422,6 +423,11 @@ declare class Raindrop {
|
|
|
422
423
|
* @param eventId - The ID of the partial event to flush.
|
|
423
424
|
*/
|
|
424
425
|
private flushPartialEvent;
|
|
426
|
+
/**
|
|
427
|
+
* Internal implementation of flushPartialEvent without request tracking.
|
|
428
|
+
* @param eventId - The ID of the partial event to flush.
|
|
429
|
+
*/
|
|
430
|
+
private _flushPartialEventInternal;
|
|
425
431
|
/**
|
|
426
432
|
* Sends a single prepared event object to the 'events/track_partial' endpoint.
|
|
427
433
|
* @param event - The event data conforming to ClientAiTrack schema.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-
|
|
1
|
+
export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-hNK1lILi.mjs';
|
|
2
2
|
import '@opentelemetry/sdk-trace-node';
|
|
3
3
|
import '@traceloop/node-server-sdk';
|
|
4
4
|
import '@dawn/schemas/ingest';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-
|
|
1
|
+
export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-hNK1lILi.js';
|
|
2
2
|
import '@opentelemetry/sdk-trace-node';
|
|
3
3
|
import '@traceloop/node-server-sdk';
|
|
4
4
|
import '@dawn/schemas/ingest';
|
package/dist/index.js
CHANGED
|
@@ -3056,7 +3056,7 @@ var CategorizationRequestSchema = import_zod.z.object({
|
|
|
3056
3056
|
// package.json
|
|
3057
3057
|
var package_default = {
|
|
3058
3058
|
name: "raindrop-ai",
|
|
3059
|
-
version: "0.0.
|
|
3059
|
+
version: "0.0.56",
|
|
3060
3060
|
main: "dist/index.js",
|
|
3061
3061
|
module: "dist/index.mjs",
|
|
3062
3062
|
types: "dist/index.d.ts",
|
|
@@ -3444,6 +3444,7 @@ var Raindrop = class {
|
|
|
3444
3444
|
// New members for partial event handling
|
|
3445
3445
|
this.partialEventBuffer = /* @__PURE__ */ new Map();
|
|
3446
3446
|
this.partialEventTimeouts = /* @__PURE__ */ new Map();
|
|
3447
|
+
this.inFlightRequests = /* @__PURE__ */ new Set();
|
|
3447
3448
|
//We are writing to local storage for browser-like environments where the
|
|
3448
3449
|
//page might get closed/reloaded before the buffer is flushed.
|
|
3449
3450
|
this.isEnvWithLocalStorage = typeof localStorage !== "undefined";
|
|
@@ -3813,6 +3814,19 @@ var Raindrop = class {
|
|
|
3813
3814
|
* @param eventId - The ID of the partial event to flush.
|
|
3814
3815
|
*/
|
|
3815
3816
|
async flushPartialEvent(eventId) {
|
|
3817
|
+
const flushPromise = this._flushPartialEventInternal(eventId);
|
|
3818
|
+
this.inFlightRequests.add(flushPromise);
|
|
3819
|
+
try {
|
|
3820
|
+
await flushPromise;
|
|
3821
|
+
} finally {
|
|
3822
|
+
this.inFlightRequests.delete(flushPromise);
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
/**
|
|
3826
|
+
* Internal implementation of flushPartialEvent without request tracking.
|
|
3827
|
+
* @param eventId - The ID of the partial event to flush.
|
|
3828
|
+
*/
|
|
3829
|
+
async _flushPartialEventInternal(eventId) {
|
|
3816
3830
|
var _a;
|
|
3817
3831
|
const accumulatedEvent = this.partialEventBuffer.get(eventId);
|
|
3818
3832
|
const timeout = this.partialEventTimeouts.get(eventId);
|
|
@@ -3941,9 +3955,22 @@ var Raindrop = class {
|
|
|
3941
3955
|
console.error(`[raindrop] Error flushing partial event ${eventId} during close:`, e);
|
|
3942
3956
|
}
|
|
3943
3957
|
}
|
|
3958
|
+
if (this.inFlightRequests.size > 0) {
|
|
3959
|
+
if (this.debugLogs) {
|
|
3960
|
+
console.log(
|
|
3961
|
+
`[raindrop] Waiting for ${this.inFlightRequests.size} in-flight requests to complete...`
|
|
3962
|
+
);
|
|
3963
|
+
}
|
|
3964
|
+
try {
|
|
3965
|
+
await Promise.all(Array.from(this.inFlightRequests));
|
|
3966
|
+
} catch (e) {
|
|
3967
|
+
console.error(`[raindrop] Error waiting for in-flight requests:`, e);
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3944
3970
|
this.partialEventBuffer.clear();
|
|
3945
3971
|
this.partialEventTimeouts.forEach(clearTimeout);
|
|
3946
3972
|
this.partialEventTimeouts.clear();
|
|
3973
|
+
this.inFlightRequests.clear();
|
|
3947
3974
|
if (this.debugLogs) {
|
|
3948
3975
|
console.log("[raindrop] Closing Raindrop Analytics");
|
|
3949
3976
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -85,7 +85,7 @@ var CategorizationRequestSchema = z.object({
|
|
|
85
85
|
// package.json
|
|
86
86
|
var package_default = {
|
|
87
87
|
name: "raindrop-ai",
|
|
88
|
-
version: "0.0.
|
|
88
|
+
version: "0.0.56",
|
|
89
89
|
main: "dist/index.js",
|
|
90
90
|
module: "dist/index.mjs",
|
|
91
91
|
types: "dist/index.d.ts",
|
|
@@ -275,6 +275,7 @@ var Raindrop = class {
|
|
|
275
275
|
// New members for partial event handling
|
|
276
276
|
this.partialEventBuffer = /* @__PURE__ */ new Map();
|
|
277
277
|
this.partialEventTimeouts = /* @__PURE__ */ new Map();
|
|
278
|
+
this.inFlightRequests = /* @__PURE__ */ new Set();
|
|
278
279
|
//We are writing to local storage for browser-like environments where the
|
|
279
280
|
//page might get closed/reloaded before the buffer is flushed.
|
|
280
281
|
this.isEnvWithLocalStorage = typeof localStorage !== "undefined";
|
|
@@ -644,6 +645,19 @@ var Raindrop = class {
|
|
|
644
645
|
* @param eventId - The ID of the partial event to flush.
|
|
645
646
|
*/
|
|
646
647
|
async flushPartialEvent(eventId) {
|
|
648
|
+
const flushPromise = this._flushPartialEventInternal(eventId);
|
|
649
|
+
this.inFlightRequests.add(flushPromise);
|
|
650
|
+
try {
|
|
651
|
+
await flushPromise;
|
|
652
|
+
} finally {
|
|
653
|
+
this.inFlightRequests.delete(flushPromise);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Internal implementation of flushPartialEvent without request tracking.
|
|
658
|
+
* @param eventId - The ID of the partial event to flush.
|
|
659
|
+
*/
|
|
660
|
+
async _flushPartialEventInternal(eventId) {
|
|
647
661
|
var _a;
|
|
648
662
|
const accumulatedEvent = this.partialEventBuffer.get(eventId);
|
|
649
663
|
const timeout = this.partialEventTimeouts.get(eventId);
|
|
@@ -772,9 +786,22 @@ var Raindrop = class {
|
|
|
772
786
|
console.error(`[raindrop] Error flushing partial event ${eventId} during close:`, e);
|
|
773
787
|
}
|
|
774
788
|
}
|
|
789
|
+
if (this.inFlightRequests.size > 0) {
|
|
790
|
+
if (this.debugLogs) {
|
|
791
|
+
console.log(
|
|
792
|
+
`[raindrop] Waiting for ${this.inFlightRequests.size} in-flight requests to complete...`
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
try {
|
|
796
|
+
await Promise.all(Array.from(this.inFlightRequests));
|
|
797
|
+
} catch (e) {
|
|
798
|
+
console.error(`[raindrop] Error waiting for in-flight requests:`, e);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
775
801
|
this.partialEventBuffer.clear();
|
|
776
802
|
this.partialEventTimeouts.forEach(clearTimeout);
|
|
777
803
|
this.partialEventTimeouts.clear();
|
|
804
|
+
this.inFlightRequests.clear();
|
|
778
805
|
if (this.debugLogs) {
|
|
779
806
|
console.log("[raindrop] Closing Raindrop Analytics");
|
|
780
807
|
}
|
package/dist/tracing/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
2
2
|
import * as traceloop from '@traceloop/node-server-sdk';
|
|
3
|
-
import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-
|
|
3
|
+
import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-hNK1lILi.mjs';
|
|
4
4
|
import '@dawn/schemas/ingest';
|
|
5
5
|
import '@opentelemetry/api';
|
|
6
6
|
|
package/dist/tracing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
2
2
|
import * as traceloop from '@traceloop/node-server-sdk';
|
|
3
|
-
import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-
|
|
3
|
+
import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-hNK1lILi.js';
|
|
4
4
|
import '@dawn/schemas/ingest';
|
|
5
5
|
import '@opentelemetry/api';
|
|
6
6
|
|