raindrop-ai 0.0.46 → 0.0.48

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.
@@ -1763,6 +1763,10 @@ var NonLiveInteraction = class {
1763
1763
  this.analytics = analytics;
1764
1764
  }
1765
1765
  withSpan(_params, fn, thisArg, ...args) {
1766
+ var _a;
1767
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
1768
+ console.log("[raindrop] using withSpan in nonLiveInteraction");
1769
+ }
1766
1770
  try {
1767
1771
  return Promise.resolve(fn.apply(thisArg, args));
1768
1772
  } catch (error) {
@@ -1770,6 +1774,10 @@ var NonLiveInteraction = class {
1770
1774
  }
1771
1775
  }
1772
1776
  withTool(_params, fn, thisArg, ...args) {
1777
+ var _a;
1778
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
1779
+ console.log("[raindrop] using withTool in nonLiveInteraction");
1780
+ }
1773
1781
  try {
1774
1782
  return Promise.resolve(fn.apply(thisArg, args));
1775
1783
  } catch (error) {
@@ -1832,7 +1840,13 @@ var NoOpTracer = class {
1832
1840
 
1833
1841
  // src/tracing/tracer-core.ts
1834
1842
  var getGlobalRegistry = () => {
1835
- if (typeof window !== "undefined") {
1843
+ if (typeof globalThis !== "undefined") {
1844
+ globalThis.__RAINDROP_TRACING_REGISTRY__ = globalThis.__RAINDROP_TRACING_REGISTRY__ || {
1845
+ hasRealImplementation: false,
1846
+ realImplementation: null
1847
+ };
1848
+ return globalThis.__RAINDROP_TRACING_REGISTRY__;
1849
+ } else if (typeof window !== "undefined") {
1836
1850
  window.__RAINDROP_TRACING_REGISTRY__ = window.__RAINDROP_TRACING_REGISTRY__ || {
1837
1851
  hasRealImplementation: false,
1838
1852
  realImplementation: null
@@ -1881,12 +1895,12 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
1881
1895
  const registry = getGlobalRegistry();
1882
1896
  if (registry.hasRealImplementation && registry.realImplementation) {
1883
1897
  if (isDebug) {
1884
- console.log("Raindrop: Using real tracing implementation");
1898
+ console.log("[raindrop] Using real tracing implementation");
1885
1899
  }
1886
1900
  return registry.realImplementation(analytics, apiUrl, writeKey, options, isDebug);
1887
1901
  }
1888
1902
  if (isDebug) {
1889
- console.log("Raindrop: Using stub implementation");
1903
+ console.log("[raindrop] Using stub implementation");
1890
1904
  }
1891
1905
  return createTracing(analytics, apiUrl, writeKey, options, isDebug);
1892
1906
  };
@@ -1895,7 +1909,7 @@ var _setImplementation = (impl) => {
1895
1909
  registry.realImplementation = impl;
1896
1910
  registry.hasRealImplementation = true;
1897
1911
  if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
1898
- console.log("Raindrop: Set real implementation in global registry");
1912
+ console.log("[raindrop] Set real implementation in global registry");
1899
1913
  }
1900
1914
  };
1901
1915
 
@@ -335,12 +335,12 @@ declare class Raindrop {
335
335
  private bufferSize;
336
336
  private bufferTimeout;
337
337
  private flushTimer;
338
- private debugLogs;
339
338
  private redactPii;
340
339
  private context;
341
340
  private _tracing;
342
341
  private partialEventBuffer;
343
342
  private partialEventTimeouts;
343
+ debugLogs: boolean;
344
344
  constructor(config: AnalyticsConfig);
345
345
  private formatEndpoint;
346
346
  /**
@@ -335,12 +335,12 @@ declare class Raindrop {
335
335
  private bufferSize;
336
336
  private bufferTimeout;
337
337
  private flushTimer;
338
- private debugLogs;
339
338
  private redactPii;
340
339
  private context;
341
340
  private _tracing;
342
341
  private partialEventBuffer;
343
342
  private partialEventTimeouts;
343
+ debugLogs: boolean;
344
344
  constructor(config: AnalyticsConfig);
345
345
  private formatEndpoint;
346
346
  /**
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-gF5ZqfKW.mjs';
1
+ export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-C86NGhKr.mjs';
2
2
  import '@dawn/schemas/ingest';
3
3
  import '@opentelemetry/api';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-gF5ZqfKW.js';
1
+ export { M as MAX_INGEST_SIZE_BYTES, R as Raindrop, R as default } from './index-C86NGhKr.js';
2
2
  import '@dawn/schemas/ingest';
3
3
  import '@opentelemetry/api';
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ var CategorizationRequestSchema = import_zod.z.object({
108
108
  // package.json
109
109
  var package_default = {
110
110
  name: "raindrop-ai",
111
- version: "0.0.46",
111
+ version: "0.0.48",
112
112
  main: "dist/index.js",
113
113
  module: "dist/index.mjs",
114
114
  types: "dist/index.d.ts",
@@ -315,6 +315,10 @@ var NonLiveInteraction = class {
315
315
  this.analytics = analytics;
316
316
  }
317
317
  withSpan(_params, fn, thisArg, ...args) {
318
+ var _a;
319
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
320
+ console.log("[raindrop] using withSpan in nonLiveInteraction");
321
+ }
318
322
  try {
319
323
  return Promise.resolve(fn.apply(thisArg, args));
320
324
  } catch (error) {
@@ -322,6 +326,10 @@ var NonLiveInteraction = class {
322
326
  }
323
327
  }
324
328
  withTool(_params, fn, thisArg, ...args) {
329
+ var _a;
330
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
331
+ console.log("[raindrop] using withTool in nonLiveInteraction");
332
+ }
325
333
  try {
326
334
  return Promise.resolve(fn.apply(thisArg, args));
327
335
  } catch (error) {
@@ -384,7 +392,13 @@ var NoOpTracer = class {
384
392
 
385
393
  // src/tracing/tracer-core.ts
386
394
  var getGlobalRegistry = () => {
387
- if (typeof window !== "undefined") {
395
+ if (typeof globalThis !== "undefined") {
396
+ globalThis.__RAINDROP_TRACING_REGISTRY__ = globalThis.__RAINDROP_TRACING_REGISTRY__ || {
397
+ hasRealImplementation: false,
398
+ realImplementation: null
399
+ };
400
+ return globalThis.__RAINDROP_TRACING_REGISTRY__;
401
+ } else if (typeof window !== "undefined") {
388
402
  window.__RAINDROP_TRACING_REGISTRY__ = window.__RAINDROP_TRACING_REGISTRY__ || {
389
403
  hasRealImplementation: false,
390
404
  realImplementation: null
@@ -433,12 +447,12 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
433
447
  const registry = getGlobalRegistry();
434
448
  if (registry.hasRealImplementation && registry.realImplementation) {
435
449
  if (isDebug) {
436
- console.log("Raindrop: Using real tracing implementation");
450
+ console.log("[raindrop] Using real tracing implementation");
437
451
  }
438
452
  return registry.realImplementation(analytics, apiUrl, writeKey, options, isDebug);
439
453
  }
440
454
  if (isDebug) {
441
- console.log("Raindrop: Using stub implementation");
455
+ console.log("[raindrop] Using stub implementation");
442
456
  }
443
457
  return createTracing(analytics, apiUrl, writeKey, options, isDebug);
444
458
  };
@@ -504,7 +518,8 @@ var Raindrop = class {
504
518
  url.origin,
505
519
  this.writeKey,
506
520
  {
507
- disableBatch: false
521
+ disableBatch: false,
522
+ logLevel: this.debugLogs ? "debug" : "error"
508
523
  },
509
524
  this.debugLogs
510
525
  );
@@ -689,7 +704,7 @@ var Raindrop = class {
689
704
  }
690
705
  }
691
706
  if (this.debugLogs) {
692
- console.log("Added to queue: " + JSON.stringify({ event }));
707
+ console.log("[raindrop] Added to queue: " + JSON.stringify({ event }));
693
708
  }
694
709
  this.buffer.push(event);
695
710
  if (this.buffer.length >= this.bufferSize) {
@@ -967,7 +982,7 @@ var Raindrop = class {
967
982
  this.partialEventTimeouts.forEach(clearTimeout);
968
983
  this.partialEventTimeouts.clear();
969
984
  if (this.debugLogs) {
970
- console.log("Closing Raindrop Analytics");
985
+ console.log("[raindrop] Closing Raindrop Analytics");
971
986
  }
972
987
  }
973
988
  };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "./chunk-BCJTP4MY.mjs";
3
+ } from "./chunk-UAOOL33Y.mjs";
4
4
 
5
5
  // ../schemas/src/ingest/index.ts
6
6
  import { z } from "zod";
@@ -84,7 +84,7 @@ var CategorizationRequestSchema = z.object({
84
84
  // package.json
85
85
  var package_default = {
86
86
  name: "raindrop-ai",
87
- version: "0.0.46",
87
+ version: "0.0.48",
88
88
  main: "dist/index.js",
89
89
  module: "dist/index.mjs",
90
90
  types: "dist/index.d.ts",
@@ -296,7 +296,8 @@ var Raindrop = class {
296
296
  url.origin,
297
297
  this.writeKey,
298
298
  {
299
- disableBatch: false
299
+ disableBatch: false,
300
+ logLevel: this.debugLogs ? "debug" : "error"
300
301
  },
301
302
  this.debugLogs
302
303
  );
@@ -481,7 +482,7 @@ var Raindrop = class {
481
482
  }
482
483
  }
483
484
  if (this.debugLogs) {
484
- console.log("Added to queue: " + JSON.stringify({ event }));
485
+ console.log("[raindrop] Added to queue: " + JSON.stringify({ event }));
485
486
  }
486
487
  this.buffer.push(event);
487
488
  if (this.buffer.length >= this.bufferSize) {
@@ -759,7 +760,7 @@ var Raindrop = class {
759
760
  this.partialEventTimeouts.forEach(clearTimeout);
760
761
  this.partialEventTimeouts.clear();
761
762
  if (this.debugLogs) {
762
- console.log("Closing Raindrop Analytics");
763
+ console.log("[raindrop] Closing Raindrop Analytics");
763
764
  }
764
765
  }
765
766
  };
@@ -1,5 +1,5 @@
1
1
  import * as traceloop from '@traceloop/node-server-sdk';
2
- import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-gF5ZqfKW.mjs';
2
+ import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-C86NGhKr.mjs';
3
3
  import '@dawn/schemas/ingest';
4
4
  import '@opentelemetry/api';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as traceloop from '@traceloop/node-server-sdk';
2
- import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-gF5ZqfKW.js';
2
+ import { R as Raindrop, P as PartialAiTrackEvent, I as Interaction, T as Tracer } from '../index-C86NGhKr.js';
3
3
  import '@dawn/schemas/ingest';
4
4
  import '@opentelemetry/api';
5
5
 
@@ -145899,6 +145899,7 @@ var LiveInteraction = class {
145899
145899
  this.traceId = traceId;
145900
145900
  }
145901
145901
  async withSpan(params, fn, thisArg, ...args) {
145902
+ var _a7;
145902
145903
  const taskName = typeof params === "string" ? params : params.name;
145903
145904
  const properties = typeof params === "string" ? {
145904
145905
  ...getPropertiesFromContext(this.context)
@@ -145907,6 +145908,9 @@ var LiveInteraction = class {
145907
145908
  ...params.properties || {}
145908
145909
  };
145909
145910
  const inputParameters = typeof params === "string" ? void 0 : params.inputParameters;
145911
+ if ((_a7 = this.analytics) == null ? void 0 : _a7.debugLogs) {
145912
+ console.log("[raindrop] using withSpan in liveInteraction");
145913
+ }
145910
145914
  return withTask(
145911
145915
  {
145912
145916
  name: taskName,
@@ -145921,12 +145925,16 @@ var LiveInteraction = class {
145921
145925
  );
145922
145926
  }
145923
145927
  async withTool(params, fn, thisArg, ...args) {
145928
+ var _a7;
145924
145929
  const toolName = params.name;
145925
145930
  const properties = {
145926
145931
  ...getPropertiesFromContext(this.context),
145927
145932
  ...params.properties || {}
145928
145933
  };
145929
145934
  const inputParams = params.inputParameters ? [params.inputParameters] : void 0;
145935
+ if ((_a7 = this.analytics) == null ? void 0 : _a7.debugLogs) {
145936
+ console.log("[raindrop] using withTool in liveInteraction");
145937
+ }
145930
145938
  return withTool(
145931
145939
  {
145932
145940
  name: toolName,
@@ -146078,6 +146086,10 @@ var NonLiveInteraction = class {
146078
146086
  this.analytics = analytics;
146079
146087
  }
146080
146088
  withSpan(_params, fn, thisArg, ...args) {
146089
+ var _a7;
146090
+ if ((_a7 = this.analytics) == null ? void 0 : _a7.debugLogs) {
146091
+ console.log("[raindrop] using withSpan in nonLiveInteraction");
146092
+ }
146081
146093
  try {
146082
146094
  return Promise.resolve(fn.apply(thisArg, args));
146083
146095
  } catch (error) {
@@ -146085,6 +146097,10 @@ var NonLiveInteraction = class {
146085
146097
  }
146086
146098
  }
146087
146099
  withTool(_params, fn, thisArg, ...args) {
146100
+ var _a7;
146101
+ if ((_a7 = this.analytics) == null ? void 0 : _a7.debugLogs) {
146102
+ console.log("[raindrop] using withTool in nonLiveInteraction");
146103
+ }
146088
146104
  try {
146089
146105
  return Promise.resolve(fn.apply(thisArg, args));
146090
146106
  } catch (error) {
@@ -146136,7 +146152,13 @@ var NonLiveInteraction = class {
146136
146152
 
146137
146153
  // src/tracing/tracer-core.ts
146138
146154
  var getGlobalRegistry = () => {
146139
- if (typeof window !== "undefined") {
146155
+ if (typeof globalThis !== "undefined") {
146156
+ globalThis.__RAINDROP_TRACING_REGISTRY__ = globalThis.__RAINDROP_TRACING_REGISTRY__ || {
146157
+ hasRealImplementation: false,
146158
+ realImplementation: null
146159
+ };
146160
+ return globalThis.__RAINDROP_TRACING_REGISTRY__;
146161
+ } else if (typeof window !== "undefined") {
146140
146162
  window.__RAINDROP_TRACING_REGISTRY__ = window.__RAINDROP_TRACING_REGISTRY__ || {
146141
146163
  hasRealImplementation: false,
146142
146164
  realImplementation: null
@@ -146159,7 +146181,7 @@ var _setImplementation = (impl) => {
146159
146181
  registry.realImplementation = impl;
146160
146182
  registry.hasRealImplementation = true;
146161
146183
  if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
146162
- console.log("Raindrop: Set real implementation in global registry");
146184
+ console.log("[raindrop] Set real implementation in global registry");
146163
146185
  }
146164
146186
  };
146165
146187
 
@@ -146173,12 +146195,13 @@ function getCurrentTraceId() {
146173
146195
  var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
146174
146196
  const { logLevel, ...otherOptions } = options;
146175
146197
  if (isDebug) {
146176
- console.log("using traces");
146198
+ console.log("[raindrop] using traces");
146177
146199
  }
146178
146200
  const traceloopClient = initialize({
146179
146201
  baseUrl: apiUrl,
146180
146202
  apiKey: writeKey,
146181
- ...otherOptions
146203
+ ...otherOptions,
146204
+ logLevel
146182
146205
  });
146183
146206
  return {
146184
146207
  begin(traceContext) {
@@ -146224,11 +146247,11 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
146224
146247
  try {
146225
146248
  _setImplementation(tracing);
146226
146249
  if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
146227
- console.log("Raindrop: Auto-initialized tracing");
146250
+ console.log("[raindrop] Auto-initialized tracing");
146228
146251
  }
146229
146252
  } catch (e) {
146230
146253
  if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
146231
- console.error("Raindrop: Failed to auto-initialize tracing:", e);
146254
+ console.error("[raindrop] Failed to auto-initialize tracing:", e);
146232
146255
  }
146233
146256
  }
146234
146257
  function initTracing() {
@@ -29,7 +29,7 @@ import {
29
29
  metrics,
30
30
  propagation,
31
31
  trace
32
- } from "../chunk-BCJTP4MY.mjs";
32
+ } from "../chunk-UAOOL33Y.mjs";
33
33
 
34
34
  // ../../node_modules/@opentelemetry/sdk-node/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
35
35
  function suppressTracing(context2) {
@@ -144215,6 +144215,7 @@ var LiveInteraction = class {
144215
144215
  this.traceId = traceId;
144216
144216
  }
144217
144217
  async withSpan(params, fn, thisArg, ...args) {
144218
+ var _a7;
144218
144219
  const taskName = typeof params === "string" ? params : params.name;
144219
144220
  const properties = typeof params === "string" ? {
144220
144221
  ...getPropertiesFromContext(this.context)
@@ -144223,6 +144224,9 @@ var LiveInteraction = class {
144223
144224
  ...params.properties || {}
144224
144225
  };
144225
144226
  const inputParameters = typeof params === "string" ? void 0 : params.inputParameters;
144227
+ if ((_a7 = this.analytics) == null ? void 0 : _a7.debugLogs) {
144228
+ console.log("[raindrop] using withSpan in liveInteraction");
144229
+ }
144226
144230
  return withTask(
144227
144231
  {
144228
144232
  name: taskName,
@@ -144237,12 +144241,16 @@ var LiveInteraction = class {
144237
144241
  );
144238
144242
  }
144239
144243
  async withTool(params, fn, thisArg, ...args) {
144244
+ var _a7;
144240
144245
  const toolName = params.name;
144241
144246
  const properties = {
144242
144247
  ...getPropertiesFromContext(this.context),
144243
144248
  ...params.properties || {}
144244
144249
  };
144245
144250
  const inputParams = params.inputParameters ? [params.inputParameters] : void 0;
144251
+ if ((_a7 = this.analytics) == null ? void 0 : _a7.debugLogs) {
144252
+ console.log("[raindrop] using withTool in liveInteraction");
144253
+ }
144246
144254
  return withTool(
144247
144255
  {
144248
144256
  name: toolName,
@@ -144354,12 +144362,13 @@ function getCurrentTraceId() {
144354
144362
  var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
144355
144363
  const { logLevel, ...otherOptions } = options;
144356
144364
  if (isDebug) {
144357
- console.log("using traces");
144365
+ console.log("[raindrop] using traces");
144358
144366
  }
144359
144367
  const traceloopClient = initialize({
144360
144368
  baseUrl: apiUrl,
144361
144369
  apiKey: writeKey,
144362
- ...otherOptions
144370
+ ...otherOptions,
144371
+ logLevel
144363
144372
  });
144364
144373
  return {
144365
144374
  begin(traceContext) {
@@ -144405,11 +144414,11 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
144405
144414
  try {
144406
144415
  _setImplementation(tracing);
144407
144416
  if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
144408
- console.log("Raindrop: Auto-initialized tracing");
144417
+ console.log("[raindrop] Auto-initialized tracing");
144409
144418
  }
144410
144419
  } catch (e) {
144411
144420
  if (typeof process !== "undefined" && process.env.RAINDROP_DEBUG === "true") {
144412
- console.error("Raindrop: Failed to auto-initialize tracing:", e);
144421
+ console.error("[raindrop] Failed to auto-initialize tracing:", e);
144413
144422
  }
144414
144423
  }
144415
144424
  function initTracing() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",