feat: add new schemas package using zod, bring acc validation package… #801
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR replaces #660 which never got reviewed due to its size. It adds a new package, @lit-protocol/schemas which contains zod schemas we can use for input/output validation and as a connection between our constants and types
The packages dependency graph is as follows:

@lit-procotol/constants
as the most base package and containing our constants values definedas const
. Optionally, they can have types to help unify multiple values but those are not needed to be exposed@lit-protocol/schemas
as a child of constants. Its purpose is to define zod schemas, based on constants if needed, to provide complex runtime validations. This package is not intended for public use as it is internal to this SDK@lit-protocol/types
as a child of schemas. Will derive types from the schemas it needs to derive complex typescript compile time validationsIn this PR there is also a migration of https://github.com/LIT-Protocol/accs-schemas into
@lit-protocol/access-control-conditions-schemas
new package. Original package usesajv
to validate ACCs schemas, that was later imported in the SDK, now with zod in the SDK we can unify both and expose them into a public. This brings the benefit of having to update only one source of truth when adding support for a network in ACCs and a slight bundle reductionType of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: