@amityco/ts-sdk 7.33.1 → 7.33.2-840ee4f3.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/content.d.ts +5 -0
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/client/api/getFeedSettings.d.ts +3 -1
- package/dist/client/api/getFeedSettings.d.ts.map +1 -1
- package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
- package/dist/index.cjs.js +213 -8
- package/dist/index.esm.js +213 -8
- package/dist/index.umd.js +2 -2
- package/dist/userRepository/api/getAllFollowers.d.ts +19 -0
- package/dist/userRepository/api/getAllFollowers.d.ts.map +1 -0
- package/dist/userRepository/api/getAllFollowings.d.ts +21 -0
- package/dist/userRepository/api/getAllFollowings.d.ts.map +1 -0
- package/dist/userRepository/api/index.d.ts +2 -0
- package/dist/userRepository/api/index.d.ts.map +1 -1
- package/dist/userRepository/api/tests/integration/getAllFollowers.integration.test.d.ts +2 -0
- package/dist/userRepository/api/tests/integration/getAllFollowers.integration.test.d.ts.map +1 -0
- package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngine.d.ts +60 -0
- package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngine.d.ts.map +1 -0
- package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngineOnLoginHandler.d.ts +3 -0
- package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const followers = await UserRepository.getAllFollowers()
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Returns all users who follow the current user (accepted follows only) as a
|
|
8
|
+
* non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
9
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store
|
|
10
|
+
* without any server call. After the TTL expires, the next call triggers a fresh
|
|
11
|
+
* server fetch.
|
|
12
|
+
*
|
|
13
|
+
* @returns A promise that resolves to an array of follower {@link Amity.User} objects
|
|
14
|
+
*
|
|
15
|
+
* @category Follow API
|
|
16
|
+
* @async
|
|
17
|
+
*/
|
|
18
|
+
export declare const getAllFollowers: () => Promise<Amity.User[]>;
|
|
19
|
+
//# sourceMappingURL=getAllFollowers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllFollowers.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/getAllFollowers.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,QAAa,QAAQ,MAAM,IAAI,EAAE,CAU5D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const followings = await UserRepository.getAllFollowings()
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Returns all users the current user follows (accepted follows only) as a
|
|
8
|
+
* non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
9
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store
|
|
10
|
+
* without any server call. After the TTL expires, the next call triggers a fresh
|
|
11
|
+
* server fetch.
|
|
12
|
+
*
|
|
13
|
+
* The directional inverse of {@link getAllFollowers}.
|
|
14
|
+
*
|
|
15
|
+
* @returns A promise that resolves to an array of followed {@link Amity.User} objects
|
|
16
|
+
*
|
|
17
|
+
* @category Follow API
|
|
18
|
+
* @async
|
|
19
|
+
*/
|
|
20
|
+
export declare const getAllFollowings: () => Promise<Amity.User[]>;
|
|
21
|
+
//# sourceMappingURL=getAllFollowings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllFollowings.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/getAllFollowings.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,QAAa,QAAQ,MAAM,IAAI,EAAE,CAU7D,CAAC"}
|
|
@@ -7,4 +7,6 @@ export { unflagUser } from './unflagUser';
|
|
|
7
7
|
export { isUserFlaggedByMe } from './isUserFlaggedByMe';
|
|
8
8
|
export { getAllBlockedUsers } from './getAllBlockedUsers';
|
|
9
9
|
export { getAllBlockingUsers } from './getAllBlockingUsers';
|
|
10
|
+
export { getAllFollowers } from './getAllFollowers';
|
|
11
|
+
export { getAllFollowings } from './getAllFollowings';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllFollowers.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/api/tests/integration/getAllFollowers.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `followers` — users who follow the current user (`to === me`, user is `from`)
|
|
3
|
+
* `followings` — users the current user follows (`from === me`, user is `to`)
|
|
4
|
+
*/
|
|
5
|
+
declare type FollowDirection = 'followers' | 'followings';
|
|
6
|
+
/**
|
|
7
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
8
|
+
* of the current user's accepted followers or followings. Provides a lazy
|
|
9
|
+
* `ensureFetched()` gate for the `getAllFollowers()` / `getAllFollowings()` APIs.
|
|
10
|
+
*
|
|
11
|
+
* Key behaviours:
|
|
12
|
+
* - `onSessionEstablished()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
13
|
+
* - `onSessionDestroyed()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
14
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
15
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
16
|
+
* - reads query the follow cache live, so follow / unfollow / remove-follower
|
|
17
|
+
* changes are reflected even within the TTL window
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
declare class FollowUserSyncEngine {
|
|
22
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
23
|
+
private lastFetchedAt;
|
|
24
|
+
private readonly direction;
|
|
25
|
+
constructor(direction: FollowDirection);
|
|
26
|
+
/** No-op — fetch is lazy, triggered by consumer calling the API. */
|
|
27
|
+
onSessionEstablished(): void;
|
|
28
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
29
|
+
onSessionDestroyed(): void;
|
|
30
|
+
/** No-op for this engine. */
|
|
31
|
+
onTokenExpired(): void;
|
|
32
|
+
private isCacheExpired;
|
|
33
|
+
/**
|
|
34
|
+
* Ensures the local store is populated with fresh follow data.
|
|
35
|
+
*
|
|
36
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
37
|
+
* (no server call).
|
|
38
|
+
* - If the cache is expired (or never fetched): fetches the first page
|
|
39
|
+
* (limit 100) of accepted follows, persists the payload to the cache, and
|
|
40
|
+
* updates `lastFetchedAt`.
|
|
41
|
+
*
|
|
42
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
43
|
+
* updated, so the next call will retry.
|
|
44
|
+
*/
|
|
45
|
+
ensureFetched(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the followers / followings by querying the follow cache live.
|
|
48
|
+
*
|
|
49
|
+
* - filter `status === 'accepted'` and the current user on the matching side
|
|
50
|
+
* of the edge, other user not deleted
|
|
51
|
+
* - sort by `updatedAt` DESC
|
|
52
|
+
* - hard limit of 100 results
|
|
53
|
+
*/
|
|
54
|
+
getCachedUsers(): Amity.User[];
|
|
55
|
+
}
|
|
56
|
+
declare const _default: {
|
|
57
|
+
getInstance: (direction: FollowDirection) => FollowUserSyncEngine;
|
|
58
|
+
};
|
|
59
|
+
export default _default;
|
|
60
|
+
//# sourceMappingURL=followUserSyncEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"followUserSyncEngine.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/services/FollowUserSyncEngine/followUserSyncEngine.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,aAAK,eAAe,GAAG,WAAW,GAAG,YAAY,CAAC;AAOlD;;;;;;;;;;;;;;GAcG;AACH,cAAM,oBAAoB;IACxB,+EAA+E;IAC/E,OAAO,CAAC,aAAa,CAAuB;IAE5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;gBAEhC,SAAS,EAAE,eAAe;IAItC,oEAAoE;IAEpE,oBAAoB,IAAI,IAAI;IAI5B,iEAAiE;IACjE,kBAAkB,IAAI,IAAI;IAI1B,6BAA6B;IAE7B,cAAc,IAAI,IAAI;IAItB,OAAO,CAAC,cAAc;IAKtB;;;;;;;;;;;OAWG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBpC;;;;;;;OAOG;IACH,cAAc,IAAI,KAAK,CAAC,IAAI,EAAE;CAwB/B;;6BAK0B,eAAe,KAAG,oBAAoB;;AADjE,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"followUserSyncEngineOnLoginHandler.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/services/FollowUserSyncEngine/followUserSyncEngineOnLoginHandler.ts"],"names":[],"mappings":";AAGA,wBAqBE"}
|