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

Rewrite Valibot with the pipe function #502

Merged
merged 299 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
299 commits
Select commit Hold shift + click to select a range
dc1f171
using mapped values for test and re-export minBytes
Afsoon Apr 12, 2024
f94e821
Add integer, safeInteger and finite actions
IlyaSemenov Apr 12, 2024
a9f6421
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe
fabian-hiller Apr 12, 2024
b2fb1f4
Refactor includes action and improve tests
fabian-hiller Apr 12, 2024
057236a
Uniform JSDoc comments of actions
fabian-hiller Apr 12, 2024
ca22e27
Remove unnecessary test from includes action
fabian-hiller Apr 12, 2024
b827d6b
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe
fabian-hiller Apr 12, 2024
726382d
✨ feat: add lower case action
xcfox Apr 10, 2024
5dd0b90
✨ feat: add upper case action
xcfox Apr 10, 2024
2debdb9
⚙️ refactor: rename files
xcfox Apr 11, 2024
debe88a
⚙️ refactor: rename to toUpperCase and toLowerCase
xcfox Apr 11, 2024
c329feb
Improve toLowerCase and toUpperCase unit tests
fabian-hiller Apr 12, 2024
d8a2267
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe
fabian-hiller Apr 12, 2024
eff348f
Merge pull request #513 from xcfox/rewrite-with-pipe
fabian-hiller Apr 12, 2024
f6af23e
Merge branch 'rewrite-with-pipe' into rewrite-min-bytes
fabian-hiller Apr 12, 2024
868652a
Fix and improve minBytes action and tests
fabian-hiller Apr 12, 2024
6f036c8
Merge pull request #514 from Afsoon/rewrite-min-bytes
fabian-hiller Apr 12, 2024
95cfdd8
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-bytes-not_bytes
fabian-hiller Apr 12, 2024
f445d5b
Refactor and improve bytes and notBytes action
fabian-hiller Apr 12, 2024
cd75cb8
Merge pull request #517 from EltonLobo07/rewrite-with-pipe-bytes-not_…
fabian-hiller Apr 12, 2024
0387b94
Add maxBytes action with unit and type tests
fabian-hiller Apr 12, 2024
ecf5849
Refactor and improve finite, integer and safeInteger
fabian-hiller Apr 12, 2024
19f1c98
Merge branch 'rewrite-with-pipe' into feat-pipe-integer
fabian-hiller Apr 12, 2024
69430b3
Merge pull request #518 from IlyaSemenov/feat-pipe-integer
fabian-hiller Apr 12, 2024
e815db8
Add asyc implementation to transform action
fabian-hiller Apr 12, 2024
99f71db
Add async tests to parse and safeParse
fabian-hiller Apr 12, 2024
e32879a
Expand omit and pick method to more schemas
fabian-hiller Apr 12, 2024
5f52ef2
Add async implementation and tests to array schema
fabian-hiller Apr 13, 2024
455c058
Move ArrayIssue to other file and refactor imports
fabian-hiller Apr 13, 2024
9ea0997
Add async implementation and tests to pipe method
fabian-hiller Apr 13, 2024
f86b861
credit card action rewrite using new format
Afsoon Apr 13, 2024
2853b4e
prettier format
Afsoon Apr 13, 2024
70b3010
✨ feat: add excludes action
EltonLobo07 Apr 13, 2024
5a67fd5
Add blob schema with unit and type tests
fabian-hiller Apr 13, 2024
ca33db5
Add enum schema with unit and type tests
fabian-hiller Apr 14, 2024
ed27657
Add instance schema with unit and type tests
fabian-hiller Apr 14, 2024
6c5f575
Add lazy schema with unit and type tests
fabian-hiller Apr 14, 2024
e7d1795
Add nan schema with unit and type tests
fabian-hiller Apr 14, 2024
ce236c2
Add null schema with unit and type tests
fabian-hiller Apr 14, 2024
b2078cc
Add symbol schema with unit and type tests
fabian-hiller Apr 14, 2024
1fac8bd
Add undefined schema with unit and type tests
fabian-hiller Apr 14, 2024
94ba93c
Add void schema with unit and type tests
fabian-hiller Apr 14, 2024
327d6a7
Add custom schema with unit and type tests
fabian-hiller Apr 14, 2024
eadcf7f
✨ feat: add minSize action
EltonLobo07 Apr 14, 2024
feab738
✨ feat: add maxSize action
EltonLobo07 Apr 14, 2024
e51cd52
cuid2 validation
Afsoon Apr 14, 2024
568a119
cuid2 type added
Afsoon Apr 14, 2024
c006d65
Improve cuid2 action implementation and tests
fabian-hiller Apr 14, 2024
bb7ebbb
Merge pull request #522 from Afsoon/rewrite-cuid2
fabian-hiller Apr 14, 2024
fd849c9
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-min_size-max_…
fabian-hiller Apr 14, 2024
2e4bce4
Improve minSize and maxSize action tests
fabian-hiller Apr 14, 2024
67cd4df
Merge pull request #521 from EltonLobo07/rewrite-with-pipe-min_size-m…
fabian-hiller Apr 14, 2024
2276382
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-excludes
fabian-hiller Apr 14, 2024
45184e8
Improve excludes action implementation
fabian-hiller Apr 14, 2024
214f3d8
Merge pull request #520 from EltonLobo07/rewrite-with-pipe-excludes
fabian-hiller Apr 14, 2024
9c3c3fa
✨ feat: To max value transformation action type
xcfox Apr 14, 2024
c610ba8
✨ feat: To min value transformation action type
xcfox Apr 14, 2024
096e5d2
Merge branch 'fabian-hiller:rewrite-with-pipe' into rewrite-with-pipe
xcfox Apr 14, 2024
93ef15d
Merge branch 'rewrite-with-pipe' into rewrite-credit-card
fabian-hiller Apr 14, 2024
534ce0b
Improve creditCard implementation and tests
fabian-hiller Apr 14, 2024
ec60471
Improve issue type of various actions
fabian-hiller Apr 14, 2024
aee72b8
Merge pull request #519 from Afsoon/rewrite-credit-card
fabian-hiller Apr 14, 2024
c2e747a
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe
fabian-hiller Apr 15, 2024
13a6876
Improve toMaxValue and toMinValue impl. and tests
fabian-hiller Apr 15, 2024
c12006d
feat(bic): add ISO 9362 action
mxdvl Apr 15, 2024
5f5f274
Reorder properties of action objects
fabian-hiller Apr 15, 2024
894506e
Improve bic action implementation and tests
fabian-hiller Apr 15, 2024
8e4c3b9
Merge pull request #524 from mxdvl/pipe-actions/bic
fabian-hiller Apr 15, 2024
b41b063
Add literal schema with unit and type tests
fabian-hiller Apr 15, 2024
44b50d4
Add set schema with unit and type tests
fabian-hiller Apr 15, 2024
08cf0c7
Add map schema with unit and type tests
fabian-hiller Apr 15, 2024
df4abc0
feat(actions): add `isoTime`
mxdvl Apr 15, 2024
24a95cb
✨ feat: add email action
EltonLobo07 Apr 16, 2024
f6f3832
feat(actions): add `isoTimestamp`
macarie Apr 16, 2024
7665a97
feat(actions): validate timestamps with offsets
macarie Apr 16, 2024
22ca283
mac, mac48 & mac64 validation
Afsoon Apr 17, 2024
aa74467
format code
Afsoon Apr 17, 2024
1557c4b
✨ feat: add hexColor action
EltonLobo07 Apr 18, 2024
6c290b0
ip, ipv4 and ipv6 validations
Afsoon Apr 18, 2024
34e158b
✨ feat: add hexadecimal action
EltonLobo07 Apr 18, 2024
79ebbd6
Refactor and improve library code of rewrite
fabian-hiller Apr 21, 2024
bd7d883
Add record schema with unit and type tests
fabian-hiller Apr 21, 2024
a273fdd
Add entriesFromList util
fabian-hiller Apr 21, 2024
0acc8e5
Remove unused import statements
fabian-hiller Apr 21, 2024
7431e8a
Add tests to _isAllowedObjectKey and entriesFromList util
fabian-hiller Apr 22, 2024
4ffd430
Merge branch 'rewrite-with-pipe' into pipe-actions/iso-time
fabian-hiller Apr 22, 2024
8f3d076
Improve isoTime action implementation and tests
fabian-hiller Apr 22, 2024
844fb50
Merge pull request #526 from mxdvl/pipe-actions/iso-time
fabian-hiller Apr 22, 2024
3022bc6
✨ feat: add every action
EltonLobo07 Apr 22, 2024
28622ea
✨ feat: add some action
EltonLobo07 Apr 22, 2024
e199f24
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-email
fabian-hiller Apr 23, 2024
8023fea
Improve email action implementation and tests
fabian-hiller Apr 23, 2024
a46535a
Merge pull request #528 from EltonLobo07/rewrite-with-pipe-email
fabian-hiller Apr 23, 2024
41be57b
Merge branch 'rewrite-with-pipe' into iso-timestamp-new-pipe
fabian-hiller Apr 23, 2024
bb91b3b
Improve isoTimestamp action implementation and tests
fabian-hiller Apr 23, 2024
28331a0
Merge pull request #530 from macarie/iso-timestamp-new-pipe
fabian-hiller Apr 23, 2024
73642ff
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-hex_color
fabian-hiller Apr 23, 2024
f23096b
Improve hexColor action implementation and tests
fabian-hiller Apr 23, 2024
07b61a6
Merge pull request #533 from EltonLobo07/rewrite-with-pipe-hex_color
fabian-hiller Apr 23, 2024
6251602
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-hexadecimal
fabian-hiller Apr 23, 2024
9d2a008
Improve hexadecimal action implementation and tests
fabian-hiller Apr 23, 2024
39f1b23
Merge pull request #535 from EltonLobo07/rewrite-with-pipe-hexadecimal
fabian-hiller Apr 23, 2024
4102781
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-every
fabian-hiller Apr 23, 2024
8d29a1e
Improve every action implementation and tests
fabian-hiller Apr 23, 2024
87b1e33
Merge pull request #541 from EltonLobo07/rewrite-with-pipe-every
fabian-hiller Apr 23, 2024
0447815
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-some
fabian-hiller Apr 23, 2024
0d39080
Improve some action implementation and tests
fabian-hiller Apr 23, 2024
c20aa87
Merge pull request #542 from EltonLobo07/rewrite-with-pipe-some
fabian-hiller Apr 23, 2024
dfcf95d
Merge branch 'rewrite-with-pipe' into rewrite-ip-validations
fabian-hiller Apr 23, 2024
c6b91c2
Improve ip, ipv4 and ipv6 action implementation and tests
fabian-hiller Apr 23, 2024
80a267f
Merge pull request #534 from Afsoon/rewrite-ip-validations
fabian-hiller Apr 23, 2024
8a23b66
Merge branch 'rewrite-with-pipe' into rewrite-mac-validations
fabian-hiller Apr 23, 2024
45a7b8a
Improve mac, mac48 and mac64 action implementation and tests
fabian-hiller Apr 24, 2024
4252e4f
Merge pull request #532 from Afsoon/rewrite-mac-validations
fabian-hiller Apr 24, 2024
e596a31
✨ feat: add check action
EltonLobo07 Apr 24, 2024
0edb572
Expand check action tests and fix description
fabian-hiller Apr 24, 2024
61cd0b3
Merge pull request #545 from EltonLobo07/rewrite-with-pipe-check
fabian-hiller Apr 24, 2024
99358cc
✨ feat: add startsWith action
EltonLobo07 Apr 27, 2024
c6c9eec
✨ feat: add endsWith action
EltonLobo07 Apr 27, 2024
d846275
Add additional test cases to unit tests of startsWith
fabian-hiller Apr 28, 2024
5a8695e
Merge pull request #550 from EltonLobo07/rewrite-with-pipe-starts_with
fabian-hiller Apr 28, 2024
b37e22c
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-ends_with
fabian-hiller Apr 28, 2024
2d633b4
Add additional test cases to endsWith and startsWith
fabian-hiller Apr 28, 2024
306ea32
Merge pull request #551 from EltonLobo07/rewrite-with-pipe-ends_with
fabian-hiller Apr 28, 2024
15d4dd5
✨ feat: add multipleOf action
EltonLobo07 Apr 28, 2024
fcadbb0
✨ feat: add length action
EltonLobo07 Apr 29, 2024
7dd977e
Improve multipleOf implementation and tests
fabian-hiller Apr 29, 2024
2f01ce4
Merge pull request #552 from EltonLobo07/rewrite-with-pipe-multiple_of
fabian-hiller Apr 29, 2024
c390da8
Refactor type tests of length action
fabian-hiller Apr 29, 2024
75e6d54
Merge pull request #554 from EltonLobo07/rewrite-with-pipe-length
fabian-hiller Apr 29, 2024
af71602
Fix type issue in creditCard action
fabian-hiller May 1, 2024
7f9b664
Improve arrayAsync to behave similar to sync version
fabian-hiller May 1, 2024
b44121a
Refactor IP and MAC regex due to treeshake problems
fabian-hiller May 1, 2024
5367771
✨ feat: add octal action
EltonLobo07 May 1, 2024
d451d1e
Add tuple schemas with unit and type tests
fabian-hiller May 2, 2024
2da4bf0
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-octal
fabian-hiller May 2, 2024
ae40161
Improve unit tests of octal action
fabian-hiller May 2, 2024
9a26ebb
Merge pull request #558 from EltonLobo07/rewrite-with-pipe-octal
fabian-hiller May 2, 2024
3d59aa3
✨ feat: add emoji action
EltonLobo07 May 2, 2024
7d0bf5d
Add nonNullable, nonNullish and nonOptional schema
fabian-hiller May 4, 2024
f65682b
Change generic implementation of lazy schema
fabian-hiller May 4, 2024
6ccc52c
Add lazyAsync schema and improve question mark detection
fabian-hiller May 4, 2024
ed58120
✨ feat: add hash action
EltonLobo07 May 4, 2024
ef264d4
Refactor pipe types to improve naming consistency
fabian-hiller May 4, 2024
b1ffa9d
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-emoji
fabian-hiller May 4, 2024
c1ac794
Improve emoji regex and fix unit tests
fabian-hiller May 4, 2024
0b05a21
Add \n escape char to emtpy string tests
fabian-hiller May 4, 2024
c260663
Upgrade GitHub actions and workflows
fabian-hiller May 4, 2024
44b50f4
Merge pull request #559 from EltonLobo07/rewrite-with-pipe-emoji
fabian-hiller May 4, 2024
7558d86
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-hash
fabian-hiller May 4, 2024
7be59f9
Merge pull request #561 from EltonLobo07/rewrite-with-pipe-hash
fabian-hiller May 4, 2024
4b9be5e
✨ feat: add size action
EltonLobo07 May 5, 2024
4b4bd42
Add hint for alternativ schemas to object and tuple schema
fabian-hiller May 5, 2024
a12c531
Add docs TODO comment to question mark schema types
fabian-hiller May 5, 2024
60493a1
feat: add ulid and uuid actions
AndreyYolkin May 5, 2024
647c303
chore: fix test name
AndreyYolkin May 5, 2024
f7c1d61
chore: prettier
AndreyYolkin May 5, 2024
bc45c05
Add union schema with unit and type tests
fabian-hiller May 6, 2024
dbd5805
feat(pipe): add isoDate methods
mxdvl May 6, 2024
49eff1f
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe
fabian-hiller May 6, 2024
fc1749d
Improve unit tests of ulid and uuid action
fabian-hiller May 6, 2024
0f46f2d
Merge branch 'rewrite-with-pipe' into mxdvl/rewrite-with-pipe/iso-date
fabian-hiller May 6, 2024
60103e0
feat(pipe): add isoDateTime validation
mxdvl May 6, 2024
0b77670
Improve unit tests of isoDate, isoTime and isoTimestamp
fabian-hiller May 6, 2024
ee4151f
Merge pull request #564 from mxdvl/mxdvl/rewrite-with-pipe/iso-date
fabian-hiller May 6, 2024
3a77242
Improve comments of size action
fabian-hiller May 6, 2024
aa4cc4c
Merge pull request #562 from EltonLobo07/rewrite-with-pipe-size
fabian-hiller May 6, 2024
d52f20d
Merge branch 'rewrite-with-pipe' into mxdvl/rewrite-with-pipe/iso-dat…
fabian-hiller May 6, 2024
4b85eb9
Improve unit tests of isoDateTime action
fabian-hiller May 6, 2024
394cc3b
Merge pull request #565 from mxdvl/mxdvl/rewrite-with-pipe/iso-date-time
fabian-hiller May 6, 2024
3f66d8c
feat: add isoTimeSecond validation
mxdvl May 6, 2024
c6b7158
feat(rewrite-with-pipe): add isoWeek action
mxdvl May 7, 2024
12671ce
Fix object types and refactor question mark types
fabian-hiller May 7, 2024
bdf343a
Refactor types to improve TS output and consistency
fabian-hiller May 8, 2024
227f132
Add variant schema with unit and type tests
fabian-hiller May 8, 2024
64b6759
Add export and improve comments of isoTimeSecond
fabian-hiller May 9, 2024
6fa1a67
Make unit tests of isoTime uniform to other
fabian-hiller May 9, 2024
3915bec
Merge pull request #566 from mxdvl/mxdvl/rewrite-with-pipe/iso-time-s…
fabian-hiller May 9, 2024
570de10
Fix comments and improve unit tests of isoWeek action
fabian-hiller May 9, 2024
11d7c89
Merge pull request #568 from mxdvl/mxdvl/rewrite-with-pipe/iso-week
fabian-hiller May 9, 2024
07c15f6
Add intersect schema with unit and type tests
fabian-hiller May 10, 2024
87095b2
✨ feat: add value action
EltonLobo07 May 12, 2024
f522425
Improve getDefault method and refactor code
fabian-hiller May 13, 2024
571594c
Add getDefaults, fallback, getFallback and getFallbacks
fabian-hiller May 13, 2024
ca15041
Add imei action with unit and type tests
fabian-hiller May 14, 2024
09ac8a0
Merge pull request #577 from MrGeniusProgrammer/rewrite-with-pipe-imei
fabian-hiller May 14, 2024
b07f52b
Improve unit tests of value action
fabian-hiller May 14, 2024
ee477b9
Merge pull request #575 from EltonLobo07/rewrite-with-pipe-value
fabian-hiller May 14, 2024
da9fd31
Improve and refactor type declarations
fabian-hiller May 14, 2024
fb55d28
Add unwrap method with unit and type tests
fabian-hiller May 14, 2024
75683f9
✨ feat: add regex action
EltonLobo07 May 15, 2024
11d560a
Add forward method with unit and type tests
fabian-hiller May 15, 2024
e3c75c8
Add keyof method with unit and type tests
fabian-hiller May 16, 2024
023cb87
Add readonly action with unit and type tests
fabian-hiller May 16, 2024
e9eb24d
Improve and refactor types
fabian-hiller May 16, 2024
7b7116b
Add readonly example to object and record type tests
fabian-hiller May 16, 2024
e716fc8
Move ValiError into utils folder
fabian-hiller May 16, 2024
c5c90a0
Fix and improve default of nullable, nullish and optional schema
fabian-hiller May 18, 2024
9e4cb21
✨ feat: add mimeType action
EltonLobo07 May 18, 2024
dff2338
feat: `notLength` action
AndreyYolkin May 18, 2024
c7cf2f9
feat: `notSize` action
AndreyYolkin May 18, 2024
5a60553
fix: add missing reexport of `notSize`
AndreyYolkin May 18, 2024
17e8825
chore: make notLength tests more consistent
AndreyYolkin May 18, 2024
98090c9
feat: `notValue` action
AndreyYolkin May 18, 2024
495a229
chore: prettier
AndreyYolkin May 18, 2024
41b9d45
Add partial and required method with unit and type tests
fabian-hiller May 18, 2024
1f1d7c4
Fix async bug in custom Vitest utils
fabian-hiller May 18, 2024
73433f1
Add generic types for better developer experience
fabian-hiller May 18, 2024
85ffa99
Add missing async types for complex schemas
fabian-hiller May 18, 2024
e83f9e8
Add flatten method without unit and type tests
fabian-hiller May 18, 2024
19686cc
Add empty and nonEmpty action with unit and type tests
fabian-hiller May 18, 2024
c6032a8
Improve and refactor regex action and its tests
fabian-hiller May 19, 2024
a63b962
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe-regex
fabian-hiller May 19, 2024
6cc8624
Merge pull request #578 from EltonLobo07/rewrite-with-pipe-regex
fabian-hiller May 19, 2024
fdba6b2
Improve and refactor mimeType action and its tests
fabian-hiller May 19, 2024
2b33f97
Merge pull request #579 from EltonLobo07/rewrite-with-pipe-mime_type
fabian-hiller May 19, 2024
7ee673d
Refactor type tests of regex action
fabian-hiller May 19, 2024
82c21e2
Improve notLength, notSize and notValue action and tests
fabian-hiller May 19, 2024
c877bba
Merge branch 'rewrite-with-pipe' into rewrite-with-pipe--not-actions
fabian-hiller May 19, 2024
8fef443
Merge pull request #580 from AndreyYolkin/rewrite-with-pipe--not-actions
fabian-hiller May 19, 2024
bd97d96
Change comment and refactor export statement
fabian-hiller May 19, 2024
d4f2471
Add checkAsync action with unit and type tests
fabian-hiller May 19, 2024
eb8ba99
Fix type of omit and pick method for async schemas
fabian-hiller May 20, 2024
1b0a21a
Add partialAsync method with unit and type tests
fabian-hiller May 20, 2024
d4e1c29
Add requiredAsync method with unit and type tests
fabian-hiller May 20, 2024
4cafcd6
Add customAsync schema with unit and type tests
fabian-hiller May 20, 2024
cf2145c
Add intersectAsync schema with unit and type tests
fabian-hiller May 20, 2024
1ffabbc
Add looseObjectAsync schema with unit and type tests
fabian-hiller May 20, 2024
2d9efe5
Add looseTupleAsync schema with unit and type tests
fabian-hiller May 20, 2024
8543955
Add objectAsync schema with unit and type tests
fabian-hiller May 20, 2024
f719f46
Add objectWithRestAsync schema with unit and type tests
fabian-hiller May 20, 2024
10a41d1
Add strictObjectAsync schema with unit and type tests
fabian-hiller May 20, 2024
9aa690d
Add strictTupleAsync schema with unit and type tests
fabian-hiller May 20, 2024
05f9697
Add tupleAsync schema with unit and type tests
fabian-hiller May 20, 2024
e97c16c
Add tupleWithRestAsync schema with unit and type tests
fabian-hiller May 20, 2024
8ec65fb
Add unit and type tests for nonNullableAsync schema
fabian-hiller May 20, 2024
14563cc
Add unit and type tests for nonNullishAsync schema
fabian-hiller May 20, 2024
3a9a8bd
Add unit and type tests for nonOptionalAsync schema
fabian-hiller May 20, 2024
2eaef12
Add unit and type tests for nullableAsync schema
fabian-hiller May 20, 2024
d874347
Add unit and type tests for nullishAsync schema
fabian-hiller May 20, 2024
39546df
Add unit and type tests for optionalAsync schema
fabian-hiller May 20, 2024
0ca7de6
Add recordAsync schema with unit and type tests
fabian-hiller May 20, 2024
febe08c
Add mapAsync schema with unit and type tests
fabian-hiller May 20, 2024
291a427
Add setAsync schema with unit and type tests
fabian-hiller May 20, 2024
145c1ce
Add unionAsync schema with unit and type tests
fabian-hiller May 20, 2024
6241e0b
Add variantAsync schema with unit and type tests
fabian-hiller May 20, 2024
3573e82
Add unit and type tests for lazyAsync schema
fabian-hiller May 20, 2024
95c0246
Bump version to v0.31.0-rc.0 and update readme and changelog
fabian-hiller May 20, 2024
9d9ed90
Fix bundle size info for code example in readme
fabian-hiller May 21, 2024
4fc5333
Merge branch 'main' into rewrite-with-pipe
fabian-hiller May 21, 2024
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
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 8
Expand All @@ -22,7 +22,7 @@ runs:
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: ./.github/actions/pnpm

Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: ./.github/actions/pnpm
- name: Prettier check
Expand All @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: ./.github/actions/pnpm
- name: ESLint check
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: ./.github/actions/pnpm
- name: Vitest tests
Expand All @@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: ./.github/actions/pnpm
- name: Prettier check
Expand All @@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: ./.github/actions/pnpm
- name: ESLint check
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ First you create a schema that describes a structured data set. A schema can be

<!-- prettier-ignore -->
```ts
import { email, minLength, object, type Output, parse, string } from 'valibot'; // 1.54 kB
import * as v from 'valibot'; // 1.21 kB

// Create login schema with email and password
const LoginSchema = object({
email: string([email()]),
password: string([minLength(8)]),
const LoginSchema = v.object({
email: v.pipe(v.string(), v.email()),
password: v.pipe(v.string(), v.minLength(8)),
});

// Infer output TypeScript type of login schema
type LoginData = Output<typeof LoginSchema>; // { email: string; password: string }
type LoginData = v.InferOutput<typeof LoginSchema>; // { email: string; password: string }

// Throws error for `email` and `password`
parse(LoginSchema, { email: '', password: '' });
v.parse(LoginSchema, { email: '', password: '' });

// Returns data as { email: string; password: string }
parse(LoginSchema, { email: 'jane@example.com', password: '12345678' });
v.parse(LoginSchema, { email: 'jane@example.com', password: '12345678' });
```

Apart from `parse` I also offer a non-exception-based API with `safeParse` and a type guard function with `is`. You can read more about it [here](https://valibot.dev/guides/parse-data/).
Expand Down
59 changes: 27 additions & 32 deletions library/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,19 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended-typescript-error',
'plugin:regexp/recommended',
'plugin:security/recommended',
'plugin:security/recommended-legacy',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import', 'redos-detector'],
rules: {
// Enable rules -----------------------------------------------------------

// Import
'import/extensions': ['error', 'always'], // Require file extensions

// Regexp
'regexp/no-super-linear-move': 'error', // Prevent DoS regexps
'regexp/no-control-character': 'error', // Avoid unneeded regexps characters
'regexp/no-octal': 'error', // Avoid unneeded regexps characters
'regexp/no-standalone-backslash': 'error', // Avoid unneeded regexps characters
'regexp/prefer-escape-replacement-dollar-char': 'error', // Avoid unneeded regexps characters
'regexp/prefer-quantifier': 'error', // Avoid unneeded regexps characters
'regexp/hexadecimal-escape': ['error', 'always'], // Avoid unneeded regexps characters
'regexp/sort-alternatives': 'error', // Avoid unneeded regexps characters
'regexp/require-unicode-regexp': 'error', // /u flag is faster and enables regexp strict mode
'regexp/prefer-regexp-exec': 'error', // Enforce that RegExp#exec is used instead of String#match if no global flag is provided, as exec is faster

// TypeScript
'@typescript-eslint/consistent-type-definitions': 'error', // Enforce declaring types using `interface` keyword for better TS performance.

// Redos detector
'redos-detector/no-unsafe-regex': ['error', { ignoreError: true }], // Prevent DoS regexps

// Disable rules ----------------------------------------------------------

// Default
'no-duplicate-imports': 'off',

// TypeScript
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',

// Imports
'no-duplicate-imports': 'off',
'import/extensions': ['error', 'always'],
// Import
'import/extensions': ['error', 'always'], // Require file extensions

// JSDoc
'jsdoc/tag-lines': ['error', 'any', { startLines: 1 }],
Expand Down Expand Up @@ -77,6 +48,30 @@ module.exports = {
},
],

// Regexp
'regexp/no-super-linear-move': 'error', // Prevent DoS regexps
'regexp/no-control-character': 'error', // Avoid unneeded regexps characters
'regexp/no-octal': 'error', // Avoid unneeded regexps characters
'regexp/no-standalone-backslash': 'error', // Avoid unneeded regexps characters
'regexp/prefer-escape-replacement-dollar-char': 'error', // Avoid unneeded regexps characters
'regexp/prefer-quantifier': 'error', // Avoid unneeded regexps characters
'regexp/hexadecimal-escape': ['error', 'always'], // Avoid unneeded regexps characters
'regexp/sort-alternatives': 'error', // Avoid unneeded regexps characters
'regexp/require-unicode-regexp': 'error', // /u flag is faster and enables regexp strict mode
'regexp/prefer-regexp-exec': 'error', // Enforce that RegExp#exec is used instead of String#match if no global flag is provided, as exec is faster

// Redos detector
'redos-detector/no-unsafe-regex': ['error', { ignoreError: true }], // Prevent DoS regexps

// Disable rules ----------------------------------------------------------

// TypeScript
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',

// Imports
'no-duplicate-imports': 'off',

// Security
'security/detect-object-injection': 'off', // Too many false positives
'security/detect-unsafe-regex': 'off', // Too many false positives, see https://github.com/eslint-community/eslint-plugin-security/issues/28 - we use the redos-detector plugin instead
Expand Down
4 changes: 4 additions & 0 deletions library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the library will be documented in this file.

## v0.31.0 (Month DD, YYYY)

- More details will follow soon

## v0.30.0 (March 06, 2024)

- Add `Default` and `DefaultAsync` type and refactor codebase
Expand Down
14 changes: 7 additions & 7 deletions library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ First you create a schema that describes a structured data set. A schema can be

<!-- prettier-ignore -->
```ts
import { email, minLength, object, type Output, parse, string } from 'valibot'; // 1.54 kB
import * as v from 'valibot'; // 1.21 kB

// Create login schema with email and password
const LoginSchema = object({
email: string([email()]),
password: string([minLength(8)]),
const LoginSchema = v.object({
email: v.pipe(v.string(), v.email()),
password: v.pipe(v.string(), v.minLength(8)),
});

// Infer output TypeScript type of login schema
type LoginData = Output<typeof LoginSchema>; // { email: string; password: string }
type LoginData = v.InferOutput<typeof LoginSchema>; // { email: string; password: string }

// Throws error for `email` and `password`
parse(LoginSchema, { email: '', password: '' });
v.parse(LoginSchema, { email: '', password: '' });

// Returns data as { email: string; password: string }
parse(LoginSchema, { email: 'jane@example.com', password: '12345678' });
v.parse(LoginSchema, { email: 'jane@example.com', password: '12345678' });
```

Apart from `parse` I also offer a non-exception-based API with `safeParse` and a type guard function with `is`. You can read more about it [here](https://valibot.dev/guides/parse-data/).
Expand Down
2 changes: 1 addition & 1 deletion library/jsr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@valibot/valibot",
"version": "0.30.0",
"version": "0.31.0-rc.0",
"exports": "./src/index.ts"
}
36 changes: 18 additions & 18 deletions library/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "valibot",
"description": "The modular and TypeScript-first schema library",
"version": "0.30.0",
"description": "The modular and type safe schema library for validating structural data",
"version": "0.31.0-rc.0",
"license": "MIT",
"author": "Fabian Hiller",
"homepage": "https://valibot.dev",
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"scripts": {
"play": "tsm ./playground.ts",
"test": "vitest",
"test": "vitest --typecheck",
"coverage": "vitest run --coverage --isolate",
"lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
"eslint.fix": "eslint \"src/**/*.ts*\" --fix",
Expand All @@ -53,21 +53,21 @@
"publish": "npm publish && npx jsr publish"
},
"devDependencies": {
"@types/eslint": "^8.40.2",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"@vitest/coverage-v8": "^0.33.0",
"eslint": "^8.43.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-redos-detector": "^2.1.1",
"eslint-plugin-regexp": "^1.15.0",
"eslint-plugin-security": "^1.7.1",
"jsdom": "^22.1.0",
"@types/eslint": "^8.56.7",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.2",
"eslint-plugin-redos-detector": "^2.4.0",
"eslint-plugin-regexp": "^2.4.0",
"eslint-plugin-security": "^2.1.1",
"jsdom": "^24.0.0",
"tsm": "^2.3.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vite": "^4.4.6",
"vitest": "^0.33.0"
"tsup": "^8.0.2",
"typescript": "^5.4.3",
"vite": "^5.2.7",
"vitest": "1.4.0"
}
}
41 changes: 41 additions & 0 deletions library/src/actions/bic/bic.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { describe, expectTypeOf, test } from 'vitest';
import type { InferInput, InferIssue, InferOutput } from '../../types/index.ts';
import { bic, type BicAction, type BicIssue } from './bic.ts';

describe('bic', () => {
describe('should return action object', () => {
test('with undefined message', () => {
type Action = BicAction<string, undefined>;
expectTypeOf(bic<string>()).toEqualTypeOf<Action>();
expectTypeOf(bic<string, undefined>(undefined)).toEqualTypeOf<Action>();
});

test('with string message', () => {
expectTypeOf(bic<string, 'message'>('message')).toEqualTypeOf<
BicAction<string, 'message'>
>();
});

test('with function message', () => {
expectTypeOf(bic<string, () => string>(() => 'message')).toEqualTypeOf<
BicAction<string, () => string>
>();
});
});

describe('should infer correct types', () => {
type Action = BicAction<string, undefined>;

test('of input', () => {
expectTypeOf<InferInput<Action>>().toEqualTypeOf<string>();
});

test('of output', () => {
expectTypeOf<InferOutput<Action>>().toEqualTypeOf<string>();
});

test('of issue', () => {
expectTypeOf<InferIssue<Action>>().toEqualTypeOf<BicIssue<string>>();
});
});
});
Loading