@honeybadger-io/js 3.2.8 → 4.0.0-beta.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/dist/browser/honeybadger.js +267 -119
- 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 +23 -3
- package/dist/browser/types/core/store.d.ts +7 -0
- package/dist/browser/types/core/types.d.ts +8 -4
- package/dist/browser/types/core/util.d.ts +5 -3
- package/dist/browser/types/server/async_store.d.ts +5 -0
- package/dist/browser/types/server.d.ts +1 -0
- package/dist/server/honeybadger.d.ts +3 -1
- package/dist/server/honeybadger.js +375 -142
- package/dist/server/types/core/client.d.ts +23 -3
- package/dist/server/types/core/store.d.ts +7 -0
- package/dist/server/types/core/types.d.ts +8 -4
- package/dist/server/types/core/util.d.ts +5 -3
- package/dist/server/types/server/async_store.d.ts +5 -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 +3 -1
- package/honeybadger.d.ts +2 -1
- package/package.json +25 -22
- package/dist/browser/types/core/error.d.ts +0 -3
- package/dist/server/types/core/error.d.ts +0 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {!HTMLElement} element
|
|
4
4
|
* @return {string}
|
|
5
5
|
*/
|
|
6
|
-
export declare function stringNameOfElement(element:
|
|
6
|
+
export declare function stringNameOfElement(element: HTMLElement): string;
|
|
7
7
|
export declare function stringSelectorOfElement(element: any): any;
|
|
8
8
|
export declare function stringTextOfElement(element: any): any;
|
|
9
9
|
export declare function nativeFetch(): boolean;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { Config, Logger, BeforeNotifyHandler, AfterNotifyHandler, Notice, Noticeable } from './types';
|
|
1
|
+
import { Config, Logger, BeforeNotifyHandler, AfterNotifyHandler, Notice, Noticeable, HoneybadgerStore, BreadcrumbRecord } from './types';
|
|
2
2
|
export default class Client {
|
|
3
|
+
private __pluginsExecuted;
|
|
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, cb: (fileContent: string) => void) => void;
|
|
3
11
|
config: Config;
|
|
4
12
|
logger: Logger;
|
|
5
13
|
constructor(opts?: Partial<Config>);
|
|
6
|
-
factory(_opts?:
|
|
14
|
+
factory(_opts?: Partial<Config>): Client;
|
|
7
15
|
getVersion(): string;
|
|
8
16
|
configure(opts?: Partial<Config>): Client;
|
|
9
17
|
beforeNotify(handler: BeforeNotifyHandler): Client;
|
|
@@ -11,6 +19,18 @@ export default class Client {
|
|
|
11
19
|
setContext(context: Record<string, unknown>): Client;
|
|
12
20
|
resetContext(context?: Record<string, unknown>): Client;
|
|
13
21
|
clear(): Client;
|
|
14
|
-
notify(
|
|
22
|
+
notify(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.
|
|
25
|
+
* Implemented using the {@link afterNotify} hook.
|
|
26
|
+
* Rejects if for any reason the report failed to be reported.
|
|
27
|
+
* Useful in serverless environments (AWS Lambda).
|
|
28
|
+
*/
|
|
29
|
+
notifyAsync(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Promise<void>;
|
|
30
|
+
protected makeNotice(noticeable: Noticeable, name?: string | Partial<Notice>, extra?: Partial<Notice>): Notice | null;
|
|
15
31
|
addBreadcrumb(message: string, opts?: Record<string, unknown>): Client;
|
|
32
|
+
protected __developmentMode(): boolean;
|
|
33
|
+
protected __send(_notice: Partial<Notice>): void;
|
|
34
|
+
protected __buildPayload(notice: Notice): Record<string, Record<string, unknown>>;
|
|
35
|
+
protected __constructTags(tags: unknown): Array<string>;
|
|
16
36
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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,4 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import Client from './client';
|
|
3
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
2
4
|
export interface Logger {
|
|
3
5
|
log(...args: unknown[]): unknown;
|
|
4
6
|
info(...args: unknown[]): unknown;
|
|
@@ -16,7 +18,6 @@ export interface Config {
|
|
|
16
18
|
component?: string;
|
|
17
19
|
action?: string;
|
|
18
20
|
revision?: string;
|
|
19
|
-
disabled: boolean;
|
|
20
21
|
debug: boolean;
|
|
21
22
|
reportData: boolean;
|
|
22
23
|
breadcrumbsEnabled: boolean | {
|
|
@@ -33,13 +34,13 @@ export interface Config {
|
|
|
33
34
|
enableUnhandledRejection: boolean;
|
|
34
35
|
filters: string[];
|
|
35
36
|
__plugins: Plugin[];
|
|
36
|
-
tags:
|
|
37
|
+
tags: unknown;
|
|
37
38
|
}
|
|
38
39
|
export interface BeforeNotifyHandler {
|
|
39
|
-
(notice
|
|
40
|
+
(notice?: Notice): boolean | void;
|
|
40
41
|
}
|
|
41
42
|
export interface AfterNotifyHandler {
|
|
42
|
-
(error: any, notice
|
|
43
|
+
(error: any, notice?: Notice): boolean | void;
|
|
43
44
|
}
|
|
44
45
|
export interface Plugin {
|
|
45
46
|
load(client: Client): void;
|
|
@@ -67,6 +68,7 @@ export interface Notice {
|
|
|
67
68
|
details: Record<string, Record<string, unknown>>;
|
|
68
69
|
__breadcrumbs: BreadcrumbRecord[];
|
|
69
70
|
afterNotify?: AfterNotifyHandler;
|
|
71
|
+
[key: string]: unknown;
|
|
70
72
|
}
|
|
71
73
|
export declare type Noticeable = string | Error | Partial<Notice>;
|
|
72
74
|
export interface BacktraceFrame {
|
|
@@ -74,6 +76,7 @@ export interface BacktraceFrame {
|
|
|
74
76
|
method: string;
|
|
75
77
|
number: number;
|
|
76
78
|
column: number;
|
|
79
|
+
source?: Record<string, string>;
|
|
77
80
|
}
|
|
78
81
|
export interface BreadcrumbRecord {
|
|
79
82
|
category: string;
|
|
@@ -87,3 +90,4 @@ export interface CGIData {
|
|
|
87
90
|
HTTP_COOKIE: string | undefined;
|
|
88
91
|
[x: string]: unknown;
|
|
89
92
|
}
|
|
93
|
+
export declare type HoneybadgerStore<T> = Pick<AsyncLocalStorage<T>, 'getStore' | 'run'>;
|
|
@@ -5,9 +5,10 @@ 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
|
|
10
|
-
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;
|
|
11
|
+
export declare function shallowClone<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;
|
|
13
14
|
/**
|
|
@@ -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;
|
|
@@ -8,6 +8,7 @@ declare class Honeybadger extends Client {
|
|
|
8
8
|
lambdaHandler: typeof lambdaHandler;
|
|
9
9
|
constructor(opts?: Partial<Config>);
|
|
10
10
|
factory(opts?: Partial<Config>): Honeybadger;
|
|
11
|
+
run<R>(handler: (...args: never[]) => R, onError?: (...args: any[]) => any): R | void;
|
|
11
12
|
}
|
|
12
13
|
declare const _default: Honeybadger;
|
|
13
14
|
export default _default;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Client from './types/core/client';
|
|
2
2
|
import { Config } from './types/core/types';
|
|
3
|
-
import { errorHandler, requestHandler
|
|
3
|
+
import { errorHandler, requestHandler } from './types/server/middleware';
|
|
4
|
+
import { lambdaHandler } from './types/server/aws_lambda';
|
|
4
5
|
declare class Honeybadger extends Client {
|
|
5
6
|
errorHandler: typeof errorHandler;
|
|
6
7
|
requestHandler: typeof requestHandler;
|
|
7
8
|
lambdaHandler: typeof lambdaHandler;
|
|
8
9
|
constructor(opts?: Partial<Config>);
|
|
9
10
|
factory(opts?: Partial<Config>): Honeybadger;
|
|
11
|
+
run<R>(handler: (...args: never[]) => R, onError?: (...args: any[]) => any): R | void;
|
|
10
12
|
}
|
|
11
13
|
declare const _default: Honeybadger;
|
|
12
14
|
export default _default;
|