@honeybadger-io/js 3.2.8 → 3.2.9

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.
@@ -254,7 +254,7 @@ function runAfterNotifyHandlers(notice, handlers, error) {
254
254
  return true;
255
255
  }
256
256
  // Returns a new object with properties from other object.
257
- function newObject(obj) {
257
+ function shallowClone(obj) {
258
258
  if (typeof (obj) !== 'object' || obj === null) {
259
259
  return {};
260
260
  }
@@ -281,8 +281,14 @@ function sanitize(obj, maxDepth) {
281
281
  return false;
282
282
  }
283
283
  function canSerialize(obj) {
284
- // Functions are TMI and Symbols can't convert to strings.
285
- if (/function|symbol/.test(typeof (obj))) {
284
+ var typeOfObj = typeof obj;
285
+ // Functions are TMI
286
+ if (/function/.test(typeOfObj)) {
287
+ // Let special toJSON method pass as it's used by JSON.stringify (#722)
288
+ return obj.name === 'toJSON';
289
+ }
290
+ // Symbols can't convert to strings.
291
+ if (/symbol/.test(typeOfObj)) {
286
292
  return false;
287
293
  }
288
294
  if (obj === null) {
@@ -373,7 +379,7 @@ function makeNotice(thing) {
373
379
  notice = merge(thing, { name: e.name, message: e.message, stack: e.stack });
374
380
  }
375
381
  else if (typeof thing === 'object') {
376
- notice = newObject(thing);
382
+ notice = shallowClone(thing);
377
383
  }
378
384
  else {
379
385
  var m = String(thing);
@@ -497,7 +503,7 @@ function formatCGIData(vars, prefix) {
497
503
  var notifier = {
498
504
  name: 'honeybadger-js',
499
505
  url: 'https://github.com/honeybadger-io/honeybadger-js',
500
- version: '3.2.8'
506
+ version: '3.2.9'
501
507
  };
502
508
  // Split at commas
503
509
  var TAG_SEPARATOR = /,/;
@@ -640,7 +646,7 @@ var Client = /** @class */ (function () {
640
646
  return;
641
647
  }
642
648
  opts = opts || {};
643
- var metadata = newObject(opts.metadata);
649
+ var metadata = shallowClone(opts.metadata);
644
650
  var category = opts.category || 'custom';
645
651
  var timestamp = new Date().toISOString();
646
652
  this.__breadcrumbs.push({
@@ -7,7 +7,7 @@ export declare function objectIsExtensible(obj: any): boolean;
7
7
  export declare function makeBacktrace(stack: string, shift?: number): BacktraceFrame[];
8
8
  export declare function runBeforeNotifyHandlers(notice: any, handlers: BeforeNotifyHandler[]): boolean;
9
9
  export declare function runAfterNotifyHandlers(notice: any, handlers: AfterNotifyHandler[], error?: any): boolean;
10
- export declare function newObject<T>(obj: T): T | Record<string, unknown>;
10
+ export declare function shallowClone<T>(obj: T): T | Record<string, unknown>;
11
11
  export declare function sanitize(obj: any, maxDepth?: number): any;
12
12
  export declare function logger(client: Client): Logger;
13
13
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honeybadger-io/js",
3
- "version": "3.2.8",
3
+ "version": "3.2.9",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/honeybadger-io/honeybadger-js",
6
6
  "author": {
@@ -1,3 +0,0 @@
1
- export default class NotifyError extends Error {
2
- constructor(message: any);
3
- }
@@ -1,9 +0,0 @@
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,2 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export default function (): Plugin;
@@ -1,2 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export default function (): Plugin;
@@ -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
- 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;
@@ -1,13 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export default function (_window?: Window & typeof globalThis): Plugin;
@@ -1,2 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export default function (_window?: Window & typeof globalThis): Plugin;
@@ -1,3 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export declare function ignoreNextOnError(): void;
3
- export declare function onError(_window?: any): Plugin;
@@ -1,2 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export default function (_window?: any): Plugin;
@@ -1,2 +0,0 @@
1
- import { Plugin } from '../../core/types';
2
- export default function (_window?: Window & typeof globalThis): Plugin;
@@ -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,15 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- export default class NotifyError extends Error {
2
- constructor(message: any);
3
- }
@@ -1,9 +0,0 @@
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;