From 6325e0a27f2017d6dab23cfa397edcdca558f02a Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 12:34:57 -0500 Subject: [PATCH 01/68] ignore lexicons dir and temp file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b947077..dcffbe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +atproto.tar.gz node_modules/ dist/ +lexicons/ From 7fc335cba2b2ed3829c7efbf2fd1d1acf2ce5591 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 12:35:03 -0500 Subject: [PATCH 02/68] adding ts support --- eslint.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index a5e888f..3f35c56 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import antfu from '@antfu/eslint-config'; export default antfu( { + typescript: true, stylistic: { semi: true, }, From 0e38ff932ded9419ccbe4a2654e03676e6ceb331 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 12:35:16 -0500 Subject: [PATCH 03/68] types generation packages --- package.json | 78 ++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 186037b..e12e165 100644 --- a/package.json +++ b/package.json @@ -1,36 +1,42 @@ -{ - "name": "tsky-workspace", - "type": "module", - "version": "0.1.0", - "packageManager": "pnpm@9.14.2", - "license": "MIT", - "homepage": "https://tsky.dev/", - "repository": { - "type": "git", - "url": "git+https://github.com/tsky-dev/tsky.git" - }, - "scripts": { - "build": "pnpm run --filter tsky build", - "docs:dev": "pnpm run --filter tsky-docs dev", - "docs:build": "pnpm run --filter tsky-docs build", - "docs:preview": "pnpm run --filter tsky-docs preview", - "format": "biome check --write .", - "format:check": "biome check", - "lint": "eslint ./packages ./docs", - "lint:fix": "eslint . --fix" - }, - "devDependencies": { - "@antfu/eslint-config": "^3.11.2", - "@biomejs/biome": "^1.9.4", - "@eslint/js": "^9.15.0", - "eslint": "^8.57.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", - "eslint-plugin-promise": "^6.0.0", - "nano-staged": "^0.8.0", - "typescript-eslint": "^8.16.0" - }, - "nano-staged": { - "*.{js,ts,cjs,mjs}": ["biome check --write --"] - } -} +{ + "name": "tsky-workspace", + "type": "module", + "version": "0.1.0", + "packageManager": "pnpm@9.14.2", + "license": "MIT", + "homepage": "https://tsky.dev/", + "repository": { + "type": "git", + "url": "git+https://github.com/tsky-dev/tsky.git" + }, + "scripts": { + "build": "pnpm run --filter tsky build", + "docs:dev": "pnpm run --filter tsky-docs dev", + "docs:build": "pnpm run --filter tsky-docs build", + "docs:preview": "pnpm run --filter tsky-docs preview", + "format": "biome check --write .", + "format:check": "biome check", + "lint": "eslint ./packages ./docs", + "lint:fix": "eslint . --fix" + }, + "devDependencies": { + "@antfu/eslint-config": "^3.11.2", + "@atproto/lex-cli": "^0.5.2", + "@biomejs/biome": "^1.9.4", + "@eslint/js": "^9.15.0", + "@types/node": "^22.10.1", + "eslint": "^8.57.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", + "eslint-plugin-promise": "^6.0.0", + "nano-staged": "^0.8.0", + "tar": "^7.4.3", + "tsx": "^4.19.2", + "typescript-eslint": "^8.16.0" + }, + "nano-staged": { + "*.{js,ts,cjs,mjs}": [ + "biome check --write --" + ] + } +} From 3d773d88310f4961578392550ef149de2b5ad57e Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 12:35:23 -0500 Subject: [PATCH 04/68] lock update --- pnpm-lock.yaml | 202 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 181 insertions(+), 21 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4e5af1c..da4ddc9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,13 +10,19 @@ importers: devDependencies: '@antfu/eslint-config': specifier: ^3.11.2 - version: 3.11.2(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(@vue/compiler-sfc@3.5.13)(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6) + version: 3.11.2(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(@vue/compiler-sfc@3.5.13)(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6(@types/node@22.10.1)) + '@atproto/lex-cli': + specifier: ^0.5.2 + version: 0.5.2 '@biomejs/biome': specifier: ^1.9.4 version: 1.9.4 '@eslint/js': specifier: ^9.15.0 version: 9.15.0 + '@types/node': + specifier: ^22.10.1 + version: 22.10.1 eslint: specifier: ^8.57.1 version: 8.57.1 @@ -32,6 +38,12 @@ importers: nano-staged: specifier: ^0.8.0 version: 0.8.0 + tar: + specifier: ^7.4.3 + version: 7.4.3 + tsx: + specifier: ^4.19.2 + version: 4.19.2 typescript-eslint: specifier: ^8.16.0 version: 8.16.0(eslint@8.57.1)(typescript@5.7.2) @@ -40,7 +52,7 @@ importers: devDependencies: vitepress: specifier: ^1.5.0 - version: 1.5.0(@algolia/client-search@5.15.0)(postcss@8.4.49)(search-insights@2.17.3)(typescript@5.7.2) + version: 1.5.0(@algolia/client-search@5.15.0)(@types/node@22.10.1)(postcss@8.4.49)(search-insights@2.17.3)(typescript@5.7.2) packages/core: dependencies: @@ -62,7 +74,7 @@ importers: version: 5.7.2 vitest: specifier: ^2.1.6 - version: 2.1.6 + version: 2.1.6(@types/node@22.10.1) packages: @@ -196,6 +208,10 @@ packages: '@atproto/common-web@0.3.1': resolution: {integrity: sha512-N7wiTnus5vAr+lT//0y8m/FaHHLJ9LpGuEwkwDAeV3LCiPif4m/FS8x/QOYrx1PdZQwKso95RAPzCGWQBH5j6Q==} + '@atproto/lex-cli@0.5.2': + resolution: {integrity: sha512-fM/FR/FpOMUOpwir7odZNiJhY3at0gMDGZpkLJeWFDaYyChtwqCGd6x7J4S6w/mqtCDcx1bzGTrnsLkJjtuNfg==} + hasBin: true + '@atproto/lexicon@0.4.3': resolution: {integrity: sha512-lFVZXe1S1pJP0dcxvJuHP3r/a+EAIBwwU7jUK+r8iLhIja+ml6NmYv8KeFHmIJATh03spEQ9s02duDmFVdCoXg==} @@ -666,6 +682,10 @@ packages: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} + '@isaacs/fs-minipass@4.0.1': + resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} + engines: {node: '>=18.0.0'} + '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} @@ -869,6 +889,9 @@ packages: peerDependencies: eslint: '>=8.40.0' + '@ts-morph/common@0.17.0': + resolution: {integrity: sha512-RMSSvSfs9kb0VzkvQ2NWobwnj7TxCA9vI/IjR9bDHqgAyVbu2T0DN4wiKVqomyDWqO7dPr/tErSfq7urQ1Q37g==} + '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} @@ -896,6 +919,9 @@ packages: '@types/ms@0.7.34': resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} + '@types/node@22.10.1': + resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} + '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -1255,6 +1281,10 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} + chownr@3.0.0: + resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} + engines: {node: '>=18'} + ci-info@4.1.0: resolution: {integrity: sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A==} engines: {node: '>=8'} @@ -1267,6 +1297,9 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} + code-block-writer@11.0.3: + resolution: {integrity: sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==} + color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -1277,6 +1310,10 @@ packages: comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} + commander@9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + comment-parser@1.4.1: resolution: {integrity: sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==} engines: {node: '>= 12.0.0'} @@ -2233,6 +2270,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -2247,9 +2288,23 @@ packages: minisearch@7.1.1: resolution: {integrity: sha512-b3YZEYCEH4EdCAtYP7OlDyx7FdPwNzuNwLQ34SfJpM9dlbBZzeXndGavTrC+VCiRWomL21SWfMc6SCKO/U2ZNw==} + minizlib@3.0.1: + resolution: {integrity: sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==} + engines: {node: '>= 18'} + mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} + mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + + mkdirp@3.0.1: + resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} + engines: {node: '>=10'} + hasBin: true + mlly@1.7.3: resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==} @@ -2361,6 +2416,9 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} + path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -2437,6 +2495,11 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier@3.4.1: + resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==} + engines: {node: '>=14'} + hasBin: true + property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} @@ -2515,6 +2578,10 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true + rimraf@5.0.10: + resolution: {integrity: sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==} + hasBin: true + rollup@4.27.4: resolution: {integrity: sha512-RLKxqHEMjh/RGLsDxAEsaLO3mWgyoU6x9w6n1ikAzet4B3gI2/3yP6PWY2p9QzRTh6MfEIXB3MwsOY0Iv3vNrw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -2691,6 +2758,10 @@ packages: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} + tar@7.4.3: + resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} + engines: {node: '>=18'} + text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} @@ -2733,6 +2804,9 @@ packages: peerDependencies: typescript: '>=4.2.0' + ts-morph@16.0.0: + resolution: {integrity: sha512-jGNF0GVpFj0orFw55LTsQxVYEUOCWBAbR5Ls7fTYE5pQsbW18ssTb/6UXx/GYAEjS+DQTp8VoTw0vqYMiaaQuw==} + tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -2800,6 +2874,9 @@ packages: unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} + undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + unist-util-is@6.0.0: resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} @@ -2982,6 +3059,10 @@ packages: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} + yallist@5.0.0: + resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} + engines: {node: '>=18'} + yaml-eslint-parser@1.2.3: resolution: {integrity: sha512-4wZWvE398hCP7O8n3nXKu/vdq1HcH01ixYlCREaJL5NUMwQ0g3MaGFUBNSlmBtKmhbtVG/Cm6lyYmSVTEVil8A==} engines: {node: ^14.17.0 || >=16.0.0} @@ -2999,6 +3080,9 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} + yesno@0.4.0: + resolution: {integrity: sha512-tdBxmHvbXPBKYIg81bMCB7bVeDmHkRzk5rVJyYYXurwKkHq/MCd8rz4HSJUP7hW0H2NlXiq8IFiWvYKEHhlotA==} + yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -3116,7 +3200,7 @@ snapshots: dependencies: '@algolia/client-common': 5.15.0 - '@antfu/eslint-config@3.11.2(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(@vue/compiler-sfc@3.5.13)(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6)': + '@antfu/eslint-config@3.11.2(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(@vue/compiler-sfc@3.5.13)(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6(@types/node@22.10.1))': dependencies: '@antfu/install-pkg': 0.5.0 '@clack/prompts': 0.8.2 @@ -3125,7 +3209,7 @@ snapshots: '@stylistic/eslint-plugin': 2.11.0(eslint@8.57.1)(typescript@5.7.2) '@typescript-eslint/eslint-plugin': 8.16.0(@typescript-eslint/parser@8.16.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2) '@typescript-eslint/parser': 8.16.0(eslint@8.57.1)(typescript@5.7.2) - '@vitest/eslint-plugin': 1.1.12(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6) + '@vitest/eslint-plugin': 1.1.12(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6(@types/node@22.10.1)) eslint: 8.57.1 eslint-config-flat-gitignore: 0.3.0(eslint@8.57.1) eslint-flat-config-utils: 0.4.0 @@ -3187,6 +3271,17 @@ snapshots: uint8arrays: 3.0.0 zod: 3.23.8 + '@atproto/lex-cli@0.5.2': + dependencies: + '@atproto/lexicon': 0.4.3 + '@atproto/syntax': 0.3.1 + chalk: 4.1.2 + commander: 9.5.0 + prettier: 3.4.1 + ts-morph: 16.0.0 + yesno: 0.4.0 + zod: 3.23.8 + '@atproto/lexicon@0.4.3': dependencies: '@atproto/common-web': 0.3.1 @@ -3519,6 +3614,10 @@ snapshots: wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 + '@isaacs/fs-minipass@4.0.1': + dependencies: + minipass: 7.1.2 + '@jridgewell/sourcemap-codec@1.5.0': {} '@nodelib/fs.scandir@2.1.5': @@ -3691,6 +3790,13 @@ snapshots: - supports-color - typescript + '@ts-morph/common@0.17.0': + dependencies: + fast-glob: 3.3.2 + minimatch: 5.1.6 + mkdirp: 1.0.4 + path-browserify: 1.0.1 + '@types/debug@4.1.12': dependencies: '@types/ms': 0.7.34 @@ -3718,6 +3824,10 @@ snapshots: '@types/ms@0.7.34': {} + '@types/node@22.10.1': + dependencies: + undici-types: 6.20.0 + '@types/normalize-package-data@2.4.4': {} '@types/resolve@1.20.2': {} @@ -3810,18 +3920,18 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-vue@5.2.1(vite@5.4.11)(vue@3.5.13(typescript@5.7.2))': + '@vitejs/plugin-vue@5.2.1(vite@5.4.11(@types/node@22.10.1))(vue@3.5.13(typescript@5.7.2))': dependencies: - vite: 5.4.11 + vite: 5.4.11(@types/node@22.10.1) vue: 3.5.13(typescript@5.7.2) - '@vitest/eslint-plugin@1.1.12(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6)': + '@vitest/eslint-plugin@1.1.12(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6(@types/node@22.10.1))': dependencies: '@typescript-eslint/utils': 8.16.0(eslint@8.57.1)(typescript@5.7.2) eslint: 8.57.1 optionalDependencies: typescript: 5.7.2 - vitest: 2.1.6 + vitest: 2.1.6(@types/node@22.10.1) '@vitest/expect@2.1.6': dependencies: @@ -3830,13 +3940,13 @@ snapshots: chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.6(vite@5.4.11)': + '@vitest/mocker@2.1.6(vite@5.4.11(@types/node@22.10.1))': dependencies: '@vitest/spy': 2.1.6 estree-walker: 3.0.3 magic-string: 0.30.14 optionalDependencies: - vite: 5.4.11 + vite: 5.4.11(@types/node@22.10.1) '@vitest/pretty-format@2.1.6': dependencies: @@ -4133,6 +4243,8 @@ snapshots: check-error@2.1.1: {} + chownr@3.0.0: {} + ci-info@4.1.0: {} clean-regexp@1.0.0: @@ -4145,6 +4257,8 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + code-block-writer@11.0.3: {} + color-convert@2.0.1: dependencies: color-name: 1.1.4 @@ -4153,6 +4267,8 @@ snapshots: comma-separated-tokens@2.0.3: {} + commander@9.5.0: {} + comment-parser@1.4.1: {} commondir@1.0.1: {} @@ -5465,6 +5581,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -5475,8 +5595,17 @@ snapshots: minisearch@7.1.1: {} + minizlib@3.0.1: + dependencies: + minipass: 7.1.2 + rimraf: 5.0.10 + mitt@3.0.1: {} + mkdirp@1.0.4: {} + + mkdirp@3.0.1: {} + mlly@1.7.3: dependencies: acorn: 8.14.0 @@ -5600,6 +5729,8 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + path-browserify@1.0.1: {} + path-exists@4.0.0: {} path-is-absolute@1.0.1: {} @@ -5665,6 +5796,8 @@ snapshots: prelude-ls@1.2.1: {} + prettier@3.4.1: {} + property-information@6.5.0: {} punycode@2.3.1: {} @@ -5746,6 +5879,10 @@ snapshots: dependencies: glob: 7.2.3 + rimraf@5.0.10: + dependencies: + glob: 10.4.5 + rollup@4.27.4: dependencies: '@types/estree': 1.0.6 @@ -5953,6 +6090,15 @@ snapshots: tapable@2.2.1: {} + tar@7.4.3: + dependencies: + '@isaacs/fs-minipass': 4.0.1 + chownr: 3.0.0 + minipass: 7.1.2 + minizlib: 3.0.1 + mkdirp: 3.0.1 + yallist: 5.0.0 + text-table@0.2.0: {} tinybench@2.9.0: {} @@ -5981,6 +6127,11 @@ snapshots: dependencies: typescript: 5.7.2 + ts-morph@16.0.0: + dependencies: + '@ts-morph/common': 0.17.0 + code-block-writer: 11.0.3 + tsconfig-paths@3.15.0: dependencies: '@types/json5': 0.0.29 @@ -6066,6 +6217,8 @@ snapshots: has-symbols: 1.0.3 which-boxed-primitive: 1.0.2 + undici-types@6.20.0: {} + unist-util-is@6.0.0: dependencies: '@types/unist': 3.0.3 @@ -6116,13 +6269,13 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.6: + vite-node@2.1.6(@types/node@22.10.1): dependencies: cac: 6.7.14 debug: 4.3.7 es-module-lexer: 1.5.4 pathe: 1.1.2 - vite: 5.4.11 + vite: 5.4.11(@types/node@22.10.1) transitivePeerDependencies: - '@types/node' - less @@ -6134,15 +6287,16 @@ snapshots: - supports-color - terser - vite@5.4.11: + vite@5.4.11(@types/node@22.10.1): dependencies: esbuild: 0.21.5 postcss: 8.4.49 rollup: 4.27.4 optionalDependencies: + '@types/node': 22.10.1 fsevents: 2.3.3 - vitepress@1.5.0(@algolia/client-search@5.15.0)(postcss@8.4.49)(search-insights@2.17.3)(typescript@5.7.2): + vitepress@1.5.0(@algolia/client-search@5.15.0)(@types/node@22.10.1)(postcss@8.4.49)(search-insights@2.17.3)(typescript@5.7.2): dependencies: '@docsearch/css': 3.8.0 '@docsearch/js': 3.8.0(@algolia/client-search@5.15.0)(search-insights@2.17.3) @@ -6151,7 +6305,7 @@ snapshots: '@shikijs/transformers': 1.24.0 '@shikijs/types': 1.24.0 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.2.1(vite@5.4.11)(vue@3.5.13(typescript@5.7.2)) + '@vitejs/plugin-vue': 5.2.1(vite@5.4.11(@types/node@22.10.1))(vue@3.5.13(typescript@5.7.2)) '@vue/devtools-api': 7.6.7 '@vue/shared': 3.5.13 '@vueuse/core': 11.3.0(vue@3.5.13(typescript@5.7.2)) @@ -6160,7 +6314,7 @@ snapshots: mark.js: 8.11.1 minisearch: 7.1.1 shiki: 1.24.0 - vite: 5.4.11 + vite: 5.4.11(@types/node@22.10.1) vue: 3.5.13(typescript@5.7.2) optionalDependencies: postcss: 8.4.49 @@ -6192,10 +6346,10 @@ snapshots: - typescript - universal-cookie - vitest@2.1.6: + vitest@2.1.6(@types/node@22.10.1): dependencies: '@vitest/expect': 2.1.6 - '@vitest/mocker': 2.1.6(vite@5.4.11) + '@vitest/mocker': 2.1.6(vite@5.4.11(@types/node@22.10.1)) '@vitest/pretty-format': 2.1.6 '@vitest/runner': 2.1.6 '@vitest/snapshot': 2.1.6 @@ -6211,9 +6365,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.2 tinyrainbow: 1.2.0 - vite: 5.4.11 - vite-node: 2.1.6 + vite: 5.4.11(@types/node@22.10.1) + vite-node: 2.1.6(@types/node@22.10.1) why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 22.10.1 transitivePeerDependencies: - less - lightningcss @@ -6320,6 +6476,8 @@ snapshots: y18n@5.0.8: {} + yallist@5.0.0: {} + yaml-eslint-parser@1.2.3: dependencies: eslint-visitor-keys: 3.4.3 @@ -6340,6 +6498,8 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 + yesno@0.4.0: {} + yocto-queue@0.1.0: {} zod@3.23.8: {} From da22d64e2c1e5f0d2b9e7e1dc2d94536370fe79e Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 12:47:54 -0500 Subject: [PATCH 05/68] generating types from the lexicons --- scripts/generate-types.ts | 94 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 scripts/generate-types.ts diff --git a/scripts/generate-types.ts b/scripts/generate-types.ts new file mode 100644 index 0000000..027529d --- /dev/null +++ b/scripts/generate-types.ts @@ -0,0 +1,94 @@ +import { Buffer } from 'node:buffer'; +import { execSync } from 'node:child_process'; +import fs from 'node:fs/promises'; +import path from 'node:path'; +import process from 'node:process'; +import * as tar from 'tar'; + +const LEXICONS_DIR = 'lexicons'; +const TYPES_DIR = 'packages/core/src/lexicons'; +const REPO = 'bluesky-social/atproto'; + +async function findJsonFiles(dir: string): Promise { + const files: string[] = []; + const entries = await fs.readdir(dir, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + files.push(...await findJsonFiles(fullPath)); + } + else if (entry.isFile() && entry.name.endsWith('.json')) { + files.push(fullPath); + } + } + + return files; +} + +async function main() { + try { + // Ensure directories exist + await fs.mkdir(LEXICONS_DIR, { recursive: true }); + await fs.mkdir(TYPES_DIR, { recursive: true }); + + // Get latest commit SHA for lexicons + console.log('Getting latest lexicon commit...'); + const shaResponse = await fetch(`https://api.github.com/repos/${REPO}/commits?path=lexicons/`); + if (!shaResponse.ok) { + throw new Error(`Failed to get commit SHA: ${shaResponse.statusText}`); + } + + const commits = await shaResponse.json(); + const sha = commits[0]?.sha; + if (!sha) { + throw new Error('No commits found for lexicons'); + } + + // Download specific commit's lexicons + console.log('Downloading lexicons from atproto...'); + const response = await fetch(`https://github.com/${REPO}/archive/${sha}.tar.gz`); + if (!response.ok) { + throw new Error(`Failed to download lexicons: ${response.statusText}`); + } + + // Create a temporary file for the tar download + const tarFile = 'atproto.tar.gz'; + await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); + + // Extract only lexicon files + await tar.x({ + file: tarFile, + cwd: LEXICONS_DIR, + filter: path => path.includes('/lexicons/'), + strip: 2, + }); + + // Clean up tar file + await fs.unlink(tarFile); + + // Find all lexicon JSON files + console.log('Finding lexicon files...'); + const lexiconFiles = await findJsonFiles(LEXICONS_DIR); + if (lexiconFiles.length === 0) { + throw new Error('No lexicon files found'); + } + + // Generate types using @atproto/lex-cli + console.log('Generating types...'); + execSync( + `pnpm lex gen-api ${TYPES_DIR} ${lexiconFiles.join(' ')}`, + { + stdio: 'inherit', + }, + ); + + console.log('Done! Types generated in', TYPES_DIR); + } + catch (error) { + console.error('Error:', error); + process.exit(1); + } +} + +main(); From cc7fd715acfbf413ec7fceb6730ccf4906eeeb4a Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 15:04:02 -0500 Subject: [PATCH 06/68] moving types to `packages/lexicons` --- .gitignore | 2 +- pnpm-lock.yaml | 17 +++++++++++++++++ scripts/generate-types.ts | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dcffbe5..7d67cfc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ atproto.tar.gz node_modules/ dist/ -lexicons/ +/lexicons/ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index da4ddc9..d864862 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -76,6 +76,18 @@ importers: specifier: ^2.1.6 version: 2.1.6(@types/node@22.10.1) + packages/lexicons: + dependencies: + '@atproto/lexicon': + specifier: ^0.4.3 + version: 0.4.3 + '@atproto/xrpc': + specifier: ^0.6.4 + version: 0.6.4 + multiformats: + specifier: ^13.3.1 + version: 13.3.1 + packages: '@algolia/autocomplete-core@1.17.7': @@ -2311,6 +2323,9 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + multiformats@13.3.1: + resolution: {integrity: sha512-QxowxTNwJ3r5RMctoGA5p13w5RbRT2QDkoM+yFlqfLiioBp78nhDjnRLvmSBI9+KAqN4VdgOVWM9c0CHd86m3g==} + multiformats@9.9.0: resolution: {integrity: sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==} @@ -5615,6 +5630,8 @@ snapshots: ms@2.1.3: {} + multiformats@13.3.1: {} + multiformats@9.9.0: {} nano-staged@0.8.0: diff --git a/scripts/generate-types.ts b/scripts/generate-types.ts index 027529d..57b962e 100644 --- a/scripts/generate-types.ts +++ b/scripts/generate-types.ts @@ -6,7 +6,7 @@ import process from 'node:process'; import * as tar from 'tar'; const LEXICONS_DIR = 'lexicons'; -const TYPES_DIR = 'packages/core/src/lexicons'; +const TYPES_DIR = 'packages/lexicons'; const REPO = 'bluesky-social/atproto'; async function findJsonFiles(dir: string): Promise { From 355716f106b1c72df6f3b2a61176671ffc11e430 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 15:04:18 -0500 Subject: [PATCH 07/68] adding dependencies for generated types --- packages/lexicons/package.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 packages/lexicons/package.json diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json new file mode 100644 index 0000000..bb819bd --- /dev/null +++ b/packages/lexicons/package.json @@ -0,0 +1,11 @@ +{ + "name": "@tsky/lexicons", + "private": true, + "version": "0.0.1", + "type": "module", + "dependencies": { + "@atproto/lexicon": "^0.4.3", + "@atproto/xrpc": "^0.6.4", + "multiformats": "^13.3.1" + } +} From f8caf66cbf3b9cc01e389ab415c5a392cec51cd1 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 15:06:11 -0500 Subject: [PATCH 08/68] remove private --- packages/lexicons/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index bb819bd..3d56a95 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -1,6 +1,5 @@ { "name": "@tsky/lexicons", - "private": true, "version": "0.0.1", "type": "module", "dependencies": { From 586ed016f820b6f6cf863968f9a7edc58faad241 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 18:03:40 -0500 Subject: [PATCH 09/68] fixing object key order --- packages/lexicons/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 3d56a95..1a52ca8 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -1,7 +1,7 @@ { "name": "@tsky/lexicons", - "version": "0.0.1", "type": "module", + "version": "0.0.1", "dependencies": { "@atproto/lexicon": "^0.4.3", "@atproto/xrpc": "^0.6.4", From d918fe40f575b0096baef97f55f2e2994b9acf38 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Sun, 1 Dec 2024 18:32:10 -0500 Subject: [PATCH 10/68] adding publishConfig --- packages/lexicons/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 1a52ca8..eee174b 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -2,6 +2,9 @@ "name": "@tsky/lexicons", "type": "module", "version": "0.0.1", + "publishConfig": { + "access": "public" + }, "dependencies": { "@atproto/lexicon": "^0.4.3", "@atproto/xrpc": "^0.6.4", From 5d3d07569c4a1848e72af4951d0e838162ca4146 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 09:29:16 -0500 Subject: [PATCH 11/68] moving devDeps to @tsky/lexicons --- package.json | 4 ---- packages/lexicons/package.json | 7 +++++++ pnpm-lock.yaml | 28 ++++++++++++++++------------ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index e12e165..b322555 100644 --- a/package.json +++ b/package.json @@ -21,17 +21,13 @@ }, "devDependencies": { "@antfu/eslint-config": "^3.11.2", - "@atproto/lex-cli": "^0.5.2", "@biomejs/biome": "^1.9.4", "@eslint/js": "^9.15.0", - "@types/node": "^22.10.1", "eslint": "^8.57.1", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", "eslint-plugin-promise": "^6.0.0", "nano-staged": "^0.8.0", - "tar": "^7.4.3", - "tsx": "^4.19.2", "typescript-eslint": "^8.16.0" }, "nano-staged": { diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index eee174b..0cd532b 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -9,5 +9,12 @@ "@atproto/lexicon": "^0.4.3", "@atproto/xrpc": "^0.6.4", "multiformats": "^13.3.1" + }, + "devDependencies": { + "@atproto/lex-cli": "^0.5.2", + "@types/node": "^22.10.1", + "tar": "^7.4.3", + "tsx": "^4.19.2", + "typescript": "^5.7.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d864862..afe4e48 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,18 +11,12 @@ importers: '@antfu/eslint-config': specifier: ^3.11.2 version: 3.11.2(@typescript-eslint/utils@8.16.0(eslint@8.57.1)(typescript@5.7.2))(@vue/compiler-sfc@3.5.13)(eslint@8.57.1)(typescript@5.7.2)(vitest@2.1.6(@types/node@22.10.1)) - '@atproto/lex-cli': - specifier: ^0.5.2 - version: 0.5.2 '@biomejs/biome': specifier: ^1.9.4 version: 1.9.4 '@eslint/js': specifier: ^9.15.0 version: 9.15.0 - '@types/node': - specifier: ^22.10.1 - version: 22.10.1 eslint: specifier: ^8.57.1 version: 8.57.1 @@ -38,12 +32,6 @@ importers: nano-staged: specifier: ^0.8.0 version: 0.8.0 - tar: - specifier: ^7.4.3 - version: 7.4.3 - tsx: - specifier: ^4.19.2 - version: 4.19.2 typescript-eslint: specifier: ^8.16.0 version: 8.16.0(eslint@8.57.1)(typescript@5.7.2) @@ -87,6 +75,22 @@ importers: multiformats: specifier: ^13.3.1 version: 13.3.1 + devDependencies: + '@atproto/lex-cli': + specifier: ^0.5.2 + version: 0.5.2 + '@types/node': + specifier: ^22.10.1 + version: 22.10.1 + tar: + specifier: ^7.4.3 + version: 7.4.3 + tsx: + specifier: ^4.19.2 + version: 4.19.2 + typescript: + specifier: ^5.7.2 + version: 5.7.2 packages: From 837a56054d9cd73002d2056b4e7a925eb5dd3b20 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 09:29:27 -0500 Subject: [PATCH 12/68] adding tsconfig --- packages/lexicons/tsconfig.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/lexicons/tsconfig.json diff --git a/packages/lexicons/tsconfig.json b/packages/lexicons/tsconfig.json new file mode 100644 index 0000000..b25195c --- /dev/null +++ b/packages/lexicons/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "resolveJsonModule": true, + "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": ["scripts/**/*"], + "exclude": ["node_modules"] +} From 85d37d6c899c73fc5f2167da3d5f378271149684 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 11:43:20 -0500 Subject: [PATCH 13/68] updating gitignores --- .gitignore | 2 -- packages/lexicons/.gitignore | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 packages/lexicons/.gitignore diff --git a/.gitignore b/.gitignore index 7d67cfc..b947077 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -atproto.tar.gz node_modules/ dist/ -/lexicons/ diff --git a/packages/lexicons/.gitignore b/packages/lexicons/.gitignore new file mode 100644 index 0000000..7d67cfc --- /dev/null +++ b/packages/lexicons/.gitignore @@ -0,0 +1,4 @@ +atproto.tar.gz +node_modules/ +dist/ +/lexicons/ From 4dc007dc821ef504d38d9af6c2b0ad07a65641a1 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 11:43:43 -0500 Subject: [PATCH 14/68] moving script to @tsky/lexicons --- .../lexicons/scripts}/generate-types.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) rename {scripts => packages/lexicons/scripts}/generate-types.ts (88%) diff --git a/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts similarity index 88% rename from scripts/generate-types.ts rename to packages/lexicons/scripts/generate-types.ts index 57b962e..10804f4 100644 --- a/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -3,10 +3,14 @@ import { execSync } from 'node:child_process'; import fs from 'node:fs/promises'; import path from 'node:path'; import process from 'node:process'; +import { fileURLToPath } from 'node:url'; import * as tar from 'tar'; -const LEXICONS_DIR = 'lexicons'; -const TYPES_DIR = 'packages/lexicons'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const LEXICONS_DIR = path.resolve(__dirname, '../lexicons'); +const TYPES_DIR = path.resolve(__dirname, '../src'); const REPO = 'bluesky-social/atproto'; async function findJsonFiles(dir: string): Promise { @@ -53,7 +57,7 @@ async function main() { } // Create a temporary file for the tar download - const tarFile = 'atproto.tar.gz'; + const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); // Extract only lexicon files @@ -80,6 +84,7 @@ async function main() { `pnpm lex gen-api ${TYPES_DIR} ${lexiconFiles.join(' ')}`, { stdio: 'inherit', + cwd: TYPES_DIR, }, ); From 9fbf07bdf9c61e95bd6979396582f4036f4772bd Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 14:28:13 -0500 Subject: [PATCH 15/68] Update packages/lexicons/package.json Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com> --- packages/lexicons/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 0cd532b..01bc3c0 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -5,6 +5,9 @@ "publishConfig": { "access": "public" }, + "scripts": { + "build": "tsx ./scripts/generate-types.ts" + }, "dependencies": { "@atproto/lexicon": "^0.4.3", "@atproto/xrpc": "^0.6.4", From 224675eec05b3815a7e097c96908fb834110e42f Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 14:30:47 -0500 Subject: [PATCH 16/68] adding generated files --- packages/lexicons/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexicons/tsconfig.json b/packages/lexicons/tsconfig.json index b25195c..53d5d52 100644 --- a/packages/lexicons/tsconfig.json +++ b/packages/lexicons/tsconfig.json @@ -9,6 +9,6 @@ "forceConsistentCasingInFileNames": true, "skipLibCheck": true }, - "include": ["scripts/**/*"], + "include": ["scripts/**/*", "src/**/*"], "exclude": ["node_modules"] } From be90dfa87e7ed832c09156b202dd667c2f41142d Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:03:29 -0500 Subject: [PATCH 17/68] ignoring generated files for now --- eslint.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index 3f35c56..6e95d1a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import antfu from '@antfu/eslint-config'; export default antfu( { + ignores: ['packages/lexicons/**/*'], typescript: true, stylistic: { semi: true, From d103777501e7d5f2df33a7382c8f95dd5e83dc2c Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:09:30 -0500 Subject: [PATCH 18/68] init @tsky/lex-cli --- packages/lex-cli/package.json | 20 ++++++++++++++++++++ packages/lex-cli/tsconfig.json | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 packages/lex-cli/package.json create mode 100644 packages/lex-cli/tsconfig.json diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json new file mode 100644 index 0000000..e81e9e9 --- /dev/null +++ b/packages/lex-cli/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tsky/lex-cli", + "type": "module", + "version": "0.0.1", + "license": "MIT", + "bin": "dist/index.js", + "scripts": { + "build": "tsc" + }, + "dependencies": { + "clipanion": "4.0.0-rc.4", + "picocolors": "^1.1.1", + "prettier": "^3.3.3", + "typanion": "^3.14.0" + }, + "devDependencies": { + "@types/node": "^22.8.1", + "typescript": "^5.7.2" + } +} diff --git a/packages/lex-cli/tsconfig.json b/packages/lex-cli/tsconfig.json new file mode 100644 index 0000000..17f73ee --- /dev/null +++ b/packages/lex-cli/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ESNext", + "rootDir": "src", + "module": "NodeNext", + "strict": true, + "declaration": true, + "outDir": "dist", + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} From 1eef65499217e249af90c168e481aad99b97dc55 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:10:40 -0500 Subject: [PATCH 19/68] adding entry point --- packages/lex-cli/src/index.ts | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 packages/lex-cli/src/index.ts diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts new file mode 100644 index 0000000..69020a3 --- /dev/null +++ b/packages/lex-cli/src/index.ts @@ -0,0 +1,96 @@ +import { writeFile } from 'node:fs/promises'; +import process from 'node:process'; +import { Builtins, Command, Option, Cli } from 'clipanion'; +import pc from 'picocolors'; +import prettier from 'prettier'; +import * as t from 'typanion'; +import { generateDefinitions } from './generator/index.js'; + +const cli = new Cli({ + binaryName: 'lex-cli', + binaryVersion: '0.0.0', +}); + +cli.register(Builtins.HelpCommand); + +cli.register( + class GenerateMainLexicons extends Command { + static paths = [['generate-main']]; + + static usage = Command.Usage({ + description: 'Generates the main type definition file', + }); + + output = Option.String('-o,--output', { + required: false, + description: + 'Where to save the resulting type definition file, defaults to stdout if not passed', + validator: t.cascade(t.isString(), t.matchesRegExp(/\.ts$/)), + }); + + desc = Option.String('--description', { + required: false, + description: 'Module description', + }); + + banner = Option.String('--banner', { + required: false, + description: 'Insert an arbitrary string at the beginning of the module', + }); + + files = Option.Rest({ + required: 1, + name: 'files', + }); + + async execute(): Promise { + let code: string; + + try { + code = await generateDefinitions({ + files: this.files, + main: true, + banner: this.banner, + description: this.desc, + }); + } + catch (err) { + if (err instanceof Error) { + console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); + + if (err.cause instanceof Error) { + console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); + } + } + else { + console.error(pc.bold(pc.red('unknown error occurred:'))); + console.error(err); + } + + return 1; + } + + const config = await prettier.resolveConfig( + this.output || process.cwd(), + { editorconfig: true }, + ); + const formatted = await prettier.format(code, { + ...config, + parser: 'typescript', + }); + + if (this.output) { + await writeFile(this.output, formatted); + } + else { + // eslint-disable-next-line no-console + console.log(formatted); + } + } + }, +); + +(async () => { + const exitCode = await cli.run(process.argv.slice(2)); + process.exitCode = exitCode; +})(); From 35a10b1774d6aca1d7fd0df6e34888a5f8b53d4d Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:10:58 -0500 Subject: [PATCH 20/68] adding generator --- packages/lex-cli/src/generator/index.ts | 338 +++++++++++++++++ .../src/generator/resolvers/complex.ts | 51 +++ .../src/generator/resolvers/numeric.ts | 17 + .../src/generator/resolvers/primitives.ts | 16 + .../lex-cli/src/generator/resolvers/string.ts | 50 +++ .../lex-cli/src/generator/resolvers/type.ts | 99 +++++ packages/lex-cli/src/generator/schema.ts | 355 ++++++++++++++++++ 7 files changed, 926 insertions(+) create mode 100644 packages/lex-cli/src/generator/index.ts create mode 100644 packages/lex-cli/src/generator/resolvers/complex.ts create mode 100644 packages/lex-cli/src/generator/resolvers/numeric.ts create mode 100644 packages/lex-cli/src/generator/resolvers/primitives.ts create mode 100644 packages/lex-cli/src/generator/resolvers/string.ts create mode 100644 packages/lex-cli/src/generator/resolvers/type.ts create mode 100644 packages/lex-cli/src/generator/schema.ts diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts new file mode 100644 index 0000000..1b9eb21 --- /dev/null +++ b/packages/lex-cli/src/generator/index.ts @@ -0,0 +1,338 @@ +import { readFile } from 'node:fs/promises'; +import { toNamespace } from '../utils/cache.js'; +import { getDescriptions, writeJsdoc } from '../utils/docs.js'; +import { mainPrelude } from '../utils/prelude.js'; +import { sortDefinition, sortName, sortPropertyKeys } from '../utils/sort.js'; +import { resolveType } from './resolvers/type.js'; +import { documentSchema, type DocumentSchema } from './schema.js'; + +export interface GenerateDefinitionsOptions { + files: string[]; + main: boolean; + banner?: string; + description?: string; + debug?: boolean; + onProgress?: (filename: string, index: number, total: number) => void; +} + +export async function generateDefinitions(opts: GenerateDefinitionsOptions) { + const { files, main, banner, description } = opts; + + let queries = ''; + let procedures = ''; + let records = ''; + let subscriptions = ''; + + let code = `/* eslint-disable */ +// This file is automatically generated, do not edit!`; + + if (description) { + code += `\n\n/** + * @module + * ${description} + */`; + } + + if (main) { + code += `\n\n${banner ?? ''}\n${mainPrelude}`; + } + else { + code += `\n\nimport "@tsky/lexicons";${banner ?? ''} + +declare module "@tsky/lexicons" {`; + } + + for await (const filename of files.sort(sortName)) { + let document: DocumentSchema; + + try { + const jsonString = await readFile(filename, 'utf8'); + const parsed = JSON.parse(jsonString); + + if (!documentSchema(parsed)) { + throw new Error('Invalid document schema'); + } + document = parsed; + } + catch (err) { + throw new Error(`failed to read ${filename}`, { cause: err }); + } + + const ns = document.id; + const tsNamespace = toNamespace(ns); + + let descs: string[] = []; + let chunk = ''; + + const definitions = document.defs; + const keys = Object.keys(definitions).sort(sortDefinition); + + for (const key of keys) { + const def = definitions[key]; + const type = def.type; + + const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; + const typeName = key[0].toUpperCase() + key.slice(1); + + if (type === 'string') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'token') { + chunk += `type ${typeName} = '${nsid}';`; + } + else if (type === 'object') { + const required = def.required; + const nullable = def.nullable; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += `interface ${typeName} {`; + chunk += `[Brand.Type]?: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + } + else if (type === 'array') { + const { value, descriptions } = resolveType(nsid, def.items); + const descs = []; + + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + + chunk += writeJsdoc(descs.concat(descriptions)); + chunk += `type ${typeName} = (${value})[];`; + } + else if (type === 'record') { + const obj = def.record; + const required = obj.required; + const nullable = obj.nullable; + const properties = obj.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += 'interface Record {'; + chunk += `$type: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + + records += `\n'${nsid}': ${tsNamespace}.Record;`; + } + else if (type === 'query' || type === 'procedure') { + let parameters = def.parameters; + const input = type === 'procedure' ? def.input : undefined; + const output = def.output; + const errors = def.errors; + + descs = getDescriptions(def); + + if (parameters) { + if (Object.values(parameters.properties).length === 0) { + parameters = undefined; + } + else { + const { value, descriptions } = resolveType(nsid, parameters); + + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + } + else { + chunk += 'interface Params {}'; + } + + if (input) { + if (input.encoding === 'application/json' && input.schema) { + const { value, descriptions } = resolveType(nsid, input.schema); + + chunk += writeJsdoc(descriptions); + + if (input.schema?.type === 'object') { + chunk += `interface Input ${value}`; + } + else { + chunk += `type Input = ${value};`; + } + } + else { + chunk += 'type Input = Blob | ArrayBufferView;'; + } + } + else { + chunk += 'type Input = undefined;'; + } + + if (output) { + if (output.encoding === 'application/json' && output.schema) { + const { value, descriptions } = resolveType(nsid, output.schema); + + chunk += writeJsdoc(descriptions); + + if (output.schema?.type === 'object') { + chunk += `interface Output ${value}`; + } + else { + chunk += `type Output = ${value};`; + } + } + else { + chunk += 'type Output = Uint8Array;'; + } + } + else { + chunk += 'type Output = undefined;'; + } + + if (errors) { + chunk += 'interface Errors {'; + + for (const error of errors) { + chunk += `${error.name}: {};`; + } + + chunk += '}'; + } + + { + let rc = `'${ns}':{\n`; + + if (parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (input) { + rc += `input: ${tsNamespace}.Input;`; + } + if (output) { + rc += `output: ${tsNamespace}.Output;`; + } + + rc += '};'; + + if (type === 'query') { + queries += rc; + } + else if (type === 'procedure') { + procedures += rc; + } + } + } + else if (type === 'blob') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'bytes') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'subscription') { + if (def.parameters) { + const { value, descriptions } = resolveType(nsid, def.parameters); + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + else { + chunk += 'interface Params {}'; + } + + if (def.message?.schema) { + const { value: messageValue, descriptions: messageDesc } + = resolveType(nsid, def.message.schema); + chunk += writeJsdoc(messageDesc); + chunk += `type Message = ${messageValue};`; + } + + if (def.errors) { + chunk += 'interface Errors {'; + for (const error of def.errors) { + chunk += `${error.name}: {};`; + } + chunk += '}'; + } + + let rc = `'${ns}':{\n`; + if (def.parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (def.message?.schema) { + rc += `message: ${tsNamespace}.Message;`; + } + if (def.errors) { + rc += `errors: ${tsNamespace}.Errors;`; + } + rc += '};'; + subscriptions += rc; + } + else { + // eslint-disable-next-line no-console + console.log(`${nsid}: unhandled type ${type}`); + } + } + + code += writeJsdoc(descs); + + if (main) { + code += `export declare namespace ${tsNamespace} {`; + } + else { + code += `namespace ${tsNamespace} {`; + } + + code += chunk; + code += '}\n\n'; + } + + if (main) { + code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; + } + else { + code += `interface Records {${records}}\n\n`; + code += `interface Queries {${queries}}\n\n`; + code += `interface Procedures {${procedures}}\n\n`; + code += `interface Subscriptions {${subscriptions}}\n\n`; + code += '}'; + } + + return code; +} diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts new file mode 100644 index 0000000..de465f5 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -0,0 +1,51 @@ +import type { + ObjectSchema, + RefSchema, + RefUnionSchema, + XrpcParametersSchema, +} from '../schema.js'; +import { toNamespace, toUpper } from '../../utils/cache.js'; +import { writeJsdoc } from '../../utils/docs.js'; +import { sortName, sortPropertyKeys } from '../../utils/sort.js'; +import { resolveType } from './type.js'; + +export function resolveRefType(def: RefSchema): string { + const [ns, ref] = def.ref.split('#'); + return (ns ? `${toNamespace(ns)}.` : '') + (ref ? toUpper(ref) : 'Main'); +} + +export function resolveUnionType(def: RefUnionSchema): string { + const refs = def.refs.toSorted(sortName).map((raw) => { + const [ns, ref] = raw.split('#'); + return (ns ? `${toNamespace(ns)}.` : '') + (ref ? toUpper(ref) : 'Main'); + }); + return `Brand.Union<${refs.join('|')}>`; +} + +export function resolveObjectType( + def: ObjectSchema | XrpcParametersSchema, + type: 'object' | 'params', + nsid: string, +): { value: string; descriptions: string[] } { + const required = def.required; + const nullable = type === 'object' && 'nullable' in def ? def.nullable : []; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + let chunk = '{'; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + return { value: chunk, descriptions: [] }; +} diff --git a/packages/lex-cli/src/generator/resolvers/numeric.ts b/packages/lex-cli/src/generator/resolvers/numeric.ts new file mode 100644 index 0000000..643f76a --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/numeric.ts @@ -0,0 +1,17 @@ +import type { IntegerSchema } from '../schema.js'; + +export function resolveIntegerType( + def: IntegerSchema, + descs: string[], +): string { + if (def.minimum !== undefined) { + descs.push(`Minimum: ${def.minimum}`); + } + if (def.maximum !== undefined) { + descs.push(`Maximum: ${def.maximum}`); + } + if (def.default !== undefined) { + descs.push(`@default ${def.default}`); + } + return 'number'; +} diff --git a/packages/lex-cli/src/generator/resolvers/primitives.ts b/packages/lex-cli/src/generator/resolvers/primitives.ts new file mode 100644 index 0000000..20430f7 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/primitives.ts @@ -0,0 +1,16 @@ +export function resolvePrimitiveType( + type: string, +): string { + switch (type) { + case 'unknown': + return 'unknown'; + case 'cid-link': + return 'At.CIDLink'; + case 'bytes': + return 'At.Bytes'; + case 'blob': + return 'At.Blob'; + default: + return 'unknown'; + } +} diff --git a/packages/lex-cli/src/generator/resolvers/string.ts b/packages/lex-cli/src/generator/resolvers/string.ts new file mode 100644 index 0000000..12af283 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/string.ts @@ -0,0 +1,50 @@ +import type { StringSchema } from '../schema.js'; +import { IGNORED_FORMATS, TYPE_FORMATS } from '../../utils/formats.js'; +import { sortName } from '../../utils/sort.js'; + +export function resolveStringFormat(format: string, nsid: string): string { + if (format === 'did') return TYPE_FORMATS.DID; + if (format === 'cid') return TYPE_FORMATS.CID; + if (format === 'handle') return TYPE_FORMATS.HANDLE; + if (format === 'at-uri') return TYPE_FORMATS.URI; + if (IGNORED_FORMATS.has(format)) return 'string'; + + console.warn(`${nsid}: unknown format ${format}`); + return 'string'; +} + +export function resolveStringType( + def: StringSchema, + nsid: string, + descs: string[], +): string { + const { format, enum: enums, knownValues: known } = def; + + if (format !== undefined) { + return resolveStringFormat(format, nsid); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum string length: ${def.minLength}`); + } + if (def.maxLength !== undefined) { + descs.push(`Maximum string length: ${def.maxLength}`); + } + if (def.maxGraphemes !== undefined) { + descs.push(`Maximum grapheme length: ${def.maxGraphemes}`); + } + if (def.default !== undefined) { + descs.push(`@default ${JSON.stringify(def.default)}`); + } + + if (enums) { + return enums.map((val: string) => JSON.stringify(val)).join('|'); + } + if (known) { + return `${known + .toSorted(sortName) + .map((val: string) => JSON.stringify(val)) + .join('|')} | (string & {})`; + } + return 'string'; +} diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts new file mode 100644 index 0000000..f3dd9e9 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -0,0 +1,99 @@ +import type { + RefVariantSchema, + UserTypeSchema, + XrpcParametersSchema, +} from '../schema.js'; +import { getDescriptions } from '../../utils/docs.js'; +import { + resolveObjectType, + resolveRefType, + resolveUnionType, +} from './complex.js'; +import { resolveIntegerType } from './numeric.js'; +import { resolvePrimitiveType } from './primitives.js'; +import { resolveStringType } from './string.js'; + +export function resolveType( + nsid: string, + def: UserTypeSchema | RefVariantSchema | XrpcParametersSchema, +): { value: string; descriptions: string[] } { + if (!def?.type) { + throw new Error(`Invalid schema definition for ${nsid}`); + } + + let descs = getDescriptions(def); + let val: string; + + switch (def.type) { + case 'unknown': + case 'cid-link': + case 'blob': + case 'bytes': + val = resolvePrimitiveType(def.type); + break; + case 'integer': + val = resolveIntegerType(def, descs); + break; + case 'boolean': + val = 'boolean'; + if (def.default !== undefined) { + descs.push(`@default ${def.default}`); + } + break; + case 'string': + val = resolveStringType(def, nsid, descs); + break; + case 'array': { + const { value, descriptions } = resolveType(`${nsid}/0`, def.items); + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + val = `(${value})[]`; + descs = descs.concat(descriptions); + break; + } + case 'ref': + val = resolveRefType(def); + break; + case 'union': + val = resolveUnionType(def); + break; + case 'object': + case 'params': { + const result = resolveObjectType(def, def.type, nsid); + val = result.value; + descs = descs.concat(result.descriptions); + break; + } + case 'subscription': { + const output: { value: string; descriptions: string[] }[] = []; + if (def.parameters) { + output.push(resolveObjectType(def.parameters, 'params', nsid)); + } + if (def.message?.schema) { + output.push(resolveType(nsid, def.message.schema)); + } + if (def.errors) { + output.push({ + value: `interface Errors {${def.errors + .map(error => `${error.name}: {};`) + .join('')}}`, + descriptions: [], + }); + } + + val = output.map(o => o.value).join('\n'); + descs = descs.concat(output.flatMap(o => o.descriptions)); + break; + } + default: + // eslint-disable-next-line no-console + console.log(`${nsid}: unknown type ${def.type}`); + val = 'unknown'; + } + + return { value: val, descriptions: descs }; +} diff --git a/packages/lex-cli/src/generator/schema.ts b/packages/lex-cli/src/generator/schema.ts new file mode 100644 index 0000000..72da151 --- /dev/null +++ b/packages/lex-cli/src/generator/schema.ts @@ -0,0 +1,355 @@ +import * as t from 'typanion'; + +const isPositiveInteger = t.cascade( + t.isNumber(), + (value): value is number => { + return Number.isInteger(value) && value >= 0; + }, +); + +export const booleanSchema = t.isObject({ + type: t.isLiteral('boolean'), + description: t.isOptional(t.isString()), + default: t.isOptional(t.isBoolean()), + const: t.isOptional(t.isBoolean()), +}); + +export type BooleanSchema = t.InferType; + +export const integerSchema = t.isObject({ + type: t.isLiteral('integer'), + description: t.isOptional(t.isString()), + default: t.isOptional(isPositiveInteger), + const: t.isOptional(isPositiveInteger), + enum: t.isOptional(t.isArray(t.isNumber())), + maximum: t.isOptional(isPositiveInteger), + minimum: t.isOptional(isPositiveInteger), +}); + +export type IntegerSchema = t.InferType; + +const stringFormatSchema = t.isOneOf([ + t.isLiteral('at-identifier'), + t.isLiteral('at-uri'), + t.isLiteral('cid'), + t.isLiteral('datetime'), + t.isLiteral('did'), + t.isLiteral('handle'), + t.isLiteral('language'), + t.isLiteral('nsid'), + t.isLiteral('record-key'), + t.isLiteral('tid'), + t.isLiteral('uri'), +]); + +export const stringSchema: t.StrictValidator = t.cascade( + t.isObject({ + type: t.isLiteral('string'), + description: t.isOptional(t.isString()), + format: t.isOptional(stringFormatSchema), + default: t.isOptional(t.isString()), + const: t.isOptional(t.isString()), + enum: t.isOptional(t.isArray(t.isString())), + knownValues: t.isOptional(t.isArray(t.isString())), + maxLength: t.isOptional(isPositiveInteger), + minLength: t.isOptional(isPositiveInteger), + maxGraphemes: t.isOptional(isPositiveInteger), + minGraphemes: t.isOptional(isPositiveInteger), + }), + (value): value is { type: 'string'; description?: string; format?: 'at-identifier' | 'at-uri' | 'cid' | 'datetime' | 'did' | 'handle' | 'language' | 'nsid' | 'record-key' | 'tid' | 'uri'; default?: string; const?: string; enum?: string[]; knownValues?: string[]; maxLength?: number; minLength?: number; maxGraphemes?: number; minGraphemes?: number } => { + if (value.format !== undefined && value.format !== 'uri') { + if (value.maxLength !== undefined + || value.minLength !== undefined + || value.maxGraphemes !== undefined + || value.minGraphemes !== undefined) { + throw new Error(`${value.format} format can't be used with length or grapheme constraints`); + } + } + return true; + }, +); + +export type StringSchema = t.InferType; + +export const unknownSchema = t.isObject({ + type: t.isLiteral('unknown'), + description: t.isOptional(t.isString()), +}); + +export type UnknownSchema = t.InferType; + +export const primitiveSchema = t.isOneOf([ + booleanSchema, + integerSchema, + stringSchema, + unknownSchema, +]); + +export type PrimitiveSchema = t.InferType; + +export const bytesSchema = t.isObject({ + type: t.isLiteral('bytes'), + description: t.isOptional(t.isString()), + maxLength: t.isOptional(isPositiveInteger), + minLength: t.isOptional(isPositiveInteger), +}); + +export type BytesSchema = t.InferType; + +export const cidLinkSchema = t.isObject({ + type: t.isLiteral('cid-link'), + description: t.isOptional(t.isString()), +}); + +export type CidLinkSchema = t.InferType; + +export const ipldTypeSchema = t.isOneOf([ + bytesSchema, + cidLinkSchema, +]); + +export type IpldTypeSchema = t.InferType; + +export const refSchema = t.isObject({ + type: t.isLiteral('ref'), + description: t.isOptional(t.isString()), + ref: t.isString(), +}); + +export type RefSchema = t.InferType; + +export const refUnionSchema = t.cascade( + t.isObject({ + type: t.isLiteral('union'), + description: t.isOptional(t.isString()), + refs: t.isArray(t.isString()), + closed: t.isOptional(t.isBoolean()), + }), + (value): value is { type: 'union'; description?: string; refs: string[]; closed?: boolean } => { + if (value.closed && value.refs.length === 0) { + throw new Error(`A closed union can't have empty refs list`); + } + return true; + }, +); + +export type RefUnionSchema = t.InferType; + +export const refVariantSchema = t.isOneOf([ + refSchema, + refUnionSchema, +]); + +export type RefVariantSchema = t.InferType; + +export const blobSchema = t.isObject({ + type: t.isLiteral('blob'), + description: t.isOptional(t.isString()), + accept: t.isOptional(t.isArray(t.isString())), + maxSize: t.isOptional(isPositiveInteger), +}); + +export type BlobSchema = t.InferType; + +export const arraySchema = t.isObject({ + type: t.isLiteral('array'), + description: t.isOptional(t.isString()), + items: t.isOneOf([primitiveSchema, ipldTypeSchema, blobSchema, refVariantSchema]), + maxLength: t.isOptional(isPositiveInteger), + minLength: t.isOptional(isPositiveInteger), +}); + +export type ArraySchema = t.InferType; + +export const primitiveArraySchema = t.cascade(arraySchema, (value): value is ArraySchema => { + if (!t.isOneOf([primitiveSchema])(value.items)) { + throw new Error('Array items must be primitive types'); + } + return true; +}); + +export type PrimitiveArraySchema = t.InferType; + +export const tokenSchema = t.isObject({ + type: t.isLiteral('token'), + description: t.isOptional(t.isString()), +}); + +export type TokenSchema = t.InferType; + +function refineRequiredProperties< + T extends { required?: string[]; properties: Record }, +>(schema: t.StrictValidator): t.StrictValidator { + interface RequiredPropertiesSchema { + required?: string[]; + properties: Record; + } + + return t.cascade(schema, (value: RequiredPropertiesSchema): value is RequiredPropertiesSchema => { + if (value.required) { + for (const field of value.required) { + if (value.properties[field] === undefined) { + throw new Error(`Required field "${field}" not defined`); + } + } + } + return true; + }); +} + +export const objectSchema = refineRequiredProperties( + t.isObject({ + type: t.isLiteral('object'), + description: t.isOptional(t.isString()), + required: t.isOptional(t.isArray(t.isString())), + nullable: t.isOptional(t.isArray(t.isString())), + properties: t.isRecord(t.isOneOf([ + refVariantSchema, + ipldTypeSchema, + arraySchema, + blobSchema, + primitiveSchema, + ])), + }), +); + +export type ObjectSchema = t.InferType; + +export const xrpcParametersSchema = refineRequiredProperties( + t.isObject({ + type: t.isLiteral('params'), + description: t.isOptional(t.isString()), + required: t.isOptional(t.isArray(t.isString())), + properties: t.isRecord(t.isOneOf([primitiveSchema, primitiveArraySchema])), + }), +); + +export type XrpcParametersSchema = t.InferType; + +export const xrpcBodySchema = t.isObject({ + description: t.isOptional(t.isString()), + encoding: t.isString(), + schema: t.isOptional(t.isOneOf([refVariantSchema, objectSchema])), +}); + +export type XrpcBodySchema = t.InferType; + +export const xrpcSubscriptionMessageSchema = t.isObject({ + description: t.isOptional(t.isString()), + schema: t.isOptional(t.isOneOf([refVariantSchema, objectSchema])), +}); + +export type XrpcSubscriptionMessageSchema = t.InferType; + +export const xrpcErrorSchema = t.isObject({ + name: t.isString(), + description: t.isOptional(t.isString()), +}); + +export type XrpcErrorSchema = t.InferType; + +export const xrpcQuerySchema = t.isObject({ + type: t.isLiteral('query'), + description: t.isOptional(t.isString()), + parameters: t.isOptional(xrpcParametersSchema), + output: t.isOptional(xrpcBodySchema), + errors: t.isOptional(t.isArray(xrpcErrorSchema)), +}); + +export type XrpcQuerySchema = t.InferType; + +export const xrpcProcedureSchema = t.isObject({ + type: t.isLiteral('procedure'), + description: t.isOptional(t.isString()), + parameters: t.isOptional(xrpcParametersSchema), + input: t.isOptional(xrpcBodySchema), + output: t.isOptional(xrpcBodySchema), + errors: t.isOptional(t.isArray(xrpcErrorSchema)), +}); + +export type XrpcProcedureSchema = t.InferType; + +export const xrpcSubscriptionSchema = t.isObject({ + type: t.isLiteral('subscription'), + description: t.isOptional(t.isString()), + parameters: t.isOptional(xrpcParametersSchema), + message: t.isOptional(xrpcSubscriptionMessageSchema), + errors: t.isOptional(t.isArray(xrpcErrorSchema)), +}); + +export type XrpcSubscriptionSchema = t.InferType; + +export const recordSchema = t.isObject({ + type: t.isLiteral('record'), + description: t.isOptional(t.isString()), + key: t.isOptional(t.isString()), + record: objectSchema, +}); + +export type RecordSchema = t.InferType; + +export const userTypeSchema = t.isOneOf([ + recordSchema, + xrpcQuerySchema, + xrpcProcedureSchema, + xrpcSubscriptionSchema, + blobSchema, + arraySchema, + tokenSchema, + objectSchema, + booleanSchema, + integerSchema, + stringSchema, + bytesSchema, + cidLinkSchema, + unknownSchema, +]); + +export type UserTypeSchema = t.InferType; + +const NSID_RE = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; +const nsidType = t.cascade( + t.isString(), + value => NSID_RE.test(value), +); + +export const documentSchema = t.cascade( + t.isObject({ + lexicon: t.isLiteral(1), + id: nsidType, + revision: t.isOptional(t.isNumber()), + description: t.isOptional(t.isString()), + defs: t.isRecord(userTypeSchema), + }), + (value): value is { lexicon: 1; id: string; revision?: number; description?: string; defs: Record } => { + for (const id in value.defs) { + const def = value.defs[id]; + const type = def.type; + + if ( + id !== 'main' + && (type === 'record' + || type === 'query' + || type === 'procedure' + || type === 'subscription') + ) { + throw new Error(`${type} must be the \`main\` definition (in defs.${id})`); + } + } + return true; + }, +); + +export type DocumentSchema = t.InferType; From 8a4074ca0665a1a94565e3a7720e109e45a2cd26 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:11:06 -0500 Subject: [PATCH 21/68] adding utils --- packages/lex-cli/src/utils/cache.ts | 25 +++++++++++++ packages/lex-cli/src/utils/docs.ts | 24 +++++++++++++ packages/lex-cli/src/utils/formats.ts | 14 ++++++++ packages/lex-cli/src/utils/prelude.ts | 51 +++++++++++++++++++++++++++ packages/lex-cli/src/utils/sort.ts | 28 +++++++++++++++ 5 files changed, 142 insertions(+) create mode 100644 packages/lex-cli/src/utils/cache.ts create mode 100644 packages/lex-cli/src/utils/docs.ts create mode 100644 packages/lex-cli/src/utils/formats.ts create mode 100644 packages/lex-cli/src/utils/prelude.ts create mode 100644 packages/lex-cli/src/utils/sort.ts diff --git a/packages/lex-cli/src/utils/cache.ts b/packages/lex-cli/src/utils/cache.ts new file mode 100644 index 0000000..8e44eda --- /dev/null +++ b/packages/lex-cli/src/utils/cache.ts @@ -0,0 +1,25 @@ +export const toUpperCache: Record = Object.create( + null, +) as Record; +export const toNamespaceCache: Record = Object.create( + null, +) as Record; + +export function toUpper(s: string) { + if (s in toUpperCache) { + return toUpperCache[s]; + } + const value = s[0].toUpperCase() + s.slice(1); + toUpperCache[s] = value; + return value; +} + +export function toNamespace(s: string) { + if (s in toNamespaceCache) { + return toNamespaceCache[s]; + } + const value = s.replace(/^\w|\.\w/g, m => + m[m.length === 1 ? 0 : 1].toUpperCase()); + toNamespaceCache[s] = value; + return value; +} diff --git a/packages/lex-cli/src/utils/docs.ts b/packages/lex-cli/src/utils/docs.ts new file mode 100644 index 0000000..195e29d --- /dev/null +++ b/packages/lex-cli/src/utils/docs.ts @@ -0,0 +1,24 @@ +export function getDescriptions(def: { description?: string }): string[] { + const descs: string[] = []; + if (def.description) { + descs.push(def.description); + if (def.description.toLowerCase().startsWith('deprecated')) { + descs.push('@deprecated'); + } + } + return descs; +} + +export function writeJsdoc(descriptions: string[]) { + if (!descriptions.length) return ''; + + const escaped = descriptions.map(desc => + desc.replace(/\*\//g, '*\\/').replace(/@/g, '\\@'), + ); + + if (escaped.length === 1) { + return `\n/** ${escaped[0]} */\n`; + } + + return `\n/**${escaped.map(desc => `\n * ${desc}`).join('')}\n */\n`; +} diff --git a/packages/lex-cli/src/utils/formats.ts b/packages/lex-cli/src/utils/formats.ts new file mode 100644 index 0000000..30fccd8 --- /dev/null +++ b/packages/lex-cli/src/utils/formats.ts @@ -0,0 +1,14 @@ +export const TYPE_FORMATS = { + DID: 'At.DID', + CID: 'At.CID', + HANDLE: 'At.Handle', + URI: 'At.Uri', +} as const; + +export const IGNORED_FORMATS = new Set([ + 'at-identifier', + 'datetime', + 'language', + 'nsid', + 'uri', +]); diff --git a/packages/lex-cli/src/utils/prelude.ts b/packages/lex-cli/src/utils/prelude.ts new file mode 100644 index 0000000..01d98ef --- /dev/null +++ b/packages/lex-cli/src/utils/prelude.ts @@ -0,0 +1,51 @@ +export const mainPrelude = `type ObjectOmit = Omit; + +/** Handles type branding in objects */ +export declare namespace Brand { + /** Symbol used to brand objects, this does not actually exist in runtime */ + const Type: unique symbol; + + /** Get the intended \`$type\` field */ + type GetType = NonNullable; + + /** Creates a union of objects where it's discriminated by \`$type\` field. */ + type Union = T extends any ? T & { $type: GetType } : never; + + /** Omits the type branding from object */ + type Omit = ObjectOmit; +} + +/** Base AT Protocol schema types */ +export declare namespace At { + /** CID string */ + type CID = string; + + /** DID of a user */ + type DID = \`did:\${string}\`; + + /** User handle */ + type Handle = string; + + /** URI string */ + type Uri = string; + + /** Object containing a CID string */ + interface CIDLink { + $link: CID; + } + + /** Object containing a base64-encoded bytes */ + interface Bytes { + $bytes: string; + } + + /** Blob interface */ + interface Blob { + $type: 'blob'; + mimeType: T; + ref: { + $link: string; + }; + size: number; + } +}`; diff --git a/packages/lex-cli/src/utils/sort.ts b/packages/lex-cli/src/utils/sort.ts new file mode 100644 index 0000000..8f1bbc1 --- /dev/null +++ b/packages/lex-cli/src/utils/sort.ts @@ -0,0 +1,28 @@ +const COLLATOR = new Intl.Collator('en-US'); +export function sortName(a: string, b: string): number { + return COLLATOR.compare(a, b); +} + +export function sortPropertyKeys( + keys: string[], + required?: string[], +): string[] { + return keys.sort((a, b) => { + const aIsOptional = !required || !required.includes(a); + const bIsOptional = !required || !required.includes(b); + if (aIsOptional === bIsOptional) { + return sortName(a, b); + } + return +aIsOptional - +bIsOptional; + }); +} + +export function sortDefinition(a: string, b: string) { + const aIsMain = a === 'main'; + const bIsMain = b === 'main'; + + if (aIsMain === bIsMain) { + return sortName(a, b); + } + return +bIsMain - +aIsMain; +} From b6ca007a96b61af7e9c0f0e5d41b5b3b39156107 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:11:23 -0500 Subject: [PATCH 22/68] revisions to @tsky/lexicons for @tsky/lex-cli --- packages/lexicons/package.json | 8 +- packages/lexicons/scripts/generate-types.ts | 216 +++++++++++--------- packages/lexicons/src/index.ts | 108 ++++++++++ 3 files changed, 227 insertions(+), 105 deletions(-) create mode 100644 packages/lexicons/src/index.ts diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 01bc3c0..4a08792 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -8,14 +8,10 @@ "scripts": { "build": "tsx ./scripts/generate-types.ts" }, - "dependencies": { - "@atproto/lexicon": "^0.4.3", - "@atproto/xrpc": "^0.6.4", - "multiformats": "^13.3.1" - }, "devDependencies": { - "@atproto/lex-cli": "^0.5.2", + "@tsky/lex-cli": "workspace:*", "@types/node": "^22.10.1", + "fast-glob": "^3.3.2", "tar": "^7.4.3", "tsx": "^4.19.2", "typescript": "^5.7.2" diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index 10804f4..78f180f 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -1,99 +1,117 @@ -import { Buffer } from 'node:buffer'; -import { execSync } from 'node:child_process'; -import fs from 'node:fs/promises'; -import path from 'node:path'; -import process from 'node:process'; -import { fileURLToPath } from 'node:url'; -import * as tar from 'tar'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -const LEXICONS_DIR = path.resolve(__dirname, '../lexicons'); -const TYPES_DIR = path.resolve(__dirname, '../src'); -const REPO = 'bluesky-social/atproto'; - -async function findJsonFiles(dir: string): Promise { - const files: string[] = []; - const entries = await fs.readdir(dir, { withFileTypes: true }); - - for (const entry of entries) { - const fullPath = path.join(dir, entry.name); - if (entry.isDirectory()) { - files.push(...await findJsonFiles(fullPath)); - } - else if (entry.isFile() && entry.name.endsWith('.json')) { - files.push(fullPath); - } - } - - return files; -} - -async function main() { - try { - // Ensure directories exist - await fs.mkdir(LEXICONS_DIR, { recursive: true }); - await fs.mkdir(TYPES_DIR, { recursive: true }); - - // Get latest commit SHA for lexicons - console.log('Getting latest lexicon commit...'); - const shaResponse = await fetch(`https://api.github.com/repos/${REPO}/commits?path=lexicons/`); - if (!shaResponse.ok) { - throw new Error(`Failed to get commit SHA: ${shaResponse.statusText}`); - } - - const commits = await shaResponse.json(); - const sha = commits[0]?.sha; - if (!sha) { - throw new Error('No commits found for lexicons'); - } - - // Download specific commit's lexicons - console.log('Downloading lexicons from atproto...'); - const response = await fetch(`https://github.com/${REPO}/archive/${sha}.tar.gz`); - if (!response.ok) { - throw new Error(`Failed to download lexicons: ${response.statusText}`); - } - - // Create a temporary file for the tar download - const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); - await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); - - // Extract only lexicon files - await tar.x({ - file: tarFile, - cwd: LEXICONS_DIR, - filter: path => path.includes('/lexicons/'), - strip: 2, - }); - - // Clean up tar file - await fs.unlink(tarFile); - - // Find all lexicon JSON files - console.log('Finding lexicon files...'); - const lexiconFiles = await findJsonFiles(LEXICONS_DIR); - if (lexiconFiles.length === 0) { - throw new Error('No lexicon files found'); - } - - // Generate types using @atproto/lex-cli - console.log('Generating types...'); - execSync( - `pnpm lex gen-api ${TYPES_DIR} ${lexiconFiles.join(' ')}`, - { - stdio: 'inherit', - cwd: TYPES_DIR, - }, - ); - - console.log('Done! Types generated in', TYPES_DIR); - } - catch (error) { - console.error('Error:', error); - process.exit(1); - } -} - -main(); +import { Buffer } from 'node:buffer'; +import { execSync } from 'node:child_process'; +import fs from 'node:fs/promises'; +import path from 'node:path'; +import process from 'node:process'; +import { fileURLToPath } from 'node:url'; +import glob from 'fast-glob'; +import * as tar from 'tar'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const LEXICONS_DIR = path.resolve(__dirname, '../lexicons'); +const TYPES_OUTPUT_PATH = path.resolve(__dirname, '../src/lib/lexicons.ts'); +const LEX_CLI_PATH = path.resolve(__dirname, '../../lex-cli/dist/index.js'); +const REPO = 'bluesky-social/atproto'; + +async function downloadLexicons() { + // Get latest commit SHA for lexicons + console.log('Getting latest lexicon commit...'); + const shaResponse = await fetch( + `https://api.github.com/repos/${REPO}/commits?path=lexicons/`, + ); + if (!shaResponse.ok) { + throw new Error(`Failed to get commit SHA: ${shaResponse.statusText}`); + } + + const commits = await shaResponse.json(); + const sha = commits[0]?.sha; + if (!sha) { + throw new Error('No commits found for lexicons'); + } + + // Download specific commit's lexicons + console.log('Downloading lexicons from atproto...'); + const response = await fetch( + `https://github.com/${REPO}/archive/${sha}.tar.gz`, + ); + if (!response.ok) { + throw new Error(`Failed to download lexicons: ${response.statusText}`); + } + + // Create a temporary file for the tar download + const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); + await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); + + // Extract only lexicon files + await tar.x({ + file: tarFile, + cwd: LEXICONS_DIR, + filter: (path) => path.includes('/lexicons/'), + strip: 2, + }); + + // Clean up tar file + await fs.unlink(tarFile); +} + +async function main() { + try { + // Ensure directories exist + await fs.mkdir(LEXICONS_DIR, { recursive: true }); + await fs.mkdir(path.dirname(TYPES_OUTPUT_PATH), { recursive: true }); + + // Download latest lexicons + await downloadLexicons(); + + // Define glob patterns for lexicon JSON files + const globPatterns = [ + 'app/bsky/**/*.json', + 'chat/bsky/**/*.json', + 'com/atproto/**/*.json', + 'tools/ozone/**/*.json', + ]; + + // Find all matching lexicon files + const lexiconFiles = await glob(globPatterns, { + cwd: LEXICONS_DIR, + absolute: true, + }); + + if (lexiconFiles.length === 0) { + throw new Error('No lexicon files found'); + } + + // Ensure lex-cli is built + console.log('Building lex-cli...'); + execSync('pnpm --filter @tsky/lex-cli build', { + stdio: 'inherit', + env: process.env, + }); + + const command = [ + 'node', + LEX_CLI_PATH, + 'generate-main', + ...lexiconFiles, + '-o', + TYPES_OUTPUT_PATH, + '--description', + '"Contains type declarations for Bluesky lexicons"', + ].join(' '); + + console.log('Running lex-cli to generate types...'); + execSync(command, { + stdio: 'inherit', + env: process.env, + }); + + console.log('Done! Types generated at', TYPES_OUTPUT_PATH); + } catch (error) { + console.error('Error:', error); + process.exit(1); + } +} + +main(); diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts new file mode 100644 index 0000000..4cbce4d --- /dev/null +++ b/packages/lexicons/src/index.ts @@ -0,0 +1,108 @@ +import type { Procedures, Queries, Records } from './lib/lexicons'; + +export * from './lib/lexicons'; + +// --- Core utility types --- +export type LexiconUnion = T[keyof T]; +export type NSIDOf = T extends { $type: infer U extends string } ? U : never; + +// --- NSID Patterns --- +export const APP_BSKY_PREFIX = 'app.bsky.' as const; +export const COM_ATPROTO_PREFIX = 'com.atproto.' as const; + +export type BskyNSID = `${typeof APP_BSKY_PREFIX}${string}`; +export type AtProtoNSID = `${typeof COM_ATPROTO_PREFIX}${string}`; +export type KnownNSID = BskyNSID | AtProtoNSID; + +// --- Record Types --- +export type RecordDefs = LexiconUnion; +export type BskyRecord = RecordDefs & { $type: BskyNSID }; +export type AtProtoRecord = RecordDefs & { $type: AtProtoNSID }; + +// --- Query Types --- +export type QueryDefs = LexiconUnion; +export type BskyQuery = { + [K in keyof Queries]: K extends BskyNSID ? Queries[K] : never; +}[keyof Queries]; + +export type QueryParams = Queries[T] extends { + params: infer P; +} ? P : never; + +export type QueryOutput = Queries[T]['output']; + +export type QueryErrors = Queries[T] extends { + errors: infer E; +} ? E : never; + +// --- Procedure Types --- +export type ProcedureDefs = LexiconUnion; +export type BskyProcedure = { + [K in keyof Procedures]: K extends BskyNSID ? Procedures[K] : never; +}[keyof Procedures]; + +export type ProcedureParams = Procedures[T] extends { + params: infer P; +} ? P : never; + +export type ProcedureInput = Procedures[T] extends { + input: infer I; +} ? I : never; + +export type ProcedureOutput = Procedures[T] extends { + output: infer O; +} ? O : never; + +export type ProcedureErrors = Procedures[T] extends { + errors: infer E; +} ? E : never; + +// --- Common Bluesky Types --- +export type BskyPost = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.post` }; +export type BskyProfile = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}actor.profile` }; +export type BskyLike = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.like` }; +export type BskyFollow = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}graph.follow` }; + +// --- Type Guards --- +export function isRecord(value: unknown): value is RecordDefs { + return ( + typeof value === 'object' && + value !== null && + '$type' in value && + typeof value.$type === 'string' + ); +} + +export function isBskyRecord(value: unknown): value is BskyRecord { + return isRecord(value) && value.$type.startsWith(APP_BSKY_PREFIX); +} + +export function isAtProtoRecord(value: unknown): value is AtProtoRecord { + return isRecord(value) && value.$type.startsWith(COM_ATPROTO_PREFIX); +} + +export function isBskyPost(value: unknown): value is BskyPost { + return isBskyRecord(value) && value.$type.startsWith(`${APP_BSKY_PREFIX}feed.post`); +} + +// --- Error Types and Guards --- +export type BskyError = { + error: string; + message: string; + statusCode?: number; +}; + +export function isBskyError(value: unknown): value is BskyError { + return ( + typeof value === 'object' && + value !== null && + 'error' in value && + 'message' in value && + typeof (value as BskyError).error === 'string' && + typeof (value as BskyError).message === 'string' + ); +} + +// --- Helper Types --- +export type BskyQueryParams = T extends keyof Queries ? QueryParams : never; +export type BskyProcedureInput = T extends keyof Procedures ? ProcedureInput : never; From 5d9f7f358a74032c536966a277ef359097a0a2ee Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:13:00 -0500 Subject: [PATCH 23/68] adding prepublish --- packages/lex-cli/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index e81e9e9..63e7686 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -5,7 +5,8 @@ "license": "MIT", "bin": "dist/index.js", "scripts": { - "build": "tsc" + "build": "tsc", + "prepublish": "pnpm run build" }, "dependencies": { "clipanion": "4.0.0-rc.4", From e57f97f5ec2124b5b83af590e80c522b65d17226 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:16:22 -0500 Subject: [PATCH 24/68] committing generated types --- packages/lexicons/src/lib/lexicons.ts | 6013 +++++++++++++++++++++++++ 1 file changed, 6013 insertions(+) create mode 100644 packages/lexicons/src/lib/lexicons.ts diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts new file mode 100644 index 0000000..66eed61 --- /dev/null +++ b/packages/lexicons/src/lib/lexicons.ts @@ -0,0 +1,6013 @@ +/* eslint-disable */ +// This file is automatically generated, do not edit! + +/** + * @module + * Contains type declarations for Bluesky lexicons + */ + +type ObjectOmit = Omit; + +/** Handles type branding in objects */ +export declare namespace Brand { + /** Symbol used to brand objects, this does not actually exist in runtime */ + const Type: unique symbol; + + /** Get the intended `$type` field */ + type GetType = NonNullable; + + /** Creates a union of objects where it's discriminated by `$type` field. */ + type Union = T extends any + ? T & { $type: GetType } + : never; + + /** Omits the type branding from object */ + type Omit = ObjectOmit; +} + +/** Base AT Protocol schema types */ +export declare namespace At { + /** CID string */ + type CID = string; + + /** DID of a user */ + type DID = `did:${string}`; + + /** User handle */ + type Handle = string; + + /** URI string */ + type Uri = string; + + /** Object containing a CID string */ + interface CIDLink { + $link: CID; + } + + /** Object containing a base64-encoded bytes */ + interface Bytes { + $bytes: string; + } + + /** Blob interface */ + interface Blob { + $type: "blob"; + mimeType: T; + ref: { + $link: string; + }; + size: number; + } +} +export declare namespace AppBskyActorDefs { + interface AdultContentPref { + [Brand.Type]?: "app.bsky.actor.defs#adultContentPref"; + /** \@default false */ + enabled: boolean; + } + /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ + interface BskyAppProgressGuide { + [Brand.Type]?: "app.bsky.actor.defs#bskyAppProgressGuide"; + /** Maximum string length: 100 */ + guide: string; + } + /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ + interface BskyAppStatePref { + [Brand.Type]?: "app.bsky.actor.defs#bskyAppStatePref"; + activeProgressGuide?: BskyAppProgressGuide; + /** + * Storage for NUXs the user has encountered. + * Maximum array length: 100 + */ + nuxs?: AppBskyActorDefs.Nux[]; + /** + * An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. + * Maximum array length: 1000 + * Maximum string length: 100 + */ + queuedNudges?: string[]; + } + interface ContentLabelPref { + [Brand.Type]?: "app.bsky.actor.defs#contentLabelPref"; + label: string; + visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); + /** Which labeler does this preference apply to? If undefined, applies globally. */ + labelerDid?: At.DID; + } + interface FeedViewPref { + [Brand.Type]?: "app.bsky.actor.defs#feedViewPref"; + /** The URI of the feed, or an identifier which describes the feed. */ + feed: string; + /** Hide quote posts in the feed. */ + hideQuotePosts?: boolean; + /** Hide replies in the feed. */ + hideReplies?: boolean; + /** Hide replies in the feed if they do not have this number of likes. */ + hideRepliesByLikeCount?: number; + /** + * Hide replies in the feed if they are not by followed users. + * \@default true + */ + hideRepliesByUnfollowed?: boolean; + /** Hide reposts in the feed. */ + hideReposts?: boolean; + } + interface HiddenPostsPref { + [Brand.Type]?: "app.bsky.actor.defs#hiddenPostsPref"; + /** A list of URIs of posts the account owner has hidden. */ + items: At.Uri[]; + } + interface InterestsPref { + [Brand.Type]?: "app.bsky.actor.defs#interestsPref"; + /** + * A list of tags which describe the account owner's interests gathered during onboarding. + * Maximum array length: 100 + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tags: string[]; + } + /** The subject's followers whom you also follow */ + interface KnownFollowers { + [Brand.Type]?: "app.bsky.actor.defs#knownFollowers"; + count: number; + /** + * Minimum array length: 0 + * Maximum array length: 5 + */ + followers: ProfileViewBasic[]; + } + interface LabelerPrefItem { + [Brand.Type]?: "app.bsky.actor.defs#labelerPrefItem"; + did: At.DID; + } + interface LabelersPref { + [Brand.Type]?: "app.bsky.actor.defs#labelersPref"; + labelers: LabelerPrefItem[]; + } + /** A word that the account owner has muted. */ + interface MutedWord { + [Brand.Type]?: "app.bsky.actor.defs#mutedWord"; + /** The intended targets of the muted word. */ + targets: AppBskyActorDefs.MutedWordTarget[]; + /** + * The muted word itself. + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + value: string; + /** + * Groups of users to apply the muted word to. If undefined, applies to all users. + * \@default "all" + */ + actorTarget?: "all" | "exclude-following" | (string & {}); + /** The date and time at which the muted word will expire and no longer be applied. */ + expiresAt?: string; + id?: string; + } + interface MutedWordsPref { + [Brand.Type]?: "app.bsky.actor.defs#mutedWordsPref"; + /** A list of words the account owner has muted. */ + items: AppBskyActorDefs.MutedWord[]; + } + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + type MutedWordTarget = "content" | "tag" | (string & {}); + /** A new user experiences (NUX) storage object */ + interface Nux { + [Brand.Type]?: "app.bsky.actor.defs#nux"; + /** \@default false */ + completed: boolean; + /** Maximum string length: 100 */ + id: string; + /** + * Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + data?: string; + /** The date and time at which the NUX will expire and should be considered completed. */ + expiresAt?: string; + } + interface PersonalDetailsPref { + [Brand.Type]?: "app.bsky.actor.defs#personalDetailsPref"; + /** The birth date of account owner. */ + birthDate?: string; + } + type Preferences = Brand.Union< + | AdultContentPref + | BskyAppStatePref + | ContentLabelPref + | FeedViewPref + | HiddenPostsPref + | InterestsPref + | LabelersPref + | MutedWordsPref + | PersonalDetailsPref + | SavedFeedsPref + | SavedFeedsPrefV2 + | ThreadViewPref + >[]; + interface ProfileAssociated { + [Brand.Type]?: "app.bsky.actor.defs#profileAssociated"; + chat?: ProfileAssociatedChat; + feedgens?: number; + labeler?: boolean; + lists?: number; + starterPacks?: number; + } + interface ProfileAssociatedChat { + [Brand.Type]?: "app.bsky.actor.defs#profileAssociatedChat"; + allowIncoming: "all" | "following" | "none" | (string & {}); + } + interface ProfileView { + [Brand.Type]?: "app.bsky.actor.defs#profileView"; + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + createdAt?: string; + /** + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + indexedAt?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: ViewerState; + } + interface ProfileViewBasic { + [Brand.Type]?: "app.bsky.actor.defs#profileViewBasic"; + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + createdAt?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: ViewerState; + } + interface ProfileViewDetailed { + [Brand.Type]?: "app.bsky.actor.defs#profileViewDetailed"; + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + banner?: string; + createdAt?: string; + /** + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + followersCount?: number; + followsCount?: number; + indexedAt?: string; + joinedViaStarterPack?: AppBskyGraphDefs.StarterPackViewBasic; + labels?: ComAtprotoLabelDefs.Label[]; + pinnedPost?: ComAtprotoRepoStrongRef.Main; + postsCount?: number; + viewer?: ViewerState; + } + interface SavedFeed { + [Brand.Type]?: "app.bsky.actor.defs#savedFeed"; + id: string; + pinned: boolean; + type: "feed" | "list" | "timeline" | (string & {}); + value: string; + } + interface SavedFeedsPref { + [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPref"; + pinned: At.Uri[]; + saved: At.Uri[]; + timelineIndex?: number; + } + interface SavedFeedsPrefV2 { + [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPrefV2"; + items: AppBskyActorDefs.SavedFeed[]; + } + interface ThreadViewPref { + [Brand.Type]?: "app.bsky.actor.defs#threadViewPref"; + /** Show followed users at the top of all replies. */ + prioritizeFollowedUsers?: boolean; + /** Sorting mode for threads. */ + sort?: + | "hotness" + | "most-likes" + | "newest" + | "oldest" + | "random" + | (string & {}); + } + /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ + interface ViewerState { + [Brand.Type]?: "app.bsky.actor.defs#viewerState"; + blockedBy?: boolean; + blocking?: At.Uri; + blockingByList?: AppBskyGraphDefs.ListViewBasic; + followedBy?: At.Uri; + following?: At.Uri; + knownFollowers?: KnownFollowers; + muted?: boolean; + mutedByList?: AppBskyGraphDefs.ListViewBasic; + } +} + +/** Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. */ +export declare namespace AppBskyActorGetPreferences { + type Input = undefined; + interface Output { + preferences: AppBskyActorDefs.Preferences; + } +} + +/** Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. */ +export declare namespace AppBskyActorGetProfile { + interface Params { + /** Handle or DID of account to fetch profile of. */ + actor: string; + } + type Input = undefined; + type Output = AppBskyActorDefs.ProfileViewDetailed; +} + +/** Get detailed profile views of multiple actors. */ +export declare namespace AppBskyActorGetProfiles { + interface Params { + /** Maximum array length: 25 */ + actors: string[]; + } + type Input = undefined; + interface Output { + profiles: AppBskyActorDefs.ProfileViewDetailed[]; + } +} + +/** Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. */ +export declare namespace AppBskyActorGetSuggestions { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + actors: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +export declare namespace AppBskyActorProfile { + /** A declaration of a Bluesky account profile. */ + interface Record { + $type: "app.bsky.actor.profile"; + /** Small image to be displayed next to posts from account. AKA, 'profile picture' */ + avatar?: At.Blob; + /** Larger horizontal image to display behind profile view. */ + banner?: At.Blob; + createdAt?: string; + /** + * Free-form profile description text. + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main; + /** Self-label values, specific to the Bluesky application, on the overall account. */ + labels?: Brand.Union; + pinnedPost?: ComAtprotoRepoStrongRef.Main; + } +} + +/** Set the private preferences attached to the account. */ +export declare namespace AppBskyActorPutPreferences { + interface Params {} + interface Input { + preferences: AppBskyActorDefs.Preferences; + } + type Output = undefined; +} + +/** Find actors (profiles) matching search criteria. Does not require auth. */ +export declare namespace AppBskyActorSearchActors { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q?: string; + /** + * DEPRECATED: use 'q' instead. + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output { + actors: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. */ +export declare namespace AppBskyActorSearchActorsTypeahead { + interface Params { + /** + * Minimum: 1 + * Maximum: 100 + * \@default 10 + */ + limit?: number; + /** Search query prefix; not a full query string. */ + q?: string; + /** + * DEPRECATED: use 'q' instead. + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output { + actors: AppBskyActorDefs.ProfileViewBasic[]; + } +} + +export declare namespace AppBskyEmbedDefs { + /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ + interface AspectRatio { + [Brand.Type]?: "app.bsky.embed.defs#aspectRatio"; + /** Minimum: 1 */ + height: number; + /** Minimum: 1 */ + width: number; + } +} + +export declare namespace AppBskyEmbedExternal { + /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ + interface Main { + [Brand.Type]?: "app.bsky.embed.external"; + external: External; + } + interface External { + [Brand.Type]?: "app.bsky.embed.external#external"; + description: string; + title: string; + uri: string; + thumb?: At.Blob; + } + interface View { + [Brand.Type]?: "app.bsky.embed.external#view"; + external: ViewExternal; + } + interface ViewExternal { + [Brand.Type]?: "app.bsky.embed.external#viewExternal"; + description: string; + title: string; + uri: string; + thumb?: string; + } +} + +export declare namespace AppBskyEmbedImages { + interface Main { + [Brand.Type]?: "app.bsky.embed.images"; + /** Maximum array length: 4 */ + images: Image[]; + } + interface Image { + [Brand.Type]?: "app.bsky.embed.images#image"; + /** Alt text description of the image, for accessibility. */ + alt: string; + image: At.Blob; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + } + interface View { + [Brand.Type]?: "app.bsky.embed.images#view"; + /** Maximum array length: 4 */ + images: ViewImage[]; + } + interface ViewImage { + [Brand.Type]?: "app.bsky.embed.images#viewImage"; + /** Alt text description of the image, for accessibility. */ + alt: string; + /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ + fullsize: string; + /** Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. */ + thumb: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + } +} + +export declare namespace AppBskyEmbedRecord { + interface Main { + [Brand.Type]?: "app.bsky.embed.record"; + record: ComAtprotoRepoStrongRef.Main; + } + interface View { + [Brand.Type]?: "app.bsky.embed.record#view"; + record: Brand.Union< + | ViewBlocked + | ViewDetached + | ViewNotFound + | ViewRecord + | AppBskyFeedDefs.GeneratorView + | AppBskyGraphDefs.ListView + | AppBskyGraphDefs.StarterPackViewBasic + | AppBskyLabelerDefs.LabelerView + >; + } + interface ViewBlocked { + [Brand.Type]?: "app.bsky.embed.record#viewBlocked"; + author: AppBskyFeedDefs.BlockedAuthor; + blocked: boolean; + uri: At.Uri; + } + interface ViewDetached { + [Brand.Type]?: "app.bsky.embed.record#viewDetached"; + detached: boolean; + uri: At.Uri; + } + interface ViewNotFound { + [Brand.Type]?: "app.bsky.embed.record#viewNotFound"; + notFound: boolean; + uri: At.Uri; + } + interface ViewRecord { + [Brand.Type]?: "app.bsky.embed.record#viewRecord"; + author: AppBskyActorDefs.ProfileViewBasic; + cid: At.CID; + indexedAt: string; + uri: At.Uri; + /** The record data itself. */ + value: unknown; + embeds?: Brand.Union< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedRecord.View + | AppBskyEmbedRecordWithMedia.View + | AppBskyEmbedVideo.View + >[]; + labels?: ComAtprotoLabelDefs.Label[]; + likeCount?: number; + quoteCount?: number; + replyCount?: number; + repostCount?: number; + } +} + +export declare namespace AppBskyEmbedRecordWithMedia { + interface Main { + [Brand.Type]?: "app.bsky.embed.recordWithMedia"; + media: Brand.Union< + | AppBskyEmbedExternal.Main + | AppBskyEmbedImages.Main + | AppBskyEmbedVideo.Main + >; + record: AppBskyEmbedRecord.Main; + } + interface View { + [Brand.Type]?: "app.bsky.embed.recordWithMedia#view"; + media: Brand.Union< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedVideo.View + >; + record: AppBskyEmbedRecord.View; + } +} + +export declare namespace AppBskyEmbedVideo { + interface Main { + [Brand.Type]?: "app.bsky.embed.video"; + video: At.Blob; + /** + * Alt text description of the video, for accessibility. + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + alt?: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + /** Maximum array length: 20 */ + captions?: Caption[]; + } + interface Caption { + [Brand.Type]?: "app.bsky.embed.video#caption"; + file: At.Blob; + lang: string; + } + interface View { + [Brand.Type]?: "app.bsky.embed.video#view"; + cid: At.CID; + playlist: string; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + alt?: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + thumbnail?: string; + } +} + +export declare namespace AppBskyFeedDefs { + interface BlockedAuthor { + [Brand.Type]?: "app.bsky.feed.defs#blockedAuthor"; + did: At.DID; + viewer?: AppBskyActorDefs.ViewerState; + } + interface BlockedPost { + [Brand.Type]?: "app.bsky.feed.defs#blockedPost"; + author: BlockedAuthor; + blocked: boolean; + uri: At.Uri; + } + type ClickthroughAuthor = "app.bsky.feed.defs#clickthroughAuthor"; + type ClickthroughEmbed = "app.bsky.feed.defs#clickthroughEmbed"; + type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; + type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; + interface FeedViewPost { + [Brand.Type]?: "app.bsky.feed.defs#feedViewPost"; + post: PostView; + /** + * Context provided by feed generator that may be passed back alongside interactions. + * Maximum string length: 2000 + */ + feedContext?: string; + reason?: Brand.Union; + reply?: ReplyRef; + } + interface GeneratorView { + [Brand.Type]?: "app.bsky.feed.defs#generatorView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + did: At.DID; + displayName: string; + indexedAt: string; + uri: At.Uri; + acceptsInteractions?: boolean; + avatar?: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: GeneratorViewerState; + } + interface GeneratorViewerState { + [Brand.Type]?: "app.bsky.feed.defs#generatorViewerState"; + like?: At.Uri; + } + interface Interaction { + [Brand.Type]?: "app.bsky.feed.defs#interaction"; + event?: + | "app.bsky.feed.defs#clickthroughAuthor" + | "app.bsky.feed.defs#clickthroughEmbed" + | "app.bsky.feed.defs#clickthroughItem" + | "app.bsky.feed.defs#clickthroughReposter" + | "app.bsky.feed.defs#interactionLike" + | "app.bsky.feed.defs#interactionQuote" + | "app.bsky.feed.defs#interactionReply" + | "app.bsky.feed.defs#interactionRepost" + | "app.bsky.feed.defs#interactionSeen" + | "app.bsky.feed.defs#interactionShare" + | "app.bsky.feed.defs#requestLess" + | "app.bsky.feed.defs#requestMore" + | (string & {}); + /** + * Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. + * Maximum string length: 2000 + */ + feedContext?: string; + item?: At.Uri; + } + type InteractionLike = "app.bsky.feed.defs#interactionLike"; + type InteractionQuote = "app.bsky.feed.defs#interactionQuote"; + type InteractionReply = "app.bsky.feed.defs#interactionReply"; + type InteractionRepost = "app.bsky.feed.defs#interactionRepost"; + type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; + type InteractionShare = "app.bsky.feed.defs#interactionShare"; + interface NotFoundPost { + [Brand.Type]?: "app.bsky.feed.defs#notFoundPost"; + notFound: boolean; + uri: At.Uri; + } + interface PostView { + [Brand.Type]?: "app.bsky.feed.defs#postView"; + author: AppBskyActorDefs.ProfileViewBasic; + cid: At.CID; + indexedAt: string; + record: unknown; + uri: At.Uri; + embed?: Brand.Union< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedRecord.View + | AppBskyEmbedRecordWithMedia.View + | AppBskyEmbedVideo.View + >; + labels?: ComAtprotoLabelDefs.Label[]; + likeCount?: number; + quoteCount?: number; + replyCount?: number; + repostCount?: number; + threadgate?: ThreadgateView; + viewer?: ViewerState; + } + interface ReasonPin { + [Brand.Type]?: "app.bsky.feed.defs#reasonPin"; + } + interface ReasonRepost { + [Brand.Type]?: "app.bsky.feed.defs#reasonRepost"; + by: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + } + interface ReplyRef { + [Brand.Type]?: "app.bsky.feed.defs#replyRef"; + parent: Brand.Union; + root: Brand.Union; + /** When parent is a reply to another post, this is the author of that post. */ + grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic; + } + type RequestLess = "app.bsky.feed.defs#requestLess"; + type RequestMore = "app.bsky.feed.defs#requestMore"; + interface SkeletonFeedPost { + [Brand.Type]?: "app.bsky.feed.defs#skeletonFeedPost"; + post: At.Uri; + /** + * Context that will be passed through to client and may be passed to feed generator back alongside interactions. + * Maximum string length: 2000 + */ + feedContext?: string; + reason?: Brand.Union; + } + interface SkeletonReasonPin { + [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonPin"; + } + interface SkeletonReasonRepost { + [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonRepost"; + repost: At.Uri; + } + interface ThreadgateView { + [Brand.Type]?: "app.bsky.feed.defs#threadgateView"; + cid?: At.CID; + lists?: AppBskyGraphDefs.ListViewBasic[]; + record?: unknown; + uri?: At.Uri; + } + interface ThreadViewPost { + [Brand.Type]?: "app.bsky.feed.defs#threadViewPost"; + post: PostView; + parent?: Brand.Union; + replies?: Brand.Union[]; + } + /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ + interface ViewerState { + [Brand.Type]?: "app.bsky.feed.defs#viewerState"; + embeddingDisabled?: boolean; + like?: At.Uri; + pinned?: boolean; + replyDisabled?: boolean; + repost?: At.Uri; + threadMuted?: boolean; + } +} + +/** Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). */ +export declare namespace AppBskyFeedDescribeFeedGenerator { + interface Params {} + type Input = undefined; + interface Output { + did: At.DID; + feeds: Feed[]; + links?: Links; + } + interface Feed { + [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#feed"; + uri: At.Uri; + } + interface Links { + [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#links"; + privacyPolicy?: string; + termsOfService?: string; + } +} + +export declare namespace AppBskyFeedGenerator { + /** Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. */ + interface Record { + $type: "app.bsky.feed.generator"; + createdAt: string; + did: At.DID; + /** + * Maximum string length: 240 + * Maximum grapheme length: 24 + */ + displayName: string; + /** Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions */ + acceptsInteractions?: boolean; + avatar?: At.Blob; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + /** Self-label values */ + labels?: Brand.Union; + } +} + +/** Get a list of feeds (feed generator records) created by the actor (in the actor's repo). */ +export declare namespace AppBskyFeedGetActorFeeds { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. */ +export declare namespace AppBskyFeedGetActorLikes { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + BlockedActor: {}; + BlockedByActor: {}; + } +} + +/** Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. */ +export declare namespace AppBskyFeedGetAuthorFeed { + interface Params { + actor: string; + cursor?: string; + /** + * Combinations of post/repost types to include in response. + * \@default "posts_with_replies" + */ + filter?: + | "posts_and_author_threads" + | "posts_no_replies" + | "posts_with_media" + | "posts_with_replies" + | (string & {}); + /** \@default false */ + includePins?: boolean; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + BlockedActor: {}; + BlockedByActor: {}; + } +} + +/** Get a hydrated feed from an actor's selected feed generator. Implemented by App View. */ +export declare namespace AppBskyFeedGetFeed { + interface Params { + feed: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + UnknownFeed: {}; + } +} + +/** Get information about a feed generator. Implemented by AppView. */ +export declare namespace AppBskyFeedGetFeedGenerator { + interface Params { + /** AT-URI of the feed generator record. */ + feed: At.Uri; + } + type Input = undefined; + interface Output { + /** Indicates whether the feed generator service has been online recently, or else seems to be inactive. */ + isOnline: boolean; + /** Indicates whether the feed generator service is compatible with the record declaration. */ + isValid: boolean; + view: AppBskyFeedDefs.GeneratorView; + } +} + +/** Get information about a list of feed generators. */ +export declare namespace AppBskyFeedGetFeedGenerators { + interface Params { + feeds: At.Uri[]; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + } +} + +/** Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. */ +export declare namespace AppBskyFeedGetFeedSkeleton { + interface Params { + /** Reference to feed generator record describing the specific feed being requested. */ + feed: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.SkeletonFeedPost[]; + cursor?: string; + } + interface Errors { + UnknownFeed: {}; + } +} + +/** Get like records which reference a subject (by AT-URI and CID). */ +export declare namespace AppBskyFeedGetLikes { + interface Params { + /** AT-URI of the subject (eg, a post record). */ + uri: At.Uri; + /** CID of the subject record (aka, specific version of record), to filter likes. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + likes: Like[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } + interface Like { + [Brand.Type]?: "app.bsky.feed.getLikes#like"; + actor: AppBskyActorDefs.ProfileView; + createdAt: string; + indexedAt: string; + } +} + +/** Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. */ +export declare namespace AppBskyFeedGetListFeed { + interface Params { + /** Reference (AT-URI) to the list record. */ + list: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + UnknownList: {}; + } +} + +/** Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. */ +export declare namespace AppBskyFeedGetPosts { + interface Params { + /** + * List of post AT-URIs to return hydrated views for. + * Maximum array length: 25 + */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output { + posts: AppBskyFeedDefs.PostView[]; + } +} + +/** Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. */ +export declare namespace AppBskyFeedGetPostThread { + interface Params { + /** Reference (AT-URI) to post record. */ + uri: At.Uri; + /** + * How many levels of reply depth should be included in response. + * Minimum: 0 + * Maximum: 1000 + * \@default 6 + */ + depth?: number; + /** + * How many levels of parent (and grandparent, etc) post to include. + * Minimum: 0 + * Maximum: 1000 + * \@default 80 + */ + parentHeight?: number; + } + type Input = undefined; + interface Output { + thread: Brand.Union< + | AppBskyFeedDefs.BlockedPost + | AppBskyFeedDefs.NotFoundPost + | AppBskyFeedDefs.ThreadViewPost + >; + threadgate?: AppBskyFeedDefs.ThreadgateView; + } + interface Errors { + NotFound: {}; + } +} + +/** Get a list of quotes for a given post. */ +export declare namespace AppBskyFeedGetQuotes { + interface Params { + /** Reference (AT-URI) of post record */ + uri: At.Uri; + /** If supplied, filters to quotes of specific version (by CID) of the post record. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + posts: AppBskyFeedDefs.PostView[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } +} + +/** Get a list of reposts for a given post. */ +export declare namespace AppBskyFeedGetRepostedBy { + interface Params { + /** Reference (AT-URI) of post record */ + uri: At.Uri; + /** If supplied, filters to reposts of specific version (by CID) of the post record. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + repostedBy: AppBskyActorDefs.ProfileView[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } +} + +/** Get a list of suggested feeds (feed generators) for the requesting account. */ +export declare namespace AppBskyFeedGetSuggestedFeeds { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. */ +export declare namespace AppBskyFeedGetTimeline { + interface Params { + /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ + algorithm?: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } +} + +export declare namespace AppBskyFeedLike { + /** Record declaring a 'like' of a piece of subject content. */ + interface Record { + $type: "app.bsky.feed.like"; + createdAt: string; + subject: ComAtprotoRepoStrongRef.Main; + } +} + +export declare namespace AppBskyFeedPost { + /** Record containing a Bluesky post. */ + interface Record { + $type: "app.bsky.feed.post"; + /** Client-declared timestamp when this post was originally created. */ + createdAt: string; + /** + * The primary post content. May be an empty string, if there are embeds. + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + text: string; + embed?: Brand.Union< + | AppBskyEmbedExternal.Main + | AppBskyEmbedImages.Main + | AppBskyEmbedRecord.Main + | AppBskyEmbedRecordWithMedia.Main + | AppBskyEmbedVideo.Main + >; + /** + * DEPRECATED: replaced by app.bsky.richtext.facet. + * \@deprecated + */ + entities?: Entity[]; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + /** Self-label values for this post. Effectively content warnings. */ + labels?: Brand.Union; + /** + * Indicates human language of post primary text content. + * Maximum array length: 3 + */ + langs?: string[]; + reply?: ReplyRef; + /** + * Additional hashtags, in addition to any included in post text and facets. + * Maximum array length: 8 + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tags?: string[]; + } + /** + * Deprecated: use facets instead. + * \@deprecated + */ + interface Entity { + [Brand.Type]?: "app.bsky.feed.post#entity"; + index: TextSlice; + /** Expected values are 'mention' and 'link'. */ + type: string; + value: string; + } + interface ReplyRef { + [Brand.Type]?: "app.bsky.feed.post#replyRef"; + parent: ComAtprotoRepoStrongRef.Main; + root: ComAtprotoRepoStrongRef.Main; + } + /** + * Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. + * \@deprecated + */ + interface TextSlice { + [Brand.Type]?: "app.bsky.feed.post#textSlice"; + /** Minimum: 0 */ + end: number; + /** Minimum: 0 */ + start: number; + } +} + +export declare namespace AppBskyFeedPostgate { + /** Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. */ + interface Record { + $type: "app.bsky.feed.postgate"; + createdAt: string; + /** Reference (AT-URI) to the post record. */ + post: At.Uri; + /** + * List of AT-URIs embedding this post that the author has detached from. + * Maximum array length: 50 + */ + detachedEmbeddingUris?: At.Uri[]; + /** Maximum array length: 5 */ + embeddingRules?: Brand.Union[]; + } + /** Disables embedding of this post. */ + interface DisableRule { + [Brand.Type]?: "app.bsky.feed.postgate#disableRule"; + } +} + +export declare namespace AppBskyFeedRepost { + /** Record representing a 'repost' of an existing Bluesky post. */ + interface Record { + $type: "app.bsky.feed.repost"; + createdAt: string; + subject: ComAtprotoRepoStrongRef.Main; + } +} + +/** Find posts matching search criteria, returning views of those posts. */ +export declare namespace AppBskyFeedSearchPosts { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ + author?: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ + domain?: string; + /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ + lang?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ + mentions?: string; + /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ + since?: string; + /** + * Specifies the ranking order of results. + * \@default "latest" + */ + sort?: "latest" | "top" | (string & {}); + /** + * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag?: string[]; + /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ + until?: string; + /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ + url?: string; + } + type Input = undefined; + interface Output { + posts: AppBskyFeedDefs.PostView[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +/** Send information about interactions with feed items back to the feed generator that served them. */ +export declare namespace AppBskyFeedSendInteractions { + interface Params {} + interface Input { + interactions: AppBskyFeedDefs.Interaction[]; + } + interface Output {} +} + +export declare namespace AppBskyFeedThreadgate { + /** Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. */ + interface Record { + $type: "app.bsky.feed.threadgate"; + createdAt: string; + /** Reference (AT-URI) to the post record. */ + post: At.Uri; + /** Maximum array length: 5 */ + allow?: Brand.Union[]; + /** + * List of hidden reply URIs. + * Maximum array length: 50 + */ + hiddenReplies?: At.Uri[]; + } + /** Allow replies from actors you follow. */ + interface FollowingRule { + [Brand.Type]?: "app.bsky.feed.threadgate#followingRule"; + } + /** Allow replies from actors on a list. */ + interface ListRule { + [Brand.Type]?: "app.bsky.feed.threadgate#listRule"; + list: At.Uri; + } + /** Allow replies from actors mentioned in your post. */ + interface MentionRule { + [Brand.Type]?: "app.bsky.feed.threadgate#mentionRule"; + } +} + +export declare namespace AppBskyGraphBlock { + /** Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. */ + interface Record { + $type: "app.bsky.graph.block"; + createdAt: string; + /** DID of the account to be blocked. */ + subject: At.DID; + } +} + +export declare namespace AppBskyGraphDefs { + type Curatelist = "app.bsky.graph.defs#curatelist"; + interface ListItemView { + [Brand.Type]?: "app.bsky.graph.defs#listItemView"; + subject: AppBskyActorDefs.ProfileView; + uri: At.Uri; + } + type ListPurpose = + | "app.bsky.graph.defs#curatelist" + | "app.bsky.graph.defs#modlist" + | "app.bsky.graph.defs#referencelist" + | (string & {}); + interface ListView { + [Brand.Type]?: "app.bsky.graph.defs#listView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + /** + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + purpose: ListPurpose; + uri: At.Uri; + avatar?: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + viewer?: ListViewerState; + } + interface ListViewBasic { + [Brand.Type]?: "app.bsky.graph.defs#listViewBasic"; + cid: At.CID; + /** + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + purpose: ListPurpose; + uri: At.Uri; + avatar?: string; + indexedAt?: string; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + viewer?: ListViewerState; + } + interface ListViewerState { + [Brand.Type]?: "app.bsky.graph.defs#listViewerState"; + blocked?: At.Uri; + muted?: boolean; + } + type Modlist = "app.bsky.graph.defs#modlist"; + /** indicates that a handle or DID could not be resolved */ + interface NotFoundActor { + [Brand.Type]?: "app.bsky.graph.defs#notFoundActor"; + actor: string; + notFound: boolean; + } + type Referencelist = "app.bsky.graph.defs#referencelist"; + /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ + interface Relationship { + [Brand.Type]?: "app.bsky.graph.defs#relationship"; + did: At.DID; + /** if the actor is followed by this DID, contains the AT-URI of the follow record */ + followedBy?: At.Uri; + /** if the actor follows this DID, this is the AT-URI of the follow record */ + following?: At.Uri; + } + interface StarterPackView { + [Brand.Type]?: "app.bsky.graph.defs#starterPackView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + record: unknown; + uri: At.Uri; + /** Maximum array length: 3 */ + feeds?: AppBskyFeedDefs.GeneratorView[]; + /** Minimum: 0 */ + joinedAllTimeCount?: number; + /** Minimum: 0 */ + joinedWeekCount?: number; + labels?: ComAtprotoLabelDefs.Label[]; + list?: ListViewBasic; + /** Maximum array length: 12 */ + listItemsSample?: ListItemView[]; + } + interface StarterPackViewBasic { + [Brand.Type]?: "app.bsky.graph.defs#starterPackViewBasic"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + record: unknown; + uri: At.Uri; + /** Minimum: 0 */ + joinedAllTimeCount?: number; + /** Minimum: 0 */ + joinedWeekCount?: number; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + } +} + +export declare namespace AppBskyGraphFollow { + /** Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. */ + interface Record { + $type: "app.bsky.graph.follow"; + createdAt: string; + subject: At.DID; + } +} + +/** Get a list of starter packs created by the actor. */ +export declare namespace AppBskyGraphGetActorStarterPacks { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + cursor?: string; + } +} + +/** Enumerates which accounts the requesting account is currently blocking. Requires auth. */ +export declare namespace AppBskyGraphGetBlocks { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + blocks: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Enumerates accounts which follow a specified account (actor). */ +export declare namespace AppBskyGraphGetFollowers { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + followers: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Enumerates accounts which a specified account (actor) follows. */ +export declare namespace AppBskyGraphGetFollows { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + follows: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Enumerates accounts which follow a specified account (actor) and are followed by the viewer. */ +export declare namespace AppBskyGraphGetKnownFollowers { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + followers: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Gets a 'view' (with additional context) of a specified list. */ +export declare namespace AppBskyGraphGetList { + interface Params { + /** Reference (AT-URI) of the list record to hydrate. */ + list: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + items: AppBskyGraphDefs.ListItemView[]; + list: AppBskyGraphDefs.ListView; + cursor?: string; + } +} + +/** Get mod lists that the requesting account (actor) is blocking. Requires auth. */ +export declare namespace AppBskyGraphGetListBlocks { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. */ +export declare namespace AppBskyGraphGetListMutes { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates the lists created by a specified account (actor). */ +export declare namespace AppBskyGraphGetLists { + interface Params { + /** The account (actor) to enumerate lists from. */ + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. */ +export declare namespace AppBskyGraphGetMutes { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + mutes: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Enumerates public relationships between one account, and a list of other accounts. Does not require auth. */ +export declare namespace AppBskyGraphGetRelationships { + interface Params { + /** Primary account requesting relationships for. */ + actor: string; + /** + * List of 'other' accounts to be related back to the primary. + * Maximum array length: 30 + */ + others?: string[]; + } + type Input = undefined; + interface Output { + relationships: Brand.Union< + AppBskyGraphDefs.NotFoundActor | AppBskyGraphDefs.Relationship + >[]; + actor?: At.DID; + } + interface Errors { + ActorNotFound: {}; + } +} + +/** Gets a view of a starter pack. */ +export declare namespace AppBskyGraphGetStarterPack { + interface Params { + /** Reference (AT-URI) of the starter pack record. */ + starterPack: At.Uri; + } + type Input = undefined; + interface Output { + starterPack: AppBskyGraphDefs.StarterPackView; + } +} + +/** Get views for a list of starter packs. */ +export declare namespace AppBskyGraphGetStarterPacks { + interface Params { + /** Maximum array length: 25 */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + } +} + +/** Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. */ +export declare namespace AppBskyGraphGetSuggestedFollowsByActor { + interface Params { + actor: string; + } + type Input = undefined; + interface Output { + suggestions: AppBskyActorDefs.ProfileView[]; + /** + * If true, response has fallen-back to generic results, and is not scoped using relativeToDid + * \@default false + */ + isFallback?: boolean; + } +} + +export declare namespace AppBskyGraphList { + /** Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. */ + interface Record { + $type: "app.bsky.graph.list"; + createdAt: string; + /** + * Display name for list; can not be empty. + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + /** Defines the purpose of the list (aka, moderation-oriented or curration-oriented) */ + purpose: AppBskyGraphDefs.ListPurpose; + avatar?: At.Blob; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: Brand.Union; + } +} + +export declare namespace AppBskyGraphListblock { + /** Record representing a block relationship against an entire an entire list of accounts (actors). */ + interface Record { + $type: "app.bsky.graph.listblock"; + createdAt: string; + /** Reference (AT-URI) to the mod list record. */ + subject: At.Uri; + } +} + +export declare namespace AppBskyGraphListitem { + /** Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. */ + interface Record { + $type: "app.bsky.graph.listitem"; + createdAt: string; + /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ + list: At.Uri; + /** The account which is included on the list. */ + subject: At.DID; + } +} + +/** Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteActor { + interface Params {} + interface Input { + actor: string; + } + type Output = undefined; +} + +/** Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteActorList { + interface Params {} + interface Input { + list: At.Uri; + } + type Output = undefined; +} + +/** Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteThread { + interface Params {} + interface Input { + root: At.Uri; + } + type Output = undefined; +} + +/** Find starter packs matching search criteria. Does not require auth. */ +export declare namespace AppBskyGraphSearchStarterPacks { + interface Params { + /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + cursor?: string; + } +} + +export declare namespace AppBskyGraphStarterpack { + /** Record defining a starter pack of actors and feeds for new users. */ + interface Record { + $type: "app.bsky.graph.starterpack"; + createdAt: string; + /** Reference (AT-URI) to the list record. */ + list: At.Uri; + /** + * Display name for starter pack; can not be empty. + * Minimum string length: 1 + * Maximum string length: 500 + * Maximum grapheme length: 50 + */ + name: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + /** Maximum array length: 3 */ + feeds?: FeedItem[]; + } + interface FeedItem { + [Brand.Type]?: "app.bsky.graph.starterpack#feedItem"; + uri: At.Uri; + } +} + +/** Unmutes the specified account. Requires auth. */ +export declare namespace AppBskyGraphUnmuteActor { + interface Params {} + interface Input { + actor: string; + } + type Output = undefined; +} + +/** Unmutes the specified list of accounts. Requires auth. */ +export declare namespace AppBskyGraphUnmuteActorList { + interface Params {} + interface Input { + list: At.Uri; + } + type Output = undefined; +} + +/** Unmutes the specified thread. Requires auth. */ +export declare namespace AppBskyGraphUnmuteThread { + interface Params {} + interface Input { + root: At.Uri; + } + type Output = undefined; +} + +export declare namespace AppBskyLabelerDefs { + interface LabelerPolicies { + [Brand.Type]?: "app.bsky.labeler.defs#labelerPolicies"; + /** The label values which this labeler publishes. May include global or custom labels. */ + labelValues: ComAtprotoLabelDefs.LabelValue[]; + /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ + labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; + } + interface LabelerView { + [Brand.Type]?: "app.bsky.labeler.defs#labelerView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: LabelerViewerState; + } + interface LabelerViewDetailed { + [Brand.Type]?: "app.bsky.labeler.defs#labelerViewDetailed"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + policies: AppBskyLabelerDefs.LabelerPolicies; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: LabelerViewerState; + } + interface LabelerViewerState { + [Brand.Type]?: "app.bsky.labeler.defs#labelerViewerState"; + like?: At.Uri; + } +} + +/** Get information about a list of labeler services. */ +export declare namespace AppBskyLabelerGetServices { + interface Params { + dids: At.DID[]; + /** \@default false */ + detailed?: boolean; + } + type Input = undefined; + interface Output { + views: Brand.Union< + AppBskyLabelerDefs.LabelerView | AppBskyLabelerDefs.LabelerViewDetailed + >[]; + } +} + +export declare namespace AppBskyLabelerService { + /** A declaration of the existence of labeler service. */ + interface Record { + $type: "app.bsky.labeler.service"; + createdAt: string; + policies: AppBskyLabelerDefs.LabelerPolicies; + labels?: Brand.Union; + } +} + +/** Count the number of unread notifications for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationGetUnreadCount { + interface Params { + priority?: boolean; + seenAt?: string; + } + type Input = undefined; + interface Output { + count: number; + } +} + +/** Enumerate notifications for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationListNotifications { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + priority?: boolean; + seenAt?: string; + } + type Input = undefined; + interface Output { + notifications: Notification[]; + cursor?: string; + priority?: boolean; + seenAt?: string; + } + interface Notification { + [Brand.Type]?: "app.bsky.notification.listNotifications#notification"; + author: AppBskyActorDefs.ProfileView; + cid: At.CID; + indexedAt: string; + isRead: boolean; + /** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', and 'starterpack-joined'. */ + reason: + | "follow" + | "like" + | "mention" + | "quote" + | "reply" + | "repost" + | "starterpack-joined" + | (string & {}); + record: unknown; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + reasonSubject?: At.Uri; + } +} + +/** Set notification-related preferences for an account. Requires auth. */ +export declare namespace AppBskyNotificationPutPreferences { + interface Params {} + interface Input { + priority: boolean; + } + type Output = undefined; +} + +/** Register to receive push notifications, via a specified service, for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationRegisterPush { + interface Params {} + interface Input { + appId: string; + platform: "android" | "ios" | "web" | (string & {}); + serviceDid: At.DID; + token: string; + } + type Output = undefined; +} + +/** Notify server that the requesting account has seen notifications. Requires auth. */ +export declare namespace AppBskyNotificationUpdateSeen { + interface Params {} + interface Input { + seenAt: string; + } + type Output = undefined; +} + +export declare namespace AppBskyRichtextFacet { + /** Annotation of a sub-string within rich text. */ + interface Main { + [Brand.Type]?: "app.bsky.richtext.facet"; + features: Brand.Union[]; + index: ByteSlice; + } + /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ + interface ByteSlice { + [Brand.Type]?: "app.bsky.richtext.facet#byteSlice"; + /** Minimum: 0 */ + byteEnd: number; + /** Minimum: 0 */ + byteStart: number; + } + /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ + interface Link { + [Brand.Type]?: "app.bsky.richtext.facet#link"; + uri: string; + } + /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ + interface Mention { + [Brand.Type]?: "app.bsky.richtext.facet#mention"; + did: At.DID; + } + /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ + interface Tag { + [Brand.Type]?: "app.bsky.richtext.facet#tag"; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag: string; + } +} + +export declare namespace AppBskyUnspeccedDefs { + interface SkeletonSearchActor { + [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchActor"; + did: At.DID; + } + interface SkeletonSearchPost { + [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchPost"; + uri: At.Uri; + } + interface SkeletonSearchStarterPack { + [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; + uri: At.Uri; + } +} + +/** Get miscellaneous runtime configuration. */ +export declare namespace AppBskyUnspeccedGetConfig { + interface Params {} + type Input = undefined; + interface Output { + checkEmailConfirmed?: boolean; + } +} + +/** An unspecced view of globally popular feed generators. */ +export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + query?: string; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions */ +export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. */ + relativeToDid?: At.DID; + /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; + cursor?: string; + /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ + relativeToDid?: At.DID; + } +} + +/** Get a list of suggestions (feeds and users) tagged with categories */ +export declare namespace AppBskyUnspeccedGetTaggedSuggestions { + type Input = undefined; + interface Output { + suggestions: Suggestion[]; + } + interface Suggestion { + [Brand.Type]?: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; + subject: string; + subjectType: "actor" | "feed" | (string & {}); + tag: string; + } +} + +/** Backend Actors (profile) search, returns only skeleton. */ +export declare namespace AppBskyUnspeccedSearchActorsSkeleton { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ + q: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** If true, acts as fast/simple 'typeahead' query. */ + typeahead?: boolean; + /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +/** Backend Posts search, returns only skeleton */ +export declare namespace AppBskyUnspeccedSearchPostsSkeleton { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ + author?: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ + domain?: string; + /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ + lang?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ + mentions?: string; + /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ + since?: string; + /** + * Specifies the ranking order of results. + * \@default "latest" + */ + sort?: "latest" | "top" | (string & {}); + /** + * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag?: string[]; + /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ + until?: string; + /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ + url?: string; + /** DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +/** Backend Starter Pack search, returns only skeleton. */ +export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** DID of the account making the request (not included for public/unauthenticated queries). */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +export declare namespace AppBskyVideoDefs { + interface JobStatus { + [Brand.Type]?: "app.bsky.video.defs#jobStatus"; + did: At.DID; + jobId: string; + /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ + state: "JOB_STATE_COMPLETED" | "JOB_STATE_FAILED" | (string & {}); + blob?: At.Blob; + error?: string; + message?: string; + /** + * Progress within the current processing state. + * Minimum: 0 + * Maximum: 100 + */ + progress?: number; + } +} + +/** Get status details for a video processing job. */ +export declare namespace AppBskyVideoGetJobStatus { + interface Params { + jobId: string; + } + type Input = undefined; + interface Output { + jobStatus: AppBskyVideoDefs.JobStatus; + } +} + +/** Get video upload limits for the authenticated user. */ +export declare namespace AppBskyVideoGetUploadLimits { + interface Params {} + type Input = undefined; + interface Output { + canUpload: boolean; + error?: string; + message?: string; + remainingDailyBytes?: number; + remainingDailyVideos?: number; + } +} + +/** Upload a video to be processed then stored on the PDS. */ +export declare namespace AppBskyVideoUploadVideo { + interface Params {} + type Input = Blob | ArrayBufferView; + interface Output { + jobStatus: AppBskyVideoDefs.JobStatus; + } +} + +export declare namespace ChatBskyActorDeclaration { + /** A declaration of a Bluesky chat account. */ + interface Record { + $type: "chat.bsky.actor.declaration"; + allowIncoming: "all" | "following" | "none" | (string & {}); + } +} + +export declare namespace ChatBskyActorDefs { + interface ProfileViewBasic { + [Brand.Type]?: "chat.bsky.actor.defs#profileViewBasic"; + did: At.DID; + handle: At.Handle; + associated?: AppBskyActorDefs.ProfileAssociated; + avatar?: string; + /** Set to true when the actor cannot actively participate in converations */ + chatDisabled?: boolean; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: AppBskyActorDefs.ViewerState; + } +} + +export declare namespace ChatBskyActorDeleteAccount { + interface Params {} + type Input = undefined; + interface Output {} +} + +export declare namespace ChatBskyActorExportAccountData { + interface Params {} + type Input = undefined; + type Output = Uint8Array; +} + +export declare namespace ChatBskyConvoDefs { + interface ConvoView { + [Brand.Type]?: "chat.bsky.convo.defs#convoView"; + id: string; + members: ChatBskyActorDefs.ProfileViewBasic[]; + muted: boolean; + rev: string; + unreadCount: number; + lastMessage?: Brand.Union; + opened?: boolean; + } + interface DeletedMessageView { + [Brand.Type]?: "chat.bsky.convo.defs#deletedMessageView"; + id: string; + rev: string; + sender: MessageViewSender; + sentAt: string; + } + interface LogBeginConvo { + [Brand.Type]?: "chat.bsky.convo.defs#logBeginConvo"; + convoId: string; + rev: string; + } + interface LogCreateMessage { + [Brand.Type]?: "chat.bsky.convo.defs#logCreateMessage"; + convoId: string; + message: Brand.Union; + rev: string; + } + interface LogDeleteMessage { + [Brand.Type]?: "chat.bsky.convo.defs#logDeleteMessage"; + convoId: string; + message: Brand.Union; + rev: string; + } + interface LogLeaveConvo { + [Brand.Type]?: "chat.bsky.convo.defs#logLeaveConvo"; + convoId: string; + rev: string; + } + interface MessageInput { + [Brand.Type]?: "chat.bsky.convo.defs#messageInput"; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + text: string; + embed?: Brand.Union; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + } + interface MessageRef { + [Brand.Type]?: "chat.bsky.convo.defs#messageRef"; + convoId: string; + did: At.DID; + messageId: string; + } + interface MessageView { + [Brand.Type]?: "chat.bsky.convo.defs#messageView"; + id: string; + rev: string; + sender: MessageViewSender; + sentAt: string; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + text: string; + embed?: Brand.Union; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + } + interface MessageViewSender { + [Brand.Type]?: "chat.bsky.convo.defs#messageViewSender"; + did: At.DID; + } +} + +export declare namespace ChatBskyConvoDeleteMessageForSelf { + interface Params {} + interface Input { + convoId: string; + messageId: string; + } + type Output = ChatBskyConvoDefs.DeletedMessageView; +} + +export declare namespace ChatBskyConvoGetConvo { + interface Params { + convoId: string; + } + type Input = undefined; + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoGetConvoForMembers { + interface Params { + /** + * Minimum array length: 1 + * Maximum array length: 10 + */ + members: At.DID[]; + } + type Input = undefined; + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoGetLog { + interface Params { + cursor?: string; + } + type Input = undefined; + interface Output { + logs: Brand.Union< + | ChatBskyConvoDefs.LogBeginConvo + | ChatBskyConvoDefs.LogCreateMessage + | ChatBskyConvoDefs.LogDeleteMessage + | ChatBskyConvoDefs.LogLeaveConvo + >[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoGetMessages { + interface Params { + convoId: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + messages: Brand.Union< + ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView + >[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoLeaveConvo { + interface Params {} + interface Input { + convoId: string; + } + interface Output { + convoId: string; + rev: string; + } +} + +export declare namespace ChatBskyConvoListConvos { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + convos: ChatBskyConvoDefs.ConvoView[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoMuteConvo { + interface Params {} + interface Input { + convoId: string; + } + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoSendMessage { + interface Params {} + interface Input { + convoId: string; + message: ChatBskyConvoDefs.MessageInput; + } + type Output = ChatBskyConvoDefs.MessageView; +} + +export declare namespace ChatBskyConvoSendMessageBatch { + interface Params {} + interface Input { + /** Maximum array length: 100 */ + items: BatchItem[]; + } + interface Output { + items: ChatBskyConvoDefs.MessageView[]; + } + interface BatchItem { + [Brand.Type]?: "chat.bsky.convo.sendMessageBatch#batchItem"; + convoId: string; + message: ChatBskyConvoDefs.MessageInput; + } +} + +export declare namespace ChatBskyConvoUnmuteConvo { + interface Params {} + interface Input { + convoId: string; + } + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoUpdateRead { + interface Params {} + interface Input { + convoId: string; + messageId?: string; + } + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyModerationGetActorMetadata { + interface Params { + actor: At.DID; + } + type Input = undefined; + interface Output { + all: Metadata; + day: Metadata; + month: Metadata; + } + interface Metadata { + [Brand.Type]?: "chat.bsky.moderation.getActorMetadata#metadata"; + convos: number; + convosStarted: number; + messagesReceived: number; + messagesSent: number; + } +} + +export declare namespace ChatBskyModerationGetMessageContext { + interface Params { + messageId: string; + /** \@default 5 */ + after?: number; + /** \@default 5 */ + before?: number; + /** Conversation that the message is from. NOTE: this field will eventually be required. */ + convoId?: string; + } + type Input = undefined; + interface Output { + messages: Brand.Union< + ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView + >[]; + } +} + +export declare namespace ChatBskyModerationUpdateActorAccess { + interface Params {} + interface Input { + actor: At.DID; + allowAccess: boolean; + ref?: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoAdminDefs { + interface AccountView { + [Brand.Type]?: "com.atproto.admin.defs#accountView"; + did: At.DID; + handle: At.Handle; + indexedAt: string; + deactivatedAt?: string; + email?: string; + emailConfirmedAt?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invites?: ComAtprotoServerDefs.InviteCode[]; + invitesDisabled?: boolean; + relatedRecords?: unknown[]; + threatSignatures?: ThreatSignature[]; + } + interface RepoBlobRef { + [Brand.Type]?: "com.atproto.admin.defs#repoBlobRef"; + cid: At.CID; + did: At.DID; + recordUri?: At.Uri; + } + interface RepoRef { + [Brand.Type]?: "com.atproto.admin.defs#repoRef"; + did: At.DID; + } + interface StatusAttr { + [Brand.Type]?: "com.atproto.admin.defs#statusAttr"; + applied: boolean; + ref?: string; + } + interface ThreatSignature { + [Brand.Type]?: "com.atproto.admin.defs#threatSignature"; + property: string; + value: string; + } +} + +/** Delete a user account as an administrator. */ +export declare namespace ComAtprotoAdminDeleteAccount { + interface Params {} + interface Input { + did: At.DID; + } + type Output = undefined; +} + +/** Disable an account from receiving new invite codes, but does not invalidate existing codes. */ +export declare namespace ComAtprotoAdminDisableAccountInvites { + interface Params {} + interface Input { + account: At.DID; + /** Optional reason for disabled invites. */ + note?: string; + } + type Output = undefined; +} + +/** Disable some set of codes and/or all codes associated with a set of users. */ +export declare namespace ComAtprotoAdminDisableInviteCodes { + interface Params {} + interface Input { + accounts?: string[]; + codes?: string[]; + } + type Output = undefined; +} + +/** Re-enable an account's ability to receive invite codes. */ +export declare namespace ComAtprotoAdminEnableAccountInvites { + interface Params {} + interface Input { + account: At.DID; + /** Optional reason for enabled invites. */ + note?: string; + } + type Output = undefined; +} + +/** Get details about an account. */ +export declare namespace ComAtprotoAdminGetAccountInfo { + interface Params { + did: At.DID; + } + type Input = undefined; + type Output = ComAtprotoAdminDefs.AccountView; +} + +/** Get details about some accounts. */ +export declare namespace ComAtprotoAdminGetAccountInfos { + interface Params { + dids: At.DID[]; + } + type Input = undefined; + interface Output { + infos: ComAtprotoAdminDefs.AccountView[]; + } +} + +/** Get an admin view of invite codes. */ +export declare namespace ComAtprotoAdminGetInviteCodes { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 500 + * \@default 100 + */ + limit?: number; + /** \@default "recent" */ + sort?: "recent" | "usage" | (string & {}); + } + type Input = undefined; + interface Output { + codes: ComAtprotoServerDefs.InviteCode[]; + cursor?: string; + } +} + +/** Get the service-specific admin status of a subject (account, record, or blob). */ +export declare namespace ComAtprotoAdminGetSubjectStatus { + interface Params { + blob?: At.CID; + did?: At.DID; + uri?: At.Uri; + } + type Input = undefined; + interface Output { + subject: Brand.Union< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + deactivated?: ComAtprotoAdminDefs.StatusAttr; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } +} + +/** Get list of accounts that matches your search query. */ +export declare namespace ComAtprotoAdminSearchAccounts { + interface Params { + cursor?: string; + email?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + accounts: ComAtprotoAdminDefs.AccountView[]; + cursor?: string; + } +} + +/** Send email to a user's account email address. */ +export declare namespace ComAtprotoAdminSendEmail { + interface Params {} + interface Input { + content: string; + recipientDid: At.DID; + senderDid: At.DID; + /** Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers */ + comment?: string; + subject?: string; + } + interface Output { + sent: boolean; + } +} + +/** Administrative action to update an account's email. */ +export declare namespace ComAtprotoAdminUpdateAccountEmail { + interface Params {} + interface Input { + /** The handle or DID of the repo. */ + account: string; + email: string; + } + type Output = undefined; +} + +/** Administrative action to update an account's handle. */ +export declare namespace ComAtprotoAdminUpdateAccountHandle { + interface Params {} + interface Input { + did: At.DID; + handle: At.Handle; + } + type Output = undefined; +} + +/** Update the password for a user account as an administrator. */ +export declare namespace ComAtprotoAdminUpdateAccountPassword { + interface Params {} + interface Input { + did: At.DID; + password: string; + } + type Output = undefined; +} + +/** Update the service-specific admin status of a subject (account, record, or blob). */ +export declare namespace ComAtprotoAdminUpdateSubjectStatus { + interface Params {} + interface Input { + subject: Brand.Union< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + deactivated?: ComAtprotoAdminDefs.StatusAttr; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } + interface Output { + subject: Brand.Union< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } +} + +/** Describe the credentials that should be included in the DID doc of an account that is migrating to this service. */ +export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { + interface Params {} + type Input = undefined; + interface Output { + alsoKnownAs?: string[]; + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[]; + services?: unknown; + verificationMethods?: unknown; + } +} + +/** Request an email with a code to in order to request a signed PLC operation. Requires Auth. */ +export declare namespace ComAtprotoIdentityRequestPlcOperationSignature { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Resolves a handle (domain name) to a DID. */ +export declare namespace ComAtprotoIdentityResolveHandle { + interface Params { + /** The handle to resolve. */ + handle: At.Handle; + } + type Input = undefined; + interface Output { + did: At.DID; + } +} + +/** Signs a PLC operation to update some value(s) in the requesting DID's document. */ +export declare namespace ComAtprotoIdentitySignPlcOperation { + interface Params {} + interface Input { + alsoKnownAs?: string[]; + rotationKeys?: string[]; + services?: unknown; + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string; + verificationMethods?: unknown; + } + interface Output { + /** A signed DID PLC operation. */ + operation: unknown; + } +} + +/** Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry */ +export declare namespace ComAtprotoIdentitySubmitPlcOperation { + interface Params {} + interface Input { + operation: unknown; + } + type Output = undefined; +} + +/** Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. */ +export declare namespace ComAtprotoIdentityUpdateHandle { + interface Params {} + interface Input { + /** The new handle. */ + handle: At.Handle; + } + type Output = undefined; +} + +export declare namespace ComAtprotoLabelDefs { + /** Metadata tag on an atproto resource (eg, repo or record). */ + interface Label { + [Brand.Type]?: "com.atproto.label.defs#label"; + /** Timestamp when this label was created. */ + cts: string; + /** DID of the actor who created this label. */ + src: At.DID; + /** AT URI of the record, repository (account), or other resource that this label applies to. */ + uri: string; + /** + * The short string name of the value or type of this label. + * Maximum string length: 128 + */ + val: string; + /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */ + cid?: At.CID; + /** Timestamp at which this label expires (no longer applies). */ + exp?: string; + /** If true, this is a negation label, overwriting a previous label. */ + neg?: boolean; + /** Signature of dag-cbor encoded label. */ + sig?: At.Bytes; + /** The AT Protocol version of the label object. */ + ver?: number; + } + type LabelValue = + | "!hide" + | "!no-promote" + | "!no-unauthenticated" + | "!warn" + | "dmca-violation" + | "doxxing" + | "gore" + | "nsfl" + | "nudity" + | "porn" + | "sexual" + | (string & {}); + /** Declares a label value and its expected interpretations and behaviors. */ + interface LabelValueDefinition { + [Brand.Type]?: "com.atproto.label.defs#labelValueDefinition"; + /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ + blurs: "content" | "media" | "none" | (string & {}); + /** + * The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). + * Maximum string length: 100 + * Maximum grapheme length: 100 + */ + identifier: string; + locales: LabelValueDefinitionStrings[]; + /** How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. */ + severity: "alert" | "inform" | "none" | (string & {}); + /** Does the user need to have adult content enabled in order to configure this label? */ + adultOnly?: boolean; + /** + * The default setting for this label. + * \@default "warn" + */ + defaultSetting?: "hide" | "ignore" | "warn" | (string & {}); + } + /** Strings which describe the label in the UI, localized into a specific language. */ + interface LabelValueDefinitionStrings { + [Brand.Type]?: "com.atproto.label.defs#labelValueDefinitionStrings"; + /** + * A longer description of what the label means and why it might be applied. + * Maximum string length: 100000 + * Maximum grapheme length: 10000 + */ + description: string; + /** The code of the language these strings are written in. */ + lang: string; + /** + * A short human-readable name for the label. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + name: string; + } + /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ + interface SelfLabel { + [Brand.Type]?: "com.atproto.label.defs#selfLabel"; + /** + * The short string name of the value or type of this label. + * Maximum string length: 128 + */ + val: string; + } + /** Metadata tags on an atproto record, published by the author within the record. */ + interface SelfLabels { + [Brand.Type]?: "com.atproto.label.defs#selfLabels"; + /** Maximum array length: 10 */ + values: SelfLabel[]; + } +} + +/** Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. */ +export declare namespace ComAtprotoLabelQueryLabels { + interface Params { + /** 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. */ + uriPatterns: string[]; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 250 + * \@default 50 + */ + limit?: number; + /** Optional list of label sources (DIDs) to filter on. */ + sources?: At.DID[]; + } + type Input = undefined; + interface Output { + labels: ComAtprotoLabelDefs.Label[]; + cursor?: string; + } +} + +export declare namespace ComAtprotoLabelSubscribeLabels { + interface Params { + /** The last known event seq number to backfill from. */ + cursor?: number; + } + type Message = Brand.Union; + interface Errors { + FutureCursor: {}; + } + interface Info { + [Brand.Type]?: "com.atproto.label.subscribeLabels#info"; + name: "OutdatedCursor" | (string & {}); + message?: string; + } + interface Labels { + [Brand.Type]?: "com.atproto.label.subscribeLabels#labels"; + labels: ComAtprotoLabelDefs.Label[]; + seq: number; + } +} + +/** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */ +export declare namespace ComAtprotoModerationCreateReport { + interface Params {} + interface Input { + /** Indicates the broad category of violation the report is for. */ + reasonType: ComAtprotoModerationDefs.ReasonType; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** + * Additional context about the content and violation. + * Maximum string length: 20000 + * Maximum grapheme length: 2000 + */ + reason?: string; + } + interface Output { + createdAt: string; + id: number; + reasonType: ComAtprotoModerationDefs.ReasonType; + reportedBy: At.DID; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** + * Maximum string length: 20000 + * Maximum grapheme length: 2000 + */ + reason?: string; + } +} + +export declare namespace ComAtprotoModerationDefs { + type ReasonAppeal = "com.atproto.moderation.defs#reasonAppeal"; + type ReasonMisleading = "com.atproto.moderation.defs#reasonMisleading"; + type ReasonOther = "com.atproto.moderation.defs#reasonOther"; + type ReasonRude = "com.atproto.moderation.defs#reasonRude"; + type ReasonSexual = "com.atproto.moderation.defs#reasonSexual"; + type ReasonSpam = "com.atproto.moderation.defs#reasonSpam"; + type ReasonType = + | "com.atproto.moderation.defs#reasonAppeal" + | "com.atproto.moderation.defs#reasonMisleading" + | "com.atproto.moderation.defs#reasonOther" + | "com.atproto.moderation.defs#reasonRude" + | "com.atproto.moderation.defs#reasonSexual" + | "com.atproto.moderation.defs#reasonSpam" + | "com.atproto.moderation.defs#reasonViolation" + | (string & {}); + type ReasonViolation = "com.atproto.moderation.defs#reasonViolation"; +} + +/** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoApplyWrites { + interface Params {} + interface Input { + /** The handle or DID of the repo (aka, current account). */ + repo: string; + writes: Brand.Union[]; + /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */ + swapCommit?: At.CID; + /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output { + commit?: ComAtprotoRepoDefs.CommitMeta; + results?: Brand.Union[]; + } + interface Errors { + InvalidSwap: {}; + } + /** Operation which creates a new record. */ + interface Create { + [Brand.Type]?: "com.atproto.repo.applyWrites#create"; + collection: string; + value: unknown; + /** Maximum string length: 512 */ + rkey?: string; + } + interface CreateResult { + [Brand.Type]?: "com.atproto.repo.applyWrites#createResult"; + cid: At.CID; + uri: At.Uri; + validationStatus?: "unknown" | "valid" | (string & {}); + } + /** Operation which deletes an existing record. */ + interface Delete { + [Brand.Type]?: "com.atproto.repo.applyWrites#delete"; + collection: string; + rkey: string; + } + interface DeleteResult { + [Brand.Type]?: "com.atproto.repo.applyWrites#deleteResult"; + } + /** Operation which updates an existing record. */ + interface Update { + [Brand.Type]?: "com.atproto.repo.applyWrites#update"; + collection: string; + rkey: string; + value: unknown; + } + interface UpdateResult { + [Brand.Type]?: "com.atproto.repo.applyWrites#updateResult"; + cid: At.CID; + uri: At.Uri; + validationStatus?: "unknown" | "valid" | (string & {}); + } +} + +/** Create a single new repository record. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoCreateRecord { + interface Params {} + interface Input { + /** The NSID of the record collection. */ + collection: string; + /** The record itself. Must contain a $type field. */ + record: unknown; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** + * The Record Key. + * Maximum string length: 512 + */ + rkey?: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output { + cid: At.CID; + uri: At.Uri; + commit?: ComAtprotoRepoDefs.CommitMeta; + validationStatus?: "unknown" | "valid" | (string & {}); + } + interface Errors { + InvalidSwap: {}; + } +} + +export declare namespace ComAtprotoRepoDefs { + interface CommitMeta { + [Brand.Type]?: "com.atproto.repo.defs#commitMeta"; + cid: At.CID; + rev: string; + } +} + +/** Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoDeleteRecord { + interface Params {} + interface Input { + /** The NSID of the record collection. */ + collection: string; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** The Record Key. */ + rkey: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Compare and swap with the previous record by CID. */ + swapRecord?: At.CID; + } + interface Output { + commit?: ComAtprotoRepoDefs.CommitMeta; + } + interface Errors { + InvalidSwap: {}; + } +} + +/** Get information about an account and repository, including the list of collections. Does not require auth. */ +export declare namespace ComAtprotoRepoDescribeRepo { + interface Params { + /** The handle or DID of the repo. */ + repo: string; + } + type Input = undefined; + interface Output { + /** List of all the collections (NSIDs) for which this repo contains at least one record. */ + collections: string[]; + did: At.DID; + /** The complete DID document for this account. */ + didDoc: unknown; + handle: At.Handle; + /** Indicates if handle is currently valid (resolves bi-directionally) */ + handleIsCorrect: boolean; + } +} + +/** Get a single record from a repository. Does not require auth. */ +export declare namespace ComAtprotoRepoGetRecord { + interface Params { + /** The NSID of the record collection. */ + collection: string; + /** The handle or DID of the repo. */ + repo: string; + /** The Record Key. */ + rkey: string; + /** The CID of the version of the record. If not specified, then return the most recent version. */ + cid?: At.CID; + } + type Input = undefined; + interface Output { + uri: At.Uri; + value: unknown; + cid?: At.CID; + } + interface Errors { + RecordNotFound: {}; + } +} + +/** Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. */ +export declare namespace ComAtprotoRepoImportRepo { + interface Params {} + type Input = Blob | ArrayBufferView; + type Output = undefined; +} + +/** Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. */ +export declare namespace ComAtprotoRepoListMissingBlobs { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + } + type Input = undefined; + interface Output { + blobs: RecordBlob[]; + cursor?: string; + } + interface RecordBlob { + [Brand.Type]?: "com.atproto.repo.listMissingBlobs#recordBlob"; + cid: At.CID; + recordUri: At.Uri; + } +} + +/** List a range of records in a repository, matching a specific collection. Does not require auth. */ +export declare namespace ComAtprotoRepoListRecords { + interface Params { + /** The NSID of the record type. */ + collection: string; + /** The handle or DID of the repo. */ + repo: string; + cursor?: string; + /** + * The number of records to return. + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** Flag to reverse the order of the returned records. */ + reverse?: boolean; + /** + * DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) + * \@deprecated + */ + rkeyEnd?: string; + /** + * DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) + * \@deprecated + */ + rkeyStart?: string; + } + type Input = undefined; + interface Output { + records: Record[]; + cursor?: string; + } + interface Record { + [Brand.Type]?: "com.atproto.repo.listRecords#record"; + cid: At.CID; + uri: At.Uri; + value: unknown; + } +} + +/** Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoPutRecord { + interface Params {} + interface Input { + /** The NSID of the record collection. */ + collection: string; + /** The record to write. */ + record: unknown; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** + * The Record Key. + * Maximum string length: 512 + */ + rkey: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */ + swapRecord?: At.CID | null; + /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output { + cid: At.CID; + uri: At.Uri; + commit?: ComAtprotoRepoDefs.CommitMeta; + validationStatus?: "unknown" | "valid" | (string & {}); + } + interface Errors { + InvalidSwap: {}; + } +} + +export declare namespace ComAtprotoRepoStrongRef { + interface Main { + [Brand.Type]?: "com.atproto.repo.strongRef"; + cid: At.CID; + uri: At.Uri; + } +} + +/** Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoUploadBlob { + interface Params {} + type Input = Blob | ArrayBufferView; + interface Output { + blob: At.Blob; + } +} + +/** Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. */ +export declare namespace ComAtprotoServerActivateAccount { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. */ +export declare namespace ComAtprotoServerCheckAccountStatus { + interface Params {} + type Input = undefined; + interface Output { + activated: boolean; + expectedBlobs: number; + importedBlobs: number; + indexedRecords: number; + privateStateValues: number; + repoBlocks: number; + repoCommit: At.CID; + repoRev: string; + validDid: boolean; + } +} + +/** Confirm an email using a token from com.atproto.server.requestEmailConfirmation. */ +export declare namespace ComAtprotoServerConfirmEmail { + interface Params {} + interface Input { + email: string; + token: string; + } + type Output = undefined; + interface Errors { + AccountNotFound: {}; + ExpiredToken: {}; + InvalidToken: {}; + InvalidEmail: {}; + } +} + +/** Create an account. Implemented by PDS. */ +export declare namespace ComAtprotoServerCreateAccount { + interface Params {} + interface Input { + /** Requested handle for the account. */ + handle: At.Handle; + /** Pre-existing atproto DID, being imported to a new account. */ + did?: At.DID; + email?: string; + inviteCode?: string; + /** Initial account password. May need to meet instance-specific password strength requirements. */ + password?: string; + /** A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. */ + plcOp?: unknown; + /** DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. */ + recoveryKey?: string; + verificationCode?: string; + verificationPhone?: string; + } + /** Account login session returned on successful account creation. */ + interface Output { + accessJwt: string; + /** The DID of the new account. */ + did: At.DID; + handle: At.Handle; + refreshJwt: string; + /** Complete DID document. */ + didDoc?: unknown; + } + interface Errors { + InvalidHandle: {}; + InvalidPassword: {}; + InvalidInviteCode: {}; + HandleNotAvailable: {}; + UnsupportedDomain: {}; + UnresolvableDid: {}; + IncompatibleDidDoc: {}; + } +} + +/** Create an App Password. */ +export declare namespace ComAtprotoServerCreateAppPassword { + interface Params {} + interface Input { + /** A short name for the App Password, to help distinguish them. */ + name: string; + /** If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. */ + privileged?: boolean; + } + type Output = AppPassword; + interface Errors { + AccountTakedown: {}; + } + interface AppPassword { + [Brand.Type]?: "com.atproto.server.createAppPassword#appPassword"; + createdAt: string; + name: string; + password: string; + privileged?: boolean; + } +} + +/** Create an invite code. */ +export declare namespace ComAtprotoServerCreateInviteCode { + interface Params {} + interface Input { + useCount: number; + forAccount?: At.DID; + } + interface Output { + code: string; + } +} + +/** Create invite codes. */ +export declare namespace ComAtprotoServerCreateInviteCodes { + interface Params {} + interface Input { + /** \@default 1 */ + codeCount: number; + useCount: number; + forAccounts?: At.DID[]; + } + interface Output { + codes: AccountCodes[]; + } + interface AccountCodes { + [Brand.Type]?: "com.atproto.server.createInviteCodes#accountCodes"; + account: string; + codes: string[]; + } +} + +/** Create an authentication session. */ +export declare namespace ComAtprotoServerCreateSession { + interface Params {} + interface Input { + /** Handle or other identifier supported by the server for the authenticating user. */ + identifier: string; + password: string; + authFactorToken?: string; + } + interface Output { + accessJwt: string; + did: At.DID; + handle: At.Handle; + refreshJwt: string; + active?: boolean; + didDoc?: unknown; + email?: string; + emailAuthFactor?: boolean; + emailConfirmed?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } + interface Errors { + AccountTakedown: {}; + AuthFactorTokenRequired: {}; + } +} + +/** Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. */ +export declare namespace ComAtprotoServerDeactivateAccount { + interface Params {} + interface Input { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoServerDefs { + interface InviteCode { + [Brand.Type]?: "com.atproto.server.defs#inviteCode"; + available: number; + code: string; + createdAt: string; + createdBy: string; + disabled: boolean; + forAccount: string; + uses: InviteCodeUse[]; + } + interface InviteCodeUse { + [Brand.Type]?: "com.atproto.server.defs#inviteCodeUse"; + usedAt: string; + usedBy: At.DID; + } +} + +/** Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. */ +export declare namespace ComAtprotoServerDeleteAccount { + interface Params {} + interface Input { + did: At.DID; + password: string; + token: string; + } + type Output = undefined; + interface Errors { + ExpiredToken: {}; + InvalidToken: {}; + } +} + +/** Delete the current session. Requires auth. */ +export declare namespace ComAtprotoServerDeleteSession { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Describes the server's account creation requirements and capabilities. Implemented by PDS. */ +export declare namespace ComAtprotoServerDescribeServer { + interface Params {} + type Input = undefined; + interface Output { + /** List of domain suffixes that can be used in account handles. */ + availableUserDomains: string[]; + did: At.DID; + /** Contact information */ + contact?: Contact; + /** If true, an invite code must be supplied to create an account on this instance. */ + inviteCodeRequired?: boolean; + /** URLs of service policy documents. */ + links?: Links; + /** If true, a phone verification token must be supplied to create an account on this instance. */ + phoneVerificationRequired?: boolean; + } + interface Contact { + [Brand.Type]?: "com.atproto.server.describeServer#contact"; + email?: string; + } + interface Links { + [Brand.Type]?: "com.atproto.server.describeServer#links"; + privacyPolicy?: string; + termsOfService?: string; + } +} + +/** Get all invite codes for the current account. Requires auth. */ +export declare namespace ComAtprotoServerGetAccountInviteCodes { + interface Params { + /** + * Controls whether any new 'earned' but not 'created' invites should be created. + * \@default true + */ + createAvailable?: boolean; + /** \@default true */ + includeUsed?: boolean; + } + type Input = undefined; + interface Output { + codes: ComAtprotoServerDefs.InviteCode[]; + } + interface Errors { + DuplicateCreate: {}; + } +} + +/** Get a signed token on behalf of the requesting DID for the requested service. */ +export declare namespace ComAtprotoServerGetServiceAuth { + interface Params { + /** The DID of the service that the token will be used to authenticate with */ + aud: At.DID; + /** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */ + exp?: number; + /** Lexicon (XRPC) method to bind the requested token to */ + lxm?: string; + } + type Input = undefined; + interface Output { + token: string; + } + interface Errors { + BadExpiration: {}; + } +} + +/** Get information about the current auth session. Requires auth. */ +export declare namespace ComAtprotoServerGetSession { + interface Params {} + type Input = undefined; + interface Output { + did: At.DID; + handle: At.Handle; + active?: boolean; + didDoc?: unknown; + email?: string; + emailAuthFactor?: boolean; + emailConfirmed?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } +} + +/** List all App Passwords. */ +export declare namespace ComAtprotoServerListAppPasswords { + interface Params {} + type Input = undefined; + interface Output { + passwords: AppPassword[]; + } + interface Errors { + AccountTakedown: {}; + } + interface AppPassword { + [Brand.Type]?: "com.atproto.server.listAppPasswords#appPassword"; + createdAt: string; + name: string; + privileged?: boolean; + } +} + +/** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */ +export declare namespace ComAtprotoServerRefreshSession { + interface Params {} + type Input = undefined; + interface Output { + accessJwt: string; + did: At.DID; + handle: At.Handle; + refreshJwt: string; + active?: boolean; + didDoc?: unknown; + /** Hosting status of the account. If not specified, then assume 'active'. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } + interface Errors { + AccountTakedown: {}; + } +} + +/** Initiate a user account deletion via email. */ +export declare namespace ComAtprotoServerRequestAccountDelete { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Request an email with a code to confirm ownership of email. */ +export declare namespace ComAtprotoServerRequestEmailConfirmation { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Request a token in order to update email. */ +export declare namespace ComAtprotoServerRequestEmailUpdate { + interface Params {} + type Input = undefined; + interface Output { + tokenRequired: boolean; + } +} + +/** Initiate a user account password reset via email. */ +export declare namespace ComAtprotoServerRequestPasswordReset { + interface Params {} + interface Input { + email: string; + } + type Output = undefined; +} + +/** Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. */ +export declare namespace ComAtprotoServerReserveSigningKey { + interface Params {} + interface Input { + /** The DID to reserve a key for. */ + did?: At.DID; + } + interface Output { + /** The public key for the reserved signing key, in did:key serialization. */ + signingKey: string; + } +} + +/** Reset a user account password using a token. */ +export declare namespace ComAtprotoServerResetPassword { + interface Params {} + interface Input { + password: string; + token: string; + } + type Output = undefined; + interface Errors { + ExpiredToken: {}; + InvalidToken: {}; + } +} + +/** Revoke an App Password by name. */ +export declare namespace ComAtprotoServerRevokeAppPassword { + interface Params {} + interface Input { + name: string; + } + type Output = undefined; +} + +/** Update an account's email. */ +export declare namespace ComAtprotoServerUpdateEmail { + interface Params {} + interface Input { + email: string; + emailAuthFactor?: boolean; + /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */ + token?: string; + } + type Output = undefined; + interface Errors { + ExpiredToken: {}; + InvalidToken: {}; + TokenRequired: {}; + } +} + +/** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetBlob { + interface Params { + /** The CID of the blob to fetch */ + cid: At.CID; + /** The DID of the account. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + BlobNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetBlocks { + interface Params { + cids: At.CID[]; + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + BlockNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** + * DEPRECATED - please use com.atproto.sync.getRepo instead + * \@deprecated + */ +export declare namespace ComAtprotoSyncGetCheckout { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; +} + +/** + * DEPRECATED - please use com.atproto.sync.getLatestCommit instead + * \@deprecated + */ +export declare namespace ComAtprotoSyncGetHead { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output { + root: At.CID; + } + interface Errors { + HeadNotFound: {}; + } +} + +/** Get the current commit CID & revision of the specified repo. Does not require auth. */ +export declare namespace ComAtprotoSyncGetLatestCommit { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output { + cid: At.CID; + rev: string; + } + interface Errors { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */ +export declare namespace ComAtprotoSyncGetRecord { + interface Params { + collection: string; + /** The DID of the repo. */ + did: At.DID; + /** Record Key */ + rkey: string; + /** + * DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit + * \@deprecated + */ + commit?: At.CID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + RecordNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetRepo { + interface Params { + /** The DID of the repo. */ + did: At.DID; + /** The revision ('rev') of the repo to create a diff from. */ + since?: string; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. */ +export declare namespace ComAtprotoSyncGetRepoStatus { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output { + active: boolean; + did: At.DID; + /** Optional field, the current rev of the repo, if active=true */ + rev?: string; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } + interface Errors { + RepoNotFound: {}; + } +} + +/** List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncListBlobs { + interface Params { + /** The DID of the repo. */ + did: At.DID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + /** Optional revision of the repo to list blobs since. */ + since?: string; + } + type Input = undefined; + interface Output { + cids: At.CID[]; + cursor?: string; + } + interface Errors { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */ +export declare namespace ComAtprotoSyncListRepos { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + } + type Input = undefined; + interface Output { + repos: Repo[]; + cursor?: string; + } + interface Repo { + [Brand.Type]?: "com.atproto.sync.listRepos#repo"; + did: At.DID; + /** Current repo commit CID */ + head: At.CID; + rev: string; + active?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } +} + +/** Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. */ +export declare namespace ComAtprotoSyncNotifyOfUpdate { + interface Params {} + interface Input { + /** Hostname of the current service (usually a PDS) that is notifying of update. */ + hostname: string; + } + type Output = undefined; +} + +/** Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. */ +export declare namespace ComAtprotoSyncRequestCrawl { + interface Params {} + interface Input { + /** Hostname of the current service (eg, PDS) that is requesting to be crawled. */ + hostname: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoSyncSubscribeRepos { + interface Params { + /** The last known event seq number to backfill from. */ + cursor?: number; + } + type Message = Brand.Union< + Account | Commit | Handle | Identity | Info | Migrate | Tombstone + >; + interface Errors { + FutureCursor: {}; + ConsumerTooSlow: {}; + } + /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ + interface Account { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#account"; + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean; + did: At.DID; + seq: number; + time: string; + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | "deactivated" + | "deleted" + | "suspended" + | "takendown" + | (string & {}); + } + /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ + interface Commit { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#commit"; + /** List of new blobs (by CID) referenced by records in this commit. */ + blobs: At.CIDLink[]; + /** CAR file containing relevant blocks, as a diff since the previous repo state. */ + blocks: At.Bytes; + /** Repo commit object CID. */ + commit: At.CIDLink; + /** + * Maximum array length: 200 + * List of repo mutation operations in this commit (eg, records created, updated, or deleted). + */ + ops: RepoOp[]; + /** + * DEPRECATED -- unused + * \@deprecated + */ + rebase: boolean; + /** The repo this event comes from. */ + repo: At.DID; + /** The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event. */ + rev: string; + /** The stream sequence number of this message. */ + seq: number; + /** The rev of the last emitted commit from this repo (if any). */ + since: string | null; + /** Timestamp of when this message was originally broadcast. */ + time: string; + /** Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data. */ + tooBig: boolean; + /** + * DEPRECATED -- unused. WARNING -- nullable and optional; stick with optional to ensure golang interoperability. + * \@deprecated + */ + prev?: At.CIDLink | null; + } + /** + * DEPRECATED -- Use #identity event instead + * \@deprecated + */ + interface Handle { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#handle"; + did: At.DID; + handle: At.Handle; + seq: number; + time: string; + } + /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ + interface Identity { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#identity"; + did: At.DID; + seq: number; + time: string; + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ + handle?: At.Handle; + } + interface Info { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#info"; + name: "OutdatedCursor" | (string & {}); + message?: string; + } + /** + * DEPRECATED -- Use #account event instead + * \@deprecated + */ + interface Migrate { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#migrate"; + did: At.DID; + migrateTo: string | null; + seq: number; + time: string; + } + /** A repo operation, ie a mutation of a single record. */ + interface RepoOp { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#repoOp"; + action: "create" | "delete" | "update" | (string & {}); + /** For creates and updates, the new record CID. For deletions, null. */ + cid: At.CIDLink | null; + path: string; + } + /** + * DEPRECATED -- Use #account event instead + * \@deprecated + */ + interface Tombstone { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#tombstone"; + did: At.DID; + seq: number; + time: string; + } +} + +/** Add a handle to the set of reserved handles. */ +export declare namespace ComAtprotoTempAddReservedHandle { + interface Params {} + interface Input { + handle: string; + } + interface Output {} +} + +/** Check accounts location in signup queue. */ +export declare namespace ComAtprotoTempCheckSignupQueue { + interface Params {} + type Input = undefined; + interface Output { + activated: boolean; + estimatedTimeMs?: number; + placeInQueue?: number; + } +} + +/** + * DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date. + * \@deprecated + */ +export declare namespace ComAtprotoTempFetchLabels { + interface Params { + /** + * Minimum: 1 + * Maximum: 250 + * \@default 50 + */ + limit?: number; + since?: number; + } + type Input = undefined; + interface Output { + labels: ComAtprotoLabelDefs.Label[]; + } +} + +/** Request a verification code to be sent to the supplied phone number */ +export declare namespace ComAtprotoTempRequestPhoneVerification { + interface Params {} + interface Input { + phoneNumber: string; + } + type Output = undefined; +} + +/** Administrative action to create a new, re-usable communication (email for now) template. */ +export declare namespace ToolsOzoneCommunicationCreateTemplate { + interface Params {} + interface Input { + /** Content of the template, markdown supported, can contain variable placeholders. */ + contentMarkdown: string; + /** Name of the template. */ + name: string; + /** Subject of the message, used in emails. */ + subject: string; + /** DID of the user who is creating the template. */ + createdBy?: At.DID; + /** Message language. */ + lang?: string; + } + type Output = ToolsOzoneCommunicationDefs.TemplateView; + interface Errors { + DuplicateTemplateName: {}; + } +} + +export declare namespace ToolsOzoneCommunicationDefs { + interface TemplateView { + [Brand.Type]?: "tools.ozone.communication.defs#templateView"; + /** Subject of the message, used in emails. */ + contentMarkdown: string; + createdAt: string; + disabled: boolean; + id: string; + /** DID of the user who last updated the template. */ + lastUpdatedBy: At.DID; + /** Name of the template. */ + name: string; + updatedAt: string; + /** Message language. */ + lang?: string; + /** Content of the template, can contain markdown and variable placeholders. */ + subject?: string; + } +} + +/** Delete a communication template. */ +export declare namespace ToolsOzoneCommunicationDeleteTemplate { + interface Params {} + interface Input { + id: string; + } + type Output = undefined; +} + +/** Get list of all communication templates. */ +export declare namespace ToolsOzoneCommunicationListTemplates { + interface Params {} + type Input = undefined; + interface Output { + communicationTemplates: ToolsOzoneCommunicationDefs.TemplateView[]; + } +} + +/** Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. */ +export declare namespace ToolsOzoneCommunicationUpdateTemplate { + interface Params {} + interface Input { + /** ID of the template to be updated. */ + id: string; + /** Content of the template, markdown supported, can contain variable placeholders. */ + contentMarkdown?: string; + disabled?: boolean; + /** Message language. */ + lang?: string; + /** Name of the template. */ + name?: string; + /** Subject of the message, used in emails. */ + subject?: string; + /** DID of the user who is updating the template. */ + updatedBy?: At.DID; + } + type Output = ToolsOzoneCommunicationDefs.TemplateView; + interface Errors { + DuplicateTemplateName: {}; + } +} + +export declare namespace ToolsOzoneModerationDefs { + /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface AccountEvent { + [Brand.Type]?: "tools.ozone.moderation.defs#accountEvent"; + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean; + timestamp: string; + comment?: string; + status?: + | "deactivated" + | "deleted" + | "suspended" + | "takendown" + | "tombstoned" + | "unknown" + | (string & {}); + } + interface AccountHosting { + [Brand.Type]?: "tools.ozone.moderation.defs#accountHosting"; + status: + | "deactivated" + | "deleted" + | "suspended" + | "takendown" + | "unknown" + | (string & {}); + createdAt?: string; + deactivatedAt?: string; + deletedAt?: string; + reactivatedAt?: string; + updatedAt?: string; + } + interface BlobView { + [Brand.Type]?: "tools.ozone.moderation.defs#blobView"; + cid: At.CID; + createdAt: string; + mimeType: string; + size: number; + details?: Brand.Union; + moderation?: Moderation; + } + /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface IdentityEvent { + [Brand.Type]?: "tools.ozone.moderation.defs#identityEvent"; + timestamp: string; + comment?: string; + handle?: At.Handle; + pdsHost?: string; + tombstone?: boolean; + } + interface ImageDetails { + [Brand.Type]?: "tools.ozone.moderation.defs#imageDetails"; + height: number; + width: number; + } + interface Moderation { + [Brand.Type]?: "tools.ozone.moderation.defs#moderation"; + subjectStatus?: SubjectStatusView; + } + interface ModerationDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#moderationDetail"; + subjectStatus?: SubjectStatusView; + } + interface ModEventAcknowledge { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventAcknowledge"; + comment?: string; + } + /** Add a comment to a subject */ + interface ModEventComment { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventComment"; + comment: string; + /** Make the comment persistent on the subject */ + sticky?: boolean; + } + /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ + interface ModEventDivert { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventDivert"; + comment?: string; + } + /** Keep a log of outgoing email to a user */ + interface ModEventEmail { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventEmail"; + /** The subject line of the email sent to the user. */ + subjectLine: string; + /** Additional comment about the outgoing comm. */ + comment?: string; + /** The content of the email sent to the user. */ + content?: string; + } + interface ModEventEscalate { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventEscalate"; + comment?: string; + } + /** Apply/Negate labels on a subject */ + interface ModEventLabel { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventLabel"; + createLabelVals: string[]; + negateLabelVals: string[]; + comment?: string; + } + /** Mute incoming reports on a subject */ + interface ModEventMute { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventMute"; + /** Indicates how long the subject should remain muted. */ + durationInHours: number; + comment?: string; + } + /** Mute incoming reports from an account */ + interface ModEventMuteReporter { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventMuteReporter"; + comment?: string; + /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ + durationInHours?: number; + } + /** Report a subject */ + interface ModEventReport { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventReport"; + reportType: ComAtprotoModerationDefs.ReasonType; + comment?: string; + /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ + isReporterMuted?: boolean; + } + /** Resolve appeal on a subject */ + interface ModEventResolveAppeal { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventResolveAppeal"; + /** Describe resolution. */ + comment?: string; + } + /** Revert take down action on a subject */ + interface ModEventReverseTakedown { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventReverseTakedown"; + /** Describe reasoning behind the reversal. */ + comment?: string; + } + /** Add/Remove a tag on a subject */ + interface ModEventTag { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventTag"; + /** Tags to be added to the subject. If already exists, won't be duplicated. */ + add: string[]; + /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ + remove: string[]; + /** Additional comment about added/removed tags. */ + comment?: string; + } + /** Take down a subject permanently or temporarily */ + interface ModEventTakedown { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventTakedown"; + /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ + acknowledgeAccountSubjects?: boolean; + comment?: string; + /** Indicates how long the takedown should be in effect before automatically expiring. */ + durationInHours?: number; + } + /** Unmute action on a subject */ + interface ModEventUnmute { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmute"; + /** Describe reasoning behind the reversal. */ + comment?: string; + } + /** Unmute incoming reports from an account */ + interface ModEventUnmuteReporter { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmuteReporter"; + /** Describe reasoning behind the reversal. */ + comment?: string; + } + interface ModEventView { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventView"; + createdAt: string; + createdBy: At.DID; + event: Brand.Union< + | AccountEvent + | IdentityEvent + | ModEventAcknowledge + | ModEventComment + | ModEventDivert + | ModEventEmail + | ModEventEscalate + | ModEventLabel + | ModEventMute + | ModEventMuteReporter + | ModEventReport + | ModEventResolveAppeal + | ModEventReverseTakedown + | ModEventTag + | ModEventTakedown + | ModEventUnmute + | ModEventUnmuteReporter + | RecordEvent + >; + id: number; + subject: Brand.Union< + | ChatBskyConvoDefs.MessageRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + subjectBlobCids: string[]; + creatorHandle?: string; + subjectHandle?: string; + } + interface ModEventViewDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventViewDetail"; + createdAt: string; + createdBy: At.DID; + event: Brand.Union< + | AccountEvent + | IdentityEvent + | ModEventAcknowledge + | ModEventComment + | ModEventDivert + | ModEventEmail + | ModEventEscalate + | ModEventLabel + | ModEventMute + | ModEventMuteReporter + | ModEventReport + | ModEventResolveAppeal + | ModEventReverseTakedown + | ModEventTag + | ModEventTakedown + | ModEventUnmute + | ModEventUnmuteReporter + | RecordEvent + >; + id: number; + subject: Brand.Union< + RecordView | RecordViewNotFound | RepoView | RepoViewNotFound + >; + subjectBlobs: BlobView[]; + } + /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface RecordEvent { + [Brand.Type]?: "tools.ozone.moderation.defs#recordEvent"; + op: "create" | "delete" | "update" | (string & {}); + timestamp: string; + cid?: At.CID; + comment?: string; + } + interface RecordHosting { + [Brand.Type]?: "tools.ozone.moderation.defs#recordHosting"; + status: "deleted" | "unknown" | (string & {}); + createdAt?: string; + deletedAt?: string; + updatedAt?: string; + } + interface RecordView { + [Brand.Type]?: "tools.ozone.moderation.defs#recordView"; + blobCids: At.CID[]; + cid: At.CID; + indexedAt: string; + moderation: Moderation; + repo: RepoView; + uri: At.Uri; + value: unknown; + } + interface RecordViewDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#recordViewDetail"; + blobs: BlobView[]; + cid: At.CID; + indexedAt: string; + moderation: ModerationDetail; + repo: RepoView; + uri: At.Uri; + value: unknown; + labels?: ComAtprotoLabelDefs.Label[]; + } + interface RecordViewNotFound { + [Brand.Type]?: "tools.ozone.moderation.defs#recordViewNotFound"; + uri: At.Uri; + } + interface RepoView { + [Brand.Type]?: "tools.ozone.moderation.defs#repoView"; + did: At.DID; + handle: At.Handle; + indexedAt: string; + moderation: Moderation; + relatedRecords: unknown[]; + deactivatedAt?: string; + email?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invitesDisabled?: boolean; + threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; + } + interface RepoViewDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#repoViewDetail"; + did: At.DID; + handle: At.Handle; + indexedAt: string; + moderation: ModerationDetail; + relatedRecords: unknown[]; + deactivatedAt?: string; + email?: string; + emailConfirmedAt?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invites?: ComAtprotoServerDefs.InviteCode[]; + invitesDisabled?: boolean; + labels?: ComAtprotoLabelDefs.Label[]; + threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; + } + interface RepoViewNotFound { + [Brand.Type]?: "tools.ozone.moderation.defs#repoViewNotFound"; + did: At.DID; + } + type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; + type ReviewEscalated = "tools.ozone.moderation.defs#reviewEscalated"; + type ReviewNone = "tools.ozone.moderation.defs#reviewNone"; + type ReviewOpen = "tools.ozone.moderation.defs#reviewOpen"; + type SubjectReviewState = + | "#reviewClosed" + | "#reviewEscalated" + | "#reviewNone" + | "#reviewOpen" + | (string & {}); + interface SubjectStatusView { + [Brand.Type]?: "tools.ozone.moderation.defs#subjectStatusView"; + /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ + createdAt: string; + id: number; + reviewState: SubjectReviewState; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** Timestamp referencing when the last update was made to the moderation status of the subject */ + updatedAt: string; + /** True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. */ + appealed?: boolean; + /** Sticky comment on the subject. */ + comment?: string; + hosting?: Brand.Union; + /** Timestamp referencing when the author of the subject appealed a moderation action */ + lastAppealedAt?: string; + lastReportedAt?: string; + lastReviewedAt?: string; + lastReviewedBy?: At.DID; + muteReportingUntil?: string; + muteUntil?: string; + subjectBlobCids?: At.CID[]; + subjectRepoHandle?: string; + suspendUntil?: string; + tags?: string[]; + takendown?: boolean; + } + interface VideoDetails { + [Brand.Type]?: "tools.ozone.moderation.defs#videoDetails"; + height: number; + length: number; + width: number; + } +} + +/** Take a moderation action on an actor. */ +export declare namespace ToolsOzoneModerationEmitEvent { + interface Params {} + interface Input { + createdBy: At.DID; + event: Brand.Union< + | ToolsOzoneModerationDefs.AccountEvent + | ToolsOzoneModerationDefs.IdentityEvent + | ToolsOzoneModerationDefs.ModEventAcknowledge + | ToolsOzoneModerationDefs.ModEventComment + | ToolsOzoneModerationDefs.ModEventEmail + | ToolsOzoneModerationDefs.ModEventEscalate + | ToolsOzoneModerationDefs.ModEventLabel + | ToolsOzoneModerationDefs.ModEventMute + | ToolsOzoneModerationDefs.ModEventMuteReporter + | ToolsOzoneModerationDefs.ModEventReport + | ToolsOzoneModerationDefs.ModEventResolveAppeal + | ToolsOzoneModerationDefs.ModEventReverseTakedown + | ToolsOzoneModerationDefs.ModEventTag + | ToolsOzoneModerationDefs.ModEventTakedown + | ToolsOzoneModerationDefs.ModEventUnmute + | ToolsOzoneModerationDefs.ModEventUnmuteReporter + | ToolsOzoneModerationDefs.RecordEvent + >; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + subjectBlobCids?: At.CID[]; + } + type Output = ToolsOzoneModerationDefs.ModEventView; + interface Errors { + SubjectHasAction: {}; + } +} + +/** Get details about a moderation event. */ +export declare namespace ToolsOzoneModerationGetEvent { + interface Params { + id: number; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.ModEventViewDetail; +} + +/** Get details about a record. */ +export declare namespace ToolsOzoneModerationGetRecord { + interface Params { + uri: At.Uri; + cid?: At.CID; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.RecordViewDetail; + interface Errors { + RecordNotFound: {}; + } +} + +/** Get details about some records. */ +export declare namespace ToolsOzoneModerationGetRecords { + interface Params { + /** Maximum array length: 100 */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output { + records: Brand.Union< + | ToolsOzoneModerationDefs.RecordViewDetail + | ToolsOzoneModerationDefs.RecordViewNotFound + >[]; + } +} + +/** Get details about a repository. */ +export declare namespace ToolsOzoneModerationGetRepo { + interface Params { + did: At.DID; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.RepoViewDetail; + interface Errors { + RepoNotFound: {}; + } +} + +/** Get details about some repositories. */ +export declare namespace ToolsOzoneModerationGetRepos { + interface Params { + /** Maximum array length: 100 */ + dids: At.DID[]; + } + type Input = undefined; + interface Output { + repos: Brand.Union< + | ToolsOzoneModerationDefs.RepoViewDetail + | ToolsOzoneModerationDefs.RepoViewNotFound + >[]; + } +} + +/** List moderation events related to a subject. */ +export declare namespace ToolsOzoneModerationQueryEvents { + interface Params { + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[]; + /** If specified, only events where all of these tags were added are returned */ + addedTags?: string[]; + /** + * If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. + * Maximum array length: 20 + */ + collections?: string[]; + /** If specified, only events with comments containing the keyword are returned. Apply || separator to use multiple keywords and match using OR condition. */ + comment?: string; + /** Retrieve events created after a given timestamp */ + createdAfter?: string; + /** Retrieve events created before a given timestamp */ + createdBefore?: string; + createdBy?: At.DID; + cursor?: string; + /** If true, only events with comments are returned */ + hasComment?: boolean; + /** + * If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned. + * \@default false + */ + includeAllUserRecords?: boolean; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[]; + /** If specified, only events where all of these tags were removed are returned */ + removedTags?: string[]; + reportTypes?: string[]; + /** + * Sort direction for the events. Defaults to descending order of created at timestamp. + * \@default "desc" + */ + sortDirection?: "asc" | "desc"; + subject?: string; + /** If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ + subjectType?: "account" | "record" | (string & {}); + /** The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent) to filter by. If not specified, all events are returned. */ + types?: string[]; + } + type Input = undefined; + interface Output { + events: ToolsOzoneModerationDefs.ModEventView[]; + cursor?: string; + } +} + +/** View moderation statuses of subjects (record or repo). */ +export declare namespace ToolsOzoneModerationQueryStatuses { + interface Params { + /** Get subjects in unresolved appealed status */ + appealed?: boolean; + /** + * If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored. + * Maximum array length: 20 + */ + collections?: string[]; + /** Search subjects by keyword from comments */ + comment?: string; + cursor?: string; + excludeTags?: string[]; + /** Search subjects where the associated record/account was deleted after a given timestamp */ + hostingDeletedAfter?: string; + /** Search subjects where the associated record/account was deleted before a given timestamp */ + hostingDeletedBefore?: string; + /** Search subjects by the status of the associated record/account */ + hostingStatuses?: string[]; + /** Search subjects where the associated record/account was updated after a given timestamp */ + hostingUpdatedAfter?: string; + /** Search subjects where the associated record/account was updated before a given timestamp */ + hostingUpdatedBefore?: string; + ignoreSubjects?: string[]; + /** All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned. */ + includeAllUserRecords?: boolean; + /** By default, we don't include muted subjects in the results. Set this to true to include them. */ + includeMuted?: boolean; + /** Get all subject statuses that were reviewed by a specific moderator */ + lastReviewedBy?: At.DID; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** When set to true, only muted subjects and reporters will be returned. */ + onlyMuted?: boolean; + /** Search subjects reported after a given timestamp */ + reportedAfter?: string; + /** Search subjects reported before a given timestamp */ + reportedBefore?: string; + /** Search subjects reviewed after a given timestamp */ + reviewedAfter?: string; + /** Search subjects reviewed before a given timestamp */ + reviewedBefore?: string; + /** Specify when fetching subjects in a certain state */ + reviewState?: string; + /** \@default "desc" */ + sortDirection?: "asc" | "desc"; + /** \@default "lastReportedAt" */ + sortField?: "lastReviewedAt" | "lastReportedAt"; + /** The subject to get the status for. */ + subject?: string; + /** If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ + subjectType?: "account" | "record" | (string & {}); + tags?: string[]; + /** Get subjects that were taken down */ + takendown?: boolean; + } + type Input = undefined; + interface Output { + subjectStatuses: ToolsOzoneModerationDefs.SubjectStatusView[]; + cursor?: string; + } +} + +/** Find repositories based on a search term. */ +export declare namespace ToolsOzoneModerationSearchRepos { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + q?: string; + /** + * DEPRECATED: use 'q' instead + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output { + repos: ToolsOzoneModerationDefs.RepoView[]; + cursor?: string; + } +} + +/** Get details about ozone's server configuration. */ +export declare namespace ToolsOzoneServerGetConfig { + interface Params {} + type Input = undefined; + interface Output { + appview?: ServiceConfig; + blobDivert?: ServiceConfig; + chat?: ServiceConfig; + pds?: ServiceConfig; + viewer?: ViewerConfig; + } + interface ServiceConfig { + [Brand.Type]?: "tools.ozone.server.getConfig#serviceConfig"; + url?: string; + } + interface ViewerConfig { + [Brand.Type]?: "tools.ozone.server.getConfig#viewerConfig"; + role?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } +} + +/** Add values to a specific set. Attempting to add values to a set that does not exist will result in an error. */ +export declare namespace ToolsOzoneSetAddValues { + interface Params {} + interface Input { + /** Name of the set to add values to */ + name: string; + /** + * Array of string values to add to the set + * Minimum array length: 1 + * Maximum array length: 1000 + */ + values: string[]; + } + type Output = undefined; +} + +export declare namespace ToolsOzoneSetDefs { + interface Set { + [Brand.Type]?: "tools.ozone.set.defs#set"; + /** + * Minimum string length: 3 + * Maximum string length: 128 + */ + name: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + } + interface SetView { + [Brand.Type]?: "tools.ozone.set.defs#setView"; + createdAt: string; + /** + * Minimum string length: 3 + * Maximum string length: 128 + */ + name: string; + setSize: number; + updatedAt: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + } +} + +/** Delete an entire set. Attempting to delete a set that does not exist will result in an error. */ +export declare namespace ToolsOzoneSetDeleteSet { + interface Params {} + interface Input { + /** Name of the set to delete */ + name: string; + } + interface Output {} + interface Errors { + SetNotFound: {}; + } +} + +/** Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error */ +export declare namespace ToolsOzoneSetDeleteValues { + interface Params {} + interface Input { + /** Name of the set to delete values from */ + name: string; + /** + * Array of string values to delete from the set + * Minimum array length: 1 + */ + values: string[]; + } + type Output = undefined; + interface Errors { + SetNotFound: {}; + } +} + +/** Get a specific set and its values */ +export declare namespace ToolsOzoneSetGetValues { + interface Params { + name: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 100 + */ + limit?: number; + } + type Input = undefined; + interface Output { + set: ToolsOzoneSetDefs.SetView; + values: string[]; + cursor?: string; + } + interface Errors { + SetNotFound: {}; + } +} + +/** Query available sets */ +export declare namespace ToolsOzoneSetQuerySets { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + namePrefix?: string; + /** \@default "name" */ + sortBy?: "name" | "createdAt" | "updatedAt"; + /** + * Defaults to ascending order of name field. + * \@default "asc" + */ + sortDirection?: "asc" | "desc"; + } + type Input = undefined; + interface Output { + sets: ToolsOzoneSetDefs.SetView[]; + cursor?: string; + } +} + +/** Create or update set metadata */ +export declare namespace ToolsOzoneSetUpsertSet { + interface Params {} + type Input = ToolsOzoneSetDefs.Set; + type Output = ToolsOzoneSetDefs.SetView; +} + +export declare namespace ToolsOzoneSettingDefs { + interface Option { + [Brand.Type]?: "tools.ozone.setting.defs#option"; + createdBy: At.DID; + did: At.DID; + key: string; + lastUpdatedBy: At.DID; + scope: "instance" | "personal" | (string & {}); + value: unknown; + createdAt?: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + managerRole?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + updatedAt?: string; + } +} + +/** List settings with optional filtering */ +export declare namespace ToolsOzoneSettingListOptions { + interface Params { + cursor?: string; + /** + * Filter for only the specified keys. Ignored if prefix is provided + * Maximum array length: 100 + */ + keys?: string[]; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** Filter keys by prefix */ + prefix?: string; + /** \@default "instance" */ + scope?: "instance" | "personal" | (string & {}); + } + type Input = undefined; + interface Output { + options: ToolsOzoneSettingDefs.Option[]; + cursor?: string; + } +} + +/** Delete settings by key */ +export declare namespace ToolsOzoneSettingRemoveOptions { + interface Params {} + interface Input { + /** + * Minimum array length: 1 + * Maximum array length: 200 + */ + keys: string[]; + scope: "instance" | "personal" | (string & {}); + } + interface Output {} +} + +/** Create or update setting option */ +export declare namespace ToolsOzoneSettingUpsertOption { + interface Params {} + interface Input { + key: string; + scope: "instance" | "personal" | (string & {}); + value: unknown; + /** Maximum string length: 2000 */ + description?: string; + managerRole?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } + interface Output { + option: ToolsOzoneSettingDefs.Option; + } +} + +export declare namespace ToolsOzoneSignatureDefs { + interface SigDetail { + [Brand.Type]?: "tools.ozone.signature.defs#sigDetail"; + property: string; + value: string; + } +} + +/** Find all correlated threat signatures between 2 or more accounts. */ +export declare namespace ToolsOzoneSignatureFindCorrelation { + interface Params { + dids: At.DID[]; + } + type Input = undefined; + interface Output { + details: ToolsOzoneSignatureDefs.SigDetail[]; + } +} + +/** Get accounts that share some matching threat signatures with the root account. */ +export declare namespace ToolsOzoneSignatureFindRelatedAccounts { + interface Params { + did: At.DID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + accounts: RelatedAccount[]; + cursor?: string; + } + interface RelatedAccount { + [Brand.Type]?: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; + account: ComAtprotoAdminDefs.AccountView; + similarities?: ToolsOzoneSignatureDefs.SigDetail[]; + } +} + +/** Search for accounts that match one or more threat signature values. */ +export declare namespace ToolsOzoneSignatureSearchAccounts { + interface Params { + values: string[]; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + accounts: ComAtprotoAdminDefs.AccountView[]; + cursor?: string; + } +} + +/** Add a member to the ozone team. Requires admin role. */ +export declare namespace ToolsOzoneTeamAddMember { + interface Params {} + interface Input { + did: At.DID; + role: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } + type Output = ToolsOzoneTeamDefs.Member; + interface Errors { + MemberAlreadyExists: {}; + } +} + +export declare namespace ToolsOzoneTeamDefs { + interface Member { + [Brand.Type]?: "tools.ozone.team.defs#member"; + did: At.DID; + role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); + createdAt?: string; + disabled?: boolean; + lastUpdatedBy?: string; + profile?: AppBskyActorDefs.ProfileViewDetailed; + updatedAt?: string; + } + type RoleAdmin = "tools.ozone.team.defs#roleAdmin"; + type RoleModerator = "tools.ozone.team.defs#roleModerator"; + type RoleTriage = "tools.ozone.team.defs#roleTriage"; +} + +/** Delete a member from ozone team. Requires admin role. */ +export declare namespace ToolsOzoneTeamDeleteMember { + interface Params {} + interface Input { + did: At.DID; + } + type Output = undefined; + interface Errors { + MemberNotFound: {}; + CannotDeleteSelf: {}; + } +} + +/** List all members with access to the ozone service. */ +export declare namespace ToolsOzoneTeamListMembers { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + members: ToolsOzoneTeamDefs.Member[]; + cursor?: string; + } +} + +/** Update a member in the ozone service. Requires admin role. */ +export declare namespace ToolsOzoneTeamUpdateMember { + interface Params {} + interface Input { + did: At.DID; + disabled?: boolean; + role?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } + type Output = ToolsOzoneTeamDefs.Member; + interface Errors { + MemberNotFound: {}; + } +} + +export declare interface Records { + "app.bsky.actor.profile": AppBskyActorProfile.Record; + "app.bsky.feed.generator": AppBskyFeedGenerator.Record; + "app.bsky.feed.like": AppBskyFeedLike.Record; + "app.bsky.feed.post": AppBskyFeedPost.Record; + "app.bsky.feed.postgate": AppBskyFeedPostgate.Record; + "app.bsky.feed.repost": AppBskyFeedRepost.Record; + "app.bsky.feed.threadgate": AppBskyFeedThreadgate.Record; + "app.bsky.graph.block": AppBskyGraphBlock.Record; + "app.bsky.graph.follow": AppBskyGraphFollow.Record; + "app.bsky.graph.list": AppBskyGraphList.Record; + "app.bsky.graph.listblock": AppBskyGraphListblock.Record; + "app.bsky.graph.listitem": AppBskyGraphListitem.Record; + "app.bsky.graph.starterpack": AppBskyGraphStarterpack.Record; + "app.bsky.labeler.service": AppBskyLabelerService.Record; + "chat.bsky.actor.declaration": ChatBskyActorDeclaration.Record; +} + +export declare interface Queries { + "app.bsky.actor.getPreferences": { + output: AppBskyActorGetPreferences.Output; + }; + "app.bsky.actor.getProfile": { + params: AppBskyActorGetProfile.Params; + output: AppBskyActorGetProfile.Output; + }; + "app.bsky.actor.getProfiles": { + params: AppBskyActorGetProfiles.Params; + output: AppBskyActorGetProfiles.Output; + }; + "app.bsky.actor.getSuggestions": { + params: AppBskyActorGetSuggestions.Params; + output: AppBskyActorGetSuggestions.Output; + }; + "app.bsky.actor.searchActors": { + params: AppBskyActorSearchActors.Params; + output: AppBskyActorSearchActors.Output; + }; + "app.bsky.actor.searchActorsTypeahead": { + params: AppBskyActorSearchActorsTypeahead.Params; + output: AppBskyActorSearchActorsTypeahead.Output; + }; + "app.bsky.feed.describeFeedGenerator": { + output: AppBskyFeedDescribeFeedGenerator.Output; + }; + "app.bsky.feed.getActorFeeds": { + params: AppBskyFeedGetActorFeeds.Params; + output: AppBskyFeedGetActorFeeds.Output; + }; + "app.bsky.feed.getActorLikes": { + params: AppBskyFeedGetActorLikes.Params; + output: AppBskyFeedGetActorLikes.Output; + }; + "app.bsky.feed.getAuthorFeed": { + params: AppBskyFeedGetAuthorFeed.Params; + output: AppBskyFeedGetAuthorFeed.Output; + }; + "app.bsky.feed.getFeed": { + params: AppBskyFeedGetFeed.Params; + output: AppBskyFeedGetFeed.Output; + }; + "app.bsky.feed.getFeedGenerator": { + params: AppBskyFeedGetFeedGenerator.Params; + output: AppBskyFeedGetFeedGenerator.Output; + }; + "app.bsky.feed.getFeedGenerators": { + params: AppBskyFeedGetFeedGenerators.Params; + output: AppBskyFeedGetFeedGenerators.Output; + }; + "app.bsky.feed.getFeedSkeleton": { + params: AppBskyFeedGetFeedSkeleton.Params; + output: AppBskyFeedGetFeedSkeleton.Output; + }; + "app.bsky.feed.getLikes": { + params: AppBskyFeedGetLikes.Params; + output: AppBskyFeedGetLikes.Output; + }; + "app.bsky.feed.getListFeed": { + params: AppBskyFeedGetListFeed.Params; + output: AppBskyFeedGetListFeed.Output; + }; + "app.bsky.feed.getPosts": { + params: AppBskyFeedGetPosts.Params; + output: AppBskyFeedGetPosts.Output; + }; + "app.bsky.feed.getPostThread": { + params: AppBskyFeedGetPostThread.Params; + output: AppBskyFeedGetPostThread.Output; + }; + "app.bsky.feed.getQuotes": { + params: AppBskyFeedGetQuotes.Params; + output: AppBskyFeedGetQuotes.Output; + }; + "app.bsky.feed.getRepostedBy": { + params: AppBskyFeedGetRepostedBy.Params; + output: AppBskyFeedGetRepostedBy.Output; + }; + "app.bsky.feed.getSuggestedFeeds": { + params: AppBskyFeedGetSuggestedFeeds.Params; + output: AppBskyFeedGetSuggestedFeeds.Output; + }; + "app.bsky.feed.getTimeline": { + params: AppBskyFeedGetTimeline.Params; + output: AppBskyFeedGetTimeline.Output; + }; + "app.bsky.feed.searchPosts": { + params: AppBskyFeedSearchPosts.Params; + output: AppBskyFeedSearchPosts.Output; + }; + "app.bsky.graph.getActorStarterPacks": { + params: AppBskyGraphGetActorStarterPacks.Params; + output: AppBskyGraphGetActorStarterPacks.Output; + }; + "app.bsky.graph.getBlocks": { + params: AppBskyGraphGetBlocks.Params; + output: AppBskyGraphGetBlocks.Output; + }; + "app.bsky.graph.getFollowers": { + params: AppBskyGraphGetFollowers.Params; + output: AppBskyGraphGetFollowers.Output; + }; + "app.bsky.graph.getFollows": { + params: AppBskyGraphGetFollows.Params; + output: AppBskyGraphGetFollows.Output; + }; + "app.bsky.graph.getKnownFollowers": { + params: AppBskyGraphGetKnownFollowers.Params; + output: AppBskyGraphGetKnownFollowers.Output; + }; + "app.bsky.graph.getList": { + params: AppBskyGraphGetList.Params; + output: AppBskyGraphGetList.Output; + }; + "app.bsky.graph.getListBlocks": { + params: AppBskyGraphGetListBlocks.Params; + output: AppBskyGraphGetListBlocks.Output; + }; + "app.bsky.graph.getListMutes": { + params: AppBskyGraphGetListMutes.Params; + output: AppBskyGraphGetListMutes.Output; + }; + "app.bsky.graph.getLists": { + params: AppBskyGraphGetLists.Params; + output: AppBskyGraphGetLists.Output; + }; + "app.bsky.graph.getMutes": { + params: AppBskyGraphGetMutes.Params; + output: AppBskyGraphGetMutes.Output; + }; + "app.bsky.graph.getRelationships": { + params: AppBskyGraphGetRelationships.Params; + output: AppBskyGraphGetRelationships.Output; + }; + "app.bsky.graph.getStarterPack": { + params: AppBskyGraphGetStarterPack.Params; + output: AppBskyGraphGetStarterPack.Output; + }; + "app.bsky.graph.getStarterPacks": { + params: AppBskyGraphGetStarterPacks.Params; + output: AppBskyGraphGetStarterPacks.Output; + }; + "app.bsky.graph.getSuggestedFollowsByActor": { + params: AppBskyGraphGetSuggestedFollowsByActor.Params; + output: AppBskyGraphGetSuggestedFollowsByActor.Output; + }; + "app.bsky.graph.searchStarterPacks": { + params: AppBskyGraphSearchStarterPacks.Params; + output: AppBskyGraphSearchStarterPacks.Output; + }; + "app.bsky.labeler.getServices": { + params: AppBskyLabelerGetServices.Params; + output: AppBskyLabelerGetServices.Output; + }; + "app.bsky.notification.getUnreadCount": { + params: AppBskyNotificationGetUnreadCount.Params; + output: AppBskyNotificationGetUnreadCount.Output; + }; + "app.bsky.notification.listNotifications": { + params: AppBskyNotificationListNotifications.Params; + output: AppBskyNotificationListNotifications.Output; + }; + "app.bsky.unspecced.getConfig": { + output: AppBskyUnspeccedGetConfig.Output; + }; + "app.bsky.unspecced.getPopularFeedGenerators": { + params: AppBskyUnspeccedGetPopularFeedGenerators.Params; + output: AppBskyUnspeccedGetPopularFeedGenerators.Output; + }; + "app.bsky.unspecced.getSuggestionsSkeleton": { + params: AppBskyUnspeccedGetSuggestionsSkeleton.Params; + output: AppBskyUnspeccedGetSuggestionsSkeleton.Output; + }; + "app.bsky.unspecced.getTaggedSuggestions": { + output: AppBskyUnspeccedGetTaggedSuggestions.Output; + }; + "app.bsky.unspecced.searchActorsSkeleton": { + params: AppBskyUnspeccedSearchActorsSkeleton.Params; + output: AppBskyUnspeccedSearchActorsSkeleton.Output; + }; + "app.bsky.unspecced.searchPostsSkeleton": { + params: AppBskyUnspeccedSearchPostsSkeleton.Params; + output: AppBskyUnspeccedSearchPostsSkeleton.Output; + }; + "app.bsky.unspecced.searchStarterPacksSkeleton": { + params: AppBskyUnspeccedSearchStarterPacksSkeleton.Params; + output: AppBskyUnspeccedSearchStarterPacksSkeleton.Output; + }; + "app.bsky.video.getJobStatus": { + params: AppBskyVideoGetJobStatus.Params; + output: AppBskyVideoGetJobStatus.Output; + }; + "app.bsky.video.getUploadLimits": { + output: AppBskyVideoGetUploadLimits.Output; + }; + "chat.bsky.actor.exportAccountData": { + output: ChatBskyActorExportAccountData.Output; + }; + "chat.bsky.convo.getConvo": { + params: ChatBskyConvoGetConvo.Params; + output: ChatBskyConvoGetConvo.Output; + }; + "chat.bsky.convo.getConvoForMembers": { + params: ChatBskyConvoGetConvoForMembers.Params; + output: ChatBskyConvoGetConvoForMembers.Output; + }; + "chat.bsky.convo.getLog": { + params: ChatBskyConvoGetLog.Params; + output: ChatBskyConvoGetLog.Output; + }; + "chat.bsky.convo.getMessages": { + params: ChatBskyConvoGetMessages.Params; + output: ChatBskyConvoGetMessages.Output; + }; + "chat.bsky.convo.listConvos": { + params: ChatBskyConvoListConvos.Params; + output: ChatBskyConvoListConvos.Output; + }; + "chat.bsky.moderation.getActorMetadata": { + params: ChatBskyModerationGetActorMetadata.Params; + output: ChatBskyModerationGetActorMetadata.Output; + }; + "chat.bsky.moderation.getMessageContext": { + params: ChatBskyModerationGetMessageContext.Params; + output: ChatBskyModerationGetMessageContext.Output; + }; + "com.atproto.admin.getAccountInfo": { + params: ComAtprotoAdminGetAccountInfo.Params; + output: ComAtprotoAdminGetAccountInfo.Output; + }; + "com.atproto.admin.getAccountInfos": { + params: ComAtprotoAdminGetAccountInfos.Params; + output: ComAtprotoAdminGetAccountInfos.Output; + }; + "com.atproto.admin.getInviteCodes": { + params: ComAtprotoAdminGetInviteCodes.Params; + output: ComAtprotoAdminGetInviteCodes.Output; + }; + "com.atproto.admin.getSubjectStatus": { + params: ComAtprotoAdminGetSubjectStatus.Params; + output: ComAtprotoAdminGetSubjectStatus.Output; + }; + "com.atproto.admin.searchAccounts": { + params: ComAtprotoAdminSearchAccounts.Params; + output: ComAtprotoAdminSearchAccounts.Output; + }; + "com.atproto.identity.getRecommendedDidCredentials": { + output: ComAtprotoIdentityGetRecommendedDidCredentials.Output; + }; + "com.atproto.identity.resolveHandle": { + params: ComAtprotoIdentityResolveHandle.Params; + output: ComAtprotoIdentityResolveHandle.Output; + }; + "com.atproto.label.queryLabels": { + params: ComAtprotoLabelQueryLabels.Params; + output: ComAtprotoLabelQueryLabels.Output; + }; + "com.atproto.repo.describeRepo": { + params: ComAtprotoRepoDescribeRepo.Params; + output: ComAtprotoRepoDescribeRepo.Output; + }; + "com.atproto.repo.getRecord": { + params: ComAtprotoRepoGetRecord.Params; + output: ComAtprotoRepoGetRecord.Output; + }; + "com.atproto.repo.listMissingBlobs": { + params: ComAtprotoRepoListMissingBlobs.Params; + output: ComAtprotoRepoListMissingBlobs.Output; + }; + "com.atproto.repo.listRecords": { + params: ComAtprotoRepoListRecords.Params; + output: ComAtprotoRepoListRecords.Output; + }; + "com.atproto.server.checkAccountStatus": { + output: ComAtprotoServerCheckAccountStatus.Output; + }; + "com.atproto.server.describeServer": { + output: ComAtprotoServerDescribeServer.Output; + }; + "com.atproto.server.getAccountInviteCodes": { + params: ComAtprotoServerGetAccountInviteCodes.Params; + output: ComAtprotoServerGetAccountInviteCodes.Output; + }; + "com.atproto.server.getServiceAuth": { + params: ComAtprotoServerGetServiceAuth.Params; + output: ComAtprotoServerGetServiceAuth.Output; + }; + "com.atproto.server.getSession": { + output: ComAtprotoServerGetSession.Output; + }; + "com.atproto.server.listAppPasswords": { + output: ComAtprotoServerListAppPasswords.Output; + }; + "com.atproto.sync.getBlob": { + params: ComAtprotoSyncGetBlob.Params; + output: ComAtprotoSyncGetBlob.Output; + }; + "com.atproto.sync.getBlocks": { + params: ComAtprotoSyncGetBlocks.Params; + output: ComAtprotoSyncGetBlocks.Output; + }; + "com.atproto.sync.getCheckout": { + params: ComAtprotoSyncGetCheckout.Params; + output: ComAtprotoSyncGetCheckout.Output; + }; + "com.atproto.sync.getHead": { + params: ComAtprotoSyncGetHead.Params; + output: ComAtprotoSyncGetHead.Output; + }; + "com.atproto.sync.getLatestCommit": { + params: ComAtprotoSyncGetLatestCommit.Params; + output: ComAtprotoSyncGetLatestCommit.Output; + }; + "com.atproto.sync.getRecord": { + params: ComAtprotoSyncGetRecord.Params; + output: ComAtprotoSyncGetRecord.Output; + }; + "com.atproto.sync.getRepo": { + params: ComAtprotoSyncGetRepo.Params; + output: ComAtprotoSyncGetRepo.Output; + }; + "com.atproto.sync.getRepoStatus": { + params: ComAtprotoSyncGetRepoStatus.Params; + output: ComAtprotoSyncGetRepoStatus.Output; + }; + "com.atproto.sync.listBlobs": { + params: ComAtprotoSyncListBlobs.Params; + output: ComAtprotoSyncListBlobs.Output; + }; + "com.atproto.sync.listRepos": { + params: ComAtprotoSyncListRepos.Params; + output: ComAtprotoSyncListRepos.Output; + }; + "com.atproto.temp.checkSignupQueue": { + output: ComAtprotoTempCheckSignupQueue.Output; + }; + "com.atproto.temp.fetchLabels": { + params: ComAtprotoTempFetchLabels.Params; + output: ComAtprotoTempFetchLabels.Output; + }; + "tools.ozone.communication.listTemplates": { + output: ToolsOzoneCommunicationListTemplates.Output; + }; + "tools.ozone.moderation.getEvent": { + params: ToolsOzoneModerationGetEvent.Params; + output: ToolsOzoneModerationGetEvent.Output; + }; + "tools.ozone.moderation.getRecord": { + params: ToolsOzoneModerationGetRecord.Params; + output: ToolsOzoneModerationGetRecord.Output; + }; + "tools.ozone.moderation.getRecords": { + params: ToolsOzoneModerationGetRecords.Params; + output: ToolsOzoneModerationGetRecords.Output; + }; + "tools.ozone.moderation.getRepo": { + params: ToolsOzoneModerationGetRepo.Params; + output: ToolsOzoneModerationGetRepo.Output; + }; + "tools.ozone.moderation.getRepos": { + params: ToolsOzoneModerationGetRepos.Params; + output: ToolsOzoneModerationGetRepos.Output; + }; + "tools.ozone.moderation.queryEvents": { + params: ToolsOzoneModerationQueryEvents.Params; + output: ToolsOzoneModerationQueryEvents.Output; + }; + "tools.ozone.moderation.queryStatuses": { + params: ToolsOzoneModerationQueryStatuses.Params; + output: ToolsOzoneModerationQueryStatuses.Output; + }; + "tools.ozone.moderation.searchRepos": { + params: ToolsOzoneModerationSearchRepos.Params; + output: ToolsOzoneModerationSearchRepos.Output; + }; + "tools.ozone.server.getConfig": { + output: ToolsOzoneServerGetConfig.Output; + }; + "tools.ozone.set.getValues": { + params: ToolsOzoneSetGetValues.Params; + output: ToolsOzoneSetGetValues.Output; + }; + "tools.ozone.set.querySets": { + params: ToolsOzoneSetQuerySets.Params; + output: ToolsOzoneSetQuerySets.Output; + }; + "tools.ozone.setting.listOptions": { + params: ToolsOzoneSettingListOptions.Params; + output: ToolsOzoneSettingListOptions.Output; + }; + "tools.ozone.signature.findCorrelation": { + params: ToolsOzoneSignatureFindCorrelation.Params; + output: ToolsOzoneSignatureFindCorrelation.Output; + }; + "tools.ozone.signature.findRelatedAccounts": { + params: ToolsOzoneSignatureFindRelatedAccounts.Params; + output: ToolsOzoneSignatureFindRelatedAccounts.Output; + }; + "tools.ozone.signature.searchAccounts": { + params: ToolsOzoneSignatureSearchAccounts.Params; + output: ToolsOzoneSignatureSearchAccounts.Output; + }; + "tools.ozone.team.listMembers": { + params: ToolsOzoneTeamListMembers.Params; + output: ToolsOzoneTeamListMembers.Output; + }; +} + +export declare interface Procedures { + "app.bsky.actor.putPreferences": { + input: AppBskyActorPutPreferences.Input; + }; + "app.bsky.feed.sendInteractions": { + input: AppBskyFeedSendInteractions.Input; + output: AppBskyFeedSendInteractions.Output; + }; + "app.bsky.graph.muteActor": { + input: AppBskyGraphMuteActor.Input; + }; + "app.bsky.graph.muteActorList": { + input: AppBskyGraphMuteActorList.Input; + }; + "app.bsky.graph.muteThread": { + input: AppBskyGraphMuteThread.Input; + }; + "app.bsky.graph.unmuteActor": { + input: AppBskyGraphUnmuteActor.Input; + }; + "app.bsky.graph.unmuteActorList": { + input: AppBskyGraphUnmuteActorList.Input; + }; + "app.bsky.graph.unmuteThread": { + input: AppBskyGraphUnmuteThread.Input; + }; + "app.bsky.notification.putPreferences": { + input: AppBskyNotificationPutPreferences.Input; + }; + "app.bsky.notification.registerPush": { + input: AppBskyNotificationRegisterPush.Input; + }; + "app.bsky.notification.updateSeen": { + input: AppBskyNotificationUpdateSeen.Input; + }; + "app.bsky.video.uploadVideo": { + input: AppBskyVideoUploadVideo.Input; + output: AppBskyVideoUploadVideo.Output; + }; + "chat.bsky.actor.deleteAccount": { + output: ChatBskyActorDeleteAccount.Output; + }; + "chat.bsky.convo.deleteMessageForSelf": { + input: ChatBskyConvoDeleteMessageForSelf.Input; + output: ChatBskyConvoDeleteMessageForSelf.Output; + }; + "chat.bsky.convo.leaveConvo": { + input: ChatBskyConvoLeaveConvo.Input; + output: ChatBskyConvoLeaveConvo.Output; + }; + "chat.bsky.convo.muteConvo": { + input: ChatBskyConvoMuteConvo.Input; + output: ChatBskyConvoMuteConvo.Output; + }; + "chat.bsky.convo.sendMessage": { + input: ChatBskyConvoSendMessage.Input; + output: ChatBskyConvoSendMessage.Output; + }; + "chat.bsky.convo.sendMessageBatch": { + input: ChatBskyConvoSendMessageBatch.Input; + output: ChatBskyConvoSendMessageBatch.Output; + }; + "chat.bsky.convo.unmuteConvo": { + input: ChatBskyConvoUnmuteConvo.Input; + output: ChatBskyConvoUnmuteConvo.Output; + }; + "chat.bsky.convo.updateRead": { + input: ChatBskyConvoUpdateRead.Input; + output: ChatBskyConvoUpdateRead.Output; + }; + "chat.bsky.moderation.updateActorAccess": { + input: ChatBskyModerationUpdateActorAccess.Input; + }; + "com.atproto.admin.deleteAccount": { + input: ComAtprotoAdminDeleteAccount.Input; + }; + "com.atproto.admin.disableAccountInvites": { + input: ComAtprotoAdminDisableAccountInvites.Input; + }; + "com.atproto.admin.disableInviteCodes": { + input: ComAtprotoAdminDisableInviteCodes.Input; + }; + "com.atproto.admin.enableAccountInvites": { + input: ComAtprotoAdminEnableAccountInvites.Input; + }; + "com.atproto.admin.sendEmail": { + input: ComAtprotoAdminSendEmail.Input; + output: ComAtprotoAdminSendEmail.Output; + }; + "com.atproto.admin.updateAccountEmail": { + input: ComAtprotoAdminUpdateAccountEmail.Input; + }; + "com.atproto.admin.updateAccountHandle": { + input: ComAtprotoAdminUpdateAccountHandle.Input; + }; + "com.atproto.admin.updateAccountPassword": { + input: ComAtprotoAdminUpdateAccountPassword.Input; + }; + "com.atproto.admin.updateSubjectStatus": { + input: ComAtprotoAdminUpdateSubjectStatus.Input; + output: ComAtprotoAdminUpdateSubjectStatus.Output; + }; + "com.atproto.identity.requestPlcOperationSignature": {}; + "com.atproto.identity.signPlcOperation": { + input: ComAtprotoIdentitySignPlcOperation.Input; + output: ComAtprotoIdentitySignPlcOperation.Output; + }; + "com.atproto.identity.submitPlcOperation": { + input: ComAtprotoIdentitySubmitPlcOperation.Input; + }; + "com.atproto.identity.updateHandle": { + input: ComAtprotoIdentityUpdateHandle.Input; + }; + "com.atproto.moderation.createReport": { + input: ComAtprotoModerationCreateReport.Input; + output: ComAtprotoModerationCreateReport.Output; + }; + "com.atproto.repo.applyWrites": { + input: ComAtprotoRepoApplyWrites.Input; + output: ComAtprotoRepoApplyWrites.Output; + }; + "com.atproto.repo.createRecord": { + input: ComAtprotoRepoCreateRecord.Input; + output: ComAtprotoRepoCreateRecord.Output; + }; + "com.atproto.repo.deleteRecord": { + input: ComAtprotoRepoDeleteRecord.Input; + output: ComAtprotoRepoDeleteRecord.Output; + }; + "com.atproto.repo.importRepo": { + input: ComAtprotoRepoImportRepo.Input; + }; + "com.atproto.repo.putRecord": { + input: ComAtprotoRepoPutRecord.Input; + output: ComAtprotoRepoPutRecord.Output; + }; + "com.atproto.repo.uploadBlob": { + input: ComAtprotoRepoUploadBlob.Input; + output: ComAtprotoRepoUploadBlob.Output; + }; + "com.atproto.server.activateAccount": {}; + "com.atproto.server.confirmEmail": { + input: ComAtprotoServerConfirmEmail.Input; + }; + "com.atproto.server.createAccount": { + input: ComAtprotoServerCreateAccount.Input; + output: ComAtprotoServerCreateAccount.Output; + }; + "com.atproto.server.createAppPassword": { + input: ComAtprotoServerCreateAppPassword.Input; + output: ComAtprotoServerCreateAppPassword.Output; + }; + "com.atproto.server.createInviteCode": { + input: ComAtprotoServerCreateInviteCode.Input; + output: ComAtprotoServerCreateInviteCode.Output; + }; + "com.atproto.server.createInviteCodes": { + input: ComAtprotoServerCreateInviteCodes.Input; + output: ComAtprotoServerCreateInviteCodes.Output; + }; + "com.atproto.server.createSession": { + input: ComAtprotoServerCreateSession.Input; + output: ComAtprotoServerCreateSession.Output; + }; + "com.atproto.server.deactivateAccount": { + input: ComAtprotoServerDeactivateAccount.Input; + }; + "com.atproto.server.deleteAccount": { + input: ComAtprotoServerDeleteAccount.Input; + }; + "com.atproto.server.deleteSession": {}; + "com.atproto.server.refreshSession": { + output: ComAtprotoServerRefreshSession.Output; + }; + "com.atproto.server.requestAccountDelete": {}; + "com.atproto.server.requestEmailConfirmation": {}; + "com.atproto.server.requestEmailUpdate": { + output: ComAtprotoServerRequestEmailUpdate.Output; + }; + "com.atproto.server.requestPasswordReset": { + input: ComAtprotoServerRequestPasswordReset.Input; + }; + "com.atproto.server.reserveSigningKey": { + input: ComAtprotoServerReserveSigningKey.Input; + output: ComAtprotoServerReserveSigningKey.Output; + }; + "com.atproto.server.resetPassword": { + input: ComAtprotoServerResetPassword.Input; + }; + "com.atproto.server.revokeAppPassword": { + input: ComAtprotoServerRevokeAppPassword.Input; + }; + "com.atproto.server.updateEmail": { + input: ComAtprotoServerUpdateEmail.Input; + }; + "com.atproto.sync.notifyOfUpdate": { + input: ComAtprotoSyncNotifyOfUpdate.Input; + }; + "com.atproto.sync.requestCrawl": { + input: ComAtprotoSyncRequestCrawl.Input; + }; + "com.atproto.temp.addReservedHandle": { + input: ComAtprotoTempAddReservedHandle.Input; + output: ComAtprotoTempAddReservedHandle.Output; + }; + "com.atproto.temp.requestPhoneVerification": { + input: ComAtprotoTempRequestPhoneVerification.Input; + }; + "tools.ozone.communication.createTemplate": { + input: ToolsOzoneCommunicationCreateTemplate.Input; + output: ToolsOzoneCommunicationCreateTemplate.Output; + }; + "tools.ozone.communication.deleteTemplate": { + input: ToolsOzoneCommunicationDeleteTemplate.Input; + }; + "tools.ozone.communication.updateTemplate": { + input: ToolsOzoneCommunicationUpdateTemplate.Input; + output: ToolsOzoneCommunicationUpdateTemplate.Output; + }; + "tools.ozone.moderation.emitEvent": { + input: ToolsOzoneModerationEmitEvent.Input; + output: ToolsOzoneModerationEmitEvent.Output; + }; + "tools.ozone.set.addValues": { + input: ToolsOzoneSetAddValues.Input; + }; + "tools.ozone.set.deleteSet": { + input: ToolsOzoneSetDeleteSet.Input; + output: ToolsOzoneSetDeleteSet.Output; + }; + "tools.ozone.set.deleteValues": { + input: ToolsOzoneSetDeleteValues.Input; + }; + "tools.ozone.set.upsertSet": { + input: ToolsOzoneSetUpsertSet.Input; + output: ToolsOzoneSetUpsertSet.Output; + }; + "tools.ozone.setting.removeOptions": { + input: ToolsOzoneSettingRemoveOptions.Input; + output: ToolsOzoneSettingRemoveOptions.Output; + }; + "tools.ozone.setting.upsertOption": { + input: ToolsOzoneSettingUpsertOption.Input; + output: ToolsOzoneSettingUpsertOption.Output; + }; + "tools.ozone.team.addMember": { + input: ToolsOzoneTeamAddMember.Input; + output: ToolsOzoneTeamAddMember.Output; + }; + "tools.ozone.team.deleteMember": { + input: ToolsOzoneTeamDeleteMember.Input; + }; + "tools.ozone.team.updateMember": { + input: ToolsOzoneTeamUpdateMember.Input; + output: ToolsOzoneTeamUpdateMember.Output; + }; +} + +export declare interface Subscriptions { + "com.atproto.label.subscribeLabels": { + params: ComAtprotoLabelSubscribeLabels.Params; + message: ComAtprotoLabelSubscribeLabels.Message; + errors: ComAtprotoLabelSubscribeLabels.Errors; + }; + "com.atproto.sync.subscribeRepos": { + params: ComAtprotoSyncSubscribeRepos.Params; + message: ComAtprotoSyncSubscribeRepos.Message; + errors: ComAtprotoSyncSubscribeRepos.Errors; + }; +} From e9ca690bb87aee1503b1eefa6ccf8f14455e24b7 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 12:10:38 -0500 Subject: [PATCH 25/68] making more specific --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 6e95d1a..201d122 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,7 +2,7 @@ import antfu from '@antfu/eslint-config'; export default antfu( { - ignores: ['packages/lexicons/**/*'], + ignores: ['packages/lexicons/src/lib/lexicons.ts'], typescript: true, stylistic: { semi: true, From 83949db2ee66732cdb91560380b3ad51b73e9149 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 12:10:48 -0500 Subject: [PATCH 26/68] linting --- packages/lexicons/src/index.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index 4cbce4d..ccfe921 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -66,10 +66,10 @@ export type BskyFollow = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}graph.f // --- Type Guards --- export function isRecord(value: unknown): value is RecordDefs { return ( - typeof value === 'object' && - value !== null && - '$type' in value && - typeof value.$type === 'string' + typeof value === 'object' + && value !== null + && '$type' in value + && typeof value.$type === 'string' ); } @@ -86,20 +86,20 @@ export function isBskyPost(value: unknown): value is BskyPost { } // --- Error Types and Guards --- -export type BskyError = { +export interface BskyError { error: string; message: string; statusCode?: number; -}; +} export function isBskyError(value: unknown): value is BskyError { return ( - typeof value === 'object' && - value !== null && - 'error' in value && - 'message' in value && - typeof (value as BskyError).error === 'string' && - typeof (value as BskyError).message === 'string' + typeof value === 'object' + && value !== null + && 'error' in value + && 'message' in value + && typeof (value as BskyError).error === 'string' + && typeof (value as BskyError).message === 'string' ); } From ece7684b6be125ede62d11195ead859b11fa707c Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 14:26:10 -0500 Subject: [PATCH 27/68] making brand tags required --- packages/lex-cli/src/generator/index.ts | 2 +- packages/lex-cli/src/utils/prelude.ts | 6 +- packages/lexicons/src/lib/lexicons.ts | 384 ++++++++++++------------ 3 files changed, 196 insertions(+), 196 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 1b9eb21..c03e558 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -93,7 +93,7 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descs); chunk += `interface ${typeName} {`; - chunk += `[Brand.Type]?: '${nsid}';`; + chunk += `[Brand.Type]: '${nsid}';`; for (const prop of propKeys) { const isOptional = !required || !required.includes(prop); diff --git a/packages/lex-cli/src/utils/prelude.ts b/packages/lex-cli/src/utils/prelude.ts index 01d98ef..2ed9bd9 100644 --- a/packages/lex-cli/src/utils/prelude.ts +++ b/packages/lex-cli/src/utils/prelude.ts @@ -6,13 +6,13 @@ export declare namespace Brand { const Type: unique symbol; /** Get the intended \`$type\` field */ - type GetType = NonNullable; + type GetType = T[typeof Type]; /** Creates a union of objects where it's discriminated by \`$type\` field. */ - type Union = T extends any ? T & { $type: GetType } : never; + type Union = T extends any ? T & { $type: GetType } : never; /** Omits the type branding from object */ - type Omit = ObjectOmit; + type Omit = ObjectOmit; } /** Base AT Protocol schema types */ diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 66eed61..99b14d8 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -14,15 +14,15 @@ export declare namespace Brand { const Type: unique symbol; /** Get the intended `$type` field */ - type GetType = NonNullable; + type GetType = T[typeof Type]; /** Creates a union of objects where it's discriminated by `$type` field. */ - type Union = T extends any + type Union = T extends any ? T & { $type: GetType } : never; /** Omits the type branding from object */ - type Omit = ObjectOmit; + type Omit = ObjectOmit; } /** Base AT Protocol schema types */ @@ -61,19 +61,19 @@ export declare namespace At { } export declare namespace AppBskyActorDefs { interface AdultContentPref { - [Brand.Type]?: "app.bsky.actor.defs#adultContentPref"; + [Brand.Type]: "app.bsky.actor.defs#adultContentPref"; /** \@default false */ enabled: boolean; } /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ interface BskyAppProgressGuide { - [Brand.Type]?: "app.bsky.actor.defs#bskyAppProgressGuide"; + [Brand.Type]: "app.bsky.actor.defs#bskyAppProgressGuide"; /** Maximum string length: 100 */ guide: string; } /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ interface BskyAppStatePref { - [Brand.Type]?: "app.bsky.actor.defs#bskyAppStatePref"; + [Brand.Type]: "app.bsky.actor.defs#bskyAppStatePref"; activeProgressGuide?: BskyAppProgressGuide; /** * Storage for NUXs the user has encountered. @@ -88,14 +88,14 @@ export declare namespace AppBskyActorDefs { queuedNudges?: string[]; } interface ContentLabelPref { - [Brand.Type]?: "app.bsky.actor.defs#contentLabelPref"; + [Brand.Type]: "app.bsky.actor.defs#contentLabelPref"; label: string; visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); /** Which labeler does this preference apply to? If undefined, applies globally. */ labelerDid?: At.DID; } interface FeedViewPref { - [Brand.Type]?: "app.bsky.actor.defs#feedViewPref"; + [Brand.Type]: "app.bsky.actor.defs#feedViewPref"; /** The URI of the feed, or an identifier which describes the feed. */ feed: string; /** Hide quote posts in the feed. */ @@ -113,12 +113,12 @@ export declare namespace AppBskyActorDefs { hideReposts?: boolean; } interface HiddenPostsPref { - [Brand.Type]?: "app.bsky.actor.defs#hiddenPostsPref"; + [Brand.Type]: "app.bsky.actor.defs#hiddenPostsPref"; /** A list of URIs of posts the account owner has hidden. */ items: At.Uri[]; } interface InterestsPref { - [Brand.Type]?: "app.bsky.actor.defs#interestsPref"; + [Brand.Type]: "app.bsky.actor.defs#interestsPref"; /** * A list of tags which describe the account owner's interests gathered during onboarding. * Maximum array length: 100 @@ -129,7 +129,7 @@ export declare namespace AppBskyActorDefs { } /** The subject's followers whom you also follow */ interface KnownFollowers { - [Brand.Type]?: "app.bsky.actor.defs#knownFollowers"; + [Brand.Type]: "app.bsky.actor.defs#knownFollowers"; count: number; /** * Minimum array length: 0 @@ -138,16 +138,16 @@ export declare namespace AppBskyActorDefs { followers: ProfileViewBasic[]; } interface LabelerPrefItem { - [Brand.Type]?: "app.bsky.actor.defs#labelerPrefItem"; + [Brand.Type]: "app.bsky.actor.defs#labelerPrefItem"; did: At.DID; } interface LabelersPref { - [Brand.Type]?: "app.bsky.actor.defs#labelersPref"; + [Brand.Type]: "app.bsky.actor.defs#labelersPref"; labelers: LabelerPrefItem[]; } /** A word that the account owner has muted. */ interface MutedWord { - [Brand.Type]?: "app.bsky.actor.defs#mutedWord"; + [Brand.Type]: "app.bsky.actor.defs#mutedWord"; /** The intended targets of the muted word. */ targets: AppBskyActorDefs.MutedWordTarget[]; /** @@ -166,7 +166,7 @@ export declare namespace AppBskyActorDefs { id?: string; } interface MutedWordsPref { - [Brand.Type]?: "app.bsky.actor.defs#mutedWordsPref"; + [Brand.Type]: "app.bsky.actor.defs#mutedWordsPref"; /** A list of words the account owner has muted. */ items: AppBskyActorDefs.MutedWord[]; } @@ -177,7 +177,7 @@ export declare namespace AppBskyActorDefs { type MutedWordTarget = "content" | "tag" | (string & {}); /** A new user experiences (NUX) storage object */ interface Nux { - [Brand.Type]?: "app.bsky.actor.defs#nux"; + [Brand.Type]: "app.bsky.actor.defs#nux"; /** \@default false */ completed: boolean; /** Maximum string length: 100 */ @@ -192,7 +192,7 @@ export declare namespace AppBskyActorDefs { expiresAt?: string; } interface PersonalDetailsPref { - [Brand.Type]?: "app.bsky.actor.defs#personalDetailsPref"; + [Brand.Type]: "app.bsky.actor.defs#personalDetailsPref"; /** The birth date of account owner. */ birthDate?: string; } @@ -211,7 +211,7 @@ export declare namespace AppBskyActorDefs { | ThreadViewPref >[]; interface ProfileAssociated { - [Brand.Type]?: "app.bsky.actor.defs#profileAssociated"; + [Brand.Type]: "app.bsky.actor.defs#profileAssociated"; chat?: ProfileAssociatedChat; feedgens?: number; labeler?: boolean; @@ -219,11 +219,11 @@ export declare namespace AppBskyActorDefs { starterPacks?: number; } interface ProfileAssociatedChat { - [Brand.Type]?: "app.bsky.actor.defs#profileAssociatedChat"; + [Brand.Type]: "app.bsky.actor.defs#profileAssociatedChat"; allowIncoming: "all" | "following" | "none" | (string & {}); } interface ProfileView { - [Brand.Type]?: "app.bsky.actor.defs#profileView"; + [Brand.Type]: "app.bsky.actor.defs#profileView"; did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -244,7 +244,7 @@ export declare namespace AppBskyActorDefs { viewer?: ViewerState; } interface ProfileViewBasic { - [Brand.Type]?: "app.bsky.actor.defs#profileViewBasic"; + [Brand.Type]: "app.bsky.actor.defs#profileViewBasic"; did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -259,7 +259,7 @@ export declare namespace AppBskyActorDefs { viewer?: ViewerState; } interface ProfileViewDetailed { - [Brand.Type]?: "app.bsky.actor.defs#profileViewDetailed"; + [Brand.Type]: "app.bsky.actor.defs#profileViewDetailed"; did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -286,24 +286,24 @@ export declare namespace AppBskyActorDefs { viewer?: ViewerState; } interface SavedFeed { - [Brand.Type]?: "app.bsky.actor.defs#savedFeed"; + [Brand.Type]: "app.bsky.actor.defs#savedFeed"; id: string; pinned: boolean; type: "feed" | "list" | "timeline" | (string & {}); value: string; } interface SavedFeedsPref { - [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPref"; + [Brand.Type]: "app.bsky.actor.defs#savedFeedsPref"; pinned: At.Uri[]; saved: At.Uri[]; timelineIndex?: number; } interface SavedFeedsPrefV2 { - [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPrefV2"; + [Brand.Type]: "app.bsky.actor.defs#savedFeedsPrefV2"; items: AppBskyActorDefs.SavedFeed[]; } interface ThreadViewPref { - [Brand.Type]?: "app.bsky.actor.defs#threadViewPref"; + [Brand.Type]: "app.bsky.actor.defs#threadViewPref"; /** Show followed users at the top of all replies. */ prioritizeFollowedUsers?: boolean; /** Sorting mode for threads. */ @@ -317,7 +317,7 @@ export declare namespace AppBskyActorDefs { } /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ interface ViewerState { - [Brand.Type]?: "app.bsky.actor.defs#viewerState"; + [Brand.Type]: "app.bsky.actor.defs#viewerState"; blockedBy?: boolean; blocking?: At.Uri; blockingByList?: AppBskyGraphDefs.ListViewBasic; @@ -464,7 +464,7 @@ export declare namespace AppBskyActorSearchActorsTypeahead { export declare namespace AppBskyEmbedDefs { /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ interface AspectRatio { - [Brand.Type]?: "app.bsky.embed.defs#aspectRatio"; + [Brand.Type]: "app.bsky.embed.defs#aspectRatio"; /** Minimum: 1 */ height: number; /** Minimum: 1 */ @@ -475,22 +475,22 @@ export declare namespace AppBskyEmbedDefs { export declare namespace AppBskyEmbedExternal { /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ interface Main { - [Brand.Type]?: "app.bsky.embed.external"; + [Brand.Type]: "app.bsky.embed.external"; external: External; } interface External { - [Brand.Type]?: "app.bsky.embed.external#external"; + [Brand.Type]: "app.bsky.embed.external#external"; description: string; title: string; uri: string; thumb?: At.Blob; } interface View { - [Brand.Type]?: "app.bsky.embed.external#view"; + [Brand.Type]: "app.bsky.embed.external#view"; external: ViewExternal; } interface ViewExternal { - [Brand.Type]?: "app.bsky.embed.external#viewExternal"; + [Brand.Type]: "app.bsky.embed.external#viewExternal"; description: string; title: string; uri: string; @@ -500,24 +500,24 @@ export declare namespace AppBskyEmbedExternal { export declare namespace AppBskyEmbedImages { interface Main { - [Brand.Type]?: "app.bsky.embed.images"; + [Brand.Type]: "app.bsky.embed.images"; /** Maximum array length: 4 */ images: Image[]; } interface Image { - [Brand.Type]?: "app.bsky.embed.images#image"; + [Brand.Type]: "app.bsky.embed.images#image"; /** Alt text description of the image, for accessibility. */ alt: string; image: At.Blob; aspectRatio?: AppBskyEmbedDefs.AspectRatio; } interface View { - [Brand.Type]?: "app.bsky.embed.images#view"; + [Brand.Type]: "app.bsky.embed.images#view"; /** Maximum array length: 4 */ images: ViewImage[]; } interface ViewImage { - [Brand.Type]?: "app.bsky.embed.images#viewImage"; + [Brand.Type]: "app.bsky.embed.images#viewImage"; /** Alt text description of the image, for accessibility. */ alt: string; /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ @@ -530,11 +530,11 @@ export declare namespace AppBskyEmbedImages { export declare namespace AppBskyEmbedRecord { interface Main { - [Brand.Type]?: "app.bsky.embed.record"; + [Brand.Type]: "app.bsky.embed.record"; record: ComAtprotoRepoStrongRef.Main; } interface View { - [Brand.Type]?: "app.bsky.embed.record#view"; + [Brand.Type]: "app.bsky.embed.record#view"; record: Brand.Union< | ViewBlocked | ViewDetached @@ -547,23 +547,23 @@ export declare namespace AppBskyEmbedRecord { >; } interface ViewBlocked { - [Brand.Type]?: "app.bsky.embed.record#viewBlocked"; + [Brand.Type]: "app.bsky.embed.record#viewBlocked"; author: AppBskyFeedDefs.BlockedAuthor; blocked: boolean; uri: At.Uri; } interface ViewDetached { - [Brand.Type]?: "app.bsky.embed.record#viewDetached"; + [Brand.Type]: "app.bsky.embed.record#viewDetached"; detached: boolean; uri: At.Uri; } interface ViewNotFound { - [Brand.Type]?: "app.bsky.embed.record#viewNotFound"; + [Brand.Type]: "app.bsky.embed.record#viewNotFound"; notFound: boolean; uri: At.Uri; } interface ViewRecord { - [Brand.Type]?: "app.bsky.embed.record#viewRecord"; + [Brand.Type]: "app.bsky.embed.record#viewRecord"; author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; @@ -587,7 +587,7 @@ export declare namespace AppBskyEmbedRecord { export declare namespace AppBskyEmbedRecordWithMedia { interface Main { - [Brand.Type]?: "app.bsky.embed.recordWithMedia"; + [Brand.Type]: "app.bsky.embed.recordWithMedia"; media: Brand.Union< | AppBskyEmbedExternal.Main | AppBskyEmbedImages.Main @@ -596,7 +596,7 @@ export declare namespace AppBskyEmbedRecordWithMedia { record: AppBskyEmbedRecord.Main; } interface View { - [Brand.Type]?: "app.bsky.embed.recordWithMedia#view"; + [Brand.Type]: "app.bsky.embed.recordWithMedia#view"; media: Brand.Union< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View @@ -608,7 +608,7 @@ export declare namespace AppBskyEmbedRecordWithMedia { export declare namespace AppBskyEmbedVideo { interface Main { - [Brand.Type]?: "app.bsky.embed.video"; + [Brand.Type]: "app.bsky.embed.video"; video: At.Blob; /** * Alt text description of the video, for accessibility. @@ -621,12 +621,12 @@ export declare namespace AppBskyEmbedVideo { captions?: Caption[]; } interface Caption { - [Brand.Type]?: "app.bsky.embed.video#caption"; + [Brand.Type]: "app.bsky.embed.video#caption"; file: At.Blob; lang: string; } interface View { - [Brand.Type]?: "app.bsky.embed.video#view"; + [Brand.Type]: "app.bsky.embed.video#view"; cid: At.CID; playlist: string; /** @@ -641,12 +641,12 @@ export declare namespace AppBskyEmbedVideo { export declare namespace AppBskyFeedDefs { interface BlockedAuthor { - [Brand.Type]?: "app.bsky.feed.defs#blockedAuthor"; + [Brand.Type]: "app.bsky.feed.defs#blockedAuthor"; did: At.DID; viewer?: AppBskyActorDefs.ViewerState; } interface BlockedPost { - [Brand.Type]?: "app.bsky.feed.defs#blockedPost"; + [Brand.Type]: "app.bsky.feed.defs#blockedPost"; author: BlockedAuthor; blocked: boolean; uri: At.Uri; @@ -656,7 +656,7 @@ export declare namespace AppBskyFeedDefs { type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; interface FeedViewPost { - [Brand.Type]?: "app.bsky.feed.defs#feedViewPost"; + [Brand.Type]: "app.bsky.feed.defs#feedViewPost"; post: PostView; /** * Context provided by feed generator that may be passed back alongside interactions. @@ -667,7 +667,7 @@ export declare namespace AppBskyFeedDefs { reply?: ReplyRef; } interface GeneratorView { - [Brand.Type]?: "app.bsky.feed.defs#generatorView"; + [Brand.Type]: "app.bsky.feed.defs#generatorView"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; did: At.DID; @@ -688,11 +688,11 @@ export declare namespace AppBskyFeedDefs { viewer?: GeneratorViewerState; } interface GeneratorViewerState { - [Brand.Type]?: "app.bsky.feed.defs#generatorViewerState"; + [Brand.Type]: "app.bsky.feed.defs#generatorViewerState"; like?: At.Uri; } interface Interaction { - [Brand.Type]?: "app.bsky.feed.defs#interaction"; + [Brand.Type]: "app.bsky.feed.defs#interaction"; event?: | "app.bsky.feed.defs#clickthroughAuthor" | "app.bsky.feed.defs#clickthroughEmbed" @@ -721,12 +721,12 @@ export declare namespace AppBskyFeedDefs { type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; type InteractionShare = "app.bsky.feed.defs#interactionShare"; interface NotFoundPost { - [Brand.Type]?: "app.bsky.feed.defs#notFoundPost"; + [Brand.Type]: "app.bsky.feed.defs#notFoundPost"; notFound: boolean; uri: At.Uri; } interface PostView { - [Brand.Type]?: "app.bsky.feed.defs#postView"; + [Brand.Type]: "app.bsky.feed.defs#postView"; author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; @@ -748,15 +748,15 @@ export declare namespace AppBskyFeedDefs { viewer?: ViewerState; } interface ReasonPin { - [Brand.Type]?: "app.bsky.feed.defs#reasonPin"; + [Brand.Type]: "app.bsky.feed.defs#reasonPin"; } interface ReasonRepost { - [Brand.Type]?: "app.bsky.feed.defs#reasonRepost"; + [Brand.Type]: "app.bsky.feed.defs#reasonRepost"; by: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; } interface ReplyRef { - [Brand.Type]?: "app.bsky.feed.defs#replyRef"; + [Brand.Type]: "app.bsky.feed.defs#replyRef"; parent: Brand.Union; root: Brand.Union; /** When parent is a reply to another post, this is the author of that post. */ @@ -765,7 +765,7 @@ export declare namespace AppBskyFeedDefs { type RequestLess = "app.bsky.feed.defs#requestLess"; type RequestMore = "app.bsky.feed.defs#requestMore"; interface SkeletonFeedPost { - [Brand.Type]?: "app.bsky.feed.defs#skeletonFeedPost"; + [Brand.Type]: "app.bsky.feed.defs#skeletonFeedPost"; post: At.Uri; /** * Context that will be passed through to client and may be passed to feed generator back alongside interactions. @@ -775,28 +775,28 @@ export declare namespace AppBskyFeedDefs { reason?: Brand.Union; } interface SkeletonReasonPin { - [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonPin"; + [Brand.Type]: "app.bsky.feed.defs#skeletonReasonPin"; } interface SkeletonReasonRepost { - [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonRepost"; + [Brand.Type]: "app.bsky.feed.defs#skeletonReasonRepost"; repost: At.Uri; } interface ThreadgateView { - [Brand.Type]?: "app.bsky.feed.defs#threadgateView"; + [Brand.Type]: "app.bsky.feed.defs#threadgateView"; cid?: At.CID; lists?: AppBskyGraphDefs.ListViewBasic[]; record?: unknown; uri?: At.Uri; } interface ThreadViewPost { - [Brand.Type]?: "app.bsky.feed.defs#threadViewPost"; + [Brand.Type]: "app.bsky.feed.defs#threadViewPost"; post: PostView; parent?: Brand.Union; replies?: Brand.Union[]; } /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ interface ViewerState { - [Brand.Type]?: "app.bsky.feed.defs#viewerState"; + [Brand.Type]: "app.bsky.feed.defs#viewerState"; embeddingDisabled?: boolean; like?: At.Uri; pinned?: boolean; @@ -816,11 +816,11 @@ export declare namespace AppBskyFeedDescribeFeedGenerator { links?: Links; } interface Feed { - [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#feed"; + [Brand.Type]: "app.bsky.feed.describeFeedGenerator#feed"; uri: At.Uri; } interface Links { - [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#links"; + [Brand.Type]: "app.bsky.feed.describeFeedGenerator#links"; privacyPolicy?: string; termsOfService?: string; } @@ -1023,7 +1023,7 @@ export declare namespace AppBskyFeedGetLikes { cursor?: string; } interface Like { - [Brand.Type]?: "app.bsky.feed.getLikes#like"; + [Brand.Type]: "app.bsky.feed.getLikes#like"; actor: AppBskyActorDefs.ProfileView; createdAt: string; indexedAt: string; @@ -1244,14 +1244,14 @@ export declare namespace AppBskyFeedPost { * \@deprecated */ interface Entity { - [Brand.Type]?: "app.bsky.feed.post#entity"; + [Brand.Type]: "app.bsky.feed.post#entity"; index: TextSlice; /** Expected values are 'mention' and 'link'. */ type: string; value: string; } interface ReplyRef { - [Brand.Type]?: "app.bsky.feed.post#replyRef"; + [Brand.Type]: "app.bsky.feed.post#replyRef"; parent: ComAtprotoRepoStrongRef.Main; root: ComAtprotoRepoStrongRef.Main; } @@ -1260,7 +1260,7 @@ export declare namespace AppBskyFeedPost { * \@deprecated */ interface TextSlice { - [Brand.Type]?: "app.bsky.feed.post#textSlice"; + [Brand.Type]: "app.bsky.feed.post#textSlice"; /** Minimum: 0 */ end: number; /** Minimum: 0 */ @@ -1285,7 +1285,7 @@ export declare namespace AppBskyFeedPostgate { } /** Disables embedding of this post. */ interface DisableRule { - [Brand.Type]?: "app.bsky.feed.postgate#disableRule"; + [Brand.Type]: "app.bsky.feed.postgate#disableRule"; } } @@ -1375,16 +1375,16 @@ export declare namespace AppBskyFeedThreadgate { } /** Allow replies from actors you follow. */ interface FollowingRule { - [Brand.Type]?: "app.bsky.feed.threadgate#followingRule"; + [Brand.Type]: "app.bsky.feed.threadgate#followingRule"; } /** Allow replies from actors on a list. */ interface ListRule { - [Brand.Type]?: "app.bsky.feed.threadgate#listRule"; + [Brand.Type]: "app.bsky.feed.threadgate#listRule"; list: At.Uri; } /** Allow replies from actors mentioned in your post. */ interface MentionRule { - [Brand.Type]?: "app.bsky.feed.threadgate#mentionRule"; + [Brand.Type]: "app.bsky.feed.threadgate#mentionRule"; } } @@ -1401,7 +1401,7 @@ export declare namespace AppBskyGraphBlock { export declare namespace AppBskyGraphDefs { type Curatelist = "app.bsky.graph.defs#curatelist"; interface ListItemView { - [Brand.Type]?: "app.bsky.graph.defs#listItemView"; + [Brand.Type]: "app.bsky.graph.defs#listItemView"; subject: AppBskyActorDefs.ProfileView; uri: At.Uri; } @@ -1411,7 +1411,7 @@ export declare namespace AppBskyGraphDefs { | "app.bsky.graph.defs#referencelist" | (string & {}); interface ListView { - [Brand.Type]?: "app.bsky.graph.defs#listView"; + [Brand.Type]: "app.bsky.graph.defs#listView"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1435,7 +1435,7 @@ export declare namespace AppBskyGraphDefs { viewer?: ListViewerState; } interface ListViewBasic { - [Brand.Type]?: "app.bsky.graph.defs#listViewBasic"; + [Brand.Type]: "app.bsky.graph.defs#listViewBasic"; cid: At.CID; /** * Minimum string length: 1 @@ -1452,21 +1452,21 @@ export declare namespace AppBskyGraphDefs { viewer?: ListViewerState; } interface ListViewerState { - [Brand.Type]?: "app.bsky.graph.defs#listViewerState"; + [Brand.Type]: "app.bsky.graph.defs#listViewerState"; blocked?: At.Uri; muted?: boolean; } type Modlist = "app.bsky.graph.defs#modlist"; /** indicates that a handle or DID could not be resolved */ interface NotFoundActor { - [Brand.Type]?: "app.bsky.graph.defs#notFoundActor"; + [Brand.Type]: "app.bsky.graph.defs#notFoundActor"; actor: string; notFound: boolean; } type Referencelist = "app.bsky.graph.defs#referencelist"; /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ interface Relationship { - [Brand.Type]?: "app.bsky.graph.defs#relationship"; + [Brand.Type]: "app.bsky.graph.defs#relationship"; did: At.DID; /** if the actor is followed by this DID, contains the AT-URI of the follow record */ followedBy?: At.Uri; @@ -1474,7 +1474,7 @@ export declare namespace AppBskyGraphDefs { following?: At.Uri; } interface StarterPackView { - [Brand.Type]?: "app.bsky.graph.defs#starterPackView"; + [Brand.Type]: "app.bsky.graph.defs#starterPackView"; cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1492,7 +1492,7 @@ export declare namespace AppBskyGraphDefs { listItemsSample?: ListItemView[]; } interface StarterPackViewBasic { - [Brand.Type]?: "app.bsky.graph.defs#starterPackViewBasic"; + [Brand.Type]: "app.bsky.graph.defs#starterPackViewBasic"; cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1889,7 +1889,7 @@ export declare namespace AppBskyGraphStarterpack { feeds?: FeedItem[]; } interface FeedItem { - [Brand.Type]?: "app.bsky.graph.starterpack#feedItem"; + [Brand.Type]: "app.bsky.graph.starterpack#feedItem"; uri: At.Uri; } } @@ -1923,14 +1923,14 @@ export declare namespace AppBskyGraphUnmuteThread { export declare namespace AppBskyLabelerDefs { interface LabelerPolicies { - [Brand.Type]?: "app.bsky.labeler.defs#labelerPolicies"; + [Brand.Type]: "app.bsky.labeler.defs#labelerPolicies"; /** The label values which this labeler publishes. May include global or custom labels. */ labelValues: ComAtprotoLabelDefs.LabelValue[]; /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; } interface LabelerView { - [Brand.Type]?: "app.bsky.labeler.defs#labelerView"; + [Brand.Type]: "app.bsky.labeler.defs#labelerView"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1941,7 +1941,7 @@ export declare namespace AppBskyLabelerDefs { viewer?: LabelerViewerState; } interface LabelerViewDetailed { - [Brand.Type]?: "app.bsky.labeler.defs#labelerViewDetailed"; + [Brand.Type]: "app.bsky.labeler.defs#labelerViewDetailed"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1953,7 +1953,7 @@ export declare namespace AppBskyLabelerDefs { viewer?: LabelerViewerState; } interface LabelerViewerState { - [Brand.Type]?: "app.bsky.labeler.defs#labelerViewerState"; + [Brand.Type]: "app.bsky.labeler.defs#labelerViewerState"; like?: At.Uri; } } @@ -2016,7 +2016,7 @@ export declare namespace AppBskyNotificationListNotifications { seenAt?: string; } interface Notification { - [Brand.Type]?: "app.bsky.notification.listNotifications#notification"; + [Brand.Type]: "app.bsky.notification.listNotifications#notification"; author: AppBskyActorDefs.ProfileView; cid: At.CID; indexedAt: string; @@ -2071,13 +2071,13 @@ export declare namespace AppBskyNotificationUpdateSeen { export declare namespace AppBskyRichtextFacet { /** Annotation of a sub-string within rich text. */ interface Main { - [Brand.Type]?: "app.bsky.richtext.facet"; + [Brand.Type]: "app.bsky.richtext.facet"; features: Brand.Union[]; index: ByteSlice; } /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ interface ByteSlice { - [Brand.Type]?: "app.bsky.richtext.facet#byteSlice"; + [Brand.Type]: "app.bsky.richtext.facet#byteSlice"; /** Minimum: 0 */ byteEnd: number; /** Minimum: 0 */ @@ -2085,17 +2085,17 @@ export declare namespace AppBskyRichtextFacet { } /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ interface Link { - [Brand.Type]?: "app.bsky.richtext.facet#link"; + [Brand.Type]: "app.bsky.richtext.facet#link"; uri: string; } /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ interface Mention { - [Brand.Type]?: "app.bsky.richtext.facet#mention"; + [Brand.Type]: "app.bsky.richtext.facet#mention"; did: At.DID; } /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ interface Tag { - [Brand.Type]?: "app.bsky.richtext.facet#tag"; + [Brand.Type]: "app.bsky.richtext.facet#tag"; /** * Maximum string length: 640 * Maximum grapheme length: 64 @@ -2106,15 +2106,15 @@ export declare namespace AppBskyRichtextFacet { export declare namespace AppBskyUnspeccedDefs { interface SkeletonSearchActor { - [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchActor"; + [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchActor"; did: At.DID; } interface SkeletonSearchPost { - [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchPost"; + [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchPost"; uri: At.Uri; } interface SkeletonSearchStarterPack { - [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; + [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; uri: At.Uri; } } @@ -2178,7 +2178,7 @@ export declare namespace AppBskyUnspeccedGetTaggedSuggestions { suggestions: Suggestion[]; } interface Suggestion { - [Brand.Type]?: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; + [Brand.Type]: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; subject: string; subjectType: "actor" | "feed" | (string & {}); tag: string; @@ -2298,7 +2298,7 @@ export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { export declare namespace AppBskyVideoDefs { interface JobStatus { - [Brand.Type]?: "app.bsky.video.defs#jobStatus"; + [Brand.Type]: "app.bsky.video.defs#jobStatus"; did: At.DID; jobId: string; /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ @@ -2358,7 +2358,7 @@ export declare namespace ChatBskyActorDeclaration { export declare namespace ChatBskyActorDefs { interface ProfileViewBasic { - [Brand.Type]?: "chat.bsky.actor.defs#profileViewBasic"; + [Brand.Type]: "chat.bsky.actor.defs#profileViewBasic"; did: At.DID; handle: At.Handle; associated?: AppBskyActorDefs.ProfileAssociated; @@ -2389,7 +2389,7 @@ export declare namespace ChatBskyActorExportAccountData { export declare namespace ChatBskyConvoDefs { interface ConvoView { - [Brand.Type]?: "chat.bsky.convo.defs#convoView"; + [Brand.Type]: "chat.bsky.convo.defs#convoView"; id: string; members: ChatBskyActorDefs.ProfileViewBasic[]; muted: boolean; @@ -2399,36 +2399,36 @@ export declare namespace ChatBskyConvoDefs { opened?: boolean; } interface DeletedMessageView { - [Brand.Type]?: "chat.bsky.convo.defs#deletedMessageView"; + [Brand.Type]: "chat.bsky.convo.defs#deletedMessageView"; id: string; rev: string; sender: MessageViewSender; sentAt: string; } interface LogBeginConvo { - [Brand.Type]?: "chat.bsky.convo.defs#logBeginConvo"; + [Brand.Type]: "chat.bsky.convo.defs#logBeginConvo"; convoId: string; rev: string; } interface LogCreateMessage { - [Brand.Type]?: "chat.bsky.convo.defs#logCreateMessage"; + [Brand.Type]: "chat.bsky.convo.defs#logCreateMessage"; convoId: string; message: Brand.Union; rev: string; } interface LogDeleteMessage { - [Brand.Type]?: "chat.bsky.convo.defs#logDeleteMessage"; + [Brand.Type]: "chat.bsky.convo.defs#logDeleteMessage"; convoId: string; message: Brand.Union; rev: string; } interface LogLeaveConvo { - [Brand.Type]?: "chat.bsky.convo.defs#logLeaveConvo"; + [Brand.Type]: "chat.bsky.convo.defs#logLeaveConvo"; convoId: string; rev: string; } interface MessageInput { - [Brand.Type]?: "chat.bsky.convo.defs#messageInput"; + [Brand.Type]: "chat.bsky.convo.defs#messageInput"; /** * Maximum string length: 10000 * Maximum grapheme length: 1000 @@ -2439,13 +2439,13 @@ export declare namespace ChatBskyConvoDefs { facets?: AppBskyRichtextFacet.Main[]; } interface MessageRef { - [Brand.Type]?: "chat.bsky.convo.defs#messageRef"; + [Brand.Type]: "chat.bsky.convo.defs#messageRef"; convoId: string; did: At.DID; messageId: string; } interface MessageView { - [Brand.Type]?: "chat.bsky.convo.defs#messageView"; + [Brand.Type]: "chat.bsky.convo.defs#messageView"; id: string; rev: string; sender: MessageViewSender; @@ -2460,7 +2460,7 @@ export declare namespace ChatBskyConvoDefs { facets?: AppBskyRichtextFacet.Main[]; } interface MessageViewSender { - [Brand.Type]?: "chat.bsky.convo.defs#messageViewSender"; + [Brand.Type]: "chat.bsky.convo.defs#messageViewSender"; did: At.DID; } } @@ -2591,7 +2591,7 @@ export declare namespace ChatBskyConvoSendMessageBatch { items: ChatBskyConvoDefs.MessageView[]; } interface BatchItem { - [Brand.Type]?: "chat.bsky.convo.sendMessageBatch#batchItem"; + [Brand.Type]: "chat.bsky.convo.sendMessageBatch#batchItem"; convoId: string; message: ChatBskyConvoDefs.MessageInput; } @@ -2629,7 +2629,7 @@ export declare namespace ChatBskyModerationGetActorMetadata { month: Metadata; } interface Metadata { - [Brand.Type]?: "chat.bsky.moderation.getActorMetadata#metadata"; + [Brand.Type]: "chat.bsky.moderation.getActorMetadata#metadata"; convos: number; convosStarted: number; messagesReceived: number; @@ -2667,7 +2667,7 @@ export declare namespace ChatBskyModerationUpdateActorAccess { export declare namespace ComAtprotoAdminDefs { interface AccountView { - [Brand.Type]?: "com.atproto.admin.defs#accountView"; + [Brand.Type]: "com.atproto.admin.defs#accountView"; did: At.DID; handle: At.Handle; indexedAt: string; @@ -2682,22 +2682,22 @@ export declare namespace ComAtprotoAdminDefs { threatSignatures?: ThreatSignature[]; } interface RepoBlobRef { - [Brand.Type]?: "com.atproto.admin.defs#repoBlobRef"; + [Brand.Type]: "com.atproto.admin.defs#repoBlobRef"; cid: At.CID; did: At.DID; recordUri?: At.Uri; } interface RepoRef { - [Brand.Type]?: "com.atproto.admin.defs#repoRef"; + [Brand.Type]: "com.atproto.admin.defs#repoRef"; did: At.DID; } interface StatusAttr { - [Brand.Type]?: "com.atproto.admin.defs#statusAttr"; + [Brand.Type]: "com.atproto.admin.defs#statusAttr"; applied: boolean; ref?: string; } interface ThreatSignature { - [Brand.Type]?: "com.atproto.admin.defs#threatSignature"; + [Brand.Type]: "com.atproto.admin.defs#threatSignature"; property: string; value: string; } @@ -2962,7 +2962,7 @@ export declare namespace ComAtprotoIdentityUpdateHandle { export declare namespace ComAtprotoLabelDefs { /** Metadata tag on an atproto resource (eg, repo or record). */ interface Label { - [Brand.Type]?: "com.atproto.label.defs#label"; + [Brand.Type]: "com.atproto.label.defs#label"; /** Timestamp when this label was created. */ cts: string; /** DID of the actor who created this label. */ @@ -3000,7 +3000,7 @@ export declare namespace ComAtprotoLabelDefs { | (string & {}); /** Declares a label value and its expected interpretations and behaviors. */ interface LabelValueDefinition { - [Brand.Type]?: "com.atproto.label.defs#labelValueDefinition"; + [Brand.Type]: "com.atproto.label.defs#labelValueDefinition"; /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ blurs: "content" | "media" | "none" | (string & {}); /** @@ -3022,7 +3022,7 @@ export declare namespace ComAtprotoLabelDefs { } /** Strings which describe the label in the UI, localized into a specific language. */ interface LabelValueDefinitionStrings { - [Brand.Type]?: "com.atproto.label.defs#labelValueDefinitionStrings"; + [Brand.Type]: "com.atproto.label.defs#labelValueDefinitionStrings"; /** * A longer description of what the label means and why it might be applied. * Maximum string length: 100000 @@ -3040,7 +3040,7 @@ export declare namespace ComAtprotoLabelDefs { } /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ interface SelfLabel { - [Brand.Type]?: "com.atproto.label.defs#selfLabel"; + [Brand.Type]: "com.atproto.label.defs#selfLabel"; /** * The short string name of the value or type of this label. * Maximum string length: 128 @@ -3049,7 +3049,7 @@ export declare namespace ComAtprotoLabelDefs { } /** Metadata tags on an atproto record, published by the author within the record. */ interface SelfLabels { - [Brand.Type]?: "com.atproto.label.defs#selfLabels"; + [Brand.Type]: "com.atproto.label.defs#selfLabels"; /** Maximum array length: 10 */ values: SelfLabel[]; } @@ -3087,12 +3087,12 @@ export declare namespace ComAtprotoLabelSubscribeLabels { FutureCursor: {}; } interface Info { - [Brand.Type]?: "com.atproto.label.subscribeLabels#info"; + [Brand.Type]: "com.atproto.label.subscribeLabels#info"; name: "OutdatedCursor" | (string & {}); message?: string; } interface Labels { - [Brand.Type]?: "com.atproto.label.subscribeLabels#labels"; + [Brand.Type]: "com.atproto.label.subscribeLabels#labels"; labels: ComAtprotoLabelDefs.Label[]; seq: number; } @@ -3170,36 +3170,36 @@ export declare namespace ComAtprotoRepoApplyWrites { } /** Operation which creates a new record. */ interface Create { - [Brand.Type]?: "com.atproto.repo.applyWrites#create"; + [Brand.Type]: "com.atproto.repo.applyWrites#create"; collection: string; value: unknown; /** Maximum string length: 512 */ rkey?: string; } interface CreateResult { - [Brand.Type]?: "com.atproto.repo.applyWrites#createResult"; + [Brand.Type]: "com.atproto.repo.applyWrites#createResult"; cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); } /** Operation which deletes an existing record. */ interface Delete { - [Brand.Type]?: "com.atproto.repo.applyWrites#delete"; + [Brand.Type]: "com.atproto.repo.applyWrites#delete"; collection: string; rkey: string; } interface DeleteResult { - [Brand.Type]?: "com.atproto.repo.applyWrites#deleteResult"; + [Brand.Type]: "com.atproto.repo.applyWrites#deleteResult"; } /** Operation which updates an existing record. */ interface Update { - [Brand.Type]?: "com.atproto.repo.applyWrites#update"; + [Brand.Type]: "com.atproto.repo.applyWrites#update"; collection: string; rkey: string; value: unknown; } interface UpdateResult { - [Brand.Type]?: "com.atproto.repo.applyWrites#updateResult"; + [Brand.Type]: "com.atproto.repo.applyWrites#updateResult"; cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); @@ -3239,7 +3239,7 @@ export declare namespace ComAtprotoRepoCreateRecord { export declare namespace ComAtprotoRepoDefs { interface CommitMeta { - [Brand.Type]?: "com.atproto.repo.defs#commitMeta"; + [Brand.Type]: "com.atproto.repo.defs#commitMeta"; cid: At.CID; rev: string; } @@ -3334,7 +3334,7 @@ export declare namespace ComAtprotoRepoListMissingBlobs { cursor?: string; } interface RecordBlob { - [Brand.Type]?: "com.atproto.repo.listMissingBlobs#recordBlob"; + [Brand.Type]: "com.atproto.repo.listMissingBlobs#recordBlob"; cid: At.CID; recordUri: At.Uri; } @@ -3374,7 +3374,7 @@ export declare namespace ComAtprotoRepoListRecords { cursor?: string; } interface Record { - [Brand.Type]?: "com.atproto.repo.listRecords#record"; + [Brand.Type]: "com.atproto.repo.listRecords#record"; cid: At.CID; uri: At.Uri; value: unknown; @@ -3416,7 +3416,7 @@ export declare namespace ComAtprotoRepoPutRecord { export declare namespace ComAtprotoRepoStrongRef { interface Main { - [Brand.Type]?: "com.atproto.repo.strongRef"; + [Brand.Type]: "com.atproto.repo.strongRef"; cid: At.CID; uri: At.Uri; } @@ -3525,7 +3525,7 @@ export declare namespace ComAtprotoServerCreateAppPassword { AccountTakedown: {}; } interface AppPassword { - [Brand.Type]?: "com.atproto.server.createAppPassword#appPassword"; + [Brand.Type]: "com.atproto.server.createAppPassword#appPassword"; createdAt: string; name: string; password: string; @@ -3558,7 +3558,7 @@ export declare namespace ComAtprotoServerCreateInviteCodes { codes: AccountCodes[]; } interface AccountCodes { - [Brand.Type]?: "com.atproto.server.createInviteCodes#accountCodes"; + [Brand.Type]: "com.atproto.server.createInviteCodes#accountCodes"; account: string; codes: string[]; } @@ -3604,7 +3604,7 @@ export declare namespace ComAtprotoServerDeactivateAccount { export declare namespace ComAtprotoServerDefs { interface InviteCode { - [Brand.Type]?: "com.atproto.server.defs#inviteCode"; + [Brand.Type]: "com.atproto.server.defs#inviteCode"; available: number; code: string; createdAt: string; @@ -3614,7 +3614,7 @@ export declare namespace ComAtprotoServerDefs { uses: InviteCodeUse[]; } interface InviteCodeUse { - [Brand.Type]?: "com.atproto.server.defs#inviteCodeUse"; + [Brand.Type]: "com.atproto.server.defs#inviteCodeUse"; usedAt: string; usedBy: At.DID; } @@ -3660,11 +3660,11 @@ export declare namespace ComAtprotoServerDescribeServer { phoneVerificationRequired?: boolean; } interface Contact { - [Brand.Type]?: "com.atproto.server.describeServer#contact"; + [Brand.Type]: "com.atproto.server.describeServer#contact"; email?: string; } interface Links { - [Brand.Type]?: "com.atproto.server.describeServer#links"; + [Brand.Type]: "com.atproto.server.describeServer#links"; privacyPolicy?: string; termsOfService?: string; } @@ -3737,7 +3737,7 @@ export declare namespace ComAtprotoServerListAppPasswords { AccountTakedown: {}; } interface AppPassword { - [Brand.Type]?: "com.atproto.server.listAppPasswords#appPassword"; + [Brand.Type]: "com.atproto.server.listAppPasswords#appPassword"; createdAt: string; name: string; privileged?: boolean; @@ -4043,7 +4043,7 @@ export declare namespace ComAtprotoSyncListRepos { cursor?: string; } interface Repo { - [Brand.Type]?: "com.atproto.sync.listRepos#repo"; + [Brand.Type]: "com.atproto.sync.listRepos#repo"; did: At.DID; /** Current repo commit CID */ head: At.CID; @@ -4088,7 +4088,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ interface Account { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#account"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#account"; /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; did: At.DID; @@ -4104,7 +4104,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ interface Commit { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#commit"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#commit"; /** List of new blobs (by CID) referenced by records in this commit. */ blobs: At.CIDLink[]; /** CAR file containing relevant blocks, as a diff since the previous repo state. */ @@ -4144,7 +4144,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * \@deprecated */ interface Handle { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#handle"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#handle"; did: At.DID; handle: At.Handle; seq: number; @@ -4152,7 +4152,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ interface Identity { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#identity"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#identity"; did: At.DID; seq: number; time: string; @@ -4160,7 +4160,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { handle?: At.Handle; } interface Info { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#info"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#info"; name: "OutdatedCursor" | (string & {}); message?: string; } @@ -4169,7 +4169,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * \@deprecated */ interface Migrate { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#migrate"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#migrate"; did: At.DID; migrateTo: string | null; seq: number; @@ -4177,7 +4177,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** A repo operation, ie a mutation of a single record. */ interface RepoOp { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#repoOp"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#repoOp"; action: "create" | "delete" | "update" | (string & {}); /** For creates and updates, the new record CID. For deletions, null. */ cid: At.CIDLink | null; @@ -4188,7 +4188,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * \@deprecated */ interface Tombstone { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#tombstone"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#tombstone"; did: At.DID; seq: number; time: string; @@ -4267,7 +4267,7 @@ export declare namespace ToolsOzoneCommunicationCreateTemplate { export declare namespace ToolsOzoneCommunicationDefs { interface TemplateView { - [Brand.Type]?: "tools.ozone.communication.defs#templateView"; + [Brand.Type]: "tools.ozone.communication.defs#templateView"; /** Subject of the message, used in emails. */ contentMarkdown: string; createdAt: string; @@ -4330,7 +4330,7 @@ export declare namespace ToolsOzoneCommunicationUpdateTemplate { export declare namespace ToolsOzoneModerationDefs { /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ interface AccountEvent { - [Brand.Type]?: "tools.ozone.moderation.defs#accountEvent"; + [Brand.Type]: "tools.ozone.moderation.defs#accountEvent"; /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; timestamp: string; @@ -4345,7 +4345,7 @@ export declare namespace ToolsOzoneModerationDefs { | (string & {}); } interface AccountHosting { - [Brand.Type]?: "tools.ozone.moderation.defs#accountHosting"; + [Brand.Type]: "tools.ozone.moderation.defs#accountHosting"; status: | "deactivated" | "deleted" @@ -4360,7 +4360,7 @@ export declare namespace ToolsOzoneModerationDefs { updatedAt?: string; } interface BlobView { - [Brand.Type]?: "tools.ozone.moderation.defs#blobView"; + [Brand.Type]: "tools.ozone.moderation.defs#blobView"; cid: At.CID; createdAt: string; mimeType: string; @@ -4370,7 +4370,7 @@ export declare namespace ToolsOzoneModerationDefs { } /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ interface IdentityEvent { - [Brand.Type]?: "tools.ozone.moderation.defs#identityEvent"; + [Brand.Type]: "tools.ozone.moderation.defs#identityEvent"; timestamp: string; comment?: string; handle?: At.Handle; @@ -4378,37 +4378,37 @@ export declare namespace ToolsOzoneModerationDefs { tombstone?: boolean; } interface ImageDetails { - [Brand.Type]?: "tools.ozone.moderation.defs#imageDetails"; + [Brand.Type]: "tools.ozone.moderation.defs#imageDetails"; height: number; width: number; } interface Moderation { - [Brand.Type]?: "tools.ozone.moderation.defs#moderation"; + [Brand.Type]: "tools.ozone.moderation.defs#moderation"; subjectStatus?: SubjectStatusView; } interface ModerationDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#moderationDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#moderationDetail"; subjectStatus?: SubjectStatusView; } interface ModEventAcknowledge { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventAcknowledge"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventAcknowledge"; comment?: string; } /** Add a comment to a subject */ interface ModEventComment { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventComment"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventComment"; comment: string; /** Make the comment persistent on the subject */ sticky?: boolean; } /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ interface ModEventDivert { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventDivert"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventDivert"; comment?: string; } /** Keep a log of outgoing email to a user */ interface ModEventEmail { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventEmail"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventEmail"; /** The subject line of the email sent to the user. */ subjectLine: string; /** Additional comment about the outgoing comm. */ @@ -4417,33 +4417,33 @@ export declare namespace ToolsOzoneModerationDefs { content?: string; } interface ModEventEscalate { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventEscalate"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventEscalate"; comment?: string; } /** Apply/Negate labels on a subject */ interface ModEventLabel { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventLabel"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventLabel"; createLabelVals: string[]; negateLabelVals: string[]; comment?: string; } /** Mute incoming reports on a subject */ interface ModEventMute { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventMute"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventMute"; /** Indicates how long the subject should remain muted. */ durationInHours: number; comment?: string; } /** Mute incoming reports from an account */ interface ModEventMuteReporter { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventMuteReporter"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventMuteReporter"; comment?: string; /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ durationInHours?: number; } /** Report a subject */ interface ModEventReport { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventReport"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventReport"; reportType: ComAtprotoModerationDefs.ReasonType; comment?: string; /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ @@ -4451,19 +4451,19 @@ export declare namespace ToolsOzoneModerationDefs { } /** Resolve appeal on a subject */ interface ModEventResolveAppeal { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventResolveAppeal"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventResolveAppeal"; /** Describe resolution. */ comment?: string; } /** Revert take down action on a subject */ interface ModEventReverseTakedown { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventReverseTakedown"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventReverseTakedown"; /** Describe reasoning behind the reversal. */ comment?: string; } /** Add/Remove a tag on a subject */ interface ModEventTag { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventTag"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventTag"; /** Tags to be added to the subject. If already exists, won't be duplicated. */ add: string[]; /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ @@ -4473,7 +4473,7 @@ export declare namespace ToolsOzoneModerationDefs { } /** Take down a subject permanently or temporarily */ interface ModEventTakedown { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventTakedown"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventTakedown"; /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ acknowledgeAccountSubjects?: boolean; comment?: string; @@ -4482,18 +4482,18 @@ export declare namespace ToolsOzoneModerationDefs { } /** Unmute action on a subject */ interface ModEventUnmute { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmute"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmute"; /** Describe reasoning behind the reversal. */ comment?: string; } /** Unmute incoming reports from an account */ interface ModEventUnmuteReporter { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmuteReporter"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmuteReporter"; /** Describe reasoning behind the reversal. */ comment?: string; } interface ModEventView { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventView"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventView"; createdAt: string; createdBy: At.DID; event: Brand.Union< @@ -4527,7 +4527,7 @@ export declare namespace ToolsOzoneModerationDefs { subjectHandle?: string; } interface ModEventViewDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventViewDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventViewDetail"; createdAt: string; createdBy: At.DID; event: Brand.Union< @@ -4558,21 +4558,21 @@ export declare namespace ToolsOzoneModerationDefs { } /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ interface RecordEvent { - [Brand.Type]?: "tools.ozone.moderation.defs#recordEvent"; + [Brand.Type]: "tools.ozone.moderation.defs#recordEvent"; op: "create" | "delete" | "update" | (string & {}); timestamp: string; cid?: At.CID; comment?: string; } interface RecordHosting { - [Brand.Type]?: "tools.ozone.moderation.defs#recordHosting"; + [Brand.Type]: "tools.ozone.moderation.defs#recordHosting"; status: "deleted" | "unknown" | (string & {}); createdAt?: string; deletedAt?: string; updatedAt?: string; } interface RecordView { - [Brand.Type]?: "tools.ozone.moderation.defs#recordView"; + [Brand.Type]: "tools.ozone.moderation.defs#recordView"; blobCids: At.CID[]; cid: At.CID; indexedAt: string; @@ -4582,7 +4582,7 @@ export declare namespace ToolsOzoneModerationDefs { value: unknown; } interface RecordViewDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#recordViewDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#recordViewDetail"; blobs: BlobView[]; cid: At.CID; indexedAt: string; @@ -4593,11 +4593,11 @@ export declare namespace ToolsOzoneModerationDefs { labels?: ComAtprotoLabelDefs.Label[]; } interface RecordViewNotFound { - [Brand.Type]?: "tools.ozone.moderation.defs#recordViewNotFound"; + [Brand.Type]: "tools.ozone.moderation.defs#recordViewNotFound"; uri: At.Uri; } interface RepoView { - [Brand.Type]?: "tools.ozone.moderation.defs#repoView"; + [Brand.Type]: "tools.ozone.moderation.defs#repoView"; did: At.DID; handle: At.Handle; indexedAt: string; @@ -4611,7 +4611,7 @@ export declare namespace ToolsOzoneModerationDefs { threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } interface RepoViewDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#repoViewDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#repoViewDetail"; did: At.DID; handle: At.Handle; indexedAt: string; @@ -4628,7 +4628,7 @@ export declare namespace ToolsOzoneModerationDefs { threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } interface RepoViewNotFound { - [Brand.Type]?: "tools.ozone.moderation.defs#repoViewNotFound"; + [Brand.Type]: "tools.ozone.moderation.defs#repoViewNotFound"; did: At.DID; } type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; @@ -4642,7 +4642,7 @@ export declare namespace ToolsOzoneModerationDefs { | "#reviewOpen" | (string & {}); interface SubjectStatusView { - [Brand.Type]?: "tools.ozone.moderation.defs#subjectStatusView"; + [Brand.Type]: "tools.ozone.moderation.defs#subjectStatusView"; /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ createdAt: string; id: number; @@ -4671,7 +4671,7 @@ export declare namespace ToolsOzoneModerationDefs { takendown?: boolean; } interface VideoDetails { - [Brand.Type]?: "tools.ozone.moderation.defs#videoDetails"; + [Brand.Type]: "tools.ozone.moderation.defs#videoDetails"; height: number; length: number; width: number; @@ -4937,11 +4937,11 @@ export declare namespace ToolsOzoneServerGetConfig { viewer?: ViewerConfig; } interface ServiceConfig { - [Brand.Type]?: "tools.ozone.server.getConfig#serviceConfig"; + [Brand.Type]: "tools.ozone.server.getConfig#serviceConfig"; url?: string; } interface ViewerConfig { - [Brand.Type]?: "tools.ozone.server.getConfig#viewerConfig"; + [Brand.Type]: "tools.ozone.server.getConfig#viewerConfig"; role?: | "tools.ozone.team.defs#roleAdmin" | "tools.ozone.team.defs#roleModerator" @@ -4968,7 +4968,7 @@ export declare namespace ToolsOzoneSetAddValues { export declare namespace ToolsOzoneSetDefs { interface Set { - [Brand.Type]?: "tools.ozone.set.defs#set"; + [Brand.Type]: "tools.ozone.set.defs#set"; /** * Minimum string length: 3 * Maximum string length: 128 @@ -4981,7 +4981,7 @@ export declare namespace ToolsOzoneSetDefs { description?: string; } interface SetView { - [Brand.Type]?: "tools.ozone.set.defs#setView"; + [Brand.Type]: "tools.ozone.set.defs#setView"; createdAt: string; /** * Minimum string length: 3 @@ -5087,7 +5087,7 @@ export declare namespace ToolsOzoneSetUpsertSet { export declare namespace ToolsOzoneSettingDefs { interface Option { - [Brand.Type]?: "tools.ozone.setting.defs#option"; + [Brand.Type]: "tools.ozone.setting.defs#option"; createdBy: At.DID; did: At.DID; key: string; @@ -5172,7 +5172,7 @@ export declare namespace ToolsOzoneSettingUpsertOption { export declare namespace ToolsOzoneSignatureDefs { interface SigDetail { - [Brand.Type]?: "tools.ozone.signature.defs#sigDetail"; + [Brand.Type]: "tools.ozone.signature.defs#sigDetail"; property: string; value: string; } @@ -5207,7 +5207,7 @@ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { cursor?: string; } interface RelatedAccount { - [Brand.Type]?: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; + [Brand.Type]: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; account: ComAtprotoAdminDefs.AccountView; similarities?: ToolsOzoneSignatureDefs.SigDetail[]; } @@ -5251,7 +5251,7 @@ export declare namespace ToolsOzoneTeamAddMember { export declare namespace ToolsOzoneTeamDefs { interface Member { - [Brand.Type]?: "tools.ozone.team.defs#member"; + [Brand.Type]: "tools.ozone.team.defs#member"; did: At.DID; role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); createdAt?: string; From 0a5b1a82268558a4540f9bf61efe4c8498aeb83c Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 14:32:37 -0500 Subject: [PATCH 28/68] linting --- packages/lex-cli/src/generator/index.ts | 48 ++--- .../src/generator/resolvers/primitives.ts | 4 +- packages/lex-cli/src/generator/schema.ts | 177 ++++++++++++------ packages/lex-cli/src/index.ts | 8 +- packages/lexicons/scripts/generate-types.ts | 5 +- packages/lexicons/src/index.ts | 71 ++++--- 6 files changed, 197 insertions(+), 116 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index c03e558..5308742 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -4,7 +4,7 @@ import { getDescriptions, writeJsdoc } from '../utils/docs.js'; import { mainPrelude } from '../utils/prelude.js'; import { sortDefinition, sortName, sortPropertyKeys } from '../utils/sort.js'; import { resolveType } from './resolvers/type.js'; -import { documentSchema, type DocumentSchema } from './schema.js'; +import { type DocumentSchema, documentSchema } from './schema.js'; export interface GenerateDefinitionsOptions { files: string[]; @@ -35,7 +35,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { if (main) { code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } + } else { code += `\n\nimport "@tsky/lexicons";${banner ?? ''} @@ -53,7 +53,7 @@ declare module "@tsky/lexicons" {`; throw new Error('Invalid document schema'); } document = parsed; - } + } catch (err) { throw new Error(`failed to read ${filename}`, { cause: err }); } @@ -79,10 +79,10 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'token') { chunk += `type ${typeName} = '${nsid}';`; - } + } else if (type === 'object') { const required = def.required; const nullable = def.nullable; @@ -108,7 +108,7 @@ declare module "@tsky/lexicons" {`; } chunk += '}'; - } + } else if (type === 'array') { const { value, descriptions } = resolveType(nsid, def.items); const descs = []; @@ -123,7 +123,7 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descs.concat(descriptions)); chunk += `type ${typeName} = (${value})[];`; - } + } else if (type === 'record') { const obj = def.record; const required = obj.required; @@ -152,7 +152,7 @@ declare module "@tsky/lexicons" {`; chunk += '}'; records += `\n'${nsid}': ${tsNamespace}.Record;`; - } + } else if (type === 'query' || type === 'procedure') { let parameters = def.parameters; const input = type === 'procedure' ? def.input : undefined; @@ -164,14 +164,14 @@ declare module "@tsky/lexicons" {`; if (parameters) { if (Object.values(parameters.properties).length === 0) { parameters = undefined; - } + } else { const { value, descriptions } = resolveType(nsid, parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; } - } + } else { chunk += 'interface Params {}'; } @@ -184,15 +184,15 @@ declare module "@tsky/lexicons" {`; if (input.schema?.type === 'object') { chunk += `interface Input ${value}`; - } + } else { chunk += `type Input = ${value};`; } - } + } else { chunk += 'type Input = Blob | ArrayBufferView;'; } - } + } else { chunk += 'type Input = undefined;'; } @@ -205,15 +205,15 @@ declare module "@tsky/lexicons" {`; if (output.schema?.type === 'object') { chunk += `interface Output ${value}`; - } + } else { chunk += `type Output = ${value};`; } - } + } else { chunk += 'type Output = Uint8Array;'; } - } + } else { chunk += 'type Output = undefined;'; } @@ -245,30 +245,30 @@ declare module "@tsky/lexicons" {`; if (type === 'query') { queries += rc; - } + } else if (type === 'procedure') { procedures += rc; } } - } + } else if (type === 'blob') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'bytes') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'subscription') { if (def.parameters) { const { value, descriptions } = resolveType(nsid, def.parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; - } + } else { chunk += 'interface Params {}'; } @@ -300,7 +300,7 @@ declare module "@tsky/lexicons" {`; } rc += '};'; subscriptions += rc; - } + } else { // eslint-disable-next-line no-console console.log(`${nsid}: unhandled type ${type}`); @@ -311,7 +311,7 @@ declare module "@tsky/lexicons" {`; if (main) { code += `export declare namespace ${tsNamespace} {`; - } + } else { code += `namespace ${tsNamespace} {`; } @@ -325,7 +325,7 @@ declare module "@tsky/lexicons" {`; code += `export declare interface Queries {${queries}}\n\n`; code += `export declare interface Procedures {${procedures}}\n\n`; code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } + } else { code += `interface Records {${records}}\n\n`; code += `interface Queries {${queries}}\n\n`; diff --git a/packages/lex-cli/src/generator/resolvers/primitives.ts b/packages/lex-cli/src/generator/resolvers/primitives.ts index 20430f7..b8fe08c 100644 --- a/packages/lex-cli/src/generator/resolvers/primitives.ts +++ b/packages/lex-cli/src/generator/resolvers/primitives.ts @@ -1,6 +1,4 @@ -export function resolvePrimitiveType( - type: string, -): string { +export function resolvePrimitiveType(type: string): string { switch (type) { case 'unknown': return 'unknown'; diff --git a/packages/lex-cli/src/generator/schema.ts b/packages/lex-cli/src/generator/schema.ts index 72da151..1c565e2 100644 --- a/packages/lex-cli/src/generator/schema.ts +++ b/packages/lex-cli/src/generator/schema.ts @@ -1,11 +1,8 @@ import * as t from 'typanion'; -const isPositiveInteger = t.cascade( - t.isNumber(), - (value): value is number => { - return Number.isInteger(value) && value >= 0; - }, -); +const isPositiveInteger = t.cascade(t.isNumber(), (value): value is number => { + return Number.isInteger(value) && value >= 0; +}); export const booleanSchema = t.isObject({ type: t.isLiteral('boolean'), @@ -42,19 +39,22 @@ const stringFormatSchema = t.isOneOf([ t.isLiteral('uri'), ]); -export const stringSchema: t.StrictValidator = t.cascade( +export const stringSchema: t.StrictValidator< + unknown, + { + type: 'string'; + description?: string; + format?: string; + default?: string; + const?: string; + enum?: string[]; + knownValues?: string[]; + maxLength?: number; + minLength?: number; + maxGraphemes?: number; + minGraphemes?: number; + } +> = t.cascade( t.isObject({ type: t.isLiteral('string'), description: t.isOptional(t.isString()), @@ -68,13 +68,42 @@ export const stringSchema: t.StrictValidator { + ( + value, + ): value is { + type: 'string'; + description?: string; + format?: + | 'at-identifier' + | 'at-uri' + | 'cid' + | 'datetime' + | 'did' + | 'handle' + | 'language' + | 'nsid' + | 'record-key' + | 'tid' + | 'uri'; + default?: string; + const?: string; + enum?: string[]; + knownValues?: string[]; + maxLength?: number; + minLength?: number; + maxGraphemes?: number; + minGraphemes?: number; + } => { if (value.format !== undefined && value.format !== 'uri') { - if (value.maxLength !== undefined + if ( + value.maxLength !== undefined || value.minLength !== undefined || value.maxGraphemes !== undefined - || value.minGraphemes !== undefined) { - throw new Error(`${value.format} format can't be used with length or grapheme constraints`); + || value.minGraphemes !== undefined + ) { + throw new Error( + `${value.format} format can't be used with length or grapheme constraints`, + ); } } return true; @@ -115,10 +144,7 @@ export const cidLinkSchema = t.isObject({ export type CidLinkSchema = t.InferType; -export const ipldTypeSchema = t.isOneOf([ - bytesSchema, - cidLinkSchema, -]); +export const ipldTypeSchema = t.isOneOf([bytesSchema, cidLinkSchema]); export type IpldTypeSchema = t.InferType; @@ -137,7 +163,14 @@ export const refUnionSchema = t.cascade( refs: t.isArray(t.isString()), closed: t.isOptional(t.isBoolean()), }), - (value): value is { type: 'union'; description?: string; refs: string[]; closed?: boolean } => { + ( + value, + ): value is { + type: 'union'; + description?: string; + refs: string[]; + closed?: boolean; + } => { if (value.closed && value.refs.length === 0) { throw new Error(`A closed union can't have empty refs list`); } @@ -147,10 +180,7 @@ export const refUnionSchema = t.cascade( export type RefUnionSchema = t.InferType; -export const refVariantSchema = t.isOneOf([ - refSchema, - refUnionSchema, -]); +export const refVariantSchema = t.isOneOf([refSchema, refUnionSchema]); export type RefVariantSchema = t.InferType; @@ -166,19 +196,27 @@ export type BlobSchema = t.InferType; export const arraySchema = t.isObject({ type: t.isLiteral('array'), description: t.isOptional(t.isString()), - items: t.isOneOf([primitiveSchema, ipldTypeSchema, blobSchema, refVariantSchema]), + items: t.isOneOf([ + primitiveSchema, + ipldTypeSchema, + blobSchema, + refVariantSchema, + ]), maxLength: t.isOptional(isPositiveInteger), minLength: t.isOptional(isPositiveInteger), }); export type ArraySchema = t.InferType; -export const primitiveArraySchema = t.cascade(arraySchema, (value): value is ArraySchema => { - if (!t.isOneOf([primitiveSchema])(value.items)) { - throw new Error('Array items must be primitive types'); - } - return true; -}); +export const primitiveArraySchema = t.cascade( + arraySchema, + (value): value is ArraySchema => { + if (!t.isOneOf([primitiveSchema])(value.items)) { + throw new Error('Array items must be primitive types'); + } + return true; + }, +); export type PrimitiveArraySchema = t.InferType; @@ -197,16 +235,19 @@ function refineRequiredProperties< properties: Record; } - return t.cascade(schema, (value: RequiredPropertiesSchema): value is RequiredPropertiesSchema => { - if (value.required) { - for (const field of value.required) { - if (value.properties[field] === undefined) { - throw new Error(`Required field "${field}" not defined`); + return t.cascade( + schema, + (value: RequiredPropertiesSchema): value is RequiredPropertiesSchema => { + if (value.required) { + for (const field of value.required) { + if (value.properties[field] === undefined) { + throw new Error(`Required field "${field}" not defined`); + } } } - } - return true; - }); + return true; + }, + ); } export const objectSchema = refineRequiredProperties( @@ -215,13 +256,15 @@ export const objectSchema = refineRequiredProperties( description: t.isOptional(t.isString()), required: t.isOptional(t.isArray(t.isString())), nullable: t.isOptional(t.isArray(t.isString())), - properties: t.isRecord(t.isOneOf([ - refVariantSchema, - ipldTypeSchema, - arraySchema, - blobSchema, - primitiveSchema, - ])), + properties: t.isRecord( + t.isOneOf([ + refVariantSchema, + ipldTypeSchema, + arraySchema, + blobSchema, + primitiveSchema, + ]), + ), }), ); @@ -251,7 +294,9 @@ export const xrpcSubscriptionMessageSchema = t.isObject({ schema: t.isOptional(t.isOneOf([refVariantSchema, objectSchema])), }); -export type XrpcSubscriptionMessageSchema = t.InferType; +export type XrpcSubscriptionMessageSchema = t.InferType< + typeof xrpcSubscriptionMessageSchema +>; export const xrpcErrorSchema = t.isObject({ name: t.isString(), @@ -319,11 +364,9 @@ export const userTypeSchema = t.isOneOf([ export type UserTypeSchema = t.InferType; -const NSID_RE = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; -const nsidType = t.cascade( - t.isString(), - value => NSID_RE.test(value), -); +const NSID_RE + = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; +const nsidType = t.cascade(t.isString(), value => NSID_RE.test(value)); export const documentSchema = t.cascade( t.isObject({ @@ -333,7 +376,15 @@ export const documentSchema = t.cascade( description: t.isOptional(t.isString()), defs: t.isRecord(userTypeSchema), }), - (value): value is { lexicon: 1; id: string; revision?: number; description?: string; defs: Record } => { + ( + value, + ): value is { + lexicon: 1; + id: string; + revision?: number; + description?: string; + defs: Record; + } => { for (const id in value.defs) { const def = value.defs[id]; const type = def.type; @@ -345,7 +396,9 @@ export const documentSchema = t.cascade( || type === 'procedure' || type === 'subscription') ) { - throw new Error(`${type} must be the \`main\` definition (in defs.${id})`); + throw new Error( + `${type} must be the \`main\` definition (in defs.${id})`, + ); } } return true; diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 69020a3..28e3e81 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -1,6 +1,6 @@ import { writeFile } from 'node:fs/promises'; import process from 'node:process'; -import { Builtins, Command, Option, Cli } from 'clipanion'; +import { Builtins, Cli, Command, Option } from 'clipanion'; import pc from 'picocolors'; import prettier from 'prettier'; import * as t from 'typanion'; @@ -53,7 +53,7 @@ cli.register( banner: this.banner, description: this.desc, }); - } + } catch (err) { if (err instanceof Error) { console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); @@ -61,7 +61,7 @@ cli.register( if (err.cause instanceof Error) { console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); } - } + } else { console.error(pc.bold(pc.red('unknown error occurred:'))); console.error(err); @@ -81,7 +81,7 @@ cli.register( if (this.output) { await writeFile(this.output, formatted); - } + } else { // eslint-disable-next-line no-console console.log(formatted); diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index 78f180f..09c8218 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -48,7 +48,7 @@ async function downloadLexicons() { await tar.x({ file: tarFile, cwd: LEXICONS_DIR, - filter: (path) => path.includes('/lexicons/'), + filter: path => path.includes('/lexicons/'), strip: 2, }); @@ -108,7 +108,8 @@ async function main() { }); console.log('Done! Types generated at', TYPES_OUTPUT_PATH); - } catch (error) { + } + catch (error) { console.error('Error:', error); process.exit(1); } diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index ccfe921..a8eb681 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -27,13 +27,17 @@ export type BskyQuery = { export type QueryParams = Queries[T] extends { params: infer P; -} ? P : never; +} + ? P + : never; export type QueryOutput = Queries[T]['output']; export type QueryErrors = Queries[T] extends { errors: infer E; -} ? E : never; +} + ? E + : never; // --- Procedure Types --- export type ProcedureDefs = LexiconUnion; @@ -41,27 +45,46 @@ export type BskyProcedure = { [K in keyof Procedures]: K extends BskyNSID ? Procedures[K] : never; }[keyof Procedures]; -export type ProcedureParams = Procedures[T] extends { - params: infer P; -} ? P : never; +export type ProcedureParams = + Procedures[T] extends { + params: infer P; + } + ? P + : never; export type ProcedureInput = Procedures[T] extends { input: infer I; -} ? I : never; - -export type ProcedureOutput = Procedures[T] extends { - output: infer O; -} ? O : never; - -export type ProcedureErrors = Procedures[T] extends { - errors: infer E; -} ? E : never; +} + ? I + : never; + +export type ProcedureOutput = + Procedures[T] extends { + output: infer O; + } + ? O + : never; + +export type ProcedureErrors = + Procedures[T] extends { + errors: infer E; + } + ? E + : never; // --- Common Bluesky Types --- -export type BskyPost = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.post` }; -export type BskyProfile = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}actor.profile` }; -export type BskyLike = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.like` }; -export type BskyFollow = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}graph.follow` }; +export type BskyPost = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}feed.post`; +}; +export type BskyProfile = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}actor.profile`; +}; +export type BskyLike = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}feed.like`; +}; +export type BskyFollow = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}graph.follow`; +}; // --- Type Guards --- export function isRecord(value: unknown): value is RecordDefs { @@ -82,7 +105,9 @@ export function isAtProtoRecord(value: unknown): value is AtProtoRecord { } export function isBskyPost(value: unknown): value is BskyPost { - return isBskyRecord(value) && value.$type.startsWith(`${APP_BSKY_PREFIX}feed.post`); + return ( + isBskyRecord(value) && value.$type.startsWith(`${APP_BSKY_PREFIX}feed.post`) + ); } // --- Error Types and Guards --- @@ -104,5 +129,9 @@ export function isBskyError(value: unknown): value is BskyError { } // --- Helper Types --- -export type BskyQueryParams = T extends keyof Queries ? QueryParams : never; -export type BskyProcedureInput = T extends keyof Procedures ? ProcedureInput : never; +export type BskyQueryParams = T extends keyof Queries + ? QueryParams + : never; +export type BskyProcedureInput = T extends keyof Procedures + ? ProcedureInput + : never; From b36573926555fe9d747048726998814cdbc0f4f9 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 15:26:59 -0500 Subject: [PATCH 29/68] add package entry point for direct imports --- packages/lexicons/index.ts | 1 + packages/lexicons/package.json | 15 ++++++++++++++- packages/lexicons/tsconfig.json | 9 ++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 packages/lexicons/index.ts diff --git a/packages/lexicons/index.ts b/packages/lexicons/index.ts new file mode 100644 index 0000000..cba1843 --- /dev/null +++ b/packages/lexicons/index.ts @@ -0,0 +1 @@ +export * from './src/index'; diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 4a08792..39487b4 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -2,11 +2,24 @@ "name": "@tsky/lexicons", "type": "module", "version": "0.0.1", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], "publishConfig": { "access": "public" }, "scripts": { - "build": "tsx ./scripts/generate-types.ts" + "build": "tsx ./scripts/generate-types.ts && tsc", + "clean": "rm -rf dist && rm -rf lexicons", + "prepublish": "npm run build" }, "devDependencies": { "@tsky/lex-cli": "workspace:*", diff --git a/packages/lexicons/tsconfig.json b/packages/lexicons/tsconfig.json index 53d5d52..4a8cb3c 100644 --- a/packages/lexicons/tsconfig.json +++ b/packages/lexicons/tsconfig.json @@ -2,13 +2,16 @@ "compilerOptions": { "target": "ESNext", "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "strict": true, + "declaration": true, + "declarationMap": true, + "outDir": "./dist", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "skipLibCheck": true }, - "include": ["scripts/**/*", "src/**/*"], - "exclude": ["node_modules"] + "include": ["index.ts", "src/**/*"], + "exclude": ["node_modules", "dist", "scripts"] } From eb09b04580d58fa5a89692e2ee8cfc0339d80837 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 15:39:57 -0500 Subject: [PATCH 30/68] add index files for better module organization --- packages/lex-cli/package.json | 8 ++- packages/lex-cli/src/generator/index.ts | 55 +++++++++---------- .../src/generator/resolvers/complex.ts | 8 +-- .../lex-cli/src/generator/resolvers/index.ts | 5 ++ .../src/generator/resolvers/numeric.ts | 2 +- .../lex-cli/src/generator/resolvers/string.ts | 5 +- .../lex-cli/src/generator/resolvers/type.ts | 12 ++-- packages/lex-cli/src/index.ts | 8 +-- packages/lex-cli/src/utils/index.ts | 5 ++ packages/lex-cli/tsconfig.json | 3 +- 10 files changed, 61 insertions(+), 50 deletions(-) create mode 100644 packages/lex-cli/src/generator/resolvers/index.ts create mode 100644 packages/lex-cli/src/utils/index.ts diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index 63e7686..703037f 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -3,7 +3,13 @@ "type": "module", "version": "0.0.1", "license": "MIT", - "bin": "dist/index.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "bin": "./dist/index.js", "scripts": { "build": "tsc", "prepublish": "pnpm run build" diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 5308742..95cc15b 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -1,10 +1,7 @@ import { readFile } from 'node:fs/promises'; -import { toNamespace } from '../utils/cache.js'; -import { getDescriptions, writeJsdoc } from '../utils/docs.js'; -import { mainPrelude } from '../utils/prelude.js'; -import { sortDefinition, sortName, sortPropertyKeys } from '../utils/sort.js'; -import { resolveType } from './resolvers/type.js'; -import { type DocumentSchema, documentSchema } from './schema.js'; +import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils'; +import { resolveType } from './resolvers'; +import { type DocumentSchema, documentSchema } from './schema'; export interface GenerateDefinitionsOptions { files: string[]; @@ -35,7 +32,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { if (main) { code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } + } else { code += `\n\nimport "@tsky/lexicons";${banner ?? ''} @@ -53,7 +50,7 @@ declare module "@tsky/lexicons" {`; throw new Error('Invalid document schema'); } document = parsed; - } + } catch (err) { throw new Error(`failed to read ${filename}`, { cause: err }); } @@ -79,10 +76,10 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'token') { chunk += `type ${typeName} = '${nsid}';`; - } + } else if (type === 'object') { const required = def.required; const nullable = def.nullable; @@ -108,7 +105,7 @@ declare module "@tsky/lexicons" {`; } chunk += '}'; - } + } else if (type === 'array') { const { value, descriptions } = resolveType(nsid, def.items); const descs = []; @@ -123,7 +120,7 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descs.concat(descriptions)); chunk += `type ${typeName} = (${value})[];`; - } + } else if (type === 'record') { const obj = def.record; const required = obj.required; @@ -152,7 +149,7 @@ declare module "@tsky/lexicons" {`; chunk += '}'; records += `\n'${nsid}': ${tsNamespace}.Record;`; - } + } else if (type === 'query' || type === 'procedure') { let parameters = def.parameters; const input = type === 'procedure' ? def.input : undefined; @@ -164,14 +161,14 @@ declare module "@tsky/lexicons" {`; if (parameters) { if (Object.values(parameters.properties).length === 0) { parameters = undefined; - } + } else { const { value, descriptions } = resolveType(nsid, parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; } - } + } else { chunk += 'interface Params {}'; } @@ -184,15 +181,15 @@ declare module "@tsky/lexicons" {`; if (input.schema?.type === 'object') { chunk += `interface Input ${value}`; - } + } else { chunk += `type Input = ${value};`; } - } + } else { chunk += 'type Input = Blob | ArrayBufferView;'; } - } + } else { chunk += 'type Input = undefined;'; } @@ -205,15 +202,15 @@ declare module "@tsky/lexicons" {`; if (output.schema?.type === 'object') { chunk += `interface Output ${value}`; - } + } else { chunk += `type Output = ${value};`; } - } + } else { chunk += 'type Output = Uint8Array;'; } - } + } else { chunk += 'type Output = undefined;'; } @@ -245,30 +242,30 @@ declare module "@tsky/lexicons" {`; if (type === 'query') { queries += rc; - } + } else if (type === 'procedure') { procedures += rc; } } - } + } else if (type === 'blob') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'bytes') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'subscription') { if (def.parameters) { const { value, descriptions } = resolveType(nsid, def.parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; - } + } else { chunk += 'interface Params {}'; } @@ -300,7 +297,7 @@ declare module "@tsky/lexicons" {`; } rc += '};'; subscriptions += rc; - } + } else { // eslint-disable-next-line no-console console.log(`${nsid}: unhandled type ${type}`); @@ -311,7 +308,7 @@ declare module "@tsky/lexicons" {`; if (main) { code += `export declare namespace ${tsNamespace} {`; - } + } else { code += `namespace ${tsNamespace} {`; } @@ -325,7 +322,7 @@ declare module "@tsky/lexicons" {`; code += `export declare interface Queries {${queries}}\n\n`; code += `export declare interface Procedures {${procedures}}\n\n`; code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } + } else { code += `interface Records {${records}}\n\n`; code += `interface Queries {${queries}}\n\n`; diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index de465f5..2658312 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -3,11 +3,9 @@ import type { RefSchema, RefUnionSchema, XrpcParametersSchema, -} from '../schema.js'; -import { toNamespace, toUpper } from '../../utils/cache.js'; -import { writeJsdoc } from '../../utils/docs.js'; -import { sortName, sortPropertyKeys } from '../../utils/sort.js'; -import { resolveType } from './type.js'; +} from '../schema'; +import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils'; +import { resolveType } from './type'; export function resolveRefType(def: RefSchema): string { const [ns, ref] = def.ref.split('#'); diff --git a/packages/lex-cli/src/generator/resolvers/index.ts b/packages/lex-cli/src/generator/resolvers/index.ts new file mode 100644 index 0000000..a73f0a3 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/index.ts @@ -0,0 +1,5 @@ +export { resolveObjectType, resolveRefType, resolveUnionType } from './complex'; +export { resolveIntegerType } from './numeric'; +export { resolvePrimitiveType } from './primitives'; +export { resolveStringFormat, resolveStringType } from './string'; +export { resolveType } from './type'; diff --git a/packages/lex-cli/src/generator/resolvers/numeric.ts b/packages/lex-cli/src/generator/resolvers/numeric.ts index 643f76a..35915ca 100644 --- a/packages/lex-cli/src/generator/resolvers/numeric.ts +++ b/packages/lex-cli/src/generator/resolvers/numeric.ts @@ -1,4 +1,4 @@ -import type { IntegerSchema } from '../schema.js'; +import type { IntegerSchema } from '../schema'; export function resolveIntegerType( def: IntegerSchema, diff --git a/packages/lex-cli/src/generator/resolvers/string.ts b/packages/lex-cli/src/generator/resolvers/string.ts index 12af283..b8ebb4d 100644 --- a/packages/lex-cli/src/generator/resolvers/string.ts +++ b/packages/lex-cli/src/generator/resolvers/string.ts @@ -1,6 +1,5 @@ -import type { StringSchema } from '../schema.js'; -import { IGNORED_FORMATS, TYPE_FORMATS } from '../../utils/formats.js'; -import { sortName } from '../../utils/sort.js'; +import type { StringSchema } from '../schema'; +import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils'; export function resolveStringFormat(format: string, nsid: string): string { if (format === 'did') return TYPE_FORMATS.DID; diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts index f3dd9e9..a9a1a1e 100644 --- a/packages/lex-cli/src/generator/resolvers/type.ts +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -2,16 +2,16 @@ import type { RefVariantSchema, UserTypeSchema, XrpcParametersSchema, -} from '../schema.js'; -import { getDescriptions } from '../../utils/docs.js'; +} from '../schema'; +import { getDescriptions } from '../../utils'; import { resolveObjectType, resolveRefType, resolveUnionType, -} from './complex.js'; -import { resolveIntegerType } from './numeric.js'; -import { resolvePrimitiveType } from './primitives.js'; -import { resolveStringType } from './string.js'; +} from './complex'; +import { resolveIntegerType } from './numeric'; +import { resolvePrimitiveType } from './primitives'; +import { resolveStringType } from './string'; export function resolveType( nsid: string, diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 28e3e81..fa8809a 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -4,7 +4,7 @@ import { Builtins, Cli, Command, Option } from 'clipanion'; import pc from 'picocolors'; import prettier from 'prettier'; import * as t from 'typanion'; -import { generateDefinitions } from './generator/index.js'; +import { generateDefinitions } from './generator'; const cli = new Cli({ binaryName: 'lex-cli', @@ -53,7 +53,7 @@ cli.register( banner: this.banner, description: this.desc, }); - } + } catch (err) { if (err instanceof Error) { console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); @@ -61,7 +61,7 @@ cli.register( if (err.cause instanceof Error) { console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); } - } + } else { console.error(pc.bold(pc.red('unknown error occurred:'))); console.error(err); @@ -81,7 +81,7 @@ cli.register( if (this.output) { await writeFile(this.output, formatted); - } + } else { // eslint-disable-next-line no-console console.log(formatted); diff --git a/packages/lex-cli/src/utils/index.ts b/packages/lex-cli/src/utils/index.ts new file mode 100644 index 0000000..b728a13 --- /dev/null +++ b/packages/lex-cli/src/utils/index.ts @@ -0,0 +1,5 @@ +export { toNamespace, toUpper } from './cache'; +export { getDescriptions, writeJsdoc } from './docs'; +export { IGNORED_FORMATS, TYPE_FORMATS } from './formats'; +export { mainPrelude } from './prelude'; +export { sortDefinition, sortName, sortPropertyKeys } from './sort'; diff --git a/packages/lex-cli/tsconfig.json b/packages/lex-cli/tsconfig.json index 17f73ee..9449cba 100644 --- a/packages/lex-cli/tsconfig.json +++ b/packages/lex-cli/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "target": "ESNext", "rootDir": "src", - "module": "NodeNext", + "module": "ESNext", + "moduleResolution": "bundler", "strict": true, "declaration": true, "outDir": "dist", From 92008ccde620593f2f16f9b56b061d65efc045ae Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 15:57:36 -0500 Subject: [PATCH 31/68] extensions required --- packages/lex-cli/src/generator/index.ts | 670 +++++++++--------- .../src/generator/resolvers/complex.ts | 6 +- .../lex-cli/src/generator/resolvers/index.ts | 10 +- .../src/generator/resolvers/numeric.ts | 2 +- .../lex-cli/src/generator/resolvers/string.ts | 4 +- .../lex-cli/src/generator/resolvers/type.ts | 12 +- packages/lex-cli/src/index.ts | 2 +- packages/lex-cli/src/utils/index.ts | 10 +- 8 files changed, 358 insertions(+), 358 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 95cc15b..17adb8d 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -1,335 +1,335 @@ -import { readFile } from 'node:fs/promises'; -import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils'; -import { resolveType } from './resolvers'; -import { type DocumentSchema, documentSchema } from './schema'; - -export interface GenerateDefinitionsOptions { - files: string[]; - main: boolean; - banner?: string; - description?: string; - debug?: boolean; - onProgress?: (filename: string, index: number, total: number) => void; -} - -export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, main, banner, description } = opts; - - let queries = ''; - let procedures = ''; - let records = ''; - let subscriptions = ''; - - let code = `/* eslint-disable */ -// This file is automatically generated, do not edit!`; - - if (description) { - code += `\n\n/** - * @module - * ${description} - */`; - } - - if (main) { - code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } - else { - code += `\n\nimport "@tsky/lexicons";${banner ?? ''} - -declare module "@tsky/lexicons" {`; - } - - for await (const filename of files.sort(sortName)) { - let document: DocumentSchema; - - try { - const jsonString = await readFile(filename, 'utf8'); - const parsed = JSON.parse(jsonString); - - if (!documentSchema(parsed)) { - throw new Error('Invalid document schema'); - } - document = parsed; - } - catch (err) { - throw new Error(`failed to read ${filename}`, { cause: err }); - } - - const ns = document.id; - const tsNamespace = toNamespace(ns); - - let descs: string[] = []; - let chunk = ''; - - const definitions = document.defs; - const keys = Object.keys(definitions).sort(sortDefinition); - - for (const key of keys) { - const def = definitions[key]; - const type = def.type; - - const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; - const typeName = key[0].toUpperCase() + key.slice(1); - - if (type === 'string') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'token') { - chunk += `type ${typeName} = '${nsid}';`; - } - else if (type === 'object') { - const required = def.required; - const nullable = def.nullable; - const properties = def.properties; - - const propKeys = sortPropertyKeys(Object.keys(properties), required); - const descs = getDescriptions(def); - - chunk += writeJsdoc(descs); - chunk += `interface ${typeName} {`; - chunk += `[Brand.Type]: '${nsid}';`; - - for (const prop of propKeys) { - const isOptional = !required || !required.includes(prop); - const isNullable = nullable?.includes(prop); - const { value, descriptions } = resolveType( - `${nsid}/${prop}`, - properties[prop], - ); - - chunk += writeJsdoc(descriptions); - chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; - } - - chunk += '}'; - } - else if (type === 'array') { - const { value, descriptions } = resolveType(nsid, def.items); - const descs = []; - - if (def.maxLength !== undefined) { - descs.push(`Maximum array length: ${def.maxLength}`); - } - - if (def.minLength !== undefined) { - descs.push(`Minimum array length: ${def.minLength}`); - } - - chunk += writeJsdoc(descs.concat(descriptions)); - chunk += `type ${typeName} = (${value})[];`; - } - else if (type === 'record') { - const obj = def.record; - const required = obj.required; - const nullable = obj.nullable; - const properties = obj.properties; - - const propKeys = sortPropertyKeys(Object.keys(properties), required); - const descs = getDescriptions(def); - - chunk += writeJsdoc(descs); - chunk += 'interface Record {'; - chunk += `$type: '${nsid}';`; - - for (const prop of propKeys) { - const isOptional = !required || !required.includes(prop); - const isNullable = nullable?.includes(prop); - const { value, descriptions } = resolveType( - `${nsid}/${prop}`, - properties[prop], - ); - - chunk += writeJsdoc(descriptions); - chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; - } - - chunk += '}'; - - records += `\n'${nsid}': ${tsNamespace}.Record;`; - } - else if (type === 'query' || type === 'procedure') { - let parameters = def.parameters; - const input = type === 'procedure' ? def.input : undefined; - const output = def.output; - const errors = def.errors; - - descs = getDescriptions(def); - - if (parameters) { - if (Object.values(parameters.properties).length === 0) { - parameters = undefined; - } - else { - const { value, descriptions } = resolveType(nsid, parameters); - - chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; - } - } - else { - chunk += 'interface Params {}'; - } - - if (input) { - if (input.encoding === 'application/json' && input.schema) { - const { value, descriptions } = resolveType(nsid, input.schema); - - chunk += writeJsdoc(descriptions); - - if (input.schema?.type === 'object') { - chunk += `interface Input ${value}`; - } - else { - chunk += `type Input = ${value};`; - } - } - else { - chunk += 'type Input = Blob | ArrayBufferView;'; - } - } - else { - chunk += 'type Input = undefined;'; - } - - if (output) { - if (output.encoding === 'application/json' && output.schema) { - const { value, descriptions } = resolveType(nsid, output.schema); - - chunk += writeJsdoc(descriptions); - - if (output.schema?.type === 'object') { - chunk += `interface Output ${value}`; - } - else { - chunk += `type Output = ${value};`; - } - } - else { - chunk += 'type Output = Uint8Array;'; - } - } - else { - chunk += 'type Output = undefined;'; - } - - if (errors) { - chunk += 'interface Errors {'; - - for (const error of errors) { - chunk += `${error.name}: {};`; - } - - chunk += '}'; - } - - { - let rc = `'${ns}':{\n`; - - if (parameters) { - rc += `params: ${tsNamespace}.Params;`; - } - if (input) { - rc += `input: ${tsNamespace}.Input;`; - } - if (output) { - rc += `output: ${tsNamespace}.Output;`; - } - - rc += '};'; - - if (type === 'query') { - queries += rc; - } - else if (type === 'procedure') { - procedures += rc; - } - } - } - else if (type === 'blob') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'bytes') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'subscription') { - if (def.parameters) { - const { value, descriptions } = resolveType(nsid, def.parameters); - chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; - } - else { - chunk += 'interface Params {}'; - } - - if (def.message?.schema) { - const { value: messageValue, descriptions: messageDesc } - = resolveType(nsid, def.message.schema); - chunk += writeJsdoc(messageDesc); - chunk += `type Message = ${messageValue};`; - } - - if (def.errors) { - chunk += 'interface Errors {'; - for (const error of def.errors) { - chunk += `${error.name}: {};`; - } - chunk += '}'; - } - - let rc = `'${ns}':{\n`; - if (def.parameters) { - rc += `params: ${tsNamespace}.Params;`; - } - if (def.message?.schema) { - rc += `message: ${tsNamespace}.Message;`; - } - if (def.errors) { - rc += `errors: ${tsNamespace}.Errors;`; - } - rc += '};'; - subscriptions += rc; - } - else { - // eslint-disable-next-line no-console - console.log(`${nsid}: unhandled type ${type}`); - } - } - - code += writeJsdoc(descs); - - if (main) { - code += `export declare namespace ${tsNamespace} {`; - } - else { - code += `namespace ${tsNamespace} {`; - } - - code += chunk; - code += '}\n\n'; - } - - if (main) { - code += `export declare interface Records {${records}}\n\n`; - code += `export declare interface Queries {${queries}}\n\n`; - code += `export declare interface Procedures {${procedures}}\n\n`; - code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } - else { - code += `interface Records {${records}}\n\n`; - code += `interface Queries {${queries}}\n\n`; - code += `interface Procedures {${procedures}}\n\n`; - code += `interface Subscriptions {${subscriptions}}\n\n`; - code += '}'; - } - - return code; -} +import { readFile } from 'node:fs/promises'; +import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils/index.js'; +import { resolveType } from './resolvers/index.js'; +import { type DocumentSchema, documentSchema } from './schema.js'; + +export interface GenerateDefinitionsOptions { + files: string[]; + main: boolean; + banner?: string; + description?: string; + debug?: boolean; + onProgress?: (filename: string, index: number, total: number) => void; +} + +export async function generateDefinitions(opts: GenerateDefinitionsOptions) { + const { files, main, banner, description } = opts; + + let queries = ''; + let procedures = ''; + let records = ''; + let subscriptions = ''; + + let code = `/* eslint-disable */ +// This file is automatically generated, do not edit!`; + + if (description) { + code += `\n\n/** + * @module + * ${description} + */`; + } + + if (main) { + code += `\n\n${banner ?? ''}\n${mainPrelude}`; + } + else { + code += `\n\nimport "@tsky/lexicons";${banner ?? ''} + +declare module "@tsky/lexicons" {`; + } + + for await (const filename of files.sort(sortName)) { + let document: DocumentSchema; + + try { + const jsonString = await readFile(filename, 'utf8'); + const parsed = JSON.parse(jsonString); + + if (!documentSchema(parsed)) { + throw new Error('Invalid document schema'); + } + document = parsed; + } + catch (err) { + throw new Error(`failed to read ${filename}`, { cause: err }); + } + + const ns = document.id; + const tsNamespace = toNamespace(ns); + + let descs: string[] = []; + let chunk = ''; + + const definitions = document.defs; + const keys = Object.keys(definitions).sort(sortDefinition); + + for (const key of keys) { + const def = definitions[key]; + const type = def.type; + + const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; + const typeName = key[0].toUpperCase() + key.slice(1); + + if (type === 'string') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'token') { + chunk += `type ${typeName} = '${nsid}';`; + } + else if (type === 'object') { + const required = def.required; + const nullable = def.nullable; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += `interface ${typeName} {`; + chunk += `[Brand.Type]: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + } + else if (type === 'array') { + const { value, descriptions } = resolveType(nsid, def.items); + const descs = []; + + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + + chunk += writeJsdoc(descs.concat(descriptions)); + chunk += `type ${typeName} = (${value})[];`; + } + else if (type === 'record') { + const obj = def.record; + const required = obj.required; + const nullable = obj.nullable; + const properties = obj.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += 'interface Record {'; + chunk += `$type: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + + records += `\n'${nsid}': ${tsNamespace}.Record;`; + } + else if (type === 'query' || type === 'procedure') { + let parameters = def.parameters; + const input = type === 'procedure' ? def.input : undefined; + const output = def.output; + const errors = def.errors; + + descs = getDescriptions(def); + + if (parameters) { + if (Object.values(parameters.properties).length === 0) { + parameters = undefined; + } + else { + const { value, descriptions } = resolveType(nsid, parameters); + + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + } + else { + chunk += 'interface Params {}'; + } + + if (input) { + if (input.encoding === 'application/json' && input.schema) { + const { value, descriptions } = resolveType(nsid, input.schema); + + chunk += writeJsdoc(descriptions); + + if (input.schema?.type === 'object') { + chunk += `interface Input ${value}`; + } + else { + chunk += `type Input = ${value};`; + } + } + else { + chunk += 'type Input = Blob | ArrayBufferView;'; + } + } + else { + chunk += 'type Input = undefined;'; + } + + if (output) { + if (output.encoding === 'application/json' && output.schema) { + const { value, descriptions } = resolveType(nsid, output.schema); + + chunk += writeJsdoc(descriptions); + + if (output.schema?.type === 'object') { + chunk += `interface Output ${value}`; + } + else { + chunk += `type Output = ${value};`; + } + } + else { + chunk += 'type Output = Uint8Array;'; + } + } + else { + chunk += 'type Output = undefined;'; + } + + if (errors) { + chunk += 'interface Errors {'; + + for (const error of errors) { + chunk += `${error.name}: {};`; + } + + chunk += '}'; + } + + { + let rc = `'${ns}':{\n`; + + if (parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (input) { + rc += `input: ${tsNamespace}.Input;`; + } + if (output) { + rc += `output: ${tsNamespace}.Output;`; + } + + rc += '};'; + + if (type === 'query') { + queries += rc; + } + else if (type === 'procedure') { + procedures += rc; + } + } + } + else if (type === 'blob') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'bytes') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'subscription') { + if (def.parameters) { + const { value, descriptions } = resolveType(nsid, def.parameters); + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + else { + chunk += 'interface Params {}'; + } + + if (def.message?.schema) { + const { value: messageValue, descriptions: messageDesc } + = resolveType(nsid, def.message.schema); + chunk += writeJsdoc(messageDesc); + chunk += `type Message = ${messageValue};`; + } + + if (def.errors) { + chunk += 'interface Errors {'; + for (const error of def.errors) { + chunk += `${error.name}: {};`; + } + chunk += '}'; + } + + let rc = `'${ns}':{\n`; + if (def.parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (def.message?.schema) { + rc += `message: ${tsNamespace}.Message;`; + } + if (def.errors) { + rc += `errors: ${tsNamespace}.Errors;`; + } + rc += '};'; + subscriptions += rc; + } + else { + // eslint-disable-next-line no-console + console.log(`${nsid}: unhandled type ${type}`); + } + } + + code += writeJsdoc(descs); + + if (main) { + code += `export declare namespace ${tsNamespace} {`; + } + else { + code += `namespace ${tsNamespace} {`; + } + + code += chunk; + code += '}\n\n'; + } + + if (main) { + code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; + } + else { + code += `interface Records {${records}}\n\n`; + code += `interface Queries {${queries}}\n\n`; + code += `interface Procedures {${procedures}}\n\n`; + code += `interface Subscriptions {${subscriptions}}\n\n`; + code += '}'; + } + + return code; +} diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index 2658312..ee01437 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -3,9 +3,9 @@ import type { RefSchema, RefUnionSchema, XrpcParametersSchema, -} from '../schema'; -import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils'; -import { resolveType } from './type'; +} from '../schema.js'; +import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils/index.js'; +import { resolveType } from './type.js'; export function resolveRefType(def: RefSchema): string { const [ns, ref] = def.ref.split('#'); diff --git a/packages/lex-cli/src/generator/resolvers/index.ts b/packages/lex-cli/src/generator/resolvers/index.ts index a73f0a3..57d75dc 100644 --- a/packages/lex-cli/src/generator/resolvers/index.ts +++ b/packages/lex-cli/src/generator/resolvers/index.ts @@ -1,5 +1,5 @@ -export { resolveObjectType, resolveRefType, resolveUnionType } from './complex'; -export { resolveIntegerType } from './numeric'; -export { resolvePrimitiveType } from './primitives'; -export { resolveStringFormat, resolveStringType } from './string'; -export { resolveType } from './type'; +export { resolveObjectType, resolveRefType, resolveUnionType } from './complex.js'; +export { resolveIntegerType } from './numeric.js'; +export { resolvePrimitiveType } from './primitives.js'; +export { resolveStringFormat, resolveStringType } from './string.js'; +export { resolveType } from './type.js'; diff --git a/packages/lex-cli/src/generator/resolvers/numeric.ts b/packages/lex-cli/src/generator/resolvers/numeric.ts index 35915ca..643f76a 100644 --- a/packages/lex-cli/src/generator/resolvers/numeric.ts +++ b/packages/lex-cli/src/generator/resolvers/numeric.ts @@ -1,4 +1,4 @@ -import type { IntegerSchema } from '../schema'; +import type { IntegerSchema } from '../schema.js'; export function resolveIntegerType( def: IntegerSchema, diff --git a/packages/lex-cli/src/generator/resolvers/string.ts b/packages/lex-cli/src/generator/resolvers/string.ts index b8ebb4d..3a54667 100644 --- a/packages/lex-cli/src/generator/resolvers/string.ts +++ b/packages/lex-cli/src/generator/resolvers/string.ts @@ -1,5 +1,5 @@ -import type { StringSchema } from '../schema'; -import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils'; +import type { StringSchema } from '../schema.js'; +import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils/index.js'; export function resolveStringFormat(format: string, nsid: string): string { if (format === 'did') return TYPE_FORMATS.DID; diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts index a9a1a1e..bb9f66a 100644 --- a/packages/lex-cli/src/generator/resolvers/type.ts +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -2,16 +2,16 @@ import type { RefVariantSchema, UserTypeSchema, XrpcParametersSchema, -} from '../schema'; -import { getDescriptions } from '../../utils'; +} from '../schema.js'; +import { getDescriptions } from '../../utils/index.js'; import { resolveObjectType, resolveRefType, resolveUnionType, -} from './complex'; -import { resolveIntegerType } from './numeric'; -import { resolvePrimitiveType } from './primitives'; -import { resolveStringType } from './string'; +} from './complex.js'; +import { resolveIntegerType } from './numeric.js'; +import { resolvePrimitiveType } from './primitives.js'; +import { resolveStringType } from './string.js'; export function resolveType( nsid: string, diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index fa8809a..55becb3 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -4,7 +4,7 @@ import { Builtins, Cli, Command, Option } from 'clipanion'; import pc from 'picocolors'; import prettier from 'prettier'; import * as t from 'typanion'; -import { generateDefinitions } from './generator'; +import { generateDefinitions } from './generator/index.js'; const cli = new Cli({ binaryName: 'lex-cli', diff --git a/packages/lex-cli/src/utils/index.ts b/packages/lex-cli/src/utils/index.ts index b728a13..c73ad3c 100644 --- a/packages/lex-cli/src/utils/index.ts +++ b/packages/lex-cli/src/utils/index.ts @@ -1,5 +1,5 @@ -export { toNamespace, toUpper } from './cache'; -export { getDescriptions, writeJsdoc } from './docs'; -export { IGNORED_FORMATS, TYPE_FORMATS } from './formats'; -export { mainPrelude } from './prelude'; -export { sortDefinition, sortName, sortPropertyKeys } from './sort'; +export { toNamespace, toUpper } from './cache.js'; +export { getDescriptions, writeJsdoc } from './docs.js'; +export { IGNORED_FORMATS, TYPE_FORMATS } from './formats.js'; +export { mainPrelude } from './prelude.js'; +export { sortDefinition, sortName, sortPropertyKeys } from './sort.js'; From a57012a4e9d21f537c5addeba43cebd037a919c7 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 16:33:38 -0500 Subject: [PATCH 32/68] typo: should be pnpm --- packages/lex-cli/package.json | 3 ++- packages/lexicons/package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index 703037f..bf44557 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -12,7 +12,8 @@ "bin": "./dist/index.js", "scripts": { "build": "tsc", - "prepublish": "pnpm run build" + "clean": "rm -rf dist", + "prepublish": "pnpm run clean && pnpm run build" }, "dependencies": { "clipanion": "4.0.0-rc.4", diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 39487b4..48f2b41 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -19,7 +19,7 @@ "scripts": { "build": "tsx ./scripts/generate-types.ts && tsc", "clean": "rm -rf dist && rm -rf lexicons", - "prepublish": "npm run build" + "prepublish": "pnpm run clean && pnpm run build" }, "devDependencies": { "@tsky/lex-cli": "workspace:*", From c08a3eff7cf18eaffdc1809094c567b96e81d2a5 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 17:23:59 -0500 Subject: [PATCH 33/68] changing to GenerateTypes --- packages/lex-cli/src/index.ts | 22 ++++++++++++++------- packages/lexicons/scripts/generate-types.ts | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 55becb3..0cf3b87 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -14,28 +14,36 @@ const cli = new Cli({ cli.register(Builtins.HelpCommand); cli.register( - class GenerateMainLexicons extends Command { - static paths = [['generate-main']]; + class GenerateTypes extends Command { + static paths = [['generate-types']]; static usage = Command.Usage({ - description: 'Generates the main type definition file', + description: 'Generates TypeScript type definitions from Lexicon schema files', + details: ` + This command takes Lexicon JSON schema files as input and generates corresponding TypeScript + type definitions. It handles all AT Protocol lexicons (app.bsky, com.atproto, etc.) and + outputs a single consolidated TypeScript declaration file. + `, + examples: [ + ['Basic usage', 'lex-cli generate-types ./lexicons/**/*.json -o types.ts'], + ['With module description', 'lex-cli generate-types ./lexicons/**/*.json -o types.ts --description "AT Protocol Types"'], + ], }); output = Option.String('-o,--output', { required: false, - description: - 'Where to save the resulting type definition file, defaults to stdout if not passed', + description: 'Path for the generated TypeScript definition file. If not specified, outputs to stdout', validator: t.cascade(t.isString(), t.matchesRegExp(/\.ts$/)), }); desc = Option.String('--description', { required: false, - description: 'Module description', + description: 'JSDoc description to add to the generated module', }); banner = Option.String('--banner', { required: false, - description: 'Insert an arbitrary string at the beginning of the module', + description: 'Custom banner text to insert at the top of the generated file', }); files = Option.Rest({ diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index 09c8218..fd23709 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -93,7 +93,7 @@ async function main() { const command = [ 'node', LEX_CLI_PATH, - 'generate-main', + 'generate-types', ...lexiconFiles, '-o', TYPES_OUTPUT_PATH, @@ -108,7 +108,7 @@ async function main() { }); console.log('Done! Types generated at', TYPES_OUTPUT_PATH); - } + } catch (error) { console.error('Error:', error); process.exit(1); From f048e3aec1d7f36671965192e8e277d29fb217f4 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 17:46:30 -0500 Subject: [PATCH 34/68] cleaning up generation --- packages/lex-cli/src/generator/index.ts | 40 +++++-------------------- packages/lex-cli/src/index.ts | 1 - packages/lexicons/src/lib/lexicons.ts | 2 +- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 17adb8d..80c19fe 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -5,7 +5,6 @@ import { type DocumentSchema, documentSchema } from './schema.js'; export interface GenerateDefinitionsOptions { files: string[]; - main: boolean; banner?: string; description?: string; debug?: boolean; @@ -13,7 +12,7 @@ export interface GenerateDefinitionsOptions { } export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, main, banner, description } = opts; + const { files, banner, description } = opts; let queries = ''; let procedures = ''; @@ -21,7 +20,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { let subscriptions = ''; let code = `/* eslint-disable */ -// This file is automatically generated, do not edit!`; +// This file is automatically generated by @tsky/lex-cli, do not edit!`; if (description) { code += `\n\n/** @@ -30,14 +29,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { */`; } - if (main) { - code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } - else { - code += `\n\nimport "@tsky/lexicons";${banner ?? ''} - -declare module "@tsky/lexicons" {`; - } + code += `\n\n${banner ?? ''}\n${mainPrelude}`; for await (const filename of files.sort(sortName)) { let document: DocumentSchema; @@ -305,31 +297,15 @@ declare module "@tsky/lexicons" {`; } code += writeJsdoc(descs); - - if (main) { - code += `export declare namespace ${tsNamespace} {`; - } - else { - code += `namespace ${tsNamespace} {`; - } - + code += `export declare namespace ${tsNamespace} {`; code += chunk; code += '}\n\n'; } - if (main) { - code += `export declare interface Records {${records}}\n\n`; - code += `export declare interface Queries {${queries}}\n\n`; - code += `export declare interface Procedures {${procedures}}\n\n`; - code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } - else { - code += `interface Records {${records}}\n\n`; - code += `interface Queries {${queries}}\n\n`; - code += `interface Procedures {${procedures}}\n\n`; - code += `interface Subscriptions {${subscriptions}}\n\n`; - code += '}'; - } + code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; return code; } diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 0cf3b87..d38c79d 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -57,7 +57,6 @@ cli.register( try { code = await generateDefinitions({ files: this.files, - main: true, banner: this.banner, description: this.desc, }); diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 99b14d8..7c420b2 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// This file is automatically generated, do not edit! +// This file is automatically generated by @tsky/lex-cli, do not edit! /** * @module From ef92f3666c00cf8e7853c37dd09deb61504641dc Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 18:34:26 -0500 Subject: [PATCH 35/68] cleaning up comments --- packages/lexicons/scripts/generate-types.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index fd23709..e970581 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -16,7 +16,6 @@ const LEX_CLI_PATH = path.resolve(__dirname, '../../lex-cli/dist/index.js'); const REPO = 'bluesky-social/atproto'; async function downloadLexicons() { - // Get latest commit SHA for lexicons console.log('Getting latest lexicon commit...'); const shaResponse = await fetch( `https://api.github.com/repos/${REPO}/commits?path=lexicons/`, @@ -31,7 +30,6 @@ async function downloadLexicons() { throw new Error('No commits found for lexicons'); } - // Download specific commit's lexicons console.log('Downloading lexicons from atproto...'); const response = await fetch( `https://github.com/${REPO}/archive/${sha}.tar.gz`, @@ -40,11 +38,9 @@ async function downloadLexicons() { throw new Error(`Failed to download lexicons: ${response.statusText}`); } - // Create a temporary file for the tar download const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); - // Extract only lexicon files await tar.x({ file: tarFile, cwd: LEXICONS_DIR, @@ -52,20 +48,16 @@ async function downloadLexicons() { strip: 2, }); - // Clean up tar file await fs.unlink(tarFile); } async function main() { try { - // Ensure directories exist await fs.mkdir(LEXICONS_DIR, { recursive: true }); await fs.mkdir(path.dirname(TYPES_OUTPUT_PATH), { recursive: true }); - // Download latest lexicons await downloadLexicons(); - // Define glob patterns for lexicon JSON files const globPatterns = [ 'app/bsky/**/*.json', 'chat/bsky/**/*.json', @@ -73,7 +65,6 @@ async function main() { 'tools/ozone/**/*.json', ]; - // Find all matching lexicon files const lexiconFiles = await glob(globPatterns, { cwd: LEXICONS_DIR, absolute: true, @@ -83,7 +74,6 @@ async function main() { throw new Error('No lexicon files found'); } - // Ensure lex-cli is built console.log('Building lex-cli...'); execSync('pnpm --filter @tsky/lex-cli build', { stdio: 'inherit', From c207c2837947d5af9c8ccfdd8b7f9e97cf19255e Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 18:59:22 -0500 Subject: [PATCH 36/68] adding extensions --- packages/lexicons/index.ts | 2 +- packages/lexicons/src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/lexicons/index.ts b/packages/lexicons/index.ts index cba1843..4df73b3 100644 --- a/packages/lexicons/index.ts +++ b/packages/lexicons/index.ts @@ -1 +1 @@ -export * from './src/index'; +export * from './src/index.js'; diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index a8eb681..fd67ea5 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -1,6 +1,6 @@ -import type { Procedures, Queries, Records } from './lib/lexicons'; +import type { Procedures, Queries, Records } from './lib/lexicons.js'; -export * from './lib/lexicons'; +export * from './lib/lexicons.js'; // --- Core utility types --- export type LexiconUnion = T[keyof T]; From 463a6a9190af67d7f727b23d51f0133539bae531 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 19:23:06 -0500 Subject: [PATCH 37/68] refactor: switch from Brand.Type to concrete $type field --- packages/lex-cli/src/generator/index.ts | 23 +- .../src/generator/resolvers/complex.ts | 2 +- packages/lex-cli/src/utils/prelude.ts | 30 +- packages/lexicons/src/index.ts | 31 +- packages/lexicons/src/lib/lexicons.ts | 1585 ++++++++--------- 5 files changed, 739 insertions(+), 932 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 80c19fe..d470c98 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -81,8 +81,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { const descs = getDescriptions(def); chunk += writeJsdoc(descs); - chunk += `interface ${typeName} {`; - chunk += `[Brand.Type]: '${nsid}';`; + chunk += `interface ${typeName} extends TypedBase {`; for (const prop of propKeys) { const isOptional = !required || !required.includes(prop); @@ -123,7 +122,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { const descs = getDescriptions(def); chunk += writeJsdoc(descs); - chunk += 'interface Record {'; + chunk += `interface Record extends RecordBase {`; chunk += `$type: '${nsid}';`; for (const prop of propKeys) { @@ -158,11 +157,11 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { const { value, descriptions } = resolveType(nsid, parameters); chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; + chunk += `interface Params extends TypedBase ${value}`; } } else { - chunk += 'interface Params {}'; + chunk += 'interface Params extends TypedBase {}'; } if (input) { @@ -172,7 +171,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { chunk += writeJsdoc(descriptions); if (input.schema?.type === 'object') { - chunk += `interface Input ${value}`; + chunk += `interface Input extends TypedBase ${value}`; } else { chunk += `type Input = ${value};`; @@ -193,7 +192,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { chunk += writeJsdoc(descriptions); if (output.schema?.type === 'object') { - chunk += `interface Output ${value}`; + chunk += `interface Output extends TypedBase ${value}`; } else { chunk += `type Output = ${value};`; @@ -208,7 +207,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { } if (errors) { - chunk += 'interface Errors {'; + chunk += 'interface Errors extends TypedBase {'; for (const error of errors) { chunk += `${error.name}: {};`; @@ -256,10 +255,10 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { if (def.parameters) { const { value, descriptions } = resolveType(nsid, def.parameters); chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; + chunk += `interface Params extends TypedBase ${value}`; } else { - chunk += 'interface Params {}'; + chunk += 'interface Params extends TypedBase {}'; } if (def.message?.schema) { @@ -270,7 +269,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { } if (def.errors) { - chunk += 'interface Errors {'; + chunk += 'interface Errors extends TypedBase {'; for (const error of def.errors) { chunk += `${error.name}: {};`; } @@ -302,7 +301,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { code += '}\n\n'; } - code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Records extends RecordBase {${records}}\n\n`; code += `export declare interface Queries {${queries}}\n\n`; code += `export declare interface Procedures {${procedures}}\n\n`; code += `export declare interface Subscriptions {${subscriptions}}\n\n`; diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index ee01437..feaca4c 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -17,7 +17,7 @@ export function resolveUnionType(def: RefUnionSchema): string { const [ns, ref] = raw.split('#'); return (ns ? `${toNamespace(ns)}.` : '') + (ref ? toUpper(ref) : 'Main'); }); - return `Brand.Union<${refs.join('|')}>`; + return `TypeUnion<${refs.join('|')}>`; } export function resolveObjectType( diff --git a/packages/lex-cli/src/utils/prelude.ts b/packages/lex-cli/src/utils/prelude.ts index 2ed9bd9..3102284 100644 --- a/packages/lex-cli/src/utils/prelude.ts +++ b/packages/lex-cli/src/utils/prelude.ts @@ -1,18 +1,24 @@ -export const mainPrelude = `type ObjectOmit = Omit; +export const mainPrelude = `/** Base type with optional type field */ +export interface TypedBase { + $type?: string; +} -/** Handles type branding in objects */ -export declare namespace Brand { - /** Symbol used to brand objects, this does not actually exist in runtime */ - const Type: unique symbol; +/** Base type for all record types */ +export interface RecordBase { + $type: string; +} - /** Get the intended \`$type\` field */ - type GetType = T[typeof Type]; +/** Makes $type required and specific */ +export type Typed = Omit & { + $type: Type; +}; - /** Creates a union of objects where it's discriminated by \`$type\` field. */ - type Union = T extends any ? T & { $type: GetType } : never; +/** Creates a union of objects discriminated by $type */ +export type TypeUnion = T extends any ? Typed : never; - /** Omits the type branding from object */ - type Omit = ObjectOmit; +/** Type guard for records */ +export function isRecord(value: unknown): value is RecordBase { + return typeof value === 'object' && value !== null && '$type' in value && typeof value.$type === 'string'; } /** Base AT Protocol schema types */ @@ -40,7 +46,7 @@ export declare namespace At { } /** Blob interface */ - interface Blob { + interface Blob extends RecordBase { $type: 'blob'; mimeType: T; ref: { diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index fd67ea5..d79d3ab 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -1,4 +1,4 @@ -import type { Procedures, Queries, Records } from './lib/lexicons.js'; +import { isRecord, type Procedures, type Queries, type Records } from './lib/lexicons.js'; export * from './lib/lexicons.js'; @@ -16,8 +16,8 @@ export type KnownNSID = BskyNSID | AtProtoNSID; // --- Record Types --- export type RecordDefs = LexiconUnion; -export type BskyRecord = RecordDefs & { $type: BskyNSID }; -export type AtProtoRecord = RecordDefs & { $type: AtProtoNSID }; +export type BskyRecord = Extract; +export type AtProtoRecord = Extract; // --- Query Types --- export type QueryDefs = LexiconUnion; @@ -73,29 +73,12 @@ export type ProcedureErrors = : never; // --- Common Bluesky Types --- -export type BskyPost = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}feed.post`; -}; -export type BskyProfile = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}actor.profile`; -}; -export type BskyLike = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}feed.like`; -}; -export type BskyFollow = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}graph.follow`; -}; +export type BskyPost = Extract; +export type BskyProfile = Extract; +export type BskyLike = Extract; +export type BskyFollow = Extract; // --- Type Guards --- -export function isRecord(value: unknown): value is RecordDefs { - return ( - typeof value === 'object' - && value !== null - && '$type' in value - && typeof value.$type === 'string' - ); -} - export function isBskyRecord(value: unknown): value is BskyRecord { return isRecord(value) && value.$type.startsWith(APP_BSKY_PREFIX); } diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 7c420b2..36a5616 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -6,23 +6,37 @@ * Contains type declarations for Bluesky lexicons */ -type ObjectOmit = Omit; +/** Base type with optional type field */ +export interface TypedBase { + $type?: string; +} -/** Handles type branding in objects */ -export declare namespace Brand { - /** Symbol used to brand objects, this does not actually exist in runtime */ - const Type: unique symbol; +/** Base type for all record types */ +export interface RecordBase { + $type: string; +} - /** Get the intended `$type` field */ - type GetType = T[typeof Type]; +/** Makes $type required and specific */ +export type Typed = Omit< + T, + "$type" +> & { + $type: Type; +}; - /** Creates a union of objects where it's discriminated by `$type` field. */ - type Union = T extends any - ? T & { $type: GetType } - : never; +/** Creates a union of objects discriminated by $type */ +export type TypeUnion = T extends any + ? Typed + : never; - /** Omits the type branding from object */ - type Omit = ObjectOmit; +/** Type guard for records */ +export function isRecord(value: unknown): value is RecordBase { + return ( + typeof value === "object" && + value !== null && + "$type" in value && + typeof value.$type === "string" + ); } /** Base AT Protocol schema types */ @@ -50,7 +64,7 @@ export declare namespace At { } /** Blob interface */ - interface Blob { + interface Blob extends RecordBase { $type: "blob"; mimeType: T; ref: { @@ -60,20 +74,17 @@ export declare namespace At { } } export declare namespace AppBskyActorDefs { - interface AdultContentPref { - [Brand.Type]: "app.bsky.actor.defs#adultContentPref"; + interface AdultContentPref extends TypedBase { /** \@default false */ enabled: boolean; } /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ - interface BskyAppProgressGuide { - [Brand.Type]: "app.bsky.actor.defs#bskyAppProgressGuide"; + interface BskyAppProgressGuide extends TypedBase { /** Maximum string length: 100 */ guide: string; } /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ - interface BskyAppStatePref { - [Brand.Type]: "app.bsky.actor.defs#bskyAppStatePref"; + interface BskyAppStatePref extends TypedBase { activeProgressGuide?: BskyAppProgressGuide; /** * Storage for NUXs the user has encountered. @@ -87,15 +98,13 @@ export declare namespace AppBskyActorDefs { */ queuedNudges?: string[]; } - interface ContentLabelPref { - [Brand.Type]: "app.bsky.actor.defs#contentLabelPref"; + interface ContentLabelPref extends TypedBase { label: string; visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); /** Which labeler does this preference apply to? If undefined, applies globally. */ labelerDid?: At.DID; } - interface FeedViewPref { - [Brand.Type]: "app.bsky.actor.defs#feedViewPref"; + interface FeedViewPref extends TypedBase { /** The URI of the feed, or an identifier which describes the feed. */ feed: string; /** Hide quote posts in the feed. */ @@ -112,13 +121,11 @@ export declare namespace AppBskyActorDefs { /** Hide reposts in the feed. */ hideReposts?: boolean; } - interface HiddenPostsPref { - [Brand.Type]: "app.bsky.actor.defs#hiddenPostsPref"; + interface HiddenPostsPref extends TypedBase { /** A list of URIs of posts the account owner has hidden. */ items: At.Uri[]; } - interface InterestsPref { - [Brand.Type]: "app.bsky.actor.defs#interestsPref"; + interface InterestsPref extends TypedBase { /** * A list of tags which describe the account owner's interests gathered during onboarding. * Maximum array length: 100 @@ -128,8 +135,7 @@ export declare namespace AppBskyActorDefs { tags: string[]; } /** The subject's followers whom you also follow */ - interface KnownFollowers { - [Brand.Type]: "app.bsky.actor.defs#knownFollowers"; + interface KnownFollowers extends TypedBase { count: number; /** * Minimum array length: 0 @@ -137,17 +143,14 @@ export declare namespace AppBskyActorDefs { */ followers: ProfileViewBasic[]; } - interface LabelerPrefItem { - [Brand.Type]: "app.bsky.actor.defs#labelerPrefItem"; + interface LabelerPrefItem extends TypedBase { did: At.DID; } - interface LabelersPref { - [Brand.Type]: "app.bsky.actor.defs#labelersPref"; + interface LabelersPref extends TypedBase { labelers: LabelerPrefItem[]; } /** A word that the account owner has muted. */ - interface MutedWord { - [Brand.Type]: "app.bsky.actor.defs#mutedWord"; + interface MutedWord extends TypedBase { /** The intended targets of the muted word. */ targets: AppBskyActorDefs.MutedWordTarget[]; /** @@ -165,8 +168,7 @@ export declare namespace AppBskyActorDefs { expiresAt?: string; id?: string; } - interface MutedWordsPref { - [Brand.Type]: "app.bsky.actor.defs#mutedWordsPref"; + interface MutedWordsPref extends TypedBase { /** A list of words the account owner has muted. */ items: AppBskyActorDefs.MutedWord[]; } @@ -176,8 +178,7 @@ export declare namespace AppBskyActorDefs { */ type MutedWordTarget = "content" | "tag" | (string & {}); /** A new user experiences (NUX) storage object */ - interface Nux { - [Brand.Type]: "app.bsky.actor.defs#nux"; + interface Nux extends TypedBase { /** \@default false */ completed: boolean; /** Maximum string length: 100 */ @@ -191,12 +192,11 @@ export declare namespace AppBskyActorDefs { /** The date and time at which the NUX will expire and should be considered completed. */ expiresAt?: string; } - interface PersonalDetailsPref { - [Brand.Type]: "app.bsky.actor.defs#personalDetailsPref"; + interface PersonalDetailsPref extends TypedBase { /** The birth date of account owner. */ birthDate?: string; } - type Preferences = Brand.Union< + type Preferences = TypeUnion< | AdultContentPref | BskyAppStatePref | ContentLabelPref @@ -210,20 +210,17 @@ export declare namespace AppBskyActorDefs { | SavedFeedsPrefV2 | ThreadViewPref >[]; - interface ProfileAssociated { - [Brand.Type]: "app.bsky.actor.defs#profileAssociated"; + interface ProfileAssociated extends TypedBase { chat?: ProfileAssociatedChat; feedgens?: number; labeler?: boolean; lists?: number; starterPacks?: number; } - interface ProfileAssociatedChat { - [Brand.Type]: "app.bsky.actor.defs#profileAssociatedChat"; + interface ProfileAssociatedChat extends TypedBase { allowIncoming: "all" | "following" | "none" | (string & {}); } - interface ProfileView { - [Brand.Type]: "app.bsky.actor.defs#profileView"; + interface ProfileView extends TypedBase { did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -243,8 +240,7 @@ export declare namespace AppBskyActorDefs { labels?: ComAtprotoLabelDefs.Label[]; viewer?: ViewerState; } - interface ProfileViewBasic { - [Brand.Type]: "app.bsky.actor.defs#profileViewBasic"; + interface ProfileViewBasic extends TypedBase { did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -258,8 +254,7 @@ export declare namespace AppBskyActorDefs { labels?: ComAtprotoLabelDefs.Label[]; viewer?: ViewerState; } - interface ProfileViewDetailed { - [Brand.Type]: "app.bsky.actor.defs#profileViewDetailed"; + interface ProfileViewDetailed extends TypedBase { did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -285,25 +280,21 @@ export declare namespace AppBskyActorDefs { postsCount?: number; viewer?: ViewerState; } - interface SavedFeed { - [Brand.Type]: "app.bsky.actor.defs#savedFeed"; + interface SavedFeed extends TypedBase { id: string; pinned: boolean; type: "feed" | "list" | "timeline" | (string & {}); value: string; } - interface SavedFeedsPref { - [Brand.Type]: "app.bsky.actor.defs#savedFeedsPref"; + interface SavedFeedsPref extends TypedBase { pinned: At.Uri[]; saved: At.Uri[]; timelineIndex?: number; } - interface SavedFeedsPrefV2 { - [Brand.Type]: "app.bsky.actor.defs#savedFeedsPrefV2"; + interface SavedFeedsPrefV2 extends TypedBase { items: AppBskyActorDefs.SavedFeed[]; } - interface ThreadViewPref { - [Brand.Type]: "app.bsky.actor.defs#threadViewPref"; + interface ThreadViewPref extends TypedBase { /** Show followed users at the top of all replies. */ prioritizeFollowedUsers?: boolean; /** Sorting mode for threads. */ @@ -316,8 +307,7 @@ export declare namespace AppBskyActorDefs { | (string & {}); } /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ - interface ViewerState { - [Brand.Type]: "app.bsky.actor.defs#viewerState"; + interface ViewerState extends TypedBase { blockedBy?: boolean; blocking?: At.Uri; blockingByList?: AppBskyGraphDefs.ListViewBasic; @@ -332,14 +322,14 @@ export declare namespace AppBskyActorDefs { /** Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. */ export declare namespace AppBskyActorGetPreferences { type Input = undefined; - interface Output { + interface Output extends TypedBase { preferences: AppBskyActorDefs.Preferences; } } /** Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. */ export declare namespace AppBskyActorGetProfile { - interface Params { + interface Params extends TypedBase { /** Handle or DID of account to fetch profile of. */ actor: string; } @@ -349,19 +339,19 @@ export declare namespace AppBskyActorGetProfile { /** Get detailed profile views of multiple actors. */ export declare namespace AppBskyActorGetProfiles { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 25 */ actors: string[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { profiles: AppBskyActorDefs.ProfileViewDetailed[]; } } /** Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. */ export declare namespace AppBskyActorGetSuggestions { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -371,7 +361,7 @@ export declare namespace AppBskyActorGetSuggestions { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -379,7 +369,7 @@ export declare namespace AppBskyActorGetSuggestions { export declare namespace AppBskyActorProfile { /** A declaration of a Bluesky account profile. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.actor.profile"; /** Small image to be displayed next to posts from account. AKA, 'profile picture' */ avatar?: At.Blob; @@ -399,15 +389,15 @@ export declare namespace AppBskyActorProfile { displayName?: string; joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main; /** Self-label values, specific to the Bluesky application, on the overall account. */ - labels?: Brand.Union; + labels?: TypeUnion; pinnedPost?: ComAtprotoRepoStrongRef.Main; } } /** Set the private preferences attached to the account. */ export declare namespace AppBskyActorPutPreferences { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { preferences: AppBskyActorDefs.Preferences; } type Output = undefined; @@ -415,7 +405,7 @@ export declare namespace AppBskyActorPutPreferences { /** Find actors (profiles) matching search criteria. Does not require auth. */ export declare namespace AppBskyActorSearchActors { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -432,7 +422,7 @@ export declare namespace AppBskyActorSearchActors { term?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -440,7 +430,7 @@ export declare namespace AppBskyActorSearchActors { /** Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. */ export declare namespace AppBskyActorSearchActorsTypeahead { - interface Params { + interface Params extends TypedBase { /** * Minimum: 1 * Maximum: 100 @@ -456,15 +446,14 @@ export declare namespace AppBskyActorSearchActorsTypeahead { term?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyActorDefs.ProfileViewBasic[]; } } export declare namespace AppBskyEmbedDefs { /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ - interface AspectRatio { - [Brand.Type]: "app.bsky.embed.defs#aspectRatio"; + interface AspectRatio extends TypedBase { /** Minimum: 1 */ height: number; /** Minimum: 1 */ @@ -474,23 +463,19 @@ export declare namespace AppBskyEmbedDefs { export declare namespace AppBskyEmbedExternal { /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ - interface Main { - [Brand.Type]: "app.bsky.embed.external"; + interface Main extends TypedBase { external: External; } - interface External { - [Brand.Type]: "app.bsky.embed.external#external"; + interface External extends TypedBase { description: string; title: string; uri: string; thumb?: At.Blob; } - interface View { - [Brand.Type]: "app.bsky.embed.external#view"; + interface View extends TypedBase { external: ViewExternal; } - interface ViewExternal { - [Brand.Type]: "app.bsky.embed.external#viewExternal"; + interface ViewExternal extends TypedBase { description: string; title: string; uri: string; @@ -499,25 +484,21 @@ export declare namespace AppBskyEmbedExternal { } export declare namespace AppBskyEmbedImages { - interface Main { - [Brand.Type]: "app.bsky.embed.images"; + interface Main extends TypedBase { /** Maximum array length: 4 */ images: Image[]; } - interface Image { - [Brand.Type]: "app.bsky.embed.images#image"; + interface Image extends TypedBase { /** Alt text description of the image, for accessibility. */ alt: string; image: At.Blob; aspectRatio?: AppBskyEmbedDefs.AspectRatio; } - interface View { - [Brand.Type]: "app.bsky.embed.images#view"; + interface View extends TypedBase { /** Maximum array length: 4 */ images: ViewImage[]; } - interface ViewImage { - [Brand.Type]: "app.bsky.embed.images#viewImage"; + interface ViewImage extends TypedBase { /** Alt text description of the image, for accessibility. */ alt: string; /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ @@ -529,13 +510,11 @@ export declare namespace AppBskyEmbedImages { } export declare namespace AppBskyEmbedRecord { - interface Main { - [Brand.Type]: "app.bsky.embed.record"; + interface Main extends TypedBase { record: ComAtprotoRepoStrongRef.Main; } - interface View { - [Brand.Type]: "app.bsky.embed.record#view"; - record: Brand.Union< + interface View extends TypedBase { + record: TypeUnion< | ViewBlocked | ViewDetached | ViewNotFound @@ -546,31 +525,27 @@ export declare namespace AppBskyEmbedRecord { | AppBskyLabelerDefs.LabelerView >; } - interface ViewBlocked { - [Brand.Type]: "app.bsky.embed.record#viewBlocked"; + interface ViewBlocked extends TypedBase { author: AppBskyFeedDefs.BlockedAuthor; blocked: boolean; uri: At.Uri; } - interface ViewDetached { - [Brand.Type]: "app.bsky.embed.record#viewDetached"; + interface ViewDetached extends TypedBase { detached: boolean; uri: At.Uri; } - interface ViewNotFound { - [Brand.Type]: "app.bsky.embed.record#viewNotFound"; + interface ViewNotFound extends TypedBase { notFound: boolean; uri: At.Uri; } - interface ViewRecord { - [Brand.Type]: "app.bsky.embed.record#viewRecord"; + interface ViewRecord extends TypedBase { author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; uri: At.Uri; /** The record data itself. */ value: unknown; - embeds?: Brand.Union< + embeds?: TypeUnion< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View | AppBskyEmbedRecord.View @@ -586,18 +561,16 @@ export declare namespace AppBskyEmbedRecord { } export declare namespace AppBskyEmbedRecordWithMedia { - interface Main { - [Brand.Type]: "app.bsky.embed.recordWithMedia"; - media: Brand.Union< + interface Main extends TypedBase { + media: TypeUnion< | AppBskyEmbedExternal.Main | AppBskyEmbedImages.Main | AppBskyEmbedVideo.Main >; record: AppBskyEmbedRecord.Main; } - interface View { - [Brand.Type]: "app.bsky.embed.recordWithMedia#view"; - media: Brand.Union< + interface View extends TypedBase { + media: TypeUnion< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View | AppBskyEmbedVideo.View @@ -607,8 +580,7 @@ export declare namespace AppBskyEmbedRecordWithMedia { } export declare namespace AppBskyEmbedVideo { - interface Main { - [Brand.Type]: "app.bsky.embed.video"; + interface Main extends TypedBase { video: At.Blob; /** * Alt text description of the video, for accessibility. @@ -620,13 +592,11 @@ export declare namespace AppBskyEmbedVideo { /** Maximum array length: 20 */ captions?: Caption[]; } - interface Caption { - [Brand.Type]: "app.bsky.embed.video#caption"; + interface Caption extends TypedBase { file: At.Blob; lang: string; } - interface View { - [Brand.Type]: "app.bsky.embed.video#view"; + interface View extends TypedBase { cid: At.CID; playlist: string; /** @@ -640,13 +610,11 @@ export declare namespace AppBskyEmbedVideo { } export declare namespace AppBskyFeedDefs { - interface BlockedAuthor { - [Brand.Type]: "app.bsky.feed.defs#blockedAuthor"; + interface BlockedAuthor extends TypedBase { did: At.DID; viewer?: AppBskyActorDefs.ViewerState; } - interface BlockedPost { - [Brand.Type]: "app.bsky.feed.defs#blockedPost"; + interface BlockedPost extends TypedBase { author: BlockedAuthor; blocked: boolean; uri: At.Uri; @@ -655,19 +623,17 @@ export declare namespace AppBskyFeedDefs { type ClickthroughEmbed = "app.bsky.feed.defs#clickthroughEmbed"; type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; - interface FeedViewPost { - [Brand.Type]: "app.bsky.feed.defs#feedViewPost"; + interface FeedViewPost extends TypedBase { post: PostView; /** * Context provided by feed generator that may be passed back alongside interactions. * Maximum string length: 2000 */ feedContext?: string; - reason?: Brand.Union; + reason?: TypeUnion; reply?: ReplyRef; } - interface GeneratorView { - [Brand.Type]: "app.bsky.feed.defs#generatorView"; + interface GeneratorView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; did: At.DID; @@ -687,12 +653,10 @@ export declare namespace AppBskyFeedDefs { likeCount?: number; viewer?: GeneratorViewerState; } - interface GeneratorViewerState { - [Brand.Type]: "app.bsky.feed.defs#generatorViewerState"; + interface GeneratorViewerState extends TypedBase { like?: At.Uri; } - interface Interaction { - [Brand.Type]: "app.bsky.feed.defs#interaction"; + interface Interaction extends TypedBase { event?: | "app.bsky.feed.defs#clickthroughAuthor" | "app.bsky.feed.defs#clickthroughEmbed" @@ -720,19 +684,17 @@ export declare namespace AppBskyFeedDefs { type InteractionRepost = "app.bsky.feed.defs#interactionRepost"; type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; type InteractionShare = "app.bsky.feed.defs#interactionShare"; - interface NotFoundPost { - [Brand.Type]: "app.bsky.feed.defs#notFoundPost"; + interface NotFoundPost extends TypedBase { notFound: boolean; uri: At.Uri; } - interface PostView { - [Brand.Type]: "app.bsky.feed.defs#postView"; + interface PostView extends TypedBase { author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; record: unknown; uri: At.Uri; - embed?: Brand.Union< + embed?: TypeUnion< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View | AppBskyEmbedRecord.View @@ -747,56 +709,45 @@ export declare namespace AppBskyFeedDefs { threadgate?: ThreadgateView; viewer?: ViewerState; } - interface ReasonPin { - [Brand.Type]: "app.bsky.feed.defs#reasonPin"; - } - interface ReasonRepost { - [Brand.Type]: "app.bsky.feed.defs#reasonRepost"; + interface ReasonPin extends TypedBase {} + interface ReasonRepost extends TypedBase { by: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; } - interface ReplyRef { - [Brand.Type]: "app.bsky.feed.defs#replyRef"; - parent: Brand.Union; - root: Brand.Union; + interface ReplyRef extends TypedBase { + parent: TypeUnion; + root: TypeUnion; /** When parent is a reply to another post, this is the author of that post. */ grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic; } type RequestLess = "app.bsky.feed.defs#requestLess"; type RequestMore = "app.bsky.feed.defs#requestMore"; - interface SkeletonFeedPost { - [Brand.Type]: "app.bsky.feed.defs#skeletonFeedPost"; + interface SkeletonFeedPost extends TypedBase { post: At.Uri; /** * Context that will be passed through to client and may be passed to feed generator back alongside interactions. * Maximum string length: 2000 */ feedContext?: string; - reason?: Brand.Union; - } - interface SkeletonReasonPin { - [Brand.Type]: "app.bsky.feed.defs#skeletonReasonPin"; + reason?: TypeUnion; } - interface SkeletonReasonRepost { - [Brand.Type]: "app.bsky.feed.defs#skeletonReasonRepost"; + interface SkeletonReasonPin extends TypedBase {} + interface SkeletonReasonRepost extends TypedBase { repost: At.Uri; } - interface ThreadgateView { - [Brand.Type]: "app.bsky.feed.defs#threadgateView"; + interface ThreadgateView extends TypedBase { cid?: At.CID; lists?: AppBskyGraphDefs.ListViewBasic[]; record?: unknown; uri?: At.Uri; } - interface ThreadViewPost { - [Brand.Type]: "app.bsky.feed.defs#threadViewPost"; + interface ThreadViewPost extends TypedBase { post: PostView; - parent?: Brand.Union; - replies?: Brand.Union[]; + parent?: TypeUnion; + replies?: TypeUnion[]; } /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ - interface ViewerState { - [Brand.Type]: "app.bsky.feed.defs#viewerState"; + interface ViewerState extends TypedBase { embeddingDisabled?: boolean; like?: At.Uri; pinned?: boolean; @@ -808,19 +759,17 @@ export declare namespace AppBskyFeedDefs { /** Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). */ export declare namespace AppBskyFeedDescribeFeedGenerator { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { did: At.DID; feeds: Feed[]; links?: Links; } - interface Feed { - [Brand.Type]: "app.bsky.feed.describeFeedGenerator#feed"; + interface Feed extends TypedBase { uri: At.Uri; } - interface Links { - [Brand.Type]: "app.bsky.feed.describeFeedGenerator#links"; + interface Links extends TypedBase { privacyPolicy?: string; termsOfService?: string; } @@ -828,7 +777,7 @@ export declare namespace AppBskyFeedDescribeFeedGenerator { export declare namespace AppBskyFeedGenerator { /** Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.generator"; createdAt: string; did: At.DID; @@ -847,13 +796,13 @@ export declare namespace AppBskyFeedGenerator { description?: string; descriptionFacets?: AppBskyRichtextFacet.Main[]; /** Self-label values */ - labels?: Brand.Union; + labels?: TypeUnion; } } /** Get a list of feeds (feed generator records) created by the actor (in the actor's repo). */ export declare namespace AppBskyFeedGetActorFeeds { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -864,7 +813,7 @@ export declare namespace AppBskyFeedGetActorFeeds { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; cursor?: string; } @@ -872,7 +821,7 @@ export declare namespace AppBskyFeedGetActorFeeds { /** Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. */ export declare namespace AppBskyFeedGetActorLikes { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -883,11 +832,11 @@ export declare namespace AppBskyFeedGetActorLikes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { BlockedActor: {}; BlockedByActor: {}; } @@ -895,7 +844,7 @@ export declare namespace AppBskyFeedGetActorLikes { /** Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. */ export declare namespace AppBskyFeedGetAuthorFeed { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -918,11 +867,11 @@ export declare namespace AppBskyFeedGetAuthorFeed { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { BlockedActor: {}; BlockedByActor: {}; } @@ -930,7 +879,7 @@ export declare namespace AppBskyFeedGetAuthorFeed { /** Get a hydrated feed from an actor's selected feed generator. Implemented by App View. */ export declare namespace AppBskyFeedGetFeed { - interface Params { + interface Params extends TypedBase { feed: At.Uri; cursor?: string; /** @@ -941,23 +890,23 @@ export declare namespace AppBskyFeedGetFeed { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { UnknownFeed: {}; } } /** Get information about a feed generator. Implemented by AppView. */ export declare namespace AppBskyFeedGetFeedGenerator { - interface Params { + interface Params extends TypedBase { /** AT-URI of the feed generator record. */ feed: At.Uri; } type Input = undefined; - interface Output { + interface Output extends TypedBase { /** Indicates whether the feed generator service has been online recently, or else seems to be inactive. */ isOnline: boolean; /** Indicates whether the feed generator service is compatible with the record declaration. */ @@ -968,18 +917,18 @@ export declare namespace AppBskyFeedGetFeedGenerator { /** Get information about a list of feed generators. */ export declare namespace AppBskyFeedGetFeedGenerators { - interface Params { + interface Params extends TypedBase { feeds: At.Uri[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; } } /** Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. */ export declare namespace AppBskyFeedGetFeedSkeleton { - interface Params { + interface Params extends TypedBase { /** Reference to feed generator record describing the specific feed being requested. */ feed: At.Uri; cursor?: string; @@ -991,18 +940,18 @@ export declare namespace AppBskyFeedGetFeedSkeleton { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.SkeletonFeedPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { UnknownFeed: {}; } } /** Get like records which reference a subject (by AT-URI and CID). */ export declare namespace AppBskyFeedGetLikes { - interface Params { + interface Params extends TypedBase { /** AT-URI of the subject (eg, a post record). */ uri: At.Uri; /** CID of the subject record (aka, specific version of record), to filter likes. */ @@ -1016,14 +965,13 @@ export declare namespace AppBskyFeedGetLikes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { likes: Like[]; uri: At.Uri; cid?: At.CID; cursor?: string; } - interface Like { - [Brand.Type]: "app.bsky.feed.getLikes#like"; + interface Like extends TypedBase { actor: AppBskyActorDefs.ProfileView; createdAt: string; indexedAt: string; @@ -1032,7 +980,7 @@ export declare namespace AppBskyFeedGetLikes { /** Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. */ export declare namespace AppBskyFeedGetListFeed { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) to the list record. */ list: At.Uri; cursor?: string; @@ -1044,18 +992,18 @@ export declare namespace AppBskyFeedGetListFeed { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { UnknownList: {}; } } /** Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. */ export declare namespace AppBskyFeedGetPosts { - interface Params { + interface Params extends TypedBase { /** * List of post AT-URIs to return hydrated views for. * Maximum array length: 25 @@ -1063,14 +1011,14 @@ export declare namespace AppBskyFeedGetPosts { uris: At.Uri[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyFeedDefs.PostView[]; } } /** Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. */ export declare namespace AppBskyFeedGetPostThread { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) to post record. */ uri: At.Uri; /** @@ -1089,22 +1037,22 @@ export declare namespace AppBskyFeedGetPostThread { parentHeight?: number; } type Input = undefined; - interface Output { - thread: Brand.Union< + interface Output extends TypedBase { + thread: TypeUnion< | AppBskyFeedDefs.BlockedPost | AppBskyFeedDefs.NotFoundPost | AppBskyFeedDefs.ThreadViewPost >; threadgate?: AppBskyFeedDefs.ThreadgateView; } - interface Errors { + interface Errors extends TypedBase { NotFound: {}; } } /** Get a list of quotes for a given post. */ export declare namespace AppBskyFeedGetQuotes { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of post record */ uri: At.Uri; /** If supplied, filters to quotes of specific version (by CID) of the post record. */ @@ -1118,7 +1066,7 @@ export declare namespace AppBskyFeedGetQuotes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyFeedDefs.PostView[]; uri: At.Uri; cid?: At.CID; @@ -1128,7 +1076,7 @@ export declare namespace AppBskyFeedGetQuotes { /** Get a list of reposts for a given post. */ export declare namespace AppBskyFeedGetRepostedBy { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of post record */ uri: At.Uri; /** If supplied, filters to reposts of specific version (by CID) of the post record. */ @@ -1142,7 +1090,7 @@ export declare namespace AppBskyFeedGetRepostedBy { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { repostedBy: AppBskyActorDefs.ProfileView[]; uri: At.Uri; cid?: At.CID; @@ -1152,7 +1100,7 @@ export declare namespace AppBskyFeedGetRepostedBy { /** Get a list of suggested feeds (feed generators) for the requesting account. */ export declare namespace AppBskyFeedGetSuggestedFeeds { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1162,7 +1110,7 @@ export declare namespace AppBskyFeedGetSuggestedFeeds { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; cursor?: string; } @@ -1170,7 +1118,7 @@ export declare namespace AppBskyFeedGetSuggestedFeeds { /** Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. */ export declare namespace AppBskyFeedGetTimeline { - interface Params { + interface Params extends TypedBase { /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ algorithm?: string; cursor?: string; @@ -1182,7 +1130,7 @@ export declare namespace AppBskyFeedGetTimeline { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } @@ -1190,7 +1138,7 @@ export declare namespace AppBskyFeedGetTimeline { export declare namespace AppBskyFeedLike { /** Record declaring a 'like' of a piece of subject content. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.like"; createdAt: string; subject: ComAtprotoRepoStrongRef.Main; @@ -1199,7 +1147,7 @@ export declare namespace AppBskyFeedLike { export declare namespace AppBskyFeedPost { /** Record containing a Bluesky post. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.post"; /** Client-declared timestamp when this post was originally created. */ createdAt: string; @@ -1209,7 +1157,7 @@ export declare namespace AppBskyFeedPost { * Maximum grapheme length: 300 */ text: string; - embed?: Brand.Union< + embed?: TypeUnion< | AppBskyEmbedExternal.Main | AppBskyEmbedImages.Main | AppBskyEmbedRecord.Main @@ -1224,7 +1172,7 @@ export declare namespace AppBskyFeedPost { /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[]; /** Self-label values for this post. Effectively content warnings. */ - labels?: Brand.Union; + labels?: TypeUnion; /** * Indicates human language of post primary text content. * Maximum array length: 3 @@ -1243,15 +1191,13 @@ export declare namespace AppBskyFeedPost { * Deprecated: use facets instead. * \@deprecated */ - interface Entity { - [Brand.Type]: "app.bsky.feed.post#entity"; + interface Entity extends TypedBase { index: TextSlice; /** Expected values are 'mention' and 'link'. */ type: string; value: string; } - interface ReplyRef { - [Brand.Type]: "app.bsky.feed.post#replyRef"; + interface ReplyRef extends TypedBase { parent: ComAtprotoRepoStrongRef.Main; root: ComAtprotoRepoStrongRef.Main; } @@ -1259,8 +1205,7 @@ export declare namespace AppBskyFeedPost { * Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. * \@deprecated */ - interface TextSlice { - [Brand.Type]: "app.bsky.feed.post#textSlice"; + interface TextSlice extends TypedBase { /** Minimum: 0 */ end: number; /** Minimum: 0 */ @@ -1270,7 +1215,7 @@ export declare namespace AppBskyFeedPost { export declare namespace AppBskyFeedPostgate { /** Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.postgate"; createdAt: string; /** Reference (AT-URI) to the post record. */ @@ -1281,17 +1226,15 @@ export declare namespace AppBskyFeedPostgate { */ detachedEmbeddingUris?: At.Uri[]; /** Maximum array length: 5 */ - embeddingRules?: Brand.Union[]; + embeddingRules?: TypeUnion[]; } /** Disables embedding of this post. */ - interface DisableRule { - [Brand.Type]: "app.bsky.feed.postgate#disableRule"; - } + interface DisableRule extends TypedBase {} } export declare namespace AppBskyFeedRepost { /** Record representing a 'repost' of an existing Bluesky post. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.repost"; createdAt: string; subject: ComAtprotoRepoStrongRef.Main; @@ -1300,7 +1243,7 @@ export declare namespace AppBskyFeedRepost { /** Find posts matching search criteria, returning views of those posts. */ export declare namespace AppBskyFeedSearchPosts { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ @@ -1338,35 +1281,35 @@ export declare namespace AppBskyFeedSearchPosts { url?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyFeedDefs.PostView[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } /** Send information about interactions with feed items back to the feed generator that served them. */ export declare namespace AppBskyFeedSendInteractions { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { interactions: AppBskyFeedDefs.Interaction[]; } - interface Output {} + interface Output extends TypedBase {} } export declare namespace AppBskyFeedThreadgate { /** Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.threadgate"; createdAt: string; /** Reference (AT-URI) to the post record. */ post: At.Uri; /** Maximum array length: 5 */ - allow?: Brand.Union[]; + allow?: TypeUnion[]; /** * List of hidden reply URIs. * Maximum array length: 50 @@ -1374,23 +1317,18 @@ export declare namespace AppBskyFeedThreadgate { hiddenReplies?: At.Uri[]; } /** Allow replies from actors you follow. */ - interface FollowingRule { - [Brand.Type]: "app.bsky.feed.threadgate#followingRule"; - } + interface FollowingRule extends TypedBase {} /** Allow replies from actors on a list. */ - interface ListRule { - [Brand.Type]: "app.bsky.feed.threadgate#listRule"; + interface ListRule extends TypedBase { list: At.Uri; } /** Allow replies from actors mentioned in your post. */ - interface MentionRule { - [Brand.Type]: "app.bsky.feed.threadgate#mentionRule"; - } + interface MentionRule extends TypedBase {} } export declare namespace AppBskyGraphBlock { /** Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.block"; createdAt: string; /** DID of the account to be blocked. */ @@ -1400,8 +1338,7 @@ export declare namespace AppBskyGraphBlock { export declare namespace AppBskyGraphDefs { type Curatelist = "app.bsky.graph.defs#curatelist"; - interface ListItemView { - [Brand.Type]: "app.bsky.graph.defs#listItemView"; + interface ListItemView extends TypedBase { subject: AppBskyActorDefs.ProfileView; uri: At.Uri; } @@ -1410,8 +1347,7 @@ export declare namespace AppBskyGraphDefs { | "app.bsky.graph.defs#modlist" | "app.bsky.graph.defs#referencelist" | (string & {}); - interface ListView { - [Brand.Type]: "app.bsky.graph.defs#listView"; + interface ListView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1434,8 +1370,7 @@ export declare namespace AppBskyGraphDefs { listItemCount?: number; viewer?: ListViewerState; } - interface ListViewBasic { - [Brand.Type]: "app.bsky.graph.defs#listViewBasic"; + interface ListViewBasic extends TypedBase { cid: At.CID; /** * Minimum string length: 1 @@ -1451,30 +1386,26 @@ export declare namespace AppBskyGraphDefs { listItemCount?: number; viewer?: ListViewerState; } - interface ListViewerState { - [Brand.Type]: "app.bsky.graph.defs#listViewerState"; + interface ListViewerState extends TypedBase { blocked?: At.Uri; muted?: boolean; } type Modlist = "app.bsky.graph.defs#modlist"; /** indicates that a handle or DID could not be resolved */ - interface NotFoundActor { - [Brand.Type]: "app.bsky.graph.defs#notFoundActor"; + interface NotFoundActor extends TypedBase { actor: string; notFound: boolean; } type Referencelist = "app.bsky.graph.defs#referencelist"; /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ - interface Relationship { - [Brand.Type]: "app.bsky.graph.defs#relationship"; + interface Relationship extends TypedBase { did: At.DID; /** if the actor is followed by this DID, contains the AT-URI of the follow record */ followedBy?: At.Uri; /** if the actor follows this DID, this is the AT-URI of the follow record */ following?: At.Uri; } - interface StarterPackView { - [Brand.Type]: "app.bsky.graph.defs#starterPackView"; + interface StarterPackView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1491,8 +1422,7 @@ export declare namespace AppBskyGraphDefs { /** Maximum array length: 12 */ listItemsSample?: ListItemView[]; } - interface StarterPackViewBasic { - [Brand.Type]: "app.bsky.graph.defs#starterPackViewBasic"; + interface StarterPackViewBasic extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1510,7 +1440,7 @@ export declare namespace AppBskyGraphDefs { export declare namespace AppBskyGraphFollow { /** Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.follow"; createdAt: string; subject: At.DID; @@ -1519,7 +1449,7 @@ export declare namespace AppBskyGraphFollow { /** Get a list of starter packs created by the actor. */ export declare namespace AppBskyGraphGetActorStarterPacks { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1530,7 +1460,7 @@ export declare namespace AppBskyGraphGetActorStarterPacks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; cursor?: string; } @@ -1538,7 +1468,7 @@ export declare namespace AppBskyGraphGetActorStarterPacks { /** Enumerates which accounts the requesting account is currently blocking. Requires auth. */ export declare namespace AppBskyGraphGetBlocks { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1548,7 +1478,7 @@ export declare namespace AppBskyGraphGetBlocks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { blocks: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -1556,7 +1486,7 @@ export declare namespace AppBskyGraphGetBlocks { /** Enumerates accounts which follow a specified account (actor). */ export declare namespace AppBskyGraphGetFollowers { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1567,7 +1497,7 @@ export declare namespace AppBskyGraphGetFollowers { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { followers: AppBskyActorDefs.ProfileView[]; subject: AppBskyActorDefs.ProfileView; cursor?: string; @@ -1576,7 +1506,7 @@ export declare namespace AppBskyGraphGetFollowers { /** Enumerates accounts which a specified account (actor) follows. */ export declare namespace AppBskyGraphGetFollows { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1587,7 +1517,7 @@ export declare namespace AppBskyGraphGetFollows { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { follows: AppBskyActorDefs.ProfileView[]; subject: AppBskyActorDefs.ProfileView; cursor?: string; @@ -1596,7 +1526,7 @@ export declare namespace AppBskyGraphGetFollows { /** Enumerates accounts which follow a specified account (actor) and are followed by the viewer. */ export declare namespace AppBskyGraphGetKnownFollowers { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1607,7 +1537,7 @@ export declare namespace AppBskyGraphGetKnownFollowers { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { followers: AppBskyActorDefs.ProfileView[]; subject: AppBskyActorDefs.ProfileView; cursor?: string; @@ -1616,7 +1546,7 @@ export declare namespace AppBskyGraphGetKnownFollowers { /** Gets a 'view' (with additional context) of a specified list. */ export declare namespace AppBskyGraphGetList { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of the list record to hydrate. */ list: At.Uri; cursor?: string; @@ -1628,7 +1558,7 @@ export declare namespace AppBskyGraphGetList { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { items: AppBskyGraphDefs.ListItemView[]; list: AppBskyGraphDefs.ListView; cursor?: string; @@ -1637,7 +1567,7 @@ export declare namespace AppBskyGraphGetList { /** Get mod lists that the requesting account (actor) is blocking. Requires auth. */ export declare namespace AppBskyGraphGetListBlocks { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1647,7 +1577,7 @@ export declare namespace AppBskyGraphGetListBlocks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { lists: AppBskyGraphDefs.ListView[]; cursor?: string; } @@ -1655,7 +1585,7 @@ export declare namespace AppBskyGraphGetListBlocks { /** Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. */ export declare namespace AppBskyGraphGetListMutes { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1665,7 +1595,7 @@ export declare namespace AppBskyGraphGetListMutes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { lists: AppBskyGraphDefs.ListView[]; cursor?: string; } @@ -1673,7 +1603,7 @@ export declare namespace AppBskyGraphGetListMutes { /** Enumerates the lists created by a specified account (actor). */ export declare namespace AppBskyGraphGetLists { - interface Params { + interface Params extends TypedBase { /** The account (actor) to enumerate lists from. */ actor: string; cursor?: string; @@ -1685,7 +1615,7 @@ export declare namespace AppBskyGraphGetLists { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { lists: AppBskyGraphDefs.ListView[]; cursor?: string; } @@ -1693,7 +1623,7 @@ export declare namespace AppBskyGraphGetLists { /** Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. */ export declare namespace AppBskyGraphGetMutes { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1703,7 +1633,7 @@ export declare namespace AppBskyGraphGetMutes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { mutes: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -1711,7 +1641,7 @@ export declare namespace AppBskyGraphGetMutes { /** Enumerates public relationships between one account, and a list of other accounts. Does not require auth. */ export declare namespace AppBskyGraphGetRelationships { - interface Params { + interface Params extends TypedBase { /** Primary account requesting relationships for. */ actor: string; /** @@ -1721,48 +1651,48 @@ export declare namespace AppBskyGraphGetRelationships { others?: string[]; } type Input = undefined; - interface Output { - relationships: Brand.Union< + interface Output extends TypedBase { + relationships: TypeUnion< AppBskyGraphDefs.NotFoundActor | AppBskyGraphDefs.Relationship >[]; actor?: At.DID; } - interface Errors { + interface Errors extends TypedBase { ActorNotFound: {}; } } /** Gets a view of a starter pack. */ export declare namespace AppBskyGraphGetStarterPack { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of the starter pack record. */ starterPack: At.Uri; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPack: AppBskyGraphDefs.StarterPackView; } } /** Get views for a list of starter packs. */ export declare namespace AppBskyGraphGetStarterPacks { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 25 */ uris: At.Uri[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; } } /** Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. */ export declare namespace AppBskyGraphGetSuggestedFollowsByActor { - interface Params { + interface Params extends TypedBase { actor: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { suggestions: AppBskyActorDefs.ProfileView[]; /** * If true, response has fallen-back to generic results, and is not scoped using relativeToDid @@ -1774,7 +1704,7 @@ export declare namespace AppBskyGraphGetSuggestedFollowsByActor { export declare namespace AppBskyGraphList { /** Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.list"; createdAt: string; /** @@ -1792,13 +1722,13 @@ export declare namespace AppBskyGraphList { */ description?: string; descriptionFacets?: AppBskyRichtextFacet.Main[]; - labels?: Brand.Union; + labels?: TypeUnion; } } export declare namespace AppBskyGraphListblock { /** Record representing a block relationship against an entire an entire list of accounts (actors). */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.listblock"; createdAt: string; /** Reference (AT-URI) to the mod list record. */ @@ -1808,7 +1738,7 @@ export declare namespace AppBskyGraphListblock { export declare namespace AppBskyGraphListitem { /** Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.listitem"; createdAt: string; /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ @@ -1820,8 +1750,8 @@ export declare namespace AppBskyGraphListitem { /** Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. */ export declare namespace AppBskyGraphMuteActor { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { actor: string; } type Output = undefined; @@ -1829,8 +1759,8 @@ export declare namespace AppBskyGraphMuteActor { /** Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. */ export declare namespace AppBskyGraphMuteActorList { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { list: At.Uri; } type Output = undefined; @@ -1838,8 +1768,8 @@ export declare namespace AppBskyGraphMuteActorList { /** Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. */ export declare namespace AppBskyGraphMuteThread { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { root: At.Uri; } type Output = undefined; @@ -1847,7 +1777,7 @@ export declare namespace AppBskyGraphMuteThread { /** Find starter packs matching search criteria. Does not require auth. */ export declare namespace AppBskyGraphSearchStarterPacks { - interface Params { + interface Params extends TypedBase { /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; cursor?: string; @@ -1859,7 +1789,7 @@ export declare namespace AppBskyGraphSearchStarterPacks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; cursor?: string; } @@ -1867,7 +1797,7 @@ export declare namespace AppBskyGraphSearchStarterPacks { export declare namespace AppBskyGraphStarterpack { /** Record defining a starter pack of actors and feeds for new users. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.starterpack"; createdAt: string; /** Reference (AT-URI) to the list record. */ @@ -1888,16 +1818,15 @@ export declare namespace AppBskyGraphStarterpack { /** Maximum array length: 3 */ feeds?: FeedItem[]; } - interface FeedItem { - [Brand.Type]: "app.bsky.graph.starterpack#feedItem"; + interface FeedItem extends TypedBase { uri: At.Uri; } } /** Unmutes the specified account. Requires auth. */ export declare namespace AppBskyGraphUnmuteActor { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { actor: string; } type Output = undefined; @@ -1905,8 +1834,8 @@ export declare namespace AppBskyGraphUnmuteActor { /** Unmutes the specified list of accounts. Requires auth. */ export declare namespace AppBskyGraphUnmuteActorList { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { list: At.Uri; } type Output = undefined; @@ -1914,23 +1843,21 @@ export declare namespace AppBskyGraphUnmuteActorList { /** Unmutes the specified thread. Requires auth. */ export declare namespace AppBskyGraphUnmuteThread { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { root: At.Uri; } type Output = undefined; } export declare namespace AppBskyLabelerDefs { - interface LabelerPolicies { - [Brand.Type]: "app.bsky.labeler.defs#labelerPolicies"; + interface LabelerPolicies extends TypedBase { /** The label values which this labeler publishes. May include global or custom labels. */ labelValues: ComAtprotoLabelDefs.LabelValue[]; /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; } - interface LabelerView { - [Brand.Type]: "app.bsky.labeler.defs#labelerView"; + interface LabelerView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1940,8 +1867,7 @@ export declare namespace AppBskyLabelerDefs { likeCount?: number; viewer?: LabelerViewerState; } - interface LabelerViewDetailed { - [Brand.Type]: "app.bsky.labeler.defs#labelerViewDetailed"; + interface LabelerViewDetailed extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1952,22 +1878,21 @@ export declare namespace AppBskyLabelerDefs { likeCount?: number; viewer?: LabelerViewerState; } - interface LabelerViewerState { - [Brand.Type]: "app.bsky.labeler.defs#labelerViewerState"; + interface LabelerViewerState extends TypedBase { like?: At.Uri; } } /** Get information about a list of labeler services. */ export declare namespace AppBskyLabelerGetServices { - interface Params { + interface Params extends TypedBase { dids: At.DID[]; /** \@default false */ detailed?: boolean; } type Input = undefined; - interface Output { - views: Brand.Union< + interface Output extends TypedBase { + views: TypeUnion< AppBskyLabelerDefs.LabelerView | AppBskyLabelerDefs.LabelerViewDetailed >[]; } @@ -1975,29 +1900,29 @@ export declare namespace AppBskyLabelerGetServices { export declare namespace AppBskyLabelerService { /** A declaration of the existence of labeler service. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.labeler.service"; createdAt: string; policies: AppBskyLabelerDefs.LabelerPolicies; - labels?: Brand.Union; + labels?: TypeUnion; } } /** Count the number of unread notifications for the requesting account. Requires auth. */ export declare namespace AppBskyNotificationGetUnreadCount { - interface Params { + interface Params extends TypedBase { priority?: boolean; seenAt?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { count: number; } } /** Enumerate notifications for the requesting account. Requires auth. */ export declare namespace AppBskyNotificationListNotifications { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2009,14 +1934,13 @@ export declare namespace AppBskyNotificationListNotifications { seenAt?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { notifications: Notification[]; cursor?: string; priority?: boolean; seenAt?: string; } - interface Notification { - [Brand.Type]: "app.bsky.notification.listNotifications#notification"; + interface Notification extends TypedBase { author: AppBskyActorDefs.ProfileView; cid: At.CID; indexedAt: string; @@ -2040,8 +1964,8 @@ export declare namespace AppBskyNotificationListNotifications { /** Set notification-related preferences for an account. Requires auth. */ export declare namespace AppBskyNotificationPutPreferences { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { priority: boolean; } type Output = undefined; @@ -2049,8 +1973,8 @@ export declare namespace AppBskyNotificationPutPreferences { /** Register to receive push notifications, via a specified service, for the requesting account. Requires auth. */ export declare namespace AppBskyNotificationRegisterPush { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { appId: string; platform: "android" | "ios" | "web" | (string & {}); serviceDid: At.DID; @@ -2061,8 +1985,8 @@ export declare namespace AppBskyNotificationRegisterPush { /** Notify server that the requesting account has seen notifications. Requires auth. */ export declare namespace AppBskyNotificationUpdateSeen { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { seenAt: string; } type Output = undefined; @@ -2070,32 +1994,27 @@ export declare namespace AppBskyNotificationUpdateSeen { export declare namespace AppBskyRichtextFacet { /** Annotation of a sub-string within rich text. */ - interface Main { - [Brand.Type]: "app.bsky.richtext.facet"; - features: Brand.Union[]; + interface Main extends TypedBase { + features: TypeUnion[]; index: ByteSlice; } /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ - interface ByteSlice { - [Brand.Type]: "app.bsky.richtext.facet#byteSlice"; + interface ByteSlice extends TypedBase { /** Minimum: 0 */ byteEnd: number; /** Minimum: 0 */ byteStart: number; } /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ - interface Link { - [Brand.Type]: "app.bsky.richtext.facet#link"; + interface Link extends TypedBase { uri: string; } /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ - interface Mention { - [Brand.Type]: "app.bsky.richtext.facet#mention"; + interface Mention extends TypedBase { did: At.DID; } /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ - interface Tag { - [Brand.Type]: "app.bsky.richtext.facet#tag"; + interface Tag extends TypedBase { /** * Maximum string length: 640 * Maximum grapheme length: 64 @@ -2105,32 +2024,29 @@ export declare namespace AppBskyRichtextFacet { } export declare namespace AppBskyUnspeccedDefs { - interface SkeletonSearchActor { - [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchActor"; + interface SkeletonSearchActor extends TypedBase { did: At.DID; } - interface SkeletonSearchPost { - [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchPost"; + interface SkeletonSearchPost extends TypedBase { uri: At.Uri; } - interface SkeletonSearchStarterPack { - [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; + interface SkeletonSearchStarterPack extends TypedBase { uri: At.Uri; } } /** Get miscellaneous runtime configuration. */ export declare namespace AppBskyUnspeccedGetConfig { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { checkEmailConfirmed?: boolean; } } /** An unspecced view of globally popular feed generators. */ export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2141,7 +2057,7 @@ export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { query?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; cursor?: string; } @@ -2149,7 +2065,7 @@ export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { /** Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions */ export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2163,7 +2079,7 @@ export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; cursor?: string; /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ @@ -2174,11 +2090,10 @@ export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { /** Get a list of suggestions (feeds and users) tagged with categories */ export declare namespace AppBskyUnspeccedGetTaggedSuggestions { type Input = undefined; - interface Output { + interface Output extends TypedBase { suggestions: Suggestion[]; } - interface Suggestion { - [Brand.Type]: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; + interface Suggestion extends TypedBase { subject: string; subjectType: "actor" | "feed" | (string & {}); tag: string; @@ -2187,7 +2102,7 @@ export declare namespace AppBskyUnspeccedGetTaggedSuggestions { /** Backend Actors (profile) search, returns only skeleton. */ export declare namespace AppBskyUnspeccedSearchActorsSkeleton { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ q: string; /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ @@ -2204,20 +2119,20 @@ export declare namespace AppBskyUnspeccedSearchActorsSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } /** Backend Posts search, returns only skeleton */ export declare namespace AppBskyUnspeccedSearchPostsSkeleton { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ @@ -2257,20 +2172,20 @@ export declare namespace AppBskyUnspeccedSearchPostsSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } /** Backend Starter Pack search, returns only skeleton. */ export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ @@ -2285,20 +2200,19 @@ export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } export declare namespace AppBskyVideoDefs { - interface JobStatus { - [Brand.Type]: "app.bsky.video.defs#jobStatus"; + interface JobStatus extends TypedBase { did: At.DID; jobId: string; /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ @@ -2317,20 +2231,20 @@ export declare namespace AppBskyVideoDefs { /** Get status details for a video processing job. */ export declare namespace AppBskyVideoGetJobStatus { - interface Params { + interface Params extends TypedBase { jobId: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { jobStatus: AppBskyVideoDefs.JobStatus; } } /** Get video upload limits for the authenticated user. */ export declare namespace AppBskyVideoGetUploadLimits { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { canUpload: boolean; error?: string; message?: string; @@ -2341,24 +2255,23 @@ export declare namespace AppBskyVideoGetUploadLimits { /** Upload a video to be processed then stored on the PDS. */ export declare namespace AppBskyVideoUploadVideo { - interface Params {} + interface Params extends TypedBase {} type Input = Blob | ArrayBufferView; - interface Output { + interface Output extends TypedBase { jobStatus: AppBskyVideoDefs.JobStatus; } } export declare namespace ChatBskyActorDeclaration { /** A declaration of a Bluesky chat account. */ - interface Record { + interface Record extends RecordBase { $type: "chat.bsky.actor.declaration"; allowIncoming: "all" | "following" | "none" | (string & {}); } } export declare namespace ChatBskyActorDefs { - interface ProfileViewBasic { - [Brand.Type]: "chat.bsky.actor.defs#profileViewBasic"; + interface ProfileViewBasic extends TypedBase { did: At.DID; handle: At.Handle; associated?: AppBskyActorDefs.ProfileAssociated; @@ -2376,76 +2289,67 @@ export declare namespace ChatBskyActorDefs { } export declare namespace ChatBskyActorDeleteAccount { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output {} + interface Output extends TypedBase {} } export declare namespace ChatBskyActorExportAccountData { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = Uint8Array; } export declare namespace ChatBskyConvoDefs { - interface ConvoView { - [Brand.Type]: "chat.bsky.convo.defs#convoView"; + interface ConvoView extends TypedBase { id: string; members: ChatBskyActorDefs.ProfileViewBasic[]; muted: boolean; rev: string; unreadCount: number; - lastMessage?: Brand.Union; + lastMessage?: TypeUnion; opened?: boolean; } - interface DeletedMessageView { - [Brand.Type]: "chat.bsky.convo.defs#deletedMessageView"; + interface DeletedMessageView extends TypedBase { id: string; rev: string; sender: MessageViewSender; sentAt: string; } - interface LogBeginConvo { - [Brand.Type]: "chat.bsky.convo.defs#logBeginConvo"; + interface LogBeginConvo extends TypedBase { convoId: string; rev: string; } - interface LogCreateMessage { - [Brand.Type]: "chat.bsky.convo.defs#logCreateMessage"; + interface LogCreateMessage extends TypedBase { convoId: string; - message: Brand.Union; + message: TypeUnion; rev: string; } - interface LogDeleteMessage { - [Brand.Type]: "chat.bsky.convo.defs#logDeleteMessage"; + interface LogDeleteMessage extends TypedBase { convoId: string; - message: Brand.Union; + message: TypeUnion; rev: string; } - interface LogLeaveConvo { - [Brand.Type]: "chat.bsky.convo.defs#logLeaveConvo"; + interface LogLeaveConvo extends TypedBase { convoId: string; rev: string; } - interface MessageInput { - [Brand.Type]: "chat.bsky.convo.defs#messageInput"; + interface MessageInput extends TypedBase { /** * Maximum string length: 10000 * Maximum grapheme length: 1000 */ text: string; - embed?: Brand.Union; + embed?: TypeUnion; /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[]; } - interface MessageRef { - [Brand.Type]: "chat.bsky.convo.defs#messageRef"; + interface MessageRef extends TypedBase { convoId: string; did: At.DID; messageId: string; } - interface MessageView { - [Brand.Type]: "chat.bsky.convo.defs#messageView"; + interface MessageView extends TypedBase { id: string; rev: string; sender: MessageViewSender; @@ -2455,19 +2359,18 @@ export declare namespace ChatBskyConvoDefs { * Maximum grapheme length: 1000 */ text: string; - embed?: Brand.Union; + embed?: TypeUnion; /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[]; } - interface MessageViewSender { - [Brand.Type]: "chat.bsky.convo.defs#messageViewSender"; + interface MessageViewSender extends TypedBase { did: At.DID; } } export declare namespace ChatBskyConvoDeleteMessageForSelf { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; messageId: string; } @@ -2475,17 +2378,17 @@ export declare namespace ChatBskyConvoDeleteMessageForSelf { } export declare namespace ChatBskyConvoGetConvo { - interface Params { + interface Params extends TypedBase { convoId: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoGetConvoForMembers { - interface Params { + interface Params extends TypedBase { /** * Minimum array length: 1 * Maximum array length: 10 @@ -2493,18 +2396,18 @@ export declare namespace ChatBskyConvoGetConvoForMembers { members: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoGetLog { - interface Params { + interface Params extends TypedBase { cursor?: string; } type Input = undefined; - interface Output { - logs: Brand.Union< + interface Output extends TypedBase { + logs: TypeUnion< | ChatBskyConvoDefs.LogBeginConvo | ChatBskyConvoDefs.LogCreateMessage | ChatBskyConvoDefs.LogDeleteMessage @@ -2515,7 +2418,7 @@ export declare namespace ChatBskyConvoGetLog { } export declare namespace ChatBskyConvoGetMessages { - interface Params { + interface Params extends TypedBase { convoId: string; cursor?: string; /** @@ -2526,8 +2429,8 @@ export declare namespace ChatBskyConvoGetMessages { limit?: number; } type Input = undefined; - interface Output { - messages: Brand.Union< + interface Output extends TypedBase { + messages: TypeUnion< ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView >[]; cursor?: string; @@ -2535,18 +2438,18 @@ export declare namespace ChatBskyConvoGetMessages { } export declare namespace ChatBskyConvoLeaveConvo { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; } - interface Output { + interface Output extends TypedBase { convoId: string; rev: string; } } export declare namespace ChatBskyConvoListConvos { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2556,25 +2459,25 @@ export declare namespace ChatBskyConvoListConvos { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { convos: ChatBskyConvoDefs.ConvoView[]; cursor?: string; } } export declare namespace ChatBskyConvoMuteConvo { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; } - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoSendMessage { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; message: ChatBskyConvoDefs.MessageInput; } @@ -2582,54 +2485,52 @@ export declare namespace ChatBskyConvoSendMessage { } export declare namespace ChatBskyConvoSendMessageBatch { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Maximum array length: 100 */ items: BatchItem[]; } - interface Output { + interface Output extends TypedBase { items: ChatBskyConvoDefs.MessageView[]; } - interface BatchItem { - [Brand.Type]: "chat.bsky.convo.sendMessageBatch#batchItem"; + interface BatchItem extends TypedBase { convoId: string; message: ChatBskyConvoDefs.MessageInput; } } export declare namespace ChatBskyConvoUnmuteConvo { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; } - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoUpdateRead { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; messageId?: string; } - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyModerationGetActorMetadata { - interface Params { + interface Params extends TypedBase { actor: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { all: Metadata; day: Metadata; month: Metadata; } - interface Metadata { - [Brand.Type]: "chat.bsky.moderation.getActorMetadata#metadata"; + interface Metadata extends TypedBase { convos: number; convosStarted: number; messagesReceived: number; @@ -2638,7 +2539,7 @@ export declare namespace ChatBskyModerationGetActorMetadata { } export declare namespace ChatBskyModerationGetMessageContext { - interface Params { + interface Params extends TypedBase { messageId: string; /** \@default 5 */ after?: number; @@ -2648,16 +2549,16 @@ export declare namespace ChatBskyModerationGetMessageContext { convoId?: string; } type Input = undefined; - interface Output { - messages: Brand.Union< + interface Output extends TypedBase { + messages: TypeUnion< ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView >[]; } } export declare namespace ChatBskyModerationUpdateActorAccess { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { actor: At.DID; allowAccess: boolean; ref?: string; @@ -2666,8 +2567,7 @@ export declare namespace ChatBskyModerationUpdateActorAccess { } export declare namespace ComAtprotoAdminDefs { - interface AccountView { - [Brand.Type]: "com.atproto.admin.defs#accountView"; + interface AccountView extends TypedBase { did: At.DID; handle: At.Handle; indexedAt: string; @@ -2681,23 +2581,19 @@ export declare namespace ComAtprotoAdminDefs { relatedRecords?: unknown[]; threatSignatures?: ThreatSignature[]; } - interface RepoBlobRef { - [Brand.Type]: "com.atproto.admin.defs#repoBlobRef"; + interface RepoBlobRef extends TypedBase { cid: At.CID; did: At.DID; recordUri?: At.Uri; } - interface RepoRef { - [Brand.Type]: "com.atproto.admin.defs#repoRef"; + interface RepoRef extends TypedBase { did: At.DID; } - interface StatusAttr { - [Brand.Type]: "com.atproto.admin.defs#statusAttr"; + interface StatusAttr extends TypedBase { applied: boolean; ref?: string; } - interface ThreatSignature { - [Brand.Type]: "com.atproto.admin.defs#threatSignature"; + interface ThreatSignature extends TypedBase { property: string; value: string; } @@ -2705,8 +2601,8 @@ export declare namespace ComAtprotoAdminDefs { /** Delete a user account as an administrator. */ export declare namespace ComAtprotoAdminDeleteAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; } type Output = undefined; @@ -2714,8 +2610,8 @@ export declare namespace ComAtprotoAdminDeleteAccount { /** Disable an account from receiving new invite codes, but does not invalidate existing codes. */ export declare namespace ComAtprotoAdminDisableAccountInvites { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { account: At.DID; /** Optional reason for disabled invites. */ note?: string; @@ -2725,8 +2621,8 @@ export declare namespace ComAtprotoAdminDisableAccountInvites { /** Disable some set of codes and/or all codes associated with a set of users. */ export declare namespace ComAtprotoAdminDisableInviteCodes { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { accounts?: string[]; codes?: string[]; } @@ -2735,8 +2631,8 @@ export declare namespace ComAtprotoAdminDisableInviteCodes { /** Re-enable an account's ability to receive invite codes. */ export declare namespace ComAtprotoAdminEnableAccountInvites { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { account: At.DID; /** Optional reason for enabled invites. */ note?: string; @@ -2746,7 +2642,7 @@ export declare namespace ComAtprotoAdminEnableAccountInvites { /** Get details about an account. */ export declare namespace ComAtprotoAdminGetAccountInfo { - interface Params { + interface Params extends TypedBase { did: At.DID; } type Input = undefined; @@ -2755,18 +2651,18 @@ export declare namespace ComAtprotoAdminGetAccountInfo { /** Get details about some accounts. */ export declare namespace ComAtprotoAdminGetAccountInfos { - interface Params { + interface Params extends TypedBase { dids: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { infos: ComAtprotoAdminDefs.AccountView[]; } } /** Get an admin view of invite codes. */ export declare namespace ComAtprotoAdminGetInviteCodes { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2778,7 +2674,7 @@ export declare namespace ComAtprotoAdminGetInviteCodes { sort?: "recent" | "usage" | (string & {}); } type Input = undefined; - interface Output { + interface Output extends TypedBase { codes: ComAtprotoServerDefs.InviteCode[]; cursor?: string; } @@ -2786,14 +2682,14 @@ export declare namespace ComAtprotoAdminGetInviteCodes { /** Get the service-specific admin status of a subject (account, record, or blob). */ export declare namespace ComAtprotoAdminGetSubjectStatus { - interface Params { + interface Params extends TypedBase { blob?: At.CID; did?: At.DID; uri?: At.Uri; } type Input = undefined; - interface Output { - subject: Brand.Union< + interface Output extends TypedBase { + subject: TypeUnion< | ComAtprotoAdminDefs.RepoBlobRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -2805,7 +2701,7 @@ export declare namespace ComAtprotoAdminGetSubjectStatus { /** Get list of accounts that matches your search query. */ export declare namespace ComAtprotoAdminSearchAccounts { - interface Params { + interface Params extends TypedBase { cursor?: string; email?: string; /** @@ -2816,7 +2712,7 @@ export declare namespace ComAtprotoAdminSearchAccounts { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { accounts: ComAtprotoAdminDefs.AccountView[]; cursor?: string; } @@ -2824,8 +2720,8 @@ export declare namespace ComAtprotoAdminSearchAccounts { /** Send email to a user's account email address. */ export declare namespace ComAtprotoAdminSendEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { content: string; recipientDid: At.DID; senderDid: At.DID; @@ -2833,15 +2729,15 @@ export declare namespace ComAtprotoAdminSendEmail { comment?: string; subject?: string; } - interface Output { + interface Output extends TypedBase { sent: boolean; } } /** Administrative action to update an account's email. */ export declare namespace ComAtprotoAdminUpdateAccountEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The handle or DID of the repo. */ account: string; email: string; @@ -2851,8 +2747,8 @@ export declare namespace ComAtprotoAdminUpdateAccountEmail { /** Administrative action to update an account's handle. */ export declare namespace ComAtprotoAdminUpdateAccountHandle { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; handle: At.Handle; } @@ -2861,8 +2757,8 @@ export declare namespace ComAtprotoAdminUpdateAccountHandle { /** Update the password for a user account as an administrator. */ export declare namespace ComAtprotoAdminUpdateAccountPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; password: string; } @@ -2871,9 +2767,9 @@ export declare namespace ComAtprotoAdminUpdateAccountPassword { /** Update the service-specific admin status of a subject (account, record, or blob). */ export declare namespace ComAtprotoAdminUpdateSubjectStatus { - interface Params {} - interface Input { - subject: Brand.Union< + interface Params extends TypedBase {} + interface Input extends TypedBase { + subject: TypeUnion< | ComAtprotoAdminDefs.RepoBlobRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -2881,8 +2777,8 @@ export declare namespace ComAtprotoAdminUpdateSubjectStatus { deactivated?: ComAtprotoAdminDefs.StatusAttr; takedown?: ComAtprotoAdminDefs.StatusAttr; } - interface Output { - subject: Brand.Union< + interface Output extends TypedBase { + subject: TypeUnion< | ComAtprotoAdminDefs.RepoBlobRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -2893,9 +2789,9 @@ export declare namespace ComAtprotoAdminUpdateSubjectStatus { /** Describe the credentials that should be included in the DID doc of an account that is migrating to this service. */ export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { alsoKnownAs?: string[]; /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ rotationKeys?: string[]; @@ -2906,27 +2802,27 @@ export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { /** Request an email with a code to in order to request a signed PLC operation. Requires Auth. */ export declare namespace ComAtprotoIdentityRequestPlcOperationSignature { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Resolves a handle (domain name) to a DID. */ export declare namespace ComAtprotoIdentityResolveHandle { - interface Params { + interface Params extends TypedBase { /** The handle to resolve. */ handle: At.Handle; } type Input = undefined; - interface Output { + interface Output extends TypedBase { did: At.DID; } } /** Signs a PLC operation to update some value(s) in the requesting DID's document. */ export declare namespace ComAtprotoIdentitySignPlcOperation { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { alsoKnownAs?: string[]; rotationKeys?: string[]; services?: unknown; @@ -2934,7 +2830,7 @@ export declare namespace ComAtprotoIdentitySignPlcOperation { token?: string; verificationMethods?: unknown; } - interface Output { + interface Output extends TypedBase { /** A signed DID PLC operation. */ operation: unknown; } @@ -2942,8 +2838,8 @@ export declare namespace ComAtprotoIdentitySignPlcOperation { /** Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry */ export declare namespace ComAtprotoIdentitySubmitPlcOperation { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { operation: unknown; } type Output = undefined; @@ -2951,8 +2847,8 @@ export declare namespace ComAtprotoIdentitySubmitPlcOperation { /** Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. */ export declare namespace ComAtprotoIdentityUpdateHandle { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The new handle. */ handle: At.Handle; } @@ -2961,8 +2857,7 @@ export declare namespace ComAtprotoIdentityUpdateHandle { export declare namespace ComAtprotoLabelDefs { /** Metadata tag on an atproto resource (eg, repo or record). */ - interface Label { - [Brand.Type]: "com.atproto.label.defs#label"; + interface Label extends TypedBase { /** Timestamp when this label was created. */ cts: string; /** DID of the actor who created this label. */ @@ -2999,8 +2894,7 @@ export declare namespace ComAtprotoLabelDefs { | "sexual" | (string & {}); /** Declares a label value and its expected interpretations and behaviors. */ - interface LabelValueDefinition { - [Brand.Type]: "com.atproto.label.defs#labelValueDefinition"; + interface LabelValueDefinition extends TypedBase { /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ blurs: "content" | "media" | "none" | (string & {}); /** @@ -3021,8 +2915,7 @@ export declare namespace ComAtprotoLabelDefs { defaultSetting?: "hide" | "ignore" | "warn" | (string & {}); } /** Strings which describe the label in the UI, localized into a specific language. */ - interface LabelValueDefinitionStrings { - [Brand.Type]: "com.atproto.label.defs#labelValueDefinitionStrings"; + interface LabelValueDefinitionStrings extends TypedBase { /** * A longer description of what the label means and why it might be applied. * Maximum string length: 100000 @@ -3039,8 +2932,7 @@ export declare namespace ComAtprotoLabelDefs { name: string; } /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ - interface SelfLabel { - [Brand.Type]: "com.atproto.label.defs#selfLabel"; + interface SelfLabel extends TypedBase { /** * The short string name of the value or type of this label. * Maximum string length: 128 @@ -3048,8 +2940,7 @@ export declare namespace ComAtprotoLabelDefs { val: string; } /** Metadata tags on an atproto record, published by the author within the record. */ - interface SelfLabels { - [Brand.Type]: "com.atproto.label.defs#selfLabels"; + interface SelfLabels extends TypedBase { /** Maximum array length: 10 */ values: SelfLabel[]; } @@ -3057,7 +2948,7 @@ export declare namespace ComAtprotoLabelDefs { /** Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. */ export declare namespace ComAtprotoLabelQueryLabels { - interface Params { + interface Params extends TypedBase { /** 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. */ uriPatterns: string[]; cursor?: string; @@ -3071,28 +2962,26 @@ export declare namespace ComAtprotoLabelQueryLabels { sources?: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { labels: ComAtprotoLabelDefs.Label[]; cursor?: string; } } export declare namespace ComAtprotoLabelSubscribeLabels { - interface Params { + interface Params extends TypedBase { /** The last known event seq number to backfill from. */ cursor?: number; } - type Message = Brand.Union; - interface Errors { + type Message = TypeUnion; + interface Errors extends TypedBase { FutureCursor: {}; } - interface Info { - [Brand.Type]: "com.atproto.label.subscribeLabels#info"; + interface Info extends TypedBase { name: "OutdatedCursor" | (string & {}); message?: string; } - interface Labels { - [Brand.Type]: "com.atproto.label.subscribeLabels#labels"; + interface Labels extends TypedBase { labels: ComAtprotoLabelDefs.Label[]; seq: number; } @@ -3100,11 +2989,11 @@ export declare namespace ComAtprotoLabelSubscribeLabels { /** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */ export declare namespace ComAtprotoModerationCreateReport { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Indicates the broad category of violation the report is for. */ reasonType: ComAtprotoModerationDefs.ReasonType; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; /** @@ -3114,12 +3003,12 @@ export declare namespace ComAtprotoModerationCreateReport { */ reason?: string; } - interface Output { + interface Output extends TypedBase { createdAt: string; id: number; reasonType: ComAtprotoModerationDefs.ReasonType; reportedBy: At.DID; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; /** @@ -3151,55 +3040,48 @@ export declare namespace ComAtprotoModerationDefs { /** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoApplyWrites { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The handle or DID of the repo (aka, current account). */ repo: string; - writes: Brand.Union[]; + writes: TypeUnion[]; /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */ swapCommit?: At.CID; /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */ validate?: boolean; } - interface Output { + interface Output extends TypedBase { commit?: ComAtprotoRepoDefs.CommitMeta; - results?: Brand.Union[]; + results?: TypeUnion[]; } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } /** Operation which creates a new record. */ - interface Create { - [Brand.Type]: "com.atproto.repo.applyWrites#create"; + interface Create extends TypedBase { collection: string; value: unknown; /** Maximum string length: 512 */ rkey?: string; } - interface CreateResult { - [Brand.Type]: "com.atproto.repo.applyWrites#createResult"; + interface CreateResult extends TypedBase { cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); } /** Operation which deletes an existing record. */ - interface Delete { - [Brand.Type]: "com.atproto.repo.applyWrites#delete"; + interface Delete extends TypedBase { collection: string; rkey: string; } - interface DeleteResult { - [Brand.Type]: "com.atproto.repo.applyWrites#deleteResult"; - } + interface DeleteResult extends TypedBase {} /** Operation which updates an existing record. */ - interface Update { - [Brand.Type]: "com.atproto.repo.applyWrites#update"; + interface Update extends TypedBase { collection: string; rkey: string; value: unknown; } - interface UpdateResult { - [Brand.Type]: "com.atproto.repo.applyWrites#updateResult"; + interface UpdateResult extends TypedBase { cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); @@ -3208,8 +3090,8 @@ export declare namespace ComAtprotoRepoApplyWrites { /** Create a single new repository record. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoCreateRecord { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The record itself. Must contain a $type field. */ @@ -3226,20 +3108,19 @@ export declare namespace ComAtprotoRepoCreateRecord { /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ validate?: boolean; } - interface Output { + interface Output extends TypedBase { cid: At.CID; uri: At.Uri; commit?: ComAtprotoRepoDefs.CommitMeta; validationStatus?: "unknown" | "valid" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } } export declare namespace ComAtprotoRepoDefs { - interface CommitMeta { - [Brand.Type]: "com.atproto.repo.defs#commitMeta"; + interface CommitMeta extends TypedBase { cid: At.CID; rev: string; } @@ -3247,8 +3128,8 @@ export declare namespace ComAtprotoRepoDefs { /** Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoDeleteRecord { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The handle or DID of the repo (aka, current account). */ @@ -3260,22 +3141,22 @@ export declare namespace ComAtprotoRepoDeleteRecord { /** Compare and swap with the previous record by CID. */ swapRecord?: At.CID; } - interface Output { + interface Output extends TypedBase { commit?: ComAtprotoRepoDefs.CommitMeta; } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } } /** Get information about an account and repository, including the list of collections. Does not require auth. */ export declare namespace ComAtprotoRepoDescribeRepo { - interface Params { + interface Params extends TypedBase { /** The handle or DID of the repo. */ repo: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { /** List of all the collections (NSIDs) for which this repo contains at least one record. */ collections: string[]; did: At.DID; @@ -3289,7 +3170,7 @@ export declare namespace ComAtprotoRepoDescribeRepo { /** Get a single record from a repository. Does not require auth. */ export declare namespace ComAtprotoRepoGetRecord { - interface Params { + interface Params extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The handle or DID of the repo. */ @@ -3300,26 +3181,26 @@ export declare namespace ComAtprotoRepoGetRecord { cid?: At.CID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { uri: At.Uri; value: unknown; cid?: At.CID; } - interface Errors { + interface Errors extends TypedBase { RecordNotFound: {}; } } /** Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. */ export declare namespace ComAtprotoRepoImportRepo { - interface Params {} + interface Params extends TypedBase {} type Input = Blob | ArrayBufferView; type Output = undefined; } /** Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. */ export declare namespace ComAtprotoRepoListMissingBlobs { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -3329,12 +3210,11 @@ export declare namespace ComAtprotoRepoListMissingBlobs { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { blobs: RecordBlob[]; cursor?: string; } - interface RecordBlob { - [Brand.Type]: "com.atproto.repo.listMissingBlobs#recordBlob"; + interface RecordBlob extends TypedBase { cid: At.CID; recordUri: At.Uri; } @@ -3342,7 +3222,7 @@ export declare namespace ComAtprotoRepoListMissingBlobs { /** List a range of records in a repository, matching a specific collection. Does not require auth. */ export declare namespace ComAtprotoRepoListRecords { - interface Params { + interface Params extends TypedBase { /** The NSID of the record type. */ collection: string; /** The handle or DID of the repo. */ @@ -3369,12 +3249,11 @@ export declare namespace ComAtprotoRepoListRecords { rkeyStart?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { records: Record[]; cursor?: string; } - interface Record { - [Brand.Type]: "com.atproto.repo.listRecords#record"; + interface Record extends TypedBase { cid: At.CID; uri: At.Uri; value: unknown; @@ -3383,8 +3262,8 @@ export declare namespace ComAtprotoRepoListRecords { /** Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoPutRecord { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The record to write. */ @@ -3403,20 +3282,19 @@ export declare namespace ComAtprotoRepoPutRecord { /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ validate?: boolean; } - interface Output { + interface Output extends TypedBase { cid: At.CID; uri: At.Uri; commit?: ComAtprotoRepoDefs.CommitMeta; validationStatus?: "unknown" | "valid" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } } export declare namespace ComAtprotoRepoStrongRef { - interface Main { - [Brand.Type]: "com.atproto.repo.strongRef"; + interface Main extends TypedBase { cid: At.CID; uri: At.Uri; } @@ -3424,25 +3302,25 @@ export declare namespace ComAtprotoRepoStrongRef { /** Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoUploadBlob { - interface Params {} + interface Params extends TypedBase {} type Input = Blob | ArrayBufferView; - interface Output { + interface Output extends TypedBase { blob: At.Blob; } } /** Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. */ export declare namespace ComAtprotoServerActivateAccount { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. */ export declare namespace ComAtprotoServerCheckAccountStatus { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { activated: boolean; expectedBlobs: number; importedBlobs: number; @@ -3457,13 +3335,13 @@ export declare namespace ComAtprotoServerCheckAccountStatus { /** Confirm an email using a token from com.atproto.server.requestEmailConfirmation. */ export declare namespace ComAtprotoServerConfirmEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { email: string; token: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { AccountNotFound: {}; ExpiredToken: {}; InvalidToken: {}; @@ -3473,8 +3351,8 @@ export declare namespace ComAtprotoServerConfirmEmail { /** Create an account. Implemented by PDS. */ export declare namespace ComAtprotoServerCreateAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Requested handle for the account. */ handle: At.Handle; /** Pre-existing atproto DID, being imported to a new account. */ @@ -3491,7 +3369,7 @@ export declare namespace ComAtprotoServerCreateAccount { verificationPhone?: string; } /** Account login session returned on successful account creation. */ - interface Output { + interface Output extends TypedBase { accessJwt: string; /** The DID of the new account. */ did: At.DID; @@ -3500,7 +3378,7 @@ export declare namespace ComAtprotoServerCreateAccount { /** Complete DID document. */ didDoc?: unknown; } - interface Errors { + interface Errors extends TypedBase { InvalidHandle: {}; InvalidPassword: {}; InvalidInviteCode: {}; @@ -3513,19 +3391,18 @@ export declare namespace ComAtprotoServerCreateAccount { /** Create an App Password. */ export declare namespace ComAtprotoServerCreateAppPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** A short name for the App Password, to help distinguish them. */ name: string; /** If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. */ privileged?: boolean; } type Output = AppPassword; - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; } - interface AppPassword { - [Brand.Type]: "com.atproto.server.createAppPassword#appPassword"; + interface AppPassword extends TypedBase { createdAt: string; name: string; password: string; @@ -3535,30 +3412,29 @@ export declare namespace ComAtprotoServerCreateAppPassword { /** Create an invite code. */ export declare namespace ComAtprotoServerCreateInviteCode { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { useCount: number; forAccount?: At.DID; } - interface Output { + interface Output extends TypedBase { code: string; } } /** Create invite codes. */ export declare namespace ComAtprotoServerCreateInviteCodes { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** \@default 1 */ codeCount: number; useCount: number; forAccounts?: At.DID[]; } - interface Output { + interface Output extends TypedBase { codes: AccountCodes[]; } - interface AccountCodes { - [Brand.Type]: "com.atproto.server.createInviteCodes#accountCodes"; + interface AccountCodes extends TypedBase { account: string; codes: string[]; } @@ -3566,14 +3442,14 @@ export declare namespace ComAtprotoServerCreateInviteCodes { /** Create an authentication session. */ export declare namespace ComAtprotoServerCreateSession { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Handle or other identifier supported by the server for the authenticating user. */ identifier: string; password: string; authFactorToken?: string; } - interface Output { + interface Output extends TypedBase { accessJwt: string; did: At.DID; handle: At.Handle; @@ -3586,7 +3462,7 @@ export declare namespace ComAtprotoServerCreateSession { /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ status?: "deactivated" | "suspended" | "takendown" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; AuthFactorTokenRequired: {}; } @@ -3594,8 +3470,8 @@ export declare namespace ComAtprotoServerCreateSession { /** Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. */ export declare namespace ComAtprotoServerDeactivateAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ deleteAfter?: string; } @@ -3603,8 +3479,7 @@ export declare namespace ComAtprotoServerDeactivateAccount { } export declare namespace ComAtprotoServerDefs { - interface InviteCode { - [Brand.Type]: "com.atproto.server.defs#inviteCode"; + interface InviteCode extends TypedBase { available: number; code: string; createdAt: string; @@ -3613,8 +3488,7 @@ export declare namespace ComAtprotoServerDefs { forAccount: string; uses: InviteCodeUse[]; } - interface InviteCodeUse { - [Brand.Type]: "com.atproto.server.defs#inviteCodeUse"; + interface InviteCodeUse extends TypedBase { usedAt: string; usedBy: At.DID; } @@ -3622,14 +3496,14 @@ export declare namespace ComAtprotoServerDefs { /** Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. */ export declare namespace ComAtprotoServerDeleteAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; password: string; token: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { ExpiredToken: {}; InvalidToken: {}; } @@ -3637,16 +3511,16 @@ export declare namespace ComAtprotoServerDeleteAccount { /** Delete the current session. Requires auth. */ export declare namespace ComAtprotoServerDeleteSession { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Describes the server's account creation requirements and capabilities. Implemented by PDS. */ export declare namespace ComAtprotoServerDescribeServer { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { /** List of domain suffixes that can be used in account handles. */ availableUserDomains: string[]; did: At.DID; @@ -3659,12 +3533,10 @@ export declare namespace ComAtprotoServerDescribeServer { /** If true, a phone verification token must be supplied to create an account on this instance. */ phoneVerificationRequired?: boolean; } - interface Contact { - [Brand.Type]: "com.atproto.server.describeServer#contact"; + interface Contact extends TypedBase { email?: string; } - interface Links { - [Brand.Type]: "com.atproto.server.describeServer#links"; + interface Links extends TypedBase { privacyPolicy?: string; termsOfService?: string; } @@ -3672,7 +3544,7 @@ export declare namespace ComAtprotoServerDescribeServer { /** Get all invite codes for the current account. Requires auth. */ export declare namespace ComAtprotoServerGetAccountInviteCodes { - interface Params { + interface Params extends TypedBase { /** * Controls whether any new 'earned' but not 'created' invites should be created. * \@default true @@ -3682,17 +3554,17 @@ export declare namespace ComAtprotoServerGetAccountInviteCodes { includeUsed?: boolean; } type Input = undefined; - interface Output { + interface Output extends TypedBase { codes: ComAtprotoServerDefs.InviteCode[]; } - interface Errors { + interface Errors extends TypedBase { DuplicateCreate: {}; } } /** Get a signed token on behalf of the requesting DID for the requested service. */ export declare namespace ComAtprotoServerGetServiceAuth { - interface Params { + interface Params extends TypedBase { /** The DID of the service that the token will be used to authenticate with */ aud: At.DID; /** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */ @@ -3701,19 +3573,19 @@ export declare namespace ComAtprotoServerGetServiceAuth { lxm?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { token: string; } - interface Errors { + interface Errors extends TypedBase { BadExpiration: {}; } } /** Get information about the current auth session. Requires auth. */ export declare namespace ComAtprotoServerGetSession { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { did: At.DID; handle: At.Handle; active?: boolean; @@ -3728,16 +3600,15 @@ export declare namespace ComAtprotoServerGetSession { /** List all App Passwords. */ export declare namespace ComAtprotoServerListAppPasswords { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { passwords: AppPassword[]; } - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; } - interface AppPassword { - [Brand.Type]: "com.atproto.server.listAppPasswords#appPassword"; + interface AppPassword extends TypedBase { createdAt: string; name: string; privileged?: boolean; @@ -3746,9 +3617,9 @@ export declare namespace ComAtprotoServerListAppPasswords { /** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */ export declare namespace ComAtprotoServerRefreshSession { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { accessJwt: string; did: At.DID; handle: At.Handle; @@ -3758,38 +3629,38 @@ export declare namespace ComAtprotoServerRefreshSession { /** Hosting status of the account. If not specified, then assume 'active'. */ status?: "deactivated" | "suspended" | "takendown" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; } } /** Initiate a user account deletion via email. */ export declare namespace ComAtprotoServerRequestAccountDelete { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Request an email with a code to confirm ownership of email. */ export declare namespace ComAtprotoServerRequestEmailConfirmation { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Request a token in order to update email. */ export declare namespace ComAtprotoServerRequestEmailUpdate { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { tokenRequired: boolean; } } /** Initiate a user account password reset via email. */ export declare namespace ComAtprotoServerRequestPasswordReset { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { email: string; } type Output = undefined; @@ -3797,12 +3668,12 @@ export declare namespace ComAtprotoServerRequestPasswordReset { /** Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. */ export declare namespace ComAtprotoServerReserveSigningKey { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The DID to reserve a key for. */ did?: At.DID; } - interface Output { + interface Output extends TypedBase { /** The public key for the reserved signing key, in did:key serialization. */ signingKey: string; } @@ -3810,13 +3681,13 @@ export declare namespace ComAtprotoServerReserveSigningKey { /** Reset a user account password using a token. */ export declare namespace ComAtprotoServerResetPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { password: string; token: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { ExpiredToken: {}; InvalidToken: {}; } @@ -3824,8 +3695,8 @@ export declare namespace ComAtprotoServerResetPassword { /** Revoke an App Password by name. */ export declare namespace ComAtprotoServerRevokeAppPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { name: string; } type Output = undefined; @@ -3833,15 +3704,15 @@ export declare namespace ComAtprotoServerRevokeAppPassword { /** Update an account's email. */ export declare namespace ComAtprotoServerUpdateEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { email: string; emailAuthFactor?: boolean; /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */ token?: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { ExpiredToken: {}; InvalidToken: {}; TokenRequired: {}; @@ -3850,7 +3721,7 @@ export declare namespace ComAtprotoServerUpdateEmail { /** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncGetBlob { - interface Params { + interface Params extends TypedBase { /** The CID of the blob to fetch */ cid: At.CID; /** The DID of the account. */ @@ -3858,7 +3729,7 @@ export declare namespace ComAtprotoSyncGetBlob { } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { BlobNotFound: {}; RepoNotFound: {}; RepoTakendown: {}; @@ -3869,14 +3740,14 @@ export declare namespace ComAtprotoSyncGetBlob { /** Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncGetBlocks { - interface Params { + interface Params extends TypedBase { cids: At.CID[]; /** The DID of the repo. */ did: At.DID; } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { BlockNotFound: {}; RepoNotFound: {}; RepoTakendown: {}; @@ -3890,7 +3761,7 @@ export declare namespace ComAtprotoSyncGetBlocks { * \@deprecated */ export declare namespace ComAtprotoSyncGetCheckout { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } @@ -3903,31 +3774,31 @@ export declare namespace ComAtprotoSyncGetCheckout { * \@deprecated */ export declare namespace ComAtprotoSyncGetHead { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { root: At.CID; } - interface Errors { + interface Errors extends TypedBase { HeadNotFound: {}; } } /** Get the current commit CID & revision of the specified repo. Does not require auth. */ export declare namespace ComAtprotoSyncGetLatestCommit { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { cid: At.CID; rev: string; } - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; RepoTakendown: {}; RepoSuspended: {}; @@ -3937,7 +3808,7 @@ export declare namespace ComAtprotoSyncGetLatestCommit { /** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */ export declare namespace ComAtprotoSyncGetRecord { - interface Params { + interface Params extends TypedBase { collection: string; /** The DID of the repo. */ did: At.DID; @@ -3951,7 +3822,7 @@ export declare namespace ComAtprotoSyncGetRecord { } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { RecordNotFound: {}; RepoNotFound: {}; RepoTakendown: {}; @@ -3962,7 +3833,7 @@ export declare namespace ComAtprotoSyncGetRecord { /** Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncGetRepo { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; /** The revision ('rev') of the repo to create a diff from. */ @@ -3970,7 +3841,7 @@ export declare namespace ComAtprotoSyncGetRepo { } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; RepoTakendown: {}; RepoSuspended: {}; @@ -3980,12 +3851,12 @@ export declare namespace ComAtprotoSyncGetRepo { /** Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. */ export declare namespace ComAtprotoSyncGetRepoStatus { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { active: boolean; did: At.DID; /** Optional field, the current rev of the repo, if active=true */ @@ -3993,14 +3864,14 @@ export declare namespace ComAtprotoSyncGetRepoStatus { /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ status?: "deactivated" | "suspended" | "takendown" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; } } /** List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncListBlobs { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; cursor?: string; @@ -4014,11 +3885,11 @@ export declare namespace ComAtprotoSyncListBlobs { since?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { cids: At.CID[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; RepoTakendown: {}; RepoSuspended: {}; @@ -4028,7 +3899,7 @@ export declare namespace ComAtprotoSyncListBlobs { /** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */ export declare namespace ComAtprotoSyncListRepos { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -4038,12 +3909,11 @@ export declare namespace ComAtprotoSyncListRepos { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { repos: Repo[]; cursor?: string; } - interface Repo { - [Brand.Type]: "com.atproto.sync.listRepos#repo"; + interface Repo extends TypedBase { did: At.DID; /** Current repo commit CID */ head: At.CID; @@ -4056,8 +3926,8 @@ export declare namespace ComAtprotoSyncListRepos { /** Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. */ export declare namespace ComAtprotoSyncNotifyOfUpdate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Hostname of the current service (usually a PDS) that is notifying of update. */ hostname: string; } @@ -4066,8 +3936,8 @@ export declare namespace ComAtprotoSyncNotifyOfUpdate { /** Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. */ export declare namespace ComAtprotoSyncRequestCrawl { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Hostname of the current service (eg, PDS) that is requesting to be crawled. */ hostname: string; } @@ -4075,20 +3945,19 @@ export declare namespace ComAtprotoSyncRequestCrawl { } export declare namespace ComAtprotoSyncSubscribeRepos { - interface Params { + interface Params extends TypedBase { /** The last known event seq number to backfill from. */ cursor?: number; } - type Message = Brand.Union< + type Message = TypeUnion< Account | Commit | Handle | Identity | Info | Migrate | Tombstone >; - interface Errors { + interface Errors extends TypedBase { FutureCursor: {}; ConsumerTooSlow: {}; } /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ - interface Account { - [Brand.Type]: "com.atproto.sync.subscribeRepos#account"; + interface Account extends TypedBase { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; did: At.DID; @@ -4103,8 +3972,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { | (string & {}); } /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ - interface Commit { - [Brand.Type]: "com.atproto.sync.subscribeRepos#commit"; + interface Commit extends TypedBase { /** List of new blobs (by CID) referenced by records in this commit. */ blobs: At.CIDLink[]; /** CAR file containing relevant blocks, as a diff since the previous repo state. */ @@ -4143,24 +4011,21 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * DEPRECATED -- Use #identity event instead * \@deprecated */ - interface Handle { - [Brand.Type]: "com.atproto.sync.subscribeRepos#handle"; + interface Handle extends TypedBase { did: At.DID; handle: At.Handle; seq: number; time: string; } /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ - interface Identity { - [Brand.Type]: "com.atproto.sync.subscribeRepos#identity"; + interface Identity extends TypedBase { did: At.DID; seq: number; time: string; /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ handle?: At.Handle; } - interface Info { - [Brand.Type]: "com.atproto.sync.subscribeRepos#info"; + interface Info extends TypedBase { name: "OutdatedCursor" | (string & {}); message?: string; } @@ -4168,16 +4033,14 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * DEPRECATED -- Use #account event instead * \@deprecated */ - interface Migrate { - [Brand.Type]: "com.atproto.sync.subscribeRepos#migrate"; + interface Migrate extends TypedBase { did: At.DID; migrateTo: string | null; seq: number; time: string; } /** A repo operation, ie a mutation of a single record. */ - interface RepoOp { - [Brand.Type]: "com.atproto.sync.subscribeRepos#repoOp"; + interface RepoOp extends TypedBase { action: "create" | "delete" | "update" | (string & {}); /** For creates and updates, the new record CID. For deletions, null. */ cid: At.CIDLink | null; @@ -4187,8 +4050,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * DEPRECATED -- Use #account event instead * \@deprecated */ - interface Tombstone { - [Brand.Type]: "com.atproto.sync.subscribeRepos#tombstone"; + interface Tombstone extends TypedBase { did: At.DID; seq: number; time: string; @@ -4197,18 +4059,18 @@ export declare namespace ComAtprotoSyncSubscribeRepos { /** Add a handle to the set of reserved handles. */ export declare namespace ComAtprotoTempAddReservedHandle { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { handle: string; } - interface Output {} + interface Output extends TypedBase {} } /** Check accounts location in signup queue. */ export declare namespace ComAtprotoTempCheckSignupQueue { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { activated: boolean; estimatedTimeMs?: number; placeInQueue?: number; @@ -4220,7 +4082,7 @@ export declare namespace ComAtprotoTempCheckSignupQueue { * \@deprecated */ export declare namespace ComAtprotoTempFetchLabels { - interface Params { + interface Params extends TypedBase { /** * Minimum: 1 * Maximum: 250 @@ -4230,15 +4092,15 @@ export declare namespace ComAtprotoTempFetchLabels { since?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { labels: ComAtprotoLabelDefs.Label[]; } } /** Request a verification code to be sent to the supplied phone number */ export declare namespace ComAtprotoTempRequestPhoneVerification { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { phoneNumber: string; } type Output = undefined; @@ -4246,8 +4108,8 @@ export declare namespace ComAtprotoTempRequestPhoneVerification { /** Administrative action to create a new, re-usable communication (email for now) template. */ export declare namespace ToolsOzoneCommunicationCreateTemplate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Content of the template, markdown supported, can contain variable placeholders. */ contentMarkdown: string; /** Name of the template. */ @@ -4260,14 +4122,13 @@ export declare namespace ToolsOzoneCommunicationCreateTemplate { lang?: string; } type Output = ToolsOzoneCommunicationDefs.TemplateView; - interface Errors { + interface Errors extends TypedBase { DuplicateTemplateName: {}; } } export declare namespace ToolsOzoneCommunicationDefs { - interface TemplateView { - [Brand.Type]: "tools.ozone.communication.defs#templateView"; + interface TemplateView extends TypedBase { /** Subject of the message, used in emails. */ contentMarkdown: string; createdAt: string; @@ -4287,8 +4148,8 @@ export declare namespace ToolsOzoneCommunicationDefs { /** Delete a communication template. */ export declare namespace ToolsOzoneCommunicationDeleteTemplate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { id: string; } type Output = undefined; @@ -4296,17 +4157,17 @@ export declare namespace ToolsOzoneCommunicationDeleteTemplate { /** Get list of all communication templates. */ export declare namespace ToolsOzoneCommunicationListTemplates { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { communicationTemplates: ToolsOzoneCommunicationDefs.TemplateView[]; } } /** Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. */ export declare namespace ToolsOzoneCommunicationUpdateTemplate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** ID of the template to be updated. */ id: string; /** Content of the template, markdown supported, can contain variable placeholders. */ @@ -4322,15 +4183,14 @@ export declare namespace ToolsOzoneCommunicationUpdateTemplate { updatedBy?: At.DID; } type Output = ToolsOzoneCommunicationDefs.TemplateView; - interface Errors { + interface Errors extends TypedBase { DuplicateTemplateName: {}; } } export declare namespace ToolsOzoneModerationDefs { /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface AccountEvent { - [Brand.Type]: "tools.ozone.moderation.defs#accountEvent"; + interface AccountEvent extends TypedBase { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; timestamp: string; @@ -4344,8 +4204,7 @@ export declare namespace ToolsOzoneModerationDefs { | "unknown" | (string & {}); } - interface AccountHosting { - [Brand.Type]: "tools.ozone.moderation.defs#accountHosting"; + interface AccountHosting extends TypedBase { status: | "deactivated" | "deleted" @@ -4359,56 +4218,47 @@ export declare namespace ToolsOzoneModerationDefs { reactivatedAt?: string; updatedAt?: string; } - interface BlobView { - [Brand.Type]: "tools.ozone.moderation.defs#blobView"; + interface BlobView extends TypedBase { cid: At.CID; createdAt: string; mimeType: string; size: number; - details?: Brand.Union; + details?: TypeUnion; moderation?: Moderation; } /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface IdentityEvent { - [Brand.Type]: "tools.ozone.moderation.defs#identityEvent"; + interface IdentityEvent extends TypedBase { timestamp: string; comment?: string; handle?: At.Handle; pdsHost?: string; tombstone?: boolean; } - interface ImageDetails { - [Brand.Type]: "tools.ozone.moderation.defs#imageDetails"; + interface ImageDetails extends TypedBase { height: number; width: number; } - interface Moderation { - [Brand.Type]: "tools.ozone.moderation.defs#moderation"; + interface Moderation extends TypedBase { subjectStatus?: SubjectStatusView; } - interface ModerationDetail { - [Brand.Type]: "tools.ozone.moderation.defs#moderationDetail"; + interface ModerationDetail extends TypedBase { subjectStatus?: SubjectStatusView; } - interface ModEventAcknowledge { - [Brand.Type]: "tools.ozone.moderation.defs#modEventAcknowledge"; + interface ModEventAcknowledge extends TypedBase { comment?: string; } /** Add a comment to a subject */ - interface ModEventComment { - [Brand.Type]: "tools.ozone.moderation.defs#modEventComment"; + interface ModEventComment extends TypedBase { comment: string; /** Make the comment persistent on the subject */ sticky?: boolean; } /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ - interface ModEventDivert { - [Brand.Type]: "tools.ozone.moderation.defs#modEventDivert"; + interface ModEventDivert extends TypedBase { comment?: string; } /** Keep a log of outgoing email to a user */ - interface ModEventEmail { - [Brand.Type]: "tools.ozone.moderation.defs#modEventEmail"; + interface ModEventEmail extends TypedBase { /** The subject line of the email sent to the user. */ subjectLine: string; /** Additional comment about the outgoing comm. */ @@ -4416,54 +4266,46 @@ export declare namespace ToolsOzoneModerationDefs { /** The content of the email sent to the user. */ content?: string; } - interface ModEventEscalate { - [Brand.Type]: "tools.ozone.moderation.defs#modEventEscalate"; + interface ModEventEscalate extends TypedBase { comment?: string; } /** Apply/Negate labels on a subject */ - interface ModEventLabel { - [Brand.Type]: "tools.ozone.moderation.defs#modEventLabel"; + interface ModEventLabel extends TypedBase { createLabelVals: string[]; negateLabelVals: string[]; comment?: string; } /** Mute incoming reports on a subject */ - interface ModEventMute { - [Brand.Type]: "tools.ozone.moderation.defs#modEventMute"; + interface ModEventMute extends TypedBase { /** Indicates how long the subject should remain muted. */ durationInHours: number; comment?: string; } /** Mute incoming reports from an account */ - interface ModEventMuteReporter { - [Brand.Type]: "tools.ozone.moderation.defs#modEventMuteReporter"; + interface ModEventMuteReporter extends TypedBase { comment?: string; /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ durationInHours?: number; } /** Report a subject */ - interface ModEventReport { - [Brand.Type]: "tools.ozone.moderation.defs#modEventReport"; + interface ModEventReport extends TypedBase { reportType: ComAtprotoModerationDefs.ReasonType; comment?: string; /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ isReporterMuted?: boolean; } /** Resolve appeal on a subject */ - interface ModEventResolveAppeal { - [Brand.Type]: "tools.ozone.moderation.defs#modEventResolveAppeal"; + interface ModEventResolveAppeal extends TypedBase { /** Describe resolution. */ comment?: string; } /** Revert take down action on a subject */ - interface ModEventReverseTakedown { - [Brand.Type]: "tools.ozone.moderation.defs#modEventReverseTakedown"; + interface ModEventReverseTakedown extends TypedBase { /** Describe reasoning behind the reversal. */ comment?: string; } /** Add/Remove a tag on a subject */ - interface ModEventTag { - [Brand.Type]: "tools.ozone.moderation.defs#modEventTag"; + interface ModEventTag extends TypedBase { /** Tags to be added to the subject. If already exists, won't be duplicated. */ add: string[]; /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ @@ -4472,8 +4314,7 @@ export declare namespace ToolsOzoneModerationDefs { comment?: string; } /** Take down a subject permanently or temporarily */ - interface ModEventTakedown { - [Brand.Type]: "tools.ozone.moderation.defs#modEventTakedown"; + interface ModEventTakedown extends TypedBase { /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ acknowledgeAccountSubjects?: boolean; comment?: string; @@ -4481,22 +4322,19 @@ export declare namespace ToolsOzoneModerationDefs { durationInHours?: number; } /** Unmute action on a subject */ - interface ModEventUnmute { - [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmute"; + interface ModEventUnmute extends TypedBase { /** Describe reasoning behind the reversal. */ comment?: string; } /** Unmute incoming reports from an account */ - interface ModEventUnmuteReporter { - [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmuteReporter"; + interface ModEventUnmuteReporter extends TypedBase { /** Describe reasoning behind the reversal. */ comment?: string; } - interface ModEventView { - [Brand.Type]: "tools.ozone.moderation.defs#modEventView"; + interface ModEventView extends TypedBase { createdAt: string; createdBy: At.DID; - event: Brand.Union< + event: TypeUnion< | AccountEvent | IdentityEvent | ModEventAcknowledge @@ -4517,7 +4355,7 @@ export declare namespace ToolsOzoneModerationDefs { | RecordEvent >; id: number; - subject: Brand.Union< + subject: TypeUnion< | ChatBskyConvoDefs.MessageRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -4526,11 +4364,10 @@ export declare namespace ToolsOzoneModerationDefs { creatorHandle?: string; subjectHandle?: string; } - interface ModEventViewDetail { - [Brand.Type]: "tools.ozone.moderation.defs#modEventViewDetail"; + interface ModEventViewDetail extends TypedBase { createdAt: string; createdBy: At.DID; - event: Brand.Union< + event: TypeUnion< | AccountEvent | IdentityEvent | ModEventAcknowledge @@ -4551,28 +4388,25 @@ export declare namespace ToolsOzoneModerationDefs { | RecordEvent >; id: number; - subject: Brand.Union< + subject: TypeUnion< RecordView | RecordViewNotFound | RepoView | RepoViewNotFound >; subjectBlobs: BlobView[]; } /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface RecordEvent { - [Brand.Type]: "tools.ozone.moderation.defs#recordEvent"; + interface RecordEvent extends TypedBase { op: "create" | "delete" | "update" | (string & {}); timestamp: string; cid?: At.CID; comment?: string; } - interface RecordHosting { - [Brand.Type]: "tools.ozone.moderation.defs#recordHosting"; + interface RecordHosting extends TypedBase { status: "deleted" | "unknown" | (string & {}); createdAt?: string; deletedAt?: string; updatedAt?: string; } - interface RecordView { - [Brand.Type]: "tools.ozone.moderation.defs#recordView"; + interface RecordView extends TypedBase { blobCids: At.CID[]; cid: At.CID; indexedAt: string; @@ -4581,8 +4415,7 @@ export declare namespace ToolsOzoneModerationDefs { uri: At.Uri; value: unknown; } - interface RecordViewDetail { - [Brand.Type]: "tools.ozone.moderation.defs#recordViewDetail"; + interface RecordViewDetail extends TypedBase { blobs: BlobView[]; cid: At.CID; indexedAt: string; @@ -4592,12 +4425,10 @@ export declare namespace ToolsOzoneModerationDefs { value: unknown; labels?: ComAtprotoLabelDefs.Label[]; } - interface RecordViewNotFound { - [Brand.Type]: "tools.ozone.moderation.defs#recordViewNotFound"; + interface RecordViewNotFound extends TypedBase { uri: At.Uri; } - interface RepoView { - [Brand.Type]: "tools.ozone.moderation.defs#repoView"; + interface RepoView extends TypedBase { did: At.DID; handle: At.Handle; indexedAt: string; @@ -4610,8 +4441,7 @@ export declare namespace ToolsOzoneModerationDefs { invitesDisabled?: boolean; threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } - interface RepoViewDetail { - [Brand.Type]: "tools.ozone.moderation.defs#repoViewDetail"; + interface RepoViewDetail extends TypedBase { did: At.DID; handle: At.Handle; indexedAt: string; @@ -4627,8 +4457,7 @@ export declare namespace ToolsOzoneModerationDefs { labels?: ComAtprotoLabelDefs.Label[]; threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } - interface RepoViewNotFound { - [Brand.Type]: "tools.ozone.moderation.defs#repoViewNotFound"; + interface RepoViewNotFound extends TypedBase { did: At.DID; } type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; @@ -4641,13 +4470,12 @@ export declare namespace ToolsOzoneModerationDefs { | "#reviewNone" | "#reviewOpen" | (string & {}); - interface SubjectStatusView { - [Brand.Type]: "tools.ozone.moderation.defs#subjectStatusView"; + interface SubjectStatusView extends TypedBase { /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ createdAt: string; id: number; reviewState: SubjectReviewState; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; /** Timestamp referencing when the last update was made to the moderation status of the subject */ @@ -4656,7 +4484,7 @@ export declare namespace ToolsOzoneModerationDefs { appealed?: boolean; /** Sticky comment on the subject. */ comment?: string; - hosting?: Brand.Union; + hosting?: TypeUnion; /** Timestamp referencing when the author of the subject appealed a moderation action */ lastAppealedAt?: string; lastReportedAt?: string; @@ -4670,8 +4498,7 @@ export declare namespace ToolsOzoneModerationDefs { tags?: string[]; takendown?: boolean; } - interface VideoDetails { - [Brand.Type]: "tools.ozone.moderation.defs#videoDetails"; + interface VideoDetails extends TypedBase { height: number; length: number; width: number; @@ -4680,10 +4507,10 @@ export declare namespace ToolsOzoneModerationDefs { /** Take a moderation action on an actor. */ export declare namespace ToolsOzoneModerationEmitEvent { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { createdBy: At.DID; - event: Brand.Union< + event: TypeUnion< | ToolsOzoneModerationDefs.AccountEvent | ToolsOzoneModerationDefs.IdentityEvent | ToolsOzoneModerationDefs.ModEventAcknowledge @@ -4702,20 +4529,20 @@ export declare namespace ToolsOzoneModerationEmitEvent { | ToolsOzoneModerationDefs.ModEventUnmuteReporter | ToolsOzoneModerationDefs.RecordEvent >; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; subjectBlobCids?: At.CID[]; } type Output = ToolsOzoneModerationDefs.ModEventView; - interface Errors { + interface Errors extends TypedBase { SubjectHasAction: {}; } } /** Get details about a moderation event. */ export declare namespace ToolsOzoneModerationGetEvent { - interface Params { + interface Params extends TypedBase { id: number; } type Input = undefined; @@ -4724,26 +4551,26 @@ export declare namespace ToolsOzoneModerationGetEvent { /** Get details about a record. */ export declare namespace ToolsOzoneModerationGetRecord { - interface Params { + interface Params extends TypedBase { uri: At.Uri; cid?: At.CID; } type Input = undefined; type Output = ToolsOzoneModerationDefs.RecordViewDetail; - interface Errors { + interface Errors extends TypedBase { RecordNotFound: {}; } } /** Get details about some records. */ export declare namespace ToolsOzoneModerationGetRecords { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 100 */ uris: At.Uri[]; } type Input = undefined; - interface Output { - records: Brand.Union< + interface Output extends TypedBase { + records: TypeUnion< | ToolsOzoneModerationDefs.RecordViewDetail | ToolsOzoneModerationDefs.RecordViewNotFound >[]; @@ -4752,25 +4579,25 @@ export declare namespace ToolsOzoneModerationGetRecords { /** Get details about a repository. */ export declare namespace ToolsOzoneModerationGetRepo { - interface Params { + interface Params extends TypedBase { did: At.DID; } type Input = undefined; type Output = ToolsOzoneModerationDefs.RepoViewDetail; - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; } } /** Get details about some repositories. */ export declare namespace ToolsOzoneModerationGetRepos { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 100 */ dids: At.DID[]; } type Input = undefined; - interface Output { - repos: Brand.Union< + interface Output extends TypedBase { + repos: TypeUnion< | ToolsOzoneModerationDefs.RepoViewDetail | ToolsOzoneModerationDefs.RepoViewNotFound >[]; @@ -4779,7 +4606,7 @@ export declare namespace ToolsOzoneModerationGetRepos { /** List moderation events related to a subject. */ export declare namespace ToolsOzoneModerationQueryEvents { - interface Params { + interface Params extends TypedBase { /** If specified, only events where all of these labels were added are returned */ addedLabels?: string[]; /** If specified, only events where all of these tags were added are returned */ @@ -4827,7 +4654,7 @@ export declare namespace ToolsOzoneModerationQueryEvents { types?: string[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { events: ToolsOzoneModerationDefs.ModEventView[]; cursor?: string; } @@ -4835,7 +4662,7 @@ export declare namespace ToolsOzoneModerationQueryEvents { /** View moderation statuses of subjects (record or repo). */ export declare namespace ToolsOzoneModerationQueryStatuses { - interface Params { + interface Params extends TypedBase { /** Get subjects in unresolved appealed status */ appealed?: boolean; /** @@ -4895,7 +4722,7 @@ export declare namespace ToolsOzoneModerationQueryStatuses { takendown?: boolean; } type Input = undefined; - interface Output { + interface Output extends TypedBase { subjectStatuses: ToolsOzoneModerationDefs.SubjectStatusView[]; cursor?: string; } @@ -4903,7 +4730,7 @@ export declare namespace ToolsOzoneModerationQueryStatuses { /** Find repositories based on a search term. */ export declare namespace ToolsOzoneModerationSearchRepos { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -4919,7 +4746,7 @@ export declare namespace ToolsOzoneModerationSearchRepos { term?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { repos: ToolsOzoneModerationDefs.RepoView[]; cursor?: string; } @@ -4927,21 +4754,19 @@ export declare namespace ToolsOzoneModerationSearchRepos { /** Get details about ozone's server configuration. */ export declare namespace ToolsOzoneServerGetConfig { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { appview?: ServiceConfig; blobDivert?: ServiceConfig; chat?: ServiceConfig; pds?: ServiceConfig; viewer?: ViewerConfig; } - interface ServiceConfig { - [Brand.Type]: "tools.ozone.server.getConfig#serviceConfig"; + interface ServiceConfig extends TypedBase { url?: string; } - interface ViewerConfig { - [Brand.Type]: "tools.ozone.server.getConfig#viewerConfig"; + interface ViewerConfig extends TypedBase { role?: | "tools.ozone.team.defs#roleAdmin" | "tools.ozone.team.defs#roleModerator" @@ -4952,8 +4777,8 @@ export declare namespace ToolsOzoneServerGetConfig { /** Add values to a specific set. Attempting to add values to a set that does not exist will result in an error. */ export declare namespace ToolsOzoneSetAddValues { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Name of the set to add values to */ name: string; /** @@ -4967,8 +4792,7 @@ export declare namespace ToolsOzoneSetAddValues { } export declare namespace ToolsOzoneSetDefs { - interface Set { - [Brand.Type]: "tools.ozone.set.defs#set"; + interface Set extends TypedBase { /** * Minimum string length: 3 * Maximum string length: 128 @@ -4980,8 +4804,7 @@ export declare namespace ToolsOzoneSetDefs { */ description?: string; } - interface SetView { - [Brand.Type]: "tools.ozone.set.defs#setView"; + interface SetView extends TypedBase { createdAt: string; /** * Minimum string length: 3 @@ -5000,21 +4823,21 @@ export declare namespace ToolsOzoneSetDefs { /** Delete an entire set. Attempting to delete a set that does not exist will result in an error. */ export declare namespace ToolsOzoneSetDeleteSet { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Name of the set to delete */ name: string; } - interface Output {} - interface Errors { + interface Output extends TypedBase {} + interface Errors extends TypedBase { SetNotFound: {}; } } /** Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error */ export declare namespace ToolsOzoneSetDeleteValues { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Name of the set to delete values from */ name: string; /** @@ -5024,14 +4847,14 @@ export declare namespace ToolsOzoneSetDeleteValues { values: string[]; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { SetNotFound: {}; } } /** Get a specific set and its values */ export declare namespace ToolsOzoneSetGetValues { - interface Params { + interface Params extends TypedBase { name: string; cursor?: string; /** @@ -5042,19 +4865,19 @@ export declare namespace ToolsOzoneSetGetValues { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { set: ToolsOzoneSetDefs.SetView; values: string[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { SetNotFound: {}; } } /** Query available sets */ export declare namespace ToolsOzoneSetQuerySets { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -5072,7 +4895,7 @@ export declare namespace ToolsOzoneSetQuerySets { sortDirection?: "asc" | "desc"; } type Input = undefined; - interface Output { + interface Output extends TypedBase { sets: ToolsOzoneSetDefs.SetView[]; cursor?: string; } @@ -5080,14 +4903,13 @@ export declare namespace ToolsOzoneSetQuerySets { /** Create or update set metadata */ export declare namespace ToolsOzoneSetUpsertSet { - interface Params {} + interface Params extends TypedBase {} type Input = ToolsOzoneSetDefs.Set; type Output = ToolsOzoneSetDefs.SetView; } export declare namespace ToolsOzoneSettingDefs { - interface Option { - [Brand.Type]: "tools.ozone.setting.defs#option"; + interface Option extends TypedBase { createdBy: At.DID; did: At.DID; key: string; @@ -5111,7 +4933,7 @@ export declare namespace ToolsOzoneSettingDefs { /** List settings with optional filtering */ export declare namespace ToolsOzoneSettingListOptions { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Filter for only the specified keys. Ignored if prefix is provided @@ -5130,7 +4952,7 @@ export declare namespace ToolsOzoneSettingListOptions { scope?: "instance" | "personal" | (string & {}); } type Input = undefined; - interface Output { + interface Output extends TypedBase { options: ToolsOzoneSettingDefs.Option[]; cursor?: string; } @@ -5138,8 +4960,8 @@ export declare namespace ToolsOzoneSettingListOptions { /** Delete settings by key */ export declare namespace ToolsOzoneSettingRemoveOptions { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** * Minimum array length: 1 * Maximum array length: 200 @@ -5147,13 +4969,13 @@ export declare namespace ToolsOzoneSettingRemoveOptions { keys: string[]; scope: "instance" | "personal" | (string & {}); } - interface Output {} + interface Output extends TypedBase {} } /** Create or update setting option */ export declare namespace ToolsOzoneSettingUpsertOption { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { key: string; scope: "instance" | "personal" | (string & {}); value: unknown; @@ -5165,14 +4987,13 @@ export declare namespace ToolsOzoneSettingUpsertOption { | "tools.ozone.team.defs#roleTriage" | (string & {}); } - interface Output { + interface Output extends TypedBase { option: ToolsOzoneSettingDefs.Option; } } export declare namespace ToolsOzoneSignatureDefs { - interface SigDetail { - [Brand.Type]: "tools.ozone.signature.defs#sigDetail"; + interface SigDetail extends TypedBase { property: string; value: string; } @@ -5180,18 +5001,18 @@ export declare namespace ToolsOzoneSignatureDefs { /** Find all correlated threat signatures between 2 or more accounts. */ export declare namespace ToolsOzoneSignatureFindCorrelation { - interface Params { + interface Params extends TypedBase { dids: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { details: ToolsOzoneSignatureDefs.SigDetail[]; } } /** Get accounts that share some matching threat signatures with the root account. */ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { - interface Params { + interface Params extends TypedBase { did: At.DID; cursor?: string; /** @@ -5202,12 +5023,11 @@ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { accounts: RelatedAccount[]; cursor?: string; } - interface RelatedAccount { - [Brand.Type]: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; + interface RelatedAccount extends TypedBase { account: ComAtprotoAdminDefs.AccountView; similarities?: ToolsOzoneSignatureDefs.SigDetail[]; } @@ -5215,7 +5035,7 @@ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { /** Search for accounts that match one or more threat signature values. */ export declare namespace ToolsOzoneSignatureSearchAccounts { - interface Params { + interface Params extends TypedBase { values: string[]; cursor?: string; /** @@ -5226,7 +5046,7 @@ export declare namespace ToolsOzoneSignatureSearchAccounts { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { accounts: ComAtprotoAdminDefs.AccountView[]; cursor?: string; } @@ -5234,8 +5054,8 @@ export declare namespace ToolsOzoneSignatureSearchAccounts { /** Add a member to the ozone team. Requires admin role. */ export declare namespace ToolsOzoneTeamAddMember { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; role: | "tools.ozone.team.defs#roleAdmin" @@ -5244,14 +5064,13 @@ export declare namespace ToolsOzoneTeamAddMember { | (string & {}); } type Output = ToolsOzoneTeamDefs.Member; - interface Errors { + interface Errors extends TypedBase { MemberAlreadyExists: {}; } } export declare namespace ToolsOzoneTeamDefs { - interface Member { - [Brand.Type]: "tools.ozone.team.defs#member"; + interface Member extends TypedBase { did: At.DID; role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); createdAt?: string; @@ -5267,12 +5086,12 @@ export declare namespace ToolsOzoneTeamDefs { /** Delete a member from ozone team. Requires admin role. */ export declare namespace ToolsOzoneTeamDeleteMember { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { MemberNotFound: {}; CannotDeleteSelf: {}; } @@ -5280,7 +5099,7 @@ export declare namespace ToolsOzoneTeamDeleteMember { /** List all members with access to the ozone service. */ export declare namespace ToolsOzoneTeamListMembers { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -5290,7 +5109,7 @@ export declare namespace ToolsOzoneTeamListMembers { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { members: ToolsOzoneTeamDefs.Member[]; cursor?: string; } @@ -5298,8 +5117,8 @@ export declare namespace ToolsOzoneTeamListMembers { /** Update a member in the ozone service. Requires admin role. */ export declare namespace ToolsOzoneTeamUpdateMember { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; disabled?: boolean; role?: @@ -5309,12 +5128,12 @@ export declare namespace ToolsOzoneTeamUpdateMember { | (string & {}); } type Output = ToolsOzoneTeamDefs.Member; - interface Errors { + interface Errors extends TypedBase { MemberNotFound: {}; } } -export declare interface Records { +export declare interface Records extends RecordBase { "app.bsky.actor.profile": AppBskyActorProfile.Record; "app.bsky.feed.generator": AppBskyFeedGenerator.Record; "app.bsky.feed.like": AppBskyFeedLike.Record; From 058c8edae086de225e29266d38f42faf67ff44f5 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 20:52:20 -0500 Subject: [PATCH 38/68] adding metadata to output lexicons file for ci --- packages/lex-cli/src/generator/index.ts | 41 +++++++++++++++++---- packages/lex-cli/src/index.ts | 6 +++ packages/lexicons/scripts/generate-types.ts | 12 +++++- packages/lexicons/src/lib/lexicons.ts | 4 ++ 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index d470c98..5c8b1e2 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -8,28 +8,53 @@ export interface GenerateDefinitionsOptions { banner?: string; description?: string; debug?: boolean; + lexiconMetadata?: { + commitSha?: string; + version?: string; + sourceUrl?: string; + }; onProgress?: (filename: string, index: number, total: number) => void; } export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, banner, description } = opts; + const { files, banner, description, lexiconMetadata } = opts; let queries = ''; let procedures = ''; let records = ''; let subscriptions = ''; + const buildDate = new Date().toISOString(); + const metadataLines = [ + '/**', + ' * @module', + description ? ` * ${description}` : ' * ATProto lexicon type definitions', + ' * @generated', + ` * Generated on: ${buildDate}`, + ]; + + if (lexiconMetadata?.version) { + metadataLines.push(` * Version: ${lexiconMetadata.version}`); + } + if (lexiconMetadata?.commitSha) { + metadataLines.push(` * Commit: ${lexiconMetadata.commitSha}`); + } + if (lexiconMetadata?.sourceUrl) { + metadataLines.push(` * Source: ${lexiconMetadata.sourceUrl}`); + } + + metadataLines.push(' */'); + let code = `/* eslint-disable */ -// This file is automatically generated by @tsky/lex-cli, do not edit!`; +// This file is automatically generated by @tsky/lex-cli, do not edit! + +${metadataLines.join('\n')}`; - if (description) { - code += `\n\n/** - * @module - * ${description} - */`; + if (banner) { + code += `\n\n${banner}`; } - code += `\n\n${banner ?? ''}\n${mainPrelude}`; + code += `\n\n${mainPrelude}`; for await (const filename of files.sort(sortName)) { let document: DocumentSchema; diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index d38c79d..02c5caa 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -46,6 +46,11 @@ cli.register( description: 'Custom banner text to insert at the top of the generated file', }); + metadata = Option.String('--metadata', { + required: false, + description: 'JSON metadata to add to the generated file header', + }); + files = Option.Rest({ required: 1, name: 'files', @@ -59,6 +64,7 @@ cli.register( files: this.files, banner: this.banner, description: this.desc, + lexiconMetadata: this.metadata ? JSON.parse(this.metadata) : undefined, }); } catch (err) { diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index e970581..e3c5a3e 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -26,6 +26,8 @@ async function downloadLexicons() { const commits = await shaResponse.json(); const sha = commits[0]?.sha; + const version = commits[0]?.commit?.message?.match(/Release v([\d.]+)/)?.[1] || 'main'; + if (!sha) { throw new Error('No commits found for lexicons'); } @@ -49,6 +51,12 @@ async function downloadLexicons() { }); await fs.unlink(tarFile); + + return { + sha, + version, + sourceUrl: `https://github.com/${REPO}/tree/${sha}/lexicons`, + }; } async function main() { @@ -56,7 +64,7 @@ async function main() { await fs.mkdir(LEXICONS_DIR, { recursive: true }); await fs.mkdir(path.dirname(TYPES_OUTPUT_PATH), { recursive: true }); - await downloadLexicons(); + const metadata = await downloadLexicons(); const globPatterns = [ 'app/bsky/**/*.json', @@ -89,6 +97,8 @@ async function main() { TYPES_OUTPUT_PATH, '--description', '"Contains type declarations for Bluesky lexicons"', + '--metadata', + JSON.stringify(JSON.stringify(metadata)), ].join(' '); console.log('Running lex-cli to generate types...'); diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 36a5616..aec0716 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -4,6 +4,10 @@ /** * @module * Contains type declarations for Bluesky lexicons + * @generated + * Generated on: 2024-12-04T01:51:07.265Z + * Version: main + * Source: https://github.com/bluesky-social/atproto/tree/c72145dbeb2d67068bc28c00a13447e0d382d121/lexicons */ /** Base type with optional type field */ From 2b10ecc778151831b1f3cc90947c9257f4a92b03 Mon Sep 17 00:00:00 2001 From: patak <583075+patak-dev@users.noreply.github.com> Date: Mon, 2 Dec 2024 06:51:04 +0100 Subject: [PATCH 39/68] chore: set casing for tsky, Tsky, Bluesky (#24) --- README.md | 14 +++++++------- docs/.vitepress/config.mts | 4 ++-- docs/index.md | 6 +++--- packages/core/src/tsky/tsky.ts | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ec4cdc7..9af7adc 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@

-

TSky

+

tsky

A lightweight, fast, universal and typed Bluesky API wrapper for Apps & Bots.

-## ⚠️ TSky is still in development and is not ready for production use. +## ⚠️ tsky is still in development and is not ready for production use. -TSksy is still in active development and is not ready for production use. If you want to contribute to the project, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file or join our [Discord Server](https://discord.gg/KPD7XPUZn3). +tsky is still in active development and is not ready for production use. If you want to contribute to the project, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file or join our [Discord Server](https://discord.gg/KPD7XPUZn3). -TSky is a lightweight, fast, universal and typed Bluesky API wrapper for Apps & Bots. It's designed to be easy to use, lightweight and straightforward to use. It's built with TypeScript and has full type support. +tsky is a lightweight, fast, universal and typed Bluesky API wrapper for Apps & Bots. It's designed to be easy to use, lightweight and straightforward to use. It's built with TypeScript and has full type support. It was primarily built for the [Nimbus Client](https://github.com/nimbus-town/nimbus) but can be used in any other project that requires Bluesky API integration. @@ -48,9 +48,9 @@ console.log(profile.handle); ## Links -- [📚 TSky Documentation](https://tsky.dev/) -- [🦋 TSky on Bluesky](https://bsky.app/profile/tsky.dev) -- [📣 TSky Discord Server](https://discord.gg/KPD7XPUZn3) +- [📚 tsky Documentation](https://tsky.dev/) +- [🦋 tsky on Bluesky](https://bsky.app/profile/tsky.dev) +- [📣 tsky Discord Server](https://discord.gg/KPD7XPUZn3) - [🦋 Nimbus on Bluesky](https://bsky.app/profile/nimbus.town) ## Contributing diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index d6a0c92..6606822 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -2,8 +2,8 @@ import { defineConfig } from 'vitepress'; // https://vitepress.dev/reference/site-config export default defineConfig({ - title: 'TSky', - description: 'A BlueSky API client for nimble apps and tools', + title: 'tsky', + description: 'A Bluesky API client for nimble apps and tools', themeConfig: { nav: [ { text: 'Home', link: '/' }, diff --git a/docs/index.md b/docs/index.md index bcbaa07..8d11a40 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,9 +3,9 @@ layout: home hero: - name: "TSky" - text: "A BlueSky API client for nimble apps and tools" - tagline: A BlueSky API client for nimble apps and tools + name: "tsky" + text: "A Bluesky API client for nimble apps and tools" + tagline: A Bluesky API client for nimble apps and tools actions: - theme: brand text: Get Started diff --git a/packages/core/src/tsky/tsky.ts b/packages/core/src/tsky/tsky.ts index 5c7fbb6..629ee01 100644 --- a/packages/core/src/tsky/tsky.ts +++ b/packages/core/src/tsky/tsky.ts @@ -8,7 +8,7 @@ import type { } from '@atproto/api'; import { Paginator } from './paginator'; -export class TSky { +export class Tsky { constructor(private instance: AppBskyNS) {} /** From 889e16dd51585426bdf7ffdd2dfb2603354c4908 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 02:40:54 -0500 Subject: [PATCH 40/68] refactor: migrate to scoped package structure (@tsky/*) (#25) --- docs/package.json | 2 +- package.json | 11 ++++++----- packages/core/package.json | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/package.json b/docs/package.json index 849b458..4f56f44 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,5 +1,5 @@ { - "name": "tsky-docs", + "name": "@tsky/docs", "version": "1.0.0", "private": true, "main": "index.js", diff --git a/package.json b/package.json index b322555..aa86578 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { - "name": "tsky-workspace", + "name": "tsky", "type": "module", "version": "0.1.0", + "private": true, "packageManager": "pnpm@9.14.2", "license": "MIT", "homepage": "https://tsky.dev/", @@ -10,10 +11,10 @@ "url": "git+https://github.com/tsky-dev/tsky.git" }, "scripts": { - "build": "pnpm run --filter tsky build", - "docs:dev": "pnpm run --filter tsky-docs dev", - "docs:build": "pnpm run --filter tsky-docs build", - "docs:preview": "pnpm run --filter tsky-docs preview", + "build": "pnpm run --filter @tsky/core build", + "docs:dev": "pnpm run --filter @tsky/docs dev", + "docs:build": "pnpm run --filter @tsky/docs build", + "docs:preview": "pnpm run --filter @tsky/docs preview", "format": "biome check --write .", "format:check": "biome check", "lint": "eslint ./packages ./docs", diff --git a/packages/core/package.json b/packages/core/package.json index 1699900..24c4dc3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,8 +1,11 @@ { - "name": "tsky", + "name": "@tsky/core", "type": "module", "version": "0.0.1", "license": "MIT", + "publishConfig": { + "access": "public" + }, "exports": { ".": { "import": { From f57d7b5626923059eb266b7958cabc8ceb1500bd Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 14:28:13 -0500 Subject: [PATCH 41/68] Update packages/lexicons/package.json Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com> --- packages/lexicons/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 0cd532b..01bc3c0 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -5,6 +5,9 @@ "publishConfig": { "access": "public" }, + "scripts": { + "build": "tsx ./scripts/generate-types.ts" + }, "dependencies": { "@atproto/lexicon": "^0.4.3", "@atproto/xrpc": "^0.6.4", From 611e72e571af30209b340632cd93ae80d9fb5783 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Mon, 2 Dec 2024 14:30:47 -0500 Subject: [PATCH 42/68] adding generated files --- packages/lexicons/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexicons/tsconfig.json b/packages/lexicons/tsconfig.json index b25195c..53d5d52 100644 --- a/packages/lexicons/tsconfig.json +++ b/packages/lexicons/tsconfig.json @@ -9,6 +9,6 @@ "forceConsistentCasingInFileNames": true, "skipLibCheck": true }, - "include": ["scripts/**/*"], + "include": ["scripts/**/*", "src/**/*"], "exclude": ["node_modules"] } From c991847c30de777addbe095b7df46819e50e74e2 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:03:29 -0500 Subject: [PATCH 43/68] ignoring generated files for now --- eslint.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index 3f35c56..6e95d1a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import antfu from '@antfu/eslint-config'; export default antfu( { + ignores: ['packages/lexicons/**/*'], typescript: true, stylistic: { semi: true, From 2c04cd52612dcc43166a8269765d7a3f3f8d7259 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:09:30 -0500 Subject: [PATCH 44/68] init @tsky/lex-cli --- packages/lex-cli/package.json | 20 ++++++++++++++++++++ packages/lex-cli/tsconfig.json | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 packages/lex-cli/package.json create mode 100644 packages/lex-cli/tsconfig.json diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json new file mode 100644 index 0000000..e81e9e9 --- /dev/null +++ b/packages/lex-cli/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tsky/lex-cli", + "type": "module", + "version": "0.0.1", + "license": "MIT", + "bin": "dist/index.js", + "scripts": { + "build": "tsc" + }, + "dependencies": { + "clipanion": "4.0.0-rc.4", + "picocolors": "^1.1.1", + "prettier": "^3.3.3", + "typanion": "^3.14.0" + }, + "devDependencies": { + "@types/node": "^22.8.1", + "typescript": "^5.7.2" + } +} diff --git a/packages/lex-cli/tsconfig.json b/packages/lex-cli/tsconfig.json new file mode 100644 index 0000000..17f73ee --- /dev/null +++ b/packages/lex-cli/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ESNext", + "rootDir": "src", + "module": "NodeNext", + "strict": true, + "declaration": true, + "outDir": "dist", + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} From 221263c5d0c38c8811390a645e3d155b02eebe9a Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:10:40 -0500 Subject: [PATCH 45/68] adding entry point --- packages/lex-cli/src/index.ts | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 packages/lex-cli/src/index.ts diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts new file mode 100644 index 0000000..69020a3 --- /dev/null +++ b/packages/lex-cli/src/index.ts @@ -0,0 +1,96 @@ +import { writeFile } from 'node:fs/promises'; +import process from 'node:process'; +import { Builtins, Command, Option, Cli } from 'clipanion'; +import pc from 'picocolors'; +import prettier from 'prettier'; +import * as t from 'typanion'; +import { generateDefinitions } from './generator/index.js'; + +const cli = new Cli({ + binaryName: 'lex-cli', + binaryVersion: '0.0.0', +}); + +cli.register(Builtins.HelpCommand); + +cli.register( + class GenerateMainLexicons extends Command { + static paths = [['generate-main']]; + + static usage = Command.Usage({ + description: 'Generates the main type definition file', + }); + + output = Option.String('-o,--output', { + required: false, + description: + 'Where to save the resulting type definition file, defaults to stdout if not passed', + validator: t.cascade(t.isString(), t.matchesRegExp(/\.ts$/)), + }); + + desc = Option.String('--description', { + required: false, + description: 'Module description', + }); + + banner = Option.String('--banner', { + required: false, + description: 'Insert an arbitrary string at the beginning of the module', + }); + + files = Option.Rest({ + required: 1, + name: 'files', + }); + + async execute(): Promise { + let code: string; + + try { + code = await generateDefinitions({ + files: this.files, + main: true, + banner: this.banner, + description: this.desc, + }); + } + catch (err) { + if (err instanceof Error) { + console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); + + if (err.cause instanceof Error) { + console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); + } + } + else { + console.error(pc.bold(pc.red('unknown error occurred:'))); + console.error(err); + } + + return 1; + } + + const config = await prettier.resolveConfig( + this.output || process.cwd(), + { editorconfig: true }, + ); + const formatted = await prettier.format(code, { + ...config, + parser: 'typescript', + }); + + if (this.output) { + await writeFile(this.output, formatted); + } + else { + // eslint-disable-next-line no-console + console.log(formatted); + } + } + }, +); + +(async () => { + const exitCode = await cli.run(process.argv.slice(2)); + process.exitCode = exitCode; +})(); From 97e4f206f3e9e226a82645513e380180ba9ef131 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:10:58 -0500 Subject: [PATCH 46/68] adding generator --- packages/lex-cli/src/generator/index.ts | 338 +++++++++++++++++ .../src/generator/resolvers/complex.ts | 51 +++ .../src/generator/resolvers/numeric.ts | 17 + .../src/generator/resolvers/primitives.ts | 16 + .../lex-cli/src/generator/resolvers/string.ts | 50 +++ .../lex-cli/src/generator/resolvers/type.ts | 99 +++++ packages/lex-cli/src/generator/schema.ts | 355 ++++++++++++++++++ 7 files changed, 926 insertions(+) create mode 100644 packages/lex-cli/src/generator/index.ts create mode 100644 packages/lex-cli/src/generator/resolvers/complex.ts create mode 100644 packages/lex-cli/src/generator/resolvers/numeric.ts create mode 100644 packages/lex-cli/src/generator/resolvers/primitives.ts create mode 100644 packages/lex-cli/src/generator/resolvers/string.ts create mode 100644 packages/lex-cli/src/generator/resolvers/type.ts create mode 100644 packages/lex-cli/src/generator/schema.ts diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts new file mode 100644 index 0000000..1b9eb21 --- /dev/null +++ b/packages/lex-cli/src/generator/index.ts @@ -0,0 +1,338 @@ +import { readFile } from 'node:fs/promises'; +import { toNamespace } from '../utils/cache.js'; +import { getDescriptions, writeJsdoc } from '../utils/docs.js'; +import { mainPrelude } from '../utils/prelude.js'; +import { sortDefinition, sortName, sortPropertyKeys } from '../utils/sort.js'; +import { resolveType } from './resolvers/type.js'; +import { documentSchema, type DocumentSchema } from './schema.js'; + +export interface GenerateDefinitionsOptions { + files: string[]; + main: boolean; + banner?: string; + description?: string; + debug?: boolean; + onProgress?: (filename: string, index: number, total: number) => void; +} + +export async function generateDefinitions(opts: GenerateDefinitionsOptions) { + const { files, main, banner, description } = opts; + + let queries = ''; + let procedures = ''; + let records = ''; + let subscriptions = ''; + + let code = `/* eslint-disable */ +// This file is automatically generated, do not edit!`; + + if (description) { + code += `\n\n/** + * @module + * ${description} + */`; + } + + if (main) { + code += `\n\n${banner ?? ''}\n${mainPrelude}`; + } + else { + code += `\n\nimport "@tsky/lexicons";${banner ?? ''} + +declare module "@tsky/lexicons" {`; + } + + for await (const filename of files.sort(sortName)) { + let document: DocumentSchema; + + try { + const jsonString = await readFile(filename, 'utf8'); + const parsed = JSON.parse(jsonString); + + if (!documentSchema(parsed)) { + throw new Error('Invalid document schema'); + } + document = parsed; + } + catch (err) { + throw new Error(`failed to read ${filename}`, { cause: err }); + } + + const ns = document.id; + const tsNamespace = toNamespace(ns); + + let descs: string[] = []; + let chunk = ''; + + const definitions = document.defs; + const keys = Object.keys(definitions).sort(sortDefinition); + + for (const key of keys) { + const def = definitions[key]; + const type = def.type; + + const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; + const typeName = key[0].toUpperCase() + key.slice(1); + + if (type === 'string') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'token') { + chunk += `type ${typeName} = '${nsid}';`; + } + else if (type === 'object') { + const required = def.required; + const nullable = def.nullable; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += `interface ${typeName} {`; + chunk += `[Brand.Type]?: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + } + else if (type === 'array') { + const { value, descriptions } = resolveType(nsid, def.items); + const descs = []; + + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + + chunk += writeJsdoc(descs.concat(descriptions)); + chunk += `type ${typeName} = (${value})[];`; + } + else if (type === 'record') { + const obj = def.record; + const required = obj.required; + const nullable = obj.nullable; + const properties = obj.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += 'interface Record {'; + chunk += `$type: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + + records += `\n'${nsid}': ${tsNamespace}.Record;`; + } + else if (type === 'query' || type === 'procedure') { + let parameters = def.parameters; + const input = type === 'procedure' ? def.input : undefined; + const output = def.output; + const errors = def.errors; + + descs = getDescriptions(def); + + if (parameters) { + if (Object.values(parameters.properties).length === 0) { + parameters = undefined; + } + else { + const { value, descriptions } = resolveType(nsid, parameters); + + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + } + else { + chunk += 'interface Params {}'; + } + + if (input) { + if (input.encoding === 'application/json' && input.schema) { + const { value, descriptions } = resolveType(nsid, input.schema); + + chunk += writeJsdoc(descriptions); + + if (input.schema?.type === 'object') { + chunk += `interface Input ${value}`; + } + else { + chunk += `type Input = ${value};`; + } + } + else { + chunk += 'type Input = Blob | ArrayBufferView;'; + } + } + else { + chunk += 'type Input = undefined;'; + } + + if (output) { + if (output.encoding === 'application/json' && output.schema) { + const { value, descriptions } = resolveType(nsid, output.schema); + + chunk += writeJsdoc(descriptions); + + if (output.schema?.type === 'object') { + chunk += `interface Output ${value}`; + } + else { + chunk += `type Output = ${value};`; + } + } + else { + chunk += 'type Output = Uint8Array;'; + } + } + else { + chunk += 'type Output = undefined;'; + } + + if (errors) { + chunk += 'interface Errors {'; + + for (const error of errors) { + chunk += `${error.name}: {};`; + } + + chunk += '}'; + } + + { + let rc = `'${ns}':{\n`; + + if (parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (input) { + rc += `input: ${tsNamespace}.Input;`; + } + if (output) { + rc += `output: ${tsNamespace}.Output;`; + } + + rc += '};'; + + if (type === 'query') { + queries += rc; + } + else if (type === 'procedure') { + procedures += rc; + } + } + } + else if (type === 'blob') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'bytes') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'subscription') { + if (def.parameters) { + const { value, descriptions } = resolveType(nsid, def.parameters); + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + else { + chunk += 'interface Params {}'; + } + + if (def.message?.schema) { + const { value: messageValue, descriptions: messageDesc } + = resolveType(nsid, def.message.schema); + chunk += writeJsdoc(messageDesc); + chunk += `type Message = ${messageValue};`; + } + + if (def.errors) { + chunk += 'interface Errors {'; + for (const error of def.errors) { + chunk += `${error.name}: {};`; + } + chunk += '}'; + } + + let rc = `'${ns}':{\n`; + if (def.parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (def.message?.schema) { + rc += `message: ${tsNamespace}.Message;`; + } + if (def.errors) { + rc += `errors: ${tsNamespace}.Errors;`; + } + rc += '};'; + subscriptions += rc; + } + else { + // eslint-disable-next-line no-console + console.log(`${nsid}: unhandled type ${type}`); + } + } + + code += writeJsdoc(descs); + + if (main) { + code += `export declare namespace ${tsNamespace} {`; + } + else { + code += `namespace ${tsNamespace} {`; + } + + code += chunk; + code += '}\n\n'; + } + + if (main) { + code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; + } + else { + code += `interface Records {${records}}\n\n`; + code += `interface Queries {${queries}}\n\n`; + code += `interface Procedures {${procedures}}\n\n`; + code += `interface Subscriptions {${subscriptions}}\n\n`; + code += '}'; + } + + return code; +} diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts new file mode 100644 index 0000000..de465f5 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -0,0 +1,51 @@ +import type { + ObjectSchema, + RefSchema, + RefUnionSchema, + XrpcParametersSchema, +} from '../schema.js'; +import { toNamespace, toUpper } from '../../utils/cache.js'; +import { writeJsdoc } from '../../utils/docs.js'; +import { sortName, sortPropertyKeys } from '../../utils/sort.js'; +import { resolveType } from './type.js'; + +export function resolveRefType(def: RefSchema): string { + const [ns, ref] = def.ref.split('#'); + return (ns ? `${toNamespace(ns)}.` : '') + (ref ? toUpper(ref) : 'Main'); +} + +export function resolveUnionType(def: RefUnionSchema): string { + const refs = def.refs.toSorted(sortName).map((raw) => { + const [ns, ref] = raw.split('#'); + return (ns ? `${toNamespace(ns)}.` : '') + (ref ? toUpper(ref) : 'Main'); + }); + return `Brand.Union<${refs.join('|')}>`; +} + +export function resolveObjectType( + def: ObjectSchema | XrpcParametersSchema, + type: 'object' | 'params', + nsid: string, +): { value: string; descriptions: string[] } { + const required = def.required; + const nullable = type === 'object' && 'nullable' in def ? def.nullable : []; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + let chunk = '{'; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + return { value: chunk, descriptions: [] }; +} diff --git a/packages/lex-cli/src/generator/resolvers/numeric.ts b/packages/lex-cli/src/generator/resolvers/numeric.ts new file mode 100644 index 0000000..643f76a --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/numeric.ts @@ -0,0 +1,17 @@ +import type { IntegerSchema } from '../schema.js'; + +export function resolveIntegerType( + def: IntegerSchema, + descs: string[], +): string { + if (def.minimum !== undefined) { + descs.push(`Minimum: ${def.minimum}`); + } + if (def.maximum !== undefined) { + descs.push(`Maximum: ${def.maximum}`); + } + if (def.default !== undefined) { + descs.push(`@default ${def.default}`); + } + return 'number'; +} diff --git a/packages/lex-cli/src/generator/resolvers/primitives.ts b/packages/lex-cli/src/generator/resolvers/primitives.ts new file mode 100644 index 0000000..20430f7 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/primitives.ts @@ -0,0 +1,16 @@ +export function resolvePrimitiveType( + type: string, +): string { + switch (type) { + case 'unknown': + return 'unknown'; + case 'cid-link': + return 'At.CIDLink'; + case 'bytes': + return 'At.Bytes'; + case 'blob': + return 'At.Blob'; + default: + return 'unknown'; + } +} diff --git a/packages/lex-cli/src/generator/resolvers/string.ts b/packages/lex-cli/src/generator/resolvers/string.ts new file mode 100644 index 0000000..12af283 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/string.ts @@ -0,0 +1,50 @@ +import type { StringSchema } from '../schema.js'; +import { IGNORED_FORMATS, TYPE_FORMATS } from '../../utils/formats.js'; +import { sortName } from '../../utils/sort.js'; + +export function resolveStringFormat(format: string, nsid: string): string { + if (format === 'did') return TYPE_FORMATS.DID; + if (format === 'cid') return TYPE_FORMATS.CID; + if (format === 'handle') return TYPE_FORMATS.HANDLE; + if (format === 'at-uri') return TYPE_FORMATS.URI; + if (IGNORED_FORMATS.has(format)) return 'string'; + + console.warn(`${nsid}: unknown format ${format}`); + return 'string'; +} + +export function resolveStringType( + def: StringSchema, + nsid: string, + descs: string[], +): string { + const { format, enum: enums, knownValues: known } = def; + + if (format !== undefined) { + return resolveStringFormat(format, nsid); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum string length: ${def.minLength}`); + } + if (def.maxLength !== undefined) { + descs.push(`Maximum string length: ${def.maxLength}`); + } + if (def.maxGraphemes !== undefined) { + descs.push(`Maximum grapheme length: ${def.maxGraphemes}`); + } + if (def.default !== undefined) { + descs.push(`@default ${JSON.stringify(def.default)}`); + } + + if (enums) { + return enums.map((val: string) => JSON.stringify(val)).join('|'); + } + if (known) { + return `${known + .toSorted(sortName) + .map((val: string) => JSON.stringify(val)) + .join('|')} | (string & {})`; + } + return 'string'; +} diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts new file mode 100644 index 0000000..f3dd9e9 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -0,0 +1,99 @@ +import type { + RefVariantSchema, + UserTypeSchema, + XrpcParametersSchema, +} from '../schema.js'; +import { getDescriptions } from '../../utils/docs.js'; +import { + resolveObjectType, + resolveRefType, + resolveUnionType, +} from './complex.js'; +import { resolveIntegerType } from './numeric.js'; +import { resolvePrimitiveType } from './primitives.js'; +import { resolveStringType } from './string.js'; + +export function resolveType( + nsid: string, + def: UserTypeSchema | RefVariantSchema | XrpcParametersSchema, +): { value: string; descriptions: string[] } { + if (!def?.type) { + throw new Error(`Invalid schema definition for ${nsid}`); + } + + let descs = getDescriptions(def); + let val: string; + + switch (def.type) { + case 'unknown': + case 'cid-link': + case 'blob': + case 'bytes': + val = resolvePrimitiveType(def.type); + break; + case 'integer': + val = resolveIntegerType(def, descs); + break; + case 'boolean': + val = 'boolean'; + if (def.default !== undefined) { + descs.push(`@default ${def.default}`); + } + break; + case 'string': + val = resolveStringType(def, nsid, descs); + break; + case 'array': { + const { value, descriptions } = resolveType(`${nsid}/0`, def.items); + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + val = `(${value})[]`; + descs = descs.concat(descriptions); + break; + } + case 'ref': + val = resolveRefType(def); + break; + case 'union': + val = resolveUnionType(def); + break; + case 'object': + case 'params': { + const result = resolveObjectType(def, def.type, nsid); + val = result.value; + descs = descs.concat(result.descriptions); + break; + } + case 'subscription': { + const output: { value: string; descriptions: string[] }[] = []; + if (def.parameters) { + output.push(resolveObjectType(def.parameters, 'params', nsid)); + } + if (def.message?.schema) { + output.push(resolveType(nsid, def.message.schema)); + } + if (def.errors) { + output.push({ + value: `interface Errors {${def.errors + .map(error => `${error.name}: {};`) + .join('')}}`, + descriptions: [], + }); + } + + val = output.map(o => o.value).join('\n'); + descs = descs.concat(output.flatMap(o => o.descriptions)); + break; + } + default: + // eslint-disable-next-line no-console + console.log(`${nsid}: unknown type ${def.type}`); + val = 'unknown'; + } + + return { value: val, descriptions: descs }; +} diff --git a/packages/lex-cli/src/generator/schema.ts b/packages/lex-cli/src/generator/schema.ts new file mode 100644 index 0000000..72da151 --- /dev/null +++ b/packages/lex-cli/src/generator/schema.ts @@ -0,0 +1,355 @@ +import * as t from 'typanion'; + +const isPositiveInteger = t.cascade( + t.isNumber(), + (value): value is number => { + return Number.isInteger(value) && value >= 0; + }, +); + +export const booleanSchema = t.isObject({ + type: t.isLiteral('boolean'), + description: t.isOptional(t.isString()), + default: t.isOptional(t.isBoolean()), + const: t.isOptional(t.isBoolean()), +}); + +export type BooleanSchema = t.InferType; + +export const integerSchema = t.isObject({ + type: t.isLiteral('integer'), + description: t.isOptional(t.isString()), + default: t.isOptional(isPositiveInteger), + const: t.isOptional(isPositiveInteger), + enum: t.isOptional(t.isArray(t.isNumber())), + maximum: t.isOptional(isPositiveInteger), + minimum: t.isOptional(isPositiveInteger), +}); + +export type IntegerSchema = t.InferType; + +const stringFormatSchema = t.isOneOf([ + t.isLiteral('at-identifier'), + t.isLiteral('at-uri'), + t.isLiteral('cid'), + t.isLiteral('datetime'), + t.isLiteral('did'), + t.isLiteral('handle'), + t.isLiteral('language'), + t.isLiteral('nsid'), + t.isLiteral('record-key'), + t.isLiteral('tid'), + t.isLiteral('uri'), +]); + +export const stringSchema: t.StrictValidator = t.cascade( + t.isObject({ + type: t.isLiteral('string'), + description: t.isOptional(t.isString()), + format: t.isOptional(stringFormatSchema), + default: t.isOptional(t.isString()), + const: t.isOptional(t.isString()), + enum: t.isOptional(t.isArray(t.isString())), + knownValues: t.isOptional(t.isArray(t.isString())), + maxLength: t.isOptional(isPositiveInteger), + minLength: t.isOptional(isPositiveInteger), + maxGraphemes: t.isOptional(isPositiveInteger), + minGraphemes: t.isOptional(isPositiveInteger), + }), + (value): value is { type: 'string'; description?: string; format?: 'at-identifier' | 'at-uri' | 'cid' | 'datetime' | 'did' | 'handle' | 'language' | 'nsid' | 'record-key' | 'tid' | 'uri'; default?: string; const?: string; enum?: string[]; knownValues?: string[]; maxLength?: number; minLength?: number; maxGraphemes?: number; minGraphemes?: number } => { + if (value.format !== undefined && value.format !== 'uri') { + if (value.maxLength !== undefined + || value.minLength !== undefined + || value.maxGraphemes !== undefined + || value.minGraphemes !== undefined) { + throw new Error(`${value.format} format can't be used with length or grapheme constraints`); + } + } + return true; + }, +); + +export type StringSchema = t.InferType; + +export const unknownSchema = t.isObject({ + type: t.isLiteral('unknown'), + description: t.isOptional(t.isString()), +}); + +export type UnknownSchema = t.InferType; + +export const primitiveSchema = t.isOneOf([ + booleanSchema, + integerSchema, + stringSchema, + unknownSchema, +]); + +export type PrimitiveSchema = t.InferType; + +export const bytesSchema = t.isObject({ + type: t.isLiteral('bytes'), + description: t.isOptional(t.isString()), + maxLength: t.isOptional(isPositiveInteger), + minLength: t.isOptional(isPositiveInteger), +}); + +export type BytesSchema = t.InferType; + +export const cidLinkSchema = t.isObject({ + type: t.isLiteral('cid-link'), + description: t.isOptional(t.isString()), +}); + +export type CidLinkSchema = t.InferType; + +export const ipldTypeSchema = t.isOneOf([ + bytesSchema, + cidLinkSchema, +]); + +export type IpldTypeSchema = t.InferType; + +export const refSchema = t.isObject({ + type: t.isLiteral('ref'), + description: t.isOptional(t.isString()), + ref: t.isString(), +}); + +export type RefSchema = t.InferType; + +export const refUnionSchema = t.cascade( + t.isObject({ + type: t.isLiteral('union'), + description: t.isOptional(t.isString()), + refs: t.isArray(t.isString()), + closed: t.isOptional(t.isBoolean()), + }), + (value): value is { type: 'union'; description?: string; refs: string[]; closed?: boolean } => { + if (value.closed && value.refs.length === 0) { + throw new Error(`A closed union can't have empty refs list`); + } + return true; + }, +); + +export type RefUnionSchema = t.InferType; + +export const refVariantSchema = t.isOneOf([ + refSchema, + refUnionSchema, +]); + +export type RefVariantSchema = t.InferType; + +export const blobSchema = t.isObject({ + type: t.isLiteral('blob'), + description: t.isOptional(t.isString()), + accept: t.isOptional(t.isArray(t.isString())), + maxSize: t.isOptional(isPositiveInteger), +}); + +export type BlobSchema = t.InferType; + +export const arraySchema = t.isObject({ + type: t.isLiteral('array'), + description: t.isOptional(t.isString()), + items: t.isOneOf([primitiveSchema, ipldTypeSchema, blobSchema, refVariantSchema]), + maxLength: t.isOptional(isPositiveInteger), + minLength: t.isOptional(isPositiveInteger), +}); + +export type ArraySchema = t.InferType; + +export const primitiveArraySchema = t.cascade(arraySchema, (value): value is ArraySchema => { + if (!t.isOneOf([primitiveSchema])(value.items)) { + throw new Error('Array items must be primitive types'); + } + return true; +}); + +export type PrimitiveArraySchema = t.InferType; + +export const tokenSchema = t.isObject({ + type: t.isLiteral('token'), + description: t.isOptional(t.isString()), +}); + +export type TokenSchema = t.InferType; + +function refineRequiredProperties< + T extends { required?: string[]; properties: Record }, +>(schema: t.StrictValidator): t.StrictValidator { + interface RequiredPropertiesSchema { + required?: string[]; + properties: Record; + } + + return t.cascade(schema, (value: RequiredPropertiesSchema): value is RequiredPropertiesSchema => { + if (value.required) { + for (const field of value.required) { + if (value.properties[field] === undefined) { + throw new Error(`Required field "${field}" not defined`); + } + } + } + return true; + }); +} + +export const objectSchema = refineRequiredProperties( + t.isObject({ + type: t.isLiteral('object'), + description: t.isOptional(t.isString()), + required: t.isOptional(t.isArray(t.isString())), + nullable: t.isOptional(t.isArray(t.isString())), + properties: t.isRecord(t.isOneOf([ + refVariantSchema, + ipldTypeSchema, + arraySchema, + blobSchema, + primitiveSchema, + ])), + }), +); + +export type ObjectSchema = t.InferType; + +export const xrpcParametersSchema = refineRequiredProperties( + t.isObject({ + type: t.isLiteral('params'), + description: t.isOptional(t.isString()), + required: t.isOptional(t.isArray(t.isString())), + properties: t.isRecord(t.isOneOf([primitiveSchema, primitiveArraySchema])), + }), +); + +export type XrpcParametersSchema = t.InferType; + +export const xrpcBodySchema = t.isObject({ + description: t.isOptional(t.isString()), + encoding: t.isString(), + schema: t.isOptional(t.isOneOf([refVariantSchema, objectSchema])), +}); + +export type XrpcBodySchema = t.InferType; + +export const xrpcSubscriptionMessageSchema = t.isObject({ + description: t.isOptional(t.isString()), + schema: t.isOptional(t.isOneOf([refVariantSchema, objectSchema])), +}); + +export type XrpcSubscriptionMessageSchema = t.InferType; + +export const xrpcErrorSchema = t.isObject({ + name: t.isString(), + description: t.isOptional(t.isString()), +}); + +export type XrpcErrorSchema = t.InferType; + +export const xrpcQuerySchema = t.isObject({ + type: t.isLiteral('query'), + description: t.isOptional(t.isString()), + parameters: t.isOptional(xrpcParametersSchema), + output: t.isOptional(xrpcBodySchema), + errors: t.isOptional(t.isArray(xrpcErrorSchema)), +}); + +export type XrpcQuerySchema = t.InferType; + +export const xrpcProcedureSchema = t.isObject({ + type: t.isLiteral('procedure'), + description: t.isOptional(t.isString()), + parameters: t.isOptional(xrpcParametersSchema), + input: t.isOptional(xrpcBodySchema), + output: t.isOptional(xrpcBodySchema), + errors: t.isOptional(t.isArray(xrpcErrorSchema)), +}); + +export type XrpcProcedureSchema = t.InferType; + +export const xrpcSubscriptionSchema = t.isObject({ + type: t.isLiteral('subscription'), + description: t.isOptional(t.isString()), + parameters: t.isOptional(xrpcParametersSchema), + message: t.isOptional(xrpcSubscriptionMessageSchema), + errors: t.isOptional(t.isArray(xrpcErrorSchema)), +}); + +export type XrpcSubscriptionSchema = t.InferType; + +export const recordSchema = t.isObject({ + type: t.isLiteral('record'), + description: t.isOptional(t.isString()), + key: t.isOptional(t.isString()), + record: objectSchema, +}); + +export type RecordSchema = t.InferType; + +export const userTypeSchema = t.isOneOf([ + recordSchema, + xrpcQuerySchema, + xrpcProcedureSchema, + xrpcSubscriptionSchema, + blobSchema, + arraySchema, + tokenSchema, + objectSchema, + booleanSchema, + integerSchema, + stringSchema, + bytesSchema, + cidLinkSchema, + unknownSchema, +]); + +export type UserTypeSchema = t.InferType; + +const NSID_RE = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; +const nsidType = t.cascade( + t.isString(), + value => NSID_RE.test(value), +); + +export const documentSchema = t.cascade( + t.isObject({ + lexicon: t.isLiteral(1), + id: nsidType, + revision: t.isOptional(t.isNumber()), + description: t.isOptional(t.isString()), + defs: t.isRecord(userTypeSchema), + }), + (value): value is { lexicon: 1; id: string; revision?: number; description?: string; defs: Record } => { + for (const id in value.defs) { + const def = value.defs[id]; + const type = def.type; + + if ( + id !== 'main' + && (type === 'record' + || type === 'query' + || type === 'procedure' + || type === 'subscription') + ) { + throw new Error(`${type} must be the \`main\` definition (in defs.${id})`); + } + } + return true; + }, +); + +export type DocumentSchema = t.InferType; From 41b987d37235b1a924a8a719cccdec71ec799e98 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:11:06 -0500 Subject: [PATCH 47/68] adding utils --- packages/lex-cli/src/utils/cache.ts | 25 +++++++++++++ packages/lex-cli/src/utils/docs.ts | 24 +++++++++++++ packages/lex-cli/src/utils/formats.ts | 14 ++++++++ packages/lex-cli/src/utils/prelude.ts | 51 +++++++++++++++++++++++++++ packages/lex-cli/src/utils/sort.ts | 28 +++++++++++++++ 5 files changed, 142 insertions(+) create mode 100644 packages/lex-cli/src/utils/cache.ts create mode 100644 packages/lex-cli/src/utils/docs.ts create mode 100644 packages/lex-cli/src/utils/formats.ts create mode 100644 packages/lex-cli/src/utils/prelude.ts create mode 100644 packages/lex-cli/src/utils/sort.ts diff --git a/packages/lex-cli/src/utils/cache.ts b/packages/lex-cli/src/utils/cache.ts new file mode 100644 index 0000000..8e44eda --- /dev/null +++ b/packages/lex-cli/src/utils/cache.ts @@ -0,0 +1,25 @@ +export const toUpperCache: Record = Object.create( + null, +) as Record; +export const toNamespaceCache: Record = Object.create( + null, +) as Record; + +export function toUpper(s: string) { + if (s in toUpperCache) { + return toUpperCache[s]; + } + const value = s[0].toUpperCase() + s.slice(1); + toUpperCache[s] = value; + return value; +} + +export function toNamespace(s: string) { + if (s in toNamespaceCache) { + return toNamespaceCache[s]; + } + const value = s.replace(/^\w|\.\w/g, m => + m[m.length === 1 ? 0 : 1].toUpperCase()); + toNamespaceCache[s] = value; + return value; +} diff --git a/packages/lex-cli/src/utils/docs.ts b/packages/lex-cli/src/utils/docs.ts new file mode 100644 index 0000000..195e29d --- /dev/null +++ b/packages/lex-cli/src/utils/docs.ts @@ -0,0 +1,24 @@ +export function getDescriptions(def: { description?: string }): string[] { + const descs: string[] = []; + if (def.description) { + descs.push(def.description); + if (def.description.toLowerCase().startsWith('deprecated')) { + descs.push('@deprecated'); + } + } + return descs; +} + +export function writeJsdoc(descriptions: string[]) { + if (!descriptions.length) return ''; + + const escaped = descriptions.map(desc => + desc.replace(/\*\//g, '*\\/').replace(/@/g, '\\@'), + ); + + if (escaped.length === 1) { + return `\n/** ${escaped[0]} */\n`; + } + + return `\n/**${escaped.map(desc => `\n * ${desc}`).join('')}\n */\n`; +} diff --git a/packages/lex-cli/src/utils/formats.ts b/packages/lex-cli/src/utils/formats.ts new file mode 100644 index 0000000..30fccd8 --- /dev/null +++ b/packages/lex-cli/src/utils/formats.ts @@ -0,0 +1,14 @@ +export const TYPE_FORMATS = { + DID: 'At.DID', + CID: 'At.CID', + HANDLE: 'At.Handle', + URI: 'At.Uri', +} as const; + +export const IGNORED_FORMATS = new Set([ + 'at-identifier', + 'datetime', + 'language', + 'nsid', + 'uri', +]); diff --git a/packages/lex-cli/src/utils/prelude.ts b/packages/lex-cli/src/utils/prelude.ts new file mode 100644 index 0000000..01d98ef --- /dev/null +++ b/packages/lex-cli/src/utils/prelude.ts @@ -0,0 +1,51 @@ +export const mainPrelude = `type ObjectOmit = Omit; + +/** Handles type branding in objects */ +export declare namespace Brand { + /** Symbol used to brand objects, this does not actually exist in runtime */ + const Type: unique symbol; + + /** Get the intended \`$type\` field */ + type GetType = NonNullable; + + /** Creates a union of objects where it's discriminated by \`$type\` field. */ + type Union = T extends any ? T & { $type: GetType } : never; + + /** Omits the type branding from object */ + type Omit = ObjectOmit; +} + +/** Base AT Protocol schema types */ +export declare namespace At { + /** CID string */ + type CID = string; + + /** DID of a user */ + type DID = \`did:\${string}\`; + + /** User handle */ + type Handle = string; + + /** URI string */ + type Uri = string; + + /** Object containing a CID string */ + interface CIDLink { + $link: CID; + } + + /** Object containing a base64-encoded bytes */ + interface Bytes { + $bytes: string; + } + + /** Blob interface */ + interface Blob { + $type: 'blob'; + mimeType: T; + ref: { + $link: string; + }; + size: number; + } +}`; diff --git a/packages/lex-cli/src/utils/sort.ts b/packages/lex-cli/src/utils/sort.ts new file mode 100644 index 0000000..8f1bbc1 --- /dev/null +++ b/packages/lex-cli/src/utils/sort.ts @@ -0,0 +1,28 @@ +const COLLATOR = new Intl.Collator('en-US'); +export function sortName(a: string, b: string): number { + return COLLATOR.compare(a, b); +} + +export function sortPropertyKeys( + keys: string[], + required?: string[], +): string[] { + return keys.sort((a, b) => { + const aIsOptional = !required || !required.includes(a); + const bIsOptional = !required || !required.includes(b); + if (aIsOptional === bIsOptional) { + return sortName(a, b); + } + return +aIsOptional - +bIsOptional; + }); +} + +export function sortDefinition(a: string, b: string) { + const aIsMain = a === 'main'; + const bIsMain = b === 'main'; + + if (aIsMain === bIsMain) { + return sortName(a, b); + } + return +bIsMain - +aIsMain; +} From 81d8c58e8200d179c3fb810a92727970b149566b Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:11:23 -0500 Subject: [PATCH 48/68] revisions to @tsky/lexicons for @tsky/lex-cli --- packages/lexicons/package.json | 8 +- packages/lexicons/scripts/generate-types.ts | 216 +++++++++++--------- packages/lexicons/src/index.ts | 108 ++++++++++ 3 files changed, 227 insertions(+), 105 deletions(-) create mode 100644 packages/lexicons/src/index.ts diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 01bc3c0..4a08792 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -8,14 +8,10 @@ "scripts": { "build": "tsx ./scripts/generate-types.ts" }, - "dependencies": { - "@atproto/lexicon": "^0.4.3", - "@atproto/xrpc": "^0.6.4", - "multiformats": "^13.3.1" - }, "devDependencies": { - "@atproto/lex-cli": "^0.5.2", + "@tsky/lex-cli": "workspace:*", "@types/node": "^22.10.1", + "fast-glob": "^3.3.2", "tar": "^7.4.3", "tsx": "^4.19.2", "typescript": "^5.7.2" diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index 10804f4..78f180f 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -1,99 +1,117 @@ -import { Buffer } from 'node:buffer'; -import { execSync } from 'node:child_process'; -import fs from 'node:fs/promises'; -import path from 'node:path'; -import process from 'node:process'; -import { fileURLToPath } from 'node:url'; -import * as tar from 'tar'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -const LEXICONS_DIR = path.resolve(__dirname, '../lexicons'); -const TYPES_DIR = path.resolve(__dirname, '../src'); -const REPO = 'bluesky-social/atproto'; - -async function findJsonFiles(dir: string): Promise { - const files: string[] = []; - const entries = await fs.readdir(dir, { withFileTypes: true }); - - for (const entry of entries) { - const fullPath = path.join(dir, entry.name); - if (entry.isDirectory()) { - files.push(...await findJsonFiles(fullPath)); - } - else if (entry.isFile() && entry.name.endsWith('.json')) { - files.push(fullPath); - } - } - - return files; -} - -async function main() { - try { - // Ensure directories exist - await fs.mkdir(LEXICONS_DIR, { recursive: true }); - await fs.mkdir(TYPES_DIR, { recursive: true }); - - // Get latest commit SHA for lexicons - console.log('Getting latest lexicon commit...'); - const shaResponse = await fetch(`https://api.github.com/repos/${REPO}/commits?path=lexicons/`); - if (!shaResponse.ok) { - throw new Error(`Failed to get commit SHA: ${shaResponse.statusText}`); - } - - const commits = await shaResponse.json(); - const sha = commits[0]?.sha; - if (!sha) { - throw new Error('No commits found for lexicons'); - } - - // Download specific commit's lexicons - console.log('Downloading lexicons from atproto...'); - const response = await fetch(`https://github.com/${REPO}/archive/${sha}.tar.gz`); - if (!response.ok) { - throw new Error(`Failed to download lexicons: ${response.statusText}`); - } - - // Create a temporary file for the tar download - const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); - await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); - - // Extract only lexicon files - await tar.x({ - file: tarFile, - cwd: LEXICONS_DIR, - filter: path => path.includes('/lexicons/'), - strip: 2, - }); - - // Clean up tar file - await fs.unlink(tarFile); - - // Find all lexicon JSON files - console.log('Finding lexicon files...'); - const lexiconFiles = await findJsonFiles(LEXICONS_DIR); - if (lexiconFiles.length === 0) { - throw new Error('No lexicon files found'); - } - - // Generate types using @atproto/lex-cli - console.log('Generating types...'); - execSync( - `pnpm lex gen-api ${TYPES_DIR} ${lexiconFiles.join(' ')}`, - { - stdio: 'inherit', - cwd: TYPES_DIR, - }, - ); - - console.log('Done! Types generated in', TYPES_DIR); - } - catch (error) { - console.error('Error:', error); - process.exit(1); - } -} - -main(); +import { Buffer } from 'node:buffer'; +import { execSync } from 'node:child_process'; +import fs from 'node:fs/promises'; +import path from 'node:path'; +import process from 'node:process'; +import { fileURLToPath } from 'node:url'; +import glob from 'fast-glob'; +import * as tar from 'tar'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const LEXICONS_DIR = path.resolve(__dirname, '../lexicons'); +const TYPES_OUTPUT_PATH = path.resolve(__dirname, '../src/lib/lexicons.ts'); +const LEX_CLI_PATH = path.resolve(__dirname, '../../lex-cli/dist/index.js'); +const REPO = 'bluesky-social/atproto'; + +async function downloadLexicons() { + // Get latest commit SHA for lexicons + console.log('Getting latest lexicon commit...'); + const shaResponse = await fetch( + `https://api.github.com/repos/${REPO}/commits?path=lexicons/`, + ); + if (!shaResponse.ok) { + throw new Error(`Failed to get commit SHA: ${shaResponse.statusText}`); + } + + const commits = await shaResponse.json(); + const sha = commits[0]?.sha; + if (!sha) { + throw new Error('No commits found for lexicons'); + } + + // Download specific commit's lexicons + console.log('Downloading lexicons from atproto...'); + const response = await fetch( + `https://github.com/${REPO}/archive/${sha}.tar.gz`, + ); + if (!response.ok) { + throw new Error(`Failed to download lexicons: ${response.statusText}`); + } + + // Create a temporary file for the tar download + const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); + await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); + + // Extract only lexicon files + await tar.x({ + file: tarFile, + cwd: LEXICONS_DIR, + filter: (path) => path.includes('/lexicons/'), + strip: 2, + }); + + // Clean up tar file + await fs.unlink(tarFile); +} + +async function main() { + try { + // Ensure directories exist + await fs.mkdir(LEXICONS_DIR, { recursive: true }); + await fs.mkdir(path.dirname(TYPES_OUTPUT_PATH), { recursive: true }); + + // Download latest lexicons + await downloadLexicons(); + + // Define glob patterns for lexicon JSON files + const globPatterns = [ + 'app/bsky/**/*.json', + 'chat/bsky/**/*.json', + 'com/atproto/**/*.json', + 'tools/ozone/**/*.json', + ]; + + // Find all matching lexicon files + const lexiconFiles = await glob(globPatterns, { + cwd: LEXICONS_DIR, + absolute: true, + }); + + if (lexiconFiles.length === 0) { + throw new Error('No lexicon files found'); + } + + // Ensure lex-cli is built + console.log('Building lex-cli...'); + execSync('pnpm --filter @tsky/lex-cli build', { + stdio: 'inherit', + env: process.env, + }); + + const command = [ + 'node', + LEX_CLI_PATH, + 'generate-main', + ...lexiconFiles, + '-o', + TYPES_OUTPUT_PATH, + '--description', + '"Contains type declarations for Bluesky lexicons"', + ].join(' '); + + console.log('Running lex-cli to generate types...'); + execSync(command, { + stdio: 'inherit', + env: process.env, + }); + + console.log('Done! Types generated at', TYPES_OUTPUT_PATH); + } catch (error) { + console.error('Error:', error); + process.exit(1); + } +} + +main(); diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts new file mode 100644 index 0000000..4cbce4d --- /dev/null +++ b/packages/lexicons/src/index.ts @@ -0,0 +1,108 @@ +import type { Procedures, Queries, Records } from './lib/lexicons'; + +export * from './lib/lexicons'; + +// --- Core utility types --- +export type LexiconUnion = T[keyof T]; +export type NSIDOf = T extends { $type: infer U extends string } ? U : never; + +// --- NSID Patterns --- +export const APP_BSKY_PREFIX = 'app.bsky.' as const; +export const COM_ATPROTO_PREFIX = 'com.atproto.' as const; + +export type BskyNSID = `${typeof APP_BSKY_PREFIX}${string}`; +export type AtProtoNSID = `${typeof COM_ATPROTO_PREFIX}${string}`; +export type KnownNSID = BskyNSID | AtProtoNSID; + +// --- Record Types --- +export type RecordDefs = LexiconUnion; +export type BskyRecord = RecordDefs & { $type: BskyNSID }; +export type AtProtoRecord = RecordDefs & { $type: AtProtoNSID }; + +// --- Query Types --- +export type QueryDefs = LexiconUnion; +export type BskyQuery = { + [K in keyof Queries]: K extends BskyNSID ? Queries[K] : never; +}[keyof Queries]; + +export type QueryParams = Queries[T] extends { + params: infer P; +} ? P : never; + +export type QueryOutput = Queries[T]['output']; + +export type QueryErrors = Queries[T] extends { + errors: infer E; +} ? E : never; + +// --- Procedure Types --- +export type ProcedureDefs = LexiconUnion; +export type BskyProcedure = { + [K in keyof Procedures]: K extends BskyNSID ? Procedures[K] : never; +}[keyof Procedures]; + +export type ProcedureParams = Procedures[T] extends { + params: infer P; +} ? P : never; + +export type ProcedureInput = Procedures[T] extends { + input: infer I; +} ? I : never; + +export type ProcedureOutput = Procedures[T] extends { + output: infer O; +} ? O : never; + +export type ProcedureErrors = Procedures[T] extends { + errors: infer E; +} ? E : never; + +// --- Common Bluesky Types --- +export type BskyPost = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.post` }; +export type BskyProfile = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}actor.profile` }; +export type BskyLike = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.like` }; +export type BskyFollow = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}graph.follow` }; + +// --- Type Guards --- +export function isRecord(value: unknown): value is RecordDefs { + return ( + typeof value === 'object' && + value !== null && + '$type' in value && + typeof value.$type === 'string' + ); +} + +export function isBskyRecord(value: unknown): value is BskyRecord { + return isRecord(value) && value.$type.startsWith(APP_BSKY_PREFIX); +} + +export function isAtProtoRecord(value: unknown): value is AtProtoRecord { + return isRecord(value) && value.$type.startsWith(COM_ATPROTO_PREFIX); +} + +export function isBskyPost(value: unknown): value is BskyPost { + return isBskyRecord(value) && value.$type.startsWith(`${APP_BSKY_PREFIX}feed.post`); +} + +// --- Error Types and Guards --- +export type BskyError = { + error: string; + message: string; + statusCode?: number; +}; + +export function isBskyError(value: unknown): value is BskyError { + return ( + typeof value === 'object' && + value !== null && + 'error' in value && + 'message' in value && + typeof (value as BskyError).error === 'string' && + typeof (value as BskyError).message === 'string' + ); +} + +// --- Helper Types --- +export type BskyQueryParams = T extends keyof Queries ? QueryParams : never; +export type BskyProcedureInput = T extends keyof Procedures ? ProcedureInput : never; From 2d60a4ad5ec7964b7a7ac1d662071923b80d8b02 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:13:00 -0500 Subject: [PATCH 49/68] adding prepublish --- packages/lex-cli/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index e81e9e9..63e7686 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -5,7 +5,8 @@ "license": "MIT", "bin": "dist/index.js", "scripts": { - "build": "tsc" + "build": "tsc", + "prepublish": "pnpm run build" }, "dependencies": { "clipanion": "4.0.0-rc.4", From 9a3d6f031a0c63a00ddce0a9395abd6c98a57efa Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 10:16:22 -0500 Subject: [PATCH 50/68] committing generated types --- packages/lexicons/src/lib/lexicons.ts | 6013 +++++++++++++++++++++++++ 1 file changed, 6013 insertions(+) create mode 100644 packages/lexicons/src/lib/lexicons.ts diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts new file mode 100644 index 0000000..66eed61 --- /dev/null +++ b/packages/lexicons/src/lib/lexicons.ts @@ -0,0 +1,6013 @@ +/* eslint-disable */ +// This file is automatically generated, do not edit! + +/** + * @module + * Contains type declarations for Bluesky lexicons + */ + +type ObjectOmit = Omit; + +/** Handles type branding in objects */ +export declare namespace Brand { + /** Symbol used to brand objects, this does not actually exist in runtime */ + const Type: unique symbol; + + /** Get the intended `$type` field */ + type GetType = NonNullable; + + /** Creates a union of objects where it's discriminated by `$type` field. */ + type Union = T extends any + ? T & { $type: GetType } + : never; + + /** Omits the type branding from object */ + type Omit = ObjectOmit; +} + +/** Base AT Protocol schema types */ +export declare namespace At { + /** CID string */ + type CID = string; + + /** DID of a user */ + type DID = `did:${string}`; + + /** User handle */ + type Handle = string; + + /** URI string */ + type Uri = string; + + /** Object containing a CID string */ + interface CIDLink { + $link: CID; + } + + /** Object containing a base64-encoded bytes */ + interface Bytes { + $bytes: string; + } + + /** Blob interface */ + interface Blob { + $type: "blob"; + mimeType: T; + ref: { + $link: string; + }; + size: number; + } +} +export declare namespace AppBskyActorDefs { + interface AdultContentPref { + [Brand.Type]?: "app.bsky.actor.defs#adultContentPref"; + /** \@default false */ + enabled: boolean; + } + /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ + interface BskyAppProgressGuide { + [Brand.Type]?: "app.bsky.actor.defs#bskyAppProgressGuide"; + /** Maximum string length: 100 */ + guide: string; + } + /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ + interface BskyAppStatePref { + [Brand.Type]?: "app.bsky.actor.defs#bskyAppStatePref"; + activeProgressGuide?: BskyAppProgressGuide; + /** + * Storage for NUXs the user has encountered. + * Maximum array length: 100 + */ + nuxs?: AppBskyActorDefs.Nux[]; + /** + * An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. + * Maximum array length: 1000 + * Maximum string length: 100 + */ + queuedNudges?: string[]; + } + interface ContentLabelPref { + [Brand.Type]?: "app.bsky.actor.defs#contentLabelPref"; + label: string; + visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); + /** Which labeler does this preference apply to? If undefined, applies globally. */ + labelerDid?: At.DID; + } + interface FeedViewPref { + [Brand.Type]?: "app.bsky.actor.defs#feedViewPref"; + /** The URI of the feed, or an identifier which describes the feed. */ + feed: string; + /** Hide quote posts in the feed. */ + hideQuotePosts?: boolean; + /** Hide replies in the feed. */ + hideReplies?: boolean; + /** Hide replies in the feed if they do not have this number of likes. */ + hideRepliesByLikeCount?: number; + /** + * Hide replies in the feed if they are not by followed users. + * \@default true + */ + hideRepliesByUnfollowed?: boolean; + /** Hide reposts in the feed. */ + hideReposts?: boolean; + } + interface HiddenPostsPref { + [Brand.Type]?: "app.bsky.actor.defs#hiddenPostsPref"; + /** A list of URIs of posts the account owner has hidden. */ + items: At.Uri[]; + } + interface InterestsPref { + [Brand.Type]?: "app.bsky.actor.defs#interestsPref"; + /** + * A list of tags which describe the account owner's interests gathered during onboarding. + * Maximum array length: 100 + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tags: string[]; + } + /** The subject's followers whom you also follow */ + interface KnownFollowers { + [Brand.Type]?: "app.bsky.actor.defs#knownFollowers"; + count: number; + /** + * Minimum array length: 0 + * Maximum array length: 5 + */ + followers: ProfileViewBasic[]; + } + interface LabelerPrefItem { + [Brand.Type]?: "app.bsky.actor.defs#labelerPrefItem"; + did: At.DID; + } + interface LabelersPref { + [Brand.Type]?: "app.bsky.actor.defs#labelersPref"; + labelers: LabelerPrefItem[]; + } + /** A word that the account owner has muted. */ + interface MutedWord { + [Brand.Type]?: "app.bsky.actor.defs#mutedWord"; + /** The intended targets of the muted word. */ + targets: AppBskyActorDefs.MutedWordTarget[]; + /** + * The muted word itself. + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + value: string; + /** + * Groups of users to apply the muted word to. If undefined, applies to all users. + * \@default "all" + */ + actorTarget?: "all" | "exclude-following" | (string & {}); + /** The date and time at which the muted word will expire and no longer be applied. */ + expiresAt?: string; + id?: string; + } + interface MutedWordsPref { + [Brand.Type]?: "app.bsky.actor.defs#mutedWordsPref"; + /** A list of words the account owner has muted. */ + items: AppBskyActorDefs.MutedWord[]; + } + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + type MutedWordTarget = "content" | "tag" | (string & {}); + /** A new user experiences (NUX) storage object */ + interface Nux { + [Brand.Type]?: "app.bsky.actor.defs#nux"; + /** \@default false */ + completed: boolean; + /** Maximum string length: 100 */ + id: string; + /** + * Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + data?: string; + /** The date and time at which the NUX will expire and should be considered completed. */ + expiresAt?: string; + } + interface PersonalDetailsPref { + [Brand.Type]?: "app.bsky.actor.defs#personalDetailsPref"; + /** The birth date of account owner. */ + birthDate?: string; + } + type Preferences = Brand.Union< + | AdultContentPref + | BskyAppStatePref + | ContentLabelPref + | FeedViewPref + | HiddenPostsPref + | InterestsPref + | LabelersPref + | MutedWordsPref + | PersonalDetailsPref + | SavedFeedsPref + | SavedFeedsPrefV2 + | ThreadViewPref + >[]; + interface ProfileAssociated { + [Brand.Type]?: "app.bsky.actor.defs#profileAssociated"; + chat?: ProfileAssociatedChat; + feedgens?: number; + labeler?: boolean; + lists?: number; + starterPacks?: number; + } + interface ProfileAssociatedChat { + [Brand.Type]?: "app.bsky.actor.defs#profileAssociatedChat"; + allowIncoming: "all" | "following" | "none" | (string & {}); + } + interface ProfileView { + [Brand.Type]?: "app.bsky.actor.defs#profileView"; + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + createdAt?: string; + /** + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + indexedAt?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: ViewerState; + } + interface ProfileViewBasic { + [Brand.Type]?: "app.bsky.actor.defs#profileViewBasic"; + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + createdAt?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: ViewerState; + } + interface ProfileViewDetailed { + [Brand.Type]?: "app.bsky.actor.defs#profileViewDetailed"; + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + banner?: string; + createdAt?: string; + /** + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + followersCount?: number; + followsCount?: number; + indexedAt?: string; + joinedViaStarterPack?: AppBskyGraphDefs.StarterPackViewBasic; + labels?: ComAtprotoLabelDefs.Label[]; + pinnedPost?: ComAtprotoRepoStrongRef.Main; + postsCount?: number; + viewer?: ViewerState; + } + interface SavedFeed { + [Brand.Type]?: "app.bsky.actor.defs#savedFeed"; + id: string; + pinned: boolean; + type: "feed" | "list" | "timeline" | (string & {}); + value: string; + } + interface SavedFeedsPref { + [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPref"; + pinned: At.Uri[]; + saved: At.Uri[]; + timelineIndex?: number; + } + interface SavedFeedsPrefV2 { + [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPrefV2"; + items: AppBskyActorDefs.SavedFeed[]; + } + interface ThreadViewPref { + [Brand.Type]?: "app.bsky.actor.defs#threadViewPref"; + /** Show followed users at the top of all replies. */ + prioritizeFollowedUsers?: boolean; + /** Sorting mode for threads. */ + sort?: + | "hotness" + | "most-likes" + | "newest" + | "oldest" + | "random" + | (string & {}); + } + /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ + interface ViewerState { + [Brand.Type]?: "app.bsky.actor.defs#viewerState"; + blockedBy?: boolean; + blocking?: At.Uri; + blockingByList?: AppBskyGraphDefs.ListViewBasic; + followedBy?: At.Uri; + following?: At.Uri; + knownFollowers?: KnownFollowers; + muted?: boolean; + mutedByList?: AppBskyGraphDefs.ListViewBasic; + } +} + +/** Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. */ +export declare namespace AppBskyActorGetPreferences { + type Input = undefined; + interface Output { + preferences: AppBskyActorDefs.Preferences; + } +} + +/** Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. */ +export declare namespace AppBskyActorGetProfile { + interface Params { + /** Handle or DID of account to fetch profile of. */ + actor: string; + } + type Input = undefined; + type Output = AppBskyActorDefs.ProfileViewDetailed; +} + +/** Get detailed profile views of multiple actors. */ +export declare namespace AppBskyActorGetProfiles { + interface Params { + /** Maximum array length: 25 */ + actors: string[]; + } + type Input = undefined; + interface Output { + profiles: AppBskyActorDefs.ProfileViewDetailed[]; + } +} + +/** Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. */ +export declare namespace AppBskyActorGetSuggestions { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + actors: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +export declare namespace AppBskyActorProfile { + /** A declaration of a Bluesky account profile. */ + interface Record { + $type: "app.bsky.actor.profile"; + /** Small image to be displayed next to posts from account. AKA, 'profile picture' */ + avatar?: At.Blob; + /** Larger horizontal image to display behind profile view. */ + banner?: At.Blob; + createdAt?: string; + /** + * Free-form profile description text. + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main; + /** Self-label values, specific to the Bluesky application, on the overall account. */ + labels?: Brand.Union; + pinnedPost?: ComAtprotoRepoStrongRef.Main; + } +} + +/** Set the private preferences attached to the account. */ +export declare namespace AppBskyActorPutPreferences { + interface Params {} + interface Input { + preferences: AppBskyActorDefs.Preferences; + } + type Output = undefined; +} + +/** Find actors (profiles) matching search criteria. Does not require auth. */ +export declare namespace AppBskyActorSearchActors { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q?: string; + /** + * DEPRECATED: use 'q' instead. + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output { + actors: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. */ +export declare namespace AppBskyActorSearchActorsTypeahead { + interface Params { + /** + * Minimum: 1 + * Maximum: 100 + * \@default 10 + */ + limit?: number; + /** Search query prefix; not a full query string. */ + q?: string; + /** + * DEPRECATED: use 'q' instead. + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output { + actors: AppBskyActorDefs.ProfileViewBasic[]; + } +} + +export declare namespace AppBskyEmbedDefs { + /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ + interface AspectRatio { + [Brand.Type]?: "app.bsky.embed.defs#aspectRatio"; + /** Minimum: 1 */ + height: number; + /** Minimum: 1 */ + width: number; + } +} + +export declare namespace AppBskyEmbedExternal { + /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ + interface Main { + [Brand.Type]?: "app.bsky.embed.external"; + external: External; + } + interface External { + [Brand.Type]?: "app.bsky.embed.external#external"; + description: string; + title: string; + uri: string; + thumb?: At.Blob; + } + interface View { + [Brand.Type]?: "app.bsky.embed.external#view"; + external: ViewExternal; + } + interface ViewExternal { + [Brand.Type]?: "app.bsky.embed.external#viewExternal"; + description: string; + title: string; + uri: string; + thumb?: string; + } +} + +export declare namespace AppBskyEmbedImages { + interface Main { + [Brand.Type]?: "app.bsky.embed.images"; + /** Maximum array length: 4 */ + images: Image[]; + } + interface Image { + [Brand.Type]?: "app.bsky.embed.images#image"; + /** Alt text description of the image, for accessibility. */ + alt: string; + image: At.Blob; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + } + interface View { + [Brand.Type]?: "app.bsky.embed.images#view"; + /** Maximum array length: 4 */ + images: ViewImage[]; + } + interface ViewImage { + [Brand.Type]?: "app.bsky.embed.images#viewImage"; + /** Alt text description of the image, for accessibility. */ + alt: string; + /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ + fullsize: string; + /** Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. */ + thumb: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + } +} + +export declare namespace AppBskyEmbedRecord { + interface Main { + [Brand.Type]?: "app.bsky.embed.record"; + record: ComAtprotoRepoStrongRef.Main; + } + interface View { + [Brand.Type]?: "app.bsky.embed.record#view"; + record: Brand.Union< + | ViewBlocked + | ViewDetached + | ViewNotFound + | ViewRecord + | AppBskyFeedDefs.GeneratorView + | AppBskyGraphDefs.ListView + | AppBskyGraphDefs.StarterPackViewBasic + | AppBskyLabelerDefs.LabelerView + >; + } + interface ViewBlocked { + [Brand.Type]?: "app.bsky.embed.record#viewBlocked"; + author: AppBskyFeedDefs.BlockedAuthor; + blocked: boolean; + uri: At.Uri; + } + interface ViewDetached { + [Brand.Type]?: "app.bsky.embed.record#viewDetached"; + detached: boolean; + uri: At.Uri; + } + interface ViewNotFound { + [Brand.Type]?: "app.bsky.embed.record#viewNotFound"; + notFound: boolean; + uri: At.Uri; + } + interface ViewRecord { + [Brand.Type]?: "app.bsky.embed.record#viewRecord"; + author: AppBskyActorDefs.ProfileViewBasic; + cid: At.CID; + indexedAt: string; + uri: At.Uri; + /** The record data itself. */ + value: unknown; + embeds?: Brand.Union< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedRecord.View + | AppBskyEmbedRecordWithMedia.View + | AppBskyEmbedVideo.View + >[]; + labels?: ComAtprotoLabelDefs.Label[]; + likeCount?: number; + quoteCount?: number; + replyCount?: number; + repostCount?: number; + } +} + +export declare namespace AppBskyEmbedRecordWithMedia { + interface Main { + [Brand.Type]?: "app.bsky.embed.recordWithMedia"; + media: Brand.Union< + | AppBskyEmbedExternal.Main + | AppBskyEmbedImages.Main + | AppBskyEmbedVideo.Main + >; + record: AppBskyEmbedRecord.Main; + } + interface View { + [Brand.Type]?: "app.bsky.embed.recordWithMedia#view"; + media: Brand.Union< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedVideo.View + >; + record: AppBskyEmbedRecord.View; + } +} + +export declare namespace AppBskyEmbedVideo { + interface Main { + [Brand.Type]?: "app.bsky.embed.video"; + video: At.Blob; + /** + * Alt text description of the video, for accessibility. + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + alt?: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + /** Maximum array length: 20 */ + captions?: Caption[]; + } + interface Caption { + [Brand.Type]?: "app.bsky.embed.video#caption"; + file: At.Blob; + lang: string; + } + interface View { + [Brand.Type]?: "app.bsky.embed.video#view"; + cid: At.CID; + playlist: string; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + alt?: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + thumbnail?: string; + } +} + +export declare namespace AppBskyFeedDefs { + interface BlockedAuthor { + [Brand.Type]?: "app.bsky.feed.defs#blockedAuthor"; + did: At.DID; + viewer?: AppBskyActorDefs.ViewerState; + } + interface BlockedPost { + [Brand.Type]?: "app.bsky.feed.defs#blockedPost"; + author: BlockedAuthor; + blocked: boolean; + uri: At.Uri; + } + type ClickthroughAuthor = "app.bsky.feed.defs#clickthroughAuthor"; + type ClickthroughEmbed = "app.bsky.feed.defs#clickthroughEmbed"; + type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; + type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; + interface FeedViewPost { + [Brand.Type]?: "app.bsky.feed.defs#feedViewPost"; + post: PostView; + /** + * Context provided by feed generator that may be passed back alongside interactions. + * Maximum string length: 2000 + */ + feedContext?: string; + reason?: Brand.Union; + reply?: ReplyRef; + } + interface GeneratorView { + [Brand.Type]?: "app.bsky.feed.defs#generatorView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + did: At.DID; + displayName: string; + indexedAt: string; + uri: At.Uri; + acceptsInteractions?: boolean; + avatar?: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: GeneratorViewerState; + } + interface GeneratorViewerState { + [Brand.Type]?: "app.bsky.feed.defs#generatorViewerState"; + like?: At.Uri; + } + interface Interaction { + [Brand.Type]?: "app.bsky.feed.defs#interaction"; + event?: + | "app.bsky.feed.defs#clickthroughAuthor" + | "app.bsky.feed.defs#clickthroughEmbed" + | "app.bsky.feed.defs#clickthroughItem" + | "app.bsky.feed.defs#clickthroughReposter" + | "app.bsky.feed.defs#interactionLike" + | "app.bsky.feed.defs#interactionQuote" + | "app.bsky.feed.defs#interactionReply" + | "app.bsky.feed.defs#interactionRepost" + | "app.bsky.feed.defs#interactionSeen" + | "app.bsky.feed.defs#interactionShare" + | "app.bsky.feed.defs#requestLess" + | "app.bsky.feed.defs#requestMore" + | (string & {}); + /** + * Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. + * Maximum string length: 2000 + */ + feedContext?: string; + item?: At.Uri; + } + type InteractionLike = "app.bsky.feed.defs#interactionLike"; + type InteractionQuote = "app.bsky.feed.defs#interactionQuote"; + type InteractionReply = "app.bsky.feed.defs#interactionReply"; + type InteractionRepost = "app.bsky.feed.defs#interactionRepost"; + type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; + type InteractionShare = "app.bsky.feed.defs#interactionShare"; + interface NotFoundPost { + [Brand.Type]?: "app.bsky.feed.defs#notFoundPost"; + notFound: boolean; + uri: At.Uri; + } + interface PostView { + [Brand.Type]?: "app.bsky.feed.defs#postView"; + author: AppBskyActorDefs.ProfileViewBasic; + cid: At.CID; + indexedAt: string; + record: unknown; + uri: At.Uri; + embed?: Brand.Union< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedRecord.View + | AppBskyEmbedRecordWithMedia.View + | AppBskyEmbedVideo.View + >; + labels?: ComAtprotoLabelDefs.Label[]; + likeCount?: number; + quoteCount?: number; + replyCount?: number; + repostCount?: number; + threadgate?: ThreadgateView; + viewer?: ViewerState; + } + interface ReasonPin { + [Brand.Type]?: "app.bsky.feed.defs#reasonPin"; + } + interface ReasonRepost { + [Brand.Type]?: "app.bsky.feed.defs#reasonRepost"; + by: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + } + interface ReplyRef { + [Brand.Type]?: "app.bsky.feed.defs#replyRef"; + parent: Brand.Union; + root: Brand.Union; + /** When parent is a reply to another post, this is the author of that post. */ + grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic; + } + type RequestLess = "app.bsky.feed.defs#requestLess"; + type RequestMore = "app.bsky.feed.defs#requestMore"; + interface SkeletonFeedPost { + [Brand.Type]?: "app.bsky.feed.defs#skeletonFeedPost"; + post: At.Uri; + /** + * Context that will be passed through to client and may be passed to feed generator back alongside interactions. + * Maximum string length: 2000 + */ + feedContext?: string; + reason?: Brand.Union; + } + interface SkeletonReasonPin { + [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonPin"; + } + interface SkeletonReasonRepost { + [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonRepost"; + repost: At.Uri; + } + interface ThreadgateView { + [Brand.Type]?: "app.bsky.feed.defs#threadgateView"; + cid?: At.CID; + lists?: AppBskyGraphDefs.ListViewBasic[]; + record?: unknown; + uri?: At.Uri; + } + interface ThreadViewPost { + [Brand.Type]?: "app.bsky.feed.defs#threadViewPost"; + post: PostView; + parent?: Brand.Union; + replies?: Brand.Union[]; + } + /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ + interface ViewerState { + [Brand.Type]?: "app.bsky.feed.defs#viewerState"; + embeddingDisabled?: boolean; + like?: At.Uri; + pinned?: boolean; + replyDisabled?: boolean; + repost?: At.Uri; + threadMuted?: boolean; + } +} + +/** Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). */ +export declare namespace AppBskyFeedDescribeFeedGenerator { + interface Params {} + type Input = undefined; + interface Output { + did: At.DID; + feeds: Feed[]; + links?: Links; + } + interface Feed { + [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#feed"; + uri: At.Uri; + } + interface Links { + [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#links"; + privacyPolicy?: string; + termsOfService?: string; + } +} + +export declare namespace AppBskyFeedGenerator { + /** Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. */ + interface Record { + $type: "app.bsky.feed.generator"; + createdAt: string; + did: At.DID; + /** + * Maximum string length: 240 + * Maximum grapheme length: 24 + */ + displayName: string; + /** Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions */ + acceptsInteractions?: boolean; + avatar?: At.Blob; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + /** Self-label values */ + labels?: Brand.Union; + } +} + +/** Get a list of feeds (feed generator records) created by the actor (in the actor's repo). */ +export declare namespace AppBskyFeedGetActorFeeds { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. */ +export declare namespace AppBskyFeedGetActorLikes { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + BlockedActor: {}; + BlockedByActor: {}; + } +} + +/** Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. */ +export declare namespace AppBskyFeedGetAuthorFeed { + interface Params { + actor: string; + cursor?: string; + /** + * Combinations of post/repost types to include in response. + * \@default "posts_with_replies" + */ + filter?: + | "posts_and_author_threads" + | "posts_no_replies" + | "posts_with_media" + | "posts_with_replies" + | (string & {}); + /** \@default false */ + includePins?: boolean; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + BlockedActor: {}; + BlockedByActor: {}; + } +} + +/** Get a hydrated feed from an actor's selected feed generator. Implemented by App View. */ +export declare namespace AppBskyFeedGetFeed { + interface Params { + feed: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + UnknownFeed: {}; + } +} + +/** Get information about a feed generator. Implemented by AppView. */ +export declare namespace AppBskyFeedGetFeedGenerator { + interface Params { + /** AT-URI of the feed generator record. */ + feed: At.Uri; + } + type Input = undefined; + interface Output { + /** Indicates whether the feed generator service has been online recently, or else seems to be inactive. */ + isOnline: boolean; + /** Indicates whether the feed generator service is compatible with the record declaration. */ + isValid: boolean; + view: AppBskyFeedDefs.GeneratorView; + } +} + +/** Get information about a list of feed generators. */ +export declare namespace AppBskyFeedGetFeedGenerators { + interface Params { + feeds: At.Uri[]; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + } +} + +/** Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. */ +export declare namespace AppBskyFeedGetFeedSkeleton { + interface Params { + /** Reference to feed generator record describing the specific feed being requested. */ + feed: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.SkeletonFeedPost[]; + cursor?: string; + } + interface Errors { + UnknownFeed: {}; + } +} + +/** Get like records which reference a subject (by AT-URI and CID). */ +export declare namespace AppBskyFeedGetLikes { + interface Params { + /** AT-URI of the subject (eg, a post record). */ + uri: At.Uri; + /** CID of the subject record (aka, specific version of record), to filter likes. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + likes: Like[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } + interface Like { + [Brand.Type]?: "app.bsky.feed.getLikes#like"; + actor: AppBskyActorDefs.ProfileView; + createdAt: string; + indexedAt: string; + } +} + +/** Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. */ +export declare namespace AppBskyFeedGetListFeed { + interface Params { + /** Reference (AT-URI) to the list record. */ + list: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors { + UnknownList: {}; + } +} + +/** Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. */ +export declare namespace AppBskyFeedGetPosts { + interface Params { + /** + * List of post AT-URIs to return hydrated views for. + * Maximum array length: 25 + */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output { + posts: AppBskyFeedDefs.PostView[]; + } +} + +/** Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. */ +export declare namespace AppBskyFeedGetPostThread { + interface Params { + /** Reference (AT-URI) to post record. */ + uri: At.Uri; + /** + * How many levels of reply depth should be included in response. + * Minimum: 0 + * Maximum: 1000 + * \@default 6 + */ + depth?: number; + /** + * How many levels of parent (and grandparent, etc) post to include. + * Minimum: 0 + * Maximum: 1000 + * \@default 80 + */ + parentHeight?: number; + } + type Input = undefined; + interface Output { + thread: Brand.Union< + | AppBskyFeedDefs.BlockedPost + | AppBskyFeedDefs.NotFoundPost + | AppBskyFeedDefs.ThreadViewPost + >; + threadgate?: AppBskyFeedDefs.ThreadgateView; + } + interface Errors { + NotFound: {}; + } +} + +/** Get a list of quotes for a given post. */ +export declare namespace AppBskyFeedGetQuotes { + interface Params { + /** Reference (AT-URI) of post record */ + uri: At.Uri; + /** If supplied, filters to quotes of specific version (by CID) of the post record. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + posts: AppBskyFeedDefs.PostView[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } +} + +/** Get a list of reposts for a given post. */ +export declare namespace AppBskyFeedGetRepostedBy { + interface Params { + /** Reference (AT-URI) of post record */ + uri: At.Uri; + /** If supplied, filters to reposts of specific version (by CID) of the post record. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + repostedBy: AppBskyActorDefs.ProfileView[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } +} + +/** Get a list of suggested feeds (feed generators) for the requesting account. */ +export declare namespace AppBskyFeedGetSuggestedFeeds { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. */ +export declare namespace AppBskyFeedGetTimeline { + interface Params { + /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ + algorithm?: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } +} + +export declare namespace AppBskyFeedLike { + /** Record declaring a 'like' of a piece of subject content. */ + interface Record { + $type: "app.bsky.feed.like"; + createdAt: string; + subject: ComAtprotoRepoStrongRef.Main; + } +} + +export declare namespace AppBskyFeedPost { + /** Record containing a Bluesky post. */ + interface Record { + $type: "app.bsky.feed.post"; + /** Client-declared timestamp when this post was originally created. */ + createdAt: string; + /** + * The primary post content. May be an empty string, if there are embeds. + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + text: string; + embed?: Brand.Union< + | AppBskyEmbedExternal.Main + | AppBskyEmbedImages.Main + | AppBskyEmbedRecord.Main + | AppBskyEmbedRecordWithMedia.Main + | AppBskyEmbedVideo.Main + >; + /** + * DEPRECATED: replaced by app.bsky.richtext.facet. + * \@deprecated + */ + entities?: Entity[]; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + /** Self-label values for this post. Effectively content warnings. */ + labels?: Brand.Union; + /** + * Indicates human language of post primary text content. + * Maximum array length: 3 + */ + langs?: string[]; + reply?: ReplyRef; + /** + * Additional hashtags, in addition to any included in post text and facets. + * Maximum array length: 8 + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tags?: string[]; + } + /** + * Deprecated: use facets instead. + * \@deprecated + */ + interface Entity { + [Brand.Type]?: "app.bsky.feed.post#entity"; + index: TextSlice; + /** Expected values are 'mention' and 'link'. */ + type: string; + value: string; + } + interface ReplyRef { + [Brand.Type]?: "app.bsky.feed.post#replyRef"; + parent: ComAtprotoRepoStrongRef.Main; + root: ComAtprotoRepoStrongRef.Main; + } + /** + * Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. + * \@deprecated + */ + interface TextSlice { + [Brand.Type]?: "app.bsky.feed.post#textSlice"; + /** Minimum: 0 */ + end: number; + /** Minimum: 0 */ + start: number; + } +} + +export declare namespace AppBskyFeedPostgate { + /** Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. */ + interface Record { + $type: "app.bsky.feed.postgate"; + createdAt: string; + /** Reference (AT-URI) to the post record. */ + post: At.Uri; + /** + * List of AT-URIs embedding this post that the author has detached from. + * Maximum array length: 50 + */ + detachedEmbeddingUris?: At.Uri[]; + /** Maximum array length: 5 */ + embeddingRules?: Brand.Union[]; + } + /** Disables embedding of this post. */ + interface DisableRule { + [Brand.Type]?: "app.bsky.feed.postgate#disableRule"; + } +} + +export declare namespace AppBskyFeedRepost { + /** Record representing a 'repost' of an existing Bluesky post. */ + interface Record { + $type: "app.bsky.feed.repost"; + createdAt: string; + subject: ComAtprotoRepoStrongRef.Main; + } +} + +/** Find posts matching search criteria, returning views of those posts. */ +export declare namespace AppBskyFeedSearchPosts { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ + author?: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ + domain?: string; + /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ + lang?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ + mentions?: string; + /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ + since?: string; + /** + * Specifies the ranking order of results. + * \@default "latest" + */ + sort?: "latest" | "top" | (string & {}); + /** + * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag?: string[]; + /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ + until?: string; + /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ + url?: string; + } + type Input = undefined; + interface Output { + posts: AppBskyFeedDefs.PostView[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +/** Send information about interactions with feed items back to the feed generator that served them. */ +export declare namespace AppBskyFeedSendInteractions { + interface Params {} + interface Input { + interactions: AppBskyFeedDefs.Interaction[]; + } + interface Output {} +} + +export declare namespace AppBskyFeedThreadgate { + /** Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. */ + interface Record { + $type: "app.bsky.feed.threadgate"; + createdAt: string; + /** Reference (AT-URI) to the post record. */ + post: At.Uri; + /** Maximum array length: 5 */ + allow?: Brand.Union[]; + /** + * List of hidden reply URIs. + * Maximum array length: 50 + */ + hiddenReplies?: At.Uri[]; + } + /** Allow replies from actors you follow. */ + interface FollowingRule { + [Brand.Type]?: "app.bsky.feed.threadgate#followingRule"; + } + /** Allow replies from actors on a list. */ + interface ListRule { + [Brand.Type]?: "app.bsky.feed.threadgate#listRule"; + list: At.Uri; + } + /** Allow replies from actors mentioned in your post. */ + interface MentionRule { + [Brand.Type]?: "app.bsky.feed.threadgate#mentionRule"; + } +} + +export declare namespace AppBskyGraphBlock { + /** Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. */ + interface Record { + $type: "app.bsky.graph.block"; + createdAt: string; + /** DID of the account to be blocked. */ + subject: At.DID; + } +} + +export declare namespace AppBskyGraphDefs { + type Curatelist = "app.bsky.graph.defs#curatelist"; + interface ListItemView { + [Brand.Type]?: "app.bsky.graph.defs#listItemView"; + subject: AppBskyActorDefs.ProfileView; + uri: At.Uri; + } + type ListPurpose = + | "app.bsky.graph.defs#curatelist" + | "app.bsky.graph.defs#modlist" + | "app.bsky.graph.defs#referencelist" + | (string & {}); + interface ListView { + [Brand.Type]?: "app.bsky.graph.defs#listView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + /** + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + purpose: ListPurpose; + uri: At.Uri; + avatar?: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + viewer?: ListViewerState; + } + interface ListViewBasic { + [Brand.Type]?: "app.bsky.graph.defs#listViewBasic"; + cid: At.CID; + /** + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + purpose: ListPurpose; + uri: At.Uri; + avatar?: string; + indexedAt?: string; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + viewer?: ListViewerState; + } + interface ListViewerState { + [Brand.Type]?: "app.bsky.graph.defs#listViewerState"; + blocked?: At.Uri; + muted?: boolean; + } + type Modlist = "app.bsky.graph.defs#modlist"; + /** indicates that a handle or DID could not be resolved */ + interface NotFoundActor { + [Brand.Type]?: "app.bsky.graph.defs#notFoundActor"; + actor: string; + notFound: boolean; + } + type Referencelist = "app.bsky.graph.defs#referencelist"; + /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ + interface Relationship { + [Brand.Type]?: "app.bsky.graph.defs#relationship"; + did: At.DID; + /** if the actor is followed by this DID, contains the AT-URI of the follow record */ + followedBy?: At.Uri; + /** if the actor follows this DID, this is the AT-URI of the follow record */ + following?: At.Uri; + } + interface StarterPackView { + [Brand.Type]?: "app.bsky.graph.defs#starterPackView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + record: unknown; + uri: At.Uri; + /** Maximum array length: 3 */ + feeds?: AppBskyFeedDefs.GeneratorView[]; + /** Minimum: 0 */ + joinedAllTimeCount?: number; + /** Minimum: 0 */ + joinedWeekCount?: number; + labels?: ComAtprotoLabelDefs.Label[]; + list?: ListViewBasic; + /** Maximum array length: 12 */ + listItemsSample?: ListItemView[]; + } + interface StarterPackViewBasic { + [Brand.Type]?: "app.bsky.graph.defs#starterPackViewBasic"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + record: unknown; + uri: At.Uri; + /** Minimum: 0 */ + joinedAllTimeCount?: number; + /** Minimum: 0 */ + joinedWeekCount?: number; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + } +} + +export declare namespace AppBskyGraphFollow { + /** Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. */ + interface Record { + $type: "app.bsky.graph.follow"; + createdAt: string; + subject: At.DID; + } +} + +/** Get a list of starter packs created by the actor. */ +export declare namespace AppBskyGraphGetActorStarterPacks { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + cursor?: string; + } +} + +/** Enumerates which accounts the requesting account is currently blocking. Requires auth. */ +export declare namespace AppBskyGraphGetBlocks { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + blocks: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Enumerates accounts which follow a specified account (actor). */ +export declare namespace AppBskyGraphGetFollowers { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + followers: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Enumerates accounts which a specified account (actor) follows. */ +export declare namespace AppBskyGraphGetFollows { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + follows: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Enumerates accounts which follow a specified account (actor) and are followed by the viewer. */ +export declare namespace AppBskyGraphGetKnownFollowers { + interface Params { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + followers: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Gets a 'view' (with additional context) of a specified list. */ +export declare namespace AppBskyGraphGetList { + interface Params { + /** Reference (AT-URI) of the list record to hydrate. */ + list: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + items: AppBskyGraphDefs.ListItemView[]; + list: AppBskyGraphDefs.ListView; + cursor?: string; + } +} + +/** Get mod lists that the requesting account (actor) is blocking. Requires auth. */ +export declare namespace AppBskyGraphGetListBlocks { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. */ +export declare namespace AppBskyGraphGetListMutes { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates the lists created by a specified account (actor). */ +export declare namespace AppBskyGraphGetLists { + interface Params { + /** The account (actor) to enumerate lists from. */ + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. */ +export declare namespace AppBskyGraphGetMutes { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + mutes: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Enumerates public relationships between one account, and a list of other accounts. Does not require auth. */ +export declare namespace AppBskyGraphGetRelationships { + interface Params { + /** Primary account requesting relationships for. */ + actor: string; + /** + * List of 'other' accounts to be related back to the primary. + * Maximum array length: 30 + */ + others?: string[]; + } + type Input = undefined; + interface Output { + relationships: Brand.Union< + AppBskyGraphDefs.NotFoundActor | AppBskyGraphDefs.Relationship + >[]; + actor?: At.DID; + } + interface Errors { + ActorNotFound: {}; + } +} + +/** Gets a view of a starter pack. */ +export declare namespace AppBskyGraphGetStarterPack { + interface Params { + /** Reference (AT-URI) of the starter pack record. */ + starterPack: At.Uri; + } + type Input = undefined; + interface Output { + starterPack: AppBskyGraphDefs.StarterPackView; + } +} + +/** Get views for a list of starter packs. */ +export declare namespace AppBskyGraphGetStarterPacks { + interface Params { + /** Maximum array length: 25 */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + } +} + +/** Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. */ +export declare namespace AppBskyGraphGetSuggestedFollowsByActor { + interface Params { + actor: string; + } + type Input = undefined; + interface Output { + suggestions: AppBskyActorDefs.ProfileView[]; + /** + * If true, response has fallen-back to generic results, and is not scoped using relativeToDid + * \@default false + */ + isFallback?: boolean; + } +} + +export declare namespace AppBskyGraphList { + /** Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. */ + interface Record { + $type: "app.bsky.graph.list"; + createdAt: string; + /** + * Display name for list; can not be empty. + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + /** Defines the purpose of the list (aka, moderation-oriented or curration-oriented) */ + purpose: AppBskyGraphDefs.ListPurpose; + avatar?: At.Blob; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: Brand.Union; + } +} + +export declare namespace AppBskyGraphListblock { + /** Record representing a block relationship against an entire an entire list of accounts (actors). */ + interface Record { + $type: "app.bsky.graph.listblock"; + createdAt: string; + /** Reference (AT-URI) to the mod list record. */ + subject: At.Uri; + } +} + +export declare namespace AppBskyGraphListitem { + /** Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. */ + interface Record { + $type: "app.bsky.graph.listitem"; + createdAt: string; + /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ + list: At.Uri; + /** The account which is included on the list. */ + subject: At.DID; + } +} + +/** Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteActor { + interface Params {} + interface Input { + actor: string; + } + type Output = undefined; +} + +/** Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteActorList { + interface Params {} + interface Input { + list: At.Uri; + } + type Output = undefined; +} + +/** Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteThread { + interface Params {} + interface Input { + root: At.Uri; + } + type Output = undefined; +} + +/** Find starter packs matching search criteria. Does not require auth. */ +export declare namespace AppBskyGraphSearchStarterPacks { + interface Params { + /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + cursor?: string; + } +} + +export declare namespace AppBskyGraphStarterpack { + /** Record defining a starter pack of actors and feeds for new users. */ + interface Record { + $type: "app.bsky.graph.starterpack"; + createdAt: string; + /** Reference (AT-URI) to the list record. */ + list: At.Uri; + /** + * Display name for starter pack; can not be empty. + * Minimum string length: 1 + * Maximum string length: 500 + * Maximum grapheme length: 50 + */ + name: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + /** Maximum array length: 3 */ + feeds?: FeedItem[]; + } + interface FeedItem { + [Brand.Type]?: "app.bsky.graph.starterpack#feedItem"; + uri: At.Uri; + } +} + +/** Unmutes the specified account. Requires auth. */ +export declare namespace AppBskyGraphUnmuteActor { + interface Params {} + interface Input { + actor: string; + } + type Output = undefined; +} + +/** Unmutes the specified list of accounts. Requires auth. */ +export declare namespace AppBskyGraphUnmuteActorList { + interface Params {} + interface Input { + list: At.Uri; + } + type Output = undefined; +} + +/** Unmutes the specified thread. Requires auth. */ +export declare namespace AppBskyGraphUnmuteThread { + interface Params {} + interface Input { + root: At.Uri; + } + type Output = undefined; +} + +export declare namespace AppBskyLabelerDefs { + interface LabelerPolicies { + [Brand.Type]?: "app.bsky.labeler.defs#labelerPolicies"; + /** The label values which this labeler publishes. May include global or custom labels. */ + labelValues: ComAtprotoLabelDefs.LabelValue[]; + /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ + labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; + } + interface LabelerView { + [Brand.Type]?: "app.bsky.labeler.defs#labelerView"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: LabelerViewerState; + } + interface LabelerViewDetailed { + [Brand.Type]?: "app.bsky.labeler.defs#labelerViewDetailed"; + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + policies: AppBskyLabelerDefs.LabelerPolicies; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: LabelerViewerState; + } + interface LabelerViewerState { + [Brand.Type]?: "app.bsky.labeler.defs#labelerViewerState"; + like?: At.Uri; + } +} + +/** Get information about a list of labeler services. */ +export declare namespace AppBskyLabelerGetServices { + interface Params { + dids: At.DID[]; + /** \@default false */ + detailed?: boolean; + } + type Input = undefined; + interface Output { + views: Brand.Union< + AppBskyLabelerDefs.LabelerView | AppBskyLabelerDefs.LabelerViewDetailed + >[]; + } +} + +export declare namespace AppBskyLabelerService { + /** A declaration of the existence of labeler service. */ + interface Record { + $type: "app.bsky.labeler.service"; + createdAt: string; + policies: AppBskyLabelerDefs.LabelerPolicies; + labels?: Brand.Union; + } +} + +/** Count the number of unread notifications for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationGetUnreadCount { + interface Params { + priority?: boolean; + seenAt?: string; + } + type Input = undefined; + interface Output { + count: number; + } +} + +/** Enumerate notifications for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationListNotifications { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + priority?: boolean; + seenAt?: string; + } + type Input = undefined; + interface Output { + notifications: Notification[]; + cursor?: string; + priority?: boolean; + seenAt?: string; + } + interface Notification { + [Brand.Type]?: "app.bsky.notification.listNotifications#notification"; + author: AppBskyActorDefs.ProfileView; + cid: At.CID; + indexedAt: string; + isRead: boolean; + /** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', and 'starterpack-joined'. */ + reason: + | "follow" + | "like" + | "mention" + | "quote" + | "reply" + | "repost" + | "starterpack-joined" + | (string & {}); + record: unknown; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + reasonSubject?: At.Uri; + } +} + +/** Set notification-related preferences for an account. Requires auth. */ +export declare namespace AppBskyNotificationPutPreferences { + interface Params {} + interface Input { + priority: boolean; + } + type Output = undefined; +} + +/** Register to receive push notifications, via a specified service, for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationRegisterPush { + interface Params {} + interface Input { + appId: string; + platform: "android" | "ios" | "web" | (string & {}); + serviceDid: At.DID; + token: string; + } + type Output = undefined; +} + +/** Notify server that the requesting account has seen notifications. Requires auth. */ +export declare namespace AppBskyNotificationUpdateSeen { + interface Params {} + interface Input { + seenAt: string; + } + type Output = undefined; +} + +export declare namespace AppBskyRichtextFacet { + /** Annotation of a sub-string within rich text. */ + interface Main { + [Brand.Type]?: "app.bsky.richtext.facet"; + features: Brand.Union[]; + index: ByteSlice; + } + /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ + interface ByteSlice { + [Brand.Type]?: "app.bsky.richtext.facet#byteSlice"; + /** Minimum: 0 */ + byteEnd: number; + /** Minimum: 0 */ + byteStart: number; + } + /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ + interface Link { + [Brand.Type]?: "app.bsky.richtext.facet#link"; + uri: string; + } + /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ + interface Mention { + [Brand.Type]?: "app.bsky.richtext.facet#mention"; + did: At.DID; + } + /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ + interface Tag { + [Brand.Type]?: "app.bsky.richtext.facet#tag"; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag: string; + } +} + +export declare namespace AppBskyUnspeccedDefs { + interface SkeletonSearchActor { + [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchActor"; + did: At.DID; + } + interface SkeletonSearchPost { + [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchPost"; + uri: At.Uri; + } + interface SkeletonSearchStarterPack { + [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; + uri: At.Uri; + } +} + +/** Get miscellaneous runtime configuration. */ +export declare namespace AppBskyUnspeccedGetConfig { + interface Params {} + type Input = undefined; + interface Output { + checkEmailConfirmed?: boolean; + } +} + +/** An unspecced view of globally popular feed generators. */ +export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + query?: string; + } + type Input = undefined; + interface Output { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions */ +export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. */ + relativeToDid?: At.DID; + /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; + cursor?: string; + /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ + relativeToDid?: At.DID; + } +} + +/** Get a list of suggestions (feeds and users) tagged with categories */ +export declare namespace AppBskyUnspeccedGetTaggedSuggestions { + type Input = undefined; + interface Output { + suggestions: Suggestion[]; + } + interface Suggestion { + [Brand.Type]?: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; + subject: string; + subjectType: "actor" | "feed" | (string & {}); + tag: string; + } +} + +/** Backend Actors (profile) search, returns only skeleton. */ +export declare namespace AppBskyUnspeccedSearchActorsSkeleton { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ + q: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** If true, acts as fast/simple 'typeahead' query. */ + typeahead?: boolean; + /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +/** Backend Posts search, returns only skeleton */ +export declare namespace AppBskyUnspeccedSearchPostsSkeleton { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ + author?: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ + domain?: string; + /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ + lang?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ + mentions?: string; + /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ + since?: string; + /** + * Specifies the ranking order of results. + * \@default "latest" + */ + sort?: "latest" | "top" | (string & {}); + /** + * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag?: string[]; + /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ + until?: string; + /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ + url?: string; + /** DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +/** Backend Starter Pack search, returns only skeleton. */ +export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { + interface Params { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** DID of the account making the request (not included for public/unauthenticated queries). */ + viewer?: At.DID; + } + type Input = undefined; + interface Output { + starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors { + BadQueryString: {}; + } +} + +export declare namespace AppBskyVideoDefs { + interface JobStatus { + [Brand.Type]?: "app.bsky.video.defs#jobStatus"; + did: At.DID; + jobId: string; + /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ + state: "JOB_STATE_COMPLETED" | "JOB_STATE_FAILED" | (string & {}); + blob?: At.Blob; + error?: string; + message?: string; + /** + * Progress within the current processing state. + * Minimum: 0 + * Maximum: 100 + */ + progress?: number; + } +} + +/** Get status details for a video processing job. */ +export declare namespace AppBskyVideoGetJobStatus { + interface Params { + jobId: string; + } + type Input = undefined; + interface Output { + jobStatus: AppBskyVideoDefs.JobStatus; + } +} + +/** Get video upload limits for the authenticated user. */ +export declare namespace AppBskyVideoGetUploadLimits { + interface Params {} + type Input = undefined; + interface Output { + canUpload: boolean; + error?: string; + message?: string; + remainingDailyBytes?: number; + remainingDailyVideos?: number; + } +} + +/** Upload a video to be processed then stored on the PDS. */ +export declare namespace AppBskyVideoUploadVideo { + interface Params {} + type Input = Blob | ArrayBufferView; + interface Output { + jobStatus: AppBskyVideoDefs.JobStatus; + } +} + +export declare namespace ChatBskyActorDeclaration { + /** A declaration of a Bluesky chat account. */ + interface Record { + $type: "chat.bsky.actor.declaration"; + allowIncoming: "all" | "following" | "none" | (string & {}); + } +} + +export declare namespace ChatBskyActorDefs { + interface ProfileViewBasic { + [Brand.Type]?: "chat.bsky.actor.defs#profileViewBasic"; + did: At.DID; + handle: At.Handle; + associated?: AppBskyActorDefs.ProfileAssociated; + avatar?: string; + /** Set to true when the actor cannot actively participate in converations */ + chatDisabled?: boolean; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: AppBskyActorDefs.ViewerState; + } +} + +export declare namespace ChatBskyActorDeleteAccount { + interface Params {} + type Input = undefined; + interface Output {} +} + +export declare namespace ChatBskyActorExportAccountData { + interface Params {} + type Input = undefined; + type Output = Uint8Array; +} + +export declare namespace ChatBskyConvoDefs { + interface ConvoView { + [Brand.Type]?: "chat.bsky.convo.defs#convoView"; + id: string; + members: ChatBskyActorDefs.ProfileViewBasic[]; + muted: boolean; + rev: string; + unreadCount: number; + lastMessage?: Brand.Union; + opened?: boolean; + } + interface DeletedMessageView { + [Brand.Type]?: "chat.bsky.convo.defs#deletedMessageView"; + id: string; + rev: string; + sender: MessageViewSender; + sentAt: string; + } + interface LogBeginConvo { + [Brand.Type]?: "chat.bsky.convo.defs#logBeginConvo"; + convoId: string; + rev: string; + } + interface LogCreateMessage { + [Brand.Type]?: "chat.bsky.convo.defs#logCreateMessage"; + convoId: string; + message: Brand.Union; + rev: string; + } + interface LogDeleteMessage { + [Brand.Type]?: "chat.bsky.convo.defs#logDeleteMessage"; + convoId: string; + message: Brand.Union; + rev: string; + } + interface LogLeaveConvo { + [Brand.Type]?: "chat.bsky.convo.defs#logLeaveConvo"; + convoId: string; + rev: string; + } + interface MessageInput { + [Brand.Type]?: "chat.bsky.convo.defs#messageInput"; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + text: string; + embed?: Brand.Union; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + } + interface MessageRef { + [Brand.Type]?: "chat.bsky.convo.defs#messageRef"; + convoId: string; + did: At.DID; + messageId: string; + } + interface MessageView { + [Brand.Type]?: "chat.bsky.convo.defs#messageView"; + id: string; + rev: string; + sender: MessageViewSender; + sentAt: string; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + text: string; + embed?: Brand.Union; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + } + interface MessageViewSender { + [Brand.Type]?: "chat.bsky.convo.defs#messageViewSender"; + did: At.DID; + } +} + +export declare namespace ChatBskyConvoDeleteMessageForSelf { + interface Params {} + interface Input { + convoId: string; + messageId: string; + } + type Output = ChatBskyConvoDefs.DeletedMessageView; +} + +export declare namespace ChatBskyConvoGetConvo { + interface Params { + convoId: string; + } + type Input = undefined; + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoGetConvoForMembers { + interface Params { + /** + * Minimum array length: 1 + * Maximum array length: 10 + */ + members: At.DID[]; + } + type Input = undefined; + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoGetLog { + interface Params { + cursor?: string; + } + type Input = undefined; + interface Output { + logs: Brand.Union< + | ChatBskyConvoDefs.LogBeginConvo + | ChatBskyConvoDefs.LogCreateMessage + | ChatBskyConvoDefs.LogDeleteMessage + | ChatBskyConvoDefs.LogLeaveConvo + >[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoGetMessages { + interface Params { + convoId: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + messages: Brand.Union< + ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView + >[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoLeaveConvo { + interface Params {} + interface Input { + convoId: string; + } + interface Output { + convoId: string; + rev: string; + } +} + +export declare namespace ChatBskyConvoListConvos { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + convos: ChatBskyConvoDefs.ConvoView[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoMuteConvo { + interface Params {} + interface Input { + convoId: string; + } + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoSendMessage { + interface Params {} + interface Input { + convoId: string; + message: ChatBskyConvoDefs.MessageInput; + } + type Output = ChatBskyConvoDefs.MessageView; +} + +export declare namespace ChatBskyConvoSendMessageBatch { + interface Params {} + interface Input { + /** Maximum array length: 100 */ + items: BatchItem[]; + } + interface Output { + items: ChatBskyConvoDefs.MessageView[]; + } + interface BatchItem { + [Brand.Type]?: "chat.bsky.convo.sendMessageBatch#batchItem"; + convoId: string; + message: ChatBskyConvoDefs.MessageInput; + } +} + +export declare namespace ChatBskyConvoUnmuteConvo { + interface Params {} + interface Input { + convoId: string; + } + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoUpdateRead { + interface Params {} + interface Input { + convoId: string; + messageId?: string; + } + interface Output { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyModerationGetActorMetadata { + interface Params { + actor: At.DID; + } + type Input = undefined; + interface Output { + all: Metadata; + day: Metadata; + month: Metadata; + } + interface Metadata { + [Brand.Type]?: "chat.bsky.moderation.getActorMetadata#metadata"; + convos: number; + convosStarted: number; + messagesReceived: number; + messagesSent: number; + } +} + +export declare namespace ChatBskyModerationGetMessageContext { + interface Params { + messageId: string; + /** \@default 5 */ + after?: number; + /** \@default 5 */ + before?: number; + /** Conversation that the message is from. NOTE: this field will eventually be required. */ + convoId?: string; + } + type Input = undefined; + interface Output { + messages: Brand.Union< + ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView + >[]; + } +} + +export declare namespace ChatBskyModerationUpdateActorAccess { + interface Params {} + interface Input { + actor: At.DID; + allowAccess: boolean; + ref?: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoAdminDefs { + interface AccountView { + [Brand.Type]?: "com.atproto.admin.defs#accountView"; + did: At.DID; + handle: At.Handle; + indexedAt: string; + deactivatedAt?: string; + email?: string; + emailConfirmedAt?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invites?: ComAtprotoServerDefs.InviteCode[]; + invitesDisabled?: boolean; + relatedRecords?: unknown[]; + threatSignatures?: ThreatSignature[]; + } + interface RepoBlobRef { + [Brand.Type]?: "com.atproto.admin.defs#repoBlobRef"; + cid: At.CID; + did: At.DID; + recordUri?: At.Uri; + } + interface RepoRef { + [Brand.Type]?: "com.atproto.admin.defs#repoRef"; + did: At.DID; + } + interface StatusAttr { + [Brand.Type]?: "com.atproto.admin.defs#statusAttr"; + applied: boolean; + ref?: string; + } + interface ThreatSignature { + [Brand.Type]?: "com.atproto.admin.defs#threatSignature"; + property: string; + value: string; + } +} + +/** Delete a user account as an administrator. */ +export declare namespace ComAtprotoAdminDeleteAccount { + interface Params {} + interface Input { + did: At.DID; + } + type Output = undefined; +} + +/** Disable an account from receiving new invite codes, but does not invalidate existing codes. */ +export declare namespace ComAtprotoAdminDisableAccountInvites { + interface Params {} + interface Input { + account: At.DID; + /** Optional reason for disabled invites. */ + note?: string; + } + type Output = undefined; +} + +/** Disable some set of codes and/or all codes associated with a set of users. */ +export declare namespace ComAtprotoAdminDisableInviteCodes { + interface Params {} + interface Input { + accounts?: string[]; + codes?: string[]; + } + type Output = undefined; +} + +/** Re-enable an account's ability to receive invite codes. */ +export declare namespace ComAtprotoAdminEnableAccountInvites { + interface Params {} + interface Input { + account: At.DID; + /** Optional reason for enabled invites. */ + note?: string; + } + type Output = undefined; +} + +/** Get details about an account. */ +export declare namespace ComAtprotoAdminGetAccountInfo { + interface Params { + did: At.DID; + } + type Input = undefined; + type Output = ComAtprotoAdminDefs.AccountView; +} + +/** Get details about some accounts. */ +export declare namespace ComAtprotoAdminGetAccountInfos { + interface Params { + dids: At.DID[]; + } + type Input = undefined; + interface Output { + infos: ComAtprotoAdminDefs.AccountView[]; + } +} + +/** Get an admin view of invite codes. */ +export declare namespace ComAtprotoAdminGetInviteCodes { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 500 + * \@default 100 + */ + limit?: number; + /** \@default "recent" */ + sort?: "recent" | "usage" | (string & {}); + } + type Input = undefined; + interface Output { + codes: ComAtprotoServerDefs.InviteCode[]; + cursor?: string; + } +} + +/** Get the service-specific admin status of a subject (account, record, or blob). */ +export declare namespace ComAtprotoAdminGetSubjectStatus { + interface Params { + blob?: At.CID; + did?: At.DID; + uri?: At.Uri; + } + type Input = undefined; + interface Output { + subject: Brand.Union< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + deactivated?: ComAtprotoAdminDefs.StatusAttr; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } +} + +/** Get list of accounts that matches your search query. */ +export declare namespace ComAtprotoAdminSearchAccounts { + interface Params { + cursor?: string; + email?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + accounts: ComAtprotoAdminDefs.AccountView[]; + cursor?: string; + } +} + +/** Send email to a user's account email address. */ +export declare namespace ComAtprotoAdminSendEmail { + interface Params {} + interface Input { + content: string; + recipientDid: At.DID; + senderDid: At.DID; + /** Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers */ + comment?: string; + subject?: string; + } + interface Output { + sent: boolean; + } +} + +/** Administrative action to update an account's email. */ +export declare namespace ComAtprotoAdminUpdateAccountEmail { + interface Params {} + interface Input { + /** The handle or DID of the repo. */ + account: string; + email: string; + } + type Output = undefined; +} + +/** Administrative action to update an account's handle. */ +export declare namespace ComAtprotoAdminUpdateAccountHandle { + interface Params {} + interface Input { + did: At.DID; + handle: At.Handle; + } + type Output = undefined; +} + +/** Update the password for a user account as an administrator. */ +export declare namespace ComAtprotoAdminUpdateAccountPassword { + interface Params {} + interface Input { + did: At.DID; + password: string; + } + type Output = undefined; +} + +/** Update the service-specific admin status of a subject (account, record, or blob). */ +export declare namespace ComAtprotoAdminUpdateSubjectStatus { + interface Params {} + interface Input { + subject: Brand.Union< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + deactivated?: ComAtprotoAdminDefs.StatusAttr; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } + interface Output { + subject: Brand.Union< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } +} + +/** Describe the credentials that should be included in the DID doc of an account that is migrating to this service. */ +export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { + interface Params {} + type Input = undefined; + interface Output { + alsoKnownAs?: string[]; + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[]; + services?: unknown; + verificationMethods?: unknown; + } +} + +/** Request an email with a code to in order to request a signed PLC operation. Requires Auth. */ +export declare namespace ComAtprotoIdentityRequestPlcOperationSignature { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Resolves a handle (domain name) to a DID. */ +export declare namespace ComAtprotoIdentityResolveHandle { + interface Params { + /** The handle to resolve. */ + handle: At.Handle; + } + type Input = undefined; + interface Output { + did: At.DID; + } +} + +/** Signs a PLC operation to update some value(s) in the requesting DID's document. */ +export declare namespace ComAtprotoIdentitySignPlcOperation { + interface Params {} + interface Input { + alsoKnownAs?: string[]; + rotationKeys?: string[]; + services?: unknown; + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string; + verificationMethods?: unknown; + } + interface Output { + /** A signed DID PLC operation. */ + operation: unknown; + } +} + +/** Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry */ +export declare namespace ComAtprotoIdentitySubmitPlcOperation { + interface Params {} + interface Input { + operation: unknown; + } + type Output = undefined; +} + +/** Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. */ +export declare namespace ComAtprotoIdentityUpdateHandle { + interface Params {} + interface Input { + /** The new handle. */ + handle: At.Handle; + } + type Output = undefined; +} + +export declare namespace ComAtprotoLabelDefs { + /** Metadata tag on an atproto resource (eg, repo or record). */ + interface Label { + [Brand.Type]?: "com.atproto.label.defs#label"; + /** Timestamp when this label was created. */ + cts: string; + /** DID of the actor who created this label. */ + src: At.DID; + /** AT URI of the record, repository (account), or other resource that this label applies to. */ + uri: string; + /** + * The short string name of the value or type of this label. + * Maximum string length: 128 + */ + val: string; + /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */ + cid?: At.CID; + /** Timestamp at which this label expires (no longer applies). */ + exp?: string; + /** If true, this is a negation label, overwriting a previous label. */ + neg?: boolean; + /** Signature of dag-cbor encoded label. */ + sig?: At.Bytes; + /** The AT Protocol version of the label object. */ + ver?: number; + } + type LabelValue = + | "!hide" + | "!no-promote" + | "!no-unauthenticated" + | "!warn" + | "dmca-violation" + | "doxxing" + | "gore" + | "nsfl" + | "nudity" + | "porn" + | "sexual" + | (string & {}); + /** Declares a label value and its expected interpretations and behaviors. */ + interface LabelValueDefinition { + [Brand.Type]?: "com.atproto.label.defs#labelValueDefinition"; + /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ + blurs: "content" | "media" | "none" | (string & {}); + /** + * The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). + * Maximum string length: 100 + * Maximum grapheme length: 100 + */ + identifier: string; + locales: LabelValueDefinitionStrings[]; + /** How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. */ + severity: "alert" | "inform" | "none" | (string & {}); + /** Does the user need to have adult content enabled in order to configure this label? */ + adultOnly?: boolean; + /** + * The default setting for this label. + * \@default "warn" + */ + defaultSetting?: "hide" | "ignore" | "warn" | (string & {}); + } + /** Strings which describe the label in the UI, localized into a specific language. */ + interface LabelValueDefinitionStrings { + [Brand.Type]?: "com.atproto.label.defs#labelValueDefinitionStrings"; + /** + * A longer description of what the label means and why it might be applied. + * Maximum string length: 100000 + * Maximum grapheme length: 10000 + */ + description: string; + /** The code of the language these strings are written in. */ + lang: string; + /** + * A short human-readable name for the label. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + name: string; + } + /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ + interface SelfLabel { + [Brand.Type]?: "com.atproto.label.defs#selfLabel"; + /** + * The short string name of the value or type of this label. + * Maximum string length: 128 + */ + val: string; + } + /** Metadata tags on an atproto record, published by the author within the record. */ + interface SelfLabels { + [Brand.Type]?: "com.atproto.label.defs#selfLabels"; + /** Maximum array length: 10 */ + values: SelfLabel[]; + } +} + +/** Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. */ +export declare namespace ComAtprotoLabelQueryLabels { + interface Params { + /** 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. */ + uriPatterns: string[]; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 250 + * \@default 50 + */ + limit?: number; + /** Optional list of label sources (DIDs) to filter on. */ + sources?: At.DID[]; + } + type Input = undefined; + interface Output { + labels: ComAtprotoLabelDefs.Label[]; + cursor?: string; + } +} + +export declare namespace ComAtprotoLabelSubscribeLabels { + interface Params { + /** The last known event seq number to backfill from. */ + cursor?: number; + } + type Message = Brand.Union; + interface Errors { + FutureCursor: {}; + } + interface Info { + [Brand.Type]?: "com.atproto.label.subscribeLabels#info"; + name: "OutdatedCursor" | (string & {}); + message?: string; + } + interface Labels { + [Brand.Type]?: "com.atproto.label.subscribeLabels#labels"; + labels: ComAtprotoLabelDefs.Label[]; + seq: number; + } +} + +/** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */ +export declare namespace ComAtprotoModerationCreateReport { + interface Params {} + interface Input { + /** Indicates the broad category of violation the report is for. */ + reasonType: ComAtprotoModerationDefs.ReasonType; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** + * Additional context about the content and violation. + * Maximum string length: 20000 + * Maximum grapheme length: 2000 + */ + reason?: string; + } + interface Output { + createdAt: string; + id: number; + reasonType: ComAtprotoModerationDefs.ReasonType; + reportedBy: At.DID; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** + * Maximum string length: 20000 + * Maximum grapheme length: 2000 + */ + reason?: string; + } +} + +export declare namespace ComAtprotoModerationDefs { + type ReasonAppeal = "com.atproto.moderation.defs#reasonAppeal"; + type ReasonMisleading = "com.atproto.moderation.defs#reasonMisleading"; + type ReasonOther = "com.atproto.moderation.defs#reasonOther"; + type ReasonRude = "com.atproto.moderation.defs#reasonRude"; + type ReasonSexual = "com.atproto.moderation.defs#reasonSexual"; + type ReasonSpam = "com.atproto.moderation.defs#reasonSpam"; + type ReasonType = + | "com.atproto.moderation.defs#reasonAppeal" + | "com.atproto.moderation.defs#reasonMisleading" + | "com.atproto.moderation.defs#reasonOther" + | "com.atproto.moderation.defs#reasonRude" + | "com.atproto.moderation.defs#reasonSexual" + | "com.atproto.moderation.defs#reasonSpam" + | "com.atproto.moderation.defs#reasonViolation" + | (string & {}); + type ReasonViolation = "com.atproto.moderation.defs#reasonViolation"; +} + +/** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoApplyWrites { + interface Params {} + interface Input { + /** The handle or DID of the repo (aka, current account). */ + repo: string; + writes: Brand.Union[]; + /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */ + swapCommit?: At.CID; + /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output { + commit?: ComAtprotoRepoDefs.CommitMeta; + results?: Brand.Union[]; + } + interface Errors { + InvalidSwap: {}; + } + /** Operation which creates a new record. */ + interface Create { + [Brand.Type]?: "com.atproto.repo.applyWrites#create"; + collection: string; + value: unknown; + /** Maximum string length: 512 */ + rkey?: string; + } + interface CreateResult { + [Brand.Type]?: "com.atproto.repo.applyWrites#createResult"; + cid: At.CID; + uri: At.Uri; + validationStatus?: "unknown" | "valid" | (string & {}); + } + /** Operation which deletes an existing record. */ + interface Delete { + [Brand.Type]?: "com.atproto.repo.applyWrites#delete"; + collection: string; + rkey: string; + } + interface DeleteResult { + [Brand.Type]?: "com.atproto.repo.applyWrites#deleteResult"; + } + /** Operation which updates an existing record. */ + interface Update { + [Brand.Type]?: "com.atproto.repo.applyWrites#update"; + collection: string; + rkey: string; + value: unknown; + } + interface UpdateResult { + [Brand.Type]?: "com.atproto.repo.applyWrites#updateResult"; + cid: At.CID; + uri: At.Uri; + validationStatus?: "unknown" | "valid" | (string & {}); + } +} + +/** Create a single new repository record. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoCreateRecord { + interface Params {} + interface Input { + /** The NSID of the record collection. */ + collection: string; + /** The record itself. Must contain a $type field. */ + record: unknown; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** + * The Record Key. + * Maximum string length: 512 + */ + rkey?: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output { + cid: At.CID; + uri: At.Uri; + commit?: ComAtprotoRepoDefs.CommitMeta; + validationStatus?: "unknown" | "valid" | (string & {}); + } + interface Errors { + InvalidSwap: {}; + } +} + +export declare namespace ComAtprotoRepoDefs { + interface CommitMeta { + [Brand.Type]?: "com.atproto.repo.defs#commitMeta"; + cid: At.CID; + rev: string; + } +} + +/** Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoDeleteRecord { + interface Params {} + interface Input { + /** The NSID of the record collection. */ + collection: string; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** The Record Key. */ + rkey: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Compare and swap with the previous record by CID. */ + swapRecord?: At.CID; + } + interface Output { + commit?: ComAtprotoRepoDefs.CommitMeta; + } + interface Errors { + InvalidSwap: {}; + } +} + +/** Get information about an account and repository, including the list of collections. Does not require auth. */ +export declare namespace ComAtprotoRepoDescribeRepo { + interface Params { + /** The handle or DID of the repo. */ + repo: string; + } + type Input = undefined; + interface Output { + /** List of all the collections (NSIDs) for which this repo contains at least one record. */ + collections: string[]; + did: At.DID; + /** The complete DID document for this account. */ + didDoc: unknown; + handle: At.Handle; + /** Indicates if handle is currently valid (resolves bi-directionally) */ + handleIsCorrect: boolean; + } +} + +/** Get a single record from a repository. Does not require auth. */ +export declare namespace ComAtprotoRepoGetRecord { + interface Params { + /** The NSID of the record collection. */ + collection: string; + /** The handle or DID of the repo. */ + repo: string; + /** The Record Key. */ + rkey: string; + /** The CID of the version of the record. If not specified, then return the most recent version. */ + cid?: At.CID; + } + type Input = undefined; + interface Output { + uri: At.Uri; + value: unknown; + cid?: At.CID; + } + interface Errors { + RecordNotFound: {}; + } +} + +/** Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. */ +export declare namespace ComAtprotoRepoImportRepo { + interface Params {} + type Input = Blob | ArrayBufferView; + type Output = undefined; +} + +/** Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. */ +export declare namespace ComAtprotoRepoListMissingBlobs { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + } + type Input = undefined; + interface Output { + blobs: RecordBlob[]; + cursor?: string; + } + interface RecordBlob { + [Brand.Type]?: "com.atproto.repo.listMissingBlobs#recordBlob"; + cid: At.CID; + recordUri: At.Uri; + } +} + +/** List a range of records in a repository, matching a specific collection. Does not require auth. */ +export declare namespace ComAtprotoRepoListRecords { + interface Params { + /** The NSID of the record type. */ + collection: string; + /** The handle or DID of the repo. */ + repo: string; + cursor?: string; + /** + * The number of records to return. + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** Flag to reverse the order of the returned records. */ + reverse?: boolean; + /** + * DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) + * \@deprecated + */ + rkeyEnd?: string; + /** + * DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) + * \@deprecated + */ + rkeyStart?: string; + } + type Input = undefined; + interface Output { + records: Record[]; + cursor?: string; + } + interface Record { + [Brand.Type]?: "com.atproto.repo.listRecords#record"; + cid: At.CID; + uri: At.Uri; + value: unknown; + } +} + +/** Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoPutRecord { + interface Params {} + interface Input { + /** The NSID of the record collection. */ + collection: string; + /** The record to write. */ + record: unknown; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** + * The Record Key. + * Maximum string length: 512 + */ + rkey: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */ + swapRecord?: At.CID | null; + /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output { + cid: At.CID; + uri: At.Uri; + commit?: ComAtprotoRepoDefs.CommitMeta; + validationStatus?: "unknown" | "valid" | (string & {}); + } + interface Errors { + InvalidSwap: {}; + } +} + +export declare namespace ComAtprotoRepoStrongRef { + interface Main { + [Brand.Type]?: "com.atproto.repo.strongRef"; + cid: At.CID; + uri: At.Uri; + } +} + +/** Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoUploadBlob { + interface Params {} + type Input = Blob | ArrayBufferView; + interface Output { + blob: At.Blob; + } +} + +/** Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. */ +export declare namespace ComAtprotoServerActivateAccount { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. */ +export declare namespace ComAtprotoServerCheckAccountStatus { + interface Params {} + type Input = undefined; + interface Output { + activated: boolean; + expectedBlobs: number; + importedBlobs: number; + indexedRecords: number; + privateStateValues: number; + repoBlocks: number; + repoCommit: At.CID; + repoRev: string; + validDid: boolean; + } +} + +/** Confirm an email using a token from com.atproto.server.requestEmailConfirmation. */ +export declare namespace ComAtprotoServerConfirmEmail { + interface Params {} + interface Input { + email: string; + token: string; + } + type Output = undefined; + interface Errors { + AccountNotFound: {}; + ExpiredToken: {}; + InvalidToken: {}; + InvalidEmail: {}; + } +} + +/** Create an account. Implemented by PDS. */ +export declare namespace ComAtprotoServerCreateAccount { + interface Params {} + interface Input { + /** Requested handle for the account. */ + handle: At.Handle; + /** Pre-existing atproto DID, being imported to a new account. */ + did?: At.DID; + email?: string; + inviteCode?: string; + /** Initial account password. May need to meet instance-specific password strength requirements. */ + password?: string; + /** A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. */ + plcOp?: unknown; + /** DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. */ + recoveryKey?: string; + verificationCode?: string; + verificationPhone?: string; + } + /** Account login session returned on successful account creation. */ + interface Output { + accessJwt: string; + /** The DID of the new account. */ + did: At.DID; + handle: At.Handle; + refreshJwt: string; + /** Complete DID document. */ + didDoc?: unknown; + } + interface Errors { + InvalidHandle: {}; + InvalidPassword: {}; + InvalidInviteCode: {}; + HandleNotAvailable: {}; + UnsupportedDomain: {}; + UnresolvableDid: {}; + IncompatibleDidDoc: {}; + } +} + +/** Create an App Password. */ +export declare namespace ComAtprotoServerCreateAppPassword { + interface Params {} + interface Input { + /** A short name for the App Password, to help distinguish them. */ + name: string; + /** If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. */ + privileged?: boolean; + } + type Output = AppPassword; + interface Errors { + AccountTakedown: {}; + } + interface AppPassword { + [Brand.Type]?: "com.atproto.server.createAppPassword#appPassword"; + createdAt: string; + name: string; + password: string; + privileged?: boolean; + } +} + +/** Create an invite code. */ +export declare namespace ComAtprotoServerCreateInviteCode { + interface Params {} + interface Input { + useCount: number; + forAccount?: At.DID; + } + interface Output { + code: string; + } +} + +/** Create invite codes. */ +export declare namespace ComAtprotoServerCreateInviteCodes { + interface Params {} + interface Input { + /** \@default 1 */ + codeCount: number; + useCount: number; + forAccounts?: At.DID[]; + } + interface Output { + codes: AccountCodes[]; + } + interface AccountCodes { + [Brand.Type]?: "com.atproto.server.createInviteCodes#accountCodes"; + account: string; + codes: string[]; + } +} + +/** Create an authentication session. */ +export declare namespace ComAtprotoServerCreateSession { + interface Params {} + interface Input { + /** Handle or other identifier supported by the server for the authenticating user. */ + identifier: string; + password: string; + authFactorToken?: string; + } + interface Output { + accessJwt: string; + did: At.DID; + handle: At.Handle; + refreshJwt: string; + active?: boolean; + didDoc?: unknown; + email?: string; + emailAuthFactor?: boolean; + emailConfirmed?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } + interface Errors { + AccountTakedown: {}; + AuthFactorTokenRequired: {}; + } +} + +/** Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. */ +export declare namespace ComAtprotoServerDeactivateAccount { + interface Params {} + interface Input { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoServerDefs { + interface InviteCode { + [Brand.Type]?: "com.atproto.server.defs#inviteCode"; + available: number; + code: string; + createdAt: string; + createdBy: string; + disabled: boolean; + forAccount: string; + uses: InviteCodeUse[]; + } + interface InviteCodeUse { + [Brand.Type]?: "com.atproto.server.defs#inviteCodeUse"; + usedAt: string; + usedBy: At.DID; + } +} + +/** Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. */ +export declare namespace ComAtprotoServerDeleteAccount { + interface Params {} + interface Input { + did: At.DID; + password: string; + token: string; + } + type Output = undefined; + interface Errors { + ExpiredToken: {}; + InvalidToken: {}; + } +} + +/** Delete the current session. Requires auth. */ +export declare namespace ComAtprotoServerDeleteSession { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Describes the server's account creation requirements and capabilities. Implemented by PDS. */ +export declare namespace ComAtprotoServerDescribeServer { + interface Params {} + type Input = undefined; + interface Output { + /** List of domain suffixes that can be used in account handles. */ + availableUserDomains: string[]; + did: At.DID; + /** Contact information */ + contact?: Contact; + /** If true, an invite code must be supplied to create an account on this instance. */ + inviteCodeRequired?: boolean; + /** URLs of service policy documents. */ + links?: Links; + /** If true, a phone verification token must be supplied to create an account on this instance. */ + phoneVerificationRequired?: boolean; + } + interface Contact { + [Brand.Type]?: "com.atproto.server.describeServer#contact"; + email?: string; + } + interface Links { + [Brand.Type]?: "com.atproto.server.describeServer#links"; + privacyPolicy?: string; + termsOfService?: string; + } +} + +/** Get all invite codes for the current account. Requires auth. */ +export declare namespace ComAtprotoServerGetAccountInviteCodes { + interface Params { + /** + * Controls whether any new 'earned' but not 'created' invites should be created. + * \@default true + */ + createAvailable?: boolean; + /** \@default true */ + includeUsed?: boolean; + } + type Input = undefined; + interface Output { + codes: ComAtprotoServerDefs.InviteCode[]; + } + interface Errors { + DuplicateCreate: {}; + } +} + +/** Get a signed token on behalf of the requesting DID for the requested service. */ +export declare namespace ComAtprotoServerGetServiceAuth { + interface Params { + /** The DID of the service that the token will be used to authenticate with */ + aud: At.DID; + /** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */ + exp?: number; + /** Lexicon (XRPC) method to bind the requested token to */ + lxm?: string; + } + type Input = undefined; + interface Output { + token: string; + } + interface Errors { + BadExpiration: {}; + } +} + +/** Get information about the current auth session. Requires auth. */ +export declare namespace ComAtprotoServerGetSession { + interface Params {} + type Input = undefined; + interface Output { + did: At.DID; + handle: At.Handle; + active?: boolean; + didDoc?: unknown; + email?: string; + emailAuthFactor?: boolean; + emailConfirmed?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } +} + +/** List all App Passwords. */ +export declare namespace ComAtprotoServerListAppPasswords { + interface Params {} + type Input = undefined; + interface Output { + passwords: AppPassword[]; + } + interface Errors { + AccountTakedown: {}; + } + interface AppPassword { + [Brand.Type]?: "com.atproto.server.listAppPasswords#appPassword"; + createdAt: string; + name: string; + privileged?: boolean; + } +} + +/** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */ +export declare namespace ComAtprotoServerRefreshSession { + interface Params {} + type Input = undefined; + interface Output { + accessJwt: string; + did: At.DID; + handle: At.Handle; + refreshJwt: string; + active?: boolean; + didDoc?: unknown; + /** Hosting status of the account. If not specified, then assume 'active'. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } + interface Errors { + AccountTakedown: {}; + } +} + +/** Initiate a user account deletion via email. */ +export declare namespace ComAtprotoServerRequestAccountDelete { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Request an email with a code to confirm ownership of email. */ +export declare namespace ComAtprotoServerRequestEmailConfirmation { + interface Params {} + type Input = undefined; + type Output = undefined; +} + +/** Request a token in order to update email. */ +export declare namespace ComAtprotoServerRequestEmailUpdate { + interface Params {} + type Input = undefined; + interface Output { + tokenRequired: boolean; + } +} + +/** Initiate a user account password reset via email. */ +export declare namespace ComAtprotoServerRequestPasswordReset { + interface Params {} + interface Input { + email: string; + } + type Output = undefined; +} + +/** Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. */ +export declare namespace ComAtprotoServerReserveSigningKey { + interface Params {} + interface Input { + /** The DID to reserve a key for. */ + did?: At.DID; + } + interface Output { + /** The public key for the reserved signing key, in did:key serialization. */ + signingKey: string; + } +} + +/** Reset a user account password using a token. */ +export declare namespace ComAtprotoServerResetPassword { + interface Params {} + interface Input { + password: string; + token: string; + } + type Output = undefined; + interface Errors { + ExpiredToken: {}; + InvalidToken: {}; + } +} + +/** Revoke an App Password by name. */ +export declare namespace ComAtprotoServerRevokeAppPassword { + interface Params {} + interface Input { + name: string; + } + type Output = undefined; +} + +/** Update an account's email. */ +export declare namespace ComAtprotoServerUpdateEmail { + interface Params {} + interface Input { + email: string; + emailAuthFactor?: boolean; + /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */ + token?: string; + } + type Output = undefined; + interface Errors { + ExpiredToken: {}; + InvalidToken: {}; + TokenRequired: {}; + } +} + +/** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetBlob { + interface Params { + /** The CID of the blob to fetch */ + cid: At.CID; + /** The DID of the account. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + BlobNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetBlocks { + interface Params { + cids: At.CID[]; + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + BlockNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** + * DEPRECATED - please use com.atproto.sync.getRepo instead + * \@deprecated + */ +export declare namespace ComAtprotoSyncGetCheckout { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; +} + +/** + * DEPRECATED - please use com.atproto.sync.getLatestCommit instead + * \@deprecated + */ +export declare namespace ComAtprotoSyncGetHead { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output { + root: At.CID; + } + interface Errors { + HeadNotFound: {}; + } +} + +/** Get the current commit CID & revision of the specified repo. Does not require auth. */ +export declare namespace ComAtprotoSyncGetLatestCommit { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output { + cid: At.CID; + rev: string; + } + interface Errors { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */ +export declare namespace ComAtprotoSyncGetRecord { + interface Params { + collection: string; + /** The DID of the repo. */ + did: At.DID; + /** Record Key */ + rkey: string; + /** + * DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit + * \@deprecated + */ + commit?: At.CID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + RecordNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetRepo { + interface Params { + /** The DID of the repo. */ + did: At.DID; + /** The revision ('rev') of the repo to create a diff from. */ + since?: string; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. */ +export declare namespace ComAtprotoSyncGetRepoStatus { + interface Params { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output { + active: boolean; + did: At.DID; + /** Optional field, the current rev of the repo, if active=true */ + rev?: string; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } + interface Errors { + RepoNotFound: {}; + } +} + +/** List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncListBlobs { + interface Params { + /** The DID of the repo. */ + did: At.DID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + /** Optional revision of the repo to list blobs since. */ + since?: string; + } + type Input = undefined; + interface Output { + cids: At.CID[]; + cursor?: string; + } + interface Errors { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */ +export declare namespace ComAtprotoSyncListRepos { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + } + type Input = undefined; + interface Output { + repos: Repo[]; + cursor?: string; + } + interface Repo { + [Brand.Type]?: "com.atproto.sync.listRepos#repo"; + did: At.DID; + /** Current repo commit CID */ + head: At.CID; + rev: string; + active?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: "deactivated" | "suspended" | "takendown" | (string & {}); + } +} + +/** Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. */ +export declare namespace ComAtprotoSyncNotifyOfUpdate { + interface Params {} + interface Input { + /** Hostname of the current service (usually a PDS) that is notifying of update. */ + hostname: string; + } + type Output = undefined; +} + +/** Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. */ +export declare namespace ComAtprotoSyncRequestCrawl { + interface Params {} + interface Input { + /** Hostname of the current service (eg, PDS) that is requesting to be crawled. */ + hostname: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoSyncSubscribeRepos { + interface Params { + /** The last known event seq number to backfill from. */ + cursor?: number; + } + type Message = Brand.Union< + Account | Commit | Handle | Identity | Info | Migrate | Tombstone + >; + interface Errors { + FutureCursor: {}; + ConsumerTooSlow: {}; + } + /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ + interface Account { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#account"; + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean; + did: At.DID; + seq: number; + time: string; + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | "deactivated" + | "deleted" + | "suspended" + | "takendown" + | (string & {}); + } + /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ + interface Commit { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#commit"; + /** List of new blobs (by CID) referenced by records in this commit. */ + blobs: At.CIDLink[]; + /** CAR file containing relevant blocks, as a diff since the previous repo state. */ + blocks: At.Bytes; + /** Repo commit object CID. */ + commit: At.CIDLink; + /** + * Maximum array length: 200 + * List of repo mutation operations in this commit (eg, records created, updated, or deleted). + */ + ops: RepoOp[]; + /** + * DEPRECATED -- unused + * \@deprecated + */ + rebase: boolean; + /** The repo this event comes from. */ + repo: At.DID; + /** The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event. */ + rev: string; + /** The stream sequence number of this message. */ + seq: number; + /** The rev of the last emitted commit from this repo (if any). */ + since: string | null; + /** Timestamp of when this message was originally broadcast. */ + time: string; + /** Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data. */ + tooBig: boolean; + /** + * DEPRECATED -- unused. WARNING -- nullable and optional; stick with optional to ensure golang interoperability. + * \@deprecated + */ + prev?: At.CIDLink | null; + } + /** + * DEPRECATED -- Use #identity event instead + * \@deprecated + */ + interface Handle { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#handle"; + did: At.DID; + handle: At.Handle; + seq: number; + time: string; + } + /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ + interface Identity { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#identity"; + did: At.DID; + seq: number; + time: string; + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ + handle?: At.Handle; + } + interface Info { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#info"; + name: "OutdatedCursor" | (string & {}); + message?: string; + } + /** + * DEPRECATED -- Use #account event instead + * \@deprecated + */ + interface Migrate { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#migrate"; + did: At.DID; + migrateTo: string | null; + seq: number; + time: string; + } + /** A repo operation, ie a mutation of a single record. */ + interface RepoOp { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#repoOp"; + action: "create" | "delete" | "update" | (string & {}); + /** For creates and updates, the new record CID. For deletions, null. */ + cid: At.CIDLink | null; + path: string; + } + /** + * DEPRECATED -- Use #account event instead + * \@deprecated + */ + interface Tombstone { + [Brand.Type]?: "com.atproto.sync.subscribeRepos#tombstone"; + did: At.DID; + seq: number; + time: string; + } +} + +/** Add a handle to the set of reserved handles. */ +export declare namespace ComAtprotoTempAddReservedHandle { + interface Params {} + interface Input { + handle: string; + } + interface Output {} +} + +/** Check accounts location in signup queue. */ +export declare namespace ComAtprotoTempCheckSignupQueue { + interface Params {} + type Input = undefined; + interface Output { + activated: boolean; + estimatedTimeMs?: number; + placeInQueue?: number; + } +} + +/** + * DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date. + * \@deprecated + */ +export declare namespace ComAtprotoTempFetchLabels { + interface Params { + /** + * Minimum: 1 + * Maximum: 250 + * \@default 50 + */ + limit?: number; + since?: number; + } + type Input = undefined; + interface Output { + labels: ComAtprotoLabelDefs.Label[]; + } +} + +/** Request a verification code to be sent to the supplied phone number */ +export declare namespace ComAtprotoTempRequestPhoneVerification { + interface Params {} + interface Input { + phoneNumber: string; + } + type Output = undefined; +} + +/** Administrative action to create a new, re-usable communication (email for now) template. */ +export declare namespace ToolsOzoneCommunicationCreateTemplate { + interface Params {} + interface Input { + /** Content of the template, markdown supported, can contain variable placeholders. */ + contentMarkdown: string; + /** Name of the template. */ + name: string; + /** Subject of the message, used in emails. */ + subject: string; + /** DID of the user who is creating the template. */ + createdBy?: At.DID; + /** Message language. */ + lang?: string; + } + type Output = ToolsOzoneCommunicationDefs.TemplateView; + interface Errors { + DuplicateTemplateName: {}; + } +} + +export declare namespace ToolsOzoneCommunicationDefs { + interface TemplateView { + [Brand.Type]?: "tools.ozone.communication.defs#templateView"; + /** Subject of the message, used in emails. */ + contentMarkdown: string; + createdAt: string; + disabled: boolean; + id: string; + /** DID of the user who last updated the template. */ + lastUpdatedBy: At.DID; + /** Name of the template. */ + name: string; + updatedAt: string; + /** Message language. */ + lang?: string; + /** Content of the template, can contain markdown and variable placeholders. */ + subject?: string; + } +} + +/** Delete a communication template. */ +export declare namespace ToolsOzoneCommunicationDeleteTemplate { + interface Params {} + interface Input { + id: string; + } + type Output = undefined; +} + +/** Get list of all communication templates. */ +export declare namespace ToolsOzoneCommunicationListTemplates { + interface Params {} + type Input = undefined; + interface Output { + communicationTemplates: ToolsOzoneCommunicationDefs.TemplateView[]; + } +} + +/** Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. */ +export declare namespace ToolsOzoneCommunicationUpdateTemplate { + interface Params {} + interface Input { + /** ID of the template to be updated. */ + id: string; + /** Content of the template, markdown supported, can contain variable placeholders. */ + contentMarkdown?: string; + disabled?: boolean; + /** Message language. */ + lang?: string; + /** Name of the template. */ + name?: string; + /** Subject of the message, used in emails. */ + subject?: string; + /** DID of the user who is updating the template. */ + updatedBy?: At.DID; + } + type Output = ToolsOzoneCommunicationDefs.TemplateView; + interface Errors { + DuplicateTemplateName: {}; + } +} + +export declare namespace ToolsOzoneModerationDefs { + /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface AccountEvent { + [Brand.Type]?: "tools.ozone.moderation.defs#accountEvent"; + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean; + timestamp: string; + comment?: string; + status?: + | "deactivated" + | "deleted" + | "suspended" + | "takendown" + | "tombstoned" + | "unknown" + | (string & {}); + } + interface AccountHosting { + [Brand.Type]?: "tools.ozone.moderation.defs#accountHosting"; + status: + | "deactivated" + | "deleted" + | "suspended" + | "takendown" + | "unknown" + | (string & {}); + createdAt?: string; + deactivatedAt?: string; + deletedAt?: string; + reactivatedAt?: string; + updatedAt?: string; + } + interface BlobView { + [Brand.Type]?: "tools.ozone.moderation.defs#blobView"; + cid: At.CID; + createdAt: string; + mimeType: string; + size: number; + details?: Brand.Union; + moderation?: Moderation; + } + /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface IdentityEvent { + [Brand.Type]?: "tools.ozone.moderation.defs#identityEvent"; + timestamp: string; + comment?: string; + handle?: At.Handle; + pdsHost?: string; + tombstone?: boolean; + } + interface ImageDetails { + [Brand.Type]?: "tools.ozone.moderation.defs#imageDetails"; + height: number; + width: number; + } + interface Moderation { + [Brand.Type]?: "tools.ozone.moderation.defs#moderation"; + subjectStatus?: SubjectStatusView; + } + interface ModerationDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#moderationDetail"; + subjectStatus?: SubjectStatusView; + } + interface ModEventAcknowledge { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventAcknowledge"; + comment?: string; + } + /** Add a comment to a subject */ + interface ModEventComment { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventComment"; + comment: string; + /** Make the comment persistent on the subject */ + sticky?: boolean; + } + /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ + interface ModEventDivert { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventDivert"; + comment?: string; + } + /** Keep a log of outgoing email to a user */ + interface ModEventEmail { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventEmail"; + /** The subject line of the email sent to the user. */ + subjectLine: string; + /** Additional comment about the outgoing comm. */ + comment?: string; + /** The content of the email sent to the user. */ + content?: string; + } + interface ModEventEscalate { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventEscalate"; + comment?: string; + } + /** Apply/Negate labels on a subject */ + interface ModEventLabel { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventLabel"; + createLabelVals: string[]; + negateLabelVals: string[]; + comment?: string; + } + /** Mute incoming reports on a subject */ + interface ModEventMute { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventMute"; + /** Indicates how long the subject should remain muted. */ + durationInHours: number; + comment?: string; + } + /** Mute incoming reports from an account */ + interface ModEventMuteReporter { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventMuteReporter"; + comment?: string; + /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ + durationInHours?: number; + } + /** Report a subject */ + interface ModEventReport { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventReport"; + reportType: ComAtprotoModerationDefs.ReasonType; + comment?: string; + /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ + isReporterMuted?: boolean; + } + /** Resolve appeal on a subject */ + interface ModEventResolveAppeal { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventResolveAppeal"; + /** Describe resolution. */ + comment?: string; + } + /** Revert take down action on a subject */ + interface ModEventReverseTakedown { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventReverseTakedown"; + /** Describe reasoning behind the reversal. */ + comment?: string; + } + /** Add/Remove a tag on a subject */ + interface ModEventTag { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventTag"; + /** Tags to be added to the subject. If already exists, won't be duplicated. */ + add: string[]; + /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ + remove: string[]; + /** Additional comment about added/removed tags. */ + comment?: string; + } + /** Take down a subject permanently or temporarily */ + interface ModEventTakedown { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventTakedown"; + /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ + acknowledgeAccountSubjects?: boolean; + comment?: string; + /** Indicates how long the takedown should be in effect before automatically expiring. */ + durationInHours?: number; + } + /** Unmute action on a subject */ + interface ModEventUnmute { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmute"; + /** Describe reasoning behind the reversal. */ + comment?: string; + } + /** Unmute incoming reports from an account */ + interface ModEventUnmuteReporter { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmuteReporter"; + /** Describe reasoning behind the reversal. */ + comment?: string; + } + interface ModEventView { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventView"; + createdAt: string; + createdBy: At.DID; + event: Brand.Union< + | AccountEvent + | IdentityEvent + | ModEventAcknowledge + | ModEventComment + | ModEventDivert + | ModEventEmail + | ModEventEscalate + | ModEventLabel + | ModEventMute + | ModEventMuteReporter + | ModEventReport + | ModEventResolveAppeal + | ModEventReverseTakedown + | ModEventTag + | ModEventTakedown + | ModEventUnmute + | ModEventUnmuteReporter + | RecordEvent + >; + id: number; + subject: Brand.Union< + | ChatBskyConvoDefs.MessageRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + subjectBlobCids: string[]; + creatorHandle?: string; + subjectHandle?: string; + } + interface ModEventViewDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#modEventViewDetail"; + createdAt: string; + createdBy: At.DID; + event: Brand.Union< + | AccountEvent + | IdentityEvent + | ModEventAcknowledge + | ModEventComment + | ModEventDivert + | ModEventEmail + | ModEventEscalate + | ModEventLabel + | ModEventMute + | ModEventMuteReporter + | ModEventReport + | ModEventResolveAppeal + | ModEventReverseTakedown + | ModEventTag + | ModEventTakedown + | ModEventUnmute + | ModEventUnmuteReporter + | RecordEvent + >; + id: number; + subject: Brand.Union< + RecordView | RecordViewNotFound | RepoView | RepoViewNotFound + >; + subjectBlobs: BlobView[]; + } + /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface RecordEvent { + [Brand.Type]?: "tools.ozone.moderation.defs#recordEvent"; + op: "create" | "delete" | "update" | (string & {}); + timestamp: string; + cid?: At.CID; + comment?: string; + } + interface RecordHosting { + [Brand.Type]?: "tools.ozone.moderation.defs#recordHosting"; + status: "deleted" | "unknown" | (string & {}); + createdAt?: string; + deletedAt?: string; + updatedAt?: string; + } + interface RecordView { + [Brand.Type]?: "tools.ozone.moderation.defs#recordView"; + blobCids: At.CID[]; + cid: At.CID; + indexedAt: string; + moderation: Moderation; + repo: RepoView; + uri: At.Uri; + value: unknown; + } + interface RecordViewDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#recordViewDetail"; + blobs: BlobView[]; + cid: At.CID; + indexedAt: string; + moderation: ModerationDetail; + repo: RepoView; + uri: At.Uri; + value: unknown; + labels?: ComAtprotoLabelDefs.Label[]; + } + interface RecordViewNotFound { + [Brand.Type]?: "tools.ozone.moderation.defs#recordViewNotFound"; + uri: At.Uri; + } + interface RepoView { + [Brand.Type]?: "tools.ozone.moderation.defs#repoView"; + did: At.DID; + handle: At.Handle; + indexedAt: string; + moderation: Moderation; + relatedRecords: unknown[]; + deactivatedAt?: string; + email?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invitesDisabled?: boolean; + threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; + } + interface RepoViewDetail { + [Brand.Type]?: "tools.ozone.moderation.defs#repoViewDetail"; + did: At.DID; + handle: At.Handle; + indexedAt: string; + moderation: ModerationDetail; + relatedRecords: unknown[]; + deactivatedAt?: string; + email?: string; + emailConfirmedAt?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invites?: ComAtprotoServerDefs.InviteCode[]; + invitesDisabled?: boolean; + labels?: ComAtprotoLabelDefs.Label[]; + threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; + } + interface RepoViewNotFound { + [Brand.Type]?: "tools.ozone.moderation.defs#repoViewNotFound"; + did: At.DID; + } + type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; + type ReviewEscalated = "tools.ozone.moderation.defs#reviewEscalated"; + type ReviewNone = "tools.ozone.moderation.defs#reviewNone"; + type ReviewOpen = "tools.ozone.moderation.defs#reviewOpen"; + type SubjectReviewState = + | "#reviewClosed" + | "#reviewEscalated" + | "#reviewNone" + | "#reviewOpen" + | (string & {}); + interface SubjectStatusView { + [Brand.Type]?: "tools.ozone.moderation.defs#subjectStatusView"; + /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ + createdAt: string; + id: number; + reviewState: SubjectReviewState; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** Timestamp referencing when the last update was made to the moderation status of the subject */ + updatedAt: string; + /** True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. */ + appealed?: boolean; + /** Sticky comment on the subject. */ + comment?: string; + hosting?: Brand.Union; + /** Timestamp referencing when the author of the subject appealed a moderation action */ + lastAppealedAt?: string; + lastReportedAt?: string; + lastReviewedAt?: string; + lastReviewedBy?: At.DID; + muteReportingUntil?: string; + muteUntil?: string; + subjectBlobCids?: At.CID[]; + subjectRepoHandle?: string; + suspendUntil?: string; + tags?: string[]; + takendown?: boolean; + } + interface VideoDetails { + [Brand.Type]?: "tools.ozone.moderation.defs#videoDetails"; + height: number; + length: number; + width: number; + } +} + +/** Take a moderation action on an actor. */ +export declare namespace ToolsOzoneModerationEmitEvent { + interface Params {} + interface Input { + createdBy: At.DID; + event: Brand.Union< + | ToolsOzoneModerationDefs.AccountEvent + | ToolsOzoneModerationDefs.IdentityEvent + | ToolsOzoneModerationDefs.ModEventAcknowledge + | ToolsOzoneModerationDefs.ModEventComment + | ToolsOzoneModerationDefs.ModEventEmail + | ToolsOzoneModerationDefs.ModEventEscalate + | ToolsOzoneModerationDefs.ModEventLabel + | ToolsOzoneModerationDefs.ModEventMute + | ToolsOzoneModerationDefs.ModEventMuteReporter + | ToolsOzoneModerationDefs.ModEventReport + | ToolsOzoneModerationDefs.ModEventResolveAppeal + | ToolsOzoneModerationDefs.ModEventReverseTakedown + | ToolsOzoneModerationDefs.ModEventTag + | ToolsOzoneModerationDefs.ModEventTakedown + | ToolsOzoneModerationDefs.ModEventUnmute + | ToolsOzoneModerationDefs.ModEventUnmuteReporter + | ToolsOzoneModerationDefs.RecordEvent + >; + subject: Brand.Union< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + subjectBlobCids?: At.CID[]; + } + type Output = ToolsOzoneModerationDefs.ModEventView; + interface Errors { + SubjectHasAction: {}; + } +} + +/** Get details about a moderation event. */ +export declare namespace ToolsOzoneModerationGetEvent { + interface Params { + id: number; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.ModEventViewDetail; +} + +/** Get details about a record. */ +export declare namespace ToolsOzoneModerationGetRecord { + interface Params { + uri: At.Uri; + cid?: At.CID; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.RecordViewDetail; + interface Errors { + RecordNotFound: {}; + } +} + +/** Get details about some records. */ +export declare namespace ToolsOzoneModerationGetRecords { + interface Params { + /** Maximum array length: 100 */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output { + records: Brand.Union< + | ToolsOzoneModerationDefs.RecordViewDetail + | ToolsOzoneModerationDefs.RecordViewNotFound + >[]; + } +} + +/** Get details about a repository. */ +export declare namespace ToolsOzoneModerationGetRepo { + interface Params { + did: At.DID; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.RepoViewDetail; + interface Errors { + RepoNotFound: {}; + } +} + +/** Get details about some repositories. */ +export declare namespace ToolsOzoneModerationGetRepos { + interface Params { + /** Maximum array length: 100 */ + dids: At.DID[]; + } + type Input = undefined; + interface Output { + repos: Brand.Union< + | ToolsOzoneModerationDefs.RepoViewDetail + | ToolsOzoneModerationDefs.RepoViewNotFound + >[]; + } +} + +/** List moderation events related to a subject. */ +export declare namespace ToolsOzoneModerationQueryEvents { + interface Params { + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[]; + /** If specified, only events where all of these tags were added are returned */ + addedTags?: string[]; + /** + * If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. + * Maximum array length: 20 + */ + collections?: string[]; + /** If specified, only events with comments containing the keyword are returned. Apply || separator to use multiple keywords and match using OR condition. */ + comment?: string; + /** Retrieve events created after a given timestamp */ + createdAfter?: string; + /** Retrieve events created before a given timestamp */ + createdBefore?: string; + createdBy?: At.DID; + cursor?: string; + /** If true, only events with comments are returned */ + hasComment?: boolean; + /** + * If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned. + * \@default false + */ + includeAllUserRecords?: boolean; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[]; + /** If specified, only events where all of these tags were removed are returned */ + removedTags?: string[]; + reportTypes?: string[]; + /** + * Sort direction for the events. Defaults to descending order of created at timestamp. + * \@default "desc" + */ + sortDirection?: "asc" | "desc"; + subject?: string; + /** If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ + subjectType?: "account" | "record" | (string & {}); + /** The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent) to filter by. If not specified, all events are returned. */ + types?: string[]; + } + type Input = undefined; + interface Output { + events: ToolsOzoneModerationDefs.ModEventView[]; + cursor?: string; + } +} + +/** View moderation statuses of subjects (record or repo). */ +export declare namespace ToolsOzoneModerationQueryStatuses { + interface Params { + /** Get subjects in unresolved appealed status */ + appealed?: boolean; + /** + * If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored. + * Maximum array length: 20 + */ + collections?: string[]; + /** Search subjects by keyword from comments */ + comment?: string; + cursor?: string; + excludeTags?: string[]; + /** Search subjects where the associated record/account was deleted after a given timestamp */ + hostingDeletedAfter?: string; + /** Search subjects where the associated record/account was deleted before a given timestamp */ + hostingDeletedBefore?: string; + /** Search subjects by the status of the associated record/account */ + hostingStatuses?: string[]; + /** Search subjects where the associated record/account was updated after a given timestamp */ + hostingUpdatedAfter?: string; + /** Search subjects where the associated record/account was updated before a given timestamp */ + hostingUpdatedBefore?: string; + ignoreSubjects?: string[]; + /** All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned. */ + includeAllUserRecords?: boolean; + /** By default, we don't include muted subjects in the results. Set this to true to include them. */ + includeMuted?: boolean; + /** Get all subject statuses that were reviewed by a specific moderator */ + lastReviewedBy?: At.DID; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** When set to true, only muted subjects and reporters will be returned. */ + onlyMuted?: boolean; + /** Search subjects reported after a given timestamp */ + reportedAfter?: string; + /** Search subjects reported before a given timestamp */ + reportedBefore?: string; + /** Search subjects reviewed after a given timestamp */ + reviewedAfter?: string; + /** Search subjects reviewed before a given timestamp */ + reviewedBefore?: string; + /** Specify when fetching subjects in a certain state */ + reviewState?: string; + /** \@default "desc" */ + sortDirection?: "asc" | "desc"; + /** \@default "lastReportedAt" */ + sortField?: "lastReviewedAt" | "lastReportedAt"; + /** The subject to get the status for. */ + subject?: string; + /** If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ + subjectType?: "account" | "record" | (string & {}); + tags?: string[]; + /** Get subjects that were taken down */ + takendown?: boolean; + } + type Input = undefined; + interface Output { + subjectStatuses: ToolsOzoneModerationDefs.SubjectStatusView[]; + cursor?: string; + } +} + +/** Find repositories based on a search term. */ +export declare namespace ToolsOzoneModerationSearchRepos { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + q?: string; + /** + * DEPRECATED: use 'q' instead + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output { + repos: ToolsOzoneModerationDefs.RepoView[]; + cursor?: string; + } +} + +/** Get details about ozone's server configuration. */ +export declare namespace ToolsOzoneServerGetConfig { + interface Params {} + type Input = undefined; + interface Output { + appview?: ServiceConfig; + blobDivert?: ServiceConfig; + chat?: ServiceConfig; + pds?: ServiceConfig; + viewer?: ViewerConfig; + } + interface ServiceConfig { + [Brand.Type]?: "tools.ozone.server.getConfig#serviceConfig"; + url?: string; + } + interface ViewerConfig { + [Brand.Type]?: "tools.ozone.server.getConfig#viewerConfig"; + role?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } +} + +/** Add values to a specific set. Attempting to add values to a set that does not exist will result in an error. */ +export declare namespace ToolsOzoneSetAddValues { + interface Params {} + interface Input { + /** Name of the set to add values to */ + name: string; + /** + * Array of string values to add to the set + * Minimum array length: 1 + * Maximum array length: 1000 + */ + values: string[]; + } + type Output = undefined; +} + +export declare namespace ToolsOzoneSetDefs { + interface Set { + [Brand.Type]?: "tools.ozone.set.defs#set"; + /** + * Minimum string length: 3 + * Maximum string length: 128 + */ + name: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + } + interface SetView { + [Brand.Type]?: "tools.ozone.set.defs#setView"; + createdAt: string; + /** + * Minimum string length: 3 + * Maximum string length: 128 + */ + name: string; + setSize: number; + updatedAt: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + } +} + +/** Delete an entire set. Attempting to delete a set that does not exist will result in an error. */ +export declare namespace ToolsOzoneSetDeleteSet { + interface Params {} + interface Input { + /** Name of the set to delete */ + name: string; + } + interface Output {} + interface Errors { + SetNotFound: {}; + } +} + +/** Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error */ +export declare namespace ToolsOzoneSetDeleteValues { + interface Params {} + interface Input { + /** Name of the set to delete values from */ + name: string; + /** + * Array of string values to delete from the set + * Minimum array length: 1 + */ + values: string[]; + } + type Output = undefined; + interface Errors { + SetNotFound: {}; + } +} + +/** Get a specific set and its values */ +export declare namespace ToolsOzoneSetGetValues { + interface Params { + name: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 100 + */ + limit?: number; + } + type Input = undefined; + interface Output { + set: ToolsOzoneSetDefs.SetView; + values: string[]; + cursor?: string; + } + interface Errors { + SetNotFound: {}; + } +} + +/** Query available sets */ +export declare namespace ToolsOzoneSetQuerySets { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + namePrefix?: string; + /** \@default "name" */ + sortBy?: "name" | "createdAt" | "updatedAt"; + /** + * Defaults to ascending order of name field. + * \@default "asc" + */ + sortDirection?: "asc" | "desc"; + } + type Input = undefined; + interface Output { + sets: ToolsOzoneSetDefs.SetView[]; + cursor?: string; + } +} + +/** Create or update set metadata */ +export declare namespace ToolsOzoneSetUpsertSet { + interface Params {} + type Input = ToolsOzoneSetDefs.Set; + type Output = ToolsOzoneSetDefs.SetView; +} + +export declare namespace ToolsOzoneSettingDefs { + interface Option { + [Brand.Type]?: "tools.ozone.setting.defs#option"; + createdBy: At.DID; + did: At.DID; + key: string; + lastUpdatedBy: At.DID; + scope: "instance" | "personal" | (string & {}); + value: unknown; + createdAt?: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + managerRole?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + updatedAt?: string; + } +} + +/** List settings with optional filtering */ +export declare namespace ToolsOzoneSettingListOptions { + interface Params { + cursor?: string; + /** + * Filter for only the specified keys. Ignored if prefix is provided + * Maximum array length: 100 + */ + keys?: string[]; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** Filter keys by prefix */ + prefix?: string; + /** \@default "instance" */ + scope?: "instance" | "personal" | (string & {}); + } + type Input = undefined; + interface Output { + options: ToolsOzoneSettingDefs.Option[]; + cursor?: string; + } +} + +/** Delete settings by key */ +export declare namespace ToolsOzoneSettingRemoveOptions { + interface Params {} + interface Input { + /** + * Minimum array length: 1 + * Maximum array length: 200 + */ + keys: string[]; + scope: "instance" | "personal" | (string & {}); + } + interface Output {} +} + +/** Create or update setting option */ +export declare namespace ToolsOzoneSettingUpsertOption { + interface Params {} + interface Input { + key: string; + scope: "instance" | "personal" | (string & {}); + value: unknown; + /** Maximum string length: 2000 */ + description?: string; + managerRole?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } + interface Output { + option: ToolsOzoneSettingDefs.Option; + } +} + +export declare namespace ToolsOzoneSignatureDefs { + interface SigDetail { + [Brand.Type]?: "tools.ozone.signature.defs#sigDetail"; + property: string; + value: string; + } +} + +/** Find all correlated threat signatures between 2 or more accounts. */ +export declare namespace ToolsOzoneSignatureFindCorrelation { + interface Params { + dids: At.DID[]; + } + type Input = undefined; + interface Output { + details: ToolsOzoneSignatureDefs.SigDetail[]; + } +} + +/** Get accounts that share some matching threat signatures with the root account. */ +export declare namespace ToolsOzoneSignatureFindRelatedAccounts { + interface Params { + did: At.DID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + accounts: RelatedAccount[]; + cursor?: string; + } + interface RelatedAccount { + [Brand.Type]?: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; + account: ComAtprotoAdminDefs.AccountView; + similarities?: ToolsOzoneSignatureDefs.SigDetail[]; + } +} + +/** Search for accounts that match one or more threat signature values. */ +export declare namespace ToolsOzoneSignatureSearchAccounts { + interface Params { + values: string[]; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + accounts: ComAtprotoAdminDefs.AccountView[]; + cursor?: string; + } +} + +/** Add a member to the ozone team. Requires admin role. */ +export declare namespace ToolsOzoneTeamAddMember { + interface Params {} + interface Input { + did: At.DID; + role: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } + type Output = ToolsOzoneTeamDefs.Member; + interface Errors { + MemberAlreadyExists: {}; + } +} + +export declare namespace ToolsOzoneTeamDefs { + interface Member { + [Brand.Type]?: "tools.ozone.team.defs#member"; + did: At.DID; + role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); + createdAt?: string; + disabled?: boolean; + lastUpdatedBy?: string; + profile?: AppBskyActorDefs.ProfileViewDetailed; + updatedAt?: string; + } + type RoleAdmin = "tools.ozone.team.defs#roleAdmin"; + type RoleModerator = "tools.ozone.team.defs#roleModerator"; + type RoleTriage = "tools.ozone.team.defs#roleTriage"; +} + +/** Delete a member from ozone team. Requires admin role. */ +export declare namespace ToolsOzoneTeamDeleteMember { + interface Params {} + interface Input { + did: At.DID; + } + type Output = undefined; + interface Errors { + MemberNotFound: {}; + CannotDeleteSelf: {}; + } +} + +/** List all members with access to the ozone service. */ +export declare namespace ToolsOzoneTeamListMembers { + interface Params { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output { + members: ToolsOzoneTeamDefs.Member[]; + cursor?: string; + } +} + +/** Update a member in the ozone service. Requires admin role. */ +export declare namespace ToolsOzoneTeamUpdateMember { + interface Params {} + interface Input { + did: At.DID; + disabled?: boolean; + role?: + | "tools.ozone.team.defs#roleAdmin" + | "tools.ozone.team.defs#roleModerator" + | "tools.ozone.team.defs#roleTriage" + | (string & {}); + } + type Output = ToolsOzoneTeamDefs.Member; + interface Errors { + MemberNotFound: {}; + } +} + +export declare interface Records { + "app.bsky.actor.profile": AppBskyActorProfile.Record; + "app.bsky.feed.generator": AppBskyFeedGenerator.Record; + "app.bsky.feed.like": AppBskyFeedLike.Record; + "app.bsky.feed.post": AppBskyFeedPost.Record; + "app.bsky.feed.postgate": AppBskyFeedPostgate.Record; + "app.bsky.feed.repost": AppBskyFeedRepost.Record; + "app.bsky.feed.threadgate": AppBskyFeedThreadgate.Record; + "app.bsky.graph.block": AppBskyGraphBlock.Record; + "app.bsky.graph.follow": AppBskyGraphFollow.Record; + "app.bsky.graph.list": AppBskyGraphList.Record; + "app.bsky.graph.listblock": AppBskyGraphListblock.Record; + "app.bsky.graph.listitem": AppBskyGraphListitem.Record; + "app.bsky.graph.starterpack": AppBskyGraphStarterpack.Record; + "app.bsky.labeler.service": AppBskyLabelerService.Record; + "chat.bsky.actor.declaration": ChatBskyActorDeclaration.Record; +} + +export declare interface Queries { + "app.bsky.actor.getPreferences": { + output: AppBskyActorGetPreferences.Output; + }; + "app.bsky.actor.getProfile": { + params: AppBskyActorGetProfile.Params; + output: AppBskyActorGetProfile.Output; + }; + "app.bsky.actor.getProfiles": { + params: AppBskyActorGetProfiles.Params; + output: AppBskyActorGetProfiles.Output; + }; + "app.bsky.actor.getSuggestions": { + params: AppBskyActorGetSuggestions.Params; + output: AppBskyActorGetSuggestions.Output; + }; + "app.bsky.actor.searchActors": { + params: AppBskyActorSearchActors.Params; + output: AppBskyActorSearchActors.Output; + }; + "app.bsky.actor.searchActorsTypeahead": { + params: AppBskyActorSearchActorsTypeahead.Params; + output: AppBskyActorSearchActorsTypeahead.Output; + }; + "app.bsky.feed.describeFeedGenerator": { + output: AppBskyFeedDescribeFeedGenerator.Output; + }; + "app.bsky.feed.getActorFeeds": { + params: AppBskyFeedGetActorFeeds.Params; + output: AppBskyFeedGetActorFeeds.Output; + }; + "app.bsky.feed.getActorLikes": { + params: AppBskyFeedGetActorLikes.Params; + output: AppBskyFeedGetActorLikes.Output; + }; + "app.bsky.feed.getAuthorFeed": { + params: AppBskyFeedGetAuthorFeed.Params; + output: AppBskyFeedGetAuthorFeed.Output; + }; + "app.bsky.feed.getFeed": { + params: AppBskyFeedGetFeed.Params; + output: AppBskyFeedGetFeed.Output; + }; + "app.bsky.feed.getFeedGenerator": { + params: AppBskyFeedGetFeedGenerator.Params; + output: AppBskyFeedGetFeedGenerator.Output; + }; + "app.bsky.feed.getFeedGenerators": { + params: AppBskyFeedGetFeedGenerators.Params; + output: AppBskyFeedGetFeedGenerators.Output; + }; + "app.bsky.feed.getFeedSkeleton": { + params: AppBskyFeedGetFeedSkeleton.Params; + output: AppBskyFeedGetFeedSkeleton.Output; + }; + "app.bsky.feed.getLikes": { + params: AppBskyFeedGetLikes.Params; + output: AppBskyFeedGetLikes.Output; + }; + "app.bsky.feed.getListFeed": { + params: AppBskyFeedGetListFeed.Params; + output: AppBskyFeedGetListFeed.Output; + }; + "app.bsky.feed.getPosts": { + params: AppBskyFeedGetPosts.Params; + output: AppBskyFeedGetPosts.Output; + }; + "app.bsky.feed.getPostThread": { + params: AppBskyFeedGetPostThread.Params; + output: AppBskyFeedGetPostThread.Output; + }; + "app.bsky.feed.getQuotes": { + params: AppBskyFeedGetQuotes.Params; + output: AppBskyFeedGetQuotes.Output; + }; + "app.bsky.feed.getRepostedBy": { + params: AppBskyFeedGetRepostedBy.Params; + output: AppBskyFeedGetRepostedBy.Output; + }; + "app.bsky.feed.getSuggestedFeeds": { + params: AppBskyFeedGetSuggestedFeeds.Params; + output: AppBskyFeedGetSuggestedFeeds.Output; + }; + "app.bsky.feed.getTimeline": { + params: AppBskyFeedGetTimeline.Params; + output: AppBskyFeedGetTimeline.Output; + }; + "app.bsky.feed.searchPosts": { + params: AppBskyFeedSearchPosts.Params; + output: AppBskyFeedSearchPosts.Output; + }; + "app.bsky.graph.getActorStarterPacks": { + params: AppBskyGraphGetActorStarterPacks.Params; + output: AppBskyGraphGetActorStarterPacks.Output; + }; + "app.bsky.graph.getBlocks": { + params: AppBskyGraphGetBlocks.Params; + output: AppBskyGraphGetBlocks.Output; + }; + "app.bsky.graph.getFollowers": { + params: AppBskyGraphGetFollowers.Params; + output: AppBskyGraphGetFollowers.Output; + }; + "app.bsky.graph.getFollows": { + params: AppBskyGraphGetFollows.Params; + output: AppBskyGraphGetFollows.Output; + }; + "app.bsky.graph.getKnownFollowers": { + params: AppBskyGraphGetKnownFollowers.Params; + output: AppBskyGraphGetKnownFollowers.Output; + }; + "app.bsky.graph.getList": { + params: AppBskyGraphGetList.Params; + output: AppBskyGraphGetList.Output; + }; + "app.bsky.graph.getListBlocks": { + params: AppBskyGraphGetListBlocks.Params; + output: AppBskyGraphGetListBlocks.Output; + }; + "app.bsky.graph.getListMutes": { + params: AppBskyGraphGetListMutes.Params; + output: AppBskyGraphGetListMutes.Output; + }; + "app.bsky.graph.getLists": { + params: AppBskyGraphGetLists.Params; + output: AppBskyGraphGetLists.Output; + }; + "app.bsky.graph.getMutes": { + params: AppBskyGraphGetMutes.Params; + output: AppBskyGraphGetMutes.Output; + }; + "app.bsky.graph.getRelationships": { + params: AppBskyGraphGetRelationships.Params; + output: AppBskyGraphGetRelationships.Output; + }; + "app.bsky.graph.getStarterPack": { + params: AppBskyGraphGetStarterPack.Params; + output: AppBskyGraphGetStarterPack.Output; + }; + "app.bsky.graph.getStarterPacks": { + params: AppBskyGraphGetStarterPacks.Params; + output: AppBskyGraphGetStarterPacks.Output; + }; + "app.bsky.graph.getSuggestedFollowsByActor": { + params: AppBskyGraphGetSuggestedFollowsByActor.Params; + output: AppBskyGraphGetSuggestedFollowsByActor.Output; + }; + "app.bsky.graph.searchStarterPacks": { + params: AppBskyGraphSearchStarterPacks.Params; + output: AppBskyGraphSearchStarterPacks.Output; + }; + "app.bsky.labeler.getServices": { + params: AppBskyLabelerGetServices.Params; + output: AppBskyLabelerGetServices.Output; + }; + "app.bsky.notification.getUnreadCount": { + params: AppBskyNotificationGetUnreadCount.Params; + output: AppBskyNotificationGetUnreadCount.Output; + }; + "app.bsky.notification.listNotifications": { + params: AppBskyNotificationListNotifications.Params; + output: AppBskyNotificationListNotifications.Output; + }; + "app.bsky.unspecced.getConfig": { + output: AppBskyUnspeccedGetConfig.Output; + }; + "app.bsky.unspecced.getPopularFeedGenerators": { + params: AppBskyUnspeccedGetPopularFeedGenerators.Params; + output: AppBskyUnspeccedGetPopularFeedGenerators.Output; + }; + "app.bsky.unspecced.getSuggestionsSkeleton": { + params: AppBskyUnspeccedGetSuggestionsSkeleton.Params; + output: AppBskyUnspeccedGetSuggestionsSkeleton.Output; + }; + "app.bsky.unspecced.getTaggedSuggestions": { + output: AppBskyUnspeccedGetTaggedSuggestions.Output; + }; + "app.bsky.unspecced.searchActorsSkeleton": { + params: AppBskyUnspeccedSearchActorsSkeleton.Params; + output: AppBskyUnspeccedSearchActorsSkeleton.Output; + }; + "app.bsky.unspecced.searchPostsSkeleton": { + params: AppBskyUnspeccedSearchPostsSkeleton.Params; + output: AppBskyUnspeccedSearchPostsSkeleton.Output; + }; + "app.bsky.unspecced.searchStarterPacksSkeleton": { + params: AppBskyUnspeccedSearchStarterPacksSkeleton.Params; + output: AppBskyUnspeccedSearchStarterPacksSkeleton.Output; + }; + "app.bsky.video.getJobStatus": { + params: AppBskyVideoGetJobStatus.Params; + output: AppBskyVideoGetJobStatus.Output; + }; + "app.bsky.video.getUploadLimits": { + output: AppBskyVideoGetUploadLimits.Output; + }; + "chat.bsky.actor.exportAccountData": { + output: ChatBskyActorExportAccountData.Output; + }; + "chat.bsky.convo.getConvo": { + params: ChatBskyConvoGetConvo.Params; + output: ChatBskyConvoGetConvo.Output; + }; + "chat.bsky.convo.getConvoForMembers": { + params: ChatBskyConvoGetConvoForMembers.Params; + output: ChatBskyConvoGetConvoForMembers.Output; + }; + "chat.bsky.convo.getLog": { + params: ChatBskyConvoGetLog.Params; + output: ChatBskyConvoGetLog.Output; + }; + "chat.bsky.convo.getMessages": { + params: ChatBskyConvoGetMessages.Params; + output: ChatBskyConvoGetMessages.Output; + }; + "chat.bsky.convo.listConvos": { + params: ChatBskyConvoListConvos.Params; + output: ChatBskyConvoListConvos.Output; + }; + "chat.bsky.moderation.getActorMetadata": { + params: ChatBskyModerationGetActorMetadata.Params; + output: ChatBskyModerationGetActorMetadata.Output; + }; + "chat.bsky.moderation.getMessageContext": { + params: ChatBskyModerationGetMessageContext.Params; + output: ChatBskyModerationGetMessageContext.Output; + }; + "com.atproto.admin.getAccountInfo": { + params: ComAtprotoAdminGetAccountInfo.Params; + output: ComAtprotoAdminGetAccountInfo.Output; + }; + "com.atproto.admin.getAccountInfos": { + params: ComAtprotoAdminGetAccountInfos.Params; + output: ComAtprotoAdminGetAccountInfos.Output; + }; + "com.atproto.admin.getInviteCodes": { + params: ComAtprotoAdminGetInviteCodes.Params; + output: ComAtprotoAdminGetInviteCodes.Output; + }; + "com.atproto.admin.getSubjectStatus": { + params: ComAtprotoAdminGetSubjectStatus.Params; + output: ComAtprotoAdminGetSubjectStatus.Output; + }; + "com.atproto.admin.searchAccounts": { + params: ComAtprotoAdminSearchAccounts.Params; + output: ComAtprotoAdminSearchAccounts.Output; + }; + "com.atproto.identity.getRecommendedDidCredentials": { + output: ComAtprotoIdentityGetRecommendedDidCredentials.Output; + }; + "com.atproto.identity.resolveHandle": { + params: ComAtprotoIdentityResolveHandle.Params; + output: ComAtprotoIdentityResolveHandle.Output; + }; + "com.atproto.label.queryLabels": { + params: ComAtprotoLabelQueryLabels.Params; + output: ComAtprotoLabelQueryLabels.Output; + }; + "com.atproto.repo.describeRepo": { + params: ComAtprotoRepoDescribeRepo.Params; + output: ComAtprotoRepoDescribeRepo.Output; + }; + "com.atproto.repo.getRecord": { + params: ComAtprotoRepoGetRecord.Params; + output: ComAtprotoRepoGetRecord.Output; + }; + "com.atproto.repo.listMissingBlobs": { + params: ComAtprotoRepoListMissingBlobs.Params; + output: ComAtprotoRepoListMissingBlobs.Output; + }; + "com.atproto.repo.listRecords": { + params: ComAtprotoRepoListRecords.Params; + output: ComAtprotoRepoListRecords.Output; + }; + "com.atproto.server.checkAccountStatus": { + output: ComAtprotoServerCheckAccountStatus.Output; + }; + "com.atproto.server.describeServer": { + output: ComAtprotoServerDescribeServer.Output; + }; + "com.atproto.server.getAccountInviteCodes": { + params: ComAtprotoServerGetAccountInviteCodes.Params; + output: ComAtprotoServerGetAccountInviteCodes.Output; + }; + "com.atproto.server.getServiceAuth": { + params: ComAtprotoServerGetServiceAuth.Params; + output: ComAtprotoServerGetServiceAuth.Output; + }; + "com.atproto.server.getSession": { + output: ComAtprotoServerGetSession.Output; + }; + "com.atproto.server.listAppPasswords": { + output: ComAtprotoServerListAppPasswords.Output; + }; + "com.atproto.sync.getBlob": { + params: ComAtprotoSyncGetBlob.Params; + output: ComAtprotoSyncGetBlob.Output; + }; + "com.atproto.sync.getBlocks": { + params: ComAtprotoSyncGetBlocks.Params; + output: ComAtprotoSyncGetBlocks.Output; + }; + "com.atproto.sync.getCheckout": { + params: ComAtprotoSyncGetCheckout.Params; + output: ComAtprotoSyncGetCheckout.Output; + }; + "com.atproto.sync.getHead": { + params: ComAtprotoSyncGetHead.Params; + output: ComAtprotoSyncGetHead.Output; + }; + "com.atproto.sync.getLatestCommit": { + params: ComAtprotoSyncGetLatestCommit.Params; + output: ComAtprotoSyncGetLatestCommit.Output; + }; + "com.atproto.sync.getRecord": { + params: ComAtprotoSyncGetRecord.Params; + output: ComAtprotoSyncGetRecord.Output; + }; + "com.atproto.sync.getRepo": { + params: ComAtprotoSyncGetRepo.Params; + output: ComAtprotoSyncGetRepo.Output; + }; + "com.atproto.sync.getRepoStatus": { + params: ComAtprotoSyncGetRepoStatus.Params; + output: ComAtprotoSyncGetRepoStatus.Output; + }; + "com.atproto.sync.listBlobs": { + params: ComAtprotoSyncListBlobs.Params; + output: ComAtprotoSyncListBlobs.Output; + }; + "com.atproto.sync.listRepos": { + params: ComAtprotoSyncListRepos.Params; + output: ComAtprotoSyncListRepos.Output; + }; + "com.atproto.temp.checkSignupQueue": { + output: ComAtprotoTempCheckSignupQueue.Output; + }; + "com.atproto.temp.fetchLabels": { + params: ComAtprotoTempFetchLabels.Params; + output: ComAtprotoTempFetchLabels.Output; + }; + "tools.ozone.communication.listTemplates": { + output: ToolsOzoneCommunicationListTemplates.Output; + }; + "tools.ozone.moderation.getEvent": { + params: ToolsOzoneModerationGetEvent.Params; + output: ToolsOzoneModerationGetEvent.Output; + }; + "tools.ozone.moderation.getRecord": { + params: ToolsOzoneModerationGetRecord.Params; + output: ToolsOzoneModerationGetRecord.Output; + }; + "tools.ozone.moderation.getRecords": { + params: ToolsOzoneModerationGetRecords.Params; + output: ToolsOzoneModerationGetRecords.Output; + }; + "tools.ozone.moderation.getRepo": { + params: ToolsOzoneModerationGetRepo.Params; + output: ToolsOzoneModerationGetRepo.Output; + }; + "tools.ozone.moderation.getRepos": { + params: ToolsOzoneModerationGetRepos.Params; + output: ToolsOzoneModerationGetRepos.Output; + }; + "tools.ozone.moderation.queryEvents": { + params: ToolsOzoneModerationQueryEvents.Params; + output: ToolsOzoneModerationQueryEvents.Output; + }; + "tools.ozone.moderation.queryStatuses": { + params: ToolsOzoneModerationQueryStatuses.Params; + output: ToolsOzoneModerationQueryStatuses.Output; + }; + "tools.ozone.moderation.searchRepos": { + params: ToolsOzoneModerationSearchRepos.Params; + output: ToolsOzoneModerationSearchRepos.Output; + }; + "tools.ozone.server.getConfig": { + output: ToolsOzoneServerGetConfig.Output; + }; + "tools.ozone.set.getValues": { + params: ToolsOzoneSetGetValues.Params; + output: ToolsOzoneSetGetValues.Output; + }; + "tools.ozone.set.querySets": { + params: ToolsOzoneSetQuerySets.Params; + output: ToolsOzoneSetQuerySets.Output; + }; + "tools.ozone.setting.listOptions": { + params: ToolsOzoneSettingListOptions.Params; + output: ToolsOzoneSettingListOptions.Output; + }; + "tools.ozone.signature.findCorrelation": { + params: ToolsOzoneSignatureFindCorrelation.Params; + output: ToolsOzoneSignatureFindCorrelation.Output; + }; + "tools.ozone.signature.findRelatedAccounts": { + params: ToolsOzoneSignatureFindRelatedAccounts.Params; + output: ToolsOzoneSignatureFindRelatedAccounts.Output; + }; + "tools.ozone.signature.searchAccounts": { + params: ToolsOzoneSignatureSearchAccounts.Params; + output: ToolsOzoneSignatureSearchAccounts.Output; + }; + "tools.ozone.team.listMembers": { + params: ToolsOzoneTeamListMembers.Params; + output: ToolsOzoneTeamListMembers.Output; + }; +} + +export declare interface Procedures { + "app.bsky.actor.putPreferences": { + input: AppBskyActorPutPreferences.Input; + }; + "app.bsky.feed.sendInteractions": { + input: AppBskyFeedSendInteractions.Input; + output: AppBskyFeedSendInteractions.Output; + }; + "app.bsky.graph.muteActor": { + input: AppBskyGraphMuteActor.Input; + }; + "app.bsky.graph.muteActorList": { + input: AppBskyGraphMuteActorList.Input; + }; + "app.bsky.graph.muteThread": { + input: AppBskyGraphMuteThread.Input; + }; + "app.bsky.graph.unmuteActor": { + input: AppBskyGraphUnmuteActor.Input; + }; + "app.bsky.graph.unmuteActorList": { + input: AppBskyGraphUnmuteActorList.Input; + }; + "app.bsky.graph.unmuteThread": { + input: AppBskyGraphUnmuteThread.Input; + }; + "app.bsky.notification.putPreferences": { + input: AppBskyNotificationPutPreferences.Input; + }; + "app.bsky.notification.registerPush": { + input: AppBskyNotificationRegisterPush.Input; + }; + "app.bsky.notification.updateSeen": { + input: AppBskyNotificationUpdateSeen.Input; + }; + "app.bsky.video.uploadVideo": { + input: AppBskyVideoUploadVideo.Input; + output: AppBskyVideoUploadVideo.Output; + }; + "chat.bsky.actor.deleteAccount": { + output: ChatBskyActorDeleteAccount.Output; + }; + "chat.bsky.convo.deleteMessageForSelf": { + input: ChatBskyConvoDeleteMessageForSelf.Input; + output: ChatBskyConvoDeleteMessageForSelf.Output; + }; + "chat.bsky.convo.leaveConvo": { + input: ChatBskyConvoLeaveConvo.Input; + output: ChatBskyConvoLeaveConvo.Output; + }; + "chat.bsky.convo.muteConvo": { + input: ChatBskyConvoMuteConvo.Input; + output: ChatBskyConvoMuteConvo.Output; + }; + "chat.bsky.convo.sendMessage": { + input: ChatBskyConvoSendMessage.Input; + output: ChatBskyConvoSendMessage.Output; + }; + "chat.bsky.convo.sendMessageBatch": { + input: ChatBskyConvoSendMessageBatch.Input; + output: ChatBskyConvoSendMessageBatch.Output; + }; + "chat.bsky.convo.unmuteConvo": { + input: ChatBskyConvoUnmuteConvo.Input; + output: ChatBskyConvoUnmuteConvo.Output; + }; + "chat.bsky.convo.updateRead": { + input: ChatBskyConvoUpdateRead.Input; + output: ChatBskyConvoUpdateRead.Output; + }; + "chat.bsky.moderation.updateActorAccess": { + input: ChatBskyModerationUpdateActorAccess.Input; + }; + "com.atproto.admin.deleteAccount": { + input: ComAtprotoAdminDeleteAccount.Input; + }; + "com.atproto.admin.disableAccountInvites": { + input: ComAtprotoAdminDisableAccountInvites.Input; + }; + "com.atproto.admin.disableInviteCodes": { + input: ComAtprotoAdminDisableInviteCodes.Input; + }; + "com.atproto.admin.enableAccountInvites": { + input: ComAtprotoAdminEnableAccountInvites.Input; + }; + "com.atproto.admin.sendEmail": { + input: ComAtprotoAdminSendEmail.Input; + output: ComAtprotoAdminSendEmail.Output; + }; + "com.atproto.admin.updateAccountEmail": { + input: ComAtprotoAdminUpdateAccountEmail.Input; + }; + "com.atproto.admin.updateAccountHandle": { + input: ComAtprotoAdminUpdateAccountHandle.Input; + }; + "com.atproto.admin.updateAccountPassword": { + input: ComAtprotoAdminUpdateAccountPassword.Input; + }; + "com.atproto.admin.updateSubjectStatus": { + input: ComAtprotoAdminUpdateSubjectStatus.Input; + output: ComAtprotoAdminUpdateSubjectStatus.Output; + }; + "com.atproto.identity.requestPlcOperationSignature": {}; + "com.atproto.identity.signPlcOperation": { + input: ComAtprotoIdentitySignPlcOperation.Input; + output: ComAtprotoIdentitySignPlcOperation.Output; + }; + "com.atproto.identity.submitPlcOperation": { + input: ComAtprotoIdentitySubmitPlcOperation.Input; + }; + "com.atproto.identity.updateHandle": { + input: ComAtprotoIdentityUpdateHandle.Input; + }; + "com.atproto.moderation.createReport": { + input: ComAtprotoModerationCreateReport.Input; + output: ComAtprotoModerationCreateReport.Output; + }; + "com.atproto.repo.applyWrites": { + input: ComAtprotoRepoApplyWrites.Input; + output: ComAtprotoRepoApplyWrites.Output; + }; + "com.atproto.repo.createRecord": { + input: ComAtprotoRepoCreateRecord.Input; + output: ComAtprotoRepoCreateRecord.Output; + }; + "com.atproto.repo.deleteRecord": { + input: ComAtprotoRepoDeleteRecord.Input; + output: ComAtprotoRepoDeleteRecord.Output; + }; + "com.atproto.repo.importRepo": { + input: ComAtprotoRepoImportRepo.Input; + }; + "com.atproto.repo.putRecord": { + input: ComAtprotoRepoPutRecord.Input; + output: ComAtprotoRepoPutRecord.Output; + }; + "com.atproto.repo.uploadBlob": { + input: ComAtprotoRepoUploadBlob.Input; + output: ComAtprotoRepoUploadBlob.Output; + }; + "com.atproto.server.activateAccount": {}; + "com.atproto.server.confirmEmail": { + input: ComAtprotoServerConfirmEmail.Input; + }; + "com.atproto.server.createAccount": { + input: ComAtprotoServerCreateAccount.Input; + output: ComAtprotoServerCreateAccount.Output; + }; + "com.atproto.server.createAppPassword": { + input: ComAtprotoServerCreateAppPassword.Input; + output: ComAtprotoServerCreateAppPassword.Output; + }; + "com.atproto.server.createInviteCode": { + input: ComAtprotoServerCreateInviteCode.Input; + output: ComAtprotoServerCreateInviteCode.Output; + }; + "com.atproto.server.createInviteCodes": { + input: ComAtprotoServerCreateInviteCodes.Input; + output: ComAtprotoServerCreateInviteCodes.Output; + }; + "com.atproto.server.createSession": { + input: ComAtprotoServerCreateSession.Input; + output: ComAtprotoServerCreateSession.Output; + }; + "com.atproto.server.deactivateAccount": { + input: ComAtprotoServerDeactivateAccount.Input; + }; + "com.atproto.server.deleteAccount": { + input: ComAtprotoServerDeleteAccount.Input; + }; + "com.atproto.server.deleteSession": {}; + "com.atproto.server.refreshSession": { + output: ComAtprotoServerRefreshSession.Output; + }; + "com.atproto.server.requestAccountDelete": {}; + "com.atproto.server.requestEmailConfirmation": {}; + "com.atproto.server.requestEmailUpdate": { + output: ComAtprotoServerRequestEmailUpdate.Output; + }; + "com.atproto.server.requestPasswordReset": { + input: ComAtprotoServerRequestPasswordReset.Input; + }; + "com.atproto.server.reserveSigningKey": { + input: ComAtprotoServerReserveSigningKey.Input; + output: ComAtprotoServerReserveSigningKey.Output; + }; + "com.atproto.server.resetPassword": { + input: ComAtprotoServerResetPassword.Input; + }; + "com.atproto.server.revokeAppPassword": { + input: ComAtprotoServerRevokeAppPassword.Input; + }; + "com.atproto.server.updateEmail": { + input: ComAtprotoServerUpdateEmail.Input; + }; + "com.atproto.sync.notifyOfUpdate": { + input: ComAtprotoSyncNotifyOfUpdate.Input; + }; + "com.atproto.sync.requestCrawl": { + input: ComAtprotoSyncRequestCrawl.Input; + }; + "com.atproto.temp.addReservedHandle": { + input: ComAtprotoTempAddReservedHandle.Input; + output: ComAtprotoTempAddReservedHandle.Output; + }; + "com.atproto.temp.requestPhoneVerification": { + input: ComAtprotoTempRequestPhoneVerification.Input; + }; + "tools.ozone.communication.createTemplate": { + input: ToolsOzoneCommunicationCreateTemplate.Input; + output: ToolsOzoneCommunicationCreateTemplate.Output; + }; + "tools.ozone.communication.deleteTemplate": { + input: ToolsOzoneCommunicationDeleteTemplate.Input; + }; + "tools.ozone.communication.updateTemplate": { + input: ToolsOzoneCommunicationUpdateTemplate.Input; + output: ToolsOzoneCommunicationUpdateTemplate.Output; + }; + "tools.ozone.moderation.emitEvent": { + input: ToolsOzoneModerationEmitEvent.Input; + output: ToolsOzoneModerationEmitEvent.Output; + }; + "tools.ozone.set.addValues": { + input: ToolsOzoneSetAddValues.Input; + }; + "tools.ozone.set.deleteSet": { + input: ToolsOzoneSetDeleteSet.Input; + output: ToolsOzoneSetDeleteSet.Output; + }; + "tools.ozone.set.deleteValues": { + input: ToolsOzoneSetDeleteValues.Input; + }; + "tools.ozone.set.upsertSet": { + input: ToolsOzoneSetUpsertSet.Input; + output: ToolsOzoneSetUpsertSet.Output; + }; + "tools.ozone.setting.removeOptions": { + input: ToolsOzoneSettingRemoveOptions.Input; + output: ToolsOzoneSettingRemoveOptions.Output; + }; + "tools.ozone.setting.upsertOption": { + input: ToolsOzoneSettingUpsertOption.Input; + output: ToolsOzoneSettingUpsertOption.Output; + }; + "tools.ozone.team.addMember": { + input: ToolsOzoneTeamAddMember.Input; + output: ToolsOzoneTeamAddMember.Output; + }; + "tools.ozone.team.deleteMember": { + input: ToolsOzoneTeamDeleteMember.Input; + }; + "tools.ozone.team.updateMember": { + input: ToolsOzoneTeamUpdateMember.Input; + output: ToolsOzoneTeamUpdateMember.Output; + }; +} + +export declare interface Subscriptions { + "com.atproto.label.subscribeLabels": { + params: ComAtprotoLabelSubscribeLabels.Params; + message: ComAtprotoLabelSubscribeLabels.Message; + errors: ComAtprotoLabelSubscribeLabels.Errors; + }; + "com.atproto.sync.subscribeRepos": { + params: ComAtprotoSyncSubscribeRepos.Params; + message: ComAtprotoSyncSubscribeRepos.Message; + errors: ComAtprotoSyncSubscribeRepos.Errors; + }; +} From 8808969672110e3ecb145dea648875f8b951d2af Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 12:10:38 -0500 Subject: [PATCH 51/68] making more specific --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 6e95d1a..201d122 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,7 +2,7 @@ import antfu from '@antfu/eslint-config'; export default antfu( { - ignores: ['packages/lexicons/**/*'], + ignores: ['packages/lexicons/src/lib/lexicons.ts'], typescript: true, stylistic: { semi: true, From fff023ca3f417792416f87253f07fe37826e6d0b Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 12:10:48 -0500 Subject: [PATCH 52/68] linting --- packages/lexicons/src/index.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index 4cbce4d..ccfe921 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -66,10 +66,10 @@ export type BskyFollow = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}graph.f // --- Type Guards --- export function isRecord(value: unknown): value is RecordDefs { return ( - typeof value === 'object' && - value !== null && - '$type' in value && - typeof value.$type === 'string' + typeof value === 'object' + && value !== null + && '$type' in value + && typeof value.$type === 'string' ); } @@ -86,20 +86,20 @@ export function isBskyPost(value: unknown): value is BskyPost { } // --- Error Types and Guards --- -export type BskyError = { +export interface BskyError { error: string; message: string; statusCode?: number; -}; +} export function isBskyError(value: unknown): value is BskyError { return ( - typeof value === 'object' && - value !== null && - 'error' in value && - 'message' in value && - typeof (value as BskyError).error === 'string' && - typeof (value as BskyError).message === 'string' + typeof value === 'object' + && value !== null + && 'error' in value + && 'message' in value + && typeof (value as BskyError).error === 'string' + && typeof (value as BskyError).message === 'string' ); } From 3ab8d98dde2678ec2480f085217bd028f558be7c Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 14:26:10 -0500 Subject: [PATCH 53/68] making brand tags required --- packages/lex-cli/src/generator/index.ts | 2 +- packages/lex-cli/src/utils/prelude.ts | 6 +- packages/lexicons/src/lib/lexicons.ts | 384 ++++++++++++------------ 3 files changed, 196 insertions(+), 196 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 1b9eb21..c03e558 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -93,7 +93,7 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descs); chunk += `interface ${typeName} {`; - chunk += `[Brand.Type]?: '${nsid}';`; + chunk += `[Brand.Type]: '${nsid}';`; for (const prop of propKeys) { const isOptional = !required || !required.includes(prop); diff --git a/packages/lex-cli/src/utils/prelude.ts b/packages/lex-cli/src/utils/prelude.ts index 01d98ef..2ed9bd9 100644 --- a/packages/lex-cli/src/utils/prelude.ts +++ b/packages/lex-cli/src/utils/prelude.ts @@ -6,13 +6,13 @@ export declare namespace Brand { const Type: unique symbol; /** Get the intended \`$type\` field */ - type GetType = NonNullable; + type GetType = T[typeof Type]; /** Creates a union of objects where it's discriminated by \`$type\` field. */ - type Union = T extends any ? T & { $type: GetType } : never; + type Union = T extends any ? T & { $type: GetType } : never; /** Omits the type branding from object */ - type Omit = ObjectOmit; + type Omit = ObjectOmit; } /** Base AT Protocol schema types */ diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 66eed61..99b14d8 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -14,15 +14,15 @@ export declare namespace Brand { const Type: unique symbol; /** Get the intended `$type` field */ - type GetType = NonNullable; + type GetType = T[typeof Type]; /** Creates a union of objects where it's discriminated by `$type` field. */ - type Union = T extends any + type Union = T extends any ? T & { $type: GetType } : never; /** Omits the type branding from object */ - type Omit = ObjectOmit; + type Omit = ObjectOmit; } /** Base AT Protocol schema types */ @@ -61,19 +61,19 @@ export declare namespace At { } export declare namespace AppBskyActorDefs { interface AdultContentPref { - [Brand.Type]?: "app.bsky.actor.defs#adultContentPref"; + [Brand.Type]: "app.bsky.actor.defs#adultContentPref"; /** \@default false */ enabled: boolean; } /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ interface BskyAppProgressGuide { - [Brand.Type]?: "app.bsky.actor.defs#bskyAppProgressGuide"; + [Brand.Type]: "app.bsky.actor.defs#bskyAppProgressGuide"; /** Maximum string length: 100 */ guide: string; } /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ interface BskyAppStatePref { - [Brand.Type]?: "app.bsky.actor.defs#bskyAppStatePref"; + [Brand.Type]: "app.bsky.actor.defs#bskyAppStatePref"; activeProgressGuide?: BskyAppProgressGuide; /** * Storage for NUXs the user has encountered. @@ -88,14 +88,14 @@ export declare namespace AppBskyActorDefs { queuedNudges?: string[]; } interface ContentLabelPref { - [Brand.Type]?: "app.bsky.actor.defs#contentLabelPref"; + [Brand.Type]: "app.bsky.actor.defs#contentLabelPref"; label: string; visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); /** Which labeler does this preference apply to? If undefined, applies globally. */ labelerDid?: At.DID; } interface FeedViewPref { - [Brand.Type]?: "app.bsky.actor.defs#feedViewPref"; + [Brand.Type]: "app.bsky.actor.defs#feedViewPref"; /** The URI of the feed, or an identifier which describes the feed. */ feed: string; /** Hide quote posts in the feed. */ @@ -113,12 +113,12 @@ export declare namespace AppBskyActorDefs { hideReposts?: boolean; } interface HiddenPostsPref { - [Brand.Type]?: "app.bsky.actor.defs#hiddenPostsPref"; + [Brand.Type]: "app.bsky.actor.defs#hiddenPostsPref"; /** A list of URIs of posts the account owner has hidden. */ items: At.Uri[]; } interface InterestsPref { - [Brand.Type]?: "app.bsky.actor.defs#interestsPref"; + [Brand.Type]: "app.bsky.actor.defs#interestsPref"; /** * A list of tags which describe the account owner's interests gathered during onboarding. * Maximum array length: 100 @@ -129,7 +129,7 @@ export declare namespace AppBskyActorDefs { } /** The subject's followers whom you also follow */ interface KnownFollowers { - [Brand.Type]?: "app.bsky.actor.defs#knownFollowers"; + [Brand.Type]: "app.bsky.actor.defs#knownFollowers"; count: number; /** * Minimum array length: 0 @@ -138,16 +138,16 @@ export declare namespace AppBskyActorDefs { followers: ProfileViewBasic[]; } interface LabelerPrefItem { - [Brand.Type]?: "app.bsky.actor.defs#labelerPrefItem"; + [Brand.Type]: "app.bsky.actor.defs#labelerPrefItem"; did: At.DID; } interface LabelersPref { - [Brand.Type]?: "app.bsky.actor.defs#labelersPref"; + [Brand.Type]: "app.bsky.actor.defs#labelersPref"; labelers: LabelerPrefItem[]; } /** A word that the account owner has muted. */ interface MutedWord { - [Brand.Type]?: "app.bsky.actor.defs#mutedWord"; + [Brand.Type]: "app.bsky.actor.defs#mutedWord"; /** The intended targets of the muted word. */ targets: AppBskyActorDefs.MutedWordTarget[]; /** @@ -166,7 +166,7 @@ export declare namespace AppBskyActorDefs { id?: string; } interface MutedWordsPref { - [Brand.Type]?: "app.bsky.actor.defs#mutedWordsPref"; + [Brand.Type]: "app.bsky.actor.defs#mutedWordsPref"; /** A list of words the account owner has muted. */ items: AppBskyActorDefs.MutedWord[]; } @@ -177,7 +177,7 @@ export declare namespace AppBskyActorDefs { type MutedWordTarget = "content" | "tag" | (string & {}); /** A new user experiences (NUX) storage object */ interface Nux { - [Brand.Type]?: "app.bsky.actor.defs#nux"; + [Brand.Type]: "app.bsky.actor.defs#nux"; /** \@default false */ completed: boolean; /** Maximum string length: 100 */ @@ -192,7 +192,7 @@ export declare namespace AppBskyActorDefs { expiresAt?: string; } interface PersonalDetailsPref { - [Brand.Type]?: "app.bsky.actor.defs#personalDetailsPref"; + [Brand.Type]: "app.bsky.actor.defs#personalDetailsPref"; /** The birth date of account owner. */ birthDate?: string; } @@ -211,7 +211,7 @@ export declare namespace AppBskyActorDefs { | ThreadViewPref >[]; interface ProfileAssociated { - [Brand.Type]?: "app.bsky.actor.defs#profileAssociated"; + [Brand.Type]: "app.bsky.actor.defs#profileAssociated"; chat?: ProfileAssociatedChat; feedgens?: number; labeler?: boolean; @@ -219,11 +219,11 @@ export declare namespace AppBskyActorDefs { starterPacks?: number; } interface ProfileAssociatedChat { - [Brand.Type]?: "app.bsky.actor.defs#profileAssociatedChat"; + [Brand.Type]: "app.bsky.actor.defs#profileAssociatedChat"; allowIncoming: "all" | "following" | "none" | (string & {}); } interface ProfileView { - [Brand.Type]?: "app.bsky.actor.defs#profileView"; + [Brand.Type]: "app.bsky.actor.defs#profileView"; did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -244,7 +244,7 @@ export declare namespace AppBskyActorDefs { viewer?: ViewerState; } interface ProfileViewBasic { - [Brand.Type]?: "app.bsky.actor.defs#profileViewBasic"; + [Brand.Type]: "app.bsky.actor.defs#profileViewBasic"; did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -259,7 +259,7 @@ export declare namespace AppBskyActorDefs { viewer?: ViewerState; } interface ProfileViewDetailed { - [Brand.Type]?: "app.bsky.actor.defs#profileViewDetailed"; + [Brand.Type]: "app.bsky.actor.defs#profileViewDetailed"; did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -286,24 +286,24 @@ export declare namespace AppBskyActorDefs { viewer?: ViewerState; } interface SavedFeed { - [Brand.Type]?: "app.bsky.actor.defs#savedFeed"; + [Brand.Type]: "app.bsky.actor.defs#savedFeed"; id: string; pinned: boolean; type: "feed" | "list" | "timeline" | (string & {}); value: string; } interface SavedFeedsPref { - [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPref"; + [Brand.Type]: "app.bsky.actor.defs#savedFeedsPref"; pinned: At.Uri[]; saved: At.Uri[]; timelineIndex?: number; } interface SavedFeedsPrefV2 { - [Brand.Type]?: "app.bsky.actor.defs#savedFeedsPrefV2"; + [Brand.Type]: "app.bsky.actor.defs#savedFeedsPrefV2"; items: AppBskyActorDefs.SavedFeed[]; } interface ThreadViewPref { - [Brand.Type]?: "app.bsky.actor.defs#threadViewPref"; + [Brand.Type]: "app.bsky.actor.defs#threadViewPref"; /** Show followed users at the top of all replies. */ prioritizeFollowedUsers?: boolean; /** Sorting mode for threads. */ @@ -317,7 +317,7 @@ export declare namespace AppBskyActorDefs { } /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ interface ViewerState { - [Brand.Type]?: "app.bsky.actor.defs#viewerState"; + [Brand.Type]: "app.bsky.actor.defs#viewerState"; blockedBy?: boolean; blocking?: At.Uri; blockingByList?: AppBskyGraphDefs.ListViewBasic; @@ -464,7 +464,7 @@ export declare namespace AppBskyActorSearchActorsTypeahead { export declare namespace AppBskyEmbedDefs { /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ interface AspectRatio { - [Brand.Type]?: "app.bsky.embed.defs#aspectRatio"; + [Brand.Type]: "app.bsky.embed.defs#aspectRatio"; /** Minimum: 1 */ height: number; /** Minimum: 1 */ @@ -475,22 +475,22 @@ export declare namespace AppBskyEmbedDefs { export declare namespace AppBskyEmbedExternal { /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ interface Main { - [Brand.Type]?: "app.bsky.embed.external"; + [Brand.Type]: "app.bsky.embed.external"; external: External; } interface External { - [Brand.Type]?: "app.bsky.embed.external#external"; + [Brand.Type]: "app.bsky.embed.external#external"; description: string; title: string; uri: string; thumb?: At.Blob; } interface View { - [Brand.Type]?: "app.bsky.embed.external#view"; + [Brand.Type]: "app.bsky.embed.external#view"; external: ViewExternal; } interface ViewExternal { - [Brand.Type]?: "app.bsky.embed.external#viewExternal"; + [Brand.Type]: "app.bsky.embed.external#viewExternal"; description: string; title: string; uri: string; @@ -500,24 +500,24 @@ export declare namespace AppBskyEmbedExternal { export declare namespace AppBskyEmbedImages { interface Main { - [Brand.Type]?: "app.bsky.embed.images"; + [Brand.Type]: "app.bsky.embed.images"; /** Maximum array length: 4 */ images: Image[]; } interface Image { - [Brand.Type]?: "app.bsky.embed.images#image"; + [Brand.Type]: "app.bsky.embed.images#image"; /** Alt text description of the image, for accessibility. */ alt: string; image: At.Blob; aspectRatio?: AppBskyEmbedDefs.AspectRatio; } interface View { - [Brand.Type]?: "app.bsky.embed.images#view"; + [Brand.Type]: "app.bsky.embed.images#view"; /** Maximum array length: 4 */ images: ViewImage[]; } interface ViewImage { - [Brand.Type]?: "app.bsky.embed.images#viewImage"; + [Brand.Type]: "app.bsky.embed.images#viewImage"; /** Alt text description of the image, for accessibility. */ alt: string; /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ @@ -530,11 +530,11 @@ export declare namespace AppBskyEmbedImages { export declare namespace AppBskyEmbedRecord { interface Main { - [Brand.Type]?: "app.bsky.embed.record"; + [Brand.Type]: "app.bsky.embed.record"; record: ComAtprotoRepoStrongRef.Main; } interface View { - [Brand.Type]?: "app.bsky.embed.record#view"; + [Brand.Type]: "app.bsky.embed.record#view"; record: Brand.Union< | ViewBlocked | ViewDetached @@ -547,23 +547,23 @@ export declare namespace AppBskyEmbedRecord { >; } interface ViewBlocked { - [Brand.Type]?: "app.bsky.embed.record#viewBlocked"; + [Brand.Type]: "app.bsky.embed.record#viewBlocked"; author: AppBskyFeedDefs.BlockedAuthor; blocked: boolean; uri: At.Uri; } interface ViewDetached { - [Brand.Type]?: "app.bsky.embed.record#viewDetached"; + [Brand.Type]: "app.bsky.embed.record#viewDetached"; detached: boolean; uri: At.Uri; } interface ViewNotFound { - [Brand.Type]?: "app.bsky.embed.record#viewNotFound"; + [Brand.Type]: "app.bsky.embed.record#viewNotFound"; notFound: boolean; uri: At.Uri; } interface ViewRecord { - [Brand.Type]?: "app.bsky.embed.record#viewRecord"; + [Brand.Type]: "app.bsky.embed.record#viewRecord"; author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; @@ -587,7 +587,7 @@ export declare namespace AppBskyEmbedRecord { export declare namespace AppBskyEmbedRecordWithMedia { interface Main { - [Brand.Type]?: "app.bsky.embed.recordWithMedia"; + [Brand.Type]: "app.bsky.embed.recordWithMedia"; media: Brand.Union< | AppBskyEmbedExternal.Main | AppBskyEmbedImages.Main @@ -596,7 +596,7 @@ export declare namespace AppBskyEmbedRecordWithMedia { record: AppBskyEmbedRecord.Main; } interface View { - [Brand.Type]?: "app.bsky.embed.recordWithMedia#view"; + [Brand.Type]: "app.bsky.embed.recordWithMedia#view"; media: Brand.Union< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View @@ -608,7 +608,7 @@ export declare namespace AppBskyEmbedRecordWithMedia { export declare namespace AppBskyEmbedVideo { interface Main { - [Brand.Type]?: "app.bsky.embed.video"; + [Brand.Type]: "app.bsky.embed.video"; video: At.Blob; /** * Alt text description of the video, for accessibility. @@ -621,12 +621,12 @@ export declare namespace AppBskyEmbedVideo { captions?: Caption[]; } interface Caption { - [Brand.Type]?: "app.bsky.embed.video#caption"; + [Brand.Type]: "app.bsky.embed.video#caption"; file: At.Blob; lang: string; } interface View { - [Brand.Type]?: "app.bsky.embed.video#view"; + [Brand.Type]: "app.bsky.embed.video#view"; cid: At.CID; playlist: string; /** @@ -641,12 +641,12 @@ export declare namespace AppBskyEmbedVideo { export declare namespace AppBskyFeedDefs { interface BlockedAuthor { - [Brand.Type]?: "app.bsky.feed.defs#blockedAuthor"; + [Brand.Type]: "app.bsky.feed.defs#blockedAuthor"; did: At.DID; viewer?: AppBskyActorDefs.ViewerState; } interface BlockedPost { - [Brand.Type]?: "app.bsky.feed.defs#blockedPost"; + [Brand.Type]: "app.bsky.feed.defs#blockedPost"; author: BlockedAuthor; blocked: boolean; uri: At.Uri; @@ -656,7 +656,7 @@ export declare namespace AppBskyFeedDefs { type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; interface FeedViewPost { - [Brand.Type]?: "app.bsky.feed.defs#feedViewPost"; + [Brand.Type]: "app.bsky.feed.defs#feedViewPost"; post: PostView; /** * Context provided by feed generator that may be passed back alongside interactions. @@ -667,7 +667,7 @@ export declare namespace AppBskyFeedDefs { reply?: ReplyRef; } interface GeneratorView { - [Brand.Type]?: "app.bsky.feed.defs#generatorView"; + [Brand.Type]: "app.bsky.feed.defs#generatorView"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; did: At.DID; @@ -688,11 +688,11 @@ export declare namespace AppBskyFeedDefs { viewer?: GeneratorViewerState; } interface GeneratorViewerState { - [Brand.Type]?: "app.bsky.feed.defs#generatorViewerState"; + [Brand.Type]: "app.bsky.feed.defs#generatorViewerState"; like?: At.Uri; } interface Interaction { - [Brand.Type]?: "app.bsky.feed.defs#interaction"; + [Brand.Type]: "app.bsky.feed.defs#interaction"; event?: | "app.bsky.feed.defs#clickthroughAuthor" | "app.bsky.feed.defs#clickthroughEmbed" @@ -721,12 +721,12 @@ export declare namespace AppBskyFeedDefs { type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; type InteractionShare = "app.bsky.feed.defs#interactionShare"; interface NotFoundPost { - [Brand.Type]?: "app.bsky.feed.defs#notFoundPost"; + [Brand.Type]: "app.bsky.feed.defs#notFoundPost"; notFound: boolean; uri: At.Uri; } interface PostView { - [Brand.Type]?: "app.bsky.feed.defs#postView"; + [Brand.Type]: "app.bsky.feed.defs#postView"; author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; @@ -748,15 +748,15 @@ export declare namespace AppBskyFeedDefs { viewer?: ViewerState; } interface ReasonPin { - [Brand.Type]?: "app.bsky.feed.defs#reasonPin"; + [Brand.Type]: "app.bsky.feed.defs#reasonPin"; } interface ReasonRepost { - [Brand.Type]?: "app.bsky.feed.defs#reasonRepost"; + [Brand.Type]: "app.bsky.feed.defs#reasonRepost"; by: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; } interface ReplyRef { - [Brand.Type]?: "app.bsky.feed.defs#replyRef"; + [Brand.Type]: "app.bsky.feed.defs#replyRef"; parent: Brand.Union; root: Brand.Union; /** When parent is a reply to another post, this is the author of that post. */ @@ -765,7 +765,7 @@ export declare namespace AppBskyFeedDefs { type RequestLess = "app.bsky.feed.defs#requestLess"; type RequestMore = "app.bsky.feed.defs#requestMore"; interface SkeletonFeedPost { - [Brand.Type]?: "app.bsky.feed.defs#skeletonFeedPost"; + [Brand.Type]: "app.bsky.feed.defs#skeletonFeedPost"; post: At.Uri; /** * Context that will be passed through to client and may be passed to feed generator back alongside interactions. @@ -775,28 +775,28 @@ export declare namespace AppBskyFeedDefs { reason?: Brand.Union; } interface SkeletonReasonPin { - [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonPin"; + [Brand.Type]: "app.bsky.feed.defs#skeletonReasonPin"; } interface SkeletonReasonRepost { - [Brand.Type]?: "app.bsky.feed.defs#skeletonReasonRepost"; + [Brand.Type]: "app.bsky.feed.defs#skeletonReasonRepost"; repost: At.Uri; } interface ThreadgateView { - [Brand.Type]?: "app.bsky.feed.defs#threadgateView"; + [Brand.Type]: "app.bsky.feed.defs#threadgateView"; cid?: At.CID; lists?: AppBskyGraphDefs.ListViewBasic[]; record?: unknown; uri?: At.Uri; } interface ThreadViewPost { - [Brand.Type]?: "app.bsky.feed.defs#threadViewPost"; + [Brand.Type]: "app.bsky.feed.defs#threadViewPost"; post: PostView; parent?: Brand.Union; replies?: Brand.Union[]; } /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ interface ViewerState { - [Brand.Type]?: "app.bsky.feed.defs#viewerState"; + [Brand.Type]: "app.bsky.feed.defs#viewerState"; embeddingDisabled?: boolean; like?: At.Uri; pinned?: boolean; @@ -816,11 +816,11 @@ export declare namespace AppBskyFeedDescribeFeedGenerator { links?: Links; } interface Feed { - [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#feed"; + [Brand.Type]: "app.bsky.feed.describeFeedGenerator#feed"; uri: At.Uri; } interface Links { - [Brand.Type]?: "app.bsky.feed.describeFeedGenerator#links"; + [Brand.Type]: "app.bsky.feed.describeFeedGenerator#links"; privacyPolicy?: string; termsOfService?: string; } @@ -1023,7 +1023,7 @@ export declare namespace AppBskyFeedGetLikes { cursor?: string; } interface Like { - [Brand.Type]?: "app.bsky.feed.getLikes#like"; + [Brand.Type]: "app.bsky.feed.getLikes#like"; actor: AppBskyActorDefs.ProfileView; createdAt: string; indexedAt: string; @@ -1244,14 +1244,14 @@ export declare namespace AppBskyFeedPost { * \@deprecated */ interface Entity { - [Brand.Type]?: "app.bsky.feed.post#entity"; + [Brand.Type]: "app.bsky.feed.post#entity"; index: TextSlice; /** Expected values are 'mention' and 'link'. */ type: string; value: string; } interface ReplyRef { - [Brand.Type]?: "app.bsky.feed.post#replyRef"; + [Brand.Type]: "app.bsky.feed.post#replyRef"; parent: ComAtprotoRepoStrongRef.Main; root: ComAtprotoRepoStrongRef.Main; } @@ -1260,7 +1260,7 @@ export declare namespace AppBskyFeedPost { * \@deprecated */ interface TextSlice { - [Brand.Type]?: "app.bsky.feed.post#textSlice"; + [Brand.Type]: "app.bsky.feed.post#textSlice"; /** Minimum: 0 */ end: number; /** Minimum: 0 */ @@ -1285,7 +1285,7 @@ export declare namespace AppBskyFeedPostgate { } /** Disables embedding of this post. */ interface DisableRule { - [Brand.Type]?: "app.bsky.feed.postgate#disableRule"; + [Brand.Type]: "app.bsky.feed.postgate#disableRule"; } } @@ -1375,16 +1375,16 @@ export declare namespace AppBskyFeedThreadgate { } /** Allow replies from actors you follow. */ interface FollowingRule { - [Brand.Type]?: "app.bsky.feed.threadgate#followingRule"; + [Brand.Type]: "app.bsky.feed.threadgate#followingRule"; } /** Allow replies from actors on a list. */ interface ListRule { - [Brand.Type]?: "app.bsky.feed.threadgate#listRule"; + [Brand.Type]: "app.bsky.feed.threadgate#listRule"; list: At.Uri; } /** Allow replies from actors mentioned in your post. */ interface MentionRule { - [Brand.Type]?: "app.bsky.feed.threadgate#mentionRule"; + [Brand.Type]: "app.bsky.feed.threadgate#mentionRule"; } } @@ -1401,7 +1401,7 @@ export declare namespace AppBskyGraphBlock { export declare namespace AppBskyGraphDefs { type Curatelist = "app.bsky.graph.defs#curatelist"; interface ListItemView { - [Brand.Type]?: "app.bsky.graph.defs#listItemView"; + [Brand.Type]: "app.bsky.graph.defs#listItemView"; subject: AppBskyActorDefs.ProfileView; uri: At.Uri; } @@ -1411,7 +1411,7 @@ export declare namespace AppBskyGraphDefs { | "app.bsky.graph.defs#referencelist" | (string & {}); interface ListView { - [Brand.Type]?: "app.bsky.graph.defs#listView"; + [Brand.Type]: "app.bsky.graph.defs#listView"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1435,7 +1435,7 @@ export declare namespace AppBskyGraphDefs { viewer?: ListViewerState; } interface ListViewBasic { - [Brand.Type]?: "app.bsky.graph.defs#listViewBasic"; + [Brand.Type]: "app.bsky.graph.defs#listViewBasic"; cid: At.CID; /** * Minimum string length: 1 @@ -1452,21 +1452,21 @@ export declare namespace AppBskyGraphDefs { viewer?: ListViewerState; } interface ListViewerState { - [Brand.Type]?: "app.bsky.graph.defs#listViewerState"; + [Brand.Type]: "app.bsky.graph.defs#listViewerState"; blocked?: At.Uri; muted?: boolean; } type Modlist = "app.bsky.graph.defs#modlist"; /** indicates that a handle or DID could not be resolved */ interface NotFoundActor { - [Brand.Type]?: "app.bsky.graph.defs#notFoundActor"; + [Brand.Type]: "app.bsky.graph.defs#notFoundActor"; actor: string; notFound: boolean; } type Referencelist = "app.bsky.graph.defs#referencelist"; /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ interface Relationship { - [Brand.Type]?: "app.bsky.graph.defs#relationship"; + [Brand.Type]: "app.bsky.graph.defs#relationship"; did: At.DID; /** if the actor is followed by this DID, contains the AT-URI of the follow record */ followedBy?: At.Uri; @@ -1474,7 +1474,7 @@ export declare namespace AppBskyGraphDefs { following?: At.Uri; } interface StarterPackView { - [Brand.Type]?: "app.bsky.graph.defs#starterPackView"; + [Brand.Type]: "app.bsky.graph.defs#starterPackView"; cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1492,7 +1492,7 @@ export declare namespace AppBskyGraphDefs { listItemsSample?: ListItemView[]; } interface StarterPackViewBasic { - [Brand.Type]?: "app.bsky.graph.defs#starterPackViewBasic"; + [Brand.Type]: "app.bsky.graph.defs#starterPackViewBasic"; cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1889,7 +1889,7 @@ export declare namespace AppBskyGraphStarterpack { feeds?: FeedItem[]; } interface FeedItem { - [Brand.Type]?: "app.bsky.graph.starterpack#feedItem"; + [Brand.Type]: "app.bsky.graph.starterpack#feedItem"; uri: At.Uri; } } @@ -1923,14 +1923,14 @@ export declare namespace AppBskyGraphUnmuteThread { export declare namespace AppBskyLabelerDefs { interface LabelerPolicies { - [Brand.Type]?: "app.bsky.labeler.defs#labelerPolicies"; + [Brand.Type]: "app.bsky.labeler.defs#labelerPolicies"; /** The label values which this labeler publishes. May include global or custom labels. */ labelValues: ComAtprotoLabelDefs.LabelValue[]; /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; } interface LabelerView { - [Brand.Type]?: "app.bsky.labeler.defs#labelerView"; + [Brand.Type]: "app.bsky.labeler.defs#labelerView"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1941,7 +1941,7 @@ export declare namespace AppBskyLabelerDefs { viewer?: LabelerViewerState; } interface LabelerViewDetailed { - [Brand.Type]?: "app.bsky.labeler.defs#labelerViewDetailed"; + [Brand.Type]: "app.bsky.labeler.defs#labelerViewDetailed"; cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1953,7 +1953,7 @@ export declare namespace AppBskyLabelerDefs { viewer?: LabelerViewerState; } interface LabelerViewerState { - [Brand.Type]?: "app.bsky.labeler.defs#labelerViewerState"; + [Brand.Type]: "app.bsky.labeler.defs#labelerViewerState"; like?: At.Uri; } } @@ -2016,7 +2016,7 @@ export declare namespace AppBskyNotificationListNotifications { seenAt?: string; } interface Notification { - [Brand.Type]?: "app.bsky.notification.listNotifications#notification"; + [Brand.Type]: "app.bsky.notification.listNotifications#notification"; author: AppBskyActorDefs.ProfileView; cid: At.CID; indexedAt: string; @@ -2071,13 +2071,13 @@ export declare namespace AppBskyNotificationUpdateSeen { export declare namespace AppBskyRichtextFacet { /** Annotation of a sub-string within rich text. */ interface Main { - [Brand.Type]?: "app.bsky.richtext.facet"; + [Brand.Type]: "app.bsky.richtext.facet"; features: Brand.Union[]; index: ByteSlice; } /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ interface ByteSlice { - [Brand.Type]?: "app.bsky.richtext.facet#byteSlice"; + [Brand.Type]: "app.bsky.richtext.facet#byteSlice"; /** Minimum: 0 */ byteEnd: number; /** Minimum: 0 */ @@ -2085,17 +2085,17 @@ export declare namespace AppBskyRichtextFacet { } /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ interface Link { - [Brand.Type]?: "app.bsky.richtext.facet#link"; + [Brand.Type]: "app.bsky.richtext.facet#link"; uri: string; } /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ interface Mention { - [Brand.Type]?: "app.bsky.richtext.facet#mention"; + [Brand.Type]: "app.bsky.richtext.facet#mention"; did: At.DID; } /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ interface Tag { - [Brand.Type]?: "app.bsky.richtext.facet#tag"; + [Brand.Type]: "app.bsky.richtext.facet#tag"; /** * Maximum string length: 640 * Maximum grapheme length: 64 @@ -2106,15 +2106,15 @@ export declare namespace AppBskyRichtextFacet { export declare namespace AppBskyUnspeccedDefs { interface SkeletonSearchActor { - [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchActor"; + [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchActor"; did: At.DID; } interface SkeletonSearchPost { - [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchPost"; + [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchPost"; uri: At.Uri; } interface SkeletonSearchStarterPack { - [Brand.Type]?: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; + [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; uri: At.Uri; } } @@ -2178,7 +2178,7 @@ export declare namespace AppBskyUnspeccedGetTaggedSuggestions { suggestions: Suggestion[]; } interface Suggestion { - [Brand.Type]?: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; + [Brand.Type]: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; subject: string; subjectType: "actor" | "feed" | (string & {}); tag: string; @@ -2298,7 +2298,7 @@ export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { export declare namespace AppBskyVideoDefs { interface JobStatus { - [Brand.Type]?: "app.bsky.video.defs#jobStatus"; + [Brand.Type]: "app.bsky.video.defs#jobStatus"; did: At.DID; jobId: string; /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ @@ -2358,7 +2358,7 @@ export declare namespace ChatBskyActorDeclaration { export declare namespace ChatBskyActorDefs { interface ProfileViewBasic { - [Brand.Type]?: "chat.bsky.actor.defs#profileViewBasic"; + [Brand.Type]: "chat.bsky.actor.defs#profileViewBasic"; did: At.DID; handle: At.Handle; associated?: AppBskyActorDefs.ProfileAssociated; @@ -2389,7 +2389,7 @@ export declare namespace ChatBskyActorExportAccountData { export declare namespace ChatBskyConvoDefs { interface ConvoView { - [Brand.Type]?: "chat.bsky.convo.defs#convoView"; + [Brand.Type]: "chat.bsky.convo.defs#convoView"; id: string; members: ChatBskyActorDefs.ProfileViewBasic[]; muted: boolean; @@ -2399,36 +2399,36 @@ export declare namespace ChatBskyConvoDefs { opened?: boolean; } interface DeletedMessageView { - [Brand.Type]?: "chat.bsky.convo.defs#deletedMessageView"; + [Brand.Type]: "chat.bsky.convo.defs#deletedMessageView"; id: string; rev: string; sender: MessageViewSender; sentAt: string; } interface LogBeginConvo { - [Brand.Type]?: "chat.bsky.convo.defs#logBeginConvo"; + [Brand.Type]: "chat.bsky.convo.defs#logBeginConvo"; convoId: string; rev: string; } interface LogCreateMessage { - [Brand.Type]?: "chat.bsky.convo.defs#logCreateMessage"; + [Brand.Type]: "chat.bsky.convo.defs#logCreateMessage"; convoId: string; message: Brand.Union; rev: string; } interface LogDeleteMessage { - [Brand.Type]?: "chat.bsky.convo.defs#logDeleteMessage"; + [Brand.Type]: "chat.bsky.convo.defs#logDeleteMessage"; convoId: string; message: Brand.Union; rev: string; } interface LogLeaveConvo { - [Brand.Type]?: "chat.bsky.convo.defs#logLeaveConvo"; + [Brand.Type]: "chat.bsky.convo.defs#logLeaveConvo"; convoId: string; rev: string; } interface MessageInput { - [Brand.Type]?: "chat.bsky.convo.defs#messageInput"; + [Brand.Type]: "chat.bsky.convo.defs#messageInput"; /** * Maximum string length: 10000 * Maximum grapheme length: 1000 @@ -2439,13 +2439,13 @@ export declare namespace ChatBskyConvoDefs { facets?: AppBskyRichtextFacet.Main[]; } interface MessageRef { - [Brand.Type]?: "chat.bsky.convo.defs#messageRef"; + [Brand.Type]: "chat.bsky.convo.defs#messageRef"; convoId: string; did: At.DID; messageId: string; } interface MessageView { - [Brand.Type]?: "chat.bsky.convo.defs#messageView"; + [Brand.Type]: "chat.bsky.convo.defs#messageView"; id: string; rev: string; sender: MessageViewSender; @@ -2460,7 +2460,7 @@ export declare namespace ChatBskyConvoDefs { facets?: AppBskyRichtextFacet.Main[]; } interface MessageViewSender { - [Brand.Type]?: "chat.bsky.convo.defs#messageViewSender"; + [Brand.Type]: "chat.bsky.convo.defs#messageViewSender"; did: At.DID; } } @@ -2591,7 +2591,7 @@ export declare namespace ChatBskyConvoSendMessageBatch { items: ChatBskyConvoDefs.MessageView[]; } interface BatchItem { - [Brand.Type]?: "chat.bsky.convo.sendMessageBatch#batchItem"; + [Brand.Type]: "chat.bsky.convo.sendMessageBatch#batchItem"; convoId: string; message: ChatBskyConvoDefs.MessageInput; } @@ -2629,7 +2629,7 @@ export declare namespace ChatBskyModerationGetActorMetadata { month: Metadata; } interface Metadata { - [Brand.Type]?: "chat.bsky.moderation.getActorMetadata#metadata"; + [Brand.Type]: "chat.bsky.moderation.getActorMetadata#metadata"; convos: number; convosStarted: number; messagesReceived: number; @@ -2667,7 +2667,7 @@ export declare namespace ChatBskyModerationUpdateActorAccess { export declare namespace ComAtprotoAdminDefs { interface AccountView { - [Brand.Type]?: "com.atproto.admin.defs#accountView"; + [Brand.Type]: "com.atproto.admin.defs#accountView"; did: At.DID; handle: At.Handle; indexedAt: string; @@ -2682,22 +2682,22 @@ export declare namespace ComAtprotoAdminDefs { threatSignatures?: ThreatSignature[]; } interface RepoBlobRef { - [Brand.Type]?: "com.atproto.admin.defs#repoBlobRef"; + [Brand.Type]: "com.atproto.admin.defs#repoBlobRef"; cid: At.CID; did: At.DID; recordUri?: At.Uri; } interface RepoRef { - [Brand.Type]?: "com.atproto.admin.defs#repoRef"; + [Brand.Type]: "com.atproto.admin.defs#repoRef"; did: At.DID; } interface StatusAttr { - [Brand.Type]?: "com.atproto.admin.defs#statusAttr"; + [Brand.Type]: "com.atproto.admin.defs#statusAttr"; applied: boolean; ref?: string; } interface ThreatSignature { - [Brand.Type]?: "com.atproto.admin.defs#threatSignature"; + [Brand.Type]: "com.atproto.admin.defs#threatSignature"; property: string; value: string; } @@ -2962,7 +2962,7 @@ export declare namespace ComAtprotoIdentityUpdateHandle { export declare namespace ComAtprotoLabelDefs { /** Metadata tag on an atproto resource (eg, repo or record). */ interface Label { - [Brand.Type]?: "com.atproto.label.defs#label"; + [Brand.Type]: "com.atproto.label.defs#label"; /** Timestamp when this label was created. */ cts: string; /** DID of the actor who created this label. */ @@ -3000,7 +3000,7 @@ export declare namespace ComAtprotoLabelDefs { | (string & {}); /** Declares a label value and its expected interpretations and behaviors. */ interface LabelValueDefinition { - [Brand.Type]?: "com.atproto.label.defs#labelValueDefinition"; + [Brand.Type]: "com.atproto.label.defs#labelValueDefinition"; /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ blurs: "content" | "media" | "none" | (string & {}); /** @@ -3022,7 +3022,7 @@ export declare namespace ComAtprotoLabelDefs { } /** Strings which describe the label in the UI, localized into a specific language. */ interface LabelValueDefinitionStrings { - [Brand.Type]?: "com.atproto.label.defs#labelValueDefinitionStrings"; + [Brand.Type]: "com.atproto.label.defs#labelValueDefinitionStrings"; /** * A longer description of what the label means and why it might be applied. * Maximum string length: 100000 @@ -3040,7 +3040,7 @@ export declare namespace ComAtprotoLabelDefs { } /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ interface SelfLabel { - [Brand.Type]?: "com.atproto.label.defs#selfLabel"; + [Brand.Type]: "com.atproto.label.defs#selfLabel"; /** * The short string name of the value or type of this label. * Maximum string length: 128 @@ -3049,7 +3049,7 @@ export declare namespace ComAtprotoLabelDefs { } /** Metadata tags on an atproto record, published by the author within the record. */ interface SelfLabels { - [Brand.Type]?: "com.atproto.label.defs#selfLabels"; + [Brand.Type]: "com.atproto.label.defs#selfLabels"; /** Maximum array length: 10 */ values: SelfLabel[]; } @@ -3087,12 +3087,12 @@ export declare namespace ComAtprotoLabelSubscribeLabels { FutureCursor: {}; } interface Info { - [Brand.Type]?: "com.atproto.label.subscribeLabels#info"; + [Brand.Type]: "com.atproto.label.subscribeLabels#info"; name: "OutdatedCursor" | (string & {}); message?: string; } interface Labels { - [Brand.Type]?: "com.atproto.label.subscribeLabels#labels"; + [Brand.Type]: "com.atproto.label.subscribeLabels#labels"; labels: ComAtprotoLabelDefs.Label[]; seq: number; } @@ -3170,36 +3170,36 @@ export declare namespace ComAtprotoRepoApplyWrites { } /** Operation which creates a new record. */ interface Create { - [Brand.Type]?: "com.atproto.repo.applyWrites#create"; + [Brand.Type]: "com.atproto.repo.applyWrites#create"; collection: string; value: unknown; /** Maximum string length: 512 */ rkey?: string; } interface CreateResult { - [Brand.Type]?: "com.atproto.repo.applyWrites#createResult"; + [Brand.Type]: "com.atproto.repo.applyWrites#createResult"; cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); } /** Operation which deletes an existing record. */ interface Delete { - [Brand.Type]?: "com.atproto.repo.applyWrites#delete"; + [Brand.Type]: "com.atproto.repo.applyWrites#delete"; collection: string; rkey: string; } interface DeleteResult { - [Brand.Type]?: "com.atproto.repo.applyWrites#deleteResult"; + [Brand.Type]: "com.atproto.repo.applyWrites#deleteResult"; } /** Operation which updates an existing record. */ interface Update { - [Brand.Type]?: "com.atproto.repo.applyWrites#update"; + [Brand.Type]: "com.atproto.repo.applyWrites#update"; collection: string; rkey: string; value: unknown; } interface UpdateResult { - [Brand.Type]?: "com.atproto.repo.applyWrites#updateResult"; + [Brand.Type]: "com.atproto.repo.applyWrites#updateResult"; cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); @@ -3239,7 +3239,7 @@ export declare namespace ComAtprotoRepoCreateRecord { export declare namespace ComAtprotoRepoDefs { interface CommitMeta { - [Brand.Type]?: "com.atproto.repo.defs#commitMeta"; + [Brand.Type]: "com.atproto.repo.defs#commitMeta"; cid: At.CID; rev: string; } @@ -3334,7 +3334,7 @@ export declare namespace ComAtprotoRepoListMissingBlobs { cursor?: string; } interface RecordBlob { - [Brand.Type]?: "com.atproto.repo.listMissingBlobs#recordBlob"; + [Brand.Type]: "com.atproto.repo.listMissingBlobs#recordBlob"; cid: At.CID; recordUri: At.Uri; } @@ -3374,7 +3374,7 @@ export declare namespace ComAtprotoRepoListRecords { cursor?: string; } interface Record { - [Brand.Type]?: "com.atproto.repo.listRecords#record"; + [Brand.Type]: "com.atproto.repo.listRecords#record"; cid: At.CID; uri: At.Uri; value: unknown; @@ -3416,7 +3416,7 @@ export declare namespace ComAtprotoRepoPutRecord { export declare namespace ComAtprotoRepoStrongRef { interface Main { - [Brand.Type]?: "com.atproto.repo.strongRef"; + [Brand.Type]: "com.atproto.repo.strongRef"; cid: At.CID; uri: At.Uri; } @@ -3525,7 +3525,7 @@ export declare namespace ComAtprotoServerCreateAppPassword { AccountTakedown: {}; } interface AppPassword { - [Brand.Type]?: "com.atproto.server.createAppPassword#appPassword"; + [Brand.Type]: "com.atproto.server.createAppPassword#appPassword"; createdAt: string; name: string; password: string; @@ -3558,7 +3558,7 @@ export declare namespace ComAtprotoServerCreateInviteCodes { codes: AccountCodes[]; } interface AccountCodes { - [Brand.Type]?: "com.atproto.server.createInviteCodes#accountCodes"; + [Brand.Type]: "com.atproto.server.createInviteCodes#accountCodes"; account: string; codes: string[]; } @@ -3604,7 +3604,7 @@ export declare namespace ComAtprotoServerDeactivateAccount { export declare namespace ComAtprotoServerDefs { interface InviteCode { - [Brand.Type]?: "com.atproto.server.defs#inviteCode"; + [Brand.Type]: "com.atproto.server.defs#inviteCode"; available: number; code: string; createdAt: string; @@ -3614,7 +3614,7 @@ export declare namespace ComAtprotoServerDefs { uses: InviteCodeUse[]; } interface InviteCodeUse { - [Brand.Type]?: "com.atproto.server.defs#inviteCodeUse"; + [Brand.Type]: "com.atproto.server.defs#inviteCodeUse"; usedAt: string; usedBy: At.DID; } @@ -3660,11 +3660,11 @@ export declare namespace ComAtprotoServerDescribeServer { phoneVerificationRequired?: boolean; } interface Contact { - [Brand.Type]?: "com.atproto.server.describeServer#contact"; + [Brand.Type]: "com.atproto.server.describeServer#contact"; email?: string; } interface Links { - [Brand.Type]?: "com.atproto.server.describeServer#links"; + [Brand.Type]: "com.atproto.server.describeServer#links"; privacyPolicy?: string; termsOfService?: string; } @@ -3737,7 +3737,7 @@ export declare namespace ComAtprotoServerListAppPasswords { AccountTakedown: {}; } interface AppPassword { - [Brand.Type]?: "com.atproto.server.listAppPasswords#appPassword"; + [Brand.Type]: "com.atproto.server.listAppPasswords#appPassword"; createdAt: string; name: string; privileged?: boolean; @@ -4043,7 +4043,7 @@ export declare namespace ComAtprotoSyncListRepos { cursor?: string; } interface Repo { - [Brand.Type]?: "com.atproto.sync.listRepos#repo"; + [Brand.Type]: "com.atproto.sync.listRepos#repo"; did: At.DID; /** Current repo commit CID */ head: At.CID; @@ -4088,7 +4088,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ interface Account { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#account"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#account"; /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; did: At.DID; @@ -4104,7 +4104,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ interface Commit { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#commit"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#commit"; /** List of new blobs (by CID) referenced by records in this commit. */ blobs: At.CIDLink[]; /** CAR file containing relevant blocks, as a diff since the previous repo state. */ @@ -4144,7 +4144,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * \@deprecated */ interface Handle { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#handle"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#handle"; did: At.DID; handle: At.Handle; seq: number; @@ -4152,7 +4152,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ interface Identity { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#identity"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#identity"; did: At.DID; seq: number; time: string; @@ -4160,7 +4160,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { handle?: At.Handle; } interface Info { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#info"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#info"; name: "OutdatedCursor" | (string & {}); message?: string; } @@ -4169,7 +4169,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * \@deprecated */ interface Migrate { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#migrate"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#migrate"; did: At.DID; migrateTo: string | null; seq: number; @@ -4177,7 +4177,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { } /** A repo operation, ie a mutation of a single record. */ interface RepoOp { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#repoOp"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#repoOp"; action: "create" | "delete" | "update" | (string & {}); /** For creates and updates, the new record CID. For deletions, null. */ cid: At.CIDLink | null; @@ -4188,7 +4188,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * \@deprecated */ interface Tombstone { - [Brand.Type]?: "com.atproto.sync.subscribeRepos#tombstone"; + [Brand.Type]: "com.atproto.sync.subscribeRepos#tombstone"; did: At.DID; seq: number; time: string; @@ -4267,7 +4267,7 @@ export declare namespace ToolsOzoneCommunicationCreateTemplate { export declare namespace ToolsOzoneCommunicationDefs { interface TemplateView { - [Brand.Type]?: "tools.ozone.communication.defs#templateView"; + [Brand.Type]: "tools.ozone.communication.defs#templateView"; /** Subject of the message, used in emails. */ contentMarkdown: string; createdAt: string; @@ -4330,7 +4330,7 @@ export declare namespace ToolsOzoneCommunicationUpdateTemplate { export declare namespace ToolsOzoneModerationDefs { /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ interface AccountEvent { - [Brand.Type]?: "tools.ozone.moderation.defs#accountEvent"; + [Brand.Type]: "tools.ozone.moderation.defs#accountEvent"; /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; timestamp: string; @@ -4345,7 +4345,7 @@ export declare namespace ToolsOzoneModerationDefs { | (string & {}); } interface AccountHosting { - [Brand.Type]?: "tools.ozone.moderation.defs#accountHosting"; + [Brand.Type]: "tools.ozone.moderation.defs#accountHosting"; status: | "deactivated" | "deleted" @@ -4360,7 +4360,7 @@ export declare namespace ToolsOzoneModerationDefs { updatedAt?: string; } interface BlobView { - [Brand.Type]?: "tools.ozone.moderation.defs#blobView"; + [Brand.Type]: "tools.ozone.moderation.defs#blobView"; cid: At.CID; createdAt: string; mimeType: string; @@ -4370,7 +4370,7 @@ export declare namespace ToolsOzoneModerationDefs { } /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ interface IdentityEvent { - [Brand.Type]?: "tools.ozone.moderation.defs#identityEvent"; + [Brand.Type]: "tools.ozone.moderation.defs#identityEvent"; timestamp: string; comment?: string; handle?: At.Handle; @@ -4378,37 +4378,37 @@ export declare namespace ToolsOzoneModerationDefs { tombstone?: boolean; } interface ImageDetails { - [Brand.Type]?: "tools.ozone.moderation.defs#imageDetails"; + [Brand.Type]: "tools.ozone.moderation.defs#imageDetails"; height: number; width: number; } interface Moderation { - [Brand.Type]?: "tools.ozone.moderation.defs#moderation"; + [Brand.Type]: "tools.ozone.moderation.defs#moderation"; subjectStatus?: SubjectStatusView; } interface ModerationDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#moderationDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#moderationDetail"; subjectStatus?: SubjectStatusView; } interface ModEventAcknowledge { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventAcknowledge"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventAcknowledge"; comment?: string; } /** Add a comment to a subject */ interface ModEventComment { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventComment"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventComment"; comment: string; /** Make the comment persistent on the subject */ sticky?: boolean; } /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ interface ModEventDivert { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventDivert"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventDivert"; comment?: string; } /** Keep a log of outgoing email to a user */ interface ModEventEmail { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventEmail"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventEmail"; /** The subject line of the email sent to the user. */ subjectLine: string; /** Additional comment about the outgoing comm. */ @@ -4417,33 +4417,33 @@ export declare namespace ToolsOzoneModerationDefs { content?: string; } interface ModEventEscalate { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventEscalate"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventEscalate"; comment?: string; } /** Apply/Negate labels on a subject */ interface ModEventLabel { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventLabel"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventLabel"; createLabelVals: string[]; negateLabelVals: string[]; comment?: string; } /** Mute incoming reports on a subject */ interface ModEventMute { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventMute"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventMute"; /** Indicates how long the subject should remain muted. */ durationInHours: number; comment?: string; } /** Mute incoming reports from an account */ interface ModEventMuteReporter { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventMuteReporter"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventMuteReporter"; comment?: string; /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ durationInHours?: number; } /** Report a subject */ interface ModEventReport { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventReport"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventReport"; reportType: ComAtprotoModerationDefs.ReasonType; comment?: string; /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ @@ -4451,19 +4451,19 @@ export declare namespace ToolsOzoneModerationDefs { } /** Resolve appeal on a subject */ interface ModEventResolveAppeal { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventResolveAppeal"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventResolveAppeal"; /** Describe resolution. */ comment?: string; } /** Revert take down action on a subject */ interface ModEventReverseTakedown { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventReverseTakedown"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventReverseTakedown"; /** Describe reasoning behind the reversal. */ comment?: string; } /** Add/Remove a tag on a subject */ interface ModEventTag { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventTag"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventTag"; /** Tags to be added to the subject. If already exists, won't be duplicated. */ add: string[]; /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ @@ -4473,7 +4473,7 @@ export declare namespace ToolsOzoneModerationDefs { } /** Take down a subject permanently or temporarily */ interface ModEventTakedown { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventTakedown"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventTakedown"; /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ acknowledgeAccountSubjects?: boolean; comment?: string; @@ -4482,18 +4482,18 @@ export declare namespace ToolsOzoneModerationDefs { } /** Unmute action on a subject */ interface ModEventUnmute { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmute"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmute"; /** Describe reasoning behind the reversal. */ comment?: string; } /** Unmute incoming reports from an account */ interface ModEventUnmuteReporter { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventUnmuteReporter"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmuteReporter"; /** Describe reasoning behind the reversal. */ comment?: string; } interface ModEventView { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventView"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventView"; createdAt: string; createdBy: At.DID; event: Brand.Union< @@ -4527,7 +4527,7 @@ export declare namespace ToolsOzoneModerationDefs { subjectHandle?: string; } interface ModEventViewDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#modEventViewDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#modEventViewDetail"; createdAt: string; createdBy: At.DID; event: Brand.Union< @@ -4558,21 +4558,21 @@ export declare namespace ToolsOzoneModerationDefs { } /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ interface RecordEvent { - [Brand.Type]?: "tools.ozone.moderation.defs#recordEvent"; + [Brand.Type]: "tools.ozone.moderation.defs#recordEvent"; op: "create" | "delete" | "update" | (string & {}); timestamp: string; cid?: At.CID; comment?: string; } interface RecordHosting { - [Brand.Type]?: "tools.ozone.moderation.defs#recordHosting"; + [Brand.Type]: "tools.ozone.moderation.defs#recordHosting"; status: "deleted" | "unknown" | (string & {}); createdAt?: string; deletedAt?: string; updatedAt?: string; } interface RecordView { - [Brand.Type]?: "tools.ozone.moderation.defs#recordView"; + [Brand.Type]: "tools.ozone.moderation.defs#recordView"; blobCids: At.CID[]; cid: At.CID; indexedAt: string; @@ -4582,7 +4582,7 @@ export declare namespace ToolsOzoneModerationDefs { value: unknown; } interface RecordViewDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#recordViewDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#recordViewDetail"; blobs: BlobView[]; cid: At.CID; indexedAt: string; @@ -4593,11 +4593,11 @@ export declare namespace ToolsOzoneModerationDefs { labels?: ComAtprotoLabelDefs.Label[]; } interface RecordViewNotFound { - [Brand.Type]?: "tools.ozone.moderation.defs#recordViewNotFound"; + [Brand.Type]: "tools.ozone.moderation.defs#recordViewNotFound"; uri: At.Uri; } interface RepoView { - [Brand.Type]?: "tools.ozone.moderation.defs#repoView"; + [Brand.Type]: "tools.ozone.moderation.defs#repoView"; did: At.DID; handle: At.Handle; indexedAt: string; @@ -4611,7 +4611,7 @@ export declare namespace ToolsOzoneModerationDefs { threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } interface RepoViewDetail { - [Brand.Type]?: "tools.ozone.moderation.defs#repoViewDetail"; + [Brand.Type]: "tools.ozone.moderation.defs#repoViewDetail"; did: At.DID; handle: At.Handle; indexedAt: string; @@ -4628,7 +4628,7 @@ export declare namespace ToolsOzoneModerationDefs { threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } interface RepoViewNotFound { - [Brand.Type]?: "tools.ozone.moderation.defs#repoViewNotFound"; + [Brand.Type]: "tools.ozone.moderation.defs#repoViewNotFound"; did: At.DID; } type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; @@ -4642,7 +4642,7 @@ export declare namespace ToolsOzoneModerationDefs { | "#reviewOpen" | (string & {}); interface SubjectStatusView { - [Brand.Type]?: "tools.ozone.moderation.defs#subjectStatusView"; + [Brand.Type]: "tools.ozone.moderation.defs#subjectStatusView"; /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ createdAt: string; id: number; @@ -4671,7 +4671,7 @@ export declare namespace ToolsOzoneModerationDefs { takendown?: boolean; } interface VideoDetails { - [Brand.Type]?: "tools.ozone.moderation.defs#videoDetails"; + [Brand.Type]: "tools.ozone.moderation.defs#videoDetails"; height: number; length: number; width: number; @@ -4937,11 +4937,11 @@ export declare namespace ToolsOzoneServerGetConfig { viewer?: ViewerConfig; } interface ServiceConfig { - [Brand.Type]?: "tools.ozone.server.getConfig#serviceConfig"; + [Brand.Type]: "tools.ozone.server.getConfig#serviceConfig"; url?: string; } interface ViewerConfig { - [Brand.Type]?: "tools.ozone.server.getConfig#viewerConfig"; + [Brand.Type]: "tools.ozone.server.getConfig#viewerConfig"; role?: | "tools.ozone.team.defs#roleAdmin" | "tools.ozone.team.defs#roleModerator" @@ -4968,7 +4968,7 @@ export declare namespace ToolsOzoneSetAddValues { export declare namespace ToolsOzoneSetDefs { interface Set { - [Brand.Type]?: "tools.ozone.set.defs#set"; + [Brand.Type]: "tools.ozone.set.defs#set"; /** * Minimum string length: 3 * Maximum string length: 128 @@ -4981,7 +4981,7 @@ export declare namespace ToolsOzoneSetDefs { description?: string; } interface SetView { - [Brand.Type]?: "tools.ozone.set.defs#setView"; + [Brand.Type]: "tools.ozone.set.defs#setView"; createdAt: string; /** * Minimum string length: 3 @@ -5087,7 +5087,7 @@ export declare namespace ToolsOzoneSetUpsertSet { export declare namespace ToolsOzoneSettingDefs { interface Option { - [Brand.Type]?: "tools.ozone.setting.defs#option"; + [Brand.Type]: "tools.ozone.setting.defs#option"; createdBy: At.DID; did: At.DID; key: string; @@ -5172,7 +5172,7 @@ export declare namespace ToolsOzoneSettingUpsertOption { export declare namespace ToolsOzoneSignatureDefs { interface SigDetail { - [Brand.Type]?: "tools.ozone.signature.defs#sigDetail"; + [Brand.Type]: "tools.ozone.signature.defs#sigDetail"; property: string; value: string; } @@ -5207,7 +5207,7 @@ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { cursor?: string; } interface RelatedAccount { - [Brand.Type]?: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; + [Brand.Type]: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; account: ComAtprotoAdminDefs.AccountView; similarities?: ToolsOzoneSignatureDefs.SigDetail[]; } @@ -5251,7 +5251,7 @@ export declare namespace ToolsOzoneTeamAddMember { export declare namespace ToolsOzoneTeamDefs { interface Member { - [Brand.Type]?: "tools.ozone.team.defs#member"; + [Brand.Type]: "tools.ozone.team.defs#member"; did: At.DID; role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); createdAt?: string; From df782244e2c29797da60608d1d87e3b05bf9f08b Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 14:32:37 -0500 Subject: [PATCH 54/68] linting --- packages/lex-cli/src/generator/index.ts | 48 ++--- .../src/generator/resolvers/primitives.ts | 4 +- packages/lex-cli/src/generator/schema.ts | 177 ++++++++++++------ packages/lex-cli/src/index.ts | 8 +- packages/lexicons/scripts/generate-types.ts | 5 +- packages/lexicons/src/index.ts | 71 ++++--- 6 files changed, 197 insertions(+), 116 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index c03e558..5308742 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -4,7 +4,7 @@ import { getDescriptions, writeJsdoc } from '../utils/docs.js'; import { mainPrelude } from '../utils/prelude.js'; import { sortDefinition, sortName, sortPropertyKeys } from '../utils/sort.js'; import { resolveType } from './resolvers/type.js'; -import { documentSchema, type DocumentSchema } from './schema.js'; +import { type DocumentSchema, documentSchema } from './schema.js'; export interface GenerateDefinitionsOptions { files: string[]; @@ -35,7 +35,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { if (main) { code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } + } else { code += `\n\nimport "@tsky/lexicons";${banner ?? ''} @@ -53,7 +53,7 @@ declare module "@tsky/lexicons" {`; throw new Error('Invalid document schema'); } document = parsed; - } + } catch (err) { throw new Error(`failed to read ${filename}`, { cause: err }); } @@ -79,10 +79,10 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'token') { chunk += `type ${typeName} = '${nsid}';`; - } + } else if (type === 'object') { const required = def.required; const nullable = def.nullable; @@ -108,7 +108,7 @@ declare module "@tsky/lexicons" {`; } chunk += '}'; - } + } else if (type === 'array') { const { value, descriptions } = resolveType(nsid, def.items); const descs = []; @@ -123,7 +123,7 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descs.concat(descriptions)); chunk += `type ${typeName} = (${value})[];`; - } + } else if (type === 'record') { const obj = def.record; const required = obj.required; @@ -152,7 +152,7 @@ declare module "@tsky/lexicons" {`; chunk += '}'; records += `\n'${nsid}': ${tsNamespace}.Record;`; - } + } else if (type === 'query' || type === 'procedure') { let parameters = def.parameters; const input = type === 'procedure' ? def.input : undefined; @@ -164,14 +164,14 @@ declare module "@tsky/lexicons" {`; if (parameters) { if (Object.values(parameters.properties).length === 0) { parameters = undefined; - } + } else { const { value, descriptions } = resolveType(nsid, parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; } - } + } else { chunk += 'interface Params {}'; } @@ -184,15 +184,15 @@ declare module "@tsky/lexicons" {`; if (input.schema?.type === 'object') { chunk += `interface Input ${value}`; - } + } else { chunk += `type Input = ${value};`; } - } + } else { chunk += 'type Input = Blob | ArrayBufferView;'; } - } + } else { chunk += 'type Input = undefined;'; } @@ -205,15 +205,15 @@ declare module "@tsky/lexicons" {`; if (output.schema?.type === 'object') { chunk += `interface Output ${value}`; - } + } else { chunk += `type Output = ${value};`; } - } + } else { chunk += 'type Output = Uint8Array;'; } - } + } else { chunk += 'type Output = undefined;'; } @@ -245,30 +245,30 @@ declare module "@tsky/lexicons" {`; if (type === 'query') { queries += rc; - } + } else if (type === 'procedure') { procedures += rc; } } - } + } else if (type === 'blob') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'bytes') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'subscription') { if (def.parameters) { const { value, descriptions } = resolveType(nsid, def.parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; - } + } else { chunk += 'interface Params {}'; } @@ -300,7 +300,7 @@ declare module "@tsky/lexicons" {`; } rc += '};'; subscriptions += rc; - } + } else { // eslint-disable-next-line no-console console.log(`${nsid}: unhandled type ${type}`); @@ -311,7 +311,7 @@ declare module "@tsky/lexicons" {`; if (main) { code += `export declare namespace ${tsNamespace} {`; - } + } else { code += `namespace ${tsNamespace} {`; } @@ -325,7 +325,7 @@ declare module "@tsky/lexicons" {`; code += `export declare interface Queries {${queries}}\n\n`; code += `export declare interface Procedures {${procedures}}\n\n`; code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } + } else { code += `interface Records {${records}}\n\n`; code += `interface Queries {${queries}}\n\n`; diff --git a/packages/lex-cli/src/generator/resolvers/primitives.ts b/packages/lex-cli/src/generator/resolvers/primitives.ts index 20430f7..b8fe08c 100644 --- a/packages/lex-cli/src/generator/resolvers/primitives.ts +++ b/packages/lex-cli/src/generator/resolvers/primitives.ts @@ -1,6 +1,4 @@ -export function resolvePrimitiveType( - type: string, -): string { +export function resolvePrimitiveType(type: string): string { switch (type) { case 'unknown': return 'unknown'; diff --git a/packages/lex-cli/src/generator/schema.ts b/packages/lex-cli/src/generator/schema.ts index 72da151..1c565e2 100644 --- a/packages/lex-cli/src/generator/schema.ts +++ b/packages/lex-cli/src/generator/schema.ts @@ -1,11 +1,8 @@ import * as t from 'typanion'; -const isPositiveInteger = t.cascade( - t.isNumber(), - (value): value is number => { - return Number.isInteger(value) && value >= 0; - }, -); +const isPositiveInteger = t.cascade(t.isNumber(), (value): value is number => { + return Number.isInteger(value) && value >= 0; +}); export const booleanSchema = t.isObject({ type: t.isLiteral('boolean'), @@ -42,19 +39,22 @@ const stringFormatSchema = t.isOneOf([ t.isLiteral('uri'), ]); -export const stringSchema: t.StrictValidator = t.cascade( +export const stringSchema: t.StrictValidator< + unknown, + { + type: 'string'; + description?: string; + format?: string; + default?: string; + const?: string; + enum?: string[]; + knownValues?: string[]; + maxLength?: number; + minLength?: number; + maxGraphemes?: number; + minGraphemes?: number; + } +> = t.cascade( t.isObject({ type: t.isLiteral('string'), description: t.isOptional(t.isString()), @@ -68,13 +68,42 @@ export const stringSchema: t.StrictValidator { + ( + value, + ): value is { + type: 'string'; + description?: string; + format?: + | 'at-identifier' + | 'at-uri' + | 'cid' + | 'datetime' + | 'did' + | 'handle' + | 'language' + | 'nsid' + | 'record-key' + | 'tid' + | 'uri'; + default?: string; + const?: string; + enum?: string[]; + knownValues?: string[]; + maxLength?: number; + minLength?: number; + maxGraphemes?: number; + minGraphemes?: number; + } => { if (value.format !== undefined && value.format !== 'uri') { - if (value.maxLength !== undefined + if ( + value.maxLength !== undefined || value.minLength !== undefined || value.maxGraphemes !== undefined - || value.minGraphemes !== undefined) { - throw new Error(`${value.format} format can't be used with length or grapheme constraints`); + || value.minGraphemes !== undefined + ) { + throw new Error( + `${value.format} format can't be used with length or grapheme constraints`, + ); } } return true; @@ -115,10 +144,7 @@ export const cidLinkSchema = t.isObject({ export type CidLinkSchema = t.InferType; -export const ipldTypeSchema = t.isOneOf([ - bytesSchema, - cidLinkSchema, -]); +export const ipldTypeSchema = t.isOneOf([bytesSchema, cidLinkSchema]); export type IpldTypeSchema = t.InferType; @@ -137,7 +163,14 @@ export const refUnionSchema = t.cascade( refs: t.isArray(t.isString()), closed: t.isOptional(t.isBoolean()), }), - (value): value is { type: 'union'; description?: string; refs: string[]; closed?: boolean } => { + ( + value, + ): value is { + type: 'union'; + description?: string; + refs: string[]; + closed?: boolean; + } => { if (value.closed && value.refs.length === 0) { throw new Error(`A closed union can't have empty refs list`); } @@ -147,10 +180,7 @@ export const refUnionSchema = t.cascade( export type RefUnionSchema = t.InferType; -export const refVariantSchema = t.isOneOf([ - refSchema, - refUnionSchema, -]); +export const refVariantSchema = t.isOneOf([refSchema, refUnionSchema]); export type RefVariantSchema = t.InferType; @@ -166,19 +196,27 @@ export type BlobSchema = t.InferType; export const arraySchema = t.isObject({ type: t.isLiteral('array'), description: t.isOptional(t.isString()), - items: t.isOneOf([primitiveSchema, ipldTypeSchema, blobSchema, refVariantSchema]), + items: t.isOneOf([ + primitiveSchema, + ipldTypeSchema, + blobSchema, + refVariantSchema, + ]), maxLength: t.isOptional(isPositiveInteger), minLength: t.isOptional(isPositiveInteger), }); export type ArraySchema = t.InferType; -export const primitiveArraySchema = t.cascade(arraySchema, (value): value is ArraySchema => { - if (!t.isOneOf([primitiveSchema])(value.items)) { - throw new Error('Array items must be primitive types'); - } - return true; -}); +export const primitiveArraySchema = t.cascade( + arraySchema, + (value): value is ArraySchema => { + if (!t.isOneOf([primitiveSchema])(value.items)) { + throw new Error('Array items must be primitive types'); + } + return true; + }, +); export type PrimitiveArraySchema = t.InferType; @@ -197,16 +235,19 @@ function refineRequiredProperties< properties: Record; } - return t.cascade(schema, (value: RequiredPropertiesSchema): value is RequiredPropertiesSchema => { - if (value.required) { - for (const field of value.required) { - if (value.properties[field] === undefined) { - throw new Error(`Required field "${field}" not defined`); + return t.cascade( + schema, + (value: RequiredPropertiesSchema): value is RequiredPropertiesSchema => { + if (value.required) { + for (const field of value.required) { + if (value.properties[field] === undefined) { + throw new Error(`Required field "${field}" not defined`); + } } } - } - return true; - }); + return true; + }, + ); } export const objectSchema = refineRequiredProperties( @@ -215,13 +256,15 @@ export const objectSchema = refineRequiredProperties( description: t.isOptional(t.isString()), required: t.isOptional(t.isArray(t.isString())), nullable: t.isOptional(t.isArray(t.isString())), - properties: t.isRecord(t.isOneOf([ - refVariantSchema, - ipldTypeSchema, - arraySchema, - blobSchema, - primitiveSchema, - ])), + properties: t.isRecord( + t.isOneOf([ + refVariantSchema, + ipldTypeSchema, + arraySchema, + blobSchema, + primitiveSchema, + ]), + ), }), ); @@ -251,7 +294,9 @@ export const xrpcSubscriptionMessageSchema = t.isObject({ schema: t.isOptional(t.isOneOf([refVariantSchema, objectSchema])), }); -export type XrpcSubscriptionMessageSchema = t.InferType; +export type XrpcSubscriptionMessageSchema = t.InferType< + typeof xrpcSubscriptionMessageSchema +>; export const xrpcErrorSchema = t.isObject({ name: t.isString(), @@ -319,11 +364,9 @@ export const userTypeSchema = t.isOneOf([ export type UserTypeSchema = t.InferType; -const NSID_RE = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; -const nsidType = t.cascade( - t.isString(), - value => NSID_RE.test(value), -); +const NSID_RE + = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; +const nsidType = t.cascade(t.isString(), value => NSID_RE.test(value)); export const documentSchema = t.cascade( t.isObject({ @@ -333,7 +376,15 @@ export const documentSchema = t.cascade( description: t.isOptional(t.isString()), defs: t.isRecord(userTypeSchema), }), - (value): value is { lexicon: 1; id: string; revision?: number; description?: string; defs: Record } => { + ( + value, + ): value is { + lexicon: 1; + id: string; + revision?: number; + description?: string; + defs: Record; + } => { for (const id in value.defs) { const def = value.defs[id]; const type = def.type; @@ -345,7 +396,9 @@ export const documentSchema = t.cascade( || type === 'procedure' || type === 'subscription') ) { - throw new Error(`${type} must be the \`main\` definition (in defs.${id})`); + throw new Error( + `${type} must be the \`main\` definition (in defs.${id})`, + ); } } return true; diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 69020a3..28e3e81 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -1,6 +1,6 @@ import { writeFile } from 'node:fs/promises'; import process from 'node:process'; -import { Builtins, Command, Option, Cli } from 'clipanion'; +import { Builtins, Cli, Command, Option } from 'clipanion'; import pc from 'picocolors'; import prettier from 'prettier'; import * as t from 'typanion'; @@ -53,7 +53,7 @@ cli.register( banner: this.banner, description: this.desc, }); - } + } catch (err) { if (err instanceof Error) { console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); @@ -61,7 +61,7 @@ cli.register( if (err.cause instanceof Error) { console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); } - } + } else { console.error(pc.bold(pc.red('unknown error occurred:'))); console.error(err); @@ -81,7 +81,7 @@ cli.register( if (this.output) { await writeFile(this.output, formatted); - } + } else { // eslint-disable-next-line no-console console.log(formatted); diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index 78f180f..09c8218 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -48,7 +48,7 @@ async function downloadLexicons() { await tar.x({ file: tarFile, cwd: LEXICONS_DIR, - filter: (path) => path.includes('/lexicons/'), + filter: path => path.includes('/lexicons/'), strip: 2, }); @@ -108,7 +108,8 @@ async function main() { }); console.log('Done! Types generated at', TYPES_OUTPUT_PATH); - } catch (error) { + } + catch (error) { console.error('Error:', error); process.exit(1); } diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index ccfe921..a8eb681 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -27,13 +27,17 @@ export type BskyQuery = { export type QueryParams = Queries[T] extends { params: infer P; -} ? P : never; +} + ? P + : never; export type QueryOutput = Queries[T]['output']; export type QueryErrors = Queries[T] extends { errors: infer E; -} ? E : never; +} + ? E + : never; // --- Procedure Types --- export type ProcedureDefs = LexiconUnion; @@ -41,27 +45,46 @@ export type BskyProcedure = { [K in keyof Procedures]: K extends BskyNSID ? Procedures[K] : never; }[keyof Procedures]; -export type ProcedureParams = Procedures[T] extends { - params: infer P; -} ? P : never; +export type ProcedureParams = + Procedures[T] extends { + params: infer P; + } + ? P + : never; export type ProcedureInput = Procedures[T] extends { input: infer I; -} ? I : never; - -export type ProcedureOutput = Procedures[T] extends { - output: infer O; -} ? O : never; - -export type ProcedureErrors = Procedures[T] extends { - errors: infer E; -} ? E : never; +} + ? I + : never; + +export type ProcedureOutput = + Procedures[T] extends { + output: infer O; + } + ? O + : never; + +export type ProcedureErrors = + Procedures[T] extends { + errors: infer E; + } + ? E + : never; // --- Common Bluesky Types --- -export type BskyPost = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.post` }; -export type BskyProfile = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}actor.profile` }; -export type BskyLike = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}feed.like` }; -export type BskyFollow = BskyRecord & { $type: `${typeof APP_BSKY_PREFIX}graph.follow` }; +export type BskyPost = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}feed.post`; +}; +export type BskyProfile = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}actor.profile`; +}; +export type BskyLike = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}feed.like`; +}; +export type BskyFollow = BskyRecord & { + $type: `${typeof APP_BSKY_PREFIX}graph.follow`; +}; // --- Type Guards --- export function isRecord(value: unknown): value is RecordDefs { @@ -82,7 +105,9 @@ export function isAtProtoRecord(value: unknown): value is AtProtoRecord { } export function isBskyPost(value: unknown): value is BskyPost { - return isBskyRecord(value) && value.$type.startsWith(`${APP_BSKY_PREFIX}feed.post`); + return ( + isBskyRecord(value) && value.$type.startsWith(`${APP_BSKY_PREFIX}feed.post`) + ); } // --- Error Types and Guards --- @@ -104,5 +129,9 @@ export function isBskyError(value: unknown): value is BskyError { } // --- Helper Types --- -export type BskyQueryParams = T extends keyof Queries ? QueryParams : never; -export type BskyProcedureInput = T extends keyof Procedures ? ProcedureInput : never; +export type BskyQueryParams = T extends keyof Queries + ? QueryParams + : never; +export type BskyProcedureInput = T extends keyof Procedures + ? ProcedureInput + : never; From 2363befae4eb66701caa9e481d4b9953e3e50c06 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 15:26:59 -0500 Subject: [PATCH 55/68] add package entry point for direct imports --- packages/lexicons/index.ts | 1 + packages/lexicons/package.json | 15 ++++++++++++++- packages/lexicons/tsconfig.json | 9 ++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 packages/lexicons/index.ts diff --git a/packages/lexicons/index.ts b/packages/lexicons/index.ts new file mode 100644 index 0000000..cba1843 --- /dev/null +++ b/packages/lexicons/index.ts @@ -0,0 +1 @@ +export * from './src/index'; diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 4a08792..39487b4 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -2,11 +2,24 @@ "name": "@tsky/lexicons", "type": "module", "version": "0.0.1", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], "publishConfig": { "access": "public" }, "scripts": { - "build": "tsx ./scripts/generate-types.ts" + "build": "tsx ./scripts/generate-types.ts && tsc", + "clean": "rm -rf dist && rm -rf lexicons", + "prepublish": "npm run build" }, "devDependencies": { "@tsky/lex-cli": "workspace:*", diff --git a/packages/lexicons/tsconfig.json b/packages/lexicons/tsconfig.json index 53d5d52..4a8cb3c 100644 --- a/packages/lexicons/tsconfig.json +++ b/packages/lexicons/tsconfig.json @@ -2,13 +2,16 @@ "compilerOptions": { "target": "ESNext", "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "strict": true, + "declaration": true, + "declarationMap": true, + "outDir": "./dist", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "skipLibCheck": true }, - "include": ["scripts/**/*", "src/**/*"], - "exclude": ["node_modules"] + "include": ["index.ts", "src/**/*"], + "exclude": ["node_modules", "dist", "scripts"] } From 636d6473f629f6ff3b70619c19be77593f3ab9fd Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 15:39:57 -0500 Subject: [PATCH 56/68] add index files for better module organization --- packages/lex-cli/package.json | 8 ++- packages/lex-cli/src/generator/index.ts | 55 +++++++++---------- .../src/generator/resolvers/complex.ts | 8 +-- .../lex-cli/src/generator/resolvers/index.ts | 5 ++ .../src/generator/resolvers/numeric.ts | 2 +- .../lex-cli/src/generator/resolvers/string.ts | 5 +- .../lex-cli/src/generator/resolvers/type.ts | 12 ++-- packages/lex-cli/src/index.ts | 8 +-- packages/lex-cli/src/utils/index.ts | 5 ++ packages/lex-cli/tsconfig.json | 3 +- 10 files changed, 61 insertions(+), 50 deletions(-) create mode 100644 packages/lex-cli/src/generator/resolvers/index.ts create mode 100644 packages/lex-cli/src/utils/index.ts diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index 63e7686..703037f 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -3,7 +3,13 @@ "type": "module", "version": "0.0.1", "license": "MIT", - "bin": "dist/index.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "bin": "./dist/index.js", "scripts": { "build": "tsc", "prepublish": "pnpm run build" diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 5308742..95cc15b 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -1,10 +1,7 @@ import { readFile } from 'node:fs/promises'; -import { toNamespace } from '../utils/cache.js'; -import { getDescriptions, writeJsdoc } from '../utils/docs.js'; -import { mainPrelude } from '../utils/prelude.js'; -import { sortDefinition, sortName, sortPropertyKeys } from '../utils/sort.js'; -import { resolveType } from './resolvers/type.js'; -import { type DocumentSchema, documentSchema } from './schema.js'; +import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils'; +import { resolveType } from './resolvers'; +import { type DocumentSchema, documentSchema } from './schema'; export interface GenerateDefinitionsOptions { files: string[]; @@ -35,7 +32,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { if (main) { code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } + } else { code += `\n\nimport "@tsky/lexicons";${banner ?? ''} @@ -53,7 +50,7 @@ declare module "@tsky/lexicons" {`; throw new Error('Invalid document schema'); } document = parsed; - } + } catch (err) { throw new Error(`failed to read ${filename}`, { cause: err }); } @@ -79,10 +76,10 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'token') { chunk += `type ${typeName} = '${nsid}';`; - } + } else if (type === 'object') { const required = def.required; const nullable = def.nullable; @@ -108,7 +105,7 @@ declare module "@tsky/lexicons" {`; } chunk += '}'; - } + } else if (type === 'array') { const { value, descriptions } = resolveType(nsid, def.items); const descs = []; @@ -123,7 +120,7 @@ declare module "@tsky/lexicons" {`; chunk += writeJsdoc(descs.concat(descriptions)); chunk += `type ${typeName} = (${value})[];`; - } + } else if (type === 'record') { const obj = def.record; const required = obj.required; @@ -152,7 +149,7 @@ declare module "@tsky/lexicons" {`; chunk += '}'; records += `\n'${nsid}': ${tsNamespace}.Record;`; - } + } else if (type === 'query' || type === 'procedure') { let parameters = def.parameters; const input = type === 'procedure' ? def.input : undefined; @@ -164,14 +161,14 @@ declare module "@tsky/lexicons" {`; if (parameters) { if (Object.values(parameters.properties).length === 0) { parameters = undefined; - } + } else { const { value, descriptions } = resolveType(nsid, parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; } - } + } else { chunk += 'interface Params {}'; } @@ -184,15 +181,15 @@ declare module "@tsky/lexicons" {`; if (input.schema?.type === 'object') { chunk += `interface Input ${value}`; - } + } else { chunk += `type Input = ${value};`; } - } + } else { chunk += 'type Input = Blob | ArrayBufferView;'; } - } + } else { chunk += 'type Input = undefined;'; } @@ -205,15 +202,15 @@ declare module "@tsky/lexicons" {`; if (output.schema?.type === 'object') { chunk += `interface Output ${value}`; - } + } else { chunk += `type Output = ${value};`; } - } + } else { chunk += 'type Output = Uint8Array;'; } - } + } else { chunk += 'type Output = undefined;'; } @@ -245,30 +242,30 @@ declare module "@tsky/lexicons" {`; if (type === 'query') { queries += rc; - } + } else if (type === 'procedure') { procedures += rc; } } - } + } else if (type === 'blob') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'bytes') { const { value, descriptions } = resolveType(nsid, def); chunk += writeJsdoc(descriptions); chunk += `type ${typeName} = ${value};`; - } + } else if (type === 'subscription') { if (def.parameters) { const { value, descriptions } = resolveType(nsid, def.parameters); chunk += writeJsdoc(descriptions); chunk += `interface Params ${value}`; - } + } else { chunk += 'interface Params {}'; } @@ -300,7 +297,7 @@ declare module "@tsky/lexicons" {`; } rc += '};'; subscriptions += rc; - } + } else { // eslint-disable-next-line no-console console.log(`${nsid}: unhandled type ${type}`); @@ -311,7 +308,7 @@ declare module "@tsky/lexicons" {`; if (main) { code += `export declare namespace ${tsNamespace} {`; - } + } else { code += `namespace ${tsNamespace} {`; } @@ -325,7 +322,7 @@ declare module "@tsky/lexicons" {`; code += `export declare interface Queries {${queries}}\n\n`; code += `export declare interface Procedures {${procedures}}\n\n`; code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } + } else { code += `interface Records {${records}}\n\n`; code += `interface Queries {${queries}}\n\n`; diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index de465f5..2658312 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -3,11 +3,9 @@ import type { RefSchema, RefUnionSchema, XrpcParametersSchema, -} from '../schema.js'; -import { toNamespace, toUpper } from '../../utils/cache.js'; -import { writeJsdoc } from '../../utils/docs.js'; -import { sortName, sortPropertyKeys } from '../../utils/sort.js'; -import { resolveType } from './type.js'; +} from '../schema'; +import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils'; +import { resolveType } from './type'; export function resolveRefType(def: RefSchema): string { const [ns, ref] = def.ref.split('#'); diff --git a/packages/lex-cli/src/generator/resolvers/index.ts b/packages/lex-cli/src/generator/resolvers/index.ts new file mode 100644 index 0000000..a73f0a3 --- /dev/null +++ b/packages/lex-cli/src/generator/resolvers/index.ts @@ -0,0 +1,5 @@ +export { resolveObjectType, resolveRefType, resolveUnionType } from './complex'; +export { resolveIntegerType } from './numeric'; +export { resolvePrimitiveType } from './primitives'; +export { resolveStringFormat, resolveStringType } from './string'; +export { resolveType } from './type'; diff --git a/packages/lex-cli/src/generator/resolvers/numeric.ts b/packages/lex-cli/src/generator/resolvers/numeric.ts index 643f76a..35915ca 100644 --- a/packages/lex-cli/src/generator/resolvers/numeric.ts +++ b/packages/lex-cli/src/generator/resolvers/numeric.ts @@ -1,4 +1,4 @@ -import type { IntegerSchema } from '../schema.js'; +import type { IntegerSchema } from '../schema'; export function resolveIntegerType( def: IntegerSchema, diff --git a/packages/lex-cli/src/generator/resolvers/string.ts b/packages/lex-cli/src/generator/resolvers/string.ts index 12af283..b8ebb4d 100644 --- a/packages/lex-cli/src/generator/resolvers/string.ts +++ b/packages/lex-cli/src/generator/resolvers/string.ts @@ -1,6 +1,5 @@ -import type { StringSchema } from '../schema.js'; -import { IGNORED_FORMATS, TYPE_FORMATS } from '../../utils/formats.js'; -import { sortName } from '../../utils/sort.js'; +import type { StringSchema } from '../schema'; +import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils'; export function resolveStringFormat(format: string, nsid: string): string { if (format === 'did') return TYPE_FORMATS.DID; diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts index f3dd9e9..a9a1a1e 100644 --- a/packages/lex-cli/src/generator/resolvers/type.ts +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -2,16 +2,16 @@ import type { RefVariantSchema, UserTypeSchema, XrpcParametersSchema, -} from '../schema.js'; -import { getDescriptions } from '../../utils/docs.js'; +} from '../schema'; +import { getDescriptions } from '../../utils'; import { resolveObjectType, resolveRefType, resolveUnionType, -} from './complex.js'; -import { resolveIntegerType } from './numeric.js'; -import { resolvePrimitiveType } from './primitives.js'; -import { resolveStringType } from './string.js'; +} from './complex'; +import { resolveIntegerType } from './numeric'; +import { resolvePrimitiveType } from './primitives'; +import { resolveStringType } from './string'; export function resolveType( nsid: string, diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 28e3e81..fa8809a 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -4,7 +4,7 @@ import { Builtins, Cli, Command, Option } from 'clipanion'; import pc from 'picocolors'; import prettier from 'prettier'; import * as t from 'typanion'; -import { generateDefinitions } from './generator/index.js'; +import { generateDefinitions } from './generator'; const cli = new Cli({ binaryName: 'lex-cli', @@ -53,7 +53,7 @@ cli.register( banner: this.banner, description: this.desc, }); - } + } catch (err) { if (err instanceof Error) { console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); @@ -61,7 +61,7 @@ cli.register( if (err.cause instanceof Error) { console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); } - } + } else { console.error(pc.bold(pc.red('unknown error occurred:'))); console.error(err); @@ -81,7 +81,7 @@ cli.register( if (this.output) { await writeFile(this.output, formatted); - } + } else { // eslint-disable-next-line no-console console.log(formatted); diff --git a/packages/lex-cli/src/utils/index.ts b/packages/lex-cli/src/utils/index.ts new file mode 100644 index 0000000..b728a13 --- /dev/null +++ b/packages/lex-cli/src/utils/index.ts @@ -0,0 +1,5 @@ +export { toNamespace, toUpper } from './cache'; +export { getDescriptions, writeJsdoc } from './docs'; +export { IGNORED_FORMATS, TYPE_FORMATS } from './formats'; +export { mainPrelude } from './prelude'; +export { sortDefinition, sortName, sortPropertyKeys } from './sort'; diff --git a/packages/lex-cli/tsconfig.json b/packages/lex-cli/tsconfig.json index 17f73ee..9449cba 100644 --- a/packages/lex-cli/tsconfig.json +++ b/packages/lex-cli/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "target": "ESNext", "rootDir": "src", - "module": "NodeNext", + "module": "ESNext", + "moduleResolution": "bundler", "strict": true, "declaration": true, "outDir": "dist", From 28d60297e04bb2c07f7446e1ef2843609e0d5b09 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 15:57:36 -0500 Subject: [PATCH 57/68] extensions required --- packages/lex-cli/src/generator/index.ts | 670 +++++++++--------- .../src/generator/resolvers/complex.ts | 6 +- .../lex-cli/src/generator/resolvers/index.ts | 10 +- .../src/generator/resolvers/numeric.ts | 2 +- .../lex-cli/src/generator/resolvers/string.ts | 4 +- .../lex-cli/src/generator/resolvers/type.ts | 12 +- packages/lex-cli/src/index.ts | 2 +- packages/lex-cli/src/utils/index.ts | 10 +- 8 files changed, 358 insertions(+), 358 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 95cc15b..17adb8d 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -1,335 +1,335 @@ -import { readFile } from 'node:fs/promises'; -import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils'; -import { resolveType } from './resolvers'; -import { type DocumentSchema, documentSchema } from './schema'; - -export interface GenerateDefinitionsOptions { - files: string[]; - main: boolean; - banner?: string; - description?: string; - debug?: boolean; - onProgress?: (filename: string, index: number, total: number) => void; -} - -export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, main, banner, description } = opts; - - let queries = ''; - let procedures = ''; - let records = ''; - let subscriptions = ''; - - let code = `/* eslint-disable */ -// This file is automatically generated, do not edit!`; - - if (description) { - code += `\n\n/** - * @module - * ${description} - */`; - } - - if (main) { - code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } - else { - code += `\n\nimport "@tsky/lexicons";${banner ?? ''} - -declare module "@tsky/lexicons" {`; - } - - for await (const filename of files.sort(sortName)) { - let document: DocumentSchema; - - try { - const jsonString = await readFile(filename, 'utf8'); - const parsed = JSON.parse(jsonString); - - if (!documentSchema(parsed)) { - throw new Error('Invalid document schema'); - } - document = parsed; - } - catch (err) { - throw new Error(`failed to read ${filename}`, { cause: err }); - } - - const ns = document.id; - const tsNamespace = toNamespace(ns); - - let descs: string[] = []; - let chunk = ''; - - const definitions = document.defs; - const keys = Object.keys(definitions).sort(sortDefinition); - - for (const key of keys) { - const def = definitions[key]; - const type = def.type; - - const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; - const typeName = key[0].toUpperCase() + key.slice(1); - - if (type === 'string') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'token') { - chunk += `type ${typeName} = '${nsid}';`; - } - else if (type === 'object') { - const required = def.required; - const nullable = def.nullable; - const properties = def.properties; - - const propKeys = sortPropertyKeys(Object.keys(properties), required); - const descs = getDescriptions(def); - - chunk += writeJsdoc(descs); - chunk += `interface ${typeName} {`; - chunk += `[Brand.Type]: '${nsid}';`; - - for (const prop of propKeys) { - const isOptional = !required || !required.includes(prop); - const isNullable = nullable?.includes(prop); - const { value, descriptions } = resolveType( - `${nsid}/${prop}`, - properties[prop], - ); - - chunk += writeJsdoc(descriptions); - chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; - } - - chunk += '}'; - } - else if (type === 'array') { - const { value, descriptions } = resolveType(nsid, def.items); - const descs = []; - - if (def.maxLength !== undefined) { - descs.push(`Maximum array length: ${def.maxLength}`); - } - - if (def.minLength !== undefined) { - descs.push(`Minimum array length: ${def.minLength}`); - } - - chunk += writeJsdoc(descs.concat(descriptions)); - chunk += `type ${typeName} = (${value})[];`; - } - else if (type === 'record') { - const obj = def.record; - const required = obj.required; - const nullable = obj.nullable; - const properties = obj.properties; - - const propKeys = sortPropertyKeys(Object.keys(properties), required); - const descs = getDescriptions(def); - - chunk += writeJsdoc(descs); - chunk += 'interface Record {'; - chunk += `$type: '${nsid}';`; - - for (const prop of propKeys) { - const isOptional = !required || !required.includes(prop); - const isNullable = nullable?.includes(prop); - const { value, descriptions } = resolveType( - `${nsid}/${prop}`, - properties[prop], - ); - - chunk += writeJsdoc(descriptions); - chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; - } - - chunk += '}'; - - records += `\n'${nsid}': ${tsNamespace}.Record;`; - } - else if (type === 'query' || type === 'procedure') { - let parameters = def.parameters; - const input = type === 'procedure' ? def.input : undefined; - const output = def.output; - const errors = def.errors; - - descs = getDescriptions(def); - - if (parameters) { - if (Object.values(parameters.properties).length === 0) { - parameters = undefined; - } - else { - const { value, descriptions } = resolveType(nsid, parameters); - - chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; - } - } - else { - chunk += 'interface Params {}'; - } - - if (input) { - if (input.encoding === 'application/json' && input.schema) { - const { value, descriptions } = resolveType(nsid, input.schema); - - chunk += writeJsdoc(descriptions); - - if (input.schema?.type === 'object') { - chunk += `interface Input ${value}`; - } - else { - chunk += `type Input = ${value};`; - } - } - else { - chunk += 'type Input = Blob | ArrayBufferView;'; - } - } - else { - chunk += 'type Input = undefined;'; - } - - if (output) { - if (output.encoding === 'application/json' && output.schema) { - const { value, descriptions } = resolveType(nsid, output.schema); - - chunk += writeJsdoc(descriptions); - - if (output.schema?.type === 'object') { - chunk += `interface Output ${value}`; - } - else { - chunk += `type Output = ${value};`; - } - } - else { - chunk += 'type Output = Uint8Array;'; - } - } - else { - chunk += 'type Output = undefined;'; - } - - if (errors) { - chunk += 'interface Errors {'; - - for (const error of errors) { - chunk += `${error.name}: {};`; - } - - chunk += '}'; - } - - { - let rc = `'${ns}':{\n`; - - if (parameters) { - rc += `params: ${tsNamespace}.Params;`; - } - if (input) { - rc += `input: ${tsNamespace}.Input;`; - } - if (output) { - rc += `output: ${tsNamespace}.Output;`; - } - - rc += '};'; - - if (type === 'query') { - queries += rc; - } - else if (type === 'procedure') { - procedures += rc; - } - } - } - else if (type === 'blob') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'bytes') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'subscription') { - if (def.parameters) { - const { value, descriptions } = resolveType(nsid, def.parameters); - chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; - } - else { - chunk += 'interface Params {}'; - } - - if (def.message?.schema) { - const { value: messageValue, descriptions: messageDesc } - = resolveType(nsid, def.message.schema); - chunk += writeJsdoc(messageDesc); - chunk += `type Message = ${messageValue};`; - } - - if (def.errors) { - chunk += 'interface Errors {'; - for (const error of def.errors) { - chunk += `${error.name}: {};`; - } - chunk += '}'; - } - - let rc = `'${ns}':{\n`; - if (def.parameters) { - rc += `params: ${tsNamespace}.Params;`; - } - if (def.message?.schema) { - rc += `message: ${tsNamespace}.Message;`; - } - if (def.errors) { - rc += `errors: ${tsNamespace}.Errors;`; - } - rc += '};'; - subscriptions += rc; - } - else { - // eslint-disable-next-line no-console - console.log(`${nsid}: unhandled type ${type}`); - } - } - - code += writeJsdoc(descs); - - if (main) { - code += `export declare namespace ${tsNamespace} {`; - } - else { - code += `namespace ${tsNamespace} {`; - } - - code += chunk; - code += '}\n\n'; - } - - if (main) { - code += `export declare interface Records {${records}}\n\n`; - code += `export declare interface Queries {${queries}}\n\n`; - code += `export declare interface Procedures {${procedures}}\n\n`; - code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } - else { - code += `interface Records {${records}}\n\n`; - code += `interface Queries {${queries}}\n\n`; - code += `interface Procedures {${procedures}}\n\n`; - code += `interface Subscriptions {${subscriptions}}\n\n`; - code += '}'; - } - - return code; -} +import { readFile } from 'node:fs/promises'; +import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils/index.js'; +import { resolveType } from './resolvers/index.js'; +import { type DocumentSchema, documentSchema } from './schema.js'; + +export interface GenerateDefinitionsOptions { + files: string[]; + main: boolean; + banner?: string; + description?: string; + debug?: boolean; + onProgress?: (filename: string, index: number, total: number) => void; +} + +export async function generateDefinitions(opts: GenerateDefinitionsOptions) { + const { files, main, banner, description } = opts; + + let queries = ''; + let procedures = ''; + let records = ''; + let subscriptions = ''; + + let code = `/* eslint-disable */ +// This file is automatically generated, do not edit!`; + + if (description) { + code += `\n\n/** + * @module + * ${description} + */`; + } + + if (main) { + code += `\n\n${banner ?? ''}\n${mainPrelude}`; + } + else { + code += `\n\nimport "@tsky/lexicons";${banner ?? ''} + +declare module "@tsky/lexicons" {`; + } + + for await (const filename of files.sort(sortName)) { + let document: DocumentSchema; + + try { + const jsonString = await readFile(filename, 'utf8'); + const parsed = JSON.parse(jsonString); + + if (!documentSchema(parsed)) { + throw new Error('Invalid document schema'); + } + document = parsed; + } + catch (err) { + throw new Error(`failed to read ${filename}`, { cause: err }); + } + + const ns = document.id; + const tsNamespace = toNamespace(ns); + + let descs: string[] = []; + let chunk = ''; + + const definitions = document.defs; + const keys = Object.keys(definitions).sort(sortDefinition); + + for (const key of keys) { + const def = definitions[key]; + const type = def.type; + + const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; + const typeName = key[0].toUpperCase() + key.slice(1); + + if (type === 'string') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'token') { + chunk += `type ${typeName} = '${nsid}';`; + } + else if (type === 'object') { + const required = def.required; + const nullable = def.nullable; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += `interface ${typeName} {`; + chunk += `[Brand.Type]: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + } + else if (type === 'array') { + const { value, descriptions } = resolveType(nsid, def.items); + const descs = []; + + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + + chunk += writeJsdoc(descs.concat(descriptions)); + chunk += `type ${typeName} = (${value})[];`; + } + else if (type === 'record') { + const obj = def.record; + const required = obj.required; + const nullable = obj.nullable; + const properties = obj.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += 'interface Record {'; + chunk += `$type: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + + records += `\n'${nsid}': ${tsNamespace}.Record;`; + } + else if (type === 'query' || type === 'procedure') { + let parameters = def.parameters; + const input = type === 'procedure' ? def.input : undefined; + const output = def.output; + const errors = def.errors; + + descs = getDescriptions(def); + + if (parameters) { + if (Object.values(parameters.properties).length === 0) { + parameters = undefined; + } + else { + const { value, descriptions } = resolveType(nsid, parameters); + + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + } + else { + chunk += 'interface Params {}'; + } + + if (input) { + if (input.encoding === 'application/json' && input.schema) { + const { value, descriptions } = resolveType(nsid, input.schema); + + chunk += writeJsdoc(descriptions); + + if (input.schema?.type === 'object') { + chunk += `interface Input ${value}`; + } + else { + chunk += `type Input = ${value};`; + } + } + else { + chunk += 'type Input = Blob | ArrayBufferView;'; + } + } + else { + chunk += 'type Input = undefined;'; + } + + if (output) { + if (output.encoding === 'application/json' && output.schema) { + const { value, descriptions } = resolveType(nsid, output.schema); + + chunk += writeJsdoc(descriptions); + + if (output.schema?.type === 'object') { + chunk += `interface Output ${value}`; + } + else { + chunk += `type Output = ${value};`; + } + } + else { + chunk += 'type Output = Uint8Array;'; + } + } + else { + chunk += 'type Output = undefined;'; + } + + if (errors) { + chunk += 'interface Errors {'; + + for (const error of errors) { + chunk += `${error.name}: {};`; + } + + chunk += '}'; + } + + { + let rc = `'${ns}':{\n`; + + if (parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (input) { + rc += `input: ${tsNamespace}.Input;`; + } + if (output) { + rc += `output: ${tsNamespace}.Output;`; + } + + rc += '};'; + + if (type === 'query') { + queries += rc; + } + else if (type === 'procedure') { + procedures += rc; + } + } + } + else if (type === 'blob') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'bytes') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } + else if (type === 'subscription') { + if (def.parameters) { + const { value, descriptions } = resolveType(nsid, def.parameters); + chunk += writeJsdoc(descriptions); + chunk += `interface Params ${value}`; + } + else { + chunk += 'interface Params {}'; + } + + if (def.message?.schema) { + const { value: messageValue, descriptions: messageDesc } + = resolveType(nsid, def.message.schema); + chunk += writeJsdoc(messageDesc); + chunk += `type Message = ${messageValue};`; + } + + if (def.errors) { + chunk += 'interface Errors {'; + for (const error of def.errors) { + chunk += `${error.name}: {};`; + } + chunk += '}'; + } + + let rc = `'${ns}':{\n`; + if (def.parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (def.message?.schema) { + rc += `message: ${tsNamespace}.Message;`; + } + if (def.errors) { + rc += `errors: ${tsNamespace}.Errors;`; + } + rc += '};'; + subscriptions += rc; + } + else { + // eslint-disable-next-line no-console + console.log(`${nsid}: unhandled type ${type}`); + } + } + + code += writeJsdoc(descs); + + if (main) { + code += `export declare namespace ${tsNamespace} {`; + } + else { + code += `namespace ${tsNamespace} {`; + } + + code += chunk; + code += '}\n\n'; + } + + if (main) { + code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; + } + else { + code += `interface Records {${records}}\n\n`; + code += `interface Queries {${queries}}\n\n`; + code += `interface Procedures {${procedures}}\n\n`; + code += `interface Subscriptions {${subscriptions}}\n\n`; + code += '}'; + } + + return code; +} diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index 2658312..ee01437 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -3,9 +3,9 @@ import type { RefSchema, RefUnionSchema, XrpcParametersSchema, -} from '../schema'; -import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils'; -import { resolveType } from './type'; +} from '../schema.js'; +import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils/index.js'; +import { resolveType } from './type.js'; export function resolveRefType(def: RefSchema): string { const [ns, ref] = def.ref.split('#'); diff --git a/packages/lex-cli/src/generator/resolvers/index.ts b/packages/lex-cli/src/generator/resolvers/index.ts index a73f0a3..57d75dc 100644 --- a/packages/lex-cli/src/generator/resolvers/index.ts +++ b/packages/lex-cli/src/generator/resolvers/index.ts @@ -1,5 +1,5 @@ -export { resolveObjectType, resolveRefType, resolveUnionType } from './complex'; -export { resolveIntegerType } from './numeric'; -export { resolvePrimitiveType } from './primitives'; -export { resolveStringFormat, resolveStringType } from './string'; -export { resolveType } from './type'; +export { resolveObjectType, resolveRefType, resolveUnionType } from './complex.js'; +export { resolveIntegerType } from './numeric.js'; +export { resolvePrimitiveType } from './primitives.js'; +export { resolveStringFormat, resolveStringType } from './string.js'; +export { resolveType } from './type.js'; diff --git a/packages/lex-cli/src/generator/resolvers/numeric.ts b/packages/lex-cli/src/generator/resolvers/numeric.ts index 35915ca..643f76a 100644 --- a/packages/lex-cli/src/generator/resolvers/numeric.ts +++ b/packages/lex-cli/src/generator/resolvers/numeric.ts @@ -1,4 +1,4 @@ -import type { IntegerSchema } from '../schema'; +import type { IntegerSchema } from '../schema.js'; export function resolveIntegerType( def: IntegerSchema, diff --git a/packages/lex-cli/src/generator/resolvers/string.ts b/packages/lex-cli/src/generator/resolvers/string.ts index b8ebb4d..3a54667 100644 --- a/packages/lex-cli/src/generator/resolvers/string.ts +++ b/packages/lex-cli/src/generator/resolvers/string.ts @@ -1,5 +1,5 @@ -import type { StringSchema } from '../schema'; -import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils'; +import type { StringSchema } from '../schema.js'; +import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils/index.js'; export function resolveStringFormat(format: string, nsid: string): string { if (format === 'did') return TYPE_FORMATS.DID; diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts index a9a1a1e..bb9f66a 100644 --- a/packages/lex-cli/src/generator/resolvers/type.ts +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -2,16 +2,16 @@ import type { RefVariantSchema, UserTypeSchema, XrpcParametersSchema, -} from '../schema'; -import { getDescriptions } from '../../utils'; +} from '../schema.js'; +import { getDescriptions } from '../../utils/index.js'; import { resolveObjectType, resolveRefType, resolveUnionType, -} from './complex'; -import { resolveIntegerType } from './numeric'; -import { resolvePrimitiveType } from './primitives'; -import { resolveStringType } from './string'; +} from './complex.js'; +import { resolveIntegerType } from './numeric.js'; +import { resolvePrimitiveType } from './primitives.js'; +import { resolveStringType } from './string.js'; export function resolveType( nsid: string, diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index fa8809a..55becb3 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -4,7 +4,7 @@ import { Builtins, Cli, Command, Option } from 'clipanion'; import pc from 'picocolors'; import prettier from 'prettier'; import * as t from 'typanion'; -import { generateDefinitions } from './generator'; +import { generateDefinitions } from './generator/index.js'; const cli = new Cli({ binaryName: 'lex-cli', diff --git a/packages/lex-cli/src/utils/index.ts b/packages/lex-cli/src/utils/index.ts index b728a13..c73ad3c 100644 --- a/packages/lex-cli/src/utils/index.ts +++ b/packages/lex-cli/src/utils/index.ts @@ -1,5 +1,5 @@ -export { toNamespace, toUpper } from './cache'; -export { getDescriptions, writeJsdoc } from './docs'; -export { IGNORED_FORMATS, TYPE_FORMATS } from './formats'; -export { mainPrelude } from './prelude'; -export { sortDefinition, sortName, sortPropertyKeys } from './sort'; +export { toNamespace, toUpper } from './cache.js'; +export { getDescriptions, writeJsdoc } from './docs.js'; +export { IGNORED_FORMATS, TYPE_FORMATS } from './formats.js'; +export { mainPrelude } from './prelude.js'; +export { sortDefinition, sortName, sortPropertyKeys } from './sort.js'; From d095c4485e2c711fb62f53513e334c12f35aac38 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 16:33:38 -0500 Subject: [PATCH 58/68] typo: should be pnpm --- packages/lex-cli/package.json | 3 ++- packages/lexicons/package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index 703037f..bf44557 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -12,7 +12,8 @@ "bin": "./dist/index.js", "scripts": { "build": "tsc", - "prepublish": "pnpm run build" + "clean": "rm -rf dist", + "prepublish": "pnpm run clean && pnpm run build" }, "dependencies": { "clipanion": "4.0.0-rc.4", diff --git a/packages/lexicons/package.json b/packages/lexicons/package.json index 39487b4..48f2b41 100644 --- a/packages/lexicons/package.json +++ b/packages/lexicons/package.json @@ -19,7 +19,7 @@ "scripts": { "build": "tsx ./scripts/generate-types.ts && tsc", "clean": "rm -rf dist && rm -rf lexicons", - "prepublish": "npm run build" + "prepublish": "pnpm run clean && pnpm run build" }, "devDependencies": { "@tsky/lex-cli": "workspace:*", From 145bf4f9c83ffc57c1ba95c93d855d2c6451614f Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 17:23:59 -0500 Subject: [PATCH 59/68] changing to GenerateTypes --- packages/lex-cli/src/index.ts | 22 ++++++++++++++------- packages/lexicons/scripts/generate-types.ts | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 55becb3..0cf3b87 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -14,28 +14,36 @@ const cli = new Cli({ cli.register(Builtins.HelpCommand); cli.register( - class GenerateMainLexicons extends Command { - static paths = [['generate-main']]; + class GenerateTypes extends Command { + static paths = [['generate-types']]; static usage = Command.Usage({ - description: 'Generates the main type definition file', + description: 'Generates TypeScript type definitions from Lexicon schema files', + details: ` + This command takes Lexicon JSON schema files as input and generates corresponding TypeScript + type definitions. It handles all AT Protocol lexicons (app.bsky, com.atproto, etc.) and + outputs a single consolidated TypeScript declaration file. + `, + examples: [ + ['Basic usage', 'lex-cli generate-types ./lexicons/**/*.json -o types.ts'], + ['With module description', 'lex-cli generate-types ./lexicons/**/*.json -o types.ts --description "AT Protocol Types"'], + ], }); output = Option.String('-o,--output', { required: false, - description: - 'Where to save the resulting type definition file, defaults to stdout if not passed', + description: 'Path for the generated TypeScript definition file. If not specified, outputs to stdout', validator: t.cascade(t.isString(), t.matchesRegExp(/\.ts$/)), }); desc = Option.String('--description', { required: false, - description: 'Module description', + description: 'JSDoc description to add to the generated module', }); banner = Option.String('--banner', { required: false, - description: 'Insert an arbitrary string at the beginning of the module', + description: 'Custom banner text to insert at the top of the generated file', }); files = Option.Rest({ diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index 09c8218..fd23709 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -93,7 +93,7 @@ async function main() { const command = [ 'node', LEX_CLI_PATH, - 'generate-main', + 'generate-types', ...lexiconFiles, '-o', TYPES_OUTPUT_PATH, @@ -108,7 +108,7 @@ async function main() { }); console.log('Done! Types generated at', TYPES_OUTPUT_PATH); - } + } catch (error) { console.error('Error:', error); process.exit(1); From f4c8826f38c1ff254ac5db86e7bed2087c853ecf Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 17:46:30 -0500 Subject: [PATCH 60/68] cleaning up generation --- packages/lex-cli/src/generator/index.ts | 40 +++++-------------------- packages/lex-cli/src/index.ts | 1 - packages/lexicons/src/lib/lexicons.ts | 2 +- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 17adb8d..80c19fe 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -5,7 +5,6 @@ import { type DocumentSchema, documentSchema } from './schema.js'; export interface GenerateDefinitionsOptions { files: string[]; - main: boolean; banner?: string; description?: string; debug?: boolean; @@ -13,7 +12,7 @@ export interface GenerateDefinitionsOptions { } export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, main, banner, description } = opts; + const { files, banner, description } = opts; let queries = ''; let procedures = ''; @@ -21,7 +20,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { let subscriptions = ''; let code = `/* eslint-disable */ -// This file is automatically generated, do not edit!`; +// This file is automatically generated by @tsky/lex-cli, do not edit!`; if (description) { code += `\n\n/** @@ -30,14 +29,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { */`; } - if (main) { - code += `\n\n${banner ?? ''}\n${mainPrelude}`; - } - else { - code += `\n\nimport "@tsky/lexicons";${banner ?? ''} - -declare module "@tsky/lexicons" {`; - } + code += `\n\n${banner ?? ''}\n${mainPrelude}`; for await (const filename of files.sort(sortName)) { let document: DocumentSchema; @@ -305,31 +297,15 @@ declare module "@tsky/lexicons" {`; } code += writeJsdoc(descs); - - if (main) { - code += `export declare namespace ${tsNamespace} {`; - } - else { - code += `namespace ${tsNamespace} {`; - } - + code += `export declare namespace ${tsNamespace} {`; code += chunk; code += '}\n\n'; } - if (main) { - code += `export declare interface Records {${records}}\n\n`; - code += `export declare interface Queries {${queries}}\n\n`; - code += `export declare interface Procedures {${procedures}}\n\n`; - code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - } - else { - code += `interface Records {${records}}\n\n`; - code += `interface Queries {${queries}}\n\n`; - code += `interface Procedures {${procedures}}\n\n`; - code += `interface Subscriptions {${subscriptions}}\n\n`; - code += '}'; - } + code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; return code; } diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 0cf3b87..d38c79d 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -57,7 +57,6 @@ cli.register( try { code = await generateDefinitions({ files: this.files, - main: true, banner: this.banner, description: this.desc, }); diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 99b14d8..7c420b2 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// This file is automatically generated, do not edit! +// This file is automatically generated by @tsky/lex-cli, do not edit! /** * @module From be916359bb24ebebbf0422ef1b416ea0590c360e Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 18:34:26 -0500 Subject: [PATCH 61/68] cleaning up comments --- packages/lexicons/scripts/generate-types.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index fd23709..e970581 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -16,7 +16,6 @@ const LEX_CLI_PATH = path.resolve(__dirname, '../../lex-cli/dist/index.js'); const REPO = 'bluesky-social/atproto'; async function downloadLexicons() { - // Get latest commit SHA for lexicons console.log('Getting latest lexicon commit...'); const shaResponse = await fetch( `https://api.github.com/repos/${REPO}/commits?path=lexicons/`, @@ -31,7 +30,6 @@ async function downloadLexicons() { throw new Error('No commits found for lexicons'); } - // Download specific commit's lexicons console.log('Downloading lexicons from atproto...'); const response = await fetch( `https://github.com/${REPO}/archive/${sha}.tar.gz`, @@ -40,11 +38,9 @@ async function downloadLexicons() { throw new Error(`Failed to download lexicons: ${response.statusText}`); } - // Create a temporary file for the tar download const tarFile = path.join(LEXICONS_DIR, 'atproto.tar.gz'); await fs.writeFile(tarFile, Buffer.from(await response.arrayBuffer())); - // Extract only lexicon files await tar.x({ file: tarFile, cwd: LEXICONS_DIR, @@ -52,20 +48,16 @@ async function downloadLexicons() { strip: 2, }); - // Clean up tar file await fs.unlink(tarFile); } async function main() { try { - // Ensure directories exist await fs.mkdir(LEXICONS_DIR, { recursive: true }); await fs.mkdir(path.dirname(TYPES_OUTPUT_PATH), { recursive: true }); - // Download latest lexicons await downloadLexicons(); - // Define glob patterns for lexicon JSON files const globPatterns = [ 'app/bsky/**/*.json', 'chat/bsky/**/*.json', @@ -73,7 +65,6 @@ async function main() { 'tools/ozone/**/*.json', ]; - // Find all matching lexicon files const lexiconFiles = await glob(globPatterns, { cwd: LEXICONS_DIR, absolute: true, @@ -83,7 +74,6 @@ async function main() { throw new Error('No lexicon files found'); } - // Ensure lex-cli is built console.log('Building lex-cli...'); execSync('pnpm --filter @tsky/lex-cli build', { stdio: 'inherit', From 22a247fe1ef2c36198b00dc259ae4cfce2cabddc Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 18:59:22 -0500 Subject: [PATCH 62/68] adding extensions --- packages/lexicons/index.ts | 2 +- packages/lexicons/src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/lexicons/index.ts b/packages/lexicons/index.ts index cba1843..4df73b3 100644 --- a/packages/lexicons/index.ts +++ b/packages/lexicons/index.ts @@ -1 +1 @@ -export * from './src/index'; +export * from './src/index.js'; diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index a8eb681..fd67ea5 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -1,6 +1,6 @@ -import type { Procedures, Queries, Records } from './lib/lexicons'; +import type { Procedures, Queries, Records } from './lib/lexicons.js'; -export * from './lib/lexicons'; +export * from './lib/lexicons.js'; // --- Core utility types --- export type LexiconUnion = T[keyof T]; From 3563edbf07556f10d3480943a33a0f896fca9217 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 19:23:06 -0500 Subject: [PATCH 63/68] refactor: switch from Brand.Type to concrete $type field --- packages/lex-cli/src/generator/index.ts | 23 +- .../src/generator/resolvers/complex.ts | 2 +- packages/lex-cli/src/utils/prelude.ts | 30 +- packages/lexicons/src/index.ts | 31 +- packages/lexicons/src/lib/lexicons.ts | 1585 ++++++++--------- 5 files changed, 739 insertions(+), 932 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 80c19fe..d470c98 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -81,8 +81,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { const descs = getDescriptions(def); chunk += writeJsdoc(descs); - chunk += `interface ${typeName} {`; - chunk += `[Brand.Type]: '${nsid}';`; + chunk += `interface ${typeName} extends TypedBase {`; for (const prop of propKeys) { const isOptional = !required || !required.includes(prop); @@ -123,7 +122,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { const descs = getDescriptions(def); chunk += writeJsdoc(descs); - chunk += 'interface Record {'; + chunk += `interface Record extends RecordBase {`; chunk += `$type: '${nsid}';`; for (const prop of propKeys) { @@ -158,11 +157,11 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { const { value, descriptions } = resolveType(nsid, parameters); chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; + chunk += `interface Params extends TypedBase ${value}`; } } else { - chunk += 'interface Params {}'; + chunk += 'interface Params extends TypedBase {}'; } if (input) { @@ -172,7 +171,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { chunk += writeJsdoc(descriptions); if (input.schema?.type === 'object') { - chunk += `interface Input ${value}`; + chunk += `interface Input extends TypedBase ${value}`; } else { chunk += `type Input = ${value};`; @@ -193,7 +192,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { chunk += writeJsdoc(descriptions); if (output.schema?.type === 'object') { - chunk += `interface Output ${value}`; + chunk += `interface Output extends TypedBase ${value}`; } else { chunk += `type Output = ${value};`; @@ -208,7 +207,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { } if (errors) { - chunk += 'interface Errors {'; + chunk += 'interface Errors extends TypedBase {'; for (const error of errors) { chunk += `${error.name}: {};`; @@ -256,10 +255,10 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { if (def.parameters) { const { value, descriptions } = resolveType(nsid, def.parameters); chunk += writeJsdoc(descriptions); - chunk += `interface Params ${value}`; + chunk += `interface Params extends TypedBase ${value}`; } else { - chunk += 'interface Params {}'; + chunk += 'interface Params extends TypedBase {}'; } if (def.message?.schema) { @@ -270,7 +269,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { } if (def.errors) { - chunk += 'interface Errors {'; + chunk += 'interface Errors extends TypedBase {'; for (const error of def.errors) { chunk += `${error.name}: {};`; } @@ -302,7 +301,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) { code += '}\n\n'; } - code += `export declare interface Records {${records}}\n\n`; + code += `export declare interface Records extends RecordBase {${records}}\n\n`; code += `export declare interface Queries {${queries}}\n\n`; code += `export declare interface Procedures {${procedures}}\n\n`; code += `export declare interface Subscriptions {${subscriptions}}\n\n`; diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index ee01437..feaca4c 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -17,7 +17,7 @@ export function resolveUnionType(def: RefUnionSchema): string { const [ns, ref] = raw.split('#'); return (ns ? `${toNamespace(ns)}.` : '') + (ref ? toUpper(ref) : 'Main'); }); - return `Brand.Union<${refs.join('|')}>`; + return `TypeUnion<${refs.join('|')}>`; } export function resolveObjectType( diff --git a/packages/lex-cli/src/utils/prelude.ts b/packages/lex-cli/src/utils/prelude.ts index 2ed9bd9..3102284 100644 --- a/packages/lex-cli/src/utils/prelude.ts +++ b/packages/lex-cli/src/utils/prelude.ts @@ -1,18 +1,24 @@ -export const mainPrelude = `type ObjectOmit = Omit; +export const mainPrelude = `/** Base type with optional type field */ +export interface TypedBase { + $type?: string; +} -/** Handles type branding in objects */ -export declare namespace Brand { - /** Symbol used to brand objects, this does not actually exist in runtime */ - const Type: unique symbol; +/** Base type for all record types */ +export interface RecordBase { + $type: string; +} - /** Get the intended \`$type\` field */ - type GetType = T[typeof Type]; +/** Makes $type required and specific */ +export type Typed = Omit & { + $type: Type; +}; - /** Creates a union of objects where it's discriminated by \`$type\` field. */ - type Union = T extends any ? T & { $type: GetType } : never; +/** Creates a union of objects discriminated by $type */ +export type TypeUnion = T extends any ? Typed : never; - /** Omits the type branding from object */ - type Omit = ObjectOmit; +/** Type guard for records */ +export function isRecord(value: unknown): value is RecordBase { + return typeof value === 'object' && value !== null && '$type' in value && typeof value.$type === 'string'; } /** Base AT Protocol schema types */ @@ -40,7 +46,7 @@ export declare namespace At { } /** Blob interface */ - interface Blob { + interface Blob extends RecordBase { $type: 'blob'; mimeType: T; ref: { diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index fd67ea5..d79d3ab 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -1,4 +1,4 @@ -import type { Procedures, Queries, Records } from './lib/lexicons.js'; +import { isRecord, type Procedures, type Queries, type Records } from './lib/lexicons.js'; export * from './lib/lexicons.js'; @@ -16,8 +16,8 @@ export type KnownNSID = BskyNSID | AtProtoNSID; // --- Record Types --- export type RecordDefs = LexiconUnion; -export type BskyRecord = RecordDefs & { $type: BskyNSID }; -export type AtProtoRecord = RecordDefs & { $type: AtProtoNSID }; +export type BskyRecord = Extract; +export type AtProtoRecord = Extract; // --- Query Types --- export type QueryDefs = LexiconUnion; @@ -73,29 +73,12 @@ export type ProcedureErrors = : never; // --- Common Bluesky Types --- -export type BskyPost = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}feed.post`; -}; -export type BskyProfile = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}actor.profile`; -}; -export type BskyLike = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}feed.like`; -}; -export type BskyFollow = BskyRecord & { - $type: `${typeof APP_BSKY_PREFIX}graph.follow`; -}; +export type BskyPost = Extract; +export type BskyProfile = Extract; +export type BskyLike = Extract; +export type BskyFollow = Extract; // --- Type Guards --- -export function isRecord(value: unknown): value is RecordDefs { - return ( - typeof value === 'object' - && value !== null - && '$type' in value - && typeof value.$type === 'string' - ); -} - export function isBskyRecord(value: unknown): value is BskyRecord { return isRecord(value) && value.$type.startsWith(APP_BSKY_PREFIX); } diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 7c420b2..36a5616 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -6,23 +6,37 @@ * Contains type declarations for Bluesky lexicons */ -type ObjectOmit = Omit; +/** Base type with optional type field */ +export interface TypedBase { + $type?: string; +} -/** Handles type branding in objects */ -export declare namespace Brand { - /** Symbol used to brand objects, this does not actually exist in runtime */ - const Type: unique symbol; +/** Base type for all record types */ +export interface RecordBase { + $type: string; +} - /** Get the intended `$type` field */ - type GetType = T[typeof Type]; +/** Makes $type required and specific */ +export type Typed = Omit< + T, + "$type" +> & { + $type: Type; +}; - /** Creates a union of objects where it's discriminated by `$type` field. */ - type Union = T extends any - ? T & { $type: GetType } - : never; +/** Creates a union of objects discriminated by $type */ +export type TypeUnion = T extends any + ? Typed + : never; - /** Omits the type branding from object */ - type Omit = ObjectOmit; +/** Type guard for records */ +export function isRecord(value: unknown): value is RecordBase { + return ( + typeof value === "object" && + value !== null && + "$type" in value && + typeof value.$type === "string" + ); } /** Base AT Protocol schema types */ @@ -50,7 +64,7 @@ export declare namespace At { } /** Blob interface */ - interface Blob { + interface Blob extends RecordBase { $type: "blob"; mimeType: T; ref: { @@ -60,20 +74,17 @@ export declare namespace At { } } export declare namespace AppBskyActorDefs { - interface AdultContentPref { - [Brand.Type]: "app.bsky.actor.defs#adultContentPref"; + interface AdultContentPref extends TypedBase { /** \@default false */ enabled: boolean; } /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ - interface BskyAppProgressGuide { - [Brand.Type]: "app.bsky.actor.defs#bskyAppProgressGuide"; + interface BskyAppProgressGuide extends TypedBase { /** Maximum string length: 100 */ guide: string; } /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ - interface BskyAppStatePref { - [Brand.Type]: "app.bsky.actor.defs#bskyAppStatePref"; + interface BskyAppStatePref extends TypedBase { activeProgressGuide?: BskyAppProgressGuide; /** * Storage for NUXs the user has encountered. @@ -87,15 +98,13 @@ export declare namespace AppBskyActorDefs { */ queuedNudges?: string[]; } - interface ContentLabelPref { - [Brand.Type]: "app.bsky.actor.defs#contentLabelPref"; + interface ContentLabelPref extends TypedBase { label: string; visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); /** Which labeler does this preference apply to? If undefined, applies globally. */ labelerDid?: At.DID; } - interface FeedViewPref { - [Brand.Type]: "app.bsky.actor.defs#feedViewPref"; + interface FeedViewPref extends TypedBase { /** The URI of the feed, or an identifier which describes the feed. */ feed: string; /** Hide quote posts in the feed. */ @@ -112,13 +121,11 @@ export declare namespace AppBskyActorDefs { /** Hide reposts in the feed. */ hideReposts?: boolean; } - interface HiddenPostsPref { - [Brand.Type]: "app.bsky.actor.defs#hiddenPostsPref"; + interface HiddenPostsPref extends TypedBase { /** A list of URIs of posts the account owner has hidden. */ items: At.Uri[]; } - interface InterestsPref { - [Brand.Type]: "app.bsky.actor.defs#interestsPref"; + interface InterestsPref extends TypedBase { /** * A list of tags which describe the account owner's interests gathered during onboarding. * Maximum array length: 100 @@ -128,8 +135,7 @@ export declare namespace AppBskyActorDefs { tags: string[]; } /** The subject's followers whom you also follow */ - interface KnownFollowers { - [Brand.Type]: "app.bsky.actor.defs#knownFollowers"; + interface KnownFollowers extends TypedBase { count: number; /** * Minimum array length: 0 @@ -137,17 +143,14 @@ export declare namespace AppBskyActorDefs { */ followers: ProfileViewBasic[]; } - interface LabelerPrefItem { - [Brand.Type]: "app.bsky.actor.defs#labelerPrefItem"; + interface LabelerPrefItem extends TypedBase { did: At.DID; } - interface LabelersPref { - [Brand.Type]: "app.bsky.actor.defs#labelersPref"; + interface LabelersPref extends TypedBase { labelers: LabelerPrefItem[]; } /** A word that the account owner has muted. */ - interface MutedWord { - [Brand.Type]: "app.bsky.actor.defs#mutedWord"; + interface MutedWord extends TypedBase { /** The intended targets of the muted word. */ targets: AppBskyActorDefs.MutedWordTarget[]; /** @@ -165,8 +168,7 @@ export declare namespace AppBskyActorDefs { expiresAt?: string; id?: string; } - interface MutedWordsPref { - [Brand.Type]: "app.bsky.actor.defs#mutedWordsPref"; + interface MutedWordsPref extends TypedBase { /** A list of words the account owner has muted. */ items: AppBskyActorDefs.MutedWord[]; } @@ -176,8 +178,7 @@ export declare namespace AppBskyActorDefs { */ type MutedWordTarget = "content" | "tag" | (string & {}); /** A new user experiences (NUX) storage object */ - interface Nux { - [Brand.Type]: "app.bsky.actor.defs#nux"; + interface Nux extends TypedBase { /** \@default false */ completed: boolean; /** Maximum string length: 100 */ @@ -191,12 +192,11 @@ export declare namespace AppBskyActorDefs { /** The date and time at which the NUX will expire and should be considered completed. */ expiresAt?: string; } - interface PersonalDetailsPref { - [Brand.Type]: "app.bsky.actor.defs#personalDetailsPref"; + interface PersonalDetailsPref extends TypedBase { /** The birth date of account owner. */ birthDate?: string; } - type Preferences = Brand.Union< + type Preferences = TypeUnion< | AdultContentPref | BskyAppStatePref | ContentLabelPref @@ -210,20 +210,17 @@ export declare namespace AppBskyActorDefs { | SavedFeedsPrefV2 | ThreadViewPref >[]; - interface ProfileAssociated { - [Brand.Type]: "app.bsky.actor.defs#profileAssociated"; + interface ProfileAssociated extends TypedBase { chat?: ProfileAssociatedChat; feedgens?: number; labeler?: boolean; lists?: number; starterPacks?: number; } - interface ProfileAssociatedChat { - [Brand.Type]: "app.bsky.actor.defs#profileAssociatedChat"; + interface ProfileAssociatedChat extends TypedBase { allowIncoming: "all" | "following" | "none" | (string & {}); } - interface ProfileView { - [Brand.Type]: "app.bsky.actor.defs#profileView"; + interface ProfileView extends TypedBase { did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -243,8 +240,7 @@ export declare namespace AppBskyActorDefs { labels?: ComAtprotoLabelDefs.Label[]; viewer?: ViewerState; } - interface ProfileViewBasic { - [Brand.Type]: "app.bsky.actor.defs#profileViewBasic"; + interface ProfileViewBasic extends TypedBase { did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -258,8 +254,7 @@ export declare namespace AppBskyActorDefs { labels?: ComAtprotoLabelDefs.Label[]; viewer?: ViewerState; } - interface ProfileViewDetailed { - [Brand.Type]: "app.bsky.actor.defs#profileViewDetailed"; + interface ProfileViewDetailed extends TypedBase { did: At.DID; handle: At.Handle; associated?: ProfileAssociated; @@ -285,25 +280,21 @@ export declare namespace AppBskyActorDefs { postsCount?: number; viewer?: ViewerState; } - interface SavedFeed { - [Brand.Type]: "app.bsky.actor.defs#savedFeed"; + interface SavedFeed extends TypedBase { id: string; pinned: boolean; type: "feed" | "list" | "timeline" | (string & {}); value: string; } - interface SavedFeedsPref { - [Brand.Type]: "app.bsky.actor.defs#savedFeedsPref"; + interface SavedFeedsPref extends TypedBase { pinned: At.Uri[]; saved: At.Uri[]; timelineIndex?: number; } - interface SavedFeedsPrefV2 { - [Brand.Type]: "app.bsky.actor.defs#savedFeedsPrefV2"; + interface SavedFeedsPrefV2 extends TypedBase { items: AppBskyActorDefs.SavedFeed[]; } - interface ThreadViewPref { - [Brand.Type]: "app.bsky.actor.defs#threadViewPref"; + interface ThreadViewPref extends TypedBase { /** Show followed users at the top of all replies. */ prioritizeFollowedUsers?: boolean; /** Sorting mode for threads. */ @@ -316,8 +307,7 @@ export declare namespace AppBskyActorDefs { | (string & {}); } /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ - interface ViewerState { - [Brand.Type]: "app.bsky.actor.defs#viewerState"; + interface ViewerState extends TypedBase { blockedBy?: boolean; blocking?: At.Uri; blockingByList?: AppBskyGraphDefs.ListViewBasic; @@ -332,14 +322,14 @@ export declare namespace AppBskyActorDefs { /** Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. */ export declare namespace AppBskyActorGetPreferences { type Input = undefined; - interface Output { + interface Output extends TypedBase { preferences: AppBskyActorDefs.Preferences; } } /** Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. */ export declare namespace AppBskyActorGetProfile { - interface Params { + interface Params extends TypedBase { /** Handle or DID of account to fetch profile of. */ actor: string; } @@ -349,19 +339,19 @@ export declare namespace AppBskyActorGetProfile { /** Get detailed profile views of multiple actors. */ export declare namespace AppBskyActorGetProfiles { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 25 */ actors: string[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { profiles: AppBskyActorDefs.ProfileViewDetailed[]; } } /** Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. */ export declare namespace AppBskyActorGetSuggestions { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -371,7 +361,7 @@ export declare namespace AppBskyActorGetSuggestions { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -379,7 +369,7 @@ export declare namespace AppBskyActorGetSuggestions { export declare namespace AppBskyActorProfile { /** A declaration of a Bluesky account profile. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.actor.profile"; /** Small image to be displayed next to posts from account. AKA, 'profile picture' */ avatar?: At.Blob; @@ -399,15 +389,15 @@ export declare namespace AppBskyActorProfile { displayName?: string; joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main; /** Self-label values, specific to the Bluesky application, on the overall account. */ - labels?: Brand.Union; + labels?: TypeUnion; pinnedPost?: ComAtprotoRepoStrongRef.Main; } } /** Set the private preferences attached to the account. */ export declare namespace AppBskyActorPutPreferences { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { preferences: AppBskyActorDefs.Preferences; } type Output = undefined; @@ -415,7 +405,7 @@ export declare namespace AppBskyActorPutPreferences { /** Find actors (profiles) matching search criteria. Does not require auth. */ export declare namespace AppBskyActorSearchActors { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -432,7 +422,7 @@ export declare namespace AppBskyActorSearchActors { term?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -440,7 +430,7 @@ export declare namespace AppBskyActorSearchActors { /** Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. */ export declare namespace AppBskyActorSearchActorsTypeahead { - interface Params { + interface Params extends TypedBase { /** * Minimum: 1 * Maximum: 100 @@ -456,15 +446,14 @@ export declare namespace AppBskyActorSearchActorsTypeahead { term?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyActorDefs.ProfileViewBasic[]; } } export declare namespace AppBskyEmbedDefs { /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ - interface AspectRatio { - [Brand.Type]: "app.bsky.embed.defs#aspectRatio"; + interface AspectRatio extends TypedBase { /** Minimum: 1 */ height: number; /** Minimum: 1 */ @@ -474,23 +463,19 @@ export declare namespace AppBskyEmbedDefs { export declare namespace AppBskyEmbedExternal { /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ - interface Main { - [Brand.Type]: "app.bsky.embed.external"; + interface Main extends TypedBase { external: External; } - interface External { - [Brand.Type]: "app.bsky.embed.external#external"; + interface External extends TypedBase { description: string; title: string; uri: string; thumb?: At.Blob; } - interface View { - [Brand.Type]: "app.bsky.embed.external#view"; + interface View extends TypedBase { external: ViewExternal; } - interface ViewExternal { - [Brand.Type]: "app.bsky.embed.external#viewExternal"; + interface ViewExternal extends TypedBase { description: string; title: string; uri: string; @@ -499,25 +484,21 @@ export declare namespace AppBskyEmbedExternal { } export declare namespace AppBskyEmbedImages { - interface Main { - [Brand.Type]: "app.bsky.embed.images"; + interface Main extends TypedBase { /** Maximum array length: 4 */ images: Image[]; } - interface Image { - [Brand.Type]: "app.bsky.embed.images#image"; + interface Image extends TypedBase { /** Alt text description of the image, for accessibility. */ alt: string; image: At.Blob; aspectRatio?: AppBskyEmbedDefs.AspectRatio; } - interface View { - [Brand.Type]: "app.bsky.embed.images#view"; + interface View extends TypedBase { /** Maximum array length: 4 */ images: ViewImage[]; } - interface ViewImage { - [Brand.Type]: "app.bsky.embed.images#viewImage"; + interface ViewImage extends TypedBase { /** Alt text description of the image, for accessibility. */ alt: string; /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ @@ -529,13 +510,11 @@ export declare namespace AppBskyEmbedImages { } export declare namespace AppBskyEmbedRecord { - interface Main { - [Brand.Type]: "app.bsky.embed.record"; + interface Main extends TypedBase { record: ComAtprotoRepoStrongRef.Main; } - interface View { - [Brand.Type]: "app.bsky.embed.record#view"; - record: Brand.Union< + interface View extends TypedBase { + record: TypeUnion< | ViewBlocked | ViewDetached | ViewNotFound @@ -546,31 +525,27 @@ export declare namespace AppBskyEmbedRecord { | AppBskyLabelerDefs.LabelerView >; } - interface ViewBlocked { - [Brand.Type]: "app.bsky.embed.record#viewBlocked"; + interface ViewBlocked extends TypedBase { author: AppBskyFeedDefs.BlockedAuthor; blocked: boolean; uri: At.Uri; } - interface ViewDetached { - [Brand.Type]: "app.bsky.embed.record#viewDetached"; + interface ViewDetached extends TypedBase { detached: boolean; uri: At.Uri; } - interface ViewNotFound { - [Brand.Type]: "app.bsky.embed.record#viewNotFound"; + interface ViewNotFound extends TypedBase { notFound: boolean; uri: At.Uri; } - interface ViewRecord { - [Brand.Type]: "app.bsky.embed.record#viewRecord"; + interface ViewRecord extends TypedBase { author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; uri: At.Uri; /** The record data itself. */ value: unknown; - embeds?: Brand.Union< + embeds?: TypeUnion< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View | AppBskyEmbedRecord.View @@ -586,18 +561,16 @@ export declare namespace AppBskyEmbedRecord { } export declare namespace AppBskyEmbedRecordWithMedia { - interface Main { - [Brand.Type]: "app.bsky.embed.recordWithMedia"; - media: Brand.Union< + interface Main extends TypedBase { + media: TypeUnion< | AppBskyEmbedExternal.Main | AppBskyEmbedImages.Main | AppBskyEmbedVideo.Main >; record: AppBskyEmbedRecord.Main; } - interface View { - [Brand.Type]: "app.bsky.embed.recordWithMedia#view"; - media: Brand.Union< + interface View extends TypedBase { + media: TypeUnion< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View | AppBskyEmbedVideo.View @@ -607,8 +580,7 @@ export declare namespace AppBskyEmbedRecordWithMedia { } export declare namespace AppBskyEmbedVideo { - interface Main { - [Brand.Type]: "app.bsky.embed.video"; + interface Main extends TypedBase { video: At.Blob; /** * Alt text description of the video, for accessibility. @@ -620,13 +592,11 @@ export declare namespace AppBskyEmbedVideo { /** Maximum array length: 20 */ captions?: Caption[]; } - interface Caption { - [Brand.Type]: "app.bsky.embed.video#caption"; + interface Caption extends TypedBase { file: At.Blob; lang: string; } - interface View { - [Brand.Type]: "app.bsky.embed.video#view"; + interface View extends TypedBase { cid: At.CID; playlist: string; /** @@ -640,13 +610,11 @@ export declare namespace AppBskyEmbedVideo { } export declare namespace AppBskyFeedDefs { - interface BlockedAuthor { - [Brand.Type]: "app.bsky.feed.defs#blockedAuthor"; + interface BlockedAuthor extends TypedBase { did: At.DID; viewer?: AppBskyActorDefs.ViewerState; } - interface BlockedPost { - [Brand.Type]: "app.bsky.feed.defs#blockedPost"; + interface BlockedPost extends TypedBase { author: BlockedAuthor; blocked: boolean; uri: At.Uri; @@ -655,19 +623,17 @@ export declare namespace AppBskyFeedDefs { type ClickthroughEmbed = "app.bsky.feed.defs#clickthroughEmbed"; type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; - interface FeedViewPost { - [Brand.Type]: "app.bsky.feed.defs#feedViewPost"; + interface FeedViewPost extends TypedBase { post: PostView; /** * Context provided by feed generator that may be passed back alongside interactions. * Maximum string length: 2000 */ feedContext?: string; - reason?: Brand.Union; + reason?: TypeUnion; reply?: ReplyRef; } - interface GeneratorView { - [Brand.Type]: "app.bsky.feed.defs#generatorView"; + interface GeneratorView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; did: At.DID; @@ -687,12 +653,10 @@ export declare namespace AppBskyFeedDefs { likeCount?: number; viewer?: GeneratorViewerState; } - interface GeneratorViewerState { - [Brand.Type]: "app.bsky.feed.defs#generatorViewerState"; + interface GeneratorViewerState extends TypedBase { like?: At.Uri; } - interface Interaction { - [Brand.Type]: "app.bsky.feed.defs#interaction"; + interface Interaction extends TypedBase { event?: | "app.bsky.feed.defs#clickthroughAuthor" | "app.bsky.feed.defs#clickthroughEmbed" @@ -720,19 +684,17 @@ export declare namespace AppBskyFeedDefs { type InteractionRepost = "app.bsky.feed.defs#interactionRepost"; type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; type InteractionShare = "app.bsky.feed.defs#interactionShare"; - interface NotFoundPost { - [Brand.Type]: "app.bsky.feed.defs#notFoundPost"; + interface NotFoundPost extends TypedBase { notFound: boolean; uri: At.Uri; } - interface PostView { - [Brand.Type]: "app.bsky.feed.defs#postView"; + interface PostView extends TypedBase { author: AppBskyActorDefs.ProfileViewBasic; cid: At.CID; indexedAt: string; record: unknown; uri: At.Uri; - embed?: Brand.Union< + embed?: TypeUnion< | AppBskyEmbedExternal.View | AppBskyEmbedImages.View | AppBskyEmbedRecord.View @@ -747,56 +709,45 @@ export declare namespace AppBskyFeedDefs { threadgate?: ThreadgateView; viewer?: ViewerState; } - interface ReasonPin { - [Brand.Type]: "app.bsky.feed.defs#reasonPin"; - } - interface ReasonRepost { - [Brand.Type]: "app.bsky.feed.defs#reasonRepost"; + interface ReasonPin extends TypedBase {} + interface ReasonRepost extends TypedBase { by: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; } - interface ReplyRef { - [Brand.Type]: "app.bsky.feed.defs#replyRef"; - parent: Brand.Union; - root: Brand.Union; + interface ReplyRef extends TypedBase { + parent: TypeUnion; + root: TypeUnion; /** When parent is a reply to another post, this is the author of that post. */ grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic; } type RequestLess = "app.bsky.feed.defs#requestLess"; type RequestMore = "app.bsky.feed.defs#requestMore"; - interface SkeletonFeedPost { - [Brand.Type]: "app.bsky.feed.defs#skeletonFeedPost"; + interface SkeletonFeedPost extends TypedBase { post: At.Uri; /** * Context that will be passed through to client and may be passed to feed generator back alongside interactions. * Maximum string length: 2000 */ feedContext?: string; - reason?: Brand.Union; - } - interface SkeletonReasonPin { - [Brand.Type]: "app.bsky.feed.defs#skeletonReasonPin"; + reason?: TypeUnion; } - interface SkeletonReasonRepost { - [Brand.Type]: "app.bsky.feed.defs#skeletonReasonRepost"; + interface SkeletonReasonPin extends TypedBase {} + interface SkeletonReasonRepost extends TypedBase { repost: At.Uri; } - interface ThreadgateView { - [Brand.Type]: "app.bsky.feed.defs#threadgateView"; + interface ThreadgateView extends TypedBase { cid?: At.CID; lists?: AppBskyGraphDefs.ListViewBasic[]; record?: unknown; uri?: At.Uri; } - interface ThreadViewPost { - [Brand.Type]: "app.bsky.feed.defs#threadViewPost"; + interface ThreadViewPost extends TypedBase { post: PostView; - parent?: Brand.Union; - replies?: Brand.Union[]; + parent?: TypeUnion; + replies?: TypeUnion[]; } /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ - interface ViewerState { - [Brand.Type]: "app.bsky.feed.defs#viewerState"; + interface ViewerState extends TypedBase { embeddingDisabled?: boolean; like?: At.Uri; pinned?: boolean; @@ -808,19 +759,17 @@ export declare namespace AppBskyFeedDefs { /** Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). */ export declare namespace AppBskyFeedDescribeFeedGenerator { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { did: At.DID; feeds: Feed[]; links?: Links; } - interface Feed { - [Brand.Type]: "app.bsky.feed.describeFeedGenerator#feed"; + interface Feed extends TypedBase { uri: At.Uri; } - interface Links { - [Brand.Type]: "app.bsky.feed.describeFeedGenerator#links"; + interface Links extends TypedBase { privacyPolicy?: string; termsOfService?: string; } @@ -828,7 +777,7 @@ export declare namespace AppBskyFeedDescribeFeedGenerator { export declare namespace AppBskyFeedGenerator { /** Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.generator"; createdAt: string; did: At.DID; @@ -847,13 +796,13 @@ export declare namespace AppBskyFeedGenerator { description?: string; descriptionFacets?: AppBskyRichtextFacet.Main[]; /** Self-label values */ - labels?: Brand.Union; + labels?: TypeUnion; } } /** Get a list of feeds (feed generator records) created by the actor (in the actor's repo). */ export declare namespace AppBskyFeedGetActorFeeds { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -864,7 +813,7 @@ export declare namespace AppBskyFeedGetActorFeeds { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; cursor?: string; } @@ -872,7 +821,7 @@ export declare namespace AppBskyFeedGetActorFeeds { /** Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. */ export declare namespace AppBskyFeedGetActorLikes { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -883,11 +832,11 @@ export declare namespace AppBskyFeedGetActorLikes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { BlockedActor: {}; BlockedByActor: {}; } @@ -895,7 +844,7 @@ export declare namespace AppBskyFeedGetActorLikes { /** Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. */ export declare namespace AppBskyFeedGetAuthorFeed { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -918,11 +867,11 @@ export declare namespace AppBskyFeedGetAuthorFeed { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { BlockedActor: {}; BlockedByActor: {}; } @@ -930,7 +879,7 @@ export declare namespace AppBskyFeedGetAuthorFeed { /** Get a hydrated feed from an actor's selected feed generator. Implemented by App View. */ export declare namespace AppBskyFeedGetFeed { - interface Params { + interface Params extends TypedBase { feed: At.Uri; cursor?: string; /** @@ -941,23 +890,23 @@ export declare namespace AppBskyFeedGetFeed { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { UnknownFeed: {}; } } /** Get information about a feed generator. Implemented by AppView. */ export declare namespace AppBskyFeedGetFeedGenerator { - interface Params { + interface Params extends TypedBase { /** AT-URI of the feed generator record. */ feed: At.Uri; } type Input = undefined; - interface Output { + interface Output extends TypedBase { /** Indicates whether the feed generator service has been online recently, or else seems to be inactive. */ isOnline: boolean; /** Indicates whether the feed generator service is compatible with the record declaration. */ @@ -968,18 +917,18 @@ export declare namespace AppBskyFeedGetFeedGenerator { /** Get information about a list of feed generators. */ export declare namespace AppBskyFeedGetFeedGenerators { - interface Params { + interface Params extends TypedBase { feeds: At.Uri[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; } } /** Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. */ export declare namespace AppBskyFeedGetFeedSkeleton { - interface Params { + interface Params extends TypedBase { /** Reference to feed generator record describing the specific feed being requested. */ feed: At.Uri; cursor?: string; @@ -991,18 +940,18 @@ export declare namespace AppBskyFeedGetFeedSkeleton { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.SkeletonFeedPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { UnknownFeed: {}; } } /** Get like records which reference a subject (by AT-URI and CID). */ export declare namespace AppBskyFeedGetLikes { - interface Params { + interface Params extends TypedBase { /** AT-URI of the subject (eg, a post record). */ uri: At.Uri; /** CID of the subject record (aka, specific version of record), to filter likes. */ @@ -1016,14 +965,13 @@ export declare namespace AppBskyFeedGetLikes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { likes: Like[]; uri: At.Uri; cid?: At.CID; cursor?: string; } - interface Like { - [Brand.Type]: "app.bsky.feed.getLikes#like"; + interface Like extends TypedBase { actor: AppBskyActorDefs.ProfileView; createdAt: string; indexedAt: string; @@ -1032,7 +980,7 @@ export declare namespace AppBskyFeedGetLikes { /** Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. */ export declare namespace AppBskyFeedGetListFeed { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) to the list record. */ list: At.Uri; cursor?: string; @@ -1044,18 +992,18 @@ export declare namespace AppBskyFeedGetListFeed { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { UnknownList: {}; } } /** Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. */ export declare namespace AppBskyFeedGetPosts { - interface Params { + interface Params extends TypedBase { /** * List of post AT-URIs to return hydrated views for. * Maximum array length: 25 @@ -1063,14 +1011,14 @@ export declare namespace AppBskyFeedGetPosts { uris: At.Uri[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyFeedDefs.PostView[]; } } /** Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. */ export declare namespace AppBskyFeedGetPostThread { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) to post record. */ uri: At.Uri; /** @@ -1089,22 +1037,22 @@ export declare namespace AppBskyFeedGetPostThread { parentHeight?: number; } type Input = undefined; - interface Output { - thread: Brand.Union< + interface Output extends TypedBase { + thread: TypeUnion< | AppBskyFeedDefs.BlockedPost | AppBskyFeedDefs.NotFoundPost | AppBskyFeedDefs.ThreadViewPost >; threadgate?: AppBskyFeedDefs.ThreadgateView; } - interface Errors { + interface Errors extends TypedBase { NotFound: {}; } } /** Get a list of quotes for a given post. */ export declare namespace AppBskyFeedGetQuotes { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of post record */ uri: At.Uri; /** If supplied, filters to quotes of specific version (by CID) of the post record. */ @@ -1118,7 +1066,7 @@ export declare namespace AppBskyFeedGetQuotes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyFeedDefs.PostView[]; uri: At.Uri; cid?: At.CID; @@ -1128,7 +1076,7 @@ export declare namespace AppBskyFeedGetQuotes { /** Get a list of reposts for a given post. */ export declare namespace AppBskyFeedGetRepostedBy { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of post record */ uri: At.Uri; /** If supplied, filters to reposts of specific version (by CID) of the post record. */ @@ -1142,7 +1090,7 @@ export declare namespace AppBskyFeedGetRepostedBy { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { repostedBy: AppBskyActorDefs.ProfileView[]; uri: At.Uri; cid?: At.CID; @@ -1152,7 +1100,7 @@ export declare namespace AppBskyFeedGetRepostedBy { /** Get a list of suggested feeds (feed generators) for the requesting account. */ export declare namespace AppBskyFeedGetSuggestedFeeds { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1162,7 +1110,7 @@ export declare namespace AppBskyFeedGetSuggestedFeeds { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; cursor?: string; } @@ -1170,7 +1118,7 @@ export declare namespace AppBskyFeedGetSuggestedFeeds { /** Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. */ export declare namespace AppBskyFeedGetTimeline { - interface Params { + interface Params extends TypedBase { /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ algorithm?: string; cursor?: string; @@ -1182,7 +1130,7 @@ export declare namespace AppBskyFeedGetTimeline { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feed: AppBskyFeedDefs.FeedViewPost[]; cursor?: string; } @@ -1190,7 +1138,7 @@ export declare namespace AppBskyFeedGetTimeline { export declare namespace AppBskyFeedLike { /** Record declaring a 'like' of a piece of subject content. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.like"; createdAt: string; subject: ComAtprotoRepoStrongRef.Main; @@ -1199,7 +1147,7 @@ export declare namespace AppBskyFeedLike { export declare namespace AppBskyFeedPost { /** Record containing a Bluesky post. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.post"; /** Client-declared timestamp when this post was originally created. */ createdAt: string; @@ -1209,7 +1157,7 @@ export declare namespace AppBskyFeedPost { * Maximum grapheme length: 300 */ text: string; - embed?: Brand.Union< + embed?: TypeUnion< | AppBskyEmbedExternal.Main | AppBskyEmbedImages.Main | AppBskyEmbedRecord.Main @@ -1224,7 +1172,7 @@ export declare namespace AppBskyFeedPost { /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[]; /** Self-label values for this post. Effectively content warnings. */ - labels?: Brand.Union; + labels?: TypeUnion; /** * Indicates human language of post primary text content. * Maximum array length: 3 @@ -1243,15 +1191,13 @@ export declare namespace AppBskyFeedPost { * Deprecated: use facets instead. * \@deprecated */ - interface Entity { - [Brand.Type]: "app.bsky.feed.post#entity"; + interface Entity extends TypedBase { index: TextSlice; /** Expected values are 'mention' and 'link'. */ type: string; value: string; } - interface ReplyRef { - [Brand.Type]: "app.bsky.feed.post#replyRef"; + interface ReplyRef extends TypedBase { parent: ComAtprotoRepoStrongRef.Main; root: ComAtprotoRepoStrongRef.Main; } @@ -1259,8 +1205,7 @@ export declare namespace AppBskyFeedPost { * Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. * \@deprecated */ - interface TextSlice { - [Brand.Type]: "app.bsky.feed.post#textSlice"; + interface TextSlice extends TypedBase { /** Minimum: 0 */ end: number; /** Minimum: 0 */ @@ -1270,7 +1215,7 @@ export declare namespace AppBskyFeedPost { export declare namespace AppBskyFeedPostgate { /** Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.postgate"; createdAt: string; /** Reference (AT-URI) to the post record. */ @@ -1281,17 +1226,15 @@ export declare namespace AppBskyFeedPostgate { */ detachedEmbeddingUris?: At.Uri[]; /** Maximum array length: 5 */ - embeddingRules?: Brand.Union[]; + embeddingRules?: TypeUnion[]; } /** Disables embedding of this post. */ - interface DisableRule { - [Brand.Type]: "app.bsky.feed.postgate#disableRule"; - } + interface DisableRule extends TypedBase {} } export declare namespace AppBskyFeedRepost { /** Record representing a 'repost' of an existing Bluesky post. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.repost"; createdAt: string; subject: ComAtprotoRepoStrongRef.Main; @@ -1300,7 +1243,7 @@ export declare namespace AppBskyFeedRepost { /** Find posts matching search criteria, returning views of those posts. */ export declare namespace AppBskyFeedSearchPosts { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ @@ -1338,35 +1281,35 @@ export declare namespace AppBskyFeedSearchPosts { url?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyFeedDefs.PostView[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } /** Send information about interactions with feed items back to the feed generator that served them. */ export declare namespace AppBskyFeedSendInteractions { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { interactions: AppBskyFeedDefs.Interaction[]; } - interface Output {} + interface Output extends TypedBase {} } export declare namespace AppBskyFeedThreadgate { /** Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.feed.threadgate"; createdAt: string; /** Reference (AT-URI) to the post record. */ post: At.Uri; /** Maximum array length: 5 */ - allow?: Brand.Union[]; + allow?: TypeUnion[]; /** * List of hidden reply URIs. * Maximum array length: 50 @@ -1374,23 +1317,18 @@ export declare namespace AppBskyFeedThreadgate { hiddenReplies?: At.Uri[]; } /** Allow replies from actors you follow. */ - interface FollowingRule { - [Brand.Type]: "app.bsky.feed.threadgate#followingRule"; - } + interface FollowingRule extends TypedBase {} /** Allow replies from actors on a list. */ - interface ListRule { - [Brand.Type]: "app.bsky.feed.threadgate#listRule"; + interface ListRule extends TypedBase { list: At.Uri; } /** Allow replies from actors mentioned in your post. */ - interface MentionRule { - [Brand.Type]: "app.bsky.feed.threadgate#mentionRule"; - } + interface MentionRule extends TypedBase {} } export declare namespace AppBskyGraphBlock { /** Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.block"; createdAt: string; /** DID of the account to be blocked. */ @@ -1400,8 +1338,7 @@ export declare namespace AppBskyGraphBlock { export declare namespace AppBskyGraphDefs { type Curatelist = "app.bsky.graph.defs#curatelist"; - interface ListItemView { - [Brand.Type]: "app.bsky.graph.defs#listItemView"; + interface ListItemView extends TypedBase { subject: AppBskyActorDefs.ProfileView; uri: At.Uri; } @@ -1410,8 +1347,7 @@ export declare namespace AppBskyGraphDefs { | "app.bsky.graph.defs#modlist" | "app.bsky.graph.defs#referencelist" | (string & {}); - interface ListView { - [Brand.Type]: "app.bsky.graph.defs#listView"; + interface ListView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1434,8 +1370,7 @@ export declare namespace AppBskyGraphDefs { listItemCount?: number; viewer?: ListViewerState; } - interface ListViewBasic { - [Brand.Type]: "app.bsky.graph.defs#listViewBasic"; + interface ListViewBasic extends TypedBase { cid: At.CID; /** * Minimum string length: 1 @@ -1451,30 +1386,26 @@ export declare namespace AppBskyGraphDefs { listItemCount?: number; viewer?: ListViewerState; } - interface ListViewerState { - [Brand.Type]: "app.bsky.graph.defs#listViewerState"; + interface ListViewerState extends TypedBase { blocked?: At.Uri; muted?: boolean; } type Modlist = "app.bsky.graph.defs#modlist"; /** indicates that a handle or DID could not be resolved */ - interface NotFoundActor { - [Brand.Type]: "app.bsky.graph.defs#notFoundActor"; + interface NotFoundActor extends TypedBase { actor: string; notFound: boolean; } type Referencelist = "app.bsky.graph.defs#referencelist"; /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ - interface Relationship { - [Brand.Type]: "app.bsky.graph.defs#relationship"; + interface Relationship extends TypedBase { did: At.DID; /** if the actor is followed by this DID, contains the AT-URI of the follow record */ followedBy?: At.Uri; /** if the actor follows this DID, this is the AT-URI of the follow record */ following?: At.Uri; } - interface StarterPackView { - [Brand.Type]: "app.bsky.graph.defs#starterPackView"; + interface StarterPackView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1491,8 +1422,7 @@ export declare namespace AppBskyGraphDefs { /** Maximum array length: 12 */ listItemsSample?: ListItemView[]; } - interface StarterPackViewBasic { - [Brand.Type]: "app.bsky.graph.defs#starterPackViewBasic"; + interface StarterPackViewBasic extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileViewBasic; indexedAt: string; @@ -1510,7 +1440,7 @@ export declare namespace AppBskyGraphDefs { export declare namespace AppBskyGraphFollow { /** Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.follow"; createdAt: string; subject: At.DID; @@ -1519,7 +1449,7 @@ export declare namespace AppBskyGraphFollow { /** Get a list of starter packs created by the actor. */ export declare namespace AppBskyGraphGetActorStarterPacks { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1530,7 +1460,7 @@ export declare namespace AppBskyGraphGetActorStarterPacks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; cursor?: string; } @@ -1538,7 +1468,7 @@ export declare namespace AppBskyGraphGetActorStarterPacks { /** Enumerates which accounts the requesting account is currently blocking. Requires auth. */ export declare namespace AppBskyGraphGetBlocks { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1548,7 +1478,7 @@ export declare namespace AppBskyGraphGetBlocks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { blocks: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -1556,7 +1486,7 @@ export declare namespace AppBskyGraphGetBlocks { /** Enumerates accounts which follow a specified account (actor). */ export declare namespace AppBskyGraphGetFollowers { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1567,7 +1497,7 @@ export declare namespace AppBskyGraphGetFollowers { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { followers: AppBskyActorDefs.ProfileView[]; subject: AppBskyActorDefs.ProfileView; cursor?: string; @@ -1576,7 +1506,7 @@ export declare namespace AppBskyGraphGetFollowers { /** Enumerates accounts which a specified account (actor) follows. */ export declare namespace AppBskyGraphGetFollows { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1587,7 +1517,7 @@ export declare namespace AppBskyGraphGetFollows { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { follows: AppBskyActorDefs.ProfileView[]; subject: AppBskyActorDefs.ProfileView; cursor?: string; @@ -1596,7 +1526,7 @@ export declare namespace AppBskyGraphGetFollows { /** Enumerates accounts which follow a specified account (actor) and are followed by the viewer. */ export declare namespace AppBskyGraphGetKnownFollowers { - interface Params { + interface Params extends TypedBase { actor: string; cursor?: string; /** @@ -1607,7 +1537,7 @@ export declare namespace AppBskyGraphGetKnownFollowers { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { followers: AppBskyActorDefs.ProfileView[]; subject: AppBskyActorDefs.ProfileView; cursor?: string; @@ -1616,7 +1546,7 @@ export declare namespace AppBskyGraphGetKnownFollowers { /** Gets a 'view' (with additional context) of a specified list. */ export declare namespace AppBskyGraphGetList { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of the list record to hydrate. */ list: At.Uri; cursor?: string; @@ -1628,7 +1558,7 @@ export declare namespace AppBskyGraphGetList { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { items: AppBskyGraphDefs.ListItemView[]; list: AppBskyGraphDefs.ListView; cursor?: string; @@ -1637,7 +1567,7 @@ export declare namespace AppBskyGraphGetList { /** Get mod lists that the requesting account (actor) is blocking. Requires auth. */ export declare namespace AppBskyGraphGetListBlocks { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1647,7 +1577,7 @@ export declare namespace AppBskyGraphGetListBlocks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { lists: AppBskyGraphDefs.ListView[]; cursor?: string; } @@ -1655,7 +1585,7 @@ export declare namespace AppBskyGraphGetListBlocks { /** Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. */ export declare namespace AppBskyGraphGetListMutes { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1665,7 +1595,7 @@ export declare namespace AppBskyGraphGetListMutes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { lists: AppBskyGraphDefs.ListView[]; cursor?: string; } @@ -1673,7 +1603,7 @@ export declare namespace AppBskyGraphGetListMutes { /** Enumerates the lists created by a specified account (actor). */ export declare namespace AppBskyGraphGetLists { - interface Params { + interface Params extends TypedBase { /** The account (actor) to enumerate lists from. */ actor: string; cursor?: string; @@ -1685,7 +1615,7 @@ export declare namespace AppBskyGraphGetLists { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { lists: AppBskyGraphDefs.ListView[]; cursor?: string; } @@ -1693,7 +1623,7 @@ export declare namespace AppBskyGraphGetLists { /** Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. */ export declare namespace AppBskyGraphGetMutes { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -1703,7 +1633,7 @@ export declare namespace AppBskyGraphGetMutes { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { mutes: AppBskyActorDefs.ProfileView[]; cursor?: string; } @@ -1711,7 +1641,7 @@ export declare namespace AppBskyGraphGetMutes { /** Enumerates public relationships between one account, and a list of other accounts. Does not require auth. */ export declare namespace AppBskyGraphGetRelationships { - interface Params { + interface Params extends TypedBase { /** Primary account requesting relationships for. */ actor: string; /** @@ -1721,48 +1651,48 @@ export declare namespace AppBskyGraphGetRelationships { others?: string[]; } type Input = undefined; - interface Output { - relationships: Brand.Union< + interface Output extends TypedBase { + relationships: TypeUnion< AppBskyGraphDefs.NotFoundActor | AppBskyGraphDefs.Relationship >[]; actor?: At.DID; } - interface Errors { + interface Errors extends TypedBase { ActorNotFound: {}; } } /** Gets a view of a starter pack. */ export declare namespace AppBskyGraphGetStarterPack { - interface Params { + interface Params extends TypedBase { /** Reference (AT-URI) of the starter pack record. */ starterPack: At.Uri; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPack: AppBskyGraphDefs.StarterPackView; } } /** Get views for a list of starter packs. */ export declare namespace AppBskyGraphGetStarterPacks { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 25 */ uris: At.Uri[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; } } /** Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. */ export declare namespace AppBskyGraphGetSuggestedFollowsByActor { - interface Params { + interface Params extends TypedBase { actor: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { suggestions: AppBskyActorDefs.ProfileView[]; /** * If true, response has fallen-back to generic results, and is not scoped using relativeToDid @@ -1774,7 +1704,7 @@ export declare namespace AppBskyGraphGetSuggestedFollowsByActor { export declare namespace AppBskyGraphList { /** Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.list"; createdAt: string; /** @@ -1792,13 +1722,13 @@ export declare namespace AppBskyGraphList { */ description?: string; descriptionFacets?: AppBskyRichtextFacet.Main[]; - labels?: Brand.Union; + labels?: TypeUnion; } } export declare namespace AppBskyGraphListblock { /** Record representing a block relationship against an entire an entire list of accounts (actors). */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.listblock"; createdAt: string; /** Reference (AT-URI) to the mod list record. */ @@ -1808,7 +1738,7 @@ export declare namespace AppBskyGraphListblock { export declare namespace AppBskyGraphListitem { /** Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.listitem"; createdAt: string; /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ @@ -1820,8 +1750,8 @@ export declare namespace AppBskyGraphListitem { /** Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. */ export declare namespace AppBskyGraphMuteActor { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { actor: string; } type Output = undefined; @@ -1829,8 +1759,8 @@ export declare namespace AppBskyGraphMuteActor { /** Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. */ export declare namespace AppBskyGraphMuteActorList { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { list: At.Uri; } type Output = undefined; @@ -1838,8 +1768,8 @@ export declare namespace AppBskyGraphMuteActorList { /** Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. */ export declare namespace AppBskyGraphMuteThread { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { root: At.Uri; } type Output = undefined; @@ -1847,7 +1777,7 @@ export declare namespace AppBskyGraphMuteThread { /** Find starter packs matching search criteria. Does not require auth. */ export declare namespace AppBskyGraphSearchStarterPacks { - interface Params { + interface Params extends TypedBase { /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; cursor?: string; @@ -1859,7 +1789,7 @@ export declare namespace AppBskyGraphSearchStarterPacks { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; cursor?: string; } @@ -1867,7 +1797,7 @@ export declare namespace AppBskyGraphSearchStarterPacks { export declare namespace AppBskyGraphStarterpack { /** Record defining a starter pack of actors and feeds for new users. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.graph.starterpack"; createdAt: string; /** Reference (AT-URI) to the list record. */ @@ -1888,16 +1818,15 @@ export declare namespace AppBskyGraphStarterpack { /** Maximum array length: 3 */ feeds?: FeedItem[]; } - interface FeedItem { - [Brand.Type]: "app.bsky.graph.starterpack#feedItem"; + interface FeedItem extends TypedBase { uri: At.Uri; } } /** Unmutes the specified account. Requires auth. */ export declare namespace AppBskyGraphUnmuteActor { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { actor: string; } type Output = undefined; @@ -1905,8 +1834,8 @@ export declare namespace AppBskyGraphUnmuteActor { /** Unmutes the specified list of accounts. Requires auth. */ export declare namespace AppBskyGraphUnmuteActorList { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { list: At.Uri; } type Output = undefined; @@ -1914,23 +1843,21 @@ export declare namespace AppBskyGraphUnmuteActorList { /** Unmutes the specified thread. Requires auth. */ export declare namespace AppBskyGraphUnmuteThread { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { root: At.Uri; } type Output = undefined; } export declare namespace AppBskyLabelerDefs { - interface LabelerPolicies { - [Brand.Type]: "app.bsky.labeler.defs#labelerPolicies"; + interface LabelerPolicies extends TypedBase { /** The label values which this labeler publishes. May include global or custom labels. */ labelValues: ComAtprotoLabelDefs.LabelValue[]; /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; } - interface LabelerView { - [Brand.Type]: "app.bsky.labeler.defs#labelerView"; + interface LabelerView extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1940,8 +1867,7 @@ export declare namespace AppBskyLabelerDefs { likeCount?: number; viewer?: LabelerViewerState; } - interface LabelerViewDetailed { - [Brand.Type]: "app.bsky.labeler.defs#labelerViewDetailed"; + interface LabelerViewDetailed extends TypedBase { cid: At.CID; creator: AppBskyActorDefs.ProfileView; indexedAt: string; @@ -1952,22 +1878,21 @@ export declare namespace AppBskyLabelerDefs { likeCount?: number; viewer?: LabelerViewerState; } - interface LabelerViewerState { - [Brand.Type]: "app.bsky.labeler.defs#labelerViewerState"; + interface LabelerViewerState extends TypedBase { like?: At.Uri; } } /** Get information about a list of labeler services. */ export declare namespace AppBskyLabelerGetServices { - interface Params { + interface Params extends TypedBase { dids: At.DID[]; /** \@default false */ detailed?: boolean; } type Input = undefined; - interface Output { - views: Brand.Union< + interface Output extends TypedBase { + views: TypeUnion< AppBskyLabelerDefs.LabelerView | AppBskyLabelerDefs.LabelerViewDetailed >[]; } @@ -1975,29 +1900,29 @@ export declare namespace AppBskyLabelerGetServices { export declare namespace AppBskyLabelerService { /** A declaration of the existence of labeler service. */ - interface Record { + interface Record extends RecordBase { $type: "app.bsky.labeler.service"; createdAt: string; policies: AppBskyLabelerDefs.LabelerPolicies; - labels?: Brand.Union; + labels?: TypeUnion; } } /** Count the number of unread notifications for the requesting account. Requires auth. */ export declare namespace AppBskyNotificationGetUnreadCount { - interface Params { + interface Params extends TypedBase { priority?: boolean; seenAt?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { count: number; } } /** Enumerate notifications for the requesting account. Requires auth. */ export declare namespace AppBskyNotificationListNotifications { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2009,14 +1934,13 @@ export declare namespace AppBskyNotificationListNotifications { seenAt?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { notifications: Notification[]; cursor?: string; priority?: boolean; seenAt?: string; } - interface Notification { - [Brand.Type]: "app.bsky.notification.listNotifications#notification"; + interface Notification extends TypedBase { author: AppBskyActorDefs.ProfileView; cid: At.CID; indexedAt: string; @@ -2040,8 +1964,8 @@ export declare namespace AppBskyNotificationListNotifications { /** Set notification-related preferences for an account. Requires auth. */ export declare namespace AppBskyNotificationPutPreferences { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { priority: boolean; } type Output = undefined; @@ -2049,8 +1973,8 @@ export declare namespace AppBskyNotificationPutPreferences { /** Register to receive push notifications, via a specified service, for the requesting account. Requires auth. */ export declare namespace AppBskyNotificationRegisterPush { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { appId: string; platform: "android" | "ios" | "web" | (string & {}); serviceDid: At.DID; @@ -2061,8 +1985,8 @@ export declare namespace AppBskyNotificationRegisterPush { /** Notify server that the requesting account has seen notifications. Requires auth. */ export declare namespace AppBskyNotificationUpdateSeen { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { seenAt: string; } type Output = undefined; @@ -2070,32 +1994,27 @@ export declare namespace AppBskyNotificationUpdateSeen { export declare namespace AppBskyRichtextFacet { /** Annotation of a sub-string within rich text. */ - interface Main { - [Brand.Type]: "app.bsky.richtext.facet"; - features: Brand.Union[]; + interface Main extends TypedBase { + features: TypeUnion[]; index: ByteSlice; } /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ - interface ByteSlice { - [Brand.Type]: "app.bsky.richtext.facet#byteSlice"; + interface ByteSlice extends TypedBase { /** Minimum: 0 */ byteEnd: number; /** Minimum: 0 */ byteStart: number; } /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ - interface Link { - [Brand.Type]: "app.bsky.richtext.facet#link"; + interface Link extends TypedBase { uri: string; } /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ - interface Mention { - [Brand.Type]: "app.bsky.richtext.facet#mention"; + interface Mention extends TypedBase { did: At.DID; } /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ - interface Tag { - [Brand.Type]: "app.bsky.richtext.facet#tag"; + interface Tag extends TypedBase { /** * Maximum string length: 640 * Maximum grapheme length: 64 @@ -2105,32 +2024,29 @@ export declare namespace AppBskyRichtextFacet { } export declare namespace AppBskyUnspeccedDefs { - interface SkeletonSearchActor { - [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchActor"; + interface SkeletonSearchActor extends TypedBase { did: At.DID; } - interface SkeletonSearchPost { - [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchPost"; + interface SkeletonSearchPost extends TypedBase { uri: At.Uri; } - interface SkeletonSearchStarterPack { - [Brand.Type]: "app.bsky.unspecced.defs#skeletonSearchStarterPack"; + interface SkeletonSearchStarterPack extends TypedBase { uri: At.Uri; } } /** Get miscellaneous runtime configuration. */ export declare namespace AppBskyUnspeccedGetConfig { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { checkEmailConfirmed?: boolean; } } /** An unspecced view of globally popular feed generators. */ export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2141,7 +2057,7 @@ export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { query?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { feeds: AppBskyFeedDefs.GeneratorView[]; cursor?: string; } @@ -2149,7 +2065,7 @@ export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { /** Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions */ export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2163,7 +2079,7 @@ export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; cursor?: string; /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ @@ -2174,11 +2090,10 @@ export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { /** Get a list of suggestions (feeds and users) tagged with categories */ export declare namespace AppBskyUnspeccedGetTaggedSuggestions { type Input = undefined; - interface Output { + interface Output extends TypedBase { suggestions: Suggestion[]; } - interface Suggestion { - [Brand.Type]: "app.bsky.unspecced.getTaggedSuggestions#suggestion"; + interface Suggestion extends TypedBase { subject: string; subjectType: "actor" | "feed" | (string & {}); tag: string; @@ -2187,7 +2102,7 @@ export declare namespace AppBskyUnspeccedGetTaggedSuggestions { /** Backend Actors (profile) search, returns only skeleton. */ export declare namespace AppBskyUnspeccedSearchActorsSkeleton { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ q: string; /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ @@ -2204,20 +2119,20 @@ export declare namespace AppBskyUnspeccedSearchActorsSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } /** Backend Posts search, returns only skeleton */ export declare namespace AppBskyUnspeccedSearchPostsSkeleton { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ @@ -2257,20 +2172,20 @@ export declare namespace AppBskyUnspeccedSearchPostsSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } /** Backend Starter Pack search, returns only skeleton. */ export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { - interface Params { + interface Params extends TypedBase { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string; /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ @@ -2285,20 +2200,19 @@ export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { viewer?: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]; cursor?: string; /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number; } - interface Errors { + interface Errors extends TypedBase { BadQueryString: {}; } } export declare namespace AppBskyVideoDefs { - interface JobStatus { - [Brand.Type]: "app.bsky.video.defs#jobStatus"; + interface JobStatus extends TypedBase { did: At.DID; jobId: string; /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ @@ -2317,20 +2231,20 @@ export declare namespace AppBskyVideoDefs { /** Get status details for a video processing job. */ export declare namespace AppBskyVideoGetJobStatus { - interface Params { + interface Params extends TypedBase { jobId: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { jobStatus: AppBskyVideoDefs.JobStatus; } } /** Get video upload limits for the authenticated user. */ export declare namespace AppBskyVideoGetUploadLimits { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { canUpload: boolean; error?: string; message?: string; @@ -2341,24 +2255,23 @@ export declare namespace AppBskyVideoGetUploadLimits { /** Upload a video to be processed then stored on the PDS. */ export declare namespace AppBskyVideoUploadVideo { - interface Params {} + interface Params extends TypedBase {} type Input = Blob | ArrayBufferView; - interface Output { + interface Output extends TypedBase { jobStatus: AppBskyVideoDefs.JobStatus; } } export declare namespace ChatBskyActorDeclaration { /** A declaration of a Bluesky chat account. */ - interface Record { + interface Record extends RecordBase { $type: "chat.bsky.actor.declaration"; allowIncoming: "all" | "following" | "none" | (string & {}); } } export declare namespace ChatBskyActorDefs { - interface ProfileViewBasic { - [Brand.Type]: "chat.bsky.actor.defs#profileViewBasic"; + interface ProfileViewBasic extends TypedBase { did: At.DID; handle: At.Handle; associated?: AppBskyActorDefs.ProfileAssociated; @@ -2376,76 +2289,67 @@ export declare namespace ChatBskyActorDefs { } export declare namespace ChatBskyActorDeleteAccount { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output {} + interface Output extends TypedBase {} } export declare namespace ChatBskyActorExportAccountData { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = Uint8Array; } export declare namespace ChatBskyConvoDefs { - interface ConvoView { - [Brand.Type]: "chat.bsky.convo.defs#convoView"; + interface ConvoView extends TypedBase { id: string; members: ChatBskyActorDefs.ProfileViewBasic[]; muted: boolean; rev: string; unreadCount: number; - lastMessage?: Brand.Union; + lastMessage?: TypeUnion; opened?: boolean; } - interface DeletedMessageView { - [Brand.Type]: "chat.bsky.convo.defs#deletedMessageView"; + interface DeletedMessageView extends TypedBase { id: string; rev: string; sender: MessageViewSender; sentAt: string; } - interface LogBeginConvo { - [Brand.Type]: "chat.bsky.convo.defs#logBeginConvo"; + interface LogBeginConvo extends TypedBase { convoId: string; rev: string; } - interface LogCreateMessage { - [Brand.Type]: "chat.bsky.convo.defs#logCreateMessage"; + interface LogCreateMessage extends TypedBase { convoId: string; - message: Brand.Union; + message: TypeUnion; rev: string; } - interface LogDeleteMessage { - [Brand.Type]: "chat.bsky.convo.defs#logDeleteMessage"; + interface LogDeleteMessage extends TypedBase { convoId: string; - message: Brand.Union; + message: TypeUnion; rev: string; } - interface LogLeaveConvo { - [Brand.Type]: "chat.bsky.convo.defs#logLeaveConvo"; + interface LogLeaveConvo extends TypedBase { convoId: string; rev: string; } - interface MessageInput { - [Brand.Type]: "chat.bsky.convo.defs#messageInput"; + interface MessageInput extends TypedBase { /** * Maximum string length: 10000 * Maximum grapheme length: 1000 */ text: string; - embed?: Brand.Union; + embed?: TypeUnion; /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[]; } - interface MessageRef { - [Brand.Type]: "chat.bsky.convo.defs#messageRef"; + interface MessageRef extends TypedBase { convoId: string; did: At.DID; messageId: string; } - interface MessageView { - [Brand.Type]: "chat.bsky.convo.defs#messageView"; + interface MessageView extends TypedBase { id: string; rev: string; sender: MessageViewSender; @@ -2455,19 +2359,18 @@ export declare namespace ChatBskyConvoDefs { * Maximum grapheme length: 1000 */ text: string; - embed?: Brand.Union; + embed?: TypeUnion; /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[]; } - interface MessageViewSender { - [Brand.Type]: "chat.bsky.convo.defs#messageViewSender"; + interface MessageViewSender extends TypedBase { did: At.DID; } } export declare namespace ChatBskyConvoDeleteMessageForSelf { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; messageId: string; } @@ -2475,17 +2378,17 @@ export declare namespace ChatBskyConvoDeleteMessageForSelf { } export declare namespace ChatBskyConvoGetConvo { - interface Params { + interface Params extends TypedBase { convoId: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoGetConvoForMembers { - interface Params { + interface Params extends TypedBase { /** * Minimum array length: 1 * Maximum array length: 10 @@ -2493,18 +2396,18 @@ export declare namespace ChatBskyConvoGetConvoForMembers { members: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoGetLog { - interface Params { + interface Params extends TypedBase { cursor?: string; } type Input = undefined; - interface Output { - logs: Brand.Union< + interface Output extends TypedBase { + logs: TypeUnion< | ChatBskyConvoDefs.LogBeginConvo | ChatBskyConvoDefs.LogCreateMessage | ChatBskyConvoDefs.LogDeleteMessage @@ -2515,7 +2418,7 @@ export declare namespace ChatBskyConvoGetLog { } export declare namespace ChatBskyConvoGetMessages { - interface Params { + interface Params extends TypedBase { convoId: string; cursor?: string; /** @@ -2526,8 +2429,8 @@ export declare namespace ChatBskyConvoGetMessages { limit?: number; } type Input = undefined; - interface Output { - messages: Brand.Union< + interface Output extends TypedBase { + messages: TypeUnion< ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView >[]; cursor?: string; @@ -2535,18 +2438,18 @@ export declare namespace ChatBskyConvoGetMessages { } export declare namespace ChatBskyConvoLeaveConvo { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; } - interface Output { + interface Output extends TypedBase { convoId: string; rev: string; } } export declare namespace ChatBskyConvoListConvos { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2556,25 +2459,25 @@ export declare namespace ChatBskyConvoListConvos { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { convos: ChatBskyConvoDefs.ConvoView[]; cursor?: string; } } export declare namespace ChatBskyConvoMuteConvo { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; } - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoSendMessage { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; message: ChatBskyConvoDefs.MessageInput; } @@ -2582,54 +2485,52 @@ export declare namespace ChatBskyConvoSendMessage { } export declare namespace ChatBskyConvoSendMessageBatch { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Maximum array length: 100 */ items: BatchItem[]; } - interface Output { + interface Output extends TypedBase { items: ChatBskyConvoDefs.MessageView[]; } - interface BatchItem { - [Brand.Type]: "chat.bsky.convo.sendMessageBatch#batchItem"; + interface BatchItem extends TypedBase { convoId: string; message: ChatBskyConvoDefs.MessageInput; } } export declare namespace ChatBskyConvoUnmuteConvo { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; } - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyConvoUpdateRead { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { convoId: string; messageId?: string; } - interface Output { + interface Output extends TypedBase { convo: ChatBskyConvoDefs.ConvoView; } } export declare namespace ChatBskyModerationGetActorMetadata { - interface Params { + interface Params extends TypedBase { actor: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { all: Metadata; day: Metadata; month: Metadata; } - interface Metadata { - [Brand.Type]: "chat.bsky.moderation.getActorMetadata#metadata"; + interface Metadata extends TypedBase { convos: number; convosStarted: number; messagesReceived: number; @@ -2638,7 +2539,7 @@ export declare namespace ChatBskyModerationGetActorMetadata { } export declare namespace ChatBskyModerationGetMessageContext { - interface Params { + interface Params extends TypedBase { messageId: string; /** \@default 5 */ after?: number; @@ -2648,16 +2549,16 @@ export declare namespace ChatBskyModerationGetMessageContext { convoId?: string; } type Input = undefined; - interface Output { - messages: Brand.Union< + interface Output extends TypedBase { + messages: TypeUnion< ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView >[]; } } export declare namespace ChatBskyModerationUpdateActorAccess { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { actor: At.DID; allowAccess: boolean; ref?: string; @@ -2666,8 +2567,7 @@ export declare namespace ChatBskyModerationUpdateActorAccess { } export declare namespace ComAtprotoAdminDefs { - interface AccountView { - [Brand.Type]: "com.atproto.admin.defs#accountView"; + interface AccountView extends TypedBase { did: At.DID; handle: At.Handle; indexedAt: string; @@ -2681,23 +2581,19 @@ export declare namespace ComAtprotoAdminDefs { relatedRecords?: unknown[]; threatSignatures?: ThreatSignature[]; } - interface RepoBlobRef { - [Brand.Type]: "com.atproto.admin.defs#repoBlobRef"; + interface RepoBlobRef extends TypedBase { cid: At.CID; did: At.DID; recordUri?: At.Uri; } - interface RepoRef { - [Brand.Type]: "com.atproto.admin.defs#repoRef"; + interface RepoRef extends TypedBase { did: At.DID; } - interface StatusAttr { - [Brand.Type]: "com.atproto.admin.defs#statusAttr"; + interface StatusAttr extends TypedBase { applied: boolean; ref?: string; } - interface ThreatSignature { - [Brand.Type]: "com.atproto.admin.defs#threatSignature"; + interface ThreatSignature extends TypedBase { property: string; value: string; } @@ -2705,8 +2601,8 @@ export declare namespace ComAtprotoAdminDefs { /** Delete a user account as an administrator. */ export declare namespace ComAtprotoAdminDeleteAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; } type Output = undefined; @@ -2714,8 +2610,8 @@ export declare namespace ComAtprotoAdminDeleteAccount { /** Disable an account from receiving new invite codes, but does not invalidate existing codes. */ export declare namespace ComAtprotoAdminDisableAccountInvites { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { account: At.DID; /** Optional reason for disabled invites. */ note?: string; @@ -2725,8 +2621,8 @@ export declare namespace ComAtprotoAdminDisableAccountInvites { /** Disable some set of codes and/or all codes associated with a set of users. */ export declare namespace ComAtprotoAdminDisableInviteCodes { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { accounts?: string[]; codes?: string[]; } @@ -2735,8 +2631,8 @@ export declare namespace ComAtprotoAdminDisableInviteCodes { /** Re-enable an account's ability to receive invite codes. */ export declare namespace ComAtprotoAdminEnableAccountInvites { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { account: At.DID; /** Optional reason for enabled invites. */ note?: string; @@ -2746,7 +2642,7 @@ export declare namespace ComAtprotoAdminEnableAccountInvites { /** Get details about an account. */ export declare namespace ComAtprotoAdminGetAccountInfo { - interface Params { + interface Params extends TypedBase { did: At.DID; } type Input = undefined; @@ -2755,18 +2651,18 @@ export declare namespace ComAtprotoAdminGetAccountInfo { /** Get details about some accounts. */ export declare namespace ComAtprotoAdminGetAccountInfos { - interface Params { + interface Params extends TypedBase { dids: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { infos: ComAtprotoAdminDefs.AccountView[]; } } /** Get an admin view of invite codes. */ export declare namespace ComAtprotoAdminGetInviteCodes { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -2778,7 +2674,7 @@ export declare namespace ComAtprotoAdminGetInviteCodes { sort?: "recent" | "usage" | (string & {}); } type Input = undefined; - interface Output { + interface Output extends TypedBase { codes: ComAtprotoServerDefs.InviteCode[]; cursor?: string; } @@ -2786,14 +2682,14 @@ export declare namespace ComAtprotoAdminGetInviteCodes { /** Get the service-specific admin status of a subject (account, record, or blob). */ export declare namespace ComAtprotoAdminGetSubjectStatus { - interface Params { + interface Params extends TypedBase { blob?: At.CID; did?: At.DID; uri?: At.Uri; } type Input = undefined; - interface Output { - subject: Brand.Union< + interface Output extends TypedBase { + subject: TypeUnion< | ComAtprotoAdminDefs.RepoBlobRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -2805,7 +2701,7 @@ export declare namespace ComAtprotoAdminGetSubjectStatus { /** Get list of accounts that matches your search query. */ export declare namespace ComAtprotoAdminSearchAccounts { - interface Params { + interface Params extends TypedBase { cursor?: string; email?: string; /** @@ -2816,7 +2712,7 @@ export declare namespace ComAtprotoAdminSearchAccounts { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { accounts: ComAtprotoAdminDefs.AccountView[]; cursor?: string; } @@ -2824,8 +2720,8 @@ export declare namespace ComAtprotoAdminSearchAccounts { /** Send email to a user's account email address. */ export declare namespace ComAtprotoAdminSendEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { content: string; recipientDid: At.DID; senderDid: At.DID; @@ -2833,15 +2729,15 @@ export declare namespace ComAtprotoAdminSendEmail { comment?: string; subject?: string; } - interface Output { + interface Output extends TypedBase { sent: boolean; } } /** Administrative action to update an account's email. */ export declare namespace ComAtprotoAdminUpdateAccountEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The handle or DID of the repo. */ account: string; email: string; @@ -2851,8 +2747,8 @@ export declare namespace ComAtprotoAdminUpdateAccountEmail { /** Administrative action to update an account's handle. */ export declare namespace ComAtprotoAdminUpdateAccountHandle { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; handle: At.Handle; } @@ -2861,8 +2757,8 @@ export declare namespace ComAtprotoAdminUpdateAccountHandle { /** Update the password for a user account as an administrator. */ export declare namespace ComAtprotoAdminUpdateAccountPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; password: string; } @@ -2871,9 +2767,9 @@ export declare namespace ComAtprotoAdminUpdateAccountPassword { /** Update the service-specific admin status of a subject (account, record, or blob). */ export declare namespace ComAtprotoAdminUpdateSubjectStatus { - interface Params {} - interface Input { - subject: Brand.Union< + interface Params extends TypedBase {} + interface Input extends TypedBase { + subject: TypeUnion< | ComAtprotoAdminDefs.RepoBlobRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -2881,8 +2777,8 @@ export declare namespace ComAtprotoAdminUpdateSubjectStatus { deactivated?: ComAtprotoAdminDefs.StatusAttr; takedown?: ComAtprotoAdminDefs.StatusAttr; } - interface Output { - subject: Brand.Union< + interface Output extends TypedBase { + subject: TypeUnion< | ComAtprotoAdminDefs.RepoBlobRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -2893,9 +2789,9 @@ export declare namespace ComAtprotoAdminUpdateSubjectStatus { /** Describe the credentials that should be included in the DID doc of an account that is migrating to this service. */ export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { alsoKnownAs?: string[]; /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ rotationKeys?: string[]; @@ -2906,27 +2802,27 @@ export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { /** Request an email with a code to in order to request a signed PLC operation. Requires Auth. */ export declare namespace ComAtprotoIdentityRequestPlcOperationSignature { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Resolves a handle (domain name) to a DID. */ export declare namespace ComAtprotoIdentityResolveHandle { - interface Params { + interface Params extends TypedBase { /** The handle to resolve. */ handle: At.Handle; } type Input = undefined; - interface Output { + interface Output extends TypedBase { did: At.DID; } } /** Signs a PLC operation to update some value(s) in the requesting DID's document. */ export declare namespace ComAtprotoIdentitySignPlcOperation { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { alsoKnownAs?: string[]; rotationKeys?: string[]; services?: unknown; @@ -2934,7 +2830,7 @@ export declare namespace ComAtprotoIdentitySignPlcOperation { token?: string; verificationMethods?: unknown; } - interface Output { + interface Output extends TypedBase { /** A signed DID PLC operation. */ operation: unknown; } @@ -2942,8 +2838,8 @@ export declare namespace ComAtprotoIdentitySignPlcOperation { /** Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry */ export declare namespace ComAtprotoIdentitySubmitPlcOperation { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { operation: unknown; } type Output = undefined; @@ -2951,8 +2847,8 @@ export declare namespace ComAtprotoIdentitySubmitPlcOperation { /** Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. */ export declare namespace ComAtprotoIdentityUpdateHandle { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The new handle. */ handle: At.Handle; } @@ -2961,8 +2857,7 @@ export declare namespace ComAtprotoIdentityUpdateHandle { export declare namespace ComAtprotoLabelDefs { /** Metadata tag on an atproto resource (eg, repo or record). */ - interface Label { - [Brand.Type]: "com.atproto.label.defs#label"; + interface Label extends TypedBase { /** Timestamp when this label was created. */ cts: string; /** DID of the actor who created this label. */ @@ -2999,8 +2894,7 @@ export declare namespace ComAtprotoLabelDefs { | "sexual" | (string & {}); /** Declares a label value and its expected interpretations and behaviors. */ - interface LabelValueDefinition { - [Brand.Type]: "com.atproto.label.defs#labelValueDefinition"; + interface LabelValueDefinition extends TypedBase { /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ blurs: "content" | "media" | "none" | (string & {}); /** @@ -3021,8 +2915,7 @@ export declare namespace ComAtprotoLabelDefs { defaultSetting?: "hide" | "ignore" | "warn" | (string & {}); } /** Strings which describe the label in the UI, localized into a specific language. */ - interface LabelValueDefinitionStrings { - [Brand.Type]: "com.atproto.label.defs#labelValueDefinitionStrings"; + interface LabelValueDefinitionStrings extends TypedBase { /** * A longer description of what the label means and why it might be applied. * Maximum string length: 100000 @@ -3039,8 +2932,7 @@ export declare namespace ComAtprotoLabelDefs { name: string; } /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ - interface SelfLabel { - [Brand.Type]: "com.atproto.label.defs#selfLabel"; + interface SelfLabel extends TypedBase { /** * The short string name of the value or type of this label. * Maximum string length: 128 @@ -3048,8 +2940,7 @@ export declare namespace ComAtprotoLabelDefs { val: string; } /** Metadata tags on an atproto record, published by the author within the record. */ - interface SelfLabels { - [Brand.Type]: "com.atproto.label.defs#selfLabels"; + interface SelfLabels extends TypedBase { /** Maximum array length: 10 */ values: SelfLabel[]; } @@ -3057,7 +2948,7 @@ export declare namespace ComAtprotoLabelDefs { /** Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. */ export declare namespace ComAtprotoLabelQueryLabels { - interface Params { + interface Params extends TypedBase { /** 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. */ uriPatterns: string[]; cursor?: string; @@ -3071,28 +2962,26 @@ export declare namespace ComAtprotoLabelQueryLabels { sources?: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { labels: ComAtprotoLabelDefs.Label[]; cursor?: string; } } export declare namespace ComAtprotoLabelSubscribeLabels { - interface Params { + interface Params extends TypedBase { /** The last known event seq number to backfill from. */ cursor?: number; } - type Message = Brand.Union; - interface Errors { + type Message = TypeUnion; + interface Errors extends TypedBase { FutureCursor: {}; } - interface Info { - [Brand.Type]: "com.atproto.label.subscribeLabels#info"; + interface Info extends TypedBase { name: "OutdatedCursor" | (string & {}); message?: string; } - interface Labels { - [Brand.Type]: "com.atproto.label.subscribeLabels#labels"; + interface Labels extends TypedBase { labels: ComAtprotoLabelDefs.Label[]; seq: number; } @@ -3100,11 +2989,11 @@ export declare namespace ComAtprotoLabelSubscribeLabels { /** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */ export declare namespace ComAtprotoModerationCreateReport { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Indicates the broad category of violation the report is for. */ reasonType: ComAtprotoModerationDefs.ReasonType; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; /** @@ -3114,12 +3003,12 @@ export declare namespace ComAtprotoModerationCreateReport { */ reason?: string; } - interface Output { + interface Output extends TypedBase { createdAt: string; id: number; reasonType: ComAtprotoModerationDefs.ReasonType; reportedBy: At.DID; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; /** @@ -3151,55 +3040,48 @@ export declare namespace ComAtprotoModerationDefs { /** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoApplyWrites { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The handle or DID of the repo (aka, current account). */ repo: string; - writes: Brand.Union[]; + writes: TypeUnion[]; /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */ swapCommit?: At.CID; /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */ validate?: boolean; } - interface Output { + interface Output extends TypedBase { commit?: ComAtprotoRepoDefs.CommitMeta; - results?: Brand.Union[]; + results?: TypeUnion[]; } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } /** Operation which creates a new record. */ - interface Create { - [Brand.Type]: "com.atproto.repo.applyWrites#create"; + interface Create extends TypedBase { collection: string; value: unknown; /** Maximum string length: 512 */ rkey?: string; } - interface CreateResult { - [Brand.Type]: "com.atproto.repo.applyWrites#createResult"; + interface CreateResult extends TypedBase { cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); } /** Operation which deletes an existing record. */ - interface Delete { - [Brand.Type]: "com.atproto.repo.applyWrites#delete"; + interface Delete extends TypedBase { collection: string; rkey: string; } - interface DeleteResult { - [Brand.Type]: "com.atproto.repo.applyWrites#deleteResult"; - } + interface DeleteResult extends TypedBase {} /** Operation which updates an existing record. */ - interface Update { - [Brand.Type]: "com.atproto.repo.applyWrites#update"; + interface Update extends TypedBase { collection: string; rkey: string; value: unknown; } - interface UpdateResult { - [Brand.Type]: "com.atproto.repo.applyWrites#updateResult"; + interface UpdateResult extends TypedBase { cid: At.CID; uri: At.Uri; validationStatus?: "unknown" | "valid" | (string & {}); @@ -3208,8 +3090,8 @@ export declare namespace ComAtprotoRepoApplyWrites { /** Create a single new repository record. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoCreateRecord { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The record itself. Must contain a $type field. */ @@ -3226,20 +3108,19 @@ export declare namespace ComAtprotoRepoCreateRecord { /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ validate?: boolean; } - interface Output { + interface Output extends TypedBase { cid: At.CID; uri: At.Uri; commit?: ComAtprotoRepoDefs.CommitMeta; validationStatus?: "unknown" | "valid" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } } export declare namespace ComAtprotoRepoDefs { - interface CommitMeta { - [Brand.Type]: "com.atproto.repo.defs#commitMeta"; + interface CommitMeta extends TypedBase { cid: At.CID; rev: string; } @@ -3247,8 +3128,8 @@ export declare namespace ComAtprotoRepoDefs { /** Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoDeleteRecord { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The handle or DID of the repo (aka, current account). */ @@ -3260,22 +3141,22 @@ export declare namespace ComAtprotoRepoDeleteRecord { /** Compare and swap with the previous record by CID. */ swapRecord?: At.CID; } - interface Output { + interface Output extends TypedBase { commit?: ComAtprotoRepoDefs.CommitMeta; } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } } /** Get information about an account and repository, including the list of collections. Does not require auth. */ export declare namespace ComAtprotoRepoDescribeRepo { - interface Params { + interface Params extends TypedBase { /** The handle or DID of the repo. */ repo: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { /** List of all the collections (NSIDs) for which this repo contains at least one record. */ collections: string[]; did: At.DID; @@ -3289,7 +3170,7 @@ export declare namespace ComAtprotoRepoDescribeRepo { /** Get a single record from a repository. Does not require auth. */ export declare namespace ComAtprotoRepoGetRecord { - interface Params { + interface Params extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The handle or DID of the repo. */ @@ -3300,26 +3181,26 @@ export declare namespace ComAtprotoRepoGetRecord { cid?: At.CID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { uri: At.Uri; value: unknown; cid?: At.CID; } - interface Errors { + interface Errors extends TypedBase { RecordNotFound: {}; } } /** Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. */ export declare namespace ComAtprotoRepoImportRepo { - interface Params {} + interface Params extends TypedBase {} type Input = Blob | ArrayBufferView; type Output = undefined; } /** Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. */ export declare namespace ComAtprotoRepoListMissingBlobs { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -3329,12 +3210,11 @@ export declare namespace ComAtprotoRepoListMissingBlobs { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { blobs: RecordBlob[]; cursor?: string; } - interface RecordBlob { - [Brand.Type]: "com.atproto.repo.listMissingBlobs#recordBlob"; + interface RecordBlob extends TypedBase { cid: At.CID; recordUri: At.Uri; } @@ -3342,7 +3222,7 @@ export declare namespace ComAtprotoRepoListMissingBlobs { /** List a range of records in a repository, matching a specific collection. Does not require auth. */ export declare namespace ComAtprotoRepoListRecords { - interface Params { + interface Params extends TypedBase { /** The NSID of the record type. */ collection: string; /** The handle or DID of the repo. */ @@ -3369,12 +3249,11 @@ export declare namespace ComAtprotoRepoListRecords { rkeyStart?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { records: Record[]; cursor?: string; } - interface Record { - [Brand.Type]: "com.atproto.repo.listRecords#record"; + interface Record extends TypedBase { cid: At.CID; uri: At.Uri; value: unknown; @@ -3383,8 +3262,8 @@ export declare namespace ComAtprotoRepoListRecords { /** Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoPutRecord { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The NSID of the record collection. */ collection: string; /** The record to write. */ @@ -3403,20 +3282,19 @@ export declare namespace ComAtprotoRepoPutRecord { /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ validate?: boolean; } - interface Output { + interface Output extends TypedBase { cid: At.CID; uri: At.Uri; commit?: ComAtprotoRepoDefs.CommitMeta; validationStatus?: "unknown" | "valid" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { InvalidSwap: {}; } } export declare namespace ComAtprotoRepoStrongRef { - interface Main { - [Brand.Type]: "com.atproto.repo.strongRef"; + interface Main extends TypedBase { cid: At.CID; uri: At.Uri; } @@ -3424,25 +3302,25 @@ export declare namespace ComAtprotoRepoStrongRef { /** Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. */ export declare namespace ComAtprotoRepoUploadBlob { - interface Params {} + interface Params extends TypedBase {} type Input = Blob | ArrayBufferView; - interface Output { + interface Output extends TypedBase { blob: At.Blob; } } /** Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. */ export declare namespace ComAtprotoServerActivateAccount { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. */ export declare namespace ComAtprotoServerCheckAccountStatus { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { activated: boolean; expectedBlobs: number; importedBlobs: number; @@ -3457,13 +3335,13 @@ export declare namespace ComAtprotoServerCheckAccountStatus { /** Confirm an email using a token from com.atproto.server.requestEmailConfirmation. */ export declare namespace ComAtprotoServerConfirmEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { email: string; token: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { AccountNotFound: {}; ExpiredToken: {}; InvalidToken: {}; @@ -3473,8 +3351,8 @@ export declare namespace ComAtprotoServerConfirmEmail { /** Create an account. Implemented by PDS. */ export declare namespace ComAtprotoServerCreateAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Requested handle for the account. */ handle: At.Handle; /** Pre-existing atproto DID, being imported to a new account. */ @@ -3491,7 +3369,7 @@ export declare namespace ComAtprotoServerCreateAccount { verificationPhone?: string; } /** Account login session returned on successful account creation. */ - interface Output { + interface Output extends TypedBase { accessJwt: string; /** The DID of the new account. */ did: At.DID; @@ -3500,7 +3378,7 @@ export declare namespace ComAtprotoServerCreateAccount { /** Complete DID document. */ didDoc?: unknown; } - interface Errors { + interface Errors extends TypedBase { InvalidHandle: {}; InvalidPassword: {}; InvalidInviteCode: {}; @@ -3513,19 +3391,18 @@ export declare namespace ComAtprotoServerCreateAccount { /** Create an App Password. */ export declare namespace ComAtprotoServerCreateAppPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** A short name for the App Password, to help distinguish them. */ name: string; /** If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. */ privileged?: boolean; } type Output = AppPassword; - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; } - interface AppPassword { - [Brand.Type]: "com.atproto.server.createAppPassword#appPassword"; + interface AppPassword extends TypedBase { createdAt: string; name: string; password: string; @@ -3535,30 +3412,29 @@ export declare namespace ComAtprotoServerCreateAppPassword { /** Create an invite code. */ export declare namespace ComAtprotoServerCreateInviteCode { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { useCount: number; forAccount?: At.DID; } - interface Output { + interface Output extends TypedBase { code: string; } } /** Create invite codes. */ export declare namespace ComAtprotoServerCreateInviteCodes { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** \@default 1 */ codeCount: number; useCount: number; forAccounts?: At.DID[]; } - interface Output { + interface Output extends TypedBase { codes: AccountCodes[]; } - interface AccountCodes { - [Brand.Type]: "com.atproto.server.createInviteCodes#accountCodes"; + interface AccountCodes extends TypedBase { account: string; codes: string[]; } @@ -3566,14 +3442,14 @@ export declare namespace ComAtprotoServerCreateInviteCodes { /** Create an authentication session. */ export declare namespace ComAtprotoServerCreateSession { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Handle or other identifier supported by the server for the authenticating user. */ identifier: string; password: string; authFactorToken?: string; } - interface Output { + interface Output extends TypedBase { accessJwt: string; did: At.DID; handle: At.Handle; @@ -3586,7 +3462,7 @@ export declare namespace ComAtprotoServerCreateSession { /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ status?: "deactivated" | "suspended" | "takendown" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; AuthFactorTokenRequired: {}; } @@ -3594,8 +3470,8 @@ export declare namespace ComAtprotoServerCreateSession { /** Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. */ export declare namespace ComAtprotoServerDeactivateAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ deleteAfter?: string; } @@ -3603,8 +3479,7 @@ export declare namespace ComAtprotoServerDeactivateAccount { } export declare namespace ComAtprotoServerDefs { - interface InviteCode { - [Brand.Type]: "com.atproto.server.defs#inviteCode"; + interface InviteCode extends TypedBase { available: number; code: string; createdAt: string; @@ -3613,8 +3488,7 @@ export declare namespace ComAtprotoServerDefs { forAccount: string; uses: InviteCodeUse[]; } - interface InviteCodeUse { - [Brand.Type]: "com.atproto.server.defs#inviteCodeUse"; + interface InviteCodeUse extends TypedBase { usedAt: string; usedBy: At.DID; } @@ -3622,14 +3496,14 @@ export declare namespace ComAtprotoServerDefs { /** Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. */ export declare namespace ComAtprotoServerDeleteAccount { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; password: string; token: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { ExpiredToken: {}; InvalidToken: {}; } @@ -3637,16 +3511,16 @@ export declare namespace ComAtprotoServerDeleteAccount { /** Delete the current session. Requires auth. */ export declare namespace ComAtprotoServerDeleteSession { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Describes the server's account creation requirements and capabilities. Implemented by PDS. */ export declare namespace ComAtprotoServerDescribeServer { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { /** List of domain suffixes that can be used in account handles. */ availableUserDomains: string[]; did: At.DID; @@ -3659,12 +3533,10 @@ export declare namespace ComAtprotoServerDescribeServer { /** If true, a phone verification token must be supplied to create an account on this instance. */ phoneVerificationRequired?: boolean; } - interface Contact { - [Brand.Type]: "com.atproto.server.describeServer#contact"; + interface Contact extends TypedBase { email?: string; } - interface Links { - [Brand.Type]: "com.atproto.server.describeServer#links"; + interface Links extends TypedBase { privacyPolicy?: string; termsOfService?: string; } @@ -3672,7 +3544,7 @@ export declare namespace ComAtprotoServerDescribeServer { /** Get all invite codes for the current account. Requires auth. */ export declare namespace ComAtprotoServerGetAccountInviteCodes { - interface Params { + interface Params extends TypedBase { /** * Controls whether any new 'earned' but not 'created' invites should be created. * \@default true @@ -3682,17 +3554,17 @@ export declare namespace ComAtprotoServerGetAccountInviteCodes { includeUsed?: boolean; } type Input = undefined; - interface Output { + interface Output extends TypedBase { codes: ComAtprotoServerDefs.InviteCode[]; } - interface Errors { + interface Errors extends TypedBase { DuplicateCreate: {}; } } /** Get a signed token on behalf of the requesting DID for the requested service. */ export declare namespace ComAtprotoServerGetServiceAuth { - interface Params { + interface Params extends TypedBase { /** The DID of the service that the token will be used to authenticate with */ aud: At.DID; /** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */ @@ -3701,19 +3573,19 @@ export declare namespace ComAtprotoServerGetServiceAuth { lxm?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { token: string; } - interface Errors { + interface Errors extends TypedBase { BadExpiration: {}; } } /** Get information about the current auth session. Requires auth. */ export declare namespace ComAtprotoServerGetSession { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { did: At.DID; handle: At.Handle; active?: boolean; @@ -3728,16 +3600,15 @@ export declare namespace ComAtprotoServerGetSession { /** List all App Passwords. */ export declare namespace ComAtprotoServerListAppPasswords { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { passwords: AppPassword[]; } - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; } - interface AppPassword { - [Brand.Type]: "com.atproto.server.listAppPasswords#appPassword"; + interface AppPassword extends TypedBase { createdAt: string; name: string; privileged?: boolean; @@ -3746,9 +3617,9 @@ export declare namespace ComAtprotoServerListAppPasswords { /** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */ export declare namespace ComAtprotoServerRefreshSession { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { accessJwt: string; did: At.DID; handle: At.Handle; @@ -3758,38 +3629,38 @@ export declare namespace ComAtprotoServerRefreshSession { /** Hosting status of the account. If not specified, then assume 'active'. */ status?: "deactivated" | "suspended" | "takendown" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { AccountTakedown: {}; } } /** Initiate a user account deletion via email. */ export declare namespace ComAtprotoServerRequestAccountDelete { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Request an email with a code to confirm ownership of email. */ export declare namespace ComAtprotoServerRequestEmailConfirmation { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; type Output = undefined; } /** Request a token in order to update email. */ export declare namespace ComAtprotoServerRequestEmailUpdate { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { tokenRequired: boolean; } } /** Initiate a user account password reset via email. */ export declare namespace ComAtprotoServerRequestPasswordReset { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { email: string; } type Output = undefined; @@ -3797,12 +3668,12 @@ export declare namespace ComAtprotoServerRequestPasswordReset { /** Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. */ export declare namespace ComAtprotoServerReserveSigningKey { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** The DID to reserve a key for. */ did?: At.DID; } - interface Output { + interface Output extends TypedBase { /** The public key for the reserved signing key, in did:key serialization. */ signingKey: string; } @@ -3810,13 +3681,13 @@ export declare namespace ComAtprotoServerReserveSigningKey { /** Reset a user account password using a token. */ export declare namespace ComAtprotoServerResetPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { password: string; token: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { ExpiredToken: {}; InvalidToken: {}; } @@ -3824,8 +3695,8 @@ export declare namespace ComAtprotoServerResetPassword { /** Revoke an App Password by name. */ export declare namespace ComAtprotoServerRevokeAppPassword { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { name: string; } type Output = undefined; @@ -3833,15 +3704,15 @@ export declare namespace ComAtprotoServerRevokeAppPassword { /** Update an account's email. */ export declare namespace ComAtprotoServerUpdateEmail { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { email: string; emailAuthFactor?: boolean; /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */ token?: string; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { ExpiredToken: {}; InvalidToken: {}; TokenRequired: {}; @@ -3850,7 +3721,7 @@ export declare namespace ComAtprotoServerUpdateEmail { /** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncGetBlob { - interface Params { + interface Params extends TypedBase { /** The CID of the blob to fetch */ cid: At.CID; /** The DID of the account. */ @@ -3858,7 +3729,7 @@ export declare namespace ComAtprotoSyncGetBlob { } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { BlobNotFound: {}; RepoNotFound: {}; RepoTakendown: {}; @@ -3869,14 +3740,14 @@ export declare namespace ComAtprotoSyncGetBlob { /** Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncGetBlocks { - interface Params { + interface Params extends TypedBase { cids: At.CID[]; /** The DID of the repo. */ did: At.DID; } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { BlockNotFound: {}; RepoNotFound: {}; RepoTakendown: {}; @@ -3890,7 +3761,7 @@ export declare namespace ComAtprotoSyncGetBlocks { * \@deprecated */ export declare namespace ComAtprotoSyncGetCheckout { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } @@ -3903,31 +3774,31 @@ export declare namespace ComAtprotoSyncGetCheckout { * \@deprecated */ export declare namespace ComAtprotoSyncGetHead { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { root: At.CID; } - interface Errors { + interface Errors extends TypedBase { HeadNotFound: {}; } } /** Get the current commit CID & revision of the specified repo. Does not require auth. */ export declare namespace ComAtprotoSyncGetLatestCommit { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { cid: At.CID; rev: string; } - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; RepoTakendown: {}; RepoSuspended: {}; @@ -3937,7 +3808,7 @@ export declare namespace ComAtprotoSyncGetLatestCommit { /** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */ export declare namespace ComAtprotoSyncGetRecord { - interface Params { + interface Params extends TypedBase { collection: string; /** The DID of the repo. */ did: At.DID; @@ -3951,7 +3822,7 @@ export declare namespace ComAtprotoSyncGetRecord { } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { RecordNotFound: {}; RepoNotFound: {}; RepoTakendown: {}; @@ -3962,7 +3833,7 @@ export declare namespace ComAtprotoSyncGetRecord { /** Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncGetRepo { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; /** The revision ('rev') of the repo to create a diff from. */ @@ -3970,7 +3841,7 @@ export declare namespace ComAtprotoSyncGetRepo { } type Input = undefined; type Output = Uint8Array; - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; RepoTakendown: {}; RepoSuspended: {}; @@ -3980,12 +3851,12 @@ export declare namespace ComAtprotoSyncGetRepo { /** Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. */ export declare namespace ComAtprotoSyncGetRepoStatus { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; } type Input = undefined; - interface Output { + interface Output extends TypedBase { active: boolean; did: At.DID; /** Optional field, the current rev of the repo, if active=true */ @@ -3993,14 +3864,14 @@ export declare namespace ComAtprotoSyncGetRepoStatus { /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ status?: "deactivated" | "suspended" | "takendown" | (string & {}); } - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; } } /** List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. */ export declare namespace ComAtprotoSyncListBlobs { - interface Params { + interface Params extends TypedBase { /** The DID of the repo. */ did: At.DID; cursor?: string; @@ -4014,11 +3885,11 @@ export declare namespace ComAtprotoSyncListBlobs { since?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { cids: At.CID[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; RepoTakendown: {}; RepoSuspended: {}; @@ -4028,7 +3899,7 @@ export declare namespace ComAtprotoSyncListBlobs { /** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */ export declare namespace ComAtprotoSyncListRepos { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -4038,12 +3909,11 @@ export declare namespace ComAtprotoSyncListRepos { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { repos: Repo[]; cursor?: string; } - interface Repo { - [Brand.Type]: "com.atproto.sync.listRepos#repo"; + interface Repo extends TypedBase { did: At.DID; /** Current repo commit CID */ head: At.CID; @@ -4056,8 +3926,8 @@ export declare namespace ComAtprotoSyncListRepos { /** Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. */ export declare namespace ComAtprotoSyncNotifyOfUpdate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Hostname of the current service (usually a PDS) that is notifying of update. */ hostname: string; } @@ -4066,8 +3936,8 @@ export declare namespace ComAtprotoSyncNotifyOfUpdate { /** Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. */ export declare namespace ComAtprotoSyncRequestCrawl { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Hostname of the current service (eg, PDS) that is requesting to be crawled. */ hostname: string; } @@ -4075,20 +3945,19 @@ export declare namespace ComAtprotoSyncRequestCrawl { } export declare namespace ComAtprotoSyncSubscribeRepos { - interface Params { + interface Params extends TypedBase { /** The last known event seq number to backfill from. */ cursor?: number; } - type Message = Brand.Union< + type Message = TypeUnion< Account | Commit | Handle | Identity | Info | Migrate | Tombstone >; - interface Errors { + interface Errors extends TypedBase { FutureCursor: {}; ConsumerTooSlow: {}; } /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ - interface Account { - [Brand.Type]: "com.atproto.sync.subscribeRepos#account"; + interface Account extends TypedBase { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; did: At.DID; @@ -4103,8 +3972,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { | (string & {}); } /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ - interface Commit { - [Brand.Type]: "com.atproto.sync.subscribeRepos#commit"; + interface Commit extends TypedBase { /** List of new blobs (by CID) referenced by records in this commit. */ blobs: At.CIDLink[]; /** CAR file containing relevant blocks, as a diff since the previous repo state. */ @@ -4143,24 +4011,21 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * DEPRECATED -- Use #identity event instead * \@deprecated */ - interface Handle { - [Brand.Type]: "com.atproto.sync.subscribeRepos#handle"; + interface Handle extends TypedBase { did: At.DID; handle: At.Handle; seq: number; time: string; } /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ - interface Identity { - [Brand.Type]: "com.atproto.sync.subscribeRepos#identity"; + interface Identity extends TypedBase { did: At.DID; seq: number; time: string; /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ handle?: At.Handle; } - interface Info { - [Brand.Type]: "com.atproto.sync.subscribeRepos#info"; + interface Info extends TypedBase { name: "OutdatedCursor" | (string & {}); message?: string; } @@ -4168,16 +4033,14 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * DEPRECATED -- Use #account event instead * \@deprecated */ - interface Migrate { - [Brand.Type]: "com.atproto.sync.subscribeRepos#migrate"; + interface Migrate extends TypedBase { did: At.DID; migrateTo: string | null; seq: number; time: string; } /** A repo operation, ie a mutation of a single record. */ - interface RepoOp { - [Brand.Type]: "com.atproto.sync.subscribeRepos#repoOp"; + interface RepoOp extends TypedBase { action: "create" | "delete" | "update" | (string & {}); /** For creates and updates, the new record CID. For deletions, null. */ cid: At.CIDLink | null; @@ -4187,8 +4050,7 @@ export declare namespace ComAtprotoSyncSubscribeRepos { * DEPRECATED -- Use #account event instead * \@deprecated */ - interface Tombstone { - [Brand.Type]: "com.atproto.sync.subscribeRepos#tombstone"; + interface Tombstone extends TypedBase { did: At.DID; seq: number; time: string; @@ -4197,18 +4059,18 @@ export declare namespace ComAtprotoSyncSubscribeRepos { /** Add a handle to the set of reserved handles. */ export declare namespace ComAtprotoTempAddReservedHandle { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { handle: string; } - interface Output {} + interface Output extends TypedBase {} } /** Check accounts location in signup queue. */ export declare namespace ComAtprotoTempCheckSignupQueue { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { activated: boolean; estimatedTimeMs?: number; placeInQueue?: number; @@ -4220,7 +4082,7 @@ export declare namespace ComAtprotoTempCheckSignupQueue { * \@deprecated */ export declare namespace ComAtprotoTempFetchLabels { - interface Params { + interface Params extends TypedBase { /** * Minimum: 1 * Maximum: 250 @@ -4230,15 +4092,15 @@ export declare namespace ComAtprotoTempFetchLabels { since?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { labels: ComAtprotoLabelDefs.Label[]; } } /** Request a verification code to be sent to the supplied phone number */ export declare namespace ComAtprotoTempRequestPhoneVerification { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { phoneNumber: string; } type Output = undefined; @@ -4246,8 +4108,8 @@ export declare namespace ComAtprotoTempRequestPhoneVerification { /** Administrative action to create a new, re-usable communication (email for now) template. */ export declare namespace ToolsOzoneCommunicationCreateTemplate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Content of the template, markdown supported, can contain variable placeholders. */ contentMarkdown: string; /** Name of the template. */ @@ -4260,14 +4122,13 @@ export declare namespace ToolsOzoneCommunicationCreateTemplate { lang?: string; } type Output = ToolsOzoneCommunicationDefs.TemplateView; - interface Errors { + interface Errors extends TypedBase { DuplicateTemplateName: {}; } } export declare namespace ToolsOzoneCommunicationDefs { - interface TemplateView { - [Brand.Type]: "tools.ozone.communication.defs#templateView"; + interface TemplateView extends TypedBase { /** Subject of the message, used in emails. */ contentMarkdown: string; createdAt: string; @@ -4287,8 +4148,8 @@ export declare namespace ToolsOzoneCommunicationDefs { /** Delete a communication template. */ export declare namespace ToolsOzoneCommunicationDeleteTemplate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { id: string; } type Output = undefined; @@ -4296,17 +4157,17 @@ export declare namespace ToolsOzoneCommunicationDeleteTemplate { /** Get list of all communication templates. */ export declare namespace ToolsOzoneCommunicationListTemplates { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { communicationTemplates: ToolsOzoneCommunicationDefs.TemplateView[]; } } /** Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. */ export declare namespace ToolsOzoneCommunicationUpdateTemplate { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** ID of the template to be updated. */ id: string; /** Content of the template, markdown supported, can contain variable placeholders. */ @@ -4322,15 +4183,14 @@ export declare namespace ToolsOzoneCommunicationUpdateTemplate { updatedBy?: At.DID; } type Output = ToolsOzoneCommunicationDefs.TemplateView; - interface Errors { + interface Errors extends TypedBase { DuplicateTemplateName: {}; } } export declare namespace ToolsOzoneModerationDefs { /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface AccountEvent { - [Brand.Type]: "tools.ozone.moderation.defs#accountEvent"; + interface AccountEvent extends TypedBase { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean; timestamp: string; @@ -4344,8 +4204,7 @@ export declare namespace ToolsOzoneModerationDefs { | "unknown" | (string & {}); } - interface AccountHosting { - [Brand.Type]: "tools.ozone.moderation.defs#accountHosting"; + interface AccountHosting extends TypedBase { status: | "deactivated" | "deleted" @@ -4359,56 +4218,47 @@ export declare namespace ToolsOzoneModerationDefs { reactivatedAt?: string; updatedAt?: string; } - interface BlobView { - [Brand.Type]: "tools.ozone.moderation.defs#blobView"; + interface BlobView extends TypedBase { cid: At.CID; createdAt: string; mimeType: string; size: number; - details?: Brand.Union; + details?: TypeUnion; moderation?: Moderation; } /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface IdentityEvent { - [Brand.Type]: "tools.ozone.moderation.defs#identityEvent"; + interface IdentityEvent extends TypedBase { timestamp: string; comment?: string; handle?: At.Handle; pdsHost?: string; tombstone?: boolean; } - interface ImageDetails { - [Brand.Type]: "tools.ozone.moderation.defs#imageDetails"; + interface ImageDetails extends TypedBase { height: number; width: number; } - interface Moderation { - [Brand.Type]: "tools.ozone.moderation.defs#moderation"; + interface Moderation extends TypedBase { subjectStatus?: SubjectStatusView; } - interface ModerationDetail { - [Brand.Type]: "tools.ozone.moderation.defs#moderationDetail"; + interface ModerationDetail extends TypedBase { subjectStatus?: SubjectStatusView; } - interface ModEventAcknowledge { - [Brand.Type]: "tools.ozone.moderation.defs#modEventAcknowledge"; + interface ModEventAcknowledge extends TypedBase { comment?: string; } /** Add a comment to a subject */ - interface ModEventComment { - [Brand.Type]: "tools.ozone.moderation.defs#modEventComment"; + interface ModEventComment extends TypedBase { comment: string; /** Make the comment persistent on the subject */ sticky?: boolean; } /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ - interface ModEventDivert { - [Brand.Type]: "tools.ozone.moderation.defs#modEventDivert"; + interface ModEventDivert extends TypedBase { comment?: string; } /** Keep a log of outgoing email to a user */ - interface ModEventEmail { - [Brand.Type]: "tools.ozone.moderation.defs#modEventEmail"; + interface ModEventEmail extends TypedBase { /** The subject line of the email sent to the user. */ subjectLine: string; /** Additional comment about the outgoing comm. */ @@ -4416,54 +4266,46 @@ export declare namespace ToolsOzoneModerationDefs { /** The content of the email sent to the user. */ content?: string; } - interface ModEventEscalate { - [Brand.Type]: "tools.ozone.moderation.defs#modEventEscalate"; + interface ModEventEscalate extends TypedBase { comment?: string; } /** Apply/Negate labels on a subject */ - interface ModEventLabel { - [Brand.Type]: "tools.ozone.moderation.defs#modEventLabel"; + interface ModEventLabel extends TypedBase { createLabelVals: string[]; negateLabelVals: string[]; comment?: string; } /** Mute incoming reports on a subject */ - interface ModEventMute { - [Brand.Type]: "tools.ozone.moderation.defs#modEventMute"; + interface ModEventMute extends TypedBase { /** Indicates how long the subject should remain muted. */ durationInHours: number; comment?: string; } /** Mute incoming reports from an account */ - interface ModEventMuteReporter { - [Brand.Type]: "tools.ozone.moderation.defs#modEventMuteReporter"; + interface ModEventMuteReporter extends TypedBase { comment?: string; /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ durationInHours?: number; } /** Report a subject */ - interface ModEventReport { - [Brand.Type]: "tools.ozone.moderation.defs#modEventReport"; + interface ModEventReport extends TypedBase { reportType: ComAtprotoModerationDefs.ReasonType; comment?: string; /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ isReporterMuted?: boolean; } /** Resolve appeal on a subject */ - interface ModEventResolveAppeal { - [Brand.Type]: "tools.ozone.moderation.defs#modEventResolveAppeal"; + interface ModEventResolveAppeal extends TypedBase { /** Describe resolution. */ comment?: string; } /** Revert take down action on a subject */ - interface ModEventReverseTakedown { - [Brand.Type]: "tools.ozone.moderation.defs#modEventReverseTakedown"; + interface ModEventReverseTakedown extends TypedBase { /** Describe reasoning behind the reversal. */ comment?: string; } /** Add/Remove a tag on a subject */ - interface ModEventTag { - [Brand.Type]: "tools.ozone.moderation.defs#modEventTag"; + interface ModEventTag extends TypedBase { /** Tags to be added to the subject. If already exists, won't be duplicated. */ add: string[]; /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ @@ -4472,8 +4314,7 @@ export declare namespace ToolsOzoneModerationDefs { comment?: string; } /** Take down a subject permanently or temporarily */ - interface ModEventTakedown { - [Brand.Type]: "tools.ozone.moderation.defs#modEventTakedown"; + interface ModEventTakedown extends TypedBase { /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ acknowledgeAccountSubjects?: boolean; comment?: string; @@ -4481,22 +4322,19 @@ export declare namespace ToolsOzoneModerationDefs { durationInHours?: number; } /** Unmute action on a subject */ - interface ModEventUnmute { - [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmute"; + interface ModEventUnmute extends TypedBase { /** Describe reasoning behind the reversal. */ comment?: string; } /** Unmute incoming reports from an account */ - interface ModEventUnmuteReporter { - [Brand.Type]: "tools.ozone.moderation.defs#modEventUnmuteReporter"; + interface ModEventUnmuteReporter extends TypedBase { /** Describe reasoning behind the reversal. */ comment?: string; } - interface ModEventView { - [Brand.Type]: "tools.ozone.moderation.defs#modEventView"; + interface ModEventView extends TypedBase { createdAt: string; createdBy: At.DID; - event: Brand.Union< + event: TypeUnion< | AccountEvent | IdentityEvent | ModEventAcknowledge @@ -4517,7 +4355,7 @@ export declare namespace ToolsOzoneModerationDefs { | RecordEvent >; id: number; - subject: Brand.Union< + subject: TypeUnion< | ChatBskyConvoDefs.MessageRef | ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main @@ -4526,11 +4364,10 @@ export declare namespace ToolsOzoneModerationDefs { creatorHandle?: string; subjectHandle?: string; } - interface ModEventViewDetail { - [Brand.Type]: "tools.ozone.moderation.defs#modEventViewDetail"; + interface ModEventViewDetail extends TypedBase { createdAt: string; createdBy: At.DID; - event: Brand.Union< + event: TypeUnion< | AccountEvent | IdentityEvent | ModEventAcknowledge @@ -4551,28 +4388,25 @@ export declare namespace ToolsOzoneModerationDefs { | RecordEvent >; id: number; - subject: Brand.Union< + subject: TypeUnion< RecordView | RecordViewNotFound | RepoView | RepoViewNotFound >; subjectBlobs: BlobView[]; } /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface RecordEvent { - [Brand.Type]: "tools.ozone.moderation.defs#recordEvent"; + interface RecordEvent extends TypedBase { op: "create" | "delete" | "update" | (string & {}); timestamp: string; cid?: At.CID; comment?: string; } - interface RecordHosting { - [Brand.Type]: "tools.ozone.moderation.defs#recordHosting"; + interface RecordHosting extends TypedBase { status: "deleted" | "unknown" | (string & {}); createdAt?: string; deletedAt?: string; updatedAt?: string; } - interface RecordView { - [Brand.Type]: "tools.ozone.moderation.defs#recordView"; + interface RecordView extends TypedBase { blobCids: At.CID[]; cid: At.CID; indexedAt: string; @@ -4581,8 +4415,7 @@ export declare namespace ToolsOzoneModerationDefs { uri: At.Uri; value: unknown; } - interface RecordViewDetail { - [Brand.Type]: "tools.ozone.moderation.defs#recordViewDetail"; + interface RecordViewDetail extends TypedBase { blobs: BlobView[]; cid: At.CID; indexedAt: string; @@ -4592,12 +4425,10 @@ export declare namespace ToolsOzoneModerationDefs { value: unknown; labels?: ComAtprotoLabelDefs.Label[]; } - interface RecordViewNotFound { - [Brand.Type]: "tools.ozone.moderation.defs#recordViewNotFound"; + interface RecordViewNotFound extends TypedBase { uri: At.Uri; } - interface RepoView { - [Brand.Type]: "tools.ozone.moderation.defs#repoView"; + interface RepoView extends TypedBase { did: At.DID; handle: At.Handle; indexedAt: string; @@ -4610,8 +4441,7 @@ export declare namespace ToolsOzoneModerationDefs { invitesDisabled?: boolean; threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } - interface RepoViewDetail { - [Brand.Type]: "tools.ozone.moderation.defs#repoViewDetail"; + interface RepoViewDetail extends TypedBase { did: At.DID; handle: At.Handle; indexedAt: string; @@ -4627,8 +4457,7 @@ export declare namespace ToolsOzoneModerationDefs { labels?: ComAtprotoLabelDefs.Label[]; threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; } - interface RepoViewNotFound { - [Brand.Type]: "tools.ozone.moderation.defs#repoViewNotFound"; + interface RepoViewNotFound extends TypedBase { did: At.DID; } type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; @@ -4641,13 +4470,12 @@ export declare namespace ToolsOzoneModerationDefs { | "#reviewNone" | "#reviewOpen" | (string & {}); - interface SubjectStatusView { - [Brand.Type]: "tools.ozone.moderation.defs#subjectStatusView"; + interface SubjectStatusView extends TypedBase { /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ createdAt: string; id: number; reviewState: SubjectReviewState; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; /** Timestamp referencing when the last update was made to the moderation status of the subject */ @@ -4656,7 +4484,7 @@ export declare namespace ToolsOzoneModerationDefs { appealed?: boolean; /** Sticky comment on the subject. */ comment?: string; - hosting?: Brand.Union; + hosting?: TypeUnion; /** Timestamp referencing when the author of the subject appealed a moderation action */ lastAppealedAt?: string; lastReportedAt?: string; @@ -4670,8 +4498,7 @@ export declare namespace ToolsOzoneModerationDefs { tags?: string[]; takendown?: boolean; } - interface VideoDetails { - [Brand.Type]: "tools.ozone.moderation.defs#videoDetails"; + interface VideoDetails extends TypedBase { height: number; length: number; width: number; @@ -4680,10 +4507,10 @@ export declare namespace ToolsOzoneModerationDefs { /** Take a moderation action on an actor. */ export declare namespace ToolsOzoneModerationEmitEvent { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { createdBy: At.DID; - event: Brand.Union< + event: TypeUnion< | ToolsOzoneModerationDefs.AccountEvent | ToolsOzoneModerationDefs.IdentityEvent | ToolsOzoneModerationDefs.ModEventAcknowledge @@ -4702,20 +4529,20 @@ export declare namespace ToolsOzoneModerationEmitEvent { | ToolsOzoneModerationDefs.ModEventUnmuteReporter | ToolsOzoneModerationDefs.RecordEvent >; - subject: Brand.Union< + subject: TypeUnion< ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main >; subjectBlobCids?: At.CID[]; } type Output = ToolsOzoneModerationDefs.ModEventView; - interface Errors { + interface Errors extends TypedBase { SubjectHasAction: {}; } } /** Get details about a moderation event. */ export declare namespace ToolsOzoneModerationGetEvent { - interface Params { + interface Params extends TypedBase { id: number; } type Input = undefined; @@ -4724,26 +4551,26 @@ export declare namespace ToolsOzoneModerationGetEvent { /** Get details about a record. */ export declare namespace ToolsOzoneModerationGetRecord { - interface Params { + interface Params extends TypedBase { uri: At.Uri; cid?: At.CID; } type Input = undefined; type Output = ToolsOzoneModerationDefs.RecordViewDetail; - interface Errors { + interface Errors extends TypedBase { RecordNotFound: {}; } } /** Get details about some records. */ export declare namespace ToolsOzoneModerationGetRecords { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 100 */ uris: At.Uri[]; } type Input = undefined; - interface Output { - records: Brand.Union< + interface Output extends TypedBase { + records: TypeUnion< | ToolsOzoneModerationDefs.RecordViewDetail | ToolsOzoneModerationDefs.RecordViewNotFound >[]; @@ -4752,25 +4579,25 @@ export declare namespace ToolsOzoneModerationGetRecords { /** Get details about a repository. */ export declare namespace ToolsOzoneModerationGetRepo { - interface Params { + interface Params extends TypedBase { did: At.DID; } type Input = undefined; type Output = ToolsOzoneModerationDefs.RepoViewDetail; - interface Errors { + interface Errors extends TypedBase { RepoNotFound: {}; } } /** Get details about some repositories. */ export declare namespace ToolsOzoneModerationGetRepos { - interface Params { + interface Params extends TypedBase { /** Maximum array length: 100 */ dids: At.DID[]; } type Input = undefined; - interface Output { - repos: Brand.Union< + interface Output extends TypedBase { + repos: TypeUnion< | ToolsOzoneModerationDefs.RepoViewDetail | ToolsOzoneModerationDefs.RepoViewNotFound >[]; @@ -4779,7 +4606,7 @@ export declare namespace ToolsOzoneModerationGetRepos { /** List moderation events related to a subject. */ export declare namespace ToolsOzoneModerationQueryEvents { - interface Params { + interface Params extends TypedBase { /** If specified, only events where all of these labels were added are returned */ addedLabels?: string[]; /** If specified, only events where all of these tags were added are returned */ @@ -4827,7 +4654,7 @@ export declare namespace ToolsOzoneModerationQueryEvents { types?: string[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { events: ToolsOzoneModerationDefs.ModEventView[]; cursor?: string; } @@ -4835,7 +4662,7 @@ export declare namespace ToolsOzoneModerationQueryEvents { /** View moderation statuses of subjects (record or repo). */ export declare namespace ToolsOzoneModerationQueryStatuses { - interface Params { + interface Params extends TypedBase { /** Get subjects in unresolved appealed status */ appealed?: boolean; /** @@ -4895,7 +4722,7 @@ export declare namespace ToolsOzoneModerationQueryStatuses { takendown?: boolean; } type Input = undefined; - interface Output { + interface Output extends TypedBase { subjectStatuses: ToolsOzoneModerationDefs.SubjectStatusView[]; cursor?: string; } @@ -4903,7 +4730,7 @@ export declare namespace ToolsOzoneModerationQueryStatuses { /** Find repositories based on a search term. */ export declare namespace ToolsOzoneModerationSearchRepos { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -4919,7 +4746,7 @@ export declare namespace ToolsOzoneModerationSearchRepos { term?: string; } type Input = undefined; - interface Output { + interface Output extends TypedBase { repos: ToolsOzoneModerationDefs.RepoView[]; cursor?: string; } @@ -4927,21 +4754,19 @@ export declare namespace ToolsOzoneModerationSearchRepos { /** Get details about ozone's server configuration. */ export declare namespace ToolsOzoneServerGetConfig { - interface Params {} + interface Params extends TypedBase {} type Input = undefined; - interface Output { + interface Output extends TypedBase { appview?: ServiceConfig; blobDivert?: ServiceConfig; chat?: ServiceConfig; pds?: ServiceConfig; viewer?: ViewerConfig; } - interface ServiceConfig { - [Brand.Type]: "tools.ozone.server.getConfig#serviceConfig"; + interface ServiceConfig extends TypedBase { url?: string; } - interface ViewerConfig { - [Brand.Type]: "tools.ozone.server.getConfig#viewerConfig"; + interface ViewerConfig extends TypedBase { role?: | "tools.ozone.team.defs#roleAdmin" | "tools.ozone.team.defs#roleModerator" @@ -4952,8 +4777,8 @@ export declare namespace ToolsOzoneServerGetConfig { /** Add values to a specific set. Attempting to add values to a set that does not exist will result in an error. */ export declare namespace ToolsOzoneSetAddValues { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Name of the set to add values to */ name: string; /** @@ -4967,8 +4792,7 @@ export declare namespace ToolsOzoneSetAddValues { } export declare namespace ToolsOzoneSetDefs { - interface Set { - [Brand.Type]: "tools.ozone.set.defs#set"; + interface Set extends TypedBase { /** * Minimum string length: 3 * Maximum string length: 128 @@ -4980,8 +4804,7 @@ export declare namespace ToolsOzoneSetDefs { */ description?: string; } - interface SetView { - [Brand.Type]: "tools.ozone.set.defs#setView"; + interface SetView extends TypedBase { createdAt: string; /** * Minimum string length: 3 @@ -5000,21 +4823,21 @@ export declare namespace ToolsOzoneSetDefs { /** Delete an entire set. Attempting to delete a set that does not exist will result in an error. */ export declare namespace ToolsOzoneSetDeleteSet { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Name of the set to delete */ name: string; } - interface Output {} - interface Errors { + interface Output extends TypedBase {} + interface Errors extends TypedBase { SetNotFound: {}; } } /** Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error */ export declare namespace ToolsOzoneSetDeleteValues { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** Name of the set to delete values from */ name: string; /** @@ -5024,14 +4847,14 @@ export declare namespace ToolsOzoneSetDeleteValues { values: string[]; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { SetNotFound: {}; } } /** Get a specific set and its values */ export declare namespace ToolsOzoneSetGetValues { - interface Params { + interface Params extends TypedBase { name: string; cursor?: string; /** @@ -5042,19 +4865,19 @@ export declare namespace ToolsOzoneSetGetValues { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { set: ToolsOzoneSetDefs.SetView; values: string[]; cursor?: string; } - interface Errors { + interface Errors extends TypedBase { SetNotFound: {}; } } /** Query available sets */ export declare namespace ToolsOzoneSetQuerySets { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -5072,7 +4895,7 @@ export declare namespace ToolsOzoneSetQuerySets { sortDirection?: "asc" | "desc"; } type Input = undefined; - interface Output { + interface Output extends TypedBase { sets: ToolsOzoneSetDefs.SetView[]; cursor?: string; } @@ -5080,14 +4903,13 @@ export declare namespace ToolsOzoneSetQuerySets { /** Create or update set metadata */ export declare namespace ToolsOzoneSetUpsertSet { - interface Params {} + interface Params extends TypedBase {} type Input = ToolsOzoneSetDefs.Set; type Output = ToolsOzoneSetDefs.SetView; } export declare namespace ToolsOzoneSettingDefs { - interface Option { - [Brand.Type]: "tools.ozone.setting.defs#option"; + interface Option extends TypedBase { createdBy: At.DID; did: At.DID; key: string; @@ -5111,7 +4933,7 @@ export declare namespace ToolsOzoneSettingDefs { /** List settings with optional filtering */ export declare namespace ToolsOzoneSettingListOptions { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Filter for only the specified keys. Ignored if prefix is provided @@ -5130,7 +4952,7 @@ export declare namespace ToolsOzoneSettingListOptions { scope?: "instance" | "personal" | (string & {}); } type Input = undefined; - interface Output { + interface Output extends TypedBase { options: ToolsOzoneSettingDefs.Option[]; cursor?: string; } @@ -5138,8 +4960,8 @@ export declare namespace ToolsOzoneSettingListOptions { /** Delete settings by key */ export declare namespace ToolsOzoneSettingRemoveOptions { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { /** * Minimum array length: 1 * Maximum array length: 200 @@ -5147,13 +4969,13 @@ export declare namespace ToolsOzoneSettingRemoveOptions { keys: string[]; scope: "instance" | "personal" | (string & {}); } - interface Output {} + interface Output extends TypedBase {} } /** Create or update setting option */ export declare namespace ToolsOzoneSettingUpsertOption { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { key: string; scope: "instance" | "personal" | (string & {}); value: unknown; @@ -5165,14 +4987,13 @@ export declare namespace ToolsOzoneSettingUpsertOption { | "tools.ozone.team.defs#roleTriage" | (string & {}); } - interface Output { + interface Output extends TypedBase { option: ToolsOzoneSettingDefs.Option; } } export declare namespace ToolsOzoneSignatureDefs { - interface SigDetail { - [Brand.Type]: "tools.ozone.signature.defs#sigDetail"; + interface SigDetail extends TypedBase { property: string; value: string; } @@ -5180,18 +5001,18 @@ export declare namespace ToolsOzoneSignatureDefs { /** Find all correlated threat signatures between 2 or more accounts. */ export declare namespace ToolsOzoneSignatureFindCorrelation { - interface Params { + interface Params extends TypedBase { dids: At.DID[]; } type Input = undefined; - interface Output { + interface Output extends TypedBase { details: ToolsOzoneSignatureDefs.SigDetail[]; } } /** Get accounts that share some matching threat signatures with the root account. */ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { - interface Params { + interface Params extends TypedBase { did: At.DID; cursor?: string; /** @@ -5202,12 +5023,11 @@ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { accounts: RelatedAccount[]; cursor?: string; } - interface RelatedAccount { - [Brand.Type]: "tools.ozone.signature.findRelatedAccounts#relatedAccount"; + interface RelatedAccount extends TypedBase { account: ComAtprotoAdminDefs.AccountView; similarities?: ToolsOzoneSignatureDefs.SigDetail[]; } @@ -5215,7 +5035,7 @@ export declare namespace ToolsOzoneSignatureFindRelatedAccounts { /** Search for accounts that match one or more threat signature values. */ export declare namespace ToolsOzoneSignatureSearchAccounts { - interface Params { + interface Params extends TypedBase { values: string[]; cursor?: string; /** @@ -5226,7 +5046,7 @@ export declare namespace ToolsOzoneSignatureSearchAccounts { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { accounts: ComAtprotoAdminDefs.AccountView[]; cursor?: string; } @@ -5234,8 +5054,8 @@ export declare namespace ToolsOzoneSignatureSearchAccounts { /** Add a member to the ozone team. Requires admin role. */ export declare namespace ToolsOzoneTeamAddMember { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; role: | "tools.ozone.team.defs#roleAdmin" @@ -5244,14 +5064,13 @@ export declare namespace ToolsOzoneTeamAddMember { | (string & {}); } type Output = ToolsOzoneTeamDefs.Member; - interface Errors { + interface Errors extends TypedBase { MemberAlreadyExists: {}; } } export declare namespace ToolsOzoneTeamDefs { - interface Member { - [Brand.Type]: "tools.ozone.team.defs#member"; + interface Member extends TypedBase { did: At.DID; role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); createdAt?: string; @@ -5267,12 +5086,12 @@ export declare namespace ToolsOzoneTeamDefs { /** Delete a member from ozone team. Requires admin role. */ export declare namespace ToolsOzoneTeamDeleteMember { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; } type Output = undefined; - interface Errors { + interface Errors extends TypedBase { MemberNotFound: {}; CannotDeleteSelf: {}; } @@ -5280,7 +5099,7 @@ export declare namespace ToolsOzoneTeamDeleteMember { /** List all members with access to the ozone service. */ export declare namespace ToolsOzoneTeamListMembers { - interface Params { + interface Params extends TypedBase { cursor?: string; /** * Minimum: 1 @@ -5290,7 +5109,7 @@ export declare namespace ToolsOzoneTeamListMembers { limit?: number; } type Input = undefined; - interface Output { + interface Output extends TypedBase { members: ToolsOzoneTeamDefs.Member[]; cursor?: string; } @@ -5298,8 +5117,8 @@ export declare namespace ToolsOzoneTeamListMembers { /** Update a member in the ozone service. Requires admin role. */ export declare namespace ToolsOzoneTeamUpdateMember { - interface Params {} - interface Input { + interface Params extends TypedBase {} + interface Input extends TypedBase { did: At.DID; disabled?: boolean; role?: @@ -5309,12 +5128,12 @@ export declare namespace ToolsOzoneTeamUpdateMember { | (string & {}); } type Output = ToolsOzoneTeamDefs.Member; - interface Errors { + interface Errors extends TypedBase { MemberNotFound: {}; } } -export declare interface Records { +export declare interface Records extends RecordBase { "app.bsky.actor.profile": AppBskyActorProfile.Record; "app.bsky.feed.generator": AppBskyFeedGenerator.Record; "app.bsky.feed.like": AppBskyFeedLike.Record; From 17b41b0ebe8b2a13ec3cf481a1bdb70d6069d278 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Tue, 3 Dec 2024 20:52:20 -0500 Subject: [PATCH 64/68] adding metadata to output lexicons file for ci --- packages/lex-cli/src/generator/index.ts | 41 +++++++++++++++++---- packages/lex-cli/src/index.ts | 6 +++ packages/lexicons/scripts/generate-types.ts | 12 +++++- packages/lexicons/src/lib/lexicons.ts | 4 ++ 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index d470c98..5c8b1e2 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -8,28 +8,53 @@ export interface GenerateDefinitionsOptions { banner?: string; description?: string; debug?: boolean; + lexiconMetadata?: { + commitSha?: string; + version?: string; + sourceUrl?: string; + }; onProgress?: (filename: string, index: number, total: number) => void; } export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, banner, description } = opts; + const { files, banner, description, lexiconMetadata } = opts; let queries = ''; let procedures = ''; let records = ''; let subscriptions = ''; + const buildDate = new Date().toISOString(); + const metadataLines = [ + '/**', + ' * @module', + description ? ` * ${description}` : ' * ATProto lexicon type definitions', + ' * @generated', + ` * Generated on: ${buildDate}`, + ]; + + if (lexiconMetadata?.version) { + metadataLines.push(` * Version: ${lexiconMetadata.version}`); + } + if (lexiconMetadata?.commitSha) { + metadataLines.push(` * Commit: ${lexiconMetadata.commitSha}`); + } + if (lexiconMetadata?.sourceUrl) { + metadataLines.push(` * Source: ${lexiconMetadata.sourceUrl}`); + } + + metadataLines.push(' */'); + let code = `/* eslint-disable */ -// This file is automatically generated by @tsky/lex-cli, do not edit!`; +// This file is automatically generated by @tsky/lex-cli, do not edit! + +${metadataLines.join('\n')}`; - if (description) { - code += `\n\n/** - * @module - * ${description} - */`; + if (banner) { + code += `\n\n${banner}`; } - code += `\n\n${banner ?? ''}\n${mainPrelude}`; + code += `\n\n${mainPrelude}`; for await (const filename of files.sort(sortName)) { let document: DocumentSchema; diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index d38c79d..02c5caa 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -46,6 +46,11 @@ cli.register( description: 'Custom banner text to insert at the top of the generated file', }); + metadata = Option.String('--metadata', { + required: false, + description: 'JSON metadata to add to the generated file header', + }); + files = Option.Rest({ required: 1, name: 'files', @@ -59,6 +64,7 @@ cli.register( files: this.files, banner: this.banner, description: this.desc, + lexiconMetadata: this.metadata ? JSON.parse(this.metadata) : undefined, }); } catch (err) { diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index e970581..e3c5a3e 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -26,6 +26,8 @@ async function downloadLexicons() { const commits = await shaResponse.json(); const sha = commits[0]?.sha; + const version = commits[0]?.commit?.message?.match(/Release v([\d.]+)/)?.[1] || 'main'; + if (!sha) { throw new Error('No commits found for lexicons'); } @@ -49,6 +51,12 @@ async function downloadLexicons() { }); await fs.unlink(tarFile); + + return { + sha, + version, + sourceUrl: `https://github.com/${REPO}/tree/${sha}/lexicons`, + }; } async function main() { @@ -56,7 +64,7 @@ async function main() { await fs.mkdir(LEXICONS_DIR, { recursive: true }); await fs.mkdir(path.dirname(TYPES_OUTPUT_PATH), { recursive: true }); - await downloadLexicons(); + const metadata = await downloadLexicons(); const globPatterns = [ 'app/bsky/**/*.json', @@ -89,6 +97,8 @@ async function main() { TYPES_OUTPUT_PATH, '--description', '"Contains type declarations for Bluesky lexicons"', + '--metadata', + JSON.stringify(JSON.stringify(metadata)), ].join(' '); console.log('Running lex-cli to generate types...'); diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index 36a5616..aec0716 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -4,6 +4,10 @@ /** * @module * Contains type declarations for Bluesky lexicons + * @generated + * Generated on: 2024-12-04T01:51:07.265Z + * Version: main + * Source: https://github.com/bluesky-social/atproto/tree/c72145dbeb2d67068bc28c00a13447e0d382d121/lexicons */ /** Base type with optional type field */ From c74d3e51d93bc0f902b8ae6ab7d636a80d9c5365 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Wed, 4 Dec 2024 08:32:50 -0500 Subject: [PATCH 65/68] lockfile update --- pnpm-lock.yaml | 270 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 237 insertions(+), 33 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bbebdbd..c4fb7a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,24 +43,39 @@ importers: specifier: ^2.1.6 version: 2.1.6(@types/node@22.10.1) + packages/lex-cli: + dependencies: + clipanion: + specifier: 4.0.0-rc.4 + version: 4.0.0-rc.4(typanion@3.14.0) + picocolors: + specifier: ^1.1.1 + version: 1.1.1 + prettier: + specifier: ^3.3.3 + version: 3.4.2 + typanion: + specifier: ^3.14.0 + version: 3.14.0 + devDependencies: + '@types/node': + specifier: ^22.8.1 + version: 22.10.1 + typescript: + specifier: ^5.7.2 + version: 5.7.2 + packages/lexicons: - dependencies: - '@atproto/lexicon': - specifier: ^0.4.3 - version: 0.4.3 - '@atproto/xrpc': - specifier: ^0.6.4 - version: 0.6.4 - multiformats: - specifier: ^13.3.1 - version: 13.3.1 devDependencies: - '@atproto/lex-cli': - specifier: ^0.5.2 - version: 0.5.2 + '@tsky/lex-cli': + specifier: workspace:* + version: link:../lex-cli '@types/node': specifier: ^22.10.1 version: 22.10.1 + fast-glob: + specifier: ^3.3.2 + version: 3.3.2 tar: specifier: ^7.4.3 version: 7.4.3 @@ -151,10 +166,6 @@ packages: '@atproto/common-web@0.3.1': resolution: {integrity: sha512-N7wiTnus5vAr+lT//0y8m/FaHHLJ9LpGuEwkwDAeV3LCiPif4m/FS8x/QOYrx1PdZQwKso95RAPzCGWQBH5j6Q==} - '@atproto/lex-cli@0.5.2': - resolution: {integrity: sha512-fM/FR/FpOMUOpwir7odZNiJhY3at0gMDGZpkLJeWFDaYyChtwqCGd6x7J4S6w/mqtCDcx1bzGTrnsLkJjtuNfg==} - hasBin: true - '@atproto/lexicon@0.4.3': resolution: {integrity: sha512-lFVZXe1S1pJP0dcxvJuHP3r/a+EAIBwwU7jUK+r8iLhIja+ml6NmYv8KeFHmIJATh03spEQ9s02duDmFVdCoXg==} @@ -556,6 +567,18 @@ packages: '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -749,6 +772,9 @@ packages: '@types/mdurl@2.0.0': resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==} + '@types/node@22.10.1': + resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} + '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -921,6 +947,10 @@ packages: brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -942,6 +972,15 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} + chownr@3.0.0: + resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} + engines: {node: '>=18'} + + clipanion@4.0.0-rc.4: + resolution: {integrity: sha512-CXkMQxU6s9GklO/1f714dkKBMu1lopS1WFF0B8o4AxPykR1hpozxSiUZ5ZUeBjfPgCWqbcNOtZVFhB8Lkfp1+Q==} + peerDependencies: + typanion: '*' + color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -1029,6 +1068,17 @@ packages: resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} engines: {node: '>=12.0.0'} + fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + + fastq@1.17.1: + resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + focus-trap@7.6.2: resolution: {integrity: sha512-9FhUxK1hVju2+AiQIDJ5Dd//9R2n2RAfJ0qfhF4IHGHgcoEUTMpbTeG/zbEuwaiYXfuAH6XE0/aCyxDdRM+W5w==} @@ -1047,6 +1097,10 @@ packages: get-tsconfig@4.8.1: resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true @@ -1078,13 +1132,25 @@ packages: resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} engines: {node: '>= 0.4'} + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + is-fullwidth-code-point@3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + is-module@1.0.0: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + is-reference@1.2.1: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} @@ -1116,6 +1182,10 @@ packages: mdast-util-to-hast@13.2.0: resolution: {integrity: sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==} + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + micromark-util-character@2.1.1: resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} @@ -1131,6 +1201,10 @@ packages: micromark-util-types@2.0.1: resolution: {integrity: sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==} + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -1149,12 +1223,14 @@ packages: mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} + mkdirp@3.0.1: + resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} + engines: {node: '>=10'} + hasBin: true + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - multiformats@13.3.1: - resolution: {integrity: sha512-QxowxTNwJ3r5RMctoGA5p13w5RbRT2QDkoM+yFlqfLiioBp78nhDjnRLvmSBI9+KAqN4VdgOVWM9c0CHd86m3g==} - multiformats@9.9.0: resolution: {integrity: sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==} @@ -1198,6 +1274,10 @@ packages: picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + picomatch@4.0.2: resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} engines: {node: '>=12'} @@ -1219,9 +1299,17 @@ packages: preact@10.25.0: resolution: {integrity: sha512-6bYnzlLxXV3OSpUxLdaxBmE7PMOu0aR3pG6lryK/0jmvcDFPlcXGQAt5DpK3RITWiDrfYZRI0druyaK/S9kYLg==} + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} + engines: {node: '>=14'} + hasBin: true + property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + regex-recursion@4.3.0: resolution: {integrity: sha512-5LcLnizwjcQ2ALfOj95MjcatxyqF5RPySx9yT+PaXu3Gox2vyAtLDjHB8NTJLtMGkvyau6nI3CfpwFCjPUIs/A==} @@ -1238,14 +1326,25 @@ packages: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true + reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} + rimraf@5.0.10: + resolution: {integrity: sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==} + hasBin: true + rollup@4.27.4: resolution: {integrity: sha512-RLKxqHEMjh/RGLsDxAEsaLO3mWgyoU6x9w6n1ikAzet4B3gI2/3yP6PWY2p9QzRTh6MfEIXB3MwsOY0Iv3vNrw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + search-insights@2.17.3: resolution: {integrity: sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==} @@ -1314,6 +1413,10 @@ packages: tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} + tar@7.4.3: + resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} + engines: {node: '>=18'} + tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} @@ -1336,6 +1439,10 @@ packages: resolution: {integrity: sha512-tcwMRIioTcF/FcxLev8MJWxCp+GUALRhFEqbDoZrnowmKSGqPrl5pqS+Sut2m8BgJ6S4FExCSSpGffZ0Tks6Aw==} hasBin: true + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -1344,6 +1451,9 @@ packages: engines: {node: '>=18.0.0'} hasBin: true + typanion@3.14.0: + resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} + typescript@5.7.2: resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} @@ -1352,6 +1462,9 @@ packages: uint8arrays@3.0.0: resolution: {integrity: sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==} + undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + unist-util-is@6.0.0: resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} @@ -1483,6 +1596,10 @@ packages: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} + yallist@5.0.0: + resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} + engines: {node: '>=18'} + zod@3.23.8: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} @@ -1614,17 +1731,6 @@ snapshots: uint8arrays: 3.0.0 zod: 3.23.8 - '@atproto/lex-cli@0.5.2': - dependencies: - '@atproto/lexicon': 0.4.3 - '@atproto/syntax': 0.3.1 - chalk: 4.1.2 - commander: 9.5.0 - prettier: 3.4.1 - ts-morph: 16.0.0 - yesno: 0.4.0 - zod: 3.23.8 - '@atproto/lexicon@0.4.3': dependencies: '@atproto/common-web': 0.3.1 @@ -1868,8 +1974,24 @@ snapshots: wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 + '@isaacs/fs-minipass@4.0.1': + dependencies: + minipass: 7.1.2 + '@jridgewell/sourcemap-codec@1.5.0': {} + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.17.1 + '@pkgjs/parseargs@0.11.0': optional: true @@ -2031,6 +2153,10 @@ snapshots: '@types/mdurl@2.0.0': {} + '@types/node@22.10.1': + dependencies: + undici-types: 6.20.0 + '@types/resolve@1.20.2': {} '@types/unist@3.0.3': {} @@ -2224,6 +2350,10 @@ snapshots: dependencies: balanced-match: 1.0.2 + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + cac@6.7.14: {} ccount@2.0.1: {} @@ -2244,6 +2374,10 @@ snapshots: chownr@3.0.0: {} + clipanion@4.0.0-rc.4(typanion@3.14.0): + dependencies: + typanion: 3.14.0 + color-convert@2.0.1: dependencies: color-name: 1.1.4 @@ -2353,6 +2487,22 @@ snapshots: expect-type@1.1.0: {} + fast-glob@3.3.2: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fastq@1.17.1: + dependencies: + reusify: 1.0.4 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + focus-trap@7.6.2: dependencies: tabbable: 6.2.0 @@ -2371,6 +2521,10 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + glob@10.4.5: dependencies: foreground-child: 3.3.0 @@ -2414,10 +2568,18 @@ snapshots: dependencies: hasown: 2.0.2 + is-extglob@2.1.1: {} + is-fullwidth-code-point@3.0.0: {} + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + is-module@1.0.0: {} + is-number@7.0.0: {} + is-reference@1.2.1: dependencies: '@types/estree': 1.0.6 @@ -2456,6 +2618,8 @@ snapshots: unist-util-visit: 5.0.0 vfile: 6.0.3 + merge2@1.4.1: {} + micromark-util-character@2.1.1: dependencies: micromark-util-symbol: 2.0.1 @@ -2473,6 +2637,11 @@ snapshots: micromark-util-types@2.0.1: {} + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -2488,9 +2657,9 @@ snapshots: mitt@3.0.1: {} - ms@2.1.3: {} + mkdirp@3.0.1: {} - multiformats@13.3.1: {} + ms@2.1.3: {} multiformats@9.9.0: {} @@ -2525,6 +2694,8 @@ snapshots: picocolors@1.1.1: {} + picomatch@2.3.1: {} + picomatch@4.0.2: {} pkgroll@2.5.1(typescript@5.7.2): @@ -2550,8 +2721,12 @@ snapshots: preact@10.25.0: {} + prettier@3.4.2: {} + property-information@6.5.0: {} + queue-microtask@1.2.3: {} + regex-recursion@4.3.0: dependencies: regex-utilities: 2.3.0 @@ -2570,8 +2745,14 @@ snapshots: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 + reusify@1.0.4: {} + rfdc@1.4.1: {} + rimraf@5.0.10: + dependencies: + glob: 10.4.5 + rollup@4.27.4: dependencies: '@types/estree': 1.0.6 @@ -2596,6 +2777,10 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.27.4 fsevents: 2.3.3 + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + search-insights@2.17.3: {} shebang-command@2.0.0: @@ -2660,6 +2845,15 @@ snapshots: tabbable@6.2.0: {} + tar@7.4.3: + dependencies: + '@isaacs/fs-minipass': 4.0.1 + chownr: 3.0.0 + minipass: 7.1.2 + minizlib: 3.0.1 + mkdirp: 3.0.1 + yallist: 5.0.0 + tinybench@2.9.0: {} tinyexec@0.3.1: {} @@ -2672,6 +2866,10 @@ snapshots: tlds@1.255.0: {} + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + trim-lines@3.0.1: {} tsx@4.19.2: @@ -2681,12 +2879,16 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + typanion@3.14.0: {} + typescript@5.7.2: {} uint8arrays@3.0.0: dependencies: multiformats: 9.9.0 + undici-types@6.20.0: {} + unist-util-is@6.0.0: dependencies: '@types/unist': 3.0.3 @@ -2867,6 +3069,8 @@ snapshots: string-width: 5.1.2 strip-ansi: 7.1.0 + yallist@5.0.0: {} + zod@3.23.8: {} zwitch@2.0.4: {} From ae4c4198b52458e3349448eaf7f82136363a31d9 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Wed, 4 Dec 2024 08:34:21 -0500 Subject: [PATCH 66/68] linting --- packages/lex-cli/src/generator/index.ts | 658 +- .../src/generator/resolvers/complex.ts | 8 +- .../lex-cli/src/generator/resolvers/index.ts | 14 +- .../lex-cli/src/generator/resolvers/type.ts | 6 +- packages/lex-cli/src/generator/schema.ts | 24 +- packages/lex-cli/src/index.ts | 32 +- packages/lex-cli/src/utils/cache.ts | 5 +- packages/lex-cli/src/utils/docs.ts | 4 +- packages/lex-cli/src/utils/index.ts | 10 +- packages/lexicons/index.ts | 2 +- packages/lexicons/scripts/generate-types.ts | 8 +- packages/lexicons/src/index.ts | 39 +- packages/lexicons/src/lib/lexicons.ts | 11672 ++++++++-------- 13 files changed, 6253 insertions(+), 6229 deletions(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 5c8b1e2..1355381 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -1,335 +1,323 @@ -import { readFile } from 'node:fs/promises'; -import { toNamespace, getDescriptions, writeJsdoc, mainPrelude, sortDefinition, sortName, sortPropertyKeys } from '../utils/index.js'; -import { resolveType } from './resolvers/index.js'; -import { type DocumentSchema, documentSchema } from './schema.js'; - -export interface GenerateDefinitionsOptions { - files: string[]; - banner?: string; - description?: string; - debug?: boolean; - lexiconMetadata?: { - commitSha?: string; - version?: string; - sourceUrl?: string; - }; - onProgress?: (filename: string, index: number, total: number) => void; -} - -export async function generateDefinitions(opts: GenerateDefinitionsOptions) { - const { files, banner, description, lexiconMetadata } = opts; - - let queries = ''; - let procedures = ''; - let records = ''; - let subscriptions = ''; - - const buildDate = new Date().toISOString(); - const metadataLines = [ - '/**', - ' * @module', - description ? ` * ${description}` : ' * ATProto lexicon type definitions', - ' * @generated', - ` * Generated on: ${buildDate}`, - ]; - - if (lexiconMetadata?.version) { - metadataLines.push(` * Version: ${lexiconMetadata.version}`); - } - if (lexiconMetadata?.commitSha) { - metadataLines.push(` * Commit: ${lexiconMetadata.commitSha}`); - } - if (lexiconMetadata?.sourceUrl) { - metadataLines.push(` * Source: ${lexiconMetadata.sourceUrl}`); - } - - metadataLines.push(' */'); - - let code = `/* eslint-disable */ -// This file is automatically generated by @tsky/lex-cli, do not edit! - -${metadataLines.join('\n')}`; - - if (banner) { - code += `\n\n${banner}`; - } - - code += `\n\n${mainPrelude}`; - - for await (const filename of files.sort(sortName)) { - let document: DocumentSchema; - - try { - const jsonString = await readFile(filename, 'utf8'); - const parsed = JSON.parse(jsonString); - - if (!documentSchema(parsed)) { - throw new Error('Invalid document schema'); - } - document = parsed; - } - catch (err) { - throw new Error(`failed to read ${filename}`, { cause: err }); - } - - const ns = document.id; - const tsNamespace = toNamespace(ns); - - let descs: string[] = []; - let chunk = ''; - - const definitions = document.defs; - const keys = Object.keys(definitions).sort(sortDefinition); - - for (const key of keys) { - const def = definitions[key]; - const type = def.type; - - const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; - const typeName = key[0].toUpperCase() + key.slice(1); - - if (type === 'string') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'token') { - chunk += `type ${typeName} = '${nsid}';`; - } - else if (type === 'object') { - const required = def.required; - const nullable = def.nullable; - const properties = def.properties; - - const propKeys = sortPropertyKeys(Object.keys(properties), required); - const descs = getDescriptions(def); - - chunk += writeJsdoc(descs); - chunk += `interface ${typeName} extends TypedBase {`; - - for (const prop of propKeys) { - const isOptional = !required || !required.includes(prop); - const isNullable = nullable?.includes(prop); - const { value, descriptions } = resolveType( - `${nsid}/${prop}`, - properties[prop], - ); - - chunk += writeJsdoc(descriptions); - chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; - } - - chunk += '}'; - } - else if (type === 'array') { - const { value, descriptions } = resolveType(nsid, def.items); - const descs = []; - - if (def.maxLength !== undefined) { - descs.push(`Maximum array length: ${def.maxLength}`); - } - - if (def.minLength !== undefined) { - descs.push(`Minimum array length: ${def.minLength}`); - } - - chunk += writeJsdoc(descs.concat(descriptions)); - chunk += `type ${typeName} = (${value})[];`; - } - else if (type === 'record') { - const obj = def.record; - const required = obj.required; - const nullable = obj.nullable; - const properties = obj.properties; - - const propKeys = sortPropertyKeys(Object.keys(properties), required); - const descs = getDescriptions(def); - - chunk += writeJsdoc(descs); - chunk += `interface Record extends RecordBase {`; - chunk += `$type: '${nsid}';`; - - for (const prop of propKeys) { - const isOptional = !required || !required.includes(prop); - const isNullable = nullable?.includes(prop); - const { value, descriptions } = resolveType( - `${nsid}/${prop}`, - properties[prop], - ); - - chunk += writeJsdoc(descriptions); - chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; - } - - chunk += '}'; - - records += `\n'${nsid}': ${tsNamespace}.Record;`; - } - else if (type === 'query' || type === 'procedure') { - let parameters = def.parameters; - const input = type === 'procedure' ? def.input : undefined; - const output = def.output; - const errors = def.errors; - - descs = getDescriptions(def); - - if (parameters) { - if (Object.values(parameters.properties).length === 0) { - parameters = undefined; - } - else { - const { value, descriptions } = resolveType(nsid, parameters); - - chunk += writeJsdoc(descriptions); - chunk += `interface Params extends TypedBase ${value}`; - } - } - else { - chunk += 'interface Params extends TypedBase {}'; - } - - if (input) { - if (input.encoding === 'application/json' && input.schema) { - const { value, descriptions } = resolveType(nsid, input.schema); - - chunk += writeJsdoc(descriptions); - - if (input.schema?.type === 'object') { - chunk += `interface Input extends TypedBase ${value}`; - } - else { - chunk += `type Input = ${value};`; - } - } - else { - chunk += 'type Input = Blob | ArrayBufferView;'; - } - } - else { - chunk += 'type Input = undefined;'; - } - - if (output) { - if (output.encoding === 'application/json' && output.schema) { - const { value, descriptions } = resolveType(nsid, output.schema); - - chunk += writeJsdoc(descriptions); - - if (output.schema?.type === 'object') { - chunk += `interface Output extends TypedBase ${value}`; - } - else { - chunk += `type Output = ${value};`; - } - } - else { - chunk += 'type Output = Uint8Array;'; - } - } - else { - chunk += 'type Output = undefined;'; - } - - if (errors) { - chunk += 'interface Errors extends TypedBase {'; - - for (const error of errors) { - chunk += `${error.name}: {};`; - } - - chunk += '}'; - } - - { - let rc = `'${ns}':{\n`; - - if (parameters) { - rc += `params: ${tsNamespace}.Params;`; - } - if (input) { - rc += `input: ${tsNamespace}.Input;`; - } - if (output) { - rc += `output: ${tsNamespace}.Output;`; - } - - rc += '};'; - - if (type === 'query') { - queries += rc; - } - else if (type === 'procedure') { - procedures += rc; - } - } - } - else if (type === 'blob') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'bytes') { - const { value, descriptions } = resolveType(nsid, def); - - chunk += writeJsdoc(descriptions); - chunk += `type ${typeName} = ${value};`; - } - else if (type === 'subscription') { - if (def.parameters) { - const { value, descriptions } = resolveType(nsid, def.parameters); - chunk += writeJsdoc(descriptions); - chunk += `interface Params extends TypedBase ${value}`; - } - else { - chunk += 'interface Params extends TypedBase {}'; - } - - if (def.message?.schema) { - const { value: messageValue, descriptions: messageDesc } - = resolveType(nsid, def.message.schema); - chunk += writeJsdoc(messageDesc); - chunk += `type Message = ${messageValue};`; - } - - if (def.errors) { - chunk += 'interface Errors extends TypedBase {'; - for (const error of def.errors) { - chunk += `${error.name}: {};`; - } - chunk += '}'; - } - - let rc = `'${ns}':{\n`; - if (def.parameters) { - rc += `params: ${tsNamespace}.Params;`; - } - if (def.message?.schema) { - rc += `message: ${tsNamespace}.Message;`; - } - if (def.errors) { - rc += `errors: ${tsNamespace}.Errors;`; - } - rc += '};'; - subscriptions += rc; - } - else { - // eslint-disable-next-line no-console - console.log(`${nsid}: unhandled type ${type}`); - } - } - - code += writeJsdoc(descs); - code += `export declare namespace ${tsNamespace} {`; - code += chunk; - code += '}\n\n'; - } - - code += `export declare interface Records extends RecordBase {${records}}\n\n`; - code += `export declare interface Queries {${queries}}\n\n`; - code += `export declare interface Procedures {${procedures}}\n\n`; - code += `export declare interface Subscriptions {${subscriptions}}\n\n`; - - return code; -} +import { readFile } from 'node:fs/promises'; +import { + toNamespace, + getDescriptions, + writeJsdoc, + mainPrelude, + sortDefinition, + sortName, + sortPropertyKeys, +} from '../utils/index.js'; +import { resolveType } from './resolvers/index.js'; +import { type DocumentSchema, documentSchema } from './schema.js'; + +export interface GenerateDefinitionsOptions { + files: string[]; + banner?: string; + description?: string; + debug?: boolean; + lexiconMetadata?: { + commitSha?: string; + version?: string; + sourceUrl?: string; + }; + onProgress?: (filename: string, index: number, total: number) => void; +} + +export async function generateDefinitions(opts: GenerateDefinitionsOptions) { + const { files, banner, description, lexiconMetadata } = opts; + + let queries = ''; + let procedures = ''; + let records = ''; + let subscriptions = ''; + + const buildDate = new Date().toISOString(); + const metadataLines = [ + '/**', + ' * @module', + description ? ` * ${description}` : ' * ATProto lexicon type definitions', + ' * @generated', + ` * Generated on: ${buildDate}`, + ]; + + if (lexiconMetadata?.version) { + metadataLines.push(` * Version: ${lexiconMetadata.version}`); + } + if (lexiconMetadata?.commitSha) { + metadataLines.push(` * Commit: ${lexiconMetadata.commitSha}`); + } + if (lexiconMetadata?.sourceUrl) { + metadataLines.push(` * Source: ${lexiconMetadata.sourceUrl}`); + } + + metadataLines.push(' */'); + + let code = `/* eslint-disable */ +// This file is automatically generated by @tsky/lex-cli, do not edit! + +${metadataLines.join('\n')}`; + + if (banner) { + code += `\n\n${banner}`; + } + + code += `\n\n${mainPrelude}`; + + for await (const filename of files.sort(sortName)) { + let document: DocumentSchema; + + try { + const jsonString = await readFile(filename, 'utf8'); + const parsed = JSON.parse(jsonString); + + if (!documentSchema(parsed)) { + throw new Error('Invalid document schema'); + } + document = parsed; + } catch (err) { + throw new Error(`failed to read ${filename}`, { cause: err }); + } + + const ns = document.id; + const tsNamespace = toNamespace(ns); + + let descs: string[] = []; + let chunk = ''; + + const definitions = document.defs; + const keys = Object.keys(definitions).sort(sortDefinition); + + for (const key of keys) { + const def = definitions[key]; + const type = def.type; + + const nsid = `${ns}${key !== 'main' ? `#${key}` : ''}`; + const typeName = key[0].toUpperCase() + key.slice(1); + + if (type === 'string') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } else if (type === 'token') { + chunk += `type ${typeName} = '${nsid}';`; + } else if (type === 'object') { + const required = def.required; + const nullable = def.nullable; + const properties = def.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += `interface ${typeName} extends TypedBase {`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + } else if (type === 'array') { + const { value, descriptions } = resolveType(nsid, def.items); + const descs = []; + + if (def.maxLength !== undefined) { + descs.push(`Maximum array length: ${def.maxLength}`); + } + + if (def.minLength !== undefined) { + descs.push(`Minimum array length: ${def.minLength}`); + } + + chunk += writeJsdoc(descs.concat(descriptions)); + chunk += `type ${typeName} = (${value})[];`; + } else if (type === 'record') { + const obj = def.record; + const required = obj.required; + const nullable = obj.nullable; + const properties = obj.properties; + + const propKeys = sortPropertyKeys(Object.keys(properties), required); + const descs = getDescriptions(def); + + chunk += writeJsdoc(descs); + chunk += `interface Record extends RecordBase {`; + chunk += `$type: '${nsid}';`; + + for (const prop of propKeys) { + const isOptional = !required || !required.includes(prop); + const isNullable = nullable?.includes(prop); + const { value, descriptions } = resolveType( + `${nsid}/${prop}`, + properties[prop], + ); + + chunk += writeJsdoc(descriptions); + chunk += `${prop}${isOptional ? '?' : ''}:${value}${isNullable ? '| null' : ''};`; + } + + chunk += '}'; + + records += `\n'${nsid}': ${tsNamespace}.Record;`; + } else if (type === 'query' || type === 'procedure') { + let parameters = def.parameters; + const input = type === 'procedure' ? def.input : undefined; + const output = def.output; + const errors = def.errors; + + descs = getDescriptions(def); + + if (parameters) { + if (Object.values(parameters.properties).length === 0) { + parameters = undefined; + } else { + const { value, descriptions } = resolveType(nsid, parameters); + + chunk += writeJsdoc(descriptions); + chunk += `interface Params extends TypedBase ${value}`; + } + } else { + chunk += 'interface Params extends TypedBase {}'; + } + + if (input) { + if (input.encoding === 'application/json' && input.schema) { + const { value, descriptions } = resolveType(nsid, input.schema); + + chunk += writeJsdoc(descriptions); + + if (input.schema?.type === 'object') { + chunk += `interface Input extends TypedBase ${value}`; + } else { + chunk += `type Input = ${value};`; + } + } else { + chunk += 'type Input = Blob | ArrayBufferView;'; + } + } else { + chunk += 'type Input = undefined;'; + } + + if (output) { + if (output.encoding === 'application/json' && output.schema) { + const { value, descriptions } = resolveType(nsid, output.schema); + + chunk += writeJsdoc(descriptions); + + if (output.schema?.type === 'object') { + chunk += `interface Output extends TypedBase ${value}`; + } else { + chunk += `type Output = ${value};`; + } + } else { + chunk += 'type Output = Uint8Array;'; + } + } else { + chunk += 'type Output = undefined;'; + } + + if (errors) { + chunk += 'interface Errors extends TypedBase {'; + + for (const error of errors) { + chunk += `${error.name}: {};`; + } + + chunk += '}'; + } + + { + let rc = `'${ns}':{\n`; + + if (parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (input) { + rc += `input: ${tsNamespace}.Input;`; + } + if (output) { + rc += `output: ${tsNamespace}.Output;`; + } + + rc += '};'; + + if (type === 'query') { + queries += rc; + } else if (type === 'procedure') { + procedures += rc; + } + } + } else if (type === 'blob') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } else if (type === 'bytes') { + const { value, descriptions } = resolveType(nsid, def); + + chunk += writeJsdoc(descriptions); + chunk += `type ${typeName} = ${value};`; + } else if (type === 'subscription') { + if (def.parameters) { + const { value, descriptions } = resolveType(nsid, def.parameters); + chunk += writeJsdoc(descriptions); + chunk += `interface Params extends TypedBase ${value}`; + } else { + chunk += 'interface Params extends TypedBase {}'; + } + + if (def.message?.schema) { + const { value: messageValue, descriptions: messageDesc } = + resolveType(nsid, def.message.schema); + chunk += writeJsdoc(messageDesc); + chunk += `type Message = ${messageValue};`; + } + + if (def.errors) { + chunk += 'interface Errors extends TypedBase {'; + for (const error of def.errors) { + chunk += `${error.name}: {};`; + } + chunk += '}'; + } + + let rc = `'${ns}':{\n`; + if (def.parameters) { + rc += `params: ${tsNamespace}.Params;`; + } + if (def.message?.schema) { + rc += `message: ${tsNamespace}.Message;`; + } + if (def.errors) { + rc += `errors: ${tsNamespace}.Errors;`; + } + rc += '};'; + subscriptions += rc; + } else { + // eslint-disable-next-line no-console + console.log(`${nsid}: unhandled type ${type}`); + } + } + + code += writeJsdoc(descs); + code += `export declare namespace ${tsNamespace} {`; + code += chunk; + code += '}\n\n'; + } + + code += `export declare interface Records extends RecordBase {${records}}\n\n`; + code += `export declare interface Queries {${queries}}\n\n`; + code += `export declare interface Procedures {${procedures}}\n\n`; + code += `export declare interface Subscriptions {${subscriptions}}\n\n`; + + return code; +} diff --git a/packages/lex-cli/src/generator/resolvers/complex.ts b/packages/lex-cli/src/generator/resolvers/complex.ts index feaca4c..8c2d2c0 100644 --- a/packages/lex-cli/src/generator/resolvers/complex.ts +++ b/packages/lex-cli/src/generator/resolvers/complex.ts @@ -4,7 +4,13 @@ import type { RefUnionSchema, XrpcParametersSchema, } from '../schema.js'; -import { toNamespace, toUpper, writeJsdoc, sortName, sortPropertyKeys } from '../../utils/index.js'; +import { + toNamespace, + toUpper, + writeJsdoc, + sortName, + sortPropertyKeys, +} from '../../utils/index.js'; import { resolveType } from './type.js'; export function resolveRefType(def: RefSchema): string { diff --git a/packages/lex-cli/src/generator/resolvers/index.ts b/packages/lex-cli/src/generator/resolvers/index.ts index 57d75dc..d5d467f 100644 --- a/packages/lex-cli/src/generator/resolvers/index.ts +++ b/packages/lex-cli/src/generator/resolvers/index.ts @@ -1,5 +1,9 @@ -export { resolveObjectType, resolveRefType, resolveUnionType } from './complex.js'; -export { resolveIntegerType } from './numeric.js'; -export { resolvePrimitiveType } from './primitives.js'; -export { resolveStringFormat, resolveStringType } from './string.js'; -export { resolveType } from './type.js'; +export { + resolveObjectType, + resolveRefType, + resolveUnionType, +} from './complex.js'; +export { resolveIntegerType } from './numeric.js'; +export { resolvePrimitiveType } from './primitives.js'; +export { resolveStringFormat, resolveStringType } from './string.js'; +export { resolveType } from './type.js'; diff --git a/packages/lex-cli/src/generator/resolvers/type.ts b/packages/lex-cli/src/generator/resolvers/type.ts index bb9f66a..cd8e2bd 100644 --- a/packages/lex-cli/src/generator/resolvers/type.ts +++ b/packages/lex-cli/src/generator/resolvers/type.ts @@ -79,14 +79,14 @@ export function resolveType( if (def.errors) { output.push({ value: `interface Errors {${def.errors - .map(error => `${error.name}: {};`) + .map((error) => `${error.name}: {};`) .join('')}}`, descriptions: [], }); } - val = output.map(o => o.value).join('\n'); - descs = descs.concat(output.flatMap(o => o.descriptions)); + val = output.map((o) => o.value).join('\n'); + descs = descs.concat(output.flatMap((o) => o.descriptions)); break; } default: diff --git a/packages/lex-cli/src/generator/schema.ts b/packages/lex-cli/src/generator/schema.ts index 1c565e2..6a7e823 100644 --- a/packages/lex-cli/src/generator/schema.ts +++ b/packages/lex-cli/src/generator/schema.ts @@ -96,10 +96,10 @@ export const stringSchema: t.StrictValidator< } => { if (value.format !== undefined && value.format !== 'uri') { if ( - value.maxLength !== undefined - || value.minLength !== undefined - || value.maxGraphemes !== undefined - || value.minGraphemes !== undefined + value.maxLength !== undefined || + value.minLength !== undefined || + value.maxGraphemes !== undefined || + value.minGraphemes !== undefined ) { throw new Error( `${value.format} format can't be used with length or grapheme constraints`, @@ -364,9 +364,9 @@ export const userTypeSchema = t.isOneOf([ export type UserTypeSchema = t.InferType; -const NSID_RE - = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; -const nsidType = t.cascade(t.isString(), value => NSID_RE.test(value)); +const NSID_RE = + /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i; +const nsidType = t.cascade(t.isString(), (value) => NSID_RE.test(value)); export const documentSchema = t.cascade( t.isObject({ @@ -390,11 +390,11 @@ export const documentSchema = t.cascade( const type = def.type; if ( - id !== 'main' - && (type === 'record' - || type === 'query' - || type === 'procedure' - || type === 'subscription') + id !== 'main' && + (type === 'record' || + type === 'query' || + type === 'procedure' || + type === 'subscription') ) { throw new Error( `${type} must be the \`main\` definition (in defs.${id})`, diff --git a/packages/lex-cli/src/index.ts b/packages/lex-cli/src/index.ts index 02c5caa..9bb65d0 100644 --- a/packages/lex-cli/src/index.ts +++ b/packages/lex-cli/src/index.ts @@ -18,21 +18,29 @@ cli.register( static paths = [['generate-types']]; static usage = Command.Usage({ - description: 'Generates TypeScript type definitions from Lexicon schema files', + description: + 'Generates TypeScript type definitions from Lexicon schema files', details: ` This command takes Lexicon JSON schema files as input and generates corresponding TypeScript type definitions. It handles all AT Protocol lexicons (app.bsky, com.atproto, etc.) and outputs a single consolidated TypeScript declaration file. `, examples: [ - ['Basic usage', 'lex-cli generate-types ./lexicons/**/*.json -o types.ts'], - ['With module description', 'lex-cli generate-types ./lexicons/**/*.json -o types.ts --description "AT Protocol Types"'], + [ + 'Basic usage', + 'lex-cli generate-types ./lexicons/**/*.json -o types.ts', + ], + [ + 'With module description', + 'lex-cli generate-types ./lexicons/**/*.json -o types.ts --description "AT Protocol Types"', + ], ], }); output = Option.String('-o,--output', { required: false, - description: 'Path for the generated TypeScript definition file. If not specified, outputs to stdout', + description: + 'Path for the generated TypeScript definition file. If not specified, outputs to stdout', validator: t.cascade(t.isString(), t.matchesRegExp(/\.ts$/)), }); @@ -43,7 +51,8 @@ cli.register( banner = Option.String('--banner', { required: false, - description: 'Custom banner text to insert at the top of the generated file', + description: + 'Custom banner text to insert at the top of the generated file', }); metadata = Option.String('--metadata', { @@ -64,18 +73,18 @@ cli.register( files: this.files, banner: this.banner, description: this.desc, - lexiconMetadata: this.metadata ? JSON.parse(this.metadata) : undefined, + lexiconMetadata: this.metadata + ? JSON.parse(this.metadata) + : undefined, }); - } - catch (err) { + } catch (err) { if (err instanceof Error) { console.error(pc.bold(`${pc.red('error:')} ${err.message}`)); if (err.cause instanceof Error) { console.error(` ${pc.gray('caused by:')} ${err.cause.message}`); } - } - else { + } else { console.error(pc.bold(pc.red('unknown error occurred:'))); console.error(err); } @@ -94,8 +103,7 @@ cli.register( if (this.output) { await writeFile(this.output, formatted); - } - else { + } else { // eslint-disable-next-line no-console console.log(formatted); } diff --git a/packages/lex-cli/src/utils/cache.ts b/packages/lex-cli/src/utils/cache.ts index 8e44eda..2bf247b 100644 --- a/packages/lex-cli/src/utils/cache.ts +++ b/packages/lex-cli/src/utils/cache.ts @@ -18,8 +18,9 @@ export function toNamespace(s: string) { if (s in toNamespaceCache) { return toNamespaceCache[s]; } - const value = s.replace(/^\w|\.\w/g, m => - m[m.length === 1 ? 0 : 1].toUpperCase()); + const value = s.replace(/^\w|\.\w/g, (m) => + m[m.length === 1 ? 0 : 1].toUpperCase(), + ); toNamespaceCache[s] = value; return value; } diff --git a/packages/lex-cli/src/utils/docs.ts b/packages/lex-cli/src/utils/docs.ts index 195e29d..ab10772 100644 --- a/packages/lex-cli/src/utils/docs.ts +++ b/packages/lex-cli/src/utils/docs.ts @@ -12,7 +12,7 @@ export function getDescriptions(def: { description?: string }): string[] { export function writeJsdoc(descriptions: string[]) { if (!descriptions.length) return ''; - const escaped = descriptions.map(desc => + const escaped = descriptions.map((desc) => desc.replace(/\*\//g, '*\\/').replace(/@/g, '\\@'), ); @@ -20,5 +20,5 @@ export function writeJsdoc(descriptions: string[]) { return `\n/** ${escaped[0]} */\n`; } - return `\n/**${escaped.map(desc => `\n * ${desc}`).join('')}\n */\n`; + return `\n/**${escaped.map((desc) => `\n * ${desc}`).join('')}\n */\n`; } diff --git a/packages/lex-cli/src/utils/index.ts b/packages/lex-cli/src/utils/index.ts index c73ad3c..bcaae1e 100644 --- a/packages/lex-cli/src/utils/index.ts +++ b/packages/lex-cli/src/utils/index.ts @@ -1,5 +1,5 @@ -export { toNamespace, toUpper } from './cache.js'; -export { getDescriptions, writeJsdoc } from './docs.js'; -export { IGNORED_FORMATS, TYPE_FORMATS } from './formats.js'; -export { mainPrelude } from './prelude.js'; -export { sortDefinition, sortName, sortPropertyKeys } from './sort.js'; +export { toNamespace, toUpper } from './cache.js'; +export { getDescriptions, writeJsdoc } from './docs.js'; +export { IGNORED_FORMATS, TYPE_FORMATS } from './formats.js'; +export { mainPrelude } from './prelude.js'; +export { sortDefinition, sortName, sortPropertyKeys } from './sort.js'; diff --git a/packages/lexicons/index.ts b/packages/lexicons/index.ts index 4df73b3..ec5a8e3 100644 --- a/packages/lexicons/index.ts +++ b/packages/lexicons/index.ts @@ -1 +1 @@ -export * from './src/index.js'; +export * from './src/index.js'; diff --git a/packages/lexicons/scripts/generate-types.ts b/packages/lexicons/scripts/generate-types.ts index e3c5a3e..8d3e112 100644 --- a/packages/lexicons/scripts/generate-types.ts +++ b/packages/lexicons/scripts/generate-types.ts @@ -26,7 +26,8 @@ async function downloadLexicons() { const commits = await shaResponse.json(); const sha = commits[0]?.sha; - const version = commits[0]?.commit?.message?.match(/Release v([\d.]+)/)?.[1] || 'main'; + const version = + commits[0]?.commit?.message?.match(/Release v([\d.]+)/)?.[1] || 'main'; if (!sha) { throw new Error('No commits found for lexicons'); @@ -46,7 +47,7 @@ async function downloadLexicons() { await tar.x({ file: tarFile, cwd: LEXICONS_DIR, - filter: path => path.includes('/lexicons/'), + filter: (path) => path.includes('/lexicons/'), strip: 2, }); @@ -108,8 +109,7 @@ async function main() { }); console.log('Done! Types generated at', TYPES_OUTPUT_PATH); - } - catch (error) { + } catch (error) { console.error('Error:', error); process.exit(1); } diff --git a/packages/lexicons/src/index.ts b/packages/lexicons/src/index.ts index d79d3ab..9a38160 100644 --- a/packages/lexicons/src/index.ts +++ b/packages/lexicons/src/index.ts @@ -1,4 +1,9 @@ -import { isRecord, type Procedures, type Queries, type Records } from './lib/lexicons.js'; +import { + isRecord, + type Procedures, + type Queries, + type Records, +} from './lib/lexicons.js'; export * from './lib/lexicons.js'; @@ -73,10 +78,22 @@ export type ProcedureErrors = : never; // --- Common Bluesky Types --- -export type BskyPost = Extract; -export type BskyProfile = Extract; -export type BskyLike = Extract; -export type BskyFollow = Extract; +export type BskyPost = Extract< + BskyRecord, + { $type: `${typeof APP_BSKY_PREFIX}feed.post` } +>; +export type BskyProfile = Extract< + BskyRecord, + { $type: `${typeof APP_BSKY_PREFIX}actor.profile` } +>; +export type BskyLike = Extract< + BskyRecord, + { $type: `${typeof APP_BSKY_PREFIX}feed.like` } +>; +export type BskyFollow = Extract< + BskyRecord, + { $type: `${typeof APP_BSKY_PREFIX}graph.follow` } +>; // --- Type Guards --- export function isBskyRecord(value: unknown): value is BskyRecord { @@ -102,12 +119,12 @@ export interface BskyError { export function isBskyError(value: unknown): value is BskyError { return ( - typeof value === 'object' - && value !== null - && 'error' in value - && 'message' in value - && typeof (value as BskyError).error === 'string' - && typeof (value as BskyError).message === 'string' + typeof value === 'object' && + value !== null && + 'error' in value && + 'message' in value && + typeof (value as BskyError).error === 'string' && + typeof (value as BskyError).message === 'string' ); } diff --git a/packages/lexicons/src/lib/lexicons.ts b/packages/lexicons/src/lib/lexicons.ts index aec0716..a6c0988 100644 --- a/packages/lexicons/src/lib/lexicons.ts +++ b/packages/lexicons/src/lib/lexicons.ts @@ -1,5836 +1,5836 @@ -/* eslint-disable */ -// This file is automatically generated by @tsky/lex-cli, do not edit! - -/** - * @module - * Contains type declarations for Bluesky lexicons - * @generated - * Generated on: 2024-12-04T01:51:07.265Z - * Version: main - * Source: https://github.com/bluesky-social/atproto/tree/c72145dbeb2d67068bc28c00a13447e0d382d121/lexicons - */ - -/** Base type with optional type field */ -export interface TypedBase { - $type?: string; -} - -/** Base type for all record types */ -export interface RecordBase { - $type: string; -} - -/** Makes $type required and specific */ -export type Typed = Omit< - T, - "$type" -> & { - $type: Type; -}; - -/** Creates a union of objects discriminated by $type */ -export type TypeUnion = T extends any - ? Typed - : never; - -/** Type guard for records */ -export function isRecord(value: unknown): value is RecordBase { - return ( - typeof value === "object" && - value !== null && - "$type" in value && - typeof value.$type === "string" - ); -} - -/** Base AT Protocol schema types */ -export declare namespace At { - /** CID string */ - type CID = string; - - /** DID of a user */ - type DID = `did:${string}`; - - /** User handle */ - type Handle = string; - - /** URI string */ - type Uri = string; - - /** Object containing a CID string */ - interface CIDLink { - $link: CID; - } - - /** Object containing a base64-encoded bytes */ - interface Bytes { - $bytes: string; - } - - /** Blob interface */ - interface Blob extends RecordBase { - $type: "blob"; - mimeType: T; - ref: { - $link: string; - }; - size: number; - } -} -export declare namespace AppBskyActorDefs { - interface AdultContentPref extends TypedBase { - /** \@default false */ - enabled: boolean; - } - /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ - interface BskyAppProgressGuide extends TypedBase { - /** Maximum string length: 100 */ - guide: string; - } - /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ - interface BskyAppStatePref extends TypedBase { - activeProgressGuide?: BskyAppProgressGuide; - /** - * Storage for NUXs the user has encountered. - * Maximum array length: 100 - */ - nuxs?: AppBskyActorDefs.Nux[]; - /** - * An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. - * Maximum array length: 1000 - * Maximum string length: 100 - */ - queuedNudges?: string[]; - } - interface ContentLabelPref extends TypedBase { - label: string; - visibility: "hide" | "ignore" | "show" | "warn" | (string & {}); - /** Which labeler does this preference apply to? If undefined, applies globally. */ - labelerDid?: At.DID; - } - interface FeedViewPref extends TypedBase { - /** The URI of the feed, or an identifier which describes the feed. */ - feed: string; - /** Hide quote posts in the feed. */ - hideQuotePosts?: boolean; - /** Hide replies in the feed. */ - hideReplies?: boolean; - /** Hide replies in the feed if they do not have this number of likes. */ - hideRepliesByLikeCount?: number; - /** - * Hide replies in the feed if they are not by followed users. - * \@default true - */ - hideRepliesByUnfollowed?: boolean; - /** Hide reposts in the feed. */ - hideReposts?: boolean; - } - interface HiddenPostsPref extends TypedBase { - /** A list of URIs of posts the account owner has hidden. */ - items: At.Uri[]; - } - interface InterestsPref extends TypedBase { - /** - * A list of tags which describe the account owner's interests gathered during onboarding. - * Maximum array length: 100 - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - tags: string[]; - } - /** The subject's followers whom you also follow */ - interface KnownFollowers extends TypedBase { - count: number; - /** - * Minimum array length: 0 - * Maximum array length: 5 - */ - followers: ProfileViewBasic[]; - } - interface LabelerPrefItem extends TypedBase { - did: At.DID; - } - interface LabelersPref extends TypedBase { - labelers: LabelerPrefItem[]; - } - /** A word that the account owner has muted. */ - interface MutedWord extends TypedBase { - /** The intended targets of the muted word. */ - targets: AppBskyActorDefs.MutedWordTarget[]; - /** - * The muted word itself. - * Maximum string length: 10000 - * Maximum grapheme length: 1000 - */ - value: string; - /** - * Groups of users to apply the muted word to. If undefined, applies to all users. - * \@default "all" - */ - actorTarget?: "all" | "exclude-following" | (string & {}); - /** The date and time at which the muted word will expire and no longer be applied. */ - expiresAt?: string; - id?: string; - } - interface MutedWordsPref extends TypedBase { - /** A list of words the account owner has muted. */ - items: AppBskyActorDefs.MutedWord[]; - } - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - type MutedWordTarget = "content" | "tag" | (string & {}); - /** A new user experiences (NUX) storage object */ - interface Nux extends TypedBase { - /** \@default false */ - completed: boolean; - /** Maximum string length: 100 */ - id: string; - /** - * Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - data?: string; - /** The date and time at which the NUX will expire and should be considered completed. */ - expiresAt?: string; - } - interface PersonalDetailsPref extends TypedBase { - /** The birth date of account owner. */ - birthDate?: string; - } - type Preferences = TypeUnion< - | AdultContentPref - | BskyAppStatePref - | ContentLabelPref - | FeedViewPref - | HiddenPostsPref - | InterestsPref - | LabelersPref - | MutedWordsPref - | PersonalDetailsPref - | SavedFeedsPref - | SavedFeedsPrefV2 - | ThreadViewPref - >[]; - interface ProfileAssociated extends TypedBase { - chat?: ProfileAssociatedChat; - feedgens?: number; - labeler?: boolean; - lists?: number; - starterPacks?: number; - } - interface ProfileAssociatedChat extends TypedBase { - allowIncoming: "all" | "following" | "none" | (string & {}); - } - interface ProfileView extends TypedBase { - did: At.DID; - handle: At.Handle; - associated?: ProfileAssociated; - avatar?: string; - createdAt?: string; - /** - * Maximum string length: 2560 - * Maximum grapheme length: 256 - */ - description?: string; - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - displayName?: string; - indexedAt?: string; - labels?: ComAtprotoLabelDefs.Label[]; - viewer?: ViewerState; - } - interface ProfileViewBasic extends TypedBase { - did: At.DID; - handle: At.Handle; - associated?: ProfileAssociated; - avatar?: string; - createdAt?: string; - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - displayName?: string; - labels?: ComAtprotoLabelDefs.Label[]; - viewer?: ViewerState; - } - interface ProfileViewDetailed extends TypedBase { - did: At.DID; - handle: At.Handle; - associated?: ProfileAssociated; - avatar?: string; - banner?: string; - createdAt?: string; - /** - * Maximum string length: 2560 - * Maximum grapheme length: 256 - */ - description?: string; - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - displayName?: string; - followersCount?: number; - followsCount?: number; - indexedAt?: string; - joinedViaStarterPack?: AppBskyGraphDefs.StarterPackViewBasic; - labels?: ComAtprotoLabelDefs.Label[]; - pinnedPost?: ComAtprotoRepoStrongRef.Main; - postsCount?: number; - viewer?: ViewerState; - } - interface SavedFeed extends TypedBase { - id: string; - pinned: boolean; - type: "feed" | "list" | "timeline" | (string & {}); - value: string; - } - interface SavedFeedsPref extends TypedBase { - pinned: At.Uri[]; - saved: At.Uri[]; - timelineIndex?: number; - } - interface SavedFeedsPrefV2 extends TypedBase { - items: AppBskyActorDefs.SavedFeed[]; - } - interface ThreadViewPref extends TypedBase { - /** Show followed users at the top of all replies. */ - prioritizeFollowedUsers?: boolean; - /** Sorting mode for threads. */ - sort?: - | "hotness" - | "most-likes" - | "newest" - | "oldest" - | "random" - | (string & {}); - } - /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ - interface ViewerState extends TypedBase { - blockedBy?: boolean; - blocking?: At.Uri; - blockingByList?: AppBskyGraphDefs.ListViewBasic; - followedBy?: At.Uri; - following?: At.Uri; - knownFollowers?: KnownFollowers; - muted?: boolean; - mutedByList?: AppBskyGraphDefs.ListViewBasic; - } -} - -/** Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. */ -export declare namespace AppBskyActorGetPreferences { - type Input = undefined; - interface Output extends TypedBase { - preferences: AppBskyActorDefs.Preferences; - } -} - -/** Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. */ -export declare namespace AppBskyActorGetProfile { - interface Params extends TypedBase { - /** Handle or DID of account to fetch profile of. */ - actor: string; - } - type Input = undefined; - type Output = AppBskyActorDefs.ProfileViewDetailed; -} - -/** Get detailed profile views of multiple actors. */ -export declare namespace AppBskyActorGetProfiles { - interface Params extends TypedBase { - /** Maximum array length: 25 */ - actors: string[]; - } - type Input = undefined; - interface Output extends TypedBase { - profiles: AppBskyActorDefs.ProfileViewDetailed[]; - } -} - -/** Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. */ -export declare namespace AppBskyActorGetSuggestions { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - actors: AppBskyActorDefs.ProfileView[]; - cursor?: string; - } -} - -export declare namespace AppBskyActorProfile { - /** A declaration of a Bluesky account profile. */ - interface Record extends RecordBase { - $type: "app.bsky.actor.profile"; - /** Small image to be displayed next to posts from account. AKA, 'profile picture' */ - avatar?: At.Blob; - /** Larger horizontal image to display behind profile view. */ - banner?: At.Blob; - createdAt?: string; - /** - * Free-form profile description text. - * Maximum string length: 2560 - * Maximum grapheme length: 256 - */ - description?: string; - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - displayName?: string; - joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main; - /** Self-label values, specific to the Bluesky application, on the overall account. */ - labels?: TypeUnion; - pinnedPost?: ComAtprotoRepoStrongRef.Main; - } -} - -/** Set the private preferences attached to the account. */ -export declare namespace AppBskyActorPutPreferences { - interface Params extends TypedBase {} - interface Input extends TypedBase { - preferences: AppBskyActorDefs.Preferences; - } - type Output = undefined; -} - -/** Find actors (profiles) matching search criteria. Does not require auth. */ -export declare namespace AppBskyActorSearchActors { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 25 - */ - limit?: number; - /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ - q?: string; - /** - * DEPRECATED: use 'q' instead. - * \@deprecated - */ - term?: string; - } - type Input = undefined; - interface Output extends TypedBase { - actors: AppBskyActorDefs.ProfileView[]; - cursor?: string; - } -} - -/** Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. */ -export declare namespace AppBskyActorSearchActorsTypeahead { - interface Params extends TypedBase { - /** - * Minimum: 1 - * Maximum: 100 - * \@default 10 - */ - limit?: number; - /** Search query prefix; not a full query string. */ - q?: string; - /** - * DEPRECATED: use 'q' instead. - * \@deprecated - */ - term?: string; - } - type Input = undefined; - interface Output extends TypedBase { - actors: AppBskyActorDefs.ProfileViewBasic[]; - } -} - -export declare namespace AppBskyEmbedDefs { - /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ - interface AspectRatio extends TypedBase { - /** Minimum: 1 */ - height: number; - /** Minimum: 1 */ - width: number; - } -} - -export declare namespace AppBskyEmbedExternal { - /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ - interface Main extends TypedBase { - external: External; - } - interface External extends TypedBase { - description: string; - title: string; - uri: string; - thumb?: At.Blob; - } - interface View extends TypedBase { - external: ViewExternal; - } - interface ViewExternal extends TypedBase { - description: string; - title: string; - uri: string; - thumb?: string; - } -} - -export declare namespace AppBskyEmbedImages { - interface Main extends TypedBase { - /** Maximum array length: 4 */ - images: Image[]; - } - interface Image extends TypedBase { - /** Alt text description of the image, for accessibility. */ - alt: string; - image: At.Blob; - aspectRatio?: AppBskyEmbedDefs.AspectRatio; - } - interface View extends TypedBase { - /** Maximum array length: 4 */ - images: ViewImage[]; - } - interface ViewImage extends TypedBase { - /** Alt text description of the image, for accessibility. */ - alt: string; - /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ - fullsize: string; - /** Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. */ - thumb: string; - aspectRatio?: AppBskyEmbedDefs.AspectRatio; - } -} - -export declare namespace AppBskyEmbedRecord { - interface Main extends TypedBase { - record: ComAtprotoRepoStrongRef.Main; - } - interface View extends TypedBase { - record: TypeUnion< - | ViewBlocked - | ViewDetached - | ViewNotFound - | ViewRecord - | AppBskyFeedDefs.GeneratorView - | AppBskyGraphDefs.ListView - | AppBskyGraphDefs.StarterPackViewBasic - | AppBskyLabelerDefs.LabelerView - >; - } - interface ViewBlocked extends TypedBase { - author: AppBskyFeedDefs.BlockedAuthor; - blocked: boolean; - uri: At.Uri; - } - interface ViewDetached extends TypedBase { - detached: boolean; - uri: At.Uri; - } - interface ViewNotFound extends TypedBase { - notFound: boolean; - uri: At.Uri; - } - interface ViewRecord extends TypedBase { - author: AppBskyActorDefs.ProfileViewBasic; - cid: At.CID; - indexedAt: string; - uri: At.Uri; - /** The record data itself. */ - value: unknown; - embeds?: TypeUnion< - | AppBskyEmbedExternal.View - | AppBskyEmbedImages.View - | AppBskyEmbedRecord.View - | AppBskyEmbedRecordWithMedia.View - | AppBskyEmbedVideo.View - >[]; - labels?: ComAtprotoLabelDefs.Label[]; - likeCount?: number; - quoteCount?: number; - replyCount?: number; - repostCount?: number; - } -} - -export declare namespace AppBskyEmbedRecordWithMedia { - interface Main extends TypedBase { - media: TypeUnion< - | AppBskyEmbedExternal.Main - | AppBskyEmbedImages.Main - | AppBskyEmbedVideo.Main - >; - record: AppBskyEmbedRecord.Main; - } - interface View extends TypedBase { - media: TypeUnion< - | AppBskyEmbedExternal.View - | AppBskyEmbedImages.View - | AppBskyEmbedVideo.View - >; - record: AppBskyEmbedRecord.View; - } -} - -export declare namespace AppBskyEmbedVideo { - interface Main extends TypedBase { - video: At.Blob; - /** - * Alt text description of the video, for accessibility. - * Maximum string length: 10000 - * Maximum grapheme length: 1000 - */ - alt?: string; - aspectRatio?: AppBskyEmbedDefs.AspectRatio; - /** Maximum array length: 20 */ - captions?: Caption[]; - } - interface Caption extends TypedBase { - file: At.Blob; - lang: string; - } - interface View extends TypedBase { - cid: At.CID; - playlist: string; - /** - * Maximum string length: 10000 - * Maximum grapheme length: 1000 - */ - alt?: string; - aspectRatio?: AppBskyEmbedDefs.AspectRatio; - thumbnail?: string; - } -} - -export declare namespace AppBskyFeedDefs { - interface BlockedAuthor extends TypedBase { - did: At.DID; - viewer?: AppBskyActorDefs.ViewerState; - } - interface BlockedPost extends TypedBase { - author: BlockedAuthor; - blocked: boolean; - uri: At.Uri; - } - type ClickthroughAuthor = "app.bsky.feed.defs#clickthroughAuthor"; - type ClickthroughEmbed = "app.bsky.feed.defs#clickthroughEmbed"; - type ClickthroughItem = "app.bsky.feed.defs#clickthroughItem"; - type ClickthroughReposter = "app.bsky.feed.defs#clickthroughReposter"; - interface FeedViewPost extends TypedBase { - post: PostView; - /** - * Context provided by feed generator that may be passed back alongside interactions. - * Maximum string length: 2000 - */ - feedContext?: string; - reason?: TypeUnion; - reply?: ReplyRef; - } - interface GeneratorView extends TypedBase { - cid: At.CID; - creator: AppBskyActorDefs.ProfileView; - did: At.DID; - displayName: string; - indexedAt: string; - uri: At.Uri; - acceptsInteractions?: boolean; - avatar?: string; - /** - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - description?: string; - descriptionFacets?: AppBskyRichtextFacet.Main[]; - labels?: ComAtprotoLabelDefs.Label[]; - /** Minimum: 0 */ - likeCount?: number; - viewer?: GeneratorViewerState; - } - interface GeneratorViewerState extends TypedBase { - like?: At.Uri; - } - interface Interaction extends TypedBase { - event?: - | "app.bsky.feed.defs#clickthroughAuthor" - | "app.bsky.feed.defs#clickthroughEmbed" - | "app.bsky.feed.defs#clickthroughItem" - | "app.bsky.feed.defs#clickthroughReposter" - | "app.bsky.feed.defs#interactionLike" - | "app.bsky.feed.defs#interactionQuote" - | "app.bsky.feed.defs#interactionReply" - | "app.bsky.feed.defs#interactionRepost" - | "app.bsky.feed.defs#interactionSeen" - | "app.bsky.feed.defs#interactionShare" - | "app.bsky.feed.defs#requestLess" - | "app.bsky.feed.defs#requestMore" - | (string & {}); - /** - * Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. - * Maximum string length: 2000 - */ - feedContext?: string; - item?: At.Uri; - } - type InteractionLike = "app.bsky.feed.defs#interactionLike"; - type InteractionQuote = "app.bsky.feed.defs#interactionQuote"; - type InteractionReply = "app.bsky.feed.defs#interactionReply"; - type InteractionRepost = "app.bsky.feed.defs#interactionRepost"; - type InteractionSeen = "app.bsky.feed.defs#interactionSeen"; - type InteractionShare = "app.bsky.feed.defs#interactionShare"; - interface NotFoundPost extends TypedBase { - notFound: boolean; - uri: At.Uri; - } - interface PostView extends TypedBase { - author: AppBskyActorDefs.ProfileViewBasic; - cid: At.CID; - indexedAt: string; - record: unknown; - uri: At.Uri; - embed?: TypeUnion< - | AppBskyEmbedExternal.View - | AppBskyEmbedImages.View - | AppBskyEmbedRecord.View - | AppBskyEmbedRecordWithMedia.View - | AppBskyEmbedVideo.View - >; - labels?: ComAtprotoLabelDefs.Label[]; - likeCount?: number; - quoteCount?: number; - replyCount?: number; - repostCount?: number; - threadgate?: ThreadgateView; - viewer?: ViewerState; - } - interface ReasonPin extends TypedBase {} - interface ReasonRepost extends TypedBase { - by: AppBskyActorDefs.ProfileViewBasic; - indexedAt: string; - } - interface ReplyRef extends TypedBase { - parent: TypeUnion; - root: TypeUnion; - /** When parent is a reply to another post, this is the author of that post. */ - grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic; - } - type RequestLess = "app.bsky.feed.defs#requestLess"; - type RequestMore = "app.bsky.feed.defs#requestMore"; - interface SkeletonFeedPost extends TypedBase { - post: At.Uri; - /** - * Context that will be passed through to client and may be passed to feed generator back alongside interactions. - * Maximum string length: 2000 - */ - feedContext?: string; - reason?: TypeUnion; - } - interface SkeletonReasonPin extends TypedBase {} - interface SkeletonReasonRepost extends TypedBase { - repost: At.Uri; - } - interface ThreadgateView extends TypedBase { - cid?: At.CID; - lists?: AppBskyGraphDefs.ListViewBasic[]; - record?: unknown; - uri?: At.Uri; - } - interface ThreadViewPost extends TypedBase { - post: PostView; - parent?: TypeUnion; - replies?: TypeUnion[]; - } - /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ - interface ViewerState extends TypedBase { - embeddingDisabled?: boolean; - like?: At.Uri; - pinned?: boolean; - replyDisabled?: boolean; - repost?: At.Uri; - threadMuted?: boolean; - } -} - -/** Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). */ -export declare namespace AppBskyFeedDescribeFeedGenerator { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - did: At.DID; - feeds: Feed[]; - links?: Links; - } - interface Feed extends TypedBase { - uri: At.Uri; - } - interface Links extends TypedBase { - privacyPolicy?: string; - termsOfService?: string; - } -} - -export declare namespace AppBskyFeedGenerator { - /** Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. */ - interface Record extends RecordBase { - $type: "app.bsky.feed.generator"; - createdAt: string; - did: At.DID; - /** - * Maximum string length: 240 - * Maximum grapheme length: 24 - */ - displayName: string; - /** Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions */ - acceptsInteractions?: boolean; - avatar?: At.Blob; - /** - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - description?: string; - descriptionFacets?: AppBskyRichtextFacet.Main[]; - /** Self-label values */ - labels?: TypeUnion; - } -} - -/** Get a list of feeds (feed generator records) created by the actor (in the actor's repo). */ -export declare namespace AppBskyFeedGetActorFeeds { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feeds: AppBskyFeedDefs.GeneratorView[]; - cursor?: string; - } -} - -/** Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. */ -export declare namespace AppBskyFeedGetActorLikes { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feed: AppBskyFeedDefs.FeedViewPost[]; - cursor?: string; - } - interface Errors extends TypedBase { - BlockedActor: {}; - BlockedByActor: {}; - } -} - -/** Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. */ -export declare namespace AppBskyFeedGetAuthorFeed { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Combinations of post/repost types to include in response. - * \@default "posts_with_replies" - */ - filter?: - | "posts_and_author_threads" - | "posts_no_replies" - | "posts_with_media" - | "posts_with_replies" - | (string & {}); - /** \@default false */ - includePins?: boolean; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feed: AppBskyFeedDefs.FeedViewPost[]; - cursor?: string; - } - interface Errors extends TypedBase { - BlockedActor: {}; - BlockedByActor: {}; - } -} - -/** Get a hydrated feed from an actor's selected feed generator. Implemented by App View. */ -export declare namespace AppBskyFeedGetFeed { - interface Params extends TypedBase { - feed: At.Uri; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feed: AppBskyFeedDefs.FeedViewPost[]; - cursor?: string; - } - interface Errors extends TypedBase { - UnknownFeed: {}; - } -} - -/** Get information about a feed generator. Implemented by AppView. */ -export declare namespace AppBskyFeedGetFeedGenerator { - interface Params extends TypedBase { - /** AT-URI of the feed generator record. */ - feed: At.Uri; - } - type Input = undefined; - interface Output extends TypedBase { - /** Indicates whether the feed generator service has been online recently, or else seems to be inactive. */ - isOnline: boolean; - /** Indicates whether the feed generator service is compatible with the record declaration. */ - isValid: boolean; - view: AppBskyFeedDefs.GeneratorView; - } -} - -/** Get information about a list of feed generators. */ -export declare namespace AppBskyFeedGetFeedGenerators { - interface Params extends TypedBase { - feeds: At.Uri[]; - } - type Input = undefined; - interface Output extends TypedBase { - feeds: AppBskyFeedDefs.GeneratorView[]; - } -} - -/** Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. */ -export declare namespace AppBskyFeedGetFeedSkeleton { - interface Params extends TypedBase { - /** Reference to feed generator record describing the specific feed being requested. */ - feed: At.Uri; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feed: AppBskyFeedDefs.SkeletonFeedPost[]; - cursor?: string; - } - interface Errors extends TypedBase { - UnknownFeed: {}; - } -} - -/** Get like records which reference a subject (by AT-URI and CID). */ -export declare namespace AppBskyFeedGetLikes { - interface Params extends TypedBase { - /** AT-URI of the subject (eg, a post record). */ - uri: At.Uri; - /** CID of the subject record (aka, specific version of record), to filter likes. */ - cid?: At.CID; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - likes: Like[]; - uri: At.Uri; - cid?: At.CID; - cursor?: string; - } - interface Like extends TypedBase { - actor: AppBskyActorDefs.ProfileView; - createdAt: string; - indexedAt: string; - } -} - -/** Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. */ -export declare namespace AppBskyFeedGetListFeed { - interface Params extends TypedBase { - /** Reference (AT-URI) to the list record. */ - list: At.Uri; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feed: AppBskyFeedDefs.FeedViewPost[]; - cursor?: string; - } - interface Errors extends TypedBase { - UnknownList: {}; - } -} - -/** Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. */ -export declare namespace AppBskyFeedGetPosts { - interface Params extends TypedBase { - /** - * List of post AT-URIs to return hydrated views for. - * Maximum array length: 25 - */ - uris: At.Uri[]; - } - type Input = undefined; - interface Output extends TypedBase { - posts: AppBskyFeedDefs.PostView[]; - } -} - -/** Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. */ -export declare namespace AppBskyFeedGetPostThread { - interface Params extends TypedBase { - /** Reference (AT-URI) to post record. */ - uri: At.Uri; - /** - * How many levels of reply depth should be included in response. - * Minimum: 0 - * Maximum: 1000 - * \@default 6 - */ - depth?: number; - /** - * How many levels of parent (and grandparent, etc) post to include. - * Minimum: 0 - * Maximum: 1000 - * \@default 80 - */ - parentHeight?: number; - } - type Input = undefined; - interface Output extends TypedBase { - thread: TypeUnion< - | AppBskyFeedDefs.BlockedPost - | AppBskyFeedDefs.NotFoundPost - | AppBskyFeedDefs.ThreadViewPost - >; - threadgate?: AppBskyFeedDefs.ThreadgateView; - } - interface Errors extends TypedBase { - NotFound: {}; - } -} - -/** Get a list of quotes for a given post. */ -export declare namespace AppBskyFeedGetQuotes { - interface Params extends TypedBase { - /** Reference (AT-URI) of post record */ - uri: At.Uri; - /** If supplied, filters to quotes of specific version (by CID) of the post record. */ - cid?: At.CID; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - posts: AppBskyFeedDefs.PostView[]; - uri: At.Uri; - cid?: At.CID; - cursor?: string; - } -} - -/** Get a list of reposts for a given post. */ -export declare namespace AppBskyFeedGetRepostedBy { - interface Params extends TypedBase { - /** Reference (AT-URI) of post record */ - uri: At.Uri; - /** If supplied, filters to reposts of specific version (by CID) of the post record. */ - cid?: At.CID; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - repostedBy: AppBskyActorDefs.ProfileView[]; - uri: At.Uri; - cid?: At.CID; - cursor?: string; - } -} - -/** Get a list of suggested feeds (feed generators) for the requesting account. */ -export declare namespace AppBskyFeedGetSuggestedFeeds { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feeds: AppBskyFeedDefs.GeneratorView[]; - cursor?: string; - } -} - -/** Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. */ -export declare namespace AppBskyFeedGetTimeline { - interface Params extends TypedBase { - /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ - algorithm?: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - feed: AppBskyFeedDefs.FeedViewPost[]; - cursor?: string; - } -} - -export declare namespace AppBskyFeedLike { - /** Record declaring a 'like' of a piece of subject content. */ - interface Record extends RecordBase { - $type: "app.bsky.feed.like"; - createdAt: string; - subject: ComAtprotoRepoStrongRef.Main; - } -} - -export declare namespace AppBskyFeedPost { - /** Record containing a Bluesky post. */ - interface Record extends RecordBase { - $type: "app.bsky.feed.post"; - /** Client-declared timestamp when this post was originally created. */ - createdAt: string; - /** - * The primary post content. May be an empty string, if there are embeds. - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - text: string; - embed?: TypeUnion< - | AppBskyEmbedExternal.Main - | AppBskyEmbedImages.Main - | AppBskyEmbedRecord.Main - | AppBskyEmbedRecordWithMedia.Main - | AppBskyEmbedVideo.Main - >; - /** - * DEPRECATED: replaced by app.bsky.richtext.facet. - * \@deprecated - */ - entities?: Entity[]; - /** Annotations of text (mentions, URLs, hashtags, etc) */ - facets?: AppBskyRichtextFacet.Main[]; - /** Self-label values for this post. Effectively content warnings. */ - labels?: TypeUnion; - /** - * Indicates human language of post primary text content. - * Maximum array length: 3 - */ - langs?: string[]; - reply?: ReplyRef; - /** - * Additional hashtags, in addition to any included in post text and facets. - * Maximum array length: 8 - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - tags?: string[]; - } - /** - * Deprecated: use facets instead. - * \@deprecated - */ - interface Entity extends TypedBase { - index: TextSlice; - /** Expected values are 'mention' and 'link'. */ - type: string; - value: string; - } - interface ReplyRef extends TypedBase { - parent: ComAtprotoRepoStrongRef.Main; - root: ComAtprotoRepoStrongRef.Main; - } - /** - * Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. - * \@deprecated - */ - interface TextSlice extends TypedBase { - /** Minimum: 0 */ - end: number; - /** Minimum: 0 */ - start: number; - } -} - -export declare namespace AppBskyFeedPostgate { - /** Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. */ - interface Record extends RecordBase { - $type: "app.bsky.feed.postgate"; - createdAt: string; - /** Reference (AT-URI) to the post record. */ - post: At.Uri; - /** - * List of AT-URIs embedding this post that the author has detached from. - * Maximum array length: 50 - */ - detachedEmbeddingUris?: At.Uri[]; - /** Maximum array length: 5 */ - embeddingRules?: TypeUnion[]; - } - /** Disables embedding of this post. */ - interface DisableRule extends TypedBase {} -} - -export declare namespace AppBskyFeedRepost { - /** Record representing a 'repost' of an existing Bluesky post. */ - interface Record extends RecordBase { - $type: "app.bsky.feed.repost"; - createdAt: string; - subject: ComAtprotoRepoStrongRef.Main; - } -} - -/** Find posts matching search criteria, returning views of those posts. */ -export declare namespace AppBskyFeedSearchPosts { - interface Params extends TypedBase { - /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ - q: string; - /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ - author?: string; - /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ - cursor?: string; - /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ - domain?: string; - /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ - lang?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 25 - */ - limit?: number; - /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ - mentions?: string; - /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ - since?: string; - /** - * Specifies the ranking order of results. - * \@default "latest" - */ - sort?: "latest" | "top" | (string & {}); - /** - * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - tag?: string[]; - /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ - until?: string; - /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ - url?: string; - } - type Input = undefined; - interface Output extends TypedBase { - posts: AppBskyFeedDefs.PostView[]; - cursor?: string; - /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ - hitsTotal?: number; - } - interface Errors extends TypedBase { - BadQueryString: {}; - } -} - -/** Send information about interactions with feed items back to the feed generator that served them. */ -export declare namespace AppBskyFeedSendInteractions { - interface Params extends TypedBase {} - interface Input extends TypedBase { - interactions: AppBskyFeedDefs.Interaction[]; - } - interface Output extends TypedBase {} -} - -export declare namespace AppBskyFeedThreadgate { - /** Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. */ - interface Record extends RecordBase { - $type: "app.bsky.feed.threadgate"; - createdAt: string; - /** Reference (AT-URI) to the post record. */ - post: At.Uri; - /** Maximum array length: 5 */ - allow?: TypeUnion[]; - /** - * List of hidden reply URIs. - * Maximum array length: 50 - */ - hiddenReplies?: At.Uri[]; - } - /** Allow replies from actors you follow. */ - interface FollowingRule extends TypedBase {} - /** Allow replies from actors on a list. */ - interface ListRule extends TypedBase { - list: At.Uri; - } - /** Allow replies from actors mentioned in your post. */ - interface MentionRule extends TypedBase {} -} - -export declare namespace AppBskyGraphBlock { - /** Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. */ - interface Record extends RecordBase { - $type: "app.bsky.graph.block"; - createdAt: string; - /** DID of the account to be blocked. */ - subject: At.DID; - } -} - -export declare namespace AppBskyGraphDefs { - type Curatelist = "app.bsky.graph.defs#curatelist"; - interface ListItemView extends TypedBase { - subject: AppBskyActorDefs.ProfileView; - uri: At.Uri; - } - type ListPurpose = - | "app.bsky.graph.defs#curatelist" - | "app.bsky.graph.defs#modlist" - | "app.bsky.graph.defs#referencelist" - | (string & {}); - interface ListView extends TypedBase { - cid: At.CID; - creator: AppBskyActorDefs.ProfileView; - indexedAt: string; - /** - * Minimum string length: 1 - * Maximum string length: 64 - */ - name: string; - purpose: ListPurpose; - uri: At.Uri; - avatar?: string; - /** - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - description?: string; - descriptionFacets?: AppBskyRichtextFacet.Main[]; - labels?: ComAtprotoLabelDefs.Label[]; - /** Minimum: 0 */ - listItemCount?: number; - viewer?: ListViewerState; - } - interface ListViewBasic extends TypedBase { - cid: At.CID; - /** - * Minimum string length: 1 - * Maximum string length: 64 - */ - name: string; - purpose: ListPurpose; - uri: At.Uri; - avatar?: string; - indexedAt?: string; - labels?: ComAtprotoLabelDefs.Label[]; - /** Minimum: 0 */ - listItemCount?: number; - viewer?: ListViewerState; - } - interface ListViewerState extends TypedBase { - blocked?: At.Uri; - muted?: boolean; - } - type Modlist = "app.bsky.graph.defs#modlist"; - /** indicates that a handle or DID could not be resolved */ - interface NotFoundActor extends TypedBase { - actor: string; - notFound: boolean; - } - type Referencelist = "app.bsky.graph.defs#referencelist"; - /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ - interface Relationship extends TypedBase { - did: At.DID; - /** if the actor is followed by this DID, contains the AT-URI of the follow record */ - followedBy?: At.Uri; - /** if the actor follows this DID, this is the AT-URI of the follow record */ - following?: At.Uri; - } - interface StarterPackView extends TypedBase { - cid: At.CID; - creator: AppBskyActorDefs.ProfileViewBasic; - indexedAt: string; - record: unknown; - uri: At.Uri; - /** Maximum array length: 3 */ - feeds?: AppBskyFeedDefs.GeneratorView[]; - /** Minimum: 0 */ - joinedAllTimeCount?: number; - /** Minimum: 0 */ - joinedWeekCount?: number; - labels?: ComAtprotoLabelDefs.Label[]; - list?: ListViewBasic; - /** Maximum array length: 12 */ - listItemsSample?: ListItemView[]; - } - interface StarterPackViewBasic extends TypedBase { - cid: At.CID; - creator: AppBskyActorDefs.ProfileViewBasic; - indexedAt: string; - record: unknown; - uri: At.Uri; - /** Minimum: 0 */ - joinedAllTimeCount?: number; - /** Minimum: 0 */ - joinedWeekCount?: number; - labels?: ComAtprotoLabelDefs.Label[]; - /** Minimum: 0 */ - listItemCount?: number; - } -} - -export declare namespace AppBskyGraphFollow { - /** Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. */ - interface Record extends RecordBase { - $type: "app.bsky.graph.follow"; - createdAt: string; - subject: At.DID; - } -} - -/** Get a list of starter packs created by the actor. */ -export declare namespace AppBskyGraphGetActorStarterPacks { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; - cursor?: string; - } -} - -/** Enumerates which accounts the requesting account is currently blocking. Requires auth. */ -export declare namespace AppBskyGraphGetBlocks { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - blocks: AppBskyActorDefs.ProfileView[]; - cursor?: string; - } -} - -/** Enumerates accounts which follow a specified account (actor). */ -export declare namespace AppBskyGraphGetFollowers { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - followers: AppBskyActorDefs.ProfileView[]; - subject: AppBskyActorDefs.ProfileView; - cursor?: string; - } -} - -/** Enumerates accounts which a specified account (actor) follows. */ -export declare namespace AppBskyGraphGetFollows { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - follows: AppBskyActorDefs.ProfileView[]; - subject: AppBskyActorDefs.ProfileView; - cursor?: string; - } -} - -/** Enumerates accounts which follow a specified account (actor) and are followed by the viewer. */ -export declare namespace AppBskyGraphGetKnownFollowers { - interface Params extends TypedBase { - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - followers: AppBskyActorDefs.ProfileView[]; - subject: AppBskyActorDefs.ProfileView; - cursor?: string; - } -} - -/** Gets a 'view' (with additional context) of a specified list. */ -export declare namespace AppBskyGraphGetList { - interface Params extends TypedBase { - /** Reference (AT-URI) of the list record to hydrate. */ - list: At.Uri; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - items: AppBskyGraphDefs.ListItemView[]; - list: AppBskyGraphDefs.ListView; - cursor?: string; - } -} - -/** Get mod lists that the requesting account (actor) is blocking. Requires auth. */ -export declare namespace AppBskyGraphGetListBlocks { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - lists: AppBskyGraphDefs.ListView[]; - cursor?: string; - } -} - -/** Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. */ -export declare namespace AppBskyGraphGetListMutes { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - lists: AppBskyGraphDefs.ListView[]; - cursor?: string; - } -} - -/** Enumerates the lists created by a specified account (actor). */ -export declare namespace AppBskyGraphGetLists { - interface Params extends TypedBase { - /** The account (actor) to enumerate lists from. */ - actor: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - lists: AppBskyGraphDefs.ListView[]; - cursor?: string; - } -} - -/** Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. */ -export declare namespace AppBskyGraphGetMutes { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - mutes: AppBskyActorDefs.ProfileView[]; - cursor?: string; - } -} - -/** Enumerates public relationships between one account, and a list of other accounts. Does not require auth. */ -export declare namespace AppBskyGraphGetRelationships { - interface Params extends TypedBase { - /** Primary account requesting relationships for. */ - actor: string; - /** - * List of 'other' accounts to be related back to the primary. - * Maximum array length: 30 - */ - others?: string[]; - } - type Input = undefined; - interface Output extends TypedBase { - relationships: TypeUnion< - AppBskyGraphDefs.NotFoundActor | AppBskyGraphDefs.Relationship - >[]; - actor?: At.DID; - } - interface Errors extends TypedBase { - ActorNotFound: {}; - } -} - -/** Gets a view of a starter pack. */ -export declare namespace AppBskyGraphGetStarterPack { - interface Params extends TypedBase { - /** Reference (AT-URI) of the starter pack record. */ - starterPack: At.Uri; - } - type Input = undefined; - interface Output extends TypedBase { - starterPack: AppBskyGraphDefs.StarterPackView; - } -} - -/** Get views for a list of starter packs. */ -export declare namespace AppBskyGraphGetStarterPacks { - interface Params extends TypedBase { - /** Maximum array length: 25 */ - uris: At.Uri[]; - } - type Input = undefined; - interface Output extends TypedBase { - starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; - } -} - -/** Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. */ -export declare namespace AppBskyGraphGetSuggestedFollowsByActor { - interface Params extends TypedBase { - actor: string; - } - type Input = undefined; - interface Output extends TypedBase { - suggestions: AppBskyActorDefs.ProfileView[]; - /** - * If true, response has fallen-back to generic results, and is not scoped using relativeToDid - * \@default false - */ - isFallback?: boolean; - } -} - -export declare namespace AppBskyGraphList { - /** Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. */ - interface Record extends RecordBase { - $type: "app.bsky.graph.list"; - createdAt: string; - /** - * Display name for list; can not be empty. - * Minimum string length: 1 - * Maximum string length: 64 - */ - name: string; - /** Defines the purpose of the list (aka, moderation-oriented or curration-oriented) */ - purpose: AppBskyGraphDefs.ListPurpose; - avatar?: At.Blob; - /** - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - description?: string; - descriptionFacets?: AppBskyRichtextFacet.Main[]; - labels?: TypeUnion; - } -} - -export declare namespace AppBskyGraphListblock { - /** Record representing a block relationship against an entire an entire list of accounts (actors). */ - interface Record extends RecordBase { - $type: "app.bsky.graph.listblock"; - createdAt: string; - /** Reference (AT-URI) to the mod list record. */ - subject: At.Uri; - } -} - -export declare namespace AppBskyGraphListitem { - /** Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. */ - interface Record extends RecordBase { - $type: "app.bsky.graph.listitem"; - createdAt: string; - /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ - list: At.Uri; - /** The account which is included on the list. */ - subject: At.DID; - } -} - -/** Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. */ -export declare namespace AppBskyGraphMuteActor { - interface Params extends TypedBase {} - interface Input extends TypedBase { - actor: string; - } - type Output = undefined; -} - -/** Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. */ -export declare namespace AppBskyGraphMuteActorList { - interface Params extends TypedBase {} - interface Input extends TypedBase { - list: At.Uri; - } - type Output = undefined; -} - -/** Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. */ -export declare namespace AppBskyGraphMuteThread { - interface Params extends TypedBase {} - interface Input extends TypedBase { - root: At.Uri; - } - type Output = undefined; -} - -/** Find starter packs matching search criteria. Does not require auth. */ -export declare namespace AppBskyGraphSearchStarterPacks { - interface Params extends TypedBase { - /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ - q: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 25 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; - cursor?: string; - } -} - -export declare namespace AppBskyGraphStarterpack { - /** Record defining a starter pack of actors and feeds for new users. */ - interface Record extends RecordBase { - $type: "app.bsky.graph.starterpack"; - createdAt: string; - /** Reference (AT-URI) to the list record. */ - list: At.Uri; - /** - * Display name for starter pack; can not be empty. - * Minimum string length: 1 - * Maximum string length: 500 - * Maximum grapheme length: 50 - */ - name: string; - /** - * Maximum string length: 3000 - * Maximum grapheme length: 300 - */ - description?: string; - descriptionFacets?: AppBskyRichtextFacet.Main[]; - /** Maximum array length: 3 */ - feeds?: FeedItem[]; - } - interface FeedItem extends TypedBase { - uri: At.Uri; - } -} - -/** Unmutes the specified account. Requires auth. */ -export declare namespace AppBskyGraphUnmuteActor { - interface Params extends TypedBase {} - interface Input extends TypedBase { - actor: string; - } - type Output = undefined; -} - -/** Unmutes the specified list of accounts. Requires auth. */ -export declare namespace AppBskyGraphUnmuteActorList { - interface Params extends TypedBase {} - interface Input extends TypedBase { - list: At.Uri; - } - type Output = undefined; -} - -/** Unmutes the specified thread. Requires auth. */ -export declare namespace AppBskyGraphUnmuteThread { - interface Params extends TypedBase {} - interface Input extends TypedBase { - root: At.Uri; - } - type Output = undefined; -} - -export declare namespace AppBskyLabelerDefs { - interface LabelerPolicies extends TypedBase { - /** The label values which this labeler publishes. May include global or custom labels. */ - labelValues: ComAtprotoLabelDefs.LabelValue[]; - /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ - labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; - } - interface LabelerView extends TypedBase { - cid: At.CID; - creator: AppBskyActorDefs.ProfileView; - indexedAt: string; - uri: At.Uri; - labels?: ComAtprotoLabelDefs.Label[]; - /** Minimum: 0 */ - likeCount?: number; - viewer?: LabelerViewerState; - } - interface LabelerViewDetailed extends TypedBase { - cid: At.CID; - creator: AppBskyActorDefs.ProfileView; - indexedAt: string; - policies: AppBskyLabelerDefs.LabelerPolicies; - uri: At.Uri; - labels?: ComAtprotoLabelDefs.Label[]; - /** Minimum: 0 */ - likeCount?: number; - viewer?: LabelerViewerState; - } - interface LabelerViewerState extends TypedBase { - like?: At.Uri; - } -} - -/** Get information about a list of labeler services. */ -export declare namespace AppBskyLabelerGetServices { - interface Params extends TypedBase { - dids: At.DID[]; - /** \@default false */ - detailed?: boolean; - } - type Input = undefined; - interface Output extends TypedBase { - views: TypeUnion< - AppBskyLabelerDefs.LabelerView | AppBskyLabelerDefs.LabelerViewDetailed - >[]; - } -} - -export declare namespace AppBskyLabelerService { - /** A declaration of the existence of labeler service. */ - interface Record extends RecordBase { - $type: "app.bsky.labeler.service"; - createdAt: string; - policies: AppBskyLabelerDefs.LabelerPolicies; - labels?: TypeUnion; - } -} - -/** Count the number of unread notifications for the requesting account. Requires auth. */ -export declare namespace AppBskyNotificationGetUnreadCount { - interface Params extends TypedBase { - priority?: boolean; - seenAt?: string; - } - type Input = undefined; - interface Output extends TypedBase { - count: number; - } -} - -/** Enumerate notifications for the requesting account. Requires auth. */ -export declare namespace AppBskyNotificationListNotifications { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - priority?: boolean; - seenAt?: string; - } - type Input = undefined; - interface Output extends TypedBase { - notifications: Notification[]; - cursor?: string; - priority?: boolean; - seenAt?: string; - } - interface Notification extends TypedBase { - author: AppBskyActorDefs.ProfileView; - cid: At.CID; - indexedAt: string; - isRead: boolean; - /** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', and 'starterpack-joined'. */ - reason: - | "follow" - | "like" - | "mention" - | "quote" - | "reply" - | "repost" - | "starterpack-joined" - | (string & {}); - record: unknown; - uri: At.Uri; - labels?: ComAtprotoLabelDefs.Label[]; - reasonSubject?: At.Uri; - } -} - -/** Set notification-related preferences for an account. Requires auth. */ -export declare namespace AppBskyNotificationPutPreferences { - interface Params extends TypedBase {} - interface Input extends TypedBase { - priority: boolean; - } - type Output = undefined; -} - -/** Register to receive push notifications, via a specified service, for the requesting account. Requires auth. */ -export declare namespace AppBskyNotificationRegisterPush { - interface Params extends TypedBase {} - interface Input extends TypedBase { - appId: string; - platform: "android" | "ios" | "web" | (string & {}); - serviceDid: At.DID; - token: string; - } - type Output = undefined; -} - -/** Notify server that the requesting account has seen notifications. Requires auth. */ -export declare namespace AppBskyNotificationUpdateSeen { - interface Params extends TypedBase {} - interface Input extends TypedBase { - seenAt: string; - } - type Output = undefined; -} - -export declare namespace AppBskyRichtextFacet { - /** Annotation of a sub-string within rich text. */ - interface Main extends TypedBase { - features: TypeUnion[]; - index: ByteSlice; - } - /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ - interface ByteSlice extends TypedBase { - /** Minimum: 0 */ - byteEnd: number; - /** Minimum: 0 */ - byteStart: number; - } - /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ - interface Link extends TypedBase { - uri: string; - } - /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ - interface Mention extends TypedBase { - did: At.DID; - } - /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ - interface Tag extends TypedBase { - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - tag: string; - } -} - -export declare namespace AppBskyUnspeccedDefs { - interface SkeletonSearchActor extends TypedBase { - did: At.DID; - } - interface SkeletonSearchPost extends TypedBase { - uri: At.Uri; - } - interface SkeletonSearchStarterPack extends TypedBase { - uri: At.Uri; - } -} - -/** Get miscellaneous runtime configuration. */ -export declare namespace AppBskyUnspeccedGetConfig { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - checkEmailConfirmed?: boolean; - } -} - -/** An unspecced view of globally popular feed generators. */ -export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - query?: string; - } - type Input = undefined; - interface Output extends TypedBase { - feeds: AppBskyFeedDefs.GeneratorView[]; - cursor?: string; - } -} - -/** Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions */ -export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - /** DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. */ - relativeToDid?: At.DID; - /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ - viewer?: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; - cursor?: string; - /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ - relativeToDid?: At.DID; - } -} - -/** Get a list of suggestions (feeds and users) tagged with categories */ -export declare namespace AppBskyUnspeccedGetTaggedSuggestions { - type Input = undefined; - interface Output extends TypedBase { - suggestions: Suggestion[]; - } - interface Suggestion extends TypedBase { - subject: string; - subjectType: "actor" | "feed" | (string & {}); - tag: string; - } -} - -/** Backend Actors (profile) search, returns only skeleton. */ -export declare namespace AppBskyUnspeccedSearchActorsSkeleton { - interface Params extends TypedBase { - /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ - q: string; - /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 25 - */ - limit?: number; - /** If true, acts as fast/simple 'typeahead' query. */ - typeahead?: boolean; - /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ - viewer?: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; - cursor?: string; - /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ - hitsTotal?: number; - } - interface Errors extends TypedBase { - BadQueryString: {}; - } -} - -/** Backend Posts search, returns only skeleton */ -export declare namespace AppBskyUnspeccedSearchPostsSkeleton { - interface Params extends TypedBase { - /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ - q: string; - /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ - author?: string; - /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ - cursor?: string; - /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ - domain?: string; - /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ - lang?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 25 - */ - limit?: number; - /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ - mentions?: string; - /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ - since?: string; - /** - * Specifies the ranking order of results. - * \@default "latest" - */ - sort?: "latest" | "top" | (string & {}); - /** - * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - tag?: string[]; - /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ - until?: string; - /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ - url?: string; - /** DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries. */ - viewer?: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]; - cursor?: string; - /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ - hitsTotal?: number; - } - interface Errors extends TypedBase { - BadQueryString: {}; - } -} - -/** Backend Starter Pack search, returns only skeleton. */ -export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { - interface Params extends TypedBase { - /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ - q: string; - /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 25 - */ - limit?: number; - /** DID of the account making the request (not included for public/unauthenticated queries). */ - viewer?: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]; - cursor?: string; - /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ - hitsTotal?: number; - } - interface Errors extends TypedBase { - BadQueryString: {}; - } -} - -export declare namespace AppBskyVideoDefs { - interface JobStatus extends TypedBase { - did: At.DID; - jobId: string; - /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ - state: "JOB_STATE_COMPLETED" | "JOB_STATE_FAILED" | (string & {}); - blob?: At.Blob; - error?: string; - message?: string; - /** - * Progress within the current processing state. - * Minimum: 0 - * Maximum: 100 - */ - progress?: number; - } -} - -/** Get status details for a video processing job. */ -export declare namespace AppBskyVideoGetJobStatus { - interface Params extends TypedBase { - jobId: string; - } - type Input = undefined; - interface Output extends TypedBase { - jobStatus: AppBskyVideoDefs.JobStatus; - } -} - -/** Get video upload limits for the authenticated user. */ -export declare namespace AppBskyVideoGetUploadLimits { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - canUpload: boolean; - error?: string; - message?: string; - remainingDailyBytes?: number; - remainingDailyVideos?: number; - } -} - -/** Upload a video to be processed then stored on the PDS. */ -export declare namespace AppBskyVideoUploadVideo { - interface Params extends TypedBase {} - type Input = Blob | ArrayBufferView; - interface Output extends TypedBase { - jobStatus: AppBskyVideoDefs.JobStatus; - } -} - -export declare namespace ChatBskyActorDeclaration { - /** A declaration of a Bluesky chat account. */ - interface Record extends RecordBase { - $type: "chat.bsky.actor.declaration"; - allowIncoming: "all" | "following" | "none" | (string & {}); - } -} - -export declare namespace ChatBskyActorDefs { - interface ProfileViewBasic extends TypedBase { - did: At.DID; - handle: At.Handle; - associated?: AppBskyActorDefs.ProfileAssociated; - avatar?: string; - /** Set to true when the actor cannot actively participate in converations */ - chatDisabled?: boolean; - /** - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - displayName?: string; - labels?: ComAtprotoLabelDefs.Label[]; - viewer?: AppBskyActorDefs.ViewerState; - } -} - -export declare namespace ChatBskyActorDeleteAccount { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase {} -} - -export declare namespace ChatBskyActorExportAccountData { - interface Params extends TypedBase {} - type Input = undefined; - type Output = Uint8Array; -} - -export declare namespace ChatBskyConvoDefs { - interface ConvoView extends TypedBase { - id: string; - members: ChatBskyActorDefs.ProfileViewBasic[]; - muted: boolean; - rev: string; - unreadCount: number; - lastMessage?: TypeUnion; - opened?: boolean; - } - interface DeletedMessageView extends TypedBase { - id: string; - rev: string; - sender: MessageViewSender; - sentAt: string; - } - interface LogBeginConvo extends TypedBase { - convoId: string; - rev: string; - } - interface LogCreateMessage extends TypedBase { - convoId: string; - message: TypeUnion; - rev: string; - } - interface LogDeleteMessage extends TypedBase { - convoId: string; - message: TypeUnion; - rev: string; - } - interface LogLeaveConvo extends TypedBase { - convoId: string; - rev: string; - } - interface MessageInput extends TypedBase { - /** - * Maximum string length: 10000 - * Maximum grapheme length: 1000 - */ - text: string; - embed?: TypeUnion; - /** Annotations of text (mentions, URLs, hashtags, etc) */ - facets?: AppBskyRichtextFacet.Main[]; - } - interface MessageRef extends TypedBase { - convoId: string; - did: At.DID; - messageId: string; - } - interface MessageView extends TypedBase { - id: string; - rev: string; - sender: MessageViewSender; - sentAt: string; - /** - * Maximum string length: 10000 - * Maximum grapheme length: 1000 - */ - text: string; - embed?: TypeUnion; - /** Annotations of text (mentions, URLs, hashtags, etc) */ - facets?: AppBskyRichtextFacet.Main[]; - } - interface MessageViewSender extends TypedBase { - did: At.DID; - } -} - -export declare namespace ChatBskyConvoDeleteMessageForSelf { - interface Params extends TypedBase {} - interface Input extends TypedBase { - convoId: string; - messageId: string; - } - type Output = ChatBskyConvoDefs.DeletedMessageView; -} - -export declare namespace ChatBskyConvoGetConvo { - interface Params extends TypedBase { - convoId: string; - } - type Input = undefined; - interface Output extends TypedBase { - convo: ChatBskyConvoDefs.ConvoView; - } -} - -export declare namespace ChatBskyConvoGetConvoForMembers { - interface Params extends TypedBase { - /** - * Minimum array length: 1 - * Maximum array length: 10 - */ - members: At.DID[]; - } - type Input = undefined; - interface Output extends TypedBase { - convo: ChatBskyConvoDefs.ConvoView; - } -} - -export declare namespace ChatBskyConvoGetLog { - interface Params extends TypedBase { - cursor?: string; - } - type Input = undefined; - interface Output extends TypedBase { - logs: TypeUnion< - | ChatBskyConvoDefs.LogBeginConvo - | ChatBskyConvoDefs.LogCreateMessage - | ChatBskyConvoDefs.LogDeleteMessage - | ChatBskyConvoDefs.LogLeaveConvo - >[]; - cursor?: string; - } -} - -export declare namespace ChatBskyConvoGetMessages { - interface Params extends TypedBase { - convoId: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - messages: TypeUnion< - ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView - >[]; - cursor?: string; - } -} - -export declare namespace ChatBskyConvoLeaveConvo { - interface Params extends TypedBase {} - interface Input extends TypedBase { - convoId: string; - } - interface Output extends TypedBase { - convoId: string; - rev: string; - } -} - -export declare namespace ChatBskyConvoListConvos { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - convos: ChatBskyConvoDefs.ConvoView[]; - cursor?: string; - } -} - -export declare namespace ChatBskyConvoMuteConvo { - interface Params extends TypedBase {} - interface Input extends TypedBase { - convoId: string; - } - interface Output extends TypedBase { - convo: ChatBskyConvoDefs.ConvoView; - } -} - -export declare namespace ChatBskyConvoSendMessage { - interface Params extends TypedBase {} - interface Input extends TypedBase { - convoId: string; - message: ChatBskyConvoDefs.MessageInput; - } - type Output = ChatBskyConvoDefs.MessageView; -} - -export declare namespace ChatBskyConvoSendMessageBatch { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Maximum array length: 100 */ - items: BatchItem[]; - } - interface Output extends TypedBase { - items: ChatBskyConvoDefs.MessageView[]; - } - interface BatchItem extends TypedBase { - convoId: string; - message: ChatBskyConvoDefs.MessageInput; - } -} - -export declare namespace ChatBskyConvoUnmuteConvo { - interface Params extends TypedBase {} - interface Input extends TypedBase { - convoId: string; - } - interface Output extends TypedBase { - convo: ChatBskyConvoDefs.ConvoView; - } -} - -export declare namespace ChatBskyConvoUpdateRead { - interface Params extends TypedBase {} - interface Input extends TypedBase { - convoId: string; - messageId?: string; - } - interface Output extends TypedBase { - convo: ChatBskyConvoDefs.ConvoView; - } -} - -export declare namespace ChatBskyModerationGetActorMetadata { - interface Params extends TypedBase { - actor: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - all: Metadata; - day: Metadata; - month: Metadata; - } - interface Metadata extends TypedBase { - convos: number; - convosStarted: number; - messagesReceived: number; - messagesSent: number; - } -} - -export declare namespace ChatBskyModerationGetMessageContext { - interface Params extends TypedBase { - messageId: string; - /** \@default 5 */ - after?: number; - /** \@default 5 */ - before?: number; - /** Conversation that the message is from. NOTE: this field will eventually be required. */ - convoId?: string; - } - type Input = undefined; - interface Output extends TypedBase { - messages: TypeUnion< - ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView - >[]; - } -} - -export declare namespace ChatBskyModerationUpdateActorAccess { - interface Params extends TypedBase {} - interface Input extends TypedBase { - actor: At.DID; - allowAccess: boolean; - ref?: string; - } - type Output = undefined; -} - -export declare namespace ComAtprotoAdminDefs { - interface AccountView extends TypedBase { - did: At.DID; - handle: At.Handle; - indexedAt: string; - deactivatedAt?: string; - email?: string; - emailConfirmedAt?: string; - invitedBy?: ComAtprotoServerDefs.InviteCode; - inviteNote?: string; - invites?: ComAtprotoServerDefs.InviteCode[]; - invitesDisabled?: boolean; - relatedRecords?: unknown[]; - threatSignatures?: ThreatSignature[]; - } - interface RepoBlobRef extends TypedBase { - cid: At.CID; - did: At.DID; - recordUri?: At.Uri; - } - interface RepoRef extends TypedBase { - did: At.DID; - } - interface StatusAttr extends TypedBase { - applied: boolean; - ref?: string; - } - interface ThreatSignature extends TypedBase { - property: string; - value: string; - } -} - -/** Delete a user account as an administrator. */ -export declare namespace ComAtprotoAdminDeleteAccount { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - } - type Output = undefined; -} - -/** Disable an account from receiving new invite codes, but does not invalidate existing codes. */ -export declare namespace ComAtprotoAdminDisableAccountInvites { - interface Params extends TypedBase {} - interface Input extends TypedBase { - account: At.DID; - /** Optional reason for disabled invites. */ - note?: string; - } - type Output = undefined; -} - -/** Disable some set of codes and/or all codes associated with a set of users. */ -export declare namespace ComAtprotoAdminDisableInviteCodes { - interface Params extends TypedBase {} - interface Input extends TypedBase { - accounts?: string[]; - codes?: string[]; - } - type Output = undefined; -} - -/** Re-enable an account's ability to receive invite codes. */ -export declare namespace ComAtprotoAdminEnableAccountInvites { - interface Params extends TypedBase {} - interface Input extends TypedBase { - account: At.DID; - /** Optional reason for enabled invites. */ - note?: string; - } - type Output = undefined; -} - -/** Get details about an account. */ -export declare namespace ComAtprotoAdminGetAccountInfo { - interface Params extends TypedBase { - did: At.DID; - } - type Input = undefined; - type Output = ComAtprotoAdminDefs.AccountView; -} - -/** Get details about some accounts. */ -export declare namespace ComAtprotoAdminGetAccountInfos { - interface Params extends TypedBase { - dids: At.DID[]; - } - type Input = undefined; - interface Output extends TypedBase { - infos: ComAtprotoAdminDefs.AccountView[]; - } -} - -/** Get an admin view of invite codes. */ -export declare namespace ComAtprotoAdminGetInviteCodes { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 500 - * \@default 100 - */ - limit?: number; - /** \@default "recent" */ - sort?: "recent" | "usage" | (string & {}); - } - type Input = undefined; - interface Output extends TypedBase { - codes: ComAtprotoServerDefs.InviteCode[]; - cursor?: string; - } -} - -/** Get the service-specific admin status of a subject (account, record, or blob). */ -export declare namespace ComAtprotoAdminGetSubjectStatus { - interface Params extends TypedBase { - blob?: At.CID; - did?: At.DID; - uri?: At.Uri; - } - type Input = undefined; - interface Output extends TypedBase { - subject: TypeUnion< - | ComAtprotoAdminDefs.RepoBlobRef - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - >; - deactivated?: ComAtprotoAdminDefs.StatusAttr; - takedown?: ComAtprotoAdminDefs.StatusAttr; - } -} - -/** Get list of accounts that matches your search query. */ -export declare namespace ComAtprotoAdminSearchAccounts { - interface Params extends TypedBase { - cursor?: string; - email?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - accounts: ComAtprotoAdminDefs.AccountView[]; - cursor?: string; - } -} - -/** Send email to a user's account email address. */ -export declare namespace ComAtprotoAdminSendEmail { - interface Params extends TypedBase {} - interface Input extends TypedBase { - content: string; - recipientDid: At.DID; - senderDid: At.DID; - /** Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers */ - comment?: string; - subject?: string; - } - interface Output extends TypedBase { - sent: boolean; - } -} - -/** Administrative action to update an account's email. */ -export declare namespace ComAtprotoAdminUpdateAccountEmail { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The handle or DID of the repo. */ - account: string; - email: string; - } - type Output = undefined; -} - -/** Administrative action to update an account's handle. */ -export declare namespace ComAtprotoAdminUpdateAccountHandle { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - handle: At.Handle; - } - type Output = undefined; -} - -/** Update the password for a user account as an administrator. */ -export declare namespace ComAtprotoAdminUpdateAccountPassword { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - password: string; - } - type Output = undefined; -} - -/** Update the service-specific admin status of a subject (account, record, or blob). */ -export declare namespace ComAtprotoAdminUpdateSubjectStatus { - interface Params extends TypedBase {} - interface Input extends TypedBase { - subject: TypeUnion< - | ComAtprotoAdminDefs.RepoBlobRef - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - >; - deactivated?: ComAtprotoAdminDefs.StatusAttr; - takedown?: ComAtprotoAdminDefs.StatusAttr; - } - interface Output extends TypedBase { - subject: TypeUnion< - | ComAtprotoAdminDefs.RepoBlobRef - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - >; - takedown?: ComAtprotoAdminDefs.StatusAttr; - } -} - -/** Describe the credentials that should be included in the DID doc of an account that is migrating to this service. */ -export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - alsoKnownAs?: string[]; - /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ - rotationKeys?: string[]; - services?: unknown; - verificationMethods?: unknown; - } -} - -/** Request an email with a code to in order to request a signed PLC operation. Requires Auth. */ -export declare namespace ComAtprotoIdentityRequestPlcOperationSignature { - interface Params extends TypedBase {} - type Input = undefined; - type Output = undefined; -} - -/** Resolves a handle (domain name) to a DID. */ -export declare namespace ComAtprotoIdentityResolveHandle { - interface Params extends TypedBase { - /** The handle to resolve. */ - handle: At.Handle; - } - type Input = undefined; - interface Output extends TypedBase { - did: At.DID; - } -} - -/** Signs a PLC operation to update some value(s) in the requesting DID's document. */ -export declare namespace ComAtprotoIdentitySignPlcOperation { - interface Params extends TypedBase {} - interface Input extends TypedBase { - alsoKnownAs?: string[]; - rotationKeys?: string[]; - services?: unknown; - /** A token received through com.atproto.identity.requestPlcOperationSignature */ - token?: string; - verificationMethods?: unknown; - } - interface Output extends TypedBase { - /** A signed DID PLC operation. */ - operation: unknown; - } -} - -/** Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry */ -export declare namespace ComAtprotoIdentitySubmitPlcOperation { - interface Params extends TypedBase {} - interface Input extends TypedBase { - operation: unknown; - } - type Output = undefined; -} - -/** Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. */ -export declare namespace ComAtprotoIdentityUpdateHandle { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The new handle. */ - handle: At.Handle; - } - type Output = undefined; -} - -export declare namespace ComAtprotoLabelDefs { - /** Metadata tag on an atproto resource (eg, repo or record). */ - interface Label extends TypedBase { - /** Timestamp when this label was created. */ - cts: string; - /** DID of the actor who created this label. */ - src: At.DID; - /** AT URI of the record, repository (account), or other resource that this label applies to. */ - uri: string; - /** - * The short string name of the value or type of this label. - * Maximum string length: 128 - */ - val: string; - /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */ - cid?: At.CID; - /** Timestamp at which this label expires (no longer applies). */ - exp?: string; - /** If true, this is a negation label, overwriting a previous label. */ - neg?: boolean; - /** Signature of dag-cbor encoded label. */ - sig?: At.Bytes; - /** The AT Protocol version of the label object. */ - ver?: number; - } - type LabelValue = - | "!hide" - | "!no-promote" - | "!no-unauthenticated" - | "!warn" - | "dmca-violation" - | "doxxing" - | "gore" - | "nsfl" - | "nudity" - | "porn" - | "sexual" - | (string & {}); - /** Declares a label value and its expected interpretations and behaviors. */ - interface LabelValueDefinition extends TypedBase { - /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ - blurs: "content" | "media" | "none" | (string & {}); - /** - * The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). - * Maximum string length: 100 - * Maximum grapheme length: 100 - */ - identifier: string; - locales: LabelValueDefinitionStrings[]; - /** How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. */ - severity: "alert" | "inform" | "none" | (string & {}); - /** Does the user need to have adult content enabled in order to configure this label? */ - adultOnly?: boolean; - /** - * The default setting for this label. - * \@default "warn" - */ - defaultSetting?: "hide" | "ignore" | "warn" | (string & {}); - } - /** Strings which describe the label in the UI, localized into a specific language. */ - interface LabelValueDefinitionStrings extends TypedBase { - /** - * A longer description of what the label means and why it might be applied. - * Maximum string length: 100000 - * Maximum grapheme length: 10000 - */ - description: string; - /** The code of the language these strings are written in. */ - lang: string; - /** - * A short human-readable name for the label. - * Maximum string length: 640 - * Maximum grapheme length: 64 - */ - name: string; - } - /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ - interface SelfLabel extends TypedBase { - /** - * The short string name of the value or type of this label. - * Maximum string length: 128 - */ - val: string; - } - /** Metadata tags on an atproto record, published by the author within the record. */ - interface SelfLabels extends TypedBase { - /** Maximum array length: 10 */ - values: SelfLabel[]; - } -} - -/** Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. */ -export declare namespace ComAtprotoLabelQueryLabels { - interface Params extends TypedBase { - /** 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. */ - uriPatterns: string[]; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 250 - * \@default 50 - */ - limit?: number; - /** Optional list of label sources (DIDs) to filter on. */ - sources?: At.DID[]; - } - type Input = undefined; - interface Output extends TypedBase { - labels: ComAtprotoLabelDefs.Label[]; - cursor?: string; - } -} - -export declare namespace ComAtprotoLabelSubscribeLabels { - interface Params extends TypedBase { - /** The last known event seq number to backfill from. */ - cursor?: number; - } - type Message = TypeUnion; - interface Errors extends TypedBase { - FutureCursor: {}; - } - interface Info extends TypedBase { - name: "OutdatedCursor" | (string & {}); - message?: string; - } - interface Labels extends TypedBase { - labels: ComAtprotoLabelDefs.Label[]; - seq: number; - } -} - -/** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */ -export declare namespace ComAtprotoModerationCreateReport { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Indicates the broad category of violation the report is for. */ - reasonType: ComAtprotoModerationDefs.ReasonType; - subject: TypeUnion< - ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main - >; - /** - * Additional context about the content and violation. - * Maximum string length: 20000 - * Maximum grapheme length: 2000 - */ - reason?: string; - } - interface Output extends TypedBase { - createdAt: string; - id: number; - reasonType: ComAtprotoModerationDefs.ReasonType; - reportedBy: At.DID; - subject: TypeUnion< - ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main - >; - /** - * Maximum string length: 20000 - * Maximum grapheme length: 2000 - */ - reason?: string; - } -} - -export declare namespace ComAtprotoModerationDefs { - type ReasonAppeal = "com.atproto.moderation.defs#reasonAppeal"; - type ReasonMisleading = "com.atproto.moderation.defs#reasonMisleading"; - type ReasonOther = "com.atproto.moderation.defs#reasonOther"; - type ReasonRude = "com.atproto.moderation.defs#reasonRude"; - type ReasonSexual = "com.atproto.moderation.defs#reasonSexual"; - type ReasonSpam = "com.atproto.moderation.defs#reasonSpam"; - type ReasonType = - | "com.atproto.moderation.defs#reasonAppeal" - | "com.atproto.moderation.defs#reasonMisleading" - | "com.atproto.moderation.defs#reasonOther" - | "com.atproto.moderation.defs#reasonRude" - | "com.atproto.moderation.defs#reasonSexual" - | "com.atproto.moderation.defs#reasonSpam" - | "com.atproto.moderation.defs#reasonViolation" - | (string & {}); - type ReasonViolation = "com.atproto.moderation.defs#reasonViolation"; -} - -/** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. */ -export declare namespace ComAtprotoRepoApplyWrites { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The handle or DID of the repo (aka, current account). */ - repo: string; - writes: TypeUnion[]; - /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */ - swapCommit?: At.CID; - /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */ - validate?: boolean; - } - interface Output extends TypedBase { - commit?: ComAtprotoRepoDefs.CommitMeta; - results?: TypeUnion[]; - } - interface Errors extends TypedBase { - InvalidSwap: {}; - } - /** Operation which creates a new record. */ - interface Create extends TypedBase { - collection: string; - value: unknown; - /** Maximum string length: 512 */ - rkey?: string; - } - interface CreateResult extends TypedBase { - cid: At.CID; - uri: At.Uri; - validationStatus?: "unknown" | "valid" | (string & {}); - } - /** Operation which deletes an existing record. */ - interface Delete extends TypedBase { - collection: string; - rkey: string; - } - interface DeleteResult extends TypedBase {} - /** Operation which updates an existing record. */ - interface Update extends TypedBase { - collection: string; - rkey: string; - value: unknown; - } - interface UpdateResult extends TypedBase { - cid: At.CID; - uri: At.Uri; - validationStatus?: "unknown" | "valid" | (string & {}); - } -} - -/** Create a single new repository record. Requires auth, implemented by PDS. */ -export declare namespace ComAtprotoRepoCreateRecord { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The NSID of the record collection. */ - collection: string; - /** The record itself. Must contain a $type field. */ - record: unknown; - /** The handle or DID of the repo (aka, current account). */ - repo: string; - /** - * The Record Key. - * Maximum string length: 512 - */ - rkey?: string; - /** Compare and swap with the previous commit by CID. */ - swapCommit?: At.CID; - /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ - validate?: boolean; - } - interface Output extends TypedBase { - cid: At.CID; - uri: At.Uri; - commit?: ComAtprotoRepoDefs.CommitMeta; - validationStatus?: "unknown" | "valid" | (string & {}); - } - interface Errors extends TypedBase { - InvalidSwap: {}; - } -} - -export declare namespace ComAtprotoRepoDefs { - interface CommitMeta extends TypedBase { - cid: At.CID; - rev: string; - } -} - -/** Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. */ -export declare namespace ComAtprotoRepoDeleteRecord { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The NSID of the record collection. */ - collection: string; - /** The handle or DID of the repo (aka, current account). */ - repo: string; - /** The Record Key. */ - rkey: string; - /** Compare and swap with the previous commit by CID. */ - swapCommit?: At.CID; - /** Compare and swap with the previous record by CID. */ - swapRecord?: At.CID; - } - interface Output extends TypedBase { - commit?: ComAtprotoRepoDefs.CommitMeta; - } - interface Errors extends TypedBase { - InvalidSwap: {}; - } -} - -/** Get information about an account and repository, including the list of collections. Does not require auth. */ -export declare namespace ComAtprotoRepoDescribeRepo { - interface Params extends TypedBase { - /** The handle or DID of the repo. */ - repo: string; - } - type Input = undefined; - interface Output extends TypedBase { - /** List of all the collections (NSIDs) for which this repo contains at least one record. */ - collections: string[]; - did: At.DID; - /** The complete DID document for this account. */ - didDoc: unknown; - handle: At.Handle; - /** Indicates if handle is currently valid (resolves bi-directionally) */ - handleIsCorrect: boolean; - } -} - -/** Get a single record from a repository. Does not require auth. */ -export declare namespace ComAtprotoRepoGetRecord { - interface Params extends TypedBase { - /** The NSID of the record collection. */ - collection: string; - /** The handle or DID of the repo. */ - repo: string; - /** The Record Key. */ - rkey: string; - /** The CID of the version of the record. If not specified, then return the most recent version. */ - cid?: At.CID; - } - type Input = undefined; - interface Output extends TypedBase { - uri: At.Uri; - value: unknown; - cid?: At.CID; - } - interface Errors extends TypedBase { - RecordNotFound: {}; - } -} - -/** Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. */ -export declare namespace ComAtprotoRepoImportRepo { - interface Params extends TypedBase {} - type Input = Blob | ArrayBufferView; - type Output = undefined; -} - -/** Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. */ -export declare namespace ComAtprotoRepoListMissingBlobs { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 1000 - * \@default 500 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - blobs: RecordBlob[]; - cursor?: string; - } - interface RecordBlob extends TypedBase { - cid: At.CID; - recordUri: At.Uri; - } -} - -/** List a range of records in a repository, matching a specific collection. Does not require auth. */ -export declare namespace ComAtprotoRepoListRecords { - interface Params extends TypedBase { - /** The NSID of the record type. */ - collection: string; - /** The handle or DID of the repo. */ - repo: string; - cursor?: string; - /** - * The number of records to return. - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - /** Flag to reverse the order of the returned records. */ - reverse?: boolean; - /** - * DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) - * \@deprecated - */ - rkeyEnd?: string; - /** - * DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) - * \@deprecated - */ - rkeyStart?: string; - } - type Input = undefined; - interface Output extends TypedBase { - records: Record[]; - cursor?: string; - } - interface Record extends TypedBase { - cid: At.CID; - uri: At.Uri; - value: unknown; - } -} - -/** Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. */ -export declare namespace ComAtprotoRepoPutRecord { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The NSID of the record collection. */ - collection: string; - /** The record to write. */ - record: unknown; - /** The handle or DID of the repo (aka, current account). */ - repo: string; - /** - * The Record Key. - * Maximum string length: 512 - */ - rkey: string; - /** Compare and swap with the previous commit by CID. */ - swapCommit?: At.CID; - /** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */ - swapRecord?: At.CID | null; - /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ - validate?: boolean; - } - interface Output extends TypedBase { - cid: At.CID; - uri: At.Uri; - commit?: ComAtprotoRepoDefs.CommitMeta; - validationStatus?: "unknown" | "valid" | (string & {}); - } - interface Errors extends TypedBase { - InvalidSwap: {}; - } -} - -export declare namespace ComAtprotoRepoStrongRef { - interface Main extends TypedBase { - cid: At.CID; - uri: At.Uri; - } -} - -/** Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. */ -export declare namespace ComAtprotoRepoUploadBlob { - interface Params extends TypedBase {} - type Input = Blob | ArrayBufferView; - interface Output extends TypedBase { - blob: At.Blob; - } -} - -/** Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. */ -export declare namespace ComAtprotoServerActivateAccount { - interface Params extends TypedBase {} - type Input = undefined; - type Output = undefined; -} - -/** Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. */ -export declare namespace ComAtprotoServerCheckAccountStatus { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - activated: boolean; - expectedBlobs: number; - importedBlobs: number; - indexedRecords: number; - privateStateValues: number; - repoBlocks: number; - repoCommit: At.CID; - repoRev: string; - validDid: boolean; - } -} - -/** Confirm an email using a token from com.atproto.server.requestEmailConfirmation. */ -export declare namespace ComAtprotoServerConfirmEmail { - interface Params extends TypedBase {} - interface Input extends TypedBase { - email: string; - token: string; - } - type Output = undefined; - interface Errors extends TypedBase { - AccountNotFound: {}; - ExpiredToken: {}; - InvalidToken: {}; - InvalidEmail: {}; - } -} - -/** Create an account. Implemented by PDS. */ -export declare namespace ComAtprotoServerCreateAccount { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Requested handle for the account. */ - handle: At.Handle; - /** Pre-existing atproto DID, being imported to a new account. */ - did?: At.DID; - email?: string; - inviteCode?: string; - /** Initial account password. May need to meet instance-specific password strength requirements. */ - password?: string; - /** A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. */ - plcOp?: unknown; - /** DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. */ - recoveryKey?: string; - verificationCode?: string; - verificationPhone?: string; - } - /** Account login session returned on successful account creation. */ - interface Output extends TypedBase { - accessJwt: string; - /** The DID of the new account. */ - did: At.DID; - handle: At.Handle; - refreshJwt: string; - /** Complete DID document. */ - didDoc?: unknown; - } - interface Errors extends TypedBase { - InvalidHandle: {}; - InvalidPassword: {}; - InvalidInviteCode: {}; - HandleNotAvailable: {}; - UnsupportedDomain: {}; - UnresolvableDid: {}; - IncompatibleDidDoc: {}; - } -} - -/** Create an App Password. */ -export declare namespace ComAtprotoServerCreateAppPassword { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** A short name for the App Password, to help distinguish them. */ - name: string; - /** If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. */ - privileged?: boolean; - } - type Output = AppPassword; - interface Errors extends TypedBase { - AccountTakedown: {}; - } - interface AppPassword extends TypedBase { - createdAt: string; - name: string; - password: string; - privileged?: boolean; - } -} - -/** Create an invite code. */ -export declare namespace ComAtprotoServerCreateInviteCode { - interface Params extends TypedBase {} - interface Input extends TypedBase { - useCount: number; - forAccount?: At.DID; - } - interface Output extends TypedBase { - code: string; - } -} - -/** Create invite codes. */ -export declare namespace ComAtprotoServerCreateInviteCodes { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** \@default 1 */ - codeCount: number; - useCount: number; - forAccounts?: At.DID[]; - } - interface Output extends TypedBase { - codes: AccountCodes[]; - } - interface AccountCodes extends TypedBase { - account: string; - codes: string[]; - } -} - -/** Create an authentication session. */ -export declare namespace ComAtprotoServerCreateSession { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Handle or other identifier supported by the server for the authenticating user. */ - identifier: string; - password: string; - authFactorToken?: string; - } - interface Output extends TypedBase { - accessJwt: string; - did: At.DID; - handle: At.Handle; - refreshJwt: string; - active?: boolean; - didDoc?: unknown; - email?: string; - emailAuthFactor?: boolean; - emailConfirmed?: boolean; - /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ - status?: "deactivated" | "suspended" | "takendown" | (string & {}); - } - interface Errors extends TypedBase { - AccountTakedown: {}; - AuthFactorTokenRequired: {}; - } -} - -/** Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. */ -export declare namespace ComAtprotoServerDeactivateAccount { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ - deleteAfter?: string; - } - type Output = undefined; -} - -export declare namespace ComAtprotoServerDefs { - interface InviteCode extends TypedBase { - available: number; - code: string; - createdAt: string; - createdBy: string; - disabled: boolean; - forAccount: string; - uses: InviteCodeUse[]; - } - interface InviteCodeUse extends TypedBase { - usedAt: string; - usedBy: At.DID; - } -} - -/** Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. */ -export declare namespace ComAtprotoServerDeleteAccount { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - password: string; - token: string; - } - type Output = undefined; - interface Errors extends TypedBase { - ExpiredToken: {}; - InvalidToken: {}; - } -} - -/** Delete the current session. Requires auth. */ -export declare namespace ComAtprotoServerDeleteSession { - interface Params extends TypedBase {} - type Input = undefined; - type Output = undefined; -} - -/** Describes the server's account creation requirements and capabilities. Implemented by PDS. */ -export declare namespace ComAtprotoServerDescribeServer { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - /** List of domain suffixes that can be used in account handles. */ - availableUserDomains: string[]; - did: At.DID; - /** Contact information */ - contact?: Contact; - /** If true, an invite code must be supplied to create an account on this instance. */ - inviteCodeRequired?: boolean; - /** URLs of service policy documents. */ - links?: Links; - /** If true, a phone verification token must be supplied to create an account on this instance. */ - phoneVerificationRequired?: boolean; - } - interface Contact extends TypedBase { - email?: string; - } - interface Links extends TypedBase { - privacyPolicy?: string; - termsOfService?: string; - } -} - -/** Get all invite codes for the current account. Requires auth. */ -export declare namespace ComAtprotoServerGetAccountInviteCodes { - interface Params extends TypedBase { - /** - * Controls whether any new 'earned' but not 'created' invites should be created. - * \@default true - */ - createAvailable?: boolean; - /** \@default true */ - includeUsed?: boolean; - } - type Input = undefined; - interface Output extends TypedBase { - codes: ComAtprotoServerDefs.InviteCode[]; - } - interface Errors extends TypedBase { - DuplicateCreate: {}; - } -} - -/** Get a signed token on behalf of the requesting DID for the requested service. */ -export declare namespace ComAtprotoServerGetServiceAuth { - interface Params extends TypedBase { - /** The DID of the service that the token will be used to authenticate with */ - aud: At.DID; - /** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */ - exp?: number; - /** Lexicon (XRPC) method to bind the requested token to */ - lxm?: string; - } - type Input = undefined; - interface Output extends TypedBase { - token: string; - } - interface Errors extends TypedBase { - BadExpiration: {}; - } -} - -/** Get information about the current auth session. Requires auth. */ -export declare namespace ComAtprotoServerGetSession { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - did: At.DID; - handle: At.Handle; - active?: boolean; - didDoc?: unknown; - email?: string; - emailAuthFactor?: boolean; - emailConfirmed?: boolean; - /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ - status?: "deactivated" | "suspended" | "takendown" | (string & {}); - } -} - -/** List all App Passwords. */ -export declare namespace ComAtprotoServerListAppPasswords { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - passwords: AppPassword[]; - } - interface Errors extends TypedBase { - AccountTakedown: {}; - } - interface AppPassword extends TypedBase { - createdAt: string; - name: string; - privileged?: boolean; - } -} - -/** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */ -export declare namespace ComAtprotoServerRefreshSession { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - accessJwt: string; - did: At.DID; - handle: At.Handle; - refreshJwt: string; - active?: boolean; - didDoc?: unknown; - /** Hosting status of the account. If not specified, then assume 'active'. */ - status?: "deactivated" | "suspended" | "takendown" | (string & {}); - } - interface Errors extends TypedBase { - AccountTakedown: {}; - } -} - -/** Initiate a user account deletion via email. */ -export declare namespace ComAtprotoServerRequestAccountDelete { - interface Params extends TypedBase {} - type Input = undefined; - type Output = undefined; -} - -/** Request an email with a code to confirm ownership of email. */ -export declare namespace ComAtprotoServerRequestEmailConfirmation { - interface Params extends TypedBase {} - type Input = undefined; - type Output = undefined; -} - -/** Request a token in order to update email. */ -export declare namespace ComAtprotoServerRequestEmailUpdate { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - tokenRequired: boolean; - } -} - -/** Initiate a user account password reset via email. */ -export declare namespace ComAtprotoServerRequestPasswordReset { - interface Params extends TypedBase {} - interface Input extends TypedBase { - email: string; - } - type Output = undefined; -} - -/** Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. */ -export declare namespace ComAtprotoServerReserveSigningKey { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** The DID to reserve a key for. */ - did?: At.DID; - } - interface Output extends TypedBase { - /** The public key for the reserved signing key, in did:key serialization. */ - signingKey: string; - } -} - -/** Reset a user account password using a token. */ -export declare namespace ComAtprotoServerResetPassword { - interface Params extends TypedBase {} - interface Input extends TypedBase { - password: string; - token: string; - } - type Output = undefined; - interface Errors extends TypedBase { - ExpiredToken: {}; - InvalidToken: {}; - } -} - -/** Revoke an App Password by name. */ -export declare namespace ComAtprotoServerRevokeAppPassword { - interface Params extends TypedBase {} - interface Input extends TypedBase { - name: string; - } - type Output = undefined; -} - -/** Update an account's email. */ -export declare namespace ComAtprotoServerUpdateEmail { - interface Params extends TypedBase {} - interface Input extends TypedBase { - email: string; - emailAuthFactor?: boolean; - /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */ - token?: string; - } - type Output = undefined; - interface Errors extends TypedBase { - ExpiredToken: {}; - InvalidToken: {}; - TokenRequired: {}; - } -} - -/** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */ -export declare namespace ComAtprotoSyncGetBlob { - interface Params extends TypedBase { - /** The CID of the blob to fetch */ - cid: At.CID; - /** The DID of the account. */ - did: At.DID; - } - type Input = undefined; - type Output = Uint8Array; - interface Errors extends TypedBase { - BlobNotFound: {}; - RepoNotFound: {}; - RepoTakendown: {}; - RepoSuspended: {}; - RepoDeactivated: {}; - } -} - -/** Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. */ -export declare namespace ComAtprotoSyncGetBlocks { - interface Params extends TypedBase { - cids: At.CID[]; - /** The DID of the repo. */ - did: At.DID; - } - type Input = undefined; - type Output = Uint8Array; - interface Errors extends TypedBase { - BlockNotFound: {}; - RepoNotFound: {}; - RepoTakendown: {}; - RepoSuspended: {}; - RepoDeactivated: {}; - } -} - -/** - * DEPRECATED - please use com.atproto.sync.getRepo instead - * \@deprecated - */ -export declare namespace ComAtprotoSyncGetCheckout { - interface Params extends TypedBase { - /** The DID of the repo. */ - did: At.DID; - } - type Input = undefined; - type Output = Uint8Array; -} - -/** - * DEPRECATED - please use com.atproto.sync.getLatestCommit instead - * \@deprecated - */ -export declare namespace ComAtprotoSyncGetHead { - interface Params extends TypedBase { - /** The DID of the repo. */ - did: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - root: At.CID; - } - interface Errors extends TypedBase { - HeadNotFound: {}; - } -} - -/** Get the current commit CID & revision of the specified repo. Does not require auth. */ -export declare namespace ComAtprotoSyncGetLatestCommit { - interface Params extends TypedBase { - /** The DID of the repo. */ - did: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - cid: At.CID; - rev: string; - } - interface Errors extends TypedBase { - RepoNotFound: {}; - RepoTakendown: {}; - RepoSuspended: {}; - RepoDeactivated: {}; - } -} - -/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */ -export declare namespace ComAtprotoSyncGetRecord { - interface Params extends TypedBase { - collection: string; - /** The DID of the repo. */ - did: At.DID; - /** Record Key */ - rkey: string; - /** - * DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit - * \@deprecated - */ - commit?: At.CID; - } - type Input = undefined; - type Output = Uint8Array; - interface Errors extends TypedBase { - RecordNotFound: {}; - RepoNotFound: {}; - RepoTakendown: {}; - RepoSuspended: {}; - RepoDeactivated: {}; - } -} - -/** Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. */ -export declare namespace ComAtprotoSyncGetRepo { - interface Params extends TypedBase { - /** The DID of the repo. */ - did: At.DID; - /** The revision ('rev') of the repo to create a diff from. */ - since?: string; - } - type Input = undefined; - type Output = Uint8Array; - interface Errors extends TypedBase { - RepoNotFound: {}; - RepoTakendown: {}; - RepoSuspended: {}; - RepoDeactivated: {}; - } -} - -/** Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. */ -export declare namespace ComAtprotoSyncGetRepoStatus { - interface Params extends TypedBase { - /** The DID of the repo. */ - did: At.DID; - } - type Input = undefined; - interface Output extends TypedBase { - active: boolean; - did: At.DID; - /** Optional field, the current rev of the repo, if active=true */ - rev?: string; - /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ - status?: "deactivated" | "suspended" | "takendown" | (string & {}); - } - interface Errors extends TypedBase { - RepoNotFound: {}; - } -} - -/** List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. */ -export declare namespace ComAtprotoSyncListBlobs { - interface Params extends TypedBase { - /** The DID of the repo. */ - did: At.DID; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 1000 - * \@default 500 - */ - limit?: number; - /** Optional revision of the repo to list blobs since. */ - since?: string; - } - type Input = undefined; - interface Output extends TypedBase { - cids: At.CID[]; - cursor?: string; - } - interface Errors extends TypedBase { - RepoNotFound: {}; - RepoTakendown: {}; - RepoSuspended: {}; - RepoDeactivated: {}; - } -} - -/** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */ -export declare namespace ComAtprotoSyncListRepos { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 1000 - * \@default 500 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - repos: Repo[]; - cursor?: string; - } - interface Repo extends TypedBase { - did: At.DID; - /** Current repo commit CID */ - head: At.CID; - rev: string; - active?: boolean; - /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ - status?: "deactivated" | "suspended" | "takendown" | (string & {}); - } -} - -/** Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. */ -export declare namespace ComAtprotoSyncNotifyOfUpdate { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Hostname of the current service (usually a PDS) that is notifying of update. */ - hostname: string; - } - type Output = undefined; -} - -/** Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. */ -export declare namespace ComAtprotoSyncRequestCrawl { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Hostname of the current service (eg, PDS) that is requesting to be crawled. */ - hostname: string; - } - type Output = undefined; -} - -export declare namespace ComAtprotoSyncSubscribeRepos { - interface Params extends TypedBase { - /** The last known event seq number to backfill from. */ - cursor?: number; - } - type Message = TypeUnion< - Account | Commit | Handle | Identity | Info | Migrate | Tombstone - >; - interface Errors extends TypedBase { - FutureCursor: {}; - ConsumerTooSlow: {}; - } - /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ - interface Account extends TypedBase { - /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ - active: boolean; - did: At.DID; - seq: number; - time: string; - /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | "deactivated" - | "deleted" - | "suspended" - | "takendown" - | (string & {}); - } - /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ - interface Commit extends TypedBase { - /** List of new blobs (by CID) referenced by records in this commit. */ - blobs: At.CIDLink[]; - /** CAR file containing relevant blocks, as a diff since the previous repo state. */ - blocks: At.Bytes; - /** Repo commit object CID. */ - commit: At.CIDLink; - /** - * Maximum array length: 200 - * List of repo mutation operations in this commit (eg, records created, updated, or deleted). - */ - ops: RepoOp[]; - /** - * DEPRECATED -- unused - * \@deprecated - */ - rebase: boolean; - /** The repo this event comes from. */ - repo: At.DID; - /** The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event. */ - rev: string; - /** The stream sequence number of this message. */ - seq: number; - /** The rev of the last emitted commit from this repo (if any). */ - since: string | null; - /** Timestamp of when this message was originally broadcast. */ - time: string; - /** Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data. */ - tooBig: boolean; - /** - * DEPRECATED -- unused. WARNING -- nullable and optional; stick with optional to ensure golang interoperability. - * \@deprecated - */ - prev?: At.CIDLink | null; - } - /** - * DEPRECATED -- Use #identity event instead - * \@deprecated - */ - interface Handle extends TypedBase { - did: At.DID; - handle: At.Handle; - seq: number; - time: string; - } - /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ - interface Identity extends TypedBase { - did: At.DID; - seq: number; - time: string; - /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ - handle?: At.Handle; - } - interface Info extends TypedBase { - name: "OutdatedCursor" | (string & {}); - message?: string; - } - /** - * DEPRECATED -- Use #account event instead - * \@deprecated - */ - interface Migrate extends TypedBase { - did: At.DID; - migrateTo: string | null; - seq: number; - time: string; - } - /** A repo operation, ie a mutation of a single record. */ - interface RepoOp extends TypedBase { - action: "create" | "delete" | "update" | (string & {}); - /** For creates and updates, the new record CID. For deletions, null. */ - cid: At.CIDLink | null; - path: string; - } - /** - * DEPRECATED -- Use #account event instead - * \@deprecated - */ - interface Tombstone extends TypedBase { - did: At.DID; - seq: number; - time: string; - } -} - -/** Add a handle to the set of reserved handles. */ -export declare namespace ComAtprotoTempAddReservedHandle { - interface Params extends TypedBase {} - interface Input extends TypedBase { - handle: string; - } - interface Output extends TypedBase {} -} - -/** Check accounts location in signup queue. */ -export declare namespace ComAtprotoTempCheckSignupQueue { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - activated: boolean; - estimatedTimeMs?: number; - placeInQueue?: number; - } -} - -/** - * DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date. - * \@deprecated - */ -export declare namespace ComAtprotoTempFetchLabels { - interface Params extends TypedBase { - /** - * Minimum: 1 - * Maximum: 250 - * \@default 50 - */ - limit?: number; - since?: number; - } - type Input = undefined; - interface Output extends TypedBase { - labels: ComAtprotoLabelDefs.Label[]; - } -} - -/** Request a verification code to be sent to the supplied phone number */ -export declare namespace ComAtprotoTempRequestPhoneVerification { - interface Params extends TypedBase {} - interface Input extends TypedBase { - phoneNumber: string; - } - type Output = undefined; -} - -/** Administrative action to create a new, re-usable communication (email for now) template. */ -export declare namespace ToolsOzoneCommunicationCreateTemplate { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Content of the template, markdown supported, can contain variable placeholders. */ - contentMarkdown: string; - /** Name of the template. */ - name: string; - /** Subject of the message, used in emails. */ - subject: string; - /** DID of the user who is creating the template. */ - createdBy?: At.DID; - /** Message language. */ - lang?: string; - } - type Output = ToolsOzoneCommunicationDefs.TemplateView; - interface Errors extends TypedBase { - DuplicateTemplateName: {}; - } -} - -export declare namespace ToolsOzoneCommunicationDefs { - interface TemplateView extends TypedBase { - /** Subject of the message, used in emails. */ - contentMarkdown: string; - createdAt: string; - disabled: boolean; - id: string; - /** DID of the user who last updated the template. */ - lastUpdatedBy: At.DID; - /** Name of the template. */ - name: string; - updatedAt: string; - /** Message language. */ - lang?: string; - /** Content of the template, can contain markdown and variable placeholders. */ - subject?: string; - } -} - -/** Delete a communication template. */ -export declare namespace ToolsOzoneCommunicationDeleteTemplate { - interface Params extends TypedBase {} - interface Input extends TypedBase { - id: string; - } - type Output = undefined; -} - -/** Get list of all communication templates. */ -export declare namespace ToolsOzoneCommunicationListTemplates { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - communicationTemplates: ToolsOzoneCommunicationDefs.TemplateView[]; - } -} - -/** Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. */ -export declare namespace ToolsOzoneCommunicationUpdateTemplate { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** ID of the template to be updated. */ - id: string; - /** Content of the template, markdown supported, can contain variable placeholders. */ - contentMarkdown?: string; - disabled?: boolean; - /** Message language. */ - lang?: string; - /** Name of the template. */ - name?: string; - /** Subject of the message, used in emails. */ - subject?: string; - /** DID of the user who is updating the template. */ - updatedBy?: At.DID; - } - type Output = ToolsOzoneCommunicationDefs.TemplateView; - interface Errors extends TypedBase { - DuplicateTemplateName: {}; - } -} - -export declare namespace ToolsOzoneModerationDefs { - /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface AccountEvent extends TypedBase { - /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ - active: boolean; - timestamp: string; - comment?: string; - status?: - | "deactivated" - | "deleted" - | "suspended" - | "takendown" - | "tombstoned" - | "unknown" - | (string & {}); - } - interface AccountHosting extends TypedBase { - status: - | "deactivated" - | "deleted" - | "suspended" - | "takendown" - | "unknown" - | (string & {}); - createdAt?: string; - deactivatedAt?: string; - deletedAt?: string; - reactivatedAt?: string; - updatedAt?: string; - } - interface BlobView extends TypedBase { - cid: At.CID; - createdAt: string; - mimeType: string; - size: number; - details?: TypeUnion; - moderation?: Moderation; - } - /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface IdentityEvent extends TypedBase { - timestamp: string; - comment?: string; - handle?: At.Handle; - pdsHost?: string; - tombstone?: boolean; - } - interface ImageDetails extends TypedBase { - height: number; - width: number; - } - interface Moderation extends TypedBase { - subjectStatus?: SubjectStatusView; - } - interface ModerationDetail extends TypedBase { - subjectStatus?: SubjectStatusView; - } - interface ModEventAcknowledge extends TypedBase { - comment?: string; - } - /** Add a comment to a subject */ - interface ModEventComment extends TypedBase { - comment: string; - /** Make the comment persistent on the subject */ - sticky?: boolean; - } - /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ - interface ModEventDivert extends TypedBase { - comment?: string; - } - /** Keep a log of outgoing email to a user */ - interface ModEventEmail extends TypedBase { - /** The subject line of the email sent to the user. */ - subjectLine: string; - /** Additional comment about the outgoing comm. */ - comment?: string; - /** The content of the email sent to the user. */ - content?: string; - } - interface ModEventEscalate extends TypedBase { - comment?: string; - } - /** Apply/Negate labels on a subject */ - interface ModEventLabel extends TypedBase { - createLabelVals: string[]; - negateLabelVals: string[]; - comment?: string; - } - /** Mute incoming reports on a subject */ - interface ModEventMute extends TypedBase { - /** Indicates how long the subject should remain muted. */ - durationInHours: number; - comment?: string; - } - /** Mute incoming reports from an account */ - interface ModEventMuteReporter extends TypedBase { - comment?: string; - /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ - durationInHours?: number; - } - /** Report a subject */ - interface ModEventReport extends TypedBase { - reportType: ComAtprotoModerationDefs.ReasonType; - comment?: string; - /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ - isReporterMuted?: boolean; - } - /** Resolve appeal on a subject */ - interface ModEventResolveAppeal extends TypedBase { - /** Describe resolution. */ - comment?: string; - } - /** Revert take down action on a subject */ - interface ModEventReverseTakedown extends TypedBase { - /** Describe reasoning behind the reversal. */ - comment?: string; - } - /** Add/Remove a tag on a subject */ - interface ModEventTag extends TypedBase { - /** Tags to be added to the subject. If already exists, won't be duplicated. */ - add: string[]; - /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ - remove: string[]; - /** Additional comment about added/removed tags. */ - comment?: string; - } - /** Take down a subject permanently or temporarily */ - interface ModEventTakedown extends TypedBase { - /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ - acknowledgeAccountSubjects?: boolean; - comment?: string; - /** Indicates how long the takedown should be in effect before automatically expiring. */ - durationInHours?: number; - } - /** Unmute action on a subject */ - interface ModEventUnmute extends TypedBase { - /** Describe reasoning behind the reversal. */ - comment?: string; - } - /** Unmute incoming reports from an account */ - interface ModEventUnmuteReporter extends TypedBase { - /** Describe reasoning behind the reversal. */ - comment?: string; - } - interface ModEventView extends TypedBase { - createdAt: string; - createdBy: At.DID; - event: TypeUnion< - | AccountEvent - | IdentityEvent - | ModEventAcknowledge - | ModEventComment - | ModEventDivert - | ModEventEmail - | ModEventEscalate - | ModEventLabel - | ModEventMute - | ModEventMuteReporter - | ModEventReport - | ModEventResolveAppeal - | ModEventReverseTakedown - | ModEventTag - | ModEventTakedown - | ModEventUnmute - | ModEventUnmuteReporter - | RecordEvent - >; - id: number; - subject: TypeUnion< - | ChatBskyConvoDefs.MessageRef - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - >; - subjectBlobCids: string[]; - creatorHandle?: string; - subjectHandle?: string; - } - interface ModEventViewDetail extends TypedBase { - createdAt: string; - createdBy: At.DID; - event: TypeUnion< - | AccountEvent - | IdentityEvent - | ModEventAcknowledge - | ModEventComment - | ModEventDivert - | ModEventEmail - | ModEventEscalate - | ModEventLabel - | ModEventMute - | ModEventMuteReporter - | ModEventReport - | ModEventResolveAppeal - | ModEventReverseTakedown - | ModEventTag - | ModEventTakedown - | ModEventUnmute - | ModEventUnmuteReporter - | RecordEvent - >; - id: number; - subject: TypeUnion< - RecordView | RecordViewNotFound | RepoView | RepoViewNotFound - >; - subjectBlobs: BlobView[]; - } - /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ - interface RecordEvent extends TypedBase { - op: "create" | "delete" | "update" | (string & {}); - timestamp: string; - cid?: At.CID; - comment?: string; - } - interface RecordHosting extends TypedBase { - status: "deleted" | "unknown" | (string & {}); - createdAt?: string; - deletedAt?: string; - updatedAt?: string; - } - interface RecordView extends TypedBase { - blobCids: At.CID[]; - cid: At.CID; - indexedAt: string; - moderation: Moderation; - repo: RepoView; - uri: At.Uri; - value: unknown; - } - interface RecordViewDetail extends TypedBase { - blobs: BlobView[]; - cid: At.CID; - indexedAt: string; - moderation: ModerationDetail; - repo: RepoView; - uri: At.Uri; - value: unknown; - labels?: ComAtprotoLabelDefs.Label[]; - } - interface RecordViewNotFound extends TypedBase { - uri: At.Uri; - } - interface RepoView extends TypedBase { - did: At.DID; - handle: At.Handle; - indexedAt: string; - moderation: Moderation; - relatedRecords: unknown[]; - deactivatedAt?: string; - email?: string; - invitedBy?: ComAtprotoServerDefs.InviteCode; - inviteNote?: string; - invitesDisabled?: boolean; - threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; - } - interface RepoViewDetail extends TypedBase { - did: At.DID; - handle: At.Handle; - indexedAt: string; - moderation: ModerationDetail; - relatedRecords: unknown[]; - deactivatedAt?: string; - email?: string; - emailConfirmedAt?: string; - invitedBy?: ComAtprotoServerDefs.InviteCode; - inviteNote?: string; - invites?: ComAtprotoServerDefs.InviteCode[]; - invitesDisabled?: boolean; - labels?: ComAtprotoLabelDefs.Label[]; - threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; - } - interface RepoViewNotFound extends TypedBase { - did: At.DID; - } - type ReviewClosed = "tools.ozone.moderation.defs#reviewClosed"; - type ReviewEscalated = "tools.ozone.moderation.defs#reviewEscalated"; - type ReviewNone = "tools.ozone.moderation.defs#reviewNone"; - type ReviewOpen = "tools.ozone.moderation.defs#reviewOpen"; - type SubjectReviewState = - | "#reviewClosed" - | "#reviewEscalated" - | "#reviewNone" - | "#reviewOpen" - | (string & {}); - interface SubjectStatusView extends TypedBase { - /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ - createdAt: string; - id: number; - reviewState: SubjectReviewState; - subject: TypeUnion< - ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main - >; - /** Timestamp referencing when the last update was made to the moderation status of the subject */ - updatedAt: string; - /** True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. */ - appealed?: boolean; - /** Sticky comment on the subject. */ - comment?: string; - hosting?: TypeUnion; - /** Timestamp referencing when the author of the subject appealed a moderation action */ - lastAppealedAt?: string; - lastReportedAt?: string; - lastReviewedAt?: string; - lastReviewedBy?: At.DID; - muteReportingUntil?: string; - muteUntil?: string; - subjectBlobCids?: At.CID[]; - subjectRepoHandle?: string; - suspendUntil?: string; - tags?: string[]; - takendown?: boolean; - } - interface VideoDetails extends TypedBase { - height: number; - length: number; - width: number; - } -} - -/** Take a moderation action on an actor. */ -export declare namespace ToolsOzoneModerationEmitEvent { - interface Params extends TypedBase {} - interface Input extends TypedBase { - createdBy: At.DID; - event: TypeUnion< - | ToolsOzoneModerationDefs.AccountEvent - | ToolsOzoneModerationDefs.IdentityEvent - | ToolsOzoneModerationDefs.ModEventAcknowledge - | ToolsOzoneModerationDefs.ModEventComment - | ToolsOzoneModerationDefs.ModEventEmail - | ToolsOzoneModerationDefs.ModEventEscalate - | ToolsOzoneModerationDefs.ModEventLabel - | ToolsOzoneModerationDefs.ModEventMute - | ToolsOzoneModerationDefs.ModEventMuteReporter - | ToolsOzoneModerationDefs.ModEventReport - | ToolsOzoneModerationDefs.ModEventResolveAppeal - | ToolsOzoneModerationDefs.ModEventReverseTakedown - | ToolsOzoneModerationDefs.ModEventTag - | ToolsOzoneModerationDefs.ModEventTakedown - | ToolsOzoneModerationDefs.ModEventUnmute - | ToolsOzoneModerationDefs.ModEventUnmuteReporter - | ToolsOzoneModerationDefs.RecordEvent - >; - subject: TypeUnion< - ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main - >; - subjectBlobCids?: At.CID[]; - } - type Output = ToolsOzoneModerationDefs.ModEventView; - interface Errors extends TypedBase { - SubjectHasAction: {}; - } -} - -/** Get details about a moderation event. */ -export declare namespace ToolsOzoneModerationGetEvent { - interface Params extends TypedBase { - id: number; - } - type Input = undefined; - type Output = ToolsOzoneModerationDefs.ModEventViewDetail; -} - -/** Get details about a record. */ -export declare namespace ToolsOzoneModerationGetRecord { - interface Params extends TypedBase { - uri: At.Uri; - cid?: At.CID; - } - type Input = undefined; - type Output = ToolsOzoneModerationDefs.RecordViewDetail; - interface Errors extends TypedBase { - RecordNotFound: {}; - } -} - -/** Get details about some records. */ -export declare namespace ToolsOzoneModerationGetRecords { - interface Params extends TypedBase { - /** Maximum array length: 100 */ - uris: At.Uri[]; - } - type Input = undefined; - interface Output extends TypedBase { - records: TypeUnion< - | ToolsOzoneModerationDefs.RecordViewDetail - | ToolsOzoneModerationDefs.RecordViewNotFound - >[]; - } -} - -/** Get details about a repository. */ -export declare namespace ToolsOzoneModerationGetRepo { - interface Params extends TypedBase { - did: At.DID; - } - type Input = undefined; - type Output = ToolsOzoneModerationDefs.RepoViewDetail; - interface Errors extends TypedBase { - RepoNotFound: {}; - } -} - -/** Get details about some repositories. */ -export declare namespace ToolsOzoneModerationGetRepos { - interface Params extends TypedBase { - /** Maximum array length: 100 */ - dids: At.DID[]; - } - type Input = undefined; - interface Output extends TypedBase { - repos: TypeUnion< - | ToolsOzoneModerationDefs.RepoViewDetail - | ToolsOzoneModerationDefs.RepoViewNotFound - >[]; - } -} - -/** List moderation events related to a subject. */ -export declare namespace ToolsOzoneModerationQueryEvents { - interface Params extends TypedBase { - /** If specified, only events where all of these labels were added are returned */ - addedLabels?: string[]; - /** If specified, only events where all of these tags were added are returned */ - addedTags?: string[]; - /** - * If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. - * Maximum array length: 20 - */ - collections?: string[]; - /** If specified, only events with comments containing the keyword are returned. Apply || separator to use multiple keywords and match using OR condition. */ - comment?: string; - /** Retrieve events created after a given timestamp */ - createdAfter?: string; - /** Retrieve events created before a given timestamp */ - createdBefore?: string; - createdBy?: At.DID; - cursor?: string; - /** If true, only events with comments are returned */ - hasComment?: boolean; - /** - * If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned. - * \@default false - */ - includeAllUserRecords?: boolean; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - /** If specified, only events where all of these labels were removed are returned */ - removedLabels?: string[]; - /** If specified, only events where all of these tags were removed are returned */ - removedTags?: string[]; - reportTypes?: string[]; - /** - * Sort direction for the events. Defaults to descending order of created at timestamp. - * \@default "desc" - */ - sortDirection?: "asc" | "desc"; - subject?: string; - /** If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ - subjectType?: "account" | "record" | (string & {}); - /** The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent) to filter by. If not specified, all events are returned. */ - types?: string[]; - } - type Input = undefined; - interface Output extends TypedBase { - events: ToolsOzoneModerationDefs.ModEventView[]; - cursor?: string; - } -} - -/** View moderation statuses of subjects (record or repo). */ -export declare namespace ToolsOzoneModerationQueryStatuses { - interface Params extends TypedBase { - /** Get subjects in unresolved appealed status */ - appealed?: boolean; - /** - * If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored. - * Maximum array length: 20 - */ - collections?: string[]; - /** Search subjects by keyword from comments */ - comment?: string; - cursor?: string; - excludeTags?: string[]; - /** Search subjects where the associated record/account was deleted after a given timestamp */ - hostingDeletedAfter?: string; - /** Search subjects where the associated record/account was deleted before a given timestamp */ - hostingDeletedBefore?: string; - /** Search subjects by the status of the associated record/account */ - hostingStatuses?: string[]; - /** Search subjects where the associated record/account was updated after a given timestamp */ - hostingUpdatedAfter?: string; - /** Search subjects where the associated record/account was updated before a given timestamp */ - hostingUpdatedBefore?: string; - ignoreSubjects?: string[]; - /** All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned. */ - includeAllUserRecords?: boolean; - /** By default, we don't include muted subjects in the results. Set this to true to include them. */ - includeMuted?: boolean; - /** Get all subject statuses that were reviewed by a specific moderator */ - lastReviewedBy?: At.DID; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - /** When set to true, only muted subjects and reporters will be returned. */ - onlyMuted?: boolean; - /** Search subjects reported after a given timestamp */ - reportedAfter?: string; - /** Search subjects reported before a given timestamp */ - reportedBefore?: string; - /** Search subjects reviewed after a given timestamp */ - reviewedAfter?: string; - /** Search subjects reviewed before a given timestamp */ - reviewedBefore?: string; - /** Specify when fetching subjects in a certain state */ - reviewState?: string; - /** \@default "desc" */ - sortDirection?: "asc" | "desc"; - /** \@default "lastReportedAt" */ - sortField?: "lastReviewedAt" | "lastReportedAt"; - /** The subject to get the status for. */ - subject?: string; - /** If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ - subjectType?: "account" | "record" | (string & {}); - tags?: string[]; - /** Get subjects that were taken down */ - takendown?: boolean; - } - type Input = undefined; - interface Output extends TypedBase { - subjectStatuses: ToolsOzoneModerationDefs.SubjectStatusView[]; - cursor?: string; - } -} - -/** Find repositories based on a search term. */ -export declare namespace ToolsOzoneModerationSearchRepos { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - q?: string; - /** - * DEPRECATED: use 'q' instead - * \@deprecated - */ - term?: string; - } - type Input = undefined; - interface Output extends TypedBase { - repos: ToolsOzoneModerationDefs.RepoView[]; - cursor?: string; - } -} - -/** Get details about ozone's server configuration. */ -export declare namespace ToolsOzoneServerGetConfig { - interface Params extends TypedBase {} - type Input = undefined; - interface Output extends TypedBase { - appview?: ServiceConfig; - blobDivert?: ServiceConfig; - chat?: ServiceConfig; - pds?: ServiceConfig; - viewer?: ViewerConfig; - } - interface ServiceConfig extends TypedBase { - url?: string; - } - interface ViewerConfig extends TypedBase { - role?: - | "tools.ozone.team.defs#roleAdmin" - | "tools.ozone.team.defs#roleModerator" - | "tools.ozone.team.defs#roleTriage" - | (string & {}); - } -} - -/** Add values to a specific set. Attempting to add values to a set that does not exist will result in an error. */ -export declare namespace ToolsOzoneSetAddValues { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Name of the set to add values to */ - name: string; - /** - * Array of string values to add to the set - * Minimum array length: 1 - * Maximum array length: 1000 - */ - values: string[]; - } - type Output = undefined; -} - -export declare namespace ToolsOzoneSetDefs { - interface Set extends TypedBase { - /** - * Minimum string length: 3 - * Maximum string length: 128 - */ - name: string; - /** - * Maximum string length: 10240 - * Maximum grapheme length: 1024 - */ - description?: string; - } - interface SetView extends TypedBase { - createdAt: string; - /** - * Minimum string length: 3 - * Maximum string length: 128 - */ - name: string; - setSize: number; - updatedAt: string; - /** - * Maximum string length: 10240 - * Maximum grapheme length: 1024 - */ - description?: string; - } -} - -/** Delete an entire set. Attempting to delete a set that does not exist will result in an error. */ -export declare namespace ToolsOzoneSetDeleteSet { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Name of the set to delete */ - name: string; - } - interface Output extends TypedBase {} - interface Errors extends TypedBase { - SetNotFound: {}; - } -} - -/** Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error */ -export declare namespace ToolsOzoneSetDeleteValues { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** Name of the set to delete values from */ - name: string; - /** - * Array of string values to delete from the set - * Minimum array length: 1 - */ - values: string[]; - } - type Output = undefined; - interface Errors extends TypedBase { - SetNotFound: {}; - } -} - -/** Get a specific set and its values */ -export declare namespace ToolsOzoneSetGetValues { - interface Params extends TypedBase { - name: string; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 1000 - * \@default 100 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - set: ToolsOzoneSetDefs.SetView; - values: string[]; - cursor?: string; - } - interface Errors extends TypedBase { - SetNotFound: {}; - } -} - -/** Query available sets */ -export declare namespace ToolsOzoneSetQuerySets { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - namePrefix?: string; - /** \@default "name" */ - sortBy?: "name" | "createdAt" | "updatedAt"; - /** - * Defaults to ascending order of name field. - * \@default "asc" - */ - sortDirection?: "asc" | "desc"; - } - type Input = undefined; - interface Output extends TypedBase { - sets: ToolsOzoneSetDefs.SetView[]; - cursor?: string; - } -} - -/** Create or update set metadata */ -export declare namespace ToolsOzoneSetUpsertSet { - interface Params extends TypedBase {} - type Input = ToolsOzoneSetDefs.Set; - type Output = ToolsOzoneSetDefs.SetView; -} - -export declare namespace ToolsOzoneSettingDefs { - interface Option extends TypedBase { - createdBy: At.DID; - did: At.DID; - key: string; - lastUpdatedBy: At.DID; - scope: "instance" | "personal" | (string & {}); - value: unknown; - createdAt?: string; - /** - * Maximum string length: 10240 - * Maximum grapheme length: 1024 - */ - description?: string; - managerRole?: - | "tools.ozone.team.defs#roleAdmin" - | "tools.ozone.team.defs#roleModerator" - | "tools.ozone.team.defs#roleTriage" - | (string & {}); - updatedAt?: string; - } -} - -/** List settings with optional filtering */ -export declare namespace ToolsOzoneSettingListOptions { - interface Params extends TypedBase { - cursor?: string; - /** - * Filter for only the specified keys. Ignored if prefix is provided - * Maximum array length: 100 - */ - keys?: string[]; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - /** Filter keys by prefix */ - prefix?: string; - /** \@default "instance" */ - scope?: "instance" | "personal" | (string & {}); - } - type Input = undefined; - interface Output extends TypedBase { - options: ToolsOzoneSettingDefs.Option[]; - cursor?: string; - } -} - -/** Delete settings by key */ -export declare namespace ToolsOzoneSettingRemoveOptions { - interface Params extends TypedBase {} - interface Input extends TypedBase { - /** - * Minimum array length: 1 - * Maximum array length: 200 - */ - keys: string[]; - scope: "instance" | "personal" | (string & {}); - } - interface Output extends TypedBase {} -} - -/** Create or update setting option */ -export declare namespace ToolsOzoneSettingUpsertOption { - interface Params extends TypedBase {} - interface Input extends TypedBase { - key: string; - scope: "instance" | "personal" | (string & {}); - value: unknown; - /** Maximum string length: 2000 */ - description?: string; - managerRole?: - | "tools.ozone.team.defs#roleAdmin" - | "tools.ozone.team.defs#roleModerator" - | "tools.ozone.team.defs#roleTriage" - | (string & {}); - } - interface Output extends TypedBase { - option: ToolsOzoneSettingDefs.Option; - } -} - -export declare namespace ToolsOzoneSignatureDefs { - interface SigDetail extends TypedBase { - property: string; - value: string; - } -} - -/** Find all correlated threat signatures between 2 or more accounts. */ -export declare namespace ToolsOzoneSignatureFindCorrelation { - interface Params extends TypedBase { - dids: At.DID[]; - } - type Input = undefined; - interface Output extends TypedBase { - details: ToolsOzoneSignatureDefs.SigDetail[]; - } -} - -/** Get accounts that share some matching threat signatures with the root account. */ -export declare namespace ToolsOzoneSignatureFindRelatedAccounts { - interface Params extends TypedBase { - did: At.DID; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - accounts: RelatedAccount[]; - cursor?: string; - } - interface RelatedAccount extends TypedBase { - account: ComAtprotoAdminDefs.AccountView; - similarities?: ToolsOzoneSignatureDefs.SigDetail[]; - } -} - -/** Search for accounts that match one or more threat signature values. */ -export declare namespace ToolsOzoneSignatureSearchAccounts { - interface Params extends TypedBase { - values: string[]; - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - accounts: ComAtprotoAdminDefs.AccountView[]; - cursor?: string; - } -} - -/** Add a member to the ozone team. Requires admin role. */ -export declare namespace ToolsOzoneTeamAddMember { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - role: - | "tools.ozone.team.defs#roleAdmin" - | "tools.ozone.team.defs#roleModerator" - | "tools.ozone.team.defs#roleTriage" - | (string & {}); - } - type Output = ToolsOzoneTeamDefs.Member; - interface Errors extends TypedBase { - MemberAlreadyExists: {}; - } -} - -export declare namespace ToolsOzoneTeamDefs { - interface Member extends TypedBase { - did: At.DID; - role: "#roleAdmin" | "#roleModerator" | "#roleTriage" | (string & {}); - createdAt?: string; - disabled?: boolean; - lastUpdatedBy?: string; - profile?: AppBskyActorDefs.ProfileViewDetailed; - updatedAt?: string; - } - type RoleAdmin = "tools.ozone.team.defs#roleAdmin"; - type RoleModerator = "tools.ozone.team.defs#roleModerator"; - type RoleTriage = "tools.ozone.team.defs#roleTriage"; -} - -/** Delete a member from ozone team. Requires admin role. */ -export declare namespace ToolsOzoneTeamDeleteMember { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - } - type Output = undefined; - interface Errors extends TypedBase { - MemberNotFound: {}; - CannotDeleteSelf: {}; - } -} - -/** List all members with access to the ozone service. */ -export declare namespace ToolsOzoneTeamListMembers { - interface Params extends TypedBase { - cursor?: string; - /** - * Minimum: 1 - * Maximum: 100 - * \@default 50 - */ - limit?: number; - } - type Input = undefined; - interface Output extends TypedBase { - members: ToolsOzoneTeamDefs.Member[]; - cursor?: string; - } -} - -/** Update a member in the ozone service. Requires admin role. */ -export declare namespace ToolsOzoneTeamUpdateMember { - interface Params extends TypedBase {} - interface Input extends TypedBase { - did: At.DID; - disabled?: boolean; - role?: - | "tools.ozone.team.defs#roleAdmin" - | "tools.ozone.team.defs#roleModerator" - | "tools.ozone.team.defs#roleTriage" - | (string & {}); - } - type Output = ToolsOzoneTeamDefs.Member; - interface Errors extends TypedBase { - MemberNotFound: {}; - } -} - -export declare interface Records extends RecordBase { - "app.bsky.actor.profile": AppBskyActorProfile.Record; - "app.bsky.feed.generator": AppBskyFeedGenerator.Record; - "app.bsky.feed.like": AppBskyFeedLike.Record; - "app.bsky.feed.post": AppBskyFeedPost.Record; - "app.bsky.feed.postgate": AppBskyFeedPostgate.Record; - "app.bsky.feed.repost": AppBskyFeedRepost.Record; - "app.bsky.feed.threadgate": AppBskyFeedThreadgate.Record; - "app.bsky.graph.block": AppBskyGraphBlock.Record; - "app.bsky.graph.follow": AppBskyGraphFollow.Record; - "app.bsky.graph.list": AppBskyGraphList.Record; - "app.bsky.graph.listblock": AppBskyGraphListblock.Record; - "app.bsky.graph.listitem": AppBskyGraphListitem.Record; - "app.bsky.graph.starterpack": AppBskyGraphStarterpack.Record; - "app.bsky.labeler.service": AppBskyLabelerService.Record; - "chat.bsky.actor.declaration": ChatBskyActorDeclaration.Record; -} - -export declare interface Queries { - "app.bsky.actor.getPreferences": { - output: AppBskyActorGetPreferences.Output; - }; - "app.bsky.actor.getProfile": { - params: AppBskyActorGetProfile.Params; - output: AppBskyActorGetProfile.Output; - }; - "app.bsky.actor.getProfiles": { - params: AppBskyActorGetProfiles.Params; - output: AppBskyActorGetProfiles.Output; - }; - "app.bsky.actor.getSuggestions": { - params: AppBskyActorGetSuggestions.Params; - output: AppBskyActorGetSuggestions.Output; - }; - "app.bsky.actor.searchActors": { - params: AppBskyActorSearchActors.Params; - output: AppBskyActorSearchActors.Output; - }; - "app.bsky.actor.searchActorsTypeahead": { - params: AppBskyActorSearchActorsTypeahead.Params; - output: AppBskyActorSearchActorsTypeahead.Output; - }; - "app.bsky.feed.describeFeedGenerator": { - output: AppBskyFeedDescribeFeedGenerator.Output; - }; - "app.bsky.feed.getActorFeeds": { - params: AppBskyFeedGetActorFeeds.Params; - output: AppBskyFeedGetActorFeeds.Output; - }; - "app.bsky.feed.getActorLikes": { - params: AppBskyFeedGetActorLikes.Params; - output: AppBskyFeedGetActorLikes.Output; - }; - "app.bsky.feed.getAuthorFeed": { - params: AppBskyFeedGetAuthorFeed.Params; - output: AppBskyFeedGetAuthorFeed.Output; - }; - "app.bsky.feed.getFeed": { - params: AppBskyFeedGetFeed.Params; - output: AppBskyFeedGetFeed.Output; - }; - "app.bsky.feed.getFeedGenerator": { - params: AppBskyFeedGetFeedGenerator.Params; - output: AppBskyFeedGetFeedGenerator.Output; - }; - "app.bsky.feed.getFeedGenerators": { - params: AppBskyFeedGetFeedGenerators.Params; - output: AppBskyFeedGetFeedGenerators.Output; - }; - "app.bsky.feed.getFeedSkeleton": { - params: AppBskyFeedGetFeedSkeleton.Params; - output: AppBskyFeedGetFeedSkeleton.Output; - }; - "app.bsky.feed.getLikes": { - params: AppBskyFeedGetLikes.Params; - output: AppBskyFeedGetLikes.Output; - }; - "app.bsky.feed.getListFeed": { - params: AppBskyFeedGetListFeed.Params; - output: AppBskyFeedGetListFeed.Output; - }; - "app.bsky.feed.getPosts": { - params: AppBskyFeedGetPosts.Params; - output: AppBskyFeedGetPosts.Output; - }; - "app.bsky.feed.getPostThread": { - params: AppBskyFeedGetPostThread.Params; - output: AppBskyFeedGetPostThread.Output; - }; - "app.bsky.feed.getQuotes": { - params: AppBskyFeedGetQuotes.Params; - output: AppBskyFeedGetQuotes.Output; - }; - "app.bsky.feed.getRepostedBy": { - params: AppBskyFeedGetRepostedBy.Params; - output: AppBskyFeedGetRepostedBy.Output; - }; - "app.bsky.feed.getSuggestedFeeds": { - params: AppBskyFeedGetSuggestedFeeds.Params; - output: AppBskyFeedGetSuggestedFeeds.Output; - }; - "app.bsky.feed.getTimeline": { - params: AppBskyFeedGetTimeline.Params; - output: AppBskyFeedGetTimeline.Output; - }; - "app.bsky.feed.searchPosts": { - params: AppBskyFeedSearchPosts.Params; - output: AppBskyFeedSearchPosts.Output; - }; - "app.bsky.graph.getActorStarterPacks": { - params: AppBskyGraphGetActorStarterPacks.Params; - output: AppBskyGraphGetActorStarterPacks.Output; - }; - "app.bsky.graph.getBlocks": { - params: AppBskyGraphGetBlocks.Params; - output: AppBskyGraphGetBlocks.Output; - }; - "app.bsky.graph.getFollowers": { - params: AppBskyGraphGetFollowers.Params; - output: AppBskyGraphGetFollowers.Output; - }; - "app.bsky.graph.getFollows": { - params: AppBskyGraphGetFollows.Params; - output: AppBskyGraphGetFollows.Output; - }; - "app.bsky.graph.getKnownFollowers": { - params: AppBskyGraphGetKnownFollowers.Params; - output: AppBskyGraphGetKnownFollowers.Output; - }; - "app.bsky.graph.getList": { - params: AppBskyGraphGetList.Params; - output: AppBskyGraphGetList.Output; - }; - "app.bsky.graph.getListBlocks": { - params: AppBskyGraphGetListBlocks.Params; - output: AppBskyGraphGetListBlocks.Output; - }; - "app.bsky.graph.getListMutes": { - params: AppBskyGraphGetListMutes.Params; - output: AppBskyGraphGetListMutes.Output; - }; - "app.bsky.graph.getLists": { - params: AppBskyGraphGetLists.Params; - output: AppBskyGraphGetLists.Output; - }; - "app.bsky.graph.getMutes": { - params: AppBskyGraphGetMutes.Params; - output: AppBskyGraphGetMutes.Output; - }; - "app.bsky.graph.getRelationships": { - params: AppBskyGraphGetRelationships.Params; - output: AppBskyGraphGetRelationships.Output; - }; - "app.bsky.graph.getStarterPack": { - params: AppBskyGraphGetStarterPack.Params; - output: AppBskyGraphGetStarterPack.Output; - }; - "app.bsky.graph.getStarterPacks": { - params: AppBskyGraphGetStarterPacks.Params; - output: AppBskyGraphGetStarterPacks.Output; - }; - "app.bsky.graph.getSuggestedFollowsByActor": { - params: AppBskyGraphGetSuggestedFollowsByActor.Params; - output: AppBskyGraphGetSuggestedFollowsByActor.Output; - }; - "app.bsky.graph.searchStarterPacks": { - params: AppBskyGraphSearchStarterPacks.Params; - output: AppBskyGraphSearchStarterPacks.Output; - }; - "app.bsky.labeler.getServices": { - params: AppBskyLabelerGetServices.Params; - output: AppBskyLabelerGetServices.Output; - }; - "app.bsky.notification.getUnreadCount": { - params: AppBskyNotificationGetUnreadCount.Params; - output: AppBskyNotificationGetUnreadCount.Output; - }; - "app.bsky.notification.listNotifications": { - params: AppBskyNotificationListNotifications.Params; - output: AppBskyNotificationListNotifications.Output; - }; - "app.bsky.unspecced.getConfig": { - output: AppBskyUnspeccedGetConfig.Output; - }; - "app.bsky.unspecced.getPopularFeedGenerators": { - params: AppBskyUnspeccedGetPopularFeedGenerators.Params; - output: AppBskyUnspeccedGetPopularFeedGenerators.Output; - }; - "app.bsky.unspecced.getSuggestionsSkeleton": { - params: AppBskyUnspeccedGetSuggestionsSkeleton.Params; - output: AppBskyUnspeccedGetSuggestionsSkeleton.Output; - }; - "app.bsky.unspecced.getTaggedSuggestions": { - output: AppBskyUnspeccedGetTaggedSuggestions.Output; - }; - "app.bsky.unspecced.searchActorsSkeleton": { - params: AppBskyUnspeccedSearchActorsSkeleton.Params; - output: AppBskyUnspeccedSearchActorsSkeleton.Output; - }; - "app.bsky.unspecced.searchPostsSkeleton": { - params: AppBskyUnspeccedSearchPostsSkeleton.Params; - output: AppBskyUnspeccedSearchPostsSkeleton.Output; - }; - "app.bsky.unspecced.searchStarterPacksSkeleton": { - params: AppBskyUnspeccedSearchStarterPacksSkeleton.Params; - output: AppBskyUnspeccedSearchStarterPacksSkeleton.Output; - }; - "app.bsky.video.getJobStatus": { - params: AppBskyVideoGetJobStatus.Params; - output: AppBskyVideoGetJobStatus.Output; - }; - "app.bsky.video.getUploadLimits": { - output: AppBskyVideoGetUploadLimits.Output; - }; - "chat.bsky.actor.exportAccountData": { - output: ChatBskyActorExportAccountData.Output; - }; - "chat.bsky.convo.getConvo": { - params: ChatBskyConvoGetConvo.Params; - output: ChatBskyConvoGetConvo.Output; - }; - "chat.bsky.convo.getConvoForMembers": { - params: ChatBskyConvoGetConvoForMembers.Params; - output: ChatBskyConvoGetConvoForMembers.Output; - }; - "chat.bsky.convo.getLog": { - params: ChatBskyConvoGetLog.Params; - output: ChatBskyConvoGetLog.Output; - }; - "chat.bsky.convo.getMessages": { - params: ChatBskyConvoGetMessages.Params; - output: ChatBskyConvoGetMessages.Output; - }; - "chat.bsky.convo.listConvos": { - params: ChatBskyConvoListConvos.Params; - output: ChatBskyConvoListConvos.Output; - }; - "chat.bsky.moderation.getActorMetadata": { - params: ChatBskyModerationGetActorMetadata.Params; - output: ChatBskyModerationGetActorMetadata.Output; - }; - "chat.bsky.moderation.getMessageContext": { - params: ChatBskyModerationGetMessageContext.Params; - output: ChatBskyModerationGetMessageContext.Output; - }; - "com.atproto.admin.getAccountInfo": { - params: ComAtprotoAdminGetAccountInfo.Params; - output: ComAtprotoAdminGetAccountInfo.Output; - }; - "com.atproto.admin.getAccountInfos": { - params: ComAtprotoAdminGetAccountInfos.Params; - output: ComAtprotoAdminGetAccountInfos.Output; - }; - "com.atproto.admin.getInviteCodes": { - params: ComAtprotoAdminGetInviteCodes.Params; - output: ComAtprotoAdminGetInviteCodes.Output; - }; - "com.atproto.admin.getSubjectStatus": { - params: ComAtprotoAdminGetSubjectStatus.Params; - output: ComAtprotoAdminGetSubjectStatus.Output; - }; - "com.atproto.admin.searchAccounts": { - params: ComAtprotoAdminSearchAccounts.Params; - output: ComAtprotoAdminSearchAccounts.Output; - }; - "com.atproto.identity.getRecommendedDidCredentials": { - output: ComAtprotoIdentityGetRecommendedDidCredentials.Output; - }; - "com.atproto.identity.resolveHandle": { - params: ComAtprotoIdentityResolveHandle.Params; - output: ComAtprotoIdentityResolveHandle.Output; - }; - "com.atproto.label.queryLabels": { - params: ComAtprotoLabelQueryLabels.Params; - output: ComAtprotoLabelQueryLabels.Output; - }; - "com.atproto.repo.describeRepo": { - params: ComAtprotoRepoDescribeRepo.Params; - output: ComAtprotoRepoDescribeRepo.Output; - }; - "com.atproto.repo.getRecord": { - params: ComAtprotoRepoGetRecord.Params; - output: ComAtprotoRepoGetRecord.Output; - }; - "com.atproto.repo.listMissingBlobs": { - params: ComAtprotoRepoListMissingBlobs.Params; - output: ComAtprotoRepoListMissingBlobs.Output; - }; - "com.atproto.repo.listRecords": { - params: ComAtprotoRepoListRecords.Params; - output: ComAtprotoRepoListRecords.Output; - }; - "com.atproto.server.checkAccountStatus": { - output: ComAtprotoServerCheckAccountStatus.Output; - }; - "com.atproto.server.describeServer": { - output: ComAtprotoServerDescribeServer.Output; - }; - "com.atproto.server.getAccountInviteCodes": { - params: ComAtprotoServerGetAccountInviteCodes.Params; - output: ComAtprotoServerGetAccountInviteCodes.Output; - }; - "com.atproto.server.getServiceAuth": { - params: ComAtprotoServerGetServiceAuth.Params; - output: ComAtprotoServerGetServiceAuth.Output; - }; - "com.atproto.server.getSession": { - output: ComAtprotoServerGetSession.Output; - }; - "com.atproto.server.listAppPasswords": { - output: ComAtprotoServerListAppPasswords.Output; - }; - "com.atproto.sync.getBlob": { - params: ComAtprotoSyncGetBlob.Params; - output: ComAtprotoSyncGetBlob.Output; - }; - "com.atproto.sync.getBlocks": { - params: ComAtprotoSyncGetBlocks.Params; - output: ComAtprotoSyncGetBlocks.Output; - }; - "com.atproto.sync.getCheckout": { - params: ComAtprotoSyncGetCheckout.Params; - output: ComAtprotoSyncGetCheckout.Output; - }; - "com.atproto.sync.getHead": { - params: ComAtprotoSyncGetHead.Params; - output: ComAtprotoSyncGetHead.Output; - }; - "com.atproto.sync.getLatestCommit": { - params: ComAtprotoSyncGetLatestCommit.Params; - output: ComAtprotoSyncGetLatestCommit.Output; - }; - "com.atproto.sync.getRecord": { - params: ComAtprotoSyncGetRecord.Params; - output: ComAtprotoSyncGetRecord.Output; - }; - "com.atproto.sync.getRepo": { - params: ComAtprotoSyncGetRepo.Params; - output: ComAtprotoSyncGetRepo.Output; - }; - "com.atproto.sync.getRepoStatus": { - params: ComAtprotoSyncGetRepoStatus.Params; - output: ComAtprotoSyncGetRepoStatus.Output; - }; - "com.atproto.sync.listBlobs": { - params: ComAtprotoSyncListBlobs.Params; - output: ComAtprotoSyncListBlobs.Output; - }; - "com.atproto.sync.listRepos": { - params: ComAtprotoSyncListRepos.Params; - output: ComAtprotoSyncListRepos.Output; - }; - "com.atproto.temp.checkSignupQueue": { - output: ComAtprotoTempCheckSignupQueue.Output; - }; - "com.atproto.temp.fetchLabels": { - params: ComAtprotoTempFetchLabels.Params; - output: ComAtprotoTempFetchLabels.Output; - }; - "tools.ozone.communication.listTemplates": { - output: ToolsOzoneCommunicationListTemplates.Output; - }; - "tools.ozone.moderation.getEvent": { - params: ToolsOzoneModerationGetEvent.Params; - output: ToolsOzoneModerationGetEvent.Output; - }; - "tools.ozone.moderation.getRecord": { - params: ToolsOzoneModerationGetRecord.Params; - output: ToolsOzoneModerationGetRecord.Output; - }; - "tools.ozone.moderation.getRecords": { - params: ToolsOzoneModerationGetRecords.Params; - output: ToolsOzoneModerationGetRecords.Output; - }; - "tools.ozone.moderation.getRepo": { - params: ToolsOzoneModerationGetRepo.Params; - output: ToolsOzoneModerationGetRepo.Output; - }; - "tools.ozone.moderation.getRepos": { - params: ToolsOzoneModerationGetRepos.Params; - output: ToolsOzoneModerationGetRepos.Output; - }; - "tools.ozone.moderation.queryEvents": { - params: ToolsOzoneModerationQueryEvents.Params; - output: ToolsOzoneModerationQueryEvents.Output; - }; - "tools.ozone.moderation.queryStatuses": { - params: ToolsOzoneModerationQueryStatuses.Params; - output: ToolsOzoneModerationQueryStatuses.Output; - }; - "tools.ozone.moderation.searchRepos": { - params: ToolsOzoneModerationSearchRepos.Params; - output: ToolsOzoneModerationSearchRepos.Output; - }; - "tools.ozone.server.getConfig": { - output: ToolsOzoneServerGetConfig.Output; - }; - "tools.ozone.set.getValues": { - params: ToolsOzoneSetGetValues.Params; - output: ToolsOzoneSetGetValues.Output; - }; - "tools.ozone.set.querySets": { - params: ToolsOzoneSetQuerySets.Params; - output: ToolsOzoneSetQuerySets.Output; - }; - "tools.ozone.setting.listOptions": { - params: ToolsOzoneSettingListOptions.Params; - output: ToolsOzoneSettingListOptions.Output; - }; - "tools.ozone.signature.findCorrelation": { - params: ToolsOzoneSignatureFindCorrelation.Params; - output: ToolsOzoneSignatureFindCorrelation.Output; - }; - "tools.ozone.signature.findRelatedAccounts": { - params: ToolsOzoneSignatureFindRelatedAccounts.Params; - output: ToolsOzoneSignatureFindRelatedAccounts.Output; - }; - "tools.ozone.signature.searchAccounts": { - params: ToolsOzoneSignatureSearchAccounts.Params; - output: ToolsOzoneSignatureSearchAccounts.Output; - }; - "tools.ozone.team.listMembers": { - params: ToolsOzoneTeamListMembers.Params; - output: ToolsOzoneTeamListMembers.Output; - }; -} - -export declare interface Procedures { - "app.bsky.actor.putPreferences": { - input: AppBskyActorPutPreferences.Input; - }; - "app.bsky.feed.sendInteractions": { - input: AppBskyFeedSendInteractions.Input; - output: AppBskyFeedSendInteractions.Output; - }; - "app.bsky.graph.muteActor": { - input: AppBskyGraphMuteActor.Input; - }; - "app.bsky.graph.muteActorList": { - input: AppBskyGraphMuteActorList.Input; - }; - "app.bsky.graph.muteThread": { - input: AppBskyGraphMuteThread.Input; - }; - "app.bsky.graph.unmuteActor": { - input: AppBskyGraphUnmuteActor.Input; - }; - "app.bsky.graph.unmuteActorList": { - input: AppBskyGraphUnmuteActorList.Input; - }; - "app.bsky.graph.unmuteThread": { - input: AppBskyGraphUnmuteThread.Input; - }; - "app.bsky.notification.putPreferences": { - input: AppBskyNotificationPutPreferences.Input; - }; - "app.bsky.notification.registerPush": { - input: AppBskyNotificationRegisterPush.Input; - }; - "app.bsky.notification.updateSeen": { - input: AppBskyNotificationUpdateSeen.Input; - }; - "app.bsky.video.uploadVideo": { - input: AppBskyVideoUploadVideo.Input; - output: AppBskyVideoUploadVideo.Output; - }; - "chat.bsky.actor.deleteAccount": { - output: ChatBskyActorDeleteAccount.Output; - }; - "chat.bsky.convo.deleteMessageForSelf": { - input: ChatBskyConvoDeleteMessageForSelf.Input; - output: ChatBskyConvoDeleteMessageForSelf.Output; - }; - "chat.bsky.convo.leaveConvo": { - input: ChatBskyConvoLeaveConvo.Input; - output: ChatBskyConvoLeaveConvo.Output; - }; - "chat.bsky.convo.muteConvo": { - input: ChatBskyConvoMuteConvo.Input; - output: ChatBskyConvoMuteConvo.Output; - }; - "chat.bsky.convo.sendMessage": { - input: ChatBskyConvoSendMessage.Input; - output: ChatBskyConvoSendMessage.Output; - }; - "chat.bsky.convo.sendMessageBatch": { - input: ChatBskyConvoSendMessageBatch.Input; - output: ChatBskyConvoSendMessageBatch.Output; - }; - "chat.bsky.convo.unmuteConvo": { - input: ChatBskyConvoUnmuteConvo.Input; - output: ChatBskyConvoUnmuteConvo.Output; - }; - "chat.bsky.convo.updateRead": { - input: ChatBskyConvoUpdateRead.Input; - output: ChatBskyConvoUpdateRead.Output; - }; - "chat.bsky.moderation.updateActorAccess": { - input: ChatBskyModerationUpdateActorAccess.Input; - }; - "com.atproto.admin.deleteAccount": { - input: ComAtprotoAdminDeleteAccount.Input; - }; - "com.atproto.admin.disableAccountInvites": { - input: ComAtprotoAdminDisableAccountInvites.Input; - }; - "com.atproto.admin.disableInviteCodes": { - input: ComAtprotoAdminDisableInviteCodes.Input; - }; - "com.atproto.admin.enableAccountInvites": { - input: ComAtprotoAdminEnableAccountInvites.Input; - }; - "com.atproto.admin.sendEmail": { - input: ComAtprotoAdminSendEmail.Input; - output: ComAtprotoAdminSendEmail.Output; - }; - "com.atproto.admin.updateAccountEmail": { - input: ComAtprotoAdminUpdateAccountEmail.Input; - }; - "com.atproto.admin.updateAccountHandle": { - input: ComAtprotoAdminUpdateAccountHandle.Input; - }; - "com.atproto.admin.updateAccountPassword": { - input: ComAtprotoAdminUpdateAccountPassword.Input; - }; - "com.atproto.admin.updateSubjectStatus": { - input: ComAtprotoAdminUpdateSubjectStatus.Input; - output: ComAtprotoAdminUpdateSubjectStatus.Output; - }; - "com.atproto.identity.requestPlcOperationSignature": {}; - "com.atproto.identity.signPlcOperation": { - input: ComAtprotoIdentitySignPlcOperation.Input; - output: ComAtprotoIdentitySignPlcOperation.Output; - }; - "com.atproto.identity.submitPlcOperation": { - input: ComAtprotoIdentitySubmitPlcOperation.Input; - }; - "com.atproto.identity.updateHandle": { - input: ComAtprotoIdentityUpdateHandle.Input; - }; - "com.atproto.moderation.createReport": { - input: ComAtprotoModerationCreateReport.Input; - output: ComAtprotoModerationCreateReport.Output; - }; - "com.atproto.repo.applyWrites": { - input: ComAtprotoRepoApplyWrites.Input; - output: ComAtprotoRepoApplyWrites.Output; - }; - "com.atproto.repo.createRecord": { - input: ComAtprotoRepoCreateRecord.Input; - output: ComAtprotoRepoCreateRecord.Output; - }; - "com.atproto.repo.deleteRecord": { - input: ComAtprotoRepoDeleteRecord.Input; - output: ComAtprotoRepoDeleteRecord.Output; - }; - "com.atproto.repo.importRepo": { - input: ComAtprotoRepoImportRepo.Input; - }; - "com.atproto.repo.putRecord": { - input: ComAtprotoRepoPutRecord.Input; - output: ComAtprotoRepoPutRecord.Output; - }; - "com.atproto.repo.uploadBlob": { - input: ComAtprotoRepoUploadBlob.Input; - output: ComAtprotoRepoUploadBlob.Output; - }; - "com.atproto.server.activateAccount": {}; - "com.atproto.server.confirmEmail": { - input: ComAtprotoServerConfirmEmail.Input; - }; - "com.atproto.server.createAccount": { - input: ComAtprotoServerCreateAccount.Input; - output: ComAtprotoServerCreateAccount.Output; - }; - "com.atproto.server.createAppPassword": { - input: ComAtprotoServerCreateAppPassword.Input; - output: ComAtprotoServerCreateAppPassword.Output; - }; - "com.atproto.server.createInviteCode": { - input: ComAtprotoServerCreateInviteCode.Input; - output: ComAtprotoServerCreateInviteCode.Output; - }; - "com.atproto.server.createInviteCodes": { - input: ComAtprotoServerCreateInviteCodes.Input; - output: ComAtprotoServerCreateInviteCodes.Output; - }; - "com.atproto.server.createSession": { - input: ComAtprotoServerCreateSession.Input; - output: ComAtprotoServerCreateSession.Output; - }; - "com.atproto.server.deactivateAccount": { - input: ComAtprotoServerDeactivateAccount.Input; - }; - "com.atproto.server.deleteAccount": { - input: ComAtprotoServerDeleteAccount.Input; - }; - "com.atproto.server.deleteSession": {}; - "com.atproto.server.refreshSession": { - output: ComAtprotoServerRefreshSession.Output; - }; - "com.atproto.server.requestAccountDelete": {}; - "com.atproto.server.requestEmailConfirmation": {}; - "com.atproto.server.requestEmailUpdate": { - output: ComAtprotoServerRequestEmailUpdate.Output; - }; - "com.atproto.server.requestPasswordReset": { - input: ComAtprotoServerRequestPasswordReset.Input; - }; - "com.atproto.server.reserveSigningKey": { - input: ComAtprotoServerReserveSigningKey.Input; - output: ComAtprotoServerReserveSigningKey.Output; - }; - "com.atproto.server.resetPassword": { - input: ComAtprotoServerResetPassword.Input; - }; - "com.atproto.server.revokeAppPassword": { - input: ComAtprotoServerRevokeAppPassword.Input; - }; - "com.atproto.server.updateEmail": { - input: ComAtprotoServerUpdateEmail.Input; - }; - "com.atproto.sync.notifyOfUpdate": { - input: ComAtprotoSyncNotifyOfUpdate.Input; - }; - "com.atproto.sync.requestCrawl": { - input: ComAtprotoSyncRequestCrawl.Input; - }; - "com.atproto.temp.addReservedHandle": { - input: ComAtprotoTempAddReservedHandle.Input; - output: ComAtprotoTempAddReservedHandle.Output; - }; - "com.atproto.temp.requestPhoneVerification": { - input: ComAtprotoTempRequestPhoneVerification.Input; - }; - "tools.ozone.communication.createTemplate": { - input: ToolsOzoneCommunicationCreateTemplate.Input; - output: ToolsOzoneCommunicationCreateTemplate.Output; - }; - "tools.ozone.communication.deleteTemplate": { - input: ToolsOzoneCommunicationDeleteTemplate.Input; - }; - "tools.ozone.communication.updateTemplate": { - input: ToolsOzoneCommunicationUpdateTemplate.Input; - output: ToolsOzoneCommunicationUpdateTemplate.Output; - }; - "tools.ozone.moderation.emitEvent": { - input: ToolsOzoneModerationEmitEvent.Input; - output: ToolsOzoneModerationEmitEvent.Output; - }; - "tools.ozone.set.addValues": { - input: ToolsOzoneSetAddValues.Input; - }; - "tools.ozone.set.deleteSet": { - input: ToolsOzoneSetDeleteSet.Input; - output: ToolsOzoneSetDeleteSet.Output; - }; - "tools.ozone.set.deleteValues": { - input: ToolsOzoneSetDeleteValues.Input; - }; - "tools.ozone.set.upsertSet": { - input: ToolsOzoneSetUpsertSet.Input; - output: ToolsOzoneSetUpsertSet.Output; - }; - "tools.ozone.setting.removeOptions": { - input: ToolsOzoneSettingRemoveOptions.Input; - output: ToolsOzoneSettingRemoveOptions.Output; - }; - "tools.ozone.setting.upsertOption": { - input: ToolsOzoneSettingUpsertOption.Input; - output: ToolsOzoneSettingUpsertOption.Output; - }; - "tools.ozone.team.addMember": { - input: ToolsOzoneTeamAddMember.Input; - output: ToolsOzoneTeamAddMember.Output; - }; - "tools.ozone.team.deleteMember": { - input: ToolsOzoneTeamDeleteMember.Input; - }; - "tools.ozone.team.updateMember": { - input: ToolsOzoneTeamUpdateMember.Input; - output: ToolsOzoneTeamUpdateMember.Output; - }; -} - -export declare interface Subscriptions { - "com.atproto.label.subscribeLabels": { - params: ComAtprotoLabelSubscribeLabels.Params; - message: ComAtprotoLabelSubscribeLabels.Message; - errors: ComAtprotoLabelSubscribeLabels.Errors; - }; - "com.atproto.sync.subscribeRepos": { - params: ComAtprotoSyncSubscribeRepos.Params; - message: ComAtprotoSyncSubscribeRepos.Message; - errors: ComAtprotoSyncSubscribeRepos.Errors; - }; -} +/* eslint-disable */ +// This file is automatically generated by @tsky/lex-cli, do not edit! + +/** + * @module + * Contains type declarations for Bluesky lexicons + * @generated + * Generated on: 2024-12-04T01:51:07.265Z + * Version: main + * Source: https://github.com/bluesky-social/atproto/tree/c72145dbeb2d67068bc28c00a13447e0d382d121/lexicons + */ + +/** Base type with optional type field */ +export interface TypedBase { + $type?: string; +} + +/** Base type for all record types */ +export interface RecordBase { + $type: string; +} + +/** Makes $type required and specific */ +export type Typed = Omit< + T, + '$type' +> & { + $type: Type; +}; + +/** Creates a union of objects discriminated by $type */ +export type TypeUnion = T extends any + ? Typed + : never; + +/** Type guard for records */ +export function isRecord(value: unknown): value is RecordBase { + return ( + typeof value === 'object' && + value !== null && + '$type' in value && + typeof value.$type === 'string' + ); +} + +/** Base AT Protocol schema types */ +export declare namespace At { + /** CID string */ + type CID = string; + + /** DID of a user */ + type DID = `did:${string}`; + + /** User handle */ + type Handle = string; + + /** URI string */ + type Uri = string; + + /** Object containing a CID string */ + interface CIDLink { + $link: CID; + } + + /** Object containing a base64-encoded bytes */ + interface Bytes { + $bytes: string; + } + + /** Blob interface */ + interface Blob extends RecordBase { + $type: 'blob'; + mimeType: T; + ref: { + $link: string; + }; + size: number; + } +} +export declare namespace AppBskyActorDefs { + interface AdultContentPref extends TypedBase { + /** \@default false */ + enabled: boolean; + } + /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ + interface BskyAppProgressGuide extends TypedBase { + /** Maximum string length: 100 */ + guide: string; + } + /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ + interface BskyAppStatePref extends TypedBase { + activeProgressGuide?: BskyAppProgressGuide; + /** + * Storage for NUXs the user has encountered. + * Maximum array length: 100 + */ + nuxs?: AppBskyActorDefs.Nux[]; + /** + * An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. + * Maximum array length: 1000 + * Maximum string length: 100 + */ + queuedNudges?: string[]; + } + interface ContentLabelPref extends TypedBase { + label: string; + visibility: 'hide' | 'ignore' | 'show' | 'warn' | (string & {}); + /** Which labeler does this preference apply to? If undefined, applies globally. */ + labelerDid?: At.DID; + } + interface FeedViewPref extends TypedBase { + /** The URI of the feed, or an identifier which describes the feed. */ + feed: string; + /** Hide quote posts in the feed. */ + hideQuotePosts?: boolean; + /** Hide replies in the feed. */ + hideReplies?: boolean; + /** Hide replies in the feed if they do not have this number of likes. */ + hideRepliesByLikeCount?: number; + /** + * Hide replies in the feed if they are not by followed users. + * \@default true + */ + hideRepliesByUnfollowed?: boolean; + /** Hide reposts in the feed. */ + hideReposts?: boolean; + } + interface HiddenPostsPref extends TypedBase { + /** A list of URIs of posts the account owner has hidden. */ + items: At.Uri[]; + } + interface InterestsPref extends TypedBase { + /** + * A list of tags which describe the account owner's interests gathered during onboarding. + * Maximum array length: 100 + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tags: string[]; + } + /** The subject's followers whom you also follow */ + interface KnownFollowers extends TypedBase { + count: number; + /** + * Minimum array length: 0 + * Maximum array length: 5 + */ + followers: ProfileViewBasic[]; + } + interface LabelerPrefItem extends TypedBase { + did: At.DID; + } + interface LabelersPref extends TypedBase { + labelers: LabelerPrefItem[]; + } + /** A word that the account owner has muted. */ + interface MutedWord extends TypedBase { + /** The intended targets of the muted word. */ + targets: AppBskyActorDefs.MutedWordTarget[]; + /** + * The muted word itself. + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + value: string; + /** + * Groups of users to apply the muted word to. If undefined, applies to all users. + * \@default "all" + */ + actorTarget?: 'all' | 'exclude-following' | (string & {}); + /** The date and time at which the muted word will expire and no longer be applied. */ + expiresAt?: string; + id?: string; + } + interface MutedWordsPref extends TypedBase { + /** A list of words the account owner has muted. */ + items: AppBskyActorDefs.MutedWord[]; + } + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + type MutedWordTarget = 'content' | 'tag' | (string & {}); + /** A new user experiences (NUX) storage object */ + interface Nux extends TypedBase { + /** \@default false */ + completed: boolean; + /** Maximum string length: 100 */ + id: string; + /** + * Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + data?: string; + /** The date and time at which the NUX will expire and should be considered completed. */ + expiresAt?: string; + } + interface PersonalDetailsPref extends TypedBase { + /** The birth date of account owner. */ + birthDate?: string; + } + type Preferences = TypeUnion< + | AdultContentPref + | BskyAppStatePref + | ContentLabelPref + | FeedViewPref + | HiddenPostsPref + | InterestsPref + | LabelersPref + | MutedWordsPref + | PersonalDetailsPref + | SavedFeedsPref + | SavedFeedsPrefV2 + | ThreadViewPref + >[]; + interface ProfileAssociated extends TypedBase { + chat?: ProfileAssociatedChat; + feedgens?: number; + labeler?: boolean; + lists?: number; + starterPacks?: number; + } + interface ProfileAssociatedChat extends TypedBase { + allowIncoming: 'all' | 'following' | 'none' | (string & {}); + } + interface ProfileView extends TypedBase { + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + createdAt?: string; + /** + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + indexedAt?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: ViewerState; + } + interface ProfileViewBasic extends TypedBase { + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + createdAt?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: ViewerState; + } + interface ProfileViewDetailed extends TypedBase { + did: At.DID; + handle: At.Handle; + associated?: ProfileAssociated; + avatar?: string; + banner?: string; + createdAt?: string; + /** + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + followersCount?: number; + followsCount?: number; + indexedAt?: string; + joinedViaStarterPack?: AppBskyGraphDefs.StarterPackViewBasic; + labels?: ComAtprotoLabelDefs.Label[]; + pinnedPost?: ComAtprotoRepoStrongRef.Main; + postsCount?: number; + viewer?: ViewerState; + } + interface SavedFeed extends TypedBase { + id: string; + pinned: boolean; + type: 'feed' | 'list' | 'timeline' | (string & {}); + value: string; + } + interface SavedFeedsPref extends TypedBase { + pinned: At.Uri[]; + saved: At.Uri[]; + timelineIndex?: number; + } + interface SavedFeedsPrefV2 extends TypedBase { + items: AppBskyActorDefs.SavedFeed[]; + } + interface ThreadViewPref extends TypedBase { + /** Show followed users at the top of all replies. */ + prioritizeFollowedUsers?: boolean; + /** Sorting mode for threads. */ + sort?: + | 'hotness' + | 'most-likes' + | 'newest' + | 'oldest' + | 'random' + | (string & {}); + } + /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ + interface ViewerState extends TypedBase { + blockedBy?: boolean; + blocking?: At.Uri; + blockingByList?: AppBskyGraphDefs.ListViewBasic; + followedBy?: At.Uri; + following?: At.Uri; + knownFollowers?: KnownFollowers; + muted?: boolean; + mutedByList?: AppBskyGraphDefs.ListViewBasic; + } +} + +/** Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. */ +export declare namespace AppBskyActorGetPreferences { + type Input = undefined; + interface Output extends TypedBase { + preferences: AppBskyActorDefs.Preferences; + } +} + +/** Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. */ +export declare namespace AppBskyActorGetProfile { + interface Params extends TypedBase { + /** Handle or DID of account to fetch profile of. */ + actor: string; + } + type Input = undefined; + type Output = AppBskyActorDefs.ProfileViewDetailed; +} + +/** Get detailed profile views of multiple actors. */ +export declare namespace AppBskyActorGetProfiles { + interface Params extends TypedBase { + /** Maximum array length: 25 */ + actors: string[]; + } + type Input = undefined; + interface Output extends TypedBase { + profiles: AppBskyActorDefs.ProfileViewDetailed[]; + } +} + +/** Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. */ +export declare namespace AppBskyActorGetSuggestions { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + actors: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +export declare namespace AppBskyActorProfile { + /** A declaration of a Bluesky account profile. */ + interface Record extends RecordBase { + $type: 'app.bsky.actor.profile'; + /** Small image to be displayed next to posts from account. AKA, 'profile picture' */ + avatar?: At.Blob; + /** Larger horizontal image to display behind profile view. */ + banner?: At.Blob; + createdAt?: string; + /** + * Free-form profile description text. + * Maximum string length: 2560 + * Maximum grapheme length: 256 + */ + description?: string; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main; + /** Self-label values, specific to the Bluesky application, on the overall account. */ + labels?: TypeUnion; + pinnedPost?: ComAtprotoRepoStrongRef.Main; + } +} + +/** Set the private preferences attached to the account. */ +export declare namespace AppBskyActorPutPreferences { + interface Params extends TypedBase {} + interface Input extends TypedBase { + preferences: AppBskyActorDefs.Preferences; + } + type Output = undefined; +} + +/** Find actors (profiles) matching search criteria. Does not require auth. */ +export declare namespace AppBskyActorSearchActors { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q?: string; + /** + * DEPRECATED: use 'q' instead. + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output extends TypedBase { + actors: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. */ +export declare namespace AppBskyActorSearchActorsTypeahead { + interface Params extends TypedBase { + /** + * Minimum: 1 + * Maximum: 100 + * \@default 10 + */ + limit?: number; + /** Search query prefix; not a full query string. */ + q?: string; + /** + * DEPRECATED: use 'q' instead. + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output extends TypedBase { + actors: AppBskyActorDefs.ProfileViewBasic[]; + } +} + +export declare namespace AppBskyEmbedDefs { + /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ + interface AspectRatio extends TypedBase { + /** Minimum: 1 */ + height: number; + /** Minimum: 1 */ + width: number; + } +} + +export declare namespace AppBskyEmbedExternal { + /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ + interface Main extends TypedBase { + external: External; + } + interface External extends TypedBase { + description: string; + title: string; + uri: string; + thumb?: At.Blob; + } + interface View extends TypedBase { + external: ViewExternal; + } + interface ViewExternal extends TypedBase { + description: string; + title: string; + uri: string; + thumb?: string; + } +} + +export declare namespace AppBskyEmbedImages { + interface Main extends TypedBase { + /** Maximum array length: 4 */ + images: Image[]; + } + interface Image extends TypedBase { + /** Alt text description of the image, for accessibility. */ + alt: string; + image: At.Blob; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + } + interface View extends TypedBase { + /** Maximum array length: 4 */ + images: ViewImage[]; + } + interface ViewImage extends TypedBase { + /** Alt text description of the image, for accessibility. */ + alt: string; + /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ + fullsize: string; + /** Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. */ + thumb: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + } +} + +export declare namespace AppBskyEmbedRecord { + interface Main extends TypedBase { + record: ComAtprotoRepoStrongRef.Main; + } + interface View extends TypedBase { + record: TypeUnion< + | ViewBlocked + | ViewDetached + | ViewNotFound + | ViewRecord + | AppBskyFeedDefs.GeneratorView + | AppBskyGraphDefs.ListView + | AppBskyGraphDefs.StarterPackViewBasic + | AppBskyLabelerDefs.LabelerView + >; + } + interface ViewBlocked extends TypedBase { + author: AppBskyFeedDefs.BlockedAuthor; + blocked: boolean; + uri: At.Uri; + } + interface ViewDetached extends TypedBase { + detached: boolean; + uri: At.Uri; + } + interface ViewNotFound extends TypedBase { + notFound: boolean; + uri: At.Uri; + } + interface ViewRecord extends TypedBase { + author: AppBskyActorDefs.ProfileViewBasic; + cid: At.CID; + indexedAt: string; + uri: At.Uri; + /** The record data itself. */ + value: unknown; + embeds?: TypeUnion< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedRecord.View + | AppBskyEmbedRecordWithMedia.View + | AppBskyEmbedVideo.View + >[]; + labels?: ComAtprotoLabelDefs.Label[]; + likeCount?: number; + quoteCount?: number; + replyCount?: number; + repostCount?: number; + } +} + +export declare namespace AppBskyEmbedRecordWithMedia { + interface Main extends TypedBase { + media: TypeUnion< + | AppBskyEmbedExternal.Main + | AppBskyEmbedImages.Main + | AppBskyEmbedVideo.Main + >; + record: AppBskyEmbedRecord.Main; + } + interface View extends TypedBase { + media: TypeUnion< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedVideo.View + >; + record: AppBskyEmbedRecord.View; + } +} + +export declare namespace AppBskyEmbedVideo { + interface Main extends TypedBase { + video: At.Blob; + /** + * Alt text description of the video, for accessibility. + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + alt?: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + /** Maximum array length: 20 */ + captions?: Caption[]; + } + interface Caption extends TypedBase { + file: At.Blob; + lang: string; + } + interface View extends TypedBase { + cid: At.CID; + playlist: string; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + alt?: string; + aspectRatio?: AppBskyEmbedDefs.AspectRatio; + thumbnail?: string; + } +} + +export declare namespace AppBskyFeedDefs { + interface BlockedAuthor extends TypedBase { + did: At.DID; + viewer?: AppBskyActorDefs.ViewerState; + } + interface BlockedPost extends TypedBase { + author: BlockedAuthor; + blocked: boolean; + uri: At.Uri; + } + type ClickthroughAuthor = 'app.bsky.feed.defs#clickthroughAuthor'; + type ClickthroughEmbed = 'app.bsky.feed.defs#clickthroughEmbed'; + type ClickthroughItem = 'app.bsky.feed.defs#clickthroughItem'; + type ClickthroughReposter = 'app.bsky.feed.defs#clickthroughReposter'; + interface FeedViewPost extends TypedBase { + post: PostView; + /** + * Context provided by feed generator that may be passed back alongside interactions. + * Maximum string length: 2000 + */ + feedContext?: string; + reason?: TypeUnion; + reply?: ReplyRef; + } + interface GeneratorView extends TypedBase { + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + did: At.DID; + displayName: string; + indexedAt: string; + uri: At.Uri; + acceptsInteractions?: boolean; + avatar?: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: GeneratorViewerState; + } + interface GeneratorViewerState extends TypedBase { + like?: At.Uri; + } + interface Interaction extends TypedBase { + event?: + | 'app.bsky.feed.defs#clickthroughAuthor' + | 'app.bsky.feed.defs#clickthroughEmbed' + | 'app.bsky.feed.defs#clickthroughItem' + | 'app.bsky.feed.defs#clickthroughReposter' + | 'app.bsky.feed.defs#interactionLike' + | 'app.bsky.feed.defs#interactionQuote' + | 'app.bsky.feed.defs#interactionReply' + | 'app.bsky.feed.defs#interactionRepost' + | 'app.bsky.feed.defs#interactionSeen' + | 'app.bsky.feed.defs#interactionShare' + | 'app.bsky.feed.defs#requestLess' + | 'app.bsky.feed.defs#requestMore' + | (string & {}); + /** + * Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. + * Maximum string length: 2000 + */ + feedContext?: string; + item?: At.Uri; + } + type InteractionLike = 'app.bsky.feed.defs#interactionLike'; + type InteractionQuote = 'app.bsky.feed.defs#interactionQuote'; + type InteractionReply = 'app.bsky.feed.defs#interactionReply'; + type InteractionRepost = 'app.bsky.feed.defs#interactionRepost'; + type InteractionSeen = 'app.bsky.feed.defs#interactionSeen'; + type InteractionShare = 'app.bsky.feed.defs#interactionShare'; + interface NotFoundPost extends TypedBase { + notFound: boolean; + uri: At.Uri; + } + interface PostView extends TypedBase { + author: AppBskyActorDefs.ProfileViewBasic; + cid: At.CID; + indexedAt: string; + record: unknown; + uri: At.Uri; + embed?: TypeUnion< + | AppBskyEmbedExternal.View + | AppBskyEmbedImages.View + | AppBskyEmbedRecord.View + | AppBskyEmbedRecordWithMedia.View + | AppBskyEmbedVideo.View + >; + labels?: ComAtprotoLabelDefs.Label[]; + likeCount?: number; + quoteCount?: number; + replyCount?: number; + repostCount?: number; + threadgate?: ThreadgateView; + viewer?: ViewerState; + } + interface ReasonPin extends TypedBase {} + interface ReasonRepost extends TypedBase { + by: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + } + interface ReplyRef extends TypedBase { + parent: TypeUnion; + root: TypeUnion; + /** When parent is a reply to another post, this is the author of that post. */ + grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic; + } + type RequestLess = 'app.bsky.feed.defs#requestLess'; + type RequestMore = 'app.bsky.feed.defs#requestMore'; + interface SkeletonFeedPost extends TypedBase { + post: At.Uri; + /** + * Context that will be passed through to client and may be passed to feed generator back alongside interactions. + * Maximum string length: 2000 + */ + feedContext?: string; + reason?: TypeUnion; + } + interface SkeletonReasonPin extends TypedBase {} + interface SkeletonReasonRepost extends TypedBase { + repost: At.Uri; + } + interface ThreadgateView extends TypedBase { + cid?: At.CID; + lists?: AppBskyGraphDefs.ListViewBasic[]; + record?: unknown; + uri?: At.Uri; + } + interface ThreadViewPost extends TypedBase { + post: PostView; + parent?: TypeUnion; + replies?: TypeUnion[]; + } + /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ + interface ViewerState extends TypedBase { + embeddingDisabled?: boolean; + like?: At.Uri; + pinned?: boolean; + replyDisabled?: boolean; + repost?: At.Uri; + threadMuted?: boolean; + } +} + +/** Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). */ +export declare namespace AppBskyFeedDescribeFeedGenerator { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + did: At.DID; + feeds: Feed[]; + links?: Links; + } + interface Feed extends TypedBase { + uri: At.Uri; + } + interface Links extends TypedBase { + privacyPolicy?: string; + termsOfService?: string; + } +} + +export declare namespace AppBskyFeedGenerator { + /** Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. */ + interface Record extends RecordBase { + $type: 'app.bsky.feed.generator'; + createdAt: string; + did: At.DID; + /** + * Maximum string length: 240 + * Maximum grapheme length: 24 + */ + displayName: string; + /** Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions */ + acceptsInteractions?: boolean; + avatar?: At.Blob; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + /** Self-label values */ + labels?: TypeUnion; + } +} + +/** Get a list of feeds (feed generator records) created by the actor (in the actor's repo). */ +export declare namespace AppBskyFeedGetActorFeeds { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. */ +export declare namespace AppBskyFeedGetActorLikes { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors extends TypedBase { + BlockedActor: {}; + BlockedByActor: {}; + } +} + +/** Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. */ +export declare namespace AppBskyFeedGetAuthorFeed { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Combinations of post/repost types to include in response. + * \@default "posts_with_replies" + */ + filter?: + | 'posts_and_author_threads' + | 'posts_no_replies' + | 'posts_with_media' + | 'posts_with_replies' + | (string & {}); + /** \@default false */ + includePins?: boolean; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors extends TypedBase { + BlockedActor: {}; + BlockedByActor: {}; + } +} + +/** Get a hydrated feed from an actor's selected feed generator. Implemented by App View. */ +export declare namespace AppBskyFeedGetFeed { + interface Params extends TypedBase { + feed: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors extends TypedBase { + UnknownFeed: {}; + } +} + +/** Get information about a feed generator. Implemented by AppView. */ +export declare namespace AppBskyFeedGetFeedGenerator { + interface Params extends TypedBase { + /** AT-URI of the feed generator record. */ + feed: At.Uri; + } + type Input = undefined; + interface Output extends TypedBase { + /** Indicates whether the feed generator service has been online recently, or else seems to be inactive. */ + isOnline: boolean; + /** Indicates whether the feed generator service is compatible with the record declaration. */ + isValid: boolean; + view: AppBskyFeedDefs.GeneratorView; + } +} + +/** Get information about a list of feed generators. */ +export declare namespace AppBskyFeedGetFeedGenerators { + interface Params extends TypedBase { + feeds: At.Uri[]; + } + type Input = undefined; + interface Output extends TypedBase { + feeds: AppBskyFeedDefs.GeneratorView[]; + } +} + +/** Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. */ +export declare namespace AppBskyFeedGetFeedSkeleton { + interface Params extends TypedBase { + /** Reference to feed generator record describing the specific feed being requested. */ + feed: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feed: AppBskyFeedDefs.SkeletonFeedPost[]; + cursor?: string; + } + interface Errors extends TypedBase { + UnknownFeed: {}; + } +} + +/** Get like records which reference a subject (by AT-URI and CID). */ +export declare namespace AppBskyFeedGetLikes { + interface Params extends TypedBase { + /** AT-URI of the subject (eg, a post record). */ + uri: At.Uri; + /** CID of the subject record (aka, specific version of record), to filter likes. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + likes: Like[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } + interface Like extends TypedBase { + actor: AppBskyActorDefs.ProfileView; + createdAt: string; + indexedAt: string; + } +} + +/** Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. */ +export declare namespace AppBskyFeedGetListFeed { + interface Params extends TypedBase { + /** Reference (AT-URI) to the list record. */ + list: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } + interface Errors extends TypedBase { + UnknownList: {}; + } +} + +/** Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. */ +export declare namespace AppBskyFeedGetPosts { + interface Params extends TypedBase { + /** + * List of post AT-URIs to return hydrated views for. + * Maximum array length: 25 + */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output extends TypedBase { + posts: AppBskyFeedDefs.PostView[]; + } +} + +/** Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. */ +export declare namespace AppBskyFeedGetPostThread { + interface Params extends TypedBase { + /** Reference (AT-URI) to post record. */ + uri: At.Uri; + /** + * How many levels of reply depth should be included in response. + * Minimum: 0 + * Maximum: 1000 + * \@default 6 + */ + depth?: number; + /** + * How many levels of parent (and grandparent, etc) post to include. + * Minimum: 0 + * Maximum: 1000 + * \@default 80 + */ + parentHeight?: number; + } + type Input = undefined; + interface Output extends TypedBase { + thread: TypeUnion< + | AppBskyFeedDefs.BlockedPost + | AppBskyFeedDefs.NotFoundPost + | AppBskyFeedDefs.ThreadViewPost + >; + threadgate?: AppBskyFeedDefs.ThreadgateView; + } + interface Errors extends TypedBase { + NotFound: {}; + } +} + +/** Get a list of quotes for a given post. */ +export declare namespace AppBskyFeedGetQuotes { + interface Params extends TypedBase { + /** Reference (AT-URI) of post record */ + uri: At.Uri; + /** If supplied, filters to quotes of specific version (by CID) of the post record. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + posts: AppBskyFeedDefs.PostView[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } +} + +/** Get a list of reposts for a given post. */ +export declare namespace AppBskyFeedGetRepostedBy { + interface Params extends TypedBase { + /** Reference (AT-URI) of post record */ + uri: At.Uri; + /** If supplied, filters to reposts of specific version (by CID) of the post record. */ + cid?: At.CID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + repostedBy: AppBskyActorDefs.ProfileView[]; + uri: At.Uri; + cid?: At.CID; + cursor?: string; + } +} + +/** Get a list of suggested feeds (feed generators) for the requesting account. */ +export declare namespace AppBskyFeedGetSuggestedFeeds { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. */ +export declare namespace AppBskyFeedGetTimeline { + interface Params extends TypedBase { + /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ + algorithm?: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + feed: AppBskyFeedDefs.FeedViewPost[]; + cursor?: string; + } +} + +export declare namespace AppBskyFeedLike { + /** Record declaring a 'like' of a piece of subject content. */ + interface Record extends RecordBase { + $type: 'app.bsky.feed.like'; + createdAt: string; + subject: ComAtprotoRepoStrongRef.Main; + } +} + +export declare namespace AppBskyFeedPost { + /** Record containing a Bluesky post. */ + interface Record extends RecordBase { + $type: 'app.bsky.feed.post'; + /** Client-declared timestamp when this post was originally created. */ + createdAt: string; + /** + * The primary post content. May be an empty string, if there are embeds. + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + text: string; + embed?: TypeUnion< + | AppBskyEmbedExternal.Main + | AppBskyEmbedImages.Main + | AppBskyEmbedRecord.Main + | AppBskyEmbedRecordWithMedia.Main + | AppBskyEmbedVideo.Main + >; + /** + * DEPRECATED: replaced by app.bsky.richtext.facet. + * \@deprecated + */ + entities?: Entity[]; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + /** Self-label values for this post. Effectively content warnings. */ + labels?: TypeUnion; + /** + * Indicates human language of post primary text content. + * Maximum array length: 3 + */ + langs?: string[]; + reply?: ReplyRef; + /** + * Additional hashtags, in addition to any included in post text and facets. + * Maximum array length: 8 + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tags?: string[]; + } + /** + * Deprecated: use facets instead. + * \@deprecated + */ + interface Entity extends TypedBase { + index: TextSlice; + /** Expected values are 'mention' and 'link'. */ + type: string; + value: string; + } + interface ReplyRef extends TypedBase { + parent: ComAtprotoRepoStrongRef.Main; + root: ComAtprotoRepoStrongRef.Main; + } + /** + * Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. + * \@deprecated + */ + interface TextSlice extends TypedBase { + /** Minimum: 0 */ + end: number; + /** Minimum: 0 */ + start: number; + } +} + +export declare namespace AppBskyFeedPostgate { + /** Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. */ + interface Record extends RecordBase { + $type: 'app.bsky.feed.postgate'; + createdAt: string; + /** Reference (AT-URI) to the post record. */ + post: At.Uri; + /** + * List of AT-URIs embedding this post that the author has detached from. + * Maximum array length: 50 + */ + detachedEmbeddingUris?: At.Uri[]; + /** Maximum array length: 5 */ + embeddingRules?: TypeUnion[]; + } + /** Disables embedding of this post. */ + interface DisableRule extends TypedBase {} +} + +export declare namespace AppBskyFeedRepost { + /** Record representing a 'repost' of an existing Bluesky post. */ + interface Record extends RecordBase { + $type: 'app.bsky.feed.repost'; + createdAt: string; + subject: ComAtprotoRepoStrongRef.Main; + } +} + +/** Find posts matching search criteria, returning views of those posts. */ +export declare namespace AppBskyFeedSearchPosts { + interface Params extends TypedBase { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ + author?: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ + domain?: string; + /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ + lang?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ + mentions?: string; + /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ + since?: string; + /** + * Specifies the ranking order of results. + * \@default "latest" + */ + sort?: 'latest' | 'top' | (string & {}); + /** + * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag?: string[]; + /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ + until?: string; + /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ + url?: string; + } + type Input = undefined; + interface Output extends TypedBase { + posts: AppBskyFeedDefs.PostView[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors extends TypedBase { + BadQueryString: {}; + } +} + +/** Send information about interactions with feed items back to the feed generator that served them. */ +export declare namespace AppBskyFeedSendInteractions { + interface Params extends TypedBase {} + interface Input extends TypedBase { + interactions: AppBskyFeedDefs.Interaction[]; + } + interface Output extends TypedBase {} +} + +export declare namespace AppBskyFeedThreadgate { + /** Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. */ + interface Record extends RecordBase { + $type: 'app.bsky.feed.threadgate'; + createdAt: string; + /** Reference (AT-URI) to the post record. */ + post: At.Uri; + /** Maximum array length: 5 */ + allow?: TypeUnion[]; + /** + * List of hidden reply URIs. + * Maximum array length: 50 + */ + hiddenReplies?: At.Uri[]; + } + /** Allow replies from actors you follow. */ + interface FollowingRule extends TypedBase {} + /** Allow replies from actors on a list. */ + interface ListRule extends TypedBase { + list: At.Uri; + } + /** Allow replies from actors mentioned in your post. */ + interface MentionRule extends TypedBase {} +} + +export declare namespace AppBskyGraphBlock { + /** Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. */ + interface Record extends RecordBase { + $type: 'app.bsky.graph.block'; + createdAt: string; + /** DID of the account to be blocked. */ + subject: At.DID; + } +} + +export declare namespace AppBskyGraphDefs { + type Curatelist = 'app.bsky.graph.defs#curatelist'; + interface ListItemView extends TypedBase { + subject: AppBskyActorDefs.ProfileView; + uri: At.Uri; + } + type ListPurpose = + | 'app.bsky.graph.defs#curatelist' + | 'app.bsky.graph.defs#modlist' + | 'app.bsky.graph.defs#referencelist' + | (string & {}); + interface ListView extends TypedBase { + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + /** + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + purpose: ListPurpose; + uri: At.Uri; + avatar?: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + viewer?: ListViewerState; + } + interface ListViewBasic extends TypedBase { + cid: At.CID; + /** + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + purpose: ListPurpose; + uri: At.Uri; + avatar?: string; + indexedAt?: string; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + viewer?: ListViewerState; + } + interface ListViewerState extends TypedBase { + blocked?: At.Uri; + muted?: boolean; + } + type Modlist = 'app.bsky.graph.defs#modlist'; + /** indicates that a handle or DID could not be resolved */ + interface NotFoundActor extends TypedBase { + actor: string; + notFound: boolean; + } + type Referencelist = 'app.bsky.graph.defs#referencelist'; + /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ + interface Relationship extends TypedBase { + did: At.DID; + /** if the actor is followed by this DID, contains the AT-URI of the follow record */ + followedBy?: At.Uri; + /** if the actor follows this DID, this is the AT-URI of the follow record */ + following?: At.Uri; + } + interface StarterPackView extends TypedBase { + cid: At.CID; + creator: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + record: unknown; + uri: At.Uri; + /** Maximum array length: 3 */ + feeds?: AppBskyFeedDefs.GeneratorView[]; + /** Minimum: 0 */ + joinedAllTimeCount?: number; + /** Minimum: 0 */ + joinedWeekCount?: number; + labels?: ComAtprotoLabelDefs.Label[]; + list?: ListViewBasic; + /** Maximum array length: 12 */ + listItemsSample?: ListItemView[]; + } + interface StarterPackViewBasic extends TypedBase { + cid: At.CID; + creator: AppBskyActorDefs.ProfileViewBasic; + indexedAt: string; + record: unknown; + uri: At.Uri; + /** Minimum: 0 */ + joinedAllTimeCount?: number; + /** Minimum: 0 */ + joinedWeekCount?: number; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + listItemCount?: number; + } +} + +export declare namespace AppBskyGraphFollow { + /** Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. */ + interface Record extends RecordBase { + $type: 'app.bsky.graph.follow'; + createdAt: string; + subject: At.DID; + } +} + +/** Get a list of starter packs created by the actor. */ +export declare namespace AppBskyGraphGetActorStarterPacks { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + cursor?: string; + } +} + +/** Enumerates which accounts the requesting account is currently blocking. Requires auth. */ +export declare namespace AppBskyGraphGetBlocks { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + blocks: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Enumerates accounts which follow a specified account (actor). */ +export declare namespace AppBskyGraphGetFollowers { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + followers: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Enumerates accounts which a specified account (actor) follows. */ +export declare namespace AppBskyGraphGetFollows { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + follows: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Enumerates accounts which follow a specified account (actor) and are followed by the viewer. */ +export declare namespace AppBskyGraphGetKnownFollowers { + interface Params extends TypedBase { + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + followers: AppBskyActorDefs.ProfileView[]; + subject: AppBskyActorDefs.ProfileView; + cursor?: string; + } +} + +/** Gets a 'view' (with additional context) of a specified list. */ +export declare namespace AppBskyGraphGetList { + interface Params extends TypedBase { + /** Reference (AT-URI) of the list record to hydrate. */ + list: At.Uri; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + items: AppBskyGraphDefs.ListItemView[]; + list: AppBskyGraphDefs.ListView; + cursor?: string; + } +} + +/** Get mod lists that the requesting account (actor) is blocking. Requires auth. */ +export declare namespace AppBskyGraphGetListBlocks { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. */ +export declare namespace AppBskyGraphGetListMutes { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates the lists created by a specified account (actor). */ +export declare namespace AppBskyGraphGetLists { + interface Params extends TypedBase { + /** The account (actor) to enumerate lists from. */ + actor: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + lists: AppBskyGraphDefs.ListView[]; + cursor?: string; + } +} + +/** Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. */ +export declare namespace AppBskyGraphGetMutes { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + mutes: AppBskyActorDefs.ProfileView[]; + cursor?: string; + } +} + +/** Enumerates public relationships between one account, and a list of other accounts. Does not require auth. */ +export declare namespace AppBskyGraphGetRelationships { + interface Params extends TypedBase { + /** Primary account requesting relationships for. */ + actor: string; + /** + * List of 'other' accounts to be related back to the primary. + * Maximum array length: 30 + */ + others?: string[]; + } + type Input = undefined; + interface Output extends TypedBase { + relationships: TypeUnion< + AppBskyGraphDefs.NotFoundActor | AppBskyGraphDefs.Relationship + >[]; + actor?: At.DID; + } + interface Errors extends TypedBase { + ActorNotFound: {}; + } +} + +/** Gets a view of a starter pack. */ +export declare namespace AppBskyGraphGetStarterPack { + interface Params extends TypedBase { + /** Reference (AT-URI) of the starter pack record. */ + starterPack: At.Uri; + } + type Input = undefined; + interface Output extends TypedBase { + starterPack: AppBskyGraphDefs.StarterPackView; + } +} + +/** Get views for a list of starter packs. */ +export declare namespace AppBskyGraphGetStarterPacks { + interface Params extends TypedBase { + /** Maximum array length: 25 */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output extends TypedBase { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + } +} + +/** Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. */ +export declare namespace AppBskyGraphGetSuggestedFollowsByActor { + interface Params extends TypedBase { + actor: string; + } + type Input = undefined; + interface Output extends TypedBase { + suggestions: AppBskyActorDefs.ProfileView[]; + /** + * If true, response has fallen-back to generic results, and is not scoped using relativeToDid + * \@default false + */ + isFallback?: boolean; + } +} + +export declare namespace AppBskyGraphList { + /** Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. */ + interface Record extends RecordBase { + $type: 'app.bsky.graph.list'; + createdAt: string; + /** + * Display name for list; can not be empty. + * Minimum string length: 1 + * Maximum string length: 64 + */ + name: string; + /** Defines the purpose of the list (aka, moderation-oriented or curration-oriented) */ + purpose: AppBskyGraphDefs.ListPurpose; + avatar?: At.Blob; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + labels?: TypeUnion; + } +} + +export declare namespace AppBskyGraphListblock { + /** Record representing a block relationship against an entire an entire list of accounts (actors). */ + interface Record extends RecordBase { + $type: 'app.bsky.graph.listblock'; + createdAt: string; + /** Reference (AT-URI) to the mod list record. */ + subject: At.Uri; + } +} + +export declare namespace AppBskyGraphListitem { + /** Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. */ + interface Record extends RecordBase { + $type: 'app.bsky.graph.listitem'; + createdAt: string; + /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ + list: At.Uri; + /** The account which is included on the list. */ + subject: At.DID; + } +} + +/** Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteActor { + interface Params extends TypedBase {} + interface Input extends TypedBase { + actor: string; + } + type Output = undefined; +} + +/** Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteActorList { + interface Params extends TypedBase {} + interface Input extends TypedBase { + list: At.Uri; + } + type Output = undefined; +} + +/** Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. */ +export declare namespace AppBskyGraphMuteThread { + interface Params extends TypedBase {} + interface Input extends TypedBase { + root: At.Uri; + } + type Output = undefined; +} + +/** Find starter packs matching search criteria. Does not require auth. */ +export declare namespace AppBskyGraphSearchStarterPacks { + interface Params extends TypedBase { + /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]; + cursor?: string; + } +} + +export declare namespace AppBskyGraphStarterpack { + /** Record defining a starter pack of actors and feeds for new users. */ + interface Record extends RecordBase { + $type: 'app.bsky.graph.starterpack'; + createdAt: string; + /** Reference (AT-URI) to the list record. */ + list: At.Uri; + /** + * Display name for starter pack; can not be empty. + * Minimum string length: 1 + * Maximum string length: 500 + * Maximum grapheme length: 50 + */ + name: string; + /** + * Maximum string length: 3000 + * Maximum grapheme length: 300 + */ + description?: string; + descriptionFacets?: AppBskyRichtextFacet.Main[]; + /** Maximum array length: 3 */ + feeds?: FeedItem[]; + } + interface FeedItem extends TypedBase { + uri: At.Uri; + } +} + +/** Unmutes the specified account. Requires auth. */ +export declare namespace AppBskyGraphUnmuteActor { + interface Params extends TypedBase {} + interface Input extends TypedBase { + actor: string; + } + type Output = undefined; +} + +/** Unmutes the specified list of accounts. Requires auth. */ +export declare namespace AppBskyGraphUnmuteActorList { + interface Params extends TypedBase {} + interface Input extends TypedBase { + list: At.Uri; + } + type Output = undefined; +} + +/** Unmutes the specified thread. Requires auth. */ +export declare namespace AppBskyGraphUnmuteThread { + interface Params extends TypedBase {} + interface Input extends TypedBase { + root: At.Uri; + } + type Output = undefined; +} + +export declare namespace AppBskyLabelerDefs { + interface LabelerPolicies extends TypedBase { + /** The label values which this labeler publishes. May include global or custom labels. */ + labelValues: ComAtprotoLabelDefs.LabelValue[]; + /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ + labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[]; + } + interface LabelerView extends TypedBase { + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: LabelerViewerState; + } + interface LabelerViewDetailed extends TypedBase { + cid: At.CID; + creator: AppBskyActorDefs.ProfileView; + indexedAt: string; + policies: AppBskyLabelerDefs.LabelerPolicies; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + /** Minimum: 0 */ + likeCount?: number; + viewer?: LabelerViewerState; + } + interface LabelerViewerState extends TypedBase { + like?: At.Uri; + } +} + +/** Get information about a list of labeler services. */ +export declare namespace AppBskyLabelerGetServices { + interface Params extends TypedBase { + dids: At.DID[]; + /** \@default false */ + detailed?: boolean; + } + type Input = undefined; + interface Output extends TypedBase { + views: TypeUnion< + AppBskyLabelerDefs.LabelerView | AppBskyLabelerDefs.LabelerViewDetailed + >[]; + } +} + +export declare namespace AppBskyLabelerService { + /** A declaration of the existence of labeler service. */ + interface Record extends RecordBase { + $type: 'app.bsky.labeler.service'; + createdAt: string; + policies: AppBskyLabelerDefs.LabelerPolicies; + labels?: TypeUnion; + } +} + +/** Count the number of unread notifications for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationGetUnreadCount { + interface Params extends TypedBase { + priority?: boolean; + seenAt?: string; + } + type Input = undefined; + interface Output extends TypedBase { + count: number; + } +} + +/** Enumerate notifications for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationListNotifications { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + priority?: boolean; + seenAt?: string; + } + type Input = undefined; + interface Output extends TypedBase { + notifications: Notification[]; + cursor?: string; + priority?: boolean; + seenAt?: string; + } + interface Notification extends TypedBase { + author: AppBskyActorDefs.ProfileView; + cid: At.CID; + indexedAt: string; + isRead: boolean; + /** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', and 'starterpack-joined'. */ + reason: + | 'follow' + | 'like' + | 'mention' + | 'quote' + | 'reply' + | 'repost' + | 'starterpack-joined' + | (string & {}); + record: unknown; + uri: At.Uri; + labels?: ComAtprotoLabelDefs.Label[]; + reasonSubject?: At.Uri; + } +} + +/** Set notification-related preferences for an account. Requires auth. */ +export declare namespace AppBskyNotificationPutPreferences { + interface Params extends TypedBase {} + interface Input extends TypedBase { + priority: boolean; + } + type Output = undefined; +} + +/** Register to receive push notifications, via a specified service, for the requesting account. Requires auth. */ +export declare namespace AppBskyNotificationRegisterPush { + interface Params extends TypedBase {} + interface Input extends TypedBase { + appId: string; + platform: 'android' | 'ios' | 'web' | (string & {}); + serviceDid: At.DID; + token: string; + } + type Output = undefined; +} + +/** Notify server that the requesting account has seen notifications. Requires auth. */ +export declare namespace AppBskyNotificationUpdateSeen { + interface Params extends TypedBase {} + interface Input extends TypedBase { + seenAt: string; + } + type Output = undefined; +} + +export declare namespace AppBskyRichtextFacet { + /** Annotation of a sub-string within rich text. */ + interface Main extends TypedBase { + features: TypeUnion[]; + index: ByteSlice; + } + /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ + interface ByteSlice extends TypedBase { + /** Minimum: 0 */ + byteEnd: number; + /** Minimum: 0 */ + byteStart: number; + } + /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ + interface Link extends TypedBase { + uri: string; + } + /** Facet feature for mention of another account. The text is usually a handle, including a '\@' prefix, but the facet reference is a DID. */ + interface Mention extends TypedBase { + did: At.DID; + } + /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ + interface Tag extends TypedBase { + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag: string; + } +} + +export declare namespace AppBskyUnspeccedDefs { + interface SkeletonSearchActor extends TypedBase { + did: At.DID; + } + interface SkeletonSearchPost extends TypedBase { + uri: At.Uri; + } + interface SkeletonSearchStarterPack extends TypedBase { + uri: At.Uri; + } +} + +/** Get miscellaneous runtime configuration. */ +export declare namespace AppBskyUnspeccedGetConfig { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + checkEmailConfirmed?: boolean; + } +} + +/** An unspecced view of globally popular feed generators. */ +export declare namespace AppBskyUnspeccedGetPopularFeedGenerators { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + query?: string; + } + type Input = undefined; + interface Output extends TypedBase { + feeds: AppBskyFeedDefs.GeneratorView[]; + cursor?: string; + } +} + +/** Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions */ +export declare namespace AppBskyUnspeccedGetSuggestionsSkeleton { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. */ + relativeToDid?: At.DID; + /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; + cursor?: string; + /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ + relativeToDid?: At.DID; + } +} + +/** Get a list of suggestions (feeds and users) tagged with categories */ +export declare namespace AppBskyUnspeccedGetTaggedSuggestions { + type Input = undefined; + interface Output extends TypedBase { + suggestions: Suggestion[]; + } + interface Suggestion extends TypedBase { + subject: string; + subjectType: 'actor' | 'feed' | (string & {}); + tag: string; + } +} + +/** Backend Actors (profile) search, returns only skeleton. */ +export declare namespace AppBskyUnspeccedSearchActorsSkeleton { + interface Params extends TypedBase { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ + q: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** If true, acts as fast/simple 'typeahead' query. */ + typeahead?: boolean; + /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors extends TypedBase { + BadQueryString: {}; + } +} + +/** Backend Posts search, returns only skeleton */ +export declare namespace AppBskyUnspeccedSearchPostsSkeleton { + interface Params extends TypedBase { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Filter to posts by the given account. Handles are resolved to DID before query-time. */ + author?: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */ + domain?: string; + /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */ + lang?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */ + mentions?: string; + /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */ + since?: string; + /** + * Specifies the ranking order of results. + * \@default "latest" + */ + sort?: 'latest' | 'top' | (string & {}); + /** + * Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + tag?: string[]; + /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */ + until?: string; + /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */ + url?: string; + /** DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries. */ + viewer?: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors extends TypedBase { + BadQueryString: {}; + } +} + +/** Backend Starter Pack search, returns only skeleton. */ +export declare namespace AppBskyUnspeccedSearchStarterPacksSkeleton { + interface Params extends TypedBase { + /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ + q: string; + /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */ + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 25 + */ + limit?: number; + /** DID of the account making the request (not included for public/unauthenticated queries). */ + viewer?: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]; + cursor?: string; + /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ + hitsTotal?: number; + } + interface Errors extends TypedBase { + BadQueryString: {}; + } +} + +export declare namespace AppBskyVideoDefs { + interface JobStatus extends TypedBase { + did: At.DID; + jobId: string; + /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ + state: 'JOB_STATE_COMPLETED' | 'JOB_STATE_FAILED' | (string & {}); + blob?: At.Blob; + error?: string; + message?: string; + /** + * Progress within the current processing state. + * Minimum: 0 + * Maximum: 100 + */ + progress?: number; + } +} + +/** Get status details for a video processing job. */ +export declare namespace AppBskyVideoGetJobStatus { + interface Params extends TypedBase { + jobId: string; + } + type Input = undefined; + interface Output extends TypedBase { + jobStatus: AppBskyVideoDefs.JobStatus; + } +} + +/** Get video upload limits for the authenticated user. */ +export declare namespace AppBskyVideoGetUploadLimits { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + canUpload: boolean; + error?: string; + message?: string; + remainingDailyBytes?: number; + remainingDailyVideos?: number; + } +} + +/** Upload a video to be processed then stored on the PDS. */ +export declare namespace AppBskyVideoUploadVideo { + interface Params extends TypedBase {} + type Input = Blob | ArrayBufferView; + interface Output extends TypedBase { + jobStatus: AppBskyVideoDefs.JobStatus; + } +} + +export declare namespace ChatBskyActorDeclaration { + /** A declaration of a Bluesky chat account. */ + interface Record extends RecordBase { + $type: 'chat.bsky.actor.declaration'; + allowIncoming: 'all' | 'following' | 'none' | (string & {}); + } +} + +export declare namespace ChatBskyActorDefs { + interface ProfileViewBasic extends TypedBase { + did: At.DID; + handle: At.Handle; + associated?: AppBskyActorDefs.ProfileAssociated; + avatar?: string; + /** Set to true when the actor cannot actively participate in converations */ + chatDisabled?: boolean; + /** + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + displayName?: string; + labels?: ComAtprotoLabelDefs.Label[]; + viewer?: AppBskyActorDefs.ViewerState; + } +} + +export declare namespace ChatBskyActorDeleteAccount { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase {} +} + +export declare namespace ChatBskyActorExportAccountData { + interface Params extends TypedBase {} + type Input = undefined; + type Output = Uint8Array; +} + +export declare namespace ChatBskyConvoDefs { + interface ConvoView extends TypedBase { + id: string; + members: ChatBskyActorDefs.ProfileViewBasic[]; + muted: boolean; + rev: string; + unreadCount: number; + lastMessage?: TypeUnion; + opened?: boolean; + } + interface DeletedMessageView extends TypedBase { + id: string; + rev: string; + sender: MessageViewSender; + sentAt: string; + } + interface LogBeginConvo extends TypedBase { + convoId: string; + rev: string; + } + interface LogCreateMessage extends TypedBase { + convoId: string; + message: TypeUnion; + rev: string; + } + interface LogDeleteMessage extends TypedBase { + convoId: string; + message: TypeUnion; + rev: string; + } + interface LogLeaveConvo extends TypedBase { + convoId: string; + rev: string; + } + interface MessageInput extends TypedBase { + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + text: string; + embed?: TypeUnion; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + } + interface MessageRef extends TypedBase { + convoId: string; + did: At.DID; + messageId: string; + } + interface MessageView extends TypedBase { + id: string; + rev: string; + sender: MessageViewSender; + sentAt: string; + /** + * Maximum string length: 10000 + * Maximum grapheme length: 1000 + */ + text: string; + embed?: TypeUnion; + /** Annotations of text (mentions, URLs, hashtags, etc) */ + facets?: AppBskyRichtextFacet.Main[]; + } + interface MessageViewSender extends TypedBase { + did: At.DID; + } +} + +export declare namespace ChatBskyConvoDeleteMessageForSelf { + interface Params extends TypedBase {} + interface Input extends TypedBase { + convoId: string; + messageId: string; + } + type Output = ChatBskyConvoDefs.DeletedMessageView; +} + +export declare namespace ChatBskyConvoGetConvo { + interface Params extends TypedBase { + convoId: string; + } + type Input = undefined; + interface Output extends TypedBase { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoGetConvoForMembers { + interface Params extends TypedBase { + /** + * Minimum array length: 1 + * Maximum array length: 10 + */ + members: At.DID[]; + } + type Input = undefined; + interface Output extends TypedBase { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoGetLog { + interface Params extends TypedBase { + cursor?: string; + } + type Input = undefined; + interface Output extends TypedBase { + logs: TypeUnion< + | ChatBskyConvoDefs.LogBeginConvo + | ChatBskyConvoDefs.LogCreateMessage + | ChatBskyConvoDefs.LogDeleteMessage + | ChatBskyConvoDefs.LogLeaveConvo + >[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoGetMessages { + interface Params extends TypedBase { + convoId: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + messages: TypeUnion< + ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView + >[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoLeaveConvo { + interface Params extends TypedBase {} + interface Input extends TypedBase { + convoId: string; + } + interface Output extends TypedBase { + convoId: string; + rev: string; + } +} + +export declare namespace ChatBskyConvoListConvos { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + convos: ChatBskyConvoDefs.ConvoView[]; + cursor?: string; + } +} + +export declare namespace ChatBskyConvoMuteConvo { + interface Params extends TypedBase {} + interface Input extends TypedBase { + convoId: string; + } + interface Output extends TypedBase { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoSendMessage { + interface Params extends TypedBase {} + interface Input extends TypedBase { + convoId: string; + message: ChatBskyConvoDefs.MessageInput; + } + type Output = ChatBskyConvoDefs.MessageView; +} + +export declare namespace ChatBskyConvoSendMessageBatch { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Maximum array length: 100 */ + items: BatchItem[]; + } + interface Output extends TypedBase { + items: ChatBskyConvoDefs.MessageView[]; + } + interface BatchItem extends TypedBase { + convoId: string; + message: ChatBskyConvoDefs.MessageInput; + } +} + +export declare namespace ChatBskyConvoUnmuteConvo { + interface Params extends TypedBase {} + interface Input extends TypedBase { + convoId: string; + } + interface Output extends TypedBase { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyConvoUpdateRead { + interface Params extends TypedBase {} + interface Input extends TypedBase { + convoId: string; + messageId?: string; + } + interface Output extends TypedBase { + convo: ChatBskyConvoDefs.ConvoView; + } +} + +export declare namespace ChatBskyModerationGetActorMetadata { + interface Params extends TypedBase { + actor: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + all: Metadata; + day: Metadata; + month: Metadata; + } + interface Metadata extends TypedBase { + convos: number; + convosStarted: number; + messagesReceived: number; + messagesSent: number; + } +} + +export declare namespace ChatBskyModerationGetMessageContext { + interface Params extends TypedBase { + messageId: string; + /** \@default 5 */ + after?: number; + /** \@default 5 */ + before?: number; + /** Conversation that the message is from. NOTE: this field will eventually be required. */ + convoId?: string; + } + type Input = undefined; + interface Output extends TypedBase { + messages: TypeUnion< + ChatBskyConvoDefs.DeletedMessageView | ChatBskyConvoDefs.MessageView + >[]; + } +} + +export declare namespace ChatBskyModerationUpdateActorAccess { + interface Params extends TypedBase {} + interface Input extends TypedBase { + actor: At.DID; + allowAccess: boolean; + ref?: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoAdminDefs { + interface AccountView extends TypedBase { + did: At.DID; + handle: At.Handle; + indexedAt: string; + deactivatedAt?: string; + email?: string; + emailConfirmedAt?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invites?: ComAtprotoServerDefs.InviteCode[]; + invitesDisabled?: boolean; + relatedRecords?: unknown[]; + threatSignatures?: ThreatSignature[]; + } + interface RepoBlobRef extends TypedBase { + cid: At.CID; + did: At.DID; + recordUri?: At.Uri; + } + interface RepoRef extends TypedBase { + did: At.DID; + } + interface StatusAttr extends TypedBase { + applied: boolean; + ref?: string; + } + interface ThreatSignature extends TypedBase { + property: string; + value: string; + } +} + +/** Delete a user account as an administrator. */ +export declare namespace ComAtprotoAdminDeleteAccount { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + } + type Output = undefined; +} + +/** Disable an account from receiving new invite codes, but does not invalidate existing codes. */ +export declare namespace ComAtprotoAdminDisableAccountInvites { + interface Params extends TypedBase {} + interface Input extends TypedBase { + account: At.DID; + /** Optional reason for disabled invites. */ + note?: string; + } + type Output = undefined; +} + +/** Disable some set of codes and/or all codes associated with a set of users. */ +export declare namespace ComAtprotoAdminDisableInviteCodes { + interface Params extends TypedBase {} + interface Input extends TypedBase { + accounts?: string[]; + codes?: string[]; + } + type Output = undefined; +} + +/** Re-enable an account's ability to receive invite codes. */ +export declare namespace ComAtprotoAdminEnableAccountInvites { + interface Params extends TypedBase {} + interface Input extends TypedBase { + account: At.DID; + /** Optional reason for enabled invites. */ + note?: string; + } + type Output = undefined; +} + +/** Get details about an account. */ +export declare namespace ComAtprotoAdminGetAccountInfo { + interface Params extends TypedBase { + did: At.DID; + } + type Input = undefined; + type Output = ComAtprotoAdminDefs.AccountView; +} + +/** Get details about some accounts. */ +export declare namespace ComAtprotoAdminGetAccountInfos { + interface Params extends TypedBase { + dids: At.DID[]; + } + type Input = undefined; + interface Output extends TypedBase { + infos: ComAtprotoAdminDefs.AccountView[]; + } +} + +/** Get an admin view of invite codes. */ +export declare namespace ComAtprotoAdminGetInviteCodes { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 500 + * \@default 100 + */ + limit?: number; + /** \@default "recent" */ + sort?: 'recent' | 'usage' | (string & {}); + } + type Input = undefined; + interface Output extends TypedBase { + codes: ComAtprotoServerDefs.InviteCode[]; + cursor?: string; + } +} + +/** Get the service-specific admin status of a subject (account, record, or blob). */ +export declare namespace ComAtprotoAdminGetSubjectStatus { + interface Params extends TypedBase { + blob?: At.CID; + did?: At.DID; + uri?: At.Uri; + } + type Input = undefined; + interface Output extends TypedBase { + subject: TypeUnion< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + deactivated?: ComAtprotoAdminDefs.StatusAttr; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } +} + +/** Get list of accounts that matches your search query. */ +export declare namespace ComAtprotoAdminSearchAccounts { + interface Params extends TypedBase { + cursor?: string; + email?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + accounts: ComAtprotoAdminDefs.AccountView[]; + cursor?: string; + } +} + +/** Send email to a user's account email address. */ +export declare namespace ComAtprotoAdminSendEmail { + interface Params extends TypedBase {} + interface Input extends TypedBase { + content: string; + recipientDid: At.DID; + senderDid: At.DID; + /** Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers */ + comment?: string; + subject?: string; + } + interface Output extends TypedBase { + sent: boolean; + } +} + +/** Administrative action to update an account's email. */ +export declare namespace ComAtprotoAdminUpdateAccountEmail { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The handle or DID of the repo. */ + account: string; + email: string; + } + type Output = undefined; +} + +/** Administrative action to update an account's handle. */ +export declare namespace ComAtprotoAdminUpdateAccountHandle { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + handle: At.Handle; + } + type Output = undefined; +} + +/** Update the password for a user account as an administrator. */ +export declare namespace ComAtprotoAdminUpdateAccountPassword { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + password: string; + } + type Output = undefined; +} + +/** Update the service-specific admin status of a subject (account, record, or blob). */ +export declare namespace ComAtprotoAdminUpdateSubjectStatus { + interface Params extends TypedBase {} + interface Input extends TypedBase { + subject: TypeUnion< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + deactivated?: ComAtprotoAdminDefs.StatusAttr; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } + interface Output extends TypedBase { + subject: TypeUnion< + | ComAtprotoAdminDefs.RepoBlobRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + takedown?: ComAtprotoAdminDefs.StatusAttr; + } +} + +/** Describe the credentials that should be included in the DID doc of an account that is migrating to this service. */ +export declare namespace ComAtprotoIdentityGetRecommendedDidCredentials { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + alsoKnownAs?: string[]; + /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ + rotationKeys?: string[]; + services?: unknown; + verificationMethods?: unknown; + } +} + +/** Request an email with a code to in order to request a signed PLC operation. Requires Auth. */ +export declare namespace ComAtprotoIdentityRequestPlcOperationSignature { + interface Params extends TypedBase {} + type Input = undefined; + type Output = undefined; +} + +/** Resolves a handle (domain name) to a DID. */ +export declare namespace ComAtprotoIdentityResolveHandle { + interface Params extends TypedBase { + /** The handle to resolve. */ + handle: At.Handle; + } + type Input = undefined; + interface Output extends TypedBase { + did: At.DID; + } +} + +/** Signs a PLC operation to update some value(s) in the requesting DID's document. */ +export declare namespace ComAtprotoIdentitySignPlcOperation { + interface Params extends TypedBase {} + interface Input extends TypedBase { + alsoKnownAs?: string[]; + rotationKeys?: string[]; + services?: unknown; + /** A token received through com.atproto.identity.requestPlcOperationSignature */ + token?: string; + verificationMethods?: unknown; + } + interface Output extends TypedBase { + /** A signed DID PLC operation. */ + operation: unknown; + } +} + +/** Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry */ +export declare namespace ComAtprotoIdentitySubmitPlcOperation { + interface Params extends TypedBase {} + interface Input extends TypedBase { + operation: unknown; + } + type Output = undefined; +} + +/** Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. */ +export declare namespace ComAtprotoIdentityUpdateHandle { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The new handle. */ + handle: At.Handle; + } + type Output = undefined; +} + +export declare namespace ComAtprotoLabelDefs { + /** Metadata tag on an atproto resource (eg, repo or record). */ + interface Label extends TypedBase { + /** Timestamp when this label was created. */ + cts: string; + /** DID of the actor who created this label. */ + src: At.DID; + /** AT URI of the record, repository (account), or other resource that this label applies to. */ + uri: string; + /** + * The short string name of the value or type of this label. + * Maximum string length: 128 + */ + val: string; + /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */ + cid?: At.CID; + /** Timestamp at which this label expires (no longer applies). */ + exp?: string; + /** If true, this is a negation label, overwriting a previous label. */ + neg?: boolean; + /** Signature of dag-cbor encoded label. */ + sig?: At.Bytes; + /** The AT Protocol version of the label object. */ + ver?: number; + } + type LabelValue = + | '!hide' + | '!no-promote' + | '!no-unauthenticated' + | '!warn' + | 'dmca-violation' + | 'doxxing' + | 'gore' + | 'nsfl' + | 'nudity' + | 'porn' + | 'sexual' + | (string & {}); + /** Declares a label value and its expected interpretations and behaviors. */ + interface LabelValueDefinition extends TypedBase { + /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */ + blurs: 'content' | 'media' | 'none' | (string & {}); + /** + * The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). + * Maximum string length: 100 + * Maximum grapheme length: 100 + */ + identifier: string; + locales: LabelValueDefinitionStrings[]; + /** How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. */ + severity: 'alert' | 'inform' | 'none' | (string & {}); + /** Does the user need to have adult content enabled in order to configure this label? */ + adultOnly?: boolean; + /** + * The default setting for this label. + * \@default "warn" + */ + defaultSetting?: 'hide' | 'ignore' | 'warn' | (string & {}); + } + /** Strings which describe the label in the UI, localized into a specific language. */ + interface LabelValueDefinitionStrings extends TypedBase { + /** + * A longer description of what the label means and why it might be applied. + * Maximum string length: 100000 + * Maximum grapheme length: 10000 + */ + description: string; + /** The code of the language these strings are written in. */ + lang: string; + /** + * A short human-readable name for the label. + * Maximum string length: 640 + * Maximum grapheme length: 64 + */ + name: string; + } + /** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */ + interface SelfLabel extends TypedBase { + /** + * The short string name of the value or type of this label. + * Maximum string length: 128 + */ + val: string; + } + /** Metadata tags on an atproto record, published by the author within the record. */ + interface SelfLabels extends TypedBase { + /** Maximum array length: 10 */ + values: SelfLabel[]; + } +} + +/** Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. */ +export declare namespace ComAtprotoLabelQueryLabels { + interface Params extends TypedBase { + /** 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. */ + uriPatterns: string[]; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 250 + * \@default 50 + */ + limit?: number; + /** Optional list of label sources (DIDs) to filter on. */ + sources?: At.DID[]; + } + type Input = undefined; + interface Output extends TypedBase { + labels: ComAtprotoLabelDefs.Label[]; + cursor?: string; + } +} + +export declare namespace ComAtprotoLabelSubscribeLabels { + interface Params extends TypedBase { + /** The last known event seq number to backfill from. */ + cursor?: number; + } + type Message = TypeUnion; + interface Errors extends TypedBase { + FutureCursor: {}; + } + interface Info extends TypedBase { + name: 'OutdatedCursor' | (string & {}); + message?: string; + } + interface Labels extends TypedBase { + labels: ComAtprotoLabelDefs.Label[]; + seq: number; + } +} + +/** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */ +export declare namespace ComAtprotoModerationCreateReport { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Indicates the broad category of violation the report is for. */ + reasonType: ComAtprotoModerationDefs.ReasonType; + subject: TypeUnion< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** + * Additional context about the content and violation. + * Maximum string length: 20000 + * Maximum grapheme length: 2000 + */ + reason?: string; + } + interface Output extends TypedBase { + createdAt: string; + id: number; + reasonType: ComAtprotoModerationDefs.ReasonType; + reportedBy: At.DID; + subject: TypeUnion< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** + * Maximum string length: 20000 + * Maximum grapheme length: 2000 + */ + reason?: string; + } +} + +export declare namespace ComAtprotoModerationDefs { + type ReasonAppeal = 'com.atproto.moderation.defs#reasonAppeal'; + type ReasonMisleading = 'com.atproto.moderation.defs#reasonMisleading'; + type ReasonOther = 'com.atproto.moderation.defs#reasonOther'; + type ReasonRude = 'com.atproto.moderation.defs#reasonRude'; + type ReasonSexual = 'com.atproto.moderation.defs#reasonSexual'; + type ReasonSpam = 'com.atproto.moderation.defs#reasonSpam'; + type ReasonType = + | 'com.atproto.moderation.defs#reasonAppeal' + | 'com.atproto.moderation.defs#reasonMisleading' + | 'com.atproto.moderation.defs#reasonOther' + | 'com.atproto.moderation.defs#reasonRude' + | 'com.atproto.moderation.defs#reasonSexual' + | 'com.atproto.moderation.defs#reasonSpam' + | 'com.atproto.moderation.defs#reasonViolation' + | (string & {}); + type ReasonViolation = 'com.atproto.moderation.defs#reasonViolation'; +} + +/** Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoApplyWrites { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The handle or DID of the repo (aka, current account). */ + repo: string; + writes: TypeUnion[]; + /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */ + swapCommit?: At.CID; + /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output extends TypedBase { + commit?: ComAtprotoRepoDefs.CommitMeta; + results?: TypeUnion[]; + } + interface Errors extends TypedBase { + InvalidSwap: {}; + } + /** Operation which creates a new record. */ + interface Create extends TypedBase { + collection: string; + value: unknown; + /** Maximum string length: 512 */ + rkey?: string; + } + interface CreateResult extends TypedBase { + cid: At.CID; + uri: At.Uri; + validationStatus?: 'unknown' | 'valid' | (string & {}); + } + /** Operation which deletes an existing record. */ + interface Delete extends TypedBase { + collection: string; + rkey: string; + } + interface DeleteResult extends TypedBase {} + /** Operation which updates an existing record. */ + interface Update extends TypedBase { + collection: string; + rkey: string; + value: unknown; + } + interface UpdateResult extends TypedBase { + cid: At.CID; + uri: At.Uri; + validationStatus?: 'unknown' | 'valid' | (string & {}); + } +} + +/** Create a single new repository record. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoCreateRecord { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The NSID of the record collection. */ + collection: string; + /** The record itself. Must contain a $type field. */ + record: unknown; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** + * The Record Key. + * Maximum string length: 512 + */ + rkey?: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output extends TypedBase { + cid: At.CID; + uri: At.Uri; + commit?: ComAtprotoRepoDefs.CommitMeta; + validationStatus?: 'unknown' | 'valid' | (string & {}); + } + interface Errors extends TypedBase { + InvalidSwap: {}; + } +} + +export declare namespace ComAtprotoRepoDefs { + interface CommitMeta extends TypedBase { + cid: At.CID; + rev: string; + } +} + +/** Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoDeleteRecord { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The NSID of the record collection. */ + collection: string; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** The Record Key. */ + rkey: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Compare and swap with the previous record by CID. */ + swapRecord?: At.CID; + } + interface Output extends TypedBase { + commit?: ComAtprotoRepoDefs.CommitMeta; + } + interface Errors extends TypedBase { + InvalidSwap: {}; + } +} + +/** Get information about an account and repository, including the list of collections. Does not require auth. */ +export declare namespace ComAtprotoRepoDescribeRepo { + interface Params extends TypedBase { + /** The handle or DID of the repo. */ + repo: string; + } + type Input = undefined; + interface Output extends TypedBase { + /** List of all the collections (NSIDs) for which this repo contains at least one record. */ + collections: string[]; + did: At.DID; + /** The complete DID document for this account. */ + didDoc: unknown; + handle: At.Handle; + /** Indicates if handle is currently valid (resolves bi-directionally) */ + handleIsCorrect: boolean; + } +} + +/** Get a single record from a repository. Does not require auth. */ +export declare namespace ComAtprotoRepoGetRecord { + interface Params extends TypedBase { + /** The NSID of the record collection. */ + collection: string; + /** The handle or DID of the repo. */ + repo: string; + /** The Record Key. */ + rkey: string; + /** The CID of the version of the record. If not specified, then return the most recent version. */ + cid?: At.CID; + } + type Input = undefined; + interface Output extends TypedBase { + uri: At.Uri; + value: unknown; + cid?: At.CID; + } + interface Errors extends TypedBase { + RecordNotFound: {}; + } +} + +/** Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. */ +export declare namespace ComAtprotoRepoImportRepo { + interface Params extends TypedBase {} + type Input = Blob | ArrayBufferView; + type Output = undefined; +} + +/** Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. */ +export declare namespace ComAtprotoRepoListMissingBlobs { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + blobs: RecordBlob[]; + cursor?: string; + } + interface RecordBlob extends TypedBase { + cid: At.CID; + recordUri: At.Uri; + } +} + +/** List a range of records in a repository, matching a specific collection. Does not require auth. */ +export declare namespace ComAtprotoRepoListRecords { + interface Params extends TypedBase { + /** The NSID of the record type. */ + collection: string; + /** The handle or DID of the repo. */ + repo: string; + cursor?: string; + /** + * The number of records to return. + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** Flag to reverse the order of the returned records. */ + reverse?: boolean; + /** + * DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) + * \@deprecated + */ + rkeyEnd?: string; + /** + * DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) + * \@deprecated + */ + rkeyStart?: string; + } + type Input = undefined; + interface Output extends TypedBase { + records: Record[]; + cursor?: string; + } + interface Record extends TypedBase { + cid: At.CID; + uri: At.Uri; + value: unknown; + } +} + +/** Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoPutRecord { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The NSID of the record collection. */ + collection: string; + /** The record to write. */ + record: unknown; + /** The handle or DID of the repo (aka, current account). */ + repo: string; + /** + * The Record Key. + * Maximum string length: 512 + */ + rkey: string; + /** Compare and swap with the previous commit by CID. */ + swapCommit?: At.CID; + /** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */ + swapRecord?: At.CID | null; + /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */ + validate?: boolean; + } + interface Output extends TypedBase { + cid: At.CID; + uri: At.Uri; + commit?: ComAtprotoRepoDefs.CommitMeta; + validationStatus?: 'unknown' | 'valid' | (string & {}); + } + interface Errors extends TypedBase { + InvalidSwap: {}; + } +} + +export declare namespace ComAtprotoRepoStrongRef { + interface Main extends TypedBase { + cid: At.CID; + uri: At.Uri; + } +} + +/** Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. */ +export declare namespace ComAtprotoRepoUploadBlob { + interface Params extends TypedBase {} + type Input = Blob | ArrayBufferView; + interface Output extends TypedBase { + blob: At.Blob; + } +} + +/** Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. */ +export declare namespace ComAtprotoServerActivateAccount { + interface Params extends TypedBase {} + type Input = undefined; + type Output = undefined; +} + +/** Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. */ +export declare namespace ComAtprotoServerCheckAccountStatus { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + activated: boolean; + expectedBlobs: number; + importedBlobs: number; + indexedRecords: number; + privateStateValues: number; + repoBlocks: number; + repoCommit: At.CID; + repoRev: string; + validDid: boolean; + } +} + +/** Confirm an email using a token from com.atproto.server.requestEmailConfirmation. */ +export declare namespace ComAtprotoServerConfirmEmail { + interface Params extends TypedBase {} + interface Input extends TypedBase { + email: string; + token: string; + } + type Output = undefined; + interface Errors extends TypedBase { + AccountNotFound: {}; + ExpiredToken: {}; + InvalidToken: {}; + InvalidEmail: {}; + } +} + +/** Create an account. Implemented by PDS. */ +export declare namespace ComAtprotoServerCreateAccount { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Requested handle for the account. */ + handle: At.Handle; + /** Pre-existing atproto DID, being imported to a new account. */ + did?: At.DID; + email?: string; + inviteCode?: string; + /** Initial account password. May need to meet instance-specific password strength requirements. */ + password?: string; + /** A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. */ + plcOp?: unknown; + /** DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. */ + recoveryKey?: string; + verificationCode?: string; + verificationPhone?: string; + } + /** Account login session returned on successful account creation. */ + interface Output extends TypedBase { + accessJwt: string; + /** The DID of the new account. */ + did: At.DID; + handle: At.Handle; + refreshJwt: string; + /** Complete DID document. */ + didDoc?: unknown; + } + interface Errors extends TypedBase { + InvalidHandle: {}; + InvalidPassword: {}; + InvalidInviteCode: {}; + HandleNotAvailable: {}; + UnsupportedDomain: {}; + UnresolvableDid: {}; + IncompatibleDidDoc: {}; + } +} + +/** Create an App Password. */ +export declare namespace ComAtprotoServerCreateAppPassword { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** A short name for the App Password, to help distinguish them. */ + name: string; + /** If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. */ + privileged?: boolean; + } + type Output = AppPassword; + interface Errors extends TypedBase { + AccountTakedown: {}; + } + interface AppPassword extends TypedBase { + createdAt: string; + name: string; + password: string; + privileged?: boolean; + } +} + +/** Create an invite code. */ +export declare namespace ComAtprotoServerCreateInviteCode { + interface Params extends TypedBase {} + interface Input extends TypedBase { + useCount: number; + forAccount?: At.DID; + } + interface Output extends TypedBase { + code: string; + } +} + +/** Create invite codes. */ +export declare namespace ComAtprotoServerCreateInviteCodes { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** \@default 1 */ + codeCount: number; + useCount: number; + forAccounts?: At.DID[]; + } + interface Output extends TypedBase { + codes: AccountCodes[]; + } + interface AccountCodes extends TypedBase { + account: string; + codes: string[]; + } +} + +/** Create an authentication session. */ +export declare namespace ComAtprotoServerCreateSession { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Handle or other identifier supported by the server for the authenticating user. */ + identifier: string; + password: string; + authFactorToken?: string; + } + interface Output extends TypedBase { + accessJwt: string; + did: At.DID; + handle: At.Handle; + refreshJwt: string; + active?: boolean; + didDoc?: unknown; + email?: string; + emailAuthFactor?: boolean; + emailConfirmed?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'deactivated' | 'suspended' | 'takendown' | (string & {}); + } + interface Errors extends TypedBase { + AccountTakedown: {}; + AuthFactorTokenRequired: {}; + } +} + +/** Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. */ +export declare namespace ComAtprotoServerDeactivateAccount { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** A recommendation to server as to how long they should hold onto the deactivated account before deleting. */ + deleteAfter?: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoServerDefs { + interface InviteCode extends TypedBase { + available: number; + code: string; + createdAt: string; + createdBy: string; + disabled: boolean; + forAccount: string; + uses: InviteCodeUse[]; + } + interface InviteCodeUse extends TypedBase { + usedAt: string; + usedBy: At.DID; + } +} + +/** Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. */ +export declare namespace ComAtprotoServerDeleteAccount { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + password: string; + token: string; + } + type Output = undefined; + interface Errors extends TypedBase { + ExpiredToken: {}; + InvalidToken: {}; + } +} + +/** Delete the current session. Requires auth. */ +export declare namespace ComAtprotoServerDeleteSession { + interface Params extends TypedBase {} + type Input = undefined; + type Output = undefined; +} + +/** Describes the server's account creation requirements and capabilities. Implemented by PDS. */ +export declare namespace ComAtprotoServerDescribeServer { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + /** List of domain suffixes that can be used in account handles. */ + availableUserDomains: string[]; + did: At.DID; + /** Contact information */ + contact?: Contact; + /** If true, an invite code must be supplied to create an account on this instance. */ + inviteCodeRequired?: boolean; + /** URLs of service policy documents. */ + links?: Links; + /** If true, a phone verification token must be supplied to create an account on this instance. */ + phoneVerificationRequired?: boolean; + } + interface Contact extends TypedBase { + email?: string; + } + interface Links extends TypedBase { + privacyPolicy?: string; + termsOfService?: string; + } +} + +/** Get all invite codes for the current account. Requires auth. */ +export declare namespace ComAtprotoServerGetAccountInviteCodes { + interface Params extends TypedBase { + /** + * Controls whether any new 'earned' but not 'created' invites should be created. + * \@default true + */ + createAvailable?: boolean; + /** \@default true */ + includeUsed?: boolean; + } + type Input = undefined; + interface Output extends TypedBase { + codes: ComAtprotoServerDefs.InviteCode[]; + } + interface Errors extends TypedBase { + DuplicateCreate: {}; + } +} + +/** Get a signed token on behalf of the requesting DID for the requested service. */ +export declare namespace ComAtprotoServerGetServiceAuth { + interface Params extends TypedBase { + /** The DID of the service that the token will be used to authenticate with */ + aud: At.DID; + /** The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. */ + exp?: number; + /** Lexicon (XRPC) method to bind the requested token to */ + lxm?: string; + } + type Input = undefined; + interface Output extends TypedBase { + token: string; + } + interface Errors extends TypedBase { + BadExpiration: {}; + } +} + +/** Get information about the current auth session. Requires auth. */ +export declare namespace ComAtprotoServerGetSession { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + did: At.DID; + handle: At.Handle; + active?: boolean; + didDoc?: unknown; + email?: string; + emailAuthFactor?: boolean; + emailConfirmed?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'deactivated' | 'suspended' | 'takendown' | (string & {}); + } +} + +/** List all App Passwords. */ +export declare namespace ComAtprotoServerListAppPasswords { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + passwords: AppPassword[]; + } + interface Errors extends TypedBase { + AccountTakedown: {}; + } + interface AppPassword extends TypedBase { + createdAt: string; + name: string; + privileged?: boolean; + } +} + +/** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */ +export declare namespace ComAtprotoServerRefreshSession { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + accessJwt: string; + did: At.DID; + handle: At.Handle; + refreshJwt: string; + active?: boolean; + didDoc?: unknown; + /** Hosting status of the account. If not specified, then assume 'active'. */ + status?: 'deactivated' | 'suspended' | 'takendown' | (string & {}); + } + interface Errors extends TypedBase { + AccountTakedown: {}; + } +} + +/** Initiate a user account deletion via email. */ +export declare namespace ComAtprotoServerRequestAccountDelete { + interface Params extends TypedBase {} + type Input = undefined; + type Output = undefined; +} + +/** Request an email with a code to confirm ownership of email. */ +export declare namespace ComAtprotoServerRequestEmailConfirmation { + interface Params extends TypedBase {} + type Input = undefined; + type Output = undefined; +} + +/** Request a token in order to update email. */ +export declare namespace ComAtprotoServerRequestEmailUpdate { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + tokenRequired: boolean; + } +} + +/** Initiate a user account password reset via email. */ +export declare namespace ComAtprotoServerRequestPasswordReset { + interface Params extends TypedBase {} + interface Input extends TypedBase { + email: string; + } + type Output = undefined; +} + +/** Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. */ +export declare namespace ComAtprotoServerReserveSigningKey { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** The DID to reserve a key for. */ + did?: At.DID; + } + interface Output extends TypedBase { + /** The public key for the reserved signing key, in did:key serialization. */ + signingKey: string; + } +} + +/** Reset a user account password using a token. */ +export declare namespace ComAtprotoServerResetPassword { + interface Params extends TypedBase {} + interface Input extends TypedBase { + password: string; + token: string; + } + type Output = undefined; + interface Errors extends TypedBase { + ExpiredToken: {}; + InvalidToken: {}; + } +} + +/** Revoke an App Password by name. */ +export declare namespace ComAtprotoServerRevokeAppPassword { + interface Params extends TypedBase {} + interface Input extends TypedBase { + name: string; + } + type Output = undefined; +} + +/** Update an account's email. */ +export declare namespace ComAtprotoServerUpdateEmail { + interface Params extends TypedBase {} + interface Input extends TypedBase { + email: string; + emailAuthFactor?: boolean; + /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */ + token?: string; + } + type Output = undefined; + interface Errors extends TypedBase { + ExpiredToken: {}; + InvalidToken: {}; + TokenRequired: {}; + } +} + +/** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetBlob { + interface Params extends TypedBase { + /** The CID of the blob to fetch */ + cid: At.CID; + /** The DID of the account. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors extends TypedBase { + BlobNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetBlocks { + interface Params extends TypedBase { + cids: At.CID[]; + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors extends TypedBase { + BlockNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** + * DEPRECATED - please use com.atproto.sync.getRepo instead + * \@deprecated + */ +export declare namespace ComAtprotoSyncGetCheckout { + interface Params extends TypedBase { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + type Output = Uint8Array; +} + +/** + * DEPRECATED - please use com.atproto.sync.getLatestCommit instead + * \@deprecated + */ +export declare namespace ComAtprotoSyncGetHead { + interface Params extends TypedBase { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + root: At.CID; + } + interface Errors extends TypedBase { + HeadNotFound: {}; + } +} + +/** Get the current commit CID & revision of the specified repo. Does not require auth. */ +export declare namespace ComAtprotoSyncGetLatestCommit { + interface Params extends TypedBase { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + cid: At.CID; + rev: string; + } + interface Errors extends TypedBase { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */ +export declare namespace ComAtprotoSyncGetRecord { + interface Params extends TypedBase { + collection: string; + /** The DID of the repo. */ + did: At.DID; + /** Record Key */ + rkey: string; + /** + * DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit + * \@deprecated + */ + commit?: At.CID; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors extends TypedBase { + RecordNotFound: {}; + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncGetRepo { + interface Params extends TypedBase { + /** The DID of the repo. */ + did: At.DID; + /** The revision ('rev') of the repo to create a diff from. */ + since?: string; + } + type Input = undefined; + type Output = Uint8Array; + interface Errors extends TypedBase { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. */ +export declare namespace ComAtprotoSyncGetRepoStatus { + interface Params extends TypedBase { + /** The DID of the repo. */ + did: At.DID; + } + type Input = undefined; + interface Output extends TypedBase { + active: boolean; + did: At.DID; + /** Optional field, the current rev of the repo, if active=true */ + rev?: string; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'deactivated' | 'suspended' | 'takendown' | (string & {}); + } + interface Errors extends TypedBase { + RepoNotFound: {}; + } +} + +/** List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. */ +export declare namespace ComAtprotoSyncListBlobs { + interface Params extends TypedBase { + /** The DID of the repo. */ + did: At.DID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + /** Optional revision of the repo to list blobs since. */ + since?: string; + } + type Input = undefined; + interface Output extends TypedBase { + cids: At.CID[]; + cursor?: string; + } + interface Errors extends TypedBase { + RepoNotFound: {}; + RepoTakendown: {}; + RepoSuspended: {}; + RepoDeactivated: {}; + } +} + +/** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */ +export declare namespace ComAtprotoSyncListRepos { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 500 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + repos: Repo[]; + cursor?: string; + } + interface Repo extends TypedBase { + did: At.DID; + /** Current repo commit CID */ + head: At.CID; + rev: string; + active?: boolean; + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'deactivated' | 'suspended' | 'takendown' | (string & {}); + } +} + +/** Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. */ +export declare namespace ComAtprotoSyncNotifyOfUpdate { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Hostname of the current service (usually a PDS) that is notifying of update. */ + hostname: string; + } + type Output = undefined; +} + +/** Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. */ +export declare namespace ComAtprotoSyncRequestCrawl { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Hostname of the current service (eg, PDS) that is requesting to be crawled. */ + hostname: string; + } + type Output = undefined; +} + +export declare namespace ComAtprotoSyncSubscribeRepos { + interface Params extends TypedBase { + /** The last known event seq number to backfill from. */ + cursor?: number; + } + type Message = TypeUnion< + Account | Commit | Handle | Identity | Info | Migrate | Tombstone + >; + interface Errors extends TypedBase { + FutureCursor: {}; + ConsumerTooSlow: {}; + } + /** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ + interface Account extends TypedBase { + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean; + did: At.DID; + seq: number; + time: string; + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'deactivated' + | 'deleted' + | 'suspended' + | 'takendown' + | (string & {}); + } + /** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */ + interface Commit extends TypedBase { + /** List of new blobs (by CID) referenced by records in this commit. */ + blobs: At.CIDLink[]; + /** CAR file containing relevant blocks, as a diff since the previous repo state. */ + blocks: At.Bytes; + /** Repo commit object CID. */ + commit: At.CIDLink; + /** + * Maximum array length: 200 + * List of repo mutation operations in this commit (eg, records created, updated, or deleted). + */ + ops: RepoOp[]; + /** + * DEPRECATED -- unused + * \@deprecated + */ + rebase: boolean; + /** The repo this event comes from. */ + repo: At.DID; + /** The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event. */ + rev: string; + /** The stream sequence number of this message. */ + seq: number; + /** The rev of the last emitted commit from this repo (if any). */ + since: string | null; + /** Timestamp of when this message was originally broadcast. */ + time: string; + /** Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data. */ + tooBig: boolean; + /** + * DEPRECATED -- unused. WARNING -- nullable and optional; stick with optional to ensure golang interoperability. + * \@deprecated + */ + prev?: At.CIDLink | null; + } + /** + * DEPRECATED -- Use #identity event instead + * \@deprecated + */ + interface Handle extends TypedBase { + did: At.DID; + handle: At.Handle; + seq: number; + time: string; + } + /** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */ + interface Identity extends TypedBase { + did: At.DID; + seq: number; + time: string; + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ + handle?: At.Handle; + } + interface Info extends TypedBase { + name: 'OutdatedCursor' | (string & {}); + message?: string; + } + /** + * DEPRECATED -- Use #account event instead + * \@deprecated + */ + interface Migrate extends TypedBase { + did: At.DID; + migrateTo: string | null; + seq: number; + time: string; + } + /** A repo operation, ie a mutation of a single record. */ + interface RepoOp extends TypedBase { + action: 'create' | 'delete' | 'update' | (string & {}); + /** For creates and updates, the new record CID. For deletions, null. */ + cid: At.CIDLink | null; + path: string; + } + /** + * DEPRECATED -- Use #account event instead + * \@deprecated + */ + interface Tombstone extends TypedBase { + did: At.DID; + seq: number; + time: string; + } +} + +/** Add a handle to the set of reserved handles. */ +export declare namespace ComAtprotoTempAddReservedHandle { + interface Params extends TypedBase {} + interface Input extends TypedBase { + handle: string; + } + interface Output extends TypedBase {} +} + +/** Check accounts location in signup queue. */ +export declare namespace ComAtprotoTempCheckSignupQueue { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + activated: boolean; + estimatedTimeMs?: number; + placeInQueue?: number; + } +} + +/** + * DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date. + * \@deprecated + */ +export declare namespace ComAtprotoTempFetchLabels { + interface Params extends TypedBase { + /** + * Minimum: 1 + * Maximum: 250 + * \@default 50 + */ + limit?: number; + since?: number; + } + type Input = undefined; + interface Output extends TypedBase { + labels: ComAtprotoLabelDefs.Label[]; + } +} + +/** Request a verification code to be sent to the supplied phone number */ +export declare namespace ComAtprotoTempRequestPhoneVerification { + interface Params extends TypedBase {} + interface Input extends TypedBase { + phoneNumber: string; + } + type Output = undefined; +} + +/** Administrative action to create a new, re-usable communication (email for now) template. */ +export declare namespace ToolsOzoneCommunicationCreateTemplate { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Content of the template, markdown supported, can contain variable placeholders. */ + contentMarkdown: string; + /** Name of the template. */ + name: string; + /** Subject of the message, used in emails. */ + subject: string; + /** DID of the user who is creating the template. */ + createdBy?: At.DID; + /** Message language. */ + lang?: string; + } + type Output = ToolsOzoneCommunicationDefs.TemplateView; + interface Errors extends TypedBase { + DuplicateTemplateName: {}; + } +} + +export declare namespace ToolsOzoneCommunicationDefs { + interface TemplateView extends TypedBase { + /** Subject of the message, used in emails. */ + contentMarkdown: string; + createdAt: string; + disabled: boolean; + id: string; + /** DID of the user who last updated the template. */ + lastUpdatedBy: At.DID; + /** Name of the template. */ + name: string; + updatedAt: string; + /** Message language. */ + lang?: string; + /** Content of the template, can contain markdown and variable placeholders. */ + subject?: string; + } +} + +/** Delete a communication template. */ +export declare namespace ToolsOzoneCommunicationDeleteTemplate { + interface Params extends TypedBase {} + interface Input extends TypedBase { + id: string; + } + type Output = undefined; +} + +/** Get list of all communication templates. */ +export declare namespace ToolsOzoneCommunicationListTemplates { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + communicationTemplates: ToolsOzoneCommunicationDefs.TemplateView[]; + } +} + +/** Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. */ +export declare namespace ToolsOzoneCommunicationUpdateTemplate { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** ID of the template to be updated. */ + id: string; + /** Content of the template, markdown supported, can contain variable placeholders. */ + contentMarkdown?: string; + disabled?: boolean; + /** Message language. */ + lang?: string; + /** Name of the template. */ + name?: string; + /** Subject of the message, used in emails. */ + subject?: string; + /** DID of the user who is updating the template. */ + updatedBy?: At.DID; + } + type Output = ToolsOzoneCommunicationDefs.TemplateView; + interface Errors extends TypedBase { + DuplicateTemplateName: {}; + } +} + +export declare namespace ToolsOzoneModerationDefs { + /** Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface AccountEvent extends TypedBase { + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean; + timestamp: string; + comment?: string; + status?: + | 'deactivated' + | 'deleted' + | 'suspended' + | 'takendown' + | 'tombstoned' + | 'unknown' + | (string & {}); + } + interface AccountHosting extends TypedBase { + status: + | 'deactivated' + | 'deleted' + | 'suspended' + | 'takendown' + | 'unknown' + | (string & {}); + createdAt?: string; + deactivatedAt?: string; + deletedAt?: string; + reactivatedAt?: string; + updatedAt?: string; + } + interface BlobView extends TypedBase { + cid: At.CID; + createdAt: string; + mimeType: string; + size: number; + details?: TypeUnion; + moderation?: Moderation; + } + /** Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface IdentityEvent extends TypedBase { + timestamp: string; + comment?: string; + handle?: At.Handle; + pdsHost?: string; + tombstone?: boolean; + } + interface ImageDetails extends TypedBase { + height: number; + width: number; + } + interface Moderation extends TypedBase { + subjectStatus?: SubjectStatusView; + } + interface ModerationDetail extends TypedBase { + subjectStatus?: SubjectStatusView; + } + interface ModEventAcknowledge extends TypedBase { + comment?: string; + } + /** Add a comment to a subject */ + interface ModEventComment extends TypedBase { + comment: string; + /** Make the comment persistent on the subject */ + sticky?: boolean; + } + /** Divert a record's blobs to a 3rd party service for further scanning/tagging */ + interface ModEventDivert extends TypedBase { + comment?: string; + } + /** Keep a log of outgoing email to a user */ + interface ModEventEmail extends TypedBase { + /** The subject line of the email sent to the user. */ + subjectLine: string; + /** Additional comment about the outgoing comm. */ + comment?: string; + /** The content of the email sent to the user. */ + content?: string; + } + interface ModEventEscalate extends TypedBase { + comment?: string; + } + /** Apply/Negate labels on a subject */ + interface ModEventLabel extends TypedBase { + createLabelVals: string[]; + negateLabelVals: string[]; + comment?: string; + } + /** Mute incoming reports on a subject */ + interface ModEventMute extends TypedBase { + /** Indicates how long the subject should remain muted. */ + durationInHours: number; + comment?: string; + } + /** Mute incoming reports from an account */ + interface ModEventMuteReporter extends TypedBase { + comment?: string; + /** Indicates how long the account should remain muted. Falsy value here means a permanent mute. */ + durationInHours?: number; + } + /** Report a subject */ + interface ModEventReport extends TypedBase { + reportType: ComAtprotoModerationDefs.ReasonType; + comment?: string; + /** Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject. */ + isReporterMuted?: boolean; + } + /** Resolve appeal on a subject */ + interface ModEventResolveAppeal extends TypedBase { + /** Describe resolution. */ + comment?: string; + } + /** Revert take down action on a subject */ + interface ModEventReverseTakedown extends TypedBase { + /** Describe reasoning behind the reversal. */ + comment?: string; + } + /** Add/Remove a tag on a subject */ + interface ModEventTag extends TypedBase { + /** Tags to be added to the subject. If already exists, won't be duplicated. */ + add: string[]; + /** Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. */ + remove: string[]; + /** Additional comment about added/removed tags. */ + comment?: string; + } + /** Take down a subject permanently or temporarily */ + interface ModEventTakedown extends TypedBase { + /** If true, all other reports on content authored by this account will be resolved (acknowledged). */ + acknowledgeAccountSubjects?: boolean; + comment?: string; + /** Indicates how long the takedown should be in effect before automatically expiring. */ + durationInHours?: number; + } + /** Unmute action on a subject */ + interface ModEventUnmute extends TypedBase { + /** Describe reasoning behind the reversal. */ + comment?: string; + } + /** Unmute incoming reports from an account */ + interface ModEventUnmuteReporter extends TypedBase { + /** Describe reasoning behind the reversal. */ + comment?: string; + } + interface ModEventView extends TypedBase { + createdAt: string; + createdBy: At.DID; + event: TypeUnion< + | AccountEvent + | IdentityEvent + | ModEventAcknowledge + | ModEventComment + | ModEventDivert + | ModEventEmail + | ModEventEscalate + | ModEventLabel + | ModEventMute + | ModEventMuteReporter + | ModEventReport + | ModEventResolveAppeal + | ModEventReverseTakedown + | ModEventTag + | ModEventTakedown + | ModEventUnmute + | ModEventUnmuteReporter + | RecordEvent + >; + id: number; + subject: TypeUnion< + | ChatBskyConvoDefs.MessageRef + | ComAtprotoAdminDefs.RepoRef + | ComAtprotoRepoStrongRef.Main + >; + subjectBlobCids: string[]; + creatorHandle?: string; + subjectHandle?: string; + } + interface ModEventViewDetail extends TypedBase { + createdAt: string; + createdBy: At.DID; + event: TypeUnion< + | AccountEvent + | IdentityEvent + | ModEventAcknowledge + | ModEventComment + | ModEventDivert + | ModEventEmail + | ModEventEscalate + | ModEventLabel + | ModEventMute + | ModEventMuteReporter + | ModEventReport + | ModEventResolveAppeal + | ModEventReverseTakedown + | ModEventTag + | ModEventTakedown + | ModEventUnmute + | ModEventUnmuteReporter + | RecordEvent + >; + id: number; + subject: TypeUnion< + RecordView | RecordViewNotFound | RepoView | RepoViewNotFound + >; + subjectBlobs: BlobView[]; + } + /** Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. */ + interface RecordEvent extends TypedBase { + op: 'create' | 'delete' | 'update' | (string & {}); + timestamp: string; + cid?: At.CID; + comment?: string; + } + interface RecordHosting extends TypedBase { + status: 'deleted' | 'unknown' | (string & {}); + createdAt?: string; + deletedAt?: string; + updatedAt?: string; + } + interface RecordView extends TypedBase { + blobCids: At.CID[]; + cid: At.CID; + indexedAt: string; + moderation: Moderation; + repo: RepoView; + uri: At.Uri; + value: unknown; + } + interface RecordViewDetail extends TypedBase { + blobs: BlobView[]; + cid: At.CID; + indexedAt: string; + moderation: ModerationDetail; + repo: RepoView; + uri: At.Uri; + value: unknown; + labels?: ComAtprotoLabelDefs.Label[]; + } + interface RecordViewNotFound extends TypedBase { + uri: At.Uri; + } + interface RepoView extends TypedBase { + did: At.DID; + handle: At.Handle; + indexedAt: string; + moderation: Moderation; + relatedRecords: unknown[]; + deactivatedAt?: string; + email?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invitesDisabled?: boolean; + threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; + } + interface RepoViewDetail extends TypedBase { + did: At.DID; + handle: At.Handle; + indexedAt: string; + moderation: ModerationDetail; + relatedRecords: unknown[]; + deactivatedAt?: string; + email?: string; + emailConfirmedAt?: string; + invitedBy?: ComAtprotoServerDefs.InviteCode; + inviteNote?: string; + invites?: ComAtprotoServerDefs.InviteCode[]; + invitesDisabled?: boolean; + labels?: ComAtprotoLabelDefs.Label[]; + threatSignatures?: ComAtprotoAdminDefs.ThreatSignature[]; + } + interface RepoViewNotFound extends TypedBase { + did: At.DID; + } + type ReviewClosed = 'tools.ozone.moderation.defs#reviewClosed'; + type ReviewEscalated = 'tools.ozone.moderation.defs#reviewEscalated'; + type ReviewNone = 'tools.ozone.moderation.defs#reviewNone'; + type ReviewOpen = 'tools.ozone.moderation.defs#reviewOpen'; + type SubjectReviewState = + | '#reviewClosed' + | '#reviewEscalated' + | '#reviewNone' + | '#reviewOpen' + | (string & {}); + interface SubjectStatusView extends TypedBase { + /** Timestamp referencing the first moderation status impacting event was emitted on the subject */ + createdAt: string; + id: number; + reviewState: SubjectReviewState; + subject: TypeUnion< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + /** Timestamp referencing when the last update was made to the moderation status of the subject */ + updatedAt: string; + /** True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. */ + appealed?: boolean; + /** Sticky comment on the subject. */ + comment?: string; + hosting?: TypeUnion; + /** Timestamp referencing when the author of the subject appealed a moderation action */ + lastAppealedAt?: string; + lastReportedAt?: string; + lastReviewedAt?: string; + lastReviewedBy?: At.DID; + muteReportingUntil?: string; + muteUntil?: string; + subjectBlobCids?: At.CID[]; + subjectRepoHandle?: string; + suspendUntil?: string; + tags?: string[]; + takendown?: boolean; + } + interface VideoDetails extends TypedBase { + height: number; + length: number; + width: number; + } +} + +/** Take a moderation action on an actor. */ +export declare namespace ToolsOzoneModerationEmitEvent { + interface Params extends TypedBase {} + interface Input extends TypedBase { + createdBy: At.DID; + event: TypeUnion< + | ToolsOzoneModerationDefs.AccountEvent + | ToolsOzoneModerationDefs.IdentityEvent + | ToolsOzoneModerationDefs.ModEventAcknowledge + | ToolsOzoneModerationDefs.ModEventComment + | ToolsOzoneModerationDefs.ModEventEmail + | ToolsOzoneModerationDefs.ModEventEscalate + | ToolsOzoneModerationDefs.ModEventLabel + | ToolsOzoneModerationDefs.ModEventMute + | ToolsOzoneModerationDefs.ModEventMuteReporter + | ToolsOzoneModerationDefs.ModEventReport + | ToolsOzoneModerationDefs.ModEventResolveAppeal + | ToolsOzoneModerationDefs.ModEventReverseTakedown + | ToolsOzoneModerationDefs.ModEventTag + | ToolsOzoneModerationDefs.ModEventTakedown + | ToolsOzoneModerationDefs.ModEventUnmute + | ToolsOzoneModerationDefs.ModEventUnmuteReporter + | ToolsOzoneModerationDefs.RecordEvent + >; + subject: TypeUnion< + ComAtprotoAdminDefs.RepoRef | ComAtprotoRepoStrongRef.Main + >; + subjectBlobCids?: At.CID[]; + } + type Output = ToolsOzoneModerationDefs.ModEventView; + interface Errors extends TypedBase { + SubjectHasAction: {}; + } +} + +/** Get details about a moderation event. */ +export declare namespace ToolsOzoneModerationGetEvent { + interface Params extends TypedBase { + id: number; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.ModEventViewDetail; +} + +/** Get details about a record. */ +export declare namespace ToolsOzoneModerationGetRecord { + interface Params extends TypedBase { + uri: At.Uri; + cid?: At.CID; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.RecordViewDetail; + interface Errors extends TypedBase { + RecordNotFound: {}; + } +} + +/** Get details about some records. */ +export declare namespace ToolsOzoneModerationGetRecords { + interface Params extends TypedBase { + /** Maximum array length: 100 */ + uris: At.Uri[]; + } + type Input = undefined; + interface Output extends TypedBase { + records: TypeUnion< + | ToolsOzoneModerationDefs.RecordViewDetail + | ToolsOzoneModerationDefs.RecordViewNotFound + >[]; + } +} + +/** Get details about a repository. */ +export declare namespace ToolsOzoneModerationGetRepo { + interface Params extends TypedBase { + did: At.DID; + } + type Input = undefined; + type Output = ToolsOzoneModerationDefs.RepoViewDetail; + interface Errors extends TypedBase { + RepoNotFound: {}; + } +} + +/** Get details about some repositories. */ +export declare namespace ToolsOzoneModerationGetRepos { + interface Params extends TypedBase { + /** Maximum array length: 100 */ + dids: At.DID[]; + } + type Input = undefined; + interface Output extends TypedBase { + repos: TypeUnion< + | ToolsOzoneModerationDefs.RepoViewDetail + | ToolsOzoneModerationDefs.RepoViewNotFound + >[]; + } +} + +/** List moderation events related to a subject. */ +export declare namespace ToolsOzoneModerationQueryEvents { + interface Params extends TypedBase { + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[]; + /** If specified, only events where all of these tags were added are returned */ + addedTags?: string[]; + /** + * If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. + * Maximum array length: 20 + */ + collections?: string[]; + /** If specified, only events with comments containing the keyword are returned. Apply || separator to use multiple keywords and match using OR condition. */ + comment?: string; + /** Retrieve events created after a given timestamp */ + createdAfter?: string; + /** Retrieve events created before a given timestamp */ + createdBefore?: string; + createdBy?: At.DID; + cursor?: string; + /** If true, only events with comments are returned */ + hasComment?: boolean; + /** + * If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned. + * \@default false + */ + includeAllUserRecords?: boolean; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[]; + /** If specified, only events where all of these tags were removed are returned */ + removedTags?: string[]; + reportTypes?: string[]; + /** + * Sort direction for the events. Defaults to descending order of created at timestamp. + * \@default "desc" + */ + sortDirection?: 'asc' | 'desc'; + subject?: string; + /** If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ + subjectType?: 'account' | 'record' | (string & {}); + /** The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent) to filter by. If not specified, all events are returned. */ + types?: string[]; + } + type Input = undefined; + interface Output extends TypedBase { + events: ToolsOzoneModerationDefs.ModEventView[]; + cursor?: string; + } +} + +/** View moderation statuses of subjects (record or repo). */ +export declare namespace ToolsOzoneModerationQueryStatuses { + interface Params extends TypedBase { + /** Get subjects in unresolved appealed status */ + appealed?: boolean; + /** + * If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored. + * Maximum array length: 20 + */ + collections?: string[]; + /** Search subjects by keyword from comments */ + comment?: string; + cursor?: string; + excludeTags?: string[]; + /** Search subjects where the associated record/account was deleted after a given timestamp */ + hostingDeletedAfter?: string; + /** Search subjects where the associated record/account was deleted before a given timestamp */ + hostingDeletedBefore?: string; + /** Search subjects by the status of the associated record/account */ + hostingStatuses?: string[]; + /** Search subjects where the associated record/account was updated after a given timestamp */ + hostingUpdatedAfter?: string; + /** Search subjects where the associated record/account was updated before a given timestamp */ + hostingUpdatedBefore?: string; + ignoreSubjects?: string[]; + /** All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned. */ + includeAllUserRecords?: boolean; + /** By default, we don't include muted subjects in the results. Set this to true to include them. */ + includeMuted?: boolean; + /** Get all subject statuses that were reviewed by a specific moderator */ + lastReviewedBy?: At.DID; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** When set to true, only muted subjects and reporters will be returned. */ + onlyMuted?: boolean; + /** Search subjects reported after a given timestamp */ + reportedAfter?: string; + /** Search subjects reported before a given timestamp */ + reportedBefore?: string; + /** Search subjects reviewed after a given timestamp */ + reviewedAfter?: string; + /** Search subjects reviewed before a given timestamp */ + reviewedBefore?: string; + /** Specify when fetching subjects in a certain state */ + reviewState?: string; + /** \@default "desc" */ + sortDirection?: 'asc' | 'desc'; + /** \@default "lastReportedAt" */ + sortField?: 'lastReviewedAt' | 'lastReportedAt'; + /** The subject to get the status for. */ + subject?: string; + /** If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */ + subjectType?: 'account' | 'record' | (string & {}); + tags?: string[]; + /** Get subjects that were taken down */ + takendown?: boolean; + } + type Input = undefined; + interface Output extends TypedBase { + subjectStatuses: ToolsOzoneModerationDefs.SubjectStatusView[]; + cursor?: string; + } +} + +/** Find repositories based on a search term. */ +export declare namespace ToolsOzoneModerationSearchRepos { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + q?: string; + /** + * DEPRECATED: use 'q' instead + * \@deprecated + */ + term?: string; + } + type Input = undefined; + interface Output extends TypedBase { + repos: ToolsOzoneModerationDefs.RepoView[]; + cursor?: string; + } +} + +/** Get details about ozone's server configuration. */ +export declare namespace ToolsOzoneServerGetConfig { + interface Params extends TypedBase {} + type Input = undefined; + interface Output extends TypedBase { + appview?: ServiceConfig; + blobDivert?: ServiceConfig; + chat?: ServiceConfig; + pds?: ServiceConfig; + viewer?: ViewerConfig; + } + interface ServiceConfig extends TypedBase { + url?: string; + } + interface ViewerConfig extends TypedBase { + role?: + | 'tools.ozone.team.defs#roleAdmin' + | 'tools.ozone.team.defs#roleModerator' + | 'tools.ozone.team.defs#roleTriage' + | (string & {}); + } +} + +/** Add values to a specific set. Attempting to add values to a set that does not exist will result in an error. */ +export declare namespace ToolsOzoneSetAddValues { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Name of the set to add values to */ + name: string; + /** + * Array of string values to add to the set + * Minimum array length: 1 + * Maximum array length: 1000 + */ + values: string[]; + } + type Output = undefined; +} + +export declare namespace ToolsOzoneSetDefs { + interface Set extends TypedBase { + /** + * Minimum string length: 3 + * Maximum string length: 128 + */ + name: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + } + interface SetView extends TypedBase { + createdAt: string; + /** + * Minimum string length: 3 + * Maximum string length: 128 + */ + name: string; + setSize: number; + updatedAt: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + } +} + +/** Delete an entire set. Attempting to delete a set that does not exist will result in an error. */ +export declare namespace ToolsOzoneSetDeleteSet { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Name of the set to delete */ + name: string; + } + interface Output extends TypedBase {} + interface Errors extends TypedBase { + SetNotFound: {}; + } +} + +/** Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error */ +export declare namespace ToolsOzoneSetDeleteValues { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** Name of the set to delete values from */ + name: string; + /** + * Array of string values to delete from the set + * Minimum array length: 1 + */ + values: string[]; + } + type Output = undefined; + interface Errors extends TypedBase { + SetNotFound: {}; + } +} + +/** Get a specific set and its values */ +export declare namespace ToolsOzoneSetGetValues { + interface Params extends TypedBase { + name: string; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 1000 + * \@default 100 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + set: ToolsOzoneSetDefs.SetView; + values: string[]; + cursor?: string; + } + interface Errors extends TypedBase { + SetNotFound: {}; + } +} + +/** Query available sets */ +export declare namespace ToolsOzoneSetQuerySets { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + namePrefix?: string; + /** \@default "name" */ + sortBy?: 'name' | 'createdAt' | 'updatedAt'; + /** + * Defaults to ascending order of name field. + * \@default "asc" + */ + sortDirection?: 'asc' | 'desc'; + } + type Input = undefined; + interface Output extends TypedBase { + sets: ToolsOzoneSetDefs.SetView[]; + cursor?: string; + } +} + +/** Create or update set metadata */ +export declare namespace ToolsOzoneSetUpsertSet { + interface Params extends TypedBase {} + type Input = ToolsOzoneSetDefs.Set; + type Output = ToolsOzoneSetDefs.SetView; +} + +export declare namespace ToolsOzoneSettingDefs { + interface Option extends TypedBase { + createdBy: At.DID; + did: At.DID; + key: string; + lastUpdatedBy: At.DID; + scope: 'instance' | 'personal' | (string & {}); + value: unknown; + createdAt?: string; + /** + * Maximum string length: 10240 + * Maximum grapheme length: 1024 + */ + description?: string; + managerRole?: + | 'tools.ozone.team.defs#roleAdmin' + | 'tools.ozone.team.defs#roleModerator' + | 'tools.ozone.team.defs#roleTriage' + | (string & {}); + updatedAt?: string; + } +} + +/** List settings with optional filtering */ +export declare namespace ToolsOzoneSettingListOptions { + interface Params extends TypedBase { + cursor?: string; + /** + * Filter for only the specified keys. Ignored if prefix is provided + * Maximum array length: 100 + */ + keys?: string[]; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + /** Filter keys by prefix */ + prefix?: string; + /** \@default "instance" */ + scope?: 'instance' | 'personal' | (string & {}); + } + type Input = undefined; + interface Output extends TypedBase { + options: ToolsOzoneSettingDefs.Option[]; + cursor?: string; + } +} + +/** Delete settings by key */ +export declare namespace ToolsOzoneSettingRemoveOptions { + interface Params extends TypedBase {} + interface Input extends TypedBase { + /** + * Minimum array length: 1 + * Maximum array length: 200 + */ + keys: string[]; + scope: 'instance' | 'personal' | (string & {}); + } + interface Output extends TypedBase {} +} + +/** Create or update setting option */ +export declare namespace ToolsOzoneSettingUpsertOption { + interface Params extends TypedBase {} + interface Input extends TypedBase { + key: string; + scope: 'instance' | 'personal' | (string & {}); + value: unknown; + /** Maximum string length: 2000 */ + description?: string; + managerRole?: + | 'tools.ozone.team.defs#roleAdmin' + | 'tools.ozone.team.defs#roleModerator' + | 'tools.ozone.team.defs#roleTriage' + | (string & {}); + } + interface Output extends TypedBase { + option: ToolsOzoneSettingDefs.Option; + } +} + +export declare namespace ToolsOzoneSignatureDefs { + interface SigDetail extends TypedBase { + property: string; + value: string; + } +} + +/** Find all correlated threat signatures between 2 or more accounts. */ +export declare namespace ToolsOzoneSignatureFindCorrelation { + interface Params extends TypedBase { + dids: At.DID[]; + } + type Input = undefined; + interface Output extends TypedBase { + details: ToolsOzoneSignatureDefs.SigDetail[]; + } +} + +/** Get accounts that share some matching threat signatures with the root account. */ +export declare namespace ToolsOzoneSignatureFindRelatedAccounts { + interface Params extends TypedBase { + did: At.DID; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + accounts: RelatedAccount[]; + cursor?: string; + } + interface RelatedAccount extends TypedBase { + account: ComAtprotoAdminDefs.AccountView; + similarities?: ToolsOzoneSignatureDefs.SigDetail[]; + } +} + +/** Search for accounts that match one or more threat signature values. */ +export declare namespace ToolsOzoneSignatureSearchAccounts { + interface Params extends TypedBase { + values: string[]; + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + accounts: ComAtprotoAdminDefs.AccountView[]; + cursor?: string; + } +} + +/** Add a member to the ozone team. Requires admin role. */ +export declare namespace ToolsOzoneTeamAddMember { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + role: + | 'tools.ozone.team.defs#roleAdmin' + | 'tools.ozone.team.defs#roleModerator' + | 'tools.ozone.team.defs#roleTriage' + | (string & {}); + } + type Output = ToolsOzoneTeamDefs.Member; + interface Errors extends TypedBase { + MemberAlreadyExists: {}; + } +} + +export declare namespace ToolsOzoneTeamDefs { + interface Member extends TypedBase { + did: At.DID; + role: '#roleAdmin' | '#roleModerator' | '#roleTriage' | (string & {}); + createdAt?: string; + disabled?: boolean; + lastUpdatedBy?: string; + profile?: AppBskyActorDefs.ProfileViewDetailed; + updatedAt?: string; + } + type RoleAdmin = 'tools.ozone.team.defs#roleAdmin'; + type RoleModerator = 'tools.ozone.team.defs#roleModerator'; + type RoleTriage = 'tools.ozone.team.defs#roleTriage'; +} + +/** Delete a member from ozone team. Requires admin role. */ +export declare namespace ToolsOzoneTeamDeleteMember { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + } + type Output = undefined; + interface Errors extends TypedBase { + MemberNotFound: {}; + CannotDeleteSelf: {}; + } +} + +/** List all members with access to the ozone service. */ +export declare namespace ToolsOzoneTeamListMembers { + interface Params extends TypedBase { + cursor?: string; + /** + * Minimum: 1 + * Maximum: 100 + * \@default 50 + */ + limit?: number; + } + type Input = undefined; + interface Output extends TypedBase { + members: ToolsOzoneTeamDefs.Member[]; + cursor?: string; + } +} + +/** Update a member in the ozone service. Requires admin role. */ +export declare namespace ToolsOzoneTeamUpdateMember { + interface Params extends TypedBase {} + interface Input extends TypedBase { + did: At.DID; + disabled?: boolean; + role?: + | 'tools.ozone.team.defs#roleAdmin' + | 'tools.ozone.team.defs#roleModerator' + | 'tools.ozone.team.defs#roleTriage' + | (string & {}); + } + type Output = ToolsOzoneTeamDefs.Member; + interface Errors extends TypedBase { + MemberNotFound: {}; + } +} + +export declare interface Records extends RecordBase { + 'app.bsky.actor.profile': AppBskyActorProfile.Record; + 'app.bsky.feed.generator': AppBskyFeedGenerator.Record; + 'app.bsky.feed.like': AppBskyFeedLike.Record; + 'app.bsky.feed.post': AppBskyFeedPost.Record; + 'app.bsky.feed.postgate': AppBskyFeedPostgate.Record; + 'app.bsky.feed.repost': AppBskyFeedRepost.Record; + 'app.bsky.feed.threadgate': AppBskyFeedThreadgate.Record; + 'app.bsky.graph.block': AppBskyGraphBlock.Record; + 'app.bsky.graph.follow': AppBskyGraphFollow.Record; + 'app.bsky.graph.list': AppBskyGraphList.Record; + 'app.bsky.graph.listblock': AppBskyGraphListblock.Record; + 'app.bsky.graph.listitem': AppBskyGraphListitem.Record; + 'app.bsky.graph.starterpack': AppBskyGraphStarterpack.Record; + 'app.bsky.labeler.service': AppBskyLabelerService.Record; + 'chat.bsky.actor.declaration': ChatBskyActorDeclaration.Record; +} + +export declare interface Queries { + 'app.bsky.actor.getPreferences': { + output: AppBskyActorGetPreferences.Output; + }; + 'app.bsky.actor.getProfile': { + params: AppBskyActorGetProfile.Params; + output: AppBskyActorGetProfile.Output; + }; + 'app.bsky.actor.getProfiles': { + params: AppBskyActorGetProfiles.Params; + output: AppBskyActorGetProfiles.Output; + }; + 'app.bsky.actor.getSuggestions': { + params: AppBskyActorGetSuggestions.Params; + output: AppBskyActorGetSuggestions.Output; + }; + 'app.bsky.actor.searchActors': { + params: AppBskyActorSearchActors.Params; + output: AppBskyActorSearchActors.Output; + }; + 'app.bsky.actor.searchActorsTypeahead': { + params: AppBskyActorSearchActorsTypeahead.Params; + output: AppBskyActorSearchActorsTypeahead.Output; + }; + 'app.bsky.feed.describeFeedGenerator': { + output: AppBskyFeedDescribeFeedGenerator.Output; + }; + 'app.bsky.feed.getActorFeeds': { + params: AppBskyFeedGetActorFeeds.Params; + output: AppBskyFeedGetActorFeeds.Output; + }; + 'app.bsky.feed.getActorLikes': { + params: AppBskyFeedGetActorLikes.Params; + output: AppBskyFeedGetActorLikes.Output; + }; + 'app.bsky.feed.getAuthorFeed': { + params: AppBskyFeedGetAuthorFeed.Params; + output: AppBskyFeedGetAuthorFeed.Output; + }; + 'app.bsky.feed.getFeed': { + params: AppBskyFeedGetFeed.Params; + output: AppBskyFeedGetFeed.Output; + }; + 'app.bsky.feed.getFeedGenerator': { + params: AppBskyFeedGetFeedGenerator.Params; + output: AppBskyFeedGetFeedGenerator.Output; + }; + 'app.bsky.feed.getFeedGenerators': { + params: AppBskyFeedGetFeedGenerators.Params; + output: AppBskyFeedGetFeedGenerators.Output; + }; + 'app.bsky.feed.getFeedSkeleton': { + params: AppBskyFeedGetFeedSkeleton.Params; + output: AppBskyFeedGetFeedSkeleton.Output; + }; + 'app.bsky.feed.getLikes': { + params: AppBskyFeedGetLikes.Params; + output: AppBskyFeedGetLikes.Output; + }; + 'app.bsky.feed.getListFeed': { + params: AppBskyFeedGetListFeed.Params; + output: AppBskyFeedGetListFeed.Output; + }; + 'app.bsky.feed.getPosts': { + params: AppBskyFeedGetPosts.Params; + output: AppBskyFeedGetPosts.Output; + }; + 'app.bsky.feed.getPostThread': { + params: AppBskyFeedGetPostThread.Params; + output: AppBskyFeedGetPostThread.Output; + }; + 'app.bsky.feed.getQuotes': { + params: AppBskyFeedGetQuotes.Params; + output: AppBskyFeedGetQuotes.Output; + }; + 'app.bsky.feed.getRepostedBy': { + params: AppBskyFeedGetRepostedBy.Params; + output: AppBskyFeedGetRepostedBy.Output; + }; + 'app.bsky.feed.getSuggestedFeeds': { + params: AppBskyFeedGetSuggestedFeeds.Params; + output: AppBskyFeedGetSuggestedFeeds.Output; + }; + 'app.bsky.feed.getTimeline': { + params: AppBskyFeedGetTimeline.Params; + output: AppBskyFeedGetTimeline.Output; + }; + 'app.bsky.feed.searchPosts': { + params: AppBskyFeedSearchPosts.Params; + output: AppBskyFeedSearchPosts.Output; + }; + 'app.bsky.graph.getActorStarterPacks': { + params: AppBskyGraphGetActorStarterPacks.Params; + output: AppBskyGraphGetActorStarterPacks.Output; + }; + 'app.bsky.graph.getBlocks': { + params: AppBskyGraphGetBlocks.Params; + output: AppBskyGraphGetBlocks.Output; + }; + 'app.bsky.graph.getFollowers': { + params: AppBskyGraphGetFollowers.Params; + output: AppBskyGraphGetFollowers.Output; + }; + 'app.bsky.graph.getFollows': { + params: AppBskyGraphGetFollows.Params; + output: AppBskyGraphGetFollows.Output; + }; + 'app.bsky.graph.getKnownFollowers': { + params: AppBskyGraphGetKnownFollowers.Params; + output: AppBskyGraphGetKnownFollowers.Output; + }; + 'app.bsky.graph.getList': { + params: AppBskyGraphGetList.Params; + output: AppBskyGraphGetList.Output; + }; + 'app.bsky.graph.getListBlocks': { + params: AppBskyGraphGetListBlocks.Params; + output: AppBskyGraphGetListBlocks.Output; + }; + 'app.bsky.graph.getListMutes': { + params: AppBskyGraphGetListMutes.Params; + output: AppBskyGraphGetListMutes.Output; + }; + 'app.bsky.graph.getLists': { + params: AppBskyGraphGetLists.Params; + output: AppBskyGraphGetLists.Output; + }; + 'app.bsky.graph.getMutes': { + params: AppBskyGraphGetMutes.Params; + output: AppBskyGraphGetMutes.Output; + }; + 'app.bsky.graph.getRelationships': { + params: AppBskyGraphGetRelationships.Params; + output: AppBskyGraphGetRelationships.Output; + }; + 'app.bsky.graph.getStarterPack': { + params: AppBskyGraphGetStarterPack.Params; + output: AppBskyGraphGetStarterPack.Output; + }; + 'app.bsky.graph.getStarterPacks': { + params: AppBskyGraphGetStarterPacks.Params; + output: AppBskyGraphGetStarterPacks.Output; + }; + 'app.bsky.graph.getSuggestedFollowsByActor': { + params: AppBskyGraphGetSuggestedFollowsByActor.Params; + output: AppBskyGraphGetSuggestedFollowsByActor.Output; + }; + 'app.bsky.graph.searchStarterPacks': { + params: AppBskyGraphSearchStarterPacks.Params; + output: AppBskyGraphSearchStarterPacks.Output; + }; + 'app.bsky.labeler.getServices': { + params: AppBskyLabelerGetServices.Params; + output: AppBskyLabelerGetServices.Output; + }; + 'app.bsky.notification.getUnreadCount': { + params: AppBskyNotificationGetUnreadCount.Params; + output: AppBskyNotificationGetUnreadCount.Output; + }; + 'app.bsky.notification.listNotifications': { + params: AppBskyNotificationListNotifications.Params; + output: AppBskyNotificationListNotifications.Output; + }; + 'app.bsky.unspecced.getConfig': { + output: AppBskyUnspeccedGetConfig.Output; + }; + 'app.bsky.unspecced.getPopularFeedGenerators': { + params: AppBskyUnspeccedGetPopularFeedGenerators.Params; + output: AppBskyUnspeccedGetPopularFeedGenerators.Output; + }; + 'app.bsky.unspecced.getSuggestionsSkeleton': { + params: AppBskyUnspeccedGetSuggestionsSkeleton.Params; + output: AppBskyUnspeccedGetSuggestionsSkeleton.Output; + }; + 'app.bsky.unspecced.getTaggedSuggestions': { + output: AppBskyUnspeccedGetTaggedSuggestions.Output; + }; + 'app.bsky.unspecced.searchActorsSkeleton': { + params: AppBskyUnspeccedSearchActorsSkeleton.Params; + output: AppBskyUnspeccedSearchActorsSkeleton.Output; + }; + 'app.bsky.unspecced.searchPostsSkeleton': { + params: AppBskyUnspeccedSearchPostsSkeleton.Params; + output: AppBskyUnspeccedSearchPostsSkeleton.Output; + }; + 'app.bsky.unspecced.searchStarterPacksSkeleton': { + params: AppBskyUnspeccedSearchStarterPacksSkeleton.Params; + output: AppBskyUnspeccedSearchStarterPacksSkeleton.Output; + }; + 'app.bsky.video.getJobStatus': { + params: AppBskyVideoGetJobStatus.Params; + output: AppBskyVideoGetJobStatus.Output; + }; + 'app.bsky.video.getUploadLimits': { + output: AppBskyVideoGetUploadLimits.Output; + }; + 'chat.bsky.actor.exportAccountData': { + output: ChatBskyActorExportAccountData.Output; + }; + 'chat.bsky.convo.getConvo': { + params: ChatBskyConvoGetConvo.Params; + output: ChatBskyConvoGetConvo.Output; + }; + 'chat.bsky.convo.getConvoForMembers': { + params: ChatBskyConvoGetConvoForMembers.Params; + output: ChatBskyConvoGetConvoForMembers.Output; + }; + 'chat.bsky.convo.getLog': { + params: ChatBskyConvoGetLog.Params; + output: ChatBskyConvoGetLog.Output; + }; + 'chat.bsky.convo.getMessages': { + params: ChatBskyConvoGetMessages.Params; + output: ChatBskyConvoGetMessages.Output; + }; + 'chat.bsky.convo.listConvos': { + params: ChatBskyConvoListConvos.Params; + output: ChatBskyConvoListConvos.Output; + }; + 'chat.bsky.moderation.getActorMetadata': { + params: ChatBskyModerationGetActorMetadata.Params; + output: ChatBskyModerationGetActorMetadata.Output; + }; + 'chat.bsky.moderation.getMessageContext': { + params: ChatBskyModerationGetMessageContext.Params; + output: ChatBskyModerationGetMessageContext.Output; + }; + 'com.atproto.admin.getAccountInfo': { + params: ComAtprotoAdminGetAccountInfo.Params; + output: ComAtprotoAdminGetAccountInfo.Output; + }; + 'com.atproto.admin.getAccountInfos': { + params: ComAtprotoAdminGetAccountInfos.Params; + output: ComAtprotoAdminGetAccountInfos.Output; + }; + 'com.atproto.admin.getInviteCodes': { + params: ComAtprotoAdminGetInviteCodes.Params; + output: ComAtprotoAdminGetInviteCodes.Output; + }; + 'com.atproto.admin.getSubjectStatus': { + params: ComAtprotoAdminGetSubjectStatus.Params; + output: ComAtprotoAdminGetSubjectStatus.Output; + }; + 'com.atproto.admin.searchAccounts': { + params: ComAtprotoAdminSearchAccounts.Params; + output: ComAtprotoAdminSearchAccounts.Output; + }; + 'com.atproto.identity.getRecommendedDidCredentials': { + output: ComAtprotoIdentityGetRecommendedDidCredentials.Output; + }; + 'com.atproto.identity.resolveHandle': { + params: ComAtprotoIdentityResolveHandle.Params; + output: ComAtprotoIdentityResolveHandle.Output; + }; + 'com.atproto.label.queryLabels': { + params: ComAtprotoLabelQueryLabels.Params; + output: ComAtprotoLabelQueryLabels.Output; + }; + 'com.atproto.repo.describeRepo': { + params: ComAtprotoRepoDescribeRepo.Params; + output: ComAtprotoRepoDescribeRepo.Output; + }; + 'com.atproto.repo.getRecord': { + params: ComAtprotoRepoGetRecord.Params; + output: ComAtprotoRepoGetRecord.Output; + }; + 'com.atproto.repo.listMissingBlobs': { + params: ComAtprotoRepoListMissingBlobs.Params; + output: ComAtprotoRepoListMissingBlobs.Output; + }; + 'com.atproto.repo.listRecords': { + params: ComAtprotoRepoListRecords.Params; + output: ComAtprotoRepoListRecords.Output; + }; + 'com.atproto.server.checkAccountStatus': { + output: ComAtprotoServerCheckAccountStatus.Output; + }; + 'com.atproto.server.describeServer': { + output: ComAtprotoServerDescribeServer.Output; + }; + 'com.atproto.server.getAccountInviteCodes': { + params: ComAtprotoServerGetAccountInviteCodes.Params; + output: ComAtprotoServerGetAccountInviteCodes.Output; + }; + 'com.atproto.server.getServiceAuth': { + params: ComAtprotoServerGetServiceAuth.Params; + output: ComAtprotoServerGetServiceAuth.Output; + }; + 'com.atproto.server.getSession': { + output: ComAtprotoServerGetSession.Output; + }; + 'com.atproto.server.listAppPasswords': { + output: ComAtprotoServerListAppPasswords.Output; + }; + 'com.atproto.sync.getBlob': { + params: ComAtprotoSyncGetBlob.Params; + output: ComAtprotoSyncGetBlob.Output; + }; + 'com.atproto.sync.getBlocks': { + params: ComAtprotoSyncGetBlocks.Params; + output: ComAtprotoSyncGetBlocks.Output; + }; + 'com.atproto.sync.getCheckout': { + params: ComAtprotoSyncGetCheckout.Params; + output: ComAtprotoSyncGetCheckout.Output; + }; + 'com.atproto.sync.getHead': { + params: ComAtprotoSyncGetHead.Params; + output: ComAtprotoSyncGetHead.Output; + }; + 'com.atproto.sync.getLatestCommit': { + params: ComAtprotoSyncGetLatestCommit.Params; + output: ComAtprotoSyncGetLatestCommit.Output; + }; + 'com.atproto.sync.getRecord': { + params: ComAtprotoSyncGetRecord.Params; + output: ComAtprotoSyncGetRecord.Output; + }; + 'com.atproto.sync.getRepo': { + params: ComAtprotoSyncGetRepo.Params; + output: ComAtprotoSyncGetRepo.Output; + }; + 'com.atproto.sync.getRepoStatus': { + params: ComAtprotoSyncGetRepoStatus.Params; + output: ComAtprotoSyncGetRepoStatus.Output; + }; + 'com.atproto.sync.listBlobs': { + params: ComAtprotoSyncListBlobs.Params; + output: ComAtprotoSyncListBlobs.Output; + }; + 'com.atproto.sync.listRepos': { + params: ComAtprotoSyncListRepos.Params; + output: ComAtprotoSyncListRepos.Output; + }; + 'com.atproto.temp.checkSignupQueue': { + output: ComAtprotoTempCheckSignupQueue.Output; + }; + 'com.atproto.temp.fetchLabels': { + params: ComAtprotoTempFetchLabels.Params; + output: ComAtprotoTempFetchLabels.Output; + }; + 'tools.ozone.communication.listTemplates': { + output: ToolsOzoneCommunicationListTemplates.Output; + }; + 'tools.ozone.moderation.getEvent': { + params: ToolsOzoneModerationGetEvent.Params; + output: ToolsOzoneModerationGetEvent.Output; + }; + 'tools.ozone.moderation.getRecord': { + params: ToolsOzoneModerationGetRecord.Params; + output: ToolsOzoneModerationGetRecord.Output; + }; + 'tools.ozone.moderation.getRecords': { + params: ToolsOzoneModerationGetRecords.Params; + output: ToolsOzoneModerationGetRecords.Output; + }; + 'tools.ozone.moderation.getRepo': { + params: ToolsOzoneModerationGetRepo.Params; + output: ToolsOzoneModerationGetRepo.Output; + }; + 'tools.ozone.moderation.getRepos': { + params: ToolsOzoneModerationGetRepos.Params; + output: ToolsOzoneModerationGetRepos.Output; + }; + 'tools.ozone.moderation.queryEvents': { + params: ToolsOzoneModerationQueryEvents.Params; + output: ToolsOzoneModerationQueryEvents.Output; + }; + 'tools.ozone.moderation.queryStatuses': { + params: ToolsOzoneModerationQueryStatuses.Params; + output: ToolsOzoneModerationQueryStatuses.Output; + }; + 'tools.ozone.moderation.searchRepos': { + params: ToolsOzoneModerationSearchRepos.Params; + output: ToolsOzoneModerationSearchRepos.Output; + }; + 'tools.ozone.server.getConfig': { + output: ToolsOzoneServerGetConfig.Output; + }; + 'tools.ozone.set.getValues': { + params: ToolsOzoneSetGetValues.Params; + output: ToolsOzoneSetGetValues.Output; + }; + 'tools.ozone.set.querySets': { + params: ToolsOzoneSetQuerySets.Params; + output: ToolsOzoneSetQuerySets.Output; + }; + 'tools.ozone.setting.listOptions': { + params: ToolsOzoneSettingListOptions.Params; + output: ToolsOzoneSettingListOptions.Output; + }; + 'tools.ozone.signature.findCorrelation': { + params: ToolsOzoneSignatureFindCorrelation.Params; + output: ToolsOzoneSignatureFindCorrelation.Output; + }; + 'tools.ozone.signature.findRelatedAccounts': { + params: ToolsOzoneSignatureFindRelatedAccounts.Params; + output: ToolsOzoneSignatureFindRelatedAccounts.Output; + }; + 'tools.ozone.signature.searchAccounts': { + params: ToolsOzoneSignatureSearchAccounts.Params; + output: ToolsOzoneSignatureSearchAccounts.Output; + }; + 'tools.ozone.team.listMembers': { + params: ToolsOzoneTeamListMembers.Params; + output: ToolsOzoneTeamListMembers.Output; + }; +} + +export declare interface Procedures { + 'app.bsky.actor.putPreferences': { + input: AppBskyActorPutPreferences.Input; + }; + 'app.bsky.feed.sendInteractions': { + input: AppBskyFeedSendInteractions.Input; + output: AppBskyFeedSendInteractions.Output; + }; + 'app.bsky.graph.muteActor': { + input: AppBskyGraphMuteActor.Input; + }; + 'app.bsky.graph.muteActorList': { + input: AppBskyGraphMuteActorList.Input; + }; + 'app.bsky.graph.muteThread': { + input: AppBskyGraphMuteThread.Input; + }; + 'app.bsky.graph.unmuteActor': { + input: AppBskyGraphUnmuteActor.Input; + }; + 'app.bsky.graph.unmuteActorList': { + input: AppBskyGraphUnmuteActorList.Input; + }; + 'app.bsky.graph.unmuteThread': { + input: AppBskyGraphUnmuteThread.Input; + }; + 'app.bsky.notification.putPreferences': { + input: AppBskyNotificationPutPreferences.Input; + }; + 'app.bsky.notification.registerPush': { + input: AppBskyNotificationRegisterPush.Input; + }; + 'app.bsky.notification.updateSeen': { + input: AppBskyNotificationUpdateSeen.Input; + }; + 'app.bsky.video.uploadVideo': { + input: AppBskyVideoUploadVideo.Input; + output: AppBskyVideoUploadVideo.Output; + }; + 'chat.bsky.actor.deleteAccount': { + output: ChatBskyActorDeleteAccount.Output; + }; + 'chat.bsky.convo.deleteMessageForSelf': { + input: ChatBskyConvoDeleteMessageForSelf.Input; + output: ChatBskyConvoDeleteMessageForSelf.Output; + }; + 'chat.bsky.convo.leaveConvo': { + input: ChatBskyConvoLeaveConvo.Input; + output: ChatBskyConvoLeaveConvo.Output; + }; + 'chat.bsky.convo.muteConvo': { + input: ChatBskyConvoMuteConvo.Input; + output: ChatBskyConvoMuteConvo.Output; + }; + 'chat.bsky.convo.sendMessage': { + input: ChatBskyConvoSendMessage.Input; + output: ChatBskyConvoSendMessage.Output; + }; + 'chat.bsky.convo.sendMessageBatch': { + input: ChatBskyConvoSendMessageBatch.Input; + output: ChatBskyConvoSendMessageBatch.Output; + }; + 'chat.bsky.convo.unmuteConvo': { + input: ChatBskyConvoUnmuteConvo.Input; + output: ChatBskyConvoUnmuteConvo.Output; + }; + 'chat.bsky.convo.updateRead': { + input: ChatBskyConvoUpdateRead.Input; + output: ChatBskyConvoUpdateRead.Output; + }; + 'chat.bsky.moderation.updateActorAccess': { + input: ChatBskyModerationUpdateActorAccess.Input; + }; + 'com.atproto.admin.deleteAccount': { + input: ComAtprotoAdminDeleteAccount.Input; + }; + 'com.atproto.admin.disableAccountInvites': { + input: ComAtprotoAdminDisableAccountInvites.Input; + }; + 'com.atproto.admin.disableInviteCodes': { + input: ComAtprotoAdminDisableInviteCodes.Input; + }; + 'com.atproto.admin.enableAccountInvites': { + input: ComAtprotoAdminEnableAccountInvites.Input; + }; + 'com.atproto.admin.sendEmail': { + input: ComAtprotoAdminSendEmail.Input; + output: ComAtprotoAdminSendEmail.Output; + }; + 'com.atproto.admin.updateAccountEmail': { + input: ComAtprotoAdminUpdateAccountEmail.Input; + }; + 'com.atproto.admin.updateAccountHandle': { + input: ComAtprotoAdminUpdateAccountHandle.Input; + }; + 'com.atproto.admin.updateAccountPassword': { + input: ComAtprotoAdminUpdateAccountPassword.Input; + }; + 'com.atproto.admin.updateSubjectStatus': { + input: ComAtprotoAdminUpdateSubjectStatus.Input; + output: ComAtprotoAdminUpdateSubjectStatus.Output; + }; + 'com.atproto.identity.requestPlcOperationSignature': {}; + 'com.atproto.identity.signPlcOperation': { + input: ComAtprotoIdentitySignPlcOperation.Input; + output: ComAtprotoIdentitySignPlcOperation.Output; + }; + 'com.atproto.identity.submitPlcOperation': { + input: ComAtprotoIdentitySubmitPlcOperation.Input; + }; + 'com.atproto.identity.updateHandle': { + input: ComAtprotoIdentityUpdateHandle.Input; + }; + 'com.atproto.moderation.createReport': { + input: ComAtprotoModerationCreateReport.Input; + output: ComAtprotoModerationCreateReport.Output; + }; + 'com.atproto.repo.applyWrites': { + input: ComAtprotoRepoApplyWrites.Input; + output: ComAtprotoRepoApplyWrites.Output; + }; + 'com.atproto.repo.createRecord': { + input: ComAtprotoRepoCreateRecord.Input; + output: ComAtprotoRepoCreateRecord.Output; + }; + 'com.atproto.repo.deleteRecord': { + input: ComAtprotoRepoDeleteRecord.Input; + output: ComAtprotoRepoDeleteRecord.Output; + }; + 'com.atproto.repo.importRepo': { + input: ComAtprotoRepoImportRepo.Input; + }; + 'com.atproto.repo.putRecord': { + input: ComAtprotoRepoPutRecord.Input; + output: ComAtprotoRepoPutRecord.Output; + }; + 'com.atproto.repo.uploadBlob': { + input: ComAtprotoRepoUploadBlob.Input; + output: ComAtprotoRepoUploadBlob.Output; + }; + 'com.atproto.server.activateAccount': {}; + 'com.atproto.server.confirmEmail': { + input: ComAtprotoServerConfirmEmail.Input; + }; + 'com.atproto.server.createAccount': { + input: ComAtprotoServerCreateAccount.Input; + output: ComAtprotoServerCreateAccount.Output; + }; + 'com.atproto.server.createAppPassword': { + input: ComAtprotoServerCreateAppPassword.Input; + output: ComAtprotoServerCreateAppPassword.Output; + }; + 'com.atproto.server.createInviteCode': { + input: ComAtprotoServerCreateInviteCode.Input; + output: ComAtprotoServerCreateInviteCode.Output; + }; + 'com.atproto.server.createInviteCodes': { + input: ComAtprotoServerCreateInviteCodes.Input; + output: ComAtprotoServerCreateInviteCodes.Output; + }; + 'com.atproto.server.createSession': { + input: ComAtprotoServerCreateSession.Input; + output: ComAtprotoServerCreateSession.Output; + }; + 'com.atproto.server.deactivateAccount': { + input: ComAtprotoServerDeactivateAccount.Input; + }; + 'com.atproto.server.deleteAccount': { + input: ComAtprotoServerDeleteAccount.Input; + }; + 'com.atproto.server.deleteSession': {}; + 'com.atproto.server.refreshSession': { + output: ComAtprotoServerRefreshSession.Output; + }; + 'com.atproto.server.requestAccountDelete': {}; + 'com.atproto.server.requestEmailConfirmation': {}; + 'com.atproto.server.requestEmailUpdate': { + output: ComAtprotoServerRequestEmailUpdate.Output; + }; + 'com.atproto.server.requestPasswordReset': { + input: ComAtprotoServerRequestPasswordReset.Input; + }; + 'com.atproto.server.reserveSigningKey': { + input: ComAtprotoServerReserveSigningKey.Input; + output: ComAtprotoServerReserveSigningKey.Output; + }; + 'com.atproto.server.resetPassword': { + input: ComAtprotoServerResetPassword.Input; + }; + 'com.atproto.server.revokeAppPassword': { + input: ComAtprotoServerRevokeAppPassword.Input; + }; + 'com.atproto.server.updateEmail': { + input: ComAtprotoServerUpdateEmail.Input; + }; + 'com.atproto.sync.notifyOfUpdate': { + input: ComAtprotoSyncNotifyOfUpdate.Input; + }; + 'com.atproto.sync.requestCrawl': { + input: ComAtprotoSyncRequestCrawl.Input; + }; + 'com.atproto.temp.addReservedHandle': { + input: ComAtprotoTempAddReservedHandle.Input; + output: ComAtprotoTempAddReservedHandle.Output; + }; + 'com.atproto.temp.requestPhoneVerification': { + input: ComAtprotoTempRequestPhoneVerification.Input; + }; + 'tools.ozone.communication.createTemplate': { + input: ToolsOzoneCommunicationCreateTemplate.Input; + output: ToolsOzoneCommunicationCreateTemplate.Output; + }; + 'tools.ozone.communication.deleteTemplate': { + input: ToolsOzoneCommunicationDeleteTemplate.Input; + }; + 'tools.ozone.communication.updateTemplate': { + input: ToolsOzoneCommunicationUpdateTemplate.Input; + output: ToolsOzoneCommunicationUpdateTemplate.Output; + }; + 'tools.ozone.moderation.emitEvent': { + input: ToolsOzoneModerationEmitEvent.Input; + output: ToolsOzoneModerationEmitEvent.Output; + }; + 'tools.ozone.set.addValues': { + input: ToolsOzoneSetAddValues.Input; + }; + 'tools.ozone.set.deleteSet': { + input: ToolsOzoneSetDeleteSet.Input; + output: ToolsOzoneSetDeleteSet.Output; + }; + 'tools.ozone.set.deleteValues': { + input: ToolsOzoneSetDeleteValues.Input; + }; + 'tools.ozone.set.upsertSet': { + input: ToolsOzoneSetUpsertSet.Input; + output: ToolsOzoneSetUpsertSet.Output; + }; + 'tools.ozone.setting.removeOptions': { + input: ToolsOzoneSettingRemoveOptions.Input; + output: ToolsOzoneSettingRemoveOptions.Output; + }; + 'tools.ozone.setting.upsertOption': { + input: ToolsOzoneSettingUpsertOption.Input; + output: ToolsOzoneSettingUpsertOption.Output; + }; + 'tools.ozone.team.addMember': { + input: ToolsOzoneTeamAddMember.Input; + output: ToolsOzoneTeamAddMember.Output; + }; + 'tools.ozone.team.deleteMember': { + input: ToolsOzoneTeamDeleteMember.Input; + }; + 'tools.ozone.team.updateMember': { + input: ToolsOzoneTeamUpdateMember.Input; + output: ToolsOzoneTeamUpdateMember.Output; + }; +} + +export declare interface Subscriptions { + 'com.atproto.label.subscribeLabels': { + params: ComAtprotoLabelSubscribeLabels.Params; + message: ComAtprotoLabelSubscribeLabels.Message; + errors: ComAtprotoLabelSubscribeLabels.Errors; + }; + 'com.atproto.sync.subscribeRepos': { + params: ComAtprotoSyncSubscribeRepos.Params; + message: ComAtprotoSyncSubscribeRepos.Message; + errors: ComAtprotoSyncSubscribeRepos.Errors; + }; +} From 6d76a174384916cbd0031db60721a04f81e27883 Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Wed, 4 Dec 2024 08:39:09 -0500 Subject: [PATCH 67/68] ignoring generated types --- biome.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/biome.json b/biome.json index bfc453f..046ccc7 100644 --- a/biome.json +++ b/biome.json @@ -16,7 +16,8 @@ "dist", "node_modules", "package.json", - "tsconfig.json" + "tsconfig.json", + "packages/lexicons/src/lib/lexicons.ts" ] }, "linter": { From 9fd4170bf22c65c73e7b63bb714f04ddd2545d4b Mon Sep 17 00:00:00 2001 From: Ryan Skinner Date: Wed, 4 Dec 2024 08:43:35 -0500 Subject: [PATCH 68/68] lint fix --- packages/lex-cli/src/generator/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lex-cli/src/generator/index.ts b/packages/lex-cli/src/generator/index.ts index 1355381..204a18a 100644 --- a/packages/lex-cli/src/generator/index.ts +++ b/packages/lex-cli/src/generator/index.ts @@ -150,7 +150,7 @@ ${metadataLines.join('\n')}`; const descs = getDescriptions(def); chunk += writeJsdoc(descs); - chunk += `interface Record extends RecordBase {`; + chunk += 'interface Record extends RecordBase {'; chunk += `$type: '${nsid}';`; for (const prop of propKeys) {