@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
|
@@ -162,17 +162,29 @@ export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
|
162
162
|
return _ref3.apply(this, arguments);
|
|
163
163
|
};
|
|
164
164
|
}();
|
|
165
|
-
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Batch retrieves multiple synced blocks by their ARIs.
|
|
168
|
+
*
|
|
169
|
+
* Calls the Block Service API endpoint: `POST /v1/block/batch-retrieve`
|
|
170
|
+
*
|
|
171
|
+
* @param blockAris - Array of block ARIs to retrieve
|
|
172
|
+
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
173
|
+
*/
|
|
174
|
+
export var batchRetrieveSyncedBlocks = /*#__PURE__*/function () {
|
|
166
175
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
167
|
-
var
|
|
176
|
+
var blockAris, response;
|
|
168
177
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
169
178
|
while (1) switch (_context3.prev = _context3.next) {
|
|
170
179
|
case 0:
|
|
171
|
-
|
|
180
|
+
blockAris = _ref4.blockAris;
|
|
172
181
|
_context3.next = 3;
|
|
173
|
-
return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/")
|
|
174
|
-
method: '
|
|
175
|
-
headers: COMMON_HEADERS
|
|
182
|
+
return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/batch-retrieve"), {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
headers: COMMON_HEADERS,
|
|
185
|
+
body: JSON.stringify({
|
|
186
|
+
blockAris: blockAris
|
|
187
|
+
})
|
|
176
188
|
});
|
|
177
189
|
case 3:
|
|
178
190
|
response = _context3.sent;
|
|
@@ -182,58 +194,92 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
|
182
194
|
}
|
|
183
195
|
throw new BlockError(response.status);
|
|
184
196
|
case 6:
|
|
197
|
+
_context3.next = 8;
|
|
198
|
+
return response.json();
|
|
199
|
+
case 8:
|
|
200
|
+
return _context3.abrupt("return", _context3.sent);
|
|
201
|
+
case 9:
|
|
185
202
|
case "end":
|
|
186
203
|
return _context3.stop();
|
|
187
204
|
}
|
|
188
205
|
}, _callee3);
|
|
189
206
|
}));
|
|
190
|
-
return function
|
|
207
|
+
return function batchRetrieveSyncedBlocks(_x3) {
|
|
191
208
|
return _ref5.apply(this, arguments);
|
|
192
209
|
};
|
|
193
210
|
}();
|
|
194
|
-
export var
|
|
211
|
+
export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
195
212
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) {
|
|
196
|
-
var blockAri,
|
|
213
|
+
var blockAri, response;
|
|
197
214
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
198
215
|
while (1) switch (_context4.prev = _context4.next) {
|
|
199
216
|
case 0:
|
|
200
|
-
blockAri = _ref6.blockAri
|
|
217
|
+
blockAri = _ref6.blockAri;
|
|
218
|
+
_context4.next = 3;
|
|
219
|
+
return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
220
|
+
method: 'DELETE',
|
|
221
|
+
headers: COMMON_HEADERS
|
|
222
|
+
});
|
|
223
|
+
case 3:
|
|
224
|
+
response = _context4.sent;
|
|
225
|
+
if (response.ok) {
|
|
226
|
+
_context4.next = 6;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
throw new BlockError(response.status);
|
|
230
|
+
case 6:
|
|
231
|
+
case "end":
|
|
232
|
+
return _context4.stop();
|
|
233
|
+
}
|
|
234
|
+
}, _callee4);
|
|
235
|
+
}));
|
|
236
|
+
return function deleteSyncedBlock(_x4) {
|
|
237
|
+
return _ref7.apply(this, arguments);
|
|
238
|
+
};
|
|
239
|
+
}();
|
|
240
|
+
export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
241
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
242
|
+
var blockAri, content, stepVersion, requestBody, response;
|
|
243
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
244
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
245
|
+
case 0:
|
|
246
|
+
blockAri = _ref8.blockAri, content = _ref8.content, stepVersion = _ref8.stepVersion;
|
|
201
247
|
requestBody = {
|
|
202
248
|
content: content
|
|
203
249
|
};
|
|
204
250
|
if (stepVersion !== undefined) {
|
|
205
251
|
requestBody.stepVersion = stepVersion;
|
|
206
252
|
}
|
|
207
|
-
|
|
253
|
+
_context5.next = 5;
|
|
208
254
|
return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
209
255
|
method: 'PUT',
|
|
210
256
|
headers: COMMON_HEADERS,
|
|
211
257
|
body: JSON.stringify(requestBody)
|
|
212
258
|
});
|
|
213
259
|
case 5:
|
|
214
|
-
response =
|
|
260
|
+
response = _context5.sent;
|
|
215
261
|
if (response.ok) {
|
|
216
|
-
|
|
262
|
+
_context5.next = 8;
|
|
217
263
|
break;
|
|
218
264
|
}
|
|
219
265
|
throw new BlockError(response.status);
|
|
220
266
|
case 8:
|
|
221
267
|
case "end":
|
|
222
|
-
return
|
|
268
|
+
return _context5.stop();
|
|
223
269
|
}
|
|
224
|
-
},
|
|
270
|
+
}, _callee5);
|
|
225
271
|
}));
|
|
226
|
-
return function updateSyncedBlock(
|
|
227
|
-
return
|
|
272
|
+
return function updateSyncedBlock(_x5) {
|
|
273
|
+
return _ref9.apply(this, arguments);
|
|
228
274
|
};
|
|
229
275
|
}();
|
|
230
276
|
export var createSyncedBlock = /*#__PURE__*/function () {
|
|
231
|
-
var
|
|
277
|
+
var _ref1 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref0) {
|
|
232
278
|
var blockAri, blockInstanceId, sourceAri, product, content, stepVersion, requestBody, response;
|
|
233
|
-
return _regeneratorRuntime.wrap(function
|
|
234
|
-
while (1) switch (
|
|
279
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
280
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
235
281
|
case 0:
|
|
236
|
-
blockAri =
|
|
282
|
+
blockAri = _ref0.blockAri, blockInstanceId = _ref0.blockInstanceId, sourceAri = _ref0.sourceAri, product = _ref0.product, content = _ref0.content, stepVersion = _ref0.stepVersion;
|
|
237
283
|
requestBody = {
|
|
238
284
|
blockAri: blockAri,
|
|
239
285
|
blockInstanceId: blockInstanceId,
|
|
@@ -244,42 +290,42 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
244
290
|
if (stepVersion !== undefined) {
|
|
245
291
|
requestBody.stepVersion = stepVersion;
|
|
246
292
|
}
|
|
247
|
-
|
|
293
|
+
_context6.next = 5;
|
|
248
294
|
return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block"), {
|
|
249
295
|
method: 'POST',
|
|
250
296
|
headers: COMMON_HEADERS,
|
|
251
297
|
body: JSON.stringify(requestBody)
|
|
252
298
|
});
|
|
253
299
|
case 5:
|
|
254
|
-
response =
|
|
300
|
+
response = _context6.sent;
|
|
255
301
|
if (response.ok) {
|
|
256
|
-
|
|
302
|
+
_context6.next = 8;
|
|
257
303
|
break;
|
|
258
304
|
}
|
|
259
305
|
throw new BlockError(response.status);
|
|
260
306
|
case 8:
|
|
261
|
-
|
|
307
|
+
_context6.next = 10;
|
|
262
308
|
return response.json();
|
|
263
309
|
case 10:
|
|
264
|
-
return
|
|
310
|
+
return _context6.abrupt("return", _context6.sent);
|
|
265
311
|
case 11:
|
|
266
312
|
case "end":
|
|
267
|
-
return
|
|
313
|
+
return _context6.stop();
|
|
268
314
|
}
|
|
269
|
-
},
|
|
315
|
+
}, _callee6);
|
|
270
316
|
}));
|
|
271
|
-
return function createSyncedBlock(
|
|
272
|
-
return
|
|
317
|
+
return function createSyncedBlock(_x6) {
|
|
318
|
+
return _ref1.apply(this, arguments);
|
|
273
319
|
};
|
|
274
320
|
}();
|
|
275
321
|
export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
276
|
-
var
|
|
277
|
-
var documentAri, blocks,
|
|
278
|
-
return _regeneratorRuntime.wrap(function
|
|
279
|
-
while (1) switch (
|
|
322
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
|
|
323
|
+
var documentAri, blocks, _ref10$noContent, noContent, response;
|
|
324
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
325
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
280
326
|
case 0:
|
|
281
|
-
documentAri =
|
|
282
|
-
|
|
327
|
+
documentAri = _ref10.documentAri, blocks = _ref10.blocks, _ref10$noContent = _ref10.noContent, noContent = _ref10$noContent === void 0 ? true : _ref10$noContent;
|
|
328
|
+
_context7.next = 3;
|
|
283
329
|
return fetchWithRetry("".concat(BLOCK_SERVICE_API_URL, "/block/document/").concat(encodeURIComponent(documentAri), "/references?noContent=").concat(noContent), {
|
|
284
330
|
method: 'PUT',
|
|
285
331
|
headers: COMMON_HEADERS,
|
|
@@ -288,28 +334,28 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
|
288
334
|
})
|
|
289
335
|
});
|
|
290
336
|
case 3:
|
|
291
|
-
response =
|
|
337
|
+
response = _context7.sent;
|
|
292
338
|
if (response.ok) {
|
|
293
|
-
|
|
339
|
+
_context7.next = 6;
|
|
294
340
|
break;
|
|
295
341
|
}
|
|
296
342
|
throw new BlockError(response.status);
|
|
297
343
|
case 6:
|
|
298
344
|
if (noContent) {
|
|
299
|
-
|
|
345
|
+
_context7.next = 10;
|
|
300
346
|
break;
|
|
301
347
|
}
|
|
302
|
-
|
|
348
|
+
_context7.next = 9;
|
|
303
349
|
return response.json();
|
|
304
350
|
case 9:
|
|
305
|
-
return
|
|
351
|
+
return _context7.abrupt("return", _context7.sent);
|
|
306
352
|
case 10:
|
|
307
353
|
case "end":
|
|
308
|
-
return
|
|
354
|
+
return _context7.stop();
|
|
309
355
|
}
|
|
310
|
-
},
|
|
356
|
+
}, _callee7);
|
|
311
357
|
}));
|
|
312
|
-
return function updateReferenceSyncedBlockOnDocument(
|
|
313
|
-
return
|
|
358
|
+
return function updateReferenceSyncedBlockOnDocument(_x7) {
|
|
359
|
+
return _ref11.apply(this, arguments);
|
|
314
360
|
};
|
|
315
361
|
}();
|