@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.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,7 @@ const idResolvers = {
|
|
|
640
664
|
notificationTraySeen: ({ userId }) => userId,
|
|
641
665
|
invitation: ({ _id }) => _id,
|
|
642
666
|
joinRequest: ({ joinRequestId }) => joinRequestId,
|
|
667
|
+
event: ({ eventId }) => eventId,
|
|
643
668
|
};
|
|
644
669
|
/**
|
|
645
670
|
* Retrieve the id resolver matching a domain name
|
|
@@ -695,6 +720,8 @@ const PAYLOAD2MODEL = {
|
|
|
695
720
|
notificationTrayItems: 'notificationTrayItem',
|
|
696
721
|
invitations: 'invitation',
|
|
697
722
|
joinRequests: 'joinRequest',
|
|
723
|
+
events: 'event',
|
|
724
|
+
discussionCommunities: 'community',
|
|
698
725
|
};
|
|
699
726
|
/** hidden */
|
|
700
727
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -10460,7 +10487,7 @@ const getUserUnread = (callback) => {
|
|
|
10460
10487
|
};
|
|
10461
10488
|
};
|
|
10462
10489
|
|
|
10463
|
-
var index$
|
|
10490
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
10464
10491
|
__proto__: null,
|
|
10465
10492
|
getActiveClient: getActiveClient,
|
|
10466
10493
|
getActiveUser: getActiveUser,
|
|
@@ -11679,7 +11706,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
11679
11706
|
};
|
|
11680
11707
|
/* end_public_function */
|
|
11681
11708
|
|
|
11682
|
-
var index$
|
|
11709
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
11683
11710
|
__proto__: null,
|
|
11684
11711
|
blockUser: blockUser,
|
|
11685
11712
|
unBlockUser: unBlockUser,
|
|
@@ -13658,6 +13685,35 @@ const communityLinkedObject = (community) => {
|
|
|
13658
13685
|
} });
|
|
13659
13686
|
};
|
|
13660
13687
|
|
|
13688
|
+
const eventLinkedObject = (event) => {
|
|
13689
|
+
return Object.assign(Object.assign({}, event), { get creator() {
|
|
13690
|
+
const cacheData = pullFromCache(['user', 'get', event.userId]);
|
|
13691
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13692
|
+
return;
|
|
13693
|
+
return userLinkedObject(cacheData.data);
|
|
13694
|
+
},
|
|
13695
|
+
get discussionCommunity() {
|
|
13696
|
+
if (!event.discussionCommunityId)
|
|
13697
|
+
return;
|
|
13698
|
+
const cacheData = pullFromCache([
|
|
13699
|
+
'community',
|
|
13700
|
+
'get',
|
|
13701
|
+
event.discussionCommunityId,
|
|
13702
|
+
]);
|
|
13703
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13704
|
+
return;
|
|
13705
|
+
return communityLinkedObject(cacheData.data);
|
|
13706
|
+
},
|
|
13707
|
+
get liveStream() {
|
|
13708
|
+
if (!event.livestreamId)
|
|
13709
|
+
return;
|
|
13710
|
+
const cacheData = pullFromCache(['stream', 'get', event.livestreamId]);
|
|
13711
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13712
|
+
return;
|
|
13713
|
+
return cacheData.data;
|
|
13714
|
+
} });
|
|
13715
|
+
};
|
|
13716
|
+
|
|
13661
13717
|
const LinkedObject = {
|
|
13662
13718
|
ad: adLinkedObject,
|
|
13663
13719
|
comment: commentLinkedObject,
|
|
@@ -13676,6 +13732,7 @@ const LinkedObject = {
|
|
|
13676
13732
|
invitation: invitationLinkedObject,
|
|
13677
13733
|
joinRequest: joinRequestLinkedObject,
|
|
13678
13734
|
channelMember: channelMemberLinkedObject,
|
|
13735
|
+
event: eventLinkedObject,
|
|
13679
13736
|
};
|
|
13680
13737
|
|
|
13681
13738
|
/* begin_public_function
|
|
@@ -14666,9 +14723,9 @@ var AmityUserSearchMatchType;
|
|
|
14666
14723
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
14667
14724
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
14668
14725
|
|
|
14669
|
-
var index$
|
|
14726
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
14670
14727
|
__proto__: null,
|
|
14671
|
-
Relationship: index$
|
|
14728
|
+
Relationship: index$o,
|
|
14672
14729
|
getUserByIds: getUserByIds,
|
|
14673
14730
|
updateUser: updateUser,
|
|
14674
14731
|
flagUser: flagUser,
|
|
@@ -15071,7 +15128,7 @@ const uploadAudio = async (formData, onProgress) => {
|
|
|
15071
15128
|
};
|
|
15072
15129
|
/* end_public_function */
|
|
15073
15130
|
|
|
15074
|
-
var index$
|
|
15131
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
15075
15132
|
__proto__: null,
|
|
15076
15133
|
getFile: getFile,
|
|
15077
15134
|
uploadFile: uploadFile,
|
|
@@ -16883,7 +16940,7 @@ const getReactions$1 = (params, callback, config) => {
|
|
|
16883
16940
|
};
|
|
16884
16941
|
/* end_public_function */
|
|
16885
16942
|
|
|
16886
|
-
var index$
|
|
16943
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
16887
16944
|
__proto__: null,
|
|
16888
16945
|
addReaction: addReaction,
|
|
16889
16946
|
removeReaction: removeReaction,
|
|
@@ -18655,7 +18712,7 @@ const getMessages = (params, callback, config) => {
|
|
|
18655
18712
|
};
|
|
18656
18713
|
/* end_public_function */
|
|
18657
18714
|
|
|
18658
|
-
var index$
|
|
18715
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
18659
18716
|
__proto__: null,
|
|
18660
18717
|
createMessage: createMessage,
|
|
18661
18718
|
updateMessage: updateMessage,
|
|
@@ -19181,7 +19238,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
19181
19238
|
};
|
|
19182
19239
|
/* end_public_function */
|
|
19183
19240
|
|
|
19184
|
-
var index$
|
|
19241
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
19185
19242
|
__proto__: null,
|
|
19186
19243
|
getSubChannelByIds: getSubChannels$1,
|
|
19187
19244
|
createSubChannel: createSubChannel,
|
|
@@ -20508,7 +20565,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
20508
20565
|
};
|
|
20509
20566
|
/* end_public_function */
|
|
20510
20567
|
|
|
20511
|
-
var index$
|
|
20568
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
20512
20569
|
__proto__: null,
|
|
20513
20570
|
addMembers: addMembers$1,
|
|
20514
20571
|
removeMembers: removeMembers$1,
|
|
@@ -20711,7 +20768,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
20711
20768
|
};
|
|
20712
20769
|
/* end_public_function */
|
|
20713
20770
|
|
|
20714
|
-
var index$
|
|
20771
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
20715
20772
|
__proto__: null,
|
|
20716
20773
|
addRole: addRole,
|
|
20717
20774
|
removeRole: removeRole,
|
|
@@ -20721,10 +20778,10 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
20721
20778
|
unmuteMembers: unmuteMembers
|
|
20722
20779
|
});
|
|
20723
20780
|
|
|
20724
|
-
var index$
|
|
20781
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
20725
20782
|
__proto__: null,
|
|
20726
|
-
Membership: index$
|
|
20727
|
-
Moderation: index$
|
|
20783
|
+
Membership: index$i,
|
|
20784
|
+
Moderation: index$h,
|
|
20728
20785
|
getChannelByIds: getChannelByIds$1,
|
|
20729
20786
|
createChannel: createChannel,
|
|
20730
20787
|
updateChannel: updateChannel,
|
|
@@ -22127,7 +22184,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
22127
22184
|
};
|
|
22128
22185
|
/* end_public_function */
|
|
22129
22186
|
|
|
22130
|
-
var index$
|
|
22187
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
22131
22188
|
__proto__: null,
|
|
22132
22189
|
addMembers: addMembers,
|
|
22133
22190
|
removeMembers: removeMembers,
|
|
@@ -23378,7 +23435,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
23378
23435
|
};
|
|
23379
23436
|
/* end_public_function */
|
|
23380
23437
|
|
|
23381
|
-
var index$
|
|
23438
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
23382
23439
|
__proto__: null,
|
|
23383
23440
|
addRoles: addRoles,
|
|
23384
23441
|
removeRoles: removeRoles,
|
|
@@ -23386,10 +23443,10 @@ var index$d = /*#__PURE__*/Object.freeze({
|
|
|
23386
23443
|
unbanMembers: unbanMembers
|
|
23387
23444
|
});
|
|
23388
23445
|
|
|
23389
|
-
var index$
|
|
23446
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
23390
23447
|
__proto__: null,
|
|
23391
|
-
Moderation: index$
|
|
23392
|
-
Membership: index$
|
|
23448
|
+
Moderation: index$e,
|
|
23449
|
+
Membership: index$f,
|
|
23393
23450
|
getCommunityByIds: getCommunities$1,
|
|
23394
23451
|
createCommunity: createCommunity,
|
|
23395
23452
|
updateCommunity: updateCommunity,
|
|
@@ -23623,7 +23680,7 @@ const getCategories = (params, callback, config) => {
|
|
|
23623
23680
|
};
|
|
23624
23681
|
/* end_public_function */
|
|
23625
23682
|
|
|
23626
|
-
var index$
|
|
23683
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
23627
23684
|
__proto__: null,
|
|
23628
23685
|
getCategory: getCategory,
|
|
23629
23686
|
getCategories: getCategories
|
|
@@ -24682,7 +24739,7 @@ const getComments = (params, callback, config) => {
|
|
|
24682
24739
|
};
|
|
24683
24740
|
/* end_public_function */
|
|
24684
24741
|
|
|
24685
|
-
var index$
|
|
24742
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
24686
24743
|
__proto__: null,
|
|
24687
24744
|
getCommentByIds: getCommentByIds,
|
|
24688
24745
|
createComment: createComment,
|
|
@@ -25353,7 +25410,7 @@ const getUserFeed = (params, callback, config) => {
|
|
|
25353
25410
|
};
|
|
25354
25411
|
/* end_public_function */
|
|
25355
25412
|
|
|
25356
|
-
var index$
|
|
25413
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
25357
25414
|
__proto__: null,
|
|
25358
25415
|
queryGlobalFeed: queryGlobalFeed,
|
|
25359
25416
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
|
|
@@ -27034,7 +27091,7 @@ const searchPostsByHashtag = (params, callback, config) => {
|
|
|
27034
27091
|
};
|
|
27035
27092
|
/* end_public_function */
|
|
27036
27093
|
|
|
27037
|
-
var index$
|
|
27094
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
27038
27095
|
__proto__: null,
|
|
27039
27096
|
getPostByIds: getPostByIds,
|
|
27040
27097
|
createPost: createPost,
|
|
@@ -27642,7 +27699,7 @@ const getStreams = (params, callback, config) => {
|
|
|
27642
27699
|
};
|
|
27643
27700
|
};
|
|
27644
27701
|
|
|
27645
|
-
var index$
|
|
27702
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
27646
27703
|
__proto__: null,
|
|
27647
27704
|
createStream: createStream,
|
|
27648
27705
|
updateStream: updateStream,
|
|
@@ -27960,7 +28017,7 @@ const getPoll = (pollId, callback) => {
|
|
|
27960
28017
|
};
|
|
27961
28018
|
/* end_public_function */
|
|
27962
28019
|
|
|
27963
|
-
var index$
|
|
28020
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
27964
28021
|
__proto__: null,
|
|
27965
28022
|
createPoll: createPoll,
|
|
27966
28023
|
closePoll: closePoll,
|
|
@@ -27972,7 +28029,7 @@ var index$6 = /*#__PURE__*/Object.freeze({
|
|
|
27972
28029
|
getPoll: getPoll
|
|
27973
28030
|
});
|
|
27974
28031
|
|
|
27975
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
28032
|
+
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
28033
|
/*
|
|
27977
28034
|
* The crypto algorithm used for importing key and signing string
|
|
27978
28035
|
*/
|
|
@@ -28343,7 +28400,7 @@ const getPlayer = async (parameters) => {
|
|
|
28343
28400
|
return video;
|
|
28344
28401
|
};
|
|
28345
28402
|
|
|
28346
|
-
var index$
|
|
28403
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
28347
28404
|
__proto__: null,
|
|
28348
28405
|
getPlayer: getPlayer
|
|
28349
28406
|
});
|
|
@@ -29516,7 +29573,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
29516
29573
|
};
|
|
29517
29574
|
};
|
|
29518
29575
|
|
|
29519
|
-
var index$
|
|
29576
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
29520
29577
|
__proto__: null,
|
|
29521
29578
|
createImageStory: createImageStory,
|
|
29522
29579
|
createVideoStory: createVideoStory,
|
|
@@ -29553,7 +29610,7 @@ const getNetworkAds = async () => {
|
|
|
29553
29610
|
};
|
|
29554
29611
|
};
|
|
29555
29612
|
|
|
29556
|
-
var index$
|
|
29613
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
29557
29614
|
__proto__: null,
|
|
29558
29615
|
getNetworkAds: getNetworkAds
|
|
29559
29616
|
});
|
|
@@ -29944,7 +30001,7 @@ const markTraySeen = async (lastSeenAt) => {
|
|
|
29944
30001
|
};
|
|
29945
30002
|
/* end_public_function */
|
|
29946
30003
|
|
|
29947
|
-
var index$
|
|
30004
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
29948
30005
|
__proto__: null,
|
|
29949
30006
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
29950
30007
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
@@ -30145,7 +30202,7 @@ const getMyCommunityInvitations = (params, callback, config) => {
|
|
|
30145
30202
|
};
|
|
30146
30203
|
};
|
|
30147
30204
|
|
|
30148
|
-
var index$
|
|
30205
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
30149
30206
|
__proto__: null,
|
|
30150
30207
|
onLocalInvitationCreated: onLocalInvitationCreated,
|
|
30151
30208
|
onLocalInvitationUpdated: onLocalInvitationUpdated,
|
|
@@ -30286,42 +30343,585 @@ const getReactions = (postId, callback) => {
|
|
|
30286
30343
|
};
|
|
30287
30344
|
};
|
|
30288
30345
|
|
|
30289
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
30346
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
30290
30347
|
__proto__: null,
|
|
30291
30348
|
createReaction: createReaction,
|
|
30292
30349
|
onLiveReactionCreated: onLiveReactionCreated,
|
|
30293
30350
|
getReactions: getReactions
|
|
30294
30351
|
});
|
|
30295
30352
|
|
|
30353
|
+
const prepareEventPayload = (rawPayload) => {
|
|
30354
|
+
return Object.assign(Object.assign({}, rawPayload), { users: rawPayload.users.map(convertRawUserToInternalUser) });
|
|
30355
|
+
};
|
|
30356
|
+
|
|
30357
|
+
const createEventEventSubscriber = (event, callback) => {
|
|
30358
|
+
const client = getActiveClient();
|
|
30359
|
+
const filter = (payload) => {
|
|
30360
|
+
const unpackedPayload = prepareEventPayload(payload);
|
|
30361
|
+
if (!client.cache) {
|
|
30362
|
+
callback(unpackedPayload.events[0]);
|
|
30363
|
+
}
|
|
30364
|
+
else {
|
|
30365
|
+
ingestInCache(unpackedPayload);
|
|
30366
|
+
const event = pullFromCache([
|
|
30367
|
+
'event',
|
|
30368
|
+
'get',
|
|
30369
|
+
unpackedPayload.events[0].eventId,
|
|
30370
|
+
]);
|
|
30371
|
+
callback(event.data);
|
|
30372
|
+
}
|
|
30373
|
+
};
|
|
30374
|
+
return createEventSubscriber(client, event, event, filter);
|
|
30375
|
+
};
|
|
30376
|
+
|
|
30377
|
+
/* begin_public_function
|
|
30378
|
+
id: event.create
|
|
30379
|
+
*/
|
|
30380
|
+
/**
|
|
30381
|
+
* ```js
|
|
30382
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30383
|
+
* const response = await EventRepository.createEvent(bundle)
|
|
30384
|
+
* ```
|
|
30385
|
+
*
|
|
30386
|
+
* Creates an {@link Amity.Event}
|
|
30387
|
+
*
|
|
30388
|
+
* @param bundle The data necessary to create a new {@link Amity.Event}
|
|
30389
|
+
* @returns The newly created {@link Amity.Event}
|
|
30390
|
+
*
|
|
30391
|
+
* @category Event API
|
|
30392
|
+
* @async
|
|
30393
|
+
*/
|
|
30394
|
+
const createEvent = async (bundle) => {
|
|
30395
|
+
const client = getActiveClient();
|
|
30396
|
+
client.log('event/createEvent', bundle);
|
|
30397
|
+
const { data: payload } = await client.http.post('/api/v1/events', bundle);
|
|
30398
|
+
fireEvent('event.created', payload);
|
|
30399
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
30400
|
+
const cachedAt = client.cache && Date.now();
|
|
30401
|
+
if (client.cache)
|
|
30402
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
30403
|
+
return {
|
|
30404
|
+
data: eventLinkedObject(preparedPayload.events[0]),
|
|
30405
|
+
cachedAt,
|
|
30406
|
+
};
|
|
30407
|
+
};
|
|
30408
|
+
/* end_public_function */
|
|
30409
|
+
|
|
30410
|
+
/* begin_public_function
|
|
30411
|
+
id: event.update
|
|
30412
|
+
*/
|
|
30413
|
+
/**
|
|
30414
|
+
* ```js
|
|
30415
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30416
|
+
* const response = await EventRepository.updateEvent(eventId, bundle)
|
|
30417
|
+
* ```
|
|
30418
|
+
*
|
|
30419
|
+
* Updates an {@link Amity.Event}
|
|
30420
|
+
*
|
|
30421
|
+
* @param eventId The ID of the {@link Amity.Event} to edit
|
|
30422
|
+
* @param bundle The data necessary to update an existing {@link Amity.Event}
|
|
30423
|
+
* @returns the updated {@link Amity.Event}
|
|
30424
|
+
*
|
|
30425
|
+
* @category Event API
|
|
30426
|
+
* @async
|
|
30427
|
+
*/
|
|
30428
|
+
const updateEvent = async (eventId, bundle) => {
|
|
30429
|
+
const client = getActiveClient();
|
|
30430
|
+
client.log('event/updateEvent', eventId, bundle);
|
|
30431
|
+
const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
|
|
30432
|
+
fireEvent('event.updated', payload);
|
|
30433
|
+
const preparedPayload = prepareEventPayload(payload);
|
|
30434
|
+
const cachedAt = client.cache && Date.now();
|
|
30435
|
+
if (client.cache)
|
|
30436
|
+
ingestInCache(preparedPayload, { cachedAt });
|
|
30437
|
+
return {
|
|
30438
|
+
data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
|
|
30439
|
+
cachedAt,
|
|
30440
|
+
};
|
|
30441
|
+
};
|
|
30442
|
+
/* end_public_function */
|
|
30443
|
+
|
|
30444
|
+
/* begin_public_function
|
|
30445
|
+
id: event.get
|
|
30446
|
+
*/
|
|
30447
|
+
/**
|
|
30448
|
+
* ```js
|
|
30449
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30450
|
+
* const event = await EventRepository.getEvent(eventId)
|
|
30451
|
+
* ```
|
|
30452
|
+
*
|
|
30453
|
+
* Fetches a {@link Amity.Event} object
|
|
30454
|
+
*
|
|
30455
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
30456
|
+
* @returns the associated {@link Amity.Event} object
|
|
30457
|
+
*
|
|
30458
|
+
* @category Event API
|
|
30459
|
+
* @async
|
|
30460
|
+
*/
|
|
30461
|
+
const getEvent$1 = async (eventId) => {
|
|
30462
|
+
const client = getActiveClient();
|
|
30463
|
+
client.log('event/getEvent', eventId);
|
|
30464
|
+
const { data: payload } = await client.http.get(`/api/v3/events/${eventId}`);
|
|
30465
|
+
const data = prepareEventPayload(payload);
|
|
30466
|
+
const cachedAt = client.cache && Date.now();
|
|
30467
|
+
if (client.cache)
|
|
30468
|
+
ingestInCache(data, { cachedAt });
|
|
30469
|
+
return {
|
|
30470
|
+
data: data.events.find(event => event.eventId === eventId),
|
|
30471
|
+
cachedAt,
|
|
30472
|
+
};
|
|
30473
|
+
};
|
|
30474
|
+
/* end_public_function */
|
|
30475
|
+
/**
|
|
30476
|
+
* ```js
|
|
30477
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30478
|
+
* const event = EventRepository.getEvent.locally(eventId)
|
|
30479
|
+
* ```
|
|
30480
|
+
*
|
|
30481
|
+
* Fetches a {@link Amity.Event} object in cache
|
|
30482
|
+
*
|
|
30483
|
+
* @param eventId the ID of the {@link Amity.Event} to fetch
|
|
30484
|
+
* @returns the associated {@link Amity.Event} object
|
|
30485
|
+
*
|
|
30486
|
+
* @category Event API
|
|
30487
|
+
*/
|
|
30488
|
+
getEvent$1.locally = (eventId) => {
|
|
30489
|
+
const client = getActiveClient();
|
|
30490
|
+
client.log('event/getEvent.locally', eventId);
|
|
30491
|
+
if (!client.cache)
|
|
30492
|
+
return;
|
|
30493
|
+
const cache = pullFromCache(['event', 'get', eventId]);
|
|
30494
|
+
if (!cache)
|
|
30495
|
+
return;
|
|
30496
|
+
return {
|
|
30497
|
+
data: cache.data,
|
|
30498
|
+
cachedAt: cache.cachedAt,
|
|
30499
|
+
};
|
|
30500
|
+
};
|
|
30501
|
+
|
|
30502
|
+
/* begin_public_function
|
|
30503
|
+
id: event.delete
|
|
30504
|
+
*/
|
|
30505
|
+
/**
|
|
30506
|
+
* ```js
|
|
30507
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30508
|
+
* const { success } = await EventRepository.deleteEvent(eventId)
|
|
30509
|
+
* ```
|
|
30510
|
+
*
|
|
30511
|
+
* Deletes a {@link Amity.Event}
|
|
30512
|
+
*
|
|
30513
|
+
* @param eventId The {@link Amity.Event} ID to delete
|
|
30514
|
+
*
|
|
30515
|
+
* @category Event API
|
|
30516
|
+
* @async
|
|
30517
|
+
*/
|
|
30518
|
+
const deleteEvent = async (eventId) => {
|
|
30519
|
+
const client = getActiveClient();
|
|
30520
|
+
client.log('event/deleteEvent', eventId);
|
|
30521
|
+
const event = await getEvent$1(eventId);
|
|
30522
|
+
await client.http.delete(`/api/v3/events/${eventId}`);
|
|
30523
|
+
const deletedEvent = Object.assign(Object.assign({}, event.data), { isDeleted: true });
|
|
30524
|
+
upsertInCache(['event', 'get', eventId], deletedEvent);
|
|
30525
|
+
fireEvent('event.deleted', {
|
|
30526
|
+
users: [],
|
|
30527
|
+
files: [],
|
|
30528
|
+
communities: [],
|
|
30529
|
+
videoStreamings: [],
|
|
30530
|
+
events: [deletedEvent],
|
|
30531
|
+
discussionCommunities: [],
|
|
30532
|
+
});
|
|
30533
|
+
};
|
|
30534
|
+
/* end_public_function */
|
|
30535
|
+
|
|
30536
|
+
/**
|
|
30537
|
+
* ```js
|
|
30538
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30539
|
+
* const dispose = EventRepository.onEventCreated(event => {
|
|
30540
|
+
* // ...
|
|
30541
|
+
* })
|
|
30542
|
+
* ```
|
|
30543
|
+
*
|
|
30544
|
+
* Fired when a {@link Amity.Event} has been created
|
|
30545
|
+
*
|
|
30546
|
+
* @param callback The function to call when the event was fired
|
|
30547
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30548
|
+
*
|
|
30549
|
+
* @category Event Events
|
|
30550
|
+
*/
|
|
30551
|
+
const onEventCreated = (callback) => createEventEventSubscriber('event.created', callback);
|
|
30552
|
+
|
|
30553
|
+
/**
|
|
30554
|
+
* ```js
|
|
30555
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30556
|
+
* const dispose = EventRepository.onEventUpdated(event => {
|
|
30557
|
+
* // ...
|
|
30558
|
+
* })
|
|
30559
|
+
* ```
|
|
30560
|
+
*
|
|
30561
|
+
* Fired when a {@link Amity.Event} has been updated
|
|
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 onEventUpdated = (callback) => createEventEventSubscriber('event.updated', callback);
|
|
30569
|
+
|
|
30570
|
+
/**
|
|
30571
|
+
* ```js
|
|
30572
|
+
* import { EventRepository } from '@amityco/ts-sdk'
|
|
30573
|
+
* const dispose = EventRepository.onEventDeleted(event => {
|
|
30574
|
+
* // ...
|
|
30575
|
+
* })
|
|
30576
|
+
* ```
|
|
30577
|
+
*
|
|
30578
|
+
* Fired when a {@link Amity.Event} has been deleted
|
|
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 onEventDeleted = (callback) => createEventEventSubscriber('event.deleted', callback);
|
|
30586
|
+
|
|
30587
|
+
/* begin_public_function
|
|
30588
|
+
id: event.get
|
|
30589
|
+
*/
|
|
30590
|
+
/**
|
|
30591
|
+
* ```js
|
|
30592
|
+
* import { EventRepository } from '@amityco/ts-sdk';
|
|
30593
|
+
*
|
|
30594
|
+
* let event;
|
|
30595
|
+
*
|
|
30596
|
+
* const unsubscribe = EventRepository.getEvent(eventId, response => {
|
|
30597
|
+
* event = response.data;
|
|
30598
|
+
* });
|
|
30599
|
+
* ```
|
|
30600
|
+
*
|
|
30601
|
+
* Observe all mutation on a given {@link Amity.Event}
|
|
30602
|
+
*
|
|
30603
|
+
* @param eventId the ID of the event to observe
|
|
30604
|
+
* @param callback the function to call when new snapshot of event are available
|
|
30605
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the event
|
|
30606
|
+
*
|
|
30607
|
+
* @category Event Live Object
|
|
30608
|
+
*/
|
|
30609
|
+
const getEvent = (eventId, callback) => {
|
|
30610
|
+
return liveObject(eventId, callback, 'eventId', getEvent$1, [onEventCreated, onEventUpdated, onEventDeleted], {
|
|
30611
|
+
callbackDataSelector: (data) => (data ? eventLinkedObject(data) : data),
|
|
30612
|
+
});
|
|
30613
|
+
};
|
|
30614
|
+
/* end_public_function */
|
|
30615
|
+
|
|
30616
|
+
var EventActionsEnum;
|
|
30617
|
+
(function (EventActionsEnum) {
|
|
30618
|
+
EventActionsEnum["OnEventCreated"] = "onEventCreated";
|
|
30619
|
+
EventActionsEnum["OnEventUpdated"] = "onEventUpdated";
|
|
30620
|
+
EventActionsEnum["OnEventDeleted"] = "onEventDeleted";
|
|
30621
|
+
})(EventActionsEnum || (EventActionsEnum = {}));
|
|
30622
|
+
|
|
30623
|
+
class EventPaginationController extends PaginationController {
|
|
30624
|
+
async getRequest(queryParams, token) {
|
|
30625
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
30626
|
+
const options = token ? { token } : { limit };
|
|
30627
|
+
const { data: response } = await this.http.get(`/api/v1/events`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
30628
|
+
return response;
|
|
30629
|
+
}
|
|
30630
|
+
}
|
|
30631
|
+
|
|
30632
|
+
class EventQueryStreamController extends QueryStreamController {
|
|
30633
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
30634
|
+
super(query, cacheKey);
|
|
30635
|
+
this.notifyChange = notifyChange;
|
|
30636
|
+
this.preparePayload = preparePayload;
|
|
30637
|
+
}
|
|
30638
|
+
async saveToMainDB(response) {
|
|
30639
|
+
const processedPayload = this.preparePayload(response);
|
|
30640
|
+
const client = getActiveClient();
|
|
30641
|
+
const cachedAt = client.cache && Date.now();
|
|
30642
|
+
if (client.cache)
|
|
30643
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
30644
|
+
}
|
|
30645
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
30646
|
+
var _a, _b;
|
|
30647
|
+
if (refresh) {
|
|
30648
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
30649
|
+
}
|
|
30650
|
+
else {
|
|
30651
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30652
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30653
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
30654
|
+
}
|
|
30655
|
+
}
|
|
30656
|
+
reactor(action) {
|
|
30657
|
+
return (event) => {
|
|
30658
|
+
var _a;
|
|
30659
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30660
|
+
if (!collection)
|
|
30661
|
+
return;
|
|
30662
|
+
if (action === EventActionsEnum.OnEventCreated) {
|
|
30663
|
+
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
30664
|
+
}
|
|
30665
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
30666
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
30667
|
+
}
|
|
30668
|
+
pushToCache(this.cacheKey, collection);
|
|
30669
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
30670
|
+
};
|
|
30671
|
+
}
|
|
30672
|
+
subscribeRTE(createSubscriber) {
|
|
30673
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
30674
|
+
}
|
|
30675
|
+
}
|
|
30676
|
+
|
|
30677
|
+
class EventLiveCollectionController extends LiveCollectionController {
|
|
30678
|
+
constructor(query, callback) {
|
|
30679
|
+
const queryStreamId = hash__default["default"](query);
|
|
30680
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
30681
|
+
const paginationController = new EventPaginationController(query);
|
|
30682
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
30683
|
+
this.query = query;
|
|
30684
|
+
this.queryStreamController = new EventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
30685
|
+
this.callback = callback.bind(this);
|
|
30686
|
+
this.loadPage({ initial: true });
|
|
30687
|
+
}
|
|
30688
|
+
setup() {
|
|
30689
|
+
var _a;
|
|
30690
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30691
|
+
if (!collection)
|
|
30692
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
30693
|
+
}
|
|
30694
|
+
async persistModel(queryPayload) {
|
|
30695
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
30696
|
+
}
|
|
30697
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
30698
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
30699
|
+
}
|
|
30700
|
+
startSubscription() {
|
|
30701
|
+
return this.queryStreamController.subscribeRTE([
|
|
30702
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
30703
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
30704
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
30705
|
+
]);
|
|
30706
|
+
}
|
|
30707
|
+
notifyChange({ origin, loading, error }) {
|
|
30708
|
+
var _a, _b;
|
|
30709
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30710
|
+
if (!collection)
|
|
30711
|
+
return;
|
|
30712
|
+
const data = ((_b = collection.data
|
|
30713
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
30714
|
+
.filter(isNonNullable)
|
|
30715
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
30716
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
30717
|
+
return;
|
|
30718
|
+
this.callback({
|
|
30719
|
+
data,
|
|
30720
|
+
error,
|
|
30721
|
+
loading,
|
|
30722
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
30723
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
30724
|
+
});
|
|
30725
|
+
}
|
|
30726
|
+
}
|
|
30727
|
+
|
|
30728
|
+
/**
|
|
30729
|
+
* Get events
|
|
30730
|
+
*
|
|
30731
|
+
* @param params the query parameters
|
|
30732
|
+
* @param callback the callback to be called when the events are updated
|
|
30733
|
+
* @returns events
|
|
30734
|
+
*
|
|
30735
|
+
* @category Event Live Collection
|
|
30736
|
+
*
|
|
30737
|
+
*/
|
|
30738
|
+
const getEvents = (params, callback, config) => {
|
|
30739
|
+
const { log, cache } = getActiveClient();
|
|
30740
|
+
if (!cache)
|
|
30741
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
30742
|
+
const timestamp = Date.now();
|
|
30743
|
+
log(`getEvents: (tmpid: ${timestamp}) > listen`);
|
|
30744
|
+
const eventLiveCollection = new EventLiveCollectionController(params, callback);
|
|
30745
|
+
const disposers = eventLiveCollection.startSubscription();
|
|
30746
|
+
const cacheKey = eventLiveCollection.getCacheKey();
|
|
30747
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
30748
|
+
return () => {
|
|
30749
|
+
log(`getEvents (tmpid: ${timestamp}) > dispose`);
|
|
30750
|
+
disposers.forEach(fn => fn());
|
|
30751
|
+
};
|
|
30752
|
+
};
|
|
30753
|
+
|
|
30754
|
+
class MyEventPaginationController extends PaginationController {
|
|
30755
|
+
async getRequest(queryParams, token) {
|
|
30756
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
30757
|
+
const options = token ? { token } : { limit };
|
|
30758
|
+
const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
30759
|
+
return response;
|
|
30760
|
+
}
|
|
30761
|
+
}
|
|
30762
|
+
|
|
30763
|
+
class MyEventQueryStreamController extends QueryStreamController {
|
|
30764
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
30765
|
+
super(query, cacheKey);
|
|
30766
|
+
this.notifyChange = notifyChange;
|
|
30767
|
+
this.preparePayload = preparePayload;
|
|
30768
|
+
}
|
|
30769
|
+
async saveToMainDB(response) {
|
|
30770
|
+
const processedPayload = this.preparePayload(response);
|
|
30771
|
+
const client = getActiveClient();
|
|
30772
|
+
const cachedAt = client.cache && Date.now();
|
|
30773
|
+
if (client.cache)
|
|
30774
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
30775
|
+
}
|
|
30776
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
30777
|
+
var _a, _b;
|
|
30778
|
+
if (refresh) {
|
|
30779
|
+
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
30780
|
+
}
|
|
30781
|
+
else {
|
|
30782
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30783
|
+
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30784
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
30785
|
+
}
|
|
30786
|
+
}
|
|
30787
|
+
reactor(action) {
|
|
30788
|
+
return (event) => {
|
|
30789
|
+
var _a;
|
|
30790
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30791
|
+
if (!collection)
|
|
30792
|
+
return;
|
|
30793
|
+
if (action === EventActionsEnum.OnEventDeleted) {
|
|
30794
|
+
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
30795
|
+
}
|
|
30796
|
+
pushToCache(this.cacheKey, collection);
|
|
30797
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
30798
|
+
};
|
|
30799
|
+
}
|
|
30800
|
+
subscribeRTE(createSubscriber) {
|
|
30801
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
30802
|
+
}
|
|
30803
|
+
}
|
|
30804
|
+
|
|
30805
|
+
class MyEventLiveCollectionController extends LiveCollectionController {
|
|
30806
|
+
constructor(query, callback) {
|
|
30807
|
+
const queryStreamId = hash__default["default"](query);
|
|
30808
|
+
const cacheKey = ['event', 'collection', queryStreamId];
|
|
30809
|
+
const paginationController = new MyEventPaginationController(query);
|
|
30810
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
30811
|
+
this.query = query;
|
|
30812
|
+
this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
30813
|
+
this.callback = callback.bind(this);
|
|
30814
|
+
this.loadPage({ initial: true });
|
|
30815
|
+
}
|
|
30816
|
+
setup() {
|
|
30817
|
+
var _a;
|
|
30818
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30819
|
+
if (!collection)
|
|
30820
|
+
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
30821
|
+
}
|
|
30822
|
+
async persistModel(queryPayload) {
|
|
30823
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
30824
|
+
}
|
|
30825
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
30826
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
30827
|
+
}
|
|
30828
|
+
startSubscription() {
|
|
30829
|
+
return this.queryStreamController.subscribeRTE([
|
|
30830
|
+
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
30831
|
+
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
30832
|
+
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
30833
|
+
]);
|
|
30834
|
+
}
|
|
30835
|
+
notifyChange({ origin, loading, error }) {
|
|
30836
|
+
var _a, _b;
|
|
30837
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30838
|
+
if (!collection)
|
|
30839
|
+
return;
|
|
30840
|
+
const data = ((_b = collection.data
|
|
30841
|
+
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
30842
|
+
.filter(isNonNullable)
|
|
30843
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
30844
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
30845
|
+
return;
|
|
30846
|
+
this.callback({
|
|
30847
|
+
data,
|
|
30848
|
+
error,
|
|
30849
|
+
loading,
|
|
30850
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
30851
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
30852
|
+
});
|
|
30853
|
+
}
|
|
30854
|
+
}
|
|
30855
|
+
|
|
30856
|
+
/**
|
|
30857
|
+
* Get my events
|
|
30858
|
+
*
|
|
30859
|
+
* @param params the query parameters
|
|
30860
|
+
* @param callback the callback to be called when the events are updated
|
|
30861
|
+
* @returns events
|
|
30862
|
+
*
|
|
30863
|
+
* @category Event Live Collection
|
|
30864
|
+
*
|
|
30865
|
+
*/
|
|
30866
|
+
const getMyEvents = (params, callback, config) => {
|
|
30867
|
+
const { log, cache } = getActiveClient();
|
|
30868
|
+
if (!cache)
|
|
30869
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
30870
|
+
const timestamp = Date.now();
|
|
30871
|
+
log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
|
|
30872
|
+
const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
|
|
30873
|
+
const disposers = myEventLiveCollection.startSubscription();
|
|
30874
|
+
const cacheKey = myEventLiveCollection.getCacheKey();
|
|
30875
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
30876
|
+
return () => {
|
|
30877
|
+
log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
|
|
30878
|
+
disposers.forEach(fn => fn());
|
|
30879
|
+
};
|
|
30880
|
+
};
|
|
30881
|
+
|
|
30882
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
30883
|
+
__proto__: null,
|
|
30884
|
+
createEvent: createEvent,
|
|
30885
|
+
updateEvent: updateEvent,
|
|
30886
|
+
deleteEvent: deleteEvent,
|
|
30887
|
+
onEventCreated: onEventCreated,
|
|
30888
|
+
onEventUpdated: onEventUpdated,
|
|
30889
|
+
onEventDeleted: onEventDeleted,
|
|
30890
|
+
getEvent: getEvent,
|
|
30891
|
+
getEvents: getEvents,
|
|
30892
|
+
getMyEvents: getMyEvents
|
|
30893
|
+
});
|
|
30894
|
+
|
|
30296
30895
|
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$
|
|
30896
|
+
exports.AdRepository = index$4;
|
|
30897
|
+
exports.CategoryRepository = index$c;
|
|
30898
|
+
exports.ChannelRepository = index$g;
|
|
30899
|
+
exports.Client = index$p;
|
|
30900
|
+
exports.CommentRepository = index$b;
|
|
30302
30901
|
exports.CommunityPostSettingMaps = CommunityPostSettingMaps;
|
|
30303
30902
|
exports.CommunityPostSettings = CommunityPostSettings;
|
|
30304
|
-
exports.CommunityRepository = index$
|
|
30903
|
+
exports.CommunityRepository = index$d;
|
|
30305
30904
|
exports.ContentFeedType = ContentFeedType;
|
|
30306
30905
|
exports.DefaultCommunityPostSetting = DefaultCommunityPostSetting;
|
|
30307
|
-
exports.
|
|
30308
|
-
exports.
|
|
30906
|
+
exports.EventRepository = index;
|
|
30907
|
+
exports.FeedRepository = index$a;
|
|
30908
|
+
exports.FileRepository = index$m;
|
|
30309
30909
|
exports.FileType = FileType;
|
|
30310
30910
|
exports.GET_WATCHER_URLS = GET_WATCHER_URLS;
|
|
30311
|
-
exports.InvitationRepository = index$
|
|
30312
|
-
exports.LiveReactionRepository = index;
|
|
30313
|
-
exports.LiveStreamPlayer = index$
|
|
30911
|
+
exports.InvitationRepository = index$2;
|
|
30912
|
+
exports.LiveReactionRepository = index$1;
|
|
30913
|
+
exports.LiveStreamPlayer = index$6;
|
|
30314
30914
|
exports.MessageContentType = MessageContentType;
|
|
30315
|
-
exports.MessageRepository = index$
|
|
30316
|
-
exports.PollRepository = index$
|
|
30915
|
+
exports.MessageRepository = index$k;
|
|
30916
|
+
exports.PollRepository = index$7;
|
|
30317
30917
|
exports.PostContentType = PostContentType;
|
|
30318
|
-
exports.PostRepository = index$
|
|
30918
|
+
exports.PostRepository = index$9;
|
|
30319
30919
|
exports.PostStructureType = PostStructureType;
|
|
30320
|
-
exports.ReactionRepository = index$
|
|
30321
|
-
exports.StoryRepository = index$
|
|
30322
|
-
exports.StreamRepository = index$
|
|
30323
|
-
exports.SubChannelRepository = index$
|
|
30324
|
-
exports.UserRepository = index$
|
|
30920
|
+
exports.ReactionRepository = index$l;
|
|
30921
|
+
exports.StoryRepository = index$5;
|
|
30922
|
+
exports.StreamRepository = index$8;
|
|
30923
|
+
exports.SubChannelRepository = index$j;
|
|
30924
|
+
exports.UserRepository = index$n;
|
|
30325
30925
|
exports.VERSION = VERSION;
|
|
30326
30926
|
exports.VideoResolution = VideoResolution;
|
|
30327
30927
|
exports.VideoSize = VideoSize;
|
|
@@ -30375,7 +30975,7 @@ exports.isPaged = isPaged;
|
|
|
30375
30975
|
exports.isReportedByMe = isReportedByMe;
|
|
30376
30976
|
exports.isSkip = isSkip;
|
|
30377
30977
|
exports.mergeInCache = mergeInCache;
|
|
30378
|
-
exports.notificationTray = index$
|
|
30978
|
+
exports.notificationTray = index$3;
|
|
30379
30979
|
exports.onChannelMarkerFetched = onChannelMarkerFetched;
|
|
30380
30980
|
exports.onFeedMarkerFetched = onFeedMarkerFetched;
|
|
30381
30981
|
exports.onFeedMarkerUpdated = onFeedMarkerUpdated;
|