From 27d2145f39dd9ec24bc7935179fa2a9798f566ce Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 13 Sep 2023 15:18:52 -0700 Subject: [PATCH 01/10] proposed new search lexicons --- lexicons/app/bsky/actor/searchActors.json | 9 ++-- .../app/bsky/actor/searchActorsTypeahead.json | 7 ++- lexicons/app/bsky/feed/searchPosts.json | 43 +++++++++++++++ .../bsky/unspecced/searchActorsSkeleton.json | 53 +++++++++++++++++++ .../bsky/unspecced/searchPostsSkeleton.json | 43 +++++++++++++++ 5 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 lexicons/app/bsky/feed/searchPosts.json create mode 100644 lexicons/app/bsky/unspecced/searchActorsSkeleton.json create mode 100644 lexicons/app/bsky/unspecced/searchPostsSkeleton.json diff --git a/lexicons/app/bsky/actor/searchActors.json b/lexicons/app/bsky/actor/searchActors.json index dc76ad8fc39..687f7d30d3e 100644 --- a/lexicons/app/bsky/actor/searchActors.json +++ b/lexicons/app/bsky/actor/searchActors.json @@ -4,16 +4,19 @@ "defs": { "main": { "type": "query", - "description": "Find actors matching search criteria.", + "description": "Find actors (profiles) matching search criteria.", "parameters": { "type": "params", "properties": { - "term": { "type": "string" }, + "term": { + "type":"string", + "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" + }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, - "default": 50 + "default": 25 }, "cursor": { "type": "string" } } diff --git a/lexicons/app/bsky/actor/searchActorsTypeahead.json b/lexicons/app/bsky/actor/searchActorsTypeahead.json index 7065f3d7117..dc561d2ad08 100644 --- a/lexicons/app/bsky/actor/searchActorsTypeahead.json +++ b/lexicons/app/bsky/actor/searchActorsTypeahead.json @@ -8,12 +8,15 @@ "parameters": { "type": "params", "properties": { - "term": { "type": "string" }, + "term": { + "type": "string", + "description": "search query prefix; not a full query string" + }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, - "default": 50 + "default": 10 } } }, diff --git a/lexicons/app/bsky/feed/searchPosts.json b/lexicons/app/bsky/feed/searchPosts.json new file mode 100644 index 00000000000..ac778163fe1 --- /dev/null +++ b/lexicons/app/bsky/feed/searchPosts.json @@ -0,0 +1,43 @@ +{ + "lexicon": 1, + "id": "app.bsky.feed.searchPosts", + "defs": { + "main": { + "type": "query", + "description": "Find posts matching search criteria", + "parameters": { + "type": "params", + "required": ["q"], + "properties": { + "q": { "type": "string", "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 25 + }, + "cursor": { "type": "string", "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["posts"], + "properties": { + "cursor": { "type": "string" }, + "hits_total": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, + "posts": { + "type": "array", + "items": { + "type": "ref", + "ref": "app.bsky.feed.defs#postView" + } + } + } + } + }, + "errors": [{ "name": "BadQueryString" }] + } + } +} diff --git a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json new file mode 100644 index 00000000000..5a8e7473e43 --- /dev/null +++ b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "app.bsky.unspecced.searchActorsSkeleton", + "defs": { + "main": { + "type": "query", + "description": "Backend Actors (profile) search, returning only skeleton", + "parameters": { + "type": "params", + "required": ["q"], + "properties": { + "q": { + "type": "string", + "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax" + }, + "typeahead": { + "type": "boolean", + "description": "if true, acts as fast/simple 'typeahead' query" + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 25 + }, + "cursor": { + "type": "string", + "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["actors"], + "properties": { + "cursor": { "type": "string" }, + "hits_total": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, + "posts": { + "type": "array", + "items": { + "type": "string", + "format": "did" + } + } + } + } + }, + "errors": [{ "name": "BadQueryString" }] + } + } +} diff --git a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json new file mode 100644 index 00000000000..7ed35a3b1d1 --- /dev/null +++ b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json @@ -0,0 +1,43 @@ +{ + "lexicon": 1, + "id": "app.bsky.unspecced.searchPostsSkeleton", + "defs": { + "main": { + "type": "query", + "description": "Backend Posts search, returning only skeleton", + "parameters": { + "type": "params", + "required": ["q"], + "properties": { + "q": { "type": "string", "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 25 + }, + "cursor": { "type": "string", "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["posts"], + "properties": { + "cursor": { "type": "string" }, + "hits_total": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, + "posts": { + "type": "array", + "items": { + "type": "string", + "format": "at-uri" + } + } + } + } + }, + "errors": [{ "name": "BadQueryString" }] + } + } +} From 12f3711a21977bd4da5d146524b29e7a34e64a2c Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 13 Sep 2023 15:46:40 -0700 Subject: [PATCH 02/10] lexicons: lint --- lexicons/app/bsky/actor/searchActors.json | 4 ++-- lexicons/app/bsky/feed/searchPosts.json | 15 ++++++++++++--- .../bsky/unspecced/searchActorsSkeleton.json | 17 ++++++++++------- .../app/bsky/unspecced/searchPostsSkeleton.json | 15 ++++++++++++--- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lexicons/app/bsky/actor/searchActors.json b/lexicons/app/bsky/actor/searchActors.json index 687f7d30d3e..db783a1f1f7 100644 --- a/lexicons/app/bsky/actor/searchActors.json +++ b/lexicons/app/bsky/actor/searchActors.json @@ -9,8 +9,8 @@ "type": "params", "properties": { "term": { - "type":"string", - "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" + "type": "string", + "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" }, "limit": { "type": "integer", diff --git a/lexicons/app/bsky/feed/searchPosts.json b/lexicons/app/bsky/feed/searchPosts.json index ac778163fe1..238fe77743b 100644 --- a/lexicons/app/bsky/feed/searchPosts.json +++ b/lexicons/app/bsky/feed/searchPosts.json @@ -9,14 +9,20 @@ "type": "params", "required": ["q"], "properties": { - "q": { "type": "string", "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" }, + "q": { + "type": "string", + "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" + }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 }, - "cursor": { "type": "string", "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" } + "cursor": { + "type": "string", + "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" + } } }, "output": { @@ -26,7 +32,10 @@ "required": ["posts"], "properties": { "cursor": { "type": "string" }, - "hits_total": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, + "hits_total": { + "type": "integer", + "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" + }, "posts": { "type": "array", "items": { diff --git a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json index 5a8e7473e43..d8be37e4664 100644 --- a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json @@ -10,12 +10,12 @@ "required": ["q"], "properties": { "q": { - "type": "string", - "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax" + "type": "string", + "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax" }, "typeahead": { - "type": "boolean", - "description": "if true, acts as fast/simple 'typeahead' query" + "type": "boolean", + "description": "if true, acts as fast/simple 'typeahead' query" }, "limit": { "type": "integer", @@ -24,8 +24,8 @@ "default": 25 }, "cursor": { - "type": "string", - "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" + "type": "string", + "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" } } }, @@ -36,7 +36,10 @@ "required": ["actors"], "properties": { "cursor": { "type": "string" }, - "hits_total": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, + "hits_total": { + "type": "integer", + "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" + }, "posts": { "type": "array", "items": { diff --git a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json index 7ed35a3b1d1..3148ac0e31a 100644 --- a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json @@ -9,14 +9,20 @@ "type": "params", "required": ["q"], "properties": { - "q": { "type": "string", "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" }, + "q": { + "type": "string", + "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" + }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 }, - "cursor": { "type": "string", "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" } + "cursor": { + "type": "string", + "description": "optional pagination mechanism; may not necessarily allow scrolling through entire result set" + } } }, "output": { @@ -26,7 +32,10 @@ "required": ["posts"], "properties": { "cursor": { "type": "string" }, - "hits_total": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, + "hits_total": { + "type": "integer", + "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" + }, "posts": { "type": "array", "items": { From 0d9133975618b5a6bb995b87bd62024d60ee0397 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 13 Sep 2023 16:31:12 -0700 Subject: [PATCH 03/10] lexicons: fix actors typo --- lexicons/app/bsky/unspecced/searchActorsSkeleton.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json index d8be37e4664..f15ecf154f2 100644 --- a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json @@ -40,7 +40,7 @@ "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, - "posts": { + "actors": { "type": "array", "items": { "type": "string", From 25a21f9d57baa36e8ed1f8dd1485426b98283ded Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 13 Sep 2023 21:35:53 -0700 Subject: [PATCH 04/10] lexicons: camelCase bites again, ssssss --- lexicons/app/bsky/feed/searchPosts.json | 2 +- lexicons/app/bsky/unspecced/searchActorsSkeleton.json | 2 +- lexicons/app/bsky/unspecced/searchPostsSkeleton.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lexicons/app/bsky/feed/searchPosts.json b/lexicons/app/bsky/feed/searchPosts.json index 238fe77743b..34eb38f686e 100644 --- a/lexicons/app/bsky/feed/searchPosts.json +++ b/lexicons/app/bsky/feed/searchPosts.json @@ -32,7 +32,7 @@ "required": ["posts"], "properties": { "cursor": { "type": "string" }, - "hits_total": { + "hitsTotal": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, diff --git a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json index f15ecf154f2..ed527a29f47 100644 --- a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json @@ -36,7 +36,7 @@ "required": ["actors"], "properties": { "cursor": { "type": "string" }, - "hits_total": { + "hitsTotal": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, diff --git a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json index 3148ac0e31a..dccb046cb54 100644 --- a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json @@ -32,7 +32,7 @@ "required": ["posts"], "properties": { "cursor": { "type": "string" }, - "hits_total": { + "hitsTotal": { "type": "integer", "description": "count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits" }, From 288d113c7010508dcbf4b8726c66ef257c1ec1fb Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 18 Sep 2023 17:56:43 -0700 Subject: [PATCH 05/10] lexicons: add 'q' and mark 'term' as deprecated for search endpoints --- lexicons/app/bsky/actor/searchActors.json | 4 ++++ lexicons/app/bsky/actor/searchActorsTypeahead.json | 4 ++++ lexicons/com/atproto/admin/searchRepos.json | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lexicons/app/bsky/actor/searchActors.json b/lexicons/app/bsky/actor/searchActors.json index db783a1f1f7..f65e2fc953b 100644 --- a/lexicons/app/bsky/actor/searchActors.json +++ b/lexicons/app/bsky/actor/searchActors.json @@ -9,6 +9,10 @@ "type": "params", "properties": { "term": { + "type": "string", + "description": "DEPRECATED: use 'q' instead" + }, + "q": { "type": "string", "description": "search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended" }, diff --git a/lexicons/app/bsky/actor/searchActorsTypeahead.json b/lexicons/app/bsky/actor/searchActorsTypeahead.json index dc561d2ad08..f94dd6c3f69 100644 --- a/lexicons/app/bsky/actor/searchActorsTypeahead.json +++ b/lexicons/app/bsky/actor/searchActorsTypeahead.json @@ -9,6 +9,10 @@ "type": "params", "properties": { "term": { + "type": "string", + "description": "DEPRECATED: use 'q' instead" + }, + "q": { "type": "string", "description": "search query prefix; not a full query string" }, diff --git a/lexicons/com/atproto/admin/searchRepos.json b/lexicons/com/atproto/admin/searchRepos.json index fb9c90f343c..85cc6fd482a 100644 --- a/lexicons/com/atproto/admin/searchRepos.json +++ b/lexicons/com/atproto/admin/searchRepos.json @@ -8,7 +8,11 @@ "parameters": { "type": "params", "properties": { - "term": { "type": "string" }, + "term": { + "type": "string", + "description": "DEPRECATED: use 'q' instead" + }, + "q": { "type": "string" }, "invitedBy": { "type": "string" }, "limit": { "type": "integer", From f4163b0888c25cf9ba26d8b578be172a543f9dfa Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 21 Sep 2023 00:43:06 -0700 Subject: [PATCH 06/10] codegen for search lexicon updates --- packages/api/src/client/index.ts | 39 ++++ packages/api/src/client/lexicons.ts | 212 +++++++++++++++++- .../types/app/bsky/actor/searchActors.ts | 3 + .../app/bsky/actor/searchActorsTypeahead.ts | 3 + .../client/types/app/bsky/feed/searchPosts.ts | 50 +++++ .../bsky/unspecced/searchActorsSkeleton.ts | 51 +++++ .../app/bsky/unspecced/searchPostsSkeleton.ts | 49 ++++ .../types/com/atproto/admin/searchRepos.ts | 2 + packages/bsky/src/lexicon/index.ts | 36 +++ packages/bsky/src/lexicon/lexicons.ts | 212 +++++++++++++++++- .../types/app/bsky/actor/searchActors.ts | 3 + .../app/bsky/actor/searchActorsTypeahead.ts | 3 + .../types/app/bsky/feed/searchPosts.ts | 54 +++++ .../bsky/unspecced/searchActorsSkeleton.ts | 55 +++++ .../app/bsky/unspecced/searchPostsSkeleton.ts | 53 +++++ .../types/com/atproto/admin/searchRepos.ts | 2 + packages/pds/src/lexicon/index.ts | 36 +++ packages/pds/src/lexicon/lexicons.ts | 212 +++++++++++++++++- .../types/app/bsky/actor/searchActors.ts | 3 + .../app/bsky/actor/searchActorsTypeahead.ts | 3 + .../types/app/bsky/feed/searchPosts.ts | 54 +++++ .../bsky/unspecced/searchActorsSkeleton.ts | 55 +++++ .../app/bsky/unspecced/searchPostsSkeleton.ts | 53 +++++ .../types/com/atproto/admin/searchRepos.ts | 2 + 24 files changed, 1236 insertions(+), 9 deletions(-) create mode 100644 packages/api/src/client/types/app/bsky/feed/searchPosts.ts create mode 100644 packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts create mode 100644 packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts create mode 100644 packages/bsky/src/lexicon/types/app/bsky/feed/searchPosts.ts create mode 100644 packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts create mode 100644 packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts create mode 100644 packages/pds/src/lexicon/types/app/bsky/feed/searchPosts.ts create mode 100644 packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts create mode 100644 packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index d72fe659e50..e63a0784b02 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -103,6 +103,7 @@ import * as AppBskyFeedGetTimeline from './types/app/bsky/feed/getTimeline' import * as AppBskyFeedLike from './types/app/bsky/feed/like' import * as AppBskyFeedPost from './types/app/bsky/feed/post' import * as AppBskyFeedRepost from './types/app/bsky/feed/repost' +import * as AppBskyFeedSearchPosts from './types/app/bsky/feed/searchPosts' import * as AppBskyFeedThreadgate from './types/app/bsky/feed/threadgate' import * as AppBskyGraphBlock from './types/app/bsky/graph/block' import * as AppBskyGraphDefs from './types/app/bsky/graph/defs' @@ -132,6 +133,8 @@ import * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLa import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular' import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators' import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton' +import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton' +import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton' export * as ComAtprotoAdminDefs from './types/com/atproto/admin/defs' export * as ComAtprotoAdminDisableAccountInvites from './types/com/atproto/admin/disableAccountInvites' @@ -229,6 +232,7 @@ export * as AppBskyFeedGetTimeline from './types/app/bsky/feed/getTimeline' export * as AppBskyFeedLike from './types/app/bsky/feed/like' export * as AppBskyFeedPost from './types/app/bsky/feed/post' export * as AppBskyFeedRepost from './types/app/bsky/feed/repost' +export * as AppBskyFeedSearchPosts from './types/app/bsky/feed/searchPosts' export * as AppBskyFeedThreadgate from './types/app/bsky/feed/threadgate' export * as AppBskyGraphBlock from './types/app/bsky/graph/block' export * as AppBskyGraphDefs from './types/app/bsky/graph/defs' @@ -258,6 +262,8 @@ export * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLa export * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular' export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators' export * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton' +export * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton' +export * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton' export const COM_ATPROTO_ADMIN = { DefsTakedown: 'com.atproto.admin.defs#takedown', @@ -1381,6 +1387,17 @@ export class FeedNS { throw AppBskyFeedGetTimeline.toKnownErr(e) }) } + + searchPosts( + params?: AppBskyFeedSearchPosts.QueryParams, + opts?: AppBskyFeedSearchPosts.CallOptions, + ): Promise { + return this._service.xrpc + .call('app.bsky.feed.searchPosts', params, undefined, opts) + .catch((e) => { + throw AppBskyFeedSearchPosts.toKnownErr(e) + }) + } } export class GeneratorRecord { @@ -2282,4 +2299,26 @@ export class UnspeccedNS { throw AppBskyUnspeccedGetTimelineSkeleton.toKnownErr(e) }) } + + searchActorsSkeleton( + params?: AppBskyUnspeccedSearchActorsSkeleton.QueryParams, + opts?: AppBskyUnspeccedSearchActorsSkeleton.CallOptions, + ): Promise { + return this._service.xrpc + .call('app.bsky.unspecced.searchActorsSkeleton', params, undefined, opts) + .catch((e) => { + throw AppBskyUnspeccedSearchActorsSkeleton.toKnownErr(e) + }) + } + + searchPostsSkeleton( + params?: AppBskyUnspeccedSearchPostsSkeleton.QueryParams, + opts?: AppBskyUnspeccedSearchPostsSkeleton.CallOptions, + ): Promise { + return this._service.xrpc + .call('app.bsky.unspecced.searchPostsSkeleton', params, undefined, opts) + .catch((e) => { + throw AppBskyUnspeccedSearchPostsSkeleton.toKnownErr(e) + }) + } } diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 48b1276adc8..0d48cd3646b 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -1113,6 +1113,10 @@ export const schemaDict = { properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', }, invitedBy: { type: 'string', @@ -3998,18 +4002,24 @@ export const schemaDict = { defs: { main: { type: 'query', - description: 'Find actors matching search criteria.', + description: 'Find actors (profiles) matching search criteria.', parameters: { type: 'params', properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', }, limit: { type: 'integer', minimum: 1, maximum: 100, - default: 50, + default: 25, }, cursor: { type: 'string', @@ -4050,12 +4060,17 @@ export const schemaDict = { properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', + description: 'search query prefix; not a full query string', }, limit: { type: 'integer', minimum: 1, maximum: 100, - default: 50, + default: 10, }, }, }, @@ -5703,6 +5718,67 @@ export const schemaDict = { }, }, }, + AppBskyFeedSearchPosts: { + lexicon: 1, + id: 'app.bsky.feed.searchPosts', + defs: { + main: { + type: 'query', + description: 'Find posts matching search criteria', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['posts'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + posts: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:app.bsky.feed.defs#postView', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, AppBskyFeedThreadgate: { lexicon: 1, id: 'app.bsky.feed.threadgate', @@ -6973,6 +7049,132 @@ export const schemaDict = { }, }, }, + AppBskyUnspeccedSearchActorsSkeleton: { + lexicon: 1, + id: 'app.bsky.unspecced.searchActorsSkeleton', + defs: { + main: { + type: 'query', + description: 'Backend Actors (profile) search, returning only skeleton', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax', + }, + typeahead: { + type: 'boolean', + description: "if true, acts as fast/simple 'typeahead' query", + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['actors'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + actors: { + type: 'array', + items: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, + AppBskyUnspeccedSearchPostsSkeleton: { + lexicon: 1, + id: 'app.bsky.unspecced.searchPostsSkeleton', + defs: { + main: { + type: 'query', + description: 'Backend Posts search, returning only skeleton', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['posts'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + posts: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, } export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[] export const lexicons: Lexicons = new Lexicons(schemas) @@ -7079,6 +7281,7 @@ export const ids = { AppBskyFeedLike: 'app.bsky.feed.like', AppBskyFeedPost: 'app.bsky.feed.post', AppBskyFeedRepost: 'app.bsky.feed.repost', + AppBskyFeedSearchPosts: 'app.bsky.feed.searchPosts', AppBskyFeedThreadgate: 'app.bsky.feed.threadgate', AppBskyGraphBlock: 'app.bsky.graph.block', AppBskyGraphDefs: 'app.bsky.graph.defs', @@ -7111,4 +7314,7 @@ export const ids = { AppBskyUnspeccedGetPopularFeedGenerators: 'app.bsky.unspecced.getPopularFeedGenerators', AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton', + AppBskyUnspeccedSearchActorsSkeleton: + 'app.bsky.unspecced.searchActorsSkeleton', + AppBskyUnspeccedSearchPostsSkeleton: 'app.bsky.unspecced.searchPostsSkeleton', } diff --git a/packages/api/src/client/types/app/bsky/actor/searchActors.ts b/packages/api/src/client/types/app/bsky/actor/searchActors.ts index 526e012910f..5e6527606d8 100644 --- a/packages/api/src/client/types/app/bsky/actor/searchActors.ts +++ b/packages/api/src/client/types/app/bsky/actor/searchActors.ts @@ -9,7 +9,10 @@ import { CID } from 'multiformats/cid' import * as AppBskyActorDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q?: string limit?: number cursor?: string } diff --git a/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts b/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts index 5bb1557b406..5818d6f64ad 100644 --- a/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts @@ -9,7 +9,10 @@ import { CID } from 'multiformats/cid' import * as AppBskyActorDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + /** search query prefix; not a full query string */ + q?: string limit?: number } diff --git a/packages/api/src/client/types/app/bsky/feed/searchPosts.ts b/packages/api/src/client/types/app/bsky/feed/searchPosts.ts new file mode 100644 index 00000000000..6b8613a2e1f --- /dev/null +++ b/packages/api/src/client/types/app/bsky/feed/searchPosts.ts @@ -0,0 +1,50 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' +import * as AppBskyFeedDefs from './defs' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q: string + limit?: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + posts: AppBskyFeedDefs.PostView[] + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export class BadQueryStringError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + if (e.error === 'BadQueryString') return new BadQueryStringError(e) + } + return e +} diff --git a/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts new file mode 100644 index 00000000000..8b52fbb649a --- /dev/null +++ b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -0,0 +1,51 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */ + q: string + /** if true, acts as fast/simple 'typeahead' query */ + typeahead?: boolean + limit?: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + actors: string[] + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export class BadQueryStringError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + if (e.error === 'BadQueryString') return new BadQueryStringError(e) + } + return e +} diff --git a/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts new file mode 100644 index 00000000000..823eddaf5b5 --- /dev/null +++ b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -0,0 +1,49 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q: string + limit?: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + posts: string[] + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export class BadQueryStringError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + if (e.error === 'BadQueryString') return new BadQueryStringError(e) + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/admin/searchRepos.ts b/packages/api/src/client/types/com/atproto/admin/searchRepos.ts index a43e0ee7322..372cc98ff13 100644 --- a/packages/api/src/client/types/com/atproto/admin/searchRepos.ts +++ b/packages/api/src/client/types/com/atproto/admin/searchRepos.ts @@ -9,7 +9,9 @@ import { CID } from 'multiformats/cid' import * as ComAtprotoAdminDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + q?: string invitedBy?: string limit?: number cursor?: string diff --git a/packages/bsky/src/lexicon/index.ts b/packages/bsky/src/lexicon/index.ts index 52635132470..3ec69a3503f 100644 --- a/packages/bsky/src/lexicon/index.ts +++ b/packages/bsky/src/lexicon/index.ts @@ -89,6 +89,7 @@ import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts' import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy' import * as AppBskyFeedGetSuggestedFeeds from './types/app/bsky/feed/getSuggestedFeeds' import * as AppBskyFeedGetTimeline from './types/app/bsky/feed/getTimeline' +import * as AppBskyFeedSearchPosts from './types/app/bsky/feed/searchPosts' import * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks' import * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers' import * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows' @@ -110,6 +111,8 @@ import * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLa import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular' import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators' import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton' +import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton' +import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton' export const COM_ATPROTO_ADMIN = { DefsTakedown: 'com.atproto.admin.defs#takedown', @@ -1168,6 +1171,17 @@ export class FeedNS { const nsid = 'app.bsky.feed.getTimeline' // @ts-ignore return this._server.xrpc.method(nsid, cfg) } + + searchPosts( + cfg: ConfigOf< + AV, + AppBskyFeedSearchPosts.Handler>, + AppBskyFeedSearchPosts.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.feed.searchPosts' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } } export class GraphNS { @@ -1431,6 +1445,28 @@ export class UnspeccedNS { const nsid = 'app.bsky.unspecced.getTimelineSkeleton' // @ts-ignore return this._server.xrpc.method(nsid, cfg) } + + searchActorsSkeleton( + cfg: ConfigOf< + AV, + AppBskyUnspeccedSearchActorsSkeleton.Handler>, + AppBskyUnspeccedSearchActorsSkeleton.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.unspecced.searchActorsSkeleton' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + searchPostsSkeleton( + cfg: ConfigOf< + AV, + AppBskyUnspeccedSearchPostsSkeleton.Handler>, + AppBskyUnspeccedSearchPostsSkeleton.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.unspecced.searchPostsSkeleton' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } } type SharedRateLimitOpts = { diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 48b1276adc8..0d48cd3646b 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -1113,6 +1113,10 @@ export const schemaDict = { properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', }, invitedBy: { type: 'string', @@ -3998,18 +4002,24 @@ export const schemaDict = { defs: { main: { type: 'query', - description: 'Find actors matching search criteria.', + description: 'Find actors (profiles) matching search criteria.', parameters: { type: 'params', properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', }, limit: { type: 'integer', minimum: 1, maximum: 100, - default: 50, + default: 25, }, cursor: { type: 'string', @@ -4050,12 +4060,17 @@ export const schemaDict = { properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', + description: 'search query prefix; not a full query string', }, limit: { type: 'integer', minimum: 1, maximum: 100, - default: 50, + default: 10, }, }, }, @@ -5703,6 +5718,67 @@ export const schemaDict = { }, }, }, + AppBskyFeedSearchPosts: { + lexicon: 1, + id: 'app.bsky.feed.searchPosts', + defs: { + main: { + type: 'query', + description: 'Find posts matching search criteria', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['posts'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + posts: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:app.bsky.feed.defs#postView', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, AppBskyFeedThreadgate: { lexicon: 1, id: 'app.bsky.feed.threadgate', @@ -6973,6 +7049,132 @@ export const schemaDict = { }, }, }, + AppBskyUnspeccedSearchActorsSkeleton: { + lexicon: 1, + id: 'app.bsky.unspecced.searchActorsSkeleton', + defs: { + main: { + type: 'query', + description: 'Backend Actors (profile) search, returning only skeleton', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax', + }, + typeahead: { + type: 'boolean', + description: "if true, acts as fast/simple 'typeahead' query", + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['actors'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + actors: { + type: 'array', + items: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, + AppBskyUnspeccedSearchPostsSkeleton: { + lexicon: 1, + id: 'app.bsky.unspecced.searchPostsSkeleton', + defs: { + main: { + type: 'query', + description: 'Backend Posts search, returning only skeleton', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['posts'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + posts: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, } export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[] export const lexicons: Lexicons = new Lexicons(schemas) @@ -7079,6 +7281,7 @@ export const ids = { AppBskyFeedLike: 'app.bsky.feed.like', AppBskyFeedPost: 'app.bsky.feed.post', AppBskyFeedRepost: 'app.bsky.feed.repost', + AppBskyFeedSearchPosts: 'app.bsky.feed.searchPosts', AppBskyFeedThreadgate: 'app.bsky.feed.threadgate', AppBskyGraphBlock: 'app.bsky.graph.block', AppBskyGraphDefs: 'app.bsky.graph.defs', @@ -7111,4 +7314,7 @@ export const ids = { AppBskyUnspeccedGetPopularFeedGenerators: 'app.bsky.unspecced.getPopularFeedGenerators', AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton', + AppBskyUnspeccedSearchActorsSkeleton: + 'app.bsky.unspecced.searchActorsSkeleton', + AppBskyUnspeccedSearchPostsSkeleton: 'app.bsky.unspecced.searchPostsSkeleton', } diff --git a/packages/bsky/src/lexicon/types/app/bsky/actor/searchActors.ts b/packages/bsky/src/lexicon/types/app/bsky/actor/searchActors.ts index f620a463cff..0222f3658da 100644 --- a/packages/bsky/src/lexicon/types/app/bsky/actor/searchActors.ts +++ b/packages/bsky/src/lexicon/types/app/bsky/actor/searchActors.ts @@ -10,7 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server' import * as AppBskyActorDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q?: string limit: number cursor?: string } diff --git a/packages/bsky/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts b/packages/bsky/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts index 4f5bbb7c23c..ba0d62444ce 100644 --- a/packages/bsky/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/bsky/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts @@ -10,7 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server' import * as AppBskyActorDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + /** search query prefix; not a full query string */ + q?: string limit: number } diff --git a/packages/bsky/src/lexicon/types/app/bsky/feed/searchPosts.ts b/packages/bsky/src/lexicon/types/app/bsky/feed/searchPosts.ts new file mode 100644 index 00000000000..6b5fe08e467 --- /dev/null +++ b/packages/bsky/src/lexicon/types/app/bsky/feed/searchPosts.ts @@ -0,0 +1,54 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth } from '@atproto/xrpc-server' +import * as AppBskyFeedDefs from './defs' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q: string + limit: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + posts: AppBskyFeedDefs.PostView[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'BadQueryString' +} + +export type HandlerOutput = HandlerError | HandlerSuccess +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts new file mode 100644 index 00000000000..0c094484338 --- /dev/null +++ b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -0,0 +1,55 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth } from '@atproto/xrpc-server' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */ + q: string + /** if true, acts as fast/simple 'typeahead' query */ + typeahead?: boolean + limit: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + actors: string[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'BadQueryString' +} + +export type HandlerOutput = HandlerError | HandlerSuccess +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts new file mode 100644 index 00000000000..808e54147d6 --- /dev/null +++ b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -0,0 +1,53 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth } from '@atproto/xrpc-server' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q: string + limit: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + posts: string[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'BadQueryString' +} + +export type HandlerOutput = HandlerError | HandlerSuccess +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/admin/searchRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/admin/searchRepos.ts index c79cd046ca0..32266fd66fd 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/admin/searchRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/admin/searchRepos.ts @@ -10,7 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server' import * as ComAtprotoAdminDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + q?: string invitedBy?: string limit: number cursor?: string diff --git a/packages/pds/src/lexicon/index.ts b/packages/pds/src/lexicon/index.ts index 52635132470..3ec69a3503f 100644 --- a/packages/pds/src/lexicon/index.ts +++ b/packages/pds/src/lexicon/index.ts @@ -89,6 +89,7 @@ import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts' import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy' import * as AppBskyFeedGetSuggestedFeeds from './types/app/bsky/feed/getSuggestedFeeds' import * as AppBskyFeedGetTimeline from './types/app/bsky/feed/getTimeline' +import * as AppBskyFeedSearchPosts from './types/app/bsky/feed/searchPosts' import * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks' import * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers' import * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows' @@ -110,6 +111,8 @@ import * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLa import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular' import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators' import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton' +import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton' +import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton' export const COM_ATPROTO_ADMIN = { DefsTakedown: 'com.atproto.admin.defs#takedown', @@ -1168,6 +1171,17 @@ export class FeedNS { const nsid = 'app.bsky.feed.getTimeline' // @ts-ignore return this._server.xrpc.method(nsid, cfg) } + + searchPosts( + cfg: ConfigOf< + AV, + AppBskyFeedSearchPosts.Handler>, + AppBskyFeedSearchPosts.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.feed.searchPosts' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } } export class GraphNS { @@ -1431,6 +1445,28 @@ export class UnspeccedNS { const nsid = 'app.bsky.unspecced.getTimelineSkeleton' // @ts-ignore return this._server.xrpc.method(nsid, cfg) } + + searchActorsSkeleton( + cfg: ConfigOf< + AV, + AppBskyUnspeccedSearchActorsSkeleton.Handler>, + AppBskyUnspeccedSearchActorsSkeleton.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.unspecced.searchActorsSkeleton' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + + searchPostsSkeleton( + cfg: ConfigOf< + AV, + AppBskyUnspeccedSearchPostsSkeleton.Handler>, + AppBskyUnspeccedSearchPostsSkeleton.HandlerReqCtx> + >, + ) { + const nsid = 'app.bsky.unspecced.searchPostsSkeleton' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } } type SharedRateLimitOpts = { diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 48b1276adc8..0d48cd3646b 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -1113,6 +1113,10 @@ export const schemaDict = { properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', }, invitedBy: { type: 'string', @@ -3998,18 +4002,24 @@ export const schemaDict = { defs: { main: { type: 'query', - description: 'Find actors matching search criteria.', + description: 'Find actors (profiles) matching search criteria.', parameters: { type: 'params', properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', }, limit: { type: 'integer', minimum: 1, maximum: 100, - default: 50, + default: 25, }, cursor: { type: 'string', @@ -4050,12 +4060,17 @@ export const schemaDict = { properties: { term: { type: 'string', + description: "DEPRECATED: use 'q' instead", + }, + q: { + type: 'string', + description: 'search query prefix; not a full query string', }, limit: { type: 'integer', minimum: 1, maximum: 100, - default: 50, + default: 10, }, }, }, @@ -5703,6 +5718,67 @@ export const schemaDict = { }, }, }, + AppBskyFeedSearchPosts: { + lexicon: 1, + id: 'app.bsky.feed.searchPosts', + defs: { + main: { + type: 'query', + description: 'Find posts matching search criteria', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['posts'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + posts: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:app.bsky.feed.defs#postView', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, AppBskyFeedThreadgate: { lexicon: 1, id: 'app.bsky.feed.threadgate', @@ -6973,6 +7049,132 @@ export const schemaDict = { }, }, }, + AppBskyUnspeccedSearchActorsSkeleton: { + lexicon: 1, + id: 'app.bsky.unspecced.searchActorsSkeleton', + defs: { + main: { + type: 'query', + description: 'Backend Actors (profile) search, returning only skeleton', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax', + }, + typeahead: { + type: 'boolean', + description: "if true, acts as fast/simple 'typeahead' query", + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['actors'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + actors: { + type: 'array', + items: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, + AppBskyUnspeccedSearchPostsSkeleton: { + lexicon: 1, + id: 'app.bsky.unspecced.searchPostsSkeleton', + defs: { + main: { + type: 'query', + description: 'Backend Posts search, returning only skeleton', + parameters: { + type: 'params', + required: ['q'], + properties: { + q: { + type: 'string', + description: + 'search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended', + }, + limit: { + type: 'integer', + minimum: 1, + maximum: 100, + default: 25, + }, + cursor: { + type: 'string', + description: + 'optional pagination mechanism; may not necessarily allow scrolling through entire result set', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['posts'], + properties: { + cursor: { + type: 'string', + }, + hitsTotal: { + type: 'integer', + description: + 'count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits', + }, + posts: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', + }, + }, + }, + }, + }, + errors: [ + { + name: 'BadQueryString', + }, + ], + }, + }, + }, } export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[] export const lexicons: Lexicons = new Lexicons(schemas) @@ -7079,6 +7281,7 @@ export const ids = { AppBskyFeedLike: 'app.bsky.feed.like', AppBskyFeedPost: 'app.bsky.feed.post', AppBskyFeedRepost: 'app.bsky.feed.repost', + AppBskyFeedSearchPosts: 'app.bsky.feed.searchPosts', AppBskyFeedThreadgate: 'app.bsky.feed.threadgate', AppBskyGraphBlock: 'app.bsky.graph.block', AppBskyGraphDefs: 'app.bsky.graph.defs', @@ -7111,4 +7314,7 @@ export const ids = { AppBskyUnspeccedGetPopularFeedGenerators: 'app.bsky.unspecced.getPopularFeedGenerators', AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton', + AppBskyUnspeccedSearchActorsSkeleton: + 'app.bsky.unspecced.searchActorsSkeleton', + AppBskyUnspeccedSearchPostsSkeleton: 'app.bsky.unspecced.searchPostsSkeleton', } diff --git a/packages/pds/src/lexicon/types/app/bsky/actor/searchActors.ts b/packages/pds/src/lexicon/types/app/bsky/actor/searchActors.ts index f620a463cff..0222f3658da 100644 --- a/packages/pds/src/lexicon/types/app/bsky/actor/searchActors.ts +++ b/packages/pds/src/lexicon/types/app/bsky/actor/searchActors.ts @@ -10,7 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server' import * as AppBskyActorDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q?: string limit: number cursor?: string } diff --git a/packages/pds/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts b/packages/pds/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts index 4f5bbb7c23c..ba0d62444ce 100644 --- a/packages/pds/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/pds/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts @@ -10,7 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server' import * as AppBskyActorDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + /** search query prefix; not a full query string */ + q?: string limit: number } diff --git a/packages/pds/src/lexicon/types/app/bsky/feed/searchPosts.ts b/packages/pds/src/lexicon/types/app/bsky/feed/searchPosts.ts new file mode 100644 index 00000000000..6b5fe08e467 --- /dev/null +++ b/packages/pds/src/lexicon/types/app/bsky/feed/searchPosts.ts @@ -0,0 +1,54 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth } from '@atproto/xrpc-server' +import * as AppBskyFeedDefs from './defs' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q: string + limit: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + posts: AppBskyFeedDefs.PostView[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'BadQueryString' +} + +export type HandlerOutput = HandlerError | HandlerSuccess +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts new file mode 100644 index 00000000000..0c094484338 --- /dev/null +++ b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -0,0 +1,55 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth } from '@atproto/xrpc-server' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */ + q: string + /** if true, acts as fast/simple 'typeahead' query */ + typeahead?: boolean + limit: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + actors: string[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'BadQueryString' +} + +export type HandlerOutput = HandlerError | HandlerSuccess +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts new file mode 100644 index 00000000000..808e54147d6 --- /dev/null +++ b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -0,0 +1,53 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth } from '@atproto/xrpc-server' + +export interface QueryParams { + /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ + q: string + limit: number + /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ + hitsTotal?: number + posts: string[] + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'BadQueryString' +} + +export type HandlerOutput = HandlerError | HandlerSuccess +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/admin/searchRepos.ts b/packages/pds/src/lexicon/types/com/atproto/admin/searchRepos.ts index c79cd046ca0..32266fd66fd 100644 --- a/packages/pds/src/lexicon/types/com/atproto/admin/searchRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/admin/searchRepos.ts @@ -10,7 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server' import * as ComAtprotoAdminDefs from './defs' export interface QueryParams { + /** DEPRECATED: use 'q' instead */ term?: string + q?: string invitedBy?: string limit: number cursor?: string From 49cc94f9f2b8d4514123391f6ffb068c07407643 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 21 Sep 2023 00:51:53 -0700 Subject: [PATCH 07/10] bsky: prefer 'q' over 'term' in existing search endpoints --- packages/bsky/src/api/app/bsky/actor/searchActors.ts | 8 +++++++- .../bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts | 8 +++++++- packages/bsky/src/api/com/atproto/admin/searchRepos.ts | 5 +++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/bsky/src/api/app/bsky/actor/searchActors.ts b/packages/bsky/src/api/app/bsky/actor/searchActors.ts index df5821a03f9..92dcea3db93 100644 --- a/packages/bsky/src/api/app/bsky/actor/searchActors.ts +++ b/packages/bsky/src/api/app/bsky/actor/searchActors.ts @@ -11,8 +11,14 @@ export default function (server: Server, ctx: AppContext) { server.app.bsky.actor.searchActors({ auth: ctx.authOptionalVerifier, handler: async ({ auth, params }) => { - const { cursor, limit, term: rawTerm } = params + const { cursor, limit, term: rawTerm, q: rawQ } = params const requester = auth.credentials.did + + // prefer new 'q' query param over deprecated 'term' + if (rawQ) { + rawTerm = rawQ + } + const term = cleanTerm(rawTerm || '') const db = ctx.db.getReplica('search') diff --git a/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts b/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts index 64bcd811d02..f1d5fb50d9e 100644 --- a/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts @@ -9,8 +9,14 @@ export default function (server: Server, ctx: AppContext) { server.app.bsky.actor.searchActorsTypeahead({ auth: ctx.authOptionalVerifier, handler: async ({ params, auth }) => { - const { limit, term: rawTerm } = params + const { limit, term: rawTerm, q: rawQ } = params const requester = auth.credentials.did + + // prefer new 'q' query param over deprecated 'term' + if (rawQ) { + rawTerm = rawQ + } + const term = cleanTerm(rawTerm || '') const db = ctx.db.getReplica('search') diff --git a/packages/bsky/src/api/com/atproto/admin/searchRepos.ts b/packages/bsky/src/api/com/atproto/admin/searchRepos.ts index 9945b27fcb4..a17421e90cd 100644 --- a/packages/bsky/src/api/com/atproto/admin/searchRepos.ts +++ b/packages/bsky/src/api/com/atproto/admin/searchRepos.ts @@ -12,6 +12,11 @@ export default function (server: Server, ctx: AppContext) { if (invitedBy) { throw new InvalidRequestError('The invitedBy parameter is unsupported') } + // prefer new 'q' query param over deprecated 'term' + const { q } = params + if (q) { + params.term = q + } const { results, cursor } = await ctx.services .actor(db) From a74d871132b49539f13f5bdd4fabbd04c30ff552 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 21 Sep 2023 01:06:33 -0700 Subject: [PATCH 08/10] search: bugfix --- packages/bsky/src/api/app/bsky/actor/searchActors.ts | 2 +- packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bsky/src/api/app/bsky/actor/searchActors.ts b/packages/bsky/src/api/app/bsky/actor/searchActors.ts index 92dcea3db93..d4ae0a8d264 100644 --- a/packages/bsky/src/api/app/bsky/actor/searchActors.ts +++ b/packages/bsky/src/api/app/bsky/actor/searchActors.ts @@ -11,7 +11,7 @@ export default function (server: Server, ctx: AppContext) { server.app.bsky.actor.searchActors({ auth: ctx.authOptionalVerifier, handler: async ({ auth, params }) => { - const { cursor, limit, term: rawTerm, q: rawQ } = params + let { cursor, limit, term: rawTerm, q: rawQ } = params const requester = auth.credentials.did // prefer new 'q' query param over deprecated 'term' diff --git a/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts b/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts index f1d5fb50d9e..c438c4d2324 100644 --- a/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/bsky/src/api/app/bsky/actor/searchActorsTypeahead.ts @@ -9,7 +9,7 @@ export default function (server: Server, ctx: AppContext) { server.app.bsky.actor.searchActorsTypeahead({ auth: ctx.authOptionalVerifier, handler: async ({ params, auth }) => { - const { limit, term: rawTerm, q: rawQ } = params + let { limit, term: rawTerm, q: rawQ } = params const requester = auth.credentials.did // prefer new 'q' query param over deprecated 'term' From a698e6595c8db870678025f9ec8df91fe0fa0716 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 21 Sep 2023 18:51:24 -0700 Subject: [PATCH 09/10] lexicons: make unspecced search endpoints return skeleton obj --- lexicons/app/bsky/unspecced/defs.json | 20 +++++++++++++++++++ .../bsky/unspecced/searchActorsSkeleton.json | 4 ++-- .../bsky/unspecced/searchPostsSkeleton.json | 4 ++-- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 lexicons/app/bsky/unspecced/defs.json diff --git a/lexicons/app/bsky/unspecced/defs.json b/lexicons/app/bsky/unspecced/defs.json new file mode 100644 index 00000000000..e9925922a3e --- /dev/null +++ b/lexicons/app/bsky/unspecced/defs.json @@ -0,0 +1,20 @@ +{ + "lexicon": 1, + "id": "app.bsky.unspecced.defs", + "defs": { + "skeletonSearchPost": { + "type": "object", + "required": ["uri"], + "properties": { + "uri": { "type": "string", "format": "at-uri" } + } + }, + "skeletonSearchActor": { + "type": "object", + "required": ["did"], + "properties": { + "did": { "type": "string", "format": "did" } + } + } + } +} diff --git a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json index ed527a29f47..108dacf9b14 100644 --- a/lexicons/app/bsky/unspecced/searchActorsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchActorsSkeleton.json @@ -43,8 +43,8 @@ "actors": { "type": "array", "items": { - "type": "string", - "format": "did" + "type": "ref", + "ref": "app.bsky.unspecced.defs#skeletonSearchActor" } } } diff --git a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json index dccb046cb54..532bfea79f9 100644 --- a/lexicons/app/bsky/unspecced/searchPostsSkeleton.json +++ b/lexicons/app/bsky/unspecced/searchPostsSkeleton.json @@ -39,8 +39,8 @@ "posts": { "type": "array", "items": { - "type": "string", - "format": "at-uri" + "type": "ref", + "ref": "app.bsky.unspecced.defs#skeletonSearchPost" } } } From f41ddabb8e31e14afb56f0cb4647f6f12227aa50 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 21 Sep 2023 18:52:47 -0700 Subject: [PATCH 10/10] re-codegen for search skeleton obj --- packages/api/src/client/index.ts | 2 + packages/api/src/client/lexicons.ts | 35 ++++++++++++++-- .../client/types/app/bsky/unspecced/defs.ts | 41 +++++++++++++++++++ .../bsky/unspecced/searchActorsSkeleton.ts | 3 +- .../app/bsky/unspecced/searchPostsSkeleton.ts | 3 +- packages/bsky/src/lexicon/lexicons.ts | 35 ++++++++++++++-- .../lexicon/types/app/bsky/unspecced/defs.ts | 41 +++++++++++++++++++ .../bsky/unspecced/searchActorsSkeleton.ts | 3 +- .../app/bsky/unspecced/searchPostsSkeleton.ts | 3 +- packages/pds/src/lexicon/lexicons.ts | 35 ++++++++++++++-- .../lexicon/types/app/bsky/unspecced/defs.ts | 41 +++++++++++++++++++ .../bsky/unspecced/searchActorsSkeleton.ts | 3 +- .../app/bsky/unspecced/searchPostsSkeleton.ts | 3 +- 13 files changed, 230 insertions(+), 18 deletions(-) create mode 100644 packages/api/src/client/types/app/bsky/unspecced/defs.ts create mode 100644 packages/bsky/src/lexicon/types/app/bsky/unspecced/defs.ts create mode 100644 packages/pds/src/lexicon/types/app/bsky/unspecced/defs.ts diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index e63a0784b02..4d9ae10936b 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -130,6 +130,7 @@ import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/ import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet' import * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLabels' +import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs' import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular' import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators' import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton' @@ -259,6 +260,7 @@ export * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/ export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen' export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet' export * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLabels' +export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs' export * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular' export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators' export * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton' diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 0d48cd3646b..1c4c9b681af 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -6908,6 +6908,32 @@ export const schemaDict = { }, }, }, + AppBskyUnspeccedDefs: { + lexicon: 1, + id: 'app.bsky.unspecced.defs', + defs: { + skeletonSearchPost: { + type: 'object', + required: ['uri'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + skeletonSearchActor: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, AppBskyUnspeccedGetPopular: { lexicon: 1, id: 'app.bsky.unspecced.getPopular', @@ -7099,8 +7125,8 @@ export const schemaDict = { actors: { type: 'array', items: { - type: 'string', - format: 'did', + type: 'ref', + ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor', }, }, }, @@ -7160,8 +7186,8 @@ export const schemaDict = { posts: { type: 'array', items: { - type: 'string', - format: 'at-uri', + type: 'ref', + ref: 'lex:app.bsky.unspecced.defs#skeletonSearchPost', }, }, }, @@ -7310,6 +7336,7 @@ export const ids = { AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', AppBskyRichtextFacet: 'app.bsky.richtext.facet', AppBskyUnspeccedApplyLabels: 'app.bsky.unspecced.applyLabels', + AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs', AppBskyUnspeccedGetPopular: 'app.bsky.unspecced.getPopular', AppBskyUnspeccedGetPopularFeedGenerators: 'app.bsky.unspecced.getPopularFeedGenerators', diff --git a/packages/api/src/client/types/app/bsky/unspecced/defs.ts b/packages/api/src/client/types/app/bsky/unspecced/defs.ts new file mode 100644 index 00000000000..ecee03578af --- /dev/null +++ b/packages/api/src/client/types/app/bsky/unspecced/defs.ts @@ -0,0 +1,41 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface SkeletonSearchPost { + uri: string + [k: string]: unknown +} + +export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.unspecced.defs#skeletonSearchPost' + ) +} + +export function validateSkeletonSearchPost(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchPost', v) +} + +export interface SkeletonSearchActor { + did: string + [k: string]: unknown +} + +export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.unspecced.defs#skeletonSearchActor' + ) +} + +export function validateSkeletonSearchActor(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchActor', v) +} diff --git a/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts index 8b52fbb649a..7cc2729620e 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -6,6 +6,7 @@ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { isObj, hasProp } from '../../../../util' import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import * as AppBskyUnspeccedDefs from './defs' export interface QueryParams { /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */ @@ -23,7 +24,7 @@ export interface OutputSchema { cursor?: string /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ hitsTotal?: number - actors: string[] + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[] [k: string]: unknown } diff --git a/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts index 823eddaf5b5..07391886f8f 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -6,6 +6,7 @@ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { isObj, hasProp } from '../../../../util' import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import * as AppBskyUnspeccedDefs from './defs' export interface QueryParams { /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ @@ -21,7 +22,7 @@ export interface OutputSchema { cursor?: string /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ hitsTotal?: number - posts: string[] + posts: AppBskyUnspeccedDefs.SkeletonSearchPost[] [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 0d48cd3646b..1c4c9b681af 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -6908,6 +6908,32 @@ export const schemaDict = { }, }, }, + AppBskyUnspeccedDefs: { + lexicon: 1, + id: 'app.bsky.unspecced.defs', + defs: { + skeletonSearchPost: { + type: 'object', + required: ['uri'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + skeletonSearchActor: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, AppBskyUnspeccedGetPopular: { lexicon: 1, id: 'app.bsky.unspecced.getPopular', @@ -7099,8 +7125,8 @@ export const schemaDict = { actors: { type: 'array', items: { - type: 'string', - format: 'did', + type: 'ref', + ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor', }, }, }, @@ -7160,8 +7186,8 @@ export const schemaDict = { posts: { type: 'array', items: { - type: 'string', - format: 'at-uri', + type: 'ref', + ref: 'lex:app.bsky.unspecced.defs#skeletonSearchPost', }, }, }, @@ -7310,6 +7336,7 @@ export const ids = { AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', AppBskyRichtextFacet: 'app.bsky.richtext.facet', AppBskyUnspeccedApplyLabels: 'app.bsky.unspecced.applyLabels', + AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs', AppBskyUnspeccedGetPopular: 'app.bsky.unspecced.getPopular', AppBskyUnspeccedGetPopularFeedGenerators: 'app.bsky.unspecced.getPopularFeedGenerators', diff --git a/packages/bsky/src/lexicon/types/app/bsky/unspecced/defs.ts b/packages/bsky/src/lexicon/types/app/bsky/unspecced/defs.ts new file mode 100644 index 00000000000..59a6b38064c --- /dev/null +++ b/packages/bsky/src/lexicon/types/app/bsky/unspecced/defs.ts @@ -0,0 +1,41 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' + +export interface SkeletonSearchPost { + uri: string + [k: string]: unknown +} + +export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.unspecced.defs#skeletonSearchPost' + ) +} + +export function validateSkeletonSearchPost(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchPost', v) +} + +export interface SkeletonSearchActor { + did: string + [k: string]: unknown +} + +export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.unspecced.defs#skeletonSearchActor' + ) +} + +export function validateSkeletonSearchActor(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchActor', v) +} diff --git a/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts index 0c094484338..2cf59bf86a9 100644 --- a/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts +++ b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons' import { isObj, hasProp } from '../../../../util' import { CID } from 'multiformats/cid' import { HandlerAuth } from '@atproto/xrpc-server' +import * as AppBskyUnspeccedDefs from './defs' export interface QueryParams { /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */ @@ -24,7 +25,7 @@ export interface OutputSchema { cursor?: string /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ hitsTotal?: number - actors: string[] + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[] [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts index 808e54147d6..df990d2c5c6 100644 --- a/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts +++ b/packages/bsky/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons' import { isObj, hasProp } from '../../../../util' import { CID } from 'multiformats/cid' import { HandlerAuth } from '@atproto/xrpc-server' +import * as AppBskyUnspeccedDefs from './defs' export interface QueryParams { /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ @@ -22,7 +23,7 @@ export interface OutputSchema { cursor?: string /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ hitsTotal?: number - posts: string[] + posts: AppBskyUnspeccedDefs.SkeletonSearchPost[] [k: string]: unknown } diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 0d48cd3646b..1c4c9b681af 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -6908,6 +6908,32 @@ export const schemaDict = { }, }, }, + AppBskyUnspeccedDefs: { + lexicon: 1, + id: 'app.bsky.unspecced.defs', + defs: { + skeletonSearchPost: { + type: 'object', + required: ['uri'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + }, + }, + skeletonSearchActor: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, AppBskyUnspeccedGetPopular: { lexicon: 1, id: 'app.bsky.unspecced.getPopular', @@ -7099,8 +7125,8 @@ export const schemaDict = { actors: { type: 'array', items: { - type: 'string', - format: 'did', + type: 'ref', + ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor', }, }, }, @@ -7160,8 +7186,8 @@ export const schemaDict = { posts: { type: 'array', items: { - type: 'string', - format: 'at-uri', + type: 'ref', + ref: 'lex:app.bsky.unspecced.defs#skeletonSearchPost', }, }, }, @@ -7310,6 +7336,7 @@ export const ids = { AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen', AppBskyRichtextFacet: 'app.bsky.richtext.facet', AppBskyUnspeccedApplyLabels: 'app.bsky.unspecced.applyLabels', + AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs', AppBskyUnspeccedGetPopular: 'app.bsky.unspecced.getPopular', AppBskyUnspeccedGetPopularFeedGenerators: 'app.bsky.unspecced.getPopularFeedGenerators', diff --git a/packages/pds/src/lexicon/types/app/bsky/unspecced/defs.ts b/packages/pds/src/lexicon/types/app/bsky/unspecced/defs.ts new file mode 100644 index 00000000000..59a6b38064c --- /dev/null +++ b/packages/pds/src/lexicon/types/app/bsky/unspecced/defs.ts @@ -0,0 +1,41 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' + +export interface SkeletonSearchPost { + uri: string + [k: string]: unknown +} + +export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.unspecced.defs#skeletonSearchPost' + ) +} + +export function validateSkeletonSearchPost(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchPost', v) +} + +export interface SkeletonSearchActor { + did: string + [k: string]: unknown +} + +export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.unspecced.defs#skeletonSearchActor' + ) +} + +export function validateSkeletonSearchActor(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchActor', v) +} diff --git a/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts index 0c094484338..2cf59bf86a9 100644 --- a/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts +++ b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons' import { isObj, hasProp } from '../../../../util' import { CID } from 'multiformats/cid' import { HandlerAuth } from '@atproto/xrpc-server' +import * as AppBskyUnspeccedDefs from './defs' export interface QueryParams { /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax */ @@ -24,7 +25,7 @@ export interface OutputSchema { cursor?: string /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ hitsTotal?: number - actors: string[] + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[] [k: string]: unknown } diff --git a/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts index 808e54147d6..df990d2c5c6 100644 --- a/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts +++ b/packages/pds/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons' import { isObj, hasProp } from '../../../../util' import { CID } from 'multiformats/cid' import { HandlerAuth } from '@atproto/xrpc-server' +import * as AppBskyUnspeccedDefs from './defs' export interface QueryParams { /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ @@ -22,7 +23,7 @@ export interface OutputSchema { cursor?: string /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ hitsTotal?: number - posts: string[] + posts: AppBskyUnspeccedDefs.SkeletonSearchPost[] [k: string]: unknown }