@atlaskit/collab-provider 9.8.0 → 9.9.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="lodash" />
2
2
  import AnalyticsHelper from '../analytics/analytics-helper';
3
- import { CatchupResponse, ChannelEvent, StepsPayload } from '../types';
3
+ import { CatchupResponse, ReconcileResponse, ChannelEvent, StepsPayload } from '../types';
4
4
  import type { SyncUpErrorFunction, ResolvedEditorState } from '@atlaskit/editor-common/collab';
5
5
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
6
6
  import type { MetadataService } from '../metadata/metadata-service';
@@ -12,6 +12,7 @@ export declare class DocumentService {
12
12
  private participantsService;
13
13
  private analyticsHelper;
14
14
  private fetchCatchup;
15
+ private fetchReconcile;
15
16
  private providerEmitCallback;
16
17
  private broadcast;
17
18
  private getUserId;
@@ -19,6 +20,7 @@ export declare class DocumentService {
19
20
  private metadataService;
20
21
  private failedStepsBeforeCatchupOnPublish;
21
22
  private enableErrorOnFailedDocumentApply;
23
+ private featureFlags;
22
24
  private getState;
23
25
  private onSyncUpError?;
24
26
  private stepQueue;
@@ -31,6 +33,7 @@ export declare class DocumentService {
31
33
  * and to emit their telepointers from steps they add
32
34
  * @param analyticsHelper - Helper for analytics events
33
35
  * @param fetchCatchup - Function to fetch "catchup" data, data required to rebase current steps to the latest version.
36
+ * @param fetchReconcile - Function to call "reconcile" from NCS backend
34
37
  * @param providerEmitCallback - Callback for emitting events to listeners on the provider
35
38
  * @param broadcast - Callback for broadcasting events to other clients
36
39
  * @param getUserId - Callback to fetch the current user's ID
@@ -38,8 +41,11 @@ export declare class DocumentService {
38
41
  * @param metadataService
39
42
  * @param failedStepsBeforeCatchupOnPublish - Control MAX_STEP_REJECTED_ERROR during page publishes.
40
43
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
44
+ * @param featureFlags - Feature flag config
41
45
  */
42
- constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchup: (fromVersion: number) => Promise<CatchupResponse>, providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, getUserId: () => string | undefined, onErrorHandled: (error: InternalError) => void, metadataService: MetadataService, failedStepsBeforeCatchupOnPublish?: number, enableErrorOnFailedDocumentApply?: boolean);
46
+ constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchup: (fromVersion: number) => Promise<CatchupResponse>, fetchReconcile: (currentStateDoc: string) => Promise<ReconcileResponse>, providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, getUserId: () => string | undefined, onErrorHandled: (error: InternalError) => void, metadataService: MetadataService, failedStepsBeforeCatchupOnPublish: number, enableErrorOnFailedDocumentApply: boolean, featureFlags: {
47
+ [key: string]: boolean;
48
+ } | undefined);
43
49
  /**
44
50
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
45
51
  */
@@ -1,6 +1,7 @@
1
1
  export interface NCSFeatureFlags {
2
2
  testFF?: boolean;
3
3
  socketMessageMetricsFF?: boolean;
4
+ enableFallbackToReconcile?: boolean;
4
5
  }
5
6
  export interface WithNCSFeatureFlags {
6
7
  featureFlags?: NCSFeatureFlags;
@@ -179,6 +179,12 @@ export interface CatchupResponse {
179
179
  stepMaps?: any[];
180
180
  metadata?: Metadata;
181
181
  }
182
+ export interface ReconcileResponse {
183
+ document: string;
184
+ version: number;
185
+ ari?: string;
186
+ metadata?: Metadata;
187
+ }
182
188
  export interface CatchupOptions {
183
189
  getCurrentPmVersion: () => number;
184
190
  fetchCatchup: (fromVersion: number) => Promise<CatchupResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "9.8.0",
3
+ "version": "9.9.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@atlaskit/analytics-gas-types": "^5.1.0",
38
38
  "@atlaskit/analytics-listeners": "^8.7.0",
39
- "@atlaskit/editor-common": "^74.35.0",
39
+ "@atlaskit/editor-common": "^74.36.0",
40
40
  "@atlaskit/editor-json-transformer": "^8.10.0",
41
41
  "@atlaskit/editor-prosemirror": "1.0.2",
42
42
  "@atlaskit/prosemirror-collab": "^0.2.0",