New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@backtrace/sdk-core

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backtrace/sdk-core - npm Package Compare versions

Comparing version

to
0.3.2

lib/dataStructures/index.d.ts

2

lib/builder/BacktraceCoreClientBuilder.d.ts
import { BacktraceReportSubmission } from '../model/http/BacktraceReportSubmission';
import { BacktraceRequestHandler } from '../model/http/BacktraceRequestHandler';
import { BacktraceModule } from '../modules/BacktraceModule';
import { BacktraceAttributeProvider } from '../modules/attribute/BacktraceAttributeProvider';

@@ -28,3 +29,4 @@ import { BreadcrumbsEventSubscriber, BreadcrumbsStorage } from '../modules/breadcrumbs';

useUniqueMetricsQueue(queue: MetricsQueue<UniqueEvent>): this;
useModule(module: BacktraceModule): this;
}
export {};

@@ -64,4 +64,13 @@ "use strict";

}
useModule(module) {
if (!this.clientSetup.modules) {
this.clientSetup.modules = [module];
}
else {
this.clientSetup.modules.push(module);
}
return this;
}
}
exports.BacktraceCoreClientBuilder = BacktraceCoreClientBuilder;
//# sourceMappingURL=BacktraceCoreClientBuilder.js.map

@@ -9,2 +9,3 @@ export * from './BacktraceCoreClient';

export * from './common/jsonEscaper';
export * from './dataStructures';
export * from './model/attachment';

@@ -11,0 +12,0 @@ export * from './model/configuration/BacktraceConfiguration';

@@ -27,2 +27,3 @@ "use strict";

__exportStar(require("./common/jsonEscaper"), exports);
__exportStar(require("./dataStructures"), exports);
__exportStar(require("./model/attachment"), exports);

@@ -29,0 +30,0 @@ __exportStar(require("./model/configuration/BacktraceConfiguration"), exports);

@@ -18,2 +18,7 @@ import { BacktraceAttachment } from '../../model/attachment';

get enabled(): boolean;
/**
* Abort controller to cancel asynchronous database operations when
* the database is being disabled by the user.
*/
private readonly _abortController;
private readonly _databaseRecordContext;

@@ -62,8 +67,10 @@ private readonly _storageProviders;

* no matter if the submission process was successful or not.
* @param abortSignal optional abort signal to cancel sending requests
*/
flush(): Promise<void>;
flush(abortSignal?: AbortSignal): Promise<void>;
/**
* Sends all records available in the database to Backtrace.
* @param abortSignal optional abort signal to cancel sending requests
*/
send(): Promise<void>;
send(abortSignal?: AbortSignal): Promise<void>;
/**

@@ -70,0 +77,0 @@ * Prepare database to insert records

@@ -13,2 +13,3 @@ "use strict";

exports.BacktraceDatabase = void 0;
const AbortController_1 = require("../../common/AbortController");
const IdGenerator_1 = require("../../common/IdGenerator");

@@ -30,2 +31,7 @@ const TimeHelper_1 = require("../../common/TimeHelper");

this._sessionFiles = _sessionFiles;
/**
* Abort controller to cancel asynchronous database operations when
* the database is being disabled by the user.
*/
this._abortController = (0, AbortController_1.createAbortController)();
this._storageProviders = [];

@@ -138,2 +144,3 @@ this._enabled = false;

clearInterval(this._intervalId);
this._abortController.abort();
}

@@ -165,9 +172,13 @@ /**

* no matter if the submission process was successful or not.
* @param abortSignal optional abort signal to cancel sending requests
*/
flush() {
flush(abortSignal) {
return __awaiter(this, void 0, void 0, function* () {
const start = TimeHelper_1.TimeHelper.now();
yield this.send();
yield this.send(abortSignal);
const records = this.get().filter((n) => n.timestamp <= start);
for (const record of records) {
if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
return;
}
this.remove(record);

@@ -179,4 +190,5 @@ }

* Sends all records available in the database to Backtrace.
* @param abortSignal optional abort signal to cancel sending requests
*/
send() {
send(abortSignal) {
return __awaiter(this, void 0, void 0, function* () {

@@ -186,3 +198,7 @@ for (let bucketIndex = 0; bucketIndex < this._databaseRecordContext.bucketCount; bucketIndex++) {

const records = [...this._databaseRecordContext.getBucket(bucketIndex)];
const signal = (0, AbortController_1.anySignal)(abortSignal, this._abortController.signal);
for (const record of records) {
if (!this.enabled) {
return;
}
if (record.locked) {

@@ -193,3 +209,3 @@ continue;

record.locked = true;
const result = yield this._requestHandler.send(record.data, record.attachments);
const result = yield this._requestHandler.send(record.data, record.attachments, signal);
if (result.status === 'Ok') {

@@ -196,0 +212,0 @@ this.remove(record);

2

package.json
{
"name": "@backtrace/sdk-core",
"version": "0.3.1",
"version": "0.3.2",
"description": "Backtrace-JavaScript SDK core library",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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