···24 }
25}
260000000002728/**
29 * Caches the mapping of handles to DIDs to avoid unnecessary API calls to resolveHandle or getProfile.
···289 let postGroups = await Promise.all(batches);
290291 return { cursor: response.cursor, posts: postGroups.flat() };
0000000000000000000000292 }
293294 /**
···24 }
25}
2627+export class HiddenRepliesError extends Error {
28+29+ /** @param {Error} error */
30+ constructor(error) {
31+ super(error.message);
32+ this.originalError = error;
33+ }
34+}
35+3637/**
38 * Caches the mapping of handles to DIDs to avoid unnecessary API calls to resolveHandle or getProfile.
···298 let postGroups = await Promise.all(batches);
299300 return { cursor: response.cursor, posts: postGroups.flat() };
301+ }
302+303+ /** @param {Post} post, @returns {Promise<(json | undefined)[]>} */
304+305+ async loadHiddenReplies(post) {
306+ let expectedReplyURIs;
307+308+ try {
309+ expectedReplyURIs = await blueAPI.getReplies(post.uri);
310+ } catch (error) {
311+ if (error instanceof APIError && error.code == 404) {
312+ throw new HiddenRepliesError(error);
313+ } else {
314+ throw error;
315+ }
316+ }
317+318+ let missingReplyURIs = expectedReplyURIs.filter(r => !post.replies.some(x => x.uri === r));
319+ let promises = missingReplyURIs.map(uri => this.loadThreadByAtURI(uri));
320+ let responses = await Promise.allSettled(promises);
321+322+ return responses.map(r => (r.status == 'fulfilled') ? r.value : undefined);
323 }
324325 /**