@atlaskit/editor-synced-block-provider 6.6.10 → 6.6.11

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/clients/block-service/blockService.js +107 -107
  3. package/dist/cjs/clients/confluence/fetchMediaToken.js +21 -21
  4. package/dist/cjs/clients/confluence/sourceInfo.js +24 -24
  5. package/dist/cjs/clients/jira/fetchMediaToken.js +21 -21
  6. package/dist/cjs/clients/jira/sourceInfo.js +24 -24
  7. package/dist/cjs/hooks/useFetchSyncBlockData.js +18 -18
  8. package/dist/cjs/providers/block-service/blockServiceAPI.js +322 -321
  9. package/dist/cjs/providers/syncBlockProvider.js +49 -48
  10. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +75 -75
  11. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +77 -78
  12. package/dist/cjs/store-manager/syncBlockStoreManager.js +41 -41
  13. package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +7 -18
  14. package/dist/cjs/utils/resourceId.js +2 -1
  15. package/dist/cjs/utils/retry.js +8 -8
  16. package/dist/cjs/utils/utils.js +4 -3
  17. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +1 -1
  18. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +1 -2
  19. package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +7 -18
  20. package/dist/es2019/utils/utils.js +1 -2
  21. package/dist/esm/clients/block-service/blockService.js +107 -107
  22. package/dist/esm/clients/confluence/fetchMediaToken.js +21 -21
  23. package/dist/esm/clients/confluence/sourceInfo.js +24 -24
  24. package/dist/esm/clients/jira/fetchMediaToken.js +21 -21
  25. package/dist/esm/clients/jira/sourceInfo.js +24 -24
  26. package/dist/esm/hooks/useFetchSyncBlockData.js +18 -18
  27. package/dist/esm/providers/block-service/blockServiceAPI.js +321 -320
  28. package/dist/esm/providers/syncBlockProvider.js +49 -48
  29. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +75 -75
  30. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +77 -78
  31. package/dist/esm/store-manager/syncBlockStoreManager.js +41 -41
  32. package/dist/esm/store-manager/syncBlockSubscriptionManager.js +7 -18
  33. package/dist/esm/utils/resourceId.js +2 -1
  34. package/dist/esm/utils/retry.js +8 -8
  35. package/dist/esm/utils/utils.js +1 -2
  36. package/package.json +5 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 6.6.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3b124b51740be`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b124b51740be) -
8
+ Remove fully rolled out feature gates platform_synced_block_patch_12 and
9
+ platform_synced_blocks_dogfooding
10
+ - Updated dependencies
11
+
3
12
  ## 6.6.10
4
13
 
5
14
  ### Patch Changes
@@ -64,7 +64,7 @@ var isBlockContentResponse = exports.isBlockContentResponse = function isBlockCo
64
64
  var getReferenceSyncedBlocks = exports.getReferenceSyncedBlocks = /*#__PURE__*/function () {
65
65
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(documentAri) {
66
66
  var bodyData, url, response, result;
67
- return _regenerator.default.wrap(function _callee$(_context) {
67
+ return _regenerator.default.wrap(function (_context) {
68
68
  while (1) switch (_context.prev = _context.next) {
69
69
  case 0:
70
70
  bodyData = {
@@ -72,40 +72,40 @@ var getReferenceSyncedBlocks = exports.getReferenceSyncedBlocks = /*#__PURE__*/f
72
72
  operationName: GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME
73
73
  };
74
74
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetDocumentReferenceBlocks");
75
- _context.next = 4;
75
+ _context.next = 1;
76
76
  return (0, _retry.fetchWithRetry)(url, {
77
77
  method: 'POST',
78
78
  headers: COMMON_HEADERS,
79
79
  body: JSON.stringify(bodyData)
80
80
  });
81
- case 4:
81
+ case 1:
82
82
  response = _context.sent;
83
83
  if (response.ok) {
84
- _context.next = 7;
84
+ _context.next = 2;
85
85
  break;
86
86
  }
87
87
  throw new BlockError(response.status);
88
- case 7:
89
- _context.next = 9;
88
+ case 2:
89
+ _context.next = 3;
90
90
  return response.json();
91
- case 9:
91
+ case 3:
92
92
  result = _context.sent;
93
93
  if (!(result.errors && result.errors.length > 0)) {
94
- _context.next = 12;
94
+ _context.next = 4;
95
95
  break;
96
96
  }
97
97
  throw new Error(result.errors.map(function (e) {
98
98
  return e.message;
99
99
  }).join(', '));
100
- case 12:
100
+ case 4:
101
101
  if (result.data) {
102
- _context.next = 14;
102
+ _context.next = 5;
103
103
  break;
104
104
  }
105
105
  throw new Error('No data returned from GraphQL query');
106
- case 14:
106
+ case 5:
107
107
  return _context.abrupt("return", result.data.blockService_getDocumentReferenceBlocks);
108
- case 15:
108
+ case 6:
109
109
  case "end":
110
110
  return _context.stop();
111
111
  }
@@ -256,7 +256,7 @@ var getSyncedBlockContent = exports.getSyncedBlockContent = /*#__PURE__*/functio
256
256
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref2) {
257
257
  var _result$data;
258
258
  var blockAri, bodyData, url, response, result;
259
- return _regenerator.default.wrap(function _callee2$(_context2) {
259
+ return _regenerator.default.wrap(function (_context2) {
260
260
  while (1) switch (_context2.prev = _context2.next) {
261
261
  case 0:
262
262
  blockAri = _ref2.blockAri;
@@ -265,40 +265,40 @@ var getSyncedBlockContent = exports.getSyncedBlockContent = /*#__PURE__*/functio
265
265
  operationName: GET_BLOCK_OPERATION_NAME
266
266
  };
267
267
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetBlock");
268
- _context2.next = 5;
268
+ _context2.next = 1;
269
269
  return (0, _retry.fetchWithRetry)(url, {
270
270
  method: 'POST',
271
271
  headers: COMMON_HEADERS,
272
272
  body: JSON.stringify(bodyData)
273
273
  });
274
- case 5:
274
+ case 1:
275
275
  response = _context2.sent;
276
276
  if (response.ok) {
277
- _context2.next = 8;
277
+ _context2.next = 2;
278
278
  break;
279
279
  }
280
280
  throw new BlockError(response.status);
281
- case 8:
282
- _context2.next = 10;
281
+ case 2:
282
+ _context2.next = 3;
283
283
  return response.json();
284
- case 10:
284
+ case 3:
285
285
  result = _context2.sent;
286
286
  if (!(result.errors && result.errors.length > 0)) {
287
- _context2.next = 13;
287
+ _context2.next = 4;
288
288
  break;
289
289
  }
290
290
  throw new Error(result.errors.map(function (e) {
291
291
  return e.message;
292
292
  }).join(', '));
293
- case 13:
293
+ case 4:
294
294
  if ((_result$data = result.data) !== null && _result$data !== void 0 && _result$data.blockService_getBlock) {
295
- _context2.next = 15;
295
+ _context2.next = 5;
296
296
  break;
297
297
  }
298
298
  throw new Error('No data returned from GraphQL query');
299
- case 15:
299
+ case 5:
300
300
  return _context2.abrupt("return", result.data.blockService_getBlock);
301
- case 16:
301
+ case 6:
302
302
  case "end":
303
303
  return _context2.stop();
304
304
  }
@@ -322,7 +322,7 @@ var batchRetrieveSyncedBlocks = exports.batchRetrieveSyncedBlocks = /*#__PURE__*
322
322
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref4) {
323
323
  var _config$timeoutMs, _result$data2;
324
324
  var blockIdentifiers, config, blockAris, bodyData, url, fetchPromise, timeoutMs, response, result, graphqlResponse;
325
- return _regenerator.default.wrap(function _callee3$(_context3) {
325
+ return _regenerator.default.wrap(function (_context3) {
326
326
  while (1) switch (_context3.prev = _context3.next) {
327
327
  case 0:
328
328
  blockIdentifiers = _ref4.blockIdentifiers, config = _ref4.config;
@@ -341,44 +341,44 @@ var batchRetrieveSyncedBlocks = exports.batchRetrieveSyncedBlocks = /*#__PURE__*
341
341
  body: JSON.stringify(bodyData)
342
342
  });
343
343
  timeoutMs = (_config$timeoutMs = config === null || config === void 0 ? void 0 : config.timeoutMs) !== null && _config$timeoutMs !== void 0 ? _config$timeoutMs : 0;
344
- _context3.next = 8;
344
+ _context3.next = 1;
345
345
  return timeoutMs > 0 ? Promise.race([fetchPromise, new Promise(function (_, reject) {
346
346
  return setTimeout(function () {
347
347
  return reject(new BlockTimeoutError());
348
348
  }, timeoutMs);
349
349
  })]) : fetchPromise;
350
- case 8:
350
+ case 1:
351
351
  response = _context3.sent;
352
352
  if (response.ok) {
353
- _context3.next = 11;
353
+ _context3.next = 2;
354
354
  break;
355
355
  }
356
356
  throw new BlockError(response.status);
357
- case 11:
358
- _context3.next = 13;
357
+ case 2:
358
+ _context3.next = 3;
359
359
  return response.json();
360
- case 13:
360
+ case 3:
361
361
  result = _context3.sent;
362
362
  if (!(result.errors && result.errors.length > 0)) {
363
- _context3.next = 16;
363
+ _context3.next = 4;
364
364
  break;
365
365
  }
366
366
  throw new Error(result.errors.map(function (e) {
367
367
  return e.message;
368
368
  }).join(', '));
369
- case 16:
369
+ case 4:
370
370
  if ((_result$data2 = result.data) !== null && _result$data2 !== void 0 && _result$data2.blockService_batchRetrieveBlocks) {
371
- _context3.next = 18;
371
+ _context3.next = 5;
372
372
  break;
373
373
  }
374
374
  throw new Error('No data returned from GraphQL query');
375
- case 18:
375
+ case 5:
376
376
  graphqlResponse = result.data.blockService_batchRetrieveBlocks;
377
377
  return _context3.abrupt("return", {
378
378
  success: graphqlResponse.success,
379
379
  error: graphqlResponse.error
380
380
  });
381
- case 20:
381
+ case 6:
382
382
  case "end":
383
383
  return _context3.stop();
384
384
  }
@@ -392,7 +392,7 @@ var deleteSyncedBlock = exports.deleteSyncedBlock = /*#__PURE__*/function () {
392
392
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(_ref6) {
393
393
  var _result$data3;
394
394
  var blockAri, deleteReason, bodyData, url, response, result, allNotFound, isDeleted;
395
- return _regenerator.default.wrap(function _callee4$(_context4) {
395
+ return _regenerator.default.wrap(function (_context4) {
396
396
  while (1) switch (_context4.prev = _context4.next) {
397
397
  case 0:
398
398
  blockAri = _ref6.blockAri, deleteReason = _ref6.deleteReason;
@@ -401,26 +401,26 @@ var deleteSyncedBlock = exports.deleteSyncedBlock = /*#__PURE__*/function () {
401
401
  operationName: DELETE_BLOCK_OPERATION_NAME
402
402
  };
403
403
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockDeleteBlock");
404
- _context4.next = 5;
404
+ _context4.next = 1;
405
405
  return (0, _retry.fetchWithRetry)(url, {
406
406
  method: 'POST',
407
407
  headers: COMMON_HEADERS,
408
408
  body: JSON.stringify(bodyData)
409
409
  });
410
- case 5:
410
+ case 1:
411
411
  response = _context4.sent;
412
412
  if (response.ok) {
413
- _context4.next = 8;
413
+ _context4.next = 2;
414
414
  break;
415
415
  }
416
416
  throw new BlockError(response.status);
417
- case 8:
418
- _context4.next = 10;
417
+ case 2:
418
+ _context4.next = 3;
419
419
  return response.json();
420
- case 10:
420
+ case 3:
421
421
  result = _context4.sent;
422
422
  if (!(result.errors && result.errors.length > 0)) {
423
- _context4.next = 16;
423
+ _context4.next = 5;
424
424
  break;
425
425
  }
426
426
  allNotFound = result.errors.every(function (e) {
@@ -428,22 +428,22 @@ var deleteSyncedBlock = exports.deleteSyncedBlock = /*#__PURE__*/function () {
428
428
  return ((_e$extensions = e.extensions) === null || _e$extensions === void 0 ? void 0 : _e$extensions.errorType) === 'RESOURCE_NOT_FOUND';
429
429
  });
430
430
  if (!allNotFound) {
431
- _context4.next = 15;
431
+ _context4.next = 4;
432
432
  break;
433
433
  }
434
434
  throw new BlockNotFoundError();
435
- case 15:
435
+ case 4:
436
436
  throw new Error(result.errors.map(function (e) {
437
437
  return e.message;
438
438
  }).join(', '));
439
- case 16:
439
+ case 5:
440
440
  isDeleted = (_result$data3 = result.data) === null || _result$data3 === void 0 || (_result$data3 = _result$data3.blockService_deleteBlock) === null || _result$data3 === void 0 ? void 0 : _result$data3.deleted;
441
441
  if (isDeleted) {
442
- _context4.next = 19;
442
+ _context4.next = 6;
443
443
  break;
444
444
  }
445
445
  throw new Error('Block deletion failed; deleted flag is false');
446
- case 19:
446
+ case 6:
447
447
  case "end":
448
448
  return _context4.stop();
449
449
  }
@@ -456,7 +456,7 @@ var deleteSyncedBlock = exports.deleteSyncedBlock = /*#__PURE__*/function () {
456
456
  var updateSyncedBlock = exports.updateSyncedBlock = /*#__PURE__*/function () {
457
457
  var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(_ref8) {
458
458
  var blockAri, content, stepVersion, status, bodyData, url, response, result;
459
- return _regenerator.default.wrap(function _callee5$(_context5) {
459
+ return _regenerator.default.wrap(function (_context5) {
460
460
  while (1) switch (_context5.prev = _context5.next) {
461
461
  case 0:
462
462
  blockAri = _ref8.blockAri, content = _ref8.content, stepVersion = _ref8.stepVersion, status = _ref8.status;
@@ -465,32 +465,32 @@ var updateSyncedBlock = exports.updateSyncedBlock = /*#__PURE__*/function () {
465
465
  operationName: UPDATE_BLOCK_OPERATION_NAME
466
466
  };
467
467
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockUpdateBlock");
468
- _context5.next = 5;
468
+ _context5.next = 1;
469
469
  return (0, _retry.fetchWithRetry)(url, {
470
470
  method: 'POST',
471
471
  headers: COMMON_HEADERS,
472
472
  body: JSON.stringify(bodyData)
473
473
  });
474
- case 5:
474
+ case 1:
475
475
  response = _context5.sent;
476
476
  if (response.ok) {
477
- _context5.next = 8;
477
+ _context5.next = 2;
478
478
  break;
479
479
  }
480
480
  throw new BlockError(response.status);
481
- case 8:
482
- _context5.next = 10;
481
+ case 2:
482
+ _context5.next = 3;
483
483
  return response.json();
484
- case 10:
484
+ case 3:
485
485
  result = _context5.sent;
486
486
  if (!(result.errors && result.errors.length > 0)) {
487
- _context5.next = 13;
487
+ _context5.next = 4;
488
488
  break;
489
489
  }
490
490
  throw new Error(result.errors.map(function (e) {
491
491
  return e.message;
492
492
  }).join(', '));
493
- case 13:
493
+ case 4:
494
494
  case "end":
495
495
  return _context5.stop();
496
496
  }
@@ -504,7 +504,7 @@ var createSyncedBlock = exports.createSyncedBlock = /*#__PURE__*/function () {
504
504
  var _ref1 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(_ref0) {
505
505
  var _result$data4;
506
506
  var blockAri, blockInstanceId, sourceAri, product, content, stepVersion, status, bodyData, url, response, result;
507
- return _regenerator.default.wrap(function _callee6$(_context6) {
507
+ return _regenerator.default.wrap(function (_context6) {
508
508
  while (1) switch (_context6.prev = _context6.next) {
509
509
  case 0:
510
510
  blockAri = _ref0.blockAri, blockInstanceId = _ref0.blockInstanceId, sourceAri = _ref0.sourceAri, product = _ref0.product, content = _ref0.content, stepVersion = _ref0.stepVersion, status = _ref0.status;
@@ -513,40 +513,40 @@ var createSyncedBlock = exports.createSyncedBlock = /*#__PURE__*/function () {
513
513
  operationName: CREATE_BLOCK_OPERATION_NAME
514
514
  };
515
515
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockCreateBlock");
516
- _context6.next = 5;
516
+ _context6.next = 1;
517
517
  return (0, _retry.fetchWithRetry)(url, {
518
518
  method: 'POST',
519
519
  headers: COMMON_HEADERS,
520
520
  body: JSON.stringify(bodyData)
521
521
  });
522
- case 5:
522
+ case 1:
523
523
  response = _context6.sent;
524
524
  if (response.ok) {
525
- _context6.next = 8;
525
+ _context6.next = 2;
526
526
  break;
527
527
  }
528
528
  throw new BlockError(response.status);
529
- case 8:
530
- _context6.next = 10;
529
+ case 2:
530
+ _context6.next = 3;
531
531
  return response.json();
532
- case 10:
532
+ case 3:
533
533
  result = _context6.sent;
534
534
  if (!(result.errors && result.errors.length > 0)) {
535
- _context6.next = 13;
535
+ _context6.next = 4;
536
536
  break;
537
537
  }
538
538
  throw new Error(result.errors.map(function (e) {
539
539
  return e.message;
540
540
  }).join(', '));
541
- case 13:
541
+ case 4:
542
542
  if ((_result$data4 = result.data) !== null && _result$data4 !== void 0 && _result$data4.blockService_createBlock) {
543
- _context6.next = 15;
543
+ _context6.next = 5;
544
544
  break;
545
545
  }
546
546
  throw new Error('No data returned from GraphQL mutation');
547
- case 15:
547
+ case 5:
548
548
  return _context6.abrupt("return", result.data.blockService_createBlock);
549
- case 16:
549
+ case 6:
550
550
  case "end":
551
551
  return _context6.stop();
552
552
  }
@@ -559,7 +559,7 @@ var createSyncedBlock = exports.createSyncedBlock = /*#__PURE__*/function () {
559
559
  var updateReferenceSyncedBlockOnDocument = exports.updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
560
560
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(_ref10) {
561
561
  var documentAri, blocks, _ref10$noContent, noContent, bodyData, url, response, result, _result$data5;
562
- return _regenerator.default.wrap(function _callee7$(_context7) {
562
+ return _regenerator.default.wrap(function (_context7) {
563
563
  while (1) switch (_context7.prev = _context7.next) {
564
564
  case 0:
565
565
  documentAri = _ref10.documentAri, blocks = _ref10.blocks, _ref10$noContent = _ref10.noContent, noContent = _ref10$noContent === void 0 ? true : _ref10$noContent;
@@ -568,45 +568,45 @@ var updateReferenceSyncedBlockOnDocument = exports.updateReferenceSyncedBlockOnD
568
568
  operationName: UPDATE_DOCUMENT_REFERENCES_OPERATION_NAME
569
569
  };
570
570
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockUpdateDocumentReferences");
571
- _context7.next = 5;
571
+ _context7.next = 1;
572
572
  return (0, _retry.fetchWithRetry)(url, {
573
573
  method: 'POST',
574
574
  headers: COMMON_HEADERS,
575
575
  body: JSON.stringify(bodyData),
576
576
  keepalive: true
577
577
  });
578
- case 5:
578
+ case 1:
579
579
  response = _context7.sent;
580
580
  if (response.ok) {
581
- _context7.next = 8;
581
+ _context7.next = 2;
582
582
  break;
583
583
  }
584
584
  throw new BlockError(response.status);
585
- case 8:
586
- _context7.next = 10;
585
+ case 2:
586
+ _context7.next = 3;
587
587
  return response.json();
588
- case 10:
588
+ case 3:
589
589
  result = _context7.sent;
590
590
  if (!(result.errors && result.errors.length > 0)) {
591
- _context7.next = 13;
591
+ _context7.next = 4;
592
592
  break;
593
593
  }
594
594
  throw new Error(result.errors.map(function (e) {
595
595
  return e.message;
596
596
  }).join(', '));
597
- case 13:
597
+ case 4:
598
598
  if (noContent) {
599
- _context7.next = 17;
599
+ _context7.next = 6;
600
600
  break;
601
601
  }
602
602
  if ((_result$data5 = result.data) !== null && _result$data5 !== void 0 && _result$data5.blockService_updateDocumentReferences) {
603
- _context7.next = 16;
603
+ _context7.next = 5;
604
604
  break;
605
605
  }
606
606
  throw new Error('No data returned from GraphQL mutation');
607
- case 16:
607
+ case 5:
608
608
  return _context7.abrupt("return", result.data.blockService_updateDocumentReferences);
609
- case 17:
609
+ case 6:
610
610
  case "end":
611
611
  return _context7.stop();
612
612
  }
@@ -620,7 +620,7 @@ var getReferenceSyncedBlocksByBlockAri = exports.getReferenceSyncedBlocksByBlock
620
620
  var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(_ref12) {
621
621
  var _result$data6;
622
622
  var blockAri, bodyData, url, response, result, graphqlResponse;
623
- return _regenerator.default.wrap(function _callee8$(_context8) {
623
+ return _regenerator.default.wrap(function (_context8) {
624
624
  while (1) switch (_context8.prev = _context8.next) {
625
625
  case 0:
626
626
  blockAri = _ref12.blockAri;
@@ -629,45 +629,45 @@ var getReferenceSyncedBlocksByBlockAri = exports.getReferenceSyncedBlocksByBlock
629
629
  operationName: GET_BLOCK_REFERENCES_OPERATION_NAME
630
630
  };
631
631
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetReferences");
632
- _context8.next = 5;
632
+ _context8.next = 1;
633
633
  return (0, _retry.fetchWithRetry)(url, {
634
634
  method: 'POST',
635
635
  headers: COMMON_HEADERS,
636
636
  body: JSON.stringify(bodyData)
637
637
  });
638
- case 5:
638
+ case 1:
639
639
  response = _context8.sent;
640
640
  if (response.ok) {
641
- _context8.next = 8;
641
+ _context8.next = 2;
642
642
  break;
643
643
  }
644
644
  throw new BlockError(response.status);
645
- case 8:
646
- _context8.next = 10;
645
+ case 2:
646
+ _context8.next = 3;
647
647
  return response.json();
648
- case 10:
648
+ case 3:
649
649
  result = _context8.sent;
650
650
  if (!(result.errors && result.errors.length > 0)) {
651
- _context8.next = 13;
651
+ _context8.next = 4;
652
652
  break;
653
653
  }
654
654
  throw new Error(result.errors.map(function (e) {
655
655
  return e.message;
656
656
  }).join(', '));
657
- case 13:
657
+ case 4:
658
658
  if ((_result$data6 = result.data) !== null && _result$data6 !== void 0 && _result$data6.blockService_getReferences) {
659
- _context8.next = 15;
659
+ _context8.next = 5;
660
660
  break;
661
661
  }
662
662
  throw new Error('No data returned from GraphQL query');
663
- case 15:
663
+ case 5:
664
664
  graphqlResponse = result.data.blockService_getReferences;
665
665
  return _context8.abrupt("return", {
666
666
  blockAri: blockAri,
667
667
  references: graphqlResponse.references || [],
668
668
  errors: graphqlResponse.errors || []
669
669
  });
670
- case 17:
670
+ case 6:
671
671
  case "end":
672
672
  return _context8.stop();
673
673
  }
@@ -704,7 +704,7 @@ var updateSyncedBlocks = exports.updateSyncedBlocks = /*#__PURE__*/function () {
704
704
  var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(_ref14) {
705
705
  var _result$data7;
706
706
  var blocks, bodyData, url, response, result, graphqlResponse;
707
- return _regenerator.default.wrap(function _callee9$(_context9) {
707
+ return _regenerator.default.wrap(function (_context9) {
708
708
  while (1) switch (_context9.prev = _context9.next) {
709
709
  case 0:
710
710
  blocks = _ref14.blocks;
@@ -713,44 +713,44 @@ var updateSyncedBlocks = exports.updateSyncedBlocks = /*#__PURE__*/function () {
713
713
  operationName: BATCH_UPDATE_BLOCKS_OPERATION_NAME
714
714
  };
715
715
  url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockBatchUpdateBlocks");
716
- _context9.next = 5;
716
+ _context9.next = 1;
717
717
  return (0, _retry.fetchWithRetry)(url, {
718
718
  method: 'POST',
719
719
  headers: COMMON_HEADERS,
720
720
  body: JSON.stringify(bodyData)
721
721
  });
722
- case 5:
722
+ case 1:
723
723
  response = _context9.sent;
724
724
  if (response.ok) {
725
- _context9.next = 8;
725
+ _context9.next = 2;
726
726
  break;
727
727
  }
728
728
  throw new BlockError(response.status);
729
- case 8:
730
- _context9.next = 10;
729
+ case 2:
730
+ _context9.next = 3;
731
731
  return response.json();
732
- case 10:
732
+ case 3:
733
733
  result = _context9.sent;
734
734
  if (!(result.errors && result.errors.length > 0)) {
735
- _context9.next = 13;
735
+ _context9.next = 4;
736
736
  break;
737
737
  }
738
738
  throw new Error(result.errors.map(function (e) {
739
739
  return e.message;
740
740
  }).join(', '));
741
- case 13:
741
+ case 4:
742
742
  if ((_result$data7 = result.data) !== null && _result$data7 !== void 0 && _result$data7.blockService_batchUpdateBlocks) {
743
- _context9.next = 15;
743
+ _context9.next = 5;
744
744
  break;
745
745
  }
746
746
  throw new Error('No data returned from GraphQL mutation');
747
- case 15:
747
+ case 5:
748
748
  graphqlResponse = result.data.blockService_batchUpdateBlocks;
749
749
  return _context9.abrupt("return", {
750
750
  success: graphqlResponse.success,
751
751
  error: graphqlResponse.error
752
752
  });
753
- case 17:
753
+ case 6:
754
754
  case "end":
755
755
  return _context9.stop();
756
756
  }
@@ -25,7 +25,7 @@ var GET_CONTENT_MEDIA_SESSION_QUERY = "query ".concat(GET_CONTENT_MEDIA_SESSION_
25
25
  var getContentMediaSession = /*#__PURE__*/function () {
26
26
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(contentId) {
27
27
  var bodyData, response, result;
28
- return _regenerator.default.wrap(function _callee$(_context) {
28
+ return _regenerator.default.wrap(function (_context) {
29
29
  while (1) switch (_context.prev = _context.next) {
30
30
  case 0:
31
31
  bodyData = {
@@ -35,26 +35,26 @@ var getContentMediaSession = /*#__PURE__*/function () {
35
35
  contentId: contentId
36
36
  }
37
37
  };
38
- _context.next = 3;
38
+ _context.next = 1;
39
39
  return (0, _retry.fetchWithRetry)(GRAPHQL_ENDPOINT, {
40
40
  method: 'POST',
41
41
  headers: _objectSpread(_objectSpread({}, COMMON_HEADERS), AGG_HEADERS),
42
42
  body: JSON.stringify(bodyData)
43
43
  });
44
- case 3:
44
+ case 1:
45
45
  response = _context.sent;
46
46
  if (response.ok) {
47
- _context.next = 6;
47
+ _context.next = 2;
48
48
  break;
49
49
  }
50
50
  throw new Error("Failed to get content media session: ".concat(response.statusText));
51
- case 6:
52
- _context.next = 8;
51
+ case 2:
52
+ _context.next = 3;
53
53
  return response.json();
54
- case 8:
54
+ case 3:
55
55
  result = _context.sent;
56
56
  return _context.abrupt("return", result);
57
- case 10:
57
+ case 4:
58
58
  case "end":
59
59
  return _context.stop();
60
60
  }
@@ -66,43 +66,43 @@ var getContentMediaSession = /*#__PURE__*/function () {
66
66
  }();
67
67
  var fetchMediaToken = exports.fetchMediaToken = /*#__PURE__*/function () {
68
68
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(contentId) {
69
- var _response$data, _contentData$token, response, contentData, token, configuration, collection, errorMsg;
70
- return _regenerator.default.wrap(function _callee2$(_context2) {
69
+ var _response$data, _contentData$token, response, contentData, token, configuration, collection, errorMsg, _t;
70
+ return _regenerator.default.wrap(function (_context2) {
71
71
  while (1) switch (_context2.prev = _context2.next) {
72
72
  case 0:
73
73
  _context2.prev = 0;
74
- _context2.next = 3;
74
+ _context2.next = 1;
75
75
  return getContentMediaSession(contentId);
76
- case 3:
76
+ case 1:
77
77
  response = _context2.sent;
78
78
  contentData = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.contentMediaSession;
79
79
  token = contentData === null || contentData === void 0 || (_contentData$token = contentData.token) === null || _contentData$token === void 0 ? void 0 : _contentData$token.value;
80
80
  configuration = contentData === null || contentData === void 0 ? void 0 : contentData.configuration;
81
81
  collection = contentData === null || contentData === void 0 ? void 0 : contentData.collection;
82
82
  if (!(!token || !configuration || !collection)) {
83
- _context2.next = 10;
83
+ _context2.next = 2;
84
84
  break;
85
85
  }
86
86
  throw new Error('Failed to get content media session data');
87
- case 10:
87
+ case 2:
88
88
  return _context2.abrupt("return", {
89
89
  config: configuration,
90
90
  token: token,
91
91
  collectionId: collection
92
92
  });
93
- case 13:
94
- _context2.prev = 13;
95
- _context2.t0 = _context2["catch"](0);
96
- (0, _monitoring.logException)(_context2.t0, {
93
+ case 3:
94
+ _context2.prev = 3;
95
+ _t = _context2["catch"](0);
96
+ (0, _monitoring.logException)(_t, {
97
97
  location: 'editor-synced-block-provider/fetchMediaToken'
98
98
  });
99
- errorMsg = _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0);
99
+ errorMsg = _t instanceof Error ? _t.message : String(_t);
100
100
  throw new Error("Failed to get content media session: ".concat(errorMsg));
101
- case 18:
101
+ case 4:
102
102
  case "end":
103
103
  return _context2.stop();
104
104
  }
105
- }, _callee2, null, [[0, 13]]);
105
+ }, _callee2, null, [[0, 3]]);
106
106
  }));
107
107
  return function fetchMediaToken(_x2) {
108
108
  return _ref2.apply(this, arguments);