@openpeepshq/core 0.1.33 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/accounts/mutations.js +33 -35
  2. package/dist/analytics/compile.js +16 -10
  3. package/dist/analytics/read.js +52 -9
  4. package/dist/analytics/report.d.ts +20 -0
  5. package/dist/backups/index.js +75 -15
  6. package/dist/backups/metadata.d.ts +2 -3
  7. package/dist/backups/metadata.js +6 -2
  8. package/dist/config/defaults/capabilities.js +13 -2
  9. package/dist/config/defaults/community.js +7 -3
  10. package/dist/config/defaults/core.d.ts +1 -1
  11. package/dist/config/defaults/core.js +3 -0
  12. package/dist/config/index.d.ts +21 -0
  13. package/dist/config/index.js +7 -1
  14. package/dist/db/helpers.d.ts +1 -0
  15. package/dist/db/helpers.js +11 -3
  16. package/dist/db/index.d.ts +1 -1
  17. package/dist/db/index.js +1 -0
  18. package/dist/db/init.js +2 -3
  19. package/dist/db/migration/importCollections.d.ts +14 -9
  20. package/dist/db/migration/importCollections.js +114 -164
  21. package/dist/db/migration/shared.d.ts +2 -33
  22. package/dist/db/migration/shared.js +2 -52
  23. package/dist/db/pg/collections.d.ts +2 -2
  24. package/dist/db/pg/collections.js +2 -2
  25. package/dist/db/pg/filters/posts.d.ts +10 -0
  26. package/dist/db/pg/filters/posts.js +28 -4
  27. package/dist/db/pg/filters/profiles.d.ts +1 -0
  28. package/dist/db/pg/filters/profiles.js +2 -1
  29. package/dist/db/pg/map/filters.js +32 -2
  30. package/dist/db/pg/map/mutations.js +13 -8
  31. package/dist/db/pg/map/registry.d.ts +5 -0
  32. package/dist/db/pg/map/registry.js +64 -24
  33. package/dist/db/pg/map/relations.js +9 -5
  34. package/dist/db/pg/migrate.d.ts +1 -2
  35. package/dist/db/pg/migrate.js +6 -6
  36. package/dist/db/pg/queries/activity.js +3 -3
  37. package/dist/db/pg/queries/sorts.d.ts +1 -0
  38. package/dist/db/pg/queries/sorts.js +4 -0
  39. package/dist/db/pg/schema/documents.d.ts +279 -41
  40. package/dist/db/pg/schema/documents.js +21 -8
  41. package/dist/db/pg/schema/edges.d.ts +116 -7
  42. package/dist/db/pg/schema/edges.js +2 -1
  43. package/dist/db/pg/schema/index.d.ts +362 -15
  44. package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
  45. package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
  46. package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
  47. package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
  48. package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
  49. package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
  50. package/dist/db/pg/sql/meta/{0009_snapshot.json → 0015_snapshot.json} +291 -36
  51. package/dist/db/pg/sql/meta/_journal.json +43 -1
  52. package/dist/email/render.js +11 -3
  53. package/dist/events/index.d.ts +4 -0
  54. package/dist/events/index.js +1 -0
  55. package/dist/federation/activities.d.ts +17 -0
  56. package/dist/federation/activities.js +26 -0
  57. package/dist/federation/identity.d.ts +16 -0
  58. package/dist/federation/identity.js +52 -0
  59. package/dist/federation/index.d.ts +4 -0
  60. package/dist/federation/index.js +3 -0
  61. package/dist/federation/profiles.d.ts +3 -0
  62. package/dist/federation/profiles.js +14 -0
  63. package/dist/groups/finders.d.ts +2 -1
  64. package/dist/groups/helpers.d.ts +18 -0
  65. package/dist/groups/mapping.d.ts +4 -2
  66. package/dist/hashtags/finders.d.ts +6 -3
  67. package/dist/hashtags/finders.js +2 -0
  68. package/dist/hashtags/helpers.d.ts +8 -0
  69. package/dist/hashtags/helpers.js +4 -0
  70. package/dist/hashtags/index.d.ts +2 -0
  71. package/dist/hashtags/index.js +2 -0
  72. package/dist/hashtags/mutations.d.ts +3 -0
  73. package/dist/hashtags/mutations.js +13 -1
  74. package/dist/i18n/index.d.ts +1 -1
  75. package/dist/i18n/index.js +3 -1
  76. package/dist/i18n/pluginLocales.d.ts +6 -0
  77. package/dist/i18n/pluginLocales.js +15 -0
  78. package/dist/jams/export.d.ts +19 -0
  79. package/dist/jams/export.js +60 -0
  80. package/dist/jams/health.d.ts +8 -0
  81. package/dist/jams/health.js +46 -0
  82. package/dist/jams/helpers.d.ts +2 -2
  83. package/dist/jams/index.d.ts +2 -0
  84. package/dist/jams/index.js +23 -16
  85. package/dist/jams/jobs.js +1 -1
  86. package/dist/jams/livekit.d.ts +49 -4
  87. package/dist/jams/livekit.js +56 -39
  88. package/dist/jams/mapping.d.ts +3 -3
  89. package/dist/jams/mutations.d.ts +1 -1
  90. package/dist/jams/recording.d.ts +10 -0
  91. package/dist/jams/recording.js +32 -0
  92. package/dist/jams/token.d.ts +13 -1
  93. package/dist/jams/token.js +18 -7
  94. package/dist/jams/waitingRoom.js +1 -1
  95. package/dist/jobs/index.d.ts +1 -0
  96. package/dist/jobs/index.js +6 -1
  97. package/dist/jobs/jobDetail.js +1 -6
  98. package/dist/media/index.d.ts +1 -1
  99. package/dist/media/index.js +23 -8
  100. package/dist/media/processing.js +18 -7
  101. package/dist/notifications/defaultNotifications/follow/index.js +2 -2
  102. package/dist/notifications/defaultNotifications/index.js +4 -0
  103. package/dist/notifications/defaultNotifications/newGroupPost/index.js +12 -6
  104. package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
  105. package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
  106. package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
  107. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +18 -0
  108. package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
  109. package/dist/notifications/defaultNotifications/rsvp/index.js +7 -0
  110. package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
  111. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +75 -0
  112. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
  113. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
  114. package/dist/notifications/jobs.js +3 -1
  115. package/dist/notifications/mutations.js +4 -0
  116. package/dist/plugins/index.js +37 -1
  117. package/dist/plugins/install.d.ts +28 -9
  118. package/dist/plugins/install.js +281 -49
  119. package/dist/plugins/pluginAuth.d.ts +1 -1
  120. package/dist/plugins/pluginAuth.js +10 -6
  121. package/dist/posts/activity.d.ts +9 -0
  122. package/dist/posts/activity.js +35 -0
  123. package/dist/posts/contextClosure.d.ts +1 -9
  124. package/dist/posts/contextClosure.js +15 -44
  125. package/dist/posts/conversationQueries.d.ts +7 -0
  126. package/dist/posts/conversationQueries.js +76 -2
  127. package/dist/posts/eventAgenda.d.ts +1 -0
  128. package/dist/posts/eventAgenda.js +10 -4
  129. package/dist/posts/eventOccurrenceJobs.js +7 -2
  130. package/dist/posts/eventOccurrences.d.ts +6 -0
  131. package/dist/posts/eventOccurrences.js +21 -0
  132. package/dist/posts/finders.d.ts +15 -8
  133. package/dist/posts/finders.js +67 -18
  134. package/dist/posts/helpers/filters.js +13 -8
  135. package/dist/posts/helpers/index.d.ts +27 -14
  136. package/dist/posts/helpers/index.js +34 -14
  137. package/dist/posts/index.d.ts +5 -2
  138. package/dist/posts/index.js +5 -2
  139. package/dist/posts/mapping.d.ts +216 -13
  140. package/dist/posts/mapping.js +14 -13
  141. package/dist/posts/mutations.d.ts +440 -3
  142. package/dist/posts/mutations.js +155 -32
  143. package/dist/posts/pollEnd.d.ts +3 -0
  144. package/dist/posts/pollEnd.js +7 -0
  145. package/dist/posts/pollEndJobs.d.ts +8 -0
  146. package/dist/posts/pollEndJobs.js +49 -0
  147. package/dist/posts/replyClosure.d.ts +10 -0
  148. package/dist/posts/replyClosure.js +43 -0
  149. package/dist/posts/rsvpConfirmationEmail.js +14 -16
  150. package/dist/posts/threadPreview.d.ts +8 -0
  151. package/dist/posts/threadPreview.js +44 -0
  152. package/dist/posts/unseenCounts.js +4 -1
  153. package/dist/profileSettings/cache.js +22 -5
  154. package/dist/profileSettings/mapping.d.ts +2 -0
  155. package/dist/profiles/activityQueries.d.ts +5 -0
  156. package/dist/profiles/activityQueries.js +85 -0
  157. package/dist/profiles/activitySummary.d.ts +3 -0
  158. package/dist/profiles/activitySummary.js +87 -0
  159. package/dist/profiles/blocks.d.ts +12 -0
  160. package/dist/profiles/blocks.js +73 -0
  161. package/dist/profiles/cache.d.ts +1 -0
  162. package/dist/profiles/cache.js +19 -6
  163. package/dist/profiles/finders.d.ts +2 -1
  164. package/dist/profiles/finders.js +8 -3
  165. package/dist/profiles/helpers.d.ts +2 -0
  166. package/dist/profiles/index.d.ts +2 -0
  167. package/dist/profiles/index.js +2 -0
  168. package/dist/profiles/mapping.d.ts +10 -5
  169. package/dist/profiles/mapping.js +13 -1
  170. package/dist/profiles/mutations.d.ts +8 -4
  171. package/dist/profiles/mutations.js +31 -2
  172. package/dist/redis/connection.d.ts +2 -0
  173. package/dist/redis/connection.js +25 -6
  174. package/dist/roles/index.d.ts +1 -1
  175. package/dist/roles/index.js +1 -1
  176. package/dist/roles/mapping.d.ts +1 -0
  177. package/dist/roles/mutations.js +86 -3
  178. package/dist/search/mapping.d.ts +1 -1
  179. package/dist/search/mapping.js +6 -2
  180. package/dist/server/index.d.ts +18 -0
  181. package/dist/server/index.js +24 -12
  182. package/dist/server/stablePublicServerInfo.d.ts +17 -0
  183. package/dist/server/stablePublicServerInfo.js +37 -0
  184. package/dist/server/status.d.ts +25 -0
  185. package/dist/server/status.js +98 -0
  186. package/dist/stats/finders.d.ts +1 -17681
  187. package/dist/stats/finders.js +9 -5
  188. package/dist/stats/mapping.d.ts +0 -1
  189. package/dist/stats/mapping.js +0 -3
  190. package/package.json +4 -5
  191. package/dist/db/migration/detect.d.ts +0 -3
  192. package/dist/db/migration/detect.js +0 -33
  193. package/dist/db/migration/importPostgres.d.ts +0 -3
  194. package/dist/db/migration/importPostgres.js +0 -18
  195. package/dist/db/migration/transform.d.ts +0 -20
  196. package/dist/db/migration/transform.js +0 -232
  197. package/dist/db/migration/validate.d.ts +0 -18
  198. package/dist/db/migration/validate.js +0 -69
  199. package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
  200. package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
  201. package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
  202. package/dist/db/pg/sql/meta/0006_snapshot.json +0 -4200
  203. package/dist/db/pg/sql/meta/0007_snapshot.json +0 -4179
  204. package/dist/mastodon/index.d.ts +0 -4
  205. package/dist/mastodon/index.js +0 -51
  206. package/dist/mastodon/types.d.ts +0 -7579
  207. package/dist/mastodon/types.js +0 -523
  208. package/dist/mastodon/typescript.d.ts +0 -1578
  209. package/dist/mastodon/typescript.js +0 -1
  210. package/dist/migration/index.d.ts +0 -4
  211. package/dist/migration/index.js +0 -4
  212. package/dist/roles/defaults.d.ts +0 -2
  213. package/dist/roles/defaults.js +0 -95
@@ -1,6 +1,6 @@
1
1
  {
2
- "id": "891cba5b-0d56-4393-9674-376cacf83ea6",
3
- "prevId": "8fc6aeab-cf72-40e8-809c-72f1f4433a5d",
2
+ "id": "dfefc4cf-8580-4232-bcc9-fe7da89adb2e",
3
+ "prevId": "3d4c31b7-52a6-4d1b-8074-351a9d74dd4f",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
6
6
  "tables": {
@@ -130,41 +130,46 @@
130
130
  "checkConstraints": {},
131
131
  "isRLSEnabled": false
132
132
  },
133
- "public.configs": {
134
- "name": "configs",
133
+ "public.ap_activities": {
134
+ "name": "ap_activities",
135
135
  "schema": "",
136
136
  "columns": {
137
- "key": {
138
- "name": "key",
137
+ "uri": {
138
+ "name": "uri",
139
139
  "type": "text",
140
140
  "primaryKey": true,
141
141
  "notNull": true
142
142
  },
143
- "body": {
144
- "name": "body",
145
- "type": "jsonb",
143
+ "type": {
144
+ "name": "type",
145
+ "type": "text",
146
146
  "primaryKey": false,
147
147
  "notNull": true
148
148
  },
149
- "created_at": {
150
- "name": "created_at",
151
- "type": "timestamp with time zone",
149
+ "actor_uri": {
150
+ "name": "actor_uri",
151
+ "type": "text",
152
152
  "primaryKey": false,
153
- "notNull": true,
154
- "default": "now()"
153
+ "notNull": true
155
154
  },
156
- "updated_at": {
157
- "name": "updated_at",
158
- "type": "timestamp with time zone",
155
+ "object_uri": {
156
+ "name": "object_uri",
157
+ "type": "text",
159
158
  "primaryKey": false,
160
- "notNull": true,
161
- "default": "now()"
159
+ "notNull": false
162
160
  },
163
- "deleted_at": {
164
- "name": "deleted_at",
161
+ "direction": {
162
+ "name": "direction",
163
+ "type": "text",
164
+ "primaryKey": false,
165
+ "notNull": true
166
+ },
167
+ "created_at": {
168
+ "name": "created_at",
165
169
  "type": "timestamp with time zone",
166
170
  "primaryKey": false,
167
- "notNull": false
171
+ "notNull": true,
172
+ "default": "now()"
168
173
  }
169
174
  },
170
175
  "indexes": {},
@@ -175,22 +180,41 @@
175
180
  "checkConstraints": {},
176
181
  "isRLSEnabled": false
177
182
  },
178
- "public.data_migrations": {
179
- "name": "data_migrations",
183
+ "public.configs": {
184
+ "name": "configs",
180
185
  "schema": "",
181
186
  "columns": {
182
- "id": {
183
- "name": "id",
187
+ "key": {
188
+ "name": "key",
184
189
  "type": "text",
185
190
  "primaryKey": true,
186
191
  "notNull": true
187
192
  },
188
- "applied_at": {
189
- "name": "applied_at",
193
+ "body": {
194
+ "name": "body",
195
+ "type": "jsonb",
196
+ "primaryKey": false,
197
+ "notNull": true
198
+ },
199
+ "created_at": {
200
+ "name": "created_at",
201
+ "type": "timestamp with time zone",
202
+ "primaryKey": false,
203
+ "notNull": true,
204
+ "default": "now()"
205
+ },
206
+ "updated_at": {
207
+ "name": "updated_at",
190
208
  "type": "timestamp with time zone",
191
209
  "primaryKey": false,
192
210
  "notNull": true,
193
211
  "default": "now()"
212
+ },
213
+ "deleted_at": {
214
+ "name": "deleted_at",
215
+ "type": "timestamp with time zone",
216
+ "primaryKey": false,
217
+ "notNull": false
194
218
  }
195
219
  },
196
220
  "indexes": {},
@@ -824,6 +848,18 @@
824
848
  "primaryKey": false,
825
849
  "notNull": true
826
850
  },
851
+ "uri": {
852
+ "name": "uri",
853
+ "type": "text",
854
+ "primaryKey": false,
855
+ "notNull": false
856
+ },
857
+ "in_reply_to_uri": {
858
+ "name": "in_reply_to_uri",
859
+ "type": "text",
860
+ "primaryKey": false,
861
+ "notNull": false
862
+ },
827
863
  "body": {
828
864
  "name": "body",
829
865
  "type": "jsonb",
@@ -837,6 +873,13 @@
837
873
  "primaryKey": false,
838
874
  "notNull": false
839
875
  },
876
+ "last_activity_at": {
877
+ "name": "last_activity_at",
878
+ "type": "timestamp with time zone",
879
+ "primaryKey": false,
880
+ "notNull": true,
881
+ "default": "now()"
882
+ },
840
883
  "created_at": {
841
884
  "name": "created_at",
842
885
  "type": "timestamp with time zone",
@@ -904,6 +947,36 @@
904
947
  "method": "btree",
905
948
  "with": {}
906
949
  },
950
+ "posts_uri_unique": {
951
+ "name": "posts_uri_unique",
952
+ "columns": [
953
+ {
954
+ "expression": "uri",
955
+ "isExpression": false,
956
+ "asc": true,
957
+ "nulls": "last"
958
+ }
959
+ ],
960
+ "isUnique": true,
961
+ "concurrently": false,
962
+ "method": "btree",
963
+ "with": {}
964
+ },
965
+ "posts_in_reply_to_uri_idx": {
966
+ "name": "posts_in_reply_to_uri_idx",
967
+ "columns": [
968
+ {
969
+ "expression": "in_reply_to_uri",
970
+ "isExpression": false,
971
+ "asc": true,
972
+ "nulls": "last"
973
+ }
974
+ ],
975
+ "isUnique": false,
976
+ "concurrently": false,
977
+ "method": "btree",
978
+ "with": {}
979
+ },
907
980
  "posts_search_vector_idx": {
908
981
  "name": "posts_search_vector_idx",
909
982
  "columns": [
@@ -918,6 +991,27 @@
918
991
  "concurrently": false,
919
992
  "method": "gin",
920
993
  "with": {}
994
+ },
995
+ "posts_last_activity_id_idx": {
996
+ "name": "posts_last_activity_id_idx",
997
+ "columns": [
998
+ {
999
+ "expression": "last_activity_at",
1000
+ "isExpression": false,
1001
+ "asc": true,
1002
+ "nulls": "last"
1003
+ },
1004
+ {
1005
+ "expression": "id",
1006
+ "isExpression": false,
1007
+ "asc": true,
1008
+ "nulls": "last"
1009
+ }
1010
+ ],
1011
+ "isUnique": false,
1012
+ "concurrently": false,
1013
+ "method": "btree",
1014
+ "with": {}
921
1015
  }
922
1016
  },
923
1017
  "foreignKeys": {},
@@ -1118,6 +1212,48 @@
1118
1212
  "primaryKey": false,
1119
1213
  "notNull": true
1120
1214
  },
1215
+ "uri": {
1216
+ "name": "uri",
1217
+ "type": "text",
1218
+ "primaryKey": false,
1219
+ "notNull": false
1220
+ },
1221
+ "inbox_url": {
1222
+ "name": "inbox_url",
1223
+ "type": "text",
1224
+ "primaryKey": false,
1225
+ "notNull": false
1226
+ },
1227
+ "shared_inbox_url": {
1228
+ "name": "shared_inbox_url",
1229
+ "type": "text",
1230
+ "primaryKey": false,
1231
+ "notNull": false
1232
+ },
1233
+ "public_key_pem": {
1234
+ "name": "public_key_pem",
1235
+ "type": "text",
1236
+ "primaryKey": false,
1237
+ "notNull": false
1238
+ },
1239
+ "private_key_pem": {
1240
+ "name": "private_key_pem",
1241
+ "type": "text",
1242
+ "primaryKey": false,
1243
+ "notNull": false
1244
+ },
1245
+ "key_id": {
1246
+ "name": "key_id",
1247
+ "type": "text",
1248
+ "primaryKey": false,
1249
+ "notNull": false
1250
+ },
1251
+ "fetched_at": {
1252
+ "name": "fetched_at",
1253
+ "type": "timestamp with time zone",
1254
+ "primaryKey": false,
1255
+ "notNull": false
1256
+ },
1121
1257
  "body": {
1122
1258
  "name": "body",
1123
1259
  "type": "jsonb",
@@ -1174,6 +1310,21 @@
1174
1310
  "method": "btree",
1175
1311
  "with": {}
1176
1312
  },
1313
+ "profiles_uri_unique": {
1314
+ "name": "profiles_uri_unique",
1315
+ "columns": [
1316
+ {
1317
+ "expression": "uri",
1318
+ "isExpression": false,
1319
+ "asc": true,
1320
+ "nulls": "last"
1321
+ }
1322
+ ],
1323
+ "isUnique": true,
1324
+ "concurrently": false,
1325
+ "method": "btree",
1326
+ "with": {}
1327
+ },
1177
1328
  "profiles_search_vector_idx": {
1178
1329
  "name": "profiles_search_vector_idx",
1179
1330
  "columns": [
@@ -1530,6 +1681,110 @@
1530
1681
  "checkConstraints": {},
1531
1682
  "isRLSEnabled": false
1532
1683
  },
1684
+ "public.blocks": {
1685
+ "name": "blocks",
1686
+ "schema": "",
1687
+ "columns": {
1688
+ "id": {
1689
+ "name": "id",
1690
+ "type": "uuid",
1691
+ "primaryKey": true,
1692
+ "notNull": true
1693
+ },
1694
+ "from_id": {
1695
+ "name": "from_id",
1696
+ "type": "text",
1697
+ "primaryKey": false,
1698
+ "notNull": true
1699
+ },
1700
+ "to_id": {
1701
+ "name": "to_id",
1702
+ "type": "text",
1703
+ "primaryKey": false,
1704
+ "notNull": true
1705
+ },
1706
+ "body": {
1707
+ "name": "body",
1708
+ "type": "jsonb",
1709
+ "primaryKey": false,
1710
+ "notNull": false,
1711
+ "default": "'{}'::jsonb"
1712
+ },
1713
+ "created_at": {
1714
+ "name": "created_at",
1715
+ "type": "timestamp with time zone",
1716
+ "primaryKey": false,
1717
+ "notNull": true,
1718
+ "default": "now()"
1719
+ },
1720
+ "updated_at": {
1721
+ "name": "updated_at",
1722
+ "type": "timestamp with time zone",
1723
+ "primaryKey": false,
1724
+ "notNull": true,
1725
+ "default": "now()"
1726
+ }
1727
+ },
1728
+ "indexes": {
1729
+ "blocks_from_idx": {
1730
+ "name": "blocks_from_idx",
1731
+ "columns": [
1732
+ {
1733
+ "expression": "from_id",
1734
+ "isExpression": false,
1735
+ "asc": true,
1736
+ "nulls": "last"
1737
+ }
1738
+ ],
1739
+ "isUnique": false,
1740
+ "concurrently": false,
1741
+ "method": "btree",
1742
+ "with": {}
1743
+ },
1744
+ "blocks_to_idx": {
1745
+ "name": "blocks_to_idx",
1746
+ "columns": [
1747
+ {
1748
+ "expression": "to_id",
1749
+ "isExpression": false,
1750
+ "asc": true,
1751
+ "nulls": "last"
1752
+ }
1753
+ ],
1754
+ "isUnique": false,
1755
+ "concurrently": false,
1756
+ "method": "btree",
1757
+ "with": {}
1758
+ },
1759
+ "blocks_from_to_unique": {
1760
+ "name": "blocks_from_to_unique",
1761
+ "columns": [
1762
+ {
1763
+ "expression": "from_id",
1764
+ "isExpression": false,
1765
+ "asc": true,
1766
+ "nulls": "last"
1767
+ },
1768
+ {
1769
+ "expression": "to_id",
1770
+ "isExpression": false,
1771
+ "asc": true,
1772
+ "nulls": "last"
1773
+ }
1774
+ ],
1775
+ "isUnique": true,
1776
+ "concurrently": false,
1777
+ "method": "btree",
1778
+ "with": {}
1779
+ }
1780
+ },
1781
+ "foreignKeys": {},
1782
+ "compositePrimaryKeys": {},
1783
+ "uniqueConstraints": {},
1784
+ "policies": {},
1785
+ "checkConstraints": {},
1786
+ "isRLSEnabled": false
1787
+ },
1533
1788
  "public.bookmarks": {
1534
1789
  "name": "bookmarks",
1535
1790
  "schema": "",
@@ -3066,8 +3321,8 @@
3066
3321
  "checkConstraints": {},
3067
3322
  "isRLSEnabled": false
3068
3323
  },
3069
- "public.reactions": {
3070
- "name": "reactions",
3324
+ "public.profile_hashtags": {
3325
+ "name": "profile_hashtags",
3071
3326
  "schema": "",
3072
3327
  "columns": {
3073
3328
  "id": {
@@ -3111,8 +3366,8 @@
3111
3366
  }
3112
3367
  },
3113
3368
  "indexes": {
3114
- "reactions_from_idx": {
3115
- "name": "reactions_from_idx",
3369
+ "profile_hashtags_from_idx": {
3370
+ "name": "profile_hashtags_from_idx",
3116
3371
  "columns": [
3117
3372
  {
3118
3373
  "expression": "from_id",
@@ -3126,8 +3381,8 @@
3126
3381
  "method": "btree",
3127
3382
  "with": {}
3128
3383
  },
3129
- "reactions_to_idx": {
3130
- "name": "reactions_to_idx",
3384
+ "profile_hashtags_to_idx": {
3385
+ "name": "profile_hashtags_to_idx",
3131
3386
  "columns": [
3132
3387
  {
3133
3388
  "expression": "to_id",
@@ -3141,8 +3396,8 @@
3141
3396
  "method": "btree",
3142
3397
  "with": {}
3143
3398
  },
3144
- "reactions_from_to_unique": {
3145
- "name": "reactions_from_to_unique",
3399
+ "profile_hashtags_from_to_unique": {
3400
+ "name": "profile_hashtags_from_to_unique",
3146
3401
  "columns": [
3147
3402
  {
3148
3403
  "expression": "from_id",
@@ -71,6 +71,48 @@
71
71
  "when": 1787640000000,
72
72
  "tag": "0009_event_occurrences",
73
73
  "breakpoints": true
74
+ },
75
+ {
76
+ "idx": 10,
77
+ "version": "7",
78
+ "when": 1789536200000,
79
+ "tag": "0010_user_group_membership_roles",
80
+ "breakpoints": true
81
+ },
82
+ {
83
+ "idx": 11,
84
+ "version": "7",
85
+ "when": 1789538000000,
86
+ "tag": "0011_drop_data_migrations",
87
+ "breakpoints": true
88
+ },
89
+ {
90
+ "idx": 12,
91
+ "version": "7",
92
+ "when": 1789540000000,
93
+ "tag": "0012_posts_last_activity_at",
94
+ "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "7",
99
+ "when": 1789541000000,
100
+ "tag": "0013_add_blocks_edge",
101
+ "breakpoints": true
102
+ },
103
+ {
104
+ "idx": 14,
105
+ "version": "7",
106
+ "when": 1789542000000,
107
+ "tag": "0014_federation_datamodel",
108
+ "breakpoints": true
109
+ },
110
+ {
111
+ "idx": 15,
112
+ "version": "7",
113
+ "when": 1790593758508,
114
+ "tag": "0015_profile_hashtags",
115
+ "breakpoints": true
74
116
  }
75
117
  ]
76
- }
118
+ }
@@ -1,19 +1,27 @@
1
+ import { FALLBACK_TIME_ZONE, resolveTimeZone } from '@openpeepshq/common/lib';
1
2
  import { communityConfig, config } from '../config/index.js';
2
3
  import { convert } from 'html-to-text';
3
4
  import { registeredTemplates } from './registry.js';
4
5
  import { serverRootUrl } from '../server/index.js';
5
6
  import { initI18nEmailContext } from '../i18n/index.js';
6
- const globals = async () => {
7
+ const localTimeZone = (locals) => {
8
+ const value = locals === null || locals === void 0 ? void 0 : locals.timeZone;
9
+ return typeof value === 'string' ? value : undefined;
10
+ };
11
+ const globals = async (locals) => {
12
+ var _a;
7
13
  const serverConfig = await config();
8
14
  const rootUrl = await serverRootUrl();
15
+ const community = await communityConfig();
9
16
  return {
10
- communityConfig: await communityConfig(),
17
+ communityConfig: community,
11
18
  serverData: {
12
19
  rootUrl,
13
20
  iosUrl: serverConfig.apps.ios.url,
14
21
  androidUrl: serverConfig.apps.android.url,
15
22
  },
16
23
  i18nContext: await initI18nEmailContext(),
24
+ timeZone: resolveTimeZone(localTimeZone(locals), (_a = community.settings) === null || _a === void 0 ? void 0 : _a.defaultTimeZone, FALLBACK_TIME_ZONE),
17
25
  };
18
26
  };
19
27
  export const render = async (emailData) => {
@@ -22,7 +30,7 @@ export const render = async (emailData) => {
22
30
  if (!render) {
23
31
  throw Error(`No renderer registered for ${emailData.template}`);
24
32
  }
25
- const { html, subject } = await render(Object.assign(Object.assign({}, emailData), { globals: await globals(), locals: locals || {} }));
33
+ const { html, subject } = await render(Object.assign(Object.assign({}, emailData), { globals: await globals(locals), locals: locals || {} }));
26
34
  const text = convert(html);
27
35
  return {
28
36
  to: emailData.to,
@@ -1,3 +1,4 @@
1
+ import type { RsvpCancelNotice } from '@openpeepshq/common/lib';
1
2
  import type { Profile, EntryData, PostWithMeta, Notification, ReactionData, JamRecordingWithMeta, RSVP, RsvpResponse } from '@openpeepshq/common/types';
2
3
  export type CoreEvents = {
3
4
  profileCreated: (profile: Profile) => void;
@@ -10,12 +11,15 @@ export type CoreEvents = {
10
11
  rsvpCreated: (profile: Profile, post: PostWithMeta, data: {
11
12
  type: 'rsvp';
12
13
  data: RSVP;
14
+ occurrenceIds?: string[];
13
15
  previousResponse?: RsvpResponse;
16
+ cancel?: RsvpCancelNotice;
14
17
  }) => void;
15
18
  postAnnounced: (post: PostWithMeta) => void;
16
19
  configUpdated: (namespace: string, name: string) => void;
17
20
  /** Profile settings changed — clear in-process caches in all services. */
18
21
  profileSettingsUpdated: (profileId: string) => void;
22
+ pollEnded: (post: PostWithMeta) => void;
19
23
  };
20
24
  export type CoreEventKey = keyof CoreEvents;
21
25
  export declare const VALID_EVENT_KEYS: CoreEventKey[];
@@ -16,6 +16,7 @@ const validEventKeyMap = {
16
16
  postAnnounced: true,
17
17
  configUpdated: true,
18
18
  profileSettingsUpdated: true,
19
+ pollEnded: true,
19
20
  };
20
21
  export const VALID_EVENT_KEYS = Object.keys(validEventKeyMap);
21
22
  let connectionPromise = undefined;
@@ -0,0 +1,17 @@
1
+ export type ApActivityDirection = 'in' | 'out';
2
+ export type ApActivity = {
3
+ uri: string;
4
+ type: string;
5
+ actorUri: string;
6
+ objectUri?: string | null;
7
+ direction: ApActivityDirection;
8
+ };
9
+ export declare const recordApActivity: (activity: ApActivity) => Promise<void>;
10
+ export declare const findApActivityByUri: (uri: string) => Promise<{
11
+ uri: string;
12
+ type: string;
13
+ actorUri: string;
14
+ objectUri: string | null;
15
+ direction: string;
16
+ createdAt: string;
17
+ }>;
@@ -0,0 +1,26 @@
1
+ import { eq } from 'drizzle-orm';
2
+ import { pgDb } from '../db/pg/client.js';
3
+ import { apActivities } from '../db/pg/schema/documents.js';
4
+ export const recordApActivity = async (activity) => {
5
+ var _a;
6
+ const db = pgDb();
7
+ await db
8
+ .insert(apActivities)
9
+ .values({
10
+ uri: activity.uri,
11
+ type: activity.type,
12
+ actorUri: activity.actorUri,
13
+ objectUri: (_a = activity.objectUri) !== null && _a !== void 0 ? _a : null,
14
+ direction: activity.direction,
15
+ })
16
+ .onConflictDoNothing();
17
+ };
18
+ export const findApActivityByUri = async (uri) => {
19
+ const db = pgDb();
20
+ const [row] = await db
21
+ .select()
22
+ .from(apActivities)
23
+ .where(eq(apActivities.uri, uri))
24
+ .limit(1);
25
+ return row;
26
+ };
@@ -0,0 +1,16 @@
1
+ export declare const actorUri: (domain: string, profileId: string) => string;
2
+ export declare const objectUri: (domain: string, postId: string) => string;
3
+ export declare const generateActorKeyPair: () => import("crypto").KeyPairSyncResult<string, string>;
4
+ export declare const localActorScalars: (profileId: string, domain: string) => {
5
+ uri: string;
6
+ inboxUrl: string;
7
+ publicKeyPem: string;
8
+ privateKeyPem: string;
9
+ keyId: string;
10
+ };
11
+ export declare const localObjectScalars: (postId: string, domain: string, inReplyToId?: string | null) => {
12
+ uri: string;
13
+ inReplyToUri: string | null;
14
+ };
15
+ /** Fill actor/object URIs and local RSA keys after schema migrate. */
16
+ export declare const backfillLocalFederationIdentities: () => Promise<void>;
@@ -0,0 +1,52 @@
1
+ import { generateKeyPairSync } from 'node:crypto';
2
+ import { and, eq, isNull, sql } from 'drizzle-orm';
3
+ import { pgDb } from '../db/pg/client.js';
4
+ import { profiles } from '../db/pg/schema/documents.js';
5
+ export const actorUri = (domain, profileId) => `https://${domain}/ap/users/${profileId}`;
6
+ export const objectUri = (domain, postId) => `https://${domain}/ap/objects/${postId}`;
7
+ export const generateActorKeyPair = () => generateKeyPairSync('rsa', {
8
+ modulusLength: 2048,
9
+ publicKeyEncoding: { type: 'spki', format: 'pem' },
10
+ privateKeyEncoding: { type: 'pkcs8', format: 'pem' },
11
+ });
12
+ export const localActorScalars = (profileId, domain) => {
13
+ const uri = actorUri(domain, profileId);
14
+ const keys = generateActorKeyPair();
15
+ return {
16
+ uri,
17
+ inboxUrl: `${uri}/inbox`,
18
+ publicKeyPem: keys.publicKey,
19
+ privateKeyPem: keys.privateKey,
20
+ keyId: `${uri}#main-key`,
21
+ };
22
+ };
23
+ export const localObjectScalars = (postId, domain, inReplyToId) => ({
24
+ uri: objectUri(domain, postId),
25
+ inReplyToUri: inReplyToId ? objectUri(domain, inReplyToId) : null,
26
+ });
27
+ const federationDomain = () => process.env.ACTIVITY_PUB_DEFAULT_DOMAIN || 'localhost';
28
+ /** Fill actor/object URIs and local RSA keys after schema migrate. */
29
+ export const backfillLocalFederationIdentities = async () => {
30
+ const db = pgDb();
31
+ const domain = federationDomain();
32
+ const locals = await db
33
+ .select({ id: profiles.id })
34
+ .from(profiles)
35
+ .where(and(eq(profiles.type, 'local'), isNull(profiles.uri), isNull(profiles.deletedAt)));
36
+ for (const row of locals) {
37
+ await db
38
+ .update(profiles)
39
+ .set(localActorScalars(row.id, domain))
40
+ .where(eq(profiles.id, row.id));
41
+ }
42
+ await db.execute(sql `UPDATE posts SET uri = ${`https://${domain}/ap/objects/`} || id::text WHERE uri IS NULL`);
43
+ await db.execute(sql `
44
+ UPDATE posts p
45
+ SET in_reply_to_uri = parent.uri
46
+ FROM reply_to rt
47
+ JOIN posts parent ON parent.id::text = rt.to_id
48
+ WHERE rt.from_id = p.id::text
49
+ AND p.in_reply_to_uri IS NULL
50
+ AND parent.uri IS NOT NULL
51
+ `);
52
+ };
@@ -0,0 +1,4 @@
1
+ export { findApActivityByUri, recordApActivity } from './activities';
2
+ export type { ApActivity, ApActivityDirection } from './activities';
3
+ export { actorUri, backfillLocalFederationIdentities, generateActorKeyPair, localActorScalars, localObjectScalars, objectUri, } from './identity';
4
+ export { findProfileByHandleAndDomain, findProfileByUri } from './profiles';