@openpeepshq/core 0.1.33 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/dist/accessTokens/finders.js +5 -6
  2. package/dist/accessTokens/mutations.js +1 -1
  3. package/dist/accessTokens/tokens.js +8 -11
  4. package/dist/accounts/helpers.js +6 -2
  5. package/dist/accounts/mutations.js +36 -33
  6. package/dist/analytics/cache.js +3 -3
  7. package/dist/analytics/clicks.js +14 -22
  8. package/dist/analytics/compile.js +17 -12
  9. package/dist/analytics/dateRange.js +3 -5
  10. package/dist/analytics/jobs.js +3 -4
  11. package/dist/analytics/pdfReport.js +45 -61
  12. package/dist/analytics/privacy.js +1 -1
  13. package/dist/analytics/read.js +164 -140
  14. package/dist/analytics/report.d.ts +22 -1
  15. package/dist/analytics/report.js +2 -3
  16. package/dist/analytics/settings.js +3 -4
  17. package/dist/backups/index.js +82 -25
  18. package/dist/backups/metadata.d.ts +2 -3
  19. package/dist/backups/metadata.js +6 -2
  20. package/dist/config/db.js +2 -4
  21. package/dist/config/defaults/capabilities.js +13 -2
  22. package/dist/config/defaults/community.js +8 -3
  23. package/dist/config/defaults/core.d.ts +1 -1
  24. package/dist/config/defaults/core.js +16 -8
  25. package/dist/config/index.d.ts +22 -0
  26. package/dist/config/index.js +15 -11
  27. package/dist/db/explorer/query.js +9 -8
  28. package/dist/db/explorer/sql.js +8 -8
  29. package/dist/db/helpers.d.ts +1 -0
  30. package/dist/db/helpers.js +25 -7
  31. package/dist/db/index.d.ts +1 -1
  32. package/dist/db/index.js +1 -0
  33. package/dist/db/init.js +2 -3
  34. package/dist/db/migration/importCollections.d.ts +14 -9
  35. package/dist/db/migration/importCollections.js +121 -174
  36. package/dist/db/migration/shared.d.ts +2 -33
  37. package/dist/db/migration/shared.js +17 -87
  38. package/dist/db/pg/client.js +4 -7
  39. package/dist/db/pg/collections.d.ts +2 -2
  40. package/dist/db/pg/collections.js +2 -2
  41. package/dist/db/pg/filters/index.js +1 -1
  42. package/dist/db/pg/filters/posts.d.ts +12 -0
  43. package/dist/db/pg/filters/posts.js +30 -4
  44. package/dist/db/pg/filters/profiles.d.ts +1 -0
  45. package/dist/db/pg/filters/profiles.js +2 -1
  46. package/dist/db/pg/helpers.js +2 -14
  47. package/dist/db/pg/map/filters.js +40 -10
  48. package/dist/db/pg/map/helpers.js +5 -1
  49. package/dist/db/pg/map/index.js +46 -51
  50. package/dist/db/pg/map/mutations.js +65 -25
  51. package/dist/db/pg/map/registry.d.ts +5 -0
  52. package/dist/db/pg/map/registry.js +133 -56
  53. package/dist/db/pg/map/relations.js +76 -68
  54. package/dist/db/pg/map/search.js +15 -37
  55. package/dist/db/pg/mappers.js +13 -7
  56. package/dist/db/pg/migrate.d.ts +1 -2
  57. package/dist/db/pg/migrate.js +8 -9
  58. package/dist/db/pg/queries/activity.js +5 -5
  59. package/dist/db/pg/queries/derived.js +8 -12
  60. package/dist/db/pg/queries/sorts.d.ts +1 -0
  61. package/dist/db/pg/queries/sorts.js +4 -0
  62. package/dist/db/pg/schema/documents.d.ts +279 -41
  63. package/dist/db/pg/schema/documents.js +136 -22
  64. package/dist/db/pg/schema/edges.d.ts +116 -7
  65. package/dist/db/pg/schema/edges.js +9 -2
  66. package/dist/db/pg/schema/index.d.ts +362 -15
  67. package/dist/db/pg/schema/index.js +5 -1
  68. package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
  69. package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
  70. package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
  71. package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
  72. package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
  73. package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
  74. package/dist/db/pg/sql/0016_posts_search_vector_title_tags_path.sql +54 -0
  75. package/dist/db/pg/sql/meta/{0009_snapshot.json → 0015_snapshot.json} +291 -36
  76. package/dist/db/pg/sql/meta/_journal.json +49 -0
  77. package/dist/db/replaceOrigin.js +1 -1
  78. package/dist/email/queueStats.js +8 -11
  79. package/dist/email/render.js +14 -3
  80. package/dist/email/send.js +19 -17
  81. package/dist/email/smtpTest.js +10 -6
  82. package/dist/errors/index.js +1 -1
  83. package/dist/events/index.d.ts +4 -0
  84. package/dist/events/index.js +1 -0
  85. package/dist/events/once.js +2 -4
  86. package/dist/federation/activities.d.ts +17 -0
  87. package/dist/federation/activities.js +25 -0
  88. package/dist/federation/identity.d.ts +16 -0
  89. package/dist/federation/identity.js +52 -0
  90. package/dist/federation/index.d.ts +4 -0
  91. package/dist/federation/index.js +3 -0
  92. package/dist/federation/profiles.d.ts +3 -0
  93. package/dist/federation/profiles.js +14 -0
  94. package/dist/groups/finders.d.ts +2 -1
  95. package/dist/groups/helpers.d.ts +18 -0
  96. package/dist/groups/helpers.js +1 -2
  97. package/dist/groups/mapping.d.ts +4 -2
  98. package/dist/groups/mutations.js +1 -1
  99. package/dist/hashtags/finders.d.ts +6 -3
  100. package/dist/hashtags/finders.js +2 -0
  101. package/dist/hashtags/helpers.d.ts +8 -0
  102. package/dist/hashtags/helpers.js +4 -0
  103. package/dist/hashtags/index.d.ts +2 -0
  104. package/dist/hashtags/index.js +2 -0
  105. package/dist/hashtags/mutations.d.ts +3 -0
  106. package/dist/hashtags/mutations.js +13 -1
  107. package/dist/i18n/index.d.ts +1 -1
  108. package/dist/i18n/index.js +3 -1
  109. package/dist/i18n/pluginLocales.d.ts +6 -0
  110. package/dist/i18n/pluginLocales.js +15 -0
  111. package/dist/inviteLinks/mutations.js +2 -3
  112. package/dist/jams/export.d.ts +19 -0
  113. package/dist/jams/export.js +58 -0
  114. package/dist/jams/finders.js +4 -1
  115. package/dist/jams/health.d.ts +10 -0
  116. package/dist/jams/health.js +50 -0
  117. package/dist/jams/helpers.d.ts +2 -2
  118. package/dist/jams/helpers.js +6 -2
  119. package/dist/jams/index.d.ts +2 -0
  120. package/dist/jams/index.js +25 -18
  121. package/dist/jams/jobs.js +2 -3
  122. package/dist/jams/livekit.d.ts +49 -4
  123. package/dist/jams/livekit.js +62 -45
  124. package/dist/jams/mapping.d.ts +3 -3
  125. package/dist/jams/mutations.d.ts +1 -1
  126. package/dist/jams/recording.d.ts +10 -0
  127. package/dist/jams/recording.js +33 -1
  128. package/dist/jams/token.d.ts +13 -1
  129. package/dist/jams/token.js +25 -18
  130. package/dist/jams/waitingRoom.js +1 -1
  131. package/dist/jobs/index.d.ts +1 -0
  132. package/dist/jobs/index.js +9 -3
  133. package/dist/jobs/jobDetail.js +6 -12
  134. package/dist/jobs/jobLog.js +2 -3
  135. package/dist/lib/streams.js +4 -39
  136. package/dist/lib/zodDeepPartial.d.ts +1 -1
  137. package/dist/lib/zodDeepPartial.js +1 -1
  138. package/dist/log/index.js +13 -29
  139. package/dist/media/index.d.ts +1 -1
  140. package/dist/media/index.js +73 -12
  141. package/dist/media/jobs.js +1 -2
  142. package/dist/media/openpeeps/index.js +11 -46
  143. package/dist/media/processing.js +25 -11
  144. package/dist/media/streaming.js +5 -5
  145. package/dist/media/streamingCleanupJobs.js +1 -2
  146. package/dist/media/streamingJobs.js +3 -4
  147. package/dist/media/streamingPrewarm.js +7 -11
  148. package/dist/mediaAttachments/index.js +6 -2
  149. package/dist/notifications/defaultNotifications/announcement/index.js +15 -18
  150. package/dist/notifications/defaultNotifications/directMessage/index.js +9 -8
  151. package/dist/notifications/defaultNotifications/follow/index.js +15 -18
  152. package/dist/notifications/defaultNotifications/groupAdded/index.js +14 -17
  153. package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +15 -18
  154. package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +15 -18
  155. package/dist/notifications/defaultNotifications/index.js +4 -0
  156. package/dist/notifications/defaultNotifications/jamModerator/index.js +3 -5
  157. package/dist/notifications/defaultNotifications/jamSpeaker/index.js +14 -18
  158. package/dist/notifications/defaultNotifications/jamStarted/index.js +18 -22
  159. package/dist/notifications/defaultNotifications/mention/index.js +20 -24
  160. package/dist/notifications/defaultNotifications/newGroupPost/index.js +11 -6
  161. package/dist/notifications/defaultNotifications/newProfile/index.js +14 -17
  162. package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
  163. package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
  164. package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
  165. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +17 -0
  166. package/dist/notifications/defaultNotifications/pollVote/index.js +14 -17
  167. package/dist/notifications/defaultNotifications/reaction/index.js +18 -21
  168. package/dist/notifications/defaultNotifications/reply/index.js +21 -22
  169. package/dist/notifications/defaultNotifications/repost/index.js +16 -20
  170. package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
  171. package/dist/notifications/defaultNotifications/rsvp/index.js +31 -18
  172. package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
  173. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +82 -0
  174. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
  175. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
  176. package/dist/notifications/fcmCredential.js +1 -1
  177. package/dist/notifications/finders.js +1 -1
  178. package/dist/notifications/helpers.js +13 -10
  179. package/dist/notifications/jobs.js +10 -5
  180. package/dist/notifications/mutations.js +8 -1
  181. package/dist/notifications/push.js +11 -16
  182. package/dist/performance/index.js +3 -3
  183. package/dist/plugins/helpers.js +3 -6
  184. package/dist/plugins/index.js +39 -4
  185. package/dist/plugins/install.d.ts +28 -9
  186. package/dist/plugins/install.js +302 -56
  187. package/dist/plugins/pluginAuth.d.ts +1 -1
  188. package/dist/plugins/pluginAuth.js +13 -10
  189. package/dist/plugins/state.js +2 -3
  190. package/dist/posts/activity.d.ts +9 -0
  191. package/dist/posts/activity.js +34 -0
  192. package/dist/posts/contextClosure.d.ts +1 -9
  193. package/dist/posts/contextClosure.js +14 -44
  194. package/dist/posts/conversationQueries.d.ts +7 -0
  195. package/dist/posts/conversationQueries.js +76 -4
  196. package/dist/posts/eventAgenda.d.ts +1 -0
  197. package/dist/posts/eventAgenda.js +17 -8
  198. package/dist/posts/eventOccurrenceJobs.js +7 -2
  199. package/dist/posts/eventOccurrences.d.ts +6 -0
  200. package/dist/posts/eventOccurrences.js +22 -1
  201. package/dist/posts/finders.d.ts +56 -9
  202. package/dist/posts/finders.js +84 -23
  203. package/dist/posts/helpers/filters.js +13 -9
  204. package/dist/posts/helpers/index.d.ts +179 -14
  205. package/dist/posts/helpers/index.js +70 -34
  206. package/dist/posts/index.d.ts +5 -2
  207. package/dist/posts/index.js +5 -2
  208. package/dist/posts/mapping.d.ts +765 -30
  209. package/dist/posts/mapping.js +74 -31
  210. package/dist/posts/mutations.d.ts +516 -3
  211. package/dist/posts/mutations.js +179 -41
  212. package/dist/posts/pollEnd.d.ts +3 -0
  213. package/dist/posts/pollEnd.js +4 -0
  214. package/dist/posts/pollEndJobs.d.ts +8 -0
  215. package/dist/posts/pollEndJobs.js +49 -0
  216. package/dist/posts/replyClosure.d.ts +10 -0
  217. package/dist/posts/replyClosure.js +43 -0
  218. package/dist/posts/rsvpConfirmationEmail.js +23 -15
  219. package/dist/posts/threadPreview.d.ts +8 -0
  220. package/dist/posts/threadPreview.js +44 -0
  221. package/dist/posts/unseenCounts.js +4 -1
  222. package/dist/processingStats/queries.js +6 -7
  223. package/dist/profileSettings/cache.js +21 -5
  224. package/dist/profileSettings/mapping.d.ts +2 -0
  225. package/dist/profiles/activityQueries.d.ts +5 -0
  226. package/dist/profiles/activityQueries.js +85 -0
  227. package/dist/profiles/activitySummary.d.ts +3 -0
  228. package/dist/profiles/activitySummary.js +82 -0
  229. package/dist/profiles/blocks.d.ts +12 -0
  230. package/dist/profiles/blocks.js +73 -0
  231. package/dist/profiles/cache.d.ts +1 -0
  232. package/dist/profiles/cache.js +30 -10
  233. package/dist/profiles/export.js +30 -39
  234. package/dist/profiles/finders.d.ts +2 -1
  235. package/dist/profiles/finders.js +15 -8
  236. package/dist/profiles/helpers.d.ts +2 -0
  237. package/dist/profiles/index.d.ts +2 -0
  238. package/dist/profiles/index.js +2 -0
  239. package/dist/profiles/mapping.d.ts +10 -5
  240. package/dist/profiles/mapping.js +13 -1
  241. package/dist/profiles/mutations.d.ts +8 -4
  242. package/dist/profiles/mutations.js +31 -4
  243. package/dist/redis/connection.d.ts +2 -0
  244. package/dist/redis/connection.js +25 -6
  245. package/dist/reports/helpers.js +7 -3
  246. package/dist/roles/index.d.ts +1 -1
  247. package/dist/roles/index.js +1 -1
  248. package/dist/roles/mapping.d.ts +1 -0
  249. package/dist/roles/mutations.js +85 -3
  250. package/dist/search/finders.js +15 -3
  251. package/dist/search/helpers.js +1 -1
  252. package/dist/search/mapping.d.ts +1 -1
  253. package/dist/search/mapping.js +6 -2
  254. package/dist/sentry/index.js +9 -11
  255. package/dist/seo/index.d.ts +50 -0
  256. package/dist/seo/index.js +145 -0
  257. package/dist/seo/route.d.ts +18 -0
  258. package/dist/seo/route.js +19 -0
  259. package/dist/server/index.d.ts +19 -0
  260. package/dist/server/index.js +31 -14
  261. package/dist/server/stablePublicServerInfo.d.ts +17 -0
  262. package/dist/server/stablePublicServerInfo.js +37 -0
  263. package/dist/server/status.d.ts +25 -0
  264. package/dist/server/status.js +97 -0
  265. package/dist/session/index.js +2 -2
  266. package/dist/stats/finders.d.ts +1 -17681
  267. package/dist/stats/finders.js +22 -9
  268. package/dist/stats/helpers.js +4 -1
  269. package/dist/stats/mapping.d.ts +39 -2
  270. package/dist/stats/mapping.js +8 -4
  271. package/dist/stripe/cache.js +5 -6
  272. package/dist/stripe/connection.js +3 -4
  273. package/dist/stripe/helpers.js +15 -20
  274. package/package.json +5 -7
  275. package/dist/db/migration/detect.d.ts +0 -3
  276. package/dist/db/migration/detect.js +0 -33
  277. package/dist/db/migration/importPostgres.d.ts +0 -3
  278. package/dist/db/migration/importPostgres.js +0 -18
  279. package/dist/db/migration/transform.d.ts +0 -20
  280. package/dist/db/migration/transform.js +0 -232
  281. package/dist/db/migration/validate.d.ts +0 -18
  282. package/dist/db/migration/validate.js +0 -69
  283. package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
  284. package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
  285. package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
  286. package/dist/db/pg/sql/meta/0006_snapshot.json +0 -4200
  287. package/dist/db/pg/sql/meta/0007_snapshot.json +0 -4179
  288. package/dist/mastodon/index.d.ts +0 -4
  289. package/dist/mastodon/index.js +0 -51
  290. package/dist/mastodon/types.d.ts +0 -7579
  291. package/dist/mastodon/types.js +0 -523
  292. package/dist/mastodon/typescript.d.ts +0 -1578
  293. package/dist/mastodon/typescript.js +0 -1
  294. package/dist/migration/index.d.ts +0 -4
  295. package/dist/migration/index.js +0 -4
  296. package/dist/roles/defaults.d.ts +0 -2
  297. package/dist/roles/defaults.js +0 -95
@@ -0,0 +1,16 @@
1
+ -- Backfill user_groups.roles from pre-roles `capabilities` on membership edges.
2
+ -- Memberships without roles fail private-group canReadPost while unseen SQL
3
+ -- still counts them by edge existence.
4
+ UPDATE "user_groups"
5
+ SET "body" = jsonb_set(
6
+ COALESCE("body", '{}'::jsonb) - 'capabilities',
7
+ '{roles}',
8
+ CASE
9
+ WHEN COALESCE("body"->'capabilities', '[]'::jsonb) ? '*'
10
+ THEN '["owner"]'::jsonb
11
+ ELSE '["member"]'::jsonb
12
+ END
13
+ )
14
+ WHERE COALESCE("body"->'roles', '[]'::jsonb) = '[]'::jsonb
15
+ OR "body"->'roles' IS NULL
16
+ OR jsonb_typeof("body"->'roles') = 'null';
@@ -0,0 +1 @@
1
+ DROP TABLE IF EXISTS "data_migrations";
@@ -0,0 +1,5 @@
1
+ ALTER TABLE "posts" ADD COLUMN IF NOT EXISTS "last_activity_at" timestamp with time zone;--> statement-breakpoint
2
+ UPDATE "posts" SET "last_activity_at" = "created_at" WHERE "last_activity_at" IS NULL;--> statement-breakpoint
3
+ ALTER TABLE "posts" ALTER COLUMN "last_activity_at" SET DEFAULT now();--> statement-breakpoint
4
+ ALTER TABLE "posts" ALTER COLUMN "last_activity_at" SET NOT NULL;--> statement-breakpoint
5
+ CREATE INDEX IF NOT EXISTS "posts_last_activity_id_idx" ON "posts" USING btree ("last_activity_at","id");
@@ -0,0 +1,12 @@
1
+ CREATE TABLE "blocks" (
2
+ "id" uuid PRIMARY KEY NOT NULL,
3
+ "from_id" text NOT NULL,
4
+ "to_id" text NOT NULL,
5
+ "body" jsonb DEFAULT '{}'::jsonb,
6
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
7
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE INDEX "blocks_from_idx" ON "blocks" USING btree ("from_id");--> statement-breakpoint
11
+ CREATE INDEX "blocks_to_idx" ON "blocks" USING btree ("to_id");--> statement-breakpoint
12
+ CREATE UNIQUE INDEX "blocks_from_to_unique" ON "blocks" USING btree ("from_id","to_id");
@@ -0,0 +1,59 @@
1
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "uri" text;
2
+ --> statement-breakpoint
3
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "inbox_url" text;
4
+ --> statement-breakpoint
5
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "shared_inbox_url" text;
6
+ --> statement-breakpoint
7
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "public_key_pem" text;
8
+ --> statement-breakpoint
9
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "private_key_pem" text;
10
+ --> statement-breakpoint
11
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "key_id" text;
12
+ --> statement-breakpoint
13
+ ALTER TABLE "profiles" ADD COLUMN IF NOT EXISTS "fetched_at" timestamp with time zone;
14
+ --> statement-breakpoint
15
+ CREATE UNIQUE INDEX IF NOT EXISTS "profiles_uri_unique" ON "profiles" USING btree ("uri");
16
+ --> statement-breakpoint
17
+ ALTER TABLE "posts" ADD COLUMN IF NOT EXISTS "uri" text;
18
+ --> statement-breakpoint
19
+ ALTER TABLE "posts" ADD COLUMN IF NOT EXISTS "in_reply_to_uri" text;
20
+ --> statement-breakpoint
21
+ CREATE UNIQUE INDEX IF NOT EXISTS "posts_uri_unique" ON "posts" USING btree ("uri");
22
+ --> statement-breakpoint
23
+ CREATE INDEX IF NOT EXISTS "posts_in_reply_to_uri_idx" ON "posts" USING btree ("in_reply_to_uri");
24
+ --> statement-breakpoint
25
+ CREATE TABLE IF NOT EXISTS "ap_activities" (
26
+ "uri" text PRIMARY KEY NOT NULL,
27
+ "type" text NOT NULL,
28
+ "actor_uri" text NOT NULL,
29
+ "object_uri" text,
30
+ "direction" text NOT NULL,
31
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
32
+ );
33
+ --> statement-breakpoint
34
+ DO $$
35
+ BEGIN
36
+ IF to_regclass('public.reactions') IS NOT NULL THEN
37
+ INSERT INTO "entries" ("id", "from_id", "to_id", "body", "created_at", "updated_at")
38
+ SELECT
39
+ r."id",
40
+ r."from_id",
41
+ r."to_id",
42
+ jsonb_build_object(
43
+ 'type', 'reaction',
44
+ 'data', CASE
45
+ WHEN COALESCE(r."body", '{}'::jsonb) ? 'reaction'
46
+ THEN COALESCE(r."body", '{}'::jsonb)
47
+ ELSE jsonb_build_object('reaction', '👍')
48
+ END
49
+ ),
50
+ r."created_at",
51
+ r."updated_at"
52
+ FROM "reactions" r
53
+ WHERE NOT EXISTS (
54
+ SELECT 1 FROM "entries" e WHERE e."id" = r."id"
55
+ );
56
+ END IF;
57
+ END $$;
58
+ --> statement-breakpoint
59
+ DROP TABLE IF EXISTS "reactions";
@@ -0,0 +1,12 @@
1
+ CREATE TABLE "profile_hashtags" (
2
+ "id" uuid PRIMARY KEY NOT NULL,
3
+ "from_id" text NOT NULL,
4
+ "to_id" text NOT NULL,
5
+ "body" jsonb DEFAULT '{}'::jsonb,
6
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
7
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE INDEX "profile_hashtags_from_idx" ON "profile_hashtags" USING btree ("from_id");--> statement-breakpoint
11
+ CREATE INDEX "profile_hashtags_to_idx" ON "profile_hashtags" USING btree ("to_id");--> statement-breakpoint
12
+ CREATE UNIQUE INDEX "profile_hashtags_from_to_unique" ON "profile_hashtags" USING btree ("from_id","to_id");
@@ -0,0 +1,54 @@
1
+ CREATE OR REPLACE FUNCTION openpeeps_posts_search_vector(p_body jsonb) RETURNS tsvector
2
+ LANGUAGE sql
3
+ STABLE
4
+ AS $$
5
+ SELECT to_tsvector('english', trim(
6
+ coalesce(p_body->>'content', '') || ' ' ||
7
+ coalesce(p_body->>'title', '') || ' ' ||
8
+ coalesce(p_body->>'name', '') || ' ' ||
9
+ coalesce(p_body->'physicalLocation'->>'text', '') || ' ' ||
10
+ coalesce(p_body->>'url', '') || ' ' ||
11
+ coalesce((
12
+ SELECT string_agg(tag, ' ')
13
+ FROM jsonb_array_elements_text(
14
+ CASE
15
+ WHEN jsonb_typeof(p_body->'tags') = 'array' THEN p_body->'tags'
16
+ ELSE '[]'::jsonb
17
+ END
18
+ ) AS tag
19
+ ), '') || ' ' ||
20
+ coalesce((
21
+ SELECT string_agg(segment, ' ')
22
+ FROM jsonb_array_elements_text(
23
+ CASE
24
+ WHEN jsonb_typeof(p_body->'categoryPath') = 'array'
25
+ THEN p_body->'categoryPath'
26
+ ELSE '[]'::jsonb
27
+ END
28
+ ) AS segment
29
+ ), '') || ' ' ||
30
+ coalesce((
31
+ SELECT string_agg(o->>'content', ' ')
32
+ FROM jsonb_array_elements(
33
+ CASE
34
+ WHEN jsonb_typeof(p_body->'options') = 'array' THEN p_body->'options'
35
+ ELSE '[]'::jsonb
36
+ END
37
+ ) AS o
38
+ ), '') || ' ' ||
39
+ coalesce((
40
+ SELECT string_agg(
41
+ coalesce(a->>'description', '') || ' ' || coalesce(a->>'filename', ''),
42
+ ' '
43
+ )
44
+ FROM jsonb_array_elements(
45
+ CASE
46
+ WHEN jsonb_typeof(p_body->'attachments') = 'array' THEN p_body->'attachments'
47
+ ELSE '[]'::jsonb
48
+ END
49
+ ) AS a
50
+ ), '')
51
+ ));
52
+ $$;
53
+ --> statement-breakpoint
54
+ UPDATE "posts" SET "search_vector" = openpeeps_posts_search_vector("body");
@@ -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,55 @@
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
116
+ },
117
+ {
118
+ "idx": 16,
119
+ "version": "7",
120
+ "when": 1791620000000,
121
+ "tag": "0016_posts_search_vector_title_tags_path",
122
+ "breakpoints": true
74
123
  }
75
124
  ]
76
125
  }
@@ -48,7 +48,7 @@ const replaceOriginInUrl = (urlValue, oldHostname, newOrigin) => {
48
48
  }
49
49
  return newOriginTrimmed + rest;
50
50
  }
51
- catch (_a) {
51
+ catch {
52
52
  return urlValue;
53
53
  }
54
54
  };