@atlaskit/editor-synced-block-provider 8.2.0 → 8.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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/hooks/useFetchSyncBlockData.js +1 -1
- package/dist/cjs/providers/block-service/blockServiceAPI.js +7 -4
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +9 -4
- package/dist/cjs/store-manager/syncBlockBatchFetcher.js +2 -1
- package/dist/cjs/store-manager/syncBlockProviderFactoryManager.js +4 -3
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +11 -4
- package/dist/cjs/utils/errorHandling.js +152 -6
- package/dist/es2019/hooks/useFetchSyncBlockData.js +2 -2
- package/dist/es2019/providers/block-service/blockServiceAPI.js +11 -3
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +10 -5
- package/dist/es2019/store-manager/syncBlockBatchFetcher.js +3 -2
- package/dist/es2019/store-manager/syncBlockProviderFactoryManager.js +5 -4
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +12 -5
- package/dist/es2019/utils/errorHandling.js +167 -22
- package/dist/esm/hooks/useFetchSyncBlockData.js +2 -2
- package/dist/esm/providers/block-service/blockServiceAPI.js +7 -4
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +10 -5
- package/dist/esm/store-manager/syncBlockBatchFetcher.js +3 -2
- package/dist/esm/store-manager/syncBlockProviderFactoryManager.js +5 -4
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +12 -5
- package/dist/esm/utils/errorHandling.js +149 -5
- package/dist/types/providers/types.d.ts +8 -0
- package/dist/types/utils/errorHandling.d.ts +94 -2
- package/package.json +3 -3
|
@@ -38,14 +38,106 @@ export type ErrorAttributionAttributes = {
|
|
|
38
38
|
* helper stays pure and trivially unit-testable for both gate states.
|
|
39
39
|
*/
|
|
40
40
|
export declare const buildErrorAttribution: (gateEnabled: boolean, error?: string, statusCode?: number) => ErrorAttributionAttributes | undefined;
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The set of categorical failure reasons emitted on synced-block fetch/subscribe
|
|
43
|
+
* operational error events (EDITOR-7862). Extends the write-path
|
|
44
|
+
* {@link SyncBlockErrorReason} set with read-path-specific buckets so the analytics
|
|
45
|
+
* dashboard can break fetch failures down by cause instead of regex-matching the
|
|
46
|
+
* free-text `error` blob.
|
|
47
|
+
*
|
|
48
|
+
* The read path surfaces several causes the write-path `SyncBlockError` enum does not
|
|
49
|
+
* model (benign source-state transitions, permission denials, WebSocket lifecycle, and
|
|
50
|
+
* client-side readiness errors), so those are added here. Known `SyncBlockError` enum
|
|
51
|
+
* values (`not_found`, `forbidden`, ...) still pass through unchanged.
|
|
52
|
+
*/
|
|
53
|
+
export type SyncBlockFetchErrorReason = SyncBlockErrorReason | 'source_deleted' | 'source_unpublished' | 'source_unsynced' | 'source_not_found' | 'permission_denied' | 'unauthenticated' | 'websocket_drop' | 'websocket_exhausted' | 'network' | 'data_provider_not_ready';
|
|
54
|
+
/**
|
|
55
|
+
* Fetch reasons that represent benign (working-as-designed) outcomes rather than genuine
|
|
56
|
+
* system failures. The dashboard uses this to compute a "true error rate" by excluding
|
|
57
|
+
* benign reasons via the structured `reason` attribute instead of brittle free-text regex
|
|
58
|
+
* (EDITOR-7862).
|
|
59
|
+
*/
|
|
60
|
+
export declare const FETCH_BENIGN_REASONS: ReadonlySet<SyncBlockFetchErrorReason>;
|
|
61
|
+
/**
|
|
62
|
+
* Maps a fetch/subscribe `error` field — which may be a {@link SyncBlockError} enum
|
|
63
|
+
* value, a {@link DeletionReason} value, or an arbitrary free-text/JSON blob — to a
|
|
64
|
+
* stable categorical {@link SyncBlockFetchErrorReason} for analytics grouping.
|
|
65
|
+
*
|
|
66
|
+
* Resolution order:
|
|
67
|
+
* 1. Known `SyncBlockError` enum value → passed through (via {@link classifyErrorReason}).
|
|
68
|
+
* 2. Known free-text substring → mapped to a fetch-specific bucket.
|
|
69
|
+
* 3. Anything else (including opaque blobs like `errored`-only payloads or
|
|
70
|
+
* `ErrorEvent: "undefined"`) → `'unknown'`, so the dashboard never groups on free text.
|
|
71
|
+
*
|
|
72
|
+
* Note: the bare string `'errored'` IS a `SyncBlockError` enum value and therefore
|
|
73
|
+
* classifies as `'errored'` (not `'unknown'`); only genuinely unrecognised strings
|
|
74
|
+
* collapse to `'unknown'`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const classifyFetchErrorReason: (error?: string) => SyncBlockFetchErrorReason;
|
|
77
|
+
/**
|
|
78
|
+
* Extra, optional analytics attributes describing WHY a fetch/subscribe synced-block
|
|
79
|
+
* action failed. Spread conditionally so we never emit `undefined` keys (EDITOR-7862).
|
|
80
|
+
*
|
|
81
|
+
* Adds `benign` on top of the shared {@link ErrorAttributionAttributes} so the dashboard
|
|
82
|
+
* can compute a true error rate (`genuine / total`) without any free-text regex.
|
|
83
|
+
*/
|
|
84
|
+
export type FetchErrorAttributionAttributes = {
|
|
85
|
+
/**
|
|
86
|
+
* Categorical fetch failure cause for dashboard grouping. Declared standalone (not via
|
|
87
|
+
* `ErrorAttributionAttributes & ...`) because intersecting two `reason?` properties
|
|
88
|
+
* narrows the type to the write-path {@link SyncBlockErrorReason}; we need the wider
|
|
89
|
+
* {@link SyncBlockFetchErrorReason} here (EDITOR-7862).
|
|
90
|
+
*/
|
|
91
|
+
reason?: SyncBlockFetchErrorReason;
|
|
92
|
+
/** Backend HTTP status code when the failure came from a `BlockError`. */
|
|
93
|
+
statusCode?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the reason is a benign/working-as-designed outcome (not a true failure).
|
|
96
|
+
* Required (not optional) so this type structurally discriminates fetch attribution
|
|
97
|
+
* from the write-path {@link ErrorAttributionAttributes}; this lets {@link getErrorPayload}
|
|
98
|
+
* overload-resolve the correct (wider) `reason` type per path. `buildFetchErrorAttribution`
|
|
99
|
+
* always sets it, so requiring it costs nothing.
|
|
100
|
+
*/
|
|
101
|
+
benign: boolean;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Builds the {@link FetchErrorAttributionAttributes} for a failed fetch/subscribe
|
|
105
|
+
* synced-block operation from the raw `error` field and optional backend `statusCode`.
|
|
106
|
+
* Returns `undefined` when the `platform_editor_blocks_patch_3` gate is OFF, so the new
|
|
107
|
+
* `reason`/`statusCode`/`benign` attributes are only emitted once the gate is rolled out
|
|
108
|
+
* (EDITOR-7862). The existing free-text `error` attribute is always left unchanged.
|
|
109
|
+
*
|
|
110
|
+
* `gateEnabled` is injected by the caller (the store managers evaluate `fg(...)`) so this
|
|
111
|
+
* helper stays pure and trivially unit-testable for both gate states.
|
|
112
|
+
*/
|
|
113
|
+
export declare const buildFetchErrorAttribution: (gateEnabled: boolean, error?: string, statusCode?: number) => FetchErrorAttributionAttributes | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Shared operational ERROR payload builder for synced-block events.
|
|
116
|
+
*
|
|
117
|
+
* Overloaded so the emitted `reason` type stays accurate per path (raised in review on
|
|
118
|
+
* EDITOR-7862): fetch/subscribe callers pass a {@link FetchErrorAttributionAttributes}
|
|
119
|
+
* (discriminated by its required `benign` field) and get the wider
|
|
120
|
+
* {@link SyncBlockFetchErrorReason}; write-path callers pass an
|
|
121
|
+
* {@link ErrorAttributionAttributes} (or nothing) and keep the narrower
|
|
122
|
+
* {@link SyncBlockErrorReason}, so write-path payloads never claim to carry fetch-only
|
|
123
|
+
* buckets like `source_deleted` they never emit.
|
|
124
|
+
*/
|
|
125
|
+
export declare function getErrorPayload<T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string, resourceId: string | undefined, sourceProduct: string | undefined, attribution: FetchErrorAttributionAttributes): OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
126
|
+
error: string;
|
|
127
|
+
resourceId?: string;
|
|
128
|
+
sourceProduct?: string;
|
|
129
|
+
reason?: SyncBlockFetchErrorReason;
|
|
130
|
+
statusCode?: number;
|
|
131
|
+
benign?: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
export declare function getErrorPayload<T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes): OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
42
134
|
error: string;
|
|
43
135
|
resourceId?: string;
|
|
44
136
|
sourceProduct?: string;
|
|
45
137
|
reason?: SyncBlockErrorReason;
|
|
46
138
|
statusCode?: number;
|
|
47
139
|
}>;
|
|
48
|
-
export declare const fetchErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
140
|
+
export declare const fetchErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: FetchErrorAttributionAttributes) => RendererSyncBlockEventPayload;
|
|
49
141
|
export declare const getSourceInfoErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
50
142
|
export declare const updateErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => SyncBlockEventPayload;
|
|
51
143
|
export declare const updateReferenceErrorPayload: (error: string, resourceId?: string, sourceProduct?: string, attribution?: ErrorAttributionAttributes) => RendererSyncBlockEventPayload;
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
22
22
|
"@atlaskit/node-data-provider": "^13.0.0",
|
|
23
23
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
24
|
-
"@atlaskit/tmp-editor-statsig": "^114.
|
|
24
|
+
"@atlaskit/tmp-editor-statsig": "^114.4.0",
|
|
25
25
|
"@babel/runtime": "^7.0.0",
|
|
26
26
|
"@compiled/react": "^0.20.0",
|
|
27
27
|
"graphql-ws": "^5.14.2",
|
|
@@ -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.17.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.
|
|
77
|
+
"version": "8.3.0",
|
|
78
78
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
79
79
|
"author": "Atlassian Pty Ltd",
|
|
80
80
|
"license": "Apache-2.0",
|