@atlaskit/collab-provider 9.22.8 → 9.23.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/participants/participants-helper.js +4 -3
- package/dist/cjs/provider/index.js +11 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/participants/participants-helper.js +4 -2
- package/dist/es2019/provider/index.js +11 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/participants/participants-helper.js +4 -3
- package/dist/esm/provider/index.js +11 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/participants/participants-service.d.ts +2 -2
- package/dist/types/provider/index.d.ts +1 -1
- package/dist/types/types.d.ts +7 -8
- package/dist/types-ts4.5/participants/participants-service.d.ts +2 -2
- package/dist/types-ts4.5/provider/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +7 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 9.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#73460](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/73460) [`5bd301383865`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5bd301383865) - Add support for PermitOnlyPermissions to determine the user type in PresencePayload
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 9.22.9
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 9.22.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -13,11 +13,11 @@ var PARTICIPANT_UPDATE_INTERVAL = exports.PARTICIPANT_UPDATE_INTERVAL = 300 * 10
|
|
|
13
13
|
|
|
14
14
|
var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__PURE__*/function () {
|
|
15
15
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(payload, getUser) {
|
|
16
|
-
var sessionId, timestamp, clientId, userId, user, participant;
|
|
16
|
+
var sessionId, timestamp, clientId, userId, permit, user, participant;
|
|
17
17
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
|
-
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId;
|
|
20
|
+
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit;
|
|
21
21
|
_context.next = 3;
|
|
22
22
|
return getUser === null || getUser === void 0 ? void 0 : getUser(userId);
|
|
23
23
|
case 3:
|
|
@@ -29,7 +29,8 @@ var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__P
|
|
|
29
29
|
sessionId: sessionId,
|
|
30
30
|
lastActive: timestamp,
|
|
31
31
|
userId: userId,
|
|
32
|
-
clientId: clientId
|
|
32
|
+
clientId: clientId,
|
|
33
|
+
permit: permit
|
|
33
34
|
};
|
|
34
35
|
return _context.abrupt("return", participant);
|
|
35
36
|
case 6:
|
|
@@ -48,11 +48,17 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
48
48
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isChannelInitialized", false);
|
|
49
49
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isProviderInitialized", false);
|
|
50
50
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isBuffered", false);
|
|
51
|
+
// User permit is used to determine if the user is allowed to view, comment or edit the document
|
|
52
|
+
// Therefore, the initial value is false for all three
|
|
53
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permit", {
|
|
54
|
+
isPermittedToView: false,
|
|
55
|
+
isPermittedToComment: false,
|
|
56
|
+
isPermittedToEdit: false
|
|
57
|
+
});
|
|
51
58
|
// isBufferingEnabled is a boolean value passed to the config during provider creation.
|
|
52
59
|
// It determines if the provider should initialize immediately and will only be true if:
|
|
53
60
|
// the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
|
|
54
61
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isBufferingEnabled", false);
|
|
55
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permit", {});
|
|
56
62
|
/**
|
|
57
63
|
* Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
|
|
58
64
|
* Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
|
|
@@ -151,7 +157,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
151
157
|
return {
|
|
152
158
|
sessionId: _this.sessionId,
|
|
153
159
|
userId: _this.userId,
|
|
154
|
-
clientId: _this.clientId
|
|
160
|
+
clientId: _this.clientId,
|
|
161
|
+
permit: _this.permit
|
|
155
162
|
};
|
|
156
163
|
});
|
|
157
164
|
/**
|
|
@@ -416,7 +423,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
416
423
|
userId: this.userId,
|
|
417
424
|
sessionId: this.sessionId,
|
|
418
425
|
clientId: this.clientId,
|
|
419
|
-
selection: data.selection
|
|
426
|
+
selection: data.selection,
|
|
427
|
+
permit: this.permit
|
|
420
428
|
};
|
|
421
429
|
var callback = (0, _telepointersHelper.telepointerCallback)(this.config.documentAri);
|
|
422
430
|
this.channel.broadcast('participant:telepointer', payload, callback);
|
|
@@ -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 = "9.
|
|
8
|
+
var version = exports.version = "9.23.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -7,7 +7,8 @@ export const createParticipantFromPayload = async (payload, getUser) => {
|
|
|
7
7
|
sessionId,
|
|
8
8
|
timestamp,
|
|
9
9
|
clientId,
|
|
10
|
-
userId
|
|
10
|
+
userId,
|
|
11
|
+
permit
|
|
11
12
|
} = payload;
|
|
12
13
|
const user = await (getUser === null || getUser === void 0 ? void 0 : getUser(userId));
|
|
13
14
|
const participant = {
|
|
@@ -17,7 +18,8 @@ export const createParticipantFromPayload = async (payload, getUser) => {
|
|
|
17
18
|
sessionId,
|
|
18
19
|
lastActive: timestamp,
|
|
19
20
|
userId,
|
|
20
|
-
clientId
|
|
21
|
+
clientId,
|
|
22
|
+
permit
|
|
21
23
|
};
|
|
22
24
|
return participant;
|
|
23
25
|
};
|
|
@@ -26,11 +26,17 @@ export class Provider extends Emitter {
|
|
|
26
26
|
_defineProperty(this, "isChannelInitialized", false);
|
|
27
27
|
_defineProperty(this, "isProviderInitialized", false);
|
|
28
28
|
_defineProperty(this, "isBuffered", false);
|
|
29
|
+
// User permit is used to determine if the user is allowed to view, comment or edit the document
|
|
30
|
+
// Therefore, the initial value is false for all three
|
|
31
|
+
_defineProperty(this, "permit", {
|
|
32
|
+
isPermittedToView: false,
|
|
33
|
+
isPermittedToComment: false,
|
|
34
|
+
isPermittedToEdit: false
|
|
35
|
+
});
|
|
29
36
|
// isBufferingEnabled is a boolean value passed to the config during provider creation.
|
|
30
37
|
// It determines if the provider should initialize immediately and will only be true if:
|
|
31
38
|
// the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
|
|
32
39
|
_defineProperty(this, "isBufferingEnabled", false);
|
|
33
|
-
_defineProperty(this, "permit", {});
|
|
34
40
|
/**
|
|
35
41
|
* Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
|
|
36
42
|
* Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
|
|
@@ -129,7 +135,8 @@ export class Provider extends Emitter {
|
|
|
129
135
|
return {
|
|
130
136
|
sessionId: this.sessionId,
|
|
131
137
|
userId: this.userId,
|
|
132
|
-
clientId: this.clientId
|
|
138
|
+
clientId: this.clientId,
|
|
139
|
+
permit: this.permit
|
|
133
140
|
};
|
|
134
141
|
});
|
|
135
142
|
/**
|
|
@@ -355,7 +362,8 @@ export class Provider extends Emitter {
|
|
|
355
362
|
userId: this.userId,
|
|
356
363
|
sessionId: this.sessionId,
|
|
357
364
|
clientId: this.clientId,
|
|
358
|
-
selection: data.selection
|
|
365
|
+
selection: data.selection,
|
|
366
|
+
permit: this.permit
|
|
359
367
|
};
|
|
360
368
|
const callback = telepointerCallback(this.config.documentAri);
|
|
361
369
|
this.channel.broadcast('participant:telepointer', payload, callback);
|
|
@@ -6,11 +6,11 @@ export var PARTICIPANT_UPDATE_INTERVAL = 300 * 1000; // 300 seconds
|
|
|
6
6
|
|
|
7
7
|
export var createParticipantFromPayload = /*#__PURE__*/function () {
|
|
8
8
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload, getUser) {
|
|
9
|
-
var sessionId, timestamp, clientId, userId, user, participant;
|
|
9
|
+
var sessionId, timestamp, clientId, userId, permit, user, participant;
|
|
10
10
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
11
|
while (1) switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
|
-
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId;
|
|
13
|
+
sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit;
|
|
14
14
|
_context.next = 3;
|
|
15
15
|
return getUser === null || getUser === void 0 ? void 0 : getUser(userId);
|
|
16
16
|
case 3:
|
|
@@ -22,7 +22,8 @@ export var createParticipantFromPayload = /*#__PURE__*/function () {
|
|
|
22
22
|
sessionId: sessionId,
|
|
23
23
|
lastActive: timestamp,
|
|
24
24
|
userId: userId,
|
|
25
|
-
clientId: clientId
|
|
25
|
+
clientId: clientId,
|
|
26
|
+
permit: permit
|
|
26
27
|
};
|
|
27
28
|
return _context.abrupt("return", participant);
|
|
28
29
|
case 6:
|
|
@@ -41,11 +41,17 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
41
41
|
_defineProperty(_assertThisInitialized(_this), "isChannelInitialized", false);
|
|
42
42
|
_defineProperty(_assertThisInitialized(_this), "isProviderInitialized", false);
|
|
43
43
|
_defineProperty(_assertThisInitialized(_this), "isBuffered", false);
|
|
44
|
+
// User permit is used to determine if the user is allowed to view, comment or edit the document
|
|
45
|
+
// Therefore, the initial value is false for all three
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "permit", {
|
|
47
|
+
isPermittedToView: false,
|
|
48
|
+
isPermittedToComment: false,
|
|
49
|
+
isPermittedToEdit: false
|
|
50
|
+
});
|
|
44
51
|
// isBufferingEnabled is a boolean value passed to the config during provider creation.
|
|
45
52
|
// It determines if the provider should initialize immediately and will only be true if:
|
|
46
53
|
// the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
|
|
47
54
|
_defineProperty(_assertThisInitialized(_this), "isBufferingEnabled", false);
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "permit", {});
|
|
49
55
|
/**
|
|
50
56
|
* Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
|
|
51
57
|
* Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
|
|
@@ -144,7 +150,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
144
150
|
return {
|
|
145
151
|
sessionId: _this.sessionId,
|
|
146
152
|
userId: _this.userId,
|
|
147
|
-
clientId: _this.clientId
|
|
153
|
+
clientId: _this.clientId,
|
|
154
|
+
permit: _this.permit
|
|
148
155
|
};
|
|
149
156
|
});
|
|
150
157
|
/**
|
|
@@ -409,7 +416,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
409
416
|
userId: this.userId,
|
|
410
417
|
sessionId: this.sessionId,
|
|
411
418
|
clientId: this.clientId,
|
|
412
|
-
selection: data.selection
|
|
419
|
+
selection: data.selection,
|
|
420
|
+
permit: this.permit
|
|
413
421
|
};
|
|
414
422
|
var callback = telepointerCallback(this.config.documentAri);
|
|
415
423
|
this.channel.broadcast('participant:telepointer', payload, callback);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
2
2
|
import type { CollabEventDisconnectedData, ChannelEvent, PresenceData, PresencePayload, TelepointerPayload } from '../types';
|
|
3
|
-
import type { CollabEventPresenceData, CollabTelepointerPayload, StepJson } from '@atlaskit/editor-common/collab';
|
|
3
|
+
import type { CollabEventPresenceData, CollabTelepointerPayload, ProviderParticipant, StepJson } from '@atlaskit/editor-common/collab';
|
|
4
4
|
import type { GetUserType } from './participants-helper';
|
|
5
5
|
import { ParticipantsState } from './participants-state';
|
|
6
6
|
/**
|
|
@@ -96,5 +96,5 @@ export declare class ParticipantsService {
|
|
|
96
96
|
/**
|
|
97
97
|
*
|
|
98
98
|
*/
|
|
99
|
-
getParticipants: () =>
|
|
99
|
+
getParticipants: () => ProviderParticipant[];
|
|
100
100
|
}
|
|
@@ -16,8 +16,8 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
16
16
|
private initialDraft?;
|
|
17
17
|
private isProviderInitialized;
|
|
18
18
|
private isBuffered;
|
|
19
|
-
private isBufferingEnabled;
|
|
20
19
|
private permit;
|
|
20
|
+
private isBufferingEnabled;
|
|
21
21
|
private sessionId?;
|
|
22
22
|
private clientId?;
|
|
23
23
|
private userId?;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -108,10 +108,16 @@ export type BroadcastIncomingPayload = {
|
|
|
108
108
|
timestamp?: number;
|
|
109
109
|
data: PresencePayload | TelepointerPayload | StepsPayload | any;
|
|
110
110
|
};
|
|
111
|
+
export type UserPermitType = {
|
|
112
|
+
isPermittedToView: boolean;
|
|
113
|
+
isPermittedToComment: boolean;
|
|
114
|
+
isPermittedToEdit: boolean;
|
|
115
|
+
};
|
|
111
116
|
export type PresenceData = {
|
|
112
117
|
sessionId: string;
|
|
113
118
|
userId: string | undefined;
|
|
114
119
|
clientId: number | string;
|
|
120
|
+
permit?: UserPermitType;
|
|
115
121
|
};
|
|
116
122
|
export type PresencePayload = PresenceData & {
|
|
117
123
|
timestamp: number;
|
|
@@ -145,13 +151,6 @@ export type NamespaceStatus = {
|
|
|
145
151
|
timestamp: number;
|
|
146
152
|
waitTimeInMs?: number;
|
|
147
153
|
};
|
|
148
|
-
export type Permit = {
|
|
149
|
-
reason?: string;
|
|
150
|
-
isPermittedToView?: boolean;
|
|
151
|
-
isPermittedToComment?: boolean;
|
|
152
|
-
isPermittedToEdit?: boolean;
|
|
153
|
-
maintenanceMode?: boolean;
|
|
154
|
-
};
|
|
155
154
|
export type ChannelEvent = {
|
|
156
155
|
connected: {
|
|
157
156
|
sid: string;
|
|
@@ -170,7 +169,7 @@ export type ChannelEvent = {
|
|
|
170
169
|
};
|
|
171
170
|
'steps:added': StepsPayload;
|
|
172
171
|
'metadata:changed': Metadata;
|
|
173
|
-
permission:
|
|
172
|
+
permission: UserPermitType;
|
|
174
173
|
error: InternalError;
|
|
175
174
|
disconnect: {
|
|
176
175
|
reason: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
2
2
|
import type { CollabEventDisconnectedData, ChannelEvent, PresenceData, PresencePayload, TelepointerPayload } from '../types';
|
|
3
|
-
import type { CollabEventPresenceData, CollabTelepointerPayload, StepJson } from '@atlaskit/editor-common/collab';
|
|
3
|
+
import type { CollabEventPresenceData, CollabTelepointerPayload, ProviderParticipant, StepJson } from '@atlaskit/editor-common/collab';
|
|
4
4
|
import type { GetUserType } from './participants-helper';
|
|
5
5
|
import { ParticipantsState } from './participants-state';
|
|
6
6
|
/**
|
|
@@ -96,5 +96,5 @@ export declare class ParticipantsService {
|
|
|
96
96
|
/**
|
|
97
97
|
*
|
|
98
98
|
*/
|
|
99
|
-
getParticipants: () =>
|
|
99
|
+
getParticipants: () => ProviderParticipant[];
|
|
100
100
|
}
|
|
@@ -16,8 +16,8 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
|
|
|
16
16
|
private initialDraft?;
|
|
17
17
|
private isProviderInitialized;
|
|
18
18
|
private isBuffered;
|
|
19
|
-
private isBufferingEnabled;
|
|
20
19
|
private permit;
|
|
20
|
+
private isBufferingEnabled;
|
|
21
21
|
private sessionId?;
|
|
22
22
|
private clientId?;
|
|
23
23
|
private userId?;
|
|
@@ -108,10 +108,16 @@ export type BroadcastIncomingPayload = {
|
|
|
108
108
|
timestamp?: number;
|
|
109
109
|
data: PresencePayload | TelepointerPayload | StepsPayload | any;
|
|
110
110
|
};
|
|
111
|
+
export type UserPermitType = {
|
|
112
|
+
isPermittedToView: boolean;
|
|
113
|
+
isPermittedToComment: boolean;
|
|
114
|
+
isPermittedToEdit: boolean;
|
|
115
|
+
};
|
|
111
116
|
export type PresenceData = {
|
|
112
117
|
sessionId: string;
|
|
113
118
|
userId: string | undefined;
|
|
114
119
|
clientId: number | string;
|
|
120
|
+
permit?: UserPermitType;
|
|
115
121
|
};
|
|
116
122
|
export type PresencePayload = PresenceData & {
|
|
117
123
|
timestamp: number;
|
|
@@ -145,13 +151,6 @@ export type NamespaceStatus = {
|
|
|
145
151
|
timestamp: number;
|
|
146
152
|
waitTimeInMs?: number;
|
|
147
153
|
};
|
|
148
|
-
export type Permit = {
|
|
149
|
-
reason?: string;
|
|
150
|
-
isPermittedToView?: boolean;
|
|
151
|
-
isPermittedToComment?: boolean;
|
|
152
|
-
isPermittedToEdit?: boolean;
|
|
153
|
-
maintenanceMode?: boolean;
|
|
154
|
-
};
|
|
155
154
|
export type ChannelEvent = {
|
|
156
155
|
connected: {
|
|
157
156
|
sid: string;
|
|
@@ -170,7 +169,7 @@ export type ChannelEvent = {
|
|
|
170
169
|
};
|
|
171
170
|
'steps:added': StepsPayload;
|
|
172
171
|
'metadata:changed': Metadata;
|
|
173
|
-
permission:
|
|
172
|
+
permission: UserPermitType;
|
|
174
173
|
error: InternalError;
|
|
175
174
|
disconnect: {
|
|
176
175
|
reason: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.23.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.9.0",
|
|
39
|
-
"@atlaskit/editor-common": "^
|
|
39
|
+
"@atlaskit/editor-common": "^78.1.0",
|
|
40
40
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
42
42
|
"@atlaskit/prosemirror-collab": "^0.2.0",
|