@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
|
@@ -19,6 +19,8 @@ export declare class AsyncStore implements Types.HoneybadgerStore {
|
|
|
19
19
|
getContents(key?: keyof Types.StoreContents): any;
|
|
20
20
|
available(): boolean;
|
|
21
21
|
setContext(context: Record<string, unknown>): void;
|
|
22
|
+
setEventContext(eventContext: Record<string, unknown>): void;
|
|
23
|
+
clearEventContext(): void;
|
|
22
24
|
addBreadcrumb(breadcrumb: any): void;
|
|
23
25
|
clear(): void;
|
|
24
26
|
run<R>(callback: () => R, request?: Record<symbol, unknown>): R;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FastifyPluginCallback } from 'fastify';
|
|
2
|
+
import { Client } from '@honeybadger-io/core';
|
|
3
|
+
type ServerClient = Client & {
|
|
4
|
+
withRequest<R>(request: Record<symbol, unknown>, handler: (...args: never[]) => R, onError?: (...args: unknown[]) => unknown): R | void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Returns a Fastify plugin bound to the given Honeybadger client.
|
|
8
|
+
*
|
|
9
|
+
* Exposed as a factory (rather than a method on the singleton) so the
|
|
10
|
+
* framework-specific code stays off the client API:
|
|
11
|
+
*
|
|
12
|
+
* const { fastifyPlugin } = require('@honeybadger-io/js/dist/server/fastify')
|
|
13
|
+
* fastify.register(fastifyPlugin(Honeybadger))
|
|
14
|
+
*
|
|
15
|
+
* Requires the `fastify-plugin` package (declared as an optional peer
|
|
16
|
+
* dependency of this package) — the factory throws with install instructions
|
|
17
|
+
* when it cannot be resolved. The returned plugin is wrapped with
|
|
18
|
+
* `fastify-plugin`, so its hooks apply to the calling context rather than
|
|
19
|
+
* being encapsulated.
|
|
20
|
+
*
|
|
21
|
+
* The plugin runs every request inside `client.withRequest(req, ...)`, seeding
|
|
22
|
+
* `request_id` / `correlation_id` on the event context. When
|
|
23
|
+
* `insights.enabled` and `insights.http` are both true it also emits a
|
|
24
|
+
* `request.handled` event per request with method, path, route, status and
|
|
25
|
+
* duration.
|
|
26
|
+
*
|
|
27
|
+
* Supports Fastify 4+.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fastifyPlugin(client: ServerClient): FastifyPluginCallback;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=fastify.d.ts.map
|