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