stream-chat 10.0.0-rc.9 → 10.0.1
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 +21653 -19788
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +21693 -19796
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +21651 -19786
- 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 +239 -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 +518 -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
package/dist/types/types.d.ts
CHANGED
|
@@ -1,76 +1,72 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StableWSConnection } from './connection';
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
3
2
|
import type { CustomEventTypes } from './custom_types';
|
|
4
|
-
import type {
|
|
5
|
-
import type { InstanceConfigTree } from './configuration/types';
|
|
6
|
-
import type { DeepPartial } from './types.utility';
|
|
7
|
-
import type { APIError, Attachment, BanRequest, ChannelConfigWithInfo, ChannelOwnCapability, ChannelStateResponseFields, CreateDeviceRequest, CreatePollRequest, DraftPayloadResponse, FlagRequest, Images, MessageResponse, OwnUserResponse, QueryChannelsRequest, QueryMembersPayload, QueryPollsRequest, QueryPollVotesRequest, QueryRemindersRequest, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, SearchPayload, SendMessageRequest, SendMessageResponse, SharedLocationResponseData, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollRequest, UserResponse, WSEvent } from './gen/models';
|
|
3
|
+
import type { APIError, Attachment, BanRequest, ChannelConfigWithInfo, ChannelMemberRequest, ChannelStateResponseFields, CreateDeviceRequest, CreatePollRequest, CustomEvent, DraftPayloadResponse, FlagRequest, Images, MessageRequest, MessageResponse, OwnUserResponse, QueryChannelsRequest, QueryMembersPayload, QueryPollsRequest, QueryPollVotesRequest, QueryReactionsRequest, QueryRemindersRequest, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, SearchPayload, SendMessageRequest, SendMessageResponse, SharedLocationResponseData, TimestampNS, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollRequest, UserResponse, WSEvent } from './gen/models';
|
|
8
4
|
import type { ChatApi } from './gen-imports';
|
|
9
|
-
/**
|
|
10
|
-
* Utility Types
|
|
11
|
-
*/
|
|
12
5
|
export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> & {
|
|
13
6
|
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
14
7
|
}[Keys];
|
|
15
8
|
export type RequireAtLeastOne<T> = {
|
|
16
9
|
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
|
|
17
10
|
}[keyof T];
|
|
18
|
-
export type Unpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends Promise<infer U> ? U : T;
|
|
19
|
-
/**
|
|
20
|
-
* Response Types
|
|
21
|
-
*/
|
|
22
11
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Only still referenced by the hand-written `/moderation/*` methods on `StreamChat` that
|
|
27
|
-
* bypass the generated client. Delete this together with those.
|
|
12
|
+
* Used only by `StreamChat.unbanUser`, a hand-written `/moderation/*` call that bypasses the
|
|
13
|
+
* generated client.
|
|
28
14
|
*/
|
|
29
15
|
export type APIResponse = {
|
|
30
16
|
duration: string;
|
|
31
17
|
};
|
|
32
18
|
export type ChannelUpdateOptions = Omit<UpdateChannelRequest, 'message'>;
|
|
19
|
+
/**
|
|
20
|
+
* A channel update that adds or removes items (members, invitees, filter tags): the items, a message
|
|
21
|
+
* notifying the channel members, and any other `update()` option.
|
|
22
|
+
*/
|
|
23
|
+
type ChannelItemsUpdate<Key extends string, Item> = Record<Key, Item[]> & {
|
|
24
|
+
/** Message object for channel members notification (optional). */
|
|
25
|
+
message?: MessageRequest;
|
|
26
|
+
} & ChannelUpdateOptions;
|
|
27
|
+
/** Request of `channel.addMembers`: user IDs, or member requests with a role or custom data. */
|
|
28
|
+
export type AddMembersRequest = ChannelItemsUpdate<'members', string | ChannelMemberRequest>;
|
|
29
|
+
/** Request of `channel.inviteMembers`. */
|
|
30
|
+
export type InviteMembersRequest = ChannelItemsUpdate<'members', string | Required<Omit<ChannelMemberRequest, 'channel_role'>>>;
|
|
31
|
+
/** Request of `channel.removeMembers`: the user IDs to remove. */
|
|
32
|
+
export type RemoveMembersRequest = ChannelItemsUpdate<'members', string>;
|
|
33
|
+
/** Request of `channel.addFilterTags` and `channel.removeFilterTags`. */
|
|
34
|
+
export type FilterTagsRequest = ChannelItemsUpdate<'tags', string>;
|
|
33
35
|
export type ConnectAPIResponse = Promise<void | ConnectionOpen>;
|
|
34
36
|
export type LocalMessage = MessageResponse & {
|
|
35
37
|
status: string;
|
|
36
38
|
error?: StreamAPIError;
|
|
37
39
|
user_id?: string;
|
|
38
40
|
};
|
|
39
|
-
export type GetThreadOptions =
|
|
41
|
+
export type GetThreadOptions = NonNullable<Parameters<ChatApi['getThread']>[1]>;
|
|
42
|
+
/** Options of `client.pinMessage`. */
|
|
43
|
+
export type PinMessageOptions = {
|
|
44
|
+
/** When the pin expires; `null` or leaving it out pins without expiry. */
|
|
45
|
+
pin_expires?: Date | string | null;
|
|
46
|
+
/** The pin time, which orders the pinned messages. Defaults to now. */
|
|
47
|
+
pinned_at?: Date | string;
|
|
48
|
+
};
|
|
40
49
|
/**
|
|
41
|
-
* The fields
|
|
42
|
-
* `
|
|
43
|
-
*
|
|
44
|
-
* Derived, never hand-listed: `client._handleUserEvent` uses this set (through
|
|
45
|
-
* `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event, so a field
|
|
46
|
-
* missing from it is silently deleted off `client.user`. Deriving it means a spec change
|
|
47
|
-
* cannot desynchronise the two.
|
|
50
|
+
* The fields of `OwnUserResponse` that a plain `UserResponse` lacks. `client._handleUserEvent` uses
|
|
51
|
+
* it (through `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event.
|
|
48
52
|
*/
|
|
49
53
|
export type OwnUserBase = Pick<OwnUserResponse, Exclude<keyof OwnUserResponse, keyof UserResponse>>;
|
|
50
54
|
export type BanUserOptions = Omit<BanRequest, 'target_user_id'>;
|
|
51
55
|
/**
|
|
52
56
|
* Everything `queryChannels()` accepts apart from the filter and the sort.
|
|
53
57
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* if the predefined filter has its own stored sort template that template wins and the request
|
|
59
|
-
* `sort` is ignored; if it does not, the request `sort` is used. `sort_values` interpolates the
|
|
60
|
-
* stored sort template's placeholders. All three are only read when `predefined_filter` is set.
|
|
58
|
+
* `predefined_filter` names a backend filter template, interpolated with `filter_values`. If that
|
|
59
|
+
* template has its own stored sort, it wins over the request `sort` and `sort_values` fills its
|
|
60
|
+
* placeholders; otherwise the request `sort` is used. `filter_values` and `sort_values` are sent
|
|
61
|
+
* only when `predefined_filter` is set.
|
|
61
62
|
*/
|
|
62
63
|
export type ChannelOptions = Omit<QueryChannelsRequest, 'filter_conditions' | 'sort'>;
|
|
63
64
|
export type ChannelStateOptions = {
|
|
64
65
|
offlineMode?: boolean;
|
|
65
|
-
skipInitialization?: string[];
|
|
66
66
|
skipHydration?: boolean;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* This is a compatibility bridge for internal callers that need response level
|
|
71
|
-
* metadata such as `predefined_filter`. The default `queryChannels()` return value
|
|
72
|
-
* remains `Channel[]` to avoid a breaking change. This should be folded into a
|
|
73
|
-
* single full response API in the next major release.
|
|
68
|
+
* Makes `queryChannelsAndHydrate()` return the full query response (with hydrated `channels`,
|
|
69
|
+
* plus metadata such as `predefined_filter`) instead of `Channel[]`.
|
|
74
70
|
*/
|
|
75
71
|
withResponse?: boolean;
|
|
76
72
|
};
|
|
@@ -78,76 +74,8 @@ export type ChannelStateOptions = {
|
|
|
78
74
|
export type Automod = ChannelConfigWithInfo['automod'];
|
|
79
75
|
/** What automod does when it trips, as reported by `channel.getConfig()`. */
|
|
80
76
|
export type AutomodBehavior = ChannelConfigWithInfo['automod_behavior'];
|
|
81
|
-
export type PinnedMessagePaginationOptions = Omit<Parameters<ChatApi['getPinnedMessages']>[
|
|
77
|
+
export type PinnedMessagePaginationOptions = Omit<NonNullable<Parameters<ChatApi['getPinnedMessages']>[1]>, 'sort'>;
|
|
82
78
|
export type QueryMembersOptions = Partial<Omit<QueryMembersPayload, 'filter_conditions'>>;
|
|
83
|
-
export type StreamChatOptions = {
|
|
84
|
-
/**
|
|
85
|
-
* Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
|
|
86
|
-
*/
|
|
87
|
-
allowServerSideConnect?: boolean;
|
|
88
|
-
axiosRequestConfig?: AxiosRequestConfig;
|
|
89
|
-
/**
|
|
90
|
-
* Base url to use for API
|
|
91
|
-
* such as https://chat-proxy-dublin.stream-io-api.com
|
|
92
|
-
*/
|
|
93
|
-
baseURL?: string;
|
|
94
|
-
browser?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Disables the hydration of all caches within the JS Client. This includes this.activeChannels,
|
|
97
|
-
* this.polls.pollCache and this.config.
|
|
98
|
-
* It is mainly meant to be used for integrations where stream-chat is used as a server-side service
|
|
99
|
-
* interacting with Stream's REST API, not depending on any state and purely serving as a wrapper
|
|
100
|
-
* around HTTP requests. Using this property on either the client side or a backend implementation
|
|
101
|
-
* that also relies on WS events will break these functionalities, so please use carefully.
|
|
102
|
-
*/
|
|
103
|
-
disableCache?: boolean;
|
|
104
|
-
enableInsights?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* When true, maintains a client-local unread count on channels that have read events disabled
|
|
107
|
-
* (e.g. livestreams). The count increments on incoming messages and is reset via
|
|
108
|
-
* `channel.markReadLocally()`. It is never sent to the backend, but is persisted to the offline DB.
|
|
109
|
-
*/
|
|
110
|
-
isLocalUnreadCountEnabled?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Custom notification manager service to use for the client.
|
|
113
|
-
* If not provided, a default notification manager will be created.
|
|
114
|
-
* Notifications are used to communicate events like errors, warnings, info, etc. Other services can publish notifications or subscribe to the NotificationManager state changes.
|
|
115
|
-
*/
|
|
116
|
-
notifications?: NotificationManager;
|
|
117
|
-
/**
|
|
118
|
-
* Declarative configuration for instances the SDK creates on your behalf, seeded before the client's
|
|
119
|
-
* own managers are constructed.
|
|
120
|
-
*
|
|
121
|
-
* Equivalent to calling `client.config.set(tree)` immediately after construction, except for the
|
|
122
|
-
* `client` subtree — the configuration registry is created inside the constructor, so this is the only
|
|
123
|
-
* way to configure `reminders` / `notifications` before they are built.
|
|
124
|
-
*/
|
|
125
|
-
config?: DeepPartial<InstanceConfigTree>;
|
|
126
|
-
/**
|
|
127
|
-
* When true, user will be persisted on client. Otherwise if `connectUser` call fails, then you need to
|
|
128
|
-
* call `connectUser` again to retry.
|
|
129
|
-
* This is mainly useful for chat application working in offline mode, where you will need client.user to
|
|
130
|
-
* persist even if connectUser call fails.
|
|
131
|
-
*/
|
|
132
|
-
persistUserOnConnectionFailure?: boolean;
|
|
133
|
-
warmUp?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Sets the instance of `StableWSConnection` on the chat client. Intended purely for testing and
|
|
136
|
-
* should not be used in production apps.
|
|
137
|
-
*/
|
|
138
|
-
wsConnection?: StableWSConnection;
|
|
139
|
-
/**
|
|
140
|
-
* Overrides the `WebSocket` constructor used by `StableWSConnection`. Intended purely for
|
|
141
|
-
* testing so a mock/drivable WebSocket can be swapped in; production code should leave this
|
|
142
|
-
* unset and rely on the platform's global `WebSocket`.
|
|
143
|
-
*/
|
|
144
|
-
WebSocketImpl?: typeof WebSocket;
|
|
145
|
-
/**
|
|
146
|
-
* Sets a suffix to the wsUrl when it is being built in `wsConnection`. Is meant to be
|
|
147
|
-
* used purely in testing suites and should not be used in production apps.
|
|
148
|
-
*/
|
|
149
|
-
wsUrlParams?: URLSearchParams;
|
|
150
|
-
};
|
|
151
79
|
export type UnBanUserOptions = {
|
|
152
80
|
client_id?: string;
|
|
153
81
|
connection_id?: string;
|
|
@@ -159,6 +87,12 @@ export type UnBanUserOptions = {
|
|
|
159
87
|
};
|
|
160
88
|
/** Everything `queryUsers()` accepts apart from the filter and the sort. */
|
|
161
89
|
export type UserOptions = Omit<QueryUsersPayload, 'filter_conditions' | 'sort'>;
|
|
90
|
+
/**
|
|
91
|
+
* Which connection a status refers to: `'network'` is the device's network (reported by the
|
|
92
|
+
* platform reporter installed on `client.networkConnection`), `'ws'` is this client's WebSocket.
|
|
93
|
+
* They can disagree, so each has its own store.
|
|
94
|
+
*/
|
|
95
|
+
export type ConnectionType = 'network' | 'ws';
|
|
162
96
|
type LocalEvent = (({
|
|
163
97
|
type: 'live_location_sharing.started';
|
|
164
98
|
} & {
|
|
@@ -174,116 +108,83 @@ type LocalEvent = (({
|
|
|
174
108
|
channels: ChannelStateResponseFields[];
|
|
175
109
|
isLatestMessageSet: boolean;
|
|
176
110
|
};
|
|
177
|
-
}) | ({
|
|
178
|
-
type: 'connection.changed';
|
|
179
|
-
} & {
|
|
180
|
-
online: boolean;
|
|
181
111
|
}) | {
|
|
182
112
|
type: 'connection.recovered';
|
|
183
113
|
} | ({
|
|
184
|
-
type: '
|
|
114
|
+
type: 'connection.fallback_activated';
|
|
185
115
|
} & {
|
|
186
|
-
|
|
116
|
+
mode: string;
|
|
187
117
|
}) | ({
|
|
188
|
-
type: '
|
|
118
|
+
type: 'offline_reactions.queried';
|
|
189
119
|
} & {
|
|
190
|
-
|
|
191
|
-
own_capabilities: ChannelOwnCapability[];
|
|
120
|
+
offlineReactions: ReactionResponse[];
|
|
192
121
|
}) | ({
|
|
193
122
|
type: 'message.read_locally';
|
|
194
123
|
} & {
|
|
195
124
|
channel_type: string;
|
|
196
125
|
cid: string;
|
|
197
|
-
created_at:
|
|
126
|
+
created_at: TimestampNS;
|
|
198
127
|
channel_id?: string;
|
|
199
128
|
last_read_message_id?: string;
|
|
200
129
|
team?: string;
|
|
201
130
|
user?: UserResponse;
|
|
202
131
|
})) & {
|
|
203
|
-
received_at?:
|
|
132
|
+
received_at?: TimestampNS;
|
|
204
133
|
};
|
|
134
|
+
export type Event = (Exclude<WSEvent, {
|
|
135
|
+
type: '*';
|
|
136
|
+
}> & {
|
|
137
|
+
received_at?: TimestampNS;
|
|
138
|
+
}) | LocalEvent | CustomEventTypeUnion;
|
|
139
|
+
type CustomEventTypeUnion = {
|
|
140
|
+
[K in keyof CustomEventTypes]: {
|
|
141
|
+
type: K;
|
|
142
|
+
} & Omit<CustomEvent, 'type'> & {
|
|
143
|
+
received_at?: TimestampNS;
|
|
144
|
+
};
|
|
145
|
+
}[keyof CustomEventTypes];
|
|
146
|
+
export type EventType = Event['type'] | 'all';
|
|
205
147
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* Hand-written because the event is not published in the OpenAPI spec, so it cannot
|
|
210
|
-
* come from `src/gen`. Remove this — along with the `decodeConnectionEvent` shim in
|
|
211
|
-
* `connection.ts` — once the backend adds it to the spec and `src/gen` is regenerated.
|
|
148
|
+
* A listener for events of type `T`. `'all'` (the default) receives every event, any other type the
|
|
149
|
+
* event members declaring it. Custom event types have to be declared by augmenting
|
|
150
|
+
* `CustomEventTypes`; an undeclared name is not an `EventType`.
|
|
212
151
|
*/
|
|
213
|
-
export type
|
|
214
|
-
type: 'connection.ok';
|
|
215
|
-
connection_id: string;
|
|
216
|
-
/** Unix nanoseconds, as every other wire event carries it. */
|
|
217
|
-
created_at: number;
|
|
218
|
-
me: OwnUserResponse;
|
|
219
|
-
/** Unix nanoseconds, as every other wire event carries it. */
|
|
220
|
-
received_at?: number;
|
|
221
|
-
};
|
|
222
|
-
export type Event = WSEvent | ConnectedEvent | LocalEvent | keyof CustomEventTypes;
|
|
223
|
-
export type EventType = Event['type'] | 'all';
|
|
224
|
-
export type EventHandler<T = string> = (event: Extract<Event, {
|
|
152
|
+
export type EventHandler<T extends EventType = 'all'> = (event: T extends 'all' ? Event : Extract<Event, {
|
|
225
153
|
type: T;
|
|
226
154
|
}>) => void;
|
|
227
|
-
|
|
228
|
-
* Filter Types
|
|
229
|
-
*/
|
|
230
|
-
export type ReactionFilters = NonNullable<QueryReactionsRequestWithId['filter']>;
|
|
231
|
-
export type QueryReactionsRequestWithId = Parameters<ChatApi['queryReactions']>[0];
|
|
155
|
+
export type ReactionFilters = NonNullable<QueryReactionsRequest['filter']>;
|
|
232
156
|
export type ChannelFilters = NonNullable<QueryChannelsRequest['filter_conditions']>;
|
|
233
157
|
export type QueryPollsOptions = Omit<QueryPollsRequest, 'filter' | 'sort'>;
|
|
234
158
|
export type QueryVotesOptions = Omit<QueryPollVotesRequest, 'filter' | 'sort'>;
|
|
235
159
|
export type QueryPollsFilters = NonNullable<QueryPollsRequest['filter']>;
|
|
236
160
|
export type QueryVotesFilters = NonNullable<QueryPollVotesRequest['filter']>;
|
|
237
161
|
export type MessageFilters = NonNullable<SearchPayload['message_filter_conditions']>;
|
|
238
|
-
export type PrimitiveFilter<ObjectType> = ObjectType | null;
|
|
239
|
-
export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends string | number | boolean | Date ? {
|
|
240
|
-
$eq?: PrimitiveFilter<ObjectType>;
|
|
241
|
-
$exists?: boolean;
|
|
242
|
-
$gt?: PrimitiveFilter<ObjectType>;
|
|
243
|
-
$gte?: PrimitiveFilter<ObjectType>;
|
|
244
|
-
$in?: PrimitiveFilter<ObjectType>[];
|
|
245
|
-
$lt?: PrimitiveFilter<ObjectType>;
|
|
246
|
-
$lte?: PrimitiveFilter<ObjectType>;
|
|
247
|
-
} : {
|
|
248
|
-
$eq?: PrimitiveFilter<ObjectType>;
|
|
249
|
-
$exists?: boolean;
|
|
250
|
-
$in?: PrimitiveFilter<Unpacked<ObjectType>>[];
|
|
251
|
-
};
|
|
252
162
|
export type UserFilters = QueryUsersPayload['filter_conditions'];
|
|
253
163
|
export type MemberFilters = QueryMembersPayload['filter_conditions'];
|
|
254
164
|
export type OGAttachment = RequireLiteral<Attachment, 'og_scrape_url'>;
|
|
255
165
|
export type PushProvider = CreateDeviceRequest['push_provider'];
|
|
256
166
|
/**
|
|
257
|
-
* Server-provided channel configuration, keyed by
|
|
258
|
-
*
|
|
259
|
-
*
|
|
167
|
+
* Server-provided channel configuration, keyed by cid (`messaging:general`). Keyed per channel
|
|
168
|
+
* because a channel's `config_overrides` can narrow its type's config. Read it via
|
|
169
|
+
* `channel.serverConfig`.
|
|
260
170
|
*/
|
|
261
171
|
export type Configs = Record<string, ChannelConfigWithInfo | undefined>;
|
|
262
172
|
export type ConnectionOpen = EventPayload<'health.check'> | EventPayload<'connection.ok'>;
|
|
263
173
|
/**
|
|
264
|
-
* The message `type` values the server can return.
|
|
265
|
-
*
|
|
266
|
-
* Hand-written because there is no generated equivalent: `MessageResponse['type']` is a bare
|
|
267
|
-
* `string`, so deriving it would widen rather than narrow. Both the React and React Native
|
|
268
|
-
* SDKs use this as a discriminant (RN types its SQLite message rows with it).
|
|
174
|
+
* The message `type` values the server can return (`MessageResponse['type']` is a bare `string`).
|
|
269
175
|
*/
|
|
270
176
|
export type MessageLabel = 'deleted' | 'ephemeral' | 'error' | 'regular' | 'reply' | 'system';
|
|
271
177
|
export type SendMessageOptions = Omit<SendMessageRequest, 'message'>;
|
|
272
178
|
export type TokenOrProvider = null | string | TokenProvider | undefined;
|
|
273
179
|
export type TokenProvider = () => Promise<string>;
|
|
274
|
-
export type MessageSetType = 'latest' | 'current' | 'new';
|
|
275
180
|
export declare class StreamAPIError<T = APIError> extends Error {
|
|
276
181
|
code: number | undefined;
|
|
277
182
|
status: number | undefined;
|
|
278
183
|
response: AxiosResponse<T> | undefined;
|
|
279
184
|
constructor(message: string, { code, status, response, }: {
|
|
280
|
-
/**
|
|
281
|
-
* Stream error code (`APIError.code`)
|
|
282
|
-
*/
|
|
185
|
+
/** Stream error code (`APIError.code`) */
|
|
283
186
|
code: StreamAPIError<T>['code'];
|
|
284
|
-
/**
|
|
285
|
-
* HTTP status code
|
|
286
|
-
*/
|
|
187
|
+
/** HTTP status code */
|
|
287
188
|
status: StreamAPIError<T>['status'];
|
|
288
189
|
response: StreamAPIError<T>['response'];
|
|
289
190
|
});
|
|
@@ -297,18 +198,12 @@ export declare class StreamAPIError<T = APIError> extends Error {
|
|
|
297
198
|
readonly status: number | undefined;
|
|
298
199
|
};
|
|
299
200
|
}
|
|
300
|
-
/**
|
|
301
|
-
* Poll vote visibility. Derived from the generated request shape so it tracks the spec.
|
|
302
|
-
*/
|
|
303
201
|
export type VotingVisibility = NonNullable<CreatePollRequest['voting_visibility']>;
|
|
304
202
|
export type PartialPollUpdate = {
|
|
305
203
|
set?: Partial<UpdatePollRequest>;
|
|
306
204
|
unset?: Array<keyof UpdatePollRequest>;
|
|
307
205
|
};
|
|
308
|
-
/**
|
|
309
|
-
* Options accepted by `moderation.flagUser` / `moderation.flagMessage` on top of the
|
|
310
|
-
* entity they resolve and the `reason` they take positionally.
|
|
311
|
-
*/
|
|
206
|
+
/** Options of `moderation.flagUser` / `moderation.flagMessage` besides the entity and `reason`. */
|
|
312
207
|
export type ModerationFlagOptions = Omit<FlagRequest, 'entity_id' | 'entity_type' | 'reason'>;
|
|
313
208
|
export type AIState = 'AI_STATE_IDLE' | 'AI_STATE_ERROR' | 'AI_STATE_EXTERNAL_SOURCES' | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | 'AI_STATE_STOP' | (string & {});
|
|
314
209
|
export declare const AIStates: {
|
|
@@ -319,27 +214,18 @@ export declare const AIStates: {
|
|
|
319
214
|
readonly Stop: "AI_STATE_STOP";
|
|
320
215
|
readonly Thinking: "AI_STATE_THINKING";
|
|
321
216
|
};
|
|
322
|
-
/**
|
|
323
|
-
* An identifier containing information about the downstream SDK using stream-chat. It
|
|
324
|
-
* is used to resolve the user agent.
|
|
325
|
-
*/
|
|
217
|
+
/** The downstream SDK using stream-chat, used to resolve the user agent. */
|
|
326
218
|
export type SdkIdentifier = {
|
|
327
219
|
name: 'react' | 'react-native' | 'expo' | 'angular';
|
|
328
220
|
version: string;
|
|
329
221
|
};
|
|
330
|
-
/**
|
|
331
|
-
* An identifier containing information about the downstream device using stream-chat, if
|
|
332
|
-
* available. Is used by the react-native SDKs to enrich the user agent further.
|
|
333
|
-
*/
|
|
222
|
+
/** The downstream device, used by the React Native SDKs to enrich the user agent. */
|
|
334
223
|
export type DeviceIdentifier = {
|
|
335
224
|
os: string;
|
|
336
225
|
model?: string;
|
|
337
226
|
};
|
|
338
227
|
/**
|
|
339
|
-
*
|
|
340
|
-
* stream-chat, if available. `name` is reported as `app` and `version` as `app_version`
|
|
341
|
-
* in the user agent. Distinct from the SDK ({@link SdkIdentifier}) and device
|
|
342
|
-
* ({@link DeviceIdentifier}) identifiers.
|
|
228
|
+
* The downstream app: `name` is reported as `app` and `version` as `app_version` in the user agent.
|
|
343
229
|
*/
|
|
344
230
|
export type AppIdentifier = {
|
|
345
231
|
name: string;
|
|
@@ -348,7 +234,6 @@ export type AppIdentifier = {
|
|
|
348
234
|
export type DraftMessage = DraftPayloadResponse & Partial<Pick<MessageResponse, 'shared_location' | 'mentioned_channel' | 'mentioned_group_ids' | 'mentioned_groups' | 'mentioned_here' | 'mentioned_roles'>>;
|
|
349
235
|
export type SharedLiveLocationResponse = RequireLiteral<SharedLocationResponseData, 'end_at'>;
|
|
350
236
|
export type ThreadFilters = NonNullable<QueryThreadsRequest['filter']>;
|
|
351
|
-
export type CreateReminderOptions = Parameters<ChatApi['createReminder']>[0];
|
|
352
237
|
export type ReminderFilters = NonNullable<QueryRemindersRequest['filter']>;
|
|
353
238
|
export type ListUserGroupsOptions = NonNullable<Parameters<ChatApi['listUserGroups']>[0]>;
|
|
354
239
|
export type SearchUserGroupsOptions = Parameters<ChatApi['searchUserGroups']>[0];
|
|
@@ -375,14 +260,10 @@ export type PartializeAllBut<T, K extends keyof T> = {
|
|
|
375
260
|
} & {
|
|
376
261
|
[P in Exclude<keyof T, K>]?: T[P];
|
|
377
262
|
};
|
|
378
|
-
export type DeleteMessageOptions =
|
|
263
|
+
export type DeleteMessageOptions = NonNullable<Parameters<ChatApi['deleteMessage']>[1]>;
|
|
379
264
|
export type SendMessageAPIResponse = StreamResponse<SendMessageResponse>;
|
|
380
265
|
export type UpdateMessageOptions = Omit<UpdateMessageRequest, 'message'>;
|
|
381
266
|
export type UpdateMessageAPIResponse = StreamResponse<UpdateMessageResponse>;
|
|
382
|
-
/**
|
|
383
|
-
* The Giphy rendition names, derived from the generated `Images` shape so the two cannot
|
|
384
|
-
* drift. Consumed by the React and React Native SDKs to pick a rendition size.
|
|
385
|
-
*/
|
|
386
267
|
export type GiphyVersions = keyof Images;
|
|
387
268
|
export type TranslationLanguage = TranslateMessageRequest['language'];
|
|
388
269
|
export type FileReferenceBase = {
|
|
@@ -392,8 +273,7 @@ export type FileReferenceBase = {
|
|
|
392
273
|
};
|
|
393
274
|
export type FileUploadInput = File | Blob | FileReferenceBase | string;
|
|
394
275
|
/**
|
|
395
|
-
* Structural subset of axios' `AxiosProgressEvent`,
|
|
396
|
-
* public surface does not depend on axios.
|
|
276
|
+
* Structural subset of axios' `AxiosProgressEvent`, so the public surface does not depend on axios.
|
|
397
277
|
*/
|
|
398
278
|
export type StreamProgressEvent = {
|
|
399
279
|
loaded: number;
|
|
@@ -405,5 +285,7 @@ export type StreamRequestOptions = {
|
|
|
405
285
|
signal?: AbortSignal;
|
|
406
286
|
/** Only meaningful for upload (multipart) requests; ignored everywhere else. */
|
|
407
287
|
onUploadProgress?: (event: StreamProgressEvent) => void;
|
|
288
|
+
/** Milliseconds before this request is aborted. */
|
|
289
|
+
timeout?: number;
|
|
408
290
|
};
|
|
409
291
|
export * from './gen/models';
|
|
@@ -2,9 +2,9 @@ export type DeepPartial<T> = {
|
|
|
2
2
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
|
-
* The keys of every union member, not only those common to all
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The keys of every union member, not only those common to all (`keyof (A | B)`). Distribution
|
|
6
|
+
* needs the naked type parameter: the same conditional inline over a concrete union yields the
|
|
7
|
+
* common keys.
|
|
8
8
|
*/
|
|
9
9
|
export type KeysOfUnion<T> = T extends unknown ? keyof T : never;
|
|
10
10
|
/** The type `Key` has in each union member declaring it; members without it drop out as `never`. */
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import type { FileReferenceBase, FileUploadInput } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Wraps a bare URI string in a {@link FileReferenceBase}; `File`, `Blob` and picker objects pass
|
|
4
|
+
* through.
|
|
5
5
|
*/
|
|
6
6
|
export declare const normalizeUploadFile: (file?: FileUploadInput) => Blob | FileReferenceBase | {
|
|
7
7
|
uri: string;
|
|
8
8
|
} | undefined;
|
|
9
9
|
/**
|
|
10
|
-
* Appends one request-body entry to a multipart form
|
|
11
|
-
*
|
|
12
|
-
* Callers must pass **raw** values - objects and arrays are JSON-encoded here (that is what
|
|
13
|
-
* the API expects for `user` and `upload_sizes`), so pre-stringifying them double-encodes.
|
|
10
|
+
* Appends one request-body entry to a multipart form. Pass **raw** values: objects and arrays are
|
|
11
|
+
* JSON-encoded here, so pre-stringifying them double-encodes.
|
|
14
12
|
*/
|
|
15
13
|
export declare function appendToFormData(data: FormData, key: string, value: unknown): void;
|
|
16
|
-
/**
|
|
17
|
-
* Encodes a request body as `multipart/form-data`. Used by `ApiClient.sendRequest` for every
|
|
18
|
-
* generated operation declaring that content type.
|
|
19
|
-
*/
|
|
14
|
+
/** Encodes a request body as `multipart/form-data`. */
|
|
20
15
|
export declare function toFormData(body: Record<string, unknown>): FormData;
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import type { StreamChat } from './client';
|
|
2
|
-
import { StateStore } from '
|
|
3
|
-
import type { AttachmentManager } from '.';
|
|
2
|
+
import { StateStore } from '@stream-io/state-store';
|
|
3
|
+
import type { AttachmentManager, LocalAttachmentUploadMetadata } from '.';
|
|
4
|
+
/**
|
|
5
|
+
* Whether an upload was aborted (attachment removed, client disconnected) rather than failed: an
|
|
6
|
+
* axios `CanceledError`, or an `AbortError` from a custom `doUploadRequest`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isUploadCancellation: (error: unknown) => boolean;
|
|
4
9
|
export type UploadRecord = {
|
|
10
|
+
/** The attachment's local ID (`localMetadata.id`); also the key this record is held under. */
|
|
5
11
|
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* `true` once every byte has been handed to the transport but the server has not responded yet.
|
|
14
|
+
* Progress reaches 100% when the request body is flushed, before the server confirms, so a
|
|
15
|
+
* determinate progress bar should turn indeterminate here. Confirmation is the record being
|
|
16
|
+
* removed. Stays `false` without `AttachmentManagerConfig.trackUploadProgress`.
|
|
17
|
+
*/
|
|
18
|
+
uploadConfirmationPending?: boolean;
|
|
6
19
|
uploadProgress?: number;
|
|
7
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Whether every byte is sent but the server has not answered. Reads
|
|
23
|
+
* {@link UploadRecord.uploadConfirmationPending} when present, else infers it from progress
|
|
24
|
+
* reaching 100. Takes `localMetadata`, as carried by a message payload.
|
|
25
|
+
*/
|
|
26
|
+
export declare const isUploadConfirmationPending: (localMetadata?: Pick<LocalAttachmentUploadMetadata, "uploadConfirmationPending" | "uploadProgress" | "uploadState">) => boolean;
|
|
8
27
|
export type UploadManagerState = {
|
|
28
|
+
/**
|
|
29
|
+
* In-flight uploads keyed by the attachment's local ID (`localMetadata.id`), which makes
|
|
30
|
+
* {@link UploadManager.upload} idempotent. A record lives only for the request (removed on
|
|
31
|
+
* success and failure alike), so for "did it upload" read `localMetadata.uploadState`.
|
|
32
|
+
*/
|
|
9
33
|
uploads: Record<string, UploadRecord>;
|
|
10
34
|
};
|
|
11
35
|
/**
|
|
@@ -20,20 +44,16 @@ export declare class UploadManager {
|
|
|
20
44
|
get uploads(): Record<string, UploadRecord>;
|
|
21
45
|
getUpload: (id: string) => UploadRecord;
|
|
22
46
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* Aborts every in-flight upload request via its `UploadRequestOptions.abortSignal`.
|
|
47
|
+
* Aborts every in-flight upload (`UploadRequestOptions.abortSignal`) and clears all records, so a
|
|
48
|
+
* later session does not inherit them. Invoked on disconnect.
|
|
26
49
|
*/
|
|
27
50
|
reset: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Removes the upload record for `id` if present.
|
|
30
|
-
* If an upload is still in progress, aborts its `UploadRequestOptions.abortSignal`.
|
|
31
|
-
*/
|
|
51
|
+
/** Removes the record for `id` and aborts its upload if still in progress. */
|
|
32
52
|
deleteUploadRecord: (id: string) => void;
|
|
33
53
|
/**
|
|
34
54
|
* Starts an upload for `id`, or returns the existing in-flight promise if one is already running.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
55
|
+
* Uploads through the `attachmentManager.doUploadRequest` of the channel `channelCid`, and
|
|
56
|
+
* rejects if that rejects (the record is removed from state either way).
|
|
37
57
|
*/
|
|
38
58
|
upload: ({ id, channelCid, file, }: {
|
|
39
59
|
id: string;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @template K - The type of the keys.
|
|
6
|
-
* @template T - The type of the values.
|
|
2
|
+
* Least-recently-used cache holding at most `size` values. `add` and `get` mark a key as most
|
|
3
|
+
* recently used. Adding to a full cache evicts the least recently used entry, calling `dispose`.
|
|
7
4
|
*/
|
|
8
5
|
export declare class FixedSizeQueueCache<K, T> {
|
|
9
6
|
private keys;
|
|
@@ -14,28 +11,28 @@ export declare class FixedSizeQueueCache<K, T> {
|
|
|
14
11
|
dispose: (key: K, value: T) => void;
|
|
15
12
|
});
|
|
16
13
|
/**
|
|
17
|
-
*
|
|
14
|
+
* Inserts or updates an entry as the most recently used one.
|
|
18
15
|
*
|
|
19
16
|
* @param key - The cache key.
|
|
20
17
|
* @param value - The value to associate with `key`.
|
|
21
18
|
*/
|
|
22
19
|
add(key: K, value: T): void;
|
|
23
20
|
/**
|
|
24
|
-
* Retrieves
|
|
21
|
+
* Retrieves a value without marking it as recently used.
|
|
25
22
|
*
|
|
26
23
|
* @param key - The cache key.
|
|
27
24
|
* @returns The value, or `undefined` when the key is not cached.
|
|
28
25
|
*/
|
|
29
26
|
peek(key: K): T | undefined;
|
|
30
27
|
/**
|
|
31
|
-
* Retrieves
|
|
28
|
+
* Retrieves a value and marks it as most recently used.
|
|
32
29
|
*
|
|
33
30
|
* @param key - The cache key.
|
|
34
31
|
* @returns The value, or `undefined` when the key is not cached.
|
|
35
32
|
*/
|
|
36
33
|
get(key: K): T | undefined;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/** Every cached value, as a new array. */
|
|
35
|
+
values(): T[];
|
|
36
|
+
/** Empties the cache, calling `dispose` for each entry. */
|
|
40
37
|
clear(): void;
|
|
41
38
|
}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
import type { Unsubscribe } from '
|
|
1
|
+
import type { Unsubscribe } from '@stream-io/state-store';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Base class for entities that own event subscriptions. `unregisterSubscriptions` is ref-counted:
|
|
4
|
+
* only the last consumer's call tears the subscriptions down.
|
|
4
5
|
*
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
8
|
export declare abstract class WithSubscriptions {
|
|
8
9
|
private unsubscribeFunctions;
|
|
9
|
-
/**
|
|
10
|
-
* Workaround for the missing TS keyword - ensures that inheritants
|
|
11
|
-
* overriding `unregisterSubscriptions` call the base method and return
|
|
12
|
-
* its unique symbol value.
|
|
13
|
-
*/
|
|
10
|
+
/** Return brand that makes overrides of `unregisterSubscriptions` return the base result. */
|
|
14
11
|
protected static symbol: symbol;
|
|
15
12
|
private refCount;
|
|
16
13
|
abstract registerSubscriptions(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Returns a boolean, provides information of whether `registerSubscriptions`
|
|
19
|
-
* method has already been called for this instance.
|
|
20
|
-
*/
|
|
14
|
+
/** Whether subscriptions are registered. Guards `registerSubscriptions` against running twice. */
|
|
21
15
|
get hasSubscriptions(): boolean;
|
|
22
16
|
protected addUnsubscribeFunction(unsubscribeFunction: Unsubscribe): void;
|
|
23
|
-
/**
|
|
24
|
-
* Increments `refCount` by one and returns new value.
|
|
25
|
-
*/
|
|
26
17
|
protected incrementRefCount(): number;
|
|
27
18
|
/**
|
|
28
|
-
*
|
|
29
|
-
* make sure to run the original too.
|
|
19
|
+
* Overrides must call `super.unregisterSubscriptions()` and return its result.
|
|
30
20
|
*
|
|
31
21
|
* @example
|
|
32
22
|
* ```ts
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rejection for a wait an `AbortSignal` ended, shaped like the one `fetch` and `axios` raise:
|
|
3
|
+
* the signal's reason when it is an `Error`, otherwise an `AbortError` carrying `message`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const abortError: (signal: AbortSignal, message: string) => Error;
|
|
6
|
+
/**
|
|
7
|
+
* Settles as `promise` does, or rejects with {@link abortError} as soon as `signal` aborts.
|
|
8
|
+
* `onAbort` runs, before the rejection, when the signal aborts before the wait has seen `promise`
|
|
9
|
+
* settle. Ending the wait does not cancel the work behind `promise`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const waitUnlessAborted: <T>({ abortMessage, onAbort, promise, signal, }: {
|
|
12
|
+
/** The message of the `AbortError` the wait rejects with when the abort reason is no `Error`. */
|
|
13
|
+
abortMessage: string;
|
|
14
|
+
onAbort?: () => void;
|
|
15
|
+
promise: Promise<T>;
|
|
16
|
+
signal: AbortSignal | undefined;
|
|
17
|
+
}) => Promise<T>;
|