prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Version Packages (#101)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

authored by

github-actions[bot]
github-actions[bot]
and committed by
GitHub
5f8bc07f 7a0cfd8d

+33 -32
-31
.changeset/query-procedure-subscription-type-hints.md
··· 1 - --- 2 - "prototypey": minor 3 - --- 4 - 5 - Add type-level inference for `query`, `procedure`, and `subscription` lexicon types. 6 - 7 - The `~infer` type on a lexicon now resolves `parameters`, `input`, `output`, and `message` bodies into the shapes you'd expect, so you can pull request/response types directly off the schema instead of hand-writing them. 8 - 9 - ```ts 10 - const getUser = lx.lexicon("com.example.getUser", { 11 - main: lx.query({ 12 - parameters: lx.params({ 13 - did: lx.string({ required: true, format: "did" }), 14 - }), 15 - output: { 16 - encoding: "application/json", 17 - schema: lx.object({ 18 - name: lx.string({ required: true }), 19 - bio: lx.string(), 20 - }), 21 - }, 22 - }), 23 - }); 24 - 25 - type GetUser = (typeof getUser)["~infer"]; 26 - // { 27 - // $type: "com.example.getUser" 28 - // parameters: { did: string } 29 - // output: { name: string; bio?: string | undefined } 30 - // } 31 - ```
+32
packages/prototypey/CHANGELOG.md
··· 1 1 # prototypey 2 2 3 + ## 0.7.0 4 + 5 + ### Minor Changes 6 + 7 + - 7a0cfd8: Add type-level inference for `query`, `procedure`, and `subscription` lexicon types. 8 + 9 + The `~infer` type on a lexicon now resolves `parameters`, `input`, `output`, and `message` bodies into the shapes you'd expect, so you can pull request/response types directly off the schema instead of hand-writing them. 10 + 11 + ```ts 12 + const getUser = lx.lexicon("com.example.getUser", { 13 + main: lx.query({ 14 + parameters: lx.params({ 15 + did: lx.string({ required: true, format: "did" }), 16 + }), 17 + output: { 18 + encoding: "application/json", 19 + schema: lx.object({ 20 + name: lx.string({ required: true }), 21 + bio: lx.string(), 22 + }), 23 + }, 24 + }), 25 + }); 26 + 27 + type GetUser = (typeof getUser)["~infer"]; 28 + // { 29 + // $type: "com.example.getUser" 30 + // parameters: { did: string } 31 + // output: { name: string; bio?: string | undefined } 32 + // } 33 + ``` 34 + 3 35 ## 0.6.1 4 36 5 37 ### Patch Changes
+1 -1
packages/prototypey/package.json
··· 1 1 { 2 2 "name": "prototypey", 3 - "version": "0.6.1", 3 + "version": "0.7.0", 4 4 "description": "atproto lexicon typescript toolkit", 5 5 "repository": { 6 6 "type": "git",