@stream-io/feeds-client 0.2.10 → 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.
Files changed (181) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/react-bindings.js +35 -33
  5. package/dist/cjs/react-bindings.js.map +1 -1
  6. package/dist/es/index.mjs +2 -2
  7. package/dist/es/index.mjs.map +1 -1
  8. package/dist/es/react-bindings.mjs +35 -33
  9. package/dist/es/react-bindings.mjs.map +1 -1
  10. package/dist/{index-EeFSq3sq.mjs → index-D7QtnkUs.mjs} +19 -21
  11. package/dist/index-D7QtnkUs.mjs.map +1 -0
  12. package/dist/{index-C49kZoN7.js → index-o7AeSkxa.js} +19 -21
  13. package/dist/index-o7AeSkxa.js.map +1 -0
  14. package/dist/tsconfig.tsbuildinfo +1 -1
  15. package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.d.ts +15 -16
  16. package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.d.ts.map +1 -1
  17. package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnFollows.d.ts +1 -1
  18. package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnFollows.d.ts.map +1 -1
  19. package/dist/types/bindings/react/hooks/util/useReactionActions.d.ts +1 -1
  20. package/dist/types/bindings/react/hooks/util/useReactionActions.d.ts.map +1 -1
  21. package/dist/types/bindings/react/wrappers/StreamFeed.d.ts +1 -1
  22. package/dist/types/bindings/react/wrappers/StreamFeed.d.ts.map +1 -1
  23. package/dist/types/bindings/react/wrappers/StreamFeeds.d.ts +1 -1
  24. package/dist/types/bindings/react/wrappers/StreamFeeds.d.ts.map +1 -1
  25. package/dist/types/bindings/react/wrappers/StreamSearch.d.ts +1 -1
  26. package/dist/types/bindings/react/wrappers/StreamSearch.d.ts.map +1 -1
  27. package/dist/types/bindings/react/wrappers/StreamSearchResults.d.ts +1 -1
  28. package/dist/types/bindings/react/wrappers/StreamSearchResults.d.ts.map +1 -1
  29. package/dist/types/common/ApiClient.d.ts +3 -3
  30. package/dist/types/common/ApiClient.d.ts.map +1 -1
  31. package/dist/types/common/EventDispatcher.d.ts +1 -1
  32. package/dist/types/common/EventDispatcher.d.ts.map +1 -1
  33. package/dist/types/common/rate-limit.d.ts +1 -1
  34. package/dist/types/common/rate-limit.d.ts.map +1 -1
  35. package/dist/types/common/real-time/StableWSConnection.d.ts +3 -3
  36. package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -1
  37. package/dist/types/common/real-time/event-models.d.ts +1 -1
  38. package/dist/types/common/real-time/event-models.d.ts.map +1 -1
  39. package/dist/types/common/search/ActivitySearchSource.d.ts +2 -2
  40. package/dist/types/common/search/ActivitySearchSource.d.ts.map +1 -1
  41. package/dist/types/common/search/FeedSearchSource.d.ts +2 -2
  42. package/dist/types/common/search/FeedSearchSource.d.ts.map +1 -1
  43. package/dist/types/common/search/UserSearchSource.d.ts +2 -2
  44. package/dist/types/common/search/UserSearchSource.d.ts.map +1 -1
  45. package/dist/types/feed/event-handlers/activity/handle-activity-added.d.ts +3 -3
  46. package/dist/types/feed/event-handlers/activity/handle-activity-added.d.ts.map +1 -1
  47. package/dist/types/feed/event-handlers/activity/handle-activity-marked.d.ts +3 -3
  48. package/dist/types/feed/event-handlers/activity/handle-activity-marked.d.ts.map +1 -1
  49. package/dist/types/feed/event-handlers/activity/handle-activity-pinned.d.ts +2 -2
  50. package/dist/types/feed/event-handlers/activity/handle-activity-pinned.d.ts.map +1 -1
  51. package/dist/types/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts +1 -1
  52. package/dist/types/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts.map +1 -1
  53. package/dist/types/feed/event-handlers/activity/handle-activity-removed-from-feed.d.ts +2 -2
  54. package/dist/types/feed/event-handlers/activity/handle-activity-removed-from-feed.d.ts.map +1 -1
  55. package/dist/types/feed/event-handlers/activity/handle-activity-unpinned.d.ts +2 -2
  56. package/dist/types/feed/event-handlers/activity/handle-activity-unpinned.d.ts.map +1 -1
  57. package/dist/types/feed/event-handlers/activity/handle-activity-updated.d.ts +3 -3
  58. package/dist/types/feed/event-handlers/activity/handle-activity-updated.d.ts.map +1 -1
  59. package/dist/types/feed/event-handlers/comment/handle-comment-deleted.d.ts +3 -2
  60. package/dist/types/feed/event-handlers/comment/handle-comment-deleted.d.ts.map +1 -1
  61. package/dist/types/feed/event-handlers/comment/handle-comment-reaction-added.d.ts +3 -2
  62. package/dist/types/feed/event-handlers/comment/handle-comment-reaction-added.d.ts.map +1 -1
  63. package/dist/types/feed/event-handlers/comment/handle-comment-reaction-deleted.d.ts +3 -2
  64. package/dist/types/feed/event-handlers/comment/handle-comment-reaction-deleted.d.ts.map +1 -1
  65. package/dist/types/feed/event-handlers/comment/handle-comment-updated.d.ts +3 -2
  66. package/dist/types/feed/event-handlers/comment/handle-comment-updated.d.ts.map +1 -1
  67. package/dist/types/feed/event-handlers/comment/utils/update-comment-count.d.ts +2 -2
  68. package/dist/types/feed/event-handlers/comment/utils/update-comment-count.d.ts.map +1 -1
  69. package/dist/types/feed/event-handlers/feed/handle-feed-updated.d.ts +2 -2
  70. package/dist/types/feed/event-handlers/feed/handle-feed-updated.d.ts.map +1 -1
  71. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-added.d.ts +2 -2
  72. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-added.d.ts.map +1 -1
  73. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-removed.d.ts +2 -2
  74. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-removed.d.ts.map +1 -1
  75. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-updated.d.ts +2 -2
  76. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-updated.d.ts.map +1 -1
  77. package/dist/types/feed/event-handlers/follow/handle-follow-updated.d.ts +1 -1
  78. package/dist/types/feed/event-handlers/follow/handle-follow-updated.d.ts.map +1 -1
  79. package/dist/types/feed/event-handlers/notification-feed/handle-notification-feed-updated.d.ts +1 -1
  80. package/dist/types/feed/event-handlers/notification-feed/handle-notification-feed-updated.d.ts.map +1 -1
  81. package/dist/types/feed/event-handlers/watch/handle-watch-started.d.ts +1 -1
  82. package/dist/types/feed/event-handlers/watch/handle-watch-started.d.ts.map +1 -1
  83. package/dist/types/feed/event-handlers/watch/handle-watch-stopped.d.ts +1 -1
  84. package/dist/types/feed/event-handlers/watch/handle-watch-stopped.d.ts.map +1 -1
  85. package/dist/types/feed/feed.d.ts +3 -3
  86. package/dist/types/feed/feed.d.ts.map +1 -1
  87. package/dist/types/feeds-client/feeds-client.d.ts +3 -3
  88. package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
  89. package/dist/types/gen/feeds/FeedApi.d.ts +2 -2
  90. package/dist/types/gen/feeds/FeedApi.d.ts.map +1 -1
  91. package/dist/types/gen/feeds/FeedsApi.d.ts +2 -2
  92. package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
  93. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +1 -1
  94. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts.map +1 -1
  95. package/dist/types/gen/models/index.d.ts +24 -26
  96. package/dist/types/gen/models/index.d.ts.map +1 -1
  97. package/dist/types/gen/moderation/ModerationApi.d.ts +2 -2
  98. package/dist/types/gen/moderation/ModerationApi.d.ts.map +1 -1
  99. package/dist/types/types-internal.d.ts +1 -1
  100. package/dist/types/types-internal.d.ts.map +1 -1
  101. package/dist/types/types.d.ts +4 -4
  102. package/dist/types/types.d.ts.map +1 -1
  103. package/dist/types/utils/event-triggered-by-connected-user.d.ts +2 -2
  104. package/dist/types/utils/event-triggered-by-connected-user.d.ts.map +1 -1
  105. package/dist/types/utils/state-update-queue.d.ts +2 -2
  106. package/dist/types/utils/state-update-queue.d.ts.map +1 -1
  107. package/dist/types/utils/type-assertions.d.ts +3 -4
  108. package/dist/types/utils/type-assertions.d.ts.map +1 -1
  109. package/package.json +1 -1
  110. package/src/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.ts +52 -38
  111. package/src/bindings/react/hooks/feed-state-hooks/useOwnFollows.ts +1 -1
  112. package/src/bindings/react/hooks/util/useReactionActions.ts +2 -1
  113. package/src/bindings/react/wrappers/StreamFeed.tsx +1 -1
  114. package/src/bindings/react/wrappers/StreamFeeds.tsx +1 -1
  115. package/src/bindings/react/wrappers/StreamSearch.tsx +1 -1
  116. package/src/bindings/react/wrappers/StreamSearchResults.tsx +1 -1
  117. package/src/common/ApiClient.ts +6 -4
  118. package/src/common/EventDispatcher.ts +1 -1
  119. package/src/common/rate-limit.ts +1 -1
  120. package/src/common/real-time/StableWSConnection.ts +3 -3
  121. package/src/common/real-time/event-models.ts +1 -1
  122. package/src/common/search/ActivitySearchSource.ts +2 -2
  123. package/src/common/search/FeedSearchSource.ts +2 -2
  124. package/src/common/search/UserSearchSource.ts +2 -2
  125. package/src/feed/event-handlers/activity/activity-marked-utils.test.ts +1 -1
  126. package/src/feed/event-handlers/activity/activity-reaction-utils.test.ts +1 -1
  127. package/src/feed/event-handlers/activity/activity-utils.test.ts +1 -1
  128. package/src/feed/event-handlers/activity/handle-activity-added.ts +3 -3
  129. package/src/feed/event-handlers/activity/handle-activity-marked.ts +3 -3
  130. package/src/feed/event-handlers/activity/handle-activity-pinned.test.ts +1 -1
  131. package/src/feed/event-handlers/activity/handle-activity-pinned.ts +3 -3
  132. package/src/feed/event-handlers/activity/handle-activity-reaction-added.test.ts +1 -1
  133. package/src/feed/event-handlers/activity/handle-activity-reaction-deleted.test.ts +1 -1
  134. package/src/feed/event-handlers/activity/handle-activity-reaction-deleted.ts +1 -1
  135. package/src/feed/event-handlers/activity/handle-activity-removed-from-feed.ts +2 -2
  136. package/src/feed/event-handlers/activity/handle-activity-unpinned.test.ts +2 -2
  137. package/src/feed/event-handlers/activity/handle-activity-unpinned.ts +2 -2
  138. package/src/feed/event-handlers/activity/handle-activity-updated.test.ts +2 -2
  139. package/src/feed/event-handlers/activity/handle-activity-updated.ts +3 -3
  140. package/src/feed/event-handlers/bookmark/bookmark-utils.test.ts +1 -1
  141. package/src/feed/event-handlers/comment/handle-comment-added.test.ts +2 -2
  142. package/src/feed/event-handlers/comment/handle-comment-deleted.test.ts +2 -2
  143. package/src/feed/event-handlers/comment/handle-comment-deleted.ts +3 -2
  144. package/src/feed/event-handlers/comment/handle-comment-reaction-added.test.ts +2 -2
  145. package/src/feed/event-handlers/comment/handle-comment-reaction-added.ts +3 -2
  146. package/src/feed/event-handlers/comment/handle-comment-reaction-deleted.test.ts +2 -2
  147. package/src/feed/event-handlers/comment/handle-comment-reaction-deleted.ts +3 -2
  148. package/src/feed/event-handlers/comment/handle-comment-updated.test.ts +2 -2
  149. package/src/feed/event-handlers/comment/handle-comment-updated.ts +3 -2
  150. package/src/feed/event-handlers/comment/utils/update-comment-count.test.ts +3 -1
  151. package/src/feed/event-handlers/comment/utils/update-comment-count.ts +2 -2
  152. package/src/feed/event-handlers/feed/handle-feed-updated.ts +2 -2
  153. package/src/feed/event-handlers/feed-member/handle-feed-member-added.ts +2 -2
  154. package/src/feed/event-handlers/feed-member/handle-feed-member-removed.ts +2 -2
  155. package/src/feed/event-handlers/feed-member/handle-feed-member-updated.ts +2 -2
  156. package/src/feed/event-handlers/follow/handle-follow-created.test.ts +1 -1
  157. package/src/feed/event-handlers/follow/handle-follow-deleted.test.ts +1 -1
  158. package/src/feed/event-handlers/follow/handle-follow-updated.test.ts +1 -1
  159. package/src/feed/event-handlers/follow/handle-follow-updated.ts +1 -1
  160. package/src/feed/event-handlers/notification-feed/handle-notification-feed-updated.test.ts +1 -1
  161. package/src/feed/event-handlers/notification-feed/handle-notification-feed-updated.ts +1 -1
  162. package/src/feed/event-handlers/watch/handle-watch-started.ts +1 -1
  163. package/src/feed/event-handlers/watch/handle-watch-stopped.ts +1 -1
  164. package/src/feed/feed.test.ts +1 -1
  165. package/src/feed/feed.ts +3 -3
  166. package/src/feeds-client/event-handlers/user/handle-user-updated.test.ts +1 -1
  167. package/src/feeds-client/feeds-client.ts +5 -4
  168. package/src/gen/feeds/FeedApi.ts +2 -2
  169. package/src/gen/feeds/FeedsApi.ts +2 -2
  170. package/src/gen/model-decoders/decoders.ts +2 -4
  171. package/src/gen/model-decoders/event-decoder-mapping.ts +1 -1
  172. package/src/gen/models/index.ts +34 -33
  173. package/src/gen/moderation/ModerationApi.ts +2 -2
  174. package/src/test-utils/response-generators.ts +2 -2
  175. package/src/types-internal.ts +1 -1
  176. package/src/types.ts +4 -4
  177. package/src/utils/event-triggered-by-connected-user.ts +2 -2
  178. package/src/utils/state-update-queue.ts +2 -2
  179. package/src/utils/type-assertions.ts +7 -11
  180. package/dist/index-C49kZoN7.js.map +0 -1
  181. package/dist/index-EeFSq3sq.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 (AddReactionResponse | AddCommentReactionResponse | DeleteReactionResponse | DeleteCommentReactionResponse);
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,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,eAAe,EACf,6BAA6B,EAC7B,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,cAEvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,KACX,IAAI,IAAI,CACP,mBAAmB,GACnB,0BAA0B,GAC1B,sBAAsB,GACtB,6BAA6B,CAMhC,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"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/feeds-client",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/es/index.mjs",
6
6
  "exports": {
@@ -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
- can_add_activity: oc.indexOf(FeedOwnCapability.ADD_ACTIVITY) > -1,
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
- oc.indexOf(FeedOwnCapability.ADD_ACTIVITY_REACTION) > -1,
28
- can_add_comment: oc.indexOf(FeedOwnCapability.ADD_COMMENT) > -1,
30
+ capabilitiesSet.has(FeedOwnCapability.ADD_ACTIVITY_REACTION),
31
+ can_add_comment: capabilitiesSet.has(FeedOwnCapability.ADD_COMMENT),
29
32
  can_add_comment_reaction:
30
- oc.indexOf(FeedOwnCapability.ADD_COMMENT_REACTION) > -1,
31
- can_bookmark_activity:
32
- oc.indexOf(FeedOwnCapability.BOOKMARK_ACTIVITY) > -1,
33
- can_create_feed: oc.indexOf(FeedOwnCapability.CREATE_FEED) > -1,
34
- can_delete_bookmark: oc.indexOf(FeedOwnCapability.DELETE_BOOKMARK) > -1,
35
- can_delete_comment: oc.indexOf(FeedOwnCapability.DELETE_COMMENT) > -1,
36
- can_delete_feed: oc.indexOf(FeedOwnCapability.DELETE_FEED) > -1,
37
- can_edit_bookmark: oc.indexOf(FeedOwnCapability.EDIT_BOOKMARK) > -1,
38
- can_follow: oc.indexOf(FeedOwnCapability.FOLLOW) > -1,
39
- can_remove_activity: oc.indexOf(FeedOwnCapability.REMOVE_ACTIVITY) > -1,
40
- can_remove_activity_reaction:
41
- oc.indexOf(FeedOwnCapability.REMOVE_ACTIVITY_REACTION) > -1,
42
- can_remove_comment_reaction:
43
- oc.indexOf(FeedOwnCapability.REMOVE_COMMENT_REACTION) > -1,
44
- can_unfollow: oc.indexOf(FeedOwnCapability.UNFOLLOW) > -1,
45
- can_update_feed: oc.indexOf(FeedOwnCapability.UPDATE_FEED) > -1,
46
- can_invite_feed: oc.indexOf(FeedOwnCapability.INVITE_FEED) > -1,
47
- can_join_feed: oc.indexOf(FeedOwnCapability.JOIN_FEED) > -1,
48
- can_leave_feed: oc.indexOf(FeedOwnCapability.LEAVE_FEED) > -1,
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
- oc.indexOf(FeedOwnCapability.QUERY_FEED_MEMBERS) > -1,
55
- can_query_follows: oc.indexOf(FeedOwnCapability.QUERY_FOLLOWS) > -1,
56
- can_read_activities: oc.indexOf(FeedOwnCapability.READ_ACTIVITIES) > -1,
57
- can_read_feed: oc.indexOf(FeedOwnCapability.READ_FEED) > -1,
58
- can_update_activity: oc.indexOf(FeedOwnCapability.UPDATE_ACTIVITY) > -1,
59
- can_update_comment: oc.indexOf(FeedOwnCapability.UPDATE_COMMENT) > -1,
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
- oc.indexOf(FeedOwnCapability.UPDATE_FEED_FOLLOWERS) > -1,
66
+ capabilitiesSet.has(FeedOwnCapability.UPDATE_FEED_FOLLOWERS),
62
67
  can_update_feed_members:
63
- oc.indexOf(FeedOwnCapability.UPDATE_FEED_MEMBERS) > -1,
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<(typeof FeedOwnCapability)[keyof typeof FeedOwnCapability]>}`,
76
+ `can_${KebabToSnakeCase<
77
+ (typeof FeedOwnCapability)[keyof typeof FeedOwnCapability]
78
+ >}`,
66
79
  boolean
67
- >,
80
+ >;
81
+ },
68
82
  [oc],
69
83
  );
70
84
  };
@@ -1,4 +1,4 @@
1
- import { Feed, FeedState } from '@self';
1
+ import type { Feed, FeedState } from '@self';
2
2
  import { useFeedContext } from '../../contexts/StreamFeedContext';
3
3
  import { useStateStore } from '@stream-io/state-store/react-bindings';
4
4
 
@@ -1,5 +1,6 @@
1
1
  import { useMemo } from 'react';
2
- import { isCommentResponse, CommentParent } from '@self';
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
 
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  import { StreamFeedContext } from '../contexts/StreamFeedContext';
3
3
  import type { Feed } from '@self';
4
4
 
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  import { StreamFeedsContext } from '../contexts/StreamFeedsContext';
3
3
  import type { StreamFeedsContextProps } from '../contexts/StreamFeedsContext';
4
4
 
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  import { StreamSearchContext } from '../contexts/StreamSearchContext';
3
3
  import type { SearchController } from '@self';
4
4
 
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  import { StreamSearchResultsContext } from '../contexts/StreamSearchResultsContext';
3
3
  import type { SearchSource } from '@self';
4
4
 
@@ -1,14 +1,16 @@
1
- import axios, {
1
+ import type {
2
2
  AxiosError,
3
3
  AxiosInstance,
4
4
  AxiosResponse,
5
5
  RawAxiosRequestHeaders,
6
6
  } from 'axios';
7
- import { RequestMetadata, StreamApiError, FeedsClientOptions } from './types';
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';
@@ -1,4 +1,4 @@
1
- import { FeedsEvent } from '../types';
1
+ import type { FeedsEvent } from '../types';
2
2
  import { getLogger } from '../utils/logger';
3
3
 
4
4
  export class EventDispatcher<
@@ -1,4 +1,4 @@
1
- import { RateLimit } from './types';
1
+ import type { RateLimit } from './types';
2
2
 
3
3
  export const getRateLimitFromResponseHeader = (
4
4
  response_headers: Record<string, string>,
@@ -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,4 +1,4 @@
1
- import { OwnUser } from '../../gen/models';
1
+ import type { OwnUser } from '../../gen/models';
2
2
 
3
3
  export interface ConnectionChangedEvent {
4
4
  type: 'connection.changed';
@@ -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 { describe, it, expect } from 'vitest';
2
- import {
2
+ import type {
3
3
  ActivityMarkEvent,
4
4
  NotificationStatusResponse,
5
5
  } from '../../../gen/models';
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import {
2
+ import type {
3
3
  ActivityReactionAddedEvent,
4
4
  ActivityReactionDeletedEvent,
5
5
  ActivityResponse,
@@ -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,
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import {
2
+ import type {
3
3
  BookmarkAddedEvent,
4
4
  BookmarkDeletedEvent,
5
5
  BookmarkUpdatedEvent,
@@ -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, type PartializeAllBut } from '../../../types-internal';
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, type PartializeAllBut } from '../../../types-internal';
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, type PartializeAllBut } from '../../../types-internal';
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, type PartializeAllBut } from '../../../types-internal';
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,