@atproto/bsky 0.0.242 → 0.0.244
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/CHANGELOG.md +27 -0
- package/dist/api/app/bsky/actor/searchActors.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/searchActors.js +7 -3
- package/dist/api/app/bsky/actor/searchActors.js.map +1 -1
- package/dist/api/app/bsky/actor/searchActorsTypeahead.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/searchActorsTypeahead.js +12 -6
- package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.js +8 -3
- package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.js +7 -3
- package/dist/api/app/bsky/graph/searchStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/notification/putPreferencesV2.js +4 -1
- package/dist/api/app/bsky/notification/putPreferencesV2.js.map +1 -1
- package/dist/api/app/bsky/notification/util.d.ts +1 -0
- package/dist/api/app/bsky/notification/util.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/util.js +7 -7
- package/dist/api/app/bsky/notification/util.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js +3 -2
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js.map +1 -1
- package/dist/api/blob-dispatcher.d.ts.map +1 -1
- package/dist/api/blob-dispatcher.js +9 -8
- package/dist/api/blob-dispatcher.js.map +1 -1
- package/dist/api/blob-resolver.d.ts +1 -1
- package/dist/api/blob-resolver.d.ts.map +1 -1
- package/dist/api/blob-resolver.js +0 -1
- package/dist/api/blob-resolver.js.map +1 -1
- package/dist/api/util.d.ts +5 -0
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +11 -0
- package/dist/api/util.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/data-plane/bsync/index.d.ts +2 -0
- package/dist/data-plane/bsync/index.d.ts.map +1 -1
- package/dist/data-plane/bsync/index.js +7 -10
- package/dist/data-plane/bsync/index.js.map +1 -1
- package/dist/data-plane/server/background.d.ts +12 -8
- package/dist/data-plane/server/background.d.ts.map +1 -1
- package/dist/data-plane/server/background.js +32 -14
- package/dist/data-plane/server/background.js.map +1 -1
- package/dist/data-plane/server/db/db.d.ts +4 -5
- package/dist/data-plane/server/db/db.d.ts.map +1 -1
- package/dist/data-plane/server/db/db.js +2 -1
- package/dist/data-plane/server/db/db.js.map +1 -1
- package/dist/data-plane/server/db/migrations/20230627T212437895Z-optional-handle.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/20230627T212437895Z-optional-handle.js +2 -4
- package/dist/data-plane/server/db/migrations/20230627T212437895Z-optional-handle.js.map +1 -1
- package/dist/data-plane/server/db/migrations/provider.d.ts +2 -1
- package/dist/data-plane/server/db/migrations/provider.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/provider.js.map +1 -1
- package/dist/data-plane/server/db/pagination.d.ts +3 -2
- package/dist/data-plane/server/db/pagination.d.ts.map +1 -1
- package/dist/data-plane/server/db/pagination.js +8 -8
- package/dist/data-plane/server/db/pagination.js.map +1 -1
- package/dist/data-plane/server/db/util.d.ts +5 -5
- package/dist/data-plane/server/db/util.d.ts.map +1 -1
- package/dist/data-plane/server/db/util.js.map +1 -1
- package/dist/data-plane/server/index.d.ts +2 -0
- package/dist/data-plane/server/index.d.ts.map +1 -1
- package/dist/data-plane/server/index.js +7 -10
- package/dist/data-plane/server/index.js.map +1 -1
- package/dist/data-plane/server/indexing/index.d.ts +2 -2
- package/dist/data-plane/server/indexing/index.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/index.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/block.d.ts +9 -4
- package/dist/data-plane/server/indexing/plugins/block.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/block.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/chat-declaration.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/chat-declaration.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/chat-declaration.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/feed-generator.d.ts +13 -4
- package/dist/data-plane/server/indexing/plugins/feed-generator.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/feed-generator.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/follow.d.ts +9 -4
- package/dist/data-plane/server/indexing/plugins/follow.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/follow.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/germ-declaration.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/germ-declaration.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/germ-declaration.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/labeler.d.ts +8 -4
- package/dist/data-plane/server/indexing/plugins/labeler.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/labeler.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/like.d.ts +12 -4
- package/dist/data-plane/server/indexing/plugins/like.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/like.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/list-block.d.ts +9 -4
- package/dist/data-plane/server/indexing/plugins/list-block.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/list-block.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/list-item.d.ts +10 -4
- package/dist/data-plane/server/indexing/plugins/list-item.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/list-item.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/list.d.ts +13 -4
- package/dist/data-plane/server/indexing/plugins/list.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/list.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/notif-declaration.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/notif-declaration.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/notif-declaration.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/post-gate.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/post-gate.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/post-gate.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/post.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/post.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/post.js +4 -3
- package/dist/data-plane/server/indexing/plugins/post.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/profile.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/profile.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/profile.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/repost.d.ts +12 -4
- package/dist/data-plane/server/indexing/plugins/repost.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/repost.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/starter-pack.d.ts +9 -4
- package/dist/data-plane/server/indexing/plugins/starter-pack.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/starter-pack.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/status.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/status.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/status.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/thread-gate.d.ts +1 -1
- package/dist/data-plane/server/indexing/plugins/thread-gate.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/thread-gate.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/verification.d.ts +12 -4
- package/dist/data-plane/server/indexing/plugins/verification.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/verification.js.map +1 -1
- package/dist/data-plane/server/indexing/processor.d.ts +1 -1
- package/dist/data-plane/server/indexing/processor.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/processor.js.map +1 -1
- package/dist/data-plane/server/routes/blocks.js +22 -14
- package/dist/data-plane/server/routes/blocks.js.map +1 -1
- package/dist/data-plane/server/routes/feed-gens.js +2 -2
- package/dist/data-plane/server/routes/feed-gens.js.map +1 -1
- package/dist/data-plane/server/routes/feeds.js +18 -16
- package/dist/data-plane/server/routes/feeds.js.map +1 -1
- package/dist/data-plane/server/routes/labels.js +1 -1
- package/dist/data-plane/server/routes/labels.js.map +1 -1
- package/dist/data-plane/server/routes/mutes.js +2 -2
- package/dist/data-plane/server/routes/mutes.js.map +1 -1
- package/dist/data-plane/server/routes/notifs.d.ts.map +1 -1
- package/dist/data-plane/server/routes/notifs.js +11 -17
- package/dist/data-plane/server/routes/notifs.js.map +1 -1
- package/dist/data-plane/server/routes/relationships.js.map +1 -1
- package/dist/data-plane/server/routes/search.js +2 -2
- package/dist/data-plane/server/routes/search.js.map +1 -1
- package/dist/data-plane/server/routes/suggestions.js +2 -2
- package/dist/data-plane/server/routes/suggestions.js.map +1 -1
- package/dist/data-plane/server/subscription.d.ts +13 -12
- package/dist/data-plane/server/subscription.d.ts.map +1 -1
- package/dist/data-plane/server/subscription.js +59 -26
- package/dist/data-plane/server/subscription.js.map +1 -1
- package/dist/data-plane/server/util.d.ts +31 -23
- package/dist/data-plane/server/util.d.ts.map +1 -1
- package/dist/feature-gates/index.d.ts +2 -1
- package/dist/feature-gates/index.d.ts.map +1 -1
- package/dist/feature-gates/index.js +9 -6
- package/dist/feature-gates/index.js.map +1 -1
- package/dist/feature-gates/metrics.d.ts +3 -3
- package/dist/feature-gates/metrics.d.ts.map +1 -1
- package/dist/feature-gates/metrics.js +8 -8
- package/dist/feature-gates/metrics.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/lexicons/app/bsky/notification/defs.defs.d.ts +5 -0
- package/dist/lexicons/app/bsky/notification/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/notification/defs.defs.js +1 -0
- package/dist/lexicons/app/bsky/notification/defs.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/notification/defs.d.ts +2 -0
- package/dist/lexicons/chat/bsky/notification/defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification/defs.defs.d.ts +20 -0
- package/dist/lexicons/chat/bsky/notification/defs.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification/defs.defs.js +19 -0
- package/dist/lexicons/chat/bsky/notification/defs.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/notification/defs.js +5 -0
- package/dist/lexicons/chat/bsky/notification/defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.d.ts +3 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.defs.d.ts +18 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.defs.js +16 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.js +6 -0
- package/dist/lexicons/chat/bsky/notification/getPreferences.js.map +1 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.d.ts +3 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.defs.d.ts +27 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.defs.js +22 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.js +6 -0
- package/dist/lexicons/chat/bsky/notification/putPreferences.js.map +1 -0
- package/dist/lexicons/chat/bsky/notification.d.ts +4 -0
- package/dist/lexicons/chat/bsky/notification.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/notification.js +7 -0
- package/dist/lexicons/chat/bsky/notification.js.map +1 -0
- package/dist/lexicons/chat/bsky.d.ts +1 -0
- package/dist/lexicons/chat/bsky.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky.js +1 -0
- package/dist/lexicons/chat/bsky.js.map +1 -1
- package/dist/lexicons/tools/ozone/report/defs.defs.d.ts +4 -0
- package/dist/lexicons/tools/ozone/report/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/report/defs.defs.js +2 -0
- package/dist/lexicons/tools/ozone/report/defs.defs.js.map +1 -1
- package/dist/lexicons/tools/ozone/report/queryActivities.d.ts +3 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.d.ts.map +1 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.defs.d.ts +42 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.defs.d.ts.map +1 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.defs.js +31 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.defs.js.map +1 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.js +6 -0
- package/dist/lexicons/tools/ozone/report/queryActivities.js.map +1 -0
- package/dist/lexicons/tools/ozone/report.d.ts +1 -0
- package/dist/lexicons/tools/ozone/report.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/report.js +1 -0
- package/dist/lexicons/tools/ozone/report.js.map +1 -1
- package/dist/proto/bsky_pb.d.ts +47 -53
- package/dist/proto/bsky_pb.d.ts.map +1 -1
- package/dist/proto/bsky_pb.js +62 -71
- package/dist/proto/bsky_pb.js.map +1 -1
- package/package.json +13 -13
- package/proto/bsky.proto +19 -17
- package/src/api/app/bsky/actor/searchActors.ts +17 -6
- package/src/api/app/bsky/actor/searchActorsTypeahead.ts +16 -8
- package/src/api/app/bsky/feed/searchPosts.ts +12 -5
- package/src/api/app/bsky/graph/searchStarterPacks.ts +14 -5
- package/src/api/app/bsky/notification/putPreferencesV2.ts +4 -1
- package/src/api/app/bsky/notification/util.ts +7 -11
- package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +9 -2
- package/src/api/blob-dispatcher.ts +12 -8
- package/src/api/blob-resolver.ts +0 -1
- package/src/api/util.ts +17 -0
- package/src/config.ts +9 -0
- package/src/data-plane/bsync/index.ts +12 -10
- package/src/data-plane/server/background.ts +49 -18
- package/src/data-plane/server/db/db.ts +1 -1
- package/src/data-plane/server/db/migrations/20230627T212437895Z-optional-handle.ts +2 -4
- package/src/data-plane/server/db/migrations/provider.ts +2 -1
- package/src/data-plane/server/db/pagination.ts +15 -15
- package/src/data-plane/server/db/util.ts +8 -5
- package/src/data-plane/server/index.ts +12 -10
- package/src/data-plane/server/indexing/index.ts +1 -1
- package/src/data-plane/server/indexing/plugins/block.ts +4 -1
- package/src/data-plane/server/indexing/plugins/chat-declaration.ts +4 -1
- package/src/data-plane/server/indexing/plugins/feed-generator.ts +4 -1
- package/src/data-plane/server/indexing/plugins/follow.ts +4 -1
- package/src/data-plane/server/indexing/plugins/germ-declaration.ts +4 -1
- package/src/data-plane/server/indexing/plugins/labeler.ts +4 -1
- package/src/data-plane/server/indexing/plugins/like.ts +4 -1
- package/src/data-plane/server/indexing/plugins/list-block.ts +4 -1
- package/src/data-plane/server/indexing/plugins/list-item.ts +4 -1
- package/src/data-plane/server/indexing/plugins/list.ts +4 -1
- package/src/data-plane/server/indexing/plugins/notif-declaration.ts +4 -1
- package/src/data-plane/server/indexing/plugins/post-gate.ts +4 -1
- package/src/data-plane/server/indexing/plugins/post.ts +9 -5
- package/src/data-plane/server/indexing/plugins/profile.ts +4 -1
- package/src/data-plane/server/indexing/plugins/repost.ts +4 -1
- package/src/data-plane/server/indexing/plugins/starter-pack.ts +4 -1
- package/src/data-plane/server/indexing/plugins/status.ts +4 -1
- package/src/data-plane/server/indexing/plugins/thread-gate.ts +4 -1
- package/src/data-plane/server/indexing/plugins/verification.ts +4 -1
- package/src/data-plane/server/indexing/processor.ts +1 -1
- package/src/data-plane/server/routes/blocks.ts +30 -24
- package/src/data-plane/server/routes/feed-gens.ts +2 -2
- package/src/data-plane/server/routes/feeds.ts +23 -19
- package/src/data-plane/server/routes/labels.ts +2 -2
- package/src/data-plane/server/routes/mutes.ts +8 -6
- package/src/data-plane/server/routes/notifs.ts +15 -26
- package/src/data-plane/server/routes/relationships.ts +4 -2
- package/src/data-plane/server/routes/search.ts +2 -2
- package/src/data-plane/server/routes/suggestions.ts +2 -2
- package/src/data-plane/server/subscription.ts +74 -31
- package/src/feature-gates/index.ts +10 -6
- package/src/feature-gates/metrics.test.ts +12 -12
- package/src/feature-gates/metrics.ts +8 -8
- package/src/index.ts +16 -9
- package/tests/_util.ts +8 -25
- package/tests/admin/admin-auth.test.ts +2 -2
- package/tests/admin/moderation.test.ts +1 -1
- package/tests/auth.test.ts +4 -6
- package/tests/blob-resolver.test.ts +4 -5
- package/tests/data-plane/db.test.ts +1 -1
- package/tests/data-plane/duplicate-records.test.ts +1 -1
- package/tests/data-plane/handle-invalidation.test.ts +2 -2
- package/tests/data-plane/indexing.test.ts +24 -21
- package/tests/data-plane/subscription.test.ts +3 -3
- package/tests/data-plane/thread-mutes.test.ts +2 -2
- package/tests/entryway-auth.test.ts +4 -5
- package/tests/feed-generation.test.ts +5 -5
- package/tests/image/server.test.ts +1 -1
- package/tests/label-hydration.test.ts +3 -5
- package/tests/postgates.test.ts +3 -6
- package/tests/query-labels.test.ts +3 -5
- package/tests/redis-cache.test.ts +1 -3
- package/tests/server.test.ts +11 -16
- package/tests/sitemap.test.ts +3 -4
- package/tests/stash.test.ts +12 -8
- package/tests/utils.test.ts +3 -13
- package/tests/views/account-deactivation.test.ts +3 -5
- package/tests/views/actor-likes.test.ts +3 -5
- package/tests/views/actor-search.test.ts +6 -7
- package/tests/views/age-assurance-v2.test.ts +9 -6
- package/tests/views/age-assurance.test.ts +30 -36
- package/tests/views/author-feed.test.ts +4 -6
- package/tests/views/block-lists.test.ts +3 -5
- package/tests/views/blocks.test.ts +3 -5
- package/tests/views/bookmarks.test.ts +4 -4
- package/tests/views/drafts.test.ts +7 -14
- package/tests/views/feed-hidden-replies.test.ts +3 -6
- package/tests/views/feed-view-post.test.ts +3 -6
- package/tests/views/follows.test.ts +4 -6
- package/tests/views/get-config.test.ts +4 -7
- package/tests/views/get-suggested-onboarding-users.test.ts +11 -9
- package/tests/views/get-suggested-starter-packs.test.ts +11 -9
- package/tests/views/get-trends.test.ts +15 -9
- package/tests/views/internal-actor.test.ts +3 -6
- package/tests/views/known-followers.test.ts +3 -6
- package/tests/views/labeler-service.test.ts +3 -5
- package/tests/views/labels-needs-review.test.ts +3 -6
- package/tests/views/labels-takedown.test.ts +3 -4
- package/tests/views/likes.test.ts +4 -6
- package/tests/views/list-feed.test.ts +3 -5
- package/tests/views/lists.test.ts +3 -5
- package/tests/views/mute-lists.test.ts +3 -5
- package/tests/views/mutes.test.ts +4 -5
- package/tests/views/notifications.test.ts +12 -11
- package/tests/views/post-search.test.ts +3 -24
- package/tests/views/posts-debug.test.ts +11 -6
- package/tests/views/posts.test.ts +3 -4
- package/tests/views/profile-debug.test.ts +11 -5
- package/tests/views/profile.test.ts +11 -5
- package/tests/views/quotes.test.ts +4 -6
- package/tests/views/reposts.test.ts +4 -6
- package/tests/views/starter-packs.test.ts +3 -6
- package/tests/views/suggestions.test.ts +9 -13
- package/tests/views/thread-v2.test.ts +3 -5
- package/tests/views/thread.test.ts +3 -7
- package/tests/views/threadgating.test.ts +3 -5
- package/tests/views/timeline.test.ts +4 -5
- package/tests/views/verification.test.ts +4 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/vitest.config.ts +1 -0
|
@@ -3,15 +3,13 @@ import { Kysely } from 'kysely'
|
|
|
3
3
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
4
|
await db.schema
|
|
5
5
|
.alterTable('actor')
|
|
6
|
-
.alterColumn('handle')
|
|
7
|
-
.dropNotNull()
|
|
6
|
+
.alterColumn('handle', (col) => col.dropNotNull())
|
|
8
7
|
.execute()
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
12
11
|
await db.schema
|
|
13
12
|
.alterTable('actor')
|
|
14
|
-
.alterColumn('handle')
|
|
15
|
-
.setNotNull()
|
|
13
|
+
.alterColumn('handle', (col) => col.setNotNull())
|
|
16
14
|
.execute()
|
|
17
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sql } from 'kysely'
|
|
1
|
+
import { SqlBool, sql } from 'kysely'
|
|
2
2
|
import { ensureValidRecordKey } from '@atproto/syntax'
|
|
3
3
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
|
4
4
|
import { AnyQb, DbRef } from './util.js'
|
|
@@ -67,16 +67,16 @@ export abstract class GenericKeyset<R, LR extends KeysetLabeledResult> {
|
|
|
67
67
|
if (tryIndex) {
|
|
68
68
|
// The tryIndex param will likely disappear and become the default implementation: here for now for gradual rollout query-by-query.
|
|
69
69
|
if (direction === 'asc') {
|
|
70
|
-
return sql
|
|
70
|
+
return sql<SqlBool>`((${this.primary}, ${this.secondary}) > (${labeled.primary}, ${labeled.secondary}))`
|
|
71
71
|
} else {
|
|
72
|
-
return sql
|
|
72
|
+
return sql<SqlBool>`((${this.primary}, ${this.secondary}) < (${labeled.primary}, ${labeled.secondary}))`
|
|
73
73
|
}
|
|
74
74
|
} else {
|
|
75
75
|
// @NOTE this implementation can struggle to use an index on (primary, secondary) for pagination due to the "or" usage.
|
|
76
76
|
if (direction === 'asc') {
|
|
77
|
-
return sql
|
|
77
|
+
return sql<SqlBool>`((${this.primary} > ${labeled.primary}) or (${this.primary} = ${labeled.primary} and ${this.secondary} > ${labeled.secondary}))`
|
|
78
78
|
} else {
|
|
79
|
-
return sql
|
|
79
|
+
return sql<SqlBool>`((${this.primary} < ${labeled.primary}) or (${this.primary} = ${labeled.primary} and ${this.secondary} < ${labeled.secondary}))`
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -94,11 +94,11 @@ export abstract class GenericKeyset<R, LR extends KeysetLabeledResult> {
|
|
|
94
94
|
const { limit, cursor, direction = 'desc', tryIndex, nullsLast } = opts
|
|
95
95
|
const keysetSql = this.getSql(this.unpack(cursor), direction, tryIndex)
|
|
96
96
|
return qb
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
.$if(!!limit, (q) => q.limit(limit as number))
|
|
98
|
+
.$if(!nullsLast, (q) =>
|
|
99
99
|
q.orderBy(this.primary, direction).orderBy(this.secondary, direction),
|
|
100
100
|
)
|
|
101
|
-
|
|
101
|
+
.$if(!!nullsLast, (q) =>
|
|
102
102
|
q
|
|
103
103
|
.orderBy(
|
|
104
104
|
direction === 'asc'
|
|
@@ -111,7 +111,7 @@ export abstract class GenericKeyset<R, LR extends KeysetLabeledResult> {
|
|
|
111
111
|
: sql`${this.secondary} desc nulls last`,
|
|
112
112
|
),
|
|
113
113
|
)
|
|
114
|
-
|
|
114
|
+
.$if(!!keysetSql, (qb) => (keysetSql ? qb.where(keysetSql) : qb)) as QB
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -231,9 +231,9 @@ export abstract class GenericSingleKey<R, LR extends SingleKeyLabeledResult> {
|
|
|
231
231
|
getSql(labeled?: LR, direction?: 'asc' | 'desc') {
|
|
232
232
|
if (labeled === undefined) return
|
|
233
233
|
if (direction === 'asc') {
|
|
234
|
-
return sql
|
|
234
|
+
return sql<SqlBool>`${this.primary} > ${labeled.primary}`
|
|
235
235
|
}
|
|
236
|
-
return sql
|
|
236
|
+
return sql<SqlBool>`${this.primary} < ${labeled.primary}`
|
|
237
237
|
}
|
|
238
238
|
paginate<QB extends AnyQb>(
|
|
239
239
|
qb: QB,
|
|
@@ -248,16 +248,16 @@ export abstract class GenericSingleKey<R, LR extends SingleKeyLabeledResult> {
|
|
|
248
248
|
const { limit, cursor, direction = 'desc', nullsLast } = opts
|
|
249
249
|
const keySql = this.getSql(this.unpack(cursor), direction)
|
|
250
250
|
return qb
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
.$if(!!limit, (q) => q.limit(limit as number))
|
|
252
|
+
.$if(!nullsLast, (q) => q.orderBy(this.primary, direction))
|
|
253
|
+
.$if(!!nullsLast, (q) =>
|
|
254
254
|
q.orderBy(
|
|
255
255
|
direction === 'asc'
|
|
256
256
|
? sql`${this.primary} asc nulls last`
|
|
257
257
|
: sql`${this.primary} desc nulls last`,
|
|
258
258
|
),
|
|
259
259
|
)
|
|
260
|
-
|
|
260
|
+
.$if(!!keySql, (qb) => (keySql ? qb.where(keySql) : qb)) as QB
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ExpressionBuilder,
|
|
5
5
|
RawBuilder,
|
|
6
6
|
SelectQueryBuilder,
|
|
7
|
+
SqlBool,
|
|
7
8
|
SqliteAdapter,
|
|
8
9
|
SqliteIntrospector,
|
|
9
10
|
SqliteQueryCompiler,
|
|
@@ -21,7 +22,7 @@ export const actorWhereClause = (actor: string) => {
|
|
|
21
22
|
|
|
22
23
|
// Applies to actor or record table
|
|
23
24
|
export const notSoftDeletedClause = (alias: DbRef) => {
|
|
24
|
-
return sql
|
|
25
|
+
return sql<SqlBool>`${alias}."takedownRef" is null`
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const softDeleted = (actorOrRecord: { takedownRef: string | null }) => {
|
|
@@ -35,11 +36,11 @@ export const excluded = <T>(db: DatabaseSchema, col) => {
|
|
|
35
36
|
return sql<T>`${db.dynamic.ref(`excluded.${col}`)}`
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
export const noMatch = sql
|
|
39
|
+
export const noMatch = sql<SqlBool>`1 = 0`
|
|
39
40
|
|
|
40
41
|
// Can be useful for large where-in clauses, to get the db to use a hash lookup on the list
|
|
41
|
-
export const valuesList = (vals: unknown[]) => {
|
|
42
|
-
return sql
|
|
42
|
+
export const valuesList = <T = unknown>(vals: unknown[]) => {
|
|
43
|
+
return sql<T>`(values (${sql.join(vals, sql`), (`)}))`
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export const dummyDialect = {
|
|
@@ -57,7 +58,9 @@ export const dummyDialect = {
|
|
|
57
58
|
},
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
export type DbRef =
|
|
61
|
+
export type DbRef =
|
|
62
|
+
| RawBuilder<unknown>
|
|
63
|
+
| ReturnType<DynamicModule<unknown>['ref']>
|
|
61
64
|
|
|
62
65
|
export type Subquery = ExpressionBuilder<DatabaseSchemaType, any>
|
|
63
66
|
|
|
@@ -2,6 +2,8 @@ import events from 'node:events'
|
|
|
2
2
|
import http from 'node:http'
|
|
3
3
|
import { expressConnectMiddleware } from '@connectrpc/connect-express'
|
|
4
4
|
import express from 'express'
|
|
5
|
+
// eslint-disable-next-line import/default
|
|
6
|
+
import httpTerminator from 'http-terminator'
|
|
5
7
|
import { IdResolver, MemoryCache } from '@atproto/identity'
|
|
6
8
|
import { Database, DatabaseSchema } from './db/index.js'
|
|
7
9
|
import createRoutes from './routes/index.js'
|
|
@@ -11,10 +13,14 @@ export type { DatabaseSchema }
|
|
|
11
13
|
export { RepoSubscription } from './subscription.js'
|
|
12
14
|
|
|
13
15
|
export class DataPlaneServer {
|
|
16
|
+
private terminator: httpTerminator.HttpTerminator
|
|
17
|
+
|
|
14
18
|
constructor(
|
|
15
19
|
public server: http.Server,
|
|
16
20
|
public idResolver: IdResolver,
|
|
17
|
-
) {
|
|
21
|
+
) {
|
|
22
|
+
this.terminator = httpTerminator.createHttpTerminator({ server })
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
static async create(db: Database, port: number, plcUrl?: string) {
|
|
20
26
|
const app = express()
|
|
@@ -28,14 +34,10 @@ export class DataPlaneServer {
|
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
async destroy() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
resolve()
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
})
|
|
37
|
+
await this.terminator.terminate()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async [Symbol.asyncDispose]() {
|
|
41
|
+
await this.destroy()
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -62,7 +62,7 @@ export class IndexingService {
|
|
|
62
62
|
constructor(
|
|
63
63
|
public db: Database,
|
|
64
64
|
public idResolver: IdResolver,
|
|
65
|
-
public background: BackgroundQueue
|
|
65
|
+
public background: BackgroundQueue<Database>,
|
|
66
66
|
) {
|
|
67
67
|
this.records = {
|
|
68
68
|
post: Post.makePlugin(this.db, this.background),
|
|
@@ -67,7 +67,10 @@ const notifsForDelete = () => {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
70
|
-
export const makePlugin = (
|
|
70
|
+
export const makePlugin = (
|
|
71
|
+
db: Database,
|
|
72
|
+
background: BackgroundQueue<Database>,
|
|
73
|
+
) => {
|
|
71
74
|
return new RecordProcessor(db, background, {
|
|
72
75
|
schema: app.bsky.graph.block.main,
|
|
73
76
|
insertFn,
|
|
@@ -40,7 +40,10 @@ const notifsForDelete = () => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
43
|
-
export const makePlugin = (
|
|
43
|
+
export const makePlugin = (
|
|
44
|
+
db: Database,
|
|
45
|
+
background: BackgroundQueue<Database>,
|
|
46
|
+
) => {
|
|
44
47
|
const processor = new RecordProcessor(db, background, {
|
|
45
48
|
schema: chat.bsky.actor.declaration.main,
|
|
46
49
|
insertFn,
|
|
@@ -63,7 +63,10 @@ const notifsForDelete = () => {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
66
|
-
export const makePlugin = (
|
|
66
|
+
export const makePlugin = (
|
|
67
|
+
db: Database,
|
|
68
|
+
background: BackgroundQueue<Database>,
|
|
69
|
+
) => {
|
|
67
70
|
return new RecordProcessor(db, background, {
|
|
68
71
|
schema: app.bsky.feed.generator.main,
|
|
69
72
|
insertFn,
|
|
@@ -114,7 +114,10 @@ const updateAggregates = async (db: DatabaseSchema, follow: IndexedFollow) => {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
117
|
-
export const makePlugin = (
|
|
117
|
+
export const makePlugin = (
|
|
118
|
+
db: Database,
|
|
119
|
+
background: BackgroundQueue<Database>,
|
|
120
|
+
) => {
|
|
118
121
|
return new RecordProcessor(db, background, {
|
|
119
122
|
schema: app.bsky.graph.follow.main,
|
|
120
123
|
insertFn,
|
|
@@ -40,7 +40,10 @@ const notifsForDelete = () => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
43
|
-
export const makePlugin = (
|
|
43
|
+
export const makePlugin = (
|
|
44
|
+
db: Database,
|
|
45
|
+
background: BackgroundQueue<Database>,
|
|
46
|
+
) => {
|
|
44
47
|
return new RecordProcessor(db, background, {
|
|
45
48
|
schema: com.germnetwork.declaration.main,
|
|
46
49
|
insertFn,
|
|
@@ -57,7 +57,10 @@ const notifsForDelete = () => {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
60
|
-
export const makePlugin = (
|
|
60
|
+
export const makePlugin = (
|
|
61
|
+
db: Database,
|
|
62
|
+
background: BackgroundQueue<Database>,
|
|
63
|
+
) => {
|
|
61
64
|
return new RecordProcessor(db, background, {
|
|
62
65
|
schema: app.bsky.labeler.service.main,
|
|
63
66
|
insertFn,
|
|
@@ -133,7 +133,10 @@ const updateAggregates = async (db: DatabaseSchema, like: IndexedLike) => {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
136
|
-
export const makePlugin = (
|
|
136
|
+
export const makePlugin = (
|
|
137
|
+
db: Database,
|
|
138
|
+
background: BackgroundQueue<Database>,
|
|
139
|
+
) => {
|
|
137
140
|
return new RecordProcessor(db, background, {
|
|
138
141
|
schema: app.bsky.feed.like.main,
|
|
139
142
|
insertFn,
|
|
@@ -67,7 +67,10 @@ const notifsForDelete = () => {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
70
|
-
export const makePlugin = (
|
|
70
|
+
export const makePlugin = (
|
|
71
|
+
db: Database,
|
|
72
|
+
background: BackgroundQueue<Database>,
|
|
73
|
+
) => {
|
|
71
74
|
return new RecordProcessor(db, background, {
|
|
72
75
|
schema: app.bsky.graph.listblock.main,
|
|
73
76
|
insertFn,
|
|
@@ -75,7 +75,10 @@ const notifsForDelete = () => {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
78
|
-
export const makePlugin = (
|
|
78
|
+
export const makePlugin = (
|
|
79
|
+
db: Database,
|
|
80
|
+
background: BackgroundQueue<Database>,
|
|
81
|
+
) => {
|
|
79
82
|
return new RecordProcessor(db, background, {
|
|
80
83
|
schema: app.bsky.graph.listitem.main,
|
|
81
84
|
insertFn,
|
|
@@ -63,7 +63,10 @@ const notifsForDelete = () => {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
66
|
-
export const makePlugin = (
|
|
66
|
+
export const makePlugin = (
|
|
67
|
+
db: Database,
|
|
68
|
+
background: BackgroundQueue<Database>,
|
|
69
|
+
) => {
|
|
67
70
|
return new RecordProcessor(db, background, {
|
|
68
71
|
schema: app.bsky.graph.list.main,
|
|
69
72
|
insertFn,
|
|
@@ -40,7 +40,10 @@ const notifsForDelete = () => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
43
|
-
export const makePlugin = (
|
|
43
|
+
export const makePlugin = (
|
|
44
|
+
db: Database,
|
|
45
|
+
background: BackgroundQueue<Database>,
|
|
46
|
+
) => {
|
|
44
47
|
return new RecordProcessor(db, background, {
|
|
45
48
|
schema: app.bsky.notification.declaration.main,
|
|
46
49
|
insertFn,
|
|
@@ -84,7 +84,10 @@ const notifsForDelete = () => {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
87
|
-
export const makePlugin = (
|
|
87
|
+
export const makePlugin = (
|
|
88
|
+
db: Database,
|
|
89
|
+
background: BackgroundQueue<Database>,
|
|
90
|
+
) => {
|
|
88
91
|
return new RecordProcessor(db, background, {
|
|
89
92
|
schema: app.bsky.feed.postgate.main,
|
|
90
93
|
insertFn,
|
|
@@ -505,10 +505,11 @@ const updateAggregates = async (db: DatabaseSchema, postIdx: IndexedPost) => {
|
|
|
505
505
|
replyCount: db
|
|
506
506
|
.selectFrom('post')
|
|
507
507
|
.where('post.replyParent', '=', postIdx.post.replyParent)
|
|
508
|
-
.where((
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
508
|
+
.where((eb) =>
|
|
509
|
+
eb.or([
|
|
510
|
+
eb('post.violatesThreadGate', 'is', null),
|
|
511
|
+
eb('post.violatesThreadGate', '=', false),
|
|
512
|
+
]),
|
|
512
513
|
)
|
|
513
514
|
.select(countAll.as('count')),
|
|
514
515
|
})
|
|
@@ -534,7 +535,10 @@ const updateAggregates = async (db: DatabaseSchema, postIdx: IndexedPost) => {
|
|
|
534
535
|
}
|
|
535
536
|
|
|
536
537
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
537
|
-
export const makePlugin = (
|
|
538
|
+
export const makePlugin = (
|
|
539
|
+
db: Database,
|
|
540
|
+
background: BackgroundQueue<Database>,
|
|
541
|
+
) => {
|
|
538
542
|
return new RecordProcessor(db, background, {
|
|
539
543
|
schema: app.bsky.feed.post.main,
|
|
540
544
|
insertFn,
|
|
@@ -73,7 +73,10 @@ const notifsForDelete = () => {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
76
|
-
export const makePlugin = (
|
|
76
|
+
export const makePlugin = (
|
|
77
|
+
db: Database,
|
|
78
|
+
background: BackgroundQueue<Database>,
|
|
79
|
+
) => {
|
|
77
80
|
return new RecordProcessor(db, background, {
|
|
78
81
|
schema: app.bsky.actor.profile.main,
|
|
79
82
|
insertFn,
|
|
@@ -158,7 +158,10 @@ const updateAggregates = async (db: DatabaseSchema, repost: IndexedRepost) => {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
161
|
-
export const makePlugin = (
|
|
161
|
+
export const makePlugin = (
|
|
162
|
+
db: Database,
|
|
163
|
+
background: BackgroundQueue<Database>,
|
|
164
|
+
) => {
|
|
162
165
|
return new RecordProcessor(db, background, {
|
|
163
166
|
schema: app.bsky.feed.repost.main,
|
|
164
167
|
insertFn,
|
|
@@ -57,7 +57,10 @@ const notifsForDelete = () => {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
60
|
-
export const makePlugin = (
|
|
60
|
+
export const makePlugin = (
|
|
61
|
+
db: Database,
|
|
62
|
+
background: BackgroundQueue<Database>,
|
|
63
|
+
) => {
|
|
61
64
|
return new RecordProcessor(db, background, {
|
|
62
65
|
schema: app.bsky.graph.starterpack.main,
|
|
63
66
|
insertFn,
|
|
@@ -40,7 +40,10 @@ const notifsForDelete = () => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
43
|
-
export const makePlugin = (
|
|
43
|
+
export const makePlugin = (
|
|
44
|
+
db: Database,
|
|
45
|
+
background: BackgroundQueue<Database>,
|
|
46
|
+
) => {
|
|
44
47
|
return new RecordProcessor(db, background, {
|
|
45
48
|
schema: app.bsky.actor.status.main,
|
|
46
49
|
insertFn,
|
|
@@ -84,7 +84,10 @@ const notifsForDelete = () => {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
87
|
-
export const makePlugin = (
|
|
87
|
+
export const makePlugin = (
|
|
88
|
+
db: Database,
|
|
89
|
+
background: BackgroundQueue<Database>,
|
|
90
|
+
) => {
|
|
88
91
|
return new RecordProcessor(db, background, {
|
|
89
92
|
schema: app.bsky.feed.threadgate.main,
|
|
90
93
|
insertFn,
|
|
@@ -96,7 +96,10 @@ const notifsForDelete = (
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export type PluginType = ReturnType<typeof makePlugin>
|
|
99
|
-
export const makePlugin = (
|
|
99
|
+
export const makePlugin = (
|
|
100
|
+
db: Database,
|
|
101
|
+
background: BackgroundQueue<Database>,
|
|
102
|
+
) => {
|
|
100
103
|
return new RecordProcessor(db, background, {
|
|
101
104
|
schema: app.bsky.graph.verification.main,
|
|
102
105
|
insertFn,
|
|
@@ -37,7 +37,7 @@ type Notif = Insertable<Notification>
|
|
|
37
37
|
export class RecordProcessor<TSchema extends l.RecordSchema, TRow> {
|
|
38
38
|
constructor(
|
|
39
39
|
private appDb: Database,
|
|
40
|
-
private background: BackgroundQueue
|
|
40
|
+
private background: BackgroundQueue<Database>,
|
|
41
41
|
private options: RecordProcessorOptions<TSchema, TRow>,
|
|
42
42
|
) {}
|
|
43
43
|
|
|
@@ -8,15 +8,17 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
|
|
|
8
8
|
const { actorDid, targetDid } = req
|
|
9
9
|
const res = await db.db
|
|
10
10
|
.selectFrom('actor_block')
|
|
11
|
-
.where((
|
|
12
|
-
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
.where((eb) =>
|
|
12
|
+
eb.or([
|
|
13
|
+
eb.and([
|
|
14
|
+
eb('actor_block.creator', '=', actorDid),
|
|
15
|
+
eb('actor_block.subjectDid', '=', targetDid),
|
|
16
|
+
]),
|
|
17
|
+
eb.and([
|
|
18
|
+
eb('actor_block.creator', '=', targetDid),
|
|
19
|
+
eb('actor_block.subjectDid', '=', actorDid),
|
|
20
|
+
]),
|
|
21
|
+
]),
|
|
20
22
|
)
|
|
21
23
|
.limit(1)
|
|
22
24
|
.selectAll()
|
|
@@ -58,15 +60,17 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
|
|
|
58
60
|
const res = await db.db
|
|
59
61
|
.selectFrom('list_block')
|
|
60
62
|
.innerJoin('list_item', 'list_item.listUri', 'list_block.subjectUri')
|
|
61
|
-
.where((
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
.where((eb) =>
|
|
64
|
+
eb.or([
|
|
65
|
+
eb.and([
|
|
66
|
+
eb('list_block.creator', '=', actorDid),
|
|
67
|
+
eb('list_item.subjectDid', '=', targetDid),
|
|
68
|
+
]),
|
|
69
|
+
eb.and([
|
|
70
|
+
eb('list_block.creator', '=', targetDid),
|
|
71
|
+
eb('list_item.subjectDid', '=', actorDid),
|
|
72
|
+
]),
|
|
73
|
+
]),
|
|
70
74
|
)
|
|
71
75
|
.limit(1)
|
|
72
76
|
.selectAll('list_block')
|
|
@@ -96,12 +100,14 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
|
|
|
96
100
|
const { ref } = db.db.dynamic
|
|
97
101
|
let builder = db.db
|
|
98
102
|
.selectFrom('list')
|
|
99
|
-
.
|
|
100
|
-
|
|
101
|
-
.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
.where(({ exists }) =>
|
|
104
|
+
exists(
|
|
105
|
+
db.db
|
|
106
|
+
.selectFrom('list_block')
|
|
107
|
+
.where('list_block.creator', '=', actorDid)
|
|
108
|
+
.whereRef('list_block.subjectUri', '=', ref('list.uri'))
|
|
109
|
+
.selectAll(),
|
|
110
|
+
),
|
|
105
111
|
)
|
|
106
112
|
.selectAll('list')
|
|
107
113
|
|
|
@@ -34,7 +34,7 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
|
|
|
34
34
|
const feeds = await db.db
|
|
35
35
|
.selectFrom('suggested_feed')
|
|
36
36
|
.orderBy('suggested_feed.order', 'asc')
|
|
37
|
-
|
|
37
|
+
.$if(!!req.cursor, (q) => q.where('order', '>', parseInt(req.cursor, 10)))
|
|
38
38
|
.limit(req.limit || 50)
|
|
39
39
|
.selectAll()
|
|
40
40
|
.execute()
|
|
@@ -74,7 +74,7 @@ const searchFeedGeneratorsImpl = async (
|
|
|
74
74
|
const trimmed = query.trim()
|
|
75
75
|
let builder = db.db
|
|
76
76
|
.selectFrom('feed_generator')
|
|
77
|
-
|
|
77
|
+
.$if(!!trimmed, (q) => q.where('displayName', 'ilike', `%${trimmed}%`))
|
|
78
78
|
.selectAll()
|
|
79
79
|
const keyset = new TimeCidKeyset(
|
|
80
80
|
ref('feed_generator.createdAt'),
|
|
@@ -21,16 +21,16 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
|
|
|
21
21
|
// only your own posts
|
|
22
22
|
.where('type', '=', 'post')
|
|
23
23
|
// only posts with media
|
|
24
|
-
.where((
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
|
|
24
|
+
.where((eb) =>
|
|
25
|
+
eb.or([
|
|
26
|
+
eb.exists(
|
|
27
|
+
eb
|
|
28
28
|
.selectFrom('post_embed_image')
|
|
29
29
|
.select('post_embed_image.postUri')
|
|
30
30
|
.whereRef('post_embed_image.postUri', '=', 'feed_item.postUri'),
|
|
31
|
-
)
|
|
32
|
-
.
|
|
33
|
-
|
|
31
|
+
),
|
|
32
|
+
eb.exists(
|
|
33
|
+
eb
|
|
34
34
|
.selectFrom('post_embed_gallery_image')
|
|
35
35
|
.select('post_embed_gallery_image.postUri')
|
|
36
36
|
.whereRef(
|
|
@@ -39,28 +39,32 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
|
|
|
39
39
|
'feed_item.postUri',
|
|
40
40
|
),
|
|
41
41
|
),
|
|
42
|
+
]),
|
|
42
43
|
)
|
|
43
44
|
} else if (feedType === FeedType.POSTS_WITH_VIDEO) {
|
|
44
45
|
builder = builder
|
|
45
46
|
// only your own posts
|
|
46
47
|
.where('type', '=', 'post')
|
|
47
48
|
// only posts with video
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
.where(({ eb, exists }) =>
|
|
50
|
+
exists(
|
|
51
|
+
eb
|
|
52
|
+
.selectFrom('post_embed_video')
|
|
53
|
+
.select('post_embed_video.postUri')
|
|
54
|
+
.whereRef('post_embed_video.postUri', '=', 'feed_item.postUri'),
|
|
55
|
+
),
|
|
53
56
|
)
|
|
54
57
|
} else if (feedType === FeedType.POSTS_NO_REPLIES) {
|
|
55
|
-
builder = builder.where((
|
|
56
|
-
|
|
58
|
+
builder = builder.where((eb) =>
|
|
59
|
+
eb.or([eb('post.replyParent', 'is', null), eb('type', '=', 'repost')]),
|
|
57
60
|
)
|
|
58
61
|
} else if (feedType === FeedType.POSTS_AND_AUTHOR_THREADS) {
|
|
59
|
-
builder = builder.where((
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
builder = builder.where((eb) =>
|
|
63
|
+
eb.or([
|
|
64
|
+
eb('type', '=', 'repost'),
|
|
65
|
+
eb('post.replyParent', 'is', null),
|
|
66
|
+
eb('post.replyRoot', 'like', `at://${actorDid}/%`),
|
|
67
|
+
]),
|
|
64
68
|
)
|
|
65
69
|
}
|
|
66
70
|
|