@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,93 @@
|
|
|
1
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
2
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
3
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
5
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
6
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
7
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
8
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
9
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
10
|
+
function fulfill(value) { resume("next", value); }
|
|
11
|
+
function reject(value) { resume("throw", value); }
|
|
12
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
13
|
+
};
|
|
14
|
+
import { addFilter } from './helpers.js';
|
|
15
|
+
import { createDocument, deleteDocument, updateDocument } from './mutations.js';
|
|
16
|
+
import { deleteRelationsFor, executeAll, executeCount, executeFind, executeFirst, relationsFrom, } from './relations.js';
|
|
17
|
+
import { buildSearchResult } from './search.js';
|
|
18
|
+
const throwIfUndefined = (message) => (value) => {
|
|
19
|
+
if (value === undefined) {
|
|
20
|
+
throw new Error(`Value is undefined: ${message}`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
export const map = (mapData) => ({
|
|
25
|
+
addRelation: (relation) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return map(Object.assign(Object.assign({}, mapData), { relations: [...((_a = mapData.relations) !== null && _a !== void 0 ? _a : []), relation] }));
|
|
28
|
+
},
|
|
29
|
+
addRelations: (relations) => {
|
|
30
|
+
var _a;
|
|
31
|
+
return map(Object.assign(Object.assign({}, mapData), { relations: [...((_a = mapData.relations) !== null && _a !== void 0 ? _a : []), ...relations] }));
|
|
32
|
+
},
|
|
33
|
+
removeRelation: (predicate) => {
|
|
34
|
+
var _a;
|
|
35
|
+
return map(Object.assign(Object.assign({}, mapData), { relations: (_a = mapData.relations) === null || _a === void 0 ? void 0 : _a.filter(predicate) }));
|
|
36
|
+
},
|
|
37
|
+
addDerivedProperty: (derivedProperty) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return map(Object.assign(Object.assign({}, mapData), { derivedProperties: [
|
|
40
|
+
...((_a = mapData.derivedProperties) !== null && _a !== void 0 ? _a : []),
|
|
41
|
+
derivedProperty,
|
|
42
|
+
] }));
|
|
43
|
+
},
|
|
44
|
+
removeDefaultFilter: () => map(Object.assign(Object.assign({}, mapData), { defaultFilter: undefined })),
|
|
45
|
+
filter: (filter) => map(addFilter(mapData, filter)),
|
|
46
|
+
clearFilters: () => map(Object.assign(Object.assign({}, mapData), { filters: [] })),
|
|
47
|
+
sort: (sort) => sort ? map(Object.assign(Object.assign({}, mapData), { sort })) : map(mapData),
|
|
48
|
+
limit: (limit) => (limit ? map(Object.assign(Object.assign({}, mapData), { limit })) : map(mapData)),
|
|
49
|
+
ignoreSoftDelete: () => map(Object.assign(Object.assign({}, mapData), { softDelete: false })),
|
|
50
|
+
find: (db, id, options) => executeFind(db, mapData.collection, mapData, id, options === null || options === void 0 ? void 0 : options.ignoreSoftDelete),
|
|
51
|
+
findOneBy: (db, filter) => map(addFilter(mapData, filter)).first(db),
|
|
52
|
+
all: (db) => executeAll(db, mapData),
|
|
53
|
+
fulltextSearch: (searchDefinition) => buildSearchResult(mapData, searchDefinition),
|
|
54
|
+
count: (db) => executeCount(db, mapData),
|
|
55
|
+
first: (db) => executeFirst(db, mapData),
|
|
56
|
+
cursor: function (db) {
|
|
57
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
58
|
+
for (const row of yield __await(executeAll(db, mapData))) {
|
|
59
|
+
yield yield __await(row);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
queryBuilder: () => {
|
|
64
|
+
throw new Error('queryBuilder() is not supported for Postgres map()');
|
|
65
|
+
},
|
|
66
|
+
query: () => {
|
|
67
|
+
throw new Error('query() is not supported for Postgres map()');
|
|
68
|
+
},
|
|
69
|
+
data: () => mapData,
|
|
70
|
+
relationsFrom: (start, relation) => {
|
|
71
|
+
const result = {
|
|
72
|
+
all: (db) => relationsFrom(db, start, mapData.collection, relation),
|
|
73
|
+
count: (db) => relationsFrom(db, start, mapData.collection, relation).then((rows) => rows.length),
|
|
74
|
+
first: (db) => relationsFrom(db, start, mapData.collection, relation).then((rows) => rows[0]),
|
|
75
|
+
limit: (limit) => map(mapData).relationsFrom(start, Object.assign(Object.assign({}, relation), { mapping: Object.assign(Object.assign({}, relation.mapping), { limit }) })),
|
|
76
|
+
query: () => {
|
|
77
|
+
throw new Error('query() is not supported for Postgres relationsFrom');
|
|
78
|
+
},
|
|
79
|
+
cursor: function (db) {
|
|
80
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
81
|
+
for (const row of yield __await(relationsFrom(db, start, mapData.collection, relation))) {
|
|
82
|
+
yield yield __await(row);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
return result;
|
|
88
|
+
},
|
|
89
|
+
create: (db, data) => createDocument(db, mapData, data),
|
|
90
|
+
update: (db, id, data) => updateDocument(db, mapData, id, data).then(throwIfUndefined(`update ${mapData.collection} ${id}`)),
|
|
91
|
+
delete: (db, id) => deleteDocument(db, mapData, id),
|
|
92
|
+
deleteRelations: (db, id, relation) => deleteRelationsFor(db, id, relation).then(() => undefined),
|
|
93
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MapData } from './queryTypes';
|
|
2
|
+
import type { PgDb } from '../client';
|
|
3
|
+
export declare const createDocument: <O extends {
|
|
4
|
+
id: string;
|
|
5
|
+
}>(db: PgDb, mapData: MapData<O, O>, data: Record<string, unknown> & {
|
|
6
|
+
id?: string;
|
|
7
|
+
}) => Promise<O>;
|
|
8
|
+
export declare const updateDocument: <O extends {
|
|
9
|
+
id: string;
|
|
10
|
+
}>(db: PgDb, mapData: MapData<O, O>, id: string, patch: Record<string, unknown>) => Promise<O>;
|
|
11
|
+
export declare const deleteDocument: (db: PgDb, mapData: MapData<object, object>, id: string) => Promise<void>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import { uuidv7 } from 'uuidv7';
|
|
3
|
+
import { nowIso } from '../mappers.js';
|
|
4
|
+
import { asTable, documentRegistry, getCollectionConfig, getTableForCollection, } from './registry.js';
|
|
5
|
+
import { executeFind } from './relations.js';
|
|
6
|
+
const EDGE_PATCH_META_KEYS = new Set([
|
|
7
|
+
'id',
|
|
8
|
+
'createdAt',
|
|
9
|
+
'updatedAt',
|
|
10
|
+
'deletedAt',
|
|
11
|
+
'_from',
|
|
12
|
+
'_to',
|
|
13
|
+
'fromId',
|
|
14
|
+
'toId',
|
|
15
|
+
]);
|
|
16
|
+
const edgeBodyPatch = (patch) => {
|
|
17
|
+
const body = {};
|
|
18
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
19
|
+
if (!EDGE_PATCH_META_KEYS.has(key)) {
|
|
20
|
+
body[key] = value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return body;
|
|
24
|
+
};
|
|
25
|
+
export const createDocument = async (db, mapData, data) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const collection = mapData.collection;
|
|
28
|
+
const config = documentRegistry[collection];
|
|
29
|
+
if (!config) {
|
|
30
|
+
throw new Error(`Cannot create in collection: ${collection}`);
|
|
31
|
+
}
|
|
32
|
+
const id = (_a = data.id) !== null && _a !== void 0 ? _a : uuidv7();
|
|
33
|
+
const { scalars, body } = config.splitPatch(data);
|
|
34
|
+
const ts = nowIso();
|
|
35
|
+
await db.insert(config.table).values(Object.assign(Object.assign({ id }, scalars), { body, createdAt: ts, updatedAt: ts, deletedAt: null }));
|
|
36
|
+
const created = await executeFind(db, collection, mapData, id, true);
|
|
37
|
+
if (!created) {
|
|
38
|
+
throw new Error(`create ${collection}`);
|
|
39
|
+
}
|
|
40
|
+
return created;
|
|
41
|
+
};
|
|
42
|
+
export const updateDocument = async (db, mapData, id, patch) => {
|
|
43
|
+
var _a;
|
|
44
|
+
const collection = mapData.collection;
|
|
45
|
+
const config = getCollectionConfig(collection);
|
|
46
|
+
if (!config) {
|
|
47
|
+
throw new Error(`Cannot update collection: ${collection}`);
|
|
48
|
+
}
|
|
49
|
+
const table = asTable(config.table);
|
|
50
|
+
const existing = await db
|
|
51
|
+
.select()
|
|
52
|
+
.from(config.table)
|
|
53
|
+
.where(eq(table.id, id))
|
|
54
|
+
.limit(1);
|
|
55
|
+
const row = existing[0];
|
|
56
|
+
if (!row) {
|
|
57
|
+
throw new Error(`update ${collection} ${id}`);
|
|
58
|
+
}
|
|
59
|
+
if (config.kind === 'edge') {
|
|
60
|
+
const currentBody = Object.assign({}, ((_a = row.body) !== null && _a !== void 0 ? _a : {}));
|
|
61
|
+
await db
|
|
62
|
+
.update(table)
|
|
63
|
+
.set({
|
|
64
|
+
body: Object.assign(Object.assign({}, currentBody), edgeBodyPatch(patch)),
|
|
65
|
+
updatedAt: nowIso(),
|
|
66
|
+
})
|
|
67
|
+
.where(eq(table.id, id));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const merged = Object.assign(Object.assign({}, rowToPatchInput(collection, row)), patch);
|
|
71
|
+
const { scalars, body } = config.splitPatch(merged);
|
|
72
|
+
await db
|
|
73
|
+
.update(table)
|
|
74
|
+
.set(Object.assign(Object.assign({}, scalars), { body, updatedAt: nowIso() }))
|
|
75
|
+
.where(eq(table.id, id));
|
|
76
|
+
}
|
|
77
|
+
const updated = await executeFind(db, collection, mapData, id, true);
|
|
78
|
+
if (!updated) {
|
|
79
|
+
throw new Error(`update ${collection} ${id}`);
|
|
80
|
+
}
|
|
81
|
+
return updated;
|
|
82
|
+
};
|
|
83
|
+
const rowToPatchInput = (collection, row) => {
|
|
84
|
+
switch (collection) {
|
|
85
|
+
case 'posts':
|
|
86
|
+
return {
|
|
87
|
+
type: row.type,
|
|
88
|
+
visibility: row.visibility,
|
|
89
|
+
creatorId: row.creatorId,
|
|
90
|
+
data: row.body,
|
|
91
|
+
};
|
|
92
|
+
case 'profiles':
|
|
93
|
+
return Object.assign(Object.assign({ handle: row.handle, type: row.type }, (row.activityPubDomain
|
|
94
|
+
? { activityPub: { domain: row.activityPubDomain } }
|
|
95
|
+
: {})), row.body);
|
|
96
|
+
case 'groups':
|
|
97
|
+
return Object.assign({ handle: row.handle }, row.body);
|
|
98
|
+
case 'roles':
|
|
99
|
+
return Object.assign({ key: row.key, isDefault: row.isDefault }, row.body);
|
|
100
|
+
case 'notifications':
|
|
101
|
+
return Object.assign({ profileId: row.profileId }, row.body);
|
|
102
|
+
case 'jamEvents':
|
|
103
|
+
return Object.assign({ jamId: row.postId }, row.body);
|
|
104
|
+
case 'processingStats':
|
|
105
|
+
return Object.assign({ filetype: row.filetype, filesize: row.filesize }, row.body);
|
|
106
|
+
case 'profileSettings':
|
|
107
|
+
return Object.assign({ id: row.profileId }, row.body);
|
|
108
|
+
case 'inviteLinks':
|
|
109
|
+
return Object.assign({ slug: row.slug }, row.body);
|
|
110
|
+
case 'accounts':
|
|
111
|
+
return {
|
|
112
|
+
email: row.email,
|
|
113
|
+
passwordHash: row.passwordHash,
|
|
114
|
+
emailValidated: row.emailValidated,
|
|
115
|
+
guest: row.guest,
|
|
116
|
+
};
|
|
117
|
+
case 'hashtags':
|
|
118
|
+
return { tag: row.name };
|
|
119
|
+
default:
|
|
120
|
+
return Object.assign({}, row.body);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
export const deleteDocument = async (db, mapData, id) => {
|
|
124
|
+
const table = asTable(getTableForCollection(mapData.collection));
|
|
125
|
+
if (mapData.softDelete !== false && table.deletedAt) {
|
|
126
|
+
await db
|
|
127
|
+
.update(getTableForCollection(mapData.collection))
|
|
128
|
+
.set({ deletedAt: nowIso(), updatedAt: nowIso() })
|
|
129
|
+
.where(eq(table.id, id));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
await db
|
|
133
|
+
.delete(getTableForCollection(mapData.collection))
|
|
134
|
+
.where(eq(table.id, id));
|
|
135
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { PgDb } from '../client';
|
|
2
|
+
import type { SqlFilter } from '../filters/types';
|
|
3
|
+
import type { SQL } from 'drizzle-orm';
|
|
4
|
+
import type { PgTable } from './registry';
|
|
5
|
+
export type { SqlFilter };
|
|
6
|
+
export type SortDirection = 'ASC' | 'DESC' | undefined;
|
|
7
|
+
export type Limit = number | [number, number];
|
|
8
|
+
export type ObjectSort = [string, SortDirection][];
|
|
9
|
+
export type OMFilterList<O extends object> = {
|
|
10
|
+
operator: '&&' | '||';
|
|
11
|
+
predicates: PgFilter<O>[];
|
|
12
|
+
};
|
|
13
|
+
export type OMMatcher<O extends object> = {
|
|
14
|
+
matches: Partial<O> | Partial<O>[];
|
|
15
|
+
};
|
|
16
|
+
export type OMFilter<O extends object> = string | OMMatcher<O> | OMFilterList<O>;
|
|
17
|
+
export type PgFilter<O extends object = Record<string, unknown>> = OMFilter<O> | SqlFilter;
|
|
18
|
+
export type WithId<T extends object> = T & {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
export type ActivityWindow = {
|
|
22
|
+
start?: Date;
|
|
23
|
+
end?: Date;
|
|
24
|
+
};
|
|
25
|
+
export type ComputedFieldContext = {
|
|
26
|
+
table: PgTable;
|
|
27
|
+
collection: string;
|
|
28
|
+
activityWindow?: ActivityWindow;
|
|
29
|
+
};
|
|
30
|
+
export type ComputedField = {
|
|
31
|
+
alias: string;
|
|
32
|
+
expr: (ctx: ComputedFieldContext) => SQL;
|
|
33
|
+
};
|
|
34
|
+
export type DerivedDoc = Record<string, unknown>;
|
|
35
|
+
export interface DerivedProperty {
|
|
36
|
+
alias: string;
|
|
37
|
+
resolve: (db: PgDb, doc: DerivedDoc) => Promise<unknown> | unknown;
|
|
38
|
+
/** When set, hydrate calls this once per batch instead of per-doc resolve. */
|
|
39
|
+
batchResolve?: (db: PgDb, docs: DerivedDoc[]) => Promise<Map<string, unknown>> | Map<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export type TraversalDirection = 'INBOUND' | 'OUTBOUND' | 'ANY';
|
|
42
|
+
export interface Relation<O extends object = object, E extends object = O> {
|
|
43
|
+
alias: string;
|
|
44
|
+
edgeCollection: string | {
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
direction: TraversalDirection;
|
|
48
|
+
maxDepth?: number;
|
|
49
|
+
edgeFilter?: PgFilter<E>;
|
|
50
|
+
vertexAlias?: string;
|
|
51
|
+
skipEdge?: boolean;
|
|
52
|
+
cardinality: 'one' | 'many';
|
|
53
|
+
mapping?: MapData<O>;
|
|
54
|
+
count?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ForeignKeyRelation<O extends object = object> {
|
|
57
|
+
alias: string;
|
|
58
|
+
foreignKeyProperty: string;
|
|
59
|
+
mapping: MapData<O>;
|
|
60
|
+
cardinality?: 'one' | 'many';
|
|
61
|
+
}
|
|
62
|
+
export type RelationWithMapping<O extends object = object, E extends object = O> = Relation<O, E> & {
|
|
63
|
+
mapping: MapData<O>;
|
|
64
|
+
};
|
|
65
|
+
export interface MapData<O extends object, F extends object = O> {
|
|
66
|
+
collection: string;
|
|
67
|
+
relations?: Relation[];
|
|
68
|
+
foreignKeyRelations?: ForeignKeyRelation[];
|
|
69
|
+
derivedProperties?: DerivedProperty[];
|
|
70
|
+
computedFields?: ComputedField[];
|
|
71
|
+
activityWindow?: ActivityWindow;
|
|
72
|
+
postFilterRelations?: Relation[];
|
|
73
|
+
postFilterForeignKeyRelations?: ForeignKeyRelation[];
|
|
74
|
+
postFilterDerivedProperties?: DerivedProperty[];
|
|
75
|
+
defaultFilter?: PgFilter<F>;
|
|
76
|
+
filters?: PgFilter<F>[];
|
|
77
|
+
sort?: ObjectSort;
|
|
78
|
+
limit?: Limit;
|
|
79
|
+
keepMetadata?: boolean;
|
|
80
|
+
softDelete?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface SearchDefinition {
|
|
83
|
+
view: string;
|
|
84
|
+
analyzer: string;
|
|
85
|
+
fields: string[];
|
|
86
|
+
query: string;
|
|
87
|
+
limit?: Limit;
|
|
88
|
+
}
|
|
89
|
+
export interface CollectionIndex {
|
|
90
|
+
name?: string;
|
|
91
|
+
type?: string;
|
|
92
|
+
fields?: unknown;
|
|
93
|
+
unique?: boolean;
|
|
94
|
+
analyzer?: string;
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
}
|
|
97
|
+
export interface CollectionInfo {
|
|
98
|
+
name: string;
|
|
99
|
+
edge?: boolean;
|
|
100
|
+
indices?: CollectionIndex[];
|
|
101
|
+
}
|
|
102
|
+
export interface ViewInfo {
|
|
103
|
+
name: string;
|
|
104
|
+
type: 'search-alias';
|
|
105
|
+
indexes: {
|
|
106
|
+
collection: string;
|
|
107
|
+
index: string;
|
|
108
|
+
}[];
|
|
109
|
+
}
|
|
110
|
+
export interface QueryResult<T extends object> {
|
|
111
|
+
all: (db: PgDb) => Promise<T[]>;
|
|
112
|
+
count: (db: PgDb) => Promise<number>;
|
|
113
|
+
first: (db: PgDb) => Promise<T | undefined>;
|
|
114
|
+
limit: (limit: Limit) => QueryResult<T>;
|
|
115
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type PgTable = unknown;
|
|
2
|
+
export declare const asTable: (table: PgTable) => Record<string, unknown>;
|
|
3
|
+
export type DocumentConfig = {
|
|
4
|
+
kind: 'document';
|
|
5
|
+
table: PgTable;
|
|
6
|
+
splitPatch: (data: Record<string, unknown>) => {
|
|
7
|
+
scalars: Record<string, unknown>;
|
|
8
|
+
body: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type EdgeConfig = {
|
|
12
|
+
kind: 'edge';
|
|
13
|
+
table: PgTable;
|
|
14
|
+
fromCollection: string;
|
|
15
|
+
toCollection: string;
|
|
16
|
+
};
|
|
17
|
+
export type CollectionConfig = DocumentConfig | EdgeConfig;
|
|
18
|
+
export declare const documentRegistry: Record<string, DocumentConfig>;
|
|
19
|
+
export declare const edgeRegistry: Record<string, EdgeConfig>;
|
|
20
|
+
export declare const getCollectionConfig: (collection: string) => CollectionConfig | undefined;
|
|
21
|
+
export declare const getTableForCollection: (collection: string) => PgTable;
|
|
22
|
+
export declare const isEdgeCollection: (collection: string) => boolean;
|
|
23
|
+
export declare const parseDocRef: (ref: string) => {
|
|
24
|
+
collection: string;
|
|
25
|
+
id: string;
|
|
26
|
+
} | undefined;
|
|
27
|
+
export declare const docRef: (collection: string, id: string) => string;
|
|
28
|
+
export declare const rowToDocument: (collection: string, row: Record<string, unknown>, keepMetadata?: boolean) => Record<string, unknown>;
|
|
29
|
+
export declare const searchViewCollections: Record<string, string>;
|