├── .devcontainer └── devcontainer.json ├── .env.example ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ └── build-push-docker.yml ├── .gitignore ├── .prettierrc ├── .vscode ├── launch.json └── settings.json ├── Dockerfile ├── LICENSE ├── README.md ├── images ├── 18-plus-nd.png ├── australia.png ├── cats.png ├── dads-media.png ├── dads.png ├── discourse.png ├── elusive.png ├── keyboards.png ├── nd.png ├── overheard.png ├── paxaus.png └── testtube.jpg ├── package.json ├── scripts ├── addSelfToList.ts ├── publish18plusND.ts ├── publishAuspol.ts ├── publishCats.ts ├── publishDads.ts ├── publishDadsMedia.ts ├── publishDiscourse.ts ├── publishElusive.ts ├── publishFeedGen.ts ├── publishKeyboards.ts ├── publishND.ts ├── publishOverheard.ts └── publishPAXAus.ts ├── src ├── addn │ ├── algoManager.ts │ ├── batchUpdate.ts │ ├── getListMembers.ts │ ├── getPostAsWebhookPayload.ts │ ├── getPostFromURI.ts │ ├── getPostsForUser.ts │ ├── getUserDetails.ts │ ├── getUserFollows.ts │ ├── getUserLists.ts │ ├── rateLimit.ts │ ├── resolveDIDToHandle.ts │ ├── resolveHandleToDID.ts │ └── setListMembers.ts ├── algos │ ├── 18-plus-nd.ts │ ├── auspol.ts │ ├── cats.ts │ ├── dads-media.ts │ ├── dads.ts │ ├── discourse.ts │ ├── elusive.ts │ ├── externalList.ts │ ├── for-science.ts │ ├── index.ts │ ├── keyboards.ts │ ├── nd.ts │ ├── overheard.ts │ ├── paxaus.ts │ └── twelve-words.ts ├── config.ts ├── db │ ├── dbClient.ts │ ├── index.ts │ └── schema.ts ├── index.ts ├── lexicon │ ├── index.ts │ ├── lexicons.ts │ ├── types │ │ ├── app │ │ │ └── bsky │ │ │ │ ├── actor │ │ │ │ ├── defs.ts │ │ │ │ ├── getPreferences.ts │ │ │ │ ├── getProfile.ts │ │ │ │ ├── getProfiles.ts │ │ │ │ ├── getSuggestions.ts │ │ │ │ ├── profile.ts │ │ │ │ ├── putPreferences.ts │ │ │ │ ├── searchActors.ts │ │ │ │ └── searchActorsTypeahead.ts │ │ │ │ ├── embed │ │ │ │ ├── external.ts │ │ │ │ ├── images.ts │ │ │ │ ├── record.ts │ │ │ │ └── recordWithMedia.ts │ │ │ │ ├── feed │ │ │ │ ├── defs.ts │ │ │ │ ├── describeFeedGenerator.ts │ │ │ │ ├── generator.ts │ │ │ │ ├── getActorFeeds.ts │ │ │ │ ├── getActorLikes.ts │ │ │ │ ├── getAuthorFeed.ts │ │ │ │ ├── getFeed.ts │ │ │ │ ├── getFeedGenerator.ts │ │ │ │ ├── getFeedGenerators.ts │ │ │ │ ├── getFeedSkeleton.ts │ │ │ │ ├── getLikes.ts │ │ │ │ ├── getListFeed.ts │ │ │ │ ├── getPostThread.ts │ │ │ │ ├── getPosts.ts │ │ │ │ ├── getRepostedBy.ts │ │ │ │ ├── getSavedFeeds.ts │ │ │ │ ├── getSuggestedFeeds.ts │ │ │ │ ├── getTimeline.ts │ │ │ │ ├── like.ts │ │ │ │ ├── post.ts │ │ │ │ ├── repost.ts │ │ │ │ ├── saveFeed.ts │ │ │ │ ├── searchPosts.ts │ │ │ │ ├── threadgate.ts │ │ │ │ └── unsaveFeed.ts │ │ │ │ ├── graph │ │ │ │ ├── block.ts │ │ │ │ ├── defs.ts │ │ │ │ ├── follow.ts │ │ │ │ ├── getBlocks.ts │ │ │ │ ├── getFollowers.ts │ │ │ │ ├── getFollows.ts │ │ │ │ ├── getList.ts │ │ │ │ ├── getListBlocks.ts │ │ │ │ ├── getListMutes.ts │ │ │ │ ├── getLists.ts │ │ │ │ ├── getMutes.ts │ │ │ │ ├── getSuggestedFollowsByActor.ts │ │ │ │ ├── list.ts │ │ │ │ ├── listblock.ts │ │ │ │ ├── listitem.ts │ │ │ │ ├── muteActor.ts │ │ │ │ ├── muteActorList.ts │ │ │ │ ├── unmuteActor.ts │ │ │ │ └── unmuteActorList.ts │ │ │ │ ├── notification │ │ │ │ ├── getUnreadCount.ts │ │ │ │ ├── listNotifications.ts │ │ │ │ ├── registerPush.ts │ │ │ │ └── updateSeen.ts │ │ │ │ ├── richtext │ │ │ │ └── facet.ts │ │ │ │ └── unspecced │ │ │ │ ├── defs.ts │ │ │ │ ├── getPopular.ts │ │ │ │ ├── getPopularFeedGenerators.ts │ │ │ │ ├── getTimelineSkeleton.ts │ │ │ │ ├── searchActorsSkeleton.ts │ │ │ │ └── searchPostsSkeleton.ts │ │ └── com │ │ │ └── atproto │ │ │ ├── admin │ │ │ ├── defs.ts │ │ │ ├── disableAccountInvites.ts │ │ │ ├── disableInviteCodes.ts │ │ │ ├── enableAccountInvites.ts │ │ │ ├── getInviteCodes.ts │ │ │ ├── getModerationAction.ts │ │ │ ├── getModerationActions.ts │ │ │ ├── getModerationReport.ts │ │ │ ├── getModerationReports.ts │ │ │ ├── getRecord.ts │ │ │ ├── getRepo.ts │ │ │ ├── rebaseRepo.ts │ │ │ ├── resolveModerationReports.ts │ │ │ ├── reverseModerationAction.ts │ │ │ ├── searchRepos.ts │ │ │ ├── sendEmail.ts │ │ │ ├── takeModerationAction.ts │ │ │ ├── updateAccountEmail.ts │ │ │ └── updateAccountHandle.ts │ │ │ ├── identity │ │ │ ├── resolveHandle.ts │ │ │ └── updateHandle.ts │ │ │ ├── label │ │ │ ├── defs.ts │ │ │ ├── queryLabels.ts │ │ │ └── subscribeLabels.ts │ │ │ ├── moderation │ │ │ ├── createReport.ts │ │ │ └── defs.ts │ │ │ ├── repo │ │ │ ├── applyWrites.ts │ │ │ ├── createRecord.ts │ │ │ ├── deleteRecord.ts │ │ │ ├── describeRepo.ts │ │ │ ├── getRecord.ts │ │ │ ├── listRecords.ts │ │ │ ├── putRecord.ts │ │ │ ├── rebaseRepo.ts │ │ │ ├── strongRef.ts │ │ │ └── uploadBlob.ts │ │ │ ├── server │ │ │ ├── createAccount.ts │ │ │ ├── createAppPassword.ts │ │ │ ├── createInviteCode.ts │ │ │ ├── createInviteCodes.ts │ │ │ ├── createSession.ts │ │ │ ├── defs.ts │ │ │ ├── deleteAccount.ts │ │ │ ├── deleteSession.ts │ │ │ ├── describeServer.ts │ │ │ ├── getAccountInviteCodes.ts │ │ │ ├── getSession.ts │ │ │ ├── listAppPasswords.ts │ │ │ ├── refreshSession.ts │ │ │ ├── requestAccountDelete.ts │ │ │ ├── requestPasswordReset.ts │ │ │ ├── resetPassword.ts │ │ │ └── revokeAppPassword.ts │ │ │ └── sync │ │ │ ├── getBlob.ts │ │ │ ├── getBlocks.ts │ │ │ ├── getCheckout.ts │ │ │ ├── getCommitPath.ts │ │ │ ├── getHead.ts │ │ │ ├── getLatestCommit.ts │ │ │ ├── getRecord.ts │ │ │ ├── getRepo.ts │ │ │ ├── listBlobs.ts │ │ │ ├── listRepos.ts │ │ │ ├── notifyOfUpdate.ts │ │ │ ├── requestCrawl.ts │ │ │ └── subscribeRepos.ts │ └── util.ts ├── methods │ ├── describe-generator.ts │ └── feed-generation.ts ├── server.ts ├── subscription.ts ├── util │ └── subscription.ts └── well-known.ts ├── tsconfig.json └── yarn.lock /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node 3 | { 4 | "name": "Node.js & TypeScript", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/typescript-node:20", 7 | 8 | // Features to add to the dev container. More info: https://containers.dev/features. 9 | "features": { 10 | "ghcr.io/devcontainers-contrib/features/gh-cli:1": {} 11 | }, 12 | 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | "forwardPorts": [ 15 | //3000 16 | ], 17 | 18 | // Use 'postCreateCommand' to run commands after the container is created. 19 | "postCreateCommand": "yarn install", 20 | "customizations": { 21 | "vscode": { 22 | "extensions": [ 23 | "esbenp.prettier-vscode" 24 | ] 25 | } 26 | } 27 | 28 | // Configure tool-specific properties. 29 | // "customizations": {}, 30 | 31 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 32 | // "remoteUser": "root" 33 | } 34 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # *** SCIENCE FEED *** 2 | # Pipe (|) separated list of lists to parse 3 | SCIENCE_LISTS="at://did:plc: ... /app.bsky.graph.list/ ... |at:// etc..." 4 | # The text to watch for for list inclusion. 5 | SCIENCE_SYMBOL="🧪" 6 | # *** ------------ *** 7 | 8 | # *** AUSPOL FEED *** 9 | # Single list to update to update 10 | AUSPOL_LIST="at://did:plc: ... /app.bsky.graph.list/ ..." 11 | # The text to watch for for list inclusion. 12 | AUSPOL_MATCH="auspol" 13 | # *** ------------ *** 14 | 15 | # Whichever port you want to run this on 16 | FEEDGEN_PORT=3000 17 | 18 | # Change this to use a different bind address - probably 0.0.0.0 for prod 19 | FEEDGEN_LISTENHOST="localhost" 20 | 21 | # The mongodb connection string 22 | FEEDGEN_MONGODB_CONNECTION_STRING="..." 23 | 24 | # Don't change unless you're working in a different environment than the primary Bluesky network 25 | FEEDGEN_SUBSCRIPTION_ENDPOINT="wss://bsky.network" 26 | 27 | 28 | # Set this to the hostname that you intend to run the service at 29 | FEEDGEN_HOSTNAME="example.com" 30 | 31 | # Set this to the DID of the account you'll use to publish the feed 32 | # You can find your accounts DID by going to 33 | # https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=${YOUR_HANDLE} 34 | FEEDGEN_PUBLISHER_DID="did:plc:abcde...." 35 | 36 | # Only use this if you want a service did different from did:web 37 | # FEEDGEN_SERVICE_DID="did:plc:abcde..." 38 | 39 | # Should be an app password 40 | FEEDGEN_PASSWORD="..." 41 | 42 | # Your handle - xyz.bsky.social e.g. 43 | FEEDGEN_HANDLE="..." 44 | 45 | # Delay between reconnect attempts to the firehose subscription endpoint (in milliseconds) 46 | FEEDGEN_SUBSCRIPTION_RECONNECT_DELAY=3000 47 | 48 | # The refresh timer. Algorithms have periodicTask() called this often. 49 | FEEDGEN_TASK_INTEVAL_MINS=15 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=true -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: 'docker' # See documentation for possible values 9 | directory: '/' # Location of package manifests 10 | schedule: 11 | interval: 'weekly' 12 | - package-ecosystem: 'npm' # See documentation for possible values 13 | directory: '/' # Location of package manifests 14 | schedule: 15 | interval: 'weekly' 16 | versioning-strategy: 'increase' 17 | ignore: 18 | - dependency-name: '*' 19 | update-types: ['version-update:semver-major'] 20 | -------------------------------------------------------------------------------- /.github/workflows/build-push-docker.yml: -------------------------------------------------------------------------------- 1 | name: Publish Docker image 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | 8 | jobs: 9 | push_to_registry: 10 | name: Push Docker image to Docker Hub 11 | runs-on: ubuntu-latest 12 | permissions: 13 | packages: write 14 | contents: read 15 | attestations: write 16 | id-token: write 17 | steps: 18 | - name: Check out the repo 19 | uses: actions/checkout@v4 20 | 21 | - name: Log in to Docker Hub 22 | uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a 23 | with: 24 | username: ${{ secrets.DOCKER_USERNAME }} 25 | password: ${{ secrets.DOCKER_PASSWORD }} 26 | 27 | - name: Extract metadata (tags, labels) for Docker 28 | id: meta 29 | uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 30 | with: 31 | images: ${{ vars.IMAGE_NAME }} 32 | tags: | 33 | type=ref,event=branch 34 | type=raw,value=latest 35 | 36 | - name: Build and push Docker image 37 | id: push 38 | uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 39 | with: 40 | context: . 41 | file: ./Dockerfile 42 | push: true 43 | tags: ${{ steps.meta.outputs.tags }} 44 | labels: ${{ steps.meta.outputs.labels }} 45 | 46 | - name: Generate artifact attestation 47 | uses: actions/attest-build-provenance@v1 48 | with: 49 | subject-name: ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }} 50 | subject-digest: ${{ steps.push.outputs.digest }} 51 | push-to-registry: true 52 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "semi": false, 5 | "singleQuote": true, 6 | "printWdith": 120, 7 | "overrides": [ 8 | { 9 | "files": "*.hbs", 10 | "options": { 11 | "singleQuote": false 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible Node.js debug attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "yarn", 11 | "runtimeExecutable": "yarn", 12 | "runtimeArgs": [ 13 | "dev" 14 | ], 15 | "cwd": "${workspaceRoot}", 16 | "timeout": 10000 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.tabSize": 2 4 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20 as build 2 | WORKDIR /app 3 | COPY ./package.json . 4 | COPY ./yarn.lock . 5 | RUN yarn install 6 | COPY . . 7 | RUN yarn build 8 | 9 | FROM node:20 AS deps 10 | WORKDIR /app 11 | COPY --from=build /app/package.json . 12 | COPY --from=build /app/yarn.lock . 13 | RUN yarn install --production 14 | 15 | FROM node:20 16 | WORKDIR /app 17 | COPY --from=build /app/dist ./dist 18 | COPY --from=deps /app/package.json . 19 | COPY --from=deps /app/yarn.lock . 20 | COPY --from=deps /app/node_modules ./node_modules 21 | EXPOSE 3000 22 | CMD ["yarn","start"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Bossett 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/18-plus-nd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/18-plus-nd.png -------------------------------------------------------------------------------- /images/australia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/australia.png -------------------------------------------------------------------------------- /images/cats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/cats.png -------------------------------------------------------------------------------- /images/dads-media.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/dads-media.png -------------------------------------------------------------------------------- /images/dads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/dads.png -------------------------------------------------------------------------------- /images/discourse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/discourse.png -------------------------------------------------------------------------------- /images/elusive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/elusive.png -------------------------------------------------------------------------------- /images/keyboards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/keyboards.png -------------------------------------------------------------------------------- /images/nd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/nd.png -------------------------------------------------------------------------------- /images/overheard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/overheard.png -------------------------------------------------------------------------------- /images/paxaus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/paxaus.png -------------------------------------------------------------------------------- /images/testtube.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bossett/bsky-feeds/ac5dd45ae14760a198fd200ef058d34efb1dd848/images/testtube.jpg -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bossett-bsky-feeds", 3 | "version": "2.1.0", 4 | "description": "basic bsky feedgen", 5 | "main": "index.js", 6 | "repository": "git@github.com:bossett/bsky-feeds.git", 7 | "author": "Bossett ", 8 | "license": "MIT", 9 | "type": "module", 10 | "scripts": { 11 | "publishKeyboards": "tsx scripts/publishKeyboards.ts", 12 | "publishCats": "tsx scripts/publishCats.ts", 13 | "publishScience": "tsx scripts/publishFeedGen.ts", 14 | "publishAuspol": "tsx scripts/publishAuspol.ts", 15 | "publishDads": "tsx scripts/publishDads.ts", 16 | "publishDadsMedia": "tsx scripts/publishDadsMedia.ts", 17 | "publish18plusND": "tsx scripts/publish18plusND.ts", 18 | "publishND": "tsx scripts/publishND.ts", 19 | "publishDiscourse": "tsx scripts/publishDiscourse.ts", 20 | "publishElusive": "tsx scripts/publishElusive.ts", 21 | "publishOverheard": "tsx scripts/publishOverheard.ts", 22 | "publishPAXAus": "tsx scripts/publishPAXAus.ts", 23 | "publishExternal": "tsx scripts/publishExternal.ts", 24 | "publishWords": "tsx scripts/publishWords.ts", 25 | "addSelfToList": "tsx scripts/addSelfToList.ts", 26 | "start": "node ./dist/index.js", 27 | "dev": "tsx ./src/index.ts", 28 | "build": "tsc && tsc-alias" 29 | }, 30 | "dependencies": { 31 | "@atcute/client": "^2.0.6", 32 | "@atproto/api": "^0.13.5", 33 | "@atproto/identity": "^0.4.1", 34 | "@atproto/lexicon": "^0.4.1", 35 | "@atproto/repo": "^0.5.0", 36 | "@atproto/syntax": "^0.3.0", 37 | "@atproto/xrpc-server": "^0.6.3", 38 | "@skyware/jetstream": "^0.2.1", 39 | "async-mutex": "^0.5.0", 40 | "dotenv": "^16.4.5", 41 | "express": "^4.18.2", 42 | "follow-redirects": "1.15.8", 43 | "mongodb": "^6.3.0", 44 | "multiformats": "^9.9.0", 45 | "node-fetch-native": "^1.6.2", 46 | "p-ratelimit": "^1.0.1", 47 | "semver": "^7.6.0", 48 | "ws": "^8.18.0" 49 | }, 50 | "devDependencies": { 51 | "@types/express": "^4.17.21", 52 | "@types/node": "^20.11.28", 53 | "tsc-alias": "1.8.10", 54 | "tsx": "^4.7.1", 55 | "typescript": "^5.4.2" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /scripts/addSelfToList.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import { BskyAgent } from '@atproto/api' 3 | import resolveHandleToDID from '../src/addn/resolveHandleToDID' 4 | 5 | const run = async () => { 6 | dotenv.config() 7 | 8 | const handle = `${process.env.FEEDGEN_HANDLE}` 9 | 10 | const password = `${process.env.FEEDGEN_PASSWORD}` 11 | 12 | const agent = new BskyAgent({ service: 'https://bsky.social' }) 13 | await agent.login({ identifier: handle, password: password }) 14 | 15 | const listUri = `${process.argv[2]}` 16 | const repo = `${await resolveHandleToDID(handle, agent)}` 17 | 18 | await agent.com.atproto.repo.createRecord({ 19 | collection: 'app.bsky.graph.listitem', 20 | repo: repo, 21 | record: { 22 | subject: repo, 23 | list: listUri, 24 | createdAt: new Date().toISOString(), 25 | }, 26 | }) 27 | } 28 | 29 | run() 30 | -------------------------------------------------------------------------------- /src/addn/algoManager.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import { Database } from '../db' 3 | import { Post } from '../db/schema' 4 | import { BskyAgent } from '@atproto/api' 5 | 6 | export class AlgoManager { 7 | private static _instance: AlgoManager 8 | 9 | public db: Database 10 | public agent: BskyAgent 11 | public periodicIntervalId: NodeJS.Timer 12 | 13 | public name: string = '' 14 | 15 | public _isReady: Boolean = false 16 | public _isStarting: Boolean = false 17 | 18 | constructor(db: Database, agent: BskyAgent) { 19 | this.db = db 20 | this.agent = agent 21 | this._isReady = false 22 | this._isStarting = false 23 | } 24 | 25 | public static cacheAge(params): Number { 26 | if (params.cursor) return 600 27 | return 30 28 | } 29 | 30 | public async _start() { 31 | if (this._isStarting) return false 32 | else this._isStarting = true 33 | 34 | dotenv.config() 35 | 36 | let task_inverval_mins = 15 37 | if ( 38 | process.env.FEEDGEN_TASK_INTEVAL_MINS !== undefined && 39 | Number.parseInt(process.env.FEEDGEN_TASK_INTEVAL_MINS) > 0 40 | ) { 41 | task_inverval_mins = Number.parseInt( 42 | process.env.FEEDGEN_TASK_INTEVAL_MINS, 43 | ) 44 | } 45 | 46 | await this.periodicTask() 47 | if (!this.periodicIntervalId) { 48 | this.periodicIntervalId = setInterval(() => { 49 | console.log(`${this.name}: running ${task_inverval_mins}m task`) 50 | try { 51 | this.periodicTask() 52 | } catch (e) { 53 | console.log(`${this.name}: error running periodic task ${e.message}`) 54 | } 55 | }, task_inverval_mins * 60 * 1000) 56 | } 57 | 58 | await this.start() 59 | 60 | this._isReady = true 61 | return this._isReady 62 | } 63 | 64 | public async start() { 65 | return 66 | } 67 | 68 | public async ready(): Promise { 69 | if (this._isReady) return this._isReady 70 | else return await this._start() 71 | } 72 | 73 | public async periodicTask() { 74 | return 75 | } 76 | 77 | public async filter_post(post: Post): Promise { 78 | return false 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/addn/batchUpdate.ts: -------------------------------------------------------------------------------- 1 | import dbClient from '../db/dbClient' 2 | import limit from './rateLimit' 3 | 4 | export default async function batchUpdate(agent, interval) { 5 | let firstRun = true 6 | while (true) { 7 | if (!firstRun) await new Promise((resolve) => setTimeout(resolve, interval)) 8 | else firstRun = false 9 | 10 | console.log('core: Updating Labels...') 11 | 12 | const unlabelledPosts = await dbClient.getUnlabelledPostsWithMedia( 13 | 300, 14 | interval, 15 | ) 16 | 17 | if (unlabelledPosts.length === 0) continue 18 | 19 | const chunkSize = 25 20 | 21 | const postEntries: { uri: string; labels: string[] }[] = [] 22 | 23 | for (let i = 0; i < unlabelledPosts.length; i += chunkSize) { 24 | const chunk = unlabelledPosts.slice(i, i + chunkSize).flatMap((item) => { 25 | return [item.uri] 26 | }) 27 | 28 | let res: any 29 | 30 | try { 31 | res = await limit(() => agent.app.bsky.feed.getPosts({ uris: chunk })) 32 | } catch (e) { 33 | console.log('core: Error fetching posts, skipping chunk...') 34 | continue 35 | } 36 | 37 | const posts = res.data.posts 38 | 39 | if (posts.length === 0) { 40 | chunk.forEach((uri) => { 41 | postEntries.push({ uri: uri, labels: [] }) 42 | }) 43 | } 44 | 45 | for (let k = 0; k < posts.length; k++) { 46 | const labels: string[] = [] 47 | if (posts[k].labels.length !== 0) { 48 | posts[k].labels.forEach((label) => { 49 | labels.push(label.val) 50 | }) 51 | } 52 | postEntries.push({ uri: posts[k].uri, labels: labels }) 53 | } 54 | } 55 | dbClient.updateLabelsForURIs(postEntries) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/addn/getListMembers.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import limit from './rateLimit' 3 | 4 | export const getListMembers = async ( 5 | list: string, 6 | agent: BskyAgent, 7 | ): Promise => { 8 | let total_retrieved = 1 9 | let current_cursor: string | undefined = undefined 10 | let members: string[] = [] 11 | 12 | do { 13 | const list_members = await limit(() => 14 | agent.api.app.bsky.graph.getList({ 15 | list: `${list}`, 16 | limit: 100, 17 | cursor: current_cursor, 18 | }), 19 | ) 20 | total_retrieved = list_members.data.items.length 21 | current_cursor = list_members.data.cursor 22 | list_members.data.items.forEach((member) => { 23 | members.push(member.subject.did) 24 | }) 25 | } while (current_cursor !== undefined && current_cursor !== '') 26 | 27 | return members 28 | } 29 | 30 | export default getListMembers 31 | -------------------------------------------------------------------------------- /src/addn/getPostAsWebhookPayload.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import limit from './rateLimit' 3 | 4 | export const getPostAsWebhookPayload = async ( 5 | post_uri: string, 6 | agent: BskyAgent, 7 | additional_fields: any[] = [], 8 | ) => { 9 | const post_detail = await limit(() => 10 | agent.app.bsky.feed.getPosts({ 11 | uris: [post_uri], 12 | }), 13 | ) 14 | 15 | if (!post_detail.data.posts[0]) return 16 | 17 | const post = post_detail.data.posts[0] 18 | const record = post.record 19 | const imageFields: any[] = [] 20 | 21 | if (post.embed?.images) { 22 | const imagesArr: any[] = post.embed.images 23 | imagesArr.forEach((image) => { 24 | imageFields.push({ 25 | title: image.alt, 26 | color: 14914598, 27 | image: { url: image.fullsize }, 28 | }) 29 | }) 30 | } 31 | 32 | const payload = { 33 | username: `${post.author.displayName}`, 34 | avatar_url: `${post.author.avatar}`, 35 | content: '', 36 | embeds: [ 37 | { 38 | title: 'Fields', 39 | color: 14886454, 40 | thumbnail: { 41 | url: `${post.author.avatar}`, 42 | }, 43 | fields: [ 44 | { 45 | name: 'Author', 46 | value: `${post.author.displayName}`, 47 | }, 48 | { 49 | name: 'Post Content', 50 | value: `${record.text}`, 51 | }, 52 | { 53 | name: 'Author DID', 54 | value: `${post.author.did}`, 55 | }, 56 | { 57 | name: 'Post URI', 58 | value: `${post_uri}`, 59 | }, 60 | { 61 | name: 'Author Link', 62 | value: `https://bsky.app/profile/${post_uri.split('/')[2]}`, 63 | }, 64 | { 65 | name: 'Post Link', 66 | value: `https://bsky.app/profile/${post_uri.split('/')[2]}/post/${ 67 | post_uri.split('/')[4] 68 | }`, 69 | }, 70 | ], 71 | }, 72 | ...imageFields, 73 | ...additional_fields, 74 | ], 75 | } 76 | 77 | return payload 78 | } 79 | 80 | export default getPostAsWebhookPayload 81 | -------------------------------------------------------------------------------- /src/addn/getPostFromURI.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import limit from './rateLimit' 3 | 4 | import { Post } from '../db/schema' 5 | 6 | export const getPostFromURI = async ( 7 | atUri: string, 8 | agent: BskyAgent, 9 | ): Promise => { 10 | const [repo, collection, rkey] = atUri.startsWith('at://') 11 | ? atUri.replace('at://', '').split('/') 12 | : [undefined, undefined, undefined] 13 | 14 | if (!repo || !collection || !rkey) return undefined 15 | 16 | const response = await limit(() => 17 | agent.com.atproto.repo.getRecord({ 18 | repo, 19 | collection, 20 | rkey, 21 | }), 22 | ) 23 | 24 | if (!response.success) return undefined 25 | 26 | const record = response.data 27 | 28 | if (!record.cid) return undefined 29 | 30 | const postValue: any = record.value 31 | 32 | const post: Post = { 33 | _id: null, 34 | uri: record.uri, 35 | cid: record.cid, 36 | author: repo, 37 | text: postValue.text, 38 | replyParent: postValue.reply?.parent.uri ?? null, 39 | replyRoot: postValue.reply?.root.uri ?? null, 40 | indexedAt: new Date().getTime(), 41 | algoTags: null, 42 | embed: postValue.embed, 43 | } 44 | 45 | return post 46 | } 47 | 48 | export default getPostFromURI 49 | -------------------------------------------------------------------------------- /src/addn/getPostsForUser.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import { BskyAgent } from '@atproto/api' 3 | import { Post } from '../db/schema' 4 | 5 | import crypto from 'crypto' 6 | import resolveDIDToHandle from './resolveDIDToHandle' 7 | import limit from './rateLimit' 8 | 9 | export const getPostsForUser = async ( 10 | author: string, 11 | agent: BskyAgent, 12 | ): Promise => { 13 | dotenv.config() 14 | 15 | const posts: Post[] = [] 16 | 17 | console.log( 18 | `Getting posts for ${await resolveDIDToHandle(author, agent)}... `, 19 | ) 20 | 21 | let author_feed = await limit(() => 22 | agent.api.app.bsky.feed.getAuthorFeed({ 23 | actor: author, 24 | limit: 100, 25 | }), 26 | ) 27 | 28 | do { 29 | const author_posts = author_feed.data.feed 30 | while (author_posts.length > 0) { 31 | const post_create = author_posts.pop() 32 | if (post_create === undefined) continue 33 | 34 | const post: Post = { 35 | _id: null, 36 | uri: post_create.post?.uri, 37 | cid: post_create.post?.cid, 38 | author: author, 39 | text: post_create.post?.record['text'], 40 | replyParent: post_create.reply?.parent.uri ?? null, 41 | replyRoot: post_create.reply?.root.uri ?? null, 42 | indexedAt: 43 | new Date(post_create.post?.indexedAt).getTime() ?? 44 | new Date().getTime(), 45 | algoTags: null, 46 | } 47 | 48 | const hash = crypto 49 | .createHash('shake256', { outputLength: 12 }) 50 | .update(post.uri) 51 | .digest('hex') 52 | .toString() 53 | post._id = hash 54 | 55 | posts.push(post) 56 | } 57 | author_feed = await limit(() => 58 | agent.api.app.bsky.feed.getAuthorFeed({ 59 | actor: author, 60 | limit: 100, 61 | cursor: author_feed.data.cursor, 62 | }), 63 | ) 64 | } while ( 65 | author_feed.data.cursor !== undefined && 66 | author_feed.data.cursor !== '' 67 | ) 68 | 69 | return posts 70 | } 71 | 72 | export default getPostsForUser 73 | -------------------------------------------------------------------------------- /src/addn/getUserFollows.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import resolveHandleToDID from './resolveHandleToDID' 3 | import limit from './rateLimit' 4 | 5 | const followCache = new Map() 6 | 7 | export const getUserFollows = async (user: string, agent: BskyAgent) => { 8 | if (followCache.has(user)) { 9 | if (followCache.get(user)!.date > Date.now() - 1000 * 60 * 10) { 10 | return followCache.get(user)!.follows 11 | } else followCache.delete(user) 12 | } 13 | 14 | let user_did = '' 15 | const follows: string[] = [] 16 | 17 | if (user.slice(0, 4) === 'did:') { 18 | user_did = user 19 | } else { 20 | user_did = await resolveHandleToDID(user, agent) 21 | } 22 | 23 | let cursor: string | undefined = undefined 24 | do { 25 | const res: any = await limit(() => 26 | agent.api.app.bsky.graph.getFollows({ 27 | actor: user_did, 28 | cursor: cursor, 29 | }), 30 | ) 31 | 32 | cursor = res.data.cursor 33 | 34 | res.data.follows.forEach((follow) => { 35 | follows.push(`${follow.did}`) 36 | }) 37 | } while (cursor !== undefined && cursor !== '') 38 | 39 | followCache.set(user, { date: Date.now(), follows }) 40 | return followCache.get(user)!.follows 41 | } 42 | 43 | export default getUserFollows 44 | -------------------------------------------------------------------------------- /src/addn/getUserLists.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import limit from './rateLimit' 3 | 4 | export const getUserLists = async ( 5 | did: string, 6 | agent: BskyAgent, 7 | ): Promise<{ name: string; atURL: string }[]> => { 8 | let current_cursor: string | undefined = undefined 9 | 10 | let total_retrieved = 0 11 | const user_lists: { name: string; atURL: string }[] = [] 12 | 13 | do { 14 | const lists: any = await limit(() => 15 | agent.api.app.bsky.graph.getLists({ 16 | actor: `${did}`, 17 | limit: 100, 18 | cursor: current_cursor, 19 | }), 20 | ) 21 | 22 | lists.data.lists.forEach((list: any) => { 23 | user_lists.push({ name: list.name, atURL: list.uri }) 24 | }) 25 | 26 | current_cursor = lists.data.cursor 27 | } while (current_cursor !== undefined && current_cursor !== '') 28 | 29 | return user_lists 30 | } 31 | 32 | export default getUserLists 33 | -------------------------------------------------------------------------------- /src/addn/rateLimit.ts: -------------------------------------------------------------------------------- 1 | import { pRateLimit } from 'p-ratelimit' 2 | 3 | const _limit = pRateLimit({ 4 | interval: undefined, 5 | rate: undefined, 6 | concurrency: 96, 7 | maxDelay: undefined, 8 | }) 9 | 10 | const limit = async (fn: () => Promise, retries = 3): Promise => { 11 | try { 12 | return await _limit(fn) 13 | } catch (error) { 14 | if (retries > 0) { 15 | console.log(`${error} - retrying limited call:\n${fn.toString()}`) 16 | const delay = (ms: number) => new Promise((res) => setTimeout(res, ms)) 17 | await delay(3000) 18 | return await limit(fn, retries - 1) 19 | } else { 20 | console.log(`error in limited call:\n${fn.toString()}\n${error}`) 21 | throw error 22 | } 23 | } 24 | } 25 | 26 | export default limit 27 | -------------------------------------------------------------------------------- /src/addn/resolveDIDToHandle.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import limit from './rateLimit' 3 | 4 | export const resolveDIDToHandle = async ( 5 | author: string, 6 | agent: BskyAgent, 7 | ): Promise => { 8 | try { 9 | return ( 10 | await limit(() => agent.app.bsky.actor.getProfile({ actor: author })) 11 | ).data.handle 12 | } catch { 13 | return author 14 | } 15 | } 16 | 17 | export default resolveDIDToHandle 18 | -------------------------------------------------------------------------------- /src/addn/resolveHandleToDID.ts: -------------------------------------------------------------------------------- 1 | import { BskyAgent } from '@atproto/api' 2 | import limit from './rateLimit' 3 | 4 | export const resolveHandleToDID = async ( 5 | author: string, 6 | agent: BskyAgent, 7 | ): Promise => { 8 | return ( 9 | await limit(() => 10 | agent.com.atproto.identity.resolveHandle({ 11 | handle: author, 12 | }), 13 | ) 14 | ).data.did 15 | } 16 | 17 | export default resolveHandleToDID 18 | -------------------------------------------------------------------------------- /src/algos/dads-media.ts: -------------------------------------------------------------------------------- 1 | import { QueryParams } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' 2 | import { AppContext } from '../config' 3 | import { AlgoManager } from '../addn/algoManager' 4 | import dotenv from 'dotenv' 5 | import { Post } from '../db/schema' 6 | import dbClient from '../db/dbClient' 7 | 8 | dotenv.config() 9 | 10 | // max 15 chars 11 | export const shortname = 'dads-media' 12 | 13 | export const handler = async (ctx: AppContext, params: QueryParams) => { 14 | const builder = await dbClient.getLatestPostsForTag({ 15 | tag: 'dads', 16 | limit: params.limit, 17 | cursor: params.cursor, 18 | mediaOnly: true, 19 | }) 20 | 21 | const feed = builder.map((row) => ({ 22 | post: row.uri, 23 | })) 24 | 25 | let cursor: string | undefined 26 | const last = builder.at(-1) 27 | if (last) { 28 | cursor = `${new Date(last.indexedAt).getTime()}::${last.cid}` 29 | } 30 | 31 | return { 32 | cursor, 33 | feed, 34 | } 35 | } 36 | 37 | export class manager extends AlgoManager { 38 | public name: string = shortname 39 | 40 | public async filter_post(post: Post): Promise { 41 | return false 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/algos/elusive.ts: -------------------------------------------------------------------------------- 1 | import { QueryParams } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' 2 | import { AppContext } from '../config' 3 | import { AlgoManager } from '../addn/algoManager' 4 | import dotenv from 'dotenv' 5 | import { Post } from '../db/schema' 6 | import dbClient from '../db/dbClient' 7 | import getUserFollows from '../addn/getUserFollows' 8 | 9 | dotenv.config() 10 | 11 | // max 15 chars 12 | export const shortname = 'elusive' 13 | 14 | export const handler = async (ctx: AppContext, params: QueryParams) => { 15 | const builder = await dbClient.getLatestPostsForTag({ 16 | tag: shortname, 17 | limit: params.limit, 18 | cursor: params.cursor, 19 | }) 20 | 21 | const feed = builder.map((row) => ({ 22 | post: row.uri, 23 | })) 24 | 25 | let cursor: string | undefined 26 | const last = builder.at(-1) 27 | if (last) { 28 | cursor = `${new Date(last.indexedAt).getTime()}::${last.cid}` 29 | } 30 | 31 | return { 32 | cursor, 33 | feed, 34 | } 35 | } 36 | 37 | export class manager extends AlgoManager { 38 | public name: string = shortname 39 | public did = 'did:plc:ywbm3iywnhzep3ckt6efhoh7' 40 | public follows: string[] = [] 41 | 42 | public async periodicTask() { 43 | this.follows = await getUserFollows(this.did, this.agent) 44 | await this.db.removeTagFromOldPosts( 45 | this.name, 46 | new Date().getTime() - 3 * 24 * 60 * 60 * 1000, //3 days 47 | ) 48 | } 49 | 50 | public async filter_post(post: Post): Promise { 51 | if (post.replyRoot !== null) return false 52 | // getUserFollows is memoised, so this should be fine 53 | this.follows = await getUserFollows(this.did, this.agent) 54 | 55 | if (this.agent === null) { 56 | await this.start() 57 | } 58 | if (this.agent === null) return false 59 | 60 | return this.follows.includes(post.author) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/algos/externalList.ts: -------------------------------------------------------------------------------- 1 | import { QueryParams } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' 2 | import { AppContext } from '../config' 3 | import { AlgoManager } from '../addn/algoManager' 4 | import dotenv from 'dotenv' 5 | import { Post } from '../db/schema' 6 | import dbClient from '../db/dbClient' 7 | 8 | dotenv.config() 9 | 10 | // max 15 chars 11 | let name = 'external' 12 | if (process.env.SECRET_NAME) name = process.env.SECRET_NAME 13 | 14 | export const shortname = name 15 | 16 | export const handler = async (ctx: AppContext, params: QueryParams) => { 17 | const builder = await dbClient.getLatestPostsForTag({ 18 | tag: shortname, 19 | limit: params.limit, 20 | cursor: params.cursor, 21 | }) 22 | 23 | const feed = builder.map((row) => ({ 24 | post: row.uri, 25 | })) 26 | 27 | let cursor: string | undefined 28 | const last = builder.at(-1) 29 | if (last) { 30 | cursor = `${new Date(last.indexedAt).getTime()}::${last.cid}` 31 | } 32 | 33 | return { 34 | cursor, 35 | feed, 36 | } 37 | } 38 | 39 | export class manager extends AlgoManager { 40 | public name: string = shortname 41 | public follows: string[] = [] 42 | 43 | async updateList() { 44 | if (process.env.SECRET_LIST) { 45 | try { 46 | const response = await fetch(`${process.env.SECRET_LIST}`) 47 | const text = await response.text() 48 | this.follows = text 49 | .split('\n') 50 | .filter((item: string) => item.startsWith('did:plc:')) 51 | } catch {} 52 | } 53 | } 54 | 55 | public async periodicTask() { 56 | this.updateList() 57 | 58 | await this.db.removeTagFromOldPosts( 59 | this.name, 60 | new Date().getTime() - 7 * 24 * 60 * 60 * 1000, //7 days 61 | ) 62 | } 63 | 64 | public async filter_post(post: Post): Promise { 65 | if (post.replyRoot !== null) return false 66 | if (this.follows.length === 0) this.updateList() 67 | 68 | if (this.agent === null) { 69 | await this.start() 70 | } 71 | if (this.agent === null) return false 72 | 73 | return this.follows.includes(post.author) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/algos/overheard.ts: -------------------------------------------------------------------------------- 1 | import { QueryParams } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' 2 | import { AppContext } from '../config' 3 | import { AlgoManager } from '../addn/algoManager' 4 | import dotenv from 'dotenv' 5 | import { Post } from '../db/schema' 6 | import dbClient from '../db/dbClient' 7 | 8 | dotenv.config() 9 | 10 | // max 15 chars 11 | export const shortname = 'overheard' 12 | 13 | export const handler = async (ctx: AppContext, params: QueryParams) => { 14 | const builder = await dbClient.getLatestPostsForTag({ 15 | tag: shortname, 16 | limit: params.limit, 17 | cursor: params.cursor, 18 | }) 19 | 20 | const feed = builder.map((row) => { 21 | let lookup_uri = row.uri 22 | 23 | if (row.embed?.record?.uri) { 24 | lookup_uri = row.embed.record.uri 25 | } else { 26 | if (row.replyParent) lookup_uri = row.replyParent 27 | else return false 28 | } 29 | return { post: lookup_uri } 30 | }) 31 | 32 | let cursor: string | undefined 33 | const last = builder.at(-1) 34 | if (last) { 35 | cursor = `${new Date(last.indexedAt).getTime()}::${last.cid}` 36 | } 37 | 38 | return { 39 | cursor, 40 | feed, 41 | } 42 | } 43 | 44 | export class manager extends AlgoManager { 45 | public name: string = shortname 46 | public re = /^\W*overheard\W*$/ims 47 | 48 | public async filter_post(post: Post): Promise { 49 | if (post.text.match(this.re)) { 50 | return true 51 | } 52 | return false 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/config.ts: -------------------------------------------------------------------------------- 1 | import { DidResolver } from '@atproto/identity' 2 | import dbClient from './db/dbClient' 3 | 4 | export type AppContext = { 5 | db: typeof dbClient 6 | didResolver: DidResolver 7 | cfg: Config 8 | } 9 | 10 | export type Config = { 11 | port: number 12 | listenhost: string 13 | hostname: string 14 | mongoDbConnectionString: string 15 | subscriptionEndpoint: string 16 | serviceDid: string 17 | publisherDid: string 18 | subscriptionReconnectDelay: number 19 | } 20 | -------------------------------------------------------------------------------- /src/db/index.ts: -------------------------------------------------------------------------------- 1 | import dbSingleton from './dbClient' 2 | 3 | export type Database = typeof dbSingleton 4 | -------------------------------------------------------------------------------- /src/db/schema.ts: -------------------------------------------------------------------------------- 1 | export type DatabaseSchema = { 2 | post: Post 3 | sub_state: SubState 4 | list_members: ListMember 5 | } 6 | 7 | export type Post = { 8 | _id: string | null 9 | uri: string 10 | cid: string 11 | author: string 12 | text: string 13 | replyParent: string | null 14 | replyRoot: string | null 15 | indexedAt: number 16 | algoTags: string[] | null 17 | embed?: any | null 18 | tags?: string[] | null 19 | } 20 | 21 | export type SubState = { 22 | _id: string | null 23 | service: string 24 | cursor: number 25 | } 26 | 27 | export type ListMember = { 28 | _id: string | null 29 | did: string 30 | } 31 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import FeedGenerator from './server' 3 | 4 | const run = async () => { 5 | dotenv.config() 6 | const hostname = maybeStr(process.env.FEEDGEN_HOSTNAME) ?? 'example.com' 7 | const serviceDid = 8 | maybeStr(process.env.FEEDGEN_SERVICE_DID) ?? `did:web:${hostname}` 9 | const server = FeedGenerator.create({ 10 | port: maybeInt(process.env.FEEDGEN_PORT) ?? 3000, 11 | listenhost: maybeStr(process.env.FEEDGEN_LISTENHOST) ?? 'localhost', 12 | mongoDbConnectionString: 13 | maybeStr(process.env.FEEDGEN_MONGODB_CONNECTION_STRING) ?? '', 14 | subscriptionEndpoint: 15 | maybeStr(process.env.FEEDGEN_SUBSCRIPTION_ENDPOINT) ?? 16 | 'wss://bsky.network', 17 | publisherDid: 18 | maybeStr(process.env.FEEDGEN_PUBLISHER_DID) ?? 'did:example:alice', 19 | hostname, 20 | serviceDid, 21 | subscriptionReconnectDelay: 22 | maybeInt(process.env.FEEDGEN_SUBSCRIPTION_RECONNECT_DELAY) ?? 3000, 23 | }) 24 | await server.start() 25 | console.log( 26 | `core: Running feed generator at http://${server.cfg.listenhost}:${server.cfg.port}`, 27 | ) 28 | } 29 | 30 | const maybeStr = (val?: string) => { 31 | if (!val) return undefined 32 | return val 33 | } 34 | 35 | const maybeInt = (val?: string) => { 36 | if (!val) return undefined 37 | const int = parseInt(val, 10) 38 | if (isNaN(int)) return undefined 39 | return int 40 | } 41 | 42 | run() 43 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/getPreferences.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams {} 13 | 14 | export type InputSchema = undefined 15 | 16 | export interface OutputSchema { 17 | preferences: AppBskyActorDefs.Preferences 18 | [k: string]: unknown 19 | } 20 | 21 | export type HandlerInput = undefined 22 | 23 | export interface HandlerSuccess { 24 | encoding: 'application/json' 25 | body: OutputSchema 26 | headers?: { [key: string]: string } 27 | } 28 | 29 | export interface HandlerError { 30 | status: number 31 | message?: string 32 | } 33 | 34 | export type HandlerOutput = HandlerError | HandlerSuccess 35 | export type HandlerReqCtx = { 36 | auth: HA 37 | params: QueryParams 38 | input: HandlerInput 39 | req: express.Request 40 | res: express.Response 41 | } 42 | export type Handler = ( 43 | ctx: HandlerReqCtx, 44 | ) => Promise | HandlerOutput 45 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/getProfile.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | export type OutputSchema = AppBskyActorDefs.ProfileViewDetailed 18 | export type HandlerInput = undefined 19 | 20 | export interface HandlerSuccess { 21 | encoding: 'application/json' 22 | body: OutputSchema 23 | headers?: { [key: string]: string } 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | } 30 | 31 | export type HandlerOutput = HandlerError | HandlerSuccess 32 | export type HandlerReqCtx = { 33 | auth: HA 34 | params: QueryParams 35 | input: HandlerInput 36 | req: express.Request 37 | res: express.Response 38 | } 39 | export type Handler = ( 40 | ctx: HandlerReqCtx, 41 | ) => Promise | HandlerOutput 42 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/getProfiles.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams { 13 | actors: string[] 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | profiles: AppBskyActorDefs.ProfileViewDetailed[] 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | } 35 | 36 | export type HandlerOutput = HandlerError | HandlerSuccess 37 | export type HandlerReqCtx = { 38 | auth: HA 39 | params: QueryParams 40 | input: HandlerInput 41 | req: express.Request 42 | res: express.Response 43 | } 44 | export type Handler = ( 45 | ctx: HandlerReqCtx, 46 | ) => Promise | HandlerOutput 47 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/getSuggestions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | actors: AppBskyActorDefs.ProfileView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/profile.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' 9 | 10 | export interface Record { 11 | displayName?: string 12 | description?: string 13 | avatar?: BlobRef 14 | banner?: BlobRef 15 | labels?: 16 | | ComAtprotoLabelDefs.SelfLabels 17 | | { $type: string; [k: string]: unknown } 18 | [k: string]: unknown 19 | } 20 | 21 | export function isRecord(v: unknown): v is Record { 22 | return ( 23 | isObj(v) && 24 | hasProp(v, '$type') && 25 | (v.$type === 'app.bsky.actor.profile#main' || 26 | v.$type === 'app.bsky.actor.profile') 27 | ) 28 | } 29 | 30 | export function validateRecord(v: unknown): ValidationResult { 31 | return lexicons.validate('app.bsky.actor.profile#main', v) 32 | } 33 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/putPreferences.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams {} 13 | 14 | export interface InputSchema { 15 | preferences: AppBskyActorDefs.Preferences 16 | [k: string]: unknown 17 | } 18 | 19 | export interface HandlerInput { 20 | encoding: 'application/json' 21 | body: InputSchema 22 | } 23 | 24 | export interface HandlerError { 25 | status: number 26 | message?: string 27 | } 28 | 29 | export type HandlerOutput = HandlerError | void 30 | export type HandlerReqCtx = { 31 | auth: HA 32 | params: QueryParams 33 | input: HandlerInput 34 | req: express.Request 35 | res: express.Response 36 | } 37 | export type Handler = ( 38 | ctx: HandlerReqCtx, 39 | ) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/searchActors.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** DEPRECATED: use 'q' instead */ 14 | term?: string 15 | /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ 16 | q?: string 17 | limit: number 18 | cursor?: string 19 | } 20 | 21 | export type InputSchema = undefined 22 | 23 | export interface OutputSchema { 24 | cursor?: string 25 | actors: AppBskyActorDefs.ProfileView[] 26 | [k: string]: unknown 27 | } 28 | 29 | export type HandlerInput = undefined 30 | 31 | export interface HandlerSuccess { 32 | encoding: 'application/json' 33 | body: OutputSchema 34 | headers?: { [key: string]: string } 35 | } 36 | 37 | export interface HandlerError { 38 | status: number 39 | message?: string 40 | } 41 | 42 | export type HandlerOutput = HandlerError | HandlerSuccess 43 | export type HandlerReqCtx = { 44 | auth: HA 45 | params: QueryParams 46 | input: HandlerInput 47 | req: express.Request 48 | res: express.Response 49 | } 50 | export type Handler = ( 51 | ctx: HandlerReqCtx, 52 | ) => Promise | HandlerOutput 53 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** DEPRECATED: use 'q' instead */ 14 | term?: string 15 | /** search query prefix; not a full query string */ 16 | q?: string 17 | limit: number 18 | } 19 | 20 | export type InputSchema = undefined 21 | 22 | export interface OutputSchema { 23 | actors: AppBskyActorDefs.ProfileViewBasic[] 24 | [k: string]: unknown 25 | } 26 | 27 | export type HandlerInput = undefined 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/embed/external.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface Main { 10 | external: External 11 | [k: string]: unknown 12 | } 13 | 14 | export function isMain(v: unknown): v is Main { 15 | return ( 16 | isObj(v) && 17 | hasProp(v, '$type') && 18 | (v.$type === 'app.bsky.embed.external#main' || 19 | v.$type === 'app.bsky.embed.external') 20 | ) 21 | } 22 | 23 | export function validateMain(v: unknown): ValidationResult { 24 | return lexicons.validate('app.bsky.embed.external#main', v) 25 | } 26 | 27 | export interface External { 28 | uri: string 29 | title: string 30 | description: string 31 | thumb?: BlobRef 32 | [k: string]: unknown 33 | } 34 | 35 | export function isExternal(v: unknown): v is External { 36 | return ( 37 | isObj(v) && 38 | hasProp(v, '$type') && 39 | v.$type === 'app.bsky.embed.external#external' 40 | ) 41 | } 42 | 43 | export function validateExternal(v: unknown): ValidationResult { 44 | return lexicons.validate('app.bsky.embed.external#external', v) 45 | } 46 | 47 | export interface View { 48 | external: ViewExternal 49 | [k: string]: unknown 50 | } 51 | 52 | export function isView(v: unknown): v is View { 53 | return ( 54 | isObj(v) && 55 | hasProp(v, '$type') && 56 | v.$type === 'app.bsky.embed.external#view' 57 | ) 58 | } 59 | 60 | export function validateView(v: unknown): ValidationResult { 61 | return lexicons.validate('app.bsky.embed.external#view', v) 62 | } 63 | 64 | export interface ViewExternal { 65 | uri: string 66 | title: string 67 | description: string 68 | thumb?: string 69 | [k: string]: unknown 70 | } 71 | 72 | export function isViewExternal(v: unknown): v is ViewExternal { 73 | return ( 74 | isObj(v) && 75 | hasProp(v, '$type') && 76 | v.$type === 'app.bsky.embed.external#viewExternal' 77 | ) 78 | } 79 | 80 | export function validateViewExternal(v: unknown): ValidationResult { 81 | return lexicons.validate('app.bsky.embed.external#viewExternal', v) 82 | } 83 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/embed/recordWithMedia.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import * as AppBskyEmbedRecord from './record' 9 | import * as AppBskyEmbedImages from './images' 10 | import * as AppBskyEmbedExternal from './external' 11 | 12 | export interface Main { 13 | record: AppBskyEmbedRecord.Main 14 | media: 15 | | AppBskyEmbedImages.Main 16 | | AppBskyEmbedExternal.Main 17 | | { $type: string; [k: string]: unknown } 18 | [k: string]: unknown 19 | } 20 | 21 | export function isMain(v: unknown): v is Main { 22 | return ( 23 | isObj(v) && 24 | hasProp(v, '$type') && 25 | (v.$type === 'app.bsky.embed.recordWithMedia#main' || 26 | v.$type === 'app.bsky.embed.recordWithMedia') 27 | ) 28 | } 29 | 30 | export function validateMain(v: unknown): ValidationResult { 31 | return lexicons.validate('app.bsky.embed.recordWithMedia#main', v) 32 | } 33 | 34 | export interface View { 35 | record: AppBskyEmbedRecord.View 36 | media: 37 | | AppBskyEmbedImages.View 38 | | AppBskyEmbedExternal.View 39 | | { $type: string; [k: string]: unknown } 40 | [k: string]: unknown 41 | } 42 | 43 | export function isView(v: unknown): v is View { 44 | return ( 45 | isObj(v) && 46 | hasProp(v, '$type') && 47 | v.$type === 'app.bsky.embed.recordWithMedia#view' 48 | ) 49 | } 50 | 51 | export function validateView(v: unknown): ValidationResult { 52 | return lexicons.validate('app.bsky.embed.recordWithMedia#view', v) 53 | } 54 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/describeFeedGenerator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | 15 | export interface OutputSchema { 16 | did: string 17 | feeds: Feed[] 18 | links?: Links 19 | [k: string]: unknown 20 | } 21 | 22 | export type HandlerInput = undefined 23 | 24 | export interface HandlerSuccess { 25 | encoding: 'application/json' 26 | body: OutputSchema 27 | headers?: { [key: string]: string } 28 | } 29 | 30 | export interface HandlerError { 31 | status: number 32 | message?: string 33 | } 34 | 35 | export type HandlerOutput = HandlerError | HandlerSuccess 36 | export type HandlerReqCtx = { 37 | auth: HA 38 | params: QueryParams 39 | input: HandlerInput 40 | req: express.Request 41 | res: express.Response 42 | } 43 | export type Handler = ( 44 | ctx: HandlerReqCtx, 45 | ) => Promise | HandlerOutput 46 | 47 | export interface Feed { 48 | uri: string 49 | [k: string]: unknown 50 | } 51 | 52 | export function isFeed(v: unknown): v is Feed { 53 | return ( 54 | isObj(v) && 55 | hasProp(v, '$type') && 56 | v.$type === 'app.bsky.feed.describeFeedGenerator#feed' 57 | ) 58 | } 59 | 60 | export function validateFeed(v: unknown): ValidationResult { 61 | return lexicons.validate('app.bsky.feed.describeFeedGenerator#feed', v) 62 | } 63 | 64 | export interface Links { 65 | privacyPolicy?: string 66 | termsOfService?: string 67 | [k: string]: unknown 68 | } 69 | 70 | export function isLinks(v: unknown): v is Links { 71 | return ( 72 | isObj(v) && 73 | hasProp(v, '$type') && 74 | v.$type === 'app.bsky.feed.describeFeedGenerator#links' 75 | ) 76 | } 77 | 78 | export function validateLinks(v: unknown): ValidationResult { 79 | return lexicons.validate('app.bsky.feed.describeFeedGenerator#links', v) 80 | } 81 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/generator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import * as AppBskyRichtextFacet from '../richtext/facet' 9 | import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' 10 | 11 | export interface Record { 12 | did: string 13 | displayName: string 14 | description?: string 15 | descriptionFacets?: AppBskyRichtextFacet.Main[] 16 | avatar?: BlobRef 17 | labels?: 18 | | ComAtprotoLabelDefs.SelfLabels 19 | | { $type: string; [k: string]: unknown } 20 | createdAt: string 21 | [k: string]: unknown 22 | } 23 | 24 | export function isRecord(v: unknown): v is Record { 25 | return ( 26 | isObj(v) && 27 | hasProp(v, '$type') && 28 | (v.$type === 'app.bsky.feed.generator#main' || 29 | v.$type === 'app.bsky.feed.generator') 30 | ) 31 | } 32 | 33 | export function validateRecord(v: unknown): ValidationResult { 34 | return lexicons.validate('app.bsky.feed.generator#main', v) 35 | } 36 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getActorFeeds.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feeds: AppBskyFeedDefs.GeneratorView[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getActorLikes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feed: AppBskyFeedDefs.FeedViewPost[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | error?: 'BlockedActor' | 'BlockedByActor' 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getAuthorFeed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | limit: number 15 | cursor?: string 16 | filter: 17 | | 'posts_with_replies' 18 | | 'posts_no_replies' 19 | | 'posts_with_media' 20 | | (string & {}) 21 | } 22 | 23 | export type InputSchema = undefined 24 | 25 | export interface OutputSchema { 26 | cursor?: string 27 | feed: AppBskyFeedDefs.FeedViewPost[] 28 | [k: string]: unknown 29 | } 30 | 31 | export type HandlerInput = undefined 32 | 33 | export interface HandlerSuccess { 34 | encoding: 'application/json' 35 | body: OutputSchema 36 | headers?: { [key: string]: string } 37 | } 38 | 39 | export interface HandlerError { 40 | status: number 41 | message?: string 42 | error?: 'BlockedActor' | 'BlockedByActor' 43 | } 44 | 45 | export type HandlerOutput = HandlerError | HandlerSuccess 46 | export type HandlerReqCtx = { 47 | auth: HA 48 | params: QueryParams 49 | input: HandlerInput 50 | req: express.Request 51 | res: express.Response 52 | } 53 | export type Handler = ( 54 | ctx: HandlerReqCtx, 55 | ) => Promise | HandlerOutput 56 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getFeed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | feed: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feed: AppBskyFeedDefs.FeedViewPost[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | error?: 'UnknownFeed' 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getFeedGenerator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | feed: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | view: AppBskyFeedDefs.GeneratorView 20 | isOnline: boolean 21 | isValid: boolean 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getFeedGenerators.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | feeds: string[] 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | feeds: AppBskyFeedDefs.GeneratorView[] 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | } 35 | 36 | export type HandlerOutput = HandlerError | HandlerSuccess 37 | export type HandlerReqCtx = { 38 | auth: HA 39 | params: QueryParams 40 | input: HandlerInput 41 | req: express.Request 42 | res: express.Response 43 | } 44 | export type Handler = ( 45 | ctx: HandlerReqCtx, 46 | ) => Promise | HandlerOutput 47 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getFeedSkeleton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | feed: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feed: AppBskyFeedDefs.SkeletonFeedPost[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | error?: 'UnknownFeed' 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getLikes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | uri: string 14 | cid?: string 15 | limit: number 16 | cursor?: string 17 | } 18 | 19 | export type InputSchema = undefined 20 | 21 | export interface OutputSchema { 22 | uri: string 23 | cid?: string 24 | cursor?: string 25 | likes: Like[] 26 | [k: string]: unknown 27 | } 28 | 29 | export type HandlerInput = undefined 30 | 31 | export interface HandlerSuccess { 32 | encoding: 'application/json' 33 | body: OutputSchema 34 | headers?: { [key: string]: string } 35 | } 36 | 37 | export interface HandlerError { 38 | status: number 39 | message?: string 40 | } 41 | 42 | export type HandlerOutput = HandlerError | HandlerSuccess 43 | export type HandlerReqCtx = { 44 | auth: HA 45 | params: QueryParams 46 | input: HandlerInput 47 | req: express.Request 48 | res: express.Response 49 | } 50 | export type Handler = ( 51 | ctx: HandlerReqCtx, 52 | ) => Promise | HandlerOutput 53 | 54 | export interface Like { 55 | indexedAt: string 56 | createdAt: string 57 | actor: AppBskyActorDefs.ProfileView 58 | [k: string]: unknown 59 | } 60 | 61 | export function isLike(v: unknown): v is Like { 62 | return ( 63 | isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.feed.getLikes#like' 64 | ) 65 | } 66 | 67 | export function validateLike(v: unknown): ValidationResult { 68 | return lexicons.validate('app.bsky.feed.getLikes#like', v) 69 | } 70 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getListFeed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | list: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feed: AppBskyFeedDefs.FeedViewPost[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | error?: 'UnknownList' 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getPostThread.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | uri: string 14 | depth: number 15 | parentHeight: number 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | thread: 22 | | AppBskyFeedDefs.ThreadViewPost 23 | | AppBskyFeedDefs.NotFoundPost 24 | | AppBskyFeedDefs.BlockedPost 25 | | { $type: string; [k: string]: unknown } 26 | [k: string]: unknown 27 | } 28 | 29 | export type HandlerInput = undefined 30 | 31 | export interface HandlerSuccess { 32 | encoding: 'application/json' 33 | body: OutputSchema 34 | headers?: { [key: string]: string } 35 | } 36 | 37 | export interface HandlerError { 38 | status: number 39 | message?: string 40 | error?: 'NotFound' 41 | } 42 | 43 | export type HandlerOutput = HandlerError | HandlerSuccess 44 | export type HandlerReqCtx = { 45 | auth: HA 46 | params: QueryParams 47 | input: HandlerInput 48 | req: express.Request 49 | res: express.Response 50 | } 51 | export type Handler = ( 52 | ctx: HandlerReqCtx, 53 | ) => Promise | HandlerOutput 54 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getPosts.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | uris: string[] 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | posts: AppBskyFeedDefs.PostView[] 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | } 35 | 36 | export type HandlerOutput = HandlerError | HandlerSuccess 37 | export type HandlerReqCtx = { 38 | auth: HA 39 | params: QueryParams 40 | input: HandlerInput 41 | req: express.Request 42 | res: express.Response 43 | } 44 | export type Handler = ( 45 | ctx: HandlerReqCtx, 46 | ) => Promise | HandlerOutput 47 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getRepostedBy.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | uri: string 14 | cid?: string 15 | limit: number 16 | cursor?: string 17 | } 18 | 19 | export type InputSchema = undefined 20 | 21 | export interface OutputSchema { 22 | uri: string 23 | cid?: string 24 | cursor?: string 25 | repostedBy: AppBskyActorDefs.ProfileView[] 26 | [k: string]: unknown 27 | } 28 | 29 | export type HandlerInput = undefined 30 | 31 | export interface HandlerSuccess { 32 | encoding: 'application/json' 33 | body: OutputSchema 34 | headers?: { [key: string]: string } 35 | } 36 | 37 | export interface HandlerError { 38 | status: number 39 | message?: string 40 | } 41 | 42 | export type HandlerOutput = HandlerError | HandlerSuccess 43 | export type HandlerReqCtx = { 44 | auth: HA 45 | params: QueryParams 46 | input: HandlerInput 47 | req: express.Request 48 | res: express.Response 49 | } 50 | export type Handler = ( 51 | ctx: HandlerReqCtx, 52 | ) => Promise | HandlerOutput 53 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getSavedFeeds.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | feeds: AppBskyFeedDefs.GeneratorView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | } 31 | 32 | export interface HandlerError { 33 | status: number 34 | message?: string 35 | } 36 | 37 | export type HandlerOutput = HandlerError | HandlerSuccess 38 | export type Handler = (ctx: { 39 | auth: HA 40 | params: QueryParams 41 | input: HandlerInput 42 | req: express.Request 43 | res: express.Response 44 | }) => Promise | HandlerOutput 45 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getSuggestedFeeds.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | feeds: AppBskyFeedDefs.GeneratorView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/getTimeline.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | algorithm?: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feed: AppBskyFeedDefs.FeedViewPost[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/like.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' 9 | 10 | export interface Record { 11 | subject: ComAtprotoRepoStrongRef.Main 12 | createdAt: string 13 | [k: string]: unknown 14 | } 15 | 16 | export function isRecord(v: unknown): v is Record { 17 | return ( 18 | isObj(v) && 19 | hasProp(v, '$type') && 20 | (v.$type === 'app.bsky.feed.like#main' || v.$type === 'app.bsky.feed.like') 21 | ) 22 | } 23 | 24 | export function validateRecord(v: unknown): ValidationResult { 25 | return lexicons.validate('app.bsky.feed.like#main', v) 26 | } 27 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/repost.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' 9 | 10 | export interface Record { 11 | subject: ComAtprotoRepoStrongRef.Main 12 | createdAt: string 13 | [k: string]: unknown 14 | } 15 | 16 | export function isRecord(v: unknown): v is Record { 17 | return ( 18 | isObj(v) && 19 | hasProp(v, '$type') && 20 | (v.$type === 'app.bsky.feed.repost#main' || 21 | v.$type === 'app.bsky.feed.repost') 22 | ) 23 | } 24 | 25 | export function validateRecord(v: unknown): ValidationResult { 26 | return lexicons.validate('app.bsky.feed.repost#main', v) 27 | } 28 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/saveFeed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | feed: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type Handler = (ctx: { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | }) => Promise | HandlerOutput 36 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/searchPosts.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ 14 | q: string 15 | limit: number 16 | /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ 17 | cursor?: string 18 | } 19 | 20 | export type InputSchema = undefined 21 | 22 | export interface OutputSchema { 23 | cursor?: string 24 | /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ 25 | hitsTotal?: number 26 | posts: AppBskyFeedDefs.PostView[] 27 | [k: string]: unknown 28 | } 29 | 30 | export type HandlerInput = undefined 31 | 32 | export interface HandlerSuccess { 33 | encoding: 'application/json' 34 | body: OutputSchema 35 | headers?: { [key: string]: string } 36 | } 37 | 38 | export interface HandlerError { 39 | status: number 40 | message?: string 41 | error?: 'BadQueryString' 42 | } 43 | 44 | export type HandlerOutput = HandlerError | HandlerSuccess 45 | export type HandlerReqCtx = { 46 | auth: HA 47 | params: QueryParams 48 | input: HandlerInput 49 | req: express.Request 50 | res: express.Response 51 | } 52 | export type Handler = ( 53 | ctx: HandlerReqCtx, 54 | ) => Promise | HandlerOutput 55 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/feed/unsaveFeed.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | feed: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type Handler = (ctx: { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | }) => Promise | HandlerOutput 36 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/block.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface Record { 10 | subject: string 11 | createdAt: string 12 | [k: string]: unknown 13 | } 14 | 15 | export function isRecord(v: unknown): v is Record { 16 | return ( 17 | isObj(v) && 18 | hasProp(v, '$type') && 19 | (v.$type === 'app.bsky.graph.block#main' || 20 | v.$type === 'app.bsky.graph.block') 21 | ) 22 | } 23 | 24 | export function validateRecord(v: unknown): ValidationResult { 25 | return lexicons.validate('app.bsky.graph.block#main', v) 26 | } 27 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/follow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface Record { 10 | subject: string 11 | createdAt: string 12 | [k: string]: unknown 13 | } 14 | 15 | export function isRecord(v: unknown): v is Record { 16 | return ( 17 | isObj(v) && 18 | hasProp(v, '$type') && 19 | (v.$type === 'app.bsky.graph.follow#main' || 20 | v.$type === 'app.bsky.graph.follow') 21 | ) 22 | } 23 | 24 | export function validateRecord(v: unknown): ValidationResult { 25 | return lexicons.validate('app.bsky.graph.follow#main', v) 26 | } 27 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getBlocks.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | blocks: AppBskyActorDefs.ProfileView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getFollowers.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | subject: AppBskyActorDefs.ProfileView 22 | cursor?: string 23 | followers: AppBskyActorDefs.ProfileView[] 24 | [k: string]: unknown 25 | } 26 | 27 | export type HandlerInput = undefined 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getFollows.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | subject: AppBskyActorDefs.ProfileView 22 | cursor?: string 23 | follows: AppBskyActorDefs.ProfileView[] 24 | [k: string]: unknown 25 | } 26 | 27 | export type HandlerInput = undefined 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyGraphDefs from './defs' 11 | 12 | export interface QueryParams { 13 | list: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | list: AppBskyGraphDefs.ListView 23 | items: AppBskyGraphDefs.ListItemView[] 24 | [k: string]: unknown 25 | } 26 | 27 | export type HandlerInput = undefined 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getListBlocks.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyGraphDefs from './defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | lists: AppBskyGraphDefs.ListView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getListMutes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyGraphDefs from './defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | lists: AppBskyGraphDefs.ListView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getLists.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyGraphDefs from './defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | lists: AppBskyGraphDefs.ListView[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getMutes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | mutes: AppBskyActorDefs.ProfileView[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyActorDefs from '../actor/defs' 11 | 12 | export interface QueryParams { 13 | actor: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | suggestions: AppBskyActorDefs.ProfileView[] 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | } 35 | 36 | export type HandlerOutput = HandlerError | HandlerSuccess 37 | export type HandlerReqCtx = { 38 | auth: HA 39 | params: QueryParams 40 | input: HandlerInput 41 | req: express.Request 42 | res: express.Response 43 | } 44 | export type Handler = ( 45 | ctx: HandlerReqCtx, 46 | ) => Promise | HandlerOutput 47 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/list.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import * as AppBskyGraphDefs from './defs' 9 | import * as AppBskyRichtextFacet from '../richtext/facet' 10 | import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' 11 | 12 | export interface Record { 13 | purpose: AppBskyGraphDefs.ListPurpose 14 | name: string 15 | description?: string 16 | descriptionFacets?: AppBskyRichtextFacet.Main[] 17 | avatar?: BlobRef 18 | labels?: 19 | | ComAtprotoLabelDefs.SelfLabels 20 | | { $type: string; [k: string]: unknown } 21 | createdAt: string 22 | [k: string]: unknown 23 | } 24 | 25 | export function isRecord(v: unknown): v is Record { 26 | return ( 27 | isObj(v) && 28 | hasProp(v, '$type') && 29 | (v.$type === 'app.bsky.graph.list#main' || 30 | v.$type === 'app.bsky.graph.list') 31 | ) 32 | } 33 | 34 | export function validateRecord(v: unknown): ValidationResult { 35 | return lexicons.validate('app.bsky.graph.list#main', v) 36 | } 37 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/listblock.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface Record { 10 | subject: string 11 | createdAt: string 12 | [k: string]: unknown 13 | } 14 | 15 | export function isRecord(v: unknown): v is Record { 16 | return ( 17 | isObj(v) && 18 | hasProp(v, '$type') && 19 | (v.$type === 'app.bsky.graph.listblock#main' || 20 | v.$type === 'app.bsky.graph.listblock') 21 | ) 22 | } 23 | 24 | export function validateRecord(v: unknown): ValidationResult { 25 | return lexicons.validate('app.bsky.graph.listblock#main', v) 26 | } 27 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/listitem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface Record { 10 | subject: string 11 | list: string 12 | createdAt: string 13 | [k: string]: unknown 14 | } 15 | 16 | export function isRecord(v: unknown): v is Record { 17 | return ( 18 | isObj(v) && 19 | hasProp(v, '$type') && 20 | (v.$type === 'app.bsky.graph.listitem#main' || 21 | v.$type === 'app.bsky.graph.listitem') 22 | ) 23 | } 24 | 25 | export function validateRecord(v: unknown): ValidationResult { 26 | return lexicons.validate('app.bsky.graph.listitem#main', v) 27 | } 28 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/muteActor.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | actor: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/muteActorList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | list: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/unmuteActor.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | actor: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/graph/unmuteActorList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | list: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/notification/getUnreadCount.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | seenAt?: string 13 | } 14 | 15 | export type InputSchema = undefined 16 | 17 | export interface OutputSchema { 18 | count: number 19 | [k: string]: unknown 20 | } 21 | 22 | export type HandlerInput = undefined 23 | 24 | export interface HandlerSuccess { 25 | encoding: 'application/json' 26 | body: OutputSchema 27 | headers?: { [key: string]: string } 28 | } 29 | 30 | export interface HandlerError { 31 | status: number 32 | message?: string 33 | } 34 | 35 | export type HandlerOutput = HandlerError | HandlerSuccess 36 | export type HandlerReqCtx = { 37 | auth: HA 38 | params: QueryParams 39 | input: HandlerInput 40 | req: express.Request 41 | res: express.Response 42 | } 43 | export type Handler = ( 44 | ctx: HandlerReqCtx, 45 | ) => Promise | HandlerOutput 46 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/notification/registerPush.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | serviceDid: string 15 | token: string 16 | platform: 'ios' | 'android' | 'web' | (string & {}) 17 | appId: string 18 | [k: string]: unknown 19 | } 20 | 21 | export interface HandlerInput { 22 | encoding: 'application/json' 23 | body: InputSchema 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | } 30 | 31 | export type HandlerOutput = HandlerError | void 32 | export type HandlerReqCtx = { 33 | auth: HA 34 | params: QueryParams 35 | input: HandlerInput 36 | req: express.Request 37 | res: express.Response 38 | } 39 | export type Handler = ( 40 | ctx: HandlerReqCtx, 41 | ) => Promise | HandlerOutput 42 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/notification/updateSeen.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | seenAt: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/unspecced/defs.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface SkeletonSearchPost { 10 | uri: string 11 | [k: string]: unknown 12 | } 13 | 14 | export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost { 15 | return ( 16 | isObj(v) && 17 | hasProp(v, '$type') && 18 | v.$type === 'app.bsky.unspecced.defs#skeletonSearchPost' 19 | ) 20 | } 21 | 22 | export function validateSkeletonSearchPost(v: unknown): ValidationResult { 23 | return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchPost', v) 24 | } 25 | 26 | export interface SkeletonSearchActor { 27 | did: string 28 | [k: string]: unknown 29 | } 30 | 31 | export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor { 32 | return ( 33 | isObj(v) && 34 | hasProp(v, '$type') && 35 | v.$type === 'app.bsky.unspecced.defs#skeletonSearchActor' 36 | ) 37 | } 38 | 39 | export function validateSkeletonSearchActor(v: unknown): ValidationResult { 40 | return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchActor', v) 41 | } 42 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/unspecced/getPopular.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from '../feed/defs' 11 | 12 | export interface QueryParams { 13 | includeNsfw: boolean 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feed: AppBskyFeedDefs.FeedViewPost[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from '../feed/defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | query?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | feeds: AppBskyFeedDefs.GeneratorView[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyFeedDefs from '../feed/defs' 11 | 12 | export interface QueryParams { 13 | limit: number 14 | cursor?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | cursor?: string 21 | feed: AppBskyFeedDefs.SkeletonFeedPost[] 22 | [k: string]: unknown 23 | } 24 | 25 | export type HandlerInput = undefined 26 | 27 | export interface HandlerSuccess { 28 | encoding: 'application/json' 29 | body: OutputSchema 30 | headers?: { [key: string]: string } 31 | } 32 | 33 | export interface HandlerError { 34 | status: number 35 | message?: string 36 | error?: 'UnknownFeed' 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyUnspeccedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** 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 */ 14 | q: string 15 | /** if true, acts as fast/simple 'typeahead' query */ 16 | typeahead?: boolean 17 | limit: number 18 | /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ 19 | cursor?: string 20 | } 21 | 22 | export type InputSchema = undefined 23 | 24 | export interface OutputSchema { 25 | cursor?: string 26 | /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ 27 | hitsTotal?: number 28 | actors: AppBskyUnspeccedDefs.SkeletonSearchActor[] 29 | [k: string]: unknown 30 | } 31 | 32 | export type HandlerInput = undefined 33 | 34 | export interface HandlerSuccess { 35 | encoding: 'application/json' 36 | body: OutputSchema 37 | headers?: { [key: string]: string } 38 | } 39 | 40 | export interface HandlerError { 41 | status: number 42 | message?: string 43 | error?: 'BadQueryString' 44 | } 45 | 46 | export type HandlerOutput = HandlerError | HandlerSuccess 47 | export type HandlerReqCtx = { 48 | auth: HA 49 | params: QueryParams 50 | input: HandlerInput 51 | req: express.Request 52 | res: express.Response 53 | } 54 | export type Handler = ( 55 | ctx: HandlerReqCtx, 56 | ) => Promise | HandlerOutput 57 | -------------------------------------------------------------------------------- /src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as AppBskyUnspeccedDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */ 14 | q: string 15 | limit: number 16 | /** optional pagination mechanism; may not necessarily allow scrolling through entire result set */ 17 | cursor?: string 18 | } 19 | 20 | export type InputSchema = undefined 21 | 22 | export interface OutputSchema { 23 | cursor?: string 24 | /** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */ 25 | hitsTotal?: number 26 | posts: AppBskyUnspeccedDefs.SkeletonSearchPost[] 27 | [k: string]: unknown 28 | } 29 | 30 | export type HandlerInput = undefined 31 | 32 | export interface HandlerSuccess { 33 | encoding: 'application/json' 34 | body: OutputSchema 35 | headers?: { [key: string]: string } 36 | } 37 | 38 | export interface HandlerError { 39 | status: number 40 | message?: string 41 | error?: 'BadQueryString' 42 | } 43 | 44 | export type HandlerOutput = HandlerError | HandlerSuccess 45 | export type HandlerReqCtx = { 46 | auth: HA 47 | params: QueryParams 48 | input: HandlerInput 49 | req: express.Request 50 | res: express.Response 51 | } 52 | export type Handler = ( 53 | ctx: HandlerReqCtx, 54 | ) => Promise | HandlerOutput 55 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/disableAccountInvites.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | account: string 15 | /** Additionally add a note describing why the invites were disabled */ 16 | note?: string 17 | [k: string]: unknown 18 | } 19 | 20 | export interface HandlerInput { 21 | encoding: 'application/json' 22 | body: InputSchema 23 | } 24 | 25 | export interface HandlerError { 26 | status: number 27 | message?: string 28 | } 29 | 30 | export type HandlerOutput = HandlerError | void 31 | export type HandlerReqCtx = { 32 | auth: HA 33 | params: QueryParams 34 | input: HandlerInput 35 | req: express.Request 36 | res: express.Response 37 | } 38 | export type Handler = ( 39 | ctx: HandlerReqCtx, 40 | ) => Promise | HandlerOutput 41 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/disableInviteCodes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | codes?: string[] 15 | accounts?: string[] 16 | [k: string]: unknown 17 | } 18 | 19 | export interface HandlerInput { 20 | encoding: 'application/json' 21 | body: InputSchema 22 | } 23 | 24 | export interface HandlerError { 25 | status: number 26 | message?: string 27 | } 28 | 29 | export type HandlerOutput = HandlerError | void 30 | export type HandlerReqCtx = { 31 | auth: HA 32 | params: QueryParams 33 | input: HandlerInput 34 | req: express.Request 35 | res: express.Response 36 | } 37 | export type Handler = ( 38 | ctx: HandlerReqCtx, 39 | ) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/enableAccountInvites.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | account: string 15 | /** Additionally add a note describing why the invites were enabled */ 16 | note?: string 17 | [k: string]: unknown 18 | } 19 | 20 | export interface HandlerInput { 21 | encoding: 'application/json' 22 | body: InputSchema 23 | } 24 | 25 | export interface HandlerError { 26 | status: number 27 | message?: string 28 | } 29 | 30 | export type HandlerOutput = HandlerError | void 31 | export type HandlerReqCtx = { 32 | auth: HA 33 | params: QueryParams 34 | input: HandlerInput 35 | req: express.Request 36 | res: express.Response 37 | } 38 | export type Handler = ( 39 | ctx: HandlerReqCtx, 40 | ) => Promise | HandlerOutput 41 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getInviteCodes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoServerDefs from '../server/defs' 11 | 12 | export interface QueryParams { 13 | sort: 'recent' | 'usage' | (string & {}) 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | codes: ComAtprotoServerDefs.InviteCode[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getModerationAction.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | id: number 14 | } 15 | 16 | export type InputSchema = undefined 17 | export type OutputSchema = ComAtprotoAdminDefs.ActionViewDetail 18 | export type HandlerInput = undefined 19 | 20 | export interface HandlerSuccess { 21 | encoding: 'application/json' 22 | body: OutputSchema 23 | headers?: { [key: string]: string } 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | } 30 | 31 | export type HandlerOutput = HandlerError | HandlerSuccess 32 | export type HandlerReqCtx = { 33 | auth: HA 34 | params: QueryParams 35 | input: HandlerInput 36 | req: express.Request 37 | res: express.Response 38 | } 39 | export type Handler = ( 40 | ctx: HandlerReqCtx, 41 | ) => Promise | HandlerOutput 42 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getModerationActions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | subject?: string 14 | limit: number 15 | cursor?: string 16 | } 17 | 18 | export type InputSchema = undefined 19 | 20 | export interface OutputSchema { 21 | cursor?: string 22 | actions: ComAtprotoAdminDefs.ActionView[] 23 | [k: string]: unknown 24 | } 25 | 26 | export type HandlerInput = undefined 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getModerationReport.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | id: number 14 | } 15 | 16 | export type InputSchema = undefined 17 | export type OutputSchema = ComAtprotoAdminDefs.ReportViewDetail 18 | export type HandlerInput = undefined 19 | 20 | export interface HandlerSuccess { 21 | encoding: 'application/json' 22 | body: OutputSchema 23 | headers?: { [key: string]: string } 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | } 30 | 31 | export type HandlerOutput = HandlerError | HandlerSuccess 32 | export type HandlerReqCtx = { 33 | auth: HA 34 | params: QueryParams 35 | input: HandlerInput 36 | req: express.Request 37 | res: express.Response 38 | } 39 | export type Handler = ( 40 | ctx: HandlerReqCtx, 41 | ) => Promise | HandlerOutput 42 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getModerationReports.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | subject?: string 14 | ignoreSubjects?: string[] 15 | /** Get all reports that were actioned by a specific moderator */ 16 | actionedBy?: string 17 | /** Filter reports made by one or more DIDs */ 18 | reporters?: string[] 19 | resolved?: boolean 20 | actionType?: 21 | | 'com.atproto.admin.defs#takedown' 22 | | 'com.atproto.admin.defs#flag' 23 | | 'com.atproto.admin.defs#acknowledge' 24 | | 'com.atproto.admin.defs#escalate' 25 | | (string & {}) 26 | limit: number 27 | cursor?: string 28 | /** Reverse the order of the returned records? when true, returns reports in chronological order */ 29 | reverse?: boolean 30 | } 31 | 32 | export type InputSchema = undefined 33 | 34 | export interface OutputSchema { 35 | cursor?: string 36 | reports: ComAtprotoAdminDefs.ReportView[] 37 | [k: string]: unknown 38 | } 39 | 40 | export type HandlerInput = undefined 41 | 42 | export interface HandlerSuccess { 43 | encoding: 'application/json' 44 | body: OutputSchema 45 | headers?: { [key: string]: string } 46 | } 47 | 48 | export interface HandlerError { 49 | status: number 50 | message?: string 51 | } 52 | 53 | export type HandlerOutput = HandlerError | HandlerSuccess 54 | export type HandlerReqCtx = { 55 | auth: HA 56 | params: QueryParams 57 | input: HandlerInput 58 | req: express.Request 59 | res: express.Response 60 | } 61 | export type Handler = ( 62 | ctx: HandlerReqCtx, 63 | ) => Promise | HandlerOutput 64 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | uri: string 14 | cid?: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | export type OutputSchema = ComAtprotoAdminDefs.RecordViewDetail 19 | export type HandlerInput = undefined 20 | 21 | export interface HandlerSuccess { 22 | encoding: 'application/json' 23 | body: OutputSchema 24 | headers?: { [key: string]: string } 25 | } 26 | 27 | export interface HandlerError { 28 | status: number 29 | message?: string 30 | error?: 'RecordNotFound' 31 | } 32 | 33 | export type HandlerOutput = HandlerError | HandlerSuccess 34 | export type HandlerReqCtx = { 35 | auth: HA 36 | params: QueryParams 37 | input: HandlerInput 38 | req: express.Request 39 | res: express.Response 40 | } 41 | export type Handler = ( 42 | ctx: HandlerReqCtx, 43 | ) => Promise | HandlerOutput 44 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/getRepo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | did: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | export type OutputSchema = ComAtprotoAdminDefs.RepoViewDetail 18 | export type HandlerInput = undefined 19 | 20 | export interface HandlerSuccess { 21 | encoding: 'application/json' 22 | body: OutputSchema 23 | headers?: { [key: string]: string } 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | error?: 'RepoNotFound' 30 | } 31 | 32 | export type HandlerOutput = HandlerError | HandlerSuccess 33 | export type HandlerReqCtx = { 34 | auth: HA 35 | params: QueryParams 36 | input: HandlerInput 37 | req: express.Request 38 | res: express.Response 39 | } 40 | export type Handler = ( 41 | ctx: HandlerReqCtx, 42 | ) => Promise | HandlerOutput 43 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/rebaseRepo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** The handle or DID of the repo. */ 15 | repo: string 16 | /** Compare and swap with the previous commit by cid. */ 17 | swapCommit?: string 18 | [k: string]: unknown 19 | } 20 | 21 | export interface HandlerInput { 22 | encoding: 'application/json' 23 | body: InputSchema 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | error?: 'InvalidSwap' | 'ConcurrentWrites' 30 | } 31 | 32 | export type HandlerOutput = HandlerError | void 33 | export type Handler = (ctx: { 34 | auth: HA 35 | params: QueryParams 36 | input: HandlerInput 37 | req: express.Request 38 | res: express.Response 39 | }) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/resolveModerationReports.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams {} 13 | 14 | export interface InputSchema { 15 | actionId: number 16 | reportIds: number[] 17 | createdBy: string 18 | [k: string]: unknown 19 | } 20 | 21 | export type OutputSchema = ComAtprotoAdminDefs.ActionView 22 | 23 | export interface HandlerInput { 24 | encoding: 'application/json' 25 | body: InputSchema 26 | } 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/reverseModerationAction.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams {} 13 | 14 | export interface InputSchema { 15 | id: number 16 | reason: string 17 | createdBy: string 18 | [k: string]: unknown 19 | } 20 | 21 | export type OutputSchema = ComAtprotoAdminDefs.ActionView 22 | 23 | export interface HandlerInput { 24 | encoding: 'application/json' 25 | body: InputSchema 26 | } 27 | 28 | export interface HandlerSuccess { 29 | encoding: 'application/json' 30 | body: OutputSchema 31 | headers?: { [key: string]: string } 32 | } 33 | 34 | export interface HandlerError { 35 | status: number 36 | message?: string 37 | } 38 | 39 | export type HandlerOutput = HandlerError | HandlerSuccess 40 | export type HandlerReqCtx = { 41 | auth: HA 42 | params: QueryParams 43 | input: HandlerInput 44 | req: express.Request 45 | res: express.Response 46 | } 47 | export type Handler = ( 48 | ctx: HandlerReqCtx, 49 | ) => Promise | HandlerOutput 50 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/searchRepos.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** DEPRECATED: use 'q' instead */ 14 | term?: string 15 | q?: string 16 | invitedBy?: string 17 | limit: number 18 | cursor?: string 19 | } 20 | 21 | export type InputSchema = undefined 22 | 23 | export interface OutputSchema { 24 | cursor?: string 25 | repos: ComAtprotoAdminDefs.RepoView[] 26 | [k: string]: unknown 27 | } 28 | 29 | export type HandlerInput = undefined 30 | 31 | export interface HandlerSuccess { 32 | encoding: 'application/json' 33 | body: OutputSchema 34 | headers?: { [key: string]: string } 35 | } 36 | 37 | export interface HandlerError { 38 | status: number 39 | message?: string 40 | } 41 | 42 | export type HandlerOutput = HandlerError | HandlerSuccess 43 | export type HandlerReqCtx = { 44 | auth: HA 45 | params: QueryParams 46 | input: HandlerInput 47 | req: express.Request 48 | res: express.Response 49 | } 50 | export type Handler = ( 51 | ctx: HandlerReqCtx, 52 | ) => Promise | HandlerOutput 53 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/sendEmail.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | recipientDid: string 15 | content: string 16 | subject?: string 17 | [k: string]: unknown 18 | } 19 | 20 | export interface OutputSchema { 21 | sent: boolean 22 | [k: string]: unknown 23 | } 24 | 25 | export interface HandlerInput { 26 | encoding: 'application/json' 27 | body: InputSchema 28 | } 29 | 30 | export interface HandlerSuccess { 31 | encoding: 'application/json' 32 | body: OutputSchema 33 | headers?: { [key: string]: string } 34 | } 35 | 36 | export interface HandlerError { 37 | status: number 38 | message?: string 39 | } 40 | 41 | export type HandlerOutput = HandlerError | HandlerSuccess 42 | export type HandlerReqCtx = { 43 | auth: HA 44 | params: QueryParams 45 | input: HandlerInput 46 | req: express.Request 47 | res: express.Response 48 | } 49 | export type Handler = ( 50 | ctx: HandlerReqCtx, 51 | ) => Promise | HandlerOutput 52 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/takeModerationAction.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoAdminDefs from './defs' 11 | import * as ComAtprotoRepoStrongRef from '../repo/strongRef' 12 | 13 | export interface QueryParams {} 14 | 15 | export interface InputSchema { 16 | action: 17 | | 'com.atproto.admin.defs#takedown' 18 | | 'com.atproto.admin.defs#flag' 19 | | 'com.atproto.admin.defs#acknowledge' 20 | | (string & {}) 21 | subject: 22 | | ComAtprotoAdminDefs.RepoRef 23 | | ComAtprotoRepoStrongRef.Main 24 | | { $type: string; [k: string]: unknown } 25 | subjectBlobCids?: string[] 26 | createLabelVals?: string[] 27 | negateLabelVals?: string[] 28 | reason: string 29 | /** Indicates how long this action was meant to be in effect before automatically expiring. */ 30 | durationInHours?: number 31 | createdBy: string 32 | [k: string]: unknown 33 | } 34 | 35 | export type OutputSchema = ComAtprotoAdminDefs.ActionView 36 | 37 | export interface HandlerInput { 38 | encoding: 'application/json' 39 | body: InputSchema 40 | } 41 | 42 | export interface HandlerSuccess { 43 | encoding: 'application/json' 44 | body: OutputSchema 45 | headers?: { [key: string]: string } 46 | } 47 | 48 | export interface HandlerError { 49 | status: number 50 | message?: string 51 | error?: 'SubjectHasAction' 52 | } 53 | 54 | export type HandlerOutput = HandlerError | HandlerSuccess 55 | export type HandlerReqCtx = { 56 | auth: HA 57 | params: QueryParams 58 | input: HandlerInput 59 | req: express.Request 60 | res: express.Response 61 | } 62 | export type Handler = ( 63 | ctx: HandlerReqCtx, 64 | ) => Promise | HandlerOutput 65 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/updateAccountEmail.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** The handle or DID of the repo. */ 15 | account: string 16 | email: string 17 | [k: string]: unknown 18 | } 19 | 20 | export interface HandlerInput { 21 | encoding: 'application/json' 22 | body: InputSchema 23 | } 24 | 25 | export interface HandlerError { 26 | status: number 27 | message?: string 28 | } 29 | 30 | export type HandlerOutput = HandlerError | void 31 | export type HandlerReqCtx = { 32 | auth: HA 33 | params: QueryParams 34 | input: HandlerInput 35 | req: express.Request 36 | res: express.Response 37 | } 38 | export type Handler = ( 39 | ctx: HandlerReqCtx, 40 | ) => Promise | HandlerOutput 41 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/admin/updateAccountHandle.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | did: string 15 | handle: string 16 | [k: string]: unknown 17 | } 18 | 19 | export interface HandlerInput { 20 | encoding: 'application/json' 21 | body: InputSchema 22 | } 23 | 24 | export interface HandlerError { 25 | status: number 26 | message?: string 27 | } 28 | 29 | export type HandlerOutput = HandlerError | void 30 | export type HandlerReqCtx = { 31 | auth: HA 32 | params: QueryParams 33 | input: HandlerInput 34 | req: express.Request 35 | res: express.Response 36 | } 37 | export type Handler = ( 38 | ctx: HandlerReqCtx, 39 | ) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/identity/resolveHandle.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The handle to resolve. */ 13 | handle: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | did: string 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | } 35 | 36 | export type HandlerOutput = HandlerError | HandlerSuccess 37 | export type HandlerReqCtx = { 38 | auth: HA 39 | params: QueryParams 40 | input: HandlerInput 41 | req: express.Request 42 | res: express.Response 43 | } 44 | export type Handler = ( 45 | ctx: HandlerReqCtx, 46 | ) => Promise | HandlerOutput 47 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/identity/updateHandle.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | handle: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/label/queryLabels.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoLabelDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will match inclusive of the string leading to '*'), or a full URI */ 14 | uriPatterns: string[] 15 | /** Optional list of label sources (DIDs) to filter on */ 16 | sources?: string[] 17 | limit: number 18 | cursor?: string 19 | } 20 | 21 | export type InputSchema = undefined 22 | 23 | export interface OutputSchema { 24 | cursor?: string 25 | labels: ComAtprotoLabelDefs.Label[] 26 | [k: string]: unknown 27 | } 28 | 29 | export type HandlerInput = undefined 30 | 31 | export interface HandlerSuccess { 32 | encoding: 'application/json' 33 | body: OutputSchema 34 | headers?: { [key: string]: string } 35 | } 36 | 37 | export interface HandlerError { 38 | status: number 39 | message?: string 40 | } 41 | 42 | export type HandlerOutput = HandlerError | HandlerSuccess 43 | export type HandlerReqCtx = { 44 | auth: HA 45 | params: QueryParams 46 | input: HandlerInput 47 | req: express.Request 48 | res: express.Response 49 | } 50 | export type Handler = ( 51 | ctx: HandlerReqCtx, 52 | ) => Promise | HandlerOutput 53 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/label/subscribeLabels.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | import { HandlerAuth, ErrorFrame } from '@atproto/xrpc-server' 9 | import { IncomingMessage } from 'http' 10 | import * as ComAtprotoLabelDefs from './defs' 11 | 12 | export interface QueryParams { 13 | /** The last known event to backfill from. */ 14 | cursor?: number 15 | } 16 | 17 | export type OutputSchema = 18 | | Labels 19 | | Info 20 | | { $type: string; [k: string]: unknown } 21 | export type HandlerError = ErrorFrame<'FutureCursor'> 22 | export type HandlerOutput = HandlerError | OutputSchema 23 | export type HandlerReqCtx = { 24 | auth: HA 25 | params: QueryParams 26 | req: IncomingMessage 27 | signal: AbortSignal 28 | } 29 | export type Handler = ( 30 | ctx: HandlerReqCtx, 31 | ) => AsyncIterable 32 | 33 | export interface Labels { 34 | seq: number 35 | labels: ComAtprotoLabelDefs.Label[] 36 | [k: string]: unknown 37 | } 38 | 39 | export function isLabels(v: unknown): v is Labels { 40 | return ( 41 | isObj(v) && 42 | hasProp(v, '$type') && 43 | v.$type === 'com.atproto.label.subscribeLabels#labels' 44 | ) 45 | } 46 | 47 | export function validateLabels(v: unknown): ValidationResult { 48 | return lexicons.validate('com.atproto.label.subscribeLabels#labels', v) 49 | } 50 | 51 | export interface Info { 52 | name: 'OutdatedCursor' | (string & {}) 53 | message?: string 54 | [k: string]: unknown 55 | } 56 | 57 | export function isInfo(v: unknown): v is Info { 58 | return ( 59 | isObj(v) && 60 | hasProp(v, '$type') && 61 | v.$type === 'com.atproto.label.subscribeLabels#info' 62 | ) 63 | } 64 | 65 | export function validateInfo(v: unknown): ValidationResult { 66 | return lexicons.validate('com.atproto.label.subscribeLabels#info', v) 67 | } 68 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/moderation/createReport.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoModerationDefs from './defs' 11 | import * as ComAtprotoAdminDefs from '../admin/defs' 12 | import * as ComAtprotoRepoStrongRef from '../repo/strongRef' 13 | 14 | export interface QueryParams {} 15 | 16 | export interface InputSchema { 17 | reasonType: ComAtprotoModerationDefs.ReasonType 18 | reason?: string 19 | subject: 20 | | ComAtprotoAdminDefs.RepoRef 21 | | ComAtprotoRepoStrongRef.Main 22 | | { $type: string; [k: string]: unknown } 23 | [k: string]: unknown 24 | } 25 | 26 | export interface OutputSchema { 27 | id: number 28 | reasonType: ComAtprotoModerationDefs.ReasonType 29 | reason?: string 30 | subject: 31 | | ComAtprotoAdminDefs.RepoRef 32 | | ComAtprotoRepoStrongRef.Main 33 | | { $type: string; [k: string]: unknown } 34 | reportedBy: string 35 | createdAt: string 36 | [k: string]: unknown 37 | } 38 | 39 | export interface HandlerInput { 40 | encoding: 'application/json' 41 | body: InputSchema 42 | } 43 | 44 | export interface HandlerSuccess { 45 | encoding: 'application/json' 46 | body: OutputSchema 47 | headers?: { [key: string]: string } 48 | } 49 | 50 | export interface HandlerError { 51 | status: number 52 | message?: string 53 | } 54 | 55 | export type HandlerOutput = HandlerError | HandlerSuccess 56 | export type HandlerReqCtx = { 57 | auth: HA 58 | params: QueryParams 59 | input: HandlerInput 60 | req: express.Request 61 | res: express.Response 62 | } 63 | export type Handler = ( 64 | ctx: HandlerReqCtx, 65 | ) => Promise | HandlerOutput 66 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/moderation/defs.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export type ReasonType = 10 | | 'com.atproto.moderation.defs#reasonSpam' 11 | | 'com.atproto.moderation.defs#reasonViolation' 12 | | 'com.atproto.moderation.defs#reasonMisleading' 13 | | 'com.atproto.moderation.defs#reasonSexual' 14 | | 'com.atproto.moderation.defs#reasonRude' 15 | | 'com.atproto.moderation.defs#reasonOther' 16 | | (string & {}) 17 | 18 | /** Spam: frequent unwanted promotion, replies, mentions */ 19 | export const REASONSPAM = 'com.atproto.moderation.defs#reasonSpam' 20 | /** Direct violation of server rules, laws, terms of service */ 21 | export const REASONVIOLATION = 'com.atproto.moderation.defs#reasonViolation' 22 | /** Misleading identity, affiliation, or content */ 23 | export const REASONMISLEADING = 'com.atproto.moderation.defs#reasonMisleading' 24 | /** Unwanted or mislabeled sexual content */ 25 | export const REASONSEXUAL = 'com.atproto.moderation.defs#reasonSexual' 26 | /** Rude, harassing, explicit, or otherwise unwelcoming behavior */ 27 | export const REASONRUDE = 'com.atproto.moderation.defs#reasonRude' 28 | /** Other: reports not falling under another report category */ 29 | export const REASONOTHER = 'com.atproto.moderation.defs#reasonOther' 30 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/createRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** The handle or DID of the repo. */ 15 | repo: string 16 | /** The NSID of the record collection. */ 17 | collection: string 18 | /** The key of the record. */ 19 | rkey?: string 20 | /** Validate the record? */ 21 | validate: boolean 22 | /** The record to create. */ 23 | record: {} 24 | /** Compare and swap with the previous commit by cid. */ 25 | swapCommit?: string 26 | [k: string]: unknown 27 | } 28 | 29 | export interface OutputSchema { 30 | uri: string 31 | cid: string 32 | [k: string]: unknown 33 | } 34 | 35 | export interface HandlerInput { 36 | encoding: 'application/json' 37 | body: InputSchema 38 | } 39 | 40 | export interface HandlerSuccess { 41 | encoding: 'application/json' 42 | body: OutputSchema 43 | headers?: { [key: string]: string } 44 | } 45 | 46 | export interface HandlerError { 47 | status: number 48 | message?: string 49 | error?: 'InvalidSwap' 50 | } 51 | 52 | export type HandlerOutput = HandlerError | HandlerSuccess 53 | export type HandlerReqCtx = { 54 | auth: HA 55 | params: QueryParams 56 | input: HandlerInput 57 | req: express.Request 58 | res: express.Response 59 | } 60 | export type Handler = ( 61 | ctx: HandlerReqCtx, 62 | ) => Promise | HandlerOutput 63 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/deleteRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** The handle or DID of the repo. */ 15 | repo: string 16 | /** The NSID of the record collection. */ 17 | collection: string 18 | /** The key of the record. */ 19 | rkey: string 20 | /** Compare and swap with the previous record by cid. */ 21 | swapRecord?: string 22 | /** Compare and swap with the previous commit by cid. */ 23 | swapCommit?: string 24 | [k: string]: unknown 25 | } 26 | 27 | export interface HandlerInput { 28 | encoding: 'application/json' 29 | body: InputSchema 30 | } 31 | 32 | export interface HandlerError { 33 | status: number 34 | message?: string 35 | error?: 'InvalidSwap' 36 | } 37 | 38 | export type HandlerOutput = HandlerError | void 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/describeRepo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The handle or DID of the repo. */ 13 | repo: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | handle: string 20 | did: string 21 | didDoc: {} 22 | collections: string[] 23 | handleIsCorrect: boolean 24 | [k: string]: unknown 25 | } 26 | 27 | export type HandlerInput = undefined 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/getRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The handle or DID of the repo. */ 13 | repo: string 14 | /** The NSID of the record collection. */ 15 | collection: string 16 | /** The key of the record. */ 17 | rkey: string 18 | /** The CID of the version of the record. If not specified, then return the most recent version. */ 19 | cid?: string 20 | } 21 | 22 | export type InputSchema = undefined 23 | 24 | export interface OutputSchema { 25 | uri: string 26 | cid?: string 27 | value: {} 28 | [k: string]: unknown 29 | } 30 | 31 | export type HandlerInput = undefined 32 | 33 | export interface HandlerSuccess { 34 | encoding: 'application/json' 35 | body: OutputSchema 36 | headers?: { [key: string]: string } 37 | } 38 | 39 | export interface HandlerError { 40 | status: number 41 | message?: string 42 | } 43 | 44 | export type HandlerOutput = HandlerError | HandlerSuccess 45 | export type HandlerReqCtx = { 46 | auth: HA 47 | params: QueryParams 48 | input: HandlerInput 49 | req: express.Request 50 | res: express.Response 51 | } 52 | export type Handler = ( 53 | ctx: HandlerReqCtx, 54 | ) => Promise | HandlerOutput 55 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/putRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** The handle or DID of the repo. */ 15 | repo: string 16 | /** The NSID of the record collection. */ 17 | collection: string 18 | /** The key of the record. */ 19 | rkey: string 20 | /** Validate the record? */ 21 | validate: boolean 22 | /** The record to write. */ 23 | record: {} 24 | /** Compare and swap with the previous record by cid. */ 25 | swapRecord?: string | null 26 | /** Compare and swap with the previous commit by cid. */ 27 | swapCommit?: string 28 | [k: string]: unknown 29 | } 30 | 31 | export interface OutputSchema { 32 | uri: string 33 | cid: string 34 | [k: string]: unknown 35 | } 36 | 37 | export interface HandlerInput { 38 | encoding: 'application/json' 39 | body: InputSchema 40 | } 41 | 42 | export interface HandlerSuccess { 43 | encoding: 'application/json' 44 | body: OutputSchema 45 | headers?: { [key: string]: string } 46 | } 47 | 48 | export interface HandlerError { 49 | status: number 50 | message?: string 51 | error?: 'InvalidSwap' 52 | } 53 | 54 | export type HandlerOutput = HandlerError | HandlerSuccess 55 | export type HandlerReqCtx = { 56 | auth: HA 57 | params: QueryParams 58 | input: HandlerInput 59 | req: express.Request 60 | res: express.Response 61 | } 62 | export type Handler = ( 63 | ctx: HandlerReqCtx, 64 | ) => Promise | HandlerOutput 65 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/rebaseRepo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** The handle or DID of the repo. */ 15 | repo: string 16 | /** Compare and swap with the previous commit by cid. */ 17 | swapCommit?: string 18 | [k: string]: unknown 19 | } 20 | 21 | export interface HandlerInput { 22 | encoding: 'application/json' 23 | body: InputSchema 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | error?: 'InvalidSwap' | 'ConcurrentWrites' 30 | } 31 | 32 | export type HandlerOutput = HandlerError | void 33 | export type Handler = (ctx: { 34 | auth: HA 35 | params: QueryParams 36 | input: HandlerInput 37 | req: express.Request 38 | res: express.Response 39 | }) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/strongRef.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface Main { 10 | uri: string 11 | cid: string 12 | [k: string]: unknown 13 | } 14 | 15 | export function isMain(v: unknown): v is Main { 16 | return ( 17 | isObj(v) && 18 | hasProp(v, '$type') && 19 | (v.$type === 'com.atproto.repo.strongRef#main' || 20 | v.$type === 'com.atproto.repo.strongRef') 21 | ) 22 | } 23 | 24 | export function validateMain(v: unknown): ValidationResult { 25 | return lexicons.validate('com.atproto.repo.strongRef#main', v) 26 | } 27 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/repo/uploadBlob.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import stream from 'stream' 6 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 7 | import { lexicons } from '../../../../lexicons' 8 | import { isObj, hasProp } from '../../../../util' 9 | import { CID } from 'multiformats/cid' 10 | import { HandlerAuth } from '@atproto/xrpc-server' 11 | 12 | export interface QueryParams {} 13 | 14 | export type InputSchema = string | Uint8Array 15 | 16 | export interface OutputSchema { 17 | blob: BlobRef 18 | [k: string]: unknown 19 | } 20 | 21 | export interface HandlerInput { 22 | encoding: '*/*' 23 | body: stream.Readable 24 | } 25 | 26 | export interface HandlerSuccess { 27 | encoding: 'application/json' 28 | body: OutputSchema 29 | headers?: { [key: string]: string } 30 | } 31 | 32 | export interface HandlerError { 33 | status: number 34 | message?: string 35 | } 36 | 37 | export type HandlerOutput = HandlerError | HandlerSuccess 38 | export type HandlerReqCtx = { 39 | auth: HA 40 | params: QueryParams 41 | input: HandlerInput 42 | req: express.Request 43 | res: express.Response 44 | } 45 | export type Handler = ( 46 | ctx: HandlerReqCtx, 47 | ) => Promise | HandlerOutput 48 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/createAccount.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | email: string 15 | handle: string 16 | did?: string 17 | inviteCode?: string 18 | password: string 19 | recoveryKey?: string 20 | [k: string]: unknown 21 | } 22 | 23 | export interface OutputSchema { 24 | accessJwt: string 25 | refreshJwt: string 26 | handle: string 27 | did: string 28 | [k: string]: unknown 29 | } 30 | 31 | export interface HandlerInput { 32 | encoding: 'application/json' 33 | body: InputSchema 34 | } 35 | 36 | export interface HandlerSuccess { 37 | encoding: 'application/json' 38 | body: OutputSchema 39 | headers?: { [key: string]: string } 40 | } 41 | 42 | export interface HandlerError { 43 | status: number 44 | message?: string 45 | error?: 46 | | 'InvalidHandle' 47 | | 'InvalidPassword' 48 | | 'InvalidInviteCode' 49 | | 'HandleNotAvailable' 50 | | 'UnsupportedDomain' 51 | | 'UnresolvableDid' 52 | | 'IncompatibleDidDoc' 53 | } 54 | 55 | export type HandlerOutput = HandlerError | HandlerSuccess 56 | export type HandlerReqCtx = { 57 | auth: HA 58 | params: QueryParams 59 | input: HandlerInput 60 | req: express.Request 61 | res: express.Response 62 | } 63 | export type Handler = ( 64 | ctx: HandlerReqCtx, 65 | ) => Promise | HandlerOutput 66 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/createAppPassword.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | name: string 15 | [k: string]: unknown 16 | } 17 | 18 | export type OutputSchema = AppPassword 19 | 20 | export interface HandlerInput { 21 | encoding: 'application/json' 22 | body: InputSchema 23 | } 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | error?: 'AccountTakedown' 35 | } 36 | 37 | export type HandlerOutput = HandlerError | HandlerSuccess 38 | export type HandlerReqCtx = { 39 | auth: HA 40 | params: QueryParams 41 | input: HandlerInput 42 | req: express.Request 43 | res: express.Response 44 | } 45 | export type Handler = ( 46 | ctx: HandlerReqCtx, 47 | ) => Promise | HandlerOutput 48 | 49 | export interface AppPassword { 50 | name: string 51 | password: string 52 | createdAt: string 53 | [k: string]: unknown 54 | } 55 | 56 | export function isAppPassword(v: unknown): v is AppPassword { 57 | return ( 58 | isObj(v) && 59 | hasProp(v, '$type') && 60 | v.$type === 'com.atproto.server.createAppPassword#appPassword' 61 | ) 62 | } 63 | 64 | export function validateAppPassword(v: unknown): ValidationResult { 65 | return lexicons.validate( 66 | 'com.atproto.server.createAppPassword#appPassword', 67 | v, 68 | ) 69 | } 70 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/createInviteCode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | useCount: number 15 | forAccount?: string 16 | [k: string]: unknown 17 | } 18 | 19 | export interface OutputSchema { 20 | code: string 21 | [k: string]: unknown 22 | } 23 | 24 | export interface HandlerInput { 25 | encoding: 'application/json' 26 | body: InputSchema 27 | } 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type HandlerReqCtx = { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | } 48 | export type Handler = ( 49 | ctx: HandlerReqCtx, 50 | ) => Promise | HandlerOutput 51 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/createInviteCodes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | codeCount: number 15 | useCount: number 16 | forAccounts?: string[] 17 | [k: string]: unknown 18 | } 19 | 20 | export interface OutputSchema { 21 | codes: AccountCodes[] 22 | [k: string]: unknown 23 | } 24 | 25 | export interface HandlerInput { 26 | encoding: 'application/json' 27 | body: InputSchema 28 | } 29 | 30 | export interface HandlerSuccess { 31 | encoding: 'application/json' 32 | body: OutputSchema 33 | headers?: { [key: string]: string } 34 | } 35 | 36 | export interface HandlerError { 37 | status: number 38 | message?: string 39 | } 40 | 41 | export type HandlerOutput = HandlerError | HandlerSuccess 42 | export type HandlerReqCtx = { 43 | auth: HA 44 | params: QueryParams 45 | input: HandlerInput 46 | req: express.Request 47 | res: express.Response 48 | } 49 | export type Handler = ( 50 | ctx: HandlerReqCtx, 51 | ) => Promise | HandlerOutput 52 | 53 | export interface AccountCodes { 54 | account: string 55 | codes: string[] 56 | [k: string]: unknown 57 | } 58 | 59 | export function isAccountCodes(v: unknown): v is AccountCodes { 60 | return ( 61 | isObj(v) && 62 | hasProp(v, '$type') && 63 | v.$type === 'com.atproto.server.createInviteCodes#accountCodes' 64 | ) 65 | } 66 | 67 | export function validateAccountCodes(v: unknown): ValidationResult { 68 | return lexicons.validate( 69 | 'com.atproto.server.createInviteCodes#accountCodes', 70 | v, 71 | ) 72 | } 73 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/createSession.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** Handle or other identifier supported by the server for the authenticating user. */ 15 | identifier: string 16 | password: string 17 | [k: string]: unknown 18 | } 19 | 20 | export interface OutputSchema { 21 | accessJwt: string 22 | refreshJwt: string 23 | handle: string 24 | did: string 25 | email?: string 26 | [k: string]: unknown 27 | } 28 | 29 | export interface HandlerInput { 30 | encoding: 'application/json' 31 | body: InputSchema 32 | } 33 | 34 | export interface HandlerSuccess { 35 | encoding: 'application/json' 36 | body: OutputSchema 37 | headers?: { [key: string]: string } 38 | } 39 | 40 | export interface HandlerError { 41 | status: number 42 | message?: string 43 | error?: 'AccountTakedown' 44 | } 45 | 46 | export type HandlerOutput = HandlerError | HandlerSuccess 47 | export type HandlerReqCtx = { 48 | auth: HA 49 | params: QueryParams 50 | input: HandlerInput 51 | req: express.Request 52 | res: express.Response 53 | } 54 | export type Handler = ( 55 | ctx: HandlerReqCtx, 56 | ) => Promise | HandlerOutput 57 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/defs.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 5 | import { lexicons } from '../../../../lexicons' 6 | import { isObj, hasProp } from '../../../../util' 7 | import { CID } from 'multiformats/cid' 8 | 9 | export interface InviteCode { 10 | code: string 11 | available: number 12 | disabled: boolean 13 | forAccount: string 14 | createdBy: string 15 | createdAt: string 16 | uses: InviteCodeUse[] 17 | [k: string]: unknown 18 | } 19 | 20 | export function isInviteCode(v: unknown): v is InviteCode { 21 | return ( 22 | isObj(v) && 23 | hasProp(v, '$type') && 24 | v.$type === 'com.atproto.server.defs#inviteCode' 25 | ) 26 | } 27 | 28 | export function validateInviteCode(v: unknown): ValidationResult { 29 | return lexicons.validate('com.atproto.server.defs#inviteCode', v) 30 | } 31 | 32 | export interface InviteCodeUse { 33 | usedBy: string 34 | usedAt: string 35 | [k: string]: unknown 36 | } 37 | 38 | export function isInviteCodeUse(v: unknown): v is InviteCodeUse { 39 | return ( 40 | isObj(v) && 41 | hasProp(v, '$type') && 42 | v.$type === 'com.atproto.server.defs#inviteCodeUse' 43 | ) 44 | } 45 | 46 | export function validateInviteCodeUse(v: unknown): ValidationResult { 47 | return lexicons.validate('com.atproto.server.defs#inviteCodeUse', v) 48 | } 49 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/deleteAccount.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | did: string 15 | password: string 16 | token: string 17 | [k: string]: unknown 18 | } 19 | 20 | export interface HandlerInput { 21 | encoding: 'application/json' 22 | body: InputSchema 23 | } 24 | 25 | export interface HandlerError { 26 | status: number 27 | message?: string 28 | error?: 'ExpiredToken' | 'InvalidToken' 29 | } 30 | 31 | export type HandlerOutput = HandlerError | void 32 | export type HandlerReqCtx = { 33 | auth: HA 34 | params: QueryParams 35 | input: HandlerInput 36 | req: express.Request 37 | res: express.Response 38 | } 39 | export type Handler = ( 40 | ctx: HandlerReqCtx, 41 | ) => Promise | HandlerOutput 42 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/deleteSession.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | export type HandlerInput = undefined 15 | 16 | export interface HandlerError { 17 | status: number 18 | message?: string 19 | } 20 | 21 | export type HandlerOutput = HandlerError | void 22 | export type HandlerReqCtx = { 23 | auth: HA 24 | params: QueryParams 25 | input: HandlerInput 26 | req: express.Request 27 | res: express.Response 28 | } 29 | export type Handler = ( 30 | ctx: HandlerReqCtx, 31 | ) => Promise | HandlerOutput 32 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/describeServer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | 15 | export interface OutputSchema { 16 | inviteCodeRequired?: boolean 17 | availableUserDomains: string[] 18 | links?: Links 19 | [k: string]: unknown 20 | } 21 | 22 | export type HandlerInput = undefined 23 | 24 | export interface HandlerSuccess { 25 | encoding: 'application/json' 26 | body: OutputSchema 27 | headers?: { [key: string]: string } 28 | } 29 | 30 | export interface HandlerError { 31 | status: number 32 | message?: string 33 | } 34 | 35 | export type HandlerOutput = HandlerError | HandlerSuccess 36 | export type HandlerReqCtx = { 37 | auth: HA 38 | params: QueryParams 39 | input: HandlerInput 40 | req: express.Request 41 | res: express.Response 42 | } 43 | export type Handler = ( 44 | ctx: HandlerReqCtx, 45 | ) => Promise | HandlerOutput 46 | 47 | export interface Links { 48 | privacyPolicy?: string 49 | termsOfService?: string 50 | [k: string]: unknown 51 | } 52 | 53 | export function isLinks(v: unknown): v is Links { 54 | return ( 55 | isObj(v) && 56 | hasProp(v, '$type') && 57 | v.$type === 'com.atproto.server.describeServer#links' 58 | ) 59 | } 60 | 61 | export function validateLinks(v: unknown): ValidationResult { 62 | return lexicons.validate('com.atproto.server.describeServer#links', v) 63 | } 64 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/getAccountInviteCodes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | import * as ComAtprotoServerDefs from './defs' 11 | 12 | export interface QueryParams { 13 | includeUsed: boolean 14 | createAvailable: boolean 15 | } 16 | 17 | export type InputSchema = undefined 18 | 19 | export interface OutputSchema { 20 | codes: ComAtprotoServerDefs.InviteCode[] 21 | [k: string]: unknown 22 | } 23 | 24 | export type HandlerInput = undefined 25 | 26 | export interface HandlerSuccess { 27 | encoding: 'application/json' 28 | body: OutputSchema 29 | headers?: { [key: string]: string } 30 | } 31 | 32 | export interface HandlerError { 33 | status: number 34 | message?: string 35 | error?: 'DuplicateCreate' 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/getSession.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | 15 | export interface OutputSchema { 16 | handle: string 17 | did: string 18 | email?: string 19 | [k: string]: unknown 20 | } 21 | 22 | export type HandlerInput = undefined 23 | 24 | export interface HandlerSuccess { 25 | encoding: 'application/json' 26 | body: OutputSchema 27 | headers?: { [key: string]: string } 28 | } 29 | 30 | export interface HandlerError { 31 | status: number 32 | message?: string 33 | } 34 | 35 | export type HandlerOutput = HandlerError | HandlerSuccess 36 | export type HandlerReqCtx = { 37 | auth: HA 38 | params: QueryParams 39 | input: HandlerInput 40 | req: express.Request 41 | res: express.Response 42 | } 43 | export type Handler = ( 44 | ctx: HandlerReqCtx, 45 | ) => Promise | HandlerOutput 46 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/listAppPasswords.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | 15 | export interface OutputSchema { 16 | passwords: AppPassword[] 17 | [k: string]: unknown 18 | } 19 | 20 | export type HandlerInput = undefined 21 | 22 | export interface HandlerSuccess { 23 | encoding: 'application/json' 24 | body: OutputSchema 25 | headers?: { [key: string]: string } 26 | } 27 | 28 | export interface HandlerError { 29 | status: number 30 | message?: string 31 | error?: 'AccountTakedown' 32 | } 33 | 34 | export type HandlerOutput = HandlerError | HandlerSuccess 35 | export type HandlerReqCtx = { 36 | auth: HA 37 | params: QueryParams 38 | input: HandlerInput 39 | req: express.Request 40 | res: express.Response 41 | } 42 | export type Handler = ( 43 | ctx: HandlerReqCtx, 44 | ) => Promise | HandlerOutput 45 | 46 | export interface AppPassword { 47 | name: string 48 | createdAt: string 49 | [k: string]: unknown 50 | } 51 | 52 | export function isAppPassword(v: unknown): v is AppPassword { 53 | return ( 54 | isObj(v) && 55 | hasProp(v, '$type') && 56 | v.$type === 'com.atproto.server.listAppPasswords#appPassword' 57 | ) 58 | } 59 | 60 | export function validateAppPassword(v: unknown): ValidationResult { 61 | return lexicons.validate('com.atproto.server.listAppPasswords#appPassword', v) 62 | } 63 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/refreshSession.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | 15 | export interface OutputSchema { 16 | accessJwt: string 17 | refreshJwt: string 18 | handle: string 19 | did: string 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | error?: 'AccountTakedown' 35 | } 36 | 37 | export type HandlerOutput = HandlerError | HandlerSuccess 38 | export type HandlerReqCtx = { 39 | auth: HA 40 | params: QueryParams 41 | input: HandlerInput 42 | req: express.Request 43 | res: express.Response 44 | } 45 | export type Handler = ( 46 | ctx: HandlerReqCtx, 47 | ) => Promise | HandlerOutput 48 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/requestAccountDelete.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export type InputSchema = undefined 14 | export type HandlerInput = undefined 15 | 16 | export interface HandlerError { 17 | status: number 18 | message?: string 19 | } 20 | 21 | export type HandlerOutput = HandlerError | void 22 | export type HandlerReqCtx = { 23 | auth: HA 24 | params: QueryParams 25 | input: HandlerInput 26 | req: express.Request 27 | res: express.Response 28 | } 29 | export type Handler = ( 30 | ctx: HandlerReqCtx, 31 | ) => Promise | HandlerOutput 32 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/requestPasswordReset.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | email: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/resetPassword.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | token: string 15 | password: string 16 | [k: string]: unknown 17 | } 18 | 19 | export interface HandlerInput { 20 | encoding: 'application/json' 21 | body: InputSchema 22 | } 23 | 24 | export interface HandlerError { 25 | status: number 26 | message?: string 27 | error?: 'ExpiredToken' | 'InvalidToken' 28 | } 29 | 30 | export type HandlerOutput = HandlerError | void 31 | export type HandlerReqCtx = { 32 | auth: HA 33 | params: QueryParams 34 | input: HandlerInput 35 | req: express.Request 36 | res: express.Response 37 | } 38 | export type Handler = ( 39 | ctx: HandlerReqCtx, 40 | ) => Promise | HandlerOutput 41 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/server/revokeAppPassword.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | name: string 15 | [k: string]: unknown 16 | } 17 | 18 | export interface HandlerInput { 19 | encoding: 'application/json' 20 | body: InputSchema 21 | } 22 | 23 | export interface HandlerError { 24 | status: number 25 | message?: string 26 | } 27 | 28 | export type HandlerOutput = HandlerError | void 29 | export type HandlerReqCtx = { 30 | auth: HA 31 | params: QueryParams 32 | input: HandlerInput 33 | req: express.Request 34 | res: express.Response 35 | } 36 | export type Handler = ( 37 | ctx: HandlerReqCtx, 38 | ) => Promise | HandlerOutput 39 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getBlob.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import stream from 'stream' 6 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 7 | import { lexicons } from '../../../../lexicons' 8 | import { isObj, hasProp } from '../../../../util' 9 | import { CID } from 'multiformats/cid' 10 | import { HandlerAuth } from '@atproto/xrpc-server' 11 | 12 | export interface QueryParams { 13 | /** The DID of the repo. */ 14 | did: string 15 | /** The CID of the blob to fetch */ 16 | cid: string 17 | } 18 | 19 | export type InputSchema = undefined 20 | export type HandlerInput = undefined 21 | 22 | export interface HandlerSuccess { 23 | encoding: '*/*' 24 | body: Uint8Array | stream.Readable 25 | headers?: { [key: string]: string } 26 | } 27 | 28 | export interface HandlerError { 29 | status: number 30 | message?: string 31 | } 32 | 33 | export type HandlerOutput = HandlerError | HandlerSuccess 34 | export type HandlerReqCtx = { 35 | auth: HA 36 | params: QueryParams 37 | input: HandlerInput 38 | req: express.Request 39 | res: express.Response 40 | } 41 | export type Handler = ( 42 | ctx: HandlerReqCtx, 43 | ) => Promise | HandlerOutput 44 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getBlocks.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import stream from 'stream' 6 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 7 | import { lexicons } from '../../../../lexicons' 8 | import { isObj, hasProp } from '../../../../util' 9 | import { CID } from 'multiformats/cid' 10 | import { HandlerAuth } from '@atproto/xrpc-server' 11 | 12 | export interface QueryParams { 13 | /** The DID of the repo. */ 14 | did: string 15 | cids: string[] 16 | } 17 | 18 | export type InputSchema = undefined 19 | export type HandlerInput = undefined 20 | 21 | export interface HandlerSuccess { 22 | encoding: 'application/vnd.ipld.car' 23 | body: Uint8Array | stream.Readable 24 | headers?: { [key: string]: string } 25 | } 26 | 27 | export interface HandlerError { 28 | status: number 29 | message?: string 30 | } 31 | 32 | export type HandlerOutput = HandlerError | HandlerSuccess 33 | export type HandlerReqCtx = { 34 | auth: HA 35 | params: QueryParams 36 | input: HandlerInput 37 | req: express.Request 38 | res: express.Response 39 | } 40 | export type Handler = ( 41 | ctx: HandlerReqCtx, 42 | ) => Promise | HandlerOutput 43 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getCheckout.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import stream from 'stream' 6 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 7 | import { lexicons } from '../../../../lexicons' 8 | import { isObj, hasProp } from '../../../../util' 9 | import { CID } from 'multiformats/cid' 10 | import { HandlerAuth } from '@atproto/xrpc-server' 11 | 12 | export interface QueryParams { 13 | /** The DID of the repo. */ 14 | did: string 15 | } 16 | 17 | export type InputSchema = undefined 18 | export type HandlerInput = undefined 19 | 20 | export interface HandlerSuccess { 21 | encoding: 'application/vnd.ipld.car' 22 | body: Uint8Array | stream.Readable 23 | headers?: { [key: string]: string } 24 | } 25 | 26 | export interface HandlerError { 27 | status: number 28 | message?: string 29 | } 30 | 31 | export type HandlerOutput = HandlerError | HandlerSuccess 32 | export type HandlerReqCtx = { 33 | auth: HA 34 | params: QueryParams 35 | input: HandlerInput 36 | req: express.Request 37 | res: express.Response 38 | } 39 | export type Handler = ( 40 | ctx: HandlerReqCtx, 41 | ) => Promise | HandlerOutput 42 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getCommitPath.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The DID of the repo. */ 13 | did: string 14 | /** The most recent commit */ 15 | latest?: string 16 | /** The earliest commit to start from */ 17 | earliest?: string 18 | } 19 | 20 | export type InputSchema = undefined 21 | 22 | export interface OutputSchema { 23 | commits: string[] 24 | [k: string]: unknown 25 | } 26 | 27 | export type HandlerInput = undefined 28 | 29 | export interface HandlerSuccess { 30 | encoding: 'application/json' 31 | body: OutputSchema 32 | headers?: { [key: string]: string } 33 | } 34 | 35 | export interface HandlerError { 36 | status: number 37 | message?: string 38 | } 39 | 40 | export type HandlerOutput = HandlerError | HandlerSuccess 41 | export type Handler = (ctx: { 42 | auth: HA 43 | params: QueryParams 44 | input: HandlerInput 45 | req: express.Request 46 | res: express.Response 47 | }) => Promise | HandlerOutput 48 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getHead.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The DID of the repo. */ 13 | did: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | root: string 20 | [k: string]: unknown 21 | } 22 | 23 | export type HandlerInput = undefined 24 | 25 | export interface HandlerSuccess { 26 | encoding: 'application/json' 27 | body: OutputSchema 28 | headers?: { [key: string]: string } 29 | } 30 | 31 | export interface HandlerError { 32 | status: number 33 | message?: string 34 | error?: 'HeadNotFound' 35 | } 36 | 37 | export type HandlerOutput = HandlerError | HandlerSuccess 38 | export type HandlerReqCtx = { 39 | auth: HA 40 | params: QueryParams 41 | input: HandlerInput 42 | req: express.Request 43 | res: express.Response 44 | } 45 | export type Handler = ( 46 | ctx: HandlerReqCtx, 47 | ) => Promise | HandlerOutput 48 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getLatestCommit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The DID of the repo. */ 13 | did: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | cid: string 20 | rev: string 21 | [k: string]: unknown 22 | } 23 | 24 | export type HandlerInput = undefined 25 | 26 | export interface HandlerSuccess { 27 | encoding: 'application/json' 28 | body: OutputSchema 29 | headers?: { [key: string]: string } 30 | } 31 | 32 | export interface HandlerError { 33 | status: number 34 | message?: string 35 | error?: 'RepoNotFound' 36 | } 37 | 38 | export type HandlerOutput = HandlerError | HandlerSuccess 39 | export type HandlerReqCtx = { 40 | auth: HA 41 | params: QueryParams 42 | input: HandlerInput 43 | req: express.Request 44 | res: express.Response 45 | } 46 | export type Handler = ( 47 | ctx: HandlerReqCtx, 48 | ) => Promise | HandlerOutput 49 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import stream from 'stream' 6 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 7 | import { lexicons } from '../../../../lexicons' 8 | import { isObj, hasProp } from '../../../../util' 9 | import { CID } from 'multiformats/cid' 10 | import { HandlerAuth } from '@atproto/xrpc-server' 11 | 12 | export interface QueryParams { 13 | /** The DID of the repo. */ 14 | did: string 15 | collection: string 16 | rkey: string 17 | /** An optional past commit CID. */ 18 | commit?: string 19 | } 20 | 21 | export type InputSchema = undefined 22 | export type HandlerInput = undefined 23 | 24 | export interface HandlerSuccess { 25 | encoding: 'application/vnd.ipld.car' 26 | body: Uint8Array | stream.Readable 27 | headers?: { [key: string]: string } 28 | } 29 | 30 | export interface HandlerError { 31 | status: number 32 | message?: string 33 | } 34 | 35 | export type HandlerOutput = HandlerError | HandlerSuccess 36 | export type HandlerReqCtx = { 37 | auth: HA 38 | params: QueryParams 39 | input: HandlerInput 40 | req: express.Request 41 | res: express.Response 42 | } 43 | export type Handler = ( 44 | ctx: HandlerReqCtx, 45 | ) => Promise | HandlerOutput 46 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/getRepo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import stream from 'stream' 6 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 7 | import { lexicons } from '../../../../lexicons' 8 | import { isObj, hasProp } from '../../../../util' 9 | import { CID } from 'multiformats/cid' 10 | import { HandlerAuth } from '@atproto/xrpc-server' 11 | 12 | export interface QueryParams { 13 | /** The DID of the repo. */ 14 | did: string 15 | /** The revision of the repo to catch up from. */ 16 | since?: string 17 | } 18 | 19 | export type InputSchema = undefined 20 | export type HandlerInput = undefined 21 | 22 | export interface HandlerSuccess { 23 | encoding: 'application/vnd.ipld.car' 24 | body: Uint8Array | stream.Readable 25 | headers?: { [key: string]: string } 26 | } 27 | 28 | export interface HandlerError { 29 | status: number 30 | message?: string 31 | } 32 | 33 | export type HandlerOutput = HandlerError | HandlerSuccess 34 | export type HandlerReqCtx = { 35 | auth: HA 36 | params: QueryParams 37 | input: HandlerInput 38 | req: express.Request 39 | res: express.Response 40 | } 41 | export type Handler = ( 42 | ctx: HandlerReqCtx, 43 | ) => Promise | HandlerOutput 44 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/listBlobs.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | /** The DID of the repo. */ 13 | did: string 14 | /** Optional revision of the repo to list blobs since */ 15 | since?: string 16 | limit: number 17 | cursor?: string 18 | } 19 | 20 | export type InputSchema = undefined 21 | 22 | export interface OutputSchema { 23 | cursor?: string 24 | cids: string[] 25 | [k: string]: unknown 26 | } 27 | 28 | export type HandlerInput = undefined 29 | 30 | export interface HandlerSuccess { 31 | encoding: 'application/json' 32 | body: OutputSchema 33 | headers?: { [key: string]: string } 34 | } 35 | 36 | export interface HandlerError { 37 | status: number 38 | message?: string 39 | } 40 | 41 | export type HandlerOutput = HandlerError | HandlerSuccess 42 | export type HandlerReqCtx = { 43 | auth: HA 44 | params: QueryParams 45 | input: HandlerInput 46 | req: express.Request 47 | res: express.Response 48 | } 49 | export type Handler = ( 50 | ctx: HandlerReqCtx, 51 | ) => Promise | HandlerOutput 52 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/listRepos.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams { 12 | limit: number 13 | cursor?: string 14 | } 15 | 16 | export type InputSchema = undefined 17 | 18 | export interface OutputSchema { 19 | cursor?: string 20 | repos: Repo[] 21 | [k: string]: unknown 22 | } 23 | 24 | export type HandlerInput = undefined 25 | 26 | export interface HandlerSuccess { 27 | encoding: 'application/json' 28 | body: OutputSchema 29 | headers?: { [key: string]: string } 30 | } 31 | 32 | export interface HandlerError { 33 | status: number 34 | message?: string 35 | } 36 | 37 | export type HandlerOutput = HandlerError | HandlerSuccess 38 | export type HandlerReqCtx = { 39 | auth: HA 40 | params: QueryParams 41 | input: HandlerInput 42 | req: express.Request 43 | res: express.Response 44 | } 45 | export type Handler = ( 46 | ctx: HandlerReqCtx, 47 | ) => Promise | HandlerOutput 48 | 49 | export interface Repo { 50 | did: string 51 | head: string 52 | [k: string]: unknown 53 | } 54 | 55 | export function isRepo(v: unknown): v is Repo { 56 | return ( 57 | isObj(v) && 58 | hasProp(v, '$type') && 59 | v.$type === 'com.atproto.sync.listRepos#repo' 60 | ) 61 | } 62 | 63 | export function validateRepo(v: unknown): ValidationResult { 64 | return lexicons.validate('com.atproto.sync.listRepos#repo', v) 65 | } 66 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/notifyOfUpdate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** Hostname of the service that is notifying of update. */ 15 | hostname: string 16 | [k: string]: unknown 17 | } 18 | 19 | export interface HandlerInput { 20 | encoding: 'application/json' 21 | body: InputSchema 22 | } 23 | 24 | export interface HandlerError { 25 | status: number 26 | message?: string 27 | } 28 | 29 | export type HandlerOutput = HandlerError | void 30 | export type HandlerReqCtx = { 31 | auth: HA 32 | params: QueryParams 33 | input: HandlerInput 34 | req: express.Request 35 | res: express.Response 36 | } 37 | export type Handler = ( 38 | ctx: HandlerReqCtx, 39 | ) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/types/com/atproto/sync/requestCrawl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | import express from 'express' 5 | import { ValidationResult, BlobRef } from '@atproto/lexicon' 6 | import { lexicons } from '../../../../lexicons' 7 | import { isObj, hasProp } from '../../../../util' 8 | import { CID } from 'multiformats/cid' 9 | import { HandlerAuth } from '@atproto/xrpc-server' 10 | 11 | export interface QueryParams {} 12 | 13 | export interface InputSchema { 14 | /** Hostname of the service that is requesting to be crawled. */ 15 | hostname: string 16 | [k: string]: unknown 17 | } 18 | 19 | export interface HandlerInput { 20 | encoding: 'application/json' 21 | body: InputSchema 22 | } 23 | 24 | export interface HandlerError { 25 | status: number 26 | message?: string 27 | } 28 | 29 | export type HandlerOutput = HandlerError | void 30 | export type HandlerReqCtx = { 31 | auth: HA 32 | params: QueryParams 33 | input: HandlerInput 34 | req: express.Request 35 | res: express.Response 36 | } 37 | export type Handler = ( 38 | ctx: HandlerReqCtx, 39 | ) => Promise | HandlerOutput 40 | -------------------------------------------------------------------------------- /src/lexicon/util.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * GENERATED CODE - DO NOT MODIFY 3 | */ 4 | export function isObj(v: unknown): v is Record { 5 | return typeof v === 'object' && v !== null 6 | } 7 | 8 | export function hasProp( 9 | data: object, 10 | prop: K, 11 | ): data is Record { 12 | return prop in data 13 | } 14 | -------------------------------------------------------------------------------- /src/methods/describe-generator.ts: -------------------------------------------------------------------------------- 1 | import { Server } from '../lexicon' 2 | import { AppContext } from '../config' 3 | import algos from '../algos' 4 | import { AtUri } from '@atproto/syntax' 5 | 6 | export default function (server: Server, ctx: AppContext) { 7 | server.app.bsky.feed.describeFeedGenerator(async () => { 8 | const feeds = Object.keys(algos).map((shortname) => ({ 9 | uri: AtUri.make( 10 | ctx.cfg.publisherDid, 11 | 'app.bsky.feed.generator', 12 | shortname, 13 | ).toString(), 14 | })) 15 | return { 16 | encoding: 'application/json', 17 | body: { 18 | did: ctx.cfg.serviceDid, 19 | feeds, 20 | }, 21 | } 22 | }) 23 | } 24 | -------------------------------------------------------------------------------- /src/methods/feed-generation.ts: -------------------------------------------------------------------------------- 1 | import { InvalidRequestError } from '@atproto/xrpc-server' 2 | import { Server } from '../lexicon' 3 | import { AppContext } from '../config' 4 | import algos from '../algos' 5 | import { AtUri } from '@atproto/syntax' 6 | import { OutputSchema as AlgoOutput } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' 7 | 8 | const algoCache = new Map() 9 | 10 | export default function (server: Server, ctx: AppContext) { 11 | server.app.bsky.feed.getFeedSkeleton(async ({ params, req, res }) => { 12 | const feedUri = new AtUri(params.feed) 13 | const algo = algos[feedUri.rkey].handler 14 | if ( 15 | //feedUri.hostname !== ctx.cfg.publisherDid || 16 | feedUri.collection !== 'app.bsky.feed.generator' || 17 | !algo 18 | ) { 19 | throw new InvalidRequestError( 20 | 'Unsupported algorithm', 21 | 'UnsupportedAlgorithm', 22 | ) 23 | } 24 | 25 | const cacheAge = algos[feedUri.rkey].manager.cacheAge(params) 26 | if (cacheAge.valueOf() > 0) { 27 | res.setHeader('Cache-Control', `public, max-age=${cacheAge}`) 28 | } else { 29 | res.setHeader('Cache-Control', `no-cache`) 30 | } 31 | 32 | /** 33 | * Example of how to check auth if giving user-specific results: 34 | * 35 | * const requesterDid = await validateAuth( 36 | * req, 37 | * ctx.cfg.serviceDid, 38 | * ctx.didResolver, 39 | * ) 40 | */ 41 | 42 | let body: AlgoOutput | undefined = undefined 43 | 44 | const cacheKey = JSON.stringify(params) 45 | 46 | if (algoCache.has(cacheKey)) { 47 | const cached = algoCache.get(cacheKey)! 48 | if (cached.date > Date.now() - 1000 * cacheAge.valueOf()) { 49 | body = cached.output 50 | } else { 51 | algoCache.delete(cacheKey) 52 | } 53 | } 54 | 55 | if (body === undefined) { 56 | body = await algo(ctx, params) 57 | algoCache.set(cacheKey, { date: Date.now(), output: body }) 58 | } 59 | if (body.feed.length < params.limit) body.cursor = undefined 60 | 61 | return { 62 | encoding: 'application/json', 63 | body: body, 64 | } 65 | }) 66 | } 67 | -------------------------------------------------------------------------------- /src/server.ts: -------------------------------------------------------------------------------- 1 | import http from 'http' 2 | import events from 'events' 3 | import express from 'express' 4 | import { DidResolver, MemoryCache } from '@atproto/identity' 5 | import { createServer } from './lexicon' 6 | import feedGeneration from './methods/feed-generation' 7 | import describeGenerator from './methods/describe-generator' 8 | import dbClient from './db/dbClient' 9 | import { FirehoseSubscription } from './subscription' 10 | import { AppContext, Config } from './config' 11 | import wellKnown from './well-known' 12 | 13 | export class FeedGenerator { 14 | public app: express.Application 15 | public server?: http.Server 16 | public firehose: FirehoseSubscription 17 | public cfg: Config 18 | 19 | constructor( 20 | app: express.Application, 21 | firehose: FirehoseSubscription, 22 | cfg: Config, 23 | ) { 24 | this.app = app 25 | this.firehose = firehose 26 | this.cfg = cfg 27 | } 28 | 29 | static create(cfg: Config) { 30 | const app = express() 31 | const db = dbClient 32 | const firehose = new FirehoseSubscription(db, cfg.subscriptionEndpoint) 33 | 34 | const didCache = new MemoryCache() 35 | const didResolver = new DidResolver({ 36 | plcUrl: 'https://plc.directory', 37 | didCache, 38 | }) 39 | 40 | const server = createServer({ 41 | validateResponse: true, 42 | payload: { 43 | jsonLimit: 100 * 1024, // 100kb 44 | textLimit: 100 * 1024, // 100kb 45 | blobLimit: 5 * 1024 * 1024, // 5mb 46 | }, 47 | }) 48 | const ctx: AppContext = { 49 | db, 50 | didResolver, 51 | cfg, 52 | } 53 | feedGeneration(server, ctx) 54 | describeGenerator(server, ctx) 55 | app.use(server.xrpc.router) 56 | app.use(wellKnown(ctx)) 57 | 58 | return new FeedGenerator(app, firehose, cfg) 59 | } 60 | 61 | async start(): Promise { 62 | this.firehose.run(this.cfg.subscriptionReconnectDelay) 63 | this.server = this.app.listen(this.cfg.port, this.cfg.listenhost) 64 | await events.once(this.server, 'listening') 65 | return this.server 66 | } 67 | } 68 | 69 | export default FeedGenerator 70 | -------------------------------------------------------------------------------- /src/well-known.ts: -------------------------------------------------------------------------------- 1 | import express from 'express' 2 | import { AppContext } from './config' 3 | 4 | const makeRouter = (ctx: AppContext) => { 5 | const router = express.Router() 6 | 7 | router.get('/.well-known/did.json', (_req, res) => { 8 | if (!ctx.cfg.serviceDid.endsWith(ctx.cfg.hostname)) { 9 | return res.sendStatus(404) 10 | } 11 | res.json({ 12 | '@context': ['https://www.w3.org/ns/did/v1'], 13 | id: ctx.cfg.serviceDid, 14 | service: [ 15 | { 16 | id: '#bsky_fg', 17 | type: 'BskyFeedGenerator', 18 | serviceEndpoint: `https://${ctx.cfg.hostname}`, 19 | }, 20 | ], 21 | }) 22 | }) 23 | 24 | return router 25 | } 26 | export default makeRouter 27 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": [ 4 | "ES2022", 5 | ], 6 | "outDir": "./dist", 7 | "module": "ESNext", 8 | "target": "ESNext", 9 | "esModuleInterop": true, 10 | "moduleResolution": "Node", 11 | "alwaysStrict": true, 12 | "allowUnreachableCode": false, 13 | "strictNullChecks": true, 14 | "skipLibCheck": true 15 | }, 16 | "tsc-alias": { 17 | "resolveFullPaths": true, 18 | "verbose": false 19 | }, 20 | "include": ["./src/**/*.ts"], 21 | "exclude": [ 22 | "node_modules", "dist" 23 | ] 24 | } 25 | --------------------------------------------------------------------------------