@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
package/dist/index.browser.js
CHANGED
|
@@ -1625,6 +1625,7 @@ class FeedsApi {
|
|
|
1625
1625
|
};
|
|
1626
1626
|
const body = {
|
|
1627
1627
|
type: request?.type,
|
|
1628
|
+
create_notification_activity: request?.create_notification_activity,
|
|
1628
1629
|
custom: request?.custom,
|
|
1629
1630
|
};
|
|
1630
1631
|
const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/activities/{activity_id}/reactions', pathParams, undefined, body, 'application/json');
|
|
@@ -1719,6 +1720,7 @@ class FeedsApi {
|
|
|
1719
1720
|
comment: request?.comment,
|
|
1720
1721
|
object_id: request?.object_id,
|
|
1721
1722
|
object_type: request?.object_type,
|
|
1723
|
+
create_notification_activity: request?.create_notification_activity,
|
|
1722
1724
|
parent_id: request?.parent_id,
|
|
1723
1725
|
attachments: request?.attachments,
|
|
1724
1726
|
mentioned_user_ids: request?.mentioned_user_ids,
|
|
@@ -1782,6 +1784,7 @@ class FeedsApi {
|
|
|
1782
1784
|
};
|
|
1783
1785
|
const body = {
|
|
1784
1786
|
type: request?.type,
|
|
1787
|
+
create_notification_activity: request?.create_notification_activity,
|
|
1785
1788
|
custom: request?.custom,
|
|
1786
1789
|
};
|
|
1787
1790
|
const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/comments/{comment_id}/reactions', pathParams, undefined, body, 'application/json');
|
|
@@ -2007,6 +2010,7 @@ class FeedsApi {
|
|
|
2007
2010
|
const body = {
|
|
2008
2011
|
source: request?.source,
|
|
2009
2012
|
target: request?.target,
|
|
2013
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2010
2014
|
follower_role: request?.follower_role,
|
|
2011
2015
|
push_preference: request?.push_preference,
|
|
2012
2016
|
custom: request?.custom,
|
|
@@ -2019,6 +2023,7 @@ class FeedsApi {
|
|
|
2019
2023
|
const body = {
|
|
2020
2024
|
source: request?.source,
|
|
2021
2025
|
target: request?.target,
|
|
2026
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2022
2027
|
push_preference: request?.push_preference,
|
|
2023
2028
|
custom: request?.custom,
|
|
2024
2029
|
};
|
|
@@ -3543,7 +3548,10 @@ class ApiClient {
|
|
|
3543
3548
|
const encodedBody = requestContentType === 'multipart/form-data' ? new FormData() : body;
|
|
3544
3549
|
if (requestContentType === 'multipart/form-data') {
|
|
3545
3550
|
Object.keys(body).forEach((key) => {
|
|
3546
|
-
|
|
3551
|
+
const value = body[key];
|
|
3552
|
+
if (value != null) {
|
|
3553
|
+
encodedBody.append(key, value);
|
|
3554
|
+
}
|
|
3547
3555
|
});
|
|
3548
3556
|
}
|
|
3549
3557
|
try {
|
|
@@ -3552,8 +3560,11 @@ class ApiClient {
|
|
|
3552
3560
|
method,
|
|
3553
3561
|
headers,
|
|
3554
3562
|
params: queryParams,
|
|
3555
|
-
paramsSerializer: params => this.queryParamsStringify(params),
|
|
3563
|
+
paramsSerializer: (params) => this.queryParamsStringify(params),
|
|
3556
3564
|
data: encodedBody,
|
|
3565
|
+
timeout:
|
|
3566
|
+
// multipart/form-data requests should not have a timeout allowing ample time for file uploads
|
|
3567
|
+
requestContentType === 'multipart/form-data' ? 0 : this.timeout,
|
|
3557
3568
|
});
|
|
3558
3569
|
const metadata = this.getRequestMetadata(client_request_id, response);
|
|
3559
3570
|
return { body: response.data, metadata };
|
|
@@ -3617,9 +3628,9 @@ class ApiClient {
|
|
|
3617
3628
|
};
|
|
3618
3629
|
};
|
|
3619
3630
|
this.baseUrl = options?.base_url ?? 'https://video.stream-io-api.com';
|
|
3631
|
+
this.timeout = options?.timeout ?? 3000;
|
|
3620
3632
|
this.axiosInstance = axios.create({
|
|
3621
3633
|
baseURL: this.baseUrl,
|
|
3622
|
-
timeout: options?.timeout ?? 3000,
|
|
3623
3634
|
});
|
|
3624
3635
|
}
|
|
3625
3636
|
get webSocketBaseUrl() {
|
|
@@ -4339,6 +4350,12 @@ class Feed extends FeedApi {
|
|
|
4339
4350
|
};
|
|
4340
4351
|
});
|
|
4341
4352
|
}
|
|
4353
|
+
async synchronize() {
|
|
4354
|
+
const { last_get_or_create_request_config } = this.state.getLatestValue();
|
|
4355
|
+
if (last_get_or_create_request_config?.watch) {
|
|
4356
|
+
await this.getOrCreate(last_get_or_create_request_config);
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4342
4359
|
async getOrCreate(request) {
|
|
4343
4360
|
if (this.currentState.is_loading_activities) {
|
|
4344
4361
|
throw new Error('Only one getOrCreate call is allowed at a time');
|
|
@@ -4404,6 +4421,7 @@ class Feed extends FeedApi {
|
|
|
4404
4421
|
if (!request?.following_pagination?.limit) {
|
|
4405
4422
|
delete nextState.following;
|
|
4406
4423
|
}
|
|
4424
|
+
nextState.last_get_or_create_request_config = request;
|
|
4407
4425
|
return nextState;
|
|
4408
4426
|
});
|
|
4409
4427
|
}
|
|
@@ -4690,7 +4708,7 @@ class Feed extends FeedApi {
|
|
|
4690
4708
|
}
|
|
4691
4709
|
async getNextPage() {
|
|
4692
4710
|
const currentState = this.currentState;
|
|
4693
|
-
|
|
4711
|
+
return await this.getOrCreate({
|
|
4694
4712
|
member_pagination: {
|
|
4695
4713
|
limit: 0,
|
|
4696
4714
|
},
|
|
@@ -4701,8 +4719,8 @@ class Feed extends FeedApi {
|
|
|
4701
4719
|
limit: 0,
|
|
4702
4720
|
},
|
|
4703
4721
|
next: currentState.next,
|
|
4722
|
+
limit: currentState.last_get_or_create_request_config?.limit ?? 20,
|
|
4704
4723
|
});
|
|
4705
|
-
return response;
|
|
4706
4724
|
}
|
|
4707
4725
|
addActivity(request) {
|
|
4708
4726
|
return this.feedsApi.addActivity({
|
|
@@ -5105,6 +5123,7 @@ class FeedsClient extends FeedsApi {
|
|
|
5105
5123
|
super(apiClient);
|
|
5106
5124
|
this.eventDispatcher = new EventDispatcher();
|
|
5107
5125
|
this.activeFeeds = {};
|
|
5126
|
+
this.healthyConnectionChangedEventCount = 0;
|
|
5108
5127
|
this.pollFromState = (id) => this.polls_by_id.get(id);
|
|
5109
5128
|
this.connectUser = async (user, tokenProvider) => {
|
|
5110
5129
|
if (this.state.getLatestValue().connectedUser !== undefined ||
|
|
@@ -5218,6 +5237,15 @@ class FeedsClient extends FeedsApi {
|
|
|
5218
5237
|
case 'connection.changed': {
|
|
5219
5238
|
const { online } = event;
|
|
5220
5239
|
this.state.partialNext({ isWsConnectionHealthy: online });
|
|
5240
|
+
if (online) {
|
|
5241
|
+
this.healthyConnectionChangedEventCount++;
|
|
5242
|
+
// we skip the first event as we could potentially be querying twice
|
|
5243
|
+
if (this.healthyConnectionChangedEventCount > 1) {
|
|
5244
|
+
for (const activeFeed of Object.values(this.activeFeeds)) {
|
|
5245
|
+
activeFeed.synchronize();
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5221
5249
|
break;
|
|
5222
5250
|
}
|
|
5223
5251
|
case 'feeds.feed.created': {
|