Skip to content
Merged
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
2 changes: 1 addition & 1 deletion examples/sdk/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"start": "NODE_ENV=production node ./lib/index.js",
"start": "cross-env NODE_ENV=production node ./lib/index.js",
"watch": "tsc -w"
},
"repository": {
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@types/semver": "^7.5.3",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"cross-env": "^7.0.3",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"clean": "rimraf common main renderer",
"format": "prettier --write '**/*.ts'",
"lint": "eslint src --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest --passWithNoTests"
"test": "cross-env NODE_ENV=test jest --passWithNoTests"
},
"keywords": [
"Error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export interface WindowAttributeProviderOptions {
}

export class WindowAttributeProvider implements BacktraceAttributeProvider {
constructor(private readonly _window: BrowserWindow, private readonly _options?: WindowAttributeProviderOptions) {}
constructor(
private readonly _window: BrowserWindow,
private readonly _options?: WindowAttributeProviderOptions,
) {}

public readonly type = 'dynamic';

Expand Down
6 changes: 5 additions & 1 deletion packages/electron/src/main/ipc/ReadableIpcStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { ipcHandshake } from '../../common/ipc/ipcHandshake';
export class ReadableIpcStream extends Readable {
private _isConnected = false;

constructor(private readonly _name: string, private readonly _ipc: IpcTransport, opts?: ReadableOptions) {
constructor(
private readonly _name: string,
private readonly _ipc: IpcTransport,
opts?: ReadableOptions,
) {
super(opts);

const close = () => this.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ export class BacktraceMainElectronModule implements BacktraceModule {
}

function toStringDictionary(record: Record<string, unknown>): Record<string, string> {
return Object.keys(record).reduce((obj, key) => {
obj[key] = record[key]?.toString() ?? '';
return obj;
}, {} as Record<string, string>);
return Object.keys(record).reduce(
(obj, key) => {
obj[key] = record[key]?.toString() ?? '';
return obj;
},
{} as Record<string, string>,
);
}
6 changes: 5 additions & 1 deletion packages/electron/src/main/modules/IpcAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { IpcTransport } from '../../common';
import { ReadableIpcStream } from '../ipc/ReadableIpcStream';

export class IpcAttachment implements BacktraceAttachment {
constructor(public readonly name: string, private readonly _id: string, private readonly _ipc: IpcTransport) {}
constructor(
public readonly name: string,
private readonly _id: string,
private readonly _ipc: IpcTransport,
) {}

public get(): Readable {
return new ReadableIpcStream(this._id, this._ipc);
Expand Down
5 changes: 4 additions & 1 deletion packages/electron/src/renderer/ipc/WritableIpcStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export class WritableIpcStream<W> extends WritableStream<W> {
class WritableIpcStreamSink<W> implements UnderlyingSink<W> {
private _isPaused = false;

constructor(private readonly _name: string, private readonly _ipc: IpcTransport) {
constructor(
private readonly _name: string,
private readonly _ipc: IpcTransport,
) {
this._ipc.on(IpcEvents.streamEvent(_name, 'pause'), () => (this._isPaused = true));
this._ipc.on(IpcEvents.streamEvent(_name, 'resume'), () => (this._isPaused = false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import { IpcRpc } from '../../common/ipc/IpcRpc';
import { WritableIpcStream } from '../ipc/WritableIpcStream';

export class IpcReportSubmission implements BacktraceReportSubmission {
constructor(private readonly _ipcRpc: IpcRpc, private readonly _ipcTransport: IpcTransport) {}
constructor(
private readonly _ipcRpc: IpcRpc,
private readonly _ipcTransport: IpcTransport,
) {}

public send(
data: BacktraceData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export class IpcSummedMetricsQueue implements MetricsQueue<SummedEvent> {
public readonly submissionUrl = '';
public readonly maximumEvents = -1;

constructor(private readonly _ipcTransport: IpcTransport, private readonly _ipcRpc: IpcRpc) {}
constructor(
private readonly _ipcTransport: IpcTransport,
private readonly _ipcRpc: IpcRpc,
) {}

public add(event: SummedEvent): void {
this._ipcTransport.emit(IpcEvents.addSummedMetric, event);
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest --passWithNoTests"
"test": "cross-env NODE_ENV=test jest --passWithNoTests"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/BacktraceNodeRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
this.reason instanceof Error
? this.reason
: typeof this.reason === 'string'
? new Error(this.reason)
: new Error('Operation cancelled.');
? new Error(this.reason)
: new Error('Operation cancelled.');

request.destroy(reason);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/node/src/attachment/BacktraceBufferAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { BacktraceAttachment } from '@backtrace/sdk-core';

export class BacktraceBufferAttachment implements BacktraceAttachment<Buffer> {
constructor(public readonly name: string, public readonly buffer: Buffer) {}
constructor(
public readonly name: string,
public readonly buffer: Buffer,
) {}
public get(): Buffer {
return this.buffer;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/node/src/attachment/BacktraceFileAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { Readable } from 'stream';
export class BacktraceFileAttachment implements CoreBacktraceFileAttachment<Readable> {
public readonly name: string;

constructor(public readonly filePath: string, name?: string) {
constructor(
public readonly filePath: string,
name?: string,
) {
this.name = name ?? path.basename(this.filePath);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/node/tests/_mocks/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export function mockStreamFileSystem(files?: Record<string, string>): MockedFile
const str = Buffer.isBuffer(chunk)
? chunk.toString('utf-8')
: typeof chunk === 'string'
? chunk
: String(chunk).toString();
? chunk
: String(chunk).toString();

const fullPath = path.resolve(p);
if (!fs.files[fullPath]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"clean": "rimraf \"lib\"",
"format:check": "eslint \"**/*.{js,ts,tsx}\"",
"prepublishOnly": "bob build",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"keywords": [
"Error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { NativeModules } from 'react-native';
export class NativeAttributeProvider implements BacktraceAttributeProvider {
private readonly _provider: { get(): Record<string, AttributeType> };

constructor(private readonly _name: string, public readonly type: 'scoped' | 'dynamic') {
constructor(
private readonly _name: string,
public readonly type: 'scoped' | 'dynamic',
) {
this._provider = NativeModules?.[this._name];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export class UnhandledExceptionHandler implements ExceptionHandler {
message = cachedPrettyFormat
? cachedPrettyFormat(rejection)
: typeof rejection === 'string'
? rejection
: JSON.stringify({ ...rejection });
? rejection
: JSON.stringify({ ...rejection });
}

const warning =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export class AndroidUnhandledException extends Error {
constructor(public readonly name: string, public readonly message: string, public readonly stack: string) {
constructor(
public readonly name: string,
public readonly message: string,
public readonly stack: string,
) {
super(message);
}
}
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"watch": "tsc -w",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-core/src/common/abortInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ function getGlobal<K extends keyof typeof window>(key: K): (typeof window)[K] |
return typeof window !== 'undefined'
? window[key as keyof typeof window]
: typeof global !== 'undefined'
? global[key as keyof typeof global]
: typeof self !== 'undefined'
? self[key as keyof typeof self]
: undefined;
? global[key as keyof typeof global]
: typeof self !== 'undefined'
? self[key as keyof typeof self]
: undefined;
}

export type OriginalAbortController = AbortController;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export class OverwritingArrayIterator<T> implements IterableIterator<T> {
private _index?: number;

constructor(private readonly _source: T[], private readonly _offset: number, private readonly _size: number) {}
constructor(
private readonly _source: T[],
private readonly _offset: number,
private readonly _size: number,
) {}

[Symbol.iterator](): IterableIterator<T> {
return new OverwritingArrayIterator(this._source, this._offset, this._size);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { BacktraceAttachment } from './BacktraceAttachment';

export class BacktraceStringAttachment implements BacktraceAttachment<string> {
constructor(public readonly name: string, public readonly data: string) {}
constructor(
public readonly name: string,
public readonly data: string,
) {}

public get(): string {
return this.data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { BacktraceAttachment } from './BacktraceAttachment';

export class BacktraceUint8ArrayAttachment implements BacktraceAttachment<Blob> {
constructor(public readonly name: string, public readonly data: Uint8Array) {}
constructor(
public readonly name: string,
public readonly data: Uint8Array,
) {}

public get(): Blob {
return new Blob([this.data.buffer]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export class BacktraceReportSubmissionResult<T> {
private _result?: T;
private constructor(response: T);
private constructor(_status: BacktraceSubmissionStatus, _message?: string);
private constructor(statusOrResponse: T | BacktraceSubmissionStatus, public readonly message?: string) {
private constructor(
statusOrResponse: T | BacktraceSubmissionStatus,
public readonly message?: string,
) {
if (this.isSubmissionResponse(statusOrResponse)) {
this.status = statusOrResponse;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export interface BacktraceReportSubmission {

export class RequestBacktraceReportSubmission {
private readonly _submissionUrl: string;
constructor(options: BacktraceConfiguration, private readonly _requestHandler: BacktraceRequestHandler) {
constructor(
options: BacktraceConfiguration,
private readonly _requestHandler: BacktraceRequestHandler,
) {
this._submissionUrl = SubmissionUrlInformation.toJsonReportSubmissionUrl(options.url, options.token);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const ATTRIBUTE_FILE_NAME = 'bt-attributes';
export class FileAttributeManager implements BacktraceModule {
private _attributeManager?: AttributeManager;

constructor(private readonly _fileSystem: FileSystem, private _fileName?: string) {}
constructor(
private readonly _fileSystem: FileSystem,
private _fileName?: string,
) {}

public static create(fileSystem: FileSystem) {
return new FileAttributeManager(fileSystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export class BacktraceDatabaseFileRecord implements BacktraceDatabaseRecord {
public readonly timestamp: number;
public locked: boolean;

private constructor(record: BacktraceDatabaseRecord, public readonly attachments: BacktraceAttachment[]) {
private constructor(
record: BacktraceDatabaseRecord,
public readonly attachments: BacktraceAttachment[],
) {
this.data = record.data;
this.id = record.id;
this.count = record.count;
Expand Down
Loading