@stream-io/feeds-client 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.1.3](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.1.2...@stream-io/feeds-client-0.1.3) (2025-07-15)
6
+
7
+
8
+ ### Features
9
+
10
+ * reconcile watched feeds on reconnect ([#54](https://github.com/GetStream/stream-feeds-js/issues/54)) ([b00e7c7](https://github.com/GetStream/stream-feeds-js/commit/b00e7c775a7680a93ff3180944e8e340e155c55e))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * form data undefined values ([#60](https://github.com/GetStream/stream-feeds-js/issues/60)) ([ef8c2f2](https://github.com/GetStream/stream-feeds-js/commit/ef8c2f29b53b24d291531edb1621e39650bf6109))
16
+ * remove timeout for file uploads ([#58](https://github.com/GetStream/stream-feeds-js/issues/58)) ([56a3d7d](https://github.com/GetStream/stream-feeds-js/commit/56a3d7d8afa55fb4dedffb97b22a3863e746d13e))
17
+
5
18
  ## [0.1.2](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.1.1...@stream-io/feeds-client-0.1.2) (2025-07-11)
6
19
 
7
20
 
@@ -3653,7 +3653,10 @@ class ApiClient {
3653
3653
  const encodedBody = requestContentType === 'multipart/form-data' ? new FormData() : body;
3654
3654
  if (requestContentType === 'multipart/form-data') {
3655
3655
  Object.keys(body).forEach((key) => {
3656
- encodedBody.append(key, body[key]);
3656
+ const value = body[key];
3657
+ if (value != null) {
3658
+ encodedBody.append(key, value);
3659
+ }
3657
3660
  });
3658
3661
  }
3659
3662
  try {
@@ -3662,8 +3665,11 @@ class ApiClient {
3662
3665
  method,
3663
3666
  headers,
3664
3667
  params: queryParams,
3665
- paramsSerializer: params => this.queryParamsStringify(params),
3668
+ paramsSerializer: (params) => this.queryParamsStringify(params),
3666
3669
  data: encodedBody,
3670
+ timeout:
3671
+ // multipart/form-data requests should not have a timeout allowing ample time for file uploads
3672
+ requestContentType === 'multipart/form-data' ? 0 : this.timeout,
3667
3673
  });
3668
3674
  const metadata = this.getRequestMetadata(client_request_id, response);
3669
3675
  return { body: response.data, metadata };
@@ -3727,9 +3733,9 @@ class ApiClient {
3727
3733
  };
3728
3734
  };
3729
3735
  this.baseUrl = options?.base_url ?? 'https://video.stream-io-api.com';
3736
+ this.timeout = options?.timeout ?? 3000;
3730
3737
  this.axiosInstance = axios.create({
3731
3738
  baseURL: this.baseUrl,
3732
- timeout: options?.timeout ?? 3000,
3733
3739
  });
3734
3740
  }
3735
3741
  get webSocketBaseUrl() {
@@ -4449,6 +4455,12 @@ class Feed extends FeedApi {
4449
4455
  };
4450
4456
  });
4451
4457
  }
4458
+ async synchronize() {
4459
+ const { last_get_or_create_request_config } = this.state.getLatestValue();
4460
+ if (last_get_or_create_request_config?.watch) {
4461
+ await this.getOrCreate(last_get_or_create_request_config);
4462
+ }
4463
+ }
4452
4464
  async getOrCreate(request) {
4453
4465
  if (this.currentState.is_loading_activities) {
4454
4466
  throw new Error('Only one getOrCreate call is allowed at a time');
@@ -4514,6 +4526,7 @@ class Feed extends FeedApi {
4514
4526
  if (!request?.following_pagination?.limit) {
4515
4527
  delete nextState.following;
4516
4528
  }
4529
+ nextState.last_get_or_create_request_config = request;
4517
4530
  return nextState;
4518
4531
  });
4519
4532
  }
@@ -4800,7 +4813,7 @@ class Feed extends FeedApi {
4800
4813
  }
4801
4814
  async getNextPage() {
4802
4815
  const currentState = this.currentState;
4803
- const response = await this.getOrCreate({
4816
+ return await this.getOrCreate({
4804
4817
  member_pagination: {
4805
4818
  limit: 0,
4806
4819
  },
@@ -4811,8 +4824,8 @@ class Feed extends FeedApi {
4811
4824
  limit: 0,
4812
4825
  },
4813
4826
  next: currentState.next,
4827
+ limit: currentState.last_get_or_create_request_config?.limit ?? 20,
4814
4828
  });
4815
- return response;
4816
4829
  }
4817
4830
  addActivity(request) {
4818
4831
  return this.feedsApi.addActivity({
@@ -5215,6 +5228,7 @@ class FeedsClient extends FeedsApi {
5215
5228
  super(apiClient);
5216
5229
  this.eventDispatcher = new EventDispatcher();
5217
5230
  this.activeFeeds = {};
5231
+ this.healthyConnectionChangedEventCount = 0;
5218
5232
  this.pollFromState = (id) => this.polls_by_id.get(id);
5219
5233
  this.connectUser = async (user, tokenProvider) => {
5220
5234
  if (this.state.getLatestValue().connectedUser !== undefined ||
@@ -5328,6 +5342,15 @@ class FeedsClient extends FeedsApi {
5328
5342
  case 'connection.changed': {
5329
5343
  const { online } = event;
5330
5344
  this.state.partialNext({ isWsConnectionHealthy: online });
5345
+ if (online) {
5346
+ this.healthyConnectionChangedEventCount++;
5347
+ // we skip the first event as we could potentially be querying twice
5348
+ if (this.healthyConnectionChangedEventCount > 1) {
5349
+ for (const activeFeed of Object.values(this.activeFeeds)) {
5350
+ activeFeed.synchronize();
5351
+ }
5352
+ }
5353
+ }
5331
5354
  break;
5332
5355
  }
5333
5356
  case 'feeds.feed.created': {