@atlaskit/editor-synced-block-provider 6.6.9 → 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.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/clients/block-service/blockService.js +107 -107
- package/dist/cjs/clients/confluence/fetchMediaToken.js +21 -21
- package/dist/cjs/clients/confluence/sourceInfo.js +24 -24
- package/dist/cjs/clients/jira/fetchMediaToken.js +21 -21
- package/dist/cjs/clients/jira/sourceInfo.js +24 -24
- package/dist/cjs/hooks/useFetchSyncBlockData.js +18 -18
- package/dist/cjs/providers/block-service/blockServiceAPI.js +322 -321
- package/dist/cjs/providers/syncBlockProvider.js +49 -48
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +75 -75
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +77 -78
- package/dist/cjs/store-manager/syncBlockStoreManager.js +41 -41
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +7 -18
- package/dist/cjs/utils/resourceId.js +2 -1
- package/dist/cjs/utils/retry.js +8 -8
- package/dist/cjs/utils/utils.js +4 -3
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +1 -1
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +1 -2
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +7 -18
- package/dist/es2019/utils/utils.js +1 -2
- package/dist/esm/clients/block-service/blockService.js +107 -107
- package/dist/esm/clients/confluence/fetchMediaToken.js +21 -21
- package/dist/esm/clients/confluence/sourceInfo.js +24 -24
- package/dist/esm/clients/jira/fetchMediaToken.js +21 -21
- package/dist/esm/clients/jira/sourceInfo.js +24 -24
- package/dist/esm/hooks/useFetchSyncBlockData.js +18 -18
- package/dist/esm/providers/block-service/blockServiceAPI.js +321 -320
- package/dist/esm/providers/syncBlockProvider.js +49 -48
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +75 -75
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +77 -78
- package/dist/esm/store-manager/syncBlockStoreManager.js +41 -41
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +7 -18
- package/dist/esm/utils/resourceId.js +2 -1
- package/dist/esm/utils/retry.js +8 -8
- package/dist/esm/utils/utils.js +1 -2
- package/package.json +5 -8
|
@@ -119,28 +119,28 @@ export var convertToSyncBlockData = function convertToSyncBlockData(data, resour
|
|
|
119
119
|
};
|
|
120
120
|
export var fetchReferences = /*#__PURE__*/function () {
|
|
121
121
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(documentAri) {
|
|
122
|
-
var response, _ref2, blocks, errors, blocksInstances, errorInstances;
|
|
123
|
-
return _regeneratorRuntime.wrap(function
|
|
122
|
+
var response, _ref2, blocks, errors, blocksInstances, errorInstances, _t;
|
|
123
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
124
124
|
while (1) switch (_context.prev = _context.next) {
|
|
125
125
|
case 0:
|
|
126
126
|
_context.prev = 0;
|
|
127
|
-
_context.next =
|
|
127
|
+
_context.next = 1;
|
|
128
128
|
return getReferenceSyncedBlocks(documentAri);
|
|
129
|
-
case
|
|
129
|
+
case 1:
|
|
130
130
|
response = _context.sent;
|
|
131
|
-
_context.next =
|
|
131
|
+
_context.next = 4;
|
|
132
132
|
break;
|
|
133
|
-
case
|
|
134
|
-
_context.prev =
|
|
135
|
-
|
|
136
|
-
if (!(
|
|
137
|
-
_context.next =
|
|
133
|
+
case 2:
|
|
134
|
+
_context.prev = 2;
|
|
135
|
+
_t = _context["catch"](0);
|
|
136
|
+
if (!(_t instanceof BlockError)) {
|
|
137
|
+
_context.next = 3;
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
|
-
return _context.abrupt("return", mapBlockError(
|
|
141
|
-
case
|
|
140
|
+
return _context.abrupt("return", mapBlockError(_t));
|
|
141
|
+
case 3:
|
|
142
142
|
return _context.abrupt("return", SyncBlockError.Errored);
|
|
143
|
-
case
|
|
143
|
+
case 4:
|
|
144
144
|
_ref2 = response || {}, blocks = _ref2.blocks, errors = _ref2.errors;
|
|
145
145
|
blocksInstances = (blocks || []).map(function (blockContentResponse) {
|
|
146
146
|
try {
|
|
@@ -177,11 +177,11 @@ export var fetchReferences = /*#__PURE__*/function () {
|
|
|
177
177
|
};
|
|
178
178
|
});
|
|
179
179
|
return _context.abrupt("return", [].concat(_toConsumableArray(blocksInstances), _toConsumableArray(errorInstances)));
|
|
180
|
-
case
|
|
180
|
+
case 5:
|
|
181
181
|
case "end":
|
|
182
182
|
return _context.stop();
|
|
183
183
|
}
|
|
184
|
-
}, _callee, null, [[0,
|
|
184
|
+
}, _callee, null, [[0, 2]]);
|
|
185
185
|
}));
|
|
186
186
|
return function fetchReferences(_x) {
|
|
187
187
|
return _ref.apply(this, arguments);
|
|
@@ -207,8 +207,8 @@ export var extractResourceIdFromBlockAri = function extractResourceIdFromBlockAr
|
|
|
207
207
|
*/
|
|
208
208
|
var _batchFetchData = /*#__PURE__*/function () {
|
|
209
209
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId, parentAri, blockNodeIdentifiers, config) {
|
|
210
|
-
var blockIdentifiers, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, content, deletionReason, sourceAri, blockAri, contentUpdatedAt, blockInstanceId, product, status, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, blockNodeIdentifier;
|
|
211
|
-
return _regeneratorRuntime.wrap(function
|
|
210
|
+
var blockIdentifiers, validResourceIds, processedResourceIds, response, results, _iterator, _step, blockContentResponse, resourceId, content, deletionReason, sourceAri, blockAri, contentUpdatedAt, blockInstanceId, product, status, syncedBlockData, _iterator2, _step2, errorResponse, _resourceId, _iterator3, _step3, blockNodeIdentifier, _t2, _t3, _t4;
|
|
211
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
212
212
|
while (1) switch (_context2.prev = _context2.next) {
|
|
213
213
|
case 0:
|
|
214
214
|
blockIdentifiers = blockNodeIdentifiers.map(function (blockIdentifier) {
|
|
@@ -225,7 +225,7 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
225
225
|
})); // Track which resourceIds have been processed
|
|
226
226
|
processedResourceIds = new Set();
|
|
227
227
|
if (parentAri) {
|
|
228
|
-
_context2.next =
|
|
228
|
+
_context2.next = 1;
|
|
229
229
|
break;
|
|
230
230
|
}
|
|
231
231
|
return _context2.abrupt("return", blockNodeIdentifiers.map(function (blockNodeIdentifier) {
|
|
@@ -236,41 +236,41 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
236
236
|
resourceId: blockNodeIdentifier.resourceId
|
|
237
237
|
};
|
|
238
238
|
}));
|
|
239
|
-
case
|
|
240
|
-
_context2.prev =
|
|
241
|
-
_context2.next =
|
|
239
|
+
case 1:
|
|
240
|
+
_context2.prev = 1;
|
|
241
|
+
_context2.next = 2;
|
|
242
242
|
return batchRetrieveSyncedBlocks({
|
|
243
243
|
blockIdentifiers: blockIdentifiers,
|
|
244
244
|
config: config
|
|
245
245
|
});
|
|
246
|
-
case
|
|
246
|
+
case 2:
|
|
247
247
|
response = _context2.sent;
|
|
248
248
|
results = []; // Process successful blocks
|
|
249
249
|
if (!response.success) {
|
|
250
|
-
_context2.next =
|
|
250
|
+
_context2.next = 11;
|
|
251
251
|
break;
|
|
252
252
|
}
|
|
253
253
|
_iterator = _createForOfIteratorHelper(response.success);
|
|
254
|
-
_context2.prev =
|
|
254
|
+
_context2.prev = 3;
|
|
255
255
|
_iterator.s();
|
|
256
|
-
case
|
|
256
|
+
case 4:
|
|
257
257
|
if ((_step = _iterator.n()).done) {
|
|
258
|
-
_context2.next =
|
|
258
|
+
_context2.next = 8;
|
|
259
259
|
break;
|
|
260
260
|
}
|
|
261
261
|
blockContentResponse = _step.value;
|
|
262
262
|
// Extract resourceId from the returned blockAri
|
|
263
263
|
resourceId = extractResourceIdFromBlockAri(blockContentResponse.blockAri);
|
|
264
264
|
if (!(!resourceId || !validResourceIds.has(resourceId))) {
|
|
265
|
-
_context2.next =
|
|
265
|
+
_context2.next = 5;
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
|
-
return _context2.abrupt("continue",
|
|
269
|
-
case
|
|
268
|
+
return _context2.abrupt("continue", 7);
|
|
269
|
+
case 5:
|
|
270
270
|
processedResourceIds.add(resourceId);
|
|
271
271
|
content = blockContentResponse.content, deletionReason = blockContentResponse.deletionReason, sourceAri = blockContentResponse.sourceAri, blockAri = blockContentResponse.blockAri, contentUpdatedAt = blockContentResponse.contentUpdatedAt, blockInstanceId = blockContentResponse.blockInstanceId, product = blockContentResponse.product, status = blockContentResponse.status;
|
|
272
272
|
if (content) {
|
|
273
|
-
_context2.next =
|
|
273
|
+
_context2.next = 6;
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
results.push({
|
|
@@ -281,8 +281,8 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
281
281
|
},
|
|
282
282
|
resourceId: resourceId
|
|
283
283
|
});
|
|
284
|
-
return _context2.abrupt("continue",
|
|
285
|
-
case
|
|
284
|
+
return _context2.abrupt("continue", 7);
|
|
285
|
+
case 6:
|
|
286
286
|
try {
|
|
287
287
|
syncedBlockData = JSON.parse(content);
|
|
288
288
|
results.push({
|
|
@@ -307,42 +307,42 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
307
307
|
resourceId: resourceId
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
case
|
|
311
|
-
_context2.next =
|
|
310
|
+
case 7:
|
|
311
|
+
_context2.next = 4;
|
|
312
312
|
break;
|
|
313
|
-
case
|
|
314
|
-
_context2.next =
|
|
313
|
+
case 8:
|
|
314
|
+
_context2.next = 10;
|
|
315
315
|
break;
|
|
316
|
-
case
|
|
317
|
-
_context2.prev =
|
|
318
|
-
|
|
319
|
-
_iterator.e(
|
|
320
|
-
case
|
|
321
|
-
_context2.prev =
|
|
316
|
+
case 9:
|
|
317
|
+
_context2.prev = 9;
|
|
318
|
+
_t2 = _context2["catch"](3);
|
|
319
|
+
_iterator.e(_t2);
|
|
320
|
+
case 10:
|
|
321
|
+
_context2.prev = 10;
|
|
322
322
|
_iterator.f();
|
|
323
|
-
return _context2.finish(
|
|
324
|
-
case
|
|
323
|
+
return _context2.finish(10);
|
|
324
|
+
case 11:
|
|
325
325
|
if (!response.error) {
|
|
326
|
-
_context2.next =
|
|
326
|
+
_context2.next = 19;
|
|
327
327
|
break;
|
|
328
328
|
}
|
|
329
329
|
_iterator2 = _createForOfIteratorHelper(response.error);
|
|
330
|
-
_context2.prev =
|
|
330
|
+
_context2.prev = 12;
|
|
331
331
|
_iterator2.s();
|
|
332
|
-
case
|
|
332
|
+
case 13:
|
|
333
333
|
if ((_step2 = _iterator2.n()).done) {
|
|
334
|
-
_context2.next =
|
|
334
|
+
_context2.next = 16;
|
|
335
335
|
break;
|
|
336
336
|
}
|
|
337
337
|
errorResponse = _step2.value;
|
|
338
338
|
// Extract resourceId from the returned blockAri
|
|
339
339
|
_resourceId = extractResourceIdFromBlockAri(errorResponse.blockAri);
|
|
340
340
|
if (!(!_resourceId || !validResourceIds.has(_resourceId))) {
|
|
341
|
-
_context2.next =
|
|
341
|
+
_context2.next = 14;
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
|
-
return _context2.abrupt("continue",
|
|
345
|
-
case
|
|
344
|
+
return _context2.abrupt("continue", 15);
|
|
345
|
+
case 14:
|
|
346
346
|
processedResourceIds.add(_resourceId);
|
|
347
347
|
results.push({
|
|
348
348
|
error: {
|
|
@@ -351,21 +351,21 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
351
351
|
},
|
|
352
352
|
resourceId: _resourceId
|
|
353
353
|
});
|
|
354
|
-
case
|
|
355
|
-
_context2.next =
|
|
354
|
+
case 15:
|
|
355
|
+
_context2.next = 13;
|
|
356
356
|
break;
|
|
357
|
-
case
|
|
358
|
-
_context2.next =
|
|
357
|
+
case 16:
|
|
358
|
+
_context2.next = 18;
|
|
359
359
|
break;
|
|
360
|
-
case
|
|
361
|
-
_context2.prev =
|
|
362
|
-
|
|
363
|
-
_iterator2.e(
|
|
364
|
-
case
|
|
365
|
-
_context2.prev =
|
|
360
|
+
case 17:
|
|
361
|
+
_context2.prev = 17;
|
|
362
|
+
_t3 = _context2["catch"](12);
|
|
363
|
+
_iterator2.e(_t3);
|
|
364
|
+
case 18:
|
|
365
|
+
_context2.prev = 18;
|
|
366
366
|
_iterator2.f();
|
|
367
|
-
return _context2.finish(
|
|
368
|
-
case
|
|
367
|
+
return _context2.finish(18);
|
|
368
|
+
case 19:
|
|
369
369
|
// Ensure all resourceIds have a result - return NotFound for any missing ones
|
|
370
370
|
_iterator3 = _createForOfIteratorHelper(blockNodeIdentifiers);
|
|
371
371
|
try {
|
|
@@ -386,37 +386,37 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
386
386
|
_iterator3.f();
|
|
387
387
|
}
|
|
388
388
|
return _context2.abrupt("return", results);
|
|
389
|
-
case
|
|
390
|
-
_context2.prev =
|
|
391
|
-
|
|
392
|
-
if (!(
|
|
393
|
-
_context2.next =
|
|
389
|
+
case 20:
|
|
390
|
+
_context2.prev = 20;
|
|
391
|
+
_t4 = _context2["catch"](1);
|
|
392
|
+
if (!(_t4 instanceof BlockTimeoutError && expValEquals('platform_editor_sync_block_ssr_config', 'isEnabled', true))) {
|
|
393
|
+
_context2.next = 21;
|
|
394
394
|
break;
|
|
395
395
|
}
|
|
396
396
|
return _context2.abrupt("return", blockNodeIdentifiers.map(function (blockNodeIdentifier) {
|
|
397
397
|
return {
|
|
398
398
|
error: {
|
|
399
399
|
type: SyncBlockError.Aborted,
|
|
400
|
-
reason:
|
|
400
|
+
reason: _t4.message
|
|
401
401
|
},
|
|
402
402
|
resourceId: blockNodeIdentifier.resourceId
|
|
403
403
|
};
|
|
404
404
|
}));
|
|
405
|
-
case
|
|
405
|
+
case 21:
|
|
406
406
|
return _context2.abrupt("return", blockNodeIdentifiers.map(function (blockNodeIdentifier) {
|
|
407
407
|
return {
|
|
408
408
|
error: {
|
|
409
|
-
type:
|
|
410
|
-
reason:
|
|
409
|
+
type: _t4 instanceof BlockError ? mapBlockError(_t4) : SyncBlockError.Errored,
|
|
410
|
+
reason: _t4.message
|
|
411
411
|
},
|
|
412
412
|
resourceId: blockNodeIdentifier.resourceId
|
|
413
413
|
};
|
|
414
414
|
}));
|
|
415
|
-
case
|
|
415
|
+
case 22:
|
|
416
416
|
case "end":
|
|
417
417
|
return _context2.stop();
|
|
418
418
|
}
|
|
419
|
-
}, _callee2, null, [[
|
|
419
|
+
}, _callee2, null, [[1, 20], [3, 9, 10, 11], [12, 17, 18, 19]]);
|
|
420
420
|
}));
|
|
421
421
|
return function batchFetchData(_x2, _x3, _x4, _x5) {
|
|
422
422
|
return _ref3.apply(this, arguments);
|
|
@@ -436,12 +436,12 @@ var _batchFetchData = /*#__PURE__*/function () {
|
|
|
436
436
|
export { _batchFetchData as batchFetchData };
|
|
437
437
|
export var writeDataBatch = /*#__PURE__*/function () {
|
|
438
438
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(cloudId, parentAri, parentId, product, data, stepVersion) {
|
|
439
|
-
var blockAriToResourceIdMap, blocks, response, results, successResourceIds, _iterator4, _step4, block, errorResourceIds, _iterator5, _step5, _loop;
|
|
440
|
-
return _regeneratorRuntime.wrap(function
|
|
439
|
+
var blockAriToResourceIdMap, blocks, response, results, successResourceIds, _iterator4, _step4, block, errorResourceIds, _iterator5, _step5, _loop, _t5, _t6;
|
|
440
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
441
441
|
while (1) switch (_context4.prev = _context4.next) {
|
|
442
442
|
case 0:
|
|
443
443
|
if (!(!parentAri || !parentId)) {
|
|
444
|
-
_context4.next =
|
|
444
|
+
_context4.next = 1;
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
447
|
return _context4.abrupt("return", data.map(function (block) {
|
|
@@ -450,8 +450,8 @@ export var writeDataBatch = /*#__PURE__*/function () {
|
|
|
450
450
|
resourceId: block.resourceId
|
|
451
451
|
};
|
|
452
452
|
}));
|
|
453
|
-
case
|
|
454
|
-
_context4.prev =
|
|
453
|
+
case 1:
|
|
454
|
+
_context4.prev = 1;
|
|
455
455
|
// Create a map from blockAri to original resourceId for matching responses
|
|
456
456
|
blockAriToResourceIdMap = new Map();
|
|
457
457
|
blocks = data.map(function (block) {
|
|
@@ -469,11 +469,11 @@ export var writeDataBatch = /*#__PURE__*/function () {
|
|
|
469
469
|
stepVersion: stepVersion
|
|
470
470
|
};
|
|
471
471
|
});
|
|
472
|
-
_context4.next =
|
|
472
|
+
_context4.next = 2;
|
|
473
473
|
return updateSyncedBlocks({
|
|
474
474
|
blocks: blocks
|
|
475
475
|
});
|
|
476
|
-
case
|
|
476
|
+
case 2:
|
|
477
477
|
response = _context4.sent;
|
|
478
478
|
results = []; // Process successful updates
|
|
479
479
|
if (response.success) {
|
|
@@ -497,7 +497,7 @@ export var writeDataBatch = /*#__PURE__*/function () {
|
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
if (!response.error) {
|
|
500
|
-
_context4.next =
|
|
500
|
+
_context4.next = 9;
|
|
501
501
|
break;
|
|
502
502
|
}
|
|
503
503
|
errorResourceIds = new Map(response.error.map(function (err) {
|
|
@@ -506,10 +506,10 @@ export var writeDataBatch = /*#__PURE__*/function () {
|
|
|
506
506
|
blockAriToResourceIdMap.get(err.blockAri) || '', mapErrorResponseCode(err.code)];
|
|
507
507
|
}));
|
|
508
508
|
_iterator5 = _createForOfIteratorHelper(data);
|
|
509
|
-
_context4.prev =
|
|
509
|
+
_context4.prev = 3;
|
|
510
510
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
511
511
|
var block, error;
|
|
512
|
-
return _regeneratorRuntime.wrap(function
|
|
512
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
513
513
|
while (1) switch (_context3.prev = _context3.next) {
|
|
514
514
|
case 0:
|
|
515
515
|
block = _step5.value;
|
|
@@ -528,60 +528,60 @@ export var writeDataBatch = /*#__PURE__*/function () {
|
|
|
528
528
|
resourceId: block.resourceId
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
|
-
case
|
|
531
|
+
case 1:
|
|
532
532
|
case "end":
|
|
533
533
|
return _context3.stop();
|
|
534
534
|
}
|
|
535
535
|
}, _loop);
|
|
536
536
|
});
|
|
537
537
|
_iterator5.s();
|
|
538
|
-
case
|
|
538
|
+
case 4:
|
|
539
539
|
if ((_step5 = _iterator5.n()).done) {
|
|
540
|
-
_context4.next =
|
|
540
|
+
_context4.next = 6;
|
|
541
541
|
break;
|
|
542
542
|
}
|
|
543
|
-
return _context4.delegateYield(_loop(), "t0",
|
|
544
|
-
case
|
|
545
|
-
_context4.next =
|
|
543
|
+
return _context4.delegateYield(_loop(), "t0", 5);
|
|
544
|
+
case 5:
|
|
545
|
+
_context4.next = 4;
|
|
546
546
|
break;
|
|
547
|
-
case
|
|
548
|
-
_context4.next =
|
|
547
|
+
case 6:
|
|
548
|
+
_context4.next = 8;
|
|
549
549
|
break;
|
|
550
|
-
case
|
|
551
|
-
_context4.prev =
|
|
552
|
-
|
|
553
|
-
_iterator5.e(
|
|
554
|
-
case
|
|
555
|
-
_context4.prev =
|
|
550
|
+
case 7:
|
|
551
|
+
_context4.prev = 7;
|
|
552
|
+
_t5 = _context4["catch"](3);
|
|
553
|
+
_iterator5.e(_t5);
|
|
554
|
+
case 8:
|
|
555
|
+
_context4.prev = 8;
|
|
556
556
|
_iterator5.f();
|
|
557
|
-
return _context4.finish(
|
|
558
|
-
case
|
|
557
|
+
return _context4.finish(8);
|
|
558
|
+
case 9:
|
|
559
559
|
return _context4.abrupt("return", results);
|
|
560
|
-
case
|
|
561
|
-
_context4.prev =
|
|
562
|
-
|
|
563
|
-
if (!(
|
|
564
|
-
_context4.next =
|
|
560
|
+
case 10:
|
|
561
|
+
_context4.prev = 10;
|
|
562
|
+
_t6 = _context4["catch"](1);
|
|
563
|
+
if (!(_t6 instanceof BlockError)) {
|
|
564
|
+
_context4.next = 11;
|
|
565
565
|
break;
|
|
566
566
|
}
|
|
567
567
|
return _context4.abrupt("return", data.map(function (block) {
|
|
568
568
|
return {
|
|
569
|
-
error: mapBlockError(
|
|
569
|
+
error: mapBlockError(_t6),
|
|
570
570
|
resourceId: block.resourceId
|
|
571
571
|
};
|
|
572
572
|
}));
|
|
573
|
-
case
|
|
573
|
+
case 11:
|
|
574
574
|
return _context4.abrupt("return", data.map(function (block) {
|
|
575
575
|
return {
|
|
576
|
-
error: stringifyError(
|
|
576
|
+
error: stringifyError(_t6),
|
|
577
577
|
resourceId: block.resourceId
|
|
578
578
|
};
|
|
579
579
|
}));
|
|
580
|
-
case
|
|
580
|
+
case 12:
|
|
581
581
|
case "end":
|
|
582
582
|
return _context4.stop();
|
|
583
583
|
}
|
|
584
|
-
}, _callee3, null, [[
|
|
584
|
+
}, _callee3, null, [[1, 10], [3, 7, 8, 9]]);
|
|
585
585
|
}));
|
|
586
586
|
return function writeDataBatch(_x6, _x7, _x8, _x9, _x0, _x1) {
|
|
587
587
|
return _ref4.apply(this, arguments);
|
|
@@ -605,8 +605,8 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
605
605
|
key: "fetchData",
|
|
606
606
|
value: function () {
|
|
607
607
|
var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(resourceId) {
|
|
608
|
-
var blockAri, blockContentResponse, content, sourceAri, deletionReason, blockInstanceId, contentUpdatedAt, product, status, syncedBlockData;
|
|
609
|
-
return _regeneratorRuntime.wrap(function
|
|
608
|
+
var blockAri, blockContentResponse, content, sourceAri, deletionReason, blockInstanceId, contentUpdatedAt, product, status, syncedBlockData, _t7;
|
|
609
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
610
610
|
while (1) switch (_context5.prev = _context5.next) {
|
|
611
611
|
case 0:
|
|
612
612
|
blockAri = generateBlockAriFromReference({
|
|
@@ -614,15 +614,15 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
614
614
|
resourceId: resourceId
|
|
615
615
|
});
|
|
616
616
|
_context5.prev = 1;
|
|
617
|
-
_context5.next =
|
|
617
|
+
_context5.next = 2;
|
|
618
618
|
return getSyncedBlockContent({
|
|
619
619
|
blockAri: blockAri
|
|
620
620
|
});
|
|
621
|
-
case
|
|
621
|
+
case 2:
|
|
622
622
|
blockContentResponse = _context5.sent;
|
|
623
623
|
content = blockContentResponse.content, sourceAri = blockContentResponse.sourceAri, deletionReason = blockContentResponse.deletionReason, blockInstanceId = blockContentResponse.blockInstanceId, contentUpdatedAt = blockContentResponse.contentUpdatedAt, product = blockContentResponse.product, status = blockContentResponse.status;
|
|
624
624
|
if (content) {
|
|
625
|
-
_context5.next =
|
|
625
|
+
_context5.next = 3;
|
|
626
626
|
break;
|
|
627
627
|
}
|
|
628
628
|
return _context5.abrupt("return", {
|
|
@@ -633,7 +633,7 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
633
633
|
},
|
|
634
634
|
resourceId: resourceId
|
|
635
635
|
});
|
|
636
|
-
case
|
|
636
|
+
case 3:
|
|
637
637
|
// Parse the synced block content from the response's content
|
|
638
638
|
syncedBlockData = JSON.parse(content);
|
|
639
639
|
return _context5.abrupt("return", {
|
|
@@ -650,33 +650,33 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
650
650
|
},
|
|
651
651
|
resourceId: resourceId
|
|
652
652
|
});
|
|
653
|
-
case
|
|
654
|
-
_context5.prev =
|
|
655
|
-
|
|
656
|
-
if (!(
|
|
657
|
-
_context5.next =
|
|
653
|
+
case 4:
|
|
654
|
+
_context5.prev = 4;
|
|
655
|
+
_t7 = _context5["catch"](1);
|
|
656
|
+
if (!(_t7 instanceof BlockError)) {
|
|
657
|
+
_context5.next = 5;
|
|
658
658
|
break;
|
|
659
659
|
}
|
|
660
660
|
return _context5.abrupt("return", {
|
|
661
661
|
error: {
|
|
662
|
-
type: mapBlockError(
|
|
663
|
-
reason:
|
|
662
|
+
type: mapBlockError(_t7),
|
|
663
|
+
reason: _t7.message
|
|
664
664
|
},
|
|
665
665
|
resourceId: resourceId
|
|
666
666
|
});
|
|
667
|
-
case
|
|
667
|
+
case 5:
|
|
668
668
|
return _context5.abrupt("return", {
|
|
669
669
|
error: {
|
|
670
670
|
type: SyncBlockError.Errored,
|
|
671
|
-
reason:
|
|
671
|
+
reason: _t7.message
|
|
672
672
|
},
|
|
673
673
|
resourceId: resourceId
|
|
674
674
|
});
|
|
675
|
-
case
|
|
675
|
+
case 6:
|
|
676
676
|
case "end":
|
|
677
677
|
return _context5.stop();
|
|
678
678
|
}
|
|
679
|
-
}, _callee4, this, [[1,
|
|
679
|
+
}, _callee4, this, [[1, 4]]);
|
|
680
680
|
}));
|
|
681
681
|
function fetchData(_x10) {
|
|
682
682
|
return _fetchData.apply(this, arguments);
|
|
@@ -688,8 +688,8 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
688
688
|
value: function () {
|
|
689
689
|
var _fetchReferences = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(referenceResourceId) {
|
|
690
690
|
var _this = this;
|
|
691
|
-
var blockAri, response, references;
|
|
692
|
-
return _regeneratorRuntime.wrap(function
|
|
691
|
+
var blockAri, response, references, _t8;
|
|
692
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
693
693
|
while (1) switch (_context6.prev = _context6.next) {
|
|
694
694
|
case 0:
|
|
695
695
|
_context6.prev = 0;
|
|
@@ -697,11 +697,11 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
697
697
|
cloudId: this.cloudId,
|
|
698
698
|
resourceId: referenceResourceId
|
|
699
699
|
});
|
|
700
|
-
_context6.next =
|
|
700
|
+
_context6.next = 1;
|
|
701
701
|
return getReferenceSyncedBlocksByBlockAri({
|
|
702
702
|
blockAri: blockAri
|
|
703
703
|
});
|
|
704
|
-
case
|
|
704
|
+
case 1:
|
|
705
705
|
response = _context6.sent;
|
|
706
706
|
references = [];
|
|
707
707
|
response.references.forEach(function (reference) {
|
|
@@ -723,25 +723,25 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
723
723
|
return _context6.abrupt("return", {
|
|
724
724
|
references: references
|
|
725
725
|
});
|
|
726
|
-
case
|
|
727
|
-
_context6.prev =
|
|
728
|
-
|
|
729
|
-
if (!(
|
|
730
|
-
_context6.next =
|
|
726
|
+
case 2:
|
|
727
|
+
_context6.prev = 2;
|
|
728
|
+
_t8 = _context6["catch"](0);
|
|
729
|
+
if (!(_t8 instanceof BlockError)) {
|
|
730
|
+
_context6.next = 3;
|
|
731
731
|
break;
|
|
732
732
|
}
|
|
733
733
|
return _context6.abrupt("return", {
|
|
734
|
-
error: mapBlockError(
|
|
734
|
+
error: mapBlockError(_t8)
|
|
735
735
|
});
|
|
736
|
-
case
|
|
736
|
+
case 3:
|
|
737
737
|
return _context6.abrupt("return", {
|
|
738
738
|
error: SyncBlockError.Errored
|
|
739
739
|
});
|
|
740
|
-
case
|
|
740
|
+
case 4:
|
|
741
741
|
case "end":
|
|
742
742
|
return _context6.stop();
|
|
743
743
|
}
|
|
744
|
-
}, _callee5, this, [[0,
|
|
744
|
+
}, _callee5, this, [[0, 2]]);
|
|
745
745
|
}));
|
|
746
746
|
function fetchReferences(_x11) {
|
|
747
747
|
return _fetchReferences.apply(this, arguments);
|
|
@@ -758,14 +758,14 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
758
758
|
key: "batchFetchData",
|
|
759
759
|
value: (function () {
|
|
760
760
|
var _batchFetchData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blockNodeIdentifiers, config) {
|
|
761
|
-
return _regeneratorRuntime.wrap(function
|
|
761
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
762
762
|
while (1) switch (_context7.prev = _context7.next) {
|
|
763
763
|
case 0:
|
|
764
|
-
_context7.next =
|
|
764
|
+
_context7.next = 1;
|
|
765
765
|
return _batchFetchData(this.cloudId, this.parentAri, blockNodeIdentifiers, config);
|
|
766
|
-
case
|
|
766
|
+
case 1:
|
|
767
767
|
return _context7.abrupt("return", _context7.sent);
|
|
768
|
-
case
|
|
768
|
+
case 2:
|
|
769
769
|
case "end":
|
|
770
770
|
return _context7.stop();
|
|
771
771
|
}
|
|
@@ -858,18 +858,18 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
858
858
|
key: "writeData",
|
|
859
859
|
value: function () {
|
|
860
860
|
var _writeData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
|
861
|
-
var resourceId, blockAri, stepVersion, status;
|
|
862
|
-
return _regeneratorRuntime.wrap(function
|
|
861
|
+
var resourceId, blockAri, stepVersion, status, _t9, _t0;
|
|
862
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
863
863
|
while (1) switch (_context8.prev = _context8.next) {
|
|
864
864
|
case 0:
|
|
865
865
|
if (!(!this.parentAri || !this.parentId)) {
|
|
866
|
-
_context8.next =
|
|
866
|
+
_context8.next = 1;
|
|
867
867
|
break;
|
|
868
868
|
}
|
|
869
869
|
return _context8.abrupt("return", {
|
|
870
870
|
error: SyncBlockError.Errored
|
|
871
871
|
});
|
|
872
|
-
case
|
|
872
|
+
case 1:
|
|
873
873
|
resourceId = data.resourceId;
|
|
874
874
|
blockAri = _generateBlockAri({
|
|
875
875
|
cloudId: this.cloudId,
|
|
@@ -878,53 +878,53 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
878
878
|
resourceId: resourceId
|
|
879
879
|
});
|
|
880
880
|
if (!this.getVersion) {
|
|
881
|
-
_context8.next =
|
|
881
|
+
_context8.next = 3;
|
|
882
882
|
break;
|
|
883
883
|
}
|
|
884
|
-
_context8.next =
|
|
884
|
+
_context8.next = 2;
|
|
885
885
|
return this.getVersion();
|
|
886
|
-
case
|
|
887
|
-
|
|
888
|
-
_context8.next =
|
|
886
|
+
case 2:
|
|
887
|
+
_t9 = _context8.sent;
|
|
888
|
+
_context8.next = 4;
|
|
889
889
|
break;
|
|
890
|
-
case
|
|
891
|
-
|
|
892
|
-
case
|
|
893
|
-
stepVersion =
|
|
894
|
-
_context8.prev =
|
|
890
|
+
case 3:
|
|
891
|
+
_t9 = undefined;
|
|
892
|
+
case 4:
|
|
893
|
+
stepVersion = _t9;
|
|
894
|
+
_context8.prev = 5;
|
|
895
895
|
status = data.status;
|
|
896
|
-
_context8.next =
|
|
896
|
+
_context8.next = 6;
|
|
897
897
|
return updateSyncedBlock({
|
|
898
898
|
blockAri: blockAri,
|
|
899
899
|
content: JSON.stringify(data.content),
|
|
900
900
|
stepVersion: stepVersion,
|
|
901
901
|
status: status
|
|
902
902
|
});
|
|
903
|
-
case
|
|
903
|
+
case 6:
|
|
904
904
|
return _context8.abrupt("return", {
|
|
905
905
|
resourceId: resourceId
|
|
906
906
|
});
|
|
907
|
-
case
|
|
908
|
-
_context8.prev =
|
|
909
|
-
|
|
910
|
-
if (!(
|
|
911
|
-
_context8.next =
|
|
907
|
+
case 7:
|
|
908
|
+
_context8.prev = 7;
|
|
909
|
+
_t0 = _context8["catch"](5);
|
|
910
|
+
if (!(_t0 instanceof BlockError)) {
|
|
911
|
+
_context8.next = 8;
|
|
912
912
|
break;
|
|
913
913
|
}
|
|
914
914
|
return _context8.abrupt("return", {
|
|
915
|
-
error: mapBlockError(
|
|
915
|
+
error: mapBlockError(_t0),
|
|
916
916
|
resourceId: resourceId
|
|
917
917
|
});
|
|
918
|
-
case
|
|
918
|
+
case 8:
|
|
919
919
|
return _context8.abrupt("return", {
|
|
920
|
-
error: stringifyError(
|
|
920
|
+
error: stringifyError(_t0),
|
|
921
921
|
resourceId: resourceId
|
|
922
922
|
});
|
|
923
|
-
case
|
|
923
|
+
case 9:
|
|
924
924
|
case "end":
|
|
925
925
|
return _context8.stop();
|
|
926
926
|
}
|
|
927
|
-
}, _callee7, this, [[
|
|
927
|
+
}, _callee7, this, [[5, 7]]);
|
|
928
928
|
}));
|
|
929
929
|
function writeData(_x14) {
|
|
930
930
|
return _writeData.apply(this, arguments);
|
|
@@ -935,18 +935,18 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
935
935
|
key: "createData",
|
|
936
936
|
value: function () {
|
|
937
937
|
var _createData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
|
|
938
|
-
var resourceId, blockAri, stepVersion, status;
|
|
939
|
-
return _regeneratorRuntime.wrap(function
|
|
938
|
+
var resourceId, blockAri, stepVersion, status, _t1, _t10;
|
|
939
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
940
940
|
while (1) switch (_context9.prev = _context9.next) {
|
|
941
941
|
case 0:
|
|
942
942
|
if (!(!this.parentAri || !this.parentId)) {
|
|
943
|
-
_context9.next =
|
|
943
|
+
_context9.next = 1;
|
|
944
944
|
break;
|
|
945
945
|
}
|
|
946
946
|
return _context9.abrupt("return", {
|
|
947
947
|
error: SyncBlockError.Errored
|
|
948
948
|
});
|
|
949
|
-
case
|
|
949
|
+
case 1:
|
|
950
950
|
resourceId = data.resourceId;
|
|
951
951
|
blockAri = _generateBlockAri({
|
|
952
952
|
cloudId: this.cloudId,
|
|
@@ -955,22 +955,22 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
955
955
|
resourceId: resourceId
|
|
956
956
|
});
|
|
957
957
|
if (!this.getVersion) {
|
|
958
|
-
_context9.next =
|
|
958
|
+
_context9.next = 3;
|
|
959
959
|
break;
|
|
960
960
|
}
|
|
961
|
-
_context9.next =
|
|
961
|
+
_context9.next = 2;
|
|
962
962
|
return this.getVersion();
|
|
963
|
-
case
|
|
964
|
-
|
|
965
|
-
_context9.next =
|
|
963
|
+
case 2:
|
|
964
|
+
_t1 = _context9.sent;
|
|
965
|
+
_context9.next = 4;
|
|
966
966
|
break;
|
|
967
|
-
case
|
|
968
|
-
|
|
969
|
-
case
|
|
970
|
-
stepVersion =
|
|
967
|
+
case 3:
|
|
968
|
+
_t1 = undefined;
|
|
969
|
+
case 4:
|
|
970
|
+
stepVersion = _t1;
|
|
971
971
|
status = 'unpublished';
|
|
972
|
-
_context9.prev =
|
|
973
|
-
_context9.next =
|
|
972
|
+
_context9.prev = 5;
|
|
973
|
+
_context9.next = 6;
|
|
974
974
|
return createSyncedBlock({
|
|
975
975
|
blockAri: blockAri,
|
|
976
976
|
blockInstanceId: data.blockInstanceId,
|
|
@@ -980,31 +980,31 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
980
980
|
stepVersion: stepVersion,
|
|
981
981
|
status: status
|
|
982
982
|
});
|
|
983
|
-
case
|
|
983
|
+
case 6:
|
|
984
984
|
return _context9.abrupt("return", {
|
|
985
985
|
resourceId: resourceId
|
|
986
986
|
});
|
|
987
|
-
case
|
|
988
|
-
_context9.prev =
|
|
989
|
-
|
|
990
|
-
if (!(
|
|
991
|
-
_context9.next =
|
|
987
|
+
case 7:
|
|
988
|
+
_context9.prev = 7;
|
|
989
|
+
_t10 = _context9["catch"](5);
|
|
990
|
+
if (!(_t10 instanceof BlockError)) {
|
|
991
|
+
_context9.next = 8;
|
|
992
992
|
break;
|
|
993
993
|
}
|
|
994
994
|
return _context9.abrupt("return", {
|
|
995
|
-
error: mapBlockError(
|
|
995
|
+
error: mapBlockError(_t10),
|
|
996
996
|
resourceId: resourceId
|
|
997
997
|
});
|
|
998
|
-
case
|
|
998
|
+
case 8:
|
|
999
999
|
return _context9.abrupt("return", {
|
|
1000
|
-
error: stringifyError(
|
|
1000
|
+
error: stringifyError(_t10),
|
|
1001
1001
|
resourceId: resourceId
|
|
1002
1002
|
});
|
|
1003
|
-
case
|
|
1003
|
+
case 9:
|
|
1004
1004
|
case "end":
|
|
1005
1005
|
return _context9.stop();
|
|
1006
1006
|
}
|
|
1007
|
-
}, _callee8, this, [[
|
|
1007
|
+
}, _callee8, this, [[5, 7]]);
|
|
1008
1008
|
}));
|
|
1009
1009
|
function createData(_x15) {
|
|
1010
1010
|
return _createData.apply(this, arguments);
|
|
@@ -1015,12 +1015,12 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1015
1015
|
key: "deleteData",
|
|
1016
1016
|
value: function () {
|
|
1017
1017
|
var _deleteData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(resourceId, deleteReason) {
|
|
1018
|
-
var blockAri;
|
|
1019
|
-
return _regeneratorRuntime.wrap(function
|
|
1018
|
+
var blockAri, _t11;
|
|
1019
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
1020
1020
|
while (1) switch (_context0.prev = _context0.next) {
|
|
1021
1021
|
case 0:
|
|
1022
1022
|
if (this.parentId) {
|
|
1023
|
-
_context0.next =
|
|
1023
|
+
_context0.next = 1;
|
|
1024
1024
|
break;
|
|
1025
1025
|
}
|
|
1026
1026
|
return _context0.abrupt("return", {
|
|
@@ -1028,30 +1028,30 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1028
1028
|
success: false,
|
|
1029
1029
|
error: SyncBlockError.Errored
|
|
1030
1030
|
});
|
|
1031
|
-
case
|
|
1031
|
+
case 1:
|
|
1032
1032
|
blockAri = _generateBlockAri({
|
|
1033
1033
|
cloudId: this.cloudId,
|
|
1034
1034
|
parentId: this.parentId,
|
|
1035
1035
|
product: this.product,
|
|
1036
1036
|
resourceId: resourceId
|
|
1037
1037
|
});
|
|
1038
|
-
_context0.prev =
|
|
1039
|
-
_context0.next =
|
|
1038
|
+
_context0.prev = 2;
|
|
1039
|
+
_context0.next = 3;
|
|
1040
1040
|
return deleteSyncedBlock({
|
|
1041
1041
|
blockAri: blockAri,
|
|
1042
1042
|
deleteReason: deleteReason
|
|
1043
1043
|
});
|
|
1044
|
-
case
|
|
1044
|
+
case 3:
|
|
1045
1045
|
return _context0.abrupt("return", {
|
|
1046
1046
|
resourceId: resourceId,
|
|
1047
1047
|
success: true,
|
|
1048
1048
|
error: undefined
|
|
1049
1049
|
});
|
|
1050
|
-
case
|
|
1051
|
-
_context0.prev =
|
|
1052
|
-
|
|
1053
|
-
if (!(
|
|
1054
|
-
_context0.next =
|
|
1050
|
+
case 4:
|
|
1051
|
+
_context0.prev = 4;
|
|
1052
|
+
_t11 = _context0["catch"](2);
|
|
1053
|
+
if (!(_t11 instanceof BlockNotFoundError && this.parentAri)) {
|
|
1054
|
+
_context0.next = 5;
|
|
1055
1055
|
break;
|
|
1056
1056
|
}
|
|
1057
1057
|
return _context0.abrupt("return", this.deleteOrphanBlock({
|
|
@@ -1060,36 +1060,36 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1060
1060
|
parentAri: this.parentAri,
|
|
1061
1061
|
deleteReason: deleteReason
|
|
1062
1062
|
}));
|
|
1063
|
-
case
|
|
1064
|
-
if (!(
|
|
1065
|
-
_context0.next =
|
|
1063
|
+
case 5:
|
|
1064
|
+
if (!(_t11 instanceof BlockError)) {
|
|
1065
|
+
_context0.next = 7;
|
|
1066
1066
|
break;
|
|
1067
1067
|
}
|
|
1068
|
-
if (!(
|
|
1069
|
-
_context0.next =
|
|
1068
|
+
if (!(_t11.status === 404)) {
|
|
1069
|
+
_context0.next = 6;
|
|
1070
1070
|
break;
|
|
1071
1071
|
}
|
|
1072
1072
|
return _context0.abrupt("return", {
|
|
1073
1073
|
resourceId: resourceId,
|
|
1074
1074
|
success: true
|
|
1075
1075
|
});
|
|
1076
|
-
case
|
|
1076
|
+
case 6:
|
|
1077
1077
|
return _context0.abrupt("return", {
|
|
1078
1078
|
resourceId: resourceId,
|
|
1079
1079
|
success: false,
|
|
1080
|
-
error: mapBlockError(
|
|
1080
|
+
error: mapBlockError(_t11)
|
|
1081
1081
|
});
|
|
1082
|
-
case
|
|
1082
|
+
case 7:
|
|
1083
1083
|
return _context0.abrupt("return", {
|
|
1084
1084
|
resourceId: resourceId,
|
|
1085
1085
|
success: false,
|
|
1086
|
-
error: stringifyError(
|
|
1086
|
+
error: stringifyError(_t11)
|
|
1087
1087
|
});
|
|
1088
|
-
case
|
|
1088
|
+
case 8:
|
|
1089
1089
|
case "end":
|
|
1090
1090
|
return _context0.stop();
|
|
1091
1091
|
}
|
|
1092
|
-
}, _callee9, this, [[
|
|
1092
|
+
}, _callee9, this, [[2, 4]]);
|
|
1093
1093
|
}));
|
|
1094
1094
|
function deleteData(_x16, _x17) {
|
|
1095
1095
|
return _deleteData.apply(this, arguments);
|
|
@@ -1102,28 +1102,28 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1102
1102
|
key: "deleteOrphanBlock",
|
|
1103
1103
|
value: function () {
|
|
1104
1104
|
var _deleteOrphanBlock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref8) {
|
|
1105
|
-
var blockAri, resourceId, parentAri, deleteReason, stepVersion;
|
|
1106
|
-
return _regeneratorRuntime.wrap(function
|
|
1105
|
+
var blockAri, resourceId, parentAri, deleteReason, stepVersion, _t12, _t13, _t14;
|
|
1106
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
1107
1107
|
while (1) switch (_context1.prev = _context1.next) {
|
|
1108
1108
|
case 0:
|
|
1109
1109
|
blockAri = _ref8.blockAri, resourceId = _ref8.resourceId, parentAri = _ref8.parentAri, deleteReason = _ref8.deleteReason;
|
|
1110
1110
|
_context1.prev = 1;
|
|
1111
1111
|
if (!this.getVersion) {
|
|
1112
|
-
_context1.next =
|
|
1112
|
+
_context1.next = 3;
|
|
1113
1113
|
break;
|
|
1114
1114
|
}
|
|
1115
|
-
_context1.next =
|
|
1115
|
+
_context1.next = 2;
|
|
1116
1116
|
return this.getVersion();
|
|
1117
|
-
case
|
|
1118
|
-
|
|
1119
|
-
_context1.next =
|
|
1117
|
+
case 2:
|
|
1118
|
+
_t12 = _context1.sent;
|
|
1119
|
+
_context1.next = 4;
|
|
1120
1120
|
break;
|
|
1121
|
-
case
|
|
1122
|
-
|
|
1123
|
-
case
|
|
1124
|
-
stepVersion =
|
|
1125
|
-
_context1.prev =
|
|
1126
|
-
_context1.next =
|
|
1121
|
+
case 3:
|
|
1122
|
+
_t12 = undefined;
|
|
1123
|
+
case 4:
|
|
1124
|
+
stepVersion = _t12;
|
|
1125
|
+
_context1.prev = 5;
|
|
1126
|
+
_context1.next = 6;
|
|
1127
1127
|
return createSyncedBlock({
|
|
1128
1128
|
blockAri: blockAri,
|
|
1129
1129
|
blockInstanceId: resourceId,
|
|
@@ -1132,69 +1132,69 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1132
1132
|
content: '[]',
|
|
1133
1133
|
stepVersion: stepVersion
|
|
1134
1134
|
});
|
|
1135
|
-
case
|
|
1136
|
-
_context1.next =
|
|
1135
|
+
case 6:
|
|
1136
|
+
_context1.next = 10;
|
|
1137
1137
|
break;
|
|
1138
|
-
case
|
|
1139
|
-
_context1.prev =
|
|
1140
|
-
|
|
1141
|
-
if (!(
|
|
1142
|
-
_context1.next =
|
|
1138
|
+
case 7:
|
|
1139
|
+
_context1.prev = 7;
|
|
1140
|
+
_t13 = _context1["catch"](5);
|
|
1141
|
+
if (!(_t13 instanceof Error && _t13.message.includes('Conditional check failed'))) {
|
|
1142
|
+
_context1.next = 8;
|
|
1143
1143
|
break;
|
|
1144
1144
|
}
|
|
1145
|
-
_context1.next =
|
|
1145
|
+
_context1.next = 10;
|
|
1146
1146
|
break;
|
|
1147
|
-
case
|
|
1148
|
-
if (!(
|
|
1149
|
-
_context1.next =
|
|
1147
|
+
case 8:
|
|
1148
|
+
if (!(_t13 instanceof BlockError)) {
|
|
1149
|
+
_context1.next = 9;
|
|
1150
1150
|
break;
|
|
1151
1151
|
}
|
|
1152
1152
|
return _context1.abrupt("return", {
|
|
1153
1153
|
resourceId: resourceId,
|
|
1154
1154
|
success: false,
|
|
1155
|
-
error: mapBlockError(
|
|
1155
|
+
error: mapBlockError(_t13)
|
|
1156
1156
|
});
|
|
1157
|
-
case
|
|
1157
|
+
case 9:
|
|
1158
1158
|
return _context1.abrupt("return", {
|
|
1159
1159
|
resourceId: resourceId,
|
|
1160
1160
|
success: false,
|
|
1161
|
-
error: stringifyError(
|
|
1161
|
+
error: stringifyError(_t13)
|
|
1162
1162
|
});
|
|
1163
|
-
case
|
|
1164
|
-
_context1.next =
|
|
1163
|
+
case 10:
|
|
1164
|
+
_context1.next = 11;
|
|
1165
1165
|
return deleteSyncedBlock({
|
|
1166
1166
|
blockAri: blockAri,
|
|
1167
1167
|
deleteReason: deleteReason
|
|
1168
1168
|
});
|
|
1169
|
-
case
|
|
1169
|
+
case 11:
|
|
1170
1170
|
return _context1.abrupt("return", {
|
|
1171
1171
|
resourceId: resourceId,
|
|
1172
1172
|
success: true,
|
|
1173
1173
|
error: undefined
|
|
1174
1174
|
});
|
|
1175
|
-
case
|
|
1176
|
-
_context1.prev =
|
|
1177
|
-
|
|
1178
|
-
if (!(
|
|
1179
|
-
_context1.next =
|
|
1175
|
+
case 12:
|
|
1176
|
+
_context1.prev = 12;
|
|
1177
|
+
_t14 = _context1["catch"](1);
|
|
1178
|
+
if (!(_t14 instanceof BlockError)) {
|
|
1179
|
+
_context1.next = 13;
|
|
1180
1180
|
break;
|
|
1181
1181
|
}
|
|
1182
1182
|
return _context1.abrupt("return", {
|
|
1183
1183
|
resourceId: resourceId,
|
|
1184
1184
|
success: false,
|
|
1185
|
-
error: mapBlockError(
|
|
1185
|
+
error: mapBlockError(_t14)
|
|
1186
1186
|
});
|
|
1187
|
-
case
|
|
1187
|
+
case 13:
|
|
1188
1188
|
return _context1.abrupt("return", {
|
|
1189
1189
|
resourceId: resourceId,
|
|
1190
1190
|
success: false,
|
|
1191
|
-
error: stringifyError(
|
|
1191
|
+
error: stringifyError(_t14)
|
|
1192
1192
|
});
|
|
1193
|
-
case
|
|
1193
|
+
case 14:
|
|
1194
1194
|
case "end":
|
|
1195
1195
|
return _context1.stop();
|
|
1196
1196
|
}
|
|
1197
|
-
}, _callee0, this, [[1,
|
|
1197
|
+
}, _callee0, this, [[1, 12], [5, 7]]);
|
|
1198
1198
|
}));
|
|
1199
1199
|
function deleteOrphanBlock(_x18) {
|
|
1200
1200
|
return _deleteOrphanBlock.apply(this, arguments);
|
|
@@ -1226,20 +1226,21 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1226
1226
|
value: function () {
|
|
1227
1227
|
var _updateReferenceData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee1(blocks, noContent) {
|
|
1228
1228
|
var _this2 = this;
|
|
1229
|
-
|
|
1229
|
+
var _t15;
|
|
1230
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1230
1231
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1231
1232
|
case 0:
|
|
1232
1233
|
if (this.parentAri) {
|
|
1233
|
-
_context10.next =
|
|
1234
|
+
_context10.next = 1;
|
|
1234
1235
|
break;
|
|
1235
1236
|
}
|
|
1236
1237
|
return _context10.abrupt("return", {
|
|
1237
1238
|
success: false,
|
|
1238
1239
|
error: SyncBlockError.Errored
|
|
1239
1240
|
});
|
|
1240
|
-
case
|
|
1241
|
-
_context10.prev =
|
|
1242
|
-
_context10.next =
|
|
1241
|
+
case 1:
|
|
1242
|
+
_context10.prev = 1;
|
|
1243
|
+
_context10.next = 2;
|
|
1243
1244
|
return updateReferenceSyncedBlockOnDocument({
|
|
1244
1245
|
documentAri: this.parentAri,
|
|
1245
1246
|
blocks: blocks.map(function (block) {
|
|
@@ -1253,31 +1254,31 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1253
1254
|
}),
|
|
1254
1255
|
noContent: noContent
|
|
1255
1256
|
});
|
|
1256
|
-
case
|
|
1257
|
+
case 2:
|
|
1257
1258
|
return _context10.abrupt("return", {
|
|
1258
1259
|
success: true
|
|
1259
1260
|
});
|
|
1260
|
-
case
|
|
1261
|
-
_context10.prev =
|
|
1262
|
-
|
|
1263
|
-
if (!(
|
|
1264
|
-
_context10.next =
|
|
1261
|
+
case 3:
|
|
1262
|
+
_context10.prev = 3;
|
|
1263
|
+
_t15 = _context10["catch"](1);
|
|
1264
|
+
if (!(_t15 instanceof BlockError)) {
|
|
1265
|
+
_context10.next = 4;
|
|
1265
1266
|
break;
|
|
1266
1267
|
}
|
|
1267
1268
|
return _context10.abrupt("return", {
|
|
1268
1269
|
success: false,
|
|
1269
|
-
error: mapBlockError(
|
|
1270
|
+
error: mapBlockError(_t15)
|
|
1270
1271
|
});
|
|
1271
|
-
case
|
|
1272
|
+
case 4:
|
|
1272
1273
|
return _context10.abrupt("return", {
|
|
1273
1274
|
success: false,
|
|
1274
|
-
error: stringifyError(
|
|
1275
|
+
error: stringifyError(_t15)
|
|
1275
1276
|
});
|
|
1276
|
-
case
|
|
1277
|
+
case 5:
|
|
1277
1278
|
case "end":
|
|
1278
1279
|
return _context10.stop();
|
|
1279
1280
|
}
|
|
1280
|
-
}, _callee1, this, [[
|
|
1281
|
+
}, _callee1, this, [[1, 3]]);
|
|
1281
1282
|
}));
|
|
1282
1283
|
function updateReferenceData(_x19, _x20) {
|
|
1283
1284
|
return _updateReferenceData.apply(this, arguments);
|
|
@@ -1289,12 +1290,12 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1289
1290
|
value: function () {
|
|
1290
1291
|
var _writeDataBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(data) {
|
|
1291
1292
|
var _this3 = this;
|
|
1292
|
-
var stepVersion, blockAriToResourceIdMap, blocks, response, results, successBlocks, _iterator6, _step6, block, successBlock, errorResourceIds, _iterator7, _step7, _loop2;
|
|
1293
|
-
return _regeneratorRuntime.wrap(function
|
|
1293
|
+
var stepVersion, blockAriToResourceIdMap, blocks, response, results, successBlocks, _iterator6, _step6, block, successBlock, errorResourceIds, _iterator7, _step7, _loop2, _t16, _t17, _t18;
|
|
1294
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
1294
1295
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1295
1296
|
case 0:
|
|
1296
1297
|
if (!(!this.parentAri || !this.parentId)) {
|
|
1297
|
-
_context12.next =
|
|
1298
|
+
_context12.next = 1;
|
|
1298
1299
|
break;
|
|
1299
1300
|
}
|
|
1300
1301
|
return _context12.abrupt("return", data.map(function (block) {
|
|
@@ -1303,22 +1304,22 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1303
1304
|
resourceId: block.resourceId
|
|
1304
1305
|
};
|
|
1305
1306
|
}));
|
|
1306
|
-
case
|
|
1307
|
+
case 1:
|
|
1307
1308
|
if (!this.getVersion) {
|
|
1308
|
-
_context12.next =
|
|
1309
|
+
_context12.next = 3;
|
|
1309
1310
|
break;
|
|
1310
1311
|
}
|
|
1311
|
-
_context12.next =
|
|
1312
|
+
_context12.next = 2;
|
|
1312
1313
|
return this.getVersion();
|
|
1313
|
-
case
|
|
1314
|
-
|
|
1315
|
-
_context12.next =
|
|
1314
|
+
case 2:
|
|
1315
|
+
_t16 = _context12.sent;
|
|
1316
|
+
_context12.next = 4;
|
|
1316
1317
|
break;
|
|
1317
|
-
case
|
|
1318
|
-
|
|
1319
|
-
case
|
|
1320
|
-
stepVersion =
|
|
1321
|
-
_context12.prev =
|
|
1318
|
+
case 3:
|
|
1319
|
+
_t16 = undefined;
|
|
1320
|
+
case 4:
|
|
1321
|
+
stepVersion = _t16;
|
|
1322
|
+
_context12.prev = 5;
|
|
1322
1323
|
// Create a map from blockAri to original resourceId for matching responses
|
|
1323
1324
|
blockAriToResourceIdMap = new Map();
|
|
1324
1325
|
blocks = data.map(function (block) {
|
|
@@ -1331,11 +1332,11 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1331
1332
|
stepVersion: stepVersion
|
|
1332
1333
|
};
|
|
1333
1334
|
});
|
|
1334
|
-
_context12.next =
|
|
1335
|
+
_context12.next = 6;
|
|
1335
1336
|
return updateSyncedBlocks({
|
|
1336
1337
|
blocks: blocks
|
|
1337
1338
|
});
|
|
1338
|
-
case
|
|
1339
|
+
case 6:
|
|
1339
1340
|
response = _context12.sent;
|
|
1340
1341
|
results = []; // Process successful updates
|
|
1341
1342
|
if (response.success) {
|
|
@@ -1361,7 +1362,7 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1361
1362
|
}
|
|
1362
1363
|
}
|
|
1363
1364
|
if (!response.error) {
|
|
1364
|
-
_context12.next =
|
|
1365
|
+
_context12.next = 13;
|
|
1365
1366
|
break;
|
|
1366
1367
|
}
|
|
1367
1368
|
errorResourceIds = new Map(response.error.map(function (err) {
|
|
@@ -1370,10 +1371,10 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1370
1371
|
blockAriToResourceIdMap.get(err.blockAri) || '', mapErrorResponseCode(err.code)];
|
|
1371
1372
|
}));
|
|
1372
1373
|
_iterator7 = _createForOfIteratorHelper(data);
|
|
1373
|
-
_context12.prev =
|
|
1374
|
+
_context12.prev = 7;
|
|
1374
1375
|
_loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
|
|
1375
1376
|
var block, error;
|
|
1376
|
-
return _regeneratorRuntime.wrap(function
|
|
1377
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1377
1378
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1378
1379
|
case 0:
|
|
1379
1380
|
block = _step7.value;
|
|
@@ -1394,60 +1395,60 @@ var BlockServiceADFWriteProvider = /*#__PURE__*/function () {
|
|
|
1394
1395
|
resourceId: block.resourceId
|
|
1395
1396
|
});
|
|
1396
1397
|
}
|
|
1397
|
-
case
|
|
1398
|
+
case 1:
|
|
1398
1399
|
case "end":
|
|
1399
1400
|
return _context11.stop();
|
|
1400
1401
|
}
|
|
1401
1402
|
}, _loop2);
|
|
1402
1403
|
});
|
|
1403
1404
|
_iterator7.s();
|
|
1404
|
-
case
|
|
1405
|
+
case 8:
|
|
1405
1406
|
if ((_step7 = _iterator7.n()).done) {
|
|
1406
|
-
_context12.next =
|
|
1407
|
+
_context12.next = 10;
|
|
1407
1408
|
break;
|
|
1408
1409
|
}
|
|
1409
|
-
return _context12.delegateYield(_loop2(), "
|
|
1410
|
-
case
|
|
1411
|
-
_context12.next =
|
|
1410
|
+
return _context12.delegateYield(_loop2(), "t0", 9);
|
|
1411
|
+
case 9:
|
|
1412
|
+
_context12.next = 8;
|
|
1412
1413
|
break;
|
|
1413
|
-
case
|
|
1414
|
-
_context12.next =
|
|
1414
|
+
case 10:
|
|
1415
|
+
_context12.next = 12;
|
|
1415
1416
|
break;
|
|
1416
|
-
case
|
|
1417
|
-
_context12.prev =
|
|
1418
|
-
|
|
1419
|
-
_iterator7.e(
|
|
1420
|
-
case
|
|
1421
|
-
_context12.prev =
|
|
1417
|
+
case 11:
|
|
1418
|
+
_context12.prev = 11;
|
|
1419
|
+
_t17 = _context12["catch"](7);
|
|
1420
|
+
_iterator7.e(_t17);
|
|
1421
|
+
case 12:
|
|
1422
|
+
_context12.prev = 12;
|
|
1422
1423
|
_iterator7.f();
|
|
1423
|
-
return _context12.finish(
|
|
1424
|
-
case
|
|
1424
|
+
return _context12.finish(12);
|
|
1425
|
+
case 13:
|
|
1425
1426
|
return _context12.abrupt("return", results);
|
|
1426
|
-
case
|
|
1427
|
-
_context12.prev =
|
|
1428
|
-
|
|
1429
|
-
if (!(
|
|
1430
|
-
_context12.next =
|
|
1427
|
+
case 14:
|
|
1428
|
+
_context12.prev = 14;
|
|
1429
|
+
_t18 = _context12["catch"](5);
|
|
1430
|
+
if (!(_t18 instanceof BlockError)) {
|
|
1431
|
+
_context12.next = 15;
|
|
1431
1432
|
break;
|
|
1432
1433
|
}
|
|
1433
1434
|
return _context12.abrupt("return", data.map(function (block) {
|
|
1434
1435
|
return {
|
|
1435
|
-
error: mapBlockError(
|
|
1436
|
+
error: mapBlockError(_t18),
|
|
1436
1437
|
resourceId: block.resourceId
|
|
1437
1438
|
};
|
|
1438
1439
|
}));
|
|
1439
|
-
case
|
|
1440
|
+
case 15:
|
|
1440
1441
|
return _context12.abrupt("return", data.map(function (block) {
|
|
1441
1442
|
return {
|
|
1442
|
-
error: stringifyError(
|
|
1443
|
+
error: stringifyError(_t18),
|
|
1443
1444
|
resourceId: block.resourceId
|
|
1444
1445
|
};
|
|
1445
1446
|
}));
|
|
1446
|
-
case
|
|
1447
|
+
case 16:
|
|
1447
1448
|
case "end":
|
|
1448
1449
|
return _context12.stop();
|
|
1449
1450
|
}
|
|
1450
|
-
}, _callee10, this, [[
|
|
1451
|
+
}, _callee10, this, [[5, 14], [7, 11, 12, 13]]);
|
|
1451
1452
|
}));
|
|
1452
1453
|
function writeDataBatch(_x21) {
|
|
1453
1454
|
return _writeDataBatch.apply(this, arguments);
|