+6
lex.config.js
+6
lex.config.js
-73
lexicons/com/atproto/repo/createRecord.json
-73
lexicons/com/atproto/repo/createRecord.json
···
1
-
{
2
-
"lexicon": 1,
3
-
"id": "com.atproto.repo.createRecord",
4
-
"defs": {
5
-
"main": {
6
-
"type": "procedure",
7
-
"description": "Create a single new repository record. Requires auth, implemented by PDS.",
8
-
"input": {
9
-
"encoding": "application/json",
10
-
"schema": {
11
-
"type": "object",
12
-
"required": ["repo", "collection", "record"],
13
-
"properties": {
14
-
"repo": {
15
-
"type": "string",
16
-
"format": "at-identifier",
17
-
"description": "The handle or DID of the repo (aka, current account)."
18
-
},
19
-
"collection": {
20
-
"type": "string",
21
-
"format": "nsid",
22
-
"description": "The NSID of the record collection."
23
-
},
24
-
"rkey": {
25
-
"type": "string",
26
-
"format": "record-key",
27
-
"description": "The Record Key.",
28
-
"maxLength": 512
29
-
},
30
-
"validate": {
31
-
"type": "boolean",
32
-
"description": "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
33
-
},
34
-
"record": {
35
-
"type": "unknown",
36
-
"description": "The record itself. Must contain a $type field."
37
-
},
38
-
"swapCommit": {
39
-
"type": "string",
40
-
"format": "cid",
41
-
"description": "Compare and swap with the previous commit by CID."
42
-
}
43
-
}
44
-
}
45
-
},
46
-
"output": {
47
-
"encoding": "application/json",
48
-
"schema": {
49
-
"type": "object",
50
-
"required": ["uri", "cid"],
51
-
"properties": {
52
-
"uri": { "type": "string", "format": "at-uri" },
53
-
"cid": { "type": "string", "format": "cid" },
54
-
"commit": {
55
-
"type": "ref",
56
-
"ref": "com.atproto.repo.defs#commitMeta"
57
-
},
58
-
"validationStatus": {
59
-
"type": "string",
60
-
"knownValues": ["valid", "unknown"]
61
-
}
62
-
}
63
-
}
64
-
},
65
-
"errors": [
66
-
{
67
-
"name": "InvalidSwap",
68
-
"description": "Indicates that 'swapCommit' didn't match current repo commit."
69
-
}
70
-
]
71
-
}
72
-
}
73
-
}
-14
lexicons/com/atproto/repo/defs.json
-14
lexicons/com/atproto/repo/defs.json
-57
lexicons/com/atproto/repo/deleteRecord.json
-57
lexicons/com/atproto/repo/deleteRecord.json
···
1
-
{
2
-
"lexicon": 1,
3
-
"id": "com.atproto.repo.deleteRecord",
4
-
"defs": {
5
-
"main": {
6
-
"type": "procedure",
7
-
"description": "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.",
8
-
"input": {
9
-
"encoding": "application/json",
10
-
"schema": {
11
-
"type": "object",
12
-
"required": ["repo", "collection", "rkey"],
13
-
"properties": {
14
-
"repo": {
15
-
"type": "string",
16
-
"format": "at-identifier",
17
-
"description": "The handle or DID of the repo (aka, current account)."
18
-
},
19
-
"collection": {
20
-
"type": "string",
21
-
"format": "nsid",
22
-
"description": "The NSID of the record collection."
23
-
},
24
-
"rkey": {
25
-
"type": "string",
26
-
"format": "record-key",
27
-
"description": "The Record Key."
28
-
},
29
-
"swapRecord": {
30
-
"type": "string",
31
-
"format": "cid",
32
-
"description": "Compare and swap with the previous record by CID."
33
-
},
34
-
"swapCommit": {
35
-
"type": "string",
36
-
"format": "cid",
37
-
"description": "Compare and swap with the previous commit by CID."
38
-
}
39
-
}
40
-
}
41
-
},
42
-
"output": {
43
-
"encoding": "application/json",
44
-
"schema": {
45
-
"type": "object",
46
-
"properties": {
47
-
"commit": {
48
-
"type": "ref",
49
-
"ref": "com.atproto.repo.defs#commitMeta"
50
-
}
51
-
}
52
-
}
53
-
},
54
-
"errors": [{ "name": "InvalidSwap" }]
55
-
}
56
-
}
57
-
}
-49
lexicons/com/atproto/repo/getRecord.json
-49
lexicons/com/atproto/repo/getRecord.json
···
1
-
{
2
-
"lexicon": 1,
3
-
"id": "com.atproto.repo.getRecord",
4
-
"defs": {
5
-
"main": {
6
-
"type": "query",
7
-
"description": "Get a single record from a repository. Does not require auth.",
8
-
"parameters": {
9
-
"type": "params",
10
-
"required": ["repo", "collection", "rkey"],
11
-
"properties": {
12
-
"repo": {
13
-
"type": "string",
14
-
"format": "at-identifier",
15
-
"description": "The handle or DID of the repo."
16
-
},
17
-
"collection": {
18
-
"type": "string",
19
-
"format": "nsid",
20
-
"description": "The NSID of the record collection."
21
-
},
22
-
"rkey": {
23
-
"type": "string",
24
-
"description": "The Record Key.",
25
-
"format": "record-key"
26
-
},
27
-
"cid": {
28
-
"type": "string",
29
-
"format": "cid",
30
-
"description": "The CID of the version of the record. If not specified, then return the most recent version."
31
-
}
32
-
}
33
-
},
34
-
"output": {
35
-
"encoding": "application/json",
36
-
"schema": {
37
-
"type": "object",
38
-
"required": ["uri", "value"],
39
-
"properties": {
40
-
"uri": { "type": "string", "format": "at-uri" },
41
-
"cid": { "type": "string", "format": "cid" },
42
-
"value": { "type": "unknown" }
43
-
}
44
-
}
45
-
},
46
-
"errors": [{ "name": "RecordNotFound" }]
47
-
}
48
-
}
49
-
}
-69
lexicons/com/atproto/repo/listRecords.json
-69
lexicons/com/atproto/repo/listRecords.json
···
1
-
{
2
-
"lexicon": 1,
3
-
"id": "com.atproto.repo.listRecords",
4
-
"defs": {
5
-
"main": {
6
-
"type": "query",
7
-
"description": "List a range of records in a repository, matching a specific collection. Does not require auth.",
8
-
"parameters": {
9
-
"type": "params",
10
-
"required": ["repo", "collection"],
11
-
"properties": {
12
-
"repo": {
13
-
"type": "string",
14
-
"format": "at-identifier",
15
-
"description": "The handle or DID of the repo."
16
-
},
17
-
"collection": {
18
-
"type": "string",
19
-
"format": "nsid",
20
-
"description": "The NSID of the record type."
21
-
},
22
-
"limit": {
23
-
"type": "integer",
24
-
"minimum": 1,
25
-
"maximum": 100,
26
-
"default": 50,
27
-
"description": "The number of records to return."
28
-
},
29
-
"cursor": { "type": "string" },
30
-
"rkeyStart": {
31
-
"type": "string",
32
-
"description": "DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)"
33
-
},
34
-
"rkeyEnd": {
35
-
"type": "string",
36
-
"description": "DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)"
37
-
},
38
-
"reverse": {
39
-
"type": "boolean",
40
-
"description": "Flag to reverse the order of the returned records."
41
-
}
42
-
}
43
-
},
44
-
"output": {
45
-
"encoding": "application/json",
46
-
"schema": {
47
-
"type": "object",
48
-
"required": ["records"],
49
-
"properties": {
50
-
"cursor": { "type": "string" },
51
-
"records": {
52
-
"type": "array",
53
-
"items": { "type": "ref", "ref": "#record" }
54
-
}
55
-
}
56
-
}
57
-
}
58
-
},
59
-
"record": {
60
-
"type": "object",
61
-
"required": ["uri", "cid", "value"],
62
-
"properties": {
63
-
"uri": { "type": "string", "format": "at-uri" },
64
-
"cid": { "type": "string", "format": "cid" },
65
-
"value": { "type": "unknown" }
66
-
}
67
-
}
68
-
}
69
-
}
-74
lexicons/com/atproto/repo/putRecord.json
-74
lexicons/com/atproto/repo/putRecord.json
···
1
-
{
2
-
"lexicon": 1,
3
-
"id": "com.atproto.repo.putRecord",
4
-
"defs": {
5
-
"main": {
6
-
"type": "procedure",
7
-
"description": "Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.",
8
-
"input": {
9
-
"encoding": "application/json",
10
-
"schema": {
11
-
"type": "object",
12
-
"required": ["repo", "collection", "rkey", "record"],
13
-
"nullable": ["swapRecord"],
14
-
"properties": {
15
-
"repo": {
16
-
"type": "string",
17
-
"format": "at-identifier",
18
-
"description": "The handle or DID of the repo (aka, current account)."
19
-
},
20
-
"collection": {
21
-
"type": "string",
22
-
"format": "nsid",
23
-
"description": "The NSID of the record collection."
24
-
},
25
-
"rkey": {
26
-
"type": "string",
27
-
"format": "record-key",
28
-
"description": "The Record Key.",
29
-
"maxLength": 512
30
-
},
31
-
"validate": {
32
-
"type": "boolean",
33
-
"description": "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
34
-
},
35
-
"record": {
36
-
"type": "unknown",
37
-
"description": "The record to write."
38
-
},
39
-
"swapRecord": {
40
-
"type": "string",
41
-
"format": "cid",
42
-
"description": "Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation"
43
-
},
44
-
"swapCommit": {
45
-
"type": "string",
46
-
"format": "cid",
47
-
"description": "Compare and swap with the previous commit by CID."
48
-
}
49
-
}
50
-
}
51
-
},
52
-
"output": {
53
-
"encoding": "application/json",
54
-
"schema": {
55
-
"type": "object",
56
-
"required": ["uri", "cid"],
57
-
"properties": {
58
-
"uri": { "type": "string", "format": "at-uri" },
59
-
"cid": { "type": "string", "format": "cid" },
60
-
"commit": {
61
-
"type": "ref",
62
-
"ref": "com.atproto.repo.defs#commitMeta"
63
-
},
64
-
"validationStatus": {
65
-
"type": "string",
66
-
"knownValues": ["valid", "unknown"]
67
-
}
68
-
}
69
-
}
70
-
},
71
-
"errors": [{ "name": "InvalidSwap" }]
72
-
}
73
-
}
74
-
}
+3
-6
package.json
+3
-6
package.json
···
20
20
"scripts": {
21
21
"lint": "biome lint",
22
22
"format": "biome format --write ./src",
23
+
"lex": "lex-cli generate -c ./lex.config.js",
23
24
"test": "vitest --run",
24
-
"lex-gen": "lex gen-api ./src/leaflet/lexicons ./lexicons/pub/leaflet/* ./lexicons/pub/leaflet/*/* ./lexicons/com/atproto/*/* --yes",
25
25
"typecheck": "tsc",
26
26
"build": "rm -rf dist && tsup"
27
27
},
···
38
38
}
39
39
},
40
40
"devDependencies": {
41
-
"@atproto/lex-cli": "^0.9.1",
41
+
"@atcute/lex-cli": "^2.1.1",
42
42
"@biomejs/biome": "2.1.3",
43
43
"@types/sanitize-html": "^2.16.0",
44
44
"astro": "^5.12.8",
···
47
47
"vitest": "^3.2.4"
48
48
},
49
49
"dependencies": {
50
+
"@atcute/lexicons": "^1.1.0",
50
51
"@atproto/api": "^0.16.1",
51
52
"@atproto/did": "^0.1.5",
52
-
"@atproto/lexicon": "^0.4.12",
53
-
"@atproto/syntax": "^0.4.0",
54
-
"@atproto/xrpc": "^0.7.1",
55
-
"multiformats": "^13.4.0",
56
53
"sanitize-html": "^2.17.0"
57
54
}
58
55
}
+52
-97
pnpm-lock.yaml
+52
-97
pnpm-lock.yaml
···
8
8
9
9
.:
10
10
dependencies:
11
+
'@atcute/lexicons':
12
+
specifier: ^1.1.0
13
+
version: 1.1.0
11
14
'@atproto/api':
12
15
specifier: ^0.16.1
13
16
version: 0.16.1
14
17
'@atproto/did':
15
18
specifier: ^0.1.5
16
19
version: 0.1.5
17
-
'@atproto/lexicon':
18
-
specifier: ^0.4.12
19
-
version: 0.4.12
20
-
'@atproto/syntax':
21
-
specifier: ^0.4.0
22
-
version: 0.4.0
23
-
'@atproto/xrpc':
24
-
specifier: ^0.7.1
25
-
version: 0.7.1
26
-
multiformats:
27
-
specifier: ^13.4.0
28
-
version: 13.4.0
29
20
sanitize-html:
30
21
specifier: ^2.17.0
31
22
version: 2.17.0
32
23
devDependencies:
33
-
'@atproto/lex-cli':
34
-
specifier: ^0.9.1
35
-
version: 0.9.1
24
+
'@atcute/lex-cli':
25
+
specifier: ^2.1.1
26
+
version: 2.1.1
36
27
'@biomejs/biome':
37
28
specifier: 2.1.3
38
29
version: 2.1.3
···
71
62
resolution: {integrity: sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==}
72
63
engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0}
73
64
65
+
'@atcute/lex-cli@2.1.1':
66
+
resolution: {integrity: sha512-QaR0sOP8Z24opGHKsSfleDbP/ahUb6HECkVaOqSwG7ORZzbLK1w0265o1BRjCVr2dT6FxlsMUa2Ge85JMA9bxg==}
67
+
hasBin: true
68
+
69
+
'@atcute/lexicon-doc@1.0.3':
70
+
resolution: {integrity: sha512-U7rinsTOwXGGcrF6/s7GzTXargcQpDr4BTrj5ci/XTK+POEK5jpcI+Ag1fF932pBX3k97em6y4TWwTSO8M/McQ==}
71
+
72
+
'@atcute/lexicons@1.1.0':
73
+
resolution: {integrity: sha512-LFqwnria78xLYb62Ri/+WwQpUTgZp2DuyolNGIIOV1dpiKhFFFh//nscHMA6IExFLQRqWDs3tTjy7zv0h3sf1Q==}
74
+
74
75
'@atproto/api@0.16.1':
75
76
resolution: {integrity: sha512-w48BlTmzKym7nZETWxgiuUX/wwRXU3xsLLKORWo/xtGnwlvpchUFnHKI3k4ttYJ2/JQE59+/4C16BaLzDyiU2w==}
76
77
···
79
80
80
81
'@atproto/did@0.1.5':
81
82
resolution: {integrity: sha512-8+1D08QdGE5TF0bB0vV8HLVrVZJeLNITpRTUVEoABNMRaUS7CoYSVb0+JNQDeJIVmqMjOL8dOjvCUDkp3gEaGQ==}
82
-
83
-
'@atproto/lex-cli@0.9.1':
84
-
resolution: {integrity: sha512-ftcUZd8rElHeUJq6pTcQkURnTEe7woCF4I1NK3j5GpT/itacEZtcppabjy5o2aUsbktZsALj3ch3xm7ZZ+Zp0w==}
85
-
engines: {node: '>=18.7.0'}
86
-
hasBin: true
87
83
88
84
'@atproto/lexicon@0.4.12':
89
85
resolution: {integrity: sha512-fcEvEQ1GpQYF5igZ4IZjPWEoWVpsEF22L9RexxLS3ptfySXLflEyH384e7HITzO/73McDeaJx3lqHIuqn9ulnw==}
···
111
107
resolution: {integrity: sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==}
112
108
engines: {node: '>=6.9.0'}
113
109
110
+
'@badrap/valita@0.4.6':
111
+
resolution: {integrity: sha512-4kdqcjyxo/8RQ8ayjms47HCWZIF5981oE5nIenbfThKDxWXtEHKipAOWlflpPJzZx9y/JWYQkp18Awr7VuepFg==}
112
+
engines: {node: '>= 18'}
113
+
114
114
'@biomejs/biome@2.1.3':
115
115
resolution: {integrity: sha512-KE/tegvJIxTkl7gJbGWSgun7G6X/n2M6C35COT6ctYrAy7SiPyNvi6JtoQERVK/VRbttZfgGq96j2bFmhmnH4w==}
116
116
engines: {node: '>=14.21.3'}
···
325
325
engines: {node: '>=18'}
326
326
cpu: [x64]
327
327
os: [win32]
328
+
329
+
'@externdefs/collider@0.3.0':
330
+
resolution: {integrity: sha512-x5CpeZ4c8n+1wMFthUMWSQKqCGcQo52/Qbda5ES+JFRRg/D8Ep6/JOvUUq5HExFuv/wW+6UYG2U/mXzw0IAd8Q==}
331
+
peerDependencies:
332
+
'@badrap/valita': ^0.4.4
328
333
329
334
'@img/sharp-darwin-arm64@0.33.5':
330
335
resolution: {integrity: sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==}
···
587
592
588
593
'@swc/helpers@0.5.17':
589
594
resolution: {integrity: sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==}
590
-
591
-
'@ts-morph/common@0.25.0':
592
-
resolution: {integrity: sha512-kMnZz+vGGHi4GoHnLmMhGNjm44kGtKUXGnOvrKmMwAuvNjM/PgKVGfUnL7IDvK7Jb2QQ82jq3Zmp04Gy+r3Dkg==}
593
595
594
596
'@types/chai@5.2.2':
595
597
resolution: {integrity: sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==}
···
762
764
resolution: {integrity: sha512-5nFxhUrX0PqtyogoYOA8IPswy5sZFTOsBFl/9bNsmDLgsxYTzSZQJDPppDnZPTQbzSEm0hqGjWPzRemQCYbD6A==}
763
765
engines: {node: '>=18'}
764
766
765
-
chalk@4.1.2:
766
-
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
767
-
engines: {node: '>=10'}
768
-
769
767
chalk@5.5.0:
770
768
resolution: {integrity: sha512-1tm8DTaJhPBG3bIkVeZt1iZM9GfSX2lzOeDVZH9R9ffRHpmHvxZ/QhgQH/aDTkswQVt+YHdXAdS/In/30OjCbg==}
771
769
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
···
803
801
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
804
802
engines: {node: '>=6'}
805
803
806
-
code-block-writer@13.0.3:
807
-
resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==}
808
-
809
804
color-convert@2.0.1:
810
805
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
811
806
engines: {node: '>=7.0.0'}
···
827
822
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
828
823
engines: {node: '>= 6'}
829
824
830
-
commander@9.5.0:
831
-
resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==}
832
-
engines: {node: ^12.20.0 || >=14}
833
-
834
825
common-ancestor-path@1.0.1:
835
826
resolution: {integrity: sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==}
836
827
···
974
965
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
975
966
engines: {node: '>=12'}
976
967
968
+
esm-env@1.2.2:
969
+
resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==}
970
+
977
971
estree-walker@2.0.2:
978
972
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
979
973
···
1039
1033
1040
1034
h3@1.15.4:
1041
1035
resolution: {integrity: sha512-z5cFQWDffyOe4vQ9xIqNfCZdV4p//vy6fBnr8Q1AWnVZ0teurKMG66rLj++TKwKPUP3u7iMUvrvKaEUiQw2QWQ==}
1042
-
1043
-
has-flag@4.0.0:
1044
-
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
1045
-
engines: {node: '>=8'}
1046
1036
1047
1037
hast-util-from-html@2.0.3:
1048
1038
resolution: {integrity: sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==}
···
1325
1315
ms@2.1.3:
1326
1316
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
1327
1317
1328
-
multiformats@13.4.0:
1329
-
resolution: {integrity: sha512-Mkb/QcclrJxKC+vrcIFl297h52QcKh2Az/9A5vbWytbQt4225UWWWmIuSsKksdww9NkIeYcA7DkfftyLuC/JSg==}
1330
-
1331
1318
multiformats@9.9.0:
1332
1319
resolution: {integrity: sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==}
1333
1320
···
1410
1397
1411
1398
parse5@7.3.0:
1412
1399
resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
1413
-
1414
-
path-browserify@1.0.1:
1415
-
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
1416
1400
1417
1401
path-key@3.1.1:
1418
1402
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
···
1649
1633
engines: {node: '>=16 || 14 >=14.17'}
1650
1634
hasBin: true
1651
1635
1652
-
supports-color@7.2.0:
1653
-
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
1654
-
engines: {node: '>=8'}
1655
-
1656
1636
thenify-all@1.6.0:
1657
1637
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
1658
1638
engines: {node: '>=0.8'}
···
1707
1687
1708
1688
ts-interface-checker@0.1.13:
1709
1689
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
1710
-
1711
-
ts-morph@24.0.0:
1712
-
resolution: {integrity: sha512-2OAOg/Ob5yx9Et7ZX4CvTCc0UFoZHwLEJ+dpDPSUi5TgwwlTlX47w+iFRrEwzUZwYACjq83cgjS/Da50Ga37uw==}
1713
1690
1714
1691
tsconfck@3.1.6:
1715
1692
resolution: {integrity: sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==}
···
2047
2024
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
2048
2025
engines: {node: '>=12'}
2049
2026
2050
-
yesno@0.4.0:
2051
-
resolution: {integrity: sha512-tdBxmHvbXPBKYIg81bMCB7bVeDmHkRzk5rVJyYYXurwKkHq/MCd8rz4HSJUP7hW0H2NlXiq8IFiWvYKEHhlotA==}
2052
-
2053
2027
yocto-queue@1.2.1:
2054
2028
resolution: {integrity: sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==}
2055
2029
engines: {node: '>=12.20'}
···
2127
2101
transitivePeerDependencies:
2128
2102
- supports-color
2129
2103
2104
+
'@atcute/lex-cli@2.1.1':
2105
+
dependencies:
2106
+
'@atcute/lexicon-doc': 1.0.3
2107
+
'@badrap/valita': 0.4.6
2108
+
'@externdefs/collider': 0.3.0(@badrap/valita@0.4.6)
2109
+
picocolors: 1.1.1
2110
+
prettier: 3.6.2
2111
+
2112
+
'@atcute/lexicon-doc@1.0.3':
2113
+
dependencies:
2114
+
'@badrap/valita': 0.4.6
2115
+
2116
+
'@atcute/lexicons@1.1.0':
2117
+
dependencies:
2118
+
esm-env: 1.2.2
2119
+
2130
2120
'@atproto/api@0.16.1':
2131
2121
dependencies:
2132
2122
'@atproto/common-web': 0.4.2
···
2149
2139
dependencies:
2150
2140
zod: 3.25.76
2151
2141
2152
-
'@atproto/lex-cli@0.9.1':
2153
-
dependencies:
2154
-
'@atproto/lexicon': 0.4.12
2155
-
'@atproto/syntax': 0.4.0
2156
-
chalk: 4.1.2
2157
-
commander: 9.5.0
2158
-
prettier: 3.6.2
2159
-
ts-morph: 24.0.0
2160
-
yesno: 0.4.0
2161
-
zod: 3.25.76
2162
-
2163
2142
'@atproto/lexicon@0.4.12':
2164
2143
dependencies:
2165
2144
'@atproto/common-web': 0.4.2
···
2187
2166
dependencies:
2188
2167
'@babel/helper-string-parser': 7.27.1
2189
2168
'@babel/helper-validator-identifier': 7.27.1
2169
+
2170
+
'@badrap/valita@0.4.6': {}
2190
2171
2191
2172
'@biomejs/biome@2.1.3':
2192
2173
optionalDependencies:
···
2314
2295
'@esbuild/win32-x64@0.25.8':
2315
2296
optional: true
2316
2297
2298
+
'@externdefs/collider@0.3.0(@badrap/valita@0.4.6)':
2299
+
dependencies:
2300
+
'@badrap/valita': 0.4.6
2301
+
2317
2302
'@img/sharp-darwin-arm64@0.33.5':
2318
2303
optionalDependencies:
2319
2304
'@img/sharp-libvips-darwin-arm64': 1.0.4
···
2521
2506
'@swc/helpers@0.5.17':
2522
2507
dependencies:
2523
2508
tslib: 2.8.1
2524
-
2525
-
'@ts-morph/common@0.25.0':
2526
-
dependencies:
2527
-
minimatch: 9.0.5
2528
-
path-browserify: 1.0.1
2529
-
tinyglobby: 0.2.14
2530
2509
2531
2510
'@types/chai@5.2.2':
2532
2511
dependencies:
···
2796
2775
loupe: 3.2.0
2797
2776
pathval: 2.0.1
2798
2777
2799
-
chalk@4.1.2:
2800
-
dependencies:
2801
-
ansi-styles: 4.3.0
2802
-
supports-color: 7.2.0
2803
-
2804
2778
chalk@5.5.0: {}
2805
2779
2806
2780
character-entities-html4@2.1.0: {}
···
2823
2797
2824
2798
clsx@2.1.1: {}
2825
2799
2826
-
code-block-writer@13.0.3: {}
2827
-
2828
2800
color-convert@2.0.1:
2829
2801
dependencies:
2830
2802
color-name: 1.1.4
···
2846
2818
comma-separated-tokens@2.0.3: {}
2847
2819
2848
2820
commander@4.1.1: {}
2849
-
2850
-
commander@9.5.0: {}
2851
2821
2852
2822
common-ancestor-path@1.0.1: {}
2853
2823
···
2986
2956
2987
2957
escape-string-regexp@5.0.0: {}
2988
2958
2959
+
esm-env@1.2.2: {}
2960
+
2989
2961
estree-walker@2.0.2: {}
2990
2962
2991
2963
estree-walker@3.0.3:
···
3063
3035
radix3: 1.1.2
3064
3036
ufo: 1.6.1
3065
3037
uncrypto: 0.1.3
3066
-
3067
-
has-flag@4.0.0: {}
3068
3038
3069
3039
hast-util-from-html@2.0.3:
3070
3040
dependencies:
···
3567
3537
3568
3538
ms@2.1.3: {}
3569
3539
3570
-
multiformats@13.4.0: {}
3571
-
3572
3540
multiformats@9.9.0: {}
3573
3541
3574
3542
mz@2.7.0:
···
3644
3612
parse5@7.3.0:
3645
3613
dependencies:
3646
3614
entities: 6.0.1
3647
-
3648
-
path-browserify@1.0.1: {}
3649
3615
3650
3616
path-key@3.1.1: {}
3651
3617
···
3959
3925
pirates: 4.0.7
3960
3926
ts-interface-checker: 0.1.13
3961
3927
3962
-
supports-color@7.2.0:
3963
-
dependencies:
3964
-
has-flag: 4.0.0
3965
-
3966
3928
thenify-all@1.6.0:
3967
3929
dependencies:
3968
3930
thenify: 3.3.1
···
4003
3965
trough@2.2.0: {}
4004
3966
4005
3967
ts-interface-checker@0.1.13: {}
4006
-
4007
-
ts-morph@24.0.0:
4008
-
dependencies:
4009
-
'@ts-morph/common': 0.25.0
4010
-
code-block-writer: 13.0.3
4011
3968
4012
3969
tsconfck@3.1.6(typescript@5.9.2):
4013
3970
optionalDependencies:
···
4297
4254
xxhash-wasm@1.1.0: {}
4298
4255
4299
4256
yargs-parser@21.1.1: {}
4300
-
4301
-
yesno@0.4.0: {}
4302
4257
4303
4258
yocto-queue@1.2.1: {}
4304
4259
-283
src/leaflet/lexicons/index.ts
-283
src/leaflet/lexicons/index.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import {
5
-
XrpcClient,
6
-
type FetchHandler,
7
-
type FetchHandlerOptions,
8
-
} from '@atproto/xrpc'
9
-
import { schemas } from './lexicons.js'
10
-
import { CID } from 'multiformats/cid'
11
-
import { type OmitKey, type Un$Typed } from './util.js'
12
-
import * as PubLeafletDocument from './types/pub/leaflet/document.js'
13
-
import * as PubLeafletBlocksCode from './types/pub/leaflet/blocks/code.js'
14
-
import * as PubLeafletBlocksHeader from './types/pub/leaflet/blocks/header.js'
15
-
import * as PubLeafletBlocksImage from './types/pub/leaflet/blocks/image.js'
16
-
import * as PubLeafletBlocksMath from './types/pub/leaflet/blocks/math.js'
17
-
import * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text.js'
18
-
import * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList.js'
19
-
import * as PubLeafletBlocksWebsite from './types/pub/leaflet/blocks/website.js'
20
-
import * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument.js'
21
-
import * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet.js'
22
-
import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord.js'
23
-
import * as ComAtprotoRepoDefs from './types/com/atproto/repo/defs.js'
24
-
import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord.js'
25
-
import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord.js'
26
-
import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords.js'
27
-
import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord.js'
28
-
import * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef.js'
29
-
30
-
export * as PubLeafletDocument from './types/pub/leaflet/document.js'
31
-
export * as PubLeafletBlocksCode from './types/pub/leaflet/blocks/code.js'
32
-
export * as PubLeafletBlocksHeader from './types/pub/leaflet/blocks/header.js'
33
-
export * as PubLeafletBlocksImage from './types/pub/leaflet/blocks/image.js'
34
-
export * as PubLeafletBlocksMath from './types/pub/leaflet/blocks/math.js'
35
-
export * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text.js'
36
-
export * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList.js'
37
-
export * as PubLeafletBlocksWebsite from './types/pub/leaflet/blocks/website.js'
38
-
export * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument.js'
39
-
export * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet.js'
40
-
export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord.js'
41
-
export * as ComAtprotoRepoDefs from './types/com/atproto/repo/defs.js'
42
-
export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord.js'
43
-
export * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord.js'
44
-
export * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords.js'
45
-
export * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord.js'
46
-
export * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef.js'
47
-
48
-
export const PUB_LEAFLET_PAGES = {
49
-
LinearDocumentTextAlignLeft: 'pub.leaflet.pages.linearDocument#textAlignLeft',
50
-
LinearDocumentTextAlignCenter:
51
-
'pub.leaflet.pages.linearDocument#textAlignCenter',
52
-
LinearDocumentTextAlignRight:
53
-
'pub.leaflet.pages.linearDocument#textAlignRight',
54
-
}
55
-
56
-
export class AtpBaseClient extends XrpcClient {
57
-
pub: PubNS
58
-
com: ComNS
59
-
60
-
constructor(options: FetchHandler | FetchHandlerOptions) {
61
-
super(options, schemas)
62
-
this.pub = new PubNS(this)
63
-
this.com = new ComNS(this)
64
-
}
65
-
66
-
/** @deprecated use `this` instead */
67
-
get xrpc(): XrpcClient {
68
-
return this
69
-
}
70
-
}
71
-
72
-
export class PubNS {
73
-
_client: XrpcClient
74
-
leaflet: PubLeafletNS
75
-
76
-
constructor(client: XrpcClient) {
77
-
this._client = client
78
-
this.leaflet = new PubLeafletNS(client)
79
-
}
80
-
}
81
-
82
-
export class PubLeafletNS {
83
-
_client: XrpcClient
84
-
document: PubLeafletDocumentRecord
85
-
blocks: PubLeafletBlocksNS
86
-
pages: PubLeafletPagesNS
87
-
richtext: PubLeafletRichtextNS
88
-
89
-
constructor(client: XrpcClient) {
90
-
this._client = client
91
-
this.blocks = new PubLeafletBlocksNS(client)
92
-
this.pages = new PubLeafletPagesNS(client)
93
-
this.richtext = new PubLeafletRichtextNS(client)
94
-
this.document = new PubLeafletDocumentRecord(client)
95
-
}
96
-
}
97
-
98
-
export class PubLeafletBlocksNS {
99
-
_client: XrpcClient
100
-
101
-
constructor(client: XrpcClient) {
102
-
this._client = client
103
-
}
104
-
}
105
-
106
-
export class PubLeafletPagesNS {
107
-
_client: XrpcClient
108
-
109
-
constructor(client: XrpcClient) {
110
-
this._client = client
111
-
}
112
-
}
113
-
114
-
export class PubLeafletRichtextNS {
115
-
_client: XrpcClient
116
-
117
-
constructor(client: XrpcClient) {
118
-
this._client = client
119
-
}
120
-
}
121
-
122
-
export class PubLeafletDocumentRecord {
123
-
_client: XrpcClient
124
-
125
-
constructor(client: XrpcClient) {
126
-
this._client = client
127
-
}
128
-
129
-
async list(
130
-
params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
131
-
): Promise<{
132
-
cursor?: string
133
-
records: { uri: string; value: PubLeafletDocument.Record }[]
134
-
}> {
135
-
const res = await this._client.call('com.atproto.repo.listRecords', {
136
-
collection: 'pub.leaflet.document',
137
-
...params,
138
-
})
139
-
return res.data
140
-
}
141
-
142
-
async get(
143
-
params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
144
-
): Promise<{ uri: string; cid: string; value: PubLeafletDocument.Record }> {
145
-
const res = await this._client.call('com.atproto.repo.getRecord', {
146
-
collection: 'pub.leaflet.document',
147
-
...params,
148
-
})
149
-
return res.data
150
-
}
151
-
152
-
async create(
153
-
params: OmitKey<
154
-
ComAtprotoRepoCreateRecord.InputSchema,
155
-
'collection' | 'record'
156
-
>,
157
-
record: Un$Typed<PubLeafletDocument.Record>,
158
-
headers?: Record<string, string>,
159
-
): Promise<{ uri: string; cid: string }> {
160
-
const collection = 'pub.leaflet.document'
161
-
const res = await this._client.call(
162
-
'com.atproto.repo.createRecord',
163
-
undefined,
164
-
{ collection, ...params, record: { ...record, $type: collection } },
165
-
{ encoding: 'application/json', headers },
166
-
)
167
-
return res.data
168
-
}
169
-
170
-
async put(
171
-
params: OmitKey<
172
-
ComAtprotoRepoPutRecord.InputSchema,
173
-
'collection' | 'record'
174
-
>,
175
-
record: Un$Typed<PubLeafletDocument.Record>,
176
-
headers?: Record<string, string>,
177
-
): Promise<{ uri: string; cid: string }> {
178
-
const collection = 'pub.leaflet.document'
179
-
const res = await this._client.call(
180
-
'com.atproto.repo.putRecord',
181
-
undefined,
182
-
{ collection, ...params, record: { ...record, $type: collection } },
183
-
{ encoding: 'application/json', headers },
184
-
)
185
-
return res.data
186
-
}
187
-
188
-
async delete(
189
-
params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
190
-
headers?: Record<string, string>,
191
-
): Promise<void> {
192
-
await this._client.call(
193
-
'com.atproto.repo.deleteRecord',
194
-
undefined,
195
-
{ collection: 'pub.leaflet.document', ...params },
196
-
{ headers },
197
-
)
198
-
}
199
-
}
200
-
201
-
export class ComNS {
202
-
_client: XrpcClient
203
-
atproto: ComAtprotoNS
204
-
205
-
constructor(client: XrpcClient) {
206
-
this._client = client
207
-
this.atproto = new ComAtprotoNS(client)
208
-
}
209
-
}
210
-
211
-
export class ComAtprotoNS {
212
-
_client: XrpcClient
213
-
repo: ComAtprotoRepoNS
214
-
215
-
constructor(client: XrpcClient) {
216
-
this._client = client
217
-
this.repo = new ComAtprotoRepoNS(client)
218
-
}
219
-
}
220
-
221
-
export class ComAtprotoRepoNS {
222
-
_client: XrpcClient
223
-
224
-
constructor(client: XrpcClient) {
225
-
this._client = client
226
-
}
227
-
228
-
createRecord(
229
-
data?: ComAtprotoRepoCreateRecord.InputSchema,
230
-
opts?: ComAtprotoRepoCreateRecord.CallOptions,
231
-
): Promise<ComAtprotoRepoCreateRecord.Response> {
232
-
return this._client
233
-
.call('com.atproto.repo.createRecord', opts?.qp, data, opts)
234
-
.catch((e) => {
235
-
throw ComAtprotoRepoCreateRecord.toKnownErr(e)
236
-
})
237
-
}
238
-
239
-
deleteRecord(
240
-
data?: ComAtprotoRepoDeleteRecord.InputSchema,
241
-
opts?: ComAtprotoRepoDeleteRecord.CallOptions,
242
-
): Promise<ComAtprotoRepoDeleteRecord.Response> {
243
-
return this._client
244
-
.call('com.atproto.repo.deleteRecord', opts?.qp, data, opts)
245
-
.catch((e) => {
246
-
throw ComAtprotoRepoDeleteRecord.toKnownErr(e)
247
-
})
248
-
}
249
-
250
-
getRecord(
251
-
params?: ComAtprotoRepoGetRecord.QueryParams,
252
-
opts?: ComAtprotoRepoGetRecord.CallOptions,
253
-
): Promise<ComAtprotoRepoGetRecord.Response> {
254
-
return this._client
255
-
.call('com.atproto.repo.getRecord', params, undefined, opts)
256
-
.catch((e) => {
257
-
throw ComAtprotoRepoGetRecord.toKnownErr(e)
258
-
})
259
-
}
260
-
261
-
listRecords(
262
-
params?: ComAtprotoRepoListRecords.QueryParams,
263
-
opts?: ComAtprotoRepoListRecords.CallOptions,
264
-
): Promise<ComAtprotoRepoListRecords.Response> {
265
-
return this._client.call(
266
-
'com.atproto.repo.listRecords',
267
-
params,
268
-
undefined,
269
-
opts,
270
-
)
271
-
}
272
-
273
-
putRecord(
274
-
data?: ComAtprotoRepoPutRecord.InputSchema,
275
-
opts?: ComAtprotoRepoPutRecord.CallOptions,
276
-
): Promise<ComAtprotoRepoPutRecord.Response> {
277
-
return this._client
278
-
.call('com.atproto.repo.putRecord', opts?.qp, data, opts)
279
-
.catch((e) => {
280
-
throw ComAtprotoRepoPutRecord.toKnownErr(e)
281
-
})
282
-
}
283
-
}
-895
src/leaflet/lexicons/lexicons.ts
-895
src/leaflet/lexicons/lexicons.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import {
5
-
type LexiconDoc,
6
-
Lexicons,
7
-
ValidationError,
8
-
type ValidationResult,
9
-
} from '@atproto/lexicon'
10
-
import { type $Typed, is$typed, maybe$typed } from './util.js'
11
-
12
-
export const schemaDict = {
13
-
PubLeafletDocument: {
14
-
lexicon: 1,
15
-
id: 'pub.leaflet.document',
16
-
revision: 1,
17
-
description: 'A lexicon for long form rich media documents',
18
-
defs: {
19
-
main: {
20
-
type: 'record',
21
-
key: 'tid',
22
-
description: 'Record containing a document',
23
-
record: {
24
-
type: 'object',
25
-
required: ['pages', 'author', 'title', 'publication'],
26
-
properties: {
27
-
title: {
28
-
type: 'string',
29
-
maxLength: 1280,
30
-
maxGraphemes: 128,
31
-
},
32
-
postRef: {
33
-
type: 'ref',
34
-
ref: 'lex:com.atproto.repo.strongRef',
35
-
},
36
-
description: {
37
-
type: 'string',
38
-
maxLength: 3000,
39
-
maxGraphemes: 300,
40
-
},
41
-
publishedAt: {
42
-
type: 'string',
43
-
format: 'datetime',
44
-
},
45
-
publication: {
46
-
type: 'string',
47
-
format: 'at-uri',
48
-
},
49
-
author: {
50
-
type: 'string',
51
-
format: 'at-identifier',
52
-
},
53
-
pages: {
54
-
type: 'array',
55
-
items: {
56
-
type: 'union',
57
-
refs: ['lex:pub.leaflet.pages.linearDocument'],
58
-
},
59
-
},
60
-
},
61
-
},
62
-
},
63
-
},
64
-
},
65
-
PubLeafletBlocksCode: {
66
-
lexicon: 1,
67
-
id: 'pub.leaflet.blocks.code',
68
-
defs: {
69
-
main: {
70
-
type: 'object',
71
-
required: ['plaintext'],
72
-
properties: {
73
-
plaintext: {
74
-
type: 'string',
75
-
},
76
-
language: {
77
-
type: 'string',
78
-
},
79
-
syntaxHighlightingTheme: {
80
-
type: 'string',
81
-
},
82
-
},
83
-
},
84
-
},
85
-
},
86
-
PubLeafletBlocksHeader: {
87
-
lexicon: 1,
88
-
id: 'pub.leaflet.blocks.header',
89
-
defs: {
90
-
main: {
91
-
type: 'object',
92
-
required: ['plaintext'],
93
-
properties: {
94
-
level: {
95
-
type: 'integer',
96
-
minimum: 1,
97
-
maximum: 6,
98
-
},
99
-
plaintext: {
100
-
type: 'string',
101
-
},
102
-
facets: {
103
-
type: 'array',
104
-
items: {
105
-
type: 'ref',
106
-
ref: 'lex:pub.leaflet.richtext.facet',
107
-
},
108
-
},
109
-
},
110
-
},
111
-
},
112
-
},
113
-
PubLeafletBlocksImage: {
114
-
lexicon: 1,
115
-
id: 'pub.leaflet.blocks.image',
116
-
defs: {
117
-
main: {
118
-
type: 'object',
119
-
required: ['image', 'aspectRatio'],
120
-
properties: {
121
-
image: {
122
-
type: 'blob',
123
-
accept: ['image/*'],
124
-
maxSize: 1000000,
125
-
},
126
-
alt: {
127
-
type: 'string',
128
-
description:
129
-
'Alt text description of the image, for accessibility.',
130
-
},
131
-
aspectRatio: {
132
-
type: 'ref',
133
-
ref: 'lex:pub.leaflet.blocks.image#aspectRatio',
134
-
},
135
-
},
136
-
},
137
-
aspectRatio: {
138
-
type: 'object',
139
-
required: ['width', 'height'],
140
-
properties: {
141
-
width: {
142
-
type: 'integer',
143
-
},
144
-
height: {
145
-
type: 'integer',
146
-
},
147
-
},
148
-
},
149
-
},
150
-
},
151
-
PubLeafletBlocksMath: {
152
-
lexicon: 1,
153
-
id: 'pub.leaflet.blocks.math',
154
-
defs: {
155
-
main: {
156
-
type: 'object',
157
-
required: ['tex'],
158
-
properties: {
159
-
tex: {
160
-
type: 'string',
161
-
},
162
-
},
163
-
},
164
-
},
165
-
},
166
-
PubLeafletBlocksText: {
167
-
lexicon: 1,
168
-
id: 'pub.leaflet.blocks.text',
169
-
defs: {
170
-
main: {
171
-
type: 'object',
172
-
required: ['plaintext'],
173
-
properties: {
174
-
plaintext: {
175
-
type: 'string',
176
-
},
177
-
facets: {
178
-
type: 'array',
179
-
items: {
180
-
type: 'ref',
181
-
ref: 'lex:pub.leaflet.richtext.facet',
182
-
},
183
-
},
184
-
},
185
-
},
186
-
},
187
-
},
188
-
PubLeafletBlocksUnorderedList: {
189
-
lexicon: 1,
190
-
id: 'pub.leaflet.blocks.unorderedList',
191
-
defs: {
192
-
main: {
193
-
type: 'object',
194
-
required: ['children'],
195
-
properties: {
196
-
children: {
197
-
type: 'array',
198
-
items: {
199
-
type: 'ref',
200
-
ref: 'lex:pub.leaflet.blocks.unorderedList#listItem',
201
-
},
202
-
},
203
-
},
204
-
},
205
-
listItem: {
206
-
type: 'object',
207
-
required: ['content'],
208
-
properties: {
209
-
content: {
210
-
type: 'union',
211
-
refs: [
212
-
'lex:pub.leaflet.blocks.text',
213
-
'lex:pub.leaflet.blocks.header',
214
-
'lex:pub.leaflet.blocks.image',
215
-
],
216
-
},
217
-
children: {
218
-
type: 'array',
219
-
items: {
220
-
type: 'ref',
221
-
ref: 'lex:pub.leaflet.blocks.unorderedList#listItem',
222
-
},
223
-
},
224
-
},
225
-
},
226
-
},
227
-
},
228
-
PubLeafletBlocksWebsite: {
229
-
lexicon: 1,
230
-
id: 'pub.leaflet.blocks.website',
231
-
defs: {
232
-
main: {
233
-
type: 'object',
234
-
required: ['src'],
235
-
properties: {
236
-
previewImage: {
237
-
type: 'blob',
238
-
accept: ['image/*'],
239
-
maxSize: 1000000,
240
-
},
241
-
title: {
242
-
type: 'string',
243
-
},
244
-
description: {
245
-
type: 'string',
246
-
},
247
-
src: {
248
-
type: 'string',
249
-
format: 'uri',
250
-
},
251
-
},
252
-
},
253
-
},
254
-
},
255
-
PubLeafletPagesLinearDocument: {
256
-
lexicon: 1,
257
-
id: 'pub.leaflet.pages.linearDocument',
258
-
defs: {
259
-
main: {
260
-
type: 'object',
261
-
properties: {
262
-
blocks: {
263
-
type: 'array',
264
-
items: {
265
-
type: 'ref',
266
-
ref: 'lex:pub.leaflet.pages.linearDocument#block',
267
-
},
268
-
},
269
-
},
270
-
},
271
-
block: {
272
-
type: 'object',
273
-
required: ['block'],
274
-
properties: {
275
-
block: {
276
-
type: 'union',
277
-
refs: [
278
-
'lex:pub.leaflet.blocks.text',
279
-
'lex:pub.leaflet.blocks.header',
280
-
'lex:pub.leaflet.blocks.image',
281
-
'lex:pub.leaflet.blocks.unorderedList',
282
-
'lex:pub.leaflet.blocks.website',
283
-
'lex:pub.leaflet.blocks.math',
284
-
'lex:pub.leaflet.blocks.code',
285
-
],
286
-
},
287
-
alignment: {
288
-
type: 'string',
289
-
knownValues: [
290
-
'lex:pub.leaflet.pages.linearDocument#textAlignLeft',
291
-
'lex:pub.leaflet.pages.linearDocument#textAlignCenter',
292
-
'lex:pub.leaflet.pages.linearDocument#textAlignRight',
293
-
],
294
-
},
295
-
},
296
-
},
297
-
textAlignLeft: {
298
-
type: 'token',
299
-
},
300
-
textAlignCenter: {
301
-
type: 'token',
302
-
},
303
-
textAlignRight: {
304
-
type: 'token',
305
-
},
306
-
},
307
-
},
308
-
PubLeafletRichtextFacet: {
309
-
lexicon: 1,
310
-
id: 'pub.leaflet.richtext.facet',
311
-
defs: {
312
-
main: {
313
-
type: 'object',
314
-
description: 'Annotation of a sub-string within rich text.',
315
-
required: ['index', 'features'],
316
-
properties: {
317
-
index: {
318
-
type: 'ref',
319
-
ref: 'lex:pub.leaflet.richtext.facet#byteSlice',
320
-
},
321
-
features: {
322
-
type: 'array',
323
-
items: {
324
-
type: 'union',
325
-
refs: [
326
-
'lex:pub.leaflet.richtext.facet#link',
327
-
'lex:pub.leaflet.richtext.facet#code',
328
-
'lex:pub.leaflet.richtext.facet#highlight',
329
-
'lex:pub.leaflet.richtext.facet#underline',
330
-
'lex:pub.leaflet.richtext.facet#strikethrough',
331
-
'lex:pub.leaflet.richtext.facet#id',
332
-
'lex:pub.leaflet.richtext.facet#bold',
333
-
'lex:pub.leaflet.richtext.facet#italic',
334
-
],
335
-
},
336
-
},
337
-
},
338
-
},
339
-
byteSlice: {
340
-
type: 'object',
341
-
description:
342
-
'Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.',
343
-
required: ['byteStart', 'byteEnd'],
344
-
properties: {
345
-
byteStart: {
346
-
type: 'integer',
347
-
minimum: 0,
348
-
},
349
-
byteEnd: {
350
-
type: 'integer',
351
-
minimum: 0,
352
-
},
353
-
},
354
-
},
355
-
link: {
356
-
type: 'object',
357
-
description:
358
-
'Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.',
359
-
required: ['uri'],
360
-
properties: {
361
-
uri: {
362
-
type: 'string',
363
-
format: 'uri',
364
-
},
365
-
},
366
-
},
367
-
code: {
368
-
type: 'object',
369
-
description: 'Facet feature for inline code.',
370
-
required: [],
371
-
properties: {},
372
-
},
373
-
highlight: {
374
-
type: 'object',
375
-
description: 'Facet feature for highlighted text.',
376
-
required: [],
377
-
properties: {},
378
-
},
379
-
underline: {
380
-
type: 'object',
381
-
description: 'Facet feature for underline markup',
382
-
required: [],
383
-
properties: {},
384
-
},
385
-
strikethrough: {
386
-
type: 'object',
387
-
description: 'Facet feature for strikethrough markup',
388
-
required: [],
389
-
properties: {},
390
-
},
391
-
id: {
392
-
type: 'object',
393
-
description:
394
-
'Facet feature for an identifier. Used for linking to a segment',
395
-
required: [],
396
-
properties: {
397
-
id: {
398
-
type: 'string',
399
-
},
400
-
},
401
-
},
402
-
bold: {
403
-
type: 'object',
404
-
description: 'Facet feature for bold text',
405
-
required: [],
406
-
properties: {},
407
-
},
408
-
italic: {
409
-
type: 'object',
410
-
description: 'Facet feature for italic text',
411
-
required: [],
412
-
properties: {},
413
-
},
414
-
},
415
-
},
416
-
ComAtprotoRepoCreateRecord: {
417
-
lexicon: 1,
418
-
id: 'com.atproto.repo.createRecord',
419
-
defs: {
420
-
main: {
421
-
type: 'procedure',
422
-
description:
423
-
'Create a single new repository record. Requires auth, implemented by PDS.',
424
-
input: {
425
-
encoding: 'application/json',
426
-
schema: {
427
-
type: 'object',
428
-
required: ['repo', 'collection', 'record'],
429
-
properties: {
430
-
repo: {
431
-
type: 'string',
432
-
format: 'at-identifier',
433
-
description:
434
-
'The handle or DID of the repo (aka, current account).',
435
-
},
436
-
collection: {
437
-
type: 'string',
438
-
format: 'nsid',
439
-
description: 'The NSID of the record collection.',
440
-
},
441
-
rkey: {
442
-
type: 'string',
443
-
format: 'record-key',
444
-
description: 'The Record Key.',
445
-
maxLength: 512,
446
-
},
447
-
validate: {
448
-
type: 'boolean',
449
-
description:
450
-
"Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.",
451
-
},
452
-
record: {
453
-
type: 'unknown',
454
-
description: 'The record itself. Must contain a $type field.',
455
-
},
456
-
swapCommit: {
457
-
type: 'string',
458
-
format: 'cid',
459
-
description:
460
-
'Compare and swap with the previous commit by CID.',
461
-
},
462
-
},
463
-
},
464
-
},
465
-
output: {
466
-
encoding: 'application/json',
467
-
schema: {
468
-
type: 'object',
469
-
required: ['uri', 'cid'],
470
-
properties: {
471
-
uri: {
472
-
type: 'string',
473
-
format: 'at-uri',
474
-
},
475
-
cid: {
476
-
type: 'string',
477
-
format: 'cid',
478
-
},
479
-
commit: {
480
-
type: 'ref',
481
-
ref: 'lex:com.atproto.repo.defs#commitMeta',
482
-
},
483
-
validationStatus: {
484
-
type: 'string',
485
-
knownValues: ['valid', 'unknown'],
486
-
},
487
-
},
488
-
},
489
-
},
490
-
errors: [
491
-
{
492
-
name: 'InvalidSwap',
493
-
description:
494
-
"Indicates that 'swapCommit' didn't match current repo commit.",
495
-
},
496
-
],
497
-
},
498
-
},
499
-
},
500
-
ComAtprotoRepoDefs: {
501
-
lexicon: 1,
502
-
id: 'com.atproto.repo.defs',
503
-
defs: {
504
-
commitMeta: {
505
-
type: 'object',
506
-
required: ['cid', 'rev'],
507
-
properties: {
508
-
cid: {
509
-
type: 'string',
510
-
format: 'cid',
511
-
},
512
-
rev: {
513
-
type: 'string',
514
-
format: 'tid',
515
-
},
516
-
},
517
-
},
518
-
},
519
-
},
520
-
ComAtprotoRepoDeleteRecord: {
521
-
lexicon: 1,
522
-
id: 'com.atproto.repo.deleteRecord',
523
-
defs: {
524
-
main: {
525
-
type: 'procedure',
526
-
description:
527
-
"Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.",
528
-
input: {
529
-
encoding: 'application/json',
530
-
schema: {
531
-
type: 'object',
532
-
required: ['repo', 'collection', 'rkey'],
533
-
properties: {
534
-
repo: {
535
-
type: 'string',
536
-
format: 'at-identifier',
537
-
description:
538
-
'The handle or DID of the repo (aka, current account).',
539
-
},
540
-
collection: {
541
-
type: 'string',
542
-
format: 'nsid',
543
-
description: 'The NSID of the record collection.',
544
-
},
545
-
rkey: {
546
-
type: 'string',
547
-
format: 'record-key',
548
-
description: 'The Record Key.',
549
-
},
550
-
swapRecord: {
551
-
type: 'string',
552
-
format: 'cid',
553
-
description:
554
-
'Compare and swap with the previous record by CID.',
555
-
},
556
-
swapCommit: {
557
-
type: 'string',
558
-
format: 'cid',
559
-
description:
560
-
'Compare and swap with the previous commit by CID.',
561
-
},
562
-
},
563
-
},
564
-
},
565
-
output: {
566
-
encoding: 'application/json',
567
-
schema: {
568
-
type: 'object',
569
-
properties: {
570
-
commit: {
571
-
type: 'ref',
572
-
ref: 'lex:com.atproto.repo.defs#commitMeta',
573
-
},
574
-
},
575
-
},
576
-
},
577
-
errors: [
578
-
{
579
-
name: 'InvalidSwap',
580
-
},
581
-
],
582
-
},
583
-
},
584
-
},
585
-
ComAtprotoRepoGetRecord: {
586
-
lexicon: 1,
587
-
id: 'com.atproto.repo.getRecord',
588
-
defs: {
589
-
main: {
590
-
type: 'query',
591
-
description:
592
-
'Get a single record from a repository. Does not require auth.',
593
-
parameters: {
594
-
type: 'params',
595
-
required: ['repo', 'collection', 'rkey'],
596
-
properties: {
597
-
repo: {
598
-
type: 'string',
599
-
format: 'at-identifier',
600
-
description: 'The handle or DID of the repo.',
601
-
},
602
-
collection: {
603
-
type: 'string',
604
-
format: 'nsid',
605
-
description: 'The NSID of the record collection.',
606
-
},
607
-
rkey: {
608
-
type: 'string',
609
-
description: 'The Record Key.',
610
-
format: 'record-key',
611
-
},
612
-
cid: {
613
-
type: 'string',
614
-
format: 'cid',
615
-
description:
616
-
'The CID of the version of the record. If not specified, then return the most recent version.',
617
-
},
618
-
},
619
-
},
620
-
output: {
621
-
encoding: 'application/json',
622
-
schema: {
623
-
type: 'object',
624
-
required: ['uri', 'value'],
625
-
properties: {
626
-
uri: {
627
-
type: 'string',
628
-
format: 'at-uri',
629
-
},
630
-
cid: {
631
-
type: 'string',
632
-
format: 'cid',
633
-
},
634
-
value: {
635
-
type: 'unknown',
636
-
},
637
-
},
638
-
},
639
-
},
640
-
errors: [
641
-
{
642
-
name: 'RecordNotFound',
643
-
},
644
-
],
645
-
},
646
-
},
647
-
},
648
-
ComAtprotoRepoListRecords: {
649
-
lexicon: 1,
650
-
id: 'com.atproto.repo.listRecords',
651
-
defs: {
652
-
main: {
653
-
type: 'query',
654
-
description:
655
-
'List a range of records in a repository, matching a specific collection. Does not require auth.',
656
-
parameters: {
657
-
type: 'params',
658
-
required: ['repo', 'collection'],
659
-
properties: {
660
-
repo: {
661
-
type: 'string',
662
-
format: 'at-identifier',
663
-
description: 'The handle or DID of the repo.',
664
-
},
665
-
collection: {
666
-
type: 'string',
667
-
format: 'nsid',
668
-
description: 'The NSID of the record type.',
669
-
},
670
-
limit: {
671
-
type: 'integer',
672
-
minimum: 1,
673
-
maximum: 100,
674
-
default: 50,
675
-
description: 'The number of records to return.',
676
-
},
677
-
cursor: {
678
-
type: 'string',
679
-
},
680
-
rkeyStart: {
681
-
type: 'string',
682
-
description:
683
-
'DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)',
684
-
},
685
-
rkeyEnd: {
686
-
type: 'string',
687
-
description:
688
-
'DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)',
689
-
},
690
-
reverse: {
691
-
type: 'boolean',
692
-
description: 'Flag to reverse the order of the returned records.',
693
-
},
694
-
},
695
-
},
696
-
output: {
697
-
encoding: 'application/json',
698
-
schema: {
699
-
type: 'object',
700
-
required: ['records'],
701
-
properties: {
702
-
cursor: {
703
-
type: 'string',
704
-
},
705
-
records: {
706
-
type: 'array',
707
-
items: {
708
-
type: 'ref',
709
-
ref: 'lex:com.atproto.repo.listRecords#record',
710
-
},
711
-
},
712
-
},
713
-
},
714
-
},
715
-
},
716
-
record: {
717
-
type: 'object',
718
-
required: ['uri', 'cid', 'value'],
719
-
properties: {
720
-
uri: {
721
-
type: 'string',
722
-
format: 'at-uri',
723
-
},
724
-
cid: {
725
-
type: 'string',
726
-
format: 'cid',
727
-
},
728
-
value: {
729
-
type: 'unknown',
730
-
},
731
-
},
732
-
},
733
-
},
734
-
},
735
-
ComAtprotoRepoPutRecord: {
736
-
lexicon: 1,
737
-
id: 'com.atproto.repo.putRecord',
738
-
defs: {
739
-
main: {
740
-
type: 'procedure',
741
-
description:
742
-
'Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.',
743
-
input: {
744
-
encoding: 'application/json',
745
-
schema: {
746
-
type: 'object',
747
-
required: ['repo', 'collection', 'rkey', 'record'],
748
-
nullable: ['swapRecord'],
749
-
properties: {
750
-
repo: {
751
-
type: 'string',
752
-
format: 'at-identifier',
753
-
description:
754
-
'The handle or DID of the repo (aka, current account).',
755
-
},
756
-
collection: {
757
-
type: 'string',
758
-
format: 'nsid',
759
-
description: 'The NSID of the record collection.',
760
-
},
761
-
rkey: {
762
-
type: 'string',
763
-
format: 'record-key',
764
-
description: 'The Record Key.',
765
-
maxLength: 512,
766
-
},
767
-
validate: {
768
-
type: 'boolean',
769
-
description:
770
-
"Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.",
771
-
},
772
-
record: {
773
-
type: 'unknown',
774
-
description: 'The record to write.',
775
-
},
776
-
swapRecord: {
777
-
type: 'string',
778
-
format: 'cid',
779
-
description:
780
-
'Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation',
781
-
},
782
-
swapCommit: {
783
-
type: 'string',
784
-
format: 'cid',
785
-
description:
786
-
'Compare and swap with the previous commit by CID.',
787
-
},
788
-
},
789
-
},
790
-
},
791
-
output: {
792
-
encoding: 'application/json',
793
-
schema: {
794
-
type: 'object',
795
-
required: ['uri', 'cid'],
796
-
properties: {
797
-
uri: {
798
-
type: 'string',
799
-
format: 'at-uri',
800
-
},
801
-
cid: {
802
-
type: 'string',
803
-
format: 'cid',
804
-
},
805
-
commit: {
806
-
type: 'ref',
807
-
ref: 'lex:com.atproto.repo.defs#commitMeta',
808
-
},
809
-
validationStatus: {
810
-
type: 'string',
811
-
knownValues: ['valid', 'unknown'],
812
-
},
813
-
},
814
-
},
815
-
},
816
-
errors: [
817
-
{
818
-
name: 'InvalidSwap',
819
-
},
820
-
],
821
-
},
822
-
},
823
-
},
824
-
ComAtprotoRepoStrongRef: {
825
-
lexicon: 1,
826
-
id: 'com.atproto.repo.strongRef',
827
-
description: 'A URI with a content-hash fingerprint.',
828
-
defs: {
829
-
main: {
830
-
type: 'object',
831
-
required: ['uri', 'cid'],
832
-
properties: {
833
-
uri: {
834
-
type: 'string',
835
-
format: 'at-uri',
836
-
},
837
-
cid: {
838
-
type: 'string',
839
-
format: 'cid',
840
-
},
841
-
},
842
-
},
843
-
},
844
-
},
845
-
} as const satisfies Record<string, LexiconDoc>
846
-
export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]
847
-
export const lexicons: Lexicons = new Lexicons(schemas)
848
-
849
-
export function validate<T extends { $type: string }>(
850
-
v: unknown,
851
-
id: string,
852
-
hash: string,
853
-
requiredType: true,
854
-
): ValidationResult<T>
855
-
export function validate<T extends { $type?: string }>(
856
-
v: unknown,
857
-
id: string,
858
-
hash: string,
859
-
requiredType?: false,
860
-
): ValidationResult<T>
861
-
export function validate(
862
-
v: unknown,
863
-
id: string,
864
-
hash: string,
865
-
requiredType?: boolean,
866
-
): ValidationResult {
867
-
return (requiredType ? is$typed : maybe$typed)(v, id, hash)
868
-
? lexicons.validate(`${id}#${hash}`, v)
869
-
: {
870
-
success: false,
871
-
error: new ValidationError(
872
-
`Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`,
873
-
),
874
-
}
875
-
}
876
-
877
-
export const ids = {
878
-
PubLeafletDocument: 'pub.leaflet.document',
879
-
PubLeafletBlocksCode: 'pub.leaflet.blocks.code',
880
-
PubLeafletBlocksHeader: 'pub.leaflet.blocks.header',
881
-
PubLeafletBlocksImage: 'pub.leaflet.blocks.image',
882
-
PubLeafletBlocksMath: 'pub.leaflet.blocks.math',
883
-
PubLeafletBlocksText: 'pub.leaflet.blocks.text',
884
-
PubLeafletBlocksUnorderedList: 'pub.leaflet.blocks.unorderedList',
885
-
PubLeafletBlocksWebsite: 'pub.leaflet.blocks.website',
886
-
PubLeafletPagesLinearDocument: 'pub.leaflet.pages.linearDocument',
887
-
PubLeafletRichtextFacet: 'pub.leaflet.richtext.facet',
888
-
ComAtprotoRepoCreateRecord: 'com.atproto.repo.createRecord',
889
-
ComAtprotoRepoDefs: 'com.atproto.repo.defs',
890
-
ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord',
891
-
ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
892
-
ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords',
893
-
ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord',
894
-
ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef',
895
-
} as const
-68
src/leaflet/lexicons/types/com/atproto/repo/createRecord.ts
-68
src/leaflet/lexicons/types/com/atproto/repo/createRecord.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { HeadersMap, XRPCError } from '@atproto/xrpc'
5
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
6
-
import { CID } from 'multiformats/cid'
7
-
import { validate as _validate } from '../../../../lexicons'
8
-
import {
9
-
type $Typed,
10
-
is$typed as _is$typed,
11
-
type OmitKey,
12
-
} from '../../../../util'
13
-
import type * as ComAtprotoRepoDefs from './defs.js'
14
-
15
-
const is$typed = _is$typed,
16
-
validate = _validate
17
-
const id = 'com.atproto.repo.createRecord'
18
-
19
-
export type QueryParams = {}
20
-
21
-
export interface InputSchema {
22
-
/** The handle or DID of the repo (aka, current account). */
23
-
repo: string
24
-
/** The NSID of the record collection. */
25
-
collection: string
26
-
/** The Record Key. */
27
-
rkey?: string
28
-
/** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */
29
-
validate?: boolean
30
-
/** The record itself. Must contain a $type field. */
31
-
record: { [_ in string]: unknown }
32
-
/** Compare and swap with the previous commit by CID. */
33
-
swapCommit?: string
34
-
}
35
-
36
-
export interface OutputSchema {
37
-
uri: string
38
-
cid: string
39
-
commit?: ComAtprotoRepoDefs.CommitMeta
40
-
validationStatus?: 'valid' | 'unknown' | (string & {})
41
-
}
42
-
43
-
export interface CallOptions {
44
-
signal?: AbortSignal
45
-
headers?: HeadersMap
46
-
qp?: QueryParams
47
-
encoding?: 'application/json'
48
-
}
49
-
50
-
export interface Response {
51
-
success: boolean
52
-
headers: HeadersMap
53
-
data: OutputSchema
54
-
}
55
-
56
-
export class InvalidSwapError extends XRPCError {
57
-
constructor(src: XRPCError) {
58
-
super(src.status, src.error, src.message, src.headers, { cause: src })
59
-
}
60
-
}
61
-
62
-
export function toKnownErr(e: any) {
63
-
if (e instanceof XRPCError) {
64
-
if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
65
-
}
66
-
67
-
return e
68
-
}
-31
src/leaflet/lexicons/types/com/atproto/repo/defs.ts
-31
src/leaflet/lexicons/types/com/atproto/repo/defs.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'com.atproto.repo.defs'
16
-
17
-
export interface CommitMeta {
18
-
$type?: 'com.atproto.repo.defs#commitMeta'
19
-
cid: string
20
-
rev: string
21
-
}
22
-
23
-
const hashCommitMeta = 'commitMeta'
24
-
25
-
export function isCommitMeta<V>(v: V) {
26
-
return is$typed(v, id, hashCommitMeta)
27
-
}
28
-
29
-
export function validateCommitMeta<V>(v: V) {
30
-
return validate<CommitMeta & V>(v, id, hashCommitMeta)
31
-
}
-63
src/leaflet/lexicons/types/com/atproto/repo/deleteRecord.ts
-63
src/leaflet/lexicons/types/com/atproto/repo/deleteRecord.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { HeadersMap, XRPCError } from '@atproto/xrpc'
5
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
6
-
import { CID } from 'multiformats/cid'
7
-
import { validate as _validate } from '../../../../lexicons'
8
-
import {
9
-
type $Typed,
10
-
is$typed as _is$typed,
11
-
type OmitKey,
12
-
} from '../../../../util'
13
-
import type * as ComAtprotoRepoDefs from './defs.js'
14
-
15
-
const is$typed = _is$typed,
16
-
validate = _validate
17
-
const id = 'com.atproto.repo.deleteRecord'
18
-
19
-
export type QueryParams = {}
20
-
21
-
export interface InputSchema {
22
-
/** The handle or DID of the repo (aka, current account). */
23
-
repo: string
24
-
/** The NSID of the record collection. */
25
-
collection: string
26
-
/** The Record Key. */
27
-
rkey: string
28
-
/** Compare and swap with the previous record by CID. */
29
-
swapRecord?: string
30
-
/** Compare and swap with the previous commit by CID. */
31
-
swapCommit?: string
32
-
}
33
-
34
-
export interface OutputSchema {
35
-
commit?: ComAtprotoRepoDefs.CommitMeta
36
-
}
37
-
38
-
export interface CallOptions {
39
-
signal?: AbortSignal
40
-
headers?: HeadersMap
41
-
qp?: QueryParams
42
-
encoding?: 'application/json'
43
-
}
44
-
45
-
export interface Response {
46
-
success: boolean
47
-
headers: HeadersMap
48
-
data: OutputSchema
49
-
}
50
-
51
-
export class InvalidSwapError extends XRPCError {
52
-
constructor(src: XRPCError) {
53
-
super(src.status, src.error, src.message, src.headers, { cause: src })
54
-
}
55
-
}
56
-
57
-
export function toKnownErr(e: any) {
58
-
if (e instanceof XRPCError) {
59
-
if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
60
-
}
61
-
62
-
return e
63
-
}
-59
src/leaflet/lexicons/types/com/atproto/repo/getRecord.ts
-59
src/leaflet/lexicons/types/com/atproto/repo/getRecord.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { HeadersMap, XRPCError } from '@atproto/xrpc'
5
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
6
-
import { CID } from 'multiformats/cid'
7
-
import { validate as _validate } from '../../../../lexicons'
8
-
import {
9
-
type $Typed,
10
-
is$typed as _is$typed,
11
-
type OmitKey,
12
-
} from '../../../../util'
13
-
14
-
const is$typed = _is$typed,
15
-
validate = _validate
16
-
const id = 'com.atproto.repo.getRecord'
17
-
18
-
export type QueryParams = {
19
-
/** The handle or DID of the repo. */
20
-
repo: string
21
-
/** The NSID of the record collection. */
22
-
collection: string
23
-
/** The Record Key. */
24
-
rkey: string
25
-
/** The CID of the version of the record. If not specified, then return the most recent version. */
26
-
cid?: string
27
-
}
28
-
export type InputSchema = undefined
29
-
30
-
export interface OutputSchema {
31
-
uri: string
32
-
cid?: string
33
-
value: { [_ in string]: unknown }
34
-
}
35
-
36
-
export interface CallOptions {
37
-
signal?: AbortSignal
38
-
headers?: HeadersMap
39
-
}
40
-
41
-
export interface Response {
42
-
success: boolean
43
-
headers: HeadersMap
44
-
data: OutputSchema
45
-
}
46
-
47
-
export class RecordNotFoundError extends XRPCError {
48
-
constructor(src: XRPCError) {
49
-
super(src.status, src.error, src.message, src.headers, { cause: src })
50
-
}
51
-
}
52
-
53
-
export function toKnownErr(e: any) {
54
-
if (e instanceof XRPCError) {
55
-
if (e.error === 'RecordNotFound') return new RecordNotFoundError(e)
56
-
}
57
-
58
-
return e
59
-
}
-70
src/leaflet/lexicons/types/com/atproto/repo/listRecords.ts
-70
src/leaflet/lexicons/types/com/atproto/repo/listRecords.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { HeadersMap, XRPCError } from '@atproto/xrpc'
5
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
6
-
import { CID } from 'multiformats/cid'
7
-
import { validate as _validate } from '../../../../lexicons'
8
-
import {
9
-
type $Typed,
10
-
is$typed as _is$typed,
11
-
type OmitKey,
12
-
} from '../../../../util'
13
-
14
-
const is$typed = _is$typed,
15
-
validate = _validate
16
-
const id = 'com.atproto.repo.listRecords'
17
-
18
-
export type QueryParams = {
19
-
/** The handle or DID of the repo. */
20
-
repo: string
21
-
/** The NSID of the record type. */
22
-
collection: string
23
-
/** The number of records to return. */
24
-
limit?: number
25
-
cursor?: string
26
-
/** DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) */
27
-
rkeyStart?: string
28
-
/** DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) */
29
-
rkeyEnd?: string
30
-
/** Flag to reverse the order of the returned records. */
31
-
reverse?: boolean
32
-
}
33
-
export type InputSchema = undefined
34
-
35
-
export interface OutputSchema {
36
-
cursor?: string
37
-
records: Record[]
38
-
}
39
-
40
-
export interface CallOptions {
41
-
signal?: AbortSignal
42
-
headers?: HeadersMap
43
-
}
44
-
45
-
export interface Response {
46
-
success: boolean
47
-
headers: HeadersMap
48
-
data: OutputSchema
49
-
}
50
-
51
-
export function toKnownErr(e: any) {
52
-
return e
53
-
}
54
-
55
-
export interface Record {
56
-
$type?: 'com.atproto.repo.listRecords#record'
57
-
uri: string
58
-
cid: string
59
-
value: { [_ in string]: unknown }
60
-
}
61
-
62
-
const hashRecord = 'record'
63
-
64
-
export function isRecord<V>(v: V) {
65
-
return is$typed(v, id, hashRecord)
66
-
}
67
-
68
-
export function validateRecord<V>(v: V) {
69
-
return validate<Record & V>(v, id, hashRecord)
70
-
}
-70
src/leaflet/lexicons/types/com/atproto/repo/putRecord.ts
-70
src/leaflet/lexicons/types/com/atproto/repo/putRecord.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { HeadersMap, XRPCError } from '@atproto/xrpc'
5
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
6
-
import { CID } from 'multiformats/cid'
7
-
import { validate as _validate } from '../../../../lexicons'
8
-
import {
9
-
type $Typed,
10
-
is$typed as _is$typed,
11
-
type OmitKey,
12
-
} from '../../../../util'
13
-
import type * as ComAtprotoRepoDefs from './defs.js'
14
-
15
-
const is$typed = _is$typed,
16
-
validate = _validate
17
-
const id = 'com.atproto.repo.putRecord'
18
-
19
-
export type QueryParams = {}
20
-
21
-
export interface InputSchema {
22
-
/** The handle or DID of the repo (aka, current account). */
23
-
repo: string
24
-
/** The NSID of the record collection. */
25
-
collection: string
26
-
/** The Record Key. */
27
-
rkey: string
28
-
/** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */
29
-
validate?: boolean
30
-
/** The record to write. */
31
-
record: { [_ in string]: unknown }
32
-
/** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */
33
-
swapRecord?: string | null
34
-
/** Compare and swap with the previous commit by CID. */
35
-
swapCommit?: string
36
-
}
37
-
38
-
export interface OutputSchema {
39
-
uri: string
40
-
cid: string
41
-
commit?: ComAtprotoRepoDefs.CommitMeta
42
-
validationStatus?: 'valid' | 'unknown' | (string & {})
43
-
}
44
-
45
-
export interface CallOptions {
46
-
signal?: AbortSignal
47
-
headers?: HeadersMap
48
-
qp?: QueryParams
49
-
encoding?: 'application/json'
50
-
}
51
-
52
-
export interface Response {
53
-
success: boolean
54
-
headers: HeadersMap
55
-
data: OutputSchema
56
-
}
57
-
58
-
export class InvalidSwapError extends XRPCError {
59
-
constructor(src: XRPCError) {
60
-
super(src.status, src.error, src.message, src.headers, { cause: src })
61
-
}
62
-
}
63
-
64
-
export function toKnownErr(e: any) {
65
-
if (e instanceof XRPCError) {
66
-
if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
67
-
}
68
-
69
-
return e
70
-
}
-31
src/leaflet/lexicons/types/com/atproto/repo/strongRef.ts
-31
src/leaflet/lexicons/types/com/atproto/repo/strongRef.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'com.atproto.repo.strongRef'
16
-
17
-
export interface Main {
18
-
$type?: 'com.atproto.repo.strongRef'
19
-
uri: string
20
-
cid: string
21
-
}
22
-
23
-
const hashMain = 'main'
24
-
25
-
export function isMain<V>(v: V) {
26
-
return is$typed(v, id, hashMain)
27
-
}
28
-
29
-
export function validateMain<V>(v: V) {
30
-
return validate<Main & V>(v, id, hashMain)
31
-
}
-32
src/leaflet/lexicons/types/pub/leaflet/blocks/code.ts
-32
src/leaflet/lexicons/types/pub/leaflet/blocks/code.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'pub.leaflet.blocks.code'
16
-
17
-
export interface Main {
18
-
$type?: 'pub.leaflet.blocks.code'
19
-
plaintext: string
20
-
language?: string
21
-
syntaxHighlightingTheme?: string
22
-
}
23
-
24
-
const hashMain = 'main'
25
-
26
-
export function isMain<V>(v: V) {
27
-
return is$typed(v, id, hashMain)
28
-
}
29
-
30
-
export function validateMain<V>(v: V) {
31
-
return validate<Main & V>(v, id, hashMain)
32
-
}
-33
src/leaflet/lexicons/types/pub/leaflet/blocks/header.ts
-33
src/leaflet/lexicons/types/pub/leaflet/blocks/header.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
import type * as PubLeafletRichtextFacet from '../richtext/facet.js'
13
-
14
-
const is$typed = _is$typed,
15
-
validate = _validate
16
-
const id = 'pub.leaflet.blocks.header'
17
-
18
-
export interface Main {
19
-
$type?: 'pub.leaflet.blocks.header'
20
-
level?: number
21
-
plaintext: string
22
-
facets?: PubLeafletRichtextFacet.Main[]
23
-
}
24
-
25
-
const hashMain = 'main'
26
-
27
-
export function isMain<V>(v: V) {
28
-
return is$typed(v, id, hashMain)
29
-
}
30
-
31
-
export function validateMain<V>(v: V) {
32
-
return validate<Main & V>(v, id, hashMain)
33
-
}
-49
src/leaflet/lexicons/types/pub/leaflet/blocks/image.ts
-49
src/leaflet/lexicons/types/pub/leaflet/blocks/image.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'pub.leaflet.blocks.image'
16
-
17
-
export interface Main {
18
-
$type?: 'pub.leaflet.blocks.image'
19
-
image: BlobRef
20
-
/** Alt text description of the image, for accessibility. */
21
-
alt?: string
22
-
aspectRatio: AspectRatio
23
-
}
24
-
25
-
const hashMain = 'main'
26
-
27
-
export function isMain<V>(v: V) {
28
-
return is$typed(v, id, hashMain)
29
-
}
30
-
31
-
export function validateMain<V>(v: V) {
32
-
return validate<Main & V>(v, id, hashMain)
33
-
}
34
-
35
-
export interface AspectRatio {
36
-
$type?: 'pub.leaflet.blocks.image#aspectRatio'
37
-
width: number
38
-
height: number
39
-
}
40
-
41
-
const hashAspectRatio = 'aspectRatio'
42
-
43
-
export function isAspectRatio<V>(v: V) {
44
-
return is$typed(v, id, hashAspectRatio)
45
-
}
46
-
47
-
export function validateAspectRatio<V>(v: V) {
48
-
return validate<AspectRatio & V>(v, id, hashAspectRatio)
49
-
}
-30
src/leaflet/lexicons/types/pub/leaflet/blocks/math.ts
-30
src/leaflet/lexicons/types/pub/leaflet/blocks/math.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'pub.leaflet.blocks.math'
16
-
17
-
export interface Main {
18
-
$type?: 'pub.leaflet.blocks.math'
19
-
tex: string
20
-
}
21
-
22
-
const hashMain = 'main'
23
-
24
-
export function isMain<V>(v: V) {
25
-
return is$typed(v, id, hashMain)
26
-
}
27
-
28
-
export function validateMain<V>(v: V) {
29
-
return validate<Main & V>(v, id, hashMain)
30
-
}
-32
src/leaflet/lexicons/types/pub/leaflet/blocks/text.ts
-32
src/leaflet/lexicons/types/pub/leaflet/blocks/text.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
import type * as PubLeafletRichtextFacet from '../richtext/facet.js'
13
-
14
-
const is$typed = _is$typed,
15
-
validate = _validate
16
-
const id = 'pub.leaflet.blocks.text'
17
-
18
-
export interface Main {
19
-
$type?: 'pub.leaflet.blocks.text'
20
-
plaintext: string
21
-
facets?: PubLeafletRichtextFacet.Main[]
22
-
}
23
-
24
-
const hashMain = 'main'
25
-
26
-
export function isMain<V>(v: V) {
27
-
return is$typed(v, id, hashMain)
28
-
}
29
-
30
-
export function validateMain<V>(v: V) {
31
-
return validate<Main & V>(v, id, hashMain)
32
-
}
-53
src/leaflet/lexicons/types/pub/leaflet/blocks/unorderedList.ts
-53
src/leaflet/lexicons/types/pub/leaflet/blocks/unorderedList.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
import type * as PubLeafletBlocksText from './text.js'
13
-
import type * as PubLeafletBlocksHeader from './header.js'
14
-
import type * as PubLeafletBlocksImage from './image.js'
15
-
16
-
const is$typed = _is$typed,
17
-
validate = _validate
18
-
const id = 'pub.leaflet.blocks.unorderedList'
19
-
20
-
export interface Main {
21
-
$type?: 'pub.leaflet.blocks.unorderedList'
22
-
children: ListItem[]
23
-
}
24
-
25
-
const hashMain = 'main'
26
-
27
-
export function isMain<V>(v: V) {
28
-
return is$typed(v, id, hashMain)
29
-
}
30
-
31
-
export function validateMain<V>(v: V) {
32
-
return validate<Main & V>(v, id, hashMain)
33
-
}
34
-
35
-
export interface ListItem {
36
-
$type?: 'pub.leaflet.blocks.unorderedList#listItem'
37
-
content:
38
-
| $Typed<PubLeafletBlocksText.Main>
39
-
| $Typed<PubLeafletBlocksHeader.Main>
40
-
| $Typed<PubLeafletBlocksImage.Main>
41
-
| { $type: string }
42
-
children?: ListItem[]
43
-
}
44
-
45
-
const hashListItem = 'listItem'
46
-
47
-
export function isListItem<V>(v: V) {
48
-
return is$typed(v, id, hashListItem)
49
-
}
50
-
51
-
export function validateListItem<V>(v: V) {
52
-
return validate<ListItem & V>(v, id, hashListItem)
53
-
}
-33
src/leaflet/lexicons/types/pub/leaflet/blocks/website.ts
-33
src/leaflet/lexicons/types/pub/leaflet/blocks/website.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'pub.leaflet.blocks.website'
16
-
17
-
export interface Main {
18
-
$type?: 'pub.leaflet.blocks.website'
19
-
previewImage?: BlobRef
20
-
title?: string
21
-
description?: string
22
-
src: string
23
-
}
24
-
25
-
const hashMain = 'main'
26
-
27
-
export function isMain<V>(v: V) {
28
-
return is$typed(v, id, hashMain)
29
-
}
30
-
31
-
export function validateMain<V>(v: V) {
32
-
return validate<Main & V>(v, id, hashMain)
33
-
}
-35
src/leaflet/lexicons/types/pub/leaflet/document.ts
-35
src/leaflet/lexicons/types/pub/leaflet/document.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../lexicons'
7
-
import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
8
-
import type * as ComAtprotoRepoStrongRef from '../../com/atproto/repo/strongRef.js'
9
-
import type * as PubLeafletPagesLinearDocument from './pages/linearDocument.js'
10
-
11
-
const is$typed = _is$typed,
12
-
validate = _validate
13
-
const id = 'pub.leaflet.document'
14
-
15
-
export interface Record {
16
-
$type: 'pub.leaflet.document'
17
-
title: string
18
-
postRef?: ComAtprotoRepoStrongRef.Main
19
-
description?: string
20
-
publishedAt?: string
21
-
publication: string
22
-
author: string
23
-
pages: ($Typed<PubLeafletPagesLinearDocument.Main> | { $type: string })[]
24
-
[k: string]: unknown
25
-
}
26
-
27
-
const hashRecord = 'main'
28
-
29
-
export function isRecord<V>(v: V) {
30
-
return is$typed(v, id, hashRecord)
31
-
}
32
-
33
-
export function validateRecord<V>(v: V) {
34
-
return validate<Record & V>(v, id, hashRecord, true)
35
-
}
-69
src/leaflet/lexicons/types/pub/leaflet/pages/linearDocument.ts
-69
src/leaflet/lexicons/types/pub/leaflet/pages/linearDocument.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
import type * as PubLeafletBlocksText from '../blocks/text.js'
13
-
import type * as PubLeafletBlocksHeader from '../blocks/header.js'
14
-
import type * as PubLeafletBlocksImage from '../blocks/image.js'
15
-
import type * as PubLeafletBlocksUnorderedList from '../blocks/unorderedList.js'
16
-
import type * as PubLeafletBlocksWebsite from '../blocks/website.js'
17
-
import type * as PubLeafletBlocksMath from '../blocks/math.js'
18
-
import type * as PubLeafletBlocksCode from '../blocks/code.js'
19
-
20
-
const is$typed = _is$typed,
21
-
validate = _validate
22
-
const id = 'pub.leaflet.pages.linearDocument'
23
-
24
-
export interface Main {
25
-
$type?: 'pub.leaflet.pages.linearDocument'
26
-
blocks?: Block[]
27
-
}
28
-
29
-
const hashMain = 'main'
30
-
31
-
export function isMain<V>(v: V) {
32
-
return is$typed(v, id, hashMain)
33
-
}
34
-
35
-
export function validateMain<V>(v: V) {
36
-
return validate<Main & V>(v, id, hashMain)
37
-
}
38
-
39
-
export interface Block {
40
-
$type?: 'pub.leaflet.pages.linearDocument#block'
41
-
block:
42
-
| $Typed<PubLeafletBlocksText.Main>
43
-
| $Typed<PubLeafletBlocksHeader.Main>
44
-
| $Typed<PubLeafletBlocksImage.Main>
45
-
| $Typed<PubLeafletBlocksUnorderedList.Main>
46
-
| $Typed<PubLeafletBlocksWebsite.Main>
47
-
| $Typed<PubLeafletBlocksMath.Main>
48
-
| $Typed<PubLeafletBlocksCode.Main>
49
-
| { $type: string }
50
-
alignment?:
51
-
| 'lex:pub.leaflet.pages.linearDocument#textAlignLeft'
52
-
| 'lex:pub.leaflet.pages.linearDocument#textAlignCenter'
53
-
| 'lex:pub.leaflet.pages.linearDocument#textAlignRight'
54
-
| (string & {})
55
-
}
56
-
57
-
const hashBlock = 'block'
58
-
59
-
export function isBlock<V>(v: V) {
60
-
return is$typed(v, id, hashBlock)
61
-
}
62
-
63
-
export function validateBlock<V>(v: V) {
64
-
return validate<Block & V>(v, id, hashBlock)
65
-
}
66
-
67
-
export const TEXTALIGNLEFT = `${id}#textAlignLeft`
68
-
export const TEXTALIGNCENTER = `${id}#textAlignCenter`
69
-
export const TEXTALIGNRIGHT = `${id}#textAlignRight`
-181
src/leaflet/lexicons/types/pub/leaflet/richtext/facet.ts
-181
src/leaflet/lexicons/types/pub/leaflet/richtext/facet.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
-
import { CID } from 'multiformats/cid'
6
-
import { validate as _validate } from '../../../../lexicons'
7
-
import {
8
-
type $Typed,
9
-
is$typed as _is$typed,
10
-
type OmitKey,
11
-
} from '../../../../util'
12
-
13
-
const is$typed = _is$typed,
14
-
validate = _validate
15
-
const id = 'pub.leaflet.richtext.facet'
16
-
17
-
/** Annotation of a sub-string within rich text. */
18
-
export interface Main {
19
-
$type?: 'pub.leaflet.richtext.facet'
20
-
index: ByteSlice
21
-
features: (
22
-
| $Typed<Link>
23
-
| $Typed<Code>
24
-
| $Typed<Highlight>
25
-
| $Typed<Underline>
26
-
| $Typed<Strikethrough>
27
-
| $Typed<Id>
28
-
| $Typed<Bold>
29
-
| $Typed<Italic>
30
-
| { $type: string }
31
-
)[]
32
-
}
33
-
34
-
const hashMain = 'main'
35
-
36
-
export function isMain<V>(v: V) {
37
-
return is$typed(v, id, hashMain)
38
-
}
39
-
40
-
export function validateMain<V>(v: V) {
41
-
return validate<Main & V>(v, id, hashMain)
42
-
}
43
-
44
-
/** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */
45
-
export interface ByteSlice {
46
-
$type?: 'pub.leaflet.richtext.facet#byteSlice'
47
-
byteStart: number
48
-
byteEnd: number
49
-
}
50
-
51
-
const hashByteSlice = 'byteSlice'
52
-
53
-
export function isByteSlice<V>(v: V) {
54
-
return is$typed(v, id, hashByteSlice)
55
-
}
56
-
57
-
export function validateByteSlice<V>(v: V) {
58
-
return validate<ByteSlice & V>(v, id, hashByteSlice)
59
-
}
60
-
61
-
/** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */
62
-
export interface Link {
63
-
$type?: 'pub.leaflet.richtext.facet#link'
64
-
uri: string
65
-
}
66
-
67
-
const hashLink = 'link'
68
-
69
-
export function isLink<V>(v: V) {
70
-
return is$typed(v, id, hashLink)
71
-
}
72
-
73
-
export function validateLink<V>(v: V) {
74
-
return validate<Link & V>(v, id, hashLink)
75
-
}
76
-
77
-
/** Facet feature for inline code. */
78
-
export interface Code {
79
-
$type?: 'pub.leaflet.richtext.facet#code'
80
-
}
81
-
82
-
const hashCode = 'code'
83
-
84
-
export function isCode<V>(v: V) {
85
-
return is$typed(v, id, hashCode)
86
-
}
87
-
88
-
export function validateCode<V>(v: V) {
89
-
return validate<Code & V>(v, id, hashCode)
90
-
}
91
-
92
-
/** Facet feature for highlighted text. */
93
-
export interface Highlight {
94
-
$type?: 'pub.leaflet.richtext.facet#highlight'
95
-
}
96
-
97
-
const hashHighlight = 'highlight'
98
-
99
-
export function isHighlight<V>(v: V) {
100
-
return is$typed(v, id, hashHighlight)
101
-
}
102
-
103
-
export function validateHighlight<V>(v: V) {
104
-
return validate<Highlight & V>(v, id, hashHighlight)
105
-
}
106
-
107
-
/** Facet feature for underline markup */
108
-
export interface Underline {
109
-
$type?: 'pub.leaflet.richtext.facet#underline'
110
-
}
111
-
112
-
const hashUnderline = 'underline'
113
-
114
-
export function isUnderline<V>(v: V) {
115
-
return is$typed(v, id, hashUnderline)
116
-
}
117
-
118
-
export function validateUnderline<V>(v: V) {
119
-
return validate<Underline & V>(v, id, hashUnderline)
120
-
}
121
-
122
-
/** Facet feature for strikethrough markup */
123
-
export interface Strikethrough {
124
-
$type?: 'pub.leaflet.richtext.facet#strikethrough'
125
-
}
126
-
127
-
const hashStrikethrough = 'strikethrough'
128
-
129
-
export function isStrikethrough<V>(v: V) {
130
-
return is$typed(v, id, hashStrikethrough)
131
-
}
132
-
133
-
export function validateStrikethrough<V>(v: V) {
134
-
return validate<Strikethrough & V>(v, id, hashStrikethrough)
135
-
}
136
-
137
-
/** Facet feature for an identifier. Used for linking to a segment */
138
-
export interface Id {
139
-
$type?: 'pub.leaflet.richtext.facet#id'
140
-
id?: string
141
-
}
142
-
143
-
const hashId = 'id'
144
-
145
-
export function isId<V>(v: V) {
146
-
return is$typed(v, id, hashId)
147
-
}
148
-
149
-
export function validateId<V>(v: V) {
150
-
return validate<Id & V>(v, id, hashId)
151
-
}
152
-
153
-
/** Facet feature for bold text */
154
-
export interface Bold {
155
-
$type?: 'pub.leaflet.richtext.facet#bold'
156
-
}
157
-
158
-
const hashBold = 'bold'
159
-
160
-
export function isBold<V>(v: V) {
161
-
return is$typed(v, id, hashBold)
162
-
}
163
-
164
-
export function validateBold<V>(v: V) {
165
-
return validate<Bold & V>(v, id, hashBold)
166
-
}
167
-
168
-
/** Facet feature for italic text */
169
-
export interface Italic {
170
-
$type?: 'pub.leaflet.richtext.facet#italic'
171
-
}
172
-
173
-
const hashItalic = 'italic'
174
-
175
-
export function isItalic<V>(v: V) {
176
-
return is$typed(v, id, hashItalic)
177
-
}
178
-
179
-
export function validateItalic<V>(v: V) {
180
-
return validate<Italic & V>(v, id, hashItalic)
181
-
}
-82
src/leaflet/lexicons/util.ts
-82
src/leaflet/lexicons/util.ts
···
1
-
/**
2
-
* GENERATED CODE - DO NOT MODIFY
3
-
*/
4
-
5
-
import { type ValidationResult } from '@atproto/lexicon'
6
-
7
-
export type OmitKey<T, K extends keyof T> = {
8
-
[K2 in keyof T as K2 extends K ? never : K2]: T[K2]
9
-
}
10
-
11
-
export type $Typed<V, T extends string = string> = V & { $type: T }
12
-
export type Un$Typed<V extends { $type?: string }> = OmitKey<V, '$type'>
13
-
14
-
export type $Type<Id extends string, Hash extends string> = Hash extends 'main'
15
-
? Id
16
-
: `${Id}#${Hash}`
17
-
18
-
function isObject<V>(v: V): v is V & object {
19
-
return v != null && typeof v === 'object'
20
-
}
21
-
22
-
function is$type<Id extends string, Hash extends string>(
23
-
$type: unknown,
24
-
id: Id,
25
-
hash: Hash,
26
-
): $type is $Type<Id, Hash> {
27
-
return hash === 'main'
28
-
? $type === id
29
-
: // $type === `${id}#${hash}`
30
-
typeof $type === 'string' &&
31
-
$type.length === id.length + 1 + hash.length &&
32
-
$type.charCodeAt(id.length) === 35 /* '#' */ &&
33
-
$type.startsWith(id) &&
34
-
$type.endsWith(hash)
35
-
}
36
-
37
-
export type $TypedObject<
38
-
V,
39
-
Id extends string,
40
-
Hash extends string,
41
-
> = V extends {
42
-
$type: $Type<Id, Hash>
43
-
}
44
-
? V
45
-
: V extends { $type?: string }
46
-
? V extends { $type?: infer T extends $Type<Id, Hash> }
47
-
? V & { $type: T }
48
-
: never
49
-
: V & { $type: $Type<Id, Hash> }
50
-
51
-
export function is$typed<V, Id extends string, Hash extends string>(
52
-
v: V,
53
-
id: Id,
54
-
hash: Hash,
55
-
): v is $TypedObject<V, Id, Hash> {
56
-
return isObject(v) && '$type' in v && is$type(v.$type, id, hash)
57
-
}
58
-
59
-
export function maybe$typed<V, Id extends string, Hash extends string>(
60
-
v: V,
61
-
id: Id,
62
-
hash: Hash,
63
-
): v is V & object & { $type?: $Type<Id, Hash> } {
64
-
return (
65
-
isObject(v) &&
66
-
('$type' in v ? v.$type === undefined || is$type(v.$type, id, hash) : true)
67
-
)
68
-
}
69
-
70
-
export type Validator<R = unknown> = (v: unknown) => ValidationResult<R>
71
-
export type ValidatorParam<V extends Validator> =
72
-
V extends Validator<infer R> ? R : never
73
-
74
-
/**
75
-
* Utility function that allows to convert a "validate*" utility function into a
76
-
* type predicate.
77
-
*/
78
-
export function asPredicate<V extends Validator>(validate: V) {
79
-
return function <T>(v: T): v is T & ValidatorParam<V> {
80
-
return validate(v).success
81
-
}
82
-
}
+11
src/lexicons/index.ts
+11
src/lexicons/index.ts
···
1
+
export * as ComAtprotoRepoStrongRef from "./types/com/atproto/repo/strongRef.js";
2
+
export * as PubLeafletBlocksCode from "./types/pub/leaflet/blocks/code.js";
3
+
export * as PubLeafletBlocksHeader from "./types/pub/leaflet/blocks/header.js";
4
+
export * as PubLeafletBlocksImage from "./types/pub/leaflet/blocks/image.js";
5
+
export * as PubLeafletBlocksMath from "./types/pub/leaflet/blocks/math.js";
6
+
export * as PubLeafletBlocksText from "./types/pub/leaflet/blocks/text.js";
7
+
export * as PubLeafletBlocksUnorderedList from "./types/pub/leaflet/blocks/unorderedList.js";
8
+
export * as PubLeafletBlocksWebsite from "./types/pub/leaflet/blocks/website.js";
9
+
export * as PubLeafletDocument from "./types/pub/leaflet/document.js";
10
+
export * as PubLeafletPagesLinearDocument from "./types/pub/leaflet/pages/linearDocument.js";
11
+
export * as PubLeafletRichtextFacet from "./types/pub/leaflet/richtext/facet.js";
+18
src/lexicons/types/com/atproto/repo/strongRef.ts
+18
src/lexicons/types/com/atproto/repo/strongRef.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
4
+
const _mainSchema = /*#__PURE__*/ v.object({
5
+
$type: /*#__PURE__*/ v.optional(
6
+
/*#__PURE__*/ v.literal("com.atproto.repo.strongRef"),
7
+
),
8
+
cid: /*#__PURE__*/ v.cidString(),
9
+
uri: /*#__PURE__*/ v.resourceUriString(),
10
+
});
11
+
12
+
type main$schematype = typeof _mainSchema;
13
+
14
+
export interface mainSchema extends main$schematype {}
15
+
16
+
export const mainSchema = _mainSchema as mainSchema;
17
+
18
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+19
src/lexicons/types/pub/leaflet/blocks/code.ts
+19
src/lexicons/types/pub/leaflet/blocks/code.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
4
+
const _mainSchema = /*#__PURE__*/ v.object({
5
+
$type: /*#__PURE__*/ v.optional(
6
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.code"),
7
+
),
8
+
language: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
9
+
plaintext: /*#__PURE__*/ v.string(),
10
+
syntaxHighlightingTheme: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
11
+
});
12
+
13
+
type main$schematype = typeof _mainSchema;
14
+
15
+
export interface mainSchema extends main$schematype {}
16
+
17
+
export const mainSchema = _mainSchema as mainSchema;
18
+
19
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+28
src/lexicons/types/pub/leaflet/blocks/header.ts
+28
src/lexicons/types/pub/leaflet/blocks/header.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
import * as PubLeafletRichtextFacet from "../richtext/facet.js";
4
+
5
+
const _mainSchema = /*#__PURE__*/ v.object({
6
+
$type: /*#__PURE__*/ v.optional(
7
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.header"),
8
+
),
9
+
get facets() {
10
+
return /*#__PURE__*/ v.optional(
11
+
/*#__PURE__*/ v.array(PubLeafletRichtextFacet.mainSchema),
12
+
);
13
+
},
14
+
level: /*#__PURE__*/ v.optional(
15
+
/*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [
16
+
/*#__PURE__*/ v.integerRange(1, 6),
17
+
]),
18
+
),
19
+
plaintext: /*#__PURE__*/ v.string(),
20
+
});
21
+
22
+
type main$schematype = typeof _mainSchema;
23
+
24
+
export interface mainSchema extends main$schematype {}
25
+
26
+
export const mainSchema = _mainSchema as mainSchema;
27
+
28
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+32
src/lexicons/types/pub/leaflet/blocks/image.ts
+32
src/lexicons/types/pub/leaflet/blocks/image.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
4
+
const _aspectRatioSchema = /*#__PURE__*/ v.object({
5
+
$type: /*#__PURE__*/ v.optional(
6
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.image#aspectRatio"),
7
+
),
8
+
height: /*#__PURE__*/ v.integer(),
9
+
width: /*#__PURE__*/ v.integer(),
10
+
});
11
+
const _mainSchema = /*#__PURE__*/ v.object({
12
+
$type: /*#__PURE__*/ v.optional(
13
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.image"),
14
+
),
15
+
alt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
16
+
get aspectRatio() {
17
+
return aspectRatioSchema;
18
+
},
19
+
image: /*#__PURE__*/ v.blob(),
20
+
});
21
+
22
+
type aspectRatio$schematype = typeof _aspectRatioSchema;
23
+
type main$schematype = typeof _mainSchema;
24
+
25
+
export interface aspectRatioSchema extends aspectRatio$schematype {}
26
+
export interface mainSchema extends main$schematype {}
27
+
28
+
export const aspectRatioSchema = _aspectRatioSchema as aspectRatioSchema;
29
+
export const mainSchema = _mainSchema as mainSchema;
30
+
31
+
export interface AspectRatio extends v.InferInput<typeof aspectRatioSchema> {}
32
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+17
src/lexicons/types/pub/leaflet/blocks/math.ts
+17
src/lexicons/types/pub/leaflet/blocks/math.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
4
+
const _mainSchema = /*#__PURE__*/ v.object({
5
+
$type: /*#__PURE__*/ v.optional(
6
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.math"),
7
+
),
8
+
tex: /*#__PURE__*/ v.string(),
9
+
});
10
+
11
+
type main$schematype = typeof _mainSchema;
12
+
13
+
export interface mainSchema extends main$schematype {}
14
+
15
+
export const mainSchema = _mainSchema as mainSchema;
16
+
17
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+23
src/lexicons/types/pub/leaflet/blocks/text.ts
+23
src/lexicons/types/pub/leaflet/blocks/text.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
import * as PubLeafletRichtextFacet from "../richtext/facet.js";
4
+
5
+
const _mainSchema = /*#__PURE__*/ v.object({
6
+
$type: /*#__PURE__*/ v.optional(
7
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.text"),
8
+
),
9
+
get facets() {
10
+
return /*#__PURE__*/ v.optional(
11
+
/*#__PURE__*/ v.array(PubLeafletRichtextFacet.mainSchema),
12
+
);
13
+
},
14
+
plaintext: /*#__PURE__*/ v.string(),
15
+
});
16
+
17
+
type main$schematype = typeof _mainSchema;
18
+
19
+
export interface mainSchema extends main$schematype {}
20
+
21
+
export const mainSchema = _mainSchema as mainSchema;
22
+
23
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+41
src/lexicons/types/pub/leaflet/blocks/unorderedList.ts
+41
src/lexicons/types/pub/leaflet/blocks/unorderedList.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
import * as PubLeafletBlocksHeader from "./header.js";
4
+
import * as PubLeafletBlocksImage from "./image.js";
5
+
import * as PubLeafletBlocksText from "./text.js";
6
+
7
+
const _listItemSchema = /*#__PURE__*/ v.object({
8
+
$type: /*#__PURE__*/ v.optional(
9
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.unorderedList#listItem"),
10
+
),
11
+
get children() {
12
+
return /*#__PURE__*/ v.optional(/*#__PURE__*/ v.array(listItemSchema));
13
+
},
14
+
get content() {
15
+
return /*#__PURE__*/ v.variant([
16
+
PubLeafletBlocksHeader.mainSchema,
17
+
PubLeafletBlocksImage.mainSchema,
18
+
PubLeafletBlocksText.mainSchema,
19
+
]);
20
+
},
21
+
});
22
+
const _mainSchema = /*#__PURE__*/ v.object({
23
+
$type: /*#__PURE__*/ v.optional(
24
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.unorderedList"),
25
+
),
26
+
get children() {
27
+
return /*#__PURE__*/ v.array(listItemSchema);
28
+
},
29
+
});
30
+
31
+
type listItem$schematype = typeof _listItemSchema;
32
+
type main$schematype = typeof _mainSchema;
33
+
34
+
export interface listItemSchema extends listItem$schematype {}
35
+
export interface mainSchema extends main$schematype {}
36
+
37
+
export const listItemSchema = _listItemSchema as listItemSchema;
38
+
export const mainSchema = _mainSchema as mainSchema;
39
+
40
+
export interface ListItem extends v.InferInput<typeof listItemSchema> {}
41
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+20
src/lexicons/types/pub/leaflet/blocks/website.ts
+20
src/lexicons/types/pub/leaflet/blocks/website.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
4
+
const _mainSchema = /*#__PURE__*/ v.object({
5
+
$type: /*#__PURE__*/ v.optional(
6
+
/*#__PURE__*/ v.literal("pub.leaflet.blocks.website"),
7
+
),
8
+
description: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
9
+
previewImage: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.blob()),
10
+
src: /*#__PURE__*/ v.genericUriString(),
11
+
title: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
12
+
});
13
+
14
+
type main$schematype = typeof _mainSchema;
15
+
16
+
export interface mainSchema extends main$schematype {}
17
+
18
+
export const mainSchema = _mainSchema as mainSchema;
19
+
20
+
export interface Main extends v.InferInput<typeof mainSchema> {}
+47
src/lexicons/types/pub/leaflet/document.ts
+47
src/lexicons/types/pub/leaflet/document.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
import type {} from "@atcute/lexicons/ambient";
4
+
import * as ComAtprotoRepoStrongRef from "../../com/atproto/repo/strongRef.js";
5
+
import * as PubLeafletPagesLinearDocument from "./pages/linearDocument.js";
6
+
7
+
const _mainSchema = /*#__PURE__*/ v.record(
8
+
/*#__PURE__*/ v.tidString(),
9
+
/*#__PURE__*/ v.object({
10
+
$type: /*#__PURE__*/ v.literal("pub.leaflet.document"),
11
+
author: /*#__PURE__*/ v.actorIdentifierString(),
12
+
description: /*#__PURE__*/ v.optional(
13
+
/*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [
14
+
/*#__PURE__*/ v.stringLength(0, 3000),
15
+
/*#__PURE__*/ v.stringGraphemes(0, 300),
16
+
]),
17
+
),
18
+
get pages() {
19
+
return /*#__PURE__*/ v.array(
20
+
/*#__PURE__*/ v.variant([PubLeafletPagesLinearDocument.mainSchema]),
21
+
);
22
+
},
23
+
get postRef() {
24
+
return /*#__PURE__*/ v.optional(ComAtprotoRepoStrongRef.mainSchema);
25
+
},
26
+
publication: /*#__PURE__*/ v.resourceUriString(),
27
+
publishedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()),
28
+
title: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [
29
+
/*#__PURE__*/ v.stringLength(0, 1280),
30
+
/*#__PURE__*/ v.stringGraphemes(0, 128),
31
+
]),
32
+
}),
33
+
);
34
+
35
+
type main$schematype = typeof _mainSchema;
36
+
37
+
export interface mainSchema extends main$schematype {}
38
+
39
+
export const mainSchema = _mainSchema as mainSchema;
40
+
41
+
export interface Main extends v.InferInput<typeof mainSchema> {}
42
+
43
+
declare module "@atcute/lexicons/ambient" {
44
+
interface Records {
45
+
"pub.leaflet.document": mainSchema;
46
+
}
47
+
}
+74
src/lexicons/types/pub/leaflet/pages/linearDocument.ts
+74
src/lexicons/types/pub/leaflet/pages/linearDocument.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
import * as PubLeafletBlocksCode from "../blocks/code.js";
4
+
import * as PubLeafletBlocksHeader from "../blocks/header.js";
5
+
import * as PubLeafletBlocksImage from "../blocks/image.js";
6
+
import * as PubLeafletBlocksMath from "../blocks/math.js";
7
+
import * as PubLeafletBlocksText from "../blocks/text.js";
8
+
import * as PubLeafletBlocksUnorderedList from "../blocks/unorderedList.js";
9
+
import * as PubLeafletBlocksWebsite from "../blocks/website.js";
10
+
11
+
const _blockSchema = /*#__PURE__*/ v.object({
12
+
$type: /*#__PURE__*/ v.optional(
13
+
/*#__PURE__*/ v.literal("pub.leaflet.pages.linearDocument#block"),
14
+
),
15
+
alignment: /*#__PURE__*/ v.optional(
16
+
/*#__PURE__*/ v.string<
17
+
"#textAlignCenter" | "#textAlignLeft" | "#textAlignRight" | (string & {})
18
+
>(),
19
+
),
20
+
get block() {
21
+
return /*#__PURE__*/ v.variant([
22
+
PubLeafletBlocksCode.mainSchema,
23
+
PubLeafletBlocksHeader.mainSchema,
24
+
PubLeafletBlocksImage.mainSchema,
25
+
PubLeafletBlocksMath.mainSchema,
26
+
PubLeafletBlocksText.mainSchema,
27
+
PubLeafletBlocksUnorderedList.mainSchema,
28
+
PubLeafletBlocksWebsite.mainSchema,
29
+
]);
30
+
},
31
+
});
32
+
const _mainSchema = /*#__PURE__*/ v.object({
33
+
$type: /*#__PURE__*/ v.optional(
34
+
/*#__PURE__*/ v.literal("pub.leaflet.pages.linearDocument"),
35
+
),
36
+
get blocks() {
37
+
return /*#__PURE__*/ v.optional(/*#__PURE__*/ v.array(blockSchema));
38
+
},
39
+
});
40
+
const _textAlignCenterSchema = /*#__PURE__*/ v.literal(
41
+
"pub.leaflet.pages.linearDocument#textAlignCenter",
42
+
);
43
+
const _textAlignLeftSchema = /*#__PURE__*/ v.literal(
44
+
"pub.leaflet.pages.linearDocument#textAlignLeft",
45
+
);
46
+
const _textAlignRightSchema = /*#__PURE__*/ v.literal(
47
+
"pub.leaflet.pages.linearDocument#textAlignRight",
48
+
);
49
+
50
+
type block$schematype = typeof _blockSchema;
51
+
type main$schematype = typeof _mainSchema;
52
+
type textAlignCenter$schematype = typeof _textAlignCenterSchema;
53
+
type textAlignLeft$schematype = typeof _textAlignLeftSchema;
54
+
type textAlignRight$schematype = typeof _textAlignRightSchema;
55
+
56
+
export interface blockSchema extends block$schematype {}
57
+
export interface mainSchema extends main$schematype {}
58
+
export interface textAlignCenterSchema extends textAlignCenter$schematype {}
59
+
export interface textAlignLeftSchema extends textAlignLeft$schematype {}
60
+
export interface textAlignRightSchema extends textAlignRight$schematype {}
61
+
62
+
export const blockSchema = _blockSchema as blockSchema;
63
+
export const mainSchema = _mainSchema as mainSchema;
64
+
export const textAlignCenterSchema =
65
+
_textAlignCenterSchema as textAlignCenterSchema;
66
+
export const textAlignLeftSchema = _textAlignLeftSchema as textAlignLeftSchema;
67
+
export const textAlignRightSchema =
68
+
_textAlignRightSchema as textAlignRightSchema;
69
+
70
+
export interface Block extends v.InferInput<typeof blockSchema> {}
71
+
export interface Main extends v.InferInput<typeof mainSchema> {}
72
+
export type TextAlignCenter = v.InferInput<typeof textAlignCenterSchema>;
73
+
export type TextAlignLeft = v.InferInput<typeof textAlignLeftSchema>;
74
+
export type TextAlignRight = v.InferInput<typeof textAlignRightSchema>;
+119
src/lexicons/types/pub/leaflet/richtext/facet.ts
+119
src/lexicons/types/pub/leaflet/richtext/facet.ts
···
1
+
import type {} from "@atcute/lexicons";
2
+
import * as v from "@atcute/lexicons/validations";
3
+
4
+
const _boldSchema = /*#__PURE__*/ v.object({
5
+
$type: /*#__PURE__*/ v.optional(
6
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#bold"),
7
+
),
8
+
});
9
+
const _byteSliceSchema = /*#__PURE__*/ v.object({
10
+
$type: /*#__PURE__*/ v.optional(
11
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#byteSlice"),
12
+
),
13
+
byteEnd: /*#__PURE__*/ v.integer(),
14
+
byteStart: /*#__PURE__*/ v.integer(),
15
+
});
16
+
const _codeSchema = /*#__PURE__*/ v.object({
17
+
$type: /*#__PURE__*/ v.optional(
18
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#code"),
19
+
),
20
+
});
21
+
const _highlightSchema = /*#__PURE__*/ v.object({
22
+
$type: /*#__PURE__*/ v.optional(
23
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#highlight"),
24
+
),
25
+
});
26
+
const _idSchema = /*#__PURE__*/ v.object({
27
+
$type: /*#__PURE__*/ v.optional(
28
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#id"),
29
+
),
30
+
id: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
31
+
});
32
+
const _italicSchema = /*#__PURE__*/ v.object({
33
+
$type: /*#__PURE__*/ v.optional(
34
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#italic"),
35
+
),
36
+
});
37
+
const _linkSchema = /*#__PURE__*/ v.object({
38
+
$type: /*#__PURE__*/ v.optional(
39
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#link"),
40
+
),
41
+
uri: /*#__PURE__*/ v.genericUriString(),
42
+
});
43
+
const _mainSchema = /*#__PURE__*/ v.object({
44
+
$type: /*#__PURE__*/ v.optional(
45
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet"),
46
+
),
47
+
get features() {
48
+
return /*#__PURE__*/ v.array(
49
+
/*#__PURE__*/ v.variant([
50
+
boldSchema,
51
+
codeSchema,
52
+
highlightSchema,
53
+
idSchema,
54
+
italicSchema,
55
+
linkSchema,
56
+
strikethroughSchema,
57
+
underlineSchema,
58
+
]),
59
+
);
60
+
},
61
+
get index() {
62
+
return byteSliceSchema;
63
+
},
64
+
});
65
+
const _strikethroughSchema = /*#__PURE__*/ v.object({
66
+
$type: /*#__PURE__*/ v.optional(
67
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#strikethrough"),
68
+
),
69
+
});
70
+
const _underlineSchema = /*#__PURE__*/ v.object({
71
+
$type: /*#__PURE__*/ v.optional(
72
+
/*#__PURE__*/ v.literal("pub.leaflet.richtext.facet#underline"),
73
+
),
74
+
});
75
+
76
+
type bold$schematype = typeof _boldSchema;
77
+
type byteSlice$schematype = typeof _byteSliceSchema;
78
+
type code$schematype = typeof _codeSchema;
79
+
type highlight$schematype = typeof _highlightSchema;
80
+
type id$schematype = typeof _idSchema;
81
+
type italic$schematype = typeof _italicSchema;
82
+
type link$schematype = typeof _linkSchema;
83
+
type main$schematype = typeof _mainSchema;
84
+
type strikethrough$schematype = typeof _strikethroughSchema;
85
+
type underline$schematype = typeof _underlineSchema;
86
+
87
+
export interface boldSchema extends bold$schematype {}
88
+
export interface byteSliceSchema extends byteSlice$schematype {}
89
+
export interface codeSchema extends code$schematype {}
90
+
export interface highlightSchema extends highlight$schematype {}
91
+
export interface idSchema extends id$schematype {}
92
+
export interface italicSchema extends italic$schematype {}
93
+
export interface linkSchema extends link$schematype {}
94
+
export interface mainSchema extends main$schematype {}
95
+
export interface strikethroughSchema extends strikethrough$schematype {}
96
+
export interface underlineSchema extends underline$schematype {}
97
+
98
+
export const boldSchema = _boldSchema as boldSchema;
99
+
export const byteSliceSchema = _byteSliceSchema as byteSliceSchema;
100
+
export const codeSchema = _codeSchema as codeSchema;
101
+
export const highlightSchema = _highlightSchema as highlightSchema;
102
+
export const idSchema = _idSchema as idSchema;
103
+
export const italicSchema = _italicSchema as italicSchema;
104
+
export const linkSchema = _linkSchema as linkSchema;
105
+
export const mainSchema = _mainSchema as mainSchema;
106
+
export const strikethroughSchema = _strikethroughSchema as strikethroughSchema;
107
+
export const underlineSchema = _underlineSchema as underlineSchema;
108
+
109
+
export interface Bold extends v.InferInput<typeof boldSchema> {}
110
+
export interface ByteSlice extends v.InferInput<typeof byteSliceSchema> {}
111
+
export interface Code extends v.InferInput<typeof codeSchema> {}
112
+
export interface Highlight extends v.InferInput<typeof highlightSchema> {}
113
+
export interface Id extends v.InferInput<typeof idSchema> {}
114
+
export interface Italic extends v.InferInput<typeof italicSchema> {}
115
+
export interface Link extends v.InferInput<typeof linkSchema> {}
116
+
export interface Main extends v.InferInput<typeof mainSchema> {}
117
+
export interface Strikethrough
118
+
extends v.InferInput<typeof strikethroughSchema> {}
119
+
export interface Underline extends v.InferInput<typeof underlineSchema> {}
+1
-1
src/types.ts
+1
-1
src/types.ts
+25
-16
src/utils.ts
+25
-16
src/utils.ts
···
1
+
import { is } from "@atcute/lexicons";
1
2
import { AtUri, UnicodeString } from "@atproto/api";
2
3
import sanitizeHTML from "sanitize-html";
4
+
import { LiveLoaderError } from "./leaflet-live-loader.js";
3
5
import {
4
6
PubLeafletBlocksHeader,
5
7
PubLeafletBlocksText,
6
8
type PubLeafletDocument,
7
9
PubLeafletPagesLinearDocument,
8
-
PubLeafletRichtextFacet,
9
-
} from "./leaflet/lexicons/index.js";
10
-
import { LiveLoaderError } from "./leaflet-live-loader.js";
10
+
} from "./lexicons/index.js";
11
11
import type {
12
12
Facet,
13
13
GetLeafletDocumentsParams,
···
116
116
id: string;
117
117
uri: string;
118
118
cid: string;
119
-
value: PubLeafletDocument.Record;
119
+
value: PubLeafletDocument.Main;
120
120
}) {
121
121
let html = "";
122
122
const firstPage = record.value.pages[0];
123
123
let blocks: PubLeafletPagesLinearDocument.Block[] = [];
124
-
if (PubLeafletPagesLinearDocument.isMain(firstPage)) {
124
+
if (is(PubLeafletPagesLinearDocument.mainSchema, firstPage)) {
125
125
blocks = firstPage.blocks || [];
126
126
}
127
127
128
128
for (const block of blocks) {
129
-
if (PubLeafletBlocksText.isMain(block.block)) {
129
+
if (is(PubLeafletBlocksText.mainSchema, block.block)) {
130
130
const rt = new RichText({
131
131
text: block.block.plaintext,
132
132
facets: block.block.facets || [],
133
133
});
134
134
const children = [];
135
135
for (const segment of rt.segments()) {
136
-
const link = segment.facet?.find(PubLeafletRichtextFacet.isLink);
137
-
const isBold = segment.facet?.find(PubLeafletRichtextFacet.isBold);
138
-
const isCode = segment.facet?.find(PubLeafletRichtextFacet.isCode);
136
+
const link = segment.facet?.find(
137
+
(segment) => segment.$type === "pub.leaflet.richtext.facet#link",
138
+
);
139
+
const isBold = segment.facet?.find(
140
+
(segment) => segment.$type === "pub.leaflet.richtext.facet#bold",
141
+
);
142
+
const isCode = segment.facet?.find(
143
+
(segment) => segment.$type === "pub.leaflet.richtext.facet#code",
144
+
);
139
145
const isStrikethrough = segment.facet?.find(
140
-
PubLeafletRichtextFacet.isStrikethrough,
146
+
(segment) =>
147
+
segment.$type === "pub.leaflet.richtext.facet#strikethrough",
141
148
);
142
149
const isUnderline = segment.facet?.find(
143
-
PubLeafletRichtextFacet.isUnderline,
150
+
(segment) => segment.$type === "pub.leaflet.richtext.facet#underline",
151
+
);
152
+
const isItalic = segment.facet?.find(
153
+
(segment) => segment.$type === "pub.leaflet.richtext.facet#italic",
144
154
);
145
-
const isItalic = segment.facet?.find(PubLeafletRichtextFacet.isItalic);
146
155
if (isCode) {
147
156
children.push(` <code>
148
157
${segment.text}
···
177
186
html += `<p>${children.join("\n")}</p>`;
178
187
}
179
188
180
-
if (PubLeafletBlocksHeader.isMain(block.block)) {
189
+
if (is(PubLeafletBlocksHeader.mainSchema, block.block)) {
181
190
if (block.block.level === 1) {
182
191
html += `<h2>${block.block.plaintext}</h2>`;
183
192
}
184
193
}
185
-
if (PubLeafletBlocksHeader.isMain(block.block)) {
194
+
if (is(PubLeafletBlocksHeader.mainSchema, block.block)) {
186
195
if (block.block.level === 2) {
187
196
html += `<h3>${block.block.plaintext}</h3>`;
188
197
}
189
198
}
190
-
if (PubLeafletBlocksHeader.isMain(block.block)) {
199
+
if (is(PubLeafletBlocksHeader.mainSchema, block.block)) {
191
200
if (block.block.level === 3) {
192
201
html += `<h4>${block.block.plaintext}</h4>`;
193
202
}
194
203
}
195
-
if (PubLeafletBlocksHeader.isMain(block.block)) {
204
+
if (is(PubLeafletBlocksHeader.mainSchema, block.block)) {
196
205
if (!block.block.level) {
197
206
html += `<h6>${block.block.plaintext}</h6>`;
198
207
}
+2
-2
tsconfig.json
+2
-2
tsconfig.json
···
11
11
"strict": true,
12
12
"noUncheckedIndexedAccess": true,
13
13
"noImplicitOverride": true,
14
-
"module": "esnext",
14
+
"module": "nodenext",
15
15
"baseUrl": "./src",
16
16
"outDir": "dist",
17
-
"moduleResolution": "bundler",
17
+
"moduleResolution": "nodenext",
18
18
"rootDir": "src",
19
19
"sourceMap": true,
20
20
"noEmit": true,