@amityco/ts-sdk 7.11.0 → 7.11.1-084e4b1c.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/events.d.ts +32 -2
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +4 -0
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +17 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/core/permissions.d.ts +5 -1
- package/dist/@types/core/permissions.d.ts.map +1 -1
- 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 +11 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/event.d.ts +81 -0
- package/dist/@types/domains/event.d.ts.map +1 -0
- package/dist/@types/domains/partials.d.ts +2 -2
- package/dist/@types/domains/partials.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.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/createEvent.d.ts +16 -0
- package/dist/eventRepository/api/createEvent.d.ts.map +1 -0
- 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 +4 -0
- package/dist/eventRepository/api/index.d.ts.map +1 -0
- package/dist/eventRepository/api/updateEvent.d.ts +17 -0
- package/dist/eventRepository/api/updateEvent.d.ts.map +1 -0
- 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 +7 -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/events/onLocalEventCreated.d.ts +17 -0
- package/dist/eventRepository/events/onLocalEventCreated.d.ts.map +1 -0
- package/dist/eventRepository/events/onLocalEventDeleted.d.ts +17 -0
- package/dist/eventRepository/events/onLocalEventDeleted.d.ts.map +1 -0
- package/dist/eventRepository/events/onLocalEventUpdated.d.ts +17 -0
- package/dist/eventRepository/events/onLocalEventUpdated.d.ts.map +1 -0
- package/dist/eventRepository/index.d.ts +4 -0
- package/dist/eventRepository/index.d.ts.map +1 -0
- 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/getMyEvents/LiveCollectionController.d.ts +13 -0
- package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts.map +1 -0
- package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts +5 -0
- package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts.map +1 -0
- package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts +15 -0
- package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts.map +1 -0
- package/dist/eventRepository/observers/getMyEvents.d.ts +12 -0
- package/dist/eventRepository/observers/getMyEvents.d.ts.map +1 -0
- package/dist/eventRepository/observers/index.d.ts +4 -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 +3 -0
- package/dist/eventRepository/utils/index.d.ts.map +1 -0
- package/dist/eventRepository/utils/prepareEventPayload.d.ts +2 -0
- package/dist/eventRepository/utils/prepareEventPayload.d.ts.map +1 -0
- package/dist/index.cjs.js +734 -51
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +714 -32
- package/dist/index.umd.js +3 -3
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/utils/linkedObject/eventLinkObject.d.ts +2 -0
- package/dist/utils/linkedObject/eventLinkObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -177,6 +177,30 @@ var FeedSourceEnum;
|
|
|
177
177
|
FeedSourceEnum["User"] = "user";
|
|
178
178
|
})(FeedSourceEnum || (FeedSourceEnum = {}));
|
|
179
179
|
|
|
180
|
+
var AmityEventType;
|
|
181
|
+
(function (AmityEventType) {
|
|
182
|
+
AmityEventType["Virtual"] = "virtual";
|
|
183
|
+
AmityEventType["InPerson"] = "in_person";
|
|
184
|
+
})(AmityEventType || (AmityEventType = {}));
|
|
185
|
+
var AmityEventOriginType;
|
|
186
|
+
(function (AmityEventOriginType) {
|
|
187
|
+
AmityEventOriginType["Community"] = "community";
|
|
188
|
+
AmityEventOriginType["User"] = "user";
|
|
189
|
+
})(AmityEventOriginType || (AmityEventOriginType = {}));
|
|
190
|
+
var AmityEventStatus;
|
|
191
|
+
(function (AmityEventStatus) {
|
|
192
|
+
AmityEventStatus["Scheduled"] = "scheduled";
|
|
193
|
+
AmityEventStatus["Live"] = "live";
|
|
194
|
+
AmityEventStatus["Ended"] = "ended";
|
|
195
|
+
AmityEventStatus["Cancelled"] = "cancelled";
|
|
196
|
+
})(AmityEventStatus || (AmityEventStatus = {}));
|
|
197
|
+
var AmityEventResponseStatus;
|
|
198
|
+
(function (AmityEventResponseStatus) {
|
|
199
|
+
AmityEventResponseStatus["Going"] = "going";
|
|
200
|
+
AmityEventResponseStatus["Interested"] = "interested";
|
|
201
|
+
AmityEventResponseStatus["NotGoing"] = "not_going";
|
|
202
|
+
})(AmityEventResponseStatus || (AmityEventResponseStatus = {}));
|
|
203
|
+
|
|
180
204
|
function getVersion() {
|
|
181
205
|
try {
|
|
182
206
|
// the string ''v7.11.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -625,6 +649,8 @@ const idResolvers = {
|
|
|
625
649
|
notificationTraySeen: ({ userId }) => userId,
|
|
626
650
|
invitation: ({ _id }) => _id,
|
|
627
651
|
joinRequest: ({ joinRequestId }) => joinRequestId,
|
|
652
|
+
event: ({ eventId }) => eventId,
|
|
653
|
+
discussionCommunity: ({ communityId }) => communityId,
|
|
628
654
|
};
|
|
629
655
|
/**
|
|
630
656
|
* Retrieve the id resolver matching a domain name
|
|
@@ -680,6 +706,8 @@ const PAYLOAD2MODEL = {
|
|
|
680
706
|
notificationTrayItems: 'notificationTrayItem',
|
|
681
707
|
invitations: 'invitation',
|
|
682
708
|
joinRequests: 'joinRequest',
|
|
709
|
+
events: 'event',
|
|
710
|
+
discussionCommunities: 'discussionCommunity',
|
|
683
711
|
};
|
|
684
712
|
/** hidden */
|
|
685
713
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -26552,7 +26580,7 @@ const getUserUnread = (callback) => {
|
|
|
26552
26580
|
};
|
|
26553
26581
|
};
|
|
26554
26582
|
|
|
26555
|
-
var index$
|
|
26583
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
26556
26584
|
__proto__: null,
|
|
26557
26585
|
getActiveClient: getActiveClient,
|
|
26558
26586
|
getActiveUser: getActiveUser,
|
|
@@ -27771,7 +27799,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
27771
27799
|
};
|
|
27772
27800
|
/* end_public_function */
|
|
27773
27801
|
|
|
27774
|
-
var index$
|
|
27802
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
27775
27803
|
__proto__: null,
|
|
27776
27804
|
blockUser: blockUser,
|
|
27777
27805
|
unBlockUser: unBlockUser,
|
|
@@ -29750,6 +29778,51 @@ const communityLinkedObject = (community) => {
|
|
|
29750
29778
|
} });
|
|
29751
29779
|
};
|
|
29752
29780
|
|
|
29781
|
+
const eventLinkedObject = (event) => {
|
|
29782
|
+
return Object.assign(Object.assign({}, event), { get creator() {
|
|
29783
|
+
const cacheData = pullFromCache(['user', 'get', event.userId]);
|
|
29784
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29785
|
+
return;
|
|
29786
|
+
return userLinkedObject(cacheData.data);
|
|
29787
|
+
},
|
|
29788
|
+
get discussionCommunity() {
|
|
29789
|
+
if (!event.discussionCommunityId)
|
|
29790
|
+
return;
|
|
29791
|
+
const cacheData = pullFromCache([
|
|
29792
|
+
'discussionCommunity',
|
|
29793
|
+
'get',
|
|
29794
|
+
event.discussionCommunityId,
|
|
29795
|
+
]);
|
|
29796
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29797
|
+
return;
|
|
29798
|
+
return communityLinkedObject(cacheData.data);
|
|
29799
|
+
},
|
|
29800
|
+
get targetCommunity() {
|
|
29801
|
+
if (!event.originId)
|
|
29802
|
+
return;
|
|
29803
|
+
const cacheData = pullFromCache(['community', 'get', event.originId]);
|
|
29804
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29805
|
+
return;
|
|
29806
|
+
return communityLinkedObject(cacheData.data);
|
|
29807
|
+
},
|
|
29808
|
+
get coverImage() {
|
|
29809
|
+
if (!event.coverImageFileId)
|
|
29810
|
+
return;
|
|
29811
|
+
const cacheData = pullFromCache(['file', 'get', event.coverImageFileId]);
|
|
29812
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29813
|
+
return;
|
|
29814
|
+
return cacheData.data;
|
|
29815
|
+
},
|
|
29816
|
+
get liveStream() {
|
|
29817
|
+
if (!event.livestreamId)
|
|
29818
|
+
return;
|
|
29819
|
+
const cacheData = pullFromCache(['stream', 'get', event.livestreamId]);
|
|
29820
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29821
|
+
return;
|
|
29822
|
+
return cacheData.data;
|
|
29823
|
+
} });
|
|
29824
|
+
};
|
|
29825
|
+
|
|
29753
29826
|
const LinkedObject = {
|
|
29754
29827
|
ad: adLinkedObject,
|
|
29755
29828
|
comment: commentLinkedObject,
|
|
@@ -29768,6 +29841,7 @@ const LinkedObject = {
|
|
|
29768
29841
|
invitation: invitationLinkedObject,
|
|
29769
29842
|
joinRequest: joinRequestLinkedObject,
|
|
29770
29843
|
channelMember: channelMemberLinkedObject,
|
|
29844
|
+
event: eventLinkedObject,
|
|
29771
29845
|
};
|
|
29772
29846
|
|
|
29773
29847
|
/* begin_public_function
|
|
@@ -30758,9 +30832,9 @@ var AmityUserSearchMatchType;
|
|
|
30758
30832
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
30759
30833
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
30760
30834
|
|
|
30761
|
-
var index$
|
|
30835
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
30762
30836
|
__proto__: null,
|
|
30763
|
-
Relationship: index$
|
|
30837
|
+
Relationship: index$o,
|
|
30764
30838
|
getUserByIds: getUserByIds,
|
|
30765
30839
|
updateUser: updateUser,
|
|
30766
30840
|
flagUser: flagUser,
|
|
@@ -31163,7 +31237,7 @@ const uploadAudio = async (formData, onProgress) => {
|
|
|
31163
31237
|
};
|
|
31164
31238
|
/* end_public_function */
|
|
31165
31239
|
|
|
31166
|
-
var index$
|
|
31240
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
31167
31241
|
__proto__: null,
|
|
31168
31242
|
getFile: getFile,
|
|
31169
31243
|
uploadFile: uploadFile,
|
|
@@ -32975,7 +33049,7 @@ const getReactions$1 = (params, callback, config) => {
|
|
|
32975
33049
|
};
|
|
32976
33050
|
/* end_public_function */
|
|
32977
33051
|
|
|
32978
|
-
var index$
|
|
33052
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
32979
33053
|
__proto__: null,
|
|
32980
33054
|
addReaction: addReaction,
|
|
32981
33055
|
removeReaction: removeReaction,
|
|
@@ -34747,7 +34821,7 @@ const getMessages = (params, callback, config) => {
|
|
|
34747
34821
|
};
|
|
34748
34822
|
/* end_public_function */
|
|
34749
34823
|
|
|
34750
|
-
var index$
|
|
34824
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
34751
34825
|
__proto__: null,
|
|
34752
34826
|
createMessage: createMessage,
|
|
34753
34827
|
updateMessage: updateMessage,
|
|
@@ -35273,7 +35347,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
35273
35347
|
};
|
|
35274
35348
|
/* end_public_function */
|
|
35275
35349
|
|
|
35276
|
-
var index$
|
|
35350
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
35277
35351
|
__proto__: null,
|
|
35278
35352
|
getSubChannelByIds: getSubChannels$1,
|
|
35279
35353
|
createSubChannel: createSubChannel,
|
|
@@ -36600,7 +36674,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
36600
36674
|
};
|
|
36601
36675
|
/* end_public_function */
|
|
36602
36676
|
|
|
36603
|
-
var index$
|
|
36677
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
36604
36678
|
__proto__: null,
|
|
36605
36679
|
addMembers: addMembers$1,
|
|
36606
36680
|
removeMembers: removeMembers$1,
|
|
@@ -36803,7 +36877,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
36803
36877
|
};
|
|
36804
36878
|
/* end_public_function */
|
|
36805
36879
|
|
|
36806
|
-
var index$
|
|
36880
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
36807
36881
|
__proto__: null,
|
|
36808
36882
|
addRole: addRole,
|
|
36809
36883
|
removeRole: removeRole,
|
|
@@ -36813,10 +36887,10 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
36813
36887
|
unmuteMembers: unmuteMembers
|
|
36814
36888
|
});
|
|
36815
36889
|
|
|
36816
|
-
var index$
|
|
36890
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
36817
36891
|
__proto__: null,
|
|
36818
|
-
Membership: index$
|
|
36819
|
-
Moderation: index$
|
|
36892
|
+
Membership: index$i,
|
|
36893
|
+
Moderation: index$h,
|
|
36820
36894
|
getChannelByIds: getChannelByIds$1,
|
|
36821
36895
|
createChannel: createChannel,
|
|
36822
36896
|
updateChannel: updateChannel,
|
|
@@ -38219,7 +38293,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
38219
38293
|
};
|
|
38220
38294
|
/* end_public_function */
|
|
38221
38295
|
|
|
38222
|
-
var index$
|
|
38296
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
38223
38297
|
__proto__: null,
|
|
38224
38298
|
addMembers: addMembers,
|
|
38225
38299
|
removeMembers: removeMembers,
|
|
@@ -39470,7 +39544,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
39470
39544
|
};
|
|
39471
39545
|
/* end_public_function */
|
|
39472
39546
|
|
|
39473
|
-
var index$
|
|
39547
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
39474
39548
|
__proto__: null,
|
|
39475
39549
|
addRoles: addRoles,
|
|
39476
39550
|
removeRoles: removeRoles,
|
|
@@ -39478,10 +39552,10 @@ var index$d = /*#__PURE__*/Object.freeze({
|
|
|
39478
39552
|
unbanMembers: unbanMembers
|
|
39479
39553
|
});
|
|
39480
39554
|
|
|
39481
|
-
var index$
|
|
39555
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
39482
39556
|
__proto__: null,
|
|
39483
|
-
Moderation: index$
|
|
39484
|
-
Membership: index$
|
|
39557
|
+
Moderation: index$e,
|
|
39558
|
+
Membership: index$f,
|
|
39485
39559
|
getCommunityByIds: getCommunities$1,
|
|
39486
39560
|
createCommunity: createCommunity,
|
|
39487
39561
|
updateCommunity: updateCommunity,
|
|
@@ -39715,7 +39789,7 @@ const getCategories = (params, callback, config) => {
|
|
|
39715
39789
|
};
|
|
39716
39790
|
/* end_public_function */
|
|
39717
39791
|
|
|
39718
|
-
var index$
|
|
39792
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
39719
39793
|
__proto__: null,
|
|
39720
39794
|
getCategory: getCategory,
|
|
39721
39795
|
getCategories: getCategories
|
|
@@ -40774,7 +40848,7 @@ const getComments = (params, callback, config) => {
|
|
|
40774
40848
|
};
|
|
40775
40849
|
/* end_public_function */
|
|
40776
40850
|
|
|
40777
|
-
var index$
|
|
40851
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
40778
40852
|
__proto__: null,
|
|
40779
40853
|
getCommentByIds: getCommentByIds,
|
|
40780
40854
|
createComment: createComment,
|
|
@@ -41445,7 +41519,7 @@ const getUserFeed = (params, callback, config) => {
|
|
|
41445
41519
|
};
|
|
41446
41520
|
/* end_public_function */
|
|
41447
41521
|
|
|
41448
|
-
var index$
|
|
41522
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
41449
41523
|
__proto__: null,
|
|
41450
41524
|
queryGlobalFeed: queryGlobalFeed,
|
|
41451
41525
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
|
|
@@ -43126,7 +43200,7 @@ const searchPostsByHashtag = (params, callback, config) => {
|
|
|
43126
43200
|
};
|
|
43127
43201
|
/* end_public_function */
|
|
43128
43202
|
|
|
43129
|
-
var index$
|
|
43203
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
43130
43204
|
__proto__: null,
|
|
43131
43205
|
getPostByIds: getPostByIds,
|
|
43132
43206
|
createPost: createPost,
|
|
@@ -43734,7 +43808,7 @@ const getStreams = (params, callback, config) => {
|
|
|
43734
43808
|
};
|
|
43735
43809
|
};
|
|
43736
43810
|
|
|
43737
|
-
var index$
|
|
43811
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
43738
43812
|
__proto__: null,
|
|
43739
43813
|
createStream: createStream,
|
|
43740
43814
|
updateStream: updateStream,
|
|
@@ -44052,7 +44126,7 @@ const getPoll = (pollId, callback) => {
|
|
|
44052
44126
|
};
|
|
44053
44127
|
/* end_public_function */
|
|
44054
44128
|
|
|
44055
|
-
var index$
|
|
44129
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
44056
44130
|
__proto__: null,
|
|
44057
44131
|
createPoll: createPoll,
|
|
44058
44132
|
closePoll: closePoll,
|
|
@@ -44064,7 +44138,7 @@ var index$6 = /*#__PURE__*/Object.freeze({
|
|
|
44064
44138
|
getPoll: getPoll
|
|
44065
44139
|
});
|
|
44066
44140
|
|
|
44067
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
44141
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\nE6PpzMOXFi1W1o+I22jDakuSM2SOQKqI/u0QefB0r0O/KVk5NrZHXk0mkrdYtxOp\nUgaGyf8UvmjB+8VqHrNKyZdk9qtmbnNj01kTTcAtmE4H39zPR7eR/8Rul94vaZbs\nwCnKJS3mLT3JxyGug6lxanveKkjG+CKC1nJQYWaxCJxaFSzbwXQPvDhB+TvrIbee\npd5v4EAyEJohpr+T9oDGGJkb/KARBZCtwLyB976PKJwwBA8MRVL1i5QwawuMiMq5\nUtnOnbGKtCeFzaLbNU0Qi8bqyims84EQxC6DOu1fkQKBgQDdvsoBsEhsOXV7hlIJ\naEd0eSJZVkdqimxH8uGoMM2FeNaOrcB6yBXqTSP0R3OIyf8eaY6yjRvP30ZNXcll\n/gD3O1Mu6YmWQdt1W2WA6pKOsUuPXasf0pdOF7IiFZKlSabz5YHXFqwVuqm8loaj\nsXel3YWqPVdHiankE7tz+3ssnQKBgQDdqi4TNdD1MdEpihx19jr0QjUiXW3939FK\nqp30HESPEGDGQzXdmJgif9HhZb+cJSuWaHEbjgBrYahvgCF+y6LbEpOD+D/dmT+s\nDEAQaR84sah6dokwPjV8fjBSrcVFjCS+doxv0d3p/9OUEeyUhFrY03nxtIEYkLIE\n/Zvn37b4RwKBgQCLENVFe9XfsaVhQ5r9dV2iyTlmh7qgMZG5CbTFs12hQGhm8McO\n+Z7s41YSJCFr/yq1WwP4LJDtrBw99vyQr1zRsG35tNLp3gGRNzGQSQyC2uQFVHw2\np+7mNewsfhUK/gbrXNsyFnDz6635rPlhfbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
44068
44142
|
/*
|
|
44069
44143
|
* The crypto algorithm used for importing key and signing string
|
|
44070
44144
|
*/
|
|
@@ -44435,7 +44509,7 @@ const getPlayer = async (parameters) => {
|
|
|
44435
44509
|
return video;
|
|
44436
44510
|
};
|
|
44437
44511
|
|
|
44438
|
-
var index$
|
|
44512
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
44439
44513
|
__proto__: null,
|
|
44440
44514
|
getPlayer: getPlayer
|
|
44441
44515
|
});
|
|
@@ -45608,7 +45682,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
45608
45682
|
};
|
|
45609
45683
|
};
|
|
45610
45684
|
|
|
45611
|
-
var index$
|
|
45685
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
45612
45686
|
__proto__: null,
|
|
45613
45687
|
createImageStory: createImageStory,
|
|
45614
45688
|
createVideoStory: createVideoStory,
|
|
@@ -45645,7 +45719,7 @@ const getNetworkAds = async () => {
|
|
|
45645
45719
|
};
|
|
45646
45720
|
};
|
|
45647
45721
|
|
|
45648
|
-
var index$
|
|
45722
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
45649
45723
|
__proto__: null,
|
|
45650
45724
|
getNetworkAds: getNetworkAds
|
|
45651
45725
|
});
|
|
@@ -46036,7 +46110,7 @@ const markTraySeen = async (lastSeenAt) => {
|
|
|
46036
46110
|
};
|
|
46037
46111
|
/* end_public_function */
|
|
46038
46112
|
|
|
46039
|
-
var index$
|
|
46113
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
46040
46114
|
__proto__: null,
|
|
46041
46115
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
46042
46116
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
@@ -46237,7 +46311,7 @@ const getMyCommunityInvitations = (params, callback, config) => {
|
|
|
46237
46311
|
};
|
|
46238
46312
|
};
|
|
46239
46313
|
|
|
46240
|
-
var index$
|
|
46314
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
46241
46315
|
__proto__: null,
|
|
46242
46316
|
onLocalInvitationCreated: onLocalInvitationCreated,
|
|
46243
46317
|
onLocalInvitationUpdated: onLocalInvitationUpdated,
|
|
@@ -46378,11 +46452,619 @@ const getReactions = (postId, callback) => {
|
|
|
46378
46452
|
};
|
|
46379
46453
|
};
|
|
46380
46454
|
|
|
46381
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
46455
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
46382
46456
|
__proto__: null,
|
|
46383
46457
|
createReaction: createReaction,
|
|
46384
46458
|
onLiveReactionCreated: onLiveReactionCreated,
|
|
46385
46459
|
getReactions: getReactions
|
|
46386
46460
|
});
|
|
46387
46461
|
|
|
46388
|
-
|
|
46462
|
+
const prepareEventPayload = (rawPayload) => {
|
|
46463
|
+
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
46464
|
+
};
|
|
46465
|
+
|
|
46466
|
+
const createEventEventSubscriber = (event, callback) => {
|
|
46467
|
+
const client = getActiveClient();
|
|
46468
|
+
const filter = (payload) => {
|
|
46469
|
+
const unpackedPayload = prepareEventPayload(payload);
|
|
46470
|
+
if (!client.cache) {
|
|
46471
|
+
callback(unpackedPayload.events[0]);
|
|
46472
|
+
}
|
|
46473
|
+
else {
|
|
46474
|
+
ingestInCache(unpackedPayload);
|
|
46475
|
+
const event = pullFromCache([
|
|
46476
|
+
'event',
|
|
46477
|
+
'get',
|
|
46478
|
+
unpackedPayload.events[0].eventId,
|
|
46479
|
+
]);
|
|
46480
|
+
callback(event.data);
|
|
46481
|
+
}
|
|
46482
|
+
};
|
|
46483
|
+
return createEventSubscriber(client, event, event, filter);
|
|
46484
|
+
};
|
|
46485
|
+
|
|
46486
|
+
/* begin_public_function
|
|
46487
|
+
id: event.create
|
|
46488
|
+
*/
|
|
46489
|
+
/**
|
|
46490
|
+
* ```js
|
|
46491
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46492
|
+
* const response = await EventRepository.createEvent(bundle)
|
|
46493
|
+
* ```
|
|
46494
|
+
*
|
|
46495
|
+
* Creates an {@link Amity.Event}
|
|
46496
|
+
*
|
|
46497
|
+
* @param bundle The data necessary to create a new {@link Amity.Event}
|
|
46498
|
+
* @returns The newly created {@link Amity.Event}
|
|
46499
|
+
*
|
|
46500
|
+
* @category Event API
|
|
46501
|
+
* @async
|
|
46502
|
+
*/
|
|
46503
|
+
const createEvent = async (bundle) => {
|
|
46504
|
+
const client = getActiveClient();
|
|
46505
|
+
client.log('event/createEvent', bundle);
|
|
46506
|
+
const { data: payload } = await client.http.post('/api/v1/events', bundle);
|
|
46507
|
+
fireEvent('local.event.created', payload);
|
|
46508
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
46509
|
+
const cachedAt = client.cache && Date.now();
|
|
46510
|
+
if (client.cache)
|
|
46511
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
46512
|
+
return {
|
|
46513
|
+
data: eventLinkedObject(preparedPayload.events[0]),
|
|
46514
|
+
cachedAt,
|
|
46515
|
+
};
|
|
46516
|
+
};
|
|
46517
|
+
/* end_public_function */
|
|
46518
|
+
|
|
46519
|
+
/* begin_public_function
|
|
46520
|
+
id: event.update
|
|
46521
|
+
*/
|
|
46522
|
+
/**
|
|
46523
|
+
* ```js
|
|
46524
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46525
|
+
* const response = await EventRepository.updateEvent(eventId, bundle)
|
|
46526
|
+
* ```
|
|
46527
|
+
*
|
|
46528
|
+
* Updates an {@link Amity.Event}
|
|
46529
|
+
*
|
|
46530
|
+
* @param eventId The ID of the {@link Amity.Event} to edit
|
|
46531
|
+
* @param bundle The data necessary to update an existing {@link Amity.Event}
|
|
46532
|
+
* @returns the updated {@link Amity.Event}
|
|
46533
|
+
*
|
|
46534
|
+
* @category Event API
|
|
46535
|
+
* @async
|
|
46536
|
+
*/
|
|
46537
|
+
const updateEvent = async (eventId, bundle) => {
|
|
46538
|
+
const client = getActiveClient();
|
|
46539
|
+
client.log('event/updateEvent', eventId, bundle);
|
|
46540
|
+
const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
|
|
46541
|
+
fireEvent('local.event.updated', payload);
|
|
46542
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
46543
|
+
const cachedAt = client.cache && Date.now();
|
|
46544
|
+
if (client.cache)
|
|
46545
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
46546
|
+
return {
|
|
46547
|
+
data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
|
|
46548
|
+
cachedAt,
|
|
46549
|
+
};
|
|
46550
|
+
};
|
|
46551
|
+
/* end_public_function */
|
|
46552
|
+
|
|
46553
|
+
/* begin_public_function
|
|
46554
|
+
id: event.get
|
|
46555
|
+
*/
|
|
46556
|
+
/**
|
|
46557
|
+
* ```js
|
|
46558
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46559
|
+
* const event = await EventRepository.getEvent(eventId)
|
|
46560
|
+
* ```
|
|
46561
|
+
*
|
|
46562
|
+
* Fetches a {@link Amity.Event} object
|
|
46563
|
+
*
|
|
46564
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46565
|
+
* @returns the associated {@link Amity.Event} object
|
|
46566
|
+
*
|
|
46567
|
+
* @category Event API
|
|
46568
|
+
* @async
|
|
46569
|
+
*/
|
|
46570
|
+
const getEvent$1 = async (eventId) => {
|
|
46571
|
+
const client = getActiveClient();
|
|
46572
|
+
client.log('event/getEvent', eventId);
|
|
46573
|
+
const { data: payload } = await client.http.get(`/api/v1/events/${eventId}`);
|
|
46574
|
+
const data = prepareEventPayload(payload);
|
|
46575
|
+
const cachedAt = client.cache && Date.now();
|
|
46576
|
+
if (client.cache)
|
|
46577
|
+
ingestInCache(data, { cachedAt });
|
|
46578
|
+
return {
|
|
46579
|
+
data: data.events.find(event => event.eventId === eventId),
|
|
46580
|
+
cachedAt,
|
|
46581
|
+
};
|
|
46582
|
+
};
|
|
46583
|
+
/* end_public_function */
|
|
46584
|
+
/**
|
|
46585
|
+
* ```js
|
|
46586
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46587
|
+
* const event = EventRepository.getEvent.locally(eventId)
|
|
46588
|
+
* ```
|
|
46589
|
+
*
|
|
46590
|
+
* Fetches a {@link Amity.Event} object in cache
|
|
46591
|
+
*
|
|
46592
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46593
|
+
* @returns the associated {@link Amity.Event} object
|
|
46594
|
+
*
|
|
46595
|
+
* @category Event API
|
|
46596
|
+
*/
|
|
46597
|
+
getEvent$1.locally = (eventId) => {
|
|
46598
|
+
const client = getActiveClient();
|
|
46599
|
+
client.log('event/getEvent.locally', eventId);
|
|
46600
|
+
if (!client.cache)
|
|
46601
|
+
return;
|
|
46602
|
+
const cache = pullFromCache(['event', 'get', eventId]);
|
|
46603
|
+
if (!cache)
|
|
46604
|
+
return;
|
|
46605
|
+
return {
|
|
46606
|
+
data: cache.data,
|
|
46607
|
+
cachedAt: cache.cachedAt,
|
|
46608
|
+
};
|
|
46609
|
+
};
|
|
46610
|
+
|
|
46611
|
+
/* begin_public_function
|
|
46612
|
+
id: event.delete
|
|
46613
|
+
*/
|
|
46614
|
+
/**
|
|
46615
|
+
* ```js
|
|
46616
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46617
|
+
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
46618
|
+
* ```
|
|
46619
|
+
*
|
|
46620
|
+
* Deletes a {@link Amity.Event}
|
|
46621
|
+
*
|
|
46622
|
+
* @param eventId The {@link Amity.Event} ID to delete
|
|
46623
|
+
*
|
|
46624
|
+
* @category Event API
|
|
46625
|
+
* @async
|
|
46626
|
+
*/
|
|
46627
|
+
const deleteEvent = async (eventId) => {
|
|
46628
|
+
const client = getActiveClient();
|
|
46629
|
+
client.log('event/deleteEvent', eventId);
|
|
46630
|
+
const event = await getEvent$1(eventId);
|
|
46631
|
+
await client.http.delete(`/api/v1/events/${eventId}`);
|
|
46632
|
+
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
46633
|
+
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
46634
|
+
fireEvent('local.event.deleted', {
|
|
46635
|
+
users: [],
|
|
46636
|
+
files: [],
|
|
46637
|
+
communities: [],
|
|
46638
|
+
videoStreamings: [],
|
|
46639
|
+
events: [deletedEvent],
|
|
46640
|
+
discussionCommunities: [],
|
|
46641
|
+
});
|
|
46642
|
+
};
|
|
46643
|
+
/* end_public_function */
|
|
46644
|
+
|
|
46645
|
+
/**
|
|
46646
|
+
* ```js
|
|
46647
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46648
|
+
* const dispose = EventRepository.onEventCreated(event => {
|
|
46649
|
+
* // ...
|
|
46650
|
+
* })
|
|
46651
|
+
* ```
|
|
46652
|
+
*
|
|
46653
|
+
* Fired when a {@link Amity.Event} has been created
|
|
46654
|
+
*
|
|
46655
|
+
* @param callback The function to call when the event was fired
|
|
46656
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46657
|
+
*
|
|
46658
|
+
* @category Event Events
|
|
46659
|
+
*/
|
|
46660
|
+
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
46661
|
+
|
|
46662
|
+
/**
|
|
46663
|
+
* ```js
|
|
46664
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46665
|
+
* const dispose = EventRepository.onEventUpdated(event => {
|
|
46666
|
+
* // ...
|
|
46667
|
+
* })
|
|
46668
|
+
* ```
|
|
46669
|
+
*
|
|
46670
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
46671
|
+
*
|
|
46672
|
+
* @param callback The function to call when the event was fired
|
|
46673
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46674
|
+
*
|
|
46675
|
+
* @category Event Events
|
|
46676
|
+
*/
|
|
46677
|
+
const onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
46678
|
+
|
|
46679
|
+
/**
|
|
46680
|
+
* ```js
|
|
46681
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46682
|
+
* const dispose = EventRepository.onEventDeleted(event => {
|
|
46683
|
+
* // ...
|
|
46684
|
+
* })
|
|
46685
|
+
* ```
|
|
46686
|
+
*
|
|
46687
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
46688
|
+
*
|
|
46689
|
+
* @param callback The function to call when the event was fired
|
|
46690
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46691
|
+
*
|
|
46692
|
+
* @category Event Events
|
|
46693
|
+
*/
|
|
46694
|
+
const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
46695
|
+
|
|
46696
|
+
/**
|
|
46697
|
+
* ```js
|
|
46698
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46699
|
+
* const dispose = EventRepository.onLocalEventCreated(event => {
|
|
46700
|
+
* // ...
|
|
46701
|
+
* })
|
|
46702
|
+
* ```
|
|
46703
|
+
*
|
|
46704
|
+
* Fired when a {@link Amity.Event} has been created
|
|
46705
|
+
*
|
|
46706
|
+
* @param callback The function to call when the event was fired
|
|
46707
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46708
|
+
*
|
|
46709
|
+
* @category Event Events
|
|
46710
|
+
*/
|
|
46711
|
+
const onLocalEventCreated = (callback) => createEventEventSubscriber('local.event.created', callback);
|
|
46712
|
+
|
|
46713
|
+
/**
|
|
46714
|
+
* ```js
|
|
46715
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46716
|
+
* const dispose = EventRepository.onLocalEventUpdated(event => {
|
|
46717
|
+
* // ...
|
|
46718
|
+
* })
|
|
46719
|
+
* ```
|
|
46720
|
+
*
|
|
46721
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
46722
|
+
*
|
|
46723
|
+
* @param callback The function to call when the event was fired
|
|
46724
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46725
|
+
*
|
|
46726
|
+
* @category Event Events
|
|
46727
|
+
*/
|
|
46728
|
+
const onLocalEventUpdated = (callback) => createEventEventSubscriber('local.event.updated', callback);
|
|
46729
|
+
|
|
46730
|
+
/**
|
|
46731
|
+
* ```js
|
|
46732
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46733
|
+
* const dispose = EventRepository.onLocalEventDeleted(event => {
|
|
46734
|
+
* // ...
|
|
46735
|
+
* })
|
|
46736
|
+
* ```
|
|
46737
|
+
*
|
|
46738
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
46739
|
+
*
|
|
46740
|
+
* @param callback The function to call when the event was fired
|
|
46741
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46742
|
+
*
|
|
46743
|
+
* @category Event Events
|
|
46744
|
+
*/
|
|
46745
|
+
const onLocalEventDeleted = (callback) => createEventEventSubscriber('local.event.deleted', callback);
|
|
46746
|
+
|
|
46747
|
+
/* begin_public_function
|
|
46748
|
+
id: event.get
|
|
46749
|
+
*/
|
|
46750
|
+
/**
|
|
46751
|
+
* ```js
|
|
46752
|
+
* import { EventRepository } from '@amityco/ts-sdk';
|
|
46753
|
+
*
|
|
46754
|
+
* let event;
|
|
46755
|
+
*
|
|
46756
|
+
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
46757
|
+
* event = response.data;
|
|
46758
|
+
* });
|
|
46759
|
+
* ```
|
|
46760
|
+
*
|
|
46761
|
+
* Observe all mutation on a given {@link Amity.Event}
|
|
46762
|
+
*
|
|
46763
|
+
* @param eventId the ID of the event to observe
|
|
46764
|
+
* @param callback the function to call when new snapshot of event are available
|
|
46765
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
46766
|
+
*
|
|
46767
|
+
* @category Event Live Object
|
|
46768
|
+
*/
|
|
46769
|
+
const getEvent = (eventId, callback) => {
|
|
46770
|
+
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventUpdated, onEventDeleted, onLocalEventUpdated, onLocalEventDeleted], {
|
|
46771
|
+
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
46772
|
+
});
|
|
46773
|
+
};
|
|
46774
|
+
/* end_public_function */
|
|
46775
|
+
|
|
46776
|
+
var EventActionsEnum;
|
|
46777
|
+
(function (EventActionsEnum) {
|
|
46778
|
+
EventActionsEnum["OnEventCreated"] = "onEventCreated";
|
|
46779
|
+
EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
|
|
46780
|
+
EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
|
|
46781
|
+
})(EventActionsEnum || (EventActionsEnum = {}));
|
|
46782
|
+
|
|
46783
|
+
class EventPaginationController extends PaginationController {
|
|
46784
|
+
async getRequest(queryParams, token) {
|
|
46785
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
46786
|
+
const options = token ? { token } : { limit };
|
|
46787
|
+
const { data: response } = await this.http.get(`/api/v1/events`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
46788
|
+
return response;
|
|
46789
|
+
}
|
|
46790
|
+
}
|
|
46791
|
+
|
|
46792
|
+
class EventQueryStreamController extends QueryStreamController {
|
|
46793
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
46794
|
+
super(query, cacheKey);
|
|
46795
|
+
this.notifyChange = notifyChange;
|
|
46796
|
+
this.preparePayload = preparePayload;
|
|
46797
|
+
}
|
|
46798
|
+
async saveToMainDB(response) {
|
|
46799
|
+
const processedPayload = this.preparePayload(response);
|
|
46800
|
+
const client = getActiveClient();
|
|
46801
|
+
const cachedAt = client.cache && Date.now();
|
|
46802
|
+
if (client.cache)
|
|
46803
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
46804
|
+
}
|
|
46805
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
46806
|
+
var _a, _b;
|
|
46807
|
+
if (refresh) {
|
|
46808
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
46809
|
+
}
|
|
46810
|
+
else {
|
|
46811
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46812
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
46813
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
46814
|
+
}
|
|
46815
|
+
}
|
|
46816
|
+
reactor(action) {
|
|
46817
|
+
return (event) => {
|
|
46818
|
+
var _a;
|
|
46819
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46820
|
+
if (!collection)
|
|
46821
|
+
return;
|
|
46822
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
46823
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
46824
|
+
}
|
|
46825
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
46826
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
46827
|
+
}
|
|
46828
|
+
pushToCache(this.cacheKey, collection);
|
|
46829
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
46830
|
+
};
|
|
46831
|
+
}
|
|
46832
|
+
subscribeRTE(createSubscriber) {
|
|
46833
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
46834
|
+
}
|
|
46835
|
+
}
|
|
46836
|
+
|
|
46837
|
+
class EventLiveCollectionController extends LiveCollectionController {
|
|
46838
|
+
constructor(query, callback) {
|
|
46839
|
+
const queryStreamId = hash(query);
|
|
46840
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
46841
|
+
const paginationController = new EventPaginationController(query);
|
|
46842
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
46843
|
+
this.query = query;
|
|
46844
|
+
this.queryStreamController = new EventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
46845
|
+
this.callback = callback.bind(this);
|
|
46846
|
+
this.loadPage({ initial: true });
|
|
46847
|
+
}
|
|
46848
|
+
setup() {
|
|
46849
|
+
var _a;
|
|
46850
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46851
|
+
if (!collection)
|
|
46852
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
46853
|
+
}
|
|
46854
|
+
async persistModel(queryPayload) {
|
|
46855
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
46856
|
+
}
|
|
46857
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
46858
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
46859
|
+
}
|
|
46860
|
+
startSubscription() {
|
|
46861
|
+
return this.queryStreamController.subscribeRTE([
|
|
46862
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
46863
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
46864
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
46865
|
+
{ fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
46866
|
+
{ fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
46867
|
+
{ fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
46868
|
+
]);
|
|
46869
|
+
}
|
|
46870
|
+
notifyChange({ origin, loading, error }) {
|
|
46871
|
+
var _a, _b;
|
|
46872
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46873
|
+
if (!collection)
|
|
46874
|
+
return;
|
|
46875
|
+
const data = ((_b = collection.data
|
|
46876
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
46877
|
+
.filter(isNonNullable)
|
|
46878
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
46879
|
+
if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
|
|
46880
|
+
return;
|
|
46881
|
+
this.callback({
|
|
46882
|
+
data,
|
|
46883
|
+
error,
|
|
46884
|
+
loading,
|
|
46885
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
46886
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
46887
|
+
});
|
|
46888
|
+
}
|
|
46889
|
+
}
|
|
46890
|
+
|
|
46891
|
+
/**
|
|
46892
|
+
* Get events
|
|
46893
|
+
*
|
|
46894
|
+
* @param params the query parameters
|
|
46895
|
+
* @param callback the callback to be called when the events are updated
|
|
46896
|
+
* @returns events
|
|
46897
|
+
*
|
|
46898
|
+
* @category Event Live Collection
|
|
46899
|
+
*
|
|
46900
|
+
*/
|
|
46901
|
+
const getEvents = (params, callback, config) => {
|
|
46902
|
+
const { log, cache } = getActiveClient();
|
|
46903
|
+
if (!cache)
|
|
46904
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
46905
|
+
const timestamp = Date.now();
|
|
46906
|
+
log(`getEvents: (tmpid: ${timestamp}) > listen`);
|
|
46907
|
+
const eventLiveCollection = new EventLiveCollectionController(params, callback);
|
|
46908
|
+
const disposers = eventLiveCollection.startSubscription();
|
|
46909
|
+
const cacheKey = eventLiveCollection.getCacheKey();
|
|
46910
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
46911
|
+
return () => {
|
|
46912
|
+
log(`getEvents (tmpid: ${timestamp}) > dispose`);
|
|
46913
|
+
disposers.forEach(fn => fn());
|
|
46914
|
+
};
|
|
46915
|
+
};
|
|
46916
|
+
|
|
46917
|
+
class MyEventPaginationController extends PaginationController {
|
|
46918
|
+
async getRequest(queryParams, token) {
|
|
46919
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
46920
|
+
const options = token ? { token } : { limit };
|
|
46921
|
+
const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
46922
|
+
return response;
|
|
46923
|
+
}
|
|
46924
|
+
}
|
|
46925
|
+
|
|
46926
|
+
class MyEventQueryStreamController extends QueryStreamController {
|
|
46927
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
46928
|
+
super(query, cacheKey);
|
|
46929
|
+
this.notifyChange = notifyChange;
|
|
46930
|
+
this.preparePayload = preparePayload;
|
|
46931
|
+
}
|
|
46932
|
+
async saveToMainDB(response) {
|
|
46933
|
+
const processedPayload = this.preparePayload(response);
|
|
46934
|
+
const client = getActiveClient();
|
|
46935
|
+
const cachedAt = client.cache && Date.now();
|
|
46936
|
+
if (client.cache)
|
|
46937
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
46938
|
+
}
|
|
46939
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
46940
|
+
var _a, _b;
|
|
46941
|
+
if (refresh) {
|
|
46942
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
46943
|
+
}
|
|
46944
|
+
else {
|
|
46945
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46946
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
46947
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
46948
|
+
}
|
|
46949
|
+
}
|
|
46950
|
+
reactor(action) {
|
|
46951
|
+
return (event) => {
|
|
46952
|
+
var _a;
|
|
46953
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46954
|
+
if (!collection)
|
|
46955
|
+
return;
|
|
46956
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
46957
|
+
const client = getActiveClient();
|
|
46958
|
+
if (client.userId !== event.userId)
|
|
46959
|
+
return;
|
|
46960
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
46961
|
+
}
|
|
46962
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
46963
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
46964
|
+
}
|
|
46965
|
+
pushToCache(this.cacheKey, collection);
|
|
46966
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
46967
|
+
};
|
|
46968
|
+
}
|
|
46969
|
+
subscribeRTE(createSubscriber) {
|
|
46970
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
46971
|
+
}
|
|
46972
|
+
}
|
|
46973
|
+
|
|
46974
|
+
class MyEventLiveCollectionController extends LiveCollectionController {
|
|
46975
|
+
constructor(query, callback) {
|
|
46976
|
+
const queryStreamId = hash(query);
|
|
46977
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
46978
|
+
const paginationController = new MyEventPaginationController(query);
|
|
46979
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
46980
|
+
this.query = query;
|
|
46981
|
+
this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
46982
|
+
this.callback = callback.bind(this);
|
|
46983
|
+
this.loadPage({ initial: true });
|
|
46984
|
+
}
|
|
46985
|
+
setup() {
|
|
46986
|
+
var _a;
|
|
46987
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46988
|
+
if (!collection)
|
|
46989
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
46990
|
+
}
|
|
46991
|
+
async persistModel(queryPayload) {
|
|
46992
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
46993
|
+
}
|
|
46994
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
46995
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
46996
|
+
}
|
|
46997
|
+
startSubscription() {
|
|
46998
|
+
return this.queryStreamController.subscribeRTE([
|
|
46999
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
47000
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
47001
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
47002
|
+
{ fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
47003
|
+
{ fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
47004
|
+
{ fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
47005
|
+
]);
|
|
47006
|
+
}
|
|
47007
|
+
notifyChange({ origin, loading, error }) {
|
|
47008
|
+
var _a, _b;
|
|
47009
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
47010
|
+
if (!collection)
|
|
47011
|
+
return;
|
|
47012
|
+
const data = ((_b = collection.data
|
|
47013
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
47014
|
+
.filter(isNonNullable)
|
|
47015
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
47016
|
+
if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
|
|
47017
|
+
return;
|
|
47018
|
+
this.callback({
|
|
47019
|
+
data,
|
|
47020
|
+
error,
|
|
47021
|
+
loading,
|
|
47022
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
47023
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
47024
|
+
});
|
|
47025
|
+
}
|
|
47026
|
+
}
|
|
47027
|
+
|
|
47028
|
+
/**
|
|
47029
|
+
* Get my events
|
|
47030
|
+
*
|
|
47031
|
+
* @param params the query parameters
|
|
47032
|
+
* @param callback the callback to be called when the events are updated
|
|
47033
|
+
* @returns events
|
|
47034
|
+
*
|
|
47035
|
+
* @category Event Live Collection
|
|
47036
|
+
*
|
|
47037
|
+
*/
|
|
47038
|
+
const getMyEvents = (params, callback, config) => {
|
|
47039
|
+
const { log, cache } = getActiveClient();
|
|
47040
|
+
if (!cache)
|
|
47041
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
47042
|
+
const timestamp = Date.now();
|
|
47043
|
+
log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
|
|
47044
|
+
const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
|
|
47045
|
+
const disposers = myEventLiveCollection.startSubscription();
|
|
47046
|
+
const cacheKey = myEventLiveCollection.getCacheKey();
|
|
47047
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
47048
|
+
return () => {
|
|
47049
|
+
log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
|
|
47050
|
+
disposers.forEach(fn => fn());
|
|
47051
|
+
};
|
|
47052
|
+
};
|
|
47053
|
+
|
|
47054
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
47055
|
+
__proto__: null,
|
|
47056
|
+
createEvent: createEvent,
|
|
47057
|
+
updateEvent: updateEvent,
|
|
47058
|
+
deleteEvent: deleteEvent,
|
|
47059
|
+
onEventCreated: onEventCreated,
|
|
47060
|
+
onEventUpdated: onEventUpdated,
|
|
47061
|
+
onEventDeleted: onEventDeleted,
|
|
47062
|
+
onLocalEventCreated: onLocalEventCreated,
|
|
47063
|
+
onLocalEventUpdated: onLocalEventUpdated,
|
|
47064
|
+
onLocalEventDeleted: onLocalEventDeleted,
|
|
47065
|
+
getEvent: getEvent,
|
|
47066
|
+
getEvents: getEvents,
|
|
47067
|
+
getMyEvents: getMyEvents
|
|
47068
|
+
});
|
|
47069
|
+
|
|
47070
|
+
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 };
|