stream-chat 10.0.0-rc.21 → 10.0.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.js +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
|
@@ -1,101 +1,48 @@
|
|
|
1
1
|
import type { StableWSConnection } from '../../connection';
|
|
2
2
|
|
|
3
3
|
export type WSConnectionState = {
|
|
4
|
-
/**
|
|
5
|
-
* Is this client's WebSocket up. After an `enableWSFallback` switch, whether its long-poll is up,
|
|
6
|
-
* since the long-poll writes this store from then on.
|
|
7
|
-
*
|
|
8
|
-
* Deliberately the same field name as `client.networkConnection.state`'s — both answer the same
|
|
9
|
-
* question about a different connection, which is why the two objects are named as parallels. The
|
|
10
|
-
* types differ only where they must: this one is never `undefined`, because a socket always has a
|
|
11
|
-
* state, so `!isHealthy` is safe here where the network's `isOnline` needs `=== false`.
|
|
12
|
-
*/
|
|
4
|
+
/** Whether the WebSocket, or the long-poll after an `enableWSFallback` switch, is up. */
|
|
13
5
|
isHealthy: boolean;
|
|
14
6
|
lastHealthyAt: Date | null;
|
|
15
7
|
lastUnhealthyAt: Date | null;
|
|
16
8
|
};
|
|
17
9
|
|
|
18
|
-
/**
|
|
19
|
-
* The WebSocket's settings: its timing knobs, what it is built from (`webSocketImpl`,
|
|
20
|
-
* `urlParams`, `connection`), and {@link enableWSFallback}, the switch to long-polling when it
|
|
21
|
-
* cannot connect.
|
|
22
|
-
*
|
|
23
|
-
* Declared, validated, and durable across reconnects. {@link offlineNotificationDisplayDelayMs} is
|
|
24
|
-
* the odd one out: the only field here this package does not act on itself.
|
|
25
|
-
*
|
|
26
|
-
* The network-recovery retry is deliberately **not** configurable, and stays a constant in
|
|
27
|
-
* `config.ts`: nothing could reach it, so exposing it would add surface rather than preserve it.
|
|
28
|
-
*
|
|
29
|
-
* The timings are all in **milliseconds**, and named with the unit, because a bare `pingInterval`
|
|
30
|
-
* reads equally well as seconds.
|
|
31
|
-
*/
|
|
10
|
+
/** The WebSocket's settings. Timings are in milliseconds. */
|
|
32
11
|
export type WSConnectionConfig = {
|
|
33
12
|
/**
|
|
34
|
-
* How long `connect()` waits for the server's `connection.ok`
|
|
35
|
-
* of 15s allows between two and three attempts of the underlying retry.
|
|
13
|
+
* How long `connect()` waits for the server's `connection.ok` before giving up. Defaults to 15s.
|
|
36
14
|
*/
|
|
37
15
|
connectTimeoutMs: number;
|
|
38
16
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* without the flag; lower it to switch sooner. The client dispatches
|
|
44
|
-
* `connection.fallback_activated` with `mode: 'longpoll'` when it switches, and stays on long-poll
|
|
45
|
-
* from then on.
|
|
17
|
+
* Falls back to HTTP long-polling, for networks that block WebSockets, when the WebSocket cannot
|
|
18
|
+
* connect within {@link connectTimeoutMs} (lower it to switch sooner) and the device is not known
|
|
19
|
+
* to be offline. Defaults to `false`; most integrators do not need it. The client dispatches
|
|
20
|
+
* `connection.fallback_activated` (`mode: 'longpoll'`) on the switch and stays on long-poll.
|
|
46
21
|
*/
|
|
47
22
|
enableWSFallback: boolean;
|
|
48
23
|
/**
|
|
49
|
-
* How often a health-check ping goes out while the socket is up.
|
|
50
|
-
*
|
|
51
|
-
* **Can only be lowered.** 25s is both the default and the maximum, because a slower ping risks the
|
|
52
|
-
* connection being closed for idleness. Shortening it makes a dead socket noticed sooner, since
|
|
53
|
-
* {@link healthCheckGracePeriodMs} moves the connection check along with it. See
|
|
24
|
+
* How often a health-check ping goes out while the socket is up. Defaults to 25s, which is also the
|
|
25
|
+
* maximum (a slower ping risks an idle close), so it can only be lowered. See
|
|
54
26
|
* {@link WS_CONNECTION_CONFIG_BOUNDS}.
|
|
55
27
|
*/
|
|
56
28
|
pingIntervalMs: number;
|
|
57
29
|
/**
|
|
58
|
-
* Extra
|
|
59
|
-
*
|
|
60
|
-
* `pingIntervalMs + healthCheckGracePeriodMs`, so changing the ping interval moves the connection check with it.
|
|
61
|
-
*
|
|
62
|
-
* A grace period rather than an absolute deadline, because a deadline can be set shorter than the
|
|
63
|
-
* ping interval, which makes the socket declare itself dead on a healthy connection and do it again
|
|
64
|
-
* after every reconnect. A grace period cannot express that.
|
|
30
|
+
* Extra time on top of {@link pingIntervalMs} before the health check declares the socket dead
|
|
31
|
+
* (the check fires after `pingIntervalMs + healthCheckGracePeriodMs` of silence). Defaults to 10s.
|
|
65
32
|
*/
|
|
66
33
|
healthCheckGracePeriodMs: number;
|
|
67
34
|
/**
|
|
68
|
-
* How long a drop must last before a UI reports it. Defaults to 5s.
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* Most drops resolve in under a second, so a banner showing all of them makes a working application
|
|
72
|
-
* look broken. **Nothing here waits on it** — it is configuration so the UI SDKs share one value.
|
|
73
|
-
* `stream-chat-react`'s `<Chat>` reads it.
|
|
35
|
+
* How long a drop must last before a UI reports it. Defaults to 5s. Nothing in this package waits
|
|
36
|
+
* on it; it is configuration so the UI SDKs share one value.
|
|
74
37
|
*/
|
|
75
38
|
offlineNotificationDisplayDelayMs: number;
|
|
76
|
-
/**
|
|
77
|
-
* The `WebSocket` constructor to open the socket with. Defaults to the global one.
|
|
78
|
-
*
|
|
79
|
-
* For hosts that have no usable global — a Node process, or a test wanting a fake socket.
|
|
80
|
-
*/
|
|
39
|
+
/** The `WebSocket` constructor to open the socket with. Defaults to the global one. */
|
|
81
40
|
webSocketImpl: typeof WebSocket | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Extra query parameters to append to the WebSocket URL.
|
|
84
|
-
*/
|
|
41
|
+
/** Extra query parameters appended to the WebSocket URL. */
|
|
85
42
|
urlParams: URLSearchParams | undefined;
|
|
86
43
|
/**
|
|
87
|
-
* A pre-built socket to use instead of constructing one
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* An instance is safe to hold here: `copyConfigPatch` passes class instances by reference so
|
|
91
|
-
* identity is preserved, only package defaults are deep-frozen, and the equality check guarding a
|
|
92
|
-
* config write short-circuits on `===`.
|
|
93
|
-
*
|
|
94
|
-
* `client.config.reset()` restores this to `undefined`, as it does every field, so a later
|
|
95
|
-
* `connect()` builds a real socket and opens a live WebSocket. A socket already open is unaffected —
|
|
96
|
-
* only the next connect. The catch is that the failure lands at that connect rather than at the
|
|
97
|
-
* reset, so a test that injected a fake socket to stay off the network breaks somewhere other than
|
|
98
|
-
* where it went wrong.
|
|
44
|
+
* A pre-built socket to use instead of constructing one (honoured only when `client.node` is true).
|
|
45
|
+
* `client.config.reset()` clears it, so the next `connect()` opens a live WebSocket.
|
|
99
46
|
*/
|
|
100
47
|
connection: StableWSConnection | undefined;
|
|
101
48
|
};
|
package/src/constants.ts
CHANGED
|
@@ -4,14 +4,14 @@ export const DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024; // 100 MB
|
|
|
4
4
|
export const API_MAX_FILES_ALLOWED_PER_MESSAGE = 10;
|
|
5
5
|
export const MAX_CHANNEL_MEMBER_COUNT_IN_CHANNEL_QUERY = 100;
|
|
6
6
|
export const RESERVED_UPDATED_MESSAGE_FIELDS = Object.freeze({
|
|
7
|
-
// Not `MessageRequest` fields
|
|
8
|
-
// shared_location)
|
|
7
|
+
// Not `MessageRequest` fields. Never add date fields that are (`pinned_at`, `pin_expires`,
|
|
8
|
+
// `shared_location`): stripping them clears them server-side.
|
|
9
9
|
created_at: true,
|
|
10
10
|
deleted_at: true,
|
|
11
11
|
message_text_updated_at: true,
|
|
12
12
|
updated_at: true,
|
|
13
13
|
command: true,
|
|
14
|
-
//
|
|
14
|
+
// Enriched by the back-end
|
|
15
15
|
mentioned_groups: true,
|
|
16
16
|
mentioned_users: true,
|
|
17
17
|
quoted_message: true,
|
|
@@ -21,7 +21,7 @@ export const RESERVED_UPDATED_MESSAGE_FIELDS = Object.freeze({
|
|
|
21
21
|
reaction_counts: true,
|
|
22
22
|
reaction_scores: true,
|
|
23
23
|
reply_count: true,
|
|
24
|
-
//
|
|
24
|
+
// Text-related fields that are not sent on update
|
|
25
25
|
i18n: true,
|
|
26
26
|
type: true,
|
|
27
27
|
html: true,
|