Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 122 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"aws-sdk": "^2.1303.0",
"babel-jest": "^29.7.0",
"coverage-diff": "^1.6.0",
"downlevel-dts": "^0.11.0",
"electron": "*",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
Expand Down Expand Up @@ -100,5 +101,12 @@
},
"workspaces": [
"packages/*"
]
],
"typesVersions": {
"<4.0": {
"*": [
"ts3.8/*"
]
}
}
}
5 changes: 5 additions & 0 deletions ts3.8/examples/ts/angular/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
2 changes: 2 additions & 0 deletions ts3.8/packages/core/src/lib/async-every.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type NodeCallbackType<T = any> = (error?: Error | null, result?: T) => void;
export default function every<T>(arr: T[], fn: (item: T, cb: NodeCallbackType) => void, cb: NodeCallbackType<boolean>): void;
2 changes: 2 additions & 0 deletions ts3.8/packages/core/src/lib/callback-runner.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { NodeCallbackType } from './async-every';
export default function callbackRunner<T>(callbacks: any, event: T, onCallbackError: (err: Error) => void, cb: NodeCallbackType<boolean>): void;
1 change: 1 addition & 0 deletions ts3.8/packages/core/src/lib/es-utils/assign.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function assign(target: object, ...sources: any[]): any;
1 change: 1 addition & 0 deletions ts3.8/packages/core/src/lib/es-utils/includes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function includes<T>(arr: T[], item?: T): boolean;
6 changes: 6 additions & 0 deletions ts3.8/packages/core/src/safe-json-stringify.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '@bugsnag/safe-json-stringify' {
export default function stringify(value: any, replacer?: null | ((this: any, key: string, value: any) => any), space?: null | string | number, options?: {
redactedKeys?: Array<string | RegExp>;
redactedPaths?: string[];
}): string;
}
3 changes: 3 additions & 0 deletions ts3.8/packages/delivery-electron/delivery.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Client, Delivery } from '@bugsnag/core';
declare const delivery: (filestore: any, net: any, app: any) => (client: Client) => Delivery;
export default delivery;
6 changes: 6 additions & 0 deletions ts3.8/packages/delivery-electron/payload-loop.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare class PayloadDeliveryLoop {
constructor(send: (opts: any, body: any, completion: (err?: Error) => void) => void, queue: any, onerror?: (err: Error) => void, retryInterval?: number);
stop(): void;
start(): void;
}
export default PayloadDeliveryLoop;
13 changes: 13 additions & 0 deletions ts3.8/packages/delivery-electron/queue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare class PayloadQueue {
constructor(path: string, resource: string, onerror?: (err: Error) => void);
peek(): Promise<{
payload: {
url: string;
};
path: string;
} | null>;
init(): Promise<void>;
enqueue(req?: {}): Promise<void>;
remove(path: string): Promise<void>;
}
export default PayloadQueue;
5 changes: 5 additions & 0 deletions ts3.8/packages/delivery-fetch/delivery.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference lib="webworker" />
import type { Client, Delivery } from '@bugsnag/core';
type Fetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
declare const delivery: (client: Client, fetch?: Fetch, windowOrWorkerGlobalScope?: Window | ServiceWorkerGlobalScope) => Delivery;
export default delivery;
3 changes: 3 additions & 0 deletions ts3.8/packages/delivery-node/delivery.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Client, Delivery } from '@bugsnag/core';
declare const delivery: (client: Client) => Delivery;
export default delivery;
9 changes: 9 additions & 0 deletions ts3.8/packages/electron-network-status/network-status.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import EventEmitter from 'events';
declare class NetworkStatus {
constructor(plugin: {
emitter: EventEmitter;
}, net: any, app: any);
watch(watcher: (state: boolean) => void);
isConnected: boolean;
}
export default NetworkStatus;
45 changes: 45 additions & 0 deletions ts3.8/packages/electron/types/notifier.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Client, Config, Event, Logger, OnErrorCallback } from '@bugsnag/core';
type AfterErrorCallback = (err: any, event: Event, logger: Logger) => void;
type OnSendErrorCallback = OnErrorCallback;
interface MainConfig extends Config {
enabledErrorTypes?: {
unhandledExceptions?: boolean;
unhandledRejections?: boolean;
nativeCrashes?: boolean;
};
endpoints?: {
notify: string;
sessions: string;
minidumps?: string;
};
onSendError?: OnSendErrorCallback | OnSendErrorCallback[];
onUncaughtException?: AfterErrorCallback;
onUnhandledRejection?: AfterErrorCallback;
projectRoot?: string;
launchDurationMillis?: number;
sendCode?: boolean;
}
// a renderer is only allowed a subset of properties from Config
// this must match the "ALLOWED_IN_RENDERER" list in the renderer config
type AllowedRendererConfig = Pick<Config, 'onError' | 'onBreadcrumb' | 'logger' | 'metadata' | 'featureFlags' | 'user' | 'context' | 'plugins' | 'appType'>;
interface RendererConfig extends AllowedRendererConfig {
codeBundleId?: string;
}
interface LastRunInfo {
crashed: boolean;
crashedDuringLaunch: boolean;
consecutiveLaunchCrashes: number;
}
declare class ElectronClient extends Client {
markLaunchComplete: () => void;
readonly lastRunInfo: LastRunInfo | null;
}
interface ElectronBugsnagStatic extends ElectronClient {
start: (apiKeyOrOpts?: string | MainConfig | RendererConfig) => Client;
createClient: (apiKeyOrOpts?: string | MainConfig | RendererConfig) => Client;
isStarted(): boolean;
}
declare const Bugsnag: ElectronBugsnagStatic;
export default Bugsnag;
export * from '@bugsnag/core';
export { ElectronClient as Client, MainConfig, RendererConfig };
7 changes: 7 additions & 0 deletions ts3.8/packages/in-flight/types/bugsnag-in-flight.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Client } from '@bugsnag/core';
interface BugsnagInFlight {
trackInFlight(client: Client): void;
flush(timeoutMs: number): Promise<void>;
}
declare const BugsnagInFlightPlugin: BugsnagInFlight;
export default BugsnagInFlightPlugin;
9 changes: 9 additions & 0 deletions ts3.8/packages/js/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Client, BrowserConfig, BugsnagStatic } from '@bugsnag/browser';
import { NodeConfig } from '@bugsnag/node';
interface UniversalBugsnagStatic extends BugsnagStatic {
start(apiKeyOrOpts: string | BrowserConfig | NodeConfig): Client;
createClient(apiKeyOrOpts: string | BrowserConfig | NodeConfig): Client;
}
declare const Bugsnag: UniversalBugsnagStatic;
export default Bugsnag;
export * from '@bugsnag/browser';
2 changes: 2 additions & 0 deletions ts3.8/packages/node/src/notifier.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from '../types/bugsnag';
export * from '../types/bugsnag';
18 changes: 18 additions & 0 deletions ts3.8/packages/node/types/bugsnag.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Client, Event, Logger, Config, BugsnagStatic } from '@bugsnag/core';
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;
}
interface NodeBugsnagStatic extends BugsnagStatic {
start(apiKeyOrOpts: string | NodeConfig): Client;
createClient(apiKeyOrOpts: string | NodeConfig): Client;
}
declare const Bugsnag: NodeBugsnagStatic;
export default Bugsnag;
export * from '@bugsnag/core';
export { NodeConfig };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Client from '@bugsnag/core';
declare const plugin: {
load: (client: Client) => void;
};
export default plugin;
25 changes: 25 additions & 0 deletions ts3.8/packages/plugin-express/types/bugsnag-express.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Plugin, Client } from '@bugsnag/core';
import * as express from 'express';
declare const bugsnagPluginExpress: Plugin;
export default bugsnagPluginExpress;
interface BugsnagPluginExpressResult {
errorHandler: express.ErrorRequestHandler;
requestHandler: express.RequestHandler;
runInContext: express.RequestHandler;
}
// add a new call signature for the getPlugin() method that types the plugin result
declare module '@bugsnag/core' {
interface Client {
getPlugin(id: 'express'): BugsnagPluginExpressResult | undefined;
}
}
// define req.bugsnag for express request handlers by declaration merging on the
// global interfaces according to the pattern described in the DefinitelyTyped repo:
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0bd28530564c3da2e728518084f22648af3a683c/types/express-serve-static-core/index.d.ts#L18-L26
declare global {
namespace Express {
export interface Request {
bugsnag?: Client;
}
}
}
Loading