@atlaskit/editor-synced-block-provider 6.6.12 → 6.7.1
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 +22 -0
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +207 -25
- package/dist/cjs/store-manager/syncBlockBatchFetcher.js +35 -0
- package/dist/cjs/store-manager/syncBlockStoreManager.js +19 -0
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +33 -15
- package/dist/cjs/utils/errorHandling.js +44 -1
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +180 -15
- package/dist/es2019/store-manager/syncBlockBatchFetcher.js +29 -0
- package/dist/es2019/store-manager/syncBlockStoreManager.js +21 -1
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +34 -15
- package/dist/es2019/utils/errorHandling.js +46 -0
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +208 -26
- package/dist/esm/store-manager/syncBlockBatchFetcher.js +35 -0
- package/dist/esm/store-manager/syncBlockStoreManager.js +21 -1
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +34 -15
- package/dist/esm/utils/errorHandling.js +43 -0
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +25 -0
- package/dist/types/store-manager/syncBlockBatchFetcher.d.ts +8 -0
- package/dist/types/store-manager/syncBlockSubscriptionManager.d.ts +4 -0
- package/dist/types/utils/errorHandling.d.ts +15 -0
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +25 -0
- package/dist/types-ts4.5/store-manager/syncBlockBatchFetcher.d.ts +8 -0
- package/dist/types-ts4.5/store-manager/syncBlockSubscriptionManager.d.ts +4 -0
- package/dist/types-ts4.5/utils/errorHandling.d.ts +15 -0
- package/package.json +6 -3
|
@@ -20,6 +20,9 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
20
20
|
private queuedFlushTimeout?;
|
|
21
21
|
private entityNotFoundRetryCount;
|
|
22
22
|
private entityNotFoundRetryTimers;
|
|
23
|
+
private pendingCacheDeletions;
|
|
24
|
+
private cacheDeletionRescheduleCounts;
|
|
25
|
+
private isDestroyed;
|
|
23
26
|
fetchExperience: Experience | undefined;
|
|
24
27
|
private fetchSourceInfoExperience;
|
|
25
28
|
private saveExperience;
|
|
@@ -90,6 +93,28 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
90
93
|
private updateCache;
|
|
91
94
|
getFromCache(resourceId: ResourceId): SyncBlockInstance | undefined;
|
|
92
95
|
private deleteFromCache;
|
|
96
|
+
/**
|
|
97
|
+
* Returns true if the cache entry for `resourceId` is safe to delete:
|
|
98
|
+
* no active subscribers, no in-flight source-info request, and no
|
|
99
|
+
* queued/in-flight batch fetch (gated by `platform_synced_block_patch_14`).
|
|
100
|
+
*/
|
|
101
|
+
private canDeleteCache;
|
|
102
|
+
/**
|
|
103
|
+
* Schedules cache deletion for `resourceId` after the grace period
|
|
104
|
+
* (gated by `platform_synced_block_patch_14`). Called when the last
|
|
105
|
+
* subscriber unsubscribes. Guards are re-checked at fire time; if any
|
|
106
|
+
* are positive the timer is rescheduled up to MAX_RESCHEDULES times.
|
|
107
|
+
*/
|
|
108
|
+
scheduleCacheDeletion(resourceId: ResourceId): void;
|
|
109
|
+
/**
|
|
110
|
+
* Cancels any pending cache deletion timer for `resourceId` and resets the
|
|
111
|
+
* reschedule counter (gated by `platform_synced_block_patch_14`). Called
|
|
112
|
+
* when a new subscriber arrives.
|
|
113
|
+
*/
|
|
114
|
+
cancelPendingCacheDeletion(resourceId: ResourceId): void;
|
|
115
|
+
/** Returns whether a cache deletion timer is pending for `resourceId`. */
|
|
116
|
+
hasPendingCacheDeletion(resourceId: ResourceId): boolean;
|
|
117
|
+
private onCacheDeletionTimerFire;
|
|
93
118
|
/**
|
|
94
119
|
* Schedules a delayed retry for a block that returned EntityNotFound.
|
|
95
120
|
* The block may be in the process of being created by a collaborator —
|
|
@@ -16,9 +16,17 @@ export interface SyncBlockBatchFetcherDeps {
|
|
|
16
16
|
export declare class SyncBlockBatchFetcher {
|
|
17
17
|
private deps;
|
|
18
18
|
private pendingFetchRequests;
|
|
19
|
+
private inFlightFetches;
|
|
20
|
+
private isDestroyed;
|
|
19
21
|
private scheduledBatchFetch;
|
|
20
22
|
constructor(deps: SyncBlockBatchFetcherDeps);
|
|
21
23
|
queueFetch(resourceId: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Returns true if a batched fetch is queued or in flight for `resourceId`.
|
|
26
|
+
* Used by cache deletion guards to prevent deleting while a fetch is
|
|
27
|
+
* about to populate the entry.
|
|
28
|
+
*/
|
|
29
|
+
hasPendingFetch(resourceId: string): boolean;
|
|
22
30
|
cancel(): void;
|
|
23
31
|
clearPending(): void;
|
|
24
32
|
destroy(): void;
|
|
@@ -3,6 +3,8 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { ResourceId, BlockInstanceId } from '../common/types';
|
|
4
4
|
import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, SyncBlockSourceInfo, TitleSubscriptionCallback } from '../providers/types';
|
|
5
5
|
export interface SyncBlockSubscriptionManagerDeps {
|
|
6
|
+
/** Cancels any pending cache deletion timer for `resourceId` (gated). */
|
|
7
|
+
cancelPendingCacheDeletion: (resourceId: ResourceId) => void;
|
|
6
8
|
debouncedBatchedFetchSyncBlocks: (resourceId: string) => void;
|
|
7
9
|
deleteFromCache: (resourceId: ResourceId) => void;
|
|
8
10
|
fetchSyncBlockSourceInfo: (resourceId: ResourceId) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -10,6 +12,8 @@ export interface SyncBlockSubscriptionManagerDeps {
|
|
|
10
12
|
getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
|
|
11
13
|
getFromCache: (resourceId: ResourceId) => SyncBlockInstance | undefined;
|
|
12
14
|
markCacheDirty: () => void;
|
|
15
|
+
/** Schedules guarded cache deletion for `resourceId` after a grace period (gated). */
|
|
16
|
+
scheduleCacheDeletion: (resourceId: ResourceId) => void;
|
|
13
17
|
updateCache: (syncBlockInstance: SyncBlockInstance) => void;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
@@ -13,6 +13,21 @@ export declare const updateReferenceErrorPayload: (error: string, resourceId?: s
|
|
|
13
13
|
export declare const createErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
14
14
|
export declare const deleteErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
15
15
|
export declare const updateCacheErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
16
|
+
/**
|
|
17
|
+
* Payload for `SYNCED_BLOCK_SOURCE_INFO_ORPHANED`. Fired when source-info
|
|
18
|
+
* resolves into a cache that has already been deleted — should be unreachable
|
|
19
|
+
* under `platform_synced_block_patch_14`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const sourceInfoOrphanedPayload: (resourceId?: string, sourceProduct?: string, context?: {
|
|
22
|
+
hasPendingDeletion?: boolean;
|
|
23
|
+
hasSubscribers?: boolean;
|
|
24
|
+
}) => RendererSyncBlockEventPayload;
|
|
25
|
+
/**
|
|
26
|
+
* Payload for `SYNCED_BLOCK_CACHE_DELETION_FORCED`. Fired when the cache
|
|
27
|
+
* deletion timer has been rescheduled `MAX_RESCHEDULE_COUNT` times and we force
|
|
28
|
+
* the deletion to avoid leaking memory. Indicates a stuck in-flight flag.
|
|
29
|
+
*/
|
|
30
|
+
export declare const cacheDeletionForcedPayload: (rescheduleCount: number, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
16
31
|
export declare const fetchReferencesErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
17
32
|
export declare const fetchSuccessPayload: (resourceId: string, blockInstanceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
18
33
|
export declare const createSuccessPayload: (resourceId: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
@@ -20,6 +20,9 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
20
20
|
private queuedFlushTimeout?;
|
|
21
21
|
private entityNotFoundRetryCount;
|
|
22
22
|
private entityNotFoundRetryTimers;
|
|
23
|
+
private pendingCacheDeletions;
|
|
24
|
+
private cacheDeletionRescheduleCounts;
|
|
25
|
+
private isDestroyed;
|
|
23
26
|
fetchExperience: Experience | undefined;
|
|
24
27
|
private fetchSourceInfoExperience;
|
|
25
28
|
private saveExperience;
|
|
@@ -90,6 +93,28 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
90
93
|
private updateCache;
|
|
91
94
|
getFromCache(resourceId: ResourceId): SyncBlockInstance | undefined;
|
|
92
95
|
private deleteFromCache;
|
|
96
|
+
/**
|
|
97
|
+
* Returns true if the cache entry for `resourceId` is safe to delete:
|
|
98
|
+
* no active subscribers, no in-flight source-info request, and no
|
|
99
|
+
* queued/in-flight batch fetch (gated by `platform_synced_block_patch_14`).
|
|
100
|
+
*/
|
|
101
|
+
private canDeleteCache;
|
|
102
|
+
/**
|
|
103
|
+
* Schedules cache deletion for `resourceId` after the grace period
|
|
104
|
+
* (gated by `platform_synced_block_patch_14`). Called when the last
|
|
105
|
+
* subscriber unsubscribes. Guards are re-checked at fire time; if any
|
|
106
|
+
* are positive the timer is rescheduled up to MAX_RESCHEDULES times.
|
|
107
|
+
*/
|
|
108
|
+
scheduleCacheDeletion(resourceId: ResourceId): void;
|
|
109
|
+
/**
|
|
110
|
+
* Cancels any pending cache deletion timer for `resourceId` and resets the
|
|
111
|
+
* reschedule counter (gated by `platform_synced_block_patch_14`). Called
|
|
112
|
+
* when a new subscriber arrives.
|
|
113
|
+
*/
|
|
114
|
+
cancelPendingCacheDeletion(resourceId: ResourceId): void;
|
|
115
|
+
/** Returns whether a cache deletion timer is pending for `resourceId`. */
|
|
116
|
+
hasPendingCacheDeletion(resourceId: ResourceId): boolean;
|
|
117
|
+
private onCacheDeletionTimerFire;
|
|
93
118
|
/**
|
|
94
119
|
* Schedules a delayed retry for a block that returned EntityNotFound.
|
|
95
120
|
* The block may be in the process of being created by a collaborator —
|
|
@@ -16,9 +16,17 @@ export interface SyncBlockBatchFetcherDeps {
|
|
|
16
16
|
export declare class SyncBlockBatchFetcher {
|
|
17
17
|
private deps;
|
|
18
18
|
private pendingFetchRequests;
|
|
19
|
+
private inFlightFetches;
|
|
20
|
+
private isDestroyed;
|
|
19
21
|
private scheduledBatchFetch;
|
|
20
22
|
constructor(deps: SyncBlockBatchFetcherDeps);
|
|
21
23
|
queueFetch(resourceId: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Returns true if a batched fetch is queued or in flight for `resourceId`.
|
|
26
|
+
* Used by cache deletion guards to prevent deleting while a fetch is
|
|
27
|
+
* about to populate the entry.
|
|
28
|
+
*/
|
|
29
|
+
hasPendingFetch(resourceId: string): boolean;
|
|
22
30
|
cancel(): void;
|
|
23
31
|
clearPending(): void;
|
|
24
32
|
destroy(): void;
|
|
@@ -3,6 +3,8 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { ResourceId, BlockInstanceId } from '../common/types';
|
|
4
4
|
import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, SyncBlockSourceInfo, TitleSubscriptionCallback } from '../providers/types';
|
|
5
5
|
export interface SyncBlockSubscriptionManagerDeps {
|
|
6
|
+
/** Cancels any pending cache deletion timer for `resourceId` (gated). */
|
|
7
|
+
cancelPendingCacheDeletion: (resourceId: ResourceId) => void;
|
|
6
8
|
debouncedBatchedFetchSyncBlocks: (resourceId: string) => void;
|
|
7
9
|
deleteFromCache: (resourceId: ResourceId) => void;
|
|
8
10
|
fetchSyncBlockSourceInfo: (resourceId: ResourceId) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -10,6 +12,8 @@ export interface SyncBlockSubscriptionManagerDeps {
|
|
|
10
12
|
getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
|
|
11
13
|
getFromCache: (resourceId: ResourceId) => SyncBlockInstance | undefined;
|
|
12
14
|
markCacheDirty: () => void;
|
|
15
|
+
/** Schedules guarded cache deletion for `resourceId` after a grace period (gated). */
|
|
16
|
+
scheduleCacheDeletion: (resourceId: ResourceId) => void;
|
|
13
17
|
updateCache: (syncBlockInstance: SyncBlockInstance) => void;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
@@ -13,6 +13,21 @@ export declare const updateReferenceErrorPayload: (error: string, resourceId?: s
|
|
|
13
13
|
export declare const createErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
14
14
|
export declare const deleteErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
15
15
|
export declare const updateCacheErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
16
|
+
/**
|
|
17
|
+
* Payload for `SYNCED_BLOCK_SOURCE_INFO_ORPHANED`. Fired when source-info
|
|
18
|
+
* resolves into a cache that has already been deleted — should be unreachable
|
|
19
|
+
* under `platform_synced_block_patch_14`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const sourceInfoOrphanedPayload: (resourceId?: string, sourceProduct?: string, context?: {
|
|
22
|
+
hasPendingDeletion?: boolean;
|
|
23
|
+
hasSubscribers?: boolean;
|
|
24
|
+
}) => RendererSyncBlockEventPayload;
|
|
25
|
+
/**
|
|
26
|
+
* Payload for `SYNCED_BLOCK_CACHE_DELETION_FORCED`. Fired when the cache
|
|
27
|
+
* deletion timer has been rescheduled `MAX_RESCHEDULE_COUNT` times and we force
|
|
28
|
+
* the deletion to avoid leaking memory. Indicates a stuck in-flight flag.
|
|
29
|
+
*/
|
|
30
|
+
export declare const cacheDeletionForcedPayload: (rescheduleCount: number, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
16
31
|
export declare const fetchReferencesErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
17
32
|
export declare const fetchSuccessPayload: (resourceId: string, blockInstanceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
18
33
|
export declare const createSuccessPayload: (resourceId: string, sourceProduct?: string) => SyncBlockEventPayload;
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
30
30
|
"@atlaskit/node-data-provider": "^11.1.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
32
|
+
"@atlaskit/tmp-editor-statsig": "^86.0.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@compiled/react": "^0.20.0",
|
|
35
35
|
"graphql-ws": "^5.14.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"uuid": "^3.1.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@atlaskit/editor-common": "^114.
|
|
41
|
+
"@atlaskit/editor-common": "^114.54.0",
|
|
42
42
|
"react": "^18.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
85
|
-
"version": "6.
|
|
85
|
+
"version": "6.7.1",
|
|
86
86
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
87
87
|
"author": "Atlassian Pty Ltd",
|
|
88
88
|
"license": "Apache-2.0",
|
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
"platform-feature-flags": {
|
|
93
93
|
"platform_synced_block_patch_13": {
|
|
94
94
|
"type": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"platform_synced_block_patch_14": {
|
|
97
|
+
"type": "boolean"
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
}
|