vedatrace 0.1.7 → 0.1.9

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.cjs CHANGED
@@ -5,13 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var transports_index = require('./transports/index.cjs');
6
6
 
7
7
  class VedaTraceBatcher {
8
- constructor(transports, config, onError, onSuccess, immediateFlush = false) {
8
+ constructor(transports, config, onError, onSuccess, immediateFlush = false, autoStart = false) {
9
9
  this.transports = transports;
10
10
  this.config = config;
11
11
  this.onError = onError;
12
12
  this.onSuccess = onSuccess;
13
13
  this.immediateFlush = immediateFlush;
14
- this.startFlushTimer();
14
+ if (autoStart && !immediateFlush) {
15
+ this.startFlushTimer();
16
+ }
15
17
  }
16
18
  queue = [];
17
19
  flushTimer = null;
@@ -59,7 +61,11 @@ class VedaTraceBatcher {
59
61
  const combinedError = new Error(
60
62
  `Failed to send logs after ${this.config.maxRetries} retries: ${errors.map((e) => e.message).join(", ")}`
61
63
  );
62
- this.onError?.(combinedError);
64
+ if (this.onError) {
65
+ this.onError(combinedError);
66
+ } else {
67
+ console.error("[VedaTrace]", combinedError.message);
68
+ }
63
69
  return;
64
70
  }
65
71
  this.onSuccess?.();
@@ -71,7 +77,18 @@ class VedaTraceBatcher {
71
77
  }
72
78
  this.flushTimer = setInterval(() => {
73
79
  if (this.queue.length > 0) {
74
- this.flush();
80
+ this.flush().catch((error) => {
81
+ if (this.onError) {
82
+ this.onError(
83
+ error instanceof Error ? error : new Error(String(error))
84
+ );
85
+ } else {
86
+ console.error(
87
+ "[VedaTrace] Flush error:",
88
+ error instanceof Error ? error.message : String(error)
89
+ );
90
+ }
91
+ });
75
92
  }
76
93
  }, this.config.flushInterval);
77
94
  if (this.config.unrefTimer === true) {
@@ -85,6 +102,12 @@ class VedaTraceBatcher {
85
102
  this.flushTimer = null;
86
103
  }
87
104
  }
105
+ /** Start the flush timer (for manual control in edge runtimes) */
106
+ start() {
107
+ if (!this.flushTimer && !this.immediateFlush) {
108
+ this.startFlushTimer();
109
+ }
110
+ }
88
111
  /** Delay helper */
89
112
  delay(ms) {
90
113
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -95,12 +118,39 @@ class VedaTraceBatcher {
95
118
  }
96
119
  }
97
120
 
121
+ function detectRuntime() {
122
+ if (typeof process !== "undefined" && process.versions?.node) {
123
+ return "node";
124
+ }
125
+ if (typeof globalThis !== "undefined" && "navigator" in globalThis && typeof self === "undefined") {
126
+ return "browser";
127
+ }
128
+ if (typeof caches !== "undefined") {
129
+ return "cloudflare";
130
+ }
131
+ const maybeDeno = globalThis;
132
+ if (maybeDeno?.version) {
133
+ return "deno";
134
+ }
135
+ const maybeBun = globalThis;
136
+ if (maybeBun?.Bun) {
137
+ return "bun";
138
+ }
139
+ return "edge";
140
+ }
141
+ function isEdgeRuntime() {
142
+ const runtime = detectRuntime();
143
+ return runtime === "cloudflare" || runtime === "deno" || runtime === "bun" || runtime === "edge";
144
+ }
145
+
98
146
  const SDK_VERSION = "1.0.0";
99
147
  class VedaTraceLogger {
100
148
  batcher = null;
149
+ runtime;
101
150
  config;
102
151
  childDefaults;
103
152
  constructor(config = {}, childDefaults = {}) {
153
+ this.runtime = config.runtime ?? detectRuntime();
104
154
  this.childDefaults = childDefaults;
105
155
  this.config = {
106
156
  service: config.service,
@@ -223,7 +273,13 @@ class VedaTraceLogger {
223
273
  this.batcher.stop();
224
274
  }
225
275
  }
226
- /** Detect runtime environment */
276
+ /** Start the flush timer (for manual control in edge runtimes) */
277
+ start() {
278
+ if (this.batcher) {
279
+ this.batcher.start();
280
+ }
281
+ }
282
+ /** Detect runtime environment (legacy, kept for compatibility) */
227
283
  detectEnvironment() {
228
284
  if (typeof globalThis !== "undefined" && "navigator" in globalThis) {
229
285
  return "browser";
@@ -311,6 +367,9 @@ function redactPii(value, mask) {
311
367
 
312
368
  function vedatrace(config = {}) {
313
369
  const logger = new VedaTraceLogger(config);
370
+ const isEdge = isEdgeRuntime();
371
+ const shouldImmediateFlush = config.immediateFlush ?? isEdge;
372
+ const shouldAutoStart = config.autoStart ?? !isEdge;
314
373
  if (config.apiKey && (!config.transports || config.transports.length === 0)) {
315
374
  const httpConfig = { apiKey: config.apiKey };
316
375
  if (config.endpoint) httpConfig.endpoint = config.endpoint;
@@ -319,13 +378,15 @@ function vedatrace(config = {}) {
319
378
  [httpTransport],
320
379
  {
321
380
  batchSize: config.batchSize ?? 100,
322
- flushInterval: config.flushInterval ?? 1e3,
381
+ flushInterval: config.flushInterval ?? (isEdge ? 1e3 : 5e3),
323
382
  maxRetries: config.maxRetries ?? 3,
324
383
  retryDelay: config.retryDelay ?? 1e3,
325
384
  unrefTimer: config.unrefTimer
326
385
  },
327
386
  config.onError,
328
- config.onSuccess
387
+ config.onSuccess,
388
+ shouldImmediateFlush,
389
+ shouldAutoStart
329
390
  );
330
391
  logger.setBatcher(batcher);
331
392
  if (typeof process !== "undefined") {
@@ -357,6 +418,8 @@ exports.VedaTraceHttpTransport = transports_index.VedaTraceHttpTransport;
357
418
  exports.VedaTraceBatcher = VedaTraceBatcher;
358
419
  exports.VedaTraceLogger = VedaTraceLogger;
359
420
  exports.default = vedatrace;
421
+ exports.detectRuntime = detectRuntime;
360
422
  exports.devVedatrace = devVedatrace;
423
+ exports.isEdgeRuntime = isEdgeRuntime;
361
424
  exports.redact = redact;
362
425
  exports.vedatrace = vedatrace;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata, R as RedactionConfig } from './types-CcdFb-vY.cjs';
2
- export { c as VedaTraceLevel, d as VedaTraceLog } from './types-CcdFb-vY.cjs';
1
+ import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, R as RuntimeType$1, a as VedaTraceConfig, L as LogMetadata, c as RedactionConfig } from './types-DUNRMOTv.cjs';
2
+ export { d as VedaTraceLevel, e as VedaTraceLog } from './types-DUNRMOTv.cjs';
3
3
  export { ConsoleFormat, ConsoleTransportConfig, HttpTransportConfig, VedaTraceConsoleTransport, VedaTraceHttpTransport } from './transports/index.cjs';
4
4
 
5
5
  /**
@@ -17,7 +17,7 @@ declare class VedaTraceBatcher {
17
17
  private flushTimer;
18
18
  private isFlushing;
19
19
  private pendingFlush;
20
- constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean);
20
+ constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean, autoStart?: boolean);
21
21
  /** Add log to queue */
22
22
  add(log: InternalLogEntry): void;
23
23
  /** Flush logs to all transports */
@@ -28,6 +28,8 @@ declare class VedaTraceBatcher {
28
28
  private startFlushTimer;
29
29
  /** Stop the flush timer */
30
30
  stop(): void;
31
+ /** Start the flush timer (for manual control in edge runtimes) */
32
+ start(): void;
31
33
  /** Delay helper */
32
34
  private delay;
33
35
  /** Get current queue size */
@@ -40,6 +42,7 @@ declare class VedaTraceBatcher {
40
42
 
41
43
  declare class VedaTraceLogger implements VedaTraceLoggerInterface {
42
44
  private batcher;
45
+ runtime: RuntimeType$1;
43
46
  private config;
44
47
  private childDefaults;
45
48
  constructor(config?: VedaTraceConfig, childDefaults?: LogMetadata);
@@ -65,7 +68,9 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
65
68
  flush(): Promise<void>;
66
69
  /** Stop the batcher and flush timer */
67
70
  stop(): void;
68
- /** Detect runtime environment */
71
+ /** Start the flush timer (for manual control in edge runtimes) */
72
+ start(): void;
73
+ /** Detect runtime environment (legacy, kept for compatibility) */
69
74
  private detectEnvironment;
70
75
  }
71
76
 
@@ -78,6 +83,14 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
78
83
  */
79
84
  declare function redact(obj: unknown, config?: RedactionConfig): unknown;
80
85
 
86
+ /**
87
+ * Runtime environment detection utility
88
+ * Detects Node.js, Browser, Cloudflare Workers, Deno, Bun
89
+ */
90
+ type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
91
+ declare function detectRuntime(): RuntimeType;
92
+ declare function isEdgeRuntime(): boolean;
93
+
81
94
  /**
82
95
  * VedaTrace SDK - Universal JavaScript logging
83
96
  *
@@ -112,4 +125,4 @@ declare function vedatrace(config?: VedaTraceConfig): VedaTraceLoggerInterface;
112
125
  */
113
126
  declare function devVedatrace(config?: Omit<VedaTraceConfig, "apiKey" | "transports">): VedaTraceLoggerInterface;
114
127
 
115
- export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, devVedatrace, redact, vedatrace };
128
+ export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, RuntimeType$1 as RuntimeType, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, detectRuntime, devVedatrace, isEdgeRuntime, redact, vedatrace };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata, R as RedactionConfig } from './types-CcdFb-vY.mjs';
2
- export { c as VedaTraceLevel, d as VedaTraceLog } from './types-CcdFb-vY.mjs';
1
+ import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, R as RuntimeType$1, a as VedaTraceConfig, L as LogMetadata, c as RedactionConfig } from './types-DUNRMOTv.mjs';
2
+ export { d as VedaTraceLevel, e as VedaTraceLog } from './types-DUNRMOTv.mjs';
3
3
  export { ConsoleFormat, ConsoleTransportConfig, HttpTransportConfig, VedaTraceConsoleTransport, VedaTraceHttpTransport } from './transports/index.mjs';
4
4
 
5
5
  /**
@@ -17,7 +17,7 @@ declare class VedaTraceBatcher {
17
17
  private flushTimer;
18
18
  private isFlushing;
19
19
  private pendingFlush;
20
- constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean);
20
+ constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean, autoStart?: boolean);
21
21
  /** Add log to queue */
22
22
  add(log: InternalLogEntry): void;
23
23
  /** Flush logs to all transports */
@@ -28,6 +28,8 @@ declare class VedaTraceBatcher {
28
28
  private startFlushTimer;
29
29
  /** Stop the flush timer */
30
30
  stop(): void;
31
+ /** Start the flush timer (for manual control in edge runtimes) */
32
+ start(): void;
31
33
  /** Delay helper */
32
34
  private delay;
33
35
  /** Get current queue size */
@@ -40,6 +42,7 @@ declare class VedaTraceBatcher {
40
42
 
41
43
  declare class VedaTraceLogger implements VedaTraceLoggerInterface {
42
44
  private batcher;
45
+ runtime: RuntimeType$1;
43
46
  private config;
44
47
  private childDefaults;
45
48
  constructor(config?: VedaTraceConfig, childDefaults?: LogMetadata);
@@ -65,7 +68,9 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
65
68
  flush(): Promise<void>;
66
69
  /** Stop the batcher and flush timer */
67
70
  stop(): void;
68
- /** Detect runtime environment */
71
+ /** Start the flush timer (for manual control in edge runtimes) */
72
+ start(): void;
73
+ /** Detect runtime environment (legacy, kept for compatibility) */
69
74
  private detectEnvironment;
70
75
  }
71
76
 
@@ -78,6 +83,14 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
78
83
  */
79
84
  declare function redact(obj: unknown, config?: RedactionConfig): unknown;
80
85
 
86
+ /**
87
+ * Runtime environment detection utility
88
+ * Detects Node.js, Browser, Cloudflare Workers, Deno, Bun
89
+ */
90
+ type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
91
+ declare function detectRuntime(): RuntimeType;
92
+ declare function isEdgeRuntime(): boolean;
93
+
81
94
  /**
82
95
  * VedaTrace SDK - Universal JavaScript logging
83
96
  *
@@ -112,4 +125,4 @@ declare function vedatrace(config?: VedaTraceConfig): VedaTraceLoggerInterface;
112
125
  */
113
126
  declare function devVedatrace(config?: Omit<VedaTraceConfig, "apiKey" | "transports">): VedaTraceLoggerInterface;
114
127
 
115
- export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, devVedatrace, redact, vedatrace };
128
+ export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, RuntimeType$1 as RuntimeType, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, detectRuntime, devVedatrace, isEdgeRuntime, redact, vedatrace };
package/dist/index.mjs CHANGED
@@ -1,13 +1,15 @@
1
1
  import { VedaTraceHttpTransport, VedaTraceConsoleTransport } from './transports/index.mjs';
2
2
 
3
3
  class VedaTraceBatcher {
4
- constructor(transports, config, onError, onSuccess, immediateFlush = false) {
4
+ constructor(transports, config, onError, onSuccess, immediateFlush = false, autoStart = false) {
5
5
  this.transports = transports;
6
6
  this.config = config;
7
7
  this.onError = onError;
8
8
  this.onSuccess = onSuccess;
9
9
  this.immediateFlush = immediateFlush;
10
- this.startFlushTimer();
10
+ if (autoStart && !immediateFlush) {
11
+ this.startFlushTimer();
12
+ }
11
13
  }
12
14
  queue = [];
13
15
  flushTimer = null;
@@ -55,7 +57,11 @@ class VedaTraceBatcher {
55
57
  const combinedError = new Error(
56
58
  `Failed to send logs after ${this.config.maxRetries} retries: ${errors.map((e) => e.message).join(", ")}`
57
59
  );
58
- this.onError?.(combinedError);
60
+ if (this.onError) {
61
+ this.onError(combinedError);
62
+ } else {
63
+ console.error("[VedaTrace]", combinedError.message);
64
+ }
59
65
  return;
60
66
  }
61
67
  this.onSuccess?.();
@@ -67,7 +73,18 @@ class VedaTraceBatcher {
67
73
  }
68
74
  this.flushTimer = setInterval(() => {
69
75
  if (this.queue.length > 0) {
70
- this.flush();
76
+ this.flush().catch((error) => {
77
+ if (this.onError) {
78
+ this.onError(
79
+ error instanceof Error ? error : new Error(String(error))
80
+ );
81
+ } else {
82
+ console.error(
83
+ "[VedaTrace] Flush error:",
84
+ error instanceof Error ? error.message : String(error)
85
+ );
86
+ }
87
+ });
71
88
  }
72
89
  }, this.config.flushInterval);
73
90
  if (this.config.unrefTimer === true) {
@@ -81,6 +98,12 @@ class VedaTraceBatcher {
81
98
  this.flushTimer = null;
82
99
  }
83
100
  }
101
+ /** Start the flush timer (for manual control in edge runtimes) */
102
+ start() {
103
+ if (!this.flushTimer && !this.immediateFlush) {
104
+ this.startFlushTimer();
105
+ }
106
+ }
84
107
  /** Delay helper */
85
108
  delay(ms) {
86
109
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -91,12 +114,39 @@ class VedaTraceBatcher {
91
114
  }
92
115
  }
93
116
 
117
+ function detectRuntime() {
118
+ if (typeof process !== "undefined" && process.versions?.node) {
119
+ return "node";
120
+ }
121
+ if (typeof globalThis !== "undefined" && "navigator" in globalThis && typeof self === "undefined") {
122
+ return "browser";
123
+ }
124
+ if (typeof caches !== "undefined") {
125
+ return "cloudflare";
126
+ }
127
+ const maybeDeno = globalThis;
128
+ if (maybeDeno?.version) {
129
+ return "deno";
130
+ }
131
+ const maybeBun = globalThis;
132
+ if (maybeBun?.Bun) {
133
+ return "bun";
134
+ }
135
+ return "edge";
136
+ }
137
+ function isEdgeRuntime() {
138
+ const runtime = detectRuntime();
139
+ return runtime === "cloudflare" || runtime === "deno" || runtime === "bun" || runtime === "edge";
140
+ }
141
+
94
142
  const SDK_VERSION = "1.0.0";
95
143
  class VedaTraceLogger {
96
144
  batcher = null;
145
+ runtime;
97
146
  config;
98
147
  childDefaults;
99
148
  constructor(config = {}, childDefaults = {}) {
149
+ this.runtime = config.runtime ?? detectRuntime();
100
150
  this.childDefaults = childDefaults;
101
151
  this.config = {
102
152
  service: config.service,
@@ -219,7 +269,13 @@ class VedaTraceLogger {
219
269
  this.batcher.stop();
220
270
  }
221
271
  }
222
- /** Detect runtime environment */
272
+ /** Start the flush timer (for manual control in edge runtimes) */
273
+ start() {
274
+ if (this.batcher) {
275
+ this.batcher.start();
276
+ }
277
+ }
278
+ /** Detect runtime environment (legacy, kept for compatibility) */
223
279
  detectEnvironment() {
224
280
  if (typeof globalThis !== "undefined" && "navigator" in globalThis) {
225
281
  return "browser";
@@ -307,6 +363,9 @@ function redactPii(value, mask) {
307
363
 
308
364
  function vedatrace(config = {}) {
309
365
  const logger = new VedaTraceLogger(config);
366
+ const isEdge = isEdgeRuntime();
367
+ const shouldImmediateFlush = config.immediateFlush ?? isEdge;
368
+ const shouldAutoStart = config.autoStart ?? !isEdge;
310
369
  if (config.apiKey && (!config.transports || config.transports.length === 0)) {
311
370
  const httpConfig = { apiKey: config.apiKey };
312
371
  if (config.endpoint) httpConfig.endpoint = config.endpoint;
@@ -315,13 +374,15 @@ function vedatrace(config = {}) {
315
374
  [httpTransport],
316
375
  {
317
376
  batchSize: config.batchSize ?? 100,
318
- flushInterval: config.flushInterval ?? 1e3,
377
+ flushInterval: config.flushInterval ?? (isEdge ? 1e3 : 5e3),
319
378
  maxRetries: config.maxRetries ?? 3,
320
379
  retryDelay: config.retryDelay ?? 1e3,
321
380
  unrefTimer: config.unrefTimer
322
381
  },
323
382
  config.onError,
324
- config.onSuccess
383
+ config.onSuccess,
384
+ shouldImmediateFlush,
385
+ shouldAutoStart
325
386
  );
326
387
  logger.setBatcher(batcher);
327
388
  if (typeof process !== "undefined") {
@@ -348,4 +409,4 @@ function devVedatrace(config = {}) {
348
409
  });
349
410
  }
350
411
 
351
- export { VedaTraceBatcher, VedaTraceConsoleTransport, VedaTraceHttpTransport, VedaTraceLogger, vedatrace as default, devVedatrace, redact, vedatrace };
412
+ export { VedaTraceBatcher, VedaTraceConsoleTransport, VedaTraceHttpTransport, VedaTraceLogger, vedatrace as default, detectRuntime, devVedatrace, isEdgeRuntime, redact, vedatrace };
@@ -1,5 +1,5 @@
1
1
  import { Request, Response, NextFunction } from 'express';
2
- import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-CcdFb-vY.cjs';
2
+ import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-DUNRMOTv.cjs';
3
3
 
4
4
  /**
5
5
  * Express.js middleware integration for VedaTrace
@@ -1,5 +1,5 @@
1
1
  import { Request, Response, NextFunction } from 'express';
2
- import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-CcdFb-vY.mjs';
2
+ import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-DUNRMOTv.mjs';
3
3
 
4
4
  /**
5
5
  * Express.js middleware integration for VedaTrace
@@ -1,4 +1,4 @@
1
- import { a as VedaTraceConfig, L as LogMetadata, V as VedaTraceLoggerInterface } from '../types-CcdFb-vY.cjs';
1
+ import { a as VedaTraceConfig, L as LogMetadata, V as VedaTraceLoggerInterface } from '../types-DUNRMOTv.cjs';
2
2
 
3
3
  /**
4
4
  * Next.js integration for VedaTrace
@@ -1,4 +1,4 @@
1
- import { a as VedaTraceConfig, L as LogMetadata, V as VedaTraceLoggerInterface } from '../types-CcdFb-vY.mjs';
1
+ import { a as VedaTraceConfig, L as LogMetadata, V as VedaTraceLoggerInterface } from '../types-DUNRMOTv.mjs';
2
2
 
3
3
  /**
4
4
  * Next.js integration for VedaTrace
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-CcdFb-vY.cjs';
2
+ import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-DUNRMOTv.cjs';
3
3
 
4
4
  /**
5
5
  * React integration for VedaTrace
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-CcdFb-vY.mjs';
2
+ import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-DUNRMOTv.mjs';
3
3
 
4
4
  /**
5
5
  * React integration for VedaTrace
@@ -1,4 +1,4 @@
1
- import { c as VedaTraceLevel, b as VedaTraceTransport, I as InternalLogEntry } from '../types-CcdFb-vY.cjs';
1
+ import { d as VedaTraceLevel, b as VedaTraceTransport, I as InternalLogEntry } from '../types-DUNRMOTv.cjs';
2
2
 
3
3
  /**
4
4
  * Console transport for development/debugging
@@ -1,4 +1,4 @@
1
- import { c as VedaTraceLevel, b as VedaTraceTransport, I as InternalLogEntry } from '../types-CcdFb-vY.mjs';
1
+ import { d as VedaTraceLevel, b as VedaTraceTransport, I as InternalLogEntry } from '../types-DUNRMOTv.mjs';
2
2
 
3
3
  /**
4
4
  * Console transport for development/debugging
@@ -51,6 +51,10 @@ interface VedaTraceConfig {
51
51
  immediateFlush?: boolean;
52
52
  /** Unref the flush timer (Node.js only, default: false) */
53
53
  unrefTimer?: boolean;
54
+ /** Auto-start the flush timer (default: true, auto-disabled for edge runtimes) */
55
+ autoStart?: boolean;
56
+ /** Force a specific runtime (auto-detected by default) */
57
+ runtime?: RuntimeType;
54
58
  }
55
59
  /** Redaction configuration */
56
60
  interface RedactionConfig {
@@ -61,6 +65,8 @@ interface RedactionConfig {
61
65
  /** Enable automatic PII detection */
62
66
  autoDetectPii?: boolean;
63
67
  }
68
+ /** Runtime environment type */
69
+ type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
64
70
  /** Transport interface for sending logs */
65
71
  interface VedaTraceTransport {
66
72
  /** Transport name */
@@ -112,6 +118,8 @@ interface VedaTraceLoggerInterface {
112
118
  child(defaults: LogMetadata): VedaTraceLoggerInterface;
113
119
  flush(): Promise<void>;
114
120
  stop(): void;
121
+ start(): void;
122
+ runtime: RuntimeType;
115
123
  }
116
124
 
117
- export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L, RedactionConfig as R, VedaTraceLoggerInterface as V, VedaTraceConfig as a, VedaTraceTransport as b, VedaTraceLevel as c, VedaTraceLog as d };
125
+ export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L, RuntimeType as R, VedaTraceLoggerInterface as V, VedaTraceConfig as a, VedaTraceTransport as b, RedactionConfig as c, VedaTraceLevel as d, VedaTraceLog as e };
@@ -51,6 +51,10 @@ interface VedaTraceConfig {
51
51
  immediateFlush?: boolean;
52
52
  /** Unref the flush timer (Node.js only, default: false) */
53
53
  unrefTimer?: boolean;
54
+ /** Auto-start the flush timer (default: true, auto-disabled for edge runtimes) */
55
+ autoStart?: boolean;
56
+ /** Force a specific runtime (auto-detected by default) */
57
+ runtime?: RuntimeType;
54
58
  }
55
59
  /** Redaction configuration */
56
60
  interface RedactionConfig {
@@ -61,6 +65,8 @@ interface RedactionConfig {
61
65
  /** Enable automatic PII detection */
62
66
  autoDetectPii?: boolean;
63
67
  }
68
+ /** Runtime environment type */
69
+ type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
64
70
  /** Transport interface for sending logs */
65
71
  interface VedaTraceTransport {
66
72
  /** Transport name */
@@ -112,6 +118,8 @@ interface VedaTraceLoggerInterface {
112
118
  child(defaults: LogMetadata): VedaTraceLoggerInterface;
113
119
  flush(): Promise<void>;
114
120
  stop(): void;
121
+ start(): void;
122
+ runtime: RuntimeType;
115
123
  }
116
124
 
117
- export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L, RedactionConfig as R, VedaTraceLoggerInterface as V, VedaTraceConfig as a, VedaTraceTransport as b, VedaTraceLevel as c, VedaTraceLog as d };
125
+ export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L, RuntimeType as R, VedaTraceLoggerInterface as V, VedaTraceConfig as a, VedaTraceTransport as b, RedactionConfig as c, VedaTraceLevel as d, VedaTraceLog as e };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vedatrace",
3
3
  "description": "Universal JavaScript logging SDK for VedaTrace - type-safe, lightweight, and developer-friendly",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "scripts": {
6
6
  "setup": "rm -rf node_modules && npm i && git init && husky",
7
7
  "prepublishOnly": "npm run build",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "lint-staged": {
25
25
  "*.{ts,tsx}": [
26
- "npm run lint"
26
+ "bun run lint"
27
27
  ]
28
28
  },
29
29
  "type": "module",