Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@backtrace/sdk-core

Package Overview
Dependencies
Maintainers
0
Versions
9
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 0.5.0 to 0.6.0

lib/common/intervalHelper.d.ts

6

lib/BacktraceCoreClient.d.ts
import { CoreClientSetup } from './builder/CoreClientSetup.js';
import { Events } from './common/Events.js';
import { ReportEvents } from './events/ReportEvents.js';
import { ClientEvents } from './events/ClientEvents.js';
import { BacktraceAttachment, BacktraceBreadcrumbs, BacktraceConfiguration, BacktraceReportSubmissionResult, BacktraceSubmissionResponse, FileSystem, SessionFiles } from './index.js';

@@ -13,3 +13,3 @@ import { AttributeType, BacktraceData } from './model/data/BacktraceData.js';

import { BacktraceMetrics } from './modules/metrics/BacktraceMetrics.js';
export declare abstract class BacktraceCoreClient<O extends BacktraceConfiguration = BacktraceConfiguration> {
export declare abstract class BacktraceCoreClient<O extends BacktraceConfiguration = BacktraceConfiguration> extends Events<ClientEvents> {
/**

@@ -56,3 +56,2 @@ * Backtrace client instance

protected readonly options: O;
protected readonly reportEvents: Events<ReportEvents>;
protected readonly attributeManager: AttributeManager;

@@ -113,2 +112,3 @@ protected readonly attachmentManager: AttachmentManager;

private static destroy;
private validateAttributes;
}

@@ -5,3 +5,3 @@ import { BacktraceReportSubmission } from '../model/http/BacktraceReportSubmission.js';

import { BacktraceAttributeProvider } from '../modules/attribute/BacktraceAttributeProvider.js';
import { BreadcrumbsEventSubscriber, BreadcrumbsStorage } from '../modules/breadcrumbs/index.js';
import { BreadcrumbsEventSubscriber, BreadcrumbsStorage, BreadcrumbsStorageFactory } from '../modules/breadcrumbs/index.js';
import { BacktraceStackTraceConverter } from '../modules/converter/index.js';

@@ -22,2 +22,6 @@ import { BacktraceSessionProvider } from '../modules/metrics/BacktraceSessionProvider.js';

useBreadcrumbSubscriber(breadcrumbSubscriber: BreadcrumbsEventSubscriber): this;
useBreadcrumbsStorage(storageFactory: BreadcrumbsStorageFactory): this;
/**
* @deprecated Use `useBreadcrumbsStorage` with `BreadcrumbsStorageFactory`.
*/
useBreadcrumbsStorage(storage: BreadcrumbsStorage): this;

@@ -24,0 +28,0 @@ useSessionProvider(sessionProvider: BacktraceSessionProvider): this;

@@ -1,9 +0,10 @@

export declare class Events<E extends Record<string | number | symbol, (...args: any[]) => unknown> = Record<string | number | symbol, (...args: any[]) => unknown>> {
export type EventMap = Record<string, any[]>;
export declare class Events<E extends EventMap = EventMap> {
private readonly _callbacks;
on<N extends keyof E>(event: N, callback: E[N]): this;
once<N extends keyof E>(event: N, callback: E[N]): this;
off<N extends keyof E>(event: N, callback: E[N]): this;
emit<N extends keyof E>(event: N, ...args: Parameters<E[N]>): boolean;
on<N extends keyof E>(event: N, callback: (...args: E[N]) => unknown): this;
once<N extends keyof E>(event: N, callback: (...args: E[N]) => unknown): this;
off<N extends keyof E>(event: N, callback: (...args: E[N]) => unknown): this;
emit<N extends keyof E>(event: N, ...args: E[N]): boolean;
private addCallback;
private removeCallback;
}

@@ -1,1 +0,1 @@

export declare function jsonEscaper(): (this: unknown, key: string, value: unknown) => unknown;
export declare function jsonEscaper(): (this: unknown, key: string, value: unknown) => {} | null | undefined;
export * from './OverwritingArray.js';
export * from './OverwritingArrayIterator.js';
export declare class OverwritingArray<T> {
readonly capacity: number;
private _array;
private _index;
private _size;
private _startIndex;
constructor(capacity: number);
add(value: T): this;
clear(): void;
private readonly _headConstraint;
private readonly _lengthConstraint;
private _head;
private _length;
private get head();
private set head(value);
get length(): number;
set length(value: number);
private get start();
constructor(capacity: number, items?: T[]);
add(item: T): void;
push(...items: T[]): number;
pop(): T | undefined;
shift(): T | undefined;
at(index: number): T | undefined;
values(): IterableIterator<T>;
keys(): IterableIterator<number>;
entries(): IterableIterator<[number, T]>;
[Symbol.iterator](): IterableIterator<T>;
private incrementIndex;
private incrementStartingIndex;
private incrementSize;
private createArray;
private pushOne;
private index;
}
import { BacktraceAttachment } from '../model/attachment/index.js';
export type AttachmentEvents = {
'scoped-attachments-updated'(attachments: BacktraceAttachment[]): void;
'scoped-attachments-updated': [attachments: BacktraceAttachment[]];
};
import { ReportData } from '../model/report/ReportData.js';
export type AttributeEvents = {
'scoped-attributes-updated'(attributes: ReportData): void;
'scoped-attributes-updated': [attributes: ReportData];
};

@@ -44,5 +44,39 @@ import { BreadcrumbLogLevel, BreadcrumbType } from '../../modules/breadcrumbs/index.js';

* will be stored.
*
* Use `false` to disable the limit.
* @default 100
*/
maximumBreadcrumbs?: number;
maximumBreadcrumbs?: number | false;
/**
* Specifies maximum object depth that are included in breadcrumb attributes.
*
* Use `false` to disable the limit.
* @default 2
*/
maximumAttributesDepth?: number | false;
/**
* Specifies maximum breadcrumb message length.
* If the size is exceeded, message will be truncated.
*
* Use `false` to disable the limit.
* @default 255
*/
maximumBreadcrumbMessageLength?: number | false;
/**
* Specifies maximum single breadcrumb size in bytes.
* If the size is exceeded, the breadcrumb will be skipped.
*
* Use `false` to disable the limit.
* @default 65536 // 64kB
*/
maximumBreadcrumbSize?: number | false;
/**
* Specifies maximum breadcrumbs size in bytes.
* If the size is exceeded, oldest breadcrumbs will be skipped.
*
* Use `false` to disable the limit.
* @default 1048576 // 1MB
*/
maximumTotalBreadcrumbsSize?: number | false;
/**
* Inspects breadcrumb and allows to modify it. If the undefined value is being

@@ -49,0 +83,0 @@ * returned from the method, no breadcrumb will be added to the breadcrumb storage.

@@ -14,3 +14,3 @@ import { BacktraceAttachment } from '../../model/attachment/index.js';

*/
get(): BacktraceAttachment;
get(): BacktraceAttachment | BacktraceAttachment[] | undefined;
}

@@ -1,3 +0,1 @@

import { Events } from '../common/Events.js';
import { ReportEvents } from '../events/ReportEvents.js';
import { BacktraceConfiguration, BacktraceCoreClient, BacktraceRequestHandler, FileSystem, SessionFiles } from '../index.js';

@@ -13,3 +11,2 @@ import { BacktraceReportSubmission } from '../model/http/BacktraceReportSubmission.js';

readonly attachmentManager: AttachmentManager;
readonly reportEvents: Events<ReportEvents>;
readonly reportSubmission: BacktraceReportSubmission;

@@ -16,0 +13,0 @@ readonly requestHandler: BacktraceRequestHandler;

@@ -6,3 +6,3 @@ import { BacktraceBreadcrumbsSettings } from '../../model/configuration/BacktraceConfiguration.js';

import { BreadcrumbsEventSubscriber } from './events/BreadcrumbsEventSubscriber.js';
import { BacktraceBreadcrumbs, BreadcrumbLogLevel, BreadcrumbsSetup, BreadcrumbsStorage, BreadcrumbType } from './index.js';
import { BacktraceBreadcrumbs, BreadcrumbLogLevel, BreadcrumbsSetup, BreadcrumbsStorage, BreadcrumbsStorageFactory, BreadcrumbType } from './index.js';
export declare class BreadcrumbsManager implements BacktraceBreadcrumbs, BacktraceModule {

@@ -21,2 +21,3 @@ /**

private _enabled;
private readonly _limits;
private readonly _eventSubscribers;

@@ -27,5 +28,9 @@ private readonly _interceptor?;

addEventSubscriber(subscriber: BreadcrumbsEventSubscriber): void;
setStorage(storageFactory: BreadcrumbsStorageFactory): void;
/**
* @deprecated Use `useStorage` with `BreadcrumbsStorageFactory`.
*/
setStorage(storage: BreadcrumbsStorage): void;
dispose(): void;
bind({ client, reportEvents, attachmentManager }: BacktraceModuleBindData): void;
bind({ client, attachmentManager }: BacktraceModuleBindData): void;
initialize(): void;

@@ -32,0 +37,0 @@ verbose(message: string, attributes?: Record<string, AttributeType> | undefined): boolean;

import { BreadcrumbsEventSubscriber } from './events/BreadcrumbsEventSubscriber.js';
import { BreadcrumbsStorage } from './storage/BreadcrumbsStorage.js';
import { BreadcrumbsStorageFactory } from './storage/BreadcrumbsStorage.js';
export interface BreadcrumbsSetup {
storage?: BreadcrumbsStorage;
storage?: BreadcrumbsStorageFactory;
subscribers?: BreadcrumbsEventSubscriber[];
}

@@ -0,1 +1,2 @@

import { Limited } from '../../../common/limitObjectDepth.js';
import { AttributeType } from '../../../model/data/BacktraceData.js';

@@ -8,3 +9,3 @@ export interface Breadcrumb {

type: string;
attributes?: Record<string, AttributeType>;
attributes?: Limited<Record<string, AttributeType>>;
}

@@ -0,1 +1,2 @@

import { Limited } from '../../../common/limitObjectDepth.js';
import { AttributeType } from '../../../model/data/index.js';

@@ -10,1 +11,7 @@ import { BreadcrumbLogLevel } from './BreadcrumbLogLevel.js';

}
export interface LimitedRawBreadcrumb {
message: string;
level: BreadcrumbLogLevel;
type: BreadcrumbType;
attributes?: Limited<Record<string, AttributeType>>;
}
import { BacktraceAttachment } from '../../../model/attachment/index.js';
import { BacktraceAttachmentProvider } from '../../attachments/BacktraceAttachmentProvider.js';
import { RawBreadcrumb } from '../model/RawBreadcrumb.js';
import { LimitedRawBreadcrumb, RawBreadcrumb } from '../model/RawBreadcrumb.js';
export interface BreadcrumbsStorageOptions {
readonly limits: BreadcrumbsStorageLimits;
}
export interface BreadcrumbsStorageLimits {
/**
* Specifies maximum number of breadcrumbs stored by the storage. By default, only 100 breadcrumbs
* will be stored.
*/
readonly maximumBreadcrumbs?: number;
/**
* Specifies maximum breadcrumbs size in bytes.
* If the size is exceeded, oldest breadcrumbs will be skipped.
*/
readonly maximumTotalBreadcrumbsSize?: number;
}
export type BreadcrumbsStorageFactory = (options: BreadcrumbsStorageOptions) => BreadcrumbsStorage;
export interface BreadcrumbsStorage {

@@ -13,3 +29,3 @@ /**

*/
add(rawBreadcrumb: RawBreadcrumb): number;
add(rawBreadcrumb: RawBreadcrumb | LimitedRawBreadcrumb): number | undefined;
/**

@@ -16,0 +32,0 @@ * Gets attachments associated with this storage.

import { BacktraceAttachment } from '../../../model/attachment/index.js';
import { BacktraceAttachmentProvider } from '../../attachments/BacktraceAttachmentProvider.js';
import { RawBreadcrumb } from '../model/RawBreadcrumb.js';
import { BreadcrumbsStorage } from './BreadcrumbsStorage.js';
import { BreadcrumbsStorage, BreadcrumbsStorageLimits, BreadcrumbsStorageOptions } from './BreadcrumbsStorage.js';
export declare class InMemoryBreadcrumbsStorage implements BreadcrumbsStorage, BacktraceAttachment {
private readonly _limits;
get lastBreadcrumbId(): number;

@@ -13,5 +14,7 @@ /**

private _breadcrumbs;
constructor(maximumBreadcrumbs?: number);
private _breadcrumbSizes;
constructor(_limits: BreadcrumbsStorageLimits);
getAttachments(): BacktraceAttachment<unknown>[];
getAttachmentProviders(): BacktraceAttachmentProvider[];
static factory({ limits }: BreadcrumbsStorageOptions): InMemoryBreadcrumbsStorage;
/**

@@ -23,2 +26,3 @@ * Returns breadcrumbs in the JSON format

add(rawBreadcrumb: RawBreadcrumb): number;
private totalSize;
}

@@ -0,1 +1,2 @@

import { Events } from '../../common/Events.js';
import { BacktraceAttachment } from '../../model/attachment/index.js';

@@ -7,5 +8,6 @@ import { BacktraceDatabaseConfiguration } from '../../model/configuration/BacktraceDatabaseConfiguration.js';

import { SessionFiles } from '../storage/index.js';
import { BacktraceDatabaseEvents } from './BacktraceDatabaseEvents.js';
import { BacktraceDatabaseStorageProvider } from './BacktraceDatabaseStorageProvider.js';
import { AttachmentBacktraceDatabaseRecord, BacktraceDatabaseRecord, BacktraceDatabaseRecordCountByType, ReportBacktraceDatabaseRecord } from './model/BacktraceDatabaseRecord.js';
export declare class BacktraceDatabase implements BacktraceModule {
export declare class BacktraceDatabase extends Events<BacktraceDatabaseEvents> implements BacktraceModule {
private readonly _options;

@@ -36,3 +38,3 @@ private readonly _storageProvider;

initialize(): boolean;
bind({ reportEvents }: BacktraceModuleBindData): void;
bind({ client }: BacktraceModuleBindData): void;
/**

@@ -39,0 +41,0 @@ * Adds backtrace data to the database

import { BacktraceMetricsOptions } from '../../model/configuration/BacktraceConfiguration.js';
import { AttributeType } from '../../model/data/BacktraceData.js';
import { AttributeManager } from '../attribute/AttributeManager.js';
import { BacktraceModule } from '../BacktraceModule.js';
import { AttributeManager } from '../attribute/AttributeManager.js';
import { BacktraceSessionProvider } from './BacktraceSessionProvider.js';

@@ -6,0 +6,0 @@ import { MetricsQueue } from './MetricsQueue.js';

{
"name": "@backtrace/sdk-core",
"version": "0.5.0",
"version": "0.6.0",
"description": "Backtrace-JavaScript SDK core library",

@@ -5,0 +5,0 @@ "main": "lib/bundle.cjs",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc