@amityco/ts-sdk 7.11.0 → 7.11.1-302f84d7.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 +2 -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 +8 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/event.d.ts +77 -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 +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 +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 +651 -51
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +631 -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,7 @@ const idResolvers = {
|
|
|
625
649
|
notificationTraySeen: ({ userId }) => userId,
|
|
626
650
|
invitation: ({ _id }) => _id,
|
|
627
651
|
joinRequest: ({ joinRequestId }) => joinRequestId,
|
|
652
|
+
event: ({ eventId }) => eventId,
|
|
628
653
|
};
|
|
629
654
|
/**
|
|
630
655
|
* Retrieve the id resolver matching a domain name
|
|
@@ -680,6 +705,8 @@ const PAYLOAD2MODEL = {
|
|
|
680
705
|
notificationTrayItems: 'notificationTrayItem',
|
|
681
706
|
invitations: 'invitation',
|
|
682
707
|
joinRequests: 'joinRequest',
|
|
708
|
+
events: 'event',
|
|
709
|
+
discussionCommunities: 'community',
|
|
683
710
|
};
|
|
684
711
|
/** hidden */
|
|
685
712
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -26552,7 +26579,7 @@ const getUserUnread = (callback) => {
|
|
|
26552
26579
|
};
|
|
26553
26580
|
};
|
|
26554
26581
|
|
|
26555
|
-
var index$
|
|
26582
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
26556
26583
|
__proto__: null,
|
|
26557
26584
|
getActiveClient: getActiveClient,
|
|
26558
26585
|
getActiveUser: getActiveUser,
|
|
@@ -27771,7 +27798,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
27771
27798
|
};
|
|
27772
27799
|
/* end_public_function */
|
|
27773
27800
|
|
|
27774
|
-
var index$
|
|
27801
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
27775
27802
|
__proto__: null,
|
|
27776
27803
|
blockUser: blockUser,
|
|
27777
27804
|
unBlockUser: unBlockUser,
|
|
@@ -29750,6 +29777,35 @@ const communityLinkedObject = (community) => {
|
|
|
29750
29777
|
} });
|
|
29751
29778
|
};
|
|
29752
29779
|
|
|
29780
|
+
const eventLinkedObject = (event) => {
|
|
29781
|
+
return Object.assign(Object.assign({}, event), { get creator() {
|
|
29782
|
+
const cacheData = pullFromCache(['user', 'get', event.userId]);
|
|
29783
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29784
|
+
return;
|
|
29785
|
+
return userLinkedObject(cacheData.data);
|
|
29786
|
+
},
|
|
29787
|
+
get discussionCommunity() {
|
|
29788
|
+
if (!event.discussionCommunityId)
|
|
29789
|
+
return;
|
|
29790
|
+
const cacheData = pullFromCache([
|
|
29791
|
+
'community',
|
|
29792
|
+
'get',
|
|
29793
|
+
event.discussionCommunityId,
|
|
29794
|
+
]);
|
|
29795
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29796
|
+
return;
|
|
29797
|
+
return communityLinkedObject(cacheData.data);
|
|
29798
|
+
},
|
|
29799
|
+
get liveStream() {
|
|
29800
|
+
if (!event.livestreamId)
|
|
29801
|
+
return;
|
|
29802
|
+
const cacheData = pullFromCache(['stream', 'get', event.livestreamId]);
|
|
29803
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29804
|
+
return;
|
|
29805
|
+
return cacheData.data;
|
|
29806
|
+
} });
|
|
29807
|
+
};
|
|
29808
|
+
|
|
29753
29809
|
const LinkedObject = {
|
|
29754
29810
|
ad: adLinkedObject,
|
|
29755
29811
|
comment: commentLinkedObject,
|
|
@@ -29768,6 +29824,7 @@ const LinkedObject = {
|
|
|
29768
29824
|
invitation: invitationLinkedObject,
|
|
29769
29825
|
joinRequest: joinRequestLinkedObject,
|
|
29770
29826
|
channelMember: channelMemberLinkedObject,
|
|
29827
|
+
event: eventLinkedObject,
|
|
29771
29828
|
};
|
|
29772
29829
|
|
|
29773
29830
|
/* begin_public_function
|
|
@@ -30758,9 +30815,9 @@ var AmityUserSearchMatchType;
|
|
|
30758
30815
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
30759
30816
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
30760
30817
|
|
|
30761
|
-
var index$
|
|
30818
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
30762
30819
|
__proto__: null,
|
|
30763
|
-
Relationship: index$
|
|
30820
|
+
Relationship: index$o,
|
|
30764
30821
|
getUserByIds: getUserByIds,
|
|
30765
30822
|
updateUser: updateUser,
|
|
30766
30823
|
flagUser: flagUser,
|
|
@@ -31163,7 +31220,7 @@ const uploadAudio = async (formData, onProgress) => {
|
|
|
31163
31220
|
};
|
|
31164
31221
|
/* end_public_function */
|
|
31165
31222
|
|
|
31166
|
-
var index$
|
|
31223
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
31167
31224
|
__proto__: null,
|
|
31168
31225
|
getFile: getFile,
|
|
31169
31226
|
uploadFile: uploadFile,
|
|
@@ -32975,7 +33032,7 @@ const getReactions$1 = (params, callback, config) => {
|
|
|
32975
33032
|
};
|
|
32976
33033
|
/* end_public_function */
|
|
32977
33034
|
|
|
32978
|
-
var index$
|
|
33035
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
32979
33036
|
__proto__: null,
|
|
32980
33037
|
addReaction: addReaction,
|
|
32981
33038
|
removeReaction: removeReaction,
|
|
@@ -34747,7 +34804,7 @@ const getMessages = (params, callback, config) => {
|
|
|
34747
34804
|
};
|
|
34748
34805
|
/* end_public_function */
|
|
34749
34806
|
|
|
34750
|
-
var index$
|
|
34807
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
34751
34808
|
__proto__: null,
|
|
34752
34809
|
createMessage: createMessage,
|
|
34753
34810
|
updateMessage: updateMessage,
|
|
@@ -35273,7 +35330,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
35273
35330
|
};
|
|
35274
35331
|
/* end_public_function */
|
|
35275
35332
|
|
|
35276
|
-
var index$
|
|
35333
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
35277
35334
|
__proto__: null,
|
|
35278
35335
|
getSubChannelByIds: getSubChannels$1,
|
|
35279
35336
|
createSubChannel: createSubChannel,
|
|
@@ -36600,7 +36657,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
36600
36657
|
};
|
|
36601
36658
|
/* end_public_function */
|
|
36602
36659
|
|
|
36603
|
-
var index$
|
|
36660
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
36604
36661
|
__proto__: null,
|
|
36605
36662
|
addMembers: addMembers$1,
|
|
36606
36663
|
removeMembers: removeMembers$1,
|
|
@@ -36803,7 +36860,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
36803
36860
|
};
|
|
36804
36861
|
/* end_public_function */
|
|
36805
36862
|
|
|
36806
|
-
var index$
|
|
36863
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
36807
36864
|
__proto__: null,
|
|
36808
36865
|
addRole: addRole,
|
|
36809
36866
|
removeRole: removeRole,
|
|
@@ -36813,10 +36870,10 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
36813
36870
|
unmuteMembers: unmuteMembers
|
|
36814
36871
|
});
|
|
36815
36872
|
|
|
36816
|
-
var index$
|
|
36873
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
36817
36874
|
__proto__: null,
|
|
36818
|
-
Membership: index$
|
|
36819
|
-
Moderation: index$
|
|
36875
|
+
Membership: index$i,
|
|
36876
|
+
Moderation: index$h,
|
|
36820
36877
|
getChannelByIds: getChannelByIds$1,
|
|
36821
36878
|
createChannel: createChannel,
|
|
36822
36879
|
updateChannel: updateChannel,
|
|
@@ -38219,7 +38276,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
38219
38276
|
};
|
|
38220
38277
|
/* end_public_function */
|
|
38221
38278
|
|
|
38222
|
-
var index$
|
|
38279
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
38223
38280
|
__proto__: null,
|
|
38224
38281
|
addMembers: addMembers,
|
|
38225
38282
|
removeMembers: removeMembers,
|
|
@@ -39470,7 +39527,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
39470
39527
|
};
|
|
39471
39528
|
/* end_public_function */
|
|
39472
39529
|
|
|
39473
|
-
var index$
|
|
39530
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
39474
39531
|
__proto__: null,
|
|
39475
39532
|
addRoles: addRoles,
|
|
39476
39533
|
removeRoles: removeRoles,
|
|
@@ -39478,10 +39535,10 @@ var index$d = /*#__PURE__*/Object.freeze({
|
|
|
39478
39535
|
unbanMembers: unbanMembers
|
|
39479
39536
|
});
|
|
39480
39537
|
|
|
39481
|
-
var index$
|
|
39538
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
39482
39539
|
__proto__: null,
|
|
39483
|
-
Moderation: index$
|
|
39484
|
-
Membership: index$
|
|
39540
|
+
Moderation: index$e,
|
|
39541
|
+
Membership: index$f,
|
|
39485
39542
|
getCommunityByIds: getCommunities$1,
|
|
39486
39543
|
createCommunity: createCommunity,
|
|
39487
39544
|
updateCommunity: updateCommunity,
|
|
@@ -39715,7 +39772,7 @@ const getCategories = (params, callback, config) => {
|
|
|
39715
39772
|
};
|
|
39716
39773
|
/* end_public_function */
|
|
39717
39774
|
|
|
39718
|
-
var index$
|
|
39775
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
39719
39776
|
__proto__: null,
|
|
39720
39777
|
getCategory: getCategory,
|
|
39721
39778
|
getCategories: getCategories
|
|
@@ -40774,7 +40831,7 @@ const getComments = (params, callback, config) => {
|
|
|
40774
40831
|
};
|
|
40775
40832
|
/* end_public_function */
|
|
40776
40833
|
|
|
40777
|
-
var index$
|
|
40834
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
40778
40835
|
__proto__: null,
|
|
40779
40836
|
getCommentByIds: getCommentByIds,
|
|
40780
40837
|
createComment: createComment,
|
|
@@ -41445,7 +41502,7 @@ const getUserFeed = (params, callback, config) => {
|
|
|
41445
41502
|
};
|
|
41446
41503
|
/* end_public_function */
|
|
41447
41504
|
|
|
41448
|
-
var index$
|
|
41505
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
41449
41506
|
__proto__: null,
|
|
41450
41507
|
queryGlobalFeed: queryGlobalFeed,
|
|
41451
41508
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
|
|
@@ -43126,7 +43183,7 @@ const searchPostsByHashtag = (params, callback, config) => {
|
|
|
43126
43183
|
};
|
|
43127
43184
|
/* end_public_function */
|
|
43128
43185
|
|
|
43129
|
-
var index$
|
|
43186
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
43130
43187
|
__proto__: null,
|
|
43131
43188
|
getPostByIds: getPostByIds,
|
|
43132
43189
|
createPost: createPost,
|
|
@@ -43734,7 +43791,7 @@ const getStreams = (params, callback, config) => {
|
|
|
43734
43791
|
};
|
|
43735
43792
|
};
|
|
43736
43793
|
|
|
43737
|
-
var index$
|
|
43794
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
43738
43795
|
__proto__: null,
|
|
43739
43796
|
createStream: createStream,
|
|
43740
43797
|
updateStream: updateStream,
|
|
@@ -44052,7 +44109,7 @@ const getPoll = (pollId, callback) => {
|
|
|
44052
44109
|
};
|
|
44053
44110
|
/* end_public_function */
|
|
44054
44111
|
|
|
44055
|
-
var index$
|
|
44112
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
44056
44113
|
__proto__: null,
|
|
44057
44114
|
createPoll: createPoll,
|
|
44058
44115
|
closePoll: closePoll,
|
|
@@ -44064,7 +44121,7 @@ var index$6 = /*#__PURE__*/Object.freeze({
|
|
|
44064
44121
|
getPoll: getPoll
|
|
44065
44122
|
});
|
|
44066
44123
|
|
|
44067
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
44124
|
+
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
44125
|
/*
|
|
44069
44126
|
* The crypto algorithm used for importing key and signing string
|
|
44070
44127
|
*/
|
|
@@ -44435,7 +44492,7 @@ const getPlayer = async (parameters) => {
|
|
|
44435
44492
|
return video;
|
|
44436
44493
|
};
|
|
44437
44494
|
|
|
44438
|
-
var index$
|
|
44495
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
44439
44496
|
__proto__: null,
|
|
44440
44497
|
getPlayer: getPlayer
|
|
44441
44498
|
});
|
|
@@ -45608,7 +45665,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
45608
45665
|
};
|
|
45609
45666
|
};
|
|
45610
45667
|
|
|
45611
|
-
var index$
|
|
45668
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
45612
45669
|
__proto__: null,
|
|
45613
45670
|
createImageStory: createImageStory,
|
|
45614
45671
|
createVideoStory: createVideoStory,
|
|
@@ -45645,7 +45702,7 @@ const getNetworkAds = async () => {
|
|
|
45645
45702
|
};
|
|
45646
45703
|
};
|
|
45647
45704
|
|
|
45648
|
-
var index$
|
|
45705
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
45649
45706
|
__proto__: null,
|
|
45650
45707
|
getNetworkAds: getNetworkAds
|
|
45651
45708
|
});
|
|
@@ -46036,7 +46093,7 @@ const markTraySeen = async (lastSeenAt) => {
|
|
|
46036
46093
|
};
|
|
46037
46094
|
/* end_public_function */
|
|
46038
46095
|
|
|
46039
|
-
var index$
|
|
46096
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
46040
46097
|
__proto__: null,
|
|
46041
46098
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
46042
46099
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
@@ -46237,7 +46294,7 @@ const getMyCommunityInvitations = (params, callback, config) => {
|
|
|
46237
46294
|
};
|
|
46238
46295
|
};
|
|
46239
46296
|
|
|
46240
|
-
var index$
|
|
46297
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
46241
46298
|
__proto__: null,
|
|
46242
46299
|
onLocalInvitationCreated: onLocalInvitationCreated,
|
|
46243
46300
|
onLocalInvitationUpdated: onLocalInvitationUpdated,
|
|
@@ -46378,11 +46435,553 @@ const getReactions = (postId, callback) => {
|
|
|
46378
46435
|
};
|
|
46379
46436
|
};
|
|
46380
46437
|
|
|
46381
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
46438
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
46382
46439
|
__proto__: null,
|
|
46383
46440
|
createReaction: createReaction,
|
|
46384
46441
|
onLiveReactionCreated: onLiveReactionCreated,
|
|
46385
46442
|
getReactions: getReactions
|
|
46386
46443
|
});
|
|
46387
46444
|
|
|
46388
|
-
|
|
46445
|
+
const prepareEventPayload = (rawPayload) => {
|
|
46446
|
+
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
46447
|
+
};
|
|
46448
|
+
|
|
46449
|
+
const createEventEventSubscriber = (event, callback) => {
|
|
46450
|
+
const client = getActiveClient();
|
|
46451
|
+
const filter = (payload) => {
|
|
46452
|
+
const unpackedPayload = prepareEventPayload(payload);
|
|
46453
|
+
if (!client.cache) {
|
|
46454
|
+
callback(unpackedPayload.events[0]);
|
|
46455
|
+
}
|
|
46456
|
+
else {
|
|
46457
|
+
ingestInCache(unpackedPayload);
|
|
46458
|
+
const event = pullFromCache([
|
|
46459
|
+
'event',
|
|
46460
|
+
'get',
|
|
46461
|
+
unpackedPayload.events[0].eventId,
|
|
46462
|
+
]);
|
|
46463
|
+
callback(event.data);
|
|
46464
|
+
}
|
|
46465
|
+
};
|
|
46466
|
+
return createEventSubscriber(client, event, event, filter);
|
|
46467
|
+
};
|
|
46468
|
+
|
|
46469
|
+
/* begin_public_function
|
|
46470
|
+
id: event.create
|
|
46471
|
+
*/
|
|
46472
|
+
/**
|
|
46473
|
+
* ```js
|
|
46474
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46475
|
+
* const response = await EventRepository.createEvent(bundle)
|
|
46476
|
+
* ```
|
|
46477
|
+
*
|
|
46478
|
+
* Creates an {@link Amity.Event}
|
|
46479
|
+
*
|
|
46480
|
+
* @param bundle The data necessary to create a new {@link Amity.Event}
|
|
46481
|
+
* @returns The newly created {@link Amity.Event}
|
|
46482
|
+
*
|
|
46483
|
+
* @category Event API
|
|
46484
|
+
* @async
|
|
46485
|
+
*/
|
|
46486
|
+
const createEvent = async (bundle) => {
|
|
46487
|
+
const client = getActiveClient();
|
|
46488
|
+
client.log('event/createEvent', bundle);
|
|
46489
|
+
const { data: payload } = await client.http.post('/api/v1/events', bundle);
|
|
46490
|
+
fireEvent('event.created', payload);
|
|
46491
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
46492
|
+
const cachedAt = client.cache && Date.now();
|
|
46493
|
+
if (client.cache)
|
|
46494
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
46495
|
+
return {
|
|
46496
|
+
data: eventLinkedObject(preparedPayload.events[0]),
|
|
46497
|
+
cachedAt,
|
|
46498
|
+
};
|
|
46499
|
+
};
|
|
46500
|
+
/* end_public_function */
|
|
46501
|
+
|
|
46502
|
+
/* begin_public_function
|
|
46503
|
+
id: event.update
|
|
46504
|
+
*/
|
|
46505
|
+
/**
|
|
46506
|
+
* ```js
|
|
46507
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46508
|
+
* const response = await EventRepository.updateEvent(eventId, bundle)
|
|
46509
|
+
* ```
|
|
46510
|
+
*
|
|
46511
|
+
* Updates an {@link Amity.Event}
|
|
46512
|
+
*
|
|
46513
|
+
* @param eventId The ID of the {@link Amity.Event} to edit
|
|
46514
|
+
* @param bundle The data necessary to update an existing {@link Amity.Event}
|
|
46515
|
+
* @returns the updated {@link Amity.Event}
|
|
46516
|
+
*
|
|
46517
|
+
* @category Event API
|
|
46518
|
+
* @async
|
|
46519
|
+
*/
|
|
46520
|
+
const updateEvent = async (eventId, bundle) => {
|
|
46521
|
+
const client = getActiveClient();
|
|
46522
|
+
client.log('event/updateEvent', eventId, bundle);
|
|
46523
|
+
const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
|
|
46524
|
+
fireEvent('event.updated', payload);
|
|
46525
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
46526
|
+
const cachedAt = client.cache && Date.now();
|
|
46527
|
+
if (client.cache)
|
|
46528
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
46529
|
+
return {
|
|
46530
|
+
data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
|
|
46531
|
+
cachedAt,
|
|
46532
|
+
};
|
|
46533
|
+
};
|
|
46534
|
+
/* end_public_function */
|
|
46535
|
+
|
|
46536
|
+
/* begin_public_function
|
|
46537
|
+
id: event.get
|
|
46538
|
+
*/
|
|
46539
|
+
/**
|
|
46540
|
+
* ```js
|
|
46541
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46542
|
+
* const event = await EventRepository.getEvent(eventId)
|
|
46543
|
+
* ```
|
|
46544
|
+
*
|
|
46545
|
+
* Fetches a {@link Amity.Event} object
|
|
46546
|
+
*
|
|
46547
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46548
|
+
* @returns the associated {@link Amity.Event} object
|
|
46549
|
+
*
|
|
46550
|
+
* @category Event API
|
|
46551
|
+
* @async
|
|
46552
|
+
*/
|
|
46553
|
+
const getEvent$1 = async (eventId) => {
|
|
46554
|
+
const client = getActiveClient();
|
|
46555
|
+
client.log('event/getEvent', eventId);
|
|
46556
|
+
const { data: payload } = await client.http.get(`/api/v3/events/${eventId}`);
|
|
46557
|
+
const data = prepareEventPayload(payload);
|
|
46558
|
+
const cachedAt = client.cache && Date.now();
|
|
46559
|
+
if (client.cache)
|
|
46560
|
+
ingestInCache(data, { cachedAt });
|
|
46561
|
+
return {
|
|
46562
|
+
data: data.events.find(event => event.eventId === eventId),
|
|
46563
|
+
cachedAt,
|
|
46564
|
+
};
|
|
46565
|
+
};
|
|
46566
|
+
/* end_public_function */
|
|
46567
|
+
/**
|
|
46568
|
+
* ```js
|
|
46569
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46570
|
+
* const event = EventRepository.getEvent.locally(eventId)
|
|
46571
|
+
* ```
|
|
46572
|
+
*
|
|
46573
|
+
* Fetches a {@link Amity.Event} object in cache
|
|
46574
|
+
*
|
|
46575
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
46576
|
+
* @returns the associated {@link Amity.Event} object
|
|
46577
|
+
*
|
|
46578
|
+
* @category Event API
|
|
46579
|
+
*/
|
|
46580
|
+
getEvent$1.locally = (eventId) => {
|
|
46581
|
+
const client = getActiveClient();
|
|
46582
|
+
client.log('event/getEvent.locally', eventId);
|
|
46583
|
+
if (!client.cache)
|
|
46584
|
+
return;
|
|
46585
|
+
const cache = pullFromCache(['event', 'get', eventId]);
|
|
46586
|
+
if (!cache)
|
|
46587
|
+
return;
|
|
46588
|
+
return {
|
|
46589
|
+
data: cache.data,
|
|
46590
|
+
cachedAt: cache.cachedAt,
|
|
46591
|
+
};
|
|
46592
|
+
};
|
|
46593
|
+
|
|
46594
|
+
/* begin_public_function
|
|
46595
|
+
id: event.delete
|
|
46596
|
+
*/
|
|
46597
|
+
/**
|
|
46598
|
+
* ```js
|
|
46599
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46600
|
+
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
46601
|
+
* ```
|
|
46602
|
+
*
|
|
46603
|
+
* Deletes a {@link Amity.Event}
|
|
46604
|
+
*
|
|
46605
|
+
* @param eventId The {@link Amity.Event} ID to delete
|
|
46606
|
+
*
|
|
46607
|
+
* @category Event API
|
|
46608
|
+
* @async
|
|
46609
|
+
*/
|
|
46610
|
+
const deleteEvent = async (eventId) => {
|
|
46611
|
+
const client = getActiveClient();
|
|
46612
|
+
client.log('event/deleteEvent', eventId);
|
|
46613
|
+
const event = await getEvent$1(eventId);
|
|
46614
|
+
await client.http.delete(`/api/v3/events/${eventId}`);
|
|
46615
|
+
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
46616
|
+
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
46617
|
+
fireEvent('event.deleted', {
|
|
46618
|
+
users: [],
|
|
46619
|
+
files: [],
|
|
46620
|
+
communities: [],
|
|
46621
|
+
videoStreamings: [],
|
|
46622
|
+
events: [deletedEvent],
|
|
46623
|
+
discussionCommunities: [],
|
|
46624
|
+
});
|
|
46625
|
+
};
|
|
46626
|
+
/* end_public_function */
|
|
46627
|
+
|
|
46628
|
+
/**
|
|
46629
|
+
* ```js
|
|
46630
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46631
|
+
* const dispose = EventRepository.onEventCreated(event => {
|
|
46632
|
+
* // ...
|
|
46633
|
+
* })
|
|
46634
|
+
* ```
|
|
46635
|
+
*
|
|
46636
|
+
* Fired when a {@link Amity.Event} has been created
|
|
46637
|
+
*
|
|
46638
|
+
* @param callback The function to call when the event was fired
|
|
46639
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46640
|
+
*
|
|
46641
|
+
* @category Event Events
|
|
46642
|
+
*/
|
|
46643
|
+
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
46644
|
+
|
|
46645
|
+
/**
|
|
46646
|
+
* ```js
|
|
46647
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46648
|
+
* const dispose = EventRepository.onEventUpdated(event => {
|
|
46649
|
+
* // ...
|
|
46650
|
+
* })
|
|
46651
|
+
* ```
|
|
46652
|
+
*
|
|
46653
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
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 onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
46661
|
+
|
|
46662
|
+
/**
|
|
46663
|
+
* ```js
|
|
46664
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
46665
|
+
* const dispose = EventRepository.onEventDeleted(event => {
|
|
46666
|
+
* // ...
|
|
46667
|
+
* })
|
|
46668
|
+
* ```
|
|
46669
|
+
*
|
|
46670
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
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 onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
46678
|
+
|
|
46679
|
+
/* begin_public_function
|
|
46680
|
+
id: event.get
|
|
46681
|
+
*/
|
|
46682
|
+
/**
|
|
46683
|
+
* ```js
|
|
46684
|
+
* import { EventRepository } from '@amityco/ts-sdk';
|
|
46685
|
+
*
|
|
46686
|
+
* let event;
|
|
46687
|
+
*
|
|
46688
|
+
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
46689
|
+
* event = response.data;
|
|
46690
|
+
* });
|
|
46691
|
+
* ```
|
|
46692
|
+
*
|
|
46693
|
+
* Observe all mutation on a given {@link Amity.Event}
|
|
46694
|
+
*
|
|
46695
|
+
* @param eventId the ID of the event to observe
|
|
46696
|
+
* @param callback the function to call when new snapshot of event are available
|
|
46697
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
46698
|
+
*
|
|
46699
|
+
* @category Event Live Object
|
|
46700
|
+
*/
|
|
46701
|
+
const getEvent = (eventId, callback) => {
|
|
46702
|
+
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventCreated, onEventUpdated, onEventDeleted], {
|
|
46703
|
+
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
46704
|
+
});
|
|
46705
|
+
};
|
|
46706
|
+
/* end_public_function */
|
|
46707
|
+
|
|
46708
|
+
var EventActionsEnum;
|
|
46709
|
+
(function (EventActionsEnum) {
|
|
46710
|
+
EventActionsEnum["OnEventCreated"] = "onEventCreated";
|
|
46711
|
+
EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
|
|
46712
|
+
EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
|
|
46713
|
+
})(EventActionsEnum || (EventActionsEnum = {}));
|
|
46714
|
+
|
|
46715
|
+
class EventPaginationController extends PaginationController {
|
|
46716
|
+
async getRequest(queryParams, token) {
|
|
46717
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
46718
|
+
const options = token ? { token } : { limit };
|
|
46719
|
+
const { data: response } = await this.http.get(`/api/v1/events`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
46720
|
+
return response;
|
|
46721
|
+
}
|
|
46722
|
+
}
|
|
46723
|
+
|
|
46724
|
+
class EventQueryStreamController extends QueryStreamController {
|
|
46725
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
46726
|
+
super(query, cacheKey);
|
|
46727
|
+
this.notifyChange = notifyChange;
|
|
46728
|
+
this.preparePayload = preparePayload;
|
|
46729
|
+
}
|
|
46730
|
+
async saveToMainDB(response) {
|
|
46731
|
+
const processedPayload = this.preparePayload(response);
|
|
46732
|
+
const client = getActiveClient();
|
|
46733
|
+
const cachedAt = client.cache && Date.now();
|
|
46734
|
+
if (client.cache)
|
|
46735
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
46736
|
+
}
|
|
46737
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
46738
|
+
var _a, _b;
|
|
46739
|
+
if (refresh) {
|
|
46740
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
46741
|
+
}
|
|
46742
|
+
else {
|
|
46743
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46744
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
46745
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
46746
|
+
}
|
|
46747
|
+
}
|
|
46748
|
+
reactor(action) {
|
|
46749
|
+
return (event) => {
|
|
46750
|
+
var _a;
|
|
46751
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46752
|
+
if (!collection)
|
|
46753
|
+
return;
|
|
46754
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
46755
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
46756
|
+
}
|
|
46757
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
46758
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
46759
|
+
}
|
|
46760
|
+
pushToCache(this.cacheKey, collection);
|
|
46761
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
46762
|
+
};
|
|
46763
|
+
}
|
|
46764
|
+
subscribeRTE(createSubscriber) {
|
|
46765
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
46766
|
+
}
|
|
46767
|
+
}
|
|
46768
|
+
|
|
46769
|
+
class EventLiveCollectionController extends LiveCollectionController {
|
|
46770
|
+
constructor(query, callback) {
|
|
46771
|
+
const queryStreamId = hash(query);
|
|
46772
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
46773
|
+
const paginationController = new EventPaginationController(query);
|
|
46774
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
46775
|
+
this.query = query;
|
|
46776
|
+
this.queryStreamController = new EventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
46777
|
+
this.callback = callback.bind(this);
|
|
46778
|
+
this.loadPage({ initial: true });
|
|
46779
|
+
}
|
|
46780
|
+
setup() {
|
|
46781
|
+
var _a;
|
|
46782
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46783
|
+
if (!collection)
|
|
46784
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
46785
|
+
}
|
|
46786
|
+
async persistModel(queryPayload) {
|
|
46787
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
46788
|
+
}
|
|
46789
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
46790
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
46791
|
+
}
|
|
46792
|
+
startSubscription() {
|
|
46793
|
+
return this.queryStreamController.subscribeRTE([
|
|
46794
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
46795
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
46796
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
46797
|
+
]);
|
|
46798
|
+
}
|
|
46799
|
+
notifyChange({ origin, loading, error }) {
|
|
46800
|
+
var _a, _b;
|
|
46801
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46802
|
+
if (!collection)
|
|
46803
|
+
return;
|
|
46804
|
+
const data = ((_b = collection.data
|
|
46805
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
46806
|
+
.filter(isNonNullable)
|
|
46807
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
46808
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
46809
|
+
return;
|
|
46810
|
+
this.callback({
|
|
46811
|
+
data,
|
|
46812
|
+
error,
|
|
46813
|
+
loading,
|
|
46814
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
46815
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
46816
|
+
});
|
|
46817
|
+
}
|
|
46818
|
+
}
|
|
46819
|
+
|
|
46820
|
+
/**
|
|
46821
|
+
* Get events
|
|
46822
|
+
*
|
|
46823
|
+
* @param params the query parameters
|
|
46824
|
+
* @param callback the callback to be called when the events are updated
|
|
46825
|
+
* @returns events
|
|
46826
|
+
*
|
|
46827
|
+
* @category Event Live Collection
|
|
46828
|
+
*
|
|
46829
|
+
*/
|
|
46830
|
+
const getEvents = (params, callback, config) => {
|
|
46831
|
+
const { log, cache } = getActiveClient();
|
|
46832
|
+
if (!cache)
|
|
46833
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
46834
|
+
const timestamp = Date.now();
|
|
46835
|
+
log(`getEvents: (tmpid: ${timestamp}) > listen`);
|
|
46836
|
+
const eventLiveCollection = new EventLiveCollectionController(params, callback);
|
|
46837
|
+
const disposers = eventLiveCollection.startSubscription();
|
|
46838
|
+
const cacheKey = eventLiveCollection.getCacheKey();
|
|
46839
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
46840
|
+
return () => {
|
|
46841
|
+
log(`getEvents (tmpid: ${timestamp}) > dispose`);
|
|
46842
|
+
disposers.forEach(fn => fn());
|
|
46843
|
+
};
|
|
46844
|
+
};
|
|
46845
|
+
|
|
46846
|
+
class MyEventPaginationController extends PaginationController {
|
|
46847
|
+
async getRequest(queryParams, token) {
|
|
46848
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
46849
|
+
const options = token ? { token } : { limit };
|
|
46850
|
+
const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
46851
|
+
return response;
|
|
46852
|
+
}
|
|
46853
|
+
}
|
|
46854
|
+
|
|
46855
|
+
class MyEventQueryStreamController extends QueryStreamController {
|
|
46856
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
46857
|
+
super(query, cacheKey);
|
|
46858
|
+
this.notifyChange = notifyChange;
|
|
46859
|
+
this.preparePayload = preparePayload;
|
|
46860
|
+
}
|
|
46861
|
+
async saveToMainDB(response) {
|
|
46862
|
+
const processedPayload = this.preparePayload(response);
|
|
46863
|
+
const client = getActiveClient();
|
|
46864
|
+
const cachedAt = client.cache && Date.now();
|
|
46865
|
+
if (client.cache)
|
|
46866
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
46867
|
+
}
|
|
46868
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
46869
|
+
var _a, _b;
|
|
46870
|
+
if (refresh) {
|
|
46871
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
46872
|
+
}
|
|
46873
|
+
else {
|
|
46874
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46875
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
46876
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
46877
|
+
}
|
|
46878
|
+
}
|
|
46879
|
+
reactor(action) {
|
|
46880
|
+
return (event) => {
|
|
46881
|
+
var _a;
|
|
46882
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46883
|
+
if (!collection)
|
|
46884
|
+
return;
|
|
46885
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
46886
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
46887
|
+
}
|
|
46888
|
+
pushToCache(this.cacheKey, collection);
|
|
46889
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
46890
|
+
};
|
|
46891
|
+
}
|
|
46892
|
+
subscribeRTE(createSubscriber) {
|
|
46893
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
46894
|
+
}
|
|
46895
|
+
}
|
|
46896
|
+
|
|
46897
|
+
class MyEventLiveCollectionController extends LiveCollectionController {
|
|
46898
|
+
constructor(query, callback) {
|
|
46899
|
+
const queryStreamId = hash(query);
|
|
46900
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
46901
|
+
const paginationController = new MyEventPaginationController(query);
|
|
46902
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
46903
|
+
this.query = query;
|
|
46904
|
+
this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
46905
|
+
this.callback = callback.bind(this);
|
|
46906
|
+
this.loadPage({ initial: true });
|
|
46907
|
+
}
|
|
46908
|
+
setup() {
|
|
46909
|
+
var _a;
|
|
46910
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46911
|
+
if (!collection)
|
|
46912
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
46913
|
+
}
|
|
46914
|
+
async persistModel(queryPayload) {
|
|
46915
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
46916
|
+
}
|
|
46917
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
46918
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
46919
|
+
}
|
|
46920
|
+
startSubscription() {
|
|
46921
|
+
return this.queryStreamController.subscribeRTE([
|
|
46922
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
46923
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
46924
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
46925
|
+
]);
|
|
46926
|
+
}
|
|
46927
|
+
notifyChange({ origin, loading, error }) {
|
|
46928
|
+
var _a, _b;
|
|
46929
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
46930
|
+
if (!collection)
|
|
46931
|
+
return;
|
|
46932
|
+
const data = ((_b = collection.data
|
|
46933
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
46934
|
+
.filter(isNonNullable)
|
|
46935
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
46936
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
46937
|
+
return;
|
|
46938
|
+
this.callback({
|
|
46939
|
+
data,
|
|
46940
|
+
error,
|
|
46941
|
+
loading,
|
|
46942
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
46943
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
46944
|
+
});
|
|
46945
|
+
}
|
|
46946
|
+
}
|
|
46947
|
+
|
|
46948
|
+
/**
|
|
46949
|
+
* Get my events
|
|
46950
|
+
*
|
|
46951
|
+
* @param params the query parameters
|
|
46952
|
+
* @param callback the callback to be called when the events are updated
|
|
46953
|
+
* @returns events
|
|
46954
|
+
*
|
|
46955
|
+
* @category Event Live Collection
|
|
46956
|
+
*
|
|
46957
|
+
*/
|
|
46958
|
+
const getMyEvents = (params, callback, config) => {
|
|
46959
|
+
const { log, cache } = getActiveClient();
|
|
46960
|
+
if (!cache)
|
|
46961
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
46962
|
+
const timestamp = Date.now();
|
|
46963
|
+
log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
|
|
46964
|
+
const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
|
|
46965
|
+
const disposers = myEventLiveCollection.startSubscription();
|
|
46966
|
+
const cacheKey = myEventLiveCollection.getCacheKey();
|
|
46967
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
46968
|
+
return () => {
|
|
46969
|
+
log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
|
|
46970
|
+
disposers.forEach(fn => fn());
|
|
46971
|
+
};
|
|
46972
|
+
};
|
|
46973
|
+
|
|
46974
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
46975
|
+
__proto__: null,
|
|
46976
|
+
createEvent: createEvent,
|
|
46977
|
+
updateEvent: updateEvent,
|
|
46978
|
+
deleteEvent: deleteEvent,
|
|
46979
|
+
onEventCreated: onEventCreated,
|
|
46980
|
+
onEventUpdated: onEventUpdated,
|
|
46981
|
+
onEventDeleted: onEventDeleted,
|
|
46982
|
+
getEvent: getEvent,
|
|
46983
|
+
getEvents: getEvents,
|
|
46984
|
+
getMyEvents: getMyEvents
|
|
46985
|
+
});
|
|
46986
|
+
|
|
46987
|
+
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 };
|