@amityco/ts-sdk 7.11.1-10e0f4d8.0 → 7.11.1-140ac995.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 (77) hide show
  1. package/dist/@types/core/events.d.ts +4 -0
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/model.d.ts +4 -0
  4. package/dist/@types/core/model.d.ts.map +1 -1
  5. package/dist/@types/core/payload.d.ts +13 -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/domains/community.d.ts +3 -0
  10. package/dist/@types/domains/community.d.ts.map +1 -1
  11. package/dist/@types/domains/event.d.ts +47 -10
  12. package/dist/@types/domains/event.d.ts.map +1 -1
  13. package/dist/@types/domains/notification.d.ts +3 -1
  14. package/dist/@types/domains/notification.d.ts.map +1 -1
  15. package/dist/core/events.d.ts +3 -3
  16. package/dist/core/events.d.ts.map +1 -1
  17. package/dist/core/model/idResolvers.d.ts.map +1 -1
  18. package/dist/core/model/index.d.ts.map +1 -1
  19. package/dist/eventRepository/events/enums.d.ts +3 -1
  20. package/dist/eventRepository/events/enums.d.ts.map +1 -1
  21. package/dist/eventRepository/events/index.d.ts +7 -0
  22. package/dist/eventRepository/events/index.d.ts.map +1 -1
  23. package/dist/eventRepository/events/onLocalEventCreated.d.ts +17 -0
  24. package/dist/eventRepository/events/onLocalEventCreated.d.ts.map +1 -0
  25. package/dist/eventRepository/events/onLocalEventDeleted.d.ts +17 -0
  26. package/dist/eventRepository/events/onLocalEventDeleted.d.ts.map +1 -0
  27. package/dist/eventRepository/events/onLocalEventUpdated.d.ts +17 -0
  28. package/dist/eventRepository/events/onLocalEventUpdated.d.ts.map +1 -0
  29. package/dist/eventRepository/events/onLocalRSVPCreated.d.ts +17 -0
  30. package/dist/eventRepository/events/onLocalRSVPCreated.d.ts.map +1 -0
  31. package/dist/eventRepository/events/onLocalRSVPUpdated.d.ts +17 -0
  32. package/dist/eventRepository/events/onLocalRSVPUpdated.d.ts.map +1 -0
  33. package/dist/eventRepository/events/onRSVPCreated.d.ts +17 -0
  34. package/dist/eventRepository/events/onRSVPCreated.d.ts.map +1 -0
  35. package/dist/eventRepository/events/onRSVPUpdated.d.ts +17 -0
  36. package/dist/eventRepository/events/onRSVPUpdated.d.ts.map +1 -0
  37. package/dist/eventRepository/internalApi/createRSVP.d.ts +16 -0
  38. package/dist/eventRepository/internalApi/createRSVP.d.ts.map +1 -0
  39. package/dist/eventRepository/internalApi/getMyRSVP.d.ts +32 -0
  40. package/dist/eventRepository/internalApi/getMyRSVP.d.ts.map +1 -0
  41. package/dist/eventRepository/internalApi/index.d.ts +3 -0
  42. package/dist/eventRepository/internalApi/index.d.ts.map +1 -1
  43. package/dist/eventRepository/internalApi/updateRSVP.d.ts +17 -0
  44. package/dist/eventRepository/internalApi/updateRSVP.d.ts.map +1 -0
  45. package/dist/eventRepository/observers/getEvent.d.ts.map +1 -1
  46. package/dist/eventRepository/observers/getEvents/LiveCollectionController.d.ts.map +1 -1
  47. package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts +13 -0
  48. package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts.map +1 -0
  49. package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts +5 -0
  50. package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts.map +1 -0
  51. package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts +15 -0
  52. package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts.map +1 -0
  53. package/dist/eventRepository/observers/getMyEvents.d.ts +12 -0
  54. package/dist/eventRepository/observers/getMyEvents.d.ts.map +1 -0
  55. package/dist/eventRepository/observers/getRSVPs/LiveCollectionController.d.ts +13 -0
  56. package/dist/eventRepository/observers/getRSVPs/LiveCollectionController.d.ts.map +1 -0
  57. package/dist/eventRepository/observers/getRSVPs/PaginationController.d.ts +5 -0
  58. package/dist/eventRepository/observers/getRSVPs/PaginationController.d.ts.map +1 -0
  59. package/dist/eventRepository/observers/getRSVPs/QueryStreamController.d.ts +15 -0
  60. package/dist/eventRepository/observers/getRSVPs/QueryStreamController.d.ts.map +1 -0
  61. package/dist/eventRepository/observers/getRSVPs.d.ts +12 -0
  62. package/dist/eventRepository/observers/getRSVPs.d.ts.map +1 -0
  63. package/dist/eventRepository/observers/index.d.ts +2 -0
  64. package/dist/eventRepository/observers/index.d.ts.map +1 -1
  65. package/dist/eventRepository/utils/createEventEventSubscriber.d.ts +1 -1
  66. package/dist/eventRepository/utils/createEventEventSubscriber.d.ts.map +1 -1
  67. package/dist/eventRepository/utils/createEventResponseSubscriber.d.ts +2 -0
  68. package/dist/eventRepository/utils/createEventResponseSubscriber.d.ts.map +1 -0
  69. package/dist/eventRepository/utils/index.d.ts +2 -0
  70. package/dist/eventRepository/utils/index.d.ts.map +1 -1
  71. package/dist/eventRepository/utils/prepareEventResponsePayload.d.ts +2 -0
  72. package/dist/eventRepository/utils/prepareEventResponsePayload.d.ts.map +1 -0
  73. package/dist/index.cjs.js +626 -33
  74. package/dist/index.esm.js +627 -34
  75. package/dist/index.umd.js +3 -3
  76. package/dist/utils/linkedObject/eventLinkObject.d.ts.map +1 -1
  77. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -194,6 +194,11 @@ var AmityEventStatus;
194
194
  AmityEventStatus["Ended"] = "ended";
195
195
  AmityEventStatus["Cancelled"] = "cancelled";
196
196
  })(AmityEventStatus || (AmityEventStatus = {}));
197
+ var AmityEventResponseStatus;
198
+ (function (AmityEventResponseStatus) {
199
+ AmityEventResponseStatus["Going"] = "going";
200
+ AmityEventResponseStatus["NotGoing"] = "not_going";
201
+ })(AmityEventResponseStatus || (AmityEventResponseStatus = {}));
197
202
 
198
203
  function getVersion() {
199
204
  try {
@@ -644,6 +649,8 @@ const idResolvers = {
644
649
  invitation: ({ _id }) => _id,
645
650
  joinRequest: ({ joinRequestId }) => joinRequestId,
646
651
  event: ({ eventId }) => eventId,
652
+ eventResponse: ({ eventId }) => eventId,
653
+ discussionCommunity: ({ communityId }) => communityId,
647
654
  };
648
655
  /**
649
656
  * Retrieve the id resolver matching a domain name
@@ -700,7 +707,8 @@ const PAYLOAD2MODEL = {
700
707
  invitations: 'invitation',
701
708
  joinRequests: 'joinRequest',
702
709
  events: 'event',
703
- discussionCommunities: 'community',
710
+ eventResponse: 'eventResponse',
711
+ discussionCommunities: 'discussionCommunity',
704
712
  };
705
713
  /** hidden */
706
714
  const isOutdated = (prevData, nextData) => {
@@ -29771,6 +29779,185 @@ const communityLinkedObject = (community) => {
29771
29779
  } });
29772
29780
  };
29773
29781
 
29782
+ const prepareEventResponsePayload = (rawPayload) => {
29783
+ return {
29784
+ status: rawPayload.eventResponses[0].status,
29785
+ eventId: rawPayload.eventResponses[0].eventId,
29786
+ event: rawPayload.events,
29787
+ userId: rawPayload.eventResponses[0].userId,
29788
+ user: rawPayload.users.map(convertRawUserToInternalUser),
29789
+ };
29790
+ };
29791
+
29792
+ /* begin_public_function
29793
+ id: event.rsvp.create
29794
+ */
29795
+ /**
29796
+ * ```js
29797
+ * import { event } from '@amityco/ts-sdk'
29798
+ * const response = await event.createRSVP(eventId, status)
29799
+ * ```
29800
+ *
29801
+ * Creates an {@link Amity.InternalEvent}
29802
+ *
29803
+ * @param bundle The data necessary to create a new {@link Amity.InternalEvent}
29804
+ * @returns The newly created {@link Amity.InternalEvent}
29805
+ *
29806
+ * @category Event API
29807
+ * @async
29808
+ */
29809
+ const createRSVP = async (eventId, status) => {
29810
+ const client = getActiveClient();
29811
+ client.log('event/createRSVP', eventId, status);
29812
+ const { data: payload } = await client.http.post(`/api/v1/events/${eventId}/rsvp`, { status });
29813
+ fireEvent('local.rsvp.created', payload);
29814
+ const data = prepareEventResponsePayload(payload);
29815
+ const cachedAt = client.cache && Date.now();
29816
+ if (client.cache)
29817
+ ingestInCache({ eventResponses: [data] }, { cachedAt });
29818
+ return {
29819
+ data,
29820
+ cachedAt,
29821
+ };
29822
+ };
29823
+ /* end_public_function */
29824
+
29825
+ /* begin_public_function
29826
+ id: event.update
29827
+ */
29828
+ /**
29829
+ * ```js
29830
+ * import { event } from '@amityco/ts-sdk'
29831
+ * const response = await event.updateRSVP(eventId, status)
29832
+ * ```
29833
+ *
29834
+ * Updates an {@link Amity.EventResponse}
29835
+ *
29836
+ * @param eventId The ID of the {@link Amity.EventResponse} to edit
29837
+ * @param bundle The data necessary to update an existing {@link Amity.EventResponse}
29838
+ * @returns the updated {@link Amity.EventResponse}
29839
+ *
29840
+ * @category Event API
29841
+ * @async
29842
+ */
29843
+ const updateRSVP = async (eventId, status) => {
29844
+ const client = getActiveClient();
29845
+ client.log('event/updateRSVP', eventId, status);
29846
+ const { data: payload } = await client.http.put(`/api/v1/events/${eventId}/rsvp`, { status });
29847
+ fireEvent('local.rsvp.updated', payload);
29848
+ const data = prepareEventResponsePayload(payload);
29849
+ const cachedAt = client.cache && Date.now();
29850
+ if (client.cache)
29851
+ ingestInCache({ eventResponses: [data] }, { cachedAt });
29852
+ return {
29853
+ data,
29854
+ cachedAt,
29855
+ };
29856
+ };
29857
+ /* end_public_function */
29858
+
29859
+ const prepareEventPayload = (rawPayload) => {
29860
+ return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
29861
+ };
29862
+
29863
+ const createEventEventSubscriber = (event, callback) => {
29864
+ const client = getActiveClient();
29865
+ const filter = (payload) => {
29866
+ const unpackedPayload = prepareEventPayload(payload);
29867
+ if (!client.cache) {
29868
+ callback(unpackedPayload.events[0]);
29869
+ }
29870
+ else {
29871
+ ingestInCache(unpackedPayload);
29872
+ const event = pullFromCache([
29873
+ 'event',
29874
+ 'get',
29875
+ unpackedPayload.events[0].eventId,
29876
+ ]);
29877
+ callback(event.data);
29878
+ }
29879
+ };
29880
+ return createEventSubscriber(client, event, event, filter);
29881
+ };
29882
+
29883
+ const createEventResponseSubscriber = (event, callback) => {
29884
+ const client = getActiveClient();
29885
+ const filter = (payload) => {
29886
+ const unpackedPayload = prepareEventResponsePayload(payload);
29887
+ if (!client.cache) {
29888
+ callback(unpackedPayload);
29889
+ }
29890
+ else {
29891
+ ingestInCache(unpackedPayload.event[0]);
29892
+ const eventResponse = pullFromCache([
29893
+ 'eventResponse',
29894
+ 'get',
29895
+ payload.eventResponses[0].eventId,
29896
+ ]);
29897
+ callback(eventResponse.data);
29898
+ }
29899
+ };
29900
+ return createEventSubscriber(client, event, event, filter);
29901
+ };
29902
+
29903
+ /* begin_public_function
29904
+ id: event.rsvp.me
29905
+ */
29906
+ /**
29907
+ * ```js
29908
+ * import { event } from '@amityco/ts-sdk'
29909
+ * const myRSVP = await event.getMyRSVP(eventId)
29910
+ * ```
29911
+ *
29912
+ * Joins a {@link Amity.EventResponse} object
29913
+ *
29914
+ * @param eventId the {@link Amity.EventResponse} to get RSVP for
29915
+ * @returns A success boolean if the {@link Amity.EventResponse} RSVP was retrieved
29916
+ *
29917
+ * @category Event API
29918
+ * @async
29919
+ */
29920
+ const getMyRSVP = async (eventId) => {
29921
+ const client = getActiveClient();
29922
+ client.log('event/getMyRSVP', eventId);
29923
+ const { data: payload } = await client.http.get(`/api/v1/events/${eventId}/me/rsvp`);
29924
+ const data = prepareEventResponsePayload(payload);
29925
+ const cachedAt = client.cache && Date.now();
29926
+ if (client.cache)
29927
+ ingestInCache({ eventResponses: [data] }, { cachedAt });
29928
+ return {
29929
+ data,
29930
+ cachedAt,
29931
+ };
29932
+ };
29933
+ /* end_public_function */
29934
+ /**
29935
+ * ```js
29936
+ * import { event } from '@amityco/ts-sdk'
29937
+ * const event = event.getMyRSVP.locally(eventId)
29938
+ * ```
29939
+ *
29940
+ * Fetches a {@link Amity.InternalEvent} object in cache
29941
+ *
29942
+ * @param eventId the ID of the {@link Amity.InternalEvent} to fetch
29943
+ * @returns the associated {@link Amity.InternalEvent} object
29944
+ *
29945
+ * @category Event API
29946
+ */
29947
+ getMyRSVP.locally = (eventId) => {
29948
+ const client = getActiveClient();
29949
+ client.log('event/getMyRSVP.locally', eventId);
29950
+ if (!client.cache)
29951
+ return;
29952
+ const cache = pullFromCache(['event', 'getMyRSVP', eventId]);
29953
+ if (!cache)
29954
+ return;
29955
+ return {
29956
+ data: cache.data,
29957
+ cachedAt: cache.cachedAt,
29958
+ };
29959
+ };
29960
+
29774
29961
  const eventLinkedObject = (event) => {
29775
29962
  return Object.assign(Object.assign({}, event), { get creator() {
29776
29963
  const cacheData = pullFromCache(['user', 'get', event.userId]);
@@ -29782,7 +29969,7 @@ const eventLinkedObject = (event) => {
29782
29969
  if (!event.discussionCommunityId)
29783
29970
  return;
29784
29971
  const cacheData = pullFromCache([
29785
- 'community',
29972
+ 'discussionCommunity',
29786
29973
  'get',
29787
29974
  event.discussionCommunityId,
29788
29975
  ]);
@@ -29790,6 +29977,22 @@ const eventLinkedObject = (event) => {
29790
29977
  return;
29791
29978
  return communityLinkedObject(cacheData.data);
29792
29979
  },
29980
+ get targetCommunity() {
29981
+ if (!event.originId)
29982
+ return;
29983
+ const cacheData = pullFromCache(['community', 'get', event.originId]);
29984
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
29985
+ return;
29986
+ return communityLinkedObject(cacheData.data);
29987
+ },
29988
+ get coverImage() {
29989
+ if (!event.coverImageFileId)
29990
+ return;
29991
+ const cacheData = pullFromCache(['file', 'get', event.coverImageFileId]);
29992
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
29993
+ return;
29994
+ return cacheData.data;
29995
+ },
29793
29996
  get liveStream() {
29794
29997
  if (!event.livestreamId)
29795
29998
  return;
@@ -29797,6 +30000,15 @@ const eventLinkedObject = (event) => {
29797
30000
  if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
29798
30001
  return;
29799
30002
  return cacheData.data;
30003
+ }, createRSVP: async (status) => {
30004
+ const { data } = await createRSVP(event.eventId, status);
30005
+ return data;
30006
+ }, updateRSVP: async (status) => {
30007
+ const { data } = await updateRSVP(event.eventId, status);
30008
+ return data;
30009
+ }, getMyRSVP: async () => {
30010
+ const { data } = await getMyRSVP(event.eventId);
30011
+ return data;
29800
30012
  } });
29801
30013
  };
29802
30014
 
@@ -46436,30 +46648,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
46436
46648
  getReactions: getReactions
46437
46649
  });
46438
46650
 
46439
- const prepareEventPayload = (rawPayload) => {
46440
- return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
46441
- };
46442
-
46443
- const createEventEventSubscriber = (event, callback) => {
46444
- const client = getActiveClient();
46445
- const filter = (payload) => {
46446
- const unpackedPayload = prepareEventPayload(payload);
46447
- if (!client.cache) {
46448
- callback(unpackedPayload.events[0]);
46449
- }
46450
- else {
46451
- ingestInCache(unpackedPayload);
46452
- const event = pullFromCache([
46453
- 'event',
46454
- 'get',
46455
- unpackedPayload.events[0].eventId,
46456
- ]);
46457
- callback(event.data);
46458
- }
46459
- };
46460
- return createEventSubscriber(client, event, event, filter);
46461
- };
46462
-
46463
46651
  /* begin_public_function
46464
46652
  id: event.create
46465
46653
  */
@@ -46481,7 +46669,7 @@ const createEvent = async (bundle) => {
46481
46669
  const client = getActiveClient();
46482
46670
  client.log('event/createEvent', bundle);
46483
46671
  const { data: payload } = await client.http.post('/api/v1/events', bundle);
46484
- fireEvent('event.created', payload);
46672
+ fireEvent('local.event.created', payload);
46485
46673
  const preparedPayload = prepareEventPayload(payload);
46486
46674
  const cachedAt = client.cache && Date.now();
46487
46675
  if (client.cache)
@@ -46515,7 +46703,7 @@ const updateEvent = async (eventId, bundle) => {
46515
46703
  const client = getActiveClient();
46516
46704
  client.log('event/updateEvent', eventId, bundle);
46517
46705
  const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
46518
- fireEvent('event.updated', payload);
46706
+ fireEvent('local.event.updated', payload);
46519
46707
  const preparedPayload = prepareEventPayload(payload);
46520
46708
  const cachedAt = client.cache && Date.now();
46521
46709
  if (client.cache)
@@ -46547,7 +46735,7 @@ const updateEvent = async (eventId, bundle) => {
46547
46735
  const getEvent$1 = async (eventId) => {
46548
46736
  const client = getActiveClient();
46549
46737
  client.log('event/getEvent', eventId);
46550
- const { data: payload } = await client.http.get(`/api/v3/events/${eventId}`);
46738
+ const { data: payload } = await client.http.get(`/api/v1/events/${eventId}`);
46551
46739
  const data = prepareEventPayload(payload);
46552
46740
  const cachedAt = client.cache && Date.now();
46553
46741
  if (client.cache)
@@ -46605,10 +46793,10 @@ const deleteEvent = async (eventId) => {
46605
46793
  const client = getActiveClient();
46606
46794
  client.log('event/deleteEvent', eventId);
46607
46795
  const event = await getEvent$1(eventId);
46608
- await client.http.delete(`/api/v3/events/${eventId}`);
46796
+ await client.http.delete(`/api/v1/events/${eventId}`);
46609
46797
  const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
46610
46798
  upsertInCache(['event', 'get', eventId], deletedEvent);
46611
- fireEvent('event.deleted', {
46799
+ fireEvent('local.event.deleted', {
46612
46800
  users: [],
46613
46801
  files: [],
46614
46802
  communities: [],
@@ -46670,6 +46858,125 @@ const onEventUpdated = (callback) => createEventEventSubscriber('event.updated',
46670
46858
  */
46671
46859
  const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
46672
46860
 
46861
+ /**
46862
+ * ```js
46863
+ * import { EventRepository } from '@amityco/ts-sdk'
46864
+ * const dispose = EventRepository.onLocalEventCreated(event => {
46865
+ * // ...
46866
+ * })
46867
+ * ```
46868
+ *
46869
+ * Fired when a {@link Amity.Event} has been created
46870
+ *
46871
+ * @param callback The function to call when the event was fired
46872
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46873
+ *
46874
+ * @category Event Events
46875
+ */
46876
+ const onLocalEventCreated = (callback) => createEventEventSubscriber('local.event.created', callback);
46877
+
46878
+ /**
46879
+ * ```js
46880
+ * import { EventRepository } from '@amityco/ts-sdk'
46881
+ * const dispose = EventRepository.onLocalEventUpdated(event => {
46882
+ * // ...
46883
+ * })
46884
+ * ```
46885
+ *
46886
+ * Fired when a {@link Amity.Event} has been updated
46887
+ *
46888
+ * @param callback The function to call when the event was fired
46889
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46890
+ *
46891
+ * @category Event Events
46892
+ */
46893
+ const onLocalEventUpdated = (callback) => createEventEventSubscriber('local.event.updated', callback);
46894
+
46895
+ /**
46896
+ * ```js
46897
+ * import { EventRepository } from '@amityco/ts-sdk'
46898
+ * const dispose = EventRepository.onLocalEventDeleted(event => {
46899
+ * // ...
46900
+ * })
46901
+ * ```
46902
+ *
46903
+ * Fired when a {@link Amity.Event} has been deleted
46904
+ *
46905
+ * @param callback The function to call when the event was fired
46906
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46907
+ *
46908
+ * @category Event Events
46909
+ */
46910
+ const onLocalEventDeleted = (callback) => createEventEventSubscriber('local.event.deleted', callback);
46911
+
46912
+ /**
46913
+ * ```js
46914
+ * import { EventRepository } from '@amityco/ts-sdk'
46915
+ * const dispose = EventRepository.onRSVPCreated(event => {
46916
+ * // ...
46917
+ * })
46918
+ * ```
46919
+ *
46920
+ * Fired when a {@link Amity.Event} has been created
46921
+ *
46922
+ * @param callback The function to call when the event was fired
46923
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46924
+ *
46925
+ * @category Event Events
46926
+ */
46927
+ const onRSVPCreated = (callback) => createEventResponseSubscriber('event.rsvp.created', callback);
46928
+
46929
+ /**
46930
+ * ```js
46931
+ * import { EventRepository } from '@amityco/ts-sdk'
46932
+ * const dispose = EventRepository.onRSVPUpdated(event => {
46933
+ * // ...
46934
+ * })
46935
+ * ```
46936
+ *
46937
+ * Fired when a {@link Amity.InternalEventResponse} has been updated
46938
+ *
46939
+ * @param callback The function to call when the event was fired
46940
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46941
+ *
46942
+ * @category Event Events
46943
+ */
46944
+ const onRSVPUpdated = (callback) => createEventResponseSubscriber('event.rsvp.updated', callback);
46945
+
46946
+ /**
46947
+ * ```js
46948
+ * import { EventRepository } from '@amityco/ts-sdk'
46949
+ * const dispose = EventRepository.onLocalRSVPCreated(event => {
46950
+ * // ...
46951
+ * })
46952
+ * ```
46953
+ *
46954
+ * Fired when a {@link Amity.Event} has been created
46955
+ *
46956
+ * @param callback The function to call when the event was fired
46957
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46958
+ *
46959
+ * @category Event Events
46960
+ */
46961
+ const onLocalRSVPCreated = (callback) => createEventResponseSubscriber('local.rsvp.created', callback);
46962
+
46963
+ /**
46964
+ * ```js
46965
+ * import { EventRepository } from '@amityco/ts-sdk'
46966
+ * const dispose = EventRepository.onLocalEventUpdated(event => {
46967
+ * // ...
46968
+ * })
46969
+ * ```
46970
+ *
46971
+ * Fired when a {@link Amity.Event} has been updated
46972
+ *
46973
+ * @param callback The function to call when the event was fired
46974
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
46975
+ *
46976
+ * @category Event Events
46977
+ */
46978
+ const onLocalRSVPUpdated = (callback) => createEventResponseSubscriber('local.rsvp.updated', callback);
46979
+
46673
46980
  /* begin_public_function
46674
46981
  id: event.get
46675
46982
  */
@@ -46693,7 +47000,7 @@ const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted',
46693
47000
  * @category Event Live Object
46694
47001
  */
46695
47002
  const getEvent = (eventId, callback) => {
46696
- return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventCreated, onEventUpdated, onEventDeleted], {
47003
+ return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventUpdated, onEventDeleted, onLocalEventUpdated, onLocalEventDeleted], {
46697
47004
  callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
46698
47005
  });
46699
47006
  };
@@ -46704,6 +47011,8 @@ var EventActionsEnum;
46704
47011
  EventActionsEnum["OnEventCreated"] = "onEventCreated";
46705
47012
  EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
46706
47013
  EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
47014
+ EventActionsEnum["OnRSVPCreated"] = "onRSVPCreated";
47015
+ EventActionsEnum["OnRSVPUpdated"] = "onRSVPUpdated";
46707
47016
  })(EventActionsEnum || (EventActionsEnum = {}));
46708
47017
 
46709
47018
  class EventPaginationController extends PaginationController {
@@ -46788,6 +47097,9 @@ class EventLiveCollectionController extends LiveCollectionController {
46788
47097
  { fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
46789
47098
  { fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
46790
47099
  { fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
47100
+ { fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
47101
+ { fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
47102
+ { fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
46791
47103
  ]);
46792
47104
  }
46793
47105
  notifyChange({ origin, loading, error }) {
@@ -46837,6 +47149,278 @@ const getEvents = (params, callback, config) => {
46837
47149
  };
46838
47150
  };
46839
47151
 
47152
+ class MyEventPaginationController extends PaginationController {
47153
+ async getRequest(queryParams, token) {
47154
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
47155
+ const options = token ? { token } : { limit };
47156
+ const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
47157
+ return response;
47158
+ }
47159
+ }
47160
+
47161
+ class MyEventQueryStreamController extends QueryStreamController {
47162
+ constructor(query, cacheKey, notifyChange, preparePayload) {
47163
+ super(query, cacheKey);
47164
+ this.notifyChange = notifyChange;
47165
+ this.preparePayload = preparePayload;
47166
+ }
47167
+ async saveToMainDB(response) {
47168
+ const processedPayload = this.preparePayload(response);
47169
+ const client = getActiveClient();
47170
+ const cachedAt = client.cache && Date.now();
47171
+ if (client.cache)
47172
+ ingestInCache(processedPayload, { cachedAt });
47173
+ }
47174
+ appendToQueryStream(response, direction, refresh = false) {
47175
+ var _a, _b;
47176
+ if (refresh) {
47177
+ pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
47178
+ }
47179
+ else {
47180
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47181
+ const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
47182
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
47183
+ }
47184
+ }
47185
+ reactor(action) {
47186
+ return (event) => {
47187
+ var _a;
47188
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47189
+ if (!collection)
47190
+ return;
47191
+ if (action === EventActionsEnum.OnEventCreated) {
47192
+ const client = getActiveClient();
47193
+ if (client.userId !== event.userId)
47194
+ return;
47195
+ collection.data = [...new Set([event.eventId, ...collection.data])];
47196
+ }
47197
+ if (action === EventActionsEnum.OnEventDeleted) {
47198
+ collection.data = collection.data.filter(eventId => eventId !== event.eventId);
47199
+ }
47200
+ pushToCache(this.cacheKey, collection);
47201
+ this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
47202
+ };
47203
+ }
47204
+ subscribeRTE(createSubscriber) {
47205
+ return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
47206
+ }
47207
+ }
47208
+
47209
+ class MyEventLiveCollectionController extends LiveCollectionController {
47210
+ constructor(query, callback) {
47211
+ const queryStreamId = hash(query);
47212
+ const cacheKey = ['event', 'collection', queryStreamId];
47213
+ const paginationController = new MyEventPaginationController(query);
47214
+ super(paginationController, queryStreamId, cacheKey, callback);
47215
+ this.query = query;
47216
+ this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
47217
+ this.callback = callback.bind(this);
47218
+ this.loadPage({ initial: true });
47219
+ }
47220
+ setup() {
47221
+ var _a;
47222
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47223
+ if (!collection)
47224
+ pushToCache(this.cacheKey, { data: [], params: {} });
47225
+ }
47226
+ async persistModel(queryPayload) {
47227
+ await this.queryStreamController.saveToMainDB(queryPayload);
47228
+ }
47229
+ persistQueryStream({ response, direction, refresh, }) {
47230
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
47231
+ }
47232
+ startSubscription() {
47233
+ return this.queryStreamController.subscribeRTE([
47234
+ { fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
47235
+ { fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
47236
+ { fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
47237
+ { fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
47238
+ { fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
47239
+ { fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
47240
+ ]);
47241
+ }
47242
+ notifyChange({ origin, loading, error }) {
47243
+ var _a, _b;
47244
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47245
+ if (!collection)
47246
+ return;
47247
+ const data = ((_b = collection.data
47248
+ .map(eventId => pullFromCache(['event', 'get', eventId]))
47249
+ .filter(isNonNullable)
47250
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
47251
+ if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
47252
+ return;
47253
+ this.callback({
47254
+ data,
47255
+ error,
47256
+ loading,
47257
+ hasNextPage: !!this.paginationController.getNextToken(),
47258
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
47259
+ });
47260
+ }
47261
+ }
47262
+
47263
+ /**
47264
+ * Get my events
47265
+ *
47266
+ * @param params the query parameters
47267
+ * @param callback the callback to be called when the events are updated
47268
+ * @returns events
47269
+ *
47270
+ * @category Event Live Collection
47271
+ *
47272
+ */
47273
+ const getMyEvents = (params, callback, config) => {
47274
+ const { log, cache } = getActiveClient();
47275
+ if (!cache)
47276
+ console.log(ENABLE_CACHE_MESSAGE);
47277
+ const timestamp = Date.now();
47278
+ log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
47279
+ const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
47280
+ const disposers = myEventLiveCollection.startSubscription();
47281
+ const cacheKey = myEventLiveCollection.getCacheKey();
47282
+ disposers.push(() => dropFromCache(cacheKey));
47283
+ return () => {
47284
+ log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
47285
+ disposers.forEach(fn => fn());
47286
+ };
47287
+ };
47288
+
47289
+ class RSVPPaginationController extends PaginationController {
47290
+ async getRequest(queryParams, token) {
47291
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, eventId } = queryParams, params = __rest(queryParams, ["limit", "eventId"]);
47292
+ const options = token ? { token } : { limit };
47293
+ const { data: response } = await this.http.get(`/api/v1/events/${eventId}/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
47294
+ return response;
47295
+ }
47296
+ }
47297
+
47298
+ class RSVPQueryStreamController extends QueryStreamController {
47299
+ constructor(query, cacheKey, notifyChange, preparePayload) {
47300
+ super(query, cacheKey);
47301
+ this.notifyChange = notifyChange;
47302
+ this.preparePayload = preparePayload;
47303
+ }
47304
+ async saveToMainDB(response) {
47305
+ const processedPayload = this.preparePayload(response);
47306
+ const client = getActiveClient();
47307
+ const cachedAt = client.cache && Date.now();
47308
+ if (client.cache)
47309
+ ingestInCache(processedPayload, { cachedAt });
47310
+ }
47311
+ appendToQueryStream(response, direction, refresh = false) {
47312
+ var _a, _b;
47313
+ if (refresh) {
47314
+ pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
47315
+ }
47316
+ else {
47317
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47318
+ const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
47319
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
47320
+ }
47321
+ }
47322
+ reactor(action) {
47323
+ return (event) => {
47324
+ var _a;
47325
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47326
+ if (!collection)
47327
+ return;
47328
+ if (action === EventActionsEnum.OnEventCreated) {
47329
+ const client = getActiveClient();
47330
+ if (client.userId !== event.userId)
47331
+ return;
47332
+ collection.data = [...new Set([event.eventId, ...collection.data])];
47333
+ }
47334
+ if (action === EventActionsEnum.OnEventDeleted) {
47335
+ collection.data = collection.data.filter(eventId => eventId !== event.eventId);
47336
+ }
47337
+ pushToCache(this.cacheKey, collection);
47338
+ this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
47339
+ };
47340
+ }
47341
+ subscribeRTE(createSubscriber) {
47342
+ return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
47343
+ }
47344
+ }
47345
+
47346
+ class RSVPLiveCollectionController extends LiveCollectionController {
47347
+ constructor(query, callback) {
47348
+ const queryStreamId = hash(query);
47349
+ const cacheKey = ['event', 'collection', queryStreamId];
47350
+ const paginationController = new RSVPPaginationController(query);
47351
+ super(paginationController, queryStreamId, cacheKey, callback);
47352
+ this.query = query;
47353
+ this.queryStreamController = new RSVPQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
47354
+ this.callback = callback.bind(this);
47355
+ this.loadPage({ initial: true });
47356
+ }
47357
+ setup() {
47358
+ var _a;
47359
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47360
+ if (!collection)
47361
+ pushToCache(this.cacheKey, { data: [], params: {} });
47362
+ }
47363
+ async persistModel(queryPayload) {
47364
+ await this.queryStreamController.saveToMainDB(queryPayload);
47365
+ }
47366
+ persistQueryStream({ response, direction, refresh, }) {
47367
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
47368
+ }
47369
+ startSubscription() {
47370
+ return this.queryStreamController.subscribeRTE([
47371
+ { fn: onRSVPCreated, action: EventActionsEnum.OnRSVPCreated },
47372
+ { fn: onRSVPUpdated, action: EventActionsEnum.OnRSVPUpdated },
47373
+ { fn: onLocalRSVPCreated, action: EventActionsEnum.OnRSVPCreated },
47374
+ { fn: onLocalRSVPUpdated, action: EventActionsEnum.OnRSVPUpdated },
47375
+ ]);
47376
+ }
47377
+ notifyChange({ origin, loading, error }) {
47378
+ var _a, _b;
47379
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
47380
+ if (!collection)
47381
+ return;
47382
+ const data = ((_b = collection.data
47383
+ .map(eventId => pullFromCache(['event', 'get', eventId]))
47384
+ .filter(isNonNullable)
47385
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
47386
+ if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
47387
+ return;
47388
+ this.callback({
47389
+ data,
47390
+ error,
47391
+ loading,
47392
+ hasNextPage: !!this.paginationController.getNextToken(),
47393
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
47394
+ });
47395
+ }
47396
+ }
47397
+
47398
+ /**
47399
+ * Get events
47400
+ *
47401
+ * @param params the query parameters
47402
+ * @param callback the callback to be called when the events are updated
47403
+ * @returns events
47404
+ *
47405
+ * @category RSVP Live Collection
47406
+ *
47407
+ */
47408
+ const getRSVPs = (params, callback, config) => {
47409
+ const { log, cache } = getActiveClient();
47410
+ if (!cache)
47411
+ console.log(ENABLE_CACHE_MESSAGE);
47412
+ const timestamp = Date.now();
47413
+ log(`getRSVPs: (tmpid: ${timestamp}) > listen`);
47414
+ const eventLiveCollection = new RSVPLiveCollectionController(params, callback);
47415
+ const disposers = eventLiveCollection.startSubscription();
47416
+ const cacheKey = eventLiveCollection.getCacheKey();
47417
+ disposers.push(() => dropFromCache(cacheKey));
47418
+ return () => {
47419
+ log(`getRSVPs (tmpid: ${timestamp}) > dispose`);
47420
+ disposers.forEach(fn => fn());
47421
+ };
47422
+ };
47423
+
46840
47424
  var index = /*#__PURE__*/Object.freeze({
46841
47425
  __proto__: null,
46842
47426
  createEvent: createEvent,
@@ -46845,8 +47429,17 @@ var index = /*#__PURE__*/Object.freeze({
46845
47429
  onEventCreated: onEventCreated,
46846
47430
  onEventUpdated: onEventUpdated,
46847
47431
  onEventDeleted: onEventDeleted,
47432
+ onLocalEventCreated: onLocalEventCreated,
47433
+ onLocalEventUpdated: onLocalEventUpdated,
47434
+ onLocalEventDeleted: onLocalEventDeleted,
47435
+ onRSVPCreated: onRSVPCreated,
47436
+ onRSVPUpdated: onRSVPUpdated,
47437
+ onLocalRSVPCreated: onLocalRSVPCreated,
47438
+ onLocalRSVPUpdated: onLocalRSVPUpdated,
46848
47439
  getEvent: getEvent,
46849
- getEvents: getEvents
47440
+ getEvents: getEvents,
47441
+ getMyEvents: getMyEvents,
47442
+ getRSVPs: getRSVPs
46850
47443
  });
46851
47444
 
46852
- export { API_REGIONS, index$4 as AdRepository, AmityEventOriginType, AmityEventStatus, AmityEventType, 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, index as EventRepository, FeedDataTypeEnum, index$a as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$m as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$k as MessageRepository, index$7 as PollRepository, PostContentType, index$9 as PostRepository, PostStructureType, index$l as ReactionRepository, index$5 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, 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 };
47445
+ export { API_REGIONS, index$4 as AdRepository, AmityEventOriginType, AmityEventResponseStatus, AmityEventStatus, AmityEventType, 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, index as EventRepository, FeedDataTypeEnum, index$a as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$m as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$k as MessageRepository, index$7 as PollRepository, PostContentType, index$9 as PostRepository, PostStructureType, index$l as ReactionRepository, index$5 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, 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 };