@atlaskit/collab-provider 9.7.4 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/provider/index.js +25 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/provider/index.js +24 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/provider/index.js +25 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/provider/index.d.ts +1 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts4.5/provider/index.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/package.json +2 -2
- package/report.api.md +2 -0
- package/tmp/api-report-tmp.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -43,6 +43,10 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
43
43
|
_this = _super.call(this);
|
|
44
44
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isChannelInitialized", false);
|
|
45
45
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isProviderInitialized", false);
|
|
46
|
+
// isBufferingEnabled is a boolean value passed to the config during provider creation.
|
|
47
|
+
// It determines if the provider should initialize immediately and will only be true if:
|
|
48
|
+
// the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isBufferingEnabled", false);
|
|
46
50
|
// isPreinitializating acts as a feature flag to determine when the provider has been initialized early
|
|
47
51
|
// and also contains the initial draft
|
|
48
52
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isPreinitializing", false);
|
|
@@ -96,6 +100,13 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
96
100
|
var sid = _ref2.sid,
|
|
97
101
|
initialized = _ref2.initialized;
|
|
98
102
|
_this.sessionId = sid;
|
|
103
|
+
// if buffering is enabled and the provider is initialized before connection, call catchup
|
|
104
|
+
// once setup resolves with the defined editor state
|
|
105
|
+
if (_this.isBufferingEnabled && _this.isProviderInitialized) {
|
|
106
|
+
_this.onSetupPromise.then(function () {
|
|
107
|
+
_this.documentService.sendStepsFromCurrentState();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
99
110
|
_this.emitCallback('connected', {
|
|
100
111
|
sid: sid,
|
|
101
112
|
initial: !initialized
|
|
@@ -271,6 +282,7 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
271
282
|
_this.channel = new _channel.Channel(config, _this.analyticsHelper);
|
|
272
283
|
_this.isChannelInitialized = false;
|
|
273
284
|
_this.initialDraft = _this.config.initialDraft;
|
|
285
|
+
_this.isBufferingEnabled = Boolean(_this.config.isBufferingEnabled);
|
|
274
286
|
_this.isProviderInitialized = false;
|
|
275
287
|
_this.isPreinitializing = false;
|
|
276
288
|
_this.participantsService = new _participantsService.ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId);
|
|
@@ -341,6 +353,17 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
341
353
|
// a defined getState (ie editor state is ready) AND after documentService sets the editor state
|
|
342
354
|
if (this.isPreinitializing) {
|
|
343
355
|
this.resolveOnSetupPromise();
|
|
356
|
+
if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
|
|
357
|
+
var _this$initialDraft2 = this.initialDraft,
|
|
358
|
+
document = _this$initialDraft2.document,
|
|
359
|
+
version = _this$initialDraft2.version,
|
|
360
|
+
metadata = _this$initialDraft2.metadata;
|
|
361
|
+
this.updateDocumentAndMetadata({
|
|
362
|
+
doc: document,
|
|
363
|
+
version: version,
|
|
364
|
+
metadata: metadata
|
|
365
|
+
});
|
|
366
|
+
}
|
|
344
367
|
}
|
|
345
368
|
}
|
|
346
369
|
if (!this.isChannelInitialized) {
|
|
@@ -374,8 +397,8 @@ var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
374
397
|
}, {
|
|
375
398
|
key: "isDraftTimestampStale",
|
|
376
399
|
value: function isDraftTimestampStale() {
|
|
377
|
-
var _this$
|
|
378
|
-
if (!((_this$
|
|
400
|
+
var _this$initialDraft3;
|
|
401
|
+
if (!((_this$initialDraft3 = this.initialDraft) !== null && _this$initialDraft3 !== void 0 && _this$initialDraft3.timestamp)) {
|
|
379
402
|
return false;
|
|
380
403
|
}
|
|
381
404
|
return Date.now() - this.initialDraft.timestamp >= PRELOAD_DRAFT_SYNC_PERIOD;
|
|
@@ -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 = "9.
|
|
9
|
+
var version = "9.8.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -20,6 +20,10 @@ export class Provider extends Emitter {
|
|
|
20
20
|
super();
|
|
21
21
|
_defineProperty(this, "isChannelInitialized", false);
|
|
22
22
|
_defineProperty(this, "isProviderInitialized", false);
|
|
23
|
+
// isBufferingEnabled is a boolean value passed to the config during provider creation.
|
|
24
|
+
// It determines if the provider should initialize immediately and will only be true if:
|
|
25
|
+
// the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
|
|
26
|
+
_defineProperty(this, "isBufferingEnabled", false);
|
|
23
27
|
// isPreinitializating acts as a feature flag to determine when the provider has been initialized early
|
|
24
28
|
// and also contains the initial draft
|
|
25
29
|
_defineProperty(this, "isPreinitializing", false);
|
|
@@ -73,6 +77,13 @@ export class Provider extends Emitter {
|
|
|
73
77
|
initialized
|
|
74
78
|
}) => {
|
|
75
79
|
this.sessionId = sid;
|
|
80
|
+
// if buffering is enabled and the provider is initialized before connection, call catchup
|
|
81
|
+
// once setup resolves with the defined editor state
|
|
82
|
+
if (this.isBufferingEnabled && this.isProviderInitialized) {
|
|
83
|
+
this.onSetupPromise.then(() => {
|
|
84
|
+
this.documentService.sendStepsFromCurrentState();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
76
87
|
this.emitCallback('connected', {
|
|
77
88
|
sid,
|
|
78
89
|
initial: !initialized
|
|
@@ -225,6 +236,7 @@ export class Provider extends Emitter {
|
|
|
225
236
|
this.channel = new Channel(config, this.analyticsHelper);
|
|
226
237
|
this.isChannelInitialized = false;
|
|
227
238
|
this.initialDraft = this.config.initialDraft;
|
|
239
|
+
this.isBufferingEnabled = Boolean(this.config.isBufferingEnabled);
|
|
228
240
|
this.isProviderInitialized = false;
|
|
229
241
|
this.isPreinitializing = false;
|
|
230
242
|
this.participantsService = new ParticipantsService(this.analyticsHelper, undefined, this.emitCallback, this.config.getUser, this.channel.broadcast, this.channel.sendPresenceJoined, this.getPresenceData, this.setUserId);
|
|
@@ -286,6 +298,18 @@ export class Provider extends Emitter {
|
|
|
286
298
|
// a defined getState (ie editor state is ready) AND after documentService sets the editor state
|
|
287
299
|
if (this.isPreinitializing) {
|
|
288
300
|
this.resolveOnSetupPromise();
|
|
301
|
+
if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
|
|
302
|
+
const {
|
|
303
|
+
document,
|
|
304
|
+
version,
|
|
305
|
+
metadata
|
|
306
|
+
} = this.initialDraft;
|
|
307
|
+
this.updateDocumentAndMetadata({
|
|
308
|
+
doc: document,
|
|
309
|
+
version,
|
|
310
|
+
metadata
|
|
311
|
+
});
|
|
312
|
+
}
|
|
289
313
|
}
|
|
290
314
|
}
|
|
291
315
|
if (!this.isChannelInitialized) {
|
package/dist/es2019/version.json
CHANGED
|
@@ -35,6 +35,10 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
35
35
|
_this = _super.call(this);
|
|
36
36
|
_defineProperty(_assertThisInitialized(_this), "isChannelInitialized", false);
|
|
37
37
|
_defineProperty(_assertThisInitialized(_this), "isProviderInitialized", false);
|
|
38
|
+
// isBufferingEnabled is a boolean value passed to the config during provider creation.
|
|
39
|
+
// It determines if the provider should initialize immediately and will only be true if:
|
|
40
|
+
// the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "isBufferingEnabled", false);
|
|
38
42
|
// isPreinitializating acts as a feature flag to determine when the provider has been initialized early
|
|
39
43
|
// and also contains the initial draft
|
|
40
44
|
_defineProperty(_assertThisInitialized(_this), "isPreinitializing", false);
|
|
@@ -88,6 +92,13 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
88
92
|
var sid = _ref2.sid,
|
|
89
93
|
initialized = _ref2.initialized;
|
|
90
94
|
_this.sessionId = sid;
|
|
95
|
+
// if buffering is enabled and the provider is initialized before connection, call catchup
|
|
96
|
+
// once setup resolves with the defined editor state
|
|
97
|
+
if (_this.isBufferingEnabled && _this.isProviderInitialized) {
|
|
98
|
+
_this.onSetupPromise.then(function () {
|
|
99
|
+
_this.documentService.sendStepsFromCurrentState();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
91
102
|
_this.emitCallback('connected', {
|
|
92
103
|
sid: sid,
|
|
93
104
|
initial: !initialized
|
|
@@ -263,6 +274,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
263
274
|
_this.channel = new Channel(config, _this.analyticsHelper);
|
|
264
275
|
_this.isChannelInitialized = false;
|
|
265
276
|
_this.initialDraft = _this.config.initialDraft;
|
|
277
|
+
_this.isBufferingEnabled = Boolean(_this.config.isBufferingEnabled);
|
|
266
278
|
_this.isProviderInitialized = false;
|
|
267
279
|
_this.isPreinitializing = false;
|
|
268
280
|
_this.participantsService = new ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId);
|
|
@@ -333,6 +345,17 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
333
345
|
// a defined getState (ie editor state is ready) AND after documentService sets the editor state
|
|
334
346
|
if (this.isPreinitializing) {
|
|
335
347
|
this.resolveOnSetupPromise();
|
|
348
|
+
if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
|
|
349
|
+
var _this$initialDraft2 = this.initialDraft,
|
|
350
|
+
document = _this$initialDraft2.document,
|
|
351
|
+
version = _this$initialDraft2.version,
|
|
352
|
+
metadata = _this$initialDraft2.metadata;
|
|
353
|
+
this.updateDocumentAndMetadata({
|
|
354
|
+
doc: document,
|
|
355
|
+
version: version,
|
|
356
|
+
metadata: metadata
|
|
357
|
+
});
|
|
358
|
+
}
|
|
336
359
|
}
|
|
337
360
|
}
|
|
338
361
|
if (!this.isChannelInitialized) {
|
|
@@ -366,8 +389,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
366
389
|
}, {
|
|
367
390
|
key: "isDraftTimestampStale",
|
|
368
391
|
value: function isDraftTimestampStale() {
|
|
369
|
-
var _this$
|
|
370
|
-
if (!((_this$
|
|
392
|
+
var _this$initialDraft3;
|
|
393
|
+
if (!((_this$initialDraft3 = this.initialDraft) !== null && _this$initialDraft3 !== void 0 && _this$initialDraft3.timestamp)) {
|
|
371
394
|
return false;
|
|
372
395
|
}
|
|
373
396
|
return Date.now() - this.initialDraft.timestamp >= PRELOAD_DRAFT_SYNC_PERIOD;
|
package/dist/esm/version.json
CHANGED
|
@@ -12,6 +12,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
12
12
|
private isChannelInitialized;
|
|
13
13
|
private initialDraft?;
|
|
14
14
|
private isProviderInitialized;
|
|
15
|
+
private isBufferingEnabled;
|
|
15
16
|
private isPreinitializing;
|
|
16
17
|
private sessionId?;
|
|
17
18
|
private clientId?;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export interface Config {
|
|
|
53
53
|
*/
|
|
54
54
|
throwOnNotConnected?: boolean;
|
|
55
55
|
initialDraft?: InitialDraft;
|
|
56
|
+
isBufferingEnabled?: boolean;
|
|
56
57
|
/**
|
|
57
58
|
* When a page is being published this number can control the number of failed steps until a catchup is triggered.
|
|
58
59
|
* The default value is MAX_STEP_REJECTED_ERROR (15).
|
|
@@ -12,6 +12,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
12
12
|
private isChannelInitialized;
|
|
13
13
|
private initialDraft?;
|
|
14
14
|
private isProviderInitialized;
|
|
15
|
+
private isBufferingEnabled;
|
|
15
16
|
private isPreinitializing;
|
|
16
17
|
private sessionId?;
|
|
17
18
|
private clientId?;
|
|
@@ -53,6 +53,7 @@ export interface Config {
|
|
|
53
53
|
*/
|
|
54
54
|
throwOnNotConnected?: boolean;
|
|
55
55
|
initialDraft?: InitialDraft;
|
|
56
|
+
isBufferingEnabled?: boolean;
|
|
56
57
|
/**
|
|
57
58
|
* When a page is being published this number can control the number of failed steps until a catchup is triggered.
|
|
58
59
|
* The default value is MAX_STEP_REJECTED_ERROR (15).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
38
38
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
39
|
-
"@atlaskit/editor-common": "^74.
|
|
39
|
+
"@atlaskit/editor-common": "^74.35.0",
|
|
40
40
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "1.0.2",
|
|
42
42
|
"@atlaskit/prosemirror-collab": "^0.2.0",
|
package/report.api.md
CHANGED
package/tmp/api-report-tmp.d.ts
CHANGED