@openpeepshq/core 0.1.31
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/LICENSE +674 -0
- package/dist/accessTokens/finders.d.ts +11 -0
- package/dist/accessTokens/finders.js +43 -0
- package/dist/accessTokens/helpers.d.ts +13 -0
- package/dist/accessTokens/helpers.js +15 -0
- package/dist/accessTokens/index.d.ts +4 -0
- package/dist/accessTokens/index.js +4 -0
- package/dist/accessTokens/mapping.d.ts +10 -0
- package/dist/accessTokens/mapping.js +25 -0
- package/dist/accessTokens/mutations.d.ts +4 -0
- package/dist/accessTokens/mutations.js +24 -0
- package/dist/accessTokens/revokations.d.ts +2 -0
- package/dist/accessTokens/revokations.js +18 -0
- package/dist/accessTokens/tokens.d.ts +31 -0
- package/dist/accessTokens/tokens.js +174 -0
- package/dist/accounts/cache.d.ts +3 -0
- package/dist/accounts/cache.js +13 -0
- package/dist/accounts/finders.d.ts +6 -0
- package/dist/accounts/finders.js +17 -0
- package/dist/accounts/helpers.d.ts +7 -0
- package/dist/accounts/helpers.js +36 -0
- package/dist/accounts/index.d.ts +6 -0
- package/dist/accounts/index.js +6 -0
- package/dist/accounts/mapping.d.ts +10 -0
- package/dist/accounts/mapping.js +28 -0
- package/dist/accounts/mutations.d.ts +21 -0
- package/dist/accounts/mutations.js +204 -0
- package/dist/analytics/cache.d.ts +6 -0
- package/dist/analytics/cache.js +29 -0
- package/dist/analytics/compile.d.ts +4 -0
- package/dist/analytics/compile.js +296 -0
- package/dist/analytics/dateRange.d.ts +39 -0
- package/dist/analytics/dateRange.js +181 -0
- package/dist/analytics/index.d.ts +8 -0
- package/dist/analytics/index.js +8 -0
- package/dist/analytics/jobs.d.ts +20 -0
- package/dist/analytics/jobs.js +84 -0
- package/dist/analytics/metrics.d.ts +4 -0
- package/dist/analytics/metrics.js +13 -0
- package/dist/analytics/pdfReport.d.ts +8 -0
- package/dist/analytics/pdfReport.js +821 -0
- package/dist/analytics/read.d.ts +6 -0
- package/dist/analytics/read.js +696 -0
- package/dist/analytics/report.d.ts +293 -0
- package/dist/analytics/report.js +153 -0
- package/dist/analytics/settings.d.ts +3 -0
- package/dist/analytics/settings.js +37 -0
- package/dist/backups/index.d.ts +5 -0
- package/dist/backups/index.js +260 -0
- package/dist/backups/metadata.d.ts +9 -0
- package/dist/backups/metadata.js +2 -0
- package/dist/config/db.d.ts +7 -0
- package/dist/config/db.js +26 -0
- package/dist/config/defaults/capabilities.d.ts +2 -0
- package/dist/config/defaults/capabilities.js +47 -0
- package/dist/config/defaults/community.d.ts +2 -0
- package/dist/config/defaults/community.js +41 -0
- package/dist/config/defaults/core.d.ts +2 -0
- package/dist/config/defaults/core.js +113 -0
- package/dist/config/defaults/db.d.ts +6 -0
- package/dist/config/defaults/db.js +8 -0
- package/dist/config/defaults/logs.d.ts +6 -0
- package/dist/config/defaults/logs.js +7 -0
- package/dist/config/defaults/redis.d.ts +4 -0
- package/dist/config/defaults/redis.js +5 -0
- package/dist/config/helpers.d.ts +11 -0
- package/dist/config/helpers.js +31 -0
- package/dist/config/index.d.ts +392 -0
- package/dist/config/index.js +83 -0
- package/dist/config/pruneEmptyConfigStrings.d.ts +7 -0
- package/dist/config/pruneEmptyConfigStrings.js +29 -0
- package/dist/db/aql.d.ts +0 -0
- package/dist/db/aql.js +1 -0
- package/dist/db/arango.d.ts +2 -0
- package/dist/db/arango.js +110 -0
- package/dist/db/bootMigrate.d.ts +1 -0
- package/dist/db/bootMigrate.js +15 -0
- package/dist/db/examples.d.ts +1 -0
- package/dist/db/examples.js +13 -0
- package/dist/db/explorer/csv.d.ts +1 -0
- package/dist/db/explorer/csv.js +18 -0
- package/dist/db/explorer/index.d.ts +6 -0
- package/dist/db/explorer/index.js +5 -0
- package/dist/db/explorer/mutate.d.ts +6 -0
- package/dist/db/explorer/mutate.js +66 -0
- package/dist/db/explorer/query.d.ts +17 -0
- package/dist/db/explorer/query.js +48 -0
- package/dist/db/explorer/sql.d.ts +11 -0
- package/dist/db/explorer/sql.js +42 -0
- package/dist/db/explorer/tables.d.ts +9 -0
- package/dist/db/explorer/tables.js +65 -0
- package/dist/db/helpers.d.ts +64 -0
- package/dist/db/helpers.js +240 -0
- package/dist/db/index.d.ts +13 -0
- package/dist/db/index.js +15 -0
- package/dist/db/init.d.ts +2 -0
- package/dist/db/init.js +10 -0
- package/dist/db/migration/autoMigrate.d.ts +2 -0
- package/dist/db/migration/autoMigrate.js +111 -0
- package/dist/db/migration/cli.d.ts +1 -0
- package/dist/db/migration/cli.js +56 -0
- package/dist/db/migration/detect.d.ts +6 -0
- package/dist/db/migration/detect.js +87 -0
- package/dist/db/migration/exportArango.d.ts +4 -0
- package/dist/db/migration/exportArango.js +80 -0
- package/dist/db/migration/importCollections.d.ts +19 -0
- package/dist/db/migration/importCollections.js +280 -0
- package/dist/db/migration/importPostgres.d.ts +3 -0
- package/dist/db/migration/importPostgres.js +18 -0
- package/dist/db/migration/shared.d.ts +39 -0
- package/dist/db/migration/shared.js +158 -0
- package/dist/db/migration/transform.d.ts +18 -0
- package/dist/db/migration/transform.js +209 -0
- package/dist/db/migration/validate.d.ts +18 -0
- package/dist/db/migration/validate.js +69 -0
- package/dist/db/pg/client.d.ts +35 -0
- package/dist/db/pg/client.js +126 -0
- package/dist/db/pg/collections.d.ts +48 -0
- package/dist/db/pg/collections.js +53 -0
- package/dist/db/pg/filters/common.d.ts +21 -0
- package/dist/db/pg/filters/common.js +48 -0
- package/dist/db/pg/filters/edges.d.ts +9 -0
- package/dist/db/pg/filters/edges.js +10 -0
- package/dist/db/pg/filters/groups.d.ts +7 -0
- package/dist/db/pg/filters/groups.js +15 -0
- package/dist/db/pg/filters/index.d.ts +22 -0
- package/dist/db/pg/filters/index.js +35 -0
- package/dist/db/pg/filters/notifications.d.ts +6 -0
- package/dist/db/pg/filters/notifications.js +10 -0
- package/dist/db/pg/filters/posts.d.ts +18 -0
- package/dist/db/pg/filters/posts.js +25 -0
- package/dist/db/pg/filters/profiles.d.ts +6 -0
- package/dist/db/pg/filters/profiles.js +9 -0
- package/dist/db/pg/filters/types.d.ts +7 -0
- package/dist/db/pg/filters/types.js +5 -0
- package/dist/db/pg/helpers.d.ts +19 -0
- package/dist/db/pg/helpers.js +67 -0
- package/dist/db/pg/map/filters.d.ts +22 -0
- package/dist/db/pg/map/filters.js +566 -0
- package/dist/db/pg/map/helpers.d.ts +2 -0
- package/dist/db/pg/map/helpers.js +2 -0
- package/dist/db/pg/map/index.d.ts +46 -0
- package/dist/db/pg/map/index.js +93 -0
- package/dist/db/pg/map/mutations.d.ts +11 -0
- package/dist/db/pg/map/mutations.js +135 -0
- package/dist/db/pg/map/queryTypes.d.ts +115 -0
- package/dist/db/pg/map/queryTypes.js +1 -0
- package/dist/db/pg/map/registry.d.ts +29 -0
- package/dist/db/pg/map/registry.js +413 -0
- package/dist/db/pg/map/relations.d.ts +28 -0
- package/dist/db/pg/map/relations.js +399 -0
- package/dist/db/pg/map/search.d.ts +6 -0
- package/dist/db/pg/map/search.js +190 -0
- package/dist/db/pg/map/types.d.ts +11 -0
- package/dist/db/pg/map/types.js +1 -0
- package/dist/db/pg/mappers.d.ts +28 -0
- package/dist/db/pg/mappers.js +29 -0
- package/dist/db/pg/migrate.d.ts +14 -0
- package/dist/db/pg/migrate.js +134 -0
- package/dist/db/pg/queries/activity.d.ts +10 -0
- package/dist/db/pg/queries/activity.js +47 -0
- package/dist/db/pg/queries/computed.d.ts +7 -0
- package/dist/db/pg/queries/computed.js +19 -0
- package/dist/db/pg/queries/derived.d.ts +22 -0
- package/dist/db/pg/queries/derived.js +100 -0
- package/dist/db/pg/queries/index.d.ts +4 -0
- package/dist/db/pg/queries/index.js +4 -0
- package/dist/db/pg/queries/sorts.d.ts +10 -0
- package/dist/db/pg/queries/sorts.js +9 -0
- package/dist/db/pg/schema/analytics.d.ts +998 -0
- package/dist/db/pg/schema/analytics.js +110 -0
- package/dist/db/pg/schema/base.d.ts +36 -0
- package/dist/db/pg/schema/base.js +23 -0
- package/dist/db/pg/schema/documents.d.ts +2002 -0
- package/dist/db/pg/schema/documents.js +40 -0
- package/dist/db/pg/schema/edges.d.ts +2725 -0
- package/dist/db/pg/schema/edges.js +34 -0
- package/dist/db/pg/schema/index.d.ts +5724 -0
- package/dist/db/pg/schema/index.js +7 -0
- package/dist/db/pg/sql/0000_bizarre_chat.sql +456 -0
- package/dist/db/pg/sql/0001_search_vector.sql +122 -0
- package/dist/db/pg/sql/0002_data_migrations_id_text.sql +1 -0
- package/dist/db/pg/sql/0003_fix_group_post_visibility.sql +4 -0
- package/dist/db/pg/sql/0004_analytics.sql +90 -0
- package/dist/db/pg/sql/meta/0000_snapshot.json +3380 -0
- package/dist/db/pg/sql/meta/0004_snapshot.json +4114 -0
- package/dist/db/pg/sql/meta/_journal.json +41 -0
- package/dist/db/replaceHostname.d.ts +1 -0
- package/dist/db/replaceHostname.js +88 -0
- package/dist/db/types.d.ts +17 -0
- package/dist/db/types.js +1 -0
- package/dist/email/index.d.ts +9 -0
- package/dist/email/index.js +19 -0
- package/dist/email/jobs.d.ts +3 -0
- package/dist/email/jobs.js +13 -0
- package/dist/email/queueStats.d.ts +2 -0
- package/dist/email/queueStats.js +27 -0
- package/dist/email/registry.d.ts +3 -0
- package/dist/email/registry.js +4 -0
- package/dist/email/render.d.ts +8 -0
- package/dist/email/render.js +34 -0
- package/dist/email/send.d.ts +9 -0
- package/dist/email/send.js +97 -0
- package/dist/email/smtpTest.d.ts +2 -0
- package/dist/email/smtpTest.js +26 -0
- package/dist/errors/index.d.ts +8 -0
- package/dist/errors/index.js +13 -0
- package/dist/events/index.d.ts +31 -0
- package/dist/events/index.js +66 -0
- package/dist/events/once.d.ts +4 -0
- package/dist/events/once.js +23 -0
- package/dist/groups/finders.d.ts +125 -0
- package/dist/groups/finders.js +18 -0
- package/dist/groups/helpers.d.ts +227 -0
- package/dist/groups/helpers.js +17 -0
- package/dist/groups/index.d.ts +3 -0
- package/dist/groups/index.js +3 -0
- package/dist/groups/mapping.d.ts +188 -0
- package/dist/groups/mapping.js +47 -0
- package/dist/groups/mutations.d.ts +26 -0
- package/dist/groups/mutations.js +41 -0
- package/dist/hashtags/finders.d.ts +3 -0
- package/dist/hashtags/finders.js +22 -0
- package/dist/hashtags/index.d.ts +2 -0
- package/dist/hashtags/index.js +2 -0
- package/dist/hashtags/mapping.d.ts +4 -0
- package/dist/hashtags/mapping.js +5 -0
- package/dist/hashtags/mutations.d.ts +0 -0
- package/dist/hashtags/mutations.js +1 -0
- package/dist/i18n/index.d.ts +14 -0
- package/dist/i18n/index.js +53 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +1 -0
- package/dist/inviteLinks/finders.d.ts +3 -0
- package/dist/inviteLinks/finders.js +5 -0
- package/dist/inviteLinks/helpers.d.ts +20 -0
- package/dist/inviteLinks/helpers.js +4 -0
- package/dist/inviteLinks/index.d.ts +3 -0
- package/dist/inviteLinks/index.js +3 -0
- package/dist/inviteLinks/mapping.d.ts +10 -0
- package/dist/inviteLinks/mapping.js +35 -0
- package/dist/inviteLinks/mutations.d.ts +4 -0
- package/dist/inviteLinks/mutations.js +39 -0
- package/dist/jams/cache.d.ts +9 -0
- package/dist/jams/cache.js +13 -0
- package/dist/jams/finders.d.ts +23 -0
- package/dist/jams/finders.js +24 -0
- package/dist/jams/helpers.d.ts +70 -0
- package/dist/jams/helpers.js +29 -0
- package/dist/jams/index.d.ts +15 -0
- package/dist/jams/index.js +108 -0
- package/dist/jams/jobs.d.ts +9 -0
- package/dist/jams/jobs.js +42 -0
- package/dist/jams/livekit.d.ts +24 -0
- package/dist/jams/livekit.js +220 -0
- package/dist/jams/mapping.d.ts +137 -0
- package/dist/jams/mapping.js +35 -0
- package/dist/jams/mutations.d.ts +40 -0
- package/dist/jams/mutations.js +4 -0
- package/dist/jams/recording.d.ts +8 -0
- package/dist/jams/recording.js +67 -0
- package/dist/jams/recordingUploadAuth.d.ts +9 -0
- package/dist/jams/recordingUploadAuth.js +19 -0
- package/dist/jams/token.d.ts +4 -0
- package/dist/jams/token.js +129 -0
- package/dist/jams/waitingRoom.d.ts +5 -0
- package/dist/jams/waitingRoom.js +71 -0
- package/dist/jobs/index.d.ts +10 -0
- package/dist/jobs/index.js +60 -0
- package/dist/jobs/jobDetail.d.ts +2 -0
- package/dist/jobs/jobDetail.js +31 -0
- package/dist/jobs/jobLog.d.ts +18 -0
- package/dist/jobs/jobLog.js +61 -0
- package/dist/jwt/index.d.ts +10 -0
- package/dist/jwt/index.js +43 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/streams.d.ts +2 -0
- package/dist/lib/streams.js +56 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +17 -0
- package/dist/lib/zodDeepPartial.d.ts +3 -0
- package/dist/lib/zodDeepPartial.js +26 -0
- package/dist/location/index.d.ts +2 -0
- package/dist/location/index.js +28 -0
- package/dist/log/index.d.ts +3 -0
- package/dist/log/index.js +97 -0
- package/dist/mastodon/index.d.ts +4 -0
- package/dist/mastodon/index.js +51 -0
- package/dist/mastodon/types.d.ts +7579 -0
- package/dist/mastodon/types.js +523 -0
- package/dist/mastodon/typescript.d.ts +1578 -0
- package/dist/mastodon/typescript.js +1 -0
- package/dist/media/index.d.ts +40 -0
- package/dist/media/index.js +248 -0
- package/dist/media/ipfs/index.d.ts +0 -0
- package/dist/media/ipfs/index.js +39 -0
- package/dist/media/jobs.d.ts +19 -0
- package/dist/media/jobs.js +90 -0
- package/dist/media/openpeeps/index.d.ts +3 -0
- package/dist/media/openpeeps/index.js +131 -0
- package/dist/media/processing.d.ts +19 -0
- package/dist/media/processing.js +83 -0
- package/dist/media/streaming.d.ts +77 -0
- package/dist/media/streaming.js +257 -0
- package/dist/media/streamingCleanupJobs.d.ts +14 -0
- package/dist/media/streamingCleanupJobs.js +47 -0
- package/dist/media/streamingJobs.d.ts +5 -0
- package/dist/media/streamingJobs.js +329 -0
- package/dist/media/streamingPrewarm.d.ts +36 -0
- package/dist/media/streamingPrewarm.js +109 -0
- package/dist/mediaAttachments/finders.d.ts +1 -0
- package/dist/mediaAttachments/finders.js +3 -0
- package/dist/mediaAttachments/index.d.ts +5 -0
- package/dist/mediaAttachments/index.js +12 -0
- package/dist/mediaAttachments/mapping.d.ts +21 -0
- package/dist/mediaAttachments/mapping.js +4 -0
- package/dist/mediaAttachments/mutations.d.ts +3 -0
- package/dist/mediaAttachments/mutations.js +10 -0
- package/dist/notifications/defaultNotifications/announcement/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/announcement/index.js +42 -0
- package/dist/notifications/defaultNotifications/directMessage/index.d.ts +28 -0
- package/dist/notifications/defaultNotifications/directMessage/index.js +69 -0
- package/dist/notifications/defaultNotifications/follow/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/follow/index.js +31 -0
- package/dist/notifications/defaultNotifications/groupAdded/index.d.ts +18 -0
- package/dist/notifications/defaultNotifications/groupAdded/index.js +33 -0
- package/dist/notifications/defaultNotifications/groupMemberJoined/index.d.ts +18 -0
- package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +36 -0
- package/dist/notifications/defaultNotifications/groupMemberLeft/index.d.ts +18 -0
- package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +36 -0
- package/dist/notifications/defaultNotifications/index.d.ts +3 -0
- package/dist/notifications/defaultNotifications/index.js +43 -0
- package/dist/notifications/defaultNotifications/jamModerator/index.d.ts +23 -0
- package/dist/notifications/defaultNotifications/jamModerator/index.js +49 -0
- package/dist/notifications/defaultNotifications/jamSpeaker/index.d.ts +23 -0
- package/dist/notifications/defaultNotifications/jamSpeaker/index.js +47 -0
- package/dist/notifications/defaultNotifications/jamStarted/index.d.ts +18 -0
- package/dist/notifications/defaultNotifications/jamStarted/index.js +82 -0
- package/dist/notifications/defaultNotifications/mention/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/mention/index.js +89 -0
- package/dist/notifications/defaultNotifications/newGroupPost/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/newGroupPost/index.js +47 -0
- package/dist/notifications/defaultNotifications/newProfile/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/newProfile/index.js +40 -0
- package/dist/notifications/defaultNotifications/pollVote/index.d.ts +19 -0
- package/dist/notifications/defaultNotifications/pollVote/index.js +40 -0
- package/dist/notifications/defaultNotifications/reaction/index.d.ts +18 -0
- package/dist/notifications/defaultNotifications/reaction/index.js +43 -0
- package/dist/notifications/defaultNotifications/reply/index.d.ts +25 -0
- package/dist/notifications/defaultNotifications/reply/index.js +57 -0
- package/dist/notifications/defaultNotifications/repost/index.d.ts +18 -0
- package/dist/notifications/defaultNotifications/repost/index.js +42 -0
- package/dist/notifications/defaultNotifications/rsvp/index.d.ts +19 -0
- package/dist/notifications/defaultNotifications/rsvp/index.js +40 -0
- package/dist/notifications/fcmCredential.d.ts +14 -0
- package/dist/notifications/fcmCredential.js +68 -0
- package/dist/notifications/finders.d.ts +7 -0
- package/dist/notifications/finders.js +13 -0
- package/dist/notifications/firebase.d.ts +1 -0
- package/dist/notifications/firebase.js +33 -0
- package/dist/notifications/handlers.d.ts +3 -0
- package/dist/notifications/handlers.js +6 -0
- package/dist/notifications/helpers.d.ts +7 -0
- package/dist/notifications/helpers.js +31 -0
- package/dist/notifications/index.d.ts +9 -0
- package/dist/notifications/index.js +43 -0
- package/dist/notifications/jobs.d.ts +2 -0
- package/dist/notifications/jobs.js +75 -0
- package/dist/notifications/mapping.d.ts +25 -0
- package/dist/notifications/mapping.js +25 -0
- package/dist/notifications/mutations.d.ts +6 -0
- package/dist/notifications/mutations.js +40 -0
- package/dist/notifications/push.d.ts +9 -0
- package/dist/notifications/push.js +261 -0
- package/dist/notifications/pushInvalidation.d.ts +10 -0
- package/dist/notifications/pushInvalidation.js +10 -0
- package/dist/performance/index.d.ts +24 -0
- package/dist/performance/index.js +61 -0
- package/dist/plugins/helpers.d.ts +3 -0
- package/dist/plugins/helpers.js +72 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.js +84 -0
- package/dist/plugins/pluginAuth.d.ts +30 -0
- package/dist/plugins/pluginAuth.js +44 -0
- package/dist/posts/contextClosure.d.ts +16 -0
- package/dist/posts/contextClosure.js +66 -0
- package/dist/posts/finders.d.ts +298 -0
- package/dist/posts/finders.js +259 -0
- package/dist/posts/helpers/filters.d.ts +14 -0
- package/dist/posts/helpers/filters.js +39 -0
- package/dist/posts/helpers/index.d.ts +837 -0
- package/dist/posts/helpers/index.js +117 -0
- package/dist/posts/index.d.ts +6 -0
- package/dist/posts/index.js +6 -0
- package/dist/posts/mapping.d.ts +2187 -0
- package/dist/posts/mapping.js +222 -0
- package/dist/posts/mutations.d.ts +19 -0
- package/dist/posts/mutations.js +202 -0
- package/dist/posts/rsvpConfirmationEmail.d.ts +2 -0
- package/dist/posts/rsvpConfirmationEmail.js +82 -0
- package/dist/processingStats/index.d.ts +3 -0
- package/dist/processingStats/index.js +3 -0
- package/dist/processingStats/mapping.d.ts +7 -0
- package/dist/processingStats/mapping.js +4 -0
- package/dist/processingStats/mutations.d.ts +2 -0
- package/dist/processingStats/mutations.js +6 -0
- package/dist/processingStats/queries.d.ts +4 -0
- package/dist/processingStats/queries.js +46 -0
- package/dist/profileSettings/cache.d.ts +2 -0
- package/dist/profileSettings/cache.js +24 -0
- package/dist/profileSettings/finders.d.ts +1 -0
- package/dist/profileSettings/finders.js +2 -0
- package/dist/profileSettings/index.d.ts +3 -0
- package/dist/profileSettings/index.js +3 -0
- package/dist/profileSettings/mapping.d.ts +38 -0
- package/dist/profileSettings/mapping.js +5 -0
- package/dist/profileSettings/mutations.d.ts +3 -0
- package/dist/profileSettings/mutations.js +24 -0
- package/dist/profiles/cache.d.ts +5 -0
- package/dist/profiles/cache.js +19 -0
- package/dist/profiles/capacity.d.ts +2 -0
- package/dist/profiles/capacity.js +20 -0
- package/dist/profiles/export.d.ts +3 -0
- package/dist/profiles/export.js +85 -0
- package/dist/profiles/finders.d.ts +11 -0
- package/dist/profiles/finders.js +39 -0
- package/dist/profiles/helpers.d.ts +35 -0
- package/dist/profiles/helpers.js +10 -0
- package/dist/profiles/index.d.ts +5 -0
- package/dist/profiles/index.js +18 -0
- package/dist/profiles/mapping.d.ts +157 -0
- package/dist/profiles/mapping.js +132 -0
- package/dist/profiles/mutations.d.ts +9 -0
- package/dist/profiles/mutations.js +75 -0
- package/dist/pushSubscriptions/finders.d.ts +187 -0
- package/dist/pushSubscriptions/finders.js +6 -0
- package/dist/pushSubscriptions/helpers.d.ts +99 -0
- package/dist/pushSubscriptions/helpers.js +3 -0
- package/dist/pushSubscriptions/index.d.ts +3 -0
- package/dist/pushSubscriptions/index.js +3 -0
- package/dist/pushSubscriptions/mapping.d.ts +261 -0
- package/dist/pushSubscriptions/mapping.js +6 -0
- package/dist/pushSubscriptions/mutations.d.ts +95 -0
- package/dist/pushSubscriptions/mutations.js +21 -0
- package/dist/redis/connection.d.ts +4 -0
- package/dist/redis/connection.js +17 -0
- package/dist/redis/index.d.ts +1 -0
- package/dist/redis/index.js +1 -0
- package/dist/reports/finders.d.ts +6 -0
- package/dist/reports/finders.js +44 -0
- package/dist/reports/helpers.d.ts +21 -0
- package/dist/reports/helpers.js +12 -0
- package/dist/reports/index.d.ts +3 -0
- package/dist/reports/index.js +3 -0
- package/dist/reports/mapping.d.ts +9 -0
- package/dist/reports/mapping.js +34 -0
- package/dist/reports/mutations.d.ts +5 -0
- package/dist/reports/mutations.js +16 -0
- package/dist/roles/defaults.d.ts +2 -0
- package/dist/roles/defaults.js +94 -0
- package/dist/roles/finders.d.ts +5 -0
- package/dist/roles/finders.js +9 -0
- package/dist/roles/index.d.ts +4 -0
- package/dist/roles/index.js +4 -0
- package/dist/roles/mapping.d.ts +11 -0
- package/dist/roles/mapping.js +5 -0
- package/dist/roles/mutations.d.ts +4 -0
- package/dist/roles/mutations.js +30 -0
- package/dist/search/finders.d.ts +47 -0
- package/dist/search/finders.js +59 -0
- package/dist/search/helpers.d.ts +3 -0
- package/dist/search/helpers.js +1 -0
- package/dist/search/index.d.ts +1 -0
- package/dist/search/index.js +1 -0
- package/dist/search/mapping.d.ts +40 -0
- package/dist/search/mapping.js +43 -0
- package/dist/sentry/index.d.ts +34 -0
- package/dist/sentry/index.js +113 -0
- package/dist/server/helpers.d.ts +0 -0
- package/dist/server/helpers.js +1 -0
- package/dist/server/index.d.ts +105 -0
- package/dist/server/index.js +64 -0
- package/dist/stats/finders.d.ts +16156 -0
- package/dist/stats/finders.js +167 -0
- package/dist/stats/helpers.d.ts +17 -0
- package/dist/stats/helpers.js +34 -0
- package/dist/stats/index.d.ts +1 -0
- package/dist/stats/index.js +1 -0
- package/dist/stats/mapping.d.ts +188 -0
- package/dist/stats/mapping.js +19 -0
- package/dist/stripe/cache.d.ts +30 -0
- package/dist/stripe/cache.js +37 -0
- package/dist/stripe/connection.d.ts +5 -0
- package/dist/stripe/connection.js +23 -0
- package/dist/stripe/helpers.d.ts +25 -0
- package/dist/stripe/helpers.js +211 -0
- package/dist/stripe/index.d.ts +3 -0
- package/dist/stripe/index.js +3 -0
- package/package.json +99 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { AuthorizationData, PostWithMeta, Post, PostType, Profile, DbPost, DbBasePost, UnseenPostCounts } from '@openpeepshq/common/types';
|
|
2
|
+
import { ProfileWithMeta } from '@openpeepshq/common/types';
|
|
3
|
+
import type { Mapping, ObjectSort, PgFilter } from '../db/pg/map';
|
|
4
|
+
export declare const findPost: (id: string, authData?: AuthorizationData) => Promise<PostWithMeta | undefined>;
|
|
5
|
+
export declare const postContext: (authData: AuthorizationData, id: string, depth: number, direction: "ancestors" | "descendents", contextMapping?: Mapping<DbPost>) => Promise<PostWithMeta[]>;
|
|
6
|
+
export declare const descendents: (authData: AuthorizationData, post: PostWithMeta, depth: number, contextMapping?: Mapping<DbPost>) => Promise<PostWithMeta[]>;
|
|
7
|
+
export declare const ancestors: (authData: AuthorizationData, post: PostWithMeta, depth: number, contextMapping?: Mapping<DbPost>) => Promise<PostWithMeta[]>;
|
|
8
|
+
export declare const replies: (authData: AuthorizationData, post: PostWithMeta) => Promise<PostWithMeta[]>;
|
|
9
|
+
export declare const baseListPosts: ({ start, profile, }: {
|
|
10
|
+
start?: string;
|
|
11
|
+
profile?: ProfileWithMeta;
|
|
12
|
+
}) => Mapping<DbPost>;
|
|
13
|
+
export declare const baseFeed: ({ start, sort, profile, }: {
|
|
14
|
+
start?: string;
|
|
15
|
+
sort?: ObjectSort;
|
|
16
|
+
profile?: ProfileWithMeta;
|
|
17
|
+
}) => Mapping<DbPost>;
|
|
18
|
+
export declare const baseEventsFeed: (profile?: ProfileWithMeta) => Mapping<{
|
|
19
|
+
type: "note" | "question" | "event" | "article";
|
|
20
|
+
visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
|
|
21
|
+
creatorId: string;
|
|
22
|
+
capabilitiesNeeded?: string[] | undefined;
|
|
23
|
+
data?: {
|
|
24
|
+
type: "note";
|
|
25
|
+
content?: string | undefined;
|
|
26
|
+
sensitive?: boolean | undefined;
|
|
27
|
+
spoilerText?: string | undefined;
|
|
28
|
+
attachments?: {
|
|
29
|
+
type: string;
|
|
30
|
+
url: string;
|
|
31
|
+
previewUrl: string | null;
|
|
32
|
+
textUrl: null;
|
|
33
|
+
filename: string;
|
|
34
|
+
meta: {
|
|
35
|
+
usage?: string | undefined;
|
|
36
|
+
focus?: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
} | undefined;
|
|
40
|
+
mimetype?: string | undefined;
|
|
41
|
+
size?: number | undefined;
|
|
42
|
+
};
|
|
43
|
+
description?: string | undefined;
|
|
44
|
+
blurhash?: string | undefined;
|
|
45
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
46
|
+
error?: string | undefined;
|
|
47
|
+
}[] | undefined;
|
|
48
|
+
customEmojis?: {
|
|
49
|
+
shortcode: string;
|
|
50
|
+
url: string;
|
|
51
|
+
staticUrl: string;
|
|
52
|
+
visibleInPicker: boolean;
|
|
53
|
+
category: string;
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
language?: string | undefined;
|
|
56
|
+
} | {
|
|
57
|
+
type: "question";
|
|
58
|
+
options: {
|
|
59
|
+
content: string;
|
|
60
|
+
type: "note";
|
|
61
|
+
}[];
|
|
62
|
+
content?: string | undefined;
|
|
63
|
+
sensitive?: boolean | undefined;
|
|
64
|
+
spoilerText?: string | undefined;
|
|
65
|
+
attachments?: {
|
|
66
|
+
type: string;
|
|
67
|
+
url: string;
|
|
68
|
+
previewUrl: string | null;
|
|
69
|
+
textUrl: null;
|
|
70
|
+
filename: string;
|
|
71
|
+
meta: {
|
|
72
|
+
usage?: string | undefined;
|
|
73
|
+
focus?: {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
} | undefined;
|
|
77
|
+
mimetype?: string | undefined;
|
|
78
|
+
size?: number | undefined;
|
|
79
|
+
};
|
|
80
|
+
description?: string | undefined;
|
|
81
|
+
blurhash?: string | undefined;
|
|
82
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
83
|
+
error?: string | undefined;
|
|
84
|
+
}[] | undefined;
|
|
85
|
+
customEmojis?: {
|
|
86
|
+
shortcode: string;
|
|
87
|
+
url: string;
|
|
88
|
+
staticUrl: string;
|
|
89
|
+
visibleInPicker: boolean;
|
|
90
|
+
category: string;
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
language?: string | undefined;
|
|
93
|
+
multiple?: boolean | undefined;
|
|
94
|
+
votersVisible?: boolean | undefined;
|
|
95
|
+
expiresAt?: string | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
type: "event";
|
|
98
|
+
start: string;
|
|
99
|
+
wholeDay: boolean;
|
|
100
|
+
content?: string | undefined;
|
|
101
|
+
sensitive?: boolean | undefined;
|
|
102
|
+
spoilerText?: string | undefined;
|
|
103
|
+
attachments?: {
|
|
104
|
+
type: string;
|
|
105
|
+
url: string;
|
|
106
|
+
previewUrl: string | null;
|
|
107
|
+
textUrl: null;
|
|
108
|
+
filename: string;
|
|
109
|
+
meta: {
|
|
110
|
+
usage?: string | undefined;
|
|
111
|
+
focus?: {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
} | undefined;
|
|
115
|
+
mimetype?: string | undefined;
|
|
116
|
+
size?: number | undefined;
|
|
117
|
+
};
|
|
118
|
+
description?: string | undefined;
|
|
119
|
+
blurhash?: string | undefined;
|
|
120
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
121
|
+
error?: string | undefined;
|
|
122
|
+
}[] | undefined;
|
|
123
|
+
customEmojis?: {
|
|
124
|
+
shortcode: string;
|
|
125
|
+
url: string;
|
|
126
|
+
staticUrl: string;
|
|
127
|
+
visibleInPicker: boolean;
|
|
128
|
+
category: string;
|
|
129
|
+
}[] | undefined;
|
|
130
|
+
language?: string | undefined;
|
|
131
|
+
name?: string | undefined;
|
|
132
|
+
timeZone?: string | undefined;
|
|
133
|
+
image?: string | undefined;
|
|
134
|
+
end?: string | undefined;
|
|
135
|
+
maxAttendees?: number | undefined;
|
|
136
|
+
attendeeListPublic?: boolean | undefined;
|
|
137
|
+
moderators?: string[] | undefined;
|
|
138
|
+
jam?: {
|
|
139
|
+
moderators: string[];
|
|
140
|
+
videoEnabled: boolean;
|
|
141
|
+
type: "video-call";
|
|
142
|
+
speakers?: string[] | undefined;
|
|
143
|
+
presenters?: string[] | undefined;
|
|
144
|
+
audience?: string[] | undefined;
|
|
145
|
+
maxSpeakers?: number | undefined;
|
|
146
|
+
maxPresenters?: number | undefined;
|
|
147
|
+
maxAudience?: number | undefined;
|
|
148
|
+
waitingRoom?: boolean | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
physicalLocation?: {
|
|
151
|
+
text: string;
|
|
152
|
+
coordinates?: {
|
|
153
|
+
lat: number;
|
|
154
|
+
lng: number;
|
|
155
|
+
alt?: number | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
} | undefined;
|
|
158
|
+
url?: string | undefined;
|
|
159
|
+
} | {
|
|
160
|
+
type: "article";
|
|
161
|
+
content?: string | undefined;
|
|
162
|
+
sensitive?: boolean | undefined;
|
|
163
|
+
spoilerText?: string | undefined;
|
|
164
|
+
attachments?: {
|
|
165
|
+
type: string;
|
|
166
|
+
url: string;
|
|
167
|
+
previewUrl: string | null;
|
|
168
|
+
textUrl: null;
|
|
169
|
+
filename: string;
|
|
170
|
+
meta: {
|
|
171
|
+
usage?: string | undefined;
|
|
172
|
+
focus?: {
|
|
173
|
+
x: number;
|
|
174
|
+
y: number;
|
|
175
|
+
} | undefined;
|
|
176
|
+
mimetype?: string | undefined;
|
|
177
|
+
size?: number | undefined;
|
|
178
|
+
};
|
|
179
|
+
description?: string | undefined;
|
|
180
|
+
blurhash?: string | undefined;
|
|
181
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
182
|
+
error?: string | undefined;
|
|
183
|
+
}[] | undefined;
|
|
184
|
+
customEmojis?: {
|
|
185
|
+
shortcode: string;
|
|
186
|
+
url: string;
|
|
187
|
+
staticUrl: string;
|
|
188
|
+
visibleInPicker: boolean;
|
|
189
|
+
category: string;
|
|
190
|
+
}[] | undefined;
|
|
191
|
+
language?: string | undefined;
|
|
192
|
+
image?: string | undefined;
|
|
193
|
+
title?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
}, DbPost, DbPost>;
|
|
196
|
+
export declare const listPosts: (authData: AuthorizationData, { start, limit, filter, }?: {
|
|
197
|
+
start?: string;
|
|
198
|
+
limit?: number;
|
|
199
|
+
filter?: PgFilter<DbBasePost>;
|
|
200
|
+
}) => Promise<PostWithMeta[]>;
|
|
201
|
+
export declare const listConversationLeaves: (authData: AuthorizationData) => Promise<PostWithMeta[]>;
|
|
202
|
+
export declare const listPostsByProfile: (authData: AuthorizationData, requestedProfile: ProfileWithMeta, { start, limit, filter, }?: {
|
|
203
|
+
start?: string;
|
|
204
|
+
limit?: number;
|
|
205
|
+
filter?: PgFilter<DbBasePost>;
|
|
206
|
+
}) => Promise<PostWithMeta[]>;
|
|
207
|
+
export declare const listBookmarkedPosts: (authData: AuthorizationData, requestedProfile: ProfileWithMeta, { start, limit, filter, }?: {
|
|
208
|
+
start?: string;
|
|
209
|
+
limit?: number;
|
|
210
|
+
filter?: PgFilter<DbBasePost>;
|
|
211
|
+
}) => Promise<PostWithMeta[]>;
|
|
212
|
+
export declare const listBookmarkedPostIds: (requestedProfile: ProfileWithMeta) => Promise<string[]>;
|
|
213
|
+
export declare const getUnseenPostCounts: (authData: AuthorizationData) => Promise<UnseenPostCounts>;
|
|
214
|
+
export declare const listPostsByType: (authData: AuthorizationData, type: PostType, { start, limit, filter, }?: {
|
|
215
|
+
start?: string;
|
|
216
|
+
limit?: number;
|
|
217
|
+
filter?: PgFilter<DbBasePost>;
|
|
218
|
+
}) => Promise<PostWithMeta[]>;
|
|
219
|
+
export declare const listPostsByTag: (authData: AuthorizationData, tag: string, { start, limit, filter, }?: {
|
|
220
|
+
start?: string;
|
|
221
|
+
limit?: number;
|
|
222
|
+
filter?: PgFilter<DbBasePost>;
|
|
223
|
+
}) => Promise<PostWithMeta[]>;
|
|
224
|
+
export declare const listPostsByGroup: (authData: AuthorizationData, groupId: string, { start, limit, filter, sort: _sort, }?: {
|
|
225
|
+
start?: string;
|
|
226
|
+
limit?: number;
|
|
227
|
+
filter?: PgFilter<DbBasePost>;
|
|
228
|
+
sort?: ObjectSort;
|
|
229
|
+
}) => Promise<PostWithMeta[]>;
|
|
230
|
+
export declare const listLocalFeed: (authData: AuthorizationData, { start, limit }?: {
|
|
231
|
+
start?: string;
|
|
232
|
+
limit?: number;
|
|
233
|
+
}) => Promise<PostWithMeta[]>;
|
|
234
|
+
export declare const listMyFeed: (authData: AuthorizationData, { start, limit }?: {
|
|
235
|
+
start?: string;
|
|
236
|
+
limit?: number;
|
|
237
|
+
}) => Promise<PostWithMeta[]>;
|
|
238
|
+
export declare const listUpcomingEventsFeed: (authData: AuthorizationData, { offset, limit, filter, }?: {
|
|
239
|
+
offset?: number;
|
|
240
|
+
limit?: number;
|
|
241
|
+
filter?: PgFilter<DbBasePost>;
|
|
242
|
+
}) => Promise<PostWithMeta[]>;
|
|
243
|
+
export declare const listCurrentEventsFeed: (authData: AuthorizationData, { offset, limit, filter, }?: {
|
|
244
|
+
offset?: number;
|
|
245
|
+
limit?: number;
|
|
246
|
+
filter?: PgFilter<DbBasePost>;
|
|
247
|
+
}) => Promise<PostWithMeta[]>;
|
|
248
|
+
export declare const listPastEventsFeed: (authData: AuthorizationData, { offset, limit, filter, }?: {
|
|
249
|
+
offset?: number;
|
|
250
|
+
limit?: number;
|
|
251
|
+
filter?: PgFilter<DbBasePost>;
|
|
252
|
+
}) => Promise<PostWithMeta[]>;
|
|
253
|
+
export declare const listMyUpcomingEventsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
254
|
+
offset?: number;
|
|
255
|
+
limit?: number;
|
|
256
|
+
}) => Promise<PostWithMeta[]>;
|
|
257
|
+
export declare const listMyCurrentEventsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
258
|
+
offset?: number;
|
|
259
|
+
limit?: number;
|
|
260
|
+
}) => Promise<PostWithMeta[]>;
|
|
261
|
+
export declare const listMyPastEventsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
262
|
+
offset?: number;
|
|
263
|
+
limit?: number;
|
|
264
|
+
}) => Promise<PostWithMeta[]>;
|
|
265
|
+
export declare const listUpcomingJamsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
266
|
+
offset?: number;
|
|
267
|
+
limit?: number;
|
|
268
|
+
}) => Promise<PostWithMeta[]>;
|
|
269
|
+
export declare const listPastJamsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
270
|
+
offset?: number;
|
|
271
|
+
limit?: number;
|
|
272
|
+
}) => Promise<PostWithMeta[]>;
|
|
273
|
+
export declare const listMyPastJamsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
274
|
+
offset?: number;
|
|
275
|
+
limit?: number;
|
|
276
|
+
}) => Promise<PostWithMeta[]>;
|
|
277
|
+
export declare const listMyUpcomingJamsFeed: (authData: AuthorizationData, { offset, limit }?: {
|
|
278
|
+
offset?: number;
|
|
279
|
+
limit?: number;
|
|
280
|
+
}) => Promise<PostWithMeta[]>;
|
|
281
|
+
export declare const listUpcomingGroupEventsFeed: (authData: AuthorizationData, groupId: string, { offset, limit }?: {
|
|
282
|
+
offset?: number;
|
|
283
|
+
limit?: number;
|
|
284
|
+
}) => Promise<PostWithMeta[]>;
|
|
285
|
+
export declare const listPastGroupEventsFeed: (authData: AuthorizationData, groupId: string, { offset, limit }?: {
|
|
286
|
+
offset?: number;
|
|
287
|
+
limit?: number;
|
|
288
|
+
}) => Promise<PostWithMeta[]>;
|
|
289
|
+
export declare const reposts: (post: PostWithMeta, authData: AuthorizationData) => Promise<PostWithMeta[]>;
|
|
290
|
+
export declare const getConversationByEnd: (post: PostWithMeta, authData: AuthorizationData) => Promise<PostWithMeta[]>;
|
|
291
|
+
export declare const getConversationByStart: (post: PostWithMeta, authData: AuthorizationData) => Promise<PostWithMeta[]>;
|
|
292
|
+
/** Full ancestor/descendant trees for post detail (CTE + lean mapping). */
|
|
293
|
+
export declare const getPostContext: (post: PostWithMeta, authData: AuthorizationData) => Promise<{
|
|
294
|
+
ancestors: PostWithMeta[];
|
|
295
|
+
descendants: PostWithMeta[];
|
|
296
|
+
}>;
|
|
297
|
+
export declare const mentions: (post: Post, profile: Profile) => Promise<{} | undefined>;
|
|
298
|
+
export declare const audience: (post: Post, profile: Profile) => Promise<{} | undefined>;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { allpeepDb, collectionInfos } from '../db/index.js';
|
|
2
|
+
import { edgeFilters, postFilters } from '../db/pg/filters/index.js';
|
|
3
|
+
import { contextRelation, conversationLeavesMappingForProfile, postContextMappingForProfile, postsMappingForProfile, repostsOfPostRelationForProfile, postIdsMapping, } from './mapping.js';
|
|
4
|
+
import { audienceConnectionFinder, currentEventsFilter, jamFilter, localFeedFilter, mentionsConnectionFinder, myEventsFilter, myFeedFilter, myFeedGroupMembershipFilter, pastEventsFilter, toFilteredPostsList, transformPost, upcomingEventsFilter, } from './helpers/index.js';
|
|
5
|
+
import { addQuerySort, addStart, sortOldestFirst } from '../db/helpers.js';
|
|
6
|
+
import { sorts } from '../db/pg/queries/index.js';
|
|
7
|
+
import { findHashtagByTag, hashtagsMapping } from '../hashtags/index.js';
|
|
8
|
+
import { findGroup } from '../groups/finders.js';
|
|
9
|
+
import { groupsMapping } from '../groups/mapping.js';
|
|
10
|
+
import { profilesMapping } from '../profiles/mapping.js';
|
|
11
|
+
import { CONTEXT_NODE_CAP, loadReplyContextPosts } from './contextClosure.js';
|
|
12
|
+
import { withSpan } from '../performance/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* Throws if the given `authData` does not include a profile.
|
|
15
|
+
*
|
|
16
|
+
* Used by `*My*` finders that need a logged-in profile to build the query
|
|
17
|
+
* filter. Endpoints that call these finders should already gate on
|
|
18
|
+
* `ensureLocalProfile` so this is purely a defensive check.
|
|
19
|
+
*/
|
|
20
|
+
const requireProfile = (authData) => {
|
|
21
|
+
if (!authData.profile) {
|
|
22
|
+
throw new Error('AuthorizationData.profile is required for this finder');
|
|
23
|
+
}
|
|
24
|
+
return authData.profile;
|
|
25
|
+
};
|
|
26
|
+
export const findPost = async (id, authData) => {
|
|
27
|
+
const profile = authData === null || authData === void 0 ? void 0 : authData.profile;
|
|
28
|
+
return allpeepDb()
|
|
29
|
+
.then(({ db }) => postsMappingForProfile(profile).find(db, id))
|
|
30
|
+
.then((post) => (post ? transformPost(post, profile) : undefined));
|
|
31
|
+
};
|
|
32
|
+
export const postContext = async (authData, id, depth, direction, contextMapping) => {
|
|
33
|
+
const profile = authData.profile;
|
|
34
|
+
const mapping = postsMappingForProfile(profile);
|
|
35
|
+
return toFilteredPostsList(mapping.relationsFrom({ id }, contextRelation(depth, direction, contextMapping !== null && contextMapping !== void 0 ? contextMapping : mapping)), { authData });
|
|
36
|
+
};
|
|
37
|
+
export const descendents = async (authData, post, depth, contextMapping) => postContext(authData, post.id, depth, 'descendents', contextMapping);
|
|
38
|
+
export const ancestors = async (authData, post, depth, contextMapping) => postContext(authData, post.id, depth, 'ancestors', contextMapping);
|
|
39
|
+
export const replies = async (authData, post) => descendents(authData, post, 1);
|
|
40
|
+
export const baseListPosts = ({ start, profile, }) => addStart(postsMappingForProfile(profile), start);
|
|
41
|
+
export const baseFeed = ({ start, sort, profile, }) => addQuerySort(baseListPosts({ start, profile }).filter(postFilters.notDirect()), sort);
|
|
42
|
+
export const baseEventsFeed = (profile) => {
|
|
43
|
+
const mapping = postsMappingForProfile(profile)
|
|
44
|
+
.sort(sorts.eventStartAsc)
|
|
45
|
+
.filter({ matches: { type: 'event' } });
|
|
46
|
+
return mapping;
|
|
47
|
+
};
|
|
48
|
+
export const listPosts = async (authData, { start, limit = 100, filter, } = {
|
|
49
|
+
limit: 100,
|
|
50
|
+
}) => toFilteredPostsList(baseListPosts({ start, profile: authData.profile }).filter(filter), { authData, limit });
|
|
51
|
+
export const listConversationLeaves = async (authData) => withSpan('conversations.list', () => toFilteredPostsList(profilesMapping.relationsFrom(requireProfile(authData), {
|
|
52
|
+
alias: 'posts',
|
|
53
|
+
edgeCollection: collectionInfos.audienceCollection.name,
|
|
54
|
+
direction: 'INBOUND',
|
|
55
|
+
skipEdge: true,
|
|
56
|
+
cardinality: 'many',
|
|
57
|
+
mapping: conversationLeavesMappingForProfile(requireProfile(authData))
|
|
58
|
+
.sort(sorts.createdAtDesc)
|
|
59
|
+
.data(),
|
|
60
|
+
}), { authData, limit: 9999 }));
|
|
61
|
+
export const listPostsByProfile = async (authData, requestedProfile, { start, limit = 100, filter, } = {
|
|
62
|
+
limit: 100,
|
|
63
|
+
}) => toFilteredPostsList(profilesMapping.relationsFrom(requestedProfile, {
|
|
64
|
+
alias: 'posts',
|
|
65
|
+
edgeCollection: collectionInfos.entriesCollection.name,
|
|
66
|
+
direction: 'OUTBOUND',
|
|
67
|
+
edgeFilter: edgeFilters.entryType('create'),
|
|
68
|
+
skipEdge: true,
|
|
69
|
+
cardinality: 'many',
|
|
70
|
+
mapping: baseFeed({ start, profile: authData.profile })
|
|
71
|
+
.filter(filter)
|
|
72
|
+
.data(),
|
|
73
|
+
}), { authData, limit });
|
|
74
|
+
export const listBookmarkedPosts = async (authData, requestedProfile, { start, limit = 100, filter, } = {
|
|
75
|
+
limit: 100,
|
|
76
|
+
}) => toFilteredPostsList(profilesMapping.relationsFrom(requestedProfile, {
|
|
77
|
+
alias: 'posts',
|
|
78
|
+
edgeCollection: collectionInfos.bookmarksCollection.name,
|
|
79
|
+
direction: 'OUTBOUND',
|
|
80
|
+
skipEdge: true,
|
|
81
|
+
cardinality: 'many',
|
|
82
|
+
mapping: baseFeed({ start, profile: authData.profile })
|
|
83
|
+
.filter(filter)
|
|
84
|
+
.data(),
|
|
85
|
+
}), { authData, limit });
|
|
86
|
+
export const listBookmarkedPostIds = async (requestedProfile) => {
|
|
87
|
+
const { db } = await allpeepDb();
|
|
88
|
+
return profilesMapping
|
|
89
|
+
.relationsFrom(requestedProfile, {
|
|
90
|
+
alias: 'posts',
|
|
91
|
+
edgeCollection: collectionInfos.bookmarksCollection.name,
|
|
92
|
+
direction: 'OUTBOUND',
|
|
93
|
+
skipEdge: true,
|
|
94
|
+
cardinality: 'many',
|
|
95
|
+
mapping: postIdsMapping.data(),
|
|
96
|
+
})
|
|
97
|
+
.all(db)
|
|
98
|
+
.then((posts) => posts.map((p) => p.id));
|
|
99
|
+
};
|
|
100
|
+
export const getUnseenPostCounts = async (authData) => withSpan('unseen.counts', async () => {
|
|
101
|
+
const profile = requireProfile(authData);
|
|
102
|
+
const groupIds = profile.memberships
|
|
103
|
+
.map((membership) => membership.group.id)
|
|
104
|
+
.filter((groupId) => typeof groupId === 'string');
|
|
105
|
+
const groupCounts = Object.fromEntries(groupIds.map((groupId) => [groupId, 0]));
|
|
106
|
+
await Promise.all(groupIds.map(async (groupId) => {
|
|
107
|
+
const posts = await listPostsByGroup(authData, groupId, {
|
|
108
|
+
limit: 9999,
|
|
109
|
+
});
|
|
110
|
+
groupCounts[groupId] = posts.filter((post) => post.seen === false && post.profile.id !== profile.id).length;
|
|
111
|
+
}));
|
|
112
|
+
const conversations = await Promise.all((await listConversationLeaves(authData)).map((post) => getConversationByEnd(post, authData)));
|
|
113
|
+
const uniqueConversations = Array.from(new Map(conversations
|
|
114
|
+
.filter((conversation) => conversation[0])
|
|
115
|
+
.map((conversation) => [conversation[0].id, conversation])).values());
|
|
116
|
+
const direct = Object.fromEntries(uniqueConversations
|
|
117
|
+
.map((conversation) => {
|
|
118
|
+
const conversationId = conversation[0].id;
|
|
119
|
+
const unread = conversation.filter((post) => post.seen === false && post.profile.id !== profile.id).length;
|
|
120
|
+
return [conversationId, unread];
|
|
121
|
+
})
|
|
122
|
+
.filter(([, unread]) => unread > 0));
|
|
123
|
+
return { groups: groupCounts, direct };
|
|
124
|
+
});
|
|
125
|
+
export const listPostsByType = async (authData, type, { start, limit = 100, filter, } = {
|
|
126
|
+
limit: 100,
|
|
127
|
+
}) => toFilteredPostsList(baseFeed({ start, profile: authData.profile })
|
|
128
|
+
.filter(filter)
|
|
129
|
+
.filter({ matches: { type } }), { authData, limit });
|
|
130
|
+
export const listPostsByTag = async (authData, tag, { start, limit = 100, filter, } = {
|
|
131
|
+
limit: 100,
|
|
132
|
+
}) => {
|
|
133
|
+
const hashtag = await findHashtagByTag(tag);
|
|
134
|
+
if (!hashtag) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
return toFilteredPostsList(hashtagsMapping.relationsFrom(hashtag, {
|
|
138
|
+
alias: 'posts',
|
|
139
|
+
edgeCollection: collectionInfos.postHashtagsCollection.name,
|
|
140
|
+
direction: 'INBOUND',
|
|
141
|
+
cardinality: 'many',
|
|
142
|
+
skipEdge: true,
|
|
143
|
+
mapping: baseFeed({ start, profile: authData.profile })
|
|
144
|
+
.filter(filter)
|
|
145
|
+
.data(),
|
|
146
|
+
}), { authData, limit });
|
|
147
|
+
};
|
|
148
|
+
export const listPostsByGroup = async (authData, groupId, { start, limit = 100, filter, sort: _sort, } = { limit: 100 }) => withSpan('feed.group', async () => {
|
|
149
|
+
const group = await findGroup(groupId);
|
|
150
|
+
if (!group) {
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
return toFilteredPostsList(groupsMapping.relationsFrom(group, {
|
|
154
|
+
alias: 'posts',
|
|
155
|
+
edgeCollection: collectionInfos.postGroupsCollection.name,
|
|
156
|
+
direction: 'INBOUND',
|
|
157
|
+
skipEdge: true,
|
|
158
|
+
cardinality: 'many',
|
|
159
|
+
mapping: baseFeed({ start, profile: authData.profile })
|
|
160
|
+
.filter(filter)
|
|
161
|
+
.data(),
|
|
162
|
+
}), { authData, limit });
|
|
163
|
+
});
|
|
164
|
+
export const listLocalFeed = async (authData, { start, limit = 100 } = { limit: 100 }) => withSpan('feed.local', () => toFilteredPostsList(baseFeed({ start, profile: authData.profile }).filter(localFeedFilter(authData.profile)), { authData, limit }));
|
|
165
|
+
export const listMyFeed = async (authData, { start, limit = 100 } = { limit: 100 }) => {
|
|
166
|
+
const profile = requireProfile(authData);
|
|
167
|
+
return withSpan('feed.my', () => toFilteredPostsList(baseFeed({ start, profile }).filter(myFeedFilter(profile)), { authData, limit, filters: [myFeedGroupMembershipFilter(profile)] }));
|
|
168
|
+
};
|
|
169
|
+
export const listUpcomingEventsFeed = async (authData, { offset, limit = 100, filter, } = {
|
|
170
|
+
limit: 100,
|
|
171
|
+
}) => toFilteredPostsList(baseEventsFeed(authData.profile)
|
|
172
|
+
.filter(upcomingEventsFilter())
|
|
173
|
+
.filter(filter), { authData, limit, offset });
|
|
174
|
+
export const listCurrentEventsFeed = async (authData, { offset, limit = 100, filter, } = {
|
|
175
|
+
limit: 100,
|
|
176
|
+
}) => toFilteredPostsList(baseEventsFeed(authData.profile)
|
|
177
|
+
.filter(currentEventsFilter())
|
|
178
|
+
.filter(filter), { authData, limit, offset });
|
|
179
|
+
export const listPastEventsFeed = async (authData, { offset, limit = 100, filter, } = {
|
|
180
|
+
limit: 100,
|
|
181
|
+
}) => toFilteredPostsList(baseEventsFeed(authData.profile)
|
|
182
|
+
.sort(sorts.eventStartDesc)
|
|
183
|
+
.filter(pastEventsFilter())
|
|
184
|
+
.filter(filter), { authData, limit, offset });
|
|
185
|
+
export const listMyUpcomingEventsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, {
|
|
186
|
+
offset,
|
|
187
|
+
filter: myEventsFilter(requireProfile(authData)),
|
|
188
|
+
limit,
|
|
189
|
+
});
|
|
190
|
+
export const listMyCurrentEventsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listCurrentEventsFeed(authData, {
|
|
191
|
+
offset,
|
|
192
|
+
filter: myEventsFilter(requireProfile(authData)),
|
|
193
|
+
limit,
|
|
194
|
+
});
|
|
195
|
+
export const listMyPastEventsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, {
|
|
196
|
+
offset,
|
|
197
|
+
filter: myEventsFilter(requireProfile(authData)),
|
|
198
|
+
limit,
|
|
199
|
+
});
|
|
200
|
+
export const listUpcomingJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, { offset, filter: jamFilter, limit });
|
|
201
|
+
export const listPastJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, { offset, filter: jamFilter, limit });
|
|
202
|
+
export const listMyPastJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listPastEventsFeed(authData, {
|
|
203
|
+
offset,
|
|
204
|
+
filter: {
|
|
205
|
+
operator: '&&',
|
|
206
|
+
predicates: [myEventsFilter(requireProfile(authData)), jamFilter],
|
|
207
|
+
},
|
|
208
|
+
limit,
|
|
209
|
+
});
|
|
210
|
+
export const listMyUpcomingJamsFeed = async (authData, { offset, limit = 100 } = { limit: 100 }) => listUpcomingEventsFeed(authData, {
|
|
211
|
+
offset,
|
|
212
|
+
filter: {
|
|
213
|
+
operator: '&&',
|
|
214
|
+
predicates: [myEventsFilter(requireProfile(authData)), jamFilter],
|
|
215
|
+
},
|
|
216
|
+
limit,
|
|
217
|
+
});
|
|
218
|
+
const baseGroupEventsFeed = async (authData, groupId, { filter, sort } = {}) => {
|
|
219
|
+
const group = await findGroup(groupId);
|
|
220
|
+
if (!group) {
|
|
221
|
+
throw new Error(`Group ${groupId} not found`);
|
|
222
|
+
}
|
|
223
|
+
const profile = authData.profile;
|
|
224
|
+
return groupsMapping.relationsFrom(group, {
|
|
225
|
+
alias: 'posts',
|
|
226
|
+
edgeCollection: collectionInfos.postGroupsCollection.name,
|
|
227
|
+
direction: 'INBOUND',
|
|
228
|
+
skipEdge: true,
|
|
229
|
+
cardinality: 'many',
|
|
230
|
+
mapping: baseEventsFeed(profile).filter(filter).sort(sort).data(),
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
export const listUpcomingGroupEventsFeed = async (authData, groupId, { offset, limit = 100 } = { limit: 100 }) => toFilteredPostsList(await baseGroupEventsFeed(authData, groupId, {
|
|
234
|
+
filter: upcomingEventsFilter(),
|
|
235
|
+
}), { authData, limit, offset });
|
|
236
|
+
export const listPastGroupEventsFeed = async (authData, groupId, { offset, limit = 100 } = { limit: 100 }) => toFilteredPostsList(await baseGroupEventsFeed(authData, groupId, {
|
|
237
|
+
filter: pastEventsFilter(),
|
|
238
|
+
sort: sorts.eventStartDesc,
|
|
239
|
+
}), { authData, limit, offset });
|
|
240
|
+
export const reposts = async (post, authData) => toFilteredPostsList(postsMappingForProfile(authData.profile).relationsFrom(post, repostsOfPostRelationForProfile(authData.profile)), { authData });
|
|
241
|
+
export const getConversationByEnd = async (post, authData) => ancestors(authData, post, 9999, sortOldestFirst(postsMappingForProfile(authData.profile))).then((conversation) => [...conversation, post]);
|
|
242
|
+
export const getConversationByStart = async (post, authData) => descendents(authData, post, 9999, sortOldestFirst(postsMappingForProfile(authData.profile))).then((conversation) => [post, ...conversation]);
|
|
243
|
+
/** Full ancestor/descendant trees for post detail (CTE + lean mapping). */
|
|
244
|
+
export const getPostContext = async (post, authData) => {
|
|
245
|
+
const mapping = sortOldestFirst(postContextMappingForProfile(authData.profile));
|
|
246
|
+
const [ancestorPosts, descendantPosts] = await Promise.all([
|
|
247
|
+
loadReplyContextPosts(authData, post.id, 'ancestors', mapping, {
|
|
248
|
+
maxDepth: 9999,
|
|
249
|
+
limit: CONTEXT_NODE_CAP,
|
|
250
|
+
}),
|
|
251
|
+
loadReplyContextPosts(authData, post.id, 'descendents', mapping, {
|
|
252
|
+
maxDepth: 9999,
|
|
253
|
+
limit: CONTEXT_NODE_CAP,
|
|
254
|
+
}),
|
|
255
|
+
]);
|
|
256
|
+
return { ancestors: ancestorPosts, descendants: descendantPosts };
|
|
257
|
+
};
|
|
258
|
+
export const mentions = async (post, profile) => allpeepDb().then(({ db }) => mentionsConnectionFinder(db, post, profile));
|
|
259
|
+
export const audience = async (post, profile) => allpeepDb().then(({ db }) => audienceConnectionFinder(db, post, profile));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PgFilter } from '../../db/pg/map/queryTypes';
|
|
2
|
+
import { AuthorizationData, PostWithMeta, ProfileWithMeta, CapabilitiesConfig, DbBasePost } from '@openpeepshq/common/types';
|
|
3
|
+
import { ObjectFilter } from '../../db/types';
|
|
4
|
+
export declare const ownPostsFilter: (profile: ProfileWithMeta) => PgFilter<DbBasePost>;
|
|
5
|
+
export declare const followFilter: (profile: ProfileWithMeta) => PgFilter<DbBasePost>;
|
|
6
|
+
export declare const myFeedFilter: (profile: ProfileWithMeta) => PgFilter<DbBasePost>;
|
|
7
|
+
export declare const myFeedGroupMembershipFilter: (profile: ProfileWithMeta) => ObjectFilter<PostWithMeta>;
|
|
8
|
+
export declare const localFeedFilter: (_profile?: ProfileWithMeta) => PgFilter<DbBasePost>;
|
|
9
|
+
export declare const canReadPost: (config: CapabilitiesConfig, authData: AuthorizationData) => (post?: PostWithMeta) => boolean;
|
|
10
|
+
export declare const upcomingEventsFilter: () => import("../../db").SqlFilter;
|
|
11
|
+
export declare const currentEventsFilter: () => import("../../db").SqlFilter;
|
|
12
|
+
export declare const pastEventsFilter: () => import("../../db").SqlFilter;
|
|
13
|
+
export declare const myEventsFilter: (profile: ProfileWithMeta) => PgFilter<DbBasePost>;
|
|
14
|
+
export declare const jamFilter: import("../../db").SqlFilter;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { postWithMetaSchema, } from '@openpeepshq/common/types';
|
|
2
|
+
import { combine, eventTimeFilters, postFilters } from '../../db/pg/filters/index.js';
|
|
3
|
+
import { checkCapabilities, getPostCapabilities } from '@openpeepshq/common/lib';
|
|
4
|
+
export const ownPostsFilter = (profile) => ({
|
|
5
|
+
matches: {
|
|
6
|
+
creatorId: profile.id,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
/** Widen the feed query to any group-tagged post; membership is enforced in `myFeedGroupMembershipFilter`. */
|
|
10
|
+
const groupPostVisibilityQueryFilter = {
|
|
11
|
+
matches: { visibility: 'group' },
|
|
12
|
+
};
|
|
13
|
+
export const followFilter = (profile) => ({
|
|
14
|
+
matches: profile.following.map((f) => ({
|
|
15
|
+
creatorId: f.id,
|
|
16
|
+
})),
|
|
17
|
+
});
|
|
18
|
+
export const myFeedFilter = (profile) => ({
|
|
19
|
+
operator: '||',
|
|
20
|
+
predicates: [
|
|
21
|
+
ownPostsFilter(profile),
|
|
22
|
+
groupPostVisibilityQueryFilter,
|
|
23
|
+
followFilter(profile),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
export const myFeedGroupMembershipFilter = (profile) => (post) => post.visibility !== 'group' ||
|
|
27
|
+
(!!post.group &&
|
|
28
|
+
profile.memberships.some((m) => { var _a; return m.group.id === ((_a = post.group) === null || _a === void 0 ? void 0 : _a.id); }));
|
|
29
|
+
export const localFeedFilter = (_profile) => ({
|
|
30
|
+
matches: [{ visibility: 'local' }, { visibility: 'public' }],
|
|
31
|
+
});
|
|
32
|
+
export const canReadPost = (config, authData) => (post) => !!post &&
|
|
33
|
+
checkCapabilities(['core-posts-read'], getPostCapabilities(authData, post, config)).success &&
|
|
34
|
+
postWithMetaSchema.safeParse(post).success;
|
|
35
|
+
export const upcomingEventsFilter = () => eventTimeFilters.upcoming();
|
|
36
|
+
export const currentEventsFilter = () => eventTimeFilters.current();
|
|
37
|
+
export const pastEventsFilter = () => eventTimeFilters.past();
|
|
38
|
+
export const myEventsFilter = (profile) => combine.or(postFilters.creatorId(profile.id), postFilters.isJamModerator(profile.id), postFilters.hasYesOrMaybeRsvp(profile.id));
|
|
39
|
+
export const jamFilter = postFilters.hasJam();
|