@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,211 @@
|
|
|
1
|
+
import { config } from '@openpeepshq/core/config';
|
|
2
|
+
import { getStripeCustomerId, isOwnerProfile, isStripeActive, } from '@openpeepshq/common/lib';
|
|
3
|
+
import { getUserStripeSubscription, refreshStripeSubscription, stripeCache, } from './cache.js';
|
|
4
|
+
import { findProfileSettings, updateProfileSettings } from '../profileSettings/index.js';
|
|
5
|
+
import { getStripe, initStripeWithCredentials } from './connection.js';
|
|
6
|
+
export const getStripeDetails = async () => {
|
|
7
|
+
var _a;
|
|
8
|
+
const cfg = await config();
|
|
9
|
+
const data = (_a = cfg.payments) === null || _a === void 0 ? void 0 : _a.stripe;
|
|
10
|
+
const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http';
|
|
11
|
+
const success_url = `${protocol}://${cfg.server.host}/payment/success`;
|
|
12
|
+
const cancel_url = `${protocol}://${cfg.server.host}/auth/login`;
|
|
13
|
+
const portal_return_url = `${protocol}://${cfg.server.host}/settings/billing`;
|
|
14
|
+
return Object.assign(Object.assign({}, data), { success_url, cancel_url, portal_return_url });
|
|
15
|
+
};
|
|
16
|
+
export const stripeMembershipActive = async () => {
|
|
17
|
+
var _a;
|
|
18
|
+
const data = await getStripeDetails();
|
|
19
|
+
return !!((_a = data === null || data === void 0 ? void 0 : data.paidMembership) === null || _a === void 0 ? void 0 : _a.enabled);
|
|
20
|
+
};
|
|
21
|
+
const getPrices = async (stripeInstance, productId = '', limit = 1) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (!productId) {
|
|
24
|
+
throw new Error('[STRIPE_PRICE][ERROR] No productId found');
|
|
25
|
+
}
|
|
26
|
+
const product = await stripeInstance.products.retrieve(productId, {
|
|
27
|
+
expand: ['default_price'],
|
|
28
|
+
});
|
|
29
|
+
if (!product) {
|
|
30
|
+
throw new Error('[STRIPE_PRICE][ERROR] No product found');
|
|
31
|
+
}
|
|
32
|
+
const defaultPriceId = typeof product.default_price === 'string'
|
|
33
|
+
? product.default_price
|
|
34
|
+
: ((_b = (_a = product.default_price) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null);
|
|
35
|
+
if (defaultPriceId && limit === 1) {
|
|
36
|
+
try {
|
|
37
|
+
const price = await stripeInstance.prices.retrieve(defaultPriceId);
|
|
38
|
+
return { data: [price] };
|
|
39
|
+
}
|
|
40
|
+
catch (_c) {
|
|
41
|
+
return { data: [] };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return await stripeInstance.prices
|
|
45
|
+
.list({
|
|
46
|
+
product: product.id,
|
|
47
|
+
limit,
|
|
48
|
+
})
|
|
49
|
+
.then((res) => res)
|
|
50
|
+
.catch(() => ({ data: [] }));
|
|
51
|
+
};
|
|
52
|
+
export const testStripeCredentials = async (data) => {
|
|
53
|
+
try {
|
|
54
|
+
const credentials = Object.assign(Object.assign({}, (await getStripeDetails())), data);
|
|
55
|
+
const stripe = initStripeWithCredentials(credentials);
|
|
56
|
+
if (!stripe) {
|
|
57
|
+
return {
|
|
58
|
+
success: false,
|
|
59
|
+
key: 'configuration.server.stripe.errors.invalidCredentials',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const { paidMembership } = credentials;
|
|
63
|
+
const productId = paidMembership === null || paidMembership === void 0 ? void 0 : paidMembership.productId;
|
|
64
|
+
if (!productId) {
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
key: 'configuration.server.stripe.errors.noProductId',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const prices = await getPrices(stripe, paidMembership === null || paidMembership === void 0 ? void 0 : paidMembership.productId, 1);
|
|
71
|
+
if (prices.data.length === 0) {
|
|
72
|
+
return {
|
|
73
|
+
success: false,
|
|
74
|
+
key: 'configuration.server.stripe.errors.noActivePrice',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return { success: true, key: 'configuration.server.stripe.success.test' };
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
return { success: false, key: 'configuration.server.stripe.errors.failed' };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export const createStripeCustomerPortal = async (stripeId) => {
|
|
84
|
+
if (!stripeId) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const { portal_return_url } = (await getStripeDetails());
|
|
88
|
+
try {
|
|
89
|
+
const session = await getStripe().then((stripe) => stripe.billingPortal.sessions.create({
|
|
90
|
+
customer: stripeId,
|
|
91
|
+
return_url: portal_return_url,
|
|
92
|
+
}));
|
|
93
|
+
return session.url;
|
|
94
|
+
}
|
|
95
|
+
catch (_a) { }
|
|
96
|
+
};
|
|
97
|
+
export const createStripeCustomer = async (profile, account) => {
|
|
98
|
+
const profileSettings = await findProfileSettings(profile.id);
|
|
99
|
+
let stripeCustomerId = getStripeCustomerId(profileSettings);
|
|
100
|
+
if (!stripeCustomerId) {
|
|
101
|
+
const customer = await getStripe().then((stripe) => stripe.customers.create({
|
|
102
|
+
email: account.email,
|
|
103
|
+
metadata: {
|
|
104
|
+
userId: profile.id,
|
|
105
|
+
},
|
|
106
|
+
}));
|
|
107
|
+
await updateProfileSettings(profile.id, {
|
|
108
|
+
stripeSettings: {
|
|
109
|
+
customerId: customer.id,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
stripeCustomerId = customer.id;
|
|
113
|
+
}
|
|
114
|
+
return stripeCustomerId;
|
|
115
|
+
};
|
|
116
|
+
const allowedEvents = [
|
|
117
|
+
'checkout.session.completed',
|
|
118
|
+
'customer.subscription.created',
|
|
119
|
+
'customer.subscription.updated',
|
|
120
|
+
'customer.subscription.deleted',
|
|
121
|
+
'customer.subscription.paused',
|
|
122
|
+
'customer.subscription.resumed',
|
|
123
|
+
'customer.subscription.pending_update_applied',
|
|
124
|
+
'customer.subscription.pending_update_expired',
|
|
125
|
+
'customer.subscription.trial_will_end',
|
|
126
|
+
'invoice.paid',
|
|
127
|
+
'invoice.payment_failed',
|
|
128
|
+
'invoice.payment_action_required',
|
|
129
|
+
'invoice.upcoming',
|
|
130
|
+
'invoice.marked_uncollectible',
|
|
131
|
+
'invoice.payment_succeeded',
|
|
132
|
+
'payment_intent.succeeded',
|
|
133
|
+
'payment_intent.payment_failed',
|
|
134
|
+
'payment_intent.canceled',
|
|
135
|
+
];
|
|
136
|
+
export const processEvent = async (event) => {
|
|
137
|
+
var _a;
|
|
138
|
+
if (!allowedEvents.includes(event.type))
|
|
139
|
+
return;
|
|
140
|
+
const { customer: customerId } = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.object;
|
|
141
|
+
if (typeof customerId !== 'string') {
|
|
142
|
+
throw new Error(`[STRIPE HOOK][CANCER] ID isn't string.\nEvent type: ${event.type}`);
|
|
143
|
+
}
|
|
144
|
+
return stripeCache.del(customerId);
|
|
145
|
+
};
|
|
146
|
+
const getOrCreateStripeCustomerId = async (profile, account) => getStripeCustomerId(await findProfileSettings(profile.id)) ||
|
|
147
|
+
(await createStripeCustomer(profile, account));
|
|
148
|
+
export const checkSubscription = async (profile, account, refresh = false) => {
|
|
149
|
+
if ((await stripeMembershipActive()) &&
|
|
150
|
+
profile &&
|
|
151
|
+
profile.type === 'local' &&
|
|
152
|
+
!isOwnerProfile(profile)) {
|
|
153
|
+
if (!account) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
const stripeCustomerId = await getOrCreateStripeCustomerId(profile, account);
|
|
157
|
+
if (!stripeCustomerId) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
const subscription = refresh
|
|
161
|
+
? await refreshStripeSubscription(stripeCustomerId)
|
|
162
|
+
: await getUserStripeSubscription(stripeCustomerId);
|
|
163
|
+
if (!isStripeActive(subscription)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
};
|
|
169
|
+
export const createStripeCheckoutUrl = async (profile, account) => {
|
|
170
|
+
var _a;
|
|
171
|
+
const stripeCustomerId = await getOrCreateStripeCustomerId(profile, account);
|
|
172
|
+
if (!stripeCustomerId) {
|
|
173
|
+
throw new Error('[STRIPE_CHECKOUT][ERROR] No stripe customer id found');
|
|
174
|
+
}
|
|
175
|
+
const { paidMembership, success_url, cancel_url } = (await getStripeDetails());
|
|
176
|
+
const productId = paidMembership === null || paidMembership === void 0 ? void 0 : paidMembership.productId;
|
|
177
|
+
const trialPeriodDays = (_a = paidMembership === null || paidMembership === void 0 ? void 0 : paidMembership.trialPeriodDays) !== null && _a !== void 0 ? _a : 0;
|
|
178
|
+
const prices = await getPrices(await getStripe(), productId, 1);
|
|
179
|
+
const line_items = prices.data.map((price) => ({
|
|
180
|
+
price: price.id,
|
|
181
|
+
quantity: 1,
|
|
182
|
+
}));
|
|
183
|
+
if (line_items.length === 0) {
|
|
184
|
+
throw new Error(`[STRIPE_PRICE][ERROR] No active prices found for product ${productId}`);
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const res = await getUserStripeSubscription(stripeCustomerId);
|
|
188
|
+
let successUrl = success_url;
|
|
189
|
+
if (res !== null && (res === null || res === void 0 ? void 0 : res.status) !== 'none') {
|
|
190
|
+
successUrl = `${success_url}?user=true`;
|
|
191
|
+
}
|
|
192
|
+
const subscription_data = trialPeriodDays > 0
|
|
193
|
+
? {
|
|
194
|
+
trial_period_days: trialPeriodDays,
|
|
195
|
+
}
|
|
196
|
+
: undefined;
|
|
197
|
+
return getStripe()
|
|
198
|
+
.then((stripe) => stripe.checkout.sessions.create({
|
|
199
|
+
customer: stripeCustomerId,
|
|
200
|
+
success_url: successUrl,
|
|
201
|
+
cancel_url,
|
|
202
|
+
line_items,
|
|
203
|
+
mode: 'subscription',
|
|
204
|
+
client_reference_id: profile.id,
|
|
205
|
+
subscription_data,
|
|
206
|
+
allow_promotion_codes: true,
|
|
207
|
+
}))
|
|
208
|
+
.then((session) => { var _a; return (_a = session.url) !== null && _a !== void 0 ? _a : undefined; });
|
|
209
|
+
}
|
|
210
|
+
catch (_b) { }
|
|
211
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openpeepshq/core",
|
|
3
|
+
"version": "0.1.31",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "GPL-3.0-or-later",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@asteasolutions/zod-to-openapi": "^8.5.0",
|
|
8
|
+
"@keyv/redis": "^5.1.4",
|
|
9
|
+
"@sentry/node": "^9.13.0",
|
|
10
|
+
"apns2": "^12.2.0",
|
|
11
|
+
"archiver": "^7.0.1",
|
|
12
|
+
"bcrypt": "^5.1.1",
|
|
13
|
+
"bullmq": "^5.34.7",
|
|
14
|
+
"cache-manager": "^7.2.4",
|
|
15
|
+
"cacheable": "^2.1.1",
|
|
16
|
+
"change-case": "^5.4.4",
|
|
17
|
+
"date-fns": "^4.1.0",
|
|
18
|
+
"deepmerge-ts": "^7.1.3",
|
|
19
|
+
"dotenv": "^16.4.7",
|
|
20
|
+
"drizzle-orm": "^0.44.2",
|
|
21
|
+
"extract-zip": "^2.0.1",
|
|
22
|
+
"firebase-admin": "^13.4.0",
|
|
23
|
+
"fluent-ffmpeg": "^2.1.3",
|
|
24
|
+
"fs-extra": "^11.3.0",
|
|
25
|
+
"html-to-text": "^9.0.5",
|
|
26
|
+
"i18next-fs-backend": "^2.6.0",
|
|
27
|
+
"jose": "^5.9.6",
|
|
28
|
+
"livekit-server-sdk": "^2.15.4",
|
|
29
|
+
"nodemailer": "^6.9.16",
|
|
30
|
+
"pdfkit": "^0.19.1",
|
|
31
|
+
"pg": "^8.16.0",
|
|
32
|
+
"redis": "^4.7.0",
|
|
33
|
+
"safe-json-stringify": "^1.2.0",
|
|
34
|
+
"sharp": "^0.33.5",
|
|
35
|
+
"stripe": "^18.4.0",
|
|
36
|
+
"tweetnacl": "^1.0.3",
|
|
37
|
+
"type-fest": "^4.31.0",
|
|
38
|
+
"uuidv7": "^1.0.2",
|
|
39
|
+
"web-push": "^3.6.7",
|
|
40
|
+
"zod": "^4.4.3",
|
|
41
|
+
"@openpeepshq/common": "0.1.43",
|
|
42
|
+
"@openpeepshq/fetch-client": "^0.1.6",
|
|
43
|
+
"@openpeepshq/i18n": "^0.1.8",
|
|
44
|
+
"@openpeepshq/geocoder": "^0.1.1"
|
|
45
|
+
},
|
|
46
|
+
"main": "dist/index.js",
|
|
47
|
+
"types": "dist/index.d.ts",
|
|
48
|
+
"exports": {
|
|
49
|
+
".": "./dist/index.js",
|
|
50
|
+
"./*": "./dist/*/index.js"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"/dist"
|
|
54
|
+
],
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/archiver": "^6.0.3",
|
|
57
|
+
"@types/bcrypt": "^5.0.2",
|
|
58
|
+
"@types/express": "^5.0.6",
|
|
59
|
+
"@types/fluent-ffmpeg": "^2.1.27",
|
|
60
|
+
"@types/fs-extra": "^11.0.4",
|
|
61
|
+
"@types/html-to-text": "^9.0.4",
|
|
62
|
+
"@types/node": "^22.19.17",
|
|
63
|
+
"@types/nodemailer": "^6.4.17",
|
|
64
|
+
"@types/pdfkit": "^0.17.6",
|
|
65
|
+
"@types/pg": "^8.15.4",
|
|
66
|
+
"@types/safe-json-stringify": "^1.1.5",
|
|
67
|
+
"@types/web-push": "^3.6.4",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.19.1",
|
|
69
|
+
"@typescript-eslint/parser": "^8.19.1",
|
|
70
|
+
"arangojs": "10.0.0",
|
|
71
|
+
"concurrently": "^9.1.2",
|
|
72
|
+
"drizzle-kit": "^0.31.1",
|
|
73
|
+
"eslint": "^9.17.0",
|
|
74
|
+
"eslint-config-prettier": "^9.1.0",
|
|
75
|
+
"google-auth-library": "^10.7.0",
|
|
76
|
+
"i18next": "^24.2.3",
|
|
77
|
+
"prettier": "^3.4.2",
|
|
78
|
+
"tsc-alias": "^1.8.10",
|
|
79
|
+
"typescript": "^5.7.2",
|
|
80
|
+
"vitest": "^2.1.8",
|
|
81
|
+
"@openpeepshq/arango-querybuilder": "^0.4.6"
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"lint": "prettier --check . && ESLINT_USE_FLAT_CONFIG=false eslint .",
|
|
85
|
+
"format": "prettier --write .",
|
|
86
|
+
"test": "vitest run",
|
|
87
|
+
"clean": "rm -rf tsconfig.tsbuildinfo dist",
|
|
88
|
+
"build": "tsc && tsc-alias && rm -rf dist/db/pg/sql && cp -r src/db/pg/sql dist/db/pg/sql",
|
|
89
|
+
"build:watch": "tsc && tsc-alias && (concurrently \"tsc -w\" \"tsc-alias -w\")",
|
|
90
|
+
"uuidv7": "node -e 'import(\"uuidv7\").then(u => console.log(u.uuidv7()))'",
|
|
91
|
+
"create-migration": "node create-migration.js",
|
|
92
|
+
"db:generate": "drizzle-kit generate",
|
|
93
|
+
"db:migrate": "drizzle-kit migrate",
|
|
94
|
+
"db:studio": "drizzle-kit studio",
|
|
95
|
+
"db:export-arango": "pnpm build && node dist/db/migration/cli.js export",
|
|
96
|
+
"db:import-pg": "pnpm build && node dist/db/migration/cli.js import",
|
|
97
|
+
"db:validate-migration": "pnpm build && node dist/db/migration/cli.js validate"
|
|
98
|
+
}
|
|
99
|
+
}
|