@atlaskit/editor-synced-block-provider 3.31.2 → 3.31.3
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 +7 -0
- package/dist/cjs/clients/block-service/blockService.js +20 -21
- package/dist/cjs/clients/confluence/fetchMediaToken.js +1 -2
- package/dist/cjs/clients/confluence/sourceInfo.js +27 -176
- package/dist/cjs/hooks/useFetchSyncBlockData.js +2 -9
- package/dist/cjs/hooks/useFetchSyncBlockTitle.js +8 -40
- package/dist/cjs/providers/block-service/blockServiceAPI.js +11 -27
- package/dist/cjs/providers/syncBlockProvider.js +22 -51
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +14 -29
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/cjs/store-manager/syncBlockStoreManager.js +3 -15
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +2 -2
- package/dist/cjs/utils/errorHandling.js +1 -10
- package/dist/cjs/utils/resolveSyncBlockInstance.js +11 -12
- package/dist/cjs/utils/retry.js +2 -23
- package/dist/es2019/clients/block-service/blockService.js +20 -21
- package/dist/es2019/clients/confluence/fetchMediaToken.js +1 -2
- package/dist/es2019/clients/confluence/sourceInfo.js +8 -126
- package/dist/es2019/hooks/useFetchSyncBlockData.js +1 -9
- package/dist/es2019/hooks/useFetchSyncBlockTitle.js +4 -33
- package/dist/es2019/providers/block-service/blockServiceAPI.js +11 -27
- package/dist/es2019/providers/syncBlockProvider.js +7 -29
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +27 -41
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/es2019/store-manager/syncBlockStoreManager.js +3 -13
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +2 -2
- package/dist/es2019/utils/errorHandling.js +1 -10
- package/dist/es2019/utils/resolveSyncBlockInstance.js +11 -12
- package/dist/es2019/utils/retry.js +2 -21
- package/dist/esm/clients/block-service/blockService.js +20 -21
- package/dist/esm/clients/confluence/fetchMediaToken.js +1 -2
- package/dist/esm/clients/confluence/sourceInfo.js +25 -176
- package/dist/esm/hooks/useFetchSyncBlockData.js +2 -9
- package/dist/esm/hooks/useFetchSyncBlockTitle.js +8 -40
- package/dist/esm/providers/block-service/blockServiceAPI.js +11 -27
- package/dist/esm/providers/syncBlockProvider.js +22 -51
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +14 -29
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +1 -1
- package/dist/esm/store-manager/syncBlockStoreManager.js +3 -15
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +2 -2
- package/dist/esm/utils/errorHandling.js +1 -10
- package/dist/esm/utils/resolveSyncBlockInstance.js +11 -12
- package/dist/esm/utils/retry.js +2 -23
- package/dist/types/clients/confluence/sourceInfo.d.ts +1 -3
- package/dist/types/providers/syncBlockProvider.d.ts +2 -3
- package/dist/types/providers/types.d.ts +1 -2
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +1 -1
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -3
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +2 -3
- package/dist/types-ts4.5/providers/types.d.ts +1 -2
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +1 -1
- package/package.json +3 -10
|
@@ -326,10 +326,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
326
326
|
*/
|
|
327
327
|
handleGraphQLSubscriptionUpdate(syncBlockInstance) {
|
|
328
328
|
if (!syncBlockInstance.resourceId) {
|
|
329
|
-
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
throw new Error('Sync block instance provided to graphql subscription update missing resource id');
|
|
329
|
+
return;
|
|
333
330
|
}
|
|
334
331
|
const existingSyncBlock = this.getFromCache(syncBlockInstance.resourceId);
|
|
335
332
|
const resolvedSyncBlockInstance = existingSyncBlock ? resolveSyncBlockInstance(existingSyncBlock, syncBlockInstance) : syncBlockInstance;
|
|
@@ -343,8 +340,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
343
340
|
});
|
|
344
341
|
this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
345
342
|
} else {
|
|
346
|
-
var _syncBlockInstance$er, _syncBlockInstance$er2,
|
|
347
|
-
const errorMessage =
|
|
343
|
+
var _syncBlockInstance$er, _syncBlockInstance$er2, _this$fireAnalyticsEv6;
|
|
344
|
+
const errorMessage = ((_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.reason) || ((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type);
|
|
348
345
|
(_this$fireAnalyticsEv6 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv6 === void 0 ? void 0 : _this$fireAnalyticsEv6.call(this, fetchErrorPayload(errorMessage, syncBlockInstance.resourceId));
|
|
349
346
|
}
|
|
350
347
|
}
|
|
@@ -391,12 +388,12 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
391
388
|
}
|
|
392
389
|
this.graphqlSubscriptions.clear();
|
|
393
390
|
}
|
|
394
|
-
fetchSyncBlockSourceInfoBySourceAri(sourceAri, hasAccess = true
|
|
391
|
+
fetchSyncBlockSourceInfoBySourceAri(sourceAri, hasAccess = true) {
|
|
395
392
|
try {
|
|
396
393
|
if (!this.dataProvider) {
|
|
397
394
|
throw new Error('Data provider not set');
|
|
398
395
|
}
|
|
399
|
-
const sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined,
|
|
396
|
+
const sourceInfo = this.dataProvider.fetchSyncBlockSourceInfo(undefined, sourceAri, undefined, hasAccess);
|
|
400
397
|
return sourceInfo;
|
|
401
398
|
} catch (error) {
|
|
402
399
|
var _this$fireAnalyticsEv7;
|
|
@@ -409,7 +406,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
409
406
|
}
|
|
410
407
|
fetchSyncBlockSourceInfo(resourceId) {
|
|
411
408
|
try {
|
|
412
|
-
var _this$fetchSourceInfo
|
|
409
|
+
var _this$fetchSourceInfo;
|
|
413
410
|
if (!resourceId || !this.dataProvider) {
|
|
414
411
|
throw new Error('Data provider or resourceId not set');
|
|
415
412
|
}
|
|
@@ -447,12 +444,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
447
444
|
return Promise.resolve(undefined);
|
|
448
445
|
}
|
|
449
446
|
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start({});
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
// hasAccess
|
|
453
|
-
'edit',
|
|
454
|
-
// urlType
|
|
455
|
-
isUnpublished).then(sourceInfo => {
|
|
447
|
+
const sourceInfoPromise = this.dataProvider.fetchSyncBlockSourceInfo(blockInstanceId, sourceAri, product, true // hasAccess
|
|
448
|
+
).then(sourceInfo => {
|
|
456
449
|
if (!sourceInfo) {
|
|
457
450
|
var _this$fetchSourceInfo2, _this$fireAnalyticsEv9;
|
|
458
451
|
(_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
|
|
@@ -619,8 +612,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
619
612
|
data.forEach(syncBlockInstance => {
|
|
620
613
|
var _resolvedSyncBlockIns;
|
|
621
614
|
if (!syncBlockInstance.resourceId) {
|
|
622
|
-
var _syncBlockInstance$
|
|
623
|
-
const payload =
|
|
615
|
+
var _syncBlockInstance$er3, _syncBlockInstance$er4, _this$fireAnalyticsEv11;
|
|
616
|
+
const payload = ((_syncBlockInstance$er3 = syncBlockInstance.error) === null || _syncBlockInstance$er3 === void 0 ? void 0 : _syncBlockInstance$er3.reason) || ((_syncBlockInstance$er4 = syncBlockInstance.error) === null || _syncBlockInstance$er4 === void 0 ? void 0 : _syncBlockInstance$er4.type) || 'Returned sync block instance does not have resource id';
|
|
624
617
|
(_this$fireAnalyticsEv11 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv11 === void 0 ? void 0 : _this$fireAnalyticsEv11.call(this, fetchErrorPayload(payload));
|
|
625
618
|
return;
|
|
626
619
|
}
|
|
@@ -639,13 +632,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
639
632
|
this.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
|
|
640
633
|
}
|
|
641
634
|
if (syncBlockInstance.error) {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
(_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId));
|
|
645
|
-
} else {
|
|
646
|
-
var _this$fireAnalyticsEv13;
|
|
647
|
-
(_this$fireAnalyticsEv13 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv13 === void 0 ? void 0 : _this$fireAnalyticsEv13.call(this, fetchErrorPayload(syncBlockInstance.error.type, syncBlockInstance.resourceId));
|
|
648
|
-
}
|
|
635
|
+
var _this$fireAnalyticsEv12;
|
|
636
|
+
(_this$fireAnalyticsEv12 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv12 === void 0 ? void 0 : _this$fireAnalyticsEv12.call(this, fetchErrorPayload(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId));
|
|
649
637
|
if (syncBlockInstance.error.type === SyncBlockError.NotFound || syncBlockInstance.error.type === SyncBlockError.Forbidden) {
|
|
650
638
|
hasExpectedError = true;
|
|
651
639
|
} else if (syncBlockInstance.error) {
|
|
@@ -656,8 +644,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
656
644
|
const callbacks = this.subscriptions.get(syncBlockInstance.resourceId);
|
|
657
645
|
const localIds = callbacks ? Object.keys(callbacks) : [];
|
|
658
646
|
localIds.forEach(localId => {
|
|
659
|
-
var _this$
|
|
660
|
-
(_this$
|
|
647
|
+
var _this$fireAnalyticsEv13, _syncBlockInstance$da2;
|
|
648
|
+
(_this$fireAnalyticsEv13 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv13 === void 0 ? void 0 : _this$fireAnalyticsEv13.call(this, fetchSuccessPayload(syncBlockInstance.resourceId, localId, (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product));
|
|
661
649
|
});
|
|
662
650
|
this.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
663
651
|
});
|
|
@@ -698,9 +686,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
698
686
|
callback(syncBlock);
|
|
699
687
|
});
|
|
700
688
|
}
|
|
701
|
-
|
|
702
|
-
this.updateSessionCache(resourceId);
|
|
703
|
-
}
|
|
689
|
+
this.updateSessionCache(resourceId);
|
|
704
690
|
}
|
|
705
691
|
}
|
|
706
692
|
updateSourceTitleSubscriptions(resourceId, title) {
|
|
@@ -871,11 +857,11 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
871
857
|
}
|
|
872
858
|
return this.subscribeToSyncBlock(resourceId, localId, callback);
|
|
873
859
|
} catch (error) {
|
|
874
|
-
var _this$
|
|
860
|
+
var _this$fireAnalyticsEv14;
|
|
875
861
|
logException(error, {
|
|
876
862
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
877
863
|
});
|
|
878
|
-
(_this$
|
|
864
|
+
(_this$fireAnalyticsEv14 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv14 === void 0 ? void 0 : _this$fireAnalyticsEv14.call(this, fetchErrorPayload(error.message));
|
|
879
865
|
return () => {};
|
|
880
866
|
}
|
|
881
867
|
}
|
|
@@ -898,12 +884,12 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
898
884
|
return this._providerFactoryManager.getProviderFactory(resourceId);
|
|
899
885
|
}
|
|
900
886
|
if (!this.dataProvider) {
|
|
901
|
-
var _this$
|
|
887
|
+
var _this$fireAnalyticsEv15;
|
|
902
888
|
const error = new Error('Data provider not set');
|
|
903
889
|
logException(error, {
|
|
904
890
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
905
891
|
});
|
|
906
|
-
(_this$
|
|
892
|
+
(_this$fireAnalyticsEv15 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv15 === void 0 ? void 0 : _this$fireAnalyticsEv15.call(this, fetchErrorPayload(error.message));
|
|
907
893
|
return undefined;
|
|
908
894
|
}
|
|
909
895
|
const {
|
|
@@ -933,11 +919,11 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
933
919
|
try {
|
|
934
920
|
this.retrieveDynamicProviders(resourceId, providerFactory, providerCreator);
|
|
935
921
|
} catch (error) {
|
|
936
|
-
var _this$
|
|
922
|
+
var _this$fireAnalyticsEv16;
|
|
937
923
|
logException(error, {
|
|
938
924
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
939
925
|
});
|
|
940
|
-
(_this$
|
|
926
|
+
(_this$fireAnalyticsEv16 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv16 === void 0 ? void 0 : _this$fireAnalyticsEv16.call(this, fetchErrorPayload(error.message, resourceId));
|
|
941
927
|
}
|
|
942
928
|
}
|
|
943
929
|
return providerFactory;
|
|
@@ -996,8 +982,8 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
996
982
|
return;
|
|
997
983
|
}
|
|
998
984
|
if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
|
|
999
|
-
var _this$
|
|
1000
|
-
(_this$
|
|
985
|
+
var _this$fireAnalyticsEv17;
|
|
986
|
+
(_this$fireAnalyticsEv17 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv17 === void 0 ? void 0 : _this$fireAnalyticsEv17.call(this, fetchErrorPayload('Sync block source ari or product not found'));
|
|
1001
987
|
return;
|
|
1002
988
|
}
|
|
1003
989
|
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);
|
|
@@ -1102,15 +1088,15 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
1102
1088
|
(_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 ? void 0 : _this$saveExperience.start();
|
|
1103
1089
|
const updateResult = await this.dataProvider.updateReferenceData(blocks);
|
|
1104
1090
|
if (!updateResult.success) {
|
|
1105
|
-
var _this$saveExperience2, _this$
|
|
1091
|
+
var _this$saveExperience2, _this$fireAnalyticsEv18;
|
|
1106
1092
|
success = false;
|
|
1107
1093
|
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 ? void 0 : _this$saveExperience2.failure({
|
|
1108
1094
|
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
1109
1095
|
});
|
|
1110
|
-
(_this$
|
|
1096
|
+
(_this$fireAnalyticsEv18 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv18 === void 0 ? void 0 : _this$fireAnalyticsEv18.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document'));
|
|
1111
1097
|
}
|
|
1112
1098
|
} catch (error) {
|
|
1113
|
-
var _this$saveExperience3, _this$
|
|
1099
|
+
var _this$saveExperience3, _this$fireAnalyticsEv19;
|
|
1114
1100
|
success = false;
|
|
1115
1101
|
logException(error, {
|
|
1116
1102
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
@@ -1118,7 +1104,7 @@ export class ReferenceSyncBlockStoreManager {
|
|
|
1118
1104
|
(_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 ? void 0 : _this$saveExperience3.failure({
|
|
1119
1105
|
reason: error.message
|
|
1120
1106
|
});
|
|
1121
|
-
(_this$
|
|
1107
|
+
(_this$fireAnalyticsEv19 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv19 === void 0 ? void 0 : _this$fireAnalyticsEv19.call(this, updateReferenceErrorPayload(error.message));
|
|
1122
1108
|
} finally {
|
|
1123
1109
|
if (!success) {
|
|
1124
1110
|
// set isCacheDirty back to true for cases where it failed to update the reference synced blocks on the BE
|
|
@@ -382,7 +382,7 @@ export class SourceSyncBlockStoreManager {
|
|
|
382
382
|
throw new Error('Data provider not set');
|
|
383
383
|
}
|
|
384
384
|
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start();
|
|
385
|
-
return this.dataProvider.fetchSyncBlockSourceInfo(localId, undefined, undefined
|
|
385
|
+
return this.dataProvider.fetchSyncBlockSourceInfo(localId, undefined, undefined).then(sourceInfo => {
|
|
386
386
|
if (!sourceInfo) {
|
|
387
387
|
var _this$fetchSourceInfo2;
|
|
388
388
|
(_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useMemo, useRef } from 'react';
|
|
2
2
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
5
3
|
import { getProductFromSourceAri } from '../clients/block-service/ari';
|
|
6
4
|
import { SyncBlockError } from '../common/types';
|
|
7
5
|
import { fetchReferencesErrorPayload } from '../utils/errorHandling';
|
|
@@ -61,7 +59,7 @@ export class SyncBlockStoreManager {
|
|
|
61
59
|
const sourceInfoPromises = response.references.map(async reference => {
|
|
62
60
|
var _this$fetchSourceInfo, _this$dataProvider, _this$fetchSourceInfo3;
|
|
63
61
|
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 ? void 0 : _this$fetchSourceInfo.start();
|
|
64
|
-
const sourceInfo = await ((_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.fetchSyncBlockSourceInfo(reference.blockInstanceId || '', reference.documentAri, getProductFromSourceAri(reference.documentAri),
|
|
62
|
+
const sourceInfo = await ((_this$dataProvider = this.dataProvider) === null || _this$dataProvider === void 0 ? void 0 : _this$dataProvider.fetchSyncBlockSourceInfo(reference.blockInstanceId || '', reference.documentAri, getProductFromSourceAri(reference.documentAri), reference.hasAccess));
|
|
65
63
|
if (!sourceInfo) {
|
|
66
64
|
var _this$fetchSourceInfo2;
|
|
67
65
|
(_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
|
|
@@ -130,14 +128,7 @@ export class SyncBlockStoreManager {
|
|
|
130
128
|
const createSyncBlockStoreManager = dataProvider => {
|
|
131
129
|
return new SyncBlockStoreManager(dataProvider);
|
|
132
130
|
};
|
|
133
|
-
const
|
|
134
|
-
const syncBlockStoreManager = useMemo(() => {
|
|
135
|
-
return createSyncBlockStoreManager(dataProvider);
|
|
136
|
-
}, [dataProvider]);
|
|
137
|
-
syncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
|
|
138
|
-
return syncBlockStoreManager;
|
|
139
|
-
};
|
|
140
|
-
const useMemoizedSyncBlockStoreManagerPatched = (dataProvider, fireAnalyticsEvent) => {
|
|
131
|
+
export const useMemoizedSyncBlockStoreManager = (dataProvider, fireAnalyticsEvent) => {
|
|
141
132
|
const syncBlockStoreManager = useMemo(() => {
|
|
142
133
|
return createSyncBlockStoreManager(dataProvider);
|
|
143
134
|
}, [dataProvider]);
|
|
@@ -147,5 +138,4 @@ const useMemoizedSyncBlockStoreManagerPatched = (dataProvider, fireAnalyticsEven
|
|
|
147
138
|
syncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
|
|
148
139
|
}
|
|
149
140
|
return syncBlockStoreManager;
|
|
150
|
-
};
|
|
151
|
-
export const useMemoizedSyncBlockStoreManager = conditionalHooksFactory(() => fg('platform_synced_block_patch_4'), useMemoizedSyncBlockStoreManagerPatched, useMemoizedSyncBlockStoreManagerBase);
|
|
141
|
+
};
|
|
@@ -128,8 +128,8 @@ export class SyncBlockSubscriptionManager {
|
|
|
128
128
|
});
|
|
129
129
|
this.deps.fetchSyncBlockSourceInfo(resolved.resourceId);
|
|
130
130
|
} else {
|
|
131
|
-
var _syncBlockInstance$er, _syncBlockInstance$er2,
|
|
132
|
-
const errorMessage =
|
|
131
|
+
var _syncBlockInstance$er, _syncBlockInstance$er2, _this$deps$getFireAna4;
|
|
132
|
+
const errorMessage = ((_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.reason) || ((_syncBlockInstance$er2 = syncBlockInstance.error) === null || _syncBlockInstance$er2 === void 0 ? void 0 : _syncBlockInstance$er2.type);
|
|
133
133
|
(_this$deps$getFireAna4 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna4 === void 0 ? void 0 : _this$deps$getFireAna4(fetchErrorPayload(errorMessage, syncBlockInstance.resourceId));
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
export const stringifyError = error => {
|
|
4
3
|
try {
|
|
5
4
|
return JSON.stringify(error);
|
|
@@ -43,7 +42,7 @@ export const fetchSuccessPayload = (resourceId, blockInstanceId, sourceProduct)
|
|
|
43
42
|
}
|
|
44
43
|
});
|
|
45
44
|
export const createSuccessPayload = resourceId => {
|
|
46
|
-
return
|
|
45
|
+
return {
|
|
47
46
|
action: ACTION.INSERTED,
|
|
48
47
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
49
48
|
actionSubjectId: ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK,
|
|
@@ -51,14 +50,6 @@ export const createSuccessPayload = resourceId => {
|
|
|
51
50
|
attributes: {
|
|
52
51
|
resourceId
|
|
53
52
|
}
|
|
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
53
|
};
|
|
63
54
|
};
|
|
64
55
|
export const createSuccessPayloadNew = resourceId => ({
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
|
|
3
2
|
import { SyncBlockError } from '../common/types';
|
|
4
3
|
/**
|
|
@@ -13,7 +12,7 @@ import { SyncBlockError } from '../common/types';
|
|
|
13
12
|
* @returns A merged SyncBlockInstance object.
|
|
14
13
|
*/
|
|
15
14
|
export const resolveSyncBlockInstance = (oldResult, newResult) => {
|
|
16
|
-
var _newResult$data, _oldResult$data, _newResult$data2, _oldResult$data2, _newResult$data3, _oldResult$data3
|
|
15
|
+
var _newResult$data, _oldResult$data, _newResult$data2, _oldResult$data2, _newResult$data3, _oldResult$data3;
|
|
17
16
|
// if the old result has no data, we simply return the new result
|
|
18
17
|
if (!oldResult.data) {
|
|
19
18
|
return newResult;
|
|
@@ -34,31 +33,31 @@ export const resolveSyncBlockInstance = (oldResult, newResult) => {
|
|
|
34
33
|
...newResult.data,
|
|
35
34
|
sourceURL: ((_newResult$data = newResult.data) === null || _newResult$data === void 0 ? void 0 : _newResult$data.sourceURL) || ((_oldResult$data = oldResult.data) === null || _oldResult$data === void 0 ? void 0 : _oldResult$data.sourceURL) || undefined,
|
|
36
35
|
sourceTitle: ((_newResult$data2 = newResult.data) === null || _newResult$data2 === void 0 ? void 0 : _newResult$data2.sourceTitle) || ((_oldResult$data2 = oldResult.data) === null || _oldResult$data2 === void 0 ? void 0 : _oldResult$data2.sourceTitle) || undefined,
|
|
37
|
-
sourceSubType:
|
|
38
|
-
onSameDocument: ((_newResult$
|
|
36
|
+
sourceSubType: mergeSubType(oldResult, newResult),
|
|
37
|
+
onSameDocument: ((_newResult$data3 = newResult.data) === null || _newResult$data3 === void 0 ? void 0 : _newResult$data3.onSameDocument) || ((_oldResult$data3 = oldResult.data) === null || _oldResult$data3 === void 0 ? void 0 : _oldResult$data3.onSameDocument) || undefined
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
};
|
|
42
41
|
const mergeSubType = (oldResult, newResult) => {
|
|
43
|
-
var _newResult$
|
|
42
|
+
var _newResult$data4, _newResult$data5, _oldResult$data4;
|
|
44
43
|
// for classic pages, subType is 'null'
|
|
45
|
-
if (((_newResult$
|
|
44
|
+
if (((_newResult$data4 = newResult.data) === null || _newResult$data4 === void 0 ? void 0 : _newResult$data4.sourceSubType) !== undefined) {
|
|
46
45
|
return newResult.data.sourceSubType;
|
|
47
46
|
}
|
|
48
|
-
if ((_newResult$
|
|
47
|
+
if ((_newResult$data5 = newResult.data) !== null && _newResult$data5 !== void 0 && _newResult$data5.sourceAri) {
|
|
49
48
|
// for blogposts, subType is always undefined
|
|
50
49
|
try {
|
|
51
|
-
var _newResult$
|
|
50
|
+
var _newResult$data6;
|
|
52
51
|
const {
|
|
53
52
|
type: pageType
|
|
54
53
|
} = getPageIdAndTypeFromConfluencePageAri({
|
|
55
|
-
ari: (_newResult$
|
|
54
|
+
ari: (_newResult$data6 = newResult.data) === null || _newResult$data6 === void 0 ? void 0 : _newResult$data6.sourceAri
|
|
56
55
|
});
|
|
57
56
|
if (pageType === 'blogpost') {
|
|
58
|
-
var _newResult$
|
|
59
|
-
return (_newResult$
|
|
57
|
+
var _newResult$data7;
|
|
58
|
+
return (_newResult$data7 = newResult.data) === null || _newResult$data7 === void 0 ? void 0 : _newResult$data7.sourceSubType;
|
|
60
59
|
}
|
|
61
60
|
} catch {}
|
|
62
61
|
}
|
|
63
|
-
return (_oldResult$
|
|
62
|
+
return (_oldResult$data4 = oldResult.data) === null || _oldResult$data4 === void 0 ? void 0 : _oldResult$data4.sourceSubType;
|
|
64
63
|
};
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { functionWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
3
1
|
const MAX_RETRY_DELAY = 30000;
|
|
4
|
-
const
|
|
5
|
-
let newDelay;
|
|
6
|
-
|
|
7
|
-
// retryAfter can either be in seconds or HTTP date
|
|
8
|
-
const parsedRetryAfter = parseInt(retryAfter);
|
|
9
|
-
if (!isNaN(parsedRetryAfter)) {
|
|
10
|
-
newDelay = parsedRetryAfter * 1000;
|
|
11
|
-
} else {
|
|
12
|
-
const retryDate = new Date(retryAfter);
|
|
13
|
-
const delayFromDate = retryDate.getTime() - Date.now();
|
|
14
|
-
if (delayFromDate > 0) {
|
|
15
|
-
newDelay = delayFromDate;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return newDelay;
|
|
19
|
-
};
|
|
20
|
-
const parseRetryAfterPatched = retryAfter => {
|
|
2
|
+
const parseRetryAfter = retryAfter => {
|
|
21
3
|
// retryAfter can either be in seconds or HTTP date
|
|
22
4
|
const parsedRetryAfter = parseInt(retryAfter, 10);
|
|
23
5
|
if (!isNaN(parsedRetryAfter) && parsedRetryAfter > 0) {
|
|
@@ -33,7 +15,6 @@ const parseRetryAfterPatched = retryAfter => {
|
|
|
33
15
|
}
|
|
34
16
|
return undefined;
|
|
35
17
|
};
|
|
36
|
-
const parseRetryAfter = functionWithCondition(() => fg('platform_synced_block_patch_4'), parseRetryAfterPatched, parseRetryAfterBase);
|
|
37
18
|
export const fetchWithRetry = async (url, options, retriesRemaining = 3, delay = 1000) => {
|
|
38
19
|
var _ref;
|
|
39
20
|
const response = await fetch(url, options);
|
|
@@ -43,7 +24,7 @@ export const fetchWithRetry = async (url, options, retriesRemaining = 3, delay =
|
|
|
43
24
|
}
|
|
44
25
|
const retryAfter = response.headers.get('Retry-After');
|
|
45
26
|
const parsedDelay = (_ref = retryAfter ? parseRetryAfter(retryAfter) : undefined) !== null && _ref !== void 0 ? _ref : delay;
|
|
46
|
-
const retryDelay =
|
|
27
|
+
const retryDelay = Math.min(parsedDelay, MAX_RETRY_DELAY);
|
|
47
28
|
await new Promise(resolve => setTimeout(resolve, retryDelay));
|
|
48
29
|
return fetchWithRetry(url, options, retriesRemaining - 1, delay * 2);
|
|
49
30
|
};
|
|
@@ -8,7 +8,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
8
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { fetchWithRetry } from '../../utils/retry';
|
|
13
12
|
export var isBlockContentResponse = function isBlockContentResponse(response) {
|
|
14
13
|
var content = response.content;
|
|
@@ -65,7 +64,7 @@ export var getReferenceSyncedBlocks = /*#__PURE__*/function () {
|
|
|
65
64
|
query: buildGetDocumentReferenceBlocksQuery(documentAri),
|
|
66
65
|
operationName: GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME
|
|
67
66
|
};
|
|
68
|
-
url =
|
|
67
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetDocumentReferenceBlocks");
|
|
69
68
|
_context.next = 4;
|
|
70
69
|
return fetchWithRetry(url, {
|
|
71
70
|
method: 'POST',
|
|
@@ -124,7 +123,7 @@ var GET_BLOCK_REFERENCES_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_REFERENCES';
|
|
|
124
123
|
var GET_BLOCK_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_GET_BLOCK';
|
|
125
124
|
var BATCH_UPDATE_BLOCKS_OPERATION_NAME = 'EDITOR_SYNCED_BLOCK_BATCH_UPDATE_BLOCKS';
|
|
126
125
|
var buildGetDocumentReferenceBlocksQuery = function buildGetDocumentReferenceBlocksQuery(documentAri) {
|
|
127
|
-
return "query ".concat(GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME, " {\n\tblockService_getDocumentReferenceBlocks(documentAri: ").concat(
|
|
126
|
+
return "query ".concat(GET_DOCUMENT_REFERENCE_BLOCKS_OPERATION_NAME, " {\n\tblockService_getDocumentReferenceBlocks(documentAri: ").concat(JSON.stringify(documentAri), ") {\n\t\tblocks {\n\t\t\tblockAri\n\t\t\tblockInstanceId\n\t\t\tcontent\n\t\t\tcontentUpdatedAt\n\t\t\tcreatedAt\n\t\t\tcreatedBy\n\t\t\tproduct\n\t\t\tsourceAri\n\t\t\tstatus\n\t\t\tversion\n\t\t}\n\t\terrors {\n\t\t\tblockAri\n\t\t\tcode\n\t\t\treason\n\t\t}\n\t}\n}");
|
|
128
127
|
};
|
|
129
128
|
var buildGetBlockQuery = function buildGetBlockQuery(blockAri) {
|
|
130
129
|
return "query ".concat(GET_BLOCK_OPERATION_NAME, " {\n\tblockService_getBlock(blockAri: ").concat(JSON.stringify(blockAri), ") {\n\t\tblockAri\n\t\tblockInstanceId\n\t\tcontent\n\t\tcontentUpdatedAt\n\t\tcreatedAt\n\t\tcreatedBy\n\t\tdeletionReason\n\t\tproduct\n\t\tsourceAri\n\t\tstatus\n\t\tversion\n\t}\n}");
|
|
@@ -231,7 +230,7 @@ export var getSyncedBlockContent = /*#__PURE__*/function () {
|
|
|
231
230
|
query: buildGetBlockQuery(blockAri),
|
|
232
231
|
operationName: GET_BLOCK_OPERATION_NAME
|
|
233
232
|
};
|
|
234
|
-
url =
|
|
233
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetBlock");
|
|
235
234
|
_context2.next = 5;
|
|
236
235
|
return fetchWithRetry(url, {
|
|
237
236
|
method: 'POST',
|
|
@@ -299,7 +298,7 @@ export var batchRetrieveSyncedBlocks = /*#__PURE__*/function () {
|
|
|
299
298
|
query: buildBatchRetrieveBlocksQuery(blockAris),
|
|
300
299
|
operationName: BATCH_RETRIEVE_BLOCKS_OPERATION_NAME
|
|
301
300
|
};
|
|
302
|
-
url =
|
|
301
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockBatchRetrieveBlocks");
|
|
303
302
|
_context3.next = 6;
|
|
304
303
|
return fetchWithRetry(url, {
|
|
305
304
|
method: 'POST',
|
|
@@ -349,7 +348,7 @@ export var batchRetrieveSyncedBlocks = /*#__PURE__*/function () {
|
|
|
349
348
|
}();
|
|
350
349
|
export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
351
350
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) {
|
|
352
|
-
var _result$data3
|
|
351
|
+
var _result$data3;
|
|
353
352
|
var blockAri, deleteReason, bodyData, url, response, result, isDeleted;
|
|
354
353
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
355
354
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -359,7 +358,7 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
|
359
358
|
query: buildDeleteBlockMutation(blockAri, deleteReason),
|
|
360
359
|
operationName: DELETE_BLOCK_OPERATION_NAME
|
|
361
360
|
};
|
|
362
|
-
url =
|
|
361
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockDeleteBlock");
|
|
363
362
|
_context4.next = 5;
|
|
364
363
|
return fetchWithRetry(url, {
|
|
365
364
|
method: 'POST',
|
|
@@ -386,7 +385,7 @@ export var deleteSyncedBlock = /*#__PURE__*/function () {
|
|
|
386
385
|
return e.message;
|
|
387
386
|
}).join(', '));
|
|
388
387
|
case 13:
|
|
389
|
-
isDeleted =
|
|
388
|
+
isDeleted = (_result$data3 = result.data) === null || _result$data3 === void 0 || (_result$data3 = _result$data3.blockService_deleteBlock) === null || _result$data3 === void 0 ? void 0 : _result$data3.deleted;
|
|
390
389
|
if (isDeleted) {
|
|
391
390
|
_context4.next = 16;
|
|
392
391
|
break;
|
|
@@ -413,7 +412,7 @@ export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
|
413
412
|
query: buildUpdateBlockMutation(blockAri, content, stepVersion, status),
|
|
414
413
|
operationName: UPDATE_BLOCK_OPERATION_NAME
|
|
415
414
|
};
|
|
416
|
-
url =
|
|
415
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockUpdateBlock");
|
|
417
416
|
_context5.next = 5;
|
|
418
417
|
return fetchWithRetry(url, {
|
|
419
418
|
method: 'POST',
|
|
@@ -451,7 +450,7 @@ export var updateSyncedBlock = /*#__PURE__*/function () {
|
|
|
451
450
|
}();
|
|
452
451
|
export var createSyncedBlock = /*#__PURE__*/function () {
|
|
453
452
|
var _ref1 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref0) {
|
|
454
|
-
var _result$
|
|
453
|
+
var _result$data4;
|
|
455
454
|
var blockAri, blockInstanceId, sourceAri, product, content, stepVersion, status, bodyData, url, response, result;
|
|
456
455
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
457
456
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -461,7 +460,7 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
461
460
|
query: buildCreateBlockMutation(blockAri, blockInstanceId, content, product, sourceAri, stepVersion, status),
|
|
462
461
|
operationName: CREATE_BLOCK_OPERATION_NAME
|
|
463
462
|
};
|
|
464
|
-
url =
|
|
463
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockCreateBlock");
|
|
465
464
|
_context6.next = 5;
|
|
466
465
|
return fetchWithRetry(url, {
|
|
467
466
|
method: 'POST',
|
|
@@ -488,7 +487,7 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
488
487
|
return e.message;
|
|
489
488
|
}).join(', '));
|
|
490
489
|
case 13:
|
|
491
|
-
if ((_result$
|
|
490
|
+
if ((_result$data4 = result.data) !== null && _result$data4 !== void 0 && _result$data4.blockService_createBlock) {
|
|
492
491
|
_context6.next = 15;
|
|
493
492
|
break;
|
|
494
493
|
}
|
|
@@ -507,7 +506,7 @@ export var createSyncedBlock = /*#__PURE__*/function () {
|
|
|
507
506
|
}();
|
|
508
507
|
export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
509
508
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
|
|
510
|
-
var documentAri, blocks, _ref10$noContent, noContent, bodyData, url, response, result, _result$
|
|
509
|
+
var documentAri, blocks, _ref10$noContent, noContent, bodyData, url, response, result, _result$data5;
|
|
511
510
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
512
511
|
while (1) switch (_context7.prev = _context7.next) {
|
|
513
512
|
case 0:
|
|
@@ -516,7 +515,7 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
|
516
515
|
query: buildUpdateDocumentReferencesMutation(documentAri, blocks, noContent),
|
|
517
516
|
operationName: UPDATE_DOCUMENT_REFERENCES_OPERATION_NAME
|
|
518
517
|
};
|
|
519
|
-
url =
|
|
518
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockUpdateDocumentReferences");
|
|
520
519
|
_context7.next = 5;
|
|
521
520
|
return fetchWithRetry(url, {
|
|
522
521
|
method: 'POST',
|
|
@@ -548,7 +547,7 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
|
548
547
|
_context7.next = 17;
|
|
549
548
|
break;
|
|
550
549
|
}
|
|
551
|
-
if ((_result$
|
|
550
|
+
if ((_result$data5 = result.data) !== null && _result$data5 !== void 0 && _result$data5.blockService_updateDocumentReferences) {
|
|
552
551
|
_context7.next = 16;
|
|
553
552
|
break;
|
|
554
553
|
}
|
|
@@ -567,7 +566,7 @@ export var updateReferenceSyncedBlockOnDocument = /*#__PURE__*/function () {
|
|
|
567
566
|
}();
|
|
568
567
|
export var getReferenceSyncedBlocksByBlockAri = /*#__PURE__*/function () {
|
|
569
568
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
|
|
570
|
-
var _result$
|
|
569
|
+
var _result$data6;
|
|
571
570
|
var blockAri, bodyData, url, response, result, graphqlResponse;
|
|
572
571
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
573
572
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -577,7 +576,7 @@ export var getReferenceSyncedBlocksByBlockAri = /*#__PURE__*/function () {
|
|
|
577
576
|
query: buildGetBlockReferencesQuery(blockAri),
|
|
578
577
|
operationName: GET_BLOCK_REFERENCES_OPERATION_NAME
|
|
579
578
|
};
|
|
580
|
-
url =
|
|
579
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockGetReferences");
|
|
581
580
|
_context8.next = 5;
|
|
582
581
|
return fetchWithRetry(url, {
|
|
583
582
|
method: 'POST',
|
|
@@ -604,7 +603,7 @@ export var getReferenceSyncedBlocksByBlockAri = /*#__PURE__*/function () {
|
|
|
604
603
|
return e.message;
|
|
605
604
|
}).join(', '));
|
|
606
605
|
case 13:
|
|
607
|
-
if ((_result$
|
|
606
|
+
if ((_result$data6 = result.data) !== null && _result$data6 !== void 0 && _result$data6.blockService_getReferences) {
|
|
608
607
|
_context8.next = 15;
|
|
609
608
|
break;
|
|
610
609
|
}
|
|
@@ -651,7 +650,7 @@ export var getReferenceSyncedBlocksByBlockAri = /*#__PURE__*/function () {
|
|
|
651
650
|
*/
|
|
652
651
|
export var updateSyncedBlocks = /*#__PURE__*/function () {
|
|
653
652
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref14) {
|
|
654
|
-
var _result$
|
|
653
|
+
var _result$data7;
|
|
655
654
|
var blocks, bodyData, url, response, result, graphqlResponse;
|
|
656
655
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
657
656
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -661,7 +660,7 @@ export var updateSyncedBlocks = /*#__PURE__*/function () {
|
|
|
661
660
|
query: buildBatchUpdateBlocksMutation(blocks),
|
|
662
661
|
operationName: BATCH_UPDATE_BLOCKS_OPERATION_NAME
|
|
663
662
|
};
|
|
664
|
-
url =
|
|
663
|
+
url = "".concat(GRAPHQL_ENDPOINT, "?operation=editorSyncedBlockBatchUpdateBlocks");
|
|
665
664
|
_context9.next = 5;
|
|
666
665
|
return fetchWithRetry(url, {
|
|
667
666
|
method: 'POST',
|
|
@@ -688,7 +687,7 @@ export var updateSyncedBlocks = /*#__PURE__*/function () {
|
|
|
688
687
|
return e.message;
|
|
689
688
|
}).join(', '));
|
|
690
689
|
case 13:
|
|
691
|
-
if ((_result$
|
|
690
|
+
if ((_result$data7 = result.data) !== null && _result$data7 !== void 0 && _result$data7.blockService_batchUpdateBlocks) {
|
|
692
691
|
_context9.next = 15;
|
|
693
692
|
break;
|
|
694
693
|
}
|
|
@@ -4,7 +4,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { fetchWithRetry } from '../../utils/retry';
|
|
9
8
|
var COMMON_HEADERS = {
|
|
10
9
|
'Content-Type': 'application/json',
|
|
@@ -90,7 +89,7 @@ export var fetchMediaToken = /*#__PURE__*/function () {
|
|
|
90
89
|
logException(_context2.t0, {
|
|
91
90
|
location: 'editor-synced-block-provider/fetchMediaToken'
|
|
92
91
|
});
|
|
93
|
-
errorMsg =
|
|
92
|
+
errorMsg = _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0);
|
|
94
93
|
throw new Error("Failed to get content media session: ".concat(errorMsg));
|
|
95
94
|
case 18:
|
|
96
95
|
case "end":
|