@singi-labs/sifa-sdk 0.11.22 → 0.11.24

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 (43) hide show
  1. package/dist/{adult-content-B6aagF8N.d.cts → adult-content-BaQjQsbN.d.cts} +78 -0
  2. package/dist/{adult-content-B6aagF8N.d.ts → adult-content-BaQjQsbN.d.ts} +78 -0
  3. package/dist/{feed-BaHtJXYR.d.cts → feed--omSiO_S.d.cts} +74 -1
  4. package/dist/{feed-BaHtJXYR.d.ts → feed--omSiO_S.d.ts} +74 -1
  5. package/dist/index-BV2QGy4u.d.ts +261 -0
  6. package/dist/index-C4UvwkKA.d.cts +261 -0
  7. package/dist/index-CHPSoiWb.d.cts +611 -0
  8. package/dist/index-Cw0Ows0u.d.ts +611 -0
  9. package/dist/index.cjs +56 -1
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +27 -7
  12. package/dist/index.d.ts +27 -7
  13. package/dist/index.js +53 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/{keys-D3urUnj8.d.cts → keys-BdLh1txD.d.cts} +2 -2
  16. package/dist/{keys-cT1ORNOu.d.ts → keys-Czq74eql.d.ts} +2 -2
  17. package/dist/query/fetchers/index.cjs +11 -0
  18. package/dist/query/fetchers/index.cjs.map +1 -1
  19. package/dist/query/fetchers/index.d.cts +4 -247
  20. package/dist/query/fetchers/index.d.ts +4 -247
  21. package/dist/query/fetchers/index.js +11 -0
  22. package/dist/query/fetchers/index.js.map +1 -1
  23. package/dist/query/hooks/index.cjs +11 -0
  24. package/dist/query/hooks/index.cjs.map +1 -1
  25. package/dist/query/hooks/index.d.cts +6 -558
  26. package/dist/query/hooks/index.d.ts +6 -558
  27. package/dist/query/hooks/index.js +11 -0
  28. package/dist/query/hooks/index.js.map +1 -1
  29. package/dist/query/index.cjs +47 -0
  30. package/dist/query/index.cjs.map +1 -1
  31. package/dist/query/index.d.cts +6 -6
  32. package/dist/query/index.d.ts +6 -6
  33. package/dist/query/index.js +44 -1
  34. package/dist/query/index.js.map +1 -1
  35. package/dist/schemas/index.cjs +37 -0
  36. package/dist/schemas/index.cjs.map +1 -1
  37. package/dist/schemas/index.d.cts +30 -397
  38. package/dist/schemas/index.d.ts +30 -397
  39. package/dist/schemas/index.js +32 -1
  40. package/dist/schemas/index.js.map +1 -1
  41. package/dist/shared-CHCY7Lst.d.cts +416 -0
  42. package/dist/shared-CHCY7Lst.d.ts +416 -0
  43. package/package.json +1 -1
@@ -0,0 +1,261 @@
1
+ import { S as SifaApiConfig, A as ApiFetchOptions, j as CreateResult, W as WriteResult } from './keys-Czq74eql.js';
2
+ import { d as Profile, t as ProfilePosition, z as SkillRef } from './adult-content-BaQjQsbN.js';
3
+ import { i as EntitySearchResponse, k as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, m as EntitySelectRequest, o as EntitySelectResponse } from './feed--omSiO_S.js';
4
+
5
+ /**
6
+ * Read the aggregated profile for a handle or DID.
7
+ *
8
+ * Returns `null` when the AppView has no profile for the given identifier
9
+ * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.
10
+ *
11
+ * Server-callable (Next.js RSC) and client-callable (Expo, browser).
12
+ */
13
+ declare function fetchProfile(config: SifaApiConfig, handleOrDid: string, options?: ApiFetchOptions): Promise<Profile | null>;
14
+ /**
15
+ * Public AT Fund link for a profile, if one is configured. Returns `null`
16
+ * on any error or when the response payload's `url` field is missing or
17
+ * non-string.
18
+ */
19
+ declare function fetchAtFundLink(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<string | null>;
20
+
21
+ /**
22
+ * Create a new `id.sifa.profile.position` record on the authenticated
23
+ * user's PDS. The AppView signs and writes via the user's OAuth session.
24
+ *
25
+ * `data` should be a lexicon-shaped position record (without `createdAt`
26
+ * or `rkey`; the AppView fills both). Validate with
27
+ * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling
28
+ * if you want client-side guarantees.
29
+ *
30
+ * Never throws -- inspect `result.success` and use `result.error` /
31
+ * `result.pdsHost` for UI messaging.
32
+ */
33
+ declare function createPosition(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
34
+ /** Update an existing position by `rkey`. */
35
+ declare function updatePosition(config: SifaApiConfig, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
36
+ /** Delete a position by `rkey`. */
37
+ declare function deletePosition(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
38
+ /** Mark a position as the user's primary (current) role. */
39
+ declare function setPositionPrimary(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
40
+ /** Clear the "primary" flag on a position. */
41
+ declare function unsetPositionPrimary(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
42
+ /**
43
+ * Add a skill link to a position. Idempotent: if the skill is already
44
+ * linked, resolves to `{ success: true }` without a network call.
45
+ *
46
+ * Implementation note: the AppView only exposes whole-record PUTs, so
47
+ * this helper rebuilds the position body with the new skills list.
48
+ */
49
+ declare function linkSkillToPosition(config: SifaApiConfig, position: ProfilePosition, skillRef: SkillRef, options?: ApiFetchOptions): Promise<WriteResult>;
50
+ /** Remove a skill link from a position. */
51
+ declare function unlinkSkillFromPosition(config: SifaApiConfig, position: ProfilePosition, skillRef: SkillRef, options?: ApiFetchOptions): Promise<WriteResult>;
52
+
53
+ /**
54
+ * Create a new `id.sifa.profile.education` record on the authenticated
55
+ * user's PDS.
56
+ */
57
+ declare function createEducation(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
58
+ /** Update an existing education record by `rkey`. */
59
+ declare function updateEducation(config: SifaApiConfig, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
60
+ /** Delete an education record by `rkey`. */
61
+ declare function deleteEducation(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
62
+
63
+ /**
64
+ * Create a new `id.sifa.profile.skill` record on the authenticated
65
+ * user's PDS.
66
+ */
67
+ declare function createSkill(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
68
+ /** Update an existing skill record by `rkey`. */
69
+ declare function updateSkill(config: SifaApiConfig, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
70
+ /** Delete a skill record by `rkey`. */
71
+ declare function deleteSkill(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
72
+
73
+ /**
74
+ * Generic record-create escape hatch. Most callers should prefer the
75
+ * dedicated section helpers (`createPosition`, `createEducation`, etc.)
76
+ * which take typed payloads and ship matching hooks. Use this when the
77
+ * lexicon doesn't yet have a dedicated endpoint (certifications,
78
+ * projects, publications, volunteering, honors, languages, courses).
79
+ *
80
+ * `collection` is a `id.sifa.profile.*` collection NSID. Routes to
81
+ * `POST /api/profile/records/<collection>`.
82
+ */
83
+ declare function createRecord(config: SifaApiConfig, collection: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
84
+ /** Generic record-update escape hatch. See {@link createRecord}. */
85
+ declare function updateRecord(config: SifaApiConfig, collection: string, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
86
+ /** Generic record-delete escape hatch. See {@link createRecord}. */
87
+ declare function deleteRecord(config: SifaApiConfig, collection: string, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
88
+
89
+ /**
90
+ * Hide a keytrace claim (verified-account claim discovered on the
91
+ * user's external accounts) from the user's profile. The claim itself
92
+ * stays in the index; only its display is suppressed.
93
+ */
94
+ declare function hideKeytraceClaim(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
95
+ /** Restore a previously-hidden keytrace claim. */
96
+ declare function unhideKeytraceClaim(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
97
+
98
+ /**
99
+ * Make a Marque-registered domain public in the owner's Links section. Marque
100
+ * domains are owner-only by default; this reveals one. `domain` is the
101
+ * at.marque.domain rkey (the domain name itself).
102
+ */
103
+ declare function revealMarqueDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<WriteResult>;
104
+ /** Make a previously-revealed Marque domain owner-only again. */
105
+ declare function unrevealMarqueDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<WriteResult>;
106
+
107
+ /**
108
+ * Organization typeahead. Returns curated entities first, then the PDL crawl,
109
+ * deduped by domain. Empty input returns an empty result without a network call.
110
+ */
111
+ declare function fetchEntitySearch(config: SifaApiConfig, query: string, limit?: number, options?: ApiFetchOptions): Promise<EntitySearchResponse>;
112
+ /**
113
+ * Record a selection: promote a PDL row into a canonical entity (dedupe by
114
+ * domain) or bump an existing entity's usage counter. Returns the entity plus
115
+ * its portable `entityRef` (null for PDL-only entities). Requires a session.
116
+ */
117
+ declare function selectEntity(config: SifaApiConfig, body: EntitySelectRequest, options?: ApiFetchOptions): Promise<EntitySelectResponse>;
118
+ /**
119
+ * Grow-on-demand: when the local typeahead misses, resolve the query live via
120
+ * Wikidata, import the org-class matches, and return them. Requires a session.
121
+ * Empty input returns an empty array without a network call.
122
+ */
123
+ declare function importSearchEntities(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<EntitySearchResult[]>;
124
+ /**
125
+ * Grow-on-demand by domain, Branch 1: when a domain-shaped typeahead query
126
+ * misses locally, resolve any notable company whose official website is that
127
+ * domain (Wikidata reverse P856), importing the matches. Read-only w.r.t.
128
+ * minting. `canMint` tells the caller whether to offer the user-initiated
129
+ * "Add <domain>" affordance. Requires a session.
130
+ */
131
+ declare function resolveEntityDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<EntityResolveDomainResponse>;
132
+ /**
133
+ * Grow-on-demand by domain, Branch 2 (user-initiated): mint a crawled-tier
134
+ * entity from the domain's own homepage (or resolve it to a notable company if
135
+ * one exists). Throws on a non-2xx response (domain not mintable, or the site
136
+ * yielded nothing usable). Requires a session.
137
+ */
138
+ declare function mintEntityDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<EntityMintDomainResponse>;
139
+
140
+ /**
141
+ * Counts confirmed endorsements received by a DID. The backend's
142
+ * `GET /api/endorsement/:did` already returns only confirmed endorsements
143
+ * (via inner join with `endorsementConfirmations`), so this helper just
144
+ * returns the array length. Failures return 0 so callers can route safely.
145
+ *
146
+ * Public endpoint -- no credentials needed.
147
+ */
148
+ declare function fetchEndorsementCount(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<number>;
149
+
150
+ interface FetchNetworkStreamCountOptions extends ApiFetchOptions {
151
+ /**
152
+ * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
153
+ * Required for authenticated server fetches because `credentials: 'include'`
154
+ * does not propagate browser cookies in RSC.
155
+ *
156
+ * When omitted, the request falls back to `credentials: 'include'` so
157
+ * client-side calls work without extra plumbing.
158
+ */
159
+ cookieHeader?: string;
160
+ }
161
+ /**
162
+ * Counts items in the authenticated user's network stream digest. The
163
+ * underlying `GET /api/stream/network` endpoint may 404 while the feature
164
+ * is in development; in that case (and on any other error) this returns
165
+ * 0 so callers can route safely to a fallback experience.
166
+ */
167
+ declare function fetchNetworkStreamCount(config: SifaApiConfig, did: string, options?: FetchNetworkStreamCountOptions): Promise<number>;
168
+
169
+ /** A node in the personal network graph. */
170
+ interface NetworkMapNode {
171
+ did: string;
172
+ handle: string;
173
+ displayName: string;
174
+ avatar: string | null;
175
+ /** Number of edges this node participates in within the rendered graph. */
176
+ degree: number;
177
+ /** Phase 2: community detection cluster id. */
178
+ cluster?: number;
179
+ /** Phase 2: pre-computed layout coordinates. */
180
+ x?: number;
181
+ y?: number;
182
+ }
183
+ /** A directed edge in the personal network graph. */
184
+ interface NetworkMapEdge {
185
+ source: string;
186
+ target: string;
187
+ mutual: boolean;
188
+ /** Networks this edge was observed in, e.g. `['sifa', 'bluesky']`. */
189
+ sources: string[];
190
+ }
191
+ /** The graph payload itself, decoupled from response metadata. */
192
+ interface NetworkMapGraphData {
193
+ nodes: NetworkMapNode[];
194
+ edges: NetworkMapEdge[];
195
+ /** Phase 2: cluster metadata for legend rendering. */
196
+ clusters?: Array<{
197
+ id: number;
198
+ label: string;
199
+ color: string;
200
+ }>;
201
+ }
202
+ /** Cached graph response. */
203
+ interface NetworkMapResponse {
204
+ generatedAt: string;
205
+ expiresAt: string;
206
+ graph: NetworkMapGraphData;
207
+ stats: {
208
+ totalNodes: number;
209
+ totalEdges: number;
210
+ mutualCount: number;
211
+ sources: Record<string, number>;
212
+ };
213
+ }
214
+ /** Async job tracking generation progress. */
215
+ interface NetworkMapGenerationJob {
216
+ jobId: string;
217
+ did: string;
218
+ status: 'pending' | 'complete' | 'failed';
219
+ /** 0..100 */
220
+ progress: number;
221
+ createdAt: string;
222
+ completedAt?: string;
223
+ error?: string;
224
+ /**
225
+ * Queue position when the job is still pending and not yet picked up
226
+ * by the worker. 0 = next to run. Absent for in-flight or terminal
227
+ * jobs (and for any backend that doesn't yet report position).
228
+ */
229
+ position?: number;
230
+ /**
231
+ * Estimated remaining seconds, derived server-side from the median
232
+ * historical duration for the user's follow-count bucket multiplied
233
+ * by `position + 1`. Absent when no historical data exists yet.
234
+ */
235
+ etaSeconds?: number;
236
+ }
237
+ /** Returned by `initiateNetworkMapGeneration` when a new job was started or one was already running. */
238
+ interface NetworkMapPendingJob {
239
+ jobId: string;
240
+ status: 'pending' | 'cached';
241
+ }
242
+ /** Discriminate the union returned by `initiateNetworkMapGeneration`. */
243
+ declare function isNetworkMapResponse(value: NetworkMapPendingJob | NetworkMapResponse): value is NetworkMapResponse;
244
+ /**
245
+ * Kick off a personal network-map computation. The backend returns the
246
+ * cached map immediately when fresh, otherwise it returns a job id that
247
+ * the caller polls via `checkNetworkMapJobStatus`.
248
+ */
249
+ declare function initiateNetworkMapGeneration(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapPendingJob | NetworkMapResponse>;
250
+ /**
251
+ * Poll the status of an in-flight generation job. Throws on 404 (unknown
252
+ * or expired job) — callers may want to treat that as terminal failure.
253
+ */
254
+ declare function checkNetworkMapJobStatus(config: SifaApiConfig, jobId: string, options?: ApiFetchOptions): Promise<NetworkMapGenerationJob>;
255
+ /**
256
+ * Fetch the most recent cached network map for the authenticated user.
257
+ * Returns `null` when no map has ever been generated (404).
258
+ */
259
+ declare function fetchNetworkMap(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapResponse | null>;
260
+
261
+ export { resolveEntityDomain as A, revealMarqueDomain as B, selectEntity as C, setPositionPrimary as D, unhideKeytraceClaim as E, type FetchNetworkStreamCountOptions as F, unlinkSkillFromPosition as G, unrevealMarqueDomain as H, unsetPositionPrimary as I, updateEducation as J, updatePosition as K, updateRecord as L, updateSkill as M, type NetworkMapEdge as N, type NetworkMapGenerationJob as a, type NetworkMapGraphData as b, type NetworkMapNode as c, type NetworkMapPendingJob as d, type NetworkMapResponse as e, checkNetworkMapJobStatus as f, createEducation as g, createPosition as h, createRecord as i, createSkill as j, deleteEducation as k, deletePosition as l, deleteRecord as m, deleteSkill as n, fetchAtFundLink as o, fetchEndorsementCount as p, fetchEntitySearch as q, fetchNetworkMap as r, fetchNetworkStreamCount as s, fetchProfile as t, hideKeytraceClaim as u, importSearchEntities as v, initiateNetworkMapGeneration as w, isNetworkMapResponse as x, linkSkillToPosition as y, mintEntityDomain as z };
@@ -0,0 +1,261 @@
1
+ import { S as SifaApiConfig, A as ApiFetchOptions, j as CreateResult, W as WriteResult } from './keys-BdLh1txD.cjs';
2
+ import { d as Profile, t as ProfilePosition, z as SkillRef } from './adult-content-BaQjQsbN.cjs';
3
+ import { i as EntitySearchResponse, k as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, m as EntitySelectRequest, o as EntitySelectResponse } from './feed--omSiO_S.cjs';
4
+
5
+ /**
6
+ * Read the aggregated profile for a handle or DID.
7
+ *
8
+ * Returns `null` when the AppView has no profile for the given identifier
9
+ * (HTTP 404). Throws {@link ApiError} on other non-2xx responses.
10
+ *
11
+ * Server-callable (Next.js RSC) and client-callable (Expo, browser).
12
+ */
13
+ declare function fetchProfile(config: SifaApiConfig, handleOrDid: string, options?: ApiFetchOptions): Promise<Profile | null>;
14
+ /**
15
+ * Public AT Fund link for a profile, if one is configured. Returns `null`
16
+ * on any error or when the response payload's `url` field is missing or
17
+ * non-string.
18
+ */
19
+ declare function fetchAtFundLink(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<string | null>;
20
+
21
+ /**
22
+ * Create a new `id.sifa.profile.position` record on the authenticated
23
+ * user's PDS. The AppView signs and writes via the user's OAuth session.
24
+ *
25
+ * `data` should be a lexicon-shaped position record (without `createdAt`
26
+ * or `rkey`; the AppView fills both). Validate with
27
+ * `ProfilePositionRecordSchema.omit({ createdAt: true })` before calling
28
+ * if you want client-side guarantees.
29
+ *
30
+ * Never throws -- inspect `result.success` and use `result.error` /
31
+ * `result.pdsHost` for UI messaging.
32
+ */
33
+ declare function createPosition(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
34
+ /** Update an existing position by `rkey`. */
35
+ declare function updatePosition(config: SifaApiConfig, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
36
+ /** Delete a position by `rkey`. */
37
+ declare function deletePosition(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
38
+ /** Mark a position as the user's primary (current) role. */
39
+ declare function setPositionPrimary(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
40
+ /** Clear the "primary" flag on a position. */
41
+ declare function unsetPositionPrimary(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
42
+ /**
43
+ * Add a skill link to a position. Idempotent: if the skill is already
44
+ * linked, resolves to `{ success: true }` without a network call.
45
+ *
46
+ * Implementation note: the AppView only exposes whole-record PUTs, so
47
+ * this helper rebuilds the position body with the new skills list.
48
+ */
49
+ declare function linkSkillToPosition(config: SifaApiConfig, position: ProfilePosition, skillRef: SkillRef, options?: ApiFetchOptions): Promise<WriteResult>;
50
+ /** Remove a skill link from a position. */
51
+ declare function unlinkSkillFromPosition(config: SifaApiConfig, position: ProfilePosition, skillRef: SkillRef, options?: ApiFetchOptions): Promise<WriteResult>;
52
+
53
+ /**
54
+ * Create a new `id.sifa.profile.education` record on the authenticated
55
+ * user's PDS.
56
+ */
57
+ declare function createEducation(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
58
+ /** Update an existing education record by `rkey`. */
59
+ declare function updateEducation(config: SifaApiConfig, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
60
+ /** Delete an education record by `rkey`. */
61
+ declare function deleteEducation(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
62
+
63
+ /**
64
+ * Create a new `id.sifa.profile.skill` record on the authenticated
65
+ * user's PDS.
66
+ */
67
+ declare function createSkill(config: SifaApiConfig, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
68
+ /** Update an existing skill record by `rkey`. */
69
+ declare function updateSkill(config: SifaApiConfig, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
70
+ /** Delete a skill record by `rkey`. */
71
+ declare function deleteSkill(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
72
+
73
+ /**
74
+ * Generic record-create escape hatch. Most callers should prefer the
75
+ * dedicated section helpers (`createPosition`, `createEducation`, etc.)
76
+ * which take typed payloads and ship matching hooks. Use this when the
77
+ * lexicon doesn't yet have a dedicated endpoint (certifications,
78
+ * projects, publications, volunteering, honors, languages, courses).
79
+ *
80
+ * `collection` is a `id.sifa.profile.*` collection NSID. Routes to
81
+ * `POST /api/profile/records/<collection>`.
82
+ */
83
+ declare function createRecord(config: SifaApiConfig, collection: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<CreateResult>;
84
+ /** Generic record-update escape hatch. See {@link createRecord}. */
85
+ declare function updateRecord(config: SifaApiConfig, collection: string, rkey: string, data: Record<string, unknown>, options?: ApiFetchOptions): Promise<WriteResult>;
86
+ /** Generic record-delete escape hatch. See {@link createRecord}. */
87
+ declare function deleteRecord(config: SifaApiConfig, collection: string, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
88
+
89
+ /**
90
+ * Hide a keytrace claim (verified-account claim discovered on the
91
+ * user's external accounts) from the user's profile. The claim itself
92
+ * stays in the index; only its display is suppressed.
93
+ */
94
+ declare function hideKeytraceClaim(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
95
+ /** Restore a previously-hidden keytrace claim. */
96
+ declare function unhideKeytraceClaim(config: SifaApiConfig, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
97
+
98
+ /**
99
+ * Make a Marque-registered domain public in the owner's Links section. Marque
100
+ * domains are owner-only by default; this reveals one. `domain` is the
101
+ * at.marque.domain rkey (the domain name itself).
102
+ */
103
+ declare function revealMarqueDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<WriteResult>;
104
+ /** Make a previously-revealed Marque domain owner-only again. */
105
+ declare function unrevealMarqueDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<WriteResult>;
106
+
107
+ /**
108
+ * Organization typeahead. Returns curated entities first, then the PDL crawl,
109
+ * deduped by domain. Empty input returns an empty result without a network call.
110
+ */
111
+ declare function fetchEntitySearch(config: SifaApiConfig, query: string, limit?: number, options?: ApiFetchOptions): Promise<EntitySearchResponse>;
112
+ /**
113
+ * Record a selection: promote a PDL row into a canonical entity (dedupe by
114
+ * domain) or bump an existing entity's usage counter. Returns the entity plus
115
+ * its portable `entityRef` (null for PDL-only entities). Requires a session.
116
+ */
117
+ declare function selectEntity(config: SifaApiConfig, body: EntitySelectRequest, options?: ApiFetchOptions): Promise<EntitySelectResponse>;
118
+ /**
119
+ * Grow-on-demand: when the local typeahead misses, resolve the query live via
120
+ * Wikidata, import the org-class matches, and return them. Requires a session.
121
+ * Empty input returns an empty array without a network call.
122
+ */
123
+ declare function importSearchEntities(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<EntitySearchResult[]>;
124
+ /**
125
+ * Grow-on-demand by domain, Branch 1: when a domain-shaped typeahead query
126
+ * misses locally, resolve any notable company whose official website is that
127
+ * domain (Wikidata reverse P856), importing the matches. Read-only w.r.t.
128
+ * minting. `canMint` tells the caller whether to offer the user-initiated
129
+ * "Add <domain>" affordance. Requires a session.
130
+ */
131
+ declare function resolveEntityDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<EntityResolveDomainResponse>;
132
+ /**
133
+ * Grow-on-demand by domain, Branch 2 (user-initiated): mint a crawled-tier
134
+ * entity from the domain's own homepage (or resolve it to a notable company if
135
+ * one exists). Throws on a non-2xx response (domain not mintable, or the site
136
+ * yielded nothing usable). Requires a session.
137
+ */
138
+ declare function mintEntityDomain(config: SifaApiConfig, domain: string, options?: ApiFetchOptions): Promise<EntityMintDomainResponse>;
139
+
140
+ /**
141
+ * Counts confirmed endorsements received by a DID. The backend's
142
+ * `GET /api/endorsement/:did` already returns only confirmed endorsements
143
+ * (via inner join with `endorsementConfirmations`), so this helper just
144
+ * returns the array length. Failures return 0 so callers can route safely.
145
+ *
146
+ * Public endpoint -- no credentials needed.
147
+ */
148
+ declare function fetchEndorsementCount(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<number>;
149
+
150
+ interface FetchNetworkStreamCountOptions extends ApiFetchOptions {
151
+ /**
152
+ * Pass the caller's `Cookie` header on Next.js RSC server-side calls.
153
+ * Required for authenticated server fetches because `credentials: 'include'`
154
+ * does not propagate browser cookies in RSC.
155
+ *
156
+ * When omitted, the request falls back to `credentials: 'include'` so
157
+ * client-side calls work without extra plumbing.
158
+ */
159
+ cookieHeader?: string;
160
+ }
161
+ /**
162
+ * Counts items in the authenticated user's network stream digest. The
163
+ * underlying `GET /api/stream/network` endpoint may 404 while the feature
164
+ * is in development; in that case (and on any other error) this returns
165
+ * 0 so callers can route safely to a fallback experience.
166
+ */
167
+ declare function fetchNetworkStreamCount(config: SifaApiConfig, did: string, options?: FetchNetworkStreamCountOptions): Promise<number>;
168
+
169
+ /** A node in the personal network graph. */
170
+ interface NetworkMapNode {
171
+ did: string;
172
+ handle: string;
173
+ displayName: string;
174
+ avatar: string | null;
175
+ /** Number of edges this node participates in within the rendered graph. */
176
+ degree: number;
177
+ /** Phase 2: community detection cluster id. */
178
+ cluster?: number;
179
+ /** Phase 2: pre-computed layout coordinates. */
180
+ x?: number;
181
+ y?: number;
182
+ }
183
+ /** A directed edge in the personal network graph. */
184
+ interface NetworkMapEdge {
185
+ source: string;
186
+ target: string;
187
+ mutual: boolean;
188
+ /** Networks this edge was observed in, e.g. `['sifa', 'bluesky']`. */
189
+ sources: string[];
190
+ }
191
+ /** The graph payload itself, decoupled from response metadata. */
192
+ interface NetworkMapGraphData {
193
+ nodes: NetworkMapNode[];
194
+ edges: NetworkMapEdge[];
195
+ /** Phase 2: cluster metadata for legend rendering. */
196
+ clusters?: Array<{
197
+ id: number;
198
+ label: string;
199
+ color: string;
200
+ }>;
201
+ }
202
+ /** Cached graph response. */
203
+ interface NetworkMapResponse {
204
+ generatedAt: string;
205
+ expiresAt: string;
206
+ graph: NetworkMapGraphData;
207
+ stats: {
208
+ totalNodes: number;
209
+ totalEdges: number;
210
+ mutualCount: number;
211
+ sources: Record<string, number>;
212
+ };
213
+ }
214
+ /** Async job tracking generation progress. */
215
+ interface NetworkMapGenerationJob {
216
+ jobId: string;
217
+ did: string;
218
+ status: 'pending' | 'complete' | 'failed';
219
+ /** 0..100 */
220
+ progress: number;
221
+ createdAt: string;
222
+ completedAt?: string;
223
+ error?: string;
224
+ /**
225
+ * Queue position when the job is still pending and not yet picked up
226
+ * by the worker. 0 = next to run. Absent for in-flight or terminal
227
+ * jobs (and for any backend that doesn't yet report position).
228
+ */
229
+ position?: number;
230
+ /**
231
+ * Estimated remaining seconds, derived server-side from the median
232
+ * historical duration for the user's follow-count bucket multiplied
233
+ * by `position + 1`. Absent when no historical data exists yet.
234
+ */
235
+ etaSeconds?: number;
236
+ }
237
+ /** Returned by `initiateNetworkMapGeneration` when a new job was started or one was already running. */
238
+ interface NetworkMapPendingJob {
239
+ jobId: string;
240
+ status: 'pending' | 'cached';
241
+ }
242
+ /** Discriminate the union returned by `initiateNetworkMapGeneration`. */
243
+ declare function isNetworkMapResponse(value: NetworkMapPendingJob | NetworkMapResponse): value is NetworkMapResponse;
244
+ /**
245
+ * Kick off a personal network-map computation. The backend returns the
246
+ * cached map immediately when fresh, otherwise it returns a job id that
247
+ * the caller polls via `checkNetworkMapJobStatus`.
248
+ */
249
+ declare function initiateNetworkMapGeneration(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapPendingJob | NetworkMapResponse>;
250
+ /**
251
+ * Poll the status of an in-flight generation job. Throws on 404 (unknown
252
+ * or expired job) — callers may want to treat that as terminal failure.
253
+ */
254
+ declare function checkNetworkMapJobStatus(config: SifaApiConfig, jobId: string, options?: ApiFetchOptions): Promise<NetworkMapGenerationJob>;
255
+ /**
256
+ * Fetch the most recent cached network map for the authenticated user.
257
+ * Returns `null` when no map has ever been generated (404).
258
+ */
259
+ declare function fetchNetworkMap(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapResponse | null>;
260
+
261
+ export { resolveEntityDomain as A, revealMarqueDomain as B, selectEntity as C, setPositionPrimary as D, unhideKeytraceClaim as E, type FetchNetworkStreamCountOptions as F, unlinkSkillFromPosition as G, unrevealMarqueDomain as H, unsetPositionPrimary as I, updateEducation as J, updatePosition as K, updateRecord as L, updateSkill as M, type NetworkMapEdge as N, type NetworkMapGenerationJob as a, type NetworkMapGraphData as b, type NetworkMapNode as c, type NetworkMapPendingJob as d, type NetworkMapResponse as e, checkNetworkMapJobStatus as f, createEducation as g, createPosition as h, createRecord as i, createSkill as j, deleteEducation as k, deletePosition as l, deleteRecord as m, deleteSkill as n, fetchAtFundLink as o, fetchEndorsementCount as p, fetchEntitySearch as q, fetchNetworkMap as r, fetchNetworkStreamCount as s, fetchProfile as t, hideKeytraceClaim as u, importSearchEntities as v, initiateNetworkMapGeneration as w, isNetworkMapResponse as x, linkSkillToPosition as y, mintEntityDomain as z };