@ckeditor/ckeditor-cloud-services-collaboration 0.0.0-internal-20251222.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/LICENSE.md +30 -0
- package/README.md +21 -0
- package/dist/ckeditorcloudserviceserror.d.ts +11 -0
- package/dist/ckeditorcloudservicesservererror.d.ts +18 -0
- package/dist/collaborativeeditingservice/collaborativeeditingservice.d.ts +131 -0
- package/dist/collaborativeeditingservice/descriptors/operationmetadatadescriptor.d.ts +21 -0
- package/dist/collaborativeeditingservice/helpers/operationmetadatahelpers.d.ts +14 -0
- package/dist/collaborativeeditingservice/messages/collaborativeeditingconnectmessage.d.ts +28 -0
- package/dist/collaborativeeditingservice/messages/collaborativeeditingreconnectmessage.d.ts +22 -0
- package/dist/collaborativeeditingservice/messages/collaborativeeditingupdatemessage.d.ts +42 -0
- package/dist/collaborativeeditingservice/messages/getdocumentdetailsmessage.d.ts +19 -0
- package/dist/collaborativeeditingservice/responses/collaborativeeditingconnectresponse.d.ts +72 -0
- package/dist/collaborativeeditingservice/responses/collaborativeeditingresponse.d.ts +55 -0
- package/dist/collaborativeeditingservice/responses/getdocumentdetailsresponse.d.ts +31 -0
- package/dist/comments-v2/commentsservice.d.ts +75 -0
- package/dist/comments-v2/descriptors/commentdescriptor.d.ts +26 -0
- package/dist/comments-v2/descriptors/commentsthreaddescriptor.d.ts +34 -0
- package/dist/comments-v2/descriptors/commentthreadaddedcomment.d.ts +18 -0
- package/dist/comments-v2/messages/addcommentmessage.d.ts +33 -0
- package/dist/comments-v2/messages/comment-threads/addcommentthreadmessage.d.ts +35 -0
- package/dist/comments-v2/messages/comment-threads/reopencommentthreadmessage.d.ts +20 -0
- package/dist/comments-v2/messages/comment-threads/resolvecommentthreadmessage.d.ts +24 -0
- package/dist/comments-v2/messages/comment-threads/updatecommentthreadmessage.d.ts +26 -0
- package/dist/comments-v2/messages/connectmessage.d.ts +18 -0
- package/dist/comments-v2/messages/getcommentthreadmessage.d.ts +20 -0
- package/dist/comments-v2/messages/getdocumentthreadsmessage.d.ts +18 -0
- package/dist/comments-v2/messages/removecommentmessage.d.ts +22 -0
- package/dist/comments-v2/messages/removecommentthreadmessage.d.ts +20 -0
- package/dist/comments-v2/messages/updatecommentmessage.d.ts +31 -0
- package/dist/comments-v2/responses/addcommentresponse.d.ts +20 -0
- package/dist/comments-v2/responses/comment-threads/addcommentthreadresponse.d.ts +25 -0
- package/dist/comments-v2/responses/comment-threads/resolvecommentthreadresponse.d.ts +22 -0
- package/dist/comments-v2/responses/connectresponse.d.ts +22 -0
- package/dist/comments-v2/responses/getcommentthreadresponse.d.ts +36 -0
- package/dist/comments-v2/responses/getdocumentthreadsresponse.d.ts +20 -0
- package/dist/compiledmessages.d.ts +6 -0
- package/dist/descriptor.d.ts +16 -0
- package/dist/descriptors/keyvaluedescriptor.d.ts +8 -0
- package/dist/editor/editorservice.d.ts +14 -0
- package/dist/editor/messages/iseditorbundleuploadedmessage.d.ts +18 -0
- package/dist/editor/responses/iseditorbundleuploadedresponse.d.ts +16 -0
- package/dist/errors/ServiceNotConnectedError.d.ts +7 -0
- package/dist/index.d.ts +68 -0
- package/dist/message.d.ts +20 -0
- package/dist/messagescompressor.d.ts +19 -0
- package/dist/messagesmapper.d.ts +12 -0
- package/dist/revision-history/descriptors/revisiondescriptor.d.ts +45 -0
- package/dist/revision-history/messages/revisionhistoryconnectmessage.d.ts +18 -0
- package/dist/revision-history/messages/revisionhistorygetrevisionmessage.d.ts +20 -0
- package/dist/revision-history/messages/revisionhistoryreconnectmessage.d.ts +20 -0
- package/dist/revision-history/messages/revisionhistoryupdaterevisionsmessage.d.ts +44 -0
- package/dist/revision-history/responses/revisionhistoryconnectresponse.d.ts +33 -0
- package/dist/revision-history/responses/revisionhistorygetrevisionresponse.d.ts +33 -0
- package/dist/revision-history/responses/revisionhistoryupdaterevisionsresponse.d.ts +16 -0
- package/dist/revision-history/revision.d.ts +18 -0
- package/dist/revision-history/revisionhistoryservice.d.ts +78 -0
- package/dist/services-content.css +3 -0
- package/dist/services-editor.css +3 -0
- package/dist/services.css +3 -0
- package/dist/services.d.ts +19 -0
- package/dist/services.js +67 -0
- package/dist/services.js.map +1 -0
- package/dist/sessions/descriptors/sessiondescriptor.d.ts +8 -0
- package/dist/sessions/messages/sessionsconnectmessage.d.ts +20 -0
- package/dist/sessions/messages/socketconnectmessage.d.ts +24 -0
- package/dist/sessions/messages/socketdisconnectmessage.d.ts +18 -0
- package/dist/sessions/responses/sessionsconnectresponse.d.ts +24 -0
- package/dist/sessions/sessioncollection.d.ts +43 -0
- package/dist/sessions/sessions.d.ts +16 -0
- package/dist/track-changes/descriptors/suggestiondescriptor.d.ts +28 -0
- package/dist/track-changes/messages/addsuggestionmessage.d.ts +28 -0
- package/dist/track-changes/messages/batchUpdateSuggestionsStateMessage.d.ts +22 -0
- package/dist/track-changes/messages/connectmessage.d.ts +18 -0
- package/dist/track-changes/messages/getallsuggestionsmessage.d.ts +18 -0
- package/dist/track-changes/messages/getsuggestionmessage.d.ts +20 -0
- package/dist/track-changes/messages/updatesuggestionmessage.d.ts +28 -0
- package/dist/track-changes/responses/addsuggestionresponse.d.ts +30 -0
- package/dist/track-changes/responses/connectresponse.d.ts +22 -0
- package/dist/track-changes/responses/getallsuggestionsresponse.d.ts +20 -0
- package/dist/track-changes/responses/getsuggestionresponse.d.ts +30 -0
- package/dist/track-changes/trackchangesservice.d.ts +65 -0
- package/dist/types.d.ts +10 -0
- package/dist/users/descriptors/userdescriptor.d.ts +8 -0
- package/dist/users/messages/getmanyusersmessage.d.ts +18 -0
- package/dist/users/messages/getusermessage.d.ts +18 -0
- package/dist/users/responses/getmanyusersresponse.d.ts +16 -0
- package/dist/users/responses/getuserresponse.d.ts +16 -0
- package/dist/users/user.d.ts +44 -0
- package/dist/version.d.ts +5 -0
- package/dist/websocketgateway/channel.d.ts +34 -0
- package/dist/websocketgateway/messages/channelmessage.d.ts +25 -0
- package/dist/websocketgateway/parser/packetparser.d.ts +19 -0
- package/dist/websocketgateway/parser/packets/bytesbytespacketdatamessage.d.ts +22 -0
- package/dist/websocketgateway/parser/packets/numberbytespacketdatamessage.d.ts +22 -0
- package/dist/websocketgateway/parser/packets/numbernumberpacketdatamessag.d.ts +20 -0
- package/dist/websocketgateway/parser/packets/numberobjectpacketdatamessage.d.ts +20 -0
- package/dist/websocketgateway/parser/packets/numberstringpacketdatamessag.d.ts +20 -0
- package/dist/websocketgateway/parser/packets/objectbufferpacketdatamessage.d.ts +22 -0
- package/dist/websocketgateway/parser/packets/objectobjectpacketdatamessage.d.ts +20 -0
- package/dist/websocketgateway/parser/packets/packagedatamessage.d.ts +19 -0
- package/dist/websocketgateway/parser/packets/packetmessage.d.ts +35 -0
- package/dist/websocketgateway/parser/packets/packetoptionsmessage.d.ts +21 -0
- package/dist/websocketgateway/parser/packets/stringbytespacketdatamessage.d.ts +22 -0
- package/dist/websocketgateway/parser/packets/stringnumberpacketdatamessage.d.ts +20 -0
- package/dist/websocketgateway/parser/packets/stringobjectpacketdatamessage.d.ts +20 -0
- package/dist/websocketgateway/parser/packets/stringstringpacketdatamessage.d.ts +20 -0
- package/dist/websocketgateway/parser/parser.d.ts +18 -0
- package/dist/websocketgateway/parser/parserutils.d.ts +33 -0
- package/dist/websocketgateway/requestsmanager.d.ts +23 -0
- package/dist/websocketgateway/websocketgateway.d.ts +169 -0
- package/package.json +42 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Descriptor, { IDescriptorBody } from './../../descriptor';
|
|
5
|
+
export default class SessionsSocketDescriptor extends Descriptor {
|
|
6
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
7
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface ISessionsConnectMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
sessionType: number | string;
|
|
9
|
+
}
|
|
10
|
+
export default class SessionsConnectMessage extends Message {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly sessionType: string | number;
|
|
13
|
+
static readonly TYPE: string;
|
|
14
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
15
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
16
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
17
|
+
constructor(id: string, sessionType: string | number);
|
|
18
|
+
toJSON(): ISessionsConnectMessage;
|
|
19
|
+
static fromJSON(data: ISessionsConnectMessage): SessionsConnectMessage;
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface ISocketConnectMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
userId?: string;
|
|
9
|
+
role?: string;
|
|
10
|
+
permissions?: string[];
|
|
11
|
+
}
|
|
12
|
+
export default class SocketConnectMessage extends Message {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly userId?: string | undefined;
|
|
15
|
+
readonly role?: string | undefined;
|
|
16
|
+
readonly permissions?: string[] | undefined;
|
|
17
|
+
static readonly TYPE: string;
|
|
18
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
19
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
20
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
21
|
+
constructor(id: string, userId?: string | undefined, role?: string | undefined, permissions?: string[] | undefined);
|
|
22
|
+
toJSON(): ISocketConnectMessage;
|
|
23
|
+
static fromJSON(data: ISocketConnectMessage): SocketConnectMessage;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface ISocketDisconnectMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
export default class SocketDisconnectMessage extends Message {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
static readonly TYPE: string;
|
|
12
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
13
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
14
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
15
|
+
constructor(id: string);
|
|
16
|
+
toJSON(): ISocketDisconnectMessage;
|
|
17
|
+
static fromJSON(data: ISocketDisconnectMessage): SocketDisconnectMessage;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
import { ISocket } from '../sessioncollection';
|
|
7
|
+
export interface ISessionsConnectResponse extends IMessage {
|
|
8
|
+
channel: string;
|
|
9
|
+
sockets: {
|
|
10
|
+
user?: string;
|
|
11
|
+
session: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
permissions?: string[];
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export default class SessionsConnectResponse extends Message {
|
|
17
|
+
readonly channel: string;
|
|
18
|
+
readonly sockets: ISocket[];
|
|
19
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
20
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
21
|
+
constructor(channel: string, sockets?: ISocket[]);
|
|
22
|
+
toJSON(): ISessionsConnectResponse;
|
|
23
|
+
static fromJSON(data: ISessionsConnectResponse): SessionsConnectResponse;
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Collection } from '@ckeditor/ckeditor5-utils';
|
|
5
|
+
import User from './../users/user';
|
|
6
|
+
import { IWebSocketGateway } from './../websocketgateway/websocketgateway';
|
|
7
|
+
export declare const _SERVICE: number;
|
|
8
|
+
export interface ISocket {
|
|
9
|
+
id: string;
|
|
10
|
+
user?: User;
|
|
11
|
+
userId?: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
permissions?: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Collection of connected socket to given service.
|
|
17
|
+
*/
|
|
18
|
+
declare class SessionCollection extends Collection<ISocket> {
|
|
19
|
+
private readonly _id;
|
|
20
|
+
private readonly _sessionType;
|
|
21
|
+
private readonly _handlers;
|
|
22
|
+
private _channel?;
|
|
23
|
+
private _wsGateway?;
|
|
24
|
+
private _connected;
|
|
25
|
+
private _eventsQueue;
|
|
26
|
+
private _isRunning;
|
|
27
|
+
constructor(_id: string, _sessionType: number);
|
|
28
|
+
/**
|
|
29
|
+
* Connects SessionCollection to CKEditor Cloud Services..
|
|
30
|
+
*/
|
|
31
|
+
connect(wsGateway: IWebSocketGateway): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Disconnects SessionCollection from CKEditor Cloud Services.
|
|
34
|
+
*/
|
|
35
|
+
disconnect(force?: boolean): void;
|
|
36
|
+
add(_1: ISocket, _2?: number): this;
|
|
37
|
+
remove(_: number): ISocket;
|
|
38
|
+
private _connectToChannel;
|
|
39
|
+
private _onWsGatewayStateChange;
|
|
40
|
+
private _runQueue;
|
|
41
|
+
private _addHandler;
|
|
42
|
+
}
|
|
43
|
+
export default SessionCollection;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import SessionCollection from './sessioncollection';
|
|
5
|
+
import { IWebSocketGateway } from '../websocketgateway/websocketgateway';
|
|
6
|
+
/**
|
|
7
|
+
* Abstracts requesting connected Sessions for services. Should not be used directly
|
|
8
|
+
*/
|
|
9
|
+
export default class Sessions {
|
|
10
|
+
/**
|
|
11
|
+
* Returns a Promise that resolves with read-only observable collection with EndUsers Sessions for given service instance.
|
|
12
|
+
*
|
|
13
|
+
* const sessions = await wsGateway.getConnectedSessions( wsGateway, 'some-uuid', 'session-type' );
|
|
14
|
+
*/
|
|
15
|
+
static getConnectedSessions(wsGateway: IWebSocketGateway, id: string, sessionType: number): Promise<SessionCollection>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Descriptor, { IDescriptorBody } from './../../descriptor';
|
|
5
|
+
interface ICommonSuggestion {
|
|
6
|
+
id: string;
|
|
7
|
+
authorId: string;
|
|
8
|
+
type: string;
|
|
9
|
+
hasComments?: boolean;
|
|
10
|
+
state?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ISuggestion extends ICommonSuggestion {
|
|
13
|
+
createdAt?: Date;
|
|
14
|
+
data?: Record<string, unknown> | null;
|
|
15
|
+
attributes?: Record<string, unknown> | null;
|
|
16
|
+
}
|
|
17
|
+
export interface ISuggestionJSON extends ICommonSuggestion {
|
|
18
|
+
createdAt?: string;
|
|
19
|
+
data?: string | null;
|
|
20
|
+
attributes?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export default class SuggestionDescriptor extends Descriptor {
|
|
23
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
24
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
25
|
+
static toJSON(suggestion: ISuggestion): ISuggestionJSON;
|
|
26
|
+
static fromJSON(suggestion: ISuggestionJSON): ISuggestion;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IAddSuggestionMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
documentId: string;
|
|
9
|
+
type: string;
|
|
10
|
+
data: string;
|
|
11
|
+
originalSuggestionId: string | null;
|
|
12
|
+
attributes: string | null;
|
|
13
|
+
}
|
|
14
|
+
export default class AddSuggestionMessage extends Message {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly documentId: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly data: Record<string, unknown>;
|
|
19
|
+
readonly originalSuggestionId: string | null;
|
|
20
|
+
readonly attributes: Record<string, unknown> | null;
|
|
21
|
+
static readonly TYPE: string;
|
|
22
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
23
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
24
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
25
|
+
constructor(id: string, documentId: string, type: string, data?: Record<string, unknown>, originalSuggestionId?: string | null, attributes?: Record<string, unknown> | null);
|
|
26
|
+
toJSON(): IAddSuggestionMessage;
|
|
27
|
+
static fromJSON(object: IAddSuggestionMessage): AddSuggestionMessage;
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IBatchUpdateSuggestionsStateMessage {
|
|
7
|
+
ids: string[];
|
|
8
|
+
documentId: string;
|
|
9
|
+
state: string;
|
|
10
|
+
}
|
|
11
|
+
export default class BatchUpdateSuggestionsStateMessage extends Message {
|
|
12
|
+
ids: string[];
|
|
13
|
+
documentId: string;
|
|
14
|
+
state: string;
|
|
15
|
+
static readonly TYPE: string;
|
|
16
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
17
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
18
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
19
|
+
constructor(ids: string[], documentId: string, state: string);
|
|
20
|
+
toJSON(): IBatchUpdateSuggestionsStateMessage;
|
|
21
|
+
static fromJSON(object: IBatchUpdateSuggestionsStateMessage): BatchUpdateSuggestionsStateMessage;
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IConnectMessage extends IMessage {
|
|
7
|
+
documentId: string;
|
|
8
|
+
}
|
|
9
|
+
export default class ConnectMessage extends Message {
|
|
10
|
+
readonly documentId: string;
|
|
11
|
+
static readonly TYPE: string;
|
|
12
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
13
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
14
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
15
|
+
constructor(documentId: string);
|
|
16
|
+
toJSON(): IConnectMessage;
|
|
17
|
+
static fromJSON(object: IConnectMessage): ConnectMessage;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetAllSuggestionsMessage extends IMessage {
|
|
7
|
+
documentId: string;
|
|
8
|
+
}
|
|
9
|
+
export default class GetAllSuggestionsMessage extends Message {
|
|
10
|
+
readonly documentId: string;
|
|
11
|
+
static readonly TYPE: string;
|
|
12
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
13
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
14
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
15
|
+
constructor(documentId: string);
|
|
16
|
+
toJSON(): IGetAllSuggestionsMessage;
|
|
17
|
+
static fromJSON(object: IGetAllSuggestionsMessage): GetAllSuggestionsMessage;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetSuggestionMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
documentId: string;
|
|
9
|
+
}
|
|
10
|
+
export default class GetSuggestionMessage extends Message {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly documentId: string;
|
|
13
|
+
static readonly TYPE: string;
|
|
14
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
15
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
16
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
17
|
+
constructor(id: string, documentId: string);
|
|
18
|
+
toJSON(): IGetSuggestionMessage;
|
|
19
|
+
static fromJSON(object: IGetSuggestionMessage): GetSuggestionMessage;
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IUpdateSuggestionMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
documentId: string;
|
|
9
|
+
hasComments?: boolean;
|
|
10
|
+
isHasCommentsModified: boolean;
|
|
11
|
+
state?: string;
|
|
12
|
+
attributes: string;
|
|
13
|
+
}
|
|
14
|
+
export default class UpdateSuggestionMessage extends Message {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly documentId: string;
|
|
17
|
+
readonly hasComments: boolean | undefined;
|
|
18
|
+
readonly isHasCommentsModified: boolean;
|
|
19
|
+
readonly state?: string | undefined;
|
|
20
|
+
readonly attributes: Record<string, unknown> | null;
|
|
21
|
+
static readonly TYPE: string;
|
|
22
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
23
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
24
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
25
|
+
constructor(id: string, documentId: string, hasComments: boolean | undefined, isHasCommentsModified: boolean, state?: string | undefined, attributes?: Record<string, unknown> | null);
|
|
26
|
+
toJSON(): IUpdateSuggestionMessage;
|
|
27
|
+
static fromJSON(object: IUpdateSuggestionMessage): UpdateSuggestionMessage;
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IAddSuggestionResponse extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
authorId: string;
|
|
9
|
+
type: string;
|
|
10
|
+
createdAt?: string;
|
|
11
|
+
data: string;
|
|
12
|
+
hasComments?: boolean;
|
|
13
|
+
state?: string;
|
|
14
|
+
attributes: string | null;
|
|
15
|
+
}
|
|
16
|
+
export default class AddSuggestionResponse extends Message {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly authorId: string;
|
|
19
|
+
readonly type: string;
|
|
20
|
+
readonly hasComments?: boolean | undefined;
|
|
21
|
+
readonly state?: string | undefined;
|
|
22
|
+
readonly data: Record<string, unknown> | null;
|
|
23
|
+
readonly attributes: Record<string, unknown> | null;
|
|
24
|
+
readonly createdAt?: Date;
|
|
25
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
26
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
27
|
+
constructor(id: string, authorId: string, type: string, createdAt?: string, hasComments?: boolean | undefined, state?: string | undefined, data?: Record<string, unknown> | null, attributes?: Record<string, unknown> | null);
|
|
28
|
+
toJSON(): IAddSuggestionResponse;
|
|
29
|
+
static fromJSON(data: IAddSuggestionResponse): AddSuggestionResponse;
|
|
30
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
import { ISuggestion, ISuggestionJSON } from '../descriptors/suggestiondescriptor';
|
|
7
|
+
export interface IConnectResponse extends IMessage {
|
|
8
|
+
channel: string;
|
|
9
|
+
suggestions?: string[];
|
|
10
|
+
suggestionsV2?: ISuggestionJSON[];
|
|
11
|
+
}
|
|
12
|
+
export default class ConnectResponse extends Message {
|
|
13
|
+
readonly channel: string;
|
|
14
|
+
private readonly _suggestions?;
|
|
15
|
+
private readonly _suggestionsV2?;
|
|
16
|
+
readonly suggestions: ISuggestion[];
|
|
17
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
18
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
19
|
+
constructor(channel: string, _suggestions?: ISuggestion[] | undefined, _suggestionsV2?: ISuggestion[] | undefined);
|
|
20
|
+
toJSON(): IConnectResponse;
|
|
21
|
+
static fromJSON(object: IConnectResponse): ConnectResponse;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
import { ISuggestion, ISuggestionJSON } from '../descriptors/suggestiondescriptor';
|
|
7
|
+
export interface IGetAllSuggestionResponse extends IMessage {
|
|
8
|
+
suggestions?: string[];
|
|
9
|
+
suggestionsV2?: ISuggestionJSON[];
|
|
10
|
+
}
|
|
11
|
+
export default class GetAllSuggestionResponse extends Message {
|
|
12
|
+
private readonly _suggestions?;
|
|
13
|
+
private readonly _suggestionsV2?;
|
|
14
|
+
readonly suggestions: ISuggestion[];
|
|
15
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
16
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
17
|
+
constructor(_suggestions?: ISuggestion[] | undefined, _suggestionsV2?: ISuggestion[] | undefined);
|
|
18
|
+
toJSON(): IGetAllSuggestionResponse;
|
|
19
|
+
static fromJSON(data: IGetAllSuggestionResponse): GetAllSuggestionResponse;
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetSuggestionResponse extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
authorId: string;
|
|
9
|
+
type: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
data: string;
|
|
12
|
+
hasComments: boolean;
|
|
13
|
+
state: string;
|
|
14
|
+
attributes: string | null;
|
|
15
|
+
}
|
|
16
|
+
export default class GetSuggestionResponse extends Message {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly authorId: string;
|
|
19
|
+
readonly type: string;
|
|
20
|
+
readonly hasComments: boolean;
|
|
21
|
+
readonly state: string;
|
|
22
|
+
readonly data: Record<string, unknown>;
|
|
23
|
+
readonly attributes: Record<string, unknown> | null;
|
|
24
|
+
readonly createdAt: Date;
|
|
25
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
26
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
27
|
+
constructor(id: string, authorId: string, type: string, createdAt: string, hasComments: boolean, state: string, data?: Record<string, unknown>, attributes?: Record<string, unknown> | null);
|
|
28
|
+
toJSON(): IGetSuggestionResponse;
|
|
29
|
+
static fromJSON(data: IGetSuggestionResponse): GetSuggestionResponse;
|
|
30
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import AddSuggestionResponse from './responses/addsuggestionresponse';
|
|
5
|
+
import GetSuggestionResponse from './responses/getsuggestionresponse';
|
|
6
|
+
import { IWebSocketGateway } from '../websocketgateway/websocketgateway';
|
|
7
|
+
import { ISuggestion } from './descriptors/suggestiondescriptor';
|
|
8
|
+
export declare const _SERVICE: number;
|
|
9
|
+
interface ISuggestionUpdateProps {
|
|
10
|
+
hasComments?: boolean;
|
|
11
|
+
state?: string;
|
|
12
|
+
attributes?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface IBatchUpdateSuggestionsStateParams {
|
|
15
|
+
ids: string[];
|
|
16
|
+
state: string;
|
|
17
|
+
}
|
|
18
|
+
declare const TrackChangesService_base: {
|
|
19
|
+
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
|
20
|
+
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
|
21
|
+
};
|
|
22
|
+
declare class TrackChangesService extends /* #__PURE__ -- @preserve */ TrackChangesService_base {
|
|
23
|
+
private readonly _documentId;
|
|
24
|
+
private _isConnected;
|
|
25
|
+
private _wsGateway?;
|
|
26
|
+
private _channel?;
|
|
27
|
+
private static readonly _SERVICE;
|
|
28
|
+
constructor(_documentId: string);
|
|
29
|
+
get isConnected(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Connects to WebSocketGateway and starts listening on channel.
|
|
32
|
+
*/
|
|
33
|
+
connect(wsGateway: IWebSocketGateway): Promise<ISuggestion[] | void>;
|
|
34
|
+
/**
|
|
35
|
+
* Disconnects TrackChangesService from CKEditor Cloud Services.
|
|
36
|
+
*/
|
|
37
|
+
disconnect(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Adds suggestion and returns AddSuggestionResponse.
|
|
40
|
+
*/
|
|
41
|
+
add(id: string, type: string, data: Record<string, unknown>, originalSuggestionId?: string | null, attributes?: Record<string, unknown>): Promise<AddSuggestionResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns suggestion with given id.
|
|
44
|
+
*/
|
|
45
|
+
get(id: string, attempt?: number): Promise<GetSuggestionResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns suggestions from given documentId.
|
|
48
|
+
*/
|
|
49
|
+
getAll(): Promise<ISuggestion[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Updates suggestion.
|
|
52
|
+
*/
|
|
53
|
+
update(id: string, props?: ISuggestionUpdateProps): Promise<void>;
|
|
54
|
+
batchUpdateState(params: IBatchUpdateSuggestionsStateParams): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Starts to listen on a given channel.
|
|
57
|
+
*/
|
|
58
|
+
private _connectToChannel;
|
|
59
|
+
/**
|
|
60
|
+
* Processes websocket gateway state changes.
|
|
61
|
+
*/
|
|
62
|
+
private _onWsGatewayStateChange;
|
|
63
|
+
private _sendRequest;
|
|
64
|
+
}
|
|
65
|
+
export default TrackChangesService;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export type TokenChangeValueEventCallback = (event: Record<string, unknown>, name: string, value: ArrayBuffer) => void | Promise<void>;
|
|
5
|
+
export interface IToken {
|
|
6
|
+
value: string | ArrayBuffer;
|
|
7
|
+
refreshToken(): Promise<void> | void;
|
|
8
|
+
on(event: string, handler: TokenChangeValueEventCallback): void;
|
|
9
|
+
off(event: string, handler: TokenChangeValueEventCallback): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Descriptor, { IDescriptorBody } from './../../descriptor';
|
|
5
|
+
export default class UserDescriptor extends Descriptor {
|
|
6
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
7
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetManyUsersMessage extends IMessage {
|
|
7
|
+
ids: string[];
|
|
8
|
+
}
|
|
9
|
+
export default class GetManyUsersMessage extends Message {
|
|
10
|
+
readonly ids: string[];
|
|
11
|
+
static readonly TYPE: string;
|
|
12
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
13
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
14
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
15
|
+
constructor(ids: string[]);
|
|
16
|
+
toJSON(): IGetManyUsersMessage;
|
|
17
|
+
static fromJSON(data: IGetManyUsersMessage): GetManyUsersMessage;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetUserMessage extends IMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
export default class GetUserMessage extends Message {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
static readonly TYPE: string;
|
|
12
|
+
static readonly READABLE_TYPE_NAME: string;
|
|
13
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
14
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
15
|
+
constructor(id: string);
|
|
16
|
+
toJSON(): IGetUserMessage;
|
|
17
|
+
static fromJSON(data: IGetUserMessage): GetUserMessage;
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetManyUsersResponse extends IMessage {
|
|
7
|
+
users: Record<string, unknown>[];
|
|
8
|
+
}
|
|
9
|
+
export default class GetManyUsersResponse extends Message {
|
|
10
|
+
readonly users: Record<string, unknown>[];
|
|
11
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
12
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
13
|
+
constructor(users: Record<string, unknown>[]);
|
|
14
|
+
toJSON(): IGetManyUsersResponse;
|
|
15
|
+
static fromJSON(data: IGetManyUsersResponse): GetManyUsersResponse;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Message, { IMessage } from './../../message';
|
|
5
|
+
import { IDescriptorBody } from '../../descriptor';
|
|
6
|
+
export interface IGetUserResponse extends IMessage {
|
|
7
|
+
attributes: Record<string, string>[];
|
|
8
|
+
}
|
|
9
|
+
export default class GetUserResponse extends Message {
|
|
10
|
+
readonly attributes: Record<string, unknown>;
|
|
11
|
+
static readonly DESCRIPTOR_NAME: string;
|
|
12
|
+
static readonly DESCRIPTOR: IDescriptorBody;
|
|
13
|
+
constructor(attributes: Record<string, unknown>);
|
|
14
|
+
toJSON(): IGetUserResponse;
|
|
15
|
+
static fromJSON(data: IGetUserResponse): GetUserResponse;
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { IWebSocketGateway } from '../websocketgateway/websocketgateway';
|
|
5
|
+
interface IUserData extends Record<string, unknown> {
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Represents User entity.
|
|
10
|
+
*/
|
|
11
|
+
declare class User {
|
|
12
|
+
static readonly _SERVICE: number;
|
|
13
|
+
readonly id?: string;
|
|
14
|
+
private readonly _attributes;
|
|
15
|
+
/**
|
|
16
|
+
* Creates User object. Passed attributes will be set on instance as a read-only attributes.
|
|
17
|
+
* Passing undefined or empty object will create "Anonymous" object.
|
|
18
|
+
*/
|
|
19
|
+
constructor(attributes?: IUserData);
|
|
20
|
+
/**
|
|
21
|
+
* Creates User from data object, ie. from token data.
|
|
22
|
+
*
|
|
23
|
+
* const user = User.fromData( { id: '1234', name: 'Bob' } );
|
|
24
|
+
*
|
|
25
|
+
* // Anonymous user will have no attributes.
|
|
26
|
+
* const anonymous = User.fromData();
|
|
27
|
+
*/
|
|
28
|
+
static fromData(data: IUserData): User;
|
|
29
|
+
/**
|
|
30
|
+
* Returns existing User from server or create a User object.
|
|
31
|
+
*
|
|
32
|
+
* const user = await User.get( wsGateway, '1234' );
|
|
33
|
+
*/
|
|
34
|
+
static get(wsGateway: IWebSocketGateway, id: string): Promise<User>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns existing Users from server or create a User objects.
|
|
37
|
+
*
|
|
38
|
+
* const users = await User.getMany( wsGateway, ['1234', '5678'] );
|
|
39
|
+
*/
|
|
40
|
+
static getMany(wsGateway: IWebSocketGateway, ids: string[]): Promise<User[]>;
|
|
41
|
+
}
|
|
42
|
+
declare interface User extends Record<string, unknown> {
|
|
43
|
+
}
|
|
44
|
+
export default User;
|