@stream-io/feeds-client 0.3.2 → 0.3.3
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 +12 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react-bindings.js +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/react-bindings.mjs +1 -1
- package/dist/{feeds-client-ZdWyhS1v.mjs → feeds-client-BWaXWhhB.mjs} +24 -12
- package/dist/{feeds-client-ZdWyhS1v.mjs.map → feeds-client-BWaXWhhB.mjs.map} +1 -1
- package/dist/{feeds-client-jZwPzici.js → feeds-client-Ddac-BnP.js} +24 -12
- package/dist/{feeds-client-jZwPzici.js.map → feeds-client-Ddac-BnP.js.map} +1 -1
- package/dist/types/feed/event-handlers/activity/handle-activity-added.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts +4 -2
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/feeds-client/feeds-client.d.ts +12 -2
- package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/feed/event-handlers/activity/handle-activity-added.ts +5 -0
- package/src/feed/feed.ts +9 -0
- package/src/feeds-client/feeds-client.ts +23 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.3.3](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.2...@stream-io/feeds-client-0.3.3) (2025-10-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* client-side features to support reading feeds with filter ([#155](https://github.com/GetStream/stream-feeds-js/issues/155)) ([8552de1](https://github.com/GetStream/stream-feeds-js/commit/8552de1566560b436b1e62189f0497f8d14fe57f))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* check pinned activities as well when updating from user events ([#153](https://github.com/GetStream/stream-feeds-js/issues/153)) ([d895b94](https://github.com/GetStream/stream-feeds-js/commit/d895b94544eaf58d94467e02f12fce0c5f2f620e))
|
|
16
|
+
|
|
5
17
|
## [0.3.2](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.1...@stream-io/feeds-client-0.3.2) (2025-10-30)
|
|
6
18
|
|
|
7
19
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const stateStore = require("@stream-io/state-store");
|
|
4
|
-
const feedsClient = require("../feeds-client-
|
|
4
|
+
const feedsClient = require("../feeds-client-Ddac-BnP.js");
|
|
5
5
|
const loggerInternal = require("@stream-io/logger");
|
|
6
6
|
const ChannelOwnCapability = {
|
|
7
7
|
BAN_CHANNEL_MEMBERS: "ban-channel-members",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require$$0 = require("react");
|
|
4
4
|
require("@stream-io/state-store");
|
|
5
|
-
const feedsClient = require("../feeds-client-
|
|
5
|
+
const feedsClient = require("../feeds-client-Ddac-BnP.js");
|
|
6
6
|
require("@stream-io/logger");
|
|
7
7
|
require("axios");
|
|
8
8
|
var shim = { exports: {} };
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StateStore } from "@stream-io/state-store";
|
|
2
2
|
export * from "@stream-io/state-store";
|
|
3
|
-
import { d as debounce } from "../feeds-client-
|
|
4
|
-
import { C, a, F, S, b, c, m, o, n, k, g, e, h, f, j, i, r, s, u, l } from "../feeds-client-
|
|
3
|
+
import { d as debounce } from "../feeds-client-BWaXWhhB.mjs";
|
|
4
|
+
import { C, a, F, S, b, c, m, o, n, k, g, e, h, f, j, i, r, s, u, l } from "../feeds-client-BWaXWhhB.mjs";
|
|
5
5
|
import { LogLevelEnum, restoreDefaults } from "@stream-io/logger";
|
|
6
6
|
const ChannelOwnCapability = {
|
|
7
7
|
BAN_CHANNEL_MEMBERS: "ban-channel-members",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0, { useCallback, useMemo, useState, useEffect, createContext, useContext, useRef } from "react";
|
|
2
2
|
import "@stream-io/state-store";
|
|
3
|
-
import { F as FeedsClient, g as isCommentResponse, c as checkHasAnotherPage } from "../feeds-client-
|
|
3
|
+
import { F as FeedsClient, g as isCommentResponse, c as checkHasAnotherPage } from "../feeds-client-BWaXWhhB.mjs";
|
|
4
4
|
import "@stream-io/logger";
|
|
5
5
|
import "axios";
|
|
6
6
|
var shim = { exports: {} };
|
|
@@ -3764,7 +3764,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
|
|
|
3764
3764
|
};
|
|
3765
3765
|
return result;
|
|
3766
3766
|
};
|
|
3767
|
-
const version = "0.3.
|
|
3767
|
+
const version = "0.3.3";
|
|
3768
3768
|
class ApiClient {
|
|
3769
3769
|
constructor(apiKey, tokenManager, connectionIdManager, options) {
|
|
3770
3770
|
this.apiKey = apiKey;
|
|
@@ -5361,6 +5361,11 @@ function addActivitiesToState(newActivities, activities, position) {
|
|
|
5361
5361
|
return result;
|
|
5362
5362
|
}
|
|
5363
5363
|
function handleActivityAdded(event) {
|
|
5364
|
+
if (this.activityAddedEventFilter) {
|
|
5365
|
+
if (!this.activityAddedEventFilter(event)) {
|
|
5366
|
+
return;
|
|
5367
|
+
}
|
|
5368
|
+
}
|
|
5364
5369
|
const currentActivities = this.currentState.activities;
|
|
5365
5370
|
const result = addActivitiesToState.bind(this)(
|
|
5366
5371
|
[event.activity],
|
|
@@ -6055,8 +6060,9 @@ function handleActivityFeedback(event) {
|
|
|
6055
6060
|
}
|
|
6056
6061
|
}
|
|
6057
6062
|
const _Feed = class _Feed extends FeedApi {
|
|
6058
|
-
constructor(client, groupId, id, data, watch = false, addNewActivitiesTo = "start") {
|
|
6063
|
+
constructor(client, groupId, id, data, watch = false, addNewActivitiesTo = "start", activityAddedEventFilter) {
|
|
6059
6064
|
super(client, groupId, id);
|
|
6065
|
+
this.activityAddedEventFilter = activityAddedEventFilter;
|
|
6060
6066
|
this.indexedActivityIds = /* @__PURE__ */ new Set();
|
|
6061
6067
|
this.stateUpdateQueue = /* @__PURE__ */ new Set();
|
|
6062
6068
|
this.eventHandlers = {
|
|
@@ -6152,6 +6158,11 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6152
6158
|
hasActivity(activityId) {
|
|
6153
6159
|
return this.indexedActivityIds.has(activityId);
|
|
6154
6160
|
}
|
|
6161
|
+
hasPinnedActivity(activityId) {
|
|
6162
|
+
return this.currentState.pinned_activities?.some(
|
|
6163
|
+
(pinnedActivity) => pinnedActivity.activity.id === activityId
|
|
6164
|
+
);
|
|
6165
|
+
}
|
|
6155
6166
|
async synchronize() {
|
|
6156
6167
|
const { last_get_or_create_request_config } = this.state.getLatestValue();
|
|
6157
6168
|
if (last_get_or_create_request_config?.watch) {
|
|
@@ -6583,6 +6594,7 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6583
6594
|
following_pagination: {
|
|
6584
6595
|
limit: 0
|
|
6585
6596
|
},
|
|
6597
|
+
filter: currentState.last_get_or_create_request_config?.filter,
|
|
6586
6598
|
next: currentState.next,
|
|
6587
6599
|
limit: currentState.last_get_or_create_request_config?.limit ?? 20
|
|
6588
6600
|
});
|
|
@@ -6992,7 +7004,8 @@ class FeedsClient extends FeedsApi {
|
|
|
6992
7004
|
id,
|
|
6993
7005
|
void 0,
|
|
6994
7006
|
void 0,
|
|
6995
|
-
options2?.addNewActivitiesTo
|
|
7007
|
+
options2?.addNewActivitiesTo,
|
|
7008
|
+
options2?.activityAddedEventFilter
|
|
6996
7009
|
);
|
|
6997
7010
|
};
|
|
6998
7011
|
this.updateNetworkConnectionStatus = (event) => {
|
|
@@ -7002,7 +7015,7 @@ class FeedsClient extends FeedsApi {
|
|
|
7002
7015
|
};
|
|
7003
7016
|
this.eventDispatcher.dispatch(networkEvent);
|
|
7004
7017
|
};
|
|
7005
|
-
this.getOrCreateActiveFeed = (group, id, data, watch, addNewActivitiesTo) => {
|
|
7018
|
+
this.getOrCreateActiveFeed = (group, id, data, watch, addNewActivitiesTo, activityAddedEventFilter) => {
|
|
7006
7019
|
const fid = `${group}:${id}`;
|
|
7007
7020
|
if (!this.activeFeeds[fid]) {
|
|
7008
7021
|
this.activeFeeds[fid] = new Feed(
|
|
@@ -7011,7 +7024,8 @@ class FeedsClient extends FeedsApi {
|
|
|
7011
7024
|
id,
|
|
7012
7025
|
data,
|
|
7013
7026
|
watch,
|
|
7014
|
-
addNewActivitiesTo
|
|
7027
|
+
addNewActivitiesTo,
|
|
7028
|
+
activityAddedEventFilter
|
|
7015
7029
|
);
|
|
7016
7030
|
}
|
|
7017
7031
|
const feed = this.activeFeeds[fid];
|
|
@@ -7121,13 +7135,13 @@ class FeedsClient extends FeedsApi {
|
|
|
7121
7135
|
case "feeds.bookmark.deleted":
|
|
7122
7136
|
case "feeds.bookmark.updated": {
|
|
7123
7137
|
const activityId = event.bookmark.activity.id;
|
|
7124
|
-
const feeds = this.
|
|
7138
|
+
const feeds = this.findActiveFeedsByActivityId(activityId);
|
|
7125
7139
|
feeds.forEach((f) => f.handleWSEvent(event));
|
|
7126
7140
|
break;
|
|
7127
7141
|
}
|
|
7128
7142
|
case "feeds.activity.feedback": {
|
|
7129
7143
|
const activityId = event.activity_feedback.activity_id;
|
|
7130
|
-
const feeds = this.
|
|
7144
|
+
const feeds = this.findActiveFeedsByActivityId(activityId);
|
|
7131
7145
|
feeds.forEach((f) => f.handleWSEvent(event));
|
|
7132
7146
|
break;
|
|
7133
7147
|
}
|
|
@@ -7265,11 +7279,9 @@ class FeedsClient extends FeedsApi {
|
|
|
7265
7279
|
}
|
|
7266
7280
|
return response;
|
|
7267
7281
|
}
|
|
7268
|
-
|
|
7282
|
+
findActiveFeedsByActivityId(activityId) {
|
|
7269
7283
|
return Object.values(this.activeFeeds).filter(
|
|
7270
|
-
(feed) => feed.
|
|
7271
|
-
(activity) => activity.id === activityId
|
|
7272
|
-
)
|
|
7284
|
+
(feed) => feed.hasActivity(activityId) || feed.hasPinnedActivity(activityId)
|
|
7273
7285
|
);
|
|
7274
7286
|
}
|
|
7275
7287
|
}
|
|
@@ -7296,4 +7308,4 @@ export {
|
|
|
7296
7308
|
shouldUpdateState as s,
|
|
7297
7309
|
uniqueArrayMerge as u
|
|
7298
7310
|
};
|
|
7299
|
-
//# sourceMappingURL=feeds-client-
|
|
7311
|
+
//# sourceMappingURL=feeds-client-BWaXWhhB.mjs.map
|