Commit Graph
1580 Commits
Author SHA1 Message Date
Giulio Canti e4151b7543 add arbitrary generation (#151)
* add arbitrary generation

* improve SchemaToJsonSchema

* add bundle

* makeLazy

* add Context

* more recursive tests

* fix annotations

* add filter management

* add tuple checks

* add struct checks

* try to reduce bundle

* add @rollup/plugin-replace for environment variable handling and update error messages in SchemaAST

* fix structWithRest check

* fix index signatures parsing

* simplify stringMatching algo

* fix is / asserts

* more tests

* date checks

* bigint checks

* fix context passing

* docs

* use reset context
2025-06-09 08:08:31 +02:00
Michael ArnaldiandGiulio Canti 6258206a71 test immer without dependency (#148)
* test immer without dependency

* add equality tests

* make classes immerable by default

* remove workaround

* remove duplicated test

---------

Co-authored-by: Giulio Canti <giulio.canti@gmail.com>
2025-06-08 07:26:47 +02:00
Michael Arnaldi fb462d84c8 Avoid using defineProperty in hash for compatibility with frozen objects (#154) 2025-06-07 11:33:08 +02:00
Tim b0c0493140 improve batch grouping (#153) 2025-06-06 15:34:26 +12:00
Tim c6eb09e6cf propagate context in Effect.addFinalizer (#152) 2025-06-06 15:00:08 +12:00
Giulio Canti 53d8b52851 json schema generation (#150)
* json schema generation

* tuples

* object

* more tests

* add bundle

* handle documentation annotation
2025-06-05 16:55:38 +02:00
Giulio Canti 48cdb3be47 add test for immer compatibility (#147) 2025-06-03 17:02:49 +02:00
Giulio Canti a017ecd217 Add NonEmptyArray schema support (#146) 2025-06-03 16:34:03 +02:00
Giulio Canti 49e24417a3 Add size checks to SchemaCheck (#145) 2025-06-03 12:27:48 +02:00
Giulio Canti f939c6de83 add support for structural filters (#144)
* better default error messages

* use symbol in isSchema

* add support for structural filters

* chore

* add minEntries / maxEntries
2025-06-03 12:07:42 +02:00
Giulio Canti fdb8d96bc3 fix contextual make (#143)
* fix contextual make

* fix other APIs + more tests

* update tstyche

* docs

* add Opaque test
2025-06-03 08:41:58 +02:00
Giulio Canti 22c05c7d3e add check method (#142)
* add check method

* update docs
2025-05-31 17:42:01 +02:00
Giulio Canti 4860a66b0d Add key annotations support (#141)
- Introduced `Schema.annotateKey` for annotating keys and elements in schemas.
- Updated `SchemaAST` and `SchemaIssue` to handle annotations in error reporting.
- Enhanced `SchemaFormatter` to display annotations in error messages.
- Added tests for key annotations in both Struct and Tuple schemas.
2025-05-31 16:43:50 +02:00
Giulio Canti 64247af171 Add standard schema support (#140)
* Update fast-check to version 4.1.1 and add new decoding/encoding promise APIs in Schema module

* add standard schema

* return a schema from standardSchemaV1
2025-05-31 15:11:37 +02:00
Giulio Canti 2ea49170ae fix make (#139) 2025-05-31 08:50:35 +02:00
Giulio Canti e23e273c47 Refactor index signatures (#138)
* rename to Record

* handle record mutability

* replace StructWithRest with withRecord API

* more tests

* renaming

* handle post rest elements

* chore

* StructWithRest + TupleWithRest

* rename ReadonlyTuple to Tuple

* rename ReadonlyArray to Array

* docs

* fix mutability model
2025-05-30 16:22:11 +02:00
Giulio Canti a5f1560845 Simplify template literals impl (#137)
* Rename StructAndRest to StructWithRest

* add bundle to check current size

* simplify impl

* remove boolean

* add support for BigInt

* should use the encoded sides

* Refactor TemplateLiteral to expose parts

* add support for filters

* remove internal getTemplateLiteralRegExp

* add checks to format

* better transformation support

* add TemplateLiteralParser

* hide impl details

* docs
2025-05-29 09:01:32 +02:00
Giulio Canti 65a4564f66 add is / asserts (#136) 2025-05-27 16:33:07 +02:00
Giulio Canti 3bac0de276 unify filters, refinements, brands (#135)
* unify filters, refinements, brands

* refactoring

* add brand to filter annotations
2025-05-27 15:28:35 +02:00
Giulio Canti 5a12828f51 refactor checkEffect as transformation (#134)
* should be possible to define a class with a mutable field

* docs: recursive patterns

* chore

* remove make API interface

* more TemplateLiteral tests

* add NoInfer

* add missing "~rebuild.out"

* chore

* refactor checkEffect as transformation

* chore

* add example
2025-05-26 15:25:25 +02:00
Giulio Canti 6029e7c360 simplify flip (#133) 2025-05-24 18:21:41 +02:00
Giulio Canti 7cc2ad3e8a add missing SchemaToParser APIs (#132)
* add missing SchemaToParser APIs

* chore

* uniform bundles

* fix benchmarks
2025-05-24 17:13:25 +02:00
Giulio Canti 0454f8ae3a refactor refine and brand (#131)
* remove checkEncoded

* refactor refine and brand
2025-05-23 15:04:56 +02:00
Giulio Canti ebb3f8d47e add decode / encode APIs + renaming (#130)
* add decode / encode APIs + renaming

* fix bundle

* all transformation as functions

* rename SchemaParser to SchemaToParser

* fix

* remove useless transformations

* fix bundles

* enhance decodeTo / encodeTo to act as composition operators
2025-05-22 17:02:16 +02:00
Giulio Canti 84045cb8a2 add mutable (#129)
* flip doc + type level tests

* add mutable Array

* Enhance withConstructorDefault to accept input parameter and update tests to validate behavior

* add mutable
2025-05-21 19:35:07 +02:00
Giulio Canti 78336988e5 Schema changes (#128)
* simplify makeSync failure message

* brands as Set

* Result.transposeMapOption from v3

* functions

* tmp

* fix constructorDefault signature

* update major version

* refactor signatures

* remove useless annotations

* fix encodedCodec API interface

* refactor Context

* remove SchemaAnnotations.Annotable

* remove EncodedFromKey

* fix suspend Api interface

* remove ~encoded.make.in

* make MakeIn type parameter optional

* fix flip API interface
2025-05-21 16:35:49 +02:00
Giulio Canti 94167dbd0b more on optional fields (#127)
* more on optional fields

* renaming

* fix optionalKey and mutableKey

* docs

* chore

* refactor SchemaGetter

* simplify code

* refactor issues and SchemaGetter

* update docs

* simplify
2025-05-19 14:55:33 +02:00
Giulio Canti 24adeb811a Duration: align toString behavior with other data types (#126)
- Update module code from v3
- Add tests
2025-05-14 17:03:31 +02:00
Giulio Canti a3e7b14c19 Update schema-string-async to use clock-based sleep (#124) 2025-05-14 13:20:28 +02:00
Giulio Canti 0131180cd0 Layer: replace static block with getter to improve bundle size (#123) 2025-05-14 13:04:34 +02:00
Giulio Canti cb3aa1d3c9 Update Rollup configuration to enable compression and mangling in the Terser plugin (#122) 2025-05-14 12:42:53 +02:00
Giulio Canti 5c18947c61 add SchemaAnnotations module and improve decodeTo / encodeTo APIs (#121)
* re-add annotate method

* add SchemaAnnotations module

* improve decodeTo / encodeTo APIs

* make annotate more general

* make Filter, FilterGroup, SchemaGetter pipeables

* bundles: target esm
2025-05-14 12:34:13 +02:00
Giulio Canti dafe2c0f5d fix brand type and impl (#120) 2025-05-12 19:38:33 +02:00
Giulio Canti aa22b33c52 Refactor numeric filters (#119)
* fix Class constructor defaults

* refactor order checks
2025-05-12 17:03:33 +02:00
Giulio Canti de181070e7 upgrade to latest tstyche and remove ts-expect-error comments (#118)
* upgrade to latest tstyche and remove ts-expect-error comments

* move tstyche configuration file
2025-05-12 12:07:47 +02:00
Giulio Canti f5b26b2feb annotate as pipe-able function (#117)
* Refactor schema annotation method to use pipe syntax for consistency across schema operations

* renaming

* rename SchemaValidator to SchemaParser

* move make from schemas to SchemaParser

* fix bundle imports

* rename serialization annotation

* simplify makeClass impl
2025-05-12 10:39:35 +02:00
Giulio Canti 6fa7b1209b refactor StructuredFormatter (#116) 2025-05-10 12:18:36 +02:00
Giulio Canti eb656d3b3e add support for exclusive unions (#115)
* rename makeUnsafe to makeSync

* add support for "oneOf" unions

* rename CodecError to SchemaError

* rename issues

* add OneOf issue
2025-05-10 10:28:39 +02:00
Giulio Canti ecefa243be remove Either module (#114) 2025-05-09 18:18:46 +02:00
Giulio Canti a882dd9652 add middleware + catch* + checkEffect* (#112)
* add middleware + catch + checkEffect*

* remove formatUnknown from makeUnsafe

* renaming
2025-05-09 15:38:12 +02:00
Giulio Canti ba8cf2ee41 abort as filter combinator (#111) 2025-05-08 12:52:53 +02:00
Giulio Canti 18be2385f5 simplify filters and remove middlewares (#110)
* simplify filters and remove middlewares

* fix bundle/schema-async

* rename
2025-05-08 10:50:39 +02:00
Giulio Canti 13576faf2b add opt-in branding to Class APIs (#109) 2025-05-07 18:38:12 +02:00
Giulio Canti 9706300ec4 add Enums (#108) 2025-05-07 18:12:39 +02:00
Giulio Canti 3dfef6977b schema compiler methods (#107)
* typeAST

* flip

* attempt 2

* parser
2025-05-07 16:27:20 +02:00
Giulio Canti 699eddb7b7 SchemaSerializerJson: add serialize / deserialize helpers (#106)
* SchemaSerializerJson: add serialize / deserialize helpers

* better docs

* fix imports
2025-05-07 11:46:17 +02:00
Giulio Canti ba55397f48 Class APIs (#103)
* Class APIs

* add extend static method

* first draft of RequestClass

* chore
2025-05-07 08:57:22 +02:00
Tim c9945d0d0d remove unused import 2025-05-07 17:05:03 +12:00
Tim 15cb775b8b remove keepAlive from runMain 2025-05-07 16:27:38 +12:00
Tim 0d2b39903d NodeStream improvements (#104) 2025-05-07 10:22:52 +12:00