@openpeepshq/core 0.1.33 → 0.1.34

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 (213) hide show
  1. package/dist/accounts/mutations.js +33 -35
  2. package/dist/analytics/compile.js +16 -10
  3. package/dist/analytics/read.js +52 -9
  4. package/dist/analytics/report.d.ts +20 -0
  5. package/dist/backups/index.js +75 -15
  6. package/dist/backups/metadata.d.ts +2 -3
  7. package/dist/backups/metadata.js +6 -2
  8. package/dist/config/defaults/capabilities.js +13 -2
  9. package/dist/config/defaults/community.js +7 -3
  10. package/dist/config/defaults/core.d.ts +1 -1
  11. package/dist/config/defaults/core.js +3 -0
  12. package/dist/config/index.d.ts +21 -0
  13. package/dist/config/index.js +7 -1
  14. package/dist/db/helpers.d.ts +1 -0
  15. package/dist/db/helpers.js +11 -3
  16. package/dist/db/index.d.ts +1 -1
  17. package/dist/db/index.js +1 -0
  18. package/dist/db/init.js +2 -3
  19. package/dist/db/migration/importCollections.d.ts +14 -9
  20. package/dist/db/migration/importCollections.js +114 -164
  21. package/dist/db/migration/shared.d.ts +2 -33
  22. package/dist/db/migration/shared.js +2 -52
  23. package/dist/db/pg/collections.d.ts +2 -2
  24. package/dist/db/pg/collections.js +2 -2
  25. package/dist/db/pg/filters/posts.d.ts +10 -0
  26. package/dist/db/pg/filters/posts.js +28 -4
  27. package/dist/db/pg/filters/profiles.d.ts +1 -0
  28. package/dist/db/pg/filters/profiles.js +2 -1
  29. package/dist/db/pg/map/filters.js +32 -2
  30. package/dist/db/pg/map/mutations.js +13 -8
  31. package/dist/db/pg/map/registry.d.ts +5 -0
  32. package/dist/db/pg/map/registry.js +64 -24
  33. package/dist/db/pg/map/relations.js +9 -5
  34. package/dist/db/pg/migrate.d.ts +1 -2
  35. package/dist/db/pg/migrate.js +6 -6
  36. package/dist/db/pg/queries/activity.js +3 -3
  37. package/dist/db/pg/queries/sorts.d.ts +1 -0
  38. package/dist/db/pg/queries/sorts.js +4 -0
  39. package/dist/db/pg/schema/documents.d.ts +279 -41
  40. package/dist/db/pg/schema/documents.js +21 -8
  41. package/dist/db/pg/schema/edges.d.ts +116 -7
  42. package/dist/db/pg/schema/edges.js +2 -1
  43. package/dist/db/pg/schema/index.d.ts +362 -15
  44. package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
  45. package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
  46. package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
  47. package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
  48. package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
  49. package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
  50. package/dist/db/pg/sql/meta/{0009_snapshot.json → 0015_snapshot.json} +291 -36
  51. package/dist/db/pg/sql/meta/_journal.json +43 -1
  52. package/dist/email/render.js +11 -3
  53. package/dist/events/index.d.ts +4 -0
  54. package/dist/events/index.js +1 -0
  55. package/dist/federation/activities.d.ts +17 -0
  56. package/dist/federation/activities.js +26 -0
  57. package/dist/federation/identity.d.ts +16 -0
  58. package/dist/federation/identity.js +52 -0
  59. package/dist/federation/index.d.ts +4 -0
  60. package/dist/federation/index.js +3 -0
  61. package/dist/federation/profiles.d.ts +3 -0
  62. package/dist/federation/profiles.js +14 -0
  63. package/dist/groups/finders.d.ts +2 -1
  64. package/dist/groups/helpers.d.ts +18 -0
  65. package/dist/groups/mapping.d.ts +4 -2
  66. package/dist/hashtags/finders.d.ts +6 -3
  67. package/dist/hashtags/finders.js +2 -0
  68. package/dist/hashtags/helpers.d.ts +8 -0
  69. package/dist/hashtags/helpers.js +4 -0
  70. package/dist/hashtags/index.d.ts +2 -0
  71. package/dist/hashtags/index.js +2 -0
  72. package/dist/hashtags/mutations.d.ts +3 -0
  73. package/dist/hashtags/mutations.js +13 -1
  74. package/dist/i18n/index.d.ts +1 -1
  75. package/dist/i18n/index.js +3 -1
  76. package/dist/i18n/pluginLocales.d.ts +6 -0
  77. package/dist/i18n/pluginLocales.js +15 -0
  78. package/dist/jams/export.d.ts +19 -0
  79. package/dist/jams/export.js +60 -0
  80. package/dist/jams/health.d.ts +8 -0
  81. package/dist/jams/health.js +46 -0
  82. package/dist/jams/helpers.d.ts +2 -2
  83. package/dist/jams/index.d.ts +2 -0
  84. package/dist/jams/index.js +23 -16
  85. package/dist/jams/jobs.js +1 -1
  86. package/dist/jams/livekit.d.ts +49 -4
  87. package/dist/jams/livekit.js +56 -39
  88. package/dist/jams/mapping.d.ts +3 -3
  89. package/dist/jams/mutations.d.ts +1 -1
  90. package/dist/jams/recording.d.ts +10 -0
  91. package/dist/jams/recording.js +32 -0
  92. package/dist/jams/token.d.ts +13 -1
  93. package/dist/jams/token.js +18 -7
  94. package/dist/jams/waitingRoom.js +1 -1
  95. package/dist/jobs/index.d.ts +1 -0
  96. package/dist/jobs/index.js +6 -1
  97. package/dist/jobs/jobDetail.js +1 -6
  98. package/dist/media/index.d.ts +1 -1
  99. package/dist/media/index.js +23 -8
  100. package/dist/media/processing.js +18 -7
  101. package/dist/notifications/defaultNotifications/follow/index.js +2 -2
  102. package/dist/notifications/defaultNotifications/index.js +4 -0
  103. package/dist/notifications/defaultNotifications/newGroupPost/index.js +12 -6
  104. package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
  105. package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
  106. package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
  107. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +18 -0
  108. package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
  109. package/dist/notifications/defaultNotifications/rsvp/index.js +7 -0
  110. package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
  111. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +75 -0
  112. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
  113. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
  114. package/dist/notifications/jobs.js +3 -1
  115. package/dist/notifications/mutations.js +4 -0
  116. package/dist/plugins/index.js +37 -1
  117. package/dist/plugins/install.d.ts +28 -9
  118. package/dist/plugins/install.js +281 -49
  119. package/dist/plugins/pluginAuth.d.ts +1 -1
  120. package/dist/plugins/pluginAuth.js +10 -6
  121. package/dist/posts/activity.d.ts +9 -0
  122. package/dist/posts/activity.js +35 -0
  123. package/dist/posts/contextClosure.d.ts +1 -9
  124. package/dist/posts/contextClosure.js +15 -44
  125. package/dist/posts/conversationQueries.d.ts +7 -0
  126. package/dist/posts/conversationQueries.js +76 -2
  127. package/dist/posts/eventAgenda.d.ts +1 -0
  128. package/dist/posts/eventAgenda.js +10 -4
  129. package/dist/posts/eventOccurrenceJobs.js +7 -2
  130. package/dist/posts/eventOccurrences.d.ts +6 -0
  131. package/dist/posts/eventOccurrences.js +21 -0
  132. package/dist/posts/finders.d.ts +15 -8
  133. package/dist/posts/finders.js +67 -18
  134. package/dist/posts/helpers/filters.js +13 -8
  135. package/dist/posts/helpers/index.d.ts +27 -14
  136. package/dist/posts/helpers/index.js +34 -14
  137. package/dist/posts/index.d.ts +5 -2
  138. package/dist/posts/index.js +5 -2
  139. package/dist/posts/mapping.d.ts +216 -13
  140. package/dist/posts/mapping.js +14 -13
  141. package/dist/posts/mutations.d.ts +440 -3
  142. package/dist/posts/mutations.js +155 -32
  143. package/dist/posts/pollEnd.d.ts +3 -0
  144. package/dist/posts/pollEnd.js +7 -0
  145. package/dist/posts/pollEndJobs.d.ts +8 -0
  146. package/dist/posts/pollEndJobs.js +49 -0
  147. package/dist/posts/replyClosure.d.ts +10 -0
  148. package/dist/posts/replyClosure.js +43 -0
  149. package/dist/posts/rsvpConfirmationEmail.js +14 -16
  150. package/dist/posts/threadPreview.d.ts +8 -0
  151. package/dist/posts/threadPreview.js +44 -0
  152. package/dist/posts/unseenCounts.js +4 -1
  153. package/dist/profileSettings/cache.js +22 -5
  154. package/dist/profileSettings/mapping.d.ts +2 -0
  155. package/dist/profiles/activityQueries.d.ts +5 -0
  156. package/dist/profiles/activityQueries.js +85 -0
  157. package/dist/profiles/activitySummary.d.ts +3 -0
  158. package/dist/profiles/activitySummary.js +87 -0
  159. package/dist/profiles/blocks.d.ts +12 -0
  160. package/dist/profiles/blocks.js +73 -0
  161. package/dist/profiles/cache.d.ts +1 -0
  162. package/dist/profiles/cache.js +19 -6
  163. package/dist/profiles/finders.d.ts +2 -1
  164. package/dist/profiles/finders.js +8 -3
  165. package/dist/profiles/helpers.d.ts +2 -0
  166. package/dist/profiles/index.d.ts +2 -0
  167. package/dist/profiles/index.js +2 -0
  168. package/dist/profiles/mapping.d.ts +10 -5
  169. package/dist/profiles/mapping.js +13 -1
  170. package/dist/profiles/mutations.d.ts +8 -4
  171. package/dist/profiles/mutations.js +31 -2
  172. package/dist/redis/connection.d.ts +2 -0
  173. package/dist/redis/connection.js +25 -6
  174. package/dist/roles/index.d.ts +1 -1
  175. package/dist/roles/index.js +1 -1
  176. package/dist/roles/mapping.d.ts +1 -0
  177. package/dist/roles/mutations.js +86 -3
  178. package/dist/search/mapping.d.ts +1 -1
  179. package/dist/search/mapping.js +6 -2
  180. package/dist/server/index.d.ts +18 -0
  181. package/dist/server/index.js +24 -12
  182. package/dist/server/stablePublicServerInfo.d.ts +17 -0
  183. package/dist/server/stablePublicServerInfo.js +37 -0
  184. package/dist/server/status.d.ts +25 -0
  185. package/dist/server/status.js +98 -0
  186. package/dist/stats/finders.d.ts +1 -17681
  187. package/dist/stats/finders.js +9 -5
  188. package/dist/stats/mapping.d.ts +0 -1
  189. package/dist/stats/mapping.js +0 -3
  190. package/package.json +4 -5
  191. package/dist/db/migration/detect.d.ts +0 -3
  192. package/dist/db/migration/detect.js +0 -33
  193. package/dist/db/migration/importPostgres.d.ts +0 -3
  194. package/dist/db/migration/importPostgres.js +0 -18
  195. package/dist/db/migration/transform.d.ts +0 -20
  196. package/dist/db/migration/transform.js +0 -232
  197. package/dist/db/migration/validate.d.ts +0 -18
  198. package/dist/db/migration/validate.js +0 -69
  199. package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
  200. package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
  201. package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
  202. package/dist/db/pg/sql/meta/0006_snapshot.json +0 -4200
  203. package/dist/db/pg/sql/meta/0007_snapshot.json +0 -4179
  204. package/dist/mastodon/index.d.ts +0 -4
  205. package/dist/mastodon/index.js +0 -51
  206. package/dist/mastodon/types.d.ts +0 -7579
  207. package/dist/mastodon/types.js +0 -523
  208. package/dist/mastodon/typescript.d.ts +0 -1578
  209. package/dist/mastodon/typescript.js +0 -1
  210. package/dist/migration/index.d.ts +0 -4
  211. package/dist/migration/index.js +0 -4
  212. package/dist/roles/defaults.d.ts +0 -2
  213. package/dist/roles/defaults.js +0 -95
@@ -5,8 +5,9 @@ import { composeFilters, connectionFinder, connector, disconnector, filterAndTra
5
5
  import { allpeepDb, collectionInfos } from '../../db/index.js';
6
6
  import { capabilitiesConfig } from '../../config/index.js';
7
7
  import { canReadPost } from './filters.js';
8
- import { matchMentionHandles, normalizePostDataFromDb, tombstoneProfileWithMetaIfDeleted, } from '@openpeepshq/common/lib';
8
+ import { AP_LIKE_REACTION, currentReactionsFromEntries, isBlockedPair, isReactionHistoryEntry, matchMentionHandles, normalizePostDataFromDb, toHiddenPost, tombstoneProfileWithMetaIfDeleted, } from '@openpeepshq/common/lib';
9
9
  import { EMBEDDED_REPOSTS_LIMIT } from '../mapping.js';
10
+ import { loadThreadPreviewReplies } from '../threadPreview.js';
10
11
  export const isDirect = (post) => post.visibility === 'direct';
11
12
  export const isPrivate = (post) => post.visibility === 'private';
12
13
  export const isUnlisted = (post) => post.visibility === 'unlisted';
@@ -47,8 +48,6 @@ export const hashtagDisconnector = disconnector(collectionInfos.postsCollection,
47
48
  export const mentionConnector = connector(collectionInfos.postsCollection, collectionInfos.profilesCollection, collectionInfos.mentionsCollection);
48
49
  export const mentionsConnectionFinder = connectionFinder(collectionInfos.postsCollection, collectionInfos.profilesCollection, collectionInfos.mentionsCollection);
49
50
  export const repostConnector = connector(collectionInfos.postsCollection, collectionInfos.postsCollection, collectionInfos.repostCollection);
50
- export const reactionConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.reactionsCollection);
51
- export const reactionDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.reactionsCollection);
52
51
  export const bookmarkConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.bookmarksCollection);
53
52
  export const bookmarkDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.bookmarksCollection);
54
53
  export const postSeenConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.postSeenCollection);
@@ -56,7 +55,6 @@ const loadPublicProfile = async (profileId, ignoreSoftDelete = false) => tombsto
56
55
  const addProfileForEntry = async (rawEntry) => (Object.assign(Object.assign({}, rawEntry), {
57
56
  // ignoreSoftDelete: authorship must survive account removal
58
57
  profile: (await loadPublicProfile(rawEntry.profile.id, true)) }));
59
- const addProfileForReaction = async (rawReaction) => (Object.assign(Object.assign({}, rawReaction), { profile: (await loadPublicProfile(rawReaction.profile.id, true)) }));
60
58
  const addProfileForMention = async (rawMention) => (Object.assign(Object.assign({}, rawMention), { profile: (await loadPublicProfile(rawMention.profile.id, true)) }));
61
59
  const leanRepostsFromWrappers = async (wrappers) => {
62
60
  if (!(wrappers === null || wrappers === void 0 ? void 0 : wrappers.length))
@@ -82,14 +80,20 @@ const leanRepostsFromWrappers = async (wrappers) => {
82
80
  .sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))
83
81
  .slice(0, EMBEDDED_REPOSTS_LIMIT);
84
82
  };
85
- export const transformPost = async (post, currentProfile) => {
86
- var _a;
87
- const entries = post.entries
83
+ export const transformPost = async (post, currentProfile, options = {}) => {
84
+ var _a, _b, _c;
85
+ const embedThreadPreview = (_a = options.embedThreadPreview) !== null && _a !== void 0 ? _a : true;
86
+ const nested = { embedThreadPreview: false };
87
+ const allEntries = post.entries
88
88
  ? await Promise.all(post.entries.map(addProfileForEntry))
89
89
  : [];
90
- const reactions = post.reactions
91
- ? await Promise.all(post.reactions.map(addProfileForReaction))
92
- : [];
90
+ const entries = allEntries.filter((entry) => !isReactionHistoryEntry(entry.type));
91
+ const reactions = currentReactionsFromEntries(allEntries)
92
+ .filter((item) => item.reaction === AP_LIKE_REACTION)
93
+ .map((item) => ({
94
+ reaction: AP_LIKE_REACTION,
95
+ profile: item.profile,
96
+ }));
93
97
  const reposts = await leanRepostsFromWrappers(post.reposts);
94
98
  const audience = post.audience
95
99
  ? (await Promise.all(post.audience.map((p) => loadPublicProfile(p.id)))).filter((profile) => !!profile)
@@ -97,14 +101,23 @@ export const transformPost = async (post, currentProfile) => {
97
101
  const mentions = post.mentions
98
102
  ? await Promise.all(post.mentions.map(addProfileForMention))
99
103
  : [];
100
- const createProfile = (_a = entries.find((entry) => entry.type === 'create')) === null || _a === void 0 ? void 0 : _a.profile;
104
+ const createProfile = (_b = entries.find((entry) => entry.type === 'create')) === null || _b === void 0 ? void 0 : _b.profile;
101
105
  const profile = createProfile !== null && createProfile !== void 0 ? createProfile : (post.creatorId
102
106
  ? await loadPublicProfile(post.creatorId, true)
103
107
  : undefined);
108
+ const preview = embedThreadPreview
109
+ ? await loadThreadPreviewReplies(post.id, currentProfile)
110
+ : {
111
+ replies: ((_c = post.latestReplies) !== null && _c !== void 0 ? _c : []),
112
+ hasMore: !!post.latestRepliesHasMore,
113
+ };
114
+ const latestReplies = (await Promise.all(preview.replies.map((reply) => transformPost(reply, currentProfile, nested)))).filter((reply) => !!reply.profile);
104
115
  return Object.assign(Object.assign({}, post), { data: post.data ? normalizePostDataFromDb(post.data) : post.data, seen: currentProfile ? post.seen : undefined, replyTo: post.replyTo
105
- ? await transformPost(post.replyTo, currentProfile)
106
- : undefined, repost: post.repost
107
- ? await transformPost(post.repost, currentProfile)
116
+ ? withBlockTombstone(await transformPost(post.replyTo, currentProfile, nested), currentProfile)
117
+ : undefined, latestReplies: latestReplies.map((reply) => withBlockTombstone(reply, currentProfile)), latestRepliesHasMore: preview.hasMore, repost: post.repost
118
+ ? await transformPost(post.repost, currentProfile, {
119
+ embedThreadPreview,
120
+ })
108
121
  : undefined, rsvps: entries
109
122
  .filter((entry) => entry.type === 'rsvp')
110
123
  .map((entry) => ({
@@ -117,6 +130,13 @@ export const transformPost = async (post, currentProfile) => {
117
130
  reactions,
118
131
  reposts });
119
132
  };
133
+ const withBlockTombstone = (post, currentProfile) => {
134
+ var _a, _b;
135
+ const creatorId = (_a = post.creatorId) !== null && _a !== void 0 ? _a : (_b = post.profile) === null || _b === void 0 ? void 0 : _b.id;
136
+ return creatorId && isBlockedPair(currentProfile, creatorId)
137
+ ? toHiddenPost(post)
138
+ : post;
139
+ };
120
140
  export const toFilteredPostsList = async (queryResult, options) => {
121
141
  const { authData, limit = 100, offset = 0, filters = [] } = options;
122
142
  const { db } = await allpeepDb();
@@ -2,9 +2,12 @@ export * from './finders';
2
2
  export * from './mutations';
3
3
  export * from './mapping';
4
4
  export { CONTEXT_NODE_CAP, collectReplyClosureIds, loadReplyContextPosts, } from './contextClosure';
5
- export { listConversationPreviews, getConversationThread, findLatestThreadPostId, } from './conversationQueries';
5
+ export { loadThreadPreviewReplies, THREAD_PREVIEW_LIMIT, } from './threadPreview';
6
+ export { listConversationPreviews, getConversationThread, findLatestThreadPostId, listLeftConversations, } from './conversationQueries';
6
7
  export * from './helpers';
8
+ export { bumpConversationActivity, findReplyRootId } from './activity';
7
9
  export { registerRsvpConfirmationEmail } from './rsvpConfirmationEmail';
8
- export { rebuildEventOccurrences, clearEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences';
10
+ export { rebuildEventOccurrences, clearEventOccurrences, backfillMissingEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences';
9
11
  export { listEventAgenda } from './eventAgenda';
10
12
  export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs';
13
+ export { pollEndQueue, pollEndWorker, schedulePollEnd, cancelPollEnd, } from './pollEndJobs';
@@ -2,9 +2,12 @@ export * from './finders.js';
2
2
  export * from './mutations.js';
3
3
  export * from './mapping.js';
4
4
  export { CONTEXT_NODE_CAP, collectReplyClosureIds, loadReplyContextPosts, } from './contextClosure.js';
5
- export { listConversationPreviews, getConversationThread, findLatestThreadPostId, } from './conversationQueries.js';
5
+ export { loadThreadPreviewReplies, THREAD_PREVIEW_LIMIT, } from './threadPreview.js';
6
+ export { listConversationPreviews, getConversationThread, findLatestThreadPostId, listLeftConversations, } from './conversationQueries.js';
6
7
  export * from './helpers/index.js';
8
+ export { bumpConversationActivity, findReplyRootId } from './activity.js';
7
9
  export { registerRsvpConfirmationEmail } from './rsvpConfirmationEmail.js';
8
- export { rebuildEventOccurrences, clearEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences.js';
10
+ export { rebuildEventOccurrences, clearEventOccurrences, backfillMissingEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences.js';
9
11
  export { listEventAgenda } from './eventAgenda.js';
10
12
  export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs.js';
13
+ export { pollEndQueue, pollEndWorker, schedulePollEnd, cancelPollEnd, } from './pollEndJobs.js';
@@ -4,6 +4,209 @@ export declare const entriesRelation: Relation<Profile, EntryData>;
4
4
  export declare const groupRelation: Relation;
5
5
  /** Cap for embedded who-reposted lists on feed/detail posts. */
6
6
  export declare const EMBEDDED_REPOSTS_LIMIT = 50;
7
+ /** Newest conversation descendants shown under a feed original. */
8
+ export declare const EMBEDDED_LATEST_REPLIES_LIMIT = 3;
9
+ export declare const threadPreviewMappingForProfile: (profile?: {
10
+ id: string;
11
+ }) => Mapping<{
12
+ type: "note" | "question" | "event" | "article";
13
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
14
+ creatorId: string;
15
+ capabilitiesNeeded?: string[] | undefined;
16
+ data?: {
17
+ type: "note";
18
+ content?: string | undefined;
19
+ sensitive?: boolean | undefined;
20
+ spoilerText?: string | undefined;
21
+ attachments?: {
22
+ type: string;
23
+ url: string;
24
+ previewUrl: string | null;
25
+ textUrl: null;
26
+ filename: string;
27
+ meta: {
28
+ usage?: string | undefined;
29
+ focus?: {
30
+ x: number;
31
+ y: number;
32
+ } | undefined;
33
+ mimetype?: string | undefined;
34
+ size?: number | undefined;
35
+ };
36
+ description?: string | undefined;
37
+ blurhash?: string | undefined;
38
+ status?: "ready" | "failed" | "processing" | undefined;
39
+ error?: string | undefined;
40
+ }[] | undefined;
41
+ customEmojis?: {
42
+ shortcode: string;
43
+ url: string;
44
+ staticUrl: string;
45
+ visibleInPicker: boolean;
46
+ category: string;
47
+ }[] | undefined;
48
+ language?: string | undefined;
49
+ } | {
50
+ type: "question";
51
+ options: {
52
+ content: string;
53
+ type: "note";
54
+ }[];
55
+ content?: string | undefined;
56
+ sensitive?: boolean | undefined;
57
+ spoilerText?: string | undefined;
58
+ attachments?: {
59
+ type: string;
60
+ url: string;
61
+ previewUrl: string | null;
62
+ textUrl: null;
63
+ filename: string;
64
+ meta: {
65
+ usage?: string | undefined;
66
+ focus?: {
67
+ x: number;
68
+ y: number;
69
+ } | undefined;
70
+ mimetype?: string | undefined;
71
+ size?: number | undefined;
72
+ };
73
+ description?: string | undefined;
74
+ blurhash?: string | undefined;
75
+ status?: "ready" | "failed" | "processing" | undefined;
76
+ error?: string | undefined;
77
+ }[] | undefined;
78
+ customEmojis?: {
79
+ shortcode: string;
80
+ url: string;
81
+ staticUrl: string;
82
+ visibleInPicker: boolean;
83
+ category: string;
84
+ }[] | undefined;
85
+ language?: string | undefined;
86
+ multiple?: boolean | undefined;
87
+ votersVisible?: boolean | undefined;
88
+ expiresAt?: string | undefined;
89
+ } | {
90
+ type: "event";
91
+ start: string;
92
+ wholeDay: boolean;
93
+ content?: string | undefined;
94
+ sensitive?: boolean | undefined;
95
+ spoilerText?: string | undefined;
96
+ attachments?: {
97
+ type: string;
98
+ url: string;
99
+ previewUrl: string | null;
100
+ textUrl: null;
101
+ filename: string;
102
+ meta: {
103
+ usage?: string | undefined;
104
+ focus?: {
105
+ x: number;
106
+ y: number;
107
+ } | undefined;
108
+ mimetype?: string | undefined;
109
+ size?: number | undefined;
110
+ };
111
+ description?: string | undefined;
112
+ blurhash?: string | undefined;
113
+ status?: "ready" | "failed" | "processing" | undefined;
114
+ error?: string | undefined;
115
+ }[] | undefined;
116
+ customEmojis?: {
117
+ shortcode: string;
118
+ url: string;
119
+ staticUrl: string;
120
+ visibleInPicker: boolean;
121
+ category: string;
122
+ }[] | undefined;
123
+ language?: string | undefined;
124
+ name?: string | undefined;
125
+ timeZone?: string | undefined;
126
+ image?: string | undefined;
127
+ end?: string | undefined;
128
+ maxAttendees?: number | undefined;
129
+ attendeeListPublic?: boolean | undefined;
130
+ moderators?: string[] | undefined;
131
+ jam?: {
132
+ moderators: string[];
133
+ videoEnabled: boolean;
134
+ type: "video-call";
135
+ speakers?: string[] | undefined;
136
+ presenters?: string[] | undefined;
137
+ audience?: string[] | undefined;
138
+ maxSpeakers?: number | undefined;
139
+ maxPresenters?: number | undefined;
140
+ maxAudience?: number | undefined;
141
+ waitingRoom?: boolean | undefined;
142
+ } | undefined;
143
+ physicalLocation?: {
144
+ text: string;
145
+ coordinates?: {
146
+ lat: number;
147
+ lng: number;
148
+ alt?: number | undefined;
149
+ } | undefined;
150
+ } | undefined;
151
+ url?: string | undefined;
152
+ recurrence?: {
153
+ freq: "DAILY" | "WEEKLY" | "MONTHLY";
154
+ interval?: number | undefined;
155
+ byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
156
+ until?: string | undefined;
157
+ count?: number | undefined;
158
+ } | undefined;
159
+ exceptions?: {
160
+ recurrenceId: string;
161
+ cancelled?: boolean | undefined;
162
+ start?: string | undefined;
163
+ end?: string | undefined;
164
+ physicalLocation?: {
165
+ text: string;
166
+ coordinates?: {
167
+ lat: number;
168
+ lng: number;
169
+ alt?: number | undefined;
170
+ } | undefined;
171
+ } | undefined;
172
+ }[] | undefined;
173
+ } | {
174
+ type: "article";
175
+ content?: string | undefined;
176
+ sensitive?: boolean | undefined;
177
+ spoilerText?: string | undefined;
178
+ attachments?: {
179
+ type: string;
180
+ url: string;
181
+ previewUrl: string | null;
182
+ textUrl: null;
183
+ filename: string;
184
+ meta: {
185
+ usage?: string | undefined;
186
+ focus?: {
187
+ x: number;
188
+ y: number;
189
+ } | undefined;
190
+ mimetype?: string | undefined;
191
+ size?: number | undefined;
192
+ };
193
+ description?: string | undefined;
194
+ blurhash?: string | undefined;
195
+ status?: "ready" | "failed" | "processing" | undefined;
196
+ error?: string | undefined;
197
+ }[] | undefined;
198
+ customEmojis?: {
199
+ shortcode: string;
200
+ url: string;
201
+ staticUrl: string;
202
+ visibleInPicker: boolean;
203
+ category: string;
204
+ }[] | undefined;
205
+ language?: string | undefined;
206
+ image?: string | undefined;
207
+ title?: string | undefined;
208
+ } | undefined;
209
+ }, DbPost, DbPost>;
7
210
  export declare const repostRelation: RelationWithMapping<DbBasePost>;
8
211
  export declare const repostRelationForProfile: (profile?: {
9
212
  id: string;
@@ -14,7 +217,7 @@ export declare const repostsOfPostRelationForProfile: (profile?: {
14
217
  }) => RelationWithMapping<DbPost>;
15
218
  export declare const postsWithReplyCountMapping: Mapping<{
16
219
  type: "note" | "question" | "event" | "article";
17
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
220
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
18
221
  creatorId: string;
19
222
  capabilitiesNeeded?: string[] | undefined;
20
223
  data?: {
@@ -216,7 +419,7 @@ export declare const postsWithReplyCountMapping: Mapping<{
216
419
  deletedAt?: string | null | undefined;
217
420
  } & {
218
421
  type: "note" | "question" | "event" | "article";
219
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
422
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
220
423
  creatorId: string;
221
424
  capabilitiesNeeded?: string[] | undefined;
222
425
  data?: {
@@ -422,7 +625,7 @@ export declare const postsWithReplyCountMapping: Mapping<{
422
625
  deletedAt?: string | null | undefined;
423
626
  } & {
424
627
  type: "note" | "question" | "event" | "article";
425
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
628
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
426
629
  creatorId: string;
427
630
  capabilitiesNeeded?: string[] | undefined;
428
631
  data?: {
@@ -625,7 +828,7 @@ export declare const postsWithReplyCountMapping: Mapping<{
625
828
  }>;
626
829
  export declare const postsWithReplyToCountMapping: Mapping<{
627
830
  type: "note" | "question" | "event" | "article";
628
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
831
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
629
832
  creatorId: string;
630
833
  capabilitiesNeeded?: string[] | undefined;
631
834
  data?: {
@@ -827,7 +1030,7 @@ export declare const postsWithReplyToCountMapping: Mapping<{
827
1030
  deletedAt?: string | null | undefined;
828
1031
  } & {
829
1032
  type: "note" | "question" | "event" | "article";
830
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
1033
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
831
1034
  creatorId: string;
832
1035
  capabilitiesNeeded?: string[] | undefined;
833
1036
  data?: {
@@ -1033,7 +1236,7 @@ export declare const postsWithReplyToCountMapping: Mapping<{
1033
1236
  deletedAt?: string | null | undefined;
1034
1237
  } & {
1035
1238
  type: "note" | "question" | "event" | "article";
1036
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
1239
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
1037
1240
  creatorId: string;
1038
1241
  capabilitiesNeeded?: string[] | undefined;
1039
1242
  data?: {
@@ -1236,7 +1439,7 @@ export declare const postsWithReplyToCountMapping: Mapping<{
1236
1439
  }>;
1237
1440
  export declare const postsMapping: Mapping<{
1238
1441
  type: "note" | "question" | "event" | "article";
1239
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
1442
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
1240
1443
  creatorId: string;
1241
1444
  capabilitiesNeeded?: string[] | undefined;
1242
1445
  data?: {
@@ -1436,7 +1639,7 @@ export declare const postsMapping: Mapping<{
1436
1639
  /** Auth / mark-seen: post graph without nested replyTo/repost hydrate. */
1437
1640
  export declare const postsAuthMapping: Mapping<{
1438
1641
  type: "note" | "question" | "event" | "article";
1439
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
1642
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
1440
1643
  creatorId: string;
1441
1644
  capabilitiesNeeded?: string[] | undefined;
1442
1645
  data?: {
@@ -1637,7 +1840,7 @@ export declare const postsMappingForProfile: (profile?: {
1637
1840
  id: string;
1638
1841
  }) => Mapping<{
1639
1842
  type: "note" | "question" | "event" | "article";
1640
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
1843
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
1641
1844
  creatorId: string;
1642
1845
  capabilitiesNeeded?: string[] | undefined;
1643
1846
  data?: {
@@ -1838,7 +2041,7 @@ export declare const postContextMappingForProfile: (profile?: {
1838
2041
  id: string;
1839
2042
  }) => Mapping<{
1840
2043
  type: "note" | "question" | "event" | "article";
1841
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
2044
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
1842
2045
  creatorId: string;
1843
2046
  capabilitiesNeeded?: string[] | undefined;
1844
2047
  data?: {
@@ -2038,7 +2241,7 @@ export declare const postContextMappingForProfile: (profile?: {
2038
2241
  export declare const contextRelation: (depth: number, direction: "ancestors" | "descendents", contextMapping?: Mapping<DbPost>) => RelationWithMapping<DbPost>;
2039
2242
  export declare const conversationLeavesMapping: Mapping<{
2040
2243
  type: "note" | "question" | "event" | "article";
2041
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
2244
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
2042
2245
  creatorId: string;
2043
2246
  capabilitiesNeeded?: string[] | undefined;
2044
2247
  data?: {
@@ -2239,7 +2442,7 @@ export declare const conversationLeavesMappingForProfile: (profile?: {
2239
2442
  id: string;
2240
2443
  }) => Mapping<{
2241
2444
  type: "note" | "question" | "event" | "article";
2242
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
2445
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
2243
2446
  creatorId: string;
2244
2447
  capabilitiesNeeded?: string[] | undefined;
2245
2448
  data?: {
@@ -2438,7 +2641,7 @@ export declare const conversationLeavesMappingForProfile: (profile?: {
2438
2641
  }, DbPost, DbPost>;
2439
2642
  export declare const postIdsMapping: Mapping<{
2440
2643
  type: "note" | "question" | "event" | "article";
2441
- visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
2644
+ visibility: "local" | "direct" | "group" | "report" | "public" | "unlisted" | "private";
2442
2645
  creatorId: string;
2443
2646
  capabilitiesNeeded?: string[] | undefined;
2444
2647
  data?: {
@@ -48,19 +48,10 @@ const repostCountRelation = {
48
48
  softDelete: true,
49
49
  },
50
50
  };
51
- const reactionsRelation = {
52
- alias: 'reactions',
53
- vertexAlias: 'profile',
54
- edgeCollection: 'reactions',
55
- direction: 'INBOUND',
56
- cardinality: 'many',
57
- mapping: {
58
- collection: 'profiles',
59
- softDelete: true,
60
- },
61
- };
62
51
  /** Cap for embedded who-reposted lists on feed/detail posts. */
63
52
  export const EMBEDDED_REPOSTS_LIMIT = 50;
53
+ /** Newest conversation descendants shown under a feed original. */
54
+ export const EMBEDDED_LATEST_REPLIES_LIMIT = 3;
64
55
  /**
65
56
  * Lean inbound wrappers for the embedded `reposts` preview. Only loads create
66
57
  * entries (for the reposter profile) — not the full post graph used by
@@ -115,7 +106,6 @@ const basePostFilterRelations = [
115
106
  groupRelation,
116
107
  replyCountRelation,
117
108
  repostCountRelation,
118
- reactionsRelation,
119
109
  leanRepostsRelation,
120
110
  tagsRelation,
121
111
  mentionsRelation,
@@ -152,6 +142,18 @@ const replyToRelation = {
152
142
  cardinality: 'one',
153
143
  mapping: replyPostMapData,
154
144
  };
145
+ export const threadPreviewMappingForProfile = (profile) => map({
146
+ collection: 'posts',
147
+ softDelete: true,
148
+ postFilterRelations: [entriesRelation],
149
+ postFilterDerivedProperties: [
150
+ {
151
+ alias: 'inReplyToId',
152
+ resolve: postDerived.inReplyToId,
153
+ },
154
+ ...(profile ? [seenBatchByCurrentProfileDerivedProperty(profile)] : []),
155
+ ],
156
+ });
155
157
  export const repostRelation = {
156
158
  alias: 'repost',
157
159
  edgeCollection: 'repost',
@@ -215,7 +217,6 @@ const contextPostFilterRelations = [
215
217
  groupRelation,
216
218
  replyCountRelation,
217
219
  repostCountRelation,
218
- reactionsRelation,
219
220
  leanRepostsRelation,
220
221
  tagsRelation,
221
222
  mentionsRelation,