@atlaskit/editor-synced-block-provider 7.0.14 → 7.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/blockService/ari/package.json +1 -8
  3. package/blockService/package.json +1 -8
  4. package/blockSubscription/package.json +1 -8
  5. package/clients/confluence/ari/package.json +1 -8
  6. package/common/types/package.json +1 -8
  7. package/errorHandling/package.json +1 -8
  8. package/fetchJiraMediaToken/package.json +1 -8
  9. package/fetchMediaToken/package.json +1 -8
  10. package/jira/ari/package.json +1 -8
  11. package/package.json +2 -2
  12. package/providers/block-service/blockServiceAPI/package.json +1 -8
  13. package/providers/types/package.json +1 -8
  14. package/rebaseTransaction/package.json +1 -8
  15. package/referenceSyncBlockStoreManager/package.json +1 -8
  16. package/requestJiraIssueAccess/package.json +1 -8
  17. package/resolveSyncBlockInstance/package.json +1 -8
  18. package/sourceInfo/package.json +1 -8
  19. package/syncBlockInMemorySessionCache/package.json +1 -8
  20. package/syncBlockProvider/package.json +1 -8
  21. package/syncBlockStoreManager/package.json +1 -8
  22. package/tokenRouting/package.json +1 -8
  23. package/types/package.json +1 -8
  24. package/useFetchSyncBlockData/package.json +1 -8
  25. package/useFetchSyncBlockTitle/package.json +1 -8
  26. package/useHandleContentChanges/package.json +1 -8
  27. package/utils/package.json +1 -8
  28. package/utils/resourceId/package.json +1 -8
  29. package/validValue/package.json +1 -8
  30. package/dist/types-ts4.5/clients/block-service/ari.d.ts +0 -34
  31. package/dist/types-ts4.5/clients/block-service/blockService.d.ts +0 -187
  32. package/dist/types-ts4.5/clients/block-service/blockSubscription.d.ts +0 -52
  33. package/dist/types-ts4.5/clients/confluence/ari.d.ts +0 -27
  34. package/dist/types-ts4.5/clients/confluence/fetchMediaToken.d.ts +0 -10
  35. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +0 -2
  36. package/dist/types-ts4.5/clients/confluence/utils.d.ts +0 -2
  37. package/dist/types-ts4.5/clients/jira/ari.d.ts +0 -18
  38. package/dist/types-ts4.5/clients/jira/fetchMediaToken.d.ts +0 -9
  39. package/dist/types-ts4.5/clients/jira/requestJiraIssueAccess.d.ts +0 -13
  40. package/dist/types-ts4.5/clients/jira/sourceInfo.d.ts +0 -22
  41. package/dist/types-ts4.5/clients/tokenRouting.d.ts +0 -11
  42. package/dist/types-ts4.5/common/consts.d.ts +0 -4
  43. package/dist/types-ts4.5/common/rebase-transaction.d.ts +0 -11
  44. package/dist/types-ts4.5/common/types.d.ts +0 -82
  45. package/dist/types-ts4.5/entry-points/blockService-ari.d.ts +0 -1
  46. package/dist/types-ts4.5/entry-points/blockService.d.ts +0 -2
  47. package/dist/types-ts4.5/entry-points/blockServiceAPI.d.ts +0 -1
  48. package/dist/types-ts4.5/entry-points/blockSubscription.d.ts +0 -1
  49. package/dist/types-ts4.5/entry-points/common-types.d.ts +0 -2
  50. package/dist/types-ts4.5/entry-points/confluence-ari.d.ts +0 -1
  51. package/dist/types-ts4.5/entry-points/errorHandling.d.ts +0 -1
  52. package/dist/types-ts4.5/entry-points/fetchJiraMediaToken.d.ts +0 -1
  53. package/dist/types-ts4.5/entry-points/fetchMediaToken.d.ts +0 -2
  54. package/dist/types-ts4.5/entry-points/jira-ari.d.ts +0 -1
  55. package/dist/types-ts4.5/entry-points/providers-types.d.ts +0 -1
  56. package/dist/types-ts4.5/entry-points/rebaseTransaction.d.ts +0 -1
  57. package/dist/types-ts4.5/entry-points/referenceSyncBlockStoreManager.d.ts +0 -1
  58. package/dist/types-ts4.5/entry-points/requestJiraIssueAccess.d.ts +0 -2
  59. package/dist/types-ts4.5/entry-points/resolveSyncBlockInstance.d.ts +0 -1
  60. package/dist/types-ts4.5/entry-points/resourceId.d.ts +0 -1
  61. package/dist/types-ts4.5/entry-points/sourceInfo.d.ts +0 -1
  62. package/dist/types-ts4.5/entry-points/syncBlockInMemorySessionCache.d.ts +0 -1
  63. package/dist/types-ts4.5/entry-points/syncBlockProvider.d.ts +0 -1
  64. package/dist/types-ts4.5/entry-points/syncBlockStoreManager.d.ts +0 -1
  65. package/dist/types-ts4.5/entry-points/tokenRouting.d.ts +0 -1
  66. package/dist/types-ts4.5/entry-points/useFetchSyncBlockData.d.ts +0 -2
  67. package/dist/types-ts4.5/entry-points/useFetchSyncBlockTitle.d.ts +0 -1
  68. package/dist/types-ts4.5/entry-points/useHandleContentChanges.d.ts +0 -1
  69. package/dist/types-ts4.5/entry-points/utils.d.ts +0 -1
  70. package/dist/types-ts4.5/entry-points/validValue.d.ts +0 -1
  71. package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +0 -16
  72. package/dist/types-ts4.5/hooks/useFetchSyncBlockTitle.d.ts +0 -3
  73. package/dist/types-ts4.5/hooks/useHandleContentChanges.d.ts +0 -3
  74. package/dist/types-ts4.5/index.d.ts +0 -25
  75. package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +0 -127
  76. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +0 -110
  77. package/dist/types-ts4.5/providers/types.d.ts +0 -185
  78. package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +0 -147
  79. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +0 -128
  80. package/dist/types-ts4.5/store-manager/syncBlockBatchFetcher.d.ts +0 -33
  81. package/dist/types-ts4.5/store-manager/syncBlockInMemorySessionCache.d.ts +0 -41
  82. package/dist/types-ts4.5/store-manager/syncBlockProviderFactoryManager.d.ts +0 -26
  83. package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +0 -24
  84. package/dist/types-ts4.5/store-manager/syncBlockSubscriptionManager.d.ts +0 -84
  85. package/dist/types-ts4.5/utils/errorHandling.d.ts +0 -36
  86. package/dist/types-ts4.5/utils/experienceTracking.d.ts +0 -59
  87. package/dist/types-ts4.5/utils/resolveSyncBlockInstance.d.ts +0 -13
  88. package/dist/types-ts4.5/utils/resourceId.d.ts +0 -7
  89. package/dist/types-ts4.5/utils/retry.d.ts +0 -1
  90. package/dist/types-ts4.5/utils/utils.d.ts +0 -15
  91. package/dist/types-ts4.5/utils/validValue.d.ts +0 -3
@@ -1,24 +0,0 @@
1
- import type { SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
2
- import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
3
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import type { BlockInstanceId, ReferencesSourceInfo, ResourceId } from '../common/types';
5
- import type { SyncBlockDataProviderInterface } from '../providers/types';
6
- import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
7
- import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
8
- export declare class SyncBlockStoreManager {
9
- private referenceSyncBlockStoreManager;
10
- private sourceSyncBlockStoreManager;
11
- private dataProvider?;
12
- private fireAnalyticsEvent?;
13
- private fetchReferencesExperience;
14
- private fetchSourceInfoExperience;
15
- constructor(dataProvider?: SyncBlockDataProviderInterface, viewMode?: ViewMode, isLivePage?: boolean);
16
- isSyncBlock(node: PMNode): boolean;
17
- fetchReferencesSourceInfo(resourceId: ResourceId, blockInstanceId: BlockInstanceId, isSourceSyncBlock: boolean): Promise<ReferencesSourceInfo>;
18
- setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
19
- get referenceManager(): ReferenceSyncBlockStoreManager;
20
- get sourceManager(): SourceSyncBlockStoreManager;
21
- destroy(): void;
22
- private getUnregisteredReferences;
23
- }
24
- export declare const useMemoizedSyncBlockStoreManager: (dataProvider?: SyncBlockDataProviderInterface, fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => SyncBlockStoreManager;
@@ -1,84 +0,0 @@
1
- import type { RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
2
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import type { ResourceId, BlockInstanceId } from '../common/types';
4
- import type { SyncBlockInstance, SubscriptionCallback, SyncBlockDataProviderInterface, SyncBlockSourceInfo, TitleSubscriptionCallback } from '../providers/types';
5
- export interface SyncBlockSubscriptionManagerDeps {
6
- /** Cancels any pending cache deletion timer for `resourceId` (gated). */
7
- cancelPendingCacheDeletion: (resourceId: ResourceId) => void;
8
- debouncedBatchedFetchSyncBlocks: (resourceId: string) => void;
9
- deleteFromCache: (resourceId: ResourceId) => void;
10
- fetchSyncBlockSourceInfo: (resourceId: ResourceId) => Promise<SyncBlockSourceInfo | undefined>;
11
- getDataProvider: () => SyncBlockDataProviderInterface | undefined;
12
- getFireAnalyticsEvent: () => ((payload: RendererSyncBlockEventPayload) => void) | undefined;
13
- getFromCache: (resourceId: ResourceId) => SyncBlockInstance | undefined;
14
- markCacheDirty: () => void;
15
- /** Schedules guarded cache deletion for `resourceId` after a grace period (gated). */
16
- scheduleCacheDeletion: (resourceId: ResourceId) => void;
17
- updateCache: (syncBlockInstance: SyncBlockInstance) => void;
18
- }
19
- /**
20
- * Manages the lifecycle of GraphQL WebSocket subscriptions for sync block
21
- * real-time updates, owns the subscriptions and titleSubscriptions maps,
22
- * and provides a listener API so React components can react when the set
23
- * of subscribed resource IDs changes.
24
- */
25
- export declare class SyncBlockSubscriptionManager {
26
- private deps;
27
- private subscriptions;
28
- private titleSubscriptions;
29
- private graphqlSubscriptions;
30
- private subscriptionChangeListeners;
31
- private useRealTimeSubscriptions;
32
- private pendingCacheDeletions;
33
- private static readonly INITIAL_RETRY_DELAY_MS;
34
- private static readonly RETRY_BACKOFF_MULTIPLIER;
35
- private static readonly MAX_RETRY_ATTEMPTS;
36
- private retryAttempts;
37
- private pendingRetries;
38
- constructor(deps: SyncBlockSubscriptionManagerDeps);
39
- /**
40
- * Returns the subscriptions map. Used by external consumers (e.g. batch fetcher, flush)
41
- * that need to read the current subscription state.
42
- */
43
- getSubscriptions(): Map<ResourceId, {
44
- [localId: BlockInstanceId]: SubscriptionCallback;
45
- }>;
46
- setRealTimeSubscriptionsEnabled(enabled: boolean): void;
47
- isRealTimeSubscriptionsEnabled(): boolean;
48
- getSubscribedResourceIds(): ResourceId[];
49
- onSubscriptionsChanged(listener: () => void): () => void;
50
- notifySubscriptionChangeListeners(): void;
51
- handleSubscriptionUpdate(syncBlockInstance: SyncBlockInstance): void;
52
- subscribeToSyncBlock(resourceId: string, localId: string, callback: SubscriptionCallback): () => void;
53
- subscribeToSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
54
- updateSourceTitleSubscriptions(resourceId: string, title: string): void;
55
- /**
56
- * Notifies all subscription callbacks for a given resource ID with the provided sync block instance.
57
- */
58
- notifySubscriptionCallbacks(resourceId: ResourceId, syncBlock: SyncBlockInstance): void;
59
- setupSubscription(resourceId: ResourceId): void;
60
- /**
61
- * Handles subscription termination (complete or error) by cleaning up the
62
- * stale entry and scheduling a reconnection with exponential backoff.
63
- */
64
- private handleSubscriptionTerminated;
65
- /**
66
- * Schedules a reconnection attempt with exponential backoff.
67
- * Delay = INITIAL_RETRY_DELAY_MS * (RETRY_BACKOFF_MULTIPLIER ^ attempts)
68
- * e.g. 1s, 2s, 4s, 8s, 16s
69
- */
70
- private scheduleReconnection;
71
- /**
72
- * Resets the retry counter for a resource. Called when a successful
73
- * update is received, indicating the subscription is healthy.
74
- */
75
- private resetRetryCount;
76
- private cancelPendingRetry;
77
- private cancelAllPendingRetries;
78
- cleanupSubscription(resourceId: ResourceId): void;
79
- setupSubscriptionsForAllBlocks(): void;
80
- cleanupAll(): void;
81
- destroy(): void;
82
- shouldUseRealTime(): boolean;
83
- private handleGraphQLUpdate;
84
- }
@@ -1,36 +0,0 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
2
- import type { RendererSyncBlockEventPayload, OperationalAEP, SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
3
- export declare const stringifyError: (error: unknown) => string | undefined;
4
- export declare const getErrorPayload: <T extends ACTION_SUBJECT_ID>(actionSubjectId: T, error: string, resourceId?: string, sourceProduct?: string) => OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, T, {
5
- error: string;
6
- resourceId?: string;
7
- sourceProduct?: string;
8
- }>;
9
- export declare const fetchErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
10
- export declare const getSourceInfoErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
11
- export declare const updateErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
12
- export declare const updateReferenceErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
13
- export declare const createErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
14
- export declare const deleteErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
15
- export declare const updateCacheErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
16
- /**
17
- * Payload for `SYNCED_BLOCK_SOURCE_INFO_ORPHANED`. Fired when source-info
18
- * resolves into a cache that has already been deleted — should be unreachable
19
- * under `platform_synced_block_patch_14`.
20
- */
21
- export declare const sourceInfoOrphanedPayload: (resourceId?: string, sourceProduct?: string, context?: {
22
- hasPendingDeletion?: boolean;
23
- hasSubscribers?: boolean;
24
- }) => RendererSyncBlockEventPayload;
25
- /**
26
- * Payload for `SYNCED_BLOCK_CACHE_DELETION_FORCED`. Fired when the cache
27
- * deletion timer has been rescheduled `MAX_RESCHEDULE_COUNT` times and we force
28
- * the deletion to avoid leaking memory. Indicates a stuck in-flight flag.
29
- */
30
- export declare const cacheDeletionForcedPayload: (rescheduleCount: number, resourceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
31
- export declare const fetchReferencesErrorPayload: (error: string, resourceId?: string, sourceProduct?: string) => SyncBlockEventPayload;
32
- export declare const fetchSuccessPayload: (resourceId: string, blockInstanceId?: string, sourceProduct?: string) => RendererSyncBlockEventPayload;
33
- export declare const createSuccessPayload: (resourceId: string, sourceProduct?: string) => SyncBlockEventPayload;
34
- export declare const createSuccessPayloadNew: (resourceId: string) => SyncBlockEventPayload;
35
- export declare const updateSuccessPayload: (resourceId: string, hasReference?: boolean, sourceProduct?: string) => SyncBlockEventPayload;
36
- export declare const deleteSuccessPayload: (resourceId: string, sourceProduct?: string) => SyncBlockEventPayload;
@@ -1,59 +0,0 @@
1
- import type { DispatchAnalyticsEvent, SyncBlockEventPayload, RendererSyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
2
- import { Experience } from '@atlaskit/editor-common/experiences';
3
- export declare const createExperienceDispatcher: (fireAnalyticsEvent?: ((payload: SyncBlockEventPayload) => void) | ((payload: RendererSyncBlockEventPayload) => void)) => DispatchAnalyticsEvent;
4
- /**
5
- * This experience tracks when a source sync block is saved to the BE.
6
- *
7
- * Start: When the flush source sync block function is called.
8
- * Success: When the sync block save is successful within the timeout duration of start.
9
- * Failure: When the timeout duration passes without the sync block being successfully saved
10
- */
11
- export declare const getSaveSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
12
- /**
13
- * This experience tracks when a reference sync block is saved to the BE.
14
- *
15
- * Start: When the flush sync block function is called.
16
- * Success: When the sync block save is successful within the timeout duration of start.
17
- * Failure: When the timeout duration passes without the sync block being successfully saved
18
- */
19
- export declare const getSaveReferenceExperience: (fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Experience;
20
- /**
21
- * This experience tracks when a reference sync block data is fetched from the BE.
22
- *
23
- * Start: When the fetchNodesData function is called.
24
- * Success: When the fetching the data is successful within the timeout duration of start.
25
- * Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
26
- */
27
- export declare const getFetchExperience: (fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Experience;
28
- /**
29
- * This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
30
- *
31
- * Start: When the fetchSourceInfo function is called.
32
- * Success: When the fetching the data is successful within the timeout duration of start.
33
- * Failure: When the timeout duration passes without the data being successfully fetched, or the fetch fails
34
- */
35
- export declare const getFetchSourceInfoExperience: (fireAnalyticsEvent?: (payload: RendererSyncBlockEventPayload) => void) => Experience;
36
- /**
37
- * This experience tracks when a source sync block is deleted from the BE.
38
- *
39
- * Start: When the delete source sync block function is called.
40
- * Success: When the sync block deletion is successful within the timeout duration of start.
41
- * Failure: When the timeout duration passes without the sync block being successfully deleted, or the deletion fails
42
- */
43
- export declare const getDeleteSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
44
- /**
45
- * This experience tracks when a source sync block is created and registered to the BE.
46
- *
47
- * Start: When the create source sync block function is called.
48
- * Success: When the sync block creation is successful within the timeout duration of start.
49
- * Failure: When the timeout duration passes without the sync block being successfully created, or the creation fails
50
- */
51
- export declare const getCreateSourceExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
52
- /**
53
- * This experience tracks when references for a sync block are fetched from the BE.
54
- *
55
- * Start: When the fetchReferences function is called.
56
- * Success: When the fetching of references is successful within the timeout duration of start.
57
- * Failure: When the timeout duration passes without references being successfully fetched, or the fetch fails
58
- */
59
- export declare const getFetchReferencesExperience: (fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void) => Experience;
@@ -1,13 +0,0 @@
1
- import type { SyncBlockInstance } from '../providers/types';
2
- /**
3
- * Merges two SyncBlockInstance objects,
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,
7
- * e.g. compare timestamps or version numbers to determine which data is more recent.
8
- *
9
- * @param oldResult - The existing SyncBlockInstance object.
10
- * @param newResult - The new SyncBlockInstance object to merge.
11
- * @returns A merged SyncBlockInstance object.
12
- */
13
- export declare const resolveSyncBlockInstance: (oldResult: SyncBlockInstance, newResult: SyncBlockInstance) => SyncBlockInstance;
@@ -1,7 +0,0 @@
1
- import type { SyncBlockProduct } from '../common/types';
2
- export declare const parseResourceId: (resourceId: string) => {
3
- contentId: string;
4
- product: SyncBlockProduct;
5
- uuid: string;
6
- } | undefined;
7
- export declare const createResourceIdForReference: (product: SyncBlockProduct, contentId: string, uuid: string) => string;
@@ -1 +0,0 @@
1
- export declare const fetchWithRetry: (url: string, options: RequestInit, retriesRemaining?: number, delay?: number) => Promise<Response>;
@@ -1,15 +0,0 @@
1
- import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
2
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode, SyncBlockProduct } from '../common/types';
4
- export declare const stripAnnotationMarksFromJSONContent: <T extends JSONNode | undefined>(content: T[]) => T[];
5
- export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
6
- export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
7
- export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
8
- export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
9
- export declare const convertPMNodesToSyncBlockNodes: (nodes: PMNode[]) => SyncBlockNode[];
10
- export declare const getContentIdAndProductFromResourceId: (resourceId: string) => {
11
- sourceContentId: string;
12
- sourceProduct: SyncBlockProduct;
13
- };
14
- export declare const getSourceProductFromResourceIdSafe: (resourceId?: string) => SyncBlockProduct | undefined;
15
- export declare const convertContentUpdatedAt: (contentUpdatedAt: number | undefined) => string | undefined;
@@ -1,3 +0,0 @@
1
- import type { SyncBlockProduct, SyncBlockStatus } from '../common/types';
2
- export declare const normaliseSyncBlockProduct: (value: string | null | undefined) => SyncBlockProduct | undefined;
3
- export declare const normaliseSyncBlockStatus: (value: string | null | undefined) => SyncBlockStatus | undefined;