@atlaskit/editor-synced-block-provider 4.0.1 → 4.1.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 +19 -0
- package/dist/cjs/clients/block-service/blockService.js +35 -17
- package/dist/cjs/common/types.js +2 -0
- package/dist/cjs/providers/block-service/blockServiceAPI.js +16 -1
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +209 -811
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +3 -6
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +180 -17
- package/dist/es2019/clients/block-service/blockService.js +16 -3
- package/dist/es2019/common/types.js +2 -0
- package/dist/es2019/providers/block-service/blockServiceAPI.js +12 -1
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +78 -595
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +3 -6
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +157 -10
- package/dist/esm/clients/block-service/blockService.js +34 -16
- package/dist/esm/common/types.js +2 -0
- package/dist/esm/providers/block-service/blockServiceAPI.js +17 -2
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +210 -812
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +3 -6
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +180 -17
- package/dist/types/clients/block-service/blockService.d.ts +4 -1
- package/dist/types/common/types.d.ts +2 -1
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +4 -49
- package/dist/types/store-manager/syncBlockSubscriptionManager.d.ts +25 -6
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +4 -1
- package/dist/types-ts4.5/common/types.d.ts +2 -1
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +4 -49
- package/dist/types-ts4.5/store-manager/syncBlockSubscriptionManager.d.ts +25 -6
- package/package.json +4 -7
|
@@ -1,33 +1,52 @@
|
|
|
1
1
|
import { type RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { ResourceId, BlockInstanceId } from '../common/types';
|
|
3
|
-
import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, SyncBlockSourceInfo } from '../providers/types';
|
|
4
|
+
import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, SyncBlockSourceInfo, TitleSubscriptionCallback } from '../providers/types';
|
|
4
5
|
export interface SyncBlockSubscriptionManagerDeps {
|
|
6
|
+
debouncedBatchedFetchSyncBlocks: (resourceId: string) => void;
|
|
7
|
+
deleteFromCache: (resourceId: ResourceId) => void;
|
|
5
8
|
fetchSyncBlockSourceInfo: (resourceId: ResourceId) => Promise<SyncBlockSourceInfo | undefined>;
|
|
6
9
|
getDataProvider: () => SyncBlockDataProviderInterface | undefined;
|
|
7
10
|
getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
|
|
8
11
|
getFromCache: (resourceId: ResourceId) => SyncBlockInstance | undefined;
|
|
9
|
-
|
|
10
|
-
[localId: BlockInstanceId]: SubscriptionCallback;
|
|
11
|
-
}>;
|
|
12
|
+
markCacheDirty: () => void;
|
|
12
13
|
updateCache: (syncBlockInstance: SyncBlockInstance) => void;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Manages the lifecycle of GraphQL WebSocket subscriptions for sync block
|
|
16
|
-
* real-time updates,
|
|
17
|
-
*
|
|
17
|
+
* real-time updates, owns the subscriptions and titleSubscriptions maps,
|
|
18
|
+
* and provides a listener API so React components can react when the set
|
|
19
|
+
* of subscribed resource IDs changes.
|
|
18
20
|
*/
|
|
19
21
|
export declare class SyncBlockSubscriptionManager {
|
|
20
22
|
private deps;
|
|
23
|
+
private subscriptions;
|
|
24
|
+
private titleSubscriptions;
|
|
21
25
|
private graphqlSubscriptions;
|
|
22
26
|
private subscriptionChangeListeners;
|
|
23
27
|
private useRealTimeSubscriptions;
|
|
28
|
+
private pendingCacheDeletions;
|
|
24
29
|
constructor(deps: SyncBlockSubscriptionManagerDeps);
|
|
30
|
+
/**
|
|
31
|
+
* Returns the subscriptions map. Used by external consumers (e.g. batch fetcher, flush)
|
|
32
|
+
* that need to read the current subscription state.
|
|
33
|
+
*/
|
|
34
|
+
getSubscriptions(): Map<ResourceId, {
|
|
35
|
+
[localId: BlockInstanceId]: SubscriptionCallback;
|
|
36
|
+
}>;
|
|
25
37
|
setRealTimeSubscriptionsEnabled(enabled: boolean): void;
|
|
26
38
|
isRealTimeSubscriptionsEnabled(): boolean;
|
|
27
39
|
getSubscribedResourceIds(): ResourceId[];
|
|
28
40
|
onSubscriptionsChanged(listener: () => void): () => void;
|
|
29
41
|
notifySubscriptionChangeListeners(): void;
|
|
30
42
|
handleSubscriptionUpdate(syncBlockInstance: SyncBlockInstance): void;
|
|
43
|
+
subscribeToSyncBlock(resourceId: string, localId: string, callback: SubscriptionCallback): () => void;
|
|
44
|
+
subscribeToSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
|
|
45
|
+
updateSourceTitleSubscriptions(resourceId: string, title: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Notifies all subscription callbacks for a given resource ID with the provided sync block instance.
|
|
48
|
+
*/
|
|
49
|
+
notifySubscriptionCallbacks(resourceId: ResourceId, syncBlock: SyncBlockInstance): void;
|
|
31
50
|
setupSubscription(resourceId: ResourceId): void;
|
|
32
51
|
cleanupSubscription(resourceId: ResourceId): void;
|
|
33
52
|
setupSubscriptionsForAllBlocks(): void;
|
package/package.json
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
30
30
|
"@atlaskit/node-data-provider": "^9.0.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
|
+
"@atlaskit/tmp-editor-statsig": "^40.6.0",
|
|
32
33
|
"@babel/runtime": "^7.0.0",
|
|
33
34
|
"@compiled/react": "^0.20.0",
|
|
34
35
|
"graphql-ws": "^5.14.2",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"uuid": "^3.1.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^112.
|
|
41
|
+
"@atlaskit/editor-common": "^112.6.0",
|
|
41
42
|
"react": "^18.2.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
@@ -80,16 +81,12 @@
|
|
|
80
81
|
}
|
|
81
82
|
},
|
|
82
83
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
83
|
-
"version": "4.
|
|
84
|
+
"version": "4.1.1",
|
|
84
85
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
85
86
|
"author": "Atlassian Pty Ltd",
|
|
86
87
|
"license": "Apache-2.0",
|
|
87
88
|
"publishConfig": {
|
|
88
89
|
"registry": "https://registry.npmjs.org/"
|
|
89
90
|
},
|
|
90
|
-
"platform-feature-flags": {
|
|
91
|
-
"platform_synced_block_patch_5": {
|
|
92
|
-
"type": "boolean"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
91
|
+
"platform-feature-flags": {}
|
|
95
92
|
}
|