stream-chat 10.0.0-rc.8 → 10.0.0
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/README.md +7 -6
- package/dist/cjs/index.browser.js +22095 -22290
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +22143 -22298
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +22093 -22288
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +216 -135
- package/dist/types/CooldownTimer.d.ts +16 -27
- package/dist/types/EventHandlerPipeline.d.ts +18 -38
- package/dist/types/LiveLocationManager.d.ts +25 -47
- package/dist/types/api-client.d.ts +17 -5
- package/dist/types/channel.d.ts +435 -500
- package/dist/types/channel_state.d.ts +72 -112
- package/dist/types/client.d.ts +323 -440
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +31 -125
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +32 -124
- 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 +64 -79
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +14 -36
- 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 +45 -0
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +84 -0
- package/dist/types/connection/index.d.ts +4 -0
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +82 -0
- package/dist/types/connection/networkConnection/index.d.ts +3 -0
- package/dist/types/connection/networkConnection/reporters.d.ts +20 -0
- package/dist/types/connection/networkConnection/types.d.ts +40 -0
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +137 -0
- package/dist/types/connection/wsConnection/WSConnection.d.ts +105 -0
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +47 -0
- package/dist/types/connection/wsConnection/config.d.ts +31 -0
- package/dist/types/connection/wsConnection/index.d.ts +4 -0
- package/dist/types/connection/wsConnection/types.d.ts +46 -0
- package/dist/types/constants.d.ts +3 -1
- package/dist/types/custom_types.d.ts +0 -2
- package/dist/types/entityStore/EntityStore.d.ts +226 -65
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +19 -33
- package/dist/types/entityStore/index.d.ts +0 -1
- package/dist/types/errors.d.ts +16 -19
- package/dist/types/formatMessageMemo.d.ts +5 -0
- package/dist/types/gen/chat/ChannelApi.d.ts +5 -1
- package/dist/types/gen/chat/ChatApi.d.ts +149 -105
- package/dist/types/gen/models/index.d.ts +2540 -698
- package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +37 -14
- package/dist/types/index.d.ts +10 -5
- package/dist/types/{i18n/languageNames.d.ts → languageNames.d.ts} +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
- package/dist/types/messageComposer/LocationComposer.d.ts +8 -2
- package/dist/types/messageComposer/attachmentIdentity.d.ts +24 -0
- package/dist/types/messageComposer/attachmentManager.d.ts +52 -24
- package/dist/types/messageComposer/attachmentUtils.d.ts +23 -0
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +38 -50
- package/dist/types/messageComposer/index.d.ts +1 -0
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +12 -9
- package/dist/types/messageComposer/messageComposer.d.ts +60 -123
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +10 -1
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +4 -0
- package/dist/types/messageComposer/middleware/messageComposer/commandInjection.d.ts +5 -0
- package/dist/types/messageComposer/middleware/messageComposer/index.d.ts +2 -0
- package/dist/types/messageComposer/middleware/messageComposer/pollOnly.d.ts +6 -0
- package/dist/types/messageComposer/middleware/messageComposer/userDataInjection.d.ts +5 -0
- 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/commandUtils.d.ts +4 -0
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +11 -2
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +20 -19
- 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 +15 -5
- package/dist/types/messageComposer/textComposer.d.ts +14 -7
- package/dist/types/messageComposer/types.d.ts +27 -7
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +27 -80
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +43 -73
- package/dist/types/messageOperations/FailedSendCache.d.ts +29 -0
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +16 -22
- package/dist/types/messageOperations/MessageOperations.d.ts +63 -34
- package/dist/types/messageOperations/applyReactionLocally.d.ts +15 -0
- package/dist/types/messageOperations/createMessageOperations.d.ts +9 -0
- package/dist/types/messageOperations/index.d.ts +6 -4
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +16 -0
- package/dist/types/messageOperations/sendOrdering.d.ts +14 -0
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +20 -0
- package/dist/types/messageOperations/types.d.ts +43 -14
- package/dist/types/middleware.d.ts +10 -0
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +10 -23
- package/dist/types/notifications/types.d.ts +21 -57
- package/dist/types/offline-support/offline_support_api.d.ts +150 -528
- package/dist/types/offline-support/offline_sync_manager.d.ts +21 -42
- package/dist/types/offline-support/queueableOperations.d.ts +35 -37
- package/dist/types/offline-support/types.d.ts +40 -185
- package/dist/types/pagination/FilterBuilder.d.ts +1 -18
- 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 +4 -5
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +19 -5
- package/dist/types/pagination/index.d.ts +1 -0
- package/dist/types/pagination/paginators/BasePaginator.d.ts +604 -550
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +123 -106
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +576 -327
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +237 -131
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +15 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +4 -3
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +44 -0
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +5 -8
- package/dist/types/pagination/paginators/index.d.ts +1 -0
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +8 -13
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +35 -8
- package/dist/types/poll_manager.d.ts +12 -2
- package/dist/types/poll_optimistic_votes.d.ts +57 -0
- package/dist/types/reminders/Reminder.d.ts +17 -7
- package/dist/types/reminders/ReminderManager.d.ts +13 -25
- package/dist/types/search/BaseSearchSource.d.ts +10 -8
- package/dist/types/search/ChannelSearchSource.d.ts +16 -0
- package/dist/types/search/MessageSearchSource.d.ts +17 -0
- package/dist/types/search/SearchController.d.ts +26 -28
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +67 -129
- package/dist/types/thread_manager.d.ts +95 -66
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +81 -197
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +31 -11
- package/dist/types/utils/FixedSizeQueueCache.d.ts +8 -11
- package/dist/types/utils/WithSubscriptions.d.ts +6 -16
- package/dist/types/utils/abort.d.ts +17 -0
- package/dist/types/utils/concurrency.d.ts +12 -20
- 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 +45 -0
- package/dist/types/utils.d.ts +74 -93
- package/package.json +14 -40
- package/src/ChannelManager.ts +494 -303
- package/src/CooldownTimer.ts +46 -59
- package/src/EventHandlerPipeline.ts +22 -45
- package/src/LiveLocationManager.ts +99 -91
- package/src/api-client.ts +113 -50
- package/src/campaign.ts +1 -1
- package/src/channel.ts +1098 -1351
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +81 -174
- package/src/client.ts +755 -970
- package/src/client_state.ts +3 -8
- package/src/configuration/ConfigController.ts +42 -158
- package/src/configuration/InstanceConfigurationRegistry.ts +43 -172
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +169 -59
- package/src/configuration/types.ts +69 -92
- package/src/configuration/utils/applyInstanceConfiguration.ts +22 -54
- 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 +111 -0
- package/src/connection/ConnectionRecoveryManager.ts +257 -0
- package/src/connection/index.ts +4 -0
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +204 -0
- package/src/connection/networkConnection/index.ts +3 -0
- package/src/connection/networkConnection/reporters.ts +58 -0
- package/src/connection/networkConnection/types.ts +45 -0
- package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +230 -231
- package/src/connection/wsConnection/WSConnection.ts +270 -0
- package/src/connection/wsConnection/WSConnectionFallback.ts +250 -0
- package/src/connection/wsConnection/config.ts +73 -0
- package/src/connection/wsConnection/index.ts +4 -0
- package/src/connection/wsConnection/types.ts +48 -0
- package/src/constants.ts +7 -5
- package/src/custom_types.ts +0 -1
- package/src/entityStore/EntityStore.ts +415 -79
- package/src/entityStore/StoreBackedItemIndex.ts +37 -41
- package/src/entityStore/index.ts +0 -1
- package/src/errors.ts +39 -20
- package/src/formatMessageMemo.ts +17 -0
- package/src/gen/chat/ChannelApi.ts +122 -36
- package/src/gen/chat/ChatApi.ts +578 -1752
- package/src/gen/models/index.ts +2566 -3440
- package/src/gen/models/timestamp-guard.ts +27 -0
- package/src/gen/moderation/ModerationApi.ts +183 -406
- package/src/index.ts +32 -10
- package/src/languageNames.ts +88 -0
- package/src/logger.ts +1 -3
- package/src/messageComposer/CustomDataManager.ts +19 -6
- package/src/messageComposer/LocationComposer.ts +49 -9
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +54 -0
- package/src/messageComposer/attachmentManager.ts +170 -185
- package/src/messageComposer/attachmentUtils.ts +44 -0
- package/src/messageComposer/configuration/configuration.ts +15 -8
- package/src/messageComposer/configuration/types.ts +38 -50
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/index.ts +1 -0
- package/src/messageComposer/linkPreviewsManager.ts +18 -21
- package/src/messageComposer/messageComposer.ts +234 -179
- package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +46 -33
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +4 -1
- package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +6 -0
- package/src/messageComposer/middleware/messageComposer/attachments.ts +76 -5
- package/src/messageComposer/middleware/messageComposer/commandInjection.ts +10 -4
- package/src/messageComposer/middleware/messageComposer/customData.ts +17 -5
- package/src/messageComposer/middleware/messageComposer/index.ts +2 -0
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +22 -12
- package/src/messageComposer/middleware/messageComposer/pollOnly.ts +9 -1
- package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +12 -12
- 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 +8 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +10 -3
- 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 +21 -9
- package/src/messageComposer/textComposer.ts +37 -57
- package/src/messageComposer/types.ts +39 -11
- package/src/messageDelivery/MessageDeliveryReporter.ts +86 -124
- package/src/messageDelivery/MessageReceiptsTracker.ts +122 -139
- package/src/messageOperations/FailedSendCache.ts +85 -0
- package/src/messageOperations/MessageOperationStatePolicy.ts +124 -116
- package/src/messageOperations/MessageOperations.ts +297 -175
- package/src/{entityStore → messageOperations}/applyReactionLocally.ts +13 -25
- package/src/messageOperations/createMessageOperations.ts +176 -0
- package/src/messageOperations/index.ts +6 -14
- package/src/messageOperations/reflectReactionEvent.ts +43 -0
- package/src/messageOperations/sendOrdering.ts +25 -0
- package/src/messageOperations/settlePendingAttachmentUploads.ts +98 -0
- package/src/messageOperations/types.ts +51 -13
- package/src/middleware.ts +13 -5
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +19 -28
- package/src/notifications/types.ts +21 -57
- package/src/offline-support/offline_support_api.ts +231 -681
- package/src/offline-support/offline_sync_manager.ts +51 -90
- package/src/offline-support/queueableOperations.ts +98 -73
- package/src/offline-support/types.ts +43 -185
- package/src/pagination/FilterBuilder.ts +1 -22
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +17 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +53 -33
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/index.ts +1 -0
- package/src/pagination/paginators/BasePaginator.ts +1415 -1041
- package/src/pagination/paginators/ChannelPaginator.ts +481 -219
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1362 -775
- package/src/pagination/paginators/MessagePaginator.ts +521 -240
- package/src/pagination/paginators/PinnedMessagePaginator.ts +32 -40
- package/src/pagination/paginators/ReminderPaginator.ts +21 -16
- package/src/pagination/paginators/ThreadPaginator.ts +170 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +18 -15
- package/src/pagination/paginators/index.ts +1 -0
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +17 -24
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +183 -102
- package/src/poll_manager.ts +24 -22
- package/src/poll_optimistic_votes.ts +335 -0
- package/src/reminders/Reminder.ts +33 -16
- package/src/reminders/ReminderManager.ts +23 -56
- package/src/reminders/ReminderTimer.ts +6 -6
- package/src/search/BaseSearchSource.ts +19 -25
- package/src/search/ChannelSearchSource.ts +43 -1
- package/src/search/MessageSearchSource.ts +77 -13
- package/src/search/SearchController.ts +39 -36
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +430 -712
- package/src/thread_manager.ts +300 -234
- package/src/token_manager.ts +12 -22
- package/src/types.ts +102 -214
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +64 -18
- package/src/utils/FixedSizeQueueCache.ts +18 -21
- package/src/utils/WithSubscriptions.ts +6 -16
- package/src/utils/abort.ts +45 -0
- 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 +64 -0
- package/src/utils.ts +227 -174
- package/codegen/i18n/callSites.ts +0 -126
- package/codegen/i18n/generate.ts +0 -226
- package/codegen/i18n/guards.ts +0 -178
- package/codegen/i18n/index.ts +0 -29
- package/codegen/i18n/stringMaps.ts +0 -91
- package/codegen/i18n/types.ts +0 -100
- package/dist/cjs/i18n.browser.js +0 -1131
- package/dist/cjs/i18n.browser.js.map +0 -7
- package/dist/cjs/i18n.node.js +0 -1160
- package/dist/cjs/i18n.node.js.map +0 -7
- package/dist/esm/i18n-codegen.mjs +0 -409
- package/dist/esm/i18n-codegen.mjs.map +0 -7
- package/dist/esm/i18n.mjs +0 -1098
- package/dist/esm/i18n.mjs.map +0 -7
- package/dist/types/ConnectionRecoveryManager.d.ts +0 -156
- package/dist/types/connection.d.ts +0 -139
- package/dist/types/entityStore/applyReactionLocally.d.ts +0 -26
- package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
- package/dist/types/i18n/Streami18n.d.ts +0 -168
- package/dist/types/i18n/TranslationBuilder.d.ts +0 -70
- package/dist/types/i18n/TranslationStore.d.ts +0 -57
- package/dist/types/i18n/dayjs.d.ts +0 -104
- package/dist/types/i18n/formatters.d.ts +0 -91
- package/dist/types/i18n/index.d.ts +0 -15
- package/dist/types/i18n/translator.d.ts +0 -29
- package/dist/types/i18n/types.d.ts +0 -262
- package/dist/types/i18n-codegen/callSites.d.ts +0 -10
- package/dist/types/i18n-codegen/generate.d.ts +0 -15
- package/dist/types/i18n-codegen/guards.d.ts +0 -61
- package/dist/types/i18n-codegen/index.d.ts +0 -29
- package/dist/types/i18n-codegen/stringMaps.d.ts +0 -14
- package/dist/types/i18n-codegen/types.d.ts +0 -94
- package/dist/types/insights.d.ts +0 -56
- package/dist/types/messageOperations/optimistic.d.ts +0 -118
- package/dist/types/messageOperations/persistence.d.ts +0 -21
- package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
- package/dist/types/store.d.ts +0 -125
- package/src/ConnectionRecoveryManager.ts +0 -293
- package/src/gen/model-decoders/decoders.ts +0 -2710
- package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
- package/src/i18n/Streami18n.ts +0 -520
- package/src/i18n/TranslationBuilder.ts +0 -176
- package/src/i18n/TranslationStore.ts +0 -96
- package/src/i18n/dayjs.ts +0 -228
- package/src/i18n/formatters.ts +0 -461
- package/src/i18n/index.ts +0 -15
- package/src/i18n/languageNames.ts +0 -103
- package/src/i18n/translator.ts +0 -76
- package/src/i18n/types.ts +0 -375
- package/src/insights.ts +0 -82
- package/src/messageOperations/optimistic.ts +0 -249
- package/src/messageOperations/persistence.ts +0 -40
- package/src/pagination/utility.queryChannel.ts +0 -84
- package/src/store.ts +0 -304
|
@@ -1,207 +1,313 @@
|
|
|
1
|
-
import type { BasePaginatorConfig,
|
|
2
|
-
import { type MessagePaginatorOptions as BaseMessagePaginatorOptions, type JumpToMessageOptions, MessageIntervalPaginator, type MessageQueryShape } from './MessageIntervalPaginator';
|
|
3
|
-
import type { LocalMessage } from '../../types';
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import type { BasePaginatorConfig, Interval, QueryPagePlacement } from './BasePaginator';
|
|
2
|
+
import { type MessagePaginatorOptions as BaseMessagePaginatorOptions, type JumpToMessageOptions, MessageIntervalPaginator, type MessageQueryResponse, type MessageQueryShape } from './MessageIntervalPaginator';
|
|
3
|
+
import type { LocalMessage, TimestampNS, UserResponse } from '../../types';
|
|
4
|
+
import type { EntityStoreChangeBatch } from '../../entityStore/EntityStore';
|
|
5
|
+
import { StateStore } from '@stream-io/state-store';
|
|
6
|
+
export type { JumpToMessageOptions, MessageFocusReason, MessageFocusSignal, MessageFocusSignalState, MessagePaginatorFilter, MessagePaginatorSort, MessagePaginatorState, MessageQueryShape, PreparedExternalQuery, ReconcileNewestMessagesOptions, } from './MessageIntervalPaginator';
|
|
6
7
|
export { MessageIntervalPaginator } from './MessageIntervalPaginator';
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* advanced monotonically as newer messages are ingested.
|
|
9
|
+
* Whole-collection aggregates, independent of the active pagination interval. `latestMessageAt` is
|
|
10
|
+
* the time of the channel's latest message and orders the channel list
|
|
11
|
+
* (`channel.messagePaginator.latestMessageAt`): the later of
|
|
12
|
+
* {@link MessagePaginatorAggregateState.latestMessage}'s `created_at` and the `last_message_at` of
|
|
13
|
+
* the latest channel or thread response.
|
|
14
14
|
*/
|
|
15
15
|
export type MessagePaginatorAggregateState = {
|
|
16
16
|
/**
|
|
17
|
-
* The newest
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* The newest message the client holds that counts as the channel's latest, from any loaded
|
|
18
|
+
* interval or from an event. Not necessarily the server's latest message: when the client does
|
|
19
|
+
* not hold that one, {@link MessagePaginator.latestMessageAt} is later than its `created_at` (see
|
|
20
|
+
* {@link MessagePaginator.latestMessage}). For display (latest-message preview, latest-reply
|
|
21
|
+
* avatar). A live reference: it advances to a strictly newer message, is refreshed in place on
|
|
22
|
+
* edit, soft-delete or reaction, and is recomputed when hard-removed. Follows
|
|
23
|
+
* `shouldAdvanceLatestMessage` (skips `error` and `ephemeral` messages and thread-only replies).
|
|
24
|
+
* `null` until one is ingested.
|
|
22
25
|
*
|
|
23
|
-
*
|
|
24
|
-
* the head interval while an older
|
|
25
|
-
* active* interval is impacted (see `BasePaginator.ingestItem`), so a `state`-derived latest would
|
|
26
|
-
* go stale in that case.
|
|
26
|
+
* It lives outside pagination `state`, which only emits when the active interval is affected: a
|
|
27
|
+
* message landing in the head interval while an older interval is active would go stale there.
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
+
latestMessage: LocalMessage | null;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* The `last_message_at` of the latest channel or thread query result (`ChannelResponse` or
|
|
32
|
+
* `ThreadStateResponse`). It comes with the channel or thread data rather than with a message, so
|
|
33
|
+
* the message it refers to may not be loaded. Each query result that carries it replaces it (see
|
|
34
|
+
* {@link MessagePaginator.setQueriedLatestMessageAt}); events never set it, as a new message from
|
|
35
|
+
* an event updates {@link latestMessage} instead. When the newest message is hard-deleted, it
|
|
36
|
+
* moves back to the previous loaded message; a truncation clears it. `null` when the query
|
|
37
|
+
* reported no messages.
|
|
38
|
+
*
|
|
39
|
+
* {@link MessagePaginator.latestMessageAt} is the later of this and {@link latestMessage}'s
|
|
40
|
+
* `created_at`, so it can be later than the message shown as the latest.
|
|
35
41
|
*/
|
|
36
|
-
|
|
42
|
+
queriedLatestMessageAt: TimestampNS | null;
|
|
37
43
|
};
|
|
38
44
|
export type MessagePaginatorOptions = BaseMessagePaginatorOptions & {
|
|
39
45
|
/**
|
|
40
|
-
*
|
|
41
|
-
* state
|
|
42
|
-
*
|
|
43
|
-
* - 'snapshot' (default): retrieve the first unread message id from the unreadStateSnapshot state when jumping to the first unread message
|
|
44
|
-
* - 'read-state-only': retrieve the last read message id from the channel read state when jumping to the first unread message
|
|
46
|
+
* Where `jumpToTheFirstUnreadMessage()` reads the unread reference from: `'snapshot'`
|
|
47
|
+
* prefers `unreadStateSnapshot`, `'read-state-only'` uses only `channel.state.read[...]`.
|
|
48
|
+
* Defaults to `'snapshot'`.
|
|
45
49
|
*/
|
|
46
50
|
unreadReferencePolicy?: 'snapshot' | 'read-state-only';
|
|
47
51
|
};
|
|
48
52
|
export type UnreadSnapshotState = {
|
|
49
|
-
lastReadAt:
|
|
53
|
+
lastReadAt: TimestampNS | null;
|
|
50
54
|
unreadCount: number;
|
|
51
55
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* may mark the channel read immediately on open, while still wanting to render
|
|
55
|
-
* UI indicators that jump to the previously-unread location.
|
|
56
|
+
* First unread message ID. Decoupled from `channel.state.read[...]` because apps may mark the
|
|
57
|
+
* channel read on open yet still want UI that jumps to the previously unread location.
|
|
56
58
|
*/
|
|
57
59
|
firstUnreadMessageId: string | null;
|
|
58
|
-
/**
|
|
59
|
-
* Snapshot of the last read message id for the user (fallback when first unread
|
|
60
|
-
* is not known).
|
|
61
|
-
*/
|
|
60
|
+
/** Last read message ID, a fallback when the first unread is unknown. */
|
|
62
61
|
lastReadMessageId: string | null;
|
|
63
62
|
};
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* snapshot bump is skipped), so the "N new" separator/banner never flash for a message the user is
|
|
69
|
-
* already looking at. Defaults to `false` (assume not viewing until the SDK proves otherwise).
|
|
64
|
+
* Set by the owning SDK (the state layer has no viewport): `true` while the user views the latest
|
|
65
|
+
* messages (app foregrounded and newest message on screen). While live, an incoming message does
|
|
66
|
+
* not bump the unread count or snapshot. Defaults to `false`.
|
|
70
67
|
*/
|
|
71
68
|
export type LiveViewState = {
|
|
72
69
|
isViewingLive: boolean;
|
|
73
70
|
};
|
|
74
71
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* the "jump to first unread" navigation built on top of them.
|
|
72
|
+
* Adds the unread snapshot, the UI-driven live-view signal and "jump to first unread" navigation to
|
|
73
|
+
* {@link MessageIntervalPaginator}.
|
|
78
74
|
*/
|
|
79
75
|
export declare class MessagePaginator extends MessageIntervalPaginator {
|
|
76
|
+
protected get holderName(): string;
|
|
80
77
|
private unreadReferencePolicy;
|
|
81
78
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
79
|
+
* Unread reference state, independent of `channel.state.read`. Seeded on each first page;
|
|
80
|
+
* consumers may also set it before `markRead`.
|
|
84
81
|
*/
|
|
85
82
|
readonly unreadStateSnapshot: StateStore<UnreadSnapshotState>;
|
|
86
83
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* this store for reactivity, or read the current boolean directly via the {@link isViewingLive} getter.
|
|
84
|
+
* The "viewing the latest messages" signal ({@link LiveViewState}), set via {@link setViewingLive}
|
|
85
|
+
* and read by the channel to gate the unread bump on `message.new`.
|
|
90
86
|
*/
|
|
91
87
|
readonly liveViewState: StateStore<LiveViewState>;
|
|
92
88
|
/**
|
|
93
|
-
*
|
|
94
|
-
* from `state`
|
|
95
|
-
*
|
|
96
|
-
* emits when the aggregate actually changes (not on every scroll/pagination emission). This is
|
|
97
|
-
* distinct from the base's `intervalViews` interval-projection store.
|
|
89
|
+
* {@link MessagePaginatorAggregateState}, in a store apart from `state` so `latestMessage` can
|
|
90
|
+
* advance from inside a `state.next` updater (`ingestPage`) and subscribers only see aggregate
|
|
91
|
+
* changes.
|
|
98
92
|
*/
|
|
99
93
|
readonly aggregateState: StateStore<MessagePaginatorAggregateState>;
|
|
100
94
|
constructor({ unreadReferencePolicy, ...options }: MessagePaginatorOptions, builtInDefaults?: Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>);
|
|
101
95
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
96
|
+
* The time of the channel's latest message as far as the client knows: the later of
|
|
97
|
+
* {@link latestMessage}'s `created_at` and the `last_message_at` of the latest response (see
|
|
98
|
+
* {@link setQueriedLatestMessageAt}). Later than {@link latestMessage} when the server has newer
|
|
99
|
+
* messages the client does not hold. The channel-list sort key. **Derived** (never stored) so it
|
|
100
|
+
* cannot drift from {@link latestMessage}. A system message that does not move `last_message_at`
|
|
101
|
+
* (see {@link isSkippedSystemMessage}) does not count: the newest loaded message that does is
|
|
102
|
+
* used instead. `null` until a query sets it or a message is ingested.
|
|
105
103
|
*/
|
|
106
|
-
get
|
|
104
|
+
get latestMessageAt(): TimestampNS | null;
|
|
105
|
+
/** The newest loaded message that moves `last_message_at`, which {@link latestMessageAt} reads. */
|
|
106
|
+
private get latestMessageAtSource();
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* ingested (a server-only seed advances {@link lastMessageAt} but leaves this `null`).
|
|
108
|
+
* {@link latestMessageAt} as the server knows it (see {@link pageReachesHead}): an unsent latest
|
|
109
|
+
* message carries the device's clock, so the latest server-known message counts in its place.
|
|
111
110
|
*/
|
|
112
|
-
get
|
|
111
|
+
private get latestServerMessageAt();
|
|
112
|
+
/** The later of `message`'s `created_at` and the queried `last_message_at`. */
|
|
113
|
+
private latestMessageAtIncluding;
|
|
113
114
|
/**
|
|
114
|
-
* The
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* `
|
|
115
|
+
* The newest message the client holds that counts as the channel's latest (see
|
|
116
|
+
* {@link shouldAdvanceLatestMessage}), from any loaded interval or from an event. Not necessarily
|
|
117
|
+
* the server's latest message: {@link latestMessageAt} is later than its `created_at` when the
|
|
118
|
+
* server has newer messages the client does not hold. `null` until a message is ingested (a
|
|
119
|
+
* `last_message_at` from a query sets {@link latestMessageAt} but leaves this `null`).
|
|
120
|
+
* Convenience read of {@link aggregateState}; subscribe to `aggregateState` for reactivity.
|
|
119
121
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
122
|
+
* It differs from {@link anchoredHeadItem}, the newest message of the interval known to reach the
|
|
123
|
+
* server's latest message, in two ways:
|
|
124
|
+
* - It skips messages that do not count: an `error` message can be `anchoredHeadItem` but never
|
|
125
|
+
* `latestMessage`.
|
|
126
|
+
* - It does not need that interval. A channel opened at its first unread message loads m40–m60
|
|
127
|
+
* while the server's newest is m95: `latestMessage` is m60, `latestMessageAt` is m95's time and
|
|
128
|
+
* `anchoredHeadItem` is `undefined`.
|
|
123
129
|
*/
|
|
124
|
-
|
|
130
|
+
get latestMessage(): LocalMessage | null;
|
|
125
131
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
132
|
+
* The newest server-confirmed message of the interval that reaches the newest message (see
|
|
133
|
+
* {@link anchoredHeadItems}). Any message the interval holds counts, system messages included, but
|
|
134
|
+
* not an unsent one: its id is local. `undefined` while that interval is not loaded or holds no
|
|
135
|
+
* server-confirmed message.
|
|
130
136
|
*
|
|
131
|
-
*
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
get anchoredHeadServerConfirmedItem(): LocalMessage | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Whether `message` counts as the channel's latest message: not shadowed, not an `error` or
|
|
142
|
+
* `ephemeral` message (only the current user sees those, e.g. a failed command or a giphy preview)
|
|
143
|
+
* and, in the main list, not a thread-only reply. A reply list (`parentMessageId` set) holds only
|
|
144
|
+
* thread replies, so the thread-only rule does not apply there.
|
|
145
|
+
*/
|
|
146
|
+
protected shouldAdvanceLatestMessage(message: LocalMessage): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Whether `message` is a main-list system message that, with
|
|
149
|
+
* `skip_last_msg_update_for_system_msgs`, does not move the channel's `last_message_at` on the
|
|
150
|
+
* server. It is still shown as the {@link latestMessage}, but {@link latestMessageAt} skips it.
|
|
151
|
+
*/
|
|
152
|
+
private isSkippedSystemMessage;
|
|
153
|
+
/** Whether `message` counts for {@link latestMessageAt}. */
|
|
154
|
+
private movesLastMessageAt;
|
|
155
|
+
/**
|
|
156
|
+
* Advances {@link latestMessage} (and so {@link latestMessageAt}) to `message` when it is newer
|
|
157
|
+
* and {@link shouldAdvanceLatestMessage} permits. Writes {@link aggregateState} only, so it is
|
|
158
|
+
* safe inside a `state.next` updater (`ingestPage`). Returns `true` when the value moved. Public
|
|
159
|
+
* for callers that advance it without an in-interval ingest, e.g. offline pending-message replay.
|
|
134
160
|
*/
|
|
135
|
-
|
|
161
|
+
trackLatestMessage(message: LocalMessage): boolean;
|
|
136
162
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
163
|
+
* Sets {@link MessagePaginatorAggregateState.queriedLatestMessageAt} from a query result's
|
|
164
|
+
* `last_message_at` (a channel's, or a thread's for a reply list), which {@link latestMessageAt}
|
|
165
|
+
* then takes into account. Each result replaces the previous value, even with an earlier one:
|
|
166
|
+
* the newest message may have been hard-deleted, which no event reports with the new value. A
|
|
167
|
+
* message ingested after the result was produced, such as a new one from an event, still counts,
|
|
168
|
+
* through {@link latestMessage}. `null` clears it (no messages); `undefined` (not in the result)
|
|
169
|
+
* leaves it.
|
|
170
|
+
*/
|
|
171
|
+
setQueriedLatestMessageAt(value: TimestampNS | null | undefined): void;
|
|
172
|
+
/**
|
|
173
|
+
* Clears the head mark of the head interval when it is stale (see {@link unmarkHead}). It is stale
|
|
174
|
+
* when its newest message is older than the `last_message_at` the latest query returned (see
|
|
175
|
+
* {@link setQueriedLatestMessageAt}): the channel has newer messages the interval lacks. The
|
|
176
|
+
* interval then stops being the head interval ({@link anchoredHeadItem} becomes `undefined`) and
|
|
177
|
+
* can load newer messages, and a message that then arrives from an event starts a separate head
|
|
178
|
+
* interval instead of joining it across the gap. Messages that exist only locally, such as a
|
|
179
|
+
* failed send, are left out of the comparison: they carry the device's clock.
|
|
180
|
+
*
|
|
181
|
+
* For example, the interval holds m1–m20 and the channel is not watched while m21–m25 are sent. A
|
|
182
|
+
* query returns m25's time: the interval can now load m21–m25, and m26 from an event does not land
|
|
183
|
+
* right after m20.
|
|
184
|
+
*
|
|
185
|
+
* Call it with each response that does not bring the newest messages up to date, before any page
|
|
186
|
+
* the response carries is placed: a page that reaches the newest message marks its own interval as
|
|
187
|
+
* the head. Call it only when no events were arriving before the response and nothing else
|
|
188
|
+
* brings the newest messages: while the channel is watched, a message the interval lacks is still
|
|
189
|
+
* on its way, and a re-watch that places the newest page settles the interval itself.
|
|
190
|
+
*/
|
|
191
|
+
unmarkStaleHead(): void;
|
|
192
|
+
/**
|
|
193
|
+
* A page reaches the newest message when its newest message is at or after
|
|
194
|
+
* {@link latestServerMessageAt}, as known before the page is ingested; one older than that is not
|
|
195
|
+
* the newest. That value comes from the latest response (`ChannelResponse` for a channel,
|
|
196
|
+
* `ThreadStateResponse` for a reply list, through {@link setQueriedLatestMessageAt}) and from the
|
|
197
|
+
* messages ingested since, such as new ones from events. `undefined` while it is not known.
|
|
198
|
+
*/
|
|
199
|
+
protected pageReachesHead(page: LocalMessage[]): boolean | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Ingests a single message, from an event or an operation such as a send. A message that starts
|
|
202
|
+
* the newest interval is placed by {@link ingestAsNewestInterval}. Any other goes into the
|
|
203
|
+
* interval it belongs to and the active interval stays active, except for the current user's new
|
|
204
|
+
* send (see {@link isOwnSendWhileOlderIntervalIsActive}): the newest interval holding it is
|
|
205
|
+
* shown, so the user sees what they sent.
|
|
140
206
|
*/
|
|
141
|
-
seedLastMessageAt(value: string | Date | null | undefined): void;
|
|
142
207
|
ingestItem(item: LocalMessage): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Whether `message` is the current user's own send (see {@link isOwnSend}) that the paginator
|
|
210
|
+
* does not hold yet, while the newest interval is loaded but another interval is active. A message
|
|
211
|
+
* already held (a retry of a failed send, a replayed send, its server confirmation) is not new.
|
|
212
|
+
*/
|
|
213
|
+
private isOwnSendWhileOlderIntervalIsActive;
|
|
214
|
+
/**
|
|
215
|
+
* Shows the interval holding the current user's own send. The send decides the interval shown, so
|
|
216
|
+
* it claims the active interval as a jump does: a page a query claimed earlier is then only
|
|
217
|
+
* stored.
|
|
218
|
+
*/
|
|
219
|
+
private showIntervalOfOwnSend;
|
|
220
|
+
/**
|
|
221
|
+
* A message the paginator does not hold yet, at or after {@link latestMessageAt} (as known before
|
|
222
|
+
* it arrives), while no loaded interval reaches the newest message. It is then the newest message,
|
|
223
|
+
* so it starts the newest interval, as a page holding it would (see {@link pageReachesHead}).
|
|
224
|
+
*/
|
|
225
|
+
private isNewNewestMessage;
|
|
226
|
+
/**
|
|
227
|
+
* The logical-head items (ingested one by one, usually from events, rather than as part of a
|
|
228
|
+
* page) not older than `queriedLatestMessageAt`, the `last_message_at` of the latest channel or
|
|
229
|
+
* thread response; all of them when no response has set it. They were ingested after that
|
|
230
|
+
* response, one after another, so nothing is missing between them. Items older than that, such as
|
|
231
|
+
* a message arriving out of order, are left out.
|
|
232
|
+
*/
|
|
233
|
+
private get logicalHeadItemsSinceQueriedLatestMessageAt();
|
|
234
|
+
/**
|
|
235
|
+
* Starts the newest interval with `message`, together with the
|
|
236
|
+
* {@link logicalHeadItemsSinceQueriedLatestMessageAt} ingested before it. It can load older
|
|
237
|
+
* messages unless none are left to load (see {@link hasNoMessagesBeforeLiveMessages}). It becomes
|
|
238
|
+
* the active interval when no interval was active, when the logical head it takes items from was,
|
|
239
|
+
* or when `message` is the current user's own send (see {@link isOwnSend}), as every own send
|
|
240
|
+
* shows the newest interval (see {@link ingestItem}).
|
|
241
|
+
*/
|
|
242
|
+
private ingestAsNewestInterval;
|
|
243
|
+
/**
|
|
244
|
+
* Whether no message older than the live messages is left to load: no interval of queried messages
|
|
245
|
+
* is loaded and the list reports no older messages, as after a newest page that came back empty.
|
|
246
|
+
* A list never queried, or one holding an interval (a jumped-to one, or one whose head mark was
|
|
247
|
+
* cleared), has older messages to load.
|
|
248
|
+
*/
|
|
249
|
+
private get hasNoMessagesBeforeLiveMessages();
|
|
250
|
+
/**
|
|
251
|
+
* Whether `message` is one the current user is sending from this device: status `sending` and
|
|
252
|
+
* authored by the client's user. The same user's message from another device arrives
|
|
253
|
+
* server-confirmed and is not one.
|
|
254
|
+
*/
|
|
255
|
+
private isOwnSend;
|
|
256
|
+
/** Whether the client's user wrote `message`; never for a paginator without a client. */
|
|
257
|
+
private isOwnMessage;
|
|
143
258
|
ingestPage(params: Parameters<MessageIntervalPaginator['ingestPage']>[0]): Interval | null;
|
|
259
|
+
onEntitiesChanged(batch: EntityStoreChangeBatch): void;
|
|
260
|
+
reflectUserUpdate(user: UserResponse): void;
|
|
144
261
|
removeItem(params: Parameters<MessageIntervalPaginator['removeItem']>[0]): ReturnType<MessageIntervalPaginator['removeItem']>;
|
|
262
|
+
truncate(params: Parameters<MessageIntervalPaginator['truncate']>[0]): void;
|
|
145
263
|
/**
|
|
146
|
-
* The still-loaded message with the greatest `created_at` that
|
|
147
|
-
* {@link
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
264
|
+
* The still-loaded message with the greatest `created_at` that `counts` (by default
|
|
265
|
+
* {@link shouldAdvanceLatestMessage}), from the interval that reaches the newest message and the
|
|
266
|
+
* {@link logicalHeadItemsSinceQueriedLatestMessageAt}. An interval reached by a jump is not
|
|
267
|
+
* searched, nor an out-of-order older message: neither is the channel's previous message. Used to
|
|
268
|
+
* recompute the tracked latest after the current one is removed or stops counting;
|
|
269
|
+
* `serverConfirmedOnly` skips unsent messages and `excludeId` skips that message. `null` when
|
|
270
|
+
* nothing loaded qualifies. It compares timestamps rather than positions, so it holds for any
|
|
271
|
+
* `itemOrder` / `requestSort`.
|
|
154
272
|
*/
|
|
155
|
-
private
|
|
273
|
+
private recomputeLatestMessage;
|
|
156
274
|
/**
|
|
157
|
-
* (Re)
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* re-seed the separator position, unread count and "jump to first unread" target all go stale
|
|
163
|
-
* across reopens.
|
|
275
|
+
* (Re)seeds the unread snapshot from the own read state. Runs once a first page and the rest of
|
|
276
|
+
* its response are in (the paginator's own first-page queries, `watch()` and the channel-list
|
|
277
|
+
* hydrate, when these place one), and the SDK calls it again when a channel is reopened from a
|
|
278
|
+
* cached paginator (no first-page query), so the separator, unread count and jump target follow
|
|
279
|
+
* the current read boundary.
|
|
164
280
|
*
|
|
165
|
-
* `firstUnreadMessageId` is
|
|
166
|
-
* (
|
|
167
|
-
* here would make the channel look explicitly marked-unread and suppress auto-mark-read.
|
|
281
|
+
* `firstUnreadMessageId` is reset to `null`: it holds only an explicit mark-unread
|
|
282
|
+
* (`notification.mark_unread`), and a computed value would suppress auto-mark-read.
|
|
168
283
|
*/
|
|
169
284
|
seedUnreadSnapshot: () => void;
|
|
170
285
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
286
|
+
* Applies the rest of the response, then takes the unread snapshot after a first-page query, from
|
|
287
|
+
* the read state the response brought. A viewed channel is marked read right after it opens, so
|
|
288
|
+
* the snapshot keeps the unread state from before, for unread UI indicators.
|
|
174
289
|
*/
|
|
175
|
-
|
|
290
|
+
protected applyQueryResponseRest(response: MessageQueryResponse, placeParams: QueryPagePlacement<MessageQueryShape>): void;
|
|
176
291
|
/**
|
|
177
|
-
* Jumps to the unread reference message.
|
|
178
|
-
*
|
|
179
|
-
* IMPORTANT: This intentionally does *not* rely on `channel.state.read[ownUserId]` only,
|
|
180
|
-
* because apps may mark a channel read immediately after opening it, while still
|
|
181
|
-
* wanting to keep "jump to unread" UI indicators alive (based on a snapshot).
|
|
292
|
+
* Jumps to the unread reference message. It does not rely on `channel.state.read` alone, since
|
|
293
|
+
* apps may mark a channel read on open yet keep "jump to unread" UI alive from the snapshot.
|
|
182
294
|
*
|
|
183
295
|
* Resolution order:
|
|
184
|
-
* 1
|
|
185
|
-
* 2
|
|
186
|
-
*
|
|
187
|
-
* 3
|
|
296
|
+
* 1. an explicit first-unread ID (snapshot or read state): jump to it;
|
|
297
|
+
* 2. the last-read timestamp: infer the first unread message from the loaded interval, or from a
|
|
298
|
+
* `created_at_around` query when the interval does not straddle the boundary, and jump to it;
|
|
299
|
+
* 3. the last-read ID, when no timestamp is known.
|
|
188
300
|
*
|
|
189
|
-
* The
|
|
190
|
-
*
|
|
191
|
-
* only used as a fallback when we cannot infer an unread boundary. The inference is NOT persisted
|
|
192
|
-
* back into the snapshot (that is reserved for explicit mark-unread).
|
|
301
|
+
* The inference is not written to the snapshot: `firstUnreadMessageId` is reserved for an explicit
|
|
302
|
+
* mark-unread (it would suppress auto-mark-read).
|
|
193
303
|
*/
|
|
194
304
|
jumpToTheFirstUnreadMessage: (options?: JumpToMessageOptions) => Promise<boolean>;
|
|
195
305
|
setUnreadSnapshot: (next: Partial<UnreadSnapshotState>) => UnreadSnapshotState;
|
|
306
|
+
get isViewingLive(): boolean;
|
|
196
307
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* Intentionally NOT reset by `clearStateAndCache` — it is an external input owned by the SDK, not
|
|
201
|
-
* derived pagination state.
|
|
308
|
+
* Sets the live-view signal ({@link LiveViewState}). Not reset by `clearStateAndCache`: it is an
|
|
309
|
+
* external input owned by the SDK.
|
|
202
310
|
*/
|
|
203
|
-
/** Current "viewing the latest messages" boolean (convenience read of {@link liveViewState}). */
|
|
204
|
-
get isViewingLive(): boolean;
|
|
205
311
|
setViewingLive: (isViewingLive: boolean) => void;
|
|
206
312
|
clearUnreadSnapshot: () => void;
|
|
207
313
|
clearStateAndCache(): void;
|
|
@@ -14,41 +14,30 @@ export type PinnedMessagePaginatorOptions = {
|
|
|
14
14
|
paginatorOptions?: PaginatorOptions<LocalMessage, MessageQueryShape>;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* The channel's pinned messages, ordered by `pinned_at` ascending (oldest-pinned first). Extends
|
|
18
|
+
* {@link MessageIntervalPaginator} rather than {@link MessagePaginator}: pinned messages are a subset
|
|
19
|
+
* of the channel and take no part in read/unread or delivery-receipt tracking.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* the channel and thread message timelines). By extending the base rather than {@link MessagePaginator}
|
|
22
|
-
* it simply never gets the unread surface.
|
|
23
|
-
*
|
|
24
|
-
* Differences from the main list:
|
|
25
|
-
* - fetches from the `/pinned_messages` endpoint (`channel.getPinnedMessages`) rather than
|
|
26
|
-
* `channel.query({ messages })`;
|
|
27
|
-
* - includes only pinned, non-shadowed messages (`shouldIncludeMessageInInterval`), and filters on
|
|
28
|
-
* `{ cid, pinned: true }` so `ingestItem` auto-adds on pin and auto-removes on unpin;
|
|
29
|
-
* - orders by `pinned_at` ascending (oldest-pinned first), matching the legacy
|
|
30
|
-
* `channel.state.pinnedMessages` order.
|
|
31
|
-
*
|
|
32
|
-
* Navigation (`jumpToMessage` / `jumpToTheLatestMessage`) is inherited and meaningful — the endpoint
|
|
33
|
-
* supports `id_around` — but no unread-coupled navigation exists.
|
|
21
|
+
* Fetches through `channel.getPinnedMessages`, includes only pinned, non-shadowed messages and
|
|
22
|
+
* matches `{ cid, pinned: true }`, so `ingestItem` adds on pin and removes on unpin.
|
|
34
23
|
*/
|
|
35
24
|
export declare class PinnedMessagePaginator extends MessageIntervalPaginator {
|
|
25
|
+
protected get holderName(): string;
|
|
36
26
|
constructor({ channel, id, itemIndex, paginatorOptions, }: PinnedMessagePaginatorOptions);
|
|
37
|
-
/**
|
|
38
|
-
* Memoized for the reason {@link MessageIntervalPaginator}'s overlay is: the base derivation folds
|
|
39
|
-
* this in and skips the publish when nothing moved, which needs stable references. Both close over
|
|
40
|
-
* `this` and over a fixed `pinned_at` sort, so there is nothing to rebuild.
|
|
41
|
-
*/
|
|
27
|
+
/** Memoized: stable references let the base derivation skip a publish when nothing moved. */
|
|
42
28
|
private pinnedBehaviour?;
|
|
43
29
|
private buildPinnedBehaviour;
|
|
44
30
|
private pinnedTiebreaker;
|
|
45
|
-
/**
|
|
46
|
-
* The ordering and request behaviour that makes this a *pinned*-message paginator, contributed to the
|
|
47
|
-
* base derivation so a re-derivation cannot drop it and does not need a second write to restore it.
|
|
48
|
-
* Spread over the interval overlay, so this class's `pinned_at` comparator wins.
|
|
49
|
-
*/
|
|
31
|
+
/** Adds the pinned ordering and request behaviour to the derivation, over the interval overlay. */
|
|
50
32
|
protected getBehaviourOverrides(): Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>;
|
|
51
33
|
private installPinnedMessageBehaviour;
|
|
34
|
+
/**
|
|
35
|
+
* The newest page (no cursor, not around a message) holds the most recently pinned messages, so
|
|
36
|
+
* it reaches the head: its interval becomes the only newest interval, and an older interval that
|
|
37
|
+
* was the newest one can load newer pins (see `makeOnlyHead`). A newest page comes from this
|
|
38
|
+
* paginator's own query or with a channel response.
|
|
39
|
+
*/
|
|
40
|
+
protected pageReachesHead(_page: LocalMessage[], queryShape: MessageQueryShape | undefined): boolean | undefined;
|
|
52
41
|
buildMatchFilters: () => PinnedMessagePaginatorFilter;
|
|
53
42
|
shouldIncludeMessageInInterval(message: LocalMessage): boolean;
|
|
54
43
|
}
|
|
@@ -13,7 +13,8 @@ export declare class ReminderPaginator extends BasePaginator<ReminderResponseDat
|
|
|
13
13
|
constructor(client: StreamChat, options?: PaginatorOptions<ReminderResponseData, QueryRemindersRequest>);
|
|
14
14
|
getItemId(item: ReminderResponseData): string;
|
|
15
15
|
private buildSortComparator;
|
|
16
|
-
protected getNextQueryShape(
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
protected getNextQueryShape(): QueryRemindersRequest;
|
|
17
|
+
protected fetchQueryResponse: ({ direction, queryShape, }: PaginationQueryParams<QueryRemindersRequest>) => Promise<PaginationQueryReturnValue<ReminderResponseData>>;
|
|
18
|
+
/** The extracting step of the query pipeline: the response is the page. */
|
|
19
|
+
protected extractQueryPage(response: PaginationQueryReturnValue<ReminderResponseData>, _params: PaginationQueryParams<QueryRemindersRequest>): PaginationQueryReturnValue<ReminderResponseData>;
|
|
19
20
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BasePaginator } from './BasePaginator';
|
|
2
|
+
import type { PaginationQueryParams, PaginationQueryReturnValue, PaginatorOptions, PaginatorState } from './BasePaginator';
|
|
3
|
+
import type { StreamChat } from '../../client';
|
|
4
|
+
import { EntityStore } from '../../entityStore/EntityStore';
|
|
5
|
+
import type { Thread } from '../../thread';
|
|
6
|
+
import type { QueryThreadsRequest } from '../../types';
|
|
7
|
+
export declare const DEFAULT_THREAD_PAGE_SIZE = 25;
|
|
8
|
+
/** Default query options for every page of the thread list. */
|
|
9
|
+
export declare const DEFAULT_THREAD_QUERY: QueryThreadsRequest;
|
|
10
|
+
export type ThreadPaginatorOptions = {
|
|
11
|
+
client: StreamChat;
|
|
12
|
+
/** Store holding the list's threads (`client.threads`' thread store). Omitted: a private one. */
|
|
13
|
+
store?: EntityStore<Thread>;
|
|
14
|
+
paginatorOptions?: PaginatorOptions<Thread, QueryThreadsRequest>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The thread list, in the order `queryThreads` returns it. There is no client-side sort: the server
|
|
18
|
+
* order (unread first, then latest reply) depends on state a `Thread` mutates in place, so a
|
|
19
|
+
* comparator would corrupt interval storage. Pages append in server order and
|
|
20
|
+
* {@link ThreadPaginator.reload} replaces the list.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ThreadPaginator extends BasePaginator<Thread, QueryThreadsRequest> {
|
|
23
|
+
private readonly client;
|
|
24
|
+
private readonly store;
|
|
25
|
+
constructor({ client, store, paginatorOptions, }: ThreadPaginatorOptions);
|
|
26
|
+
/** No next page until a load has landed, so `toTail()` is a no-op before the first reload. */
|
|
27
|
+
get initialState(): PaginatorState<Thread>;
|
|
28
|
+
getItemId(thread: Thread): string;
|
|
29
|
+
protected getNextQueryShape({ direction, }: Required<Pick<PaginationQueryParams<QueryThreadsRequest>, 'direction'>>): QueryThreadsRequest;
|
|
30
|
+
protected fetchQueryResponse: ({ queryShape, }: PaginationQueryParams<QueryThreadsRequest>) => Promise<PaginationQueryReturnValue<Thread>>;
|
|
31
|
+
/** The extracting step of the query pipeline: the response is the page. */
|
|
32
|
+
protected extractQueryPage(response: PaginationQueryReturnValue<Thread>, _params: PaginationQueryParams<QueryThreadsRequest>): PaginationQueryReturnValue<Thread>;
|
|
33
|
+
/**
|
|
34
|
+
* Re-queries the first page and replaces the list in server order; also the first load. The
|
|
35
|
+
* current threads stay until the response lands. A failed query leaves them and records
|
|
36
|
+
* `lastQueryError`; a success clears it. Only the first load publishes `isLoading` (with items it
|
|
37
|
+
* would mean the next page).
|
|
38
|
+
*/
|
|
39
|
+
reload: ({ limit }?: {
|
|
40
|
+
limit?: number;
|
|
41
|
+
}) => Promise<void>;
|
|
42
|
+
/** Also clears the item index (the base reset keeps it), before the base publishes. */
|
|
43
|
+
resetState(): void;
|
|
44
|
+
}
|
|
@@ -3,12 +3,8 @@ import type { PaginationQueryParams, PaginationQueryReturnValue, PaginatorOption
|
|
|
3
3
|
import type { ListUserGroupsOptions, UserGroupResponse } from '../../types';
|
|
4
4
|
import type { StreamChat } from '../../client';
|
|
5
5
|
/**
|
|
6
|
-
* Paginates
|
|
7
|
-
*
|
|
8
|
-
* This entity only supports forward (tailward) cursor pagination via
|
|
9
|
-
* `created_at_gt` and `id_gt`. Backward (headward) pagination is not available
|
|
10
|
-
* because the API does not expose a backward cursor, so the headward cursor is
|
|
11
|
-
* initialized as exhausted (`null`).
|
|
6
|
+
* Paginates `/usergroups` forward (tailward) only, via `created_at_gt` and `id_gt`. The API has no
|
|
7
|
+
* backward cursor, so the headward cursor starts exhausted (`null`).
|
|
12
8
|
*/
|
|
13
9
|
export declare class UserGroupPaginator extends BasePaginator<UserGroupResponse, ListUserGroupsOptions> {
|
|
14
10
|
private client;
|
|
@@ -19,6 +15,7 @@ export declare class UserGroupPaginator extends BasePaginator<UserGroupResponse,
|
|
|
19
15
|
set teamId(teamId: string | undefined);
|
|
20
16
|
private buildNextCursor;
|
|
21
17
|
protected getNextQueryShape(): ListUserGroupsOptions;
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
protected fetchQueryResponse: ({ direction, queryShape, }: PaginationQueryParams<ListUserGroupsOptions>) => Promise<PaginationQueryReturnValue<UserGroupResponse>>;
|
|
19
|
+
/** The extracting step of the query pipeline: the response is the page. */
|
|
20
|
+
protected extractQueryPage(response: PaginationQueryReturnValue<UserGroupResponse>, _params: PaginationQueryParams<ListUserGroupsOptions>): PaginationQueryReturnValue<UserGroupResponse>;
|
|
24
21
|
}
|