@openpeepshq/core 0.1.34 → 0.2.0

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 (192) 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 +13 -8
  6. package/dist/analytics/cache.js +3 -3
  7. package/dist/analytics/clicks.js +14 -22
  8. package/dist/analytics/compile.js +1 -2
  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 +116 -135
  14. package/dist/analytics/report.d.ts +2 -1
  15. package/dist/analytics/report.js +2 -3
  16. package/dist/analytics/settings.js +3 -4
  17. package/dist/backups/index.js +13 -16
  18. package/dist/backups/metadata.js +1 -1
  19. package/dist/config/db.js +2 -4
  20. package/dist/config/defaults/community.js +1 -0
  21. package/dist/config/defaults/core.js +13 -8
  22. package/dist/config/defaults/logs.d.ts +4 -0
  23. package/dist/config/defaults/logs.js +5 -0
  24. package/dist/config/index.d.ts +9 -0
  25. package/dist/config/index.js +9 -11
  26. package/dist/db/explorer/query.js +9 -8
  27. package/dist/db/explorer/sql.js +8 -8
  28. package/dist/db/helpers.js +15 -5
  29. package/dist/db/migration/importCollections.js +15 -18
  30. package/dist/db/migration/shared.js +15 -35
  31. package/dist/db/pg/client.js +4 -7
  32. package/dist/db/pg/filters/index.js +1 -1
  33. package/dist/db/pg/filters/posts.d.ts +2 -0
  34. package/dist/db/pg/filters/posts.js +3 -1
  35. package/dist/db/pg/helpers.js +2 -14
  36. package/dist/db/pg/map/filters.js +8 -8
  37. package/dist/db/pg/map/helpers.js +5 -1
  38. package/dist/db/pg/map/index.js +46 -51
  39. package/dist/db/pg/map/mutations.js +56 -21
  40. package/dist/db/pg/map/registry.js +87 -50
  41. package/dist/db/pg/map/relations.js +67 -63
  42. package/dist/db/pg/map/search.js +15 -37
  43. package/dist/db/pg/mappers.js +13 -7
  44. package/dist/db/pg/migrate.js +2 -3
  45. package/dist/db/pg/queries/activity.js +2 -2
  46. package/dist/db/pg/queries/derived.js +8 -12
  47. package/dist/db/pg/schema/documents.js +119 -18
  48. package/dist/db/pg/schema/edges.js +7 -1
  49. package/dist/db/pg/schema/index.js +5 -1
  50. package/dist/db/pg/sql/0016_posts_search_vector_title_tags_path.sql +54 -0
  51. package/dist/db/pg/sql/meta/_journal.json +8 -1
  52. package/dist/db/replaceOrigin.js +1 -1
  53. package/dist/email/queueStats.js +8 -11
  54. package/dist/email/render.js +7 -4
  55. package/dist/email/send.js +19 -17
  56. package/dist/email/smtpTest.js +10 -6
  57. package/dist/errors/index.js +1 -1
  58. package/dist/events/once.js +2 -4
  59. package/dist/federation/activities.js +1 -2
  60. package/dist/groups/finders.d.ts +2 -2
  61. package/dist/groups/helpers.d.ts +6 -6
  62. package/dist/groups/helpers.js +1 -2
  63. package/dist/groups/mapping.d.ts +4 -4
  64. package/dist/groups/mutations.js +1 -1
  65. package/dist/hashtags/finders.js +2 -2
  66. package/dist/inviteLinks/mutations.js +2 -3
  67. package/dist/jams/export.js +5 -7
  68. package/dist/jams/finders.js +4 -1
  69. package/dist/jams/health.d.ts +6 -4
  70. package/dist/jams/health.js +15 -11
  71. package/dist/jams/helpers.d.ts +2 -2
  72. package/dist/jams/helpers.js +6 -2
  73. package/dist/jams/index.js +2 -2
  74. package/dist/jams/jobs.js +1 -2
  75. package/dist/jams/livekit.d.ts +2 -2
  76. package/dist/jams/livekit.js +8 -8
  77. package/dist/jams/mapping.d.ts +10 -10
  78. package/dist/jams/mutations.d.ts +2 -2
  79. package/dist/jams/recording.js +1 -1
  80. package/dist/jams/token.js +13 -17
  81. package/dist/jobs/index.js +7 -6
  82. package/dist/jobs/jobDetail.js +5 -6
  83. package/dist/jobs/jobLog.js +2 -3
  84. package/dist/lib/streams.js +4 -39
  85. package/dist/lib/zodDeepPartial.d.ts +1 -1
  86. package/dist/lib/zodDeepPartial.js +1 -1
  87. package/dist/log/index.d.ts +1 -0
  88. package/dist/log/index.js +14 -29
  89. package/dist/log/retention.d.ts +9 -0
  90. package/dist/log/retention.js +83 -0
  91. package/dist/log/retentionJobs.d.ts +17 -0
  92. package/dist/log/retentionJobs.js +50 -0
  93. package/dist/media/index.js +127 -4
  94. package/dist/media/jobs.js +1 -2
  95. package/dist/media/openpeeps/index.js +11 -46
  96. package/dist/media/processing.js +7 -4
  97. package/dist/media/streaming.js +5 -5
  98. package/dist/media/streamingCleanupJobs.js +1 -2
  99. package/dist/media/streamingJobs.js +3 -4
  100. package/dist/media/streamingPrewarm.js +7 -11
  101. package/dist/mediaAttachments/index.js +6 -2
  102. package/dist/mediaAttachments/mapping.d.ts +1 -1
  103. package/dist/notifications/defaultNotifications/announcement/index.js +15 -18
  104. package/dist/notifications/defaultNotifications/directMessage/index.js +9 -8
  105. package/dist/notifications/defaultNotifications/follow/index.js +14 -17
  106. package/dist/notifications/defaultNotifications/groupAdded/index.js +14 -17
  107. package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +15 -18
  108. package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +15 -18
  109. package/dist/notifications/defaultNotifications/jamModerator/index.js +27 -20
  110. package/dist/notifications/defaultNotifications/jamModerator/recipients.d.ts +2 -0
  111. package/dist/notifications/defaultNotifications/jamModerator/recipients.js +5 -0
  112. package/dist/notifications/defaultNotifications/jamSpeaker/index.js +14 -18
  113. package/dist/notifications/defaultNotifications/jamStarted/index.js +18 -22
  114. package/dist/notifications/defaultNotifications/mention/index.js +20 -24
  115. package/dist/notifications/defaultNotifications/newGroupPost/index.js +9 -10
  116. package/dist/notifications/defaultNotifications/newGroupPost/recipients.d.ts +5 -0
  117. package/dist/notifications/defaultNotifications/newGroupPost/recipients.js +23 -0
  118. package/dist/notifications/defaultNotifications/newProfile/index.js +14 -17
  119. package/dist/notifications/defaultNotifications/pollEnded/index.js +21 -21
  120. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +2 -3
  121. package/dist/notifications/defaultNotifications/pollVote/index.js +14 -17
  122. package/dist/notifications/defaultNotifications/reaction/index.js +18 -21
  123. package/dist/notifications/defaultNotifications/reply/index.js +21 -22
  124. package/dist/notifications/defaultNotifications/repost/index.js +16 -20
  125. package/dist/notifications/defaultNotifications/rsvp/index.js +24 -18
  126. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +20 -13
  127. package/dist/notifications/eventIcsAttachment.d.ts +6 -0
  128. package/dist/notifications/eventIcsAttachment.js +32 -0
  129. package/dist/notifications/fcmCredential.js +1 -1
  130. package/dist/notifications/finders.js +1 -1
  131. package/dist/notifications/helpers.d.ts +11 -1
  132. package/dist/notifications/helpers.js +38 -9
  133. package/dist/notifications/jobs.js +16 -7
  134. package/dist/notifications/mutations.js +13 -2
  135. package/dist/notifications/push.js +11 -16
  136. package/dist/performance/index.js +3 -3
  137. package/dist/plugins/helpers.js +3 -6
  138. package/dist/plugins/index.js +2 -3
  139. package/dist/plugins/install.js +31 -17
  140. package/dist/plugins/pluginAuth.js +3 -4
  141. package/dist/plugins/state.js +2 -3
  142. package/dist/posts/activity.d.ts +1 -1
  143. package/dist/posts/activity.js +2 -3
  144. package/dist/posts/contextClosure.js +1 -2
  145. package/dist/posts/conversationQueries.js +2 -4
  146. package/dist/posts/eventAgenda.js +12 -7
  147. package/dist/posts/eventOccurrences.js +2 -2
  148. package/dist/posts/finders.d.ts +46 -6
  149. package/dist/posts/finders.js +21 -9
  150. package/dist/posts/helpers/filters.js +2 -3
  151. package/dist/posts/helpers/index.d.ts +170 -18
  152. package/dist/posts/helpers/index.js +43 -27
  153. package/dist/posts/mapping.d.ts +616 -84
  154. package/dist/posts/mapping.js +60 -18
  155. package/dist/posts/mutations.d.ts +85 -9
  156. package/dist/posts/mutations.js +47 -34
  157. package/dist/posts/pollEnd.js +3 -6
  158. package/dist/posts/rsvpConfirmationEmail.js +18 -8
  159. package/dist/posts/threadPreview.js +1 -1
  160. package/dist/processingStats/queries.js +6 -7
  161. package/dist/profileSettings/cache.js +1 -2
  162. package/dist/profileSettings/mapping.d.ts +1 -0
  163. package/dist/profiles/activitySummary.js +23 -28
  164. package/dist/profiles/cache.js +15 -8
  165. package/dist/profiles/export.js +30 -39
  166. package/dist/profiles/finders.js +7 -5
  167. package/dist/profiles/mapping.d.ts +10 -10
  168. package/dist/profiles/mutations.js +3 -5
  169. package/dist/redis/connection.js +1 -1
  170. package/dist/reports/helpers.js +7 -3
  171. package/dist/reports/mapping.d.ts +1 -1
  172. package/dist/roles/mutations.js +20 -21
  173. package/dist/search/finders.js +15 -3
  174. package/dist/search/helpers.js +1 -1
  175. package/dist/sentry/index.js +9 -11
  176. package/dist/seo/index.d.ts +50 -0
  177. package/dist/seo/index.js +145 -0
  178. package/dist/seo/route.d.ts +18 -0
  179. package/dist/seo/route.js +19 -0
  180. package/dist/server/index.d.ts +1 -0
  181. package/dist/server/index.js +16 -11
  182. package/dist/server/status.js +6 -7
  183. package/dist/session/index.js +2 -2
  184. package/dist/stats/finders.js +13 -4
  185. package/dist/stats/helpers.js +4 -1
  186. package/dist/stats/mapping.d.ts +43 -5
  187. package/dist/stats/mapping.js +9 -2
  188. package/dist/stripe/cache.js +5 -6
  189. package/dist/stripe/connection.js +3 -4
  190. package/dist/stripe/helpers.js +15 -20
  191. package/package.json +5 -6
  192. package/LICENSE +0 -674
@@ -3,7 +3,7 @@ import { postFilters } from '../db/pg/filters/index.js';
3
3
  import { postDerived } from '../db/pg/queries/index.js';
4
4
  import { collectionInfos } from '../db/index.js';
5
5
  import { groupsMapping } from '../groups/mapping.js';
6
- const seenBatchByCurrentProfileDerivedProperty = (profile) => postDerived.seenBatch(profile === null || profile === void 0 ? void 0 : profile.id);
6
+ const seenBatchByCurrentProfileDerivedProperty = (profile) => postDerived.seenBatch(profile?.id);
7
7
  export const entriesRelation = {
8
8
  alias: 'entries',
9
9
  edgeCollection: 'entries',
@@ -114,7 +114,10 @@ const preFilterMapData = {
114
114
  collection: 'posts',
115
115
  softDelete: true,
116
116
  };
117
- const basePostMapData = Object.assign(Object.assign({}, preFilterMapData), { postFilterRelations: basePostFilterRelations, postFilterDerivedProperties: [
117
+ const basePostMapData = {
118
+ ...preFilterMapData,
119
+ postFilterRelations: basePostFilterRelations,
120
+ postFilterDerivedProperties: [
118
121
  {
119
122
  alias: 'inReplyToId',
120
123
  resolve: postDerived.inReplyToId,
@@ -123,11 +126,15 @@ const basePostMapData = Object.assign(Object.assign({}, preFilterMapData), { pos
123
126
  alias: 'groupId',
124
127
  resolve: postDerived.groupId,
125
128
  },
126
- ] });
127
- const basePostMapDataForProfile = (profile) => (Object.assign(Object.assign({}, basePostMapData), { postFilterDerivedProperties: [
129
+ ],
130
+ };
131
+ const basePostMapDataForProfile = (profile) => ({
132
+ ...basePostMapData,
133
+ postFilterDerivedProperties: [
128
134
  ...(basePostMapData.postFilterDerivedProperties || []),
129
135
  seenBatchByCurrentProfileDerivedProperty(profile),
130
- ] }));
136
+ ],
137
+ });
131
138
  // Keep soft-deleted parents so replies can render a tombstone / deleted post.
132
139
  const replyPostMapData = {
133
140
  collection: 'posts',
@@ -160,26 +167,44 @@ export const repostRelation = {
160
167
  direction: 'OUTBOUND',
161
168
  skipEdge: true,
162
169
  cardinality: 'one',
163
- mapping: Object.assign(Object.assign({}, basePostMapData), { postFilterRelations: [...basePostFilterRelations, replyToRelation] }),
170
+ mapping: {
171
+ ...basePostMapData,
172
+ postFilterRelations: [...basePostFilterRelations, replyToRelation],
173
+ },
164
174
  };
165
- export const repostRelationForProfile = (profile) => (Object.assign(Object.assign({}, repostRelation), { mapping: Object.assign(Object.assign({}, basePostMapDataForProfile(profile)), { postFilterRelations: [...basePostFilterRelations, replyToRelation] }) }));
175
+ export const repostRelationForProfile = (profile) => ({
176
+ ...repostRelation,
177
+ mapping: {
178
+ ...basePostMapDataForProfile(profile),
179
+ postFilterRelations: [...basePostFilterRelations, replyToRelation],
180
+ },
181
+ });
166
182
  export const repostsOfPostRelation = {
167
183
  alias: 'reposts',
168
184
  edgeCollection: 'repost',
169
185
  direction: 'INBOUND',
170
186
  skipEdge: true,
171
187
  cardinality: 'many',
172
- mapping: Object.assign(Object.assign({}, basePostMapData), { postFilterRelations: [
188
+ mapping: {
189
+ ...basePostMapData,
190
+ postFilterRelations: [
173
191
  ...basePostFilterRelations,
174
192
  repostRelation,
175
193
  replyToRelation,
176
- ] }),
194
+ ],
195
+ },
177
196
  };
178
- export const repostsOfPostRelationForProfile = (profile) => (Object.assign(Object.assign({}, repostsOfPostRelation), { mapping: Object.assign(Object.assign({}, basePostMapDataForProfile(profile)), { postFilterRelations: [
197
+ export const repostsOfPostRelationForProfile = (profile) => ({
198
+ ...repostsOfPostRelation,
199
+ mapping: {
200
+ ...basePostMapDataForProfile(profile),
201
+ postFilterRelations: [
179
202
  ...basePostFilterRelations,
180
203
  repostRelationForProfile(profile),
181
204
  replyToRelation,
182
- ] }) }));
205
+ ],
206
+ },
207
+ });
183
208
  export const postsWithReplyCountMapping = map({
184
209
  collection: 'posts',
185
210
  relations: [replyCountRelation],
@@ -197,18 +222,27 @@ export const postsWithReplyToCountMapping = map({
197
222
  },
198
223
  ],
199
224
  });
200
- export const postsMapping = map(Object.assign(Object.assign({}, basePostMapData), { postFilterRelations: [
225
+ export const postsMapping = map({
226
+ ...basePostMapData,
227
+ postFilterRelations: [
201
228
  ...basePostFilterRelations,
202
229
  repostRelation,
203
230
  replyToRelation,
204
- ] }));
231
+ ],
232
+ });
205
233
  /** Auth / mark-seen: post graph without nested replyTo/repost hydrate. */
206
- export const postsAuthMapping = map(Object.assign(Object.assign({}, basePostMapData), { postFilterRelations: basePostFilterRelations }));
207
- export const postsMappingForProfile = (profile) => map(Object.assign(Object.assign({}, basePostMapDataForProfile(profile)), { postFilterRelations: [
234
+ export const postsAuthMapping = map({
235
+ ...basePostMapData,
236
+ postFilterRelations: basePostFilterRelations,
237
+ });
238
+ export const postsMappingForProfile = (profile) => map({
239
+ ...basePostMapDataForProfile(profile),
240
+ postFilterRelations: [
208
241
  ...basePostFilterRelations,
209
242
  repostRelationForProfile(profile),
210
243
  replyToRelation,
211
- ] }));
244
+ ],
245
+ });
212
246
  /** Lean mapping for post detail context — skips nested repost. Audience is
213
247
  * required so direct replies stay readable to the thread's recipients. */
214
248
  const contextPostFilterRelations = [
@@ -252,6 +286,14 @@ const conversationLeafFilters = [
252
286
  postFilters.replyCountZero(),
253
287
  postFilters.isDirect(),
254
288
  ];
255
- export const conversationLeavesMapping = map(Object.assign(Object.assign({}, basePostMapData), { relations: [replyCountRelation], filters: conversationLeafFilters }));
256
- export const conversationLeavesMappingForProfile = (profile) => map(Object.assign(Object.assign({}, basePostMapDataForProfile(profile)), { relations: [replyCountRelation], filters: conversationLeafFilters }));
289
+ export const conversationLeavesMapping = map({
290
+ ...basePostMapData,
291
+ relations: [replyCountRelation],
292
+ filters: conversationLeafFilters,
293
+ });
294
+ export const conversationLeavesMappingForProfile = (profile) => map({
295
+ ...basePostMapDataForProfile(profile),
296
+ relations: [replyCountRelation],
297
+ filters: conversationLeafFilters,
298
+ });
257
299
  export const postIdsMapping = map(preFilterMapData);
@@ -32,7 +32,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
32
32
  };
33
33
  description?: string | undefined;
34
34
  blurhash?: string | undefined;
35
- status?: "failed" | "processing" | "ready" | undefined;
35
+ status?: "failed" | "ready" | "processing" | undefined;
36
36
  error?: string | undefined;
37
37
  }[] | undefined;
38
38
  customEmojis?: {
@@ -69,7 +69,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
69
69
  };
70
70
  description?: string | undefined;
71
71
  blurhash?: string | undefined;
72
- status?: "failed" | "processing" | "ready" | undefined;
72
+ status?: "failed" | "ready" | "processing" | undefined;
73
73
  error?: string | undefined;
74
74
  }[] | undefined;
75
75
  customEmojis?: {
@@ -107,7 +107,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
107
107
  };
108
108
  description?: string | undefined;
109
109
  blurhash?: string | undefined;
110
- status?: "failed" | "processing" | "ready" | undefined;
110
+ status?: "failed" | "ready" | "processing" | undefined;
111
111
  error?: string | undefined;
112
112
  }[] | undefined;
113
113
  customEmojis?: {
@@ -189,7 +189,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
189
189
  };
190
190
  description?: string | undefined;
191
191
  blurhash?: string | undefined;
192
- status?: "failed" | "processing" | "ready" | undefined;
192
+ status?: "failed" | "ready" | "processing" | undefined;
193
193
  error?: string | undefined;
194
194
  }[] | undefined;
195
195
  customEmojis?: {
@@ -202,6 +202,44 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
202
202
  language?: string | undefined;
203
203
  image?: string | undefined;
204
204
  title?: string | undefined;
205
+ } | {
206
+ type: "resource";
207
+ title: string;
208
+ resourceKind: "file" | "link" | "video" | "gallery" | "audio";
209
+ content?: string | undefined;
210
+ sensitive?: boolean | undefined;
211
+ spoilerText?: string | undefined;
212
+ attachments?: {
213
+ type: string;
214
+ url: string;
215
+ previewUrl: string | null;
216
+ textUrl: null;
217
+ filename: string;
218
+ meta: {
219
+ usage?: string | undefined;
220
+ focus?: {
221
+ x: number;
222
+ y: number;
223
+ } | undefined;
224
+ mimetype?: string | undefined;
225
+ size?: number | undefined;
226
+ };
227
+ description?: string | undefined;
228
+ blurhash?: string | undefined;
229
+ status?: "failed" | "ready" | "processing" | undefined;
230
+ error?: string | undefined;
231
+ }[] | undefined;
232
+ customEmojis?: {
233
+ shortcode: string;
234
+ url: string;
235
+ staticUrl: string;
236
+ visibleInPicker: boolean;
237
+ category: string;
238
+ }[] | undefined;
239
+ language?: string | undefined;
240
+ tags?: string[] | undefined;
241
+ categoryPath?: string[] | undefined;
242
+ url?: string | undefined;
205
243
  };
206
244
  } | {
207
245
  type: "edit";
@@ -227,7 +265,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
227
265
  };
228
266
  description?: string | undefined;
229
267
  blurhash?: string | undefined;
230
- status?: "failed" | "processing" | "ready" | undefined;
268
+ status?: "failed" | "ready" | "processing" | undefined;
231
269
  error?: string | undefined;
232
270
  }[] | undefined;
233
271
  customEmojis?: {
@@ -264,7 +302,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
264
302
  };
265
303
  description?: string | undefined;
266
304
  blurhash?: string | undefined;
267
- status?: "failed" | "processing" | "ready" | undefined;
305
+ status?: "failed" | "ready" | "processing" | undefined;
268
306
  error?: string | undefined;
269
307
  }[] | undefined;
270
308
  customEmojis?: {
@@ -302,7 +340,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
302
340
  };
303
341
  description?: string | undefined;
304
342
  blurhash?: string | undefined;
305
- status?: "failed" | "processing" | "ready" | undefined;
343
+ status?: "failed" | "ready" | "processing" | undefined;
306
344
  error?: string | undefined;
307
345
  }[] | undefined;
308
346
  customEmojis?: {
@@ -384,7 +422,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
384
422
  };
385
423
  description?: string | undefined;
386
424
  blurhash?: string | undefined;
387
- status?: "failed" | "processing" | "ready" | undefined;
425
+ status?: "failed" | "ready" | "processing" | undefined;
388
426
  error?: string | undefined;
389
427
  }[] | undefined;
390
428
  customEmojis?: {
@@ -397,6 +435,44 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
397
435
  language?: string | undefined;
398
436
  image?: string | undefined;
399
437
  title?: string | undefined;
438
+ } | {
439
+ type: "resource";
440
+ title: string;
441
+ resourceKind: "file" | "link" | "video" | "gallery" | "audio";
442
+ content?: string | undefined;
443
+ sensitive?: boolean | undefined;
444
+ spoilerText?: string | undefined;
445
+ attachments?: {
446
+ type: string;
447
+ url: string;
448
+ previewUrl: string | null;
449
+ textUrl: null;
450
+ filename: string;
451
+ meta: {
452
+ usage?: string | undefined;
453
+ focus?: {
454
+ x: number;
455
+ y: number;
456
+ } | undefined;
457
+ mimetype?: string | undefined;
458
+ size?: number | undefined;
459
+ };
460
+ description?: string | undefined;
461
+ blurhash?: string | undefined;
462
+ status?: "failed" | "ready" | "processing" | undefined;
463
+ error?: string | undefined;
464
+ }[] | undefined;
465
+ customEmojis?: {
466
+ shortcode: string;
467
+ url: string;
468
+ staticUrl: string;
469
+ visibleInPicker: boolean;
470
+ category: string;
471
+ }[] | undefined;
472
+ language?: string | undefined;
473
+ tags?: string[] | undefined;
474
+ categoryPath?: string[] | undefined;
475
+ url?: string | undefined;
400
476
  };
401
477
  } | {
402
478
  type: "delete";
@@ -409,7 +485,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
409
485
  } | {
410
486
  type: "rsvp";
411
487
  data: {
412
- response: "removed" | "no" | "yes" | "tentative";
488
+ response: "no" | "yes" | "tentative" | "removed";
413
489
  recurrenceId?: string | undefined;
414
490
  };
415
491
  } | {
@@ -21,7 +21,6 @@ import { cancelPollEnd, schedulePollEnd } from './pollEndJobs.js';
21
21
  import { config } from '../config/index.js';
22
22
  import { localObjectScalars } from '../federation/identity.js';
23
23
  export const createPost = async (data, profile, postData, relations = {}) => {
24
- var _a, _b;
25
24
  if (data.type === 'event') {
26
25
  data = normalizeEventDataForSave(data);
27
26
  }
@@ -41,23 +40,30 @@ export const createPost = async (data, profile, postData, relations = {}) => {
41
40
  }
42
41
  const audienceIds = [
43
42
  profile.id,
44
- ...((_a = relations.audience) !== null && _a !== void 0 ? _a : []).map((member) => member.id),
43
+ ...(relations.audience ?? []).map((member) => member.id),
45
44
  ];
46
45
  if (await hasBlockAmong(db, audienceIds)) {
47
46
  throw forbidden({ errorKey: 'error.cannotInteractBlocked' });
48
47
  }
49
- const group = await ((repliedToPost === null || repliedToPost === void 0 ? void 0 : repliedToPost.group) ||
48
+ const group = await (repliedToPost?.group ||
50
49
  (relations.groupId ? findGroup(relations.groupId) : undefined));
51
50
  // Group-linked posts always use visibility=group so community/local feeds
52
51
  // (which only include public/local) never surface them incorrectly.
53
52
  if (group) {
54
- postData = Object.assign(Object.assign({}, postData), { visibility: 'group' });
53
+ postData = { ...postData, visibility: 'group' };
55
54
  }
56
55
  const hashtags = extractHashtags(data);
57
56
  const id = uuidv7();
58
57
  const domain = (await config()).activityPub.defaultDomain;
59
58
  const object = localObjectScalars(id, domain, relations.inReplyToId);
60
- const post = await postsMapping.removeDefaultFilter().create(db, Object.assign(Object.assign(Object.assign({ id }, postData), object), { data, type: data.type, creatorId: profile.id }));
59
+ const post = await postsMapping.removeDefaultFilter().create(db, {
60
+ id,
61
+ ...postData,
62
+ ...object,
63
+ data,
64
+ type: data.type,
65
+ creatorId: profile.id,
66
+ });
61
67
  await entryConnector(db, profile, post, {
62
68
  type: 'create',
63
69
  data,
@@ -80,10 +86,10 @@ export const createPost = async (data, profile, postData, relations = {}) => {
80
86
  if (mentions.length) {
81
87
  await Promise.all(mentions.map(async (mention) => mentionConnector(db, post, mention.profile, { text: mention.text })));
82
88
  }
83
- const audienceToLink = ((_b = relations.audience) === null || _b === void 0 ? void 0 : _b.length)
89
+ const audienceToLink = relations.audience?.length
84
90
  ? relations.audience
85
- : repliedToPost === null || repliedToPost === void 0 ? void 0 : repliedToPost.audience;
86
- if (audienceToLink === null || audienceToLink === void 0 ? void 0 : audienceToLink.length) {
91
+ : repliedToPost?.audience;
92
+ if (audienceToLink?.length) {
87
93
  await Promise.all(audienceToLink.map(async (member) => {
88
94
  await audienceConnector(db, post, member);
89
95
  }));
@@ -100,8 +106,7 @@ export const createPost = async (data, profile, postData, relations = {}) => {
100
106
  return transformedPost;
101
107
  };
102
108
  export const updatePost = async (post, profile, data) => {
103
- var _a;
104
- const previousEvent = ((_a = post.data) === null || _a === void 0 ? void 0 : _a.type) === 'event' ? post.data : undefined;
109
+ const previousEvent = post.data?.type === 'event' ? post.data : undefined;
105
110
  const normalized = data.type === 'event' ? normalizeEventDataForSave(data) : data;
106
111
  const dataForDb = normalized.type === 'event'
107
112
  ? eventDataForDbUpdate(previousEvent, normalized)
@@ -132,15 +137,16 @@ export const updatePost = async (post, profile, data) => {
132
137
  else {
133
138
  await cancelPollEnd(post.id);
134
139
  }
135
- hub.emit('postUpdated', newPost);
140
+ hub.emit('postUpdated', newPost, previousEvent?.jam?.moderators ?? []);
136
141
  return newPost;
137
142
  };
138
143
  export const reactToPost = async (post, profile, data) => allpeepDb().then(({ db }) => entryConnector(db, profile, post, {
139
144
  type: 'reaction',
140
145
  data: { reaction: data.reaction },
141
- })
142
- .then(() => bumpConversationActivity(db, post.id))
143
- .then(() => hub.emit('reactionCreated', profile, post, Object.assign({ type: 'reaction' }, data))));
146
+ }).then(() => hub.emit('reactionCreated', profile, post, {
147
+ type: 'reaction',
148
+ ...data,
149
+ })));
144
150
  export const retractReaction = async (post, profile) => allpeepDb().then(({ db }) => entryConnector(db, profile, post, {
145
151
  type: 'unreaction',
146
152
  data: { reaction: AP_LIKE_REACTION },
@@ -178,7 +184,10 @@ export const deletePost = async (post, profile) => {
178
184
  type: 'tombstone',
179
185
  },
180
186
  });
181
- await postsMapping.deleteRelations(db, post.id, Object.assign(Object.assign({}, repostRelation), { direction: 'INBOUND' }));
187
+ await postsMapping.deleteRelations(db, post.id, {
188
+ ...repostRelation,
189
+ direction: 'INBOUND',
190
+ });
182
191
  await postsMapping.delete(db, post.id);
183
192
  if (post.type === 'event') {
184
193
  await clearEventOccurrences(post.id);
@@ -194,19 +203,17 @@ export const vote = (profile, post, data) => allpeepDb().then(({ db }) => entryC
194
203
  }).then(() => hub.emit('entryCreated', profile, post, { type: 'answer', data })));
195
204
  const attendingRsvp = (response) => response === 'yes' || response === 'tentative';
196
205
  const rsvpOccurrenceIds = (data) => {
197
- var _a;
198
- if ((_a = data.recurrenceIds) === null || _a === void 0 ? void 0 : _a.length)
206
+ if (data.recurrenceIds?.length)
199
207
  return data.recurrenceIds;
200
208
  if (data.recurrenceId)
201
209
  return [data.recurrenceId];
202
210
  return undefined;
203
211
  };
204
212
  export const rsvpRespond = async (profile, post, data) => {
205
- var _a, _b, _c, _d;
206
213
  if (profile.id === post.profile.id) {
207
214
  return;
208
215
  }
209
- if (post.type !== 'event' || ((_a = post.data) === null || _a === void 0 ? void 0 : _a.type) !== 'event') {
216
+ if (post.type !== 'event' || post.data?.type !== 'event') {
210
217
  throw unprocessableRequest({ errorKey: 'error.unprocessableRequest' });
211
218
  }
212
219
  // `removed` is an organizer-only status; users cannot set it on themselves,
@@ -215,7 +222,7 @@ export const rsvpRespond = async (profile, post, data) => {
215
222
  if (data.response === 'removed') {
216
223
  throw forbidden({ errorKey: 'error.rsvpRemovedForbidden' });
217
224
  }
218
- if (((_b = getEffectiveRsvp(post, profile.id)) === null || _b === void 0 ? void 0 : _b.response) === 'removed') {
225
+ if (getEffectiveRsvp(post, profile.id)?.response === 'removed') {
219
226
  throw forbidden({ errorKey: 'error.rsvpRemoved' });
220
227
  }
221
228
  const occurrenceIds = rsvpOccurrenceIds(data);
@@ -233,10 +240,10 @@ export const rsvpRespond = async (profile, post, data) => {
233
240
  }
234
241
  }
235
242
  else {
236
- const ids = occurrenceIds !== null && occurrenceIds !== void 0 ? occurrenceIds : [undefined];
243
+ const ids = occurrenceIds ?? [undefined];
237
244
  for (const recurrenceId of ids) {
238
245
  const currentRsvp = getEffectiveRsvp(post, profile.id, recurrenceId);
239
- if ((currentRsvp === null || currentRsvp === void 0 ? void 0 : currentRsvp.response) !== 'yes' &&
246
+ if (currentRsvp?.response !== 'yes' &&
240
247
  countYesRsvps(post, recurrenceId) >= maxAttendees) {
241
248
  throw unprocessableRequest({ errorKey: 'error.eventAtCapacity' });
242
249
  }
@@ -246,16 +253,16 @@ export const rsvpRespond = async (profile, post, data) => {
246
253
  }
247
254
  const { db } = await allpeepDb();
248
255
  const previousResponses = occurrenceIds
249
- ? occurrenceIds.map((id) => { var _a; return (_a = getEffectiveRsvp(post, profile.id, id)) === null || _a === void 0 ? void 0 : _a.response; })
256
+ ? occurrenceIds.map((id) => getEffectiveRsvp(post, profile.id, id)?.response)
250
257
  : undefined;
251
258
  const previousResponse = previousResponses
252
259
  ? previousResponses.every(attendingRsvp)
253
260
  ? previousResponses[0]
254
261
  : previousResponses.find((response) => !attendingRsvp(response))
255
- : (_d = [...((_c = post.rsvps) !== null && _c !== void 0 ? _c : [])]
262
+ : [...(post.rsvps ?? [])]
256
263
  .filter((rsvp) => rsvp.profile.id === profile.id)
257
264
  .filter((rsvp) => !rsvp.recurrenceId)
258
- .sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))[0]) === null || _d === void 0 ? void 0 : _d.response;
265
+ .sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))[0]?.response;
259
266
  const writes = occurrenceIds
260
267
  ? occurrenceIds.map((recurrenceId) => ({
261
268
  response: data.response,
@@ -269,13 +276,20 @@ export const rsvpRespond = async (profile, post, data) => {
269
276
  });
270
277
  }
271
278
  const cancel = rsvpCancelNotice(post, profile.id, data.response, occurrenceIds);
272
- hub.emit('rsvpCreated', profile, post, Object.assign({ type: 'rsvp', data: Object.assign({ response: data.response }, ((occurrenceIds === null || occurrenceIds === void 0 ? void 0 : occurrenceIds.length) === 1
273
- ? { recurrenceId: occurrenceIds[0] }
274
- : {})), occurrenceIds,
275
- previousResponse }, (cancel ? { cancel } : {})));
279
+ hub.emit('rsvpCreated', profile, post, {
280
+ type: 'rsvp',
281
+ data: {
282
+ response: data.response,
283
+ ...(occurrenceIds?.length === 1
284
+ ? { recurrenceId: occurrenceIds[0] }
285
+ : {}),
286
+ },
287
+ occurrenceIds,
288
+ previousResponse,
289
+ ...(cancel ? { cancel } : {}),
290
+ });
276
291
  };
277
292
  export const rsvpManageByOrganizer = async (actingProfile, targetProfile, post, response, recurrenceId) => {
278
- var _a, _b;
279
293
  if (!canManageEventRsvps(actingProfile, post)) {
280
294
  throw forbidden({ errorKey: 'forbidden' });
281
295
  }
@@ -287,13 +301,13 @@ export const rsvpManageByOrganizer = async (actingProfile, targetProfile, post,
287
301
  }
288
302
  const data = { response, recurrenceId };
289
303
  const { db } = await allpeepDb();
290
- const previousResponse = (_b = [...((_a = post.rsvps) !== null && _a !== void 0 ? _a : [])]
304
+ const previousResponse = [...(post.rsvps ?? [])]
291
305
  .filter((rsvp) => rsvp.profile.id === targetProfile.id)
292
306
  .filter((rsvp) => recurrenceId
293
307
  ? sameRecurrenceId(rsvp.recurrenceId, recurrenceId) ||
294
308
  !rsvp.recurrenceId
295
309
  : !rsvp.recurrenceId)
296
- .sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))[0]) === null || _b === void 0 ? void 0 : _b.response;
310
+ .sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))[0]?.response;
297
311
  await entryConnector(db, targetProfile, post, {
298
312
  type: 'rsvp',
299
313
  data,
@@ -322,7 +336,6 @@ export const rsvpManageByOrganizer = async (actingProfile, targetProfile, post,
322
336
  * tab, detected by posts they authored but are not in.
323
337
  */
324
338
  export const leaveConversation = async (rootPost, profile) => {
325
- var _a, _b;
326
339
  const { db } = await allpeepDb();
327
340
  const lastPostId = await findLatestThreadPostId(rootPost.id);
328
341
  const [lastPost] = lastPostId === rootPost.id
@@ -330,7 +343,7 @@ export const leaveConversation = async (rootPost, profile) => {
330
343
  : await findPostsForAuth([lastPostId]);
331
344
  if (!lastPost)
332
345
  return;
333
- const remainingAudience = (_b = (_a = lastPost.audience) === null || _a === void 0 ? void 0 : _a.filter((p) => p.id !== profile.id)) !== null && _b !== void 0 ? _b : [];
346
+ const remainingAudience = lastPost.audience?.filter((p) => p.id !== profile.id) ?? [];
334
347
  if (remainingAudience.length > 0) {
335
348
  await createPost({ type: 'note', content: '' }, profile, { type: 'note', visibility: 'direct', creatorId: profile.id }, {
336
349
  inReplyToId: lastPost.id,
@@ -1,7 +1,4 @@
1
1
  export const pollEndDelayMs = (expiresAt, now = Date.now()) => new Date(expiresAt).getTime() - now;
2
- export const shouldEmitPollEnded = (post, scheduledExpiresAt) => {
3
- var _a;
4
- return !!post &&
5
- ((_a = post.data) === null || _a === void 0 ? void 0 : _a.type) === 'question' &&
6
- post.data.expiresAt === scheduledExpiresAt;
7
- };
2
+ export const shouldEmitPollEnded = (post, scheduledExpiresAt) => !!post &&
3
+ post.data?.type === 'question' &&
4
+ post.data.expiresAt === scheduledExpiresAt;
@@ -14,14 +14,13 @@ const attendingResponses = ['yes', 'tentative'];
14
14
  * avoid re-sending when someone toggles between yes/maybe.
15
15
  */
16
16
  const handleRsvpCreated = async (profileArg, postArg, payloadArg) => {
17
- var _a, _b, _c;
18
17
  const profile = profileArg;
19
18
  const post = postArg;
20
19
  const payload = payloadArg;
21
- if ((payload === null || payload === void 0 ? void 0 : payload.type) !== 'rsvp') {
20
+ if (payload?.type !== 'rsvp') {
22
21
  return;
23
22
  }
24
- const response = (_a = payload.data) === null || _a === void 0 ? void 0 : _a.response;
23
+ const response = payload.data?.response;
25
24
  if (!response || !attendingResponses.includes(response)) {
26
25
  return;
27
26
  }
@@ -29,12 +28,13 @@ const handleRsvpCreated = async (profileArg, postArg, payloadArg) => {
29
28
  attendingResponses.includes(payload.previousResponse)) {
30
29
  return;
31
30
  }
32
- if (post.type !== 'event' || ((_b = post.data) === null || _b === void 0 ? void 0 : _b.type) !== 'event') {
31
+ if (post.type !== 'event' || post.data?.type !== 'event') {
33
32
  return;
34
33
  }
35
34
  const rootUrl = await serverRootUrl();
36
35
  const postUrl = `${rootUrl}/posts/${post.id}`;
37
- const occurrenceIds = (_c = payload.occurrenceIds) !== null && _c !== void 0 ? _c : (payload.data.recurrenceId ? [payload.data.recurrenceId] : undefined);
36
+ const occurrenceIds = payload.occurrenceIds ??
37
+ (payload.data.recurrenceId ? [payload.data.recurrenceId] : undefined);
38
38
  const confirmation = rsvpConfirmationContent(post, {
39
39
  postUrl,
40
40
  occurrenceIds,
@@ -56,9 +56,19 @@ const handleRsvpCreated = async (profileArg, postArg, payloadArg) => {
56
56
  .send({
57
57
  to: account.email,
58
58
  template: 'eventRsvpConfirmation',
59
- locals: Object.assign({ eventName: confirmation.eventName, eventUrl: postUrl, response, start: confirmation.start, end: confirmation.end, location: confirmation.location, allDay: confirmation.allDay, occurrenceCount: confirmation.occurrenceCount }, ((profileSettings === null || profileSettings === void 0 ? void 0 : profileSettings.timeZone)
60
- ? { timeZone: profileSettings.timeZone }
61
- : {})),
59
+ locals: {
60
+ eventName: confirmation.eventName,
61
+ eventUrl: postUrl,
62
+ response,
63
+ start: confirmation.start,
64
+ end: confirmation.end,
65
+ location: confirmation.location,
66
+ allDay: confirmation.allDay,
67
+ occurrenceCount: confirmation.occurrenceCount,
68
+ ...(profileSettings?.timeZone
69
+ ? { timeZone: profileSettings.timeZone }
70
+ : {}),
71
+ },
62
72
  attachments: [
63
73
  {
64
74
  filename: 'event.ics',
@@ -38,7 +38,7 @@ export const loadThreadPreviewReplies = async (rootId, currentProfile) => {
38
38
  if (!parentId || parentId === rootId)
39
39
  return post;
40
40
  const parent = byId.get(parentId);
41
- return parent ? Object.assign(Object.assign({}, post), { replyTo: parent }) : post;
41
+ return parent ? { ...post, replyTo: parent } : post;
42
42
  });
43
43
  return { replies, hasMore };
44
44
  };
@@ -3,12 +3,12 @@ import { allpeepDb } from '../db/index.js';
3
3
  import { sorts } from '../db/pg/queries/index.js';
4
4
  const HISTORY_SAMPLE_SIZE = 50;
5
5
  const FILETYPE_DEFAULTS_MS = {
6
- image: 2000,
7
- audio: 8000,
8
- video: 30000,
9
- document: 1500,
6
+ image: 2_000,
7
+ audio: 8_000,
8
+ video: 30_000,
9
+ document: 1_500,
10
10
  };
11
- const GENERIC_DEFAULT_MS = 5000;
11
+ const GENERIC_DEFAULT_MS = 5_000;
12
12
  const median = (values) => {
13
13
  if (!values.length)
14
14
  return 0;
@@ -27,7 +27,6 @@ const findRecent = async (filter) => {
27
27
  .all(db);
28
28
  };
29
29
  export const estimateProcessingDuration = async ({ filetype, filesize, }) => {
30
- var _a;
31
30
  const lower = filesize * 0.5;
32
31
  const upper = filesize * 2;
33
32
  const sized = await findRecent({ filetype })
@@ -42,5 +41,5 @@ export const estimateProcessingDuration = async ({ filetype, filesize, }) => {
42
41
  if (scaledMedian > 0)
43
42
  return scaledMedian;
44
43
  }
45
- return (_a = FILETYPE_DEFAULTS_MS[filetype]) !== null && _a !== void 0 ? _a : GENERIC_DEFAULT_MS;
44
+ return FILETYPE_DEFAULTS_MS[filetype] ?? GENERIC_DEFAULT_MS;
46
45
  };
@@ -12,9 +12,8 @@ hub.on('profileSettingsUpdated', (profileId) => {
12
12
  void profileSettingsCache.del(profileId);
13
13
  });
14
14
  const uniqueViolation = (error) => {
15
- var _a;
16
15
  const current = error;
17
- return current.code === '23505' || ((_a = current.cause) === null || _a === void 0 ? void 0 : _a.code) === '23505';
16
+ return current.code === '23505' || current.cause?.code === '23505';
18
17
  };
19
18
  const readProfileSettings = async (db, id) =>
20
19
  // Include soft-deleted rows: the profile_id unique index still covers them,
@@ -14,6 +14,7 @@ export declare const profileSettingsMapping: import("../db/pg/map").Mapping<{
14
14
  push: boolean;
15
15
  email: boolean;
16
16
  }> | undefined;
17
+ groupNotificationLevels?: Record<string, "off" | "all" | "mostRelevant"> | undefined;
17
18
  jamSettings?: {
18
19
  backgroundObfuscation?: {
19
20
  type: "blur";