raindrop-ai 0.0.36 → 0.0.38

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
  }
@@ -122,7 +125,7 @@ var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
122
125
  }
123
126
  });
124
127
  var implementation = createTracing;
125
- 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);
126
129
  var _setImplementation = (impl) => {
127
130
  implementation = impl;
128
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.36",
110
+ version: "0.0.38",
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
  }
@@ -385,7 +388,7 @@ var createTracing = (analytics, _apiUrl, _writeKey, _options) => ({
385
388
  }
386
389
  });
387
390
  var implementation = createTracing;
388
- 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);
389
392
 
390
393
  // src/types.ts
391
394
  var import_zod2 = require("zod");
@@ -440,9 +443,15 @@ var Raindrop = class {
440
443
  this.redactPii = (_e = config.redactPii) != null ? _e : false;
441
444
  this.context = this.getContext();
442
445
  const url = new URL(this.apiUrl);
443
- this._tracing = tracing(this, url.origin, this.writeKey, {
444
- disableBatch: false
445
- });
446
+ this._tracing = tracing(
447
+ this,
448
+ url.origin,
449
+ this.writeKey,
450
+ {
451
+ disableBatch: false
452
+ },
453
+ this.debugLogs
454
+ );
446
455
  }
447
456
  formatEndpoint(endpoint) {
448
457
  if (endpoint) {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "./chunk-42STP23J.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.36",
86
+ version: "0.0.38",
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) {
@@ -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
  }
@@ -270,8 +273,11 @@ function getCurrentTraceId() {
270
273
  var _a;
271
274
  return (_a = import_api3.trace.getSpan(import_api3.context.active())) == null ? void 0 : _a.spanContext().traceId;
272
275
  }
273
- var tracing = (analytics, apiUrl, writeKey, options) => {
276
+ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
274
277
  const { logLevel, ...otherOptions } = options;
278
+ if (isDebug) {
279
+ console.log("using traces");
280
+ }
275
281
  const traceloopClient = traceloop2.initialize({
276
282
  baseUrl: apiUrl,
277
283
  apiKey: writeKey,
@@ -309,6 +315,16 @@ var tracing = (analytics, apiUrl, writeKey, options) => {
309
315
  }
310
316
  };
311
317
  };
318
+ try {
319
+ _setImplementation(tracing);
320
+ if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
321
+ console.log("Raindrop: Auto-initialized tracing");
322
+ }
323
+ } catch (e) {
324
+ if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
325
+ console.error("Raindrop: Failed to auto-initialize tracing:", e);
326
+ }
327
+ }
312
328
  function initTracing() {
313
329
  _setImplementation(tracing);
314
330
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NonLiveInteraction,
3
3
  _setImplementation
4
- } from "../chunk-42STP23J.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,
@@ -153,6 +156,16 @@ var tracing = (analytics, apiUrl, writeKey, options) => {
153
156
  }
154
157
  };
155
158
  };
159
+ try {
160
+ _setImplementation(tracing);
161
+ if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
162
+ console.log("Raindrop: Auto-initialized tracing");
163
+ }
164
+ } catch (e) {
165
+ if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
166
+ console.error("Raindrop: Failed to auto-initialize tracing:", e);
167
+ }
168
+ }
156
169
  function initTracing() {
157
170
  _setImplementation(tracing);
158
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -65,4 +65,4 @@
65
65
  "dts": true,
66
66
  "clean": true
67
67
  }
68
- }
68
+ }