@bentolabs/sdk 1.0.1 → 1.1.0

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.d.ts CHANGED
@@ -2,16 +2,29 @@ interface SDKConfig {
2
2
  apiKey: string;
3
3
  endpoint: string;
4
4
  debug: boolean;
5
+ batchSize: number;
6
+ batchInterval: number;
7
+ enableRecording: boolean;
8
+ maxRetries: number;
9
+ baseRetryDelay: number;
5
10
  }
6
11
  interface SDKOptions {
7
12
  endpoint?: string;
8
13
  debug?: boolean;
14
+ batchSize?: number;
15
+ batchInterval?: number;
16
+ enableRecording?: boolean;
17
+ maxRetries?: number;
18
+ baseRetryDelay?: number;
9
19
  }
10
20
  export declare class BentoLabsSDK {
11
21
  private config;
12
22
  private sessionId;
13
23
  private events;
14
24
  private isRecording;
25
+ private batchTimer;
26
+ private retryTimer;
27
+ private stopRecording;
15
28
  constructor();
16
29
  /**
17
30
  * Initialize the BentoLabs SDK
@@ -35,6 +48,26 @@ export declare class BentoLabsSDK {
35
48
  * Start batching events for transmission
36
49
  */
37
50
  private startBatching;
51
+ /**
52
+ * Add an event to the events array
53
+ */
54
+ private addEvent;
55
+ /**
56
+ * Send batched events to the API with exponential backoff retry
57
+ */
58
+ private sendBatch;
59
+ /**
60
+ * Schedule retry attempts for failed events
61
+ */
62
+ private scheduleRetry;
63
+ /**
64
+ * Internal method to stop recording without logging (used during re-init)
65
+ */
66
+ private stopRecordingInternal;
67
+ /**
68
+ * Stop recording and clean up resources
69
+ */
70
+ stop(): void;
38
71
  /**
39
72
  * Get current session ID
40
73
  */
@@ -49,6 +82,20 @@ export declare class BentoLabsSDK {
49
82
  getConfig(): Omit<SDKConfig, 'apiKey'> & {
50
83
  apiKey: string;
51
84
  };
85
+ /**
86
+ * Get current event queue length
87
+ */
88
+ getEventQueueLength(): number;
89
+ /**
90
+ * Manually trigger a batch send
91
+ */
92
+ flushEvents(): Promise<void>;
93
+ /**
94
+ * Track a custom event with custom data
95
+ * @param eventName - Name of the custom event
96
+ * @param data - Custom event data (will be JSON stringified)
97
+ */
98
+ trackCustomEvent(eventName: string, data?: Record<string, any>): void;
52
99
  }
53
100
  declare const _default: BentoLabsSDK;
54
101
  export default _default;