@atlaskit/collab-provider 8.4.0 → 8.6.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 (88) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/cjs/analytics/analytics-helper.js +135 -0
  3. package/dist/cjs/analytics/performance.js +6 -5
  4. package/dist/cjs/channel.js +242 -223
  5. package/dist/cjs/document/catchup.js +142 -0
  6. package/dist/cjs/document/document-service.js +587 -0
  7. package/dist/cjs/document/step-queue-state.js +56 -0
  8. package/dist/cjs/errors/error-code-mapper.js +86 -67
  9. package/dist/cjs/errors/error-types.js +329 -21
  10. package/dist/cjs/helpers/utils.js +1 -12
  11. package/dist/cjs/index.js +8 -1
  12. package/dist/cjs/metadata/metadata-service.js +82 -0
  13. package/dist/cjs/participants/participants-helper.js +52 -0
  14. package/dist/cjs/participants/participants-service.js +259 -0
  15. package/dist/cjs/participants/participants-state.js +56 -0
  16. package/dist/cjs/{provider/telepointers.js → participants/telepointers-helper.js} +6 -6
  17. package/dist/cjs/provider/commit-step.js +14 -6
  18. package/dist/cjs/provider/index.js +291 -780
  19. package/dist/cjs/types.js +6 -1
  20. package/dist/cjs/version-wrapper.js +1 -1
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/es2019/analytics/{index.js → analytics-helper.js} +15 -4
  23. package/dist/es2019/analytics/performance.js +5 -6
  24. package/dist/es2019/channel.js +140 -113
  25. package/dist/es2019/{provider → document}/catchup.js +6 -4
  26. package/dist/es2019/document/document-service.js +472 -0
  27. package/dist/es2019/document/step-queue-state.js +35 -0
  28. package/dist/es2019/errors/error-code-mapper.js +87 -63
  29. package/dist/es2019/errors/error-types.js +221 -5
  30. package/dist/es2019/helpers/utils.js +0 -10
  31. package/dist/es2019/index.js +2 -1
  32. package/dist/es2019/metadata/metadata-service.js +61 -0
  33. package/dist/es2019/participants/participants-helper.js +25 -0
  34. package/dist/es2019/participants/participants-service.js +207 -0
  35. package/dist/es2019/participants/participants-state.js +30 -0
  36. package/dist/es2019/{provider/telepointers.js → participants/telepointers-helper.js} +2 -2
  37. package/dist/es2019/provider/commit-step.js +12 -5
  38. package/dist/es2019/provider/index.js +240 -640
  39. package/dist/es2019/types.js +8 -1
  40. package/dist/es2019/version-wrapper.js +1 -1
  41. package/dist/es2019/version.json +1 -1
  42. package/dist/esm/analytics/analytics-helper.js +128 -0
  43. package/dist/esm/analytics/performance.js +5 -6
  44. package/dist/esm/channel.js +243 -224
  45. package/dist/esm/document/catchup.js +133 -0
  46. package/dist/esm/document/document-service.js +579 -0
  47. package/dist/esm/document/step-queue-state.js +48 -0
  48. package/dist/esm/errors/error-code-mapper.js +87 -64
  49. package/dist/esm/errors/error-types.js +321 -18
  50. package/dist/esm/helpers/utils.js +0 -10
  51. package/dist/esm/index.js +2 -1
  52. package/dist/esm/metadata/metadata-service.js +74 -0
  53. package/dist/esm/participants/participants-helper.js +44 -0
  54. package/dist/esm/participants/participants-service.js +251 -0
  55. package/dist/esm/participants/participants-state.js +48 -0
  56. package/dist/esm/{provider/telepointers.js → participants/telepointers-helper.js} +4 -4
  57. package/dist/esm/provider/commit-step.js +12 -5
  58. package/dist/esm/provider/index.js +291 -779
  59. package/dist/esm/types.js +8 -1
  60. package/dist/esm/version-wrapper.js +1 -1
  61. package/dist/esm/version.json +1 -1
  62. package/dist/types/analytics/{index.d.ts → analytics-helper.d.ts} +3 -1
  63. package/dist/types/analytics/performance.d.ts +3 -1
  64. package/dist/types/analytics/ufo.d.ts +1 -1
  65. package/dist/types/channel.d.ts +13 -6
  66. package/dist/types/document/document-service.d.ts +86 -0
  67. package/dist/types/document/step-queue-state.d.ts +16 -0
  68. package/dist/types/errors/error-code-mapper.d.ts +2 -36
  69. package/dist/types/errors/error-types.d.ts +439 -4
  70. package/dist/types/helpers/const.d.ts +2 -2
  71. package/dist/types/helpers/utils.d.ts +0 -6
  72. package/dist/types/index.d.ts +3 -1
  73. package/dist/types/metadata/metadata-service.d.ts +25 -0
  74. package/dist/types/participants/participants-helper.d.ts +15 -0
  75. package/dist/types/participants/participants-service.d.ts +74 -0
  76. package/dist/types/participants/participants-state.d.ts +13 -0
  77. package/dist/types/participants/telepointers-helper.d.ts +4 -0
  78. package/dist/types/provider/commit-step.d.ts +17 -6
  79. package/dist/types/provider/index.d.ts +81 -78
  80. package/dist/types/types.d.ts +56 -31
  81. package/package.json +6 -6
  82. package/report.api.md +187 -21
  83. package/dist/cjs/analytics/index.js +0 -95
  84. package/dist/cjs/provider/catchup.js +0 -139
  85. package/dist/esm/analytics/index.js +0 -88
  86. package/dist/esm/provider/catchup.js +0 -130
  87. package/dist/types/provider/telepointers.d.ts +0 -5
  88. /package/dist/types/{provider → document}/catchup.d.ts +0 -0
@@ -0,0 +1,133 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ 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; }
4
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7
+ import { createLogger } from '../helpers/utils';
8
+ import { StepMap, Mapping } from 'prosemirror-transform';
9
+ var logger = createLogger('Catchup', 'red');
10
+
11
+ /**
12
+ * Rebase the steps based on the mapping pipeline.
13
+ * Some steps could be lost, if they are no longer
14
+ * invalid after rebased.
15
+ */
16
+ export function rebaseSteps(steps, mapping) {
17
+ var newSteps = [];
18
+ var _iterator = _createForOfIteratorHelper(steps),
19
+ _step;
20
+ try {
21
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22
+ var step = _step.value;
23
+ var newStep = step.map(mapping);
24
+ // newStep could be null(means invalid after rebase) when can't rebase.
25
+ if (newStep) {
26
+ newSteps.push(newStep);
27
+ }
28
+ }
29
+ } catch (err) {
30
+ _iterator.e(err);
31
+ } finally {
32
+ _iterator.f();
33
+ }
34
+ return newSteps;
35
+ }
36
+ export var catchup = /*#__PURE__*/function () {
37
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(opt) {
38
+ var _yield$opt$fetchCatch, doc, serverStepMaps, serverVersion, metadata, currentPmVersion, unconfirmedSteps, _unconfirmedSteps, stepMaps, mapping, newUnconfirmedSteps;
39
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
40
+ while (1) {
41
+ switch (_context.prev = _context.next) {
42
+ case 0:
43
+ _context.next = 2;
44
+ return opt.fetchCatchup(opt.getCurrentPmVersion());
45
+ case 2:
46
+ _yield$opt$fetchCatch = _context.sent;
47
+ doc = _yield$opt$fetchCatch.doc;
48
+ serverStepMaps = _yield$opt$fetchCatch.stepMaps;
49
+ serverVersion = _yield$opt$fetchCatch.version;
50
+ metadata = _yield$opt$fetchCatch.metadata;
51
+ if (doc) {
52
+ currentPmVersion = opt.getCurrentPmVersion();
53
+ if (typeof serverVersion === 'undefined') {
54
+ logger("Could not determine server version");
55
+ } else if (serverVersion <= currentPmVersion) {
56
+ // there are no step maps in this case after page recovery
57
+ unconfirmedSteps = opt.getUnconfirmedSteps(); // replace the entire document
58
+ logger("Replacing document: ".concat(doc));
59
+ logger("getting metadata: ".concat(metadata));
60
+ // Replace local document and version number
61
+ opt.updateDocument({
62
+ doc: JSON.parse(doc),
63
+ version: serverVersion,
64
+ metadata: metadata,
65
+ reserveCursor: true
66
+ });
67
+ opt.updateMetadata(metadata);
68
+ if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
69
+ opt.applyLocalSteps(unconfirmedSteps);
70
+ }
71
+ } else {
72
+ // Please, do not use those steps inside of async
73
+ // method. That will lead to outdated steps
74
+ _unconfirmedSteps = opt.getUnconfirmedSteps();
75
+ logger("Too far behind[current: v".concat(currentPmVersion, ", server: v").concat(serverVersion, ". ").concat(serverStepMaps.length, " steps need to catchup]"));
76
+ /**
77
+ * Remove steps from queue where the version is older than
78
+ * the version we received from service. Keep steps that might be
79
+ * newer.
80
+ */
81
+ opt.filterQueue(function (data) {
82
+ return data.version > serverVersion;
83
+ });
84
+
85
+ // We are too far behind - replace the entire document
86
+ logger("Replacing document: ".concat(doc));
87
+ logger("getting metadata: ".concat(metadata));
88
+
89
+ // Replace local document and version number
90
+ opt.updateDocument({
91
+ doc: JSON.parse(doc),
92
+ version: serverVersion,
93
+ metadata: metadata,
94
+ reserveCursor: true
95
+ });
96
+ opt.updateMetadata(metadata);
97
+
98
+ // After replacing the whole document in the editor, we need to reapply the unconfirmed
99
+ // steps back into the editor, so we don't lose any data. But before that, we need to rebase
100
+ // those steps since their position could be changed after replacing.
101
+ // https://prosemirror.net/docs/guide/#transform.rebasing
102
+ if (_unconfirmedSteps !== null && _unconfirmedSteps !== void 0 && _unconfirmedSteps.length) {
103
+ // Create StepMap from StepMap JSON
104
+ // eslint-disable-next-line no-unused-vars
105
+ stepMaps = serverStepMaps.map(function (_ref2) {
106
+ var ranges = _ref2.ranges,
107
+ inverted = _ref2.inverted;
108
+ // Due to @types/prosemirror-transform mismatch with the actual
109
+ // constructor, hack to set the `inverted`.
110
+ var stepMap = new StepMap(ranges);
111
+ stepMap.inverted = inverted;
112
+ return stepMap;
113
+ }); // create Mapping used for Step.map
114
+ mapping = new Mapping(stepMaps);
115
+ logger("".concat(_unconfirmedSteps.length, " unconfirmed steps before rebased: ").concat(JSON.stringify(_unconfirmedSteps)));
116
+ newUnconfirmedSteps = rebaseSteps(_unconfirmedSteps, mapping);
117
+ logger("Re-aply ".concat(newUnconfirmedSteps.length, " mapped unconfirmed steps: ").concat(JSON.stringify(newUnconfirmedSteps)));
118
+ // Re-apply local steps
119
+ opt.applyLocalSteps(newUnconfirmedSteps);
120
+ }
121
+ }
122
+ }
123
+ case 8:
124
+ case "end":
125
+ return _context.stop();
126
+ }
127
+ }
128
+ }, _callee);
129
+ }));
130
+ return function catchup(_x) {
131
+ return _ref.apply(this, arguments);
132
+ };
133
+ }();