raindrop-ai 0.0.35 → 0.0.37

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.
@@ -100,8 +100,11 @@ var NonLiveInteraction = class {
100
100
  };
101
101
 
102
102
  // src/tracing/tracer-core.ts
103
- var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
103
+ var createTracing = (analytics, _apiUrl, _writeKey, _options, isDebug = false) => ({
104
104
  begin(traceContext) {
105
+ if (isDebug) {
106
+ console.log("not using traces");
107
+ }
105
108
  if (!traceContext.eventId) {
106
109
  traceContext.eventId = crypto.randomUUID();
107
110
  }
@@ -119,11 +122,10 @@ var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
119
122
  return new NonLiveInteraction({ eventId }, void 0, analytics);
120
123
  },
121
124
  close() {
122
- analytics == null ? void 0 : analytics.close();
123
125
  }
124
126
  });
125
127
  var implementation = createTracing;
126
- var tracing = (analytics, apiUrl, writeKey, options) => implementation(analytics, apiUrl, writeKey, options);
128
+ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => implementation(analytics, apiUrl, writeKey, options, isDebug);
127
129
  var _setImplementation = (impl) => {
128
130
  implementation = impl;
129
131
  };
package/dist/index.js CHANGED
@@ -107,7 +107,7 @@ var CategorizationRequestSchema = import_zod.z.object({
107
107
  // package.json
108
108
  var package_default = {
109
109
  name: "raindrop-ai",
110
- version: "0.0.35",
110
+ version: "0.0.37",
111
111
  main: "dist/index.js",
112
112
  module: "dist/index.mjs",
113
113
  types: "dist/index.d.ts",
@@ -363,8 +363,11 @@ var NonLiveInteraction = class {
363
363
  };
364
364
 
365
365
  // src/tracing/tracer-core.ts
366
- var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
366
+ var createTracing = (analytics, _apiUrl, _writeKey, _options, isDebug = false) => ({
367
367
  begin(traceContext) {
368
+ if (isDebug) {
369
+ console.log("not using traces");
370
+ }
368
371
  if (!traceContext.eventId) {
369
372
  traceContext.eventId = crypto.randomUUID();
370
373
  }
@@ -382,11 +385,10 @@ var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
382
385
  return new NonLiveInteraction({ eventId }, void 0, analytics);
383
386
  },
384
387
  close() {
385
- analytics == null ? void 0 : analytics.close();
386
388
  }
387
389
  });
388
390
  var implementation = createTracing;
389
- var tracing = (analytics, apiUrl, writeKey, options) => implementation(analytics, apiUrl, writeKey, options);
391
+ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => implementation(analytics, apiUrl, writeKey, options, isDebug);
390
392
 
391
393
  // src/types.ts
392
394
  var import_zod2 = require("zod");
@@ -441,9 +443,15 @@ var Raindrop = class {
441
443
  this.redactPii = (_e = config.redactPii) != null ? _e : false;
442
444
  this.context = this.getContext();
443
445
  const url = new URL(this.apiUrl);
444
- this._tracing = tracing(this, url.origin, this.writeKey, {
445
- disableBatch: false
446
- });
446
+ this._tracing = tracing(
447
+ this,
448
+ url.origin,
449
+ this.writeKey,
450
+ {
451
+ disableBatch: false
452
+ },
453
+ this.debugLogs
454
+ );
447
455
  }
448
456
  formatEndpoint(endpoint) {
449
457
  if (endpoint) {
@@ -889,6 +897,7 @@ var Raindrop = class {
889
897
  this.partialEventBuffer.clear();
890
898
  this.partialEventTimeouts.forEach(clearTimeout);
891
899
  this.partialEventTimeouts.clear();
900
+ this._tracing.close();
892
901
  if (this.debugLogs) {
893
902
  console.log("Closing Raindrop Analytics");
894
903
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "./chunk-GJTS3VZY.mjs";
3
+ } from "./chunk-45CPPW3B.mjs";
4
4
 
5
5
  // ../schemas/src/ingest/index.ts
6
6
  import { z } from "zod";
@@ -83,7 +83,7 @@ var CategorizationRequestSchema = z.object({
83
83
  // package.json
84
84
  var package_default = {
85
85
  name: "raindrop-ai",
86
- version: "0.0.35",
86
+ version: "0.0.37",
87
87
  main: "dist/index.js",
88
88
  module: "dist/index.mjs",
89
89
  types: "dist/index.d.ts",
@@ -292,9 +292,15 @@ var Raindrop = class {
292
292
  this.redactPii = (_e = config.redactPii) != null ? _e : false;
293
293
  this.context = this.getContext();
294
294
  const url = new URL(this.apiUrl);
295
- this._tracing = tracing(this, url.origin, this.writeKey, {
296
- disableBatch: false
297
- });
295
+ this._tracing = tracing(
296
+ this,
297
+ url.origin,
298
+ this.writeKey,
299
+ {
300
+ disableBatch: false
301
+ },
302
+ this.debugLogs
303
+ );
298
304
  }
299
305
  formatEndpoint(endpoint) {
300
306
  if (endpoint) {
@@ -740,6 +746,7 @@ var Raindrop = class {
740
746
  this.partialEventBuffer.clear();
741
747
  this.partialEventTimeouts.forEach(clearTimeout);
742
748
  this.partialEventTimeouts.clear();
749
+ this._tracing.close();
743
750
  if (this.debugLogs) {
744
751
  console.log("Closing Raindrop Analytics");
745
752
  }
@@ -3,7 +3,7 @@ import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction } from '../in
3
3
  import '@dawn/schemas/ingest';
4
4
  import '@opentelemetry/api';
5
5
 
6
- declare const tracing: (analytics: Raindrop, apiUrl: string, writeKey: string, options: traceloop.InitializeOptions) => {
6
+ declare const tracing: (analytics: Raindrop, apiUrl: string, writeKey: string, options: traceloop.InitializeOptions, isDebug?: boolean) => {
7
7
  begin(traceContext: PartialAiTrackEvent): Interaction;
8
8
  getActiveInteraction(eventId: string): Interaction;
9
9
  close(): void;
@@ -3,7 +3,7 @@ import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction } from '../in
3
3
  import '@dawn/schemas/ingest';
4
4
  import '@opentelemetry/api';
5
5
 
6
- declare const tracing: (analytics: Raindrop, apiUrl: string, writeKey: string, options: traceloop.InitializeOptions) => {
6
+ declare const tracing: (analytics: Raindrop, apiUrl: string, writeKey: string, options: traceloop.InitializeOptions, isDebug?: boolean) => {
7
7
  begin(traceContext: PartialAiTrackEvent): Interaction;
8
8
  getActiveInteraction(eventId: string): Interaction;
9
9
  close(): void;
@@ -238,8 +238,11 @@ var NonLiveInteraction = class {
238
238
  };
239
239
 
240
240
  // src/tracing/tracer-core.ts
241
- var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
241
+ var createTracing = (analytics, _apiUrl, _writeKey, _options, isDebug = false) => ({
242
242
  begin(traceContext) {
243
+ if (isDebug) {
244
+ console.log("not using traces");
245
+ }
243
246
  if (!traceContext.eventId) {
244
247
  traceContext.eventId = crypto.randomUUID();
245
248
  }
@@ -257,7 +260,6 @@ var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
257
260
  return new NonLiveInteraction({ eventId }, void 0, analytics);
258
261
  },
259
262
  close() {
260
- analytics == null ? void 0 : analytics.close();
261
263
  }
262
264
  });
263
265
  var implementation = createTracing;
@@ -271,8 +273,11 @@ function getCurrentTraceId() {
271
273
  var _a;
272
274
  return (_a = import_api3.trace.getSpan(import_api3.context.active())) == null ? void 0 : _a.spanContext().traceId;
273
275
  }
274
- var tracing = (analytics, apiUrl, writeKey, options) => {
276
+ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
275
277
  const { logLevel, ...otherOptions } = options;
278
+ if (isDebug) {
279
+ console.log("using traces");
280
+ }
276
281
  const traceloopClient = traceloop2.initialize({
277
282
  baseUrl: apiUrl,
278
283
  apiKey: writeKey,
@@ -306,7 +311,6 @@ var tracing = (analytics, apiUrl, writeKey, options) => {
306
311
  },
307
312
  close() {
308
313
  activeInteractions.clear();
309
- analytics == null ? void 0 : analytics.close();
310
314
  traceloop2.forceFlush();
311
315
  }
312
316
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NonLiveInteraction,
3
3
  _setImplementation
4
- } from "../chunk-GJTS3VZY.mjs";
4
+ } from "../chunk-45CPPW3B.mjs";
5
5
 
6
6
  // src/tracing/index.ts
7
7
  import { context, trace as trace2 } from "@opentelemetry/api";
@@ -114,8 +114,11 @@ function getCurrentTraceId() {
114
114
  var _a;
115
115
  return (_a = trace2.getSpan(context.active())) == null ? void 0 : _a.spanContext().traceId;
116
116
  }
117
- var tracing = (analytics, apiUrl, writeKey, options) => {
117
+ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
118
118
  const { logLevel, ...otherOptions } = options;
119
+ if (isDebug) {
120
+ console.log("using traces");
121
+ }
119
122
  const traceloopClient = traceloop2.initialize({
120
123
  baseUrl: apiUrl,
121
124
  apiKey: writeKey,
@@ -149,7 +152,6 @@ var tracing = (analytics, apiUrl, writeKey, options) => {
149
152
  },
150
153
  close() {
151
154
  activeInteractions.clear();
152
- analytics == null ? void 0 : analytics.close();
153
155
  traceloop2.forceFlush();
154
156
  }
155
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",