stream-chat 10.0.0-rc.9 → 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 +21650 -19790
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +21690 -19798
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +21755 -19895
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +216 -135
- package/dist/types/CooldownTimer.d.ts +13 -27
- package/dist/types/EventHandlerPipeline.d.ts +18 -38
- package/dist/types/LiveLocationManager.d.ts +24 -52
- package/dist/types/api-client.d.ts +17 -5
- package/dist/types/channel.d.ts +432 -470
- package/dist/types/channel_state.d.ts +68 -112
- package/dist/types/client.d.ts +321 -435
- 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 +2 -0
- 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 +2528 -690
- package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +33 -14
- package/dist/types/index.d.ts +10 -6
- 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 +7 -1
- 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 -128
- 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 +19 -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 +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 +40 -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 -186
- 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 -334
- 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 +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +34 -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 +11 -11
- 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 +63 -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 -199
- 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 +33 -57
- package/dist/types/utils.d.ts +72 -91
- package/package.json +14 -40
- package/src/ChannelManager.ts +494 -303
- package/src/CooldownTimer.ts +28 -38
- package/src/EventHandlerPipeline.ts +22 -45
- package/src/LiveLocationManager.ts +37 -76
- package/src/api-client.ts +113 -50
- package/src/campaign.ts +1 -1
- package/src/channel.ts +1067 -1276
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +73 -168
- package/src/client.ts +744 -974
- 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 -232
- 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 +6 -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 -1540
- package/src/gen/models/index.ts +2498 -3383
- package/src/gen/models/timestamp-guard.ts +27 -0
- package/src/gen/moderation/ModerationApi.ts +170 -367
- package/src/index.ts +22 -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 +19 -23
- 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 +223 -174
- 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/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 -125
- package/src/messageDelivery/MessageReceiptsTracker.ts +88 -101
- package/src/messageOperations/FailedSendCache.ts +85 -0
- package/src/messageOperations/MessageOperationStatePolicy.ts +121 -112
- package/src/messageOperations/MessageOperations.ts +297 -175
- package/src/{entityStore → messageOperations}/applyReactionLocally.ts +9 -28
- 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 +226 -669
- package/src/offline-support/offline_sync_manager.ts +51 -80
- package/src/offline-support/queueableOperations.ts +98 -73
- package/src/offline-support/types.ts +43 -186
- 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 +15 -63
- 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 +479 -217
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1351 -772
- package/src/pagination/paginators/MessagePaginator.ts +513 -233
- 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 +16 -19
- 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 +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +177 -98
- package/src/poll_manager.ts +24 -22
- package/src/poll_optimistic_votes.ts +335 -0
- package/src/reminders/Reminder.ts +16 -12
- package/src/reminders/ReminderManager.ts +22 -55
- package/src/reminders/ReminderTimer.ts +1 -2
- 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 +418 -703
- package/src/thread_manager.ts +300 -234
- package/src/token_manager.ts +12 -22
- package/src/types.ts +102 -216
- 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 +40 -60
- package/src/utils.ts +181 -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 -32
- 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/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 -257
- package/src/messageOperations/persistence.ts +0 -40
- package/src/pagination/utility.queryChannel.ts +0 -84
- package/src/store.ts +0 -304
|
@@ -3,59 +3,55 @@ import { EntityStore, type EntityStoreSubscriber } from './EntityStore';
|
|
|
3
3
|
|
|
4
4
|
export type StoreBackedItemIndexOptions<T> = {
|
|
5
5
|
getEntityId: (item: T) => string;
|
|
6
|
-
/**
|
|
7
|
-
* The entity that owns this index; used as the store subscriber, which also holds its refcount.
|
|
8
|
-
* Optional: an index over a private store (see `store`) has no one to fan out to, so an
|
|
9
|
-
* owner-less index just uses an internal no-op subscriber to hold its refcount. Message paginators pass themselves so
|
|
10
|
-
* cross-collection updates reach them; single-home collections (channels, reminders, …) omit it.
|
|
11
|
-
*/
|
|
6
|
+
/** The list that owns this index; the store's notifications, ID renames and removals reach it. */
|
|
12
7
|
owner?: EntityStoreSubscriber;
|
|
8
|
+
/** The holder's name in the store, for debugging tools: no spaces, e.g. `channel-paginator`. */
|
|
9
|
+
holderName?: string;
|
|
13
10
|
/**
|
|
14
|
-
* The
|
|
15
|
-
*
|
|
16
|
-
* plain, per-instance index — same code path, no shared content, no fan-out. This is the mode used
|
|
17
|
-
* by single-home collections and by detached paginators (e.g. built without a client, in tests).
|
|
11
|
+
* The store the items live in, shared with other lists. Without it the index makes a private
|
|
12
|
+
* store and behaves like a plain per-list map (e.g. paginators built without a client).
|
|
18
13
|
*/
|
|
19
14
|
store?: EntityStore<T>;
|
|
20
15
|
};
|
|
21
16
|
|
|
22
|
-
/** No-op subscriber that holds the refcount for an owner-less (private-store) index. */
|
|
23
|
-
const NOOP_OWNER: EntityStoreSubscriber = { onEntitiesChanged: () => undefined };
|
|
24
|
-
|
|
25
17
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
18
|
+
* The item index of one list (a paginator). Items live in an {@link EntityStore}, which can be
|
|
19
|
+
* shared with other lists; the index only records which IDs belong to this list (`memberIds`) and
|
|
20
|
+
* stands for the list in the store with one `holder`. Reads see only this list's items, even when a
|
|
21
|
+
* shared store holds other lists' items.
|
|
30
22
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* lives in the (possibly shared) store. This is what keeps e.g. reaction routing
|
|
34
|
-
* (`threadPaginator.getItem(id) ? thread : channel`) correct and keeps the `.values()` scans
|
|
35
|
-
* from ever walking other channels' entities.
|
|
36
|
-
* - `setOne` writes content once into the store and links the owner as a subscriber (drives both
|
|
37
|
-
* notification fan-out and refcount GC). The write passes the owner as the `subscriber` to skip, so
|
|
38
|
-
* the owner is not notified of its own write (it re-emits its window inline); other subscribers of
|
|
39
|
-
* the same id ARE notified and re-project.
|
|
40
|
-
* - `remove`/`clear` unlink the owner rather than hard-deleting content, so an entity still held by
|
|
41
|
-
* another index (e.g. a `show_in_channel` reply in both the channel list and its thread) survives;
|
|
42
|
-
* the store GCs it only when the last subscriber unlinks.
|
|
23
|
+
* Store callbacks reach the owner through the holder: changes to held items (except the owner's own
|
|
24
|
+
* writes), removals (with the removed item), and ID renames, which are also applied to `memberIds`.
|
|
43
25
|
*
|
|
44
|
-
*
|
|
45
|
-
* one subscriber (its own owner), so no fan-out ever fires and removal GCs immediately, matching a plain
|
|
46
|
-
* per-instance index.
|
|
47
|
-
*
|
|
48
|
-
* @template T The domain item type held by the index; collocated with the {@link EntityStore}'s.
|
|
26
|
+
* @template T The item type held by the index and its store.
|
|
49
27
|
*/
|
|
50
28
|
export class StoreBackedItemIndex<T> implements ItemIndexApi<T> {
|
|
51
29
|
private memberIds = new Set<string>();
|
|
52
30
|
private readonly store: EntityStore<T>;
|
|
53
|
-
|
|
31
|
+
/**
|
|
32
|
+
* This index's identity in the store: linked per ID while the index lists it, and unlinked on
|
|
33
|
+
* remove or clear. The store tells holders apart by object, so every index has its own, even with
|
|
34
|
+
* the same owner or none.
|
|
35
|
+
*/
|
|
36
|
+
private readonly holder: EntityStoreSubscriber;
|
|
54
37
|
private readonly getEntityId: (item: T) => string;
|
|
55
38
|
|
|
56
|
-
constructor({ store, owner, getEntityId }: StoreBackedItemIndexOptions<T>) {
|
|
39
|
+
constructor({ store, owner, getEntityId, holderName }: StoreBackedItemIndexOptions<T>) {
|
|
57
40
|
this.store = store ?? new EntityStore<T>({ getEntityId });
|
|
58
|
-
this.
|
|
41
|
+
this.holder = {
|
|
42
|
+
name: holderName,
|
|
43
|
+
onEntitiesChanged: (batch) => owner?.onEntitiesChanged(batch),
|
|
44
|
+
flushState: () => owner?.flushState?.(),
|
|
45
|
+
onIdChanged: (oldId, newId) => {
|
|
46
|
+
if (this.memberIds.delete(oldId)) this.memberIds.add(newId);
|
|
47
|
+
owner?.onIdChanged?.(oldId, newId);
|
|
48
|
+
},
|
|
49
|
+
onEntityRemoved: (id, entity) => {
|
|
50
|
+
// Owner first: dropping the item from its intervals still reads it through this index.
|
|
51
|
+
owner?.onEntityRemoved?.(id, entity);
|
|
52
|
+
this.memberIds.delete(id);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
59
55
|
this.getEntityId = getEntityId;
|
|
60
56
|
}
|
|
61
57
|
|
|
@@ -67,9 +63,9 @@ export class StoreBackedItemIndex<T> implements ItemIndexApi<T> {
|
|
|
67
63
|
|
|
68
64
|
setOne(item: T) {
|
|
69
65
|
const id = this.getEntityId(item);
|
|
70
|
-
this.store.link(id, this.
|
|
66
|
+
this.store.link(id, this.holder);
|
|
71
67
|
this.memberIds.add(id);
|
|
72
|
-
this.store.upsert(item, this.
|
|
68
|
+
this.store.upsert(item, this.holder);
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
get(id: string): T | undefined {
|
|
@@ -83,11 +79,11 @@ export class StoreBackedItemIndex<T> implements ItemIndexApi<T> {
|
|
|
83
79
|
remove(id: string) {
|
|
84
80
|
if (!this.memberIds.has(id)) return;
|
|
85
81
|
this.memberIds.delete(id);
|
|
86
|
-
this.store.unlink(id, this.
|
|
82
|
+
this.store.unlink(id, this.holder);
|
|
87
83
|
}
|
|
88
84
|
|
|
89
85
|
clear() {
|
|
90
|
-
for (const id of this.memberIds) this.store.unlink(id, this.
|
|
86
|
+
for (const id of this.memberIds) this.store.unlink(id, this.holder);
|
|
91
87
|
this.memberIds.clear();
|
|
92
88
|
}
|
|
93
89
|
|
package/src/entityStore/index.ts
CHANGED
package/src/errors.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AxiosResponse } from 'axios';
|
|
2
|
-
import { isCancel } from 'axios';
|
|
3
|
-
import
|
|
2
|
+
import { isAxiosError, isCancel } from 'axios';
|
|
3
|
+
import { OfflineError } from './offline-support/types';
|
|
4
|
+
import type { APIError as Gen_APIError, StreamAPIError } from './types';
|
|
4
5
|
|
|
5
6
|
export const APIErrorCodes: Record<string, { name: string; retryable: boolean }> = {
|
|
6
7
|
'-1': { name: 'InternalSystemError', retryable: true },
|
|
@@ -43,13 +44,8 @@ export function isAPIError(error: Error): error is APIError {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
|
-
* Whether the server answered "
|
|
47
|
-
*
|
|
48
|
-
* Use it to avoid surfacing an error state for something a caller can legitimately ask about before
|
|
49
|
-
* it exists (a thread on a parent that has no replies yet, say).
|
|
50
|
-
*
|
|
51
|
-
* Resolved through {@link APIErrorCodes} rather than comparing the numeric code, so the table stays
|
|
52
|
-
* the single place the mapping lives.
|
|
47
|
+
* Whether the server answered "does not exist": an expected answer for a resource a caller may ask
|
|
48
|
+
* about before it exists, not a failure.
|
|
53
49
|
*/
|
|
54
50
|
export function isDoesNotExistError(error: Error): boolean {
|
|
55
51
|
return (
|
|
@@ -64,18 +60,15 @@ export function isErrorRetryable(error: APIError) {
|
|
|
64
60
|
return err.retryable;
|
|
65
61
|
}
|
|
66
62
|
|
|
63
|
+
export function isConnectionIDError(error: APIError) {
|
|
64
|
+
return error.code === 46; // ConnectionIDNotFoundError
|
|
65
|
+
}
|
|
66
|
+
|
|
67
67
|
/**
|
|
68
|
-
* Whether an error is
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* non-retryable code (InputError 4, DoesNotExist 16, NotAllowed 17, …) and when the caller
|
|
73
|
-
* cancelled the request.
|
|
74
|
-
*
|
|
75
|
-
* Cancellation is deliberately NOT ephemeral even though an aborted request carries no `response`.
|
|
76
|
-
* A caller who aborts via `StreamRequestOptions.signal` wants the operation dropped, so treating it
|
|
77
|
-
* as transient would do the opposite of what was asked: the task would be queued and replayed on
|
|
78
|
-
* reconnect, and any optimistic local update would be kept rather than rolled back.
|
|
68
|
+
* Whether an error is transient and worth queueing or retrying: the server never responded (no
|
|
69
|
+
* `response`, e.g. an axios network error or an `OfflineError`) or responded with a retryable code
|
|
70
|
+
* (see {@link APIErrorCodes}). A request cancelled by the caller is not ephemeral: it is dropped,
|
|
71
|
+
* not queued for replay.
|
|
79
72
|
*/
|
|
80
73
|
export function isEphemeral(error: Error): boolean {
|
|
81
74
|
if (isCancel(error)) return false;
|
|
@@ -100,3 +93,29 @@ export function isErrorResponse(
|
|
|
100
93
|
): res is AxiosResponse<Gen_APIError> {
|
|
101
94
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
102
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Whether a request failed in transport: axios sent it and got no response (and the caller did not
|
|
99
|
+
* cancel it), or the offline layer refused to send it. An error thrown by anything else, such as an
|
|
100
|
+
* integrator's own request handler, is not one, even though it carries no response either.
|
|
101
|
+
*/
|
|
102
|
+
const isTransportFailure = (error: unknown) =>
|
|
103
|
+
error instanceof OfflineError ||
|
|
104
|
+
(isAxiosError(error) && !error.response && !isCancel(error));
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Turns whatever a request threw into a plain error object, so it can be stored on a message. A
|
|
108
|
+
* transport failure (see {@link isTransportFailure}) has no HTTP status and is given `status: 0`,
|
|
109
|
+
* which is how a UI tells it from a rejection.
|
|
110
|
+
*/
|
|
111
|
+
export const parseError = (error: unknown): StreamAPIError => {
|
|
112
|
+
const stringError = JSON.stringify(error);
|
|
113
|
+
const parsed = (stringError ? JSON.parse(stringError) : {}) as StreamAPIError;
|
|
114
|
+
return parsed.status == null && isTransportFailure(error)
|
|
115
|
+
? ({ ...parsed, status: 0 } as StreamAPIError)
|
|
116
|
+
: parsed;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Whether the server rejected a send because a message with that ID already exists. */
|
|
120
|
+
export const isAlreadyExistsError = (error: unknown, parsed: StreamAPIError) =>
|
|
121
|
+
parsed.code === 4 && error instanceof Error && error.message.includes('already exists');
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LocalMessage } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One `LocalMessage` per source object, shared by every subscriber that formats the same
|
|
5
|
+
* `event.message`, so `EntityStore.upsert`'s reference check skips redundant writes. Keyed weakly:
|
|
6
|
+
* an entry lives as long as its source.
|
|
7
|
+
*/
|
|
8
|
+
const memo: WeakMap<object, LocalMessage> = new WeakMap();
|
|
9
|
+
|
|
10
|
+
/** The `LocalMessage` already produced for `source`, if any. */
|
|
11
|
+
export const getMemoizedFormat = (source: object): LocalMessage | undefined =>
|
|
12
|
+
memo.get(source);
|
|
13
|
+
|
|
14
|
+
/** Records `formatted` as the `LocalMessage` for `source`. */
|
|
15
|
+
export const memoizeFormat = (source: object, formatted: LocalMessage): void => {
|
|
16
|
+
memo.set(source, formatted);
|
|
17
|
+
};
|
|
@@ -7,6 +7,10 @@ import type {
|
|
|
7
7
|
CreateDraftResponse,
|
|
8
8
|
DeleteChannelResponse,
|
|
9
9
|
EventResponse,
|
|
10
|
+
ForkChannelRequest,
|
|
11
|
+
ForkChannelResponse,
|
|
12
|
+
ForkMessageIDsRequest,
|
|
13
|
+
ForkMessageIDsResponse,
|
|
10
14
|
GetDraftResponse,
|
|
11
15
|
GetManyMessagesResponse,
|
|
12
16
|
GetPinnedMessagesResponse,
|
|
@@ -15,7 +19,11 @@ import type {
|
|
|
15
19
|
MarkReadRequest,
|
|
16
20
|
MarkReadResponse,
|
|
17
21
|
MarkUnreadRequest,
|
|
22
|
+
QueryChannelBansRequest,
|
|
23
|
+
QueryChannelBansResponse,
|
|
18
24
|
Response,
|
|
25
|
+
RewindChannelRequest,
|
|
26
|
+
RewindChannelResponse,
|
|
19
27
|
SendEventRequest,
|
|
20
28
|
SendMessageRequest,
|
|
21
29
|
SendMessageResponse,
|
|
@@ -54,7 +62,8 @@ export class ChannelApi {
|
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
return this.chatApi.deleteChannel(
|
|
57
|
-
{ id: this.id, type: this.type
|
|
65
|
+
{ id: this.id, type: this.type },
|
|
66
|
+
request,
|
|
58
67
|
requestOptions,
|
|
59
68
|
);
|
|
60
69
|
}
|
|
@@ -80,14 +89,14 @@ export class ChannelApi {
|
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
return this.chatApi.getChannel(
|
|
83
|
-
{ id: this.id, type: this.type
|
|
92
|
+
{ id: this.id, type: this.type },
|
|
93
|
+
request,
|
|
84
94
|
requestOptions,
|
|
85
95
|
);
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
updateChannelPartial(
|
|
89
99
|
request?: UpdateChannelPartialRequest,
|
|
90
|
-
|
|
91
100
|
requestOptions?: StreamRequestOptions,
|
|
92
101
|
): Promise<StreamResponse<UpdateChannelPartialResponse>> {
|
|
93
102
|
if (!this.id) {
|
|
@@ -97,14 +106,14 @@ export class ChannelApi {
|
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
return this.chatApi.updateChannelPartial(
|
|
100
|
-
{ id: this.id, type: this.type
|
|
109
|
+
{ id: this.id, type: this.type },
|
|
110
|
+
request,
|
|
101
111
|
requestOptions,
|
|
102
112
|
);
|
|
103
113
|
}
|
|
104
114
|
|
|
105
115
|
update(
|
|
106
116
|
request?: UpdateChannelRequest,
|
|
107
|
-
|
|
108
117
|
requestOptions?: StreamRequestOptions,
|
|
109
118
|
): Promise<StreamResponse<UpdateChannelResponse>> {
|
|
110
119
|
if (!this.id) {
|
|
@@ -114,7 +123,25 @@ export class ChannelApi {
|
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
return this.chatApi.updateChannel(
|
|
117
|
-
{ id: this.id, type: this.type
|
|
126
|
+
{ id: this.id, type: this.type },
|
|
127
|
+
request,
|
|
128
|
+
requestOptions,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
queryChannelBans(
|
|
133
|
+
request?: QueryChannelBansRequest,
|
|
134
|
+
requestOptions?: StreamRequestOptions,
|
|
135
|
+
): Promise<StreamResponse<QueryChannelBansResponse>> {
|
|
136
|
+
if (!this.id) {
|
|
137
|
+
throw new Error(
|
|
138
|
+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return this.chatApi.queryChannelBans(
|
|
143
|
+
{ id: this.id, type: this.type },
|
|
144
|
+
request,
|
|
118
145
|
requestOptions,
|
|
119
146
|
);
|
|
120
147
|
}
|
|
@@ -130,7 +157,8 @@ export class ChannelApi {
|
|
|
130
157
|
}
|
|
131
158
|
|
|
132
159
|
return this.chatApi.deleteDraft(
|
|
133
|
-
{ id: this.id, type: this.type
|
|
160
|
+
{ id: this.id, type: this.type },
|
|
161
|
+
request,
|
|
134
162
|
requestOptions,
|
|
135
163
|
);
|
|
136
164
|
}
|
|
@@ -146,14 +174,14 @@ export class ChannelApi {
|
|
|
146
174
|
}
|
|
147
175
|
|
|
148
176
|
return this.chatApi.getDraft(
|
|
149
|
-
{ id: this.id, type: this.type
|
|
177
|
+
{ id: this.id, type: this.type },
|
|
178
|
+
request,
|
|
150
179
|
requestOptions,
|
|
151
180
|
);
|
|
152
181
|
}
|
|
153
182
|
|
|
154
183
|
createDraft(
|
|
155
184
|
request: CreateDraftRequest,
|
|
156
|
-
|
|
157
185
|
requestOptions?: StreamRequestOptions,
|
|
158
186
|
): Promise<StreamResponse<CreateDraftResponse>> {
|
|
159
187
|
if (!this.id) {
|
|
@@ -163,14 +191,14 @@ export class ChannelApi {
|
|
|
163
191
|
}
|
|
164
192
|
|
|
165
193
|
return this.chatApi.createDraft(
|
|
166
|
-
{ id: this.id, type: this.type
|
|
194
|
+
{ id: this.id, type: this.type },
|
|
195
|
+
request,
|
|
167
196
|
requestOptions,
|
|
168
197
|
);
|
|
169
198
|
}
|
|
170
199
|
|
|
171
200
|
sendEvent(
|
|
172
201
|
request: SendEventRequest,
|
|
173
|
-
|
|
174
202
|
requestOptions?: StreamRequestOptions,
|
|
175
203
|
): Promise<StreamResponse<EventResponse>> {
|
|
176
204
|
if (!this.id) {
|
|
@@ -180,7 +208,8 @@ export class ChannelApi {
|
|
|
180
208
|
}
|
|
181
209
|
|
|
182
210
|
return this.chatApi.sendEvent(
|
|
183
|
-
{ id: this.id, type: this.type
|
|
211
|
+
{ id: this.id, type: this.type },
|
|
212
|
+
request,
|
|
184
213
|
requestOptions,
|
|
185
214
|
);
|
|
186
215
|
}
|
|
@@ -196,14 +225,14 @@ export class ChannelApi {
|
|
|
196
225
|
}
|
|
197
226
|
|
|
198
227
|
return this.chatApi.deleteChannelFile(
|
|
199
|
-
{ id: this.id, type: this.type
|
|
228
|
+
{ id: this.id, type: this.type },
|
|
229
|
+
request,
|
|
200
230
|
requestOptions,
|
|
201
231
|
);
|
|
202
232
|
}
|
|
203
233
|
|
|
204
234
|
uploadChannelFile(
|
|
205
235
|
request?: UploadChannelFileRequest,
|
|
206
|
-
|
|
207
236
|
requestOptions?: StreamRequestOptions,
|
|
208
237
|
): Promise<StreamResponse<UploadChannelFileResponse>> {
|
|
209
238
|
if (!this.id) {
|
|
@@ -213,14 +242,48 @@ export class ChannelApi {
|
|
|
213
242
|
}
|
|
214
243
|
|
|
215
244
|
return this.chatApi.uploadChannelFile(
|
|
216
|
-
{ id: this.id, type: this.type
|
|
245
|
+
{ id: this.id, type: this.type },
|
|
246
|
+
request,
|
|
247
|
+
requestOptions,
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
fork(
|
|
252
|
+
request: ForkChannelRequest,
|
|
253
|
+
requestOptions?: StreamRequestOptions,
|
|
254
|
+
): Promise<StreamResponse<ForkChannelResponse>> {
|
|
255
|
+
if (!this.id) {
|
|
256
|
+
throw new Error(
|
|
257
|
+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return this.chatApi.forkChannel(
|
|
262
|
+
{ id: this.id, type: this.type },
|
|
263
|
+
request,
|
|
264
|
+
requestOptions,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
forkMessageIDs(
|
|
269
|
+
request: ForkMessageIDsRequest,
|
|
270
|
+
requestOptions?: StreamRequestOptions,
|
|
271
|
+
): Promise<StreamResponse<ForkMessageIDsResponse>> {
|
|
272
|
+
if (!this.id) {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return this.chatApi.forkMessageIDs(
|
|
279
|
+
{ id: this.id, type: this.type },
|
|
280
|
+
request,
|
|
217
281
|
requestOptions,
|
|
218
282
|
);
|
|
219
283
|
}
|
|
220
284
|
|
|
221
285
|
hide(
|
|
222
286
|
request?: HideChannelRequest,
|
|
223
|
-
|
|
224
287
|
requestOptions?: StreamRequestOptions,
|
|
225
288
|
): Promise<StreamResponse<HideChannelResponse>> {
|
|
226
289
|
if (!this.id) {
|
|
@@ -230,7 +293,8 @@ export class ChannelApi {
|
|
|
230
293
|
}
|
|
231
294
|
|
|
232
295
|
return this.chatApi.hideChannel(
|
|
233
|
-
{ id: this.id, type: this.type
|
|
296
|
+
{ id: this.id, type: this.type },
|
|
297
|
+
request,
|
|
234
298
|
requestOptions,
|
|
235
299
|
);
|
|
236
300
|
}
|
|
@@ -246,14 +310,14 @@ export class ChannelApi {
|
|
|
246
310
|
}
|
|
247
311
|
|
|
248
312
|
return this.chatApi.deleteChannelImage(
|
|
249
|
-
{ id: this.id, type: this.type
|
|
313
|
+
{ id: this.id, type: this.type },
|
|
314
|
+
request,
|
|
250
315
|
requestOptions,
|
|
251
316
|
);
|
|
252
317
|
}
|
|
253
318
|
|
|
254
319
|
uploadChannelImage(
|
|
255
320
|
request?: UploadChannelRequest,
|
|
256
|
-
|
|
257
321
|
requestOptions?: StreamRequestOptions,
|
|
258
322
|
): Promise<StreamResponse<UploadChannelResponse>> {
|
|
259
323
|
if (!this.id) {
|
|
@@ -263,14 +327,14 @@ export class ChannelApi {
|
|
|
263
327
|
}
|
|
264
328
|
|
|
265
329
|
return this.chatApi.uploadChannelImage(
|
|
266
|
-
{ id: this.id, type: this.type
|
|
330
|
+
{ id: this.id, type: this.type },
|
|
331
|
+
request,
|
|
267
332
|
requestOptions,
|
|
268
333
|
);
|
|
269
334
|
}
|
|
270
335
|
|
|
271
336
|
updateMemberPartial(
|
|
272
337
|
request?: UpdateMemberPartialRequest,
|
|
273
|
-
|
|
274
338
|
requestOptions?: StreamRequestOptions,
|
|
275
339
|
): Promise<StreamResponse<UpdateMemberPartialResponse>> {
|
|
276
340
|
if (!this.id) {
|
|
@@ -280,14 +344,14 @@ export class ChannelApi {
|
|
|
280
344
|
}
|
|
281
345
|
|
|
282
346
|
return this.chatApi.updateMemberPartial(
|
|
283
|
-
{ id: this.id, type: this.type
|
|
347
|
+
{ id: this.id, type: this.type },
|
|
348
|
+
request,
|
|
284
349
|
requestOptions,
|
|
285
350
|
);
|
|
286
351
|
}
|
|
287
352
|
|
|
288
353
|
sendMessage(
|
|
289
354
|
request: SendMessageRequest,
|
|
290
|
-
|
|
291
355
|
requestOptions?: StreamRequestOptions,
|
|
292
356
|
): Promise<StreamResponse<SendMessageResponse>> {
|
|
293
357
|
if (!this.id) {
|
|
@@ -297,7 +361,8 @@ export class ChannelApi {
|
|
|
297
361
|
}
|
|
298
362
|
|
|
299
363
|
return this.chatApi.sendMessage(
|
|
300
|
-
{ id: this.id, type: this.type
|
|
364
|
+
{ id: this.id, type: this.type },
|
|
365
|
+
request,
|
|
301
366
|
requestOptions,
|
|
302
367
|
);
|
|
303
368
|
}
|
|
@@ -313,7 +378,8 @@ export class ChannelApi {
|
|
|
313
378
|
}
|
|
314
379
|
|
|
315
380
|
return this.chatApi.getManyMessages(
|
|
316
|
-
{ id: this.id, type: this.type
|
|
381
|
+
{ id: this.id, type: this.type },
|
|
382
|
+
request,
|
|
317
383
|
requestOptions,
|
|
318
384
|
);
|
|
319
385
|
}
|
|
@@ -344,7 +410,8 @@ export class ChannelApi {
|
|
|
344
410
|
}
|
|
345
411
|
|
|
346
412
|
return this.chatApi.getPinnedMessages(
|
|
347
|
-
{ id: this.id, type: this.type
|
|
413
|
+
{ id: this.id, type: this.type },
|
|
414
|
+
request,
|
|
348
415
|
requestOptions,
|
|
349
416
|
);
|
|
350
417
|
}
|
|
@@ -360,14 +427,14 @@ export class ChannelApi {
|
|
|
360
427
|
}
|
|
361
428
|
|
|
362
429
|
return this.chatApi.getOrCreateChannel(
|
|
363
|
-
{ id: this.id, type: this.type
|
|
430
|
+
{ id: this.id, type: this.type },
|
|
431
|
+
request,
|
|
364
432
|
requestOptions,
|
|
365
433
|
);
|
|
366
434
|
}
|
|
367
435
|
|
|
368
436
|
markRead(
|
|
369
437
|
request?: MarkReadRequest,
|
|
370
|
-
|
|
371
438
|
requestOptions?: StreamRequestOptions,
|
|
372
439
|
): Promise<StreamResponse<MarkReadResponse>> {
|
|
373
440
|
if (!this.id) {
|
|
@@ -377,14 +444,31 @@ export class ChannelApi {
|
|
|
377
444
|
}
|
|
378
445
|
|
|
379
446
|
return this.chatApi.markRead(
|
|
380
|
-
{ id: this.id, type: this.type
|
|
447
|
+
{ id: this.id, type: this.type },
|
|
448
|
+
request,
|
|
449
|
+
requestOptions,
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
rewind(
|
|
454
|
+
request: RewindChannelRequest,
|
|
455
|
+
requestOptions?: StreamRequestOptions,
|
|
456
|
+
): Promise<StreamResponse<RewindChannelResponse>> {
|
|
457
|
+
if (!this.id) {
|
|
458
|
+
throw new Error(
|
|
459
|
+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return this.chatApi.rewindChannel(
|
|
464
|
+
{ id: this.id, type: this.type },
|
|
465
|
+
request,
|
|
381
466
|
requestOptions,
|
|
382
467
|
);
|
|
383
468
|
}
|
|
384
469
|
|
|
385
470
|
show(
|
|
386
471
|
request?: ShowChannelRequest,
|
|
387
|
-
|
|
388
472
|
requestOptions?: StreamRequestOptions,
|
|
389
473
|
): Promise<StreamResponse<ShowChannelResponse>> {
|
|
390
474
|
if (!this.id) {
|
|
@@ -394,7 +478,8 @@ export class ChannelApi {
|
|
|
394
478
|
}
|
|
395
479
|
|
|
396
480
|
return this.chatApi.showChannel(
|
|
397
|
-
{ id: this.id, type: this.type
|
|
481
|
+
{ id: this.id, type: this.type },
|
|
482
|
+
request,
|
|
398
483
|
requestOptions,
|
|
399
484
|
);
|
|
400
485
|
}
|
|
@@ -410,14 +495,14 @@ export class ChannelApi {
|
|
|
410
495
|
}
|
|
411
496
|
|
|
412
497
|
return this.chatApi.stopWatchingChannel(
|
|
413
|
-
{ id: this.id, type: this.type
|
|
498
|
+
{ id: this.id, type: this.type },
|
|
499
|
+
request,
|
|
414
500
|
requestOptions,
|
|
415
501
|
);
|
|
416
502
|
}
|
|
417
503
|
|
|
418
504
|
truncate(
|
|
419
505
|
request?: TruncateChannelRequest,
|
|
420
|
-
|
|
421
506
|
requestOptions?: StreamRequestOptions,
|
|
422
507
|
): Promise<StreamResponse<TruncateChannelResponse>> {
|
|
423
508
|
if (!this.id) {
|
|
@@ -427,14 +512,14 @@ export class ChannelApi {
|
|
|
427
512
|
}
|
|
428
513
|
|
|
429
514
|
return this.chatApi.truncateChannel(
|
|
430
|
-
{ id: this.id, type: this.type
|
|
515
|
+
{ id: this.id, type: this.type },
|
|
516
|
+
request,
|
|
431
517
|
requestOptions,
|
|
432
518
|
);
|
|
433
519
|
}
|
|
434
520
|
|
|
435
521
|
markUnread(
|
|
436
522
|
request?: MarkUnreadRequest,
|
|
437
|
-
|
|
438
523
|
requestOptions?: StreamRequestOptions,
|
|
439
524
|
): Promise<StreamResponse<Response>> {
|
|
440
525
|
if (!this.id) {
|
|
@@ -444,7 +529,8 @@ export class ChannelApi {
|
|
|
444
529
|
}
|
|
445
530
|
|
|
446
531
|
return this.chatApi.markUnread(
|
|
447
|
-
{ id: this.id, type: this.type
|
|
532
|
+
{ id: this.id, type: this.type },
|
|
533
|
+
request,
|
|
448
534
|
requestOptions,
|
|
449
535
|
);
|
|
450
536
|
}
|