@atlaskit/collab-provider 8.0.0 → 8.1.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 +19 -0
- package/dist/cjs/channel.js +3 -1
- package/dist/cjs/feature-flags/__test__/index.unit.js +28 -0
- package/dist/cjs/feature-flags/index.js +62 -0
- package/dist/cjs/feature-flags/types.js +10 -0
- package/dist/cjs/helpers/const.js +4 -2
- package/dist/cjs/provider/index.js +3 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/channel.js +3 -1
- package/dist/es2019/feature-flags/__test__/index.unit.js +25 -0
- package/dist/es2019/feature-flags/index.js +34 -0
- package/dist/es2019/feature-flags/types.js +3 -0
- package/dist/es2019/helpers/const.js +2 -1
- package/dist/es2019/provider/index.js +3 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/channel.js +3 -1
- package/dist/esm/feature-flags/__test__/index.unit.js +25 -0
- package/dist/esm/feature-flags/index.js +48 -0
- package/dist/esm/feature-flags/types.js +3 -0
- package/dist/esm/helpers/const.js +2 -1
- package/dist/esm/provider/index.js +3 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/feature-flags/__test__/index.unit.d.ts +1 -0
- package/dist/types/feature-flags/index.d.ts +9 -0
- package/dist/types/feature-flags/types.d.ts +11 -0
- package/dist/types/helpers/const.d.ts +3 -0
- package/dist/types/provider/catchup.d.ts +1 -1
- package/dist/types/provider/index.d.ts +1 -0
- package/dist/types/types.d.ts +6 -3
- package/package.json +6 -7
- package/report.api.md +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 8.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`59e998e408f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/59e998e408f) - [ESS-2914] Switch to the forked prosemirror-collab library (based on version 1.3.0) to filter out analytics steps
|
|
8
|
+
- [`ec0ebbf16bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ec0ebbf16bc) - Adding Feature Flag to Collab Provider
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [`6eb720b7d3b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6eb720b7d3b) - A page recovery attribute and ttl attribute to metrics to monitor ttl effect on tti
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 8.0.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`7ba48e47e3b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7ba48e47e3b) - NO-ISSUE Re-removed some unused prod dependencies that were accidentally merged back in
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 8.0.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
package/dist/cjs/channel.js
CHANGED
|
@@ -116,7 +116,9 @@ var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
116
116
|
eventStatus: _const.EVENT_STATUS.SUCCESS,
|
|
117
117
|
// TODO: detect when document init fails and fire corresponding event for it
|
|
118
118
|
latency: measure === null || measure === void 0 ? void 0 : measure.duration,
|
|
119
|
-
documentAri: _this.config.documentAri
|
|
119
|
+
documentAri: _this.config.documentAri,
|
|
120
|
+
requiredPageRecovery: data === null || data === void 0 ? void 0 : data.requiredPageRecovery,
|
|
121
|
+
ttlEnabled: data === null || data === void 0 ? void 0 : data.ttlEnabled
|
|
120
122
|
}
|
|
121
123
|
}, _this.analyticsClient);
|
|
122
124
|
var doc = data.doc,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _index = require("../index");
|
|
4
|
+
|
|
5
|
+
describe('Feature flags', function () {
|
|
6
|
+
it('getProductSpecificFeatureFlags', function () {
|
|
7
|
+
var result = (0, _index.getProductSpecificFeatureFlags)({
|
|
8
|
+
testFF: true
|
|
9
|
+
}, 'confluence');
|
|
10
|
+
expect(result).toEqual(['confluence.fe.collab.provider.testFF']);
|
|
11
|
+
});
|
|
12
|
+
it('getCollabProviderFeatureFlag return true', function () {
|
|
13
|
+
var result = (0, _index.getCollabProviderFeatureFlag)('testFF', {
|
|
14
|
+
testFF: true
|
|
15
|
+
});
|
|
16
|
+
expect(result).toEqual(true);
|
|
17
|
+
});
|
|
18
|
+
it('getCollabProviderFeatureFlag with wrong ff set', function () {
|
|
19
|
+
var result = (0, _index.getCollabProviderFeatureFlag)('testFF', {
|
|
20
|
+
abc: true
|
|
21
|
+
});
|
|
22
|
+
expect(result).toEqual(false);
|
|
23
|
+
});
|
|
24
|
+
it('getCollabProviderFeatureFlag with wrong ff set', function () {
|
|
25
|
+
var result = (0, _index.getCollabProviderFeatureFlag)('testFF', undefined);
|
|
26
|
+
expect(result).toEqual(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getCollabProviderFeatureFlag = getCollabProviderFeatureFlag;
|
|
9
|
+
exports.getProductSpecificFeatureFlags = void 0;
|
|
10
|
+
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
|
|
13
|
+
var defaultNCSFeatureFlags = {
|
|
14
|
+
testFF: false
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Note that Confluence should have the same FF sets as NCS
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
var productKeys = {
|
|
21
|
+
confluence: {
|
|
22
|
+
testFF: 'confluence.fe.collab.provider.testFF'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var filterFeatureFlagNames = function filterFeatureFlagNames(flags) {
|
|
27
|
+
var pairs = Object.entries(flags);
|
|
28
|
+
return pairs.filter(function (_ref) {
|
|
29
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
30
|
+
_key = _ref2[0],
|
|
31
|
+
value = _ref2[1];
|
|
32
|
+
|
|
33
|
+
return !!value;
|
|
34
|
+
}).map(function (_ref3) {
|
|
35
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
36
|
+
key = _ref4[0];
|
|
37
|
+
|
|
38
|
+
return key;
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Takes a record of {NCS Feature Flag Names → boolean} and a supported product name.
|
|
43
|
+
* Returns the corresponding product’s Launch Darkly Keys for each of the flags set as true in the input record.
|
|
44
|
+
* */
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var getProductSpecificFeatureFlags = function getProductSpecificFeatureFlags(flags, product) {
|
|
48
|
+
var ncsFeatureFlags = filterFeatureFlagNames(flags);
|
|
49
|
+
return ncsFeatureFlags.map(function (key) {
|
|
50
|
+
return productKeys[product][key];
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.getProductSpecificFeatureFlags = getProductSpecificFeatureFlags;
|
|
55
|
+
|
|
56
|
+
function getCollabProviderFeatureFlag(flagName, featureFlags) {
|
|
57
|
+
if (featureFlags) {
|
|
58
|
+
return flagName in featureFlags ? featureFlags[flagName] : defaultNCSFeatureFlags[flagName];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return defaultNCSFeatureFlags[flagName];
|
|
62
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.supportedProducts = void 0;
|
|
7
|
+
// NCS feature flags - type and defaults defined here in one source of truth
|
|
8
|
+
// With this type we ensure the object will contain all the flags
|
|
9
|
+
var supportedProducts = ['confluence'];
|
|
10
|
+
exports.supportedProducts = supportedProducts;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.EVENT_SUBJECT = exports.EVENT_STATUS = exports.EVENT_ACTION = exports.COLLAB_SERVICE = exports.ADD_STEPS_TYPE = exports.ACK_MAX_TRY = void 0;
|
|
6
|
+
exports.EVENT_SUBJECT = exports.EVENT_STATUS = exports.EVENT_ACTION = exports.CONFLUENCE = exports.COLLAB_SERVICE = exports.ADD_STEPS_TYPE = exports.ACK_MAX_TRY = void 0;
|
|
7
7
|
var EVENT_SUBJECT = 'collab';
|
|
8
8
|
exports.EVENT_SUBJECT = EVENT_SUBJECT;
|
|
9
9
|
var COLLAB_SERVICE;
|
|
@@ -46,4 +46,6 @@ exports.ADD_STEPS_TYPE = ADD_STEPS_TYPE;
|
|
|
46
46
|
})(ADD_STEPS_TYPE || (exports.ADD_STEPS_TYPE = ADD_STEPS_TYPE = {}));
|
|
47
47
|
|
|
48
48
|
var ACK_MAX_TRY = 30;
|
|
49
|
-
exports.ACK_MAX_TRY = ACK_MAX_TRY;
|
|
49
|
+
exports.ACK_MAX_TRY = ACK_MAX_TRY;
|
|
50
|
+
var CONFLUENCE = 'confluence';
|
|
51
|
+
exports.CONFLUENCE = CONFLUENCE;
|
|
@@ -33,7 +33,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
33
33
|
|
|
34
34
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
35
35
|
|
|
36
|
-
var _prosemirrorCollab = require("prosemirror-collab");
|
|
36
|
+
var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
|
|
37
37
|
|
|
38
38
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
39
39
|
|
|
@@ -317,7 +317,7 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
319
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "applyLocalSteps", function (steps) {
|
|
320
|
-
// Re-
|
|
320
|
+
// Re-apply local steps
|
|
321
321
|
_this.emit('local-steps', {
|
|
322
322
|
steps: steps
|
|
323
323
|
});
|
|
@@ -952,6 +952,7 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
952
952
|
}
|
|
953
953
|
/**
|
|
954
954
|
* Send steps from transaction to other participants
|
|
955
|
+
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
955
956
|
*/
|
|
956
957
|
|
|
957
958
|
}, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/collab-provider";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "8.
|
|
9
|
+
var version = "8.1.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
|
|
12
12
|
var nextMajorVersion = function nextMajorVersion() {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/channel.js
CHANGED
|
@@ -69,7 +69,9 @@ export class Channel extends Emitter {
|
|
|
69
69
|
eventStatus: EVENT_STATUS.SUCCESS,
|
|
70
70
|
// TODO: detect when document init fails and fire corresponding event for it
|
|
71
71
|
latency: measure === null || measure === void 0 ? void 0 : measure.duration,
|
|
72
|
-
documentAri: this.config.documentAri
|
|
72
|
+
documentAri: this.config.documentAri,
|
|
73
|
+
requiredPageRecovery: data === null || data === void 0 ? void 0 : data.requiredPageRecovery,
|
|
74
|
+
ttlEnabled: data === null || data === void 0 ? void 0 : data.ttlEnabled
|
|
73
75
|
}
|
|
74
76
|
}, this.analyticsClient);
|
|
75
77
|
const {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getProductSpecificFeatureFlags, getCollabProviderFeatureFlag } from '../index';
|
|
2
|
+
describe('Feature flags', () => {
|
|
3
|
+
it('getProductSpecificFeatureFlags', () => {
|
|
4
|
+
const result = getProductSpecificFeatureFlags({
|
|
5
|
+
testFF: true
|
|
6
|
+
}, 'confluence');
|
|
7
|
+
expect(result).toEqual(['confluence.fe.collab.provider.testFF']);
|
|
8
|
+
});
|
|
9
|
+
it('getCollabProviderFeatureFlag return true', () => {
|
|
10
|
+
const result = getCollabProviderFeatureFlag('testFF', {
|
|
11
|
+
testFF: true
|
|
12
|
+
});
|
|
13
|
+
expect(result).toEqual(true);
|
|
14
|
+
});
|
|
15
|
+
it('getCollabProviderFeatureFlag with wrong ff set', () => {
|
|
16
|
+
const result = getCollabProviderFeatureFlag('testFF', {
|
|
17
|
+
abc: true
|
|
18
|
+
});
|
|
19
|
+
expect(result).toEqual(false);
|
|
20
|
+
});
|
|
21
|
+
it('getCollabProviderFeatureFlag with wrong ff set', () => {
|
|
22
|
+
const result = getCollabProviderFeatureFlag('testFF', undefined);
|
|
23
|
+
expect(result).toEqual(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const defaultNCSFeatureFlags = {
|
|
2
|
+
testFF: false
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Note that Confluence should have the same FF sets as NCS
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const productKeys = {
|
|
9
|
+
confluence: {
|
|
10
|
+
testFF: 'confluence.fe.collab.provider.testFF'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const filterFeatureFlagNames = flags => {
|
|
15
|
+
const pairs = Object.entries(flags);
|
|
16
|
+
return pairs.filter(([_key, value]) => !!value).map(([key]) => key);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Takes a record of {NCS Feature Flag Names → boolean} and a supported product name.
|
|
20
|
+
* Returns the corresponding product’s Launch Darkly Keys for each of the flags set as true in the input record.
|
|
21
|
+
* */
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export const getProductSpecificFeatureFlags = (flags, product) => {
|
|
25
|
+
const ncsFeatureFlags = filterFeatureFlagNames(flags);
|
|
26
|
+
return ncsFeatureFlags.map(key => productKeys[product][key]);
|
|
27
|
+
};
|
|
28
|
+
export function getCollabProviderFeatureFlag(flagName, featureFlags) {
|
|
29
|
+
if (featureFlags) {
|
|
30
|
+
return flagName in featureFlags ? featureFlags[flagName] : defaultNCSFeatureFlags[flagName];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return defaultNCSFeatureFlags[flagName];
|
|
34
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { getVersion, sendableSteps } from 'prosemirror-collab';
|
|
2
|
+
import { getVersion, sendableSteps } from '@atlaskit/prosemirror-collab';
|
|
3
3
|
import throttle from 'lodash/throttle';
|
|
4
4
|
import isEqual from 'lodash/isEqual';
|
|
5
5
|
import countBy from 'lodash/countBy';
|
|
@@ -247,7 +247,7 @@ export class Provider extends Emitter {
|
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
_defineProperty(this, "applyLocalSteps", steps => {
|
|
250
|
-
// Re-
|
|
250
|
+
// Re-apply local steps
|
|
251
251
|
this.emit('local-steps', {
|
|
252
252
|
steps
|
|
253
253
|
});
|
|
@@ -754,6 +754,7 @@ export class Provider extends Emitter {
|
|
|
754
754
|
}
|
|
755
755
|
/**
|
|
756
756
|
* Send steps from transaction to other participants
|
|
757
|
+
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
757
758
|
*/
|
|
758
759
|
|
|
759
760
|
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/channel.js
CHANGED
|
@@ -101,7 +101,9 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
101
101
|
eventStatus: EVENT_STATUS.SUCCESS,
|
|
102
102
|
// TODO: detect when document init fails and fire corresponding event for it
|
|
103
103
|
latency: measure === null || measure === void 0 ? void 0 : measure.duration,
|
|
104
|
-
documentAri: _this.config.documentAri
|
|
104
|
+
documentAri: _this.config.documentAri,
|
|
105
|
+
requiredPageRecovery: data === null || data === void 0 ? void 0 : data.requiredPageRecovery,
|
|
106
|
+
ttlEnabled: data === null || data === void 0 ? void 0 : data.ttlEnabled
|
|
105
107
|
}
|
|
106
108
|
}, _this.analyticsClient);
|
|
107
109
|
var doc = data.doc,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getProductSpecificFeatureFlags, getCollabProviderFeatureFlag } from '../index';
|
|
2
|
+
describe('Feature flags', function () {
|
|
3
|
+
it('getProductSpecificFeatureFlags', function () {
|
|
4
|
+
var result = getProductSpecificFeatureFlags({
|
|
5
|
+
testFF: true
|
|
6
|
+
}, 'confluence');
|
|
7
|
+
expect(result).toEqual(['confluence.fe.collab.provider.testFF']);
|
|
8
|
+
});
|
|
9
|
+
it('getCollabProviderFeatureFlag return true', function () {
|
|
10
|
+
var result = getCollabProviderFeatureFlag('testFF', {
|
|
11
|
+
testFF: true
|
|
12
|
+
});
|
|
13
|
+
expect(result).toEqual(true);
|
|
14
|
+
});
|
|
15
|
+
it('getCollabProviderFeatureFlag with wrong ff set', function () {
|
|
16
|
+
var result = getCollabProviderFeatureFlag('testFF', {
|
|
17
|
+
abc: true
|
|
18
|
+
});
|
|
19
|
+
expect(result).toEqual(false);
|
|
20
|
+
});
|
|
21
|
+
it('getCollabProviderFeatureFlag with wrong ff set', function () {
|
|
22
|
+
var result = getCollabProviderFeatureFlag('testFF', undefined);
|
|
23
|
+
expect(result).toEqual(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
var defaultNCSFeatureFlags = {
|
|
3
|
+
testFF: false
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Note that Confluence should have the same FF sets as NCS
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var productKeys = {
|
|
10
|
+
confluence: {
|
|
11
|
+
testFF: 'confluence.fe.collab.provider.testFF'
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var filterFeatureFlagNames = function filterFeatureFlagNames(flags) {
|
|
16
|
+
var pairs = Object.entries(flags);
|
|
17
|
+
return pairs.filter(function (_ref) {
|
|
18
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
19
|
+
_key = _ref2[0],
|
|
20
|
+
value = _ref2[1];
|
|
21
|
+
|
|
22
|
+
return !!value;
|
|
23
|
+
}).map(function (_ref3) {
|
|
24
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
|
25
|
+
key = _ref4[0];
|
|
26
|
+
|
|
27
|
+
return key;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Takes a record of {NCS Feature Flag Names → boolean} and a supported product name.
|
|
32
|
+
* Returns the corresponding product’s Launch Darkly Keys for each of the flags set as true in the input record.
|
|
33
|
+
* */
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export var getProductSpecificFeatureFlags = function getProductSpecificFeatureFlags(flags, product) {
|
|
37
|
+
var ncsFeatureFlags = filterFeatureFlagNames(flags);
|
|
38
|
+
return ncsFeatureFlags.map(function (key) {
|
|
39
|
+
return productKeys[product][key];
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export function getCollabProviderFeatureFlag(flagName, featureFlags) {
|
|
43
|
+
if (featureFlags) {
|
|
44
|
+
return flagName in featureFlags ? featureFlags[flagName] : defaultNCSFeatureFlags[flagName];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return defaultNCSFeatureFlags[flagName];
|
|
48
|
+
}
|
|
@@ -21,7 +21,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
21
21
|
|
|
22
22
|
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) { _defineProperty(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; }
|
|
23
23
|
|
|
24
|
-
import { getVersion, sendableSteps } from 'prosemirror-collab';
|
|
24
|
+
import { getVersion, sendableSteps } from '@atlaskit/prosemirror-collab';
|
|
25
25
|
import throttle from 'lodash/throttle';
|
|
26
26
|
import isEqual from 'lodash/isEqual';
|
|
27
27
|
import countBy from 'lodash/countBy';
|
|
@@ -289,7 +289,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
289
289
|
});
|
|
290
290
|
|
|
291
291
|
_defineProperty(_assertThisInitialized(_this), "applyLocalSteps", function (steps) {
|
|
292
|
-
// Re-
|
|
292
|
+
// Re-apply local steps
|
|
293
293
|
_this.emit('local-steps', {
|
|
294
294
|
steps: steps
|
|
295
295
|
});
|
|
@@ -943,6 +943,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
943
943
|
}
|
|
944
944
|
/**
|
|
945
945
|
* Send steps from transaction to other participants
|
|
946
|
+
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
946
947
|
*/
|
|
947
948
|
|
|
948
949
|
}, {
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NCSFeatureFlags, RequiredNCSFeatureFlags, SupportedProduct } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Takes a record of {NCS Feature Flag Names → boolean} and a supported product name.
|
|
4
|
+
* Returns the corresponding product’s Launch Darkly Keys for each of the flags set as true in the input record.
|
|
5
|
+
* */
|
|
6
|
+
export declare const getProductSpecificFeatureFlags: (flags: RequiredNCSFeatureFlags, product: SupportedProduct) => Array<string>;
|
|
7
|
+
export declare function getCollabProviderFeatureFlag<T = boolean>(flagName: keyof NCSFeatureFlags, featureFlags?: {
|
|
8
|
+
[key: string]: boolean;
|
|
9
|
+
}): T;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface NCSFeatureFlags {
|
|
2
|
+
testFF?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface WithNCSFeatureFlags {
|
|
5
|
+
featureFlags?: NCSFeatureFlags;
|
|
6
|
+
}
|
|
7
|
+
export declare type RequiredNCSFeatureFlags = Record<keyof Required<NCSFeatureFlags>, boolean>;
|
|
8
|
+
export declare type NCSFeatureFlagsMap = Record<keyof Required<NCSFeatureFlags>, string>;
|
|
9
|
+
export declare const supportedProducts: readonly ["confluence"];
|
|
10
|
+
export declare type SupportedProduct = typeof supportedProducts[number];
|
|
11
|
+
export declare type ProductKeys = Record<SupportedProduct, NCSFeatureFlagsMap>;
|
|
@@ -55,7 +55,10 @@ export declare type AnalyticsEvent = {
|
|
|
55
55
|
error?: ErrorPayload;
|
|
56
56
|
participants?: number;
|
|
57
57
|
numUnconfirmedSteps?: number;
|
|
58
|
+
requiredPageRecovery?: boolean;
|
|
59
|
+
ttlEnabled?: boolean;
|
|
58
60
|
};
|
|
59
61
|
} | AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent;
|
|
60
62
|
export declare const ACK_MAX_TRY = 30;
|
|
63
|
+
export declare const CONFLUENCE = "confluence";
|
|
61
64
|
export {};
|
|
@@ -5,5 +5,5 @@ import { Mapping, Step } from 'prosemirror-transform';
|
|
|
5
5
|
* Some steps could be lost, if they are no longer
|
|
6
6
|
* invalid after rebased.
|
|
7
7
|
*/
|
|
8
|
-
export declare function rebaseSteps(steps: Step[], mapping: Mapping): Step[];
|
|
8
|
+
export declare function rebaseSteps(steps: readonly Step[], mapping: Mapping): Step[];
|
|
9
9
|
export declare const catchup: (opt: CatchupOptions) => Promise<void>;
|
|
@@ -44,6 +44,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
44
44
|
private sendStepsFromCurrentState;
|
|
45
45
|
/**
|
|
46
46
|
* Send steps from transaction to other participants
|
|
47
|
+
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
47
48
|
*/
|
|
48
49
|
send(_tr: Transaction | null, _oldState: EditorState | null, newState: EditorState): void;
|
|
49
50
|
private onRestore;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export interface Config {
|
|
|
17
17
|
need404?: boolean;
|
|
18
18
|
createSocket: (path: string, auth?: (cb: (data: object) => void) => void, productInfo?: ProductInformation) => Socket;
|
|
19
19
|
analyticsClient?: AnalyticsWebClient;
|
|
20
|
+
featureFlags?: {
|
|
21
|
+
[key: string]: boolean;
|
|
22
|
+
};
|
|
20
23
|
getUser?(userId: string): Promise<Pick<CollabParticipant, 'avatar' | 'email' | 'name'> & {
|
|
21
24
|
userId: string;
|
|
22
25
|
}>;
|
|
@@ -65,7 +68,7 @@ export declare type CollabTelepointerPayload = CollabEventTelepointerData;
|
|
|
65
68
|
export declare type CollabPresencePayload = CollabEventPresenceData;
|
|
66
69
|
export declare type CollabMetadataPayload = Metadata;
|
|
67
70
|
export declare type CollabLocalStepsPayload = {
|
|
68
|
-
steps: Step[];
|
|
71
|
+
steps: readonly Step[];
|
|
69
72
|
};
|
|
70
73
|
export interface CollabEvents {
|
|
71
74
|
'metadata:changed': CollabMetadataPayload;
|
|
@@ -183,9 +186,9 @@ export interface CatchupOptions {
|
|
|
183
186
|
filterQueue: (condition: (stepsPayload: StepsPayload) => boolean) => void;
|
|
184
187
|
getUnconfirmedSteps: () => {
|
|
185
188
|
version: number;
|
|
186
|
-
steps: Step<any>[];
|
|
189
|
+
steps: readonly Step<any>[];
|
|
187
190
|
clientID: string | number;
|
|
188
|
-
origins: Transaction<any>[];
|
|
191
|
+
origins: readonly Transaction<any>[];
|
|
189
192
|
} | null | undefined;
|
|
190
193
|
updateDocumentWithMetadata: ({ doc, version, metadata, reserveCursor, }: CollabInitPayload) => void;
|
|
191
194
|
applyLocalSteps: (steps: Step[]) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/analytics-gas-types": "5.0.9",
|
|
25
|
-
"@atlaskit/analytics-listeners": "^8.
|
|
26
|
-
"@atlaskit/editor-common": "^72.
|
|
25
|
+
"@atlaskit/analytics-listeners": "^8.5.0",
|
|
26
|
+
"@atlaskit/editor-common": "^72.2.0",
|
|
27
27
|
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
28
|
+
"@atlaskit/prosemirror-collab": "^0.1.0",
|
|
28
29
|
"@atlaskit/ufo": "^0.1.4",
|
|
29
30
|
"@atlaskit/util-service-support": "^6.1.0",
|
|
30
31
|
"@babel/runtime": "^7.0.0",
|
|
31
32
|
"eventemitter2": "^4.1.0",
|
|
32
33
|
"lodash": "^4.17.21",
|
|
33
|
-
"prosemirror-collab": "^1.2.2",
|
|
34
34
|
"prosemirror-transform": "1.3.2",
|
|
35
35
|
"socket.io-client": "^4.1.3"
|
|
36
36
|
},
|
|
@@ -47,12 +47,11 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@atlaskit/adf-schema": "^25.
|
|
50
|
+
"@atlaskit/adf-schema": "^25.1.0",
|
|
51
51
|
"@atlaskit/analytics-gas-types": "^5.0.9",
|
|
52
|
-
"@atlaskit/analytics-listeners": "^8.
|
|
52
|
+
"@atlaskit/analytics-listeners": "^8.5.0",
|
|
53
53
|
"@atlaskit/editor-test-helpers": "^18.0.0",
|
|
54
54
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
55
|
-
"@types/prosemirror-collab": "^1.1.1",
|
|
56
55
|
"@types/prosemirror-model": "^1.11.0",
|
|
57
56
|
"@types/prosemirror-state": "^1.2.0",
|
|
58
57
|
"prosemirror-model": "1.14.3",
|
package/report.api.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
### Table of contents
|
|
9
9
|
|
|
10
10
|
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
11
12
|
|
|
12
13
|
### Main Entry Types
|
|
13
14
|
|
|
@@ -108,7 +109,7 @@ export interface CollabInitPayload extends CollabEventInitData {
|
|
|
108
109
|
|
|
109
110
|
// @public (undocumented)
|
|
110
111
|
export type CollabLocalStepsPayload = {
|
|
111
|
-
steps: Step[];
|
|
112
|
+
steps: readonly Step[];
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
// @public (undocumented)
|
|
@@ -133,6 +134,10 @@ interface Config {
|
|
|
133
134
|
// (undocumented)
|
|
134
135
|
documentAri: string;
|
|
135
136
|
// (undocumented)
|
|
137
|
+
featureFlags?: {
|
|
138
|
+
[key: string]: boolean;
|
|
139
|
+
};
|
|
140
|
+
// (undocumented)
|
|
136
141
|
getUser?(userId: string): Promise<
|
|
137
142
|
Pick<CollabParticipant, 'avatar' | 'email' | 'name'> & {
|
|
138
143
|
userId: string;
|
|
@@ -278,3 +283,13 @@ interface Storage_2 {
|
|
|
278
283
|
```
|
|
279
284
|
|
|
280
285
|
<!--SECTION END: Main Entry Types-->
|
|
286
|
+
|
|
287
|
+
### Peer Dependencies
|
|
288
|
+
|
|
289
|
+
<!--SECTION START: Peer Dependencies-->
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
<!--SECTION END: Peer Dependencies-->
|