@deeptracer/core 0.6.4 → 0.7.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/{chunk-QAJHHVX4.js → chunk-POYXPAC5.js} +2 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +2 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{logger-DyJENLNA.d.cts → logger-DnaUqfFI.d.cts} +23 -1
- package/dist/{logger-DyJENLNA.d.ts → logger-DnaUqfFI.d.ts} +23 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = "0.
|
|
2
|
+
var SDK_VERSION = "0.7.0";
|
|
3
3
|
var SDK_NAME = "core";
|
|
4
4
|
|
|
5
5
|
// src/transport.ts
|
|
@@ -99,6 +99,7 @@ var Transport = class {
|
|
|
99
99
|
track(promise) {
|
|
100
100
|
this.inFlightRequests.add(promise);
|
|
101
101
|
promise.finally(() => this.inFlightRequests.delete(promise));
|
|
102
|
+
this.config.waitUntil?.(promise);
|
|
102
103
|
}
|
|
103
104
|
async sendLogs(logs) {
|
|
104
105
|
const p = this.sendWithRetry(
|
package/dist/index.cjs
CHANGED
|
@@ -64,7 +64,7 @@ var Batcher = class {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
// src/version.ts
|
|
67
|
-
var SDK_VERSION = "0.
|
|
67
|
+
var SDK_VERSION = "0.7.0";
|
|
68
68
|
var SDK_NAME = "core";
|
|
69
69
|
|
|
70
70
|
// src/transport.ts
|
|
@@ -164,6 +164,7 @@ var Transport = class {
|
|
|
164
164
|
track(promise) {
|
|
165
165
|
this.inFlightRequests.add(promise);
|
|
166
166
|
promise.finally(() => this.inFlightRequests.delete(promise));
|
|
167
|
+
this.config.waitUntil?.(promise);
|
|
167
168
|
}
|
|
168
169
|
async sendLogs(logs) {
|
|
169
170
|
const p = this.sendWithRetry(
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as Logger } from './logger-
|
|
2
|
-
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, b as LLMUsageReport, c as LogEntry, d as LogLevel, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-
|
|
1
|
+
import { L as Logger } from './logger-DnaUqfFI.cjs';
|
|
2
|
+
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, b as LLMUsageReport, c as LogEntry, d as LogLevel, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-DnaUqfFI.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A Logger-compatible object where every method is a silent no-op.
|
|
@@ -18,7 +18,7 @@ export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveS
|
|
|
18
18
|
declare const noopLogger: Logger;
|
|
19
19
|
|
|
20
20
|
/** SDK version. Update on each release. */
|
|
21
|
-
declare const SDK_VERSION = "0.
|
|
21
|
+
declare const SDK_VERSION = "0.7.0";
|
|
22
22
|
declare const SDK_NAME = "core";
|
|
23
23
|
|
|
24
24
|
export { Logger, SDK_NAME, SDK_VERSION, noopLogger };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as Logger } from './logger-
|
|
2
|
-
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, b as LLMUsageReport, c as LogEntry, d as LogLevel, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-
|
|
1
|
+
import { L as Logger } from './logger-DnaUqfFI.js';
|
|
2
|
+
export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveSpan, b as LLMUsageReport, c as LogEntry, d as LogLevel, e as LoggerConfig, M as MiddlewareOptions, S as Span, f as SpanData, U as User, g as createLogger } from './logger-DnaUqfFI.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A Logger-compatible object where every method is a silent no-op.
|
|
@@ -18,7 +18,7 @@ export { B as BeforeSendEvent, a as Breadcrumb, E as ErrorReport, I as InactiveS
|
|
|
18
18
|
declare const noopLogger: Logger;
|
|
19
19
|
|
|
20
20
|
/** SDK version. Update on each release. */
|
|
21
|
-
declare const SDK_VERSION = "0.
|
|
21
|
+
declare const SDK_VERSION = "0.7.0";
|
|
22
22
|
declare const SDK_NAME = "core";
|
|
23
23
|
|
|
24
24
|
export { Logger, SDK_NAME, SDK_VERSION, noopLogger };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -64,7 +64,7 @@ var Batcher = class {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
// src/version.ts
|
|
67
|
-
var SDK_VERSION = "0.
|
|
67
|
+
var SDK_VERSION = "0.7.0";
|
|
68
68
|
var SDK_NAME = "core";
|
|
69
69
|
|
|
70
70
|
// src/transport.ts
|
|
@@ -164,6 +164,7 @@ var Transport = class {
|
|
|
164
164
|
track(promise) {
|
|
165
165
|
this.inFlightRequests.add(promise);
|
|
166
166
|
promise.finally(() => this.inFlightRequests.delete(promise));
|
|
167
|
+
this.config.waitUntil?.(promise);
|
|
167
168
|
}
|
|
168
169
|
async sendLogs(logs) {
|
|
169
170
|
const p = this.sendWithRetry(
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { L as Logger, e as LoggerConfig, h as LoggerState, M as MiddlewareOptions, T as Transport, _ as _originalConsole, p as parseTraceparent } from './logger-
|
|
1
|
+
export { L as Logger, e as LoggerConfig, h as LoggerState, M as MiddlewareOptions, T as Transport, _ as _originalConsole, p as parseTraceparent } from './logger-DnaUqfFI.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Parse console.log/info/warn/error arguments into a structured `{ message, metadata }` pair.
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { L as Logger, e as LoggerConfig, h as LoggerState, M as MiddlewareOptions, T as Transport, _ as _originalConsole, p as parseTraceparent } from './logger-
|
|
1
|
+
export { L as Logger, e as LoggerConfig, h as LoggerState, M as MiddlewareOptions, T as Transport, _ as _originalConsole, p as parseTraceparent } from './logger-DnaUqfFI.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Parse console.log/info/warn/error arguments into a structured `{ message, metadata }` pair.
|
package/dist/internal.js
CHANGED
|
@@ -63,6 +63,28 @@ interface LoggerConfig {
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
beforeSend?: (event: BeforeSendEvent) => BeforeSendEvent | null;
|
|
66
|
+
/**
|
|
67
|
+
* Called with each outgoing HTTP request promise when the transport sends data.
|
|
68
|
+
* Use this to keep a serverless function alive until all in-flight requests
|
|
69
|
+
* complete — even for logs written after the HTTP response has been returned
|
|
70
|
+
* (e.g., from Better Auth background task callbacks or other post-response work).
|
|
71
|
+
*
|
|
72
|
+
* On Vercel this is wired up automatically by `@deeptracer/nextjs`.
|
|
73
|
+
* On Cloudflare Workers, pass `ctx.waitUntil.bind(ctx)` when creating the logger.
|
|
74
|
+
* On persistent servers (Railway, Fly, Docker) you don't need this — the process
|
|
75
|
+
* stays alive and the timer-based flush handles it.
|
|
76
|
+
*
|
|
77
|
+
* @example Cloudflare Workers
|
|
78
|
+
* ```ts
|
|
79
|
+
* export default {
|
|
80
|
+
* async fetch(request, env, ctx) {
|
|
81
|
+
* const logger = createLogger({ waitUntil: ctx.waitUntil.bind(ctx), ... })
|
|
82
|
+
* // logs are now kept alive past the response
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
66
88
|
}
|
|
67
89
|
/** Log severity level */
|
|
68
90
|
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
@@ -254,7 +276,7 @@ declare class Transport {
|
|
|
254
276
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
255
277
|
*/
|
|
256
278
|
private warnedLabels;
|
|
257
|
-
constructor(config: Pick<LoggerConfig, "endpoint" | "apiKey" | "service" | "environment">);
|
|
279
|
+
constructor(config: Pick<LoggerConfig, "endpoint" | "apiKey" | "service" | "environment" | "waitUntil">);
|
|
258
280
|
private get authKey();
|
|
259
281
|
/**
|
|
260
282
|
* Send a request with automatic retry and exponential backoff.
|
|
@@ -63,6 +63,28 @@ interface LoggerConfig {
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
beforeSend?: (event: BeforeSendEvent) => BeforeSendEvent | null;
|
|
66
|
+
/**
|
|
67
|
+
* Called with each outgoing HTTP request promise when the transport sends data.
|
|
68
|
+
* Use this to keep a serverless function alive until all in-flight requests
|
|
69
|
+
* complete — even for logs written after the HTTP response has been returned
|
|
70
|
+
* (e.g., from Better Auth background task callbacks or other post-response work).
|
|
71
|
+
*
|
|
72
|
+
* On Vercel this is wired up automatically by `@deeptracer/nextjs`.
|
|
73
|
+
* On Cloudflare Workers, pass `ctx.waitUntil.bind(ctx)` when creating the logger.
|
|
74
|
+
* On persistent servers (Railway, Fly, Docker) you don't need this — the process
|
|
75
|
+
* stays alive and the timer-based flush handles it.
|
|
76
|
+
*
|
|
77
|
+
* @example Cloudflare Workers
|
|
78
|
+
* ```ts
|
|
79
|
+
* export default {
|
|
80
|
+
* async fetch(request, env, ctx) {
|
|
81
|
+
* const logger = createLogger({ waitUntil: ctx.waitUntil.bind(ctx), ... })
|
|
82
|
+
* // logs are now kept alive past the response
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
66
88
|
}
|
|
67
89
|
/** Log severity level */
|
|
68
90
|
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
@@ -254,7 +276,7 @@ declare class Transport {
|
|
|
254
276
|
* (e.g., when the ingestion endpoint is unreachable during development).
|
|
255
277
|
*/
|
|
256
278
|
private warnedLabels;
|
|
257
|
-
constructor(config: Pick<LoggerConfig, "endpoint" | "apiKey" | "service" | "environment">);
|
|
279
|
+
constructor(config: Pick<LoggerConfig, "endpoint" | "apiKey" | "service" | "environment" | "waitUntil">);
|
|
258
280
|
private get authKey();
|
|
259
281
|
/**
|
|
260
282
|
* Send a request with automatic retry and exponential backoff.
|