tangled
alpha
login
or
join now
mary.my.id
/
anartia
9
fork
atom
JavaScript-optional public web frontend for Bluesky
anartia.kelinci.net
sveltekit
atcute
bluesky
typescript
svelte
9
fork
atom
overview
issues
pulls
pipelines
refactor: stuff
mary.my.id
5 months ago
3cd552cb
4a542657
verified
This commit was signed with the committer's
known signature
.
mary.my.id
SSH Key Fingerprint:
SHA256:ZlTP/auFSGpGnaoDg4mCTG1g9OZvXp62jWR4c6H4O3c=
+25
-4
1 changed file
expand all
collapse all
unified
split
src
lib
types
valibot.ts
+25
-4
src/lib/types/valibot.ts
···
1
1
-
import { isDid, isNsid, isRecordKey, type Did, type Nsid, type RecordKey } from '@atcute/lexicons/syntax';
1
1
+
import {
2
2
+
isCanonicalResourceUri,
3
3
+
isDid,
4
4
+
isNsid,
5
5
+
isRecordKey,
6
6
+
isResourceUri,
7
7
+
type CanonicalResourceUri,
8
8
+
type Did,
9
9
+
type Nsid,
10
10
+
type RecordKey,
11
11
+
type ResourceUri,
12
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
7
-
v.check((input) => isDid(input), `must be a did string`),
18
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
12
-
v.check((input) => isNsid(input), `must be an nsid string`),
23
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
17
-
v.check((input) => isRecordKey(input), `must be an rkey string`),
28
28
+
v.check((input) => isRecordKey(input), `must be a record key`),
18
29
) as v.GenericSchema<string, RecordKey>;
30
30
+
31
31
+
export const resourceUriString = v.pipe(
32
32
+
v.string(),
33
33
+
v.check((input) => isResourceUri(input), `must be a resource uri`),
34
34
+
) as v.GenericSchema<string, ResourceUri>;
35
35
+
36
36
+
export const canonicalResourceUriString = v.pipe(
37
37
+
v.string(),
38
38
+
v.check((input) => isCanonicalResourceUri(input), `must be a canonical resource uri`),
39
39
+
) as v.GenericSchema<string, CanonicalResourceUri>;
19
40
20
41
export const integer = v.pipe(v.number(), v.safeInteger(), v.minValue(0));