@atlaskit/collab-provider 7.3.0 → 7.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/channel/package.json +1 -0
- package/disconnected-reason-mapper/package.json +1 -0
- package/dist/cjs/provider/index.js +82 -46
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/provider/index.js +36 -23
- package/dist/es2019/version.json +1 -1
- package/dist/esm/provider/index.js +82 -46
- package/dist/esm/version.json +1 -1
- package/emitter/package.json +1 -0
- package/error-code-mapper/package.json +1 -0
- package/package.json +6 -5
- package/socket-io-provider/package.json +1 -0
- package/types/package.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 7.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 7.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`de9e3c28026`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de9e3c28026) - [ED-14689] Refactor getFinalAcknowledgedState to only wait for the unconfirmed steps at the time of calling it to be confirmed. It will no longer wait for there to be no unconfirmed steps at all.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 7.3.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 7.3.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/channel/package.json
CHANGED
|
@@ -535,70 +535,106 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
});
|
|
538
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
539
|
-
var _this$
|
|
538
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
539
|
+
var _this$metadata$title;
|
|
540
540
|
|
|
541
|
-
var maxAttemptsToSync, count,
|
|
542
|
-
|
|
543
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
541
|
+
var maxAttemptsToSync, count, unconfirmedState, state;
|
|
542
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
544
543
|
while (1) {
|
|
545
|
-
switch (
|
|
544
|
+
switch (_context4.prev = _context4.next) {
|
|
546
545
|
case 0:
|
|
547
546
|
maxAttemptsToSync = _const.ACK_MAX_TRY;
|
|
548
547
|
count = 0;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
case 3:
|
|
552
|
-
if (!(unconfirmedSteps && unconfirmedSteps.length)) {
|
|
553
|
-
_context3.next = 13;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
_this.sendStepsFromCurrentState();
|
|
558
|
-
|
|
559
|
-
_context3.next = 7;
|
|
560
|
-
return (0, _utils.sleep)(500);
|
|
561
|
-
|
|
562
|
-
case 7:
|
|
563
|
-
unconfirmedSteps = (_this$getUnconfirmedS2 = _this.getUnconfirmedSteps()) === null || _this$getUnconfirmedS2 === void 0 ? void 0 : _this$getUnconfirmedS2.steps;
|
|
548
|
+
unconfirmedState = _this.getUnconfirmedSteps();
|
|
564
549
|
|
|
565
|
-
if (!(
|
|
566
|
-
|
|
550
|
+
if (!(unconfirmedState && unconfirmedState.steps.length)) {
|
|
551
|
+
_context4.next = 5;
|
|
567
552
|
break;
|
|
568
553
|
}
|
|
569
554
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
555
|
+
return _context4.delegateYield( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
556
|
+
var unconfirmedTrs, lastTr, isLastTrConfirmed, nextUnconfirmedState, nextUnconfirmedTrs, _state;
|
|
557
|
+
|
|
558
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
559
|
+
while (1) {
|
|
560
|
+
switch (_context3.prev = _context3.next) {
|
|
561
|
+
case 0:
|
|
562
|
+
// We use origins here as steps can be rebased. When steps are rebased a new step is created.
|
|
563
|
+
// This means that we can not track if it has been removed from the unconfirmed array or not.
|
|
564
|
+
// Origins points to the original transaction that the step was created in. This is never changed
|
|
565
|
+
// and gets passed down when a step is rebased.
|
|
566
|
+
unconfirmedTrs = unconfirmedState.origins;
|
|
567
|
+
lastTr = unconfirmedTrs[unconfirmedTrs.length - 1];
|
|
568
|
+
isLastTrConfirmed = false;
|
|
569
|
+
|
|
570
|
+
case 3:
|
|
571
|
+
if (isLastTrConfirmed) {
|
|
572
|
+
_context3.next = 14;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
_this.sendStepsFromCurrentState();
|
|
577
|
+
|
|
578
|
+
_context3.next = 7;
|
|
579
|
+
return (0, _utils.sleep)(500);
|
|
580
|
+
|
|
581
|
+
case 7:
|
|
582
|
+
nextUnconfirmedState = _this.getUnconfirmedSteps();
|
|
583
|
+
|
|
584
|
+
if (nextUnconfirmedState && nextUnconfirmedState.steps.length) {
|
|
585
|
+
nextUnconfirmedTrs = nextUnconfirmedState.origins;
|
|
586
|
+
isLastTrConfirmed = !nextUnconfirmedTrs.some(function (tr) {
|
|
587
|
+
return tr === lastTr;
|
|
588
|
+
});
|
|
589
|
+
} else {
|
|
590
|
+
isLastTrConfirmed = true;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if (!(!isLastTrConfirmed && count++ >= maxAttemptsToSync)) {
|
|
594
|
+
_context3.next = 12;
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (_this.onSyncUpError) {
|
|
599
|
+
_state = _this.getState();
|
|
600
|
+
|
|
601
|
+
_this.onSyncUpError({
|
|
602
|
+
lengthOfUnconfirmedSteps: nextUnconfirmedState === null || nextUnconfirmedState === void 0 ? void 0 : nextUnconfirmedState.steps.length,
|
|
603
|
+
tries: count,
|
|
604
|
+
maxRetries: maxAttemptsToSync,
|
|
605
|
+
clientId: _this.clientId,
|
|
606
|
+
version: (0, _prosemirrorCollab.getVersion)(_state)
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
throw new Error("Can't syncup with Collab Service");
|
|
611
|
+
|
|
612
|
+
case 12:
|
|
613
|
+
_context3.next = 3;
|
|
614
|
+
break;
|
|
615
|
+
|
|
616
|
+
case 14:
|
|
617
|
+
case "end":
|
|
618
|
+
return _context3.stop();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}, _callee3);
|
|
622
|
+
})(), "t0", 5);
|
|
623
|
+
|
|
624
|
+
case 5:
|
|
589
625
|
state = _this.getState();
|
|
590
|
-
return
|
|
626
|
+
return _context4.abrupt("return", {
|
|
591
627
|
content: state.doc.toJSON(),
|
|
592
628
|
title: (_this$metadata$title = _this.metadata.title) === null || _this$metadata$title === void 0 ? void 0 : _this$metadata$title.toString(),
|
|
593
629
|
stepVersion: (0, _prosemirrorCollab.getVersion)(state)
|
|
594
630
|
});
|
|
595
631
|
|
|
596
|
-
case
|
|
632
|
+
case 7:
|
|
597
633
|
case "end":
|
|
598
|
-
return
|
|
634
|
+
return _context4.stop();
|
|
599
635
|
}
|
|
600
636
|
}
|
|
601
|
-
},
|
|
637
|
+
}, _callee4);
|
|
602
638
|
})));
|
|
603
639
|
_this.config = config;
|
|
604
640
|
_this.channel = new _channel.Channel(config);
|
package/dist/cjs/version.json
CHANGED
|
@@ -424,34 +424,47 @@ export class Provider extends Emitter {
|
|
|
424
424
|
});
|
|
425
425
|
|
|
426
426
|
_defineProperty(this, "getFinalAcknowledgedState", async () => {
|
|
427
|
-
var _this$
|
|
427
|
+
var _this$metadata$title;
|
|
428
428
|
|
|
429
429
|
const maxAttemptsToSync = ACK_MAX_TRY;
|
|
430
430
|
let count = 0;
|
|
431
|
-
let
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
431
|
+
let unconfirmedState = this.getUnconfirmedSteps();
|
|
432
|
+
|
|
433
|
+
if (unconfirmedState && unconfirmedState.steps.length) {
|
|
434
|
+
// We use origins here as steps can be rebased. When steps are rebased a new step is created.
|
|
435
|
+
// This means that we can not track if it has been removed from the unconfirmed array or not.
|
|
436
|
+
// Origins points to the original transaction that the step was created in. This is never changed
|
|
437
|
+
// and gets passed down when a step is rebased.
|
|
438
|
+
const unconfirmedTrs = unconfirmedState.origins;
|
|
439
|
+
const lastTr = unconfirmedTrs[unconfirmedTrs.length - 1];
|
|
440
|
+
let isLastTrConfirmed = false;
|
|
441
|
+
|
|
442
|
+
while (!isLastTrConfirmed) {
|
|
443
|
+
this.sendStepsFromCurrentState();
|
|
444
|
+
await sleep(500);
|
|
445
|
+
const nextUnconfirmedState = this.getUnconfirmedSteps();
|
|
446
|
+
|
|
447
|
+
if (nextUnconfirmedState && nextUnconfirmedState.steps.length) {
|
|
448
|
+
const nextUnconfirmedTrs = nextUnconfirmedState.origins;
|
|
449
|
+
isLastTrConfirmed = !nextUnconfirmedTrs.some(tr => tr === lastTr);
|
|
450
|
+
} else {
|
|
451
|
+
isLastTrConfirmed = true;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
-
|
|
454
|
+
if (!isLastTrConfirmed && count++ >= maxAttemptsToSync) {
|
|
455
|
+
if (this.onSyncUpError) {
|
|
456
|
+
const state = this.getState();
|
|
457
|
+
this.onSyncUpError({
|
|
458
|
+
lengthOfUnconfirmedSteps: nextUnconfirmedState === null || nextUnconfirmedState === void 0 ? void 0 : nextUnconfirmedState.steps.length,
|
|
459
|
+
tries: count,
|
|
460
|
+
maxRetries: maxAttemptsToSync,
|
|
461
|
+
clientId: this.clientId,
|
|
462
|
+
version: getVersion(state)
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
throw new Error("Can't syncup with Collab Service");
|
|
467
|
+
}
|
|
455
468
|
}
|
|
456
469
|
}
|
|
457
470
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -527,70 +527,106 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
527
527
|
}
|
|
528
528
|
});
|
|
529
529
|
|
|
530
|
-
_defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
531
|
-
var _this$
|
|
530
|
+
_defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
531
|
+
var _this$metadata$title;
|
|
532
532
|
|
|
533
|
-
var maxAttemptsToSync, count,
|
|
534
|
-
|
|
535
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
533
|
+
var maxAttemptsToSync, count, unconfirmedState, state;
|
|
534
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
536
535
|
while (1) {
|
|
537
|
-
switch (
|
|
536
|
+
switch (_context4.prev = _context4.next) {
|
|
538
537
|
case 0:
|
|
539
538
|
maxAttemptsToSync = ACK_MAX_TRY;
|
|
540
539
|
count = 0;
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
case 3:
|
|
544
|
-
if (!(unconfirmedSteps && unconfirmedSteps.length)) {
|
|
545
|
-
_context3.next = 13;
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
_this.sendStepsFromCurrentState();
|
|
550
|
-
|
|
551
|
-
_context3.next = 7;
|
|
552
|
-
return sleep(500);
|
|
553
|
-
|
|
554
|
-
case 7:
|
|
555
|
-
unconfirmedSteps = (_this$getUnconfirmedS2 = _this.getUnconfirmedSteps()) === null || _this$getUnconfirmedS2 === void 0 ? void 0 : _this$getUnconfirmedS2.steps;
|
|
540
|
+
unconfirmedState = _this.getUnconfirmedSteps();
|
|
556
541
|
|
|
557
|
-
if (!(
|
|
558
|
-
|
|
542
|
+
if (!(unconfirmedState && unconfirmedState.steps.length)) {
|
|
543
|
+
_context4.next = 5;
|
|
559
544
|
break;
|
|
560
545
|
}
|
|
561
546
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
547
|
+
return _context4.delegateYield( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
548
|
+
var unconfirmedTrs, lastTr, isLastTrConfirmed, nextUnconfirmedState, nextUnconfirmedTrs, _state;
|
|
549
|
+
|
|
550
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
551
|
+
while (1) {
|
|
552
|
+
switch (_context3.prev = _context3.next) {
|
|
553
|
+
case 0:
|
|
554
|
+
// We use origins here as steps can be rebased. When steps are rebased a new step is created.
|
|
555
|
+
// This means that we can not track if it has been removed from the unconfirmed array or not.
|
|
556
|
+
// Origins points to the original transaction that the step was created in. This is never changed
|
|
557
|
+
// and gets passed down when a step is rebased.
|
|
558
|
+
unconfirmedTrs = unconfirmedState.origins;
|
|
559
|
+
lastTr = unconfirmedTrs[unconfirmedTrs.length - 1];
|
|
560
|
+
isLastTrConfirmed = false;
|
|
561
|
+
|
|
562
|
+
case 3:
|
|
563
|
+
if (isLastTrConfirmed) {
|
|
564
|
+
_context3.next = 14;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
_this.sendStepsFromCurrentState();
|
|
569
|
+
|
|
570
|
+
_context3.next = 7;
|
|
571
|
+
return sleep(500);
|
|
572
|
+
|
|
573
|
+
case 7:
|
|
574
|
+
nextUnconfirmedState = _this.getUnconfirmedSteps();
|
|
575
|
+
|
|
576
|
+
if (nextUnconfirmedState && nextUnconfirmedState.steps.length) {
|
|
577
|
+
nextUnconfirmedTrs = nextUnconfirmedState.origins;
|
|
578
|
+
isLastTrConfirmed = !nextUnconfirmedTrs.some(function (tr) {
|
|
579
|
+
return tr === lastTr;
|
|
580
|
+
});
|
|
581
|
+
} else {
|
|
582
|
+
isLastTrConfirmed = true;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
if (!(!isLastTrConfirmed && count++ >= maxAttemptsToSync)) {
|
|
586
|
+
_context3.next = 12;
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (_this.onSyncUpError) {
|
|
591
|
+
_state = _this.getState();
|
|
592
|
+
|
|
593
|
+
_this.onSyncUpError({
|
|
594
|
+
lengthOfUnconfirmedSteps: nextUnconfirmedState === null || nextUnconfirmedState === void 0 ? void 0 : nextUnconfirmedState.steps.length,
|
|
595
|
+
tries: count,
|
|
596
|
+
maxRetries: maxAttemptsToSync,
|
|
597
|
+
clientId: _this.clientId,
|
|
598
|
+
version: getVersion(_state)
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
throw new Error("Can't syncup with Collab Service");
|
|
603
|
+
|
|
604
|
+
case 12:
|
|
605
|
+
_context3.next = 3;
|
|
606
|
+
break;
|
|
607
|
+
|
|
608
|
+
case 14:
|
|
609
|
+
case "end":
|
|
610
|
+
return _context3.stop();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}, _callee3);
|
|
614
|
+
})(), "t0", 5);
|
|
615
|
+
|
|
616
|
+
case 5:
|
|
581
617
|
state = _this.getState();
|
|
582
|
-
return
|
|
618
|
+
return _context4.abrupt("return", {
|
|
583
619
|
content: state.doc.toJSON(),
|
|
584
620
|
title: (_this$metadata$title = _this.metadata.title) === null || _this$metadata$title === void 0 ? void 0 : _this$metadata$title.toString(),
|
|
585
621
|
stepVersion: getVersion(state)
|
|
586
622
|
});
|
|
587
623
|
|
|
588
|
-
case
|
|
624
|
+
case 7:
|
|
589
625
|
case "end":
|
|
590
|
-
return
|
|
626
|
+
return _context4.stop();
|
|
591
627
|
}
|
|
592
628
|
}
|
|
593
|
-
},
|
|
629
|
+
}, _callee4);
|
|
594
630
|
})));
|
|
595
631
|
|
|
596
632
|
_this.config = config;
|
package/dist/esm/version.json
CHANGED
package/emitter/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"releaseModel": "scheduled"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/analytics-gas-types": "5.0.
|
|
24
|
+
"@atlaskit/analytics-gas-types": "5.0.6",
|
|
25
25
|
"@atlaskit/analytics-listeners": "^8.2.0",
|
|
26
|
-
"@atlaskit/editor-common": "^
|
|
26
|
+
"@atlaskit/editor-common": "^68.0.0",
|
|
27
27
|
"@atlaskit/editor-json-transformer": "^8.7.0",
|
|
28
28
|
"@atlaskit/util-service-support": "^6.1.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"tree-shaking": []
|
|
40
40
|
},
|
|
41
41
|
"@repo/internal": {
|
|
42
|
-
"deprecation": "no-deprecated-imports"
|
|
42
|
+
"deprecation": "no-deprecated-imports",
|
|
43
|
+
"theming": "tokens"
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"@types/prosemirror-model": "^1.11.0",
|
|
50
51
|
"@types/prosemirror-state": "^1.2.0",
|
|
51
52
|
"prosemirror-model": "1.14.3",
|
|
52
|
-
"typescript": "
|
|
53
|
+
"typescript": "4.2.4"
|
|
53
54
|
},
|
|
54
55
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
55
56
|
}
|