···1# prototypey
23+## 0.3.8
4+5+### Patch Changes
6+7+- 7a19f90: releast changes from dep updates and #66
8+9+## 0.3.7
10+11+### Patch Changes
12+13+- e75de54: update docs
14+15+## 0.3.6
16+17+### Patch Changes
18+19+- 2b55317: fix exported type bug
20+21+## 0.3.5
22+23+### Patch Changes
24+25+- abb4b31: updated docs
26+27+## 0.3.4
28+29+### Patch Changes
30+31+- 3329654: fix for type of record key and description hint
32+33+## 0.3.3
34+35+### Patch Changes
36+37+- e7a7497: documentation update
38+39+## 0.3.2
40+41+### Patch Changes
42+43+- 6a6cae5: update deps
44+45+## 0.3.1
46+47+### Patch Changes
48+49+- d5d3143: update docs - we're featured!
50+51+## 0.3.0
52+53+### Minor Changes
54+55+- 91a8c84: generate prototypey lexicon utils from json definitions
56+57+## 0.2.6
58+59+### Patch Changes
60+61+- 6c5569b: only export intended items
62+63## 0.2.5
6465### Patch Changes
+61-17
packages/prototypey/README.md
···1# prototypey
23-A (soon-to-be) fully-featured sdk for developing lexicons with typescript.
00000000000045## Installation
6···138prototypey gen-emit ./lexicons ./src/lexicons/**/*.ts
139```
140141-### Typical Workflow
0000000000000000000000000001421431. Author lexicons in TypeScript using the library
1442. Emit JSON schemas with `gen-emit` for runtime validation
···159npm run lexicon:emit
160```
161162-## State of the Project
163164-**Done:**
0165166-- Full atproto spec lexicon authoring with in IDE docs & hints for each attribute (ts => json)
167-- CLI generates json from ts definitions
168-- CLI generates ts from json definitions
169-- Inferrance of valid type from full lexicon definition
170- - the really cool part of this is that it fills in the refs from the defs all at the type level
171-- `lx.lexicon(...).validate(data)` for validating data using `@atproto/lexicon` and your lexicon definitions
172173-**TODO/In Progress:**
000000174175-- Library art! Please reach out if you'd be willing to contribute some drawings or anything!
176-- Add CLI support for inferring and validating from json as the starting point
177178-Please give any and all feedback. I've not really written many lexicons much myself yet, so this project is at a point of "well I think this makes sense" ๐. Both the [issues page](https://github.com/tylersayshi/prototypey/issues) and [discussions](https://github.com/tylersayshi/prototypey/discussions) are open and ready for y'all ๐.
00179180---
181182-> ๐ This package was templated with
183-> [`create-typescript-app`](https://github.com/JoshuaKGoldberg/create-typescript-app)
184-> using the [Bingo framework](https://create.bingo).
00
···1# prototypey
23+A fully-featured sdk for developing lexicons with typescript.
4+5+Below this is the docs and features of the library. If you'd like the story for why prototypey exists and what it's good for: [that's published here](https://notes.tylur.dev/3m5a3do4eus2w)
6+7+## Features
8+9+- atproto spec lexicon authoring with in IDE docs & hints for each attribute (ts => json)
10+- CLI to generate json from ts definitions
11+- CLI to generate ts from json definitions
12+- inference of usage type from full lexicon definition
13+ - the really cool part of this is that it fills in the refs from the defs all at the type level
14+- `lx.lexicon(...).validate(data)` for validating data using `@atproto/lexicon`
15+- `fromJSON()` helper for creating lexicons directly from JSON objects with full type inference
1617## Installation
18···150prototypey gen-emit ./lexicons ./src/lexicons/**/*.ts
151```
152153+#### `gen-from-json` - Generate TypeScript from JSON schemas
154+155+```bash
156+prototypey gen-from-json <outdir> <sources...>
157+```
158+159+Generates TypeScript files from JSON lexicon schemas using the `fromJSON` helper. This is useful when you have existing lexicon JSON files and want to work with them in TypeScript with full type inference.
160+161+**Example:**
162+163+```bash
164+prototypey gen-from-json ./src/lexicons ./lexicons/**/*.json
165+```
166+167+This will create TypeScript files that export typed lexicon objects:
168+169+```ts
170+// Generated file: src/lexicons/app.bsky.feed.post.ts
171+import { fromJSON } from "prototypey";
172+173+export const appBskyFeedPost = fromJSON({
174+ // ... lexicon JSON
175+});
176+```
177+178+### Typical Workflows
179+180+#### TypeScript-first workflow
1811821. Author lexicons in TypeScript using the library
1832. Emit JSON schemas with `gen-emit` for runtime validation
···198npm run lexicon:emit
199```
200201+#### JSON-first workflow
202203+1. Start with JSON lexicon schemas (e.g., from atproto)
204+2. Generate TypeScript with `gen-from-json` for type-safe access
205206+**Recommended:** Add as a script to your `package.json`:
00000207208+```json
209+{
210+ "scripts": {
211+ "lexicon:import": "prototypey gen-from-json ./src/lexicons ./lexicons/**/*.json"
212+ }
213+}
214+```
215216+Then run:
0217218+```bash
219+npm run lexicon:import
220+```
221222---
223224+Please give any and all feedback. I've not really written many lexicons much myself yet, so this project is at a point of "well I think this makes sense". Both the [issues page](https://github.com/tylersayshi/prototypey/issues) and [discussions](https://github.com/tylersayshi/prototypey/discussions) are open and ready for y'all ๐.
225+226+**Call For Contribution:**
227+228+We need library art! Please reach out if you'd be willing to contribute some drawings or anything :)
···183 });
184});
1850000000000000000000000000000000000000000000000000000000000000000000000000186test("lx.token() with interaction event", () => {
187 const result = lx.token(
188 "Request that less content like the given feed item be shown in the feed",