@sourav732/error-tracker-js 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/constants.d.ts +12 -3
- package/dist/types/core/eventQueue.d.ts +8 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const SDK_NAME = "error-tracker-js";
|
|
6
6
|
/** Must match package.json "version" (a test enforces this). */
|
|
7
|
-
export declare const SDK_VERSION = "0.
|
|
7
|
+
export declare const SDK_VERSION = "0.2.0";
|
|
8
8
|
export declare const PLATFORM = "js";
|
|
9
9
|
export declare const DEFAULT_SAMPLE_RATE = 1;
|
|
10
10
|
export declare const DEFAULT_MAX_BREADCRUMBS = 30;
|
|
@@ -14,6 +14,12 @@ export declare const DEFAULT_ENVIRONMENT = "production";
|
|
|
14
14
|
export declare const API_KEY_HEADER = "X-API-Key";
|
|
15
15
|
export declare const CONTENT_TYPE_JSON = "application/json";
|
|
16
16
|
export declare const BATCH_SIZE = 10;
|
|
17
|
+
/**
|
|
18
|
+
* Max serialized size of one request. Serverless hosts cap request bodies
|
|
19
|
+
* (Vercel: 4.5 MB); batches are split to stay well below that. A single event
|
|
20
|
+
* larger than this is still sent on its own.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MAX_BATCH_BYTES = 1000000;
|
|
17
23
|
/** How long to wait for more events before sending a partial batch. */
|
|
18
24
|
export declare const FLUSH_DELAY_MS = 2000;
|
|
19
25
|
/** Backoff before each retry; length of this array is the retry count. */
|
|
@@ -84,16 +90,19 @@ export declare const DEFAULT_HTML2CANVAS_URL = "https://cdnjs.cloudflare.com/aja
|
|
|
84
90
|
/** Subresource-integrity hash of DEFAULT_HTML2CANVAS_URL. */
|
|
85
91
|
export declare const DEFAULT_HTML2CANVAS_INTEGRITY = "sha384-ZZ1pncU3bQe8y31yfZdMFdSpttDoPmOZg2wguVK9almUodir1PghgT0eY7Mrty8H";
|
|
86
92
|
export declare const SCREENSHOT_MIME_TYPE = "image/jpeg";
|
|
87
|
-
export declare const SCREENSHOT_QUALITY = 0.
|
|
93
|
+
export declare const SCREENSHOT_QUALITY = 0.5;
|
|
88
94
|
/** Fallback quality used when the first encode is over the size budget. */
|
|
89
95
|
export declare const SCREENSHOT_FALLBACK_QUALITY = 0.3;
|
|
90
96
|
/** Max base64 length of a screenshot data URL (~750 KB). */
|
|
91
|
-
|
|
97
|
+
/** Max base64 length of a screenshot data URL (~370 KB of image; the backend refuses > 400 KB). */
|
|
98
|
+
export declare const MAX_SCREENSHOT_LENGTH = 500000;
|
|
92
99
|
/** Library load + render must finish within this or the event is sent without it. */
|
|
93
100
|
export declare const SCREENSHOT_TIMEOUT_MS = 3000;
|
|
94
101
|
/** At most one screenshot per interval to protect the host app's main thread. */
|
|
95
102
|
export declare const SCREENSHOT_MIN_INTERVAL_MS = 10000;
|
|
96
103
|
export declare const SCREENSHOT_MAX_SCALE = 1;
|
|
104
|
+
/** Screenshots are downscaled so they are at most this many pixels wide. */
|
|
105
|
+
export declare const SCREENSHOT_MAX_WIDTH = 1280;
|
|
97
106
|
export declare const MASK_COLOR = "#000000";
|
|
98
107
|
/** Always masked, in addition to config.maskSelectors. */
|
|
99
108
|
export declare const DEFAULT_MASK_SELECTORS: readonly string[];
|
|
@@ -8,6 +8,8 @@ export interface EventQueueOptions {
|
|
|
8
8
|
store: OfflineStore;
|
|
9
9
|
logger: Logger;
|
|
10
10
|
batchSize?: number;
|
|
11
|
+
/** Max serialized bytes per request; defaults to MAX_BATCH_BYTES. */
|
|
12
|
+
maxBatchBytes?: number;
|
|
11
13
|
flushDelayMs?: number;
|
|
12
14
|
retryDelaysMs?: readonly number[];
|
|
13
15
|
/** Injectable for tests; defaults to setTimeout. */
|
|
@@ -28,6 +30,7 @@ export declare class EventQueue {
|
|
|
28
30
|
private readonly store;
|
|
29
31
|
private readonly logger;
|
|
30
32
|
private readonly batchSize;
|
|
33
|
+
private readonly maxBatchBytes;
|
|
31
34
|
private readonly flushDelayMs;
|
|
32
35
|
private readonly retryDelaysMs;
|
|
33
36
|
private readonly schedule;
|
|
@@ -47,6 +50,11 @@ export declare class EventQueue {
|
|
|
47
50
|
close(): void;
|
|
48
51
|
private scheduleFlush;
|
|
49
52
|
private cancelTimer;
|
|
53
|
+
/**
|
|
54
|
+
* How many queued events fit in the next request: at most batchSize events
|
|
55
|
+
* and at most maxBatchBytes serialized (always at least one event).
|
|
56
|
+
*/
|
|
57
|
+
private nextBatchLength;
|
|
50
58
|
/** Sends batch after batch until the queue is empty or delivery has to stop. */
|
|
51
59
|
private drain;
|
|
52
60
|
}
|
package/package.json
CHANGED