backtrace-node
Advanced tools
Comparing version 1.0.0-alpha.5 to 1.0.0-alpha.6
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { BacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import { BacktraceReport } from './model/backtraceReport'; | ||
@@ -14,3 +14,3 @@ import { BacktraceResult } from './model/backtraceResult'; | ||
private _clientRateLimit; | ||
constructor(options: BacktraceClientOptions); | ||
constructor(clientOptions: IBacktraceClientOptions | BacktraceClientOptions); | ||
/** | ||
@@ -17,0 +17,0 @@ * Memorize selected values from application. |
@@ -73,11 +73,9 @@ "use strict"; | ||
__extends(BacktraceClient, _super); | ||
function BacktraceClient(options) { | ||
function BacktraceClient(clientOptions) { | ||
var _this = _super.call(this) || this; | ||
_this.options = options; | ||
_this._memorizedAttributes = {}; | ||
if (!options.endpoint) { | ||
// tslint:disable-next-line: quotemark | ||
if (!clientOptions.endpoint) { | ||
throw new Error("Backtrace: missing 'endpoint' option."); | ||
} | ||
_this.options = __assign({}, new backtraceClientOptions_1.BacktraceClientOptions(), options); | ||
_this.options = __assign({}, new backtraceClientOptions_1.BacktraceClientOptions(), clientOptions); | ||
_this._backtraceApi = new backtraceApi_1.BacktraceApi(_this.getSubmitUrl(), _this.options.timeout); | ||
@@ -84,0 +82,0 @@ _this._clientRateLimit = new clientRateLimit_1.ClientRateLimit(_this.options.rateLimit); |
import { BacktraceClient } from './backtraceClient'; | ||
import { BacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import * as btReport from './model/backtraceReport'; | ||
@@ -8,3 +8,3 @@ import { BacktraceResult } from './model/backtraceResult'; | ||
export { BacktraceReport as BtReport } from './model/backtraceReport'; | ||
export { BacktraceClientOptions } from './model/backtraceClientOptions'; | ||
export { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; | ||
/** | ||
@@ -14,3 +14,3 @@ * Initalize Backtrace Client and Backtrace node integration | ||
*/ | ||
export declare function initialize(configuration: BacktraceClientOptions): BacktraceClient; | ||
export declare function initialize(configuration: BacktraceClientOptions | IBacktraceClientOptions): BacktraceClient; | ||
/** | ||
@@ -17,0 +17,0 @@ * Returns used BacktraceClient |
@@ -1,5 +0,5 @@ | ||
export declare class BacktraceClientOptions { | ||
export declare class BacktraceClientOptions implements IBacktraceClientOptions { | ||
timeout: number; | ||
endpoint: string; | ||
token: string; | ||
token?: string; | ||
attributes: object; | ||
@@ -14,1 +14,14 @@ disableGlobalHandler: boolean; | ||
} | ||
export interface IBacktraceClientOptions { | ||
timeout?: number; | ||
endpoint: string; | ||
token?: string; | ||
attributes?: object; | ||
disableGlobalHandler?: boolean; | ||
handlePromises?: boolean; | ||
allowMultipleUncaughtExceptionListeners?: boolean; | ||
tabWidth?: number; | ||
contextLineCount?: number; | ||
sampling?: number | undefined; | ||
rateLimit?: number; | ||
} |
@@ -63,2 +63,3 @@ import { IBacktraceData } from './backtraceData'; | ||
isExceptionTypeReport(): boolean; | ||
getPayload(): Error | string; | ||
/** | ||
@@ -65,0 +66,0 @@ * Set error or message in BacktraceReport object |
@@ -127,2 +127,5 @@ "use strict"; | ||
}; | ||
BacktraceReport.prototype.getPayload = function () { | ||
return this.err; | ||
}; | ||
/** | ||
@@ -129,0 +132,0 @@ * Set error or message in BacktraceReport object |
{ | ||
"name": "backtrace-node", | ||
"version": "1.0.0-alpha.5", | ||
"version": "1.0.0-alpha.6", | ||
"description": "Backtrace error reporting tool", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -5,3 +5,3 @@ import { ClientRateLimit } from './clientRateLimit'; | ||
import { BacktraceApi } from './backtraceApi'; | ||
import { BacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import { IBacktraceData } from './model/backtraceData'; | ||
@@ -14,15 +14,16 @@ import { BacktraceReport } from './model/backtraceReport'; | ||
export class BacktraceClient extends EventEmitter { | ||
public options: BacktraceClientOptions; | ||
private _memorizedAttributes: object = {}; | ||
private _backtraceApi: BacktraceApi; | ||
private _clientRateLimit: ClientRateLimit; | ||
constructor(public options: BacktraceClientOptions) { | ||
constructor(clientOptions: IBacktraceClientOptions | BacktraceClientOptions) { | ||
super(); | ||
if (!options.endpoint) { | ||
// tslint:disable-next-line: quotemark | ||
throw new Error("Backtrace: missing 'endpoint' option."); | ||
if (!clientOptions.endpoint) { | ||
throw new Error(`Backtrace: missing 'endpoint' option.`); | ||
} | ||
this.options = { | ||
...new BacktraceClientOptions(), | ||
...options, | ||
}; | ||
...clientOptions, | ||
} as BacktraceClientOptions; | ||
this._backtraceApi = new BacktraceApi(this.getSubmitUrl(), this.options.timeout); | ||
@@ -29,0 +30,0 @@ this._clientRateLimit = new ClientRateLimit(this.options.rateLimit); |
import { BacktraceClient } from './backtraceClient'; | ||
import { BacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; | ||
import * as btReport from './model/backtraceReport'; | ||
@@ -11,3 +11,3 @@ import { BacktraceResult } from './model/backtraceResult'; | ||
export { BacktraceReport as BtReport } from './model/backtraceReport'; | ||
export { BacktraceClientOptions } from './model/backtraceClientOptions'; | ||
export { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; | ||
/** | ||
@@ -17,3 +17,3 @@ * Initalize Backtrace Client and Backtrace node integration | ||
*/ | ||
export function initialize(configuration: BacktraceClientOptions): BacktraceClient { | ||
export function initialize(configuration: BacktraceClientOptions | IBacktraceClientOptions): BacktraceClient { | ||
backtraceClient = new BacktraceClient(configuration); | ||
@@ -20,0 +20,0 @@ return backtraceClient; |
@@ -1,5 +0,5 @@ | ||
export class BacktraceClientOptions { | ||
export class BacktraceClientOptions implements IBacktraceClientOptions { | ||
public timeout: number = 15000; | ||
public endpoint!: string; | ||
public token!: string; | ||
public token?: string; | ||
public attributes: object = {}; | ||
@@ -17,1 +17,15 @@ | ||
} | ||
export interface IBacktraceClientOptions { | ||
timeout?: number; | ||
endpoint: string; | ||
token?: string; | ||
attributes?: object; | ||
disableGlobalHandler?: boolean; | ||
handlePromises?: boolean; | ||
allowMultipleUncaughtExceptionListeners?: boolean; | ||
tabWidth?: number; | ||
contextLineCount?: number; | ||
sampling?: number | undefined; | ||
rateLimit?: number; | ||
} |
@@ -98,2 +98,5 @@ // tslint:disable-next-line: no-var-requires | ||
public getPayload(): Error | string { | ||
return this.err; | ||
} | ||
/** | ||
@@ -100,0 +103,0 @@ * Set error or message in BacktraceReport object |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151705
2900