@stream-io/feeds-client 0.2.2 → 0.2.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 +8 -0
- package/dist/@react-bindings/contexts/StreamSearchContext.d.ts +1 -1
- package/dist/@react-bindings/contexts/StreamSearchResultsContext.d.ts +1 -1
- package/dist/@react-bindings/hooks/search-state-hooks/useSearchQuery.d.ts +1 -1
- package/dist/@react-bindings/hooks/search-state-hooks/useSearchResult.d.ts +1 -1
- package/dist/@react-bindings/hooks/search-state-hooks/useSearchSources.d.ts +2 -2
- package/dist/@react-bindings/wrappers/StreamSearch.d.ts +1 -1
- package/dist/@react-bindings/wrappers/StreamSearchResults.d.ts +1 -1
- package/dist/index-react-bindings.browser.cjs +26 -8
- package/dist/index-react-bindings.browser.cjs.map +1 -1
- package/dist/index-react-bindings.browser.js +26 -8
- package/dist/index-react-bindings.browser.js.map +1 -1
- package/dist/index-react-bindings.node.cjs +26 -8
- package/dist/index-react-bindings.node.cjs.map +1 -1
- package/dist/index-react-bindings.node.js +26 -8
- package/dist/index-react-bindings.node.js.map +1 -1
- package/dist/index.browser.cjs +242 -170
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +242 -171
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.node.cjs +242 -170
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +242 -171
- package/dist/index.node.js.map +1 -1
- package/dist/src/common/{ActivitySearchSource.d.ts → search/ActivitySearchSource.d.ts} +3 -3
- package/dist/src/common/{BaseSearchSource.d.ts → search/BaseSearchSource.d.ts} +41 -35
- package/dist/src/common/{FeedSearchSource.d.ts → search/FeedSearchSource.d.ts} +3 -3
- package/dist/src/common/{SearchController.d.ts → search/SearchController.d.ts} +1 -3
- package/dist/src/common/{UserSearchSource.d.ts → search/UserSearchSource.d.ts} +4 -4
- package/dist/src/common/search/index.d.ts +6 -0
- package/dist/src/common/search/types.d.ts +22 -0
- package/dist/src/common/types.d.ts +1 -0
- package/dist/src/feed/event-handlers/activity/handle-activity-deleted.d.ts +5 -12
- package/dist/src/gen/models/index.d.ts +58 -26
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -5
- package/package.json +1 -1
- package/src/common/{ActivitySearchSource.ts → search/ActivitySearchSource.ts} +3 -3
- package/src/common/{BaseSearchSource.ts → search/BaseSearchSource.ts} +137 -69
- package/src/common/{FeedSearchSource.ts → search/FeedSearchSource.ts} +3 -3
- package/src/common/{SearchController.ts → search/SearchController.ts} +2 -7
- package/src/common/{UserSearchSource.ts → search/UserSearchSource.ts} +3 -3
- package/src/common/search/index.ts +6 -0
- package/src/common/search/types.ts +21 -0
- package/src/common/types.ts +2 -0
- package/src/feed/event-handlers/activity/activity-utils.test.ts +2 -2
- package/src/feed/event-handlers/activity/handle-activity-added.test.ts +86 -0
- package/src/feed/event-handlers/activity/handle-activity-deleted.test.ts +117 -0
- package/src/feed/event-handlers/activity/handle-activity-deleted.ts +8 -4
- package/src/feed/event-handlers/feed-member/handle-feed-member-added.test.ts +75 -0
- package/src/feed/event-handlers/feed-member/handle-feed-member-removed.test.ts +82 -0
- package/src/feed/event-handlers/feed-member/handle-feed-member-removed.ts +19 -9
- package/src/feed/event-handlers/feed-member/handle-feed-member-updated.test.ts +84 -0
- package/src/gen/feeds/FeedsApi.ts +6 -0
- package/src/gen/model-decoders/decoders.ts +13 -1
- package/src/gen/models/index.ts +90 -34
- package/src/test-utils/response-generators.ts +107 -0
- package/dist/src/test-utils/index.d.ts +0 -1
- package/dist/src/test-utils/response-generators.d.ts +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [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)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
* 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))
|
|
12
|
+
|
|
5
13
|
## [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
14
|
|
|
7
15
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SearchController } from '../../src/common/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
1
|
+
import type { SearchController } from '../../../src/common/search';
|
|
2
2
|
export declare const useSearchSources: (controllerFromProps?: SearchController) => {
|
|
3
|
-
sources: import("
|
|
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/
|
|
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/
|
|
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 /
|
|
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
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
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,
|
|
4913
|
+
return { changed: true, pinned_activities: newActivities };
|
|
4896
4914
|
}
|
|
4897
4915
|
else {
|
|
4898
4916
|
return { changed: false, pinned_activities: pinnedActivities };
|