@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,440 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _typeof from "@babel/runtime/helpers/typeof";
6
- 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; }
7
- 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; }
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
- import { useMemo } from 'react';
10
- import { getConfluencePageAri, getLocalIdFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId } from '../../clients/confluence/ari';
11
- import { getContentProperty, createContentProperty, updateContentProperty, deleteContentProperty } from '../../clients/confluence/contentProperty';
12
- import { isBlogPageType } from '../../clients/confluence/utils';
13
- import { SyncBlockError } from '../../common/types';
14
- import { stringifyError } from '../../utils/errorHandling';
15
-
16
- /**
17
- * Configuration for Content API providers
18
- */
19
-
20
- var getContentPropertyKey = function getContentPropertyKey(contentPropertyKey, localId) {
21
- return contentPropertyKey + '-' + localId;
22
- };
23
- var parseSyncedBlockContentPropertyValue = function parseSyncedBlockContentPropertyValue(value) {
24
- try {
25
- if (value !== '') {
26
- var parsedValue = JSON.parse(value);
27
- if (_typeof(parsedValue.content) === 'object') {
28
- return parsedValue;
29
- }
30
- throw new Error('Cannot parse synced block data: required properties missing in value');
31
- } else {
32
- throw new Error('Cannot parse synced block data: value is empty');
33
- }
34
- } catch (error) {
35
- throw new Error("Failed to parse synced block data: ".concat(error));
36
- }
37
- };
38
- var getResponseError = function getResponseError(contentProperty) {
39
- var _content$properties;
40
- var content = 'blogPost' in contentProperty.data.confluence ? contentProperty.data.confluence.blogPost : contentProperty.data.confluence.page;
41
- if (!content) {
42
- return SyncBlockError.Forbidden;
43
- }
44
- if (!((_content$properties = content.properties) !== null && _content$properties !== void 0 && _content$properties[0])) {
45
- return SyncBlockError.NotFound;
46
- }
47
- return SyncBlockError.Errored;
48
- };
49
-
50
- /**
51
- * ADFFetchProvider implementation that fetches synced block data from Confluence Content API
52
- */
53
- var ConfluenceADFFetchProvider = /*#__PURE__*/function () {
54
- function ConfluenceADFFetchProvider(config) {
55
- _classCallCheck(this, ConfluenceADFFetchProvider);
56
- this.config = config;
57
- }
58
- return _createClass(ConfluenceADFFetchProvider, [{
59
- key: "fetchData",
60
- value: function () {
61
- var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resourceId) {
62
- var _getPageIdAndTypeFrom, pageId, pageType, localId, key, options, error, value, _contentProperty$data, contentProperty, _contentProperty$data2, _contentProperty, syncedBlockData;
63
- return _regeneratorRuntime.wrap(function _callee$(_context) {
64
- while (1) switch (_context.prev = _context.next) {
65
- case 0:
66
- _getPageIdAndTypeFrom = getPageIdAndTypeFromConfluencePageAri(resourceId), pageId = _getPageIdAndTypeFrom.id, pageType = _getPageIdAndTypeFrom.type;
67
- localId = getLocalIdFromContentPropertyResourceId(resourceId);
68
- _context.prev = 2;
69
- key = getContentPropertyKey(this.config.contentPropertyKey, localId);
70
- options = {
71
- pageId: pageId,
72
- key: key,
73
- cloudId: this.config.cloudId,
74
- pageType: pageType
75
- };
76
- if (!isBlogPageType(pageType)) {
77
- _context.next = 13;
78
- break;
79
- }
80
- _context.next = 8;
81
- return getContentProperty(options);
82
- case 8:
83
- contentProperty = _context.sent;
84
- value = (_contentProperty$data = contentProperty.data.confluence.blogPost) === null || _contentProperty$data === void 0 || (_contentProperty$data = _contentProperty$data.properties) === null || _contentProperty$data === void 0 || (_contentProperty$data = _contentProperty$data[0]) === null || _contentProperty$data === void 0 ? void 0 : _contentProperty$data.value;
85
- error = getResponseError(contentProperty);
86
- _context.next = 18;
87
- break;
88
- case 13:
89
- _context.next = 15;
90
- return getContentProperty(options);
91
- case 15:
92
- _contentProperty = _context.sent;
93
- value = (_contentProperty$data2 = _contentProperty.data.confluence.page) === null || _contentProperty$data2 === void 0 || (_contentProperty$data2 = _contentProperty$data2.properties) === null || _contentProperty$data2 === void 0 || (_contentProperty$data2 = _contentProperty$data2[0]) === null || _contentProperty$data2 === void 0 ? void 0 : _contentProperty$data2.value;
94
- error = getResponseError(_contentProperty);
95
- case 18:
96
- if (value) {
97
- _context.next = 20;
98
- break;
99
- }
100
- return _context.abrupt("return", {
101
- error: error,
102
- resourceId: resourceId
103
- });
104
- case 20:
105
- // Parse the synced block content from the property value
106
- syncedBlockData = parseSyncedBlockContentPropertyValue(value);
107
- return _context.abrupt("return", {
108
- data: {
109
- content: syncedBlockData.content,
110
- // If the block instance ID is not set, use the local ID from the fetch data request
111
- // This is a fallback for the case where the block instance ID is not set in the synced block data (old data)
112
- blockInstanceId: syncedBlockData.blockInstanceId || localId,
113
- // If the resource ID is not set, use the resource ID from the fetch data request
114
- // This is a fallback for the case where the resource ID is not set in the synced block data (old data)
115
- resourceId: syncedBlockData.resourceId || resourceId,
116
- // If the product is not set, use the default product 'confluence-page'
117
- // This is a fallback for the case where the product is not set in the synced block data (old data)
118
- product: syncedBlockData.product || 'confluence-page',
119
- // If the source Ari is not set, use the resource ID as the source Ari
120
- // This is a fallback for the case where the source Ari is not set in the synced block data (old data)
121
- sourceAri: syncedBlockData.sourceAri || resourceId
122
- },
123
- resourceId: resourceId
124
- });
125
- case 24:
126
- _context.prev = 24;
127
- _context.t0 = _context["catch"](2);
128
- return _context.abrupt("return", {
129
- error: SyncBlockError.Errored,
130
- resourceId: resourceId
131
- });
132
- case 27:
133
- case "end":
134
- return _context.stop();
135
- }
136
- }, _callee, this, [[2, 24]]);
137
- }));
138
- function fetchData(_x) {
139
- return _fetchData.apply(this, arguments);
140
- }
141
- return fetchData;
142
- }()
143
- }]);
144
- }();
145
- /**
146
- * ADFWriteProvider implementation that writes synced block data to Confluence Content API
147
- */
148
- var ConfluenceADFWriteProvider = /*#__PURE__*/function () {
149
- function ConfluenceADFWriteProvider(config) {
150
- var _this = this;
151
- _classCallCheck(this, ConfluenceADFWriteProvider);
152
- _defineProperty(this, "product", 'confluence-page');
153
- _defineProperty(this, "createNewContentProperty", /*#__PURE__*/function () {
154
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(pageId, key, value, pageType) {
155
- var options, _contentProperty$data3, contentProperty, _contentProperty2$dat, _contentProperty2;
156
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
157
- while (1) switch (_context2.prev = _context2.next) {
158
- case 0:
159
- options = {
160
- pageId: pageId,
161
- key: key,
162
- value: value,
163
- cloudId: _this.config.cloudId,
164
- pageType: pageType
165
- };
166
- if (!isBlogPageType(pageType)) {
167
- _context2.next = 12;
168
- break;
169
- }
170
- _context2.next = 4;
171
- return createContentProperty(options);
172
- case 4:
173
- contentProperty = _context2.sent;
174
- if (!(((_contentProperty$data3 = contentProperty.data.confluence.createBlogPostProperty.blogPostProperty) === null || _contentProperty$data3 === void 0 ? void 0 : _contentProperty$data3.key) === key)) {
175
- _context2.next = 9;
176
- break;
177
- }
178
- return _context2.abrupt("return", key);
179
- case 9:
180
- return _context2.abrupt("return", Promise.reject('Failed to create blog post content property'));
181
- case 10:
182
- _context2.next = 20;
183
- break;
184
- case 12:
185
- _context2.next = 14;
186
- return createContentProperty(options);
187
- case 14:
188
- _contentProperty2 = _context2.sent;
189
- if (!(((_contentProperty2$dat = _contentProperty2.data.confluence.createPageProperty.pageProperty) === null || _contentProperty2$dat === void 0 ? void 0 : _contentProperty2$dat.key) === key)) {
190
- _context2.next = 19;
191
- break;
192
- }
193
- return _context2.abrupt("return", key);
194
- case 19:
195
- return _context2.abrupt("return", Promise.reject('Failed to create page content property'));
196
- case 20:
197
- case "end":
198
- return _context2.stop();
199
- }
200
- }, _callee2);
201
- }));
202
- return function (_x2, _x3, _x4, _x5) {
203
- return _ref.apply(this, arguments);
204
- };
205
- }());
206
- this.config = config;
207
- }
208
- return _createClass(ConfluenceADFWriteProvider, [{
209
- key: "writeData",
210
- value: function () {
211
- var _writeData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(syncBlockData) {
212
- var match, resourceId, _match, pageId, pageType, localId, key, sourceAri, syncBlockDataWithSourceDocumentAri, options, updatePayload, updateResult;
213
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
214
- while (1) switch (_context3.prev = _context3.next) {
215
- case 0:
216
- resourceId = syncBlockData.resourceId;
217
- _context3.prev = 1;
218
- match = getPageIdAndTypeFromConfluencePageAri(resourceId);
219
- _context3.next = 8;
220
- break;
221
- case 5:
222
- _context3.prev = 5;
223
- _context3.t0 = _context3["catch"](1);
224
- return _context3.abrupt("return", {
225
- error: stringifyError(_context3.t0)
226
- });
227
- case 8:
228
- _match = match, pageId = _match.id, pageType = _match.type;
229
- _context3.prev = 9;
230
- // Update existing content property
231
- localId = getLocalIdFromContentPropertyResourceId(resourceId);
232
- key = getContentPropertyKey(this.config.contentPropertyKey, localId);
233
- sourceAri = getConfluencePageAri(pageId, this.config.cloudId, pageType);
234
- syncBlockDataWithSourceDocumentAri = _objectSpread(_objectSpread({}, syncBlockData), {}, {
235
- product: 'confluence-page',
236
- sourceAri: sourceAri
237
- });
238
- options = {
239
- pageId: pageId,
240
- key: key,
241
- value: syncBlockDataWithSourceDocumentAri,
242
- cloudId: this.config.cloudId,
243
- pageType: pageType
244
- };
245
- _context3.next = 17;
246
- return updateContentProperty(options);
247
- case 17:
248
- updatePayload = _context3.sent;
249
- updateResult = isBlogPageType(pageType) ? updatePayload.data.confluence.updateValueBlogPostProperty.blogPostProperty : updatePayload.data.confluence.updateValuePageProperty.pageProperty;
250
- if (!((updateResult === null || updateResult === void 0 ? void 0 : updateResult.key) === key)) {
251
- _context3.next = 23;
252
- break;
253
- }
254
- return _context3.abrupt("return", {
255
- resourceId: resourceId
256
- });
257
- case 23:
258
- return _context3.abrupt("return", {
259
- error: "Failed to update ".concat(pageType, " content property")
260
- });
261
- case 24:
262
- _context3.next = 29;
263
- break;
264
- case 26:
265
- _context3.prev = 26;
266
- _context3.t1 = _context3["catch"](9);
267
- return _context3.abrupt("return", {
268
- error: "Failed to write ".concat(pageType)
269
- });
270
- case 29:
271
- case "end":
272
- return _context3.stop();
273
- }
274
- }, _callee3, this, [[1, 5], [9, 26]]);
275
- }));
276
- function writeData(_x6) {
277
- return _writeData.apply(this, arguments);
278
- }
279
- return writeData;
280
- }()
281
- }, {
282
- key: "createData",
283
- value: function () {
284
- var _createData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(syncBlockData) {
285
- var match, resourceId, _match2, pageId, pageType, localId, key, sourceAri, syncBlockDataWithSourceDocumentAri;
286
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
287
- while (1) switch (_context4.prev = _context4.next) {
288
- case 0:
289
- resourceId = syncBlockData.resourceId;
290
- _context4.prev = 1;
291
- match = getPageIdAndTypeFromConfluencePageAri(resourceId);
292
- _context4.next = 8;
293
- break;
294
- case 5:
295
- _context4.prev = 5;
296
- _context4.t0 = _context4["catch"](1);
297
- return _context4.abrupt("return", {
298
- error: stringifyError(_context4.t0)
299
- });
300
- case 8:
301
- _match2 = match, pageId = _match2.id, pageType = _match2.type;
302
- _context4.prev = 9;
303
- localId = getLocalIdFromContentPropertyResourceId(resourceId);
304
- key = getContentPropertyKey(this.config.contentPropertyKey, localId);
305
- sourceAri = getConfluencePageAri(pageId, this.config.cloudId, pageType);
306
- syncBlockDataWithSourceDocumentAri = _objectSpread(_objectSpread({}, syncBlockData), {}, {
307
- product: 'confluence-page',
308
- sourceAri: sourceAri
309
- });
310
- _context4.next = 16;
311
- return this.createNewContentProperty(pageId, key, syncBlockDataWithSourceDocumentAri, pageType);
312
- case 16:
313
- return _context4.abrupt("return", {
314
- resourceId: resourceId
315
- });
316
- case 19:
317
- _context4.prev = 19;
318
- _context4.t1 = _context4["catch"](9);
319
- return _context4.abrupt("return", Promise.resolve({
320
- error: stringifyError(_context4.t1)
321
- }));
322
- case 22:
323
- case "end":
324
- return _context4.stop();
325
- }
326
- }, _callee4, this, [[1, 5], [9, 19]]);
327
- }));
328
- function createData(_x7) {
329
- return _createData.apply(this, arguments);
330
- }
331
- return createData;
332
- }()
333
- }, {
334
- key: "deleteData",
335
- value: function () {
336
- var _deleteData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(resourceId) {
337
- var deletePayload, deleteResult, match, _match3, pageId, pageType, localId, key, options, _stringifyError;
338
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
339
- while (1) switch (_context5.prev = _context5.next) {
340
- case 0:
341
- _context5.prev = 0;
342
- match = getPageIdAndTypeFromConfluencePageAri(resourceId);
343
- _context5.next = 7;
344
- break;
345
- case 4:
346
- _context5.prev = 4;
347
- _context5.t0 = _context5["catch"](0);
348
- return _context5.abrupt("return", {
349
- resourceId: resourceId,
350
- success: false,
351
- error: stringifyError(_context5.t0)
352
- });
353
- case 7:
354
- _match3 = match, pageId = _match3.id, pageType = _match3.type;
355
- _context5.prev = 8;
356
- localId = getLocalIdFromContentPropertyResourceId(resourceId);
357
- key = getContentPropertyKey(this.config.contentPropertyKey, localId);
358
- options = {
359
- pageId: pageId,
360
- key: key,
361
- cloudId: this.config.cloudId,
362
- pageType: pageType
363
- };
364
- _context5.next = 14;
365
- return deleteContentProperty(options);
366
- case 14:
367
- deletePayload = _context5.sent;
368
- deleteResult = isBlogPageType(pageType) ? deletePayload.data.confluence.deleteBlogPostProperty : deletePayload.data.confluence.deletePageProperty;
369
- _context5.next = 21;
370
- break;
371
- case 18:
372
- _context5.prev = 18;
373
- _context5.t1 = _context5["catch"](8);
374
- return _context5.abrupt("return", {
375
- resourceId: resourceId,
376
- success: false,
377
- error: (_stringifyError = stringifyError(_context5.t1)) !== null && _stringifyError !== void 0 ? _stringifyError : "Fail to delete ".concat(pageType, " content property")
378
- });
379
- case 21:
380
- return _context5.abrupt("return", {
381
- resourceId: resourceId,
382
- success: deleteResult.success,
383
- error: deleteResult.errors.join()
384
- });
385
- case 22:
386
- case "end":
387
- return _context5.stop();
388
- }
389
- }, _callee5, this, [[0, 4], [8, 18]]);
390
- }));
391
- function deleteData(_x8) {
392
- return _deleteData.apply(this, arguments);
393
- }
394
- return deleteData;
395
- }()
396
- }, {
397
- key: "generateResourceId",
398
- value: function generateResourceId(sourceId, localId) {
399
- return resourceIdFromConfluencePageSourceIdAndLocalId(sourceId, localId);
400
- }
401
- }, {
402
- key: "generateResourceIdForReference",
403
- value: function generateResourceIdForReference(sourceId) {
404
- return sourceId;
405
- }
406
- }, {
407
- key: "updateReferenceData",
408
- value: function updateReferenceData(_blocks, _noContent) {
409
- return Promise.resolve({
410
- success: true
411
- });
412
- }
413
- }]);
414
- }();
415
- /**
416
- * Factory function to create both providers with shared configuration
417
- */
418
- var createContentAPIProviders = function createContentAPIProviders(config) {
419
- var fetchProvider = new ConfluenceADFFetchProvider(config);
420
- var writeProvider = new ConfluenceADFWriteProvider(config);
421
- return {
422
- fetchProvider: fetchProvider,
423
- writeProvider: writeProvider
424
- };
425
- };
426
-
427
- /**
428
- * Convenience function to create providers with default content property key
429
- */
430
- export var createContentAPIProvidersWithDefaultKey = function createContentAPIProvidersWithDefaultKey(cloudId) {
431
- return createContentAPIProviders({
432
- cloudId: cloudId,
433
- contentPropertyKey: 'editor-synced-block'
434
- });
435
- };
436
- export var useMemoizedContentAPIProviders = function useMemoizedContentAPIProviders(cloudId) {
437
- return useMemo(function () {
438
- return createContentAPIProvidersWithDefaultKey(cloudId);
439
- }, [cloudId]);
440
- };
@@ -1,139 +0,0 @@
1
- import type { SyncBlockData } from '../../common/types';
2
- import { type PAGE_TYPE } from './ari';
3
- type GetContentPropertyOptions = {
4
- cloudId: string;
5
- key: string;
6
- pageId: string;
7
- pageType: PAGE_TYPE;
8
- signal?: AbortSignal;
9
- };
10
- type CreateContentPropertyOptions = {
11
- cloudId: string;
12
- key: string;
13
- pageId: string;
14
- pageType: PAGE_TYPE;
15
- value: SyncBlockData;
16
- };
17
- type UpdateContentPropertyOptions = {
18
- cloudId: string;
19
- key: string;
20
- pageId: string;
21
- pageType: PAGE_TYPE;
22
- signal?: AbortSignal;
23
- value: SyncBlockData;
24
- };
25
- type DeleteContentPropertyOptions = {
26
- cloudId: string;
27
- key: string;
28
- pageId: string;
29
- pageType: PAGE_TYPE;
30
- };
31
- export type GetContentPropertyResult = {
32
- data: {
33
- confluence: {
34
- page: {
35
- properties: [
36
- {
37
- key: string | null;
38
- value: string | null;
39
- }
40
- ] | null;
41
- };
42
- };
43
- };
44
- };
45
- export type GetBlogPostContentPropertyResult = {
46
- data: {
47
- confluence: {
48
- blogPost: {
49
- properties: [
50
- {
51
- key: string | null;
52
- value: string | null;
53
- }
54
- ] | null;
55
- };
56
- };
57
- };
58
- };
59
- export type UpdateContentPropertyResult = {
60
- data: {
61
- confluence: {
62
- updateValuePageProperty: {
63
- pageProperty: {
64
- key: string | null;
65
- value: string | null;
66
- } | null;
67
- };
68
- };
69
- };
70
- };
71
- export type UpdateBlogPostContentPropertyResult = {
72
- data: {
73
- confluence: {
74
- updateValueBlogPostProperty: {
75
- blogPostProperty: {
76
- key: string | null;
77
- value: string | null;
78
- } | null;
79
- };
80
- };
81
- };
82
- };
83
- export type CreateContentPropertyResult = {
84
- data: {
85
- confluence: {
86
- createPageProperty: {
87
- pageProperty: {
88
- key: string | null;
89
- value: string | null;
90
- } | null;
91
- };
92
- };
93
- };
94
- };
95
- export type CreateBlogPostContentPropertyResult = {
96
- data: {
97
- confluence: {
98
- createBlogPostProperty: {
99
- blogPostProperty: {
100
- key: string | null;
101
- value: string | null;
102
- } | null;
103
- };
104
- };
105
- };
106
- };
107
- export type DeletePageContentPropertyResult = {
108
- data: {
109
- confluence: {
110
- deletePageProperty: {
111
- errors: [
112
- {
113
- message: string;
114
- }
115
- ];
116
- success: boolean;
117
- };
118
- };
119
- };
120
- };
121
- export type DeleteBlogPostPropertyResult = {
122
- data: {
123
- confluence: {
124
- deleteBlogPostProperty: {
125
- errors: [
126
- {
127
- message: string;
128
- }
129
- ];
130
- success: boolean;
131
- };
132
- };
133
- };
134
- };
135
- export declare const getContentProperty: <T extends GetContentPropertyResult | GetBlogPostContentPropertyResult>({ pageId, key, cloudId, pageType, }: GetContentPropertyOptions) => Promise<T>;
136
- export declare const updateContentProperty: <T extends UpdateContentPropertyResult | UpdateBlogPostContentPropertyResult>({ pageId, key, value, cloudId, pageType, }: UpdateContentPropertyOptions) => Promise<T>;
137
- export declare const createContentProperty: <T extends CreateContentPropertyResult | CreateBlogPostContentPropertyResult>({ pageId, key, value, cloudId, pageType, }: CreateContentPropertyOptions) => Promise<T>;
138
- export declare const deleteContentProperty: <T extends DeletePageContentPropertyResult | DeleteBlogPostPropertyResult>({ pageId, cloudId, pageType, key, }: DeleteContentPropertyOptions) => Promise<T>;
139
- export {};
@@ -1,44 +0,0 @@
1
- import { type ResourceId, type SyncBlockAttrs, type SyncBlockData, type SyncBlockProduct } from '../../common/types';
2
- import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, UpdateReferenceSyncBlockResult, WriteSyncBlockResult } from '../types';
3
- /**
4
- * Configuration for Content API providers
5
- */
6
- interface ContentAPIConfig {
7
- cloudId: string;
8
- contentPropertyKey: string;
9
- }
10
- /**
11
- * ADFFetchProvider implementation that fetches synced block data from Confluence Content API
12
- */
13
- declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
14
- private config;
15
- constructor(config: ContentAPIConfig);
16
- fetchData(resourceId: string): Promise<SyncBlockInstance>;
17
- }
18
- /**
19
- * ADFWriteProvider implementation that writes synced block data to Confluence Content API
20
- */
21
- declare class ConfluenceADFWriteProvider implements ADFWriteProvider {
22
- private config;
23
- product: SyncBlockProduct;
24
- constructor(config: ContentAPIConfig);
25
- private createNewContentProperty;
26
- writeData(syncBlockData: SyncBlockData): Promise<WriteSyncBlockResult>;
27
- createData(syncBlockData: SyncBlockData): Promise<WriteSyncBlockResult>;
28
- deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
29
- generateResourceId(sourceId: string, localId: string): string;
30
- generateResourceIdForReference(sourceId: ResourceId): ResourceId;
31
- updateReferenceData(_blocks: SyncBlockAttrs[], _noContent?: boolean): Promise<UpdateReferenceSyncBlockResult>;
32
- }
33
- /**
34
- * Convenience function to create providers with default content property key
35
- */
36
- export declare const createContentAPIProvidersWithDefaultKey: (cloudId: string) => {
37
- fetchProvider: ConfluenceADFFetchProvider;
38
- writeProvider: ConfluenceADFWriteProvider;
39
- };
40
- export declare const useMemoizedContentAPIProviders: (cloudId: string) => {
41
- fetchProvider: ConfluenceADFFetchProvider;
42
- writeProvider: ConfluenceADFWriteProvider;
43
- };
44
- export {};