@amityco/ts-sdk 7.11.1-8ca038e4.0 → 7.11.1-b8fc6951.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.
- package/dist/@types/core/transport.d.ts +3 -0
- package/dist/@types/core/transport.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +8 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/event.d.ts +9 -0
- package/dist/@types/domains/event.d.ts.map +1 -1
- package/dist/@types/domains/partials.d.ts +2 -2
- package/dist/@types/domains/partials.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/eventRepository/api/deleteEvent.d.ts +15 -0
- package/dist/eventRepository/api/deleteEvent.d.ts.map +1 -0
- package/dist/eventRepository/api/index.d.ts +1 -0
- package/dist/eventRepository/api/index.d.ts.map +1 -1
- package/dist/eventRepository/events/enums.d.ts +6 -0
- package/dist/eventRepository/events/enums.d.ts.map +1 -0
- package/dist/eventRepository/events/index.d.ts +4 -0
- package/dist/eventRepository/events/index.d.ts.map +1 -0
- package/dist/eventRepository/events/onEventCreated.d.ts +17 -0
- package/dist/eventRepository/events/onEventCreated.d.ts.map +1 -0
- package/dist/eventRepository/events/onEventDeleted.d.ts +17 -0
- package/dist/eventRepository/events/onEventDeleted.d.ts.map +1 -0
- package/dist/eventRepository/events/onEventUpdated.d.ts +17 -0
- package/dist/eventRepository/events/onEventUpdated.d.ts.map +1 -0
- package/dist/eventRepository/index.d.ts +2 -0
- package/dist/eventRepository/index.d.ts.map +1 -1
- package/dist/eventRepository/internalApi/getEvent.d.ts +32 -0
- package/dist/eventRepository/internalApi/getEvent.d.ts.map +1 -0
- package/dist/eventRepository/internalApi/index.d.ts +2 -0
- package/dist/eventRepository/internalApi/index.d.ts.map +1 -0
- package/dist/eventRepository/observers/getEvent.d.ts +21 -0
- package/dist/eventRepository/observers/getEvent.d.ts.map +1 -0
- package/dist/eventRepository/observers/getEvents/LiveCollectionController.d.ts +13 -0
- package/dist/eventRepository/observers/getEvents/LiveCollectionController.d.ts.map +1 -0
- package/dist/eventRepository/observers/getEvents/PaginationController.d.ts +5 -0
- package/dist/eventRepository/observers/getEvents/PaginationController.d.ts.map +1 -0
- package/dist/eventRepository/observers/getEvents/QueryStreamController.d.ts +15 -0
- package/dist/eventRepository/observers/getEvents/QueryStreamController.d.ts.map +1 -0
- package/dist/eventRepository/observers/getEvents.d.ts +12 -0
- package/dist/eventRepository/observers/getEvents.d.ts.map +1 -0
- package/dist/eventRepository/observers/index.d.ts +3 -0
- package/dist/eventRepository/observers/index.d.ts.map +1 -0
- package/dist/eventRepository/utils/createEventEventSubscriber.d.ts +2 -0
- package/dist/eventRepository/utils/createEventEventSubscriber.d.ts.map +1 -0
- package/dist/eventRepository/utils/index.d.ts +1 -0
- package/dist/eventRepository/utils/index.d.ts.map +1 -1
- package/dist/index.cjs.js +346 -3
- package/dist/index.esm.js +346 -3
- package/dist/index.umd.js +3 -3
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/utils/linkedObject/eventLinkObject.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -643,6 +643,7 @@ const idResolvers = {
|
|
|
643
643
|
notificationTraySeen: ({ userId }) => userId,
|
|
644
644
|
invitation: ({ _id }) => _id,
|
|
645
645
|
joinRequest: ({ joinRequestId }) => joinRequestId,
|
|
646
|
+
event: ({ eventId }) => eventId,
|
|
646
647
|
};
|
|
647
648
|
/**
|
|
648
649
|
* Retrieve the id resolver matching a domain name
|
|
@@ -698,6 +699,8 @@ const PAYLOAD2MODEL = {
|
|
|
698
699
|
notificationTrayItems: 'notificationTrayItem',
|
|
699
700
|
invitations: 'invitation',
|
|
700
701
|
joinRequests: 'joinRequest',
|
|
702
|
+
events: 'event',
|
|
703
|
+
discussionCommunities: 'community',
|
|
701
704
|
};
|
|
702
705
|
/** hidden */
|
|
703
706
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -29776,9 +29779,13 @@ const eventLinkedObject = (event) => {
|
|
|
29776
29779
|
return userLinkedObject(cacheData.data);
|
|
29777
29780
|
},
|
|
29778
29781
|
get discussionCommunity() {
|
|
29779
|
-
if (!event.
|
|
29782
|
+
if (!event.discussionCommunityId)
|
|
29780
29783
|
return;
|
|
29781
|
-
const cacheData = pullFromCache([
|
|
29784
|
+
const cacheData = pullFromCache([
|
|
29785
|
+
'community',
|
|
29786
|
+
'get',
|
|
29787
|
+
event.discussionCommunityId,
|
|
29788
|
+
]);
|
|
29782
29789
|
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29783
29790
|
return;
|
|
29784
29791
|
return communityLinkedObject(cacheData.data);
|
|
@@ -46433,6 +46440,26 @@ const prepareEventPayload = (rawPayload) => {
|
|
|
46433
46440
|
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
46434
46441
|
};
|
|
46435
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
|
+
|
|
46436
46463
|
/* begin_public_function
|
|
46437
46464
|
id: event.create
|
|
46438
46465
|
*/
|
|
@@ -46500,10 +46527,326 @@ const updateEvent = async (eventId, bundle) => {
|
|
|
46500
46527
|
};
|
|
46501
46528
|
/* end_public_function */
|
|
46502
46529
|
|
|
46530
|
+
/* begin_public_function
|
|
46531
|
+
id: event.get
|
|
46532
|
+
*/
|
|
46533
|
+
/**
|
|
46534
|
+
* ```js
|
|
46535
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46536
|
+
* const event = await EventRepository.getEvent(eventId)
|
|
46537
|
+
* ```
|
|
46538
|
+
*
|
|
46539
|
+
* Fetches a {@link Amity.Event} object
|
|
46540
|
+
*
|
|
46541
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46542
|
+
* @returns the associated {@link Amity.Event} object
|
|
46543
|
+
*
|
|
46544
|
+
* @category Event API
|
|
46545
|
+
* @async
|
|
46546
|
+
*/
|
|
46547
|
+
const getEvent$1 = async (eventId) => {
|
|
46548
|
+
const client = getActiveClient();
|
|
46549
|
+
client.log('event/getEvent', eventId);
|
|
46550
|
+
const { data: payload } = await client.http.get(`/api/v3/events/${eventId}`);
|
|
46551
|
+
const data = prepareEventPayload(payload);
|
|
46552
|
+
const cachedAt = client.cache && Date.now();
|
|
46553
|
+
if (client.cache)
|
|
46554
|
+
ingestInCache(data, { cachedAt });
|
|
46555
|
+
return {
|
|
46556
|
+
data: data.events.find(event => event.eventId === eventId),
|
|
46557
|
+
cachedAt,
|
|
46558
|
+
};
|
|
46559
|
+
};
|
|
46560
|
+
/* end_public_function */
|
|
46561
|
+
/**
|
|
46562
|
+
* ```js
|
|
46563
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46564
|
+
* const event = EventRepository.getEvent.locally(eventId)
|
|
46565
|
+
* ```
|
|
46566
|
+
*
|
|
46567
|
+
* Fetches a {@link Amity.Event} object in cache
|
|
46568
|
+
*
|
|
46569
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46570
|
+
* @returns the associated {@link Amity.Event} object
|
|
46571
|
+
*
|
|
46572
|
+
* @category Event API
|
|
46573
|
+
*/
|
|
46574
|
+
getEvent$1.locally = (eventId) => {
|
|
46575
|
+
const client = getActiveClient();
|
|
46576
|
+
client.log('event/getEvent.locally', eventId);
|
|
46577
|
+
if (!client.cache)
|
|
46578
|
+
return;
|
|
46579
|
+
const cache = pullFromCache(['event', 'get', eventId]);
|
|
46580
|
+
if (!cache)
|
|
46581
|
+
return;
|
|
46582
|
+
return {
|
|
46583
|
+
data: cache.data,
|
|
46584
|
+
cachedAt: cache.cachedAt,
|
|
46585
|
+
};
|
|
46586
|
+
};
|
|
46587
|
+
|
|
46588
|
+
/* begin_public_function
|
|
46589
|
+
id: event.delete
|
|
46590
|
+
*/
|
|
46591
|
+
/**
|
|
46592
|
+
* ```js
|
|
46593
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46594
|
+
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
46595
|
+
* ```
|
|
46596
|
+
*
|
|
46597
|
+
* Deletes a {@link Amity.Event}
|
|
46598
|
+
*
|
|
46599
|
+
* @param eventId The {@link Amity.Event} ID to delete
|
|
46600
|
+
*
|
|
46601
|
+
* @category Event API
|
|
46602
|
+
* @async
|
|
46603
|
+
*/
|
|
46604
|
+
const deleteEvent = async (eventId) => {
|
|
46605
|
+
const client = getActiveClient();
|
|
46606
|
+
client.log('event/deleteEvent', eventId);
|
|
46607
|
+
const event = await getEvent$1(eventId);
|
|
46608
|
+
await client.http.delete(`/api/v3/events/${eventId}`);
|
|
46609
|
+
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
46610
|
+
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
46611
|
+
fireEvent('event.deleted', {
|
|
46612
|
+
users: [],
|
|
46613
|
+
files: [],
|
|
46614
|
+
communities: [],
|
|
46615
|
+
videoStreamings: [],
|
|
46616
|
+
events: [deletedEvent],
|
|
46617
|
+
discussionCommunities: [],
|
|
46618
|
+
});
|
|
46619
|
+
};
|
|
46620
|
+
/* end_public_function */
|
|
46621
|
+
|
|
46622
|
+
/**
|
|
46623
|
+
* ```js
|
|
46624
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46625
|
+
* const dispose = EventRepository.onEventCreated(event => {
|
|
46626
|
+
* // ...
|
|
46627
|
+
* })
|
|
46628
|
+
* ```
|
|
46629
|
+
*
|
|
46630
|
+
* Fired when a {@link Amity.Event} has been created
|
|
46631
|
+
*
|
|
46632
|
+
* @param callback The function to call when the event was fired
|
|
46633
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46634
|
+
*
|
|
46635
|
+
* @category Event Events
|
|
46636
|
+
*/
|
|
46637
|
+
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
46638
|
+
|
|
46639
|
+
/**
|
|
46640
|
+
* ```js
|
|
46641
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46642
|
+
* const dispose = EventRepository.onEventUpdated(event => {
|
|
46643
|
+
* // ...
|
|
46644
|
+
* })
|
|
46645
|
+
* ```
|
|
46646
|
+
*
|
|
46647
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
46648
|
+
*
|
|
46649
|
+
* @param callback The function to call when the event was fired
|
|
46650
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46651
|
+
*
|
|
46652
|
+
* @category Event Events
|
|
46653
|
+
*/
|
|
46654
|
+
const onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
46655
|
+
|
|
46656
|
+
/**
|
|
46657
|
+
* ```js
|
|
46658
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46659
|
+
* const dispose = EventRepository.onEventDeleted(event => {
|
|
46660
|
+
* // ...
|
|
46661
|
+
* })
|
|
46662
|
+
* ```
|
|
46663
|
+
*
|
|
46664
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
46665
|
+
*
|
|
46666
|
+
* @param callback The function to call when the event was fired
|
|
46667
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46668
|
+
*
|
|
46669
|
+
* @category Event Events
|
|
46670
|
+
*/
|
|
46671
|
+
const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
46672
|
+
|
|
46673
|
+
/* begin_public_function
|
|
46674
|
+
id: event.get
|
|
46675
|
+
*/
|
|
46676
|
+
/**
|
|
46677
|
+
* ```js
|
|
46678
|
+
* import { EventRepository } from '@amityco/ts-sdk';
|
|
46679
|
+
*
|
|
46680
|
+
* let event;
|
|
46681
|
+
*
|
|
46682
|
+
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
46683
|
+
* event = response.data;
|
|
46684
|
+
* });
|
|
46685
|
+
* ```
|
|
46686
|
+
*
|
|
46687
|
+
* Observe all mutation on a given {@link Amity.Event}
|
|
46688
|
+
*
|
|
46689
|
+
* @param eventId the ID of the event to observe
|
|
46690
|
+
* @param callback the function to call when new snapshot of event are available
|
|
46691
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
46692
|
+
*
|
|
46693
|
+
* @category Event Live Object
|
|
46694
|
+
*/
|
|
46695
|
+
const getEvent = (eventId, callback) => {
|
|
46696
|
+
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventCreated, onEventUpdated, onEventDeleted], {
|
|
46697
|
+
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
46698
|
+
});
|
|
46699
|
+
};
|
|
46700
|
+
/* end_public_function */
|
|
46701
|
+
|
|
46702
|
+
var EventActionsEnum;
|
|
46703
|
+
(function (EventActionsEnum) {
|
|
46704
|
+
EventActionsEnum["OnEventCreated"] = "onEventCreated";
|
|
46705
|
+
EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
|
|
46706
|
+
EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
|
|
46707
|
+
})(EventActionsEnum || (EventActionsEnum = {}));
|
|
46708
|
+
|
|
46709
|
+
class EventPaginationController extends PaginationController {
|
|
46710
|
+
async getRequest(queryParams, token) {
|
|
46711
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
46712
|
+
const options = token ? { token } : { limit };
|
|
46713
|
+
const { data: response } = await this.http.get(`/api/v1/events`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
46714
|
+
return response;
|
|
46715
|
+
}
|
|
46716
|
+
}
|
|
46717
|
+
|
|
46718
|
+
class EventQueryStreamController extends QueryStreamController {
|
|
46719
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
46720
|
+
super(query, cacheKey);
|
|
46721
|
+
this.notifyChange = notifyChange;
|
|
46722
|
+
this.preparePayload = preparePayload;
|
|
46723
|
+
}
|
|
46724
|
+
async saveToMainDB(response) {
|
|
46725
|
+
const processedPayload = this.preparePayload(response);
|
|
46726
|
+
const client = getActiveClient();
|
|
46727
|
+
const cachedAt = client.cache && Date.now();
|
|
46728
|
+
if (client.cache)
|
|
46729
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
46730
|
+
}
|
|
46731
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
46732
|
+
var _a, _b;
|
|
46733
|
+
if (refresh) {
|
|
46734
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
46735
|
+
}
|
|
46736
|
+
else {
|
|
46737
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46738
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
46739
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
46740
|
+
}
|
|
46741
|
+
}
|
|
46742
|
+
reactor(action) {
|
|
46743
|
+
return (event) => {
|
|
46744
|
+
var _a;
|
|
46745
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46746
|
+
if (!collection)
|
|
46747
|
+
return;
|
|
46748
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
46749
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
46750
|
+
}
|
|
46751
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
46752
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
46753
|
+
}
|
|
46754
|
+
pushToCache(this.cacheKey, collection);
|
|
46755
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
46756
|
+
};
|
|
46757
|
+
}
|
|
46758
|
+
subscribeRTE(createSubscriber) {
|
|
46759
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
46760
|
+
}
|
|
46761
|
+
}
|
|
46762
|
+
|
|
46763
|
+
class EventLiveCollectionController extends LiveCollectionController {
|
|
46764
|
+
constructor(query, callback) {
|
|
46765
|
+
const queryStreamId = hash(query);
|
|
46766
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
46767
|
+
const paginationController = new EventPaginationController(query);
|
|
46768
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
46769
|
+
this.query = query;
|
|
46770
|
+
this.queryStreamController = new EventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
46771
|
+
this.callback = callback.bind(this);
|
|
46772
|
+
this.loadPage({ initial: true });
|
|
46773
|
+
}
|
|
46774
|
+
setup() {
|
|
46775
|
+
var _a;
|
|
46776
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46777
|
+
if (!collection)
|
|
46778
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
46779
|
+
}
|
|
46780
|
+
async persistModel(queryPayload) {
|
|
46781
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
46782
|
+
}
|
|
46783
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
46784
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
46785
|
+
}
|
|
46786
|
+
startSubscription() {
|
|
46787
|
+
return this.queryStreamController.subscribeRTE([
|
|
46788
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
46789
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
46790
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
46791
|
+
]);
|
|
46792
|
+
}
|
|
46793
|
+
notifyChange({ origin, loading, error }) {
|
|
46794
|
+
var _a, _b;
|
|
46795
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46796
|
+
if (!collection)
|
|
46797
|
+
return;
|
|
46798
|
+
const data = ((_b = collection.data
|
|
46799
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
46800
|
+
.filter(isNonNullable)
|
|
46801
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
46802
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
46803
|
+
return;
|
|
46804
|
+
this.callback({
|
|
46805
|
+
data,
|
|
46806
|
+
error,
|
|
46807
|
+
loading,
|
|
46808
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
46809
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
46810
|
+
});
|
|
46811
|
+
}
|
|
46812
|
+
}
|
|
46813
|
+
|
|
46814
|
+
/**
|
|
46815
|
+
* Get events
|
|
46816
|
+
*
|
|
46817
|
+
* @param params the query parameters
|
|
46818
|
+
* @param callback the callback to be called when the events are updated
|
|
46819
|
+
* @returns events
|
|
46820
|
+
*
|
|
46821
|
+
* @category Event Live Collection
|
|
46822
|
+
*
|
|
46823
|
+
*/
|
|
46824
|
+
const getEvents = (params, callback, config) => {
|
|
46825
|
+
const { log, cache } = getActiveClient();
|
|
46826
|
+
if (!cache)
|
|
46827
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
46828
|
+
const timestamp = Date.now();
|
|
46829
|
+
log(`getEvents: (tmpid: ${timestamp}) > listen`);
|
|
46830
|
+
const eventLiveCollection = new EventLiveCollectionController(params, callback);
|
|
46831
|
+
const disposers = eventLiveCollection.startSubscription();
|
|
46832
|
+
const cacheKey = eventLiveCollection.getCacheKey();
|
|
46833
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
46834
|
+
return () => {
|
|
46835
|
+
log(`getEvents (tmpid: ${timestamp}) > dispose`);
|
|
46836
|
+
disposers.forEach(fn => fn());
|
|
46837
|
+
};
|
|
46838
|
+
};
|
|
46839
|
+
|
|
46503
46840
|
var index = /*#__PURE__*/Object.freeze({
|
|
46504
46841
|
__proto__: null,
|
|
46505
46842
|
createEvent: createEvent,
|
|
46506
|
-
updateEvent: updateEvent
|
|
46843
|
+
updateEvent: updateEvent,
|
|
46844
|
+
deleteEvent: deleteEvent,
|
|
46845
|
+
onEventCreated: onEventCreated,
|
|
46846
|
+
onEventUpdated: onEventUpdated,
|
|
46847
|
+
onEventDeleted: onEventDeleted,
|
|
46848
|
+
getEvent: getEvent,
|
|
46849
|
+
getEvents: getEvents
|
|
46507
46850
|
});
|
|
46508
46851
|
|
|
46509
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 };
|