Skip to content

Commit f7062ae

Browse files
committed
Revert "remove lex generated code (#21)"
This reverts commit 1418f94.
1 parent d640f14 commit f7062ae

18 files changed

Lines changed: 932 additions & 2 deletions

lex.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// file: lex.config.js
2+
import { defineLexiconConfig } from '@atcute/lex-cli';
3+
4+
export default defineLexiconConfig({
5+
files: ['lexicons/**/*.json'],
6+
outdir: 'src/lexicons/',
7+
pull: {
8+
outdir: 'lexicons/',
9+
clean: false,
10+
sources: [
11+
{
12+
type: 'git',
13+
remote: 'https://github.com/cosmik-network/semble.git',
14+
ref: 'main',
15+
pattern: ['src/modules/atproto/infrastructure/lexicons/**/*.json'],
16+
},
17+
{
18+
type: 'git',
19+
remote: 'https://tangled.org/margin.at/margin.git',
20+
ref: 'main',
21+
pattern: ['lexicons/**/*.json'],
22+
},
23+
],
24+
},
25+
});

lexicons/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# lexicon sources
2+
3+
this directory contains lexicon documents pulled from the following sources:
4+
5+
- https://github.com/cosmik-network/semble.git (ref: main)
6+
- commit: 0c1ee36649c20c0713a0ad0fd20209c0154b8550
7+
- https://tangled.org/margin.at/margin.git (ref: main)
8+
- commit: ac7f76cb2ce7d27087825178d95e8d267b524d88

lexicons/at/margin/annotation.json

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
{
2+
"lexicon": 1,
3+
"id": "at.margin.annotation",
4+
"revision": 2,
5+
"description": "W3C Web Annotation Data Model compliant annotation record for ATProto",
6+
"defs": {
7+
"main": {
8+
"type": "record",
9+
"description": "A W3C-compliant web annotation stored on the AT Protocol",
10+
"key": "tid",
11+
"record": {
12+
"type": "object",
13+
"required": ["target", "createdAt"],
14+
"properties": {
15+
"motivation": {
16+
"type": "string",
17+
"description": "W3C motivation for the annotation",
18+
"knownValues": [
19+
"commenting",
20+
"highlighting",
21+
"bookmarking",
22+
"tagging",
23+
"describing",
24+
"linking",
25+
"replying",
26+
"editing",
27+
"questioning",
28+
"assessing"
29+
]
30+
},
31+
"body": {
32+
"type": "ref",
33+
"ref": "#body",
34+
"description": "The annotation content (text or reference)"
35+
},
36+
"target": {
37+
"type": "ref",
38+
"ref": "#target",
39+
"description": "The resource being annotated with optional selector"
40+
},
41+
"tags": {
42+
"type": "array",
43+
"description": "Tags for categorization",
44+
"items": {
45+
"type": "string",
46+
"maxLength": 64,
47+
"maxGraphemes": 32
48+
},
49+
"maxLength": 10
50+
},
51+
"createdAt": {
52+
"type": "string",
53+
"format": "datetime"
54+
}
55+
}
56+
}
57+
},
58+
"body": {
59+
"type": "object",
60+
"description": "Annotation body - the content of the annotation",
61+
"properties": {
62+
"value": {
63+
"type": "string",
64+
"maxLength": 10000,
65+
"maxGraphemes": 3000,
66+
"description": "Text content of the annotation"
67+
},
68+
"format": {
69+
"type": "string",
70+
"description": "MIME type of the body content",
71+
"default": "text/plain"
72+
},
73+
"language": {
74+
"type": "string",
75+
"description": "BCP47 language tag"
76+
},
77+
"uri": {
78+
"type": "string",
79+
"format": "uri",
80+
"description": "Reference to external body content"
81+
}
82+
}
83+
},
84+
"target": {
85+
"type": "object",
86+
"description": "W3C SpecificResource - the target with optional selector",
87+
"required": ["source"],
88+
"properties": {
89+
"source": {
90+
"type": "string",
91+
"format": "uri",
92+
"description": "The URL being annotated"
93+
},
94+
"sourceHash": {
95+
"type": "string",
96+
"description": "SHA256 hash of normalized URL for indexing"
97+
},
98+
"title": {
99+
"type": "string",
100+
"maxLength": 500,
101+
"description": "Page title at time of annotation"
102+
},
103+
"selector": {
104+
"type": "union",
105+
"description": "Selector to identify the specific segment",
106+
"refs": [
107+
"#textQuoteSelector",
108+
"#textPositionSelector",
109+
"#cssSelector",
110+
"#xpathSelector",
111+
"#fragmentSelector",
112+
"#rangeSelector"
113+
]
114+
},
115+
"state": {
116+
"type": "ref",
117+
"ref": "#timeState",
118+
"description": "State of the resource at annotation time"
119+
}
120+
}
121+
},
122+
"textQuoteSelector": {
123+
"type": "object",
124+
"description": "W3C TextQuoteSelector - select text by quoting it with context",
125+
"required": ["exact"],
126+
"properties": {
127+
"type": {
128+
"type": "string",
129+
"const": "TextQuoteSelector"
130+
},
131+
"exact": {
132+
"type": "string",
133+
"maxLength": 5000,
134+
"maxGraphemes": 1500,
135+
"description": "The exact text to match"
136+
},
137+
"prefix": {
138+
"type": "string",
139+
"maxLength": 500,
140+
"maxGraphemes": 150,
141+
"description": "Text immediately before the selection"
142+
},
143+
"suffix": {
144+
"type": "string",
145+
"maxLength": 500,
146+
"maxGraphemes": 150,
147+
"description": "Text immediately after the selection"
148+
}
149+
}
150+
},
151+
"textPositionSelector": {
152+
"type": "object",
153+
"description": "W3C TextPositionSelector - select by character offsets",
154+
"required": ["start", "end"],
155+
"properties": {
156+
"type": {
157+
"type": "string",
158+
"const": "TextPositionSelector"
159+
},
160+
"start": {
161+
"type": "integer",
162+
"minimum": 0,
163+
"description": "Starting character position (0-indexed, inclusive)"
164+
},
165+
"end": {
166+
"type": "integer",
167+
"minimum": 0,
168+
"description": "Ending character position (exclusive)"
169+
}
170+
}
171+
},
172+
"cssSelector": {
173+
"type": "object",
174+
"description": "W3C CssSelector - select DOM elements by CSS selector",
175+
"required": ["value"],
176+
"properties": {
177+
"type": {
178+
"type": "string",
179+
"const": "CssSelector"
180+
},
181+
"value": {
182+
"type": "string",
183+
"maxLength": 2000,
184+
"description": "CSS selector string"
185+
}
186+
}
187+
},
188+
"xpathSelector": {
189+
"type": "object",
190+
"description": "W3C XPathSelector - select by XPath expression",
191+
"required": ["value"],
192+
"properties": {
193+
"type": {
194+
"type": "string",
195+
"const": "XPathSelector"
196+
},
197+
"value": {
198+
"type": "string",
199+
"maxLength": 2000,
200+
"description": "XPath expression"
201+
}
202+
}
203+
},
204+
"fragmentSelector": {
205+
"type": "object",
206+
"description": "W3C FragmentSelector - select by URI fragment",
207+
"required": ["value"],
208+
"properties": {
209+
"type": {
210+
"type": "string",
211+
"const": "FragmentSelector"
212+
},
213+
"value": {
214+
"type": "string",
215+
"maxLength": 1000,
216+
"description": "Fragment identifier value"
217+
},
218+
"conformsTo": {
219+
"type": "string",
220+
"format": "uri",
221+
"description": "Specification the fragment conforms to"
222+
}
223+
}
224+
},
225+
"rangeSelector": {
226+
"type": "object",
227+
"description": "W3C RangeSelector - select range between two selectors",
228+
"required": ["startSelector", "endSelector"],
229+
"properties": {
230+
"type": {
231+
"type": "string",
232+
"const": "RangeSelector"
233+
},
234+
"startSelector": {
235+
"type": "union",
236+
"description": "Selector for range start",
237+
"refs": [
238+
"#textQuoteSelector",
239+
"#textPositionSelector",
240+
"#cssSelector",
241+
"#xpathSelector"
242+
]
243+
},
244+
"endSelector": {
245+
"type": "union",
246+
"description": "Selector for range end",
247+
"refs": [
248+
"#textQuoteSelector",
249+
"#textPositionSelector",
250+
"#cssSelector",
251+
"#xpathSelector"
252+
]
253+
}
254+
}
255+
},
256+
"timeState": {
257+
"type": "object",
258+
"description": "W3C TimeState - record when content was captured",
259+
"properties": {
260+
"sourceDate": {
261+
"type": "string",
262+
"format": "datetime",
263+
"description": "When the source was accessed"
264+
},
265+
"cached": {
266+
"type": "string",
267+
"format": "uri",
268+
"description": "URL to cached/archived version"
269+
}
270+
}
271+
}
272+
}
273+
}

lexicons/at/margin/authFull.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"lexicon": 1,
3+
"id": "at.margin.authFull",
4+
"defs": {
5+
"main": {
6+
"type": "permission-set",
7+
"title": "Margin",
8+
"title:langs": {},
9+
"detail": "Full access to Margin features including annotations, highlights, bookmarks, and collections.",
10+
"detail:langs": {},
11+
"permissions": [
12+
{
13+
"type": "permission",
14+
"resource": "repo",
15+
"action": ["create", "update", "delete"],
16+
"collection": [
17+
"at.margin.annotation",
18+
"at.margin.highlight",
19+
"at.margin.bookmark",
20+
"at.margin.reply",
21+
"at.margin.like",
22+
"at.margin.collection",
23+
"at.margin.collectionItem",
24+
"at.margin.profile"
25+
]
26+
}
27+
]
28+
}
29+
}
30+
}

lexicons/at/margin/bookmark.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"lexicon": 1,
3+
"id": "at.margin.bookmark",
4+
"description": "A bookmark record - save URL for later",
5+
"defs": {
6+
"main": {
7+
"type": "record",
8+
"description": "A bookmarked URL (motivation: bookmarking)",
9+
"key": "tid",
10+
"record": {
11+
"type": "object",
12+
"required": ["source", "createdAt"],
13+
"properties": {
14+
"source": {
15+
"type": "string",
16+
"format": "uri",
17+
"description": "The bookmarked URL"
18+
},
19+
"sourceHash": {
20+
"type": "string",
21+
"description": "SHA256 hash of normalized URL for indexing"
22+
},
23+
"title": {
24+
"type": "string",
25+
"maxLength": 500,
26+
"description": "Page title"
27+
},
28+
"description": {
29+
"type": "string",
30+
"maxLength": 1000,
31+
"maxGraphemes": 300,
32+
"description": "Optional description/note"
33+
},
34+
"tags": {
35+
"type": "array",
36+
"description": "Tags for categorization",
37+
"items": {
38+
"type": "string",
39+
"maxLength": 64,
40+
"maxGraphemes": 32
41+
},
42+
"maxLength": 10
43+
},
44+
"createdAt": {
45+
"type": "string",
46+
"format": "datetime"
47+
}
48+
}
49+
}
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)