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