@atlaskit/editor-synced-block-provider 8.1.8 → 8.1.10
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 +19 -0
- package/dist/cjs/providers/block-service/blockServiceAPI.js +16 -8
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +4 -2
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +15 -8
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +46 -11
- package/dist/cjs/utils/errorHandling.js +65 -11
- package/dist/es2019/providers/block-service/blockServiceAPI.js +16 -8
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +5 -3
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +14 -7
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +41 -11
- package/dist/es2019/utils/errorHandling.js +62 -5
- package/dist/esm/providers/block-service/blockServiceAPI.js +16 -8
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +5 -3
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +16 -9
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +46 -11
- package/dist/esm/utils/errorHandling.js +64 -10
- package/dist/types/providers/types.d.ts +18 -0
- package/dist/types/store-manager/syncBlockSubscriptionManager.d.ts +4 -5
- package/dist/types/utils/errorHandling.d.ts +44 -5
- package/package.json +5 -2
|
@@ -25,6 +25,12 @@ export type SyncBlockInstance = {
|
|
|
25
25
|
export type DeleteSyncBlockResult = {
|
|
26
26
|
error?: string;
|
|
27
27
|
resourceId: ResourceId;
|
|
28
|
+
/**
|
|
29
|
+
* HTTP status code from the backend (Block Service) when the failure originated
|
|
30
|
+
* from a `BlockError`. Surfaced so failure analytics can break down delete/update
|
|
31
|
+
* failures by status code (EDITOR-7796). Undefined for non-HTTP failures.
|
|
32
|
+
*/
|
|
33
|
+
statusCode?: number;
|
|
28
34
|
success: boolean;
|
|
29
35
|
};
|
|
30
36
|
/**
|
|
@@ -66,6 +72,12 @@ export type WriteSyncBlockResult = {
|
|
|
66
72
|
error?: string;
|
|
67
73
|
resourceId?: ResourceId;
|
|
68
74
|
status?: SyncBlockStatus;
|
|
75
|
+
/**
|
|
76
|
+
* HTTP status code from the backend (Block Service) when the failure originated
|
|
77
|
+
* from a `BlockError`. Surfaced so failure analytics can break down update
|
|
78
|
+
* failures by status code (EDITOR-7796). Undefined for non-HTTP failures.
|
|
79
|
+
*/
|
|
80
|
+
statusCode?: number;
|
|
69
81
|
};
|
|
70
82
|
export type SourceInfoFetchData = {
|
|
71
83
|
pageARI: string;
|
|
@@ -73,6 +85,12 @@ export type SourceInfoFetchData = {
|
|
|
73
85
|
};
|
|
74
86
|
export type UpdateReferenceSyncBlockResult = {
|
|
75
87
|
error?: string;
|
|
88
|
+
/**
|
|
89
|
+
* HTTP status code from the backend when the failure originated from a `BlockError`.
|
|
90
|
+
* Surfaced so reference-update failure analytics can break down failures by status
|
|
91
|
+
* code (EDITOR-7796). Undefined for non-HTTP failures.
|
|
92
|
+
*/
|
|
93
|
+
statusCode?: number;
|
|
76
94
|
success: boolean;
|
|
77
95
|
};
|
|
78
96
|
export type BlockNodeIdentifiers = {
|
|
@@ -33,8 +33,12 @@ export declare class SyncBlockSubscriptionManager {
|
|
|
33
33
|
private static readonly INITIAL_RETRY_DELAY_MS;
|
|
34
34
|
private static readonly RETRY_BACKOFF_MULTIPLIER;
|
|
35
35
|
private static readonly MAX_RETRY_ATTEMPTS;
|
|
36
|
+
private static readonly MAX_RETRY_ATTEMPTS_HARDENED;
|
|
37
|
+
private static readonly MAX_RETRY_DELAY_MS;
|
|
36
38
|
private retryAttempts;
|
|
37
39
|
private pendingRetries;
|
|
40
|
+
private getMaxRetryAttempts;
|
|
41
|
+
private getReconnectionDelay;
|
|
38
42
|
constructor(deps: SyncBlockSubscriptionManagerDeps);
|
|
39
43
|
/**
|
|
40
44
|
* Returns the subscriptions map. Used by external consumers (e.g. batch fetcher, flush)
|
|
@@ -62,11 +66,6 @@ export declare class SyncBlockSubscriptionManager {
|
|
|
62
66
|
* stale entry and scheduling a reconnection with exponential backoff.
|
|
63
67
|
*/
|
|
64
68
|
private handleSubscriptionTerminated;
|
|
65
|
-
/**
|
|
66
|
-
* Schedules a reconnection attempt with exponential backoff.
|
|
67
|
-
* Delay = INITIAL_RETRY_DELAY_MS * (RETRY_BACKOFF_MULTIPLIER ^ attempts)
|
|
68
|
-
* e.g. 1s, 2s, 4s, 8s, 16s
|
|
69
|
-
*/
|
|
70
69
|
private scheduleReconnection;
|
|
71
70
|
/**
|
|
72
71
|
* Resets the retry counter for a resource. Called when a successful
|
|
@@ -1,17 +1,56 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { RendererSyncBlockEventPayload, OperationalAEP, SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { SyncBlockError } from '../common/types';
|
|
3
4
|
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The set of categorical failure reasons emitted on synced-block operational error
|
|
7
|
+
* events (EDITOR-7796). These let the analytics dashboard break delete/update/create
|
|
8
|
+
* failures down by cause (Block Service / HG / Relay) instead of relying on the
|
|
9
|
+
* free-text `error` blob. Mirrors the {@link SyncBlockError} enum values, plus an
|
|
10
|
+
* `unknown` fallback for unclassifiable errors.
|
|
11
|
+
*/
|
|
12
|
+
export type SyncBlockErrorReason = `${SyncBlockError}` | 'unknown';
|
|
13
|
+
/**
|
|
14
|
+
* Maps a result `error` field (which may be a {@link SyncBlockError} enum value such as
|
|
15
|
+
* `'not_found'`, or an arbitrary stringified blob) to a stable categorical
|
|
16
|
+
* {@link SyncBlockErrorReason} for analytics grouping. Anything that is not a known
|
|
17
|
+
* `SyncBlockError` value collapses to `'unknown'` so the dashboard never has to group on
|
|
18
|
+
* free-text error blobs.
|
|
19
|
+
*/
|
|
20
|
+
export declare const classifyErrorReason: (error?: string) => SyncBlockErrorReason;
|
|
21
|
+
/**
|
|
22
|
+
* Extra, optional analytics attributes describing WHY an operational synced-block
|
|
23
|
+
* action failed. Spread conditionally so we never emit `undefined` keys (EDITOR-7796).
|
|
24
|
+
*/
|
|
25
|
+
export type ErrorAttributionAttributes = {
|
|
26
|
+
/** Categorical failure cause for dashboard grouping. */
|
|
27
|
+
reason?: SyncBlockErrorReason;
|
|
28
|
+
/** Backend HTTP status code when the failure came from a `BlockError`. */
|
|
29
|
+
statusCode?: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Builds the {@link ErrorAttributionAttributes} for a failed synced-block operation from
|
|
33
|
+
* the raw result `error` field and optional backend `statusCode`. Returns `undefined`
|
|
34
|
+
* when the `platform_editor_blocks_patch_3` gate is OFF, so the new `reason`/`statusCode`
|
|
35
|
+
* attributes are only emitted once the gate is rolled out (EDITOR-7796).
|
|
36
|
+
*
|
|
37
|
+
* `gateEnabled` is injected by the caller (the store managers evaluate `fg(...)`) so this
|
|
38
|
+
* helper stays pure and trivially unit-testable for both gate states.
|
|
39
|
+
*/
|
|
40
|
+
export declare const buildErrorAttribution: (gateEnabled: boolean, error?: string, statusCode?: number) => ErrorAttributionAttributes | undefined;
|
|
41
|
+
export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
5
42
|
error: string;
|
|
6
43
|
resourceId?: string;
|
|
7
44
|
sourceProduct?: string;
|
|
45
|
+
reason?: SyncBlockErrorReason;
|
|
46
|
+
statusCode?: number;
|
|
8
47
|
}>;
|
|
9
48
|
export declare const fetchErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
10
49
|
export declare const getSourceInfoErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
11
|
-
export declare const updateErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
12
|
-
export declare const updateReferenceErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
13
|
-
export declare const createErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
14
|
-
export declare const deleteErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
50
|
+
export declare const updateErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => SyncBlockEventPayload;
|
|
51
|
+
export declare const updateReferenceErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => RendererSyncBlockEventPayload;
|
|
52
|
+
export declare const createErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => SyncBlockEventPayload;
|
|
53
|
+
export declare const deleteErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => SyncBlockEventPayload;
|
|
15
54
|
export declare const updateCacheErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
16
55
|
/**
|
|
17
56
|
* Payload for `SYNCED_BLOCK_SOURCE_INFO_ORPHANED`. Fired when source-info
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"uuid": "^3.1.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@atlaskit/editor-common": "^116.
|
|
33
|
+
"@atlaskit/editor-common": "^116.14.0",
|
|
34
34
|
"react": "^18.2.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
77
|
-
"version": "8.1.
|
|
77
|
+
"version": "8.1.10",
|
|
78
78
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
79
79
|
"author": "Atlassian Pty Ltd",
|
|
80
80
|
"license": "Apache-2.0",
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"platform_editor_blocks_patch_2": {
|
|
86
86
|
"type": "boolean"
|
|
87
87
|
},
|
|
88
|
+
"platform_editor_blocks_patch_3": {
|
|
89
|
+
"type": "boolean"
|
|
90
|
+
},
|
|
88
91
|
"platform_synced_block_patch_13": {
|
|
89
92
|
"type": "boolean"
|
|
90
93
|
},
|