@stream-io/feeds-client 0.3.42 → 0.3.44

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.
@@ -1711,6 +1711,7 @@ class FeedsApi {
1711
1711
  const body = {
1712
1712
  type: request?.type,
1713
1713
  feeds: request?.feeds,
1714
+ copy_custom_to_notification: request?.copy_custom_to_notification,
1714
1715
  create_notification_activity: request?.create_notification_activity,
1715
1716
  expires_at: request?.expires_at,
1716
1717
  id: request?.id,
@@ -1913,6 +1914,7 @@ class FeedsApi {
1913
1914
  };
1914
1915
  const body = {
1915
1916
  type: request?.type,
1917
+ copy_custom_to_notification: request?.copy_custom_to_notification,
1916
1918
  create_notification_activity: request?.create_notification_activity,
1917
1919
  enforce_unique: request?.enforce_unique,
1918
1920
  skip_push: request?.skip_push,
@@ -1993,6 +1995,7 @@ class FeedsApi {
1993
1995
  id: request?.id
1994
1996
  };
1995
1997
  const body = {
1998
+ copy_custom_to_notification: request?.copy_custom_to_notification,
1996
1999
  handle_mention_notifications: request?.handle_mention_notifications,
1997
2000
  run_activity_processors: request?.run_activity_processors,
1998
2001
  unset: request?.unset,
@@ -2014,6 +2017,7 @@ class FeedsApi {
2014
2017
  id: request?.id
2015
2018
  };
2016
2019
  const body = {
2020
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2017
2021
  expires_at: request?.expires_at,
2018
2022
  handle_mention_notifications: request?.handle_mention_notifications,
2019
2023
  poll_id: request?.poll_id,
@@ -2193,6 +2197,7 @@ class FeedsApi {
2193
2197
  async addComment(request) {
2194
2198
  const body = {
2195
2199
  comment: request?.comment,
2200
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2196
2201
  create_notification_activity: request?.create_notification_activity,
2197
2202
  id: request?.id,
2198
2203
  object_id: request?.object_id,
@@ -2275,6 +2280,7 @@ class FeedsApi {
2275
2280
  };
2276
2281
  const body = {
2277
2282
  comment: request?.comment,
2283
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2278
2284
  handle_mention_notifications: request?.handle_mention_notifications,
2279
2285
  skip_enrich_url: request?.skip_enrich_url,
2280
2286
  skip_push: request?.skip_push,
@@ -2299,6 +2305,7 @@ class FeedsApi {
2299
2305
  };
2300
2306
  const body = {
2301
2307
  type: request?.type,
2308
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2302
2309
  create_notification_activity: request?.create_notification_activity,
2303
2310
  enforce_unique: request?.enforce_unique,
2304
2311
  skip_push: request?.skip_push,
@@ -2674,6 +2681,7 @@ class FeedsApi {
2674
2681
  const body = {
2675
2682
  source: request?.source,
2676
2683
  target: request?.target,
2684
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2677
2685
  create_notification_activity: request?.create_notification_activity,
2678
2686
  follower_role: request?.follower_role,
2679
2687
  push_preference: request?.push_preference,
@@ -2695,6 +2703,7 @@ class FeedsApi {
2695
2703
  const body = {
2696
2704
  source: request?.source,
2697
2705
  target: request?.target,
2706
+ copy_custom_to_notification: request?.copy_custom_to_notification,
2698
2707
  create_notification_activity: request?.create_notification_activity,
2699
2708
  push_preference: request?.push_preference,
2700
2709
  skip_push: request?.skip_push,
@@ -4017,7 +4026,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
4017
4026
  };
4018
4027
  return result;
4019
4028
  };
4020
- const version = "0.3.42";
4029
+ const version = "0.3.44";
4021
4030
  const axios = axiosImport.default ?? axiosImport;
4022
4031
  class ApiClient {
4023
4032
  constructor(apiKey, tokenManager, connectionIdManager, options) {
@@ -6301,6 +6310,38 @@ function handleWatchStarted() {
6301
6310
  function handleWatchStopped() {
6302
6311
  this.state.partialNext({ watch: false });
6303
6312
  }
6313
+ const DEFAULT_MAX_RETRIES = 3;
6314
+ function isRetryableError(error) {
6315
+ if (error instanceof StreamApiError) {
6316
+ const statusCode = error.metadata?.response_code;
6317
+ if (statusCode && statusCode >= 400 && statusCode < 500) {
6318
+ return false;
6319
+ }
6320
+ }
6321
+ return true;
6322
+ }
6323
+ async function withRetry(fn, options = {}) {
6324
+ const { maxRetries = DEFAULT_MAX_RETRIES, shouldRetry } = options;
6325
+ let lastError;
6326
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
6327
+ try {
6328
+ return await fn();
6329
+ } catch (error) {
6330
+ lastError = error;
6331
+ const isLastAttempt = attempt === maxRetries;
6332
+ if (isLastAttempt) {
6333
+ throw error;
6334
+ }
6335
+ const shouldRetryResult = shouldRetry ? shouldRetry(error, attempt) : isRetryableError(error);
6336
+ if (!shouldRetryResult) {
6337
+ throw error;
6338
+ }
6339
+ const delay = retryInterval(attempt + 1);
6340
+ await sleep(delay);
6341
+ }
6342
+ }
6343
+ throw lastError;
6344
+ }
6304
6345
  const isPin = (entity) => {
6305
6346
  return "activity" in entity;
6306
6347
  };
@@ -6568,7 +6609,7 @@ const _Feed = class _Feed extends FeedApi {
6568
6609
  const { last_get_or_create_request_config } = this.state.getLatestValue();
6569
6610
  if (last_get_or_create_request_config?.watch) {
6570
6611
  this.inProgressGetOrCreate = void 0;
6571
- await this.getOrCreate(last_get_or_create_request_config);
6612
+ await withRetry(() => this.getOrCreate(last_get_or_create_request_config));
6572
6613
  }
6573
6614
  }
6574
6615
  async getOrCreate(request) {
@@ -7120,7 +7161,7 @@ function handleUserUpdated(event) {
7120
7161
  }
7121
7162
  var UnhandledErrorType = /* @__PURE__ */ ((UnhandledErrorType2) => {
7122
7163
  UnhandledErrorType2["ReconnectionReconciliation"] = "reconnection-reconciliation";
7123
- UnhandledErrorType2["FetchingOwnCapabilitiesOnNewActivity"] = "fetching-own-capabilities-on-new-activity";
7164
+ UnhandledErrorType2["FetchingOwnFieldsOnNewActivity"] = "fetching-own-fields-on-new-activity";
7124
7165
  return UnhandledErrorType2;
7125
7166
  })(UnhandledErrorType || {});
7126
7167
  function updateCommentCount({
@@ -7372,7 +7413,7 @@ class FeedsClient extends FeedsApi {
7372
7413
  }).catch((error) => {
7373
7414
  this.eventDispatcher.dispatch({
7374
7415
  type: "errors.unhandled",
7375
- error_type: UnhandledErrorType.FetchingOwnCapabilitiesOnNewActivity,
7416
+ error_type: UnhandledErrorType.FetchingOwnFieldsOnNewActivity,
7376
7417
  error
7377
7418
  });
7378
7419
  });
@@ -7400,11 +7441,13 @@ class FeedsClient extends FeedsApi {
7400
7441
  const feed = feedEntries[index]?.[0] ?? (activity && getFeed.call(activity)?.feed);
7401
7442
  return [{ feed, reason: result.reason, activity_id: activity?.id }];
7402
7443
  });
7403
- this.eventDispatcher.dispatch({
7404
- type: "errors.unhandled",
7405
- error_type: UnhandledErrorType.ReconnectionReconciliation,
7406
- failures
7407
- });
7444
+ if (failures.length > 0) {
7445
+ this.eventDispatcher.dispatch({
7446
+ type: "errors.unhandled",
7447
+ error_type: UnhandledErrorType.ReconnectionReconciliation,
7448
+ failures
7449
+ });
7450
+ }
7408
7451
  }
7409
7452
  };
7410
7453
  this.pollFromState = (id) => this.polls_by_id.get(id);
@@ -7596,6 +7639,7 @@ class FeedsClient extends FeedsApi {
7596
7639
  this.polls_by_id.clear();
7597
7640
  this.activeActivities = [];
7598
7641
  this.activeFeeds = {};
7642
+ this.healthyConnectionChangedEventCount = 0;
7599
7643
  this.state.partialNext(this.initialState);
7600
7644
  this.cancelGetBatchOwnFieldsTimer();
7601
7645
  clearQueuedFeeds();
@@ -7860,7 +7904,7 @@ class FeedsClient extends FeedsApi {
7860
7904
  };
7861
7905
  }
7862
7906
  async ownBatch(request) {
7863
- const response = await super.ownBatch(request);
7907
+ const response = await withRetry(() => super.ownBatch(request));
7864
7908
  Object.entries(response.data).forEach(([fid, ownFields]) => {
7865
7909
  const feed = this.activeFeeds[fid];
7866
7910
  if (feed) {
@@ -8041,4 +8085,4 @@ exports.replaceUniqueArrayMerge = replaceUniqueArrayMerge;
8041
8085
  exports.shouldUpdateState = shouldUpdateState;
8042
8086
  exports.uniqueArrayMerge = uniqueArrayMerge;
8043
8087
  exports.updateEntityInArray = updateEntityInArray;
8044
- //# sourceMappingURL=feeds-client-9wb2RHSS.js.map
8088
+ //# sourceMappingURL=feeds-client-DK7vuKlg.js.map