@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
|
@@ -2016,6 +2016,7 @@ class FeedsApi {
|
|
|
2016
2016
|
};
|
|
2017
2017
|
const body = {
|
|
2018
2018
|
type: request?.type,
|
|
2019
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2019
2020
|
custom: request?.custom,
|
|
2020
2021
|
};
|
|
2021
2022
|
const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/activities/{activity_id}/reactions', pathParams, undefined, body, 'application/json');
|
|
@@ -2110,6 +2111,7 @@ class FeedsApi {
|
|
|
2110
2111
|
comment: request?.comment,
|
|
2111
2112
|
object_id: request?.object_id,
|
|
2112
2113
|
object_type: request?.object_type,
|
|
2114
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2113
2115
|
parent_id: request?.parent_id,
|
|
2114
2116
|
attachments: request?.attachments,
|
|
2115
2117
|
mentioned_user_ids: request?.mentioned_user_ids,
|
|
@@ -2173,6 +2175,7 @@ class FeedsApi {
|
|
|
2173
2175
|
};
|
|
2174
2176
|
const body = {
|
|
2175
2177
|
type: request?.type,
|
|
2178
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2176
2179
|
custom: request?.custom,
|
|
2177
2180
|
};
|
|
2178
2181
|
const response = await this.apiClient.sendRequest('POST', '/api/v2/feeds/comments/{comment_id}/reactions', pathParams, undefined, body, 'application/json');
|
|
@@ -2398,6 +2401,7 @@ class FeedsApi {
|
|
|
2398
2401
|
const body = {
|
|
2399
2402
|
source: request?.source,
|
|
2400
2403
|
target: request?.target,
|
|
2404
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2401
2405
|
follower_role: request?.follower_role,
|
|
2402
2406
|
push_preference: request?.push_preference,
|
|
2403
2407
|
custom: request?.custom,
|
|
@@ -2410,6 +2414,7 @@ class FeedsApi {
|
|
|
2410
2414
|
const body = {
|
|
2411
2415
|
source: request?.source,
|
|
2412
2416
|
target: request?.target,
|
|
2417
|
+
create_notification_activity: request?.create_notification_activity,
|
|
2413
2418
|
push_preference: request?.push_preference,
|
|
2414
2419
|
custom: request?.custom,
|
|
2415
2420
|
};
|
|
@@ -3653,7 +3658,10 @@ class ApiClient {
|
|
|
3653
3658
|
const encodedBody = requestContentType === 'multipart/form-data' ? new FormData() : body;
|
|
3654
3659
|
if (requestContentType === 'multipart/form-data') {
|
|
3655
3660
|
Object.keys(body).forEach((key) => {
|
|
3656
|
-
|
|
3661
|
+
const value = body[key];
|
|
3662
|
+
if (value != null) {
|
|
3663
|
+
encodedBody.append(key, value);
|
|
3664
|
+
}
|
|
3657
3665
|
});
|
|
3658
3666
|
}
|
|
3659
3667
|
try {
|
|
@@ -3662,8 +3670,11 @@ class ApiClient {
|
|
|
3662
3670
|
method,
|
|
3663
3671
|
headers,
|
|
3664
3672
|
params: queryParams,
|
|
3665
|
-
paramsSerializer: params => this.queryParamsStringify(params),
|
|
3673
|
+
paramsSerializer: (params) => this.queryParamsStringify(params),
|
|
3666
3674
|
data: encodedBody,
|
|
3675
|
+
timeout:
|
|
3676
|
+
// multipart/form-data requests should not have a timeout allowing ample time for file uploads
|
|
3677
|
+
requestContentType === 'multipart/form-data' ? 0 : this.timeout,
|
|
3667
3678
|
});
|
|
3668
3679
|
const metadata = this.getRequestMetadata(client_request_id, response);
|
|
3669
3680
|
return { body: response.data, metadata };
|
|
@@ -3727,9 +3738,9 @@ class ApiClient {
|
|
|
3727
3738
|
};
|
|
3728
3739
|
};
|
|
3729
3740
|
this.baseUrl = options?.base_url ?? 'https://video.stream-io-api.com';
|
|
3741
|
+
this.timeout = options?.timeout ?? 3000;
|
|
3730
3742
|
this.axiosInstance = axios.create({
|
|
3731
3743
|
baseURL: this.baseUrl,
|
|
3732
|
-
timeout: options?.timeout ?? 3000,
|
|
3733
3744
|
});
|
|
3734
3745
|
}
|
|
3735
3746
|
get webSocketBaseUrl() {
|
|
@@ -4449,6 +4460,12 @@ class Feed extends FeedApi {
|
|
|
4449
4460
|
};
|
|
4450
4461
|
});
|
|
4451
4462
|
}
|
|
4463
|
+
async synchronize() {
|
|
4464
|
+
const { last_get_or_create_request_config } = this.state.getLatestValue();
|
|
4465
|
+
if (last_get_or_create_request_config?.watch) {
|
|
4466
|
+
await this.getOrCreate(last_get_or_create_request_config);
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4452
4469
|
async getOrCreate(request) {
|
|
4453
4470
|
if (this.currentState.is_loading_activities) {
|
|
4454
4471
|
throw new Error('Only one getOrCreate call is allowed at a time');
|
|
@@ -4514,6 +4531,7 @@ class Feed extends FeedApi {
|
|
|
4514
4531
|
if (!request?.following_pagination?.limit) {
|
|
4515
4532
|
delete nextState.following;
|
|
4516
4533
|
}
|
|
4534
|
+
nextState.last_get_or_create_request_config = request;
|
|
4517
4535
|
return nextState;
|
|
4518
4536
|
});
|
|
4519
4537
|
}
|
|
@@ -4800,7 +4818,7 @@ class Feed extends FeedApi {
|
|
|
4800
4818
|
}
|
|
4801
4819
|
async getNextPage() {
|
|
4802
4820
|
const currentState = this.currentState;
|
|
4803
|
-
|
|
4821
|
+
return await this.getOrCreate({
|
|
4804
4822
|
member_pagination: {
|
|
4805
4823
|
limit: 0,
|
|
4806
4824
|
},
|
|
@@ -4811,8 +4829,8 @@ class Feed extends FeedApi {
|
|
|
4811
4829
|
limit: 0,
|
|
4812
4830
|
},
|
|
4813
4831
|
next: currentState.next,
|
|
4832
|
+
limit: currentState.last_get_or_create_request_config?.limit ?? 20,
|
|
4814
4833
|
});
|
|
4815
|
-
return response;
|
|
4816
4834
|
}
|
|
4817
4835
|
addActivity(request) {
|
|
4818
4836
|
return this.feedsApi.addActivity({
|
|
@@ -5215,6 +5233,7 @@ class FeedsClient extends FeedsApi {
|
|
|
5215
5233
|
super(apiClient);
|
|
5216
5234
|
this.eventDispatcher = new EventDispatcher();
|
|
5217
5235
|
this.activeFeeds = {};
|
|
5236
|
+
this.healthyConnectionChangedEventCount = 0;
|
|
5218
5237
|
this.pollFromState = (id) => this.polls_by_id.get(id);
|
|
5219
5238
|
this.connectUser = async (user, tokenProvider) => {
|
|
5220
5239
|
if (this.state.getLatestValue().connectedUser !== undefined ||
|
|
@@ -5328,6 +5347,15 @@ class FeedsClient extends FeedsApi {
|
|
|
5328
5347
|
case 'connection.changed': {
|
|
5329
5348
|
const { online } = event;
|
|
5330
5349
|
this.state.partialNext({ isWsConnectionHealthy: online });
|
|
5350
|
+
if (online) {
|
|
5351
|
+
this.healthyConnectionChangedEventCount++;
|
|
5352
|
+
// we skip the first event as we could potentially be querying twice
|
|
5353
|
+
if (this.healthyConnectionChangedEventCount > 1) {
|
|
5354
|
+
for (const activeFeed of Object.values(this.activeFeeds)) {
|
|
5355
|
+
activeFeed.synchronize();
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5331
5359
|
break;
|
|
5332
5360
|
}
|
|
5333
5361
|
case 'feeds.feed.created': {
|