-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
groq-builder: zod compatibility (#257)
* feature(zod): added zodValidations * feature(zod): added nullToUndefined helper * feature(zod): added `as` and `asType` helpers * feature(zod): improved jsdocs * feature(zod): better support for Zod types in parsers * feature(zod): renamed to simply `zod` * feature(zod): add zod dependency * feature(zod): switch more tests to use zod * feature(zod): moved "lite validation" into new folder * feature(zod): handle ZodError * feature(zod): extracted the object/array parsing logic, used by `project` * feature(infer): implemented `q.infer()` for inferred result types * feature(infer): updated error messages * feature(cleanup): renamed to `InferResultItem` * feature(cleanup): moved type utils into a `ResultItem` namespace * feature(cleanup): use type-fest types, and removed unused types * feature(cleanup): removed useless `$` convention * feature(infer): updated naked projections (`.field`, projection tuples) with mandatory parser * Revert "feature(infer): updated naked projections (`.field`, projection tuples) with mandatory parser" This reverts commit 42cb7e6 * Revert "feature(infer): implemented `q.infer()` for inferred result types" This reverts commit ac59a43 * feature(cleanup): allow `q.field` to accept a parser * feature(cleanup): updated tests to use zod * feature(validationRequired): added validationRequired flag * feature(validationRequired): implemented validationRequired field for naked projections * feature(validationRequired): implemented validationRequired field for projections * changeset * feature(cleanup): added jsdocs * feature(zod): do not require validation for naked projections, since they can be chained; enforce stronger for projections * feature(zod): allow a parser for the `...` type * feature(cleanup): simplified Omit conditional keys * feature(zod): map all `undefined` to `null` * feature(zod): added `q.default` utility * feature(zod): updated zod test with nullable field * feature(zod): support Parser input widening * feature(projection): massively improved error messages for projections * feature(projection): updated tests * feature(projection): removed custom `expectType`, replaced with `expectTypeOf` from vitest * feature(zod): updated MIGRATION with updated Zod examples * feature(zod): added `createGroqBuilderWithZod` method to simplify API * feature(zod): moved `nullToUndefined` into zod namespacr * feature(zod): when chaining methods, check to ensure parsers are not added before queries * feature(zod): implemented `.nullable()` * feature(zod): moved `q.slug` into zod, since that's the only place it's useful * feature(zod): make chain's `parser` optional * feature(zod): removed unused `validation/lite` * feature(zod): ensure naked projection parsers are validated * feature(zod): properly preserve `null` values in naked projections * feature(zod): properly preserve `null` values in naked projections * feature(zod): removed unused import * feature(zod): updated changeset --------- Co-authored-by: scottrippey <scott.william.rippey@gmail.com>
- Loading branch information
1 parent
22e5dd3
commit a6e10ab
Showing
67 changed files
with
1,598 additions
and
1,760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
"groq-builder": minor | ||
--- | ||
|
||
Added `createGroqBuilderWithZod()` and removed the `.include(zod)` method | ||
|
||
Removed internal validation methods; use Zod methods instead | ||
|
||
Added `validationRequired` option to require runtime validation | ||
|
||
Removed `$` from `q.conditional$` and `q.select$` methods; these are now just `q.conditional` and `q.select` | ||
|
||
Added optional validation parameter to `q.field(field, parser?)` | ||
|
||
Cleaned up some internal types, added better type documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.