@atlaskit/editor-synced-block-provider 2.11.3 → 2.12.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 +7 -0
- package/dist/cjs/clients/block-service/blockService.js +130 -50
- package/dist/cjs/common/types.js +1 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/providers/block-service/blockServiceAPI.js +135 -59
- package/dist/es2019/clients/block-service/blockService.js +57 -0
- package/dist/es2019/common/types.js +1 -0
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/providers/block-service/blockServiceAPI.js +54 -1
- package/dist/esm/clients/block-service/blockService.js +130 -50
- package/dist/esm/common/types.js +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/providers/block-service/blockServiceAPI.js +135 -59
- package/dist/types/clients/block-service/blockService.d.ts +52 -0
- package/dist/types/common/types.d.ts +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +2 -1
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +52 -0
- package/dist/types-ts4.5/common/types.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,3 +1,60 @@
|
|
|
1
|
+
export const isBlockContentResponse = response => {
|
|
2
|
+
const content = response.content;
|
|
3
|
+
return typeof content === 'string';
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves all synced blocks referenced in a document.
|
|
8
|
+
*
|
|
9
|
+
* Calls the Block Service API endpoint: `/v1/block/document/reference/{documentAri}`
|
|
10
|
+
*
|
|
11
|
+
* @param documentAri - The ARI of the document to fetch synced blocks for
|
|
12
|
+
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const { blocks, errors } = await getReferenceSyncedBlocks(
|
|
17
|
+
* 'ari:cloud:confluence:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:page/88888888'
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Example response:
|
|
22
|
+
* ```json
|
|
23
|
+
* {
|
|
24
|
+
* "blocks": [
|
|
25
|
+
* {
|
|
26
|
+
* "blockAri": "ari:cloud:blocks:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:synced-block/xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
27
|
+
* "version": 1,
|
|
28
|
+
* "sourceDocumentAri": "ari:cloud:confluence:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:page/88888888",
|
|
29
|
+
* "blockInstanceId": "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
30
|
+
* "content": "string",
|
|
31
|
+
* "status": "active",
|
|
32
|
+
* "createdAt": "2025-10-08T10:30:00.000Z",
|
|
33
|
+
* "createdBy": "557058:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
34
|
+
* "updatedAt": "2025-10-08T10:30:00.000Z"
|
|
35
|
+
* }
|
|
36
|
+
* ],
|
|
37
|
+
* "errors": [
|
|
38
|
+
* {
|
|
39
|
+
* "blockAri": "ari:cloud:blocks:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:synced-block/xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
40
|
+
* "code": "error",
|
|
41
|
+
* "reason": "some error reason"
|
|
42
|
+
* }
|
|
43
|
+
* ]
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
* Check https://block-service.dev.atl-paas.net/ for latest API documentation.
|
|
47
|
+
*/
|
|
48
|
+
export const getReferenceSyncedBlocks = async documentAri => {
|
|
49
|
+
const response = await fetch(`${BLOCK_SERVICE_API_URL}/block/document/reference/${encodeURIComponent(documentAri)}`, {
|
|
50
|
+
method: 'GET',
|
|
51
|
+
headers: COMMON_HEADERS
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
throw new BlockError(response.status);
|
|
55
|
+
}
|
|
56
|
+
return await response.json();
|
|
57
|
+
};
|
|
1
58
|
const COMMON_HEADERS = {
|
|
2
59
|
'Content-Type': 'application/json',
|
|
3
60
|
Accept: 'application/json'
|
|
@@ -2,5 +2,6 @@ export let SyncBlockError = /*#__PURE__*/function (SyncBlockError) {
|
|
|
2
2
|
SyncBlockError["Errored"] = "errored";
|
|
3
3
|
SyncBlockError["NotFound"] = "not_found";
|
|
4
4
|
SyncBlockError["Forbidden"] = "forbidden";
|
|
5
|
+
SyncBlockError["InvalidContent"] = "invalid_content"; // content is not a valid JSON
|
|
5
6
|
return SyncBlockError;
|
|
6
7
|
}({});
|
package/dist/es2019/index.js
CHANGED
|
@@ -23,4 +23,5 @@ export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
|
|
|
23
23
|
|
|
24
24
|
// utils
|
|
25
25
|
export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
|
|
26
|
-
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes } from './utils/utils';
|
|
26
|
+
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes } from './utils/utils';
|
|
27
|
+
export { fetchReferences } from './providers/block-service/blockServiceAPI';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { blockResourceIdFromSourceAndLocalId, getLocalIdFromBlockResourceId } from '../../clients/block-service/ari';
|
|
3
|
-
import { BlockError, createSyncedBlock, deleteSyncedBlock, getSyncedBlockContent, updateSyncedBlock } from '../../clients/block-service/blockService';
|
|
3
|
+
import { BlockError, createSyncedBlock, deleteSyncedBlock, getReferenceSyncedBlocks, getSyncedBlockContent, updateSyncedBlock } from '../../clients/block-service/blockService';
|
|
4
4
|
import { SyncBlockError } from '../../common/types';
|
|
5
5
|
import { stringifyError } from '../../utils/errorHandling';
|
|
6
6
|
const mapBlockError = error => {
|
|
@@ -13,6 +13,59 @@ const mapBlockError = error => {
|
|
|
13
13
|
return SyncBlockError.Errored;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
// convert BlockContentResponse to SyncBlockData
|
|
17
|
+
// throws exception if JSON parsing fails
|
|
18
|
+
// what's missing from BlockContentResponse to SyncBlockData:
|
|
19
|
+
// - updatedAt
|
|
20
|
+
// - sourceURL
|
|
21
|
+
// - sourceTitle
|
|
22
|
+
// - isSynced
|
|
23
|
+
const convertToSyncBlockData = data => {
|
|
24
|
+
return {
|
|
25
|
+
blockInstanceId: data.blockInstanceId,
|
|
26
|
+
content: JSON.parse(data.content),
|
|
27
|
+
createdAt: new Date(data.createdAt).toISOString(),
|
|
28
|
+
createdBy: data.createdBy,
|
|
29
|
+
product: data.product,
|
|
30
|
+
resourceId: data.blockAri,
|
|
31
|
+
sourceAri: data.sourceAri
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export const fetchReferences = async documentAri => {
|
|
35
|
+
let response;
|
|
36
|
+
try {
|
|
37
|
+
response = await getReferenceSyncedBlocks(documentAri);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error instanceof BlockError) {
|
|
40
|
+
return mapBlockError(error);
|
|
41
|
+
}
|
|
42
|
+
return SyncBlockError.Errored;
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
blocks,
|
|
46
|
+
errors
|
|
47
|
+
} = response || {};
|
|
48
|
+
const blocksInstances = (blocks || []).map(blockContentResponse => {
|
|
49
|
+
try {
|
|
50
|
+
return {
|
|
51
|
+
data: convertToSyncBlockData(blockContentResponse),
|
|
52
|
+
resourceId: blockContentResponse.blockAri
|
|
53
|
+
};
|
|
54
|
+
} catch {
|
|
55
|
+
// JSON parsing error, return InvalidContent error
|
|
56
|
+
return {
|
|
57
|
+
error: SyncBlockError.InvalidContent,
|
|
58
|
+
resourceId: blockContentResponse.blockAri
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const errorInstances = (errors || []).map(errorBlock => ({
|
|
63
|
+
error: SyncBlockError.Errored,
|
|
64
|
+
resourceId: errorBlock.blockAri
|
|
65
|
+
}));
|
|
66
|
+
return [...blocksInstances, ...errorInstances];
|
|
67
|
+
};
|
|
68
|
+
|
|
16
69
|
/**
|
|
17
70
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
18
71
|
*/
|
|
@@ -1,13 +1,93 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
6
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
8
|
-
import
|
|
7
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
9
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
+
export var isBlockContentResponse = function isBlockContentResponse(response) {
|
|
12
|
+
var content = response.content;
|
|
13
|
+
return typeof content === 'string';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves all synced blocks referenced in a document.
|
|
18
|
+
*
|
|
19
|
+
* Calls the Block Service API endpoint: `/v1/block/document/reference/{documentAri}`
|
|
20
|
+
*
|
|
21
|
+
* @param documentAri - The ARI of the document to fetch synced blocks for
|
|
22
|
+
* @returns A promise containing arrays of successfully fetched blocks and any errors encountered
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const { blocks, errors } = await getReferenceSyncedBlocks(
|
|
27
|
+
* 'ari:cloud:confluence:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:page/88888888'
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Example response:
|
|
32
|
+
* ```json
|
|
33
|
+
* {
|
|
34
|
+
* "blocks": [
|
|
35
|
+
* {
|
|
36
|
+
* "blockAri": "ari:cloud:blocks:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:synced-block/xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
37
|
+
* "version": 1,
|
|
38
|
+
* "sourceDocumentAri": "ari:cloud:confluence:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:page/88888888",
|
|
39
|
+
* "blockInstanceId": "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
40
|
+
* "content": "string",
|
|
41
|
+
* "status": "active",
|
|
42
|
+
* "createdAt": "2025-10-08T10:30:00.000Z",
|
|
43
|
+
* "createdBy": "557058:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
44
|
+
* "updatedAt": "2025-10-08T10:30:00.000Z"
|
|
45
|
+
* }
|
|
46
|
+
* ],
|
|
47
|
+
* "errors": [
|
|
48
|
+
* {
|
|
49
|
+
* "blockAri": "ari:cloud:blocks:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:synced-block/xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
|
|
50
|
+
* "code": "error",
|
|
51
|
+
* "reason": "some error reason"
|
|
52
|
+
* }
|
|
53
|
+
* ]
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
* Check https://block-service.dev.atl-paas.net/ for latest API documentation.
|
|
57
|
+
*/
|
|
58
|
+
export var getReferenceSyncedBlocks = /*#__PURE__*/function () {
|
|
59
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(documentAri) {
|
|
60
|
+
var response;
|
|
61
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
_context.next = 2;
|
|
65
|
+
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/document/reference/").concat(encodeURIComponent(documentAri)), {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
headers: COMMON_HEADERS
|
|
68
|
+
});
|
|
69
|
+
case 2:
|
|
70
|
+
response = _context.sent;
|
|
71
|
+
if (response.ok) {
|
|
72
|
+
_context.next = 5;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
throw new BlockError(response.status);
|
|
76
|
+
case 5:
|
|
77
|
+
_context.next = 7;
|
|
78
|
+
return response.json();
|
|
79
|
+
case 7:
|
|
80
|
+
return _context.abrupt("return", _context.sent);
|
|
81
|
+
case 8:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
84
|
+
}
|
|
85
|
+
}, _callee);
|
|
86
|
+
}));
|
|
87
|
+
return function getReferenceSyncedBlocks(_x) {
|
|
88
|
+
return _ref.apply(this, arguments);
|
|
89
|
+
};
|
|
90
|
+
}();
|
|
11
91
|
var COMMON_HEADERS = {
|
|
12
92
|
'Content-Type': 'application/json',
|
|
13
93
|
Accept: 'application/json'
|
|
@@ -25,76 +105,76 @@ export var BlockError = /*#__PURE__*/function (_Error) {
|
|
|
25
105
|
return _createClass(BlockError);
|
|
26
106
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
27
107
|
export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
28
|
-
var
|
|
108
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
29
109
|
var blockAri, response;
|
|
30
|
-
return _regeneratorRuntime.wrap(function
|
|
31
|
-
while (1) switch (
|
|
110
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
111
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
32
112
|
case 0:
|
|
33
|
-
blockAri =
|
|
34
|
-
|
|
113
|
+
blockAri = _ref2.blockAri;
|
|
114
|
+
_context2.next = 3;
|
|
35
115
|
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
36
116
|
method: 'GET',
|
|
37
117
|
headers: COMMON_HEADERS
|
|
38
118
|
});
|
|
39
119
|
case 3:
|
|
40
|
-
response =
|
|
120
|
+
response = _context2.sent;
|
|
41
121
|
if (response.ok) {
|
|
42
|
-
|
|
122
|
+
_context2.next = 6;
|
|
43
123
|
break;
|
|
44
124
|
}
|
|
45
125
|
throw new BlockError(response.status);
|
|
46
126
|
case 6:
|
|
47
|
-
|
|
127
|
+
_context2.next = 8;
|
|
48
128
|
return response.json();
|
|
49
129
|
case 8:
|
|
50
|
-
return
|
|
130
|
+
return _context2.abrupt("return", _context2.sent);
|
|
51
131
|
case 9:
|
|
52
132
|
case "end":
|
|
53
|
-
return
|
|
133
|
+
return _context2.stop();
|
|
54
134
|
}
|
|
55
|
-
},
|
|
135
|
+
}, _callee2);
|
|
56
136
|
}));
|
|
57
|
-
return function getSyncedBlockContent(
|
|
58
|
-
return
|
|
137
|
+
return function getSyncedBlockContent(_x2) {
|
|
138
|
+
return _ref3.apply(this, arguments);
|
|
59
139
|
};
|
|
60
140
|
}();
|
|
61
141
|
export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
62
|
-
var
|
|
142
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
63
143
|
var blockAri, response;
|
|
64
|
-
return _regeneratorRuntime.wrap(function
|
|
65
|
-
while (1) switch (
|
|
144
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
145
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
66
146
|
case 0:
|
|
67
|
-
blockAri =
|
|
68
|
-
|
|
147
|
+
blockAri = _ref4.blockAri;
|
|
148
|
+
_context3.next = 3;
|
|
69
149
|
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
70
150
|
method: 'DELETE',
|
|
71
151
|
headers: COMMON_HEADERS
|
|
72
152
|
});
|
|
73
153
|
case 3:
|
|
74
|
-
response =
|
|
154
|
+
response = _context3.sent;
|
|
75
155
|
if (response.ok) {
|
|
76
|
-
|
|
156
|
+
_context3.next = 6;
|
|
77
157
|
break;
|
|
78
158
|
}
|
|
79
159
|
throw new BlockError(response.status);
|
|
80
160
|
case 6:
|
|
81
161
|
case "end":
|
|
82
|
-
return
|
|
162
|
+
return _context3.stop();
|
|
83
163
|
}
|
|
84
|
-
},
|
|
164
|
+
}, _callee3);
|
|
85
165
|
}));
|
|
86
|
-
return function deleteSyncedBlock(
|
|
87
|
-
return
|
|
166
|
+
return function deleteSyncedBlock(_x3) {
|
|
167
|
+
return _ref5.apply(this, arguments);
|
|
88
168
|
};
|
|
89
169
|
}();
|
|
90
170
|
export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
91
|
-
var
|
|
171
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) {
|
|
92
172
|
var blockAri, content, response;
|
|
93
|
-
return _regeneratorRuntime.wrap(function
|
|
94
|
-
while (1) switch (
|
|
173
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
174
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
95
175
|
case 0:
|
|
96
|
-
blockAri =
|
|
97
|
-
|
|
176
|
+
blockAri = _ref6.blockAri, content = _ref6.content;
|
|
177
|
+
_context4.next = 3;
|
|
98
178
|
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block/").concat(encodeURIComponent(blockAri)), {
|
|
99
179
|
method: 'PUT',
|
|
100
180
|
headers: COMMON_HEADERS,
|
|
@@ -103,30 +183,30 @@ export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
|
103
183
|
})
|
|
104
184
|
});
|
|
105
185
|
case 3:
|
|
106
|
-
response =
|
|
186
|
+
response = _context4.sent;
|
|
107
187
|
if (response.ok) {
|
|
108
|
-
|
|
188
|
+
_context4.next = 6;
|
|
109
189
|
break;
|
|
110
190
|
}
|
|
111
191
|
throw new BlockError(response.status);
|
|
112
192
|
case 6:
|
|
113
193
|
case "end":
|
|
114
|
-
return
|
|
194
|
+
return _context4.stop();
|
|
115
195
|
}
|
|
116
|
-
},
|
|
196
|
+
}, _callee4);
|
|
117
197
|
}));
|
|
118
|
-
return function updateSyncedBlock(
|
|
119
|
-
return
|
|
198
|
+
return function updateSyncedBlock(_x4) {
|
|
199
|
+
return _ref7.apply(this, arguments);
|
|
120
200
|
};
|
|
121
201
|
}();
|
|
122
202
|
export var createSyncedBlock = /*#__PURE__*/function () {
|
|
123
|
-
var
|
|
203
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
124
204
|
var blockAri, blockInstanceId, sourceAri, product, content, response;
|
|
125
|
-
return _regeneratorRuntime.wrap(function
|
|
126
|
-
while (1) switch (
|
|
205
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
206
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
127
207
|
case 0:
|
|
128
|
-
blockAri =
|
|
129
|
-
|
|
208
|
+
blockAri = _ref8.blockAri, blockInstanceId = _ref8.blockInstanceId, sourceAri = _ref8.sourceAri, product = _ref8.product, content = _ref8.content;
|
|
209
|
+
_context5.next = 3;
|
|
130
210
|
return fetch("".concat(BLOCK_SERVICE_API_URL, "/block"), {
|
|
131
211
|
method: 'POST',
|
|
132
212
|
headers: COMMON_HEADERS,
|
|
@@ -139,24 +219,24 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
139
219
|
})
|
|
140
220
|
});
|
|
141
221
|
case 3:
|
|
142
|
-
response =
|
|
222
|
+
response = _context5.sent;
|
|
143
223
|
if (response.ok) {
|
|
144
|
-
|
|
224
|
+
_context5.next = 6;
|
|
145
225
|
break;
|
|
146
226
|
}
|
|
147
227
|
throw new BlockError(response.status);
|
|
148
228
|
case 6:
|
|
149
|
-
|
|
229
|
+
_context5.next = 8;
|
|
150
230
|
return response.json();
|
|
151
231
|
case 8:
|
|
152
|
-
return
|
|
232
|
+
return _context5.abrupt("return", _context5.sent);
|
|
153
233
|
case 9:
|
|
154
234
|
case "end":
|
|
155
|
-
return
|
|
235
|
+
return _context5.stop();
|
|
156
236
|
}
|
|
157
|
-
},
|
|
237
|
+
}, _callee5);
|
|
158
238
|
}));
|
|
159
|
-
return function createSyncedBlock(
|
|
160
|
-
return
|
|
239
|
+
return function createSyncedBlock(_x5) {
|
|
240
|
+
return _ref9.apply(this, arguments);
|
|
161
241
|
};
|
|
162
242
|
}();
|
package/dist/esm/common/types.js
CHANGED
|
@@ -2,5 +2,6 @@ export var SyncBlockError = /*#__PURE__*/function (SyncBlockError) {
|
|
|
2
2
|
SyncBlockError["Errored"] = "errored";
|
|
3
3
|
SyncBlockError["NotFound"] = "not_found";
|
|
4
4
|
SyncBlockError["Forbidden"] = "forbidden";
|
|
5
|
+
SyncBlockError["InvalidContent"] = "invalid_content"; // content is not a valid JSON
|
|
5
6
|
return SyncBlockError;
|
|
6
7
|
}({});
|
package/dist/esm/index.js
CHANGED
|
@@ -23,4 +23,5 @@ export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
|
|
|
23
23
|
|
|
24
24
|
// utils
|
|
25
25
|
export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
|
|
26
|
-
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes } from './utils/utils';
|
|
26
|
+
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes } from './utils/utils';
|
|
27
|
+
export { fetchReferences } from './providers/block-service/blockServiceAPI';
|