@openpeepshq/core 0.1.33 → 0.1.35

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 (297) hide show
  1. package/dist/accessTokens/finders.js +5 -6
  2. package/dist/accessTokens/mutations.js +1 -1
  3. package/dist/accessTokens/tokens.js +8 -11
  4. package/dist/accounts/helpers.js +6 -2
  5. package/dist/accounts/mutations.js +36 -33
  6. package/dist/analytics/cache.js +3 -3
  7. package/dist/analytics/clicks.js +14 -22
  8. package/dist/analytics/compile.js +17 -12
  9. package/dist/analytics/dateRange.js +3 -5
  10. package/dist/analytics/jobs.js +3 -4
  11. package/dist/analytics/pdfReport.js +45 -61
  12. package/dist/analytics/privacy.js +1 -1
  13. package/dist/analytics/read.js +164 -140
  14. package/dist/analytics/report.d.ts +22 -1
  15. package/dist/analytics/report.js +2 -3
  16. package/dist/analytics/settings.js +3 -4
  17. package/dist/backups/index.js +82 -25
  18. package/dist/backups/metadata.d.ts +2 -3
  19. package/dist/backups/metadata.js +6 -2
  20. package/dist/config/db.js +2 -4
  21. package/dist/config/defaults/capabilities.js +13 -2
  22. package/dist/config/defaults/community.js +8 -3
  23. package/dist/config/defaults/core.d.ts +1 -1
  24. package/dist/config/defaults/core.js +16 -8
  25. package/dist/config/index.d.ts +22 -0
  26. package/dist/config/index.js +15 -11
  27. package/dist/db/explorer/query.js +9 -8
  28. package/dist/db/explorer/sql.js +8 -8
  29. package/dist/db/helpers.d.ts +1 -0
  30. package/dist/db/helpers.js +25 -7
  31. package/dist/db/index.d.ts +1 -1
  32. package/dist/db/index.js +1 -0
  33. package/dist/db/init.js +2 -3
  34. package/dist/db/migration/importCollections.d.ts +14 -9
  35. package/dist/db/migration/importCollections.js +121 -174
  36. package/dist/db/migration/shared.d.ts +2 -33
  37. package/dist/db/migration/shared.js +17 -87
  38. package/dist/db/pg/client.js +4 -7
  39. package/dist/db/pg/collections.d.ts +2 -2
  40. package/dist/db/pg/collections.js +2 -2
  41. package/dist/db/pg/filters/index.js +1 -1
  42. package/dist/db/pg/filters/posts.d.ts +12 -0
  43. package/dist/db/pg/filters/posts.js +30 -4
  44. package/dist/db/pg/filters/profiles.d.ts +1 -0
  45. package/dist/db/pg/filters/profiles.js +2 -1
  46. package/dist/db/pg/helpers.js +2 -14
  47. package/dist/db/pg/map/filters.js +40 -10
  48. package/dist/db/pg/map/helpers.js +5 -1
  49. package/dist/db/pg/map/index.js +46 -51
  50. package/dist/db/pg/map/mutations.js +65 -25
  51. package/dist/db/pg/map/registry.d.ts +5 -0
  52. package/dist/db/pg/map/registry.js +133 -56
  53. package/dist/db/pg/map/relations.js +76 -68
  54. package/dist/db/pg/map/search.js +15 -37
  55. package/dist/db/pg/mappers.js +13 -7
  56. package/dist/db/pg/migrate.d.ts +1 -2
  57. package/dist/db/pg/migrate.js +8 -9
  58. package/dist/db/pg/queries/activity.js +5 -5
  59. package/dist/db/pg/queries/derived.js +8 -12
  60. package/dist/db/pg/queries/sorts.d.ts +1 -0
  61. package/dist/db/pg/queries/sorts.js +4 -0
  62. package/dist/db/pg/schema/documents.d.ts +279 -41
  63. package/dist/db/pg/schema/documents.js +136 -22
  64. package/dist/db/pg/schema/edges.d.ts +116 -7
  65. package/dist/db/pg/schema/edges.js +9 -2
  66. package/dist/db/pg/schema/index.d.ts +362 -15
  67. package/dist/db/pg/schema/index.js +5 -1
  68. package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
  69. package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
  70. package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
  71. package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
  72. package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
  73. package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
  74. package/dist/db/pg/sql/0016_posts_search_vector_title_tags_path.sql +54 -0
  75. package/dist/db/pg/sql/meta/{0009_snapshot.json → 0015_snapshot.json} +291 -36
  76. package/dist/db/pg/sql/meta/_journal.json +49 -0
  77. package/dist/db/replaceOrigin.js +1 -1
  78. package/dist/email/queueStats.js +8 -11
  79. package/dist/email/render.js +14 -3
  80. package/dist/email/send.js +19 -17
  81. package/dist/email/smtpTest.js +10 -6
  82. package/dist/errors/index.js +1 -1
  83. package/dist/events/index.d.ts +4 -0
  84. package/dist/events/index.js +1 -0
  85. package/dist/events/once.js +2 -4
  86. package/dist/federation/activities.d.ts +17 -0
  87. package/dist/federation/activities.js +25 -0
  88. package/dist/federation/identity.d.ts +16 -0
  89. package/dist/federation/identity.js +52 -0
  90. package/dist/federation/index.d.ts +4 -0
  91. package/dist/federation/index.js +3 -0
  92. package/dist/federation/profiles.d.ts +3 -0
  93. package/dist/federation/profiles.js +14 -0
  94. package/dist/groups/finders.d.ts +2 -1
  95. package/dist/groups/helpers.d.ts +18 -0
  96. package/dist/groups/helpers.js +1 -2
  97. package/dist/groups/mapping.d.ts +4 -2
  98. package/dist/groups/mutations.js +1 -1
  99. package/dist/hashtags/finders.d.ts +6 -3
  100. package/dist/hashtags/finders.js +2 -0
  101. package/dist/hashtags/helpers.d.ts +8 -0
  102. package/dist/hashtags/helpers.js +4 -0
  103. package/dist/hashtags/index.d.ts +2 -0
  104. package/dist/hashtags/index.js +2 -0
  105. package/dist/hashtags/mutations.d.ts +3 -0
  106. package/dist/hashtags/mutations.js +13 -1
  107. package/dist/i18n/index.d.ts +1 -1
  108. package/dist/i18n/index.js +3 -1
  109. package/dist/i18n/pluginLocales.d.ts +6 -0
  110. package/dist/i18n/pluginLocales.js +15 -0
  111. package/dist/inviteLinks/mutations.js +2 -3
  112. package/dist/jams/export.d.ts +19 -0
  113. package/dist/jams/export.js +58 -0
  114. package/dist/jams/finders.js +4 -1
  115. package/dist/jams/health.d.ts +10 -0
  116. package/dist/jams/health.js +50 -0
  117. package/dist/jams/helpers.d.ts +2 -2
  118. package/dist/jams/helpers.js +6 -2
  119. package/dist/jams/index.d.ts +2 -0
  120. package/dist/jams/index.js +25 -18
  121. package/dist/jams/jobs.js +2 -3
  122. package/dist/jams/livekit.d.ts +49 -4
  123. package/dist/jams/livekit.js +62 -45
  124. package/dist/jams/mapping.d.ts +3 -3
  125. package/dist/jams/mutations.d.ts +1 -1
  126. package/dist/jams/recording.d.ts +10 -0
  127. package/dist/jams/recording.js +33 -1
  128. package/dist/jams/token.d.ts +13 -1
  129. package/dist/jams/token.js +25 -18
  130. package/dist/jams/waitingRoom.js +1 -1
  131. package/dist/jobs/index.d.ts +1 -0
  132. package/dist/jobs/index.js +9 -3
  133. package/dist/jobs/jobDetail.js +6 -12
  134. package/dist/jobs/jobLog.js +2 -3
  135. package/dist/lib/streams.js +4 -39
  136. package/dist/lib/zodDeepPartial.d.ts +1 -1
  137. package/dist/lib/zodDeepPartial.js +1 -1
  138. package/dist/log/index.js +13 -29
  139. package/dist/media/index.d.ts +1 -1
  140. package/dist/media/index.js +73 -12
  141. package/dist/media/jobs.js +1 -2
  142. package/dist/media/openpeeps/index.js +11 -46
  143. package/dist/media/processing.js +25 -11
  144. package/dist/media/streaming.js +5 -5
  145. package/dist/media/streamingCleanupJobs.js +1 -2
  146. package/dist/media/streamingJobs.js +3 -4
  147. package/dist/media/streamingPrewarm.js +7 -11
  148. package/dist/mediaAttachments/index.js +6 -2
  149. package/dist/notifications/defaultNotifications/announcement/index.js +15 -18
  150. package/dist/notifications/defaultNotifications/directMessage/index.js +9 -8
  151. package/dist/notifications/defaultNotifications/follow/index.js +15 -18
  152. package/dist/notifications/defaultNotifications/groupAdded/index.js +14 -17
  153. package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +15 -18
  154. package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +15 -18
  155. package/dist/notifications/defaultNotifications/index.js +4 -0
  156. package/dist/notifications/defaultNotifications/jamModerator/index.js +3 -5
  157. package/dist/notifications/defaultNotifications/jamSpeaker/index.js +14 -18
  158. package/dist/notifications/defaultNotifications/jamStarted/index.js +18 -22
  159. package/dist/notifications/defaultNotifications/mention/index.js +20 -24
  160. package/dist/notifications/defaultNotifications/newGroupPost/index.js +11 -6
  161. package/dist/notifications/defaultNotifications/newProfile/index.js +14 -17
  162. package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
  163. package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
  164. package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
  165. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +17 -0
  166. package/dist/notifications/defaultNotifications/pollVote/index.js +14 -17
  167. package/dist/notifications/defaultNotifications/reaction/index.js +18 -21
  168. package/dist/notifications/defaultNotifications/reply/index.js +21 -22
  169. package/dist/notifications/defaultNotifications/repost/index.js +16 -20
  170. package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
  171. package/dist/notifications/defaultNotifications/rsvp/index.js +31 -18
  172. package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
  173. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +82 -0
  174. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
  175. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
  176. package/dist/notifications/fcmCredential.js +1 -1
  177. package/dist/notifications/finders.js +1 -1
  178. package/dist/notifications/helpers.js +13 -10
  179. package/dist/notifications/jobs.js +10 -5
  180. package/dist/notifications/mutations.js +8 -1
  181. package/dist/notifications/push.js +11 -16
  182. package/dist/performance/index.js +3 -3
  183. package/dist/plugins/helpers.js +3 -6
  184. package/dist/plugins/index.js +39 -4
  185. package/dist/plugins/install.d.ts +28 -9
  186. package/dist/plugins/install.js +302 -56
  187. package/dist/plugins/pluginAuth.d.ts +1 -1
  188. package/dist/plugins/pluginAuth.js +13 -10
  189. package/dist/plugins/state.js +2 -3
  190. package/dist/posts/activity.d.ts +9 -0
  191. package/dist/posts/activity.js +34 -0
  192. package/dist/posts/contextClosure.d.ts +1 -9
  193. package/dist/posts/contextClosure.js +14 -44
  194. package/dist/posts/conversationQueries.d.ts +7 -0
  195. package/dist/posts/conversationQueries.js +76 -4
  196. package/dist/posts/eventAgenda.d.ts +1 -0
  197. package/dist/posts/eventAgenda.js +17 -8
  198. package/dist/posts/eventOccurrenceJobs.js +7 -2
  199. package/dist/posts/eventOccurrences.d.ts +6 -0
  200. package/dist/posts/eventOccurrences.js +22 -1
  201. package/dist/posts/finders.d.ts +56 -9
  202. package/dist/posts/finders.js +84 -23
  203. package/dist/posts/helpers/filters.js +13 -9
  204. package/dist/posts/helpers/index.d.ts +179 -14
  205. package/dist/posts/helpers/index.js +70 -34
  206. package/dist/posts/index.d.ts +5 -2
  207. package/dist/posts/index.js +5 -2
  208. package/dist/posts/mapping.d.ts +765 -30
  209. package/dist/posts/mapping.js +74 -31
  210. package/dist/posts/mutations.d.ts +516 -3
  211. package/dist/posts/mutations.js +179 -41
  212. package/dist/posts/pollEnd.d.ts +3 -0
  213. package/dist/posts/pollEnd.js +4 -0
  214. package/dist/posts/pollEndJobs.d.ts +8 -0
  215. package/dist/posts/pollEndJobs.js +49 -0
  216. package/dist/posts/replyClosure.d.ts +10 -0
  217. package/dist/posts/replyClosure.js +43 -0
  218. package/dist/posts/rsvpConfirmationEmail.js +23 -15
  219. package/dist/posts/threadPreview.d.ts +8 -0
  220. package/dist/posts/threadPreview.js +44 -0
  221. package/dist/posts/unseenCounts.js +4 -1
  222. package/dist/processingStats/queries.js +6 -7
  223. package/dist/profileSettings/cache.js +21 -5
  224. package/dist/profileSettings/mapping.d.ts +2 -0
  225. package/dist/profiles/activityQueries.d.ts +5 -0
  226. package/dist/profiles/activityQueries.js +85 -0
  227. package/dist/profiles/activitySummary.d.ts +3 -0
  228. package/dist/profiles/activitySummary.js +82 -0
  229. package/dist/profiles/blocks.d.ts +12 -0
  230. package/dist/profiles/blocks.js +73 -0
  231. package/dist/profiles/cache.d.ts +1 -0
  232. package/dist/profiles/cache.js +30 -10
  233. package/dist/profiles/export.js +30 -39
  234. package/dist/profiles/finders.d.ts +2 -1
  235. package/dist/profiles/finders.js +15 -8
  236. package/dist/profiles/helpers.d.ts +2 -0
  237. package/dist/profiles/index.d.ts +2 -0
  238. package/dist/profiles/index.js +2 -0
  239. package/dist/profiles/mapping.d.ts +10 -5
  240. package/dist/profiles/mapping.js +13 -1
  241. package/dist/profiles/mutations.d.ts +8 -4
  242. package/dist/profiles/mutations.js +31 -4
  243. package/dist/redis/connection.d.ts +2 -0
  244. package/dist/redis/connection.js +25 -6
  245. package/dist/reports/helpers.js +7 -3
  246. package/dist/roles/index.d.ts +1 -1
  247. package/dist/roles/index.js +1 -1
  248. package/dist/roles/mapping.d.ts +1 -0
  249. package/dist/roles/mutations.js +85 -3
  250. package/dist/search/finders.js +15 -3
  251. package/dist/search/helpers.js +1 -1
  252. package/dist/search/mapping.d.ts +1 -1
  253. package/dist/search/mapping.js +6 -2
  254. package/dist/sentry/index.js +9 -11
  255. package/dist/seo/index.d.ts +50 -0
  256. package/dist/seo/index.js +145 -0
  257. package/dist/seo/route.d.ts +18 -0
  258. package/dist/seo/route.js +19 -0
  259. package/dist/server/index.d.ts +19 -0
  260. package/dist/server/index.js +31 -14
  261. package/dist/server/stablePublicServerInfo.d.ts +17 -0
  262. package/dist/server/stablePublicServerInfo.js +37 -0
  263. package/dist/server/status.d.ts +25 -0
  264. package/dist/server/status.js +97 -0
  265. package/dist/session/index.js +2 -2
  266. package/dist/stats/finders.d.ts +1 -17681
  267. package/dist/stats/finders.js +22 -9
  268. package/dist/stats/helpers.js +4 -1
  269. package/dist/stats/mapping.d.ts +39 -2
  270. package/dist/stats/mapping.js +8 -4
  271. package/dist/stripe/cache.js +5 -6
  272. package/dist/stripe/connection.js +3 -4
  273. package/dist/stripe/helpers.js +15 -20
  274. package/package.json +5 -7
  275. package/dist/db/migration/detect.d.ts +0 -3
  276. package/dist/db/migration/detect.js +0 -33
  277. package/dist/db/migration/importPostgres.d.ts +0 -3
  278. package/dist/db/migration/importPostgres.js +0 -18
  279. package/dist/db/migration/transform.d.ts +0 -20
  280. package/dist/db/migration/transform.js +0 -232
  281. package/dist/db/migration/validate.d.ts +0 -18
  282. package/dist/db/migration/validate.js +0 -69
  283. package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
  284. package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
  285. package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
  286. package/dist/db/pg/sql/meta/0006_snapshot.json +0 -4200
  287. package/dist/db/pg/sql/meta/0007_snapshot.json +0 -4179
  288. package/dist/mastodon/index.d.ts +0 -4
  289. package/dist/mastodon/index.js +0 -51
  290. package/dist/mastodon/types.d.ts +0 -7579
  291. package/dist/mastodon/types.js +0 -523
  292. package/dist/mastodon/typescript.d.ts +0 -1578
  293. package/dist/mastodon/typescript.js +0 -1
  294. package/dist/migration/index.d.ts +0 -4
  295. package/dist/migration/index.js +0 -4
  296. package/dist/roles/defaults.d.ts +0 -2
  297. package/dist/roles/defaults.js +0 -95
@@ -1,15 +1,5 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { spawn } from 'node:child_process';
2
+ import { createRequire } from 'node:module';
13
3
  import fs from 'node:fs/promises';
14
4
  import path from 'node:path';
15
5
  import { defaultConfig } from '../config/index.js';
@@ -20,20 +10,24 @@ import { nowIso } from '../db/pg/mappers.js';
20
10
  import { eq } from 'drizzle-orm';
21
11
  import { setPluginEnabledOverride } from './state.js';
22
12
  const log = logger('core:plugins:install');
13
+ const requireFromHost = createRequire(new URL('../../package.json', import.meta.url));
14
+ const MAX_COMMAND_OUTPUT = 16_000;
23
15
  const INSTALLED_PLUGINS_KEY = 'openpeeps-installed-plugins';
24
- const getInstalledPlugins = async () => {
25
- var _a, _b;
16
+ export const getInstalledPlugins = async () => {
26
17
  const { db } = await allpeepDb();
27
18
  const rows = await db
28
19
  .select()
29
20
  .from(configs)
30
21
  .where(eq(configs.key, INSTALLED_PLUGINS_KEY))
31
22
  .limit(1);
32
- return (_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a.body) !== null && _b !== void 0 ? _b : {};
23
+ return rows[0]?.body ?? {};
33
24
  };
34
- const setInstalledPlugin = async (pluginKey, source, installedBy) => {
25
+ const setInstalledPlugin = async (pluginKey, source, requiresAuth, installedBy) => {
35
26
  const installed = await getInstalledPlugins();
36
- const body = Object.assign(Object.assign({}, installed), { [pluginKey]: { source, installedAt: nowIso(), installedBy } });
27
+ const body = {
28
+ ...installed,
29
+ [pluginKey]: { source, requiresAuth, installedAt: nowIso(), installedBy },
30
+ };
37
31
  const ts = nowIso();
38
32
  const { db } = await allpeepDb();
39
33
  await db
@@ -46,7 +40,7 @@ const setInstalledPlugin = async (pluginKey, source, installedBy) => {
46
40
  };
47
41
  const removeInstalledPlugin = async (pluginKey) => {
48
42
  const installed = await getInstalledPlugins();
49
- const _a = installed, _b = pluginKey, _removed = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
43
+ const rest = Object.fromEntries(Object.entries(installed).filter(([key]) => key !== pluginKey));
50
44
  const ts = nowIso();
51
45
  const { db } = await allpeepDb();
52
46
  await db
@@ -62,8 +56,22 @@ const removeInstalledPlugin = async (pluginKey) => {
62
56
  set: { body: rest, updatedAt: ts },
63
57
  });
64
58
  };
65
- const runCommand = (command, args, cwd) => new Promise((resolve) => {
66
- const child = spawn(command, args, { cwd, shell: true });
59
+ const runCommand = (command, args, cwd, environment = {}) => new Promise((resolve) => {
60
+ const child = spawn(command, args, {
61
+ cwd,
62
+ env: {
63
+ HOME: process.env.HOME,
64
+ LANG: process.env.LANG,
65
+ LC_ALL: process.env.LC_ALL,
66
+ NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS,
67
+ PATH: process.env.PATH,
68
+ SSL_CERT_DIR: process.env.SSL_CERT_DIR,
69
+ SSL_CERT_FILE: process.env.SSL_CERT_FILE,
70
+ TMPDIR: process.env.TMPDIR,
71
+ ...environment,
72
+ },
73
+ shell: false,
74
+ });
67
75
  let stdout = '';
68
76
  let stderr = '';
69
77
  child.stdout.on('data', (chunk) => {
@@ -73,7 +81,7 @@ const runCommand = (command, args, cwd) => new Promise((resolve) => {
73
81
  stderr += chunk.toString();
74
82
  });
75
83
  child.on('close', (exitCode) => {
76
- resolve({ exitCode: exitCode !== null && exitCode !== void 0 ? exitCode : 1, stdout, stderr });
84
+ resolve({ exitCode: exitCode ?? 1, stdout, stderr });
77
85
  });
78
86
  child.on('error', (err) => {
79
87
  resolve({ exitCode: 1, stdout, stderr: String(err) });
@@ -83,13 +91,174 @@ const getPluginDir = async () => {
83
91
  const { plugins } = await defaultConfig;
84
92
  return plugins.path;
85
93
  };
94
+ const redactUrl = (url) => {
95
+ const parsed = new URL(url);
96
+ if (parsed.protocol !== 'ssh:') {
97
+ parsed.username = '';
98
+ }
99
+ parsed.password = '';
100
+ return parsed.toString();
101
+ };
86
102
  const sourceLabel = (source) => source.type === 'npm'
87
103
  ? `npm:${source.package}${source.version ? `@${source.version}` : ''}`
88
- : `git:${source.url}${source.ref ? `#${source.ref}` : ''}`;
89
- export const installPlugin = async (source, installedBy) => {
90
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
104
+ : `git:${redactUrl(source.url)}${source.ref ? `#${source.ref}` : ''}`;
105
+ /**
106
+ * Inverse of sourceLabel for credentials-free sources; undefined when the
107
+ * stored label is not a label this version produced.
108
+ */
109
+ const parseInstallSource = (label) => {
110
+ if (label.startsWith('npm:')) {
111
+ const spec = label.slice('npm:'.length);
112
+ const at = spec.lastIndexOf('@');
113
+ // A leading '@' is the scope prefix, not a version separator.
114
+ if (at <= 0) {
115
+ return { type: 'npm', package: spec };
116
+ }
117
+ return {
118
+ type: 'npm',
119
+ package: spec.slice(0, at),
120
+ version: spec.slice(at + 1),
121
+ };
122
+ }
123
+ if (label.startsWith('git:')) {
124
+ const spec = label.slice('git:'.length);
125
+ const hash = spec.indexOf('#');
126
+ if (hash === -1) {
127
+ return { type: 'git', url: spec };
128
+ }
129
+ return { type: 'git', url: spec.slice(0, hash), ref: spec.slice(hash + 1) };
130
+ }
131
+ return undefined;
132
+ };
133
+ const sourceSecrets = (source) => {
134
+ if (source.type === 'npm') {
135
+ return source.auth ? [source.auth.token] : [];
136
+ }
137
+ if (!source.auth) {
138
+ return [];
139
+ }
140
+ if (source.auth.type === 'token') {
141
+ return [source.auth.token];
142
+ }
143
+ return [source.auth.privateKey];
144
+ };
145
+ const redactSecrets = (value, secrets) => secrets.reduce((redacted, secret) => redacted.split(secret).join('[REDACTED]'), value);
146
+ const trimCommandOutput = (value) => value.length <= MAX_COMMAND_OUTPUT
147
+ ? value
148
+ : `${value.slice(0, MAX_COMMAND_OUTPUT)}\n… truncated`;
149
+ const commandFailure = (operation, result, secrets) => {
150
+ const output = [result.stderr, result.stdout]
151
+ .map((part) => part.trim())
152
+ .filter(Boolean)
153
+ .join('\n');
154
+ return redactSecrets(`${operation} failed: ${trimCommandOutput(output)}`, secrets).trim();
155
+ };
156
+ const peerDependencyNames = (pkgJson) => {
157
+ const peers = pkgJson.peerDependencies;
158
+ if (!peers || typeof peers !== 'object' || Array.isArray(peers)) {
159
+ return [];
160
+ }
161
+ return Object.keys(peers);
162
+ };
163
+ const resolveHostPackage = async (name) => {
164
+ let current = path.dirname(requireFromHost.resolve(name));
165
+ while (true) {
166
+ try {
167
+ const pkg = JSON.parse(await fs.readFile(path.join(current, 'package.json'), 'utf8'));
168
+ if (pkg.name === name) {
169
+ return current;
170
+ }
171
+ }
172
+ catch {
173
+ // Keep walking toward the filesystem root.
174
+ }
175
+ const parent = path.dirname(current);
176
+ if (parent === current) {
177
+ throw new Error(`Could not locate package root for "${name}".`);
178
+ }
179
+ current = parent;
180
+ }
181
+ };
182
+ export const linkHostPeerDependencies = async (installDir, names) => {
183
+ for (const name of names) {
184
+ let resolved;
185
+ try {
186
+ resolved = await resolveHostPackage(name);
187
+ }
188
+ catch {
189
+ return {
190
+ success: false,
191
+ error: `Host does not provide peer dependency "${name}".`,
192
+ };
193
+ }
194
+ const destination = path.join(installDir, 'node_modules', name);
195
+ await fs.mkdir(path.dirname(destination), { recursive: true });
196
+ await fs.rm(destination, { recursive: true, force: true });
197
+ await fs.symlink(resolved, destination);
198
+ }
199
+ return { success: true };
200
+ };
201
+ const writeNpmConfig = async (tempDir, auth) => {
202
+ if (!auth) {
203
+ return {};
204
+ }
205
+ const registry = new URL(auth.registry ?? 'https://registry.npmjs.org/');
206
+ const registryUrl = registry.toString().replace(/\/?$/, '/');
207
+ const authPath = registry.pathname.replace(/\/?$/, '/');
208
+ const configPath = path.join(tempDir, '.npmrc');
209
+ await fs.writeFile(configPath, [
210
+ `registry=${registryUrl}`,
211
+ `//${registry.host}${authPath}:_authToken=${auth.token}`,
212
+ 'always-auth=true',
213
+ '',
214
+ ].join('\n'), { mode: 0o600 });
215
+ return { NPM_CONFIG_USERCONFIG: configPath };
216
+ };
217
+ const removeNpmConfig = (tempDir) => fs.rm(path.join(tempDir, '.npmrc'), { force: true });
218
+ const writeGitAuth = async (tempDir, auth) => {
219
+ if (!auth) {
220
+ return { GIT_TERMINAL_PROMPT: '0' };
221
+ }
222
+ if (auth.type === 'token') {
223
+ const askpassPath = path.join(tempDir, 'git-askpass');
224
+ await fs.writeFile(askpassPath, [
225
+ '#!/bin/sh',
226
+ 'case "$1" in',
227
+ ' *Username*) printf "%s\\n" "$OPENPEEPS_GIT_USERNAME" ;;',
228
+ ' *) printf "%s\\n" "$OPENPEEPS_GIT_TOKEN" ;;',
229
+ 'esac',
230
+ '',
231
+ ].join('\n'), { mode: 0o700 });
232
+ return {
233
+ GIT_ASKPASS: askpassPath,
234
+ GIT_ASKPASS_REQUIRE: 'force',
235
+ GIT_TERMINAL_PROMPT: '0',
236
+ OPENPEEPS_GIT_TOKEN: auth.token,
237
+ OPENPEEPS_GIT_USERNAME: auth.username,
238
+ };
239
+ }
240
+ const keyPath = path.join(tempDir, 'git-deploy-key');
241
+ const knownHostsPath = path.join(tempDir, 'known_hosts');
242
+ await fs.writeFile(keyPath, `${auth.privateKey.trim()}\n`, { mode: 0o600 });
243
+ await fs.writeFile(knownHostsPath, '', { mode: 0o600 });
244
+ return {
245
+ GIT_SSH_COMMAND: [
246
+ 'ssh',
247
+ '-F /dev/null',
248
+ `-i "${keyPath}"`,
249
+ '-o BatchMode=yes',
250
+ '-o IdentitiesOnly=yes',
251
+ '-o StrictHostKeyChecking=accept-new',
252
+ `-o UserKnownHostsFile="${knownHostsPath}"`,
253
+ ].join(' '),
254
+ GIT_SSH_VARIANT: 'ssh',
255
+ GIT_TERMINAL_PROMPT: '0',
256
+ };
257
+ };
258
+ export const installPlugin = async (source, installedBy, options) => {
91
259
  const pluginsDir = await getPluginDir();
92
260
  const label = sourceLabel(source);
261
+ const secrets = sourceSecrets(source);
93
262
  let tempDir;
94
263
  try {
95
264
  tempDir = await fs.mkdtemp(path.join(pluginsDir, '.install-'));
@@ -100,6 +269,7 @@ export const installPlugin = async (source, installedBy) => {
100
269
  }
101
270
  try {
102
271
  let installDir;
272
+ let npmEnvironment;
103
273
  if (source.type === 'npm') {
104
274
  const pkg = source.version
105
275
  ? `${source.package}@${source.version}`
@@ -107,35 +277,46 @@ export const installPlugin = async (source, installedBy) => {
107
277
  log.info(`Installing npm package ${pkg} to temp dir ${tempDir}`);
108
278
  const init = await runCommand('npm', ['init', '-y'], tempDir);
109
279
  if (init.exitCode !== 0) {
110
- return { success: false, error: `npm init failed: ${init.stderr}` };
280
+ const error = commandFailure('npm init', init, secrets);
281
+ log.error(new Error(error), `npm init failed for ${label}.`);
282
+ return { success: false, error };
111
283
  }
112
- const install = await runCommand('npm', ['install', pkg], tempDir);
284
+ npmEnvironment = await writeNpmConfig(tempDir, source.auth);
285
+ const install = await runCommand('npm', ['install', '--omit=peer', pkg], tempDir, npmEnvironment);
113
286
  if (install.exitCode !== 0) {
114
- return {
115
- success: false,
116
- error: `npm install failed: ${install.stderr}`,
117
- };
287
+ const error = commandFailure('npm install', install, secrets);
288
+ log.error(new Error(error), `npm install failed for ${label}.`);
289
+ return { success: false, error };
118
290
  }
119
291
  installDir = path.join(tempDir, 'node_modules', source.package);
120
292
  }
121
293
  else {
122
- log.info(`Cloning git repo ${source.url} to temp dir ${tempDir}`);
294
+ const repositoryUrl = redactUrl(source.url);
295
+ log.info(`Cloning git repo ${repositoryUrl} to temp dir ${tempDir}`);
123
296
  const cloneArgs = ['clone', '--depth', '1'];
124
297
  if (source.ref) {
125
298
  cloneArgs.push('--branch', source.ref);
126
299
  }
127
- cloneArgs.push(source.url, path.join(tempDir, 'repo'));
128
- const clone = await runCommand('git', cloneArgs, tempDir);
300
+ cloneArgs.push(repositoryUrl, path.join(tempDir, 'repo'));
301
+ const gitEnvironment = await writeGitAuth(tempDir, source.auth);
302
+ const clone = await runCommand('git', cloneArgs, tempDir, gitEnvironment);
129
303
  if (clone.exitCode !== 0) {
130
- return { success: false, error: `git clone failed: ${clone.stderr}` };
304
+ const error = commandFailure('git clone', clone, secrets);
305
+ log.error(new Error(error), `git clone failed for ${label}.`);
306
+ return { success: false, error };
131
307
  }
132
308
  installDir = path.join(tempDir, 'repo');
133
309
  }
134
310
  // Read package.json to determine namespace/name
135
311
  const pkgJsonRaw = await fs.readFile(path.join(installDir, 'package.json'), 'utf-8');
136
312
  const pkgJson = JSON.parse(pkgJsonRaw);
137
- const namespace = (_e = (_b = (_a = pkgJson.openpeeps) === null || _a === void 0 ? void 0 : _a.namespace) !== null && _b !== void 0 ? _b : (_d = (_c = pkgJson.name) === null || _c === void 0 ? void 0 : _c.split('/')[0]) === null || _d === void 0 ? void 0 : _d.replace(/^@/, '')) !== null && _e !== void 0 ? _e : 'custom';
138
- const name = (_l = (_j = (_g = (_f = pkgJson.openpeeps) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : (_h = pkgJson.name) === null || _h === void 0 ? void 0 : _h.split('/')[1]) !== null && _j !== void 0 ? _j : (_k = pkgJson.name) === null || _k === void 0 ? void 0 : _k.replace(/^@[^/]+\//, '')) !== null && _l !== void 0 ? _l : 'plugin';
313
+ const namespace = pkgJson.openpeeps?.namespace ??
314
+ pkgJson.name?.split('/')[0]?.replace(/^@/, '') ??
315
+ 'custom';
316
+ const name = pkgJson.openpeeps?.name ??
317
+ pkgJson.name?.split('/')[1] ??
318
+ pkgJson.name?.replace(/^@[^/]+\//, '') ??
319
+ 'plugin';
139
320
  const pluginKey = `${namespace}/${name}`;
140
321
  const destDir = path.join(pluginsDir, namespace, name);
141
322
  // Check if already exists in the plugins dir (built-in)
@@ -158,42 +339,59 @@ export const installPlugin = async (source, installedBy) => {
158
339
  }
159
340
  }
160
341
  // Build the plugin if it has a build script
161
- if ((_m = pkgJson.scripts) === null || _m === void 0 ? void 0 : _m.build) {
342
+ if (pkgJson.scripts?.build) {
162
343
  log.info(`Building plugin ${pluginKey}...`);
163
- const buildDeps = await runCommand('npm', ['install'], installDir);
344
+ const buildDeps = await runCommand('npm', ['install', '--omit=peer'], installDir, npmEnvironment);
164
345
  if (buildDeps.exitCode !== 0) {
165
- return {
166
- success: false,
167
- error: `Dependency install failed: ${buildDeps.stderr}`,
168
- };
346
+ const error = commandFailure('Dependency install', buildDeps, secrets);
347
+ log.error(new Error(error), `Plugin ${pluginKey} dependency install failed.`);
348
+ return { success: false, error };
349
+ }
350
+ const linked = await linkHostPeerDependencies(installDir, peerDependencyNames(pkgJson));
351
+ if (!linked.success) {
352
+ log.error(new Error(linked.error), `Plugin ${pluginKey} peer link failed.`);
353
+ return linked;
169
354
  }
170
- const build = await runCommand('npm', ['run', 'build'], installDir);
355
+ // The plugin temp dir sits under the host tree. A plugin script that
356
+ // invokes pnpm would otherwise adopt the host workspace.
357
+ await fs.writeFile(path.join(installDir, 'pnpm-workspace.yaml'), "packages:\n - '.'\n");
358
+ await removeNpmConfig(tempDir);
359
+ const build = await runCommand('npm', ['run', 'build'], installDir, {
360
+ CI: 'true',
361
+ });
171
362
  if (build.exitCode !== 0) {
172
- return {
173
- success: false,
174
- error: `Build failed: ${build.stderr}`,
175
- };
363
+ const error = commandFailure('Build', build, secrets);
364
+ log.error(new Error(error), `Plugin ${pluginKey} build failed.`);
365
+ return { success: false, error };
176
366
  }
177
367
  }
178
368
  // Move to final location
369
+ await removeNpmConfig(tempDir);
179
370
  await fs.mkdir(path.join(pluginsDir, namespace), { recursive: true });
180
371
  await fs.rm(destDir, { recursive: true, force: true });
181
372
  await fs.cp(installDir, destDir, { recursive: true });
182
- await fs.rm(tempDir, { recursive: true, force: true });
183
- await setInstalledPlugin(pluginKey, label, installedBy);
184
- // Installed plugins never auto-enable — an admin must explicitly
185
- // activate them via the enable toggle (Phase B) after reviewing them.
186
- await setPluginEnabledOverride(pluginKey, false);
187
- log.info(`Plugin ${pluginKey} installed successfully from ${label}${installedBy ? ` by ${installedBy}` : ''}. Disabled by default — activate it explicitly to load it.`);
373
+ await setInstalledPlugin(pluginKey, label, secrets.length > 0, installedBy);
374
+ if (options?.selfHeal) {
375
+ // Re-downloading an already-reviewed plugin keeps its enabled state.
376
+ log.info(`Self-healed plugin ${pluginKey} (re-downloaded from ${label}).`);
377
+ }
378
+ else {
379
+ // Installed plugins never auto-enable — an admin must explicitly
380
+ // activate them via the enable toggle (Phase B) after reviewing them.
381
+ await setPluginEnabledOverride(pluginKey, false);
382
+ log.info(`Plugin ${pluginKey} installed successfully from ${label}${installedBy ? ` by ${installedBy}` : ''}. Disabled by default — activate it explicitly to load it.`);
383
+ }
188
384
  return { success: true, pluginKey };
189
385
  }
190
386
  catch (e) {
191
- // Cleanup on any error
192
- await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
193
- const message = e instanceof Error ? e.message : String(e);
194
- log.error(e, `Failed to install plugin from ${label}.`);
387
+ const rawMessage = e instanceof Error ? e.message : String(e);
388
+ const message = redactSecrets(rawMessage, secrets);
389
+ log.error(new Error(message), `Failed to install plugin from ${label}.`);
195
390
  return { success: false, error: message };
196
391
  }
392
+ finally {
393
+ await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
394
+ }
197
395
  };
198
396
  export const uninstallPlugin = async (pluginKey, uninstalledBy) => {
199
397
  const installed = await getInstalledPlugins();
@@ -217,6 +415,54 @@ export const uninstallPlugin = async (pluginKey, uninstalledBy) => {
217
415
  return { success: false, error: message };
218
416
  }
219
417
  };
418
+ /**
419
+ * Re-downloads admin-installed plugins whose files are missing from the
420
+ * plugins directory (e.g. after a container recreate whose plugins path was
421
+ * not a persistent volume). Credentials are not stored, so plugins installed
422
+ * from private sources cannot be re-fetched — they are reported for manual
423
+ * re-install instead. Returns pluginKey -> reason for every plugin that is
424
+ * still unavailable after the attempt.
425
+ */
426
+ export const selfHealInstalledPlugins = async () => {
427
+ const installed = await getInstalledPlugins();
428
+ const pluginsDir = await getPluginDir();
429
+ const failures = {};
430
+ for (const [pluginKey, record] of Object.entries(installed)) {
431
+ const healthy = await fs
432
+ .access(path.join(pluginsDir, pluginKey, 'package.json'))
433
+ .then(() => true)
434
+ .catch(() => false);
435
+ if (healthy)
436
+ continue;
437
+ if (record.requiresAuth) {
438
+ log.error(`Plugin ${pluginKey} files are missing and it was installed from a private source; re-install it with credentials.`);
439
+ failures[pluginKey] =
440
+ 'Plugin files are missing. It was installed from a private source, which cannot be re-downloaded automatically — reinstall it with its credentials.';
441
+ continue;
442
+ }
443
+ const source = parseInstallSource(record.source);
444
+ if (!source) {
445
+ log.error(`Plugin ${pluginKey} files are missing and its recorded source "${record.source}" could not be parsed.`);
446
+ failures[pluginKey] =
447
+ 'Plugin files are missing and its recorded install source is no longer recognizable — reinstall it.';
448
+ continue;
449
+ }
450
+ try {
451
+ const result = await installPlugin(source, record.installedBy, {
452
+ selfHeal: true,
453
+ });
454
+ if (!result.success) {
455
+ log.error(new Error(result.error ?? 'unknown error'), `Self-heal failed for plugin ${pluginKey}.`);
456
+ failures[pluginKey] = `Automatic re-download failed: ${result.error}`;
457
+ }
458
+ }
459
+ catch (e) {
460
+ log.error(e, `Self-heal failed for plugin ${pluginKey}.`);
461
+ failures[pluginKey] = `Automatic re-download failed: ${e instanceof Error ? e.message : String(e)}`;
462
+ }
463
+ }
464
+ return failures;
465
+ };
220
466
  export const getInstalledPluginKeys = async () => {
221
467
  const installed = await getInstalledPlugins();
222
468
  return Object.keys(installed);
@@ -26,5 +26,5 @@ declare global {
26
26
  * or verify whether the profile/account still exists. Plugin authors that need
27
27
  * stronger guarantees or the handle should perform their own lookup.
28
28
  */
29
- export declare const ensurePluginAuth: () => (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
29
+ export declare const ensurePluginAuth: () => (req: Request, res: Response, next: NextFunction) => Promise<void>;
30
30
  export {};
@@ -17,28 +17,31 @@ import { jwtUtil } from '../jwt/index.js';
17
17
  * stronger guarantees or the handle should perform their own lookup.
18
18
  */
19
19
  export const ensurePluginAuth = () => async (req, res, next) => {
20
- var _a;
20
+ // Express 5's RequestHandler type requires `void | Promise<void>` — never
21
+ // `return res...`, which types as `Promise<Response>` and fails overload
22
+ // resolution wherever this middleware is passed to router.post/get/etc.
21
23
  const authHeader = req.headers.authorization;
22
24
  if (!authHeader || !authHeader.startsWith('Bearer ')) {
23
- return res.status(401).json({ success: false, message: 'Unauthorized' });
25
+ res.status(401).json({ success: false, message: 'Unauthorized' });
26
+ return;
24
27
  }
25
28
  const token = authHeader.slice(7);
26
29
  if (!token) {
27
- return res.status(401).json({ success: false, message: 'Unauthorized' });
30
+ res.status(401).json({ success: false, message: 'Unauthorized' });
31
+ return;
28
32
  }
29
33
  try {
30
34
  const jwt = await jwtUtil();
31
35
  const verified = await jwt.verify(token);
32
- const payload = verified === null || verified === void 0 ? void 0 : verified.payload;
33
- if (!((_a = payload === null || payload === void 0 ? void 0 : payload.identities) === null || _a === void 0 ? void 0 : _a.profile)) {
34
- return res
35
- .status(401)
36
- .json({ success: false, message: 'Invalid token' });
36
+ const payload = verified?.payload;
37
+ if (!payload?.identities?.profile) {
38
+ res.status(401).json({ success: false, message: 'Invalid token' });
39
+ return;
37
40
  }
38
41
  req.pluginProfile = { id: payload.identities.profile };
39
42
  next();
40
43
  }
41
- catch (_b) {
42
- return res.status(401).json({ success: false, message: 'Unauthorized' });
44
+ catch {
45
+ res.status(401).json({ success: false, message: 'Unauthorized' });
43
46
  }
44
47
  };
@@ -8,16 +8,15 @@ import { nowIso } from '../db/pg/mappers.js';
8
8
  // one — this is a small, boot-time-read key/value document, not a relation.
9
9
  const PLUGIN_STATE_KEY = 'openpeeps-plugin-state';
10
10
  export const getPluginStateOverrides = () => allpeepDb().then(async ({ db }) => {
11
- var _a, _b;
12
11
  const rows = await db
13
12
  .select()
14
13
  .from(configs)
15
14
  .where(eq(configs.key, PLUGIN_STATE_KEY))
16
15
  .limit(1);
17
- return (_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a.body) !== null && _b !== void 0 ? _b : {};
16
+ return rows[0]?.body ?? {};
18
17
  });
19
18
  export const setPluginEnabledOverride = (pluginKey, enabled) => getPluginStateOverrides().then((overrides) => {
20
- const body = Object.assign(Object.assign({}, overrides), { [pluginKey]: enabled });
19
+ const body = { ...overrides, [pluginKey]: enabled };
21
20
  const ts = nowIso();
22
21
  return allpeepDb().then(({ db }) => db
23
22
  .insert(configs)
@@ -0,0 +1,9 @@
1
+ import type { PgDb } from '../db/pg/client';
2
+ /**
3
+ * Walk outbound `reply_to` until there is no parent. A root post is itself.
4
+ */
5
+ export declare const findReplyRootId: (db: PgDb, postId: string) => Promise<string>;
6
+ /** Bump conversation ordering without changing `created_at` or `updated_at`. */
7
+ export declare const touchPostActivity: (db: PgDb, postId: string) => Promise<void>;
8
+ /** Replies and reactions on any descendant bump the original/root post. */
9
+ export declare const bumpConversationActivity: (db: PgDb, postId: string) => Promise<void>;
@@ -0,0 +1,34 @@
1
+ import { sql } from 'drizzle-orm';
2
+ /**
3
+ * Walk outbound `reply_to` until there is no parent. A root post is itself.
4
+ */
5
+ export const findReplyRootId = async (db, postId) => {
6
+ const result = (await db.execute(sql `
7
+ WITH RECURSIVE walk AS (
8
+ SELECT ${postId}::text AS node_id, 0 AS depth
9
+ UNION ALL
10
+ SELECT rt.to_id, walk.depth + 1
11
+ FROM reply_to rt
12
+ INNER JOIN walk ON rt.from_id = walk.node_id
13
+ WHERE walk.depth < 64
14
+ )
15
+ SELECT node_id
16
+ FROM walk
17
+ ORDER BY depth DESC
18
+ LIMIT 1
19
+ `));
20
+ return result.rows[0]?.node_id ?? postId;
21
+ };
22
+ /** Bump conversation ordering without changing `created_at` or `updated_at`. */
23
+ export const touchPostActivity = async (db, postId) => {
24
+ await db.execute(sql `
25
+ UPDATE posts
26
+ SET last_activity_at = now()
27
+ WHERE id = ${postId}::uuid
28
+ `);
29
+ };
30
+ /** Replies and reactions on any descendant bump the original/root post. */
31
+ export const bumpConversationActivity = async (db, postId) => {
32
+ const rootId = await findReplyRootId(db, postId);
33
+ await touchPostActivity(db, rootId);
34
+ };
@@ -1,17 +1,9 @@
1
1
  import type { AuthorizationData, DbPost, PostWithMeta } from '@openpeepshq/common/types';
2
- import type { PgDb } from '../db/pg/client';
3
2
  import type { Mapping } from '../db/pg/map';
4
- export declare const CONTEXT_NODE_CAP = 100;
5
3
  type ClosureDirection = 'ancestors' | 'descendents';
6
- /** Collect reply-graph ids via one recursive CTE (capped). */
7
- export declare const collectReplyClosureIds: (db: PgDb, startId: string, direction: ClosureDirection, { maxDepth, limit, newestFirst, }?: {
8
- maxDepth?: number;
9
- limit?: number;
10
- newestFirst?: boolean;
11
- }) => Promise<string[]>;
4
+ export { CONTEXT_NODE_CAP, collectReplyClosureIds } from './replyClosure';
12
5
  /** Load and hydrate posts in a reply closure, then ACL-filter + transform. */
13
6
  export declare const loadReplyContextPosts: (authData: AuthorizationData, startId: string, direction: ClosureDirection, mapping: Mapping<DbPost>, { maxDepth, limit, }?: {
14
7
  maxDepth?: number;
15
8
  limit?: number;
16
9
  }) => Promise<PostWithMeta[]>;
17
- export {};