raindrop-ai 0.0.85 → 0.0.86

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.
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "raindrop-ai",
4
- version: "0.0.85",
4
+ version: "0.0.86",
5
5
  main: "dist/index.js",
6
6
  module: "dist/index.mjs",
7
7
  types: "dist/index.d.ts",
@@ -316,6 +316,13 @@ function getActiveTraceContext() {
316
316
  }
317
317
 
318
318
  // src/tracing/direct/shipper.ts
319
+ function serializeAssociationValue(value) {
320
+ if (typeof value === "string") {
321
+ return value;
322
+ }
323
+ const jsonValue = JSON.stringify(value);
324
+ return jsonValue === void 0 ? String(value) : jsonValue;
325
+ }
319
326
  var DirectTraceShipper = class {
320
327
  constructor(opts) {
321
328
  this.queue = [];
@@ -360,7 +367,12 @@ var DirectTraceShipper = class {
360
367
  attrInt("traceloop.entity.duration_ms", params.durationMs)
361
368
  ];
362
369
  for (const [key, value] of Object.entries(params.properties)) {
363
- attributes.push(attrString(`traceloop.association.properties.${key}`, value));
370
+ if (value === void 0) {
371
+ continue;
372
+ }
373
+ attributes.push(
374
+ attrString(`traceloop.association.properties.${key}`, serializeAssociationValue(value))
375
+ );
364
376
  }
365
377
  let status;
366
378
  if (params.error) {
@@ -467,9 +479,17 @@ function getPropertiesFromContext(context3) {
467
479
  }
468
480
  function setAssociationProperties(span, properties) {
469
481
  Object.entries(properties).forEach(([key, value]) => {
470
- span.setAttribute("traceloop.association.properties." + key, String(value));
482
+ if (value === void 0) {
483
+ return;
484
+ }
485
+ span.setAttribute("traceloop.association.properties." + key, serializeSpanValue(value));
471
486
  });
472
487
  }
488
+ function serializeAssociationProperties(properties) {
489
+ return Object.fromEntries(
490
+ Object.entries(properties).filter(([, value]) => value !== void 0).map(([key, value]) => [key, serializeSpanValue(value)])
491
+ );
492
+ }
473
493
  function serializeSpanValue(value) {
474
494
  if (typeof value === "string") {
475
495
  return value;
@@ -565,7 +585,7 @@ var LiveInteraction = class {
565
585
  return traceloop.withTask(
566
586
  {
567
587
  name: taskName,
568
- associationProperties: properties,
588
+ associationProperties: serializeAssociationProperties(properties),
569
589
  inputParameters,
570
590
  traceContent: params.traceContent,
571
591
  suppressTracing: params.suppressTracing
@@ -633,7 +653,7 @@ var LiveInteraction = class {
633
653
  return traceloop.withTool(
634
654
  {
635
655
  name: toolName,
636
- associationProperties: properties,
656
+ associationProperties: serializeAssociationProperties(properties),
637
657
  inputParameters: inputParams,
638
658
  version: params.version,
639
659
  traceContent: params.traceContent,
@@ -735,7 +755,10 @@ var LiveInteraction = class {
735
755
  }
736
756
  if (this.context.properties) {
737
757
  for (const [key, value] of Object.entries(this.context.properties)) {
738
- metadata[`traceloop.association.properties.${key}`] = value;
758
+ if (value === void 0) {
759
+ continue;
760
+ }
761
+ metadata[`traceloop.association.properties.${key}`] = serializeSpanValue(value);
739
762
  }
740
763
  }
741
764
  return metadata;
package/dist/index.d.mts CHANGED
@@ -30,6 +30,11 @@ type OtherAttachment = BaseAttachment & {
30
30
  type: "text" | "image" | "iframe";
31
31
  };
32
32
  type Attachment = CodeAttachment | OtherAttachment;
33
+ type RaindropPropertyLeaf = string | boolean | number;
34
+ type RaindropPropertyValue = RaindropPropertyLeaf | RaindropPropertyValue[] | {
35
+ [key: string]: RaindropPropertyValue;
36
+ };
37
+ type RaindropProperties = Record<string, RaindropPropertyValue>;
33
38
  /**
34
39
  * Interface for tracking events.
35
40
  *
@@ -43,7 +48,7 @@ type Attachment = CodeAttachment | OtherAttachment;
43
48
  interface TrackEvent {
44
49
  eventId?: string;
45
50
  event: string;
46
- properties?: Record<string, any>;
51
+ properties?: RaindropProperties;
47
52
  timestamp?: string;
48
53
  userId: string;
49
54
  }
@@ -479,14 +484,14 @@ type Interaction = {
479
484
  *
480
485
  * @param properties Object containing properties to set
481
486
  */
482
- setProperties(properties: Record<string, string>): void;
487
+ setProperties(properties: RaindropProperties): void;
483
488
  /**
484
489
  * Sets a single property on the interaction context.
485
490
  *
486
491
  * @param key The property key
487
492
  * @param value The property value
488
493
  */
489
- setProperty(key: string, value: string): void;
494
+ setProperty(key: string, value: RaindropPropertyValue): void;
490
495
  /**
491
496
  * Adds an attachment to the interaction.
492
497
  *
@@ -920,4 +925,4 @@ declare class Raindrop {
920
925
  close(): Promise<void>;
921
926
  }
922
927
 
923
- export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
928
+ export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropProperties, type RaindropPropertyLeaf, type RaindropPropertyValue, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
package/dist/index.d.ts CHANGED
@@ -30,6 +30,11 @@ type OtherAttachment = BaseAttachment & {
30
30
  type: "text" | "image" | "iframe";
31
31
  };
32
32
  type Attachment = CodeAttachment | OtherAttachment;
33
+ type RaindropPropertyLeaf = string | boolean | number;
34
+ type RaindropPropertyValue = RaindropPropertyLeaf | RaindropPropertyValue[] | {
35
+ [key: string]: RaindropPropertyValue;
36
+ };
37
+ type RaindropProperties = Record<string, RaindropPropertyValue>;
33
38
  /**
34
39
  * Interface for tracking events.
35
40
  *
@@ -43,7 +48,7 @@ type Attachment = CodeAttachment | OtherAttachment;
43
48
  interface TrackEvent {
44
49
  eventId?: string;
45
50
  event: string;
46
- properties?: Record<string, any>;
51
+ properties?: RaindropProperties;
47
52
  timestamp?: string;
48
53
  userId: string;
49
54
  }
@@ -479,14 +484,14 @@ type Interaction = {
479
484
  *
480
485
  * @param properties Object containing properties to set
481
486
  */
482
- setProperties(properties: Record<string, string>): void;
487
+ setProperties(properties: RaindropProperties): void;
483
488
  /**
484
489
  * Sets a single property on the interaction context.
485
490
  *
486
491
  * @param key The property key
487
492
  * @param value The property value
488
493
  */
489
- setProperty(key: string, value: string): void;
494
+ setProperty(key: string, value: RaindropPropertyValue): void;
490
495
  /**
491
496
  * Adds an attachment to the interaction.
492
497
  *
@@ -920,4 +925,4 @@ declare class Raindrop {
920
925
  close(): Promise<void>;
921
926
  }
922
927
 
923
- export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
928
+ export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropProperties, type RaindropPropertyLeaf, type RaindropPropertyValue, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
package/dist/index.js CHANGED
@@ -59,10 +59,24 @@ var IdentifySchema = import_zod.z.object({
59
59
  traits: import_zod.z.record(import_zod.z.any()),
60
60
  user_id: import_zod.z.string()
61
61
  }).strict();
62
+ var EventPropertyLeafSchema = import_zod.z.union([
63
+ import_zod.z.string(),
64
+ import_zod.z.boolean(),
65
+ import_zod.z.number(),
66
+ import_zod.z.null()
67
+ ]);
68
+ var EventPropertyValueSchema = import_zod.z.lazy(
69
+ () => import_zod.z.union([
70
+ EventPropertyLeafSchema,
71
+ import_zod.z.array(EventPropertyValueSchema),
72
+ import_zod.z.record(EventPropertyValueSchema)
73
+ ])
74
+ );
75
+ var EventPropertiesSchema = import_zod.z.record(EventPropertyValueSchema);
62
76
  var TrackEventSchema = import_zod.z.object({
63
77
  event_id: import_zod.z.string(),
64
78
  event: import_zod.z.string().min(1, "Event name cannot be empty"),
65
- properties: import_zod.z.record(import_zod.z.any()).optional(),
79
+ properties: EventPropertiesSchema.optional(),
66
80
  timestamp: import_zod.z.coerce.date(),
67
81
  received_at: import_zod.z.coerce.date(),
68
82
  user_id: import_zod.z.coerce.string().min(1, "User ID cannot be empty"),
@@ -138,7 +152,7 @@ var CategorizationRequestSchema = import_zod.z.object({
138
152
  // package.json
139
153
  var package_default = {
140
154
  name: "raindrop-ai",
141
- version: "0.0.85",
155
+ version: "0.0.86",
142
156
  main: "dist/index.js",
143
157
  module: "dist/index.mjs",
144
158
  types: "dist/index.d.ts",
@@ -539,6 +553,13 @@ function getActiveTraceContext() {
539
553
  }
540
554
 
541
555
  // src/tracing/direct/shipper.ts
556
+ function serializeAssociationValue(value) {
557
+ if (typeof value === "string") {
558
+ return value;
559
+ }
560
+ const jsonValue = JSON.stringify(value);
561
+ return jsonValue === void 0 ? String(value) : jsonValue;
562
+ }
542
563
  var DirectTraceShipper = class {
543
564
  constructor(opts) {
544
565
  this.queue = [];
@@ -583,7 +604,12 @@ var DirectTraceShipper = class {
583
604
  attrInt("traceloop.entity.duration_ms", params.durationMs)
584
605
  ];
585
606
  for (const [key, value] of Object.entries(params.properties)) {
586
- attributes.push(attrString(`traceloop.association.properties.${key}`, value));
607
+ if (value === void 0) {
608
+ continue;
609
+ }
610
+ attributes.push(
611
+ attrString(`traceloop.association.properties.${key}`, serializeAssociationValue(value))
612
+ );
587
613
  }
588
614
  let status;
589
615
  if (params.error) {
@@ -690,9 +716,17 @@ function getPropertiesFromContext(context3) {
690
716
  }
691
717
  function setAssociationProperties(span, properties) {
692
718
  Object.entries(properties).forEach(([key, value]) => {
693
- span.setAttribute("traceloop.association.properties." + key, String(value));
719
+ if (value === void 0) {
720
+ return;
721
+ }
722
+ span.setAttribute("traceloop.association.properties." + key, serializeSpanValue(value));
694
723
  });
695
724
  }
725
+ function serializeAssociationProperties(properties) {
726
+ return Object.fromEntries(
727
+ Object.entries(properties).filter(([, value]) => value !== void 0).map(([key, value]) => [key, serializeSpanValue(value)])
728
+ );
729
+ }
696
730
  function serializeSpanValue(value) {
697
731
  if (typeof value === "string") {
698
732
  return value;
@@ -788,7 +822,7 @@ var LiveInteraction = class {
788
822
  return traceloop.withTask(
789
823
  {
790
824
  name: taskName,
791
- associationProperties: properties,
825
+ associationProperties: serializeAssociationProperties(properties),
792
826
  inputParameters,
793
827
  traceContent: params.traceContent,
794
828
  suppressTracing: params.suppressTracing
@@ -856,7 +890,7 @@ var LiveInteraction = class {
856
890
  return traceloop.withTool(
857
891
  {
858
892
  name: toolName,
859
- associationProperties: properties,
893
+ associationProperties: serializeAssociationProperties(properties),
860
894
  inputParameters: inputParams,
861
895
  version: params.version,
862
896
  traceContent: params.traceContent,
@@ -958,7 +992,10 @@ var LiveInteraction = class {
958
992
  }
959
993
  if (this.context.properties) {
960
994
  for (const [key, value] of Object.entries(this.context.properties)) {
961
- metadata[`traceloop.association.properties.${key}`] = value;
995
+ if (value === void 0) {
996
+ continue;
997
+ }
998
+ metadata[`traceloop.association.properties.${key}`] = serializeSpanValue(value);
962
999
  }
963
1000
  }
964
1001
  return metadata;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  package_default,
3
3
  tracing
4
- } from "./chunk-EVQT43DR.mjs";
4
+ } from "./chunk-JCKOY5OJ.mjs";
5
5
 
6
6
  // ../schemas/src/ingest/index.ts
7
7
  import { z } from "zod";
@@ -26,10 +26,24 @@ var IdentifySchema = z.object({
26
26
  traits: z.record(z.any()),
27
27
  user_id: z.string()
28
28
  }).strict();
29
+ var EventPropertyLeafSchema = z.union([
30
+ z.string(),
31
+ z.boolean(),
32
+ z.number(),
33
+ z.null()
34
+ ]);
35
+ var EventPropertyValueSchema = z.lazy(
36
+ () => z.union([
37
+ EventPropertyLeafSchema,
38
+ z.array(EventPropertyValueSchema),
39
+ z.record(EventPropertyValueSchema)
40
+ ])
41
+ );
42
+ var EventPropertiesSchema = z.record(EventPropertyValueSchema);
29
43
  var TrackEventSchema = z.object({
30
44
  event_id: z.string(),
31
45
  event: z.string().min(1, "Event name cannot be empty"),
32
- properties: z.record(z.any()).optional(),
46
+ properties: EventPropertiesSchema.optional(),
33
47
  timestamp: z.coerce.date(),
34
48
  received_at: z.coerce.date(),
35
49
  user_id: z.coerce.string().min(1, "User ID cannot be empty"),
@@ -184,7 +184,7 @@ function base64Encode(bytes) {
184
184
  // package.json
185
185
  var package_default = {
186
186
  name: "raindrop-ai",
187
- version: "0.0.85",
187
+ version: "0.0.86",
188
188
  main: "dist/index.js",
189
189
  module: "dist/index.mjs",
190
190
  types: "dist/index.d.ts",
@@ -350,6 +350,13 @@ function getActiveTraceContext() {
350
350
  }
351
351
 
352
352
  // src/tracing/direct/shipper.ts
353
+ function serializeAssociationValue(value) {
354
+ if (typeof value === "string") {
355
+ return value;
356
+ }
357
+ const jsonValue = JSON.stringify(value);
358
+ return jsonValue === void 0 ? String(value) : jsonValue;
359
+ }
353
360
  var DirectTraceShipper = class {
354
361
  constructor(opts) {
355
362
  this.queue = [];
@@ -394,7 +401,12 @@ var DirectTraceShipper = class {
394
401
  attrInt("traceloop.entity.duration_ms", params.durationMs)
395
402
  ];
396
403
  for (const [key, value] of Object.entries(params.properties)) {
397
- attributes.push(attrString(`traceloop.association.properties.${key}`, value));
404
+ if (value === void 0) {
405
+ continue;
406
+ }
407
+ attributes.push(
408
+ attrString(`traceloop.association.properties.${key}`, serializeAssociationValue(value))
409
+ );
398
410
  }
399
411
  let status;
400
412
  if (params.error) {
@@ -501,9 +513,17 @@ function getPropertiesFromContext(context3) {
501
513
  }
502
514
  function setAssociationProperties(span, properties) {
503
515
  Object.entries(properties).forEach(([key, value]) => {
504
- span.setAttribute("traceloop.association.properties." + key, String(value));
516
+ if (value === void 0) {
517
+ return;
518
+ }
519
+ span.setAttribute("traceloop.association.properties." + key, serializeSpanValue(value));
505
520
  });
506
521
  }
522
+ function serializeAssociationProperties(properties) {
523
+ return Object.fromEntries(
524
+ Object.entries(properties).filter(([, value]) => value !== void 0).map(([key, value]) => [key, serializeSpanValue(value)])
525
+ );
526
+ }
507
527
  function serializeSpanValue(value) {
508
528
  if (typeof value === "string") {
509
529
  return value;
@@ -599,7 +619,7 @@ var LiveInteraction = class {
599
619
  return traceloop.withTask(
600
620
  {
601
621
  name: taskName,
602
- associationProperties: properties,
622
+ associationProperties: serializeAssociationProperties(properties),
603
623
  inputParameters,
604
624
  traceContent: params.traceContent,
605
625
  suppressTracing: params.suppressTracing
@@ -667,7 +687,7 @@ var LiveInteraction = class {
667
687
  return traceloop.withTool(
668
688
  {
669
689
  name: toolName,
670
- associationProperties: properties,
690
+ associationProperties: serializeAssociationProperties(properties),
671
691
  inputParameters: inputParams,
672
692
  version: params.version,
673
693
  traceContent: params.traceContent,
@@ -769,7 +789,10 @@ var LiveInteraction = class {
769
789
  }
770
790
  if (this.context.properties) {
771
791
  for (const [key, value] of Object.entries(this.context.properties)) {
772
- metadata[`traceloop.association.properties.${key}`] = value;
792
+ if (value === void 0) {
793
+ continue;
794
+ }
795
+ metadata[`traceloop.association.properties.${key}`] = serializeSpanValue(value);
773
796
  }
774
797
  }
775
798
  return metadata;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "../chunk-EVQT43DR.mjs";
3
+ } from "../chunk-JCKOY5OJ.mjs";
4
4
 
5
5
  // src/tracing/index.ts
6
6
  function initTracing() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",