Monorepo for Wisp.place. A static site hosting service built on top of the AT Protocol.
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 PlaceWispFs: { 14 lexicon: 1, 15 id: 'place.wisp.fs', 16 defs: { 17 main: { 18 type: 'record', 19 description: 'Virtual filesystem manifest for a Wisp site', 20 record: { 21 type: 'object', 22 required: ['site', 'root', 'createdAt'], 23 properties: { 24 site: { 25 type: 'string', 26 }, 27 root: { 28 type: 'ref', 29 ref: 'lex:place.wisp.fs#directory', 30 }, 31 fileCount: { 32 type: 'integer', 33 minimum: 0, 34 maximum: 1000, 35 }, 36 createdAt: { 37 type: 'string', 38 format: 'datetime', 39 }, 40 }, 41 }, 42 }, 43 file: { 44 type: 'object', 45 required: ['type', 'blob'], 46 properties: { 47 type: { 48 type: 'string', 49 const: 'file', 50 }, 51 blob: { 52 type: 'blob', 53 accept: ['*/*'], 54 maxSize: 1000000, 55 description: 'Content blob ref', 56 }, 57 encoding: { 58 type: 'string', 59 enum: ['gzip'], 60 description: 'Content encoding (e.g., gzip for compressed files)', 61 }, 62 mimeType: { 63 type: 'string', 64 description: 'Original MIME type before compression', 65 }, 66 base64: { 67 type: 'boolean', 68 description: 69 'True if blob content is base64-encoded (used to bypass PDS content sniffing)', 70 }, 71 }, 72 }, 73 directory: { 74 type: 'object', 75 required: ['type', 'entries'], 76 properties: { 77 type: { 78 type: 'string', 79 const: 'directory', 80 }, 81 entries: { 82 type: 'array', 83 maxLength: 500, 84 items: { 85 type: 'ref', 86 ref: 'lex:place.wisp.fs#entry', 87 }, 88 }, 89 }, 90 }, 91 entry: { 92 type: 'object', 93 required: ['name', 'node'], 94 properties: { 95 name: { 96 type: 'string', 97 maxLength: 255, 98 }, 99 node: { 100 type: 'union', 101 refs: ['lex:place.wisp.fs#file', 'lex:place.wisp.fs#directory'], 102 }, 103 }, 104 }, 105 }, 106 }, 107} as const satisfies Record<string, LexiconDoc> 108export const schemas = Object.values(schemaDict) satisfies LexiconDoc[] 109export const lexicons: Lexicons = new Lexicons(schemas) 110 111export function validate<T extends { $type: string }>( 112 v: unknown, 113 id: string, 114 hash: string, 115 requiredType: true, 116): ValidationResult<T> 117export function validate<T extends { $type?: string }>( 118 v: unknown, 119 id: string, 120 hash: string, 121 requiredType?: false, 122): ValidationResult<T> 123export function validate( 124 v: unknown, 125 id: string, 126 hash: string, 127 requiredType?: boolean, 128): ValidationResult { 129 return (requiredType ? is$typed : maybe$typed)(v, id, hash) 130 ? lexicons.validate(`${id}#${hash}`, v) 131 : { 132 success: false, 133 error: new ValidationError( 134 `Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`, 135 ), 136 } 137} 138 139export const ids = { 140 PlaceWispFs: 'place.wisp.fs', 141} as const