@stream-io/feeds-client 0.1.0 → 0.1.2
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/@react-bindings/index.ts +13 -0
- package/CHANGELOG.md +31 -0
- package/dist/@react-bindings/contexts/StreamFeedsContext.d.ts +15 -0
- package/dist/@react-bindings/hooks/clientStateHooks.d.ts +10 -0
- package/dist/@react-bindings/hooks/useCreateFeedsClient.d.ts +13 -0
- package/dist/@react-bindings/hooks/useOwnCapabilities.d.ts +33 -0
- package/dist/@react-bindings/hooks/useStateStore.d.ts +1 -1
- package/dist/@react-bindings/index.d.ts +5 -0
- package/dist/@react-bindings/wrappers/StreamFeeds.d.ts +6 -0
- package/dist/index-react-bindings.browser.cjs +5462 -12
- package/dist/index-react-bindings.browser.cjs.map +1 -1
- package/dist/index-react-bindings.browser.js +5457 -14
- package/dist/index-react-bindings.browser.js.map +1 -1
- package/dist/index-react-bindings.node.cjs +5462 -12
- package/dist/index-react-bindings.node.cjs.map +1 -1
- package/dist/index-react-bindings.node.js +5457 -14
- package/dist/index-react-bindings.node.js.map +1 -1
- package/dist/index.browser.cjs +100 -31
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +100 -31
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +100 -31
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +100 -31
- package/dist/index.node.js.map +1 -1
- package/dist/src/Feed.d.ts +2 -2
- package/dist/src/FeedsClient.d.ts +8 -5
- package/dist/src/common/StateStore.d.ts +1 -0
- package/dist/src/common/real-time/StableWSConnection.d.ts +3 -3
- package/dist/src/gen/feeds/FeedsApi.d.ts +7 -1
- package/dist/src/gen/models/index.d.ts +41 -0
- package/dist/src/types.d.ts +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -6
- package/src/Feed.ts +22 -12
- package/src/FeedsClient.ts +24 -17
- package/src/common/StateStore.ts +30 -12
- package/src/common/utils.ts +1 -1
- package/src/gen/feeds/FeedsApi.ts +51 -0
- package/src/gen/model-decoders/decoders.ts +29 -0
- package/src/gen/model-decoders/event-decoder-mapping.ts +6 -0
- package/src/gen/models/index.ts +60 -0
- package/src/types.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/feeds-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "./dist/index.node.js",
|
|
6
6
|
"exports": {
|
|
@@ -62,17 +62,13 @@
|
|
|
62
62
|
"@rollup/plugin-replace": "^6.0.1",
|
|
63
63
|
"@rollup/plugin-typescript": "^12.1.0",
|
|
64
64
|
"@types/react": "^19.1.8",
|
|
65
|
-
"@vitest/browser": "^2.1.3",
|
|
66
|
-
"@vitest/coverage-v8": "^2.1.2",
|
|
67
65
|
"dotenv": "^16.4.5",
|
|
68
|
-
"playwright": "^1.48.1",
|
|
69
66
|
"react": "19.0.0",
|
|
70
67
|
"rimraf": "^6.0.1",
|
|
71
68
|
"rollup": "^4.24.0",
|
|
72
69
|
"typescript": "^5.8.3",
|
|
73
70
|
"vite": "^5.4.8",
|
|
74
|
-
"vitest": "^2.1
|
|
75
|
-
"vitest-mock-extended": "^2.0.2"
|
|
71
|
+
"vitest": "^3.2.1"
|
|
76
72
|
},
|
|
77
73
|
"peerDependencies": {
|
|
78
74
|
"react": "^18 || ^19"
|
package/src/Feed.ts
CHANGED
|
@@ -207,6 +207,8 @@ export class Feed extends FeedApi {
|
|
|
207
207
|
'feeds.bookmark.added': this.handleBookmarkAdded.bind(this),
|
|
208
208
|
'feeds.bookmark.deleted': this.handleBookmarkDeleted.bind(this),
|
|
209
209
|
'feeds.bookmark.updated': this.handleBookmarkUpdated.bind(this),
|
|
210
|
+
'feeds.bookmark_folder.deleted': Feed.noop,
|
|
211
|
+
'feeds.bookmark_folder.updated': Feed.noop,
|
|
210
212
|
'feeds.comment.added': (event) => {
|
|
211
213
|
const { comment } = event;
|
|
212
214
|
const forId = comment.parent_id ?? comment.object_id;
|
|
@@ -310,16 +312,21 @@ export class Feed extends FeedApi {
|
|
|
310
312
|
|
|
311
313
|
// this feed followed someone
|
|
312
314
|
if (event.follow.source_feed.fid === this.fid) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
+
this.state.next((currentState) => {
|
|
316
|
+
const newState = {
|
|
315
317
|
...currentState,
|
|
316
318
|
...event.follow.source_feed,
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
if (currentState.following_pagination?.next === END_OF_LIST) {
|
|
317
322
|
// TODO: respect sort
|
|
318
|
-
following
|
|
323
|
+
newState.following = currentState.following
|
|
319
324
|
? currentState.following.concat(event.follow)
|
|
320
|
-
: [event.follow]
|
|
321
|
-
}
|
|
322
|
-
|
|
325
|
+
: [event.follow];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return newState;
|
|
329
|
+
});
|
|
323
330
|
} else if (
|
|
324
331
|
// someone followed this feed
|
|
325
332
|
event.follow.target_feed.fid === this.fid
|
|
@@ -331,15 +338,15 @@ export class Feed extends FeedApi {
|
|
|
331
338
|
const newState = { ...currentState, ...event.follow.target_feed };
|
|
332
339
|
|
|
333
340
|
if (source.created_by.id === connectedUser?.id) {
|
|
334
|
-
newState.own_follows =
|
|
335
|
-
?
|
|
341
|
+
newState.own_follows = currentState.own_follows
|
|
342
|
+
? currentState.own_follows.concat(event.follow)
|
|
336
343
|
: [event.follow];
|
|
337
344
|
}
|
|
338
345
|
|
|
339
346
|
if (currentState.followers_pagination?.next === END_OF_LIST) {
|
|
340
347
|
// TODO: respect sort
|
|
341
|
-
newState.followers =
|
|
342
|
-
?
|
|
348
|
+
newState.followers = currentState.followers
|
|
349
|
+
? currentState.followers.concat(event.follow)
|
|
343
350
|
: [event.follow];
|
|
344
351
|
}
|
|
345
352
|
|
|
@@ -371,13 +378,13 @@ export class Feed extends FeedApi {
|
|
|
371
378
|
const newState = { ...currentState, ...event.follow.target_feed };
|
|
372
379
|
|
|
373
380
|
if (source.created_by.id === connectedUser?.id) {
|
|
374
|
-
newState.own_follows =
|
|
381
|
+
newState.own_follows = currentState.own_follows?.filter(
|
|
375
382
|
(follow) =>
|
|
376
383
|
follow.source_feed.fid !== event.follow.source_feed.fid,
|
|
377
384
|
);
|
|
378
385
|
}
|
|
379
386
|
|
|
380
|
-
newState.followers =
|
|
387
|
+
newState.followers = currentState.followers?.filter(
|
|
381
388
|
(follow) => follow.source_feed.fid !== event.follow.source_feed.fid,
|
|
382
389
|
);
|
|
383
390
|
|
|
@@ -516,6 +523,9 @@ export class Feed extends FeedApi {
|
|
|
516
523
|
const newComment: CommentResponse = {
|
|
517
524
|
...newComments[commentIndex],
|
|
518
525
|
...commentCopy,
|
|
526
|
+
// TODO: FIXME this should be handled by the backend
|
|
527
|
+
latest_reactions: commentCopy.latest_reactions ?? [],
|
|
528
|
+
reaction_groups: commentCopy.reaction_groups ?? {},
|
|
519
529
|
};
|
|
520
530
|
|
|
521
531
|
newComments[commentIndex] = newComment;
|
package/src/FeedsClient.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
UserRequest,
|
|
13
13
|
WSEvent,
|
|
14
14
|
} from './gen/models';
|
|
15
|
-
import { FeedsEvent } from './types';
|
|
15
|
+
import { FeedsEvent, TokenOrProvider } from './types';
|
|
16
16
|
import { StateStore } from './common/StateStore';
|
|
17
17
|
import { TokenManager } from './common/TokenManager';
|
|
18
18
|
import { ConnectionIdManager } from './common/ConnectionIdManager';
|
|
@@ -35,6 +35,7 @@ import { StreamPoll } from './common/Poll';
|
|
|
35
35
|
|
|
36
36
|
export type FeedsClientState = {
|
|
37
37
|
connectedUser: OwnUser | undefined;
|
|
38
|
+
isWsConnectionHealthy: boolean;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
type FID = string;
|
|
@@ -67,6 +68,7 @@ export class FeedsClient extends FeedsApi {
|
|
|
67
68
|
super(apiClient);
|
|
68
69
|
this.state = new StateStore<FeedsClientState>({
|
|
69
70
|
connectedUser: undefined,
|
|
71
|
+
isWsConnectionHealthy: false,
|
|
70
72
|
});
|
|
71
73
|
this.moderation = new ModerationClient(apiClient);
|
|
72
74
|
this.tokenManager = tokenManager;
|
|
@@ -79,6 +81,11 @@ export class FeedsClient extends FeedsApi {
|
|
|
79
81
|
typeof fid === 'string' ? this.activeFeeds[fid] : undefined;
|
|
80
82
|
|
|
81
83
|
switch (event.type) {
|
|
84
|
+
case 'connection.changed': {
|
|
85
|
+
const { online } = event;
|
|
86
|
+
this.state.partialNext({ isWsConnectionHealthy: online });
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
82
89
|
case 'feeds.feed.created': {
|
|
83
90
|
if (feed) break;
|
|
84
91
|
|
|
@@ -188,10 +195,7 @@ export class FeedsClient extends FeedsApi {
|
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
197
|
|
|
191
|
-
connectUser = async (
|
|
192
|
-
user: UserRequest,
|
|
193
|
-
tokenProvider: string | (() => Promise<string>),
|
|
194
|
-
) => {
|
|
198
|
+
connectUser = async (user: UserRequest, tokenProvider: TokenOrProvider) => {
|
|
195
199
|
if (
|
|
196
200
|
this.state.getLatestValue().connectedUser !== undefined ||
|
|
197
201
|
this.wsConnection
|
|
@@ -216,7 +220,10 @@ export class FeedsClient extends FeedsApi {
|
|
|
216
220
|
this.eventDispatcher.dispatch(event),
|
|
217
221
|
);
|
|
218
222
|
const connectedEvent = await this.wsConnection.connect();
|
|
219
|
-
this.state.partialNext({
|
|
223
|
+
this.state.partialNext({
|
|
224
|
+
connectedUser: connectedEvent?.me,
|
|
225
|
+
isWsConnectionHealthy: this.wsConnection.isHealthy,
|
|
226
|
+
});
|
|
220
227
|
} catch (err) {
|
|
221
228
|
await this.disconnectUser();
|
|
222
229
|
throw err;
|
|
@@ -291,7 +298,7 @@ export class FeedsClient extends FeedsApi {
|
|
|
291
298
|
|
|
292
299
|
this.connectionIdManager.reset();
|
|
293
300
|
this.tokenManager.reset();
|
|
294
|
-
this.state.partialNext({ connectedUser: undefined });
|
|
301
|
+
this.state.partialNext({ connectedUser: undefined, isWsConnectionHealthy: false });
|
|
295
302
|
};
|
|
296
303
|
|
|
297
304
|
on = this.eventDispatcher.on;
|
|
@@ -317,6 +324,16 @@ export class FeedsClient extends FeedsApi {
|
|
|
317
324
|
};
|
|
318
325
|
}
|
|
319
326
|
|
|
327
|
+
updateNetworkConnectionStatus = (
|
|
328
|
+
event: { type: 'online' | 'offline' } | Event,
|
|
329
|
+
) => {
|
|
330
|
+
const networkEvent: NetworkChangedEvent = {
|
|
331
|
+
type: 'network.changed',
|
|
332
|
+
online: event.type === 'online',
|
|
333
|
+
};
|
|
334
|
+
this.eventDispatcher.dispatch(networkEvent);
|
|
335
|
+
};
|
|
336
|
+
|
|
320
337
|
private readonly getOrCreateActiveFeed = (
|
|
321
338
|
group: string,
|
|
322
339
|
id: string,
|
|
@@ -332,16 +349,6 @@ export class FeedsClient extends FeedsApi {
|
|
|
332
349
|
}
|
|
333
350
|
};
|
|
334
351
|
|
|
335
|
-
private readonly updateNetworkConnectionStatus = (
|
|
336
|
-
event: { type: 'online' | 'offline' } | Event,
|
|
337
|
-
) => {
|
|
338
|
-
const networkEvent: NetworkChangedEvent = {
|
|
339
|
-
type: 'network.changed',
|
|
340
|
-
online: event.type === 'online',
|
|
341
|
-
};
|
|
342
|
-
this.eventDispatcher.dispatch(networkEvent);
|
|
343
|
-
};
|
|
344
|
-
|
|
345
352
|
private findActiveFeedByActivityId(activityId: string) {
|
|
346
353
|
return Object.values(this.activeFeeds).filter((feed) =>
|
|
347
354
|
feed.currentState.activities?.some(
|
package/src/common/StateStore.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type Preprocessor<T> = Handler<T>;
|
|
|
9
9
|
export const isPatch = <T>(value: ValueOrPatch<T>): value is Patch<T> =>
|
|
10
10
|
typeof value === 'function';
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
const noop = () => {};
|
|
14
13
|
|
|
15
14
|
export class StateStore<T extends Record<string, unknown>> {
|
|
@@ -23,7 +22,6 @@ export class StateStore<T extends Record<string, unknown>> {
|
|
|
23
22
|
* @experimental
|
|
24
23
|
* This method is experimental and may change in future versions.
|
|
25
24
|
*/
|
|
26
|
-
|
|
27
25
|
public merge<Q extends StateStore<any>>(
|
|
28
26
|
stateStore: Q extends StateStore<infer L>
|
|
29
27
|
? Extract<keyof T, keyof L> extends never
|
|
@@ -44,7 +42,7 @@ export class StateStore<T extends Record<string, unknown>> {
|
|
|
44
42
|
: newValueOrPatch;
|
|
45
43
|
|
|
46
44
|
// do not notify subscribers if the value hasn't changed
|
|
47
|
-
if (newValue
|
|
45
|
+
if (Object.is(newValue, this.value)) return;
|
|
48
46
|
|
|
49
47
|
this.preprocessors.forEach((preprocessor) =>
|
|
50
48
|
preprocessor(newValue, this.value),
|
|
@@ -71,6 +69,29 @@ export class StateStore<T extends Record<string, unknown>> {
|
|
|
71
69
|
};
|
|
72
70
|
}
|
|
73
71
|
|
|
72
|
+
public static doSelectionsEqual<
|
|
73
|
+
O extends Readonly<Record<string, unknown>> | readonly unknown[],
|
|
74
|
+
>(previouslySelectedValues: O | undefined, newlySelectedValues: O): boolean {
|
|
75
|
+
let selectionsAreEqual: boolean;
|
|
76
|
+
|
|
77
|
+
if (
|
|
78
|
+
(selectionsAreEqual = typeof previouslySelectedValues !== 'undefined')
|
|
79
|
+
) {
|
|
80
|
+
for (const key in newlySelectedValues) {
|
|
81
|
+
if (
|
|
82
|
+
Object.is(previouslySelectedValues[key], newlySelectedValues[key])
|
|
83
|
+
) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
selectionsAreEqual = false;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return selectionsAreEqual;
|
|
93
|
+
}
|
|
94
|
+
|
|
74
95
|
public subscribeWithSelector = <
|
|
75
96
|
O extends Readonly<Record<string, unknown>> | readonly unknown[],
|
|
76
97
|
>(
|
|
@@ -83,16 +104,13 @@ export class StateStore<T extends Record<string, unknown>> {
|
|
|
83
104
|
const wrappedHandler: Handler<T> = (nextValue) => {
|
|
84
105
|
const newlySelectedValues = selector(nextValue);
|
|
85
106
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
hasUpdatedValues = true;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
107
|
+
// shallow comparison of previouslySelectedValues and newlySelectedValues
|
|
108
|
+
const selectionsAreEqual = StateStore.doSelectionsEqual(
|
|
109
|
+
previouslySelectedValues,
|
|
110
|
+
newlySelectedValues,
|
|
111
|
+
);
|
|
94
112
|
|
|
95
|
-
if (
|
|
113
|
+
if (selectionsAreEqual) return;
|
|
96
114
|
|
|
97
115
|
// save a copy of previouslySelectedValues before running
|
|
98
116
|
// handler - if previouslySelectedValues are set to
|
package/src/common/utils.ts
CHANGED
|
@@ -72,7 +72,7 @@ function getRandomValuesWithMathRandom(bytes: Uint8Array): void {
|
|
|
72
72
|
declare const msCrypto: Crypto;
|
|
73
73
|
|
|
74
74
|
const getRandomValues = (() => {
|
|
75
|
-
if (typeof crypto?.getRandomValues !== 'undefined') {
|
|
75
|
+
if (typeof crypto !== 'undefined' && typeof crypto?.getRandomValues !== 'undefined') {
|
|
76
76
|
return crypto.getRandomValues.bind(crypto);
|
|
77
77
|
} else if (typeof msCrypto !== 'undefined') {
|
|
78
78
|
return msCrypto.getRandomValues.bind(msCrypto);
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
DeleteActivitiesResponse,
|
|
33
33
|
DeleteActivityReactionResponse,
|
|
34
34
|
DeleteActivityResponse,
|
|
35
|
+
DeleteBookmarkFolderResponse,
|
|
35
36
|
DeleteBookmarkResponse,
|
|
36
37
|
DeleteCommentReactionResponse,
|
|
37
38
|
DeleteCommentResponse,
|
|
@@ -103,6 +104,8 @@ import {
|
|
|
103
104
|
UpdateActivityResponse,
|
|
104
105
|
UpdateBlockListRequest,
|
|
105
106
|
UpdateBlockListResponse,
|
|
107
|
+
UpdateBookmarkFolderRequest,
|
|
108
|
+
UpdateBookmarkFolderResponse,
|
|
106
109
|
UpdateBookmarkRequest,
|
|
107
110
|
UpdateBookmarkResponse,
|
|
108
111
|
UpdateCommentRequest,
|
|
@@ -743,6 +746,54 @@ export class FeedsApi {
|
|
|
743
746
|
return { ...response.body, metadata: response.metadata };
|
|
744
747
|
}
|
|
745
748
|
|
|
749
|
+
async deleteBookmarkFolder(request: {
|
|
750
|
+
folder_id: string;
|
|
751
|
+
}): Promise<StreamResponse<DeleteBookmarkFolderResponse>> {
|
|
752
|
+
const pathParams = {
|
|
753
|
+
folder_id: request?.folder_id,
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
const response = await this.apiClient.sendRequest<
|
|
757
|
+
StreamResponse<DeleteBookmarkFolderResponse>
|
|
758
|
+
>(
|
|
759
|
+
'DELETE',
|
|
760
|
+
'/api/v2/feeds/bookmark_folders/{folder_id}',
|
|
761
|
+
pathParams,
|
|
762
|
+
undefined,
|
|
763
|
+
);
|
|
764
|
+
|
|
765
|
+
decoders.DeleteBookmarkFolderResponse?.(response.body);
|
|
766
|
+
|
|
767
|
+
return { ...response.body, metadata: response.metadata };
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
async updateBookmarkFolder(
|
|
771
|
+
request: UpdateBookmarkFolderRequest & { folder_id: string },
|
|
772
|
+
): Promise<StreamResponse<UpdateBookmarkFolderResponse>> {
|
|
773
|
+
const pathParams = {
|
|
774
|
+
folder_id: request?.folder_id,
|
|
775
|
+
};
|
|
776
|
+
const body = {
|
|
777
|
+
name: request?.name,
|
|
778
|
+
custom: request?.custom,
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
const response = await this.apiClient.sendRequest<
|
|
782
|
+
StreamResponse<UpdateBookmarkFolderResponse>
|
|
783
|
+
>(
|
|
784
|
+
'PATCH',
|
|
785
|
+
'/api/v2/feeds/bookmark_folders/{folder_id}',
|
|
786
|
+
pathParams,
|
|
787
|
+
undefined,
|
|
788
|
+
body,
|
|
789
|
+
'application/json',
|
|
790
|
+
);
|
|
791
|
+
|
|
792
|
+
decoders.UpdateBookmarkFolderResponse?.(response.body);
|
|
793
|
+
|
|
794
|
+
return { ...response.body, metadata: response.metadata };
|
|
795
|
+
}
|
|
796
|
+
|
|
746
797
|
async queryBookmarks(
|
|
747
798
|
request?: QueryBookmarksRequest,
|
|
748
799
|
): Promise<StreamResponse<QueryBookmarksResponse>> {
|
|
@@ -353,6 +353,17 @@ decoders.BookmarkDeletedEvent = (input?: Record<string, any>) => {
|
|
|
353
353
|
return decode(typeMappings, input);
|
|
354
354
|
};
|
|
355
355
|
|
|
356
|
+
decoders.BookmarkFolderDeletedEvent = (input?: Record<string, any>) => {
|
|
357
|
+
const typeMappings: TypeMapping = {
|
|
358
|
+
created_at: { type: 'DatetimeType', isSingle: true },
|
|
359
|
+
|
|
360
|
+
bookmark_folder: { type: 'BookmarkFolderResponse', isSingle: true },
|
|
361
|
+
|
|
362
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
363
|
+
};
|
|
364
|
+
return decode(typeMappings, input);
|
|
365
|
+
};
|
|
366
|
+
|
|
356
367
|
decoders.BookmarkFolderResponse = (input?: Record<string, any>) => {
|
|
357
368
|
const typeMappings: TypeMapping = {
|
|
358
369
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -362,6 +373,17 @@ decoders.BookmarkFolderResponse = (input?: Record<string, any>) => {
|
|
|
362
373
|
return decode(typeMappings, input);
|
|
363
374
|
};
|
|
364
375
|
|
|
376
|
+
decoders.BookmarkFolderUpdatedEvent = (input?: Record<string, any>) => {
|
|
377
|
+
const typeMappings: TypeMapping = {
|
|
378
|
+
created_at: { type: 'DatetimeType', isSingle: true },
|
|
379
|
+
|
|
380
|
+
bookmark_folder: { type: 'BookmarkFolderResponse', isSingle: true },
|
|
381
|
+
|
|
382
|
+
received_at: { type: 'DatetimeType', isSingle: true },
|
|
383
|
+
};
|
|
384
|
+
return decode(typeMappings, input);
|
|
385
|
+
};
|
|
386
|
+
|
|
365
387
|
decoders.BookmarkResponse = (input?: Record<string, any>) => {
|
|
366
388
|
const typeMappings: TypeMapping = {
|
|
367
389
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1699,6 +1721,13 @@ decoders.UpdateBlockListResponse = (input?: Record<string, any>) => {
|
|
|
1699
1721
|
return decode(typeMappings, input);
|
|
1700
1722
|
};
|
|
1701
1723
|
|
|
1724
|
+
decoders.UpdateBookmarkFolderResponse = (input?: Record<string, any>) => {
|
|
1725
|
+
const typeMappings: TypeMapping = {
|
|
1726
|
+
bookmark_folder: { type: 'BookmarkFolderResponse', isSingle: true },
|
|
1727
|
+
};
|
|
1728
|
+
return decode(typeMappings, input);
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1702
1731
|
decoders.UpdateBookmarkResponse = (input?: Record<string, any>) => {
|
|
1703
1732
|
const typeMappings: TypeMapping = {
|
|
1704
1733
|
bookmark: { type: 'BookmarkResponse', isSingle: true },
|
|
@@ -46,6 +46,12 @@ const eventDecoderMapping: Record<
|
|
|
46
46
|
'feeds.bookmark.updated': (data: Record<string, any>) =>
|
|
47
47
|
decoders.BookmarkUpdatedEvent(data),
|
|
48
48
|
|
|
49
|
+
'feeds.bookmark_folder.deleted': (data: Record<string, any>) =>
|
|
50
|
+
decoders.BookmarkFolderDeletedEvent(data),
|
|
51
|
+
|
|
52
|
+
'feeds.bookmark_folder.updated': (data: Record<string, any>) =>
|
|
53
|
+
decoders.BookmarkFolderUpdatedEvent(data),
|
|
54
|
+
|
|
49
55
|
'feeds.comment.added': (data: Record<string, any>) =>
|
|
50
56
|
decoders.CommentAddedEvent(data),
|
|
51
57
|
|
package/src/gen/models/index.ts
CHANGED
|
@@ -373,6 +373,8 @@ export interface ActivityResponse {
|
|
|
373
373
|
|
|
374
374
|
popularity: number;
|
|
375
375
|
|
|
376
|
+
reaction_count: number;
|
|
377
|
+
|
|
376
378
|
score: number;
|
|
377
379
|
|
|
378
380
|
share_count: number;
|
|
@@ -949,6 +951,20 @@ export interface BookmarkDeletedEvent {
|
|
|
949
951
|
user?: UserResponseCommonFields;
|
|
950
952
|
}
|
|
951
953
|
|
|
954
|
+
export interface BookmarkFolderDeletedEvent {
|
|
955
|
+
created_at: Date;
|
|
956
|
+
|
|
957
|
+
bookmark_folder: BookmarkFolderResponse;
|
|
958
|
+
|
|
959
|
+
custom: Record<string, any>;
|
|
960
|
+
|
|
961
|
+
type: string;
|
|
962
|
+
|
|
963
|
+
received_at?: Date;
|
|
964
|
+
|
|
965
|
+
user?: UserResponseCommonFields;
|
|
966
|
+
}
|
|
967
|
+
|
|
952
968
|
export interface BookmarkFolderResponse {
|
|
953
969
|
created_at: Date;
|
|
954
970
|
|
|
@@ -961,6 +977,20 @@ export interface BookmarkFolderResponse {
|
|
|
961
977
|
custom?: Record<string, any>;
|
|
962
978
|
}
|
|
963
979
|
|
|
980
|
+
export interface BookmarkFolderUpdatedEvent {
|
|
981
|
+
created_at: Date;
|
|
982
|
+
|
|
983
|
+
bookmark_folder: BookmarkFolderResponse;
|
|
984
|
+
|
|
985
|
+
custom: Record<string, any>;
|
|
986
|
+
|
|
987
|
+
type: string;
|
|
988
|
+
|
|
989
|
+
received_at?: Date;
|
|
990
|
+
|
|
991
|
+
user?: UserResponseCommonFields;
|
|
992
|
+
}
|
|
993
|
+
|
|
964
994
|
export interface BookmarkResponse {
|
|
965
995
|
created_at: Date;
|
|
966
996
|
|
|
@@ -2051,6 +2081,10 @@ export interface DeleteActivityResponse {
|
|
|
2051
2081
|
duration: string;
|
|
2052
2082
|
}
|
|
2053
2083
|
|
|
2084
|
+
export interface DeleteBookmarkFolderResponse {
|
|
2085
|
+
duration: string;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2054
2088
|
export interface DeleteBookmarkResponse {
|
|
2055
2089
|
duration: string;
|
|
2056
2090
|
|
|
@@ -2490,6 +2524,8 @@ export interface FeedInput {
|
|
|
2490
2524
|
|
|
2491
2525
|
visibility?: 'public' | 'visible' | 'followers' | 'members' | 'private';
|
|
2492
2526
|
|
|
2527
|
+
filter_tags?: string[];
|
|
2528
|
+
|
|
2493
2529
|
members?: FeedMemberRequest[];
|
|
2494
2530
|
|
|
2495
2531
|
custom?: Record<string, any>;
|
|
@@ -2620,6 +2656,8 @@ export interface FeedRequest {
|
|
|
2620
2656
|
|
|
2621
2657
|
visibility?: 'public' | 'visible' | 'followers' | 'members' | 'private';
|
|
2622
2658
|
|
|
2659
|
+
filter_tags?: string[];
|
|
2660
|
+
|
|
2623
2661
|
members?: FeedMemberRequest[];
|
|
2624
2662
|
|
|
2625
2663
|
custom?: Record<string, any>;
|
|
@@ -2654,6 +2692,8 @@ export interface FeedResponse {
|
|
|
2654
2692
|
|
|
2655
2693
|
visibility?: string;
|
|
2656
2694
|
|
|
2695
|
+
filter_tags?: string[];
|
|
2696
|
+
|
|
2657
2697
|
custom?: Record<string, any>;
|
|
2658
2698
|
}
|
|
2659
2699
|
|
|
@@ -3678,6 +3718,8 @@ export interface OwnUser {
|
|
|
3678
3718
|
|
|
3679
3719
|
custom: Record<string, any>;
|
|
3680
3720
|
|
|
3721
|
+
total_unread_count_by_team: Record<string, number>;
|
|
3722
|
+
|
|
3681
3723
|
deactivated_at?: Date;
|
|
3682
3724
|
|
|
3683
3725
|
deleted_at?: Date;
|
|
@@ -3757,6 +3799,8 @@ export interface OwnUserResponse {
|
|
|
3757
3799
|
push_preferences?: PushPreferences;
|
|
3758
3800
|
|
|
3759
3801
|
teams_role?: Record<string, string>;
|
|
3802
|
+
|
|
3803
|
+
total_unread_count_by_team?: Record<string, number>;
|
|
3760
3804
|
}
|
|
3761
3805
|
|
|
3762
3806
|
export interface PagerRequest {
|
|
@@ -5232,6 +5276,18 @@ export interface UpdateBlockListResponse {
|
|
|
5232
5276
|
blocklist?: BlockListResponse;
|
|
5233
5277
|
}
|
|
5234
5278
|
|
|
5279
|
+
export interface UpdateBookmarkFolderRequest {
|
|
5280
|
+
name?: string;
|
|
5281
|
+
|
|
5282
|
+
custom?: Record<string, any>;
|
|
5283
|
+
}
|
|
5284
|
+
|
|
5285
|
+
export interface UpdateBookmarkFolderResponse {
|
|
5286
|
+
duration: string;
|
|
5287
|
+
|
|
5288
|
+
bookmark_folder: BookmarkFolderResponse;
|
|
5289
|
+
}
|
|
5290
|
+
|
|
5235
5291
|
export interface UpdateBookmarkRequest {
|
|
5236
5292
|
folder_id?: string;
|
|
5237
5293
|
|
|
@@ -5805,6 +5861,8 @@ export type WSClientEvent =
|
|
|
5805
5861
|
| ({ type: 'feeds.bookmark.added' } & BookmarkAddedEvent)
|
|
5806
5862
|
| ({ type: 'feeds.bookmark.deleted' } & BookmarkDeletedEvent)
|
|
5807
5863
|
| ({ type: 'feeds.bookmark.updated' } & BookmarkUpdatedEvent)
|
|
5864
|
+
| ({ type: 'feeds.bookmark_folder.deleted' } & BookmarkFolderDeletedEvent)
|
|
5865
|
+
| ({ type: 'feeds.bookmark_folder.updated' } & BookmarkFolderUpdatedEvent)
|
|
5808
5866
|
| ({ type: 'feeds.comment.added' } & CommentAddedEvent)
|
|
5809
5867
|
| ({ type: 'feeds.comment.deleted' } & CommentDeletedEvent)
|
|
5810
5868
|
| ({ type: 'feeds.comment.reaction.added' } & CommentReactionAddedEvent)
|
|
@@ -5848,6 +5906,8 @@ export type WSEvent =
|
|
|
5848
5906
|
| ({ type: 'feeds.bookmark.added' } & BookmarkAddedEvent)
|
|
5849
5907
|
| ({ type: 'feeds.bookmark.deleted' } & BookmarkDeletedEvent)
|
|
5850
5908
|
| ({ type: 'feeds.bookmark.updated' } & BookmarkUpdatedEvent)
|
|
5909
|
+
| ({ type: 'feeds.bookmark_folder.deleted' } & BookmarkFolderDeletedEvent)
|
|
5910
|
+
| ({ type: 'feeds.bookmark_folder.updated' } & BookmarkFolderUpdatedEvent)
|
|
5851
5911
|
| ({ type: 'feeds.comment.added' } & CommentAddedEvent)
|
|
5852
5912
|
| ({ type: 'feeds.comment.deleted' } & CommentDeletedEvent)
|
|
5853
5913
|
| ({ type: 'feeds.comment.reaction.added' } & CommentReactionAddedEvent)
|