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.
Files changed (269) hide show
  1. package/dist/cjs/index.browser.js +2196 -3902
  2. package/dist/cjs/index.browser.js.map +3 -3
  3. package/dist/cjs/index.node.js +2197 -3902
  4. package/dist/cjs/index.node.js.map +3 -3
  5. package/dist/esm/index.mjs +2199 -3905
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelManager.d.ts +120 -233
  8. package/dist/types/CooldownTimer.d.ts +8 -23
  9. package/dist/types/EventHandlerPipeline.d.ts +17 -37
  10. package/dist/types/LiveLocationManager.d.ts +22 -50
  11. package/dist/types/api-client.d.ts +9 -14
  12. package/dist/types/channel.d.ts +253 -448
  13. package/dist/types/channel_state.d.ts +48 -95
  14. package/dist/types/client.d.ts +245 -370
  15. package/dist/types/client_state.d.ts +1 -3
  16. package/dist/types/configuration/ConfigController.d.ts +30 -124
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
  18. package/dist/types/configuration/keys.d.ts +5 -19
  19. package/dist/types/configuration/shape.d.ts +12 -29
  20. package/dist/types/configuration/types.d.ts +59 -87
  21. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
  22. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  23. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  24. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  25. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  26. package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
  27. package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
  28. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
  29. package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
  30. package/dist/types/connection/networkConnection/types.d.ts +12 -27
  31. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
  32. package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
  33. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
  34. package/dist/types/connection/wsConnection/config.d.ts +8 -28
  35. package/dist/types/connection/wsConnection/types.d.ts +17 -70
  36. package/dist/types/entityStore/EntityStore.d.ts +153 -113
  37. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
  38. package/dist/types/errors.d.ts +7 -19
  39. package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
  40. package/dist/types/gen/chat/ChatApi.d.ts +28 -14
  41. package/dist/types/gen/models/index.d.ts +769 -86
  42. package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
  43. package/dist/types/index.d.ts +2 -4
  44. package/dist/types/languageNames.d.ts +9 -24
  45. package/dist/types/logger.d.ts +1 -3
  46. package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
  47. package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
  48. package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
  49. package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
  50. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  51. package/dist/types/messageComposer/configuration/types.d.ts +29 -56
  52. package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
  53. package/dist/types/messageComposer/messageComposer.d.ts +30 -164
  54. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
  55. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
  56. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  57. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  58. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
  59. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
  60. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  61. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  62. package/dist/types/messageComposer/pollComposer.d.ts +8 -4
  63. package/dist/types/messageComposer/textComposer.d.ts +3 -9
  64. package/dist/types/messageComposer/types.d.ts +5 -8
  65. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
  66. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
  67. package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
  68. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
  69. package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
  70. package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
  71. package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
  72. package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
  73. package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
  74. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
  75. package/dist/types/messageOperations/types.d.ts +15 -30
  76. package/dist/types/middleware.d.ts +7 -5
  77. package/dist/types/moderation.d.ts +21 -14
  78. package/dist/types/notifications/NotificationManager.d.ts +8 -31
  79. package/dist/types/notifications/types.d.ts +19 -59
  80. package/dist/types/offline-support/offline_support_api.d.ts +145 -539
  81. package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
  82. package/dist/types/offline-support/queueableOperations.d.ts +24 -52
  83. package/dist/types/offline-support/types.d.ts +24 -187
  84. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  85. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  86. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
  87. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
  88. package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
  89. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
  90. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
  91. package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
  92. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
  93. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
  94. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
  95. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
  96. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  97. package/dist/types/pagination/utility.normalization.d.ts +5 -23
  98. package/dist/types/pagination/utility.search.d.ts +3 -8
  99. package/dist/types/poll.d.ts +14 -14
  100. package/dist/types/poll_manager.d.ts +11 -2
  101. package/dist/types/poll_optimistic_votes.d.ts +10 -14
  102. package/dist/types/reminders/Reminder.d.ts +4 -4
  103. package/dist/types/reminders/ReminderManager.d.ts +7 -20
  104. package/dist/types/search/BaseSearchSource.d.ts +7 -12
  105. package/dist/types/search/ChannelSearchSource.d.ts +7 -7
  106. package/dist/types/search/MessageSearchSource.d.ts +7 -9
  107. package/dist/types/search/SearchController.d.ts +17 -22
  108. package/dist/types/search/types.d.ts +6 -10
  109. package/dist/types/signing.d.ts +12 -3
  110. package/dist/types/thread.d.ts +23 -71
  111. package/dist/types/thread_manager.d.ts +45 -70
  112. package/dist/types/token_manager.d.ts +8 -13
  113. package/dist/types/types.d.ts +64 -125
  114. package/dist/types/types.utility.d.ts +3 -3
  115. package/dist/types/upload-utils.d.ts +5 -10
  116. package/dist/types/uploadManager.d.ts +17 -45
  117. package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
  118. package/dist/types/utils/WithSubscriptions.d.ts +5 -15
  119. package/dist/types/utils/concurrency.d.ts +11 -19
  120. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  121. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  122. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  123. package/dist/types/utils/objectPath.d.ts +6 -41
  124. package/dist/types/utils/retryable.d.ts +8 -12
  125. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  126. package/dist/types/utils/time.d.ts +24 -64
  127. package/dist/types/utils.d.ts +40 -86
  128. package/package.json +7 -2
  129. package/src/ChannelManager.ts +159 -300
  130. package/src/CooldownTimer.ts +11 -29
  131. package/src/EventHandlerPipeline.ts +21 -44
  132. package/src/LiveLocationManager.ts +35 -74
  133. package/src/api-client.ts +43 -61
  134. package/src/campaign.ts +1 -1
  135. package/src/channel.ts +396 -749
  136. package/src/channel_batch_updater.ts +1 -1
  137. package/src/channel_state.ts +50 -105
  138. package/src/client.ts +360 -588
  139. package/src/client_state.ts +1 -6
  140. package/src/configuration/ConfigController.ts +41 -157
  141. package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
  142. package/src/configuration/index.ts +1 -1
  143. package/src/configuration/keys.ts +13 -32
  144. package/src/configuration/shape.ts +67 -70
  145. package/src/configuration/types.ts +60 -100
  146. package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
  147. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  148. package/src/configuration/utils/declarativeSlices.ts +9 -39
  149. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  150. package/src/configuration/utils/index.ts +2 -4
  151. package/src/configuration/utils/serverAuthority.ts +20 -68
  152. package/src/connection/ConnectionIdManager.ts +20 -49
  153. package/src/connection/ConnectionRecoveryManager.ts +51 -178
  154. package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
  155. package/src/connection/networkConnection/reporters.ts +9 -36
  156. package/src/connection/networkConnection/types.ts +12 -27
  157. package/src/connection/wsConnection/StableWSConnection.ts +73 -193
  158. package/src/connection/wsConnection/WSConnection.ts +56 -131
  159. package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
  160. package/src/connection/wsConnection/config.ts +13 -48
  161. package/src/connection/wsConnection/types.ts +17 -70
  162. package/src/constants.ts +4 -4
  163. package/src/entityStore/EntityStore.ts +162 -167
  164. package/src/entityStore/StoreBackedItemIndex.ts +14 -47
  165. package/src/errors.ts +7 -19
  166. package/src/formatMessageMemo.ts +3 -9
  167. package/src/gen/chat/ChannelApi.ts +19 -0
  168. package/src/gen/chat/ChatApi.ts +87 -13
  169. package/src/gen/models/index.ts +793 -71
  170. package/src/gen/moderation/ModerationApi.ts +0 -4
  171. package/src/index.ts +10 -14
  172. package/src/languageNames.ts +9 -24
  173. package/src/logger.ts +1 -3
  174. package/src/messageComposer/LocationComposer.ts +7 -23
  175. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  176. package/src/messageComposer/attachmentIdentity.ts +2 -13
  177. package/src/messageComposer/attachmentManager.ts +17 -63
  178. package/src/messageComposer/attachmentUtils.ts +3 -17
  179. package/src/messageComposer/configuration/configuration.ts +5 -8
  180. package/src/messageComposer/configuration/types.ts +29 -56
  181. package/src/messageComposer/fileUtils.ts +1 -1
  182. package/src/messageComposer/linkPreviewsManager.ts +8 -20
  183. package/src/messageComposer/messageComposer.ts +54 -222
  184. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
  185. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
  186. package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
  187. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
  188. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  189. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
  190. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  191. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  192. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  193. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
  194. package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
  195. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  196. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  197. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  198. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  199. package/src/messageComposer/pollComposer.ts +11 -8
  200. package/src/messageComposer/textComposer.ts +9 -59
  201. package/src/messageComposer/types.ts +9 -12
  202. package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
  203. package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
  204. package/src/messageOperations/FailedSendCache.ts +4 -9
  205. package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
  206. package/src/messageOperations/MessageOperations.ts +33 -62
  207. package/src/messageOperations/applyReactionLocally.ts +9 -28
  208. package/src/messageOperations/createMessageOperations.ts +17 -33
  209. package/src/messageOperations/reflectReactionEvent.ts +5 -13
  210. package/src/messageOperations/sendOrdering.ts +4 -7
  211. package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
  212. package/src/messageOperations/types.ts +15 -30
  213. package/src/middleware.ts +7 -10
  214. package/src/moderation.ts +25 -21
  215. package/src/notifications/NotificationManager.ts +11 -35
  216. package/src/notifications/types.ts +19 -59
  217. package/src/offline-support/offline_support_api.ts +178 -608
  218. package/src/offline-support/offline_sync_manager.ts +25 -69
  219. package/src/offline-support/queueableOperations.ts +31 -84
  220. package/src/offline-support/types.ts +25 -188
  221. package/src/pagination/ItemIndex.ts +4 -12
  222. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  223. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
  224. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  225. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
  226. package/src/pagination/filterCompiler.ts +11 -25
  227. package/src/pagination/paginators/BasePaginator.ts +422 -976
  228. package/src/pagination/paginators/ChannelPaginator.ts +130 -190
  229. package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
  230. package/src/pagination/paginators/MessagePaginator.ts +135 -175
  231. package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
  232. package/src/pagination/paginators/ReminderPaginator.ts +12 -15
  233. package/src/pagination/paginators/ThreadPaginator.ts +16 -26
  234. package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
  235. package/src/pagination/paginators/stateThrottling.ts +5 -10
  236. package/src/pagination/sortCompiler.ts +23 -50
  237. package/src/pagination/utility.normalization.ts +8 -30
  238. package/src/pagination/utility.search.ts +4 -11
  239. package/src/poll.ts +19 -19
  240. package/src/poll_manager.ts +16 -20
  241. package/src/poll_optimistic_votes.ts +17 -22
  242. package/src/reminders/Reminder.ts +5 -6
  243. package/src/reminders/ReminderManager.ts +9 -34
  244. package/src/reminders/ReminderTimer.ts +1 -2
  245. package/src/search/BaseSearchSource.ts +14 -29
  246. package/src/search/ChannelSearchSource.ts +8 -8
  247. package/src/search/MessageSearchSource.ts +19 -25
  248. package/src/search/SearchController.ts +18 -24
  249. package/src/search/types.ts +6 -10
  250. package/src/segment.ts +1 -1
  251. package/src/signing.ts +23 -3
  252. package/src/thread.ts +72 -173
  253. package/src/thread_manager.ts +59 -76
  254. package/src/token_manager.ts +11 -21
  255. package/src/types.ts +78 -126
  256. package/src/types.utility.ts +3 -3
  257. package/src/upload-utils.ts +5 -10
  258. package/src/uploadManager.ts +22 -54
  259. package/src/utils/FixedSizeQueueCache.ts +13 -21
  260. package/src/utils/WithSubscriptions.ts +5 -15
  261. package/src/utils/concurrency.ts +16 -55
  262. package/src/utils/mergeWith/mergeWith.ts +10 -13
  263. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  264. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  265. package/src/utils/objectPath.ts +6 -41
  266. package/src/utils/retryable.ts +10 -14
  267. package/src/utils/throttling/throttle.ts +9 -25
  268. package/src/utils/time.ts +26 -66
  269. package/src/utils.ts +72 -128
@@ -7,32 +7,29 @@ import type { StreamChat } from '../../client';
7
7
  import type { Channel } from '../../channel';
8
8
  import type { ChannelFilters, ChannelOptions, ChannelStateOptions, ParsedPredefinedFilterResponse, QueryChannelsRequest, SortParamRequest } from '../../types';
9
9
  /**
10
- * The `queryChannels` request this paginator will send, plus the client-only `stateOptions`.
11
- *
12
- * Deliberately the request's own shape (`filter_conditions`, `sort`, `limit`, `predefined_filter`, …)
13
- * rather than a `{ filters, sort, options }` wrapper: the same object goes on the wire, keys the
14
- * offline-db cache and is compared for query-shape changes, so any field mapping in between would be a
15
- * place for those three to drift apart. `MessageQueryShape` is likewise the request params themselves.
10
+ * The `queryChannels` request this paginator sends, plus the client-only `stateOptions`. It is the
11
+ * request's own shape because the same object goes on the wire, keys the offline-db cache and is
12
+ * compared for query-shape changes.
16
13
  */
17
14
  export type ChannelQueryShape = QueryChannelsRequest & {
18
- /** Not part of the request — controls how the response is applied to client state. */
15
+ /** Not part of the request: controls how the response is applied to client state. */
19
16
  stateOptions?: ChannelStateOptions;
20
17
  };
21
18
  export type ChannelPaginatorState = PaginatorState<Channel>;
19
+ /**
20
+ * Request options sent with every page query (`state`, `watch`, `presence`, `message_limit`, ...).
21
+ * `limit` and `offset` belong to the paginator: set the page size with `paginatorOptions.pageSize`.
22
+ */
22
23
  export type ChannelPaginatorRequestOptions = Partial<Omit<ChannelOptions, 'offset' | 'limit'>>;
23
24
  export type ChannelSortComparatorFactoryParams = {
24
- /** Sort the comparator is being built for — the effective sort, so a backend-resolved sort template. */
25
+ /** The effective sort the comparator is built for (a backend-resolved template, if any). */
25
26
  sort: SortParamRequest[];
26
- /**
27
- * The comparator `ChannelPaginator` would use for this sort. Delegate to it for the fields you do not
28
- * want to handle yourself instead of reimplementing channel field resolution and the cid tiebreaker.
29
- */
27
+ /** The comparator `ChannelPaginator` would use: delegate to it for the fields you do not handle. */
30
28
  defaultComparator: (a: Channel, b: Channel) => number;
31
29
  };
32
30
  /**
33
- * Produces the comparator that orders this paginator's channels. Consulted on **every** comparator
34
- * rebuild (construction, `sort` change, backend-resolved predefined sort), so unlike assigning
35
- * `sortComparator` directly, a factory is not overwritten by later sort changes.
31
+ * Produces the comparator that orders the channels. Consulted on every rebuild (construction,
32
+ * `sort` change, backend-resolved predefined sort), so later sort changes do not overwrite it.
36
33
  */
37
34
  export type ChannelSortComparatorFactory = (params: ChannelSortComparatorFactoryParams) => (a: Channel, b: Channel) => number;
38
35
  export type ChannelPaginatorOptions = {
@@ -46,31 +43,26 @@ export type ChannelPaginatorOptions = {
46
43
  sort?: SortParamRequest[];
47
44
  sortComparatorFactory?: ChannelSortComparatorFactory;
48
45
  /**
49
- * The channel store the list's index holds its channels in. Defaults to `client.channelManager`'s
50
- * store, so every list shares one instance per cid and keeps the channels it lists stored.
46
+ * The channel store backing the list's index. Defaults to `client.channelManager`'s store, shared
47
+ * by every list.
51
48
  *
52
49
  * @internal
53
50
  */
54
51
  store?: EntityStore<Channel>;
55
52
  };
56
53
  /**
57
- * A paginated channel list. Filters are described along three independent axes — the names follow them:
54
+ * A paginated channel list. `staticFilters` are the filters this client asked for, `filterBuilder`
55
+ * adds dynamic ones from its reactive context (merged over the static ones on every build). For a
56
+ * `predefined_filter` query the backend reports what it applied (`predefinedFilter`), which wins
57
+ * over `staticFilters` in `effectiveFilters` (and over `sort` in `effectiveSort`).
58
58
  *
59
- * - origin: `staticFilters` are supplied at construction and fixed; `filterBuilder` generates the
60
- * dynamic ones from its reactive context on every build. Every build merges dynamic over static.
61
- * - authority: `staticFilters` are what this client asked for; `predefinedFilter` is what the backend
62
- * reports it actually applied for a `predefined_filter` query. `effectiveFilters` is the winner of the
63
- * two (and `effectiveSort` likewise for ordering).
64
- * - purpose: `buildQueryFilters()` produces the filters sent to the server (and the offline-db query
65
- * key), built from the local filters only; `buildMatchFilters()` produces the filters items are
66
- * matched against locally, built from `effectiveFilters`. They are not interchangeable: sending the
67
- * resolved filter back changes the query shape mid-pagination, and matching against the local filter
68
- * admits channels the queried list excludes.
59
+ * `buildQueryFilters()` (sent to the server, offline-db query key) uses the local filters only and
60
+ * `buildMatchFilters()` (local matching) uses `effectiveFilters`. Do not swap them: sending the
61
+ * resolved filter back changes the query shape mid-pagination, and matching on the local filter
62
+ * admits channels the list excludes.
69
63
  *
70
- * Ordering follows the same authority rule: `sortComparator` is derived from `effectiveSort` and is
71
- * rebuilt whenever that changes, so it must not be assigned to. Customize it through
72
- * `sortComparatorFactory` (constructor option or setter, consulted on every rebuild) or by overriding
73
- * `buildSortComparator` in a subclass.
64
+ * `sortComparator` is derived from `effectiveSort` and rebuilt when it changes, so do not assign
65
+ * it: use `sortComparatorFactory` or override `buildSortComparator`.
74
66
  */
75
67
  export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQueryShape> {
76
68
  private readonly _id;
@@ -82,34 +74,28 @@ export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQuer
82
74
  protected _nextQueryShape: ChannelQueryShape | undefined;
83
75
  /** Backend-reported metadata of the last `predefined_filter` query (see `predefinedFilter`). */
84
76
  protected _predefinedFilter: ParsedPredefinedFilterResponse | undefined;
85
- /**
86
- * Predefined-filter metadata from the response of the query currently in flight. Held until
87
- * `postQueryReconcile` decides whether it should be committed (first page only).
88
- */
77
+ /** Metadata of the in-flight response, committed by `postQueryReconcile` on a first page only. */
89
78
  private _pendingPredefinedFilter;
90
79
  /**
91
- * True while the loaded items came ONLY from the offline cache - seeded by `setItems`, never
92
- * confirmed by a query. Such a state has no pagination position worth continuing from, so the seed
93
- * records `offset = <cache size>` and a query shape, which is what makes the next query look like a
94
- * continuation rather than a first page. See `executeQuery`.
80
+ * True while the loaded items came only from the offline cache (seeded by `setItems`, never
81
+ * confirmed by a query). The seed's offset and query shape would make the next query a
82
+ * continuation, but a cache has no pagination position, so `executeQuery` forces a first page that
83
+ * keeps the items.
95
84
  */
96
85
  private _itemsLoadedFromOfflineDB;
97
86
  /** The query in flight refreshes a cache-only window, so its response replaces the window. */
98
87
  private _replaceOfflineSeedOnResponse;
88
+ /** The query handed to the sync manager, from the cache read until it runs. See `executeQuery`. */
89
+ private _queryAwaitingSync;
99
90
  protected _sortComparatorFactory: ChannelSortComparatorFactory | undefined;
100
91
  sortComparator: (a: Channel, b: Channel) => number;
101
92
  filterBuilder: FilterBuilder<ChannelFilters>;
102
93
  constructor({ channelStateOptions, client, id, filterBuilderOptions, filters, paginatorOptions, requestOptions, sort, sortComparatorFactory, store, }: ChannelPaginatorOptions);
103
94
  /**
104
- * Builds the comparator for the given sort — the single construction point, so every rebuild (the
105
- * `sort` setter, a backend-resolved predefined sort) keeps the channel-specific path resolver and the
106
- * cid tiebreaker; omitting either makes ordering fall back to raw `channel.data` lookups and become
107
- * non-deterministic for equal sort values.
108
- *
109
- * `sortComparator` is derived state and is therefore reassigned on every rebuild — assigning to it
110
- * directly does not survive a sort change or a predefined-filter response. To customize ordering,
111
- * supply `sortComparatorFactory` (it is consulted on every rebuild and may delegate to
112
- * `defaultComparator`), or override this method in a subclass.
95
+ * The single construction point of `sortComparator`, so every rebuild keeps the channel path
96
+ * resolver and the cid tiebreaker. Customize it with `sortComparatorFactory` (which may delegate
97
+ * to `defaultComparator`) or by overriding this method: assigning `sortComparator` directly is
98
+ * lost on the next rebuild.
113
99
  */
114
100
  protected buildSortComparator(sort: SortParamRequest[]): (a: Channel, b: Channel) => number;
115
101
  get id(): string;
@@ -117,23 +103,14 @@ export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQuer
117
103
  get staticFilters(): ChannelFilters | undefined;
118
104
  get sort(): SortParamRequest[];
119
105
  /**
120
- * What the backend reported it actually filtered and sorted by for the last first-page query —
121
- * `QueryChannelsResponse.predefined_filter` (`name`, `filter`, and `sort` when the stored filter
122
- * carries its own sort template). Set only for `predefined_filter` queries: the raw `filter_conditions`
123
- * of a normal query are not echoed back.
106
+ * What the backend reported it filtered and sorted by for the last first-page query
107
+ * (`QueryChannelsResponse.predefined_filter`: `name`, `filter`, and `sort` when the stored filter
108
+ * has a sort template). Set only for `predefined_filter` queries.
124
109
  */
125
110
  get predefinedFilter(): ParsedPredefinedFilterResponse | undefined;
126
- /**
127
- * Filters this paginator matches items against client-side. A predefined filter resolved by the backend
128
- * wins over the locally configured one: for such a query the local `filters` are not what the server
129
- * applied, so matching against them would admit items the queried list excludes.
130
- */
111
+ /** Filters items are matched against locally: the backend-resolved one, else `staticFilters`. */
131
112
  get effectiveFilters(): ChannelFilters | undefined;
132
- /**
133
- * Sort this paginator orders items by. Mirrors `effectiveFilters`: a sort template carried by a
134
- * backend-resolved predefined filter takes precedence over the requested sort, matching backend
135
- * precedence rules.
136
- */
113
+ /** The sort items are ordered by: the backend-resolved predefined sort template, else `sort`. */
137
114
  get effectiveSort(): SortParamRequest[];
138
115
  get options(): ChannelOptions | undefined;
139
116
  get channelStateOptions(): ChannelStateOptions | undefined;
@@ -143,40 +120,26 @@ export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQuer
143
120
  set channelStateOptions(options: ChannelStateOptions | undefined);
144
121
  get sortComparatorFactory(): ChannelSortComparatorFactory | undefined;
145
122
  /**
146
- * Take over channel ordering at any point in the paginator's life. The comparator is rebuilt
147
- * immediately and the factory is consulted again on every later rebuild, so — unlike assigning
148
- * `sortComparator` — a sort change or a backend-resolved predefined sort will not discard it. Set to
149
- * `undefined` to go back to the built-in ordering.
123
+ * Rebuilds the comparator immediately; later rebuilds consult the factory again, so a sort change
124
+ * does not discard it. `undefined` restores the built-in ordering.
150
125
  */
151
126
  set sortComparatorFactory(factory: ChannelSortComparatorFactory | undefined);
152
127
  getItemId(item: Channel): string;
153
128
  /**
154
- * Filters sent to the server with the next query (and used as the offline-db query key). Deliberately
155
- * built from the locally configured filters only — feeding the backend-resolved filter back in would
156
- * change the query shape after the first response and make the following page look like a new first
157
- * page to `hasPaginationQueryShapeChanged`.
129
+ * Filters sent with the next query and used as the offline-db query key. Built from the local
130
+ * filters only: the backend-resolved filter would change the query shape after the first response,
131
+ * so the next page would look like a first page.
158
132
  */
159
133
  buildQueryFilters: () => ChannelFilters;
160
- /**
161
- * Filters items are matched against locally — the `BasePaginator.buildMatchFilters` hook consumed by
162
- * `matchesFilter`. Built from `effectiveFilters`, so a `predefined_filter` list matches what the
163
- * backend applied rather than the local filters, which are not what produced the list.
164
- */
134
+ /** Filters items are matched against locally (`matchesFilter`), built from `effectiveFilters`. */
165
135
  buildMatchFilters: () => ChannelFilters;
166
136
  matchesFilter(channel: Channel): boolean;
167
- /**
168
- * Commits the `predefined_filter` metadata of the response, or clears it when the response carried
169
- * none (a plain `filter_conditions` query), so a switch away from a predefined filter cannot leave
170
- * stale matching/ordering semantics behind.
171
- */
137
+ /** Commits the response's `predefined_filter` metadata, or clears it when there is none. */
172
138
  protected applyPredefinedFilterResponse(predefinedFilter: ParsedPredefinedFilterResponse | undefined): void;
173
139
  /**
174
- * The response metadata describes the query as a whole, so it is (re)committed only when a first page
175
- * lands — matching the legacy `ChannelManager`, which kept it untouched while paginating. A failed
176
- * query (`results === null`) must not drop the metadata of the already loaded list either.
177
- *
178
- * Committing before `super` matters: the base implementation filters and ingests the page using
179
- * `matchesFilter` and the comparators this metadata feeds.
140
+ * The metadata describes the query as a whole, so it is committed only when a first page lands (a
141
+ * failed query keeps the loaded list's). It is committed before `super`, which filters and ingests
142
+ * the page using `matchesFilter` and the comparator this metadata feeds.
180
143
  */
181
144
  postQueryReconcile(params: PostQueryReconcileParams<Channel, ChannelQueryShape>): import("./BasePaginator").ExecuteQueryReturnValue<Channel>;
182
145
  protected getNextQueryShape({ pageSize, }?: {
@@ -185,28 +148,19 @@ export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQuer
185
148
  /** The query that produced the currently loaded list, i.e. the cache key its cids belong under. */
186
149
  protected get loadedQueryRequest(): QueryChannelsRequest;
187
150
  /**
188
- * Writes a cid order into the offline cache under the query that produced it.
189
- *
190
- * `filters` and `sort` are passed separately even though `options` already contains them: the concrete
191
- * (RN) DB implementation derives the cache row key from those two top-level arguments in
192
- * `convertFilterSortToQuery`, while `options` carries the full request — the only place
193
- * `predefined_filter` / `filter_values` / `sort_values` appear, without which two predefined-filter
194
- * lists cannot be told apart. The duplication goes away once `convertFilterSortToQuery` derives the
195
- * key from `options` (a change in that implementation plus a schema-version bump to flush stale rows).
196
- *
197
- * The resolved `predefinedFilter` rides along with the order it produced: a cache-seeded list has no
198
- * response to learn it from, and without it `effectiveFilters` / `effectiveSort` fall back to the
199
- * local filters and the default sort - i.e. it would match and order by a different rule than the
200
- * one the cached order came from.
151
+ * Writes a cid order into the offline cache under the query that produced it. `filters` and `sort`
152
+ * are passed apart from `options` (which already holds them) because the DB implementation derives
153
+ * the cache row key from them, while `options` carries the full request (`predefined_filter`, ...)
154
+ * that tells predefined-filter lists apart. The resolved `predefinedFilter` is stored with the
155
+ * order: a cache-seeded list has no response to learn it from.
201
156
  */
202
157
  protected cacheCidsForQuery({ cids, request, }: {
203
158
  cids: string[];
204
159
  request: QueryChannelsRequest;
205
160
  }): void;
206
161
  /**
207
- * Persists the current cid order under the query that produced it. Called after every mutation of the
208
- * loaded list — including live WS-driven inserts/removals, which reorder the list without any query
209
- * running; skipping those would leave the cached order stale until the next full re-query.
162
+ * Persists the current cid order under the query that produced it. Runs after every mutation of
163
+ * the loaded list, including live inserts and removals that reorder it without a query.
210
164
  */
211
165
  protected persistLoadedCids(): void;
212
166
  preloadFirstPageFromOfflineDb: ({ queryShape, }: PaginationQueryParams<ChannelQueryShape>) => Promise<Channel[] | undefined>;
@@ -215,37 +169,25 @@ export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQuer
215
169
  queryShape?: ChannelQueryShape;
216
170
  }) => undefined;
217
171
  /**
218
- * Postpones a first-page query while the offline sync is still in progress: the cached page is
219
- * surfaced right away and the network query is handed to the sync manager, which re-runs it once
220
- * reconciliation finished — querying (and persisting cids) against unsynced local state would race
221
- * with the replay of pending local mutations. Mirrors `ChannelManager.queryChannels`, which deferred
222
- * on every unsynced call and read the cache only when it had nothing loaded yet.
223
- *
224
- * Only first-page queries defer; paginating an already loaded list is unaffected (as was the legacy
225
- * `loadNext`).
172
+ * Defers a first-page query (or a page of a cache-seeded list) while the offline sync is in
173
+ * progress: the cached page is shown right away and the network query is handed to the sync
174
+ * manager, which re-runs it after reconciliation. Querying and persisting cids against unsynced
175
+ * local state would race the replay of pending mutations. Paginating a list loaded from the
176
+ * network is not deferred.
226
177
  */
227
178
  executeQuery(params?: PaginationQueryParams<ChannelQueryShape>): Promise<void | import("./BasePaginator").ExecuteQueryReturnValue<Channel>>;
228
179
  query: () => Promise<PaginationQueryReturnValue<Channel>>;
229
180
  filterQueryResults: (items: Channel[]) => Channel[];
230
181
  setItems(params: SetPaginatorItemsParams<Channel>): void;
231
182
  /**
232
- * Places `channel` in the list if it matches, or drops it if it no longer does. A provisional
233
- * channel (created from members, still without an id) is refused: it is stored under a temporary
234
- * cid until its first query gives it the real one, and a list holding it would keep the temporary
235
- * cid. It is listed once it has its id, as the channels in a server page always do. Another
236
- * instance for a stored cid (a superseded one, or one made with `new Channel()`) is replaced by
237
- * the stored instance (see `ChannelManager.resolveListedChannel`).
183
+ * Places `channel` in the list if it matches, or drops it when it stops matching. A provisional
184
+ * channel (created from members, no ID yet) is refused: it is stored under a temporary cid. Another
185
+ * instance for a stored cid is replaced by the stored one (`ChannelManager.resolveListedChannel`).
238
186
  */
239
187
  ingestItem(input: Channel): boolean;
240
- /**
241
- * Entity-store subscriber (as the owner of its index). A channel publishes its own changes through
242
- * `channel.state`, so the list has nothing to re-project when the store reports a change.
243
- */
188
+ /** Entity-store subscriber. A channel publishes changes via `channel.state`: nothing to do. */
244
189
  onEntitiesChanged(): void;
245
- /**
246
- * Entity-store subscriber: the store removed a channel this list holds (a known end, logout), so
247
- * the list drops it from its windows.
248
- */
190
+ /** Entity-store subscriber: the store removed a channel this list holds (e.g. logout). */
249
191
  onEntityRemoved(id: string, channel: unknown): void;
250
192
  resetState(): void;
251
193
  removeItem(params: {