hive-react-kit 0.9.0 → 0.9.1
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/components/HiveDetailPost.d.ts +20 -1
- package/dist/components/inlineComments/InlineCommentItem.d.ts +8 -1
- package/dist/components/inlineComments/InlineCommentSection.d.ts +8 -1
- package/dist/index.cjs.js +77 -77
- package/dist/index.esm.js +5788 -5676
- package/dist/services/userService.d.ts +38 -7
- package/package.json +1 -1
|
@@ -2,6 +2,19 @@ import { Follower, Following, UserProfileResponse, Account } from "@/types/user"
|
|
|
2
2
|
import { Post } from "@/types/post";
|
|
3
3
|
import type { Poll } from "@/types/poll";
|
|
4
4
|
import type { PendingAuthorRow, PendingCurationRow } from "@/types/reward";
|
|
5
|
+
/** Default "parent" container for getUserSnaps (kept for backwards compatibility). */
|
|
6
|
+
export declare const DEFAULT_SNAP_PARENT = "peak.snaps";
|
|
7
|
+
/**
|
|
8
|
+
* Known snap-container parents supported by UserDetailProfile's segmented
|
|
9
|
+
* control. Values are the account names queried via `?parent=<account>`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SNAP_SUBTYPE_PARENTS: {
|
|
12
|
+
readonly snaps: "peak.snaps";
|
|
13
|
+
readonly ecency: "ecency.waves";
|
|
14
|
+
readonly threads: "leothreads";
|
|
15
|
+
readonly liketu: "liketu.moments";
|
|
16
|
+
};
|
|
17
|
+
export type SnapSubType = keyof typeof SNAP_SUBTYPE_PARENTS;
|
|
5
18
|
declare class UserService {
|
|
6
19
|
private readonly HIVE_API_URL;
|
|
7
20
|
/** Central fetch wrapper — threads AbortSignal to every network request */
|
|
@@ -19,10 +32,15 @@ declare class UserService {
|
|
|
19
32
|
getUserComments(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
|
|
20
33
|
getUserReplies(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
|
|
21
34
|
/**
|
|
22
|
-
* Fetch snap references for a user from
|
|
23
|
-
* Returns { id, author, permlink }[]
|
|
35
|
+
* Fetch snap references for a user from the hreplier API.
|
|
36
|
+
* Returns `{ id, author, permlink }[]`. The endpoint does not support
|
|
37
|
+
* cursor-based pagination — it returns a single batch, so `startId`
|
|
38
|
+
* is accepted for call-site compatibility but ignored.
|
|
39
|
+
*
|
|
40
|
+
* `parent` selects the container account: `peak.snaps` (Snaps), `ecency.waves`
|
|
41
|
+
* (Ecency waves), `leothreads` (Threads), `liketu.moments` (Liketu moments).
|
|
24
42
|
*/
|
|
25
|
-
getSnapReferences(username: string,
|
|
43
|
+
getSnapReferences(username: string, _startId?: number, signal?: AbortSignal, parent?: string): Promise<{
|
|
26
44
|
id: number;
|
|
27
45
|
author: string;
|
|
28
46
|
permlink: string;
|
|
@@ -33,11 +51,24 @@ declare class UserService {
|
|
|
33
51
|
*/
|
|
34
52
|
private batchGetPosts;
|
|
35
53
|
/**
|
|
36
|
-
* Fetch snaps for a user
|
|
37
|
-
*
|
|
38
|
-
*
|
|
54
|
+
* Fetch a page of snaps for a user via the hreplier API + Hive bridge.get_post.
|
|
55
|
+
*
|
|
56
|
+
* The hreplier endpoint returns the full snap-reference list in one shot and
|
|
57
|
+
* has no server-side pagination, so we cache it per (username, parent) and
|
|
58
|
+
* slice client-side. `startId` is repurposed as the slice offset (20-item
|
|
59
|
+
* pages):
|
|
60
|
+
* - undefined / 0 → first 20 refs
|
|
61
|
+
* - 20, 40, … → subsequent pages
|
|
62
|
+
* `nextStartId` is the next offset to request, or null when exhausted.
|
|
63
|
+
*
|
|
64
|
+
* `parent` selects the container account — see SNAP_SUBTYPE_PARENTS
|
|
65
|
+
* (defaults to `peak.snaps`). Cache is keyed per parent so switching
|
|
66
|
+
* segments never collides.
|
|
67
|
+
*
|
|
68
|
+
* Only the current slice is materialised via bridge.get_post, so switching
|
|
69
|
+
* pages stays snappy.
|
|
39
70
|
*/
|
|
40
|
-
getUserSnaps(username: string, startId?: number, observer?: string, signal?: AbortSignal): Promise<{
|
|
71
|
+
getUserSnaps(username: string, startId?: number, observer?: string, signal?: AbortSignal, parent?: string): Promise<{
|
|
41
72
|
snaps: Post[];
|
|
42
73
|
nextStartId: number | null;
|
|
43
74
|
}>;
|