@atlaskit/editor-synced-block-provider 2.10.4 → 2.10.6
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 +14 -0
- package/dist/cjs/clients/confluence/sourceInfo.js +3 -3
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/providers/block-service/blockServiceAPI.js +0 -14
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +0 -15
- package/dist/cjs/providers/syncBlockProvider.js +30 -40
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +54 -31
- package/dist/es2019/clients/confluence/sourceInfo.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/providers/block-service/blockServiceAPI.js +0 -12
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +1 -14
- package/dist/es2019/providers/syncBlockProvider.js +30 -44
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +51 -30
- package/dist/esm/clients/confluence/sourceInfo.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/providers/block-service/blockServiceAPI.js +0 -14
- package/dist/esm/providers/confluence/confluenceContentAPI.js +1 -16
- package/dist/esm/providers/syncBlockProvider.js +31 -41
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +54 -31
- package/dist/types/clients/confluence/sourceInfo.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +2 -3
- package/dist/types/providers/confluence/confluenceContentAPI.d.ts +2 -3
- package/dist/types/providers/syncBlockProvider.d.ts +11 -9
- package/dist/types/providers/types.d.ts +8 -9
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +2 -1
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +2 -3
- package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +2 -3
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +11 -9
- package/dist/types-ts4.5/providers/types.d.ts +8 -9
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +2 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromCo
|
|
|
15
15
|
// providers
|
|
16
16
|
export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
|
|
17
17
|
export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders } from './providers/confluence/confluenceContentAPI';
|
|
18
|
-
export {
|
|
18
|
+
export { fetchConfluencePageInfo } from './clients/confluence/sourceInfo';
|
|
19
19
|
export { SyncBlockProvider as SyncedBlockProvider, useMemoizedSyncedBlockProvider } from './providers/syncBlockProvider';
|
|
20
20
|
// store managers
|
|
21
21
|
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
@@ -89,20 +89,6 @@ var BlockServiceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
89
89
|
}
|
|
90
90
|
return fetchData;
|
|
91
91
|
}()
|
|
92
|
-
}, {
|
|
93
|
-
key: "retrieveSourceInfoFetchData",
|
|
94
|
-
value: function retrieveSourceInfoFetchData(resourceId, pageARI) {
|
|
95
|
-
var sourceLocalId;
|
|
96
|
-
try {
|
|
97
|
-
sourceLocalId = getLocalIdFromBlockResourceId(resourceId);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
// EDITOR-1921: log analytic here, safe to continue
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
pageARI: pageARI,
|
|
103
|
-
sourceLocalId: sourceLocalId
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
92
|
}]);
|
|
107
93
|
}();
|
|
108
94
|
/**
|
|
@@ -7,7 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
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
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
9
|
import { useMemo } from 'react';
|
|
10
|
-
import { getConfluencePageAri,
|
|
10
|
+
import { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId } from '../../clients/confluence/ari';
|
|
11
11
|
import { getContentProperty, createContentProperty, updateContentProperty, deleteContentProperty } from '../../clients/confluence/contentProperty';
|
|
12
12
|
import { isBlogPageType } from '../../clients/confluence/utils';
|
|
13
13
|
import { SyncBlockError } from '../../common/types';
|
|
@@ -140,21 +140,6 @@ var ConfluenceADFFetchProvider = /*#__PURE__*/function () {
|
|
|
140
140
|
}
|
|
141
141
|
return fetchData;
|
|
142
142
|
}()
|
|
143
|
-
}, {
|
|
144
|
-
key: "retrieveSourceInfoFetchData",
|
|
145
|
-
value: function retrieveSourceInfoFetchData(resourceId) {
|
|
146
|
-
var pageARI = getPageARIFromContentPropertyResourceId(resourceId);
|
|
147
|
-
var sourceLocalId;
|
|
148
|
-
try {
|
|
149
|
-
sourceLocalId = getLocalIdFromConfluencePageAri(resourceId);
|
|
150
|
-
} catch (error) {
|
|
151
|
-
// EDITOR-1921: log analytic here, safe to continue
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
pageARI: pageARI,
|
|
155
|
-
sourceLocalId: sourceLocalId
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
143
|
}]);
|
|
159
144
|
}();
|
|
160
145
|
/**
|
|
@@ -11,7 +11,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
11
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import { useMemo } from 'react';
|
|
13
13
|
import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
|
|
14
|
-
import {
|
|
14
|
+
import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
|
|
15
15
|
import { SyncBlockError } from '../common/types';
|
|
16
16
|
import { SyncBlockDataProvider } from '../providers/types';
|
|
17
17
|
export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
@@ -202,34 +202,28 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
205
|
+
* Fetch the source info from the source id
|
|
206
206
|
*
|
|
207
|
-
* @param
|
|
207
|
+
* @param params
|
|
208
|
+
* @param params.sourceAri - The source ARI
|
|
209
|
+
* @param params.sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
208
210
|
*
|
|
209
211
|
* @returns The source info
|
|
210
212
|
*/
|
|
211
213
|
}, {
|
|
212
|
-
key: "
|
|
213
|
-
value: function
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
sourceLocalId = fetchData.sourceLocalId;
|
|
225
|
-
} catch (error) {
|
|
226
|
-
return Promise.reject(error);
|
|
227
|
-
}
|
|
214
|
+
key: "fetchSyncBlockSourceInfo",
|
|
215
|
+
value: function fetchSyncBlockSourceInfo(localId, sourceAri, sourceProduct) {
|
|
216
|
+
if (!sourceAri || !sourceProduct) {
|
|
217
|
+
return Promise.resolve(undefined);
|
|
218
|
+
}
|
|
219
|
+
switch (sourceProduct) {
|
|
220
|
+
case 'confluence-page':
|
|
221
|
+
return fetchConfluencePageInfo(sourceAri, localId);
|
|
222
|
+
case 'jira-work-item':
|
|
223
|
+
return Promise.reject(new Error('Jira work item source product not supported'));
|
|
224
|
+
default:
|
|
225
|
+
return Promise.reject(new Error("".concat(sourceProduct, " source product not supported")));
|
|
228
226
|
}
|
|
229
|
-
|
|
230
|
-
// TODO: EDITOR-3312 - based on the source sync block product,
|
|
231
|
-
// execute fetchConfluenceSourceInfo or fetchJiraItemSourceInfo or similar...
|
|
232
|
-
return pageARI ? fetchConfluenceSourceInfo(pageARI, sourceLocalId) : Promise.resolve(undefined);
|
|
233
227
|
}
|
|
234
228
|
}, {
|
|
235
229
|
key: "generateResourceId",
|
|
@@ -251,32 +245,28 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
|
251
245
|
/**
|
|
252
246
|
* Retrieve the parent info for the sync block
|
|
253
247
|
*
|
|
254
|
-
* @param
|
|
255
|
-
* @param
|
|
248
|
+
* @param sourceAri - The source ARI
|
|
249
|
+
* @param sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
256
250
|
*
|
|
257
251
|
* @returns The parent info for the sync block
|
|
258
252
|
*/
|
|
259
253
|
}, {
|
|
260
254
|
key: "retrieveSyncBlockParentInfo",
|
|
261
|
-
value: function retrieveSyncBlockParentInfo(
|
|
262
|
-
if (!
|
|
255
|
+
value: function retrieveSyncBlockParentInfo(sourceAri, sourceProduct) {
|
|
256
|
+
if (!sourceAri || !sourceProduct) {
|
|
263
257
|
return undefined;
|
|
264
258
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
259
|
+
switch (sourceProduct) {
|
|
260
|
+
case 'confluence-page':
|
|
261
|
+
return {
|
|
262
|
+
contentId: getPageIdAndTypeFromConfluencePageAri(sourceAri).id,
|
|
263
|
+
contentProduct: sourceProduct
|
|
264
|
+
};
|
|
265
|
+
case 'jira-work-item':
|
|
266
|
+
throw new Error('Jira work item source product not supported');
|
|
267
|
+
default:
|
|
268
|
+
throw new Error("".concat(sourceProduct, " source product not supported"));
|
|
270
269
|
}
|
|
271
|
-
|
|
272
|
-
// TODO: EDITOR-3312 - based on the source sync block product,
|
|
273
|
-
// execute getPageIdAndTypeFromConfluencePageAri or getJiraItemIdAndTypeFromJiraItemAri or similar...
|
|
274
|
-
var _getPageIdAndTypeFrom = getPageIdAndTypeFromConfluencePageAri(sourceAri),
|
|
275
|
-
contentId = _getPageIdAndTypeFrom.id;
|
|
276
|
-
return {
|
|
277
|
-
contentId: contentId,
|
|
278
|
-
contentProduct: product
|
|
279
|
-
};
|
|
280
270
|
}
|
|
281
271
|
}]);
|
|
282
272
|
}(SyncBlockDataProvider);
|
|
@@ -115,35 +115,45 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
115
115
|
return refreshSubscriptions;
|
|
116
116
|
}())
|
|
117
117
|
}, {
|
|
118
|
-
key: "
|
|
119
|
-
value: function
|
|
120
|
-
var
|
|
118
|
+
key: "fetchSyncBlockSourceInfo",
|
|
119
|
+
value: function fetchSyncBlockSourceInfo(resourceId) {
|
|
120
|
+
var _existingSyncBlock$da,
|
|
121
|
+
_existingSyncBlock$da2,
|
|
122
|
+
_this = this;
|
|
121
123
|
if (!resourceId || !this.dataProvider) {
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
126
|
+
if (this.syncBlockURLRequests.get(resourceId)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.syncBlockURLRequests.set(resourceId, true);
|
|
130
|
+
var existingSyncBlock = this.getFromCache(resourceId);
|
|
131
|
+
if (!existingSyncBlock) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
124
134
|
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// we could optimise this further by checking if the sync block is on the same page as the source
|
|
129
|
-
if (!this.syncBlockURLRequests.get(resourceId)) {
|
|
130
|
-
this.syncBlockURLRequests.set(resourceId, true);
|
|
131
|
-
this.dataProvider.retrieveSyncBlockSourceInfo(createSyncBlockNode('', resourceId)).then(function (sourceInfo) {
|
|
132
|
-
var existingSyncBlock = _this.getFromCache(resourceId);
|
|
133
|
-
if (existingSyncBlock && existingSyncBlock.data) {
|
|
134
|
-
existingSyncBlock.data = _objectSpread(_objectSpread({}, existingSyncBlock.data), {}, {
|
|
135
|
-
sourceURL: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url,
|
|
136
|
-
sourceTitle: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title
|
|
137
|
-
});
|
|
138
|
-
_this.updateCache(existingSyncBlock);
|
|
139
|
-
if (sourceInfo !== null && sourceInfo !== void 0 && sourceInfo.title) {
|
|
140
|
-
_this.updateSourceTitleSubscriptions(existingSyncBlock.resourceId, sourceInfo.title);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}).finally(function () {
|
|
144
|
-
_this.syncBlockURLRequests.set(resourceId, false);
|
|
145
|
-
});
|
|
135
|
+
// skip if source URL and title are already present
|
|
136
|
+
if ((_existingSyncBlock$da = existingSyncBlock.data) !== null && _existingSyncBlock$da !== void 0 && _existingSyncBlock$da.sourceURL && (_existingSyncBlock$da2 = existingSyncBlock.data) !== null && _existingSyncBlock$da2 !== void 0 && _existingSyncBlock$da2.sourceTitle) {
|
|
137
|
+
return;
|
|
146
138
|
}
|
|
139
|
+
var _ref = existingSyncBlock.data || {},
|
|
140
|
+
sourceAri = _ref.sourceAri,
|
|
141
|
+
product = _ref.product,
|
|
142
|
+
blockInstanceId = _ref.blockInstanceId;
|
|
143
|
+
if (!sourceAri || !product || !blockInstanceId) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product).then(function (sourceInfo) {
|
|
147
|
+
if (!sourceInfo) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
_this.updateCacheWithSourceInfo(resourceId, sourceInfo);
|
|
151
|
+
if (sourceInfo.title) {
|
|
152
|
+
_this.updateSourceTitleSubscriptions(resourceId, sourceInfo.title);
|
|
153
|
+
}
|
|
154
|
+
}).finally(function () {
|
|
155
|
+
_this.syncBlockURLRequests.delete(resourceId);
|
|
156
|
+
});
|
|
147
157
|
}
|
|
148
158
|
|
|
149
159
|
/**
|
|
@@ -194,7 +204,6 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
194
204
|
case 11:
|
|
195
205
|
resolvedData = [];
|
|
196
206
|
data.forEach(function (syncBlockInstance) {
|
|
197
|
-
var _resolvedSyncBlockIns, _resolvedSyncBlockIns2;
|
|
198
207
|
if (!syncBlockInstance.resourceId) {
|
|
199
208
|
return;
|
|
200
209
|
}
|
|
@@ -207,11 +216,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
207
216
|
var resolvedSyncBlockInstance = existingSyncBlock ? resolveSyncBlockInstance(existingSyncBlock, syncBlockInstance) : syncBlockInstance;
|
|
208
217
|
_this2.updateCache(resolvedSyncBlockInstance);
|
|
209
218
|
resolvedData.push(resolvedSyncBlockInstance);
|
|
210
|
-
|
|
211
|
-
// fetch source URL and title if not already present
|
|
212
|
-
if ((!((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) !== null && _resolvedSyncBlockIns !== void 0 && _resolvedSyncBlockIns.sourceURL) || !((_resolvedSyncBlockIns2 = resolvedSyncBlockInstance.data) !== null && _resolvedSyncBlockIns2 !== void 0 && _resolvedSyncBlockIns2.sourceTitle)) && resolvedSyncBlockInstance.resourceId) {
|
|
213
|
-
_this2.retrieveSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
214
|
-
}
|
|
219
|
+
_this2.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
215
220
|
});
|
|
216
221
|
return _context3.abrupt("return", [].concat(resolvedData, blocksWithNotFoundError));
|
|
217
222
|
case 14:
|
|
@@ -225,6 +230,19 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
225
230
|
}
|
|
226
231
|
return fetchSyncBlocksData;
|
|
227
232
|
}())
|
|
233
|
+
}, {
|
|
234
|
+
key: "updateCacheWithSourceInfo",
|
|
235
|
+
value: function updateCacheWithSourceInfo(resourceId, sourceInfo) {
|
|
236
|
+
var existingSyncBlock = this.getFromCache(resourceId);
|
|
237
|
+
if (existingSyncBlock && existingSyncBlock.data) {
|
|
238
|
+
existingSyncBlock.data.sourceURL = sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url;
|
|
239
|
+
existingSyncBlock.data = _objectSpread(_objectSpread({}, existingSyncBlock.data), {}, {
|
|
240
|
+
sourceURL: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.url,
|
|
241
|
+
sourceTitle: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.title
|
|
242
|
+
});
|
|
243
|
+
this.updateCache(existingSyncBlock);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
228
246
|
}, {
|
|
229
247
|
key: "updateCache",
|
|
230
248
|
value: function updateCache(syncBlock) {
|
|
@@ -380,6 +398,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
380
398
|
}, {
|
|
381
399
|
key: "retrieveDynamicProviders",
|
|
382
400
|
value: function retrieveDynamicProviders(resourceId, providerFactory, providerCreator) {
|
|
401
|
+
var _syncBlock$data2, _syncBlock$data3, _syncBlock$data4, _syncBlock$data5;
|
|
383
402
|
if (!this.dataProvider) {
|
|
384
403
|
return;
|
|
385
404
|
}
|
|
@@ -388,7 +407,11 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
388
407
|
if (hasMediaProvider && hasEmojiProvider) {
|
|
389
408
|
return;
|
|
390
409
|
}
|
|
391
|
-
var
|
|
410
|
+
var syncBlock = this.getFromCache(resourceId);
|
|
411
|
+
if (!syncBlock || !((_syncBlock$data2 = syncBlock.data) !== null && _syncBlock$data2 !== void 0 && _syncBlock$data2.sourceAri) || !((_syncBlock$data3 = syncBlock.data) !== null && _syncBlock$data3 !== void 0 && _syncBlock$data3.product)) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
var parentInfo = this.dataProvider.retrieveSyncBlockParentInfo((_syncBlock$data4 = syncBlock.data) === null || _syncBlock$data4 === void 0 ? void 0 : _syncBlock$data4.sourceAri, (_syncBlock$data5 = syncBlock.data) === null || _syncBlock$data5 === void 0 ? void 0 : _syncBlock$data5.product);
|
|
392
415
|
if (!parentInfo) {
|
|
393
416
|
return;
|
|
394
417
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SyncBlockSourceInfo } from '../../providers/types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { rebaseTransaction } from './common/rebase-transaction';
|
|
2
2
|
export { SyncBlockError } from './common/types';
|
|
3
|
-
export type { SyncBlockData, SyncBlockNode } from './common/types';
|
|
3
|
+
export type { SyncBlockData, SyncBlockNode, SyncBlockProduct, BlockInstanceId, } from './common/types';
|
|
4
4
|
export { useFetchSyncBlockData, type UseFetchSyncBlockDataResult, } from './hooks/useFetchSyncBlockData';
|
|
5
5
|
export { useFetchSyncBlockTitle } from './hooks/useFetchSyncBlockTitle';
|
|
6
6
|
export { useHandleContentChanges } from './hooks/useHandleContentChanges';
|
|
@@ -8,7 +8,7 @@ export { blockResourceIdFromSourceAndLocalId, getLocalIdFromBlockResourceId, } f
|
|
|
8
8
|
export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId, } from './clients/confluence/ari';
|
|
9
9
|
export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
|
|
10
10
|
export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders, } from './providers/confluence/confluenceContentAPI';
|
|
11
|
-
export {
|
|
11
|
+
export { fetchConfluencePageInfo } from './clients/confluence/sourceInfo';
|
|
12
12
|
export { SyncBlockProvider as SyncedBlockProvider, useMemoizedSyncedBlockProvider, } from './providers/syncBlockProvider';
|
|
13
13
|
export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlockInstance, MediaEmojiProviderOptions, SyncedBlockRendererProviderOptions, SyncBlockRendererProviderCreator, } from './providers/types';
|
|
14
14
|
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
5
5
|
*/
|
|
6
6
|
declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
7
7
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
8
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId, pageARI: string): SourceInfoFetchData;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Content API providers
|
|
5
5
|
*/
|
|
@@ -14,7 +14,6 @@ declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
|
|
|
14
14
|
private config;
|
|
15
15
|
constructor(config: ContentAPIConfig);
|
|
16
16
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
17
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId): SourceInfoFetchData;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* ADFWriteProvider implementation that writes synced block data to Confluence Content API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
|
-
import { type SyncBlockData, type SyncBlockNode } from '../common/types';
|
|
2
|
+
import { type BlockInstanceId, type ResourceId, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
3
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
4
4
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
5
5
|
name: string;
|
|
@@ -57,7 +57,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
57
57
|
*
|
|
58
58
|
* @returns Array of {resourceId?: string, error?: string}.
|
|
59
59
|
*/
|
|
60
|
-
deleteNodesData(resourceIds:
|
|
60
|
+
deleteNodesData(resourceIds: ResourceId[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
61
61
|
/**
|
|
62
62
|
* Get the source id
|
|
63
63
|
*
|
|
@@ -65,14 +65,16 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
65
65
|
*/
|
|
66
66
|
getSourceId(): string;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Fetch the source info from the source id
|
|
69
69
|
*
|
|
70
|
-
* @param
|
|
70
|
+
* @param params
|
|
71
|
+
* @param params.sourceAri - The source ARI
|
|
72
|
+
* @param params.sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
71
73
|
*
|
|
72
74
|
* @returns The source info
|
|
73
75
|
*/
|
|
74
|
-
|
|
75
|
-
generateResourceId(sourceId: string, localId:
|
|
76
|
+
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
77
|
+
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
76
78
|
/**
|
|
77
79
|
* Get the synced block renderer provider options
|
|
78
80
|
*
|
|
@@ -82,11 +84,11 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
82
84
|
/**
|
|
83
85
|
* Retrieve the parent info for the sync block
|
|
84
86
|
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
+
* @param sourceAri - The source ARI
|
|
88
|
+
* @param sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
87
89
|
*
|
|
88
90
|
* @returns The parent info for the sync block
|
|
89
91
|
*/
|
|
90
|
-
retrieveSyncBlockParentInfo(
|
|
92
|
+
retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
91
93
|
}
|
|
92
94
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string, providerOptions: SyncedBlockRendererProviderOptions) => SyncBlockProvider;
|
|
@@ -3,7 +3,7 @@ import type { EmojiProvider } from '@atlaskit/emoji';
|
|
|
3
3
|
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
4
4
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
5
5
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
6
|
-
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct } from '../common/types';
|
|
6
|
+
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct, BlockInstanceId } from '../common/types';
|
|
7
7
|
/**
|
|
8
8
|
* The instance of a sync block, containing its data and metadata.
|
|
9
9
|
* Mainly used for representing the state of a sync block after fetching from a data provider.
|
|
@@ -12,11 +12,11 @@ import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBloc
|
|
|
12
12
|
export type SyncBlockInstance = {
|
|
13
13
|
data?: SyncBlockData;
|
|
14
14
|
error?: SyncBlockError;
|
|
15
|
-
resourceId:
|
|
15
|
+
resourceId: ResourceId;
|
|
16
16
|
};
|
|
17
17
|
export type DeleteSyncBlockResult = {
|
|
18
18
|
error?: string;
|
|
19
|
-
resourceId:
|
|
19
|
+
resourceId: ResourceId;
|
|
20
20
|
success: boolean;
|
|
21
21
|
};
|
|
22
22
|
export type SyncBlockSourceInfo = {
|
|
@@ -29,7 +29,7 @@ export type SyncBlockParentInfo = {
|
|
|
29
29
|
};
|
|
30
30
|
export type WriteSyncBlockResult = {
|
|
31
31
|
error?: string;
|
|
32
|
-
resourceId?:
|
|
32
|
+
resourceId?: ResourceId;
|
|
33
33
|
};
|
|
34
34
|
export type SourceInfoFetchData = {
|
|
35
35
|
pageARI: string;
|
|
@@ -37,10 +37,9 @@ export type SourceInfoFetchData = {
|
|
|
37
37
|
};
|
|
38
38
|
export interface ADFFetchProvider {
|
|
39
39
|
fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
|
|
40
|
-
retrieveSourceInfoFetchData: (resourceId: ResourceId, pageAri: string) => SourceInfoFetchData;
|
|
41
40
|
}
|
|
42
41
|
export interface ADFWriteProvider {
|
|
43
|
-
deleteData: (resourceId:
|
|
42
|
+
deleteData: (resourceId: ResourceId) => Promise<DeleteSyncBlockResult>;
|
|
44
43
|
generateResourceId: (sourceId: string, localId: string) => ResourceId;
|
|
45
44
|
writeData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
46
45
|
}
|
|
@@ -65,16 +64,16 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
65
64
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
66
65
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
67
66
|
abstract getSourceId(): ResourceId;
|
|
68
|
-
abstract
|
|
67
|
+
abstract fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
69
68
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
70
|
-
abstract retrieveSyncBlockParentInfo(
|
|
69
|
+
abstract retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
71
70
|
/**
|
|
72
71
|
* Generates a resource ID from a source ID and local ID.
|
|
73
72
|
* @param sourceId - The source document ID (e.g., page ARI)
|
|
74
73
|
* @param localId - The local block ID (usually a UUID)
|
|
75
74
|
* @returns The generated resource ID
|
|
76
75
|
*/
|
|
77
|
-
abstract generateResourceId(sourceId: ResourceId, localId:
|
|
76
|
+
abstract generateResourceId(sourceId: ResourceId, localId: BlockInstanceId): ResourceId;
|
|
78
77
|
}
|
|
79
78
|
export type SubscriptionCallback = (data: SyncBlockInstance) => void;
|
|
80
79
|
export type TitleSubscriptionCallback = (title: string) => void;
|
|
@@ -16,13 +16,14 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
16
16
|
* @returns {Promise<void>}
|
|
17
17
|
*/
|
|
18
18
|
refreshSubscriptions(): Promise<void>;
|
|
19
|
-
private
|
|
19
|
+
private fetchSyncBlockSourceInfo;
|
|
20
20
|
/**
|
|
21
21
|
* Fetch sync block data for a given array of sync block nodes.
|
|
22
22
|
* @param syncBlockNodes - The array of sync block nodes to fetch data for
|
|
23
23
|
* @returns The fetched sync block data results
|
|
24
24
|
*/
|
|
25
25
|
fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
|
|
26
|
+
private updateCacheWithSourceInfo;
|
|
26
27
|
private updateCache;
|
|
27
28
|
private updateSourceTitleSubscriptions;
|
|
28
29
|
private getFromCache;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SyncBlockSourceInfo } from '../../providers/types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const fetchConfluencePageInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { rebaseTransaction } from './common/rebase-transaction';
|
|
2
2
|
export { SyncBlockError } from './common/types';
|
|
3
|
-
export type { SyncBlockData, SyncBlockNode } from './common/types';
|
|
3
|
+
export type { SyncBlockData, SyncBlockNode, SyncBlockProduct, BlockInstanceId, } from './common/types';
|
|
4
4
|
export { useFetchSyncBlockData, type UseFetchSyncBlockDataResult, } from './hooks/useFetchSyncBlockData';
|
|
5
5
|
export { useFetchSyncBlockTitle } from './hooks/useFetchSyncBlockTitle';
|
|
6
6
|
export { useHandleContentChanges } from './hooks/useHandleContentChanges';
|
|
@@ -8,7 +8,7 @@ export { blockResourceIdFromSourceAndLocalId, getLocalIdFromBlockResourceId, } f
|
|
|
8
8
|
export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId, } from './clients/confluence/ari';
|
|
9
9
|
export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
|
|
10
10
|
export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders, } from './providers/confluence/confluenceContentAPI';
|
|
11
|
-
export {
|
|
11
|
+
export { fetchConfluencePageInfo } from './clients/confluence/sourceInfo';
|
|
12
12
|
export { SyncBlockProvider as SyncedBlockProvider, useMemoizedSyncedBlockProvider, } from './providers/syncBlockProvider';
|
|
13
13
|
export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlockInstance, MediaEmojiProviderOptions, SyncedBlockRendererProviderOptions, SyncBlockRendererProviderCreator, } from './providers/types';
|
|
14
14
|
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ADFFetchProvider implementation that fetches synced block data from Block Service API
|
|
5
5
|
*/
|
|
6
6
|
declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
|
|
7
7
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
8
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId, pageARI: string): SourceInfoFetchData;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* ADFWriteProvider implementation that writes synced block data to Block Service API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult,
|
|
1
|
+
import { type SyncBlockData } from '../../common/types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Content API providers
|
|
5
5
|
*/
|
|
@@ -14,7 +14,6 @@ declare class ConfluenceADFFetchProvider implements ADFFetchProvider {
|
|
|
14
14
|
private config;
|
|
15
15
|
constructor(config: ContentAPIConfig);
|
|
16
16
|
fetchData(resourceId: string): Promise<SyncBlockInstance>;
|
|
17
|
-
retrieveSourceInfoFetchData(resourceId: ResourceId): SourceInfoFetchData;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* ADFWriteProvider implementation that writes synced block data to Confluence Content API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
|
-
import { type SyncBlockData, type SyncBlockNode } from '../common/types';
|
|
2
|
+
import { type BlockInstanceId, type ResourceId, type SyncBlockData, type SyncBlockNode, type SyncBlockProduct } from '../common/types';
|
|
3
3
|
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
4
4
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
5
5
|
name: string;
|
|
@@ -57,7 +57,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
57
57
|
*
|
|
58
58
|
* @returns Array of {resourceId?: string, error?: string}.
|
|
59
59
|
*/
|
|
60
|
-
deleteNodesData(resourceIds:
|
|
60
|
+
deleteNodesData(resourceIds: ResourceId[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
61
61
|
/**
|
|
62
62
|
* Get the source id
|
|
63
63
|
*
|
|
@@ -65,14 +65,16 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
65
65
|
*/
|
|
66
66
|
getSourceId(): string;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Fetch the source info from the source id
|
|
69
69
|
*
|
|
70
|
-
* @param
|
|
70
|
+
* @param params
|
|
71
|
+
* @param params.sourceAri - The source ARI
|
|
72
|
+
* @param params.sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
71
73
|
*
|
|
72
74
|
* @returns The source info
|
|
73
75
|
*/
|
|
74
|
-
|
|
75
|
-
generateResourceId(sourceId: string, localId:
|
|
76
|
+
fetchSyncBlockSourceInfo(localId: BlockInstanceId, sourceAri: string, sourceProduct: SyncBlockProduct): Promise<SyncBlockSourceInfo | undefined>;
|
|
77
|
+
generateResourceId(sourceId: string, localId: BlockInstanceId): string;
|
|
76
78
|
/**
|
|
77
79
|
* Get the synced block renderer provider options
|
|
78
80
|
*
|
|
@@ -82,11 +84,11 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
82
84
|
/**
|
|
83
85
|
* Retrieve the parent info for the sync block
|
|
84
86
|
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
+
* @param sourceAri - The source ARI
|
|
88
|
+
* @param sourceProduct - The source product. e.g. 'confluence-page', 'jira-work-item'
|
|
87
89
|
*
|
|
88
90
|
* @returns The parent info for the sync block
|
|
89
91
|
*/
|
|
90
|
-
retrieveSyncBlockParentInfo(
|
|
92
|
+
retrieveSyncBlockParentInfo(sourceAri: string, sourceProduct: SyncBlockProduct): SyncBlockParentInfo | undefined;
|
|
91
93
|
}
|
|
92
94
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string, providerOptions: SyncedBlockRendererProviderOptions) => SyncBlockProvider;
|