@atlaskit/editor-synced-block-provider 2.12.3 → 2.13.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 +15 -0
- package/dist/cjs/clients/block-service/ari.js +26 -9
- package/dist/cjs/index.js +12 -6
- package/dist/cjs/providers/block-service/blockServiceAPI.js +68 -49
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +6 -0
- package/dist/cjs/providers/syncBlockProvider.js +18 -8
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +8 -0
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +2 -2
- package/dist/es2019/clients/block-service/ari.js +25 -8
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/providers/block-service/blockServiceAPI.js +32 -13
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +4 -0
- package/dist/es2019/providers/syncBlockProvider.js +6 -0
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +6 -0
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +2 -2
- package/dist/esm/clients/block-service/ari.js +25 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/providers/block-service/blockServiceAPI.js +68 -50
- package/dist/esm/providers/confluence/confluenceContentAPI.js +6 -0
- package/dist/esm/providers/syncBlockProvider.js +18 -8
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +8 -0
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +2 -2
- package/dist/types/clients/block-service/ari.d.ts +13 -5
- package/dist/types/common/types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +6 -3
- package/dist/types/providers/confluence/confluenceContentAPI.d.ts +3 -1
- package/dist/types/providers/syncBlockProvider.d.ts +2 -0
- package/dist/types/providers/types.d.ts +7 -0
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +1 -0
- package/dist/types-ts4.5/clients/block-service/ari.d.ts +13 -5
- package/dist/types-ts4.5/common/types.d.ts +3 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +6 -3
- package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +3 -1
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -0
- package/dist/types-ts4.5/providers/types.d.ts +7 -0
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import { type SyncBlockProduct } from '../../common/types';
|
|
1
2
|
/**
|
|
2
|
-
* Generates
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
5
|
-
* @returns the block ARI. E.G ari:cloud:blocks
|
|
3
|
+
* Generates the block ARI from the source page ARI and the source block's resource ID.
|
|
4
|
+
* @param sourceAri - the ARI of the document. E.G ari:cloud:confluence:cloudId:page/pageId
|
|
5
|
+
* @param resourceId - the resource ID of the block node. A randomly generated UUID
|
|
6
|
+
* @returns the block ARI. E.G ari:cloud:blocks:<cloudId>:synced-block/<product>/<pageId>/<resourceId>
|
|
6
7
|
*/
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const generateBlockAri: (sourceAri: string, resourceId: string, product: SyncBlockProduct) => string;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param sourceAri - the ARI of the document. E.G ari:cloud:confluence:cloudId:page/pageId
|
|
12
|
+
* @param resourceId - the resource ID of the reference synced block. E.G confluence-page/pageId/sourceResourceId
|
|
13
|
+
* @returns the block ARI. E.G ari:cloud:blocks:<cloudId>:synced-block/<product>/<pageId>/<resourceId>
|
|
14
|
+
*/
|
|
15
|
+
export declare const generateBlockAriFromReference: (sourceAri: string, resourceId: string) => string;
|
|
8
16
|
/**
|
|
9
17
|
* Extracts the local ID from a block ARI.
|
|
10
18
|
* @param ari - the block ARI. E.G ari:cloud:blocks:cloudId:synced-block/localId
|
|
@@ -29,6 +29,9 @@ export interface SyncBlockData {
|
|
|
29
29
|
createdBy?: string;
|
|
30
30
|
isSynced?: boolean;
|
|
31
31
|
product?: SyncBlockProduct;
|
|
32
|
+
/**
|
|
33
|
+
* The ARI of the block. E.G ari:cloud:blocks:<cloudId>:synced-block/<product>/<pageId>/<resourceId>
|
|
34
|
+
*/
|
|
32
35
|
resourceId: ResourceId;
|
|
33
36
|
sourceAri?: string;
|
|
34
37
|
sourceTitle?: string;
|
|
@@ -4,7 +4,7 @@ export type { SyncBlockData, SyncBlockNode, SyncBlockProduct, BlockInstanceId, }
|
|
|
4
4
|
export { useFetchSyncBlockData, type UseFetchSyncBlockDataResult, } from './hooks/useFetchSyncBlockData';
|
|
5
5
|
export { useFetchSyncBlockTitle } from './hooks/useFetchSyncBlockTitle';
|
|
6
6
|
export { useHandleContentChanges } from './hooks/useHandleContentChanges';
|
|
7
|
-
export {
|
|
7
|
+
export { generateBlockAri, generateBlockAriFromReference, getLocalIdFromBlockResourceId, } from './clients/block-service/ari';
|
|
8
8
|
export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId, } from './clients/confluence/ari';
|
|
9
9
|
export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
|
|
10
10
|
export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders, } from './providers/confluence/confluenceContentAPI';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { SyncBlockError, type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
1
|
+
import { SyncBlockError, type ResourceId, type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
2
2
|
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
export declare const fetchReferences: (documentAri: string) => Promise<SyncBlockInstance[] | SyncBlockError>;
|
|
4
4
|
/**
|
|
5
5
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
6
6
|
*/
|
|
7
7
|
declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
8
|
+
private sourceAri;
|
|
9
|
+
constructor(sourceAri: string);
|
|
8
10
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
@@ -12,12 +14,13 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
|
12
14
|
*/
|
|
13
15
|
declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
14
16
|
private sourceAri;
|
|
15
|
-
|
|
17
|
+
product: SyncBlockProduct;
|
|
16
18
|
constructor(sourceAri: string, product: SyncBlockProduct);
|
|
17
19
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
18
20
|
createData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
19
21
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
20
|
-
|
|
22
|
+
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
23
|
+
generateResourceId(): ResourceId;
|
|
21
24
|
}
|
|
22
25
|
export declare const useMemoizedBlockServiceAPIProviders: (sourceAri: string, product: SyncBlockProduct) => {
|
|
23
26
|
fetchProvider: BlockServiceADFFetchProvider;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SyncBlockData } from '../../common/types';
|
|
1
|
+
import { type ResourceId, type SyncBlockData, type SyncBlockProduct } from '../../common/types';
|
|
2
2
|
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Content API providers
|
|
@@ -20,12 +20,14 @@ declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
|
|
|
20
20
|
*/
|
|
21
21
|
declare class ConfluenceADFWriteProvider implements ADFWriteProvider {
|
|
22
22
|
private config;
|
|
23
|
+
product: SyncBlockProduct;
|
|
23
24
|
constructor(config: ContentAPIConfig);
|
|
24
25
|
private createNewContentProperty;
|
|
25
26
|
writeData(syncBlockData: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
26
27
|
createData(syncBlockData: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
27
28
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
28
29
|
generateResourceId(sourceId: string, localId: string): string;
|
|
30
|
+
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* Convenience function to create providers with default content property key
|
|
@@ -17,6 +17,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
17
17
|
* @param nestedRendererDataProviders
|
|
18
18
|
*/
|
|
19
19
|
constructor(fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string, providerOptions: SyncedBlockRendererProviderOptions);
|
|
20
|
+
getProduct(): SyncBlockProduct | undefined;
|
|
20
21
|
/**
|
|
21
22
|
* Check if the node is supported by the provider
|
|
22
23
|
*
|
|
@@ -77,6 +78,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
77
78
|
*/
|
|
78
79
|
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
79
80
|
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
81
|
+
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
80
82
|
/**
|
|
81
83
|
* Get the synced block renderer provider options
|
|
82
84
|
*
|
|
@@ -13,6 +13,9 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
|
|
|
13
13
|
export type SyncBlockInstance = {
|
|
14
14
|
data?: SyncBlockData;
|
|
15
15
|
error?: SyncBlockError;
|
|
16
|
+
/**
|
|
17
|
+
* The resourceId in the attrs of the block
|
|
18
|
+
*/
|
|
16
19
|
resourceId: ResourceId;
|
|
17
20
|
};
|
|
18
21
|
export type DeleteSyncBlockResult = {
|
|
@@ -43,6 +46,8 @@ export interface ADFWriteProvider {
|
|
|
43
46
|
createData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
44
47
|
deleteData: (resourceId: ResourceId) => Promise<DeleteSyncBlockResult>;
|
|
45
48
|
generateResourceId: (sourceId: string, localId: string) => ResourceId;
|
|
49
|
+
generateResourceIdForReference: (sourceId: ResourceId) => ResourceId;
|
|
50
|
+
product: SyncBlockProduct;
|
|
46
51
|
writeData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
47
52
|
}
|
|
48
53
|
export type MediaEmojiProviderOptions = {
|
|
@@ -67,6 +72,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
67
72
|
abstract createNodeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
68
73
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
69
74
|
abstract getSourceId(): ResourceId;
|
|
75
|
+
abstract getProduct(): SyncBlockProduct | undefined;
|
|
70
76
|
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): Promise<SyncBlockSourceInfo | undefined>;
|
|
71
77
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
72
78
|
abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
@@ -77,6 +83,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
77
83
|
* @returns The generated resource ID
|
|
78
84
|
*/
|
|
79
85
|
abstract generateResourceId(sourceId: ResourceId, localId: BlockInstanceId): ResourceId;
|
|
86
|
+
abstract generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
80
87
|
}
|
|
81
88
|
export type SubscriptionCallback = (data: SyncBlockInstance) => void;
|
|
82
89
|
export type TitleSubscriptionCallback = (title: string) => void;
|
|
@@ -13,6 +13,7 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
13
13
|
private syncBlockURLRequests;
|
|
14
14
|
private isRefreshingSubscriptions;
|
|
15
15
|
constructor(dataProvider?: SyncBlockDataProvider, fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void);
|
|
16
|
+
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
16
17
|
updateFireAnalyticsEvent(fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void): void;
|
|
17
18
|
/**
|
|
18
19
|
* Refreshes the subscriptions for all sync blocks.
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"uuid": "^3.1.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@atlaskit/editor-common": "^110.
|
|
37
|
+
"@atlaskit/editor-common": "^110.40.0",
|
|
38
38
|
"react": "^18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
80
|
-
"version": "2.
|
|
80
|
+
"version": "2.13.1",
|
|
81
81
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
82
82
|
"author": "Atlassian Pty Ltd",
|
|
83
83
|
"license": "Apache-2.0",
|