@atlaskit/collab-provider 16.0.0 → 16.0.2

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 16.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`224048d036344`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/224048d036344) -
8
+ EDITOR-5683 do not rethrow setMetadataError: Cannot send metadata, currently offline and
9
+ setMetadataError: Cannot send metadata, not initialized yet as they are intermittent connection
10
+ errors
11
+ - Updated dependencies
12
+
13
+ ## 16.0.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 16.0.0
4
20
 
5
21
  ### Patch Changes
@@ -32,6 +32,8 @@ var createLogger = exports.createLogger = function createLogger(prefix) {
32
32
  }
33
33
  );
34
34
  };
35
+
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
37
  function sleep(ms) {
36
38
  return new Promise(function (resolve) {
37
39
  setTimeout(resolve, ms);
@@ -756,6 +756,11 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
756
756
  } catch (error) {
757
757
  var _this$analyticsHelper13;
758
758
  (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while setting metadata');
759
+ // Don't re-throw for transient connectivity/initialization errors.
760
+ // (e.g. socket not yet ready, user momentarily offline)
761
+ if ((error instanceof _customErrors.NotInitializedError || error instanceof _customErrors.NotConnectedError) && (0, _expValEquals.expValEquals)('platform_editor_ignore_metadata_connection_errors', 'isEnabled', true)) {
762
+ return;
763
+ }
759
764
  throw new _customErrors.SetMetadataError('Error while setting metadata', error);
760
765
  }
761
766
  }
@@ -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 = "0.0.0-development";
8
+ var version = exports.version = "16.0.1";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -12,6 +12,8 @@ export const createLogger = (prefix, color = 'blue') =>
12
12
  console.log(`%cCollab-${prefix}: ${msg}`, `color: ${color}; font-weight: bold`, data);
13
13
  }
14
14
  };
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
17
  export function sleep(ms) {
16
18
  return new Promise(resolve => {
17
19
  setTimeout(resolve, ms);
@@ -8,7 +8,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
8
  import { createLogger, logObfuscatedSteps } from '../helpers/utils';
9
9
  import AnalyticsHelper from '../analytics/analytics-helper';
10
10
  import { telepointerCallback } from '../participants/telepointers-helper';
11
- import { CustomError, DestroyError, GetCurrentStateError, GetFinalAcknowledgedStateError, ProviderInitialisationError, SendTransactionError, SetEditorWidthError, SetMetadataError, SetTitleError } from '../errors/custom-errors';
11
+ import { CustomError, DestroyError, GetCurrentStateError, GetFinalAcknowledgedStateError, NotConnectedError, NotInitializedError, ProviderInitialisationError, SendTransactionError, SetEditorWidthError, SetMetadataError, SetTitleError } from '../errors/custom-errors';
12
12
  import { NCS_ERROR_CODE } from '../errors/ncs-errors';
13
13
  import { MetadataService } from '../metadata/metadata-service';
14
14
  import { DocumentService } from '../document/document-service';
@@ -646,6 +646,11 @@ export class Provider extends Emitter {
646
646
  } catch (error) {
647
647
  var _this$analyticsHelper15;
648
648
  (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting metadata');
649
+ // Don't re-throw for transient connectivity/initialization errors.
650
+ // (e.g. socket not yet ready, user momentarily offline)
651
+ if ((error instanceof NotInitializedError || error instanceof NotConnectedError) && expValEquals('platform_editor_ignore_metadata_connection_errors', 'isEnabled', true)) {
652
+ return;
653
+ }
649
654
  throw new SetMetadataError('Error while setting metadata', error);
650
655
  }
651
656
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "0.0.0-development";
2
+ export const version = "16.0.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -22,6 +22,8 @@ export var createLogger = function createLogger(prefix) {
22
22
  }
23
23
  );
24
24
  };
25
+
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
27
  export function sleep(ms) {
26
28
  return new Promise(function (resolve) {
27
29
  setTimeout(resolve, ms);
@@ -21,7 +21,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
21
21
  import { createLogger, logObfuscatedSteps } from '../helpers/utils';
22
22
  import AnalyticsHelper from '../analytics/analytics-helper';
23
23
  import { telepointerCallback } from '../participants/telepointers-helper';
24
- import { CustomError, DestroyError, GetCurrentStateError, GetFinalAcknowledgedStateError, ProviderInitialisationError, SendTransactionError, SetEditorWidthError, SetMetadataError, SetTitleError } from '../errors/custom-errors';
24
+ import { CustomError, DestroyError, GetCurrentStateError, GetFinalAcknowledgedStateError, NotConnectedError, NotInitializedError, ProviderInitialisationError, SendTransactionError, SetEditorWidthError, SetMetadataError, SetTitleError } from '../errors/custom-errors';
25
25
  import { NCS_ERROR_CODE } from '../errors/ncs-errors';
26
26
  import { MetadataService } from '../metadata/metadata-service';
27
27
  import { DocumentService } from '../document/document-service';
@@ -750,6 +750,11 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
750
750
  } catch (error) {
751
751
  var _this$analyticsHelper13;
752
752
  (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while setting metadata');
753
+ // Don't re-throw for transient connectivity/initialization errors.
754
+ // (e.g. socket not yet ready, user momentarily offline)
755
+ if ((error instanceof NotInitializedError || error instanceof NotConnectedError) && expValEquals('platform_editor_ignore_metadata_connection_errors', 'isEnabled', true)) {
756
+ return;
757
+ }
753
758
  throw new SetMetadataError('Error while setting metadata', error);
754
759
  }
755
760
  }
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "0.0.0-development";
2
+ export var version = "16.0.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -11,6 +11,8 @@ import type { InternalError } from '../errors/internal-errors';
11
11
  import { type ParticipantsService } from '../participants/participants-service';
12
12
  import { type DocumentServiceInterface } from './interface-document-service';
13
13
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
14
+ import type { ADFEntity } from '@atlaskit/adf-utils/types';
15
+ import type { DebouncedFunc } from 'lodash';
14
16
  /**
15
17
  *
16
18
  */
@@ -67,7 +69,7 @@ export declare class DocumentService implements DocumentServiceInterface {
67
69
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
68
70
  * @param reason - optional reason to attach.
69
71
  */
70
- throttledCatchupv2: import("lodash").DebouncedFunc<(reason?: CatchupEventReason, reconnectionMetadata?: ReconnectionMetadata, sessionId?: string) => Promise<void>>;
72
+ throttledCatchupv2: DebouncedFunc<(reason?: CatchupEventReason, reconnectionMetadata?: ReconnectionMetadata, sessionId?: string) => Promise<void>>;
71
73
  /**
72
74
  * Called when:
73
75
  * * session established(offline -> online)
@@ -107,7 +109,7 @@ export declare class DocumentService implements DocumentServiceInterface {
107
109
  type: string;
108
110
  contentTypes: string | null;
109
111
  };
110
- stepContent: import("@atlaskit/adf-utils/types").ADFEntity[] | null;
112
+ stepContent: ADFEntity[] | null;
111
113
  stepPositions: {
112
114
  pos?: number | undefined;
113
115
  insert?: number | undefined;
@@ -128,7 +130,7 @@ export declare class DocumentService implements DocumentServiceInterface {
128
130
  unconfirmedStepAfterRecovery?: boolean;
129
131
  } | undefined;
130
132
  }[];
131
- obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null | undefined;
133
+ obfuscatedDoc: string | ADFEntity | null | undefined;
132
134
  };
133
135
  onRestore: ({ doc, version, metadata, targetClientId, }: CollabInitPayload) => Promise<void>;
134
136
  getFinalAcknowledgedState: (reason: GetResolvedEditorStateReason) => Promise<ResolvedEditorState>;
@@ -7,7 +7,7 @@ import { type JSONDocNode } from '@atlaskit/editor-json-transformer';
7
7
  import { type Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
8
8
  import { CustomError } from '../errors/custom-errors';
9
9
  export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
10
- export declare function sleep(ms: number): Promise<unknown>;
10
+ export declare function sleep(ms: number): Promise<any>;
11
11
  export declare const isAIProviderID: (id: string) => boolean;
12
12
  export declare const getProduct: (productInfo?: ProductInformation) => string;
13
13
  export declare const getSubProduct: (productInfo?: ProductInformation) => string;
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { Emitter } from '../emitter';
4
4
  import type { Config } from '../types';
5
- import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload } from '@atlaskit/editor-common/collab';
5
+ import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
6
6
  import { Api } from '../api/api';
7
7
  import { NullApi } from '../api/null-api';
8
8
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
@@ -173,11 +173,11 @@ export declare class Provider extends Emitter<CollabEvents> implements CollabEdi
173
173
  * Used when the provider is disconnected or destroyed to prevent perpetual timers from continuously running
174
174
  */
175
175
  private clearTimers;
176
- getParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
176
+ getParticipants: () => ProviderParticipant[];
177
177
  getUniqueParticipantSize: () => number;
178
- getUniqueParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
179
- getUniqueHydratedParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
180
- getAIProviderParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
178
+ getUniqueParticipants: () => ProviderParticipant[];
179
+ getUniqueHydratedParticipants: () => ProviderParticipant[];
180
+ getAIProviderParticipants: () => ProviderParticipant[];
181
181
  fetchMore: (props?: {
182
182
  fetchSize?: number;
183
183
  }) => Promise<void>;
@@ -11,6 +11,8 @@ import type { InternalError } from '../errors/internal-errors';
11
11
  import { type ParticipantsService } from '../participants/participants-service';
12
12
  import { type DocumentServiceInterface } from './interface-document-service';
13
13
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
14
+ import type { ADFEntity } from '@atlaskit/adf-utils/types';
15
+ import type { DebouncedFunc } from 'lodash';
14
16
  /**
15
17
  *
16
18
  */
@@ -67,7 +69,7 @@ export declare class DocumentService implements DocumentServiceInterface {
67
69
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
68
70
  * @param reason - optional reason to attach.
69
71
  */
70
- throttledCatchupv2: import("lodash").DebouncedFunc<(reason?: CatchupEventReason, reconnectionMetadata?: ReconnectionMetadata, sessionId?: string) => Promise<void>>;
72
+ throttledCatchupv2: DebouncedFunc<(reason?: CatchupEventReason, reconnectionMetadata?: ReconnectionMetadata, sessionId?: string) => Promise<void>>;
71
73
  /**
72
74
  * Called when:
73
75
  * * session established(offline -> online)
@@ -107,7 +109,7 @@ export declare class DocumentService implements DocumentServiceInterface {
107
109
  type: string;
108
110
  contentTypes: string | null;
109
111
  };
110
- stepContent: import("@atlaskit/adf-utils/types").ADFEntity[] | null;
112
+ stepContent: ADFEntity[] | null;
111
113
  stepPositions: {
112
114
  pos?: number | undefined;
113
115
  insert?: number | undefined;
@@ -128,7 +130,7 @@ export declare class DocumentService implements DocumentServiceInterface {
128
130
  unconfirmedStepAfterRecovery?: boolean;
129
131
  } | undefined;
130
132
  }[];
131
- obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null | undefined;
133
+ obfuscatedDoc: string | ADFEntity | null | undefined;
132
134
  };
133
135
  onRestore: ({ doc, version, metadata, targetClientId, }: CollabInitPayload) => Promise<void>;
134
136
  getFinalAcknowledgedState: (reason: GetResolvedEditorStateReason) => Promise<ResolvedEditorState>;
@@ -7,7 +7,7 @@ import { type JSONDocNode } from '@atlaskit/editor-json-transformer';
7
7
  import { type Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
8
8
  import { CustomError } from '../errors/custom-errors';
9
9
  export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
10
- export declare function sleep(ms: number): Promise<unknown>;
10
+ export declare function sleep(ms: number): Promise<any>;
11
11
  export declare const isAIProviderID: (id: string) => boolean;
12
12
  export declare const getProduct: (productInfo?: ProductInformation) => string;
13
13
  export declare const getSubProduct: (productInfo?: ProductInformation) => string;
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { Emitter } from '../emitter';
4
4
  import type { Config } from '../types';
5
- import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload } from '@atlaskit/editor-common/collab';
5
+ import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
6
6
  import { Api } from '../api/api';
7
7
  import { NullApi } from '../api/null-api';
8
8
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
@@ -173,11 +173,11 @@ export declare class Provider extends Emitter<CollabEvents> implements CollabEdi
173
173
  * Used when the provider is disconnected or destroyed to prevent perpetual timers from continuously running
174
174
  */
175
175
  private clearTimers;
176
- getParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
176
+ getParticipants: () => ProviderParticipant[];
177
177
  getUniqueParticipantSize: () => number;
178
- getUniqueParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
179
- getUniqueHydratedParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
180
- getAIProviderParticipants: () => import("@atlaskit/editor-common/collab").ProviderParticipant[];
178
+ getUniqueParticipants: () => ProviderParticipant[];
179
+ getUniqueHydratedParticipants: () => ProviderParticipant[];
180
+ getAIProviderParticipants: () => ProviderParticipant[];
181
181
  fetchMore: (props?: {
182
182
  fetchSize?: number;
183
183
  }) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "16.0.0",
3
+ "version": "16.0.2",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@atlaskit/prosemirror-collab": "^0.22.0",
39
39
  "@atlaskit/react-ufo": "^5.4.0",
40
- "@atlaskit/tmp-editor-statsig": "^35.10.0",
40
+ "@atlaskit/tmp-editor-statsig": "^36.2.0",
41
41
  "@atlaskit/ufo": "^0.4.0",
42
42
  "@atlaskit/util-service-support": "^6.3.0",
43
43
  "@babel/runtime": "^7.0.0",
@@ -73,6 +73,6 @@
73
73
  }
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/editor-common": "^112.0.0"
76
+ "@atlaskit/editor-common": "^112.2.0"
77
77
  }
78
78
  }