@stream-io/feeds-client 0.1.3 → 0.1.5
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/@react-bindings/hooks/client-state-hooks/index.ts +2 -0
- package/@react-bindings/hooks/feed-state-hooks/index.ts +5 -0
- package/@react-bindings/hooks/internal/index.ts +1 -0
- package/@react-bindings/hooks/util/index.ts +1 -0
- package/@react-bindings/index.ts +6 -3
- package/CHANGELOG.md +21 -0
- package/dist/@react-bindings/contexts/StreamFeedContext.d.ts +12 -0
- package/dist/@react-bindings/hooks/client-state-hooks/index.d.ts +2 -0
- package/dist/@react-bindings/hooks/client-state-hooks/useClientConnectedUser.d.ts +4 -0
- package/dist/@react-bindings/hooks/client-state-hooks/useWsConnectionState.d.ts +6 -0
- package/dist/@react-bindings/hooks/feed-state-hooks/index.d.ts +5 -0
- package/dist/@react-bindings/hooks/feed-state-hooks/useComments.d.ts +19 -0
- package/dist/@react-bindings/hooks/feed-state-hooks/useFeedActivities.d.ts +11 -0
- package/dist/@react-bindings/hooks/feed-state-hooks/useFollowers.d.ts +16 -0
- package/dist/@react-bindings/hooks/feed-state-hooks/useFollowing.d.ts +16 -0
- package/dist/@react-bindings/hooks/{useOwnCapabilities.d.ts → feed-state-hooks/useOwnCapabilities.d.ts} +2 -2
- package/dist/@react-bindings/hooks/internal/index.d.ts +1 -0
- package/dist/@react-bindings/hooks/internal/useStableCallback.d.ts +25 -0
- package/dist/@react-bindings/hooks/util/index.d.ts +1 -0
- package/dist/@react-bindings/hooks/util/useReactionActions.d.ts +17 -0
- package/dist/@react-bindings/index.d.ts +5 -3
- package/dist/@react-bindings/wrappers/StreamFeed.d.ts +12 -0
- package/dist/index-react-bindings.browser.cjs +456 -183
- package/dist/index-react-bindings.browser.cjs.map +1 -1
- package/dist/index-react-bindings.browser.js +451 -185
- package/dist/index-react-bindings.browser.js.map +1 -1
- package/dist/index-react-bindings.node.cjs +456 -183
- package/dist/index-react-bindings.node.cjs.map +1 -1
- package/dist/index-react-bindings.node.js +451 -185
- package/dist/index-react-bindings.node.js.map +1 -1
- package/dist/index.browser.cjs +172 -72
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +169 -73
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +172 -72
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +169 -73
- package/dist/index.node.js.map +1 -1
- package/dist/src/Feed.d.ts +7 -3
- package/dist/src/FeedsClient.d.ts +4 -3
- package/dist/src/gen/models/index.d.ts +92 -15
- package/dist/src/types.d.ts +7 -0
- package/dist/src/utils.d.ts +9 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/Feed.ts +200 -89
- package/src/FeedsClient.ts +8 -3
- package/src/common/real-time/StableWSConnection.ts +4 -1
- package/src/gen/feeds/FeedsApi.ts +5 -0
- package/src/gen/models/index.ts +143 -17
- package/src/types.ts +12 -1
- package/src/utils.ts +25 -1
- package/dist/@react-bindings/hooks/clientStateHooks.d.ts +0 -10
- package/dist/@react-bindings/hooks/useComments.d.ts +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useStableCallback';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useReactionActions'
|
package/@react-bindings/index.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
// Hooks
|
|
2
2
|
|
|
3
|
-
export * from './hooks/useComments';
|
|
4
3
|
export * from './hooks/useStateStore';
|
|
5
|
-
export * from './hooks/useOwnCapabilities';
|
|
6
|
-
export * from './hooks/clientStateHooks';
|
|
7
4
|
export * from './hooks/useCreateFeedsClient';
|
|
8
5
|
|
|
6
|
+
export * from './hooks/client-state-hooks';
|
|
7
|
+
export * from './hooks/feed-state-hooks';
|
|
8
|
+
export * from './hooks/util';
|
|
9
|
+
|
|
9
10
|
// Contexts
|
|
10
11
|
|
|
11
12
|
export * from './contexts/StreamFeedsContext';
|
|
13
|
+
export * from './contexts/StreamFeedContext';
|
|
12
14
|
|
|
13
15
|
// Wrappers
|
|
14
16
|
|
|
15
17
|
export * from './wrappers/StreamFeeds';
|
|
18
|
+
export * from './wrappers/StreamFeed';
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.1.5](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.1.4...@stream-io/feeds-client-0.1.5) (2025-07-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add loadNextPage to useComments ([#57](https://github.com/GetStream/stream-feeds-js/issues/57)) ([fef823c](https://github.com/GetStream/stream-feeds-js/commit/fef823ceeb1d181f44607821cb46ec2458e199f3))
|
|
11
|
+
* add loadNextPageMembers ([#56](https://github.com/GetStream/stream-feeds-js/issues/56)) ([104dad0](https://github.com/GetStream/stream-feeds-js/commit/104dad0c1440ad26b41b76e1402ef0635e4358ac))
|
|
12
|
+
* add useFollowers & useFollowing ([#55](https://github.com/GetStream/stream-feeds-js/issues/55)) ([95bef04](https://github.com/GetStream/stream-feeds-js/commit/95bef04d2d921574fd1461cca0965963bc245910))
|
|
13
|
+
* feed context, file uploads and reactions ([#66](https://github.com/GetStream/stream-feeds-js/issues/66)) ([886123a](https://github.com/GetStream/stream-feeds-js/commit/886123aeb243c04d9ae82112634e826518e61089))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* post useComments/useFollows merge fixes ([#64](https://github.com/GetStream/stream-feeds-js/issues/64)) ([2da2670](https://github.com/GetStream/stream-feeds-js/commit/2da2670d9575aba8b3f22d4cc019ae911a92edfb))
|
|
19
|
+
* replace `eol` with `checkHasAnotherPage` ([#67](https://github.com/GetStream/stream-feeds-js/issues/67)) ([f490e1f](https://github.com/GetStream/stream-feeds-js/commit/f490e1f16775adac46bccc979d5d0d2ce825f859))
|
|
20
|
+
|
|
21
|
+
## [0.1.4](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.1.3...@stream-io/feeds-client-0.1.4) (2025-07-16)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* update to latest openapi ([#62](https://github.com/GetStream/stream-feeds-js/issues/62)) ([82b39ae](https://github.com/GetStream/stream-feeds-js/commit/82b39aee0c62cd9aa1598fb42aaf6637ded83a33))
|
|
25
|
+
|
|
5
26
|
## [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
27
|
|
|
7
28
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Feed } from '../../src/Feed';
|
|
2
|
+
export declare const StreamFeedContext: import("react").Context<Feed | undefined>;
|
|
3
|
+
/**
|
|
4
|
+
* The props for the StreamFeedProvider component.
|
|
5
|
+
*/
|
|
6
|
+
export type StreamFeedContextProps = {
|
|
7
|
+
feed: Feed;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Hook to access the nearest Feed instance.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useFeedContext: () => Feed | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ActivityResponse, CommentResponse } from '../../../src/gen/models';
|
|
2
|
+
import type { CommentParent } from '../../../src/types';
|
|
3
|
+
import { Feed, FeedState } from '../../../src/Feed';
|
|
4
|
+
type UseCommentsReturnType<T extends ActivityResponse | CommentResponse> = {
|
|
5
|
+
comments: NonNullable<FeedState['comments_by_entity_id'][T['id']]>['comments'];
|
|
6
|
+
comments_pagination: NonNullable<FeedState['comments_by_entity_id'][T['id']]>['pagination'];
|
|
7
|
+
hasNextPage: boolean;
|
|
8
|
+
isLoadingNextPage: boolean;
|
|
9
|
+
loadNextPage: (request?: T extends CommentResponse ? Parameters<Feed['loadNextPageCommentReplies']>[1] : Parameters<Feed['loadNextPageActivityComments']>[1]) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export declare function useComments<T extends CommentParent>(_: {
|
|
12
|
+
feed: Feed;
|
|
13
|
+
parent: T;
|
|
14
|
+
}): UseCommentsReturnType<T>;
|
|
15
|
+
export declare function useComments<T extends CommentParent>(_: {
|
|
16
|
+
feed?: Feed;
|
|
17
|
+
parent: T;
|
|
18
|
+
}): UseCommentsReturnType<T> | undefined;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Feed } from '../../../src/Feed';
|
|
2
|
+
/**
|
|
3
|
+
* A React hook that returns a reactive object containing the current activities,
|
|
4
|
+
* loading state and whether there is a next page to paginate to or not.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFeedActivities: (feedFromProps?: Feed) => {
|
|
7
|
+
loadNextPage: import("../internal").StableCallback<[], Promise<void>>;
|
|
8
|
+
isLoading?: boolean | undefined;
|
|
9
|
+
hasNextPage?: boolean | undefined;
|
|
10
|
+
activities?: import("../../..").ActivityResponse[] | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Feed, FeedState } from '../../../src/Feed';
|
|
2
|
+
declare const selector: ({ follower_count, followers, followers_pagination, }: FeedState) => {
|
|
3
|
+
follower_count: number | undefined;
|
|
4
|
+
followers: import("../../..").FollowResponse[] | undefined;
|
|
5
|
+
followers_pagination: (import("../../..").PagerResponse & import("../../..").LoadingStates & {
|
|
6
|
+
sort?: import("../../..").SortParamRequest[];
|
|
7
|
+
}) | undefined;
|
|
8
|
+
};
|
|
9
|
+
type UseFollowersReturnType = ReturnType<typeof selector> & {
|
|
10
|
+
isLoadingNextPage: boolean;
|
|
11
|
+
hasNextPage: boolean;
|
|
12
|
+
loadNextPage: (...options: Parameters<Feed['loadNextPageFollowers']>) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare function useFollowers(feed: Feed): UseFollowersReturnType;
|
|
15
|
+
export declare function useFollowers(feed?: Feed): UseFollowersReturnType | undefined;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Feed, FeedState } from '../../../src/Feed';
|
|
2
|
+
declare const selector: ({ following_count, following, following_pagination, }: FeedState) => {
|
|
3
|
+
following_count: number | undefined;
|
|
4
|
+
following: import("../../..").FollowResponse[] | undefined;
|
|
5
|
+
following_pagination: (import("../../..").PagerResponse & import("../../..").LoadingStates & {
|
|
6
|
+
sort?: import("../../..").SortParamRequest[];
|
|
7
|
+
}) | undefined;
|
|
8
|
+
};
|
|
9
|
+
type UseFollowingReturnType = ReturnType<typeof selector> & {
|
|
10
|
+
isLoadingNextPage: boolean;
|
|
11
|
+
hasNextPage: boolean;
|
|
12
|
+
loadNextPage: (...options: Parameters<Feed['loadNextPageFollowers']>) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare function useFollowing(feed: Feed): UseFollowingReturnType;
|
|
15
|
+
export declare function useFollowing(feed?: Feed): UseFollowingReturnType | undefined;
|
|
16
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const useOwnCapabilities: (
|
|
1
|
+
import { Feed } from '../../../src/Feed';
|
|
2
|
+
export declare const useOwnCapabilities: (feedFromProps?: Feed) => {
|
|
3
3
|
canAddActivity: boolean;
|
|
4
4
|
canAddActivityReaction: boolean;
|
|
5
5
|
canAddComment: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useStableCallback';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type StableCallback<A extends unknown[], R> = (...args: A) => R;
|
|
2
|
+
/**
|
|
3
|
+
* A utility hook implementing a stable callback. It takes in an unstable method that
|
|
4
|
+
* is supposed to be invoked somewhere deeper in the DOM tree without making it
|
|
5
|
+
* change its reference every time the parent component rerenders. It will also return
|
|
6
|
+
* the value of the callback if it does return one.
|
|
7
|
+
* A common use-case would be having a function whose invocation depends on state
|
|
8
|
+
* somewhere high up in the DOM tree and wanting to use the same function deeper
|
|
9
|
+
* down, for example in a leaf node and simply using useCallback results in
|
|
10
|
+
* cascading dependency hell. If we wrap it in useStableCallback, we would be able
|
|
11
|
+
* to:
|
|
12
|
+
* - Use the same function as a dependency of another hook (since it is stable)
|
|
13
|
+
* - Still invoke it and get the latest state
|
|
14
|
+
*
|
|
15
|
+
* **Caveats:**
|
|
16
|
+
* - Never wrap a function that is supposed to return a React.ReactElement in
|
|
17
|
+
* useStableCallback, since React will not know that the DOM needs to be updated
|
|
18
|
+
* whenever the callback value changes (for example, renderItem from FlatList must
|
|
19
|
+
* never be wrapped in this hook)
|
|
20
|
+
* - Always prefer using a standard useCallback/stable function wherever possible
|
|
21
|
+
* (the purpose of useStableCallback is to bridge the gap between top level contexts
|
|
22
|
+
* and cascading rereders in downstream components - **not** as an escape hatch)
|
|
23
|
+
* @param callback - the callback we want to stabilize
|
|
24
|
+
*/
|
|
25
|
+
export declare const useStableCallback: <A extends unknown[], R>(callback: StableCallback<A, R>) => StableCallback<A, R>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useReactionActions';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommentParent } from '../../../src/types';
|
|
2
|
+
/**
|
|
3
|
+
* A utility hook that takes in an entity and a reaction type, and creates reaction actions
|
|
4
|
+
* that can then be used on the UI. The entity can be either an ActivityResponse or a CommentResponse
|
|
5
|
+
* as the hook determines internally which APIs it is supposed to use, while taking the
|
|
6
|
+
* correct ownCapabilities into account.
|
|
7
|
+
* @param entity - The entity to which we want to add a reaction, can be either ActivityResponse or CommentResponse.
|
|
8
|
+
* @param type - The type of reaction we want to add or remove.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useReactionActions: ({ entity, type, }: {
|
|
11
|
+
entity: CommentParent;
|
|
12
|
+
type: string;
|
|
13
|
+
}) => {
|
|
14
|
+
addReaction: import("../internal").StableCallback<[], Promise<void>>;
|
|
15
|
+
removeReaction: import("../internal").StableCallback<[], Promise<void>>;
|
|
16
|
+
toggleReaction: import("../internal").StableCallback<[], Promise<void>>;
|
|
17
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export * from './hooks/useComments';
|
|
2
1
|
export * from './hooks/useStateStore';
|
|
3
|
-
export * from './hooks/useOwnCapabilities';
|
|
4
|
-
export * from './hooks/clientStateHooks';
|
|
5
2
|
export * from './hooks/useCreateFeedsClient';
|
|
3
|
+
export * from './hooks/client-state-hooks';
|
|
4
|
+
export * from './hooks/feed-state-hooks';
|
|
5
|
+
export * from './hooks/util';
|
|
6
6
|
export * from './contexts/StreamFeedsContext';
|
|
7
|
+
export * from './contexts/StreamFeedContext';
|
|
7
8
|
export * from './wrappers/StreamFeeds';
|
|
9
|
+
export * from './wrappers/StreamFeed';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import type { Feed } from '../../src/Feed';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the StreamFeed component. It accepts a `Feed` instance.
|
|
5
|
+
*/
|
|
6
|
+
export type StreamFeedProps = {
|
|
7
|
+
feed: Feed;
|
|
8
|
+
};
|
|
9
|
+
export declare const StreamFeed: {
|
|
10
|
+
({ feed, children }: PropsWithChildren<StreamFeedProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|