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