@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,38 @@
|
|
|
1
|
+
import { ProfileSettings } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const profileSettingsMapping: import("../db/pg/map").Mapping<{
|
|
3
|
+
id: string;
|
|
4
|
+
language?: string | undefined;
|
|
5
|
+
theme?: "light" | "dark" | "community" | "system" | undefined;
|
|
6
|
+
defaults?: {
|
|
7
|
+
privacy?: "public" | "unlisted" | "private" | undefined;
|
|
8
|
+
sensitive?: boolean | undefined;
|
|
9
|
+
language?: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
notifications?: Record<string, {
|
|
12
|
+
create: boolean;
|
|
13
|
+
push: boolean;
|
|
14
|
+
email: boolean;
|
|
15
|
+
}> | undefined;
|
|
16
|
+
jamSettings?: {
|
|
17
|
+
backgroundObfuscation?: {
|
|
18
|
+
type: "blur";
|
|
19
|
+
radius?: number | undefined;
|
|
20
|
+
} | {
|
|
21
|
+
type: "image";
|
|
22
|
+
image: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "video";
|
|
25
|
+
video: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: "none";
|
|
28
|
+
} | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
stripeSettings?: {
|
|
31
|
+
customerId?: string | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
feedSettings?: {
|
|
34
|
+
communityFeed?: {
|
|
35
|
+
showGroupPosts?: boolean | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
}, ProfileSettings, ProfileSettings>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ProfileSettingsData } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const createProfileSettings: (profileSettingsData: ProfileSettingsData) => Promise<import("@openpeepshq/common").ProfileSettings>;
|
|
3
|
+
export declare const updateProfileSettings: (id: string, profileSettingsData: Partial<ProfileSettingsData>) => Promise<import("@openpeepshq/common").ProfileSettings>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { conflict } from '../errors/index.js';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { hub } from '../events/index.js';
|
|
4
|
+
import { profileSettingsMapping } from './mapping.js';
|
|
5
|
+
import { findProfileSettings } from './finders.js';
|
|
6
|
+
import { profileSettingsCache } from './cache.js';
|
|
7
|
+
export const createProfileSettings = (profileSettingsData) => allpeepDb().then(async ({ db }) => {
|
|
8
|
+
const existingConfig = await findProfileSettings(profileSettingsData.id);
|
|
9
|
+
if (existingConfig) {
|
|
10
|
+
throw conflict({
|
|
11
|
+
errorKey: 'error.configExists',
|
|
12
|
+
parameters: { key: profileSettingsData.id },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return profileSettingsMapping.create(db, profileSettingsData);
|
|
16
|
+
});
|
|
17
|
+
export const updateProfileSettings = async (id, profileSettingsData) => {
|
|
18
|
+
const { db } = await allpeepDb();
|
|
19
|
+
await findProfileSettings(id);
|
|
20
|
+
const updatedSettings = await profileSettingsMapping.update(db, id, profileSettingsData);
|
|
21
|
+
await profileSettingsCache.del(id);
|
|
22
|
+
await hub.emit('profileSettingsUpdated', id);
|
|
23
|
+
return updatedSettings;
|
|
24
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ProfileWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const profilesCache: import("cache-manager").Cache;
|
|
3
|
+
export declare const getProfile: (id: string, ignoreSoftDelete?: boolean) => Promise<ProfileWithMeta | undefined>;
|
|
4
|
+
export declare const getProfileByHandle: (handle: string, ignoreSoftDelete?: boolean) => Promise<ProfileWithMeta | undefined>;
|
|
5
|
+
export declare const getProfiles: (ids: string[]) => Promise<ProfileWithMeta[]>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createCache } from 'cache-manager';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { profilesMapping } from './mapping.js';
|
|
4
|
+
export const profilesCache = createCache({
|
|
5
|
+
ttl: 60 * 60 * 1000,
|
|
6
|
+
refreshThreshold: 60 * 1000,
|
|
7
|
+
});
|
|
8
|
+
export const getProfile = async (id, ignoreSoftDelete = false) => profilesCache.wrap(id, () => allpeepDb().then(({ db }) => ignoreSoftDelete
|
|
9
|
+
? profilesMapping.ignoreSoftDelete().find(db, id)
|
|
10
|
+
: profilesMapping.find(db, id)));
|
|
11
|
+
export const getProfileByHandle = async (handle, ignoreSoftDelete = false) => profilesCache.wrap(handle, () => allpeepDb().then(({ db }) => ignoreSoftDelete
|
|
12
|
+
? profilesMapping
|
|
13
|
+
.ignoreSoftDelete()
|
|
14
|
+
.findOneBy(db, { matches: { handle } })
|
|
15
|
+
: profilesMapping.findOneBy(db, { matches: { handle } })));
|
|
16
|
+
export const getProfiles = async (ids) => profilesCache
|
|
17
|
+
.mget(ids)
|
|
18
|
+
.then((profiles) => Promise.all(profiles.map(async (p, index) => p || (await getProfile(ids[index])))))
|
|
19
|
+
.then((profiles) => profiles.filter((p) => !!p));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { config } from '../config/index.js';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { conflict } from '../errors/index.js';
|
|
4
|
+
import { baseProfilesMapping } from './mapping.js';
|
|
5
|
+
/** Throws when non-deleted profile count is at or above server.maxProfiles. */
|
|
6
|
+
export const assertProfileCapacity = async () => {
|
|
7
|
+
const coreConfig = await config();
|
|
8
|
+
const maxProfiles = coreConfig.server.maxProfiles;
|
|
9
|
+
if (!maxProfiles || maxProfiles <= 0) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const { db } = await allpeepDb();
|
|
13
|
+
const count = await baseProfilesMapping.count(db);
|
|
14
|
+
if (count >= maxProfiles) {
|
|
15
|
+
throw conflict({
|
|
16
|
+
errorKey: 'maxProfilesReached',
|
|
17
|
+
parameters: { maxProfiles, count },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { formatMemberExportCustomFields, toCsvRow, } from '@openpeepshq/common/lib';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { profileFilters } from '../db/pg/filters/index.js';
|
|
4
|
+
import { baseProfilesMapping, membersExportMapping } from './mapping.js';
|
|
5
|
+
import { expandProfiles } from './helpers.js';
|
|
6
|
+
const guestFilter = profileFilters.notGuest();
|
|
7
|
+
const emptyStats = () => ({
|
|
8
|
+
postsCount: 0,
|
|
9
|
+
reactionsCount: 0,
|
|
10
|
+
lastSeen: null,
|
|
11
|
+
});
|
|
12
|
+
const toMemberExportStats = (row) => {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
return ({
|
|
15
|
+
postsCount: (_a = row === null || row === void 0 ? void 0 : row.postsCount) !== null && _a !== void 0 ? _a : 0,
|
|
16
|
+
reactionsCount: (_b = row === null || row === void 0 ? void 0 : row.reactionsCount) !== null && _b !== void 0 ? _b : 0,
|
|
17
|
+
lastSeen: (_c = row === null || row === void 0 ? void 0 : row.lastSeen) !== null && _c !== void 0 ? _c : null,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export const listMembersForExport = async () => {
|
|
21
|
+
const { db } = await allpeepDb();
|
|
22
|
+
const [profiles, statsRows] = await Promise.all([
|
|
23
|
+
baseProfilesMapping.filter(guestFilter).all(db).then(expandProfiles),
|
|
24
|
+
membersExportMapping.filter(guestFilter).all(db),
|
|
25
|
+
]);
|
|
26
|
+
const statsById = new Map(statsRows.map((row) => [row.id, toMemberExportStats(row)]));
|
|
27
|
+
return profiles.map((profile) => {
|
|
28
|
+
var _a;
|
|
29
|
+
return (Object.assign(Object.assign({}, profile), ((_a = statsById.get(profile.id)) !== null && _a !== void 0 ? _a : emptyStats())));
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const formatCustomFields = (fields) => formatMemberExportCustomFields(fields);
|
|
33
|
+
const formatEmailVerified = (controllers) => {
|
|
34
|
+
var _a;
|
|
35
|
+
const validated = (_a = controllers[0]) === null || _a === void 0 ? void 0 : _a.emailValidated;
|
|
36
|
+
return validated == null ? '' : validated ? 'yes' : 'no';
|
|
37
|
+
};
|
|
38
|
+
const formatGroups = (memberships) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = memberships === null || memberships === void 0 ? void 0 : memberships.map((membership) => membership.group.displayName).join('; ')) !== null && _a !== void 0 ? _a : '';
|
|
41
|
+
};
|
|
42
|
+
const formatRoles = (roles) => { var _a; return (_a = roles === null || roles === void 0 ? void 0 : roles.map((role) => role.displayName || role.key).join('; ')) !== null && _a !== void 0 ? _a : ''; };
|
|
43
|
+
const memberExportHeaders = [
|
|
44
|
+
'Email',
|
|
45
|
+
'Email Verified',
|
|
46
|
+
'Profile Created Date',
|
|
47
|
+
'Handle',
|
|
48
|
+
'Display Name',
|
|
49
|
+
'Roles',
|
|
50
|
+
'Bio',
|
|
51
|
+
'Location',
|
|
52
|
+
'Custom Fields',
|
|
53
|
+
'Groups',
|
|
54
|
+
'Last Seen',
|
|
55
|
+
'Posts',
|
|
56
|
+
'Reactions',
|
|
57
|
+
'Followers',
|
|
58
|
+
'Following',
|
|
59
|
+
];
|
|
60
|
+
export const exportMembersCsv = async () => {
|
|
61
|
+
const members = await listMembersForExport();
|
|
62
|
+
return [
|
|
63
|
+
toCsvRow([...memberExportHeaders]),
|
|
64
|
+
...members.map((member) => {
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
66
|
+
return toCsvRow([
|
|
67
|
+
(_b = (_a = member.controllers[0]) === null || _a === void 0 ? void 0 : _a.email) !== null && _b !== void 0 ? _b : '',
|
|
68
|
+
formatEmailVerified(member.controllers),
|
|
69
|
+
member.createdAt,
|
|
70
|
+
member.handle,
|
|
71
|
+
(_c = member.displayName) !== null && _c !== void 0 ? _c : '',
|
|
72
|
+
formatRoles(member.roles),
|
|
73
|
+
(_d = member.bio) !== null && _d !== void 0 ? _d : '',
|
|
74
|
+
(_f = (_e = member.location) === null || _e === void 0 ? void 0 : _e.text) !== null && _f !== void 0 ? _f : '',
|
|
75
|
+
formatCustomFields(member.fields),
|
|
76
|
+
formatGroups(member.memberships),
|
|
77
|
+
(_g = member.lastSeen) !== null && _g !== void 0 ? _g : '',
|
|
78
|
+
member.postsCount,
|
|
79
|
+
member.reactionsCount,
|
|
80
|
+
member.profileStats.followersCount,
|
|
81
|
+
member.profileStats.followingCount,
|
|
82
|
+
]);
|
|
83
|
+
}),
|
|
84
|
+
].join('\n');
|
|
85
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Account, GroupMember, GroupWithMeta, Profile, ProfileWithMeta, Role } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const findProfile: (profileId: string) => Promise<ProfileWithMeta | undefined>;
|
|
3
|
+
export declare const findProfileByHandle: (handle: string) => Promise<ProfileWithMeta | undefined>;
|
|
4
|
+
export declare const existsProfileByHandle: (handle: string) => Promise<boolean>;
|
|
5
|
+
export declare const listProfiles: () => Promise<ProfileWithMeta[]>;
|
|
6
|
+
export declare const listProfilesByRole: (role: Role) => Promise<ProfileWithMeta[]>;
|
|
7
|
+
export declare const listProfilesByAccount: (account: Account) => Promise<ProfileWithMeta[]>;
|
|
8
|
+
export declare const listProfilesWithCapabilities: (capabilities: string[]) => Promise<ProfileWithMeta[]>;
|
|
9
|
+
export declare const follows: (follower: Profile, followed: Profile) => Promise<boolean>;
|
|
10
|
+
export declare const listGroupMembers: (group: GroupWithMeta) => Promise<GroupMember[]>;
|
|
11
|
+
export declare const listCommonGroups: (profile1: ProfileWithMeta, profile2: ProfileWithMeta) => Promise<GroupWithMeta[]>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { accountProfileRelation, baseProfilesMapping, membersRelation, profileRoleRelation, } from './mapping.js';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { profileFilters } from '../db/pg/filters/index.js';
|
|
4
|
+
import { rolesMapping } from '../roles/mapping.js';
|
|
5
|
+
import { findRolesByCapabilities } from '../roles/finders.js';
|
|
6
|
+
import { expandProfiles, followFinder } from './helpers.js';
|
|
7
|
+
import { accountsMapping } from '../accounts/mapping.js';
|
|
8
|
+
import { groupsMapping } from '../groups/mapping.js';
|
|
9
|
+
import { listGroups } from '../groups/index.js';
|
|
10
|
+
import { getProfile, getProfileByHandle } from './cache.js';
|
|
11
|
+
export const findProfile = (profileId) => getProfile(profileId);
|
|
12
|
+
export const findProfileByHandle = (handle) => getProfileByHandle(handle);
|
|
13
|
+
export const existsProfileByHandle = (handle) => getProfileByHandle(handle, true).then(Boolean);
|
|
14
|
+
export const listProfiles = () => allpeepDb()
|
|
15
|
+
.then(({ db }) => baseProfilesMapping.filter(profileFilters.notGuest()).all(db))
|
|
16
|
+
.then(expandProfiles);
|
|
17
|
+
export const listProfilesByRole = (role) => allpeepDb()
|
|
18
|
+
.then(({ db }) => rolesMapping.relationsFrom(role, profileRoleRelation).all(db))
|
|
19
|
+
.then(expandProfiles);
|
|
20
|
+
export const listProfilesByAccount = (account) => allpeepDb()
|
|
21
|
+
.then(({ db }) => accountsMapping.relationsFrom(account, accountProfileRelation).all(db))
|
|
22
|
+
.then(expandProfiles);
|
|
23
|
+
export const listProfilesWithCapabilities = async (capabilities) => findRolesByCapabilities(capabilities)
|
|
24
|
+
.then((roles) => Promise.all(roles.map((role) => listProfilesByRole(role))))
|
|
25
|
+
.then((pp) => pp.flat());
|
|
26
|
+
export const follows = (follower, followed) => allpeepDb().then(({ db }) => followFinder(db, follower, followed).then(Boolean));
|
|
27
|
+
export const listGroupMembers = (group) => allpeepDb()
|
|
28
|
+
.then(({ db }) => groupsMapping.relationsFrom(group, membersRelation).all(db))
|
|
29
|
+
.then((members) => Promise.all(members
|
|
30
|
+
.filter((m) => { var _a; return (_a = m.profile) === null || _a === void 0 ? void 0 : _a.id; })
|
|
31
|
+
.map(async (m) => (Object.assign(Object.assign({}, m), { profile: (await getProfile(m.profile.id)) })))))
|
|
32
|
+
.then((members) => members.filter((m) => !!m.profile));
|
|
33
|
+
export const listCommonGroups = async (profile1, profile2) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const groups = await listGroups({ profile: profile1, scopes: [] });
|
|
36
|
+
const profile1GroupIds = new Set(((_a = profile1.memberships) === null || _a === void 0 ? void 0 : _a.map((m) => m.group.id)) || []);
|
|
37
|
+
const profile2GroupIds = new Set(((_b = profile2.memberships) === null || _b === void 0 ? void 0 : _b.map((m) => m.group.id)) || []);
|
|
38
|
+
return groups.filter((group) => profile1GroupIds.has(group.id) && profile2GroupIds.has(group.id));
|
|
39
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Profile, ProfileWithMeta, Role } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const followConnector: (db: import("../db").PgDb, from: Profile, to: Profile, data?: {
|
|
3
|
+
reblogs?: boolean | undefined;
|
|
4
|
+
notify?: boolean | undefined;
|
|
5
|
+
languages?: string[] | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
id?: string;
|
|
8
|
+
}) => Promise<import("../db/pg/map").WithId<{
|
|
9
|
+
reblogs?: boolean | undefined;
|
|
10
|
+
notify?: boolean | undefined;
|
|
11
|
+
languages?: string[] | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
_from: string;
|
|
14
|
+
_to: string;
|
|
15
|
+
}>>;
|
|
16
|
+
export declare const followDisconnector: (db: import("../db").PgDb, from: Profile, to: Profile) => Promise<void>;
|
|
17
|
+
export declare const followFinder: (db: import("../db").PgDb, from: Profile, to: Profile) => Promise<{} | undefined>;
|
|
18
|
+
export declare const expandProfiles: (profiles: Profile[]) => Promise<ProfileWithMeta[]>;
|
|
19
|
+
export declare const roleAssigner: (db: import("../db").PgDb, from: Profile, to: Role, data?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
}) => Promise<import("../db/pg/map").WithId<{
|
|
22
|
+
_from: string;
|
|
23
|
+
_to: string;
|
|
24
|
+
}>>;
|
|
25
|
+
export declare const roleUnassigner: (db: import("../db").PgDb, from: Profile, to: Role) => Promise<void>;
|
|
26
|
+
export declare const giveControl: (db: import("../db").PgDb, from: {
|
|
27
|
+
id: string;
|
|
28
|
+
}, to: {
|
|
29
|
+
id: string;
|
|
30
|
+
}, data?: {
|
|
31
|
+
id?: string;
|
|
32
|
+
}) => Promise<import("../db/pg/map").WithId<{
|
|
33
|
+
_from: string;
|
|
34
|
+
_to: string;
|
|
35
|
+
}>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { connectionFinder, connector, disconnector } from '../db/helpers.js';
|
|
2
|
+
import { collectionInfos } from '../db/index.js';
|
|
3
|
+
import { getProfiles } from './cache.js';
|
|
4
|
+
export const followConnector = connector(collectionInfos.profilesCollection, collectionInfos.profilesCollection, collectionInfos.followsCollection);
|
|
5
|
+
export const followDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.profilesCollection, collectionInfos.followsCollection);
|
|
6
|
+
export const followFinder = connectionFinder(collectionInfos.profilesCollection, collectionInfos.profilesCollection, collectionInfos.followsCollection);
|
|
7
|
+
export const expandProfiles = (profiles) => getProfiles(profiles.map((p) => p.id));
|
|
8
|
+
export const roleAssigner = connector(collectionInfos.profilesCollection, collectionInfos.rolesCollection, collectionInfos.hasRoleCollection);
|
|
9
|
+
export const roleUnassigner = disconnector(collectionInfos.profilesCollection, collectionInfos.rolesCollection, collectionInfos.hasRoleCollection);
|
|
10
|
+
export const giveControl = connector(collectionInfos.accountsCollection, collectionInfos.profilesCollection, collectionInfos.controlsCollection);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { findProfileByHandle } from './finders.js';
|
|
2
|
+
export * from './mapping.js';
|
|
3
|
+
export * from './mutations.js';
|
|
4
|
+
export * from './finders.js';
|
|
5
|
+
export * from './export.js';
|
|
6
|
+
const sanitizeHandle = (name) => name.replace(/[^a-zA-Z0-9]/g, '-');
|
|
7
|
+
export const findNewFreeHandle = async (seed) => {
|
|
8
|
+
let counter = 2;
|
|
9
|
+
const sanitizedSeed = sanitizeHandle(seed).substring(0, 16);
|
|
10
|
+
let candidate = sanitizedSeed;
|
|
11
|
+
while (await findProfileByHandle(candidate)) {
|
|
12
|
+
const counterString = String(counter);
|
|
13
|
+
candidate =
|
|
14
|
+
sanitizedSeed.substring(0, 16 - counterString.length) + counterString;
|
|
15
|
+
counter++;
|
|
16
|
+
}
|
|
17
|
+
return candidate;
|
|
18
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Relation, RelationWithMapping } from '../db/pg/map';
|
|
2
|
+
import { AccountWithMeta, GroupMember, Profile, ProfileWithMeta } from '@openpeepshq/common/types';
|
|
3
|
+
export declare const profileAccountRelation: RelationWithMapping<AccountWithMeta>;
|
|
4
|
+
export declare const baseProfileRelations: Relation[];
|
|
5
|
+
export declare const profileRelations: Relation[];
|
|
6
|
+
export declare const baseProfilesMapping: import("../db/pg/map").Mapping<{
|
|
7
|
+
handle: string;
|
|
8
|
+
type: "guest" | "local" | "federated";
|
|
9
|
+
deletedHandle?: string | undefined;
|
|
10
|
+
avatar?: string | null | undefined;
|
|
11
|
+
header?: string | null | undefined;
|
|
12
|
+
displayName?: string | undefined;
|
|
13
|
+
bio?: string | undefined;
|
|
14
|
+
timeZone?: string | undefined;
|
|
15
|
+
location?: {
|
|
16
|
+
text: string;
|
|
17
|
+
coordinates?: {
|
|
18
|
+
lat: number;
|
|
19
|
+
lng: number;
|
|
20
|
+
alt?: number | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
} | undefined;
|
|
23
|
+
locked?: boolean | undefined;
|
|
24
|
+
bot?: boolean | undefined;
|
|
25
|
+
discoverable?: boolean | undefined;
|
|
26
|
+
hideSocialGraph?: boolean | undefined;
|
|
27
|
+
indexable?: boolean | undefined;
|
|
28
|
+
fields?: {
|
|
29
|
+
name: string;
|
|
30
|
+
value: string;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
activityPub?: {
|
|
33
|
+
domain: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
guestData?: {
|
|
36
|
+
email?: string | undefined;
|
|
37
|
+
resource?: {
|
|
38
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "jams" | "*" | "jam" | "webhooks" | "analytics" | "render";
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}, Profile, Profile>;
|
|
43
|
+
/** Lean mapping for public search results (memberships only). */
|
|
44
|
+
export declare const publicProfilesSearchMapping: import("../db/pg/map").Mapping<{
|
|
45
|
+
handle: string;
|
|
46
|
+
type: "guest" | "local" | "federated";
|
|
47
|
+
deletedHandle?: string | undefined;
|
|
48
|
+
avatar?: string | null | undefined;
|
|
49
|
+
header?: string | null | undefined;
|
|
50
|
+
displayName?: string | undefined;
|
|
51
|
+
bio?: string | undefined;
|
|
52
|
+
timeZone?: string | undefined;
|
|
53
|
+
location?: {
|
|
54
|
+
text: string;
|
|
55
|
+
coordinates?: {
|
|
56
|
+
lat: number;
|
|
57
|
+
lng: number;
|
|
58
|
+
alt?: number | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
locked?: boolean | undefined;
|
|
62
|
+
bot?: boolean | undefined;
|
|
63
|
+
discoverable?: boolean | undefined;
|
|
64
|
+
hideSocialGraph?: boolean | undefined;
|
|
65
|
+
indexable?: boolean | undefined;
|
|
66
|
+
fields?: {
|
|
67
|
+
name: string;
|
|
68
|
+
value: string;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
activityPub?: {
|
|
71
|
+
domain: string;
|
|
72
|
+
} | undefined;
|
|
73
|
+
guestData?: {
|
|
74
|
+
email?: string | undefined;
|
|
75
|
+
resource?: {
|
|
76
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "jams" | "*" | "jam" | "webhooks" | "analytics" | "render";
|
|
77
|
+
id?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
}, ProfileWithMeta, ProfileWithMeta>;
|
|
81
|
+
export declare const profilesMapping: import("../db/pg/map").Mapping<{
|
|
82
|
+
handle: string;
|
|
83
|
+
type: "guest" | "local" | "federated";
|
|
84
|
+
deletedHandle?: string | undefined;
|
|
85
|
+
avatar?: string | null | undefined;
|
|
86
|
+
header?: string | null | undefined;
|
|
87
|
+
displayName?: string | undefined;
|
|
88
|
+
bio?: string | undefined;
|
|
89
|
+
timeZone?: string | undefined;
|
|
90
|
+
location?: {
|
|
91
|
+
text: string;
|
|
92
|
+
coordinates?: {
|
|
93
|
+
lat: number;
|
|
94
|
+
lng: number;
|
|
95
|
+
alt?: number | undefined;
|
|
96
|
+
} | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
locked?: boolean | undefined;
|
|
99
|
+
bot?: boolean | undefined;
|
|
100
|
+
discoverable?: boolean | undefined;
|
|
101
|
+
hideSocialGraph?: boolean | undefined;
|
|
102
|
+
indexable?: boolean | undefined;
|
|
103
|
+
fields?: {
|
|
104
|
+
name: string;
|
|
105
|
+
value: string;
|
|
106
|
+
}[] | undefined;
|
|
107
|
+
activityPub?: {
|
|
108
|
+
domain: string;
|
|
109
|
+
} | undefined;
|
|
110
|
+
guestData?: {
|
|
111
|
+
email?: string | undefined;
|
|
112
|
+
resource?: {
|
|
113
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "jams" | "*" | "jam" | "webhooks" | "analytics" | "render";
|
|
114
|
+
id?: string | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
}, ProfileWithMeta, ProfileWithMeta>;
|
|
118
|
+
export declare const membersExportMapping: import("../db/pg/map").Mapping<{
|
|
119
|
+
handle: string;
|
|
120
|
+
type: "guest" | "local" | "federated";
|
|
121
|
+
deletedHandle?: string | undefined;
|
|
122
|
+
avatar?: string | null | undefined;
|
|
123
|
+
header?: string | null | undefined;
|
|
124
|
+
displayName?: string | undefined;
|
|
125
|
+
bio?: string | undefined;
|
|
126
|
+
timeZone?: string | undefined;
|
|
127
|
+
location?: {
|
|
128
|
+
text: string;
|
|
129
|
+
coordinates?: {
|
|
130
|
+
lat: number;
|
|
131
|
+
lng: number;
|
|
132
|
+
alt?: number | undefined;
|
|
133
|
+
} | undefined;
|
|
134
|
+
} | undefined;
|
|
135
|
+
locked?: boolean | undefined;
|
|
136
|
+
bot?: boolean | undefined;
|
|
137
|
+
discoverable?: boolean | undefined;
|
|
138
|
+
hideSocialGraph?: boolean | undefined;
|
|
139
|
+
indexable?: boolean | undefined;
|
|
140
|
+
fields?: {
|
|
141
|
+
name: string;
|
|
142
|
+
value: string;
|
|
143
|
+
}[] | undefined;
|
|
144
|
+
activityPub?: {
|
|
145
|
+
domain: string;
|
|
146
|
+
} | undefined;
|
|
147
|
+
guestData?: {
|
|
148
|
+
email?: string | undefined;
|
|
149
|
+
resource?: {
|
|
150
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "jams" | "*" | "jam" | "webhooks" | "analytics" | "render";
|
|
151
|
+
id?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
} | undefined;
|
|
154
|
+
}, Profile, Profile>;
|
|
155
|
+
export declare const membersRelation: RelationWithMapping<ProfileWithMeta, GroupMember>;
|
|
156
|
+
export declare const profileRoleRelation: RelationWithMapping<Profile>;
|
|
157
|
+
export declare const accountProfileRelation: RelationWithMapping<ProfileWithMeta>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { map } from '../db/pg/map/index.js';
|
|
2
|
+
import { groupsMapping } from '../groups/mapping.js';
|
|
3
|
+
import { profileDerived } from '../db/pg/queries/index.js';
|
|
4
|
+
const membersExportStatsRelations = [
|
|
5
|
+
{
|
|
6
|
+
alias: 'reactionsCount',
|
|
7
|
+
edgeCollection: 'reactions',
|
|
8
|
+
direction: 'OUTBOUND',
|
|
9
|
+
count: true,
|
|
10
|
+
cardinality: 'one',
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
export const profileAccountRelation = {
|
|
14
|
+
alias: 'controllers',
|
|
15
|
+
edgeCollection: 'controls',
|
|
16
|
+
direction: 'INBOUND',
|
|
17
|
+
skipEdge: true,
|
|
18
|
+
mapping: {
|
|
19
|
+
collection: 'accounts',
|
|
20
|
+
softDelete: true,
|
|
21
|
+
},
|
|
22
|
+
cardinality: 'many',
|
|
23
|
+
};
|
|
24
|
+
export const baseProfileRelations = [
|
|
25
|
+
{
|
|
26
|
+
alias: 'memberships',
|
|
27
|
+
edgeCollection: 'userGroups',
|
|
28
|
+
vertexAlias: 'group',
|
|
29
|
+
direction: 'OUTBOUND',
|
|
30
|
+
cardinality: 'many',
|
|
31
|
+
mapping: groupsMapping.data(),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
alias: 'roles',
|
|
35
|
+
edgeCollection: 'hasRole',
|
|
36
|
+
direction: 'OUTBOUND',
|
|
37
|
+
skipEdge: true,
|
|
38
|
+
cardinality: 'many',
|
|
39
|
+
},
|
|
40
|
+
profileAccountRelation,
|
|
41
|
+
];
|
|
42
|
+
export const profileRelations = [
|
|
43
|
+
...baseProfileRelations,
|
|
44
|
+
{
|
|
45
|
+
alias: 'followers',
|
|
46
|
+
edgeCollection: 'follows',
|
|
47
|
+
direction: 'INBOUND',
|
|
48
|
+
cardinality: 'many',
|
|
49
|
+
skipEdge: true,
|
|
50
|
+
mapping: {
|
|
51
|
+
softDelete: true,
|
|
52
|
+
collection: 'profiles',
|
|
53
|
+
relations: baseProfileRelations,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
alias: 'following',
|
|
58
|
+
edgeCollection: 'follows',
|
|
59
|
+
direction: 'OUTBOUND',
|
|
60
|
+
skipEdge: true,
|
|
61
|
+
cardinality: 'many',
|
|
62
|
+
mapping: {
|
|
63
|
+
softDelete: true,
|
|
64
|
+
collection: 'profiles',
|
|
65
|
+
relations: baseProfileRelations,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
export const baseProfilesMapping = map({
|
|
70
|
+
collection: 'profiles',
|
|
71
|
+
softDelete: true,
|
|
72
|
+
});
|
|
73
|
+
/** Lean mapping for public search results (memberships only). */
|
|
74
|
+
export const publicProfilesSearchMapping = map({
|
|
75
|
+
collection: 'profiles',
|
|
76
|
+
softDelete: true,
|
|
77
|
+
postFilterRelations: [
|
|
78
|
+
{
|
|
79
|
+
alias: 'memberships',
|
|
80
|
+
edgeCollection: 'userGroups',
|
|
81
|
+
vertexAlias: 'group',
|
|
82
|
+
direction: 'OUTBOUND',
|
|
83
|
+
cardinality: 'many',
|
|
84
|
+
mapping: groupsMapping.data(),
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
export const profilesMapping = map({
|
|
89
|
+
collection: 'profiles',
|
|
90
|
+
postFilterRelations: profileRelations,
|
|
91
|
+
softDelete: true,
|
|
92
|
+
postFilterDerivedProperties: [
|
|
93
|
+
{
|
|
94
|
+
alias: 'profileStats',
|
|
95
|
+
resolve: profileDerived.profileStats,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
export const membersExportMapping = baseProfilesMapping
|
|
100
|
+
.addRelations(membersExportStatsRelations)
|
|
101
|
+
.addDerivedProperty({
|
|
102
|
+
alias: 'postsCount',
|
|
103
|
+
resolve: profileDerived.postsCount,
|
|
104
|
+
})
|
|
105
|
+
.addDerivedProperty({
|
|
106
|
+
alias: 'lastSeen',
|
|
107
|
+
resolve: profileDerived.lastSeen,
|
|
108
|
+
});
|
|
109
|
+
export const membersRelation = {
|
|
110
|
+
alias: 'members',
|
|
111
|
+
vertexAlias: 'profile',
|
|
112
|
+
edgeCollection: 'userGroups',
|
|
113
|
+
direction: 'INBOUND',
|
|
114
|
+
cardinality: 'many',
|
|
115
|
+
mapping: baseProfilesMapping.data(),
|
|
116
|
+
};
|
|
117
|
+
export const profileRoleRelation = {
|
|
118
|
+
alias: 'profiles',
|
|
119
|
+
direction: 'INBOUND',
|
|
120
|
+
edgeCollection: 'hasRole',
|
|
121
|
+
mapping: baseProfilesMapping.data(),
|
|
122
|
+
cardinality: 'many',
|
|
123
|
+
skipEdge: true,
|
|
124
|
+
};
|
|
125
|
+
export const accountProfileRelation = {
|
|
126
|
+
alias: 'profiles',
|
|
127
|
+
edgeCollection: 'controls',
|
|
128
|
+
direction: 'OUTBOUND',
|
|
129
|
+
skipEdge: true,
|
|
130
|
+
mapping: baseProfilesMapping.data(),
|
|
131
|
+
cardinality: 'many',
|
|
132
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Account, FollowData, GuestPassRequest, Profile, ProfileData, Role } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const createProfile: (data: ProfileData, controllingAccount?: Account) => Promise<import("@openpeepshq/common").ProfileWithMeta>;
|
|
3
|
+
export declare const createGuestProfile: (guestPassRequest: GuestPassRequest) => Promise<import("@openpeepshq/common").ProfileWithMeta>;
|
|
4
|
+
export declare const updateProfile: (profileId: string, data: Partial<ProfileData>) => Promise<import("@openpeepshq/common").ProfileWithMeta>;
|
|
5
|
+
export declare const deleteProfile: (profileId: string) => Promise<void>;
|
|
6
|
+
export declare const follow: (follower: Profile, followed: Profile, followData: FollowData) => Promise<void>;
|
|
7
|
+
export declare const unfollow: (follower: Profile, followed: Profile) => Promise<void>;
|
|
8
|
+
export declare const assignRole: (profile: Profile, role: Role) => Promise<boolean>;
|
|
9
|
+
export declare const unassignRole: (profile: Profile, role: Role) => Promise<boolean>;
|