@amityco/ts-sdk 7.11.1-31db2c1f.0 → 7.11.1-352154bf.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 (223) hide show
  1. package/dist/@types/core/events.d.ts +41 -5
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/model.d.ts +6 -1
  4. package/dist/@types/core/model.d.ts.map +1 -1
  5. package/dist/@types/core/payload.d.ts +46 -0
  6. package/dist/@types/core/payload.d.ts.map +1 -1
  7. package/dist/@types/core/permissions.d.ts +5 -1
  8. package/dist/@types/core/permissions.d.ts.map +1 -1
  9. package/dist/@types/core/transport.d.ts +3 -0
  10. package/dist/@types/core/transport.d.ts.map +1 -1
  11. package/dist/@types/domains/community.d.ts +14 -1
  12. package/dist/@types/domains/community.d.ts.map +1 -1
  13. package/dist/@types/domains/event.d.ts +122 -0
  14. package/dist/@types/domains/event.d.ts.map +1 -0
  15. package/dist/@types/domains/notification.d.ts +6 -2
  16. package/dist/@types/domains/notification.d.ts.map +1 -1
  17. package/dist/@types/domains/partials.d.ts +2 -2
  18. package/dist/@types/domains/partials.d.ts.map +1 -1
  19. package/dist/@types/domains/room.d.ts +18 -3
  20. package/dist/@types/domains/room.d.ts.map +1 -1
  21. package/dist/@types/index.d.ts +1 -0
  22. package/dist/@types/index.d.ts.map +1 -1
  23. package/dist/client/api/getPresenceSetting.d.ts +2 -0
  24. package/dist/client/api/getPresenceSetting.d.ts.map +1 -0
  25. package/dist/client/api/resumeSession.d.ts.map +1 -1
  26. package/dist/client/events/onUserDeleted.d.ts +17 -0
  27. package/dist/client/events/onUserDeleted.d.ts.map +1 -0
  28. package/dist/client/services/ObjectResolver/objectResolverEngine.d.ts.map +1 -0
  29. package/dist/client/services/ObjectResolver/objectResolverEngineOnLoginHandler.d.ts.map +1 -0
  30. package/dist/client/services/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +1 -0
  31. package/dist/client/services/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +1 -0
  32. package/dist/client/services/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -0
  33. package/dist/client/services/ReadReceiptSync/readReceiptSyncEngineOnLoginHandler.d.ts.map +1 -0
  34. package/dist/core/events.d.ts +3 -3
  35. package/dist/core/events.d.ts.map +1 -1
  36. package/dist/core/model/idResolvers.d.ts.map +1 -1
  37. package/dist/core/model/index.d.ts.map +1 -1
  38. package/dist/eventRepository/api/createEvent.d.ts +16 -0
  39. package/dist/eventRepository/api/createEvent.d.ts.map +1 -0
  40. package/dist/eventRepository/api/deleteEvent.d.ts +15 -0
  41. package/dist/eventRepository/api/deleteEvent.d.ts.map +1 -0
  42. package/dist/eventRepository/api/index.d.ts +4 -0
  43. package/dist/eventRepository/api/index.d.ts.map +1 -0
  44. package/dist/eventRepository/api/updateEvent.d.ts +17 -0
  45. package/dist/eventRepository/api/updateEvent.d.ts.map +1 -0
  46. package/dist/eventRepository/events/enums.d.ts +8 -0
  47. package/dist/eventRepository/events/enums.d.ts.map +1 -0
  48. package/dist/eventRepository/events/index.d.ts +11 -0
  49. package/dist/eventRepository/events/index.d.ts.map +1 -0
  50. package/dist/eventRepository/events/onEventCreated.d.ts +17 -0
  51. package/dist/eventRepository/events/onEventCreated.d.ts.map +1 -0
  52. package/dist/eventRepository/events/onEventDeleted.d.ts +17 -0
  53. package/dist/eventRepository/events/onEventDeleted.d.ts.map +1 -0
  54. package/dist/eventRepository/events/onEventUpdated.d.ts +17 -0
  55. package/dist/eventRepository/events/onEventUpdated.d.ts.map +1 -0
  56. package/dist/eventRepository/events/onLocalEventCreated.d.ts +17 -0
  57. package/dist/eventRepository/events/onLocalEventCreated.d.ts.map +1 -0
  58. package/dist/eventRepository/events/onLocalEventDeleted.d.ts +17 -0
  59. package/dist/eventRepository/events/onLocalEventDeleted.d.ts.map +1 -0
  60. package/dist/eventRepository/events/onLocalEventUpdated.d.ts +17 -0
  61. package/dist/eventRepository/events/onLocalEventUpdated.d.ts.map +1 -0
  62. package/dist/eventRepository/events/onLocalRSVPCreated.d.ts +17 -0
  63. package/dist/eventRepository/events/onLocalRSVPCreated.d.ts.map +1 -0
  64. package/dist/eventRepository/events/onLocalRSVPUpdated.d.ts +17 -0
  65. package/dist/eventRepository/events/onLocalRSVPUpdated.d.ts.map +1 -0
  66. package/dist/eventRepository/events/onRSVPCreated.d.ts +17 -0
  67. package/dist/eventRepository/events/onRSVPCreated.d.ts.map +1 -0
  68. package/dist/eventRepository/events/onRSVPUpdated.d.ts +17 -0
  69. package/dist/eventRepository/events/onRSVPUpdated.d.ts.map +1 -0
  70. package/dist/eventRepository/index.d.ts +4 -0
  71. package/dist/eventRepository/index.d.ts.map +1 -0
  72. package/dist/eventRepository/internalApi/createRSVP.d.ts +17 -0
  73. package/dist/eventRepository/internalApi/createRSVP.d.ts.map +1 -0
  74. package/dist/eventRepository/internalApi/getEvent.d.ts +32 -0
  75. package/dist/eventRepository/internalApi/getEvent.d.ts.map +1 -0
  76. package/dist/eventRepository/internalApi/getMyRSVP.d.ts +32 -0
  77. package/dist/eventRepository/internalApi/getMyRSVP.d.ts.map +1 -0
  78. package/dist/eventRepository/internalApi/index.d.ts +5 -0
  79. package/dist/eventRepository/internalApi/index.d.ts.map +1 -0
  80. package/dist/eventRepository/internalApi/updateRSVP.d.ts +17 -0
  81. package/dist/eventRepository/internalApi/updateRSVP.d.ts.map +1 -0
  82. package/dist/eventRepository/observers/getEvent.d.ts +21 -0
  83. package/dist/eventRepository/observers/getEvent.d.ts.map +1 -0
  84. package/dist/eventRepository/observers/getEvents/LiveCollectionController.d.ts +13 -0
  85. package/dist/eventRepository/observers/getEvents/LiveCollectionController.d.ts.map +1 -0
  86. package/dist/eventRepository/observers/getEvents/PaginationController.d.ts +5 -0
  87. package/dist/eventRepository/observers/getEvents/PaginationController.d.ts.map +1 -0
  88. package/dist/eventRepository/observers/getEvents/QueryStreamController.d.ts +15 -0
  89. package/dist/eventRepository/observers/getEvents/QueryStreamController.d.ts.map +1 -0
  90. package/dist/eventRepository/observers/getEvents.d.ts +12 -0
  91. package/dist/eventRepository/observers/getEvents.d.ts.map +1 -0
  92. package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts +13 -0
  93. package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts.map +1 -0
  94. package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts +5 -0
  95. package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts.map +1 -0
  96. package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts +15 -0
  97. package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts.map +1 -0
  98. package/dist/eventRepository/observers/getMyEvents.d.ts +12 -0
  99. package/dist/eventRepository/observers/getMyEvents.d.ts.map +1 -0
  100. package/dist/eventRepository/observers/getRSVPs/LiveCollectionController.d.ts +13 -0
  101. package/dist/eventRepository/observers/getRSVPs/LiveCollectionController.d.ts.map +1 -0
  102. package/dist/eventRepository/observers/getRSVPs/PaginationController.d.ts +5 -0
  103. package/dist/eventRepository/observers/getRSVPs/PaginationController.d.ts.map +1 -0
  104. package/dist/eventRepository/observers/getRSVPs/QueryStreamController.d.ts +15 -0
  105. package/dist/eventRepository/observers/getRSVPs/QueryStreamController.d.ts.map +1 -0
  106. package/dist/eventRepository/observers/getRSVPs.d.ts +12 -0
  107. package/dist/eventRepository/observers/getRSVPs.d.ts.map +1 -0
  108. package/dist/eventRepository/observers/index.d.ts +5 -0
  109. package/dist/eventRepository/observers/index.d.ts.map +1 -0
  110. package/dist/eventRepository/utils/createEventEventSubscriber.d.ts +2 -0
  111. package/dist/eventRepository/utils/createEventEventSubscriber.d.ts.map +1 -0
  112. package/dist/eventRepository/utils/createEventResponseSubscriber.d.ts +2 -0
  113. package/dist/eventRepository/utils/createEventResponseSubscriber.d.ts.map +1 -0
  114. package/dist/eventRepository/utils/index.d.ts +5 -0
  115. package/dist/eventRepository/utils/index.d.ts.map +1 -0
  116. package/dist/eventRepository/utils/prepareEventPayload.d.ts +2 -0
  117. package/dist/eventRepository/utils/prepareEventPayload.d.ts.map +1 -0
  118. package/dist/eventRepository/utils/prepareEventResponsePayload.d.ts +2 -0
  119. package/dist/eventRepository/utils/prepareEventResponsePayload.d.ts.map +1 -0
  120. package/dist/index.cjs.js +2063 -600
  121. package/dist/index.d.ts +2 -0
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.esm.js +1579 -118
  124. package/dist/index.umd.js +3 -3
  125. package/dist/invitationRepository/api/index.d.ts +0 -1
  126. package/dist/invitationRepository/api/index.d.ts.map +1 -1
  127. package/dist/invitationRepository/internalObservers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
  128. package/dist/invitationRepository/internalObservers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
  129. package/dist/invitationRepository/internalObservers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
  130. package/dist/invitationRepository/internalObservers/getInvitations/enums.d.ts.map +1 -0
  131. package/dist/invitationRepository/internalObservers/getInvitations.d.ts +12 -0
  132. package/dist/invitationRepository/internalObservers/getInvitations.d.ts.map +1 -0
  133. package/dist/invitationRepository/observers/getInvitations.d.ts +28 -6
  134. package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -1
  135. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +1 -1
  136. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -1
  137. package/dist/invitationRepository/observers/index.d.ts +1 -1
  138. package/dist/invitationRepository/observers/index.d.ts.map +1 -1
  139. package/dist/liveReactionRepository/internalApi/createLiveReaction.d.ts +2 -2
  140. package/dist/liveReactionRepository/internalApi/createLiveReaction.d.ts.map +1 -1
  141. package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +1 -1
  142. package/dist/roomPresenceRepository/api/getRoomOnlineUsers.d.ts +18 -0
  143. package/dist/roomPresenceRepository/api/getRoomOnlineUsers.d.ts.map +1 -0
  144. package/dist/roomPresenceRepository/api/getRoomUserCount.d.ts +17 -0
  145. package/dist/roomPresenceRepository/api/getRoomUserCount.d.ts.map +1 -0
  146. package/dist/roomPresenceRepository/api/index.d.ts +5 -0
  147. package/dist/roomPresenceRepository/api/index.d.ts.map +1 -0
  148. package/dist/roomPresenceRepository/api/startHeartbeat.d.ts +15 -0
  149. package/dist/roomPresenceRepository/api/startHeartbeat.d.ts.map +1 -0
  150. package/dist/roomPresenceRepository/api/stopHeartbeat.d.ts +15 -0
  151. package/dist/roomPresenceRepository/api/stopHeartbeat.d.ts.map +1 -0
  152. package/dist/roomPresenceRepository/index.d.ts +2 -0
  153. package/dist/roomPresenceRepository/index.d.ts.map +1 -0
  154. package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/RoomPresenceSyncEngine.d.ts +38 -0
  155. package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/RoomPresenceSyncEngine.d.ts.map +1 -0
  156. package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/index.d.ts +2 -0
  157. package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/index.d.ts.map +1 -0
  158. package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/roomPresenceSyncEngineFactory.d.ts +32 -0
  159. package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/roomPresenceSyncEngineFactory.d.ts.map +1 -0
  160. package/dist/roomPresenceRepository/services/index.d.ts +2 -0
  161. package/dist/roomPresenceRepository/services/index.d.ts.map +1 -0
  162. package/dist/roomRepository/api/index.d.ts +1 -0
  163. package/dist/roomRepository/api/index.d.ts.map +1 -1
  164. package/dist/roomRepository/api/leaveRoom.d.ts +16 -0
  165. package/dist/roomRepository/api/leaveRoom.d.ts.map +1 -0
  166. package/dist/roomRepository/api/removeParticipant.d.ts.map +1 -1
  167. package/dist/roomRepository/events/index.d.ts +1 -0
  168. package/dist/roomRepository/events/index.d.ts.map +1 -1
  169. package/dist/roomRepository/events/onRoomCoHostInviteAccepted.d.ts +1 -1
  170. package/dist/roomRepository/events/onRoomCoHostInviteAccepted.d.ts.map +1 -1
  171. package/dist/roomRepository/events/onRoomEndBroadcasting.d.ts +1 -1
  172. package/dist/roomRepository/events/onRoomEndBroadcasting.d.ts.map +1 -1
  173. package/dist/roomRepository/events/onRoomLeft.d.ts +17 -0
  174. package/dist/roomRepository/events/onRoomLeft.d.ts.map +1 -0
  175. package/dist/roomRepository/events/onRoomParticipantJoined.d.ts +1 -1
  176. package/dist/roomRepository/events/onRoomParticipantJoined.d.ts.map +1 -1
  177. package/dist/roomRepository/events/onRoomParticipantLeft.d.ts +1 -1
  178. package/dist/roomRepository/events/onRoomParticipantLeft.d.ts.map +1 -1
  179. package/dist/roomRepository/events/onRoomParticipantRemovedLocal.d.ts +17 -0
  180. package/dist/roomRepository/events/onRoomParticipantRemovedLocal.d.ts.map +1 -0
  181. package/dist/roomRepository/events/onRoomRecordedAvailable.d.ts +1 -1
  182. package/dist/roomRepository/events/onRoomRecordedAvailable.d.ts.map +1 -1
  183. package/dist/roomRepository/events/onRoomStartBroadcasting.d.ts +1 -1
  184. package/dist/roomRepository/events/onRoomStartBroadcasting.d.ts.map +1 -1
  185. package/dist/roomRepository/events/onRoomWaitingReconnect.d.ts +1 -1
  186. package/dist/roomRepository/events/onRoomWaitingReconnect.d.ts.map +1 -1
  187. package/dist/roomRepository/observers/getRoom.d.ts.map +1 -1
  188. package/dist/roomRepository/observers/utils.d.ts +1 -1
  189. package/dist/utils/linkedObject/eventLinkObject.d.ts +2 -0
  190. package/dist/utils/linkedObject/eventLinkObject.d.ts.map +1 -0
  191. package/dist/utils/linkedObject/eventResponseLinkObject.d.ts +2 -0
  192. package/dist/utils/linkedObject/eventResponseLinkObject.d.ts.map +1 -0
  193. package/dist/utils/linkedObject/index.d.ts +2 -0
  194. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  195. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -1
  196. package/dist/utils/linkedObject/roomLinkedObject.d.ts.map +1 -1
  197. package/package.json +1 -1
  198. package/dist/client/utils/ObjectResolver/objectResolverEngine.d.ts.map +0 -1
  199. package/dist/client/utils/ObjectResolver/objectResolverEngineOnLoginHandler.d.ts.map +0 -1
  200. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +0 -1
  201. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
  202. package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +0 -1
  203. package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
  204. package/dist/invitationRepository/api/acceptInvitation.d.ts +0 -16
  205. package/dist/invitationRepository/api/acceptInvitation.d.ts.map +0 -1
  206. package/dist/invitationRepository/api/getMyInvitation.d.ts +0 -16
  207. package/dist/invitationRepository/api/getMyInvitation.d.ts.map +0 -1
  208. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +0 -1
  209. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +0 -1
  210. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +0 -1
  211. package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +0 -1
  212. package/dist/invitationRepository/observers/observeInvitations.d.ts +0 -34
  213. package/dist/invitationRepository/observers/observeInvitations.d.ts.map +0 -1
  214. /package/dist/client/{utils → services}/ObjectResolver/objectResolverEngine.d.ts +0 -0
  215. /package/dist/client/{utils → services}/ObjectResolver/objectResolverEngineOnLoginHandler.d.ts +0 -0
  216. /package/dist/client/{utils → services}/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +0 -0
  217. /package/dist/client/{utils → services}/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +0 -0
  218. /package/dist/client/{utils → services}/ReadReceiptSync/readReceiptSyncEngine.d.ts +0 -0
  219. /package/dist/client/{utils → services}/ReadReceiptSync/readReceiptSyncEngineOnLoginHandler.d.ts +0 -0
  220. /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/InvitationsLiveCollectionController.d.ts +0 -0
  221. /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/InvitationsPaginationController.d.ts +0 -0
  222. /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/InvitationsQueryStreamController.d.ts +0 -0
  223. /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/enums.d.ts +0 -0
package/dist/index.esm.js CHANGED
@@ -73,6 +73,11 @@ const CommunityPostSettingMaps = Object.freeze({
73
73
  },
74
74
  });
75
75
  const DefaultCommunityPostSetting = 'ONLY_ADMIN_CAN_POST';
76
+ var AmityCommunityType;
77
+ (function (AmityCommunityType) {
78
+ AmityCommunityType["Default"] = "default";
79
+ AmityCommunityType["Event"] = "event";
80
+ })(AmityCommunityType || (AmityCommunityType = {}));
76
81
 
77
82
  const ContentFeedType = Object.freeze({
78
83
  STORY: 'story',
@@ -184,6 +189,39 @@ var FeedSourceEnum;
184
189
  FeedSourceEnum["User"] = "user";
185
190
  })(FeedSourceEnum || (FeedSourceEnum = {}));
186
191
 
192
+ var AmityEventType;
193
+ (function (AmityEventType) {
194
+ AmityEventType["Virtual"] = "virtual";
195
+ AmityEventType["InPerson"] = "in_person";
196
+ })(AmityEventType || (AmityEventType = {}));
197
+ var AmityEventOriginType;
198
+ (function (AmityEventOriginType) {
199
+ AmityEventOriginType["Community"] = "community";
200
+ AmityEventOriginType["User"] = "user";
201
+ })(AmityEventOriginType || (AmityEventOriginType = {}));
202
+ var AmityEventStatus;
203
+ (function (AmityEventStatus) {
204
+ AmityEventStatus["Scheduled"] = "scheduled";
205
+ AmityEventStatus["Live"] = "live";
206
+ AmityEventStatus["Ended"] = "ended";
207
+ AmityEventStatus["Cancelled"] = "cancelled";
208
+ })(AmityEventStatus || (AmityEventStatus = {}));
209
+ var AmityEventResponseStatus;
210
+ (function (AmityEventResponseStatus) {
211
+ AmityEventResponseStatus["Going"] = "going";
212
+ AmityEventResponseStatus["NotGoing"] = "not_going";
213
+ })(AmityEventResponseStatus || (AmityEventResponseStatus = {}));
214
+ var AmityEventSortOption;
215
+ (function (AmityEventSortOption) {
216
+ AmityEventSortOption["StartTime"] = "startTime";
217
+ AmityEventSortOption["CreatedAt"] = "createdAt";
218
+ })(AmityEventSortOption || (AmityEventSortOption = {}));
219
+ var AmityEventOrderOption;
220
+ (function (AmityEventOrderOption) {
221
+ AmityEventOrderOption["Ascending"] = "asc";
222
+ AmityEventOrderOption["Descending"] = "desc";
223
+ })(AmityEventOrderOption || (AmityEventOrderOption = {}));
224
+
187
225
  function getVersion() {
188
226
  try {
189
227
  // the string ''v7.11.0-esm'' should be replaced by actual value by @rollup/plugin-replace
@@ -633,6 +671,9 @@ const idResolvers = {
633
671
  invitation: ({ _id }) => _id,
634
672
  joinRequest: ({ joinRequestId }) => joinRequestId,
635
673
  room: ({ roomId }) => roomId,
674
+ viewer: ({ userId }) => userId,
675
+ event: ({ eventId }) => eventId,
676
+ eventResponse: ({ eventId }) => eventId,
636
677
  };
637
678
  /**
638
679
  * Retrieve the id resolver matching a domain name
@@ -689,6 +730,9 @@ const PAYLOAD2MODEL = {
689
730
  invitations: 'invitation',
690
731
  joinRequests: 'joinRequest',
691
732
  rooms: 'room',
733
+ events: 'event',
734
+ viewers: 'viewer',
735
+ eventResponses: 'eventResponse',
692
736
  };
693
737
  /** hidden */
694
738
  const isOutdated = (prevData, nextData) => {
@@ -1419,14 +1463,12 @@ const createEventEmitter = () => {
1419
1463
  const proxyMqttEvents = (mqttClient, emitter) => {
1420
1464
  MQTT_EVENTS.forEach(event => {
1421
1465
  mqttClient === null || mqttClient === void 0 ? void 0 : mqttClient.on(event, (...params) => {
1422
- console.log('global event received => ', event);
1423
1466
  emitter.emit(event, params.length === 1 ? params[0] : params);
1424
1467
  });
1425
1468
  });
1426
1469
  // @ts-ignore
1427
1470
  mqttClient.on('message', (topic, payload) => {
1428
1471
  const message = JSON.parse(payload.toString());
1429
- console.log('message event received => ', message.eventType, message.data);
1430
1472
  emitter.emit(message.eventType, message.data);
1431
1473
  });
1432
1474
  };
@@ -24575,11 +24617,11 @@ var objectResolverEngineOnLoginHandler = () => {
24575
24617
  * @category Live Reaction API
24576
24618
  * @async
24577
24619
  */
24578
- const createLiveReaction = async ({ reactions, roomId, }) => {
24620
+ const createLiveReaction = async ({ reactions, liveStreamId, }) => {
24579
24621
  const client = getActiveClient();
24580
24622
  client.log('live_reaction/addReaction', reactions);
24581
24623
  const { data } = await client.http.post(`/api/v1/reactions/live`, {
24582
- roomId,
24624
+ liveStreamId,
24583
24625
  reactions,
24584
24626
  });
24585
24627
  return data;
@@ -24649,7 +24691,7 @@ class LiveReactionSyncEngine {
24649
24691
  // Call server api `POST /api/v1/reactions/live` to sync live reactions
24650
24692
  Object.entries(payloads).forEach(([roomId, reactions]) => {
24651
24693
  createLiveReaction({
24652
- roomId,
24694
+ liveStreamId: roomId,
24653
24695
  reactions,
24654
24696
  });
24655
24697
  });
@@ -26571,7 +26613,7 @@ const getUserUnread = (callback) => {
26571
26613
  };
26572
26614
  };
26573
26615
 
26574
- var index$p = /*#__PURE__*/Object.freeze({
26616
+ var index$r = /*#__PURE__*/Object.freeze({
26575
26617
  __proto__: null,
26576
26618
  getActiveClient: getActiveClient,
26577
26619
  getActiveUser: getActiveUser,
@@ -27790,7 +27832,7 @@ const getMyFollowInfo = (callback) => {
27790
27832
  };
27791
27833
  /* end_public_function */
27792
27834
 
27793
- var index$o = /*#__PURE__*/Object.freeze({
27835
+ var index$q = /*#__PURE__*/Object.freeze({
27794
27836
  __proto__: null,
27795
27837
  blockUser: blockUser,
27796
27838
  unBlockUser: unBlockUser,
@@ -28435,7 +28477,7 @@ const createInvitations = async (bundle) => {
28435
28477
  * @category Invitation API
28436
28478
  * @async
28437
28479
  */
28438
- const acceptInvitation$1 = async (invitationId) => {
28480
+ const acceptInvitation = async (invitationId) => {
28439
28481
  var _a;
28440
28482
  const client = getActiveClient();
28441
28483
  client.log('invitation/acceptInvitation', invitationId);
@@ -28521,7 +28563,7 @@ const invitationLinkedObject = (invitation) => {
28521
28563
  }
28522
28564
  return undefined;
28523
28565
  }, accept: async () => {
28524
- await acceptInvitation$1(invitation._id);
28566
+ await acceptInvitation(invitation._id);
28525
28567
  }, reject: async () => {
28526
28568
  await rejectInvitation(invitation._id);
28527
28569
  } });
@@ -28772,7 +28814,7 @@ class InvitationsLiveCollectionController extends LiveCollectionController {
28772
28814
  * @category Invitation Live Collection
28773
28815
  *
28774
28816
  */
28775
- const getInvitations = (params, callback, config) => {
28817
+ const getInvitations$1 = (params, callback, config) => {
28776
28818
  const { log, cache } = getActiveClient();
28777
28819
  if (!cache) {
28778
28820
  console.log(ENABLE_CACHE_MESSAGE);
@@ -28847,7 +28889,8 @@ const roomLinkedObject = (room) => {
28847
28889
  },
28848
28890
  get user() {
28849
28891
  var _a;
28850
- return (_a = pullFromCache(['user', 'get', room.createdBy])) === null || _a === void 0 ? void 0 : _a.data;
28892
+ const user = (_a = pullFromCache(['user', 'get', room.createdBy])) === null || _a === void 0 ? void 0 : _a.data;
28893
+ return user ? userLinkedObject(user) : user;
28851
28894
  },
28852
28895
  get childRooms() {
28853
28896
  if (!room.childRoomIds || room.childRoomIds.length === 0)
@@ -28861,12 +28904,16 @@ const roomLinkedObject = (room) => {
28861
28904
  return roomLinkedObject(roomCache);
28862
28905
  })
28863
28906
  .filter(isNonNullable);
28864
- }, getLiveChat: () => getLiveChat(room), createInvitation: (userId) => createInvitations({
28907
+ }, participants: room.participants.map(participant => (Object.assign(Object.assign({}, participant), { get user() {
28908
+ var _a;
28909
+ const user = (_a = pullFromCache(['user', 'get', participant.userId])) === null || _a === void 0 ? void 0 : _a.data;
28910
+ return user ? userLinkedObject(user) : user;
28911
+ } }))), getLiveChat: () => getLiveChat(room), createInvitation: (userId) => createInvitations({
28865
28912
  type: "livestreamCohostInvite" /* InvitationTypeEnum.LivestreamCohostInvite */,
28866
28913
  targetType: 'room',
28867
28914
  targetId: room.roomId,
28868
28915
  userIds: [userId],
28869
- }), getInvitations: (params, callback) => getInvitations(Object.assign(Object.assign({}, params), { targetId: room.roomId, targetType: 'room', type: "livestreamCohostInvite" /* InvitationTypeEnum.LivestreamCohostInvite */ }), callback), getMyInvitation: async () => {
28916
+ }), getInvitations: (params, callback) => getInvitations$1(Object.assign(Object.assign({}, params), { targetId: room.roomId, targetType: 'room', type: "livestreamCohostInvite" /* InvitationTypeEnum.LivestreamCohostInvite */ }), callback), getMyInvitation: async () => {
28870
28917
  const { data } = await getInvitation({
28871
28918
  targetId: room.roomId,
28872
28919
  targetType: 'room',
@@ -29278,7 +29325,12 @@ const notificationTrayLinkedObject = (noti) => {
29278
29325
  .map(({ publicId }) => pullFromCache(['user', 'get', publicId]))
29279
29326
  .filter(isNonNullable)
29280
29327
  .map(({ data }) => data)
29281
- .map(user => userLinkedObject(user)) });
29328
+ .map(user => userLinkedObject(user)), get event() {
29329
+ const cacheData = pullFromCache(['event', 'get', noti.actionReferenceId]);
29330
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
29331
+ return;
29332
+ return cacheData.data;
29333
+ } });
29282
29334
  };
29283
29335
 
29284
29336
  /*
@@ -29865,7 +29917,7 @@ const communityLinkedObject = (community) => {
29865
29917
  userIds,
29866
29918
  });
29867
29919
  }, getMemberInvitations: (params, callback) => {
29868
- return getInvitations(Object.assign(Object.assign({}, params), { targetId: community.communityId, targetType: 'community', type: "communityMemberInvite" /* InvitationTypeEnum.CommunityMemberInvite */ }), callback);
29920
+ return getInvitations$1(Object.assign(Object.assign({}, params), { targetId: community.communityId, targetType: 'community', type: "communityMemberInvite" /* InvitationTypeEnum.CommunityMemberInvite */ }), callback);
29869
29921
  }, getInvitation: async () => {
29870
29922
  const { data } = await getInvitation({
29871
29923
  targetType: 'community',
@@ -29880,6 +29932,578 @@ const communityLinkedObject = (community) => {
29880
29932
  } });
29881
29933
  };
29882
29934
 
29935
+ const prepareEventResponsePayload = (rawPayload) => {
29936
+ return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
29937
+ };
29938
+
29939
+ const eventResponseLinkedObject = (event) => {
29940
+ return Object.assign(Object.assign({}, event), { get status() {
29941
+ return event.status;
29942
+ },
29943
+ get userId() {
29944
+ return event.userId;
29945
+ },
29946
+ get eventId() {
29947
+ return event.eventId;
29948
+ },
29949
+ get respondedAt() {
29950
+ return event.respondedAt;
29951
+ },
29952
+ get event() {
29953
+ const cacheData = pullFromCache(['event', 'get', event.eventId]);
29954
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
29955
+ return;
29956
+ return cacheData.data;
29957
+ },
29958
+ get user() {
29959
+ const cacheData = pullFromCache(['user', 'get', event.userId]);
29960
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
29961
+ return;
29962
+ return userLinkedObject(cacheData.data);
29963
+ } });
29964
+ };
29965
+
29966
+ /* begin_public_function
29967
+ id: event.rsvp.create
29968
+ */
29969
+ /**
29970
+ * ```js
29971
+ * import { event } from '@amityco/ts-sdk'
29972
+ * const response = await event.createRSVP(eventId, status)
29973
+ * ```
29974
+ *
29975
+ * Creates an {@link Amity.EventResponse} for the active user for a specific event.
29976
+ *
29977
+ * @param eventId The ID of the {@link Amity.EventResponse} to create an RSVP for
29978
+ * @param status The RSVP status to set for the event
29979
+ * @returns The {@link Amity.EventResponse} with updated RSVP information
29980
+ *
29981
+ * @category Event API
29982
+ * @async
29983
+ */
29984
+ const createRSVP = async (eventId, status) => {
29985
+ const client = getActiveClient();
29986
+ client.log('event/createRSVP', eventId, status);
29987
+ const { data: payload } = await client.http.post(`/api/v1/events/${eventId}/rsvp`, { status });
29988
+ fireEvent('local.rsvp.created', payload);
29989
+ const data = prepareEventResponsePayload(payload);
29990
+ const cachedAt = client.cache && Date.now();
29991
+ if (client.cache)
29992
+ ingestInCache(data, { cachedAt });
29993
+ return {
29994
+ data: eventResponseLinkedObject(data.eventResponses[0]),
29995
+ cachedAt,
29996
+ };
29997
+ };
29998
+ /* end_public_function */
29999
+
30000
+ /* begin_public_function
30001
+ id: event.update
30002
+ */
30003
+ /**
30004
+ * ```js
30005
+ * import { event } from '@amityco/ts-sdk'
30006
+ * const response = await event.updateRSVP(eventId, status)
30007
+ * ```
30008
+ *
30009
+ * Updates an {@link Amity.EventResponse}
30010
+ *
30011
+ * @param eventId The ID of the {@link Amity.EventResponse} to edit
30012
+ * @param bundle The data necessary to update an existing {@link Amity.EventResponse}
30013
+ * @returns the updated {@link Amity.EventResponse}
30014
+ *
30015
+ * @category Event API
30016
+ * @async
30017
+ */
30018
+ const updateRSVP = async (eventId, status) => {
30019
+ const client = getActiveClient();
30020
+ client.log('event/updateRSVP', eventId, status);
30021
+ const { data: payload } = await client.http.put(`/api/v1/events/${eventId}/rsvp`, { status });
30022
+ fireEvent('local.rsvp.updated', payload);
30023
+ const data = prepareEventResponsePayload(payload);
30024
+ const cachedAt = client.cache && Date.now();
30025
+ if (client.cache)
30026
+ ingestInCache(data, { cachedAt });
30027
+ return {
30028
+ data: eventResponseLinkedObject(data.eventResponses[0]),
30029
+ cachedAt,
30030
+ };
30031
+ };
30032
+ /* end_public_function */
30033
+
30034
+ const prepareEventPayload = (rawPayload) => {
30035
+ return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
30036
+ };
30037
+
30038
+ const createEventEventSubscriber = (event, callback) => {
30039
+ const client = getActiveClient();
30040
+ const filter = (payload) => {
30041
+ const unpackedPayload = prepareEventPayload(payload);
30042
+ if (!client.cache) {
30043
+ callback(unpackedPayload.events[0]);
30044
+ }
30045
+ else {
30046
+ ingestInCache(unpackedPayload);
30047
+ const event = pullFromCache([
30048
+ 'event',
30049
+ 'get',
30050
+ unpackedPayload.events[0].eventId,
30051
+ ]);
30052
+ callback(event.data);
30053
+ }
30054
+ };
30055
+ return createEventSubscriber(client, event, event, filter);
30056
+ };
30057
+
30058
+ const createEventResponseSubscriber = (event, callback) => {
30059
+ const client = getActiveClient();
30060
+ const filter = (payload) => {
30061
+ const unpackedPayload = prepareEventResponsePayload(payload);
30062
+ if (!client.cache) {
30063
+ callback(unpackedPayload);
30064
+ }
30065
+ else {
30066
+ ingestInCache(unpackedPayload.event[0]);
30067
+ const eventResponse = pullFromCache([
30068
+ 'eventResponse',
30069
+ 'get',
30070
+ payload.eventResponses[0].eventId,
30071
+ ]);
30072
+ callback(eventResponse.data);
30073
+ }
30074
+ };
30075
+ return createEventSubscriber(client, event, event, filter);
30076
+ };
30077
+
30078
+ /* begin_public_function
30079
+ id: event.rsvp.me
30080
+ */
30081
+ /**
30082
+ * ```js
30083
+ * import { event } from '@amityco/ts-sdk'
30084
+ * const myRSVP = await event.getMyRSVP()
30085
+ * ```
30086
+ *
30087
+ * Joins a {@link Amity.EventResponse} object
30088
+ *
30089
+ * @param eventId the {@link Amity.EventResponse} to get RSVP for
30090
+ * @returns A success boolean if the {@link Amity.EventResponse} RSVP was retrieved
30091
+ *
30092
+ * @category Event API
30093
+ * @async
30094
+ */
30095
+ const getMyRSVP = async (eventId) => {
30096
+ const client = getActiveClient();
30097
+ client.log('event/getMyRSVP', eventId);
30098
+ const { data: payload } = await client.http.get(`/api/v1/events/${eventId}/me/rsvp`);
30099
+ const data = prepareEventResponsePayload(payload);
30100
+ const cachedAt = client.cache && Date.now();
30101
+ if (client.cache)
30102
+ ingestInCache(data, { cachedAt });
30103
+ return {
30104
+ data: eventResponseLinkedObject(data.eventResponses[0]),
30105
+ cachedAt,
30106
+ };
30107
+ };
30108
+ /* end_public_function */
30109
+ /**
30110
+ * ```js
30111
+ * import { event } from '@amityco/ts-sdk'
30112
+ * const event = event.getMyRSVP.locally(eventId)
30113
+ * ```
30114
+ *
30115
+ * Fetches a {@link Amity.EventResponse} object in cache
30116
+ *
30117
+ * @param eventId the ID of the {@link Amity.EventResponse} to fetch
30118
+ * @returns the associated {@link Amity.EventResponse} object
30119
+ *
30120
+ * @category Event API
30121
+ */
30122
+ getMyRSVP.locally = (eventId) => {
30123
+ const client = getActiveClient();
30124
+ client.log('event/getMyRSVP.locally', eventId);
30125
+ if (!client.cache)
30126
+ return;
30127
+ const cache = pullFromCache(['event', 'getMyRSVP', eventId]);
30128
+ if (!cache)
30129
+ return;
30130
+ return {
30131
+ data: cache.data,
30132
+ cachedAt: cache.cachedAt,
30133
+ };
30134
+ };
30135
+
30136
+ var EventActionsEnum;
30137
+ (function (EventActionsEnum) {
30138
+ EventActionsEnum["OnEventCreated"] = "onEventCreated";
30139
+ EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
30140
+ EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
30141
+ EventActionsEnum["OnRSVPCreated"] = "onRSVPCreated";
30142
+ EventActionsEnum["OnRSVPUpdated"] = "onRSVPUpdated";
30143
+ })(EventActionsEnum || (EventActionsEnum = {}));
30144
+
30145
+ class RSVPPaginationController extends PaginationController {
30146
+ async getRequest(queryParams, token) {
30147
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, eventId } = queryParams, params = __rest(queryParams, ["limit", "eventId"]);
30148
+ const options = token ? { token } : { limit };
30149
+ const { data: response } = await this.http.get(`/api/v1/events/${eventId}/rsvp`, { params: Object.assign(Object.assign({}, params), { options }) });
30150
+ return response;
30151
+ }
30152
+ }
30153
+
30154
+ class RSVPQueryStreamController extends QueryStreamController {
30155
+ constructor(query, cacheKey, notifyChange, preparePayload) {
30156
+ super(query, cacheKey);
30157
+ this.notifyChange = notifyChange;
30158
+ this.preparePayload = preparePayload;
30159
+ }
30160
+ async saveToMainDB(response) {
30161
+ const processedPayload = this.preparePayload(response);
30162
+ const client = getActiveClient();
30163
+ const cachedAt = client.cache && Date.now();
30164
+ if (client.cache)
30165
+ ingestInCache({ eventResponses: [processedPayload] }, { cachedAt });
30166
+ }
30167
+ appendToQueryStream(response, direction, refresh = false) {
30168
+ var _a, _b;
30169
+ if (refresh) {
30170
+ pushToCache(this.cacheKey, {
30171
+ data: response.eventResponses.map(getResolver('eventResponse')),
30172
+ });
30173
+ }
30174
+ else {
30175
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
30176
+ const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
30177
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [
30178
+ ...new Set([...events, ...response.eventResponses.map(getResolver('eventResponse'))]),
30179
+ ] }));
30180
+ }
30181
+ }
30182
+ reactor(action) {
30183
+ return (event) => {
30184
+ var _a;
30185
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
30186
+ if (!collection)
30187
+ return;
30188
+ if (action === EventActionsEnum.OnRSVPCreated) {
30189
+ const client = getActiveClient();
30190
+ if (client.userId !== event.userId)
30191
+ return;
30192
+ collection.data = [...new Set([event.eventId, ...collection.data])];
30193
+ }
30194
+ if (action === EventActionsEnum.OnEventDeleted) {
30195
+ collection.data = collection.data.filter(eventId => eventId !== event.eventId);
30196
+ }
30197
+ pushToCache(this.cacheKey, collection);
30198
+ this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
30199
+ };
30200
+ }
30201
+ subscribeRTE(createSubscriber) {
30202
+ return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
30203
+ }
30204
+ }
30205
+
30206
+ /**
30207
+ * ```js
30208
+ * import { EventRepository } from '@amityco/ts-sdk'
30209
+ * const dispose = EventRepository.onEventCreated(event => {
30210
+ * // ...
30211
+ * })
30212
+ * ```
30213
+ *
30214
+ * Fired when an RSVP response for a {@link Amity.Event} has been created
30215
+ *
30216
+ * @param callback The function to call when the event was fired
30217
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30218
+ *
30219
+ * @category Event Events
30220
+ */
30221
+ const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
30222
+
30223
+ /**
30224
+ * ```js
30225
+ * import { EventRepository } from '@amityco/ts-sdk'
30226
+ * const dispose = EventRepository.onEventUpdated(event => {
30227
+ * // ...
30228
+ * })
30229
+ * ```
30230
+ *
30231
+ * Fired when a {@link Amity.Event} has been updated
30232
+ *
30233
+ * @param callback The function to call when the event was fired
30234
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30235
+ *
30236
+ * @category Event Events
30237
+ */
30238
+ const onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
30239
+
30240
+ /**
30241
+ * ```js
30242
+ * import { EventRepository } from '@amityco/ts-sdk'
30243
+ * const dispose = EventRepository.onEventDeleted(event => {
30244
+ * // ...
30245
+ * })
30246
+ * ```
30247
+ *
30248
+ * Fired when a {@link Amity.Event} has been deleted
30249
+ *
30250
+ * @param callback The function to call when the event was fired
30251
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30252
+ *
30253
+ * @category Event Events
30254
+ */
30255
+ const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
30256
+
30257
+ /**
30258
+ * ```js
30259
+ * import { EventRepository } from '@amityco/ts-sdk'
30260
+ * const dispose = EventRepository.onLocalEventCreated(event => {
30261
+ * // ...
30262
+ * })
30263
+ * ```
30264
+ *
30265
+ * Fired when a {@link Amity.Event} has been created
30266
+ *
30267
+ * @param callback The function to call when the event was fired
30268
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30269
+ *
30270
+ * @category Event Events
30271
+ */
30272
+ const onLocalEventCreated = (callback) => createEventEventSubscriber('local.event.created', callback);
30273
+
30274
+ /**
30275
+ * ```js
30276
+ * import { EventRepository } from '@amityco/ts-sdk'
30277
+ * const dispose = EventRepository.onLocalEventUpdated(event => {
30278
+ * // ...
30279
+ * })
30280
+ * ```
30281
+ *
30282
+ * Fired when a {@link Amity.Event} has been updated
30283
+ *
30284
+ * @param callback The function to call when the event was fired
30285
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30286
+ *
30287
+ * @category Event Events
30288
+ */
30289
+ const onLocalEventUpdated = (callback) => createEventEventSubscriber('local.event.updated', callback);
30290
+
30291
+ /**
30292
+ * ```js
30293
+ * import { EventRepository } from '@amityco/ts-sdk'
30294
+ * const dispose = EventRepository.onLocalEventDeleted(event => {
30295
+ * // ...
30296
+ * })
30297
+ * ```
30298
+ *
30299
+ * Fired when a {@link Amity.Event} has been deleted
30300
+ *
30301
+ * @param callback The function to call when the event was fired
30302
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30303
+ *
30304
+ * @category Event Events
30305
+ */
30306
+ const onLocalEventDeleted = (callback) => createEventEventSubscriber('local.event.deleted', callback);
30307
+
30308
+ /**
30309
+ * ```js
30310
+ * import { EventRepository } from '@amityco/ts-sdk'
30311
+ * const dispose = EventRepository.onRSVPCreated(event => {
30312
+ * // ...
30313
+ * })
30314
+ * ```
30315
+ *
30316
+ * Fired when a {@link Amity.Event} has been created
30317
+ *
30318
+ * @param callback The function to call when the event was fired
30319
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30320
+ *
30321
+ * @category Event Events
30322
+ */
30323
+ const onRSVPCreated = (callback) => createEventResponseSubscriber('event.rsvp.created', callback);
30324
+
30325
+ /**
30326
+ * ```js
30327
+ * import { EventRepository } from '@amityco/ts-sdk'
30328
+ * const dispose = EventRepository.onRSVPUpdated(event => {
30329
+ * // ...
30330
+ * })
30331
+ * ```
30332
+ *
30333
+ * Fired when a {@link Amity.InternalEventResponse} has been updated
30334
+ *
30335
+ * @param callback The function to call when the event was fired
30336
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30337
+ *
30338
+ * @category Event Events
30339
+ */
30340
+ const onRSVPUpdated = (callback) => createEventResponseSubscriber('event.rsvp.updated', callback);
30341
+
30342
+ /**
30343
+ * ```js
30344
+ * import { EventRepository } from '@amityco/ts-sdk'
30345
+ * const dispose = EventRepository.onLocalRSVPCreated(event => {
30346
+ * // ...
30347
+ * })
30348
+ * ```
30349
+ *
30350
+ * Fired when an RSVP response for a {@link Amity.EventResponse} has been created
30351
+ *
30352
+ * @param callback The function to call when the event was fired
30353
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30354
+ *
30355
+ * @category Event Events
30356
+ */
30357
+ const onLocalRSVPCreated = (callback) => createEventResponseSubscriber('local.rsvp.created', callback);
30358
+
30359
+ /**
30360
+ * ```js
30361
+ * import { EventRepository } from '@amityco/ts-sdk'
30362
+ * const dispose = EventRepository.onLocalEventUpdated(event => {
30363
+ * // ...
30364
+ * })
30365
+ * ```
30366
+ *
30367
+ * Fired when an RSVP response for a {@link Amity.EventResponse} has been updated
30368
+ *
30369
+ * @param callback The function to call when the event was fired
30370
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
30371
+ *
30372
+ * @category Event Events
30373
+ */
30374
+ const onLocalRSVPUpdated = (callback) => createEventResponseSubscriber('local.rsvp.updated', callback);
30375
+
30376
+ class RSVPLiveCollectionController extends LiveCollectionController {
30377
+ constructor(query, callback) {
30378
+ const queryStreamId = hash(query);
30379
+ const cacheKey = ['eventResponse', 'collection', queryStreamId];
30380
+ const paginationController = new RSVPPaginationController(query);
30381
+ super(paginationController, queryStreamId, cacheKey, callback);
30382
+ this.query = query;
30383
+ this.queryStreamController = new RSVPQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventResponsePayload);
30384
+ this.callback = callback.bind(this);
30385
+ this.loadPage({ initial: true });
30386
+ }
30387
+ setup() {
30388
+ var _a;
30389
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
30390
+ if (!collection)
30391
+ pushToCache(this.cacheKey, { data: [], params: this.query });
30392
+ }
30393
+ async persistModel(queryPayload) {
30394
+ await this.queryStreamController.saveToMainDB(queryPayload);
30395
+ }
30396
+ persistQueryStream({ response, direction, refresh, }) {
30397
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
30398
+ }
30399
+ startSubscription() {
30400
+ return this.queryStreamController.subscribeRTE([
30401
+ { fn: onRSVPCreated, action: EventActionsEnum.OnRSVPCreated },
30402
+ { fn: onRSVPUpdated, action: EventActionsEnum.OnRSVPUpdated },
30403
+ { fn: onLocalRSVPCreated, action: EventActionsEnum.OnRSVPCreated },
30404
+ { fn: onLocalRSVPUpdated, action: EventActionsEnum.OnRSVPUpdated },
30405
+ ]);
30406
+ }
30407
+ notifyChange({ origin, loading, error }) {
30408
+ var _a, _b;
30409
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
30410
+ if (!collection)
30411
+ return;
30412
+ const data = (_b = collection.data
30413
+ .map(eventId => pullFromCache(['eventResponse', 'get', eventId]))
30414
+ .filter(isNonNullable)
30415
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : [].map(eventResponseLinkedObject);
30416
+ if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
30417
+ return;
30418
+ this.callback({
30419
+ data,
30420
+ error,
30421
+ loading,
30422
+ hasNextPage: !!this.paginationController.getNextToken(),
30423
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
30424
+ });
30425
+ }
30426
+ }
30427
+
30428
+ /**
30429
+ * Get events
30430
+ *
30431
+ * @param params the query parameters
30432
+ * @param callback the callback to be called when the events are updated
30433
+ * @returns events
30434
+ *
30435
+ * @category RSVP Live Collection
30436
+ *
30437
+ */
30438
+ const getRSVPs = (params, callback, config) => {
30439
+ const { log, cache } = getActiveClient();
30440
+ if (!cache)
30441
+ console.log(ENABLE_CACHE_MESSAGE);
30442
+ const timestamp = Date.now();
30443
+ log(`getRSVPs: (tmpid: ${timestamp}) > listen`);
30444
+ const rsvpLiveCollection = new RSVPLiveCollectionController(params, callback);
30445
+ const disposers = rsvpLiveCollection.startSubscription();
30446
+ const cacheKey = rsvpLiveCollection.getCacheKey();
30447
+ disposers.push(() => dropFromCache(cacheKey));
30448
+ return () => {
30449
+ log(`getRSVPs (tmpid: ${timestamp}) > dispose`);
30450
+ disposers.forEach(fn => fn());
30451
+ };
30452
+ };
30453
+
30454
+ const eventLinkedObject = (event) => {
30455
+ return Object.assign(Object.assign({}, event), { get creator() {
30456
+ const cacheData = pullFromCache(['user', 'get', event.userId]);
30457
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
30458
+ return;
30459
+ return userLinkedObject(cacheData.data);
30460
+ },
30461
+ get targetCommunity() {
30462
+ if (!event.originId)
30463
+ return;
30464
+ const cacheData = pullFromCache(['community', 'get', event.originId]);
30465
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
30466
+ return;
30467
+ return communityLinkedObject(cacheData.data);
30468
+ },
30469
+ get coverImage() {
30470
+ if (!event.coverImageFileId)
30471
+ return;
30472
+ const cacheData = pullFromCache(['file', 'get', event.coverImageFileId]);
30473
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
30474
+ return;
30475
+ return cacheData.data;
30476
+ },
30477
+ get post() {
30478
+ if (!event.postId)
30479
+ return;
30480
+ const cacheData = pullFromCache(['post', 'get', event.postId]);
30481
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
30482
+ return;
30483
+ return postLinkedObject(cacheData.data);
30484
+ },
30485
+ get room() {
30486
+ var _a;
30487
+ if (!event.postId)
30488
+ return;
30489
+ const cacheData = (_a = queryCache(['room', 'get'])) === null || _a === void 0 ? void 0 : _a.filter(room => room.data.referenceId === event.postId);
30490
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.length) || !cacheData[0].data)
30491
+ return;
30492
+ return roomLinkedObject(cacheData[0].data);
30493
+ }, createRSVP: async (status) => {
30494
+ const { data } = await createRSVP(event.eventId, status);
30495
+ return data;
30496
+ }, updateRSVP: async (status) => {
30497
+ const { data } = await updateRSVP(event.eventId, status);
30498
+ return data;
30499
+ }, getMyRSVP: async () => {
30500
+ const { data } = await getMyRSVP(event.eventId);
30501
+ return data;
30502
+ }, getRSVPs: (params, callback) => {
30503
+ return getRSVPs(Object.assign({ eventId: event.eventId }, params), callback);
30504
+ } });
30505
+ };
30506
+
29883
30507
  const LinkedObject = {
29884
30508
  ad: adLinkedObject,
29885
30509
  comment: commentLinkedObject,
@@ -29899,6 +30523,8 @@ const LinkedObject = {
29899
30523
  joinRequest: joinRequestLinkedObject,
29900
30524
  channelMember: channelMemberLinkedObject,
29901
30525
  room: roomLinkedObject,
30526
+ event: eventLinkedObject,
30527
+ eventResponse: eventResponseLinkedObject,
29902
30528
  };
29903
30529
 
29904
30530
  /* begin_public_function
@@ -30889,9 +31515,9 @@ var AmityUserSearchMatchType;
30889
31515
  AmityUserSearchMatchType["PARTIAL"] = "partial";
30890
31516
  })(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
30891
31517
 
30892
- var index$n = /*#__PURE__*/Object.freeze({
31518
+ var index$p = /*#__PURE__*/Object.freeze({
30893
31519
  __proto__: null,
30894
- Relationship: index$o,
31520
+ Relationship: index$q,
30895
31521
  getUserByIds: getUserByIds,
30896
31522
  updateUser: updateUser,
30897
31523
  flagUser: flagUser,
@@ -31294,7 +31920,7 @@ const uploadAudio = async (formData, onProgress) => {
31294
31920
  };
31295
31921
  /* end_public_function */
31296
31922
 
31297
- var index$m = /*#__PURE__*/Object.freeze({
31923
+ var index$o = /*#__PURE__*/Object.freeze({
31298
31924
  __proto__: null,
31299
31925
  getFile: getFile,
31300
31926
  uploadFile: uploadFile,
@@ -33106,7 +33732,7 @@ const getReactions$1 = (params, callback, config) => {
33106
33732
  };
33107
33733
  /* end_public_function */
33108
33734
 
33109
- var index$l = /*#__PURE__*/Object.freeze({
33735
+ var index$n = /*#__PURE__*/Object.freeze({
33110
33736
  __proto__: null,
33111
33737
  addReaction: addReaction,
33112
33738
  removeReaction: removeReaction,
@@ -34878,7 +35504,7 @@ const getMessages = (params, callback, config) => {
34878
35504
  };
34879
35505
  /* end_public_function */
34880
35506
 
34881
- var index$k = /*#__PURE__*/Object.freeze({
35507
+ var index$m = /*#__PURE__*/Object.freeze({
34882
35508
  __proto__: null,
34883
35509
  createMessage: createMessage,
34884
35510
  updateMessage: updateMessage,
@@ -35404,7 +36030,7 @@ const stopMessageReceiptSync = (subChannelId) => {
35404
36030
  };
35405
36031
  /* end_public_function */
35406
36032
 
35407
- var index$j = /*#__PURE__*/Object.freeze({
36033
+ var index$l = /*#__PURE__*/Object.freeze({
35408
36034
  __proto__: null,
35409
36035
  getSubChannelByIds: getSubChannels$1,
35410
36036
  createSubChannel: createSubChannel,
@@ -36731,7 +37357,7 @@ const searchMembers$1 = (params, callback, config) => {
36731
37357
  };
36732
37358
  /* end_public_function */
36733
37359
 
36734
- var index$i = /*#__PURE__*/Object.freeze({
37360
+ var index$k = /*#__PURE__*/Object.freeze({
36735
37361
  __proto__: null,
36736
37362
  addMembers: addMembers$1,
36737
37363
  removeMembers: removeMembers$1,
@@ -36934,7 +37560,7 @@ const unmuteMembers = async (channelId, userIds) => {
36934
37560
  };
36935
37561
  /* end_public_function */
36936
37562
 
36937
- var index$h = /*#__PURE__*/Object.freeze({
37563
+ var index$j = /*#__PURE__*/Object.freeze({
36938
37564
  __proto__: null,
36939
37565
  addRole: addRole,
36940
37566
  removeRole: removeRole,
@@ -36944,10 +37570,10 @@ var index$h = /*#__PURE__*/Object.freeze({
36944
37570
  unmuteMembers: unmuteMembers
36945
37571
  });
36946
37572
 
36947
- var index$g = /*#__PURE__*/Object.freeze({
37573
+ var index$i = /*#__PURE__*/Object.freeze({
36948
37574
  __proto__: null,
36949
- Membership: index$i,
36950
- Moderation: index$h,
37575
+ Membership: index$k,
37576
+ Moderation: index$j,
36951
37577
  getChannelByIds: getChannelByIds$1,
36952
37578
  createChannel: createChannel,
36953
37579
  updateChannel: updateChannel,
@@ -38350,7 +38976,7 @@ const searchMembers = (params, callback, config) => {
38350
38976
  };
38351
38977
  /* end_public_function */
38352
38978
 
38353
- var index$f = /*#__PURE__*/Object.freeze({
38979
+ var index$h = /*#__PURE__*/Object.freeze({
38354
38980
  __proto__: null,
38355
38981
  addMembers: addMembers,
38356
38982
  removeMembers: removeMembers,
@@ -39601,7 +40227,7 @@ const unbanMembers = async (communityId, userIds) => {
39601
40227
  };
39602
40228
  /* end_public_function */
39603
40229
 
39604
- var index$e = /*#__PURE__*/Object.freeze({
40230
+ var index$g = /*#__PURE__*/Object.freeze({
39605
40231
  __proto__: null,
39606
40232
  addRoles: addRoles,
39607
40233
  removeRoles: removeRoles,
@@ -39609,10 +40235,10 @@ var index$e = /*#__PURE__*/Object.freeze({
39609
40235
  unbanMembers: unbanMembers
39610
40236
  });
39611
40237
 
39612
- var index$d = /*#__PURE__*/Object.freeze({
40238
+ var index$f = /*#__PURE__*/Object.freeze({
39613
40239
  __proto__: null,
39614
- Moderation: index$e,
39615
- Membership: index$f,
40240
+ Moderation: index$g,
40241
+ Membership: index$h,
39616
40242
  getCommunityByIds: getCommunities$1,
39617
40243
  createCommunity: createCommunity,
39618
40244
  updateCommunity: updateCommunity,
@@ -39846,7 +40472,7 @@ const getCategories = (params, callback, config) => {
39846
40472
  };
39847
40473
  /* end_public_function */
39848
40474
 
39849
- var index$c = /*#__PURE__*/Object.freeze({
40475
+ var index$e = /*#__PURE__*/Object.freeze({
39850
40476
  __proto__: null,
39851
40477
  getCategory: getCategory,
39852
40478
  getCategories: getCategories
@@ -40905,7 +41531,7 @@ const getComments = (params, callback, config) => {
40905
41531
  };
40906
41532
  /* end_public_function */
40907
41533
 
40908
- var index$b = /*#__PURE__*/Object.freeze({
41534
+ var index$d = /*#__PURE__*/Object.freeze({
40909
41535
  __proto__: null,
40910
41536
  getCommentByIds: getCommentByIds,
40911
41537
  createComment: createComment,
@@ -41576,7 +42202,7 @@ const getUserFeed = (params, callback, config) => {
41576
42202
  };
41577
42203
  /* end_public_function */
41578
42204
 
41579
- var index$a = /*#__PURE__*/Object.freeze({
42205
+ var index$c = /*#__PURE__*/Object.freeze({
41580
42206
  __proto__: null,
41581
42207
  queryGlobalFeed: queryGlobalFeed,
41582
42208
  getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
@@ -43257,7 +43883,7 @@ const searchPostsByHashtag = (params, callback, config) => {
43257
43883
  };
43258
43884
  /* end_public_function */
43259
43885
 
43260
- var index$9 = /*#__PURE__*/Object.freeze({
43886
+ var index$b = /*#__PURE__*/Object.freeze({
43261
43887
  __proto__: null,
43262
43888
  getPostByIds: getPostByIds,
43263
43889
  createPost: createPost,
@@ -43865,7 +44491,7 @@ const getStreams = (params, callback, config) => {
43865
44491
  };
43866
44492
  };
43867
44493
 
43868
- var index$8 = /*#__PURE__*/Object.freeze({
44494
+ var index$a = /*#__PURE__*/Object.freeze({
43869
44495
  __proto__: null,
43870
44496
  createStream: createStream,
43871
44497
  updateStream: updateStream,
@@ -44080,9 +44706,7 @@ const getRecordedUrl = async (roomId) => {
44080
44706
  const removeParticipant = async (roomId, participantUserId) => {
44081
44707
  const client = getActiveClient();
44082
44708
  client.log('room/removeParticipant', { roomId, participantUserId });
44083
- await client.http.delete(`/api/v1/rooms/${roomId}/participants`, {
44084
- data: { participantUserId },
44085
- });
44709
+ await client.http.delete(`/api/v1/rooms/${roomId}/participants/${participantUserId}`);
44086
44710
  fireEvent('local.room.participantRemoved', {
44087
44711
  rooms: [{ _id: roomId }],
44088
44712
  users: [{ _id: participantUserId }],
@@ -44090,6 +44714,33 @@ const removeParticipant = async (roomId, participantUserId) => {
44090
44714
  };
44091
44715
  /* end_public_function */
44092
44716
 
44717
+ /* begin_public_function
44718
+ id: room.leave
44719
+ */
44720
+ /**
44721
+ * ```js
44722
+ * import { leaveRoom } from '@amityco/ts-sdk'
44723
+ * const result = await leaveRoom('roomId')
44724
+ * ```
44725
+ *
44726
+ * Leaves an {@link Amity.Room}
44727
+ *
44728
+ * @param roomId The ID of the room to leave
44729
+ * @returns Promise that resolves when the user has left the room
44730
+ *
44731
+ * @category Room API
44732
+ * @async
44733
+ */
44734
+ const leaveRoom = async (roomId) => {
44735
+ const client = getActiveClient();
44736
+ client.log('room/leaveRoom', { roomId });
44737
+ await client.http.post(`/api/v1/rooms/${roomId}/leave`);
44738
+ fireEvent('local.room.left', {
44739
+ rooms: [{ _id: roomId }],
44740
+ });
44741
+ };
44742
+ /* end_public_function */
44743
+
44093
44744
  /**
44094
44745
  * ```js
44095
44746
  * import { onRoomStartBroadcasting } from '@amityco/ts-sdk'
@@ -44211,6 +44862,46 @@ const onRoomCoHostInvited = (callback) => {
44211
44862
  return createEventSubscriber(client, 'room/onRoomCoHostInvited', 'room.didCohostInvite', filter);
44212
44863
  };
44213
44864
 
44865
+ const getRoomById = async (roomId) => {
44866
+ const client = getActiveClient();
44867
+ client.log('room/getRoomById', roomId);
44868
+ // Check if room is in tombstone
44869
+ isInTombstone('room', roomId);
44870
+ let data;
44871
+ try {
44872
+ const response = await client.http.get(`/api/v1/rooms/${roomId}`);
44873
+ data = response.data;
44874
+ }
44875
+ catch (error) {
44876
+ if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
44877
+ pushToTombstone('room', roomId);
44878
+ }
44879
+ throw error;
44880
+ }
44881
+ const cachedAt = client.cache && Date.now();
44882
+ if (client.cache) {
44883
+ ingestInCache(data, { cachedAt });
44884
+ }
44885
+ return {
44886
+ data: data.rooms[0],
44887
+ cachedAt,
44888
+ };
44889
+ };
44890
+ getRoomById.locally = (roomId) => {
44891
+ const client = getActiveClient();
44892
+ client.log('room/getRoomById.locally', roomId);
44893
+ // Check if room is in tombstone
44894
+ isInTombstone('room', roomId);
44895
+ const cachedAt = client.cache && Date.now();
44896
+ const roomCache = pullFromCache(['room', 'get', roomId]);
44897
+ if (!roomCache)
44898
+ return;
44899
+ return {
44900
+ data: roomCache.data,
44901
+ cachedAt,
44902
+ };
44903
+ };
44904
+
44214
44905
  /**
44215
44906
  * ```js
44216
44907
  * import { onRoomCoHostInviteAccepted } from '@amityco/ts-sdk'
@@ -44228,12 +44919,14 @@ const onRoomCoHostInvited = (callback) => {
44228
44919
  */
44229
44920
  const onRoomCoHostInviteAccepted = (callback) => {
44230
44921
  const client = getActiveClient();
44231
- const filter = (payload) => {
44922
+ const filter = async (payload) => {
44923
+ var _a;
44232
44924
  const data = prepareMyInvitationsPayload(payload);
44925
+ await getRoomById((_a = data.invitations) === null || _a === void 0 ? void 0 : _a[0].targetId);
44233
44926
  ingestInCache(data);
44234
- callback(data.invitations);
44927
+ callback(data.invitations[0]);
44235
44928
  };
44236
- return createEventSubscriber(client, 'room/onRoomCoHostInviteAccepted', 'room.didCoHostInviteAccept', filter);
44929
+ return createEventSubscriber(client, 'room/onRoomCoHostInviteAccepted', 'room.didCohostInviteAccept', filter);
44237
44930
  };
44238
44931
 
44239
44932
  /**
@@ -44258,7 +44951,7 @@ const onRoomCoHostInviteRejected = (callback) => {
44258
44951
  ingestInCache(data);
44259
44952
  callback(data.invitations);
44260
44953
  };
44261
- return createEventSubscriber(client, 'room/onRoomCoHostInviteRejected', 'room.didCoHostInviteReject', filter);
44954
+ return createEventSubscriber(client, 'room/onRoomCoHostInviteRejected', 'room.didCohostInviteReject', filter);
44262
44955
  };
44263
44956
 
44264
44957
  /**
@@ -44283,7 +44976,7 @@ const onRoomCoHostInviteCanceled = (callback) => {
44283
44976
  ingestInCache(data);
44284
44977
  callback(data.invitations);
44285
44978
  };
44286
- return createEventSubscriber(client, 'room/onRoomCoHostInviteCanceled', 'room.didCoHostInviteCancel', filter);
44979
+ return createEventSubscriber(client, 'room/onRoomCoHostInviteCanceled', 'room.didCohostInviteCancel', filter);
44287
44980
  };
44288
44981
 
44289
44982
  /**
@@ -44451,47 +45144,55 @@ const onRoomParticipantRemoved = (callback) => {
44451
45144
  ingestInCache(payload);
44452
45145
  callback(payload.rooms[0]);
44453
45146
  };
44454
- return createEventSubscriber(client, 'room/onRoomParticipantRemoved', 'local.room.participantRemoved', filter);
45147
+ return createEventSubscriber(client, 'room/onRoomParticipantRemoved', 'room.participantRemoved', filter);
44455
45148
  };
44456
45149
 
44457
- const getRoomById = async (roomId) => {
45150
+ /**
45151
+ * ```js
45152
+ * import { onRoomLeft } from '@amityco/ts-sdk'
45153
+ * const dispose = onRoomLeft(room => {
45154
+ * // ...
45155
+ * })
45156
+ * ```
45157
+ *
45158
+ * Fired when a user has left a {@link Amity.Room} locally
45159
+ *
45160
+ * @param callback The function to call when the event was fired
45161
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
45162
+ *
45163
+ * @category Room Events
45164
+ */
45165
+ const onRoomLeft = (callback) => {
44458
45166
  const client = getActiveClient();
44459
- client.log('room/getRoomById', roomId);
44460
- // Check if room is in tombstone
44461
- isInTombstone('room', roomId);
44462
- let data;
44463
- try {
44464
- const response = await client.http.get(`/api/v1/rooms/${roomId}`);
44465
- data = response.data;
44466
- }
44467
- catch (error) {
44468
- if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
44469
- pushToTombstone('room', roomId);
44470
- }
44471
- throw error;
44472
- }
44473
- const cachedAt = client.cache && Date.now();
44474
- if (client.cache) {
44475
- ingestInCache(data, { cachedAt });
44476
- }
44477
- return {
44478
- data: data.rooms[0],
44479
- cachedAt,
45167
+ const filter = (payload) => {
45168
+ ingestInCache(payload);
45169
+ callback(payload.rooms[0]);
44480
45170
  };
45171
+ return createEventSubscriber(client, 'room/onRoomLeft', 'local.room.left', filter);
44481
45172
  };
44482
- getRoomById.locally = (roomId) => {
45173
+
45174
+ /**
45175
+ * ```js
45176
+ * import { onRoomParticipantRemoved } from '@amityco/ts-sdk'
45177
+ * const dispose = onRoomParticipantRemoved(room => {
45178
+ * // ...
45179
+ * })
45180
+ * ```
45181
+ *
45182
+ * Fired when a participant has been removed from a {@link Amity.Room} locally
45183
+ *
45184
+ * @param callback The function to call when the event was fired
45185
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
45186
+ *
45187
+ * @category Room Events
45188
+ */
45189
+ const onRoomParticipantRemovedLocal = (callback) => {
44483
45190
  const client = getActiveClient();
44484
- client.log('room/getRoomById.locally', roomId);
44485
- // Check if room is in tombstone
44486
- isInTombstone('room', roomId);
44487
- const cachedAt = client.cache && Date.now();
44488
- const roomCache = pullFromCache(['room', 'get', roomId]);
44489
- if (!roomCache)
44490
- return;
44491
- return {
44492
- data: roomCache.data,
44493
- cachedAt,
45191
+ const filter = (payload) => {
45192
+ ingestInCache(payload);
45193
+ callback(payload.rooms[0]);
44494
45194
  };
45195
+ return createEventSubscriber(client, 'room/onRoomParticipantRemoved', 'local.room.participantRemoved', filter);
44495
45196
  };
44496
45197
 
44497
45198
  const getRoom = (roomId, callback) => {
@@ -44501,7 +45202,11 @@ const getRoom = (roomId, callback) => {
44501
45202
  onRoomStartBroadcasting,
44502
45203
  onRoomWaitingReconnect,
44503
45204
  onRoomRecordedAvailable,
44504
- onRoomCoHostInvited,
45205
+ onRoomParticipantJoined,
45206
+ onRoomParticipantLeft,
45207
+ onRoomParticipantRemoved,
45208
+ onRoomParticipantRemovedLocal,
45209
+ convertEventPayload(onRoomCoHostInviteAccepted, 'targetId', 'room'),
44505
45210
  ], {
44506
45211
  callbackDataSelector: (data) => {
44507
45212
  if (!data)
@@ -44721,7 +45426,7 @@ const getRooms = (params, callback, config) => {
44721
45426
  };
44722
45427
  /* end_public_function */
44723
45428
 
44724
- var index$7 = /*#__PURE__*/Object.freeze({
45429
+ var index$9 = /*#__PURE__*/Object.freeze({
44725
45430
  __proto__: null,
44726
45431
  createRoom: createRoom,
44727
45432
  updateRoom: updateRoom,
@@ -44730,6 +45435,7 @@ var index$7 = /*#__PURE__*/Object.freeze({
44730
45435
  getBroadcasterData: getBroadcasterData,
44731
45436
  getRecordedUrl: getRecordedUrl,
44732
45437
  removeParticipant: removeParticipant,
45438
+ leaveRoom: leaveRoom,
44733
45439
  onRoomStartBroadcasting: onRoomStartBroadcasting,
44734
45440
  onRoomWaitingReconnect: onRoomWaitingReconnect,
44735
45441
  onRoomEndBroadcasting: onRoomEndBroadcasting,
@@ -44745,10 +45451,305 @@ var index$7 = /*#__PURE__*/Object.freeze({
44745
45451
  onRoomDeleted: onRoomDeleted,
44746
45452
  onRoomStopped: onRoomStopped,
44747
45453
  onRoomParticipantRemoved: onRoomParticipantRemoved,
45454
+ onRoomLeft: onRoomLeft,
44748
45455
  getRoom: getRoom,
44749
45456
  getRooms: getRooms
44750
45457
  });
44751
45458
 
45459
+ /* begin_public_function
45460
+ id: roomPresence.getRoomOnlineUsers
45461
+ */
45462
+ /**
45463
+ * ```js
45464
+ * import { getRoomOnlineUsers } from '@amityco/ts-sdk'
45465
+ * const result = await getRoomOnlineUsers('roomId')
45466
+ * ```
45467
+ *
45468
+ * Retrieves the list of users currently online in a specific room.
45469
+ * This function fetches all users who are actively watching or present in the room,
45470
+ * handling pagination automatically for large numbers of users.
45471
+ *
45472
+ * @param roomId The ID of the room to get online users for
45473
+ * @returns Promise that resolves with a cached list of online users
45474
+ *
45475
+ * @category Room Presence API
45476
+ * @async
45477
+ */
45478
+ const getRoomOnlineUsers = async (roomId) => {
45479
+ var _a, _b, _c;
45480
+ const client = getActiveClient();
45481
+ client.log('room/getWatchingUsers', { roomId });
45482
+ const { data } = await client.http.get(`/api/v1/presence/rooms/${roomId}/users`);
45483
+ const viewerIds = (_a = data === null || data === void 0 ? void 0 : data.viewers.map(viewer => viewer.userId)) !== null && _a !== void 0 ? _a : [];
45484
+ // getUserByIds has a maximum limit of 100 users per call
45485
+ // Split into chunks of 100 if we have more than 100 users
45486
+ const BATCH_SIZE = 100;
45487
+ const batches = [];
45488
+ for (let i = 0; i < viewerIds.length; i += BATCH_SIZE) {
45489
+ batches.push(viewerIds.slice(i, i + BATCH_SIZE));
45490
+ }
45491
+ // Fetch all batches in parallel
45492
+ const batchResults = await Promise.all(batches.map(batch => getUserByIds(batch)));
45493
+ // Merge all results
45494
+ const allViewers = [];
45495
+ batchResults.forEach(result => {
45496
+ if (result.data) {
45497
+ allViewers.push(...result.data);
45498
+ }
45499
+ });
45500
+ // Return in the same format as getUserByIds
45501
+ return {
45502
+ data: allViewers,
45503
+ cachedAt: (_c = (_b = batchResults[0]) === null || _b === void 0 ? void 0 : _b.cachedAt) !== null && _c !== void 0 ? _c : Date.now(),
45504
+ };
45505
+ };
45506
+ /* end_public_function */
45507
+
45508
+ /* begin_public_function
45509
+ id: roomPresence.getRoomUserCount
45510
+ */
45511
+ /**
45512
+ * ```js
45513
+ * import { getRoomUserCount } from '@amityco/ts-sdk'
45514
+ * const count = await getRoomUserCount('roomId')
45515
+ * ```
45516
+ *
45517
+ * Retrieves the count of users currently watching or present in a specific room.
45518
+ * This function returns the total number of online users without fetching their full user data.
45519
+ *
45520
+ * @param roomId The ID of the room to get the user count for
45521
+ * @returns Promise that resolves with the room watching count data
45522
+ *
45523
+ * @category Room Presence API
45524
+ * @async
45525
+ */
45526
+ const getRoomUserCount = async (roomId) => {
45527
+ const client = getActiveClient();
45528
+ client.log('roomPresence/getRoomUserCount', { roomId });
45529
+ const { data } = await client.http.get(`/api/v1/presence/rooms/${roomId}/users/count`);
45530
+ pushToCache(['get', 'watchingCount', roomId], data);
45531
+ fireEvent('local.room.watchingCountUpdated', data);
45532
+ return data;
45533
+ };
45534
+ /* end_public_function */
45535
+
45536
+ const getPresenceSetting = async () => {
45537
+ const client = getActiveClient();
45538
+ client.log('presence/getPresenceSetting');
45539
+ const { data } = await client.http.get('/api/v1/presence/settings');
45540
+ pushToCache(['get', 'presenceSetting'], data);
45541
+ return data;
45542
+ };
45543
+
45544
+ class RoomPresenceSyncEngine {
45545
+ constructor(roomId) {
45546
+ this.isEnabled = false;
45547
+ this.config = {
45548
+ heartbeatInterval: 30 * SECOND$1,
45549
+ };
45550
+ this.roomId = roomId;
45551
+ // Initialize config asynchronously - don't await in constructor
45552
+ this.initializeConfig().catch(error => {
45553
+ console.error('Failed to initialize RoomPresenceSyncEngine config in constructor:', error);
45554
+ });
45555
+ }
45556
+ async initializeConfig() {
45557
+ try {
45558
+ // Get presence settings from API with retry logic
45559
+ const presenceSettings = await RoomPresenceSyncEngine.getPresenceSettingWithRetry();
45560
+ if (presenceSettings) {
45561
+ // Set intervals from network settings (convert from minutes to milliseconds)
45562
+ this.config = {
45563
+ heartbeatInterval: (presenceSettings.network.heartbeatInterval || 5) * 60 * 1000,
45564
+ };
45565
+ }
45566
+ else {
45567
+ // Use default intervals if all retries failed
45568
+ this.config.heartbeatInterval = 5 * 60 * 1000; // 5 minutes
45569
+ }
45570
+ }
45571
+ catch (error) {
45572
+ console.error('Failed to initialize RoomPresenceSyncEngine config:', error);
45573
+ // Use default intervals if settings fetch fails
45574
+ this.config.heartbeatInterval = 5 * 60 * 1000; // 5 minutes
45575
+ }
45576
+ }
45577
+ static async getPresenceSettingWithRetry(maxRetries = 5) {
45578
+ for (let attempt = 0; attempt < maxRetries; attempt += 1) {
45579
+ try {
45580
+ // eslint-disable-next-line no-await-in-loop
45581
+ const presenceSettings = await getPresenceSetting();
45582
+ return presenceSettings;
45583
+ }
45584
+ catch (error) {
45585
+ if (attempt >= maxRetries - 1) {
45586
+ console.error(`Failed to get presence setting after ${maxRetries} attempts:`, error);
45587
+ return null;
45588
+ }
45589
+ // Calculate delay: 20 seconds + random jitter (0-5 seconds)
45590
+ const jitter = Math.random() * 5000; // 0-5 seconds in milliseconds
45591
+ const delay = 20000 + jitter; // 20 seconds + jitter
45592
+ console.warn(`Failed to get presence setting (attempt ${attempt + 1}/${maxRetries}), retrying in ${Math.round(delay / 1000)}s:`, error);
45593
+ // Wait before retry
45594
+ // eslint-disable-next-line no-await-in-loop
45595
+ await new Promise(resolve => {
45596
+ setTimeout(resolve, delay);
45597
+ });
45598
+ }
45599
+ }
45600
+ return null;
45601
+ }
45602
+ /**
45603
+ * Start heartbeat for the room
45604
+ */
45605
+ start() {
45606
+ if (this.isEnabled)
45607
+ return;
45608
+ this.isEnabled = true;
45609
+ // Send immediate heartbeat
45610
+ this.sendHeartbeat();
45611
+ // Start heartbeat timer
45612
+ this.heartbeatTimer = setInterval(() => {
45613
+ this.sendHeartbeat();
45614
+ }, this.config.heartbeatInterval);
45615
+ }
45616
+ /**
45617
+ * Stop heartbeat for the room
45618
+ */
45619
+ stop() {
45620
+ this.isEnabled = false;
45621
+ // Stop heartbeat timer
45622
+ if (this.heartbeatTimer) {
45623
+ clearInterval(this.heartbeatTimer);
45624
+ this.heartbeatTimer = undefined;
45625
+ }
45626
+ }
45627
+ /**
45628
+ * Send heartbeat to the room
45629
+ */
45630
+ async sendHeartbeat() {
45631
+ try {
45632
+ const client = getActiveClient();
45633
+ await client.http.post(`/api/v1/presence/rooms/${this.roomId}/heartbeat`);
45634
+ }
45635
+ catch (error) {
45636
+ console.error(`Heartbeat failed for room ${this.roomId}:`, error);
45637
+ }
45638
+ }
45639
+ /**
45640
+ * Get the room ID
45641
+ */
45642
+ getRoomId() {
45643
+ return this.roomId;
45644
+ }
45645
+ /**
45646
+ * Check if the engine is enabled
45647
+ */
45648
+ isActive() {
45649
+ return this.isEnabled;
45650
+ }
45651
+ /**
45652
+ * Cleanup method to stop all timers and release resources
45653
+ * Call this when the engine instance is no longer needed
45654
+ */
45655
+ destroy() {
45656
+ // Stop the engine
45657
+ this.stop();
45658
+ }
45659
+ // Session Management
45660
+ onSessionDestroyed() {
45661
+ // Stop all timers when session is destroyed and cleanup
45662
+ this.destroy();
45663
+ }
45664
+ onTokenExpired() {
45665
+ // Stop engine when token expires
45666
+ this.stop();
45667
+ }
45668
+ }
45669
+
45670
+ // Map to store engine instances per roomId
45671
+ const engineInstances = new Map();
45672
+ /**
45673
+ * Get or create a RoomPresenceSyncEngine instance for a specific room
45674
+ *
45675
+ * @param roomId The room ID to get/create engine for
45676
+ * @returns RoomPresenceSyncEngine instance for the room
45677
+ */
45678
+ const getRoomPresenceSyncEngine = (roomId) => {
45679
+ let engine = engineInstances.get(roomId);
45680
+ if (!engine) {
45681
+ engine = new RoomPresenceSyncEngine(roomId);
45682
+ engineInstances.set(roomId, engine);
45683
+ }
45684
+ return engine;
45685
+ };
45686
+ /**
45687
+ * Destroy the engine instance for a specific room
45688
+ *
45689
+ * @param roomId The room ID to destroy engine for
45690
+ */
45691
+ const destroyRoomPresenceSyncEngine = (roomId) => {
45692
+ const engine = engineInstances.get(roomId);
45693
+ if (engine) {
45694
+ engine.destroy();
45695
+ engineInstances.delete(roomId);
45696
+ }
45697
+ };
45698
+
45699
+ /* begin_public_function
45700
+ id: roomPresence.startHeartbeat
45701
+ */
45702
+ /**
45703
+ * ```js
45704
+ * import { startHeartbeat } from '@amityco/ts-sdk'
45705
+ * startHeartbeat('roomId')
45706
+ * ```
45707
+ *
45708
+ * Starts sending heartbeat signals for a specific room to maintain presence status.
45709
+ * This enables the room presence tracking and notifies the server that the user is actively viewing the room.
45710
+ *
45711
+ * @param roomId The ID of the room to start heartbeat for
45712
+ *
45713
+ * @category Room Presence API
45714
+ */
45715
+ const startHeartbeat = (roomId) => {
45716
+ const engine = getRoomPresenceSyncEngine(roomId);
45717
+ engine.start();
45718
+ };
45719
+ /* end_public_function */
45720
+
45721
+ /* begin_public_function
45722
+ id: roomPresence.stopHeartbeat
45723
+ */
45724
+ /**
45725
+ * ```js
45726
+ * import { stopHeartbeat } from '@amityco/ts-sdk'
45727
+ * stopHeartbeat('roomId')
45728
+ * ```
45729
+ *
45730
+ * Stops sending heartbeat signals for a specific room.
45731
+ * This disables the room presence tracking for the specified room and stops notifying the server of the user's presence.
45732
+ *
45733
+ * @param roomId The ID of the room to stop heartbeat for
45734
+ *
45735
+ * @category Room Presence API
45736
+ */
45737
+ const stopHeartbeat = (roomId) => {
45738
+ const engine = getRoomPresenceSyncEngine(roomId);
45739
+ engine.stop();
45740
+ // Clean up the engine instance
45741
+ destroyRoomPresenceSyncEngine(roomId);
45742
+ };
45743
+ /* end_public_function */
45744
+
45745
+ var index$8 = /*#__PURE__*/Object.freeze({
45746
+ __proto__: null,
45747
+ getRoomOnlineUsers: getRoomOnlineUsers,
45748
+ getRoomUserCount: getRoomUserCount,
45749
+ startHeartbeat: startHeartbeat,
45750
+ stopHeartbeat: stopHeartbeat
45751
+ });
45752
+
44752
45753
  /* begin_public_function
44753
45754
  id: poll.create
44754
45755
  */
@@ -45049,7 +46050,7 @@ const getPoll = (pollId, callback) => {
45049
46050
  };
45050
46051
  /* end_public_function */
45051
46052
 
45052
- var index$6 = /*#__PURE__*/Object.freeze({
46053
+ var index$7 = /*#__PURE__*/Object.freeze({
45053
46054
  __proto__: null,
45054
46055
  createPoll: createPoll,
45055
46056
  closePoll: closePoll,
@@ -45432,7 +46433,7 @@ const getPlayer = async (parameters) => {
45432
46433
  return video;
45433
46434
  };
45434
46435
 
45435
- var index$5 = /*#__PURE__*/Object.freeze({
46436
+ var index$6 = /*#__PURE__*/Object.freeze({
45436
46437
  __proto__: null,
45437
46438
  getPlayer: getPlayer
45438
46439
  });
@@ -46605,7 +47606,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
46605
47606
  };
46606
47607
  };
46607
47608
 
46608
- var index$4 = /*#__PURE__*/Object.freeze({
47609
+ var index$5 = /*#__PURE__*/Object.freeze({
46609
47610
  __proto__: null,
46610
47611
  createImageStory: createImageStory,
46611
47612
  createVideoStory: createVideoStory,
@@ -46642,7 +47643,7 @@ const getNetworkAds = async () => {
46642
47643
  };
46643
47644
  };
46644
47645
 
46645
- var index$3 = /*#__PURE__*/Object.freeze({
47646
+ var index$4 = /*#__PURE__*/Object.freeze({
46646
47647
  __proto__: null,
46647
47648
  getNetworkAds: getNetworkAds
46648
47649
  });
@@ -47033,7 +48034,7 @@ const markTraySeen = async (lastSeenAt) => {
47033
48034
  };
47034
48035
  /* end_public_function */
47035
48036
 
47036
- var index$2 = /*#__PURE__*/Object.freeze({
48037
+ var index$3 = /*#__PURE__*/Object.freeze({
47037
48038
  __proto__: null,
47038
48039
  getNotificationTraySeen: getNotificationTraySeen,
47039
48040
  getNotificationTrayItems: getNotificationTrayItems,
@@ -47076,28 +48077,6 @@ const cancelInvitation = async (invitationId) => {
47076
48077
  };
47077
48078
  /* end_public_function */
47078
48079
 
47079
- /* begin_public_function
47080
- id: invitation.accept
47081
- */
47082
- /**
47083
- * ```js
47084
- * import { acceptInvitation } from '@amityco/ts-sdk'
47085
- * const isAccepted = await acceptInvitation(invitationId)
47086
- * ```
47087
- *
47088
- * Accepts a {@link Amity.Invitation} object
47089
- *
47090
- * @param invitationId the {@link Amity.Invitation} to accept
47091
- * @returns A success boolean if the {@link Amity.Invitation} was accepted
47092
- *
47093
- * @category Invitation API
47094
- * @async
47095
- */
47096
- const acceptInvitation = async (invitationId) => {
47097
- return acceptInvitation$1(invitationId);
47098
- };
47099
- /* end_public_function */
47100
-
47101
48080
  class MyInvitationsPaginationController extends PaginationController {
47102
48081
  async getRequest(queryParams, token) {
47103
48082
  const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
@@ -47158,7 +48137,7 @@ class MyInvitationsQueryStreamController extends QueryStreamController {
47158
48137
  ]),
47159
48138
  ];
47160
48139
  }
47161
- if (action === InvitationActionsEnum.OnLocalInvitationDeleted) {
48140
+ if (action === InvitationActionsEnum.OnLocalInvitationCanceled) {
47162
48141
  collection.data = collection.data.filter(id => id !== invitations[0].invitationId);
47163
48142
  }
47164
48143
  pushToCache(this.cacheKey, collection);
@@ -47290,13 +48269,16 @@ const getMyCommunityInvitations = (params, callback, config) => {
47290
48269
  };
47291
48270
  };
47292
48271
 
48272
+ /* begin_public_function
48273
+ id: invitation.get_invitations
48274
+ */
47293
48275
  /**
47294
48276
  *
47295
48277
  * ```js
47296
- * import { observeInvitations } from '@amityco/ts-sdk';
48278
+ * import { InvitationRepository } from '@amityco/ts-sdk';
47297
48279
  *
47298
48280
  * // For room invitations
47299
- * const unsubscribe = observeInvitations(
48281
+ * const unsubscribe = InvitationRepository.getInvitations(
47300
48282
  * { targetId: 'room123', targetType: 'room' },
47301
48283
  * response => {
47302
48284
  * console.log('Room invitation event:', response.room, response.users, response.eventType)
@@ -47320,7 +48302,7 @@ const getMyCommunityInvitations = (params, callback, config) => {
47320
48302
  *
47321
48303
  * @category Invitation Observable
47322
48304
  */
47323
- const observeInvitations = (params, callback) => {
48305
+ const getInvitations = (params, callback) => {
47324
48306
  const { _id: userId } = getCurrentUser();
47325
48307
  if (!userId)
47326
48308
  throw new ASCError('The _id has not been defined in ActiveUser', 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
@@ -47333,7 +48315,7 @@ const observeInvitations = (params, callback) => {
47333
48315
  callback(data.map(LinkedObject.invitation));
47334
48316
  };
47335
48317
  const realtimeRouter = (data) => {
47336
- const invitations = data.filter(({ targetId, targetType }) => targetId === params.targetId && targetType === params.targetType);
48318
+ const invitations = (Array.isArray(data) ? data : [data]).filter(({ targetId, targetType }) => targetId === params.targetId && targetType === params.targetType);
47337
48319
  dispatcher(invitations);
47338
48320
  };
47339
48321
  // Only subscribe to room co-host events for now (since that's what we have implemented)
@@ -47345,20 +48327,19 @@ const observeInvitations = (params, callback) => {
47345
48327
  disposers.push(onRoomCoHostInviteCanceled(realtimeRouter));
47346
48328
  }
47347
48329
  return () => {
47348
- log(`observeInvitations(tmpid: ${timestamp}) > dispose for ${targetType}: ${targetId}`);
48330
+ log(`getInvitations(tmpid: ${timestamp}) > dispose for ${targetType}: ${targetId}`);
47349
48331
  disposers.forEach(fn => fn());
47350
48332
  };
47351
48333
  };
47352
48334
 
47353
- var index$1 = /*#__PURE__*/Object.freeze({
48335
+ var index$2 = /*#__PURE__*/Object.freeze({
47354
48336
  __proto__: null,
47355
48337
  cancelInvitation: cancelInvitation,
47356
- acceptInvitation: acceptInvitation,
47357
48338
  onLocalInvitationCreated: onLocalInvitationCreated,
47358
48339
  onLocalInvitationUpdated: onLocalInvitationUpdated,
47359
48340
  onLocalInvitationCanceled: onLocalInvitationCanceled,
47360
48341
  getMyCommunityInvitations: getMyCommunityInvitations,
47361
- observeInvitations: observeInvitations
48342
+ getInvitations: getInvitations
47362
48343
  });
47363
48344
 
47364
48345
  // TODO: confirm id
@@ -47494,11 +48475,491 @@ const getReactions = (postId, callback) => {
47494
48475
  };
47495
48476
  };
47496
48477
 
47497
- var index = /*#__PURE__*/Object.freeze({
48478
+ var index$1 = /*#__PURE__*/Object.freeze({
47498
48479
  __proto__: null,
47499
48480
  createReaction: createReaction,
47500
48481
  onLiveReactionCreated: onLiveReactionCreated,
47501
48482
  getReactions: getReactions
47502
48483
  });
47503
48484
 
47504
- export { API_REGIONS, index$3 as AdRepository, index$c as CategoryRepository, index$g as ChannelRepository, index$p as Client, index$b as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$d as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, FeedDataTypeEnum, index$a as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$m as FileRepository, FileType, GET_WATCHER_URLS, index$1 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index as LiveReactionRepository, index$5 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$k as MessageRepository, index$6 as PollRepository, PostContentType, index$9 as PostRepository, PostStructureType, index$l as ReactionRepository, index$7 as RoomRepository, index$4 as StoryRepository, index$8 as StreamRepository, index$j as SubChannelRepository, SubscriptionLevels, index$n as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$2 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
48485
+ /* begin_public_function
48486
+ id: event.create
48487
+ */
48488
+ /**
48489
+ * ```js
48490
+ * import { EventRepository } from '@amityco/ts-sdk'
48491
+ * const response = await EventRepository.createEvent(bundle)
48492
+ * ```
48493
+ *
48494
+ * Creates an {@link Amity.Event}
48495
+ *
48496
+ * @param bundle The data necessary to create a new {@link Amity.Event}
48497
+ * @returns The newly created {@link Amity.Event}
48498
+ *
48499
+ * @category Event API
48500
+ * @async
48501
+ */
48502
+ const createEvent = async (bundle) => {
48503
+ const client = getActiveClient();
48504
+ client.log('event/createEvent', bundle);
48505
+ const { data: payload } = await client.http.post('/api/v1/events', bundle);
48506
+ fireEvent('local.event.created', payload);
48507
+ const preparedPayload = prepareEventPayload(payload);
48508
+ const cachedAt = client.cache && Date.now();
48509
+ if (client.cache)
48510
+ ingestInCache(preparedPayload, { cachedAt });
48511
+ return {
48512
+ data: eventLinkedObject(preparedPayload.events[0]),
48513
+ cachedAt,
48514
+ };
48515
+ };
48516
+ /* end_public_function */
48517
+
48518
+ /* begin_public_function
48519
+ id: event.update
48520
+ */
48521
+ /**
48522
+ * ```js
48523
+ * import { EventRepository } from '@amityco/ts-sdk'
48524
+ * const response = await EventRepository.updateEvent(eventId, bundle)
48525
+ * ```
48526
+ *
48527
+ * Updates an {@link Amity.Event}
48528
+ *
48529
+ * @param eventId The ID of the {@link Amity.Event} to edit
48530
+ * @param bundle The data necessary to update an existing {@link Amity.Event}
48531
+ * @returns the updated {@link Amity.Event}
48532
+ *
48533
+ * @category Event API
48534
+ * @async
48535
+ */
48536
+ const updateEvent = async (eventId, bundle) => {
48537
+ const client = getActiveClient();
48538
+ client.log('event/updateEvent', eventId, bundle);
48539
+ const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
48540
+ fireEvent('local.event.updated', payload);
48541
+ const preparedPayload = prepareEventPayload(payload);
48542
+ const cachedAt = client.cache && Date.now();
48543
+ if (client.cache)
48544
+ ingestInCache(preparedPayload, { cachedAt });
48545
+ return {
48546
+ data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
48547
+ cachedAt,
48548
+ };
48549
+ };
48550
+ /* end_public_function */
48551
+
48552
+ /* begin_public_function
48553
+ id: event.get
48554
+ */
48555
+ /**
48556
+ * ```js
48557
+ * import { EventRepository } from '@amityco/ts-sdk'
48558
+ * const event = await EventRepository.getEvent(eventId)
48559
+ * ```
48560
+ *
48561
+ * Fetches a {@link Amity.Event} object
48562
+ *
48563
+ * @param eventId the ID of the {@link Amity.Event} to fetch
48564
+ * @returns the associated {@link Amity.Event} object
48565
+ *
48566
+ * @category Event API
48567
+ * @async
48568
+ */
48569
+ const getEvent$1 = async (eventId) => {
48570
+ const client = getActiveClient();
48571
+ client.log('event/getEvent', eventId);
48572
+ const { data: payload } = await client.http.get(`/api/v1/events/${eventId}`);
48573
+ const data = prepareEventPayload(payload);
48574
+ const cachedAt = client.cache && Date.now();
48575
+ if (client.cache)
48576
+ ingestInCache(data, { cachedAt });
48577
+ return {
48578
+ data: data.events.find(event => event.eventId === eventId),
48579
+ cachedAt,
48580
+ };
48581
+ };
48582
+ /* end_public_function */
48583
+ /**
48584
+ * ```js
48585
+ * import { EventRepository } from '@amityco/ts-sdk'
48586
+ * const event = EventRepository.getEvent.locally(eventId)
48587
+ * ```
48588
+ *
48589
+ * Fetches a {@link Amity.Event} object in cache
48590
+ *
48591
+ * @param eventId the ID of the {@link Amity.Event} to fetch
48592
+ * @returns the associated {@link Amity.Event} object
48593
+ *
48594
+ * @category Event API
48595
+ */
48596
+ getEvent$1.locally = (eventId) => {
48597
+ const client = getActiveClient();
48598
+ client.log('event/getEvent.locally', eventId);
48599
+ if (!client.cache)
48600
+ return;
48601
+ const cache = pullFromCache(['event', 'get', eventId]);
48602
+ if (!cache)
48603
+ return;
48604
+ return {
48605
+ data: cache.data,
48606
+ cachedAt: cache.cachedAt,
48607
+ };
48608
+ };
48609
+
48610
+ /* begin_public_function
48611
+ id: event.delete
48612
+ */
48613
+ /**
48614
+ * ```js
48615
+ * import { EventRepository } from '@amityco/ts-sdk'
48616
+ * const { success } = await EventRepository.deleteEvent(eventId)
48617
+ * ```
48618
+ *
48619
+ * Deletes a {@link Amity.Event}
48620
+ *
48621
+ * @param eventId The {@link Amity.Event} ID to delete
48622
+ *
48623
+ * @category Event API
48624
+ * @async
48625
+ */
48626
+ const deleteEvent = async (eventId) => {
48627
+ const client = getActiveClient();
48628
+ client.log('event/deleteEvent', eventId);
48629
+ const event = await getEvent$1(eventId);
48630
+ await client.http.delete(`/api/v1/events/${eventId}`);
48631
+ const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
48632
+ upsertInCache(['event', 'get', eventId], deletedEvent);
48633
+ fireEvent('local.event.deleted', {
48634
+ users: [],
48635
+ files: [],
48636
+ communities: [],
48637
+ posts: [],
48638
+ rooms: [],
48639
+ events: [deletedEvent],
48640
+ });
48641
+ };
48642
+ /* end_public_function */
48643
+
48644
+ /* begin_public_function
48645
+ id: event.get
48646
+ */
48647
+ /**
48648
+ * ```js
48649
+ * import { EventRepository } from '@amityco/ts-sdk';
48650
+ *
48651
+ * let event;
48652
+ *
48653
+ * const unsubscribe = EventRepository.getEvent(eventId, response => {
48654
+ * event = response.data;
48655
+ * });
48656
+ * ```
48657
+ *
48658
+ * Observe all mutation on a given {@link Amity.Event}
48659
+ *
48660
+ * @param eventId the ID of the event to observe
48661
+ * @param callback the function to call when new snapshot of event are available
48662
+ * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
48663
+ *
48664
+ * @category Event Live Object
48665
+ */
48666
+ const getEvent = (eventId, callback) => {
48667
+ return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventUpdated, onEventDeleted, onLocalEventUpdated, onLocalEventDeleted], {
48668
+ callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
48669
+ });
48670
+ };
48671
+ /* end_public_function */
48672
+
48673
+ class EventPaginationController extends PaginationController {
48674
+ async getRequest(queryParams, token) {
48675
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
48676
+ const options = token ? { token } : { limit };
48677
+ const { data: response } = await this.http.get(`/api/v1/events`, { params: Object.assign(Object.assign({}, params), { options }) });
48678
+ return response;
48679
+ }
48680
+ }
48681
+
48682
+ class EventQueryStreamController extends QueryStreamController {
48683
+ constructor(query, cacheKey, notifyChange, preparePayload) {
48684
+ super(query, cacheKey);
48685
+ this.notifyChange = notifyChange;
48686
+ this.preparePayload = preparePayload;
48687
+ }
48688
+ async saveToMainDB(response) {
48689
+ const processedPayload = this.preparePayload(response);
48690
+ const client = getActiveClient();
48691
+ const cachedAt = client.cache && Date.now();
48692
+ if (client.cache)
48693
+ ingestInCache(processedPayload, { cachedAt });
48694
+ }
48695
+ appendToQueryStream(response, direction, refresh = false) {
48696
+ var _a, _b;
48697
+ if (refresh) {
48698
+ pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
48699
+ }
48700
+ else {
48701
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48702
+ const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
48703
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
48704
+ }
48705
+ }
48706
+ reactor(action) {
48707
+ return (event) => {
48708
+ var _a;
48709
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48710
+ if (!collection)
48711
+ return;
48712
+ if (action === EventActionsEnum.OnEventCreated) {
48713
+ collection.data = [...new Set([event.eventId, ...collection.data])];
48714
+ }
48715
+ if (action === EventActionsEnum.OnEventDeleted) {
48716
+ collection.data = collection.data.filter(eventId => eventId !== event.eventId);
48717
+ }
48718
+ pushToCache(this.cacheKey, collection);
48719
+ this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
48720
+ };
48721
+ }
48722
+ subscribeRTE(createSubscriber) {
48723
+ return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
48724
+ }
48725
+ }
48726
+
48727
+ class EventLiveCollectionController extends LiveCollectionController {
48728
+ constructor(query, callback) {
48729
+ const queryStreamId = hash(query);
48730
+ const cacheKey = ['event', 'collection', queryStreamId];
48731
+ const paginationController = new EventPaginationController(query);
48732
+ super(paginationController, queryStreamId, cacheKey, callback);
48733
+ this.query = query;
48734
+ this.queryStreamController = new EventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
48735
+ this.callback = callback.bind(this);
48736
+ this.loadPage({ initial: true });
48737
+ }
48738
+ setup() {
48739
+ var _a;
48740
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48741
+ if (!collection)
48742
+ pushToCache(this.cacheKey, { data: [], params: {} });
48743
+ }
48744
+ async persistModel(queryPayload) {
48745
+ await this.queryStreamController.saveToMainDB(queryPayload);
48746
+ }
48747
+ persistQueryStream({ response, direction, refresh, }) {
48748
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
48749
+ }
48750
+ startSubscription() {
48751
+ return this.queryStreamController.subscribeRTE([
48752
+ { fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
48753
+ { fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
48754
+ { fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
48755
+ { fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
48756
+ { fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
48757
+ { fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
48758
+ ]);
48759
+ }
48760
+ notifyChange({ origin, loading, error }) {
48761
+ var _a, _b;
48762
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48763
+ if (!collection)
48764
+ return;
48765
+ const data = ((_b = collection.data
48766
+ .map(eventId => pullFromCache(['event', 'get', eventId]))
48767
+ .filter(isNonNullable)
48768
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
48769
+ if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
48770
+ return;
48771
+ this.callback({
48772
+ data,
48773
+ error,
48774
+ loading,
48775
+ hasNextPage: !!this.paginationController.getNextToken(),
48776
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
48777
+ });
48778
+ }
48779
+ }
48780
+
48781
+ /**
48782
+ * Get events
48783
+ *
48784
+ * @param params the query parameters
48785
+ * @param callback the callback to be called when the events are updated
48786
+ * @returns events
48787
+ *
48788
+ * @category Event Live Collection
48789
+ *
48790
+ */
48791
+ const getEvents = (params, callback, config) => {
48792
+ const { log, cache } = getActiveClient();
48793
+ if (!cache)
48794
+ console.log(ENABLE_CACHE_MESSAGE);
48795
+ const timestamp = Date.now();
48796
+ log(`getEvents: (tmpid: ${timestamp}) > listen`);
48797
+ const eventLiveCollection = new EventLiveCollectionController(params, callback);
48798
+ const disposers = eventLiveCollection.startSubscription();
48799
+ const cacheKey = eventLiveCollection.getCacheKey();
48800
+ disposers.push(() => dropFromCache(cacheKey));
48801
+ return () => {
48802
+ log(`getEvents (tmpid: ${timestamp}) > dispose`);
48803
+ disposers.forEach(fn => fn());
48804
+ };
48805
+ };
48806
+
48807
+ class MyEventPaginationController extends PaginationController {
48808
+ async getRequest(queryParams, token) {
48809
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
48810
+ const options = token ? { token } : { limit };
48811
+ const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
48812
+ return response;
48813
+ }
48814
+ }
48815
+
48816
+ class MyEventQueryStreamController extends QueryStreamController {
48817
+ constructor(query, cacheKey, notifyChange, preparePayload) {
48818
+ super(query, cacheKey);
48819
+ this.notifyChange = notifyChange;
48820
+ this.preparePayload = preparePayload;
48821
+ }
48822
+ async saveToMainDB(response) {
48823
+ const processedPayload = this.preparePayload(response);
48824
+ const client = getActiveClient();
48825
+ const cachedAt = client.cache && Date.now();
48826
+ if (client.cache)
48827
+ ingestInCache(processedPayload, { cachedAt });
48828
+ }
48829
+ appendToQueryStream(response, direction, refresh = false) {
48830
+ var _a, _b;
48831
+ if (refresh) {
48832
+ pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
48833
+ }
48834
+ else {
48835
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48836
+ const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
48837
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
48838
+ }
48839
+ }
48840
+ reactor(action) {
48841
+ return (event) => {
48842
+ var _a;
48843
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48844
+ if (!collection)
48845
+ return;
48846
+ if (action === EventActionsEnum.OnEventCreated) {
48847
+ const client = getActiveClient();
48848
+ if (client.userId !== event.userId)
48849
+ return;
48850
+ collection.data = [...new Set([event.eventId, ...collection.data])];
48851
+ }
48852
+ if (action === EventActionsEnum.OnEventDeleted) {
48853
+ collection.data = collection.data.filter(eventId => eventId !== event.eventId);
48854
+ }
48855
+ pushToCache(this.cacheKey, collection);
48856
+ this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
48857
+ };
48858
+ }
48859
+ subscribeRTE(createSubscriber) {
48860
+ return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
48861
+ }
48862
+ }
48863
+
48864
+ class MyEventLiveCollectionController extends LiveCollectionController {
48865
+ constructor(query, callback) {
48866
+ const queryStreamId = hash(query);
48867
+ const cacheKey = ['event', 'collection', queryStreamId];
48868
+ const paginationController = new MyEventPaginationController(query);
48869
+ super(paginationController, queryStreamId, cacheKey, callback);
48870
+ this.query = query;
48871
+ this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
48872
+ this.callback = callback.bind(this);
48873
+ this.loadPage({ initial: true });
48874
+ }
48875
+ setup() {
48876
+ var _a;
48877
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48878
+ if (!collection)
48879
+ pushToCache(this.cacheKey, { data: [], params: {} });
48880
+ }
48881
+ async persistModel(queryPayload) {
48882
+ await this.queryStreamController.saveToMainDB(queryPayload);
48883
+ }
48884
+ persistQueryStream({ response, direction, refresh, }) {
48885
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
48886
+ }
48887
+ startSubscription() {
48888
+ return this.queryStreamController.subscribeRTE([
48889
+ { fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
48890
+ { fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
48891
+ { fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
48892
+ { fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
48893
+ { fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
48894
+ { fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
48895
+ ]);
48896
+ }
48897
+ notifyChange({ origin, loading, error }) {
48898
+ var _a, _b;
48899
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
48900
+ if (!collection)
48901
+ return;
48902
+ const data = ((_b = collection.data
48903
+ .map(eventId => pullFromCache(['event', 'get', eventId]))
48904
+ .filter(isNonNullable)
48905
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
48906
+ if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
48907
+ return;
48908
+ this.callback({
48909
+ data,
48910
+ error,
48911
+ loading,
48912
+ hasNextPage: !!this.paginationController.getNextToken(),
48913
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
48914
+ });
48915
+ }
48916
+ }
48917
+
48918
+ /**
48919
+ * Get my events
48920
+ *
48921
+ * @param params the query parameters
48922
+ * @param callback the callback to be called when the events are updated
48923
+ * @returns events
48924
+ *
48925
+ * @category Event Live Collection
48926
+ *
48927
+ */
48928
+ const getMyEvents = (params, callback, config) => {
48929
+ const { log, cache } = getActiveClient();
48930
+ if (!cache)
48931
+ console.log(ENABLE_CACHE_MESSAGE);
48932
+ const timestamp = Date.now();
48933
+ log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
48934
+ const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
48935
+ const disposers = myEventLiveCollection.startSubscription();
48936
+ const cacheKey = myEventLiveCollection.getCacheKey();
48937
+ disposers.push(() => dropFromCache(cacheKey));
48938
+ return () => {
48939
+ log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
48940
+ disposers.forEach(fn => fn());
48941
+ };
48942
+ };
48943
+
48944
+ var index = /*#__PURE__*/Object.freeze({
48945
+ __proto__: null,
48946
+ createEvent: createEvent,
48947
+ updateEvent: updateEvent,
48948
+ deleteEvent: deleteEvent,
48949
+ onEventCreated: onEventCreated,
48950
+ onEventUpdated: onEventUpdated,
48951
+ onEventDeleted: onEventDeleted,
48952
+ onLocalEventCreated: onLocalEventCreated,
48953
+ onLocalEventUpdated: onLocalEventUpdated,
48954
+ onLocalEventDeleted: onLocalEventDeleted,
48955
+ onRSVPCreated: onRSVPCreated,
48956
+ onRSVPUpdated: onRSVPUpdated,
48957
+ onLocalRSVPCreated: onLocalRSVPCreated,
48958
+ onLocalRSVPUpdated: onLocalRSVPUpdated,
48959
+ getEvent: getEvent,
48960
+ getEvents: getEvents,
48961
+ getMyEvents: getMyEvents,
48962
+ getRSVPs: getRSVPs
48963
+ });
48964
+
48965
+ export { API_REGIONS, index$4 as AdRepository, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, index$e as CategoryRepository, index$i as ChannelRepository, index$r as Client, index$d as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$f as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index as EventRepository, FeedDataTypeEnum, index$c as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$o as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$m as MessageRepository, index$7 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index$n as ReactionRepository, index$8 as RoomPresenceRepository, index$9 as RoomRepository, index$5 as StoryRepository, index$a as StreamRepository, index$l as SubChannelRepository, SubscriptionLevels, index$p as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$3 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };