@atproto/bsky 0.0.242 → 0.0.243
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 +8 -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 +7 -3
- 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/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/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/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/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/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/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/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/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/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-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.d.ts +13 -4
- package/dist/data-plane/server/indexing/plugins/list.d.ts.map +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/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/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/verification.d.ts +12 -4
- package/dist/data-plane/server/indexing/plugins/verification.d.ts.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 +10 -9
- 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/suggestions.js +2 -2
- package/dist/data-plane/server/routes/suggestions.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/package.json +11 -11
- package/src/api/app/bsky/actor/searchActors.ts +17 -6
- package/src/api/app/bsky/actor/searchActorsTypeahead.ts +11 -5
- 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/unspecced/getPopularFeedGenerators.ts +9 -2
- package/src/api/util.ts +17 -0
- package/src/config.ts +9 -0
- 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/indexing/plugins/post.ts +5 -4
- 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 -12
- package/src/data-plane/server/routes/relationships.ts +4 -2
- package/src/data-plane/server/routes/suggestions.ts +2 -2
- package/tests/data-plane/subscription.test.ts +2 -2
|
@@ -3,32 +3,40 @@ import { DatabaseSchema } from './db/database-schema.js';
|
|
|
3
3
|
export declare const getDescendentsQb: (db: DatabaseSchema, opts: {
|
|
4
4
|
uri: string;
|
|
5
5
|
depth: number;
|
|
6
|
-
}) => import("kysely").QueryCreatorWithCommonTableExpression<import("./db/database-schema.js").DatabaseSchemaType, "descendent(uri, depth)", (cte: import("kysely").QueryCreator<import("./db/tables/duplicate-record.js").PartialDB & import("./db/tables/profile.js").PartialDB & import("./db/tables/profile-agg.js").PartialDB & import("./db/tables/post.js").PartialDB & import("./db/tables/post-embed.js").PartialDB & import("./db/tables/post-agg.js").PartialDB & import("./db/tables/repost.js").PartialDB & import("./db/tables/thread-gate.js").PartialDB & import("./db/tables/post-gate.js").PartialDB & import("./db/tables/feed-item.js").PartialDB & import("./db/tables/follow.js").PartialDB & import("./db/tables/like.js").PartialDB & import("./db/tables/list.js").PartialDB & import("./db/tables/list-item.js").PartialDB & import("./db/tables/list-mute.js").PartialDB & import("./db/tables/list-block.js").PartialDB & import("./db/tables/mute.js").PartialDB & import("./db/tables/actor-block.js").PartialDB & import("./db/tables/thread-mute.js").PartialDB & import("./db/tables/feed-generator.js").PartialDB & import("./db/tables/subscription.js").PartialDB & import("./db/tables/actor.js").PartialDB & import("./db/tables/actor-state.js").PartialDB & import("./db/tables/actor-sync.js").PartialDB & import("./db/tables/record.js").PartialDB & import("./db/tables/notification.js").PartialDB & import("./db/tables/notification-push-token.js").PartialDB & import("./db/tables/did-cache.js").PartialDB & import("./db/tables/label.js").PartialDB & import("./db/tables/algo.js").PartialDB & import("./db/tables/view-param.js").PartialDB & import("./db/tables/suggested-follow.js").PartialDB & import("./db/tables/suggested-feed.js").PartialDB & import("./db/tables/blob-takedown.js").PartialDB & import("./db/tables/labeler.js").PartialDB & import("./db/tables/starter-pack.js").PartialDB & import("./db/tables/tagged-suggestion.js").PartialDB & import("./db/tables/quote.js").PartialDB & import("./db/tables/verification.js").PartialDB & import("./db/tables/private-data.js").PartialDB & import("./db/tables/activity-subscription.js").PartialDB & import("./db/tables/bookmark.js").PartialDB & import("./db/tables/draft.js").PartialDB &
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
6
|
+
}) => import("kysely").QueryCreatorWithCommonTableExpression<import("./db/database-schema.js").DatabaseSchemaType, "descendent(uri, depth)", (cte: import("kysely").QueryCreator<import("./db/tables/duplicate-record.js").PartialDB & import("./db/tables/profile.js").PartialDB & import("./db/tables/profile-agg.js").PartialDB & import("./db/tables/post.js").PartialDB & import("./db/tables/post-embed.js").PartialDB & import("./db/tables/post-agg.js").PartialDB & import("./db/tables/repost.js").PartialDB & import("./db/tables/thread-gate.js").PartialDB & import("./db/tables/post-gate.js").PartialDB & import("./db/tables/feed-item.js").PartialDB & import("./db/tables/follow.js").PartialDB & import("./db/tables/like.js").PartialDB & import("./db/tables/list.js").PartialDB & import("./db/tables/list-item.js").PartialDB & import("./db/tables/list-mute.js").PartialDB & import("./db/tables/list-block.js").PartialDB & import("./db/tables/mute.js").PartialDB & import("./db/tables/actor-block.js").PartialDB & import("./db/tables/thread-mute.js").PartialDB & import("./db/tables/feed-generator.js").PartialDB & import("./db/tables/subscription.js").PartialDB & import("./db/tables/actor.js").PartialDB & import("./db/tables/actor-state.js").PartialDB & import("./db/tables/actor-sync.js").PartialDB & import("./db/tables/record.js").PartialDB & import("./db/tables/notification.js").PartialDB & import("./db/tables/notification-push-token.js").PartialDB & import("./db/tables/did-cache.js").PartialDB & import("./db/tables/label.js").PartialDB & import("./db/tables/algo.js").PartialDB & import("./db/tables/view-param.js").PartialDB & import("./db/tables/suggested-follow.js").PartialDB & import("./db/tables/suggested-feed.js").PartialDB & import("./db/tables/blob-takedown.js").PartialDB & import("./db/tables/labeler.js").PartialDB & import("./db/tables/starter-pack.js").PartialDB & import("./db/tables/tagged-suggestion.js").PartialDB & import("./db/tables/quote.js").PartialDB & import("./db/tables/verification.js").PartialDB & import("./db/tables/private-data.js").PartialDB & import("./db/tables/activity-subscription.js").PartialDB & import("./db/tables/bookmark.js").PartialDB & import("./db/tables/draft.js").PartialDB & {
|
|
7
|
+
descendent: {
|
|
8
|
+
depth: any;
|
|
9
|
+
uri: any;
|
|
10
|
+
};
|
|
11
|
+
}>) => import("kysely").SelectQueryBuilder<import("./db/tables/duplicate-record.js").PartialDB & import("./db/tables/profile.js").PartialDB & import("./db/tables/profile-agg.js").PartialDB & import("./db/tables/post.js").PartialDB & import("./db/tables/post-embed.js").PartialDB & import("./db/tables/post-agg.js").PartialDB & import("./db/tables/repost.js").PartialDB & import("./db/tables/thread-gate.js").PartialDB & import("./db/tables/post-gate.js").PartialDB & import("./db/tables/feed-item.js").PartialDB & import("./db/tables/follow.js").PartialDB & import("./db/tables/like.js").PartialDB & import("./db/tables/list.js").PartialDB & import("./db/tables/list-item.js").PartialDB & import("./db/tables/list-mute.js").PartialDB & import("./db/tables/list-block.js").PartialDB & import("./db/tables/mute.js").PartialDB & import("./db/tables/actor-block.js").PartialDB & import("./db/tables/thread-mute.js").PartialDB & import("./db/tables/feed-generator.js").PartialDB & import("./db/tables/subscription.js").PartialDB & import("./db/tables/actor.js").PartialDB & import("./db/tables/actor-state.js").PartialDB & import("./db/tables/actor-sync.js").PartialDB & import("./db/tables/record.js").PartialDB & import("./db/tables/notification.js").PartialDB & import("./db/tables/notification-push-token.js").PartialDB & import("./db/tables/did-cache.js").PartialDB & import("./db/tables/label.js").PartialDB & import("./db/tables/algo.js").PartialDB & import("./db/tables/view-param.js").PartialDB & import("./db/tables/suggested-follow.js").PartialDB & import("./db/tables/suggested-feed.js").PartialDB & import("./db/tables/blob-takedown.js").PartialDB & import("./db/tables/labeler.js").PartialDB & import("./db/tables/starter-pack.js").PartialDB & import("./db/tables/tagged-suggestion.js").PartialDB & import("./db/tables/quote.js").PartialDB & import("./db/tables/verification.js").PartialDB & import("./db/tables/private-data.js").PartialDB & import("./db/tables/activity-subscription.js").PartialDB & import("./db/tables/bookmark.js").PartialDB & import("./db/tables/draft.js").PartialDB & {
|
|
12
|
+
descendent: {
|
|
13
|
+
depth: any;
|
|
14
|
+
uri: any;
|
|
15
|
+
};
|
|
16
|
+
}, "post", {
|
|
17
|
+
depth: number;
|
|
18
|
+
uri: string;
|
|
19
|
+
}>>;
|
|
16
20
|
export declare const getAncestorsAndSelfQb: (db: DatabaseSchema, opts: {
|
|
17
21
|
uri: string;
|
|
18
22
|
parentHeight: number;
|
|
19
|
-
}) => import("kysely").QueryCreatorWithCommonTableExpression<import("./db/database-schema.js").DatabaseSchemaType, "ancestor(uri, ancestorUri, height)", (cte: import("kysely").QueryCreator<import("./db/tables/duplicate-record.js").PartialDB & import("./db/tables/profile.js").PartialDB & import("./db/tables/profile-agg.js").PartialDB & import("./db/tables/post.js").PartialDB & import("./db/tables/post-embed.js").PartialDB & import("./db/tables/post-agg.js").PartialDB & import("./db/tables/repost.js").PartialDB & import("./db/tables/thread-gate.js").PartialDB & import("./db/tables/post-gate.js").PartialDB & import("./db/tables/feed-item.js").PartialDB & import("./db/tables/follow.js").PartialDB & import("./db/tables/like.js").PartialDB & import("./db/tables/list.js").PartialDB & import("./db/tables/list-item.js").PartialDB & import("./db/tables/list-mute.js").PartialDB & import("./db/tables/list-block.js").PartialDB & import("./db/tables/mute.js").PartialDB & import("./db/tables/actor-block.js").PartialDB & import("./db/tables/thread-mute.js").PartialDB & import("./db/tables/feed-generator.js").PartialDB & import("./db/tables/subscription.js").PartialDB & import("./db/tables/actor.js").PartialDB & import("./db/tables/actor-state.js").PartialDB & import("./db/tables/actor-sync.js").PartialDB & import("./db/tables/record.js").PartialDB & import("./db/tables/notification.js").PartialDB & import("./db/tables/notification-push-token.js").PartialDB & import("./db/tables/did-cache.js").PartialDB & import("./db/tables/label.js").PartialDB & import("./db/tables/algo.js").PartialDB & import("./db/tables/view-param.js").PartialDB & import("./db/tables/suggested-follow.js").PartialDB & import("./db/tables/suggested-feed.js").PartialDB & import("./db/tables/blob-takedown.js").PartialDB & import("./db/tables/labeler.js").PartialDB & import("./db/tables/starter-pack.js").PartialDB & import("./db/tables/tagged-suggestion.js").PartialDB & import("./db/tables/quote.js").PartialDB & import("./db/tables/verification.js").PartialDB & import("./db/tables/private-data.js").PartialDB & import("./db/tables/activity-subscription.js").PartialDB & import("./db/tables/bookmark.js").PartialDB & import("./db/tables/draft.js").PartialDB &
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
23
|
+
}) => import("kysely").QueryCreatorWithCommonTableExpression<import("./db/database-schema.js").DatabaseSchemaType, "ancestor(uri, ancestorUri, height)", (cte: import("kysely").QueryCreator<import("./db/tables/duplicate-record.js").PartialDB & import("./db/tables/profile.js").PartialDB & import("./db/tables/profile-agg.js").PartialDB & import("./db/tables/post.js").PartialDB & import("./db/tables/post-embed.js").PartialDB & import("./db/tables/post-agg.js").PartialDB & import("./db/tables/repost.js").PartialDB & import("./db/tables/thread-gate.js").PartialDB & import("./db/tables/post-gate.js").PartialDB & import("./db/tables/feed-item.js").PartialDB & import("./db/tables/follow.js").PartialDB & import("./db/tables/like.js").PartialDB & import("./db/tables/list.js").PartialDB & import("./db/tables/list-item.js").PartialDB & import("./db/tables/list-mute.js").PartialDB & import("./db/tables/list-block.js").PartialDB & import("./db/tables/mute.js").PartialDB & import("./db/tables/actor-block.js").PartialDB & import("./db/tables/thread-mute.js").PartialDB & import("./db/tables/feed-generator.js").PartialDB & import("./db/tables/subscription.js").PartialDB & import("./db/tables/actor.js").PartialDB & import("./db/tables/actor-state.js").PartialDB & import("./db/tables/actor-sync.js").PartialDB & import("./db/tables/record.js").PartialDB & import("./db/tables/notification.js").PartialDB & import("./db/tables/notification-push-token.js").PartialDB & import("./db/tables/did-cache.js").PartialDB & import("./db/tables/label.js").PartialDB & import("./db/tables/algo.js").PartialDB & import("./db/tables/view-param.js").PartialDB & import("./db/tables/suggested-follow.js").PartialDB & import("./db/tables/suggested-feed.js").PartialDB & import("./db/tables/blob-takedown.js").PartialDB & import("./db/tables/labeler.js").PartialDB & import("./db/tables/starter-pack.js").PartialDB & import("./db/tables/tagged-suggestion.js").PartialDB & import("./db/tables/quote.js").PartialDB & import("./db/tables/verification.js").PartialDB & import("./db/tables/private-data.js").PartialDB & import("./db/tables/activity-subscription.js").PartialDB & import("./db/tables/bookmark.js").PartialDB & import("./db/tables/draft.js").PartialDB & {
|
|
24
|
+
ancestor: {
|
|
25
|
+
ancestorUri: any;
|
|
26
|
+
height: any;
|
|
27
|
+
uri: any;
|
|
28
|
+
};
|
|
29
|
+
}>) => import("kysely").SelectQueryBuilder<import("./db/tables/duplicate-record.js").PartialDB & import("./db/tables/profile.js").PartialDB & import("./db/tables/profile-agg.js").PartialDB & import("./db/tables/post.js").PartialDB & import("./db/tables/post-embed.js").PartialDB & import("./db/tables/post-agg.js").PartialDB & import("./db/tables/repost.js").PartialDB & import("./db/tables/thread-gate.js").PartialDB & import("./db/tables/post-gate.js").PartialDB & import("./db/tables/feed-item.js").PartialDB & import("./db/tables/follow.js").PartialDB & import("./db/tables/like.js").PartialDB & import("./db/tables/list.js").PartialDB & import("./db/tables/list-item.js").PartialDB & import("./db/tables/list-mute.js").PartialDB & import("./db/tables/list-block.js").PartialDB & import("./db/tables/mute.js").PartialDB & import("./db/tables/actor-block.js").PartialDB & import("./db/tables/thread-mute.js").PartialDB & import("./db/tables/feed-generator.js").PartialDB & import("./db/tables/subscription.js").PartialDB & import("./db/tables/actor.js").PartialDB & import("./db/tables/actor-state.js").PartialDB & import("./db/tables/actor-sync.js").PartialDB & import("./db/tables/record.js").PartialDB & import("./db/tables/notification.js").PartialDB & import("./db/tables/notification-push-token.js").PartialDB & import("./db/tables/did-cache.js").PartialDB & import("./db/tables/label.js").PartialDB & import("./db/tables/algo.js").PartialDB & import("./db/tables/view-param.js").PartialDB & import("./db/tables/suggested-follow.js").PartialDB & import("./db/tables/suggested-feed.js").PartialDB & import("./db/tables/blob-takedown.js").PartialDB & import("./db/tables/labeler.js").PartialDB & import("./db/tables/starter-pack.js").PartialDB & import("./db/tables/tagged-suggestion.js").PartialDB & import("./db/tables/quote.js").PartialDB & import("./db/tables/verification.js").PartialDB & import("./db/tables/private-data.js").PartialDB & import("./db/tables/activity-subscription.js").PartialDB & import("./db/tables/bookmark.js").PartialDB & import("./db/tables/draft.js").PartialDB & {
|
|
30
|
+
ancestor: {
|
|
31
|
+
ancestorUri: any;
|
|
32
|
+
height: any;
|
|
33
|
+
uri: any;
|
|
34
|
+
};
|
|
35
|
+
}, "post", {
|
|
36
|
+
ancestorUri: string | null;
|
|
37
|
+
height: number;
|
|
38
|
+
uri: string;
|
|
39
|
+
}>>;
|
|
32
40
|
export declare const invalidReplyRoot: (reply: PostReplyRef, parent: {
|
|
33
41
|
record: PostRecord;
|
|
34
42
|
invalidReplyRoot: boolean | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/data-plane/server/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGxD,eAAO,MAAM,gBAAgB,OACvB,cAAc,QACZ;IACJ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/data-plane/server/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGxD,eAAO,MAAM,gBAAgB,OACvB,cAAc,QACZ;IACJ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;;;;;;;;;;;;;GAqBF,CAAA;AAED,eAAO,MAAM,qBAAqB,OAC5B,cAAc,QACZ;IACJ,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;CACrB;;;;;;;;;;;;;;;;GA4BF,CAAA;AAED,eAAO,MAAM,gBAAgB,UACpB,YAAY,UACX;IACN,MAAM,EAAE,UAAU,CAAA;IAClB,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAA;CACjC,YAcF,CAAA;AACD,eAAO,MAAM,kBAAkB,OACzB,cAAc,cACN,MAAM,YACR,MAAM,YACN,UAAU,GAAG,IAAI,QACrB,UAAU,GAAG,IAAI,qBAwDxB,CAAA;AAID,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,oBAAoB,WACvB,MAAM,WACL;IACP,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,KACA,eAqCF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.243",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"ioredis": "^5.3.2",
|
|
36
36
|
"jose": "^5.0.1",
|
|
37
37
|
"key-encoder": "^2.0.3",
|
|
38
|
-
"kysely": "^0.
|
|
38
|
+
"kysely": "^0.29.2",
|
|
39
39
|
"leo-profanity": "^1.8.0",
|
|
40
40
|
"murmurhash": "^2.0.1",
|
|
41
41
|
"p-queue": "^8.0.0",
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"uint8arrays": "^5.0.0",
|
|
49
49
|
"undici": "^6.19.8",
|
|
50
50
|
"zod": "3.23.8",
|
|
51
|
-
"@atproto-labs/fetch-node": "^0.3.1",
|
|
52
|
-
"@atproto/api": "^0.20.16",
|
|
53
51
|
"@atproto-labs/xrpc-utils": "^0.1.1",
|
|
54
|
-
"@atproto/
|
|
52
|
+
"@atproto/api": "^0.20.16",
|
|
55
53
|
"@atproto/common": "^0.6.3",
|
|
54
|
+
"@atproto-labs/fetch-node": "^0.3.1",
|
|
55
|
+
"@atproto/crypto": "^0.5.1",
|
|
56
|
+
"@atproto/did": "^0.5.1",
|
|
56
57
|
"@atproto/identity": "^0.5.1",
|
|
57
|
-
"@atproto/lex": "^0.1.4",
|
|
58
58
|
"@atproto/repo": "^0.10.1",
|
|
59
|
-
"@atproto/
|
|
59
|
+
"@atproto/lex": "^0.1.4",
|
|
60
60
|
"@atproto/sync": "^0.3.2",
|
|
61
|
-
"@atproto/
|
|
62
|
-
"@atproto/
|
|
61
|
+
"@atproto/syntax": "^0.6.2",
|
|
62
|
+
"@atproto/xrpc-server": "^0.11.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@bufbuild/buf": "^1.28.1",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"@types/cors": "^2.8.12",
|
|
70
70
|
"@types/express": "^4.17.13",
|
|
71
71
|
"@types/express-serve-static-core": "^4.17.36",
|
|
72
|
-
"@types/pg": "^8.
|
|
72
|
+
"@types/pg": "^8.15.5",
|
|
73
73
|
"@types/qs": "^6.9.7",
|
|
74
74
|
"ts-node": "^10.8.2",
|
|
75
75
|
"vitest": "^4.0.16",
|
|
76
|
-
"@atproto/pds": "^0.5.
|
|
76
|
+
"@atproto/pds": "^0.5.6"
|
|
77
77
|
},
|
|
78
78
|
"type": "module",
|
|
79
79
|
"exports": {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
createPipeline,
|
|
15
15
|
} from '../../../../pipeline.js'
|
|
16
16
|
import { Views } from '../../../../views/index.js'
|
|
17
|
-
import { resHeaders } from '../../../util.js'
|
|
17
|
+
import { resHeaders, resolveSearchV2Override } from '../../../util.js'
|
|
18
18
|
|
|
19
19
|
export default function (server: Server, ctx: AppContext) {
|
|
20
20
|
const searchActors = createPipeline(
|
|
@@ -41,7 +41,14 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
41
41
|
}),
|
|
42
42
|
),
|
|
43
43
|
})
|
|
44
|
-
const results = await searchActors(
|
|
44
|
+
const results = await searchActors(
|
|
45
|
+
{
|
|
46
|
+
...params,
|
|
47
|
+
hydrateCtx,
|
|
48
|
+
isV2Override: resolveSearchV2Override(req, ctx.cfg),
|
|
49
|
+
},
|
|
50
|
+
ctx,
|
|
51
|
+
)
|
|
45
52
|
return {
|
|
46
53
|
encoding: 'application/json',
|
|
47
54
|
body: results,
|
|
@@ -109,9 +116,10 @@ const skeletonV2 = async (
|
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
|
112
|
-
const useV2 =
|
|
113
|
-
input.params.hydrateCtx.features.
|
|
114
|
-
|
|
119
|
+
const useV2 =
|
|
120
|
+
input.params.hydrateCtx.features.checkGate(
|
|
121
|
+
input.params.hydrateCtx.features.Gate.SearchV2Enable,
|
|
122
|
+
) || input.params.isV2Override
|
|
115
123
|
const skeletonFn = useV2 ? skeletonV2 : skeletonV1
|
|
116
124
|
return skeletonFn(input)
|
|
117
125
|
}
|
|
@@ -151,7 +159,10 @@ type Context = {
|
|
|
151
159
|
searchClient?: Client
|
|
152
160
|
}
|
|
153
161
|
|
|
154
|
-
type Params = app.bsky.actor.searchActors.$Params & {
|
|
162
|
+
type Params = app.bsky.actor.searchActors.$Params & {
|
|
163
|
+
hydrateCtx: HydrateCtx
|
|
164
|
+
isV2Override: boolean
|
|
165
|
+
}
|
|
155
166
|
|
|
156
167
|
type Skeleton = {
|
|
157
168
|
dids: DidString[]
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createPipeline,
|
|
14
14
|
} from '../../../../pipeline.js'
|
|
15
15
|
import { Views } from '../../../../views/index.js'
|
|
16
|
-
import { resHeaders } from '../../../util.js'
|
|
16
|
+
import { resHeaders, resolveSearchV2Override } from '../../../util.js'
|
|
17
17
|
|
|
18
18
|
export default function (server: Server, ctx: AppContext) {
|
|
19
19
|
const searchActorsTypeahead = createPipeline(
|
|
@@ -38,7 +38,11 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
38
38
|
),
|
|
39
39
|
})
|
|
40
40
|
const results = await searchActorsTypeahead(
|
|
41
|
-
{
|
|
41
|
+
{
|
|
42
|
+
...params,
|
|
43
|
+
hydrateCtx,
|
|
44
|
+
isV2Override: resolveSearchV2Override(req, ctx.cfg),
|
|
45
|
+
},
|
|
42
46
|
ctx,
|
|
43
47
|
)
|
|
44
48
|
return {
|
|
@@ -101,9 +105,10 @@ const skeletonV2 = async (
|
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
|
104
|
-
const useV2 =
|
|
105
|
-
input.params.hydrateCtx.features.
|
|
106
|
-
|
|
108
|
+
const useV2 =
|
|
109
|
+
input.params.hydrateCtx.features.checkGate(
|
|
110
|
+
input.params.hydrateCtx.features.Gate.SearchV2Enable,
|
|
111
|
+
) || input.params.isV2Override
|
|
107
112
|
const skeletonFn = useV2 ? skeletonV2 : skeletonV1
|
|
108
113
|
return skeletonFn(input)
|
|
109
114
|
}
|
|
@@ -149,6 +154,7 @@ type Context = {
|
|
|
149
154
|
|
|
150
155
|
type Params = app.bsky.actor.searchActorsTypeahead.$Params & {
|
|
151
156
|
hydrateCtx: HydrateCtx
|
|
157
|
+
isV2Override: boolean
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
type Skeleton = {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { SearchSortOrder } from '../../../../proto/bsky_pb.js'
|
|
23
23
|
import { uriToDid as creatorFromUri } from '../../../../util/uris.js'
|
|
24
24
|
import { Views } from '../../../../views/index.js'
|
|
25
|
-
import { resHeaders } from '../../../util.js'
|
|
25
|
+
import { resHeaders, resolveSearchV2Override } from '../../../util.js'
|
|
26
26
|
|
|
27
27
|
export default function (server: Server, ctx: AppContext) {
|
|
28
28
|
const searchPosts = createPipeline(
|
|
@@ -50,7 +50,12 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
50
50
|
),
|
|
51
51
|
})
|
|
52
52
|
const results = await searchPosts(
|
|
53
|
-
{
|
|
53
|
+
{
|
|
54
|
+
...params,
|
|
55
|
+
hydrateCtx,
|
|
56
|
+
isModService,
|
|
57
|
+
isV2Override: resolveSearchV2Override(req, ctx.cfg),
|
|
58
|
+
},
|
|
54
59
|
ctx,
|
|
55
60
|
)
|
|
56
61
|
return {
|
|
@@ -146,9 +151,10 @@ const skeletonV2 = async (
|
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
|
149
|
-
const useV2 =
|
|
150
|
-
input.params.hydrateCtx.features.
|
|
151
|
-
|
|
154
|
+
const useV2 =
|
|
155
|
+
input.params.hydrateCtx.features.checkGate(
|
|
156
|
+
input.params.hydrateCtx.features.Gate.SearchV2Enable,
|
|
157
|
+
) || input.params.isV2Override
|
|
152
158
|
const skeletonFn = useV2 ? skeletonV2 : skeletonV1
|
|
153
159
|
return skeletonFn(input)
|
|
154
160
|
}
|
|
@@ -237,6 +243,7 @@ type Context = {
|
|
|
237
243
|
type Params = app.bsky.feed.searchPosts.$Params & {
|
|
238
244
|
hydrateCtx: HydrateCtx
|
|
239
245
|
isModService: boolean
|
|
246
|
+
isV2Override: boolean
|
|
240
247
|
}
|
|
241
248
|
|
|
242
249
|
type Skeleton = {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '../../../../pipeline.js'
|
|
16
16
|
import { uriToDid as creatorFromUri } from '../../../../util/uris.js'
|
|
17
17
|
import { Views } from '../../../../views/index.js'
|
|
18
|
-
import { resHeaders } from '../../../util.js'
|
|
18
|
+
import { resHeaders, resolveSearchV2Override } from '../../../util.js'
|
|
19
19
|
|
|
20
20
|
export default function (server: Server, ctx: AppContext) {
|
|
21
21
|
const searchStarterPacks = createPipeline(
|
|
@@ -42,7 +42,14 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
42
42
|
}),
|
|
43
43
|
),
|
|
44
44
|
})
|
|
45
|
-
const results = await searchStarterPacks(
|
|
45
|
+
const results = await searchStarterPacks(
|
|
46
|
+
{
|
|
47
|
+
...params,
|
|
48
|
+
hydrateCtx,
|
|
49
|
+
isV2Override: resolveSearchV2Override(req, ctx.cfg),
|
|
50
|
+
},
|
|
51
|
+
ctx,
|
|
52
|
+
)
|
|
46
53
|
return {
|
|
47
54
|
encoding: 'application/json',
|
|
48
55
|
body: results,
|
|
@@ -107,9 +114,10 @@ const skeletonV2 = async (
|
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
|
110
|
-
const useV2 =
|
|
111
|
-
input.params.hydrateCtx.features.
|
|
112
|
-
|
|
117
|
+
const useV2 =
|
|
118
|
+
input.params.hydrateCtx.features.checkGate(
|
|
119
|
+
input.params.hydrateCtx.features.Gate.SearchV2Enable,
|
|
120
|
+
) || input.params.isV2Override
|
|
113
121
|
const skeletonFn = useV2 ? skeletonV2 : skeletonV1
|
|
114
122
|
return skeletonFn(input)
|
|
115
123
|
}
|
|
@@ -152,6 +160,7 @@ type Context = {
|
|
|
152
160
|
|
|
153
161
|
type Params = app.bsky.graph.searchStarterPacks.$Params & {
|
|
154
162
|
hydrateCtx: HydrateCtx
|
|
163
|
+
isV2Override: boolean
|
|
155
164
|
}
|
|
156
165
|
|
|
157
166
|
type Skeleton = {
|
|
@@ -4,7 +4,11 @@ import { Server } from '@atproto/xrpc-server'
|
|
|
4
4
|
import { AppContext } from '../../../../context.js'
|
|
5
5
|
import { parseString } from '../../../../hydration/util.js'
|
|
6
6
|
import { app } from '../../../../lexicons/index.js'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
clearlyBadCursor,
|
|
9
|
+
resHeaders,
|
|
10
|
+
resolveSearchV2Override,
|
|
11
|
+
} from '../../../util.js'
|
|
8
12
|
|
|
9
13
|
// THIS IS A TEMPORARY UNSPECCED ROUTE
|
|
10
14
|
// @TODO currently mirrors getSuggestedFeeds and ignores the "query" param.
|
|
@@ -37,9 +41,12 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
37
41
|
let uris: AtUriString[]
|
|
38
42
|
let cursor: string | undefined
|
|
39
43
|
|
|
44
|
+
const isV2Override = resolveSearchV2Override(req, ctx.cfg)
|
|
45
|
+
|
|
40
46
|
const query = params.query?.trim() ?? ''
|
|
41
47
|
if (query) {
|
|
42
|
-
const useV2 =
|
|
48
|
+
const useV2 =
|
|
49
|
+
features.checkGate(features.Gate.SearchV2Enable) || isV2Override
|
|
43
50
|
if (useV2) {
|
|
44
51
|
const res = await ctx.dataplane.searchFeedGeneratorsV2({
|
|
45
52
|
params: {
|
package/src/api/util.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IncomingHttpHeaders } from 'node:http'
|
|
2
|
+
import { ServerConfig } from '../config.js'
|
|
1
3
|
import { ParsedLabelers, formatLabelerHeader } from '../util.js'
|
|
2
4
|
|
|
3
5
|
export const BSKY_USER_AGENT = 'BskyAppView'
|
|
@@ -26,3 +28,18 @@ export const clearlyBadCursor = (cursor?: string) => {
|
|
|
26
28
|
// hallmark of v1 cursor, highly unlikely in v2 cursors based on time or rkeys
|
|
27
29
|
return !!cursor?.includes('::')
|
|
28
30
|
}
|
|
31
|
+
|
|
32
|
+
// @TEMPORARY backdoor to force search v2 via a request header, gated by the
|
|
33
|
+
// BSKY_SEARCH_V2_OVERRIDE_HEADER env var. Remove once search v2 is fully rolled out.
|
|
34
|
+
const SEARCH_V2_OVERRIDE_HEADER = 'x-bsky-search-v2-override'
|
|
35
|
+
|
|
36
|
+
export const resolveSearchV2Override = (
|
|
37
|
+
req: { headers: IncomingHttpHeaders },
|
|
38
|
+
cfg: ServerConfig,
|
|
39
|
+
): boolean => {
|
|
40
|
+
const expected = cfg.searchV2OverrideHeader
|
|
41
|
+
if (!expected) return false
|
|
42
|
+
const value = req.headers[SEARCH_V2_OVERRIDE_HEADER]
|
|
43
|
+
const header = Array.isArray(value) ? value.join(',') : value
|
|
44
|
+
return header === expected
|
|
45
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -110,6 +110,7 @@ export interface ServerConfigValues {
|
|
|
110
110
|
kws?: KwsConfig
|
|
111
111
|
debugFieldAllowedDids: Set<string>
|
|
112
112
|
draftsLimit: number
|
|
113
|
+
searchV2OverrideHeader?: string
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
export class ServerConfig {
|
|
@@ -331,6 +332,9 @@ export class ServerConfig {
|
|
|
331
332
|
? parseInt(process.env.BSKY_DRAFTS_LIMIT || '', 10)
|
|
332
333
|
: 500
|
|
333
334
|
|
|
335
|
+
const searchV2OverrideHeader =
|
|
336
|
+
process.env.BSKY_SEARCH_V2_OVERRIDE_HEADER || undefined
|
|
337
|
+
|
|
334
338
|
return new ServerConfig({
|
|
335
339
|
version,
|
|
336
340
|
debugMode,
|
|
@@ -399,6 +403,7 @@ export class ServerConfig {
|
|
|
399
403
|
kws,
|
|
400
404
|
debugFieldAllowedDids,
|
|
401
405
|
draftsLimit,
|
|
406
|
+
searchV2OverrideHeader,
|
|
402
407
|
...noUndefinedVals(overrides ?? {}),
|
|
403
408
|
})
|
|
404
409
|
}
|
|
@@ -675,6 +680,10 @@ export class ServerConfig {
|
|
|
675
680
|
get draftsLimit() {
|
|
676
681
|
return this.cfg.draftsLimit
|
|
677
682
|
}
|
|
683
|
+
|
|
684
|
+
get searchV2OverrideHeader() {
|
|
685
|
+
return this.cfg.searchV2OverrideHeader
|
|
686
|
+
}
|
|
678
687
|
}
|
|
679
688
|
|
|
680
689
|
function envList(str: string | undefined): string[] {
|
|
@@ -3,7 +3,6 @@ import EventEmitter from 'node:events'
|
|
|
3
3
|
import {
|
|
4
4
|
Kysely,
|
|
5
5
|
KyselyPlugin,
|
|
6
|
-
Migrator,
|
|
7
6
|
PluginTransformQueryArgs,
|
|
8
7
|
PluginTransformResultArgs,
|
|
9
8
|
PostgresDialect,
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
RootOperationNode,
|
|
12
11
|
UnknownRow,
|
|
13
12
|
} from 'kysely'
|
|
13
|
+
import { Migrator } from 'kysely/migration'
|
|
14
14
|
// eslint-disable-next-line import/default
|
|
15
15
|
import pg from 'pg'
|
|
16
16
|
// eslint-disable-next-line import/no-named-as-default-member
|
|
@@ -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
|
|