@atlaskit/collab-provider 10.6.2 → 10.7.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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/document/document-service.js +30 -9
- package/dist/cjs/helpers/const.js +1 -0
- package/dist/cjs/provider/commit-step.js +4 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +30 -9
- package/dist/es2019/helpers/const.js +1 -0
- package/dist/es2019/provider/commit-step.js +4 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +30 -9
- package/dist/esm/helpers/const.js +1 -0
- package/dist/esm/provider/commit-step.js +4 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +4 -4
- package/dist/types/document/interface-document-service.d.ts +1 -1
- package/dist/types/helpers/const.d.ts +22 -2
- package/dist/types/provider/commit-step.d.ts +2 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts4.5/document/document-service.d.ts +4 -4
- package/dist/types-ts4.5/document/interface-document-service.d.ts +1 -1
- package/dist/types-ts4.5/helpers/const.d.ts +22 -2
- package/dist/types-ts4.5/provider/commit-step.d.ts +2 -1
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#115482](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115482)
|
|
8
|
+
[`5c3199f49f3c7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c3199f49f3c7) -
|
|
9
|
+
Added analytics tracking for rebased steps
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#115191](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115191)
|
|
14
|
+
[`83e0a3ca379fa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/83e0a3ca379fa) -
|
|
15
|
+
CEPS-362: pass a forcePublish flag to NCS backend when committing steps via publish - this is so
|
|
16
|
+
that we can remoev ackDelays for publish
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 10.6.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -320,10 +320,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
320
320
|
obfuscatedSteps = 'Failed to obfuscate steps';
|
|
321
321
|
}
|
|
322
322
|
var obfuscatedDoc;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
323
|
+
if (currentState) {
|
|
324
|
+
try {
|
|
325
|
+
obfuscatedDoc = (0, _utils.getDocAdfWithObfuscation)(currentState.content);
|
|
326
|
+
} catch (error) {
|
|
327
|
+
obfuscatedDoc = 'Failed to obfuscate doc';
|
|
328
|
+
}
|
|
327
329
|
}
|
|
328
330
|
return {
|
|
329
331
|
obfuscatedSteps: obfuscatedSteps,
|
|
@@ -629,7 +631,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
629
631
|
_context5.next = 22;
|
|
630
632
|
break;
|
|
631
633
|
}
|
|
632
|
-
|
|
634
|
+
// forcePublish = true, this is because commitUnconfirmedSteps is only called when the Editor publishes a document
|
|
635
|
+
_this.sendStepsFromCurrentState(undefined, true);
|
|
633
636
|
_context5.next = 13;
|
|
634
637
|
return (0, _utils.sleep)(500);
|
|
635
638
|
case 13:
|
|
@@ -866,7 +869,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
866
869
|
*/
|
|
867
870
|
}, {
|
|
868
871
|
key: "sendStepsFromCurrentState",
|
|
869
|
-
value: function sendStepsFromCurrentState(sendAnalyticsEvent) {
|
|
872
|
+
value: function sendStepsFromCurrentState(sendAnalyticsEvent, forcePublish) {
|
|
870
873
|
var _this$getState8;
|
|
871
874
|
var state = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
|
|
872
875
|
if (!state) {
|
|
@@ -874,7 +877,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
874
877
|
(_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
|
|
875
878
|
return;
|
|
876
879
|
}
|
|
877
|
-
this.send(null, null, state, sendAnalyticsEvent);
|
|
880
|
+
this.send(null, null, state, sendAnalyticsEvent, forcePublish);
|
|
878
881
|
}
|
|
879
882
|
}, {
|
|
880
883
|
key: "send",
|
|
@@ -883,7 +886,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
883
886
|
* Send steps from transaction to other participants
|
|
884
887
|
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
885
888
|
*/
|
|
886
|
-
function send(
|
|
889
|
+
function send(tr, _oldState, newState, sendAnalyticsEvent, forcePublish) {
|
|
887
890
|
var unconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
|
|
888
891
|
var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
|
|
889
892
|
|
|
@@ -910,6 +913,23 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
910
913
|
if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
|
|
911
914
|
return;
|
|
912
915
|
}
|
|
916
|
+
var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
|
|
917
|
+
if (rebased) {
|
|
918
|
+
var _this$analyticsHelper35;
|
|
919
|
+
var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
|
|
920
|
+
var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
|
|
921
|
+
var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
|
|
922
|
+
// send analtyics on unconfirmed steps
|
|
923
|
+
(_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
|
|
924
|
+
obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
|
|
925
|
+
obfuscatedRemoteSteps: obfuscatedRemoteSteps,
|
|
926
|
+
obfuscatedRebasedSteps: obfuscatedRebasedSteps,
|
|
927
|
+
clientID: this.clientId,
|
|
928
|
+
userId: this.getUserId(),
|
|
929
|
+
versionBefore: rebased.versionBefore,
|
|
930
|
+
versionAfter: version
|
|
931
|
+
});
|
|
932
|
+
}
|
|
913
933
|
|
|
914
934
|
// If we are going to commit unconfirmed steps
|
|
915
935
|
// we need to lock them to ensure they don't get
|
|
@@ -942,7 +962,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
942
962
|
emit: this.providerEmitCallback,
|
|
943
963
|
__livePage: this.options.__livePage,
|
|
944
964
|
hasRecovered: this.hasRecovered,
|
|
945
|
-
collabMode: this.participantsService.getCollabMode()
|
|
965
|
+
collabMode: this.participantsService.getCollabMode(),
|
|
966
|
+
forcePublish: forcePublish
|
|
946
967
|
});
|
|
947
968
|
}
|
|
948
969
|
}]);
|
|
@@ -26,6 +26,7 @@ var EVENT_ACTION = exports.EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
26
26
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
27
27
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
28
28
|
EVENT_ACTION["OUT_OF_SYNC"] = "outOfSync";
|
|
29
|
+
EVENT_ACTION["STEPS_REBASED"] = "stepsRebased";
|
|
29
30
|
return EVENT_ACTION;
|
|
30
31
|
}({});
|
|
31
32
|
var EVENT_STATUS = exports.EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
@@ -29,7 +29,8 @@ var commitStepQueue = exports.commitStepQueue = function commitStepQueue(_ref) {
|
|
|
29
29
|
emit = _ref.emit,
|
|
30
30
|
__livePage = _ref.__livePage,
|
|
31
31
|
hasRecovered = _ref.hasRecovered,
|
|
32
|
-
collabMode = _ref.collabMode
|
|
32
|
+
collabMode = _ref.collabMode,
|
|
33
|
+
forcePublish = _ref.forcePublish;
|
|
33
34
|
if (!readyToCommit) {
|
|
34
35
|
logger('Not ready to commit, skip');
|
|
35
36
|
return;
|
|
@@ -91,7 +92,8 @@ var commitStepQueue = exports.commitStepQueue = function commitStepQueue(_ref) {
|
|
|
91
92
|
collabMode: collabMode,
|
|
92
93
|
steps: stepsWithClientAndUserId,
|
|
93
94
|
version: version,
|
|
94
|
-
userId: userId
|
|
95
|
+
userId: userId,
|
|
96
|
+
forcePublish: forcePublish
|
|
95
97
|
}, function (response) {
|
|
96
98
|
var latency = new Date().getTime() - start;
|
|
97
99
|
if (timer) {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/collab-provider";
|
|
8
|
-
var version = exports.version = "10.
|
|
8
|
+
var version = exports.version = "10.7.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -287,10 +287,12 @@ export class DocumentService {
|
|
|
287
287
|
obfuscatedSteps = 'Failed to obfuscate steps';
|
|
288
288
|
}
|
|
289
289
|
let obfuscatedDoc;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
if (currentState) {
|
|
291
|
+
try {
|
|
292
|
+
obfuscatedDoc = getDocAdfWithObfuscation(currentState.content);
|
|
293
|
+
} catch (error) {
|
|
294
|
+
obfuscatedDoc = 'Failed to obfuscate doc';
|
|
295
|
+
}
|
|
294
296
|
}
|
|
295
297
|
return {
|
|
296
298
|
obfuscatedSteps,
|
|
@@ -538,7 +540,8 @@ export class DocumentService {
|
|
|
538
540
|
(_this$analyticsHelper24 = this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 ? void 0 : _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
|
|
539
541
|
}
|
|
540
542
|
while (!isLastTrConfirmed) {
|
|
541
|
-
this
|
|
543
|
+
// forcePublish = true, this is because commitUnconfirmedSteps is only called when the Editor publishes a document
|
|
544
|
+
this.sendStepsFromCurrentState(undefined, true);
|
|
542
545
|
await sleep(500);
|
|
543
546
|
const nextUnconfirmedSteps = this.getUnconfirmedSteps();
|
|
544
547
|
if (nextUnconfirmedSteps !== null && nextUnconfirmedSteps !== void 0 && nextUnconfirmedSteps.length) {
|
|
@@ -740,7 +743,7 @@ export class DocumentService {
|
|
|
740
743
|
* The getState function will return the current EditorState
|
|
741
744
|
* from the EditorView.
|
|
742
745
|
*/
|
|
743
|
-
sendStepsFromCurrentState(sendAnalyticsEvent) {
|
|
746
|
+
sendStepsFromCurrentState(sendAnalyticsEvent, forcePublish) {
|
|
744
747
|
var _this$getState8;
|
|
745
748
|
const state = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
|
|
746
749
|
if (!state) {
|
|
@@ -748,13 +751,13 @@ export class DocumentService {
|
|
|
748
751
|
(_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 ? void 0 : _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
|
|
749
752
|
return;
|
|
750
753
|
}
|
|
751
|
-
this.send(null, null, state, sendAnalyticsEvent);
|
|
754
|
+
this.send(null, null, state, sendAnalyticsEvent, forcePublish);
|
|
752
755
|
}
|
|
753
756
|
/**
|
|
754
757
|
* Send steps from transaction to other participants
|
|
755
758
|
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
756
759
|
*/
|
|
757
|
-
send(
|
|
760
|
+
send(tr, _oldState, newState, sendAnalyticsEvent, forcePublish) {
|
|
758
761
|
const unconfirmedStepsData = sendableSteps(newState);
|
|
759
762
|
const version = this.getVersionFromCollabState(newState, 'collab-provider: send');
|
|
760
763
|
|
|
@@ -781,6 +784,23 @@ export class DocumentService {
|
|
|
781
784
|
if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
|
|
782
785
|
return;
|
|
783
786
|
}
|
|
787
|
+
const rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
|
|
788
|
+
if (rebased) {
|
|
789
|
+
var _this$analyticsHelper35;
|
|
790
|
+
const obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
|
|
791
|
+
const obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
|
|
792
|
+
const obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
|
|
793
|
+
// send analtyics on unconfirmed steps
|
|
794
|
+
(_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 ? void 0 : _this$analyticsHelper35.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
|
|
795
|
+
obfuscatedUnconfirmedSteps,
|
|
796
|
+
obfuscatedRemoteSteps,
|
|
797
|
+
obfuscatedRebasedSteps,
|
|
798
|
+
clientID: this.clientId,
|
|
799
|
+
userId: this.getUserId(),
|
|
800
|
+
versionBefore: rebased.versionBefore,
|
|
801
|
+
versionAfter: version
|
|
802
|
+
});
|
|
803
|
+
}
|
|
784
804
|
|
|
785
805
|
// If we are going to commit unconfirmed steps
|
|
786
806
|
// we need to lock them to ensure they don't get
|
|
@@ -813,7 +833,8 @@ export class DocumentService {
|
|
|
813
833
|
emit: this.providerEmitCallback,
|
|
814
834
|
__livePage: this.options.__livePage,
|
|
815
835
|
hasRecovered: this.hasRecovered,
|
|
816
|
-
collabMode: this.participantsService.getCollabMode()
|
|
836
|
+
collabMode: this.participantsService.getCollabMode(),
|
|
837
|
+
forcePublish
|
|
817
838
|
});
|
|
818
839
|
}
|
|
819
840
|
}
|
|
@@ -20,6 +20,7 @@ export let EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
20
20
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
21
21
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
22
22
|
EVENT_ACTION["OUT_OF_SYNC"] = "outOfSync";
|
|
23
|
+
EVENT_ACTION["STEPS_REBASED"] = "stepsRebased";
|
|
23
24
|
return EVENT_ACTION;
|
|
24
25
|
}({});
|
|
25
26
|
export let EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
@@ -19,7 +19,8 @@ export const commitStepQueue = ({
|
|
|
19
19
|
emit,
|
|
20
20
|
__livePage,
|
|
21
21
|
hasRecovered,
|
|
22
|
-
collabMode
|
|
22
|
+
collabMode,
|
|
23
|
+
forcePublish
|
|
23
24
|
}) => {
|
|
24
25
|
if (!readyToCommit) {
|
|
25
26
|
logger('Not ready to commit, skip');
|
|
@@ -83,7 +84,8 @@ export const commitStepQueue = ({
|
|
|
83
84
|
collabMode,
|
|
84
85
|
steps: stepsWithClientAndUserId,
|
|
85
86
|
version,
|
|
86
|
-
userId
|
|
87
|
+
userId,
|
|
88
|
+
forcePublish
|
|
87
89
|
}, response => {
|
|
88
90
|
const latency = new Date().getTime() - start;
|
|
89
91
|
if (timer) {
|
|
@@ -313,10 +313,12 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
313
313
|
obfuscatedSteps = 'Failed to obfuscate steps';
|
|
314
314
|
}
|
|
315
315
|
var obfuscatedDoc;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
if (currentState) {
|
|
317
|
+
try {
|
|
318
|
+
obfuscatedDoc = getDocAdfWithObfuscation(currentState.content);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
obfuscatedDoc = 'Failed to obfuscate doc';
|
|
321
|
+
}
|
|
320
322
|
}
|
|
321
323
|
return {
|
|
322
324
|
obfuscatedSteps: obfuscatedSteps,
|
|
@@ -622,7 +624,8 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
622
624
|
_context5.next = 22;
|
|
623
625
|
break;
|
|
624
626
|
}
|
|
625
|
-
|
|
627
|
+
// forcePublish = true, this is because commitUnconfirmedSteps is only called when the Editor publishes a document
|
|
628
|
+
_this.sendStepsFromCurrentState(undefined, true);
|
|
626
629
|
_context5.next = 13;
|
|
627
630
|
return sleep(500);
|
|
628
631
|
case 13:
|
|
@@ -859,7 +862,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
859
862
|
*/
|
|
860
863
|
}, {
|
|
861
864
|
key: "sendStepsFromCurrentState",
|
|
862
|
-
value: function sendStepsFromCurrentState(sendAnalyticsEvent) {
|
|
865
|
+
value: function sendStepsFromCurrentState(sendAnalyticsEvent, forcePublish) {
|
|
863
866
|
var _this$getState8;
|
|
864
867
|
var state = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
|
|
865
868
|
if (!state) {
|
|
@@ -867,7 +870,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
867
870
|
(_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
|
|
868
871
|
return;
|
|
869
872
|
}
|
|
870
|
-
this.send(null, null, state, sendAnalyticsEvent);
|
|
873
|
+
this.send(null, null, state, sendAnalyticsEvent, forcePublish);
|
|
871
874
|
}
|
|
872
875
|
}, {
|
|
873
876
|
key: "send",
|
|
@@ -876,7 +879,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
876
879
|
* Send steps from transaction to other participants
|
|
877
880
|
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
878
881
|
*/
|
|
879
|
-
function send(
|
|
882
|
+
function send(tr, _oldState, newState, sendAnalyticsEvent, forcePublish) {
|
|
880
883
|
var unconfirmedStepsData = sendableSteps(newState);
|
|
881
884
|
var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
|
|
882
885
|
|
|
@@ -903,6 +906,23 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
903
906
|
if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
|
|
904
907
|
return;
|
|
905
908
|
}
|
|
909
|
+
var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
|
|
910
|
+
if (rebased) {
|
|
911
|
+
var _this$analyticsHelper35;
|
|
912
|
+
var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
|
|
913
|
+
var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
|
|
914
|
+
var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
|
|
915
|
+
// send analtyics on unconfirmed steps
|
|
916
|
+
(_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
|
|
917
|
+
obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
|
|
918
|
+
obfuscatedRemoteSteps: obfuscatedRemoteSteps,
|
|
919
|
+
obfuscatedRebasedSteps: obfuscatedRebasedSteps,
|
|
920
|
+
clientID: this.clientId,
|
|
921
|
+
userId: this.getUserId(),
|
|
922
|
+
versionBefore: rebased.versionBefore,
|
|
923
|
+
versionAfter: version
|
|
924
|
+
});
|
|
925
|
+
}
|
|
906
926
|
|
|
907
927
|
// If we are going to commit unconfirmed steps
|
|
908
928
|
// we need to lock them to ensure they don't get
|
|
@@ -935,7 +955,8 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
935
955
|
emit: this.providerEmitCallback,
|
|
936
956
|
__livePage: this.options.__livePage,
|
|
937
957
|
hasRecovered: this.hasRecovered,
|
|
938
|
-
collabMode: this.participantsService.getCollabMode()
|
|
958
|
+
collabMode: this.participantsService.getCollabMode(),
|
|
959
|
+
forcePublish: forcePublish
|
|
939
960
|
});
|
|
940
961
|
}
|
|
941
962
|
}]);
|
|
@@ -20,6 +20,7 @@ export var EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
20
20
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
21
21
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
22
22
|
EVENT_ACTION["OUT_OF_SYNC"] = "outOfSync";
|
|
23
|
+
EVENT_ACTION["STEPS_REBASED"] = "stepsRebased";
|
|
23
24
|
return EVENT_ACTION;
|
|
24
25
|
}({});
|
|
25
26
|
export var EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
@@ -22,7 +22,8 @@ export var commitStepQueue = function commitStepQueue(_ref) {
|
|
|
22
22
|
emit = _ref.emit,
|
|
23
23
|
__livePage = _ref.__livePage,
|
|
24
24
|
hasRecovered = _ref.hasRecovered,
|
|
25
|
-
collabMode = _ref.collabMode
|
|
25
|
+
collabMode = _ref.collabMode,
|
|
26
|
+
forcePublish = _ref.forcePublish;
|
|
26
27
|
if (!readyToCommit) {
|
|
27
28
|
logger('Not ready to commit, skip');
|
|
28
29
|
return;
|
|
@@ -84,7 +85,8 @@ export var commitStepQueue = function commitStepQueue(_ref) {
|
|
|
84
85
|
collabMode: collabMode,
|
|
85
86
|
steps: stepsWithClientAndUserId,
|
|
86
87
|
version: version,
|
|
87
|
-
userId: userId
|
|
88
|
+
userId: userId,
|
|
89
|
+
forcePublish: forcePublish
|
|
88
90
|
}, function (response) {
|
|
89
91
|
var latency = new Date().getTime() - start;
|
|
90
92
|
if (timer) {
|
|
@@ -80,7 +80,7 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
80
80
|
* Called when we receive steps from the service
|
|
81
81
|
*/
|
|
82
82
|
onStepsAdded: (data: StepsPayload) => void;
|
|
83
|
-
obfuscateStepsAndState: (unconfirmedSteps: readonly ProseMirrorStep[] | undefined, currentState
|
|
83
|
+
obfuscateStepsAndState: (unconfirmedSteps: readonly ProseMirrorStep[] | undefined, currentState?: ResolvedEditorState) => {
|
|
84
84
|
obfuscatedSteps: string | {
|
|
85
85
|
stepType: {
|
|
86
86
|
type: string;
|
|
@@ -106,7 +106,7 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
106
106
|
unconfirmedStepAfterRecovery?: boolean | undefined;
|
|
107
107
|
} | undefined;
|
|
108
108
|
}[];
|
|
109
|
-
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null;
|
|
109
|
+
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null | undefined;
|
|
110
110
|
};
|
|
111
111
|
onRestore: ({ doc, version, metadata, targetClientId }: CollabInitPayload) => Promise<void>;
|
|
112
112
|
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
@@ -131,11 +131,11 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
131
131
|
* The getState function will return the current EditorState
|
|
132
132
|
* from the EditorView.
|
|
133
133
|
*/
|
|
134
|
-
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean): void;
|
|
134
|
+
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean, forcePublish?: boolean): void;
|
|
135
135
|
onStepRejectedError: () => void;
|
|
136
136
|
/**
|
|
137
137
|
* Send steps from transaction to other participants
|
|
138
138
|
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
139
139
|
*/
|
|
140
|
-
send(
|
|
140
|
+
send(tr: Transaction | null, _oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean, forcePublish?: boolean): void;
|
|
141
141
|
}
|
|
@@ -25,7 +25,7 @@ export interface DocumentServiceInterface {
|
|
|
25
25
|
}): void;
|
|
26
26
|
onStepRejectedError(): void;
|
|
27
27
|
send(tr: Transaction | null, oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean): void;
|
|
28
|
-
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean): void;
|
|
28
|
+
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean, forcePublish?: boolean): void;
|
|
29
29
|
throttledCatchupv2(): void;
|
|
30
30
|
getCurrentState(): Promise<ResolvedEditorState>;
|
|
31
31
|
getFinalAcknowledgedState(): Promise<ResolvedEditorState>;
|
|
@@ -20,7 +20,8 @@ export declare enum EVENT_ACTION {
|
|
|
20
20
|
RECONNECTION = "providerReconnection",// https://data-portal.internal.atlassian.com/analytics/registry/73992
|
|
21
21
|
PROVIDER_SETUP = "providerSetup",// https://data-portal.internal.atlassian.com/analytics/registry/54715
|
|
22
22
|
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps",// https://data-portal.internal.atlassian.com/analytics/registry/56141
|
|
23
|
-
OUT_OF_SYNC = "outOfSync"
|
|
23
|
+
OUT_OF_SYNC = "outOfSync",// https://data-portal.internal.atlassian.com/analytics/registry/74993
|
|
24
|
+
STEPS_REBASED = "stepsRebased"
|
|
24
25
|
}
|
|
25
26
|
export declare enum EVENT_STATUS {
|
|
26
27
|
SUCCESS = "SUCCESS",
|
|
@@ -275,7 +276,26 @@ type OutOfSyncAnalyticsEvent = {
|
|
|
275
276
|
catchupReason: CatchupEventReason | undefined;
|
|
276
277
|
} & BaseActionAnalyticsEventAttributes;
|
|
277
278
|
};
|
|
278
|
-
|
|
279
|
+
type StepsRebasedAnalyticsEvent = {
|
|
280
|
+
eventAction: EVENT_ACTION.STEPS_REBASED;
|
|
281
|
+
attributes: {
|
|
282
|
+
eventStatus: EVENT_STATUS.INFO;
|
|
283
|
+
obfuscatedUnconfirmedSteps: {
|
|
284
|
+
[key: string]: number;
|
|
285
|
+
}[];
|
|
286
|
+
obfuscatedRemoteSteps: {
|
|
287
|
+
[key: string]: number;
|
|
288
|
+
}[];
|
|
289
|
+
obfuscatedRebasedSteps: {
|
|
290
|
+
[key: string]: number;
|
|
291
|
+
}[];
|
|
292
|
+
clientID: 'string';
|
|
293
|
+
userId: 'string';
|
|
294
|
+
versionBefore: 'string';
|
|
295
|
+
versionAfter: 'string';
|
|
296
|
+
} & BaseActionAnalyticsEventAttributes;
|
|
297
|
+
};
|
|
298
|
+
export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent | ReconnectionAnalyticsEvent | OutOfSyncAnalyticsEvent | StepsRebasedAnalyticsEvent;
|
|
279
299
|
export declare const ACK_MAX_TRY = 60;
|
|
280
300
|
export declare const CONFLUENCE = "confluence";
|
|
281
301
|
/** Enumerable for attaching a reason to catchup (v2) call(s) */
|
|
@@ -5,7 +5,7 @@ import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
|
5
5
|
import type { InternalError } from '../errors/internal-errors';
|
|
6
6
|
export declare let readyToCommit: boolean;
|
|
7
7
|
export declare const RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
|
|
8
|
-
export declare const commitStepQueue: ({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, __livePage, hasRecovered, collabMode, }: {
|
|
8
|
+
export declare const commitStepQueue: ({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, __livePage, hasRecovered, collabMode, forcePublish, }: {
|
|
9
9
|
broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void;
|
|
10
10
|
steps: readonly ProseMirrorStep[];
|
|
11
11
|
version: number;
|
|
@@ -18,4 +18,5 @@ export declare const commitStepQueue: ({ broadcast, steps, version, userId, clie
|
|
|
18
18
|
__livePage: boolean;
|
|
19
19
|
hasRecovered: boolean;
|
|
20
20
|
collabMode: string;
|
|
21
|
+
forcePublish?: boolean | undefined;
|
|
21
22
|
}) => void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
80
80
|
* Called when we receive steps from the service
|
|
81
81
|
*/
|
|
82
82
|
onStepsAdded: (data: StepsPayload) => void;
|
|
83
|
-
obfuscateStepsAndState: (unconfirmedSteps: readonly ProseMirrorStep[] | undefined, currentState
|
|
83
|
+
obfuscateStepsAndState: (unconfirmedSteps: readonly ProseMirrorStep[] | undefined, currentState?: ResolvedEditorState) => {
|
|
84
84
|
obfuscatedSteps: string | {
|
|
85
85
|
stepType: {
|
|
86
86
|
type: string;
|
|
@@ -106,7 +106,7 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
106
106
|
unconfirmedStepAfterRecovery?: boolean | undefined;
|
|
107
107
|
} | undefined;
|
|
108
108
|
}[];
|
|
109
|
-
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null;
|
|
109
|
+
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null | undefined;
|
|
110
110
|
};
|
|
111
111
|
onRestore: ({ doc, version, metadata, targetClientId }: CollabInitPayload) => Promise<void>;
|
|
112
112
|
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
@@ -131,11 +131,11 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
131
131
|
* The getState function will return the current EditorState
|
|
132
132
|
* from the EditorView.
|
|
133
133
|
*/
|
|
134
|
-
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean): void;
|
|
134
|
+
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean, forcePublish?: boolean): void;
|
|
135
135
|
onStepRejectedError: () => void;
|
|
136
136
|
/**
|
|
137
137
|
* Send steps from transaction to other participants
|
|
138
138
|
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
139
139
|
*/
|
|
140
|
-
send(
|
|
140
|
+
send(tr: Transaction | null, _oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean, forcePublish?: boolean): void;
|
|
141
141
|
}
|
|
@@ -25,7 +25,7 @@ export interface DocumentServiceInterface {
|
|
|
25
25
|
}): void;
|
|
26
26
|
onStepRejectedError(): void;
|
|
27
27
|
send(tr: Transaction | null, oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean): void;
|
|
28
|
-
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean): void;
|
|
28
|
+
sendStepsFromCurrentState(sendAnalyticsEvent?: boolean, forcePublish?: boolean): void;
|
|
29
29
|
throttledCatchupv2(): void;
|
|
30
30
|
getCurrentState(): Promise<ResolvedEditorState>;
|
|
31
31
|
getFinalAcknowledgedState(): Promise<ResolvedEditorState>;
|
|
@@ -20,7 +20,8 @@ export declare enum EVENT_ACTION {
|
|
|
20
20
|
RECONNECTION = "providerReconnection",// https://data-portal.internal.atlassian.com/analytics/registry/73992
|
|
21
21
|
PROVIDER_SETUP = "providerSetup",// https://data-portal.internal.atlassian.com/analytics/registry/54715
|
|
22
22
|
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps",// https://data-portal.internal.atlassian.com/analytics/registry/56141
|
|
23
|
-
OUT_OF_SYNC = "outOfSync"
|
|
23
|
+
OUT_OF_SYNC = "outOfSync",// https://data-portal.internal.atlassian.com/analytics/registry/74993
|
|
24
|
+
STEPS_REBASED = "stepsRebased"
|
|
24
25
|
}
|
|
25
26
|
export declare enum EVENT_STATUS {
|
|
26
27
|
SUCCESS = "SUCCESS",
|
|
@@ -275,7 +276,26 @@ type OutOfSyncAnalyticsEvent = {
|
|
|
275
276
|
catchupReason: CatchupEventReason | undefined;
|
|
276
277
|
} & BaseActionAnalyticsEventAttributes;
|
|
277
278
|
};
|
|
278
|
-
|
|
279
|
+
type StepsRebasedAnalyticsEvent = {
|
|
280
|
+
eventAction: EVENT_ACTION.STEPS_REBASED;
|
|
281
|
+
attributes: {
|
|
282
|
+
eventStatus: EVENT_STATUS.INFO;
|
|
283
|
+
obfuscatedUnconfirmedSteps: {
|
|
284
|
+
[key: string]: number;
|
|
285
|
+
}[];
|
|
286
|
+
obfuscatedRemoteSteps: {
|
|
287
|
+
[key: string]: number;
|
|
288
|
+
}[];
|
|
289
|
+
obfuscatedRebasedSteps: {
|
|
290
|
+
[key: string]: number;
|
|
291
|
+
}[];
|
|
292
|
+
clientID: 'string';
|
|
293
|
+
userId: 'string';
|
|
294
|
+
versionBefore: 'string';
|
|
295
|
+
versionAfter: 'string';
|
|
296
|
+
} & BaseActionAnalyticsEventAttributes;
|
|
297
|
+
};
|
|
298
|
+
export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent | ReconnectionAnalyticsEvent | OutOfSyncAnalyticsEvent | StepsRebasedAnalyticsEvent;
|
|
279
299
|
export declare const ACK_MAX_TRY = 60;
|
|
280
300
|
export declare const CONFLUENCE = "confluence";
|
|
281
301
|
/** Enumerable for attaching a reason to catchup (v2) call(s) */
|
|
@@ -5,7 +5,7 @@ import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
|
5
5
|
import type { InternalError } from '../errors/internal-errors';
|
|
6
6
|
export declare let readyToCommit: boolean;
|
|
7
7
|
export declare const RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
|
|
8
|
-
export declare const commitStepQueue: ({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, __livePage, hasRecovered, collabMode, }: {
|
|
8
|
+
export declare const commitStepQueue: ({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, __livePage, hasRecovered, collabMode, forcePublish, }: {
|
|
9
9
|
broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void;
|
|
10
10
|
steps: readonly ProseMirrorStep[];
|
|
11
11
|
version: number;
|
|
@@ -18,4 +18,5 @@ export declare const commitStepQueue: ({ broadcast, steps, version, userId, clie
|
|
|
18
18
|
__livePage: boolean;
|
|
19
19
|
hasRecovered: boolean;
|
|
20
20
|
collabMode: string;
|
|
21
|
+
forcePublish?: boolean | undefined;
|
|
21
22
|
}) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^4.25.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
|
-
"@atlaskit/prosemirror-collab": "^0.
|
|
44
|
-
"@atlaskit/react-ufo": "^2.
|
|
43
|
+
"@atlaskit/prosemirror-collab": "^0.14.0",
|
|
44
|
+
"@atlaskit/react-ufo": "^2.16.0",
|
|
45
45
|
"@atlaskit/ufo": "^0.3.0",
|
|
46
46
|
"@atlaskit/util-service-support": "^6.2.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|