@atlaskit/editor-synced-block-provider 3.1.0 → 3.2.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 +14 -0
- package/dist/cjs/clients/block-service/ari.js +13 -16
- package/dist/cjs/clients/block-service/blockService.js +37 -14
- package/dist/cjs/clients/confluence/ari.js +7 -40
- package/dist/cjs/clients/confluence/sourceInfo.js +3 -1
- package/dist/cjs/clients/jira/ari.js +5 -2
- package/dist/cjs/index.js +2 -27
- package/dist/cjs/providers/block-service/blockServiceAPI.js +71 -28
- package/dist/cjs/providers/syncBlockProvider.js +57 -38
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +5 -8
- package/dist/es2019/clients/block-service/ari.js +15 -16
- package/dist/es2019/clients/block-service/blockService.js +39 -7
- package/dist/es2019/clients/confluence/ari.js +11 -37
- package/dist/es2019/clients/confluence/sourceInfo.js +3 -1
- package/dist/es2019/clients/jira/ari.js +9 -2
- package/dist/es2019/index.js +2 -3
- package/dist/es2019/providers/block-service/blockServiceAPI.js +75 -28
- package/dist/es2019/providers/syncBlockProvider.js +45 -25
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +5 -8
- package/dist/esm/clients/block-service/ari.js +13 -16
- package/dist/esm/clients/block-service/blockService.js +37 -14
- package/dist/esm/clients/confluence/ari.js +6 -39
- package/dist/esm/clients/confluence/sourceInfo.js +3 -1
- package/dist/esm/clients/jira/ari.js +5 -2
- package/dist/esm/index.js +2 -3
- package/dist/esm/providers/block-service/blockServiceAPI.js +70 -27
- package/dist/esm/providers/syncBlockProvider.js +57 -38
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +4 -8
- package/dist/types/clients/block-service/ari.d.ts +14 -4
- package/dist/types/clients/block-service/blockService.d.ts +1 -2
- package/dist/types/clients/confluence/ari.d.ts +8 -21
- package/dist/types/clients/jira/ari.d.ts +7 -2
- package/dist/types/index.d.ts +5 -6
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +31 -6
- package/dist/types/providers/syncBlockProvider.d.ts +14 -13
- package/dist/types/providers/types.d.ts +9 -6
- package/dist/types-ts4.5/clients/block-service/ari.d.ts +14 -4
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +1 -2
- package/dist/types-ts4.5/clients/confluence/ari.d.ts +8 -21
- package/dist/types-ts4.5/clients/jira/ari.d.ts +7 -2
- package/dist/types-ts4.5/index.d.ts +5 -6
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +31 -6
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +14 -13
- package/dist/types-ts4.5/providers/types.d.ts +9 -6
- package/package.json +1 -1
- package/dist/cjs/clients/confluence/contentProperty.js +0 -284
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +0 -446
- package/dist/es2019/clients/confluence/contentProperty.js +0 -288
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +0 -310
- package/dist/esm/clients/confluence/contentProperty.js +0 -277
- package/dist/esm/providers/confluence/confluenceContentAPI.js +0 -440
- package/dist/types/clients/confluence/contentProperty.d.ts +0 -139
- package/dist/types/providers/confluence/confluenceContentAPI.d.ts +0 -44
- package/dist/types-ts4.5/clients/confluence/contentProperty.d.ts +0 -139
- package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 3.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`08984e84a58de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08984e84a58de) -
|
|
8
|
+
EDITOR-3594 Improve ARIs handling to ensure correctness
|
|
9
|
+
|
|
10
|
+
## 3.2.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`b7db97837674e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7db97837674e) -
|
|
15
|
+
Use GraphQL endpoint for fetching references on a document instead of Rest API
|
|
16
|
+
|
|
3
17
|
## 3.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -8,32 +8,29 @@ exports.getLocalIdFromBlockResourceId = exports.generateBlockAriFromReference =
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Generates the block ARI from the source page ARI and the source block's resource ID.
|
|
11
|
-
* @param
|
|
11
|
+
* @param cloudId - the cloudId of the block. E.G the cloudId of the confluence page, or the cloudId of the Jira instance
|
|
12
|
+
* @param parentId - the parentId of the block. E.G the pageId for a confluence page, or the issueId for a Jira work item
|
|
12
13
|
* @param resourceId - the resource ID of the block node. A randomly generated UUID
|
|
14
|
+
* @param product - the product of the block. E.G 'confluence-page', 'jira-work-item'
|
|
13
15
|
* @returns the block ARI. E.G ari:cloud:blocks:<cloudId>:synced-block/<product>/<pageId>/<resourceId>
|
|
14
16
|
*/
|
|
15
|
-
var generateBlockAri = exports.generateBlockAri = function generateBlockAri(
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var pageId = match[3];
|
|
22
|
-
return "ari:cloud:blocks:".concat(cloudId, ":synced-block/").concat(product, "/").concat(pageId, "/").concat(resourceId);
|
|
17
|
+
var generateBlockAri = exports.generateBlockAri = function generateBlockAri(_ref) {
|
|
18
|
+
var cloudId = _ref.cloudId,
|
|
19
|
+
parentId = _ref.parentId,
|
|
20
|
+
product = _ref.product,
|
|
21
|
+
resourceId = _ref.resourceId;
|
|
22
|
+
return "ari:cloud:blocks:".concat(cloudId, ":synced-block/").concat(product, "/").concat(parentId, "/").concat(resourceId);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Generates the block ARI from the reference synced block ARI and the resource ID
|
|
27
|
-
* @param
|
|
27
|
+
* @param cloudId - the cloudId of the block. E.G the cloudId of the confluence page, or the cloudId of the Jira instance
|
|
28
28
|
* @param resourceId - the resource ID of the reference synced block. E.G confluence-page/pageId/sourceResourceId
|
|
29
29
|
* @returns the block ARI. E.G ari:cloud:blocks:<cloudId>:synced-block/<product>/<pageId>/<resourceId>
|
|
30
30
|
*/
|
|
31
|
-
var generateBlockAriFromReference = exports.generateBlockAriFromReference = function generateBlockAriFromReference(
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
throw new Error("Invalid source ARI: ".concat(sourceAri));
|
|
35
|
-
}
|
|
36
|
-
var cloudId = match[1];
|
|
31
|
+
var generateBlockAriFromReference = exports.generateBlockAriFromReference = function generateBlockAriFromReference(_ref2) {
|
|
32
|
+
var cloudId = _ref2.cloudId,
|
|
33
|
+
resourceId = _ref2.resourceId;
|
|
37
34
|
return "ari:cloud:blocks:".concat(cloudId, ":synced-block/").concat(resourceId);
|
|
38
35
|
};
|
|
39
36
|
|
|
@@ -20,11 +20,10 @@ var isBlockContentResponse = exports.isBlockContentResponse = function isBlockCo
|
|
|
20
20
|
var content = response.content;
|
|
21
21
|
return typeof content === 'string';
|
|
22
22
|
};
|
|
23
|
-
|
|
24
23
|
/**
|
|
25
24
|
* Retrieves all synced blocks referenced in a document.
|
|
26
25
|
*
|
|
27
|
-
* Calls the Block Service API
|
|
26
|
+
* Calls the Block Service GraphQL API: `blockService_getDocumentReferenceBlocks`
|
|
28
27
|
*
|
|
29
28
|
* @param documentAri - The ARI of the document to fetch synced blocks for
|
|
30
29
|
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
@@ -61,32 +60,51 @@ var isBlockContentResponse = exports.isBlockContentResponse = function isBlockCo
|
|
|
61
60
|
* ]
|
|
62
61
|
* }
|
|
63
62
|
* ```
|
|
64
|
-
* Check https://block-service.dev.atl-paas.net/ for latest API documentation.
|
|
65
63
|
*/
|
|
66
64
|
var getReferenceSyncedBlocks = exports.getReferenceSyncedBlocks = /*#__PURE__*/function () {
|
|
67
65
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(documentAri) {
|
|
68
|
-
var response;
|
|
66
|
+
var bodyData, response, result;
|
|
69
67
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
70
68
|
while (1) switch (_context.prev = _context.next) {
|
|
71
69
|
case 0:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
bodyData = {
|
|
71
|
+
query: buildGetDocumentReferenceBlocksQuery(documentAri),
|
|
72
|
+
operationName: GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME
|
|
73
|
+
};
|
|
74
|
+
_context.next = 3;
|
|
75
|
+
return (0, _retry.fetchWithRetry)(GRAPHQL_ENDPOINT, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: COMMON_HEADERS,
|
|
78
|
+
body: JSON.stringify(bodyData)
|
|
76
79
|
});
|
|
77
|
-
case
|
|
80
|
+
case 3:
|
|
78
81
|
response = _context.sent;
|
|
79
82
|
if (response.ok) {
|
|
80
|
-
_context.next =
|
|
83
|
+
_context.next = 6;
|
|
81
84
|
break;
|
|
82
85
|
}
|
|
83
86
|
throw new BlockError(response.status);
|
|
84
|
-
case
|
|
85
|
-
_context.next =
|
|
87
|
+
case 6:
|
|
88
|
+
_context.next = 8;
|
|
86
89
|
return response.json();
|
|
87
|
-
case 7:
|
|
88
|
-
return _context.abrupt("return", _context.sent);
|
|
89
90
|
case 8:
|
|
91
|
+
result = _context.sent;
|
|
92
|
+
if (!(result.errors && result.errors.length > 0)) {
|
|
93
|
+
_context.next = 11;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
throw new Error(result.errors.map(function (e) {
|
|
97
|
+
return e.message;
|
|
98
|
+
}).join(', '));
|
|
99
|
+
case 11:
|
|
100
|
+
if (result.data) {
|
|
101
|
+
_context.next = 13;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
throw new Error('No data returned from GraphQL query');
|
|
105
|
+
case 13:
|
|
106
|
+
return _context.abrupt("return", result.data.blockService_getDocumentReferenceBlocks);
|
|
107
|
+
case 14:
|
|
90
108
|
case "end":
|
|
91
109
|
return _context.stop();
|
|
92
110
|
}
|
|
@@ -101,6 +119,11 @@ var COMMON_HEADERS = {
|
|
|
101
119
|
Accept: 'application/json'
|
|
102
120
|
};
|
|
103
121
|
var BLOCK_SERVICE_API_URL = '/gateway/api/blocks/v1';
|
|
122
|
+
var GRAPHQL_ENDPOINT = '/gateway/api/graphql';
|
|
123
|
+
var GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_DOCUMENT_REFERENCE_BLOCKS';
|
|
124
|
+
var buildGetDocumentReferenceBlocksQuery = function buildGetDocumentReferenceBlocksQuery(documentAri) {
|
|
125
|
+
return "query ".concat(GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME, " {\n\tblockService_getDocumentReferenceBlocks(documentAri: \"").concat(documentAri, "\") {\n\t\tblocks {\n\t\t\tblockAri\n\t\t\tblockInstanceId\n\t\t\tcontent\n\t\t\tcreatedAt\n\t\t\tcreatedBy\n\t\t\tproduct\n\t\t\tsourceAri\n\t\t\tstatus\n\t\t\tversion\n\t\t}\n\t\terrors {\n\t\t\tblockAri\n\t\t\tcode\n\t\t\treason\n\t\t}\n\t}\n}");
|
|
126
|
+
};
|
|
104
127
|
var BlockError = exports.BlockError = /*#__PURE__*/function (_Error) {
|
|
105
128
|
function BlockError(status) {
|
|
106
129
|
var _this;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getPageIdAndTypeFromConfluencePageAri = exports.getConfluencePageAri = void 0;
|
|
7
7
|
/* eslint-disable require-unicode-regexp */
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -17,8 +17,10 @@ exports.resourceIdFromConfluencePageSourceIdAndLocalId = exports.getPageIdAndTyp
|
|
|
17
17
|
* @param pageType - the type of the page
|
|
18
18
|
* @returns the Confluence page ARI
|
|
19
19
|
*/
|
|
20
|
-
var getConfluencePageAri = exports.getConfluencePageAri = function getConfluencePageAri(
|
|
21
|
-
var
|
|
20
|
+
var getConfluencePageAri = exports.getConfluencePageAri = function getConfluencePageAri(_ref) {
|
|
21
|
+
var pageId = _ref.pageId,
|
|
22
|
+
cloudId = _ref.cloudId,
|
|
23
|
+
pageType = _ref.pageType;
|
|
22
24
|
return "ari:cloud:confluence:".concat(cloudId, ":").concat(pageType, "/").concat(pageId);
|
|
23
25
|
};
|
|
24
26
|
|
|
@@ -27,7 +29,8 @@ var getConfluencePageAri = exports.getConfluencePageAri = function getConfluence
|
|
|
27
29
|
* @param ari - the Confluence page ARI
|
|
28
30
|
* @returns the page ID and type
|
|
29
31
|
*/
|
|
30
|
-
var getPageIdAndTypeFromConfluencePageAri = exports.getPageIdAndTypeFromConfluencePageAri = function getPageIdAndTypeFromConfluencePageAri(
|
|
32
|
+
var getPageIdAndTypeFromConfluencePageAri = exports.getPageIdAndTypeFromConfluencePageAri = function getPageIdAndTypeFromConfluencePageAri(_ref2) {
|
|
33
|
+
var ari = _ref2.ari;
|
|
31
34
|
var match = ari.match(/ari:cloud:confluence:[^:]+:(page|blogpost)\/(\d+)/);
|
|
32
35
|
if (match !== null && match !== void 0 && match[2]) {
|
|
33
36
|
return {
|
|
@@ -36,40 +39,4 @@ var getPageIdAndTypeFromConfluencePageAri = exports.getPageIdAndTypeFromConfluen
|
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
41
|
throw new Error("Invalid page ARI: ".concat(ari));
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Extracts the local ID from the Confluence page content property resource ID
|
|
43
|
-
* @param resourceId - the Confluence page content property resource ID
|
|
44
|
-
* @returns the local ID
|
|
45
|
-
*/
|
|
46
|
-
var getLocalIdFromContentPropertyResourceId = exports.getLocalIdFromContentPropertyResourceId = function getLocalIdFromContentPropertyResourceId(resourceId) {
|
|
47
|
-
var match = resourceId.match(/ari:cloud:confluence:[^:]+:(page|blogpost)\/\d+\/([a-zA-Z0-9-]+)/);
|
|
48
|
-
if (match !== null && match !== void 0 && match[2]) {
|
|
49
|
-
return match[2];
|
|
50
|
-
}
|
|
51
|
-
throw new Error("Invalid resourceId: ".concat(resourceId));
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Extracts the Confluence page ARI from the Confluence content property resource ID
|
|
56
|
-
* @param resourceId - the Confluence content property resource ID
|
|
57
|
-
* @returns the Confluence page ARI
|
|
58
|
-
*/
|
|
59
|
-
var getPageAriFromContentPropertyResourceId = exports.getPageAriFromContentPropertyResourceId = function getPageAriFromContentPropertyResourceId(resourceId) {
|
|
60
|
-
var match = resourceId.match(/(ari:cloud:confluence:[^:]+:(page|blogpost)\/\d+)\/([a-zA-Z0-9-]+)$/);
|
|
61
|
-
if (match !== null && match !== void 0 && match[1]) {
|
|
62
|
-
return match[1];
|
|
63
|
-
}
|
|
64
|
-
throw new Error("Invalid resourceId: ".concat(resourceId));
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Generates the Confluence page content property resource ID from the source ID and local ID
|
|
69
|
-
* @param sourceId - the source ID
|
|
70
|
-
* @param localId - the local ID
|
|
71
|
-
* @returns the Confluence page content property resource ID
|
|
72
|
-
*/
|
|
73
|
-
var resourceIdFromConfluencePageSourceIdAndLocalId = exports.resourceIdFromConfluencePageSourceIdAndLocalId = function resourceIdFromConfluencePageSourceIdAndLocalId(sourceId, localId) {
|
|
74
|
-
return "".concat(sourceId, "/").concat(localId);
|
|
75
42
|
};
|
|
@@ -78,7 +78,9 @@ var fetchConfluencePageInfo = exports.fetchConfluencePageInfo = /*#__PURE__*/fun
|
|
|
78
78
|
while (1) switch (_context2.prev = _context2.next) {
|
|
79
79
|
case 0:
|
|
80
80
|
_context2.prev = 0;
|
|
81
|
-
_getPageIdAndTypeFrom = (0, _ari.getPageIdAndTypeFromConfluencePageAri)(
|
|
81
|
+
_getPageIdAndTypeFrom = (0, _ari.getPageIdAndTypeFromConfluencePageAri)({
|
|
82
|
+
ari: pageAri
|
|
83
|
+
}), pageType = _getPageIdAndTypeFrom.type;
|
|
82
84
|
_context2.next = 4;
|
|
83
85
|
return getConfluenceSourceInfo(pageAri);
|
|
84
86
|
case 4:
|
|
@@ -12,7 +12,9 @@ exports.getJiraWorkItemIdFromAri = exports.getJiraWorkItemAri = void 0;
|
|
|
12
12
|
* @param cloudId - the cloud ID
|
|
13
13
|
* @returns the Jira work item ARI
|
|
14
14
|
*/
|
|
15
|
-
var getJiraWorkItemAri = exports.getJiraWorkItemAri = function getJiraWorkItemAri(
|
|
15
|
+
var getJiraWorkItemAri = exports.getJiraWorkItemAri = function getJiraWorkItemAri(_ref) {
|
|
16
|
+
var cloudId = _ref.cloudId,
|
|
17
|
+
workItemId = _ref.workItemId;
|
|
16
18
|
return "ari:cloud:jira:".concat(cloudId, ":issue/").concat(workItemId);
|
|
17
19
|
};
|
|
18
20
|
|
|
@@ -21,7 +23,8 @@ var getJiraWorkItemAri = exports.getJiraWorkItemAri = function getJiraWorkItemAr
|
|
|
21
23
|
* @param ari - the Jira work item ARI
|
|
22
24
|
* @returns the Jira work item ID
|
|
23
25
|
*/
|
|
24
|
-
var getJiraWorkItemIdFromAri = exports.getJiraWorkItemIdFromAri = function getJiraWorkItemIdFromAri(
|
|
26
|
+
var getJiraWorkItemIdFromAri = exports.getJiraWorkItemIdFromAri = function getJiraWorkItemIdFromAri(_ref2) {
|
|
27
|
+
var ari = _ref2.ari;
|
|
25
28
|
var match = ari.match(/ari:cloud:jira:([^:]+):issue\/(\d+)/);
|
|
26
29
|
if (match !== null && match !== void 0 && match[2]) {
|
|
27
30
|
return match[2];
|
package/dist/cjs/index.js
CHANGED
|
@@ -39,12 +39,6 @@ Object.defineProperty(exports, "convertSyncBlockPMNodeToSyncBlockData", {
|
|
|
39
39
|
return _utils.convertSyncBlockPMNodeToSyncBlockData;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(exports, "createContentAPIProvidersWithDefaultKey", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _confluenceContentAPI.createContentAPIProvidersWithDefaultKey;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
42
|
Object.defineProperty(exports, "createSyncBlockNode", {
|
|
49
43
|
enumerable: true,
|
|
50
44
|
get: function get() {
|
|
@@ -111,18 +105,6 @@ Object.defineProperty(exports, "getLocalIdFromBlockResourceId", {
|
|
|
111
105
|
return _ari.getLocalIdFromBlockResourceId;
|
|
112
106
|
}
|
|
113
107
|
});
|
|
114
|
-
Object.defineProperty(exports, "getLocalIdFromContentPropertyResourceId", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
get: function get() {
|
|
117
|
-
return _ari2.getLocalIdFromContentPropertyResourceId;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, "getPageAriFromContentPropertyResourceId", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function get() {
|
|
123
|
-
return _ari2.getPageAriFromContentPropertyResourceId;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
108
|
Object.defineProperty(exports, "getPageIdAndTypeFromConfluencePageAri", {
|
|
127
109
|
enumerable: true,
|
|
128
110
|
get: function get() {
|
|
@@ -141,12 +123,6 @@ Object.defineProperty(exports, "resolveSyncBlockInstance", {
|
|
|
141
123
|
return _resolveSyncBlockInstance.resolveSyncBlockInstance;
|
|
142
124
|
}
|
|
143
125
|
});
|
|
144
|
-
Object.defineProperty(exports, "resourceIdFromConfluencePageSourceIdAndLocalId", {
|
|
145
|
-
enumerable: true,
|
|
146
|
-
get: function get() {
|
|
147
|
-
return _ari2.resourceIdFromConfluencePageSourceIdAndLocalId;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
126
|
Object.defineProperty(exports, "useFetchSyncBlockData", {
|
|
151
127
|
enumerable: true,
|
|
152
128
|
get: function get() {
|
|
@@ -171,10 +147,10 @@ Object.defineProperty(exports, "useMemoizedBlockServiceAPIProviders", {
|
|
|
171
147
|
return _blockServiceAPI.useMemoizedBlockServiceAPIProviders;
|
|
172
148
|
}
|
|
173
149
|
});
|
|
174
|
-
Object.defineProperty(exports, "
|
|
150
|
+
Object.defineProperty(exports, "useMemoizedBlockServiceFetchOnlyAPIProvider", {
|
|
175
151
|
enumerable: true,
|
|
176
152
|
get: function get() {
|
|
177
|
-
return
|
|
153
|
+
return _blockServiceAPI.useMemoizedBlockServiceFetchOnlyAPIProvider;
|
|
178
154
|
}
|
|
179
155
|
});
|
|
180
156
|
Object.defineProperty(exports, "useMemoizedSyncBlockStoreManager", {
|
|
@@ -198,7 +174,6 @@ var _ari = require("./clients/block-service/ari");
|
|
|
198
174
|
var _ari2 = require("./clients/confluence/ari");
|
|
199
175
|
var _ari3 = require("./clients/jira/ari");
|
|
200
176
|
var _blockServiceAPI = require("./providers/block-service/blockServiceAPI");
|
|
201
|
-
var _confluenceContentAPI = require("./providers/confluence/confluenceContentAPI");
|
|
202
177
|
var _sourceInfo = require("./clients/confluence/sourceInfo");
|
|
203
178
|
var _syncBlockProvider = require("./providers/syncBlockProvider");
|
|
204
179
|
var _syncBlockStoreManager = require("./store-manager/syncBlockStoreManager");
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useMemoizedBlockServiceAPIProviders = exports.fetchReferences = void 0;
|
|
7
|
+
exports.useMemoizedBlockServiceFetchOnlyAPIProvider = exports.useMemoizedBlockServiceAPIProviders = exports.fetchReferences = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -112,14 +112,14 @@ var fetchReferences = exports.fetchReferences = /*#__PURE__*/function () {
|
|
|
112
112
|
return _ref.apply(this, arguments);
|
|
113
113
|
};
|
|
114
114
|
}();
|
|
115
|
-
|
|
116
115
|
/**
|
|
117
116
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
118
117
|
*/
|
|
119
118
|
var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
120
|
-
function BlockServiceADFFetchProvider(
|
|
119
|
+
function BlockServiceADFFetchProvider(_ref3) {
|
|
120
|
+
var cloudId = _ref3.cloudId;
|
|
121
121
|
(0, _classCallCheck2.default)(this, BlockServiceADFFetchProvider);
|
|
122
|
-
this.
|
|
122
|
+
this.cloudId = cloudId;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
// resourceId of the reference synced block.
|
|
@@ -132,7 +132,10 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
132
132
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
133
133
|
while (1) switch (_context2.prev = _context2.next) {
|
|
134
134
|
case 0:
|
|
135
|
-
blockAri = (0, _ari.generateBlockAriFromReference)(
|
|
135
|
+
blockAri = (0, _ari.generateBlockAriFromReference)({
|
|
136
|
+
cloudId: this.cloudId,
|
|
137
|
+
resourceId: resourceId
|
|
138
|
+
});
|
|
136
139
|
_context2.prev = 1;
|
|
137
140
|
_context2.next = 4;
|
|
138
141
|
return (0, _blockService.getSyncedBlockContent)({
|
|
@@ -196,11 +199,17 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
196
199
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
197
200
|
*/
|
|
198
201
|
var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
199
|
-
function BlockServiceADFWriteProvider(
|
|
202
|
+
function BlockServiceADFWriteProvider(_ref4) {
|
|
203
|
+
var cloudId = _ref4.cloudId,
|
|
204
|
+
parentAri = _ref4.parentAri,
|
|
205
|
+
parentId = _ref4.parentId,
|
|
206
|
+
product = _ref4.product,
|
|
207
|
+
getVersion = _ref4.getVersion;
|
|
200
208
|
(0, _classCallCheck2.default)(this, BlockServiceADFWriteProvider);
|
|
201
|
-
this.
|
|
209
|
+
this.cloudId = cloudId;
|
|
210
|
+
this.parentAri = parentAri;
|
|
211
|
+
this.parentId = parentId;
|
|
202
212
|
this.product = product;
|
|
203
|
-
this.sourceDocumentId = sourceDocumentId;
|
|
204
213
|
this.getVersion = getVersion;
|
|
205
214
|
}
|
|
206
215
|
|
|
@@ -214,7 +223,12 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
214
223
|
while (1) switch (_context3.prev = _context3.next) {
|
|
215
224
|
case 0:
|
|
216
225
|
resourceId = data.resourceId;
|
|
217
|
-
blockAri = (0, _ari.generateBlockAri)(
|
|
226
|
+
blockAri = (0, _ari.generateBlockAri)({
|
|
227
|
+
cloudId: this.cloudId,
|
|
228
|
+
parentId: this.parentId,
|
|
229
|
+
product: this.product,
|
|
230
|
+
resourceId: resourceId
|
|
231
|
+
});
|
|
218
232
|
stepVersion = this.getVersion ? this.getVersion() : undefined;
|
|
219
233
|
_context3.prev = 3;
|
|
220
234
|
_context3.next = 6;
|
|
@@ -263,14 +277,19 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
263
277
|
while (1) switch (_context4.prev = _context4.next) {
|
|
264
278
|
case 0:
|
|
265
279
|
resourceId = data.resourceId;
|
|
266
|
-
blockAri = (0, _ari.generateBlockAri)(
|
|
280
|
+
blockAri = (0, _ari.generateBlockAri)({
|
|
281
|
+
cloudId: this.cloudId,
|
|
282
|
+
parentId: this.parentId,
|
|
283
|
+
product: this.product,
|
|
284
|
+
resourceId: resourceId
|
|
285
|
+
});
|
|
267
286
|
stepVersion = this.getVersion ? this.getVersion() : undefined;
|
|
268
287
|
_context4.prev = 3;
|
|
269
288
|
_context4.next = 6;
|
|
270
289
|
return (0, _blockService.createSyncedBlock)({
|
|
271
290
|
blockAri: blockAri,
|
|
272
291
|
blockInstanceId: data.blockInstanceId,
|
|
273
|
-
sourceAri: this.
|
|
292
|
+
sourceAri: this.parentAri,
|
|
274
293
|
product: this.product,
|
|
275
294
|
content: JSON.stringify(data.content),
|
|
276
295
|
stepVersion: stepVersion
|
|
@@ -314,7 +333,12 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
314
333
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
315
334
|
while (1) switch (_context5.prev = _context5.next) {
|
|
316
335
|
case 0:
|
|
317
|
-
blockAri = (0, _ari.generateBlockAri)(
|
|
336
|
+
blockAri = (0, _ari.generateBlockAri)({
|
|
337
|
+
cloudId: this.cloudId,
|
|
338
|
+
parentId: this.parentId,
|
|
339
|
+
product: this.product,
|
|
340
|
+
resourceId: resourceId
|
|
341
|
+
});
|
|
318
342
|
_context5.prev = 1;
|
|
319
343
|
_context5.next = 4;
|
|
320
344
|
return (0, _blockService.deleteSyncedBlock)({
|
|
@@ -367,7 +391,7 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
367
391
|
}, {
|
|
368
392
|
key: "generateResourceIdForReference",
|
|
369
393
|
value: function generateResourceIdForReference(sourceId) {
|
|
370
|
-
return "".concat(this.product, "/").concat(this.
|
|
394
|
+
return "".concat(this.product, "/").concat(this.parentId, "/").concat(sourceId);
|
|
371
395
|
}
|
|
372
396
|
}, {
|
|
373
397
|
key: "generateResourceId",
|
|
@@ -385,10 +409,13 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
385
409
|
_context6.prev = 0;
|
|
386
410
|
_context6.next = 3;
|
|
387
411
|
return (0, _blockService.updateReferenceSyncedBlockOnDocument)({
|
|
388
|
-
documentAri: this.
|
|
412
|
+
documentAri: this.parentAri,
|
|
389
413
|
blocks: blocks.map(function (block) {
|
|
390
414
|
return {
|
|
391
|
-
blockAri: (0, _ari.generateBlockAriFromReference)(
|
|
415
|
+
blockAri: (0, _ari.generateBlockAriFromReference)({
|
|
416
|
+
cloudId: _this.cloudId,
|
|
417
|
+
resourceId: block.resourceId
|
|
418
|
+
}),
|
|
392
419
|
blockInstanceId: block.localId
|
|
393
420
|
};
|
|
394
421
|
}),
|
|
@@ -427,19 +454,35 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
427
454
|
}()
|
|
428
455
|
}]);
|
|
429
456
|
}();
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
return {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
457
|
+
var useMemoizedBlockServiceAPIProviders = exports.useMemoizedBlockServiceAPIProviders = function useMemoizedBlockServiceAPIProviders(_ref5) {
|
|
458
|
+
var cloudId = _ref5.cloudId,
|
|
459
|
+
parentAri = _ref5.parentAri,
|
|
460
|
+
parentId = _ref5.parentId,
|
|
461
|
+
product = _ref5.product,
|
|
462
|
+
getVersion = _ref5.getVersion;
|
|
463
|
+
return (0, _react.useMemo)(function () {
|
|
464
|
+
return {
|
|
465
|
+
fetchProvider: new BlockServiceADFFetchProvider({
|
|
466
|
+
cloudId: cloudId
|
|
467
|
+
}),
|
|
468
|
+
writeProvider: new BlockServiceADFWriteProvider({
|
|
469
|
+
cloudId: cloudId,
|
|
470
|
+
parentAri: parentAri,
|
|
471
|
+
parentId: parentId,
|
|
472
|
+
product: product,
|
|
473
|
+
getVersion: getVersion
|
|
474
|
+
})
|
|
475
|
+
};
|
|
476
|
+
}, [cloudId, parentAri, parentId, product, getVersion]);
|
|
440
477
|
};
|
|
441
|
-
var
|
|
478
|
+
var useMemoizedBlockServiceFetchOnlyAPIProvider = exports.useMemoizedBlockServiceFetchOnlyAPIProvider = function useMemoizedBlockServiceFetchOnlyAPIProvider(_ref6) {
|
|
479
|
+
var cloudId = _ref6.cloudId;
|
|
442
480
|
return (0, _react.useMemo)(function () {
|
|
443
|
-
return
|
|
444
|
-
|
|
481
|
+
return {
|
|
482
|
+
fetchProvider: new BlockServiceADFFetchProvider({
|
|
483
|
+
cloudId: cloudId
|
|
484
|
+
}),
|
|
485
|
+
writeProvider: undefined
|
|
486
|
+
};
|
|
487
|
+
}, [cloudId]);
|
|
445
488
|
};
|