Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve codegen typings #2999

Merged
merged 20 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/beige-trees-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/api": patch
---

Fixes a bug that would clear interests prefs when updating hidden posts
10 changes: 10 additions & 0 deletions .changeset/brown-flies-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@atproto/ozone": patch
"@atproto/bsky": patch
"@atproto/api": minor
"@atproto/pds": patch
---

Update Lexicon derived code to better reflect data typings. In particular, Lexicon derived interfaces will now explicitly include the `$type` property that can be present in the data.


5 changes: 5 additions & 0 deletions .changeset/fast-points-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/syntax": patch
---

Improve performance of isValidTid
5 changes: 5 additions & 0 deletions .changeset/fast-waves-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lex-cli": minor
---

Update the code generation to better reflect the data typings. In particular this change will cause generated code to explicit the `$type` property that can be present in the data.
5 changes: 5 additions & 0 deletions .changeset/green-cherries-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/pds": patch
---

Minor typing fixes
5 changes: 5 additions & 0 deletions .changeset/green-forks-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/api": minor
---

Helper functions (e.g. `NS.isRecord`) no longer casts the output value. Use `asPredicate(NS.validateRecord)` to create a predicate function that will ensure that an unknown value is indeed an `NS.Record`. The `isX` helper function's purpose is to discriminate between `$type`d values from unions.
5 changes: 5 additions & 0 deletions .changeset/late-worms-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lex-cli": patch
---

Add `.js` file extension to `import` statements in generated code.
5 changes: 5 additions & 0 deletions .changeset/popular-shirts-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lexicon": patch
---

Various performance improvements
5 changes: 5 additions & 0 deletions .changeset/shiny-suns-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lex-cli": patch
---

Type the generated `ids` object (that contains all the lexicon namespace ids) as `const`.
5 changes: 5 additions & 0 deletions .changeset/silly-starfishes-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lexicon": patch
---

Fully type `ValidationResult`'s `value` property, allowing `NS.validateMyType` helper functions to return a typed value in case of success.
5 changes: 5 additions & 0 deletions .changeset/spotty-bottles-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lex-cli": minor
---

Remove `[string]: unknown` index signature from custom user objects, input and output schemas.
5 changes: 5 additions & 0 deletions .changeset/tiny-carpets-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/lex-cli": patch
---

Ensures that empty `schemas` arrays are typed as `LexiconDoc[]`.
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ pnpm-lock.yaml
.pnpm*
.changeset
CHANGELOG.md

# Prettier is used to format the code during codegen
packages/api/src/client
packages/bsky/src/lexicon
packages/pds/src/lexicon
packages/ozone/src/lexicon
1 change: 1 addition & 0 deletions packages/api/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ module.exports = {
testTimeout: 60000,
setupFiles: ['<rootDir>/../../jest.setup.ts'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
moduleNameMapper: { '^(\\.\\.?\\/.+)\\.js$': ['$1.ts', '$1.js'] },
}
Loading