@stream-io/feeds-client 0.3.36 → 0.3.38
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 +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-bindings.js +11 -5
- package/dist/cjs/react-bindings.js.map +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/react-bindings.mjs +11 -5
- package/dist/es/react-bindings.mjs.map +1 -1
- package/dist/{feeds-client-BAM-n--9.mjs → feeds-client-B5rMw7wy.mjs} +36 -14
- package/dist/feeds-client-B5rMw7wy.mjs.map +1 -0
- package/dist/{feeds-client-DxM97oeZ.js → feeds-client-eEru7Ibh.js} +36 -14
- package/dist/feeds-client-eEru7Ibh.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types/bindings/react/hooks/useCreateFeedsClient.d.ts +3 -3
- package/dist/types/bindings/react/hooks/useCreateFeedsClient.d.ts.map +1 -1
- package/dist/types/feed/event-handlers/activity-updater.d.ts +1 -0
- package/dist/types/feed/event-handlers/activity-updater.d.ts.map +1 -1
- package/dist/types/feeds-client/feeds-client.d.ts +7 -1
- package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
- package/dist/types/gen/feeds/FeedsApi.d.ts +1 -0
- package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
- package/dist/types/gen/models/index.d.ts +4 -0
- package/dist/types/gen/models/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bindings/react/hooks/useCreateFeedsClient.ts +23 -12
- package/src/feeds-client/feeds-client.ts +43 -15
- package/src/gen/feeds/FeedsApi.ts +3 -0
- package/src/gen/model-decoders/decoders.ts +4 -0
- package/src/gen/models/index.ts +8 -0
- package/dist/feeds-client-BAM-n--9.mjs.map +0 -1
- package/dist/feeds-client-DxM97oeZ.js.map +0 -1
|
@@ -103,6 +103,7 @@ import {
|
|
|
103
103
|
|
|
104
104
|
export type FeedsClientState = {
|
|
105
105
|
connected_user: ConnectedUser | undefined;
|
|
106
|
+
is_anonymous: boolean;
|
|
106
107
|
is_ws_connection_healthy: boolean;
|
|
107
108
|
};
|
|
108
109
|
|
|
@@ -143,10 +144,7 @@ export class FeedsClient extends FeedsApi {
|
|
|
143
144
|
options,
|
|
144
145
|
);
|
|
145
146
|
super(apiClient);
|
|
146
|
-
this.state = new StateStore<FeedsClientState>(
|
|
147
|
-
connected_user: undefined,
|
|
148
|
-
is_ws_connection_healthy: false,
|
|
149
|
-
});
|
|
147
|
+
this.state = new StateStore<FeedsClientState>(this.initialState);
|
|
150
148
|
this.moderation = new ModerationClient(apiClient);
|
|
151
149
|
this.tokenManager = tokenManager;
|
|
152
150
|
this.connectionIdManager = connectionIdManager;
|
|
@@ -365,13 +363,28 @@ export class FeedsClient extends FeedsApi {
|
|
|
365
363
|
}
|
|
366
364
|
}
|
|
367
365
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
)
|
|
373
|
-
|
|
374
|
-
|
|
366
|
+
connectAnonymous = () => {
|
|
367
|
+
this.checkIfUserIsConnected();
|
|
368
|
+
|
|
369
|
+
this.connectionIdManager.resolveConnectionidPromise();
|
|
370
|
+
this.tokenManager.setTokenOrProvider(undefined);
|
|
371
|
+
this.setGetBatchOwnFieldsThrottlingInterval(
|
|
372
|
+
this.query_batch_own_fields_throttling_interval,
|
|
373
|
+
);
|
|
374
|
+
this.state.partialNext({
|
|
375
|
+
connected_user: undefined,
|
|
376
|
+
is_anonymous: true,
|
|
377
|
+
is_ws_connection_healthy: false,
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
return Promise.resolve();
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
connectUser = async (
|
|
384
|
+
user: UserRequest | { id: '!anon' },
|
|
385
|
+
tokenProvider?: TokenOrProvider,
|
|
386
|
+
) => {
|
|
387
|
+
this.checkIfUserIsConnected();
|
|
375
388
|
|
|
376
389
|
this.tokenManager.setTokenOrProvider(tokenProvider);
|
|
377
390
|
|
|
@@ -614,10 +627,7 @@ export class FeedsClient extends FeedsApi {
|
|
|
614
627
|
this.activeActivities = [];
|
|
615
628
|
this.activeFeeds = {};
|
|
616
629
|
|
|
617
|
-
this.state.partialNext(
|
|
618
|
-
connected_user: undefined,
|
|
619
|
-
is_ws_connection_healthy: false,
|
|
620
|
-
});
|
|
630
|
+
this.state.partialNext(this.initialState);
|
|
621
631
|
|
|
622
632
|
this.cancelGetBatchOwnFieldsTimer();
|
|
623
633
|
clearQueuedFeeds();
|
|
@@ -1010,4 +1020,22 @@ export class FeedsClient extends FeedsApi {
|
|
|
1010
1020
|
feeds.forEach((f) => handleFollowDeleted.bind(f)({ follow }, false));
|
|
1011
1021
|
});
|
|
1012
1022
|
}
|
|
1023
|
+
|
|
1024
|
+
private get initialState() {
|
|
1025
|
+
return {
|
|
1026
|
+
connected_user: undefined,
|
|
1027
|
+
is_anonymous: false,
|
|
1028
|
+
is_ws_connection_healthy: false,
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
private checkIfUserIsConnected() {
|
|
1033
|
+
if (
|
|
1034
|
+
this.state.getLatestValue().connected_user !== undefined ||
|
|
1035
|
+
this.wsConnection ||
|
|
1036
|
+
this.state.getLatestValue().is_anonymous
|
|
1037
|
+
) {
|
|
1038
|
+
throw new Error(`Can't connect a new user, call "disconnectUser" first`);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1013
1041
|
}
|
|
@@ -376,6 +376,7 @@ export class FeedsApi {
|
|
|
376
376
|
): Promise<StreamResponse<DeleteActivitiesResponse>> {
|
|
377
377
|
const body = {
|
|
378
378
|
ids: request?.ids,
|
|
379
|
+
delete_notification_activity: request?.delete_notification_activity,
|
|
379
380
|
hard_delete: request?.hard_delete,
|
|
380
381
|
};
|
|
381
382
|
|
|
@@ -678,9 +679,11 @@ export class FeedsApi {
|
|
|
678
679
|
async deleteActivity(request: {
|
|
679
680
|
id: string;
|
|
680
681
|
hard_delete?: boolean;
|
|
682
|
+
delete_notification_activity?: boolean;
|
|
681
683
|
}): Promise<StreamResponse<DeleteActivityResponse>> {
|
|
682
684
|
const queryParams = {
|
|
683
685
|
hard_delete: request?.hard_delete,
|
|
686
|
+
delete_notification_activity: request?.delete_notification_activity,
|
|
684
687
|
};
|
|
685
688
|
const pathParams = {
|
|
686
689
|
id: request?.id,
|
|
@@ -730,6 +730,8 @@ decoders.CommentResponse = (input?: Record<string, any>) => {
|
|
|
730
730
|
|
|
731
731
|
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
732
732
|
|
|
733
|
+
edited_at: { type: 'DatetimeType', isSingle: true },
|
|
734
|
+
|
|
733
735
|
latest_reactions: { type: 'FeedsReactionResponse', isSingle: false },
|
|
734
736
|
|
|
735
737
|
reaction_groups: { type: 'ReactionGroupResponse', isSingle: false },
|
|
@@ -1921,6 +1923,8 @@ decoders.ThreadedCommentResponse = (input?: Record<string, any>) => {
|
|
|
1921
1923
|
|
|
1922
1924
|
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
1923
1925
|
|
|
1926
|
+
edited_at: { type: 'DatetimeType', isSingle: true },
|
|
1927
|
+
|
|
1924
1928
|
latest_reactions: { type: 'FeedsReactionResponse', isSingle: false },
|
|
1925
1929
|
|
|
1926
1930
|
replies: { type: 'ThreadedCommentResponse', isSingle: false },
|
package/src/gen/models/index.ts
CHANGED
|
@@ -471,6 +471,8 @@ export interface ActivityResponse {
|
|
|
471
471
|
|
|
472
472
|
moderation_action?: string;
|
|
473
473
|
|
|
474
|
+
selector_source?: string;
|
|
475
|
+
|
|
474
476
|
text?: string;
|
|
475
477
|
|
|
476
478
|
visibility_tag?: string;
|
|
@@ -1929,6 +1931,8 @@ export interface CommentResponse {
|
|
|
1929
1931
|
|
|
1930
1932
|
deleted_at?: Date;
|
|
1931
1933
|
|
|
1934
|
+
edited_at?: Date;
|
|
1935
|
+
|
|
1932
1936
|
parent_id?: string;
|
|
1933
1937
|
|
|
1934
1938
|
text?: string;
|
|
@@ -2177,6 +2181,8 @@ export interface DecayFunctionConfig {
|
|
|
2177
2181
|
export interface DeleteActivitiesRequest {
|
|
2178
2182
|
ids: string[];
|
|
2179
2183
|
|
|
2184
|
+
delete_notification_activity?: boolean;
|
|
2185
|
+
|
|
2180
2186
|
hard_delete?: boolean;
|
|
2181
2187
|
}
|
|
2182
2188
|
|
|
@@ -5578,6 +5584,8 @@ export interface ThreadedCommentResponse {
|
|
|
5578
5584
|
|
|
5579
5585
|
deleted_at?: Date;
|
|
5580
5586
|
|
|
5587
|
+
edited_at?: Date;
|
|
5588
|
+
|
|
5581
5589
|
parent_id?: string;
|
|
5582
5590
|
|
|
5583
5591
|
text?: string;
|