@atlaskit/editor-synced-block-provider 0.2.0 → 0.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 +7 -0
- package/dist/cjs/common/syncBlockProvider.js +24 -12
- package/dist/cjs/common/syncBlockStoreManager.js +8 -5
- package/dist/cjs/index.js +28 -2
- package/dist/cjs/providers/confluenceContentAPI.js +238 -0
- package/dist/cjs/utils/ari.js +42 -0
- package/dist/cjs/utils/contentProperty.js +192 -0
- package/dist/es2019/common/syncBlockProvider.js +25 -13
- package/dist/es2019/common/syncBlockStoreManager.js +8 -5
- package/dist/es2019/index.js +5 -3
- package/dist/es2019/providers/confluenceContentAPI.js +150 -0
- package/dist/es2019/utils/ari.js +32 -0
- package/dist/es2019/utils/contentProperty.js +160 -0
- package/dist/esm/common/syncBlockProvider.js +24 -12
- package/dist/esm/common/syncBlockStoreManager.js +8 -5
- package/dist/esm/index.js +5 -3
- package/dist/esm/providers/confluenceContentAPI.js +232 -0
- package/dist/esm/utils/ari.js +36 -0
- package/dist/esm/utils/contentProperty.js +185 -0
- package/dist/types/common/syncBlockProvider.d.ts +3 -1
- package/dist/types/common/syncBlockStoreManager.d.ts +2 -1
- package/dist/types/common/types.d.ts +1 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/providers/confluenceContentAPI.d.ts +41 -0
- package/dist/types/utils/ari.d.ts +10 -0
- package/dist/types/utils/contentProperty.d.ts +61 -0
- package/dist/types-ts4.5/common/syncBlockProvider.d.ts +3 -1
- package/dist/types-ts4.5/common/syncBlockStoreManager.d.ts +2 -1
- package/dist/types-ts4.5/common/types.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +4 -2
- package/dist/types-ts4.5/providers/confluenceContentAPI.d.ts +41 -0
- package/dist/types-ts4.5/utils/ari.d.ts +10 -0
- package/dist/types-ts4.5/utils/contentProperty.d.ts +61 -0
- package/package.json +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, SyncBlockData } from '../common/types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for Content API providers
|
|
5
|
+
*/
|
|
6
|
+
interface ContentAPIConfig {
|
|
7
|
+
cloudId: string;
|
|
8
|
+
contentPropertyKey: string;
|
|
9
|
+
}
|
|
10
|
+
export type SyncedBlockContentPropertyValue = {
|
|
11
|
+
content?: ADFEntity;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* ADFFetchProvider implementation that fetches synced block data from Confluence Content API
|
|
15
|
+
*/
|
|
16
|
+
declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
|
|
17
|
+
private config;
|
|
18
|
+
constructor(config: ContentAPIConfig);
|
|
19
|
+
fetchData(resourceId: string): Promise<SyncBlockData>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ADFWriteProvider implementation that writes synced block data to Confluence Content API
|
|
23
|
+
*/
|
|
24
|
+
declare class ConfluenceADFWriteProvider implements ADFWriteProvider {
|
|
25
|
+
private config;
|
|
26
|
+
constructor(config: ContentAPIConfig);
|
|
27
|
+
private createNewContentProperty;
|
|
28
|
+
writeData(sourceId: string, localId: string, data: ADFEntity, resourceId?: string): Promise<string>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Convenience function to create providers with default content property key
|
|
32
|
+
*/
|
|
33
|
+
export declare const createContentAPIProvidersWithDefaultKey: (cloudId: string) => {
|
|
34
|
+
fetchProvider: ConfluenceADFFetchProvider;
|
|
35
|
+
writeProvider: ConfluenceADFWriteProvider;
|
|
36
|
+
};
|
|
37
|
+
export declare const useMemoizedContentAPIProviders: (cloudId: string) => {
|
|
38
|
+
fetchProvider: ConfluenceADFFetchProvider;
|
|
39
|
+
writeProvider: ConfluenceADFWriteProvider;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const getConfluencePageAri: (pageId: string, cloudId: string) => string;
|
|
2
|
+
export declare const getPageIdFromAri: (ari: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param ari ari:cloud:confluence:<cloudId>:page/<pageId>/<localId>
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const getLocalIdFromAri: (ari: string) => string;
|
|
9
|
+
export declare const getContentPropertyAri: (contentPropertyId: string, cloudId: string) => string;
|
|
10
|
+
export declare const getContentPropertyIdFromAri: (ari: string) => string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
type GetContentPropertyOptions = {
|
|
2
|
+
cloudId: string;
|
|
3
|
+
key: string;
|
|
4
|
+
pageId: string;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
};
|
|
7
|
+
type CreateContentPropertyOptions = {
|
|
8
|
+
cloudId: string;
|
|
9
|
+
key: string;
|
|
10
|
+
pageId: string;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
type UpdateContentPropertyOptions = {
|
|
14
|
+
cloudId: string;
|
|
15
|
+
key: string;
|
|
16
|
+
pageId: string;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
export type GetContentPropertyResult = {
|
|
21
|
+
data: {
|
|
22
|
+
confluence: {
|
|
23
|
+
page: {
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
key: string | null;
|
|
27
|
+
value: string | null;
|
|
28
|
+
}
|
|
29
|
+
] | null;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type UpdateContentPropertyResult = {
|
|
35
|
+
data: {
|
|
36
|
+
confluence: {
|
|
37
|
+
updateValuePageProperty: {
|
|
38
|
+
pageProperty: {
|
|
39
|
+
key: string | null;
|
|
40
|
+
value: string | null;
|
|
41
|
+
} | null;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type CreateContentPropertyResult = {
|
|
47
|
+
data: {
|
|
48
|
+
confluence: {
|
|
49
|
+
createPageProperty: {
|
|
50
|
+
pageProperty: {
|
|
51
|
+
key: string | null;
|
|
52
|
+
value: string | null;
|
|
53
|
+
} | null;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const getContentProperty: ({ pageId, key, cloudId, }: GetContentPropertyOptions) => Promise<GetContentPropertyResult>;
|
|
59
|
+
export declare const updateContentProperty: ({ pageId, key, value, cloudId, }: UpdateContentPropertyOptions) => Promise<UpdateContentPropertyResult>;
|
|
60
|
+
export declare const createContentProperty: ({ pageId, key, value, cloudId, }: CreateContentPropertyOptions) => Promise<CreateContentPropertyResult>;
|
|
61
|
+
export {};
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/css": "^0.14.0",
|
|
30
30
|
"@atlaskit/editor-json-transformer": "^8.30.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
32
|
-
"@atlaskit/node-data-provider": "^7.
|
|
32
|
+
"@atlaskit/node-data-provider": "^7.1.0",
|
|
33
33
|
"@atlaskit/primitives": "^14.15.0",
|
|
34
34
|
"@atlaskit/tokens": "^6.4.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
85
|
-
"version": "0.
|
|
85
|
+
"version": "0.3.0",
|
|
86
86
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
87
87
|
"author": "Atlassian Pty Ltd",
|
|
88
88
|
"license": "Apache-2.0",
|