@amityco/ts-sdk 7.33.2-2476596b.0 → 7.33.2-4b6d807.0
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/dist/@types/domains/feed.d.ts +14 -0
- package/dist/@types/domains/feed.d.ts.map +1 -1
- package/dist/@types/domains/notification.d.ts +5 -1
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/feedRepository/index.d.ts +1 -1
- package/dist/feedRepository/index.d.ts.map +1 -1
- package/dist/feedRepository/observers/getFollowingFeed/LiveCollectionController.d.ts +13 -0
- package/dist/feedRepository/observers/getFollowingFeed/LiveCollectionController.d.ts.map +1 -0
- package/dist/feedRepository/observers/getFollowingFeed/PaginationController.d.ts +10 -0
- package/dist/feedRepository/observers/getFollowingFeed/PaginationController.d.ts.map +1 -0
- package/dist/feedRepository/observers/getFollowingFeed/QueryStreamController.d.ts +22 -0
- package/dist/feedRepository/observers/getFollowingFeed/QueryStreamController.d.ts.map +1 -0
- package/dist/feedRepository/observers/getFollowingFeed.d.ts +35 -0
- package/dist/feedRepository/observers/getFollowingFeed.d.ts.map +1 -0
- package/dist/feedRepository/observers/index.d.ts +1 -0
- package/dist/feedRepository/observers/index.d.ts.map +1 -1
- package/dist/feedRepository/observers/tests/integration/getFollowingFeed.integration.test.d.ts +2 -0
- package/dist/feedRepository/observers/tests/integration/getFollowingFeed.integration.test.d.ts.map +1 -0
- package/dist/feedRepository/observers/tests/unit/FollowingFeedQueryStreamController.test.d.ts +2 -0
- package/dist/feedRepository/observers/tests/unit/FollowingFeedQueryStreamController.test.d.ts.map +1 -0
- package/dist/index.cjs.js +198 -3
- package/dist/index.esm.js +199 -4
- package/dist/index.umd.js +2 -2
- package/dist/userRepository/relationship/follow/api/getAllFollowings.d.ts +1 -2
- package/dist/userRepository/relationship/follow/api/getAllFollowings.d.ts.map +1 -1
- package/dist/userRepository/services/FollowingSyncEngine/followRealtimeOnLoginHandler.d.ts +3 -0
- package/dist/userRepository/services/FollowingSyncEngine/followRealtimeOnLoginHandler.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -16,6 +16,13 @@ export declare const enum FeedSortByEnum {
|
|
|
16
16
|
LastUpdated = "lastUpdated",
|
|
17
17
|
FirstUpdated = "firstUpdated"
|
|
18
18
|
}
|
|
19
|
+
/** Sort order of the following feed (`GET /api/v1/me/following-feeds`). */
|
|
20
|
+
export declare const enum FollowingFeedSortByEnum {
|
|
21
|
+
/** Server-ranked. The backend default when `sortBy` is not sent. */
|
|
22
|
+
CustomRanking = "customRanking",
|
|
23
|
+
/** Newest first. */
|
|
24
|
+
LastCreated = "lastCreated"
|
|
25
|
+
}
|
|
19
26
|
export declare const enum FeedSourceEnum {
|
|
20
27
|
Community = "community",
|
|
21
28
|
User = "user"
|
|
@@ -29,6 +36,7 @@ declare global {
|
|
|
29
36
|
namespace Amity {
|
|
30
37
|
type FeedDataType = FeedDataTypeEnum;
|
|
31
38
|
type FeedSortBy = FeedSortByEnum;
|
|
39
|
+
type FollowingFeedSortBy = FollowingFeedSortByEnum;
|
|
32
40
|
type FeedSource = FeedSourceEnum;
|
|
33
41
|
type Feed = {
|
|
34
42
|
feedId: string;
|
|
@@ -63,6 +71,12 @@ declare global {
|
|
|
63
71
|
type GlobalFeedLiveCollectionCache = Amity.LiveCollectionCache<Amity.InternalPost['postId'], QueryGlobalFeed>;
|
|
64
72
|
type ForYouFeedLiveCollection = Amity.LiveCollectionParams<Record<string, never>>;
|
|
65
73
|
type ForYouFeedLiveCollectionCache = Amity.LiveCollectionCache<Amity.InternalPost['postId'], Record<string, never>>;
|
|
74
|
+
type QueryFollowingFeed = {
|
|
75
|
+
/** Left off the request when unset, so the server default (`customRanking`) applies. */
|
|
76
|
+
sortBy?: Amity.FollowingFeedSortBy;
|
|
77
|
+
};
|
|
78
|
+
type FollowingFeedLiveCollection = Amity.LiveCollectionParams<QueryFollowingFeed>;
|
|
79
|
+
type FollowingFeedLiveCollectionCache = Amity.LiveCollectionCache<Amity.InternalPost['postId'], QueryFollowingFeed>;
|
|
66
80
|
type QueryUserFeed = {
|
|
67
81
|
userId: string;
|
|
68
82
|
includeDeleted?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,0BAAkB,gBAAgB;IAChC,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,0BAAkB,cAAc;IAC9B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;CAC9B;AAED,0BAAkB,cAAc;IAC9B,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAED,0BAAkB,YAAY;IAC5B,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,YAAY,GAAG,gBAAgB,CAAC;QAErC,KAAK,UAAU,GAAG,cAAc,CAAC;QAEjC,KAAK,UAAU,GAAG,cAAc,CAAC;QAEjC,KAAK,IAAI,GAAG;YACV,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,EAAE,WAAW,GAAG,WAAW,CAAC;YACpC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;YACxD,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;SACnB,GAAG,KAAK,CAAC,UAAU,CAAC;QAErB,KAAK,YAAY,GAAG;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,o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,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;YAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;YACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;YAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;YAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;SAC3B,CAAC;QAEF,KAAK,2BAA2B,GAAG,KAAK,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;QAElF,KAAK,gCAAgC,GAAG,KAAK,CAAC,mBAAmB,CAC/D,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,EAC5B,kBAAkB,CACnB,CAAC;KACH;CACF"}
|
|
@@ -9,6 +9,7 @@ declare global {
|
|
|
9
9
|
POST_REACT = "reaction_on_post",
|
|
10
10
|
COMMENT_REACT = "reaction_on_comment",
|
|
11
11
|
REPLY_REACT = "reaction_on_reply",
|
|
12
|
+
POLL_REACT = "reaction_on_poll",
|
|
12
13
|
RESPONSE_JOIN_REQUEST = "respond_on_join_request",
|
|
13
14
|
FOLLOW_USER = "follow",
|
|
14
15
|
EVENT_REMINDER = "event_reminder",
|
|
@@ -25,7 +26,10 @@ declare global {
|
|
|
25
26
|
MENTION = "mention",
|
|
26
27
|
REPLY = "reply",
|
|
27
28
|
JOIN_REQUEST = "join_request",
|
|
28
|
-
USER = "user"
|
|
29
|
+
USER = "user",
|
|
30
|
+
FOLLOW = "follow",
|
|
31
|
+
EVENT = "event",
|
|
32
|
+
INVITATION = "invitation"
|
|
29
33
|
}
|
|
30
34
|
type RawNotificationTrayItem = {
|
|
31
35
|
_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,oBAAoB;YAC7B,YAAY,oBAAoB;YAChC,eAAe,uBAAuB;YACtC,aAAa,qBAAqB;YAClC,YAAY,oBAAoB;YAChC,UAAU,qBAAqB;YAC/B,aAAa,wBAAwB;YACrC,WAAW,sBAAsB;YACjC,qBAAqB,4BAA4B;YACjD,WAAW,WAAW;YACtB,cAAc,mBAAmB;YACjC,aAAa,kBAAkB;YAC/B,aAAa,kBAAkB;YAC/B,kBAAkB,uBAAuB;YACzC,kBAAkB,uBAAuB;SAC1C;QAED,WAAW,UAAU;YACnB,IAAI,SAAS;YACb,IAAI,SAAS;YACb,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,OAAO,YAAY;YACnB,KAAK,UAAU;YACf,YAAY,iBAAiB;YAC7B,IAAI,SAAS;
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,oBAAoB;YAC7B,YAAY,oBAAoB;YAChC,eAAe,uBAAuB;YACtC,aAAa,qBAAqB;YAClC,YAAY,oBAAoB;YAChC,UAAU,qBAAqB;YAC/B,aAAa,wBAAwB;YACrC,WAAW,sBAAsB;YACjC,UAAU,qBAAqB;YAC/B,qBAAqB,4BAA4B;YACjD,WAAW,WAAW;YACtB,cAAc,mBAAmB;YACjC,aAAa,kBAAkB;YAC/B,aAAa,kBAAkB;YAC/B,kBAAkB,uBAAuB;YACzC,kBAAkB,uBAAuB;SAC1C;QAED,WAAW,UAAU;YACnB,IAAI,SAAS;YACb,IAAI,SAAS;YACb,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,OAAO,YAAY;YACnB,KAAK,UAAU;YACf,YAAY,iBAAiB;YAC7B,IAAI,SAAS;YACb,MAAM,WAAW;YACjB,KAAK,UAAU;YACf,UAAU,eAA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ACzC,CAAC;QAEF,KAAK,gCAAgC,GAAG;YACtC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;SACrB,CAAC;QAEF,KAAK,oBAAoB,GAAG,KAAK,CAAC,4BAA4B,GAC5D,gCAAgC,GAAG;YACjC,MAAM,EAAE,OAAO,CAAC;YAChB,QAAQ,EAAE,OAAO,CAAC;SACnB,CAAC;QAEJ,KAAK,uBAAuB,GAAG;YAC7B,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;YAChC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC;SACrC,CAAC;QAEF,KAAK,8BAA8B,GAAG;YACpC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;SACjC,CAAC;QAEF,KAAK,4BAA4B,GAAG,uBAAuB,GAAG;YAC5D,MAAM,EAAE,MAAM,CAAC;YACf,MAAM,EAAE,OAAO,CAAC;SACjB,CAAC;QAEF,KAAK,oBAAoB,GAAG,uBAAuB,GAAG;YAAE,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC;QAE1E,KAAK,uBAAuB,GAAG;YAC7B,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;SAC7B,CAAC;QAEF,KAAK,yBAAyB,GAAG;YAC/B,EAAE,EAAE,MAAM,CAAC;YACX,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;SAC7B,CAAC;KACH;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { queryGlobalFeed } from './api';
|
|
2
|
-
export { getCustomRankingGlobalFeed, getGlobalFeed, getUserFeed, getCommunityFeed, getForYouFeed, } from './observers';
|
|
2
|
+
export { getCustomRankingGlobalFeed, getGlobalFeed, getUserFeed, getCommunityFeed, getForYouFeed, getFollowingFeed, } from './observers';
|
|
3
3
|
export { AmityForYouFeedDisabledError } from './errors/AmityForYouFeedDisabledError';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedRepository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedRepository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
|
|
2
|
+
import { FollowingFeedPaginationController } from './PaginationController';
|
|
3
|
+
export declare class FollowingFeedLiveCollectionController extends LiveCollectionController<'post', Amity.FollowingFeedLiveCollection, Amity.Post, FollowingFeedPaginationController> {
|
|
4
|
+
private queryStreamController;
|
|
5
|
+
private query;
|
|
6
|
+
constructor(query: Amity.FollowingFeedLiveCollection, callback: Amity.LiveCollectionCallback<Amity.Post>);
|
|
7
|
+
protected setup(): void;
|
|
8
|
+
protected persistModel(queryPayload: Amity.PostPayload & Amity.Pagination): Promise<void>;
|
|
9
|
+
protected persistQueryStream({ response, direction, refresh, }: Amity.LiveCollectionPersistQueryStreamParams<'post'>): void;
|
|
10
|
+
startSubscription(): Amity.Unsubscriber[];
|
|
11
|
+
notifyChange({ origin, loading, error }: Amity.LiveCollectionNotifyParams): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=LiveCollectionController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/feedRepository/observers/getFollowingFeed/LiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAG3E,qBAAa,qCAAsC,SAAQ,wBAAwB,CACjF,MAAM,EACN,KAAK,CAAC,2BAA2B,EACjC,KAAK,CAAC,IAAI,EACV,iCAAiC,CAClC;IACC,OAAO,CAAC,qBAAqB,CAAqC;IAElE,OAAO,CAAC,KAAK,CAAoC;gBAG/C,KAAK,EAAE,KAAK,CAAC,2BAA2B,EACxC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;IAoBpD,SAAS,CAAC,KAAK;cAWC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU;IAI/E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,MAAM,CAAC;IAIvD,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;CAqB1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
2
|
+
/**
|
|
3
|
+
* `GET /api/v1/me/following-feeds` reads `limit` and `token` as flat query params.
|
|
4
|
+
* Unlike the global feed, they must not be nested in `options`: the endpoint forwards
|
|
5
|
+
* only `{ limit, token }`, so a nested token would be dropped and every page would be page one.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FollowingFeedPaginationController extends PaginationController<'post', Amity.FollowingFeedLiveCollection> {
|
|
8
|
+
getRequest(queryParams: Amity.FollowingFeedLiveCollection, token: string | undefined): Promise<Amity.PostPayload<any> & Amity.Pagination>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PaginationController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationController.d.ts","sourceRoot":"","sources":["../../../../src/feedRepository/observers/getFollowingFeed/PaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;;GAIG;AACH,qBAAa,iCAAkC,SAAQ,oBAAoB,CACzE,MAAM,EACN,KAAK,CAAC,2BAA2B,CAClC;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;CAa3F"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
|
|
2
|
+
import { EnumPostActions } from '~/postRepository/observers/enums';
|
|
3
|
+
export declare class FollowingFeedQueryStreamController extends QueryStreamController<Amity.PostPayload, Amity.FollowingFeedLiveCollection> {
|
|
4
|
+
private notifyChange;
|
|
5
|
+
private preparePayload;
|
|
6
|
+
constructor(query: Amity.FollowingFeedLiveCollection, cacheKey: string[], notifyChange: (params: Amity.LiveCollectionNotifyParams) => void, preparePayload: (response: Amity.PostPayload) => Amity.ProcessedPostPayload);
|
|
7
|
+
saveToMainDB(response: Amity.PostPayload): Promise<void>;
|
|
8
|
+
appendToQueryStream(response: Amity.PostPayload & Partial<Amity.Pagination>, direction: Amity.LiveCollectionPageDirection, refresh?: boolean): void;
|
|
9
|
+
/**
|
|
10
|
+
* The SDK does not know the viewer's follow list or the network's `social.globalFeed`
|
|
11
|
+
* switches, so it cannot tell whether a new post belongs in this feed. A created or
|
|
12
|
+
* approved post, by anyone (the current user included), never changes the list: it
|
|
13
|
+
* appears on the next first-page load. Deleted and declined posts are removed; any
|
|
14
|
+
* other event re-emits so listed posts render their new state.
|
|
15
|
+
*/
|
|
16
|
+
reactor(action: EnumPostActions): (post: Amity.InternalPost) => void;
|
|
17
|
+
subscribeRTE(createSubscriber: {
|
|
18
|
+
fn: (reactor: (post: Amity.InternalPost) => void) => Amity.Unsubscriber;
|
|
19
|
+
action: EnumPostActions;
|
|
20
|
+
}[]): Amity.Unsubscriber[];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=QueryStreamController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/feedRepository/observers/getFollowingFeed/QueryStreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAKpF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,qBAAa,kCAAmC,SAAQ,qBAAqB,CAC3E,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,2BAA2B,CAClC;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAA8D;gBAGlF,KAAK,EAAE,KAAK,CAAC,2BAA2B,EACxC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,KAAK,KAAK,CAAC,oBAAoB;IAOvE,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW;IAW9C,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EACvD,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;IAkBjB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,eAAe,UACf,MAAM,YAAY;IAwBlC,YAAY,CACV,gBAAgB,EAAE;QAChB,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC;QACxE,MAAM,EAAE,eAAe,CAAC;KACzB,EAAE;CAIN"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { FeedRepository, FollowingFeedSortByEnum } from '@amityco/ts-sdk'
|
|
4
|
+
*
|
|
5
|
+
* const unsub = FeedRepository.getFollowingFeed(
|
|
6
|
+
* { sortBy: FollowingFeedSortByEnum.LastCreated, limit: 20 },
|
|
7
|
+
* ({ data: posts, hasNextPage, onNextPage, loading, error }) => processResponse(posts),
|
|
8
|
+
* )
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Observe all mutations on a list of {@link Amity.Post} for the current user's following feed.
|
|
12
|
+
* Which posts match is decided by the server, from the network's `social.globalFeed` setting:
|
|
13
|
+
* - `lastCreated`: posts by the users the current user follows, plus the current user's own
|
|
14
|
+
* posts, newest first.
|
|
15
|
+
* - `customRanking` (the default): server-ranked posts by the current user, the users they
|
|
16
|
+
* follow and the communities they joined.
|
|
17
|
+
*
|
|
18
|
+
* A new post, the current user's own included, is not added in real time: it appears
|
|
19
|
+
* when the feed is next loaded from the first page (for example, a new subscription).
|
|
20
|
+
* With `customRanking` the server may take up to 5 minutes to include it.
|
|
21
|
+
* Deleted and declined posts are removed at once.
|
|
22
|
+
*
|
|
23
|
+
* When the network enforces module entitlement and the `feed` module is not entitled,
|
|
24
|
+
* the request fails with `400325` (`ModuleNotEntitled`), reported through `error`.
|
|
25
|
+
*
|
|
26
|
+
* @param params.sortBy order of the feed. When omitted, the server default (`customRanking`) applies
|
|
27
|
+
* @param params.limit page size of the first request (1 - 100)
|
|
28
|
+
* @param callback the function to call when new data are available
|
|
29
|
+
* @param config
|
|
30
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the posts
|
|
31
|
+
*
|
|
32
|
+
* @category Posts Live Collection
|
|
33
|
+
*/
|
|
34
|
+
export declare const getFollowingFeed: (params: Amity.FollowingFeedLiveCollection, callback: Amity.LiveCollectionCallback<Amity.Post>, config?: Amity.LiveCollectionConfig) => Amity.Unsubscriber;
|
|
35
|
+
//# sourceMappingURL=getFollowingFeed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFollowingFeed.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/observers/getFollowingFeed.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gBAAgB,WACnB,MAAM,2BAA2B,YAC/B,MAAM,sBAAsB,CAAC,MAAM,IAAI,CAAC,WACzC,MAAM,oBAAoB,KAClC,MAAM,YAqBR,CAAC"}
|
|
@@ -3,4 +3,5 @@ export { getGlobalFeed } from './getGlobalFeed';
|
|
|
3
3
|
export { getUserFeed } from './getUserFeed';
|
|
4
4
|
export { getCommunityFeed } from './getCommunityFeed';
|
|
5
5
|
export { getForYouFeed } from './getForYouFeed';
|
|
6
|
+
export { getFollowingFeed } from './getFollowingFeed';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/observers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/observers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/feedRepository/observers/tests/integration/getFollowingFeed.integration.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFollowingFeed.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/feedRepository/observers/tests/integration/getFollowingFeed.integration.test.ts"],"names":[],"mappings":""}
|
package/dist/feedRepository/observers/tests/unit/FollowingFeedQueryStreamController.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FollowingFeedQueryStreamController.test.d.ts","sourceRoot":"","sources":["../../../../../src/feedRepository/observers/tests/unit/FollowingFeedQueryStreamController.test.ts"],"names":[],"mappings":""}
|
package/dist/index.cjs.js
CHANGED
|
@@ -262,6 +262,14 @@ exports.FeedSortByEnum = void 0;
|
|
|
262
262
|
FeedSortByEnum["LastUpdated"] = "lastUpdated";
|
|
263
263
|
FeedSortByEnum["FirstUpdated"] = "firstUpdated";
|
|
264
264
|
})(exports.FeedSortByEnum || (exports.FeedSortByEnum = {}));
|
|
265
|
+
/** Sort order of the following feed (`GET /api/v1/me/following-feeds`). */
|
|
266
|
+
exports.FollowingFeedSortByEnum = void 0;
|
|
267
|
+
(function (FollowingFeedSortByEnum) {
|
|
268
|
+
/** Server-ranked. The backend default when `sortBy` is not sent. */
|
|
269
|
+
FollowingFeedSortByEnum["CustomRanking"] = "customRanking";
|
|
270
|
+
/** Newest first. */
|
|
271
|
+
FollowingFeedSortByEnum["LastCreated"] = "lastCreated";
|
|
272
|
+
})(exports.FollowingFeedSortByEnum || (exports.FollowingFeedSortByEnum = {}));
|
|
265
273
|
exports.FeedSourceEnum = void 0;
|
|
266
274
|
(function (FeedSourceEnum) {
|
|
267
275
|
FeedSourceEnum["Community"] = "community";
|
|
@@ -390,6 +398,7 @@ const YEAR = 365 * DAY;
|
|
|
390
398
|
const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
391
399
|
const API_ENDPOINTS = {
|
|
392
400
|
forYouFeed: '/api/v1/feeds/for-you',
|
|
401
|
+
followingFeed: '/api/v1/me/following-feeds',
|
|
393
402
|
commentReviewQueue: (communityId) => `/api/v3/communities/${encodeURIComponent(communityId)}/comments/review-queue`,
|
|
394
403
|
};
|
|
395
404
|
// The review-queue route defaults to 10, not the SDK-wide page size, and caps at 100
|
|
@@ -8585,6 +8594,9 @@ const onLocalUserUnfollowed = (callback) => createLocalFollowEventSubscriber('lo
|
|
|
8585
8594
|
* user as accepted, a request as pending, an accepted request turns accepted, and an
|
|
8586
8595
|
* unfollow, a canceled or declined request, a removed follower or a block takes the user out.
|
|
8587
8596
|
* `blockUser` also calls the engine itself: its local event swaps `from` and `to`.
|
|
8597
|
+
* `user.didBlock` is read here rather than through `onUserDidBlock`, which passes on only
|
|
8598
|
+
* the payload's first follow: every follow in it goes to the engine, as on Android and iOS,
|
|
8599
|
+
* so the signed-in user's block is applied wherever it sits in the payload.
|
|
8588
8600
|
* The MQTT events arrive on the followers and followings topics of the BLOCK
|
|
8589
8601
|
* auto-subscription (on by default).
|
|
8590
8602
|
*
|
|
@@ -8602,7 +8614,7 @@ var followRealtimeOnLoginHandler = () => {
|
|
|
8602
8614
|
onFollowRequestCanceled(apply),
|
|
8603
8615
|
onFollowRequestDeclined(apply),
|
|
8604
8616
|
onFollowerDeleted(apply),
|
|
8605
|
-
|
|
8617
|
+
createEventSubscriber(getActiveClient(), 'user.didBlock', 'user.didBlock', payload => { var _a; return ((_a = payload === null || payload === void 0 ? void 0 : payload.follows) !== null && _a !== void 0 ? _a : []).forEach(apply); }),
|
|
8606
8618
|
onLocalUserFollowed(apply),
|
|
8607
8619
|
onLocalFollowerRequested(apply),
|
|
8608
8620
|
onLocalUserUnfollowed(apply),
|
|
@@ -11788,8 +11800,7 @@ const declineMyFollower = async (userId) => {
|
|
|
11788
11800
|
* author by user id against `userId`.
|
|
11789
11801
|
*
|
|
11790
11802
|
* Keeping the app current: the function answers once, so call it again to see changes —
|
|
11791
|
-
* for example when more posts load
|
|
11792
|
-
* event (`onUserFollowed`, `onUserUnfollowed`, `onFollowRequestAccepted`). The answer is
|
|
11803
|
+
* for example when more posts load or when the feed comes back into view. The answer is
|
|
11793
11804
|
* kept on the device for 5 minutes, so a call within that window costs no request. Changes
|
|
11794
11805
|
* made in this app show at once. Changes made elsewhere — on another device, or by the
|
|
11795
11806
|
* other user accepting a request or removing the user as a follower — show once their
|
|
@@ -30722,6 +30733,189 @@ const getForYouFeed = (callback) => {
|
|
|
30722
30733
|
};
|
|
30723
30734
|
/* end_public_function */
|
|
30724
30735
|
|
|
30736
|
+
class FollowingFeedQueryStreamController extends QueryStreamController {
|
|
30737
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
30738
|
+
super(query, cacheKey);
|
|
30739
|
+
this.notifyChange = notifyChange;
|
|
30740
|
+
this.preparePayload = preparePayload;
|
|
30741
|
+
}
|
|
30742
|
+
async saveToMainDB(response) {
|
|
30743
|
+
const processedPayload = await this.preparePayload(response);
|
|
30744
|
+
const client = getActiveClient();
|
|
30745
|
+
const cachedAt = client.cache && Date.now();
|
|
30746
|
+
if (client.cache) {
|
|
30747
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
30748
|
+
}
|
|
30749
|
+
}
|
|
30750
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
30751
|
+
var _a, _b;
|
|
30752
|
+
if (refresh) {
|
|
30753
|
+
pushToCache(this.cacheKey, {
|
|
30754
|
+
data: response.posts.map(getResolver('post')),
|
|
30755
|
+
});
|
|
30756
|
+
}
|
|
30757
|
+
else {
|
|
30758
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30759
|
+
const posts = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30760
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...posts, ...response.posts.map(getResolver('post'))])] }));
|
|
30761
|
+
}
|
|
30762
|
+
}
|
|
30763
|
+
/**
|
|
30764
|
+
* The SDK does not know the viewer's follow list or the network's `social.globalFeed`
|
|
30765
|
+
* switches, so it cannot tell whether a new post belongs in this feed. A created or
|
|
30766
|
+
* approved post, by anyone (the current user included), never changes the list: it
|
|
30767
|
+
* appears on the next first-page load. Deleted and declined posts are removed; any
|
|
30768
|
+
* other event re-emits so listed posts render their new state.
|
|
30769
|
+
*/
|
|
30770
|
+
reactor(action) {
|
|
30771
|
+
return (post) => {
|
|
30772
|
+
var _a;
|
|
30773
|
+
if (action === EnumPostActions.OnPostCreated || action === EnumPostActions.OnPostApproved) {
|
|
30774
|
+
return;
|
|
30775
|
+
}
|
|
30776
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30777
|
+
if (!collection)
|
|
30778
|
+
return;
|
|
30779
|
+
// A child post event never adds or removes an entry; it re-emits only when its parent is listed
|
|
30780
|
+
if (post.parentPostId) {
|
|
30781
|
+
if (!collection.data.includes(post.parentPostId))
|
|
30782
|
+
return;
|
|
30783
|
+
}
|
|
30784
|
+
else if (action === EnumPostActions.OnPostDeleted ||
|
|
30785
|
+
action === EnumPostActions.OnPostDeclined) {
|
|
30786
|
+
collection.data = collection.data.filter(postId => postId !== post.postId);
|
|
30787
|
+
}
|
|
30788
|
+
pushToCache(this.cacheKey, collection);
|
|
30789
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
30790
|
+
};
|
|
30791
|
+
}
|
|
30792
|
+
subscribeRTE(createSubscriber) {
|
|
30793
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
30794
|
+
}
|
|
30795
|
+
}
|
|
30796
|
+
|
|
30797
|
+
/**
|
|
30798
|
+
* `GET /api/v1/me/following-feeds` reads `limit` and `token` as flat query params.
|
|
30799
|
+
* Unlike the global feed, they must not be nested in `options`: the endpoint forwards
|
|
30800
|
+
* only `{ limit, token }`, so a nested token would be dropped and every page would be page one.
|
|
30801
|
+
*/
|
|
30802
|
+
class FollowingFeedPaginationController extends PaginationController {
|
|
30803
|
+
async getRequest(queryParams, token) {
|
|
30804
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_SIZE, sortBy } = queryParams;
|
|
30805
|
+
const params = token ? { token } : { limit };
|
|
30806
|
+
if (sortBy)
|
|
30807
|
+
params.sortBy = sortBy;
|
|
30808
|
+
const { data: queryResponse } = await this.http.get(API_ENDPOINTS.followingFeed, { params });
|
|
30809
|
+
return queryResponse;
|
|
30810
|
+
}
|
|
30811
|
+
}
|
|
30812
|
+
|
|
30813
|
+
class FollowingFeedLiveCollectionController extends LiveCollectionController {
|
|
30814
|
+
constructor(query, callback) {
|
|
30815
|
+
const queryStreamId = hash__default["default"](query);
|
|
30816
|
+
const cacheKey = ['followingFeed', 'collection', queryStreamId];
|
|
30817
|
+
const paginationController = new FollowingFeedPaginationController(query);
|
|
30818
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
30819
|
+
this.query = query;
|
|
30820
|
+
this.queryStreamController = new FollowingFeedQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), preparePostPayload);
|
|
30821
|
+
this.callback = callback.bind(this);
|
|
30822
|
+
this.loadPage({ initial: true });
|
|
30823
|
+
}
|
|
30824
|
+
setup() {
|
|
30825
|
+
var _a;
|
|
30826
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30827
|
+
if (!collection) {
|
|
30828
|
+
pushToCache(this.cacheKey, {
|
|
30829
|
+
data: [],
|
|
30830
|
+
params: {},
|
|
30831
|
+
});
|
|
30832
|
+
}
|
|
30833
|
+
}
|
|
30834
|
+
async persistModel(queryPayload) {
|
|
30835
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
30836
|
+
}
|
|
30837
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
30838
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
30839
|
+
}
|
|
30840
|
+
startSubscription() {
|
|
30841
|
+
return this.queryStreamController.subscribeRTE(getGlobalFeedSubscriptions(this.cacheKey));
|
|
30842
|
+
}
|
|
30843
|
+
notifyChange({ origin, loading, error }) {
|
|
30844
|
+
var _a, _b;
|
|
30845
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30846
|
+
if (!collection)
|
|
30847
|
+
return;
|
|
30848
|
+
const data = ((_b = collection.data
|
|
30849
|
+
.map(id => pullFromCache(['post', 'get', id]))
|
|
30850
|
+
.filter(isNonNullable)
|
|
30851
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.post);
|
|
30852
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
30853
|
+
return;
|
|
30854
|
+
this.callback({
|
|
30855
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
30856
|
+
data,
|
|
30857
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
30858
|
+
loading,
|
|
30859
|
+
error,
|
|
30860
|
+
});
|
|
30861
|
+
}
|
|
30862
|
+
}
|
|
30863
|
+
|
|
30864
|
+
/* begin_public_function
|
|
30865
|
+
id: feed.query.following_feed
|
|
30866
|
+
api_style: live_collection
|
|
30867
|
+
*/
|
|
30868
|
+
/**
|
|
30869
|
+
* ```js
|
|
30870
|
+
* import { FeedRepository, FollowingFeedSortByEnum } from '@amityco/ts-sdk'
|
|
30871
|
+
*
|
|
30872
|
+
* const unsub = FeedRepository.getFollowingFeed(
|
|
30873
|
+
* { sortBy: FollowingFeedSortByEnum.LastCreated, limit: 20 },
|
|
30874
|
+
* ({ data: posts, hasNextPage, onNextPage, loading, error }) => processResponse(posts),
|
|
30875
|
+
* )
|
|
30876
|
+
* ```
|
|
30877
|
+
*
|
|
30878
|
+
* Observe all mutations on a list of {@link Amity.Post} for the current user's following feed.
|
|
30879
|
+
* Which posts match is decided by the server, from the network's `social.globalFeed` setting:
|
|
30880
|
+
* - `lastCreated`: posts by the users the current user follows, plus the current user's own
|
|
30881
|
+
* posts, newest first.
|
|
30882
|
+
* - `customRanking` (the default): server-ranked posts by the current user, the users they
|
|
30883
|
+
* follow and the communities they joined.
|
|
30884
|
+
*
|
|
30885
|
+
* A new post, the current user's own included, is not added in real time: it appears
|
|
30886
|
+
* when the feed is next loaded from the first page (for example, a new subscription).
|
|
30887
|
+
* With `customRanking` the server may take up to 5 minutes to include it.
|
|
30888
|
+
* Deleted and declined posts are removed at once.
|
|
30889
|
+
*
|
|
30890
|
+
* When the network enforces module entitlement and the `feed` module is not entitled,
|
|
30891
|
+
* the request fails with `400325` (`ModuleNotEntitled`), reported through `error`.
|
|
30892
|
+
*
|
|
30893
|
+
* @param params.sortBy order of the feed. When omitted, the server default (`customRanking`) applies
|
|
30894
|
+
* @param params.limit page size of the first request (1 - 100)
|
|
30895
|
+
* @param callback the function to call when new data are available
|
|
30896
|
+
* @param config
|
|
30897
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the posts
|
|
30898
|
+
*
|
|
30899
|
+
* @category Posts Live Collection
|
|
30900
|
+
*/
|
|
30901
|
+
const getFollowingFeed = (params, callback, config) => {
|
|
30902
|
+
const { log, cache } = getActiveClient();
|
|
30903
|
+
if (!cache) {
|
|
30904
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
30905
|
+
}
|
|
30906
|
+
const timestamp = Date.now();
|
|
30907
|
+
log(`getFollowingFeed(tmpid: ${timestamp}) > listen`);
|
|
30908
|
+
const liveCollection = new FollowingFeedLiveCollectionController(params, callback);
|
|
30909
|
+
const disposers = liveCollection.startSubscription();
|
|
30910
|
+
const cacheKey = liveCollection.getCacheKey();
|
|
30911
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
30912
|
+
return () => {
|
|
30913
|
+
log(`getFollowingFeed(tmpid: ${timestamp}) > dispose`);
|
|
30914
|
+
disposers.forEach(fn => fn());
|
|
30915
|
+
};
|
|
30916
|
+
};
|
|
30917
|
+
/* end_public_function */
|
|
30918
|
+
|
|
30725
30919
|
var index$e = /*#__PURE__*/Object.freeze({
|
|
30726
30920
|
__proto__: null,
|
|
30727
30921
|
queryGlobalFeed: queryGlobalFeed,
|
|
@@ -30730,6 +30924,7 @@ var index$e = /*#__PURE__*/Object.freeze({
|
|
|
30730
30924
|
getUserFeed: getUserFeed,
|
|
30731
30925
|
getCommunityFeed: getCommunityFeed,
|
|
30732
30926
|
getForYouFeed: getForYouFeed,
|
|
30927
|
+
getFollowingFeed: getFollowingFeed,
|
|
30733
30928
|
AmityForYouFeedDisabledError: AmityForYouFeedDisabledError
|
|
30734
30929
|
});
|
|
30735
30930
|
|