@stream-io/feeds-client 0.3.16 → 0.3.17

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.
@@ -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: "UserResponseCommonFields", isSingle: true }
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: "UserResponseCommonFields", isSingle: true },
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
- user: { type: "UserResponseCommonFields", isSingle: true }
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 ownCapabilitiesBatch(request) {
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/own_capabilities/batch",
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.OwnCapabilitiesBatchResponse?.(response.body);
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.16";
3917
+ const version = "0.3.17";
3908
3918
  class ApiClient {
3909
3919
  constructor(apiKey, tokenManager, connectionIdManager, options) {
3910
3920
  this.apiKey = apiKey;
@@ -7120,7 +7130,7 @@ class FeedsClient extends FeedsApi {
7120
7130
  cancelTimer: cancel
7121
7131
  } = throttle(
7122
7132
  (feeds, callback) => {
7123
- this.ownCapabilitiesBatch({
7133
+ this.ownBatch({
7124
7134
  feeds
7125
7135
  }).catch((error) => {
7126
7136
  this.eventDispatcher.dispatch({
@@ -7162,19 +7172,6 @@ class FeedsClient extends FeedsApi {
7162
7172
  }
7163
7173
  };
7164
7174
  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
7175
  this.connectUser = async (user, tokenProvider) => {
7179
7176
  if (this.state.getLatestValue().connected_user !== void 0 || this.wsConnection) {
7180
7177
  throw new Error(`Can't connect a new user, call "disconnectUser" first`);
@@ -7409,7 +7406,6 @@ class FeedsClient extends FeedsApi {
7409
7406
  };
7410
7407
  this.state = new StateStore({
7411
7408
  connected_user: void 0,
7412
- is_anonymous: false,
7413
7409
  is_ws_connection_healthy: false,
7414
7410
  own_capabilities_by_fid: {}
7415
7411
  });
@@ -7597,12 +7593,12 @@ class FeedsClient extends FeedsApi {
7597
7593
  duration: response.duration
7598
7594
  };
7599
7595
  }
7600
- async ownCapabilitiesBatch(request) {
7601
- const response = await super.ownCapabilitiesBatch(request);
7602
- const feedResponses = Object.entries(response.capabilities).map(
7603
- ([feed, own_capabilities]) => ({
7596
+ async ownBatch(request) {
7597
+ const response = await super.ownBatch(request);
7598
+ const feedResponses = Object.entries(response.data).map(
7599
+ ([feed, ownFields]) => ({
7604
7600
  feed,
7605
- own_capabilities
7601
+ own_capabilities: ownFields.own_capabilities
7606
7602
  })
7607
7603
  );
7608
7604
  this.hydrateCapabilitiesCache(feedResponses);
@@ -7622,29 +7618,32 @@ class FeedsClient extends FeedsApi {
7622
7618
  // For follow API endpoints we update the state after HTTP response to allow queryFeeds with watch: false
7623
7619
  async follow(request) {
7624
7620
  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
- });
7621
+ this.updateStateFromFollows([response.follow]);
7632
7622
  return response;
7633
7623
  }
7624
+ /**
7625
+ * @deprecated Use getOrCreateFollows instead
7626
+ * @param request
7627
+ * @returns
7628
+ */
7634
7629
  async followBatch(request) {
7635
7630
  const response = await super.followBatch(request);
7636
- response.follows.forEach((follow) => {
7637
- const feeds = this.findAllActiveFeedsByFid(follow.source_feed.feed);
7638
- feeds.forEach((f) => handleFollowCreated.bind(f)({ follow }, false));
7639
- });
7631
+ this.updateStateFromFollows(response.follows);
7632
+ return response;
7633
+ }
7634
+ async getOrCreateFollows(request) {
7635
+ const response = await super.getOrCreateFollows(request);
7636
+ this.updateStateFromFollows(response.created);
7640
7637
  return response;
7641
7638
  }
7642
7639
  async unfollow(request) {
7643
7640
  const response = await super.unfollow(request);
7644
- [request.source, request.target].forEach((fid) => {
7645
- const feeds = this.findAllActiveFeedsByFid(fid);
7646
- feeds.forEach((f) => handleFollowDeleted.bind(f)(response, false));
7647
- });
7641
+ this.updateStateFromUnfollows([response.follow]);
7642
+ return response;
7643
+ }
7644
+ async getOrCreateUnfollows(request) {
7645
+ const response = await super.getOrCreateUnfollows(request);
7646
+ this.updateStateFromUnfollows(response.follows);
7648
7647
  return response;
7649
7648
  }
7650
7649
  async stopWatchingFeed(request) {
@@ -7709,6 +7708,24 @@ class FeedsClient extends FeedsApi {
7709
7708
  }).map((a) => getFeed.call(a))
7710
7709
  ];
7711
7710
  }
7711
+ updateStateFromFollows(follows) {
7712
+ follows.forEach((follow) => {
7713
+ const feeds = [
7714
+ ...this.findAllActiveFeedsByFid(follow.source_feed.feed),
7715
+ ...this.findAllActiveFeedsByFid(follow.target_feed.feed)
7716
+ ];
7717
+ feeds.forEach((f) => handleFollowCreated.bind(f)({ follow }, false));
7718
+ });
7719
+ }
7720
+ updateStateFromUnfollows(follows) {
7721
+ follows.forEach((follow) => {
7722
+ const feeds = [
7723
+ ...this.findAllActiveFeedsByFid(follow.source_feed.feed),
7724
+ ...this.findAllActiveFeedsByFid(follow.target_feed.feed)
7725
+ ];
7726
+ feeds.forEach((f) => handleFollowDeleted.bind(f)({ follow }, false));
7727
+ });
7728
+ }
7712
7729
  }
7713
7730
  export {
7714
7731
  ActivityWithStateUpdates as A,
@@ -7733,4 +7750,4 @@ export {
7733
7750
  shouldUpdateState as s,
7734
7751
  uniqueArrayMerge as u
7735
7752
  };
7736
- //# sourceMappingURL=feeds-client-Bh01VLai.mjs.map
7753
+ //# sourceMappingURL=feeds-client-Bq_SWnZW.mjs.map