@atlaskit/collab-provider 8.6.0 → 8.8.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 (67) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/analytics/analytics-helper.js +25 -28
  3. package/dist/cjs/analytics/performance.js +4 -4
  4. package/dist/cjs/channel.js +218 -224
  5. package/dist/cjs/connectivity/network.js +4 -4
  6. package/dist/cjs/disconnected-reason-mapper.js +4 -4
  7. package/dist/cjs/document/catchup.js +84 -87
  8. package/dist/cjs/document/document-service.js +205 -234
  9. package/dist/cjs/document/step-queue-state.js +4 -5
  10. package/dist/cjs/errors/error-types.js +25 -24
  11. package/dist/cjs/helpers/const.js +12 -12
  12. package/dist/cjs/metadata/metadata-service.js +15 -20
  13. package/dist/cjs/participants/participants-helper.js +22 -32
  14. package/dist/cjs/participants/participants-service.js +89 -101
  15. package/dist/cjs/participants/participants-state.js +2 -4
  16. package/dist/cjs/provider/index.js +130 -136
  17. package/dist/cjs/types.js +11 -5
  18. package/dist/cjs/version-wrapper.js +1 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/analytics/analytics-helper.js +3 -3
  21. package/dist/es2019/analytics/performance.js +3 -3
  22. package/dist/es2019/channel.js +21 -20
  23. package/dist/es2019/connectivity/network.js +3 -3
  24. package/dist/es2019/disconnected-reason-mapper.js +3 -3
  25. package/dist/es2019/document/document-service.js +17 -25
  26. package/dist/es2019/document/step-queue-state.js +4 -5
  27. package/dist/es2019/errors/error-types.js +26 -25
  28. package/dist/es2019/helpers/const.js +9 -9
  29. package/dist/es2019/metadata/metadata-service.js +15 -19
  30. package/dist/es2019/participants/participants-helper.js +3 -8
  31. package/dist/es2019/participants/participants-service.js +42 -52
  32. package/dist/es2019/participants/participants-state.js +1 -2
  33. package/dist/es2019/provider/index.js +68 -71
  34. package/dist/es2019/types.js +13 -3
  35. package/dist/es2019/version-wrapper.js +1 -1
  36. package/dist/es2019/version.json +1 -1
  37. package/dist/esm/analytics/analytics-helper.js +25 -28
  38. package/dist/esm/analytics/performance.js +3 -3
  39. package/dist/esm/channel.js +218 -224
  40. package/dist/esm/connectivity/network.js +3 -3
  41. package/dist/esm/disconnected-reason-mapper.js +3 -3
  42. package/dist/esm/document/catchup.js +84 -87
  43. package/dist/esm/document/document-service.js +205 -234
  44. package/dist/esm/document/step-queue-state.js +4 -5
  45. package/dist/esm/errors/error-types.js +26 -25
  46. package/dist/esm/helpers/const.js +9 -9
  47. package/dist/esm/metadata/metadata-service.js +15 -20
  48. package/dist/esm/participants/participants-helper.js +22 -32
  49. package/dist/esm/participants/participants-service.js +89 -101
  50. package/dist/esm/participants/participants-state.js +2 -4
  51. package/dist/esm/provider/index.js +130 -136
  52. package/dist/esm/types.js +13 -3
  53. package/dist/esm/version-wrapper.js +1 -1
  54. package/dist/esm/version.json +1 -1
  55. package/dist/types/channel.d.ts +1 -1
  56. package/dist/types/feature-flags/types.d.ts +1 -1
  57. package/dist/types/metadata/metadata-service.d.ts +1 -1
  58. package/dist/types/participants/participants-helper.d.ts +2 -3
  59. package/dist/types/participants/participants-service.d.ts +4 -8
  60. package/dist/types/provider/index.d.ts +6 -0
  61. package/dist/types/types.d.ts +15 -9
  62. package/package.json +16 -11
  63. package/report.api.md +11 -5
  64. package/channel/package.json +0 -15
  65. package/config/package.json +0 -15
  66. package/disconnected-reason-mapper/package.json +0 -15
  67. package/emitter/package.json +0 -15
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.DocumentService = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -23,14 +23,11 @@ var _stepQueueState = require("./step-queue-state");
23
23
  var _errorTypes = require("../errors/error-types");
24
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
25
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
27
26
  var CATCHUP_THROTTLE = 1 * 1000; // 1 second
28
27
 
29
28
  var noop = function noop() {};
30
29
  var logger = (0, _utils.createLogger)('documentService', 'black');
31
30
  var DocumentService = /*#__PURE__*/function () {
32
- // Fires analytics to editor when collab editor cannot sync up
33
-
34
31
  // ClientID is the unique ID for a prosemirror client. Used for step-rebasing.
35
32
 
36
33
  /**
@@ -48,7 +45,11 @@ var DocumentService = /*#__PURE__*/function () {
48
45
  function DocumentService(participantsService, analyticsHelper, fetchCatchup, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService) {
49
46
  var _this = this;
50
47
  (0, _classCallCheck2.default)(this, DocumentService);
48
+ // Fires analytics to editor when collab editor cannot sync up
51
49
  (0, _defineProperty2.default)(this, "stepRejectCounter", 0);
50
+ /**
51
+ * To prevent calling catchup to often, use lodash throttle to reduce the frequency
52
+ */
52
53
  (0, _defineProperty2.default)(this, "throttledCatchup", (0, _throttle.default)(function () {
53
54
  return _this.catchup();
54
55
  }, CATCHUP_THROTTLE, {
@@ -56,59 +57,62 @@ var DocumentService = /*#__PURE__*/function () {
56
57
  // TODO: why shouldn't this be leading?
57
58
  trailing: true
58
59
  }));
59
- (0, _defineProperty2.default)(this, "catchup", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
60
+ /**
61
+ * Called when:
62
+ * * session established(offline -> online)
63
+ * * try to accept steps but version is behind.
64
+ */
65
+ (0, _defineProperty2.default)(this, "catchup", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
60
66
  var start, _this$analyticsHelper, latency, _this$analyticsHelper2, _this$analyticsHelper3, _latency;
61
- return _regeneratorRuntime().wrap(function _callee$(_context) {
62
- while (1) {
63
- switch (_context.prev = _context.next) {
64
- case 0:
65
- start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
66
- if (!_this.stepQueue.isPaused()) {
67
- _context.next = 4;
68
- break;
69
- }
70
- logger("Queue is paused. Aborting.");
71
- return _context.abrupt("return");
72
- case 4:
73
- _this.stepQueue.pauseQueue();
74
- _context.prev = 5;
75
- _context.next = 8;
76
- return (0, _catchup.catchup)({
77
- getCurrentPmVersion: _this.getCurrentPmVersion,
78
- fetchCatchup: _this.fetchCatchup,
79
- getUnconfirmedSteps: _this.getUnconfirmedSteps,
80
- filterQueue: _this.stepQueue.filterQueue,
81
- applyLocalSteps: _this.applyLocalSteps,
82
- updateDocument: _this.updateDocument,
83
- updateMetadata: _this.metadataService.updateMetadata
84
- });
85
- case 8:
86
- latency = new Date().getTime() - start;
87
- (_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 ? void 0 : _this$analyticsHelper.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
88
- latency: latency
89
- });
90
- _context.next = 18;
67
+ return _regenerator.default.wrap(function _callee$(_context) {
68
+ while (1) switch (_context.prev = _context.next) {
69
+ case 0:
70
+ start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
71
+ if (!_this.stepQueue.isPaused()) {
72
+ _context.next = 4;
91
73
  break;
92
- case 12:
93
- _context.prev = 12;
94
- _context.t0 = _context["catch"](5);
95
- _latency = new Date().getTime() - start;
96
- (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
97
- latency: _latency
98
- });
99
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(_context.t0, 'Error while catching up');
100
- logger("Catch-Up Failed:", _context.t0.message);
101
- case 18:
102
- _context.prev = 18;
103
- _this.stepQueue.resumeQueue();
104
- _this.processQueue();
105
- _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls commitStep which will either catchup on onStepsAdded or onErrorHandled
106
- _this.stepRejectCounter = 0;
107
- return _context.finish(18);
108
- case 24:
109
- case "end":
110
- return _context.stop();
111
- }
74
+ }
75
+ logger("Queue is paused. Aborting.");
76
+ return _context.abrupt("return");
77
+ case 4:
78
+ _this.stepQueue.pauseQueue();
79
+ _context.prev = 5;
80
+ _context.next = 8;
81
+ return (0, _catchup.catchup)({
82
+ getCurrentPmVersion: _this.getCurrentPmVersion,
83
+ fetchCatchup: _this.fetchCatchup,
84
+ getUnconfirmedSteps: _this.getUnconfirmedSteps,
85
+ filterQueue: _this.stepQueue.filterQueue,
86
+ applyLocalSteps: _this.applyLocalSteps,
87
+ updateDocument: _this.updateDocument,
88
+ updateMetadata: _this.metadataService.updateMetadata
89
+ });
90
+ case 8:
91
+ latency = new Date().getTime() - start;
92
+ (_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 ? void 0 : _this$analyticsHelper.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
93
+ latency: latency
94
+ });
95
+ _context.next = 18;
96
+ break;
97
+ case 12:
98
+ _context.prev = 12;
99
+ _context.t0 = _context["catch"](5);
100
+ _latency = new Date().getTime() - start;
101
+ (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
102
+ latency: _latency
103
+ });
104
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(_context.t0, 'Error while catching up');
105
+ logger("Catch-Up Failed:", _context.t0.message);
106
+ case 18:
107
+ _context.prev = 18;
108
+ _this.stepQueue.resumeQueue();
109
+ _this.processQueue();
110
+ _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls commitStep which will either catchup on onStepsAdded or onErrorHandled
111
+ _this.stepRejectCounter = 0;
112
+ return _context.finish(18);
113
+ case 24:
114
+ case "end":
115
+ return _context.stop();
112
116
  }
113
117
  }, _callee, null, [[5, 12, 18, 24]]);
114
118
  })));
@@ -122,41 +126,39 @@ var DocumentService = /*#__PURE__*/function () {
122
126
  }
123
127
  return (0, _prosemirrorCollab.getVersion)(state);
124
128
  });
125
- (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
129
+ (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
126
130
  var _this$analyticsHelper5, state, adfDocument, currentState, measure, _this$analyticsHelper6, _this$analyticsHelper7, _measure;
127
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
128
- while (1) {
129
- switch (_context2.prev = _context2.next) {
130
- case 0:
131
- _context2.prev = 0;
132
- (0, _performance.startMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
131
+ return _regenerator.default.wrap(function _callee2$(_context2) {
132
+ while (1) switch (_context2.prev = _context2.next) {
133
+ case 0:
134
+ _context2.prev = 0;
135
+ (0, _performance.startMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
133
136
 
134
- // Convert ProseMirror document in Editor state to ADF document
135
- state = _this.getState();
136
- adfDocument = new _editorJsonTransformer.JSONTransformer().encode(state.doc);
137
- currentState = {
138
- content: adfDocument,
139
- title: _this.metadataService.getTitle(),
140
- stepVersion: (0, _prosemirrorCollab.getVersion)(state)
141
- };
142
- measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
143
- (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
144
- latency: measure === null || measure === void 0 ? void 0 : measure.duration
145
- });
146
- return _context2.abrupt("return", currentState);
147
- case 10:
148
- _context2.prev = 10;
149
- _context2.t0 = _context2["catch"](0);
150
- _measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
151
- (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
152
- latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
153
- });
154
- (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
155
- throw _context2.t0;
156
- case 16:
157
- case "end":
158
- return _context2.stop();
159
- }
137
+ // Convert ProseMirror document in Editor state to ADF document
138
+ state = _this.getState();
139
+ adfDocument = new _editorJsonTransformer.JSONTransformer().encode(state.doc);
140
+ currentState = {
141
+ content: adfDocument,
142
+ title: _this.metadataService.getTitle(),
143
+ stepVersion: (0, _prosemirrorCollab.getVersion)(state)
144
+ };
145
+ measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
146
+ (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
147
+ latency: measure === null || measure === void 0 ? void 0 : measure.duration
148
+ });
149
+ return _context2.abrupt("return", currentState);
150
+ case 10:
151
+ _context2.prev = 10;
152
+ _context2.t0 = _context2["catch"](0);
153
+ _measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
154
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
155
+ latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
156
+ });
157
+ (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
158
+ throw _context2.t0;
159
+ case 16:
160
+ case "end":
161
+ return _context2.stop();
160
162
  }
161
163
  }, _callee2, null, [[0, 10]]);
162
164
  })));
@@ -186,6 +188,9 @@ var DocumentService = /*#__PURE__*/function () {
186
188
  steps: steps
187
189
  });
188
190
  });
191
+ /**
192
+ * Called when we receive steps from the service
193
+ */
189
194
  (0, _defineProperty2.default)(this, "onStepsAdded", function (data) {
190
195
  logger("Received steps", {
191
196
  steps: data.steps,
@@ -224,6 +229,7 @@ var DocumentService = /*#__PURE__*/function () {
224
229
  });
225
230
  }
226
231
  });
232
+ // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
227
233
  (0, _defineProperty2.default)(this, "onRestore", function (_ref4) {
228
234
  var doc = _ref4.doc,
229
235
  version = _ref4.version,
@@ -269,39 +275,37 @@ var DocumentService = /*#__PURE__*/function () {
269
275
  });
270
276
  }
271
277
  });
272
- (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
278
+ (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
273
279
  var _this$analyticsHelper14, currentState, measure, _this$analyticsHelper15, _this$analyticsHelper16, _measure2;
274
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
275
- while (1) {
276
- switch (_context3.prev = _context3.next) {
277
- case 0:
278
- _context3.prev = 0;
279
- (0, _performance.startMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
280
- _context3.next = 4;
281
- return _this.commitUnconfirmedSteps();
282
- case 4:
283
- _context3.next = 6;
284
- return _this.getCurrentState();
285
- case 6:
286
- currentState = _context3.sent;
287
- measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
288
- (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
289
- latency: measure === null || measure === void 0 ? void 0 : measure.duration
290
- });
291
- return _context3.abrupt("return", currentState);
292
- case 12:
293
- _context3.prev = 12;
294
- _context3.t0 = _context3["catch"](0);
295
- _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
296
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
297
- latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
298
- });
299
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendErrorEvent(_context3.t0, 'Error while returning ADF version of the final draft document');
300
- throw _context3.t0;
301
- case 18:
302
- case "end":
303
- return _context3.stop();
304
- }
280
+ return _regenerator.default.wrap(function _callee3$(_context3) {
281
+ while (1) switch (_context3.prev = _context3.next) {
282
+ case 0:
283
+ _context3.prev = 0;
284
+ (0, _performance.startMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
285
+ _context3.next = 4;
286
+ return _this.commitUnconfirmedSteps();
287
+ case 4:
288
+ _context3.next = 6;
289
+ return _this.getCurrentState();
290
+ case 6:
291
+ currentState = _context3.sent;
292
+ measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
293
+ (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
294
+ latency: measure === null || measure === void 0 ? void 0 : measure.duration
295
+ });
296
+ return _context3.abrupt("return", currentState);
297
+ case 12:
298
+ _context3.prev = 12;
299
+ _context3.t0 = _context3["catch"](0);
300
+ _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
301
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
302
+ latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
303
+ });
304
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendErrorEvent(_context3.t0, 'Error while returning ADF version of the final draft document');
305
+ throw _context3.t0;
306
+ case 18:
307
+ case "end":
308
+ return _context3.stop();
305
309
  }
306
310
  }, _callee3, null, [[0, 12]]);
307
311
  })));
@@ -318,102 +322,90 @@ var DocumentService = /*#__PURE__*/function () {
318
322
  reserveCursor: reserveCursor
319
323
  } : {}));
320
324
  });
321
- (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
322
- var unconfirmedSteps, _this$analyticsHelper18, _this$analyticsHelper19, measure;
323
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
324
- while (1) {
325
- switch (_context5.prev = _context5.next) {
326
- case 0:
327
- unconfirmedSteps = _this.getUnconfirmedSteps();
328
- _context5.prev = 1;
329
- if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
330
- _context5.next = 4;
331
- break;
332
- }
333
- return _context5.delegateYield( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
334
- var _this$analyticsHelper17;
335
- var count, unconfirmedTrs, lastTr, isLastTrConfirmed, nextUnconfirmedSteps, nextUnconfirmedTrs, state, measure;
336
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
337
- while (1) {
338
- switch (_context4.prev = _context4.next) {
339
- case 0:
340
- (0, _performance.startMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
341
- count = 0; // We use origins here as steps can be rebased. When steps are rebased a new step is created.
342
- // This means that we can not track if it has been removed from the unconfirmed array or not.
343
- // Origins points to the original transaction that the step was created in. This is never changed
344
- // and gets passed down when a step is rebased.
345
- unconfirmedTrs = _this.getUnconfirmedStepsOrigins();
346
- lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
347
- isLastTrConfirmed = false;
348
- case 5:
349
- if (isLastTrConfirmed) {
350
- _context4.next = 16;
351
- break;
352
- }
353
- _this.sendStepsFromCurrentState();
354
- _context4.next = 9;
355
- return (0, _utils.sleep)(1000);
356
- case 9:
357
- nextUnconfirmedSteps = _this.getUnconfirmedSteps();
358
- if (nextUnconfirmedSteps !== null && nextUnconfirmedSteps !== void 0 && nextUnconfirmedSteps.length) {
359
- nextUnconfirmedTrs = _this.getUnconfirmedStepsOrigins();
360
- isLastTrConfirmed = !(nextUnconfirmedTrs !== null && nextUnconfirmedTrs !== void 0 && nextUnconfirmedTrs.some(function (tr) {
361
- return tr === lastTr;
362
- }));
363
- } else {
364
- isLastTrConfirmed = true;
365
- }
366
- if (!(!isLastTrConfirmed && count++ >= _const.ACK_MAX_TRY)) {
367
- _context4.next = 14;
368
- break;
369
- }
370
- if (_this.onSyncUpError) {
371
- state = _this.getState();
372
- _this.onSyncUpError({
373
- lengthOfUnconfirmedSteps: nextUnconfirmedSteps === null || nextUnconfirmedSteps === void 0 ? void 0 : nextUnconfirmedSteps.length,
374
- tries: count,
375
- maxRetries: _const.ACK_MAX_TRY,
376
- clientId: _this.clientId,
377
- version: (0, _prosemirrorCollab.getVersion)(state)
378
- });
379
- }
380
- throw new Error("Can't sync up with Collab Service");
381
- case 14:
382
- _context4.next = 5;
383
- break;
384
- case 16:
385
- measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
386
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
387
- latency: measure === null || measure === void 0 ? void 0 : measure.duration,
388
- // upon success, emit the total number of unconfirmed steps we synced
389
- numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
390
- });
391
- case 18:
392
- case "end":
393
- return _context4.stop();
394
- }
395
- }
396
- }, _callee4);
397
- })(), "t0", 4);
398
- case 4:
399
- _context5.next = 12;
325
+ /**
326
+ * Commit the unconfirmed local steps to the back-end service
327
+ * @throws {Error} Couldn't sync the steps after retrying 30 times
328
+ */
329
+ (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
330
+ var unconfirmedSteps, _this$analyticsHelper17, count, unconfirmedTrs, lastTr, isLastTrConfirmed, nextUnconfirmedSteps, nextUnconfirmedTrs, state, measure, _this$analyticsHelper18, _this$analyticsHelper19, _measure3;
331
+ return _regenerator.default.wrap(function _callee4$(_context4) {
332
+ while (1) switch (_context4.prev = _context4.next) {
333
+ case 0:
334
+ unconfirmedSteps = _this.getUnconfirmedSteps();
335
+ _context4.prev = 1;
336
+ if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
337
+ _context4.next = 21;
338
+ break;
339
+ }
340
+ (0, _performance.startMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
341
+ count = 0; // We use origins here as steps can be rebased. When steps are rebased a new step is created.
342
+ // This means that we can not track if it has been removed from the unconfirmed array or not.
343
+ // Origins points to the original transaction that the step was created in. This is never changed
344
+ // and gets passed down when a step is rebased.
345
+ unconfirmedTrs = _this.getUnconfirmedStepsOrigins();
346
+ lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
347
+ isLastTrConfirmed = false;
348
+ case 8:
349
+ if (isLastTrConfirmed) {
350
+ _context4.next = 19;
351
+ break;
352
+ }
353
+ _this.sendStepsFromCurrentState();
354
+ _context4.next = 12;
355
+ return (0, _utils.sleep)(1000);
356
+ case 12:
357
+ nextUnconfirmedSteps = _this.getUnconfirmedSteps();
358
+ if (nextUnconfirmedSteps !== null && nextUnconfirmedSteps !== void 0 && nextUnconfirmedSteps.length) {
359
+ nextUnconfirmedTrs = _this.getUnconfirmedStepsOrigins();
360
+ isLastTrConfirmed = !(nextUnconfirmedTrs !== null && nextUnconfirmedTrs !== void 0 && nextUnconfirmedTrs.some(function (tr) {
361
+ return tr === lastTr;
362
+ }));
363
+ } else {
364
+ isLastTrConfirmed = true;
365
+ }
366
+ if (!(!isLastTrConfirmed && count++ >= _const.ACK_MAX_TRY)) {
367
+ _context4.next = 17;
400
368
  break;
401
- case 6:
402
- _context5.prev = 6;
403
- _context5.t1 = _context5["catch"](1);
404
- measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
405
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 ? void 0 : _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
406
- latency: measure === null || measure === void 0 ? void 0 : measure.duration,
407
- numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
369
+ }
370
+ if (_this.onSyncUpError) {
371
+ state = _this.getState();
372
+ _this.onSyncUpError({
373
+ lengthOfUnconfirmedSteps: nextUnconfirmedSteps === null || nextUnconfirmedSteps === void 0 ? void 0 : nextUnconfirmedSteps.length,
374
+ tries: count,
375
+ maxRetries: _const.ACK_MAX_TRY,
376
+ clientId: _this.clientId,
377
+ version: (0, _prosemirrorCollab.getVersion)(state)
408
378
  });
409
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 ? void 0 : _this$analyticsHelper19.sendErrorEvent(_context5.t1, 'Error while committing unconfirmed steps');
410
- throw _context5.t1;
411
- case 12:
412
- case "end":
413
- return _context5.stop();
414
- }
379
+ }
380
+ throw new Error("Can't sync up with Collab Service");
381
+ case 17:
382
+ _context4.next = 8;
383
+ break;
384
+ case 19:
385
+ measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
386
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
387
+ latency: measure === null || measure === void 0 ? void 0 : measure.duration,
388
+ // upon success, emit the total number of unconfirmed steps we synced
389
+ numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
390
+ });
391
+ case 21:
392
+ _context4.next = 29;
393
+ break;
394
+ case 23:
395
+ _context4.prev = 23;
396
+ _context4.t0 = _context4["catch"](1);
397
+ _measure3 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
398
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 ? void 0 : _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
399
+ latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
400
+ numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
401
+ });
402
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 ? void 0 : _this$analyticsHelper19.sendErrorEvent(_context4.t0, 'Error while committing unconfirmed steps');
403
+ throw _context4.t0;
404
+ case 29:
405
+ case "end":
406
+ return _context4.stop();
415
407
  }
416
- }, _callee5, null, [[1, 6]]);
408
+ }, _callee4, null, [[1, 23]]);
417
409
  })));
418
410
  (0, _defineProperty2.default)(this, "onStepRejectedError", function () {
419
411
  _this.stepRejectCounter++;
@@ -441,16 +433,6 @@ var DocumentService = /*#__PURE__*/function () {
441
433
  this.metadataService = metadataService;
442
434
  this.stepQueue = new _stepQueueState.StepQueueState();
443
435
  }
444
-
445
- /**
446
- * To prevent calling catchup to often, use lodash throttle to reduce the frequency
447
- */
448
-
449
- /**
450
- * Called when:
451
- * * session established(offline -> online)
452
- * * try to accept steps but version is behind.
453
- */
454
436
  (0, _createClass2.default)(DocumentService, [{
455
437
  key: "processQueue",
456
438
  value: function processQueue() {
@@ -507,17 +489,6 @@ var DocumentService = /*#__PURE__*/function () {
507
489
  }
508
490
  }
509
491
  }
510
-
511
- /**
512
- * Called when we receive steps from the service
513
- */
514
-
515
- // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
516
-
517
- /**
518
- * Commit the unconfirmed local steps to the back-end service
519
- * @throws {Error} Couldn't sync the steps after retrying 30 times
520
- */
521
492
  }, {
522
493
  key: "setup",
523
494
  value: function setup(_ref9) {
@@ -23,6 +23,10 @@ var StepQueueState = /*#__PURE__*/function () {
23
23
  (0, _defineProperty2.default)(this, "filterQueue", function (condition) {
24
24
  _this.queue = _this.queue.filter(condition);
25
25
  });
26
+ /**
27
+ * Get whether the document service has stopped processing new steps whilst it carries out processes such as catchup.
28
+ * Exposed for testing
29
+ */
26
30
  (0, _defineProperty2.default)(this, "isPaused", function () {
27
31
  return _this.queuePaused;
28
32
  });
@@ -45,11 +49,6 @@ var StepQueueState = /*#__PURE__*/function () {
45
49
  });
46
50
  this.queue = orderedQueue;
47
51
  }
48
-
49
- /**
50
- * Get whether the document service has stopped processing new steps whilst it carries out processes such as catchup.
51
- * Exposed for testing
52
- */
53
52
  }]);
54
53
  return StepQueueState;
55
54
  }();