@stream-io/feeds-client 0.3.33 → 0.3.34
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 +10 -0
- package/README.md +3 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react-bindings.js +2 -4
- package/dist/cjs/react-bindings.js.map +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/react-bindings.mjs +2 -4
- package/dist/es/react-bindings.mjs.map +1 -1
- package/dist/{feeds-client-C-6NrDBy.mjs → feeds-client-C-2_fdH1.mjs} +40 -34
- package/dist/{feeds-client-C-6NrDBy.mjs.map → feeds-client-C-2_fdH1.mjs.map} +1 -1
- package/dist/{feeds-client-CyaHg6lu.js → feeds-client-Xj6kDjVH.js} +40 -34
- package/dist/{feeds-client-CyaHg6lu.js.map → feeds-client-Xj6kDjVH.js.map} +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types/activity-with-state-updates/activity-with-state-updates.d.ts +3 -1
- package/dist/types/activity-with-state-updates/activity-with-state-updates.d.ts.map +1 -1
- package/dist/types/bindings/react/hooks/useCreateFeedsClient.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/feeds-client/active-activity.d.ts +2 -1
- package/dist/types/feeds-client/active-activity.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/package.json +1 -1
- package/src/activity-with-state-updates/activity-with-state-updates.ts +10 -1
- package/src/bindings/react/hooks/useCreateFeedsClient.ts +1 -3
- package/src/feed/feed.ts +7 -5
- package/src/feeds-client/active-activity.ts +8 -4
- package/src/feeds-client/feeds-client.ts +22 -23
|
@@ -3923,7 +3923,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
|
|
|
3923
3923
|
};
|
|
3924
3924
|
return result;
|
|
3925
3925
|
};
|
|
3926
|
-
const version = "0.3.
|
|
3926
|
+
const version = "0.3.34";
|
|
3927
3927
|
const axios = axiosImport.default ?? axiosImport;
|
|
3928
3928
|
class ApiClient {
|
|
3929
3929
|
constructor(apiKey, tokenManager, connectionIdManager, options) {
|
|
@@ -6914,11 +6914,13 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6914
6914
|
const newFeeds = Array.from(feedsToGetOrCreate.values());
|
|
6915
6915
|
const fieldsToUpdate = [];
|
|
6916
6916
|
if (!options.fromWebSocket) {
|
|
6917
|
-
fieldsToUpdate.push(
|
|
6918
|
-
|
|
6919
|
-
"
|
|
6920
|
-
|
|
6921
|
-
)
|
|
6917
|
+
fieldsToUpdate.push("own_membership");
|
|
6918
|
+
if (!enrichmentOptions?.skip_own_capabilities) {
|
|
6919
|
+
fieldsToUpdate.push("own_capabilities");
|
|
6920
|
+
}
|
|
6921
|
+
if (!enrichmentOptions?.skip_own_follows) {
|
|
6922
|
+
fieldsToUpdate.push("own_follows");
|
|
6923
|
+
}
|
|
6922
6924
|
if (enrichmentOptions?.enrich_own_followings) {
|
|
6923
6925
|
fieldsToUpdate.push("own_followings");
|
|
6924
6926
|
}
|
|
@@ -7026,14 +7028,14 @@ function isAnyFeedWatched(fids) {
|
|
|
7026
7028
|
}
|
|
7027
7029
|
return false;
|
|
7028
7030
|
}
|
|
7029
|
-
function disconnectActivityFromFeed(
|
|
7030
|
-
const
|
|
7031
|
-
if (
|
|
7032
|
-
|
|
7031
|
+
function disconnectActivityFromFeed(activity) {
|
|
7032
|
+
const index = this.activeActivities.indexOf(activity);
|
|
7033
|
+
if (index !== -1) {
|
|
7034
|
+
this.activeActivities.splice(index, 1);
|
|
7033
7035
|
}
|
|
7034
7036
|
}
|
|
7035
7037
|
class ActivityWithStateUpdates {
|
|
7036
|
-
constructor(id, feedsClient) {
|
|
7038
|
+
constructor(id, feedsClient, { fromResponse } = { fromResponse: void 0 }) {
|
|
7037
7039
|
this.id = id;
|
|
7038
7040
|
this.feedsClient = feedsClient;
|
|
7039
7041
|
this.state = new StateStore({
|
|
@@ -7041,6 +7043,13 @@ class ActivityWithStateUpdates {
|
|
|
7041
7043
|
comments_by_entity_id: {},
|
|
7042
7044
|
is_loading: false
|
|
7043
7045
|
});
|
|
7046
|
+
if (fromResponse) {
|
|
7047
|
+
this.setFeed({
|
|
7048
|
+
fid: fromResponse.feeds[0],
|
|
7049
|
+
initialState: fromResponse
|
|
7050
|
+
});
|
|
7051
|
+
this.subscribeToFeedState();
|
|
7052
|
+
}
|
|
7044
7053
|
}
|
|
7045
7054
|
get currentState() {
|
|
7046
7055
|
return this.state.getLatestValue();
|
|
@@ -7109,7 +7118,7 @@ class ActivityWithStateUpdates {
|
|
|
7109
7118
|
}
|
|
7110
7119
|
dispose() {
|
|
7111
7120
|
this.unsubscribeFromFeedState?.();
|
|
7112
|
-
disconnectActivityFromFeed.call(this.feedsClient, this
|
|
7121
|
+
disconnectActivityFromFeed.call(this.feedsClient, this);
|
|
7113
7122
|
}
|
|
7114
7123
|
/**
|
|
7115
7124
|
* @internal
|
|
@@ -7206,7 +7215,7 @@ class FeedsClient extends FeedsApi {
|
|
|
7206
7215
|
);
|
|
7207
7216
|
super(apiClient);
|
|
7208
7217
|
this.eventDispatcher = new EventDispatcher();
|
|
7209
|
-
this.activeActivities =
|
|
7218
|
+
this.activeActivities = [];
|
|
7210
7219
|
this.activeFeeds = {};
|
|
7211
7220
|
this.healthyConnectionChangedEventCount = 0;
|
|
7212
7221
|
this.setGetBatchOwnFieldsThrottlingInterval = (throttlingMs) => {
|
|
@@ -7233,16 +7242,15 @@ class FeedsClient extends FeedsApi {
|
|
|
7233
7242
|
this.healthyConnectionChangedEventCount++;
|
|
7234
7243
|
if (this.healthyConnectionChangedEventCount > 1) {
|
|
7235
7244
|
const feedEntries = Object.entries(this.activeFeeds);
|
|
7236
|
-
const activityEntries = Object.entries(this.activeActivities);
|
|
7237
7245
|
const results = await Promise.allSettled([
|
|
7238
7246
|
...feedEntries.map(([, feed]) => feed.synchronize()),
|
|
7239
|
-
...
|
|
7247
|
+
...this.activeActivities.map((activity) => activity.synchronize())
|
|
7240
7248
|
]);
|
|
7241
7249
|
const failures = results.flatMap((result, index) => {
|
|
7242
7250
|
if (result.status === "fulfilled") {
|
|
7243
7251
|
return [];
|
|
7244
7252
|
}
|
|
7245
|
-
const activity =
|
|
7253
|
+
const activity = this.activeActivities[index - feedEntries.length];
|
|
7246
7254
|
const feed = feedEntries[index]?.[0] ?? (activity && getFeed.call(activity)?.feed);
|
|
7247
7255
|
return [{ feed, reason: result.reason, activity_id: activity?.id }];
|
|
7248
7256
|
});
|
|
@@ -7428,7 +7436,7 @@ class FeedsClient extends FeedsApi {
|
|
|
7428
7436
|
this.connectionIdManager.reset();
|
|
7429
7437
|
this.tokenManager.reset();
|
|
7430
7438
|
this.polls_by_id.clear();
|
|
7431
|
-
this.activeActivities =
|
|
7439
|
+
this.activeActivities = [];
|
|
7432
7440
|
this.activeFeeds = {};
|
|
7433
7441
|
this.state.partialNext({
|
|
7434
7442
|
connected_user: void 0,
|
|
@@ -7447,12 +7455,11 @@ class FeedsClient extends FeedsApi {
|
|
|
7447
7455
|
fieldsToUpdate: []
|
|
7448
7456
|
});
|
|
7449
7457
|
};
|
|
7450
|
-
this.activityWithStateUpdates = (id
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
}
|
|
7458
|
+
this.activityWithStateUpdates = (id, { fromResponse } = {
|
|
7459
|
+
fromResponse: void 0
|
|
7460
|
+
}) => {
|
|
7461
|
+
const activity = new ActivityWithStateUpdates(id, this, { fromResponse });
|
|
7462
|
+
this.activeActivities.push(activity);
|
|
7456
7463
|
return activity;
|
|
7457
7464
|
};
|
|
7458
7465
|
this.updateNetworkConnectionStatus = (event) => {
|
|
@@ -7566,12 +7573,9 @@ class FeedsClient extends FeedsApi {
|
|
|
7566
7573
|
feeds.forEach((f) => f.handleWSEvent(event));
|
|
7567
7574
|
if (typeof fid === "string") {
|
|
7568
7575
|
delete this.activeFeeds[fid];
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
delete this.activeActivities[activityId];
|
|
7573
|
-
}
|
|
7574
|
-
});
|
|
7576
|
+
this.activeActivities = this.activeActivities.filter(
|
|
7577
|
+
(activity) => getFeed.call(activity)?.feed !== fid
|
|
7578
|
+
);
|
|
7575
7579
|
}
|
|
7576
7580
|
break;
|
|
7577
7581
|
}
|
|
@@ -7649,7 +7653,9 @@ class FeedsClient extends FeedsApi {
|
|
|
7649
7653
|
default: {
|
|
7650
7654
|
feeds.forEach((f) => f.handleWSEvent(event));
|
|
7651
7655
|
if (event.type === "feeds.activity.deleted") {
|
|
7652
|
-
|
|
7656
|
+
this.activeActivities = this.activeActivities.filter(
|
|
7657
|
+
(activity) => activity.id !== event.activity.id
|
|
7658
|
+
);
|
|
7653
7659
|
}
|
|
7654
7660
|
}
|
|
7655
7661
|
}
|
|
@@ -7777,8 +7783,8 @@ class FeedsClient extends FeedsApi {
|
|
|
7777
7783
|
}
|
|
7778
7784
|
async getFollowSuggestions(...params) {
|
|
7779
7785
|
const response = await super.getFollowSuggestions(...params);
|
|
7780
|
-
response.suggestions.
|
|
7781
|
-
this.getOrCreateActiveFeed({
|
|
7786
|
+
const feeds = response.suggestions.map((suggestion) => {
|
|
7787
|
+
return this.getOrCreateActiveFeed({
|
|
7782
7788
|
group: suggestion.group_id,
|
|
7783
7789
|
id: suggestion.id,
|
|
7784
7790
|
data: suggestion,
|
|
@@ -7790,7 +7796,7 @@ class FeedsClient extends FeedsApi {
|
|
|
7790
7796
|
]
|
|
7791
7797
|
});
|
|
7792
7798
|
});
|
|
7793
|
-
return response;
|
|
7799
|
+
return { ...response, feeds };
|
|
7794
7800
|
}
|
|
7795
7801
|
findAllActiveFeedsByActivityId(activityId) {
|
|
7796
7802
|
return [
|
|
@@ -7873,4 +7879,4 @@ export {
|
|
|
7873
7879
|
shouldUpdateState as s,
|
|
7874
7880
|
uniqueArrayMerge as u
|
|
7875
7881
|
};
|
|
7876
|
-
//# sourceMappingURL=feeds-client-C-
|
|
7882
|
+
//# sourceMappingURL=feeds-client-C-2_fdH1.mjs.map
|