@atlaskit/collab-provider 20.0.16 → 20.0.17

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/version-wrapper.js +1 -1
  3. package/dist/es2019/version-wrapper.js +1 -1
  4. package/dist/esm/version-wrapper.js +1 -1
  5. package/package.json +2 -2
  6. package/provider/package.json +1 -8
  7. package/socket-io-provider/package.json +1 -8
  8. package/types/package.json +1 -8
  9. package/version-wrapper/package.json +1 -8
  10. package/dist/types-ts4.5/analytics/analytics-helper.d.ts +0 -15
  11. package/dist/types-ts4.5/analytics/performance.d.ts +0 -16
  12. package/dist/types-ts4.5/analytics/ufo.d.ts +0 -3
  13. package/dist/types-ts4.5/api/api.d.ts +0 -24
  14. package/dist/types-ts4.5/api/null-api.d.ts +0 -5
  15. package/dist/types-ts4.5/channel.d.ts +0 -83
  16. package/dist/types-ts4.5/config.d.ts +0 -35
  17. package/dist/types-ts4.5/connectivity/network.d.ts +0 -17
  18. package/dist/types-ts4.5/connectivity/reconnect-helper.d.ts +0 -8
  19. package/dist/types-ts4.5/connectivity/singleton.d.ts +0 -3
  20. package/dist/types-ts4.5/disconnected-reason-mapper.d.ts +0 -9
  21. package/dist/types-ts4.5/document/catchupv2.d.ts +0 -12
  22. package/dist/types-ts4.5/document/document-service.d.ts +0 -195
  23. package/dist/types-ts4.5/document/getConflictChanges.d.ts +0 -24
  24. package/dist/types-ts4.5/document/interface-document-service.d.ts +0 -37
  25. package/dist/types-ts4.5/document/null-document-service.d.ts +0 -20
  26. package/dist/types-ts4.5/document/step-queue-state.d.ts +0 -16
  27. package/dist/types-ts4.5/emitter.d.ts +0 -19
  28. package/dist/types-ts4.5/entry-points/provider.d.ts +0 -1
  29. package/dist/types-ts4.5/entry-points/socket-io-provider.d.ts +0 -1
  30. package/dist/types-ts4.5/entry-points/types.d.ts +0 -2
  31. package/dist/types-ts4.5/entry-points/version-wrapper.d.ts +0 -1
  32. package/dist/types-ts4.5/errors/custom-errors.d.ts +0 -56
  33. package/dist/types-ts4.5/errors/error-code-mapper.d.ts +0 -3
  34. package/dist/types-ts4.5/errors/internal-errors.d.ts +0 -110
  35. package/dist/types-ts4.5/errors/ncs-errors.d.ts +0 -184
  36. package/dist/types-ts4.5/feature-flags/index.d.ts +0 -9
  37. package/dist/types-ts4.5/feature-flags/types.d.ts +0 -13
  38. package/dist/types-ts4.5/helpers/const.d.ts +0 -324
  39. package/dist/types-ts4.5/helpers/utils.d.ts +0 -72
  40. package/dist/types-ts4.5/index.d.ts +0 -1
  41. package/dist/types-ts4.5/metadata/metadata-service.d.ts +0 -25
  42. package/dist/types-ts4.5/namespace/namespace-service.d.ts +0 -14
  43. package/dist/types-ts4.5/participants/participants-helper.d.ts +0 -35
  44. package/dist/types-ts4.5/participants/participants-service.d.ts +0 -200
  45. package/dist/types-ts4.5/participants/participants-state.d.ts +0 -27
  46. package/dist/types-ts4.5/participants/telepointers-helper.d.ts +0 -4
  47. package/dist/types-ts4.5/provider/commit-step.d.ts +0 -41
  48. package/dist/types-ts4.5/provider/get-offline-steps-length.d.ts +0 -4
  49. package/dist/types-ts4.5/provider/index.d.ts +0 -206
  50. package/dist/types-ts4.5/socket-io-provider.d.ts +0 -6
  51. package/dist/types-ts4.5/types.d.ts +0 -256
  52. package/dist/types-ts4.5/version-wrapper.d.ts +0 -3
@@ -1,27 +0,0 @@
1
- import type { ParticipantsMap } from './participants-helper';
2
- import type { ProviderParticipant } from '@atlaskit/editor-common/collab';
3
- export type ParticipantFilter = {
4
- isHydrated: boolean;
5
- };
6
- export declare class ParticipantsState {
7
- private participants;
8
- constructor(baseParticipants?: ParticipantsMap);
9
- getBySessionId: (sessionId: string) => ProviderParticipant | undefined;
10
- setBySessionId: (sessionId: string, participant: ProviderParticipant) => void;
11
- getParticipants: () => ProviderParticipant[];
12
- getAIProviderParticipants: () => ProviderParticipant[];
13
- /**
14
- * A user may contain multiple sessions, only return the unique users based on aaid.
15
- * If multiple participants with same aaid exist, will return the most recent entry
16
- * @param filter additional filter to narrow down results
17
- * @param filter.isHydrated
18
- */
19
- getUniqueParticipants: ({ isHydrated }: ParticipantFilter) => ProviderParticipant[];
20
- hasMoreParticipantsToHydrate: () => boolean;
21
- removeBySessionId: (sessionId: string) => boolean;
22
- clear: () => void;
23
- doesntHave: (sessionId: string) => boolean;
24
- size: () => number;
25
- getUniqueParticipantSize: () => number;
26
- updateLastActive: (now: number, userIds: string[]) => void;
27
- }
@@ -1,4 +0,0 @@
1
- import type { AcknowledgementPayload } from '../types';
2
- import type { CollabTelepointerPayload, StepJson, ProviderParticipant } from '@atlaskit/editor-common/collab';
3
- export declare const telepointerFromStep: (participants: ProviderParticipant[], step: StepJson) => CollabTelepointerPayload | undefined;
4
- export declare const telepointerCallback: (documentAri: string) => ((response: AcknowledgementPayload) => void);
@@ -1,41 +0,0 @@
1
- import type { ChannelEvent, StepsPayload } from '../types';
2
- import type { CollabEvents } from '@atlaskit/editor-common/collab';
3
- import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
4
- import type AnalyticsHelper from '../analytics/analytics-helper';
5
- import type { InternalError } from '../errors/internal-errors';
6
- import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
7
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
8
- export declare const RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
9
- export declare class CommitStepService {
10
- private broadcast;
11
- private analyticsHelper;
12
- private emit;
13
- private onErrorHandled;
14
- private readyToCommit;
15
- private lastBroadcastRequestAcked;
16
- /**
17
- * @param broadcast - Callback for broadcasting events to other clients
18
- * @param analyticsHelper - Helper for analytics events
19
- * @param emit - Callback for emitting events to listeners on the provider
20
- * @param onErrorHandled - Callback to handle
21
- */
22
- constructor(broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, analyticsHelper: AnalyticsHelper | undefined, emit: (evt: keyof CollabEvents, data: any) => void, onErrorHandled: (error: InternalError) => void);
23
- commitStepQueue({ steps, version, userId, clientId, onStepsAdded, __livePage, hasRecovered, collabMode, reason, lockSteps, stepOrigins, }: {
24
- __livePage: boolean;
25
- clientId: number | string;
26
- collabMode: string;
27
- hasRecovered: boolean;
28
- lockSteps: (stepOrigins?: readonly Transaction[]) => void;
29
- onStepsAdded: (data: StepsPayload) => void;
30
- reason?: GetResolvedEditorStateReason;
31
- stepOrigins: readonly Transaction[];
32
- steps: readonly ProseMirrorStep[];
33
- userId: string;
34
- version: number;
35
- }): void;
36
- private isExpandChangeStep;
37
- private addOfflineMetadata;
38
- private sendSuccessAnalytics;
39
- private sendFailureAnalytics;
40
- getReadyToCommitStatus(): boolean;
41
- }
@@ -1,4 +0,0 @@
1
- import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- export declare function getOfflineStepsLength(steps: readonly ProseMirrorStep[] | undefined, origins: readonly Transaction[] | undefined): number | undefined;
4
- export declare function getOfflineReplaceStepsLength(steps: readonly ProseMirrorStep[] | undefined, origins: readonly Transaction[] | undefined): number | undefined;
@@ -1,206 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
3
- import { Emitter } from '../emitter';
4
- import type { Config } from '../types';
5
- import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, CollabInitPayload, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
6
- import { Api } from '../api/api';
7
- import { NullApi } from '../api/null-api';
8
- import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
9
- export declare const MAX_STEP_REJECTED_ERROR = 15;
10
- export declare const MAX_STEP_REJECTED_ERROR_AGGRESSIVE = 2;
11
- export declare class Provider extends Emitter<CollabEvents> implements CollabEditProvider<CollabEvents> {
12
- api: Api | NullApi;
13
- private channel;
14
- private config;
15
- private analyticsHelper?;
16
- private isChannelInitialized;
17
- private initialDraft?;
18
- private isProviderInitialized;
19
- private isBuffered;
20
- /**
21
- * Cache of the last `init` payload, populated when the document and metadata
22
- * are first applied. Returned by {@link getInitPayload} so that late
23
- * subscribers (e.g. a freshly-attached collab plugin view after editor
24
- * preset reconfigure) can be seeded without waiting for the `init` event
25
- * which is only emitted once per session.
26
- */
27
- private lastInitPayload?;
28
- private permit;
29
- private isBufferingEnabled;
30
- private sessionId?;
31
- private clientId?;
32
- private userId?;
33
- private presenceId?;
34
- private presenceActivity?;
35
- private presenceUpdateTimeout?;
36
- private disconnectedAt?;
37
- private sendStepsTimer?;
38
- private readonly participantsService;
39
- private readonly metadataService;
40
- private readonly documentService;
41
- private readonly namespaceService;
42
- private aiProviderActiveIds;
43
- /**
44
- * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
45
- * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
46
- * @param evt - Event name to emit to subscribers
47
- * @param data - Event data to emit to subscribers
48
- */
49
- private readonly emitCallback;
50
- /**
51
- * Wrapper to update document and metadata.
52
- * Catches and logs any errors thrown by document service's updateDocument and updateMetadata methods and destroys the provider in case of errors.
53
- * Passing the document, metadata, version (either from the initial draft or from collab service)
54
- */
55
- private readonly updateDocumentAndMetadata;
56
- constructor(config: Config);
57
- private initializeChannel;
58
- private setUserId;
59
- private getPresenceData;
60
- private setPresenceActivity;
61
- /**
62
- * Initialisation logic, called by Jira with a dummy getState function, deprecated in favour of the setup method which allows more configuration
63
- * @param {Function} getState Function that returns the editor state, used to retrieve collab-edit properties and to interact with prosemirror-collab
64
- * @throws {ProviderInitialisationError} Something went wrong during provider initialisation
65
- * @deprecated Use setup method instead
66
- */
67
- initialize(getState: () => EditorState): this;
68
- /**
69
- * Initialisation logic, called by the editor in the collab-edit plugin.
70
- *
71
- * @param {Function} options.getState Function that returns the editor state, used to retrieve collab-edit properties and to interact with prosemirror-collab
72
- * @param options.editorApi
73
- * @param {SyncUpErrorFunction} options.onSyncUpError (Optional) Function that gets called when the sync of steps fails after retrying 30 times, used by Editor to log to analytics
74
- * @throws {ProviderInitialisationError} Something went wrong during provider initialisation
75
- */
76
- setup({ getState, editorApi: _editorApi, // eslint says unused vars should start with _
77
- onSyncUpError, }: {
78
- editorApi?: any;
79
- getState?: () => EditorState;
80
- onSyncUpError?: SyncUpErrorFunction;
81
- }): this;
82
- setupForPresenceOnly(clientId: string): this;
83
- private checkForCookies;
84
- /**
85
- * Send steps from transaction to NCS (and as a consequence to other participants), called from the collab-edit plugin in the editor
86
- * @param {Transaction} _tr Deprecated, included to keep API consistent with Synchrony provider
87
- * @param {EditorState} _oldState Deprecated, included to keep API consistent with Synchrony provider
88
- * @param {EditorState} newState The editor state after applying the transaction
89
- * @throws {SendTransactionError} Something went wrong while sending the steps for this transaction
90
- */
91
- send(_tr: Transaction | null, _oldState: EditorState | null, newState: EditorState): void;
92
- /**
93
- * @param {InternalError} error The error to handle
94
- */
95
- private onErrorHandled;
96
- private isViewOnly;
97
- /**
98
- * Send messages, such as telepointers, and AI provider changes to NCS and other participants.
99
- * Only used for telepointer data (text and node selections) in the editor and JWM.
100
- * JWM does some weird serialisation stuff on the node selections.
101
- * Silently fails if an error occurs, since Presence isn't a critical functionality and self-restores over time.
102
- *
103
- * @param {CollabTelepointerPayload} data Data you want to send to NCS / the other participants
104
- * @param {string} data.type Can only be 'telepointer' for now, we don't support anything else yet
105
- * @param {CollabSendableSelection} data.selection Object representing the selected element
106
- * @param {string} data.sessionId Identifier identifying the session
107
- */
108
- sendMessage(data: CollabTelepointerPayload | CollabActivityAIProviderChangedPayload | CollabPresenceActivityChangePayload): void;
109
- setAIProviderActiveIds(ids?: string[]): void;
110
- private getAIProviderActiveIds;
111
- private onDisconnected;
112
- /**
113
- * "Destroy" the provider, disconnect it's connection to the back-end service and unsubscribe all event listeners on the provider.
114
- * Used by Jira products (JWM, JPD) to disable the provider
115
- * @throws {DestroyError} Something went wrong while shutting down the collab provider
116
- */
117
- destroy(): this;
118
- /**
119
- * Disconnect the provider, disconnect it's connection to the back-end service and unsubscribe all event listeners on the provider.
120
- * Used by Confluence to disable the provider when a user doesn't have access to a resource.
121
- * @deprecated use destroy instead, it does the same thing
122
- * @throws {DestroyError} Something went wrong while shutting down the collab provider
123
- */
124
- disconnect(): this;
125
- /**
126
- * Disconnect the provider's connection to the back-end service and unsubscribe from all events emitted by this provider. Kept to keep roughly aligned to Synchrony API, which you need to call for each event.
127
- * @deprecated use destroy instead, it does the same thing
128
- * @throws {DestroyError} Something went wrong while shutting down the collab provider
129
- */
130
- unsubscribeAll(): this;
131
- /**
132
- * Update the title of the document in the collab provider and optionally broadcast it to other participants and NCS
133
- * @deprecated use setMetadata instead, it does the same thing
134
- * @param {string} title Title you want to set on the document
135
- * @param {boolean} broadcast (Optional) Flag indicating whether you want to broadcast the title change to the other participants, always true for now (otherwise we would lose title changes)
136
- * @throws {SetTitleError} Something went wrong while setting the title
137
- */
138
- setTitle(title: string, broadcast?: boolean): void;
139
- /**
140
- * Set editor width, not used any more
141
- * @deprecated use setMetadata instead, it does the same thing
142
- * @param {string} editorWidth string? indicating the editor width
143
- * @param {boolean} broadcast (Optional) Flag indicating whether you want to broadcast the editor width change
144
- * @throws {SetEditorWidthError} Something went wrong while setting the editor width
145
- */
146
- setEditorWidth(editorWidth: string, broadcast?: boolean): void;
147
- /**
148
- * Set the editor width and title and distribute it to all participants. Used by Confluence
149
- * @param {Metadata} metadata The metadata you want to update
150
- * @throws {ExampleError} Something went wrong while setting the metadata
151
- */
152
- setMetadata(metadata: Metadata): void;
153
- /**
154
- * Returns the documents metadata
155
- */
156
- getMetadata: () => Metadata;
157
- /**
158
- * Returns the cached `init` payload if the provider has already initialised
159
- * the document, otherwise `undefined`.
160
- *
161
- * Used by the collab plugin's `view()` factory to seed a freshly-attached
162
- * plugin view (e.g. after editor preset reconfigure or full EditorView
163
- * recreation) with the same `init` data the original subscribers received.
164
- * Without this, late subscribers never receive `init` (it is emitted only
165
- * once per session) and the editor stays in `!isReady`, silently dropping
166
- * doc-changing transactions.
167
- */
168
- getInitPayload: () => CollabInitPayload | undefined;
169
- /**
170
- * Return the ADF version of the current draft document, together with it's title and the current step version.
171
- * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
172
- * @throws {GetCurrentStateError} Something went wrong while returning the current state
173
- */
174
- getCurrentState: () => Promise<ResolvedEditorState>;
175
- /**
176
- * Return the final acknowledged (by NCS) ADF version of the current draft document, together with it's title and the current step version.
177
- * Used when returning the document to Confluence on publish.
178
- * @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
179
- */
180
- getFinalAcknowledgedState: (reason: GetResolvedEditorStateReason) => Promise<ResolvedEditorState>;
181
- /**
182
- * Returns the namespace locking status via true/false
183
- */
184
- getIsNamespaceLocked(): boolean;
185
- getUnconfirmedSteps: () => readonly ProseMirrorStep[] | undefined;
186
- /**
187
- * Provides a synchronous method to retreive the version from the Document Service / Editor State
188
- *
189
- * @returns {number} Returns the current ProseMirror version from the Editor State
190
- */
191
- getCurrentPmVersion: () => number;
192
- /**
193
- * Used when the provider is disconnected or destroyed to prevent perpetual timers from continuously running
194
- */
195
- private clearTimers;
196
- getParticipants: () => ProviderParticipant[];
197
- getUniqueParticipantSize: () => number;
198
- getUniqueParticipants: () => ProviderParticipant[];
199
- getUniqueHydratedParticipants: () => ProviderParticipant[];
200
- getAIProviderParticipants: () => ProviderParticipant[];
201
- fetchMore: (props?: {
202
- fetchSize?: number;
203
- }) => Promise<void>;
204
- getSessionId: () => string | undefined;
205
- getDocumentAri: () => string;
206
- }
@@ -1,6 +0,0 @@
1
- import type { Socket } from 'socket.io-client';
2
- import { Provider } from './provider';
3
- import type { Config, ProductInformation, InitAndAuthData, AuthCallback } from './types';
4
- import type AnalyticsHelper from './analytics/analytics-helper';
5
- export declare function createSocketIOSocket(url: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper, path?: string, documentAri?: string): Socket;
6
- export declare function createSocketIOCollabProvider(config: Omit<Config, 'createSocket'>): Provider;
@@ -1,256 +0,0 @@
1
- import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
2
- import type { AnonymousAsset } from '@atlaskit/anonymous-assets';
3
- import type { Manager, Socket as SocketIOSocket } from 'socket.io-client';
4
- import type { InternalError } from './errors/internal-errors';
5
- import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
6
- import type { BatchProps, GetUserType } from './participants/participants-helper';
7
- import type AnalyticsHelper from './analytics/analytics-helper';
8
- import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, PresenceActivity } from '@atlaskit/editor-common/collab';
9
- import type { CatchupEventReason } from './helpers/const';
10
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
- export interface CollabEventDisconnectedData {
12
- reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
13
- sid: string;
14
- }
15
- export interface Storage {
16
- delete: (key: string) => Promise<void>;
17
- get: (key: string) => Promise<string>;
18
- set: (key: string, value: string) => Promise<void>;
19
- }
20
- export interface InitialDraft {
21
- document: JSONDocNode;
22
- metadata?: Metadata;
23
- version: number;
24
- }
25
- export type FetchAnonymousAsset = (presenceId: string | undefined) => Promise<AnonymousAsset | undefined>;
26
- export interface Config {
27
- /**
28
- * There is expected to be temporary divergence between Live Page editor expand behaviour and the standard expand behaviour.
29
- *
30
- * This is expected to be removed in Q4 as Editor and Live Page teams align on a singular behaviour.
31
- *
32
- * It is only supported for use by Confluence.
33
- *
34
- * @default false
35
- */
36
- __livePage?: boolean;
37
- /**
38
- * @deprecated: Use promise based getAnalyticsWebClient instead
39
- */
40
- analyticsClient?: AnalyticsWebClient;
41
- batchProps?: BatchProps;
42
- createSocket: (url: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper, path?: string, documentAri?: string) => SocketIOSocket;
43
- documentAri: string;
44
- /**
45
- * Enable checking if a document update from collab-provider is being dropped by the editor,
46
- * throwing a non-recoverable error if it's detected.
47
- */
48
- enableErrorOnFailedDocumentApply?: boolean;
49
- /**
50
- * When a page is being published this number can control the number of failed steps until a catchup is triggered.
51
- * The default value is MAX_STEP_REJECTED_ERROR (15).
52
- */
53
- failedStepLimitBeforeCatchupOnPublish?: number;
54
- featureFlags?: {
55
- [key: string]: boolean;
56
- };
57
- fetchAnonymousAsset?: FetchAnonymousAsset;
58
- getAnalyticsWebClient?: Promise<AnalyticsWebClient>;
59
- getUser?: GetUserType;
60
- initialDraft?: InitialDraft;
61
- isBufferingEnabled?: boolean;
62
- isPresenceOnly?: boolean;
63
- lifecycle?: Lifecycle;
64
- need404?: boolean;
65
- /**
66
- * Used for sharded routing, product passes route to collab provider
67
- * Presence traffic e.g. /ncs-presence/{cloudId}/{activationId}/confluence
68
- * Edit traffic e.g. /ncs/{cloudId}/{activationId}/confluence
69
- *
70
- */
71
- path?: string;
72
- /**
73
- * If provided, permissionTokenRefresh is called whenever a new JWT token is required.
74
- */
75
- permissionTokenRefresh?: () => Promise<string | null>;
76
- /**
77
- * Configure the provider to pass along a default activity during presence events. This activity will be used
78
- * to display a user's activity, such as 'viewer' or 'editor'.
79
- *
80
- * This activity can be updated later on by the participants-service.
81
- */
82
- presenceActivity?: PresenceActivity;
83
- /**
84
- * Configure the provider to pass along a persistent presenceId during presence events. This presenceId will be used
85
- * to calculate the colors of the presence avatars as well as the editors telepointers. Since these two features are split across
86
- * multiple websocket connections, the presenceId is used to correlate the two.
87
- */
88
- presenceId?: string;
89
- productInfo?: ProductInformation;
90
- /**
91
- * Configure the client side circuit breaker in the event that abnormal behaviour causes the client to flood
92
- * NCS with too many steps or too large a volume of data. This can result in either a soft fail or a hard (fatal) fail
93
- * depending on the configured rate limit type.
94
- */
95
- rateLimitMaxStepSize?: number;
96
- rateLimitStepCount?: number;
97
- rateLimitTotalStepSize?: number;
98
- rateLimitType?: number;
99
- storage?: Storage;
100
- /**
101
- * Throws errors when trying to send data to collab but the client is not offline.
102
- * This can lead to potential dataloss and retrying should be considered. Without this flag the provider silently drops the requests.
103
- */
104
- throwOnNotConnected?: boolean;
105
- url: string;
106
- }
107
- export interface InitAndAuthData {
108
- initialized: boolean;
109
- need404?: boolean;
110
- token?: string;
111
- }
112
- export type AuthCallback = (cb: (data: InitAndAuthData) => void) => void;
113
- interface SimpleEventEmitter {
114
- on: (event: string, fn: Function) => SimpleEventEmitter;
115
- }
116
- export interface Socket extends SimpleEventEmitter {
117
- close: () => Socket;
118
- connect: () => Socket;
119
- emit: (event: string, ...args: any[]) => Socket;
120
- id: string;
121
- io?: Manager;
122
- }
123
- export type LifecycleEvents = 'save' | 'restore';
124
- export type EventHandler = () => void;
125
- export interface Lifecycle {
126
- on: (event: LifecycleEvents, handler: EventHandler) => void;
127
- }
128
- export type InitPayload = {
129
- doc: any;
130
- metadata?: Metadata;
131
- targetClientId?: string;
132
- userId?: string;
133
- version: number;
134
- };
135
- /**
136
- * @description Incoming payload type from the `broadcast` route in NCS
137
- * @param {number} timestamp added in NCS
138
- * @param {string} sessionId socket.id from NCS
139
- * @param data event specific data from NCS
140
- */
141
- export type BroadcastIncomingPayload = {
142
- data: PresencePayload | TelepointerPayload | StepsPayload | any;
143
- sessionId?: string;
144
- timestamp?: number;
145
- };
146
- export type PresenceData = {
147
- clientId: number | string;
148
- permit?: UserPermitType;
149
- presenceActivity?: PresenceActivity;
150
- presenceId?: string;
151
- sessionId: string;
152
- userId: string | undefined;
153
- };
154
- export type PresencePayload = PresenceData & {
155
- data?: Record<string, any>;
156
- timestamp: number;
157
- };
158
- export type TelepointerPayload = PresencePayload & {
159
- selection: CollabSendableSelection;
160
- };
161
- export declare enum AcknowledgementResponseTypes {
162
- SUCCESS = "SUCCESS",
163
- ERROR = "ERROR"
164
- }
165
- export type AcknowledgementSuccessPayload = {
166
- type: AcknowledgementResponseTypes.SUCCESS;
167
- };
168
- export type AcknowledgementPayload = AcknowledgementSuccessPayload | AcknowledgementErrorPayload;
169
- export type AddStepAcknowledgementSuccessPayload = {
170
- delay?: number;
171
- type: AcknowledgementResponseTypes.SUCCESS;
172
- version: number;
173
- };
174
- export type AcknowledgementErrorPayload = {
175
- delay?: number;
176
- error: InternalError;
177
- type: AcknowledgementResponseTypes.ERROR;
178
- };
179
- export type AddStepAcknowledgementPayload = AddStepAcknowledgementSuccessPayload | AcknowledgementErrorPayload;
180
- export type StepsPayload = {
181
- steps: StepJson[];
182
- version: number;
183
- };
184
- export type NamespaceStatus = {
185
- isLocked: boolean;
186
- timestamp: number;
187
- waitTimeInMs?: number;
188
- };
189
- export type ChannelEvent = {
190
- connected: {
191
- initialized: boolean;
192
- sid: string;
193
- };
194
- disconnect: {
195
- reason: string;
196
- };
197
- error: InternalError;
198
- init: InitPayload;
199
- 'metadata:changed': Metadata;
200
- 'participant:left': PresencePayload;
201
- 'participant:telepointer': TelepointerPayload;
202
- 'participant:updated': PresencePayload;
203
- permission: UserPermitType;
204
- presence: PresencePayload;
205
- 'presence:joined': PresencePayload;
206
- reconnected: null;
207
- restore: InitPayload;
208
- status: NamespaceStatus;
209
- 'steps:added': StepsPayload;
210
- 'steps:commit': StepsPayload & {
211
- collabMode: string;
212
- forcePublish?: boolean;
213
- userId: string;
214
- };
215
- };
216
- export interface Catchupv2Response {
217
- metadata?: Metadata;
218
- steps?: StepJson[];
219
- }
220
- export interface ReconcileResponse {
221
- ari?: string;
222
- document: string;
223
- metadata?: Metadata;
224
- version: number;
225
- }
226
- export type GenerateDiffStepsResponseBody = {
227
- documentAri: string;
228
- generatedSteps: StepJson[];
229
- latestDocument?: string;
230
- message?: string;
231
- userId: string;
232
- };
233
- export interface Catchupv2Options {
234
- analyticsHelper: AnalyticsHelper | undefined;
235
- catchUpOutofSync: boolean;
236
- clientId: number | string | undefined;
237
- fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean, reason?: CatchupEventReason, sessionId?: string) => Promise<Catchupv2Response>;
238
- getCurrentPmVersion: () => number;
239
- getState: (() => EditorState) | undefined;
240
- onCatchupComplete?: (steps: StepJson[]) => void;
241
- onStepsAdded: (data: StepsPayload) => void;
242
- reason?: CatchupEventReason;
243
- sessionId?: string;
244
- updateMetadata: (metadata: Metadata | undefined) => void;
245
- }
246
- export type ReconnectionMetadata = {
247
- disconnectionPeriodSeconds: number | undefined;
248
- offlineReplaceStepsLength: number | undefined;
249
- offlineStepsLength: number | undefined;
250
- unconfirmedStepsLength: number | undefined;
251
- };
252
- export type ProductInformation = {
253
- product: string;
254
- subProduct?: string;
255
- };
256
- export {};
@@ -1,3 +0,0 @@
1
- export declare const name: string;
2
- export declare const version: string;
3
- export declare const nextMajorVersion: () => string;