@atlaskit/editor-synced-block-provider 3.6.0 → 3.7.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/clients/block-service/ari.js +12 -1
  3. package/dist/cjs/clients/block-service/blockService.js +35 -2
  4. package/dist/cjs/clients/confluence/sourceInfo.js +109 -52
  5. package/dist/cjs/providers/block-service/blockServiceAPI.js +195 -125
  6. package/dist/cjs/providers/syncBlockProvider.js +83 -14
  7. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +60 -17
  8. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +17 -0
  9. package/dist/cjs/store-manager/syncBlockStoreManager.js +121 -0
  10. package/dist/cjs/utils/errorHandling.js +4 -1
  11. package/dist/es2019/clients/block-service/ari.js +11 -0
  12. package/dist/es2019/clients/block-service/blockService.js +12 -1
  13. package/dist/es2019/clients/confluence/sourceInfo.js +64 -29
  14. package/dist/es2019/providers/block-service/blockServiceAPI.js +45 -2
  15. package/dist/es2019/providers/syncBlockProvider.js +37 -5
  16. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +61 -18
  17. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +16 -1
  18. package/dist/es2019/store-manager/syncBlockStoreManager.js +64 -0
  19. package/dist/es2019/utils/errorHandling.js +2 -1
  20. package/dist/esm/clients/block-service/ari.js +11 -0
  21. package/dist/esm/clients/block-service/blockService.js +34 -1
  22. package/dist/esm/clients/confluence/sourceInfo.js +109 -52
  23. package/dist/esm/providers/block-service/blockServiceAPI.js +195 -125
  24. package/dist/esm/providers/syncBlockProvider.js +81 -12
  25. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +60 -17
  26. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +18 -1
  27. package/dist/esm/store-manager/syncBlockStoreManager.js +121 -0
  28. package/dist/esm/utils/errorHandling.js +3 -0
  29. package/dist/types/clients/block-service/ari.d.ts +1 -0
  30. package/dist/types/clients/block-service/blockService.d.ts +15 -5
  31. package/dist/types/clients/confluence/sourceInfo.d.ts +2 -2
  32. package/dist/types/common/types.d.ts +25 -0
  33. package/dist/types/index.d.ts +2 -2
  34. package/dist/types/providers/block-service/blockServiceAPI.d.ts +3 -2
  35. package/dist/types/providers/syncBlockProvider.d.ts +3 -2
  36. package/dist/types/providers/types.d.ts +16 -3
  37. package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +3 -2
  38. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +3 -2
  39. package/dist/types/store-manager/syncBlockStoreManager.d.ts +4 -0
  40. package/dist/types/utils/errorHandling.d.ts +1 -0
  41. package/dist/types-ts4.5/clients/block-service/ari.d.ts +1 -0
  42. package/dist/types-ts4.5/clients/block-service/blockService.d.ts +15 -5
  43. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +2 -2
  44. package/dist/types-ts4.5/common/types.d.ts +25 -0
  45. package/dist/types-ts4.5/index.d.ts +2 -2
  46. package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +3 -2
  47. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +3 -2
  48. package/dist/types-ts4.5/providers/types.d.ts +16 -3
  49. package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +3 -2
  50. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +3 -2
  51. package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +4 -0
  52. package/dist/types-ts4.5/utils/errorHandling.d.ts +1 -0
  53. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
@@ -5,11 +6,14 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
6
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
6
7
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
8
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
+ 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; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
12
  /* eslint-disable require-unicode-regexp */
10
13
  import { useMemo } from 'react';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
11
15
  import { generateBlockAri, generateBlockAriFromReference } from '../../clients/block-service/ari';
12
- import { batchRetrieveSyncedBlocks, BlockError, createSyncedBlock, deleteSyncedBlock, getReferenceSyncedBlocks, getSyncedBlockContent, updateReferenceSyncedBlockOnDocument, updateSyncedBlock } from '../../clients/block-service/blockService';
16
+ import { batchRetrieveSyncedBlocks, BlockError, createSyncedBlock, deleteSyncedBlock, getReferenceSyncedBlocks, getReferenceSyncedBlocksByBlockAri, getSyncedBlockContent, updateReferenceSyncedBlockOnDocument, updateSyncedBlock } from '../../clients/block-service/blockService';
13
17
  import { SyncBlockError } from '../../common/types';
14
18
  import { stringifyError } from '../../utils/errorHandling';
15
19
  var mapBlockError = function mapBlockError(error) {
@@ -237,6 +241,71 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
237
241
  }
238
242
  return fetchData;
239
243
  }()
244
+ }, {
245
+ key: "fetchReferences",
246
+ value: function () {
247
+ var _fetchReferences = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(referenceResourceId) {
248
+ var _this = this;
249
+ var blockAri, response, references;
250
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
251
+ while (1) switch (_context3.prev = _context3.next) {
252
+ case 0:
253
+ _context3.prev = 0;
254
+ blockAri = generateBlockAriFromReference({
255
+ cloudId: this.cloudId,
256
+ resourceId: referenceResourceId
257
+ });
258
+ _context3.next = 4;
259
+ return getReferenceSyncedBlocksByBlockAri({
260
+ blockAri: blockAri
261
+ });
262
+ case 4:
263
+ response = _context3.sent;
264
+ references = [];
265
+ response.references.forEach(function (reference) {
266
+ references.push(_objectSpread(_objectSpread({}, reference), {}, {
267
+ hasAccess: true,
268
+ onSamePage: _this.parentAri === reference.documentAri
269
+ }));
270
+ });
271
+ response.errors.forEach(function (reference) {
272
+ if (reference.code === 'FORBIDDEN') {
273
+ references.push({
274
+ blockAri: reference.blockAri,
275
+ documentAri: reference.documentAri,
276
+ hasAccess: false,
277
+ onSamePage: false
278
+ });
279
+ }
280
+ });
281
+ return _context3.abrupt("return", {
282
+ references: references
283
+ });
284
+ case 11:
285
+ _context3.prev = 11;
286
+ _context3.t0 = _context3["catch"](0);
287
+ if (!(_context3.t0 instanceof BlockError)) {
288
+ _context3.next = 15;
289
+ break;
290
+ }
291
+ return _context3.abrupt("return", {
292
+ error: mapBlockError(_context3.t0)
293
+ });
294
+ case 15:
295
+ return _context3.abrupt("return", {
296
+ error: SyncBlockError.Errored
297
+ });
298
+ case 16:
299
+ case "end":
300
+ return _context3.stop();
301
+ }
302
+ }, _callee3, this, [[0, 11]]);
303
+ }));
304
+ function fetchReferences(_x3) {
305
+ return _fetchReferences.apply(this, arguments);
306
+ }
307
+ return fetchReferences;
308
+ }()
240
309
  /**
241
310
  * Extracts the resourceId from a block ARI.
242
311
  * Block ARI format: ari:cloud:blocks:<cloudId>:synced-block/<resourceId>
@@ -256,60 +325,60 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
256
325
  }, {
257
326
  key: "batchFetchData",
258
327
  value: (function () {
259
- var _batchFetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resourceIds) {
260
- var _this = this;
328
+ var _batchFetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(resourceIds) {
329
+ var _this2 = this;
261
330
  var blockAris, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, value, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, _resourceId2;
262
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
263
- while (1) switch (_context3.prev = _context3.next) {
331
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
332
+ while (1) switch (_context4.prev = _context4.next) {
264
333
  case 0:
265
334
  blockAris = resourceIds.map(function (resourceId) {
266
335
  return generateBlockAriFromReference({
267
- cloudId: _this.cloudId,
336
+ cloudId: _this2.cloudId,
268
337
  resourceId: resourceId
269
338
  });
270
339
  }); // Create a set of valid resourceIds for validation
271
340
  validResourceIds = new Set(resourceIds); // Track which resourceIds have been processed
272
341
  processedResourceIds = new Set();
273
- _context3.prev = 3;
274
- _context3.next = 6;
342
+ _context4.prev = 3;
343
+ _context4.next = 6;
275
344
  return batchRetrieveSyncedBlocks({
276
345
  blockAris: blockAris
277
346
  });
278
347
  case 6:
279
- response = _context3.sent;
348
+ response = _context4.sent;
280
349
  results = []; // Process successful blocks
281
350
  if (!response.success) {
282
- _context3.next = 33;
351
+ _context4.next = 33;
283
352
  break;
284
353
  }
285
354
  _iterator = _createForOfIteratorHelper(response.success);
286
- _context3.prev = 10;
355
+ _context4.prev = 10;
287
356
  _iterator.s();
288
357
  case 12:
289
358
  if ((_step = _iterator.n()).done) {
290
- _context3.next = 25;
359
+ _context4.next = 25;
291
360
  break;
292
361
  }
293
362
  blockContentResponse = _step.value;
294
363
  // Extract resourceId from the returned blockAri
295
364
  resourceId = this.extractResourceIdFromBlockAri(blockContentResponse.blockAri);
296
365
  if (!(!resourceId || !validResourceIds.has(resourceId))) {
297
- _context3.next = 17;
366
+ _context4.next = 17;
298
367
  break;
299
368
  }
300
- return _context3.abrupt("continue", 23);
369
+ return _context4.abrupt("continue", 23);
301
370
  case 17:
302
371
  processedResourceIds.add(resourceId);
303
372
  value = blockContentResponse.content;
304
373
  if (value) {
305
- _context3.next = 22;
374
+ _context4.next = 22;
306
375
  break;
307
376
  }
308
377
  results.push({
309
378
  error: SyncBlockError.NotFound,
310
379
  resourceId: resourceId
311
380
  });
312
- return _context3.abrupt("continue", 23);
381
+ return _context4.abrupt("continue", 23);
313
382
  case 22:
314
383
  try {
315
384
  syncedBlockData = JSON.parse(value);
@@ -330,40 +399,40 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
330
399
  });
331
400
  }
332
401
  case 23:
333
- _context3.next = 12;
402
+ _context4.next = 12;
334
403
  break;
335
404
  case 25:
336
- _context3.next = 30;
405
+ _context4.next = 30;
337
406
  break;
338
407
  case 27:
339
- _context3.prev = 27;
340
- _context3.t0 = _context3["catch"](10);
341
- _iterator.e(_context3.t0);
408
+ _context4.prev = 27;
409
+ _context4.t0 = _context4["catch"](10);
410
+ _iterator.e(_context4.t0);
342
411
  case 30:
343
- _context3.prev = 30;
412
+ _context4.prev = 30;
344
413
  _iterator.f();
345
- return _context3.finish(30);
414
+ return _context4.finish(30);
346
415
  case 33:
347
416
  if (!response.error) {
348
- _context3.next = 54;
417
+ _context4.next = 54;
349
418
  break;
350
419
  }
351
420
  _iterator2 = _createForOfIteratorHelper(response.error);
352
- _context3.prev = 35;
421
+ _context4.prev = 35;
353
422
  _iterator2.s();
354
423
  case 37:
355
424
  if ((_step2 = _iterator2.n()).done) {
356
- _context3.next = 46;
425
+ _context4.next = 46;
357
426
  break;
358
427
  }
359
428
  errorResponse = _step2.value;
360
429
  // Extract resourceId from the returned blockAri
361
430
  _resourceId = this.extractResourceIdFromBlockAri(errorResponse.blockAri);
362
431
  if (!(!_resourceId || !validResourceIds.has(_resourceId))) {
363
- _context3.next = 42;
432
+ _context4.next = 42;
364
433
  break;
365
434
  }
366
- return _context3.abrupt("continue", 44);
435
+ return _context4.abrupt("continue", 44);
367
436
  case 42:
368
437
  processedResourceIds.add(_resourceId);
369
438
  results.push({
@@ -371,19 +440,19 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
371
440
  resourceId: _resourceId
372
441
  });
373
442
  case 44:
374
- _context3.next = 37;
443
+ _context4.next = 37;
375
444
  break;
376
445
  case 46:
377
- _context3.next = 51;
446
+ _context4.next = 51;
378
447
  break;
379
448
  case 48:
380
- _context3.prev = 48;
381
- _context3.t1 = _context3["catch"](35);
382
- _iterator2.e(_context3.t1);
449
+ _context4.prev = 48;
450
+ _context4.t1 = _context4["catch"](35);
451
+ _iterator2.e(_context4.t1);
383
452
  case 51:
384
- _context3.prev = 51;
453
+ _context4.prev = 51;
385
454
  _iterator2.f();
386
- return _context3.finish(51);
455
+ return _context4.finish(51);
387
456
  case 54:
388
457
  // Ensure all resourceIds have a result - return NotFound for any missing ones
389
458
  _iterator3 = _createForOfIteratorHelper(resourceIds);
@@ -402,23 +471,23 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
402
471
  } finally {
403
472
  _iterator3.f();
404
473
  }
405
- return _context3.abrupt("return", results);
474
+ return _context4.abrupt("return", results);
406
475
  case 59:
407
- _context3.prev = 59;
408
- _context3.t2 = _context3["catch"](3);
409
- return _context3.abrupt("return", resourceIds.map(function (resourceId) {
476
+ _context4.prev = 59;
477
+ _context4.t2 = _context4["catch"](3);
478
+ return _context4.abrupt("return", resourceIds.map(function (resourceId) {
410
479
  return {
411
- error: _context3.t2 instanceof BlockError ? mapBlockError(_context3.t2) : SyncBlockError.Errored,
480
+ error: _context4.t2 instanceof BlockError ? mapBlockError(_context4.t2) : SyncBlockError.Errored,
412
481
  resourceId: resourceId
413
482
  };
414
483
  }));
415
484
  case 62:
416
485
  case "end":
417
- return _context3.stop();
486
+ return _context4.stop();
418
487
  }
419
- }, _callee3, this, [[3, 59], [10, 27, 30, 33], [35, 48, 51, 54]]);
488
+ }, _callee4, this, [[3, 59], [10, 27, 30, 33], [35, 48, 51, 54]]);
420
489
  }));
421
- function batchFetchData(_x3) {
490
+ function batchFetchData(_x4) {
422
491
  return _batchFetchData.apply(this, arguments);
423
492
  }
424
493
  return batchFetchData;
@@ -447,16 +516,16 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
447
516
  return _createClass(BlockServiceADFWriteProvider, [{
448
517
  key: "writeData",
449
518
  value: function () {
450
- var _writeData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
519
+ var _writeData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
451
520
  var resourceId, blockAri, stepVersion;
452
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
453
- while (1) switch (_context4.prev = _context4.next) {
521
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
522
+ while (1) switch (_context5.prev = _context5.next) {
454
523
  case 0:
455
524
  if (!(!this.parentAri || !this.parentId)) {
456
- _context4.next = 2;
525
+ _context5.next = 2;
457
526
  break;
458
527
  }
459
- return _context4.abrupt("return", {
528
+ return _context5.abrupt("return", {
460
529
  error: SyncBlockError.Errored
461
530
  });
462
531
  case 2:
@@ -468,40 +537,40 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
468
537
  resourceId: resourceId
469
538
  });
470
539
  stepVersion = this.getVersion ? this.getVersion() : undefined;
471
- _context4.prev = 5;
472
- _context4.next = 8;
540
+ _context5.prev = 5;
541
+ _context5.next = 8;
473
542
  return updateSyncedBlock({
474
543
  blockAri: blockAri,
475
544
  content: JSON.stringify(data.content),
476
545
  stepVersion: stepVersion
477
546
  });
478
547
  case 8:
479
- return _context4.abrupt("return", {
548
+ return _context5.abrupt("return", {
480
549
  resourceId: resourceId
481
550
  });
482
551
  case 11:
483
- _context4.prev = 11;
484
- _context4.t0 = _context4["catch"](5);
485
- if (!(_context4.t0 instanceof BlockError)) {
486
- _context4.next = 15;
552
+ _context5.prev = 11;
553
+ _context5.t0 = _context5["catch"](5);
554
+ if (!(_context5.t0 instanceof BlockError)) {
555
+ _context5.next = 15;
487
556
  break;
488
557
  }
489
- return _context4.abrupt("return", {
490
- error: mapBlockError(_context4.t0),
558
+ return _context5.abrupt("return", {
559
+ error: mapBlockError(_context5.t0),
491
560
  resourceId: resourceId
492
561
  });
493
562
  case 15:
494
- return _context4.abrupt("return", {
495
- error: stringifyError(_context4.t0),
563
+ return _context5.abrupt("return", {
564
+ error: stringifyError(_context5.t0),
496
565
  resourceId: resourceId
497
566
  });
498
567
  case 16:
499
568
  case "end":
500
- return _context4.stop();
569
+ return _context5.stop();
501
570
  }
502
- }, _callee4, this, [[5, 11]]);
571
+ }, _callee5, this, [[5, 11]]);
503
572
  }));
504
- function writeData(_x4) {
573
+ function writeData(_x5) {
505
574
  return _writeData.apply(this, arguments);
506
575
  }
507
576
  return writeData;
@@ -509,16 +578,16 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
509
578
  }, {
510
579
  key: "createData",
511
580
  value: function () {
512
- var _createData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
581
+ var _createData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
513
582
  var resourceId, blockAri, stepVersion;
514
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
515
- while (1) switch (_context5.prev = _context5.next) {
583
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
584
+ while (1) switch (_context6.prev = _context6.next) {
516
585
  case 0:
517
586
  if (!(!this.parentAri || !this.parentId)) {
518
- _context5.next = 2;
587
+ _context6.next = 2;
519
588
  break;
520
589
  }
521
- return _context5.abrupt("return", {
590
+ return _context6.abrupt("return", {
522
591
  error: SyncBlockError.Errored
523
592
  });
524
593
  case 2:
@@ -530,8 +599,8 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
530
599
  resourceId: resourceId
531
600
  });
532
601
  stepVersion = this.getVersion ? this.getVersion() : undefined;
533
- _context5.prev = 5;
534
- _context5.next = 8;
602
+ _context6.prev = 5;
603
+ _context6.next = 8;
535
604
  return createSyncedBlock({
536
605
  blockAri: blockAri,
537
606
  blockInstanceId: data.blockInstanceId,
@@ -541,32 +610,32 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
541
610
  stepVersion: stepVersion
542
611
  });
543
612
  case 8:
544
- return _context5.abrupt("return", {
613
+ return _context6.abrupt("return", {
545
614
  resourceId: resourceId
546
615
  });
547
616
  case 11:
548
- _context5.prev = 11;
549
- _context5.t0 = _context5["catch"](5);
550
- if (!(_context5.t0 instanceof BlockError)) {
551
- _context5.next = 15;
617
+ _context6.prev = 11;
618
+ _context6.t0 = _context6["catch"](5);
619
+ if (!(_context6.t0 instanceof BlockError)) {
620
+ _context6.next = 15;
552
621
  break;
553
622
  }
554
- return _context5.abrupt("return", {
555
- error: mapBlockError(_context5.t0),
623
+ return _context6.abrupt("return", {
624
+ error: mapBlockError(_context6.t0),
556
625
  resourceId: resourceId
557
626
  });
558
627
  case 15:
559
- return _context5.abrupt("return", {
560
- error: stringifyError(_context5.t0),
628
+ return _context6.abrupt("return", {
629
+ error: stringifyError(_context6.t0),
561
630
  resourceId: resourceId
562
631
  });
563
632
  case 16:
564
633
  case "end":
565
- return _context5.stop();
634
+ return _context6.stop();
566
635
  }
567
- }, _callee5, this, [[5, 11]]);
636
+ }, _callee6, this, [[5, 11]]);
568
637
  }));
569
- function createData(_x5) {
638
+ function createData(_x6) {
570
639
  return _createData.apply(this, arguments);
571
640
  }
572
641
  return createData;
@@ -574,16 +643,16 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
574
643
  }, {
575
644
  key: "deleteData",
576
645
  value: function () {
577
- var _deleteData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(resourceId) {
646
+ var _deleteData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(resourceId) {
578
647
  var blockAri;
579
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
580
- while (1) switch (_context6.prev = _context6.next) {
648
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
649
+ while (1) switch (_context7.prev = _context7.next) {
581
650
  case 0:
582
651
  if (this.parentId) {
583
- _context6.next = 2;
652
+ _context7.next = 2;
584
653
  break;
585
654
  }
586
- return _context6.abrupt("return", {
655
+ return _context7.abrupt("return", {
587
656
  resourceId: resourceId,
588
657
  success: false,
589
658
  error: SyncBlockError.Errored
@@ -595,51 +664,51 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
595
664
  product: this.product,
596
665
  resourceId: resourceId
597
666
  });
598
- _context6.prev = 3;
599
- _context6.next = 6;
667
+ _context7.prev = 3;
668
+ _context7.next = 6;
600
669
  return deleteSyncedBlock({
601
670
  blockAri: blockAri
602
671
  });
603
672
  case 6:
604
- return _context6.abrupt("return", {
673
+ return _context7.abrupt("return", {
605
674
  resourceId: resourceId,
606
675
  success: true,
607
676
  error: undefined
608
677
  });
609
678
  case 9:
610
- _context6.prev = 9;
611
- _context6.t0 = _context6["catch"](3);
612
- if (!(_context6.t0 instanceof BlockError)) {
613
- _context6.next = 15;
679
+ _context7.prev = 9;
680
+ _context7.t0 = _context7["catch"](3);
681
+ if (!(_context7.t0 instanceof BlockError)) {
682
+ _context7.next = 15;
614
683
  break;
615
684
  }
616
- if (!(_context6.t0.status === 404)) {
617
- _context6.next = 14;
685
+ if (!(_context7.t0.status === 404)) {
686
+ _context7.next = 14;
618
687
  break;
619
688
  }
620
- return _context6.abrupt("return", {
689
+ return _context7.abrupt("return", {
621
690
  resourceId: resourceId,
622
691
  success: true
623
692
  });
624
693
  case 14:
625
- return _context6.abrupt("return", {
694
+ return _context7.abrupt("return", {
626
695
  resourceId: resourceId,
627
696
  success: false,
628
- error: mapBlockError(_context6.t0)
697
+ error: mapBlockError(_context7.t0)
629
698
  });
630
699
  case 15:
631
- return _context6.abrupt("return", {
700
+ return _context7.abrupt("return", {
632
701
  resourceId: resourceId,
633
702
  success: false,
634
- error: stringifyError(_context6.t0)
703
+ error: stringifyError(_context7.t0)
635
704
  });
636
705
  case 16:
637
706
  case "end":
638
- return _context6.stop();
707
+ return _context7.stop();
639
708
  }
640
- }, _callee6, this, [[3, 9]]);
709
+ }, _callee7, this, [[3, 9]]);
641
710
  }));
642
- function deleteData(_x6) {
711
+ function deleteData(_x7) {
643
712
  return _deleteData.apply(this, arguments);
644
713
  }
645
714
  return deleteData;
@@ -657,28 +726,28 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
657
726
  }, {
658
727
  key: "updateReferenceData",
659
728
  value: function () {
660
- var _updateReferenceData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(blocks, noContent) {
661
- var _this2 = this;
662
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
663
- while (1) switch (_context7.prev = _context7.next) {
729
+ var _updateReferenceData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(blocks, noContent) {
730
+ var _this3 = this;
731
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
732
+ while (1) switch (_context8.prev = _context8.next) {
664
733
  case 0:
665
734
  if (this.parentAri) {
666
- _context7.next = 2;
735
+ _context8.next = 2;
667
736
  break;
668
737
  }
669
- return _context7.abrupt("return", {
738
+ return _context8.abrupt("return", {
670
739
  success: false,
671
740
  error: SyncBlockError.Errored
672
741
  });
673
742
  case 2:
674
- _context7.prev = 2;
675
- _context7.next = 5;
743
+ _context8.prev = 2;
744
+ _context8.next = 5;
676
745
  return updateReferenceSyncedBlockOnDocument({
677
746
  documentAri: this.parentAri,
678
747
  blocks: blocks.map(function (block) {
679
748
  return {
680
749
  blockAri: generateBlockAriFromReference({
681
- cloudId: _this2.cloudId,
750
+ cloudId: _this3.cloudId,
682
751
  resourceId: block.resourceId
683
752
  }),
684
753
  blockInstanceId: block.localId
@@ -687,32 +756,32 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
687
756
  noContent: noContent
688
757
  });
689
758
  case 5:
690
- return _context7.abrupt("return", {
759
+ return _context8.abrupt("return", {
691
760
  success: true
692
761
  });
693
762
  case 8:
694
- _context7.prev = 8;
695
- _context7.t0 = _context7["catch"](2);
696
- if (!(_context7.t0 instanceof BlockError)) {
697
- _context7.next = 12;
763
+ _context8.prev = 8;
764
+ _context8.t0 = _context8["catch"](2);
765
+ if (!(_context8.t0 instanceof BlockError)) {
766
+ _context8.next = 12;
698
767
  break;
699
768
  }
700
- return _context7.abrupt("return", {
769
+ return _context8.abrupt("return", {
701
770
  success: false,
702
- error: mapBlockError(_context7.t0)
771
+ error: mapBlockError(_context8.t0)
703
772
  });
704
773
  case 12:
705
- return _context7.abrupt("return", {
774
+ return _context8.abrupt("return", {
706
775
  success: false,
707
- error: stringifyError(_context7.t0)
776
+ error: stringifyError(_context8.t0)
708
777
  });
709
778
  case 13:
710
779
  case "end":
711
- return _context7.stop();
780
+ return _context8.stop();
712
781
  }
713
- }, _callee7, this, [[2, 8]]);
782
+ }, _callee8, this, [[2, 8]]);
714
783
  }));
715
- function updateReferenceData(_x7, _x8) {
784
+ function updateReferenceData(_x8, _x9) {
716
785
  return _updateReferenceData.apply(this, arguments);
717
786
  }
718
787
  return updateReferenceData;
@@ -727,7 +796,8 @@ var createBlockServiceAPIProviders = function createBlockServiceAPIProviders(_re
727
796
  getVersion = _ref5.getVersion;
728
797
  return {
729
798
  fetchProvider: new BlockServiceADFFetchProvider({
730
- cloudId: cloudId
799
+ cloudId: cloudId,
800
+ parentAri: fg('platform_synced_block_dogfooding') ? parentAri : undefined
731
801
  }),
732
802
  writeProvider: new BlockServiceADFWriteProvider({
733
803
  cloudId: cloudId,