[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

server: add lexicon for routing

+119 -4
+7 -2
deno.json
··· 1 1 { 2 2 "tasks": { 3 - "dev": "PORT=8000 deno run --watch --allow-net --allow-env=HOSTNAME,PORT,NODE_ENV src/index.ts" 3 + "dev": "PORT=8000 deno run --watch --allow-net --allow-env=HOSTNAME,PORT,NODE_ENV src/index.ts", 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 - "@atcute/identity-resolver": "npm:@atcute/identity-resolver@^1.1.3" 7 + "@atcute/identity-resolver": "npm:@atcute/identity-resolver@^1.1.3", 8 + "@atcute/atproto": "npm:@atcute/atproto@^3.1.4", 9 + "@atcute/client": "npm:@atcute/client@^4.0.3", 10 + "@atcute/lex-cli": "npm:@atcute/lex-cli@^2.2.0", 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 - "npm:@atcute/identity-resolver@^1.1.3": "1.1.3_@atcute+identity@1.1.0" 4 + "npm:@atcute/atproto@^3.1.4": "3.1.4", 5 + "npm:@atcute/client@^4.0.3": "4.0.3", 6 + "npm:@atcute/identity-resolver@^1.1.3": "1.1.3_@atcute+identity@1.1.0", 7 + "npm:@atcute/lex-cli@^2.2.0": "2.2.0_@badrap+valita@0.4.6", 8 + "npm:@atcute/lexicons@^1.1.1": "1.1.1" 5 9 }, 6 10 "npm": { 11 + "@atcute/atproto@3.1.4": { 12 + "integrity": "sha512-v0/ue7mZYtjYw4vWbtda51bLwW88mqsUQB8F/UZNO18ANAQWmKq1HDceVqjvruaLe2QPqE43XM3WkEyZ2FhOrA==", 13 + "dependencies": [ 14 + "@atcute/lexicons" 15 + ] 16 + }, 17 + "@atcute/client@4.0.3": { 18 + "integrity": "sha512-RIOZWFVLca/HiPAAUDqQPOdOreCxTbL5cb+WUf5yqQOKIu5yEAP3eksinmlLmgIrlr5qVOE7brazUUzaskFCfw==", 19 + "dependencies": [ 20 + "@atcute/identity", 21 + "@atcute/lexicons" 22 + ] 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 + "@atcute/lex-cli@2.2.0_@badrap+valita@0.4.6": { 41 + "integrity": "sha512-noikZui2a7zeGGp0KdQQqCkhfrgXORZ5RiFI9lyxD/SoL+g1LZBZ2vOo92kcbZT1j37Guj4+DmpFC4pWbxhuUA==", 42 + "dependencies": [ 43 + "@atcute/lexicon-doc", 44 + "@badrap/valita", 45 + "@externdefs/collider", 46 + "picocolors", 47 + "prettier" 48 + ], 49 + "bin": true 50 + }, 51 + "@atcute/lexicon-doc@1.1.1": { 52 + "integrity": "sha512-/6M4K34ICZWa9rRiM9YWSsDZs0Vjv05SFJBb03mD+x14W01gIVLPK2UXiP0yIodgzWHhPQ79LLdyMJ8LirC84w==", 53 + "dependencies": [ 54 + "@badrap/valita" 55 + ] 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 + }, 72 + "@externdefs/collider@0.3.0_@badrap+valita@0.4.6": { 73 + "integrity": "sha512-x5CpeZ4c8n+1wMFthUMWSQKqCGcQo52/Qbda5ES+JFRRg/D8Ep6/JOvUUq5HExFuv/wW+6UYG2U/mXzw0IAd8Q==", 74 + "dependencies": [ 75 + "@badrap/valita" 76 + ] 37 77 }, 38 78 "esm-env@1.2.2": { 39 79 "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==" 80 + }, 81 + "picocolors@1.1.1": { 82 + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" 83 + }, 84 + "prettier@3.6.2": { 85 + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", 86 + "bin": true 40 87 } 41 88 }, 42 89 "workspace": { 43 90 "dependencies": [ 44 - "npm:@atcute/identity-resolver@^1.1.3" 91 + "npm:@atcute/atproto@^3.1.4", 92 + "npm:@atcute/client@^4.0.3", 93 + "npm:@atcute/identity-resolver@^1.1.3", 94 + "npm:@atcute/lex-cli@^2.2.0", 95 + "npm:@atcute/lexicons@^1.1.1" 45 96 ] 46 97 } 47 98 }
+6
lex.config.js
··· 1 + import { defineLexiconConfig } from "@atcute/lex-cli"; 2 + 3 + export default defineLexiconConfig({ 4 + files: ["lex/**/*.json"], 5 + outdir: "src/lexicons/", 6 + });
+26
lex/dev.atcities.route.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "dev.atcities.route", 4 + "description": "Define the route for a given page. Page content is a blob", 5 + "defs": { 6 + "main": { 7 + "type": "record", 8 + "description": "Page URL maps directly to a record key", 9 + "key": "any", 10 + "record": { 11 + "type": "object", 12 + "properties": { 13 + "page": { 14 + "type": "blob", 15 + "accept": ["*/*"] 16 + }, 17 + "mimeType": { 18 + "type": "string", 19 + "description": "Optionally the mime type for this page. `mimeType` > `blob.mimeType` (ignore application/octet-stream) > getBlob xrpc mime header" 20 + } 21 + }, 22 + "required": ["page"] 23 + } 24 + } 25 + } 26 + }
+1
src/lexicons/index.ts
··· 1 + export * as DevAtcitiesRoute from "./types/dev/atcities/route.js";
+26
src/lexicons/types/dev/atcities/route.ts
··· 1 + import type {} from "@atcute/lexicons"; 2 + import * as v from "@atcute/lexicons/validations"; 3 + import type {} from "@atcute/lexicons/ambient"; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.string(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal("dev.atcities.route"), 9 + mimeType: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 10 + page: /*#__PURE__*/ v.blob(), 11 + }), 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> {} 21 + 22 + declare module "@atcute/lexicons/ambient" { 23 + interface Records { 24 + "dev.atcities.route": mainSchema; 25 + } 26 + }