@honeybadger-io/js 4.0.0-beta.5 → 4.0.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.d.ts +4 -7
- package/dist/browser/honeybadger.js +140 -66
- 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/transport.d.ts +7 -0
- package/dist/browser/types/browser.d.ts +4 -7
- package/dist/browser/types/core/client.d.ts +9 -8
- package/dist/browser/types/core/store.d.ts +1 -1
- package/dist/browser/types/core/types.d.ts +64 -1
- package/dist/browser/types/core/util.d.ts +4 -3
- package/dist/browser/types/server/async_store.d.ts +1 -1
- package/dist/browser/types/server/aws_lambda.d.ts +2 -1
- package/dist/browser/types/server/transport.d.ts +9 -0
- package/dist/browser/types/server/util.d.ts +3 -3
- package/dist/browser/types/server.d.ts +7 -4
- package/dist/server/honeybadger.d.ts +7 -4
- package/dist/server/honeybadger.js +283 -127
- package/dist/server/types/browser/transport.d.ts +7 -0
- package/dist/server/types/browser.d.ts +4 -7
- package/dist/server/types/core/client.d.ts +9 -8
- package/dist/server/types/core/store.d.ts +1 -1
- package/dist/server/types/core/types.d.ts +64 -1
- package/dist/server/types/core/util.d.ts +4 -3
- package/dist/server/types/server/async_store.d.ts +1 -1
- package/dist/server/types/server/aws_lambda.d.ts +2 -1
- package/dist/server/types/server/transport.d.ts +9 -0
- package/dist/server/types/server/util.d.ts +3 -3
- package/dist/server/types/server.d.ts +7 -4
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import Client from './client';
|
|
3
|
-
|
|
3
|
+
/** @ts-ignore */
|
|
4
|
+
import type { AsyncLocalStorage } from 'async_hooks';
|
|
4
5
|
export interface Logger {
|
|
5
6
|
log(...args: unknown[]): unknown;
|
|
6
7
|
info(...args: unknown[]): unknown;
|
|
@@ -36,6 +37,10 @@ export interface Config {
|
|
|
36
37
|
__plugins: Plugin[];
|
|
37
38
|
tags: unknown;
|
|
38
39
|
}
|
|
40
|
+
export interface ServerlessConfig extends Config {
|
|
41
|
+
reportTimeoutWarning: boolean;
|
|
42
|
+
timeoutWarningThresholdMs: number;
|
|
43
|
+
}
|
|
39
44
|
export interface BeforeNotifyHandler {
|
|
40
45
|
(notice?: Notice): boolean | void;
|
|
41
46
|
}
|
|
@@ -70,6 +75,10 @@ export interface Notice {
|
|
|
70
75
|
afterNotify?: AfterNotifyHandler;
|
|
71
76
|
[key: string]: unknown;
|
|
72
77
|
}
|
|
78
|
+
export interface BrowserConfig extends Config {
|
|
79
|
+
async: boolean;
|
|
80
|
+
maxErrors: number;
|
|
81
|
+
}
|
|
73
82
|
export declare type Noticeable = string | Error | Partial<Notice>;
|
|
74
83
|
export interface BacktraceFrame {
|
|
75
84
|
file: string;
|
|
@@ -90,6 +99,60 @@ export interface CGIData {
|
|
|
90
99
|
HTTP_COOKIE: string | undefined;
|
|
91
100
|
[x: string]: unknown;
|
|
92
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
|
+
}
|
|
93
156
|
export declare type HoneybadgerStore<T> = Pick<AsyncLocalStorage<T>, 'getStore' | 'run'>;
|
|
94
157
|
export declare type DefaultStoreContents = {
|
|
95
158
|
context: Record<string, unknown>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Client from '../core/client';
|
|
2
|
-
import { Logger,
|
|
2
|
+
import { Logger, BacktraceFrame, Notice, Noticeable, BeforeNotifyHandler, AfterNotifyHandler, Config, BrowserConfig } from './types';
|
|
3
3
|
export declare function merge<T1 extends Record<string, unknown>, T2 extends Record<string, unknown>>(obj1: T1, obj2: T2): T1 & T2;
|
|
4
4
|
export declare function mergeNotice(notice1: Partial<Notice>, notice2: Partial<Notice>): Partial<Notice>;
|
|
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 getSourceForBacktrace(backtrace: BacktraceFrame[], getSourceFileHandler: (path: string
|
|
8
|
+
export declare function getSourceForBacktrace(backtrace: BacktraceFrame[], getSourceFileHandler: (path: string) => Promise<string>): Promise<Record<string, string>[]>;
|
|
9
9
|
export declare function runBeforeNotifyHandlers(notice: Notice | null, handlers: BeforeNotifyHandler[]): boolean;
|
|
10
10
|
export declare function runAfterNotifyHandlers(notice: Notice | null, handlers: AfterNotifyHandler[], error?: Error): boolean;
|
|
11
11
|
export declare function shallowClone<T>(obj: T): T | Record<string, unknown>;
|
|
@@ -23,9 +23,10 @@ export declare function makeNotice(thing: Noticeable): Partial<Notice>;
|
|
|
23
23
|
* @param {!Function} replacement
|
|
24
24
|
*/
|
|
25
25
|
export declare function instrument(object: Record<string, any>, name: string, replacement: (unknown: any) => void): void;
|
|
26
|
-
export declare function endpoint(
|
|
26
|
+
export declare function endpoint(base: string, path: string): string;
|
|
27
27
|
export declare function generateStackTrace(): string;
|
|
28
28
|
export declare function filter(obj: Record<string, unknown>, filters: string[]): Record<string, unknown>;
|
|
29
29
|
export declare function filterUrl(url: string, filters: string[]): string;
|
|
30
30
|
export declare function formatCGIData(vars: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
31
31
|
export declare function clone<T>(obj: T): T;
|
|
32
|
+
export declare function isBrowserConfig(config: BrowserConfig | Config): config is BrowserConfig;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @ts-ignore */
|
|
2
|
+
import type { Handler, Callback, Context } from 'aws-lambda';
|
|
2
3
|
export declare type SyncHandler<TEvent = any, TResult = any> = (event: TEvent, context: Context, callback: Callback<TResult>) => void;
|
|
3
4
|
export declare type AsyncHandler<TEvent = any, TResult = any> = (event: TEvent, context: Context) => Promise<TResult>;
|
|
4
5
|
export declare function lambdaHandler<TEvent = any, TResult = any>(handler: Handler<TEvent, TResult>): Handler<TEvent, TResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 +1,9 @@
|
|
|
1
|
+
import { ProcessStats } from '../core/types';
|
|
1
2
|
export declare function fatallyLogAndExit(err: Error): never;
|
|
2
|
-
export declare function getStats(
|
|
3
|
+
export declare function getStats(): Promise<ProcessStats>;
|
|
3
4
|
/**
|
|
4
5
|
* Get source file if possible, used to build `notice.backtrace.source`
|
|
5
6
|
*
|
|
6
7
|
* @param path to source code
|
|
7
|
-
* @param cb callback with fileContent
|
|
8
8
|
*/
|
|
9
|
-
export declare function getSourceFile(path: string
|
|
9
|
+
export declare function getSourceFile(path: string): Promise<string>;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import Client from './core/client';
|
|
2
|
-
import { Config } from './core/types';
|
|
2
|
+
import { Config, ServerlessConfig } from './core/types';
|
|
3
3
|
import { errorHandler, requestHandler } from './server/middleware';
|
|
4
4
|
import { lambdaHandler } from './server/aws_lambda';
|
|
5
5
|
declare class Honeybadger extends Client {
|
|
6
6
|
errorHandler: typeof errorHandler;
|
|
7
7
|
requestHandler: typeof requestHandler;
|
|
8
8
|
lambdaHandler: typeof lambdaHandler;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
15
|
}
|
|
13
16
|
declare const _default: Honeybadger;
|
|
14
17
|
export default _default;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import Client from './types/core/client';
|
|
2
|
-
import { Config } from './types/core/types';
|
|
2
|
+
import { Config, ServerlessConfig } from './types/core/types';
|
|
3
3
|
import { errorHandler, requestHandler } from './types/server/middleware';
|
|
4
4
|
import { lambdaHandler } from './types/server/aws_lambda';
|
|
5
5
|
declare class Honeybadger extends Client {
|
|
6
6
|
errorHandler: typeof errorHandler;
|
|
7
7
|
requestHandler: typeof requestHandler;
|
|
8
8
|
lambdaHandler: typeof lambdaHandler;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
15
|
}
|
|
13
16
|
declare const _default: Honeybadger;
|
|
14
17
|
export default _default;
|