@ckeditor/ckeditor-cloud-services-collaboration 54.2.10 → 54.3.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.
@@ -23,3 +23,23 @@ export declare const REVISION_HISTORY_SERVICE_ID: number;
23
23
  * When adding a new channel-based service, add its id here.
24
24
  */
25
25
  export declare const CHANNEL_SERVICES: ReadonlyArray<number>;
26
+ /**
27
+ * Byte 0 of a request envelope that marks it as a batch of requests instead of a request to a single service.
28
+ *
29
+ * The gateway's `servicesMap` must never map this id, on SaaS or on-premises: that would turn every batch
30
+ * into a request to the mapped service. Gateways that do not support batches fail fast on it with
31
+ * `Service not found`, which reaches the client as a generic `500` server error. That `500` is what lets the client
32
+ * fall back to single requests.
33
+ */
34
+ export declare const BATCH_SERVICE_ID: number;
35
+ /**
36
+ * Byte 1 of a batch request envelope: the type of the batch, as byte 1 of a single request is its method.
37
+ *
38
+ * Type 1 is the only one: the parts run in parallel and their responses come back in the order of the requests.
39
+ */
40
+ export declare const BATCH_REQUEST_TYPE: number;
41
+ /**
42
+ * The highest number of requests a single batch request may carry. The gateway rejects a larger batch, so the client
43
+ * sends the requests of a larger batch one by one.
44
+ */
45
+ export declare const BATCH_MAX_PARTS: number;
@@ -2,7 +2,7 @@
2
2
  Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
3
3
  */
4
4
  import AddCommentResponse from './responses/addcommentresponse';
5
- import { type IWebSocketGateway } from './../websocketgateway/websocketgateway';
5
+ import { type IServiceRequest, type IWebSocketGateway } from './../websocketgateway/websocketgateway';
6
6
  import type { IThread } from './descriptors/commentsthreaddescriptor';
7
7
  import type SessionCollection from '../sessions/sessioncollection';
8
8
  import type { IComment } from './descriptors/commentdescriptor';
@@ -42,6 +42,17 @@ declare class CommentsService extends /* #__PURE__ -- @preserve */ CommentsServi
42
42
  * Connects to WebSocketGateway and starts listening on channel.
43
43
  */
44
44
  connect(wsGateway: IWebSocketGateway): Promise<IThread[] | void>;
45
+ /**
46
+ * Prepares the service for connecting and returns its connect request, or `undefined` when it is already connected.
47
+ *
48
+ * @throws {@link CKEditorCloudServicesError}
49
+ * Thrown when the WebSocket Gateway is not connected.
50
+ */
51
+ beforeConnect(wsGateway: IWebSocketGateway): IServiceRequest | undefined;
52
+ /**
53
+ * Applies the response of the connect request: starts listening on the channel and on the gateway state.
54
+ */
55
+ afterConnect(wsGateway: IWebSocketGateway, response: Buffer): IThread[];
45
56
  /**
46
57
  * Disconnects CommentsService from CKEditor Cloud Services.
47
58
  */
package/dist/index.d.ts CHANGED
@@ -41,7 +41,7 @@ export { default as SessionsConnectResponse } from './sessions/responses/session
41
41
  export { default as SocketConnectMessage } from './sessions/messages/socketconnectmessage';
42
42
  export { default as SocketDisconnectMessage } from './sessions/messages/socketdisconnectmessage';
43
43
  export { default as ChannelDisconnectedMessage } from './websocketgateway/messages/channeldisconnectedmessage';
44
- export { CHANNEL_SERVICES } from './channelservices';
44
+ export { CHANNEL_SERVICES, BATCH_SERVICE_ID, BATCH_REQUEST_TYPE, BATCH_MAX_PARTS } from './channelservices';
45
45
  export { default as AddSuggestionMessage } from './track-changes/messages/addsuggestionmessage';
46
46
  export { default as AddSuggestionResponse } from './track-changes/responses/addsuggestionresponse';
47
47
  export { default as GetAllSuggestionsResponse } from './track-changes/responses/getallsuggestionsresponse';
@@ -68,3 +68,5 @@ export * as Parser from './websocketgateway/parser/parser';
68
68
  export { Encoder, Decoder } from './websocketgateway/parser/parser';
69
69
  export { default as PacketParser, type IPacketParserOptions, type Packet } from './websocketgateway/parser/packetparser';
70
70
  export { default as ChannelMessage } from './websocketgateway/messages/channelmessage';
71
+ export { default as BatchRequestMessage } from './websocketgateway/messages/batchrequestmessage';
72
+ export { default as BatchResponseMessage } from './websocketgateway/messages/batchresponsemessage';
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Copyright (c), CKSource Holding sp. z o.o. All rights reserved.
3
3
  */
4
- import { type IWebSocketGateway } from '../websocketgateway/websocketgateway';
4
+ import { type IServiceRequest, type IWebSocketGateway } from '../websocketgateway/websocketgateway';
5
5
  import type { IRevisionObject } from './revision';
6
6
  export declare const _SERVICE: number;
7
7
  interface IRevisionHistoryConnectResponse {
@@ -27,6 +27,17 @@ declare class RevisionHistoryService extends /* #__PURE__ -- @preserve */ Revisi
27
27
  * Thrown in the case of errors on the backend side.
28
28
  */
29
29
  connect(wsGateway: IWebSocketGateway): Promise<IRevisionHistoryConnectResponse | void>;
30
+ /**
31
+ * Prepares the service for connecting and returns its connect request, or `undefined` when it is already connected.
32
+ *
33
+ * @throws {@link CKEditorCloudServicesError}
34
+ * Thrown when the WebSocket Gateway is not connected.
35
+ */
36
+ beforeConnect(wsGateway: IWebSocketGateway): IServiceRequest | undefined;
37
+ /**
38
+ * Applies the response of the connect or reconnect request: starts listening on the channel and on the gateway state.
39
+ */
40
+ afterConnect(wsGateway: IWebSocketGateway, response: Buffer): IRevisionHistoryConnectResponse;
30
41
  /**
31
42
  * Disconnects RevisionHistoryService from CKEditor Cloud Services.
32
43
  *
@@ -59,6 +70,13 @@ declare class RevisionHistoryService extends /* #__PURE__ -- @preserve */ Revisi
59
70
  * Connects or reconnects to WebSocketGateway and starts listening on channel.
60
71
  */
61
72
  private _connect;
73
+ /**
74
+ * Prepares the service for connecting or reconnecting and returns the request.
75
+ *
76
+ * @throws {@link CKEditorCloudServicesError}
77
+ * Thrown when the WebSocket Gateway is not connected.
78
+ */
79
+ private _beforeConnect;
62
80
  /**
63
81
  * Starts to listen on a given channel.
64
82
  */
@@ -9,6 +9,7 @@ export { default as TrackChangesService } from './track-changes/trackchangesserv
9
9
  export { default as CollaborativeEditingService } from './collaborativeeditingservice/collaborativeeditingservice';
10
10
  export { default as CommentsService } from './comments-v2/commentsservice';
11
11
  export { default as CKEditorCloudServicesError } from './ckeditorcloudserviceserror';
12
+ export { default as ServicesConnector, type IConnectableService, type ServicesConnectResults } from './servicesconnector/servicesconnector';
12
13
  export type { IPublicError } from './ckeditorcloudservicesservererror';
13
14
  export type { IComment } from './comments-v2/descriptors/commentdescriptor';
14
15
  export type { ISuggestion } from './track-changes/descriptors/suggestiondescriptor';