@bugsnag/node
Advanced tools
Comparing version 7.0.0-alpha.0 to 7.0.0-alpha.1
@@ -0,9 +1,10 @@ | ||
import { BreadcrumbType, BreadcrumbMetadataValue } from "./common"; | ||
declare class Breadcrumb { | ||
public message: string; | ||
public metadata: object; | ||
public type: string; | ||
public metadata: BreadcrumbMetadataValue; | ||
public type: BreadcrumbType; | ||
public timestamp: string; | ||
constructor(message: string, metadata?: object, type?: string, timestamp?: string); | ||
} | ||
export default Breadcrumb; |
import Client from "./client"; | ||
import Event from "./event"; | ||
import * as common from "./common"; | ||
import { | ||
BreadcrumbType, | ||
BreadcrumbMetadataValue, | ||
Config, | ||
NotifiableError, | ||
OnErrorCallback, | ||
OnSessionCallback, | ||
OnBreadcrumbCallback, | ||
User, | ||
Plugin | ||
} from "./common"; | ||
export default interface BugsnagStatic { | ||
init(apiKeyOrOpts: string | common.Config): void; | ||
createClient(apiKeyOrOpts: string | common.Config): Client; | ||
// reporting errors | ||
notify( | ||
error: common.NotifiableError, | ||
onError?: common.OnErrorCallback, | ||
cb?: (err: any, event: Event) => void, | ||
): void; | ||
// breadcrumbs | ||
leaveBreadcrumb(message: string, metadata?: any, type?: string, timestamp?: string): Client; | ||
// metadata | ||
addMetadata(section: string, values: { [key: string]: any }): void; | ||
addMetadata(section: string, key: string, value: any): void; | ||
getMetadata(section: string, key?: string): any; | ||
clearMetadata(section: string, key?: string): void; | ||
// context | ||
getContext(): string | undefined; | ||
setContext(c: string): void; | ||
// user | ||
getUser(): { id?: string; email?: string; name?: string }; | ||
setUser(id?: string, email?: string, name?: string): void; | ||
// reporting sesions | ||
startSession(): Client; | ||
pauseSession(): void; | ||
resumeSession(): Client; | ||
// callbacks | ||
addOnError(fn: common.OnErrorCallback): void; | ||
removeOnError(fn: common.OnErrorCallback): void; | ||
addOnSession(fn: common.OnSessionCallback): void; | ||
removeOnSession(fn: common.OnSessionCallback): void; | ||
addOnBreadcrumb(fn: common.OnBreadcrumbCallback): void; | ||
removeOnBreadcrumb(fn: common.OnBreadcrumbCallback): void; | ||
// plugins | ||
use(plugin: common.Plugin, ...args: any[]): Client; | ||
getPlugin(name: string): any; | ||
export default interface BugsnagStatic extends Client { | ||
init(apiKeyOrOpts: string | Config): Client; | ||
createClient(apiKeyOrOpts: string | Config): Client; | ||
} |
@@ -1,3 +0,12 @@ | ||
import * as common from "./common"; | ||
import Breadcrumb from "./breadcrumb"; | ||
import { | ||
NotifiableError, | ||
BreadcrumbMetadataValue, | ||
BreadcrumbType, | ||
Plugin, | ||
OnErrorCallback, | ||
OnSessionCallback, | ||
OnBreadcrumbCallback, | ||
User | ||
} from "./common"; | ||
import Event from "./event"; | ||
@@ -11,4 +20,10 @@ import Session from "./session"; | ||
public notify( | ||
error: common.NotifiableError, | ||
onError?: common.OnErrorCallback, | ||
error: NotifiableError, | ||
onError?: OnErrorCallback, | ||
cb?: (err: any, event: Event) => void | ||
): void; | ||
public _notify( | ||
event: Event, | ||
onError?: OnErrorCallback, | ||
cb?: (err: any, event: Event) => void, | ||
@@ -18,3 +33,7 @@ ): void; | ||
// breadcrumbs | ||
public leaveBreadcrumb(message: string, metadata?: any, type?: string): void; | ||
public leaveBreadcrumb( | ||
message: string, | ||
metadata?: { [key: string]: BreadcrumbMetadataValue }, | ||
type?: BreadcrumbType | ||
): void; | ||
@@ -32,6 +51,6 @@ // metadata | ||
// user | ||
public getUser(): { id?: string; email?: string; name?: string }; | ||
public getUser(): User; | ||
public setUser(id?: string, email?: string, name?: string): void; | ||
// reporting sesions | ||
// sessions | ||
public startSession(): Client; | ||
@@ -42,13 +61,13 @@ public pauseSession(): void; | ||
// callbacks | ||
public addOnError(fn: common.OnErrorCallback): void; | ||
public removeOnError(fn: common.OnErrorCallback): void; | ||
public addOnError(fn: OnErrorCallback): void; | ||
public removeOnError(fn: OnErrorCallback): void; | ||
public addOnSession(fn: common.OnSessionCallback): void; | ||
public removeOnSession(fn: common.OnSessionCallback): void; | ||
public addOnSession(fn: OnSessionCallback): void; | ||
public removeOnSession(fn: OnSessionCallback): void; | ||
public addOnBreadcrumb(fn: common.OnBreadcrumbCallback): void; | ||
public removeOnBreadcrumb(fn: common.OnBreadcrumbCallback): void; | ||
public addOnBreadcrumb(fn: OnBreadcrumbCallback): void; | ||
public removeOnBreadcrumb(fn: OnBreadcrumbCallback): void; | ||
// plugins | ||
public use(plugin: common.Plugin, ...args: any[]): Client; | ||
public use(plugin: Plugin, ...args: any[]): Client; | ||
public getPlugin(name: string): any; | ||
@@ -55,0 +74,0 @@ |
@@ -1,6 +0,5 @@ | ||
import Breadcrumb from "./breadcrumb"; | ||
import Client from "./client"; | ||
import Event from "./event"; | ||
import Session from "./session"; | ||
import BugsnagStatic from "./bugsnag"; | ||
import Breadcrumb from "./breadcrumb"; | ||
@@ -13,15 +12,16 @@ export interface Config { | ||
autoDetectUnhandledRejections?: boolean; | ||
onError?: OnErrorCallback | OnErrorCallback[]; | ||
endpoints?: { notify: string; sessions?: string }; | ||
autoTrackSessions?: boolean; | ||
context?: string; | ||
enabledBreadcrumbTypes?: BreadcrumbType[]; | ||
enabledReleaseStages?: string[]; | ||
endpoints?: { notify: string; sessions: string }; | ||
filters?: Array<string | RegExp>; | ||
onBreadcrumb?: OnBreadcrumbCallback | OnBreadcrumbCallback[]; | ||
onError?: OnErrorCallback | OnErrorCallback[]; | ||
onSession?: OnSessionCallback | OnSessionCallback[]; | ||
logger?: Logger | null; | ||
maxBreadcrumbs?: number; | ||
metadata?: { [key: string]: any }; | ||
releaseStage?: string; | ||
maxBreadcrumbs?: number; | ||
enabledBreadcrumbTypes?: BreadcrumbType[]; | ||
user?: { id?: string; name?: string; email?: string } | null; | ||
metadata?: object | null; | ||
logger?: Logger | null; | ||
redactedKeys?: Array<string | RegExp>; | ||
context?: string; | ||
[key: string]: any; | ||
user?: {} | null; | ||
} | ||
@@ -33,4 +33,2 @@ | ||
export type BreadcrumbType = "error" | "log" | "manual" | "navigation" | "process" | "request" | "state" | "user"; | ||
export interface Plugin { | ||
@@ -60,2 +58,27 @@ name?: string; | ||
export interface SessionDelegate { | ||
startSession: (client: Client) => Client; | ||
} | ||
export interface EventPayload { apiKey: string; | ||
notifier: { | ||
name: string; | ||
version: string; | ||
url: string; | ||
}; | ||
events: Event[]; | ||
} | ||
export interface SessionPayload { | ||
notifier: { | ||
name: string; | ||
version: string; | ||
url: string; | ||
}; | ||
device?: Device; | ||
user?: User; | ||
app?: App; | ||
sessions: Session[]; | ||
} | ||
export type NotifiableError = Error | ||
@@ -66,2 +89,49 @@ | { errorClass: string; errorMessage: string } | ||
export { BugsnagStatic } | ||
type Primitive = boolean | string | number | undefined | null; | ||
export type BreadcrumbMetadataValue = Primitive | Array<Primitive>; | ||
export type BreadcrumbType = "error" | "log" | "manual" | "navigation" | "process" | "request" | "state" | "user"; | ||
interface Device { | ||
id?: string; | ||
hostname?: string; | ||
locale?: string; | ||
manufacturer?: string; | ||
model?: string; | ||
modelNumber?: string; | ||
orientation?: string; | ||
osName?: string; | ||
osVersion?: string; | ||
runtimeVersions?: { | ||
[key: string]: any; | ||
}; | ||
time?: string; | ||
userAgent?: string; | ||
[key: string]: any; | ||
} | ||
interface App { | ||
codeBundleId?: string; | ||
duration?: number; | ||
durationInForeground?: number; | ||
inForeground?: boolean; | ||
releaseStage?: string; | ||
type?: string; | ||
version?: string; | ||
[key: string]: any; | ||
} | ||
interface Request { | ||
clientIp?: string; | ||
headers?: { [key: string]: string }; | ||
httpMethod?: string; | ||
referer?: string; | ||
url?: string; | ||
[key: string]: any; | ||
} | ||
export interface User { | ||
id?: string; | ||
email?: string; | ||
name?: string | ||
} |
import Breadcrumb from "./breadcrumb"; | ||
import { | ||
App, | ||
Device, | ||
Request, | ||
Logger, | ||
User | ||
} from "./common"; | ||
declare class Event { | ||
private constructor(); | ||
public static create( | ||
maybeError: any, | ||
tolerateNonErrors: boolean, | ||
handledState: HandledState, | ||
component: string, | ||
errorFramesToSkip: number, | ||
logger?: Logger | ||
): Event; | ||
public static getStacktrace( | ||
error: any, | ||
errorFramesToSkip?: number, | ||
generatedFramesToSkip?: number, | ||
): Stackframe[]; | ||
public app: App; | ||
@@ -29,4 +37,4 @@ public device: Device; | ||
// user | ||
getUser(): { id?: string; email?: string; name?: string }; | ||
setUser(id?: string, email?: string, name?: string): void; | ||
public getUser(): User; | ||
public setUser(id?: string, email?: string, name?: string): void; | ||
@@ -62,23 +70,5 @@ // metadata | ||
stacktrace: Stackframe[]; | ||
type: string; | ||
} | ||
interface Device { | ||
runtimeVersions: { | ||
[key: string]: any; | ||
}; | ||
[key: string]: any; | ||
} | ||
interface App { | ||
version?: string; | ||
releaseStage?: string; | ||
type?: string; | ||
[key: string]: any; | ||
} | ||
interface Request { | ||
url?: string; | ||
[key: string]: any; | ||
} | ||
export default Event; |
@@ -5,4 +5,5 @@ import Breadcrumb from "./breadcrumb"; | ||
import Session from "./session"; | ||
import * as AbstractTypes from "./common"; | ||
import BugsnagStatic from "./bugsnag"; | ||
export { Breadcrumb, Client, Event, Session, AbstractTypes }; | ||
export * from "./common"; | ||
export { Breadcrumb, Client, Event, Session, BugsnagStatic }; |
import Event from "./event"; | ||
import { App, Device, User } from "./common"; | ||
@@ -6,9 +7,10 @@ declare class Session { | ||
public id: string; | ||
public events: { | ||
_handled: number; | ||
_unhandled: number; | ||
}; | ||
public track: (event: Event) => void; | ||
public device?: Device; | ||
public app?: App; | ||
public getUser(): User; | ||
public setUser(id?: string, email?: string, name?: string): void; | ||
} | ||
export default Session; |
@@ -1,40 +0,23 @@ | ||
import { Client, Breadcrumb, Event, Session, AbstractTypes } from "./bugsnag-core"; | ||
import { Client, Event, Logger, Config, BugsnagStatic } from "./bugsnag-core"; | ||
// overwrite config interface, adding browser-specific options | ||
declare module "./bugsnag-core" { | ||
interface Config { | ||
apiKey: string; | ||
appVersion?: string; | ||
appType?: string; | ||
autoDetectErrors?: boolean; | ||
autoDetectUnhandledRejections?: boolean; | ||
onError?: AbstractTypes.OnErrorCallback | AbstractTypes.OnErrorCallback[]; | ||
endpoints?: { notify: string; sessions?: string }; | ||
autoTrackSessions?: boolean; | ||
enabledReleaseStages?: string[]; | ||
releaseStage?: string; | ||
maxBreadcrumbs?: number; | ||
enabledBreadcrumbTypes?: AbstractTypes.BreadcrumbType[]; | ||
user?: { id?: string; name?: string; email?: string } | null; | ||
metadata?: object | null; | ||
logger?: AbstractTypes.Logger | null; | ||
redactedKeys?: Array<string | RegExp>; | ||
// catch-all for any missing options | ||
[key: string]: any; | ||
// options for all bundled browser plugins | ||
hostname?: string; | ||
onUncaughtException?: afterErrorCb; | ||
onUnhandledRejection?: afterErrorCb; | ||
agent?: any; | ||
projectRoot?: string; | ||
sendCode?: boolean; | ||
autoBreadcrumbs?: void; | ||
} | ||
type AfterErrorCb = (err: any, event: Event, logger: Logger) => void; | ||
interface NodeConfig extends Config { | ||
hostname?: string; | ||
onUncaughtException?: AfterErrorCb; | ||
onUnhandledRejection?: AfterErrorCb; | ||
agent?: any; | ||
projectRoot?: string; | ||
sendCode?: boolean; | ||
} | ||
type afterErrorCb = (err: any, report: BugsnagCore.Config, logger: BugsnagCore.Logger) => void; | ||
interface NodeBugsnagStatic extends BugsnagStatic { | ||
init(apiKeyOrOpts: string | NodeConfig): Client; | ||
createClient(apiKeyOrOpts: string | NodeConfig): Client; | ||
} | ||
declare const Bugsnag: AbstractTypes.BugsnagStatic; | ||
declare const Bugsnag: NodeBugsnagStatic; | ||
export default Bugsnag; | ||
export { Client, Breadcrumb, Event, Session, AbstractTypes }; | ||
export * from "./bugsnag-core"; | ||
export { NodeConfig }; |
{ | ||
"name": "@bugsnag/node", | ||
"version": "7.0.0-alpha.0", | ||
"version": "7.0.0-alpha.1", | ||
"main": "dist/bugsnag.js", | ||
@@ -28,13 +28,13 @@ "types": "dist/types/bugsnag.d.ts", | ||
"devDependencies": { | ||
"@bugsnag/core": "^7.0.0-alpha.0", | ||
"@bugsnag/delivery-node": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-contextualize": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-intercept": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-node-device": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-node-in-project": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-node-surrounding-code": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-node-uncaught-exception": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-node-unhandled-rejection": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-server-session": "^7.0.0-alpha.0", | ||
"@bugsnag/plugin-strip-project-root": "^7.0.0-alpha.0", | ||
"@bugsnag/core": "^7.0.0-alpha.1", | ||
"@bugsnag/delivery-node": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-contextualize": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-intercept": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-node-device": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-node-in-project": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-node-surrounding-code": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-node-uncaught-exception": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-node-unhandled-rejection": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-server-session": "^7.0.0-alpha.1", | ||
"@bugsnag/plugin-strip-project-root": "^7.0.0-alpha.1", | ||
"jasmine": "^3.1.0", | ||
@@ -50,3 +50,3 @@ "nyc": "^12.0.2" | ||
}, | ||
"gitHead": "44e41f2d9cce4a3aed93dd77e0c851119c2fe776" | ||
"gitHead": "55453140c2572284f8b34e3c2b8a8fec1e69c36e" | ||
} |
Sorry, the diff of this file is too big to display
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
2339
214275