@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.
- package/dist/accessTokens/helpers.d.ts +2 -2
- package/dist/accessTokens/tokens.js +14 -7
- package/dist/accounts/mutations.d.ts +2 -2
- package/dist/accounts/mutations.js +33 -35
- package/dist/analytics/cache.js +12 -7
- package/dist/analytics/compile.js +16 -10
- package/dist/analytics/pdfReport.d.ts +1 -0
- package/dist/analytics/pdfReport.js +5 -4
- package/dist/analytics/privacy.d.ts +18 -0
- package/dist/analytics/privacy.js +10 -0
- package/dist/analytics/read.js +75 -19
- package/dist/analytics/report.d.ts +21 -1
- package/dist/analytics/report.js +9 -2
- package/dist/backups/index.js +78 -15
- package/dist/backups/metadata.d.ts +8 -2
- package/dist/backups/metadata.js +6 -2
- package/dist/config/defaults/capabilities.js +13 -2
- package/dist/config/defaults/community.js +7 -9
- package/dist/config/defaults/core.d.ts +1 -1
- package/dist/config/defaults/core.js +3 -0
- package/dist/config/defaults/db.d.ts +0 -2
- package/dist/config/defaults/db.js +0 -2
- package/dist/config/index.d.ts +25 -3
- package/dist/config/index.js +7 -1
- package/dist/db/helpers.d.ts +7 -28
- package/dist/db/helpers.js +30 -152
- package/dist/db/index.d.ts +3 -1
- package/dist/db/index.js +5 -0
- package/dist/db/init.js +2 -2
- package/dist/db/migration/importCollections.d.ts +15 -10
- package/dist/db/migration/importCollections.js +121 -155
- package/dist/db/migration/shared.d.ts +2 -37
- package/dist/db/migration/shared.js +2 -59
- package/dist/db/pg/client.js +4 -0
- package/dist/db/pg/collections.d.ts +2 -2
- package/dist/db/pg/collections.js +2 -2
- package/dist/db/pg/filters/edges.d.ts +1 -1
- package/dist/db/pg/filters/edges.js +1 -1
- package/dist/db/pg/filters/posts.d.ts +11 -0
- package/dist/db/pg/filters/posts.js +37 -3
- package/dist/db/pg/filters/profiles.d.ts +1 -0
- package/dist/db/pg/filters/profiles.js +2 -1
- package/dist/db/pg/map/filters.js +37 -2
- package/dist/db/pg/map/mutations.js +13 -8
- package/dist/db/pg/map/registry.d.ts +5 -0
- package/dist/db/pg/map/registry.js +64 -24
- package/dist/db/pg/map/relations.d.ts +1 -1
- package/dist/db/pg/map/relations.js +98 -46
- package/dist/db/pg/migrate.d.ts +22 -0
- package/dist/db/pg/migrate.js +88 -2
- package/dist/db/pg/queries/activity.js +3 -3
- package/dist/db/pg/queries/sorts.d.ts +1 -0
- package/dist/db/pg/queries/sorts.js +4 -0
- package/dist/db/pg/schema/documents.d.ts +422 -41
- package/dist/db/pg/schema/documents.js +43 -9
- package/dist/db/pg/schema/edges.d.ts +117 -7
- package/dist/db/pg/schema/edges.js +4 -2
- package/dist/db/pg/schema/index.d.ts +505 -15
- package/dist/db/pg/sql/0007_shallow_oracle.sql +3 -0
- package/dist/db/pg/sql/0008_group_owner_roles.sql +31 -0
- package/dist/db/pg/sql/0009_event_occurrences.sql +26 -0
- package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
- package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
- package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
- package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
- package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
- package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
- package/dist/db/pg/sql/meta/{0006_snapshot.json → 0015_snapshot.json} +393 -39
- package/dist/db/pg/sql/meta/_journal.json +64 -1
- package/dist/db/replaceOrigin.js +6 -0
- package/dist/db/types.d.ts +0 -4
- package/dist/email/render.js +11 -3
- package/dist/events/index.d.ts +6 -1
- package/dist/events/index.js +55 -33
- package/dist/federation/activities.d.ts +17 -0
- package/dist/federation/activities.js +26 -0
- package/dist/federation/identity.d.ts +16 -0
- package/dist/federation/identity.js +52 -0
- package/dist/federation/index.d.ts +4 -0
- package/dist/federation/index.js +3 -0
- package/dist/federation/profiles.d.ts +3 -0
- package/dist/federation/profiles.js +14 -0
- package/dist/groups/finders.d.ts +3 -2
- package/dist/groups/helpers.d.ts +24 -6
- package/dist/groups/mapping.d.ts +6 -4
- package/dist/groups/mapping.js +2 -2
- package/dist/groups/mutations.js +1 -1
- package/dist/hashtags/finders.d.ts +6 -3
- package/dist/hashtags/finders.js +2 -0
- package/dist/hashtags/helpers.d.ts +8 -0
- package/dist/hashtags/helpers.js +4 -0
- package/dist/hashtags/index.d.ts +2 -0
- package/dist/hashtags/index.js +2 -0
- package/dist/hashtags/mutations.d.ts +3 -0
- package/dist/hashtags/mutations.js +13 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +3 -1
- package/dist/i18n/pluginLocales.d.ts +6 -0
- package/dist/i18n/pluginLocales.js +15 -0
- package/dist/inviteLinks/helpers.d.ts +4 -4
- package/dist/jams/cache.d.ts +1 -1
- package/dist/jams/cache.js +2 -1
- package/dist/jams/export.d.ts +19 -0
- package/dist/jams/export.js +60 -0
- package/dist/jams/finders.d.ts +2 -1
- package/dist/jams/finders.js +18 -7
- package/dist/jams/health.d.ts +8 -0
- package/dist/jams/health.js +46 -0
- package/dist/jams/helpers.d.ts +6 -2
- package/dist/jams/index.d.ts +6 -3
- package/dist/jams/index.js +41 -27
- package/dist/jams/jobs.js +1 -1
- package/dist/jams/livekit.d.ts +93 -10
- package/dist/jams/livekit.js +151 -52
- package/dist/jams/mapping.d.ts +17 -7
- package/dist/jams/mutations.d.ts +3 -1
- package/dist/jams/recording.d.ts +10 -0
- package/dist/jams/recording.js +32 -0
- package/dist/jams/rtmp.d.ts +5 -0
- package/dist/jams/rtmp.js +8 -0
- package/dist/jams/token.d.ts +15 -3
- package/dist/jams/token.js +30 -16
- package/dist/jams/waitingRoom.d.ts +6 -6
- package/dist/jams/waitingRoom.js +24 -23
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.js +6 -1
- package/dist/jobs/jobDetail.js +1 -6
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.js +23 -8
- package/dist/media/processing.js +18 -7
- package/dist/notifications/defaultNotifications/follow/index.js +2 -2
- package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +3 -1
- package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +3 -1
- package/dist/notifications/defaultNotifications/index.js +4 -0
- package/dist/notifications/defaultNotifications/newGroupPost/index.js +12 -6
- package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
- package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
- package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
- package/dist/notifications/defaultNotifications/pollEnded/recipients.js +18 -0
- package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
- package/dist/notifications/defaultNotifications/rsvp/index.js +7 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +75 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
- package/dist/notifications/helpers.js +6 -2
- package/dist/notifications/jobs.js +3 -1
- package/dist/notifications/mutations.js +4 -0
- package/dist/notifications/push.js +11 -4
- package/dist/plugins/helpers.d.ts +1 -0
- package/dist/plugins/helpers.js +1 -8
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +78 -5
- package/dist/plugins/install.d.ts +39 -0
- package/dist/plugins/install.js +455 -0
- package/dist/plugins/pluginAuth.d.ts +1 -1
- package/dist/plugins/pluginAuth.js +10 -6
- package/dist/plugins/state.d.ts +4 -0
- package/dist/plugins/state.js +29 -0
- package/dist/posts/activity.d.ts +9 -0
- package/dist/posts/activity.js +35 -0
- package/dist/posts/contextClosure.d.ts +1 -9
- package/dist/posts/contextClosure.js +15 -44
- package/dist/posts/conversationQueries.d.ts +7 -0
- package/dist/posts/conversationQueries.js +76 -2
- package/dist/posts/eventAgenda.d.ts +166 -0
- package/dist/posts/eventAgenda.js +126 -0
- package/dist/posts/eventOccurrenceJobs.d.ts +4 -0
- package/dist/posts/eventOccurrenceJobs.js +28 -0
- package/dist/posts/eventOccurrences.d.ts +10 -0
- package/dist/posts/eventOccurrences.js +61 -0
- package/dist/posts/finders.d.ts +47 -16
- package/dist/posts/finders.js +93 -62
- package/dist/posts/helpers/filters.js +14 -9
- package/dist/posts/helpers/index.d.ts +129 -30
- package/dist/posts/helpers/index.js +66 -33
- package/dist/posts/index.d.ts +7 -1
- package/dist/posts/index.js +7 -1
- package/dist/posts/mapping.d.ts +491 -13
- package/dist/posts/mapping.js +45 -10
- package/dist/posts/mutations.d.ts +441 -4
- package/dist/posts/mutations.js +177 -43
- package/dist/posts/pollEnd.d.ts +3 -0
- package/dist/posts/pollEnd.js +7 -0
- package/dist/posts/pollEndJobs.d.ts +8 -0
- package/dist/posts/pollEndJobs.js +49 -0
- package/dist/posts/replyClosure.d.ts +10 -0
- package/dist/posts/replyClosure.js +43 -0
- package/dist/posts/rsvpConfirmationEmail.js +14 -15
- package/dist/posts/threadPreview.d.ts +8 -0
- package/dist/posts/threadPreview.js +44 -0
- package/dist/posts/unseenCounts.d.ts +2 -0
- package/dist/posts/unseenCounts.js +28 -8
- package/dist/profileSettings/cache.js +22 -5
- package/dist/profileSettings/mapping.d.ts +2 -0
- package/dist/profiles/activityQueries.d.ts +5 -0
- package/dist/profiles/activityQueries.js +85 -0
- package/dist/profiles/activitySummary.d.ts +3 -0
- package/dist/profiles/activitySummary.js +87 -0
- package/dist/profiles/blocks.d.ts +12 -0
- package/dist/profiles/blocks.js +73 -0
- package/dist/profiles/cache.d.ts +4 -1
- package/dist/profiles/cache.js +28 -7
- package/dist/profiles/finders.d.ts +2 -1
- package/dist/profiles/finders.js +8 -3
- package/dist/profiles/helpers.d.ts +7 -5
- package/dist/profiles/index.d.ts +3 -1
- package/dist/profiles/index.js +3 -1
- package/dist/profiles/mapping.d.ts +10 -5
- package/dist/profiles/mapping.js +13 -1
- package/dist/profiles/mutations.d.ts +8 -4
- package/dist/profiles/mutations.js +42 -15
- package/dist/pushSubscriptions/helpers.d.ts +2 -2
- package/dist/pushSubscriptions/mutations.js +13 -1
- package/dist/redis/connection.d.ts +2 -0
- package/dist/redis/connection.js +25 -6
- package/dist/reports/helpers.d.ts +6 -6
- package/dist/roles/index.d.ts +1 -1
- package/dist/roles/index.js +1 -1
- package/dist/roles/mapping.d.ts +1 -0
- package/dist/roles/mutations.js +86 -3
- package/dist/search/mapping.d.ts +1 -1
- package/dist/search/mapping.js +6 -2
- package/dist/server/index.d.ts +19 -1
- package/dist/server/index.js +37 -18
- package/dist/server/stablePublicServerInfo.d.ts +17 -0
- package/dist/server/stablePublicServerInfo.js +37 -0
- package/dist/server/status.d.ts +25 -0
- package/dist/server/status.js +98 -0
- package/dist/stats/finders.d.ts +1 -16131
- package/dist/stats/finders.js +9 -5
- package/dist/stats/mapping.d.ts +21 -1
- package/dist/stats/mapping.js +0 -3
- package/package.json +6 -12
- package/dist/db/arango.d.ts +0 -2
- package/dist/db/arango.js +0 -110
- package/dist/db/migration/autoMigrate.d.ts +0 -2
- package/dist/db/migration/autoMigrate.js +0 -111
- package/dist/db/migration/cli.d.ts +0 -1
- package/dist/db/migration/cli.js +0 -56
- package/dist/db/migration/detect.d.ts +0 -6
- package/dist/db/migration/detect.js +0 -87
- package/dist/db/migration/exportArango.d.ts +0 -4
- package/dist/db/migration/exportArango.js +0 -80
- package/dist/db/migration/importPostgres.d.ts +0 -3
- package/dist/db/migration/importPostgres.js +0 -18
- package/dist/db/migration/transform.d.ts +0 -18
- package/dist/db/migration/transform.js +0 -209
- package/dist/db/migration/validate.d.ts +0 -18
- package/dist/db/migration/validate.js +0 -69
- package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
- package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
- package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
- package/dist/mastodon/index.d.ts +0 -4
- package/dist/mastodon/index.js +0 -51
- package/dist/mastodon/types.d.ts +0 -7579
- package/dist/mastodon/types.js +0 -523
- package/dist/mastodon/typescript.d.ts +0 -1578
- package/dist/mastodon/typescript.js +0 -1
- package/dist/roles/defaults.d.ts +0 -2
- package/dist/roles/defaults.js +0 -94
package/dist/posts/finders.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const replies: (authData: AuthorizationData, post: PostWithMeta)
|
|
|
11
11
|
export declare const baseListPosts: ({ start, profile, }: {
|
|
12
12
|
start?: string;
|
|
13
13
|
profile?: ProfileWithMeta;
|
|
14
|
-
}) => Mapping<DbPost
|
|
14
|
+
}) => Mapping<DbPost, import("../db/pg/map").WithId<DbPost>, import("../db/pg/map").WithId<DbPost>>;
|
|
15
15
|
export declare const baseFeed: ({ start, sort, profile, }: {
|
|
16
16
|
start?: string;
|
|
17
17
|
sort?: ObjectSort;
|
|
@@ -158,6 +158,27 @@ export declare const baseEventsFeed: (profile?: ProfileWithMeta) => Mapping<{
|
|
|
158
158
|
} | undefined;
|
|
159
159
|
} | undefined;
|
|
160
160
|
url?: string | undefined;
|
|
161
|
+
recurrence?: {
|
|
162
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
163
|
+
interval?: number | undefined;
|
|
164
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
165
|
+
until?: string | undefined;
|
|
166
|
+
count?: number | undefined;
|
|
167
|
+
} | undefined;
|
|
168
|
+
exceptions?: {
|
|
169
|
+
recurrenceId: string;
|
|
170
|
+
cancelled?: boolean | undefined;
|
|
171
|
+
start?: string | undefined;
|
|
172
|
+
end?: string | undefined;
|
|
173
|
+
physicalLocation?: {
|
|
174
|
+
text: string;
|
|
175
|
+
coordinates?: {
|
|
176
|
+
lat: number;
|
|
177
|
+
lng: number;
|
|
178
|
+
alt?: number | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
}[] | undefined;
|
|
161
182
|
} | {
|
|
162
183
|
type: "article";
|
|
163
184
|
content?: string | undefined;
|
|
@@ -201,56 +222,66 @@ export declare const listPosts: (authData: AuthorizationData, { start, limit, fi
|
|
|
201
222
|
filter?: PgFilter<DbBasePost>;
|
|
202
223
|
}) => Promise<PostWithMeta[]>;
|
|
203
224
|
export declare const listConversationLeaves: (authData: AuthorizationData) => Promise<PostWithMeta[]>;
|
|
204
|
-
export declare const listPostsByProfile: (authData: AuthorizationData, requestedProfile: ProfileWithMeta, { start, limit, filter, }?: {
|
|
225
|
+
export declare const listPostsByProfile: (authData: AuthorizationData, requestedProfile: ProfileWithMeta, { start, limit, filter, format, }?: {
|
|
205
226
|
start?: string;
|
|
206
227
|
limit?: number;
|
|
207
228
|
filter?: PgFilter<DbBasePost>;
|
|
229
|
+
format?: string | null;
|
|
208
230
|
}) => Promise<PostWithMeta[]>;
|
|
209
|
-
export declare const listBookmarkedPosts: (authData: AuthorizationData, requestedProfile: ProfileWithMeta, { start, limit, filter, }?: {
|
|
231
|
+
export declare const listBookmarkedPosts: (authData: AuthorizationData, requestedProfile: ProfileWithMeta, { start, limit, filter, format, }?: {
|
|
210
232
|
start?: string;
|
|
211
233
|
limit?: number;
|
|
212
234
|
filter?: PgFilter<DbBasePost>;
|
|
235
|
+
format?: string | null;
|
|
213
236
|
}) => Promise<PostWithMeta[]>;
|
|
214
237
|
export declare const listBookmarkedPostIds: (requestedProfile: ProfileWithMeta) => Promise<string[]>;
|
|
215
238
|
export declare const getUnseenPostCounts: (authData: AuthorizationData) => Promise<UnseenPostCounts>;
|
|
216
|
-
export declare const listPostsByType: (authData: AuthorizationData, type: PostType, { start, limit, filter, }?: {
|
|
239
|
+
export declare const listPostsByType: (authData: AuthorizationData, type: PostType, { start, limit, filter, format, }?: {
|
|
217
240
|
start?: string;
|
|
218
241
|
limit?: number;
|
|
219
242
|
filter?: PgFilter<DbBasePost>;
|
|
243
|
+
format?: string | null;
|
|
220
244
|
}) => Promise<PostWithMeta[]>;
|
|
221
|
-
export declare const listPostsByTag: (authData: AuthorizationData, tag: string, { start, limit, filter, }?: {
|
|
245
|
+
export declare const listPostsByTag: (authData: AuthorizationData, tag: string, { start, limit, filter, format, }?: {
|
|
222
246
|
start?: string;
|
|
223
247
|
limit?: number;
|
|
224
248
|
filter?: PgFilter<DbBasePost>;
|
|
249
|
+
format?: string | null;
|
|
225
250
|
}) => Promise<PostWithMeta[]>;
|
|
226
|
-
export declare const listPostsByGroup: (authData: AuthorizationData, groupId: string, { start, limit, filter, sort
|
|
251
|
+
export declare const listPostsByGroup: (authData: AuthorizationData, groupId: string, { start, limit, filter, sort, format, }?: {
|
|
227
252
|
start?: string;
|
|
228
253
|
limit?: number;
|
|
229
254
|
filter?: PgFilter<DbBasePost>;
|
|
230
255
|
sort?: ObjectSort;
|
|
256
|
+
format?: string | null;
|
|
231
257
|
}) => Promise<PostWithMeta[]>;
|
|
232
|
-
export declare const listLocalFeed: (authData: AuthorizationData, { start, limit }?: {
|
|
258
|
+
export declare const listLocalFeed: (authData: AuthorizationData, { start, limit, format, }?: {
|
|
233
259
|
start?: string;
|
|
234
260
|
limit?: number;
|
|
261
|
+
format?: string | null;
|
|
235
262
|
}) => Promise<PostWithMeta[]>;
|
|
236
|
-
export declare const listMyFeed: (authData: AuthorizationData, { start, limit }?: {
|
|
263
|
+
export declare const listMyFeed: (authData: AuthorizationData, { start, limit, format, }?: {
|
|
237
264
|
start?: string;
|
|
238
265
|
limit?: number;
|
|
266
|
+
format?: string | null;
|
|
239
267
|
}) => Promise<PostWithMeta[]>;
|
|
240
|
-
export declare const listUpcomingEventsFeed: (authData: AuthorizationData, { offset, limit,
|
|
268
|
+
export declare const listUpcomingEventsFeed: (authData: AuthorizationData, { offset, limit, jamOnly, mine, }?: {
|
|
241
269
|
offset?: number;
|
|
242
270
|
limit?: number;
|
|
243
|
-
|
|
271
|
+
jamOnly?: boolean;
|
|
272
|
+
mine?: boolean;
|
|
244
273
|
}) => Promise<PostWithMeta[]>;
|
|
245
|
-
export declare const listCurrentEventsFeed: (authData: AuthorizationData, { offset, limit,
|
|
274
|
+
export declare const listCurrentEventsFeed: (authData: AuthorizationData, { offset, limit, jamOnly, mine, }?: {
|
|
246
275
|
offset?: number;
|
|
247
276
|
limit?: number;
|
|
248
|
-
|
|
277
|
+
jamOnly?: boolean;
|
|
278
|
+
mine?: boolean;
|
|
249
279
|
}) => Promise<PostWithMeta[]>;
|
|
250
|
-
export declare const listPastEventsFeed: (authData: AuthorizationData, { offset, limit,
|
|
280
|
+
export declare const listPastEventsFeed: (authData: AuthorizationData, { offset, limit, jamOnly, mine, }?: {
|
|
251
281
|
offset?: number;
|
|
252
282
|
limit?: number;
|
|
253
|
-
|
|
283
|
+
jamOnly?: boolean;
|
|
284
|
+
mine?: boolean;
|
|
254
285
|
}) => Promise<PostWithMeta[]>;
|
|
255
286
|
export declare const listMyUpcomingEventsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
256
287
|
offset?: number;
|
|
@@ -296,5 +327,5 @@ export declare const getPostContext: (post: PostWithMeta, authData: Authorizatio
|
|
|
296
327
|
ancestors: PostWithMeta[];
|
|
297
328
|
descendants: PostWithMeta[];
|
|
298
329
|
}>;
|
|
299
|
-
export declare const mentions: (post: Post, profile: Profile) => Promise<
|
|
300
|
-
export declare const audience: (post: Post, profile: Profile) => Promise<
|
|
330
|
+
export declare const mentions: (post: Post, profile: Profile) => Promise<Record<string, unknown> | undefined>;
|
|
331
|
+
export declare const audience: (post: Post, profile: Profile) => Promise<Record<string, unknown> | undefined>;
|
package/dist/posts/finders.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { parseFeedFormat } from '@openpeepshq/common';
|
|
2
|
+
import { blockedPairIds, isBlockedPair } from '@openpeepshq/common/lib';
|
|
1
3
|
import { allpeepDb, collectionInfos } from '../db/index.js';
|
|
2
4
|
import { edgeFilters, postFilters } from '../db/pg/filters/index.js';
|
|
3
5
|
import { contextRelation, conversationLeavesMappingForProfile, postContextMappingForProfile, postsAuthMapping, postsMappingForProfile, repostsOfPostRelationForProfile, postIdsMapping, } from './mapping.js';
|
|
4
|
-
import { audienceConnectionFinder,
|
|
5
|
-
import { addQuerySort, addStart, sortOldestFirst } from '../db/helpers.js';
|
|
6
|
+
import { audienceConnectionFinder, localFeedFilter, mentionsConnectionFinder, myFeedFilter, myFeedGroupMembershipFilter, toFilteredPostsList, transformPost, } from './helpers/index.js';
|
|
7
|
+
import { addActivityStart, addQuerySort, addStart, sortOldestFirst, } from '../db/helpers.js';
|
|
6
8
|
import { sorts } from '../db/pg/queries/index.js';
|
|
7
9
|
import { findHashtagByTag, hashtagsMapping } from '../hashtags/index.js';
|
|
8
10
|
import { findGroup } from '../groups/finders.js';
|
|
@@ -13,6 +15,7 @@ import { withSpan } from '../performance/index.js';
|
|
|
13
15
|
import { queryUnseenPostCounts } from './unseenCounts.js';
|
|
14
16
|
import { getConversationThread } from './conversationQueries.js';
|
|
15
17
|
import { fetchRowsByIds, hydrateMapData } from '../db/pg/map/relations.js';
|
|
18
|
+
import { listEventAgenda } from './eventAgenda.js';
|
|
16
19
|
/**
|
|
17
20
|
* Throws if the given `authData` does not include a profile.
|
|
18
21
|
*
|
|
@@ -26,11 +29,19 @@ const requireProfile = (authData) => {
|
|
|
26
29
|
}
|
|
27
30
|
return authData.profile;
|
|
28
31
|
};
|
|
32
|
+
const hideBlockedAuthorPost = (post, profile) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (!post)
|
|
35
|
+
return undefined;
|
|
36
|
+
const creatorId = (_a = post.creatorId) !== null && _a !== void 0 ? _a : (_b = post.profile) === null || _b === void 0 ? void 0 : _b.id;
|
|
37
|
+
return isBlockedPair(profile, creatorId) ? undefined : post;
|
|
38
|
+
};
|
|
29
39
|
export const findPost = async (id, authData) => {
|
|
30
40
|
const profile = authData === null || authData === void 0 ? void 0 : authData.profile;
|
|
31
41
|
return allpeepDb()
|
|
32
42
|
.then(({ db }) => postsMappingForProfile(profile).find(db, id))
|
|
33
|
-
.then((post) => (post ? transformPost(post, profile) : undefined))
|
|
43
|
+
.then((post) => (post ? transformPost(post, profile) : undefined))
|
|
44
|
+
.then((post) => hideBlockedAuthorPost(post, profile));
|
|
34
45
|
};
|
|
35
46
|
/** Lean post load for capability checks (no nested reply/repost). */
|
|
36
47
|
export const findPostsForAuth = async (ids, authData) => {
|
|
@@ -46,7 +57,7 @@ export const findPostsForAuth = async (ids, authData) => {
|
|
|
46
57
|
return [transformed.id, transformed];
|
|
47
58
|
})));
|
|
48
59
|
return ids
|
|
49
|
-
.map((id) => byId.get(id))
|
|
60
|
+
.map((id) => hideBlockedAuthorPost(byId.get(id), profile))
|
|
50
61
|
.filter((post) => !!post);
|
|
51
62
|
};
|
|
52
63
|
export const postContext = async (authData, id, depth, direction, contextMapping) => {
|
|
@@ -57,12 +68,26 @@ export const postContext = async (authData, id, depth, direction, contextMapping
|
|
|
57
68
|
export const descendents = async (authData, post, depth, contextMapping) => postContext(authData, post.id, depth, 'descendents', contextMapping);
|
|
58
69
|
export const ancestors = async (authData, post, depth, contextMapping) => postContext(authData, post.id, depth, 'ancestors', contextMapping);
|
|
59
70
|
export const replies = async (authData, post) => descendents(authData, post, 1);
|
|
60
|
-
export const baseListPosts = ({ start, profile, }) => addStart(postsMappingForProfile(profile), start);
|
|
71
|
+
export const baseListPosts = ({ start, profile, }) => addStart(postsMappingForProfile(profile), start).filter(postFilters.notCreatorIn(blockedPairIds(profile)));
|
|
61
72
|
export const baseFeed = ({ start, sort, profile, }) => addQuerySort(baseListPosts({ start, profile }).filter(postFilters.notDirect()), sort);
|
|
73
|
+
/**
|
|
74
|
+
* Community / my / group timelines: original posts (and reposts) only,
|
|
75
|
+
* ordered by last conversation activity. Replies stay nested on the post
|
|
76
|
+
* detail thread so the same conversation is not repeated as standalone
|
|
77
|
+
* feed items.
|
|
78
|
+
*/
|
|
79
|
+
const timelineFeed = ({ start, sort, profile, }) => addQuerySort(addActivityStart(postsMappingForProfile(profile)
|
|
80
|
+
.filter(postFilters.notDirect())
|
|
81
|
+
.filter(postFilters.notReply())
|
|
82
|
+
.filter(postFilters.notCreatorIn(blockedPairIds(profile))), start), sort);
|
|
83
|
+
const conversationFeed = ({ start, sort, profile, format, }) => parseFeedFormat(format) === 'linear'
|
|
84
|
+
? baseFeed({ start, sort, profile })
|
|
85
|
+
: timelineFeed({ start, sort, profile });
|
|
62
86
|
export const baseEventsFeed = (profile) => {
|
|
63
87
|
const mapping = postsMappingForProfile(profile)
|
|
64
88
|
.sort(sorts.eventStartAsc)
|
|
65
|
-
.filter({ matches: { type: 'event' } })
|
|
89
|
+
.filter({ matches: { type: 'event' } })
|
|
90
|
+
.filter(postFilters.notCreatorIn(blockedPairIds(profile)));
|
|
66
91
|
return mapping;
|
|
67
92
|
};
|
|
68
93
|
export const listPosts = async (authData, { start, limit = 100, filter, } = {
|
|
@@ -78,7 +103,7 @@ export const listConversationLeaves = async (authData) => withSpan('conversation
|
|
|
78
103
|
.sort(sorts.createdAtDesc)
|
|
79
104
|
.data(),
|
|
80
105
|
}), { authData, limit: 9999 }));
|
|
81
|
-
export const listPostsByProfile = async (authData, requestedProfile, { start, limit = 100, filter, } = {
|
|
106
|
+
export const listPostsByProfile = async (authData, requestedProfile, { start, limit = 100, filter, format, } = {
|
|
82
107
|
limit: 100,
|
|
83
108
|
}) => toFilteredPostsList(profilesMapping.relationsFrom(requestedProfile, {
|
|
84
109
|
alias: 'posts',
|
|
@@ -87,11 +112,15 @@ export const listPostsByProfile = async (authData, requestedProfile, { start, li
|
|
|
87
112
|
edgeFilter: edgeFilters.entryType('create'),
|
|
88
113
|
skipEdge: true,
|
|
89
114
|
cardinality: 'many',
|
|
90
|
-
mapping:
|
|
115
|
+
mapping: conversationFeed({
|
|
116
|
+
start,
|
|
117
|
+
profile: authData.profile,
|
|
118
|
+
format,
|
|
119
|
+
})
|
|
91
120
|
.filter(filter)
|
|
92
121
|
.data(),
|
|
93
122
|
}), { authData, limit });
|
|
94
|
-
export const listBookmarkedPosts = async (authData, requestedProfile, { start, limit = 100, filter, } = {
|
|
123
|
+
export const listBookmarkedPosts = async (authData, requestedProfile, { start, limit = 100, filter, format, } = {
|
|
95
124
|
limit: 100,
|
|
96
125
|
}) => toFilteredPostsList(profilesMapping.relationsFrom(requestedProfile, {
|
|
97
126
|
alias: 'posts',
|
|
@@ -99,7 +128,11 @@ export const listBookmarkedPosts = async (authData, requestedProfile, { start, l
|
|
|
99
128
|
direction: 'OUTBOUND',
|
|
100
129
|
skipEdge: true,
|
|
101
130
|
cardinality: 'many',
|
|
102
|
-
mapping:
|
|
131
|
+
mapping: conversationFeed({
|
|
132
|
+
start,
|
|
133
|
+
profile: authData.profile,
|
|
134
|
+
format,
|
|
135
|
+
})
|
|
103
136
|
.filter(filter)
|
|
104
137
|
.data(),
|
|
105
138
|
}), { authData, limit });
|
|
@@ -125,12 +158,12 @@ export const getUnseenPostCounts = async (authData) => withSpan('unseen.counts',
|
|
|
125
158
|
const { db } = await allpeepDb();
|
|
126
159
|
return queryUnseenPostCounts(db, profile.id, groupIds);
|
|
127
160
|
});
|
|
128
|
-
export const listPostsByType = async (authData, type, { start, limit = 100, filter, } = {
|
|
161
|
+
export const listPostsByType = async (authData, type, { start, limit = 100, filter, format, } = {
|
|
129
162
|
limit: 100,
|
|
130
|
-
}) => toFilteredPostsList(
|
|
163
|
+
}) => toFilteredPostsList(conversationFeed({ start, profile: authData.profile, format })
|
|
131
164
|
.filter(filter)
|
|
132
165
|
.filter({ matches: { type } }), { authData, limit });
|
|
133
|
-
export const listPostsByTag = async (authData, tag, { start, limit = 100, filter, } = {
|
|
166
|
+
export const listPostsByTag = async (authData, tag, { start, limit = 100, filter, format, } = {
|
|
134
167
|
limit: 100,
|
|
135
168
|
}) => {
|
|
136
169
|
const hashtag = await findHashtagByTag(tag);
|
|
@@ -143,12 +176,16 @@ export const listPostsByTag = async (authData, tag, { start, limit = 100, filter
|
|
|
143
176
|
direction: 'INBOUND',
|
|
144
177
|
cardinality: 'many',
|
|
145
178
|
skipEdge: true,
|
|
146
|
-
mapping:
|
|
179
|
+
mapping: conversationFeed({
|
|
180
|
+
start,
|
|
181
|
+
profile: authData.profile,
|
|
182
|
+
format,
|
|
183
|
+
})
|
|
147
184
|
.filter(filter)
|
|
148
185
|
.data(),
|
|
149
186
|
}), { authData, limit });
|
|
150
187
|
};
|
|
151
|
-
export const listPostsByGroup = async (authData, groupId, { start, limit = 100, filter, sort
|
|
188
|
+
export const listPostsByGroup = async (authData, groupId, { start, limit = 100, filter, sort, format, } = { limit: 100 }) => withSpan('feed.group', async () => {
|
|
152
189
|
const group = await findGroup(groupId);
|
|
153
190
|
if (!group) {
|
|
154
191
|
return [];
|
|
@@ -159,87 +196,81 @@ export const listPostsByGroup = async (authData, groupId, { start, limit = 100,
|
|
|
159
196
|
direction: 'INBOUND',
|
|
160
197
|
skipEdge: true,
|
|
161
198
|
cardinality: 'many',
|
|
162
|
-
mapping:
|
|
199
|
+
mapping: conversationFeed({
|
|
200
|
+
start,
|
|
201
|
+
profile: authData.profile,
|
|
202
|
+
format,
|
|
203
|
+
sort,
|
|
204
|
+
})
|
|
163
205
|
.filter(filter)
|
|
164
206
|
.data(),
|
|
165
207
|
}), { authData, limit });
|
|
166
208
|
});
|
|
167
|
-
export const listLocalFeed = async (authData, { start, limit = 100
|
|
168
|
-
|
|
209
|
+
export const listLocalFeed = async (authData, { start, limit = 100, format, } = {
|
|
210
|
+
limit: 100,
|
|
211
|
+
}) => withSpan('feed.local', () => toFilteredPostsList(conversationFeed({
|
|
212
|
+
start,
|
|
213
|
+
profile: authData.profile,
|
|
214
|
+
format,
|
|
215
|
+
}).filter(localFeedFilter()), { authData, limit }));
|
|
216
|
+
export const listMyFeed = async (authData, { start, limit = 100, format, } = {
|
|
217
|
+
limit: 100,
|
|
218
|
+
}) => {
|
|
169
219
|
const profile = requireProfile(authData);
|
|
170
|
-
return withSpan('feed.my', () => toFilteredPostsList(
|
|
220
|
+
return withSpan('feed.my', () => toFilteredPostsList(conversationFeed({ start, profile, format }).filter(myFeedFilter(profile)), { authData, limit, filters: [myFeedGroupMembershipFilter(profile)] }));
|
|
171
221
|
};
|
|
172
|
-
export const listUpcomingEventsFeed = async (authData, { offset, limit = 100,
|
|
222
|
+
export const listUpcomingEventsFeed = async (authData, { offset, limit = 100, jamOnly, mine, } = {
|
|
173
223
|
limit: 100,
|
|
174
|
-
}) =>
|
|
175
|
-
|
|
176
|
-
.filter(filter), { authData, limit, offset });
|
|
177
|
-
export const listCurrentEventsFeed = async (authData, { offset, limit = 100, filter, } = {
|
|
224
|
+
}) => listEventAgenda(authData, 'upcoming', { offset, limit, jamOnly, mine });
|
|
225
|
+
export const listCurrentEventsFeed = async (authData, { offset, limit = 100, jamOnly, mine, } = {
|
|
178
226
|
limit: 100,
|
|
179
|
-
}) =>
|
|
180
|
-
|
|
181
|
-
.filter(filter), { authData, limit, offset });
|
|
182
|
-
export const listPastEventsFeed = async (authData, { offset, limit = 100, filter, } = {
|
|
227
|
+
}) => listEventAgenda(authData, 'current', { offset, limit, jamOnly, mine });
|
|
228
|
+
export const listPastEventsFeed = async (authData, { offset, limit = 100, jamOnly, mine, } = {
|
|
183
229
|
limit: 100,
|
|
184
|
-
}) =>
|
|
185
|
-
.sort(sorts.eventStartDesc)
|
|
186
|
-
.filter(pastEventsFilter())
|
|
187
|
-
.filter(filter), { authData, limit, offset });
|
|
230
|
+
}) => listEventAgenda(authData, 'past', { offset, limit, jamOnly, mine });
|
|
188
231
|
export const listMyUpcomingEventsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, {
|
|
189
232
|
offset,
|
|
190
|
-
|
|
233
|
+
mine: true,
|
|
191
234
|
limit,
|
|
192
235
|
});
|
|
193
236
|
export const listMyCurrentEventsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listCurrentEventsFeed(authData, {
|
|
194
237
|
offset,
|
|
195
|
-
|
|
238
|
+
mine: true,
|
|
196
239
|
limit,
|
|
197
240
|
});
|
|
198
241
|
export const listMyPastEventsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, {
|
|
199
242
|
offset,
|
|
200
|
-
|
|
243
|
+
mine: true,
|
|
201
244
|
limit,
|
|
202
245
|
});
|
|
203
|
-
export const listUpcomingJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, { offset,
|
|
204
|
-
export const listPastJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, { offset,
|
|
246
|
+
export const listUpcomingJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, { offset, jamOnly: true, limit });
|
|
247
|
+
export const listPastJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, { offset, jamOnly: true, limit });
|
|
205
248
|
export const listMyPastJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, {
|
|
206
249
|
offset,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
predicates: [myEventsFilter(requireProfile(authData)), jamFilter],
|
|
210
|
-
},
|
|
250
|
+
jamOnly: true,
|
|
251
|
+
mine: true,
|
|
211
252
|
limit,
|
|
212
253
|
});
|
|
213
254
|
export const listMyUpcomingJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, {
|
|
214
255
|
offset,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
predicates: [myEventsFilter(requireProfile(authData)), jamFilter],
|
|
218
|
-
},
|
|
256
|
+
jamOnly: true,
|
|
257
|
+
mine: true,
|
|
219
258
|
limit,
|
|
220
259
|
});
|
|
221
|
-
const
|
|
260
|
+
export const listUpcomingGroupEventsFeed = async (authData, groupId, { offset, limit = 100 } = { limit: 100 }) => {
|
|
222
261
|
const group = await findGroup(groupId);
|
|
223
262
|
if (!group) {
|
|
224
263
|
throw new Error(`Group ${groupId} not found`);
|
|
225
264
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
});
|
|
265
|
+
return listEventAgenda(authData, 'upcoming', { offset, limit, groupId });
|
|
266
|
+
};
|
|
267
|
+
export const listPastGroupEventsFeed = async (authData, groupId, { offset, limit = 100 } = { limit: 100 }) => {
|
|
268
|
+
const group = await findGroup(groupId);
|
|
269
|
+
if (!group) {
|
|
270
|
+
throw new Error(`Group ${groupId} not found`);
|
|
271
|
+
}
|
|
272
|
+
return listEventAgenda(authData, 'past', { offset, limit, groupId });
|
|
235
273
|
};
|
|
236
|
-
export const listUpcomingGroupEventsFeed = async (authData, groupId, { offset, limit = 100 } = { limit: 100 }) => toFilteredPostsList(await baseGroupEventsFeed(authData, groupId, {
|
|
237
|
-
filter: upcomingEventsFilter(),
|
|
238
|
-
}), { authData, limit, offset });
|
|
239
|
-
export const listPastGroupEventsFeed = async (authData, groupId, { offset, limit = 100 } = { limit: 100 }) => toFilteredPostsList(await baseGroupEventsFeed(authData, groupId, {
|
|
240
|
-
filter: pastEventsFilter(),
|
|
241
|
-
sort: sorts.eventStartDesc,
|
|
242
|
-
}), { authData, limit, offset });
|
|
243
274
|
export const reposts = async (post, authData) => toFilteredPostsList(postsMappingForProfile(authData.profile).relationsFrom(post, repostsOfPostRelationForProfile(authData.profile)), { authData });
|
|
244
275
|
export const getConversationByEnd = async (post, authData) => ancestors(authData, post, 9999, sortOldestFirst(postsMappingForProfile(authData.profile))).then((conversation) => [...conversation, post]);
|
|
245
276
|
export const getConversationByStart = async (post, authData) => getConversationThread(post, authData);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { postWithMetaSchema, } from '@openpeepshq/common/types';
|
|
2
2
|
import { combine, eventTimeFilters, postFilters } from '../../db/pg/filters/index.js';
|
|
3
|
-
import { checkCapabilities, getPostCapabilities } from '@openpeepshq/common/lib';
|
|
3
|
+
import { checkCapabilities, getPostCapabilities, } from '@openpeepshq/common/lib';
|
|
4
4
|
export const ownPostsFilter = (profile) => ({
|
|
5
5
|
matches: {
|
|
6
6
|
creatorId: profile.id,
|
|
@@ -15,14 +15,19 @@ export const followFilter = (profile) => ({
|
|
|
15
15
|
creatorId: f.id,
|
|
16
16
|
})),
|
|
17
17
|
});
|
|
18
|
-
export const myFeedFilter = (profile) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
export const myFeedFilter = (profile) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const hashtagFilterResult = postFilters.hasAnyHashtag((_b = (_a = profile.followedHashtags) === null || _a === void 0 ? void 0 : _a.map((h) => h.id)) !== null && _b !== void 0 ? _b : []);
|
|
21
|
+
return {
|
|
22
|
+
operator: '||',
|
|
23
|
+
predicates: [
|
|
24
|
+
ownPostsFilter(profile),
|
|
25
|
+
groupPostVisibilityQueryFilter,
|
|
26
|
+
followFilter(profile),
|
|
27
|
+
...(hashtagFilterResult ? [hashtagFilterResult] : []),
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
};
|
|
26
31
|
export const myFeedGroupMembershipFilter = (profile) => (post) => post.visibility !== 'group' ||
|
|
27
32
|
(!!post.group &&
|
|
28
33
|
profile.memberships.some((m) => { var _a; return m.group.id === ((_a = post.group) === null || _a === void 0 ? void 0 : _a.id); }));
|