@honeybadger-io/js 6.15.2 → 6.16.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/browser/honeybadger.ext.min.js +1 -1
- package/dist/browser/honeybadger.ext.min.js.map +1 -1
- package/dist/browser/honeybadger.js +355 -58
- package/dist/browser/honeybadger.js.map +1 -1
- package/dist/browser/honeybadger.min.js +1 -1
- package/dist/browser/honeybadger.min.js.map +1 -1
- package/dist/server/async_store.d.ts +2 -0
- package/dist/server/fastify.d.ts +31 -0
- package/dist/server/fastify.js +2149 -0
- package/dist/server/fastify.js.map +1 -0
- package/dist/server/honeybadger.js +707 -81
- package/dist/server/honeybadger.js.map +1 -1
- package/dist/server/instrumentation/http_event.d.ts +51 -0
- package/dist/server/integrations/shutdown_monitor.d.ts +2 -0
- package/dist/server/stacked_store.d.ts +2 -0
- package/package.json +19 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for HTTP-event instrumentation.
|
|
3
|
+
*
|
|
4
|
+
* Used by inbound (Express, Fastify, Lambda, Next.js) and — in a later PR —
|
|
5
|
+
* outbound (`http`, `https`, `fetch`) integrations.
|
|
6
|
+
*/
|
|
7
|
+
export type HeaderValue = string | string[] | undefined;
|
|
8
|
+
export type HeadersInput = Record<string, HeaderValue> | null | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Returns a unique-per-request id. Reads `x-request-id`, then `request-id`
|
|
11
|
+
* headers; falls back to a generated id when neither is present.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getOrCreateRequestId(headers: HeadersInput): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a correlation id that may span multiple requests in a logical trace.
|
|
16
|
+
* Reads `x-correlation-id`, then `x-amzn-trace-id`; falls back to the supplied
|
|
17
|
+
* `requestId` so callers always have both fields populated.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getOrCreateCorrelationId(headers: HeadersInput, requestId: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Convenience helper for framework integrations: read request/correlation ids
|
|
22
|
+
* from the request headers and return both. When no headers contain either
|
|
23
|
+
* value, both ids are generated and `requestId === correlationId`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function seedRequestEventContext(headers: HeadersInput): {
|
|
26
|
+
request_id: string;
|
|
27
|
+
correlation_id: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Starts a high-resolution timer.
|
|
31
|
+
*/
|
|
32
|
+
export declare function startTimer(): bigint;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the integer number of milliseconds elapsed since `start`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function durationMs(start: bigint): number;
|
|
37
|
+
export interface RequestEventInput {
|
|
38
|
+
method?: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
route?: string;
|
|
41
|
+
status?: number;
|
|
42
|
+
duration?: number;
|
|
43
|
+
extra?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds the per-request event payload. `request_id` and `correlation_id` are
|
|
47
|
+
* NOT added here — they live on `eventContext` and are merged onto every event
|
|
48
|
+
* by the client.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildRequestEventPayload(input: RequestEventInput): Record<string, unknown>;
|
|
51
|
+
//# sourceMappingURL=http_event.d.ts.map
|
|
@@ -5,9 +5,11 @@ export default class ShutdownMonitor {
|
|
|
5
5
|
protected __isReporting: boolean;
|
|
6
6
|
protected __client: typeof Client;
|
|
7
7
|
protected __listener: (signal: string) => void;
|
|
8
|
+
protected __beforeExitListener: () => void;
|
|
8
9
|
constructor();
|
|
9
10
|
setClient(client: typeof Client): void;
|
|
10
11
|
makeListener(): (signal: NodeJS.Signals) => Promise<void>;
|
|
12
|
+
makeBeforeExitListener(): () => Promise<void>;
|
|
11
13
|
maybeAddListener(): void;
|
|
12
14
|
maybeRemoveListener(): void;
|
|
13
15
|
hasOtherShutdownListeners(signal: NodeJS.Signals): boolean;
|
|
@@ -16,6 +16,8 @@ export declare class StackedStore implements Types.HoneybadgerStore {
|
|
|
16
16
|
available(): boolean;
|
|
17
17
|
getContents(key?: keyof Types.StoreContents): any;
|
|
18
18
|
setContext(context: any): void;
|
|
19
|
+
setEventContext(eventContext: any): void;
|
|
20
|
+
clearEventContext(): void;
|
|
19
21
|
addBreadcrumb(breadcrumb: any): void;
|
|
20
22
|
clear(): void;
|
|
21
23
|
run<R>(callback: () => R, request?: Record<symbol, unknown>): R;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/js",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js",
|
|
6
6
|
"author": {
|
|
@@ -52,10 +52,22 @@
|
|
|
52
52
|
"postpublish": "./scripts/release-cdn.sh"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@honeybadger-io/core": "^6.
|
|
55
|
+
"@honeybadger-io/core": "^6.11.0",
|
|
56
56
|
"@types/aws-lambda": "^8.10.89",
|
|
57
57
|
"@types/express": "^5.0.3"
|
|
58
58
|
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"fastify": ">=4",
|
|
61
|
+
"fastify-plugin": ">=4"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"fastify": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"fastify-plugin": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
59
71
|
"devDependencies": {
|
|
60
72
|
"@playwright/test": "1.51.0",
|
|
61
73
|
"@rollup/plugin-commonjs": "^22.0.1",
|
|
@@ -65,7 +77,11 @@
|
|
|
65
77
|
"@types/node": "^17.0.45",
|
|
66
78
|
"browserstack-local": "^1.5.5",
|
|
67
79
|
"express": "^5.1.0",
|
|
80
|
+
"fastify": "~4.23.2",
|
|
81
|
+
"fastify-plugin": "^4.5.1",
|
|
68
82
|
"jest": "^27.4.4",
|
|
83
|
+
"jest-environment-jsdom": "^27.5.1",
|
|
84
|
+
"jest-environment-node": "^27.5.1",
|
|
69
85
|
"jest-fetch-mock": "^3.0.3",
|
|
70
86
|
"nock": "^13.2.1",
|
|
71
87
|
"rollup": "^2.77.0",
|
|
@@ -83,5 +99,5 @@
|
|
|
83
99
|
"engines": {
|
|
84
100
|
"node": ">=14"
|
|
85
101
|
},
|
|
86
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "471dbce000d6f499b048cb612009fcfed41cdd91"
|
|
87
103
|
}
|