@atlaskit/editor-synced-block-provider 3.29.0 → 3.29.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.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/clients/block-service/ari.js +5 -3
- package/dist/cjs/index.js +33 -1
- package/dist/cjs/providers/syncBlockProvider.js +10 -10
- package/dist/cjs/providers/types.js +7 -7
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +102 -35
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/cjs/utils/errorHandling.js +21 -1
- package/dist/cjs/utils/resolveSyncBlockInstance.js +3 -2
- package/dist/cjs/utils/retry.js +2 -1
- package/dist/es2019/clients/block-service/ari.js +5 -3
- package/dist/es2019/index.js +4 -4
- package/dist/es2019/providers/syncBlockProvider.js +4 -4
- package/dist/es2019/providers/types.js +1 -1
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +75 -16
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/es2019/utils/errorHandling.js +21 -1
- package/dist/es2019/utils/resolveSyncBlockInstance.js +3 -2
- package/dist/es2019/utils/retry.js +4 -1
- package/dist/esm/clients/block-service/ari.js +5 -3
- package/dist/esm/index.js +4 -4
- package/dist/esm/providers/syncBlockProvider.js +10 -10
- package/dist/esm/providers/types.js +6 -6
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +101 -35
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/esm/utils/errorHandling.js +20 -0
- package/dist/esm/utils/resolveSyncBlockInstance.js +3 -2
- package/dist/esm/utils/retry.js +2 -1
- package/dist/types/clients/block-service/ari.d.ts +4 -2
- package/dist/types/index.d.ts +6 -4
- package/dist/types/providers/syncBlockProvider.d.ts +4 -4
- package/dist/types/providers/types.d.ts +1 -1
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +5 -2
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +3 -3
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +3 -3
- package/dist/types/utils/errorHandling.d.ts +1 -0
- package/dist/types/utils/resolveSyncBlockInstance.d.ts +3 -2
- package/dist/types-ts4.5/clients/block-service/ari.d.ts +4 -2
- package/dist/types-ts4.5/index.d.ts +6 -4
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +4 -4
- package/dist/types-ts4.5/providers/types.d.ts +1 -1
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +5 -2
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +3 -3
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +3 -3
- package/dist/types-ts4.5/utils/errorHandling.d.ts +1 -0
- package/dist/types-ts4.5/utils/resolveSyncBlockInstance.d.ts +3 -2
- package/package.json +5 -2
|
@@ -5,10 +5,10 @@ import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari
|
|
|
5
5
|
import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
|
|
6
6
|
import { fetchJiraWorkItemInfo } from '../clients/jira/sourceInfo';
|
|
7
7
|
import { SyncBlockError } from '../common/types';
|
|
8
|
-
import {
|
|
9
|
-
export class
|
|
8
|
+
import { SyncBlockDataProviderInterface } from './types';
|
|
9
|
+
export class SyncedBlockProvider extends SyncBlockDataProviderInterface {
|
|
10
10
|
/**
|
|
11
|
-
* Constructor for the
|
|
11
|
+
* Constructor for the SyncedBlockProvider
|
|
12
12
|
*
|
|
13
13
|
* @param fetchProvider
|
|
14
14
|
* @param writeProvider
|
|
@@ -283,7 +283,7 @@ const createSyncedBlockProvider = ({
|
|
|
283
283
|
fetchProvider,
|
|
284
284
|
writeProvider
|
|
285
285
|
}) => {
|
|
286
|
-
return new
|
|
286
|
+
return new SyncedBlockProvider(fetchProvider, writeProvider);
|
|
287
287
|
};
|
|
288
288
|
export const useMemoizedSyncedBlockProvider = ({
|
|
289
289
|
fetchProvider,
|
|
@@ -6,4 +6,4 @@ import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
|
6
6
|
* This will be used in both data processing and rendering contexts.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export class
|
|
9
|
+
export class SyncBlockDataProviderInterface extends NodeDataProvider {}
|
|
@@ -10,6 +10,7 @@ import { getFetchExperience, getFetchSourceInfoExperience, getSaveReferenceExper
|
|
|
10
10
|
import { resolveSyncBlockInstance } from '../utils/resolveSyncBlockInstance';
|
|
11
11
|
import { parseResourceId } from '../utils/resourceId';
|
|
12
12
|
import { createSyncBlockNode } from '../utils/utils';
|
|
13
|
+
const SESSION_STORAGE_KEY_PREFIX = 'sync-block-data-';
|
|
13
14
|
|
|
14
15
|
// A store manager responsible for the lifecycle and state management of reference sync blocks in an editor instance.
|
|
15
16
|
// Designed to manage local in-memory state and synchronize with an external data provider.
|
|
@@ -18,6 +19,7 @@ import { createSyncBlockNode } from '../utils/utils';
|
|
|
18
19
|
// Can be used in both editor and renderer contexts.
|
|
19
20
|
export class ReferenceSyncBlockStoreManager {
|
|
20
21
|
constructor(dataProvider) {
|
|
22
|
+
var _this$dataProvider;
|
|
21
23
|
// Keeps track of addition and deletion of reference synced blocks on the document
|
|
22
24
|
// This starts as true to always flush the cache when document is saved for the first time
|
|
23
25
|
// to cater the case when a editor session is closed without document being updated right after reference block is deleted
|
|
@@ -63,6 +65,9 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
63
65
|
this.graphqlSubscriptions = new Map();
|
|
64
66
|
this.subscriptionChangeListeners = new Set();
|
|
65
67
|
this.newlyAddedSyncBlocks = new Set();
|
|
68
|
+
|
|
69
|
+
// The provider might have SSR data cache already set, so we need to update the cache in session storage
|
|
70
|
+
this.setSSRDataInSessionStorage((_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.getNodeDataCacheKeys());
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
/**
|
|
@@ -173,9 +178,53 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
173
178
|
this.fireAnalyticsEvent = fireAnalyticsEvent;
|
|
174
179
|
}
|
|
175
180
|
getInitialSyncBlockData(resourceId) {
|
|
176
|
-
var _this$
|
|
181
|
+
var _this$dataProvider2, _this$dataProvider2$g;
|
|
177
182
|
const syncBlockNode = createSyncBlockNode('', resourceId);
|
|
178
|
-
|
|
183
|
+
const data = (_this$dataProvider2 = this.dataProvider) === null || _this$dataProvider2 === void 0 ? void 0 : (_this$dataProvider2$g = _this$dataProvider2.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider2$g === void 0 ? void 0 : _this$dataProvider2$g.data;
|
|
184
|
+
if (data) {
|
|
185
|
+
return data;
|
|
186
|
+
}
|
|
187
|
+
if (fg('platform_synced_block_patch_3')) {
|
|
188
|
+
const sessionData = this.getSyncBlockDataFromSessionStorage(resourceId);
|
|
189
|
+
if (sessionData) {
|
|
190
|
+
return sessionData;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
updateCacheInSessionStorage(resourceId) {
|
|
196
|
+
try {
|
|
197
|
+
const latestData = this.getFromCache(resourceId);
|
|
198
|
+
if (latestData) {
|
|
199
|
+
sessionStorage.setItem(`${SESSION_STORAGE_KEY_PREFIX}${resourceId}`, JSON.stringify(latestData));
|
|
200
|
+
}
|
|
201
|
+
} catch (error) {
|
|
202
|
+
logException(error, {
|
|
203
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/updateCacheInSessionStorage'
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
getSyncBlockDataFromSessionStorage(resourceId) {
|
|
208
|
+
let sessionData = null;
|
|
209
|
+
try {
|
|
210
|
+
sessionData = sessionStorage.getItem(`${SESSION_STORAGE_KEY_PREFIX}${resourceId}`);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
logException(error, {
|
|
213
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/getSyncBlockDataFromSessionStorage'
|
|
214
|
+
});
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
if (!sessionData) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
return JSON.parse(sessionData);
|
|
222
|
+
} catch (error) {
|
|
223
|
+
logException(error, {
|
|
224
|
+
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/getSyncBlockDataFromSessionStorage'
|
|
225
|
+
});
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
179
228
|
}
|
|
180
229
|
|
|
181
230
|
/**
|
|
@@ -218,12 +267,12 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
218
267
|
* @param resourceId - The resource ID of the block to subscribe to
|
|
219
268
|
*/
|
|
220
269
|
setupGraphQLSubscription(resourceId) {
|
|
221
|
-
var _this$
|
|
270
|
+
var _this$dataProvider3;
|
|
222
271
|
// Don't set up duplicate subscriptions
|
|
223
272
|
if (this.graphqlSubscriptions.has(resourceId)) {
|
|
224
273
|
return;
|
|
225
274
|
}
|
|
226
|
-
if (!((_this$
|
|
275
|
+
if (!((_this$dataProvider3 = this.dataProvider) !== null && _this$dataProvider3 !== void 0 && _this$dataProvider3.subscribeToBlockUpdates)) {
|
|
227
276
|
return;
|
|
228
277
|
}
|
|
229
278
|
const unsubscribe = this.dataProvider.subscribeToBlockUpdates(resourceId, syncBlockInstance => {
|
|
@@ -585,8 +634,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
585
634
|
resourceId
|
|
586
635
|
} = syncBlock;
|
|
587
636
|
if (resourceId) {
|
|
588
|
-
var _this$
|
|
589
|
-
(_this$
|
|
637
|
+
var _this$dataProvider4;
|
|
638
|
+
(_this$dataProvider4 = this.dataProvider) === null || _this$dataProvider4 === void 0 ? void 0 : _this$dataProvider4.updateCache({
|
|
590
639
|
[resourceId]: syncBlock
|
|
591
640
|
}, {
|
|
592
641
|
strategy: 'merge',
|
|
@@ -598,6 +647,9 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
598
647
|
callback(syncBlock);
|
|
599
648
|
});
|
|
600
649
|
}
|
|
650
|
+
if (fg('platform_synced_block_patch_3')) {
|
|
651
|
+
this.updateCacheInSessionStorage(resourceId);
|
|
652
|
+
}
|
|
601
653
|
}
|
|
602
654
|
}
|
|
603
655
|
updateSourceTitleSubscriptions(resourceId, title) {
|
|
@@ -609,13 +661,13 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
609
661
|
}
|
|
610
662
|
}
|
|
611
663
|
getFromCache(resourceId) {
|
|
612
|
-
var _this$
|
|
664
|
+
var _this$dataProvider5, _this$dataProvider5$g;
|
|
613
665
|
const syncBlockNode = createSyncBlockNode('', resourceId);
|
|
614
|
-
return (_this$
|
|
666
|
+
return (_this$dataProvider5 = this.dataProvider) === null || _this$dataProvider5 === void 0 ? void 0 : (_this$dataProvider5$g = _this$dataProvider5.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider5$g === void 0 ? void 0 : _this$dataProvider5$g.data;
|
|
615
667
|
}
|
|
616
668
|
deleteFromCache(resourceId) {
|
|
617
|
-
var _this$
|
|
618
|
-
(_this$
|
|
669
|
+
var _this$dataProvider6;
|
|
670
|
+
(_this$dataProvider6 = this.dataProvider) === null || _this$dataProvider6 === void 0 ? void 0 : _this$dataProvider6.removeFromCache([resourceId]);
|
|
619
671
|
this.providerFactories.delete(resourceId);
|
|
620
672
|
}
|
|
621
673
|
debouncedBatchedFetchSyncBlocks(resourceId) {
|
|
@@ -632,8 +684,16 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
632
684
|
this.scheduledBatchFetch();
|
|
633
685
|
}
|
|
634
686
|
}
|
|
687
|
+
setSSRDataInSessionStorage(resourceIds) {
|
|
688
|
+
if (!resourceIds || resourceIds.length === 0) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
resourceIds.forEach(resourceId => {
|
|
692
|
+
this.updateCacheInSessionStorage(resourceId);
|
|
693
|
+
});
|
|
694
|
+
}
|
|
635
695
|
subscribeToSyncBlock(resourceId, localId, callback) {
|
|
636
|
-
var _this$
|
|
696
|
+
var _this$dataProvider7, _this$dataProvider7$g;
|
|
637
697
|
// Cancel any pending cache deletion for this resourceId.
|
|
638
698
|
// This handles the case where a block is moved - the old component unmounts
|
|
639
699
|
// (scheduling deletion) but the new component mounts and subscribes before
|
|
@@ -662,7 +722,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
662
722
|
const syncBlockNode = createSyncBlockNode(localId, resourceId);
|
|
663
723
|
|
|
664
724
|
// call the callback immediately if we have cached data
|
|
665
|
-
const cachedData = (_this$
|
|
725
|
+
const cachedData = (_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 ? void 0 : (_this$dataProvider7$g = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7$g === void 0 ? void 0 : _this$dataProvider7$g.data;
|
|
666
726
|
if (cachedData) {
|
|
667
727
|
callback(cachedData);
|
|
668
728
|
} else {
|
|
@@ -883,7 +943,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
883
943
|
}
|
|
884
944
|
const parentInfo = this.dataProvider.retrieveSyncBlockParentInfo((_syncBlock$data2 = syncBlock.data) === null || _syncBlock$data2 === void 0 ? void 0 : _syncBlock$data2.sourceAri, (_syncBlock$data3 = syncBlock.data) === null || _syncBlock$data3 === void 0 ? void 0 : _syncBlock$data3.product);
|
|
885
945
|
if (!parentInfo) {
|
|
886
|
-
throw new Error('Unable to
|
|
946
|
+
throw new Error('Unable to retrieve sync block parent info');
|
|
887
947
|
}
|
|
888
948
|
const {
|
|
889
949
|
contentId,
|
|
@@ -1043,7 +1103,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
1043
1103
|
return success;
|
|
1044
1104
|
}
|
|
1045
1105
|
destroy() {
|
|
1046
|
-
var _this$
|
|
1106
|
+
var _this$dataProvider8, _this$saveExperience5, _this$fetchExperience0, _this$fetchSourceInfo6;
|
|
1047
1107
|
// Cancel any queued flush to prevent it from running after destroy
|
|
1048
1108
|
if (this.queuedFlushTimeout) {
|
|
1049
1109
|
clearTimeout(this.queuedFlushTimeout);
|
|
@@ -1052,7 +1112,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
1052
1112
|
|
|
1053
1113
|
// Clean up all GraphQL subscriptions first
|
|
1054
1114
|
this.cleanupAllGraphQLSubscriptions();
|
|
1055
|
-
(_this$
|
|
1115
|
+
(_this$dataProvider8 = this.dataProvider) === null || _this$dataProvider8 === void 0 ? void 0 : _this$dataProvider8.resetCache();
|
|
1056
1116
|
this.scheduledBatchFetch.cancel();
|
|
1057
1117
|
this.pendingFetchRequests.clear();
|
|
1058
1118
|
this.dataProvider = undefined;
|
|
@@ -1060,7 +1120,6 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
1060
1120
|
this.titleSubscriptions.clear();
|
|
1061
1121
|
this.syncBlockFetchDataRequests.clear();
|
|
1062
1122
|
this.syncBlockSourceInfoRequests.clear();
|
|
1063
|
-
this.providerFactories.clear();
|
|
1064
1123
|
this.isRefreshingSubscriptions = false;
|
|
1065
1124
|
this.useRealTimeSubscriptions = false;
|
|
1066
1125
|
this.subscriptionChangeListeners.clear();
|
|
@@ -204,7 +204,7 @@ export class SourceSyncBlockStoreManager {
|
|
|
204
204
|
* Create a bodiedSyncBlock node with empty content to backend
|
|
205
205
|
* @param attrs attributes Ids of the node
|
|
206
206
|
*/
|
|
207
|
-
createBodiedSyncBlockNode(attrs, onCompletion
|
|
207
|
+
createBodiedSyncBlockNode(attrs, onCompletion) {
|
|
208
208
|
const {
|
|
209
209
|
resourceId,
|
|
210
210
|
localId: blockInstanceId
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
export const stringifyError = error => {
|
|
3
4
|
try {
|
|
4
5
|
return JSON.stringify(error);
|
|
@@ -41,7 +42,26 @@ export const fetchSuccessPayload = (resourceId, blockInstanceId, sourceProduct)
|
|
|
41
42
|
})
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
|
-
export const createSuccessPayload = resourceId =>
|
|
45
|
+
export const createSuccessPayload = resourceId => {
|
|
46
|
+
return fg('platform_synced_block_patch_3') ? {
|
|
47
|
+
action: ACTION.INSERTED,
|
|
48
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
49
|
+
actionSubjectId: ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK,
|
|
50
|
+
eventType: EVENT_TYPE.TRACK,
|
|
51
|
+
attributes: {
|
|
52
|
+
resourceId
|
|
53
|
+
}
|
|
54
|
+
} : {
|
|
55
|
+
action: ACTION.INSERTED,
|
|
56
|
+
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
57
|
+
actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
58
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
59
|
+
attributes: {
|
|
60
|
+
resourceId
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export const createSuccessPayloadNew = resourceId => ({
|
|
45
65
|
action: ACTION.INSERTED,
|
|
46
66
|
actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
|
|
47
67
|
actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SyncBlockError } from '../common/types';
|
|
2
2
|
/**
|
|
3
3
|
* Merges two SyncBlockInstance objects,
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* preserving sourceURL, sourceTitle, sourceSubType, and onSameDocument from the old result
|
|
5
|
+
* when the new result does not have them.
|
|
6
|
+
* This can be extended in the future to resolve other conflicts as needed,
|
|
6
7
|
* e.g. compare timestamps or version numbers to determine which data is more recent.
|
|
7
8
|
*
|
|
8
9
|
* @param oldResult - The existing SyncBlockInstance object.
|
|
@@ -21,6 +21,9 @@ export const fetchWithRetry = async (url, options, retriesRemaining = 3, delay =
|
|
|
21
21
|
return response;
|
|
22
22
|
}
|
|
23
23
|
const retryAfter = response.headers.get('Retry-After');
|
|
24
|
-
await new Promise(resolve =>
|
|
24
|
+
await new Promise(resolve => {
|
|
25
|
+
var _ref;
|
|
26
|
+
return setTimeout(resolve, (_ref = retryAfter ? parseRetryAfter(retryAfter) : undefined) !== null && _ref !== void 0 ? _ref : delay);
|
|
27
|
+
});
|
|
25
28
|
return fetchWithRetry(url, options, retriesRemaining - 1, delay * 2);
|
|
26
29
|
};
|
|
@@ -29,8 +29,10 @@ export var generateBlockAriFromReference = function generateBlockAriFromReferenc
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Extracts the local ID from a block ARI.
|
|
33
|
-
*
|
|
32
|
+
* Extracts the local ID from a source block ARI.
|
|
33
|
+
* Designed for source block ARIs of the form: ari:cloud:blocks:{cloudId}:synced-block/{localId}
|
|
34
|
+
* where the localId is a UUID immediately after synced-block/.
|
|
35
|
+
* @param ari - the source block ARI. E.G ari:cloud:blocks:cloudId:synced-block/79d4f3f4-51df-451b-b9a1-751bc77b1e77
|
|
34
36
|
* @returns the localId of the block node. A randomly generated UUID
|
|
35
37
|
*/
|
|
36
38
|
export var getLocalIdFromBlockResourceId = function getLocalIdFromBlockResourceId(ari) {
|
|
@@ -38,7 +40,7 @@ export var getLocalIdFromBlockResourceId = function getLocalIdFromBlockResourceI
|
|
|
38
40
|
if (match !== null && match !== void 0 && match[1]) {
|
|
39
41
|
return match[1];
|
|
40
42
|
}
|
|
41
|
-
throw new Error("Invalid
|
|
43
|
+
throw new Error("Invalid block ARI: ".concat(ari));
|
|
42
44
|
};
|
|
43
45
|
export var getProductFromSourceAri = function getProductFromSourceAri(ari) {
|
|
44
46
|
var jiraMatch = ari === null || ari === void 0 ? void 0 : ari.search(/ari:cloud:jira:.*/);
|
package/dist/esm/index.js
CHANGED
|
@@ -10,17 +10,17 @@ export { useHandleContentChanges } from './hooks/useHandleContentChanges';
|
|
|
10
10
|
|
|
11
11
|
// clients
|
|
12
12
|
export { generateBlockAri, generateBlockAriFromReference, getLocalIdFromBlockResourceId } from './clients/block-service/ari';
|
|
13
|
+
export { BlockError } from './clients/block-service/blockService';
|
|
13
14
|
export { getConfluencePageAri, getPageIdAndTypeFromConfluencePageAri } from './clients/confluence/ari';
|
|
14
15
|
export { fetchMediaToken } from './clients/confluence/fetchMediaToken';
|
|
15
16
|
export { getJiraWorkItemAri, getJiraWorkItemIdFromAri } from './clients/jira/ari';
|
|
16
17
|
|
|
17
18
|
// providers
|
|
18
|
-
export { useMemoizedBlockServiceAPIProviders, useMemoizedBlockServiceFetchOnlyAPIProvider, fetchReferences, batchFetchData } from './providers/block-service/blockServiceAPI';
|
|
19
|
+
export { useMemoizedBlockServiceAPIProviders, useMemoizedBlockServiceFetchOnlyAPIProvider, fetchReferences, batchFetchData, blockAriToResourceId, convertToSyncBlockData, extractResourceIdFromBlockAri } from './providers/block-service/blockServiceAPI';
|
|
19
20
|
export { fetchConfluencePageInfo } from './clients/confluence/sourceInfo';
|
|
20
|
-
export {
|
|
21
|
-
|
|
21
|
+
export { SyncedBlockProvider, useMemoizedSyncedBlockProvider } from './providers/syncBlockProvider';
|
|
22
22
|
// store managers
|
|
23
|
-
|
|
23
|
+
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
24
24
|
export { SyncBlockStoreManager, useMemoizedSyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
|
|
25
25
|
|
|
26
26
|
// utils
|
|
@@ -16,27 +16,27 @@ import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari
|
|
|
16
16
|
import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
|
|
17
17
|
import { fetchJiraWorkItemInfo } from '../clients/jira/sourceInfo';
|
|
18
18
|
import { SyncBlockError } from '../common/types';
|
|
19
|
-
import {
|
|
20
|
-
export var
|
|
19
|
+
import { SyncBlockDataProviderInterface } from './types';
|
|
20
|
+
export var SyncedBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
21
21
|
/**
|
|
22
|
-
* Constructor for the
|
|
22
|
+
* Constructor for the SyncedBlockProvider
|
|
23
23
|
*
|
|
24
24
|
* @param fetchProvider
|
|
25
25
|
* @param writeProvider
|
|
26
26
|
* @param nestedRendererDataProviders
|
|
27
27
|
*/
|
|
28
|
-
function
|
|
28
|
+
function SyncedBlockProvider(fetchProvider, writeProvider) {
|
|
29
29
|
var _this;
|
|
30
|
-
_classCallCheck(this,
|
|
31
|
-
_this = _callSuper(this,
|
|
30
|
+
_classCallCheck(this, SyncedBlockProvider);
|
|
31
|
+
_this = _callSuper(this, SyncedBlockProvider);
|
|
32
32
|
_defineProperty(_this, "name", 'syncBlockProvider');
|
|
33
33
|
_this.fetchProvider = fetchProvider;
|
|
34
34
|
_this.writeProvider = writeProvider;
|
|
35
35
|
_this.providerOptions = {};
|
|
36
36
|
return _this;
|
|
37
37
|
}
|
|
38
|
-
_inherits(
|
|
39
|
-
return _createClass(
|
|
38
|
+
_inherits(SyncedBlockProvider, _SyncBlockDataProvide);
|
|
39
|
+
return _createClass(SyncedBlockProvider, [{
|
|
40
40
|
key: "setProviderOptions",
|
|
41
41
|
value: function setProviderOptions(providerOptions) {
|
|
42
42
|
this.providerOptions = providerOptions;
|
|
@@ -434,11 +434,11 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
|
|
|
434
434
|
return undefined;
|
|
435
435
|
}
|
|
436
436
|
}]);
|
|
437
|
-
}(
|
|
437
|
+
}(SyncBlockDataProviderInterface);
|
|
438
438
|
var createSyncedBlockProvider = function createSyncedBlockProvider(_ref) {
|
|
439
439
|
var fetchProvider = _ref.fetchProvider,
|
|
440
440
|
writeProvider = _ref.writeProvider;
|
|
441
|
-
return new
|
|
441
|
+
return new SyncedBlockProvider(fetchProvider, writeProvider);
|
|
442
442
|
};
|
|
443
443
|
export var useMemoizedSyncedBlockProvider = function useMemoizedSyncedBlockProvider(_ref2) {
|
|
444
444
|
var fetchProvider = _ref2.fetchProvider,
|
|
@@ -13,11 +13,11 @@ import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
|
13
13
|
* This will be used in both data processing and rendering contexts.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export var
|
|
17
|
-
function
|
|
18
|
-
_classCallCheck(this,
|
|
19
|
-
return _callSuper(this,
|
|
16
|
+
export var SyncBlockDataProviderInterface = /*#__PURE__*/function (_NodeDataProvider) {
|
|
17
|
+
function SyncBlockDataProviderInterface() {
|
|
18
|
+
_classCallCheck(this, SyncBlockDataProviderInterface);
|
|
19
|
+
return _callSuper(this, SyncBlockDataProviderInterface, arguments);
|
|
20
20
|
}
|
|
21
|
-
_inherits(
|
|
22
|
-
return _createClass(
|
|
21
|
+
_inherits(SyncBlockDataProviderInterface, _NodeDataProvider);
|
|
22
|
+
return _createClass(SyncBlockDataProviderInterface);
|
|
23
23
|
}(NodeDataProvider);
|