diff --git a/.changeset/slimy-trainers-tease.md b/.changeset/slimy-trainers-tease.md new file mode 100644 index 000000000..d203bfe7e --- /dev/null +++ b/.changeset/slimy-trainers-tease.md @@ -0,0 +1,5 @@ +--- +"@atproto/api": patch +--- + +add com.atproto.sync.listReposByCollection Lexicon diff --git a/lexicons/com/atproto/sync/listReposByCollection.json b/lexicons/com/atproto/sync/listReposByCollection.json new file mode 100644 index 000000000..040277234 --- /dev/null +++ b/lexicons/com/atproto/sync/listReposByCollection.json @@ -0,0 +1,46 @@ +{ + "lexicon": 1, + "id": "com.atproto.sync.listReposByCollection", + "defs": { + "main": { + "type": "query", + "description": "Enumerates all the DIDs which have records with the given collection NSID.", + "parameters": { + "type": "params", + "required": ["collection"], + "properties": { + "collection": { "type": "string", "format": "nsid" }, + "limit": { + "type": "integer", + "description": "Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.", + "minimum": 1, + "maximum": 2000, + "default": 500 + }, + "cursor": { "type": "string" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repos"], + "properties": { + "cursor": { "type": "string" }, + "repos": { + "type": "array", + "items": { "type": "ref", "ref": "#repo" } + } + } + } + } + }, + "repo": { + "type": "object", + "required": ["did"], + "properties": { + "did": { "type": "string", "format": "did" } + } + } + } +} diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index 0f0c06dfb..f1f4af198 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -80,6 +80,7 @@ import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js' import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js' +import * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js' import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js' import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js' @@ -310,6 +311,7 @@ export * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js' export * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js' export * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js' export * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js' +export * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js' export * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js' export * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js' export * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js' @@ -1473,6 +1475,18 @@ export class ComAtprotoSyncNS { ) } + listReposByCollection( + params?: ComAtprotoSyncListReposByCollection.QueryParams, + opts?: ComAtprotoSyncListReposByCollection.CallOptions, + ): Promise { + return this._client.call( + 'com.atproto.sync.listReposByCollection', + params, + undefined, + opts, + ) + } + notifyOfUpdate( data?: ComAtprotoSyncNotifyOfUpdate.InputSchema, opts?: ComAtprotoSyncNotifyOfUpdate.CallOptions, diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index c02dac82c..c3c55ebce 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -3661,6 +3661,67 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncListReposByCollection: { + lexicon: 1, + id: 'com.atproto.sync.listReposByCollection', + defs: { + main: { + type: 'query', + description: + 'Enumerates all the DIDs which have records with the given collection NSID.', + parameters: { + type: 'params', + required: ['collection'], + properties: { + collection: { + type: 'string', + format: 'nsid', + }, + limit: { + type: 'integer', + description: + 'Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.', + minimum: 1, + maximum: 2000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['repos'], + properties: { + cursor: { + type: 'string', + }, + repos: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.sync.listReposByCollection#repo', + }, + }, + }, + }, + }, + }, + repo: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, ComAtprotoSyncNotifyOfUpdate: { lexicon: 1, id: 'com.atproto.sync.notifyOfUpdate', @@ -14091,6 +14152,7 @@ export const ids = { ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', + ComAtprotoSyncListReposByCollection: 'com.atproto.sync.listReposByCollection', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl', ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos', diff --git a/packages/api/src/client/types/com/atproto/sync/listReposByCollection.ts b/packages/api/src/client/types/com/atproto/sync/listReposByCollection.ts new file mode 100644 index 000000000..4b26739f2 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/sync/listReposByCollection.ts @@ -0,0 +1,56 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { HeadersMap, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' +import { validate as _validate } from '../../../../lexicons' +import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util' + +const is$typed = _is$typed, + validate = _validate +const id = 'com.atproto.sync.listReposByCollection' + +export interface QueryParams { + collection: string + /** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */ + limit?: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + repos: Repo[] +} + +export interface CallOptions { + signal?: AbortSignal + headers?: HeadersMap +} + +export interface Response { + success: boolean + headers: HeadersMap + data: OutputSchema +} + +export function toKnownErr(e: any) { + return e +} + +export interface Repo { + $type?: 'com.atproto.sync.listReposByCollection#repo' + did: string +} + +const hashRepo = 'repo' + +export function isRepo(v: V) { + return is$typed(v, id, hashRepo) +} + +export function validateRepo(v: V) { + return validate(v, id, hashRepo) +} diff --git a/packages/bsky/src/lexicon/index.ts b/packages/bsky/src/lexicon/index.ts index 056cc278d..4cdbd7ecc 100644 --- a/packages/bsky/src/lexicon/index.ts +++ b/packages/bsky/src/lexicon/index.ts @@ -77,6 +77,7 @@ import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js' import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js' +import * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js' import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js' import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js' @@ -1065,6 +1066,17 @@ export class ComAtprotoSyncNS { return this._server.xrpc.method(nsid, cfg) } + listReposByCollection( + cfg: ConfigOf< + AV, + ComAtprotoSyncListReposByCollection.Handler>, + ComAtprotoSyncListReposByCollection.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.sync.listReposByCollection' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + notifyOfUpdate( cfg: ConfigOf< AV, diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index bc0170642..9d5be5240 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -3661,6 +3661,67 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncListReposByCollection: { + lexicon: 1, + id: 'com.atproto.sync.listReposByCollection', + defs: { + main: { + type: 'query', + description: + 'Enumerates all the DIDs which have records with the given collection NSID.', + parameters: { + type: 'params', + required: ['collection'], + properties: { + collection: { + type: 'string', + format: 'nsid', + }, + limit: { + type: 'integer', + description: + 'Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.', + minimum: 1, + maximum: 2000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['repos'], + properties: { + cursor: { + type: 'string', + }, + repos: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.sync.listReposByCollection#repo', + }, + }, + }, + }, + }, + }, + repo: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, ComAtprotoSyncNotifyOfUpdate: { lexicon: 1, id: 'com.atproto.sync.notifyOfUpdate', @@ -11055,6 +11116,7 @@ export const ids = { ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', + ComAtprotoSyncListReposByCollection: 'com.atproto.sync.listReposByCollection', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl', ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos', diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/listReposByCollection.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/listReposByCollection.ts new file mode 100644 index 000000000..4dc747e23 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/listReposByCollection.ts @@ -0,0 +1,68 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' +import { validate as _validate } from '../../../../lexicons' +import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +const is$typed = _is$typed, + validate = _validate +const id = 'com.atproto.sync.listReposByCollection' + +export interface QueryParams { + collection: string + /** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */ + limit: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + repos: Repo[] +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response + resetRouteRateLimits: () => Promise +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput + +export interface Repo { + $type?: 'com.atproto.sync.listReposByCollection#repo' + did: string +} + +const hashRepo = 'repo' + +export function isRepo(v: V) { + return is$typed(v, id, hashRepo) +} + +export function validateRepo(v: V) { + return validate(v, id, hashRepo) +} diff --git a/packages/ozone/src/lexicon/index.ts b/packages/ozone/src/lexicon/index.ts index fc1e6956d..f04f5b345 100644 --- a/packages/ozone/src/lexicon/index.ts +++ b/packages/ozone/src/lexicon/index.ts @@ -77,6 +77,7 @@ import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js' import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js' +import * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js' import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js' import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js' @@ -1109,6 +1110,17 @@ export class ComAtprotoSyncNS { return this._server.xrpc.method(nsid, cfg) } + listReposByCollection( + cfg: ConfigOf< + AV, + ComAtprotoSyncListReposByCollection.Handler>, + ComAtprotoSyncListReposByCollection.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.sync.listReposByCollection' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + notifyOfUpdate( cfg: ConfigOf< AV, diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index c02dac82c..c3c55ebce 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -3661,6 +3661,67 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncListReposByCollection: { + lexicon: 1, + id: 'com.atproto.sync.listReposByCollection', + defs: { + main: { + type: 'query', + description: + 'Enumerates all the DIDs which have records with the given collection NSID.', + parameters: { + type: 'params', + required: ['collection'], + properties: { + collection: { + type: 'string', + format: 'nsid', + }, + limit: { + type: 'integer', + description: + 'Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.', + minimum: 1, + maximum: 2000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['repos'], + properties: { + cursor: { + type: 'string', + }, + repos: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.sync.listReposByCollection#repo', + }, + }, + }, + }, + }, + }, + repo: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, ComAtprotoSyncNotifyOfUpdate: { lexicon: 1, id: 'com.atproto.sync.notifyOfUpdate', @@ -14091,6 +14152,7 @@ export const ids = { ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', + ComAtprotoSyncListReposByCollection: 'com.atproto.sync.listReposByCollection', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl', ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos', diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/listReposByCollection.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/listReposByCollection.ts new file mode 100644 index 000000000..4dc747e23 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/listReposByCollection.ts @@ -0,0 +1,68 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' +import { validate as _validate } from '../../../../lexicons' +import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +const is$typed = _is$typed, + validate = _validate +const id = 'com.atproto.sync.listReposByCollection' + +export interface QueryParams { + collection: string + /** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */ + limit: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + repos: Repo[] +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response + resetRouteRateLimits: () => Promise +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput + +export interface Repo { + $type?: 'com.atproto.sync.listReposByCollection#repo' + did: string +} + +const hashRepo = 'repo' + +export function isRepo(v: V) { + return is$typed(v, id, hashRepo) +} + +export function validateRepo(v: V) { + return validate(v, id, hashRepo) +} diff --git a/packages/pds/src/lexicon/index.ts b/packages/pds/src/lexicon/index.ts index fc1e6956d..f04f5b345 100644 --- a/packages/pds/src/lexicon/index.ts +++ b/packages/pds/src/lexicon/index.ts @@ -77,6 +77,7 @@ import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js' import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js' +import * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js' import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js' import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js' @@ -1109,6 +1110,17 @@ export class ComAtprotoSyncNS { return this._server.xrpc.method(nsid, cfg) } + listReposByCollection( + cfg: ConfigOf< + AV, + ComAtprotoSyncListReposByCollection.Handler>, + ComAtprotoSyncListReposByCollection.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.sync.listReposByCollection' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + notifyOfUpdate( cfg: ConfigOf< AV, diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index c02dac82c..c3c55ebce 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -3661,6 +3661,67 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncListReposByCollection: { + lexicon: 1, + id: 'com.atproto.sync.listReposByCollection', + defs: { + main: { + type: 'query', + description: + 'Enumerates all the DIDs which have records with the given collection NSID.', + parameters: { + type: 'params', + required: ['collection'], + properties: { + collection: { + type: 'string', + format: 'nsid', + }, + limit: { + type: 'integer', + description: + 'Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.', + minimum: 1, + maximum: 2000, + default: 500, + }, + cursor: { + type: 'string', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['repos'], + properties: { + cursor: { + type: 'string', + }, + repos: { + type: 'array', + items: { + type: 'ref', + ref: 'lex:com.atproto.sync.listReposByCollection#repo', + }, + }, + }, + }, + }, + }, + repo: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + }, + }, ComAtprotoSyncNotifyOfUpdate: { lexicon: 1, id: 'com.atproto.sync.notifyOfUpdate', @@ -14091,6 +14152,7 @@ export const ids = { ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', + ComAtprotoSyncListReposByCollection: 'com.atproto.sync.listReposByCollection', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl', ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos', diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/listReposByCollection.ts b/packages/pds/src/lexicon/types/com/atproto/sync/listReposByCollection.ts new file mode 100644 index 000000000..4dc747e23 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/sync/listReposByCollection.ts @@ -0,0 +1,68 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' +import { validate as _validate } from '../../../../lexicons' +import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +const is$typed = _is$typed, + validate = _validate +const id = 'com.atproto.sync.listReposByCollection' + +export interface QueryParams { + collection: string + /** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */ + limit: number + cursor?: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + cursor?: string + repos: Repo[] +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response + resetRouteRateLimits: () => Promise +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput + +export interface Repo { + $type?: 'com.atproto.sync.listReposByCollection#repo' + did: string +} + +const hashRepo = 'repo' + +export function isRepo(v: V) { + return is$typed(v, id, hashRepo) +} + +export function validateRepo(v: V) { + return validate(v, id, hashRepo) +}