@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,89 @@
|
|
|
1
|
+
import { notificationAll, } from '@openpeepshq/common/types';
|
|
2
|
+
import { extractMentionHandles } from '@openpeepshq/core/posts';
|
|
3
|
+
import { findPost } from '@openpeepshq/core/posts';
|
|
4
|
+
import { findProfile, findProfileByHandle } from '@openpeepshq/core/profiles';
|
|
5
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
6
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
7
|
+
import { communityConfig } from '../../../config/index.js';
|
|
8
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
9
|
+
const getMentionedProfiles = async (post) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const byId = new Map();
|
|
12
|
+
for (const mention of (_a = post.mentions) !== null && _a !== void 0 ? _a : []) {
|
|
13
|
+
const profile = mention.profile;
|
|
14
|
+
if (profile === null || profile === void 0 ? void 0 : profile.id) {
|
|
15
|
+
byId.set(profile.id, profile);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (byId.size === 0) {
|
|
19
|
+
for (const handle of extractMentionHandles((_b = post.data) === null || _b === void 0 ? void 0 : _b.content)) {
|
|
20
|
+
const profile = await findProfileByHandle(handle);
|
|
21
|
+
if (profile) {
|
|
22
|
+
byId.set(profile.id, profile);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return [...byId.values()];
|
|
27
|
+
};
|
|
28
|
+
export default {
|
|
29
|
+
type: 'mention',
|
|
30
|
+
event: 'postCreated',
|
|
31
|
+
defaultSettings: notificationAll,
|
|
32
|
+
eventHandler: async (data) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const post = data;
|
|
35
|
+
if (((_a = post.data) === null || _a === void 0 ? void 0 : _a.type) === 'event') {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (post.visibility === 'direct') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const mentionedProfiles = await getMentionedProfiles(post);
|
|
42
|
+
if (!mentionedProfiles.length) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let replyTargetProfileId;
|
|
46
|
+
if (post.inReplyToId) {
|
|
47
|
+
const repliedPost = await findPost(post.inReplyToId);
|
|
48
|
+
replyTargetProfileId = (_b = repliedPost === null || repliedPost === void 0 ? void 0 : repliedPost.profile) === null || _b === void 0 ? void 0 : _b.id;
|
|
49
|
+
}
|
|
50
|
+
const notified = new Set();
|
|
51
|
+
for (const mentionedProfile of mentionedProfiles) {
|
|
52
|
+
if (mentionedProfile.id === post.profile.id) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (mentionedProfile.id === replyTargetProfileId) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (notified.has(mentionedProfile.id)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
notified.add(mentionedProfile.id);
|
|
62
|
+
const targetProfile = await findProfile(mentionedProfile.id);
|
|
63
|
+
if (targetProfile) {
|
|
64
|
+
await maybeCreateNotification(targetProfile, {
|
|
65
|
+
type: 'mention',
|
|
66
|
+
postId: post.id,
|
|
67
|
+
fromProfileId: post.profile.id,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
pushRenderer: async (notification) => {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
return ({
|
|
75
|
+
title: `${profileName(notification.senderProfile)} mentioned you`,
|
|
76
|
+
options: {
|
|
77
|
+
body: (_b = (_a = notification.post) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content,
|
|
78
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
79
|
+
actions: [
|
|
80
|
+
{
|
|
81
|
+
action: `goto:/posts/${(_c = notification.post) === null || _c === void 0 ? void 0 : _c.id}`,
|
|
82
|
+
title: 'Go to post',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ExpandedNotification } from '@openpeepshq/common/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
type: string;
|
|
4
|
+
event: string;
|
|
5
|
+
eventHandler: (data: unknown) => Promise<void>;
|
|
6
|
+
pushRenderer: (notification: ExpandedNotification) => Promise<{
|
|
7
|
+
title: string;
|
|
8
|
+
options: {
|
|
9
|
+
body: string | undefined;
|
|
10
|
+
icon: string;
|
|
11
|
+
actions: {
|
|
12
|
+
action: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
invalidateQueries: string[][];
|
|
17
|
+
}>;
|
|
18
|
+
defaultSettings: {
|
|
19
|
+
readonly create: true;
|
|
20
|
+
readonly push: true;
|
|
21
|
+
readonly email: true;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { notificationAll, } from '@openpeepshq/common/types';
|
|
2
|
+
import { listGroupMembers } from '@openpeepshq/core/profiles';
|
|
3
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
4
|
+
import { getGroupAvatar, profileName } from '@openpeepshq/common/lib';
|
|
5
|
+
import { communityConfig } from '../../../config/index.js';
|
|
6
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
7
|
+
const eventHandler = async (data) => {
|
|
8
|
+
const post = data;
|
|
9
|
+
if (!post.group) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const group = post.group;
|
|
13
|
+
for (const groupMember of await listGroupMembers(group).then((members) => members
|
|
14
|
+
.map((m) => m.profile)
|
|
15
|
+
.filter((profile) => post.profile.id !== profile.id))) {
|
|
16
|
+
await maybeCreateNotification(groupMember, {
|
|
17
|
+
type: 'newGroupPost',
|
|
18
|
+
fromProfileId: post.profile.id,
|
|
19
|
+
postId: post.id,
|
|
20
|
+
groupId: group.id,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const pushRenderer = async (notification) => {
|
|
25
|
+
var _a, _b, _c, _d, _e;
|
|
26
|
+
return ({
|
|
27
|
+
title: `${profileName((_a = notification.post) === null || _a === void 0 ? void 0 : _a.profile)} made a post in ${(_b = notification === null || notification === void 0 ? void 0 : notification.group) === null || _b === void 0 ? void 0 : _b.displayName}`,
|
|
28
|
+
options: {
|
|
29
|
+
body: (_d = (_c = notification.post) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.content,
|
|
30
|
+
icon: getGroupAvatar(notification.group, await communityConfig()),
|
|
31
|
+
actions: [
|
|
32
|
+
{
|
|
33
|
+
action: `goto:/groups/@${(_e = notification.group) === null || _e === void 0 ? void 0 : _e.handle}`,
|
|
34
|
+
title: 'Go to post',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
invalidateQueries: [PUSH_INVALIDATE.posts, PUSH_INVALIDATE.unseenCounts],
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export default {
|
|
42
|
+
type: 'newGroupPost',
|
|
43
|
+
event: 'postCreated',
|
|
44
|
+
eventHandler,
|
|
45
|
+
pushRenderer,
|
|
46
|
+
defaultSettings: notificationAll,
|
|
47
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
type: string;
|
|
3
|
+
event: string;
|
|
4
|
+
requiredCapabilities: "core-profiles-roles-update"[];
|
|
5
|
+
defaultSettings: {
|
|
6
|
+
readonly create: true;
|
|
7
|
+
readonly push: true;
|
|
8
|
+
readonly email: true;
|
|
9
|
+
};
|
|
10
|
+
eventHandler: (data: unknown) => Promise<void>;
|
|
11
|
+
pushRenderer: (notification: import("@openpeepshq/common").ExpandedNotification) => Promise<{
|
|
12
|
+
title: string;
|
|
13
|
+
options: {
|
|
14
|
+
body: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
actions: {
|
|
17
|
+
action: string;
|
|
18
|
+
title: string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
invalidateQueries: string[][];
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { notificationAll, } from '@openpeepshq/common/types';
|
|
2
|
+
import { listProfilesWithCapabilities } from '@openpeepshq/core/profiles';
|
|
3
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
4
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
5
|
+
import { communityConfig } from '../../../config/index.js';
|
|
6
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
7
|
+
export default {
|
|
8
|
+
type: 'newProfile',
|
|
9
|
+
event: 'profileCreated',
|
|
10
|
+
requiredCapabilities: ['core-profiles-roles-update'],
|
|
11
|
+
defaultSettings: notificationAll,
|
|
12
|
+
eventHandler: async (data) => {
|
|
13
|
+
const profile = data;
|
|
14
|
+
for (const recipientProfile of await listProfilesWithCapabilities([
|
|
15
|
+
'core-profiles-roles-update',
|
|
16
|
+
])) {
|
|
17
|
+
await maybeCreateNotification(recipientProfile, {
|
|
18
|
+
type: 'newProfile',
|
|
19
|
+
fromProfileId: profile.id,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
pushRenderer: async (notification) => {
|
|
24
|
+
var _a;
|
|
25
|
+
return ({
|
|
26
|
+
title: `New user ${profileName(notification.senderProfile)} joined`,
|
|
27
|
+
options: {
|
|
28
|
+
body: "Let's welcome them!",
|
|
29
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
30
|
+
actions: [
|
|
31
|
+
{
|
|
32
|
+
action: `goto:/@${(_a = notification.senderProfile) === null || _a === void 0 ? void 0 : _a.handle}`,
|
|
33
|
+
title: 'View Profile',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
invalidateQueries: [PUSH_INVALIDATE.profiles],
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpandedNotification } from '@openpeepshq/common/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
type: string;
|
|
4
|
+
event: string;
|
|
5
|
+
eventHandler: (senderProfile: unknown, post: unknown, data: unknown) => Promise<void>;
|
|
6
|
+
pushRenderer: (notification: ExpandedNotification) => Promise<{
|
|
7
|
+
title: string;
|
|
8
|
+
options: {
|
|
9
|
+
body: string | undefined;
|
|
10
|
+
icon: string;
|
|
11
|
+
actions: {
|
|
12
|
+
action: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
invalidateQueries: string[][];
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
2
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
3
|
+
import { communityConfig } from '../../../config/index.js';
|
|
4
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
5
|
+
const eventHandler = async (senderProfile, post, data) => {
|
|
6
|
+
const mergedPost = post;
|
|
7
|
+
const fromProfile = senderProfile;
|
|
8
|
+
const entryData = data;
|
|
9
|
+
if (entryData.type !== 'answer') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
await maybeCreateNotification(mergedPost.profile, {
|
|
13
|
+
type: 'pollVote',
|
|
14
|
+
postId: mergedPost.id,
|
|
15
|
+
fromProfileId: fromProfile.id,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const pushRenderer = async (notification) => {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
return ({
|
|
21
|
+
title: `New vote on your poll by ${profileName(notification.senderProfile)}`,
|
|
22
|
+
options: {
|
|
23
|
+
body: (_b = (_a = notification.post) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content,
|
|
24
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
25
|
+
actions: [
|
|
26
|
+
{
|
|
27
|
+
action: `goto:/posts/${(_c = notification.post) === null || _c === void 0 ? void 0 : _c.id}`,
|
|
28
|
+
title: 'View Poll',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export default {
|
|
36
|
+
type: 'pollVote',
|
|
37
|
+
event: 'entryCreated',
|
|
38
|
+
eventHandler,
|
|
39
|
+
pushRenderer,
|
|
40
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
type: string;
|
|
3
|
+
event: string;
|
|
4
|
+
pushRenderer: (notification: import("@openpeepshq/common").ExpandedNotification) => Promise<{
|
|
5
|
+
title: string;
|
|
6
|
+
options: {
|
|
7
|
+
body: string | undefined;
|
|
8
|
+
icon: string;
|
|
9
|
+
actions: {
|
|
10
|
+
action: string;
|
|
11
|
+
title: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
invalidateQueries: string[][];
|
|
15
|
+
}>;
|
|
16
|
+
eventHandler: (...eventData: unknown[]) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { findProfile } from '@openpeepshq/core/profiles';
|
|
2
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
3
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
4
|
+
import { communityConfig } from '../../../config/index.js';
|
|
5
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
6
|
+
export default {
|
|
7
|
+
type: 'reaction',
|
|
8
|
+
event: 'reactionCreated',
|
|
9
|
+
pushRenderer: async (notification) => {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
return ({
|
|
12
|
+
title: profileName(notification.senderProfile) +
|
|
13
|
+
' reacted with ' +
|
|
14
|
+
notification.data.reaction +
|
|
15
|
+
' to your post',
|
|
16
|
+
options: {
|
|
17
|
+
body: (_b = (_a = notification.post) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content,
|
|
18
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
19
|
+
actions: [
|
|
20
|
+
{
|
|
21
|
+
action: `goto:/posts/${(_c = notification.post) === null || _c === void 0 ? void 0 : _c.id}`,
|
|
22
|
+
title: 'Go to post',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
eventHandler: async (...eventData) => {
|
|
30
|
+
const [profile, post, data] = eventData;
|
|
31
|
+
const recipientProfile = await findProfile(post.profile.id);
|
|
32
|
+
if (recipientProfile && (recipientProfile === null || recipientProfile === void 0 ? void 0 : recipientProfile.id) !== profile.id) {
|
|
33
|
+
await maybeCreateNotification(recipientProfile, {
|
|
34
|
+
type: 'reaction',
|
|
35
|
+
fromProfileId: profile.id,
|
|
36
|
+
postId: post.id,
|
|
37
|
+
data: {
|
|
38
|
+
reaction: data.reaction,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExpandedNotification } from '@openpeepshq/common/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
type: string;
|
|
4
|
+
event: string;
|
|
5
|
+
defaultSettings: {
|
|
6
|
+
readonly create: true;
|
|
7
|
+
readonly push: true;
|
|
8
|
+
readonly email: true;
|
|
9
|
+
};
|
|
10
|
+
eventHandler: (data: unknown) => Promise<void>;
|
|
11
|
+
expander: (notification: ExpandedNotification) => Promise<ExpandedNotification>;
|
|
12
|
+
pushRenderer: (notification: ExpandedNotification) => Promise<{
|
|
13
|
+
title: string;
|
|
14
|
+
options: {
|
|
15
|
+
body: string | undefined;
|
|
16
|
+
icon: string;
|
|
17
|
+
actions: {
|
|
18
|
+
action: string;
|
|
19
|
+
title: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
invalidateQueries: string[][];
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { notificationAll, } from '@openpeepshq/common/types';
|
|
2
|
+
import { findPost } from '@openpeepshq/core/posts';
|
|
3
|
+
import { findProfile } from '@openpeepshq/core/profiles';
|
|
4
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
5
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
6
|
+
import { communityConfig } from '../../../config/index.js';
|
|
7
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
8
|
+
export default {
|
|
9
|
+
type: 'reply',
|
|
10
|
+
event: 'postCreated',
|
|
11
|
+
defaultSettings: notificationAll,
|
|
12
|
+
eventHandler: async (data) => {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const post = data;
|
|
15
|
+
if (((_a = post.data) === null || _a === void 0 ? void 0 : _a.type) === 'event') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (post.visibility === 'direct') {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!post.inReplyToId) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const repliedPost = await findPost(post.inReplyToId);
|
|
25
|
+
const targetProfile = await findProfile((_c = (_b = repliedPost === null || repliedPost === void 0 ? void 0 : repliedPost.profile) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : '');
|
|
26
|
+
if (targetProfile && targetProfile.id !== post.profile.id) {
|
|
27
|
+
await maybeCreateNotification(targetProfile, {
|
|
28
|
+
type: 'reply',
|
|
29
|
+
postId: post.inReplyToId,
|
|
30
|
+
fromProfileId: post.profile.id,
|
|
31
|
+
data: {
|
|
32
|
+
replyPostId: post.id,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
expander: async (notification) => (Object.assign(Object.assign({}, notification), { data: {
|
|
38
|
+
replyPost: await findPost(notification.data.replyPostId),
|
|
39
|
+
} })),
|
|
40
|
+
pushRenderer: async (notification) => {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
return ({
|
|
43
|
+
title: `${profileName(notification.senderProfile)} replied your post`,
|
|
44
|
+
options: {
|
|
45
|
+
body: (_b = (_a = notification.post) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content,
|
|
46
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
47
|
+
actions: [
|
|
48
|
+
{
|
|
49
|
+
action: `goto:/posts/${(_c = notification.post) === null || _c === void 0 ? void 0 : _c.id}`,
|
|
50
|
+
title: 'Go to post',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
type: string;
|
|
3
|
+
event: string;
|
|
4
|
+
eventHandler: (data: unknown) => Promise<void>;
|
|
5
|
+
pushRenderer: (notification: import("@openpeepshq/common").ExpandedNotification) => Promise<{
|
|
6
|
+
title: string;
|
|
7
|
+
options: {
|
|
8
|
+
body: string | undefined;
|
|
9
|
+
icon: string;
|
|
10
|
+
actions: {
|
|
11
|
+
action: string;
|
|
12
|
+
title: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
invalidateQueries: string[][];
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { findProfile } from '@openpeepshq/core/profiles';
|
|
2
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
3
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
4
|
+
import { communityConfig } from '../../../config/index.js';
|
|
5
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
6
|
+
export default {
|
|
7
|
+
type: 'repost',
|
|
8
|
+
event: 'postCreated',
|
|
9
|
+
eventHandler: async (data) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const post = data;
|
|
12
|
+
if (((_a = post.data) === null || _a === void 0 ? void 0 : _a.type) === 'event')
|
|
13
|
+
return;
|
|
14
|
+
if (post.repost) {
|
|
15
|
+
const recipientProfile = await findProfile(post.repost.profile.id);
|
|
16
|
+
if (recipientProfile && (recipientProfile === null || recipientProfile === void 0 ? void 0 : recipientProfile.id) !== post.profile.id) {
|
|
17
|
+
await maybeCreateNotification(recipientProfile, {
|
|
18
|
+
type: 'repost',
|
|
19
|
+
postId: post.repost.id,
|
|
20
|
+
fromProfileId: post.profile.id,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
pushRenderer: async (notification) => {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
return ({
|
|
28
|
+
title: `${profileName(notification.senderProfile)} reposted your post`,
|
|
29
|
+
options: {
|
|
30
|
+
body: (_b = (_a = notification.post) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content,
|
|
31
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
32
|
+
actions: [
|
|
33
|
+
{
|
|
34
|
+
action: `goto:/posts/${(_c = notification.post) === null || _c === void 0 ? void 0 : _c.id}`,
|
|
35
|
+
title: 'Go to post',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpandedNotification } from '@openpeepshq/common/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
type: string;
|
|
4
|
+
event: string;
|
|
5
|
+
eventHandler: (senderProfile: unknown, post: unknown, data: unknown) => Promise<void>;
|
|
6
|
+
pushRenderer: (notification: ExpandedNotification) => Promise<{
|
|
7
|
+
title: string;
|
|
8
|
+
options: {
|
|
9
|
+
body: string | undefined;
|
|
10
|
+
icon: string;
|
|
11
|
+
actions: {
|
|
12
|
+
action: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
invalidateQueries: string[][];
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
2
|
+
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
3
|
+
import { communityConfig } from '../../../config/index.js';
|
|
4
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
5
|
+
const eventHandler = async (senderProfile, post, data) => {
|
|
6
|
+
const mergedPost = post;
|
|
7
|
+
const fromProfile = senderProfile;
|
|
8
|
+
const entryData = data;
|
|
9
|
+
if (entryData.type !== 'rsvp') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
await maybeCreateNotification(mergedPost.profile, {
|
|
13
|
+
type: 'rsvp',
|
|
14
|
+
postId: mergedPost.id,
|
|
15
|
+
fromProfileId: fromProfile.id,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const pushRenderer = async (notification) => {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
return ({
|
|
21
|
+
title: `${profileName(notification.senderProfile)} RSVP'd to your event`,
|
|
22
|
+
options: {
|
|
23
|
+
body: (_b = (_a = notification.post) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content,
|
|
24
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
25
|
+
actions: [
|
|
26
|
+
{
|
|
27
|
+
action: `goto:/posts/${(_c = notification.post) === null || _c === void 0 ? void 0 : _c.id}`,
|
|
28
|
+
title: 'View RSVP',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export default {
|
|
36
|
+
type: 'rsvp',
|
|
37
|
+
event: 'rsvpCreated',
|
|
38
|
+
eventHandler,
|
|
39
|
+
pushRenderer,
|
|
40
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import https from 'node:https';
|
|
2
|
+
type FcmServiceAccount = {
|
|
3
|
+
client_email: string;
|
|
4
|
+
private_key: string;
|
|
5
|
+
project_id?: string;
|
|
6
|
+
};
|
|
7
|
+
type AccessTokenResponse = {
|
|
8
|
+
access_token: string;
|
|
9
|
+
expires_in: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const createFcmCredential: (serviceAccount: FcmServiceAccount, agent: https.Agent) => {
|
|
12
|
+
getAccessToken: () => Promise<AccessTokenResponse>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createSign } from 'node:crypto';
|
|
2
|
+
import https from 'node:https';
|
|
3
|
+
const FCM_SCOPE = 'https://www.googleapis.com/auth/firebase.messaging';
|
|
4
|
+
const TOKEN_HOST = 'oauth2.googleapis.com';
|
|
5
|
+
const TOKEN_PATH = '/token';
|
|
6
|
+
const signJwt = (serviceAccount) => {
|
|
7
|
+
const now = Math.floor(Date.now() / 1000);
|
|
8
|
+
const header = Buffer.from(JSON.stringify({ alg: 'RS256', typ: 'JWT' })).toString('base64url');
|
|
9
|
+
const claim = Buffer.from(JSON.stringify({
|
|
10
|
+
iss: serviceAccount.client_email,
|
|
11
|
+
scope: FCM_SCOPE,
|
|
12
|
+
aud: `https://${TOKEN_HOST}${TOKEN_PATH}`,
|
|
13
|
+
iat: now,
|
|
14
|
+
exp: now + 3600,
|
|
15
|
+
})).toString('base64url');
|
|
16
|
+
const signInput = `${header}.${claim}`;
|
|
17
|
+
const signature = createSign('RSA-SHA256')
|
|
18
|
+
.update(signInput)
|
|
19
|
+
.sign(serviceAccount.private_key, 'base64url');
|
|
20
|
+
return `${signInput}.${signature}`;
|
|
21
|
+
};
|
|
22
|
+
const fetchAccessToken = (serviceAccount, agent) => new Promise((resolve, reject) => {
|
|
23
|
+
const body = `grant_type=${encodeURIComponent('urn:ietf:params:oauth:grant-type:jwt-bearer')}&assertion=${signJwt(serviceAccount)}`;
|
|
24
|
+
const req = https.request({
|
|
25
|
+
hostname: TOKEN_HOST,
|
|
26
|
+
path: TOKEN_PATH,
|
|
27
|
+
method: 'POST',
|
|
28
|
+
agent,
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
31
|
+
'Content-Length': Buffer.byteLength(body),
|
|
32
|
+
},
|
|
33
|
+
}, (res) => {
|
|
34
|
+
let data = '';
|
|
35
|
+
res.on('data', (chunk) => {
|
|
36
|
+
data += chunk;
|
|
37
|
+
});
|
|
38
|
+
res.on('end', () => {
|
|
39
|
+
if (res.statusCode !== 200) {
|
|
40
|
+
reject(new Error(`FCM OAuth token request failed (${res.statusCode}): ${data}`));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
resolve(JSON.parse(data));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
req.on('error', reject);
|
|
47
|
+
req.end(body);
|
|
48
|
+
});
|
|
49
|
+
export const createFcmCredential = (serviceAccount, agent) => {
|
|
50
|
+
let cached;
|
|
51
|
+
return {
|
|
52
|
+
getAccessToken: async () => {
|
|
53
|
+
const now = Date.now();
|
|
54
|
+
if (cached && cached.expiresAt > now + 60000) {
|
|
55
|
+
return {
|
|
56
|
+
access_token: cached.access_token,
|
|
57
|
+
expires_in: Math.floor((cached.expiresAt - now) / 1000),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const token = await fetchAccessToken(serviceAccount, agent);
|
|
61
|
+
cached = {
|
|
62
|
+
access_token: token.access_token,
|
|
63
|
+
expiresAt: now + token.expires_in * 1000,
|
|
64
|
+
};
|
|
65
|
+
return token;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExpandedNotification, NotificationStats, ProfileWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const findNotification: (profile: ProfileWithMeta, notificationId: string) => Promise<ExpandedNotification | undefined>;
|
|
3
|
+
export declare const listNotificationsByProfile: (profile: ProfileWithMeta, { start, limit }?: {
|
|
4
|
+
start?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
}) => Promise<ExpandedNotification[]>;
|
|
7
|
+
export declare const getNotificationStats: (profile: ProfileWithMeta) => Promise<NotificationStats>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { allpeepDb } from '../db/index.js';
|
|
2
|
+
import { addStart, filterAndTransform } from '../db/helpers.js';
|
|
3
|
+
import { baseListNotifications, expandNotification, unreadNotifications, unseenNotifications, } from './helpers.js';
|
|
4
|
+
export const findNotification = (profile, notificationId) => allpeepDb()
|
|
5
|
+
.then(({ db }) => baseListNotifications(profile).find(db, notificationId))
|
|
6
|
+
.then((notification) => (notification === null || notification === void 0 ? void 0 : notification.profileId) === profile.id
|
|
7
|
+
? expandNotification(notification)
|
|
8
|
+
: undefined);
|
|
9
|
+
export const listNotificationsByProfile = (profile, { start, limit = 100 } = { limit: 100 }) => allpeepDb().then(({ db }) => filterAndTransform(addStart(baseListNotifications(profile), start), db, { transform: expandNotification, limit }));
|
|
10
|
+
export const getNotificationStats = async (profile) => ({
|
|
11
|
+
unread: await unreadNotifications(profile),
|
|
12
|
+
unseen: await unseenNotifications(profile),
|
|
13
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initializeFirebase: () => Promise<void>;
|