@atlaskit/editor-synced-block-provider 3.31.2 → 3.32.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 +18 -0
- package/dist/cjs/clients/block-service/blockService.js +21 -21
- package/dist/cjs/clients/confluence/fetchMediaToken.js +1 -2
- package/dist/cjs/clients/confluence/sourceInfo.js +27 -176
- package/dist/cjs/hooks/useFetchSyncBlockData.js +2 -9
- package/dist/cjs/hooks/useFetchSyncBlockTitle.js +8 -40
- package/dist/cjs/providers/block-service/blockServiceAPI.js +28 -41
- package/dist/cjs/providers/syncBlockProvider.js +22 -51
- package/dist/cjs/providers/types.js +3 -0
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +14 -29
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/cjs/store-manager/syncBlockStoreManager.js +3 -15
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +2 -2
- package/dist/cjs/utils/errorHandling.js +1 -10
- package/dist/cjs/utils/resolveSyncBlockInstance.js +11 -12
- package/dist/cjs/utils/retry.js +2 -23
- package/dist/es2019/clients/block-service/blockService.js +21 -21
- package/dist/es2019/clients/confluence/fetchMediaToken.js +1 -2
- package/dist/es2019/clients/confluence/sourceInfo.js +8 -126
- package/dist/es2019/hooks/useFetchSyncBlockData.js +1 -9
- package/dist/es2019/hooks/useFetchSyncBlockTitle.js +4 -33
- package/dist/es2019/providers/block-service/blockServiceAPI.js +18 -31
- package/dist/es2019/providers/syncBlockProvider.js +7 -29
- package/dist/es2019/providers/types.js +4 -0
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +27 -41
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/es2019/store-manager/syncBlockStoreManager.js +3 -13
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +2 -2
- package/dist/es2019/utils/errorHandling.js +1 -10
- package/dist/es2019/utils/resolveSyncBlockInstance.js +11 -12
- package/dist/es2019/utils/retry.js +2 -21
- package/dist/esm/clients/block-service/blockService.js +21 -21
- package/dist/esm/clients/confluence/fetchMediaToken.js +1 -2
- package/dist/esm/clients/confluence/sourceInfo.js +25 -176
- package/dist/esm/hooks/useFetchSyncBlockData.js +2 -9
- package/dist/esm/hooks/useFetchSyncBlockTitle.js +8 -40
- package/dist/esm/providers/block-service/blockServiceAPI.js +28 -41
- package/dist/esm/providers/syncBlockProvider.js +22 -51
- package/dist/esm/providers/types.js +4 -0
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +14 -29
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/esm/store-manager/syncBlockStoreManager.js +3 -15
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +2 -2
- package/dist/esm/utils/errorHandling.js +1 -10
- package/dist/esm/utils/resolveSyncBlockInstance.js +11 -12
- package/dist/esm/utils/retry.js +2 -23
- package/dist/types/clients/block-service/blockService.d.ts +3 -0
- package/dist/types/clients/confluence/sourceInfo.d.ts +1 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +5 -3
- package/dist/types/providers/syncBlockProvider.d.ts +2 -3
- package/dist/types/providers/types.d.ts +13 -3
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +1 -1
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +3 -0
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -3
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +5 -3
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -3
- package/dist/types-ts4.5/providers/types.d.ts +13 -3
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +1 -1
- package/package.json +3 -10
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.resolveSyncBlockInstance = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _ari = require("../clients/confluence/ari");
|
|
11
10
|
var _types = require("../common/types");
|
|
12
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -23,7 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
23
22
|
* @returns A merged SyncBlockInstance object.
|
|
24
23
|
*/
|
|
25
24
|
var resolveSyncBlockInstance = exports.resolveSyncBlockInstance = function resolveSyncBlockInstance(oldResult, newResult) {
|
|
26
|
-
var _newResult$data, _oldResult$data, _newResult$data2, _oldResult$data2, _newResult$data3, _oldResult$data3
|
|
25
|
+
var _newResult$data, _oldResult$data, _newResult$data2, _oldResult$data2, _newResult$data3, _oldResult$data3;
|
|
27
26
|
// if the old result has no data, we simply return the new result
|
|
28
27
|
if (!oldResult.data) {
|
|
29
28
|
return newResult;
|
|
@@ -42,30 +41,30 @@ var resolveSyncBlockInstance = exports.resolveSyncBlockInstance = function resol
|
|
|
42
41
|
data: _objectSpread(_objectSpread({}, newResult.data), {}, {
|
|
43
42
|
sourceURL: ((_newResult$data = newResult.data) === null || _newResult$data === void 0 ? void 0 : _newResult$data.sourceURL) || ((_oldResult$data = oldResult.data) === null || _oldResult$data === void 0 ? void 0 : _oldResult$data.sourceURL) || undefined,
|
|
44
43
|
sourceTitle: ((_newResult$data2 = newResult.data) === null || _newResult$data2 === void 0 ? void 0 : _newResult$data2.sourceTitle) || ((_oldResult$data2 = oldResult.data) === null || _oldResult$data2 === void 0 ? void 0 : _oldResult$data2.sourceTitle) || undefined,
|
|
45
|
-
sourceSubType:
|
|
46
|
-
onSameDocument: ((_newResult$
|
|
44
|
+
sourceSubType: mergeSubType(oldResult, newResult),
|
|
45
|
+
onSameDocument: ((_newResult$data3 = newResult.data) === null || _newResult$data3 === void 0 ? void 0 : _newResult$data3.onSameDocument) || ((_oldResult$data3 = oldResult.data) === null || _oldResult$data3 === void 0 ? void 0 : _oldResult$data3.onSameDocument) || undefined
|
|
47
46
|
})
|
|
48
47
|
});
|
|
49
48
|
};
|
|
50
49
|
var mergeSubType = function mergeSubType(oldResult, newResult) {
|
|
51
|
-
var _newResult$
|
|
50
|
+
var _newResult$data4, _newResult$data5, _oldResult$data4;
|
|
52
51
|
// for classic pages, subType is 'null'
|
|
53
|
-
if (((_newResult$
|
|
52
|
+
if (((_newResult$data4 = newResult.data) === null || _newResult$data4 === void 0 ? void 0 : _newResult$data4.sourceSubType) !== undefined) {
|
|
54
53
|
return newResult.data.sourceSubType;
|
|
55
54
|
}
|
|
56
|
-
if ((_newResult$
|
|
55
|
+
if ((_newResult$data5 = newResult.data) !== null && _newResult$data5 !== void 0 && _newResult$data5.sourceAri) {
|
|
57
56
|
// for blogposts, subType is always undefined
|
|
58
57
|
try {
|
|
59
|
-
var _newResult$
|
|
58
|
+
var _newResult$data6;
|
|
60
59
|
var _getPageIdAndTypeFrom = (0, _ari.getPageIdAndTypeFromConfluencePageAri)({
|
|
61
|
-
ari: (_newResult$
|
|
60
|
+
ari: (_newResult$data6 = newResult.data) === null || _newResult$data6 === void 0 ? void 0 : _newResult$data6.sourceAri
|
|
62
61
|
}),
|
|
63
62
|
pageType = _getPageIdAndTypeFrom.type;
|
|
64
63
|
if (pageType === 'blogpost') {
|
|
65
|
-
var _newResult$
|
|
66
|
-
return (_newResult$
|
|
64
|
+
var _newResult$data7;
|
|
65
|
+
return (_newResult$data7 = newResult.data) === null || _newResult$data7 === void 0 ? void 0 : _newResult$data7.sourceSubType;
|
|
67
66
|
}
|
|
68
67
|
} catch (_unused) {}
|
|
69
68
|
}
|
|
70
|
-
return (_oldResult$
|
|
69
|
+
return (_oldResult$data4 = oldResult.data) === null || _oldResult$data4 === void 0 ? void 0 : _oldResult$data4.sourceSubType;
|
|
71
70
|
};
|
package/dist/cjs/utils/retry.js
CHANGED
|
@@ -7,26 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.fetchWithRetry = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
-
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
12
10
|
var MAX_RETRY_DELAY = 30000;
|
|
13
|
-
var
|
|
14
|
-
var newDelay;
|
|
15
|
-
|
|
16
|
-
// retryAfter can either be in seconds or HTTP date
|
|
17
|
-
var parsedRetryAfter = parseInt(retryAfter);
|
|
18
|
-
if (!isNaN(parsedRetryAfter)) {
|
|
19
|
-
newDelay = parsedRetryAfter * 1000;
|
|
20
|
-
} else {
|
|
21
|
-
var retryDate = new Date(retryAfter);
|
|
22
|
-
var delayFromDate = retryDate.getTime() - Date.now();
|
|
23
|
-
if (delayFromDate > 0) {
|
|
24
|
-
newDelay = delayFromDate;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return newDelay;
|
|
28
|
-
};
|
|
29
|
-
var parseRetryAfterPatched = function parseRetryAfterPatched(retryAfter) {
|
|
11
|
+
var parseRetryAfter = function parseRetryAfter(retryAfter) {
|
|
30
12
|
// retryAfter can either be in seconds or HTTP date
|
|
31
13
|
var parsedRetryAfter = parseInt(retryAfter, 10);
|
|
32
14
|
if (!isNaN(parsedRetryAfter) && parsedRetryAfter > 0) {
|
|
@@ -42,9 +24,6 @@ var parseRetryAfterPatched = function parseRetryAfterPatched(retryAfter) {
|
|
|
42
24
|
}
|
|
43
25
|
return undefined;
|
|
44
26
|
};
|
|
45
|
-
var parseRetryAfter = (0, _platformFeatureFlagsReact.functionWithCondition)(function () {
|
|
46
|
-
return (0, _platformFeatureFlags.fg)('platform_synced_block_patch_4');
|
|
47
|
-
}, parseRetryAfterPatched, parseRetryAfterBase);
|
|
48
27
|
var _fetchWithRetry = exports.fetchWithRetry = /*#__PURE__*/function () {
|
|
49
28
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, options) {
|
|
50
29
|
var _ref2;
|
|
@@ -74,7 +53,7 @@ var _fetchWithRetry = exports.fetchWithRetry = /*#__PURE__*/function () {
|
|
|
74
53
|
case 8:
|
|
75
54
|
retryAfter = response.headers.get('Retry-After');
|
|
76
55
|
parsedDelay = (_ref2 = retryAfter ? parseRetryAfter(retryAfter) : undefined) !== null && _ref2 !== void 0 ? _ref2 : delay;
|
|
77
|
-
retryDelay =
|
|
56
|
+
retryDelay = Math.min(parsedDelay, MAX_RETRY_DELAY);
|
|
78
57
|
_context.next = 13;
|
|
79
58
|
return new Promise(function (resolve) {
|
|
80
59
|
return setTimeout(resolve, retryDelay);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { fetchWithRetry } from '../../utils/retry';
|
|
3
2
|
export const isBlockContentResponse = response => {
|
|
4
3
|
const content = response.content;
|
|
@@ -50,7 +49,7 @@ export const getReferenceSyncedBlocks = async documentAri => {
|
|
|
50
49
|
query: buildGetDocumentReferenceBlocksQuery(documentAri),
|
|
51
50
|
operationName: GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME
|
|
52
51
|
};
|
|
53
|
-
const url =
|
|
52
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockGetDocumentReferenceBlocks`;
|
|
54
53
|
const response = await fetchWithRetry(url, {
|
|
55
54
|
method: 'POST',
|
|
56
55
|
headers: COMMON_HEADERS,
|
|
@@ -83,7 +82,7 @@ const GET_BLOCK_REFERENCES_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_REFERENCES'
|
|
|
83
82
|
const GET_BLOCK_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_BLOCK';
|
|
84
83
|
const BATCH_UPDATE_BLOCKS_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_BATCH_UPDATE_BLOCKS';
|
|
85
84
|
const buildGetDocumentReferenceBlocksQuery = documentAri => `query ${GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME} {
|
|
86
|
-
blockService_getDocumentReferenceBlocks(documentAri: ${
|
|
85
|
+
blockService_getDocumentReferenceBlocks(documentAri: ${JSON.stringify(documentAri)}) {
|
|
87
86
|
blocks {
|
|
88
87
|
blockAri
|
|
89
88
|
blockInstanceId
|
|
@@ -306,7 +305,7 @@ export const getSyncedBlockContent = async ({
|
|
|
306
305
|
query: buildGetBlockQuery(blockAri),
|
|
307
306
|
operationName: GET_BLOCK_OPERATION_NAME
|
|
308
307
|
};
|
|
309
|
-
const url =
|
|
308
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockGetBlock`;
|
|
310
309
|
const response = await fetchWithRetry(url, {
|
|
311
310
|
method: 'POST',
|
|
312
311
|
headers: COMMON_HEADERS,
|
|
@@ -331,6 +330,7 @@ export const getSyncedBlockContent = async ({
|
|
|
331
330
|
* Calls the Block Service GraphQL API: `blockService_batchRetrieveBlocks`
|
|
332
331
|
*
|
|
333
332
|
* @param blockIdentifiers - Array of block identifiers to retrieve
|
|
333
|
+
* @param config - Optional batch fetch configuration (e.g. timeout)
|
|
334
334
|
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
335
335
|
*/
|
|
336
336
|
export const batchRetrieveSyncedBlocks = async ({
|
|
@@ -342,7 +342,7 @@ export const batchRetrieveSyncedBlocks = async ({
|
|
|
342
342
|
query: buildBatchRetrieveBlocksQuery(blockAris),
|
|
343
343
|
operationName: BATCH_RETRIEVE_BLOCKS_OPERATION_NAME
|
|
344
344
|
};
|
|
345
|
-
const url =
|
|
345
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockBatchRetrieveBlocks`;
|
|
346
346
|
const response = await fetchWithRetry(url, {
|
|
347
347
|
method: 'POST',
|
|
348
348
|
headers: COMMON_HEADERS,
|
|
@@ -368,12 +368,12 @@ export const deleteSyncedBlock = async ({
|
|
|
368
368
|
blockAri,
|
|
369
369
|
deleteReason
|
|
370
370
|
}) => {
|
|
371
|
-
var _result$data3, _result$data3$blockSe
|
|
371
|
+
var _result$data3, _result$data3$blockSe;
|
|
372
372
|
const bodyData = {
|
|
373
373
|
query: buildDeleteBlockMutation(blockAri, deleteReason),
|
|
374
374
|
operationName: DELETE_BLOCK_OPERATION_NAME
|
|
375
375
|
};
|
|
376
|
-
const url =
|
|
376
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockDeleteBlock`;
|
|
377
377
|
const response = await fetchWithRetry(url, {
|
|
378
378
|
method: 'POST',
|
|
379
379
|
headers: COMMON_HEADERS,
|
|
@@ -386,7 +386,7 @@ export const deleteSyncedBlock = async ({
|
|
|
386
386
|
if (result.errors && result.errors.length > 0) {
|
|
387
387
|
throw new Error(result.errors.map(e => e.message).join(', '));
|
|
388
388
|
}
|
|
389
|
-
const isDeleted =
|
|
389
|
+
const isDeleted = (_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : (_result$data3$blockSe = _result$data3.blockService_deleteBlock) === null || _result$data3$blockSe === void 0 ? void 0 : _result$data3$blockSe.deleted;
|
|
390
390
|
if (!isDeleted) {
|
|
391
391
|
throw new Error('Block deletion failed; deleted flag is false');
|
|
392
392
|
}
|
|
@@ -401,7 +401,7 @@ export const updateSyncedBlock = async ({
|
|
|
401
401
|
query: buildUpdateBlockMutation(blockAri, content, stepVersion, status),
|
|
402
402
|
operationName: UPDATE_BLOCK_OPERATION_NAME
|
|
403
403
|
};
|
|
404
|
-
const url =
|
|
404
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockUpdateBlock`;
|
|
405
405
|
const response = await fetchWithRetry(url, {
|
|
406
406
|
method: 'POST',
|
|
407
407
|
headers: COMMON_HEADERS,
|
|
@@ -424,12 +424,12 @@ export const createSyncedBlock = async ({
|
|
|
424
424
|
stepVersion,
|
|
425
425
|
status
|
|
426
426
|
}) => {
|
|
427
|
-
var _result$
|
|
427
|
+
var _result$data4;
|
|
428
428
|
const bodyData = {
|
|
429
429
|
query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status),
|
|
430
430
|
operationName: CREATE_BLOCK_OPERATION_NAME
|
|
431
431
|
};
|
|
432
|
-
const url =
|
|
432
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockCreateBlock`;
|
|
433
433
|
const response = await fetchWithRetry(url, {
|
|
434
434
|
method: 'POST',
|
|
435
435
|
headers: COMMON_HEADERS,
|
|
@@ -442,7 +442,7 @@ export const createSyncedBlock = async ({
|
|
|
442
442
|
if (result.errors && result.errors.length > 0) {
|
|
443
443
|
throw new Error(result.errors.map(e => e.message).join(', '));
|
|
444
444
|
}
|
|
445
|
-
if (!((_result$
|
|
445
|
+
if (!((_result$data4 = result.data) !== null && _result$data4 !== void 0 && _result$data4.blockService_createBlock)) {
|
|
446
446
|
throw new Error('No data returned from GraphQL mutation');
|
|
447
447
|
}
|
|
448
448
|
return result.data.blockService_createBlock;
|
|
@@ -456,7 +456,7 @@ export const updateReferenceSyncedBlockOnDocument = async ({
|
|
|
456
456
|
query: buildUpdateDocumentReferencesMutation(documentAri, blocks, noContent),
|
|
457
457
|
operationName: UPDATE_DOCUMENT_REFERENCES_OPERATION_NAME
|
|
458
458
|
};
|
|
459
|
-
const url =
|
|
459
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockUpdateDocumentReferences`;
|
|
460
460
|
const response = await fetchWithRetry(url, {
|
|
461
461
|
method: 'POST',
|
|
462
462
|
headers: COMMON_HEADERS,
|
|
@@ -471,8 +471,8 @@ export const updateReferenceSyncedBlockOnDocument = async ({
|
|
|
471
471
|
throw new Error(result.errors.map(e => e.message).join(', '));
|
|
472
472
|
}
|
|
473
473
|
if (!noContent) {
|
|
474
|
-
var _result$
|
|
475
|
-
if (!((_result$
|
|
474
|
+
var _result$data5;
|
|
475
|
+
if (!((_result$data5 = result.data) !== null && _result$data5 !== void 0 && _result$data5.blockService_updateDocumentReferences)) {
|
|
476
476
|
throw new Error('No data returned from GraphQL mutation');
|
|
477
477
|
}
|
|
478
478
|
return result.data.blockService_updateDocumentReferences;
|
|
@@ -481,12 +481,12 @@ export const updateReferenceSyncedBlockOnDocument = async ({
|
|
|
481
481
|
export const getReferenceSyncedBlocksByBlockAri = async ({
|
|
482
482
|
blockAri
|
|
483
483
|
}) => {
|
|
484
|
-
var _result$
|
|
484
|
+
var _result$data6;
|
|
485
485
|
const bodyData = {
|
|
486
486
|
query: buildGetBlockReferencesQuery(blockAri),
|
|
487
487
|
operationName: GET_BLOCK_REFERENCES_OPERATION_NAME
|
|
488
488
|
};
|
|
489
|
-
const url =
|
|
489
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockGetReferences`;
|
|
490
490
|
const response = await fetchWithRetry(url, {
|
|
491
491
|
method: 'POST',
|
|
492
492
|
headers: COMMON_HEADERS,
|
|
@@ -499,7 +499,7 @@ export const getReferenceSyncedBlocksByBlockAri = async ({
|
|
|
499
499
|
if (result.errors && result.errors.length > 0) {
|
|
500
500
|
throw new Error(result.errors.map(e => e.message).join(', '));
|
|
501
501
|
}
|
|
502
|
-
if (!((_result$
|
|
502
|
+
if (!((_result$data6 = result.data) !== null && _result$data6 !== void 0 && _result$data6.blockService_getReferences)) {
|
|
503
503
|
throw new Error('No data returned from GraphQL query');
|
|
504
504
|
}
|
|
505
505
|
const graphqlResponse = result.data.blockService_getReferences;
|
|
@@ -535,12 +535,12 @@ export const getReferenceSyncedBlocksByBlockAri = async ({
|
|
|
535
535
|
export const updateSyncedBlocks = async ({
|
|
536
536
|
blocks
|
|
537
537
|
}) => {
|
|
538
|
-
var _result$
|
|
538
|
+
var _result$data7;
|
|
539
539
|
const bodyData = {
|
|
540
540
|
query: buildBatchUpdateBlocksMutation(blocks),
|
|
541
541
|
operationName: BATCH_UPDATE_BLOCKS_OPERATION_NAME
|
|
542
542
|
};
|
|
543
|
-
const url =
|
|
543
|
+
const url = `${GRAPHQL_ENDPOINT}?operation=editorSyncedBlockBatchUpdateBlocks`;
|
|
544
544
|
const response = await fetchWithRetry(url, {
|
|
545
545
|
method: 'POST',
|
|
546
546
|
headers: COMMON_HEADERS,
|
|
@@ -553,7 +553,7 @@ export const updateSyncedBlocks = async ({
|
|
|
553
553
|
if (result.errors && result.errors.length > 0) {
|
|
554
554
|
throw new Error(result.errors.map(e => e.message).join(', '));
|
|
555
555
|
}
|
|
556
|
-
if (!((_result$
|
|
556
|
+
if (!((_result$data7 = result.data) !== null && _result$data7 !== void 0 && _result$data7.blockService_batchUpdateBlocks)) {
|
|
557
557
|
throw new Error('No data returned from GraphQL mutation');
|
|
558
558
|
}
|
|
559
559
|
const graphqlResponse = result.data.blockService_batchUpdateBlocks;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { fetchWithRetry } from '../../utils/retry';
|
|
4
3
|
const COMMON_HEADERS = {
|
|
5
4
|
'Content-Type': 'application/json',
|
|
@@ -64,7 +63,7 @@ export const fetchMediaToken = async contentId => {
|
|
|
64
63
|
logException(error, {
|
|
65
64
|
location: 'editor-synced-block-provider/fetchMediaToken'
|
|
66
65
|
});
|
|
67
|
-
const errorMsg =
|
|
66
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
68
67
|
throw new Error(`Failed to get content media session: ${errorMsg}`);
|
|
69
68
|
}
|
|
70
69
|
};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/* eslint-disable require-unicode-regexp */
|
|
2
|
-
|
|
3
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import { getSourceInfoErrorPayload } from '../../utils/errorHandling';
|
|
6
1
|
import { fetchWithRetry } from '../../utils/retry';
|
|
7
|
-
import { getPageIdAndTypeFromConfluencePageAri } from './ari';
|
|
8
|
-
import { isBlogPageType } from './utils';
|
|
9
2
|
const COMMON_HEADERS = {
|
|
10
3
|
'Content-Type': 'application/json',
|
|
11
4
|
Accept: 'application/json'
|
|
@@ -88,110 +81,12 @@ const resolveNoAccessPageInfo = async ari => {
|
|
|
88
81
|
throw new Error(`Failed to resolve ari: ${response.statusText}`);
|
|
89
82
|
}
|
|
90
83
|
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Fetches unpublished page info from the v2 pages API
|
|
94
|
-
* Used when the GraphQL query returns empty content.nodes for unpublished pages
|
|
95
|
-
* @param pageAri - The page ARI
|
|
96
|
-
* @param localId - Optional local ID to append as block anchor
|
|
97
|
-
* @returns Source info with URL, title, and optional subtype
|
|
98
|
-
*/
|
|
99
|
-
const fetchCompleteConfluencePageInfo = async (pageAri, localId) => {
|
|
100
|
-
try {
|
|
101
|
-
var _pageData$_links, _pageData$_links2;
|
|
102
|
-
const {
|
|
103
|
-
id: pageId
|
|
104
|
-
} = getPageIdAndTypeFromConfluencePageAri({
|
|
105
|
-
ari: pageAri
|
|
106
|
-
});
|
|
107
|
-
const response = await fetchWithRetry(`/wiki/api/v2/pages/${pageId}?draft=true`, {
|
|
108
|
-
method: 'GET',
|
|
109
|
-
headers: COMMON_HEADERS
|
|
110
|
-
});
|
|
111
|
-
if (!response.ok) {
|
|
112
|
-
throw new Error(`Failed to get unpublished page info: ${response.statusText}`);
|
|
113
|
-
}
|
|
114
|
-
const pageData = await response.json();
|
|
115
|
-
const base = (_pageData$_links = pageData._links) === null || _pageData$_links === void 0 ? void 0 : _pageData$_links.base;
|
|
116
|
-
const edituiv2 = (_pageData$_links2 = pageData._links) === null || _pageData$_links2 === void 0 ? void 0 : _pageData$_links2.edituiv2;
|
|
117
|
-
const title = pageData.title;
|
|
118
|
-
const subType = pageData.subtype;
|
|
119
|
-
let url;
|
|
120
|
-
if (base && edituiv2) {
|
|
121
|
-
url = `${base}${edituiv2}`;
|
|
122
|
-
url = url && localId ? `${url}#block-${localId}` : url;
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
title,
|
|
126
|
-
url,
|
|
127
|
-
sourceAri: pageAri,
|
|
128
|
-
subType
|
|
129
|
-
};
|
|
130
|
-
} catch (error) {
|
|
131
|
-
logException(error, {
|
|
132
|
-
location: 'editor-synced-block-provider/sourceInfo/fetchUnpublishedConfluencePageInfo'
|
|
133
|
-
});
|
|
134
|
-
return Promise.resolve(undefined);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
export const fetchConfluencePageInfoOld = async (pageAri, localId, fireAnalyticsEvent) => {
|
|
138
|
-
try {
|
|
139
|
-
var _response$data, _response$data$conten, _response$data$conten2, _contentData$space;
|
|
140
|
-
const {
|
|
141
|
-
type: pageType
|
|
142
|
-
} = getPageIdAndTypeFromConfluencePageAri({
|
|
143
|
-
ari: pageAri
|
|
144
|
-
});
|
|
145
|
-
const status = fg('platform_synced_block_patch_3') ? ['draft', 'archived', 'current'] : undefined;
|
|
146
|
-
const response = await getConfluenceSourceInfo(pageAri, status);
|
|
147
|
-
const contentData = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$conten = _response$data.content) === null || _response$data$conten === void 0 ? void 0 : (_response$data$conten2 = _response$data$conten.nodes) === null || _response$data$conten2 === void 0 ? void 0 : _response$data$conten2[0];
|
|
148
|
-
const title = contentData === null || contentData === void 0 ? void 0 : contentData.title;
|
|
149
|
-
let url;
|
|
150
|
-
const {
|
|
151
|
-
base
|
|
152
|
-
} = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {};
|
|
153
|
-
if (base && contentData !== null && contentData !== void 0 && (_contentData$space = contentData.space) !== null && _contentData$space !== void 0 && _contentData$space.key && contentData !== null && contentData !== void 0 && contentData.id) {
|
|
154
|
-
if (isBlogPageType(pageType)) {
|
|
155
|
-
url = `${base}/spaces/${contentData.space.key}/blog/edit-v2/${contentData.id}`;
|
|
156
|
-
} else if (contentData.subType === 'live') {
|
|
157
|
-
url = `${base}/spaces/${contentData.space.key}/pages/${contentData.id}`;
|
|
158
|
-
} else {
|
|
159
|
-
url = `${base}/spaces/${contentData.space.key}/pages/edit-v2/${contentData.id}`;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
url = url && localId ? `${url}#block-${localId}` : url;
|
|
163
|
-
if (!title || !url) {
|
|
164
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(getSourceInfoErrorPayload('Failed to get confluence page source info'));
|
|
165
|
-
}
|
|
166
|
-
return Promise.resolve({
|
|
167
|
-
title,
|
|
168
|
-
url,
|
|
169
|
-
sourceAri: pageAri
|
|
170
|
-
});
|
|
171
|
-
} catch (error) {
|
|
172
|
-
logException(error, {
|
|
173
|
-
location: 'editor-synced-block-provider/sourceInfo'
|
|
174
|
-
});
|
|
175
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(getSourceInfoErrorPayload(error.message));
|
|
176
|
-
return Promise.resolve(undefined);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
export const fetchConfluencePageInfo = async (pageAri, hasAccess, urlType, localId, isUnpublished) => {
|
|
180
|
-
// For unpublished pages, use the v2 pages API as GraphQL returns empty content.nodes
|
|
181
|
-
// We don't want to use the Rest API at all because it doesn't work if accessed from a custom base URL (e.g in Jira)
|
|
182
|
-
if (isUnpublished && !fg('platform_synced_block_patch_3')) {
|
|
183
|
-
return await fetchCompleteConfluencePageInfo(pageAri, localId);
|
|
184
|
-
}
|
|
84
|
+
export const fetchConfluencePageInfo = async (pageAri, hasAccess, localId) => {
|
|
185
85
|
if (hasAccess) {
|
|
186
|
-
var _response$
|
|
187
|
-
const
|
|
188
|
-
type: pageType
|
|
189
|
-
} = getPageIdAndTypeFromConfluencePageAri({
|
|
190
|
-
ari: pageAri
|
|
191
|
-
});
|
|
192
|
-
const status = fg('platform_synced_block_patch_3') ? ['draft', 'archived', 'current'] : undefined;
|
|
86
|
+
var _response$data, _response$data$conten, _response$data$conten2;
|
|
87
|
+
const status = ['draft', 'archived', 'current'];
|
|
193
88
|
const response = await getConfluenceSourceInfo(pageAri, status);
|
|
194
|
-
const contentData = (_response$
|
|
89
|
+
const contentData = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$conten = _response$data.content) === null || _response$data$conten === void 0 ? void 0 : (_response$data$conten2 = _response$data$conten.nodes) === null || _response$data$conten2 === void 0 ? void 0 : _response$data$conten2[0];
|
|
195
90
|
const {
|
|
196
91
|
title,
|
|
197
92
|
subType
|
|
@@ -203,23 +98,10 @@ export const fetchConfluencePageInfo = async (pageAri, hasAccess, urlType, local
|
|
|
203
98
|
webui
|
|
204
99
|
} = (contentData === null || contentData === void 0 ? void 0 : contentData.links) || {};
|
|
205
100
|
const pageStatus = contentData === null || contentData === void 0 ? void 0 : contentData.status;
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
url = `${base}${webui}`;
|
|
211
|
-
}
|
|
212
|
-
} else {
|
|
213
|
-
var _contentData$space2;
|
|
214
|
-
if (base && contentData !== null && contentData !== void 0 && (_contentData$space2 = contentData.space) !== null && _contentData$space2 !== void 0 && _contentData$space2.key && contentData !== null && contentData !== void 0 && contentData.id) {
|
|
215
|
-
if (isBlogPageType(pageType)) {
|
|
216
|
-
url = `${base}/spaces/${contentData.space.key}/blog${urlType === 'edit' ? '/edit-v2' : ''}/${contentData.id}`;
|
|
217
|
-
} else if (contentData.subType === 'live') {
|
|
218
|
-
url = `${base}/spaces/${contentData.space.key}/pages/${contentData.id}`;
|
|
219
|
-
} else {
|
|
220
|
-
url = `${base}/spaces/${contentData.space.key}/pages${urlType === 'edit' ? '/edit-v2' : ''}/${contentData.id}`;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
101
|
+
if (base && editui && pageStatus !== 'archived') {
|
|
102
|
+
url = `${base}${editui}`;
|
|
103
|
+
} else if (base && webui && pageStatus === 'archived') {
|
|
104
|
+
url = `${base}${webui}`;
|
|
223
105
|
}
|
|
224
106
|
url = url && localId ? `${url}#block-${localId}` : url;
|
|
225
107
|
return Promise.resolve({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { SyncBlockError } from '../common/types';
|
|
6
5
|
import { fetchErrorPayload } from '../utils/errorHandling';
|
|
7
6
|
import { createSyncBlockNode } from '../utils/utils';
|
|
@@ -47,14 +46,7 @@ export const useFetchSyncBlockData = (manager, resourceId, localId, fireAnalytic
|
|
|
47
46
|
logException(error, {
|
|
48
47
|
location: 'editor-synced-block-provider/useFetchSyncBlockData'
|
|
49
48
|
});
|
|
50
|
-
|
|
51
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(fetchErrorPayload(error.message));
|
|
52
|
-
} else {
|
|
53
|
-
var _manager$referenceMan2, _manager$referenceMan3;
|
|
54
|
-
manager === null || manager === void 0 ? void 0 : (_manager$referenceMan2 = manager.referenceManager) === null || _manager$referenceMan2 === void 0 ? void 0 : (_manager$referenceMan3 = _manager$referenceMan2.fetchExperience) === null || _manager$referenceMan3 === void 0 ? void 0 : _manager$referenceMan3.failure({
|
|
55
|
-
reason: error.message
|
|
56
|
-
});
|
|
57
|
-
}
|
|
49
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(fetchErrorPayload(error.message));
|
|
58
50
|
|
|
59
51
|
// Set error state if fetching fails
|
|
60
52
|
setFetchState({
|
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
4
|
-
const useFetchSyncBlockTitleBase = (manager, syncBlockNode) => {
|
|
5
|
-
// Initialize state from cache to prevent flickering during re-renders
|
|
6
|
-
const [sourceTitle, setSourceTitle] = useState(() => {
|
|
7
|
-
var _cachedData$data;
|
|
8
|
-
if (syncBlockNode.type.name !== 'syncBlock') {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
const {
|
|
12
|
-
resourceId
|
|
13
|
-
} = syncBlockNode.attrs;
|
|
14
|
-
if (!resourceId) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const cachedData = manager.referenceManager.getFromCache(resourceId);
|
|
18
|
-
return cachedData === null || cachedData === void 0 ? void 0 : (_cachedData$data = cachedData.data) === null || _cachedData$data === void 0 ? void 0 : _cachedData$data.sourceTitle;
|
|
19
|
-
});
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
const unsubscribe = manager.referenceManager.subscribeToSourceTitle(syncBlockNode, title => {
|
|
22
|
-
setSourceTitle(title);
|
|
23
|
-
});
|
|
24
|
-
return () => {
|
|
25
|
-
unsubscribe();
|
|
26
|
-
};
|
|
27
|
-
}, [manager, syncBlockNode]);
|
|
28
|
-
return sourceTitle;
|
|
29
|
-
};
|
|
30
|
-
const useFetchSyncBlockTitlePatched = (manager, syncBlockNode) => {
|
|
2
|
+
export const useFetchSyncBlockTitle = (manager, syncBlockNode) => {
|
|
31
3
|
var _syncBlockNode$attrs, _syncBlockNode$attrs2;
|
|
32
4
|
const nodeRef = useRef(syncBlockNode);
|
|
33
5
|
nodeRef.current = syncBlockNode;
|
|
@@ -37,7 +9,7 @@ const useFetchSyncBlockTitlePatched = (manager, syncBlockNode) => {
|
|
|
37
9
|
|
|
38
10
|
// Initialize state from cache to prevent flickering during re-renders
|
|
39
11
|
const [sourceTitle, setSourceTitle] = useState(() => {
|
|
40
|
-
var _cachedData$
|
|
12
|
+
var _cachedData$data;
|
|
41
13
|
if (nodeTypeName !== 'syncBlock') {
|
|
42
14
|
return undefined;
|
|
43
15
|
}
|
|
@@ -45,7 +17,7 @@ const useFetchSyncBlockTitlePatched = (manager, syncBlockNode) => {
|
|
|
45
17
|
return undefined;
|
|
46
18
|
}
|
|
47
19
|
const cachedData = manager.referenceManager.getFromCache(resourceId);
|
|
48
|
-
return cachedData === null || cachedData === void 0 ? void 0 : (_cachedData$
|
|
20
|
+
return cachedData === null || cachedData === void 0 ? void 0 : (_cachedData$data = cachedData.data) === null || _cachedData$data === void 0 ? void 0 : _cachedData$data.sourceTitle;
|
|
49
21
|
});
|
|
50
22
|
useEffect(() => {
|
|
51
23
|
const unsubscribe = manager.referenceManager.subscribeToSourceTitle(nodeRef.current, title => {
|
|
@@ -56,5 +28,4 @@ const useFetchSyncBlockTitlePatched = (manager, syncBlockNode) => {
|
|
|
56
28
|
};
|
|
57
29
|
}, [manager, nodeTypeName, resourceId, localId]);
|
|
58
30
|
return sourceTitle;
|
|
59
|
-
};
|
|
60
|
-
export const useFetchSyncBlockTitle = conditionalHooksFactory(() => fg('platform_synced_block_patch_4'), useFetchSyncBlockTitlePatched, useFetchSyncBlockTitleBase);
|
|
31
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable require-unicode-regexp */
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { generateBlockAri, generateBlockAriFromReference } from '../../clients/block-service/ari';
|
|
5
4
|
import { batchRetrieveSyncedBlocks, BlockError, createSyncedBlock, deleteSyncedBlock, getReferenceSyncedBlocks, getReferenceSyncedBlocksByBlockAri, getSyncedBlockContent, updateReferenceSyncedBlockOnDocument, updateSyncedBlock, updateSyncedBlocks } from '../../clients/block-service/blockService';
|
|
6
5
|
import { subscribeToBlockUpdates as subscribeToBlockUpdatesWS } from '../../clients/block-service/blockSubscription';
|
|
@@ -167,9 +166,10 @@ export const extractResourceIdFromBlockAri = blockAri => {
|
|
|
167
166
|
* @param cloudId - The cloudId of the block. E.G the cloudId of the confluence page, or the cloudId of the Jira instance
|
|
168
167
|
* @param parentAri - The ARI of the parent of the block. E.G the ARI of the confluence page, or the ARI of the Jira work item
|
|
169
168
|
* @param blockNodeIdentifiers - Array of block node identifiers to fetch
|
|
169
|
+
* @param config - Optional batch fetch configuration
|
|
170
170
|
* @returns Array of SyncBlockInstance results
|
|
171
171
|
*/
|
|
172
|
-
export const batchFetchData = async (cloudId, parentAri, blockNodeIdentifiers) => {
|
|
172
|
+
export const batchFetchData = async (cloudId, parentAri, blockNodeIdentifiers, config) => {
|
|
173
173
|
const blockIdentifiers = blockNodeIdentifiers.map(blockIdentifier => ({
|
|
174
174
|
blockAri: generateBlockAriFromReference({
|
|
175
175
|
cloudId,
|
|
@@ -193,7 +193,8 @@ export const batchFetchData = async (cloudId, parentAri, blockNodeIdentifiers) =
|
|
|
193
193
|
}
|
|
194
194
|
try {
|
|
195
195
|
const response = await batchRetrieveSyncedBlocks({
|
|
196
|
-
blockIdentifiers
|
|
196
|
+
blockIdentifiers,
|
|
197
|
+
config
|
|
197
198
|
});
|
|
198
199
|
const results = [];
|
|
199
200
|
|
|
@@ -243,22 +244,13 @@ export const batchFetchData = async (cloudId, parentAri, blockNodeIdentifiers) =
|
|
|
243
244
|
resourceId
|
|
244
245
|
});
|
|
245
246
|
} catch {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
});
|
|
254
|
-
} else {
|
|
255
|
-
results.push({
|
|
256
|
-
error: {
|
|
257
|
-
type: SyncBlockError.Errored
|
|
258
|
-
},
|
|
259
|
-
resourceId
|
|
260
|
-
});
|
|
261
|
-
}
|
|
247
|
+
results.push({
|
|
248
|
+
error: {
|
|
249
|
+
type: SyncBlockError.Errored,
|
|
250
|
+
reason: `parsing JSON content response failed for resourceId: ${resourceId} localId: ${blockAri}`
|
|
251
|
+
},
|
|
252
|
+
resourceId
|
|
253
|
+
});
|
|
262
254
|
}
|
|
263
255
|
}
|
|
264
256
|
}
|
|
@@ -273,11 +265,9 @@ export const batchFetchData = async (cloudId, parentAri, blockNodeIdentifiers) =
|
|
|
273
265
|
}
|
|
274
266
|
processedResourceIds.add(resourceId);
|
|
275
267
|
results.push({
|
|
276
|
-
error:
|
|
268
|
+
error: {
|
|
277
269
|
type: mapErrorResponseCode(errorResponse.code),
|
|
278
270
|
reason: errorResponse.reason
|
|
279
|
-
} : {
|
|
280
|
-
type: mapErrorResponseCode(errorResponse.code)
|
|
281
271
|
},
|
|
282
272
|
resourceId
|
|
283
273
|
});
|
|
@@ -301,7 +291,7 @@ export const batchFetchData = async (cloudId, parentAri, blockNodeIdentifiers) =
|
|
|
301
291
|
return blockNodeIdentifiers.map(blockNodeIdentifier => ({
|
|
302
292
|
error: {
|
|
303
293
|
type: error instanceof BlockError ? mapBlockError(error) : SyncBlockError.Errored,
|
|
304
|
-
reason:
|
|
294
|
+
reason: error.message
|
|
305
295
|
},
|
|
306
296
|
resourceId: blockNodeIdentifier.resourceId
|
|
307
297
|
}));
|
|
@@ -455,21 +445,17 @@ class BlockServiceADFFetchProvider {
|
|
|
455
445
|
} catch (error) {
|
|
456
446
|
if (error instanceof BlockError) {
|
|
457
447
|
return {
|
|
458
|
-
error:
|
|
448
|
+
error: {
|
|
459
449
|
type: mapBlockError(error),
|
|
460
450
|
reason: error.message
|
|
461
|
-
} : {
|
|
462
|
-
type: mapBlockError(error)
|
|
463
451
|
},
|
|
464
452
|
resourceId
|
|
465
453
|
};
|
|
466
454
|
}
|
|
467
455
|
return {
|
|
468
|
-
error:
|
|
456
|
+
error: {
|
|
469
457
|
type: SyncBlockError.Errored,
|
|
470
458
|
reason: error.message
|
|
471
|
-
} : {
|
|
472
|
-
type: SyncBlockError.Errored
|
|
473
459
|
},
|
|
474
460
|
resourceId
|
|
475
461
|
};
|
|
@@ -520,10 +506,11 @@ class BlockServiceADFFetchProvider {
|
|
|
520
506
|
/**
|
|
521
507
|
* Batch fetches multiple synced blocks by their resource IDs.
|
|
522
508
|
* @param blockNodeIdentifiers - Array of block node identifiers to fetch
|
|
509
|
+
* @param config - Optional batch fetch configuration
|
|
523
510
|
* @returns Array of SyncBlockInstance results
|
|
524
511
|
*/
|
|
525
|
-
async batchFetchData(blockNodeIdentifiers) {
|
|
526
|
-
return await batchFetchData(this.cloudId, this.parentAri, blockNodeIdentifiers);
|
|
512
|
+
async batchFetchData(blockNodeIdentifiers, config) {
|
|
513
|
+
return await batchFetchData(this.cloudId, this.parentAri, blockNodeIdentifiers, config);
|
|
527
514
|
}
|
|
528
515
|
|
|
529
516
|
/**
|