@amityco/ts-sdk 7.33.1 → 7.33.2-2476596b.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.
Files changed (30) hide show
  1. package/dist/@types/core/payload.d.ts +4 -0
  2. package/dist/@types/core/payload.d.ts.map +1 -1
  3. package/dist/@types/domains/content.d.ts +5 -0
  4. package/dist/@types/domains/content.d.ts.map +1 -1
  5. package/dist/@types/domains/follow.d.ts +7 -0
  6. package/dist/@types/domains/follow.d.ts.map +1 -1
  7. package/dist/client/api/getFeedSettings.d.ts +3 -1
  8. package/dist/client/api/getFeedSettings.d.ts.map +1 -1
  9. package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
  10. package/dist/index.cjs.js +432 -191
  11. package/dist/index.esm.js +432 -191
  12. package/dist/index.umd.js +2 -2
  13. package/dist/userRepository/relationship/block/api/blockUser.d.ts.map +1 -1
  14. package/dist/userRepository/relationship/follow/api/follow.d.ts.map +1 -1
  15. package/dist/userRepository/relationship/follow/api/getAllFollowings.d.ts +35 -0
  16. package/dist/userRepository/relationship/follow/api/getAllFollowings.d.ts.map +1 -0
  17. package/dist/userRepository/relationship/follow/api/index.d.ts +1 -0
  18. package/dist/userRepository/relationship/follow/api/index.d.ts.map +1 -1
  19. package/dist/userRepository/relationship/follow/api/tests/getAllFollowings.test.d.ts +2 -0
  20. package/dist/userRepository/relationship/follow/api/tests/getAllFollowings.test.d.ts.map +1 -0
  21. package/dist/userRepository/relationship/follow/api/tests/integration/getAllFollowings.integration.test.d.ts +2 -0
  22. package/dist/userRepository/relationship/follow/api/tests/integration/getAllFollowings.integration.test.d.ts.map +1 -0
  23. package/dist/userRepository/relationship/follow/api/unfollow.d.ts.map +1 -1
  24. package/dist/userRepository/services/FollowingSyncEngine/followRealtimeOnLoginHandler.d.ts +16 -0
  25. package/dist/userRepository/services/FollowingSyncEngine/followRealtimeOnLoginHandler.d.ts.map +1 -0
  26. package/dist/userRepository/services/FollowingSyncEngine/followingSyncEngine.d.ts +61 -0
  27. package/dist/userRepository/services/FollowingSyncEngine/followingSyncEngine.d.ts.map +1 -0
  28. package/dist/userRepository/services/FollowingSyncEngine/followingSyncEngineOnLoginHandler.d.ts +3 -0
  29. package/dist/userRepository/services/FollowingSyncEngine/followingSyncEngineOnLoginHandler.d.ts.map +1 -0
  30. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"blockUser.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/block/api/blockUser.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,WACZ,MAAM,YAAY,CAAC,QAAQ,CAAC,KACnC,QAAQ,MAAM,cAAc,CAmC9B,CAAC"}
1
+ {"version":3,"file":"blockUser.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/block/api/blockUser.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,WACZ,MAAM,YAAY,CAAC,QAAQ,CAAC,KACnC,QAAQ,MAAM,cAAc,CA4C9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"follow.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/follow.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,WACT,MAAM,YAAY,CAAC,QAAQ,CAAC,KACnC,QAAQ,MAAM,MAAM,CAAC,MAAM,YAAY,CAAC,CA0B1C,CAAC"}
1
+ {"version":3,"file":"follow.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/follow.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,WACT,MAAM,YAAY,CAAC,QAAQ,CAAC,KACnC,QAAQ,MAAM,MAAM,CAAC,MAAM,YAAY,CAAC,CA6B1C,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * ```js
3
+ * import { UserRepository } from '@amityco/ts-sdk'
4
+ *
5
+ * const followings = await UserRepository.Relationship.getAllFollowings()
6
+ * const statusOf = new Map(followings.map(f => [f.userId, f.status]))
7
+ * // 'accepted' → no button; 'pending' → Pending; missing → Follow
8
+ * ```
9
+ *
10
+ * Returns whom the signed-in user follows as a one-shot list of at most 5,000 (the most a
11
+ * user can follow), from one request with no paging: each followed user's id and the
12
+ * follow's status — `accepted`, or `pending` for a request not yet accepted. A user
13
+ * missing from the list is not followed. The list holds ids and statuses only, no user
14
+ * profiles.
15
+ *
16
+ * Use it to show the follow button next to each author in the post feed: match each
17
+ * author by user id against `userId`.
18
+ *
19
+ * Keeping the app current: the function answers once, so call it again to see changes —
20
+ * for example when more posts load, when the feed comes back into view, or on a follow
21
+ * event (`onUserFollowed`, `onUserUnfollowed`, `onFollowRequestAccepted`). The answer is
22
+ * kept on the device for 5 minutes, so a call within that window costs no request. Changes
23
+ * made in this app show at once. Changes made elsewhere — on another device, or by the
24
+ * other user accepting a request or removing the user as a follower — show once their
25
+ * real-time event arrives; the SDK receives these on the followers and followings topics
26
+ * of `AmityAutoSubscription.BLOCK`, on by default. An event missed while offline, or with
27
+ * that subscription turned off, shows at the next fetch, after the 5 minutes.
28
+ *
29
+ * @returns A promise that resolves to the signed-in user's {@link Amity.FollowingUserStatus} list
30
+ *
31
+ * @category Follow API
32
+ * @async
33
+ */
34
+ export declare const getAllFollowings: () => Promise<Amity.FollowingUserStatus[]>;
35
+ //# sourceMappingURL=getAllFollowings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllFollowings.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/getAllFollowings.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gBAAgB,QAAa,QAAQ,MAAM,mBAAmB,EAAE,CAU5E,CAAC"}
@@ -2,4 +2,5 @@ export * from './follow';
2
2
  export * from './unfollow';
3
3
  export * from './acceptMyFollower';
4
4
  export * from './declineMyFollower';
5
+ export * from './getAllFollowings';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getAllFollowings.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllFollowings.test.d.ts","sourceRoot":"","sources":["../../../../../../src/userRepository/relationship/follow/api/tests/getAllFollowings.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getAllFollowings.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllFollowings.integration.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/userRepository/relationship/follow/api/tests/integration/getAllFollowings.integration.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"unfollow.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/unfollow.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,WAAkB,MAAM,YAAY,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAiBpF,CAAC"}
1
+ {"version":3,"file":"unfollow.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/relationship/follow/api/unfollow.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,WAAkB,MAAM,YAAY,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAoBpF,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Keeps `getAllFollowings()` current for the whole session: every follow change — from
3
+ * this device (local echo) or another (MQTT) — goes to `FollowingSyncEngine.onFollowChanged`,
4
+ * which ignores follows of other users and applies the rest by status: a follow adds the
5
+ * user as accepted, a request as pending, an accepted request turns accepted, and an
6
+ * unfollow, a canceled or declined request, a removed follower or a block takes the user out.
7
+ * `blockUser` also calls the engine itself: its local event swaps `from` and `to`.
8
+ * The MQTT events arrive on the followers and followings topics of the BLOCK
9
+ * auto-subscription (on by default).
10
+ *
11
+ * Registered via `setupLoginSubscriptions`; the returned unsubscriber is torn
12
+ * down on logout.
13
+ */
14
+ declare const _default: () => Amity.Unsubscriber;
15
+ export default _default;
16
+ //# sourceMappingURL=followRealtimeOnLoginHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"followRealtimeOnLoginHandler.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/services/FollowingSyncEngine/followRealtimeOnLoginHandler.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;GAYG;8BACgB,MAAM,YAAY;AAArC,wBAkBE"}
@@ -0,0 +1,61 @@
1
+ declare type FollowChange = Pick<Amity.FollowStatus, 'from' | 'to' | 'status'>;
2
+ /**
3
+ * Session-scoped singleton engine behind `getAllFollowings()`: a 5-minute fetch gate
4
+ * on `GET /api/v4/me/following-ids`, copied from BlockedUserSyncEngine.
5
+ *
6
+ * - `onSessionEstablished()` is a no-op — the fetch is lazy, on the first call
7
+ * - `onSessionDestroyed()` resets `lastFetchedAt` and empties the list, so the next
8
+ * session fetches again
9
+ * - `ensureFetched()` fetches only when the window expired or nothing was fetched yet;
10
+ * `lastFetchedAt` moves only on success
11
+ * - the answer holds ids and statuses only, so the engine keeps it in memory — user id →
12
+ * status — replaced on each fetch, never merged: a follow removed on another device
13
+ * drops out at the next fetch. Nothing is written to the follow or user cache.
14
+ * - `onFollowChanged()` applies every follow change of the session by its status; a change
15
+ * that arrives while a fetch is in flight is replayed on top of the answer, so the older
16
+ * answer does not drop it. Concurrent calls share one in-flight fetch.
17
+ *
18
+ * @internal
19
+ */
20
+ declare class FollowingSyncEngine {
21
+ /** Epoch ms of the last successful fetch. null = never fetched in this session. */
22
+ private lastFetchedAt;
23
+ /** user id → status, in order: the session's changes first, then the answer's order. */
24
+ private followings;
25
+ /** Bumped on sign-out, so a fetch from the old session cannot fill the new one. */
26
+ private session;
27
+ /** The in-flight fetch, shared by concurrent calls. */
28
+ private fetching;
29
+ /** Changes applied while `fetching` is in flight, replayed on top of its answer. */
30
+ private changesDuringFetch;
31
+ /** No-op — the fetch is lazy, triggered by getAllFollowings(). */
32
+ onSessionEstablished(): void;
33
+ /** Resets the window so the next session starts with a fresh fetch. */
34
+ onSessionDestroyed(): void;
35
+ /** No-op — the window does not depend on the token. */
36
+ onTokenExpired(): void;
37
+ /**
38
+ * Called for every follow change the SDK sees during the session. A follow whose
39
+ * `from` is another user is ignored. Status `accepted` or `pending` sets the user with
40
+ * that status and moves them to the front; any other status (`none` after an unfollow,
41
+ * a cancel, a decline or a removed follower; `blocked`) removes them.
42
+ */
43
+ onFollowChanged(follow?: FollowChange): void;
44
+ private apply;
45
+ private isCacheExpired;
46
+ /**
47
+ * Fetches whom the user follows (up to 5,000 ids and statuses, one response, no
48
+ * `status` so both accepted and pending come back) when the window has expired. A
49
+ * failure propagates and leaves the window and the list unchanged, so the next call
50
+ * retries.
51
+ */
52
+ ensureFetched(): Promise<void>;
53
+ private fetch;
54
+ /** The kept entries, in order. */
55
+ getFollowings(): Amity.FollowingUserStatus[];
56
+ }
57
+ declare const _default: {
58
+ getInstance: () => FollowingSyncEngine;
59
+ };
60
+ export default _default;
61
+ //# sourceMappingURL=followingSyncEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"followingSyncEngine.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/services/FollowingSyncEngine/followingSyncEngine.ts"],"names":[],"mappings":"AAMA,aAAK,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;AAKvE;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAM,mBAAmB;IACvB,mFAAmF;IACnF,OAAO,CAAC,aAAa,CAAuB;IAE5C,wFAAwF;IACxF,OAAO,CAAC,UAAU,CAA4D;IAE9E,mFAAmF;IACnF,OAAO,CAAC,OAAO,CAAK;IAEpB,uDAAuD;IACvD,OAAO,CAAC,QAAQ,CAA8B;IAE9C,oFAAoF;IACpF,OAAO,CAAC,kBAAkB,CAAsB;IAEhD,kEAAkE;IAElE,oBAAoB,IAAI,IAAI;IAI5B,uEAAuE;IACvE,kBAAkB,IAAI,IAAI;IAQ1B,uDAAuD;IAEvD,cAAc,IAAI,IAAI;IAItB;;;;;OAKG;IACH,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI;IAO5C,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,cAAc;IAKtB;;;;;OAKG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;YAgBtB,KAAK;IAkBnB,kCAAkC;IAClC,aAAa,IAAI,KAAK,CAAC,mBAAmB,EAAE;CAG7C;;uBAKkB,mBAAmB;;AADtC,wBAKE"}
@@ -0,0 +1,3 @@
1
+ declare const _default: () => () => void;
2
+ export default _default;
3
+ //# sourceMappingURL=followingSyncEngineOnLoginHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"followingSyncEngineOnLoginHandler.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/services/FollowingSyncEngine/followingSyncEngineOnLoginHandler.ts"],"names":[],"mappings":";AAGA,wBAgBE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.33.1",
3
+ "version": "7.33.2-2476596b.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",