@stream-io/feeds-client 0.2.11 → 0.2.12
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 +10 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-bindings.js +35 -33
- package/dist/cjs/react-bindings.js.map +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/react-bindings.mjs +35 -33
- package/dist/es/react-bindings.mjs.map +1 -1
- package/dist/{index-DP0C8psw.mjs → index-D7QtnkUs.mjs} +19 -21
- package/dist/index-D7QtnkUs.mjs.map +1 -0
- package/dist/{index-CFv0uza2.js → index-o7AeSkxa.js} +19 -21
- package/dist/index-o7AeSkxa.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.d.ts +15 -16
- package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.d.ts.map +1 -1
- package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnFollows.d.ts +1 -1
- package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnFollows.d.ts.map +1 -1
- package/dist/types/bindings/react/hooks/util/useReactionActions.d.ts +1 -1
- package/dist/types/bindings/react/hooks/util/useReactionActions.d.ts.map +1 -1
- package/dist/types/bindings/react/wrappers/StreamFeed.d.ts +1 -1
- package/dist/types/bindings/react/wrappers/StreamFeed.d.ts.map +1 -1
- package/dist/types/bindings/react/wrappers/StreamFeeds.d.ts +1 -1
- package/dist/types/bindings/react/wrappers/StreamFeeds.d.ts.map +1 -1
- package/dist/types/bindings/react/wrappers/StreamSearch.d.ts +1 -1
- package/dist/types/bindings/react/wrappers/StreamSearch.d.ts.map +1 -1
- package/dist/types/bindings/react/wrappers/StreamSearchResults.d.ts +1 -1
- package/dist/types/bindings/react/wrappers/StreamSearchResults.d.ts.map +1 -1
- package/dist/types/common/ApiClient.d.ts +3 -3
- package/dist/types/common/ApiClient.d.ts.map +1 -1
- package/dist/types/common/EventDispatcher.d.ts +1 -1
- package/dist/types/common/EventDispatcher.d.ts.map +1 -1
- package/dist/types/common/rate-limit.d.ts +1 -1
- package/dist/types/common/rate-limit.d.ts.map +1 -1
- package/dist/types/common/real-time/StableWSConnection.d.ts +3 -3
- package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -1
- package/dist/types/common/real-time/event-models.d.ts +1 -1
- package/dist/types/common/real-time/event-models.d.ts.map +1 -1
- package/dist/types/common/search/ActivitySearchSource.d.ts +2 -2
- package/dist/types/common/search/ActivitySearchSource.d.ts.map +1 -1
- package/dist/types/common/search/FeedSearchSource.d.ts +2 -2
- package/dist/types/common/search/FeedSearchSource.d.ts.map +1 -1
- package/dist/types/common/search/UserSearchSource.d.ts +2 -2
- package/dist/types/common/search/UserSearchSource.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-added.d.ts +3 -3
- package/dist/types/feed/event-handlers/activity/handle-activity-added.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-marked.d.ts +3 -3
- package/dist/types/feed/event-handlers/activity/handle-activity-marked.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-pinned.d.ts +2 -2
- package/dist/types/feed/event-handlers/activity/handle-activity-pinned.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-removed-from-feed.d.ts +2 -2
- package/dist/types/feed/event-handlers/activity/handle-activity-removed-from-feed.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-unpinned.d.ts +2 -2
- package/dist/types/feed/event-handlers/activity/handle-activity-unpinned.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-updated.d.ts +3 -3
- package/dist/types/feed/event-handlers/activity/handle-activity-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/comment/handle-comment-deleted.d.ts +3 -2
- package/dist/types/feed/event-handlers/comment/handle-comment-deleted.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/comment/handle-comment-reaction-added.d.ts +3 -2
- package/dist/types/feed/event-handlers/comment/handle-comment-reaction-added.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/comment/handle-comment-reaction-deleted.d.ts +3 -2
- package/dist/types/feed/event-handlers/comment/handle-comment-reaction-deleted.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/comment/handle-comment-updated.d.ts +3 -2
- package/dist/types/feed/event-handlers/comment/handle-comment-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/comment/utils/update-comment-count.d.ts +2 -2
- package/dist/types/feed/event-handlers/comment/utils/update-comment-count.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/feed/handle-feed-updated.d.ts +2 -2
- package/dist/types/feed/event-handlers/feed/handle-feed-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/feed-member/handle-feed-member-added.d.ts +2 -2
- package/dist/types/feed/event-handlers/feed-member/handle-feed-member-added.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/feed-member/handle-feed-member-removed.d.ts +2 -2
- package/dist/types/feed/event-handlers/feed-member/handle-feed-member-removed.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/feed-member/handle-feed-member-updated.d.ts +2 -2
- package/dist/types/feed/event-handlers/feed-member/handle-feed-member-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/follow/handle-follow-updated.d.ts +1 -1
- package/dist/types/feed/event-handlers/follow/handle-follow-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/notification-feed/handle-notification-feed-updated.d.ts +1 -1
- package/dist/types/feed/event-handlers/notification-feed/handle-notification-feed-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/watch/handle-watch-started.d.ts +1 -1
- package/dist/types/feed/event-handlers/watch/handle-watch-started.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/watch/handle-watch-stopped.d.ts +1 -1
- package/dist/types/feed/event-handlers/watch/handle-watch-stopped.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts +3 -3
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/feeds-client/feeds-client.d.ts +3 -3
- package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
- package/dist/types/gen/feeds/FeedApi.d.ts +2 -2
- package/dist/types/gen/feeds/FeedApi.d.ts.map +1 -1
- package/dist/types/gen/feeds/FeedsApi.d.ts +2 -2
- package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +1 -1
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts.map +1 -1
- package/dist/types/gen/models/index.d.ts +24 -26
- package/dist/types/gen/models/index.d.ts.map +1 -1
- package/dist/types/gen/moderation/ModerationApi.d.ts +2 -2
- package/dist/types/gen/moderation/ModerationApi.d.ts.map +1 -1
- package/dist/types/types-internal.d.ts +1 -1
- package/dist/types/types-internal.d.ts.map +1 -1
- package/dist/types/types.d.ts +4 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/event-triggered-by-connected-user.d.ts +2 -2
- package/dist/types/utils/event-triggered-by-connected-user.d.ts.map +1 -1
- package/dist/types/utils/state-update-queue.d.ts +2 -2
- package/dist/types/utils/state-update-queue.d.ts.map +1 -1
- package/dist/types/utils/type-assertions.d.ts +3 -4
- package/dist/types/utils/type-assertions.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.ts +52 -38
- package/src/bindings/react/hooks/feed-state-hooks/useOwnFollows.ts +1 -1
- package/src/bindings/react/hooks/util/useReactionActions.ts +2 -1
- package/src/bindings/react/wrappers/StreamFeed.tsx +1 -1
- package/src/bindings/react/wrappers/StreamFeeds.tsx +1 -1
- package/src/bindings/react/wrappers/StreamSearch.tsx +1 -1
- package/src/bindings/react/wrappers/StreamSearchResults.tsx +1 -1
- package/src/common/ApiClient.ts +6 -4
- package/src/common/EventDispatcher.ts +1 -1
- package/src/common/rate-limit.ts +1 -1
- package/src/common/real-time/StableWSConnection.ts +3 -3
- package/src/common/real-time/event-models.ts +1 -1
- package/src/common/search/ActivitySearchSource.ts +2 -2
- package/src/common/search/FeedSearchSource.ts +2 -2
- package/src/common/search/UserSearchSource.ts +2 -2
- package/src/feed/event-handlers/activity/activity-marked-utils.test.ts +1 -1
- package/src/feed/event-handlers/activity/activity-reaction-utils.test.ts +1 -1
- package/src/feed/event-handlers/activity/activity-utils.test.ts +1 -1
- package/src/feed/event-handlers/activity/handle-activity-added.ts +3 -3
- package/src/feed/event-handlers/activity/handle-activity-marked.ts +3 -3
- package/src/feed/event-handlers/activity/handle-activity-pinned.test.ts +1 -1
- package/src/feed/event-handlers/activity/handle-activity-pinned.ts +3 -3
- package/src/feed/event-handlers/activity/handle-activity-reaction-added.test.ts +1 -1
- package/src/feed/event-handlers/activity/handle-activity-reaction-deleted.test.ts +1 -1
- package/src/feed/event-handlers/activity/handle-activity-reaction-deleted.ts +1 -1
- package/src/feed/event-handlers/activity/handle-activity-removed-from-feed.ts +2 -2
- package/src/feed/event-handlers/activity/handle-activity-unpinned.test.ts +2 -2
- package/src/feed/event-handlers/activity/handle-activity-unpinned.ts +2 -2
- package/src/feed/event-handlers/activity/handle-activity-updated.test.ts +2 -2
- package/src/feed/event-handlers/activity/handle-activity-updated.ts +3 -3
- package/src/feed/event-handlers/bookmark/bookmark-utils.test.ts +1 -1
- package/src/feed/event-handlers/comment/handle-comment-added.test.ts +2 -2
- package/src/feed/event-handlers/comment/handle-comment-deleted.test.ts +2 -2
- package/src/feed/event-handlers/comment/handle-comment-deleted.ts +3 -2
- package/src/feed/event-handlers/comment/handle-comment-reaction-added.test.ts +2 -2
- package/src/feed/event-handlers/comment/handle-comment-reaction-added.ts +3 -2
- package/src/feed/event-handlers/comment/handle-comment-reaction-deleted.test.ts +2 -2
- package/src/feed/event-handlers/comment/handle-comment-reaction-deleted.ts +3 -2
- package/src/feed/event-handlers/comment/handle-comment-updated.test.ts +2 -2
- package/src/feed/event-handlers/comment/handle-comment-updated.ts +3 -2
- package/src/feed/event-handlers/comment/utils/update-comment-count.test.ts +3 -1
- package/src/feed/event-handlers/comment/utils/update-comment-count.ts +2 -2
- package/src/feed/event-handlers/feed/handle-feed-updated.ts +2 -2
- package/src/feed/event-handlers/feed-member/handle-feed-member-added.ts +2 -2
- package/src/feed/event-handlers/feed-member/handle-feed-member-removed.ts +2 -2
- package/src/feed/event-handlers/feed-member/handle-feed-member-updated.ts +2 -2
- package/src/feed/event-handlers/follow/handle-follow-created.test.ts +1 -1
- package/src/feed/event-handlers/follow/handle-follow-deleted.test.ts +1 -1
- package/src/feed/event-handlers/follow/handle-follow-updated.test.ts +1 -1
- package/src/feed/event-handlers/follow/handle-follow-updated.ts +1 -1
- package/src/feed/event-handlers/notification-feed/handle-notification-feed-updated.test.ts +1 -1
- package/src/feed/event-handlers/notification-feed/handle-notification-feed-updated.ts +1 -1
- package/src/feed/event-handlers/watch/handle-watch-started.ts +1 -1
- package/src/feed/event-handlers/watch/handle-watch-stopped.ts +1 -1
- package/src/feed/feed.test.ts +1 -1
- package/src/feed/feed.ts +3 -3
- package/src/feeds-client/event-handlers/user/handle-user-updated.test.ts +1 -1
- package/src/feeds-client/feeds-client.ts +5 -4
- package/src/gen/feeds/FeedApi.ts +2 -2
- package/src/gen/feeds/FeedsApi.ts +2 -2
- package/src/gen/model-decoders/decoders.ts +2 -4
- package/src/gen/model-decoders/event-decoder-mapping.ts +1 -1
- package/src/gen/models/index.ts +34 -33
- package/src/gen/moderation/ModerationApi.ts +2 -2
- package/src/test-utils/response-generators.ts +2 -2
- package/src/types-internal.ts +1 -1
- package/src/types.ts +4 -4
- package/src/utils/event-triggered-by-connected-user.ts +2 -2
- package/src/utils/state-update-queue.ts +2 -2
- package/src/utils/type-assertions.ts +7 -11
- package/dist/index-CFv0uza2.js.map +0 -1
- package/dist/index-DP0C8psw.mjs.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { AddCommentReactionResponse, AddReactionResponse, CommentResponse, DeleteCommentReactionResponse, FollowResponse } from '../gen/models';
|
|
2
|
-
import { StreamFile } from '../types';
|
|
3
|
-
import { DeleteReactionResponse } from '@stream-io/node-sdk';
|
|
1
|
+
import type { AddCommentReactionResponse, AddReactionResponse, DeleteActivityReactionResponse, CommentResponse, DeleteCommentReactionResponse, FollowResponse } from '../gen/models';
|
|
2
|
+
import type { StreamFile } from '../types';
|
|
4
3
|
export declare const isFollowResponse: (data: object) => data is FollowResponse;
|
|
5
|
-
export declare const isReactionResponse: (data: object) => data is
|
|
4
|
+
export declare const isReactionResponse: (data: object) => data is AddReactionResponse | AddCommentReactionResponse | DeleteActivityReactionResponse | DeleteCommentReactionResponse;
|
|
6
5
|
export declare const isCommentResponse: (entity: object) => entity is CommentResponse;
|
|
7
6
|
export declare const isImageFile: (file: StreamFile) => boolean;
|
|
8
7
|
export declare const isVideoFile: (file: StreamFile) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-assertions.d.ts","sourceRoot":"","sources":["../../../src/utils/type-assertions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"type-assertions.d.ts","sourceRoot":"","sources":["../../../src/utils/type-assertions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,8BAA8B,EAC9B,eAAe,EACf,6BAA6B,EAC7B,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,cAEvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,KACX,IAAI,IACH,mBAAmB,GACnB,0BAA0B,GAC1B,8BAA8B,GAC9B,6BAEH,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,KACb,MAAM,IAAI,eAEZ,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,UAAU,YAG3C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,UAAU,YAE3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -20,51 +20,65 @@ export const useOwnCapabilities = (feedFromProps?: Feed) => {
|
|
|
20
20
|
const { oc = stableEmptyArray } = useStateStore(feed?.state, selector) ?? {};
|
|
21
21
|
|
|
22
22
|
return useMemo(
|
|
23
|
-
() =>
|
|
24
|
-
(
|
|
25
|
-
|
|
23
|
+
() => {
|
|
24
|
+
const capabilitiesSet = new Set(oc);
|
|
25
|
+
return ({
|
|
26
|
+
can_add_activity: capabilitiesSet.has(FeedOwnCapability.ADD_ACTIVITY),
|
|
27
|
+
can_add_activity_bookmark:
|
|
28
|
+
capabilitiesSet.has(FeedOwnCapability.ADD_ACTIVITY_BOOKMARK),
|
|
26
29
|
can_add_activity_reaction:
|
|
27
|
-
|
|
28
|
-
can_add_comment:
|
|
30
|
+
capabilitiesSet.has(FeedOwnCapability.ADD_ACTIVITY_REACTION),
|
|
31
|
+
can_add_comment: capabilitiesSet.has(FeedOwnCapability.ADD_COMMENT),
|
|
29
32
|
can_add_comment_reaction:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
can_delete_feed:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
can_manage_feed_group:
|
|
50
|
-
oc.indexOf(FeedOwnCapability.MANAGE_FEED_GROUP) > -1,
|
|
51
|
-
can_mark_activity: oc.indexOf(FeedOwnCapability.MARK_ACTIVITY) > -1,
|
|
52
|
-
can_pin_activity: oc.indexOf(FeedOwnCapability.PIN_ACTIVITY) > -1,
|
|
33
|
+
capabilitiesSet.has(FeedOwnCapability.ADD_COMMENT_REACTION),
|
|
34
|
+
can_create_feed: capabilitiesSet.has(FeedOwnCapability.CREATE_FEED),
|
|
35
|
+
can_delete_any_activity:
|
|
36
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_ANY_ACTIVITY),
|
|
37
|
+
can_delete_any_comment:
|
|
38
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_ANY_COMMENT),
|
|
39
|
+
can_delete_feed: capabilitiesSet.has(FeedOwnCapability.DELETE_FEED),
|
|
40
|
+
can_delete_own_activity:
|
|
41
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_OWN_ACTIVITY),
|
|
42
|
+
can_delete_own_activity_bookmark:
|
|
43
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_OWN_ACTIVITY_BOOKMARK),
|
|
44
|
+
can_delete_own_activity_reaction:
|
|
45
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_OWN_ACTIVITY_REACTION),
|
|
46
|
+
can_delete_own_comment:
|
|
47
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_OWN_COMMENT),
|
|
48
|
+
can_delete_own_comment_reaction:
|
|
49
|
+
capabilitiesSet.has(FeedOwnCapability.DELETE_OWN_COMMENT_REACTION),
|
|
50
|
+
can_follow: capabilitiesSet.has(FeedOwnCapability.FOLLOW),
|
|
51
|
+
can_pin_activity: capabilitiesSet.has(FeedOwnCapability.PIN_ACTIVITY),
|
|
53
52
|
can_query_feed_members:
|
|
54
|
-
|
|
55
|
-
can_query_follows:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
capabilitiesSet.has(FeedOwnCapability.QUERY_FEED_MEMBERS),
|
|
54
|
+
can_query_follows:
|
|
55
|
+
capabilitiesSet.has(FeedOwnCapability.QUERY_FOLLOWS),
|
|
56
|
+
can_read_activities:
|
|
57
|
+
capabilitiesSet.has(FeedOwnCapability.READ_ACTIVITIES),
|
|
58
|
+
can_read_feed: capabilitiesSet.has(FeedOwnCapability.READ_FEED),
|
|
59
|
+
can_unfollow: capabilitiesSet.has(FeedOwnCapability.UNFOLLOW),
|
|
60
|
+
can_update_any_activity:
|
|
61
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_ANY_ACTIVITY),
|
|
62
|
+
can_update_any_comment:
|
|
63
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_ANY_COMMENT),
|
|
64
|
+
can_update_feed: capabilitiesSet.has(FeedOwnCapability.UPDATE_FEED),
|
|
60
65
|
can_update_feed_followers:
|
|
61
|
-
|
|
66
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_FEED_FOLLOWERS),
|
|
62
67
|
can_update_feed_members:
|
|
63
|
-
|
|
68
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_FEED_MEMBERS),
|
|
69
|
+
can_update_own_activity:
|
|
70
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_OWN_ACTIVITY),
|
|
71
|
+
can_update_own_activity_bookmark:
|
|
72
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_OWN_ACTIVITY_BOOKMARK),
|
|
73
|
+
can_update_own_comment:
|
|
74
|
+
capabilitiesSet.has(FeedOwnCapability.UPDATE_OWN_COMMENT),
|
|
64
75
|
}) satisfies Record<
|
|
65
|
-
`can_${KebabToSnakeCase<
|
|
76
|
+
`can_${KebabToSnakeCase<
|
|
77
|
+
(typeof FeedOwnCapability)[keyof typeof FeedOwnCapability]
|
|
78
|
+
>}`,
|
|
66
79
|
boolean
|
|
67
|
-
|
|
80
|
+
>;
|
|
81
|
+
},
|
|
68
82
|
[oc],
|
|
69
83
|
);
|
|
70
84
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { CommentParent } from '@self';
|
|
3
|
+
import { isCommentResponse } from '@self';
|
|
3
4
|
import { useStableCallback } from '../internal';
|
|
4
5
|
import { useFeedsClient } from '../../contexts/StreamFeedsContext';
|
|
5
6
|
|
package/src/common/ApiClient.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type {
|
|
2
2
|
AxiosError,
|
|
3
3
|
AxiosInstance,
|
|
4
4
|
AxiosResponse,
|
|
5
5
|
RawAxiosRequestHeaders,
|
|
6
6
|
} from 'axios';
|
|
7
|
-
import
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import type { RequestMetadata, FeedsClientOptions } from './types';
|
|
9
|
+
import { StreamApiError } from './types';
|
|
8
10
|
import { getRateLimitFromResponseHeader } from './rate-limit';
|
|
9
11
|
import { KnownCodes, randomId } from './utils';
|
|
10
|
-
import { TokenManager } from './TokenManager';
|
|
11
|
-
import { ConnectionIdManager } from './ConnectionIdManager';
|
|
12
|
+
import type { TokenManager } from './TokenManager';
|
|
13
|
+
import type { ConnectionIdManager } from './ConnectionIdManager';
|
|
12
14
|
import { getLogger } from '../utils/logger';
|
|
13
15
|
// this gets replaced during the build process (var version = 'x.y.z';)
|
|
14
16
|
import { version } from '../../package.json';
|
package/src/common/rate-limit.ts
CHANGED
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
sleep,
|
|
8
8
|
} from '../utils';
|
|
9
9
|
import type { UserRequest } from '../../gen/models';
|
|
10
|
-
import { TokenManager } from '../TokenManager';
|
|
10
|
+
import type { TokenManager } from '../TokenManager';
|
|
11
11
|
import { EventDispatcher } from '../EventDispatcher';
|
|
12
|
-
import { ConnectionIdManager } from '../ConnectionIdManager';
|
|
13
|
-
import { ConnectedEvent } from './event-models';
|
|
12
|
+
import type { ConnectionIdManager } from '../ConnectionIdManager';
|
|
13
|
+
import type { ConnectedEvent } from './event-models';
|
|
14
14
|
import { getLogger } from '../../utils/logger';
|
|
15
15
|
|
|
16
16
|
// Type guards to check WebSocket error type
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseSearchSource } from './BaseSearchSource';
|
|
2
2
|
import type { SearchSourceOptions } from './types';
|
|
3
3
|
|
|
4
|
-
import { FeedsClient } from '../../feeds-client';
|
|
5
|
-
import { ActivityResponse } from '../../gen/models';
|
|
4
|
+
import type { FeedsClient } from '../../feeds-client';
|
|
5
|
+
import type { ActivityResponse } from '../../gen/models';
|
|
6
6
|
|
|
7
7
|
export class ActivitySearchSource extends BaseSearchSource<ActivityResponse> {
|
|
8
8
|
readonly type = 'activity' as const;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseSearchSource } from './BaseSearchSource';
|
|
2
2
|
import type { SearchSourceOptions } from './types';
|
|
3
3
|
|
|
4
|
-
import { FeedsClient } from '../../feeds-client';
|
|
5
|
-
import { Feed } from '../../feed';
|
|
4
|
+
import type { FeedsClient } from '../../feeds-client';
|
|
5
|
+
import type { Feed } from '../../feed';
|
|
6
6
|
|
|
7
7
|
export type FeedSearchSourceOptions = SearchSourceOptions & {
|
|
8
8
|
groupId?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseSearchSource } from './BaseSearchSource';
|
|
2
2
|
import type { SearchSourceOptions } from './types';
|
|
3
3
|
|
|
4
|
-
import { FeedsClient } from '../../feeds-client';
|
|
5
|
-
import { UserResponse } from '../../gen/models';
|
|
4
|
+
import type { FeedsClient } from '../../feeds-client';
|
|
5
|
+
import type { UserResponse } from '../../gen/models';
|
|
6
6
|
|
|
7
7
|
export class UserSearchSource extends BaseSearchSource<UserResponse> {
|
|
8
8
|
readonly type = 'user' as const;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { ActivityResponse } from '../../../gen/models';
|
|
2
|
+
import type { ActivityResponse } from '../../../gen/models';
|
|
3
3
|
import { FeedsClient } from '../../../feeds-client';
|
|
4
4
|
import {
|
|
5
5
|
addActivitiesToState as addActivitiesToStateOriginal,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Feed } from '../../feed';
|
|
2
|
-
import { ActivityResponse } from '../../../gen/models';
|
|
3
|
-
import { EventPayload, UpdateStateResult } from '../../../types-internal';
|
|
1
|
+
import type { Feed } from '../../feed';
|
|
2
|
+
import type { ActivityResponse } from '../../../gen/models';
|
|
3
|
+
import type { EventPayload, UpdateStateResult } from '../../../types-internal';
|
|
4
4
|
|
|
5
5
|
export function addActivitiesToState(
|
|
6
6
|
this: Feed,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ActivityMarkEvent,
|
|
3
3
|
NotificationStatusResponse,
|
|
4
4
|
} from '../../../gen/models';
|
|
5
|
-
import { EventPayload, UpdateStateResult } from '../../../types-internal';
|
|
6
|
-
import { Feed } from '../../feed';
|
|
5
|
+
import type { EventPayload, UpdateStateResult } from '../../../types-internal';
|
|
6
|
+
import type { Feed } from '../../feed';
|
|
7
7
|
|
|
8
8
|
export const updateNotificationStatusFromActivityMarked = (
|
|
9
9
|
event: ActivityMarkEvent,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
generateActivityPinResponse,
|
|
9
9
|
generateFeedResponse,
|
|
10
10
|
} from '../../../test-utils/response-generators';
|
|
11
|
-
import { ActivityPinResponse } from '../../../gen/models';
|
|
11
|
+
import type { ActivityPinResponse } from '../../../gen/models';
|
|
12
12
|
|
|
13
13
|
describe(handleActivityPinned.name, () => {
|
|
14
14
|
let feed: Feed;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActivityPinResponse } from '../../../gen/models';
|
|
2
|
-
import { EventPayload } from '../../../types-internal';
|
|
3
|
-
import { Feed } from '../../feed';
|
|
1
|
+
import type { ActivityPinResponse } from '../../../gen/models';
|
|
2
|
+
import type { EventPayload } from '../../../types-internal';
|
|
3
|
+
import type { Feed } from '../../feed';
|
|
4
4
|
|
|
5
5
|
export function handleActivityPinned(
|
|
6
6
|
this: Feed,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getHumanId,
|
|
12
12
|
} from '../../../test-utils';
|
|
13
13
|
import { shouldUpdateState } from '../../../utils';
|
|
14
|
-
import { EventPayload } from '../../../types-internal';
|
|
14
|
+
import type { EventPayload } from '../../../types-internal';
|
|
15
15
|
|
|
16
16
|
describe(handleActivityReactionAdded.name, () => {
|
|
17
17
|
let feed: Feed;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
generateActivityReactionDeletedEvent,
|
|
14
14
|
} from '../../../test-utils';
|
|
15
15
|
import { shouldUpdateState } from '../../../utils';
|
|
16
|
-
import { EventPayload } from '../../../types-internal';
|
|
16
|
+
import type { EventPayload } from '../../../types-internal';
|
|
17
17
|
|
|
18
18
|
describe(handleActivityReactionDeleted.name, () => {
|
|
19
19
|
let feed: Feed;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Feed } from '../../feed';
|
|
2
|
-
import { ActivityPinResponse, ActivityResponse } from '../../../gen/models';
|
|
2
|
+
import type { ActivityPinResponse, ActivityResponse } from '../../../gen/models';
|
|
3
3
|
import type { EventPayload, PartializeAllBut } from '../../../types-internal';
|
|
4
4
|
import {
|
|
5
5
|
getStateUpdateQueueId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Feed } from '../../../feed';
|
|
2
|
-
import { EventPayload } from '../../../types-internal';
|
|
1
|
+
import type { Feed } from '../../../feed';
|
|
2
|
+
import type { EventPayload } from '../../../types-internal';
|
|
3
3
|
import { removeActivityFromState } from './handle-activity-deleted';
|
|
4
4
|
|
|
5
5
|
export function handleActivityRemovedFromFeed(
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
generateActivityPinResponse,
|
|
8
8
|
generateFeedResponse,
|
|
9
9
|
} from '../../../test-utils/response-generators';
|
|
10
|
-
import { ActivityPinResponse } from '../../../gen/models';
|
|
11
|
-
import { EventPayload } from '../../../types-internal';
|
|
10
|
+
import type { ActivityPinResponse } from '../../../gen/models';
|
|
11
|
+
import type { EventPayload } from '../../../types-internal';
|
|
12
12
|
|
|
13
13
|
// Helper to construct the event payload for 'feeds.activity.unpinned'
|
|
14
14
|
function makeUnpinnedEvent(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventPayload } from '../../../types-internal';
|
|
2
|
-
import { Feed, FeedState } from '../../feed';
|
|
1
|
+
import type { EventPayload } from '../../../types-internal';
|
|
2
|
+
import type { Feed, FeedState } from '../../feed';
|
|
3
3
|
|
|
4
4
|
export function handleActivityUnpinned(
|
|
5
5
|
this: Feed,
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
generateUserResponseCommonFields,
|
|
14
14
|
getHumanId,
|
|
15
15
|
} from '../../../test-utils';
|
|
16
|
-
import { EventPayload } from '../../../types-internal';
|
|
16
|
+
import type { EventPayload } from '../../../types-internal';
|
|
17
17
|
import { shouldUpdateState } from '../../../utils';
|
|
18
|
-
import { ActivityResponse } from '../../../gen/models';
|
|
18
|
+
import type { ActivityResponse } from '../../../gen/models';
|
|
19
19
|
|
|
20
20
|
describe(handleActivityUpdated.name, () => {
|
|
21
21
|
let feed: Feed;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Feed } from '../../../feed';
|
|
2
|
-
import { ActivityPinResponse, ActivityResponse } from '../../../gen/models';
|
|
3
|
-
import { EventPayload, PartializeAllBut } from '../../../types-internal';
|
|
1
|
+
import type { Feed } from '../../../feed';
|
|
2
|
+
import type { ActivityPinResponse, ActivityResponse } from '../../../gen/models';
|
|
3
|
+
import type { EventPayload, PartializeAllBut } from '../../../types-internal';
|
|
4
4
|
import {
|
|
5
5
|
getStateUpdateQueueId,
|
|
6
6
|
shouldUpdateState,
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
generateCommentResponse,
|
|
11
11
|
generateUserResponseCommonFields,
|
|
12
12
|
} from '../../../test-utils';
|
|
13
|
-
import { CommentResponse, UserResponseCommonFields } from '../../../gen/models';
|
|
14
|
-
import { EventPayload } from '../../../types-internal';
|
|
13
|
+
import type { CommentResponse, UserResponseCommonFields } from '../../../gen/models';
|
|
14
|
+
import type { EventPayload } from '../../../types-internal';
|
|
15
15
|
import { shouldUpdateState } from '../../../utils';
|
|
16
16
|
|
|
17
17
|
describe(handleCommentAdded.name, () => {
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
generateOwnUser, generateUserResponseCommonFields,
|
|
10
10
|
getHumanId,
|
|
11
11
|
} from '../../../test-utils';
|
|
12
|
-
import { CommentResponse, UserResponseCommonFields } from '../../../gen/models';
|
|
12
|
+
import type { CommentResponse, UserResponseCommonFields } from '../../../gen/models';
|
|
13
13
|
import { shouldUpdateState } from '../../../utils';
|
|
14
|
-
import { EventPayload } from '../../../types-internal';
|
|
14
|
+
import type { EventPayload } from '../../../types-internal';
|
|
15
15
|
|
|
16
16
|
describe(handleCommentDeleted.name, () => {
|
|
17
17
|
let feed: Feed;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Feed } from '../../feed';
|
|
2
|
-
import { EventPayload
|
|
1
|
+
import type { Feed } from '../../feed';
|
|
2
|
+
import type { EventPayload} from '../../../types-internal';
|
|
3
|
+
import { type PartializeAllBut } from '../../../types-internal';
|
|
3
4
|
import { getStateUpdateQueueId, shouldUpdateState } from '../../../utils';
|
|
4
5
|
import {
|
|
5
6
|
eventTriggeredByConnectedUser
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
generateCommentReactionAddedEvent,
|
|
11
11
|
generateFeedReactionResponse,
|
|
12
12
|
} from '../../../test-utils';
|
|
13
|
-
import {
|
|
13
|
+
import type {
|
|
14
14
|
CommentResponse,
|
|
15
15
|
FeedsReactionResponse,
|
|
16
16
|
} from '../../../gen/models';
|
|
17
17
|
import { shouldUpdateState } from '../../../utils'
|
|
18
|
-
import { EventPayload } from '../../../types-internal';
|
|
18
|
+
import type { EventPayload } from '../../../types-internal';
|
|
19
19
|
|
|
20
20
|
describe(handleCommentReactionAdded.name, () => {
|
|
21
21
|
let feed: Feed;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Feed } from '../../feed';
|
|
2
|
-
import { EventPayload
|
|
1
|
+
import type { Feed } from '../../feed';
|
|
2
|
+
import type { EventPayload} from '../../../types-internal';
|
|
3
|
+
import { type PartializeAllBut } from '../../../types-internal';
|
|
3
4
|
import { getStateUpdateQueueId, shouldUpdateState } from '../../../utils';
|
|
4
5
|
|
|
5
6
|
export type CommentReactionAddedPayload = PartializeAllBut<
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
generateCommentReactionDeletedEvent,
|
|
12
12
|
} from '../../../test-utils';
|
|
13
13
|
import { shouldUpdateState } from '../../../utils';
|
|
14
|
-
import { CommentResponse, FeedsReactionResponse } from '../../../gen/models';
|
|
15
|
-
import { EventPayload } from '../../../types-internal';
|
|
14
|
+
import type { CommentResponse, FeedsReactionResponse } from '../../../gen/models';
|
|
15
|
+
import type { EventPayload } from '../../../types-internal';
|
|
16
16
|
|
|
17
17
|
describe(handleCommentReactionDeleted.name, () => {
|
|
18
18
|
let feed: Feed;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Feed } from '../../feed';
|
|
2
|
-
import { EventPayload
|
|
1
|
+
import type { Feed } from '../../feed';
|
|
2
|
+
import type { EventPayload} from '../../../types-internal';
|
|
3
|
+
import { type PartializeAllBut } from '../../../types-internal';
|
|
3
4
|
import { getStateUpdateQueueId, shouldUpdateState } from '../../../utils';
|
|
4
5
|
|
|
5
6
|
export type CommentReactionDeletedPayload = PartializeAllBut<
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
generateUserResponseCommonFields,
|
|
11
11
|
getHumanId,
|
|
12
12
|
} from '../../../test-utils';
|
|
13
|
-
import { CommentResponse, UserResponseCommonFields } from '../../../gen/models';
|
|
13
|
+
import type { CommentResponse, UserResponseCommonFields } from '../../../gen/models';
|
|
14
14
|
import { shouldUpdateState } from '../../../utils';
|
|
15
|
-
import { EventPayload } from '../../../types-internal';
|
|
15
|
+
import type { EventPayload } from '../../../types-internal';
|
|
16
16
|
|
|
17
17
|
describe(handleCommentUpdated.name, () => {
|
|
18
18
|
let feed: Feed;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Feed } from '../../feed';
|
|
2
|
-
import { EventPayload
|
|
1
|
+
import type { Feed } from '../../feed';
|
|
2
|
+
import type { EventPayload} from '../../../types-internal';
|
|
3
|
+
import { type PartializeAllBut } from '../../../types-internal';
|
|
3
4
|
import { getStateUpdateQueueId, shouldUpdateState } from '../../../utils';
|
|
4
5
|
import {
|
|
5
6
|
eventTriggeredByConnectedUser
|
|
@@ -5,7 +5,7 @@ import * as commentHandlers from '../handle-comment-updated';
|
|
|
5
5
|
import * as activityHandlers from '../../activity';
|
|
6
6
|
import { FeedsClient } from '../../../../feeds-client';
|
|
7
7
|
import { Feed } from '../../../feed';
|
|
8
|
-
import { ActivityResponse, CommentResponse } from '../../../../gen/models';
|
|
8
|
+
import type { ActivityResponse, CommentResponse } from '../../../../gen/models';
|
|
9
9
|
import {
|
|
10
10
|
generateCommentResponse,
|
|
11
11
|
generateFeedResponse,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '../../../../test-utils';
|
|
15
15
|
|
|
16
16
|
vi.mock('../../activity', async (importOriginal) => {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
17
18
|
const actual = await importOriginal<typeof import('../../activity')>();
|
|
18
19
|
return {
|
|
19
20
|
...actual,
|
|
@@ -22,6 +23,7 @@ vi.mock('../../activity', async (importOriginal) => {
|
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
vi.mock('../handle-comment-updated', async (importOriginal) => {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
25
27
|
const actual = await importOriginal<typeof import('../handle-comment-updated')>();
|
|
26
28
|
return {
|
|
27
29
|
...actual,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActivityResponse, Feed } from '@self';
|
|
2
|
-
import { CommentResponse } from '@self';
|
|
1
|
+
import type { ActivityResponse, Feed } from '@self';
|
|
2
|
+
import type { CommentResponse } from '@self';
|
|
3
3
|
import { handleCommentUpdated } from '../handle-comment-updated';
|
|
4
4
|
import { handleActivityUpdated } from '../../activity';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Feed } from '../../../feed';
|
|
2
|
-
import { EventPayload, PartializeAllBut } from '../../../types-internal';
|
|
1
|
+
import type { Feed } from '../../../feed';
|
|
2
|
+
import type { EventPayload, PartializeAllBut } from '../../../types-internal';
|
|
3
3
|
|
|
4
4
|
export function handleFeedUpdated(
|
|
5
5
|
this: Feed,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Feed, FeedState } from '../../../feed';
|
|
2
|
-
import { EventPayload } from '../../../types-internal';
|
|
1
|
+
import type { Feed, FeedState } from '../../../feed';
|
|
2
|
+
import type { EventPayload } from '../../../types-internal';
|
|
3
3
|
|
|
4
4
|
export function handleFeedMemberAdded(
|
|
5
5
|
this: Feed,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Feed, FeedState } from '../../../feed';
|
|
2
|
-
import { EventPayload } from '../../../types-internal';
|
|
1
|
+
import type { Feed, FeedState } from '../../../feed';
|
|
2
|
+
import type { EventPayload } from '../../../types-internal';
|
|
3
3
|
|
|
4
4
|
export function handleFeedMemberRemoved(
|
|
5
5
|
this: Feed,
|