JavaScript-optional public web frontend for Bluesky anartia.kelinci.net
sveltekit atcute bluesky typescript svelte

refactor: stuff

mary.my.id 3cd552cb 4a542657

verified
+25 -4
+25 -4
src/lib/types/valibot.ts
··· 1 - import { isDid, isNsid, isRecordKey, type Did, type Nsid, type RecordKey } from '@atcute/lexicons/syntax'; 1 + import { 2 + isCanonicalResourceUri, 3 + isDid, 4 + isNsid, 5 + isRecordKey, 6 + isResourceUri, 7 + type CanonicalResourceUri, 8 + type Did, 9 + type Nsid, 10 + type RecordKey, 11 + type ResourceUri, 12 + } from '@atcute/lexicons/syntax'; 2 13 3 14 import * as v from 'valibot'; 4 15 5 16 export const didString = v.pipe( 6 17 v.string(), 7 - v.check((input) => isDid(input), `must be a did string`), 18 + v.check((input) => isDid(input), `must be a did`), 8 19 ) as v.GenericSchema<string, Did>; 9 20 10 21 export const nsidString = v.pipe( 11 22 v.string(), 12 - v.check((input) => isNsid(input), `must be an nsid string`), 23 + v.check((input) => isNsid(input), `must be an nsid`), 13 24 ) as v.GenericSchema<string, Nsid>; 14 25 15 26 export const recordKeyString = v.pipe( 16 27 v.string(), 17 - v.check((input) => isRecordKey(input), `must be an rkey string`), 28 + v.check((input) => isRecordKey(input), `must be a record key`), 18 29 ) as v.GenericSchema<string, RecordKey>; 30 + 31 + export const resourceUriString = v.pipe( 32 + v.string(), 33 + v.check((input) => isResourceUri(input), `must be a resource uri`), 34 + ) as v.GenericSchema<string, ResourceUri>; 35 + 36 + export const canonicalResourceUriString = v.pipe( 37 + v.string(), 38 + v.check((input) => isCanonicalResourceUri(input), `must be a canonical resource uri`), 39 + ) as v.GenericSchema<string, CanonicalResourceUri>; 19 40 20 41 export const integer = v.pipe(v.number(), v.safeInteger(), v.minValue(0));