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
|
@@ -18,26 +18,17 @@ export type MessageFocusSignalState = {
|
|
|
18
18
|
};
|
|
19
19
|
export type JumpToMessageOptions = {
|
|
20
20
|
pageSize?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Optional reason attached to emitted focus signal.
|
|
23
|
-
* Defaults to `jump-to-message`.
|
|
24
|
-
*/
|
|
21
|
+
/** Reason attached to the emitted focus signal. Defaults to `jump-to-message`. */
|
|
25
22
|
focusReason?: MessageFocusReason;
|
|
26
|
-
/**
|
|
27
|
-
* TTL for the emitted focus signal in milliseconds.
|
|
28
|
-
* Defaults to `3000`.
|
|
29
|
-
*/
|
|
23
|
+
/** TTL of the emitted focus signal in milliseconds. Defaults to `3000`. */
|
|
30
24
|
focusSignalTtlMs?: number;
|
|
31
|
-
/**
|
|
32
|
-
* If true, suppresses focus signal emission after a successful jump.
|
|
33
|
-
*/
|
|
25
|
+
/** Suppresses the focus signal after a successful jump. */
|
|
34
26
|
suppressFocusSignal?: boolean;
|
|
35
27
|
/**
|
|
36
|
-
* Also
|
|
37
|
-
* loads the window around the message asks to watch too, so it
|
|
38
|
-
* already loaded is
|
|
39
|
-
*
|
|
40
|
-
* the messages.
|
|
28
|
+
* Also watches the channel (so it receives events) when it is not watched yet. The request that
|
|
29
|
+
* loads the window around the message asks to watch too, so it stays one request, and a message
|
|
30
|
+
* already loaded is loaded again. Ignored for a thread's reply list (its request cannot watch)
|
|
31
|
+
* and when the paginator's `doRequest` loads the messages.
|
|
41
32
|
*/
|
|
42
33
|
watchChannel?: boolean;
|
|
43
34
|
};
|
|
@@ -48,107 +39,76 @@ export type MessagePaginatorFilter = {
|
|
|
48
39
|
};
|
|
49
40
|
export type MessagePaginatorState = PaginatorState<LocalMessage>;
|
|
50
41
|
export type MessageQueryShape = MessagePaginationParams | PinnedMessagePaginationOptions;
|
|
51
|
-
/**
|
|
52
|
-
* A message's `created_at` as the comparable wire timestamp (unix nanoseconds), or `null` when it
|
|
53
|
-
* is absent or not a finite number.
|
|
54
|
-
*
|
|
55
|
-
* Accepts `null`/`undefined` so callers holding an optional message (e.g.
|
|
56
|
-
* `MessagePaginator.lastMessage`) do not each repeat the guard.
|
|
57
|
-
*/
|
|
42
|
+
/** A message's `created_at` (unix nanoseconds), or `null` when absent or not finite. */
|
|
58
43
|
export declare const getMessageCreatedAtTimestamp: (message: LocalMessage | null | undefined) => TimestampNS | null;
|
|
59
44
|
export type MessagePaginatorOptions = {
|
|
60
45
|
channel: Channel;
|
|
61
46
|
id?: string;
|
|
62
47
|
itemIndex?: ItemIndexApi<LocalMessage>;
|
|
63
48
|
parentMessageId?: string;
|
|
64
|
-
/**
|
|
65
|
-
* Sort passed to backend message/replies query.
|
|
66
|
-
* Does not affect in-memory item ordering.
|
|
67
|
-
*/
|
|
49
|
+
/** Sort sent to the backend messages/replies query. Does not affect in-memory ordering. */
|
|
68
50
|
requestSort?: MessagePaginatorSort;
|
|
69
51
|
/**
|
|
70
52
|
* @deprecated Use `requestSort` instead.
|
|
71
53
|
*/
|
|
72
54
|
sort?: MessagePaginatorSort;
|
|
73
|
-
/**
|
|
74
|
-
* In-memory ordering for items exposed by paginator state.
|
|
75
|
-
*/
|
|
55
|
+
/** In-memory ordering of the items exposed by paginator state. */
|
|
76
56
|
itemOrder?: MessagePaginatorSort;
|
|
77
57
|
paginatorOptions?: PaginatorOptions<LocalMessage, MessageQueryShape>;
|
|
78
58
|
};
|
|
79
59
|
/**
|
|
80
|
-
* Options for {@link MessageIntervalPaginator.mergeNewestPage} that enable
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* Throughout, `page` is the newest window the server returned for `mergeNewestPage`, and "`page`'s
|
|
86
|
-
* newest / oldest message" are its bounds by `created_at`. With NO options, `mergeNewestPage` prunes
|
|
87
|
-
* any loaded message that falls WITHIN `page`'s `created_at` span but is absent from it —
|
|
88
|
-
* unconditionally safe (a message that arrived live during the caller's fetch is always strictly
|
|
89
|
-
* newer than `page`'s newest message, so it can never fall in that span). `candidateIds` widens the
|
|
90
|
-
* reconcilable window at the TOP edge; `requestedLimit` only tunes the `hasMoreTail` affordance and
|
|
91
|
-
* can never remove a message:
|
|
60
|
+
* Options for {@link MessageIntervalPaginator.mergeNewestPage} that enable reconciling messages
|
|
61
|
+
* hard-deleted while the client was offline (no event reaches other clients). With no options it
|
|
62
|
+
* prunes loaded messages inside `page`'s `created_at` span that are absent from it, which is always
|
|
63
|
+
* safe: a live arrival is newer than `page`'s newest message. `candidateIds` widens reconciliation
|
|
64
|
+
* at the top edge; `requestedLimit` tunes `hasMoreTail` and gates the below-window probe.
|
|
92
65
|
*/
|
|
93
66
|
export type MergeNewestPageOptions = {
|
|
94
67
|
/**
|
|
95
|
-
* The `limit`
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* {@link MessageIntervalPaginator.pageReachedChannelStart}); a larger over-request — e.g.
|
|
101
|
-
* `channel.reload` re-fetching the whole loaded window to reconcile as much as possible — may have
|
|
102
|
-
* been silently server-capped, so its short page is ignored rather than mistaken for reaching the
|
|
103
|
-
* start.
|
|
68
|
+
* The `limit` of the query that produced `page`. Derives `hasMoreTail` and, when not smaller than
|
|
69
|
+
* the loaded count, enables the below-window reached-start probe. Trusted for `hasMoreTail` only
|
|
70
|
+
* when not larger than the paginator's `pageSize` (see
|
|
71
|
+
* {@link MessageIntervalPaginator.pageReachedChannelStart}): a larger over-request (e.g.
|
|
72
|
+
* `channel.reload`) may have been server-capped.
|
|
104
73
|
*/
|
|
105
74
|
requestedLimit?: number;
|
|
106
75
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* message that arrived live during the fetch are indistinguishable by timestamp — only the pre-fetch
|
|
111
|
-
* snapshot separates them (a live arrival is not in it). Must be captured before the await; the
|
|
112
|
-
* paginator's own items at merge time already include any live arrival.
|
|
76
|
+
* Loaded message IDs snapshotted before the caller's fetch await. Needed to prune a hard-deleted
|
|
77
|
+
* message newer than `page`'s newest and to reconcile an empty `page`: at or above that edge only
|
|
78
|
+
* the pre-fetch snapshot tells a just-deleted message from one that arrived live during the fetch.
|
|
113
79
|
*/
|
|
114
80
|
candidateIds?: ReadonlySet<string>;
|
|
115
81
|
};
|
|
116
|
-
/**
|
|
117
|
-
* Options for {@link MessageIntervalPaginator.seedFirstPageSync}, the synchronous channel-open seed.
|
|
118
|
-
*/
|
|
82
|
+
/** Options for {@link MessageIntervalPaginator.seedFirstPageSync}, the channel-open seed. */
|
|
119
83
|
export type SeedFirstPageOptions = {
|
|
120
84
|
/**
|
|
121
|
-
* When true and the paginator
|
|
122
|
-
* {@link MessageIntervalPaginator.mergeNewestPage}
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* connection recovery) share one reconciling seed path. Left false for the differently-sorted
|
|
126
|
-
* pinned list, and a no-op on a cold open (nothing loaded to fold).
|
|
85
|
+
* When true and the paginator was already seeded, folds the page in via
|
|
86
|
+
* {@link MessageIntervalPaginator.mergeNewestPage} instead of a plain first-page ingest, so
|
|
87
|
+
* `channel.reload`, the channel-list hydrate and connection recovery share one reconciling path.
|
|
88
|
+
* Leave false for the pinned list (different sort). No-op on a cold open.
|
|
127
89
|
*/
|
|
128
90
|
reconcile?: boolean;
|
|
129
91
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* without mistaking a message that arrived live during the fetch for a delete. Only consulted when
|
|
133
|
-
* {@link reconcile} is set and a window is already loaded.
|
|
92
|
+
* Message IDs snapshotted before the caller's network await, forwarded to
|
|
93
|
+
* {@link MergeNewestPageOptions.candidateIds}. Only used when {@link reconcile} is set.
|
|
134
94
|
*/
|
|
135
95
|
candidateIds?: ReadonlySet<string>;
|
|
136
96
|
};
|
|
137
97
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
98
|
+
* A message list with a configurable backend request sort and a stable in-memory item order.
|
|
99
|
+
* Ingested items are filtered only by local predicates (`filterQueryResults`).
|
|
140
100
|
*/
|
|
141
101
|
export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage, MessageQueryShape> {
|
|
142
102
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
103
|
+
* Holder name of this list's index in the message store. A getter, so a subclass's value is in
|
|
104
|
+
* place while the base constructor builds the index.
|
|
145
105
|
*/
|
|
146
106
|
protected get holderName(): string;
|
|
147
107
|
state: StateStore<MessagePaginatorState>;
|
|
148
108
|
private readonly _id;
|
|
149
109
|
/** The channel this list belongs to. A thread's reply list holds its parent channel. */
|
|
150
110
|
readonly channel: Channel;
|
|
151
|
-
/** Set when this is a thread's reply list, to the parent message's
|
|
111
|
+
/** Set when this is a thread's reply list, to the parent message's ID. */
|
|
152
112
|
readonly parentMessageId?: string;
|
|
153
113
|
readonly messageFocusSignal: StateStore<MessageFocusSignalState>;
|
|
154
114
|
private clearMessageFocusSignalTimeoutId;
|
|
@@ -156,91 +116,70 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
|
|
|
156
116
|
protected _requestSort: MessagePaginatorSort;
|
|
157
117
|
protected _itemOrder: MessagePaginatorSort;
|
|
158
118
|
protected _nextQueryShape: MessageQueryShape | undefined;
|
|
159
|
-
/** Pending below-window reached-start probe (exposed
|
|
119
|
+
/** Pending below-window reached-start probe (exposed so tests can await it). */
|
|
160
120
|
private _belowWindowReconcile?;
|
|
161
121
|
sortComparator: (a: LocalMessage, b: LocalMessage) => number;
|
|
162
122
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
123
|
+
* Whether a message belongs in intervals and state. Keep it consistent with `filterQueryResults`
|
|
124
|
+
* and cursor flag derivation.
|
|
165
125
|
*/
|
|
166
126
|
shouldIncludeMessageInInterval(message: LocalMessage): boolean;
|
|
167
127
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
128
|
+
* Reconciles the held messages that changed in the entity store.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
* @param batch - The change batch from the store.
|
|
132
|
+
* @param batch.changedIds - IDs of the watched messages that changed.
|
|
173
133
|
*/
|
|
174
134
|
onEntitiesChanged({ changedIds }: EntityStoreChangeBatch): void;
|
|
175
135
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
136
|
+
* Drops a message from this paginator's windows after the entity store removed it.
|
|
137
|
+
*
|
|
138
|
+
* @internal
|
|
139
|
+
* @param id - ID of the removed message.
|
|
140
|
+
* @param message - The removed message.
|
|
178
141
|
*/
|
|
179
142
|
onEntityRemoved(id: string, message: unknown): void;
|
|
180
|
-
/**
|
|
181
|
-
* Entity-store subscriber flush (the optional `EntityStoreSubscriber.flushState`): the `EntityStore`
|
|
182
|
-
* calls this after an optimistic (local-user) write so the change renders without throttle delay.
|
|
183
|
-
* Delegates to the base's generic {@link BasePaginator.flushPendingPublishes}.
|
|
184
|
-
*/
|
|
143
|
+
/** Entity-store subscriber flush after an optimistic (local-user) write: skips the throttle. */
|
|
185
144
|
flushState(): void;
|
|
186
|
-
/**
|
|
187
|
-
* UI-driven "hold off on pruning" signal, set via {@link setPruningSuspended}. Defaults to not
|
|
188
|
-
* suspended, so a paginator with no UI attached still honours its configured cap.
|
|
189
|
-
*/
|
|
145
|
+
/** UI-driven "hold off on pruning" signal ({@link setPruningSuspended}). Off by default. */
|
|
190
146
|
protected get isPruningSuspended(): boolean;
|
|
191
147
|
private _pruningSuspended;
|
|
192
148
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* scroll back. Only meaningful alongside `maxLoadedItems`.
|
|
197
|
-
*
|
|
198
|
-
* Deliberately a plain field rather than a `StateStore` — nothing observes it, and a scroll-driven
|
|
199
|
-
* signal must not be able to cost a render.
|
|
149
|
+
* Holds off dropping the oldest loaded messages, so pruning does not pull content from under a user
|
|
150
|
+
* reading near them: the window may grow past `maxLoadedItems` until they scroll back. A plain
|
|
151
|
+
* field, not a `StateStore`: nothing observes it and a scroll-driven signal must not cost a render.
|
|
200
152
|
*/
|
|
201
153
|
setPruningSuspended: (suspended: boolean) => void;
|
|
202
154
|
/**
|
|
203
|
-
* A message
|
|
204
|
-
*
|
|
205
|
-
* never become the window's tailward cursor (its id would go out as `id_lt` and mean nothing to the
|
|
206
|
-
* server).
|
|
155
|
+
* A message anchors pagination once the server has acknowledged it. This keeps an unsent message
|
|
156
|
+
* out of both halves of a prune and stops its ID from becoming the tailward cursor (`id_lt`).
|
|
207
157
|
*/
|
|
208
158
|
protected isPaginationAnchorable(item: LocalMessage | undefined): boolean;
|
|
209
159
|
protected get intervalItemIdsAreHeadFirst(): boolean;
|
|
210
160
|
protected get intervalSortDirection(): 'asc' | 'desc';
|
|
211
161
|
constructor({ channel, id, itemIndex, parentMessageId, requestSort, sort, itemOrder, paginatorOptions, }: MessagePaginatorOptions, builtInDefaults?: Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>);
|
|
212
162
|
/**
|
|
213
|
-
* Memoized
|
|
214
|
-
*
|
|
215
|
-
* are stable.
|
|
216
|
-
*
|
|
217
|
-
* Safe to build once: both close over `this` and read `_itemOrder`, which is assigned in the
|
|
218
|
-
* constructor and has no setter.
|
|
163
|
+
* Memoized: `initializeConfig` folds it in and skips the publish when nothing moved, which needs
|
|
164
|
+
* stable references. Safe to build once: `_itemOrder` is set in the constructor, with no setter.
|
|
219
165
|
*/
|
|
220
166
|
private intervalBehaviour?;
|
|
221
167
|
private buildIntervalBehaviour;
|
|
222
168
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* Contributed to the base derivation rather than written after it — see
|
|
227
|
-
* {@link BasePaginator.getBehaviourOverrides}. That is what keeps one re-derivation to one publish,
|
|
228
|
-
* and stops the intermediate publish that had these two stripped.
|
|
169
|
+
* Installs cursor derivation and item ordering on `config` through the base derivation
|
|
170
|
+
* ({@link BasePaginator.getBehaviourOverrides}), so one re-derivation is one publish.
|
|
229
171
|
*/
|
|
230
172
|
protected getBehaviourOverrides(): Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>;
|
|
231
173
|
/**
|
|
232
|
-
* The constructor's route to the same overlay.
|
|
233
|
-
*
|
|
234
|
-
* own fields were initialized.
|
|
174
|
+
* The constructor's route to the same overlay. It calls the private builder, not the overridable
|
|
175
|
+
* hook, which would run a subclass override before its fields are initialized.
|
|
235
176
|
*/
|
|
236
177
|
protected installIntervalBehaviour(): void;
|
|
237
178
|
get id(): string;
|
|
238
179
|
get sort(): MessagePaginatorSort;
|
|
239
180
|
get requestSort(): MessagePaginatorSort;
|
|
240
181
|
get itemOrder(): MessagePaginatorSort;
|
|
241
|
-
/**
|
|
242
|
-
* Even though we do not send filters object to the server, we need to have filters for client-side item ingestion logic.
|
|
243
|
-
*/
|
|
182
|
+
/** Not sent to the server: drives client-side item ingestion. */
|
|
244
183
|
buildMatchFilters: () => MessagePaginatorFilter;
|
|
245
184
|
protected getNextQueryShape({ direction, }: Omit<PaginationQueryParams<MessageQueryShape>, 'isFirstPageQuery'>): MessageQueryShape;
|
|
246
185
|
getCursorFromQueryResults: ({ direction, items, }: {
|
|
@@ -256,169 +195,88 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
|
|
|
256
195
|
*/
|
|
257
196
|
query: ({ direction, requestOptions, }: PaginationQueryParams<MessageQueryShape>) => Promise<PaginationQueryReturnValue<LocalMessage>>;
|
|
258
197
|
/**
|
|
259
|
-
*
|
|
260
|
-
* `watch`/`create`,
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* (`
|
|
264
|
-
*
|
|
265
|
-
* the `last_read_message_id` / `last_delivered_message_id`. `postQueryReconcile` is fully
|
|
266
|
-
* synchronous (filtering is a local predicate), so seeding here guarantees the paginator is
|
|
267
|
-
* populated before the reconcile runs. First-page reconciliation also takes the unread snapshot.
|
|
198
|
+
* Seeds the paginator with the page a channel-open query just fetched (`Channel.query` with
|
|
199
|
+
* `watch`/`create`, `client.hydrateChannels`). Those paths hydrate the read state in the same
|
|
200
|
+
* synchronous tick (`Channel._initializeState`), and the read patch drives
|
|
201
|
+
* `MessageReceiptsTracker`, which resolves cursors against this paginator
|
|
202
|
+
* (`findItemByTimestamp`) when the server omits the message IDs, so the paginator must be
|
|
203
|
+
* populated first. First-page reconciliation also takes the unread snapshot.
|
|
268
204
|
*
|
|
269
|
-
* The
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* apply jump semantics (no forced head/tail; cursor flags derived from the around position)
|
|
273
|
-
* instead of wrongly flagging the window as the head (newest) page.
|
|
205
|
+
* The page is not always the latest window: a channel can open around a message (`id_around` /
|
|
206
|
+
* `created_at_around`), so the original pagination options are passed as the query shape and
|
|
207
|
+
* `postQueryReconcile` applies jump semantics instead of flagging the window as the newest page.
|
|
274
208
|
*/
|
|
275
209
|
seedFirstPageSync(messages: LocalMessage[], requestedPageSize: number, messagePaginationOptions?: MessagePaginationParams, options?: SeedFirstPageOptions): void;
|
|
276
210
|
isJumpQueryShape(queryShape: MessageQueryShape): boolean;
|
|
211
|
+
/** A jump sends its own `limit`: head/tail flags are derived against it, not `pageSize`. */
|
|
212
|
+
protected getRequestedPageSize(queryShape: MessageQueryShape | undefined): number;
|
|
277
213
|
jumpToMessage: (messageId: string, { focusReason, focusSignalTtlMs, pageSize, suppressFocusSignal, watchChannel, }?: JumpToMessageOptions) => Promise<boolean>;
|
|
278
214
|
jumpToTheLatestMessage: (options?: JumpToMessageOptions) => Promise<boolean>;
|
|
279
215
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* head:
|
|
216
|
+
* Folds an already fetched newest (head) page into the loaded items without a query. A page that
|
|
217
|
+
* shares an ID with the loaded head merges in place (reconciling by ID, appending new items,
|
|
218
|
+
* keeping older pages), sets the tail boundary via {@link pageReachedChannelStart} and runs
|
|
219
|
+
* {@link reconcileHeadAgainstPage}. A disjoint page would weld the two across a gap, so the
|
|
220
|
+
* loaded set is rebuilt from it as a fresh head (`hasMoreTail: true`) and the gap loads when
|
|
221
|
+
* paginating older.
|
|
285
222
|
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* no more older, otherwise "load older" stays enabled and the cursor re-anchors to the true loaded
|
|
292
|
-
* oldest (which also clears a stale offline-DB cursor). Then destructive reconciliation
|
|
293
|
-
* ({@link reconcileHeadAgainstPage}) removes any loaded message
|
|
294
|
-
* that the authoritative page proves was hard-deleted while offline (see that method + the
|
|
295
|
-
* {@link MergeNewestPageOptions} for the exact, safe window).
|
|
223
|
+
* Merges only when the head interval is loaded and in view (or only live content is loaded,
|
|
224
|
+
* which the page then anchors). When the caller jumped to an older window only offline
|
|
225
|
+
* hard-deletes are pruned from the hidden head. An empty page never wipes the list, except that
|
|
226
|
+
* with `options.candidateIds` it reads as "the channel has no messages". The query shape is
|
|
227
|
+
* recorded on every exit (see `recordLoadedWindowQueryShape`).
|
|
296
228
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* reach them. Instead the loaded set is discarded and rebuilt from the incoming page as a fresh
|
|
301
|
-
* contiguous head (`hasMoreTail: true`, cursor reanchored to the page's oldest item) so the
|
|
302
|
-
* gap and older history load again when paginating older. No separate reconciliation is needed:
|
|
303
|
-
* the rebuilt window IS the server truth, so any hard-deleted message is simply absent from it.
|
|
304
|
-
*
|
|
305
|
-
* Never blanks the loaded set. Noop unless the newest slice is both loaded AND the interval
|
|
306
|
-
* currently in view (the head interval is anchored at the head and active); when the caller has
|
|
307
|
-
* jumped to a separate older window the merge is skipped so their position is preserved, and the
|
|
308
|
-
* incoming page is picked up on a later load. An empty page never wipes the list on its own, but
|
|
309
|
-
* — given a pre-fetch snapshot via `options.candidateIds` — is reconciled as "the channel has no
|
|
310
|
-
* messages" (every server-confirmed loaded message removed).
|
|
311
|
-
*
|
|
312
|
-
* @param page - The fetched newest window (may be empty). `created_at` order is normalized on ingest.
|
|
313
|
-
* @param options - See {@link MergeNewestPageOptions}. Omit to prune only within the page's own span.
|
|
314
|
-
*/
|
|
315
|
-
/**
|
|
316
|
-
* Merges a freshly fetched newest page into the loaded window (the hydrate path). Wraps the
|
|
317
|
-
* implementation so the query shape is recorded on EVERY exit — the body returns early in
|
|
318
|
-
* several places, and a window left without a shape loses itself on the next pagination (see
|
|
319
|
-
* `recordLoadedWindowQueryShape`).
|
|
229
|
+
* @param page - The fetched newest window (may be empty). Ingest normalizes `created_at` order.
|
|
230
|
+
* @param options - See {@link MergeNewestPageOptions}. Omit to prune only within the page's own
|
|
231
|
+
* span.
|
|
320
232
|
*/
|
|
321
233
|
mergeNewestPage: (page: LocalMessage[], options?: MergeNewestPageOptions) => void;
|
|
322
234
|
private _mergeNewestPage;
|
|
323
235
|
/**
|
|
324
|
-
* Whether `page` proves it reached the channel's
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
* `pageSize <= the server's max page size` is already the invariant normal pagination
|
|
328
|
-
* (`executeQuery`) relies on — `page.length < pageSize` ⟹ reached the end — so a request no larger
|
|
329
|
-
* than `pageSize` returns exactly what was asked unless the channel ended. This needs no hardcoded
|
|
330
|
-
* max page size and is per-paginator, so a thread reply paginator uses its own `pageSize`.
|
|
331
|
-
*
|
|
332
|
-
* An OVER-request (larger than `pageSize`, e.g. `channel.reload` re-fetching the whole loaded window
|
|
333
|
-
* to reconcile as much as possible) may have been silently capped by the server, so a short page
|
|
334
|
-
* there is NOT proof of reaching the start — return `false` and stay conservative. This only ever
|
|
335
|
-
* gates the `hasMoreTail` affordance; it never removes a message.
|
|
236
|
+
* Whether `page` proves it reached the channel's oldest message: the request was bounded by this
|
|
237
|
+
* paginator's own `pageSize` (so a short page means the end). A larger over-request (e.g.
|
|
238
|
+
* `channel.reload`) may have been server-capped and never proves it. Only gates `hasMoreTail`.
|
|
336
239
|
*/
|
|
337
240
|
private pageReachedChannelStart;
|
|
338
241
|
/**
|
|
339
|
-
*
|
|
340
|
-
* older than `anchorId
|
|
341
|
-
*
|
|
342
|
-
* older than `anchorId
|
|
343
|
-
*
|
|
344
|
-
* delete). The caller decides WHEN this runs.
|
|
242
|
+
* Settles the below-window leftovers {@link reconcileHeadAgainstPage} returned (loaded messages
|
|
243
|
+
* older than `anchorId`, the page's oldest, and absent from it): from the page alone a
|
|
244
|
+
* hard-deleted oldest looks like a server-capped over-request. It asks the server whether anything
|
|
245
|
+
* is older than `anchorId`; if not, they are real deletes and are removed and the tail settled. A
|
|
246
|
+
* probe failure or a head change across the await keeps them. The caller decides when this runs.
|
|
345
247
|
*/
|
|
346
248
|
private pruneBelowWindowIfReachedStart;
|
|
347
249
|
/** One `limit: 1` fetch of messages older than `id` (channel main list or thread replies). */
|
|
348
250
|
private hasMessagesOlderThan;
|
|
349
251
|
/**
|
|
350
|
-
* Whether a loaded message is server-confirmed
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* so a legitimately-unsent message is never mistaken for a hard delete.
|
|
252
|
+
* Whether a loaded message is server-confirmed, so it may be reconciled away when absent from an
|
|
253
|
+
* authoritative page. Optimistic (`sending`), `failed` and client-side `error` messages are not, so
|
|
254
|
+
* an unsent message is never mistaken for a hard delete.
|
|
354
255
|
*/
|
|
355
256
|
protected isServerConfirmedMessage(message: LocalMessage): boolean;
|
|
356
257
|
/**
|
|
357
|
-
* Destructive half of {@link mergeNewestPage}:
|
|
358
|
-
*
|
|
359
|
-
* the merge is additive, so they would otherwise linger forever).
|
|
360
|
-
*
|
|
361
|
-
* Here `page` is the freshly-fetched newest window the server returned for the query that produced
|
|
362
|
-
* it. Its two bounds are its NEWEST message (`page`'s last item by `created_at`) and its OLDEST
|
|
363
|
-
* message (`page`'s first item). Reconciliation removes ONLY messages `page` actually covers — no
|
|
364
|
-
* hardcoded page size is involved — in two regions, by a loaded message's `created_at`:
|
|
365
|
-
*
|
|
366
|
-
* - WITHIN `page` (strictly between `page`'s oldest and newest message): a server-confirmed loaded
|
|
367
|
-
* message absent from `page` was hard-deleted. Safe with no snapshot — a message that arrived live
|
|
368
|
-
* during the caller's fetch is always strictly newer than `page`'s newest message, so it can never
|
|
369
|
-
* fall in this span.
|
|
370
|
-
* - AT/ABOVE `page`'s newest message (a hard-deleted newest message), and the empty-`page` case:
|
|
371
|
-
* only reconcilable with a pre-fetch `candidateIds` snapshot, which alone tells a just-deleted
|
|
372
|
-
* message from one that arrived live during the fetch at that top edge.
|
|
258
|
+
* Destructive half of {@link mergeNewestPage}: removes loaded head-interval messages that `page`
|
|
259
|
+
* (the fresh newest window) proves were hard-deleted while offline, by `created_at`:
|
|
373
260
|
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* the server confirms nothing older exists. Absent that proof they are kept (a later cold/fresh query
|
|
379
|
-
* omits any real delete).
|
|
261
|
+
* - within `page`'s span: a server-confirmed message absent from `page` was deleted (a live
|
|
262
|
+
* arrival is newer than `page`'s newest, so this needs no snapshot);
|
|
263
|
+
* - at or above `page`'s newest, and for an empty `page`: only IDs in the pre-fetch `candidateIds`
|
|
264
|
+
* snapshot, which tells a just-deleted message from a live arrival.
|
|
380
265
|
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
* the
|
|
266
|
+
* Messages below `page`'s oldest are kept (a hard-deleted oldest looks like a server-capped
|
|
267
|
+
* over-request) and returned for {@link pruneBelowWindowIfReachedStart}. Removal goes through
|
|
268
|
+
* {@link removeItem}, so the index, intervals, message store and any subclass bookkeeping (e.g.
|
|
269
|
+
* an overridden `removeItem`) stay correct.
|
|
384
270
|
*
|
|
385
|
-
* @returns
|
|
386
|
-
* from it) for the caller's reached-start probe. Empty for the no-head / empty-page paths.
|
|
271
|
+
* @returns The below-window leftover IDs. Empty for the no-head and empty-page paths.
|
|
387
272
|
*/
|
|
388
273
|
protected reconcileHeadAgainstPage(page: LocalMessage[], options?: MergeNewestPageOptions): string[];
|
|
389
|
-
/**
|
|
390
|
-
* Remove a set of reconciled (hard-deleted) ids from this paginator's loaded state in one coalesced
|
|
391
|
-
* batch. Each id goes through {@link removeItem}, which drops it from THREE places — not a single
|
|
392
|
-
* interval:
|
|
393
|
-
*
|
|
394
|
-
* 1. the item index — unlinks this paginator's membership from the shared entity store (GC'ing the
|
|
395
|
-
* content if this was the last holder);
|
|
396
|
-
* 2. the interval that holds it — located by id, so it is NOT head-specific in general; in practice
|
|
397
|
-
* it is always the head interval, because the sole caller ({@link reconcileHeadAgainstPage})
|
|
398
|
-
* sources these ids from `headInterval.itemIds` and an item has single-interval membership;
|
|
399
|
-
* 3. the active window (`state.items`) if visible — blanking to `[]` when the window empties, per
|
|
400
|
-
* {@link flushWindowPublish}.
|
|
401
|
-
*
|
|
402
|
-
* The coalesced batch collapses all of that into a single `state.items` publish. Then mirror the
|
|
403
|
-
* removal into the offline DB (see {@link purgeReconciledFromOfflineDb}) so a cold start does not
|
|
404
|
-
* re-seed the ghosts from SQLite. No-op for an empty set, so an unaffected merge does not touch
|
|
405
|
-
* state a second time.
|
|
406
|
-
*/
|
|
274
|
+
/** Removes reconciled IDs in one coalesced batch (one publish), then mirrors it offline. */
|
|
407
275
|
private removeReconciledItems;
|
|
408
276
|
/**
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* page), so without this the ghosts survive in SQLite and a cold start would re-seed them after the
|
|
413
|
-
* in-memory list already dropped them.
|
|
414
|
-
*
|
|
415
|
-
* Owned by the state layer, NOT the SDK: the SDK only supplies the platform `offlineDb`
|
|
416
|
-
* implementation and never orchestrates DB writes for reconciliation. Fire-and-forget and
|
|
417
|
-
* best-effort — the in-memory removal is the source of truth for the live list, so a failed/absent
|
|
418
|
-
* DB write is no worse than before (the ghost merely re-appears on a cold start until the next
|
|
419
|
-
* reconcile). No-op when offline support is off (`client.offlineDb` undefined). The ids are already
|
|
420
|
-
* server-confirmed (the reconcile excludes pending/failed/optimistic), so a plain hard delete —
|
|
421
|
-
* without the pending-task teardown of a local failed message — is correct.
|
|
277
|
+
* Mirrors a reconciliation into the offline DB: a hard delete done while offline reaches it via no
|
|
278
|
+
* event and the reconnect query upserts (never removing absent rows), so a cold start would re-seed
|
|
279
|
+
* the ghosts. Fire-and-forget, no-op without offline support.
|
|
422
280
|
*/
|
|
423
281
|
private purgeReconciledFromOfflineDb;
|
|
424
282
|
protected resolveUnreadBoundaryIdsByTimestamp: ({ lastReadAt, messages, }: {
|
|
@@ -434,10 +292,9 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
|
|
|
434
292
|
ttlMs?: number;
|
|
435
293
|
}) => MessageFocusSignal;
|
|
436
294
|
/**
|
|
437
|
-
* Starts the auto-
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
* signal has already been cleared or superseded (guarded by `token`).
|
|
295
|
+
* Starts the auto-dismiss countdown for the active focus signal. Call it once the focused message
|
|
296
|
+
* is viewed, so the highlight lasts from when the user could see it. No-op if the signal was
|
|
297
|
+
* cleared or superseded (guarded by `token`).
|
|
441
298
|
*/
|
|
442
299
|
scheduleMessageFocusSignalClear: ({ token, ttlMs, }?: {
|
|
443
300
|
token?: number;
|
|
@@ -448,50 +305,34 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
|
|
|
448
305
|
}) => void;
|
|
449
306
|
clearStateAndCache(): void;
|
|
450
307
|
/**
|
|
451
|
-
* Partial truncation for `channel.truncated`
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* its `tail` (oldest) and `head` (newest) edges, so only the single interval that *straddles* the
|
|
458
|
-
* cutoff is scanned member-by-member — the rest are kept or dropped wholesale. The straddling
|
|
459
|
-
* interval becomes the new global tail (nothing older than the cutoff exists anymore), so its
|
|
460
|
-
* `isTail`/`hasMoreTail` are set; intervals entirely newer keep their flags (unloaded older
|
|
461
|
-
* messages may still sit between them and the cutoff). The active window is re-emitted once.
|
|
308
|
+
* Partial truncation for `channel.truncated` with a `truncated_at`: drops every loaded message
|
|
309
|
+
* strictly older than the cutoff across all windows (a full truncation uses
|
|
310
|
+
* {@link MessageIntervalPaginator.clearStateAndCache}). Only the interval straddling the cutoff is
|
|
311
|
+
* scanned member by member and becomes the new global tail; intervals entirely newer keep their
|
|
312
|
+
* flags, since unloaded older messages may sit between them and the cutoff. The active window is
|
|
313
|
+
* re-emitted once.
|
|
462
314
|
*/
|
|
463
|
-
truncate
|
|
315
|
+
truncate({ truncatedAt }: {
|
|
464
316
|
truncatedAt: TimestampNS;
|
|
465
|
-
})
|
|
317
|
+
}): void;
|
|
466
318
|
applyMessageDeletionForUser: ({ userId, hardDelete, deletedAt, }: {
|
|
467
319
|
userId: string;
|
|
468
320
|
hardDelete?: boolean;
|
|
469
321
|
deletedAt: TimestampNS;
|
|
470
322
|
}) => void;
|
|
471
|
-
/**
|
|
472
|
-
* Ensures quoted-message snapshots across loaded paginator cache are in sync
|
|
473
|
-
* with the provided message.
|
|
474
|
-
*
|
|
475
|
-
* Scans cached messages and updates any item where `quoted_message_id`
|
|
476
|
-
* matches `message.id`.
|
|
477
|
-
*/
|
|
323
|
+
/** Updates the quoted-message snapshot of every cached message that quotes `message`. */
|
|
478
324
|
reflectQuotedMessageUpdate: (message: LocalMessage) => void;
|
|
479
325
|
/**
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
* Batched: a user rename can affect many messages, so this patches the shared item index and
|
|
485
|
-
* re-emits the active window a single time (if it held an affected message) rather than one
|
|
486
|
-
* `ingestItem` re-emit per message.
|
|
326
|
+
* Reflects an updated `user` onto every cached message authored by that user (not
|
|
327
|
+
* `quoted_message.user`). Patches the shared item index in one batch and re-emits the active
|
|
328
|
+
* window once, if it held an affected message.
|
|
487
329
|
*/
|
|
488
|
-
reflectUserUpdate
|
|
330
|
+
reflectUserUpdate(user: UserResponse): void;
|
|
489
331
|
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
* read cursors live — which is already sorted, so this is O(log n) with no re-sort.
|
|
332
|
+
* The last loaded message created at or before `timestamp` (a floor), or `null` when it precedes
|
|
333
|
+
* every loaded message. With `exactTsMatch`, only a message created exactly at `timestamp` matches.
|
|
334
|
+
* Searches the newest loaded window (already sorted) in O(log n). Used by the receipts tracker to
|
|
335
|
+
* resolve read/delivered cursors.
|
|
495
336
|
*/
|
|
496
337
|
findItemByTimestamp: (timestamp: TimestampNS, exactTsMatch?: boolean) => LocalMessage | null;
|
|
497
338
|
filterQueryResults: (items: LocalMessage[]) => LocalMessage[];
|