@atlaskit/editor-synced-block-provider 7.0.14 → 8.0.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 +32 -0
- package/blockService/ari/package.json +1 -8
- package/blockService/package.json +1 -8
- package/blockSubscription/package.json +1 -8
- package/clients/confluence/ari/package.json +1 -8
- package/common/types/package.json +1 -8
- package/errorHandling/package.json +1 -8
- package/fetchJiraMediaToken/package.json +1 -8
- package/fetchMediaToken/package.json +1 -8
- package/jira/ari/package.json +1 -8
- package/package.json +8 -16
- package/providers/block-service/blockServiceAPI/package.json +1 -8
- package/providers/types/package.json +1 -8
- package/rebaseTransaction/package.json +1 -8
- package/referenceSyncBlockStoreManager/package.json +1 -8
- package/requestJiraIssueAccess/package.json +1 -8
- package/resolveSyncBlockInstance/package.json +1 -8
- package/sourceInfo/package.json +1 -8
- package/syncBlockInMemorySessionCache/package.json +1 -8
- package/syncBlockProvider/package.json +1 -8
- package/syncBlockStoreManager/package.json +1 -8
- package/tokenRouting/package.json +1 -8
- package/types/package.json +1 -8
- package/useFetchSyncBlockData/package.json +1 -8
- package/useFetchSyncBlockTitle/package.json +1 -8
- package/useHandleContentChanges/package.json +1 -8
- package/utils/package.json +1 -8
- package/utils/resourceId/package.json +1 -8
- package/validValue/package.json +1 -8
- package/dist/types-ts4.5/clients/block-service/ari.d.ts +0 -34
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +0 -187
- package/dist/types-ts4.5/clients/block-service/blockSubscription.d.ts +0 -52
- package/dist/types-ts4.5/clients/confluence/ari.d.ts +0 -27
- package/dist/types-ts4.5/clients/confluence/fetchMediaToken.d.ts +0 -10
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +0 -2
- package/dist/types-ts4.5/clients/confluence/utils.d.ts +0 -2
- package/dist/types-ts4.5/clients/jira/ari.d.ts +0 -18
- package/dist/types-ts4.5/clients/jira/fetchMediaToken.d.ts +0 -9
- package/dist/types-ts4.5/clients/jira/requestJiraIssueAccess.d.ts +0 -13
- package/dist/types-ts4.5/clients/jira/sourceInfo.d.ts +0 -22
- package/dist/types-ts4.5/clients/tokenRouting.d.ts +0 -11
- package/dist/types-ts4.5/common/consts.d.ts +0 -4
- package/dist/types-ts4.5/common/rebase-transaction.d.ts +0 -11
- package/dist/types-ts4.5/common/types.d.ts +0 -82
- package/dist/types-ts4.5/entry-points/blockService-ari.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/blockService.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/blockServiceAPI.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/blockSubscription.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/common-types.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/confluence-ari.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/errorHandling.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/fetchJiraMediaToken.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/fetchMediaToken.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/jira-ari.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/providers-types.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/rebaseTransaction.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/referenceSyncBlockStoreManager.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/requestJiraIssueAccess.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/resolveSyncBlockInstance.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/resourceId.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/sourceInfo.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/syncBlockInMemorySessionCache.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/syncBlockProvider.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/syncBlockStoreManager.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/tokenRouting.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/useFetchSyncBlockData.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/useFetchSyncBlockTitle.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/useHandleContentChanges.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/utils.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/validValue.d.ts +0 -1
- package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +0 -16
- package/dist/types-ts4.5/hooks/useFetchSyncBlockTitle.d.ts +0 -3
- package/dist/types-ts4.5/hooks/useHandleContentChanges.d.ts +0 -3
- package/dist/types-ts4.5/index.d.ts +0 -25
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +0 -127
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +0 -110
- package/dist/types-ts4.5/providers/types.d.ts +0 -185
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +0 -147
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +0 -128
- package/dist/types-ts4.5/store-manager/syncBlockBatchFetcher.d.ts +0 -33
- package/dist/types-ts4.5/store-manager/syncBlockInMemorySessionCache.d.ts +0 -41
- package/dist/types-ts4.5/store-manager/syncBlockProviderFactoryManager.d.ts +0 -26
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +0 -24
- package/dist/types-ts4.5/store-manager/syncBlockSubscriptionManager.d.ts +0 -84
- package/dist/types-ts4.5/utils/errorHandling.d.ts +0 -36
- package/dist/types-ts4.5/utils/experienceTracking.d.ts +0 -59
- package/dist/types-ts4.5/utils/resolveSyncBlockInstance.d.ts +0 -13
- package/dist/types-ts4.5/utils/resourceId.d.ts +0 -7
- package/dist/types-ts4.5/utils/retry.d.ts +0 -1
- package/dist/types-ts4.5/utils/utils.d.ts +0 -15
- package/dist/types-ts4.5/utils/validValue.d.ts +0 -3
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { ResourceId, SyncBlockAttrs, BlockInstanceId, DeletionReason, ReferenceSyncBlockData } from '../common/types';
|
|
5
|
-
import type { SyncBlockDataProviderInterface, SyncBlockSourceInfo } from '../providers/types';
|
|
6
|
-
export type ConfirmationCallback = (syncBlockIds: SyncBlockAttrs[], deleteReason: DeletionReason | undefined) => Promise<boolean>;
|
|
7
|
-
type OnDelete = () => void;
|
|
8
|
-
type OnCompletion = (success: boolean) => void;
|
|
9
|
-
type DestroyCallback = () => void;
|
|
10
|
-
export declare class SourceSyncBlockStoreManager {
|
|
11
|
-
private viewMode?;
|
|
12
|
-
private isLivePage?;
|
|
13
|
-
private dataProvider?;
|
|
14
|
-
private fireAnalyticsEvent?;
|
|
15
|
-
private syncBlockCache;
|
|
16
|
-
private hasReceivedContentChange;
|
|
17
|
-
private confirmationCallback?;
|
|
18
|
-
private deletionRetryInfo?;
|
|
19
|
-
private creationCompletionCallbacks;
|
|
20
|
-
private flushCompletionCallback?;
|
|
21
|
-
private postCreationFlushCallback?;
|
|
22
|
-
/**
|
|
23
|
-
* Promises for in-flight block creations, keyed by resourceId.
|
|
24
|
-
* `flush()` awaits these so that blocks created from existing content are
|
|
25
|
-
* persisted even if no further edits trigger a subsequent flush.
|
|
26
|
-
* See EDITOR-7112.
|
|
27
|
-
*/
|
|
28
|
-
private pendingCreationPromises;
|
|
29
|
-
/**
|
|
30
|
-
* Set of resource IDs whose creation was still in-flight when a `flush()`
|
|
31
|
-
* timed out. Each completion (success or failure) is removed from this set;
|
|
32
|
-
* the first successful completion of any of these IDs triggers
|
|
33
|
-
* `postCreationFlushCallback` so the content is eventually persisted.
|
|
34
|
-
* Tracking IDs (not just a boolean) avoids dropping late completions when
|
|
35
|
-
* multiple blocks are created concurrently. See EDITOR-7112.
|
|
36
|
-
*/
|
|
37
|
-
private creationsTimedOutDuringFlush;
|
|
38
|
-
private createExperience;
|
|
39
|
-
private saveExperience;
|
|
40
|
-
private deleteExperience;
|
|
41
|
-
private fetchSourceInfoExperience;
|
|
42
|
-
constructor(dataProvider?: SyncBlockDataProviderInterface, viewMode?: ViewMode, isLivePage?: boolean);
|
|
43
|
-
/**
|
|
44
|
-
* Register a callback to be invoked after flush() completes.
|
|
45
|
-
* Used by the pm-plugin to dispatch a transaction so that
|
|
46
|
-
* hasUnsavedBodiedSyncBlockChanges is recalculated in plugin state.
|
|
47
|
-
*/
|
|
48
|
-
registerFlushCompletionCallback(callback: () => void): void;
|
|
49
|
-
/**
|
|
50
|
-
* Register a callback to be invoked when flush() timed out waiting for a
|
|
51
|
-
* pending block creation and that creation subsequently completes. The
|
|
52
|
-
* callback should trigger a deferred flush to persist the content that
|
|
53
|
-
* was skipped due to the timeout. See EDITOR-7112.
|
|
54
|
-
*/
|
|
55
|
-
registerPostCreationFlushCallback(callback: () => void): void;
|
|
56
|
-
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
|
|
57
|
-
isSourceBlock(node: PMNode): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Add/update a sync block node to/from the local cache
|
|
60
|
-
* @param syncBlockNode - The sync block node to update
|
|
61
|
-
*/
|
|
62
|
-
updateSyncBlockData(syncBlockNode: PMNode, isRemote: boolean): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Save content of bodiedSyncBlock nodes in local cache to backend
|
|
65
|
-
*
|
|
66
|
-
* @returns true if saving all nodes successfully, false if fail to save some/all nodes
|
|
67
|
-
*/
|
|
68
|
-
flush(): Promise<boolean>;
|
|
69
|
-
hasUnsavedChanges(): boolean;
|
|
70
|
-
isPendingCreation(resourceId: ResourceId): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Returns `true` when at least one sync block is waiting for its backend
|
|
73
|
-
* creation call to complete. Used as a cheap pre-check in the decoration
|
|
74
|
-
* rebuild path to avoid a full `doc.descendants()` walk when no creations
|
|
75
|
-
* are in flight (see EDITOR-6930).
|
|
76
|
-
*/
|
|
77
|
-
hasPendingCreations(): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Fires callback to insert node (if creation is successful) and clears pending creation data
|
|
80
|
-
* @param success
|
|
81
|
-
*/
|
|
82
|
-
commitPendingCreation(success: boolean, resourceId: ResourceId): void;
|
|
83
|
-
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
84
|
-
requireConfirmationBeforeDelete(): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* @returns attributes for a new bodiedSyncBlock node
|
|
87
|
-
*/
|
|
88
|
-
generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
|
|
89
|
-
/**
|
|
90
|
-
* Create a bodiedSyncBlock node with empty content to backend
|
|
91
|
-
* @param attrs attributes Ids of the node
|
|
92
|
-
* @param node the ProseMirror node to cache
|
|
93
|
-
* @param onCompletion callback invoked when creation completes
|
|
94
|
-
*/
|
|
95
|
-
createBodiedSyncBlockNode(attrs: SyncBlockAttrs, node: PMNode, onCompletion: OnCompletion): void;
|
|
96
|
-
private setPendingDeletion;
|
|
97
|
-
private delete;
|
|
98
|
-
isRetryingDeletion(): boolean;
|
|
99
|
-
retryDeletion(): Promise<void>;
|
|
100
|
-
clearPendingDeletion(): void;
|
|
101
|
-
/**
|
|
102
|
-
* Fetches the current status of all source sync blocks in the cache from the backend
|
|
103
|
-
* and updates the cache entries with the fetched status.
|
|
104
|
-
* This is called on editor init so we know which blocks are 'unpublished' vs 'active'.
|
|
105
|
-
*/
|
|
106
|
-
fetchAndCacheStatuses(): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Deletes all source sync blocks that have 'unpublished' status.
|
|
109
|
-
* Used to clean up orphaned blocks when a user cancels editing without saving.
|
|
110
|
-
* Blocks that were already saved (status 'active') are not affected.
|
|
111
|
-
*
|
|
112
|
-
* @returns true if all deletions succeeded, false otherwise
|
|
113
|
-
*/
|
|
114
|
-
discardUnpublishedBlocks(): Promise<boolean>;
|
|
115
|
-
/**
|
|
116
|
-
* Deletes sync blocks with confirmation from the backend
|
|
117
|
-
*
|
|
118
|
-
* @param syncBlockIds - The sync block ids to delete
|
|
119
|
-
* @param onDelete - The callback to delete sync block node from document
|
|
120
|
-
* @param onDeleteCompleted - The callback for after the deletion is saved to BE (whether successful or not)
|
|
121
|
-
* @param destroyCallback - The callback to clear any reference stored for deletion (regardless if deletion is completed or abort)
|
|
122
|
-
*/
|
|
123
|
-
deleteSyncBlocksWithConfirmation(syncBlockIds: SyncBlockAttrs[], deletionReason: DeletionReason, onDelete: OnDelete, onDeleteCompleted: OnCompletion, destroyCallback: DestroyCallback): Promise<void>;
|
|
124
|
-
getSyncBlockSourceInfo(localId: BlockInstanceId): Promise<SyncBlockSourceInfo | undefined>;
|
|
125
|
-
fetchReferences(resourceId: string): Promise<ReferenceSyncBlockData>;
|
|
126
|
-
destroy(): void;
|
|
127
|
-
}
|
|
128
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { ResourceId, BlockInstanceId, SyncBlockNode } from '../common/types';
|
|
3
|
-
import type { SubscriptionCallback } from '../providers/types';
|
|
4
|
-
export interface SyncBlockBatchFetcherDeps {
|
|
5
|
-
fetchSyncBlocksData: (nodes: SyncBlockNode[]) => Promise<void>;
|
|
6
|
-
getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
|
|
7
|
-
getSubscriptions: () => Map<ResourceId, {
|
|
8
|
-
[localId: BlockInstanceId]: SubscriptionCallback;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Handles debounced batch-fetching of sync block data via `raf-schd`.
|
|
13
|
-
* Accumulates resource IDs and flushes them in a single fetch per
|
|
14
|
-
* animation frame.
|
|
15
|
-
*/
|
|
16
|
-
export declare class SyncBlockBatchFetcher {
|
|
17
|
-
private deps;
|
|
18
|
-
private pendingFetchRequests;
|
|
19
|
-
private inFlightFetches;
|
|
20
|
-
private isDestroyed;
|
|
21
|
-
private scheduledBatchFetch;
|
|
22
|
-
constructor(deps: SyncBlockBatchFetcherDeps);
|
|
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;
|
|
30
|
-
cancel(): void;
|
|
31
|
-
clearPending(): void;
|
|
32
|
-
destroy(): void;
|
|
33
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory session cache for sync block data with size-based LRU eviction.
|
|
3
|
-
*
|
|
4
|
-
* Backed by a plain Map so that potentially private ADF content is never
|
|
5
|
-
* written to any browser-persistent storage (sessionStorage, localStorage,
|
|
6
|
-
* IndexedDB). The module-level singleton survives SPA transitions (no full
|
|
7
|
-
* page reload) and is naturally cleared on hard navigation or tab close.
|
|
8
|
-
*
|
|
9
|
-
* Uses JavaScript Map's insertion-order guarantee to implement LRU:
|
|
10
|
-
* on every read or write the accessed entry is moved to the end of the
|
|
11
|
-
* iteration order; when total cached size exceeds `maxSize`, the oldest
|
|
12
|
-
* (least-recently-used) entries are evicted first.
|
|
13
|
-
*/
|
|
14
|
-
export declare class SyncBlockInMemorySessionCache {
|
|
15
|
-
private store;
|
|
16
|
-
private currentSize;
|
|
17
|
-
/**
|
|
18
|
-
* Maximum total size of all cached values, measured in **UTF-16 code
|
|
19
|
-
* units** (i.e. `String.prototype.length`), not bytes. For ASCII-only
|
|
20
|
-
* content the two are equivalent; for content with characters outside
|
|
21
|
-
* the BMP each surrogate pair counts as 2.
|
|
22
|
-
*/
|
|
23
|
-
private maxSize;
|
|
24
|
-
constructor(maxSize?: number);
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves a cached value by key.
|
|
27
|
-
*
|
|
28
|
-
* **Side-effect:** promotes the entry to the most-recently-used
|
|
29
|
-
* position by re-inserting it at the end of the underlying Map's
|
|
30
|
-
* iteration order.
|
|
31
|
-
*/
|
|
32
|
-
getItem(key: string): string | null;
|
|
33
|
-
setItem(key: string, value: string): void;
|
|
34
|
-
removeItem(key: string): void;
|
|
35
|
-
/**
|
|
36
|
-
* Removes all entries from the cache and resets the tracked size to zero.
|
|
37
|
-
* Useful for cleaning up the singleton on SPA navigation boundaries.
|
|
38
|
-
*/
|
|
39
|
-
clear(): void;
|
|
40
|
-
}
|
|
41
|
-
export declare const syncBlockInMemorySessionCache: SyncBlockInMemorySessionCache;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
-
import type { ResourceId } from '../common/types';
|
|
5
|
-
import type { SyncBlockInstance, SyncBlockDataProviderInterface } from '../providers/types';
|
|
6
|
-
export interface SyncBlockProviderFactoryManagerDeps {
|
|
7
|
-
getDataProvider: () => SyncBlockDataProviderInterface | undefined;
|
|
8
|
-
getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
|
|
9
|
-
getFromCache: (resourceId: ResourceId) => SyncBlockInstance | undefined;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Manages creation and caching of ProviderFactory instances used to
|
|
13
|
-
* render synced block content (media, emoji, smart links, etc.).
|
|
14
|
-
*/
|
|
15
|
-
export declare class SyncBlockProviderFactoryManager {
|
|
16
|
-
private deps;
|
|
17
|
-
private providerFactories;
|
|
18
|
-
constructor(deps: SyncBlockProviderFactoryManagerDeps);
|
|
19
|
-
getProviderFactory(resourceId: ResourceId): ProviderFactory | undefined;
|
|
20
|
-
getSSRProviders(resourceId: ResourceId): {
|
|
21
|
-
media: MediaProvider;
|
|
22
|
-
} | null;
|
|
23
|
-
deleteFactory(resourceId: ResourceId): void;
|
|
24
|
-
destroy(): void;
|
|
25
|
-
private retrieveDynamicProviders;
|
|
26
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { BlockInstanceId, ReferencesSourceInfo, ResourceId } from '../common/types';
|
|
5
|
-
import type { SyncBlockDataProviderInterface } from '../providers/types';
|
|
6
|
-
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
7
|
-
import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
|
|
8
|
-
export declare class SyncBlockStoreManager {
|
|
9
|
-
private referenceSyncBlockStoreManager;
|
|
10
|
-
private sourceSyncBlockStoreManager;
|
|
11
|
-
private dataProvider?;
|
|
12
|
-
private fireAnalyticsEvent?;
|
|
13
|
-
private fetchReferencesExperience;
|
|
14
|
-
private fetchSourceInfoExperience;
|
|
15
|
-
constructor(dataProvider?: SyncBlockDataProviderInterface, viewMode?: ViewMode, isLivePage?: boolean);
|
|
16
|
-
isSyncBlock(node: PMNode): boolean;
|
|
17
|
-
fetchReferencesSourceInfo(resourceId: ResourceId, blockInstanceId: BlockInstanceId, isSourceSyncBlock: boolean): Promise<ReferencesSourceInfo>;
|
|
18
|
-
setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
|
|
19
|
-
get referenceManager(): ReferenceSyncBlockStoreManager;
|
|
20
|
-
get sourceManager(): SourceSyncBlockStoreManager;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
private getUnregisteredReferences;
|
|
23
|
-
}
|
|
24
|
-
export declare const useMemoizedSyncBlockStoreManager: (dataProvider?: SyncBlockDataProviderInterface, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => SyncBlockStoreManager;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { ResourceId, BlockInstanceId } from '../common/types';
|
|
4
|
-
import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, SyncBlockSourceInfo, TitleSubscriptionCallback } from '../providers/types';
|
|
5
|
-
export interface SyncBlockSubscriptionManagerDeps {
|
|
6
|
-
/** Cancels any pending cache deletion timer for `resourceId` (gated). */
|
|
7
|
-
cancelPendingCacheDeletion: (resourceId: ResourceId) => void;
|
|
8
|
-
debouncedBatchedFetchSyncBlocks: (resourceId: string) => void;
|
|
9
|
-
deleteFromCache: (resourceId: ResourceId) => void;
|
|
10
|
-
fetchSyncBlockSourceInfo: (resourceId: ResourceId) => Promise<SyncBlockSourceInfo | undefined>;
|
|
11
|
-
getDataProvider: () => SyncBlockDataProviderInterface | undefined;
|
|
12
|
-
getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
|
|
13
|
-
getFromCache: (resourceId: ResourceId) => SyncBlockInstance | undefined;
|
|
14
|
-
markCacheDirty: () => void;
|
|
15
|
-
/** Schedules guarded cache deletion for `resourceId` after a grace period (gated). */
|
|
16
|
-
scheduleCacheDeletion: (resourceId: ResourceId) => void;
|
|
17
|
-
updateCache: (syncBlockInstance: SyncBlockInstance) => void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Manages the lifecycle of GraphQL WebSocket subscriptions for sync block
|
|
21
|
-
* real-time updates, owns the subscriptions and titleSubscriptions maps,
|
|
22
|
-
* and provides a listener API so React components can react when the set
|
|
23
|
-
* of subscribed resource IDs changes.
|
|
24
|
-
*/
|
|
25
|
-
export declare class SyncBlockSubscriptionManager {
|
|
26
|
-
private deps;
|
|
27
|
-
private subscriptions;
|
|
28
|
-
private titleSubscriptions;
|
|
29
|
-
private graphqlSubscriptions;
|
|
30
|
-
private subscriptionChangeListeners;
|
|
31
|
-
private useRealTimeSubscriptions;
|
|
32
|
-
private pendingCacheDeletions;
|
|
33
|
-
private static readonly INITIAL_RETRY_DELAY_MS;
|
|
34
|
-
private static readonly RETRY_BACKOFF_MULTIPLIER;
|
|
35
|
-
private static readonly MAX_RETRY_ATTEMPTS;
|
|
36
|
-
private retryAttempts;
|
|
37
|
-
private pendingRetries;
|
|
38
|
-
constructor(deps: SyncBlockSubscriptionManagerDeps);
|
|
39
|
-
/**
|
|
40
|
-
* Returns the subscriptions map. Used by external consumers (e.g. batch fetcher, flush)
|
|
41
|
-
* that need to read the current subscription state.
|
|
42
|
-
*/
|
|
43
|
-
getSubscriptions(): Map<ResourceId, {
|
|
44
|
-
[localId: BlockInstanceId]: SubscriptionCallback;
|
|
45
|
-
}>;
|
|
46
|
-
setRealTimeSubscriptionsEnabled(enabled: boolean): void;
|
|
47
|
-
isRealTimeSubscriptionsEnabled(): boolean;
|
|
48
|
-
getSubscribedResourceIds(): ResourceId[];
|
|
49
|
-
onSubscriptionsChanged(listener: () => void): () => void;
|
|
50
|
-
notifySubscriptionChangeListeners(): void;
|
|
51
|
-
handleSubscriptionUpdate(syncBlockInstance: SyncBlockInstance): void;
|
|
52
|
-
subscribeToSyncBlock(resourceId: string, localId: string, callback: SubscriptionCallback): () => void;
|
|
53
|
-
subscribeToSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
|
|
54
|
-
updateSourceTitleSubscriptions(resourceId: string, title: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Notifies all subscription callbacks for a given resource ID with the provided sync block instance.
|
|
57
|
-
*/
|
|
58
|
-
notifySubscriptionCallbacks(resourceId: ResourceId, syncBlock: SyncBlockInstance): void;
|
|
59
|
-
setupSubscription(resourceId: ResourceId): void;
|
|
60
|
-
/**
|
|
61
|
-
* Handles subscription termination (complete or error) by cleaning up the
|
|
62
|
-
* stale entry and scheduling a reconnection with exponential backoff.
|
|
63
|
-
*/
|
|
64
|
-
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
|
-
private scheduleReconnection;
|
|
71
|
-
/**
|
|
72
|
-
* Resets the retry counter for a resource. Called when a successful
|
|
73
|
-
* update is received, indicating the subscription is healthy.
|
|
74
|
-
*/
|
|
75
|
-
private resetRetryCount;
|
|
76
|
-
private cancelPendingRetry;
|
|
77
|
-
private cancelAllPendingRetries;
|
|
78
|
-
cleanupSubscription(resourceId: ResourceId): void;
|
|
79
|
-
setupSubscriptionsForAllBlocks(): void;
|
|
80
|
-
cleanupAll(): void;
|
|
81
|
-
destroy(): void;
|
|
82
|
-
shouldUseRealTime(): boolean;
|
|
83
|
-
private handleGraphQLUpdate;
|
|
84
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { RendererSyncBlockEventPayload, OperationalAEP, SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
4
|
-
export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string, resourceId?: string, sourceProduct?: string) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
|
|
5
|
-
error: string;
|
|
6
|
-
resourceId?: string;
|
|
7
|
-
sourceProduct?: string;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const fetchErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
10
|
-
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;
|
|
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;
|
|
31
|
-
export declare const fetchReferencesErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
32
|
-
export declare const fetchSuccessPayload: (resourceId: string, blockInstanceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
|
|
33
|
-
export declare const createSuccessPayload: (resourceId: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
34
|
-
export declare const createSuccessPayloadNew: (resourceId: string) => SyncBlockEventPayload;
|
|
35
|
-
export declare const updateSuccessPayload: (resourceId: string, hasReference?: boolean, sourceProduct?: string) => SyncBlockEventPayload;
|
|
36
|
-
export declare const deleteSuccessPayload: (resourceId: string, sourceProduct?: string) => SyncBlockEventPayload;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { DispatchAnalyticsEvent, SyncBlockEventPayload, RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { Experience } from '@atlaskit/editor-common/experiences';
|
|
3
|
-
export declare const createExperienceDispatcher: (fireAnalyticsEvent?: ((payload: SyncBlockEventPayload) => void) | ((payload: RendererSyncBlockEventPayload) => void)) => DispatchAnalyticsEvent;
|
|
4
|
-
/**
|
|
5
|
-
* This experience tracks when a source sync block is saved to the BE.
|
|
6
|
-
*
|
|
7
|
-
* Start: When the flush source sync block function is called.
|
|
8
|
-
* Success: When the sync block save is successful within the timeout duration of start.
|
|
9
|
-
* Failure: When the timeout duration passes without the sync block being successfully saved
|
|
10
|
-
*/
|
|
11
|
-
export declare const getSaveSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
|
|
12
|
-
/**
|
|
13
|
-
* This experience tracks when a reference sync block is saved to the BE.
|
|
14
|
-
*
|
|
15
|
-
* Start: When the flush sync block function is called.
|
|
16
|
-
* Success: When the sync block save is successful within the timeout duration of start.
|
|
17
|
-
* Failure: When the timeout duration passes without the sync block being successfully saved
|
|
18
|
-
*/
|
|
19
|
-
export declare const getSaveReferenceExperience: (fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Experience;
|
|
20
|
-
/**
|
|
21
|
-
* This experience tracks when a reference sync block data is fetched from the BE.
|
|
22
|
-
*
|
|
23
|
-
* Start: When the fetchNodesData function is called.
|
|
24
|
-
* Success: When the fetching the data is successful within the timeout duration of start.
|
|
25
|
-
* Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
|
|
26
|
-
*/
|
|
27
|
-
export declare const getFetchExperience: (fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Experience;
|
|
28
|
-
/**
|
|
29
|
-
* This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
|
|
30
|
-
*
|
|
31
|
-
* Start: When the fetchSourceInfo function is called.
|
|
32
|
-
* Success: When the fetching the data is successful within the timeout duration of start.
|
|
33
|
-
* Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
|
|
34
|
-
*/
|
|
35
|
-
export declare const getFetchSourceInfoExperience: (fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Experience;
|
|
36
|
-
/**
|
|
37
|
-
* This experience tracks when a source sync block is deleted from the BE.
|
|
38
|
-
*
|
|
39
|
-
* Start: When the delete source sync block function is called.
|
|
40
|
-
* Success: When the sync block deletion is successful within the timeout duration of start.
|
|
41
|
-
* Failure: When the timeout duration passes without the sync block being successfully deleted, or the deletion fails
|
|
42
|
-
*/
|
|
43
|
-
export declare const getDeleteSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
|
|
44
|
-
/**
|
|
45
|
-
* This experience tracks when a source sync block is created and registered to the BE.
|
|
46
|
-
*
|
|
47
|
-
* Start: When the create source sync block function is called.
|
|
48
|
-
* Success: When the sync block creation is successful within the timeout duration of start.
|
|
49
|
-
* Failure: When the timeout duration passes without the sync block being successfully created, or the creation fails
|
|
50
|
-
*/
|
|
51
|
-
export declare const getCreateSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
|
|
52
|
-
/**
|
|
53
|
-
* This experience tracks when references for a sync block are fetched from the BE.
|
|
54
|
-
*
|
|
55
|
-
* Start: When the fetchReferences function is called.
|
|
56
|
-
* Success: When the fetching of references is successful within the timeout duration of start.
|
|
57
|
-
* Failure: When the timeout duration passes without references being successfully fetched, or the fetch fails
|
|
58
|
-
*/
|
|
59
|
-
export declare const getFetchReferencesExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { SyncBlockInstance } from '../providers/types';
|
|
2
|
-
/**
|
|
3
|
-
* Merges two SyncBlockInstance objects,
|
|
4
|
-
* preserving sourceURL, sourceTitle, sourceSubType, and onSameDocument from the old result
|
|
5
|
-
* when the new result does not have them.
|
|
6
|
-
* This can be extended in the future to resolve other conflicts as needed,
|
|
7
|
-
* e.g. compare timestamps or version numbers to determine which data is more recent.
|
|
8
|
-
*
|
|
9
|
-
* @param oldResult - The existing SyncBlockInstance object.
|
|
10
|
-
* @param newResult - The new SyncBlockInstance object to merge.
|
|
11
|
-
* @returns A merged SyncBlockInstance object.
|
|
12
|
-
*/
|
|
13
|
-
export declare const resolveSyncBlockInstance: (oldResult: SyncBlockInstance, newResult: SyncBlockInstance) => SyncBlockInstance;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SyncBlockProduct } from '../common/types';
|
|
2
|
-
export declare const parseResourceId: (resourceId: string) => {
|
|
3
|
-
contentId: string;
|
|
4
|
-
product: SyncBlockProduct;
|
|
5
|
-
uuid: string;
|
|
6
|
-
} | undefined;
|
|
7
|
-
export declare const createResourceIdForReference: (product: SyncBlockProduct, contentId: string, uuid: string) => string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const fetchWithRetry: (url: string, options: RequestInit, retriesRemaining?: number, delay?: number) => Promise<Response>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode, SyncBlockProduct } from '../common/types';
|
|
4
|
-
export declare const stripAnnotationMarksFromJSONContent: <T extends JSONNode | undefined>(content: T[]) => T[];
|
|
5
|
-
export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
|
|
6
|
-
export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
|
|
7
|
-
export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
|
|
8
|
-
export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
|
|
9
|
-
export declare const convertPMNodesToSyncBlockNodes: (nodes: PMNode[]) => SyncBlockNode[];
|
|
10
|
-
export declare const getContentIdAndProductFromResourceId: (resourceId: string) => {
|
|
11
|
-
sourceContentId: string;
|
|
12
|
-
sourceProduct: SyncBlockProduct;
|
|
13
|
-
};
|
|
14
|
-
export declare const getSourceProductFromResourceIdSafe: (resourceId?: string) => SyncBlockProduct | undefined;
|
|
15
|
-
export declare const convertContentUpdatedAt: (contentUpdatedAt: number | undefined) => string | undefined;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { SyncBlockProduct, SyncBlockStatus } from '../common/types';
|
|
2
|
-
export declare const normaliseSyncBlockProduct: (value: string | null | undefined) => SyncBlockProduct | undefined;
|
|
3
|
-
export declare const normaliseSyncBlockStatus: (value: string | null | undefined) => SyncBlockStatus | undefined;
|