tangled
alpha
login
or
join now
vielle.dev
/
atcities.dev
8
fork
atom
[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!
8
fork
atom
overview
issues
pulls
pipelines
server: add lexicon for routing
vielle.dev
5 months ago
26e37f3b
137b7aac
+119
-4
6 changed files
expand all
collapse all
unified
split
deno.json
deno.lock
lex
dev.atcities.route.json
lex.config.js
src
lexicons
index.ts
types
dev
atcities
route.ts
+7
-2
deno.json
···
1
1
{
2
2
"tasks": {
3
3
-
"dev": "PORT=8000 deno run --watch --allow-net --allow-env=HOSTNAME,PORT,NODE_ENV src/index.ts"
3
3
+
"dev": "PORT=8000 deno run --watch --allow-net --allow-env=HOSTNAME,PORT,NODE_ENV src/index.ts",
4
4
+
"lexgen": "deno run --allow-env --allow-sys --allow-read=. --allow-write=./src/lexicons --no-prompt @atcute/lex-cli generate -c ./lex.config.js"
4
5
},
5
6
"imports": {
6
6
-
"@atcute/identity-resolver": "npm:@atcute/identity-resolver@^1.1.3"
7
7
+
"@atcute/identity-resolver": "npm:@atcute/identity-resolver@^1.1.3",
8
8
+
"@atcute/atproto": "npm:@atcute/atproto@^3.1.4",
9
9
+
"@atcute/client": "npm:@atcute/client@^4.0.3",
10
10
+
"@atcute/lex-cli": "npm:@atcute/lex-cli@^2.2.0",
11
11
+
"@atcute/lexicons": "npm:@atcute/lexicons@^1.1.1"
7
12
},
8
13
"unstable": ["raw-imports"]
9
14
}
+53
-2
deno.lock
···
1
1
{
2
2
"version": "5",
3
3
"specifiers": {
4
4
-
"npm:@atcute/identity-resolver@^1.1.3": "1.1.3_@atcute+identity@1.1.0"
4
4
+
"npm:@atcute/atproto@^3.1.4": "3.1.4",
5
5
+
"npm:@atcute/client@^4.0.3": "4.0.3",
6
6
+
"npm:@atcute/identity-resolver@^1.1.3": "1.1.3_@atcute+identity@1.1.0",
7
7
+
"npm:@atcute/lex-cli@^2.2.0": "2.2.0_@badrap+valita@0.4.6",
8
8
+
"npm:@atcute/lexicons@^1.1.1": "1.1.1"
5
9
},
6
10
"npm": {
11
11
+
"@atcute/atproto@3.1.4": {
12
12
+
"integrity": "sha512-v0/ue7mZYtjYw4vWbtda51bLwW88mqsUQB8F/UZNO18ANAQWmKq1HDceVqjvruaLe2QPqE43XM3WkEyZ2FhOrA==",
13
13
+
"dependencies": [
14
14
+
"@atcute/lexicons"
15
15
+
]
16
16
+
},
17
17
+
"@atcute/client@4.0.3": {
18
18
+
"integrity": "sha512-RIOZWFVLca/HiPAAUDqQPOdOreCxTbL5cb+WUf5yqQOKIu5yEAP3eksinmlLmgIrlr5qVOE7brazUUzaskFCfw==",
19
19
+
"dependencies": [
20
20
+
"@atcute/identity",
21
21
+
"@atcute/lexicons"
22
22
+
]
23
23
+
},
7
24
"@atcute/identity-resolver@1.1.3_@atcute+identity@1.1.0": {
8
25
"integrity": "sha512-KZgGgg99CWaV7Df3+h3X/WMrDzTPQVfsaoIVbTNLx2B56BvCL2EmaxPSVw/7BFUJMZHlVU4rtoEB4lyvNyMswA==",
9
26
"dependencies": [
···
20
37
"@badrap/valita"
21
38
]
22
39
},
40
40
+
"@atcute/lex-cli@2.2.0_@badrap+valita@0.4.6": {
41
41
+
"integrity": "sha512-noikZui2a7zeGGp0KdQQqCkhfrgXORZ5RiFI9lyxD/SoL+g1LZBZ2vOo92kcbZT1j37Guj4+DmpFC4pWbxhuUA==",
42
42
+
"dependencies": [
43
43
+
"@atcute/lexicon-doc",
44
44
+
"@badrap/valita",
45
45
+
"@externdefs/collider",
46
46
+
"picocolors",
47
47
+
"prettier"
48
48
+
],
49
49
+
"bin": true
50
50
+
},
51
51
+
"@atcute/lexicon-doc@1.1.1": {
52
52
+
"integrity": "sha512-/6M4K34ICZWa9rRiM9YWSsDZs0Vjv05SFJBb03mD+x14W01gIVLPK2UXiP0yIodgzWHhPQ79LLdyMJ8LirC84w==",
53
53
+
"dependencies": [
54
54
+
"@badrap/valita"
55
55
+
]
56
56
+
},
23
57
"@atcute/lexicons@1.1.1": {
24
58
"integrity": "sha512-k6qy5p3j9fJJ6ekaMPfEfp3ni4TW/XNuH9ZmsuwC0fi0tOjp+Fa8ZQakHwnqOzFt/cVBfGcmYE/lKNAbeTjgUg==",
25
59
"dependencies": [
···
34
68
},
35
69
"@badrap/valita@0.4.6": {
36
70
"integrity": "sha512-4kdqcjyxo/8RQ8ayjms47HCWZIF5981oE5nIenbfThKDxWXtEHKipAOWlflpPJzZx9y/JWYQkp18Awr7VuepFg=="
71
71
+
},
72
72
+
"@externdefs/collider@0.3.0_@badrap+valita@0.4.6": {
73
73
+
"integrity": "sha512-x5CpeZ4c8n+1wMFthUMWSQKqCGcQo52/Qbda5ES+JFRRg/D8Ep6/JOvUUq5HExFuv/wW+6UYG2U/mXzw0IAd8Q==",
74
74
+
"dependencies": [
75
75
+
"@badrap/valita"
76
76
+
]
37
77
},
38
78
"esm-env@1.2.2": {
39
79
"integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="
80
80
+
},
81
81
+
"picocolors@1.1.1": {
82
82
+
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
83
83
+
},
84
84
+
"prettier@3.6.2": {
85
85
+
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
86
86
+
"bin": true
40
87
}
41
88
},
42
89
"workspace": {
43
90
"dependencies": [
44
44
-
"npm:@atcute/identity-resolver@^1.1.3"
91
91
+
"npm:@atcute/atproto@^3.1.4",
92
92
+
"npm:@atcute/client@^4.0.3",
93
93
+
"npm:@atcute/identity-resolver@^1.1.3",
94
94
+
"npm:@atcute/lex-cli@^2.2.0",
95
95
+
"npm:@atcute/lexicons@^1.1.1"
45
96
]
46
97
}
47
98
}
+6
lex.config.js
···
1
1
+
import { defineLexiconConfig } from "@atcute/lex-cli";
2
2
+
3
3
+
export default defineLexiconConfig({
4
4
+
files: ["lex/**/*.json"],
5
5
+
outdir: "src/lexicons/",
6
6
+
});
+26
lex/dev.atcities.route.json
···
1
1
+
{
2
2
+
"lexicon": 1,
3
3
+
"id": "dev.atcities.route",
4
4
+
"description": "Define the route for a given page. Page content is a blob",
5
5
+
"defs": {
6
6
+
"main": {
7
7
+
"type": "record",
8
8
+
"description": "Page URL maps directly to a record key",
9
9
+
"key": "any",
10
10
+
"record": {
11
11
+
"type": "object",
12
12
+
"properties": {
13
13
+
"page": {
14
14
+
"type": "blob",
15
15
+
"accept": ["*/*"]
16
16
+
},
17
17
+
"mimeType": {
18
18
+
"type": "string",
19
19
+
"description": "Optionally the mime type for this page. `mimeType` > `blob.mimeType` (ignore application/octet-stream) > getBlob xrpc mime header"
20
20
+
}
21
21
+
},
22
22
+
"required": ["page"]
23
23
+
}
24
24
+
}
25
25
+
}
26
26
+
}
+1
src/lexicons/index.ts
···
1
1
+
export * as DevAtcitiesRoute from "./types/dev/atcities/route.js";
+26
src/lexicons/types/dev/atcities/route.ts
···
1
1
+
import type {} from "@atcute/lexicons";
2
2
+
import * as v from "@atcute/lexicons/validations";
3
3
+
import type {} from "@atcute/lexicons/ambient";
4
4
+
5
5
+
const _mainSchema = /*#__PURE__*/ v.record(
6
6
+
/*#__PURE__*/ v.string(),
7
7
+
/*#__PURE__*/ v.object({
8
8
+
$type: /*#__PURE__*/ v.literal("dev.atcities.route"),
9
9
+
mimeType: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()),
10
10
+
page: /*#__PURE__*/ v.blob(),
11
11
+
}),
12
12
+
);
13
13
+
14
14
+
type main$schematype = typeof _mainSchema;
15
15
+
16
16
+
export interface mainSchema extends main$schematype {}
17
17
+
18
18
+
export const mainSchema = _mainSchema as mainSchema;
19
19
+
20
20
+
export interface Main extends v.InferInput<typeof mainSchema> {}
21
21
+
22
22
+
declare module "@atcute/lexicons/ambient" {
23
23
+
interface Records {
24
24
+
"dev.atcities.route": mainSchema;
25
25
+
}
26
26
+
}