@stream-io/feeds-client 0.2.2 → 0.2.4

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 (60) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/@react-bindings/contexts/StreamSearchContext.d.ts +1 -1
  3. package/dist/@react-bindings/contexts/StreamSearchResultsContext.d.ts +1 -1
  4. package/dist/@react-bindings/hooks/search-state-hooks/useSearchQuery.d.ts +1 -1
  5. package/dist/@react-bindings/hooks/search-state-hooks/useSearchResult.d.ts +1 -1
  6. package/dist/@react-bindings/hooks/search-state-hooks/useSearchSources.d.ts +2 -2
  7. package/dist/@react-bindings/wrappers/StreamSearch.d.ts +1 -1
  8. package/dist/@react-bindings/wrappers/StreamSearchResults.d.ts +1 -1
  9. package/dist/index-react-bindings.browser.cjs +29 -9
  10. package/dist/index-react-bindings.browser.cjs.map +1 -1
  11. package/dist/index-react-bindings.browser.js +29 -9
  12. package/dist/index-react-bindings.browser.js.map +1 -1
  13. package/dist/index-react-bindings.node.cjs +29 -9
  14. package/dist/index-react-bindings.node.cjs.map +1 -1
  15. package/dist/index-react-bindings.node.js +29 -9
  16. package/dist/index-react-bindings.node.js.map +1 -1
  17. package/dist/index.browser.cjs +243 -171
  18. package/dist/index.browser.cjs.map +1 -1
  19. package/dist/index.browser.js +243 -172
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.d.ts +1 -5
  22. package/dist/index.node.cjs +243 -171
  23. package/dist/index.node.cjs.map +1 -1
  24. package/dist/index.node.js +243 -172
  25. package/dist/index.node.js.map +1 -1
  26. package/dist/src/common/{ActivitySearchSource.d.ts → search/ActivitySearchSource.d.ts} +3 -3
  27. package/dist/src/common/{BaseSearchSource.d.ts → search/BaseSearchSource.d.ts} +41 -35
  28. package/dist/src/common/{FeedSearchSource.d.ts → search/FeedSearchSource.d.ts} +5 -5
  29. package/dist/src/common/{SearchController.d.ts → search/SearchController.d.ts} +1 -3
  30. package/dist/src/common/{UserSearchSource.d.ts → search/UserSearchSource.d.ts} +4 -4
  31. package/dist/src/common/search/index.d.ts +6 -0
  32. package/dist/src/common/search/types.d.ts +22 -0
  33. package/dist/src/common/types.d.ts +1 -0
  34. package/dist/src/feed/event-handlers/activity/handle-activity-deleted.d.ts +5 -12
  35. package/dist/src/gen/models/index.d.ts +68 -26
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/index.ts +1 -5
  38. package/package.json +1 -1
  39. package/src/common/{ActivitySearchSource.ts → search/ActivitySearchSource.ts} +3 -3
  40. package/src/common/{BaseSearchSource.ts → search/BaseSearchSource.ts} +137 -69
  41. package/src/common/{FeedSearchSource.ts → search/FeedSearchSource.ts} +6 -5
  42. package/src/common/{SearchController.ts → search/SearchController.ts} +2 -7
  43. package/src/common/{UserSearchSource.ts → search/UserSearchSource.ts} +3 -3
  44. package/src/common/search/index.ts +6 -0
  45. package/src/common/search/types.ts +21 -0
  46. package/src/common/types.ts +2 -0
  47. package/src/feed/event-handlers/activity/activity-utils.test.ts +2 -2
  48. package/src/feed/event-handlers/activity/handle-activity-added.test.ts +86 -0
  49. package/src/feed/event-handlers/activity/handle-activity-deleted.test.ts +117 -0
  50. package/src/feed/event-handlers/activity/handle-activity-deleted.ts +8 -4
  51. package/src/feed/event-handlers/feed-member/handle-feed-member-added.test.ts +75 -0
  52. package/src/feed/event-handlers/feed-member/handle-feed-member-removed.test.ts +82 -0
  53. package/src/feed/event-handlers/feed-member/handle-feed-member-removed.ts +19 -9
  54. package/src/feed/event-handlers/feed-member/handle-feed-member-updated.test.ts +84 -0
  55. package/src/gen/feeds/FeedsApi.ts +6 -0
  56. package/src/gen/model-decoders/decoders.ts +13 -1
  57. package/src/gen/models/index.ts +108 -34
  58. package/src/test-utils/response-generators.ts +107 -0
  59. package/dist/src/test-utils/index.d.ts +0 -1
  60. package/dist/src/test-utils/response-generators.d.ts +0 -74
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.2.4](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.2.3...@stream-io/feeds-client-0.2.4) (2025-09-04)
6
+
7
+
8
+ * fix docs snippets tests ([879d5d4](https://github.com/GetStream/stream-feeds-js/commit/879d5d48b70cb5ec16b82b145bf46abdb000c428))
9
+ * Skip notification tests to be able to release ([c71733e](https://github.com/GetStream/stream-feeds-js/commit/c71733e6e26ca65df1660452fd7ae73ef70f2e98))
10
+
11
+
12
+ ### Features
13
+
14
+ * add TaskID in DeleteFeedResponse ([#107](https://github.com/GetStream/stream-feeds-js/issues/107)) ([153aa23](https://github.com/GetStream/stream-feeds-js/commit/153aa230e415fb20d790f083f0fb1057990e91f5))
15
+ * hashtags ([#105](https://github.com/GetStream/stream-feeds-js/issues/105)) ([f5e5e24](https://github.com/GetStream/stream-feeds-js/commit/f5e5e24be1183aab682cae05115f2c04f5543c4d))
16
+
17
+ ## [0.2.3](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.2.2...@stream-io/feeds-client-0.2.3) (2025-09-01)
18
+
19
+
20
+ ### Features
21
+
22
+ * add the ability to keep search items stable while searching ([#104](https://github.com/GetStream/stream-feeds-js/issues/104)) ([62a9808](https://github.com/GetStream/stream-feeds-js/commit/62a980890ce3a16e34a6d323ef8f58d58d2f8f4c))
23
+ * update to latest API spec ([#106](https://github.com/GetStream/stream-feeds-js/issues/106)) ([6555d15](https://github.com/GetStream/stream-feeds-js/commit/6555d15049fddace837cfd592bff2d18293a16be))
24
+
5
25
  ## [0.2.2](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.2.1...@stream-io/feeds-client-0.2.2) (2025-08-25)
6
26
 
7
27
 
@@ -1,4 +1,4 @@
1
- import type { SearchController } from '../../src/common/SearchController';
1
+ import type { SearchController } from '../../src/common/search';
2
2
  export declare const StreamSearchContext: import("react").Context<SearchController | undefined>;
3
3
  /**
4
4
  * The props for the StreamSearchProvider component.
@@ -1,4 +1,4 @@
1
- import type { SearchSource } from '../../src/common/BaseSearchSource';
1
+ import type { SearchSource } from '../../src/common/search';
2
2
  export declare const StreamSearchResultsContext: import("react").Context<SearchSource<any> | undefined>;
3
3
  /**
4
4
  * The props for the StreamSearchResultsProvider component.
@@ -1,4 +1,4 @@
1
- import type { SearchController } from '../../../src/common/SearchController';
1
+ import type { SearchController } from '../../../src/common/search';
2
2
  export declare const useSearchQuery: (controllerFromProps?: SearchController) => {
3
3
  searchQuery: string;
4
4
  } | undefined;
@@ -1,4 +1,4 @@
1
- import type { SearchSource } from '../../../src/common/BaseSearchSource';
1
+ import type { SearchSource } from '../../../src/common/search';
2
2
  export declare const useSearchResult: (sourceFromProps?: SearchSource) => {
3
3
  items: any[] | undefined;
4
4
  error: Error | undefined;
@@ -1,4 +1,4 @@
1
- import type { SearchController } from '../../../src/common/SearchController';
1
+ import type { SearchController } from '../../../src/common/search';
2
2
  export declare const useSearchSources: (controllerFromProps?: SearchController) => {
3
- sources: import("../../..").SearchSource<any>[];
3
+ sources: import("../../../src/common/search").SearchSource<any>[];
4
4
  } | undefined;
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import type { SearchController } from '../../src/common/SearchController';
2
+ import type { SearchController } from '../../src/common/search';
3
3
  /**
4
4
  * The props for the StreamSearch component. It accepts a `SearchController` instance.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import type { SearchSource } from '../../src/common/BaseSearchSource';
2
+ import type { SearchSource } from '../../src/common/search';
3
3
  /**
4
4
  * The props for the StreamSearchResults component. It accepts a `SearchSource` instance.
5
5
  */
@@ -277,7 +277,7 @@ function useStateStore(store, selector) {
277
277
 
278
278
  const decoders = {};
279
279
  const decodeDatetimeType = (input) => typeof input === 'number'
280
- ? new Date(Math.floor(input / 1e6))
280
+ ? new Date(Math.floor(input / 1000000))
281
281
  : new Date(input);
282
282
  decoders.DatetimeType = decodeDatetimeType;
283
283
  const decode = (typeMappings, input) => {
@@ -688,6 +688,7 @@ decoders.Command = (input) => {
688
688
  decoders.CommentAddedEvent = (input) => {
689
689
  const typeMappings = {
690
690
  created_at: { type: 'DatetimeType', isSingle: true },
691
+ activity: { type: 'ActivityResponse', isSingle: true },
691
692
  comment: { type: 'CommentResponse', isSingle: true },
692
693
  received_at: { type: 'DatetimeType', isSingle: true },
693
694
  };
@@ -704,6 +705,7 @@ decoders.CommentDeletedEvent = (input) => {
704
705
  decoders.CommentReactionAddedEvent = (input) => {
705
706
  const typeMappings = {
706
707
  created_at: { type: 'DatetimeType', isSingle: true },
708
+ activity: { type: 'ActivityResponse', isSingle: true },
707
709
  comment: { type: 'CommentResponse', isSingle: true },
708
710
  reaction: { type: 'FeedsReactionResponse', isSingle: true },
709
711
  received_at: { type: 'DatetimeType', isSingle: true },
@@ -722,6 +724,7 @@ decoders.CommentReactionDeletedEvent = (input) => {
722
724
  decoders.CommentReactionUpdatedEvent = (input) => {
723
725
  const typeMappings = {
724
726
  created_at: { type: 'DatetimeType', isSingle: true },
727
+ activity: { type: 'ActivityResponse', isSingle: true },
725
728
  comment: { type: 'CommentResponse', isSingle: true },
726
729
  reaction: { type: 'FeedsReactionResponse', isSingle: true },
727
730
  received_at: { type: 'DatetimeType', isSingle: true },
@@ -1084,6 +1087,7 @@ decoders.Message = (input) => {
1084
1087
  pin_expires: { type: 'DatetimeType', isSingle: true },
1085
1088
  pinned_at: { type: 'DatetimeType', isSingle: true },
1086
1089
  thread_participants: { type: 'User', isSingle: false },
1090
+ member: { type: 'ChannelMember', isSingle: true },
1087
1091
  pinned_by: { type: 'User', isSingle: true },
1088
1092
  poll: { type: 'Poll', isSingle: true },
1089
1093
  quoted_message: { type: 'Message', isSingle: true },
@@ -1137,6 +1141,8 @@ decoders.ModerationCustomActionEvent = (input) => {
1137
1141
  };
1138
1142
  decoders.ModerationFlagResponse = (input) => {
1139
1143
  const typeMappings = {
1144
+ created_at: { type: 'DatetimeType', isSingle: true },
1145
+ updated_at: { type: 'DatetimeType', isSingle: true },
1140
1146
  review_queue_item: { type: 'ReviewQueueItemResponse', isSingle: true },
1141
1147
  user: { type: 'UserResponse', isSingle: true },
1142
1148
  };
@@ -1903,6 +1909,7 @@ class FeedsApi {
1903
1909
  const body = {
1904
1910
  type: request?.type,
1905
1911
  create_notification_activity: request?.create_notification_activity,
1912
+ skip_push: request?.skip_push,
1906
1913
  custom: request?.custom,
1907
1914
  };
1908
1915
  const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/activities/{activity_id}/reactions', pathParams, undefined, body, 'application/json');
@@ -2049,6 +2056,7 @@ class FeedsApi {
2049
2056
  object_type: request?.object_type,
2050
2057
  create_notification_activity: request?.create_notification_activity,
2051
2058
  parent_id: request?.parent_id,
2059
+ skip_push: request?.skip_push,
2052
2060
  attachments: request?.attachments,
2053
2061
  mentioned_user_ids: request?.mentioned_user_ids,
2054
2062
  custom: request?.custom,
@@ -2102,6 +2110,7 @@ class FeedsApi {
2102
2110
  };
2103
2111
  const body = {
2104
2112
  comment: request?.comment,
2113
+ skip_push: request?.skip_push,
2105
2114
  custom: request?.custom,
2106
2115
  };
2107
2116
  const response = await this.apiClient.sendRequest('PATCH', '/api/v2/feeds/comments/{id}', pathParams, undefined, body, 'application/json');
@@ -2115,6 +2124,7 @@ class FeedsApi {
2115
2124
  const body = {
2116
2125
  type: request?.type,
2117
2126
  create_notification_activity: request?.create_notification_activity,
2127
+ skip_push: request?.skip_push,
2118
2128
  custom: request?.custom,
2119
2129
  };
2120
2130
  const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/comments/{id}/reactions', pathParams, undefined, body, 'application/json');
@@ -2355,6 +2365,7 @@ class FeedsApi {
2355
2365
  create_notification_activity: request?.create_notification_activity,
2356
2366
  follower_role: request?.follower_role,
2357
2367
  push_preference: request?.push_preference,
2368
+ skip_push: request?.skip_push,
2358
2369
  custom: request?.custom,
2359
2370
  };
2360
2371
  const response = await this.apiClient.sendRequest('PATCH', '/api/v2/feeds/follows', undefined, undefined, body, 'application/json');
@@ -2367,6 +2378,7 @@ class FeedsApi {
2367
2378
  target: request?.target,
2368
2379
  create_notification_activity: request?.create_notification_activity,
2369
2380
  push_preference: request?.push_preference,
2381
+ skip_push: request?.skip_push,
2370
2382
  custom: request?.custom,
2371
2383
  };
2372
2384
  const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/follows', undefined, undefined, body, 'application/json');
@@ -4648,14 +4660,20 @@ function handleFeedMemberUpdated(event) {
4648
4660
  function handleFeedMemberRemoved(event) {
4649
4661
  const { connected_user: connectedUser } = this.client.state.getLatestValue();
4650
4662
  this.state.next((currentState) => {
4651
- const newState = {
4652
- ...currentState,
4653
- members: currentState.members?.filter((member) => member.user.id !== event.user?.id),
4654
- };
4655
- if (connectedUser?.id === event.member_id) {
4663
+ let newState;
4664
+ if (typeof currentState.members !== 'undefined') {
4665
+ const filtered = currentState.members.filter((member) => member.user.id !== event.member_id);
4666
+ if (filtered.length !== currentState.members.length) {
4667
+ newState ?? (newState = { ...currentState });
4668
+ newState.members = filtered;
4669
+ }
4670
+ }
4671
+ if (connectedUser?.id === event.member_id &&
4672
+ typeof currentState.own_membership !== 'undefined') {
4673
+ newState ?? (newState = { ...currentState });
4656
4674
  delete newState.own_membership;
4657
4675
  }
4658
- return newState;
4676
+ return newState ?? currentState;
4659
4677
  });
4660
4678
  }
4661
4679
 
@@ -4892,7 +4910,7 @@ const removePinnedActivityFromState = (activityResponse, pinnedActivities) => {
4892
4910
  if (index !== -1) {
4893
4911
  const newActivities = [...pinnedActivities];
4894
4912
  newActivities.splice(index, 1);
4895
- return { changed: true, activities: newActivities };
4913
+ return { changed: true, pinned_activities: newActivities };
4896
4914
  }
4897
4915
  else {
4898
4916
  return { changed: false, pinned_activities: pinnedActivities };
@@ -6404,7 +6422,9 @@ const useSearchResult = (sourceFromProps) => {
6404
6422
  const source = sourceFromProps ?? sourceFromContext;
6405
6423
  const { items, error, isLoading, hasNext } = useStateStore(source?.state, selector$2) ?? {};
6406
6424
  const loadMore = useStableCallback(async () => {
6407
- source?.search();
6425
+ if (hasNext) {
6426
+ source?.search();
6427
+ }
6408
6428
  });
6409
6429
  return react.useMemo(() => ({ items, error, isLoading, hasNext, loadMore }), [error, hasNext, isLoading, items, loadMore]);
6410
6430
  };