@honeybadger-io/js 3.2.7 → 3.2.8

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.
@@ -0,0 +1,4 @@
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;
@@ -0,0 +1,9 @@
1
+ export declare function fatallyLogAndExit(err: Error): never;
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;
@@ -0,0 +1,13 @@
1
+ import Client from './core/client';
2
+ import { Config } 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
+ constructor(opts?: Partial<Config>);
10
+ factory(opts?: Partial<Config>): Honeybadger;
11
+ }
12
+ declare const _default: Honeybadger;
13
+ export default _default;
@@ -309,7 +309,7 @@ function sanitize(obj, maxDepth) {
309
309
  }
310
310
  // Serialize inside arrays
311
311
  if (Array.isArray(obj)) {
312
- return obj.map(function (o) { return serialize(o, depth + 1); });
312
+ return obj.map(function (o) { return safeSerialize(o, depth + 1); });
313
313
  }
314
314
  // Serialize inside objects
315
315
  if (typeof (obj) === 'object') {
@@ -317,7 +317,7 @@ function sanitize(obj, maxDepth) {
317
317
  for (var k in obj) {
318
318
  var v = obj[k];
319
319
  if (Object.prototype.hasOwnProperty.call(obj, k) && (k != null) && (v != null)) {
320
- ret[k] = serialize(v, depth + 1);
320
+ ret[k] = safeSerialize(v, depth + 1);
321
321
  }
322
322
  }
323
323
  return ret;
@@ -325,7 +325,16 @@ function sanitize(obj, maxDepth) {
325
325
  // Return everything else untouched
326
326
  return obj;
327
327
  }
328
- return serialize(obj);
328
+ function safeSerialize(obj, depth) {
329
+ if (depth === void 0) { depth = 0; }
330
+ try {
331
+ return serialize(obj, depth);
332
+ }
333
+ catch (e) {
334
+ return "[ERROR] " + e;
335
+ }
336
+ }
337
+ return safeSerialize(obj);
329
338
  }
330
339
  function logger(client) {
331
340
  var log = function (method) {
@@ -488,7 +497,7 @@ function formatCGIData(vars, prefix) {
488
497
  var notifier = {
489
498
  name: 'honeybadger-js',
490
499
  url: 'https://github.com/honeybadger-io/honeybadger-js',
491
- version: '3.2.7'
500
+ version: '3.2.8'
492
501
  };
493
502
  // Split at commas
494
503
  var TAG_SEPARATOR = /,/;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '../../core/types';
2
+ export default function (_window?: Window & typeof globalThis): Plugin;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '../../core/types';
2
+ export default function (_window?: Window & typeof globalThis): Plugin;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from '../../core/types';
2
+ export declare function ignoreNextOnError(): void;
3
+ export declare function onError(_window?: any): Plugin;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '../../core/types';
2
+ export default function (_window?: any): Plugin;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '../../core/types';
2
+ export default function (_window?: Window & typeof globalThis): Plugin;
@@ -0,0 +1,18 @@
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;
@@ -0,0 +1,15 @@
1
+ import Client from './core/client';
2
+ import { Config } from './core/types';
3
+ interface BrowserConfig extends Config {
4
+ async: boolean;
5
+ maxErrors: number;
6
+ }
7
+ declare class Honeybadger extends Client {
8
+ config: BrowserConfig;
9
+ constructor(opts?: Partial<BrowserConfig>);
10
+ configure(opts?: Partial<BrowserConfig>): Client;
11
+ resetMaxErrors(): number;
12
+ factory(opts?: Partial<BrowserConfig>): Honeybadger;
13
+ }
14
+ declare const _default: Honeybadger;
15
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default class NotifyError extends Error {
2
+ constructor(message: any);
3
+ }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honeybadger-io/js",
3
- "version": "3.2.7",
3
+ "version": "3.2.8",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/honeybadger-io/honeybadger-js",
6
6
  "author": {