@amityco/ts-sdk 6.12.2-d74459e.0 → 6.12.2-e855934.0

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 (290) hide show
  1. package/README.md +8 -9
  2. package/dist/@types/core/marker.d.ts +4 -4
  3. package/dist/@types/core/marker.d.ts.map +1 -1
  4. package/dist/@types/core/model.d.ts +4 -4
  5. package/dist/@types/core/model.d.ts.map +1 -1
  6. package/dist/@types/core/payload.d.ts +17 -17
  7. package/dist/@types/core/payload.d.ts.map +1 -1
  8. package/dist/@types/domains/block.d.ts +1 -1
  9. package/dist/@types/domains/block.d.ts.map +1 -1
  10. package/dist/@types/domains/category.d.ts +5 -2
  11. package/dist/@types/domains/category.d.ts.map +1 -1
  12. package/dist/@types/domains/client.d.ts +3 -3
  13. package/dist/@types/domains/client.d.ts.map +1 -1
  14. package/dist/@types/domains/comment.d.ts +1 -1
  15. package/dist/@types/domains/comment.d.ts.map +1 -1
  16. package/dist/@types/domains/community.d.ts +4 -4
  17. package/dist/@types/domains/community.d.ts.map +1 -1
  18. package/dist/@types/domains/follow.d.ts +4 -4
  19. package/dist/@types/domains/follow.d.ts.map +1 -1
  20. package/dist/@types/domains/group.d.ts +2 -2
  21. package/dist/@types/domains/group.d.ts.map +1 -1
  22. package/dist/@types/domains/messagePreview.d.ts +2 -2
  23. package/dist/@types/domains/messagePreview.d.ts.map +1 -1
  24. package/dist/@types/domains/poll.d.ts +1 -1
  25. package/dist/@types/domains/poll.d.ts.map +1 -1
  26. package/dist/@types/domains/post.d.ts +1 -1
  27. package/dist/@types/domains/post.d.ts.map +1 -1
  28. package/dist/@types/domains/reaction.d.ts +1 -1
  29. package/dist/@types/domains/reaction.d.ts.map +1 -1
  30. package/dist/@types/domains/stream.d.ts +2 -2
  31. package/dist/@types/domains/stream.d.ts.map +1 -1
  32. package/dist/@types/domains/user.d.ts +7 -3
  33. package/dist/@types/domains/user.d.ts.map +1 -1
  34. package/dist/cache/api/pushToCache.d.ts +1 -1
  35. package/dist/cache/api/upsertInCache.d.ts +1 -1
  36. package/dist/categoryRepository/api/getCategory.d.ts.map +1 -1
  37. package/dist/categoryRepository/api/queryCategories.d.ts.map +1 -1
  38. package/dist/categoryRepository/observers/getCategories.d.ts.map +1 -1
  39. package/dist/channelRepsitory/channelMembership/api/addMembers.d.ts +4 -4
  40. package/dist/channelRepsitory/channelMembership/api/addMembers.d.ts.map +1 -1
  41. package/dist/channelRepsitory/channelMembership/api/removeMembers.d.ts +4 -4
  42. package/dist/channelRepsitory/channelMembership/api/removeMembers.d.ts.map +1 -1
  43. package/dist/channelRepsitory/channelModeration/api/addRole.d.ts +4 -4
  44. package/dist/channelRepsitory/channelModeration/api/addRole.d.ts.map +1 -1
  45. package/dist/channelRepsitory/channelModeration/api/banMembers.d.ts +2 -2
  46. package/dist/channelRepsitory/channelModeration/api/banMembers.d.ts.map +1 -1
  47. package/dist/channelRepsitory/channelModeration/api/removeRole.d.ts +4 -4
  48. package/dist/channelRepsitory/channelModeration/api/removeRole.d.ts.map +1 -1
  49. package/dist/channelRepsitory/channelModeration/api/unbanMembers.d.ts +2 -2
  50. package/dist/channelRepsitory/channelModeration/api/unbanMembers.d.ts.map +1 -1
  51. package/dist/channelRepsitory/events/onChannelMemberAdded.d.ts +1 -1
  52. package/dist/channelRepsitory/events/onChannelMemberBanned.d.ts +1 -1
  53. package/dist/channelRepsitory/events/onChannelMemberRemoved.d.ts +1 -1
  54. package/dist/channelRepsitory/events/onChannelMemberUnbanned.d.ts +1 -1
  55. package/dist/channelRepsitory/observers/tests/getChannel.test.d.ts +2 -0
  56. package/dist/channelRepsitory/observers/tests/getChannel.test.d.ts.map +1 -0
  57. package/dist/client/api/getToken.d.ts +3 -3
  58. package/dist/client/api/getToken.d.ts.map +1 -1
  59. package/dist/client/utils/setClientToken.d.ts +1 -1
  60. package/dist/communityRepository/communityMembership/api/addMembers.d.ts +4 -4
  61. package/dist/communityRepository/communityMembership/api/addMembers.d.ts.map +1 -1
  62. package/dist/communityRepository/communityMembership/api/removeMembers.d.ts +4 -4
  63. package/dist/communityRepository/communityMembership/api/removeMembers.d.ts.map +1 -1
  64. package/dist/communityRepository/communityModeration/api/addRoles.d.ts +4 -4
  65. package/dist/communityRepository/communityModeration/api/addRoles.d.ts.map +1 -1
  66. package/dist/communityRepository/communityModeration/api/banMembers.d.ts +2 -2
  67. package/dist/communityRepository/communityModeration/api/banMembers.d.ts.map +1 -1
  68. package/dist/communityRepository/communityModeration/api/removeRoles.d.ts +4 -4
  69. package/dist/communityRepository/communityModeration/api/removeRoles.d.ts.map +1 -1
  70. package/dist/communityRepository/communityModeration/api/unbanMembers.d.ts +2 -2
  71. package/dist/communityRepository/communityModeration/api/unbanMembers.d.ts.map +1 -1
  72. package/dist/core/device.d.ts +1 -1
  73. package/dist/core/device.d.ts.map +1 -1
  74. package/dist/core/query/filtering.d.ts +2 -2
  75. package/dist/core/query/filtering.d.ts.map +1 -1
  76. package/dist/external/api/createUserToken.d.ts +2 -2
  77. package/dist/external/api/createUserToken.d.ts.map +1 -1
  78. package/dist/group/utils/withUser.d.ts +3 -3
  79. package/dist/group/utils/withUser.d.ts.map +1 -1
  80. package/dist/index.cjs.js +206 -126
  81. package/dist/index.esm.js +206 -126
  82. package/dist/index.umd.js +4 -4
  83. package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +1 -1
  84. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  85. package/dist/messageRepository/api/getDeliveredUsers.d.ts +6 -6
  86. package/dist/messageRepository/api/getDeliveredUsers.d.ts.map +1 -1
  87. package/dist/messageRepository/api/getReadUsers.d.ts +6 -6
  88. package/dist/messageRepository/api/getReadUsers.d.ts.map +1 -1
  89. package/dist/streamRepository/api/getStreams.d.ts +1 -1
  90. package/dist/streamRepository/api/getStreams.d.ts.map +1 -1
  91. package/dist/streamRepository/api/queryStreams.d.ts +1 -1
  92. package/dist/streamRepository/api/queryStreams.d.ts.map +1 -1
  93. package/dist/userRepository/api/flagUser.d.ts +1 -1
  94. package/dist/userRepository/api/flagUser.d.ts.map +1 -1
  95. package/dist/userRepository/api/getUser.d.ts.map +1 -1
  96. package/dist/userRepository/api/getUserByIds.d.ts +1 -1
  97. package/dist/userRepository/api/getUserByIds.d.ts.map +1 -1
  98. package/dist/userRepository/api/isUserFlaggedByMe.d.ts +1 -1
  99. package/dist/userRepository/api/isUserFlaggedByMe.d.ts.map +1 -1
  100. package/dist/userRepository/api/queryBlockedUsers.d.ts +5 -5
  101. package/dist/userRepository/api/queryBlockedUsers.d.ts.map +1 -1
  102. package/dist/userRepository/api/queryUsers.d.ts +6 -6
  103. package/dist/userRepository/api/queryUsers.d.ts.map +1 -1
  104. package/dist/userRepository/api/unflagUser.d.ts +1 -1
  105. package/dist/userRepository/api/unflagUser.d.ts.map +1 -1
  106. package/dist/userRepository/api/updateUser.d.ts +4 -4
  107. package/dist/userRepository/api/updateUser.d.ts.map +1 -1
  108. package/dist/userRepository/events/onUserDeleted.d.ts +2 -2
  109. package/dist/userRepository/events/onUserDeleted.d.ts.map +1 -1
  110. package/dist/userRepository/events/onUserFetched.d.ts +2 -2
  111. package/dist/userRepository/events/onUserFetched.d.ts.map +1 -1
  112. package/dist/userRepository/events/onUserFlagCleared.d.ts +2 -2
  113. package/dist/userRepository/events/onUserFlagCleared.d.ts.map +1 -1
  114. package/dist/userRepository/events/onUserFlagged.d.ts +2 -2
  115. package/dist/userRepository/events/onUserFlagged.d.ts.map +1 -1
  116. package/dist/userRepository/events/onUserUnflagged.d.ts +2 -2
  117. package/dist/userRepository/events/onUserUnflagged.d.ts.map +1 -1
  118. package/dist/userRepository/events/onUserUpdated.d.ts +2 -2
  119. package/dist/userRepository/events/onUserUpdated.d.ts.map +1 -1
  120. package/dist/userRepository/events/utils.d.ts +1 -1
  121. package/dist/userRepository/events/utils.d.ts.map +1 -1
  122. package/dist/userRepository/observers/getBlockedUsers.d.ts +4 -4
  123. package/dist/userRepository/observers/getBlockedUsers.d.ts.map +1 -1
  124. package/dist/userRepository/observers/getUser.d.ts +2 -2
  125. package/dist/userRepository/observers/getUser.d.ts.map +1 -1
  126. package/dist/userRepository/observers/getUsers.d.ts.map +1 -1
  127. package/dist/userRepository/observers/observeUser.d.ts +2 -2
  128. package/dist/userRepository/observers/observeUser.d.ts.map +1 -1
  129. package/dist/userRepository/observers/searchUserByDisplayName.d.ts +2 -2
  130. package/dist/userRepository/observers/searchUserByDisplayName.d.ts.map +1 -1
  131. package/dist/userRepository/relationship/block/api/blockUser.d.ts +4 -4
  132. package/dist/userRepository/relationship/block/api/blockUser.d.ts.map +1 -1
  133. package/dist/userRepository/relationship/block/api/unBlockUser.d.ts +4 -4
  134. package/dist/userRepository/relationship/block/api/unBlockUser.d.ts.map +1 -1
  135. package/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts +1 -1
  136. package/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts.map +1 -1
  137. package/dist/userRepository/relationship/follow/api/acceptFollower.d.ts +2 -2
  138. package/dist/userRepository/relationship/follow/api/acceptFollower.d.ts.map +1 -1
  139. package/dist/userRepository/relationship/follow/api/acceptMyFollower.d.ts +2 -2
  140. package/dist/userRepository/relationship/follow/api/acceptMyFollower.d.ts.map +1 -1
  141. package/dist/userRepository/relationship/follow/api/declineFollower.d.ts +2 -2
  142. package/dist/userRepository/relationship/follow/api/declineFollower.d.ts.map +1 -1
  143. package/dist/userRepository/relationship/follow/api/declineMyFollower.d.ts +2 -2
  144. package/dist/userRepository/relationship/follow/api/declineMyFollower.d.ts.map +1 -1
  145. package/dist/userRepository/relationship/follow/api/follow.d.ts +2 -2
  146. package/dist/userRepository/relationship/follow/api/follow.d.ts.map +1 -1
  147. package/dist/userRepository/relationship/follow/api/getFollowInfo.d.ts +4 -4
  148. package/dist/userRepository/relationship/follow/api/getFollowInfo.d.ts.map +1 -1
  149. package/dist/userRepository/relationship/follow/api/unfollow.d.ts +3 -3
  150. package/dist/userRepository/relationship/follow/api/unfollow.d.ts.map +1 -1
  151. package/dist/userRepository/relationship/follow/api/utils.d.ts +1 -1
  152. package/dist/userRepository/relationship/follow/api/utils.d.ts.map +1 -1
  153. package/dist/userRepository/relationship/follow/observers/getFollowers.d.ts +1 -1
  154. package/dist/userRepository/relationship/follow/observers/getFollowings.d.ts +1 -1
  155. package/dist/userRepository/relationship/follow/observers/observeFollowInfo.d.ts +1 -1
  156. package/dist/userRepository/relationship/follow/observers/observeFollowInfo.d.ts.map +1 -1
  157. package/dist/userRepository/relationship/follow/observers/observeFollowers.d.ts +2 -2
  158. package/dist/userRepository/relationship/follow/observers/observeFollowers.d.ts.map +1 -1
  159. package/dist/userRepository/relationship/follow/observers/observeFollowings.d.ts +2 -2
  160. package/dist/userRepository/relationship/follow/observers/observeFollowings.d.ts.map +1 -1
  161. package/dist/utils/linkedObject/categoryLinkedObject.d.ts +2 -0
  162. package/dist/utils/linkedObject/categoryLinkedObject.d.ts.map +1 -0
  163. package/dist/utils/linkedObject/index.d.ts +2 -0
  164. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  165. package/dist/utils/linkedObject/userLinkedObject.d.ts +2 -0
  166. package/dist/utils/linkedObject/userLinkedObject.d.ts.map +1 -0
  167. package/dist/utils/tests/client.d.ts.map +1 -1
  168. package/dist/utils/tests/dummy/block.d.ts +4 -4
  169. package/dist/utils/tests/dummy/block.d.ts.map +1 -1
  170. package/dist/utils/tests/dummy/category.d.ts +7 -0
  171. package/dist/utils/tests/dummy/category.d.ts.map +1 -1
  172. package/dist/utils/tests/dummy/channel.d.ts +11 -1
  173. package/dist/utils/tests/dummy/channel.d.ts.map +1 -1
  174. package/dist/utils/tests/dummy/comment.d.ts +6 -6
  175. package/dist/utils/tests/dummy/follow.d.ts +1 -1
  176. package/dist/utils/tests/dummy/follow.d.ts.map +1 -1
  177. package/dist/utils/tests/dummy/user.d.ts +5 -1
  178. package/dist/utils/tests/dummy/user.d.ts.map +1 -1
  179. package/package.json +1 -1
  180. package/src/@types/core/marker.ts +4 -4
  181. package/src/@types/core/model.ts +4 -4
  182. package/src/@types/core/payload.ts +17 -17
  183. package/src/@types/domains/block.ts +1 -1
  184. package/src/@types/domains/category.ts +6 -2
  185. package/src/@types/domains/client.ts +3 -3
  186. package/src/@types/domains/comment.ts +1 -1
  187. package/src/@types/domains/community.ts +4 -4
  188. package/src/@types/domains/follow.ts +4 -4
  189. package/src/@types/domains/group.ts +2 -2
  190. package/src/@types/domains/messagePreview.ts +2 -2
  191. package/src/@types/domains/poll.ts +1 -1
  192. package/src/@types/domains/post.ts +1 -1
  193. package/src/@types/domains/reaction.ts +1 -1
  194. package/src/@types/domains/stream.ts +2 -2
  195. package/src/@types/domains/user.ts +8 -3
  196. package/src/cache/api/pushToCache.ts +1 -1
  197. package/src/cache/api/upsertInCache.ts +1 -1
  198. package/src/categoryRepository/api/getCategory.ts +3 -2
  199. package/src/categoryRepository/api/queryCategories.ts +7 -1
  200. package/src/categoryRepository/observers/getCategories.ts +3 -2
  201. package/src/categoryRepository/observers/tests/getCategories.test.ts +2 -1
  202. package/src/channelRepsitory/api/createChannel.ts +1 -1
  203. package/src/channelRepsitory/channelMembership/api/addMembers.ts +4 -4
  204. package/src/channelRepsitory/channelMembership/api/removeMembers.ts +4 -4
  205. package/src/channelRepsitory/channelMembership/observers/tests/getMembers.test.ts +1 -1
  206. package/src/channelRepsitory/channelMembership/observers/tests/searchMembers.test.ts +1 -3
  207. package/src/channelRepsitory/channelModeration/api/addRole.ts +4 -4
  208. package/src/channelRepsitory/channelModeration/api/banMembers.ts +2 -2
  209. package/src/channelRepsitory/channelModeration/api/removeRole.ts +4 -4
  210. package/src/channelRepsitory/channelModeration/api/unbanMembers.ts +2 -2
  211. package/src/channelRepsitory/events/onChannelMemberAdded.ts +1 -1
  212. package/src/channelRepsitory/events/onChannelMemberBanned.ts +1 -1
  213. package/src/channelRepsitory/events/onChannelMemberRemoved.ts +1 -1
  214. package/src/channelRepsitory/events/onChannelMemberUnbanned.ts +1 -1
  215. package/src/channelRepsitory/observers/tests/getChannel.test.ts +73 -0
  216. package/src/channelRepsitory/observers/tests/getChannels.test.ts +462 -50
  217. package/src/client/api/getToken.ts +3 -3
  218. package/src/client/api/login.ts +1 -1
  219. package/src/communityRepository/communityMembership/api/addMembers.ts +4 -4
  220. package/src/communityRepository/communityMembership/api/removeMembers.ts +4 -4
  221. package/src/communityRepository/communityMembership/events/utils.ts +2 -2
  222. package/src/communityRepository/communityMembership/observers/tests/getMembers.test.ts +1 -1
  223. package/src/communityRepository/communityModeration/api/addRoles.ts +4 -4
  224. package/src/communityRepository/communityModeration/api/banMembers.ts +2 -2
  225. package/src/communityRepository/communityModeration/api/removeRoles.ts +4 -4
  226. package/src/communityRepository/communityModeration/api/unbanMembers.ts +2 -2
  227. package/src/core/device.ts +1 -1
  228. package/src/core/query/filtering.ts +3 -1
  229. package/src/core/query/tests/filtering.test.ts +2 -2
  230. package/src/external/api/createUserToken.ts +2 -2
  231. package/src/group/utils/withUser.ts +8 -4
  232. package/src/liveStreamPlayer/api/getPlayer.ts +1 -1
  233. package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +1 -1
  234. package/src/messagePreview/utils/getSubChannelMessagePreviewWithUser.ts +1 -1
  235. package/src/messageRepository/api/getDeliveredUsers.ts +11 -9
  236. package/src/messageRepository/api/getReadUsers.ts +11 -9
  237. package/src/messageRepository/observers/tests/getMessages.test.ts +766 -0
  238. package/src/streamRepository/api/getStreams.ts +1 -1
  239. package/src/streamRepository/api/queryStreams.ts +1 -1
  240. package/src/subChannelRepository/observers/tests/getSubChannels.test.ts +308 -15
  241. package/src/userRepository/api/flagUser.ts +1 -1
  242. package/src/userRepository/api/getUser.ts +2 -1
  243. package/src/userRepository/api/getUserByIds.ts +4 -3
  244. package/src/userRepository/api/isUserFlaggedByMe.ts +1 -1
  245. package/src/userRepository/api/queryBlockedUsers.ts +10 -8
  246. package/src/userRepository/api/queryUsers.ts +12 -10
  247. package/src/userRepository/api/unflagUser.ts +1 -1
  248. package/src/userRepository/api/updateUser.ts +6 -6
  249. package/src/userRepository/events/onUserDeleted.ts +2 -2
  250. package/src/userRepository/events/onUserFetched.ts +2 -2
  251. package/src/userRepository/events/onUserFlagCleared.ts +2 -2
  252. package/src/userRepository/events/onUserFlagged.ts +2 -2
  253. package/src/userRepository/events/onUserUnflagged.ts +2 -2
  254. package/src/userRepository/events/onUserUpdated.ts +2 -2
  255. package/src/userRepository/events/utils.ts +1 -1
  256. package/src/userRepository/observers/getBlockedUsers.ts +8 -7
  257. package/src/userRepository/observers/getUser.ts +3 -3
  258. package/src/userRepository/observers/getUsers.ts +2 -2
  259. package/src/userRepository/observers/observeUser.ts +9 -6
  260. package/src/userRepository/observers/searchUserByDisplayName.ts +2 -2
  261. package/src/userRepository/observers/tests/getUser.test.ts +1 -1
  262. package/src/userRepository/observers/tests/getUsers.test.ts +12 -11
  263. package/src/userRepository/observers/tests/searchUserByDisplayName.test.ts +1 -1
  264. package/src/userRepository/relationship/block/api/blockUser.ts +6 -4
  265. package/src/userRepository/relationship/block/api/unBlockUser.ts +6 -4
  266. package/src/userRepository/relationship/block/observers/getBlockedUsers.ts +1 -1
  267. package/src/userRepository/relationship/follow/api/acceptFollower.ts +2 -2
  268. package/src/userRepository/relationship/follow/api/acceptMyFollower.ts +2 -2
  269. package/src/userRepository/relationship/follow/api/declineFollower.ts +2 -2
  270. package/src/userRepository/relationship/follow/api/declineMyFollower.ts +2 -2
  271. package/src/userRepository/relationship/follow/api/follow.ts +2 -2
  272. package/src/userRepository/relationship/follow/api/getFollowInfo.ts +4 -4
  273. package/src/userRepository/relationship/follow/api/unfollow.ts +3 -3
  274. package/src/userRepository/relationship/follow/api/utils.ts +1 -1
  275. package/src/userRepository/relationship/follow/observers/getFollowers.ts +1 -1
  276. package/src/userRepository/relationship/follow/observers/getFollowings.ts +1 -1
  277. package/src/userRepository/relationship/follow/observers/observeFollowInfo.ts +1 -1
  278. package/src/userRepository/relationship/follow/observers/observeFollowers.ts +2 -2
  279. package/src/userRepository/relationship/follow/observers/observeFollowings.ts +2 -2
  280. package/src/utils/linkedObject/categoryLinkedObject.ts +40 -0
  281. package/src/utils/linkedObject/index.ts +4 -0
  282. package/src/utils/linkedObject/userLinkedObject.ts +36 -0
  283. package/src/utils/tests/client.ts +1 -0
  284. package/src/utils/tests/dummy/block.ts +3 -3
  285. package/src/utils/tests/dummy/category.ts +5 -0
  286. package/src/utils/tests/dummy/channel.ts +58 -1
  287. package/src/utils/tests/dummy/community.ts +1 -1
  288. package/src/utils/tests/dummy/follow.ts +1 -1
  289. package/src/utils/tests/dummy/user.ts +3 -1
  290. package/tsconfig.json +18 -23
package/dist/index.cjs.js CHANGED
@@ -943,7 +943,7 @@ const pullFromCache = (key) => {
943
943
  /**
944
944
  * ```js
945
945
  * import { pushToCache } from '@amityco/ts-sdk'
946
- * pushToCache<Amity.User>(["user", "foobar"], user)
946
+ * pushToCache<Amity.InternalUser>(["user", "foobar"], user)
947
947
  * ```
948
948
  *
949
949
  * Saves any provided value as {@link Amity.CacheEntry} for the matching {@link Amity.CacheKey}
@@ -1009,7 +1009,7 @@ const mergeInCache = (key, mutation, options) => {
1009
1009
  /**
1010
1010
  * ```js
1011
1011
  * import { upsertInCache } from '@amityco/ts-sdk'
1012
- * upsertInCache<Amity.User>(["user", "foobar"], user)
1012
+ * upsertInCache<Amity.InternalUser>(["user", "foobar"], user)
1013
1013
  * ```
1014
1014
  *
1015
1015
  * Insert or update any provided value as {@link Amity.CacheEntry} for
@@ -4706,7 +4706,11 @@ const withUser = (member, userIdProp = 'userId', userProp = 'user') => {
4706
4706
  const client = getActiveClient();
4707
4707
  if (!client.cache)
4708
4708
  return undefined;
4709
- const userCache = (_a = pullFromCache(['user', 'get', member[userIdProp]])) === null || _a === void 0 ? void 0 : _a.data;
4709
+ const userCache = (_a = pullFromCache([
4710
+ 'user',
4711
+ 'get',
4712
+ member[userIdProp],
4713
+ ])) === null || _a === void 0 ? void 0 : _a.data;
4710
4714
  if (!userCache) {
4711
4715
  return undefined;
4712
4716
  }
@@ -6274,7 +6278,7 @@ const onChannelDeleted = (callback) => {
6274
6278
  * })
6275
6279
  * ```
6276
6280
  *
6277
- * Fired when any {@link Amity.User} has been banned from any {@link Amity.Channel}
6281
+ * Fired when any {@link Amity.InternalUser} has been banned from any {@link Amity.Channel}
6278
6282
  *
6279
6283
  * @param callback The function to call when the event was fired
6280
6284
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -6311,7 +6315,7 @@ const createUserEventSubscriber = (event, callback) => {
6311
6315
  * })
6312
6316
  * ```
6313
6317
  *
6314
- * Fired when a {@link Amity.User} has been deleted
6318
+ * Fired when a {@link Amity.InternalUser} has been deleted
6315
6319
  *
6316
6320
  * @param callback The function to call when the event was fired
6317
6321
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -7755,7 +7759,7 @@ const onChannelMuted = (callback) => {
7755
7759
  * })
7756
7760
  * ```
7757
7761
  *
7758
- * Fired when any {@link Amity.User} has been added to any {@link Amity.Channel}
7762
+ * Fired when any {@link Amity.InternalUser} has been added to any {@link Amity.Channel}
7759
7763
  *
7760
7764
  * @param callback The function to call when the event was fired
7761
7765
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -7781,7 +7785,7 @@ const onChannelMemberAdded = (callback) => {
7781
7785
  * })
7782
7786
  * ```
7783
7787
  *
7784
- * Fired when any {@link Amity.User} has been removed from any {@link Amity.Channel}
7788
+ * Fired when any {@link Amity.InternalUser} has been removed from any {@link Amity.Channel}
7785
7789
  *
7786
7790
  * @param callback The function to call when the event was fired
7787
7791
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -7807,7 +7811,7 @@ const onChannelMemberRemoved = (callback) => {
7807
7811
  * })
7808
7812
  * ```
7809
7813
  *
7810
- * Fired when any {@link Amity.User} has been unbanned from any {@link Amity.Channel}
7814
+ * Fired when any {@link Amity.InternalUser} has been unbanned from any {@link Amity.Channel}
7811
7815
  *
7812
7816
  * @param callback The function to call when the event was fired
7813
7817
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -8581,11 +8585,11 @@ const getChannels = (params, callback, config) => {
8581
8585
  * const updated = await addMembers(channelId, ['foo', 'bar'])
8582
8586
  * ```
8583
8587
  *
8584
- * Adds a list of {@link Amity.User} to a {@link Amity.Channel}
8588
+ * Adds a list of {@link Amity.InternalUser} to a {@link Amity.Channel}
8585
8589
  *
8586
8590
  * @param channelId The ID of the {@link Amity.Channel} to perform
8587
- * @param userIds The list of IDs {@link Amity.User} to add
8588
- * @returns A success boolean if the {@link Amity.User} were added to the {@link Amity.Channel}
8591
+ * @param userIds The list of IDs {@link Amity.InternalUser} to add
8592
+ * @returns A success boolean if the {@link Amity.InternalUser} were added to the {@link Amity.Channel}
8589
8593
  *
8590
8594
  * @category Channel API
8591
8595
  * @async
@@ -8615,11 +8619,11 @@ const addMembers$1 = async (channelId, userIds) => {
8615
8619
  * const updated = await removeMembers(channelId, ['foo', 'bar'])
8616
8620
  * ```
8617
8621
  *
8618
- * Removes a list of {@link Amity.User} from a {@link Amity.Channel}
8622
+ * Removes a list of {@link Amity.InternalUser} from a {@link Amity.Channel}
8619
8623
  *
8620
8624
  * @param channelId The ID of the {@link Amity.Channel} to perform
8621
- * @param userIds The list of IDs {@link Amity.User} to remove
8622
- * @returns A success boolean if the list of {@link Amity.User} were removed from the {@link Amity.Channel}
8625
+ * @param userIds The list of IDs {@link Amity.InternalUser} to remove
8626
+ * @returns A success boolean if the list of {@link Amity.InternalUser} were removed from the {@link Amity.Channel}
8623
8627
  *
8624
8628
  * @category Channel API
8625
8629
  * @async
@@ -8911,12 +8915,12 @@ var index$j = /*#__PURE__*/Object.freeze({
8911
8915
  * const updated = await addRole(channelId, 'foo', ['bar'])
8912
8916
  * ```
8913
8917
  *
8914
- * Adds an {@link Amity.Role} to a list of {@link Amity.User} on a {@link Amity.Channel}
8918
+ * Adds an {@link Amity.Role} to a list of {@link Amity.InternalUser} on a {@link Amity.Channel}
8915
8919
  *
8916
8920
  * @param channelId The ID of the {@link Amity.Channel} to perform
8917
8921
  * @param roleId The ID of the {@link Amity.Role} to apply
8918
- * @param userId Array of IDs of the {@link Amity.User} to perform
8919
- * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Channel}
8922
+ * @param userId Array of IDs of the {@link Amity.InternalUser} to perform
8923
+ * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.InternalUser} in the {@link Amity.Channel}
8920
8924
  *
8921
8925
  * @category Channel API
8922
8926
  * @async
@@ -8943,12 +8947,12 @@ const addRole = async (channelId, roleId, userIds) => {
8943
8947
  * const updated = await removeRole(channelId, 'foo', ['bar'])
8944
8948
  * ```
8945
8949
  *
8946
- * Removes an {@link Amity.Role} from a list of {@link Amity.User} on a {@link Amity.Channel}
8950
+ * Removes an {@link Amity.Role} from a list of {@link Amity.InternalUser} on a {@link Amity.Channel}
8947
8951
  *
8948
8952
  * @param channelId The ID of the {@link Amity.Channel} to perform
8949
8953
  * @param roleId The ID of the {@link Amity.Role} to apply
8950
- * @param userIds Array of IDs of the {@link Amity.User} to perform
8951
- * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
8954
+ * @param userIds Array of IDs of the {@link Amity.InternalUser} to perform
8955
+ * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.InternalUser} in the {@link Amity.Channel}
8952
8956
  *
8953
8957
  * @category Channel API
8954
8958
  * @async
@@ -8977,7 +8981,7 @@ const removeRole = async (channelId, roleId, userIds) => {
8977
8981
  * ```
8978
8982
  *
8979
8983
  * @param channelId of {@link Amity.Channel} from which the users should be banned
8980
- * @param userIds of the {@link Amity.User}'s to be banned
8984
+ * @param userIds of the {@link Amity.InternalUser}'s to be banned
8981
8985
  * @returns the updated {@link Amity.Membership}'s object
8982
8986
  *
8983
8987
  * @category Channel API
@@ -9012,7 +9016,7 @@ const banMembers$1 = async (channelId, userIds) => {
9012
9016
  * ```
9013
9017
  *
9014
9018
  * @param channelId of {@link Amity.Channel} where the users should be unbanned
9015
- * @param userIds of the {@link Amity.User}'s to be unbanned
9019
+ * @param userIds of the {@link Amity.InternalUser}'s to be unbanned
9016
9020
  * @returns the updated {@link Amity.Membership}'s object
9017
9021
  *
9018
9022
  * @category Channel API
@@ -9465,10 +9469,10 @@ var index$g = /*#__PURE__*/Object.freeze({
9465
9469
  * const blockedUser = await UserRepository.blockUser('userId')
9466
9470
  * ```
9467
9471
  *
9468
- * Blocks a {@link Amity.User}
9472
+ * Blocks a {@link Amity.InternalUser}
9469
9473
  *
9470
- * @param userId The ID of the {@link Amity.User} to block
9471
- * @returns the blocked {@link Amity.User} object
9474
+ * @param userId The ID of the {@link Amity.InternalUser} to block
9475
+ * @returns the blocked {@link Amity.InternalUser} object
9472
9476
  *
9473
9477
  * @category Post API
9474
9478
  * @async
@@ -9498,10 +9502,10 @@ const blockUser = async (userId) => {
9498
9502
  * const unblockedUser = await UserRepository.blockUser('userId')
9499
9503
  * ```
9500
9504
  *
9501
- * Blocks a {@link Amity.User}
9505
+ * Blocks a {@link Amity.InternalUser}
9502
9506
  *
9503
- * @param userId The ID of the {@link Amity.User} to unblock
9504
- * @returns the unblocked {@link Amity.User} object
9507
+ * @param userId The ID of the {@link Amity.InternalUser} to unblock
9508
+ * @returns the unblocked {@link Amity.InternalUser} object
9505
9509
  *
9506
9510
  * @category Post API
9507
9511
  * @async
@@ -9529,7 +9533,7 @@ const unBlockUser = async (userId) => {
9529
9533
  * ```
9530
9534
  *
9531
9535
  * @param query The query parameters
9532
- * @returns A page of {@link Amity.User} objects
9536
+ * @returns A page of {@link Amity.InternalUser} objects
9533
9537
  *
9534
9538
  * @category Block API
9535
9539
  * @async
@@ -9567,11 +9571,11 @@ const queryBlockedUsers = async (query) => {
9567
9571
  * const { data: users } = queryBlockedUsers.locally({ page: 'page_token' })
9568
9572
  * ```
9569
9573
  *
9570
- * Queries a paginable list of {@link Amity.User} objects from cache
9574
+ * Queries a paginable list of {@link Amity.InternalUser} objects from cache
9571
9575
  * Search is performed by displayName such as `.startsWith(search)`
9572
9576
  *
9573
9577
  * @param query The query parameters
9574
- * @returns A page of {@link Amity.User} objects
9578
+ * @returns A page of {@link Amity.InternalUser} objects
9575
9579
  *
9576
9580
  * @category Block API
9577
9581
  */
@@ -9599,6 +9603,105 @@ queryBlockedUsers.locally = (query = {}) => {
9599
9603
  : undefined;
9600
9604
  };
9601
9605
 
9606
+ const categoryLinkedObject = (category) => {
9607
+ return Object.assign(Object.assign({}, category), { get avatar() {
9608
+ var _a;
9609
+ if (!category.avatarFileId)
9610
+ return null;
9611
+ let avatar = {
9612
+ fileId: ((_a = category.avatarFileId) === null || _a === void 0 ? void 0 : _a.toString()) ? category.avatarFileId.toString() : '',
9613
+ type: 'image',
9614
+ fileUrl: '',
9615
+ createdAt: '',
9616
+ attributes: {
9617
+ name: '',
9618
+ extension: '',
9619
+ size: '',
9620
+ mimeType: '',
9621
+ metadata: {
9622
+ exif: {},
9623
+ gps: {},
9624
+ width: 0,
9625
+ height: 0,
9626
+ isFull: false,
9627
+ },
9628
+ },
9629
+ };
9630
+ const cacheData = pullFromCache([
9631
+ 'file',
9632
+ 'get',
9633
+ `${category.avatarFileId}`,
9634
+ ]);
9635
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.data) {
9636
+ avatar = cacheData === null || cacheData === void 0 ? void 0 : cacheData.data;
9637
+ }
9638
+ return avatar;
9639
+ } });
9640
+ };
9641
+
9642
+ const commentLinkedObject = (comment) => {
9643
+ return Object.assign(Object.assign({}, comment), { get target() {
9644
+ const commentTypes = {
9645
+ type: comment.targetType,
9646
+ };
9647
+ if (comment.targetType === 'user') {
9648
+ return Object.assign(Object.assign({}, commentTypes), { userId: comment.targetId });
9649
+ }
9650
+ if (commentTypes.type === 'content') {
9651
+ return Object.assign(Object.assign({}, commentTypes), { contentId: comment.targetId });
9652
+ }
9653
+ if (commentTypes.type === 'community') {
9654
+ const cacheData = pullFromCache([
9655
+ 'communityUsers',
9656
+ 'get',
9657
+ `${comment.targetId}#${comment.userId}`,
9658
+ ]);
9659
+ return Object.assign(Object.assign({}, commentTypes), { communityId: comment.targetId, creatorMember: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data });
9660
+ }
9661
+ return {
9662
+ type: 'unknown',
9663
+ };
9664
+ } });
9665
+ };
9666
+
9667
+ const userLinkedObject = (user) => {
9668
+ return Object.assign(Object.assign({}, user), { get avatar() {
9669
+ var _a;
9670
+ if (!user.avatarFileId)
9671
+ return null;
9672
+ let avatar = {
9673
+ fileId: ((_a = user.avatarFileId) === null || _a === void 0 ? void 0 : _a.toString()) ? user.avatarFileId.toString() : '',
9674
+ type: 'image',
9675
+ fileUrl: '',
9676
+ createdAt: '',
9677
+ attributes: {
9678
+ name: '',
9679
+ extension: '',
9680
+ size: '',
9681
+ mimeType: '',
9682
+ metadata: {
9683
+ exif: {},
9684
+ gps: {},
9685
+ width: 0,
9686
+ height: 0,
9687
+ isFull: false,
9688
+ },
9689
+ },
9690
+ };
9691
+ const cacheData = pullFromCache(['file', 'get', `${user.avatarFileId}`]);
9692
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.data) {
9693
+ avatar = cacheData === null || cacheData === void 0 ? void 0 : cacheData.data;
9694
+ }
9695
+ return avatar;
9696
+ } });
9697
+ };
9698
+
9699
+ const LinkedObject = {
9700
+ comment: commentLinkedObject,
9701
+ user: userLinkedObject,
9702
+ category: categoryLinkedObject,
9703
+ };
9704
+
9602
9705
  /* eslint-disable no-use-before-define */
9603
9706
  /* begin_public_function
9604
9707
  id: user.get_blocked_users
@@ -9609,10 +9712,10 @@ queryBlockedUsers.locally = (query = {}) => {
9609
9712
  * const unblockedUser = await UserRepository.blockUser('userId')
9610
9713
  * ```
9611
9714
  *
9612
- * Blocks a {@link Amity.User}
9715
+ * Blocks a {@link Amity.InternalUser}
9613
9716
  *
9614
- * @param params The params to get blocked {@link Amity.User}s
9615
- * @param callback to recieve updates on unblocked {@link Amity.User}s
9717
+ * @param params The params to get blocked {@link Amity.InternalUser}s
9718
+ * @param callback to recieve updates on unblocked {@link Amity.InternalUser}s
9616
9719
  * @returns {@link Amity.Unsubscriber} to unsubscribe from collection
9617
9720
  *
9618
9721
  * @category Post API
@@ -9635,7 +9738,7 @@ const getBlockedUsers$1 = (params, callback, config) => {
9635
9738
  const users = (_a = data.data
9636
9739
  .map(userId => pullFromCache(['user', 'get', userId]))
9637
9740
  .filter(Boolean)
9638
- .map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
9741
+ .map(({ data }) => LinkedObject.user(data))) !== null && _a !== void 0 ? _a : [];
9639
9742
  callback({
9640
9743
  onNextPage: onFetch,
9641
9744
  data: users,
@@ -9705,7 +9808,7 @@ const getBlockedUsers = (params, callback, config) => {
9705
9808
  *
9706
9809
  * Follow the user
9707
9810
  *
9708
- * @param userId the ID of the {@link Amity.User}
9811
+ * @param userId the ID of the {@link Amity.InternalUser}
9709
9812
  * @returns the status {@link Amity.FollowStatus}
9710
9813
  *
9711
9814
  * @category Follow API
@@ -9738,8 +9841,8 @@ const follow = async (userId) => {
9738
9841
  *
9739
9842
  * Cancel the follow request or unfollow the user
9740
9843
  *
9741
- * @param userId the ID of the {@link Amity.User}
9742
- * @returns A success boolean if the user {@link Amity.User} was unfollowed
9844
+ * @param userId the ID of the {@link Amity.InternalUser}
9845
+ * @returns A success boolean if the user {@link Amity.InternalUser} was unfollowed
9743
9846
  *
9744
9847
  * @category Follow API
9745
9848
  * @async
@@ -9767,7 +9870,7 @@ const unfollow = async (userId) => {
9767
9870
  *
9768
9871
  * Accept the follow request
9769
9872
  *
9770
- * @param userId the ID of the {@link Amity.User} follower
9873
+ * @param userId the ID of the {@link Amity.InternalUser} follower
9771
9874
  * @returns A success boolean if the follow request was accepted
9772
9875
  *
9773
9876
  * @category Follow API
@@ -9795,7 +9898,7 @@ const acceptFollower = async (userId) => {
9795
9898
  *
9796
9899
  * Accept the follow request
9797
9900
  *
9798
- * @param userId the ID of the {@link Amity.User} follower
9901
+ * @param userId the ID of the {@link Amity.InternalUser} follower
9799
9902
  * @returns A success boolean if the follow request was accepted
9800
9903
  *
9801
9904
  * @category Follow API
@@ -9824,7 +9927,7 @@ const acceptMyFollower = async (userId) => {
9824
9927
  *
9825
9928
  * Decline the follow request or delete the follower
9826
9929
  *
9827
- * @param userId the ID of the {@link Amity.User} follower
9930
+ * @param userId the ID of the {@link Amity.InternalUser} follower
9828
9931
  * @returns A success boolean if the follow request was decline
9829
9932
  *
9830
9933
  * @category Follow API
@@ -9852,7 +9955,7 @@ const declineFollower = async (userId) => {
9852
9955
  *
9853
9956
  * Decline the follow request or delete the follower
9854
9957
  *
9855
- * @param userId the ID of the {@link Amity.User} follower
9958
+ * @param userId the ID of the {@link Amity.InternalUser} follower
9856
9959
  * @returns A success boolean if the follow request was decline
9857
9960
  *
9858
9961
  * @category Follow API
@@ -10021,7 +10124,7 @@ const onFollowRequestDeclined = (callback) => createFollowEventSubscriber('follo
10021
10124
  *
10022
10125
  * Fetches the number of followers, followings, pending requests and the follow status for current user
10023
10126
  *
10024
- * @param userId the ID of the {@link Amity.User}
10127
+ * @param userId the ID of the {@link Amity.InternalUser}
10025
10128
  * @returns the associated {@link Amity.FollowInfo} object
10026
10129
  *
10027
10130
  * @category Follow API
@@ -10053,7 +10156,7 @@ const getFollowInfo$1 = async (userId) => {
10053
10156
  *
10054
10157
  * Fetches the number of followers, followings, pending requests and the follow status for current user from cache
10055
10158
  *
10056
- * @param userId the ID of the {@link Amity.User}
10159
+ * @param userId the ID of the {@link Amity.InternalUser}
10057
10160
  * @returns the associated {@link Amity.FollowInfo} object
10058
10161
  *
10059
10162
  * @category Follow API
@@ -10165,7 +10268,7 @@ const observeFollowInfo = (userId, callback, policy = 'cache_then_server') => {
10165
10268
  *
10166
10269
  * Observe all mutations on a list of followers {@link Amity.FollowStatus} for a given user
10167
10270
  *
10168
- * @param userId the ID of the {@link Amity.User}
10271
+ * @param userId the ID of the {@link Amity.InternalUser}
10169
10272
  * @param callback the function to call when new data are available
10170
10273
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the messages
10171
10274
  *
@@ -10204,7 +10307,7 @@ const observeFollowers = (userId, callback) => {
10204
10307
  *
10205
10308
  * Observe all mutations on a list of followings {@link Amity.FollowStatus} for a given user
10206
10309
  *
10207
- * @param userId the ID of the {@link Amity.User}
10310
+ * @param userId the ID of the {@link Amity.InternalUser}
10208
10311
  * @param callback the function to call when new data are available
10209
10312
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the messages
10210
10313
  *
@@ -10322,7 +10425,7 @@ queryFollowers.locally = (query) => queryFollows.locally('followers', query);
10322
10425
  *
10323
10426
  * let followers = []
10324
10427
  * const unsub = getFollowers({
10325
- * userId: Amity.User['userId'];
10428
+ * userId: Amity.InternalUser['userId'];
10326
10429
  * }, response => merge(followers, response.data))
10327
10430
  * ```
10328
10431
  *
@@ -10446,7 +10549,7 @@ queryFollowings.locally = (query) => queryFollows.locally('following', query);
10446
10549
  *
10447
10550
  * let followings = []
10448
10551
  * const unsub = getFollowings({
10449
- * userId: Amity.User['userId'];
10552
+ * userId: Amity.InternalUser['userId'];
10450
10553
  * }, response => merge(followings, response.data))
10451
10554
  * ```
10452
10555
  *
@@ -10650,7 +10753,7 @@ const getUserByIds = async (userIds) => {
10650
10753
  ingestInCache(data, { cachedAt });
10651
10754
  fireEvent('user.fetched', data);
10652
10755
  return {
10653
- data: data.users,
10756
+ data: data.users.map(user => LinkedObject.user(user)),
10654
10757
  cachedAt,
10655
10758
  };
10656
10759
  };
@@ -10677,7 +10780,7 @@ getUserByIds.locally = (userIds) => {
10677
10780
  const cached = userIds
10678
10781
  .map(userId => pullFromCache(['user', 'get', userId]))
10679
10782
  .filter(Boolean);
10680
- const users = cached.map(({ data }) => data);
10783
+ const users = cached.map(({ data }) => LinkedObject.user(data));
10681
10784
  const oldest = (_a = cached.sort((a, b) => (a.cachedAt < b.cachedAt ? -1 : 1))) === null || _a === void 0 ? void 0 : _a[0];
10682
10785
  if ((cached === null || cached === void 0 ? void 0 : cached.length) < userIds.length)
10683
10786
  return;
@@ -10696,11 +10799,11 @@ getUserByIds.locally = (userIds) => {
10696
10799
  * const updated = await updateUser(userId, { displayName: 'foobar' })
10697
10800
  * ```
10698
10801
  *
10699
- * Updates an {@link Amity.User}
10802
+ * Updates an {@link Amity.InternalUser}
10700
10803
  *
10701
- * @param userId The ID of the {@link Amity.User} to update
10804
+ * @param userId The ID of the {@link Amity.InternalUser} to update
10702
10805
  * @param patch The patch data to apply
10703
- * @returns the updated {@link Amity.User} object
10806
+ * @returns the updated {@link Amity.InternalUser} object
10704
10807
  *
10705
10808
  * @category User API
10706
10809
  * @async
@@ -10812,7 +10915,7 @@ const isUserFlaggedByMe = async (userId) => {
10812
10915
  * })
10813
10916
  * ```
10814
10917
  *
10815
- * Fired when a {@link Amity.User} has been updated
10918
+ * Fired when a {@link Amity.InternalUser} has been updated
10816
10919
  *
10817
10920
  * @param callback The function to call when the event was fired
10818
10921
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -10829,7 +10932,7 @@ const onUserUpdated = (callback) => createUserEventSubscriber('user.updated', ca
10829
10932
  * })
10830
10933
  * ```
10831
10934
  *
10832
- * Fired when a {@link Amity.User} has been flagged
10935
+ * Fired when a {@link Amity.InternalUser} has been flagged
10833
10936
  *
10834
10937
  * @param callback The function to call when the event was fired
10835
10938
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -10846,7 +10949,7 @@ const onUserFlagged = (callback) => createUserEventSubscriber('user.flagged', ca
10846
10949
  * })
10847
10950
  * ```
10848
10951
  *
10849
- * Fired when a flag has been removed from a {@link Amity.User}
10952
+ * Fired when a flag has been removed from a {@link Amity.InternalUser}
10850
10953
  *
10851
10954
  * @param callback The function to call when the event was fired
10852
10955
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -10863,7 +10966,7 @@ const onUserUnflagged = (callback) => createUserEventSubscriber('user.unflagged'
10863
10966
  * })
10864
10967
  * ```
10865
10968
  *
10866
- * Fired when flags have been cleared for a {@link Amity.User}
10969
+ * Fired when flags have been cleared for a {@link Amity.InternalUser}
10867
10970
  *
10868
10971
  * @param callback The function to call when the event was fired
10869
10972
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -10880,7 +10983,7 @@ const onUserFlagCleared = (callback) => createUserEventSubscriber('user.flagClea
10880
10983
  * })
10881
10984
  * ```
10882
10985
  *
10883
- * Fired when a {@link Amity.User} has been fetched
10986
+ * Fired when a {@link Amity.InternalUser} has been fetched
10884
10987
  *
10885
10988
  * @param callback The function to call when the event was fired
10886
10989
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -10924,7 +11027,7 @@ const getUser$1 = async (userId) => {
10924
11027
  const { users } = data;
10925
11028
  fireEvent('user.fetched', data);
10926
11029
  return {
10927
- data: users.find(user => user.userId === userId),
11030
+ data: LinkedObject.user(users.find(user => user.userId === userId)),
10928
11031
  cachedAt,
10929
11032
  };
10930
11033
  };
@@ -10961,7 +11064,7 @@ getUser$1.locally = (userId) => {
10961
11064
  * });
10962
11065
  * ```
10963
11066
  *
10964
- * Observe all mutation on a given {@link Amity.User}
11067
+ * Observe all mutation on a given {@link Amity.InternalUser}
10965
11068
  *
10966
11069
  * @param userId the ID of the user to observe
10967
11070
  * @param callback the function to call when new data are available
@@ -10987,11 +11090,11 @@ const getUser = (userId, callback) => {
10987
11090
  * const { data: users, prevPage, nextPage } = await queryUsers({ displayName: 'foo' })
10988
11091
  * ```
10989
11092
  *
10990
- * Queries a paginable list of {@link Amity.User} objects
11093
+ * Queries a paginable list of {@link Amity.InternalUser} objects
10991
11094
  * Search is performed by displayName such as `.startsWith(search)`
10992
11095
  *
10993
11096
  * @param query The query parameters
10994
- * @returns A page of {@link Amity.User} objects
11097
+ * @returns A page of {@link Amity.InternalUser} objects
10995
11098
  *
10996
11099
  * @category User API
10997
11100
  * @async
@@ -11022,7 +11125,7 @@ const queryUsers = async (query = {}) => {
11022
11125
  fireEvent('user.fetched', data);
11023
11126
  const prevPage = toPage(paging.previous);
11024
11127
  const nextPage = toPage(paging.next);
11025
- return { data: users, cachedAt, prevPage, nextPage };
11128
+ return { data: users.map(user => LinkedObject.user(user)), cachedAt, prevPage, nextPage };
11026
11129
  };
11027
11130
  /**
11028
11131
  * ```js
@@ -11030,11 +11133,11 @@ const queryUsers = async (query = {}) => {
11030
11133
  * const { data: users } = queryUsers.locally({ keyword: 'foo' })
11031
11134
  * ```
11032
11135
  *
11033
- * Queries a paginable list of {@link Amity.User} objects from cache
11136
+ * Queries a paginable list of {@link Amity.InternalUser} objects from cache
11034
11137
  * Search is performed by displayName such as `.startsWith(search)`
11035
11138
  *
11036
11139
  * @param query The query parameters
11037
- * @returns A page of {@link Amity.User} objects
11140
+ * @returns A page of {@link Amity.InternalUser} objects
11038
11141
  *
11039
11142
  * @category User API
11040
11143
  */
@@ -11118,7 +11221,7 @@ const getUsers = (params, callback, config) => {
11118
11221
  const users = (_a = data.data
11119
11222
  .map(userId => pullFromCache(['user', 'get', userId]))
11120
11223
  .filter(Boolean)
11121
- .map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
11224
+ .map(({ data }) => LinkedObject.user(data))) !== null && _a !== void 0 ? _a : [];
11122
11225
  callback({
11123
11226
  onNextPage: onFetch,
11124
11227
  /*
@@ -11181,7 +11284,7 @@ const getUsers = (params, callback, config) => {
11181
11284
  * @param callback the function to call when new data are available
11182
11285
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the user
11183
11286
  *
11184
- * Observe all mutation on a given {@link Amity.User}
11287
+ * Observe all mutation on a given {@link Amity.InternalUser}
11185
11288
  * @category User Observer
11186
11289
  */
11187
11290
  const observeUser = (userId, callback) => {
@@ -11194,11 +11297,12 @@ const observeUser = (userId, callback) => {
11194
11297
  // filter function
11195
11298
  if (((_a = result.data) === null || _a === void 0 ? void 0 : _a.userId) !== userId)
11196
11299
  return;
11300
+ const newResult = Object.assign(Object.assign({}, result), { data: LinkedObject.user(result.data) });
11197
11301
  if (callback instanceof Function)
11198
- return callback(result);
11302
+ return callback(newResult);
11199
11303
  if (action !== 'onFetch')
11200
- (_b = callback.onEvent) === null || _b === void 0 ? void 0 : _b.call(callback, action, result);
11201
- (_c = callback[action]) === null || _c === void 0 ? void 0 : _c.call(callback, result);
11304
+ (_b = callback.onEvent) === null || _b === void 0 ? void 0 : _b.call(callback, action, newResult);
11305
+ (_c = callback[action]) === null || _c === void 0 ? void 0 : _c.call(callback, newResult);
11202
11306
  };
11203
11307
  const disposers = [];
11204
11308
  disposers.push(onUserUpdated(data => router({ data, loading: false, origin: 'event' }, 'onUpdate')), onUserDeleted(data => router({ data, loading: false, origin: 'event' }, 'onDelete')), onUserFlagged(data => router({ data, loading: false, origin: 'event' }, 'onFlagged')), onUserUnflagged(data => router({ data, loading: false, origin: 'event' }, 'onUnflagged')), onUserFlagCleared(data => router({ data, loading: false, origin: 'event' }, 'onFlagCleared')));
@@ -11220,7 +11324,7 @@ const observeUser = (userId, callback) => {
11220
11324
  * const unsub = UserRepository.searchUserByDisplayName({}, response => merge(users, response.data))
11221
11325
  * ```
11222
11326
  *
11223
- * Observe all mutations on a list of {@link Amity.User}s
11327
+ * Observe all mutations on a list of {@link Amity.InternalUser}s
11224
11328
  *
11225
11329
  * @param params for searching users
11226
11330
  * @param callback the function to call when new data are available
@@ -11921,35 +12025,6 @@ getPost$1.locally = (postId) => {
11921
12025
  };
11922
12026
  };
11923
12027
 
11924
- const commentLinkedObject = (comment) => {
11925
- return Object.assign(Object.assign({}, comment), { get target() {
11926
- const commentTypes = {
11927
- type: comment.targetType,
11928
- };
11929
- if (comment.targetType === 'user') {
11930
- return Object.assign(Object.assign({}, commentTypes), { userId: comment.targetId });
11931
- }
11932
- if (commentTypes.type === 'content') {
11933
- return Object.assign(Object.assign({}, commentTypes), { contentId: comment.targetId });
11934
- }
11935
- if (commentTypes.type === 'community') {
11936
- const cacheData = pullFromCache([
11937
- 'communityUsers',
11938
- 'get',
11939
- `${comment.targetId}#${comment.userId}`,
11940
- ]);
11941
- return Object.assign(Object.assign({}, commentTypes), { communityId: comment.targetId, creatorMember: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data });
11942
- }
11943
- return {
11944
- type: 'unknown',
11945
- };
11946
- } });
11947
- };
11948
-
11949
- const LinkedObject = {
11950
- comment: commentLinkedObject,
11951
- };
11952
-
11953
12028
  /**
11954
12029
  * ```js
11955
12030
  * import { CommentRepository } from '@amityco/ts-sdk'
@@ -13616,10 +13691,10 @@ const markAsDelivered = async (subChannelId, messageId) => {
13616
13691
  * })
13617
13692
  * ```
13618
13693
  *
13619
- * Queries a paginable list of read {@link Amity.User} by messageId
13694
+ * Queries a paginable list of read {@link Amity.InternalUser} by messageId
13620
13695
  *
13621
13696
  * @param query The query parameters
13622
- * @returns A page of {@link Amity.User} objects
13697
+ * @returns A page of {@link Amity.InternalUser} objects
13623
13698
  *
13624
13699
  * @category Message API
13625
13700
  * @async
@@ -13661,10 +13736,10 @@ const getReadUsers = async (query) => {
13661
13736
  * })
13662
13737
  * ```
13663
13738
  *
13664
- * Queries a paginable list of read {@link Amity.User} objects from cache
13739
+ * Queries a paginable list of read {@link Amity.InternalUser} objects from cache
13665
13740
  *
13666
13741
  * @param query The query parameters
13667
- * @returns A page of {@link Amity.User} objects
13742
+ * @returns A page of {@link Amity.InternalUser} objects
13668
13743
  *
13669
13744
  * @category Message API
13670
13745
  */
@@ -13697,10 +13772,10 @@ getReadUsers.locally = (query) => {
13697
13772
  * })
13698
13773
  * ```
13699
13774
  *
13700
- * Queries a paginable list of delivered {@link Amity.User} by messageId
13775
+ * Queries a paginable list of delivered {@link Amity.InternalUser} by messageId
13701
13776
  *
13702
13777
  * @param query The query parameters
13703
- * @returns A page of {@link Amity.User} objects
13778
+ * @returns A page of {@link Amity.InternalUser} objects
13704
13779
  *
13705
13780
  * @category Message API
13706
13781
  * @async
@@ -13741,10 +13816,10 @@ const getDeliveredUsers = async (query) => {
13741
13816
  * })
13742
13817
  * ```
13743
13818
  *
13744
- * Queries a paginable list of delivered {@link Amity.User} objects from cache
13819
+ * Queries a paginable list of delivered {@link Amity.InternalUser} objects from cache
13745
13820
  *
13746
13821
  * @param query The query parameters
13747
- * @returns A page of {@link Amity.User} objects
13822
+ * @returns A page of {@link Amity.InternalUser} objects
13748
13823
  *
13749
13824
  * @category Message API
13750
13825
  */
@@ -16037,12 +16112,12 @@ const getRecommendedCommunities = (params, callback, config) => {
16037
16112
  * const updated = await CommunityRepository.moderation.addRoles(communityId, ['foo', 'bar'])
16038
16113
  * ```
16039
16114
  *
16040
- * Adds a list of {@link Amity.Role} to a list of {@link Amity.User} on a {@link Amity.Community}
16115
+ * Adds a list of {@link Amity.Role} to a list of {@link Amity.InternalUser} on a {@link Amity.Community}
16041
16116
  *
16042
16117
  * @param communityId The ID of the {@link Amity.Community} to perform
16043
16118
  * @param roleIds Array of IDs of the {@link Amity.Role} to apply
16044
- * @param userIds Array of IDs of the {@link Amity.User} to perform
16045
- * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Community}
16119
+ * @param userIds Array of IDs of the {@link Amity.InternalUser} to perform
16120
+ * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.InternalUser} in the {@link Amity.Community}
16046
16121
  *
16047
16122
  * @category Community API
16048
16123
  * @async
@@ -16069,12 +16144,12 @@ const addRoles = async (communityId, roleIds, userIds) => {
16069
16144
  * const updated = await CommunityRepository.moderation.removeRoles(communityId, ['foo', 'bar'])
16070
16145
  * ```
16071
16146
  *
16072
- * Removes a list of {@link Amity.Role} from a list of {@link Amity.User} on a {@link Amity.Community}
16147
+ * Removes a list of {@link Amity.Role} from a list of {@link Amity.InternalUser} on a {@link Amity.Community}
16073
16148
  *
16074
16149
  * @param communityId The ID of the {@link Amity.Community} to perform
16075
16150
  * @param roleIds Array of IDs of the {@link Amity.Role} to apply
16076
- * @param userIds Array of IDs of the {@link Amity.User} to perform
16077
- * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Community}
16151
+ * @param userIds Array of IDs of the {@link Amity.InternalUser} to perform
16152
+ * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.InternalUser} in the {@link Amity.Community}
16078
16153
  *
16079
16154
  * @category Community API
16080
16155
  * @async
@@ -16103,7 +16178,7 @@ const removeRoles = async (communityId, roleIds, userIds) => {
16103
16178
  * ```
16104
16179
  *
16105
16180
  * @param communityId of {@link Amity.Community} from which the users should be banned
16106
- * @param userIds of the {@link Amity.User}'s to be banned
16181
+ * @param userIds of the {@link Amity.InternalUser}'s to be banned
16107
16182
  * @returns the updated {@link Amity.Membership}'s object
16108
16183
  *
16109
16184
  * @category Community API
@@ -16138,7 +16213,7 @@ const banMembers = async (communityId, userIds) => {
16138
16213
  * ```
16139
16214
  *
16140
16215
  * @param communityId of {@link Amity.Community} from which the users should be unbanned
16141
- * @param userIds of the {@link Amity.User}'s to be unbanned
16216
+ * @param userIds of the {@link Amity.InternalUser}'s to be unbanned
16142
16217
  * @returns the updated {@link Amity.Membership}'s object
16143
16218
  *
16144
16219
  * @category Community API
@@ -16179,11 +16254,11 @@ var index$9 = /*#__PURE__*/Object.freeze({
16179
16254
  * const updated = await CommunityRepository.moderation.addMembers(communityId, ['foo', 'bar'])
16180
16255
  * ```
16181
16256
  *
16182
- * Adds a list of {@link Amity.User} to a {@link Amity.Community} to add users to
16257
+ * Adds a list of {@link Amity.InternalUser} to a {@link Amity.Community} to add users to
16183
16258
  *
16184
16259
  * @param communityId The ID of the {@link Amity.Community} to perform
16185
- * @param userIds The list of IDs {@link Amity.User} to add
16186
- * @returns A success boolean if the {@link Amity.User} were added to the {@link Amity.Community}
16260
+ * @param userIds The list of IDs {@link Amity.InternalUser} to add
16261
+ * @returns A success boolean if the {@link Amity.InternalUser} were added to the {@link Amity.Community}
16187
16262
  *
16188
16263
  * @category Community API
16189
16264
  * @async
@@ -16210,11 +16285,11 @@ const addMembers = async (communityId, userIds) => {
16210
16285
  * const updated = await CommunityRepository.moderation.removeMembers(communityId, ['foo', 'bar'])
16211
16286
  * ```
16212
16287
  *
16213
- * Removes a list of {@link Amity.User} from a {@link Amity.Community}
16288
+ * Removes a list of {@link Amity.InternalUser} from a {@link Amity.Community}
16214
16289
  *
16215
16290
  * @param communityId The ID of the {@link Amity.Community} to edit
16216
- * @param userIds The list of IDs {@link Amity.User} to remove
16217
- * @returns A success boolean if the list of {@link Amity.User} were removed from the {@link Amity.Community}
16291
+ * @param userIds The list of IDs {@link Amity.InternalUser} to remove
16292
+ * @returns A success boolean if the list of {@link Amity.InternalUser} were removed from the {@link Amity.Community}
16218
16293
  *
16219
16294
  * @category Community API
16220
16295
  * @async
@@ -16499,7 +16574,7 @@ const getCategory = async (categoryId) => {
16499
16574
  ingestInCache(data, { cachedAt });
16500
16575
  const { categories } = data;
16501
16576
  return {
16502
- data: categories.find(category => category.categoryId === categoryId),
16577
+ data: categoryLinkedObject(categories.find(category => category.categoryId === categoryId)),
16503
16578
  cachedAt,
16504
16579
  };
16505
16580
  };
@@ -16568,7 +16643,12 @@ const queryCategories = async (query) => {
16568
16643
  }
16569
16644
  const nextPage = toPage(paging.next);
16570
16645
  const prevPage = toPage(paging.previous);
16571
- return { data: categories, cachedAt, prevPage, nextPage };
16646
+ return {
16647
+ data: categories.map(category => LinkedObject.category(category)),
16648
+ cachedAt,
16649
+ prevPage,
16650
+ nextPage,
16651
+ };
16572
16652
  };
16573
16653
  /**
16574
16654
  * ```js
@@ -16641,7 +16721,7 @@ const getCategories = (params, callback, config) => {
16641
16721
  let categories = (_a = data.data
16642
16722
  .map(categoryId => pullFromCache(['category', 'get', categoryId]))
16643
16723
  .filter(Boolean)
16644
- .map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
16724
+ .map(({ data }) => LinkedObject.category(data))) !== null && _a !== void 0 ? _a : [];
16645
16725
  if (!params.includeDeleted) {
16646
16726
  categories = filterByPropEquality(categories, 'isDeleted', false);
16647
16727
  }
@@ -19447,7 +19527,7 @@ const getPlayer = async (parameters) => {
19447
19527
  hls.loadSource(url);
19448
19528
  }
19449
19529
  else {
19450
- const recording = recordings[0];
19530
+ const recording = recordings.find(rec => !!rec.mp4);
19451
19531
  if (!recording || !recording.mp4) {
19452
19532
  throw new Error('No playable recording available');
19453
19533
  }