@stream-io/feeds-client 0.3.3 → 0.3.5
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 +15 -0
- package/dist/cjs/index.js +2 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-bindings.js +1 -2
- package/dist/cjs/react-bindings.js.map +1 -1
- package/dist/es/index.mjs +5 -7
- package/dist/es/react-bindings.mjs +1 -2
- package/dist/es/react-bindings.mjs.map +1 -1
- package/dist/{feeds-client-BWaXWhhB.mjs → feeds-client-0zVMEzPX.mjs} +21 -16
- package/dist/feeds-client-0zVMEzPX.mjs.map +1 -0
- package/dist/{feeds-client-Ddac-BnP.js → feeds-client-DLRsdGJc.js} +20 -15
- package/dist/feeds-client-DLRsdGJc.js.map +1 -0
- package/dist/types/common/ApiClient.d.ts.map +1 -1
- package/dist/types/common/EventDispatcher.d.ts.map +1 -1
- package/dist/types/common/TokenManager.d.ts.map +1 -1
- package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -1
- package/dist/types/feed/feed.d.ts +5 -1
- package/dist/types/feed/feed.d.ts.map +1 -1
- package/dist/types/utils/logger.d.ts +2 -64
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common/ApiClient.ts +2 -2
- package/src/common/EventDispatcher.ts +2 -2
- package/src/common/TokenManager.ts +2 -2
- package/src/common/real-time/StableWSConnection.ts +2 -2
- package/src/feed/feed.ts +10 -2
- package/src/feeds-client/feeds-client.ts +2 -2
- package/src/utils/ensure-exhausted.ts +2 -2
- package/src/utils/logger.ts +3 -4
- package/dist/feeds-client-BWaXWhhB.mjs.map +0 -1
- package/dist/feeds-client-Ddac-BnP.js.map +0 -1
|
@@ -2996,8 +2996,7 @@ class FeedsApi {
|
|
|
2996
2996
|
return { ...response.body, metadata: response.metadata };
|
|
2997
2997
|
}
|
|
2998
2998
|
}
|
|
2999
|
-
const
|
|
3000
|
-
const getLogger = loggerInternal__namespace.getLogger;
|
|
2999
|
+
const feedsLoggerSystem = loggerInternal__namespace.createLoggerSystem();
|
|
3001
3000
|
const sleep = (m) => new Promise((resolve) => setTimeout(resolve, m));
|
|
3002
3001
|
function isFunction(value) {
|
|
3003
3002
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || typeof value === "function" || value instanceof Function);
|
|
@@ -3112,7 +3111,7 @@ const capitalize = (s) => {
|
|
|
3112
3111
|
};
|
|
3113
3112
|
class TokenManager {
|
|
3114
3113
|
constructor() {
|
|
3115
|
-
this.logger = getLogger("token-manager");
|
|
3114
|
+
this.logger = feedsLoggerSystem.getLogger("token-manager");
|
|
3116
3115
|
this.setTokenOrProvider = (tokenOrProvider) => {
|
|
3117
3116
|
if (isFunction(tokenOrProvider)) {
|
|
3118
3117
|
this.tokenProvider = tokenOrProvider;
|
|
@@ -3229,7 +3228,7 @@ class ConnectionIdManager {
|
|
|
3229
3228
|
class EventDispatcher {
|
|
3230
3229
|
constructor() {
|
|
3231
3230
|
this.subscribers = {};
|
|
3232
|
-
this.logger = getLogger("event-dispatcher");
|
|
3231
|
+
this.logger = feedsLoggerSystem.getLogger("event-dispatcher");
|
|
3233
3232
|
this.dispatch = (event) => {
|
|
3234
3233
|
const listeners = [
|
|
3235
3234
|
...this.subscribers[event.type] ?? [],
|
|
@@ -3274,7 +3273,7 @@ class StableWSConnection {
|
|
|
3274
3273
|
this.connectionIdManager = connectionIdManager;
|
|
3275
3274
|
this.decoders = decoders2;
|
|
3276
3275
|
this.dispatcher = new EventDispatcher();
|
|
3277
|
-
this.logger = getLogger("stable-ws-connection");
|
|
3276
|
+
this.logger = feedsLoggerSystem.getLogger("stable-ws-connection");
|
|
3278
3277
|
this.on = this.dispatcher.on;
|
|
3279
3278
|
this.off = this.dispatcher.off;
|
|
3280
3279
|
this.offAll = this.dispatcher.offAll;
|
|
@@ -3782,14 +3781,14 @@ const getRateLimitFromResponseHeader = (response_headers) => {
|
|
|
3782
3781
|
};
|
|
3783
3782
|
return result;
|
|
3784
3783
|
};
|
|
3785
|
-
const version = "0.3.
|
|
3784
|
+
const version = "0.3.5";
|
|
3786
3785
|
class ApiClient {
|
|
3787
3786
|
constructor(apiKey, tokenManager, connectionIdManager, options) {
|
|
3788
3787
|
this.apiKey = apiKey;
|
|
3789
3788
|
this.tokenManager = tokenManager;
|
|
3790
3789
|
this.connectionIdManager = connectionIdManager;
|
|
3791
3790
|
this.extraHeaderInformation = {};
|
|
3792
|
-
this.logger = getLogger("api-client");
|
|
3791
|
+
this.logger = feedsLoggerSystem.getLogger("api-client");
|
|
3793
3792
|
this.sendRequest = async (method, url, pathParams, queryParams, body, requestContentType) => {
|
|
3794
3793
|
queryParams = queryParams ?? {};
|
|
3795
3794
|
queryParams.api_key = this.apiKey;
|
|
@@ -4566,7 +4565,7 @@ const isVideoFile = (file) => {
|
|
|
4566
4565
|
return file.type.startsWith("video/");
|
|
4567
4566
|
};
|
|
4568
4567
|
const ensureExhausted = (x, message) => {
|
|
4569
|
-
getLogger("helpers").warn(message, x);
|
|
4568
|
+
feedsLoggerSystem.getLogger("helpers").warn(message, x);
|
|
4570
4569
|
};
|
|
4571
4570
|
const shouldUpdateState = ({
|
|
4572
4571
|
stateUpdateQueueId,
|
|
@@ -6600,9 +6599,17 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6600
6599
|
});
|
|
6601
6600
|
return response;
|
|
6602
6601
|
}
|
|
6602
|
+
/**
|
|
6603
|
+
* Fetches the next page of activities for the feed.
|
|
6604
|
+
* @returns The response from the API or `undefined` if there is no next page.
|
|
6605
|
+
*/
|
|
6603
6606
|
async getNextPage() {
|
|
6604
6607
|
const currentState = this.currentState;
|
|
6608
|
+
if (!currentState.next) {
|
|
6609
|
+
return;
|
|
6610
|
+
}
|
|
6605
6611
|
return await this.getOrCreate({
|
|
6612
|
+
...currentState.last_get_or_create_request_config,
|
|
6606
6613
|
member_pagination: {
|
|
6607
6614
|
limit: 0
|
|
6608
6615
|
},
|
|
@@ -6612,9 +6619,8 @@ const _Feed = class _Feed extends FeedApi {
|
|
|
6612
6619
|
following_pagination: {
|
|
6613
6620
|
limit: 0
|
|
6614
6621
|
},
|
|
6615
|
-
|
|
6616
|
-
next: currentState.next
|
|
6617
|
-
limit: currentState.last_get_or_create_request_config?.limit ?? 20
|
|
6622
|
+
watch: void 0,
|
|
6623
|
+
next: currentState.next
|
|
6618
6624
|
});
|
|
6619
6625
|
}
|
|
6620
6626
|
async addActivity(request) {
|
|
@@ -7063,7 +7069,7 @@ class FeedsClient extends FeedsApi {
|
|
|
7063
7069
|
this.connectionIdManager = connectionIdManager;
|
|
7064
7070
|
this.polls_by_id = /* @__PURE__ */ new Map();
|
|
7065
7071
|
this.query_batch_own_capabilties_throttling_interval = options?.query_batch_own_capabilties_throttling_interval ?? DEFAULT_BATCH_OWN_CAPABILITIES_THROTTLING_INTERVAL;
|
|
7066
|
-
configureLoggers(options?.configure_loggers_options);
|
|
7072
|
+
feedsLoggerSystem.configureLoggers(options?.configure_loggers_options);
|
|
7067
7073
|
this.on("all", (event) => {
|
|
7068
7074
|
const fid = event.fid;
|
|
7069
7075
|
const feed = typeof fid === "string" ? this.activeFeeds[fid] : void 0;
|
|
@@ -7309,10 +7315,9 @@ exports.FeedsClient = FeedsClient;
|
|
|
7309
7315
|
exports.StreamApiError = StreamApiError;
|
|
7310
7316
|
exports.StreamPoll = StreamPoll;
|
|
7311
7317
|
exports.checkHasAnotherPage = checkHasAnotherPage;
|
|
7312
|
-
exports.configureLoggers = configureLoggers;
|
|
7313
7318
|
exports.debounce = debounce;
|
|
7314
7319
|
exports.ensureExhausted = ensureExhausted;
|
|
7315
|
-
exports.
|
|
7320
|
+
exports.feedsLoggerSystem = feedsLoggerSystem;
|
|
7316
7321
|
exports.getStateUpdateQueueId = getStateUpdateQueueId;
|
|
7317
7322
|
exports.isCommentResponse = isCommentResponse;
|
|
7318
7323
|
exports.isFollowResponse = isFollowResponse;
|
|
@@ -7324,4 +7329,4 @@ exports.replaceUniqueArrayMerge = replaceUniqueArrayMerge;
|
|
|
7324
7329
|
exports.shouldUpdateState = shouldUpdateState;
|
|
7325
7330
|
exports.uniqueArrayMerge = uniqueArrayMerge;
|
|
7326
7331
|
exports.updateEntityInArray = updateEntityInArray;
|
|
7327
|
-
//# sourceMappingURL=feeds-client-
|
|
7332
|
+
//# sourceMappingURL=feeds-client-DLRsdGJc.js.map
|