@goliapkg/sentori-react-native 5.6.1 → 5.7.1
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/lib/init.d.ts.map +1 -1
- package/lib/init.js +15 -1
- package/lib/init.js.map +1 -1
- package/lib/replay-screens.d.ts +11 -0
- package/lib/replay-screens.d.ts.map +1 -1
- package/lib/replay-screens.js +14 -0
- package/lib/replay-screens.js.map +1 -1
- package/lib/transport.js +1 -1
- package/package.json +1 -13
- package/src/__tests__/replay-screens.test.ts +29 -0
- package/src/init.ts +19 -1
- package/src/replay-screens.ts +16 -0
- package/src/transport.ts +1 -1
package/lib/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAwBzD,eAAO,MAAM,IAAI,0CAqGf,CAAC;AAGH,eAAO,MAAM,eAAe,QAAO,IAElC,CAAC"}
|
package/lib/init.js
CHANGED
|
@@ -15,7 +15,7 @@ import { armLaunch } from './launch';
|
|
|
15
15
|
import { markNativeJsBridgeReady, setNativeConfig } from './native';
|
|
16
16
|
import { shipNativePending } from './native-pending';
|
|
17
17
|
import { drainReplay, startReplay } from './replay';
|
|
18
|
-
import { drainScreenReplay, startScreenReplay } from './replay-screens';
|
|
18
|
+
import { drainScreenReplay, screenReplayArmed, screenReplayCaptured, startScreenReplay, } from './replay-screens';
|
|
19
19
|
import { drainOfflineQueue, queueAttachment, startTransport } from './transport';
|
|
20
20
|
let _initialized = false;
|
|
21
21
|
export const init = safeFn('init', (config) => {
|
|
@@ -86,6 +86,20 @@ export const init = safeFn('init', (config) => {
|
|
|
86
86
|
mediaType: 'application/x-sentori-screens',
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
else if (screenReplayArmed()) {
|
|
90
|
+
// Asked for, produced nothing. Without this the dashboard
|
|
91
|
+
// cannot tell that from "never enabled", and it was telling
|
|
92
|
+
// readers to switch on a setting that was already on. A
|
|
93
|
+
// handful of bytes on an event already going out — no extra
|
|
94
|
+
// request, and nothing at all when the feature is off.
|
|
95
|
+
event.payload = {
|
|
96
|
+
...(event.payload ?? {}),
|
|
97
|
+
replay: {
|
|
98
|
+
screens: 'empty',
|
|
99
|
+
captured: screenReplayCaptured(),
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
89
103
|
});
|
|
90
104
|
}
|
|
91
105
|
// Native side: hand over release/environment for the crash-file
|
package/lib/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,mEAAmE;AACnE,6DAA6D;AAC7D,iCAAiC;AAEjC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,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AE,EAAE,CAAC;gBAC/B,0DAA0D;gBAC1D,4DAA4D;gBAC5D,wDAAwD;gBACxD,4DAA4D;gBAC5D,uDAAuD;gBACvD,KAAK,CAAC,OAAO,GAAG;oBACd,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;oBACxB,MAAM,EAAE;wBACN,OAAO,EAAE,OAAO;wBAChB,QAAQ,EAAE,oBAAoB,EAAE;qBACjC;iBACF,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IAChE,iEAAiE;IACjE,kEAAkE;IAClE,kEAAkE;IAClE,eAAe,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,YAAY;QAC/C,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC,CAAC;IACH,uBAAuB,EAAE,CAAC;IAE1B,cAAc,EAAE,CAAC;IACjB,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,KAAK,KAAK,CAAC,CAAC;IACvD,SAAS,EAAE,CAAC;IACZ,KAAK,iBAAiB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAChD,KAAK,iBAAiB,EAAE,CAAC;AAC3B,CAAC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAS,EAAE;IACxC,YAAY,GAAG,KAAK,CAAC;AACvB,CAAC,CAAC"}
|
package/lib/replay-screens.d.ts
CHANGED
|
@@ -8,6 +8,17 @@ export declare const startScreenReplay: (windowSeconds: number) => void;
|
|
|
8
8
|
* reads "-42.5s → 0s"). Returns null when empty. The ring is NOT
|
|
9
9
|
* cleared — a second error two seconds later should still see
|
|
10
10
|
* the minute before it. */
|
|
11
|
+
/** Has the ring been asked to run this session? Distinguishes "the
|
|
12
|
+
* host never turned pixel replay on" from "it is on and produced
|
|
13
|
+
* nothing", which look identical from the server and which the
|
|
14
|
+
* dashboard was guessing between — it told readers to enable a
|
|
15
|
+
* setting that may already be enabled. */
|
|
16
|
+
export declare const screenReplayArmed: () => boolean;
|
|
17
|
+
/** Frames captured since start. Zero while armed means every tick
|
|
18
|
+
* returned nothing: an older native binary, or a capture that keeps
|
|
19
|
+
* failing. Either way the host should hear it from the event rather
|
|
20
|
+
* than from a console line on a device nobody is holding. */
|
|
21
|
+
export declare const screenReplayCaptured: () => number;
|
|
11
22
|
export declare const drainScreenReplay: () => null | string;
|
|
12
23
|
export declare const __resetForTests: () => void;
|
|
13
24
|
export declare const __setCaptureForTests: (fn: CaptureFn) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay-screens.d.ts","sourceRoot":"","sources":["../src/replay-screens.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,KAAK,SAAS,GAAG,OAAO,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"replay-screens.d.ts","sourceRoot":"","sources":["../src/replay-screens.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,KAAK,SAAS,GAAG,OAAO,wBAAwB,CAAC;AA8BjD;mCACmC;AACnC,eAAO,MAAM,iBAAiB,kBAAmB,MAAM,KAAG,IAOzD,CAAC;AAmBF;;;;4BAI4B;AAC5B;;;;2CAI2C;AAC3C,eAAO,MAAM,iBAAiB,QAAO,OAA0B,CAAC;AAEhE;;;8DAG8D;AAC9D,eAAO,MAAM,oBAAoB,QAAO,MAAmB,CAAC;AAE5D,eAAO,MAAM,iBAAiB,QAAO,IAAI,GAAG,MAe3C,CAAC;AAEF,eAAO,MAAM,eAAe,QAAO,IAQlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,OAAQ,SAAS,KAAG,IAEpD,CAAC"}
|
package/lib/replay-screens.js
CHANGED
|
@@ -26,6 +26,7 @@ let _ring = [];
|
|
|
26
26
|
let _capacity = 0;
|
|
27
27
|
let _timer = null;
|
|
28
28
|
let _capturing = false;
|
|
29
|
+
let _captured = 0;
|
|
29
30
|
/** Start the ring. `windowSeconds` is how far back the replay
|
|
30
31
|
* reaches when an event fires. */
|
|
31
32
|
export const startScreenReplay = (windowSeconds) => {
|
|
@@ -46,6 +47,7 @@ const tick = async () => {
|
|
|
46
47
|
try {
|
|
47
48
|
const frame = await _capture(maskedNativeIds(), FRAME_LONG_EDGE_PX, FRAME_QUALITY);
|
|
48
49
|
if (frame) {
|
|
50
|
+
_captured += 1;
|
|
49
51
|
_ring.push({ t: Date.now(), ...frame });
|
|
50
52
|
if (_ring.length > _capacity)
|
|
51
53
|
_ring.splice(0, _ring.length - _capacity);
|
|
@@ -60,6 +62,17 @@ const tick = async () => {
|
|
|
60
62
|
* reads "-42.5s → 0s"). Returns null when empty. The ring is NOT
|
|
61
63
|
* cleared — a second error two seconds later should still see
|
|
62
64
|
* the minute before it. */
|
|
65
|
+
/** Has the ring been asked to run this session? Distinguishes "the
|
|
66
|
+
* host never turned pixel replay on" from "it is on and produced
|
|
67
|
+
* nothing", which look identical from the server and which the
|
|
68
|
+
* dashboard was guessing between — it told readers to enable a
|
|
69
|
+
* setting that may already be enabled. */
|
|
70
|
+
export const screenReplayArmed = () => _timer !== null;
|
|
71
|
+
/** Frames captured since start. Zero while armed means every tick
|
|
72
|
+
* returned nothing: an older native binary, or a capture that keeps
|
|
73
|
+
* failing. Either way the host should hear it from the event rather
|
|
74
|
+
* than from a console line on a device nobody is holding. */
|
|
75
|
+
export const screenReplayCaptured = () => _captured;
|
|
63
76
|
export const drainScreenReplay = () => {
|
|
64
77
|
if (_ring.length === 0)
|
|
65
78
|
return null;
|
|
@@ -79,6 +92,7 @@ export const __resetForTests = () => {
|
|
|
79
92
|
if (_timer !== null)
|
|
80
93
|
clearInterval(_timer);
|
|
81
94
|
_timer = null;
|
|
95
|
+
_captured = 0;
|
|
82
96
|
_ring = [];
|
|
83
97
|
_capacity = 0;
|
|
84
98
|
_capturing = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay-screens.js","sourceRoot":"","sources":["../src/replay-screens.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,+DAA+D;AAC/D,iEAAiE;AACjE,6DAA6D;AAC7D,gEAAgE;AAChE,6DAA6D;AAC7D,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGpD,IAAI,QAAQ,GAAc,wBAAwB,CAAC;AAEnD;oDACoD;AACpD,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B;;wCAEwC;AACxC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,2CAA2C;AAC3C,MAAM,aAAa,GAAG,IAAI,CAAC;AAa3B,IAAI,KAAK,GAAkB,EAAE,CAAC;AAC9B,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,IAAI,MAAM,GAA0C,IAAI,CAAC;AACzD,IAAI,UAAU,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"replay-screens.js","sourceRoot":"","sources":["../src/replay-screens.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,+DAA+D;AAC/D,iEAAiE;AACjE,6DAA6D;AAC7D,gEAAgE;AAChE,6DAA6D;AAC7D,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGpD,IAAI,QAAQ,GAAc,wBAAwB,CAAC;AAEnD;oDACoD;A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GAAG,GAAS,EAAE;IACxC,IAAI,MAAM,KAAK,IAAI;QAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,IAAI,CAAC;IACd,SAAS,GAAG,CAAC,CAAC;IACd,KAAK,GAAG,EAAE,CAAC;IACX,SAAS,GAAG,CAAC,CAAC;IACd,UAAU,GAAG,KAAK,CAAC;IACnB,QAAQ,GAAG,wBAAwB,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAa,EAAQ,EAAE;IAC1D,QAAQ,GAAG,EAAE,CAAC;AAChB,CAAC,CAAC"}
|
package/lib/transport.js
CHANGED
|
@@ -15,7 +15,7 @@ const MAX_RETRY = 3;
|
|
|
15
15
|
const STORAGE_KEY = '@sentori/pending';
|
|
16
16
|
const MAX_PERSISTED = 1000;
|
|
17
17
|
// Pinned to package.json by a test — bump both together.
|
|
18
|
-
const SDK_VERSION = '5.
|
|
18
|
+
const SDK_VERSION = '5.7.1';
|
|
19
19
|
let _queue = [];
|
|
20
20
|
let _assertStats = new Map();
|
|
21
21
|
let _flushTimer = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goliapkg/sentori-react-native",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.1",
|
|
4
4
|
"description": "Sentori SDK for React Native \u2014 JS-layer error capture, native crash handlers (iOS / Android), batched transport, fetch + react-navigation tracing.",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"author": "GOLIA K.K. <takagi@golia.jp> (https://golia.jp)",
|
|
@@ -28,18 +28,6 @@
|
|
|
28
28
|
"types": "./lib/index.d.ts",
|
|
29
29
|
"default": "./lib/index.js"
|
|
30
30
|
},
|
|
31
|
-
"./compat": {
|
|
32
|
-
"types": "./lib/compat/sentry.d.ts",
|
|
33
|
-
"default": "./lib/compat/sentry.js"
|
|
34
|
-
},
|
|
35
|
-
"./expo-compat": {
|
|
36
|
-
"types": "./lib/expo-compat.d.ts",
|
|
37
|
-
"default": "./lib/expo-compat.js"
|
|
38
|
-
},
|
|
39
|
-
"./feedback": {
|
|
40
|
-
"types": "./lib/feedback.d.ts",
|
|
41
|
-
"default": "./lib/feedback.js"
|
|
42
|
-
},
|
|
43
31
|
"./package.json": "./package.json"
|
|
44
32
|
},
|
|
45
33
|
"bin": {
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
__resetForTests as resetRing,
|
|
9
9
|
__setCaptureForTests,
|
|
10
10
|
drainScreenReplay,
|
|
11
|
+
screenReplayArmed,
|
|
12
|
+
screenReplayCaptured,
|
|
11
13
|
startScreenReplay,
|
|
12
14
|
} from '../replay-screens';
|
|
13
15
|
|
|
@@ -69,3 +71,30 @@ describe('screens ring', () => {
|
|
|
69
71
|
expect(drainScreenReplay()).not.toBeNull();
|
|
70
72
|
}, 10_000);
|
|
71
73
|
});
|
|
74
|
+
|
|
75
|
+
describe('armed but empty', () => {
|
|
76
|
+
test('off: not armed, nothing captured', () => {
|
|
77
|
+
expect(screenReplayArmed()).toBe(false);
|
|
78
|
+
expect(screenReplayCaptured()).toBe(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('armed with a native that captures nothing stays at zero', async () => {
|
|
82
|
+
// An older native binary returns null forever. The ring must
|
|
83
|
+
// report "on, and producing nothing" — the dashboard used to
|
|
84
|
+
// read that state as "the host never turned this on" and told
|
|
85
|
+
// people to enable a setting that was already enabled.
|
|
86
|
+
__setCaptureForTests(async () => null);
|
|
87
|
+
startScreenReplay(30);
|
|
88
|
+
expect(screenReplayArmed()).toBe(true);
|
|
89
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
90
|
+
expect(screenReplayCaptured()).toBe(0);
|
|
91
|
+
expect(drainScreenReplay()).toBeNull();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('reset disarms and clears the count', () => {
|
|
95
|
+
startScreenReplay(30);
|
|
96
|
+
resetRing();
|
|
97
|
+
expect(screenReplayArmed()).toBe(false);
|
|
98
|
+
expect(screenReplayCaptured()).toBe(0);
|
|
99
|
+
});
|
|
100
|
+
});
|
package/src/init.ts
CHANGED
|
@@ -18,7 +18,12 @@ import { armLaunch } from './launch';
|
|
|
18
18
|
import { markNativeJsBridgeReady, setNativeConfig } from './native';
|
|
19
19
|
import { shipNativePending } from './native-pending';
|
|
20
20
|
import { drainReplay, startReplay } from './replay';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
drainScreenReplay,
|
|
23
|
+
screenReplayArmed,
|
|
24
|
+
screenReplayCaptured,
|
|
25
|
+
startScreenReplay,
|
|
26
|
+
} from './replay-screens';
|
|
22
27
|
import { drainOfflineQueue, queueAttachment, startTransport } from './transport';
|
|
23
28
|
|
|
24
29
|
let _initialized = false;
|
|
@@ -91,6 +96,19 @@ export const init = safeFn('init', (config: InitConfig): void => {
|
|
|
91
96
|
text: frames,
|
|
92
97
|
mediaType: 'application/x-sentori-screens',
|
|
93
98
|
});
|
|
99
|
+
} else if (screenReplayArmed()) {
|
|
100
|
+
// Asked for, produced nothing. Without this the dashboard
|
|
101
|
+
// cannot tell that from "never enabled", and it was telling
|
|
102
|
+
// readers to switch on a setting that was already on. A
|
|
103
|
+
// handful of bytes on an event already going out — no extra
|
|
104
|
+
// request, and nothing at all when the feature is off.
|
|
105
|
+
event.payload = {
|
|
106
|
+
...(event.payload ?? {}),
|
|
107
|
+
replay: {
|
|
108
|
+
screens: 'empty',
|
|
109
|
+
captured: screenReplayCaptured(),
|
|
110
|
+
},
|
|
111
|
+
};
|
|
94
112
|
}
|
|
95
113
|
});
|
|
96
114
|
}
|
package/src/replay-screens.ts
CHANGED
|
@@ -43,6 +43,7 @@ let _ring: ScreenFrame[] = [];
|
|
|
43
43
|
let _capacity = 0;
|
|
44
44
|
let _timer: ReturnType<typeof setInterval> | null = null;
|
|
45
45
|
let _capturing = false;
|
|
46
|
+
let _captured = 0;
|
|
46
47
|
|
|
47
48
|
/** Start the ring. `windowSeconds` is how far back the replay
|
|
48
49
|
* reaches when an event fires. */
|
|
@@ -63,6 +64,7 @@ const tick = async (): Promise<void> => {
|
|
|
63
64
|
try {
|
|
64
65
|
const frame = await _capture(maskedNativeIds(), FRAME_LONG_EDGE_PX, FRAME_QUALITY);
|
|
65
66
|
if (frame) {
|
|
67
|
+
_captured += 1;
|
|
66
68
|
_ring.push({ t: Date.now(), ...frame });
|
|
67
69
|
if (_ring.length > _capacity) _ring.splice(0, _ring.length - _capacity);
|
|
68
70
|
}
|
|
@@ -76,6 +78,19 @@ const tick = async (): Promise<void> => {
|
|
|
76
78
|
* reads "-42.5s → 0s"). Returns null when empty. The ring is NOT
|
|
77
79
|
* cleared — a second error two seconds later should still see
|
|
78
80
|
* the minute before it. */
|
|
81
|
+
/** Has the ring been asked to run this session? Distinguishes "the
|
|
82
|
+
* host never turned pixel replay on" from "it is on and produced
|
|
83
|
+
* nothing", which look identical from the server and which the
|
|
84
|
+
* dashboard was guessing between — it told readers to enable a
|
|
85
|
+
* setting that may already be enabled. */
|
|
86
|
+
export const screenReplayArmed = (): boolean => _timer !== null;
|
|
87
|
+
|
|
88
|
+
/** Frames captured since start. Zero while armed means every tick
|
|
89
|
+
* returned nothing: an older native binary, or a capture that keeps
|
|
90
|
+
* failing. Either way the host should hear it from the event rather
|
|
91
|
+
* than from a console line on a device nobody is holding. */
|
|
92
|
+
export const screenReplayCaptured = (): number => _captured;
|
|
93
|
+
|
|
79
94
|
export const drainScreenReplay = (): null | string => {
|
|
80
95
|
if (_ring.length === 0) return null;
|
|
81
96
|
const now = Date.now();
|
|
@@ -96,6 +111,7 @@ export const drainScreenReplay = (): null | string => {
|
|
|
96
111
|
export const __resetForTests = (): void => {
|
|
97
112
|
if (_timer !== null) clearInterval(_timer);
|
|
98
113
|
_timer = null;
|
|
114
|
+
_captured = 0;
|
|
99
115
|
_ring = [];
|
|
100
116
|
_capacity = 0;
|
|
101
117
|
_capturing = false;
|
package/src/transport.ts
CHANGED
|
@@ -20,7 +20,7 @@ const STORAGE_KEY = '@sentori/pending';
|
|
|
20
20
|
const MAX_PERSISTED = 1000;
|
|
21
21
|
|
|
22
22
|
// Pinned to package.json by a test — bump both together.
|
|
23
|
-
const SDK_VERSION = '5.
|
|
23
|
+
const SDK_VERSION = '5.7.1';
|
|
24
24
|
|
|
25
25
|
let _queue: WireEvent[] = [];
|
|
26
26
|
let _assertStats = new Map<string, AssertStat>();
|