@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,95 @@
|
|
|
1
|
+
import { Account, PushSubscriptionData } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const createPushSubscription: (account: Account, data: PushSubscriptionData) => Promise<{
|
|
3
|
+
type: "web";
|
|
4
|
+
endpoint: string;
|
|
5
|
+
keys: {
|
|
6
|
+
auth: string;
|
|
7
|
+
p256dh: string;
|
|
8
|
+
};
|
|
9
|
+
id: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
deviceName?: string | undefined;
|
|
13
|
+
alerts?: {
|
|
14
|
+
poll: boolean;
|
|
15
|
+
followRequest: boolean;
|
|
16
|
+
status: boolean;
|
|
17
|
+
favorite: boolean;
|
|
18
|
+
follow: boolean;
|
|
19
|
+
repost: boolean;
|
|
20
|
+
mention: boolean;
|
|
21
|
+
update: boolean;
|
|
22
|
+
admin: {
|
|
23
|
+
signUp: boolean;
|
|
24
|
+
report: boolean;
|
|
25
|
+
};
|
|
26
|
+
} | undefined;
|
|
27
|
+
deletedAt?: string | null | undefined;
|
|
28
|
+
} | {
|
|
29
|
+
type: "apn";
|
|
30
|
+
apnToken: string;
|
|
31
|
+
id: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
deviceName?: string | undefined;
|
|
35
|
+
alerts?: {
|
|
36
|
+
poll: boolean;
|
|
37
|
+
followRequest: boolean;
|
|
38
|
+
status: boolean;
|
|
39
|
+
favorite: boolean;
|
|
40
|
+
follow: boolean;
|
|
41
|
+
repost: boolean;
|
|
42
|
+
mention: boolean;
|
|
43
|
+
update: boolean;
|
|
44
|
+
admin: {
|
|
45
|
+
signUp: boolean;
|
|
46
|
+
report: boolean;
|
|
47
|
+
};
|
|
48
|
+
} | undefined;
|
|
49
|
+
deletedAt?: string | null | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
type: "fcm";
|
|
52
|
+
fcmToken: string;
|
|
53
|
+
id: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
deviceName?: string | undefined;
|
|
57
|
+
alerts?: {
|
|
58
|
+
poll: boolean;
|
|
59
|
+
followRequest: boolean;
|
|
60
|
+
status: boolean;
|
|
61
|
+
favorite: boolean;
|
|
62
|
+
follow: boolean;
|
|
63
|
+
repost: boolean;
|
|
64
|
+
mention: boolean;
|
|
65
|
+
update: boolean;
|
|
66
|
+
admin: {
|
|
67
|
+
signUp: boolean;
|
|
68
|
+
report: boolean;
|
|
69
|
+
};
|
|
70
|
+
} | undefined;
|
|
71
|
+
deletedAt?: string | null | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
type: "webhook";
|
|
74
|
+
url: string;
|
|
75
|
+
publicKey: string;
|
|
76
|
+
id: string;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
alerts?: {
|
|
80
|
+
poll: boolean;
|
|
81
|
+
followRequest: boolean;
|
|
82
|
+
status: boolean;
|
|
83
|
+
favorite: boolean;
|
|
84
|
+
follow: boolean;
|
|
85
|
+
repost: boolean;
|
|
86
|
+
mention: boolean;
|
|
87
|
+
update: boolean;
|
|
88
|
+
admin: {
|
|
89
|
+
signUp: boolean;
|
|
90
|
+
report: boolean;
|
|
91
|
+
};
|
|
92
|
+
} | undefined;
|
|
93
|
+
deletedAt?: string | null | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export declare const deletePushSubscription: (id: string) => Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { pushSubscriptionsMapping } from './mapping.js';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { pushSubscriptionAccountConnector } from './helpers.js';
|
|
4
|
+
export const createPushSubscription = async (account, data) => {
|
|
5
|
+
const db = await allpeepDb().then((db) => db.db);
|
|
6
|
+
const existingPushSubscription = await pushSubscriptionsMapping
|
|
7
|
+
.filter({
|
|
8
|
+
matches: data,
|
|
9
|
+
})
|
|
10
|
+
.first(db);
|
|
11
|
+
if (existingPushSubscription) {
|
|
12
|
+
return existingPushSubscription;
|
|
13
|
+
}
|
|
14
|
+
const pushSubscription = await pushSubscriptionsMapping.create(db, data);
|
|
15
|
+
await pushSubscriptionAccountConnector(db, account, pushSubscription);
|
|
16
|
+
return pushSubscription;
|
|
17
|
+
};
|
|
18
|
+
export const deletePushSubscription = async (id) => {
|
|
19
|
+
const db = await allpeepDb().then((db) => db.db);
|
|
20
|
+
return pushSubscriptionsMapping.delete(db, id);
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createClient } from 'redis';
|
|
2
|
+
import { defaultConfig } from '../config/defaults/core.js';
|
|
3
|
+
export const getConnection = () => createClient({
|
|
4
|
+
url: `redis://${defaultConfig.redis.host}:6379`,
|
|
5
|
+
})
|
|
6
|
+
.on('error', console.log)
|
|
7
|
+
.connect();
|
|
8
|
+
export const disconnect = async (conn) => {
|
|
9
|
+
conn.isOpen && (await conn.disconnect().catch(console.error));
|
|
10
|
+
};
|
|
11
|
+
let connection;
|
|
12
|
+
export const getSharedConnection = async () => {
|
|
13
|
+
if (!(connection && (await connection).isOpen)) {
|
|
14
|
+
connection = getConnection();
|
|
15
|
+
}
|
|
16
|
+
return connection;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './connection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './connection.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PostWithMeta, Profile, ReportWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const findReport: (id: string) => Promise<ReportWithMeta | undefined>;
|
|
3
|
+
export declare const listReports: () => Promise<ReportWithMeta[]>;
|
|
4
|
+
export declare const listReportsByReporterProfile: (profile: Profile) => Promise<ReportWithMeta[]>;
|
|
5
|
+
export declare const listReportsByReportedProfile: (profile: Profile) => Promise<ReportWithMeta[]>;
|
|
6
|
+
export declare const listReportsByReportedPost: (post: PostWithMeta) => Promise<ReportWithMeta[]>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { allpeepDb, collectionInfos } from '../db/index.js';
|
|
2
|
+
import { reportsMapping } from './mapping.js';
|
|
3
|
+
import { profilesMapping } from '../profiles/mapping.js';
|
|
4
|
+
import { postsMapping } from '../posts/index.js';
|
|
5
|
+
import { transformReport, transformReports } from './helpers.js';
|
|
6
|
+
export const findReport = async (id) => allpeepDb()
|
|
7
|
+
.then(({ db }) => reportsMapping.find(db, id))
|
|
8
|
+
.then((report) => (report ? transformReport(report) : undefined));
|
|
9
|
+
export const listReports = async () => allpeepDb()
|
|
10
|
+
.then(({ db }) => reportsMapping.all(db))
|
|
11
|
+
.then(transformReports);
|
|
12
|
+
export const listReportsByReporterProfile = async (profile) => allpeepDb()
|
|
13
|
+
.then(({ db }) => profilesMapping
|
|
14
|
+
.relationsFrom(profile, {
|
|
15
|
+
alias: 'createdReport',
|
|
16
|
+
edgeCollection: collectionInfos.createdReportCollection.name,
|
|
17
|
+
direction: 'OUTBOUND',
|
|
18
|
+
cardinality: 'many',
|
|
19
|
+
mapping: reportsMapping.data(),
|
|
20
|
+
})
|
|
21
|
+
.all(db))
|
|
22
|
+
.then(transformReports);
|
|
23
|
+
export const listReportsByReportedProfile = async (profile) => allpeepDb()
|
|
24
|
+
.then(({ db }) => profilesMapping
|
|
25
|
+
.relationsFrom(profile, {
|
|
26
|
+
alias: 'reportedProfile',
|
|
27
|
+
edgeCollection: collectionInfos.isReportedProfileCollection.name,
|
|
28
|
+
direction: 'INBOUND',
|
|
29
|
+
cardinality: 'many',
|
|
30
|
+
mapping: reportsMapping.data(),
|
|
31
|
+
})
|
|
32
|
+
.all(db))
|
|
33
|
+
.then(transformReports);
|
|
34
|
+
export const listReportsByReportedPost = async (post) => allpeepDb()
|
|
35
|
+
.then(({ db }) => postsMapping
|
|
36
|
+
.relationsFrom(post, {
|
|
37
|
+
alias: 'reportedPosts',
|
|
38
|
+
edgeCollection: collectionInfos.isReportedObjectCollection.name,
|
|
39
|
+
direction: 'INBOUND',
|
|
40
|
+
cardinality: 'many',
|
|
41
|
+
mapping: reportsMapping.data(),
|
|
42
|
+
})
|
|
43
|
+
.all(db))
|
|
44
|
+
.then(transformReports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PostWithMeta, ReportWithMeta, ProfileWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const transformReport: (report: ReportWithMeta) => Promise<ReportWithMeta>;
|
|
3
|
+
export declare const transformReports: (reports: ReportWithMeta[]) => Promise<ReportWithMeta[]>;
|
|
4
|
+
export declare const createdReportConnector: (db: import("../db").PgDb, from: ProfileWithMeta, to: ReportWithMeta, data?: {
|
|
5
|
+
id?: string;
|
|
6
|
+
}) => Promise<import("../db/pg/map").WithId<{
|
|
7
|
+
_from: string;
|
|
8
|
+
_to: string;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare const reportedProfileConnector: (db: import("../db").PgDb, from: ReportWithMeta, to: ProfileWithMeta, data?: {
|
|
11
|
+
id?: string;
|
|
12
|
+
}) => Promise<import("../db/pg/map").WithId<{
|
|
13
|
+
_from: string;
|
|
14
|
+
_to: string;
|
|
15
|
+
}>>;
|
|
16
|
+
export declare const reportedPostsConnector: (db: import("../db").PgDb, from: ReportWithMeta, to: PostWithMeta, data?: {
|
|
17
|
+
id?: string;
|
|
18
|
+
}) => Promise<import("../db/pg/map").WithId<{
|
|
19
|
+
_from: string;
|
|
20
|
+
_to: string;
|
|
21
|
+
}>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { connector } from '../db/helpers.js';
|
|
2
|
+
import { collectionInfos } from '../db/index.js';
|
|
3
|
+
import { transformPost } from '../posts/index.js';
|
|
4
|
+
export const transformReport = async (report) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const rawPosts = ((_a = report.reportedPosts) !== null && _a !== void 0 ? _a : []);
|
|
7
|
+
return Object.assign(Object.assign({}, report), { reportedPosts: await Promise.all(rawPosts.map((post) => transformPost(post))) });
|
|
8
|
+
};
|
|
9
|
+
export const transformReports = async (reports) => Promise.all(reports.map(transformReport));
|
|
10
|
+
export const createdReportConnector = connector(collectionInfos.profilesCollection, collectionInfos.reportsCollection, collectionInfos.createdReportCollection);
|
|
11
|
+
export const reportedProfileConnector = connector(collectionInfos.reportsCollection, collectionInfos.profilesCollection, collectionInfos.isReportedProfileCollection);
|
|
12
|
+
export const reportedPostsConnector = connector(collectionInfos.reportsCollection, collectionInfos.postsCollection, collectionInfos.isReportedObjectCollection);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReportWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const reportsMapping: import("../db/pg/map").Mapping<{
|
|
3
|
+
comment: string;
|
|
4
|
+
category: "other" | "spam" | "violation";
|
|
5
|
+
uri?: string | undefined;
|
|
6
|
+
forward?: boolean | undefined;
|
|
7
|
+
ruleIds?: number[] | undefined;
|
|
8
|
+
resolution?: "warn" | "remove" | "ignore" | "other" | "ban" | undefined;
|
|
9
|
+
}, ReportWithMeta, ReportWithMeta>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { collectionInfos } from '../db/index.js';
|
|
2
|
+
import { postsMapping } from '../posts/mapping.js';
|
|
3
|
+
import { profilesMapping } from '../profiles/mapping.js';
|
|
4
|
+
import { map } from '../db/pg/map/index.js';
|
|
5
|
+
const reportRelations = [
|
|
6
|
+
{
|
|
7
|
+
alias: 'reporterProfile',
|
|
8
|
+
edgeCollection: collectionInfos.createdReportCollection.name,
|
|
9
|
+
direction: 'INBOUND',
|
|
10
|
+
cardinality: 'one',
|
|
11
|
+
mapping: profilesMapping.data(),
|
|
12
|
+
skipEdge: true,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
alias: 'reportedProfile',
|
|
16
|
+
edgeCollection: collectionInfos.isReportedProfileCollection.name,
|
|
17
|
+
direction: 'OUTBOUND',
|
|
18
|
+
cardinality: 'one',
|
|
19
|
+
mapping: profilesMapping.data(),
|
|
20
|
+
skipEdge: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
alias: 'reportedPosts',
|
|
24
|
+
edgeCollection: collectionInfos.isReportedObjectCollection.name,
|
|
25
|
+
direction: 'OUTBOUND',
|
|
26
|
+
cardinality: 'many',
|
|
27
|
+
mapping: postsMapping.data(),
|
|
28
|
+
skipEdge: true,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
export const reportsMapping = map({
|
|
32
|
+
collection: collectionInfos.reportsCollection.name,
|
|
33
|
+
relations: reportRelations,
|
|
34
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PostWithMeta, ReportData, ReportResolution, ReportWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
import { ProfileWithMeta } from '@openpeepshq/common/types';
|
|
3
|
+
export declare const createReport: (reportData: ReportData, reporter: ProfileWithMeta, reportedProfile: ProfileWithMeta, reportedPosts: PostWithMeta[]) => Promise<ReportWithMeta>;
|
|
4
|
+
export declare const resolveReport: (report: ReportWithMeta, resolution: ReportResolution) => Promise<ReportWithMeta>;
|
|
5
|
+
export declare const reopenReport: (report: ReportWithMeta) => Promise<ReportWithMeta>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { allpeepDb } from '../db/index.js';
|
|
2
|
+
import { reportsMapping } from './mapping.js';
|
|
3
|
+
import { createdReportConnector, reportedPostsConnector, reportedProfileConnector, transformReport, } from './helpers.js';
|
|
4
|
+
import { throwIfUndefined } from '../lib/utils.js';
|
|
5
|
+
export const createReport = async (reportData, reporter, reportedProfile, reportedPosts) => {
|
|
6
|
+
const { db } = await allpeepDb();
|
|
7
|
+
const report = await reportsMapping.create(db, reportData);
|
|
8
|
+
await createdReportConnector(db, reporter, report);
|
|
9
|
+
await reportedProfileConnector(db, report, reportedProfile);
|
|
10
|
+
await Promise.all(reportedPosts.map((post) => reportedPostsConnector(db, report, post)));
|
|
11
|
+
return throwIfUndefined(await reportsMapping
|
|
12
|
+
.find(db, report.id)
|
|
13
|
+
.then((loaded) => (loaded ? transformReport(loaded) : undefined)));
|
|
14
|
+
};
|
|
15
|
+
export const resolveReport = async (report, resolution) => allpeepDb().then(({ db }) => reportsMapping.update(db, report.id, { resolution }));
|
|
16
|
+
export const reopenReport = async (report) => allpeepDb().then(({ db }) => reportsMapping.update(db, report.id, { resolution: undefined }));
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export const defaultRoles = [
|
|
2
|
+
{
|
|
3
|
+
key: 'owner',
|
|
4
|
+
displayName: 'Owner',
|
|
5
|
+
capabilities: { add: ['*'], remove: [] },
|
|
6
|
+
default: true,
|
|
7
|
+
description: 'The owner of this community can do everything',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
key: 'admin',
|
|
11
|
+
displayName: 'Admin',
|
|
12
|
+
capabilities: {
|
|
13
|
+
add: [
|
|
14
|
+
'core-accounts-*',
|
|
15
|
+
'core-reports-*',
|
|
16
|
+
'core-groups-*',
|
|
17
|
+
'core-posts-*',
|
|
18
|
+
'core-profiles-*',
|
|
19
|
+
'core-customization-*',
|
|
20
|
+
'core-backups-*',
|
|
21
|
+
'core-i18n-*',
|
|
22
|
+
'core-logs-*',
|
|
23
|
+
'core-roles-read',
|
|
24
|
+
'core-maintenance-restart',
|
|
25
|
+
'core-inviteLinks-*',
|
|
26
|
+
'core-analytics-read',
|
|
27
|
+
],
|
|
28
|
+
remove: [],
|
|
29
|
+
},
|
|
30
|
+
default: true,
|
|
31
|
+
description: 'An admin of the community',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 'moderator',
|
|
35
|
+
displayName: 'Moderator',
|
|
36
|
+
capabilities: {
|
|
37
|
+
add: [
|
|
38
|
+
'core-posts-delete',
|
|
39
|
+
'core-posts-pin-globally',
|
|
40
|
+
'core-posts-announce',
|
|
41
|
+
'core-profiles-suspend',
|
|
42
|
+
'core-accounts-read',
|
|
43
|
+
'core-profiles-read',
|
|
44
|
+
'core-groups-read',
|
|
45
|
+
'core-inviteLinks-read',
|
|
46
|
+
'core-reports-read',
|
|
47
|
+
'core-reports-update',
|
|
48
|
+
'core-analytics-read',
|
|
49
|
+
'core-local',
|
|
50
|
+
'core-posts-create-*',
|
|
51
|
+
'core-groups-create',
|
|
52
|
+
'core-reports-create',
|
|
53
|
+
],
|
|
54
|
+
remove: [],
|
|
55
|
+
},
|
|
56
|
+
default: true,
|
|
57
|
+
description: 'A moderator of the community',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: 'member',
|
|
61
|
+
displayName: 'Member',
|
|
62
|
+
capabilities: {
|
|
63
|
+
add: [
|
|
64
|
+
'core-local',
|
|
65
|
+
'core-posts-create-*',
|
|
66
|
+
'core-groups-create',
|
|
67
|
+
'core-reports-create',
|
|
68
|
+
],
|
|
69
|
+
remove: [],
|
|
70
|
+
},
|
|
71
|
+
default: true,
|
|
72
|
+
description: 'A member of the community',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: 'pendingmember',
|
|
76
|
+
displayName: 'Pending Member',
|
|
77
|
+
capabilities: {
|
|
78
|
+
add: ['core-local'],
|
|
79
|
+
remove: [],
|
|
80
|
+
},
|
|
81
|
+
default: true,
|
|
82
|
+
description: 'A member of the community that has not been approved yet',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: 'limitedmember',
|
|
86
|
+
displayName: 'Limited Member',
|
|
87
|
+
capabilities: {
|
|
88
|
+
add: [],
|
|
89
|
+
remove: [],
|
|
90
|
+
},
|
|
91
|
+
default: true,
|
|
92
|
+
description: 'A member of the community that can only partcipate in group they are added to',
|
|
93
|
+
},
|
|
94
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Role } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const findRole: (id: string) => Promise<Role | undefined>;
|
|
3
|
+
export declare const findRoleByKey: (key: string) => Promise<Role | undefined>;
|
|
4
|
+
export declare const listRoles: () => Promise<Role[]>;
|
|
5
|
+
export declare const findRolesByCapabilities: (capabilities: string[]) => Promise<Role[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { allpeepDb } from '../db/index.js';
|
|
2
|
+
import { rolesMapping } from './mapping.js';
|
|
3
|
+
import { checkRoleCapabilities } from '@openpeepshq/common/lib';
|
|
4
|
+
export const findRole = (id) => allpeepDb().then(({ db }) => rolesMapping.find(db, id));
|
|
5
|
+
export const findRoleByKey = (key) => allpeepDb().then(({ db }) => rolesMapping.findOneBy(db, { matches: { key } }));
|
|
6
|
+
export const listRoles = () => allpeepDb().then(({ db }) => rolesMapping.all(db));
|
|
7
|
+
export const findRolesByCapabilities = (capabilities) => allpeepDb()
|
|
8
|
+
.then(({ db }) => rolesMapping.all(db))
|
|
9
|
+
.then((roles) => roles.filter((role) => checkRoleCapabilities([role], capabilities).success));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Role } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const rolesMapping: import("../db/pg/map").Mapping<{
|
|
3
|
+
key: string;
|
|
4
|
+
default: boolean;
|
|
5
|
+
displayName: string;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
capabilities?: {
|
|
8
|
+
add?: string[] | undefined;
|
|
9
|
+
remove?: string[] | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
}, Role, Role>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RoleData } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const createRole: (roleData: RoleData) => Promise<import("@openpeepshq/common").Role>;
|
|
3
|
+
export declare const updateRole: (id: string, roleData: Partial<RoleData>) => Promise<boolean>;
|
|
4
|
+
export declare const setDefaultRoles: () => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { findRoleByKey } from './finders.js';
|
|
2
|
+
import { defaultRoles } from './defaults.js';
|
|
3
|
+
import { allpeepDb } from '../db/index.js';
|
|
4
|
+
import { conflict } from '../errors/index.js';
|
|
5
|
+
import { rolesMapping } from './mapping.js';
|
|
6
|
+
import { profilesCache } from '../profiles/cache.js';
|
|
7
|
+
export const createRole = (roleData) => allpeepDb().then(async ({ db }) => {
|
|
8
|
+
const existingRole = await findRoleByKey(roleData.key);
|
|
9
|
+
if (existingRole) {
|
|
10
|
+
throw conflict({
|
|
11
|
+
errorKey: 'error.roleExists',
|
|
12
|
+
parameters: { key: roleData.key },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return rolesMapping.create(db, roleData);
|
|
16
|
+
});
|
|
17
|
+
export const updateRole = (id, roleData) => allpeepDb()
|
|
18
|
+
.then(async ({ db }) => rolesMapping.update(db, id, roleData))
|
|
19
|
+
.then(() => profilesCache.clear());
|
|
20
|
+
export const setDefaultRoles = async () => {
|
|
21
|
+
for (const role of defaultRoles) {
|
|
22
|
+
const existingRole = await findRoleByKey(role.key);
|
|
23
|
+
if (!existingRole) {
|
|
24
|
+
await createRole(role);
|
|
25
|
+
}
|
|
26
|
+
else if (existingRole.default) {
|
|
27
|
+
await updateRole(existingRole.id, role);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AuthorizationData, OffsetInfiniteQueryParams, PostWithMeta, ProfileWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const searchGroups: (query: string, authData: AuthorizationData, limit?: OffsetInfiniteQueryParams) => Promise<{
|
|
3
|
+
data: {
|
|
4
|
+
handle: string;
|
|
5
|
+
capabilities: Record<string, {
|
|
6
|
+
add?: string[] | undefined;
|
|
7
|
+
remove?: string[] | undefined;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
membersCount: number;
|
|
10
|
+
id: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
avatar?: string | null | undefined;
|
|
14
|
+
header?: string | null | undefined;
|
|
15
|
+
displayName?: string | undefined;
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
rules?: string | undefined;
|
|
18
|
+
pinnedPostId?: string | undefined;
|
|
19
|
+
discoverable?: boolean | undefined;
|
|
20
|
+
lastPostAt?: string | null | undefined;
|
|
21
|
+
deletedAt?: string | null | undefined;
|
|
22
|
+
};
|
|
23
|
+
score: number;
|
|
24
|
+
}[]>;
|
|
25
|
+
export declare const searchProfiles: (query: string, authData: AuthorizationData, limit?: OffsetInfiniteQueryParams) => Promise<{
|
|
26
|
+
data: ProfileWithMeta;
|
|
27
|
+
score: number;
|
|
28
|
+
}[]>;
|
|
29
|
+
export declare const searchPosts: (query: string, authData: AuthorizationData, limitOffset?: OffsetInfiniteQueryParams) => Promise<{
|
|
30
|
+
data: PostWithMeta;
|
|
31
|
+
score: number;
|
|
32
|
+
}[]>;
|
|
33
|
+
export declare const searchEvents: (query: string, authData: AuthorizationData, limitOffset?: OffsetInfiniteQueryParams) => Promise<{
|
|
34
|
+
data: PostWithMeta;
|
|
35
|
+
score: number;
|
|
36
|
+
}[]>;
|
|
37
|
+
export declare const searchJams: (query: string, authData: AuthorizationData, limitOffset?: OffsetInfiniteQueryParams) => Promise<{
|
|
38
|
+
data: PostWithMeta;
|
|
39
|
+
score: number;
|
|
40
|
+
}[]>;
|
|
41
|
+
export declare const searchResultCounts: (query: string, authData: AuthorizationData) => Promise<{
|
|
42
|
+
groups: number;
|
|
43
|
+
profiles: number;
|
|
44
|
+
posts: number;
|
|
45
|
+
events: number;
|
|
46
|
+
jams: number;
|
|
47
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { allpeepDb } from '../db/index.js';
|
|
2
|
+
import { filterAndTransform } from '../db/helpers.js';
|
|
3
|
+
import { canReadPost, transformPost } from '../posts/helpers/index.js';
|
|
4
|
+
import { capabilitiesConfig } from '../config/index.js';
|
|
5
|
+
import { eventSearchMapping, groupSearchMapping, jamSearchMapping, postSearchMapping, profileSearchMapping, } from './mapping.js';
|
|
6
|
+
import { queryParamsToLimit } from './helpers.js';
|
|
7
|
+
import { withSpan } from '../performance/index.js';
|
|
8
|
+
const requireProfile = (authData) => {
|
|
9
|
+
if (!authData.profile) {
|
|
10
|
+
throw new Error('AuthorizationData.profile is required for this finder');
|
|
11
|
+
}
|
|
12
|
+
return authData.profile;
|
|
13
|
+
};
|
|
14
|
+
export const searchGroups = async (query, authData, limit = { offset: 0, limit: 15 }) => {
|
|
15
|
+
const { db } = await allpeepDb();
|
|
16
|
+
return groupSearchMapping(requireProfile(authData), query)
|
|
17
|
+
.limit(queryParamsToLimit(limit))
|
|
18
|
+
.all(db);
|
|
19
|
+
};
|
|
20
|
+
export const searchProfiles = async (query, authData, limit = { offset: 0, limit: 15 }) => withSpan('profiles.search', async () => {
|
|
21
|
+
const { db } = await allpeepDb();
|
|
22
|
+
return profileSearchMapping(requireProfile(authData), query)
|
|
23
|
+
.limit(queryParamsToLimit(limit))
|
|
24
|
+
.all(db);
|
|
25
|
+
});
|
|
26
|
+
const canReadPostFilter = async (authData) => {
|
|
27
|
+
const postFilter = canReadPost(await capabilitiesConfig(), authData);
|
|
28
|
+
return (item) => {
|
|
29
|
+
return postFilter(item.data);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const transformPostWithScore = (profile) => async (item) => {
|
|
33
|
+
return { data: await transformPost(item.data, profile), score: item.score };
|
|
34
|
+
};
|
|
35
|
+
export const searchPosts = async (query, authData, limitOffset = { offset: 0, limit: 15 }) => withSpan('posts.search', async () => {
|
|
36
|
+
const profile = requireProfile(authData);
|
|
37
|
+
const { db } = await allpeepDb();
|
|
38
|
+
const mapping = postSearchMapping(profile, query);
|
|
39
|
+
return filterAndTransform(mapping, db, Object.assign({ transform: transformPostWithScore(profile), filter: await canReadPostFilter(authData) }, limitOffset));
|
|
40
|
+
});
|
|
41
|
+
export const searchEvents = async (query, authData, limitOffset = { offset: 0, limit: 15 }) => {
|
|
42
|
+
const profile = requireProfile(authData);
|
|
43
|
+
return filterAndTransform(eventSearchMapping(profile, query), (await allpeepDb()).db, Object.assign({ transform: transformPostWithScore(profile), filter: await canReadPostFilter(authData) }, limitOffset));
|
|
44
|
+
};
|
|
45
|
+
export const searchJams = async (query, authData, limitOffset = { offset: 0, limit: 15 }) => {
|
|
46
|
+
const profile = requireProfile(authData);
|
|
47
|
+
return filterAndTransform(jamSearchMapping(profile, query), (await allpeepDb()).db, Object.assign({ transform: transformPostWithScore(profile), filter: await canReadPostFilter(authData) }, limitOffset));
|
|
48
|
+
};
|
|
49
|
+
export const searchResultCounts = async (query, authData) => {
|
|
50
|
+
const profile = requireProfile(authData);
|
|
51
|
+
const { db } = await allpeepDb();
|
|
52
|
+
return {
|
|
53
|
+
groups: await groupSearchMapping(profile, query).count(db),
|
|
54
|
+
profiles: await profileSearchMapping(profile, query).count(db),
|
|
55
|
+
posts: await searchPosts(query, authData, { limit: 100 }).then((posts) => posts.length),
|
|
56
|
+
events: await searchEvents(query, authData, { limit: 100 }).then((events) => events.length),
|
|
57
|
+
jams: await searchJams(query, authData, { limit: 100 }).then((jams) => jams.length),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const queryParamsToLimit = (query) => { var _a, _b; return (query === null || query === void 0 ? void 0 : query.offset) ? [query.offset, (_a = query === null || query === void 0 ? void 0 : query.limit) !== null && _a !== void 0 ? _a : 15] : ((_b = query === null || query === void 0 ? void 0 : query.limit) !== null && _b !== void 0 ? _b : 15); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './finders';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './finders.js';
|