@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.esm.js CHANGED
@@ -928,7 +928,7 @@ const pullFromCache = (key) => {
928
928
  /**
929
929
  * ```js
930
930
  * import { pushToCache } from '@amityco/ts-sdk'
931
- * pushToCache<Amity.User>(["user", "foobar"], user)
931
+ * pushToCache<Amity.InternalUser>(["user", "foobar"], user)
932
932
  * ```
933
933
  *
934
934
  * Saves any provided value as {@link Amity.CacheEntry} for the matching {@link Amity.CacheKey}
@@ -994,7 +994,7 @@ const mergeInCache = (key, mutation, options) => {
994
994
  /**
995
995
  * ```js
996
996
  * import { upsertInCache } from '@amityco/ts-sdk'
997
- * upsertInCache<Amity.User>(["user", "foobar"], user)
997
+ * upsertInCache<Amity.InternalUser>(["user", "foobar"], user)
998
998
  * ```
999
999
  *
1000
1000
  * Insert or update any provided value as {@link Amity.CacheEntry} for
@@ -20796,7 +20796,11 @@ const withUser = (member, userIdProp = 'userId', userProp = 'user') => {
20796
20796
  const client = getActiveClient();
20797
20797
  if (!client.cache)
20798
20798
  return undefined;
20799
- const userCache = (_a = pullFromCache(['user', 'get', member[userIdProp]])) === null || _a === void 0 ? void 0 : _a.data;
20799
+ const userCache = (_a = pullFromCache([
20800
+ 'user',
20801
+ 'get',
20802
+ member[userIdProp],
20803
+ ])) === null || _a === void 0 ? void 0 : _a.data;
20800
20804
  if (!userCache) {
20801
20805
  return undefined;
20802
20806
  }
@@ -22364,7 +22368,7 @@ const onChannelDeleted = (callback) => {
22364
22368
  * })
22365
22369
  * ```
22366
22370
  *
22367
- * Fired when any {@link Amity.User} has been banned from any {@link Amity.Channel}
22371
+ * Fired when any {@link Amity.InternalUser} has been banned from any {@link Amity.Channel}
22368
22372
  *
22369
22373
  * @param callback The function to call when the event was fired
22370
22374
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -22401,7 +22405,7 @@ const createUserEventSubscriber = (event, callback) => {
22401
22405
  * })
22402
22406
  * ```
22403
22407
  *
22404
- * Fired when a {@link Amity.User} has been deleted
22408
+ * Fired when a {@link Amity.InternalUser} has been deleted
22405
22409
  *
22406
22410
  * @param callback The function to call when the event was fired
22407
22411
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -23845,7 +23849,7 @@ const onChannelMuted = (callback) => {
23845
23849
  * })
23846
23850
  * ```
23847
23851
  *
23848
- * Fired when any {@link Amity.User} has been added to any {@link Amity.Channel}
23852
+ * Fired when any {@link Amity.InternalUser} has been added to any {@link Amity.Channel}
23849
23853
  *
23850
23854
  * @param callback The function to call when the event was fired
23851
23855
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -23871,7 +23875,7 @@ const onChannelMemberAdded = (callback) => {
23871
23875
  * })
23872
23876
  * ```
23873
23877
  *
23874
- * Fired when any {@link Amity.User} has been removed from any {@link Amity.Channel}
23878
+ * Fired when any {@link Amity.InternalUser} has been removed from any {@link Amity.Channel}
23875
23879
  *
23876
23880
  * @param callback The function to call when the event was fired
23877
23881
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -23897,7 +23901,7 @@ const onChannelMemberRemoved = (callback) => {
23897
23901
  * })
23898
23902
  * ```
23899
23903
  *
23900
- * Fired when any {@link Amity.User} has been unbanned from any {@link Amity.Channel}
23904
+ * Fired when any {@link Amity.InternalUser} has been unbanned from any {@link Amity.Channel}
23901
23905
  *
23902
23906
  * @param callback The function to call when the event was fired
23903
23907
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -24671,11 +24675,11 @@ const getChannels = (params, callback, config) => {
24671
24675
  * const updated = await addMembers(channelId, ['foo', 'bar'])
24672
24676
  * ```
24673
24677
  *
24674
- * Adds a list of {@link Amity.User} to a {@link Amity.Channel}
24678
+ * Adds a list of {@link Amity.InternalUser} to a {@link Amity.Channel}
24675
24679
  *
24676
24680
  * @param channelId The ID of the {@link Amity.Channel} to perform
24677
- * @param userIds The list of IDs {@link Amity.User} to add
24678
- * @returns A success boolean if the {@link Amity.User} were added to the {@link Amity.Channel}
24681
+ * @param userIds The list of IDs {@link Amity.InternalUser} to add
24682
+ * @returns A success boolean if the {@link Amity.InternalUser} were added to the {@link Amity.Channel}
24679
24683
  *
24680
24684
  * @category Channel API
24681
24685
  * @async
@@ -24705,11 +24709,11 @@ const addMembers$1 = async (channelId, userIds) => {
24705
24709
  * const updated = await removeMembers(channelId, ['foo', 'bar'])
24706
24710
  * ```
24707
24711
  *
24708
- * Removes a list of {@link Amity.User} from a {@link Amity.Channel}
24712
+ * Removes a list of {@link Amity.InternalUser} from a {@link Amity.Channel}
24709
24713
  *
24710
24714
  * @param channelId The ID of the {@link Amity.Channel} to perform
24711
- * @param userIds The list of IDs {@link Amity.User} to remove
24712
- * @returns A success boolean if the list of {@link Amity.User} were removed from the {@link Amity.Channel}
24715
+ * @param userIds The list of IDs {@link Amity.InternalUser} to remove
24716
+ * @returns A success boolean if the list of {@link Amity.InternalUser} were removed from the {@link Amity.Channel}
24713
24717
  *
24714
24718
  * @category Channel API
24715
24719
  * @async
@@ -25001,12 +25005,12 @@ var index$j = /*#__PURE__*/Object.freeze({
25001
25005
  * const updated = await addRole(channelId, 'foo', ['bar'])
25002
25006
  * ```
25003
25007
  *
25004
- * Adds an {@link Amity.Role} to a list of {@link Amity.User} on a {@link Amity.Channel}
25008
+ * Adds an {@link Amity.Role} to a list of {@link Amity.InternalUser} on a {@link Amity.Channel}
25005
25009
  *
25006
25010
  * @param channelId The ID of the {@link Amity.Channel} to perform
25007
25011
  * @param roleId The ID of the {@link Amity.Role} to apply
25008
- * @param userId Array of IDs of the {@link Amity.User} to perform
25009
- * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Channel}
25012
+ * @param userId Array of IDs of the {@link Amity.InternalUser} to perform
25013
+ * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.InternalUser} in the {@link Amity.Channel}
25010
25014
  *
25011
25015
  * @category Channel API
25012
25016
  * @async
@@ -25033,12 +25037,12 @@ const addRole = async (channelId, roleId, userIds) => {
25033
25037
  * const updated = await removeRole(channelId, 'foo', ['bar'])
25034
25038
  * ```
25035
25039
  *
25036
- * Removes an {@link Amity.Role} from a list of {@link Amity.User} on a {@link Amity.Channel}
25040
+ * Removes an {@link Amity.Role} from a list of {@link Amity.InternalUser} on a {@link Amity.Channel}
25037
25041
  *
25038
25042
  * @param channelId The ID of the {@link Amity.Channel} to perform
25039
25043
  * @param roleId The ID of the {@link Amity.Role} to apply
25040
- * @param userIds Array of IDs of the {@link Amity.User} to perform
25041
- * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
25044
+ * @param userIds Array of IDs of the {@link Amity.InternalUser} to perform
25045
+ * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.InternalUser} in the {@link Amity.Channel}
25042
25046
  *
25043
25047
  * @category Channel API
25044
25048
  * @async
@@ -25067,7 +25071,7 @@ const removeRole = async (channelId, roleId, userIds) => {
25067
25071
  * ```
25068
25072
  *
25069
25073
  * @param channelId of {@link Amity.Channel} from which the users should be banned
25070
- * @param userIds of the {@link Amity.User}'s to be banned
25074
+ * @param userIds of the {@link Amity.InternalUser}'s to be banned
25071
25075
  * @returns the updated {@link Amity.Membership}'s object
25072
25076
  *
25073
25077
  * @category Channel API
@@ -25102,7 +25106,7 @@ const banMembers$1 = async (channelId, userIds) => {
25102
25106
  * ```
25103
25107
  *
25104
25108
  * @param channelId of {@link Amity.Channel} where the users should be unbanned
25105
- * @param userIds of the {@link Amity.User}'s to be unbanned
25109
+ * @param userIds of the {@link Amity.InternalUser}'s to be unbanned
25106
25110
  * @returns the updated {@link Amity.Membership}'s object
25107
25111
  *
25108
25112
  * @category Channel API
@@ -25555,10 +25559,10 @@ var index$g = /*#__PURE__*/Object.freeze({
25555
25559
  * const blockedUser = await UserRepository.blockUser('userId')
25556
25560
  * ```
25557
25561
  *
25558
- * Blocks a {@link Amity.User}
25562
+ * Blocks a {@link Amity.InternalUser}
25559
25563
  *
25560
- * @param userId The ID of the {@link Amity.User} to block
25561
- * @returns the blocked {@link Amity.User} object
25564
+ * @param userId The ID of the {@link Amity.InternalUser} to block
25565
+ * @returns the blocked {@link Amity.InternalUser} object
25562
25566
  *
25563
25567
  * @category Post API
25564
25568
  * @async
@@ -25588,10 +25592,10 @@ const blockUser = async (userId) => {
25588
25592
  * const unblockedUser = await UserRepository.blockUser('userId')
25589
25593
  * ```
25590
25594
  *
25591
- * Blocks a {@link Amity.User}
25595
+ * Blocks a {@link Amity.InternalUser}
25592
25596
  *
25593
- * @param userId The ID of the {@link Amity.User} to unblock
25594
- * @returns the unblocked {@link Amity.User} object
25597
+ * @param userId The ID of the {@link Amity.InternalUser} to unblock
25598
+ * @returns the unblocked {@link Amity.InternalUser} object
25595
25599
  *
25596
25600
  * @category Post API
25597
25601
  * @async
@@ -25619,7 +25623,7 @@ const unBlockUser = async (userId) => {
25619
25623
  * ```
25620
25624
  *
25621
25625
  * @param query The query parameters
25622
- * @returns A page of {@link Amity.User} objects
25626
+ * @returns A page of {@link Amity.InternalUser} objects
25623
25627
  *
25624
25628
  * @category Block API
25625
25629
  * @async
@@ -25657,11 +25661,11 @@ const queryBlockedUsers = async (query) => {
25657
25661
  * const { data: users } = queryBlockedUsers.locally({ page: 'page_token' })
25658
25662
  * ```
25659
25663
  *
25660
- * Queries a paginable list of {@link Amity.User} objects from cache
25664
+ * Queries a paginable list of {@link Amity.InternalUser} objects from cache
25661
25665
  * Search is performed by displayName such as `.startsWith(search)`
25662
25666
  *
25663
25667
  * @param query The query parameters
25664
- * @returns A page of {@link Amity.User} objects
25668
+ * @returns A page of {@link Amity.InternalUser} objects
25665
25669
  *
25666
25670
  * @category Block API
25667
25671
  */
@@ -25689,6 +25693,105 @@ queryBlockedUsers.locally = (query = {}) => {
25689
25693
  : undefined;
25690
25694
  };
25691
25695
 
25696
+ const categoryLinkedObject = (category) => {
25697
+ return Object.assign(Object.assign({}, category), { get avatar() {
25698
+ var _a;
25699
+ if (!category.avatarFileId)
25700
+ return null;
25701
+ let avatar = {
25702
+ fileId: ((_a = category.avatarFileId) === null || _a === void 0 ? void 0 : _a.toString()) ? category.avatarFileId.toString() : '',
25703
+ type: 'image',
25704
+ fileUrl: '',
25705
+ createdAt: '',
25706
+ attributes: {
25707
+ name: '',
25708
+ extension: '',
25709
+ size: '',
25710
+ mimeType: '',
25711
+ metadata: {
25712
+ exif: {},
25713
+ gps: {},
25714
+ width: 0,
25715
+ height: 0,
25716
+ isFull: false,
25717
+ },
25718
+ },
25719
+ };
25720
+ const cacheData = pullFromCache([
25721
+ 'file',
25722
+ 'get',
25723
+ `${category.avatarFileId}`,
25724
+ ]);
25725
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.data) {
25726
+ avatar = cacheData === null || cacheData === void 0 ? void 0 : cacheData.data;
25727
+ }
25728
+ return avatar;
25729
+ } });
25730
+ };
25731
+
25732
+ const commentLinkedObject = (comment) => {
25733
+ return Object.assign(Object.assign({}, comment), { get target() {
25734
+ const commentTypes = {
25735
+ type: comment.targetType,
25736
+ };
25737
+ if (comment.targetType === 'user') {
25738
+ return Object.assign(Object.assign({}, commentTypes), { userId: comment.targetId });
25739
+ }
25740
+ if (commentTypes.type === 'content') {
25741
+ return Object.assign(Object.assign({}, commentTypes), { contentId: comment.targetId });
25742
+ }
25743
+ if (commentTypes.type === 'community') {
25744
+ const cacheData = pullFromCache([
25745
+ 'communityUsers',
25746
+ 'get',
25747
+ `${comment.targetId}#${comment.userId}`,
25748
+ ]);
25749
+ return Object.assign(Object.assign({}, commentTypes), { communityId: comment.targetId, creatorMember: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data });
25750
+ }
25751
+ return {
25752
+ type: 'unknown',
25753
+ };
25754
+ } });
25755
+ };
25756
+
25757
+ const userLinkedObject = (user) => {
25758
+ return Object.assign(Object.assign({}, user), { get avatar() {
25759
+ var _a;
25760
+ if (!user.avatarFileId)
25761
+ return null;
25762
+ let avatar = {
25763
+ fileId: ((_a = user.avatarFileId) === null || _a === void 0 ? void 0 : _a.toString()) ? user.avatarFileId.toString() : '',
25764
+ type: 'image',
25765
+ fileUrl: '',
25766
+ createdAt: '',
25767
+ attributes: {
25768
+ name: '',
25769
+ extension: '',
25770
+ size: '',
25771
+ mimeType: '',
25772
+ metadata: {
25773
+ exif: {},
25774
+ gps: {},
25775
+ width: 0,
25776
+ height: 0,
25777
+ isFull: false,
25778
+ },
25779
+ },
25780
+ };
25781
+ const cacheData = pullFromCache(['file', 'get', `${user.avatarFileId}`]);
25782
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.data) {
25783
+ avatar = cacheData === null || cacheData === void 0 ? void 0 : cacheData.data;
25784
+ }
25785
+ return avatar;
25786
+ } });
25787
+ };
25788
+
25789
+ const LinkedObject = {
25790
+ comment: commentLinkedObject,
25791
+ user: userLinkedObject,
25792
+ category: categoryLinkedObject,
25793
+ };
25794
+
25692
25795
  /* eslint-disable no-use-before-define */
25693
25796
  /* begin_public_function
25694
25797
  id: user.get_blocked_users
@@ -25699,10 +25802,10 @@ queryBlockedUsers.locally = (query = {}) => {
25699
25802
  * const unblockedUser = await UserRepository.blockUser('userId')
25700
25803
  * ```
25701
25804
  *
25702
- * Blocks a {@link Amity.User}
25805
+ * Blocks a {@link Amity.InternalUser}
25703
25806
  *
25704
- * @param params The params to get blocked {@link Amity.User}s
25705
- * @param callback to recieve updates on unblocked {@link Amity.User}s
25807
+ * @param params The params to get blocked {@link Amity.InternalUser}s
25808
+ * @param callback to recieve updates on unblocked {@link Amity.InternalUser}s
25706
25809
  * @returns {@link Amity.Unsubscriber} to unsubscribe from collection
25707
25810
  *
25708
25811
  * @category Post API
@@ -25725,7 +25828,7 @@ const getBlockedUsers$1 = (params, callback, config) => {
25725
25828
  const users = (_a = data.data
25726
25829
  .map(userId => pullFromCache(['user', 'get', userId]))
25727
25830
  .filter(Boolean)
25728
- .map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
25831
+ .map(({ data }) => LinkedObject.user(data))) !== null && _a !== void 0 ? _a : [];
25729
25832
  callback({
25730
25833
  onNextPage: onFetch,
25731
25834
  data: users,
@@ -25795,7 +25898,7 @@ const getBlockedUsers = (params, callback, config) => {
25795
25898
  *
25796
25899
  * Follow the user
25797
25900
  *
25798
- * @param userId the ID of the {@link Amity.User}
25901
+ * @param userId the ID of the {@link Amity.InternalUser}
25799
25902
  * @returns the status {@link Amity.FollowStatus}
25800
25903
  *
25801
25904
  * @category Follow API
@@ -25828,8 +25931,8 @@ const follow = async (userId) => {
25828
25931
  *
25829
25932
  * Cancel the follow request or unfollow the user
25830
25933
  *
25831
- * @param userId the ID of the {@link Amity.User}
25832
- * @returns A success boolean if the user {@link Amity.User} was unfollowed
25934
+ * @param userId the ID of the {@link Amity.InternalUser}
25935
+ * @returns A success boolean if the user {@link Amity.InternalUser} was unfollowed
25833
25936
  *
25834
25937
  * @category Follow API
25835
25938
  * @async
@@ -25857,7 +25960,7 @@ const unfollow = async (userId) => {
25857
25960
  *
25858
25961
  * Accept the follow request
25859
25962
  *
25860
- * @param userId the ID of the {@link Amity.User} follower
25963
+ * @param userId the ID of the {@link Amity.InternalUser} follower
25861
25964
  * @returns A success boolean if the follow request was accepted
25862
25965
  *
25863
25966
  * @category Follow API
@@ -25885,7 +25988,7 @@ const acceptFollower = async (userId) => {
25885
25988
  *
25886
25989
  * Accept the follow request
25887
25990
  *
25888
- * @param userId the ID of the {@link Amity.User} follower
25991
+ * @param userId the ID of the {@link Amity.InternalUser} follower
25889
25992
  * @returns A success boolean if the follow request was accepted
25890
25993
  *
25891
25994
  * @category Follow API
@@ -25914,7 +26017,7 @@ const acceptMyFollower = async (userId) => {
25914
26017
  *
25915
26018
  * Decline the follow request or delete the follower
25916
26019
  *
25917
- * @param userId the ID of the {@link Amity.User} follower
26020
+ * @param userId the ID of the {@link Amity.InternalUser} follower
25918
26021
  * @returns A success boolean if the follow request was decline
25919
26022
  *
25920
26023
  * @category Follow API
@@ -25942,7 +26045,7 @@ const declineFollower = async (userId) => {
25942
26045
  *
25943
26046
  * Decline the follow request or delete the follower
25944
26047
  *
25945
- * @param userId the ID of the {@link Amity.User} follower
26048
+ * @param userId the ID of the {@link Amity.InternalUser} follower
25946
26049
  * @returns A success boolean if the follow request was decline
25947
26050
  *
25948
26051
  * @category Follow API
@@ -26111,7 +26214,7 @@ const onFollowRequestDeclined = (callback) => createFollowEventSubscriber('follo
26111
26214
  *
26112
26215
  * Fetches the number of followers, followings, pending requests and the follow status for current user
26113
26216
  *
26114
- * @param userId the ID of the {@link Amity.User}
26217
+ * @param userId the ID of the {@link Amity.InternalUser}
26115
26218
  * @returns the associated {@link Amity.FollowInfo} object
26116
26219
  *
26117
26220
  * @category Follow API
@@ -26143,7 +26246,7 @@ const getFollowInfo$1 = async (userId) => {
26143
26246
  *
26144
26247
  * Fetches the number of followers, followings, pending requests and the follow status for current user from cache
26145
26248
  *
26146
- * @param userId the ID of the {@link Amity.User}
26249
+ * @param userId the ID of the {@link Amity.InternalUser}
26147
26250
  * @returns the associated {@link Amity.FollowInfo} object
26148
26251
  *
26149
26252
  * @category Follow API
@@ -26255,7 +26358,7 @@ const observeFollowInfo = (userId, callback, policy = 'cache_then_server') => {
26255
26358
  *
26256
26359
  * Observe all mutations on a list of followers {@link Amity.FollowStatus} for a given user
26257
26360
  *
26258
- * @param userId the ID of the {@link Amity.User}
26361
+ * @param userId the ID of the {@link Amity.InternalUser}
26259
26362
  * @param callback the function to call when new data are available
26260
26363
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the messages
26261
26364
  *
@@ -26294,7 +26397,7 @@ const observeFollowers = (userId, callback) => {
26294
26397
  *
26295
26398
  * Observe all mutations on a list of followings {@link Amity.FollowStatus} for a given user
26296
26399
  *
26297
- * @param userId the ID of the {@link Amity.User}
26400
+ * @param userId the ID of the {@link Amity.InternalUser}
26298
26401
  * @param callback the function to call when new data are available
26299
26402
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the messages
26300
26403
  *
@@ -26412,7 +26515,7 @@ queryFollowers.locally = (query) => queryFollows.locally('followers', query);
26412
26515
  *
26413
26516
  * let followers = []
26414
26517
  * const unsub = getFollowers({
26415
- * userId: Amity.User['userId'];
26518
+ * userId: Amity.InternalUser['userId'];
26416
26519
  * }, response => merge(followers, response.data))
26417
26520
  * ```
26418
26521
  *
@@ -26536,7 +26639,7 @@ queryFollowings.locally = (query) => queryFollows.locally('following', query);
26536
26639
  *
26537
26640
  * let followings = []
26538
26641
  * const unsub = getFollowings({
26539
- * userId: Amity.User['userId'];
26642
+ * userId: Amity.InternalUser['userId'];
26540
26643
  * }, response => merge(followings, response.data))
26541
26644
  * ```
26542
26645
  *
@@ -26740,7 +26843,7 @@ const getUserByIds = async (userIds) => {
26740
26843
  ingestInCache(data, { cachedAt });
26741
26844
  fireEvent('user.fetched', data);
26742
26845
  return {
26743
- data: data.users,
26846
+ data: data.users.map(user => LinkedObject.user(user)),
26744
26847
  cachedAt,
26745
26848
  };
26746
26849
  };
@@ -26767,7 +26870,7 @@ getUserByIds.locally = (userIds) => {
26767
26870
  const cached = userIds
26768
26871
  .map(userId => pullFromCache(['user', 'get', userId]))
26769
26872
  .filter(Boolean);
26770
- const users = cached.map(({ data }) => data);
26873
+ const users = cached.map(({ data }) => LinkedObject.user(data));
26771
26874
  const oldest = (_a = cached.sort((a, b) => (a.cachedAt < b.cachedAt ? -1 : 1))) === null || _a === void 0 ? void 0 : _a[0];
26772
26875
  if ((cached === null || cached === void 0 ? void 0 : cached.length) < userIds.length)
26773
26876
  return;
@@ -26786,11 +26889,11 @@ getUserByIds.locally = (userIds) => {
26786
26889
  * const updated = await updateUser(userId, { displayName: 'foobar' })
26787
26890
  * ```
26788
26891
  *
26789
- * Updates an {@link Amity.User}
26892
+ * Updates an {@link Amity.InternalUser}
26790
26893
  *
26791
- * @param userId The ID of the {@link Amity.User} to update
26894
+ * @param userId The ID of the {@link Amity.InternalUser} to update
26792
26895
  * @param patch The patch data to apply
26793
- * @returns the updated {@link Amity.User} object
26896
+ * @returns the updated {@link Amity.InternalUser} object
26794
26897
  *
26795
26898
  * @category User API
26796
26899
  * @async
@@ -26902,7 +27005,7 @@ const isUserFlaggedByMe = async (userId) => {
26902
27005
  * })
26903
27006
  * ```
26904
27007
  *
26905
- * Fired when a {@link Amity.User} has been updated
27008
+ * Fired when a {@link Amity.InternalUser} has been updated
26906
27009
  *
26907
27010
  * @param callback The function to call when the event was fired
26908
27011
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -26919,7 +27022,7 @@ const onUserUpdated = (callback) => createUserEventSubscriber('user.updated', ca
26919
27022
  * })
26920
27023
  * ```
26921
27024
  *
26922
- * Fired when a {@link Amity.User} has been flagged
27025
+ * Fired when a {@link Amity.InternalUser} has been flagged
26923
27026
  *
26924
27027
  * @param callback The function to call when the event was fired
26925
27028
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -26936,7 +27039,7 @@ const onUserFlagged = (callback) => createUserEventSubscriber('user.flagged', ca
26936
27039
  * })
26937
27040
  * ```
26938
27041
  *
26939
- * Fired when a flag has been removed from a {@link Amity.User}
27042
+ * Fired when a flag has been removed from a {@link Amity.InternalUser}
26940
27043
  *
26941
27044
  * @param callback The function to call when the event was fired
26942
27045
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -26953,7 +27056,7 @@ const onUserUnflagged = (callback) => createUserEventSubscriber('user.unflagged'
26953
27056
  * })
26954
27057
  * ```
26955
27058
  *
26956
- * Fired when flags have been cleared for a {@link Amity.User}
27059
+ * Fired when flags have been cleared for a {@link Amity.InternalUser}
26957
27060
  *
26958
27061
  * @param callback The function to call when the event was fired
26959
27062
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -26970,7 +27073,7 @@ const onUserFlagCleared = (callback) => createUserEventSubscriber('user.flagClea
26970
27073
  * })
26971
27074
  * ```
26972
27075
  *
26973
- * Fired when a {@link Amity.User} has been fetched
27076
+ * Fired when a {@link Amity.InternalUser} has been fetched
26974
27077
  *
26975
27078
  * @param callback The function to call when the event was fired
26976
27079
  * @returns an {@link Amity.Unsubscriber} function to stop listening
@@ -27014,7 +27117,7 @@ const getUser$1 = async (userId) => {
27014
27117
  const { users } = data;
27015
27118
  fireEvent('user.fetched', data);
27016
27119
  return {
27017
- data: users.find(user => user.userId === userId),
27120
+ data: LinkedObject.user(users.find(user => user.userId === userId)),
27018
27121
  cachedAt,
27019
27122
  };
27020
27123
  };
@@ -27051,7 +27154,7 @@ getUser$1.locally = (userId) => {
27051
27154
  * });
27052
27155
  * ```
27053
27156
  *
27054
- * Observe all mutation on a given {@link Amity.User}
27157
+ * Observe all mutation on a given {@link Amity.InternalUser}
27055
27158
  *
27056
27159
  * @param userId the ID of the user to observe
27057
27160
  * @param callback the function to call when new data are available
@@ -27077,11 +27180,11 @@ const getUser = (userId, callback) => {
27077
27180
  * const { data: users, prevPage, nextPage } = await queryUsers({ displayName: 'foo' })
27078
27181
  * ```
27079
27182
  *
27080
- * Queries a paginable list of {@link Amity.User} objects
27183
+ * Queries a paginable list of {@link Amity.InternalUser} objects
27081
27184
  * Search is performed by displayName such as `.startsWith(search)`
27082
27185
  *
27083
27186
  * @param query The query parameters
27084
- * @returns A page of {@link Amity.User} objects
27187
+ * @returns A page of {@link Amity.InternalUser} objects
27085
27188
  *
27086
27189
  * @category User API
27087
27190
  * @async
@@ -27112,7 +27215,7 @@ const queryUsers = async (query = {}) => {
27112
27215
  fireEvent('user.fetched', data);
27113
27216
  const prevPage = toPage(paging.previous);
27114
27217
  const nextPage = toPage(paging.next);
27115
- return { data: users, cachedAt, prevPage, nextPage };
27218
+ return { data: users.map(user => LinkedObject.user(user)), cachedAt, prevPage, nextPage };
27116
27219
  };
27117
27220
  /**
27118
27221
  * ```js
@@ -27120,11 +27223,11 @@ const queryUsers = async (query = {}) => {
27120
27223
  * const { data: users } = queryUsers.locally({ keyword: 'foo' })
27121
27224
  * ```
27122
27225
  *
27123
- * Queries a paginable list of {@link Amity.User} objects from cache
27226
+ * Queries a paginable list of {@link Amity.InternalUser} objects from cache
27124
27227
  * Search is performed by displayName such as `.startsWith(search)`
27125
27228
  *
27126
27229
  * @param query The query parameters
27127
- * @returns A page of {@link Amity.User} objects
27230
+ * @returns A page of {@link Amity.InternalUser} objects
27128
27231
  *
27129
27232
  * @category User API
27130
27233
  */
@@ -27208,7 +27311,7 @@ const getUsers = (params, callback, config) => {
27208
27311
  const users = (_a = data.data
27209
27312
  .map(userId => pullFromCache(['user', 'get', userId]))
27210
27313
  .filter(Boolean)
27211
- .map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
27314
+ .map(({ data }) => LinkedObject.user(data))) !== null && _a !== void 0 ? _a : [];
27212
27315
  callback({
27213
27316
  onNextPage: onFetch,
27214
27317
  /*
@@ -27271,7 +27374,7 @@ const getUsers = (params, callback, config) => {
27271
27374
  * @param callback the function to call when new data are available
27272
27375
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the user
27273
27376
  *
27274
- * Observe all mutation on a given {@link Amity.User}
27377
+ * Observe all mutation on a given {@link Amity.InternalUser}
27275
27378
  * @category User Observer
27276
27379
  */
27277
27380
  const observeUser = (userId, callback) => {
@@ -27284,11 +27387,12 @@ const observeUser = (userId, callback) => {
27284
27387
  // filter function
27285
27388
  if (((_a = result.data) === null || _a === void 0 ? void 0 : _a.userId) !== userId)
27286
27389
  return;
27390
+ const newResult = Object.assign(Object.assign({}, result), { data: LinkedObject.user(result.data) });
27287
27391
  if (callback instanceof Function)
27288
- return callback(result);
27392
+ return callback(newResult);
27289
27393
  if (action !== 'onFetch')
27290
- (_b = callback.onEvent) === null || _b === void 0 ? void 0 : _b.call(callback, action, result);
27291
- (_c = callback[action]) === null || _c === void 0 ? void 0 : _c.call(callback, result);
27394
+ (_b = callback.onEvent) === null || _b === void 0 ? void 0 : _b.call(callback, action, newResult);
27395
+ (_c = callback[action]) === null || _c === void 0 ? void 0 : _c.call(callback, newResult);
27292
27396
  };
27293
27397
  const disposers = [];
27294
27398
  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')));
@@ -27310,7 +27414,7 @@ const observeUser = (userId, callback) => {
27310
27414
  * const unsub = UserRepository.searchUserByDisplayName({}, response => merge(users, response.data))
27311
27415
  * ```
27312
27416
  *
27313
- * Observe all mutations on a list of {@link Amity.User}s
27417
+ * Observe all mutations on a list of {@link Amity.InternalUser}s
27314
27418
  *
27315
27419
  * @param params for searching users
27316
27420
  * @param callback the function to call when new data are available
@@ -28011,35 +28115,6 @@ getPost$1.locally = (postId) => {
28011
28115
  };
28012
28116
  };
28013
28117
 
28014
- const commentLinkedObject = (comment) => {
28015
- return Object.assign(Object.assign({}, comment), { get target() {
28016
- const commentTypes = {
28017
- type: comment.targetType,
28018
- };
28019
- if (comment.targetType === 'user') {
28020
- return Object.assign(Object.assign({}, commentTypes), { userId: comment.targetId });
28021
- }
28022
- if (commentTypes.type === 'content') {
28023
- return Object.assign(Object.assign({}, commentTypes), { contentId: comment.targetId });
28024
- }
28025
- if (commentTypes.type === 'community') {
28026
- const cacheData = pullFromCache([
28027
- 'communityUsers',
28028
- 'get',
28029
- `${comment.targetId}#${comment.userId}`,
28030
- ]);
28031
- return Object.assign(Object.assign({}, commentTypes), { communityId: comment.targetId, creatorMember: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data });
28032
- }
28033
- return {
28034
- type: 'unknown',
28035
- };
28036
- } });
28037
- };
28038
-
28039
- const LinkedObject = {
28040
- comment: commentLinkedObject,
28041
- };
28042
-
28043
28118
  /**
28044
28119
  * ```js
28045
28120
  * import { CommentRepository } from '@amityco/ts-sdk'
@@ -29706,10 +29781,10 @@ const markAsDelivered = async (subChannelId, messageId) => {
29706
29781
  * })
29707
29782
  * ```
29708
29783
  *
29709
- * Queries a paginable list of read {@link Amity.User} by messageId
29784
+ * Queries a paginable list of read {@link Amity.InternalUser} by messageId
29710
29785
  *
29711
29786
  * @param query The query parameters
29712
- * @returns A page of {@link Amity.User} objects
29787
+ * @returns A page of {@link Amity.InternalUser} objects
29713
29788
  *
29714
29789
  * @category Message API
29715
29790
  * @async
@@ -29751,10 +29826,10 @@ const getReadUsers = async (query) => {
29751
29826
  * })
29752
29827
  * ```
29753
29828
  *
29754
- * Queries a paginable list of read {@link Amity.User} objects from cache
29829
+ * Queries a paginable list of read {@link Amity.InternalUser} objects from cache
29755
29830
  *
29756
29831
  * @param query The query parameters
29757
- * @returns A page of {@link Amity.User} objects
29832
+ * @returns A page of {@link Amity.InternalUser} objects
29758
29833
  *
29759
29834
  * @category Message API
29760
29835
  */
@@ -29787,10 +29862,10 @@ getReadUsers.locally = (query) => {
29787
29862
  * })
29788
29863
  * ```
29789
29864
  *
29790
- * Queries a paginable list of delivered {@link Amity.User} by messageId
29865
+ * Queries a paginable list of delivered {@link Amity.InternalUser} by messageId
29791
29866
  *
29792
29867
  * @param query The query parameters
29793
- * @returns A page of {@link Amity.User} objects
29868
+ * @returns A page of {@link Amity.InternalUser} objects
29794
29869
  *
29795
29870
  * @category Message API
29796
29871
  * @async
@@ -29831,10 +29906,10 @@ const getDeliveredUsers = async (query) => {
29831
29906
  * })
29832
29907
  * ```
29833
29908
  *
29834
- * Queries a paginable list of delivered {@link Amity.User} objects from cache
29909
+ * Queries a paginable list of delivered {@link Amity.InternalUser} objects from cache
29835
29910
  *
29836
29911
  * @param query The query parameters
29837
- * @returns A page of {@link Amity.User} objects
29912
+ * @returns A page of {@link Amity.InternalUser} objects
29838
29913
  *
29839
29914
  * @category Message API
29840
29915
  */
@@ -32127,12 +32202,12 @@ const getRecommendedCommunities = (params, callback, config) => {
32127
32202
  * const updated = await CommunityRepository.moderation.addRoles(communityId, ['foo', 'bar'])
32128
32203
  * ```
32129
32204
  *
32130
- * Adds a list of {@link Amity.Role} to a list of {@link Amity.User} on a {@link Amity.Community}
32205
+ * Adds a list of {@link Amity.Role} to a list of {@link Amity.InternalUser} on a {@link Amity.Community}
32131
32206
  *
32132
32207
  * @param communityId The ID of the {@link Amity.Community} to perform
32133
32208
  * @param roleIds Array of IDs of the {@link Amity.Role} to apply
32134
- * @param userIds Array of IDs of the {@link Amity.User} to perform
32135
- * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Community}
32209
+ * @param userIds Array of IDs of the {@link Amity.InternalUser} to perform
32210
+ * @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.InternalUser} in the {@link Amity.Community}
32136
32211
  *
32137
32212
  * @category Community API
32138
32213
  * @async
@@ -32159,12 +32234,12 @@ const addRoles = async (communityId, roleIds, userIds) => {
32159
32234
  * const updated = await CommunityRepository.moderation.removeRoles(communityId, ['foo', 'bar'])
32160
32235
  * ```
32161
32236
  *
32162
- * Removes a list of {@link Amity.Role} from a list of {@link Amity.User} on a {@link Amity.Community}
32237
+ * Removes a list of {@link Amity.Role} from a list of {@link Amity.InternalUser} on a {@link Amity.Community}
32163
32238
  *
32164
32239
  * @param communityId The ID of the {@link Amity.Community} to perform
32165
32240
  * @param roleIds Array of IDs of the {@link Amity.Role} to apply
32166
- * @param userIds Array of IDs of the {@link Amity.User} to perform
32167
- * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Community}
32241
+ * @param userIds Array of IDs of the {@link Amity.InternalUser} to perform
32242
+ * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.InternalUser} in the {@link Amity.Community}
32168
32243
  *
32169
32244
  * @category Community API
32170
32245
  * @async
@@ -32193,7 +32268,7 @@ const removeRoles = async (communityId, roleIds, userIds) => {
32193
32268
  * ```
32194
32269
  *
32195
32270
  * @param communityId of {@link Amity.Community} from which the users should be banned
32196
- * @param userIds of the {@link Amity.User}'s to be banned
32271
+ * @param userIds of the {@link Amity.InternalUser}'s to be banned
32197
32272
  * @returns the updated {@link Amity.Membership}'s object
32198
32273
  *
32199
32274
  * @category Community API
@@ -32228,7 +32303,7 @@ const banMembers = async (communityId, userIds) => {
32228
32303
  * ```
32229
32304
  *
32230
32305
  * @param communityId of {@link Amity.Community} from which the users should be unbanned
32231
- * @param userIds of the {@link Amity.User}'s to be unbanned
32306
+ * @param userIds of the {@link Amity.InternalUser}'s to be unbanned
32232
32307
  * @returns the updated {@link Amity.Membership}'s object
32233
32308
  *
32234
32309
  * @category Community API
@@ -32269,11 +32344,11 @@ var index$9 = /*#__PURE__*/Object.freeze({
32269
32344
  * const updated = await CommunityRepository.moderation.addMembers(communityId, ['foo', 'bar'])
32270
32345
  * ```
32271
32346
  *
32272
- * Adds a list of {@link Amity.User} to a {@link Amity.Community} to add users to
32347
+ * Adds a list of {@link Amity.InternalUser} to a {@link Amity.Community} to add users to
32273
32348
  *
32274
32349
  * @param communityId The ID of the {@link Amity.Community} to perform
32275
- * @param userIds The list of IDs {@link Amity.User} to add
32276
- * @returns A success boolean if the {@link Amity.User} were added to the {@link Amity.Community}
32350
+ * @param userIds The list of IDs {@link Amity.InternalUser} to add
32351
+ * @returns A success boolean if the {@link Amity.InternalUser} were added to the {@link Amity.Community}
32277
32352
  *
32278
32353
  * @category Community API
32279
32354
  * @async
@@ -32300,11 +32375,11 @@ const addMembers = async (communityId, userIds) => {
32300
32375
  * const updated = await CommunityRepository.moderation.removeMembers(communityId, ['foo', 'bar'])
32301
32376
  * ```
32302
32377
  *
32303
- * Removes a list of {@link Amity.User} from a {@link Amity.Community}
32378
+ * Removes a list of {@link Amity.InternalUser} from a {@link Amity.Community}
32304
32379
  *
32305
32380
  * @param communityId The ID of the {@link Amity.Community} to edit
32306
- * @param userIds The list of IDs {@link Amity.User} to remove
32307
- * @returns A success boolean if the list of {@link Amity.User} were removed from the {@link Amity.Community}
32381
+ * @param userIds The list of IDs {@link Amity.InternalUser} to remove
32382
+ * @returns A success boolean if the list of {@link Amity.InternalUser} were removed from the {@link Amity.Community}
32308
32383
  *
32309
32384
  * @category Community API
32310
32385
  * @async
@@ -32589,7 +32664,7 @@ const getCategory = async (categoryId) => {
32589
32664
  ingestInCache(data, { cachedAt });
32590
32665
  const { categories } = data;
32591
32666
  return {
32592
- data: categories.find(category => category.categoryId === categoryId),
32667
+ data: categoryLinkedObject(categories.find(category => category.categoryId === categoryId)),
32593
32668
  cachedAt,
32594
32669
  };
32595
32670
  };
@@ -32658,7 +32733,12 @@ const queryCategories = async (query) => {
32658
32733
  }
32659
32734
  const nextPage = toPage(paging.next);
32660
32735
  const prevPage = toPage(paging.previous);
32661
- return { data: categories, cachedAt, prevPage, nextPage };
32736
+ return {
32737
+ data: categories.map(category => LinkedObject.category(category)),
32738
+ cachedAt,
32739
+ prevPage,
32740
+ nextPage,
32741
+ };
32662
32742
  };
32663
32743
  /**
32664
32744
  * ```js
@@ -32731,7 +32811,7 @@ const getCategories = (params, callback, config) => {
32731
32811
  let categories = (_a = data.data
32732
32812
  .map(categoryId => pullFromCache(['category', 'get', categoryId]))
32733
32813
  .filter(Boolean)
32734
- .map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
32814
+ .map(({ data }) => LinkedObject.category(data))) !== null && _a !== void 0 ? _a : [];
32735
32815
  if (!params.includeDeleted) {
32736
32816
  categories = filterByPropEquality(categories, 'isDeleted', false);
32737
32817
  }
@@ -35537,7 +35617,7 @@ const getPlayer = async (parameters) => {
35537
35617
  hls.loadSource(url);
35538
35618
  }
35539
35619
  else {
35540
- const recording = recordings[0];
35620
+ const recording = recordings.find(rec => !!rec.mp4);
35541
35621
  if (!recording || !recording.mp4) {
35542
35622
  throw new Error('No playable recording available');
35543
35623
  }