@atlaskit/editor-synced-block-provider 3.2.2 → 3.4.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 +92 -46
- package/dist/cjs/providers/block-service/blockServiceAPI.js +275 -76
- package/dist/cjs/providers/syncBlockProvider.js +85 -47
- package/dist/es2019/clients/block-service/blockService.js +24 -0
- package/dist/es2019/providers/block-service/blockServiceAPI.js +118 -2
- package/dist/es2019/providers/syncBlockProvider.js +26 -13
- package/dist/esm/clients/block-service/blockService.js +91 -45
- package/dist/esm/providers/block-service/blockServiceAPI.js +276 -75
- package/dist/esm/providers/syncBlockProvider.js +85 -47
- package/dist/types/clients/block-service/blockService.d.ts +16 -0
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +11 -0
- package/dist/types/providers/syncBlockProvider.d.ts +1 -1
- package/dist/types/providers/types.d.ts +1 -0
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +16 -0
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +11 -0
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +1 -1
- package/dist/types-ts4.5/providers/types.d.ts +1 -0
- package/package.json +8 -2
|
@@ -15,8 +15,9 @@ var _ari = require("../../clients/block-service/ari");
|
|
|
15
15
|
var _blockService = require("../../clients/block-service/blockService");
|
|
16
16
|
var _types = require("../../common/types");
|
|
17
17
|
var _errorHandling = require("../../utils/errorHandling");
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
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; } } }; }
|
|
19
|
+
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; } }
|
|
20
|
+
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; } /* eslint-disable require-unicode-regexp */
|
|
20
21
|
var mapBlockError = function mapBlockError(error) {
|
|
21
22
|
switch (error.status) {
|
|
22
23
|
case 400:
|
|
@@ -46,10 +47,22 @@ var mapBlockError = function mapBlockError(error) {
|
|
|
46
47
|
// - sourceTitle
|
|
47
48
|
// - isSynced
|
|
48
49
|
var convertToSyncBlockData = function convertToSyncBlockData(data) {
|
|
50
|
+
var createdAt;
|
|
51
|
+
if (data.createdAt) {
|
|
52
|
+
try {
|
|
53
|
+
// BE returns microseconds, convert to milliseconds
|
|
54
|
+
// BE should fix this in the future
|
|
55
|
+
createdAt = new Date(data.createdAt / 1000).toISOString();
|
|
56
|
+
} catch (e) {
|
|
57
|
+
// fallback to undefined
|
|
58
|
+
// as we don't want to block the whole process due to invalid date
|
|
59
|
+
createdAt = undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
49
62
|
return {
|
|
50
63
|
blockInstanceId: data.blockInstanceId,
|
|
51
64
|
content: JSON.parse(data.content),
|
|
52
|
-
createdAt:
|
|
65
|
+
createdAt: createdAt,
|
|
53
66
|
createdBy: data.createdBy,
|
|
54
67
|
product: data.product,
|
|
55
68
|
resourceId: data.blockAri,
|
|
@@ -193,6 +206,192 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
193
206
|
}
|
|
194
207
|
return fetchData;
|
|
195
208
|
}()
|
|
209
|
+
/**
|
|
210
|
+
* Extracts the resourceId from a block ARI.
|
|
211
|
+
* Block ARI format: ari:cloud:blocks:<cloudId>:synced-block/<resourceId>
|
|
212
|
+
*/
|
|
213
|
+
}, {
|
|
214
|
+
key: "extractResourceIdFromBlockAri",
|
|
215
|
+
value: function extractResourceIdFromBlockAri(blockAri) {
|
|
216
|
+
var match = blockAri.match(/ari:cloud:blocks:[^:]+:synced-block\/(.+)$/);
|
|
217
|
+
return match === null || match === void 0 ? void 0 : match[1];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Batch fetches multiple synced blocks by their resource IDs.
|
|
222
|
+
* @param resourceIds - Array of resource IDs to fetch
|
|
223
|
+
* @returns Array of SyncBlockInstance results
|
|
224
|
+
*/
|
|
225
|
+
}, {
|
|
226
|
+
key: "batchFetchData",
|
|
227
|
+
value: (function () {
|
|
228
|
+
var _batchFetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resourceIds) {
|
|
229
|
+
var _this = this;
|
|
230
|
+
var blockAris, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, value, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, _resourceId2;
|
|
231
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
232
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
233
|
+
case 0:
|
|
234
|
+
blockAris = resourceIds.map(function (resourceId) {
|
|
235
|
+
return (0, _ari.generateBlockAriFromReference)({
|
|
236
|
+
cloudId: _this.cloudId,
|
|
237
|
+
resourceId: resourceId
|
|
238
|
+
});
|
|
239
|
+
}); // Create a set of valid resourceIds for validation
|
|
240
|
+
validResourceIds = new Set(resourceIds); // Track which resourceIds have been processed
|
|
241
|
+
processedResourceIds = new Set();
|
|
242
|
+
_context3.prev = 3;
|
|
243
|
+
_context3.next = 6;
|
|
244
|
+
return (0, _blockService.batchRetrieveSyncedBlocks)({
|
|
245
|
+
blockAris: blockAris
|
|
246
|
+
});
|
|
247
|
+
case 6:
|
|
248
|
+
response = _context3.sent;
|
|
249
|
+
results = []; // Process successful blocks
|
|
250
|
+
if (!response.success) {
|
|
251
|
+
_context3.next = 33;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
_iterator = _createForOfIteratorHelper(response.success);
|
|
255
|
+
_context3.prev = 10;
|
|
256
|
+
_iterator.s();
|
|
257
|
+
case 12:
|
|
258
|
+
if ((_step = _iterator.n()).done) {
|
|
259
|
+
_context3.next = 25;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
blockContentResponse = _step.value;
|
|
263
|
+
// Extract resourceId from the returned blockAri
|
|
264
|
+
resourceId = this.extractResourceIdFromBlockAri(blockContentResponse.blockAri);
|
|
265
|
+
if (!(!resourceId || !validResourceIds.has(resourceId))) {
|
|
266
|
+
_context3.next = 17;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
return _context3.abrupt("continue", 23);
|
|
270
|
+
case 17:
|
|
271
|
+
processedResourceIds.add(resourceId);
|
|
272
|
+
value = blockContentResponse.content;
|
|
273
|
+
if (value) {
|
|
274
|
+
_context3.next = 22;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
results.push({
|
|
278
|
+
error: _types.SyncBlockError.NotFound,
|
|
279
|
+
resourceId: resourceId
|
|
280
|
+
});
|
|
281
|
+
return _context3.abrupt("continue", 23);
|
|
282
|
+
case 22:
|
|
283
|
+
try {
|
|
284
|
+
syncedBlockData = JSON.parse(value);
|
|
285
|
+
results.push({
|
|
286
|
+
data: {
|
|
287
|
+
content: syncedBlockData,
|
|
288
|
+
resourceId: blockContentResponse.blockAri,
|
|
289
|
+
blockInstanceId: blockContentResponse.blockInstanceId,
|
|
290
|
+
sourceAri: blockContentResponse.sourceAri,
|
|
291
|
+
product: blockContentResponse.product
|
|
292
|
+
},
|
|
293
|
+
resourceId: resourceId
|
|
294
|
+
});
|
|
295
|
+
} catch (_unused2) {
|
|
296
|
+
results.push({
|
|
297
|
+
error: _types.SyncBlockError.Errored,
|
|
298
|
+
resourceId: resourceId
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
case 23:
|
|
302
|
+
_context3.next = 12;
|
|
303
|
+
break;
|
|
304
|
+
case 25:
|
|
305
|
+
_context3.next = 30;
|
|
306
|
+
break;
|
|
307
|
+
case 27:
|
|
308
|
+
_context3.prev = 27;
|
|
309
|
+
_context3.t0 = _context3["catch"](10);
|
|
310
|
+
_iterator.e(_context3.t0);
|
|
311
|
+
case 30:
|
|
312
|
+
_context3.prev = 30;
|
|
313
|
+
_iterator.f();
|
|
314
|
+
return _context3.finish(30);
|
|
315
|
+
case 33:
|
|
316
|
+
if (!response.error) {
|
|
317
|
+
_context3.next = 54;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
_iterator2 = _createForOfIteratorHelper(response.error);
|
|
321
|
+
_context3.prev = 35;
|
|
322
|
+
_iterator2.s();
|
|
323
|
+
case 37:
|
|
324
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
325
|
+
_context3.next = 46;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
errorResponse = _step2.value;
|
|
329
|
+
// Extract resourceId from the returned blockAri
|
|
330
|
+
_resourceId = this.extractResourceIdFromBlockAri(errorResponse.blockAri);
|
|
331
|
+
if (!(!_resourceId || !validResourceIds.has(_resourceId))) {
|
|
332
|
+
_context3.next = 42;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
return _context3.abrupt("continue", 44);
|
|
336
|
+
case 42:
|
|
337
|
+
processedResourceIds.add(_resourceId);
|
|
338
|
+
results.push({
|
|
339
|
+
error: _types.SyncBlockError.Errored,
|
|
340
|
+
resourceId: _resourceId
|
|
341
|
+
});
|
|
342
|
+
case 44:
|
|
343
|
+
_context3.next = 37;
|
|
344
|
+
break;
|
|
345
|
+
case 46:
|
|
346
|
+
_context3.next = 51;
|
|
347
|
+
break;
|
|
348
|
+
case 48:
|
|
349
|
+
_context3.prev = 48;
|
|
350
|
+
_context3.t1 = _context3["catch"](35);
|
|
351
|
+
_iterator2.e(_context3.t1);
|
|
352
|
+
case 51:
|
|
353
|
+
_context3.prev = 51;
|
|
354
|
+
_iterator2.f();
|
|
355
|
+
return _context3.finish(51);
|
|
356
|
+
case 54:
|
|
357
|
+
// Ensure all resourceIds have a result - return NotFound for any missing ones
|
|
358
|
+
_iterator3 = _createForOfIteratorHelper(resourceIds);
|
|
359
|
+
try {
|
|
360
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
361
|
+
_resourceId2 = _step3.value;
|
|
362
|
+
if (!processedResourceIds.has(_resourceId2)) {
|
|
363
|
+
results.push({
|
|
364
|
+
error: _types.SyncBlockError.NotFound,
|
|
365
|
+
resourceId: _resourceId2
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
} catch (err) {
|
|
370
|
+
_iterator3.e(err);
|
|
371
|
+
} finally {
|
|
372
|
+
_iterator3.f();
|
|
373
|
+
}
|
|
374
|
+
return _context3.abrupt("return", results);
|
|
375
|
+
case 59:
|
|
376
|
+
_context3.prev = 59;
|
|
377
|
+
_context3.t2 = _context3["catch"](3);
|
|
378
|
+
return _context3.abrupt("return", resourceIds.map(function (resourceId) {
|
|
379
|
+
return {
|
|
380
|
+
error: _context3.t2 instanceof _blockService.BlockError ? mapBlockError(_context3.t2) : _types.SyncBlockError.Errored,
|
|
381
|
+
resourceId: resourceId
|
|
382
|
+
};
|
|
383
|
+
}));
|
|
384
|
+
case 62:
|
|
385
|
+
case "end":
|
|
386
|
+
return _context3.stop();
|
|
387
|
+
}
|
|
388
|
+
}, _callee3, this, [[3, 59], [10, 27, 30, 33], [35, 48, 51, 54]]);
|
|
389
|
+
}));
|
|
390
|
+
function batchFetchData(_x3) {
|
|
391
|
+
return _batchFetchData.apply(this, arguments);
|
|
392
|
+
}
|
|
393
|
+
return batchFetchData;
|
|
394
|
+
}())
|
|
196
395
|
}]);
|
|
197
396
|
}();
|
|
198
397
|
/**
|
|
@@ -217,10 +416,10 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
217
416
|
return (0, _createClass2.default)(BlockServiceADFWriteProvider, [{
|
|
218
417
|
key: "writeData",
|
|
219
418
|
value: function () {
|
|
220
|
-
var _writeData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
419
|
+
var _writeData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(data) {
|
|
221
420
|
var resourceId, blockAri, stepVersion;
|
|
222
|
-
return _regenerator.default.wrap(function
|
|
223
|
-
while (1) switch (
|
|
421
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
422
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
224
423
|
case 0:
|
|
225
424
|
resourceId = data.resourceId;
|
|
226
425
|
blockAri = (0, _ari.generateBlockAri)({
|
|
@@ -230,40 +429,40 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
230
429
|
resourceId: resourceId
|
|
231
430
|
});
|
|
232
431
|
stepVersion = this.getVersion ? this.getVersion() : undefined;
|
|
233
|
-
|
|
234
|
-
|
|
432
|
+
_context4.prev = 3;
|
|
433
|
+
_context4.next = 6;
|
|
235
434
|
return (0, _blockService.updateSyncedBlock)({
|
|
236
435
|
blockAri: blockAri,
|
|
237
436
|
content: JSON.stringify(data.content),
|
|
238
437
|
stepVersion: stepVersion
|
|
239
438
|
});
|
|
240
439
|
case 6:
|
|
241
|
-
return
|
|
440
|
+
return _context4.abrupt("return", {
|
|
242
441
|
resourceId: resourceId
|
|
243
442
|
});
|
|
244
443
|
case 9:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (!(
|
|
248
|
-
|
|
444
|
+
_context4.prev = 9;
|
|
445
|
+
_context4.t0 = _context4["catch"](3);
|
|
446
|
+
if (!(_context4.t0 instanceof _blockService.BlockError)) {
|
|
447
|
+
_context4.next = 13;
|
|
249
448
|
break;
|
|
250
449
|
}
|
|
251
|
-
return
|
|
252
|
-
error: mapBlockError(
|
|
450
|
+
return _context4.abrupt("return", {
|
|
451
|
+
error: mapBlockError(_context4.t0),
|
|
253
452
|
resourceId: resourceId
|
|
254
453
|
});
|
|
255
454
|
case 13:
|
|
256
|
-
return
|
|
257
|
-
error: (0, _errorHandling.stringifyError)(
|
|
455
|
+
return _context4.abrupt("return", {
|
|
456
|
+
error: (0, _errorHandling.stringifyError)(_context4.t0),
|
|
258
457
|
resourceId: resourceId
|
|
259
458
|
});
|
|
260
459
|
case 14:
|
|
261
460
|
case "end":
|
|
262
|
-
return
|
|
461
|
+
return _context4.stop();
|
|
263
462
|
}
|
|
264
|
-
},
|
|
463
|
+
}, _callee4, this, [[3, 9]]);
|
|
265
464
|
}));
|
|
266
|
-
function writeData(
|
|
465
|
+
function writeData(_x4) {
|
|
267
466
|
return _writeData.apply(this, arguments);
|
|
268
467
|
}
|
|
269
468
|
return writeData;
|
|
@@ -271,10 +470,10 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
271
470
|
}, {
|
|
272
471
|
key: "createData",
|
|
273
472
|
value: function () {
|
|
274
|
-
var _createData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
473
|
+
var _createData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(data) {
|
|
275
474
|
var resourceId, blockAri, stepVersion;
|
|
276
|
-
return _regenerator.default.wrap(function
|
|
277
|
-
while (1) switch (
|
|
475
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
476
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
278
477
|
case 0:
|
|
279
478
|
resourceId = data.resourceId;
|
|
280
479
|
blockAri = (0, _ari.generateBlockAri)({
|
|
@@ -284,8 +483,8 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
284
483
|
resourceId: resourceId
|
|
285
484
|
});
|
|
286
485
|
stepVersion = this.getVersion ? this.getVersion() : undefined;
|
|
287
|
-
|
|
288
|
-
|
|
486
|
+
_context5.prev = 3;
|
|
487
|
+
_context5.next = 6;
|
|
289
488
|
return (0, _blockService.createSyncedBlock)({
|
|
290
489
|
blockAri: blockAri,
|
|
291
490
|
blockInstanceId: data.blockInstanceId,
|
|
@@ -295,32 +494,32 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
295
494
|
stepVersion: stepVersion
|
|
296
495
|
});
|
|
297
496
|
case 6:
|
|
298
|
-
return
|
|
497
|
+
return _context5.abrupt("return", {
|
|
299
498
|
resourceId: resourceId
|
|
300
499
|
});
|
|
301
500
|
case 9:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (!(
|
|
305
|
-
|
|
501
|
+
_context5.prev = 9;
|
|
502
|
+
_context5.t0 = _context5["catch"](3);
|
|
503
|
+
if (!(_context5.t0 instanceof _blockService.BlockError)) {
|
|
504
|
+
_context5.next = 13;
|
|
306
505
|
break;
|
|
307
506
|
}
|
|
308
|
-
return
|
|
309
|
-
error: mapBlockError(
|
|
507
|
+
return _context5.abrupt("return", {
|
|
508
|
+
error: mapBlockError(_context5.t0),
|
|
310
509
|
resourceId: resourceId
|
|
311
510
|
});
|
|
312
511
|
case 13:
|
|
313
|
-
return
|
|
314
|
-
error: (0, _errorHandling.stringifyError)(
|
|
512
|
+
return _context5.abrupt("return", {
|
|
513
|
+
error: (0, _errorHandling.stringifyError)(_context5.t0),
|
|
315
514
|
resourceId: resourceId
|
|
316
515
|
});
|
|
317
516
|
case 14:
|
|
318
517
|
case "end":
|
|
319
|
-
return
|
|
518
|
+
return _context5.stop();
|
|
320
519
|
}
|
|
321
|
-
},
|
|
520
|
+
}, _callee5, this, [[3, 9]]);
|
|
322
521
|
}));
|
|
323
|
-
function createData(
|
|
522
|
+
function createData(_x5) {
|
|
324
523
|
return _createData.apply(this, arguments);
|
|
325
524
|
}
|
|
326
525
|
return createData;
|
|
@@ -328,10 +527,10 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
328
527
|
}, {
|
|
329
528
|
key: "deleteData",
|
|
330
529
|
value: function () {
|
|
331
|
-
var _deleteData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
530
|
+
var _deleteData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resourceId) {
|
|
332
531
|
var blockAri;
|
|
333
|
-
return _regenerator.default.wrap(function
|
|
334
|
-
while (1) switch (
|
|
532
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
533
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
335
534
|
case 0:
|
|
336
535
|
blockAri = (0, _ari.generateBlockAri)({
|
|
337
536
|
cloudId: this.cloudId,
|
|
@@ -339,51 +538,51 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
339
538
|
product: this.product,
|
|
340
539
|
resourceId: resourceId
|
|
341
540
|
});
|
|
342
|
-
|
|
343
|
-
|
|
541
|
+
_context6.prev = 1;
|
|
542
|
+
_context6.next = 4;
|
|
344
543
|
return (0, _blockService.deleteSyncedBlock)({
|
|
345
544
|
blockAri: blockAri
|
|
346
545
|
});
|
|
347
546
|
case 4:
|
|
348
|
-
return
|
|
547
|
+
return _context6.abrupt("return", {
|
|
349
548
|
resourceId: resourceId,
|
|
350
549
|
success: true,
|
|
351
550
|
error: undefined
|
|
352
551
|
});
|
|
353
552
|
case 7:
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if (!(
|
|
357
|
-
|
|
553
|
+
_context6.prev = 7;
|
|
554
|
+
_context6.t0 = _context6["catch"](1);
|
|
555
|
+
if (!(_context6.t0 instanceof _blockService.BlockError)) {
|
|
556
|
+
_context6.next = 13;
|
|
358
557
|
break;
|
|
359
558
|
}
|
|
360
|
-
if (!(
|
|
361
|
-
|
|
559
|
+
if (!(_context6.t0.status === 404)) {
|
|
560
|
+
_context6.next = 12;
|
|
362
561
|
break;
|
|
363
562
|
}
|
|
364
|
-
return
|
|
563
|
+
return _context6.abrupt("return", {
|
|
365
564
|
resourceId: resourceId,
|
|
366
565
|
success: true
|
|
367
566
|
});
|
|
368
567
|
case 12:
|
|
369
|
-
return
|
|
568
|
+
return _context6.abrupt("return", {
|
|
370
569
|
resourceId: resourceId,
|
|
371
570
|
success: false,
|
|
372
|
-
error: mapBlockError(
|
|
571
|
+
error: mapBlockError(_context6.t0)
|
|
373
572
|
});
|
|
374
573
|
case 13:
|
|
375
|
-
return
|
|
574
|
+
return _context6.abrupt("return", {
|
|
376
575
|
resourceId: resourceId,
|
|
377
576
|
success: false,
|
|
378
|
-
error: (0, _errorHandling.stringifyError)(
|
|
577
|
+
error: (0, _errorHandling.stringifyError)(_context6.t0)
|
|
379
578
|
});
|
|
380
579
|
case 14:
|
|
381
580
|
case "end":
|
|
382
|
-
return
|
|
581
|
+
return _context6.stop();
|
|
383
582
|
}
|
|
384
|
-
},
|
|
583
|
+
}, _callee6, this, [[1, 7]]);
|
|
385
584
|
}));
|
|
386
|
-
function deleteData(
|
|
585
|
+
function deleteData(_x6) {
|
|
387
586
|
return _deleteData.apply(this, arguments);
|
|
388
587
|
}
|
|
389
588
|
return deleteData;
|
|
@@ -401,19 +600,19 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
401
600
|
}, {
|
|
402
601
|
key: "updateReferenceData",
|
|
403
602
|
value: function () {
|
|
404
|
-
var _updateReferenceData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
405
|
-
var
|
|
406
|
-
return _regenerator.default.wrap(function
|
|
407
|
-
while (1) switch (
|
|
603
|
+
var _updateReferenceData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(blocks, noContent) {
|
|
604
|
+
var _this2 = this;
|
|
605
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
606
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
408
607
|
case 0:
|
|
409
|
-
|
|
410
|
-
|
|
608
|
+
_context7.prev = 0;
|
|
609
|
+
_context7.next = 3;
|
|
411
610
|
return (0, _blockService.updateReferenceSyncedBlockOnDocument)({
|
|
412
611
|
documentAri: this.parentAri,
|
|
413
612
|
blocks: blocks.map(function (block) {
|
|
414
613
|
return {
|
|
415
614
|
blockAri: (0, _ari.generateBlockAriFromReference)({
|
|
416
|
-
cloudId:
|
|
615
|
+
cloudId: _this2.cloudId,
|
|
417
616
|
resourceId: block.resourceId
|
|
418
617
|
}),
|
|
419
618
|
blockInstanceId: block.localId
|
|
@@ -422,32 +621,32 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
422
621
|
noContent: noContent
|
|
423
622
|
});
|
|
424
623
|
case 3:
|
|
425
|
-
return
|
|
624
|
+
return _context7.abrupt("return", {
|
|
426
625
|
success: true
|
|
427
626
|
});
|
|
428
627
|
case 6:
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
if (!(
|
|
432
|
-
|
|
628
|
+
_context7.prev = 6;
|
|
629
|
+
_context7.t0 = _context7["catch"](0);
|
|
630
|
+
if (!(_context7.t0 instanceof _blockService.BlockError)) {
|
|
631
|
+
_context7.next = 10;
|
|
433
632
|
break;
|
|
434
633
|
}
|
|
435
|
-
return
|
|
634
|
+
return _context7.abrupt("return", {
|
|
436
635
|
success: false,
|
|
437
|
-
error: mapBlockError(
|
|
636
|
+
error: mapBlockError(_context7.t0)
|
|
438
637
|
});
|
|
439
638
|
case 10:
|
|
440
|
-
return
|
|
639
|
+
return _context7.abrupt("return", {
|
|
441
640
|
success: false,
|
|
442
|
-
error: (0, _errorHandling.stringifyError)(
|
|
641
|
+
error: (0, _errorHandling.stringifyError)(_context7.t0)
|
|
443
642
|
});
|
|
444
643
|
case 11:
|
|
445
644
|
case "end":
|
|
446
|
-
return
|
|
645
|
+
return _context7.stop();
|
|
447
646
|
}
|
|
448
|
-
},
|
|
647
|
+
}, _callee7, this, [[0, 6]]);
|
|
449
648
|
}));
|
|
450
|
-
function updateReferenceData(
|
|
649
|
+
function updateReferenceData(_x7, _x8) {
|
|
451
650
|
return _updateReferenceData.apply(this, arguments);
|
|
452
651
|
}
|
|
453
652
|
return updateReferenceData;
|