@sentry/replay 7.49.0 → 7.51.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.
Files changed (40) hide show
  1. package/README.md +19 -6
  2. package/cjs/index.js +541 -209
  3. package/cjs/index.js.map +1 -1
  4. package/esm/index.js +542 -210
  5. package/esm/index.js.map +1 -1
  6. package/package.json +5 -5
  7. package/types/constants.d.ts +4 -2
  8. package/types/constants.d.ts.map +1 -1
  9. package/types/coreHandlers/handleAfterSendEvent.d.ts.map +1 -1
  10. package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts.map +1 -1
  11. package/types/coreHandlers/handleScope.d.ts +2 -0
  12. package/types/coreHandlers/handleScope.d.ts.map +1 -1
  13. package/types/coreHandlers/util/fetchUtils.d.ts.map +1 -1
  14. package/types/coreHandlers/util/networkUtils.d.ts +4 -0
  15. package/types/coreHandlers/util/networkUtils.d.ts.map +1 -1
  16. package/types/coreHandlers/util/xhrUtils.d.ts.map +1 -1
  17. package/types/eventBuffer/EventBufferArray.d.ts +5 -1
  18. package/types/eventBuffer/EventBufferArray.d.ts.map +1 -1
  19. package/types/eventBuffer/EventBufferCompressionWorker.d.ts +8 -5
  20. package/types/eventBuffer/EventBufferCompressionWorker.d.ts.map +1 -1
  21. package/types/eventBuffer/EventBufferProxy.d.ts +5 -1
  22. package/types/eventBuffer/EventBufferProxy.d.ts.map +1 -1
  23. package/types/integration.d.ts +21 -14
  24. package/types/integration.d.ts.map +1 -1
  25. package/types/replay.d.ts +35 -12
  26. package/types/replay.d.ts.map +1 -1
  27. package/types/session/Session.d.ts +0 -4
  28. package/types/session/Session.d.ts.map +1 -1
  29. package/types/session/clearSession.d.ts +6 -0
  30. package/types/session/clearSession.d.ts.map +1 -0
  31. package/types/session/createSession.d.ts +6 -2
  32. package/types/session/createSession.d.ts.map +1 -1
  33. package/types/session/getSession.d.ts +1 -1
  34. package/types/session/getSession.d.ts.map +1 -1
  35. package/types/types.d.ts +68 -45
  36. package/types/types.d.ts.map +1 -1
  37. package/types/util/addEvent.d.ts.map +1 -1
  38. package/types/util/addGlobalListeners.d.ts.map +1 -1
  39. package/types/util/timestampToMs.d.ts +5 -0
  40. package/types/util/timestampToMs.d.ts.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/replay",
3
- "version": "7.49.0",
3
+ "version": "7.51.0",
4
4
  "description": "User replays for Sentry",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -18,16 +18,16 @@
18
18
  "homepage": "https://docs.sentry.io/platforms/javascript/session-replay/",
19
19
  "devDependencies": {
20
20
  "@babel/core": "^7.17.5",
21
- "@sentry-internal/replay-worker": "7.49.0",
21
+ "@sentry-internal/replay-worker": "7.51.0",
22
22
  "@sentry-internal/rrweb": "1.106.0",
23
23
  "@sentry-internal/rrweb-snapshot": "1.106.0",
24
24
  "jsdom-worker": "^0.2.1",
25
25
  "tslib": "^1.9.3"
26
26
  },
27
27
  "dependencies": {
28
- "@sentry/core": "7.49.0",
29
- "@sentry/types": "7.49.0",
30
- "@sentry/utils": "7.49.0"
28
+ "@sentry/core": "7.51.0",
29
+ "@sentry/types": "7.51.0",
30
+ "@sentry/utils": "7.51.0"
31
31
  },
32
32
  "engines": {
33
33
  "node": ">=12"
@@ -3,13 +3,15 @@ export declare const REPLAY_SESSION_KEY = "sentryReplaySession";
3
3
  export declare const REPLAY_EVENT_NAME = "replay_event";
4
4
  export declare const RECORDING_EVENT_NAME = "replay_recording";
5
5
  export declare const UNABLE_TO_SEND_REPLAY = "Unable to send Replay";
6
- export declare const SESSION_IDLE_DURATION = 300000;
6
+ export declare const SESSION_IDLE_PAUSE_DURATION = 300000;
7
+ export declare const SESSION_IDLE_EXPIRE_DURATION = 900000;
7
8
  export declare const MAX_SESSION_LIFE = 3600000;
8
9
  /** Default flush delays */
9
10
  export declare const DEFAULT_FLUSH_MIN_DELAY = 5000;
10
11
  export declare const DEFAULT_FLUSH_MAX_DELAY = 5500;
11
- export declare const ERROR_CHECKOUT_TIME = 60000;
12
+ export declare const BUFFER_CHECKOUT_TIME = 60000;
12
13
  export declare const RETRY_BASE_INTERVAL = 5000;
13
14
  export declare const RETRY_MAX_COUNT = 3;
14
15
  export declare const NETWORK_BODY_MAX_SIZE = 150000;
16
+ export declare const CONSOLE_ARG_MAX_SIZE = 5000;
15
17
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM,iDAA2C,CAAC;AAE/D,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAG7D,eAAO,MAAM,qBAAqB,SAAU,CAAC;AAG7C,eAAO,MAAM,gBAAgB,UAAY,CAAC;AAE1C,2BAA2B;AAC3B,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAG7C,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAG7C,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,eAAe,IAAI,CAAC;AAGjC,eAAO,MAAM,qBAAqB,SAAU,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM,iDAA2C,CAAC;AAE/D,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAG7D,eAAO,MAAM,2BAA2B,SAAU,CAAC;AAGnD,eAAO,MAAM,4BAA4B,SAAU,CAAC;AAGpD,eAAO,MAAM,gBAAgB,UAAY,CAAC;AAE1C,2BAA2B;AAC3B,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAG7C,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAG7C,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,eAAe,IAAI,CAAC;AAGjC,eAAO,MAAM,qBAAqB,SAAU,CAAC;AAG7C,eAAO,MAAM,oBAAoB,OAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handleAfterSendEvent.d.ts","sourceRoot":"","sources":["../../../../src/coreHandlers/handleAfterSendEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAa,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAGpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,aAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,4BAA4B,GAAG,IAAI,KAAK,IAAI,CAAC;AAExG;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,sBAAsB,CA2DpF"}
1
+ {"version":3,"file":"handleAfterSendEvent.d.ts","sourceRoot":"","sources":["../../../../src/coreHandlers/handleAfterSendEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAa,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAGpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,aAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,4BAA4B,GAAG,IAAI,KAAK,IAAI,CAAC;AAExG;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,sBAAsB,CAqDpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"handleNetworkBreadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/coreHandlers/handleNetworkBreadcrumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EAEd,mBAAmB,EAEpB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAa,eAAe,EAAE,oBAAoB,EAAW,MAAM,UAAU,CAAC;AAM1F,UAAU,iCAAkC,SAAQ,oBAAoB;IACtE,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAsBtE;AAED,8BAA8B;AAC9B,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,EAC1C,UAAU,EAAE,UAAU,EACtB,IAAI,CAAC,EAAE,cAAc,GACpB,IAAI,CA0BN"}
1
+ {"version":3,"file":"handleNetworkBreadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/coreHandlers/handleNetworkBreadcrumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EAEd,mBAAmB,EAEpB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAa,eAAe,EAAE,oBAAoB,EAAW,MAAM,UAAU,CAAC;AAM1F,UAAU,iCAAkC,SAAQ,oBAAoB;IACtE,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CA4BtE;AAED,8BAA8B;AAC9B,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,EAC1C,UAAU,EAAE,UAAU,EACtB,IAAI,CAAC,EAAE,cAAc,GACpB,IAAI,CA0BN"}
@@ -5,4 +5,6 @@ export declare const handleScopeListener: (replay: ReplayContainer) => (scope: S
5
5
  * An event handler to handle scope changes.
6
6
  */
7
7
  export declare function handleScope(scope: Scope): Breadcrumb | null;
8
+ /** exported for tests only */
9
+ export declare function normalizeConsoleBreadcrumb(breadcrumb: Breadcrumb): Breadcrumb;
8
10
  //# sourceMappingURL=handleScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleScope.d.ts","sourceRoot":"","sources":["../../../../src/coreHandlers/handleScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMhD,eAAO,MAAM,mBAAmB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,CAAC,KAAK,EAAE,KAAK,KAAK,IAc9E,CAAC;AAEJ;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,IAAI,CAwB3D"}
1
+ {"version":3,"file":"handleScope.d.ts","sourceRoot":"","sources":["../../../../src/coreHandlers/handleScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAIvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAOhD,eAAO,MAAM,mBAAmB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,CAAC,KAAK,EAAE,KAAK,KAAK,IAc9E,CAAC;AAEJ;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,IAAI,CA4B3D;AAED,8BAA8B;AAC9B,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkD7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchUtils.d.ts","sourceRoot":"","sources":["../../../../../src/coreHandlers/util/fetchUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,C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,EAAE,mBAAmB,CAAA;CAAE,GAC5C,IAAI,CAcN"}
@@ -10,8 +10,12 @@ export declare function getBodyString(body: unknown): string | undefined;
10
10
  export declare function makeNetworkReplayBreadcrumb(type: string, data: ReplayNetworkRequestData | null): ReplayPerformanceEntry<NetworkRequestData> | null;
11
11
  /** Get either a JSON network body, or a text representation. */
12
12
  export declare function getNetworkBody(bodyText: string | undefined): NetworkBody | undefined;
13
+ /** Build the request or response part of a replay network breadcrumb that was skipped. */
14
+ export declare function buildSkippedNetworkRequestOrResponse(bodySize: number | undefined): ReplayNetworkRequestOrResponse;
13
15
  /** Build the request or response part of a replay network breadcrumb. */
14
16
  export declare function buildNetworkRequestOrResponse(headers: Record<string, string>, bodySize: number | undefined, body: string | undefined): ReplayNetworkRequestOrResponse | undefined;
15
17
  /** Filter a set of headers */
16
18
  export declare function getAllowedHeaders(headers: Record<string, string>, allowedHeaders: string[]): Record<string, string>;
19
+ /** Match an URL against a list of strings/Regex. */
20
+ export declare function urlMatches(url: string, urls: (string | RegExp)[]): boolean;
17
21
  //# sourceMappingURL=networkUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../../../src/coreHandlers/util/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIzD,OAAO,KAAK,EACV,WAAW,EAEX,kBAAkB,EAClB,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,8BAA8B;AAC9B,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,WAAW,EAAE,WAAW,GAAG,mBAAmB,GAC7C,MAAM,GAAG,SAAS,CAiCpB;AAED,4DAA4D;AAC5D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,+C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C;AAW5G;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,EACpD,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,oBAAoB,GAAG;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,GAC1D,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,EACpD,IAAI,EAAE,OAAO,EACb,OAAO,EAAE;IAAE,WAAW,EAAE,mBAAmB,CAAA;CAAE,GAC5C,IAAI,CAcN"}
1
+ {"version":3,"file":"xhrUtils.d.ts","sourceRoot":"","sources":["../../../../../src/coreHandlers/util/xhrUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGxF,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAA4B,OAAO,EAAE,MAAM,aAAa,CAAC;AAa5G;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,EACpD,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,oBAAoB,GAAG;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,GAC1D,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,EACpD,IAAI,EAAE,OAAO,EACb,OAAO,EAAE;IAAE,WAAW,EAAE,mBAAmB,CAAA;CAAE,GAC5C,IAAI,CAcN"}
@@ -12,8 +12,12 @@ export declare class EventBufferArray implements EventBuffer {
12
12
  /** @inheritdoc */
13
13
  destroy(): void;
14
14
  /** @inheritdoc */
15
- addEvent(event: RecordingEvent, isCheckout?: boolean): Promise<AddEventResult>;
15
+ addEvent(event: RecordingEvent): Promise<AddEventResult>;
16
16
  /** @inheritdoc */
17
17
  finish(): Promise<string>;
18
+ /** @inheritdoc */
19
+ clear(): void;
20
+ /** @inheritdoc */
21
+ getEarliestTimestamp(): number | null;
18
22
  }
19
23
  //# sourceMappingURL=EventBufferArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventBufferArray.d.ts","sourceRoot":"","sources":["../../../../src/eventBuffer/EventBufferArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5E;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,mDAAmD;IAC5C,MAAM,EAAE,cAAc,EAAE,CAAC;;IAMhC,kBAAkB;IAClB,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,kBAAkB;IACX,OAAO,IAAI,IAAI;IAItB,kBAAkB;IACL,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IAU3F,kBAAkB;IACX,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CAUjC"}
1
+ {"version":3,"file":"EventBufferArray.d.ts","sourceRoot":"","sources":["../../../../src/eventBuffer/EventBufferArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG5E;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,mDAAmD;IAC5C,MAAM,EAAE,cAAc,EAAE,CAAC;;IAMhC,kBAAkB;IAClB,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,kBAAkB;IACX,OAAO,IAAI,IAAI;IAItB,kBAAkB;IACL,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAIrE,kBAAkB;IACX,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAWhC,kBAAkB;IACX,KAAK,IAAI,IAAI;IAIpB,kBAAkB;IACX,oBAAoB,IAAI,MAAM,GAAG,IAAI;CAS7C"}
@@ -5,10 +5,11 @@ import type { AddEventResult, EventBuffer, RecordingEvent } from '../types';
5
5
  * Exported only for testing.
6
6
  */
7
7
  export declare class EventBufferCompressionWorker implements EventBuffer {
8
- /** @inheritdoc */
9
- hasEvents: boolean;
10
8
  private _worker;
9
+ private _earliestTimestamp;
11
10
  constructor(worker: Worker);
11
+ /** @inheritdoc */
12
+ get hasEvents(): boolean;
12
13
  /**
13
14
  * Ensure the worker is ready (or not).
14
15
  * This will either resolve when the worker is ready, or reject if an error occured.
@@ -23,11 +24,15 @@ export declare class EventBufferCompressionWorker implements EventBuffer {
23
24
  *
24
25
  * Returns true if event was successfuly received and processed by worker.
25
26
  */
26
- addEvent(event: RecordingEvent, isCheckout?: boolean): Promise<AddEventResult>;
27
+ addEvent(event: RecordingEvent): Promise<AddEventResult>;
27
28
  /**
28
29
  * Finish the event buffer and return the compressed data.
29
30
  */
30
31
  finish(): Promise<ReplayRecordingData>;
32
+ /** @inheritdoc */
33
+ clear(): void;
34
+ /** @inheritdoc */
35
+ getEarliestTimestamp(): number | null;
31
36
  /**
32
37
  * Send the event to the worker.
33
38
  */
@@ -36,7 +41,5 @@ export declare class EventBufferCompressionWorker implements EventBuffer {
36
41
  * Finish the request and return the compressed data from the worker.
37
42
  */
38
43
  private _finishRequest;
39
- /** Clear any pending events from the worker. */
40
- private _clear;
41
44
  }
42
45
  //# sourceMappingURL=EventBufferCompressionWorker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventBufferCompressionWorker.d.ts","sourceRoot":"","sources":["../../../../src/eventBuffer/EventBufferCompressionWorker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG5E;;;GAGG;AACH,qBAAa,4BAA6B,YAAW,WAAW;IAC9D,kBAAkB;IACX,SAAS,EAAE,OAAO,CAAC;IAE1B,OAAO,CAAC,OAAO,CAAgB;gBAEZ,MAAM,EAAE,MAAM;IAKjC;;;OAGG;IACI,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;OAEG;IACI,OAAO,IAAI,IAAI;IAItB;;;;OAIG;IACU,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IAY3F;;OAEG;IACI,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI7C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;YACW,cAAc;IAQ5B,gDAAgD;IAChD,OAAO,CAAC,MAAM;CAGf"}
1
+ {"version":3,"file":"EventBufferCompressionWorker.d.ts","sourceRoot":"","sources":["../../../../src/eventBuffer/EventBufferCompressionWorker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI5E;;;GAGG;AACH,qBAAa,4BAA6B,YAAW,WAAW;IAC9D,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,kBAAkB,CAAgB;gBAEvB,MAAM,EAAE,MAAM;IAKjC,kBAAkB;IAClB,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED;;;OAGG;IACI,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;OAEG;IACI,OAAO,IAAI,IAAI;IAItB;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAS/D;;OAEG;IACI,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI7C,kBAAkB;IACX,KAAK,IAAI,IAAI;IAMpB,kBAAkB;IACX,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAI5C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;YACW,cAAc;CAO7B"}
@@ -15,12 +15,16 @@ export declare class EventBufferProxy implements EventBuffer {
15
15
  get hasEvents(): boolean;
16
16
  /** @inheritDoc */
17
17
  destroy(): void;
18
+ /** @inheritdoc */
19
+ clear(): void;
20
+ /** @inheritdoc */
21
+ getEarliestTimestamp(): number | null;
18
22
  /**
19
23
  * Add an event to the event buffer.
20
24
  *
21
25
  * Returns true if event was successfully added.
22
26
  */
23
- addEvent(event: RecordingEvent, isCheckout?: boolean): Promise<AddEventResult>;
27
+ addEvent(event: RecordingEvent): Promise<AddEventResult>;
24
28
  /** @inheritDoc */
25
29
  finish(): Promise<ReplayRecordingData>;
26
30
  /** Ensure the worker has loaded. */
@@ -1 +1 @@
1
- {"version":3,"file":"EventBufferProxy.d.ts","sourceRoot":"","sources":["../../../../src/eventBuffer/EventBufferProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI5E;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,4BAA4B,CAAgB;gBAEjC,MAAM,EAAE,MAAM;IAQjC,kBAAkB;IAClB,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,kBAAkB;IACX,OAAO,IAAI,IAAI;IAKtB;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IAIrF,kBAAkB;IACL,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAOnD,oCAAoC;IAC7B,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C,oDAAoD;YACtC,qBAAqB;IAcnC,wDAAwD;YAC1C,0BAA0B;CAmBzC"}
1
+ {"version":3,"file":"EventBufferProxy.d.ts","sourceRoot":"","sources":["../../../../src/eventBuffer/EventBufferProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI5E;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,4BAA4B,CAAgB;gBAEjC,MAAM,EAAE,MAAM;IAQjC,kBAAkB;IAClB,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,kBAAkB;IACX,OAAO,IAAI,IAAI;IAKtB,kBAAkB;IACX,KAAK,IAAI,IAAI;IAIpB,kBAAkB;IACX,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAI5C;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAI/D,kBAAkB;IACL,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAOnD,oCAAoC;IAC7B,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C,oDAAoD;YACtC,qBAAqB;IAcnC,wDAAwD;YAC1C,0BAA0B;CAmBzC"}
@@ -1,5 +1,5 @@
1
1
  import type { Integration } from '@sentry/types';
2
- import type { ReplayConfiguration } from './types';
2
+ import type { ReplayConfiguration, SendBufferedReplayOptions } from './types';
3
3
  /**
4
4
  * The main replay integration class, to be passed to `init({ integrations: [] })`.
5
5
  */
@@ -25,42 +25,49 @@ export declare class Replay implements Integration {
25
25
  */
26
26
  private readonly _initialOptions;
27
27
  private _replay?;
28
- constructor({ flushMinDelay, flushMaxDelay, stickySession, useCompression, _experiments, sessionSampleRate, errorSampleRate, maskAllText, maskAllInputs, blockAllMedia, mask, unmask, block, unblock, ignore, maskFn, blockClass, blockSelector, maskInputOptions, maskTextClass, maskTextSelector, ignoreClass, }?: ReplayConfiguration);
28
+ constructor({ flushMinDelay, flushMaxDelay, stickySession, useCompression, _experiments, sessionSampleRate, errorSampleRate, maskAllText, maskAllInputs, blockAllMedia, networkDetailAllowUrls, networkCaptureBodies, networkRequestHeaders, networkResponseHeaders, mask, unmask, block, unblock, ignore, maskFn, blockClass, blockSelector, maskInputOptions, maskTextClass, maskTextSelector, ignoreClass, }?: ReplayConfiguration);
29
29
  /** If replay has already been initialized */
30
30
  protected get _isInitialized(): boolean;
31
31
  /** Update _isInitialized */
32
32
  protected set _isInitialized(value: boolean);
33
33
  /**
34
- * We previously used to create a transaction in `setupOnce` and it would
35
- * potentially create a transaction before some native SDK integrations have run
36
- * and applied their own global event processor. An example is:
37
- * https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts
38
- *
39
- * So we call `replay.setup` in next event loop as a workaround to wait for other
40
- * global event processors to finish. This is no longer needed, but keeping it
41
- * here to avoid any future issues.
34
+ * Setup and initialize replay container
42
35
  */
43
36
  setupOnce(): void;
44
37
  /**
45
- * Initializes the plugin.
38
+ * Start a replay regardless of sampling rate. Calling this will always
39
+ * create a new session. Will throw an error if replay is already in progress.
46
40
  *
47
41
  * Creates or loads a session, attaches listeners to varying events (DOM,
48
42
  * PerformanceObserver, Recording, Sentry SDK, etc)
49
43
  */
50
44
  start(): void;
45
+ /**
46
+ * Start replay buffering. Buffers until `flush()` is called or, if
47
+ * `replaysOnErrorSampleRate` > 0, until an error occurs.
48
+ */
49
+ startBuffering(): void;
51
50
  /**
52
51
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
53
52
  * does not support a teardown
54
53
  */
55
- stop(): void;
54
+ stop(): Promise<void>;
56
55
  /**
57
- * Immediately send all pending events.
56
+ * If not in "session" recording mode, flush event buffer which will create a new replay.
57
+ * Unless `continueRecording` is false, the replay will continue to record and
58
+ * behave as a "session"-based replay.
59
+ *
60
+ * Otherwise, queue up a flush.
58
61
  */
59
- flush(): Promise<void> | void;
62
+ flush(options?: SendBufferedReplayOptions): Promise<void>;
60
63
  /**
61
64
  * Get the current session ID.
62
65
  */
63
66
  getReplayId(): string | undefined;
67
+ /**
68
+ * Initializes replay.
69
+ */
70
+ protected _initialize(): void;
64
71
  /** Setup the integration. */
65
72
  private _setup;
66
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA8B,WAAW,EAAE,MAAM,eAAe,CAAC;AAK7E,OAAO,KAAK,EAAoB,mBAAmB,EAAuB,MAAM,SAAS,CAAC;AAY1F;;GAEG;AACH,qBAAa,MAAO,YAAW,WAAW;IACxC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAY;IAEpC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAa;IAEhC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;IAE7D,OAAO,CAAC,OAAO,CAAC,CAAkB;gBAEf,EACjB,aAAuC,EACvC,aAAuC,EACvC,aAAoB,EACpB,cAAqB,EACrB,YAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAkB,EAClB,aAAoB,EACpB,aAAoB,EAEpB,IAAS,EACT,MAAW,EACX,KAAU,EACV,OAAY,EACZ,MAAW,EACX,MAAM,EAGN,UAAU,EAEV,aAA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AAY,EACZ,MAAW,EACX,MAAM,EAGN,UAAU,EAEV,aAAa,EAEb,gBAAgB,EAEhB,aAAa,EAEb,gBAAgB,EAEhB,WAAW,GACZ,GAAE,mBAAwB;IAsF3B,6CAA6C;IAC7C,SAAS,KAAK,cAAc,IAAI,OAAO,CAEtC;IAED,4BAA4B;IAC5B,SAAS,KAAK,cAAc,CAAC,KAAK,EAAE,OAAO,EAE1C;IAED;;OAEG;IACI,SAAS,IAAI,IAAI;IAkBxB;;;;;;OAMG;IACI,KAAK,IAAI,IAAI;IAQpB;;;OAGG;IACI,cAAc,IAAI,IAAI;IAQ7B;;;OAGG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;;;;;OAMG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhE;;OAEG;IACI,WAAW,IAAI,MAAM,GAAG,SAAS;IAOxC;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAQ7B,6BAA6B;IAC7B,OAAO,CAAC,MAAM;CASf"}
package/types/replay.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ReplayRecordingMode } from '@sentry/types';
2
- import type { AddUpdateCallback, AllPerformanceEntry, EventBuffer, InternalEventContext, RecordingOptions, ReplayContainer as ReplayContainerInterface, ReplayExperimentalPluginOptions, ReplayPluginOptions, Session, Timeouts } from './types';
2
+ import type { AddUpdateCallback, AllPerformanceEntry, EventBuffer, InternalEventContext, RecordingOptions, ReplayContainer as ReplayContainerInterface, ReplayPluginOptions, SendBufferedReplayOptions, Session, Timeouts } from './types';
3
3
  /**
4
4
  * The main replay container class, which holds all the state and methods for recording and sending replays.
5
5
  */
@@ -11,9 +11,11 @@ export declare class ReplayContainer implements ReplayContainerInterface {
11
11
  performanceEvents: AllPerformanceEntry[];
12
12
  session: Session | undefined;
13
13
  /**
14
- * Recording can happen in one of two modes:
15
- * * session: Record the whole session, sending it continuously
16
- * * error: Always keep the last 60s of recording, and when an error occurs, send it immediately
14
+ * Recording can happen in one of three modes:
15
+ * - session: Record the whole session, sending it continuously
16
+ * - buffer: Always keep the last 60s of recording, requires:
17
+ * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
18
+ * - or calling `flush()` to send the replay
17
19
  */
18
20
  recordingMode: ReplayRecordingMode;
19
21
  /**
@@ -21,7 +23,6 @@ export declare class ReplayContainer implements ReplayContainerInterface {
21
23
  * @hidden
22
24
  */
23
25
  readonly timeouts: Timeouts;
24
- private readonly _experimentalOptions;
25
26
  /**
26
27
  * Options to pass to `rrweb.record()`
27
28
  */
@@ -67,18 +68,23 @@ export declare class ReplayContainer implements ReplayContainerInterface {
67
68
  /** Get the replay integration options. */
68
69
  getOptions(): ReplayPluginOptions;
69
70
  /**
70
- * Get the experimental options.
71
- * THIS IS INTERNAL AND SUBJECT TO CHANGE!
72
- * @hidden
71
+ * Initializes the plugin based on sampling configuration. Should not be
72
+ * called outside of constructor.
73
73
  */
74
- getExperimentalOptions(): ReplayExperimentalPluginOptions;
74
+ initializeSampling(): void;
75
75
  /**
76
- * Initializes the plugin.
76
+ * Start a replay regardless of sampling rate. Calling this will always
77
+ * create a new session. Will throw an error if replay is already in progress.
77
78
  *
78
79
  * Creates or loads a session, attaches listeners to varying events (DOM,
79
80
  * _performanceObserver, Recording, Sentry SDK, etc)
80
81
  */
81
82
  start(): void;
83
+ /**
84
+ * Start replay buffering. Buffers until `flush()` is called or, if
85
+ * `replaysOnErrorSampleRate` > 0, an error occurs.
86
+ */
87
+ startBuffering(): void;
82
88
  /**
83
89
  * Start recording.
84
90
  *
@@ -87,14 +93,16 @@ export declare class ReplayContainer implements ReplayContainerInterface {
87
93
  startRecording(): void;
88
94
  /**
89
95
  * Stops the recording, if it was running.
90
- * Returns true if it was stopped, else false.
96
+ *
97
+ * Returns true if it was previously stopped, or is now stopped,
98
+ * otherwise false.
91
99
  */
92
100
  stopRecording(): boolean;
93
101
  /**
94
102
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
95
103
  * does not support a teardown
96
104
  */
97
- stop(reason?: string): void;
105
+ stop(reason?: string): Promise<void>;
98
106
  /**
99
107
  * Pause some replay functionality. See comments for `_isPaused`.
100
108
  * This differs from stop as this only stops DOM recording, it is
@@ -108,6 +116,14 @@ export declare class ReplayContainer implements ReplayContainerInterface {
108
116
  * new DOM checkout.`
109
117
  */
110
118
  resume(): void;
119
+ /**
120
+ * If not in "session" recording mode, flush event buffer which will create a new replay.
121
+ * Unless `continueRecording` is false, the replay will continue to record and
122
+ * behave as a "session"-based replay.
123
+ *
124
+ * Otherwise, queue up a flush.
125
+ */
126
+ sendBufferedReplayOrFlush({ continueRecording }?: SendBufferedReplayOptions): Promise<void>;
111
127
  /**
112
128
  * We want to batch uploads of replay events. Save events only if
113
129
  * `<flushMinDelay>` milliseconds have elapsed since the last event
@@ -147,6 +163,11 @@ export declare class ReplayContainer implements ReplayContainerInterface {
147
163
  * first flush.
148
164
  */
149
165
  setInitialState(): void;
166
+ /**
167
+ * Initialize and start all listeners to varying events (DOM,
168
+ * Performance Observer, Recording, Sentry SDK, etc)
169
+ */
170
+ private _initializeRecording;
150
171
  /** A wrapper to conditionally capture exceptions. */
151
172
  private _handleException;
152
173
  /**
@@ -215,6 +236,8 @@ export declare class ReplayContainer implements ReplayContainerInterface {
215
236
  * Clear _context
216
237
  */
217
238
  private _clearContext;
239
+ /** Update the initial timestamp based on the buffer content. */
240
+ private _updateInitialTimestampFromEventBuffer;
218
241
  /**
219
242
  * Return and clear _context
220
243
  */
@@ -1 +1 @@
1
- {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../src/replay.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAQrE,OAAO,KAAK,EAEV,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EAEpB,gBAAgB,EAChB,eAAe,IAAI,wBAAwB,EAC3C,+BAA+B,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AGG;IACH,OAAO,CAAC,oBAAoB;IA8B5B;;OAEG;IACH,OAAO,CAAC,aAAa;IAwBrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB,CAM7B;IAEF;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAQvB;IAEF;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAQxB;IAEF;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAiBlC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAoBlC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAQ9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB,gEAAgE;IAChE,OAAO,CAAC,sCAAsC;IAiB9C;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;;;;;;OAOG;YACW,SAAS;IA6DvB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAkDZ;IAEF,wCAAwC;IACxC,OAAO,CAAC,iBAAiB;IAMzB,0CAA0C;IAC1C,OAAO,CAAC,kBAAkB,CA4BxB;CACH"}
@@ -5,8 +5,4 @@ import type { Sampled, Session } from '../types';
5
5
  export declare function makeSession(session: Partial<Session> & {
6
6
  sampled: Sampled;
7
7
  }): Session;
8
- /**
9
- * Get the sampled status for a session based on sample rates & current sampled status.
10
- */
11
- export declare function getSessionSampleType(sessionSampleRate: number, errorSampleRate: number): Sampled;
12
8
  //# sourceMappingURL=Session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../../../src/session/Session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGjD;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAgBrF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAEhG"}
1
+ {"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../../../src/session/Session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAiBrF"}
@@ -0,0 +1,6 @@
1
+ import type { ReplayContainer } from '../../src/types';
2
+ /**
3
+ * Removes the session from Session Storage and unsets session in replay instance
4
+ */
5
+ export declare function clearSession(replay: ReplayContainer): void;
6
+ //# sourceMappingURL=clearSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clearSession.d.ts","sourceRoot":"","sources":["../../../../src/session/clearSession.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAG1D"}
@@ -1,8 +1,12 @@
1
- import type { Session, SessionOptions } from '../types';
1
+ import type { Sampled, Session, SessionOptions } from '../types';
2
+ /**
3
+ * Get the sampled status for a session based on sample rates & current sampled status.
4
+ */
5
+ export declare function getSessionSampleType(sessionSampleRate: number, allowBuffering: boolean): Sampled;
2
6
  /**
3
7
  * Create a new session, which in its current implementation is a Sentry event
4
8
  * that all replays will be saved to as attachments. Currently, we only expect
5
9
  * one of these Sentry events per "replay session".
6
10
  */
7
- export declare function createSession({ sessionSampleRate, errorSampleRate, stickySession }: SessionOptions): Session;
11
+ export declare function createSession({ sessionSampleRate, allowBuffering, stickySession }: SessionOptions): Session;
8
12
  //# sourceMappingURL=createSession.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../../src/session/createSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAqB,EAAE,EAAE,cAAc,GAAG,OAAO,CAapH"}
1
+ {"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../../src/session/createSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAKjE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,OAAO,CAEhG;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAqB,EAAE,EAAE,cAAc,GAAG,OAAO,CAanH"}
@@ -9,7 +9,7 @@ interface GetSessionParams extends SessionOptions {
9
9
  /**
10
10
  * Get or create a session
11
11
  */
12
- export declare function getSession({ timeouts, currentSession, stickySession, sessionSampleRate, errorSampleRate, }: GetSessionParams): {
12
+ export declare function getSession({ timeouts, currentSession, stickySession, sessionSampleRate, allowBuffering, }: GetSessionParams): {
13
13
  type: 'new' | 'saved';
14
14
  session: Session;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getSession.d.ts","sourceRoot":"","sources":["../../../../src/session/getSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMlE,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,EAAE,gBAAgB,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA6BhE"}
1
+ {"version":3,"file":"getSession.d.ts","sourceRoot":"","sources":["../../../../src/session/getSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMlE,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,EAAE,gBAAgB,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA8BhE"}