@sentry/replay 0.3.0 → 0.4.2

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.
@@ -4,7 +4,7 @@ import { IEventBuffer } from './eventBuffer';
4
4
  import type { RRWebOptions, ReplaySpan, ReplayRequest, InstrumentationType, SentryReplayPluginOptions, SentryReplayConfiguration } from './types';
5
5
  import { Session } from './session/Session';
6
6
  /**
7
- * Returns true if we want to flush immediately, otherwise continue with normal batching
7
+ * Returns true to return control to calling function, otherwise continue with normal batching
8
8
  */
9
9
  declare type AddUpdateCallback = () => boolean | void;
10
10
  export declare class SentryReplay implements Integration {
@@ -39,8 +39,9 @@ export declare class SentryReplay implements Integration {
39
39
  */
40
40
  private timeout;
41
41
  /**
42
- * The timestamp of the first event since the last flush.
43
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
42
+ * The timestamp of the first event since the last flush. This is used to
43
+ * determine if the maximum allowed time has passed before events should be
44
+ * flushed again.
44
45
  */
45
46
  private initialEventTimestampSinceFlush;
46
47
  private performanceObserver;
@@ -55,17 +56,17 @@ export declare class SentryReplay implements Integration {
55
56
  private needsCaptureReplay;
56
57
  session: Session | undefined;
57
58
  static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string): string;
58
- constructor({ uploadMinDelay, uploadMaxDelay, stickySession, // TBD: Making this opt-in for now
59
+ constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, // TBD: Making this opt-in for now
59
60
  useCompression, rrwebConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
60
61
  setupOnce(): void;
61
62
  setup(): void;
62
63
  /**
63
64
  * We want to batch uploads of replay events. Save events only if
64
- * `<uploadMinDelay>` milliseconds have elapsed since the last event
65
- * *OR* if `<uploadMaxDelay>` milliseconds have elapsed.
65
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
66
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
66
67
  *
67
- * Accepts a callback to perform side-effects and returns a boolean value if we
68
- * should flush events immediately
68
+ * Accepts a callback to perform side-effects and returns true to stop batch
69
+ * processing and hand back control to caller.
69
70
  */
70
71
  addUpdate(cb?: AddUpdateCallback): void;
71
72
  /**
@@ -33,6 +33,10 @@ export declare class Session {
33
33
  * Sequence ID specific to replay updates
34
34
  */
35
35
  private _sequenceId;
36
+ /**
37
+ * Previous session ID
38
+ */
39
+ private _previousSessionId;
36
40
  readonly options: Required<SessionOptions>;
37
41
  constructor(session?: Partial<SessionObject>, { stickySession }?: SessionOptions);
38
42
  get id(): string;
@@ -41,6 +45,8 @@ export declare class Session {
41
45
  set lastActivity(newDate: number);
42
46
  get sequenceId(): number;
43
47
  set sequenceId(id: number);
48
+ get previousSessionId(): string;
49
+ set previousSessionId(id: string);
44
50
  toJSON(): SessionObject;
45
51
  }
46
52
  export {};
@@ -33,11 +33,15 @@ export interface SentryReplayPluginOptions {
33
33
  /**
34
34
  * The amount of time to wait before sending a replay
35
35
  */
36
- uploadMinDelay?: number;
36
+ flushMinDelay?: number;
37
37
  /**
38
38
  * The max amount of time to wait before sending a replay
39
39
  */
40
- uploadMaxDelay?: number;
40
+ flushMaxDelay?: number;
41
+ /**
42
+ * The amount of time to buffer the initial snapshot
43
+ */
44
+ initialFlushDelay?: number;
41
45
  /**
42
46
  * If false, will create a new session per pageload
43
47
  */
@@ -4,7 +4,7 @@ import { IEventBuffer } from './eventBuffer';
4
4
  import type { RRWebOptions, ReplaySpan, ReplayRequest, InstrumentationType, SentryReplayPluginOptions, SentryReplayConfiguration } from './types';
5
5
  import { Session } from './session/Session';
6
6
  /**
7
- * Returns true if we want to flush immediately, otherwise continue with normal batching
7
+ * Returns true to return control to calling function, otherwise continue with normal batching
8
8
  */
9
9
  declare type AddUpdateCallback = () => boolean | void;
10
10
  export declare class SentryReplay implements Integration {
@@ -39,8 +39,9 @@ export declare class SentryReplay implements Integration {
39
39
  */
40
40
  private timeout;
41
41
  /**
42
- * The timestamp of the first event since the last flush.
43
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
42
+ * The timestamp of the first event since the last flush. This is used to
43
+ * determine if the maximum allowed time has passed before events should be
44
+ * flushed again.
44
45
  */
45
46
  private initialEventTimestampSinceFlush;
46
47
  private performanceObserver;
@@ -55,17 +56,17 @@ export declare class SentryReplay implements Integration {
55
56
  private needsCaptureReplay;
56
57
  session: Session | undefined;
57
58
  static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string): string;
58
- constructor({ uploadMinDelay, uploadMaxDelay, stickySession, // TBD: Making this opt-in for now
59
+ constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, // TBD: Making this opt-in for now
59
60
  useCompression, rrwebConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
60
61
  setupOnce(): void;
61
62
  setup(): void;
62
63
  /**
63
64
  * We want to batch uploads of replay events. Save events only if
64
- * `<uploadMinDelay>` milliseconds have elapsed since the last event
65
- * *OR* if `<uploadMaxDelay>` milliseconds have elapsed.
65
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
66
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
66
67
  *
67
- * Accepts a callback to perform side-effects and returns a boolean value if we
68
- * should flush events immediately
68
+ * Accepts a callback to perform side-effects and returns true to stop batch
69
+ * processing and hand back control to caller.
69
70
  */
70
71
  addUpdate(cb?: AddUpdateCallback): void;
71
72
  /**
@@ -33,6 +33,10 @@ export declare class Session {
33
33
  * Sequence ID specific to replay updates
34
34
  */
35
35
  private _sequenceId;
36
+ /**
37
+ * Previous session ID
38
+ */
39
+ private _previousSessionId;
36
40
  readonly options: Required<SessionOptions>;
37
41
  constructor(session?: Partial<SessionObject>, { stickySession }?: SessionOptions);
38
42
  get id(): string;
@@ -41,6 +45,8 @@ export declare class Session {
41
45
  set lastActivity(newDate: number);
42
46
  get sequenceId(): number;
43
47
  set sequenceId(id: number);
48
+ get previousSessionId(): string;
49
+ set previousSessionId(id: string);
44
50
  toJSON(): SessionObject;
45
51
  }
46
52
  export {};
@@ -33,11 +33,15 @@ export interface SentryReplayPluginOptions {
33
33
  /**
34
34
  * The amount of time to wait before sending a replay
35
35
  */
36
- uploadMinDelay?: number;
36
+ flushMinDelay?: number;
37
37
  /**
38
38
  * The max amount of time to wait before sending a replay
39
39
  */
40
- uploadMaxDelay?: number;
40
+ flushMaxDelay?: number;
41
+ /**
42
+ * The amount of time to buffer the initial snapshot
43
+ */
44
+ initialFlushDelay?: number;
41
45
  /**
42
46
  * If false, will create a new session per pageload
43
47
  */
package/dist/index.es.js CHANGED
@@ -432,6 +432,16 @@ var Session = /** @class */ (function () {
432
432
  enumerable: false,
433
433
  configurable: true
434
434
  });
435
+ Object.defineProperty(Session.prototype, "previousSessionId", {
436
+ get: function () {
437
+ return this._previousSessionId;
438
+ },
439
+ set: function (id) {
440
+ this._previousSessionId = id;
441
+ },
442
+ enumerable: false,
443
+ configurable: true
444
+ });
435
445
  Session.prototype.toJSON = function () {
436
446
  return {
437
447
  id: this.id,
@@ -551,7 +561,7 @@ function handleScope(scope) {
551
561
  var newBreadcrumb = scope._breadcrumbs[scope._breadcrumbs.length - 1];
552
562
  // Listener can be called when breadcrumbs have not changed, so we store the
553
563
  // reference to the last crumb and only return a crumb if it has changed
554
- if (_LAST_BREADCRUMB === newBreadcrumb) {
564
+ if (_LAST_BREADCRUMB === newBreadcrumb || !newBreadcrumb) {
555
565
  return null;
556
566
  }
557
567
  _LAST_BREADCRUMB = newBreadcrumb;
@@ -596,9 +606,9 @@ var SentryReplay = /** @class */ (function () {
596
606
  function SentryReplay(_a) {
597
607
  if (_a === void 0) { _a = {}; }
598
608
  var _this = this;
599
- var _b = _a.uploadMinDelay, uploadMinDelay = _b === void 0 ? 5000 : _b, _c = _a.uploadMaxDelay, uploadMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.stickySession, stickySession = _d === void 0 ? false : _d, // TBD: Making this opt-in for now
600
- _e = _a.useCompression, // TBD: Making this opt-in for now
601
- useCompression = _e === void 0 ? true : _e, _f = _a.rrwebConfig, _g = _f === void 0 ? {} : _f, _h = _g.maskAllInputs, maskAllInputs = _h === void 0 ? true : _h, _j = _g.blockClass, blockClass = _j === void 0 ? 'sr-block' : _j, _k = _g.ignoreClass, ignoreClass = _k === void 0 ? 'sr-ignore' : _k, _l = _g.maskTextClass, maskTextClass = _l === void 0 ? 'sr-mask' : _l, rrwebRecordOptions = __rest(_g, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
609
+ var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? false : _e, // TBD: Making this opt-in for now
610
+ _f = _a.useCompression, // TBD: Making this opt-in for now
611
+ useCompression = _f === void 0 ? true : _f, _g = _a.rrwebConfig, _h = _g === void 0 ? {} : _g, _j = _h.maskAllInputs, maskAllInputs = _j === void 0 ? true : _j, _k = _h.blockClass, blockClass = _k === void 0 ? 'sr-block' : _k, _l = _h.ignoreClass, ignoreClass = _l === void 0 ? 'sr-ignore' : _l, _m = _h.maskTextClass, maskTextClass = _m === void 0 ? 'sr-mask' : _m, rrwebRecordOptions = __rest(_h, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
602
612
  /**
603
613
  * @inheritDoc
604
614
  */
@@ -616,8 +626,9 @@ var SentryReplay = /** @class */ (function () {
616
626
  */
617
627
  this.performanceEvents = [];
618
628
  /**
619
- * The timestamp of the first event since the last flush.
620
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
629
+ * The timestamp of the first event since the last flush. This is used to
630
+ * determine if the maximum allowed time has passed before events should be
631
+ * flushed again.
621
632
  */
622
633
  this.initialEventTimestampSinceFlush = null;
623
634
  this.performanceObserver = null;
@@ -707,8 +718,14 @@ var SentryReplay = /** @class */ (function () {
707
718
  ) {
708
719
  _this.performanceEvents = __spreadArray(__spreadArray([], _this.performanceEvents, true), list.getEntries(), true);
709
720
  };
721
+ console.log('main2');
710
722
  this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs, blockClass: blockClass, ignoreClass: ignoreClass, maskTextClass: maskTextClass }, rrwebRecordOptions);
711
- this.options = { uploadMinDelay: uploadMinDelay, uploadMaxDelay: uploadMaxDelay, stickySession: stickySession };
723
+ this.options = {
724
+ flushMinDelay: flushMinDelay,
725
+ flushMaxDelay: flushMaxDelay,
726
+ stickySession: stickySession,
727
+ initialFlushDelay: initialFlushDelay,
728
+ };
712
729
  this.eventBuffer = createEventBuffer({ useCompression: useCompression });
713
730
  }
714
731
  SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
@@ -757,25 +774,36 @@ var SentryReplay = /** @class */ (function () {
757
774
  // We need to clear existing events on a checkout, otherwise they are
758
775
  // incremental event updates and should be appended
759
776
  _this.eventBuffer.addEvent(event, isCheckout);
760
- // This event type is a fullsnapshot, we should save immediately when this occurs
777
+ // This event type is a fullsnapshot
761
778
  // See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
762
779
  if (event.type === 2) {
763
- // A fullsnapshot happens on initial load and if we need to start a
764
- // new replay due to idle timeout. In the latter case, a new session *should* have been started
765
- // before triggering a new checkout
780
+ // If the full snapshot is due to an initial load, we will not have
781
+ // a previous session ID. In this case, we want to buffer events
782
+ // for a set amount of time before flushing. This can help avoid
783
+ // capturing replays of users that immediately close the window.
784
+ if (!_this.session.previousSessionId) {
785
+ var now_1 = new Date().getTime();
786
+ setTimeout(function () { return _this.flushUpdate(now_1); }, _this.options.initialFlushDelay);
787
+ return true;
788
+ }
789
+ // The other case where a full snapshot occurs is when a new replay
790
+ // needs to be started due to session expiration. The new session
791
+ // is started before triggering a new checkout and contains the id
792
+ // of the previous session. Do not immediately flush in this case
793
+ // to avoid capturing only the checkout and instead the replay will
794
+ // be captured if they perform any follow-up actions.
766
795
  return true;
767
796
  }
768
- return false;
769
797
  });
770
798
  } }));
771
799
  };
772
800
  /**
773
801
  * We want to batch uploads of replay events. Save events only if
774
- * `<uploadMinDelay>` milliseconds have elapsed since the last event
775
- * *OR* if `<uploadMaxDelay>` milliseconds have elapsed.
802
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
803
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
776
804
  *
777
- * Accepts a callback to perform side-effects and returns a boolean value if we
778
- * should flush events immediately
805
+ * Accepts a callback to perform side-effects and returns true to stop batch
806
+ * processing and hand back control to caller.
779
807
  */
780
808
  SentryReplay.prototype.addUpdate = function (cb) {
781
809
  var _this = this;
@@ -789,25 +817,26 @@ var SentryReplay = /** @class */ (function () {
789
817
  if (this.timeout) {
790
818
  window.clearTimeout(this.timeout);
791
819
  }
820
+ // If callback is true, we do not want to continue with flushing -- the
821
+ // caller will need to handle it.
792
822
  if ((cb === null || cb === void 0 ? void 0 : cb()) === true) {
793
- this.flushUpdate();
794
823
  return;
795
824
  }
796
- var uploadMaxDelayExceeded = isExpired(this.initialEventTimestampSinceFlush, this.options.uploadMaxDelay, now);
797
- // If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,
798
- // Otherwise schedule it to be finished in `this.options.uploadMinDelay`
799
- if (uploadMaxDelayExceeded) {
825
+ var flushMaxDelayExceeded = isExpired(this.initialEventTimestampSinceFlush, this.options.flushMaxDelay, now);
826
+ // If `flushMaxDelayExceeded` is true, then we should finish the replay event immediately,
827
+ // Otherwise schedule it to be finished in `this.options.flushMinDelay`
828
+ if (flushMaxDelayExceeded) {
800
829
  logger.log('replay max delay exceeded, finishing replay event');
801
830
  this.flushUpdate();
802
831
  return;
803
832
  }
804
833
  // Set timer to finish replay event and send replay attachment to
805
- // Sentry. Will be cancelled if an event happens before `uploadMinDelay`
834
+ // Sentry. Will be cancelled if an event happens before `flushMinDelay`
806
835
  // elapses.
807
836
  this.timeout = window.setTimeout(function () {
808
837
  logger.log('replay timeout exceeded, finishing replay event');
809
838
  _this.flushUpdate(now);
810
- }, this.options.uploadMinDelay);
839
+ }, this.options.flushMinDelay);
811
840
  };
812
841
  /**
813
842
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
@@ -824,17 +853,21 @@ var SentryReplay = /** @class */ (function () {
824
853
  * is expired.
825
854
  */
826
855
  SentryReplay.prototype.loadSession = function (_a) {
856
+ var _b, _c;
827
857
  var expiry = _a.expiry;
828
- var _b = getSession({
858
+ var _d = getSession({
829
859
  expiry: expiry,
830
860
  stickySession: this.options.stickySession,
831
861
  currentSession: this.session,
832
- }), type = _b.type, session = _b.session;
862
+ }), type = _d.type, session = _d.session;
833
863
  // If session was newly created (i.e. was not loaded from storage), then
834
864
  // enable flag to create the root replay
835
865
  if (type === 'new') {
836
866
  this.needsCaptureReplay = true;
837
867
  }
868
+ if (session.id !== ((_b = this.session) === null || _b === void 0 ? void 0 : _b.id)) {
869
+ session.previousSessionId = (_c = this.session) === null || _c === void 0 ? void 0 : _c.id;
870
+ }
838
871
  this.session = session;
839
872
  };
840
873
  SentryReplay.prototype.addListeners = function () {
@@ -1011,12 +1044,13 @@ var SentryReplay = /** @class */ (function () {
1011
1044
  };
1012
1045
  SentryReplay.prototype.flushUpdate = function (lastActivity) {
1013
1046
  return __awaiter(this, void 0, void 0, function () {
1014
- var recordingData;
1047
+ var recordingData, err_1;
1015
1048
  return __generator(this, function (_a) {
1016
1049
  switch (_a.label) {
1017
1050
  case 0:
1018
1051
  if (!this.checkAndHandleExpiredSession()) {
1019
1052
  logger.error(new Error('Attempting to finish replay event after session expired.'));
1053
+ return [2 /*return*/];
1020
1054
  }
1021
1055
  if (!this.session.id) {
1022
1056
  console.error(new Error('[Sentry]: No transaction, no replay'));
@@ -1026,18 +1060,27 @@ var SentryReplay = /** @class */ (function () {
1026
1060
  if (!this.eventBuffer.length) {
1027
1061
  return [2 /*return*/];
1028
1062
  }
1029
- return [4 /*yield*/, this.eventBuffer.finish()];
1030
- case 1:
1031
- recordingData = _a.sent();
1032
- this.sendReplay(this.session.id, recordingData);
1033
- this.initialEventTimestampSinceFlush = null;
1034
- // TBD: Alternatively we could update this after every rrweb event
1035
- this.updateLastActivity(lastActivity);
1036
1063
  // Only want to create replay event if session is new
1037
1064
  if (this.needsCaptureReplay) {
1065
+ // This event needs to exist before calling `sendReplay`
1038
1066
  captureReplay(this.session);
1039
1067
  this.needsCaptureReplay = false;
1040
1068
  }
1069
+ // Reset this to null regardless of `sendReplay` result so that future
1070
+ // events will get flushed properly
1071
+ this.initialEventTimestampSinceFlush = null;
1072
+ _a.label = 1;
1073
+ case 1:
1074
+ _a.trys.push([1, 4, , 5]);
1075
+ return [4 /*yield*/, this.eventBuffer.finish()];
1076
+ case 2:
1077
+ recordingData = _a.sent();
1078
+ return [4 /*yield*/, this.sendReplay(this.session.id, recordingData)];
1079
+ case 3:
1080
+ _a.sent();
1081
+ // The below will only happen after successfully sending replay //
1082
+ // TBD: Alternatively we could update this after every rrweb event
1083
+ this.updateLastActivity(lastActivity);
1041
1084
  captureEvent({
1042
1085
  message: "".concat(REPLAY_EVENT_NAME, "-").concat(uuid4().substring(16)),
1043
1086
  tags: {
@@ -1045,7 +1088,12 @@ var SentryReplay = /** @class */ (function () {
1045
1088
  sequenceId: this.session.sequenceId++,
1046
1089
  },
1047
1090
  });
1048
- return [2 /*return*/];
1091
+ return [3 /*break*/, 5];
1092
+ case 4:
1093
+ err_1 = _a.sent();
1094
+ console.error(err_1);
1095
+ return [3 /*break*/, 5];
1096
+ case 5: return [2 /*return*/];
1049
1097
  }
1050
1098
  });
1051
1099
  });
@@ -1102,8 +1150,8 @@ var SentryReplay = /** @class */ (function () {
1102
1150
  return __awaiter(this, void 0, void 0, function () {
1103
1151
  var client, endpoint, ex_1;
1104
1152
  var _this = this;
1105
- return __generator(this, function (_a) {
1106
- switch (_a.label) {
1153
+ return __generator(this, function (_b) {
1154
+ switch (_b.label) {
1107
1155
  case 0:
1108
1156
  // short circuit if there's no events to upload
1109
1157
  if (!events.length) {
@@ -1111,34 +1159,60 @@ var SentryReplay = /** @class */ (function () {
1111
1159
  }
1112
1160
  client = getCurrentHub().getClient();
1113
1161
  endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
1114
- _a.label = 1;
1162
+ _b.label = 1;
1115
1163
  case 1:
1116
- _a.trys.push([1, 3, , 4]);
1164
+ _b.trys.push([1, 3, , 8]);
1117
1165
  return [4 /*yield*/, this.sendReplayRequest({
1118
1166
  endpoint: endpoint,
1119
1167
  events: events,
1120
1168
  })];
1121
1169
  case 2:
1122
- _a.sent();
1170
+ _b.sent();
1123
1171
  this.resetRetries();
1124
1172
  return [2 /*return*/, true];
1125
1173
  case 3:
1126
- ex_1 = _a.sent();
1174
+ ex_1 = _b.sent();
1127
1175
  // we have to catch this otherwise it throws an infinite loop in Sentry
1128
1176
  console.error(ex_1);
1129
1177
  // If an error happened here, it's likely that uploading the attachment
1130
1178
  // failed, we'll can retry with the same events payload
1131
1179
  if (this.retryCount >= MAX_RETRY_COUNT) {
1132
1180
  this.resetRetries();
1181
+ return [2 /*return*/, false];
1133
1182
  }
1134
- else {
1135
- this.retryCount = this.retryCount + 1;
1136
- // will retry in intervals of 5, 10, 15, 20, 25 seconds
1137
- this.retryInterval = this.retryCount * this.retryInterval;
1138
- setTimeout(function () { return _this.sendReplay(eventId, events); }, this.retryInterval);
1139
- }
1183
+ this.retryCount = this.retryCount + 1;
1184
+ // will retry in intervals of 5, 10, 15, 20, 25 seconds
1185
+ this.retryInterval = this.retryCount * this.retryInterval;
1186
+ _b.label = 4;
1187
+ case 4:
1188
+ _b.trys.push([4, 6, , 7]);
1189
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
1190
+ setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
1191
+ var result;
1192
+ return __generator(this, function (_a) {
1193
+ switch (_a.label) {
1194
+ case 0: return [4 /*yield*/, this.sendReplay(eventId, events)];
1195
+ case 1:
1196
+ result = _a.sent();
1197
+ if (result) {
1198
+ resolve(true);
1199
+ }
1200
+ else {
1201
+ reject(new Error('Could not send replay'));
1202
+ }
1203
+ return [2 /*return*/];
1204
+ }
1205
+ });
1206
+ }); }, _this.retryInterval);
1207
+ })];
1208
+ case 5:
1209
+ _b.sent();
1210
+ return [2 /*return*/, true];
1211
+ case 6:
1212
+ _b.sent();
1140
1213
  return [2 /*return*/, false];
1141
- case 4: return [2 /*return*/];
1214
+ case 7: return [3 /*break*/, 8];
1215
+ case 8: return [2 /*return*/];
1142
1216
  }
1143
1217
  });
1144
1218
  });