@atlaskit/editor-synced-block-provider 3.2.0 → 3.2.2

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/clients/block-service/ari.js +13 -16
  3. package/dist/cjs/clients/confluence/ari.js +7 -40
  4. package/dist/cjs/clients/confluence/sourceInfo.js +3 -1
  5. package/dist/cjs/clients/jira/ari.js +5 -2
  6. package/dist/cjs/index.js +22 -23
  7. package/dist/cjs/providers/block-service/blockServiceAPI.js +89 -26
  8. package/dist/cjs/providers/syncBlockProvider.js +82 -39
  9. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +5 -8
  10. package/dist/cjs/store-manager/syncBlockStoreManager.js +12 -2
  11. package/dist/es2019/clients/block-service/ari.js +15 -16
  12. package/dist/es2019/clients/confluence/ari.js +11 -37
  13. package/dist/es2019/clients/confluence/sourceInfo.js +3 -1
  14. package/dist/es2019/clients/jira/ari.js +9 -2
  15. package/dist/es2019/index.js +4 -5
  16. package/dist/es2019/providers/block-service/blockServiceAPI.js +92 -27
  17. package/dist/es2019/providers/syncBlockProvider.js +71 -25
  18. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +5 -8
  19. package/dist/es2019/store-manager/syncBlockStoreManager.js +12 -1
  20. package/dist/esm/clients/block-service/ari.js +13 -16
  21. package/dist/esm/clients/confluence/ari.js +6 -39
  22. package/dist/esm/clients/confluence/sourceInfo.js +3 -1
  23. package/dist/esm/clients/jira/ari.js +5 -2
  24. package/dist/esm/index.js +4 -5
  25. package/dist/esm/providers/block-service/blockServiceAPI.js +88 -25
  26. package/dist/esm/providers/syncBlockProvider.js +81 -38
  27. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +4 -8
  28. package/dist/esm/store-manager/syncBlockStoreManager.js +11 -1
  29. package/dist/types/clients/block-service/ari.d.ts +14 -4
  30. package/dist/types/clients/confluence/ari.d.ts +8 -21
  31. package/dist/types/clients/jira/ari.d.ts +7 -2
  32. package/dist/types/index.d.ts +7 -8
  33. package/dist/types/providers/block-service/blockServiceAPI.d.ts +39 -6
  34. package/dist/types/providers/syncBlockProvider.d.ts +15 -13
  35. package/dist/types/providers/types.d.ts +9 -6
  36. package/dist/types/store-manager/syncBlockStoreManager.d.ts +4 -0
  37. package/dist/types-ts4.5/clients/block-service/ari.d.ts +14 -4
  38. package/dist/types-ts4.5/clients/confluence/ari.d.ts +8 -21
  39. package/dist/types-ts4.5/clients/jira/ari.d.ts +7 -2
  40. package/dist/types-ts4.5/index.d.ts +7 -8
  41. package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +39 -6
  42. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +15 -13
  43. package/dist/types-ts4.5/providers/types.d.ts +9 -6
  44. package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +4 -0
  45. package/package.json +1 -1
  46. package/dist/cjs/clients/confluence/contentProperty.js +0 -284
  47. package/dist/cjs/providers/confluence/confluenceContentAPI.js +0 -446
  48. package/dist/es2019/clients/confluence/contentProperty.js +0 -288
  49. package/dist/es2019/providers/confluence/confluenceContentAPI.js +0 -310
  50. package/dist/esm/clients/confluence/contentProperty.js +0 -277
  51. package/dist/esm/providers/confluence/confluenceContentAPI.js +0 -440
  52. package/dist/types/clients/confluence/contentProperty.d.ts +0 -139
  53. package/dist/types/providers/confluence/confluenceContentAPI.d.ts +0 -44
  54. package/dist/types-ts4.5/clients/confluence/contentProperty.d.ts +0 -139
  55. package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +0 -44
@@ -1,277 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import { fetchWithRetry } from '../../utils/retry';
7
- import { getConfluencePageAri } from './ari';
8
- import { isBlogPageType } from './utils';
9
- var COMMON_HEADERS = {
10
- 'Content-Type': 'application/json',
11
- Accept: 'application/json'
12
- };
13
- var AGG_HEADERS = {
14
- 'X-ExperimentalApi': 'confluence-agg-beta'
15
- };
16
- var GRAPHQL_ENDPOINT = '/gateway/api/graphql';
17
- var GET_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET';
18
- var CREATE_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_CREATE';
19
- var UPDATE_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_UPDATE';
20
- var DELETE_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_DELETE';
21
- /**
22
- * Query to get the page property by key
23
- * @param documentARI
24
- * @param key
25
- * @returns
26
- */
27
- var GET_PAGE_QUERY = "query ".concat(GET_OPERATION_NAME, " ($id: ID!, $keys: [String]!) {\n\t\t\t\t\tconfluence {\n\t\t\t\t\t\tpage (id: $id) {\n\t\t\t\t\t\t\tproperties(keys: $keys) {\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}");
28
-
29
- /**
30
- * Query to get the blog page property by key
31
- * @param documentARI
32
- * @param key
33
- * @returns
34
- */
35
- var GET_BLOG_QUERY = "query ".concat(GET_OPERATION_NAME, " ($id: ID!, $keys: [String]!) {\n\tconfluence {\n\t\tblogPost (id: $id) {\n\t\t\tproperties(keys: $keys) {\n\t\t\t\tkey,\n\t\t\t\tvalue\n\t\t\t}\n\t\t}\n\t}\n}");
36
-
37
- /**
38
- * Query to create a page property with key and value
39
- * @param documentARI
40
- * @param key
41
- * @param value
42
- * @returns
43
- */
44
- var CREATE_PAGE_QUERY = "mutation ".concat(CREATE_OPERATION_NAME, " ($input: ConfluenceCreatePagePropertyInput!){\n\t\t\t\t\t\tconfluence {\n\t\t\t\t\t\t\tcreatePageProperty(input: $input) {\n\t\t\t\t\t\t\t\tpageProperty {\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}");
45
-
46
- /**
47
- * Query to create a blog page property with key and value
48
- * @param documentARI
49
- * @param key
50
- * @param value
51
- * @returns
52
- */
53
- var CREATE_BLOG_QUERY = "mutation ".concat(CREATE_OPERATION_NAME, " ($input: ConfluenceCreateBlogPostPropertyInput!){\n\tconfluence {\n\t\tcreateBlogPostProperty(input: $input) {\n\t\t\tblogPostProperty {\n\t\t\t\tkey,\n\t\t\t\tvalue\n\t\t\t}\n\t\t}\n\t}\n}");
54
-
55
- /**
56
- * Query to update a page property with key and value without bumping the version
57
- * @param documentARI
58
- * @param key
59
- * @param value
60
- * @returns
61
- */
62
- var UPDATE_PAGE_QUERY = "mutation ".concat(UPDATE_OPERATION_NAME, " ($input: ConfluenceUpdateValuePagePropertyInput!) {\n\t\t\t\t\t\tconfluence {\n\t\t\t\t\t\t\tupdateValuePageProperty(input: $input) {\n\t\t\t\t\t\t\t\tpageProperty {\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}");
63
-
64
- /**
65
- * Query to update a blog page property with key and value without bumping the version
66
- * @param documentARI
67
- * @param key
68
- * @param value
69
- * @returns
70
- */
71
- var UPDATE_BLOG_QUERY = "mutation ".concat(UPDATE_OPERATION_NAME, " ($input: ConfluenceUpdateValueBlogPostPropertyInput!) {\n\tconfluence {\n\t\tupdateValueBlogPostProperty(input: $input) {\n\t\t\tblogPostProperty {\n\t\t\t\tkey,\n\t\t\t\tvalue\n\t\t\t}\n\t\t}\n\t}\n}");
72
- var DELETE_PAGE_QUERY = "mutation ".concat(DELETE_OPERATION_NAME, " ($input: ConfluenceDeletePagePropertyInput!) {\n\t\t\t\t\t\tconfluence {\n\t\t\t\t\t\t\tdeletePageProperty(input: $input) {\n\t\t\t\t\t\t\t\tsuccess, errors {\n\t\t\t\t\t\t\t\t message\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}");
73
- var DELETE_BLOG_QUERY = "mutation ".concat(DELETE_OPERATION_NAME, " ($input: ConfluenceDeleteBlogPostPropertyInput!) {\n\t\t\t\t\t\tconfluence {\n\t\t\t\t\t\t\tdeleteBlogPostProperty(input: $input) {\n\t\t\t\t\t\t\t\tsuccess, errors {\n\t\t\t\t\t\t\t\t message\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}");
74
- export var getContentProperty = /*#__PURE__*/function () {
75
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
76
- var pageId, key, cloudId, pageType, documentARI, isBlog, bodyData, response;
77
- return _regeneratorRuntime.wrap(function _callee$(_context) {
78
- while (1) switch (_context.prev = _context.next) {
79
- case 0:
80
- pageId = _ref.pageId, key = _ref.key, cloudId = _ref.cloudId, pageType = _ref.pageType;
81
- documentARI = getConfluencePageAri(pageId, cloudId, pageType);
82
- isBlog = isBlogPageType(pageType);
83
- bodyData = {
84
- query: isBlog ? GET_BLOG_QUERY : GET_PAGE_QUERY,
85
- operationName: GET_OPERATION_NAME,
86
- variables: {
87
- id: documentARI,
88
- keys: [key]
89
- }
90
- };
91
- _context.next = 6;
92
- return fetchWithRetry(GRAPHQL_ENDPOINT, {
93
- method: 'POST',
94
- headers: _objectSpread(_objectSpread({}, COMMON_HEADERS), AGG_HEADERS),
95
- body: JSON.stringify(bodyData)
96
- });
97
- case 6:
98
- response = _context.sent;
99
- if (response.ok) {
100
- _context.next = 9;
101
- break;
102
- }
103
- throw new Error("Failed to get content property: ".concat(response.statusText));
104
- case 9:
105
- _context.next = 11;
106
- return response.json();
107
- case 11:
108
- return _context.abrupt("return", _context.sent);
109
- case 12:
110
- case "end":
111
- return _context.stop();
112
- }
113
- }, _callee);
114
- }));
115
- return function getContentProperty(_x) {
116
- return _ref2.apply(this, arguments);
117
- };
118
- }();
119
- export var updateContentProperty = /*#__PURE__*/function () {
120
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
121
- var pageId, key, value, cloudId, pageType, documentARI, isBlog, useSameVersion, input, bodyData, response;
122
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
123
- while (1) switch (_context2.prev = _context2.next) {
124
- case 0:
125
- pageId = _ref3.pageId, key = _ref3.key, value = _ref3.value, cloudId = _ref3.cloudId, pageType = _ref3.pageType;
126
- documentARI = getConfluencePageAri(pageId, cloudId, pageType);
127
- isBlog = isBlogPageType(pageType);
128
- useSameVersion = {
129
- useSameVersion: true
130
- };
131
- input = _objectSpread(_objectSpread({}, isBlog ? {
132
- blogPostId: documentARI
133
- } : {
134
- pageId: documentARI
135
- }), {}, {
136
- key: key,
137
- value: JSON.stringify(value)
138
- }); // Blog content properties don't support the useSameVersion flag at the moment
139
- if (!isBlog) {
140
- input = _objectSpread(_objectSpread({}, input), useSameVersion);
141
- }
142
- bodyData = {
143
- query: isBlog ? UPDATE_BLOG_QUERY : UPDATE_PAGE_QUERY,
144
- operationName: UPDATE_OPERATION_NAME,
145
- variables: {
146
- input: input
147
- }
148
- };
149
- _context2.next = 9;
150
- return fetch(GRAPHQL_ENDPOINT, {
151
- method: 'POST',
152
- headers: _objectSpread(_objectSpread({}, COMMON_HEADERS), AGG_HEADERS),
153
- body: JSON.stringify(bodyData)
154
- });
155
- case 9:
156
- response = _context2.sent;
157
- if (response.ok) {
158
- _context2.next = 12;
159
- break;
160
- }
161
- throw new Error("Failed to update content property: ".concat(response.statusText));
162
- case 12:
163
- _context2.next = 14;
164
- return response.json();
165
- case 14:
166
- return _context2.abrupt("return", _context2.sent);
167
- case 15:
168
- case "end":
169
- return _context2.stop();
170
- }
171
- }, _callee2);
172
- }));
173
- return function updateContentProperty(_x2) {
174
- return _ref4.apply(this, arguments);
175
- };
176
- }();
177
- export var createContentProperty = /*#__PURE__*/function () {
178
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
179
- var pageId, key, value, cloudId, pageType, documentARI, isBlog, bodyData, response;
180
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
181
- while (1) switch (_context3.prev = _context3.next) {
182
- case 0:
183
- pageId = _ref5.pageId, key = _ref5.key, value = _ref5.value, cloudId = _ref5.cloudId, pageType = _ref5.pageType;
184
- documentARI = getConfluencePageAri(pageId, cloudId, pageType);
185
- isBlog = isBlogPageType(pageType);
186
- bodyData = {
187
- query: isBlog ? CREATE_BLOG_QUERY : CREATE_PAGE_QUERY,
188
- operationName: CREATE_OPERATION_NAME,
189
- variables: {
190
- input: _objectSpread(_objectSpread({}, isBlog ? {
191
- blogPostId: documentARI
192
- } : {
193
- pageId: documentARI
194
- }), {}, {
195
- key: key,
196
- value: JSON.stringify(value)
197
- })
198
- }
199
- };
200
- _context3.next = 6;
201
- return fetchWithRetry(GRAPHQL_ENDPOINT, {
202
- method: 'POST',
203
- headers: _objectSpread(_objectSpread({}, COMMON_HEADERS), AGG_HEADERS),
204
- body: JSON.stringify(bodyData)
205
- });
206
- case 6:
207
- response = _context3.sent;
208
- if (response.ok) {
209
- _context3.next = 9;
210
- break;
211
- }
212
- throw new Error("Failed to create content property: ".concat(response.statusText));
213
- case 9:
214
- _context3.next = 11;
215
- return response.json();
216
- case 11:
217
- return _context3.abrupt("return", _context3.sent);
218
- case 12:
219
- case "end":
220
- return _context3.stop();
221
- }
222
- }, _callee3);
223
- }));
224
- return function createContentProperty(_x3) {
225
- return _ref6.apply(this, arguments);
226
- };
227
- }();
228
- export var deleteContentProperty = /*#__PURE__*/function () {
229
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
230
- var pageId, cloudId, pageType, key, documentARI, isBlog, bodyData, response;
231
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
232
- while (1) switch (_context4.prev = _context4.next) {
233
- case 0:
234
- pageId = _ref7.pageId, cloudId = _ref7.cloudId, pageType = _ref7.pageType, key = _ref7.key;
235
- documentARI = getConfluencePageAri(pageId, cloudId, pageType);
236
- isBlog = isBlogPageType(pageType);
237
- bodyData = {
238
- query: isBlog ? DELETE_BLOG_QUERY : DELETE_PAGE_QUERY,
239
- operationName: DELETE_OPERATION_NAME,
240
- variables: {
241
- input: _objectSpread(_objectSpread({}, isBlog ? {
242
- blogPostId: documentARI
243
- } : {
244
- pageId: documentARI
245
- }), {}, {
246
- key: key
247
- })
248
- }
249
- };
250
- _context4.next = 6;
251
- return fetchWithRetry(GRAPHQL_ENDPOINT, {
252
- method: 'POST',
253
- headers: _objectSpread(_objectSpread({}, COMMON_HEADERS), AGG_HEADERS),
254
- body: JSON.stringify(bodyData)
255
- });
256
- case 6:
257
- response = _context4.sent;
258
- if (response.ok) {
259
- _context4.next = 9;
260
- break;
261
- }
262
- throw new Error("Failed to delete content property: ".concat(response.statusText));
263
- case 9:
264
- _context4.next = 11;
265
- return response.json();
266
- case 11:
267
- return _context4.abrupt("return", _context4.sent);
268
- case 12:
269
- case "end":
270
- return _context4.stop();
271
- }
272
- }, _callee4);
273
- }));
274
- return function deleteContentProperty(_x4) {
275
- return _ref8.apply(this, arguments);
276
- };
277
- }();