@atlaskit/editor-synced-block-provider 3.29.2 → 3.30.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 +21 -0
- package/dist/cjs/clients/block-service/blockService.js +110 -101
- package/dist/cjs/clients/confluence/sourceInfo.js +60 -44
- package/dist/cjs/utils/resolveSyncBlockInstance.js +25 -1
- package/dist/es2019/clients/block-service/blockService.js +17 -8
- package/dist/es2019/clients/confluence/sourceInfo.js +41 -18
- package/dist/es2019/utils/resolveSyncBlockInstance.js +26 -1
- package/dist/esm/clients/block-service/blockService.js +110 -101
- package/dist/esm/clients/confluence/sourceInfo.js +60 -44
- package/dist/esm/utils/resolveSyncBlockInstance.js +25 -1
- package/package.json +2 -2
|
@@ -8,6 +8,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
8
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { fetchWithRetry } from '../../utils/retry';
|
|
12
13
|
export var isBlockContentResponse = function isBlockContentResponse(response) {
|
|
13
14
|
var content = response.content;
|
|
@@ -56,7 +57,7 @@ export var isBlockContentResponse = function isBlockContentResponse(response) {
|
|
|
56
57
|
*/
|
|
57
58
|
export var getReferenceSyncedBlocks = /*#__PURE__*/function () {
|
|
58
59
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(documentAri) {
|
|
59
|
-
var bodyData, response, result;
|
|
60
|
+
var bodyData, url, response, result;
|
|
60
61
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
61
62
|
while (1) switch (_context.prev = _context.next) {
|
|
62
63
|
case 0:
|
|
@@ -64,40 +65,41 @@ export var getReferenceSyncedBlocks = /*#__PURE__*/function () {
|
|
|
64
65
|
query: buildGetDocumentReferenceBlocksQuery(documentAri),
|
|
65
66
|
operationName: GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetDocumentReferenceBlocks") : GRAPHQL_ENDPOINT;
|
|
69
|
+
_context.next = 4;
|
|
70
|
+
return fetchWithRetry(url, {
|
|
69
71
|
method: 'POST',
|
|
70
72
|
headers: COMMON_HEADERS,
|
|
71
73
|
body: JSON.stringify(bodyData)
|
|
72
74
|
});
|
|
73
|
-
case
|
|
75
|
+
case 4:
|
|
74
76
|
response = _context.sent;
|
|
75
77
|
if (response.ok) {
|
|
76
|
-
_context.next =
|
|
78
|
+
_context.next = 7;
|
|
77
79
|
break;
|
|
78
80
|
}
|
|
79
81
|
throw new BlockError(response.status);
|
|
80
|
-
case
|
|
81
|
-
_context.next =
|
|
82
|
+
case 7:
|
|
83
|
+
_context.next = 9;
|
|
82
84
|
return response.json();
|
|
83
|
-
case
|
|
85
|
+
case 9:
|
|
84
86
|
result = _context.sent;
|
|
85
87
|
if (!(result.errors && result.errors.length > 0)) {
|
|
86
|
-
_context.next =
|
|
88
|
+
_context.next = 12;
|
|
87
89
|
break;
|
|
88
90
|
}
|
|
89
91
|
throw new Error(result.errors.map(function (e) {
|
|
90
92
|
return e.message;
|
|
91
93
|
}).join(', '));
|
|
92
|
-
case
|
|
94
|
+
case 12:
|
|
93
95
|
if (result.data) {
|
|
94
|
-
_context.next =
|
|
96
|
+
_context.next = 14;
|
|
95
97
|
break;
|
|
96
98
|
}
|
|
97
99
|
throw new Error('No data returned from GraphQL query');
|
|
98
|
-
case 13:
|
|
99
|
-
return _context.abrupt("return", result.data.blockService_getDocumentReferenceBlocks);
|
|
100
100
|
case 14:
|
|
101
|
+
return _context.abrupt("return", result.data.blockService_getDocumentReferenceBlocks);
|
|
102
|
+
case 15:
|
|
101
103
|
case "end":
|
|
102
104
|
return _context.stop();
|
|
103
105
|
}
|
|
@@ -200,7 +202,7 @@ export var BlockError = /*#__PURE__*/function (_Error) {
|
|
|
200
202
|
export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
201
203
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
202
204
|
var _result$data;
|
|
203
|
-
var blockAri, bodyData, response, result;
|
|
205
|
+
var blockAri, bodyData, url, response, result;
|
|
204
206
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
205
207
|
while (1) switch (_context2.prev = _context2.next) {
|
|
206
208
|
case 0:
|
|
@@ -209,40 +211,41 @@ export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
|
209
211
|
query: buildGetBlockQuery(blockAri),
|
|
210
212
|
operationName: GET_BLOCK_OPERATION_NAME
|
|
211
213
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetBlock") : GRAPHQL_ENDPOINT;
|
|
215
|
+
_context2.next = 5;
|
|
216
|
+
return fetchWithRetry(url, {
|
|
214
217
|
method: 'POST',
|
|
215
218
|
headers: COMMON_HEADERS,
|
|
216
219
|
body: JSON.stringify(bodyData)
|
|
217
220
|
});
|
|
218
|
-
case
|
|
221
|
+
case 5:
|
|
219
222
|
response = _context2.sent;
|
|
220
223
|
if (response.ok) {
|
|
221
|
-
_context2.next =
|
|
224
|
+
_context2.next = 8;
|
|
222
225
|
break;
|
|
223
226
|
}
|
|
224
227
|
throw new BlockError(response.status);
|
|
225
|
-
case
|
|
226
|
-
_context2.next =
|
|
228
|
+
case 8:
|
|
229
|
+
_context2.next = 10;
|
|
227
230
|
return response.json();
|
|
228
|
-
case
|
|
231
|
+
case 10:
|
|
229
232
|
result = _context2.sent;
|
|
230
233
|
if (!(result.errors && result.errors.length > 0)) {
|
|
231
|
-
_context2.next =
|
|
234
|
+
_context2.next = 13;
|
|
232
235
|
break;
|
|
233
236
|
}
|
|
234
237
|
throw new Error(result.errors.map(function (e) {
|
|
235
238
|
return e.message;
|
|
236
239
|
}).join(', '));
|
|
237
|
-
case
|
|
240
|
+
case 13:
|
|
238
241
|
if ((_result$data = result.data) !== null && _result$data !== void 0 && _result$data.blockService_getBlock) {
|
|
239
|
-
_context2.next =
|
|
242
|
+
_context2.next = 15;
|
|
240
243
|
break;
|
|
241
244
|
}
|
|
242
245
|
throw new Error('No data returned from GraphQL query');
|
|
243
|
-
case 14:
|
|
244
|
-
return _context2.abrupt("return", result.data.blockService_getBlock);
|
|
245
246
|
case 15:
|
|
247
|
+
return _context2.abrupt("return", result.data.blockService_getBlock);
|
|
248
|
+
case 16:
|
|
246
249
|
case "end":
|
|
247
250
|
return _context2.stop();
|
|
248
251
|
}
|
|
@@ -264,7 +267,7 @@ export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
|
264
267
|
export var batchRetrieveSyncedBlocks = /*#__PURE__*/function () {
|
|
265
268
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
266
269
|
var _result$data2;
|
|
267
|
-
var blockIdentifiers, blockAris, bodyData, response, result, graphqlResponse;
|
|
270
|
+
var blockIdentifiers, blockAris, bodyData, url, response, result, graphqlResponse;
|
|
268
271
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
269
272
|
while (1) switch (_context3.prev = _context3.next) {
|
|
270
273
|
case 0:
|
|
@@ -276,44 +279,45 @@ export var batchRetrieveSyncedBlocks = /*#__PURE__*/function () {
|
|
|
276
279
|
query: buildBatchRetrieveBlocksQuery(blockAris),
|
|
277
280
|
operationName: BATCH_RETRIEVE_BLOCKS_OPERATION_NAME
|
|
278
281
|
};
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockBatchRetrieveBlocks") : GRAPHQL_ENDPOINT;
|
|
283
|
+
_context3.next = 6;
|
|
284
|
+
return fetchWithRetry(url, {
|
|
281
285
|
method: 'POST',
|
|
282
286
|
headers: COMMON_HEADERS,
|
|
283
287
|
body: JSON.stringify(bodyData)
|
|
284
288
|
});
|
|
285
|
-
case
|
|
289
|
+
case 6:
|
|
286
290
|
response = _context3.sent;
|
|
287
291
|
if (response.ok) {
|
|
288
|
-
_context3.next =
|
|
292
|
+
_context3.next = 9;
|
|
289
293
|
break;
|
|
290
294
|
}
|
|
291
295
|
throw new BlockError(response.status);
|
|
292
|
-
case
|
|
293
|
-
_context3.next =
|
|
296
|
+
case 9:
|
|
297
|
+
_context3.next = 11;
|
|
294
298
|
return response.json();
|
|
295
|
-
case
|
|
299
|
+
case 11:
|
|
296
300
|
result = _context3.sent;
|
|
297
301
|
if (!(result.errors && result.errors.length > 0)) {
|
|
298
|
-
_context3.next =
|
|
302
|
+
_context3.next = 14;
|
|
299
303
|
break;
|
|
300
304
|
}
|
|
301
305
|
throw new Error(result.errors.map(function (e) {
|
|
302
306
|
return e.message;
|
|
303
307
|
}).join(', '));
|
|
304
|
-
case
|
|
308
|
+
case 14:
|
|
305
309
|
if ((_result$data2 = result.data) !== null && _result$data2 !== void 0 && _result$data2.blockService_batchRetrieveBlocks) {
|
|
306
|
-
_context3.next =
|
|
310
|
+
_context3.next = 16;
|
|
307
311
|
break;
|
|
308
312
|
}
|
|
309
313
|
throw new Error('No data returned from GraphQL query');
|
|
310
|
-
case
|
|
314
|
+
case 16:
|
|
311
315
|
graphqlResponse = result.data.blockService_batchRetrieveBlocks;
|
|
312
316
|
return _context3.abrupt("return", {
|
|
313
317
|
success: graphqlResponse.success,
|
|
314
318
|
error: graphqlResponse.error
|
|
315
319
|
});
|
|
316
|
-
case
|
|
320
|
+
case 18:
|
|
317
321
|
case "end":
|
|
318
322
|
return _context3.stop();
|
|
319
323
|
}
|
|
@@ -326,7 +330,7 @@ export var batchRetrieveSyncedBlocks = /*#__PURE__*/function () {
|
|
|
326
330
|
export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
327
331
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) {
|
|
328
332
|
var _result$data3;
|
|
329
|
-
var blockAri, deleteReason, bodyData, response, result;
|
|
333
|
+
var blockAri, deleteReason, bodyData, url, response, result;
|
|
330
334
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
331
335
|
while (1) switch (_context4.prev = _context4.next) {
|
|
332
336
|
case 0:
|
|
@@ -335,38 +339,39 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
|
335
339
|
query: buildDeleteBlockMutation(blockAri, deleteReason),
|
|
336
340
|
operationName: DELETE_BLOCK_OPERATION_NAME
|
|
337
341
|
};
|
|
338
|
-
|
|
339
|
-
|
|
342
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockDeleteBlock") : GRAPHQL_ENDPOINT;
|
|
343
|
+
_context4.next = 5;
|
|
344
|
+
return fetchWithRetry(url, {
|
|
340
345
|
method: 'POST',
|
|
341
346
|
headers: COMMON_HEADERS,
|
|
342
347
|
body: JSON.stringify(bodyData)
|
|
343
348
|
});
|
|
344
|
-
case
|
|
349
|
+
case 5:
|
|
345
350
|
response = _context4.sent;
|
|
346
351
|
if (response.ok) {
|
|
347
|
-
_context4.next =
|
|
352
|
+
_context4.next = 8;
|
|
348
353
|
break;
|
|
349
354
|
}
|
|
350
355
|
throw new BlockError(response.status);
|
|
351
|
-
case
|
|
352
|
-
_context4.next =
|
|
356
|
+
case 8:
|
|
357
|
+
_context4.next = 10;
|
|
353
358
|
return response.json();
|
|
354
|
-
case
|
|
359
|
+
case 10:
|
|
355
360
|
result = _context4.sent;
|
|
356
361
|
if (!(result.errors && result.errors.length > 0)) {
|
|
357
|
-
_context4.next =
|
|
362
|
+
_context4.next = 13;
|
|
358
363
|
break;
|
|
359
364
|
}
|
|
360
365
|
throw new Error(result.errors.map(function (e) {
|
|
361
366
|
return e.message;
|
|
362
367
|
}).join(', '));
|
|
363
|
-
case
|
|
368
|
+
case 13:
|
|
364
369
|
if ((_result$data3 = result.data) !== null && _result$data3 !== void 0 && _result$data3.blockService_deleteBlock.deleted) {
|
|
365
|
-
_context4.next =
|
|
370
|
+
_context4.next = 15;
|
|
366
371
|
break;
|
|
367
372
|
}
|
|
368
373
|
throw new Error('Block deletion failed; deleted flag is false');
|
|
369
|
-
case
|
|
374
|
+
case 15:
|
|
370
375
|
case "end":
|
|
371
376
|
return _context4.stop();
|
|
372
377
|
}
|
|
@@ -378,7 +383,7 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
|
378
383
|
}();
|
|
379
384
|
export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
380
385
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
381
|
-
var blockAri, content, stepVersion, status, bodyData, response, result;
|
|
386
|
+
var blockAri, content, stepVersion, status, bodyData, url, response, result;
|
|
382
387
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
383
388
|
while (1) switch (_context5.prev = _context5.next) {
|
|
384
389
|
case 0:
|
|
@@ -387,32 +392,33 @@ export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
|
387
392
|
query: buildUpdateBlockMutation(blockAri, content, stepVersion, status),
|
|
388
393
|
operationName: UPDATE_BLOCK_OPERATION_NAME
|
|
389
394
|
};
|
|
390
|
-
|
|
391
|
-
|
|
395
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockUpdateBlock") : GRAPHQL_ENDPOINT;
|
|
396
|
+
_context5.next = 5;
|
|
397
|
+
return fetchWithRetry(url, {
|
|
392
398
|
method: 'POST',
|
|
393
399
|
headers: COMMON_HEADERS,
|
|
394
400
|
body: JSON.stringify(bodyData)
|
|
395
401
|
});
|
|
396
|
-
case
|
|
402
|
+
case 5:
|
|
397
403
|
response = _context5.sent;
|
|
398
404
|
if (response.ok) {
|
|
399
|
-
_context5.next =
|
|
405
|
+
_context5.next = 8;
|
|
400
406
|
break;
|
|
401
407
|
}
|
|
402
408
|
throw new BlockError(response.status);
|
|
403
|
-
case
|
|
404
|
-
_context5.next =
|
|
409
|
+
case 8:
|
|
410
|
+
_context5.next = 10;
|
|
405
411
|
return response.json();
|
|
406
|
-
case
|
|
412
|
+
case 10:
|
|
407
413
|
result = _context5.sent;
|
|
408
414
|
if (!(result.errors && result.errors.length > 0)) {
|
|
409
|
-
_context5.next =
|
|
415
|
+
_context5.next = 13;
|
|
410
416
|
break;
|
|
411
417
|
}
|
|
412
418
|
throw new Error(result.errors.map(function (e) {
|
|
413
419
|
return e.message;
|
|
414
420
|
}).join(', '));
|
|
415
|
-
case
|
|
421
|
+
case 13:
|
|
416
422
|
case "end":
|
|
417
423
|
return _context5.stop();
|
|
418
424
|
}
|
|
@@ -425,7 +431,7 @@ export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
|
425
431
|
export var createSyncedBlock = /*#__PURE__*/function () {
|
|
426
432
|
var _ref1 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref0) {
|
|
427
433
|
var _result$data4;
|
|
428
|
-
var blockAri, blockInstanceId, sourceAri, product, content, stepVersion, status, bodyData, response, result;
|
|
434
|
+
var blockAri, blockInstanceId, sourceAri, product, content, stepVersion, status, bodyData, url, response, result;
|
|
429
435
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
430
436
|
while (1) switch (_context6.prev = _context6.next) {
|
|
431
437
|
case 0:
|
|
@@ -434,40 +440,41 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
434
440
|
query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status),
|
|
435
441
|
operationName: CREATE_BLOCK_OPERATION_NAME
|
|
436
442
|
};
|
|
437
|
-
|
|
438
|
-
|
|
443
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockCreateBlock") : GRAPHQL_ENDPOINT;
|
|
444
|
+
_context6.next = 5;
|
|
445
|
+
return fetchWithRetry(url, {
|
|
439
446
|
method: 'POST',
|
|
440
447
|
headers: COMMON_HEADERS,
|
|
441
448
|
body: JSON.stringify(bodyData)
|
|
442
449
|
});
|
|
443
|
-
case
|
|
450
|
+
case 5:
|
|
444
451
|
response = _context6.sent;
|
|
445
452
|
if (response.ok) {
|
|
446
|
-
_context6.next =
|
|
453
|
+
_context6.next = 8;
|
|
447
454
|
break;
|
|
448
455
|
}
|
|
449
456
|
throw new BlockError(response.status);
|
|
450
|
-
case
|
|
451
|
-
_context6.next =
|
|
457
|
+
case 8:
|
|
458
|
+
_context6.next = 10;
|
|
452
459
|
return response.json();
|
|
453
|
-
case
|
|
460
|
+
case 10:
|
|
454
461
|
result = _context6.sent;
|
|
455
462
|
if (!(result.errors && result.errors.length > 0)) {
|
|
456
|
-
_context6.next =
|
|
463
|
+
_context6.next = 13;
|
|
457
464
|
break;
|
|
458
465
|
}
|
|
459
466
|
throw new Error(result.errors.map(function (e) {
|
|
460
467
|
return e.message;
|
|
461
468
|
}).join(', '));
|
|
462
|
-
case
|
|
469
|
+
case 13:
|
|
463
470
|
if ((_result$data4 = result.data) !== null && _result$data4 !== void 0 && _result$data4.blockService_createBlock) {
|
|
464
|
-
_context6.next =
|
|
471
|
+
_context6.next = 15;
|
|
465
472
|
break;
|
|
466
473
|
}
|
|
467
474
|
throw new Error('No data returned from GraphQL mutation');
|
|
468
|
-
case 14:
|
|
469
|
-
return _context6.abrupt("return", result.data.blockService_createBlock);
|
|
470
475
|
case 15:
|
|
476
|
+
return _context6.abrupt("return", result.data.blockService_createBlock);
|
|
477
|
+
case 16:
|
|
471
478
|
case "end":
|
|
472
479
|
return _context6.stop();
|
|
473
480
|
}
|
|
@@ -479,7 +486,7 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
479
486
|
}();
|
|
480
487
|
export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
481
488
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
|
|
482
|
-
var documentAri, blocks, _ref10$noContent, noContent, bodyData, response, result, _result$data5;
|
|
489
|
+
var documentAri, blocks, _ref10$noContent, noContent, bodyData, url, response, result, _result$data5;
|
|
483
490
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
484
491
|
while (1) switch (_context7.prev = _context7.next) {
|
|
485
492
|
case 0:
|
|
@@ -488,45 +495,46 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
|
488
495
|
query: buildUpdateDocumentReferencesMutation(documentAri, blocks, noContent),
|
|
489
496
|
operationName: UPDATE_DOCUMENT_REFERENCES_OPERATION_NAME
|
|
490
497
|
};
|
|
491
|
-
|
|
492
|
-
|
|
498
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockUpdateDocumentReferences") : GRAPHQL_ENDPOINT;
|
|
499
|
+
_context7.next = 5;
|
|
500
|
+
return fetchWithRetry(url, {
|
|
493
501
|
method: 'POST',
|
|
494
502
|
headers: COMMON_HEADERS,
|
|
495
503
|
body: JSON.stringify(bodyData),
|
|
496
504
|
keepalive: true
|
|
497
505
|
});
|
|
498
|
-
case
|
|
506
|
+
case 5:
|
|
499
507
|
response = _context7.sent;
|
|
500
508
|
if (response.ok) {
|
|
501
|
-
_context7.next =
|
|
509
|
+
_context7.next = 8;
|
|
502
510
|
break;
|
|
503
511
|
}
|
|
504
512
|
throw new BlockError(response.status);
|
|
505
|
-
case
|
|
506
|
-
_context7.next =
|
|
513
|
+
case 8:
|
|
514
|
+
_context7.next = 10;
|
|
507
515
|
return response.json();
|
|
508
|
-
case
|
|
516
|
+
case 10:
|
|
509
517
|
result = _context7.sent;
|
|
510
518
|
if (!(result.errors && result.errors.length > 0)) {
|
|
511
|
-
_context7.next =
|
|
519
|
+
_context7.next = 13;
|
|
512
520
|
break;
|
|
513
521
|
}
|
|
514
522
|
throw new Error(result.errors.map(function (e) {
|
|
515
523
|
return e.message;
|
|
516
524
|
}).join(', '));
|
|
517
|
-
case
|
|
525
|
+
case 13:
|
|
518
526
|
if (noContent) {
|
|
519
|
-
_context7.next =
|
|
527
|
+
_context7.next = 17;
|
|
520
528
|
break;
|
|
521
529
|
}
|
|
522
530
|
if ((_result$data5 = result.data) !== null && _result$data5 !== void 0 && _result$data5.blockService_updateDocumentReferences) {
|
|
523
|
-
_context7.next =
|
|
531
|
+
_context7.next = 16;
|
|
524
532
|
break;
|
|
525
533
|
}
|
|
526
534
|
throw new Error('No data returned from GraphQL mutation');
|
|
527
|
-
case 15:
|
|
528
|
-
return _context7.abrupt("return", result.data.blockService_updateDocumentReferences);
|
|
529
535
|
case 16:
|
|
536
|
+
return _context7.abrupt("return", result.data.blockService_updateDocumentReferences);
|
|
537
|
+
case 17:
|
|
530
538
|
case "end":
|
|
531
539
|
return _context7.stop();
|
|
532
540
|
}
|
|
@@ -539,7 +547,7 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
|
539
547
|
export var getReferenceSyncedBlocksByBlockAri = /*#__PURE__*/function () {
|
|
540
548
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
|
|
541
549
|
var _result$data6;
|
|
542
|
-
var blockAri, bodyData, response, result, graphqlResponse;
|
|
550
|
+
var blockAri, bodyData, url, response, result, graphqlResponse;
|
|
543
551
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
544
552
|
while (1) switch (_context8.prev = _context8.next) {
|
|
545
553
|
case 0:
|
|
@@ -548,45 +556,46 @@ export var getReferenceSyncedBlocksByBlockAri = /*#__PURE__*/function () {
|
|
|
548
556
|
query: buildGetBlockReferencesQuery(blockAri),
|
|
549
557
|
operationName: GET_BLOCK_REFERENCES_OPERATION_NAME
|
|
550
558
|
};
|
|
551
|
-
|
|
552
|
-
|
|
559
|
+
url = fg('platform_synced_block_patch_3') ? "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetReferences") : GRAPHQL_ENDPOINT;
|
|
560
|
+
_context8.next = 5;
|
|
561
|
+
return fetchWithRetry(url, {
|
|
553
562
|
method: 'POST',
|
|
554
563
|
headers: COMMON_HEADERS,
|
|
555
564
|
body: JSON.stringify(bodyData)
|
|
556
565
|
});
|
|
557
|
-
case
|
|
566
|
+
case 5:
|
|
558
567
|
response = _context8.sent;
|
|
559
568
|
if (response.ok) {
|
|
560
|
-
_context8.next =
|
|
569
|
+
_context8.next = 8;
|
|
561
570
|
break;
|
|
562
571
|
}
|
|
563
572
|
throw new BlockError(response.status);
|
|
564
|
-
case
|
|
565
|
-
_context8.next =
|
|
573
|
+
case 8:
|
|
574
|
+
_context8.next = 10;
|
|
566
575
|
return response.json();
|
|
567
|
-
case
|
|
576
|
+
case 10:
|
|
568
577
|
result = _context8.sent;
|
|
569
578
|
if (!(result.errors && result.errors.length > 0)) {
|
|
570
|
-
_context8.next =
|
|
579
|
+
_context8.next = 13;
|
|
571
580
|
break;
|
|
572
581
|
}
|
|
573
582
|
throw new Error(result.errors.map(function (e) {
|
|
574
583
|
return e.message;
|
|
575
584
|
}).join(', '));
|
|
576
|
-
case
|
|
585
|
+
case 13:
|
|
577
586
|
if ((_result$data6 = result.data) !== null && _result$data6 !== void 0 && _result$data6.blockService_getReferences) {
|
|
578
|
-
_context8.next =
|
|
587
|
+
_context8.next = 15;
|
|
579
588
|
break;
|
|
580
589
|
}
|
|
581
590
|
throw new Error('No data returned from GraphQL query');
|
|
582
|
-
case
|
|
591
|
+
case 15:
|
|
583
592
|
graphqlResponse = result.data.blockService_getReferences;
|
|
584
593
|
return _context8.abrupt("return", {
|
|
585
594
|
blockAri: blockAri,
|
|
586
595
|
references: graphqlResponse.references || [],
|
|
587
596
|
errors: graphqlResponse.errors || []
|
|
588
597
|
});
|
|
589
|
-
case
|
|
598
|
+
case 17:
|
|
590
599
|
case "end":
|
|
591
600
|
return _context8.stop();
|
|
592
601
|
}
|