Update atproto API for content visibility lexicon

This commit is contained in:
vineyardbovines
2026-08-13 09:16:35 -04:00
parent 30c44f7df6
commit fc2fcf0e79
3 changed files with 36 additions and 41 deletions
+1 -1
View File
@@ -96,7 +96,7 @@
"prettier": "prettier --check ."
},
"dependencies": {
"@atproto/api": "0.20.37",
"@atproto/api": "0.20.40",
"@atproto/common-web": "0.5.6",
"@atproto/syntax": "0.7.2",
"@bitdrift/react-native": "^0.6.8",
+25 -25
View File
@@ -242,8 +242,8 @@ importers:
.:
dependencies:
'@atproto/api':
specifier: 0.20.37
version: 0.20.37
specifier: 0.20.40
version: 0.20.40
'@atproto/common-web':
specifier: 0.5.6
version: 0.5.6
@@ -874,16 +874,16 @@ packages:
graphql:
optional: true
'@atproto/api@0.20.37':
resolution: {integrity: sha512-TEt8oKMbuC+1GvqyLKDBLqmptnk1mh52FdHPQEomlPIWxh88YcNnk0g0iKNVBevaeeLtWZF1a7Am/t/q255u5Q==}
'@atproto/api@0.20.40':
resolution: {integrity: sha512-8ClSOeFEhtwLrE7G6eFOdLJLtu5K0A/joYRd+urHS3OZG2uiBrEoIU2JbYcPZjEJ5xtWMo9VJiKV5zPSH7rP3Q==}
engines: {node: '>=22'}
'@atproto/common-web@0.5.6':
resolution: {integrity: sha512-5Y4MIK9dpkJPiKiE6u7iEHitxj+g3aAU2GfGL686JlKE2zDKD4y18BJb+uVek6nXQKb5XOdNVvw+7BHarpn8Fw==}
engines: {node: '>=22'}
'@atproto/common-web@0.5.8':
resolution: {integrity: sha512-GiYY2Jgbg1aWe9QGT3TswC/wZNicipBDz0nFo4FrP6XqENEJJRxGKAf/zjvqbesfIQFhHXi1VbSFY7GStB8v8w==}
'@atproto/common-web@0.5.9':
resolution: {integrity: sha512-2c5C6YV8352JJz9Z5fNfcsstllaKGAb3cQW9aO7unMAGh/FzTGFq+xOwNMW2lTeagO6z530uxYm8AiSRM6O+DQ==}
engines: {node: '>=22'}
'@atproto/lex-data@0.1.5':
@@ -902,20 +902,20 @@ packages:
resolution: {integrity: sha512-mvrAd0lbyuecIHjyld8QN6MN6CBf4j0GCxLzegsvLh0SvDf+GbYWklkcQqmITL44yFQOwmA/QNIQj0Uvh7+R/g==}
engines: {node: '>=22'}
'@atproto/lexicon@0.7.10':
resolution: {integrity: sha512-HH/3d3z5Qt0JoJ9iOuLP/YT++6lb5wWMQsvgQ2TGfgkbuzDQ6AX6X1H5uJ9luPci4/LaADfpwLZfeqyy/Hjfaw==}
'@atproto/lexicon@0.7.11':
resolution: {integrity: sha512-ukCZMCWmiu7fAlssBbLs+IMaf2K2R9mADaTKz2jEeC/xeZ3jT77Ka0S2G+ELBB+Dc9ijBACU0iPMQLhquOkuzQ==}
engines: {node: '>=22'}
'@atproto/syntax@0.7.2':
resolution: {integrity: sha512-tZ1Tr0R9pK4bI4Zs69t29cjMlCFQvRNBeNkqJC5pGeNuCt64D0eoF7s/AlqeVmYppClmQ0xJquggGgsMDP6j7w==}
engines: {node: '>=22'}
'@atproto/syntax@0.7.3':
resolution: {integrity: sha512-7LU8Ra79L5wCqVAZZst2352VMMwkU4KNagVMm6pnURrY/uS7+HrJl3XCuA4V2Gy2dEpkt1r6DBxlsP43/VjDBw==}
'@atproto/syntax@0.7.4':
resolution: {integrity: sha512-EHsEHtasH/DGPljBYecVDjweGMQ5eTu6Ns0GZ5z0qdqpOI8ipBvldWnMIxWkA+5HfZ9Dsu4V1MX0WP7wgL8cuA==}
engines: {node: '>=22'}
'@atproto/xrpc@0.8.9':
resolution: {integrity: sha512-3jRiAuHCqYFoT8Nv25xFRmgrfmoo84yBnB5PfVP95JoRP+szIkwHS6mq72ZETYbWmLA1tNyR5QVEHrhHZ1LQhw==}
'@atproto/xrpc@0.8.10':
resolution: {integrity: sha512-++FNpTVF61fF8+3Kk1RYtdTO7xyUTdIc/Cmfk2CMn29Qw9tZD8bmW+M5db1Z0okYWFWK8Wqu7bc9VmF8tUB8Jg==}
engines: {node: '>=22'}
'@babel/code-frame@7.10.4':
@@ -9415,12 +9415,12 @@ snapshots:
'@0no-co/graphql.web@1.2.0': {}
'@atproto/api@0.20.37':
'@atproto/api@0.20.40':
dependencies:
'@atproto/common-web': 0.5.8
'@atproto/lexicon': 0.7.10
'@atproto/syntax': 0.7.3
'@atproto/xrpc': 0.8.9
'@atproto/common-web': 0.5.9
'@atproto/lexicon': 0.7.11
'@atproto/syntax': 0.7.4
'@atproto/xrpc': 0.8.10
await-lock: 3.0.0
multiformats: 13.4.2
tlds: 1.261.0
@@ -9433,11 +9433,11 @@ snapshots:
'@atproto/syntax': 0.7.2
zod: 3.25.76
'@atproto/common-web@0.5.8':
'@atproto/common-web@0.5.9':
dependencies:
'@atproto/lex-data': 0.1.7
'@atproto/lex-json': 0.1.6
'@atproto/syntax': 0.7.3
'@atproto/syntax': 0.7.4
zod: 3.25.76
'@atproto/lex-data@0.1.5':
@@ -9462,10 +9462,10 @@ snapshots:
'@atproto/lex-data': 0.1.7
tslib: 2.8.1
'@atproto/lexicon@0.7.10':
'@atproto/lexicon@0.7.11':
dependencies:
'@atproto/common-web': 0.5.8
'@atproto/syntax': 0.7.3
'@atproto/common-web': 0.5.9
'@atproto/syntax': 0.7.4
multiformats: 13.4.2
zod: 3.25.76
@@ -9474,14 +9474,14 @@ snapshots:
iso-datestring-validator: 2.2.2
tslib: 2.8.1
'@atproto/syntax@0.7.3':
'@atproto/syntax@0.7.4':
dependencies:
iso-datestring-validator: 2.2.2
tslib: 2.8.1
'@atproto/xrpc@0.8.9':
'@atproto/xrpc@0.8.10':
dependencies:
'@atproto/lexicon': 0.7.10
'@atproto/lexicon': 0.7.11
zod: 3.25.76
'@babel/code-frame@7.10.4':
+10 -15
View File
@@ -1,11 +1,11 @@
import {AppBskyActorContentVisibilityDeclaration} from '@atproto/api'
export const CONTENT_VISIBILITY_COLLECTION =
'app.bsky.actor.contentVisibilityDeclaration' as const
export const CONTENT_VISIBILITY_RKEY = 'self'
export type ContentVisibilityRecord = {
$type: typeof CONTENT_VISIBILITY_COLLECTION
hideFromAlgorithmicRecommendations: boolean
}
export type ContentVisibilityRecord =
AppBskyActorContentVisibilityDeclaration.Record
export function createContentVisibilityRecord(
hideFromAlgorithmicRecommendations: boolean,
@@ -19,16 +19,11 @@ export function createContentVisibilityRecord(
export function parseContentVisibilityRecord(
value: unknown,
): ContentVisibilityRecord {
if (
typeof value !== 'object' ||
value === null ||
!('$type' in value) ||
value.$type !== CONTENT_VISIBILITY_COLLECTION ||
!('hideFromAlgorithmicRecommendations' in value) ||
typeof value.hideFromAlgorithmicRecommendations !== 'boolean'
) {
throw new Error('Invalid content visibility record')
const result = AppBskyActorContentVisibilityDeclaration.validateRecord(value)
if (!result.success) {
throw new Error('Invalid content visibility record', {
cause: result.error,
})
}
return value as ContentVisibilityRecord
return result.value
}