@stream-io/feeds-client 0.1.2 → 0.1.4
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 +18 -0
- package/dist/index-react-bindings.browser.cjs +33 -5
- package/dist/index-react-bindings.browser.cjs.map +1 -1
- package/dist/index-react-bindings.browser.js +33 -5
- package/dist/index-react-bindings.browser.js.map +1 -1
- package/dist/index-react-bindings.node.cjs +33 -5
- package/dist/index-react-bindings.node.cjs.map +1 -1
- package/dist/index-react-bindings.node.js +33 -5
- package/dist/index-react-bindings.node.js.map +1 -1
- package/dist/index.browser.cjs +33 -5
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +33 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +33 -5
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +33 -5
- package/dist/index.node.js.map +1 -1
- package/dist/src/Feed.d.ts +2 -0
- package/dist/src/FeedsClient.d.ts +1 -0
- package/dist/src/common/ApiClient.d.ts +1 -0
- package/dist/src/gen/models/index.d.ts +92 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Feed.ts +14 -3
- package/src/FeedsClient.ts +13 -0
- package/src/common/ApiClient.ts +10 -3
- package/src/gen/feeds/FeedsApi.ts +5 -0
- package/src/gen/models/index.ts +143 -17
|
@@ -2014,6 +2014,7 @@ class FeedsApi {
|
|
|
2014
2014
|
};
|
|
2015
2015
|
const body = {
|
|
2016
2016
|
type: request?.type,
|
|
2017
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2017
2018
|
custom: request?.custom,
|
|
2018
2019
|
};
|
|
2019
2020
|
const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/activities/{activity_id}/reactions', pathParams, undefined, body, 'application/json');
|
|
@@ -2108,6 +2109,7 @@ class FeedsApi {
|
|
|
2108
2109
|
comment: request?.comment,
|
|
2109
2110
|
object_id: request?.object_id,
|
|
2110
2111
|
object_type: request?.object_type,
|
|
2112
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2111
2113
|
parent_id: request?.parent_id,
|
|
2112
2114
|
attachments: request?.attachments,
|
|
2113
2115
|
mentioned_user_ids: request?.mentioned_user_ids,
|
|
@@ -2171,6 +2173,7 @@ class FeedsApi {
|
|
|
2171
2173
|
};
|
|
2172
2174
|
const body = {
|
|
2173
2175
|
type: request?.type,
|
|
2176
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2174
2177
|
custom: request?.custom,
|
|
2175
2178
|
};
|
|
2176
2179
|
const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/comments/{comment_id}/reactions', pathParams, undefined, body, 'application/json');
|
|
@@ -2396,6 +2399,7 @@ class FeedsApi {
|
|
|
2396
2399
|
const body = {
|
|
2397
2400
|
source: request?.source,
|
|
2398
2401
|
target: request?.target,
|
|
2402
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2399
2403
|
follower_role: request?.follower_role,
|
|
2400
2404
|
push_preference: request?.push_preference,
|
|
2401
2405
|
custom: request?.custom,
|
|
@@ -2408,6 +2412,7 @@ class FeedsApi {
|
|
|
2408
2412
|
const body = {
|
|
2409
2413
|
source: request?.source,
|
|
2410
2414
|
target: request?.target,
|
|
2415
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2411
2416
|
push_preference: request?.push_preference,
|
|
2412
2417
|
custom: request?.custom,
|
|
2413
2418
|
};
|
|
@@ -3651,7 +3656,10 @@ class ApiClient {
|
|
|
3651
3656
|
const encodedBody = requestContentType === 'multipart/form-data' ? new FormData() : body;
|
|
3652
3657
|
if (requestContentType === 'multipart/form-data') {
|
|
3653
3658
|
Object.keys(body).forEach((key) => {
|
|
3654
|
-
|
|
3659
|
+
const value = body[key];
|
|
3660
|
+
if (value != null) {
|
|
3661
|
+
encodedBody.append(key, value);
|
|
3662
|
+
}
|
|
3655
3663
|
});
|
|
3656
3664
|
}
|
|
3657
3665
|
try {
|
|
@@ -3660,8 +3668,11 @@ class ApiClient {
|
|
|
3660
3668
|
method,
|
|
3661
3669
|
headers,
|
|
3662
3670
|
params: queryParams,
|
|
3663
|
-
paramsSerializer: params => this.queryParamsStringify(params),
|
|
3671
|
+
paramsSerializer: (params) => this.queryParamsStringify(params),
|
|
3664
3672
|
data: encodedBody,
|
|
3673
|
+
timeout:
|
|
3674
|
+
// multipart/form-data requests should not have a timeout allowing ample time for file uploads
|
|
3675
|
+
requestContentType === 'multipart/form-data' ? 0 : this.timeout,
|
|
3665
3676
|
});
|
|
3666
3677
|
const metadata = this.getRequestMetadata(client_request_id, response);
|
|
3667
3678
|
return { body: response.data, metadata };
|
|
@@ -3725,9 +3736,9 @@ class ApiClient {
|
|
|
3725
3736
|
};
|
|
3726
3737
|
};
|
|
3727
3738
|
this.baseUrl = options?.base_url ?? 'https://video.stream-io-api.com';
|
|
3739
|
+
this.timeout = options?.timeout ?? 3000;
|
|
3728
3740
|
this.axiosInstance = axios.create({
|
|
3729
3741
|
baseURL: this.baseUrl,
|
|
3730
|
-
timeout: options?.timeout ?? 3000,
|
|
3731
3742
|
});
|
|
3732
3743
|
}
|
|
3733
3744
|
get webSocketBaseUrl() {
|
|
@@ -4447,6 +4458,12 @@ class Feed extends FeedApi {
|
|
|
4447
4458
|
};
|
|
4448
4459
|
});
|
|
4449
4460
|
}
|
|
4461
|
+
async synchronize() {
|
|
4462
|
+
const { last_get_or_create_request_config } = this.state.getLatestValue();
|
|
4463
|
+
if (last_get_or_create_request_config?.watch) {
|
|
4464
|
+
await this.getOrCreate(last_get_or_create_request_config);
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4450
4467
|
async getOrCreate(request) {
|
|
4451
4468
|
if (this.currentState.is_loading_activities) {
|
|
4452
4469
|
throw new Error('Only one getOrCreate call is allowed at a time');
|
|
@@ -4512,6 +4529,7 @@ class Feed extends FeedApi {
|
|
|
4512
4529
|
if (!request?.following_pagination?.limit) {
|
|
4513
4530
|
delete nextState.following;
|
|
4514
4531
|
}
|
|
4532
|
+
nextState.last_get_or_create_request_config = request;
|
|
4515
4533
|
return nextState;
|
|
4516
4534
|
});
|
|
4517
4535
|
}
|
|
@@ -4798,7 +4816,7 @@ class Feed extends FeedApi {
|
|
|
4798
4816
|
}
|
|
4799
4817
|
async getNextPage() {
|
|
4800
4818
|
const currentState = this.currentState;
|
|
4801
|
-
|
|
4819
|
+
return await this.getOrCreate({
|
|
4802
4820
|
member_pagination: {
|
|
4803
4821
|
limit: 0,
|
|
4804
4822
|
},
|
|
@@ -4809,8 +4827,8 @@ class Feed extends FeedApi {
|
|
|
4809
4827
|
limit: 0,
|
|
4810
4828
|
},
|
|
4811
4829
|
next: currentState.next,
|
|
4830
|
+
limit: currentState.last_get_or_create_request_config?.limit ?? 20,
|
|
4812
4831
|
});
|
|
4813
|
-
return response;
|
|
4814
4832
|
}
|
|
4815
4833
|
addActivity(request) {
|
|
4816
4834
|
return this.feedsApi.addActivity({
|
|
@@ -5213,6 +5231,7 @@ class FeedsClient extends FeedsApi {
|
|
|
5213
5231
|
super(apiClient);
|
|
5214
5232
|
this.eventDispatcher = new EventDispatcher();
|
|
5215
5233
|
this.activeFeeds = {};
|
|
5234
|
+
this.healthyConnectionChangedEventCount = 0;
|
|
5216
5235
|
this.pollFromState = (id) => this.polls_by_id.get(id);
|
|
5217
5236
|
this.connectUser = async (user, tokenProvider) => {
|
|
5218
5237
|
if (this.state.getLatestValue().connectedUser !== undefined ||
|
|
@@ -5326,6 +5345,15 @@ class FeedsClient extends FeedsApi {
|
|
|
5326
5345
|
case 'connection.changed': {
|
|
5327
5346
|
const { online } = event;
|
|
5328
5347
|
this.state.partialNext({ isWsConnectionHealthy: online });
|
|
5348
|
+
if (online) {
|
|
5349
|
+
this.healthyConnectionChangedEventCount++;
|
|
5350
|
+
// we skip the first event as we could potentially be querying twice
|
|
5351
|
+
if (this.healthyConnectionChangedEventCount > 1) {
|
|
5352
|
+
for (const activeFeed of Object.values(this.activeFeeds)) {
|
|
5353
|
+
activeFeed.synchronize();
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5329
5357
|
break;
|
|
5330
5358
|
}
|
|
5331
5359
|
case 'feeds.feed.created': {
|