@openpeepshq/core 0.1.32 → 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 (261) hide show
  1. package/dist/accessTokens/helpers.d.ts +2 -2
  2. package/dist/accessTokens/tokens.js +14 -7
  3. package/dist/accounts/mutations.d.ts +2 -2
  4. package/dist/accounts/mutations.js +33 -35
  5. package/dist/analytics/cache.js +12 -7
  6. package/dist/analytics/compile.js +16 -10
  7. package/dist/analytics/pdfReport.d.ts +1 -0
  8. package/dist/analytics/pdfReport.js +5 -4
  9. package/dist/analytics/privacy.d.ts +18 -0
  10. package/dist/analytics/privacy.js +10 -0
  11. package/dist/analytics/read.js +75 -19
  12. package/dist/analytics/report.d.ts +21 -1
  13. package/dist/analytics/report.js +9 -2
  14. package/dist/backups/index.js +78 -15
  15. package/dist/backups/metadata.d.ts +8 -2
  16. package/dist/backups/metadata.js +6 -2
  17. package/dist/config/defaults/capabilities.js +13 -2
  18. package/dist/config/defaults/community.js +7 -9
  19. package/dist/config/defaults/core.d.ts +1 -1
  20. package/dist/config/defaults/core.js +3 -0
  21. package/dist/config/defaults/db.d.ts +0 -2
  22. package/dist/config/defaults/db.js +0 -2
  23. package/dist/config/index.d.ts +25 -3
  24. package/dist/config/index.js +7 -1
  25. package/dist/db/helpers.d.ts +7 -28
  26. package/dist/db/helpers.js +30 -152
  27. package/dist/db/index.d.ts +3 -1
  28. package/dist/db/index.js +5 -0
  29. package/dist/db/init.js +2 -2
  30. package/dist/db/migration/importCollections.d.ts +15 -10
  31. package/dist/db/migration/importCollections.js +121 -155
  32. package/dist/db/migration/shared.d.ts +2 -37
  33. package/dist/db/migration/shared.js +2 -59
  34. package/dist/db/pg/client.js +4 -0
  35. package/dist/db/pg/collections.d.ts +2 -2
  36. package/dist/db/pg/collections.js +2 -2
  37. package/dist/db/pg/filters/edges.d.ts +1 -1
  38. package/dist/db/pg/filters/edges.js +1 -1
  39. package/dist/db/pg/filters/posts.d.ts +11 -0
  40. package/dist/db/pg/filters/posts.js +37 -3
  41. package/dist/db/pg/filters/profiles.d.ts +1 -0
  42. package/dist/db/pg/filters/profiles.js +2 -1
  43. package/dist/db/pg/map/filters.js +37 -2
  44. package/dist/db/pg/map/mutations.js +13 -8
  45. package/dist/db/pg/map/registry.d.ts +5 -0
  46. package/dist/db/pg/map/registry.js +64 -24
  47. package/dist/db/pg/map/relations.d.ts +1 -1
  48. package/dist/db/pg/map/relations.js +98 -46
  49. package/dist/db/pg/migrate.d.ts +22 -0
  50. package/dist/db/pg/migrate.js +88 -2
  51. package/dist/db/pg/queries/activity.js +3 -3
  52. package/dist/db/pg/queries/sorts.d.ts +1 -0
  53. package/dist/db/pg/queries/sorts.js +4 -0
  54. package/dist/db/pg/schema/documents.d.ts +422 -41
  55. package/dist/db/pg/schema/documents.js +43 -9
  56. package/dist/db/pg/schema/edges.d.ts +117 -7
  57. package/dist/db/pg/schema/edges.js +4 -2
  58. package/dist/db/pg/schema/index.d.ts +505 -15
  59. package/dist/db/pg/sql/0007_shallow_oracle.sql +3 -0
  60. package/dist/db/pg/sql/0008_group_owner_roles.sql +31 -0
  61. package/dist/db/pg/sql/0009_event_occurrences.sql +26 -0
  62. package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
  63. package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
  64. package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
  65. package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
  66. package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
  67. package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
  68. package/dist/db/pg/sql/meta/{0006_snapshot.json → 0015_snapshot.json} +393 -39
  69. package/dist/db/pg/sql/meta/_journal.json +64 -1
  70. package/dist/db/replaceOrigin.js +6 -0
  71. package/dist/db/types.d.ts +0 -4
  72. package/dist/email/render.js +11 -3
  73. package/dist/events/index.d.ts +6 -1
  74. package/dist/events/index.js +55 -33
  75. package/dist/federation/activities.d.ts +17 -0
  76. package/dist/federation/activities.js +26 -0
  77. package/dist/federation/identity.d.ts +16 -0
  78. package/dist/federation/identity.js +52 -0
  79. package/dist/federation/index.d.ts +4 -0
  80. package/dist/federation/index.js +3 -0
  81. package/dist/federation/profiles.d.ts +3 -0
  82. package/dist/federation/profiles.js +14 -0
  83. package/dist/groups/finders.d.ts +3 -2
  84. package/dist/groups/helpers.d.ts +24 -6
  85. package/dist/groups/mapping.d.ts +6 -4
  86. package/dist/groups/mapping.js +2 -2
  87. package/dist/groups/mutations.js +1 -1
  88. package/dist/hashtags/finders.d.ts +6 -3
  89. package/dist/hashtags/finders.js +2 -0
  90. package/dist/hashtags/helpers.d.ts +8 -0
  91. package/dist/hashtags/helpers.js +4 -0
  92. package/dist/hashtags/index.d.ts +2 -0
  93. package/dist/hashtags/index.js +2 -0
  94. package/dist/hashtags/mutations.d.ts +3 -0
  95. package/dist/hashtags/mutations.js +13 -1
  96. package/dist/i18n/index.d.ts +1 -1
  97. package/dist/i18n/index.js +3 -1
  98. package/dist/i18n/pluginLocales.d.ts +6 -0
  99. package/dist/i18n/pluginLocales.js +15 -0
  100. package/dist/inviteLinks/helpers.d.ts +4 -4
  101. package/dist/jams/cache.d.ts +1 -1
  102. package/dist/jams/cache.js +2 -1
  103. package/dist/jams/export.d.ts +19 -0
  104. package/dist/jams/export.js +60 -0
  105. package/dist/jams/finders.d.ts +2 -1
  106. package/dist/jams/finders.js +18 -7
  107. package/dist/jams/health.d.ts +8 -0
  108. package/dist/jams/health.js +46 -0
  109. package/dist/jams/helpers.d.ts +6 -2
  110. package/dist/jams/index.d.ts +6 -3
  111. package/dist/jams/index.js +41 -27
  112. package/dist/jams/jobs.js +1 -1
  113. package/dist/jams/livekit.d.ts +93 -10
  114. package/dist/jams/livekit.js +151 -52
  115. package/dist/jams/mapping.d.ts +17 -7
  116. package/dist/jams/mutations.d.ts +3 -1
  117. package/dist/jams/recording.d.ts +10 -0
  118. package/dist/jams/recording.js +32 -0
  119. package/dist/jams/rtmp.d.ts +5 -0
  120. package/dist/jams/rtmp.js +8 -0
  121. package/dist/jams/token.d.ts +15 -3
  122. package/dist/jams/token.js +30 -16
  123. package/dist/jams/waitingRoom.d.ts +6 -6
  124. package/dist/jams/waitingRoom.js +24 -23
  125. package/dist/jobs/index.d.ts +1 -0
  126. package/dist/jobs/index.js +6 -1
  127. package/dist/jobs/jobDetail.js +1 -6
  128. package/dist/media/index.d.ts +1 -1
  129. package/dist/media/index.js +23 -8
  130. package/dist/media/processing.js +18 -7
  131. package/dist/notifications/defaultNotifications/follow/index.js +2 -2
  132. package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +3 -1
  133. package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +3 -1
  134. package/dist/notifications/defaultNotifications/index.js +4 -0
  135. package/dist/notifications/defaultNotifications/newGroupPost/index.js +12 -6
  136. package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
  137. package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
  138. package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
  139. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +18 -0
  140. package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
  141. package/dist/notifications/defaultNotifications/rsvp/index.js +7 -0
  142. package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
  143. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +75 -0
  144. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
  145. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
  146. package/dist/notifications/helpers.js +6 -2
  147. package/dist/notifications/jobs.js +3 -1
  148. package/dist/notifications/mutations.js +4 -0
  149. package/dist/notifications/push.js +11 -4
  150. package/dist/plugins/helpers.d.ts +1 -0
  151. package/dist/plugins/helpers.js +1 -8
  152. package/dist/plugins/index.d.ts +5 -0
  153. package/dist/plugins/index.js +78 -5
  154. package/dist/plugins/install.d.ts +39 -0
  155. package/dist/plugins/install.js +455 -0
  156. package/dist/plugins/pluginAuth.d.ts +1 -1
  157. package/dist/plugins/pluginAuth.js +10 -6
  158. package/dist/plugins/state.d.ts +4 -0
  159. package/dist/plugins/state.js +29 -0
  160. package/dist/posts/activity.d.ts +9 -0
  161. package/dist/posts/activity.js +35 -0
  162. package/dist/posts/contextClosure.d.ts +1 -9
  163. package/dist/posts/contextClosure.js +15 -44
  164. package/dist/posts/conversationQueries.d.ts +7 -0
  165. package/dist/posts/conversationQueries.js +76 -2
  166. package/dist/posts/eventAgenda.d.ts +166 -0
  167. package/dist/posts/eventAgenda.js +126 -0
  168. package/dist/posts/eventOccurrenceJobs.d.ts +4 -0
  169. package/dist/posts/eventOccurrenceJobs.js +28 -0
  170. package/dist/posts/eventOccurrences.d.ts +10 -0
  171. package/dist/posts/eventOccurrences.js +61 -0
  172. package/dist/posts/finders.d.ts +47 -16
  173. package/dist/posts/finders.js +93 -62
  174. package/dist/posts/helpers/filters.js +14 -9
  175. package/dist/posts/helpers/index.d.ts +129 -30
  176. package/dist/posts/helpers/index.js +66 -33
  177. package/dist/posts/index.d.ts +7 -1
  178. package/dist/posts/index.js +7 -1
  179. package/dist/posts/mapping.d.ts +491 -13
  180. package/dist/posts/mapping.js +45 -10
  181. package/dist/posts/mutations.d.ts +441 -4
  182. package/dist/posts/mutations.js +177 -43
  183. package/dist/posts/pollEnd.d.ts +3 -0
  184. package/dist/posts/pollEnd.js +7 -0
  185. package/dist/posts/pollEndJobs.d.ts +8 -0
  186. package/dist/posts/pollEndJobs.js +49 -0
  187. package/dist/posts/replyClosure.d.ts +10 -0
  188. package/dist/posts/replyClosure.js +43 -0
  189. package/dist/posts/rsvpConfirmationEmail.js +14 -15
  190. package/dist/posts/threadPreview.d.ts +8 -0
  191. package/dist/posts/threadPreview.js +44 -0
  192. package/dist/posts/unseenCounts.d.ts +2 -0
  193. package/dist/posts/unseenCounts.js +28 -8
  194. package/dist/profileSettings/cache.js +22 -5
  195. package/dist/profileSettings/mapping.d.ts +2 -0
  196. package/dist/profiles/activityQueries.d.ts +5 -0
  197. package/dist/profiles/activityQueries.js +85 -0
  198. package/dist/profiles/activitySummary.d.ts +3 -0
  199. package/dist/profiles/activitySummary.js +87 -0
  200. package/dist/profiles/blocks.d.ts +12 -0
  201. package/dist/profiles/blocks.js +73 -0
  202. package/dist/profiles/cache.d.ts +4 -1
  203. package/dist/profiles/cache.js +28 -7
  204. package/dist/profiles/finders.d.ts +2 -1
  205. package/dist/profiles/finders.js +8 -3
  206. package/dist/profiles/helpers.d.ts +7 -5
  207. package/dist/profiles/index.d.ts +3 -1
  208. package/dist/profiles/index.js +3 -1
  209. package/dist/profiles/mapping.d.ts +10 -5
  210. package/dist/profiles/mapping.js +13 -1
  211. package/dist/profiles/mutations.d.ts +8 -4
  212. package/dist/profiles/mutations.js +42 -15
  213. package/dist/pushSubscriptions/helpers.d.ts +2 -2
  214. package/dist/pushSubscriptions/mutations.js +13 -1
  215. package/dist/redis/connection.d.ts +2 -0
  216. package/dist/redis/connection.js +25 -6
  217. package/dist/reports/helpers.d.ts +6 -6
  218. package/dist/roles/index.d.ts +1 -1
  219. package/dist/roles/index.js +1 -1
  220. package/dist/roles/mapping.d.ts +1 -0
  221. package/dist/roles/mutations.js +86 -3
  222. package/dist/search/mapping.d.ts +1 -1
  223. package/dist/search/mapping.js +6 -2
  224. package/dist/server/index.d.ts +19 -1
  225. package/dist/server/index.js +37 -18
  226. package/dist/server/stablePublicServerInfo.d.ts +17 -0
  227. package/dist/server/stablePublicServerInfo.js +37 -0
  228. package/dist/server/status.d.ts +25 -0
  229. package/dist/server/status.js +98 -0
  230. package/dist/stats/finders.d.ts +1 -16131
  231. package/dist/stats/finders.js +9 -5
  232. package/dist/stats/mapping.d.ts +21 -1
  233. package/dist/stats/mapping.js +0 -3
  234. package/package.json +6 -12
  235. package/dist/db/arango.d.ts +0 -2
  236. package/dist/db/arango.js +0 -110
  237. package/dist/db/migration/autoMigrate.d.ts +0 -2
  238. package/dist/db/migration/autoMigrate.js +0 -111
  239. package/dist/db/migration/cli.d.ts +0 -1
  240. package/dist/db/migration/cli.js +0 -56
  241. package/dist/db/migration/detect.d.ts +0 -6
  242. package/dist/db/migration/detect.js +0 -87
  243. package/dist/db/migration/exportArango.d.ts +0 -4
  244. package/dist/db/migration/exportArango.js +0 -80
  245. package/dist/db/migration/importPostgres.d.ts +0 -3
  246. package/dist/db/migration/importPostgres.js +0 -18
  247. package/dist/db/migration/transform.d.ts +0 -18
  248. package/dist/db/migration/transform.js +0 -209
  249. package/dist/db/migration/validate.d.ts +0 -18
  250. package/dist/db/migration/validate.js +0 -69
  251. package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
  252. package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
  253. package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
  254. package/dist/mastodon/index.d.ts +0 -4
  255. package/dist/mastodon/index.js +0 -51
  256. package/dist/mastodon/types.d.ts +0 -7579
  257. package/dist/mastodon/types.js +0 -523
  258. package/dist/mastodon/typescript.d.ts +0 -1578
  259. package/dist/mastodon/typescript.js +0 -1
  260. package/dist/roles/defaults.d.ts +0 -2
  261. package/dist/roles/defaults.js +0 -94
@@ -1,4 +1,4 @@
1
- import { AuthorizationData, PostWithMeta, PostDataUnion, Profile, Post, Hashtag, MentionWithPublicProfile, DbPost } from '@openpeepshq/common/types';
1
+ import { AuthorizationData, PostWithMeta, PostDataUnion, Profile, Post, Hashtag, ProfileWithMeta, MentionWithPublicProfile, DbPost } from '@openpeepshq/common/types';
2
2
  import type { PgQueryResult } from '../../db/pg/map/types';
3
3
  import { ObjectFilter } from '../../db/types';
4
4
  export declare const isDirect: (post: PostWithMeta) => boolean;
@@ -149,6 +149,27 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
149
149
  } | undefined;
150
150
  } | undefined;
151
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;
152
173
  } | {
153
174
  type: "article";
154
175
  content?: string | undefined;
@@ -323,6 +344,27 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
323
344
  } | undefined;
324
345
  } | undefined;
325
346
  url?: string | undefined;
347
+ recurrence?: {
348
+ freq: "DAILY" | "WEEKLY" | "MONTHLY";
349
+ interval?: number | undefined;
350
+ byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
351
+ until?: string | undefined;
352
+ count?: number | undefined;
353
+ } | undefined;
354
+ exceptions?: {
355
+ recurrenceId: string;
356
+ cancelled?: boolean | undefined;
357
+ start?: string | undefined;
358
+ end?: string | undefined;
359
+ physicalLocation?: {
360
+ text: string;
361
+ coordinates?: {
362
+ lat: number;
363
+ lng: number;
364
+ alt?: number | undefined;
365
+ } | undefined;
366
+ } | undefined;
367
+ }[] | undefined;
326
368
  } | {
327
369
  type: "article";
328
370
  content?: string | undefined;
@@ -371,7 +413,20 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
371
413
  type: "rsvp";
372
414
  data: {
373
415
  response: "removed" | "no" | "yes" | "tentative";
416
+ recurrenceId?: string | undefined;
417
+ };
418
+ } | {
419
+ type: "reaction";
420
+ data: {
421
+ reaction: string;
374
422
  };
423
+ uri?: string | undefined;
424
+ } | {
425
+ type: "unreaction";
426
+ data: {
427
+ reaction: string;
428
+ };
429
+ uri?: string | undefined;
375
430
  }) & {
376
431
  id?: string;
377
432
  }) => Promise<import("../../db/pg/map").WithId<({
@@ -512,6 +567,27 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
512
567
  } | undefined;
513
568
  } | undefined;
514
569
  url?: string | undefined;
570
+ recurrence?: {
571
+ freq: "DAILY" | "WEEKLY" | "MONTHLY";
572
+ interval?: number | undefined;
573
+ byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
574
+ until?: string | undefined;
575
+ count?: number | undefined;
576
+ } | undefined;
577
+ exceptions?: {
578
+ recurrenceId: string;
579
+ cancelled?: boolean | undefined;
580
+ start?: string | undefined;
581
+ end?: string | undefined;
582
+ physicalLocation?: {
583
+ text: string;
584
+ coordinates?: {
585
+ lat: number;
586
+ lng: number;
587
+ alt?: number | undefined;
588
+ } | undefined;
589
+ } | undefined;
590
+ }[] | undefined;
515
591
  } | {
516
592
  type: "article";
517
593
  content?: string | undefined;
@@ -686,6 +762,27 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
686
762
  } | undefined;
687
763
  } | undefined;
688
764
  url?: string | undefined;
765
+ recurrence?: {
766
+ freq: "DAILY" | "WEEKLY" | "MONTHLY";
767
+ interval?: number | undefined;
768
+ byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
769
+ until?: string | undefined;
770
+ count?: number | undefined;
771
+ } | undefined;
772
+ exceptions?: {
773
+ recurrenceId: string;
774
+ cancelled?: boolean | undefined;
775
+ start?: string | undefined;
776
+ end?: string | undefined;
777
+ physicalLocation?: {
778
+ text: string;
779
+ coordinates?: {
780
+ lat: number;
781
+ lng: number;
782
+ alt?: number | undefined;
783
+ } | undefined;
784
+ } | undefined;
785
+ }[] | undefined;
689
786
  } | {
690
787
  type: "article";
691
788
  content?: string | undefined;
@@ -734,15 +831,28 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
734
831
  type: "rsvp";
735
832
  data: {
736
833
  response: "removed" | "no" | "yes" | "tentative";
834
+ recurrenceId?: string | undefined;
737
835
  };
836
+ } | {
837
+ type: "reaction";
838
+ data: {
839
+ reaction: string;
840
+ };
841
+ uri?: string | undefined;
842
+ } | {
843
+ type: "unreaction";
844
+ data: {
845
+ reaction: string;
846
+ };
847
+ uri?: string | undefined;
738
848
  }) & {
739
849
  _from: string;
740
850
  _to: string;
741
851
  }>>;
742
852
  export declare const entryDisconnector: (db: import("../../db").PgDb, from: Profile, to: Post) => Promise<void>;
743
- export declare const replyConnector: (db: import("../../db").PgDb, from: Post, to: Post, data?: {
853
+ export declare const replyConnector: (db: import("../../db").PgDb, from: Post, to: Post, data?: object & {
744
854
  id?: string;
745
- }) => Promise<import("../../db/pg/map").WithId<{
855
+ }) => Promise<import("../../db/pg/map").WithId<object & {
746
856
  _from: string;
747
857
  _to: string;
748
858
  }>>;
@@ -765,22 +875,22 @@ export declare const groupConnector: (db: import("../../db").PgDb, from: Post, t
765
875
  discoverable?: boolean | undefined;
766
876
  lastPostAt?: string | null | undefined;
767
877
  deletedAt?: string | null | undefined;
768
- }, data?: {
878
+ }, data?: object & {
769
879
  id?: string;
770
- }) => Promise<import("../../db/pg/map").WithId<{
880
+ }) => Promise<import("../../db/pg/map").WithId<object & {
771
881
  _from: string;
772
882
  _to: string;
773
883
  }>>;
774
- export declare const audienceConnector: (db: import("../../db").PgDb, from: Post, to: Profile, data?: {
884
+ export declare const audienceConnector: (db: import("../../db").PgDb, from: Post, to: Profile, data?: object & {
775
885
  id?: string;
776
- }) => Promise<import("../../db/pg/map").WithId<{
886
+ }) => Promise<import("../../db/pg/map").WithId<object & {
777
887
  _from: string;
778
888
  _to: string;
779
889
  }>>;
780
- export declare const audienceConnectionFinder: (db: import("../../db").PgDb, from: Post, to: Profile) => Promise<{} | undefined>;
781
- export declare const hashtagConnector: (db: import("../../db").PgDb, from: Post, to: Hashtag, data?: {
890
+ export declare const audienceConnectionFinder: (db: import("../../db").PgDb, from: Post, to: Profile) => Promise<Record<string, unknown> | undefined>;
891
+ export declare const hashtagConnector: (db: import("../../db").PgDb, from: Post, to: Hashtag, data?: object & {
782
892
  id?: string;
783
- }) => Promise<import("../../db/pg/map").WithId<{
893
+ }) => Promise<import("../../db/pg/map").WithId<object & {
784
894
  _from: string;
785
895
  _to: string;
786
896
  }>>;
@@ -795,39 +905,28 @@ export declare const mentionConnector: (db: import("../../db").PgDb, from: Post,
795
905
  _from: string;
796
906
  _to: string;
797
907
  }>>;
798
- export declare const mentionsConnectionFinder: (db: import("../../db").PgDb, from: Post, to: Profile) => Promise<{} | undefined>;
799
- export declare const repostConnector: (db: import("../../db").PgDb, from: Post, to: Post, data?: {
908
+ export declare const mentionsConnectionFinder: (db: import("../../db").PgDb, from: Post, to: Profile) => Promise<Record<string, unknown> | undefined>;
909
+ export declare const repostConnector: (db: import("../../db").PgDb, from: Post, to: Post, data?: object & {
800
910
  id?: string;
801
- }) => Promise<import("../../db/pg/map").WithId<{
911
+ }) => Promise<import("../../db/pg/map").WithId<object & {
802
912
  _from: string;
803
913
  _to: string;
804
914
  }>>;
805
- export declare const reactionConnector: (db: import("../../db").PgDb, from: Profile, to: Post, data?: {
806
- reaction: "👍";
807
- } & {
808
- id?: string;
809
- }) => Promise<import("../../db/pg/map").WithId<{
810
- reaction: "👍";
811
- } & {
812
- _from: string;
813
- _to: string;
814
- }>>;
815
- export declare const reactionDisconnector: (db: import("../../db").PgDb, from: Profile, to: Post) => Promise<void>;
816
- export declare const bookmarkConnector: (db: import("../../db").PgDb, from: Profile, to: Post, data?: {
915
+ export declare const bookmarkConnector: (db: import("../../db").PgDb, from: Profile, to: Post, data?: object & {
817
916
  id?: string;
818
- }) => Promise<import("../../db/pg/map").WithId<{
917
+ }) => Promise<import("../../db/pg/map").WithId<object & {
819
918
  _from: string;
820
919
  _to: string;
821
920
  }>>;
822
921
  export declare const bookmarkDisconnector: (db: import("../../db").PgDb, from: Profile, to: Post) => Promise<void>;
823
- export declare const postSeenConnector: (db: import("../../db").PgDb, from: Profile, to: Post, data?: {
922
+ export declare const postSeenConnector: (db: import("../../db").PgDb, from: Profile, to: Post, data?: object & {
824
923
  id?: string;
825
- }) => Promise<import("../../db/pg/map").WithId<{
924
+ }) => Promise<import("../../db/pg/map").WithId<object & {
826
925
  _from: string;
827
926
  _to: string;
828
927
  }>>;
829
- export declare const transformPost: (post: DbPost, currentProfile?: {
830
- id: string;
928
+ export declare const transformPost: (post: DbPost, currentProfile?: ProfileWithMeta, options?: {
929
+ embedThreadPreview?: boolean;
831
930
  }) => Promise<PostWithMeta>;
832
931
  export declare const toFilteredPostsList: (queryResult: PgQueryResult<DbPost>, options: {
833
932
  authData: AuthorizationData;
@@ -1,11 +1,13 @@
1
- import { hashtagRegex, normalizeHashtagTag, handleRegex, } from '@openpeepshq/common/types';
1
+ import { hashtagRegex, normalizeHashtagTag, } from '@openpeepshq/common/types';
2
2
  import { findProfileByHandle } from '../../profiles/finders.js';
3
3
  import { getPublicProfile } from '../../profiles/cache.js';
4
4
  import { composeFilters, connectionFinder, connector, disconnector, filterAndTransform, } from '../../db/helpers.js';
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 { anonymizeProfileIfDeleted, normalizePostDataFromDb, } from '@openpeepshq/common/lib';
8
+ import { AP_LIKE_REACTION, currentReactionsFromEntries, isBlockedPair, isReactionHistoryEntry, matchMentionHandles, normalizePostDataFromDb, toHiddenPost, tombstoneProfileWithMetaIfDeleted, } from '@openpeepshq/common/lib';
9
+ import { EMBEDDED_REPOSTS_LIMIT } from '../mapping.js';
10
+ import { loadThreadPreviewReplies } from '../threadPreview.js';
9
11
  export const isDirect = (post) => post.visibility === 'direct';
10
12
  export const isPrivate = (post) => post.visibility === 'private';
11
13
  export const isUnlisted = (post) => post.visibility === 'unlisted';
@@ -24,22 +26,7 @@ export const extractHashtags = (data) => {
24
26
  return getTags(data === null || data === void 0 ? void 0 : data.content);
25
27
  }
26
28
  };
27
- export const extractMentionHandles = (text) => {
28
- if (!text) {
29
- return [];
30
- }
31
- const handles = new Set();
32
- for (const word of text.split(/\s+/)) {
33
- if (!word.startsWith('@')) {
34
- continue;
35
- }
36
- const handle = word.slice(1);
37
- if (handleRegex.test(handle)) {
38
- handles.add(handle);
39
- }
40
- }
41
- return [...handles];
42
- };
29
+ export const extractMentionHandles = (text) => matchMentionHandles(text);
43
30
  export const resolveMentionsForPost = async (data) => {
44
31
  const byProfileId = new Map();
45
32
  for (const handle of extractMentionHandles(data.content)) {
@@ -61,48 +48,94 @@ export const hashtagDisconnector = disconnector(collectionInfos.postsCollection,
61
48
  export const mentionConnector = connector(collectionInfos.postsCollection, collectionInfos.profilesCollection, collectionInfos.mentionsCollection);
62
49
  export const mentionsConnectionFinder = connectionFinder(collectionInfos.postsCollection, collectionInfos.profilesCollection, collectionInfos.mentionsCollection);
63
50
  export const repostConnector = connector(collectionInfos.postsCollection, collectionInfos.postsCollection, collectionInfos.repostCollection);
64
- export const reactionConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.reactionsCollection);
65
- export const reactionDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.reactionsCollection);
66
51
  export const bookmarkConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.bookmarksCollection);
67
52
  export const bookmarkDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.bookmarksCollection);
68
53
  export const postSeenConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.postSeenCollection);
69
- const loadPublicProfile = async (profileId, ignoreSoftDelete = false) => anonymizeProfileIfDeleted(await getPublicProfile(profileId, ignoreSoftDelete));
54
+ const loadPublicProfile = async (profileId, ignoreSoftDelete = false) => tombstoneProfileWithMetaIfDeleted(await getPublicProfile(profileId, ignoreSoftDelete));
70
55
  const addProfileForEntry = async (rawEntry) => (Object.assign(Object.assign({}, rawEntry), {
71
56
  // ignoreSoftDelete: authorship must survive account removal
72
57
  profile: (await loadPublicProfile(rawEntry.profile.id, true)) }));
73
- const addProfileForReaction = async (rawReaction) => (Object.assign(Object.assign({}, rawReaction), { profile: (await loadPublicProfile(rawReaction.profile.id, true)) }));
74
58
  const addProfileForMention = async (rawMention) => (Object.assign(Object.assign({}, rawMention), { profile: (await loadPublicProfile(rawMention.profile.id, true)) }));
75
- export const transformPost = async (post, currentProfile) => {
76
- var _a;
77
- const entries = post.entries
59
+ const leanRepostsFromWrappers = async (wrappers) => {
60
+ if (!(wrappers === null || wrappers === void 0 ? void 0 : wrappers.length))
61
+ return [];
62
+ const withProfiles = await Promise.all(wrappers.map(async (wrapper) => {
63
+ var _a, _b, _c;
64
+ const createEntry = (_a = wrapper.entries) === null || _a === void 0 ? void 0 : _a.find((entry) => entry.type === 'create');
65
+ const profileId = (_c = (_b = createEntry === null || createEntry === void 0 ? void 0 : createEntry.profile) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : wrapper.creatorId;
66
+ if (!profileId)
67
+ return null;
68
+ const profile = (createEntry === null || createEntry === void 0 ? void 0 : createEntry.profile)
69
+ ? await loadPublicProfile(createEntry.profile.id, true)
70
+ : await loadPublicProfile(profileId, true);
71
+ if (!profile)
72
+ return null;
73
+ return {
74
+ profile,
75
+ createdAt: wrapper.createdAt,
76
+ };
77
+ }));
78
+ return withProfiles
79
+ .filter((r) => !!r)
80
+ .sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))
81
+ .slice(0, EMBEDDED_REPOSTS_LIMIT);
82
+ };
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
78
88
  ? await Promise.all(post.entries.map(addProfileForEntry))
79
89
  : [];
80
- const reactions = post.reactions
81
- ? await Promise.all(post.reactions.map(addProfileForReaction))
82
- : [];
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
+ }));
97
+ const reposts = await leanRepostsFromWrappers(post.reposts);
83
98
  const audience = post.audience
84
99
  ? (await Promise.all(post.audience.map((p) => loadPublicProfile(p.id)))).filter((profile) => !!profile)
85
100
  : [];
86
101
  const mentions = post.mentions
87
102
  ? await Promise.all(post.mentions.map(addProfileForMention))
88
103
  : [];
89
- 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;
90
105
  const profile = createProfile !== null && createProfile !== void 0 ? createProfile : (post.creatorId
91
106
  ? await loadPublicProfile(post.creatorId, true)
92
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);
93
115
  return Object.assign(Object.assign({}, post), { data: post.data ? normalizePostDataFromDb(post.data) : post.data, seen: currentProfile ? post.seen : undefined, replyTo: post.replyTo
94
- ? await transformPost(post.replyTo, currentProfile)
95
- : undefined, repost: post.repost
96
- ? 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
+ })
97
121
  : undefined, rsvps: entries
98
122
  .filter((entry) => entry.type === 'rsvp')
99
123
  .map((entry) => ({
100
124
  profile: entry.profile,
101
125
  response: entry.data.response,
126
+ recurrenceId: entry.data.recurrenceId,
102
127
  createdAt: entry.createdAt,
103
128
  })), audience,
104
129
  mentions, profile: profile, entries,
105
- reactions });
130
+ reactions,
131
+ reposts });
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;
106
139
  };
107
140
  export const toFilteredPostsList = async (queryResult, options) => {
108
141
  const { authData, limit = 100, offset = 0, filters = [] } = options;
@@ -2,6 +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';
10
+ export { rebuildEventOccurrences, clearEventOccurrences, backfillMissingEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences';
11
+ export { listEventAgenda } from './eventAgenda';
12
+ export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs';
13
+ export { pollEndQueue, pollEndWorker, schedulePollEnd, cancelPollEnd, } from './pollEndJobs';
@@ -2,6 +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';
10
+ export { rebuildEventOccurrences, clearEventOccurrences, backfillMissingEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences.js';
11
+ export { listEventAgenda } from './eventAgenda.js';
12
+ export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs.js';
13
+ export { pollEndQueue, pollEndWorker, schedulePollEnd, cancelPollEnd, } from './pollEndJobs.js';