@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.cjs.js
CHANGED
|
@@ -192,6 +192,30 @@ exports.FeedSourceEnum = void 0;
|
|
|
192
192
|
FeedSourceEnum["User"] = "user";
|
|
193
193
|
})(exports.FeedSourceEnum || (exports.FeedSourceEnum = {}));
|
|
194
194
|
|
|
195
|
+
exports.AmityEventType = void 0;
|
|
196
|
+
(function (AmityEventType) {
|
|
197
|
+
AmityEventType["Virtual"] = "virtual";
|
|
198
|
+
AmityEventType["InPerson"] = "in_person";
|
|
199
|
+
})(exports.AmityEventType || (exports.AmityEventType = {}));
|
|
200
|
+
exports.AmityEventOriginType = void 0;
|
|
201
|
+
(function (AmityEventOriginType) {
|
|
202
|
+
AmityEventOriginType["Community"] = "community";
|
|
203
|
+
AmityEventOriginType["User"] = "user";
|
|
204
|
+
})(exports.AmityEventOriginType || (exports.AmityEventOriginType = {}));
|
|
205
|
+
exports.AmityEventStatus = void 0;
|
|
206
|
+
(function (AmityEventStatus) {
|
|
207
|
+
AmityEventStatus["Scheduled"] = "scheduled";
|
|
208
|
+
AmityEventStatus["Live"] = "live";
|
|
209
|
+
AmityEventStatus["Ended"] = "ended";
|
|
210
|
+
AmityEventStatus["Cancelled"] = "cancelled";
|
|
211
|
+
})(exports.AmityEventStatus || (exports.AmityEventStatus = {}));
|
|
212
|
+
exports.AmityEventResponseStatus = void 0;
|
|
213
|
+
(function (AmityEventResponseStatus) {
|
|
214
|
+
AmityEventResponseStatus["Going"] = "going";
|
|
215
|
+
AmityEventResponseStatus["Interested"] = "interested";
|
|
216
|
+
AmityEventResponseStatus["NotGoing"] = "not_going";
|
|
217
|
+
})(exports.AmityEventResponseStatus || (exports.AmityEventResponseStatus = {}));
|
|
218
|
+
|
|
195
219
|
function getVersion() {
|
|
196
220
|
try {
|
|
197
221
|
// the string ''v7.11.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -640,6 +664,8 @@ const idResolvers = {
|
|
|
640
664
|
notificationTraySeen: ({ userId }) => userId,
|
|
641
665
|
invitation: ({ _id }) => _id,
|
|
642
666
|
joinRequest: ({ joinRequestId }) => joinRequestId,
|
|
667
|
+
event: ({ eventId }) => eventId,
|
|
668
|
+
discussionCommunity: ({ communityId }) => communityId,
|
|
643
669
|
};
|
|
644
670
|
/**
|
|
645
671
|
* Retrieve the id resolver matching a domain name
|
|
@@ -695,6 +721,8 @@ const PAYLOAD2MODEL = {
|
|
|
695
721
|
notificationTrayItems: 'notificationTrayItem',
|
|
696
722
|
invitations: 'invitation',
|
|
697
723
|
joinRequests: 'joinRequest',
|
|
724
|
+
events: 'event',
|
|
725
|
+
discussionCommunities: 'discussionCommunity',
|
|
698
726
|
};
|
|
699
727
|
/** hidden */
|
|
700
728
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -10460,7 +10488,7 @@ const getUserUnread = (callback) => {
|
|
|
10460
10488
|
};
|
|
10461
10489
|
};
|
|
10462
10490
|
|
|
10463
|
-
var index$
|
|
10491
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
10464
10492
|
__proto__: null,
|
|
10465
10493
|
getActiveClient: getActiveClient,
|
|
10466
10494
|
getActiveUser: getActiveUser,
|
|
@@ -11679,7 +11707,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
11679
11707
|
};
|
|
11680
11708
|
/* end_public_function */
|
|
11681
11709
|
|
|
11682
|
-
var index$
|
|
11710
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
11683
11711
|
__proto__: null,
|
|
11684
11712
|
blockUser: blockUser,
|
|
11685
11713
|
unBlockUser: unBlockUser,
|
|
@@ -13658,6 +13686,51 @@ const communityLinkedObject = (community) => {
|
|
|
13658
13686
|
} });
|
|
13659
13687
|
};
|
|
13660
13688
|
|
|
13689
|
+
const eventLinkedObject = (event) => {
|
|
13690
|
+
return Object.assign(Object.assign({}, event), { get creator() {
|
|
13691
|
+
const cacheData = pullFromCache(['user', 'get', event.userId]);
|
|
13692
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13693
|
+
return;
|
|
13694
|
+
return userLinkedObject(cacheData.data);
|
|
13695
|
+
},
|
|
13696
|
+
get discussionCommunity() {
|
|
13697
|
+
if (!event.discussionCommunityId)
|
|
13698
|
+
return;
|
|
13699
|
+
const cacheData = pullFromCache([
|
|
13700
|
+
'discussionCommunity',
|
|
13701
|
+
'get',
|
|
13702
|
+
event.discussionCommunityId,
|
|
13703
|
+
]);
|
|
13704
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13705
|
+
return;
|
|
13706
|
+
return communityLinkedObject(cacheData.data);
|
|
13707
|
+
},
|
|
13708
|
+
get targetCommunity() {
|
|
13709
|
+
if (!event.originId)
|
|
13710
|
+
return;
|
|
13711
|
+
const cacheData = pullFromCache(['community', 'get', event.originId]);
|
|
13712
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13713
|
+
return;
|
|
13714
|
+
return communityLinkedObject(cacheData.data);
|
|
13715
|
+
},
|
|
13716
|
+
get coverImage() {
|
|
13717
|
+
if (!event.coverImageFileId)
|
|
13718
|
+
return;
|
|
13719
|
+
const cacheData = pullFromCache(['file', 'get', event.coverImageFileId]);
|
|
13720
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13721
|
+
return;
|
|
13722
|
+
return cacheData.data;
|
|
13723
|
+
},
|
|
13724
|
+
get liveStream() {
|
|
13725
|
+
if (!event.livestreamId)
|
|
13726
|
+
return;
|
|
13727
|
+
const cacheData = pullFromCache(['stream', 'get', event.livestreamId]);
|
|
13728
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13729
|
+
return;
|
|
13730
|
+
return cacheData.data;
|
|
13731
|
+
} });
|
|
13732
|
+
};
|
|
13733
|
+
|
|
13661
13734
|
const LinkedObject = {
|
|
13662
13735
|
ad: adLinkedObject,
|
|
13663
13736
|
comment: commentLinkedObject,
|
|
@@ -13676,6 +13749,7 @@ const LinkedObject = {
|
|
|
13676
13749
|
invitation: invitationLinkedObject,
|
|
13677
13750
|
joinRequest: joinRequestLinkedObject,
|
|
13678
13751
|
channelMember: channelMemberLinkedObject,
|
|
13752
|
+
event: eventLinkedObject,
|
|
13679
13753
|
};
|
|
13680
13754
|
|
|
13681
13755
|
/* begin_public_function
|
|
@@ -14666,9 +14740,9 @@ var AmityUserSearchMatchType;
|
|
|
14666
14740
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
14667
14741
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
14668
14742
|
|
|
14669
|
-
var index$
|
|
14743
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
14670
14744
|
__proto__: null,
|
|
14671
|
-
Relationship: index$
|
|
14745
|
+
Relationship: index$o,
|
|
14672
14746
|
getUserByIds: getUserByIds,
|
|
14673
14747
|
updateUser: updateUser,
|
|
14674
14748
|
flagUser: flagUser,
|
|
@@ -15071,7 +15145,7 @@ const uploadAudio = async (formData, onProgress) => {
|
|
|
15071
15145
|
};
|
|
15072
15146
|
/* end_public_function */
|
|
15073
15147
|
|
|
15074
|
-
var index$
|
|
15148
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
15075
15149
|
__proto__: null,
|
|
15076
15150
|
getFile: getFile,
|
|
15077
15151
|
uploadFile: uploadFile,
|
|
@@ -16883,7 +16957,7 @@ const getReactions$1 = (params, callback, config) => {
|
|
|
16883
16957
|
};
|
|
16884
16958
|
/* end_public_function */
|
|
16885
16959
|
|
|
16886
|
-
var index$
|
|
16960
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
16887
16961
|
__proto__: null,
|
|
16888
16962
|
addReaction: addReaction,
|
|
16889
16963
|
removeReaction: removeReaction,
|
|
@@ -18655,7 +18729,7 @@ const getMessages = (params, callback, config) => {
|
|
|
18655
18729
|
};
|
|
18656
18730
|
/* end_public_function */
|
|
18657
18731
|
|
|
18658
|
-
var index$
|
|
18732
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
18659
18733
|
__proto__: null,
|
|
18660
18734
|
createMessage: createMessage,
|
|
18661
18735
|
updateMessage: updateMessage,
|
|
@@ -19181,7 +19255,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
19181
19255
|
};
|
|
19182
19256
|
/* end_public_function */
|
|
19183
19257
|
|
|
19184
|
-
var index$
|
|
19258
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
19185
19259
|
__proto__: null,
|
|
19186
19260
|
getSubChannelByIds: getSubChannels$1,
|
|
19187
19261
|
createSubChannel: createSubChannel,
|
|
@@ -20508,7 +20582,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
20508
20582
|
};
|
|
20509
20583
|
/* end_public_function */
|
|
20510
20584
|
|
|
20511
|
-
var index$
|
|
20585
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
20512
20586
|
__proto__: null,
|
|
20513
20587
|
addMembers: addMembers$1,
|
|
20514
20588
|
removeMembers: removeMembers$1,
|
|
@@ -20711,7 +20785,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
20711
20785
|
};
|
|
20712
20786
|
/* end_public_function */
|
|
20713
20787
|
|
|
20714
|
-
var index$
|
|
20788
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
20715
20789
|
__proto__: null,
|
|
20716
20790
|
addRole: addRole,
|
|
20717
20791
|
removeRole: removeRole,
|
|
@@ -20721,10 +20795,10 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
20721
20795
|
unmuteMembers: unmuteMembers
|
|
20722
20796
|
});
|
|
20723
20797
|
|
|
20724
|
-
var index$
|
|
20798
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
20725
20799
|
__proto__: null,
|
|
20726
|
-
Membership: index$
|
|
20727
|
-
Moderation: index$
|
|
20800
|
+
Membership: index$i,
|
|
20801
|
+
Moderation: index$h,
|
|
20728
20802
|
getChannelByIds: getChannelByIds$1,
|
|
20729
20803
|
createChannel: createChannel,
|
|
20730
20804
|
updateChannel: updateChannel,
|
|
@@ -22127,7 +22201,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
22127
22201
|
};
|
|
22128
22202
|
/* end_public_function */
|
|
22129
22203
|
|
|
22130
|
-
var index$
|
|
22204
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
22131
22205
|
__proto__: null,
|
|
22132
22206
|
addMembers: addMembers,
|
|
22133
22207
|
removeMembers: removeMembers,
|
|
@@ -23378,7 +23452,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
23378
23452
|
};
|
|
23379
23453
|
/* end_public_function */
|
|
23380
23454
|
|
|
23381
|
-
var index$
|
|
23455
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
23382
23456
|
__proto__: null,
|
|
23383
23457
|
addRoles: addRoles,
|
|
23384
23458
|
removeRoles: removeRoles,
|
|
@@ -23386,10 +23460,10 @@ var index$d = /*#__PURE__*/Object.freeze({
|
|
|
23386
23460
|
unbanMembers: unbanMembers
|
|
23387
23461
|
});
|
|
23388
23462
|
|
|
23389
|
-
var index$
|
|
23463
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
23390
23464
|
__proto__: null,
|
|
23391
|
-
Moderation: index$
|
|
23392
|
-
Membership: index$
|
|
23465
|
+
Moderation: index$e,
|
|
23466
|
+
Membership: index$f,
|
|
23393
23467
|
getCommunityByIds: getCommunities$1,
|
|
23394
23468
|
createCommunity: createCommunity,
|
|
23395
23469
|
updateCommunity: updateCommunity,
|
|
@@ -23623,7 +23697,7 @@ const getCategories = (params, callback, config) => {
|
|
|
23623
23697
|
};
|
|
23624
23698
|
/* end_public_function */
|
|
23625
23699
|
|
|
23626
|
-
var index$
|
|
23700
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
23627
23701
|
__proto__: null,
|
|
23628
23702
|
getCategory: getCategory,
|
|
23629
23703
|
getCategories: getCategories
|
|
@@ -24682,7 +24756,7 @@ const getComments = (params, callback, config) => {
|
|
|
24682
24756
|
};
|
|
24683
24757
|
/* end_public_function */
|
|
24684
24758
|
|
|
24685
|
-
var index$
|
|
24759
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
24686
24760
|
__proto__: null,
|
|
24687
24761
|
getCommentByIds: getCommentByIds,
|
|
24688
24762
|
createComment: createComment,
|
|
@@ -25353,7 +25427,7 @@ const getUserFeed = (params, callback, config) => {
|
|
|
25353
25427
|
};
|
|
25354
25428
|
/* end_public_function */
|
|
25355
25429
|
|
|
25356
|
-
var index$
|
|
25430
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
25357
25431
|
__proto__: null,
|
|
25358
25432
|
queryGlobalFeed: queryGlobalFeed,
|
|
25359
25433
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
|
|
@@ -27034,7 +27108,7 @@ const searchPostsByHashtag = (params, callback, config) => {
|
|
|
27034
27108
|
};
|
|
27035
27109
|
/* end_public_function */
|
|
27036
27110
|
|
|
27037
|
-
var index$
|
|
27111
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
27038
27112
|
__proto__: null,
|
|
27039
27113
|
getPostByIds: getPostByIds,
|
|
27040
27114
|
createPost: createPost,
|
|
@@ -27642,7 +27716,7 @@ const getStreams = (params, callback, config) => {
|
|
|
27642
27716
|
};
|
|
27643
27717
|
};
|
|
27644
27718
|
|
|
27645
|
-
var index$
|
|
27719
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
27646
27720
|
__proto__: null,
|
|
27647
27721
|
createStream: createStream,
|
|
27648
27722
|
updateStream: updateStream,
|
|
@@ -27960,7 +28034,7 @@ const getPoll = (pollId, callback) => {
|
|
|
27960
28034
|
};
|
|
27961
28035
|
/* end_public_function */
|
|
27962
28036
|
|
|
27963
|
-
var index$
|
|
28037
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
27964
28038
|
__proto__: null,
|
|
27965
28039
|
createPoll: createPoll,
|
|
27966
28040
|
closePoll: closePoll,
|
|
@@ -27972,7 +28046,7 @@ var index$6 = /*#__PURE__*/Object.freeze({
|
|
|
27972
28046
|
getPoll: getPoll
|
|
27973
28047
|
});
|
|
27974
28048
|
|
|
27975
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
28049
|
+
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-----";
|
|
27976
28050
|
/*
|
|
27977
28051
|
* The crypto algorithm used for importing key and signing string
|
|
27978
28052
|
*/
|
|
@@ -28343,7 +28417,7 @@ const getPlayer = async (parameters) => {
|
|
|
28343
28417
|
return video;
|
|
28344
28418
|
};
|
|
28345
28419
|
|
|
28346
|
-
var index$
|
|
28420
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
28347
28421
|
__proto__: null,
|
|
28348
28422
|
getPlayer: getPlayer
|
|
28349
28423
|
});
|
|
@@ -29516,7 +29590,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
29516
29590
|
};
|
|
29517
29591
|
};
|
|
29518
29592
|
|
|
29519
|
-
var index$
|
|
29593
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
29520
29594
|
__proto__: null,
|
|
29521
29595
|
createImageStory: createImageStory,
|
|
29522
29596
|
createVideoStory: createVideoStory,
|
|
@@ -29553,7 +29627,7 @@ const getNetworkAds = async () => {
|
|
|
29553
29627
|
};
|
|
29554
29628
|
};
|
|
29555
29629
|
|
|
29556
|
-
var index$
|
|
29630
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
29557
29631
|
__proto__: null,
|
|
29558
29632
|
getNetworkAds: getNetworkAds
|
|
29559
29633
|
});
|
|
@@ -29944,7 +30018,7 @@ const markTraySeen = async (lastSeenAt) => {
|
|
|
29944
30018
|
};
|
|
29945
30019
|
/* end_public_function */
|
|
29946
30020
|
|
|
29947
|
-
var index$
|
|
30021
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
29948
30022
|
__proto__: null,
|
|
29949
30023
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
29950
30024
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
@@ -30145,7 +30219,7 @@ const getMyCommunityInvitations = (params, callback, config) => {
|
|
|
30145
30219
|
};
|
|
30146
30220
|
};
|
|
30147
30221
|
|
|
30148
|
-
var index$
|
|
30222
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
30149
30223
|
__proto__: null,
|
|
30150
30224
|
onLocalInvitationCreated: onLocalInvitationCreated,
|
|
30151
30225
|
onLocalInvitationUpdated: onLocalInvitationUpdated,
|
|
@@ -30286,42 +30360,651 @@ const getReactions = (postId, callback) => {
|
|
|
30286
30360
|
};
|
|
30287
30361
|
};
|
|
30288
30362
|
|
|
30289
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
30363
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
30290
30364
|
__proto__: null,
|
|
30291
30365
|
createReaction: createReaction,
|
|
30292
30366
|
onLiveReactionCreated: onLiveReactionCreated,
|
|
30293
30367
|
getReactions: getReactions
|
|
30294
30368
|
});
|
|
30295
30369
|
|
|
30370
|
+
const prepareEventPayload = (rawPayload) => {
|
|
30371
|
+
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
30372
|
+
};
|
|
30373
|
+
|
|
30374
|
+
const createEventEventSubscriber = (event, callback) => {
|
|
30375
|
+
const client = getActiveClient();
|
|
30376
|
+
const filter = (payload) => {
|
|
30377
|
+
const unpackedPayload = prepareEventPayload(payload);
|
|
30378
|
+
if (!client.cache) {
|
|
30379
|
+
callback(unpackedPayload.events[0]);
|
|
30380
|
+
}
|
|
30381
|
+
else {
|
|
30382
|
+
ingestInCache(unpackedPayload);
|
|
30383
|
+
const event = pullFromCache([
|
|
30384
|
+
'event',
|
|
30385
|
+
'get',
|
|
30386
|
+
unpackedPayload.events[0].eventId,
|
|
30387
|
+
]);
|
|
30388
|
+
callback(event.data);
|
|
30389
|
+
}
|
|
30390
|
+
};
|
|
30391
|
+
return createEventSubscriber(client, event, event, filter);
|
|
30392
|
+
};
|
|
30393
|
+
|
|
30394
|
+
/* begin_public_function
|
|
30395
|
+
id: event.create
|
|
30396
|
+
*/
|
|
30397
|
+
/**
|
|
30398
|
+
* ```js
|
|
30399
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30400
|
+
* const response = await EventRepository.createEvent(bundle)
|
|
30401
|
+
* ```
|
|
30402
|
+
*
|
|
30403
|
+
* Creates an {@link Amity.Event}
|
|
30404
|
+
*
|
|
30405
|
+
* @param bundle The data necessary to create a new {@link Amity.Event}
|
|
30406
|
+
* @returns The newly created {@link Amity.Event}
|
|
30407
|
+
*
|
|
30408
|
+
* @category Event API
|
|
30409
|
+
* @async
|
|
30410
|
+
*/
|
|
30411
|
+
const createEvent = async (bundle) => {
|
|
30412
|
+
const client = getActiveClient();
|
|
30413
|
+
client.log('event/createEvent', bundle);
|
|
30414
|
+
const { data: payload } = await client.http.post('/api/v1/events', bundle);
|
|
30415
|
+
fireEvent('local.event.created', payload);
|
|
30416
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
30417
|
+
const cachedAt = client.cache && Date.now();
|
|
30418
|
+
if (client.cache)
|
|
30419
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
30420
|
+
return {
|
|
30421
|
+
data: eventLinkedObject(preparedPayload.events[0]),
|
|
30422
|
+
cachedAt,
|
|
30423
|
+
};
|
|
30424
|
+
};
|
|
30425
|
+
/* end_public_function */
|
|
30426
|
+
|
|
30427
|
+
/* begin_public_function
|
|
30428
|
+
id: event.update
|
|
30429
|
+
*/
|
|
30430
|
+
/**
|
|
30431
|
+
* ```js
|
|
30432
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30433
|
+
* const response = await EventRepository.updateEvent(eventId, bundle)
|
|
30434
|
+
* ```
|
|
30435
|
+
*
|
|
30436
|
+
* Updates an {@link Amity.Event}
|
|
30437
|
+
*
|
|
30438
|
+
* @param eventId The ID of the {@link Amity.Event} to edit
|
|
30439
|
+
* @param bundle The data necessary to update an existing {@link Amity.Event}
|
|
30440
|
+
* @returns the updated {@link Amity.Event}
|
|
30441
|
+
*
|
|
30442
|
+
* @category Event API
|
|
30443
|
+
* @async
|
|
30444
|
+
*/
|
|
30445
|
+
const updateEvent = async (eventId, bundle) => {
|
|
30446
|
+
const client = getActiveClient();
|
|
30447
|
+
client.log('event/updateEvent', eventId, bundle);
|
|
30448
|
+
const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
|
|
30449
|
+
fireEvent('local.event.updated', payload);
|
|
30450
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
30451
|
+
const cachedAt = client.cache && Date.now();
|
|
30452
|
+
if (client.cache)
|
|
30453
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
30454
|
+
return {
|
|
30455
|
+
data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
|
|
30456
|
+
cachedAt,
|
|
30457
|
+
};
|
|
30458
|
+
};
|
|
30459
|
+
/* end_public_function */
|
|
30460
|
+
|
|
30461
|
+
/* begin_public_function
|
|
30462
|
+
id: event.get
|
|
30463
|
+
*/
|
|
30464
|
+
/**
|
|
30465
|
+
* ```js
|
|
30466
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30467
|
+
* const event = await EventRepository.getEvent(eventId)
|
|
30468
|
+
* ```
|
|
30469
|
+
*
|
|
30470
|
+
* Fetches a {@link Amity.Event} object
|
|
30471
|
+
*
|
|
30472
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
30473
|
+
* @returns the associated {@link Amity.Event} object
|
|
30474
|
+
*
|
|
30475
|
+
* @category Event API
|
|
30476
|
+
* @async
|
|
30477
|
+
*/
|
|
30478
|
+
const getEvent$1 = async (eventId) => {
|
|
30479
|
+
const client = getActiveClient();
|
|
30480
|
+
client.log('event/getEvent', eventId);
|
|
30481
|
+
const { data: payload } = await client.http.get(`/api/v1/events/${eventId}`);
|
|
30482
|
+
const data = prepareEventPayload(payload);
|
|
30483
|
+
const cachedAt = client.cache && Date.now();
|
|
30484
|
+
if (client.cache)
|
|
30485
|
+
ingestInCache(data, { cachedAt });
|
|
30486
|
+
return {
|
|
30487
|
+
data: data.events.find(event => event.eventId === eventId),
|
|
30488
|
+
cachedAt,
|
|
30489
|
+
};
|
|
30490
|
+
};
|
|
30491
|
+
/* end_public_function */
|
|
30492
|
+
/**
|
|
30493
|
+
* ```js
|
|
30494
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30495
|
+
* const event = EventRepository.getEvent.locally(eventId)
|
|
30496
|
+
* ```
|
|
30497
|
+
*
|
|
30498
|
+
* Fetches a {@link Amity.Event} object in cache
|
|
30499
|
+
*
|
|
30500
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
30501
|
+
* @returns the associated {@link Amity.Event} object
|
|
30502
|
+
*
|
|
30503
|
+
* @category Event API
|
|
30504
|
+
*/
|
|
30505
|
+
getEvent$1.locally = (eventId) => {
|
|
30506
|
+
const client = getActiveClient();
|
|
30507
|
+
client.log('event/getEvent.locally', eventId);
|
|
30508
|
+
if (!client.cache)
|
|
30509
|
+
return;
|
|
30510
|
+
const cache = pullFromCache(['event', 'get', eventId]);
|
|
30511
|
+
if (!cache)
|
|
30512
|
+
return;
|
|
30513
|
+
return {
|
|
30514
|
+
data: cache.data,
|
|
30515
|
+
cachedAt: cache.cachedAt,
|
|
30516
|
+
};
|
|
30517
|
+
};
|
|
30518
|
+
|
|
30519
|
+
/* begin_public_function
|
|
30520
|
+
id: event.delete
|
|
30521
|
+
*/
|
|
30522
|
+
/**
|
|
30523
|
+
* ```js
|
|
30524
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30525
|
+
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
30526
|
+
* ```
|
|
30527
|
+
*
|
|
30528
|
+
* Deletes a {@link Amity.Event}
|
|
30529
|
+
*
|
|
30530
|
+
* @param eventId The {@link Amity.Event} ID to delete
|
|
30531
|
+
*
|
|
30532
|
+
* @category Event API
|
|
30533
|
+
* @async
|
|
30534
|
+
*/
|
|
30535
|
+
const deleteEvent = async (eventId) => {
|
|
30536
|
+
const client = getActiveClient();
|
|
30537
|
+
client.log('event/deleteEvent', eventId);
|
|
30538
|
+
const event = await getEvent$1(eventId);
|
|
30539
|
+
await client.http.delete(`/api/v1/events/${eventId}`);
|
|
30540
|
+
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
30541
|
+
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
30542
|
+
fireEvent('local.event.deleted', {
|
|
30543
|
+
users: [],
|
|
30544
|
+
files: [],
|
|
30545
|
+
communities: [],
|
|
30546
|
+
videoStreamings: [],
|
|
30547
|
+
events: [deletedEvent],
|
|
30548
|
+
discussionCommunities: [],
|
|
30549
|
+
});
|
|
30550
|
+
};
|
|
30551
|
+
/* end_public_function */
|
|
30552
|
+
|
|
30553
|
+
/**
|
|
30554
|
+
* ```js
|
|
30555
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30556
|
+
* const dispose = EventRepository.onEventCreated(event => {
|
|
30557
|
+
* // ...
|
|
30558
|
+
* })
|
|
30559
|
+
* ```
|
|
30560
|
+
*
|
|
30561
|
+
* Fired when a {@link Amity.Event} has been created
|
|
30562
|
+
*
|
|
30563
|
+
* @param callback The function to call when the event was fired
|
|
30564
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30565
|
+
*
|
|
30566
|
+
* @category Event Events
|
|
30567
|
+
*/
|
|
30568
|
+
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
30569
|
+
|
|
30570
|
+
/**
|
|
30571
|
+
* ```js
|
|
30572
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30573
|
+
* const dispose = EventRepository.onEventUpdated(event => {
|
|
30574
|
+
* // ...
|
|
30575
|
+
* })
|
|
30576
|
+
* ```
|
|
30577
|
+
*
|
|
30578
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
30579
|
+
*
|
|
30580
|
+
* @param callback The function to call when the event was fired
|
|
30581
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30582
|
+
*
|
|
30583
|
+
* @category Event Events
|
|
30584
|
+
*/
|
|
30585
|
+
const onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
30586
|
+
|
|
30587
|
+
/**
|
|
30588
|
+
* ```js
|
|
30589
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30590
|
+
* const dispose = EventRepository.onEventDeleted(event => {
|
|
30591
|
+
* // ...
|
|
30592
|
+
* })
|
|
30593
|
+
* ```
|
|
30594
|
+
*
|
|
30595
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
30596
|
+
*
|
|
30597
|
+
* @param callback The function to call when the event was fired
|
|
30598
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30599
|
+
*
|
|
30600
|
+
* @category Event Events
|
|
30601
|
+
*/
|
|
30602
|
+
const onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
30603
|
+
|
|
30604
|
+
/**
|
|
30605
|
+
* ```js
|
|
30606
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30607
|
+
* const dispose = EventRepository.onLocalEventCreated(event => {
|
|
30608
|
+
* // ...
|
|
30609
|
+
* })
|
|
30610
|
+
* ```
|
|
30611
|
+
*
|
|
30612
|
+
* Fired when a {@link Amity.Event} has been created
|
|
30613
|
+
*
|
|
30614
|
+
* @param callback The function to call when the event was fired
|
|
30615
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30616
|
+
*
|
|
30617
|
+
* @category Event Events
|
|
30618
|
+
*/
|
|
30619
|
+
const onLocalEventCreated = (callback) => createEventEventSubscriber('local.event.created', callback);
|
|
30620
|
+
|
|
30621
|
+
/**
|
|
30622
|
+
* ```js
|
|
30623
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30624
|
+
* const dispose = EventRepository.onLocalEventUpdated(event => {
|
|
30625
|
+
* // ...
|
|
30626
|
+
* })
|
|
30627
|
+
* ```
|
|
30628
|
+
*
|
|
30629
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
30630
|
+
*
|
|
30631
|
+
* @param callback The function to call when the event was fired
|
|
30632
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30633
|
+
*
|
|
30634
|
+
* @category Event Events
|
|
30635
|
+
*/
|
|
30636
|
+
const onLocalEventUpdated = (callback) => createEventEventSubscriber('local.event.updated', callback);
|
|
30637
|
+
|
|
30638
|
+
/**
|
|
30639
|
+
* ```js
|
|
30640
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30641
|
+
* const dispose = EventRepository.onLocalEventDeleted(event => {
|
|
30642
|
+
* // ...
|
|
30643
|
+
* })
|
|
30644
|
+
* ```
|
|
30645
|
+
*
|
|
30646
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
30647
|
+
*
|
|
30648
|
+
* @param callback The function to call when the event was fired
|
|
30649
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30650
|
+
*
|
|
30651
|
+
* @category Event Events
|
|
30652
|
+
*/
|
|
30653
|
+
const onLocalEventDeleted = (callback) => createEventEventSubscriber('local.event.deleted', callback);
|
|
30654
|
+
|
|
30655
|
+
/* begin_public_function
|
|
30656
|
+
id: event.get
|
|
30657
|
+
*/
|
|
30658
|
+
/**
|
|
30659
|
+
* ```js
|
|
30660
|
+
* import { EventRepository } from '@amityco/ts-sdk';
|
|
30661
|
+
*
|
|
30662
|
+
* let event;
|
|
30663
|
+
*
|
|
30664
|
+
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
30665
|
+
* event = response.data;
|
|
30666
|
+
* });
|
|
30667
|
+
* ```
|
|
30668
|
+
*
|
|
30669
|
+
* Observe all mutation on a given {@link Amity.Event}
|
|
30670
|
+
*
|
|
30671
|
+
* @param eventId the ID of the event to observe
|
|
30672
|
+
* @param callback the function to call when new snapshot of event are available
|
|
30673
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
30674
|
+
*
|
|
30675
|
+
* @category Event Live Object
|
|
30676
|
+
*/
|
|
30677
|
+
const getEvent = (eventId, callback) => {
|
|
30678
|
+
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventUpdated, onEventDeleted, onLocalEventUpdated, onLocalEventDeleted], {
|
|
30679
|
+
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
30680
|
+
});
|
|
30681
|
+
};
|
|
30682
|
+
/* end_public_function */
|
|
30683
|
+
|
|
30684
|
+
var EventActionsEnum;
|
|
30685
|
+
(function (EventActionsEnum) {
|
|
30686
|
+
EventActionsEnum["OnEventCreated"] = "onEventCreated";
|
|
30687
|
+
EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
|
|
30688
|
+
EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
|
|
30689
|
+
})(EventActionsEnum || (EventActionsEnum = {}));
|
|
30690
|
+
|
|
30691
|
+
class EventPaginationController extends PaginationController {
|
|
30692
|
+
async getRequest(queryParams, token) {
|
|
30693
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
30694
|
+
const options = token ? { token } : { limit };
|
|
30695
|
+
const { data: response } = await this.http.get(`/api/v1/events`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
30696
|
+
return response;
|
|
30697
|
+
}
|
|
30698
|
+
}
|
|
30699
|
+
|
|
30700
|
+
class EventQueryStreamController extends QueryStreamController {
|
|
30701
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
30702
|
+
super(query, cacheKey);
|
|
30703
|
+
this.notifyChange = notifyChange;
|
|
30704
|
+
this.preparePayload = preparePayload;
|
|
30705
|
+
}
|
|
30706
|
+
async saveToMainDB(response) {
|
|
30707
|
+
const processedPayload = this.preparePayload(response);
|
|
30708
|
+
const client = getActiveClient();
|
|
30709
|
+
const cachedAt = client.cache && Date.now();
|
|
30710
|
+
if (client.cache)
|
|
30711
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
30712
|
+
}
|
|
30713
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
30714
|
+
var _a, _b;
|
|
30715
|
+
if (refresh) {
|
|
30716
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
30717
|
+
}
|
|
30718
|
+
else {
|
|
30719
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30720
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30721
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
30722
|
+
}
|
|
30723
|
+
}
|
|
30724
|
+
reactor(action) {
|
|
30725
|
+
return (event) => {
|
|
30726
|
+
var _a;
|
|
30727
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30728
|
+
if (!collection)
|
|
30729
|
+
return;
|
|
30730
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
30731
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
30732
|
+
}
|
|
30733
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
30734
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
30735
|
+
}
|
|
30736
|
+
pushToCache(this.cacheKey, collection);
|
|
30737
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
30738
|
+
};
|
|
30739
|
+
}
|
|
30740
|
+
subscribeRTE(createSubscriber) {
|
|
30741
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
30742
|
+
}
|
|
30743
|
+
}
|
|
30744
|
+
|
|
30745
|
+
class EventLiveCollectionController extends LiveCollectionController {
|
|
30746
|
+
constructor(query, callback) {
|
|
30747
|
+
const queryStreamId = hash__default["default"](query);
|
|
30748
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
30749
|
+
const paginationController = new EventPaginationController(query);
|
|
30750
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
30751
|
+
this.query = query;
|
|
30752
|
+
this.queryStreamController = new EventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
30753
|
+
this.callback = callback.bind(this);
|
|
30754
|
+
this.loadPage({ initial: true });
|
|
30755
|
+
}
|
|
30756
|
+
setup() {
|
|
30757
|
+
var _a;
|
|
30758
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30759
|
+
if (!collection)
|
|
30760
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
30761
|
+
}
|
|
30762
|
+
async persistModel(queryPayload) {
|
|
30763
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
30764
|
+
}
|
|
30765
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
30766
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
30767
|
+
}
|
|
30768
|
+
startSubscription() {
|
|
30769
|
+
return this.queryStreamController.subscribeRTE([
|
|
30770
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
30771
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
30772
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
30773
|
+
{ fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
30774
|
+
{ fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
30775
|
+
{ fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
30776
|
+
]);
|
|
30777
|
+
}
|
|
30778
|
+
notifyChange({ origin, loading, error }) {
|
|
30779
|
+
var _a, _b;
|
|
30780
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30781
|
+
if (!collection)
|
|
30782
|
+
return;
|
|
30783
|
+
const data = ((_b = collection.data
|
|
30784
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
30785
|
+
.filter(isNonNullable)
|
|
30786
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
30787
|
+
if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
|
|
30788
|
+
return;
|
|
30789
|
+
this.callback({
|
|
30790
|
+
data,
|
|
30791
|
+
error,
|
|
30792
|
+
loading,
|
|
30793
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
30794
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
30795
|
+
});
|
|
30796
|
+
}
|
|
30797
|
+
}
|
|
30798
|
+
|
|
30799
|
+
/**
|
|
30800
|
+
* Get events
|
|
30801
|
+
*
|
|
30802
|
+
* @param params the query parameters
|
|
30803
|
+
* @param callback the callback to be called when the events are updated
|
|
30804
|
+
* @returns events
|
|
30805
|
+
*
|
|
30806
|
+
* @category Event Live Collection
|
|
30807
|
+
*
|
|
30808
|
+
*/
|
|
30809
|
+
const getEvents = (params, callback, config) => {
|
|
30810
|
+
const { log, cache } = getActiveClient();
|
|
30811
|
+
if (!cache)
|
|
30812
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
30813
|
+
const timestamp = Date.now();
|
|
30814
|
+
log(`getEvents: (tmpid: ${timestamp}) > listen`);
|
|
30815
|
+
const eventLiveCollection = new EventLiveCollectionController(params, callback);
|
|
30816
|
+
const disposers = eventLiveCollection.startSubscription();
|
|
30817
|
+
const cacheKey = eventLiveCollection.getCacheKey();
|
|
30818
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
30819
|
+
return () => {
|
|
30820
|
+
log(`getEvents (tmpid: ${timestamp}) > dispose`);
|
|
30821
|
+
disposers.forEach(fn => fn());
|
|
30822
|
+
};
|
|
30823
|
+
};
|
|
30824
|
+
|
|
30825
|
+
class MyEventPaginationController extends PaginationController {
|
|
30826
|
+
async getRequest(queryParams, token) {
|
|
30827
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
30828
|
+
const options = token ? { token } : { limit };
|
|
30829
|
+
const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
30830
|
+
return response;
|
|
30831
|
+
}
|
|
30832
|
+
}
|
|
30833
|
+
|
|
30834
|
+
class MyEventQueryStreamController extends QueryStreamController {
|
|
30835
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
30836
|
+
super(query, cacheKey);
|
|
30837
|
+
this.notifyChange = notifyChange;
|
|
30838
|
+
this.preparePayload = preparePayload;
|
|
30839
|
+
}
|
|
30840
|
+
async saveToMainDB(response) {
|
|
30841
|
+
const processedPayload = this.preparePayload(response);
|
|
30842
|
+
const client = getActiveClient();
|
|
30843
|
+
const cachedAt = client.cache && Date.now();
|
|
30844
|
+
if (client.cache)
|
|
30845
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
30846
|
+
}
|
|
30847
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
30848
|
+
var _a, _b;
|
|
30849
|
+
if (refresh) {
|
|
30850
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
30851
|
+
}
|
|
30852
|
+
else {
|
|
30853
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30854
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30855
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
30856
|
+
}
|
|
30857
|
+
}
|
|
30858
|
+
reactor(action) {
|
|
30859
|
+
return (event) => {
|
|
30860
|
+
var _a;
|
|
30861
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30862
|
+
if (!collection)
|
|
30863
|
+
return;
|
|
30864
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
30865
|
+
const client = getActiveClient();
|
|
30866
|
+
if (client.userId !== event.userId)
|
|
30867
|
+
return;
|
|
30868
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
30869
|
+
}
|
|
30870
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
30871
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
30872
|
+
}
|
|
30873
|
+
pushToCache(this.cacheKey, collection);
|
|
30874
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
30875
|
+
};
|
|
30876
|
+
}
|
|
30877
|
+
subscribeRTE(createSubscriber) {
|
|
30878
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
30879
|
+
}
|
|
30880
|
+
}
|
|
30881
|
+
|
|
30882
|
+
class MyEventLiveCollectionController extends LiveCollectionController {
|
|
30883
|
+
constructor(query, callback) {
|
|
30884
|
+
const queryStreamId = hash__default["default"](query);
|
|
30885
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
30886
|
+
const paginationController = new MyEventPaginationController(query);
|
|
30887
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
30888
|
+
this.query = query;
|
|
30889
|
+
this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
30890
|
+
this.callback = callback.bind(this);
|
|
30891
|
+
this.loadPage({ initial: true });
|
|
30892
|
+
}
|
|
30893
|
+
setup() {
|
|
30894
|
+
var _a;
|
|
30895
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30896
|
+
if (!collection)
|
|
30897
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
30898
|
+
}
|
|
30899
|
+
async persistModel(queryPayload) {
|
|
30900
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
30901
|
+
}
|
|
30902
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
30903
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
30904
|
+
}
|
|
30905
|
+
startSubscription() {
|
|
30906
|
+
return this.queryStreamController.subscribeRTE([
|
|
30907
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
30908
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
30909
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
30910
|
+
{ fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
30911
|
+
{ fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
30912
|
+
{ fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
30913
|
+
]);
|
|
30914
|
+
}
|
|
30915
|
+
notifyChange({ origin, loading, error }) {
|
|
30916
|
+
var _a, _b;
|
|
30917
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30918
|
+
if (!collection)
|
|
30919
|
+
return;
|
|
30920
|
+
const data = ((_b = collection.data
|
|
30921
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
30922
|
+
.filter(isNonNullable)
|
|
30923
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
30924
|
+
if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
|
|
30925
|
+
return;
|
|
30926
|
+
this.callback({
|
|
30927
|
+
data,
|
|
30928
|
+
error,
|
|
30929
|
+
loading,
|
|
30930
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
30931
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
30932
|
+
});
|
|
30933
|
+
}
|
|
30934
|
+
}
|
|
30935
|
+
|
|
30936
|
+
/**
|
|
30937
|
+
* Get my events
|
|
30938
|
+
*
|
|
30939
|
+
* @param params the query parameters
|
|
30940
|
+
* @param callback the callback to be called when the events are updated
|
|
30941
|
+
* @returns events
|
|
30942
|
+
*
|
|
30943
|
+
* @category Event Live Collection
|
|
30944
|
+
*
|
|
30945
|
+
*/
|
|
30946
|
+
const getMyEvents = (params, callback, config) => {
|
|
30947
|
+
const { log, cache } = getActiveClient();
|
|
30948
|
+
if (!cache)
|
|
30949
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
30950
|
+
const timestamp = Date.now();
|
|
30951
|
+
log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
|
|
30952
|
+
const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
|
|
30953
|
+
const disposers = myEventLiveCollection.startSubscription();
|
|
30954
|
+
const cacheKey = myEventLiveCollection.getCacheKey();
|
|
30955
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
30956
|
+
return () => {
|
|
30957
|
+
log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
|
|
30958
|
+
disposers.forEach(fn => fn());
|
|
30959
|
+
};
|
|
30960
|
+
};
|
|
30961
|
+
|
|
30962
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
30963
|
+
__proto__: null,
|
|
30964
|
+
createEvent: createEvent,
|
|
30965
|
+
updateEvent: updateEvent,
|
|
30966
|
+
deleteEvent: deleteEvent,
|
|
30967
|
+
onEventCreated: onEventCreated,
|
|
30968
|
+
onEventUpdated: onEventUpdated,
|
|
30969
|
+
onEventDeleted: onEventDeleted,
|
|
30970
|
+
onLocalEventCreated: onLocalEventCreated,
|
|
30971
|
+
onLocalEventUpdated: onLocalEventUpdated,
|
|
30972
|
+
onLocalEventDeleted: onLocalEventDeleted,
|
|
30973
|
+
getEvent: getEvent,
|
|
30974
|
+
getEvents: getEvents,
|
|
30975
|
+
getMyEvents: getMyEvents
|
|
30976
|
+
});
|
|
30977
|
+
|
|
30296
30978
|
exports.API_REGIONS = API_REGIONS;
|
|
30297
|
-
exports.AdRepository = index$
|
|
30298
|
-
exports.CategoryRepository = index$
|
|
30299
|
-
exports.ChannelRepository = index$
|
|
30300
|
-
exports.Client = index$
|
|
30301
|
-
exports.CommentRepository = index$
|
|
30979
|
+
exports.AdRepository = index$4;
|
|
30980
|
+
exports.CategoryRepository = index$c;
|
|
30981
|
+
exports.ChannelRepository = index$g;
|
|
30982
|
+
exports.Client = index$p;
|
|
30983
|
+
exports.CommentRepository = index$b;
|
|
30302
30984
|
exports.CommunityPostSettingMaps = CommunityPostSettingMaps;
|
|
30303
30985
|
exports.CommunityPostSettings = CommunityPostSettings;
|
|
30304
|
-
exports.CommunityRepository = index$
|
|
30986
|
+
exports.CommunityRepository = index$d;
|
|
30305
30987
|
exports.ContentFeedType = ContentFeedType;
|
|
30306
30988
|
exports.DefaultCommunityPostSetting = DefaultCommunityPostSetting;
|
|
30307
|
-
exports.
|
|
30308
|
-
exports.
|
|
30989
|
+
exports.EventRepository = index;
|
|
30990
|
+
exports.FeedRepository = index$a;
|
|
30991
|
+
exports.FileRepository = index$m;
|
|
30309
30992
|
exports.FileType = FileType;
|
|
30310
30993
|
exports.GET_WATCHER_URLS = GET_WATCHER_URLS;
|
|
30311
|
-
exports.InvitationRepository = index$
|
|
30312
|
-
exports.LiveReactionRepository = index;
|
|
30313
|
-
exports.LiveStreamPlayer = index$
|
|
30994
|
+
exports.InvitationRepository = index$2;
|
|
30995
|
+
exports.LiveReactionRepository = index$1;
|
|
30996
|
+
exports.LiveStreamPlayer = index$6;
|
|
30314
30997
|
exports.MessageContentType = MessageContentType;
|
|
30315
|
-
exports.MessageRepository = index$
|
|
30316
|
-
exports.PollRepository = index$
|
|
30998
|
+
exports.MessageRepository = index$k;
|
|
30999
|
+
exports.PollRepository = index$7;
|
|
30317
31000
|
exports.PostContentType = PostContentType;
|
|
30318
|
-
exports.PostRepository = index$
|
|
31001
|
+
exports.PostRepository = index$9;
|
|
30319
31002
|
exports.PostStructureType = PostStructureType;
|
|
30320
|
-
exports.ReactionRepository = index$
|
|
30321
|
-
exports.StoryRepository = index$
|
|
30322
|
-
exports.StreamRepository = index$
|
|
30323
|
-
exports.SubChannelRepository = index$
|
|
30324
|
-
exports.UserRepository = index$
|
|
31003
|
+
exports.ReactionRepository = index$l;
|
|
31004
|
+
exports.StoryRepository = index$5;
|
|
31005
|
+
exports.StreamRepository = index$8;
|
|
31006
|
+
exports.SubChannelRepository = index$j;
|
|
31007
|
+
exports.UserRepository = index$n;
|
|
30325
31008
|
exports.VERSION = VERSION;
|
|
30326
31009
|
exports.VideoResolution = VideoResolution;
|
|
30327
31010
|
exports.VideoSize = VideoSize;
|
|
@@ -30375,7 +31058,7 @@ exports.isPaged = isPaged;
|
|
|
30375
31058
|
exports.isReportedByMe = isReportedByMe;
|
|
30376
31059
|
exports.isSkip = isSkip;
|
|
30377
31060
|
exports.mergeInCache = mergeInCache;
|
|
30378
|
-
exports.notificationTray = index$
|
|
31061
|
+
exports.notificationTray = index$3;
|
|
30379
31062
|
exports.onChannelMarkerFetched = onChannelMarkerFetched;
|
|
30380
31063
|
exports.onFeedMarkerFetched = onFeedMarkerFetched;
|
|
30381
31064
|
exports.onFeedMarkerUpdated = onFeedMarkerUpdated;
|