@deeptracer/core 0.5.0 → 0.5.1
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/{chunk-GH7R74RT.js → chunk-HOUMS3SU.js} +6 -14
- package/dist/index.cjs +6 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/internal.cjs +6 -14
- package/dist/internal.d.cts +3 -4
- package/dist/internal.d.ts +3 -4
- package/dist/internal.js +1 -1
- package/dist/{logger-BDTEt7Gi.d.cts → logger-BzzHo1HP.d.cts} +5 -17
- package/dist/{logger-BDTEt7Gi.d.ts → logger-BzzHo1HP.d.ts} +5 -17
- package/package.json +1 -1
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = "0.5.
|
|
2
|
+
var SDK_VERSION = "0.5.1";
|
|
3
3
|
var SDK_NAME = "core";
|
|
4
4
|
|
|
5
5
|
// src/transport.ts
|
|
6
6
|
var Transport = class {
|
|
7
7
|
constructor(config) {
|
|
8
8
|
this.config = config;
|
|
9
|
-
const hasKey = !!
|
|
9
|
+
const hasKey = !!config.apiKey;
|
|
10
10
|
const hasEndpoint = !!config.endpoint;
|
|
11
11
|
this.disabled = !hasKey || !hasEndpoint;
|
|
12
|
-
if (config.secretKey?.startsWith("dt_secret_") && typeof globalThis.window !== "undefined") {
|
|
13
|
-
console.error(
|
|
14
|
-
"[@deeptracer/core] WARNING: `secretKey` (dt_secret_...) detected in a browser bundle. This exposes your server key to end users. Use `publicKey` (dt_public_...) for client-side code."
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
12
|
}
|
|
18
13
|
inFlightRequests = /* @__PURE__ */ new Set();
|
|
19
14
|
/**
|
|
@@ -30,9 +25,8 @@ var Transport = class {
|
|
|
30
25
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
31
26
|
*/
|
|
32
27
|
warnedLabels = /* @__PURE__ */ new Set();
|
|
33
|
-
/** Resolve the auth key: prefer secretKey (server), fall back to publicKey (client). */
|
|
34
28
|
get authKey() {
|
|
35
|
-
return this.config.
|
|
29
|
+
return this.config.apiKey ?? "";
|
|
36
30
|
}
|
|
37
31
|
/**
|
|
38
32
|
* Send a request with automatic retry and exponential backoff.
|
|
@@ -281,16 +275,14 @@ var Logger = class _Logger {
|
|
|
281
275
|
this.contextName = contextName;
|
|
282
276
|
this.requestMeta = requestMeta;
|
|
283
277
|
this.state = state ?? createLoggerState(config.maxBreadcrumbs ?? 20);
|
|
284
|
-
const hasKey = !!
|
|
278
|
+
const hasKey = !!config.apiKey;
|
|
285
279
|
const hasEndpoint = !!config.endpoint;
|
|
286
280
|
if (!hasKey && !hasEndpoint) {
|
|
287
281
|
_originalConsole.warn(
|
|
288
|
-
"[@deeptracer/core] No API key or endpoint configured. Running in local-only mode (logging methods work, but events are not sent). Set
|
|
282
|
+
"[@deeptracer/core] No API key or endpoint configured. Running in local-only mode (logging methods work, but events are not sent). Set DEEPTRACER_KEY and DEEPTRACER_ENDPOINT to enable."
|
|
289
283
|
);
|
|
290
284
|
} else if (!hasKey) {
|
|
291
|
-
_originalConsole.warn(
|
|
292
|
-
"[@deeptracer/core] No `secretKey` or `publicKey` provided. Events will not be sent."
|
|
293
|
-
);
|
|
285
|
+
_originalConsole.warn("[@deeptracer/core] No `apiKey` provided. Events will not be sent.");
|
|
294
286
|
} else if (!hasEndpoint) {
|
|
295
287
|
_originalConsole.warn("[@deeptracer/core] No `endpoint` provided. Events will not be sent.");
|
|
296
288
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -62,21 +62,16 @@ var Batcher = class {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
// src/version.ts
|
|
65
|
-
var SDK_VERSION = "0.5.
|
|
65
|
+
var SDK_VERSION = "0.5.1";
|
|
66
66
|
var SDK_NAME = "core";
|
|
67
67
|
|
|
68
68
|
// src/transport.ts
|
|
69
69
|
var Transport = class {
|
|
70
70
|
constructor(config) {
|
|
71
71
|
this.config = config;
|
|
72
|
-
const hasKey = !!
|
|
72
|
+
const hasKey = !!config.apiKey;
|
|
73
73
|
const hasEndpoint = !!config.endpoint;
|
|
74
74
|
this.disabled = !hasKey || !hasEndpoint;
|
|
75
|
-
if (config.secretKey?.startsWith("dt_secret_") && typeof globalThis.window !== "undefined") {
|
|
76
|
-
console.error(
|
|
77
|
-
"[@deeptracer/core] WARNING: `secretKey` (dt_secret_...) detected in a browser bundle. This exposes your server key to end users. Use `publicKey` (dt_public_...) for client-side code."
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
75
|
}
|
|
81
76
|
inFlightRequests = /* @__PURE__ */ new Set();
|
|
82
77
|
/**
|
|
@@ -93,9 +88,8 @@ var Transport = class {
|
|
|
93
88
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
94
89
|
*/
|
|
95
90
|
warnedLabels = /* @__PURE__ */ new Set();
|
|
96
|
-
/** Resolve the auth key: prefer secretKey (server), fall back to publicKey (client). */
|
|
97
91
|
get authKey() {
|
|
98
|
-
return this.config.
|
|
92
|
+
return this.config.apiKey ?? "";
|
|
99
93
|
}
|
|
100
94
|
/**
|
|
101
95
|
* Send a request with automatic retry and exponential backoff.
|
|
@@ -310,16 +304,14 @@ var Logger = class _Logger {
|
|
|
310
304
|
this.contextName = contextName;
|
|
311
305
|
this.requestMeta = requestMeta;
|
|
312
306
|
this.state = state ?? createLoggerState(config.maxBreadcrumbs ?? 20);
|
|
313
|
-
const hasKey = !!
|
|
307
|
+
const hasKey = !!config.apiKey;
|
|
314
308
|
const hasEndpoint = !!config.endpoint;
|
|
315
309
|
if (!hasKey && !hasEndpoint) {
|
|
316
310
|
_originalConsole.warn(
|
|
317
|
-
"[@deeptracer/core] No API key or endpoint configured. Running in local-only mode (logging methods work, but events are not sent). Set
|
|
311
|
+
"[@deeptracer/core] No API key or endpoint configured. Running in local-only mode (logging methods work, but events are not sent). Set DEEPTRACER_KEY and DEEPTRACER_ENDPOINT to enable."
|
|
318
312
|
);
|
|
319
313
|
} else if (!hasKey) {
|
|
320
|
-
_originalConsole.warn(
|
|
321
|
-
"[@deeptracer/core] No `secretKey` or `publicKey` provided. Events will not be sent."
|
|
322
|
-
);
|
|
314
|
+
_originalConsole.warn("[@deeptracer/core] No `apiKey` provided. Events will not be sent.");
|
|
323
315
|
} else if (!hasEndpoint) {
|
|
324
316
|
_originalConsole.warn("[@deeptracer/core] No `endpoint` provided. Events will not be sent.");
|
|
325
317
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, L as LLMUsageReport, b as LogEntry, c as LogLevel, d as Logger, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-
|
|
1
|
+
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, L as LLMUsageReport, b as LogEntry, c as LogLevel, d as Logger, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-BzzHo1HP.cjs';
|
|
2
2
|
|
|
3
3
|
/** SDK version. Update on each release. */
|
|
4
|
-
declare const SDK_VERSION = "0.5.
|
|
4
|
+
declare const SDK_VERSION = "0.5.1";
|
|
5
5
|
declare const SDK_NAME = "core";
|
|
6
6
|
|
|
7
7
|
export { SDK_NAME, SDK_VERSION };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, L as LLMUsageReport, b as LogEntry, c as LogLevel, d as Logger, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-
|
|
1
|
+
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, L as LLMUsageReport, b as LogEntry, c as LogLevel, d as Logger, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-BzzHo1HP.js';
|
|
2
2
|
|
|
3
3
|
/** SDK version. Update on each release. */
|
|
4
|
-
declare const SDK_VERSION = "0.5.
|
|
4
|
+
declare const SDK_VERSION = "0.5.1";
|
|
5
5
|
declare const SDK_NAME = "core";
|
|
6
6
|
|
|
7
7
|
export { SDK_NAME, SDK_VERSION };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -63,21 +63,16 @@ var Batcher = class {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
// src/version.ts
|
|
66
|
-
var SDK_VERSION = "0.5.
|
|
66
|
+
var SDK_VERSION = "0.5.1";
|
|
67
67
|
var SDK_NAME = "core";
|
|
68
68
|
|
|
69
69
|
// src/transport.ts
|
|
70
70
|
var Transport = class {
|
|
71
71
|
constructor(config) {
|
|
72
72
|
this.config = config;
|
|
73
|
-
const hasKey = !!
|
|
73
|
+
const hasKey = !!config.apiKey;
|
|
74
74
|
const hasEndpoint = !!config.endpoint;
|
|
75
75
|
this.disabled = !hasKey || !hasEndpoint;
|
|
76
|
-
if (config.secretKey?.startsWith("dt_secret_") && typeof globalThis.window !== "undefined") {
|
|
77
|
-
console.error(
|
|
78
|
-
"[@deeptracer/core] WARNING: `secretKey` (dt_secret_...) detected in a browser bundle. This exposes your server key to end users. Use `publicKey` (dt_public_...) for client-side code."
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
76
|
}
|
|
82
77
|
inFlightRequests = /* @__PURE__ */ new Set();
|
|
83
78
|
/**
|
|
@@ -94,9 +89,8 @@ var Transport = class {
|
|
|
94
89
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
95
90
|
*/
|
|
96
91
|
warnedLabels = /* @__PURE__ */ new Set();
|
|
97
|
-
/** Resolve the auth key: prefer secretKey (server), fall back to publicKey (client). */
|
|
98
92
|
get authKey() {
|
|
99
|
-
return this.config.
|
|
93
|
+
return this.config.apiKey ?? "";
|
|
100
94
|
}
|
|
101
95
|
/**
|
|
102
96
|
* Send a request with automatic retry and exponential backoff.
|
|
@@ -311,16 +305,14 @@ var Logger = class _Logger {
|
|
|
311
305
|
this.contextName = contextName;
|
|
312
306
|
this.requestMeta = requestMeta;
|
|
313
307
|
this.state = state ?? createLoggerState(config.maxBreadcrumbs ?? 20);
|
|
314
|
-
const hasKey = !!
|
|
308
|
+
const hasKey = !!config.apiKey;
|
|
315
309
|
const hasEndpoint = !!config.endpoint;
|
|
316
310
|
if (!hasKey && !hasEndpoint) {
|
|
317
311
|
_originalConsole.warn(
|
|
318
|
-
"[@deeptracer/core] No API key or endpoint configured. Running in local-only mode (logging methods work, but events are not sent). Set
|
|
312
|
+
"[@deeptracer/core] No API key or endpoint configured. Running in local-only mode (logging methods work, but events are not sent). Set DEEPTRACER_KEY and DEEPTRACER_ENDPOINT to enable."
|
|
319
313
|
);
|
|
320
314
|
} else if (!hasKey) {
|
|
321
|
-
_originalConsole.warn(
|
|
322
|
-
"[@deeptracer/core] No `secretKey` or `publicKey` provided. Events will not be sent."
|
|
323
|
-
);
|
|
315
|
+
_originalConsole.warn("[@deeptracer/core] No `apiKey` provided. Events will not be sent.");
|
|
324
316
|
} else if (!hasEndpoint) {
|
|
325
317
|
_originalConsole.warn("[@deeptracer/core] No `endpoint` provided. Events will not be sent.");
|
|
326
318
|
}
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as LoggerConfig, b as LogEntry, E as ErrorReport, f as SpanData } from './logger-
|
|
2
|
-
export { d as Logger, h as LoggerState, M as MiddlewareOptions, _ as _originalConsole, p as parseTraceparent } from './logger-
|
|
1
|
+
import { e as LoggerConfig, b as LogEntry, E as ErrorReport, f as SpanData } from './logger-BzzHo1HP.cjs';
|
|
2
|
+
export { d as Logger, h as LoggerState, M as MiddlewareOptions, _ as _originalConsole, p as parseTraceparent } from './logger-BzzHo1HP.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* HTTP transport for sending data to the DeepTracer ingestion API.
|
|
@@ -30,8 +30,7 @@ declare class Transport {
|
|
|
30
30
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
31
31
|
*/
|
|
32
32
|
private warnedLabels;
|
|
33
|
-
constructor(config: Pick<LoggerConfig, "endpoint" | "
|
|
34
|
-
/** Resolve the auth key: prefer secretKey (server), fall back to publicKey (client). */
|
|
33
|
+
constructor(config: Pick<LoggerConfig, "endpoint" | "apiKey" | "service" | "environment">);
|
|
35
34
|
private get authKey();
|
|
36
35
|
/**
|
|
37
36
|
* Send a request with automatic retry and exponential backoff.
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as LoggerConfig, b as LogEntry, E as ErrorReport, f as SpanData } from './logger-
|
|
2
|
-
export { d as Logger, h as LoggerState, M as MiddlewareOptions, _ as _originalConsole, p as parseTraceparent } from './logger-
|
|
1
|
+
import { e as LoggerConfig, b as LogEntry, E as ErrorReport, f as SpanData } from './logger-BzzHo1HP.js';
|
|
2
|
+
export { d as Logger, h as LoggerState, M as MiddlewareOptions, _ as _originalConsole, p as parseTraceparent } from './logger-BzzHo1HP.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* HTTP transport for sending data to the DeepTracer ingestion API.
|
|
@@ -30,8 +30,7 @@ declare class Transport {
|
|
|
30
30
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
31
31
|
*/
|
|
32
32
|
private warnedLabels;
|
|
33
|
-
constructor(config: Pick<LoggerConfig, "endpoint" | "
|
|
34
|
-
/** Resolve the auth key: prefer secretKey (server), fall back to publicKey (client). */
|
|
33
|
+
constructor(config: Pick<LoggerConfig, "endpoint" | "apiKey" | "service" | "environment">);
|
|
35
34
|
private get authKey();
|
|
36
35
|
/**
|
|
37
36
|
* Send a request with automatic retry and exponential backoff.
|
package/dist/internal.js
CHANGED
|
@@ -2,34 +2,22 @@
|
|
|
2
2
|
* Configuration for creating a DeepTracer logger instance.
|
|
3
3
|
*
|
|
4
4
|
* All fields are optional when environment variables are set.
|
|
5
|
-
* Server packages read `
|
|
5
|
+
* Server packages read `DEEPTRACER_KEY`, `DEEPTRACER_ENDPOINT`, etc.
|
|
6
6
|
* Client packages read `NEXT_PUBLIC_DEEPTRACER_KEY`, `NEXT_PUBLIC_DEEPTRACER_ENDPOINT`, etc.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* Server (Node.js / Next.js instrumentation):
|
|
10
9
|
* ```ts
|
|
11
10
|
* const config: LoggerConfig = {
|
|
12
|
-
*
|
|
11
|
+
* apiKey: "dt_xxx",
|
|
13
12
|
* endpoint: "https://deeptracer.example.com",
|
|
14
13
|
* service: "api",
|
|
15
14
|
* environment: "production",
|
|
16
15
|
* }
|
|
17
16
|
* ```
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* Client (browser / React):
|
|
21
|
-
* ```ts
|
|
22
|
-
* const config: LoggerConfig = {
|
|
23
|
-
* publicKey: "dt_public_xxx",
|
|
24
|
-
* endpoint: "https://deeptracer.example.com",
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
17
|
*/
|
|
28
18
|
interface LoggerConfig {
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
/** Client-side API key (prefix: `dt_public_`). Safe for browser bundles. */
|
|
32
|
-
publicKey?: string;
|
|
19
|
+
/** DeepTracer API key (prefix: `dt_`). Set via `DEEPTRACER_KEY` or `NEXT_PUBLIC_DEEPTRACER_KEY` env var. */
|
|
20
|
+
apiKey?: string;
|
|
33
21
|
/** Service name (e.g., "api", "worker", "web"). Default varies by package. */
|
|
34
22
|
service?: string;
|
|
35
23
|
/** Deployment environment (any string). Default: `NODE_ENV` or `"production"` */
|
|
@@ -274,7 +262,7 @@ declare const _originalConsole: {
|
|
|
274
262
|
* import { createLogger } from "@deeptracer/core"
|
|
275
263
|
*
|
|
276
264
|
* const logger = createLogger({
|
|
277
|
-
*
|
|
265
|
+
* apiKey: "dt_xxx",
|
|
278
266
|
* endpoint: "https://deeptracer.example.com",
|
|
279
267
|
* service: "api",
|
|
280
268
|
* environment: "production",
|
|
@@ -2,34 +2,22 @@
|
|
|
2
2
|
* Configuration for creating a DeepTracer logger instance.
|
|
3
3
|
*
|
|
4
4
|
* All fields are optional when environment variables are set.
|
|
5
|
-
* Server packages read `
|
|
5
|
+
* Server packages read `DEEPTRACER_KEY`, `DEEPTRACER_ENDPOINT`, etc.
|
|
6
6
|
* Client packages read `NEXT_PUBLIC_DEEPTRACER_KEY`, `NEXT_PUBLIC_DEEPTRACER_ENDPOINT`, etc.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* Server (Node.js / Next.js instrumentation):
|
|
10
9
|
* ```ts
|
|
11
10
|
* const config: LoggerConfig = {
|
|
12
|
-
*
|
|
11
|
+
* apiKey: "dt_xxx",
|
|
13
12
|
* endpoint: "https://deeptracer.example.com",
|
|
14
13
|
* service: "api",
|
|
15
14
|
* environment: "production",
|
|
16
15
|
* }
|
|
17
16
|
* ```
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* Client (browser / React):
|
|
21
|
-
* ```ts
|
|
22
|
-
* const config: LoggerConfig = {
|
|
23
|
-
* publicKey: "dt_public_xxx",
|
|
24
|
-
* endpoint: "https://deeptracer.example.com",
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
17
|
*/
|
|
28
18
|
interface LoggerConfig {
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
/** Client-side API key (prefix: `dt_public_`). Safe for browser bundles. */
|
|
32
|
-
publicKey?: string;
|
|
19
|
+
/** DeepTracer API key (prefix: `dt_`). Set via `DEEPTRACER_KEY` or `NEXT_PUBLIC_DEEPTRACER_KEY` env var. */
|
|
20
|
+
apiKey?: string;
|
|
33
21
|
/** Service name (e.g., "api", "worker", "web"). Default varies by package. */
|
|
34
22
|
service?: string;
|
|
35
23
|
/** Deployment environment (any string). Default: `NODE_ENV` or `"production"` */
|
|
@@ -274,7 +262,7 @@ declare const _originalConsole: {
|
|
|
274
262
|
* import { createLogger } from "@deeptracer/core"
|
|
275
263
|
*
|
|
276
264
|
* const logger = createLogger({
|
|
277
|
-
*
|
|
265
|
+
* apiKey: "dt_xxx",
|
|
278
266
|
* endpoint: "https://deeptracer.example.com",
|
|
279
267
|
* service: "api",
|
|
280
268
|
* environment: "production",
|