@stream-io/feeds-client 0.3.48 → 0.3.50
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/CHANGELOG.md +20 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-bindings.js +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/react-bindings.mjs +1 -1
- package/dist/{feeds-client-D-EFo20w.mjs → feeds-client-BHpmg4_E.mjs} +270 -176
- package/dist/feeds-client-BHpmg4_E.mjs.map +1 -0
- package/dist/{feeds-client-DuJuJuEJ.js → feeds-client-CKxvuiKz.js} +270 -176
- package/dist/feeds-client-CKxvuiKz.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types/common/Poll.d.ts +7 -3
- package/dist/types/common/Poll.d.ts.map +1 -1
- package/dist/types/common/real-time/StableWSConnection.d.ts +3 -3
- package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity-updater.d.ts +3 -1
- package/dist/types/feed/event-handlers/activity-updater.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/comment/handle-comment-added.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts +2 -2
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/feeds-client/feeds-client.d.ts +7 -3
- package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
- package/dist/types/gen/feeds/FeedsApi.d.ts +34 -3
- package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts.map +1 -1
- package/dist/types/gen/models/index.d.ts +276 -422
- package/dist/types/gen/models/index.d.ts.map +1 -1
- package/dist/types/gen/moderation/ModerationApi.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/constants.d.ts +1 -1
- package/package.json +1 -1
- package/src/common/Poll.ts +16 -15
- package/src/feed/event-handlers/comment/handle-comment-added.ts +14 -2
- package/src/feed/feed.ts +25 -9
- package/src/feeds-client/feeds-client.ts +28 -1
- package/src/gen/feeds/FeedsApi.ts +200 -2
- package/src/gen/model-decoders/decoders.ts +95 -230
- package/src/gen/model-decoders/event-decoder-mapping.ts +6 -2
- package/src/gen/models/index.ts +443 -746
- package/src/gen/moderation/ModerationApi.ts +1 -0
- package/src/test-utils/response-generators.ts +3 -2
- package/src/types.ts +2 -2
- package/src/utils/constants.ts +1 -1
- package/dist/feeds-client-D-EFo20w.mjs.map +0 -1
- package/dist/feeds-client-DuJuJuEJ.js.map +0 -1
|
@@ -155,7 +155,7 @@ decoders.ActivityResponse = (input) => {
|
|
|
155
155
|
own_bookmarks: { type: "BookmarkResponse", isSingle: false },
|
|
156
156
|
own_reactions: { type: "FeedsReactionResponse", isSingle: false },
|
|
157
157
|
collections: { type: "EnrichedCollectionResponse", isSingle: false },
|
|
158
|
-
reaction_groups: { type: "
|
|
158
|
+
reaction_groups: { type: "FeedsReactionGroupResponse", isSingle: false },
|
|
159
159
|
user: { type: "UserResponse", isSingle: true },
|
|
160
160
|
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
161
161
|
edited_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -229,6 +229,12 @@ decoders.AddReactionResponse = (input) => {
|
|
|
229
229
|
};
|
|
230
230
|
return decode(typeMappings, input);
|
|
231
231
|
};
|
|
232
|
+
decoders.AddUserGroupMembersResponse = (input) => {
|
|
233
|
+
const typeMappings = {
|
|
234
|
+
user_group: { type: "UserGroupResponse", isSingle: true }
|
|
235
|
+
};
|
|
236
|
+
return decode(typeMappings, input);
|
|
237
|
+
};
|
|
232
238
|
decoders.AggregatedActivityResponse = (input) => {
|
|
233
239
|
const typeMappings = {
|
|
234
240
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -252,13 +258,12 @@ decoders.AppealItemResponse = (input) => {
|
|
|
252
258
|
};
|
|
253
259
|
return decode(typeMappings, input);
|
|
254
260
|
};
|
|
255
|
-
decoders.
|
|
261
|
+
decoders.BanInfoResponse = (input) => {
|
|
256
262
|
const typeMappings = {
|
|
257
263
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
258
264
|
expires: { type: "DatetimeType", isSingle: true },
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
target: { type: "User", isSingle: true }
|
|
265
|
+
created_by: { type: "UserResponse", isSingle: true },
|
|
266
|
+
user: { type: "UserResponse", isSingle: true }
|
|
262
267
|
};
|
|
263
268
|
return decode(typeMappings, input);
|
|
264
269
|
};
|
|
@@ -373,30 +378,6 @@ decoders.CallSessionResponse = (input) => {
|
|
|
373
378
|
};
|
|
374
379
|
return decode(typeMappings, input);
|
|
375
380
|
};
|
|
376
|
-
decoders.Channel = (input) => {
|
|
377
|
-
const typeMappings = {
|
|
378
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
379
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
380
|
-
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
381
|
-
last_message_at: { type: "DatetimeType", isSingle: true },
|
|
382
|
-
message_count_updated_at: { type: "DatetimeType", isSingle: true },
|
|
383
|
-
active_live_locations: { type: "SharedLocation", isSingle: false },
|
|
384
|
-
invites: { type: "ChannelMember", isSingle: false },
|
|
385
|
-
members: { type: "ChannelMember", isSingle: false },
|
|
386
|
-
config: { type: "ChannelConfig", isSingle: true },
|
|
387
|
-
created_by: { type: "User", isSingle: true },
|
|
388
|
-
members_lookup: { type: "ChannelMemberLookup", isSingle: false },
|
|
389
|
-
truncated_by: { type: "User", isSingle: true }
|
|
390
|
-
};
|
|
391
|
-
return decode(typeMappings, input);
|
|
392
|
-
};
|
|
393
|
-
decoders.ChannelConfig = (input) => {
|
|
394
|
-
const typeMappings = {
|
|
395
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
396
|
-
updated_at: { type: "DatetimeType", isSingle: true }
|
|
397
|
-
};
|
|
398
|
-
return decode(typeMappings, input);
|
|
399
|
-
};
|
|
400
381
|
decoders.ChannelConfigWithInfo = (input) => {
|
|
401
382
|
const typeMappings = {
|
|
402
383
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -405,28 +386,6 @@ decoders.ChannelConfigWithInfo = (input) => {
|
|
|
405
386
|
};
|
|
406
387
|
return decode(typeMappings, input);
|
|
407
388
|
};
|
|
408
|
-
decoders.ChannelMember = (input) => {
|
|
409
|
-
const typeMappings = {
|
|
410
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
411
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
412
|
-
archived_at: { type: "DatetimeType", isSingle: true },
|
|
413
|
-
ban_expires: { type: "DatetimeType", isSingle: true },
|
|
414
|
-
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
415
|
-
invite_accepted_at: { type: "DatetimeType", isSingle: true },
|
|
416
|
-
invite_rejected_at: { type: "DatetimeType", isSingle: true },
|
|
417
|
-
pinned_at: { type: "DatetimeType", isSingle: true },
|
|
418
|
-
user: { type: "User", isSingle: true }
|
|
419
|
-
};
|
|
420
|
-
return decode(typeMappings, input);
|
|
421
|
-
};
|
|
422
|
-
decoders.ChannelMemberLookup = (input) => {
|
|
423
|
-
const typeMappings = {
|
|
424
|
-
archived_at: { type: "DatetimeType", isSingle: true },
|
|
425
|
-
ban_expires: { type: "DatetimeType", isSingle: true },
|
|
426
|
-
pinned_at: { type: "DatetimeType", isSingle: true }
|
|
427
|
-
};
|
|
428
|
-
return decode(typeMappings, input);
|
|
429
|
-
};
|
|
430
389
|
decoders.ChannelMemberResponse = (input) => {
|
|
431
390
|
const typeMappings = {
|
|
432
391
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -537,7 +496,7 @@ decoders.CommentResponse = (input) => {
|
|
|
537
496
|
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
538
497
|
edited_at: { type: "DatetimeType", isSingle: true },
|
|
539
498
|
latest_reactions: { type: "FeedsReactionResponse", isSingle: false },
|
|
540
|
-
reaction_groups: { type: "
|
|
499
|
+
reaction_groups: { type: "FeedsReactionGroupResponse", isSingle: false }
|
|
541
500
|
};
|
|
542
501
|
return decode(typeMappings, input);
|
|
543
502
|
};
|
|
@@ -580,6 +539,12 @@ decoders.CreateGuestResponse = (input) => {
|
|
|
580
539
|
};
|
|
581
540
|
return decode(typeMappings, input);
|
|
582
541
|
};
|
|
542
|
+
decoders.CreateUserGroupResponse = (input) => {
|
|
543
|
+
const typeMappings = {
|
|
544
|
+
user_group: { type: "UserGroupResponse", isSingle: true }
|
|
545
|
+
};
|
|
546
|
+
return decode(typeMappings, input);
|
|
547
|
+
};
|
|
583
548
|
decoders.DeleteActivityReactionResponse = (input) => {
|
|
584
549
|
const typeMappings = {
|
|
585
550
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
@@ -607,12 +572,6 @@ decoders.DeleteCommentResponse = (input) => {
|
|
|
607
572
|
};
|
|
608
573
|
return decode(typeMappings, input);
|
|
609
574
|
};
|
|
610
|
-
decoders.Device = (input) => {
|
|
611
|
-
const typeMappings = {
|
|
612
|
-
created_at: { type: "DatetimeType", isSingle: true }
|
|
613
|
-
};
|
|
614
|
-
return decode(typeMappings, input);
|
|
615
|
-
};
|
|
616
575
|
decoders.DeviceResponse = (input) => {
|
|
617
576
|
const typeMappings = {
|
|
618
577
|
created_at: { type: "DatetimeType", isSingle: true }
|
|
@@ -689,6 +648,13 @@ decoders.FeedGroupDeletedEvent = (input) => {
|
|
|
689
648
|
};
|
|
690
649
|
return decode(typeMappings, input);
|
|
691
650
|
};
|
|
651
|
+
decoders.FeedGroupRestoredEvent = (input) => {
|
|
652
|
+
const typeMappings = {
|
|
653
|
+
created_at: { type: "DatetimeType", isSingle: true },
|
|
654
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
655
|
+
};
|
|
656
|
+
return decode(typeMappings, input);
|
|
657
|
+
};
|
|
692
658
|
decoders.FeedMemberAddedEvent = (input) => {
|
|
693
659
|
const typeMappings = {
|
|
694
660
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -763,6 +729,13 @@ decoders.FeedUpdatedEvent = (input) => {
|
|
|
763
729
|
};
|
|
764
730
|
return decode(typeMappings, input);
|
|
765
731
|
};
|
|
732
|
+
decoders.FeedsReactionGroupResponse = (input) => {
|
|
733
|
+
const typeMappings = {
|
|
734
|
+
first_reaction_at: { type: "DatetimeType", isSingle: true },
|
|
735
|
+
last_reaction_at: { type: "DatetimeType", isSingle: true }
|
|
736
|
+
};
|
|
737
|
+
return decode(typeMappings, input);
|
|
738
|
+
};
|
|
766
739
|
decoders.FeedsReactionResponse = (input) => {
|
|
767
740
|
const typeMappings = {
|
|
768
741
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -892,10 +865,17 @@ decoders.GetOrCreateFeedResponse = (input) => {
|
|
|
892
865
|
};
|
|
893
866
|
return decode(typeMappings, input);
|
|
894
867
|
};
|
|
868
|
+
decoders.GetUserGroupResponse = (input) => {
|
|
869
|
+
const typeMappings = {
|
|
870
|
+
user_group: { type: "UserGroupResponse", isSingle: true }
|
|
871
|
+
};
|
|
872
|
+
return decode(typeMappings, input);
|
|
873
|
+
};
|
|
895
874
|
decoders.HealthCheckEvent = (input) => {
|
|
896
875
|
const typeMappings = {
|
|
897
876
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
898
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
877
|
+
received_at: { type: "DatetimeType", isSingle: true },
|
|
878
|
+
me: { type: "OwnUserResponse", isSingle: true }
|
|
899
879
|
};
|
|
900
880
|
return decode(typeMappings, input);
|
|
901
881
|
};
|
|
@@ -911,44 +891,16 @@ decoders.ListDevicesResponse = (input) => {
|
|
|
911
891
|
};
|
|
912
892
|
return decode(typeMappings, input);
|
|
913
893
|
};
|
|
914
|
-
decoders.
|
|
894
|
+
decoders.ListUserGroupsResponse = (input) => {
|
|
915
895
|
const typeMappings = {
|
|
916
|
-
|
|
917
|
-
updated_at: { type: "DatetimeType", isSingle: true }
|
|
896
|
+
user_groups: { type: "UserGroupResponse", isSingle: false }
|
|
918
897
|
};
|
|
919
898
|
return decode(typeMappings, input);
|
|
920
899
|
};
|
|
921
|
-
decoders.
|
|
922
|
-
const typeMappings = {
|
|
923
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
924
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
925
|
-
latest_reactions: { type: "Reaction", isSingle: false },
|
|
926
|
-
mentioned_users: { type: "User", isSingle: false },
|
|
927
|
-
own_reactions: { type: "Reaction", isSingle: false },
|
|
928
|
-
reaction_groups: { type: "ReactionGroupResponse", isSingle: false },
|
|
929
|
-
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
930
|
-
message_text_updated_at: { type: "DatetimeType", isSingle: true },
|
|
931
|
-
pin_expires: { type: "DatetimeType", isSingle: true },
|
|
932
|
-
pinned_at: { type: "DatetimeType", isSingle: true },
|
|
933
|
-
thread_participants: { type: "User", isSingle: false },
|
|
934
|
-
member: { type: "ChannelMember", isSingle: true },
|
|
935
|
-
pinned_by: { type: "User", isSingle: true },
|
|
936
|
-
poll: { type: "Poll", isSingle: true },
|
|
937
|
-
quoted_message: { type: "Message", isSingle: true },
|
|
938
|
-
reminder: { type: "MessageReminder", isSingle: true },
|
|
939
|
-
shared_location: { type: "SharedLocation", isSingle: true },
|
|
940
|
-
user: { type: "User", isSingle: true }
|
|
941
|
-
};
|
|
942
|
-
return decode(typeMappings, input);
|
|
943
|
-
};
|
|
944
|
-
decoders.MessageReminder = (input) => {
|
|
900
|
+
decoders.MembershipLevelResponse = (input) => {
|
|
945
901
|
const typeMappings = {
|
|
946
902
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
947
|
-
updated_at: { type: "DatetimeType", isSingle: true }
|
|
948
|
-
remind_at: { type: "DatetimeType", isSingle: true },
|
|
949
|
-
channel: { type: "Channel", isSingle: true },
|
|
950
|
-
message: { type: "Message", isSingle: true },
|
|
951
|
-
user: { type: "User", isSingle: true }
|
|
903
|
+
updated_at: { type: "DatetimeType", isSingle: true }
|
|
952
904
|
};
|
|
953
905
|
return decode(typeMappings, input);
|
|
954
906
|
};
|
|
@@ -997,7 +949,7 @@ decoders.ModerationFlagResponse = (input) => {
|
|
|
997
949
|
decoders.ModerationFlaggedEvent = (input) => {
|
|
998
950
|
const typeMappings = {
|
|
999
951
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1000
|
-
|
|
952
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
1001
953
|
};
|
|
1002
954
|
return decode(typeMappings, input);
|
|
1003
955
|
};
|
|
@@ -1012,8 +964,8 @@ decoders.ModerationMarkReviewedEvent = (input) => {
|
|
|
1012
964
|
};
|
|
1013
965
|
decoders.MuteResponse = (input) => {
|
|
1014
966
|
const typeMappings = {
|
|
1015
|
-
mutes: { type: "
|
|
1016
|
-
own_user: { type: "
|
|
967
|
+
mutes: { type: "UserMuteResponse", isSingle: false },
|
|
968
|
+
own_user: { type: "OwnUserResponse", isSingle: true }
|
|
1017
969
|
};
|
|
1018
970
|
return decode(typeMappings, input);
|
|
1019
971
|
};
|
|
@@ -1042,18 +994,18 @@ decoders.OwnBatchResponse = (input) => {
|
|
|
1042
994
|
};
|
|
1043
995
|
return decode(typeMappings, input);
|
|
1044
996
|
};
|
|
1045
|
-
decoders.
|
|
997
|
+
decoders.OwnUserResponse = (input) => {
|
|
1046
998
|
const typeMappings = {
|
|
1047
999
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1048
1000
|
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1049
1001
|
channel_mutes: { type: "ChannelMute", isSingle: false },
|
|
1050
|
-
devices: { type: "
|
|
1051
|
-
mutes: { type: "
|
|
1002
|
+
devices: { type: "DeviceResponse", isSingle: false },
|
|
1003
|
+
mutes: { type: "UserMuteResponse", isSingle: false },
|
|
1052
1004
|
deactivated_at: { type: "DatetimeType", isSingle: true },
|
|
1053
1005
|
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
1054
1006
|
last_active: { type: "DatetimeType", isSingle: true },
|
|
1055
|
-
|
|
1056
|
-
push_preferences: { type: "
|
|
1007
|
+
revoke_tokens_issued_before: { type: "DatetimeType", isSingle: true },
|
|
1008
|
+
push_preferences: { type: "PushPreferencesResponse", isSingle: true }
|
|
1057
1009
|
};
|
|
1058
1010
|
return decode(typeMappings, input);
|
|
1059
1011
|
};
|
|
@@ -1064,16 +1016,6 @@ decoders.PinActivityResponse = (input) => {
|
|
|
1064
1016
|
};
|
|
1065
1017
|
return decode(typeMappings, input);
|
|
1066
1018
|
};
|
|
1067
|
-
decoders.Poll = (input) => {
|
|
1068
|
-
const typeMappings = {
|
|
1069
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
1070
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1071
|
-
latest_answers: { type: "PollVote", isSingle: false },
|
|
1072
|
-
own_votes: { type: "PollVote", isSingle: false },
|
|
1073
|
-
created_by: { type: "User", isSingle: true }
|
|
1074
|
-
};
|
|
1075
|
-
return decode(typeMappings, input);
|
|
1076
|
-
};
|
|
1077
1019
|
decoders.PollClosedFeedEvent = (input) => {
|
|
1078
1020
|
const typeMappings = {
|
|
1079
1021
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -1114,14 +1056,6 @@ decoders.PollUpdatedFeedEvent = (input) => {
|
|
|
1114
1056
|
};
|
|
1115
1057
|
return decode(typeMappings, input);
|
|
1116
1058
|
};
|
|
1117
|
-
decoders.PollVote = (input) => {
|
|
1118
|
-
const typeMappings = {
|
|
1119
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
1120
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1121
|
-
user: { type: "User", isSingle: true }
|
|
1122
|
-
};
|
|
1123
|
-
return decode(typeMappings, input);
|
|
1124
|
-
};
|
|
1125
1059
|
decoders.PollVoteCastedFeedEvent = (input) => {
|
|
1126
1060
|
const typeMappings = {
|
|
1127
1061
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -1170,7 +1104,7 @@ decoders.PollVotesResponse = (input) => {
|
|
|
1170
1104
|
};
|
|
1171
1105
|
return decode(typeMappings, input);
|
|
1172
1106
|
};
|
|
1173
|
-
decoders.
|
|
1107
|
+
decoders.PushPreferencesResponse = (input) => {
|
|
1174
1108
|
const typeMappings = {
|
|
1175
1109
|
disabled_until: { type: "DatetimeType", isSingle: true }
|
|
1176
1110
|
};
|
|
@@ -1264,8 +1198,7 @@ decoders.Reaction = (input) => {
|
|
|
1264
1198
|
const typeMappings = {
|
|
1265
1199
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1266
1200
|
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1267
|
-
deleted_at: { type: "DatetimeType", isSingle: true }
|
|
1268
|
-
user: { type: "User", isSingle: true }
|
|
1201
|
+
deleted_at: { type: "DatetimeType", isSingle: true }
|
|
1269
1202
|
};
|
|
1270
1203
|
return decode(typeMappings, input);
|
|
1271
1204
|
};
|
|
@@ -1313,6 +1246,12 @@ decoders.ReminderResponseData = (input) => {
|
|
|
1313
1246
|
};
|
|
1314
1247
|
return decode(typeMappings, input);
|
|
1315
1248
|
};
|
|
1249
|
+
decoders.RemoveUserGroupMembersResponse = (input) => {
|
|
1250
|
+
const typeMappings = {
|
|
1251
|
+
user_group: { type: "UserGroupResponse", isSingle: true }
|
|
1252
|
+
};
|
|
1253
|
+
return decode(typeMappings, input);
|
|
1254
|
+
};
|
|
1316
1255
|
decoders.RestoreActivityResponse = (input) => {
|
|
1317
1256
|
const typeMappings = {
|
|
1318
1257
|
activity: { type: "ActivityResponse", isSingle: true }
|
|
@@ -1324,7 +1263,7 @@ decoders.ReviewQueueItemResponse = (input) => {
|
|
|
1324
1263
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1325
1264
|
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1326
1265
|
actions: { type: "ActionLogResponse", isSingle: false },
|
|
1327
|
-
bans: { type: "
|
|
1266
|
+
bans: { type: "BanInfoResponse", isSingle: false },
|
|
1328
1267
|
flags: { type: "ModerationFlagResponse", isSingle: false },
|
|
1329
1268
|
completed_at: { type: "DatetimeType", isSingle: true },
|
|
1330
1269
|
reviewed_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -1340,13 +1279,9 @@ decoders.ReviewQueueItemResponse = (input) => {
|
|
|
1340
1279
|
};
|
|
1341
1280
|
return decode(typeMappings, input);
|
|
1342
1281
|
};
|
|
1343
|
-
decoders.
|
|
1282
|
+
decoders.SearchUserGroupsResponse = (input) => {
|
|
1344
1283
|
const typeMappings = {
|
|
1345
|
-
|
|
1346
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1347
|
-
end_at: { type: "DatetimeType", isSingle: true },
|
|
1348
|
-
channel: { type: "Channel", isSingle: true },
|
|
1349
|
-
message: { type: "Message", isSingle: true }
|
|
1284
|
+
user_groups: { type: "UserGroupResponse", isSingle: false }
|
|
1350
1285
|
};
|
|
1351
1286
|
return decode(typeMappings, input);
|
|
1352
1287
|
};
|
|
@@ -1415,7 +1350,7 @@ decoders.ThreadedCommentResponse = (input) => {
|
|
|
1415
1350
|
edited_at: { type: "DatetimeType", isSingle: true },
|
|
1416
1351
|
latest_reactions: { type: "FeedsReactionResponse", isSingle: false },
|
|
1417
1352
|
replies: { type: "ThreadedCommentResponse", isSingle: false },
|
|
1418
|
-
reaction_groups: { type: "
|
|
1353
|
+
reaction_groups: { type: "FeedsReactionGroupResponse", isSingle: false }
|
|
1419
1354
|
};
|
|
1420
1355
|
return decode(typeMappings, input);
|
|
1421
1356
|
};
|
|
@@ -1498,6 +1433,12 @@ decoders.UpdateFollowResponse = (input) => {
|
|
|
1498
1433
|
};
|
|
1499
1434
|
return decode(typeMappings, input);
|
|
1500
1435
|
};
|
|
1436
|
+
decoders.UpdateUserGroupResponse = (input) => {
|
|
1437
|
+
const typeMappings = {
|
|
1438
|
+
user_group: { type: "UserGroupResponse", isSingle: true }
|
|
1439
|
+
};
|
|
1440
|
+
return decode(typeMappings, input);
|
|
1441
|
+
};
|
|
1501
1442
|
decoders.UpdateUsersResponse = (input) => {
|
|
1502
1443
|
const typeMappings = {
|
|
1503
1444
|
users: { type: "FullUserResponse", isSingle: false }
|
|
@@ -1518,47 +1459,36 @@ decoders.UpsertConfigResponse = (input) => {
|
|
|
1518
1459
|
};
|
|
1519
1460
|
decoders.UpsertPushPreferencesResponse = (input) => {
|
|
1520
1461
|
const typeMappings = {
|
|
1521
|
-
user_preferences: { type: "
|
|
1462
|
+
user_preferences: { type: "PushPreferencesResponse", isSingle: false }
|
|
1522
1463
|
};
|
|
1523
1464
|
return decode(typeMappings, input);
|
|
1524
1465
|
};
|
|
1525
|
-
decoders.
|
|
1466
|
+
decoders.UserBannedEvent = (input) => {
|
|
1526
1467
|
const typeMappings = {
|
|
1527
|
-
ban_expires: { type: "DatetimeType", isSingle: true },
|
|
1528
1468
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
last_active: { type: "DatetimeType", isSingle: true },
|
|
1532
|
-
last_engaged_at: { type: "DatetimeType", isSingle: true },
|
|
1533
|
-
revoke_tokens_issued_before: { type: "DatetimeType", isSingle: true },
|
|
1534
|
-
updated_at: { type: "DatetimeType", isSingle: true }
|
|
1469
|
+
expiration: { type: "DatetimeType", isSingle: true },
|
|
1470
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
1535
1471
|
};
|
|
1536
1472
|
return decode(typeMappings, input);
|
|
1537
1473
|
};
|
|
1538
|
-
decoders.
|
|
1474
|
+
decoders.UserDeactivatedEvent = (input) => {
|
|
1539
1475
|
const typeMappings = {
|
|
1540
1476
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1541
|
-
|
|
1542
|
-
expiration: { type: "DatetimeType", isSingle: true },
|
|
1543
|
-
user: { type: "User", isSingle: true }
|
|
1477
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
1544
1478
|
};
|
|
1545
1479
|
return decode(typeMappings, input);
|
|
1546
1480
|
};
|
|
1547
|
-
decoders.
|
|
1481
|
+
decoders.UserGroupMember = (input) => {
|
|
1548
1482
|
const typeMappings = {
|
|
1549
|
-
created_at: { type: "DatetimeType", isSingle: true }
|
|
1550
|
-
created_by: { type: "User", isSingle: true },
|
|
1551
|
-
user: { type: "User", isSingle: true }
|
|
1483
|
+
created_at: { type: "DatetimeType", isSingle: true }
|
|
1552
1484
|
};
|
|
1553
1485
|
return decode(typeMappings, input);
|
|
1554
1486
|
};
|
|
1555
|
-
decoders.
|
|
1487
|
+
decoders.UserGroupResponse = (input) => {
|
|
1556
1488
|
const typeMappings = {
|
|
1557
1489
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1558
1490
|
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1559
|
-
|
|
1560
|
-
target: { type: "User", isSingle: true },
|
|
1561
|
-
user: { type: "User", isSingle: true }
|
|
1491
|
+
members: { type: "UserGroupMember", isSingle: false }
|
|
1562
1492
|
};
|
|
1563
1493
|
return decode(typeMappings, input);
|
|
1564
1494
|
};
|
|
@@ -1572,17 +1502,10 @@ decoders.UserMuteResponse = (input) => {
|
|
|
1572
1502
|
};
|
|
1573
1503
|
return decode(typeMappings, input);
|
|
1574
1504
|
};
|
|
1575
|
-
decoders.UserMutedEvent = (input) => {
|
|
1576
|
-
const typeMappings = {
|
|
1577
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
1578
|
-
user: { type: "User", isSingle: true }
|
|
1579
|
-
};
|
|
1580
|
-
return decode(typeMappings, input);
|
|
1581
|
-
};
|
|
1582
1505
|
decoders.UserReactivatedEvent = (input) => {
|
|
1583
1506
|
const typeMappings = {
|
|
1584
1507
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
1585
|
-
|
|
1508
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
1586
1509
|
};
|
|
1587
1510
|
return decode(typeMappings, input);
|
|
1588
1511
|
};
|
|
@@ -1597,6 +1520,13 @@ decoders.UserResponse = (input) => {
|
|
|
1597
1520
|
};
|
|
1598
1521
|
return decode(typeMappings, input);
|
|
1599
1522
|
};
|
|
1523
|
+
decoders.UserUnbannedEvent = (input) => {
|
|
1524
|
+
const typeMappings = {
|
|
1525
|
+
created_at: { type: "DatetimeType", isSingle: true },
|
|
1526
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
1527
|
+
};
|
|
1528
|
+
return decode(typeMappings, input);
|
|
1529
|
+
};
|
|
1600
1530
|
decoders.UserUpdatedEvent = (input) => {
|
|
1601
1531
|
const typeMappings = {
|
|
1602
1532
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -2041,7 +1971,8 @@ class FeedsApi {
|
|
|
2041
1971
|
interest_tags: request?.interest_tags,
|
|
2042
1972
|
mentioned_user_ids: request?.mentioned_user_ids,
|
|
2043
1973
|
custom: request?.custom,
|
|
2044
|
-
location: request?.location
|
|
1974
|
+
location: request?.location,
|
|
1975
|
+
search_data: request?.search_data
|
|
2045
1976
|
};
|
|
2046
1977
|
const response = await this.apiClient.sendRequest(
|
|
2047
1978
|
"PUT",
|
|
@@ -3172,6 +3103,122 @@ class FeedsApi {
|
|
|
3172
3103
|
decoders.ImageUploadResponse?.(response.body);
|
|
3173
3104
|
return { ...response.body, metadata: response.metadata };
|
|
3174
3105
|
}
|
|
3106
|
+
async listUserGroups(request) {
|
|
3107
|
+
const queryParams = {
|
|
3108
|
+
limit: request?.limit,
|
|
3109
|
+
id_gt: request?.id_gt,
|
|
3110
|
+
created_at_gt: request?.created_at_gt,
|
|
3111
|
+
team_id: request?.team_id
|
|
3112
|
+
};
|
|
3113
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/usergroups", void 0, queryParams);
|
|
3114
|
+
decoders.ListUserGroupsResponse?.(response.body);
|
|
3115
|
+
return { ...response.body, metadata: response.metadata };
|
|
3116
|
+
}
|
|
3117
|
+
async createUserGroup(request) {
|
|
3118
|
+
const body = {
|
|
3119
|
+
name: request?.name,
|
|
3120
|
+
description: request?.description,
|
|
3121
|
+
id: request?.id,
|
|
3122
|
+
team_id: request?.team_id,
|
|
3123
|
+
member_ids: request?.member_ids
|
|
3124
|
+
};
|
|
3125
|
+
const response = await this.apiClient.sendRequest(
|
|
3126
|
+
"POST",
|
|
3127
|
+
"/api/v2/usergroups",
|
|
3128
|
+
void 0,
|
|
3129
|
+
void 0,
|
|
3130
|
+
body,
|
|
3131
|
+
"application/json"
|
|
3132
|
+
);
|
|
3133
|
+
decoders.CreateUserGroupResponse?.(response.body);
|
|
3134
|
+
return { ...response.body, metadata: response.metadata };
|
|
3135
|
+
}
|
|
3136
|
+
async searchUserGroups(request) {
|
|
3137
|
+
const queryParams = {
|
|
3138
|
+
query: request?.query,
|
|
3139
|
+
limit: request?.limit,
|
|
3140
|
+
name_gt: request?.name_gt,
|
|
3141
|
+
id_gt: request?.id_gt,
|
|
3142
|
+
team_id: request?.team_id
|
|
3143
|
+
};
|
|
3144
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/usergroups/search", void 0, queryParams);
|
|
3145
|
+
decoders.SearchUserGroupsResponse?.(response.body);
|
|
3146
|
+
return { ...response.body, metadata: response.metadata };
|
|
3147
|
+
}
|
|
3148
|
+
async deleteUserGroup(request) {
|
|
3149
|
+
const queryParams = {
|
|
3150
|
+
team_id: request?.team_id
|
|
3151
|
+
};
|
|
3152
|
+
const pathParams = {
|
|
3153
|
+
id: request?.id
|
|
3154
|
+
};
|
|
3155
|
+
const response = await this.apiClient.sendRequest(
|
|
3156
|
+
"DELETE",
|
|
3157
|
+
"/api/v2/usergroups/{id}",
|
|
3158
|
+
pathParams,
|
|
3159
|
+
queryParams
|
|
3160
|
+
);
|
|
3161
|
+
decoders.Response?.(response.body);
|
|
3162
|
+
return { ...response.body, metadata: response.metadata };
|
|
3163
|
+
}
|
|
3164
|
+
async getUserGroup(request) {
|
|
3165
|
+
const queryParams = {
|
|
3166
|
+
team_id: request?.team_id
|
|
3167
|
+
};
|
|
3168
|
+
const pathParams = {
|
|
3169
|
+
id: request?.id
|
|
3170
|
+
};
|
|
3171
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/usergroups/{id}", pathParams, queryParams);
|
|
3172
|
+
decoders.GetUserGroupResponse?.(response.body);
|
|
3173
|
+
return { ...response.body, metadata: response.metadata };
|
|
3174
|
+
}
|
|
3175
|
+
async updateUserGroup(request) {
|
|
3176
|
+
const pathParams = {
|
|
3177
|
+
id: request?.id
|
|
3178
|
+
};
|
|
3179
|
+
const body = {
|
|
3180
|
+
description: request?.description,
|
|
3181
|
+
name: request?.name,
|
|
3182
|
+
team_id: request?.team_id
|
|
3183
|
+
};
|
|
3184
|
+
const response = await this.apiClient.sendRequest(
|
|
3185
|
+
"PUT",
|
|
3186
|
+
"/api/v2/usergroups/{id}",
|
|
3187
|
+
pathParams,
|
|
3188
|
+
void 0,
|
|
3189
|
+
body,
|
|
3190
|
+
"application/json"
|
|
3191
|
+
);
|
|
3192
|
+
decoders.UpdateUserGroupResponse?.(response.body);
|
|
3193
|
+
return { ...response.body, metadata: response.metadata };
|
|
3194
|
+
}
|
|
3195
|
+
async removeUserGroupMembers(request) {
|
|
3196
|
+
const pathParams = {
|
|
3197
|
+
id: request?.id
|
|
3198
|
+
};
|
|
3199
|
+
const response = await this.apiClient.sendRequest("DELETE", "/api/v2/usergroups/{id}/members", pathParams, void 0);
|
|
3200
|
+
decoders.RemoveUserGroupMembersResponse?.(response.body);
|
|
3201
|
+
return { ...response.body, metadata: response.metadata };
|
|
3202
|
+
}
|
|
3203
|
+
async addUserGroupMembers(request) {
|
|
3204
|
+
const pathParams = {
|
|
3205
|
+
id: request?.id
|
|
3206
|
+
};
|
|
3207
|
+
const body = {
|
|
3208
|
+
member_ids: request?.member_ids,
|
|
3209
|
+
team_id: request?.team_id
|
|
3210
|
+
};
|
|
3211
|
+
const response = await this.apiClient.sendRequest(
|
|
3212
|
+
"POST",
|
|
3213
|
+
"/api/v2/usergroups/{id}/members",
|
|
3214
|
+
pathParams,
|
|
3215
|
+
void 0,
|
|
3216
|
+
body,
|
|
3217
|
+
"application/json"
|
|
3218
|
+
);
|
|
3219
|
+
decoders.AddUserGroupMembersResponse?.(response.body);
|
|
3220
|
+
return { ...response.body, metadata: response.metadata };
|
|
3221
|
+
}
|
|
3175
3222
|
async queryUsers(request) {
|
|
3176
3223
|
const queryParams = {
|
|
3177
3224
|
payload: request?.payload
|
|
@@ -4057,7 +4104,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
|
|
|
4057
4104
|
};
|
|
4058
4105
|
return result;
|
|
4059
4106
|
};
|
|
4060
|
-
const version = "0.3.
|
|
4107
|
+
const version = "0.3.50";
|
|
4061
4108
|
const axios = axiosImport.default ?? axiosImport;
|
|
4062
4109
|
class ApiClient {
|
|
4063
4110
|
constructor(apiKey, tokenManager, connectionIdManager, options) {
|
|
@@ -4260,6 +4307,7 @@ const eventDecoderMapping = {
|
|
|
4260
4307
|
"feeds.feed.updated": (data) => decoders.FeedUpdatedEvent(data),
|
|
4261
4308
|
"feeds.feed_group.changed": (data) => decoders.FeedGroupChangedEvent(data),
|
|
4262
4309
|
"feeds.feed_group.deleted": (data) => decoders.FeedGroupDeletedEvent(data),
|
|
4310
|
+
"feeds.feed_group.restored": (data) => decoders.FeedGroupRestoredEvent(data),
|
|
4263
4311
|
"feeds.feed_member.added": (data) => decoders.FeedMemberAddedEvent(data),
|
|
4264
4312
|
"feeds.feed_member.removed": (data) => decoders.FeedMemberRemovedEvent(data),
|
|
4265
4313
|
"feeds.feed_member.updated": (data) => decoders.FeedMemberUpdatedEvent(data),
|
|
@@ -4280,8 +4328,8 @@ const eventDecoderMapping = {
|
|
|
4280
4328
|
"moderation.mark_reviewed": (data) => decoders.ModerationMarkReviewedEvent(data),
|
|
4281
4329
|
"user.banned": (data) => decoders.UserBannedEvent(data),
|
|
4282
4330
|
"user.deactivated": (data) => decoders.UserDeactivatedEvent(data),
|
|
4283
|
-
"user.muted": (data) => decoders.UserMutedEvent(data),
|
|
4284
4331
|
"user.reactivated": (data) => decoders.UserReactivatedEvent(data),
|
|
4332
|
+
"user.unbanned": (data) => decoders.UserUnbannedEvent(data),
|
|
4285
4333
|
"user.updated": (data) => decoders.UserUpdatedEvent(data)
|
|
4286
4334
|
};
|
|
4287
4335
|
const decodeWSEvent = (data) => {
|
|
@@ -4507,6 +4555,7 @@ class ModerationApi {
|
|
|
4507
4555
|
delete_message: request?.delete_message,
|
|
4508
4556
|
delete_reaction: request?.delete_reaction,
|
|
4509
4557
|
delete_user: request?.delete_user,
|
|
4558
|
+
flag: request?.flag,
|
|
4510
4559
|
mark_reviewed: request?.mark_reviewed,
|
|
4511
4560
|
reject_appeal: request?.reject_appeal,
|
|
4512
4561
|
restore: request?.restore,
|
|
@@ -4528,8 +4577,6 @@ class ModerationApi {
|
|
|
4528
4577
|
}
|
|
4529
4578
|
class ModerationClient extends ModerationApi {
|
|
4530
4579
|
}
|
|
4531
|
-
const isPollUpdatedEvent = (e) => e.type === "feeds.poll.updated";
|
|
4532
|
-
const isPollClosedEventEvent = (e) => e.type === "feeds.poll.closed";
|
|
4533
4580
|
const isVoteAnswer = (vote) => !!vote?.answer_text;
|
|
4534
4581
|
class StreamPoll {
|
|
4535
4582
|
constructor({ client, poll }) {
|
|
@@ -4561,7 +4608,10 @@ class StreamPoll {
|
|
|
4561
4608
|
};
|
|
4562
4609
|
this.handlePollUpdated = (event) => {
|
|
4563
4610
|
if (event.poll?.id && event.poll.id !== this.id) return;
|
|
4564
|
-
|
|
4611
|
+
const currentState = this.data;
|
|
4612
|
+
if (currentState.updated_at && event.poll.updated_at && event.poll.updated_at <= currentState.updated_at) {
|
|
4613
|
+
return;
|
|
4614
|
+
}
|
|
4565
4615
|
const { id, ...pollData } = event.poll;
|
|
4566
4616
|
this.state.partialNext({
|
|
4567
4617
|
...pollData,
|
|
@@ -4570,7 +4620,8 @@ class StreamPoll {
|
|
|
4570
4620
|
};
|
|
4571
4621
|
this.handlePollClosed = (event) => {
|
|
4572
4622
|
if (event.poll?.id && event.poll.id !== this.id) return;
|
|
4573
|
-
|
|
4623
|
+
const currentState = this.data;
|
|
4624
|
+
if (currentState.is_closed) return;
|
|
4574
4625
|
this.state.partialNext({
|
|
4575
4626
|
is_closed: true,
|
|
4576
4627
|
last_activity_at: new Date(event.created_at)
|
|
@@ -4891,7 +4942,7 @@ const replaceUniqueArrayMerge = (existingArray, arrayToMerge, getKey) => {
|
|
|
4891
4942
|
return result;
|
|
4892
4943
|
};
|
|
4893
4944
|
const Constants = {
|
|
4894
|
-
DEFAULT_COMMENT_PAGINATION: "
|
|
4945
|
+
DEFAULT_COMMENT_PAGINATION: "last"
|
|
4895
4946
|
};
|
|
4896
4947
|
const isFollowResponse = (data) => {
|
|
4897
4948
|
return "source_feed" in data && "target_feed" in data;
|
|
@@ -5182,8 +5233,21 @@ function handleCommentAdded(payload, fromWs) {
|
|
|
5182
5233
|
return currentState;
|
|
5183
5234
|
}
|
|
5184
5235
|
const newComments = entityState?.comments ? [...entityState.comments] : [];
|
|
5185
|
-
|
|
5236
|
+
const sort = entityState.pagination?.sort;
|
|
5237
|
+
const hasMorePages = entityState.pagination?.next !== void 0;
|
|
5238
|
+
const isFromCurrentUser = eventTriggeredByConnectedUser.call(this, payload);
|
|
5239
|
+
if (sort === "last") {
|
|
5186
5240
|
newComments.unshift(comment);
|
|
5241
|
+
} else if (sort === "first") {
|
|
5242
|
+
if (isFromCurrentUser) {
|
|
5243
|
+
newComments.push(comment);
|
|
5244
|
+
} else {
|
|
5245
|
+
if (!hasMorePages) {
|
|
5246
|
+
newComments.push(comment);
|
|
5247
|
+
} else {
|
|
5248
|
+
return currentState;
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5187
5251
|
} else {
|
|
5188
5252
|
newComments.push(comment);
|
|
5189
5253
|
}
|
|
@@ -6579,6 +6643,7 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6579
6643
|
"feeds.feed.updated": handleFeedUpdated.bind(this),
|
|
6580
6644
|
"feeds.feed_group.changed": _Feed.noop,
|
|
6581
6645
|
"feeds.feed_group.deleted": _Feed.noop,
|
|
6646
|
+
"feeds.feed_group.restored": _Feed.noop,
|
|
6582
6647
|
"feeds.follow.created": handleFollowCreated.bind(this),
|
|
6583
6648
|
"feeds.follow.deleted": handleFollowDeleted.bind(this),
|
|
6584
6649
|
"feeds.follow.updated": handleFollowUpdated.bind(this),
|
|
@@ -6607,11 +6672,11 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6607
6672
|
"app.updated": _Feed.noop,
|
|
6608
6673
|
"user.banned": _Feed.noop,
|
|
6609
6674
|
"user.deactivated": _Feed.noop,
|
|
6610
|
-
"user.muted": _Feed.noop,
|
|
6611
6675
|
"user.reactivated": _Feed.noop,
|
|
6612
6676
|
"user.updated": _Feed.noop,
|
|
6613
6677
|
"feeds.activity.feedback": handleActivityFeedback.bind(this),
|
|
6614
|
-
"feeds.activity.restored": _Feed.noop
|
|
6678
|
+
"feeds.activity.restored": _Feed.noop,
|
|
6679
|
+
"user.unbanned": _Feed.noop
|
|
6615
6680
|
};
|
|
6616
6681
|
this.eventDispatcher = new EventDispatcher();
|
|
6617
6682
|
this.on = this.eventDispatcher.on;
|
|
@@ -6661,7 +6726,9 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6661
6726
|
const { last_get_or_create_request_config } = this.state.getLatestValue();
|
|
6662
6727
|
if (last_get_or_create_request_config?.watch) {
|
|
6663
6728
|
this.inProgressGetOrCreate = void 0;
|
|
6664
|
-
await withRetry(
|
|
6729
|
+
await withRetry(
|
|
6730
|
+
() => this.getOrCreate(last_get_or_create_request_config)
|
|
6731
|
+
);
|
|
6665
6732
|
}
|
|
6666
6733
|
}
|
|
6667
6734
|
async getOrCreate(request) {
|
|
@@ -6803,6 +6870,16 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6803
6870
|
({ replies: _r, meta: _m, ...restOfTheCommentResponse }) => restOfTheCommentResponse
|
|
6804
6871
|
);
|
|
6805
6872
|
const existingComments = newCommentsByEntityId[entityId]?.comments;
|
|
6873
|
+
let comments = existingComments ? uniqueArrayMerge(
|
|
6874
|
+
existingComments,
|
|
6875
|
+
newComments,
|
|
6876
|
+
(comment) => comment.id
|
|
6877
|
+
) : newComments;
|
|
6878
|
+
if (data.sort === "first" && existingComments && existingComments.length > 0) {
|
|
6879
|
+
comments = [...comments].sort(
|
|
6880
|
+
(a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
|
|
6881
|
+
);
|
|
6882
|
+
}
|
|
6806
6883
|
newCommentsByEntityId[entityId] = {
|
|
6807
6884
|
...newCommentsByEntityId[entityId],
|
|
6808
6885
|
entity_parent_id: item.entityParentId,
|
|
@@ -6811,11 +6888,7 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6811
6888
|
next: item.next,
|
|
6812
6889
|
sort: data.sort
|
|
6813
6890
|
},
|
|
6814
|
-
comments
|
|
6815
|
-
existingComments,
|
|
6816
|
-
newComments,
|
|
6817
|
-
(comment) => comment.id
|
|
6818
|
-
) : newComments
|
|
6891
|
+
comments
|
|
6819
6892
|
};
|
|
6820
6893
|
}
|
|
6821
6894
|
return {
|
|
@@ -7573,13 +7646,34 @@ class FeedsClient extends FeedsApi {
|
|
|
7573
7646
|
this.devToken = (userId) => {
|
|
7574
7647
|
return streamDevToken(userId);
|
|
7575
7648
|
};
|
|
7649
|
+
this.updatePoll = async (request) => {
|
|
7650
|
+
const poll = this.pollFromState(request.id);
|
|
7651
|
+
const response = await super.updatePoll(request);
|
|
7652
|
+
if (response.poll && poll) {
|
|
7653
|
+
poll.handlePollUpdated({ poll: response.poll, created_at: /* @__PURE__ */ new Date() });
|
|
7654
|
+
}
|
|
7655
|
+
return response;
|
|
7656
|
+
};
|
|
7657
|
+
this.updatePollPartial = async (request) => {
|
|
7658
|
+
const poll = this.pollFromState(request.poll_id);
|
|
7659
|
+
const response = await super.updatePollPartial(request);
|
|
7660
|
+
if (response.poll && poll) {
|
|
7661
|
+
poll.handlePollUpdated({ poll: response.poll, created_at: /* @__PURE__ */ new Date() });
|
|
7662
|
+
}
|
|
7663
|
+
return response;
|
|
7664
|
+
};
|
|
7576
7665
|
this.closePoll = async (request) => {
|
|
7577
|
-
|
|
7666
|
+
const poll = this.pollFromState(request.poll_id);
|
|
7667
|
+
const response = await super.updatePollPartial({
|
|
7578
7668
|
poll_id: request.poll_id,
|
|
7579
7669
|
set: {
|
|
7580
7670
|
is_closed: true
|
|
7581
7671
|
}
|
|
7582
7672
|
});
|
|
7673
|
+
if (response.poll && poll) {
|
|
7674
|
+
poll.handlePollClosed({ poll: response.poll, created_at: /* @__PURE__ */ new Date() });
|
|
7675
|
+
}
|
|
7676
|
+
return response;
|
|
7583
7677
|
};
|
|
7584
7678
|
this.castPollVote = async (request) => {
|
|
7585
7679
|
const poll = this.pollFromState(request.poll_id);
|
|
@@ -8186,4 +8280,4 @@ exports.replaceUniqueArrayMerge = replaceUniqueArrayMerge;
|
|
|
8186
8280
|
exports.shouldUpdateState = shouldUpdateState;
|
|
8187
8281
|
exports.uniqueArrayMerge = uniqueArrayMerge;
|
|
8188
8282
|
exports.updateEntityInArray = updateEntityInArray;
|
|
8189
|
-
//# sourceMappingURL=feeds-client-
|
|
8283
|
+
//# sourceMappingURL=feeds-client-CKxvuiKz.js.map
|