@honeybadger-io/js 3.2.7 → 4.0.0-beta.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.js +193 -80
- 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/browser/types/browser/util.d.ts +1 -1
- package/dist/browser/types/core/client.d.ts +9 -1
- package/dist/browser/types/core/error.d.ts +3 -0
- package/dist/browser/types/core/types.d.ts +5 -4
- package/dist/browser/types/core/util.d.ts +4 -2
- package/dist/browser/types/server/aws_lambda.d.ts +9 -0
- package/dist/browser/types/server/integrations/uncaught_exception.d.ts +2 -0
- package/dist/browser/types/server/integrations/unhandled_rejection.d.ts +2 -0
- package/dist/browser/types/server/middleware.d.ts +4 -0
- package/dist/browser/types/server/util.d.ts +9 -0
- package/dist/browser/types/server.d.ts +13 -0
- package/dist/server/honeybadger.d.ts +2 -1
- package/dist/server/honeybadger.js +313 -100
- package/dist/server/types/browser/integrations/breadcrumbs.d.ts +2 -0
- package/dist/server/types/browser/integrations/event_listeners.d.ts +2 -0
- package/dist/server/types/browser/integrations/onerror.d.ts +3 -0
- package/dist/server/types/browser/integrations/onunhandledrejection.d.ts +2 -0
- package/dist/server/types/browser/integrations/timers.d.ts +2 -0
- package/dist/server/types/browser/util.d.ts +18 -0
- package/dist/server/types/browser.d.ts +15 -0
- package/dist/server/types/core/client.d.ts +9 -1
- package/dist/server/types/core/error.d.ts +3 -0
- package/dist/server/types/core/types.d.ts +5 -4
- package/dist/server/types/core/util.d.ts +4 -2
- package/dist/server/types/server/aws_lambda.d.ts +9 -0
- package/dist/server/types/server/middleware.d.ts +3 -5
- package/dist/server/types/server/util.d.ts +7 -0
- package/dist/server/types/server.d.ts +2 -1
- package/honeybadger.d.ts +2 -1
- package/package.json +23 -21
|
@@ -11,6 +11,14 @@ export default class Client {
|
|
|
11
11
|
setContext(context: Record<string, unknown>): Client;
|
|
12
12
|
resetContext(context?: Record<string, unknown>): Client;
|
|
13
13
|
clear(): Client;
|
|
14
|
-
notify(
|
|
14
|
+
notify(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.
|
|
17
|
+
* Implemented using the {@link afterNotify} hook.
|
|
18
|
+
* Rejects if for any reason the report failed to be reported.
|
|
19
|
+
* Useful in serverless environments (AWS Lambda).
|
|
20
|
+
*/
|
|
21
|
+
notifyAsync(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Promise<void>;
|
|
22
|
+
protected makeNotice(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Notice | null;
|
|
15
23
|
addBreadcrumb(message: string, opts?: Record<string, unknown>): Client;
|
|
16
24
|
}
|
|
@@ -16,7 +16,6 @@ export interface Config {
|
|
|
16
16
|
component?: string;
|
|
17
17
|
action?: string;
|
|
18
18
|
revision?: string;
|
|
19
|
-
disabled: boolean;
|
|
20
19
|
debug: boolean;
|
|
21
20
|
reportData: boolean;
|
|
22
21
|
breadcrumbsEnabled: boolean | {
|
|
@@ -33,13 +32,13 @@ export interface Config {
|
|
|
33
32
|
enableUnhandledRejection: boolean;
|
|
34
33
|
filters: string[];
|
|
35
34
|
__plugins: Plugin[];
|
|
36
|
-
tags:
|
|
35
|
+
tags: unknown;
|
|
37
36
|
}
|
|
38
37
|
export interface BeforeNotifyHandler {
|
|
39
|
-
(notice
|
|
38
|
+
(notice?: Notice): boolean | void;
|
|
40
39
|
}
|
|
41
40
|
export interface AfterNotifyHandler {
|
|
42
|
-
(error: any, notice
|
|
41
|
+
(error: any, notice?: Notice): boolean | void;
|
|
43
42
|
}
|
|
44
43
|
export interface Plugin {
|
|
45
44
|
load(client: Client): void;
|
|
@@ -67,6 +66,7 @@ export interface Notice {
|
|
|
67
66
|
details: Record<string, Record<string, unknown>>;
|
|
68
67
|
__breadcrumbs: BreadcrumbRecord[];
|
|
69
68
|
afterNotify?: AfterNotifyHandler;
|
|
69
|
+
[key: string]: unknown;
|
|
70
70
|
}
|
|
71
71
|
export declare type Noticeable = string | Error | Partial<Notice>;
|
|
72
72
|
export interface BacktraceFrame {
|
|
@@ -74,6 +74,7 @@ export interface BacktraceFrame {
|
|
|
74
74
|
method: string;
|
|
75
75
|
number: number;
|
|
76
76
|
column: number;
|
|
77
|
+
source?: Record<string, string>;
|
|
77
78
|
}
|
|
78
79
|
export interface BreadcrumbRecord {
|
|
79
80
|
category: string;
|
|
@@ -5,8 +5,9 @@ export declare function mergeNotice(notice1: Partial<Notice>, notice2: Partial<N
|
|
|
5
5
|
export declare function objectIsEmpty(obj: any): boolean;
|
|
6
6
|
export declare function objectIsExtensible(obj: any): boolean;
|
|
7
7
|
export declare function makeBacktrace(stack: string, shift?: number): BacktraceFrame[];
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
8
|
+
export declare function getSourceForBacktrace(backtrace: BacktraceFrame[], getSourceFileHandler: (path: string, cb: (fileContent: string) => void) => void, cb: (sourcePerTrace: Record<string, string>[]) => void): void;
|
|
9
|
+
export declare function runBeforeNotifyHandlers(notice: Notice | null, handlers: BeforeNotifyHandler[]): boolean;
|
|
10
|
+
export declare function runAfterNotifyHandlers(notice: Notice | null, handlers: AfterNotifyHandler[], error?: Error): boolean;
|
|
10
11
|
export declare function newObject<T>(obj: T): T | Record<string, unknown>;
|
|
11
12
|
export declare function sanitize(obj: any, maxDepth?: number): any;
|
|
12
13
|
export declare function logger(client: Client): Logger;
|
|
@@ -27,3 +28,4 @@ export declare function generateStackTrace(): string;
|
|
|
27
28
|
export declare function filter(obj: Record<string, unknown>, filters: string[]): Record<string, unknown>;
|
|
28
29
|
export declare function filterUrl(url: string, filters: string[]): string;
|
|
29
30
|
export declare function formatCGIData(vars: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
31
|
+
export declare function clone<T>(obj: T): T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Handler, Callback, Context } from 'aws-lambda';
|
|
2
|
+
export declare type SyncHandler<TEvent = any, TResult = any> = (event: TEvent, context: Context, callback: Callback<TResult>) => void;
|
|
3
|
+
export declare type AsyncHandler<TEvent = any, TResult = any> = (event: TEvent, context: Context) => Promise<TResult>;
|
|
4
|
+
export declare function lambdaHandler<TEvent = any, TResult = any>(handler: Handler<TEvent, TResult>): Handler<TEvent, TResult>;
|
|
5
|
+
/**
|
|
6
|
+
* Removes AWS Lambda default listener that
|
|
7
|
+
* exits the process before letting us report to honeybadger.
|
|
8
|
+
*/
|
|
9
|
+
export declare function removeAwsDefaultUncaughtExceptionListener(): void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { NextFunction, Request, Response } from 'express';
|
|
2
|
-
|
|
3
|
-
declare function
|
|
4
|
-
declare
|
|
5
|
-
declare function lambdaHandler(handler: LambdaHandler): LambdaHandler;
|
|
6
|
-
export { errorHandler, requestHandler, lambdaHandler };
|
|
2
|
+
import { Noticeable } from '../core/types';
|
|
3
|
+
export declare function requestHandler(req: Request, res: Response, next: NextFunction): void;
|
|
4
|
+
export declare function errorHandler(err: Noticeable, req: Request, _res: Response, next: NextFunction): unknown;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export declare function fatallyLogAndExit(err: Error): never;
|
|
2
2
|
export declare function getStats(cb: (stats: Record<string, unknown>) => void): void;
|
|
3
|
+
/**
|
|
4
|
+
* Get source file if possible, used to build `notice.backtrace.source`
|
|
5
|
+
*
|
|
6
|
+
* @param path to source code
|
|
7
|
+
* @param cb callback with fileContent
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSourceFile(path: string, cb: (fileContent: string) => void): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Client from './core/client';
|
|
2
2
|
import { Config } from './core/types';
|
|
3
|
-
import { errorHandler, requestHandler
|
|
3
|
+
import { errorHandler, requestHandler } from './server/middleware';
|
|
4
|
+
import { lambdaHandler } from './server/aws_lambda';
|
|
4
5
|
declare class Honeybadger extends Client {
|
|
5
6
|
errorHandler: typeof errorHandler;
|
|
6
7
|
requestHandler: typeof requestHandler;
|
package/honeybadger.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
1
2
|
// Type definitions for honeybadger.js
|
|
2
3
|
// Project: https://github.com/honeybadger-io/honeybadger-js
|
|
3
4
|
import Server from './dist/server/types/server'
|
|
@@ -5,4 +6,4 @@ import Browser from './dist/browser/types/browser'
|
|
|
5
6
|
|
|
6
7
|
type Honeybadger = typeof Server & typeof Browser;
|
|
7
8
|
declare const Honeybadger: Honeybadger;
|
|
8
|
-
export = Honeybadger;
|
|
9
|
+
export = Honeybadger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/honeybadger-io/honeybadger-js",
|
|
6
6
|
"author": {
|
|
@@ -37,38 +37,40 @@
|
|
|
37
37
|
"test:integration:browserstack": "npm run test:integration",
|
|
38
38
|
"test:integration:headless": "HEADLESS=1 npm run test:integration",
|
|
39
39
|
"tsd": "npm run build && tsd",
|
|
40
|
+
"lint": "npx eslint .",
|
|
40
41
|
"build": "rollup -c && node ./scripts/copy-typedefs.js",
|
|
41
42
|
"release": "shipjs prepare"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@types/express": "^4.17.13",
|
|
45
45
|
"stacktrace-parser": "^0.1.10"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@rollup/plugin-node-resolve": "^13.0.
|
|
48
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
50
|
-
"@rollup/plugin-typescript": "^8.
|
|
51
|
-
"@types/
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"eslint
|
|
59
|
-
"eslint-plugin-
|
|
50
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
51
|
+
"@types/aws-lambda": "^8.10.89",
|
|
52
|
+
"@types/express": "^4.17.13",
|
|
53
|
+
"@types/jest": "^27.0.3",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
55
|
+
"@typescript-eslint/parser": "^5.6.0",
|
|
56
|
+
"axios": ">=0.24.0",
|
|
57
|
+
"concurrently": "^7.0.0",
|
|
58
|
+
"eslint": "^8.4.1",
|
|
59
|
+
"eslint-plugin-import": "^2.25.3",
|
|
60
|
+
"eslint-plugin-jest": "^26.0.0",
|
|
61
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
60
62
|
"express": "^4.17.1",
|
|
61
|
-
"jest": "^27.
|
|
62
|
-
"nock": "^13.1
|
|
63
|
-
"rollup": "^2.
|
|
63
|
+
"jest": "^27.4.4",
|
|
64
|
+
"nock": "^13.2.1",
|
|
65
|
+
"rollup": "^2.61.1",
|
|
64
66
|
"rollup-plugin-uglify": "^6.0.2",
|
|
65
|
-
"shipjs": "0.24.
|
|
66
|
-
"sinon": "^
|
|
67
|
+
"shipjs": "0.24.2",
|
|
68
|
+
"sinon": "^13.0.1",
|
|
67
69
|
"supertest": "^6.1.6",
|
|
68
|
-
"ts-jest": "^27.
|
|
69
|
-
"tsd": "^0.
|
|
70
|
+
"ts-jest": "^27.1.1",
|
|
71
|
+
"tsd": "^0.19.0",
|
|
70
72
|
"tslib": "^2.3.1",
|
|
71
|
-
"typescript": "^4.3
|
|
73
|
+
"typescript": "^4.5.3"
|
|
72
74
|
},
|
|
73
75
|
"readmeFilename": "README.md",
|
|
74
76
|
"files": [
|