Releases: TheAppleFreak/moleculer-zod-validator
v3.3.1
v3.3.0
- Added the
.return
propertyy toZodParams
. This is a utility to store return types that can be used for typing action calls elsewhere. - Updated dev dependencies
v3.2.0
v3.1.0
Type inference now works (mostly) as expected! While the runtime behavior of the package worked as expected during work on 3.0.0 and was what I had been testing, I somehow was completely unaware that type inference was completely broken. It's a bit embarrassing for me, to be honest. It took more energy than I had anticipated to make it work, but type inferences now behave when using typeof .call
and typeof .context
almost exactly as they do in Zod with z.input<typeof validator>
and z.infer<typeof validator>
/z.output<typeof validator>
. This closes Issues #2 and #5 in the process.
I do say almost, as there is an important note that is worth mentioning. There's a known upstream bug in Zod where using .catchall()
results in bugged TypeScript type inference. While I could have left that behavior in ZodParams for parity with Zod, the sudden introduction of that behavior could break builds (it already broke one of our tests, through no fault of my own), so for the time being I've disabled catchall type inference in ZodParams. When the bug is fixed upstream, I'll reenable that behavior here.
Beyond all of this, there should be no other changes and everything should Just Work™ as expected.
v3.0.1
Rerelease to hopefully get the readme showing up on NPM as it should. No changes have been made from v3.0.0.
- BREAKING CHANGE - The minimum compatible Node.js version is now Node.js v17.0.0. This is due to the requirement of the structuredClone function in the fastest-validator fallback (described below), which in Node.js is only available in v17.0.0 and above.
- Added support for passing in fastest-validator schemas. This is required because the $node internal services built into Moleculer assume that fastest-validator is the current validator, which poses a problem given as moleculer-zod-validator had no idea what to do with those schemas. By checking for the existence of property in the Zod schema that is not used in fastest-validator, this can now automatically switch into a failsafe that uses fastest-validator instead.
v3.0.0
- BREAKING CHANGE - The minimum compatible Node.js version is now Node.js v17.0.0. This is due to the requirement of the structuredClone function in the fastest-validator fallback (described below), which in Node.js is only available in v17.0.0 and above.
- Added support for passing in fastest-validator schemas. This is required because the $node internal services built into Moleculer assume that fastest-validator is the current validator, which poses a problem given as moleculer-zod-validator had no idea what to do with those schemas. By checking for the existence of property in the Zod schema that is not used in fastest-validator, this can now automatically switch into a failsafe that uses fastest-validator instead.
v2.0.0
Added support for parameter transformations! Read the docs for more information on it. Please note this is a breaking change.
v1.0.2 - listen I swear I know how to code
protip for any aspiring typescript devs out there: when you're publishing, remember to include your build output in the tarball you publish
v1.0.1
Turns out publishing a tarball with no build files included is a bad idea. Who knew?
v1.0.0
Initial release