raindrop-ai 0.0.61 → 0.0.62
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-hNK1lILi.d.mts → index-Djb_i4Ni.d.mts} +6 -0
- package/dist/{index-hNK1lILi.d.ts → index-Djb_i4Ni.d.ts} +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -7
- package/dist/index.mjs +25 -7
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/package.json +5 -3
|
@@ -333,6 +333,11 @@ interface AnalyticsConfig {
|
|
|
333
333
|
* you can then use the span processor using raindrop.createSpanProcessor()
|
|
334
334
|
*/
|
|
335
335
|
disableTracing?: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* false by default. If true, the SDK will not send any events or initialize tracing.
|
|
338
|
+
* Useful for development/test environments.
|
|
339
|
+
*/
|
|
340
|
+
disabled?: boolean;
|
|
336
341
|
}
|
|
337
342
|
declare const MAX_INGEST_SIZE_BYTES: number;
|
|
338
343
|
declare class Raindrop {
|
|
@@ -343,6 +348,7 @@ declare class Raindrop {
|
|
|
343
348
|
private bufferTimeout;
|
|
344
349
|
private flushTimer;
|
|
345
350
|
private redactPii;
|
|
351
|
+
private disabled;
|
|
346
352
|
private context;
|
|
347
353
|
private _tracing;
|
|
348
354
|
private partialEventBuffer;
|
|
@@ -333,6 +333,11 @@ interface AnalyticsConfig {
|
|
|
333
333
|
* you can then use the span processor using raindrop.createSpanProcessor()
|
|
334
334
|
*/
|
|
335
335
|
disableTracing?: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* false by default. If true, the SDK will not send any events or initialize tracing.
|
|
338
|
+
* Useful for development/test environments.
|
|
339
|
+
*/
|
|
340
|
+
disabled?: boolean;
|
|
336
341
|
}
|
|
337
342
|
declare const MAX_INGEST_SIZE_BYTES: number;
|
|
338
343
|
declare class Raindrop {
|
|
@@ -343,6 +348,7 @@ declare class Raindrop {
|
|
|
343
348
|
private bufferTimeout;
|
|
344
349
|
private flushTimer;
|
|
345
350
|
private redactPii;
|
|
351
|
+
private disabled;
|
|
346
352
|
private context;
|
|
347
353
|
private _tracing;
|
|
348
354
|
private partialEventBuffer;
|
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-Djb_i4Ni.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-Djb_i4Ni.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
|
@@ -128,7 +128,7 @@ var CategorizationRequestSchema = import_zod.z.object({
|
|
|
128
128
|
// package.json
|
|
129
129
|
var package_default = {
|
|
130
130
|
name: "raindrop-ai",
|
|
131
|
-
version: "0.0.
|
|
131
|
+
version: "0.0.62",
|
|
132
132
|
main: "dist/index.js",
|
|
133
133
|
module: "dist/index.mjs",
|
|
134
134
|
types: "dist/index.d.ts",
|
|
@@ -160,13 +160,15 @@ var package_default = {
|
|
|
160
160
|
dev: "tsup --watch",
|
|
161
161
|
clean: "rm -rf .turbo && rm -rf dist",
|
|
162
162
|
try: "tsx ./src/example/index.ts",
|
|
163
|
+
test: "vitest run",
|
|
163
164
|
smoke: "tsx ./scripts/smoke.ts"
|
|
164
165
|
},
|
|
165
166
|
devDependencies: {
|
|
166
167
|
"@types/node": "^20.11.17",
|
|
167
168
|
tsup: "^8.4.0",
|
|
168
169
|
tsx: "^4.20.3",
|
|
169
|
-
typescript: "^5.3.3"
|
|
170
|
+
typescript: "^5.3.3",
|
|
171
|
+
vitest: "^4.0.10"
|
|
170
172
|
},
|
|
171
173
|
dependencies: {
|
|
172
174
|
"@dawn-analytics/redact-pii": "0.1.2",
|
|
@@ -584,7 +586,7 @@ var Raindrop = class {
|
|
|
584
586
|
//We are writing to local storage for browser-like environments where the
|
|
585
587
|
//page might get closed/reloaded before the buffer is flushed.
|
|
586
588
|
this.isEnvWithLocalStorage = typeof localStorage !== "undefined";
|
|
587
|
-
var _a, _b, _c, _d, _e;
|
|
589
|
+
var _a, _b, _c, _d, _e, _f;
|
|
588
590
|
if (!config.writeKey) {
|
|
589
591
|
throw new Error("A writeKey is required to use Raindrop");
|
|
590
592
|
}
|
|
@@ -593,15 +595,16 @@ var Raindrop = class {
|
|
|
593
595
|
this.bufferSize = (_b = config.bufferSize) != null ? _b : 50;
|
|
594
596
|
this.bufferTimeout = (_c = config.bufferTimeout) != null ? _c : 1e3;
|
|
595
597
|
this.buffer = new Array();
|
|
596
|
-
|
|
598
|
+
this.disabled = (_d = config.disabled) != null ? _d : false;
|
|
599
|
+
if (this.isEnvWithLocalStorage && !this.disabled) {
|
|
597
600
|
const storedBuffer = localStorage.getItem("raindrop_analytics_buffer");
|
|
598
601
|
if (storedBuffer) {
|
|
599
602
|
this.buffer = JSON.parse(storedBuffer);
|
|
600
603
|
this.flush();
|
|
601
604
|
}
|
|
602
605
|
}
|
|
603
|
-
this.debugLogs = (
|
|
604
|
-
this.redactPii = (
|
|
606
|
+
this.debugLogs = (_e = config.debugLogs) != null ? _e : false;
|
|
607
|
+
this.redactPii = (_f = config.redactPii) != null ? _f : false;
|
|
605
608
|
this.context = this.getContext();
|
|
606
609
|
if (this.debugLogs) {
|
|
607
610
|
process.env.RAINDROP_DEBUG = "true";
|
|
@@ -616,7 +619,7 @@ var Raindrop = class {
|
|
|
616
619
|
logLevel: this.debugLogs ? "debug" : "error",
|
|
617
620
|
// If the user wants to use span processor
|
|
618
621
|
// we disable tracing so that traceloop doesn't initialize OTEL tracing
|
|
619
|
-
tracingEnabled: config.disableTracing === true ? false : true
|
|
622
|
+
tracingEnabled: config.disableTracing === true || this.disabled ? false : true
|
|
620
623
|
},
|
|
621
624
|
this.debugLogs
|
|
622
625
|
);
|
|
@@ -677,6 +680,9 @@ var Raindrop = class {
|
|
|
677
680
|
* ```
|
|
678
681
|
*/
|
|
679
682
|
trackAi(event) {
|
|
683
|
+
if (this.disabled) {
|
|
684
|
+
return void 0;
|
|
685
|
+
}
|
|
680
686
|
const addEvent = (e) => {
|
|
681
687
|
var _a;
|
|
682
688
|
const {
|
|
@@ -741,6 +747,9 @@ var Raindrop = class {
|
|
|
741
747
|
}
|
|
742
748
|
}
|
|
743
749
|
setUserDetails(event) {
|
|
750
|
+
if (this.disabled) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
744
753
|
const parsed = IdentifySchema.safeParse({
|
|
745
754
|
user_id: event.userId,
|
|
746
755
|
traits: event.traits || {}
|
|
@@ -757,6 +766,9 @@ var Raindrop = class {
|
|
|
757
766
|
});
|
|
758
767
|
}
|
|
759
768
|
trackSignal(signal) {
|
|
769
|
+
if (this.disabled) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
760
772
|
const addSignal = (s) => {
|
|
761
773
|
const parsed = SignalEventSchema.safeParse({
|
|
762
774
|
event_id: s.eventId,
|
|
@@ -797,6 +809,9 @@ var Raindrop = class {
|
|
|
797
809
|
}
|
|
798
810
|
}
|
|
799
811
|
saveToBuffer(event) {
|
|
812
|
+
if (this.disabled) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
800
815
|
if (this.isEnvWithLocalStorage) {
|
|
801
816
|
localStorage.setItem("raindrop_analytics_buffer", JSON.stringify(this.buffer));
|
|
802
817
|
if (event == null ? void 0 : event.properties) {
|
|
@@ -924,6 +939,9 @@ var Raindrop = class {
|
|
|
924
939
|
* @param event - The PartialAiTrackEvent, requires eventId.
|
|
925
940
|
*/
|
|
926
941
|
_trackAiPartial(event) {
|
|
942
|
+
if (this.disabled) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
927
945
|
const { eventId, isPending, ...rest } = event;
|
|
928
946
|
if (!eventId) {
|
|
929
947
|
console.warn("[raindrop] trackAiPartial requires an eventId.");
|
package/dist/index.mjs
CHANGED
|
@@ -104,7 +104,7 @@ var CategorizationRequestSchema = z.object({
|
|
|
104
104
|
// package.json
|
|
105
105
|
var package_default = {
|
|
106
106
|
name: "raindrop-ai",
|
|
107
|
-
version: "0.0.
|
|
107
|
+
version: "0.0.62",
|
|
108
108
|
main: "dist/index.js",
|
|
109
109
|
module: "dist/index.mjs",
|
|
110
110
|
types: "dist/index.d.ts",
|
|
@@ -136,13 +136,15 @@ var package_default = {
|
|
|
136
136
|
dev: "tsup --watch",
|
|
137
137
|
clean: "rm -rf .turbo && rm -rf dist",
|
|
138
138
|
try: "tsx ./src/example/index.ts",
|
|
139
|
+
test: "vitest run",
|
|
139
140
|
smoke: "tsx ./scripts/smoke.ts"
|
|
140
141
|
},
|
|
141
142
|
devDependencies: {
|
|
142
143
|
"@types/node": "^20.11.17",
|
|
143
144
|
tsup: "^8.4.0",
|
|
144
145
|
tsx: "^4.20.3",
|
|
145
|
-
typescript: "^5.3.3"
|
|
146
|
+
typescript: "^5.3.3",
|
|
147
|
+
vitest: "^4.0.10"
|
|
146
148
|
},
|
|
147
149
|
dependencies: {
|
|
148
150
|
"@dawn-analytics/redact-pii": "0.1.2",
|
|
@@ -356,7 +358,7 @@ var Raindrop = class {
|
|
|
356
358
|
//We are writing to local storage for browser-like environments where the
|
|
357
359
|
//page might get closed/reloaded before the buffer is flushed.
|
|
358
360
|
this.isEnvWithLocalStorage = typeof localStorage !== "undefined";
|
|
359
|
-
var _a, _b, _c, _d, _e;
|
|
361
|
+
var _a, _b, _c, _d, _e, _f;
|
|
360
362
|
if (!config.writeKey) {
|
|
361
363
|
throw new Error("A writeKey is required to use Raindrop");
|
|
362
364
|
}
|
|
@@ -365,15 +367,16 @@ var Raindrop = class {
|
|
|
365
367
|
this.bufferSize = (_b = config.bufferSize) != null ? _b : 50;
|
|
366
368
|
this.bufferTimeout = (_c = config.bufferTimeout) != null ? _c : 1e3;
|
|
367
369
|
this.buffer = new Array();
|
|
368
|
-
|
|
370
|
+
this.disabled = (_d = config.disabled) != null ? _d : false;
|
|
371
|
+
if (this.isEnvWithLocalStorage && !this.disabled) {
|
|
369
372
|
const storedBuffer = localStorage.getItem("raindrop_analytics_buffer");
|
|
370
373
|
if (storedBuffer) {
|
|
371
374
|
this.buffer = JSON.parse(storedBuffer);
|
|
372
375
|
this.flush();
|
|
373
376
|
}
|
|
374
377
|
}
|
|
375
|
-
this.debugLogs = (
|
|
376
|
-
this.redactPii = (
|
|
378
|
+
this.debugLogs = (_e = config.debugLogs) != null ? _e : false;
|
|
379
|
+
this.redactPii = (_f = config.redactPii) != null ? _f : false;
|
|
377
380
|
this.context = this.getContext();
|
|
378
381
|
if (this.debugLogs) {
|
|
379
382
|
process.env.RAINDROP_DEBUG = "true";
|
|
@@ -388,7 +391,7 @@ var Raindrop = class {
|
|
|
388
391
|
logLevel: this.debugLogs ? "debug" : "error",
|
|
389
392
|
// If the user wants to use span processor
|
|
390
393
|
// we disable tracing so that traceloop doesn't initialize OTEL tracing
|
|
391
|
-
tracingEnabled: config.disableTracing === true ? false : true
|
|
394
|
+
tracingEnabled: config.disableTracing === true || this.disabled ? false : true
|
|
392
395
|
},
|
|
393
396
|
this.debugLogs
|
|
394
397
|
);
|
|
@@ -449,6 +452,9 @@ var Raindrop = class {
|
|
|
449
452
|
* ```
|
|
450
453
|
*/
|
|
451
454
|
trackAi(event) {
|
|
455
|
+
if (this.disabled) {
|
|
456
|
+
return void 0;
|
|
457
|
+
}
|
|
452
458
|
const addEvent = (e) => {
|
|
453
459
|
var _a;
|
|
454
460
|
const {
|
|
@@ -513,6 +519,9 @@ var Raindrop = class {
|
|
|
513
519
|
}
|
|
514
520
|
}
|
|
515
521
|
setUserDetails(event) {
|
|
522
|
+
if (this.disabled) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
516
525
|
const parsed = IdentifySchema.safeParse({
|
|
517
526
|
user_id: event.userId,
|
|
518
527
|
traits: event.traits || {}
|
|
@@ -529,6 +538,9 @@ var Raindrop = class {
|
|
|
529
538
|
});
|
|
530
539
|
}
|
|
531
540
|
trackSignal(signal) {
|
|
541
|
+
if (this.disabled) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
532
544
|
const addSignal = (s) => {
|
|
533
545
|
const parsed = SignalEventSchema.safeParse({
|
|
534
546
|
event_id: s.eventId,
|
|
@@ -569,6 +581,9 @@ var Raindrop = class {
|
|
|
569
581
|
}
|
|
570
582
|
}
|
|
571
583
|
saveToBuffer(event) {
|
|
584
|
+
if (this.disabled) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
572
587
|
if (this.isEnvWithLocalStorage) {
|
|
573
588
|
localStorage.setItem("raindrop_analytics_buffer", JSON.stringify(this.buffer));
|
|
574
589
|
if (event == null ? void 0 : event.properties) {
|
|
@@ -696,6 +711,9 @@ var Raindrop = class {
|
|
|
696
711
|
* @param event - The PartialAiTrackEvent, requires eventId.
|
|
697
712
|
*/
|
|
698
713
|
_trackAiPartial(event) {
|
|
714
|
+
if (this.disabled) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
699
717
|
const { eventId, isPending, ...rest } = event;
|
|
700
718
|
if (!eventId) {
|
|
701
719
|
console.warn("[raindrop] trackAiPartial requires an eventId.");
|
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-Djb_i4Ni.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-Djb_i4Ni.js';
|
|
4
4
|
import '@dawn/schemas/ingest';
|
|
5
5
|
import '@opentelemetry/api';
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raindrop-ai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
"dev": "tsup --watch",
|
|
33
33
|
"clean": "rm -rf .turbo && rm -rf dist",
|
|
34
34
|
"try": "tsx ./src/example/index.ts",
|
|
35
|
+
"test": "vitest run",
|
|
35
36
|
"smoke": "tsx ./scripts/smoke.ts"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@types/node": "^20.11.17",
|
|
39
40
|
"tsup": "^8.4.0",
|
|
40
41
|
"tsx": "^4.20.3",
|
|
41
|
-
"typescript": "^5.3.3"
|
|
42
|
+
"typescript": "^5.3.3",
|
|
43
|
+
"vitest": "^4.0.10"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@dawn-analytics/redact-pii": "0.1.2",
|
|
@@ -72,4 +74,4 @@
|
|
|
72
74
|
"dts": true,
|
|
73
75
|
"clean": true
|
|
74
76
|
}
|
|
75
|
-
}
|
|
77
|
+
}
|