@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,167 @@
|
|
|
1
|
+
import { publicProfileWithActivityScoreSchema, publicPostWithActivityScoreSchema, } from '@openpeepshq/common/types';
|
|
2
|
+
import { sub } from 'date-fns';
|
|
3
|
+
import { baseProfilesMapping } from '../profiles/index.js';
|
|
4
|
+
import { allpeepDb } from '../db/index.js';
|
|
5
|
+
import { postsMapping, postsWithReplyCountMapping, postsWithReplyToCountMapping, transformPost, } from '../posts/index.js';
|
|
6
|
+
import { entriesMapping, followsMapping, postsWithActivityScoreMapping, profileWithActivityScoreMapping, reactionsMapping, repostsMapping, } from './mapping.js';
|
|
7
|
+
import { compileStatsWithAll, createdAtFilter } from './helpers.js';
|
|
8
|
+
import { jamParticipantsMapping, jamSessionStartsMapping, } from '../jams/mapping.js';
|
|
9
|
+
import { edgeFilters, postFilters, profileFilters } from '../db/pg/filters/index.js';
|
|
10
|
+
import { sorts } from '../db/pg/queries/index.js';
|
|
11
|
+
import { entries, follows, reactions, repost } from '../db/pg/schema/edges.js';
|
|
12
|
+
import { jamEvents, posts, profiles } from '../db/pg/schema/documents.js';
|
|
13
|
+
export const activeProfilesCount = (db, start, end) => profileWithActivityScoreMapping(start, end)
|
|
14
|
+
.filter(profileFilters.activityScorePositive(start, end))
|
|
15
|
+
.count(db);
|
|
16
|
+
export const activeProfilesStats = () => compileStatsWithAll(activeProfilesCount);
|
|
17
|
+
export const profilesCount = (db, start, end) => baseProfilesMapping.filter(createdAtFilter(profiles, start, end)).count(db);
|
|
18
|
+
export const profileStats = () => compileStatsWithAll(profilesCount);
|
|
19
|
+
export const postsCount = (db, start, end) => postsMapping.filter(createdAtFilter(posts, start, end)).count(db);
|
|
20
|
+
export const postsStats = () => compileStatsWithAll(postsCount);
|
|
21
|
+
export const eventsCount = (db, start, end) => postsMapping
|
|
22
|
+
.filter(createdAtFilter(posts, start, end))
|
|
23
|
+
.filter({ matches: { type: 'event' } })
|
|
24
|
+
.count(db);
|
|
25
|
+
export const postsWithoutReplyCount = (db, start, end) => postsWithReplyCountMapping
|
|
26
|
+
.filter(createdAtFilter(posts, start, end))
|
|
27
|
+
.filter({ matches: { replyCount: 0 } })
|
|
28
|
+
.count(db);
|
|
29
|
+
export const postsWithoutReplyStats = () => compileStatsWithAll(postsWithoutReplyCount);
|
|
30
|
+
export const postsWithRepliesCount = (db, start, end) => postsWithReplyCountMapping
|
|
31
|
+
.filter(createdAtFilter(posts, start, end))
|
|
32
|
+
.filter(postFilters.replyCountPositive())
|
|
33
|
+
.count(db);
|
|
34
|
+
export const postsWithRepliesStats = () => compileStatsWithAll(postsWithRepliesCount);
|
|
35
|
+
export const postsRepliesCount = (db, start, end) => postsWithReplyToCountMapping
|
|
36
|
+
.filter(createdAtFilter(posts, start, end))
|
|
37
|
+
.filter({ matches: { replyToCount: 1 } })
|
|
38
|
+
.count(db);
|
|
39
|
+
export const postsRepliesStats = () => compileStatsWithAll(postsRepliesCount);
|
|
40
|
+
const reactionCount = (db, start, end) => reactionsMapping.filter(createdAtFilter(reactions, start, end)).count(db);
|
|
41
|
+
const rsvpCount = (db, start, end) => entriesMapping
|
|
42
|
+
.filter(createdAtFilter(entries, start, end))
|
|
43
|
+
.filter(edgeFilters.entryType('rsvp'))
|
|
44
|
+
.count(db);
|
|
45
|
+
const followCount = (db, start, end) => followsMapping.filter(createdAtFilter(follows, start, end)).count(db);
|
|
46
|
+
const entryCount = (db, start, end) => entriesMapping.filter(createdAtFilter(entries, start, end)).count(db);
|
|
47
|
+
const repostCount = (db, start, end) => repostsMapping.filter(createdAtFilter(repost, start, end)).count(db);
|
|
48
|
+
const interactionsCount = async (db, start, end) => (await reactionCount(db, start, end)) +
|
|
49
|
+
(await followCount(db, start, end)) +
|
|
50
|
+
(await entryCount(db, start, end)) +
|
|
51
|
+
(await repostCount(db, start, end));
|
|
52
|
+
export const interactionsStats = () => compileStatsWithAll(interactionsCount);
|
|
53
|
+
export const serverCounts = async () => allpeepDb().then(async ({ db }) => {
|
|
54
|
+
const [profiles, posts, events, reactions, rsvps] = await Promise.all([
|
|
55
|
+
profilesCount(db),
|
|
56
|
+
postsCount(db),
|
|
57
|
+
eventsCount(db),
|
|
58
|
+
reactionCount(db),
|
|
59
|
+
rsvpCount(db),
|
|
60
|
+
]);
|
|
61
|
+
return {
|
|
62
|
+
profiles,
|
|
63
|
+
posts,
|
|
64
|
+
events,
|
|
65
|
+
reactions,
|
|
66
|
+
rsvps,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
const jamSessionStarts = (db, start, end) => jamSessionStartsMapping
|
|
70
|
+
.filter(createdAtFilter(jamEvents, start, end))
|
|
71
|
+
.count(db);
|
|
72
|
+
export const jamSessionsStats = () => compileStatsWithAll(jamSessionStarts);
|
|
73
|
+
const jamParticipants = (db, start, end) => jamParticipantsMapping
|
|
74
|
+
.filter(createdAtFilter(jamEvents, start, end))
|
|
75
|
+
.count(db);
|
|
76
|
+
export const jamParticipantsStats = () => compileStatsWithAll(jamParticipants);
|
|
77
|
+
const topPosts = (db, start) => postsWithActivityScoreMapping
|
|
78
|
+
.filter(createdAtFilter(posts, start))
|
|
79
|
+
.sort(sorts.activityScoreDesc)
|
|
80
|
+
.limit(5)
|
|
81
|
+
.all(db)
|
|
82
|
+
.then((posts) => Promise.all(posts.map((post) => transformPost(post))))
|
|
83
|
+
.then((posts) => posts
|
|
84
|
+
.map((post) => publicPostWithActivityScoreSchema.safeParse(post))
|
|
85
|
+
.filter((result) => result.success)
|
|
86
|
+
.map((result) => result.data));
|
|
87
|
+
const topProfiles = (db, start) => profileWithActivityScoreMapping(start, new Date())
|
|
88
|
+
.sort(sorts.activityScoreDesc)
|
|
89
|
+
.limit(5)
|
|
90
|
+
.all(db)
|
|
91
|
+
.then((profiles) => profiles
|
|
92
|
+
.map((profile) => publicProfileWithActivityScoreSchema.safeParse(profile))
|
|
93
|
+
.filter((result) => result.success)
|
|
94
|
+
.map((result) => result.data));
|
|
95
|
+
export const topListsStats = () => allpeepDb().then(async ({ db }) => ({
|
|
96
|
+
posts: {
|
|
97
|
+
day: await topPosts(db, sub(new Date(), { days: 1 })),
|
|
98
|
+
week: await topPosts(db, sub(new Date(), { weeks: 1 })),
|
|
99
|
+
month: await topPosts(db, sub(new Date(), { months: 1 })),
|
|
100
|
+
quarter: await topPosts(db, sub(new Date(), { months: 3 })),
|
|
101
|
+
year: await topPosts(db, sub(new Date(), { years: 1 })),
|
|
102
|
+
},
|
|
103
|
+
profiles: {
|
|
104
|
+
day: await topProfiles(db, sub(new Date(), { days: 1 })),
|
|
105
|
+
week: await topProfiles(db, sub(new Date(), { weeks: 1 })),
|
|
106
|
+
month: await topProfiles(db, sub(new Date(), { months: 1 })),
|
|
107
|
+
quarter: await topProfiles(db, sub(new Date(), { months: 3 })),
|
|
108
|
+
year: await topProfiles(db, sub(new Date(), { years: 1 })),
|
|
109
|
+
},
|
|
110
|
+
}));
|
|
111
|
+
export const newProfilesForInterval = (start, end) => allpeepDb().then(({ db }) => baseProfilesMapping.filter(createdAtFilter(profiles, start, end)).count(db));
|
|
112
|
+
const createIntervals = (duration) => {
|
|
113
|
+
switch (duration) {
|
|
114
|
+
case 'P1W':
|
|
115
|
+
return [0, 1, 2, 3, 4, 5, 6]
|
|
116
|
+
.map((i) => ({
|
|
117
|
+
start: sub(new Date(), { days: i + 1 }),
|
|
118
|
+
end: sub(new Date(), { days: i }),
|
|
119
|
+
}))
|
|
120
|
+
.map((interval) => (Object.assign({ name: interval.start.toISOString().split('T')[0] }, interval)));
|
|
121
|
+
case 'P4W':
|
|
122
|
+
return [0, 1, 2, 3]
|
|
123
|
+
.map((i) => ({
|
|
124
|
+
start: sub(new Date(), { days: (i + 1) * 7 }),
|
|
125
|
+
end: sub(new Date(), { days: i * 7 }),
|
|
126
|
+
}))
|
|
127
|
+
.map((interval) => (Object.assign({ name: `${interval.start.toISOString().split('T')[0]} - ${interval.end.toISOString().split('T')[0]}` }, interval)));
|
|
128
|
+
case 'P120D':
|
|
129
|
+
return [0, 1, 2, 3]
|
|
130
|
+
.map((i) => ({
|
|
131
|
+
start: sub(new Date(), { days: (i + 1) * 30 }),
|
|
132
|
+
end: sub(new Date(), { days: i * 30 }),
|
|
133
|
+
}))
|
|
134
|
+
.map((interval) => (Object.assign({ name: `${interval.start.toISOString().split('T')[0]} - ${interval.end.toISOString().split('T')[0]}` }, interval)));
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
export const signupsTimeline = (duration) => Promise.all(createIntervals(duration).map((interval) => newProfilesForInterval(interval.start, interval.end).then((count) => ({
|
|
138
|
+
name: interval === null || interval === void 0 ? void 0 : interval.name,
|
|
139
|
+
count,
|
|
140
|
+
}))));
|
|
141
|
+
export const serverStats = async () => ({
|
|
142
|
+
profiles: {
|
|
143
|
+
all: await profileStats(),
|
|
144
|
+
active: await activeProfilesStats(),
|
|
145
|
+
},
|
|
146
|
+
posts: {
|
|
147
|
+
all: await postsStats(),
|
|
148
|
+
withoutReply: await postsWithoutReplyStats(),
|
|
149
|
+
withReplies: await postsWithRepliesStats(),
|
|
150
|
+
replies: await postsRepliesStats(),
|
|
151
|
+
},
|
|
152
|
+
interactions: {
|
|
153
|
+
all: await interactionsStats(),
|
|
154
|
+
},
|
|
155
|
+
jams: {
|
|
156
|
+
sessions: await jamSessionsStats(),
|
|
157
|
+
participants: await jamParticipantsStats(),
|
|
158
|
+
},
|
|
159
|
+
topLists: await topListsStats(),
|
|
160
|
+
timelines: {
|
|
161
|
+
signups: {
|
|
162
|
+
week: await signupsTimeline('P1W'),
|
|
163
|
+
fourWeeks: await signupsTimeline('P4W'),
|
|
164
|
+
fourMonths: await signupsTimeline('P120D'),
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PgDb } from '../db/pg/client';
|
|
2
|
+
import { ObjectStats, ObjectStatsWithAll } from '@openpeepshq/common/types';
|
|
3
|
+
import type { SqlFilter } from '../db/pg/filters/types';
|
|
4
|
+
type TimestampTable = {
|
|
5
|
+
createdAt: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const createdAtFilter: (table: TimestampTable, start?: Date, end?: Date) => SqlFilter | undefined;
|
|
8
|
+
export declare const pastStats: (fn: (db: PgDb, start?: Date, end?: Date) => Promise<number>) => Promise<{
|
|
9
|
+
day: number;
|
|
10
|
+
week: number;
|
|
11
|
+
month: number;
|
|
12
|
+
quarter: number;
|
|
13
|
+
year: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const compileStats: (fn: (db: PgDb, start?: Date, end?: Date) => Promise<number>) => Promise<ObjectStats>;
|
|
16
|
+
export declare const compileStatsWithAll: (fn: (db: PgDb, start?: Date, end?: Date) => Promise<number>) => Promise<ObjectStatsWithAll>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { sub } from 'date-fns';
|
|
2
|
+
import { allpeepDb } from '../db/index.js';
|
|
3
|
+
import { createdAtBetween } from '../db/pg/filters/index.js';
|
|
4
|
+
export const createdAtFilter = (table, start, end) => createdAtBetween(table, start, end);
|
|
5
|
+
export const pastStats = async (fn) => allpeepDb().then(async ({ db }) => ({
|
|
6
|
+
day: await fn(db, sub(new Date(), { days: 1 })),
|
|
7
|
+
week: await fn(db, sub(new Date(), { weeks: 1 })),
|
|
8
|
+
month: await fn(db, sub(new Date(), { months: 1 })),
|
|
9
|
+
quarter: await fn(db, sub(new Date(), { months: 3 })),
|
|
10
|
+
year: await fn(db, sub(new Date(), { years: 1 })),
|
|
11
|
+
}));
|
|
12
|
+
export const compileStats = async (fn) => allpeepDb().then(async ({ db }) => ({
|
|
13
|
+
day: {
|
|
14
|
+
currentPeriod: await fn(db, sub(new Date(), { days: 1 })),
|
|
15
|
+
lastPeriod: await fn(db, sub(new Date(), { days: 2 }), sub(new Date(), { days: 1 })),
|
|
16
|
+
},
|
|
17
|
+
week: {
|
|
18
|
+
currentPeriod: await fn(db, sub(new Date(), { weeks: 1 })),
|
|
19
|
+
lastPeriod: await fn(db, sub(new Date(), { weeks: 2 }), sub(new Date(), { weeks: 1 })),
|
|
20
|
+
},
|
|
21
|
+
month: {
|
|
22
|
+
currentPeriod: await fn(db, sub(new Date(), { months: 1 })),
|
|
23
|
+
lastPeriod: await fn(db, sub(new Date(), { months: 2 }), sub(new Date(), { months: 1 })),
|
|
24
|
+
},
|
|
25
|
+
quarter: {
|
|
26
|
+
currentPeriod: await fn(db, sub(new Date(), { months: 3 })),
|
|
27
|
+
lastPeriod: await fn(db, sub(new Date(), { months: 6 }), sub(new Date(), { months: 3 })),
|
|
28
|
+
},
|
|
29
|
+
year: {
|
|
30
|
+
currentPeriod: await fn(db, sub(new Date(), { years: 1 })),
|
|
31
|
+
lastPeriod: await fn(db, sub(new Date(), { years: 2 }), sub(new Date(), { years: 1 })),
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
export const compileStatsWithAll = async (fn) => allpeepDb().then(async ({ db }) => (Object.assign(Object.assign({}, (await compileStats(fn))), { all: await fn(db) })));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './finders';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './finders.js';
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { DbPost } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const profileWithActivityScoreMapping: (start?: Date, end?: Date) => import("../db/pg/map").Mapping<object, import("../db/pg/map").WithId<object>, import("@openpeepshq/common").Profile>;
|
|
3
|
+
export declare const postsWithActivityScoreMapping: import("../db/pg/map").Mapping<{
|
|
4
|
+
type: "note" | "question" | "event" | "article";
|
|
5
|
+
visibility: "direct" | "group" | "local" | "report" | "public" | "unlisted" | "private";
|
|
6
|
+
creatorId: string;
|
|
7
|
+
capabilitiesNeeded?: string[] | undefined;
|
|
8
|
+
data?: {
|
|
9
|
+
type: "note";
|
|
10
|
+
content?: string | undefined;
|
|
11
|
+
sensitive?: boolean | undefined;
|
|
12
|
+
spoilerText?: string | undefined;
|
|
13
|
+
attachments?: {
|
|
14
|
+
type: string;
|
|
15
|
+
url: string;
|
|
16
|
+
previewUrl: string | null;
|
|
17
|
+
textUrl: null;
|
|
18
|
+
filename: string;
|
|
19
|
+
meta: {
|
|
20
|
+
usage?: string | undefined;
|
|
21
|
+
focus?: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
mimetype?: string | undefined;
|
|
26
|
+
size?: number | undefined;
|
|
27
|
+
};
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
blurhash?: string | undefined;
|
|
30
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
31
|
+
error?: string | undefined;
|
|
32
|
+
}[] | undefined;
|
|
33
|
+
customEmojis?: {
|
|
34
|
+
shortcode: string;
|
|
35
|
+
url: string;
|
|
36
|
+
staticUrl: string;
|
|
37
|
+
visibleInPicker: boolean;
|
|
38
|
+
category: string;
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
language?: string | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
type: "question";
|
|
43
|
+
options: {
|
|
44
|
+
content: string;
|
|
45
|
+
type: "note";
|
|
46
|
+
}[];
|
|
47
|
+
content?: string | undefined;
|
|
48
|
+
sensitive?: boolean | undefined;
|
|
49
|
+
spoilerText?: string | undefined;
|
|
50
|
+
attachments?: {
|
|
51
|
+
type: string;
|
|
52
|
+
url: string;
|
|
53
|
+
previewUrl: string | null;
|
|
54
|
+
textUrl: null;
|
|
55
|
+
filename: string;
|
|
56
|
+
meta: {
|
|
57
|
+
usage?: string | undefined;
|
|
58
|
+
focus?: {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
} | undefined;
|
|
62
|
+
mimetype?: string | undefined;
|
|
63
|
+
size?: number | undefined;
|
|
64
|
+
};
|
|
65
|
+
description?: string | undefined;
|
|
66
|
+
blurhash?: string | undefined;
|
|
67
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
68
|
+
error?: string | undefined;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
customEmojis?: {
|
|
71
|
+
shortcode: string;
|
|
72
|
+
url: string;
|
|
73
|
+
staticUrl: string;
|
|
74
|
+
visibleInPicker: boolean;
|
|
75
|
+
category: string;
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
language?: string | undefined;
|
|
78
|
+
multiple?: boolean | undefined;
|
|
79
|
+
votersVisible?: boolean | undefined;
|
|
80
|
+
expiresAt?: string | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
type: "event";
|
|
83
|
+
start: string;
|
|
84
|
+
wholeDay: boolean;
|
|
85
|
+
content?: string | undefined;
|
|
86
|
+
sensitive?: boolean | undefined;
|
|
87
|
+
spoilerText?: string | undefined;
|
|
88
|
+
attachments?: {
|
|
89
|
+
type: string;
|
|
90
|
+
url: string;
|
|
91
|
+
previewUrl: string | null;
|
|
92
|
+
textUrl: null;
|
|
93
|
+
filename: string;
|
|
94
|
+
meta: {
|
|
95
|
+
usage?: string | undefined;
|
|
96
|
+
focus?: {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
} | undefined;
|
|
100
|
+
mimetype?: string | undefined;
|
|
101
|
+
size?: number | undefined;
|
|
102
|
+
};
|
|
103
|
+
description?: string | undefined;
|
|
104
|
+
blurhash?: string | undefined;
|
|
105
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
106
|
+
error?: string | undefined;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
customEmojis?: {
|
|
109
|
+
shortcode: string;
|
|
110
|
+
url: string;
|
|
111
|
+
staticUrl: string;
|
|
112
|
+
visibleInPicker: boolean;
|
|
113
|
+
category: string;
|
|
114
|
+
}[] | undefined;
|
|
115
|
+
language?: string | undefined;
|
|
116
|
+
name?: string | undefined;
|
|
117
|
+
timeZone?: string | undefined;
|
|
118
|
+
image?: string | undefined;
|
|
119
|
+
end?: string | undefined;
|
|
120
|
+
maxAttendees?: number | undefined;
|
|
121
|
+
attendeeListPublic?: boolean | undefined;
|
|
122
|
+
moderators?: string[] | undefined;
|
|
123
|
+
jam?: {
|
|
124
|
+
moderators: string[];
|
|
125
|
+
videoEnabled: boolean;
|
|
126
|
+
type: "video-call";
|
|
127
|
+
speakers?: string[] | undefined;
|
|
128
|
+
presenters?: string[] | undefined;
|
|
129
|
+
audience?: string[] | undefined;
|
|
130
|
+
maxSpeakers?: number | undefined;
|
|
131
|
+
maxPresenters?: number | undefined;
|
|
132
|
+
maxAudience?: number | undefined;
|
|
133
|
+
waitingRoom?: boolean | undefined;
|
|
134
|
+
} | undefined;
|
|
135
|
+
physicalLocation?: {
|
|
136
|
+
text: string;
|
|
137
|
+
coordinates?: {
|
|
138
|
+
lat: number;
|
|
139
|
+
lng: number;
|
|
140
|
+
alt?: number | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
} | undefined;
|
|
143
|
+
url?: string | undefined;
|
|
144
|
+
} | {
|
|
145
|
+
type: "article";
|
|
146
|
+
content?: string | undefined;
|
|
147
|
+
sensitive?: boolean | undefined;
|
|
148
|
+
spoilerText?: string | undefined;
|
|
149
|
+
attachments?: {
|
|
150
|
+
type: string;
|
|
151
|
+
url: string;
|
|
152
|
+
previewUrl: string | null;
|
|
153
|
+
textUrl: null;
|
|
154
|
+
filename: string;
|
|
155
|
+
meta: {
|
|
156
|
+
usage?: string | undefined;
|
|
157
|
+
focus?: {
|
|
158
|
+
x: number;
|
|
159
|
+
y: number;
|
|
160
|
+
} | undefined;
|
|
161
|
+
mimetype?: string | undefined;
|
|
162
|
+
size?: number | undefined;
|
|
163
|
+
};
|
|
164
|
+
description?: string | undefined;
|
|
165
|
+
blurhash?: string | undefined;
|
|
166
|
+
status?: "ready" | "failed" | "processing" | undefined;
|
|
167
|
+
error?: string | undefined;
|
|
168
|
+
}[] | undefined;
|
|
169
|
+
customEmojis?: {
|
|
170
|
+
shortcode: string;
|
|
171
|
+
url: string;
|
|
172
|
+
staticUrl: string;
|
|
173
|
+
visibleInPicker: boolean;
|
|
174
|
+
category: string;
|
|
175
|
+
}[] | undefined;
|
|
176
|
+
language?: string | undefined;
|
|
177
|
+
image?: string | undefined;
|
|
178
|
+
title?: string | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
}, DbPost & {
|
|
181
|
+
activityScore: number;
|
|
182
|
+
}, DbPost & {
|
|
183
|
+
activityScore: number;
|
|
184
|
+
}>;
|
|
185
|
+
export declare const reactionsMapping: import("../db/pg/map").Mapping<object, import("../db/pg/map").WithId<object>, import("../db/pg/map").WithId<object>>;
|
|
186
|
+
export declare const followsMapping: import("../db/pg/map").Mapping<object, import("../db/pg/map").WithId<object>, import("../db/pg/map").WithId<object>>;
|
|
187
|
+
export declare const entriesMapping: import("../db/pg/map").Mapping<object, import("../db/pg/map").WithId<object>, import("../db/pg/map").WithId<object>>;
|
|
188
|
+
export declare const repostsMapping: import("../db/pg/map").Mapping<object, import("../db/pg/map").WithId<object>, import("../db/pg/map").WithId<object>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { collectionInfos } from '../db/index.js';
|
|
2
|
+
import { baseProfilesMapping } from '../profiles/index.js';
|
|
3
|
+
import { postsMapping } from '../posts/index.js';
|
|
4
|
+
import { map } from '../db/pg/map/index.js';
|
|
5
|
+
import { computedFields } from '../db/pg/queries/index.js';
|
|
6
|
+
export const profileWithActivityScoreMapping = (start, end) => map(Object.assign(Object.assign({}, baseProfilesMapping.data()), { activityWindow: { start, end }, computedFields: [computedFields.profileActivityScore({ start, end })] }));
|
|
7
|
+
export const postsWithActivityScoreMapping = map(Object.assign(Object.assign({}, postsMapping.data()), { computedFields: [computedFields.postActivityScore()] }));
|
|
8
|
+
export const reactionsMapping = map({
|
|
9
|
+
collection: collectionInfos.reactionsCollection.name,
|
|
10
|
+
});
|
|
11
|
+
export const followsMapping = map({
|
|
12
|
+
collection: collectionInfos.followsCollection.name,
|
|
13
|
+
});
|
|
14
|
+
export const entriesMapping = map({
|
|
15
|
+
collection: collectionInfos.entriesCollection.name,
|
|
16
|
+
});
|
|
17
|
+
export const repostsMapping = map({
|
|
18
|
+
collection: collectionInfos.repostCollection.name,
|
|
19
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const STRIPE_CACHE_KEY = "stripe-customer-sub:";
|
|
2
|
+
export declare const stripeCache: import("cache-manager").Cache;
|
|
3
|
+
export declare const getUserStripeSubscription: (customerId: string) => Promise<{
|
|
4
|
+
subscriptionId: string | null;
|
|
5
|
+
status: "active" | "paused" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "canceled" | "unpaid";
|
|
6
|
+
priceId: string | null;
|
|
7
|
+
currentPeriodStart: number | null;
|
|
8
|
+
currentPeriodEnd: number | null;
|
|
9
|
+
cancelAtPeriodEnd: boolean;
|
|
10
|
+
paymentMethod: {
|
|
11
|
+
brand: string | null;
|
|
12
|
+
last4: string | null;
|
|
13
|
+
} | null;
|
|
14
|
+
} | {
|
|
15
|
+
status: "none";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const refreshStripeSubscription: (customerId: string) => Promise<{
|
|
18
|
+
subscriptionId: string | null;
|
|
19
|
+
status: "active" | "paused" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "canceled" | "unpaid";
|
|
20
|
+
priceId: string | null;
|
|
21
|
+
currentPeriodStart: number | null;
|
|
22
|
+
currentPeriodEnd: number | null;
|
|
23
|
+
cancelAtPeriodEnd: boolean;
|
|
24
|
+
paymentMethod: {
|
|
25
|
+
brand: string | null;
|
|
26
|
+
last4: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
} | {
|
|
29
|
+
status: "none";
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getStripe } from './connection.js';
|
|
2
|
+
export const STRIPE_CACHE_KEY = 'stripe-customer-sub:';
|
|
3
|
+
import { createCache } from 'cache-manager';
|
|
4
|
+
export const stripeCache = createCache({
|
|
5
|
+
ttl: 60 * 60 * 1000 * 24,
|
|
6
|
+
refreshThreshold: 60 * 60 * 1000,
|
|
7
|
+
});
|
|
8
|
+
const loadStripeSubscription = async (customerId) => {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
const subscriptions = await getStripe().then((stripe) => stripe.subscriptions.list({
|
|
11
|
+
customer: customerId,
|
|
12
|
+
limit: 1,
|
|
13
|
+
status: 'all',
|
|
14
|
+
expand: ['data.default_payment_method'],
|
|
15
|
+
}));
|
|
16
|
+
if (!(subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.data) || (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.data.length) === 0) {
|
|
17
|
+
return { status: 'none' };
|
|
18
|
+
}
|
|
19
|
+
const subscription = subscriptions.data[0];
|
|
20
|
+
return {
|
|
21
|
+
subscriptionId: subscription.id,
|
|
22
|
+
status: subscription.status,
|
|
23
|
+
priceId: subscription.items.data[0].price.id,
|
|
24
|
+
currentPeriodEnd: (_a = subscription.ended_at) !== null && _a !== void 0 ? _a : null,
|
|
25
|
+
currentPeriodStart: (_b = subscription.start_date) !== null && _b !== void 0 ? _b : null,
|
|
26
|
+
cancelAtPeriodEnd: subscription.cancel_at_period_end,
|
|
27
|
+
paymentMethod: subscription.default_payment_method &&
|
|
28
|
+
typeof subscription.default_payment_method !== 'string'
|
|
29
|
+
? {
|
|
30
|
+
brand: (_d = (_c = subscription.default_payment_method.card) === null || _c === void 0 ? void 0 : _c.brand) !== null && _d !== void 0 ? _d : null,
|
|
31
|
+
last4: (_f = (_e = subscription.default_payment_method.card) === null || _e === void 0 ? void 0 : _e.last4) !== null && _f !== void 0 ? _f : null,
|
|
32
|
+
}
|
|
33
|
+
: null,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export const getUserStripeSubscription = async (customerId) => stripeCache.wrap(customerId, async () => loadStripeSubscription(customerId));
|
|
37
|
+
export const refreshStripeSubscription = async (customerId) => stripeCache.del(customerId).then(() => getUserStripeSubscription(customerId));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StripePaymentConfig } from '@openpeepshq/common/types';
|
|
2
|
+
import Stripe from 'stripe';
|
|
3
|
+
export declare const initStripeWithCredentials: (data: StripePaymentConfig) => Stripe | undefined;
|
|
4
|
+
export declare const initStripe: () => Promise<Stripe | undefined>;
|
|
5
|
+
export declare const getStripe: () => Promise<Stripe>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Stripe from 'stripe';
|
|
2
|
+
import { config } from '../config/index.js';
|
|
3
|
+
import { hub } from '../events/index.js';
|
|
4
|
+
export const initStripeWithCredentials = (data) => (data === null || data === void 0 ? void 0 : data.publishableKey) || (data === null || data === void 0 ? void 0 : data.secretKey) || (data === null || data === void 0 ? void 0 : data.webhookSecret)
|
|
5
|
+
? new Stripe(data === null || data === void 0 ? void 0 : data.secretKey, { apiVersion: '2025-07-30.basil' })
|
|
6
|
+
: undefined;
|
|
7
|
+
export const initStripe = async () => {
|
|
8
|
+
var _a;
|
|
9
|
+
hub.on('configUpdated', (namespace, name) => {
|
|
10
|
+
if (namespace === 'openpeeps' && name === 'core') {
|
|
11
|
+
_stripe = null;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const cfg = await config();
|
|
15
|
+
return initStripeWithCredentials((_a = cfg.payments) === null || _a === void 0 ? void 0 : _a.stripe);
|
|
16
|
+
};
|
|
17
|
+
let _stripe = null;
|
|
18
|
+
export const getStripe = async () => {
|
|
19
|
+
if (!_stripe) {
|
|
20
|
+
_stripe = (await initStripe());
|
|
21
|
+
}
|
|
22
|
+
return _stripe;
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type Stripe from 'stripe';
|
|
2
|
+
import type { AccountWithMeta, ProfileWithMeta, StripePaymentConfig } from '@openpeepshq/common/types';
|
|
3
|
+
export declare const getStripeDetails: () => Promise<{
|
|
4
|
+
success_url: string;
|
|
5
|
+
cancel_url: string;
|
|
6
|
+
portal_return_url: string;
|
|
7
|
+
paidMembership?: {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
productId?: string | undefined;
|
|
10
|
+
trialPeriodDays?: number | undefined;
|
|
11
|
+
} | undefined;
|
|
12
|
+
publishableKey?: string | undefined;
|
|
13
|
+
secretKey?: string | undefined;
|
|
14
|
+
webhookSecret?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const stripeMembershipActive: () => Promise<boolean>;
|
|
17
|
+
export declare const testStripeCredentials: (data: StripePaymentConfig) => Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
key: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const createStripeCustomerPortal: (stripeId: string) => Promise<string | undefined>;
|
|
22
|
+
export declare const createStripeCustomer: (profile: ProfileWithMeta, account: AccountWithMeta) => Promise<string>;
|
|
23
|
+
export declare const processEvent: (event: Stripe.Event) => Promise<boolean | undefined>;
|
|
24
|
+
export declare const checkSubscription: (profile?: ProfileWithMeta, account?: AccountWithMeta, refresh?: boolean) => Promise<boolean>;
|
|
25
|
+
export declare const createStripeCheckoutUrl: (profile: ProfileWithMeta, account: AccountWithMeta) => Promise<string | undefined>;
|