stream-chat 10.0.0-rc.21 → 10.0.0-rc.23
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/dist/cjs/index.browser.js +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
|
@@ -14,21 +14,17 @@ export type ChannelManagerEventHandlerContext = {
|
|
|
14
14
|
type EventHandlerContext = ChannelManagerEventHandlerContext;
|
|
15
15
|
type SupportedEventType = EventType | (string & {});
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* Return a set of paginator ids that should keep/own the item.
|
|
21
|
-
* Returning an empty set means the channel will be removed everywhere.
|
|
17
|
+
* Picks which paginators own a channel that matches several, by returning their IDs. An empty list
|
|
18
|
+
* means every matching paginator keeps it.
|
|
22
19
|
*/
|
|
23
20
|
export type PaginatorOwnershipResolver = (args: {
|
|
24
21
|
channel: Channel;
|
|
25
22
|
matchingPaginators: ChannelPaginator[];
|
|
26
23
|
}) => string[];
|
|
27
24
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* - If none of the matching paginator ids are in the priority list, all matches are kept (back-compat).
|
|
25
|
+
* Priority-based ownership resolver. `priority` lists paginator IDs from highest to lowest: of the
|
|
26
|
+
* paginators matching a channel, the highest-priority one owns it. If none of them is listed, all
|
|
27
|
+
* keep it.
|
|
32
28
|
*/
|
|
33
29
|
export declare const createPriorityOwnershipResolver: (priority?: string[]) => PaginatorOwnershipResolver;
|
|
34
30
|
export declare const ignoreEventsForUnknownChannels: EventHandlerPipelineHandler<EventHandlerContext>;
|
|
@@ -40,25 +36,23 @@ export type ChannelManagerOptions = {
|
|
|
40
36
|
client: StreamChat;
|
|
41
37
|
paginators?: ChannelPaginator[];
|
|
42
38
|
/**
|
|
43
|
-
* The complete set of event handlers
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* through `addEventHandler` / `setEventHandlers` / `removeEventHandlers`.
|
|
39
|
+
* The complete set of event handlers, replacing the defaults. Start from
|
|
40
|
+
* `ChannelManager.getDefaultHandlers()` (a copy) and enrich it. `client.channelManager` is built
|
|
41
|
+
* without this option: customize it through `addEventHandler` / `setEventHandlers` /
|
|
42
|
+
* `removeEventHandlers`.
|
|
48
43
|
*/
|
|
49
44
|
eventHandlers?: ChannelManagerEventHandlers;
|
|
50
45
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* Empty ownershipResolver array means that the channel is kept in all matching paginators.
|
|
46
|
+
* Picks which paginator(s) own a channel that matches several. Defaults to all of them. A function
|
|
47
|
+
* returns the owning paginator IDs; an array is a priority list (highest first), so the
|
|
48
|
+
* highest-priority match owns the channel, and if none of them is listed all keep it.
|
|
55
49
|
*/
|
|
56
50
|
ownershipResolver?: PaginatorOwnershipResolver | string[];
|
|
57
51
|
};
|
|
58
52
|
/**
|
|
59
|
-
* A stored channel,
|
|
60
|
-
* `'
|
|
61
|
-
*
|
|
53
|
+
* A stored channel, its store key, and what keeps it: its own state (`'watched'`, `'active'`,
|
|
54
|
+
* `'querying-channel'`) and the names of its holders. If none, `releaseUnusedChannels()` removes
|
|
55
|
+
* it.
|
|
62
56
|
*/
|
|
63
57
|
export type ChannelUsage = {
|
|
64
58
|
channel: Channel;
|
|
@@ -69,13 +63,11 @@ export declare class ChannelManager extends WithSubscriptions {
|
|
|
69
63
|
client: StreamChat;
|
|
70
64
|
state: StateStore<ChannelManagerState>;
|
|
71
65
|
/**
|
|
72
|
-
* Every `Channel
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* list holds the channels it shows by linking them, which also tells it about removals and cid
|
|
78
|
-
* changes; other users hold theirs through claims.
|
|
66
|
+
* Every `Channel`, one per cid (a channel created from members sits under a temporary cid until
|
|
67
|
+
* {@link ChannelManager.changeChannelId}). A channel stays until it is deleted, the user is
|
|
68
|
+
* removed from it or logs out, or {@link ChannelManager.releaseUnusedChannels} removes it;
|
|
69
|
+
* removal runs {@link Channel.disconnect}. Lists hold the channels they show by linking them,
|
|
70
|
+
* others by claims.
|
|
79
71
|
*
|
|
80
72
|
* @internal
|
|
81
73
|
*/
|
|
@@ -83,61 +75,52 @@ export declare class ChannelManager extends WithSubscriptions {
|
|
|
83
75
|
protected _pipelines: Map<SupportedEventType, EventHandlerPipeline<ChannelManagerEventHandlerContext>>;
|
|
84
76
|
protected ownershipResolver?: PaginatorOwnershipResolver;
|
|
85
77
|
/**
|
|
86
|
-
* Instances replaced by a stored one ({@link ChannelManager.supersedeChannel}). Not in the store,
|
|
87
|
-
* they are
|
|
88
|
-
* ({@link ChannelManager.clearChannels}). Nothing disconnects them earlier, as the app may still hold
|
|
89
|
-
* them.
|
|
78
|
+
* Instances replaced by a stored one ({@link ChannelManager.supersedeChannel}). Not in the store,
|
|
79
|
+
* so they are disconnected at logout ({@link ChannelManager.clearChannels}).
|
|
90
80
|
*/
|
|
91
81
|
private readonly supersededChannels;
|
|
92
82
|
/**
|
|
93
|
-
* The `filterQueryResults` each registered paginator had before
|
|
94
|
-
*
|
|
95
|
-
* A server query bypasses the manager — the paginator fetches and ingests a page on its own, and
|
|
96
|
-
* the backend knows nothing about client-side ownership — so a "Work" (`{ team: 'work' }`) channel
|
|
97
|
-
* comes back in a catch-all list's page too and would render in both. `wrapPaginatorFiltering`
|
|
98
|
-
* therefore composes the ownership check onto that hook, which every page passes through.
|
|
99
|
-
*
|
|
100
|
-
* Keys = already wrapped (so re-inserting does not wrap twice); values = what to restore on
|
|
101
|
-
* removal, since a detached paginator must stop applying rules resolved against lists it left.
|
|
102
|
-
* Weakly keyed so a dropped paginator is not kept alive by this manager.
|
|
83
|
+
* The `filterQueryResults` each registered paginator had before `wrapPaginatorFiltering` wrapped
|
|
84
|
+
* it. Keys mark paginators already wrapped, values are restored on removal. Weakly keyed.
|
|
103
85
|
*/
|
|
104
86
|
protected filterQueryResultsBeforeWrapping: WeakMap<ChannelPaginator, (items: Channel[]) => Channel[]>;
|
|
105
87
|
protected static readonly defaultEventHandlers: ChannelManagerEventHandlers;
|
|
106
88
|
constructor({ client, eventHandlers, paginators, ownershipResolver, }: ChannelManagerOptions);
|
|
107
89
|
get paginators(): ChannelPaginator[];
|
|
108
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Returns the stored channel for a cid.
|
|
92
|
+
*
|
|
93
|
+
* @param cid - The channel's cid.
|
|
94
|
+
* @returns The stored channel, or `undefined` when none is stored.
|
|
95
|
+
*/
|
|
109
96
|
get(cid: string): Channel | undefined;
|
|
110
97
|
/**
|
|
111
98
|
* The instance a channel list should show for `channel`: the one that superseded it, else the one
|
|
112
|
-
* stored under its cid, else `channel` itself
|
|
113
|
-
*
|
|
114
|
-
* `undefined` when that instance is disconnected (`pendingDisposal`), stored or not: it receives
|
|
115
|
-
* no events, and a list that already shows it drops it at the next `releaseUnusedChannels()`.
|
|
99
|
+
* stored under its cid, else `channel` itself, so a list never displaces the stored instance.
|
|
100
|
+
* `undefined` when that instance is disconnected (`pendingDisposal`): it receives no events.
|
|
116
101
|
*
|
|
117
102
|
* @internal
|
|
118
103
|
*/
|
|
119
104
|
resolveListedChannel(channel: Channel): Channel | undefined;
|
|
120
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Returns every stored channel.
|
|
107
|
+
*
|
|
108
|
+
* @returns The stored channels.
|
|
109
|
+
*/
|
|
121
110
|
values(): Channel[];
|
|
122
111
|
/**
|
|
123
|
-
* Returns the channel for `type` and `id`, creating it if it
|
|
124
|
-
*
|
|
125
|
-
*
|
|
112
|
+
* Returns the channel for `type` and `id`, creating it if it is not stored yet (one instance per
|
|
113
|
+
* cid; a stored `pendingDisposal` channel is replaced by a fresh one). Use it instead of
|
|
114
|
+
* `new Channel()`.
|
|
126
115
|
*
|
|
127
|
-
* Leave out `id` and pass `data.members` for a distinct channel between those members
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* left unstored. A group with the same members as another needs its own `id` instead.
|
|
116
|
+
* Leave out `id` and pass `data.members` for a distinct channel between those members. It is
|
|
117
|
+
* stored under a temporary cid until `watch()`, `query()` or `create()` returns the real one; a
|
|
118
|
+
* stored distinct channel with the same loaded members is returned instead. If another instance
|
|
119
|
+
* holds the real cid by then, it stays stored and this one is left unstored. A group with the
|
|
120
|
+
* same members as another needs its own `id`.
|
|
133
121
|
*
|
|
134
122
|
* A channel created from members is {@link Channel.isProvisional} until its query is answered: it
|
|
135
|
-
* has no
|
|
136
|
-
* whose id the app generated and the server doesn't have yet: requests for it go to the server.
|
|
137
|
-
*
|
|
138
|
-
* A channel got this way stays stored until it is deleted, the current user is removed from it, or
|
|
139
|
-
* the user logs out. The SDK never releases it on its own; an app freeing memory calls
|
|
140
|
-
* {@link ChannelManager.releaseUnusedChannels}, which releases it only while nothing uses it.
|
|
123
|
+
* has no ID yet, so nothing but that query can be sent for it.
|
|
141
124
|
*
|
|
142
125
|
* ```ts
|
|
143
126
|
* const general = client.channelManager.ensure({ type: 'messaging', id: 'general' });
|
|
@@ -176,25 +159,15 @@ export declare class ChannelManager extends WithSubscriptions {
|
|
|
176
159
|
*/
|
|
177
160
|
changeChannelId(oldCid: string, newCid: string): boolean;
|
|
178
161
|
/**
|
|
179
|
-
* `previous`, created without an
|
|
180
|
-
* event or a
|
|
181
|
-
*
|
|
162
|
+
* `previous`, created without an ID, was answered with a cid `successor` already holds (stored by
|
|
163
|
+
* an event or a list meanwhile). `successor` stays the one instance and takes over: the response
|
|
164
|
+
* is applied to it like a `queryChannels` result (local messages are never removed),
|
|
165
|
+
* `previous`'s local messages (sending or failed) are added by ID (`successor`'s copy wins), and
|
|
166
|
+
* `previous`'s composer moves over when `previous` is open and `successor` is not.
|
|
182
167
|
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* - `previous`'s local messages (sending or failed), added by id; a message `successor` already has
|
|
187
|
-
* keeps `successor`'s copy;
|
|
188
|
-
* - `previous`'s composer, when `previous` is open and `successor` isn't: the user is typing in
|
|
189
|
-
* `previous`, and nobody in `successor`. When both are open, neither composer is overwritten.
|
|
190
|
-
*
|
|
191
|
-
* `successor` is marked watched only when the query asked to watch (`watch: true`): the server then
|
|
192
|
-
* watches the cid for this connection. A query without a watch leaves its watch status as it was.
|
|
193
|
-
*
|
|
194
|
-
* `previous`'s own entry (`storedUnder`, its temporary cid) is dropped first, without disconnecting
|
|
195
|
-
* it: its query is still being applied to it and it may be on screen. It is marked superseded
|
|
196
|
-
* (`state.supersededBy`) so its holders switch over, and tracked here until logout, so the SDK
|
|
197
|
-
* never loses track of it.
|
|
168
|
+
* `successor` is marked watched only when the query asked to watch. `previous` is dropped from
|
|
169
|
+
* the store (`storedUnder`) without disconnecting, as it may be on screen, marked superseded
|
|
170
|
+
* (`state.supersededBy`) so its holders switch over, and disconnected at logout.
|
|
198
171
|
*
|
|
199
172
|
* @internal
|
|
200
173
|
*/
|
|
@@ -203,42 +176,28 @@ export declare class ChannelManager extends WithSubscriptions {
|
|
|
203
176
|
watch?: boolean;
|
|
204
177
|
}): void;
|
|
205
178
|
/**
|
|
206
|
-
* Removes every stored channel the app disconnected (
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* one a holder holds in {@link ChannelManager.channelStore}: a channel list links each of its
|
|
217
|
-
* channels, while threads, the composer cache and an active channel search hold theirs through
|
|
218
|
-
* claims ({@link EntityStore.addClaim}).
|
|
219
|
-
*
|
|
220
|
-
* What remains is an unwatched snapshot nothing shows, which saves no request: using it again
|
|
221
|
-
* needs a query, which stores it again.
|
|
222
|
-
*
|
|
223
|
-
* The SDK never calls this: it can't see the channels an app keeps in its own state, such as a
|
|
224
|
-
* stopped watch kept for re-entry or search results held after the search ended. Call it when the
|
|
225
|
-
* app is done with what it held, for example after closing a search screen
|
|
226
|
-
* (`searchController.dispose()`, then this). A channel your code still uses but that none of the
|
|
227
|
-
* above keeps would be released, so keep it with {@link Channel.activate} first.
|
|
179
|
+
* Removes every stored channel the app disconnected (`pendingDisposal`), whatever holds it, then
|
|
180
|
+
* every one that is neither watched nor held; lists drop them. Kept: watched channels
|
|
181
|
+
* (`watching`, or `wasWatching` until restored), active ones ({@link Channel.activate}), ones
|
|
182
|
+
* being loaded, and ones held in {@link ChannelManager.channelStore} (lists link theirs; threads,
|
|
183
|
+
* the composer cache and channel search hold theirs through claims,
|
|
184
|
+
* {@link EntityStore.addClaim}).
|
|
185
|
+
*
|
|
186
|
+
* The SDK never calls this, as it cannot see channels an app keeps in its own state. Call it when
|
|
187
|
+
* the app is done with them (e.g. after `searchController.dispose()`), and keep a channel your
|
|
188
|
+
* code still uses with {@link Channel.activate} first.
|
|
228
189
|
*/
|
|
229
190
|
releaseUnusedChannels(): void;
|
|
230
191
|
/**
|
|
231
|
-
* Every stored channel with what keeps it, by the
|
|
232
|
-
* {@link ChannelManager.releaseUnusedChannels}
|
|
233
|
-
* call to it. For debugging tools.
|
|
192
|
+
* Every stored channel with what keeps it, by the rule of
|
|
193
|
+
* {@link ChannelManager.releaseUnusedChannels}. For debugging tools.
|
|
234
194
|
*
|
|
235
195
|
* @internal
|
|
236
196
|
*/
|
|
237
197
|
getChannelUsage(): ChannelUsage[];
|
|
238
198
|
/**
|
|
239
199
|
* Removes the channel stored under `cid` whatever uses it, and disconnects it
|
|
240
|
-
* ({@link Channel.disconnect}).
|
|
241
|
-
* Every list showing it drops it too, as the store's removal reaches each list's index.
|
|
200
|
+
* ({@link Channel.disconnect}). Every list showing it drops it too.
|
|
242
201
|
*
|
|
243
202
|
* @internal
|
|
244
203
|
*/
|
|
@@ -251,172 +210,113 @@ export declare class ChannelManager extends WithSubscriptions {
|
|
|
251
210
|
*/
|
|
252
211
|
clearChannels(): void;
|
|
253
212
|
/**
|
|
254
|
-
* Fans the client-owned `mutedChannels` out to every stored channel's
|
|
255
|
-
*
|
|
256
|
-
* the frequent `health.check` path.
|
|
213
|
+
* Fans the client-owned `mutedChannels` out to every stored channel's `state.muteStatus` (a
|
|
214
|
+
* channel republishes only when its status changed, as this runs on every `health.check`).
|
|
257
215
|
*
|
|
258
216
|
* @internal
|
|
259
217
|
*/
|
|
260
218
|
reflectMutedChannels(): void;
|
|
261
219
|
/**
|
|
262
|
-
* Resets the AI indicator state to `Idle` on every stored channel. Invoked from
|
|
263
|
-
*
|
|
220
|
+
* Resets the AI indicator state to `Idle` on every stored channel. Invoked from
|
|
221
|
+
* `closeConnection`, a deliberate shutdown that triggers no WS event.
|
|
264
222
|
*
|
|
265
223
|
* @internal
|
|
266
224
|
*/
|
|
267
225
|
resetAIStateOnChannels(): void;
|
|
268
226
|
/**
|
|
269
|
-
* Demotes every
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* disconnected (`disconnect()`), stays `NotWatching` and must not be resurrected by a reconnect.
|
|
275
|
-
*
|
|
276
|
-
* Invoked from two places on the WebSocket, because neither covers the other:
|
|
277
|
-
* `StableWSConnection._setHealth(false)` for an abnormal close/error, and `closeConnection()` for a
|
|
278
|
-
* deliberate shutdown (e.g. mobile backgrounding), whose `disconnect()` writes the status through
|
|
279
|
-
* `_applyHealth` and so never reaches `_setHealth`. After an `enableWSFallback` switch the
|
|
280
|
-
* long-poll calls it too, from `WSConnectionFallback._setState()` whenever going closed or
|
|
281
|
-
* disconnected takes the status offline.
|
|
227
|
+
* Demotes every `Watching` channel to `WasWatching`: the server keys watches by connection ID, so
|
|
228
|
+
* a dropped socket ends them all. Channels stopped on purpose or disconnected stay `NotWatching`.
|
|
229
|
+
* Called when the socket goes unhealthy or offline (`StableWSConnection`, `WSConnectionFallback`)
|
|
230
|
+
* and by `closeConnection()`, whose `disconnect()` writes health through `_applyHealth` and never
|
|
231
|
+
* reaches `_setHealth`.
|
|
282
232
|
*
|
|
283
233
|
* @internal
|
|
284
234
|
*/
|
|
285
235
|
markChannelsWatchInterrupted(): void;
|
|
286
236
|
get pipelines(): Map<SupportedEventType, EventHandlerPipeline<EventHandlerContext>>;
|
|
287
237
|
private get ctx();
|
|
288
|
-
/**
|
|
289
|
-
* Returns deep copy of default handlers mapping.
|
|
290
|
-
* The defaults can be enriched with custom handlers or the custom handlers can be replaced.
|
|
291
|
-
*/
|
|
238
|
+
/** Returns a copy of the default handler mapping, to enrich or replace. */
|
|
292
239
|
static getDefaultHandlers(): ChannelManagerEventHandlers;
|
|
293
240
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* Available as a setter because the manager is constructed by the client, before the app has had
|
|
300
|
-
* a chance to create its paginators — their ids are therefore only known later.
|
|
241
|
+
* Sets the rule deciding which paginator(s) own a channel matched by several. Pass paginator IDs
|
|
242
|
+
* (highest priority first) for the built-in priority resolver, a custom resolver, or `undefined`
|
|
243
|
+
* for the default (every matching paginator keeps the channel). A setter because the client
|
|
244
|
+
* builds the manager before the app creates its paginators.
|
|
301
245
|
*/
|
|
302
246
|
setOwnershipResolver(ownershipResolver?: PaginatorOwnershipResolver | string[]): void;
|
|
303
|
-
/**
|
|
304
|
-
* Which paginators should own the channel among the ones that matched.
|
|
305
|
-
* Default behavior keeps the channel in all matching paginators.
|
|
306
|
-
*/
|
|
247
|
+
/** Ids of the paginators that own the channel among the matches. Empty: all of them. */
|
|
307
248
|
resolveOwnership(channel: Channel, matchingPaginators: ChannelPaginator[]): Set<string>;
|
|
308
249
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
* in the list(s) without a full re-query. `ingestItem` dedupes by cid and inserts in sort
|
|
316
|
-
* order, so calling this repeatedly is safe. A channel created from members is ignored until its
|
|
317
|
-
* first query gives it an id: ingest it once `watch()` (or `ensureWatched()`) resolves.
|
|
318
|
-
*
|
|
319
|
-
* A channel that matches no paginator is not added anywhere. To have such channels still
|
|
320
|
-
* appear, register a catch-all paginator (empty filter) with the lowest ownership priority as
|
|
321
|
-
* a local fallback list.
|
|
250
|
+
* Routes a channel into the paginator(s) that own it and removes it from any list it no longer
|
|
251
|
+
* belongs to, as for live WS updates. Use it to surface a channel the app just opened (a search
|
|
252
|
+
* result, a new DM) without a re-query; repeated calls are safe. A channel created from members
|
|
253
|
+
* is ignored until its first query gives it an ID. A channel matching no paginator is added
|
|
254
|
+
* nowhere: register a catch-all paginator (empty filter) with the lowest ownership priority as a
|
|
255
|
+
* fallback.
|
|
322
256
|
*/
|
|
323
257
|
ingestChannel(input: Channel): void;
|
|
324
258
|
/**
|
|
325
|
-
* Drops a channel from the lists whose filters it no longer matches, adding it nowhere.
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* a channel belong to a list, and `ingestChannel` would pull unloaded channels into matching ones.
|
|
259
|
+
* Drops a channel from the lists whose filters it no longer matches, adding it nowhere. For state
|
|
260
|
+
* the client changes without an event naming the channel (e.g. zeroing every unread count on a
|
|
261
|
+
* global read). Removal-only: becoming read cannot make a channel belong to a list (the backend
|
|
262
|
+
* rejects `has_unread: false`).
|
|
330
263
|
*/
|
|
331
264
|
dropFromUnmatchedLists(channel: Channel): void;
|
|
332
|
-
/**
|
|
333
|
-
* Filter a page of query results for a specific paginator according to ownership rules.
|
|
334
|
-
* If no owners are specified by the resolver, all matching paginators keep the item.
|
|
335
|
-
*/
|
|
265
|
+
/** Filters a page of query results for `paginator` by ownership (no owners: all matches keep). */
|
|
336
266
|
protected filterItemsByOwnership({ paginator, items, }: {
|
|
337
267
|
paginator: ChannelPaginator;
|
|
338
268
|
items: Channel[];
|
|
339
269
|
}): Channel[];
|
|
340
270
|
/**
|
|
341
|
-
* Makes a registered paginator apply
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* - **WS events / `ingestChannel`** — the manager routes the channel and consults
|
|
346
|
-
* `resolveOwnership` before ingesting, so exclusivity holds by construction.
|
|
347
|
-
* - **A server query** — `paginator.next()` (a `ChannelList` scrolling, `reload()`) queries and
|
|
348
|
-
* ingests on its own; the manager is not involved. Without this wrapper a page would land in
|
|
349
|
-
* every list whose *server-side* filter matched it, so a channel matching both
|
|
350
|
-
* `channels:archived` and `channels:default` would show up in both lists until some later event
|
|
351
|
-
* re-routed it — the exact duplication the resolver exists to prevent.
|
|
352
|
-
*
|
|
353
|
-
* Wrapping (rather than subclassing or a constructor hook) is what lets the manager inject this
|
|
354
|
-
* into paginators it does not construct: `filterQueryResults` is an instance property, so the
|
|
355
|
-
* original is captured here and handed back by `unwrapPaginatorFiltering` when the paginator is
|
|
356
|
-
* detached. The paginator's own filtering runs first and stays authoritative — ownership only ever
|
|
357
|
-
* removes further items, never adds any back.
|
|
358
|
-
*
|
|
359
|
-
* Idempotent: the `WeakMap` guard keeps a re-inserted paginator from being wrapped twice, which
|
|
360
|
-
* would filter the same page repeatedly and, worse, lose the reference to the true original.
|
|
271
|
+
* Makes a registered paginator apply the ownership rules to the pages it fetches itself (server
|
|
272
|
+
* queries bypass the manager), by composing `filterItemsByOwnership` onto its
|
|
273
|
+
* `filterQueryResults`. Its own filtering runs first. Idempotent: wrapping twice would lose the
|
|
274
|
+
* true original.
|
|
361
275
|
*/
|
|
362
276
|
protected wrapPaginatorFiltering(paginator: ChannelPaginator): void;
|
|
363
277
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* rules: those are resolved against the paginators the manager still holds, so a detached
|
|
367
|
-
* paginator would drop channels owned by lists it is no longer part of.
|
|
278
|
+
* Restores the `filterQueryResults` the paginator had before `wrapPaginatorFiltering`: a detached
|
|
279
|
+
* paginator must not keep applying ownership rules resolved against lists it left.
|
|
368
280
|
*/
|
|
369
281
|
protected unwrapPaginatorFiltering(paginator: ChannelPaginator): void;
|
|
370
282
|
getPaginatorById(id: string): ChannelPaginator | undefined;
|
|
371
283
|
/**
|
|
372
|
-
*
|
|
373
|
-
* `removePaginator` build on
|
|
374
|
-
*
|
|
375
|
-
* `removePaginator` detaches them; a repeated id keeps only its first occurrence.
|
|
284
|
+
* Replaces the whole set of lists in one state update (the primitive `insertPaginator` and
|
|
285
|
+
* `removePaginator` build on). Dropped paginators are detached as `removePaginator` does; a
|
|
286
|
+
* repeated ID keeps only its first occurrence.
|
|
376
287
|
*
|
|
377
288
|
* @param paginators - The lists this manager should hold, in render order.
|
|
378
289
|
*/
|
|
379
290
|
setPaginators(paginators: ChannelPaginator[]): void;
|
|
380
291
|
/**
|
|
381
|
-
*
|
|
382
|
-
* released exactly as `removePaginator` releases it (ownership-filtering wrapper removed,
|
|
383
|
-
* scheduled query canceled, loaded items kept), in a single state update.
|
|
292
|
+
* Detaches every list as `removePaginator` does, in one update.
|
|
384
293
|
*
|
|
385
294
|
* @returns The paginators the manager held, in the order it held them.
|
|
386
295
|
*/
|
|
387
296
|
clearPaginators(): ChannelPaginator[];
|
|
388
297
|
/**
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* If index provided → insert (or move) at that index.
|
|
298
|
+
* Inserts a paginator. One already held with the same ID is removed first, so this moves it, or
|
|
299
|
+
* replaces it when it is another instance.
|
|
392
300
|
*
|
|
393
|
-
* @param params - The insertion parameters.
|
|
394
301
|
* @param params.paginator - The paginator to insert or move.
|
|
395
|
-
* @param params.index - Target index
|
|
302
|
+
* @param params.index - Target index, clamped to the list. Defaults to appending.
|
|
396
303
|
*/
|
|
397
304
|
insertPaginator({ paginator, index }: {
|
|
398
305
|
paginator: ChannelPaginator;
|
|
399
306
|
index?: number;
|
|
400
307
|
}): void;
|
|
401
308
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* Its loaded items are left untouched: the paginator can be re-inserted later, or kept and
|
|
407
|
-
* queried on its own. Any query scheduled through `nextDebounced` is canceled, so a list that was
|
|
408
|
-
* just removed does not fire one more request.
|
|
309
|
+
* Removes a paginator: it leaves `state.paginators`, stops receiving WS-driven updates and gets
|
|
310
|
+
* its own `filterQueryResults` back. Its loaded items stay, and a query scheduled through
|
|
311
|
+
* `nextDebounced` is cancelled.
|
|
409
312
|
*
|
|
410
|
-
* @param paginatorOrId - The paginator to remove, or its
|
|
313
|
+
* @param paginatorOrId - The paginator to remove, or its ID.
|
|
411
314
|
* @returns The removed paginator, or `undefined` when this manager did not hold it.
|
|
412
315
|
*/
|
|
413
316
|
removePaginator(paginatorOrId: ChannelPaginator | string): ChannelPaginator | undefined;
|
|
414
317
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* user and become invalid on `disconnectUser`. Each paginator returns to "never queried"
|
|
418
|
-
* (`items: undefined`) with its debounced query canceled. Deliberately not named `resetState` —
|
|
419
|
-
* this manager's own `state` *is* the paginator list, which this must not touch.
|
|
318
|
+
* Discards the loaded data of every registered list but keeps the registrations: each paginator
|
|
319
|
+
* returns to "never queried" (`items: undefined`) with its debounced query cancelled.
|
|
420
320
|
*/
|
|
421
321
|
resetPaginatorStates(): void;
|
|
422
322
|
addEventHandler({ eventType, ...payload }: {
|
|
@@ -430,31 +330,18 @@ export declare class ChannelManager extends WithSubscriptions {
|
|
|
430
330
|
eventType: SupportedEventType;
|
|
431
331
|
handlers: FindEventHandlerParams<EventHandlerContext>[];
|
|
432
332
|
}): void;
|
|
433
|
-
/**
|
|
333
|
+
/** Subscribes to client events. The returned function releases this registration. */
|
|
434
334
|
registerSubscriptions(): Unsubscribe;
|
|
435
335
|
ensurePipeline(eventType: SupportedEventType): EventHandlerPipeline<EventHandlerContext>;
|
|
436
336
|
reload: () => Promise<PromiseSettledResult<void>[]>;
|
|
437
337
|
/**
|
|
438
|
-
* Re-
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
* `{ keepPreviousItems: true, reset: 'yes' }` is the non-destructive refresh: `reset` restarts the
|
|
447
|
-
* window at page 1, while `keepPreviousItems` merges the fetched page into the loaded list instead
|
|
448
|
-
* of replacing it and keeps the item index populated — the latter is what stops a concurrent
|
|
449
|
-
* offline-replay ingest from rebuilding the list out of a cleared index. Notably NOT `silent`: the
|
|
450
|
-
* `isLoading` transition it would suppress is the in-flight guard that keeps a second overlapping
|
|
451
|
-
* query from being issued.
|
|
452
|
-
*
|
|
453
|
-
* Distinct from {@link ChannelManager.reload}, which is a destructive `reset` that blanks each list
|
|
454
|
-
* to its loading state.
|
|
455
|
-
*
|
|
456
|
-
* Paginators that were never queried are skipped: they run their own first query when they mount,
|
|
457
|
-
* and querying them here would race it.
|
|
338
|
+
* Re-runs every loaded list's own first-page query, the channel-list half of connection recovery
|
|
339
|
+
* ({@link ConnectionRecoveryManager}). The page's channels are re-watched (`queryChannels`
|
|
340
|
+
* watches by default), those below it come back through `restoreInterruptedWatch`.
|
|
341
|
+
* Never-queried paginators are skipped: they run their own first query on mount, and querying them
|
|
342
|
+
* here would race it. Unlike {@link ChannelManager.reload}, it merges the page into the loaded
|
|
343
|
+
* list (`keepPreviousItems`) instead of blanking it, and is not `silent`: the `isLoading`
|
|
344
|
+
* transition guards against an overlapping query.
|
|
458
345
|
*/
|
|
459
346
|
recover: () => Promise<PromiseSettledResult<void>[]>;
|
|
460
347
|
}
|
|
@@ -3,22 +3,13 @@ import type { TimestampNS } from './types';
|
|
|
3
3
|
import { WithSubscriptions } from './utils/WithSubscriptions';
|
|
4
4
|
import type { Channel } from './channel';
|
|
5
5
|
export type CooldownTimerState = {
|
|
6
|
-
/**
|
|
7
|
-
* Slow mode cooldown interval in seconds. Change reported via channel.updated WS event.
|
|
8
|
-
*/
|
|
6
|
+
/** Slow mode cooldown interval in seconds. Change reported via channel.updated WS event. */
|
|
9
7
|
cooldownConfigSeconds: number;
|
|
10
|
-
/**
|
|
11
|
-
* Whether the current user can skip slow mode. Change is not reported via WS.
|
|
12
|
-
*/
|
|
8
|
+
/** Whether the current user can skip slow mode. Change is not reported via WS. */
|
|
13
9
|
canSkipCooldown: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Creation timestamp of the latest message authored by the current user in this channel, in unix
|
|
16
|
-
* nanoseconds as the API sends it. Change reported via message.new WS event.
|
|
17
|
-
*/
|
|
10
|
+
/** Creation time of the current user's latest message in this channel, in unix nanoseconds. */
|
|
18
11
|
ownLatestMessageTimestamp?: TimestampNS;
|
|
19
|
-
/**
|
|
20
|
-
* Remaining cooldown in whole seconds (rounded).
|
|
21
|
-
*/
|
|
12
|
+
/** Remaining cooldown in whole seconds (rounded). */
|
|
22
13
|
cooldownRemaining: number;
|
|
23
14
|
};
|
|
24
15
|
export declare class CooldownTimer extends WithSubscriptions {
|
|
@@ -33,22 +24,16 @@ export declare class CooldownTimer extends WithSubscriptions {
|
|
|
33
24
|
get canSkipCooldown(): boolean;
|
|
34
25
|
get ownLatestMessageTimestamp(): TimestampNS | undefined;
|
|
35
26
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* `Channel` calls this right after constructing the timer and unregisters it in `disconnect`, the same
|
|
40
|
-
* way it drives `messageReceiptsTracker`. That replaces four imperative `cooldownTimer.refresh()` calls
|
|
41
|
-
* in `Channel`, and the three WS-event handlers that used to live here — which duplicated those calls
|
|
42
|
-
* and never ran, because nothing registered them. Between them the two arrangements still missed every
|
|
43
|
-
* `query()`, and any `updatePartial` that changed `cooldown` without changing capabilities.
|
|
27
|
+
* Derives the timer from `channel.state` (`cooldown`, `ownCapabilities`) and the message
|
|
28
|
+
* paginator's store (the current user's latest message). `Channel` registers it on construction
|
|
29
|
+
* and unregisters it in `disconnect`.
|
|
44
30
|
*/
|
|
45
31
|
registerSubscriptions: () => void;
|
|
46
32
|
setCooldownRemaining: (cooldownRemaining: number) => void;
|
|
47
33
|
clearTimeout: () => void;
|
|
48
34
|
refresh: () => void;
|
|
49
35
|
/**
|
|
50
|
-
*
|
|
51
|
-
* Prefer calling this when you already know it (e.g. from an event).
|
|
36
|
+
* Sets the own latest message timestamp and recomputes the remaining time.
|
|
52
37
|
*
|
|
53
38
|
* @param timestamp - Unix nanoseconds, as the API sends it.
|
|
54
39
|
*/
|