A website for the ATmosphereConf
at main 298 lines 9.0 kB view raw
1/** 2 * GENERATED CODE - DO NOT MODIFY 3 */ 4import { 5 type LexiconDoc, 6 Lexicons, 7 ValidationError, 8 type ValidationResult, 9} from '@atproto/lexicon' 10import { type $Typed, is$typed, maybe$typed } from './util.js' 11 12export const schemaDict = { 13 ComAtprotoLabelDefs: { 14 lexicon: 1, 15 id: 'com.atproto.label.defs', 16 defs: { 17 label: { 18 type: 'object', 19 description: 20 'Metadata tag on an atproto resource (eg, repo or record).', 21 required: ['src', 'uri', 'val', 'cts'], 22 properties: { 23 ver: { 24 type: 'integer', 25 description: 'The AT Protocol version of the label object.', 26 }, 27 src: { 28 type: 'string', 29 format: 'did', 30 description: 'DID of the actor who created this label.', 31 }, 32 uri: { 33 type: 'string', 34 format: 'uri', 35 description: 36 'AT URI of the record, repository (account), or other resource that this label applies to.', 37 }, 38 cid: { 39 type: 'string', 40 format: 'cid', 41 description: 42 "Optionally, CID specifying the specific version of 'uri' resource this label applies to.", 43 }, 44 val: { 45 type: 'string', 46 maxLength: 128, 47 description: 48 'The short string name of the value or type of this label.', 49 }, 50 neg: { 51 type: 'boolean', 52 description: 53 'If true, this is a negation label, overwriting a previous label.', 54 }, 55 cts: { 56 type: 'string', 57 format: 'datetime', 58 description: 'Timestamp when this label was created.', 59 }, 60 exp: { 61 type: 'string', 62 format: 'datetime', 63 description: 64 'Timestamp at which this label expires (no longer applies).', 65 }, 66 sig: { 67 type: 'bytes', 68 description: 'Signature of dag-cbor encoded label.', 69 }, 70 }, 71 }, 72 selfLabels: { 73 type: 'object', 74 description: 75 'Metadata tags on an atproto record, published by the author within the record.', 76 required: ['values'], 77 properties: { 78 values: { 79 type: 'array', 80 items: { 81 type: 'ref', 82 ref: 'lex:com.atproto.label.defs#selfLabel', 83 }, 84 maxLength: 10, 85 }, 86 }, 87 }, 88 selfLabel: { 89 type: 'object', 90 description: 91 'Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.', 92 required: ['val'], 93 properties: { 94 val: { 95 type: 'string', 96 maxLength: 128, 97 description: 98 'The short string name of the value or type of this label.', 99 }, 100 }, 101 }, 102 labelValueDefinition: { 103 type: 'object', 104 description: 105 'Declares a label value and its expected interpretations and behaviors.', 106 required: ['identifier', 'severity', 'blurs', 'locales'], 107 properties: { 108 identifier: { 109 type: 'string', 110 description: 111 "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", 112 maxLength: 100, 113 maxGraphemes: 100, 114 }, 115 severity: { 116 type: 'string', 117 description: 118 "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.", 119 knownValues: ['inform', 'alert', 'none'], 120 }, 121 blurs: { 122 type: 'string', 123 description: 124 "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.", 125 knownValues: ['content', 'media', 'none'], 126 }, 127 defaultSetting: { 128 type: 'string', 129 description: 'The default setting for this label.', 130 knownValues: ['ignore', 'warn', 'hide'], 131 default: 'warn', 132 }, 133 adultOnly: { 134 type: 'boolean', 135 description: 136 'Does the user need to have adult content enabled in order to configure this label?', 137 }, 138 locales: { 139 type: 'array', 140 items: { 141 type: 'ref', 142 ref: 'lex:com.atproto.label.defs#labelValueDefinitionStrings', 143 }, 144 }, 145 }, 146 }, 147 labelValueDefinitionStrings: { 148 type: 'object', 149 description: 150 'Strings which describe the label in the UI, localized into a specific language.', 151 required: ['lang', 'name', 'description'], 152 properties: { 153 lang: { 154 type: 'string', 155 description: 156 'The code of the language these strings are written in.', 157 format: 'language', 158 }, 159 name: { 160 type: 'string', 161 description: 'A short human-readable name for the label.', 162 maxGraphemes: 64, 163 maxLength: 640, 164 }, 165 description: { 166 type: 'string', 167 description: 168 'A longer description of what the label means and why it might be applied.', 169 maxGraphemes: 10000, 170 maxLength: 100000, 171 }, 172 }, 173 }, 174 labelValue: { 175 type: 'string', 176 knownValues: [ 177 '!hide', 178 '!no-promote', 179 '!warn', 180 '!no-unauthenticated', 181 'dmca-violation', 182 'doxxing', 183 'porn', 184 'sexual', 185 'nudity', 186 'nsfl', 187 'gore', 188 ], 189 }, 190 }, 191 }, 192 OrgAtmosphereconfProfile: { 193 lexicon: 1, 194 id: 'org.atmosphereconf.profile', 195 defs: { 196 main: { 197 type: 'record', 198 description: 'A conference attendee profile.', 199 key: 'literal:self', 200 record: { 201 type: 'object', 202 properties: { 203 displayName: { 204 type: 'string', 205 maxGraphemes: 64, 206 maxLength: 640, 207 }, 208 description: { 209 type: 'string', 210 description: 'Free-form profile description text.', 211 maxGraphemes: 256, 212 maxLength: 2560, 213 }, 214 avatar: { 215 type: 'blob', 216 description: 'Profile picture for conference attendee', 217 accept: ['image/png', 'image/jpeg'], 218 maxSize: 1000000, 219 }, 220 banner: { 221 type: 'blob', 222 description: 223 'Larger horizontal image to display behind profile view.', 224 accept: ['image/png', 'image/jpeg'], 225 maxSize: 1000000, 226 }, 227 labels: { 228 type: 'union', 229 description: 'Self-label values for the conference profile.', 230 refs: ['lex:com.atproto.label.defs#selfLabels'], 231 }, 232 createdAt: { 233 type: 'string', 234 format: 'datetime', 235 }, 236 }, 237 }, 238 }, 239 }, 240 }, 241 ComAtprotoRepoStrongRef: { 242 lexicon: 1, 243 id: 'com.atproto.repo.strongRef', 244 description: 'A URI with a content-hash fingerprint.', 245 defs: { 246 main: { 247 type: 'object', 248 required: ['uri', 'cid'], 249 properties: { 250 uri: { 251 type: 'string', 252 format: 'at-uri', 253 }, 254 cid: { 255 type: 'string', 256 format: 'cid', 257 }, 258 }, 259 }, 260 }, 261 }, 262} as const satisfies Record<string, LexiconDoc> 263export const schemas = Object.values(schemaDict) satisfies LexiconDoc[] 264export const lexicons: Lexicons = new Lexicons(schemas) 265 266export function validate<T extends { $type: string }>( 267 v: unknown, 268 id: string, 269 hash: string, 270 requiredType: true, 271): ValidationResult<T> 272export function validate<T extends { $type?: string }>( 273 v: unknown, 274 id: string, 275 hash: string, 276 requiredType?: false, 277): ValidationResult<T> 278export function validate( 279 v: unknown, 280 id: string, 281 hash: string, 282 requiredType?: boolean, 283): ValidationResult { 284 return (requiredType ? is$typed : maybe$typed)(v, id, hash) 285 ? lexicons.validate(`${id}#${hash}`, v) 286 : { 287 success: false, 288 error: new ValidationError( 289 `Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`, 290 ), 291 } 292} 293 294export const ids = { 295 ComAtprotoLabelDefs: 'com.atproto.label.defs', 296 OrgAtmosphereconfProfile: 'org.atmosphereconf.profile', 297 ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef', 298} as const