@stream-io/feeds-client 0.3.42 → 0.3.43

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,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.3.43](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.42...@stream-io/feeds-client-0.3.43) (2026-02-05)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * rename UnhandledErrorType.FetchingOwnCapabilitiesOnNewActivity t… ([#229](https://github.com/GetStream/stream-feeds-js/issues/229)) ([4f7e0d1](https://github.com/GetStream/stream-feeds-js/commit/4f7e0d17eecd6455966d97629559a83138087381))
11
+
5
12
  ## [0.3.42](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.41...@stream-io/feeds-client-0.3.42) (2026-02-03)
6
13
 
7
14
 
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const stateStore = require("@stream-io/state-store");
4
- const feedsClient = require("../feeds-client-9wb2RHSS.js");
4
+ const feedsClient = require("../feeds-client-B1mzWjrM.js");
5
5
  const loggerInternal = require("@stream-io/logger");
6
6
  const ownFeedFields = ["own_capabilities", "own_follows", "own_membership"];
7
7
  const ChannelOwnCapability = {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const reactBindings = require("@stream-io/state-store/react-bindings");
4
4
  const react = require("react");
5
- const feedsClient = require("../feeds-client-9wb2RHSS.js");
5
+ const feedsClient = require("../feeds-client-B1mzWjrM.js");
6
6
  const jsxRuntime = require("react/jsx-runtime");
7
7
  const useCreateFeedsClient = ({
8
8
  apiKey,
package/dist/es/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { StateStore } from "@stream-io/state-store";
2
2
  export * from "@stream-io/state-store";
3
- import { d as debounce } from "../feeds-client-BIM-XpQr.mjs";
4
- import { A, C, a, F, S, b, c, n, m, k, g, e, h, f, j, i, r, s, u, l } from "../feeds-client-BIM-XpQr.mjs";
3
+ import { d as debounce } from "../feeds-client-O3lXU8Bl.mjs";
4
+ import { A, C, a, F, S, b, c, n, m, k, g, e, h, f, j, i, r, s, u, l } from "../feeds-client-O3lXU8Bl.mjs";
5
5
  import { LogLevelEnum } from "@stream-io/logger";
6
6
  const ownFeedFields = ["own_capabilities", "own_follows", "own_membership"];
7
7
  const ChannelOwnCapability = {
@@ -1,7 +1,7 @@
1
1
  import { useStateStore } from "@stream-io/state-store/react-bindings";
2
2
  export * from "@stream-io/state-store/react-bindings";
3
3
  import { useState, useEffect, createContext, useContext, useRef, useCallback, useMemo } from "react";
4
- import { F as FeedsClient, g as isCommentResponse, c as checkHasAnotherPage } from "../feeds-client-BIM-XpQr.mjs";
4
+ import { F as FeedsClient, g as isCommentResponse, c as checkHasAnotherPage } from "../feeds-client-O3lXU8Bl.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  const useCreateFeedsClient = ({
7
7
  apiKey,
@@ -4017,7 +4017,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
4017
4017
  };
4018
4018
  return result;
4019
4019
  };
4020
- const version = "0.3.42";
4020
+ const version = "0.3.43";
4021
4021
  const axios = axiosImport.default ?? axiosImport;
4022
4022
  class ApiClient {
4023
4023
  constructor(apiKey, tokenManager, connectionIdManager, options) {
@@ -6301,6 +6301,38 @@ function handleWatchStarted() {
6301
6301
  function handleWatchStopped() {
6302
6302
  this.state.partialNext({ watch: false });
6303
6303
  }
6304
+ const DEFAULT_MAX_RETRIES = 3;
6305
+ function isRetryableError(error) {
6306
+ if (error instanceof StreamApiError) {
6307
+ const statusCode = error.metadata?.response_code;
6308
+ if (statusCode && statusCode >= 400 && statusCode < 500) {
6309
+ return false;
6310
+ }
6311
+ }
6312
+ return true;
6313
+ }
6314
+ async function withRetry(fn, options = {}) {
6315
+ const { maxRetries = DEFAULT_MAX_RETRIES, shouldRetry } = options;
6316
+ let lastError;
6317
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
6318
+ try {
6319
+ return await fn();
6320
+ } catch (error) {
6321
+ lastError = error;
6322
+ const isLastAttempt = attempt === maxRetries;
6323
+ if (isLastAttempt) {
6324
+ throw error;
6325
+ }
6326
+ const shouldRetryResult = shouldRetry ? shouldRetry(error, attempt) : isRetryableError(error);
6327
+ if (!shouldRetryResult) {
6328
+ throw error;
6329
+ }
6330
+ const delay = retryInterval(attempt + 1);
6331
+ await sleep(delay);
6332
+ }
6333
+ }
6334
+ throw lastError;
6335
+ }
6304
6336
  const isPin = (entity) => {
6305
6337
  return "activity" in entity;
6306
6338
  };
@@ -6568,7 +6600,7 @@ const _Feed = class _Feed extends FeedApi {
6568
6600
  const { last_get_or_create_request_config } = this.state.getLatestValue();
6569
6601
  if (last_get_or_create_request_config?.watch) {
6570
6602
  this.inProgressGetOrCreate = void 0;
6571
- await this.getOrCreate(last_get_or_create_request_config);
6603
+ await withRetry(() => this.getOrCreate(last_get_or_create_request_config));
6572
6604
  }
6573
6605
  }
6574
6606
  async getOrCreate(request) {
@@ -7120,7 +7152,7 @@ function handleUserUpdated(event) {
7120
7152
  }
7121
7153
  var UnhandledErrorType = /* @__PURE__ */ ((UnhandledErrorType2) => {
7122
7154
  UnhandledErrorType2["ReconnectionReconciliation"] = "reconnection-reconciliation";
7123
- UnhandledErrorType2["FetchingOwnCapabilitiesOnNewActivity"] = "fetching-own-capabilities-on-new-activity";
7155
+ UnhandledErrorType2["FetchingOwnFieldsOnNewActivity"] = "fetching-own-fields-on-new-activity";
7124
7156
  return UnhandledErrorType2;
7125
7157
  })(UnhandledErrorType || {});
7126
7158
  function updateCommentCount({
@@ -7372,7 +7404,7 @@ class FeedsClient extends FeedsApi {
7372
7404
  }).catch((error) => {
7373
7405
  this.eventDispatcher.dispatch({
7374
7406
  type: "errors.unhandled",
7375
- error_type: UnhandledErrorType.FetchingOwnCapabilitiesOnNewActivity,
7407
+ error_type: UnhandledErrorType.FetchingOwnFieldsOnNewActivity,
7376
7408
  error
7377
7409
  });
7378
7410
  });
@@ -7400,11 +7432,13 @@ class FeedsClient extends FeedsApi {
7400
7432
  const feed = feedEntries[index]?.[0] ?? (activity && getFeed.call(activity)?.feed);
7401
7433
  return [{ feed, reason: result.reason, activity_id: activity?.id }];
7402
7434
  });
7403
- this.eventDispatcher.dispatch({
7404
- type: "errors.unhandled",
7405
- error_type: UnhandledErrorType.ReconnectionReconciliation,
7406
- failures
7407
- });
7435
+ if (failures.length > 0) {
7436
+ this.eventDispatcher.dispatch({
7437
+ type: "errors.unhandled",
7438
+ error_type: UnhandledErrorType.ReconnectionReconciliation,
7439
+ failures
7440
+ });
7441
+ }
7408
7442
  }
7409
7443
  };
7410
7444
  this.pollFromState = (id) => this.polls_by_id.get(id);
@@ -7596,6 +7630,7 @@ class FeedsClient extends FeedsApi {
7596
7630
  this.polls_by_id.clear();
7597
7631
  this.activeActivities = [];
7598
7632
  this.activeFeeds = {};
7633
+ this.healthyConnectionChangedEventCount = 0;
7599
7634
  this.state.partialNext(this.initialState);
7600
7635
  this.cancelGetBatchOwnFieldsTimer();
7601
7636
  clearQueuedFeeds();
@@ -7860,7 +7895,7 @@ class FeedsClient extends FeedsApi {
7860
7895
  };
7861
7896
  }
7862
7897
  async ownBatch(request) {
7863
- const response = await super.ownBatch(request);
7898
+ const response = await withRetry(() => super.ownBatch(request));
7864
7899
  Object.entries(response.data).forEach(([fid, ownFields]) => {
7865
7900
  const feed = this.activeFeeds[fid];
7866
7901
  if (feed) {
@@ -8041,4 +8076,4 @@ exports.replaceUniqueArrayMerge = replaceUniqueArrayMerge;
8041
8076
  exports.shouldUpdateState = shouldUpdateState;
8042
8077
  exports.uniqueArrayMerge = uniqueArrayMerge;
8043
8078
  exports.updateEntityInArray = updateEntityInArray;
8044
- //# sourceMappingURL=feeds-client-9wb2RHSS.js.map
8079
+ //# sourceMappingURL=feeds-client-B1mzWjrM.js.map