@honeybadger-io/js 4.0.5 → 4.1.2
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/README.md +13 -64
- package/dist/browser/honeybadger.d.ts +6 -6
- package/dist/browser/honeybadger.js +1791 -1694
- 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/integrations/breadcrumbs.d.ts +3 -0
- package/dist/browser/integrations/event_listeners.d.ts +3 -0
- package/dist/browser/integrations/onerror.d.ts +4 -0
- package/dist/browser/integrations/onunhandledrejection.d.ts +3 -0
- package/dist/browser/integrations/timers.d.ts +3 -0
- package/dist/browser/transport.d.ts +8 -0
- package/dist/browser/{types/browser/util.d.ts → util.d.ts} +1 -0
- package/dist/server/async_store.d.ts +6 -0
- package/dist/server/{types/server/aws_lambda.d.ts → aws_lambda.d.ts} +1 -1
- package/dist/server/honeybadger.d.ts +8 -8
- package/dist/server/honeybadger.js +632 -501
- package/dist/server/integrations/uncaught_exception.d.ts +3 -0
- package/dist/server/integrations/unhandled_rejection.d.ts +3 -0
- package/dist/server/middleware.d.ts +5 -0
- package/dist/server/transport.d.ts +10 -0
- package/dist/server/{types/server/util.d.ts → util.d.ts} +3 -2
- package/honeybadger.d.ts +2 -2
- package/package.json +27 -39
- package/dist/browser/types/browser/integrations/breadcrumbs.d.ts +0 -2
- package/dist/browser/types/browser/integrations/event_listeners.d.ts +0 -2
- package/dist/browser/types/browser/integrations/onerror.d.ts +0 -3
- package/dist/browser/types/browser/integrations/onunhandledrejection.d.ts +0 -2
- package/dist/browser/types/browser/integrations/timers.d.ts +0 -2
- package/dist/browser/types/browser/transport.d.ts +0 -7
- package/dist/browser/types/browser.d.ts +0 -12
- package/dist/browser/types/core/client.d.ts +0 -37
- package/dist/browser/types/core/store.d.ts +0 -7
- package/dist/browser/types/core/types.d.ts +0 -160
- package/dist/browser/types/core/util.d.ts +0 -32
- package/dist/browser/types/server/async_store.d.ts +0 -5
- package/dist/browser/types/server/aws_lambda.d.ts +0 -10
- package/dist/browser/types/server/integrations/uncaught_exception.d.ts +0 -2
- package/dist/browser/types/server/integrations/unhandled_rejection.d.ts +0 -2
- package/dist/browser/types/server/middleware.d.ts +0 -4
- package/dist/browser/types/server/transport.d.ts +0 -9
- package/dist/browser/types/server/util.d.ts +0 -9
- package/dist/browser/types/server.d.ts +0 -17
- package/dist/server/types/browser/integrations/breadcrumbs.d.ts +0 -2
- package/dist/server/types/browser/integrations/event_listeners.d.ts +0 -2
- package/dist/server/types/browser/integrations/onerror.d.ts +0 -3
- package/dist/server/types/browser/integrations/onunhandledrejection.d.ts +0 -2
- package/dist/server/types/browser/integrations/timers.d.ts +0 -2
- package/dist/server/types/browser/transport.d.ts +0 -7
- package/dist/server/types/browser/util.d.ts +0 -18
- package/dist/server/types/browser.d.ts +0 -12
- package/dist/server/types/core/client.d.ts +0 -37
- package/dist/server/types/core/store.d.ts +0 -7
- package/dist/server/types/core/types.d.ts +0 -160
- package/dist/server/types/core/util.d.ts +0 -32
- package/dist/server/types/server/async_store.d.ts +0 -5
- package/dist/server/types/server/integrations/uncaught_exception.d.ts +0 -2
- package/dist/server/types/server/integrations/unhandled_rejection.d.ts +0 -2
- package/dist/server/types/server/middleware.d.ts +0 -4
- package/dist/server/types/server/transport.d.ts +0 -9
- package/dist/server/types/server.d.ts +0 -17
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NextFunction, Request, Response } from 'express';
|
|
2
|
+
import { Types } from '@honeybadger-io/core';
|
|
3
|
+
export declare function requestHandler(req: Request, res: Response, next: NextFunction): void;
|
|
4
|
+
export declare function errorHandler(err: Types.Noticeable, req: Request, _res: Response, next: NextFunction): unknown;
|
|
5
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Types } from '@honeybadger-io/core';
|
|
2
|
+
export declare class ServerTransport implements Types.Transport {
|
|
3
|
+
send(options: Types.TransportOptions, payload?: Types.NoticeTransportPayload | undefined): Promise<{
|
|
4
|
+
statusCode: number;
|
|
5
|
+
body: string;
|
|
6
|
+
}>;
|
|
7
|
+
private isNoticePayload;
|
|
8
|
+
private appendMetadata;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Types } from '@honeybadger-io/core';
|
|
2
2
|
export declare function fatallyLogAndExit(err: Error): never;
|
|
3
|
-
export declare function getStats(): Promise<ProcessStats>;
|
|
3
|
+
export declare function getStats(): Promise<Types.ProcessStats>;
|
|
4
4
|
/**
|
|
5
5
|
* Get source file if possible, used to build `notice.backtrace.source`
|
|
6
6
|
*
|
|
7
7
|
* @param path to source code
|
|
8
8
|
*/
|
|
9
9
|
export declare function getSourceFile(path: string): Promise<string>;
|
|
10
|
+
//# sourceMappingURL=util.d.ts.map
|
package/honeybadger.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable import/no-unresolved */
|
|
2
2
|
// Type definitions for honeybadger.js
|
|
3
3
|
// Project: https://github.com/honeybadger-io/honeybadger-js
|
|
4
|
-
import Server from './dist/server/
|
|
5
|
-
import Browser from './dist/browser/
|
|
4
|
+
import Server from './dist/server/honeybadger'
|
|
5
|
+
import Browser from './dist/browser/honeybadger'
|
|
6
6
|
|
|
7
7
|
type Honeybadger = typeof Server & typeof Browser;
|
|
8
8
|
declare const Honeybadger: Honeybadger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/honeybadger-io/honeybadger-js",
|
|
6
6
|
"author": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"isomorphic",
|
|
20
20
|
"universal"
|
|
21
21
|
],
|
|
22
|
-
"main": "dist/server/honeybadger.js",
|
|
23
|
-
"browser": "dist/browser/honeybadger.js",
|
|
22
|
+
"main": "./dist/server/honeybadger.js",
|
|
23
|
+
"browser": "./dist/browser/honeybadger.js",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
26
|
"url": "git@github.com:honeybadger-io/honeybadger-js.git"
|
|
@@ -28,63 +28,51 @@
|
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/honeybadger-io/honeybadger-js/issues"
|
|
30
30
|
},
|
|
31
|
+
"types": "./honeybadger.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"./dist",
|
|
34
|
+
"./honeybadger.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"tsd": {
|
|
37
|
+
"compilerOptions": {
|
|
38
|
+
"strict": false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
31
41
|
"scripts": {
|
|
32
|
-
"
|
|
33
|
-
"test": "
|
|
42
|
+
"build": "tsc --build tsconfig.json && rollup -c && node ./scripts/copy-typedefs.js",
|
|
43
|
+
"test": "npm run test:browser && npm run test:server && npm run tsd",
|
|
34
44
|
"test:browser": "jest --env=jsdom --testPathPattern=\"test/unit/.*(?<![\\./]server)\\.test\\.(js|ts)\"",
|
|
35
45
|
"test:server": "jest --env=node --testPathPattern=\"test/unit/.*(?<![\\./]browser)\\.test\\.(js|ts)\"",
|
|
36
|
-
"test:integration": "
|
|
46
|
+
"test:integration": "test/integration/node_modules/karma/bin/karma start test/integration/karma.conf.js",
|
|
37
47
|
"test:integration:browserstack": "npm run test:integration",
|
|
38
48
|
"test:integration:headless": "HEADLESS=1 npm run test:integration",
|
|
39
|
-
"tsd": "
|
|
40
|
-
"
|
|
41
|
-
"build": "rollup -c && node ./scripts/copy-typedefs.js",
|
|
42
|
-
"release": "shipjs prepare"
|
|
49
|
+
"tsd": "tsd",
|
|
50
|
+
"postpublish": "./scripts/release-cdn.sh"
|
|
43
51
|
},
|
|
44
52
|
"dependencies": {
|
|
45
|
-
"
|
|
53
|
+
"@honeybadger-io/core": "^4.1.1",
|
|
54
|
+
"@types/aws-lambda": "^8.10.89"
|
|
46
55
|
},
|
|
47
56
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@commitlint/config-conventional": "^17.0.0",
|
|
57
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
50
58
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
51
59
|
"@rollup/plugin-replace": "^4.0.0",
|
|
52
|
-
"@rollup/plugin-typescript": "^8.3.3",
|
|
53
|
-
"@types/aws-lambda": "^8.10.89",
|
|
54
60
|
"@types/express": "^4.17.13",
|
|
55
61
|
"@types/jest": "^27.0.3",
|
|
56
|
-
"@types/node": "^
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
58
|
-
"@typescript-eslint/parser": "^5.6.0",
|
|
59
|
-
"axios": ">=0.24.0",
|
|
60
|
-
"concurrently": "^7.0.0",
|
|
61
|
-
"eslint": "^8.4.1",
|
|
62
|
-
"eslint-plugin-import": "^2.25.3",
|
|
63
|
-
"eslint-plugin-jest": "^26.0.0",
|
|
64
|
-
"eslint-plugin-promise": "^6.0.0",
|
|
62
|
+
"@types/node": "^17.0.45",
|
|
65
63
|
"express": "^4.17.1",
|
|
66
|
-
"husky": "^8.0.1",
|
|
67
64
|
"jest": "^27.4.4",
|
|
68
65
|
"nock": "^13.2.1",
|
|
69
|
-
"rollup": "^2.
|
|
66
|
+
"rollup": "^2.77.0",
|
|
70
67
|
"rollup-plugin-terser": "^7.0.2",
|
|
71
|
-
"shipjs": "0.24.4",
|
|
72
68
|
"sinon": "^14.0.0",
|
|
73
69
|
"supertest": "^6.1.6",
|
|
74
70
|
"ts-jest": "^27.1.5",
|
|
75
|
-
"tsd": "^0.
|
|
76
|
-
"tslib": "^2.3.1",
|
|
71
|
+
"tsd": "^0.22.0",
|
|
77
72
|
"typescript": "^4.5.3"
|
|
78
73
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
"dist",
|
|
82
|
-
"honeybadger.d.ts"
|
|
83
|
-
],
|
|
84
|
-
"tsd": {
|
|
85
|
-
"compilerOptions": {
|
|
86
|
-
"strict": false
|
|
87
|
-
}
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
88
76
|
},
|
|
89
|
-
"
|
|
77
|
+
"gitHead": "362837b27ee55eec6dc0a13633b93d2be0cccd44"
|
|
90
78
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Transport, TransportOptions, NoticeTransportPayload } from '../core/types';
|
|
2
|
-
export declare class BrowserTransport implements Transport {
|
|
3
|
-
send(options: TransportOptions, payload?: NoticeTransportPayload | undefined): Promise<{
|
|
4
|
-
statusCode: number;
|
|
5
|
-
body: string;
|
|
6
|
-
}>;
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Client from './core/client';
|
|
2
|
-
import { BrowserConfig } from './core/types';
|
|
3
|
-
declare class Honeybadger extends Client {
|
|
4
|
-
config: BrowserConfig;
|
|
5
|
-
constructor(opts?: Partial<BrowserConfig>);
|
|
6
|
-
configure(opts?: Partial<BrowserConfig>): this;
|
|
7
|
-
resetMaxErrors(): number;
|
|
8
|
-
factory(opts?: Partial<BrowserConfig>): this;
|
|
9
|
-
checkIn(_id: string): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: Honeybadger;
|
|
12
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Config, Logger, BeforeNotifyHandler, AfterNotifyHandler, Notice, Noticeable, HoneybadgerStore, BreadcrumbRecord, Transport, NoticeTransportPayload } from './types';
|
|
2
|
-
export default abstract class Client {
|
|
3
|
-
protected __pluginsExecuted: boolean;
|
|
4
|
-
protected __store: HoneybadgerStore<{
|
|
5
|
-
context: Record<string, unknown>;
|
|
6
|
-
breadcrumbs: BreadcrumbRecord[];
|
|
7
|
-
}>;
|
|
8
|
-
protected __beforeNotifyHandlers: BeforeNotifyHandler[];
|
|
9
|
-
protected __afterNotifyHandlers: AfterNotifyHandler[];
|
|
10
|
-
protected __getSourceFileHandler: (path: string) => Promise<string>;
|
|
11
|
-
protected readonly __transport: Transport;
|
|
12
|
-
config: Config;
|
|
13
|
-
logger: Logger;
|
|
14
|
-
protected constructor(opts: Partial<Config>, transport: Transport);
|
|
15
|
-
protected abstract factory(opts: Partial<Config>): this;
|
|
16
|
-
protected abstract checkIn(id: string): Promise<void>;
|
|
17
|
-
getVersion(): string;
|
|
18
|
-
configure(opts?: Partial<Config>): this;
|
|
19
|
-
beforeNotify(handler: BeforeNotifyHandler): Client;
|
|
20
|
-
afterNotify(handler: AfterNotifyHandler): Client;
|
|
21
|
-
setContext(context: Record<string, unknown>): Client;
|
|
22
|
-
resetContext(context?: Record<string, unknown>): Client;
|
|
23
|
-
clear(): Client;
|
|
24
|
-
notify(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.
|
|
27
|
-
* Implemented using the {@link afterNotify} hook.
|
|
28
|
-
* Rejects if for any reason the report failed to be reported.
|
|
29
|
-
* Useful in serverless environments (AWS Lambda).
|
|
30
|
-
*/
|
|
31
|
-
notifyAsync(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Promise<void>;
|
|
32
|
-
protected makeNotice(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Notice | null;
|
|
33
|
-
addBreadcrumb(message: string, opts?: Record<string, unknown>): Client;
|
|
34
|
-
protected __developmentMode(): boolean;
|
|
35
|
-
protected __buildPayload(notice: Notice): NoticeTransportPayload;
|
|
36
|
-
protected __constructTags(tags: unknown): Array<string>;
|
|
37
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HoneybadgerStore } from './types';
|
|
2
|
-
export declare class GlobalStore<T> implements HoneybadgerStore<T> {
|
|
3
|
-
private store;
|
|
4
|
-
constructor(store: T);
|
|
5
|
-
getStore(): T;
|
|
6
|
-
run<R, TArgs extends never[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
|
7
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import Client from './client';
|
|
3
|
-
/** @ts-ignore */
|
|
4
|
-
import type { AsyncLocalStorage } from 'async_hooks';
|
|
5
|
-
export interface Logger {
|
|
6
|
-
log(...args: unknown[]): unknown;
|
|
7
|
-
info(...args: unknown[]): unknown;
|
|
8
|
-
debug(...args: unknown[]): unknown;
|
|
9
|
-
warn(...args: unknown[]): unknown;
|
|
10
|
-
error(...args: unknown[]): unknown;
|
|
11
|
-
}
|
|
12
|
-
export interface Config {
|
|
13
|
-
apiKey?: string;
|
|
14
|
-
endpoint: string;
|
|
15
|
-
developmentEnvironments: string[];
|
|
16
|
-
environment?: string;
|
|
17
|
-
hostname?: string;
|
|
18
|
-
projectRoot?: string;
|
|
19
|
-
component?: string;
|
|
20
|
-
action?: string;
|
|
21
|
-
revision?: string;
|
|
22
|
-
debug: boolean;
|
|
23
|
-
reportData: boolean;
|
|
24
|
-
breadcrumbsEnabled: boolean | {
|
|
25
|
-
dom?: boolean;
|
|
26
|
-
network?: boolean;
|
|
27
|
-
navigation?: boolean;
|
|
28
|
-
console?: boolean;
|
|
29
|
-
};
|
|
30
|
-
maxBreadcrumbs: number;
|
|
31
|
-
maxObjectDepth: number;
|
|
32
|
-
logger: Logger;
|
|
33
|
-
enableUncaught: boolean;
|
|
34
|
-
afterUncaught: (err: Error) => void;
|
|
35
|
-
enableUnhandledRejection: boolean;
|
|
36
|
-
filters: string[];
|
|
37
|
-
__plugins: Plugin[];
|
|
38
|
-
tags: unknown;
|
|
39
|
-
}
|
|
40
|
-
export interface ServerlessConfig extends Config {
|
|
41
|
-
reportTimeoutWarning: boolean;
|
|
42
|
-
timeoutWarningThresholdMs: number;
|
|
43
|
-
}
|
|
44
|
-
export interface BeforeNotifyHandler {
|
|
45
|
-
(notice?: Notice): boolean | void;
|
|
46
|
-
}
|
|
47
|
-
export interface AfterNotifyHandler {
|
|
48
|
-
(error: any, notice?: Notice): boolean | void;
|
|
49
|
-
}
|
|
50
|
-
export interface Plugin {
|
|
51
|
-
load(client: Client): void;
|
|
52
|
-
}
|
|
53
|
-
export interface Notice {
|
|
54
|
-
id: string | undefined;
|
|
55
|
-
name: string;
|
|
56
|
-
message: string;
|
|
57
|
-
stack: string;
|
|
58
|
-
backtrace: BacktraceFrame[];
|
|
59
|
-
fingerprint?: string | undefined;
|
|
60
|
-
url?: string | undefined;
|
|
61
|
-
component?: string | undefined;
|
|
62
|
-
action?: string | undefined;
|
|
63
|
-
context: Record<string, unknown>;
|
|
64
|
-
cgiData: Record<string, unknown>;
|
|
65
|
-
params: Record<string, unknown>;
|
|
66
|
-
session: Record<string, unknown>;
|
|
67
|
-
headers: Record<string, unknown>;
|
|
68
|
-
cookies: Record<string, unknown> | string;
|
|
69
|
-
projectRoot?: string | undefined;
|
|
70
|
-
environment?: string | undefined;
|
|
71
|
-
revision?: string | undefined;
|
|
72
|
-
tags: string | string[];
|
|
73
|
-
details: Record<string, Record<string, unknown>>;
|
|
74
|
-
__breadcrumbs: BreadcrumbRecord[];
|
|
75
|
-
afterNotify?: AfterNotifyHandler;
|
|
76
|
-
[key: string]: unknown;
|
|
77
|
-
}
|
|
78
|
-
export interface BrowserConfig extends Config {
|
|
79
|
-
async: boolean;
|
|
80
|
-
maxErrors: number;
|
|
81
|
-
}
|
|
82
|
-
export declare type Noticeable = string | Error | Partial<Notice>;
|
|
83
|
-
export interface BacktraceFrame {
|
|
84
|
-
file: string;
|
|
85
|
-
method: string;
|
|
86
|
-
number: number;
|
|
87
|
-
column: number;
|
|
88
|
-
source?: Record<string, string>;
|
|
89
|
-
}
|
|
90
|
-
export interface BreadcrumbRecord {
|
|
91
|
-
category: string;
|
|
92
|
-
message: string;
|
|
93
|
-
metadata: Record<string, unknown>;
|
|
94
|
-
timestamp: string;
|
|
95
|
-
}
|
|
96
|
-
export interface CGIData {
|
|
97
|
-
HTTP_USER_AGENT: string | undefined;
|
|
98
|
-
HTTP_REFERER: string | undefined;
|
|
99
|
-
HTTP_COOKIE: string | undefined;
|
|
100
|
-
[x: string]: unknown;
|
|
101
|
-
}
|
|
102
|
-
export declare type ProcessStats = {
|
|
103
|
-
load: {
|
|
104
|
-
one: number;
|
|
105
|
-
five: number;
|
|
106
|
-
fifteen: number;
|
|
107
|
-
};
|
|
108
|
-
mem: {
|
|
109
|
-
total?: number;
|
|
110
|
-
free?: number;
|
|
111
|
-
buffers?: number;
|
|
112
|
-
cached?: number;
|
|
113
|
-
free_total?: number;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
export declare type TransportOptions = {
|
|
117
|
-
method: 'GET' | 'POST';
|
|
118
|
-
headers?: Record<string, number | string | string[] | undefined>;
|
|
119
|
-
endpoint: string;
|
|
120
|
-
maxObjectDepth?: number;
|
|
121
|
-
logger: Logger;
|
|
122
|
-
async?: boolean;
|
|
123
|
-
};
|
|
124
|
-
export declare type NoticeTransportPayload = {
|
|
125
|
-
notifier: {
|
|
126
|
-
name: string;
|
|
127
|
-
url: string;
|
|
128
|
-
version: string;
|
|
129
|
-
};
|
|
130
|
-
breadcrumbs: {
|
|
131
|
-
enabled: boolean;
|
|
132
|
-
trail: BreadcrumbRecord[];
|
|
133
|
-
};
|
|
134
|
-
error: Pick<Notice, 'message' | 'backtrace' | 'fingerprint' | 'tags'> & {
|
|
135
|
-
class: string;
|
|
136
|
-
};
|
|
137
|
-
request: Pick<Notice, 'url' | 'component' | 'action' | 'context' | 'params' | 'session'> & {
|
|
138
|
-
cgi_data: unknown;
|
|
139
|
-
};
|
|
140
|
-
server: Pick<Notice, 'revision'> & {
|
|
141
|
-
pid?: number | undefined;
|
|
142
|
-
project_root?: string | undefined;
|
|
143
|
-
environment_name?: string | undefined;
|
|
144
|
-
hostname: string;
|
|
145
|
-
time: string;
|
|
146
|
-
stats?: ProcessStats | undefined;
|
|
147
|
-
};
|
|
148
|
-
details: Record<string, Record<string, unknown>>;
|
|
149
|
-
};
|
|
150
|
-
export interface Transport {
|
|
151
|
-
send(options: TransportOptions, payload?: NoticeTransportPayload | undefined): Promise<{
|
|
152
|
-
statusCode: number;
|
|
153
|
-
body: string;
|
|
154
|
-
}>;
|
|
155
|
-
}
|
|
156
|
-
export declare type HoneybadgerStore<T> = Pick<AsyncLocalStorage<T>, 'getStore' | 'run'>;
|
|
157
|
-
export declare type DefaultStoreContents = {
|
|
158
|
-
context: Record<string, unknown>;
|
|
159
|
-
breadcrumbs: BreadcrumbRecord[];
|
|
160
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Client from '../core/client';
|
|
2
|
-
import { Logger, BacktraceFrame, Notice, Noticeable, BeforeNotifyHandler, AfterNotifyHandler, Config, BrowserConfig } from './types';
|
|
3
|
-
export declare function merge<T1 extends Record<string, unknown>, T2 extends Record<string, unknown>>(obj1: T1, obj2: T2): T1 & T2;
|
|
4
|
-
export declare function mergeNotice(notice1: Partial<Notice>, notice2: Partial<Notice>): Partial<Notice>;
|
|
5
|
-
export declare function objectIsEmpty(obj: any): boolean;
|
|
6
|
-
export declare function objectIsExtensible(obj: any): boolean;
|
|
7
|
-
export declare function makeBacktrace(stack: string, shift?: number): BacktraceFrame[];
|
|
8
|
-
export declare function getSourceForBacktrace(backtrace: BacktraceFrame[], getSourceFileHandler: (path: string) => Promise<string>): Promise<Record<string, string>[]>;
|
|
9
|
-
export declare function runBeforeNotifyHandlers(notice: Notice | null, handlers: BeforeNotifyHandler[]): boolean;
|
|
10
|
-
export declare function runAfterNotifyHandlers(notice: Notice | null, handlers: AfterNotifyHandler[], error?: Error): boolean;
|
|
11
|
-
export declare function shallowClone<T>(obj: T): T | Record<string, unknown>;
|
|
12
|
-
export declare function sanitize(obj: any, maxDepth?: number): any;
|
|
13
|
-
export declare function logger(client: Client): Logger;
|
|
14
|
-
/**
|
|
15
|
-
* Converts any object into a notice object (which at minimum has the same
|
|
16
|
-
* properties as Error, but supports additional Honeybadger properties.)
|
|
17
|
-
*/
|
|
18
|
-
export declare function makeNotice(thing: Noticeable): Partial<Notice>;
|
|
19
|
-
/**
|
|
20
|
-
* Instrument an existing function inside an object (usually global).
|
|
21
|
-
* @param {!Object} object
|
|
22
|
-
* @param {!String} name
|
|
23
|
-
* @param {!Function} replacement
|
|
24
|
-
*/
|
|
25
|
-
export declare function instrument(object: Record<string, any>, name: string, replacement: (unknown: any) => void): void;
|
|
26
|
-
export declare function endpoint(base: string, path: string): string;
|
|
27
|
-
export declare function generateStackTrace(): string;
|
|
28
|
-
export declare function filter(obj: Record<string, unknown>, filters: string[]): Record<string, unknown>;
|
|
29
|
-
export declare function filterUrl(url: string, filters: string[]): string;
|
|
30
|
-
export declare function formatCGIData(vars: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
31
|
-
export declare function clone<T>(obj: T): T;
|
|
32
|
-
export declare function isBrowserConfig(config: BrowserConfig | Config): config is BrowserConfig;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** @ts-ignore */
|
|
2
|
-
import type { Handler, Callback, Context } from 'aws-lambda';
|
|
3
|
-
export declare type SyncHandler<TEvent = any, TResult = any> = (event: TEvent, context: Context, callback: Callback<TResult>) => void;
|
|
4
|
-
export declare type AsyncHandler<TEvent = any, TResult = any> = (event: TEvent, context: Context) => Promise<TResult>;
|
|
5
|
-
export declare function lambdaHandler<TEvent = any, TResult = any>(handler: Handler<TEvent, TResult>): Handler<TEvent, TResult>;
|
|
6
|
-
/**
|
|
7
|
-
* Removes AWS Lambda default listener that
|
|
8
|
-
* exits the process before letting us report to honeybadger.
|
|
9
|
-
*/
|
|
10
|
-
export declare function removeAwsDefaultUncaughtExceptionListener(): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from 'express';
|
|
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,9 +0,0 @@
|
|
|
1
|
-
import { Transport, TransportOptions, NoticeTransportPayload } from '../core/types';
|
|
2
|
-
export declare class ServerTransport implements Transport {
|
|
3
|
-
send(options: TransportOptions, payload?: NoticeTransportPayload | undefined): Promise<{
|
|
4
|
-
statusCode: number;
|
|
5
|
-
body: string;
|
|
6
|
-
}>;
|
|
7
|
-
private isNoticePayload;
|
|
8
|
-
private appendMetadata;
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ProcessStats } from '../core/types';
|
|
2
|
-
export declare function fatallyLogAndExit(err: Error): never;
|
|
3
|
-
export declare function getStats(): Promise<ProcessStats>;
|
|
4
|
-
/**
|
|
5
|
-
* Get source file if possible, used to build `notice.backtrace.source`
|
|
6
|
-
*
|
|
7
|
-
* @param path to source code
|
|
8
|
-
*/
|
|
9
|
-
export declare function getSourceFile(path: string): Promise<string>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Client from './core/client';
|
|
2
|
-
import { Config, ServerlessConfig } from './core/types';
|
|
3
|
-
import { errorHandler, requestHandler } from './server/middleware';
|
|
4
|
-
import { lambdaHandler } from './server/aws_lambda';
|
|
5
|
-
declare class Honeybadger extends Client {
|
|
6
|
-
errorHandler: typeof errorHandler;
|
|
7
|
-
requestHandler: typeof requestHandler;
|
|
8
|
-
lambdaHandler: typeof lambdaHandler;
|
|
9
|
-
config: Config | ServerlessConfig;
|
|
10
|
-
constructor(opts?: Partial<Config | ServerlessConfig>);
|
|
11
|
-
factory(opts?: Partial<Config | ServerlessConfig>): this;
|
|
12
|
-
configure(opts?: Partial<Config | ServerlessConfig>): this;
|
|
13
|
-
checkIn(id: string): Promise<void>;
|
|
14
|
-
withRequest<R>(request: Record<symbol, unknown>, handler: (...args: never[]) => R, onError?: (...args: unknown[]) => unknown): R | void;
|
|
15
|
-
}
|
|
16
|
-
declare const _default: Honeybadger;
|
|
17
|
-
export default _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Transport, TransportOptions, NoticeTransportPayload } from '../core/types';
|
|
2
|
-
export declare class BrowserTransport implements Transport {
|
|
3
|
-
send(options: TransportOptions, payload?: NoticeTransportPayload | undefined): Promise<{
|
|
4
|
-
statusCode: number;
|
|
5
|
-
body: string;
|
|
6
|
-
}>;
|
|
7
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an HTMLElement into a human-readable string.
|
|
3
|
-
* @param {!HTMLElement} element
|
|
4
|
-
* @return {string}
|
|
5
|
-
*/
|
|
6
|
-
export declare function stringNameOfElement(element: HTMLElement): string;
|
|
7
|
-
export declare function stringSelectorOfElement(element: any): any;
|
|
8
|
-
export declare function stringTextOfElement(element: any): any;
|
|
9
|
-
export declare function nativeFetch(): boolean;
|
|
10
|
-
export declare function parseURL(url: any): {
|
|
11
|
-
protocol: any;
|
|
12
|
-
host: any;
|
|
13
|
-
pathname: any;
|
|
14
|
-
};
|
|
15
|
-
export declare function localURLPathname(url: any): any;
|
|
16
|
-
export declare function decodeCookie(string: string): Record<string, unknown>;
|
|
17
|
-
export declare function encodeCookie(object: any): string;
|
|
18
|
-
export declare const preferCatch: boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Client from './core/client';
|
|
2
|
-
import { BrowserConfig } from './core/types';
|
|
3
|
-
declare class Honeybadger extends Client {
|
|
4
|
-
config: BrowserConfig;
|
|
5
|
-
constructor(opts?: Partial<BrowserConfig>);
|
|
6
|
-
configure(opts?: Partial<BrowserConfig>): this;
|
|
7
|
-
resetMaxErrors(): number;
|
|
8
|
-
factory(opts?: Partial<BrowserConfig>): this;
|
|
9
|
-
checkIn(_id: string): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: Honeybadger;
|
|
12
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Config, Logger, BeforeNotifyHandler, AfterNotifyHandler, Notice, Noticeable, HoneybadgerStore, BreadcrumbRecord, Transport, NoticeTransportPayload } from './types';
|
|
2
|
-
export default abstract class Client {
|
|
3
|
-
protected __pluginsExecuted: boolean;
|
|
4
|
-
protected __store: HoneybadgerStore<{
|
|
5
|
-
context: Record<string, unknown>;
|
|
6
|
-
breadcrumbs: BreadcrumbRecord[];
|
|
7
|
-
}>;
|
|
8
|
-
protected __beforeNotifyHandlers: BeforeNotifyHandler[];
|
|
9
|
-
protected __afterNotifyHandlers: AfterNotifyHandler[];
|
|
10
|
-
protected __getSourceFileHandler: (path: string) => Promise<string>;
|
|
11
|
-
protected readonly __transport: Transport;
|
|
12
|
-
config: Config;
|
|
13
|
-
logger: Logger;
|
|
14
|
-
protected constructor(opts: Partial<Config>, transport: Transport);
|
|
15
|
-
protected abstract factory(opts: Partial<Config>): this;
|
|
16
|
-
protected abstract checkIn(id: string): Promise<void>;
|
|
17
|
-
getVersion(): string;
|
|
18
|
-
configure(opts?: Partial<Config>): this;
|
|
19
|
-
beforeNotify(handler: BeforeNotifyHandler): Client;
|
|
20
|
-
afterNotify(handler: AfterNotifyHandler): Client;
|
|
21
|
-
setContext(context: Record<string, unknown>): Client;
|
|
22
|
-
resetContext(context?: Record<string, unknown>): Client;
|
|
23
|
-
clear(): Client;
|
|
24
|
-
notify(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.
|
|
27
|
-
* Implemented using the {@link afterNotify} hook.
|
|
28
|
-
* Rejects if for any reason the report failed to be reported.
|
|
29
|
-
* Useful in serverless environments (AWS Lambda).
|
|
30
|
-
*/
|
|
31
|
-
notifyAsync(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Promise<void>;
|
|
32
|
-
protected makeNotice(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Notice | null;
|
|
33
|
-
addBreadcrumb(message: string, opts?: Record<string, unknown>): Client;
|
|
34
|
-
protected __developmentMode(): boolean;
|
|
35
|
-
protected __buildPayload(notice: Notice): NoticeTransportPayload;
|
|
36
|
-
protected __constructTags(tags: unknown): Array<string>;
|
|
37
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HoneybadgerStore } from './types';
|
|
2
|
-
export declare class GlobalStore<T> implements HoneybadgerStore<T> {
|
|
3
|
-
private store;
|
|
4
|
-
constructor(store: T);
|
|
5
|
-
getStore(): T;
|
|
6
|
-
run<R, TArgs extends never[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
|
7
|
-
}
|