@stream-io/feeds-client 0.3.16 → 0.3.18
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/README.md +27 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-bindings.js +5 -11
- package/dist/cjs/react-bindings.js.map +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/react-bindings.mjs +5 -11
- package/dist/es/react-bindings.mjs.map +1 -1
- package/dist/{feeds-client-B6L006tr.js → feeds-client-Be5gS8Xx.js} +154 -139
- package/dist/feeds-client-Be5gS8Xx.js.map +1 -0
- package/dist/{feeds-client-Bh01VLai.mjs → feeds-client-DT_p8LU4.mjs} +154 -139
- package/dist/feeds-client-DT_p8LU4.mjs.map +1 -0
- package/dist/types/bindings/react/hooks/useCreateFeedsClient.d.ts +3 -3
- package/dist/types/bindings/react/hooks/useCreateFeedsClient.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-updated.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity-updater.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/bookmark/handle-bookmark-added.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/bookmark/handle-bookmark-deleted.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/feeds-client/feeds-client.d.ts +16 -8
- package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
- package/dist/types/gen/feeds/FeedsApi.d.ts +6 -4
- package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
- package/dist/types/gen/models/index.d.ts +26 -7
- package/dist/types/gen/models/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bindings/react/hooks/useCreateFeedsClient.ts +12 -23
- package/src/feed/event-handlers/activity/handle-activity-updated.ts +0 -11
- package/src/feed/event-handlers/activity-updater.ts +0 -8
- package/src/feed/event-handlers/bookmark/handle-bookmark-added.ts +2 -10
- package/src/feed/event-handlers/bookmark/handle-bookmark-deleted.ts +2 -10
- package/src/feed/event-handlers/bookmark/handle-bookmark-updated.ts +2 -2
- package/src/feed/feed.ts +28 -0
- package/src/feeds-client/feeds-client.ts +52 -45
- package/src/gen/feeds/FeedsApi.ts +60 -11
- package/src/gen/model-decoders/decoders.ts +26 -78
- package/src/gen/models/index.ts +39 -9
- package/dist/feeds-client-B6L006tr.js.map +0 -1
- package/dist/feeds-client-Bh01VLai.mjs.map +0 -1
|
@@ -49,8 +49,7 @@ decoders.ActivityAddedEvent = (input) => {
|
|
|
49
49
|
const typeMappings = {
|
|
50
50
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
51
51
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
52
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
53
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
52
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
54
53
|
};
|
|
55
54
|
return decode(typeMappings, input);
|
|
56
55
|
};
|
|
@@ -58,24 +57,21 @@ decoders.ActivityDeletedEvent = (input) => {
|
|
|
58
57
|
const typeMappings = {
|
|
59
58
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
60
59
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
61
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
62
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
60
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
63
61
|
};
|
|
64
62
|
return decode(typeMappings, input);
|
|
65
63
|
};
|
|
66
64
|
decoders.ActivityFeedbackEvent = (input) => {
|
|
67
65
|
const typeMappings = {
|
|
68
66
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
69
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
70
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
67
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
71
68
|
};
|
|
72
69
|
return decode(typeMappings, input);
|
|
73
70
|
};
|
|
74
71
|
decoders.ActivityMarkEvent = (input) => {
|
|
75
72
|
const typeMappings = {
|
|
76
73
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
77
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
78
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
74
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
79
75
|
};
|
|
80
76
|
return decode(typeMappings, input);
|
|
81
77
|
};
|
|
@@ -92,8 +88,7 @@ decoders.ActivityPinnedEvent = (input) => {
|
|
|
92
88
|
const typeMappings = {
|
|
93
89
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
94
90
|
pinned_activity: { type: "PinActivityResponse", isSingle: true },
|
|
95
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
96
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
91
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
97
92
|
};
|
|
98
93
|
return decode(typeMappings, input);
|
|
99
94
|
};
|
|
@@ -102,8 +97,7 @@ decoders.ActivityReactionAddedEvent = (input) => {
|
|
|
102
97
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
103
98
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
104
99
|
reaction: { type: "FeedsReactionResponse", isSingle: true },
|
|
105
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
106
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
100
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
107
101
|
};
|
|
108
102
|
return decode(typeMappings, input);
|
|
109
103
|
};
|
|
@@ -112,8 +106,7 @@ decoders.ActivityReactionDeletedEvent = (input) => {
|
|
|
112
106
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
113
107
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
114
108
|
reaction: { type: "FeedsReactionResponse", isSingle: true },
|
|
115
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
116
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
109
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
117
110
|
};
|
|
118
111
|
return decode(typeMappings, input);
|
|
119
112
|
};
|
|
@@ -122,8 +115,7 @@ decoders.ActivityReactionUpdatedEvent = (input) => {
|
|
|
122
115
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
123
116
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
124
117
|
reaction: { type: "FeedsReactionResponse", isSingle: true },
|
|
125
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
126
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
118
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
127
119
|
};
|
|
128
120
|
return decode(typeMappings, input);
|
|
129
121
|
};
|
|
@@ -131,8 +123,7 @@ decoders.ActivityRemovedFromFeedEvent = (input) => {
|
|
|
131
123
|
const typeMappings = {
|
|
132
124
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
133
125
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
134
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
135
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
126
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
136
127
|
};
|
|
137
128
|
return decode(typeMappings, input);
|
|
138
129
|
};
|
|
@@ -161,8 +152,7 @@ decoders.ActivityUnpinnedEvent = (input) => {
|
|
|
161
152
|
const typeMappings = {
|
|
162
153
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
163
154
|
pinned_activity: { type: "PinActivityResponse", isSingle: true },
|
|
164
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
165
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
155
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
166
156
|
};
|
|
167
157
|
return decode(typeMappings, input);
|
|
168
158
|
};
|
|
@@ -170,8 +160,7 @@ decoders.ActivityUpdatedEvent = (input) => {
|
|
|
170
160
|
const typeMappings = {
|
|
171
161
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
172
162
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
173
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
174
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
163
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
175
164
|
};
|
|
176
165
|
return decode(typeMappings, input);
|
|
177
166
|
};
|
|
@@ -263,8 +252,7 @@ decoders.BookmarkAddedEvent = (input) => {
|
|
|
263
252
|
const typeMappings = {
|
|
264
253
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
265
254
|
bookmark: { type: "BookmarkResponse", isSingle: true },
|
|
266
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
267
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
255
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
268
256
|
};
|
|
269
257
|
return decode(typeMappings, input);
|
|
270
258
|
};
|
|
@@ -272,8 +260,7 @@ decoders.BookmarkDeletedEvent = (input) => {
|
|
|
272
260
|
const typeMappings = {
|
|
273
261
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
274
262
|
bookmark: { type: "BookmarkResponse", isSingle: true },
|
|
275
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
276
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
263
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
277
264
|
};
|
|
278
265
|
return decode(typeMappings, input);
|
|
279
266
|
};
|
|
@@ -281,8 +268,7 @@ decoders.BookmarkFolderDeletedEvent = (input) => {
|
|
|
281
268
|
const typeMappings = {
|
|
282
269
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
283
270
|
bookmark_folder: { type: "BookmarkFolderResponse", isSingle: true },
|
|
284
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
285
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
271
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
286
272
|
};
|
|
287
273
|
return decode(typeMappings, input);
|
|
288
274
|
};
|
|
@@ -290,7 +276,7 @@ decoders.BookmarkFolderResponse = (input) => {
|
|
|
290
276
|
const typeMappings = {
|
|
291
277
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
292
278
|
updated_at: { type: "DatetimeType", isSingle: true },
|
|
293
|
-
user: { type: "
|
|
279
|
+
user: { type: "UserResponse", isSingle: true }
|
|
294
280
|
};
|
|
295
281
|
return decode(typeMappings, input);
|
|
296
282
|
};
|
|
@@ -298,8 +284,7 @@ decoders.BookmarkFolderUpdatedEvent = (input) => {
|
|
|
298
284
|
const typeMappings = {
|
|
299
285
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
300
286
|
bookmark_folder: { type: "BookmarkFolderResponse", isSingle: true },
|
|
301
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
302
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
287
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
303
288
|
};
|
|
304
289
|
return decode(typeMappings, input);
|
|
305
290
|
};
|
|
@@ -308,7 +293,7 @@ decoders.BookmarkResponse = (input) => {
|
|
|
308
293
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
309
294
|
updated_at: { type: "DatetimeType", isSingle: true },
|
|
310
295
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
311
|
-
user: { type: "
|
|
296
|
+
user: { type: "UserResponse", isSingle: true },
|
|
312
297
|
folder: { type: "BookmarkFolderResponse", isSingle: true }
|
|
313
298
|
};
|
|
314
299
|
return decode(typeMappings, input);
|
|
@@ -317,8 +302,7 @@ decoders.BookmarkUpdatedEvent = (input) => {
|
|
|
317
302
|
const typeMappings = {
|
|
318
303
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
319
304
|
bookmark: { type: "BookmarkResponse", isSingle: true },
|
|
320
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
321
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
305
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
322
306
|
};
|
|
323
307
|
return decode(typeMappings, input);
|
|
324
308
|
};
|
|
@@ -467,8 +451,7 @@ decoders.CommentAddedEvent = (input) => {
|
|
|
467
451
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
468
452
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
469
453
|
comment: { type: "CommentResponse", isSingle: true },
|
|
470
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
471
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
454
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
472
455
|
};
|
|
473
456
|
return decode(typeMappings, input);
|
|
474
457
|
};
|
|
@@ -476,8 +459,7 @@ decoders.CommentDeletedEvent = (input) => {
|
|
|
476
459
|
const typeMappings = {
|
|
477
460
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
478
461
|
comment: { type: "CommentResponse", isSingle: true },
|
|
479
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
480
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
462
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
481
463
|
};
|
|
482
464
|
return decode(typeMappings, input);
|
|
483
465
|
};
|
|
@@ -487,8 +469,7 @@ decoders.CommentReactionAddedEvent = (input) => {
|
|
|
487
469
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
488
470
|
comment: { type: "CommentResponse", isSingle: true },
|
|
489
471
|
reaction: { type: "FeedsReactionResponse", isSingle: true },
|
|
490
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
491
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
472
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
492
473
|
};
|
|
493
474
|
return decode(typeMappings, input);
|
|
494
475
|
};
|
|
@@ -507,8 +488,7 @@ decoders.CommentReactionUpdatedEvent = (input) => {
|
|
|
507
488
|
activity: { type: "ActivityResponse", isSingle: true },
|
|
508
489
|
comment: { type: "CommentResponse", isSingle: true },
|
|
509
490
|
reaction: { type: "FeedsReactionResponse", isSingle: true },
|
|
510
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
511
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
491
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
512
492
|
};
|
|
513
493
|
return decode(typeMappings, input);
|
|
514
494
|
};
|
|
@@ -529,8 +509,7 @@ decoders.CommentUpdatedEvent = (input) => {
|
|
|
529
509
|
const typeMappings = {
|
|
530
510
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
531
511
|
comment: { type: "CommentResponse", isSingle: true },
|
|
532
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
533
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
512
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
534
513
|
};
|
|
535
514
|
return decode(typeMappings, input);
|
|
536
515
|
};
|
|
@@ -649,7 +628,6 @@ decoders.FeedCreatedEvent = (input) => {
|
|
|
649
628
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
650
629
|
members: { type: "FeedMemberResponse", isSingle: false },
|
|
651
630
|
feed: { type: "FeedResponse", isSingle: true },
|
|
652
|
-
user: { type: "UserResponseCommonFields", isSingle: true },
|
|
653
631
|
received_at: { type: "DatetimeType", isSingle: true }
|
|
654
632
|
};
|
|
655
633
|
return decode(typeMappings, input);
|
|
@@ -657,16 +635,14 @@ decoders.FeedCreatedEvent = (input) => {
|
|
|
657
635
|
decoders.FeedDeletedEvent = (input) => {
|
|
658
636
|
const typeMappings = {
|
|
659
637
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
660
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
661
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
638
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
662
639
|
};
|
|
663
640
|
return decode(typeMappings, input);
|
|
664
641
|
};
|
|
665
642
|
decoders.FeedGroupChangedEvent = (input) => {
|
|
666
643
|
const typeMappings = {
|
|
667
644
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
668
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
669
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
645
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
670
646
|
};
|
|
671
647
|
return decode(typeMappings, input);
|
|
672
648
|
};
|
|
@@ -681,16 +657,14 @@ decoders.FeedMemberAddedEvent = (input) => {
|
|
|
681
657
|
const typeMappings = {
|
|
682
658
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
683
659
|
member: { type: "FeedMemberResponse", isSingle: true },
|
|
684
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
685
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
660
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
686
661
|
};
|
|
687
662
|
return decode(typeMappings, input);
|
|
688
663
|
};
|
|
689
664
|
decoders.FeedMemberRemovedEvent = (input) => {
|
|
690
665
|
const typeMappings = {
|
|
691
666
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
692
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
693
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
667
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
694
668
|
};
|
|
695
669
|
return decode(typeMappings, input);
|
|
696
670
|
};
|
|
@@ -709,8 +683,14 @@ decoders.FeedMemberUpdatedEvent = (input) => {
|
|
|
709
683
|
const typeMappings = {
|
|
710
684
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
711
685
|
member: { type: "FeedMemberResponse", isSingle: true },
|
|
712
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
713
|
-
|
|
686
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
687
|
+
};
|
|
688
|
+
return decode(typeMappings, input);
|
|
689
|
+
};
|
|
690
|
+
decoders.FeedOwnData = (input) => {
|
|
691
|
+
const typeMappings = {
|
|
692
|
+
own_follows: { type: "FollowResponse", isSingle: false },
|
|
693
|
+
own_membership: { type: "FeedMemberResponse", isSingle: true }
|
|
714
694
|
};
|
|
715
695
|
return decode(typeMappings, input);
|
|
716
696
|
};
|
|
@@ -740,8 +720,7 @@ decoders.FeedUpdatedEvent = (input) => {
|
|
|
740
720
|
const typeMappings = {
|
|
741
721
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
742
722
|
feed: { type: "FeedResponse", isSingle: true },
|
|
743
|
-
received_at: { type: "DatetimeType", isSingle: true }
|
|
744
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
723
|
+
received_at: { type: "DatetimeType", isSingle: true }
|
|
745
724
|
};
|
|
746
725
|
return decode(typeMappings, input);
|
|
747
726
|
};
|
|
@@ -755,6 +734,7 @@ decoders.FeedsReactionResponse = (input) => {
|
|
|
755
734
|
};
|
|
756
735
|
decoders.FollowBatchResponse = (input) => {
|
|
757
736
|
const typeMappings = {
|
|
737
|
+
created: { type: "FollowResponse", isSingle: false },
|
|
758
738
|
follows: { type: "FollowResponse", isSingle: false }
|
|
759
739
|
};
|
|
760
740
|
return decode(typeMappings, input);
|
|
@@ -1000,8 +980,7 @@ decoders.NotificationFeedUpdatedEvent = (input) => {
|
|
|
1000
980
|
type: "AggregatedActivityResponse",
|
|
1001
981
|
isSingle: false
|
|
1002
982
|
},
|
|
1003
|
-
notification_status: { type: "NotificationStatusResponse", isSingle: true }
|
|
1004
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
983
|
+
notification_status: { type: "NotificationStatusResponse", isSingle: true }
|
|
1005
984
|
};
|
|
1006
985
|
return decode(typeMappings, input);
|
|
1007
986
|
};
|
|
@@ -1012,6 +991,12 @@ decoders.NotificationStatusResponse = (input) => {
|
|
|
1012
991
|
};
|
|
1013
992
|
return decode(typeMappings, input);
|
|
1014
993
|
};
|
|
994
|
+
decoders.OwnBatchResponse = (input) => {
|
|
995
|
+
const typeMappings = {
|
|
996
|
+
data: { type: "FeedOwnData", isSingle: false }
|
|
997
|
+
};
|
|
998
|
+
return decode(typeMappings, input);
|
|
999
|
+
};
|
|
1015
1000
|
decoders.OwnUser = (input) => {
|
|
1016
1001
|
const typeMappings = {
|
|
1017
1002
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -1343,8 +1328,7 @@ decoders.StoriesFeedUpdatedEvent = (input) => {
|
|
|
1343
1328
|
aggregated_activities: {
|
|
1344
1329
|
type: "AggregatedActivityResponse",
|
|
1345
1330
|
isSingle: false
|
|
1346
|
-
}
|
|
1347
|
-
user: { type: "UserResponseCommonFields", isSingle: true }
|
|
1331
|
+
}
|
|
1348
1332
|
};
|
|
1349
1333
|
return decode(typeMappings, input);
|
|
1350
1334
|
};
|
|
@@ -1368,6 +1352,12 @@ decoders.ThreadedCommentResponse = (input) => {
|
|
|
1368
1352
|
};
|
|
1369
1353
|
return decode(typeMappings, input);
|
|
1370
1354
|
};
|
|
1355
|
+
decoders.UnfollowBatchResponse = (input) => {
|
|
1356
|
+
const typeMappings = {
|
|
1357
|
+
follows: { type: "FollowResponse", isSingle: false }
|
|
1358
|
+
};
|
|
1359
|
+
return decode(typeMappings, input);
|
|
1360
|
+
};
|
|
1371
1361
|
decoders.UnfollowResponse = (input) => {
|
|
1372
1362
|
const typeMappings = {
|
|
1373
1363
|
follow: { type: "FollowResponse", isSingle: true }
|
|
@@ -1540,17 +1530,6 @@ decoders.UserResponse = (input) => {
|
|
|
1540
1530
|
};
|
|
1541
1531
|
return decode(typeMappings, input);
|
|
1542
1532
|
};
|
|
1543
|
-
decoders.UserResponseCommonFields = (input) => {
|
|
1544
|
-
const typeMappings = {
|
|
1545
|
-
created_at: { type: "DatetimeType", isSingle: true },
|
|
1546
|
-
updated_at: { type: "DatetimeType", isSingle: true },
|
|
1547
|
-
deactivated_at: { type: "DatetimeType", isSingle: true },
|
|
1548
|
-
deleted_at: { type: "DatetimeType", isSingle: true },
|
|
1549
|
-
last_active: { type: "DatetimeType", isSingle: true },
|
|
1550
|
-
revoke_tokens_issued_before: { type: "DatetimeType", isSingle: true }
|
|
1551
|
-
};
|
|
1552
|
-
return decode(typeMappings, input);
|
|
1553
|
-
};
|
|
1554
1533
|
decoders.UserUpdatedEvent = (input) => {
|
|
1555
1534
|
const typeMappings = {
|
|
1556
1535
|
created_at: { type: "DatetimeType", isSingle: true },
|
|
@@ -2124,11 +2103,11 @@ class FeedsApi {
|
|
|
2124
2103
|
}
|
|
2125
2104
|
async addComment(request) {
|
|
2126
2105
|
const body = {
|
|
2127
|
-
object_id: request?.object_id,
|
|
2128
|
-
object_type: request?.object_type,
|
|
2129
2106
|
comment: request?.comment,
|
|
2130
2107
|
create_notification_activity: request?.create_notification_activity,
|
|
2131
2108
|
id: request?.id,
|
|
2109
|
+
object_id: request?.object_id,
|
|
2110
|
+
object_type: request?.object_type,
|
|
2132
2111
|
parent_id: request?.parent_id,
|
|
2133
2112
|
skip_enrich_url: request?.skip_enrich_url,
|
|
2134
2113
|
skip_push: request?.skip_push,
|
|
@@ -2550,22 +2529,23 @@ class FeedsApi {
|
|
|
2550
2529
|
decoders.CreateFeedsBatchResponse?.(response.body);
|
|
2551
2530
|
return { ...response.body, metadata: response.metadata };
|
|
2552
2531
|
}
|
|
2553
|
-
async
|
|
2532
|
+
async ownBatch(request) {
|
|
2554
2533
|
const queryParams = {
|
|
2555
2534
|
connection_id: request?.connection_id
|
|
2556
2535
|
};
|
|
2557
2536
|
const body = {
|
|
2558
|
-
feeds: request?.feeds
|
|
2537
|
+
feeds: request?.feeds,
|
|
2538
|
+
fields: request?.fields
|
|
2559
2539
|
};
|
|
2560
2540
|
const response = await this.apiClient.sendRequest(
|
|
2561
2541
|
"POST",
|
|
2562
|
-
"/api/v2/feeds/feeds/
|
|
2542
|
+
"/api/v2/feeds/feeds/own/batch",
|
|
2563
2543
|
void 0,
|
|
2564
2544
|
queryParams,
|
|
2565
2545
|
body,
|
|
2566
2546
|
"application/json"
|
|
2567
2547
|
);
|
|
2568
|
-
decoders.
|
|
2548
|
+
decoders.OwnBatchResponse?.(response.body);
|
|
2569
2549
|
return { ...response.body, metadata: response.metadata };
|
|
2570
2550
|
}
|
|
2571
2551
|
async _queryFeeds(request) {
|
|
@@ -2664,6 +2644,21 @@ class FeedsApi {
|
|
|
2664
2644
|
decoders.FollowBatchResponse?.(response.body);
|
|
2665
2645
|
return { ...response.body, metadata: response.metadata };
|
|
2666
2646
|
}
|
|
2647
|
+
async getOrCreateFollows(request) {
|
|
2648
|
+
const body = {
|
|
2649
|
+
follows: request?.follows
|
|
2650
|
+
};
|
|
2651
|
+
const response = await this.apiClient.sendRequest(
|
|
2652
|
+
"POST",
|
|
2653
|
+
"/api/v2/feeds/follows/batch/upsert",
|
|
2654
|
+
void 0,
|
|
2655
|
+
void 0,
|
|
2656
|
+
body,
|
|
2657
|
+
"application/json"
|
|
2658
|
+
);
|
|
2659
|
+
decoders.FollowBatchResponse?.(response.body);
|
|
2660
|
+
return { ...response.body, metadata: response.metadata };
|
|
2661
|
+
}
|
|
2667
2662
|
async queryFollows(request) {
|
|
2668
2663
|
const body = {
|
|
2669
2664
|
limit: request?.limit,
|
|
@@ -2713,6 +2708,21 @@ class FeedsApi {
|
|
|
2713
2708
|
decoders.UnfollowResponse?.(response.body);
|
|
2714
2709
|
return { ...response.body, metadata: response.metadata };
|
|
2715
2710
|
}
|
|
2711
|
+
async getOrCreateUnfollows(request) {
|
|
2712
|
+
const body = {
|
|
2713
|
+
follows: request?.follows
|
|
2714
|
+
};
|
|
2715
|
+
const response = await this.apiClient.sendRequest(
|
|
2716
|
+
"POST",
|
|
2717
|
+
"/api/v2/feeds/unfollow/batch/upsert",
|
|
2718
|
+
void 0,
|
|
2719
|
+
void 0,
|
|
2720
|
+
body,
|
|
2721
|
+
"application/json"
|
|
2722
|
+
);
|
|
2723
|
+
decoders.UnfollowBatchResponse?.(response.body);
|
|
2724
|
+
return { ...response.body, metadata: response.metadata };
|
|
2725
|
+
}
|
|
2716
2726
|
async createGuest(request) {
|
|
2717
2727
|
const body = {
|
|
2718
2728
|
user: request?.user
|
|
@@ -3904,7 +3914,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
|
|
|
3904
3914
|
};
|
|
3905
3915
|
return result;
|
|
3906
3916
|
};
|
|
3907
|
-
const version = "0.3.
|
|
3917
|
+
const version = "0.3.18";
|
|
3908
3918
|
class ApiClient {
|
|
3909
3919
|
constructor(apiKey, tokenManager, connectionIdManager, options) {
|
|
3910
3920
|
this.apiKey = apiKey;
|
|
@@ -5269,13 +5279,10 @@ const sharedUpdateActivity$6 = ({
|
|
|
5269
5279
|
if (eventBelongsToCurrentUser) {
|
|
5270
5280
|
newOwnBookmarks = [...newOwnBookmarks, event.bookmark];
|
|
5271
5281
|
}
|
|
5272
|
-
if (!event.bookmark.activity.current_feed && event.bookmark.activity.feeds.length === 1 && currentActivity.current_feed) {
|
|
5273
|
-
event.bookmark.activity.current_feed = currentActivity.current_feed;
|
|
5274
|
-
}
|
|
5275
5282
|
return {
|
|
5276
|
-
...
|
|
5277
|
-
|
|
5278
|
-
|
|
5283
|
+
...currentActivity,
|
|
5284
|
+
bookmark_count: event.bookmark.activity.bookmark_count,
|
|
5285
|
+
own_bookmarks: newOwnBookmarks
|
|
5279
5286
|
};
|
|
5280
5287
|
};
|
|
5281
5288
|
const addBookmarkToActivities = (event, activities, eventBelongsToCurrentUser) => updateEntityInArray({
|
|
@@ -5345,13 +5352,10 @@ const sharedUpdateActivity$5 = ({
|
|
|
5345
5352
|
(bookmark) => !isSameBookmark(bookmark, event.bookmark)
|
|
5346
5353
|
);
|
|
5347
5354
|
}
|
|
5348
|
-
if (!event.bookmark.activity.current_feed && event.bookmark.activity.feeds.length === 1 && currentActivity.current_feed) {
|
|
5349
|
-
event.bookmark.activity.current_feed = currentActivity.current_feed;
|
|
5350
|
-
}
|
|
5351
5355
|
return {
|
|
5352
|
-
...
|
|
5353
|
-
|
|
5354
|
-
|
|
5356
|
+
...currentActivity,
|
|
5357
|
+
bookmark_count: event.bookmark.activity.bookmark_count,
|
|
5358
|
+
own_bookmarks: newOwnBookmarks
|
|
5355
5359
|
};
|
|
5356
5360
|
};
|
|
5357
5361
|
const removeBookmarkFromActivities = (event, activities, eventBelongsToCurrentUser) => updateEntityInArray({
|
|
@@ -5423,9 +5427,9 @@ const sharedUpdateActivity$4 = ({
|
|
|
5423
5427
|
}
|
|
5424
5428
|
}
|
|
5425
5429
|
return {
|
|
5426
|
-
...
|
|
5427
|
-
|
|
5428
|
-
|
|
5430
|
+
...currentActivity,
|
|
5431
|
+
bookmark_count: event.bookmark.activity.bookmark_count,
|
|
5432
|
+
own_bookmarks: newOwnBookmarks
|
|
5429
5433
|
};
|
|
5430
5434
|
};
|
|
5431
5435
|
const updateBookmarkInActivities = (event, activities, eventBelongsToCurrentUser) => updateEntityInArray({
|
|
@@ -5583,9 +5587,6 @@ const updateActivity = ({
|
|
|
5583
5587
|
currentActivity,
|
|
5584
5588
|
newActivtiy
|
|
5585
5589
|
}) => {
|
|
5586
|
-
if (!newActivtiy.current_feed && newActivtiy.feeds.length === 1 && currentActivity.current_feed) {
|
|
5587
|
-
newActivtiy.current_feed = currentActivity.current_feed;
|
|
5588
|
-
}
|
|
5589
5590
|
return {
|
|
5590
5591
|
...newActivtiy,
|
|
5591
5592
|
own_reactions: currentActivity.own_reactions,
|
|
@@ -5635,12 +5636,6 @@ function handleActivityUpdated(payload, fromWs) {
|
|
|
5635
5636
|
activities: currentActivities,
|
|
5636
5637
|
pinned_activities: currentPinnedActivities
|
|
5637
5638
|
} = this.currentState;
|
|
5638
|
-
const currentActivity = currentActivities?.find(
|
|
5639
|
-
(a) => a.id === payload.activity.id
|
|
5640
|
-
);
|
|
5641
|
-
if (!payload.activity.current_feed && payload.activity.feeds.length === 1 && currentActivity?.current_feed) {
|
|
5642
|
-
payload.activity.current_feed = currentActivity.current_feed;
|
|
5643
|
-
}
|
|
5644
5639
|
const [result1, result2] = [
|
|
5645
5640
|
this.hasActivity(payload.activity.id) ? updateActivityInState(payload, currentActivities) : void 0,
|
|
5646
5641
|
updatePinnedActivityInState(payload, currentPinnedActivities)
|
|
@@ -6804,6 +6799,19 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6804
6799
|
handleWSEvent(event) {
|
|
6805
6800
|
const eventHandler = this.eventHandlers[event.type];
|
|
6806
6801
|
if (eventHandler !== _Feed.noop) {
|
|
6802
|
+
if ("activity" in event && this.hasActivity(event.activity.id)) {
|
|
6803
|
+
const currentActivity = this.currentState.activities?.find(
|
|
6804
|
+
(a) => a.id === event.activity.id
|
|
6805
|
+
);
|
|
6806
|
+
if (event.activity.feeds.length > 1 && !event.activity.current_feed && currentActivity?.current_feed) {
|
|
6807
|
+
event.activity.current_feed = currentActivity.current_feed;
|
|
6808
|
+
}
|
|
6809
|
+
if (event.activity.feeds.length === 1 && event.activity.current_feed && currentActivity?.current_feed) {
|
|
6810
|
+
event.activity.current_feed.own_capabilities = currentActivity.current_feed.own_capabilities;
|
|
6811
|
+
event.activity.current_feed.own_follows = currentActivity.current_feed.own_follows;
|
|
6812
|
+
event.activity.current_feed.own_membership = currentActivity.current_feed.own_membership;
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6807
6815
|
eventHandler?.(event);
|
|
6808
6816
|
}
|
|
6809
6817
|
if (typeof eventHandler === "undefined") {
|
|
@@ -7120,7 +7128,7 @@ class FeedsClient extends FeedsApi {
|
|
|
7120
7128
|
cancelTimer: cancel
|
|
7121
7129
|
} = throttle(
|
|
7122
7130
|
(feeds, callback) => {
|
|
7123
|
-
this.
|
|
7131
|
+
this.ownBatch({
|
|
7124
7132
|
feeds
|
|
7125
7133
|
}).catch((error) => {
|
|
7126
7134
|
this.eventDispatcher.dispatch({
|
|
@@ -7162,19 +7170,6 @@ class FeedsClient extends FeedsApi {
|
|
|
7162
7170
|
}
|
|
7163
7171
|
};
|
|
7164
7172
|
this.pollFromState = (id) => this.polls_by_id.get(id);
|
|
7165
|
-
this.connectAnonymous = () => {
|
|
7166
|
-
this.connectionIdManager.resolveConnectionidPromise();
|
|
7167
|
-
this.tokenManager.setTokenOrProvider(void 0);
|
|
7168
|
-
this.setGetBatchOwnCapabilitiesThrottlingInterval(
|
|
7169
|
-
this.query_batch_own_capabilties_throttling_interval
|
|
7170
|
-
);
|
|
7171
|
-
this.state.partialNext({
|
|
7172
|
-
connected_user: void 0,
|
|
7173
|
-
is_anonymous: true,
|
|
7174
|
-
is_ws_connection_healthy: false
|
|
7175
|
-
});
|
|
7176
|
-
return Promise.resolve();
|
|
7177
|
-
};
|
|
7178
7173
|
this.connectUser = async (user, tokenProvider) => {
|
|
7179
7174
|
if (this.state.getLatestValue().connected_user !== void 0 || this.wsConnection) {
|
|
7180
7175
|
throw new Error(`Can't connect a new user, call "disconnectUser" first`);
|
|
@@ -7409,7 +7404,6 @@ class FeedsClient extends FeedsApi {
|
|
|
7409
7404
|
};
|
|
7410
7405
|
this.state = new StateStore({
|
|
7411
7406
|
connected_user: void 0,
|
|
7412
|
-
is_anonymous: false,
|
|
7413
7407
|
is_ws_connection_healthy: false,
|
|
7414
7408
|
own_capabilities_by_fid: {}
|
|
7415
7409
|
});
|
|
@@ -7597,12 +7591,12 @@ class FeedsClient extends FeedsApi {
|
|
|
7597
7591
|
duration: response.duration
|
|
7598
7592
|
};
|
|
7599
7593
|
}
|
|
7600
|
-
async
|
|
7601
|
-
const response = await super.
|
|
7602
|
-
const feedResponses = Object.entries(response.
|
|
7603
|
-
([feed,
|
|
7594
|
+
async ownBatch(request) {
|
|
7595
|
+
const response = await super.ownBatch(request);
|
|
7596
|
+
const feedResponses = Object.entries(response.data).map(
|
|
7597
|
+
([feed, ownFields]) => ({
|
|
7604
7598
|
feed,
|
|
7605
|
-
own_capabilities
|
|
7599
|
+
own_capabilities: ownFields.own_capabilities
|
|
7606
7600
|
})
|
|
7607
7601
|
);
|
|
7608
7602
|
this.hydrateCapabilitiesCache(feedResponses);
|
|
@@ -7622,29 +7616,32 @@ class FeedsClient extends FeedsApi {
|
|
|
7622
7616
|
// For follow API endpoints we update the state after HTTP response to allow queryFeeds with watch: false
|
|
7623
7617
|
async follow(request) {
|
|
7624
7618
|
const response = await super.follow(request);
|
|
7625
|
-
[
|
|
7626
|
-
response.follow.source_feed.feed,
|
|
7627
|
-
response.follow.target_feed.feed
|
|
7628
|
-
].forEach((fid) => {
|
|
7629
|
-
const feeds = this.findAllActiveFeedsByFid(fid);
|
|
7630
|
-
feeds.forEach((f) => handleFollowCreated.bind(f)(response, false));
|
|
7631
|
-
});
|
|
7619
|
+
this.updateStateFromFollows([response.follow]);
|
|
7632
7620
|
return response;
|
|
7633
7621
|
}
|
|
7622
|
+
/**
|
|
7623
|
+
* @deprecated Use getOrCreateFollows instead
|
|
7624
|
+
* @param request
|
|
7625
|
+
* @returns
|
|
7626
|
+
*/
|
|
7634
7627
|
async followBatch(request) {
|
|
7635
7628
|
const response = await super.followBatch(request);
|
|
7636
|
-
response.follows
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7629
|
+
this.updateStateFromFollows(response.follows);
|
|
7630
|
+
return response;
|
|
7631
|
+
}
|
|
7632
|
+
async getOrCreateFollows(request) {
|
|
7633
|
+
const response = await super.getOrCreateFollows(request);
|
|
7634
|
+
this.updateStateFromFollows(response.created);
|
|
7640
7635
|
return response;
|
|
7641
7636
|
}
|
|
7642
7637
|
async unfollow(request) {
|
|
7643
7638
|
const response = await super.unfollow(request);
|
|
7644
|
-
[
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7639
|
+
this.updateStateFromUnfollows([response.follow]);
|
|
7640
|
+
return response;
|
|
7641
|
+
}
|
|
7642
|
+
async getOrCreateUnfollows(request) {
|
|
7643
|
+
const response = await super.getOrCreateUnfollows(request);
|
|
7644
|
+
this.updateStateFromUnfollows(response.follows);
|
|
7648
7645
|
return response;
|
|
7649
7646
|
}
|
|
7650
7647
|
async stopWatchingFeed(request) {
|
|
@@ -7709,6 +7706,24 @@ class FeedsClient extends FeedsApi {
|
|
|
7709
7706
|
}).map((a) => getFeed.call(a))
|
|
7710
7707
|
];
|
|
7711
7708
|
}
|
|
7709
|
+
updateStateFromFollows(follows) {
|
|
7710
|
+
follows.forEach((follow) => {
|
|
7711
|
+
const feeds = [
|
|
7712
|
+
...this.findAllActiveFeedsByFid(follow.source_feed.feed),
|
|
7713
|
+
...this.findAllActiveFeedsByFid(follow.target_feed.feed)
|
|
7714
|
+
];
|
|
7715
|
+
feeds.forEach((f) => handleFollowCreated.bind(f)({ follow }, false));
|
|
7716
|
+
});
|
|
7717
|
+
}
|
|
7718
|
+
updateStateFromUnfollows(follows) {
|
|
7719
|
+
follows.forEach((follow) => {
|
|
7720
|
+
const feeds = [
|
|
7721
|
+
...this.findAllActiveFeedsByFid(follow.source_feed.feed),
|
|
7722
|
+
...this.findAllActiveFeedsByFid(follow.target_feed.feed)
|
|
7723
|
+
];
|
|
7724
|
+
feeds.forEach((f) => handleFollowDeleted.bind(f)({ follow }, false));
|
|
7725
|
+
});
|
|
7726
|
+
}
|
|
7712
7727
|
}
|
|
7713
7728
|
export {
|
|
7714
7729
|
ActivityWithStateUpdates as A,
|
|
@@ -7733,4 +7748,4 @@ export {
|
|
|
7733
7748
|
shouldUpdateState as s,
|
|
7734
7749
|
uniqueArrayMerge as u
|
|
7735
7750
|
};
|
|
7736
|
-
//# sourceMappingURL=feeds-client-
|
|
7751
|
+
//# sourceMappingURL=feeds-client-DT_p8LU4.mjs.map
|